/*!
 * Crafted with ❤ by Salla
 */
'use strict';

var index = require('./index-vstkdqRz.js');

const sallaOrderDetailsCss = "";

const SallaOrderDetails = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
    }
    parseOrderDetailsData(newValue) {
        this.parsedOrderDetailsData = newValue;
        if (typeof this.orderDetails === 'string') {
            this.parsedOrderDetailsData = JSON.parse(newValue);
        }
        else {
            this.parsedOrderDetailsData = newValue;
        }
    }
    componentWillLoad() {
        this.parseOrderDetailsData(this.orderDetails);
        console.log('Parent componentWillLoad - parsedOrderDetailsData:', this.parsedOrderDetailsData);
    }
    renderOrderDetailsContent() {
        // Check if we have parsed data
        if (!this.parsedOrderDetailsData) {
            console.warn('No parsedOrderDetailsData available');
            return null;
        }
        return [
            /* Product Options */
            this.parsedOrderDetailsData.options && this.parsedOrderDetailsData.options.length > 0 && (index.h("salla-order-details-options", { options: this.parsedOrderDetailsData.options })),
            /* Bundle Subproducts */
            this.parsedOrderDetailsData.sub_products &&
                this.parsedOrderDetailsData.sub_products.length > 0 && (index.h(index.Fragment, null, index.h("h2", { class: "s-order-details-bundle-title" }, salla.lang.get('pages.orders.sub_products')), index.h("div", { class: "s-order-details-bundle-content" }, this.parsedOrderDetailsData.sub_products.map(product => (index.h("salla-order-details-multiple-bundle-product", { key: product?.id, productDetails: product })))))),
        ];
    }
    render() {
        return index.h(index.Host, { key: '41599687bddf4d4b9eda3572ce39b93a0d8f596d', class: "s-order-details-wrapper" }, this.renderOrderDetailsContent());
    }
    static get watchers() { return {
        "orderDetails": ["parseOrderDetailsData"]
    }; }
};
SallaOrderDetails.style = sallaOrderDetailsCss;

exports.salla_order_details = SallaOrderDetails;
