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

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

const SallaFulfillmentMethods = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
        this.methods = [];
        this.shouldRender = false;
    }
    async componentDidLoad() {
        await Salla.onReady();
        await Salla.lang.onLoaded();
        if (!Salla.config.get('store.support_pickup'))
            return;
        this.shouldRender = true;
        this.setLabels();
    }
    setLabels() {
        this.methods = [
            {
                id: 'delivery',
                title: Salla.lang.getWithDefault('pages.products.promise_delivery_title', 'متاح للتوصيل'),
                subtitle: Salla.lang.getWithDefault('pages.products.promise_delivery_subtitle', 'طلبك يوصلك لباب البيت بسهولة.'),
                iconClass: 'sicon-location',
            },
            {
                id: 'pickup',
                title: Salla.lang.getWithDefault('pages.products.promise_pickup_title', 'متاح للاستلام'),
                subtitle: Salla.lang.getWithDefault('pages.products.promise_pickup_subtitle', 'استلام فوري من أقرب فرع.'),
                iconClass: 'sicon-store',
            },
        ];
    }
    render() {
        if (!this.shouldRender)
            return null;
        return (index.h(index.Host, { class: "s-fulfillment-methods" }, index.h("div", { class: "s-fulfillment-methods-list" }, this.methods.map((method) => (index.h("div", { key: method.id, class: "s-fulfillment-methods-card" }, index.h("div", { class: "s-fulfillment-methods-content" }, index.h("div", { class: "s-fulfillment-methods-icon-wrap" }, index.h("i", { class: `${method.iconClass} s-fulfillment-methods-icon` })), index.h("div", { class: "s-fulfillment-methods-text" }, index.h("span", { class: "s-fulfillment-methods-title" }, method.title), index.h("span", { class: "s-fulfillment-methods-subtitle" }, method.subtitle)))))))));
    }
};

exports.salla_fulfillment_methods = SallaFulfillmentMethods;
