UNPKG

@salla.sa/twilight-components

Version:
65 lines (61 loc) 2.81 kB
/*! * Crafted with ❤ by Salla */ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client'; const SallaFulfillmentMethods$1 = /*@__PURE__*/ proxyCustomElement(class SallaFulfillmentMethods extends HTMLElement { constructor() { super(); this.__registerHost(); this.methods = []; this.shouldRender = false; } async componentDidLoad() { await Salla.onReady(); await Salla.lang.onLoaded(); if (!Salla.config.get('store.shipping.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 (h(Host, { class: "s-fulfillment-methods" }, h("div", { class: "s-fulfillment-methods-list" }, this.methods.map((method) => (h("div", { key: method.id, class: "s-fulfillment-methods-card" }, h("div", { class: "s-fulfillment-methods-content" }, h("div", { class: "s-fulfillment-methods-icon-wrap" }, h("i", { class: `${method.iconClass} s-fulfillment-methods-icon` })), h("div", { class: "s-fulfillment-methods-text" }, h("span", { class: "s-fulfillment-methods-title" }, method.title), h("span", { class: "s-fulfillment-methods-subtitle" }, method.subtitle))))))))); } }, [0, "salla-fulfillment-methods", { "methods": [32], "shouldRender": [32] }]); function defineCustomElement$1() { if (typeof customElements === "undefined") { return; } const components = ["salla-fulfillment-methods"]; components.forEach(tagName => { switch (tagName) { case "salla-fulfillment-methods": if (!customElements.get(tagName)) { customElements.define(tagName, SallaFulfillmentMethods$1); } break; } }); } defineCustomElement$1(); const SallaFulfillmentMethods = SallaFulfillmentMethods$1; const defineCustomElement = defineCustomElement$1; export { SallaFulfillmentMethods, defineCustomElement };