@salla.sa/twilight-components 2.13.96 → 2.13.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/app-globals-c5340b59.js.map +1 -1
- package/dist/cjs/salla-add-product-button_48.cjs.entry.js +2 -2
- package/dist/cjs/salla-add-product-button_48.cjs.entry.js.map +1 -1
- package/dist/cjs/salla-product-options.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-options.cjs.entry.js.map +1 -1
- package/dist/collection/components/salla-add-product-button/salla-add-product-button.js +4 -4
- package/dist/collection/components/salla-add-product-button/salla-add-product-button.js.map +1 -1
- package/dist/collection/components/salla-product-options/salla-product-options.js +1 -1
- package/dist/collection/components/salla-product-options/salla-product-options.js.map +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/salla-add-product-button2.js +2 -2
- package/dist/components/salla-add-product-button2.js.map +1 -1
- package/dist/components/salla-product-options.js +1 -1
- package/dist/components/salla-product-options.js.map +1 -1
- package/dist/components/salla-quick-buy2.js.map +1 -1
- package/dist/esm/app-globals-0280e1d0.js.map +1 -1
- package/dist/esm/salla-add-product-button_48.entry.js +2 -2
- package/dist/esm/salla-add-product-button_48.entry.js.map +1 -1
- package/dist/esm/salla-product-options.entry.js +1 -1
- package/dist/esm/salla-product-options.entry.js.map +1 -1
- package/dist/esm-es5/app-globals-0280e1d0.js.map +1 -1
- package/dist/esm-es5/salla-add-product-button_48.entry.js +1 -1
- package/dist/esm-es5/salla-add-product-button_48.entry.js.map +1 -1
- package/dist/esm-es5/salla-product-options.entry.js +1 -1
- package/dist/esm-es5/salla-product-options.entry.js.map +1 -1
- package/dist/twilight/{p-903962d6.system.entry.js → p-20adfb95.system.entry.js} +2 -2
- package/dist/twilight/p-20adfb95.system.entry.js.map +1 -0
- package/dist/twilight/p-4a9df09e.js.map +1 -1
- package/dist/twilight/p-4c2194e3.system.js.map +1 -1
- package/dist/twilight/p-54e1a882.system.js +1 -1
- package/dist/twilight/{p-d5b85f12.system.entry.js → p-6786413f.system.entry.js} +2 -2
- package/dist/twilight/{p-d5b85f12.system.entry.js.map → p-6786413f.system.entry.js.map} +1 -1
- package/dist/twilight/{p-c612fde8.entry.js → p-8b0dbb9b.entry.js} +2 -2
- package/dist/twilight/p-8b0dbb9b.entry.js.map +1 -0
- package/dist/twilight/{p-84bf4247.entry.js → p-af69a687.entry.js} +2 -2
- package/dist/twilight/{p-84bf4247.entry.js.map → p-af69a687.entry.js.map} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/components/salla-add-product-button/salla-add-product-button.d.ts +1 -1
- package/dist/types/components.d.ts +2 -2
- package/package.json +5 -5
- package/dist/twilight/p-903962d6.system.entry.js.map +0 -1
- package/dist/twilight/p-c612fde8.entry.js.map +0 -1
- package/dist/types/global.d.ts +0 -20
|
@@ -160,8 +160,8 @@ const SallaAddProductButton = /*@__PURE__*/ proxyCustomElement(class SallaAddPro
|
|
|
160
160
|
's-add-product-button-with-apple-pay': this.showQuickBuy && this.isApplePayActive
|
|
161
161
|
} }, h("div", { class: {
|
|
162
162
|
's-add-product-button-main': this.showQuickBuy,
|
|
163
|
-
'w-full': !document.getElementById('fast-checkout-js'), // This is a temporary fix until all themes fully support the fast checkout -- To be removed later
|
|
164
|
-
} }, h("salla-button", Object.assign({ color: this.productStatus === 'sale' ? 'primary' : 'light', type: "button", fill: this.productStatus === 'sale' ? 'solid' : 'outline', ref: el => this.btn = el, onClick: event => this.addProductToCart(event), disabled: this.productStatus !== 'sale' }, this.getBtnAttributes(), { "loader-position": "center" }), h("slot", null)), this.showQuickBuy && !!document.getElementById('fast-checkout-js') ? this.miniCheckoutWidget() : ''), this.showQuickBuy && this.isApplePayActive ? h("salla-quick-buy", Object.assign({}, this.getQuickBuyBtnAttributes())) : '');
|
|
163
|
+
'w-full': !document.getElementById('fast-checkout-js') || ['financial_support', 'donating'].includes(this.productType) // This is a temporary fix until all themes fully support the fast checkout -- To be removed later
|
|
164
|
+
} }, h("salla-button", Object.assign({ color: this.productStatus === 'sale' ? 'primary' : 'light', type: "button", fill: this.productStatus === 'sale' ? 'solid' : 'outline', ref: el => this.btn = el, onClick: event => this.addProductToCart(event), disabled: this.productStatus !== 'sale' }, this.getBtnAttributes(), { "loader-position": "center" }), h("slot", null)), this.showQuickBuy && !!document.getElementById('fast-checkout-js') && ['financial_support', 'donating'].includes(this.productType) ? this.miniCheckoutWidget() : ''), this.showQuickBuy && this.isApplePayActive ? h("salla-quick-buy", Object.assign({}, this.getQuickBuyBtnAttributes())) : '');
|
|
165
165
|
}
|
|
166
166
|
componentDidLoad() {
|
|
167
167
|
if (!this.notifyOptionsAvailability) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"salla-add-product-button2.js","mappings":";;;;;;;;;;;;;;;;;;;AAAA,MAAM,wBAAwB,GAAG,sEAAsE;;MCS1F,qBAAqB;EAChC;;;;;IAMQ,mBAAc,GAAQ,EAAE,CAAC;;;;;;;;;yBA8C2C,MAAM;uBAKuD,SAAS;;;2BAW3G,EAAE;;;sBAGX,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,wBAAwB,CAAC;IAtEpE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC;MAClB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;KAC5D,CAAC,CAAC;GACJ;EA4EO,QAAQ;IACd,IAAI,IAAI,CAAC,aAAa,KAAK,MAAM,IAAI,IAAI,CAAC,gBAAgB,IAAI,MAAM,CAAC,UAAU,IAAI,GAAG,IAAI,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,gBAAgB,EAAE;MACpI,OAAOA,iBAAI,CAAC;KACb;IAED,IAAI,IAAI,CAAC,aAAa,KAAK,MAAM,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,EAAE;MACnE,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;KAC9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,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CACvE,CAAC;OACH;WAAM;QACL,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,iBAAiB,KAAK,MAAM,IAAI,IAAI,CAAC,iBAAiB,KAAK,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,GAAG,IACtK,GAAG,CAAC,KAAK,CAAC,EAAE,IAAI,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CACvE,GAAG,KAAK,CAAC;OACX;KACF,CAAC,CAAC;GAGJ;EAED,kBAAkB;;;IAEhB,IAAI,CAAC,CAAC,IAAI,CAAC,WAAW,KAAK,CAAC,IAAI,CAAC,gBAAgB,IAAI,MAAM,CAAC,UAAU,IAAI,GAAG,CAAC,EAAE;;MAE9E,MAAA,IAAI,CAAC,GAAG,0CAAE,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;MACnC,OAAO;KACR;IACD,MAAA,IAAI,CAAC,GAAG,0CAAE,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAA;IAElC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,gBAAM,OAAA,MAAA,IAAI,CAAC,GAAG,0CAAE,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAA,EAAA,CAAC,CAAC;GAC/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["Cart"],"sources":["src/components/salla-add-product-button/salla-add-product-button.css?tag=salla-add-product-button","src/components/salla-add-product-button/salla-add-product-button.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\nsalla-add-product-button[width=wide] {\n width: 100%;\n}\n\n","import { Component, Element, State, Event, EventEmitter, Host, Prop, h } from '@stencil/core';\nimport Cart from '../../assets/svg/cart.svg';\n// import SallaIcon from '../../assets/svg/salla.svg';\nimport WalletIcon from '../../assets/svg/full-wallet.svg';\n\n@Component({\n tag: 'salla-add-product-button',\n styleUrl: 'salla-add-product-button.css'\n})\nexport class SallaAddProductButton {\n constructor() {\n salla.lang.onLoaded(() => {\n this.buyNowText = salla.lang.get('pages.products.buy_now');\n });\n }\n\n private hostAttributes: any = {};\n private btn?: HTMLSallaButtonElement;\n private passedLabel: string;\n\n /**\n * Channels.\n */\n @Prop({ reflect: true }) channels: string;\n\n /**\n * Subscribed Options ex: \"[[139487,2394739],[1212,1544]]\"\n */\n @Prop() subscribedOptions: string;\n\n /**\n * Support Quick Pay Button\n */\n @Prop({ reflect: true, mutable: true }) quickBuy: boolean;\n\n /**\n * Product Quantity\n */\n @Prop({ reflect: true }) quantity: number;\n\n /**\n * Donating amount.\n */\n @Prop({ reflect: true }) donatingAmount: number;\n\n /**\n * Listen to product options availability.\n */\n @Prop({ reflect: true }) notifyOptionsAvailability: boolean;\n\n /**\n * Product id\n */\n @Prop({ reflect: true }) productId;\n\n /**\n * Support themes that have a sticky bar\n */\n @Prop({ reflect: true }) supportStickyBar: boolean;\n /**\n * Product Status.Defaults to `sale`\n */\n @Prop({ reflect: true }) productStatus: 'sale' | 'out' | 'out-and-notify' = 'sale';\n\n /**\n * Product type. Defaults to `product`\n */\n @Prop({ reflect: true }) productType: 'product' | 'service' | 'codes' | 'digital' | 'food' | 'donating' | 'group_products' | 'booking' = 'product';\n\n /**\n * Custome DOM event emitter when product gets added to cart successfully.\n */\n @Event() success: EventEmitter;\n\n @State() hasOutOfStockOption: boolean;\n\n @State() hasSubscribedOptions: boolean;\n\n @State() selectedOptions: Array<any> = [];\n @State() showQuickBuy: boolean;\n @State() isApplePayActive: boolean;\n @State() buyNowText: string = salla.lang.get('pages.products.buy_now');\n\n /**\n * Custome DOM event emitter when product addition to cart fails.\n */\n @Event() failed: EventEmitter;\n\n @Element() host: HTMLElement;\n\n private getLabel() {\n if (this.productStatus === 'sale' && this.supportStickyBar && window.innerWidth <= 768 && this.showQuickBuy && this.isApplePayActive) {\n return Cart;\n }\n\n if (this.productStatus === 'sale' && this.productType === 'booking') {\n return salla.lang.get('pages.cart.book_now');\n }\n\n if (this.productStatus === 'sale') {\n return salla.lang.get('pages.cart.add_to_cart');\n }\n\n if (this.productType !== 'donating') {\n return salla.lang.get('pages.products.out_of_stock');\n }\n\n // donating\n return salla.lang.get('pages.products.donation_exceed');\n }\n\n private addProductToCart(event) {\n\n if (this.productType === 'booking') {\n event.preventDefault();\n return this.addBookingProduct();\n }\n\n // we want to ignore the click action when the type of button is submit a form\n if (this.hostAttributes.type === 'submit') {\n return false;\n }\n event.preventDefault();\n\n this.btn?.disable();\n /**\n * by default the quick add is just an alias for add item function\n * but its work only when the id is the only value is passed via the object\n * so we will filter the object entities to remove null and zero values in case we don't want the normal add item action\n */\n const data: any = Object.entries({\n id: this.productId,\n donation_amount: this.donatingAmount,\n quantity: this.quantity,\n endpoint: 'quickAdd'\n }).reduce((a, [k, v]) => (v ? (a[k] = v, a) : a), {})\n return salla.cart.addItem(data)\n .then(response => {\n this.selectedOptions = [];\n this.btn?.enable();\n this.success.emit(response);\n })\n .catch(error => { this.failed.emit(error); this.btn?.enable(); });\n }\n\n private addBookingProduct() {\n if (salla.config.isGuest()) {\n salla.auth.api.setAfterLoginEvent('booking::add', this.productId);\n salla.event.dispatch('login::open');\n return;\n }\n return salla.booking.add(this.productId)\n .then(resp => this.success.emit(resp))\n .catch(error => this.failed.emit(error))\n }\n\n private getBtnAttributes() {\n for (let i = 0; i < this.host.attributes.length; i++) {\n if (!['id', 'class'].includes(this.host.attributes[i].name)) {\n this.hostAttributes[this.host.attributes[i].name] = this.host.attributes[i].value;\n }\n }\n\n return this.hostAttributes;\n }\n\n private getQuickBuyBtnAttributes() {\n return {\n ...this.getBtnAttributes(),\n type: this.supportStickyBar && window.innerWidth <= 768 ? 'plain' : this.productType == 'donating' ? 'donate' : 'buy'\n }\n }\n private miniCheckoutWidget() {\n let storeId = salla.config.get('store.id');\n if (!storeId) {\n return;\n }\n return <salla-mini-checkout-widget\n language={salla.lang.locale}\n store-id={storeId}\n config={{user:salla.config.get('user')}}\n products={[this.productId]}\n api={salla.config.get('store.api')}\n outline\n form-selector=\"form.product-form\"\n class=\"s-add-product-button-mini-checkout\"\n >\n {/* {window.innerWidth <= 768 && this.isApplePayActive && this.supportStickyBar ? <div slot=\"widget-label\">\n <span innerHTML={SallaIcon}></span>\n </div> : ''} */} \n\n <div slot=\"widget-label\" class=\"s-add-product-button-mini-checkout-content\">\n <span innerHTML={WalletIcon}></span>\n {this.buyNowText}\n </div>\n </salla-mini-checkout-widget>\n }\n\n\n componentWillLoad() {\n return salla.onReady()\n .then(() => {\n this.showQuickBuy = this.quickBuy\n && salla.config.get('store.settings.buy_now')\n && this.productStatus == 'sale'\n && this.productType !== 'booking';\n\n this.isApplePayActive = window.ApplePaySession?.canMakePayments()\n && salla.config.get('store.settings.payments')?.includes('apple_pay')\n && salla.config.get('store.settings.is_salla_gateway', false);\n\n this.passedLabel = this.host.innerHTML.replace('<!---->', '').trim();\n if (!!this.passedLabel && window.innerWidth >= 768) {\n return this.btn?.setText(this.passedLabel);\n }\n \n if (this.host.getAttribute('type') === 'submit' && this.supportStickyBar) {\n window.addEventListener('resize', () => this.btn?.setText((window.innerWidth >= 768 && !!this.passedLabel) ? this.passedLabel : this.getLabel()));\n }\n })\n }\n\n\n render() {\n //TODO:: find a better fix, this is a patch for issue that duplicates the buttons more than twice @see the screenshot inside this folder\n if (this.host.closest('.swiper-slide')?.classList.contains('swiper-slide-duplicate')) {\n return ''\n }\n if (this.hasSubscribedOptions) {\n return <Host>\n <salla-product-availability {...this.getBtnAttributes()} is-subscribed={true}>\n <span class=\"s-hidden\"><slot /></span>\n </salla-product-availability>\n </Host>;\n }\n\n if ((this.productStatus === 'out-and-notify' && this.channels) || this.hasOutOfStockOption) {\n return <Host>\n <salla-product-availability {...this.getBtnAttributes()}>\n <span class=\"s-hidden\"><slot /></span>\n </salla-product-availability>\n </Host>;\n }\n\n return <Host class={{\n 's-add-product-button-with-quick-buy': this.showQuickBuy,\n 's-add-product-button-with-sticky-bar': this.supportStickyBar,\n 's-add-product-button-with-apple-pay': this.showQuickBuy && this.isApplePayActive\n }}>\n <div class={{\n 's-add-product-button-main': this.showQuickBuy,\n 'w-full': !document.getElementById('fast-checkout-js'), // This is a temporary fix until all themes fully support the fast checkout -- To be removed later\n }}>\n <salla-button color={this.productStatus === 'sale' ? 'primary' : 'light'}\n type=\"button\"\n fill={this.productStatus === 'sale' ? 'solid' : 'outline'}\n ref={el => this.btn = el as HTMLSallaButtonElement}\n onClick={event => this.addProductToCart(event)}\n disabled={this.productStatus !== 'sale'}\n {...this.getBtnAttributes()}\n loader-position=\"center\"\n >\n <slot />\n </salla-button>\n {this.showQuickBuy && !!document.getElementById('fast-checkout-js') ? this.miniCheckoutWidget() : ''}\n </div>\n {this.showQuickBuy && this.isApplePayActive ? <salla-quick-buy {...this.getQuickBuyBtnAttributes()} /> : ''}\n </Host>;\n }\n\n componentDidLoad() {\n if (!this.notifyOptionsAvailability) {\n return;\n }\n\n salla.event.on('product-options::change', async data => {\n if (!['thumbnail', 'color', 'single-option'].includes(data.option.type)) {\n return;\n }\n this.hasSubscribedOptions = false;\n this.selectedOptions = await (document.querySelector(`salla-product-options[product-id=\"${this.productId}\"]`) as any)?.getSelectedOptions();\n this.hasOutOfStockOption = await (document.querySelector(`salla-product-options[product-id=\"${this.productId}\"]`) as any)?.hasOutOfStockOption();\n let subscribedDetails = salla.storage.get(`product-${this.productId}-subscribed-options`);\n\n if (!subscribedDetails && !this.subscribedOptions || !this.hasOutOfStockOption) {\n return;\n }\n\n if (salla.config.isGuest()) {\n const parsedSubscribedDetails = subscribedDetails ? subscribedDetails.map(ids => ids.split(',').map(id => parseInt(id))) : [];\n\n this.hasSubscribedOptions = parsedSubscribedDetails.length > 0 && parsedSubscribedDetails.some(ids =>\n ids.every(id => this.selectedOptions.some(option => option.id === id))\n );\n } else {\n this.hasSubscribedOptions = this.subscribedOptions && this.subscribedOptions !== 'null' && this.subscribedOptions !== '[]' ? JSON.parse(this.subscribedOptions).some(ids =>\n ids.every(id => this.selectedOptions.some(option => option.id === id))\n ) : false;\n }\n });\n\n\n }\n\n componentDidRender(): void {\n //if label not passed, get label\n if (!!this.passedLabel && (!this.supportStickyBar || window.innerWidth >= 768)) {\n // if passed label, set it\n this.btn?.setText(this.passedLabel)\n return;\n }\n this.btn?.setText(this.getLabel())\n\n salla.lang.onLoaded(() => this.btn?.setText(this.getLabel()));\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"salla-add-product-button2.js","mappings":";;;;;;;;;;;;;;;;;;;AAAA,MAAM,wBAAwB,GAAG,sEAAsE;;MCS1F,qBAAqB;EAChC;;;;;IAMQ,mBAAc,GAAQ,EAAE,CAAC;;;;;;;;;yBA8C2C,MAAM;uBAK6E,SAAS;;;2BAWjI,EAAE;;;sBAGX,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,wBAAwB,CAAC;IAtEpE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC;MAClB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;KAC5D,CAAC,CAAC;GACJ;EA4EO,QAAQ;IACd,IAAI,IAAI,CAAC,aAAa,KAAK,MAAM,IAAI,IAAI,CAAC,gBAAgB,IAAI,MAAM,CAAC,UAAU,IAAI,GAAG,IAAI,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,gBAAgB,EAAE;MACpI,OAAOA,iBAAI,CAAC;KACb;IAED,IAAI,IAAI,CAAC,aAAa,KAAK,MAAM,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,EAAE;MACnE,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;KAC9C;IAED,IAAI,IAAI,CAAC,aAAa,KAAK,MAAM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B,CAAC,IAAI,CAAC,GAAG,IAChG,GAAG,CAAC,KAAK,CAAC,EAAE,IAAI,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CACvE,CAAC;OACH;WAAM;QACL,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,iBAAiB,KAAK,MAAM,IAAI,IAAI,CAAC,iBAAiB,KAAK,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,GAAG,IACtK,GAAG,CAAC,KAAK,CAAC,EAAE,IAAI,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CACvE,GAAG,KAAK,CAAC;OACX;KACF,CAAC,CAAC;GAGJ;EAED,kBAAkB;;;IAEhB,IAAI,CAAC,CAAC,IAAI,CAAC,WAAW,KAAK,CAAC,IAAI,CAAC,gBAAgB,IAAI,MAAM,CAAC,UAAU,IAAI,GAAG,CAAC,EAAE;;MAE9E,MAAA,IAAI,CAAC,GAAG,0CAAE,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;MACnC,OAAO;KACR;IACD,MAAA,IAAI,CAAC,GAAG,0CAAE,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAA;IAElC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,gBAAM,OAAA,MAAA,IAAI,CAAC,GAAG,0CAAE,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAA,EAAA,CAAC,CAAC;GAC/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["Cart"],"sources":["src/components/salla-add-product-button/salla-add-product-button.css?tag=salla-add-product-button","src/components/salla-add-product-button/salla-add-product-button.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\nsalla-add-product-button[width=wide] {\n width: 100%;\n}\n\n","import { Component, Element, State, Event, EventEmitter, Host, Prop, h } from '@stencil/core';\nimport Cart from '../../assets/svg/cart.svg';\n// import SallaIcon from '../../assets/svg/salla.svg';\nimport WalletIcon from '../../assets/svg/full-wallet.svg';\n\n@Component({\n tag: 'salla-add-product-button',\n styleUrl: 'salla-add-product-button.css'\n})\nexport class SallaAddProductButton {\n constructor() {\n salla.lang.onLoaded(() => {\n this.buyNowText = salla.lang.get('pages.products.buy_now');\n });\n }\n\n private hostAttributes: any = {};\n private btn?: HTMLSallaButtonElement;\n private passedLabel: string;\n\n /**\n * Channels.\n */\n @Prop({ reflect: true }) channels: string;\n\n /**\n * Subscribed Options ex: \"[[139487,2394739],[1212,1544]]\"\n */\n @Prop() subscribedOptions: string;\n\n /**\n * Support Quick Pay Button\n */\n @Prop({ reflect: true, mutable: true }) quickBuy: boolean;\n\n /**\n * Product Quantity\n */\n @Prop({ reflect: true }) quantity: number;\n\n /**\n * Donating amount.\n */\n @Prop({ reflect: true }) donatingAmount: number;\n\n /**\n * Listen to product options availability.\n */\n @Prop({ reflect: true }) notifyOptionsAvailability: boolean;\n\n /**\n * Product id\n */\n @Prop({ reflect: true }) productId;\n\n /**\n * Support themes that have a sticky bar\n */\n @Prop({ reflect: true }) supportStickyBar: boolean;\n /**\n * Product Status.Defaults to `sale`\n */\n @Prop({ reflect: true }) productStatus: 'sale' | 'out' | 'out-and-notify' = 'sale';\n\n /**\n * Product type. Defaults to `product`\n */\n @Prop({ reflect: true }) productType: 'product' | 'service' | 'codes' | 'digital' | 'food' | 'donating' | 'group_products' | 'booking' | 'financial_support' = 'product';\n\n /**\n * Custome DOM event emitter when product gets added to cart successfully.\n */\n @Event() success: EventEmitter;\n\n @State() hasOutOfStockOption: boolean;\n\n @State() hasSubscribedOptions: boolean;\n\n @State() selectedOptions: Array<any> = [];\n @State() showQuickBuy: boolean;\n @State() isApplePayActive: boolean;\n @State() buyNowText: string = salla.lang.get('pages.products.buy_now');\n\n /**\n * Custome DOM event emitter when product addition to cart fails.\n */\n @Event() failed: EventEmitter;\n\n @Element() host: HTMLElement;\n\n private getLabel() {\n if (this.productStatus === 'sale' && this.supportStickyBar && window.innerWidth <= 768 && this.showQuickBuy && this.isApplePayActive) {\n return Cart;\n }\n\n if (this.productStatus === 'sale' && this.productType === 'booking') {\n return salla.lang.get('pages.cart.book_now');\n }\n\n if (this.productStatus === 'sale') {\n return salla.lang.get('pages.cart.add_to_cart');\n }\n\n if (this.productType !== 'donating') {\n return salla.lang.get('pages.products.out_of_stock');\n }\n\n // donating\n return salla.lang.get('pages.products.donation_exceed');\n }\n\n private addProductToCart(event) {\n\n if (this.productType === 'booking') {\n event.preventDefault();\n return this.addBookingProduct();\n }\n\n // we want to ignore the click action when the type of button is submit a form\n if (this.hostAttributes.type === 'submit') {\n return false;\n }\n event.preventDefault();\n\n this.btn?.disable();\n /**\n * by default the quick add is just an alias for add item function\n * but its work only when the id is the only value is passed via the object\n * so we will filter the object entities to remove null and zero values in case we don't want the normal add item action\n */\n const data: any = Object.entries({\n id: this.productId,\n donation_amount: this.donatingAmount,\n quantity: this.quantity,\n endpoint: 'quickAdd'\n }).reduce((a, [k, v]) => (v ? (a[k] = v, a) : a), {})\n return salla.cart.addItem(data)\n .then(response => {\n this.selectedOptions = [];\n this.btn?.enable();\n this.success.emit(response);\n })\n .catch(error => { this.failed.emit(error); this.btn?.enable(); });\n }\n\n private addBookingProduct() {\n if (salla.config.isGuest()) {\n salla.auth.api.setAfterLoginEvent('booking::add', this.productId);\n salla.event.dispatch('login::open');\n return;\n }\n return salla.booking.add(this.productId)\n .then(resp => this.success.emit(resp))\n .catch(error => this.failed.emit(error))\n }\n\n private getBtnAttributes() {\n for (let i = 0; i < this.host.attributes.length; i++) {\n if (!['id', 'class'].includes(this.host.attributes[i].name)) {\n this.hostAttributes[this.host.attributes[i].name] = this.host.attributes[i].value;\n }\n }\n\n return this.hostAttributes;\n }\n\n private getQuickBuyBtnAttributes() {\n return {\n ...this.getBtnAttributes(),\n type: this.supportStickyBar && window.innerWidth <= 768 ? 'plain' : this.productType == 'donating' ? 'donate' : 'buy'\n }\n }\n private miniCheckoutWidget() {\n let storeId = salla.config.get('store.id');\n if (!storeId) {\n return;\n }\n return <salla-mini-checkout-widget\n language={salla.lang.locale}\n store-id={storeId}\n config={{user:salla.config.get('user')}}\n products={[this.productId]}\n api={salla.config.get('store.api')}\n outline\n form-selector=\"form.product-form\"\n class=\"s-add-product-button-mini-checkout\"\n >\n {/* {window.innerWidth <= 768 && this.isApplePayActive && this.supportStickyBar ? <div slot=\"widget-label\">\n <span innerHTML={SallaIcon}></span>\n </div> : ''} */} \n\n <div slot=\"widget-label\" class=\"s-add-product-button-mini-checkout-content\">\n <span innerHTML={WalletIcon}></span>\n {this.buyNowText}\n </div>\n </salla-mini-checkout-widget>\n }\n\n\n componentWillLoad() {\n return salla.onReady()\n .then(() => {\n this.showQuickBuy = this.quickBuy\n && salla.config.get('store.settings.buy_now')\n && this.productStatus == 'sale'\n && this.productType !== 'booking';\n\n this.isApplePayActive = window.ApplePaySession?.canMakePayments()\n && salla.config.get('store.settings.payments')?.includes('apple_pay')\n && salla.config.get('store.settings.is_salla_gateway', false);\n\n this.passedLabel = this.host.innerHTML.replace('<!---->', '').trim();\n if (!!this.passedLabel && window.innerWidth >= 768) {\n return this.btn?.setText(this.passedLabel);\n }\n \n if (this.host.getAttribute('type') === 'submit' && this.supportStickyBar) {\n window.addEventListener('resize', () => this.btn?.setText((window.innerWidth >= 768 && !!this.passedLabel) ? this.passedLabel : this.getLabel()));\n }\n })\n }\n\n\n render() {\n //TODO:: find a better fix, this is a patch for issue that duplicates the buttons more than twice @see the screenshot inside this folder\n if (this.host.closest('.swiper-slide')?.classList.contains('swiper-slide-duplicate')) {\n return ''\n }\n if (this.hasSubscribedOptions) {\n return <Host>\n <salla-product-availability {...this.getBtnAttributes()} is-subscribed={true}>\n <span class=\"s-hidden\"><slot /></span>\n </salla-product-availability>\n </Host>;\n }\n\n if ((this.productStatus === 'out-and-notify' && this.channels) || this.hasOutOfStockOption) {\n return <Host>\n <salla-product-availability {...this.getBtnAttributes()}>\n <span class=\"s-hidden\"><slot /></span>\n </salla-product-availability>\n </Host>;\n }\n\n return <Host class={{\n 's-add-product-button-with-quick-buy': this.showQuickBuy,\n 's-add-product-button-with-sticky-bar': this.supportStickyBar,\n 's-add-product-button-with-apple-pay': this.showQuickBuy && this.isApplePayActive\n }}>\n <div class={{\n 's-add-product-button-main': this.showQuickBuy,\n 'w-full': !document.getElementById('fast-checkout-js') || ['financial_support', 'donating'].includes(this.productType) // This is a temporary fix until all themes fully support the fast checkout -- To be removed later\n }}>\n <salla-button color={this.productStatus === 'sale' ? 'primary' : 'light'}\n type=\"button\"\n fill={this.productStatus === 'sale' ? 'solid' : 'outline'}\n ref={el => this.btn = el as HTMLSallaButtonElement}\n onClick={event => this.addProductToCart(event)}\n disabled={this.productStatus !== 'sale'}\n {...this.getBtnAttributes()}\n loader-position=\"center\"\n >\n <slot />\n </salla-button>\n {this.showQuickBuy && !!document.getElementById('fast-checkout-js') && ['financial_support', 'donating'].includes(this.productType) ? this.miniCheckoutWidget() : ''}\n </div>\n {this.showQuickBuy && this.isApplePayActive ? <salla-quick-buy {...this.getQuickBuyBtnAttributes()} /> : ''}\n </Host>;\n }\n\n componentDidLoad() {\n if (!this.notifyOptionsAvailability) {\n return;\n }\n\n salla.event.on('product-options::change', async data => {\n if (!['thumbnail', 'color', 'single-option'].includes(data.option.type)) {\n return;\n }\n this.hasSubscribedOptions = false;\n this.selectedOptions = await (document.querySelector(`salla-product-options[product-id=\"${this.productId}\"]`) as any)?.getSelectedOptions();\n this.hasOutOfStockOption = await (document.querySelector(`salla-product-options[product-id=\"${this.productId}\"]`) as any)?.hasOutOfStockOption();\n let subscribedDetails = salla.storage.get(`product-${this.productId}-subscribed-options`);\n\n if (!subscribedDetails && !this.subscribedOptions || !this.hasOutOfStockOption) {\n return;\n }\n\n if (salla.config.isGuest()) {\n const parsedSubscribedDetails = subscribedDetails ? subscribedDetails.map(ids => ids.split(',').map(id => parseInt(id))) : [];\n\n this.hasSubscribedOptions = parsedSubscribedDetails.length > 0 && parsedSubscribedDetails.some(ids =>\n ids.every(id => this.selectedOptions.some(option => option.id === id))\n );\n } else {\n this.hasSubscribedOptions = this.subscribedOptions && this.subscribedOptions !== 'null' && this.subscribedOptions !== '[]' ? JSON.parse(this.subscribedOptions).some(ids =>\n ids.every(id => this.selectedOptions.some(option => option.id === id))\n ) : false;\n }\n });\n\n\n }\n\n componentDidRender(): void {\n //if label not passed, get label\n if (!!this.passedLabel && (!this.supportStickyBar || window.innerWidth >= 768)) {\n // if passed label, set it\n this.btn?.setText(this.passedLabel)\n return;\n }\n this.btn?.setText(this.getLabel())\n\n salla.lang.onLoaded(() => this.btn?.setText(this.getLabel()));\n }\n}\n"],"version":3}
|
|
@@ -516,7 +516,7 @@ const SallaProductOptions$1 = /*@__PURE__*/ proxyCustomElement(class SallaProduc
|
|
|
516
516
|
countryOption(option) {
|
|
517
517
|
return h("div", { class: "s-product-options-digital-card-wrapper" }, option.details.map((detail) => {
|
|
518
518
|
var _a;
|
|
519
|
-
return (h("label", { htmlFor: String(detail.id), key: detail.id, class: { "s-product-options-digital-card-option": true, "s-product-options-digital-card-option-stock-out": detail.is_out } }, h("input", { id: String(detail.id), type: "radio", class: "s-form-control s-product-options-digital-card-input", value: detail.id, name: `options[${option.id}]`, required: !option.visibility_condition && option.required, onInvalid: (e) => this.invalidHandler(e, option), onChange: e => this.changedHandler(e, option), checked: ((_a = this.getSelectedDigitalCardOptions(option)) === null || _a === void 0 ? void 0 : _a.id) === detail.id && salla.url.is_page('cart') }), h("div", { class: "s-product-options-country-flag-wrapper" }, h("div", { class: `s-product-options-country-flag flag iti__flag iti__${String(detail.code).toLocaleLowerCase()}` })), h("span", null, detail.name)));
|
|
519
|
+
return (h("label", { htmlFor: String(detail.id), key: detail.id, class: { "s-product-options-digital-card-option": true, "s-product-options-digital-card-option-stock-out": detail.is_out } }, h("input", { id: String(detail.id), type: "radio", class: "s-form-control s-product-options-digital-card-input", value: detail.id, name: `options[${option.id}]`, disabled: detail.is_out, required: !option.visibility_condition && option.required, onInvalid: (e) => this.invalidHandler(e, option), onChange: e => this.changedHandler(e, option), checked: ((_a = this.getSelectedDigitalCardOptions(option)) === null || _a === void 0 ? void 0 : _a.id) === detail.id && salla.url.is_page('cart') }), h("div", { class: "s-product-options-country-flag-wrapper" }, h("div", { class: `s-product-options-country-flag flag iti__flag iti__${String(detail.code).toLocaleLowerCase()}` })), h("span", null, detail.name)));
|
|
520
520
|
}));
|
|
521
521
|
}
|
|
522
522
|
get host() { return this; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"salla-product-options.js","mappings":";;;;;;;;;;;;;;;;;AAAA,IAAY,WAsBX;AAtBD,WAAY,WAAW;EACrB,8BAAe,CAAA;EACf,4BAAa,CAAA;EACb,oCAAqB,CAAA;EACrB,oCAAqB,CAAA;EACrB,8BAAe,CAAA;EACf,oDAAqC,CAAA;EACrC,gCAAiB,CAAA;EACjB,8CAA+B,CAAA;EAC/B,wDAAyC,CAAA;EACzC,kCAAmB,CAAA;EACnB,oCAAqB,CAAA;EACrB,4BAAa,CAAA;EACb,oCAAqB,CAAA;EACrB,sCAAuB,CAAA;EACvB,4BAAa,CAAA;EACb,8BAAe,CAAA;EACf,oCAAqB,CAAA;EACrB,0BAAW,CAAA;EACX,4BAAa,CAAA;EACb,4CAA6B,CAAA;EAC7B,kCAAmB,CAAA;AACrB,CAAC,EAtBW,WAAW,KAAX,WAAW,QAsBtB;AAqID,IAAY,QAEX;AAFD,WAAY,QAAQ;EAClB,uBAAW,CAAA;AACb,CAAC,EAFW,QAAQ,KAAR,QAAQ;;;;;;;;;AC3JpB,MAAM,sBAAsB,GAAG,EAAE;;MCWpBA,qBAAmB;EAE9B;;;;IAuCQ,cAAS,GAA2B;MAC1C,GA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CAAC,MAAM;;MAAK,QAC9B,aAAO,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE,EAAC,uCAAuC,EAAC,IAAI,EAAC,iDAAiD,EAAC,MAAM,CAAC,MAAM,EAAC,IACtK,aAAO,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,IAAI,EAAC,OAAO,EAAC,KAAK,EAAC,qDAAqD,EAAC,KAAK,EAAE,MAAM,CAAC,EAAE,EACrH,IAAI,EAAE,WAAW,MAAM,CAAC,EAAE,GAAG,EAC7B,QAAQ,EAAE,CAAC,MAAM,CAAC,oBAAoB,IAAI,MAAM,CAAC,QAAQ,EACzD,SAAS,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,cAAc,CAAC,CAAC,EAAE,MAAM,CAAC,EAChD,QAAQ,EAAE,CAAC,IAAI,IAAI,CAAC,cAAc,CAAC,CAAC,EAAE,MAAM,CAAC,EAC7C,OAAO,EAAE,CAAA,MAAA,IAAI,CAAC,6BAA6B,CAAC,MAAM,CAAC,0CAAE,EAAE,MAAK,MAAM,CAAC,EAAE,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,GAElG,EACF,WAAK,KAAK,EAAC,wCAAwC,IACjD,WAAK,KAAK,EAAE,sDAAsD,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,iBAAiB,EAAE,EAAE,GAAI,CAC3G,EACN,gBAAQ,MAAM,CAAC,IAAI,CAAQ,CACrB,EACT;KAAA,CAAC,CAEE,CAAA;GAEP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["SallaProductOptions"],"sources":["src/components/salla-product-options/interfaces.ts","src/components/salla-product-options/salla-product-options.scss?tag=salla-product-options","src/components/salla-product-options/salla-product-options.tsx"],"sourcesContent":["export enum DisplayType {\n COLOR = \"color\",\n DATE = \"date\",\n DATETIME = \"datetime\",\n DONATION = \"donation\",\n IMAGE = \"image\",\n MULTIPLE_OPTIONS = \"multiple-options\",\n NUMBER = \"number\",\n SINGLE_OPTION = \"single-option\",\n DIGITAL_CARD_VALUE = \"digital-code-value\",\n COUNTRY = \"country\",\n SPLITTER = \"splitter\",\n TEXT = \"text\",\n TEXTAREA = \"textarea\",\n THUMBNAIL = \"thumbnail\",\n TIME = \"time\",\n RADIO = \"radio\",\n CHECKBOX = \"checkbox\",\n MAP = \"map\",\n FILE = \"file\", // similar to image type (file-uploader component)\n COLOR_PICKER = \"color_picker\",\n BOOKING = \"booking\"\n}\n\nexport interface ProductDetail {\n id: string;\n sku: string;\n name: string;\n description: string;\n url: string;\n promotion_title: string;\n subtitle: string;\n type: string;\n status: string;\n price: number;\n sale_price: number;\n regular_price: number;\n starting_price: null;\n quantity: number;\n max_quantity: number;\n discount_ends: number;\n is_taxable: boolean;\n has_read_more: boolean;\n can_add_note: boolean;\n can_show_remained_quantity: boolean;\n can_upload_file: boolean;\n has_custom_form: boolean;\n is_on_sale: boolean;\n is_hidden_quantity: boolean;\n is_available: boolean;\n is_out_of_stock: boolean;\n weight: null;\n calories: null;\n image: SimpleImage;\n brand: Brand;\n donation?: ProductDonation;\n images: Image[];\n tags: Tag[];\n notify_availability: null;\n rating: Rating;\n options: Option[];\n sold_quantity: number;\n category: Category;\n}\n\nexport interface SimpleImage {\n url: string;\n alt: string;\n}\n\nexport interface Category {\n name: string;\n url: string;\n icon: string;\n}\n\nexport interface ProductDonation {\n target_message?: string;\n collected_amount?: number;\n target_amount?: number;\n target_percent?: number;\n target_end_date?: string;\n can_donate: boolean;\n custom_amount_enabled: boolean;\n}\n\nexport interface Image {\n id: number;\n url: string;\n main: boolean;\n three_d_image_url: string;\n alt: string;\n video_url: string;\n type: string;\n sort: number;\n}\n\nexport interface Option {\n id: number;\n name: string;\n required: boolean;\n type: string;\n placeholder: string;\n option_type: string;\n not_same_day_order: boolean;\n availability_range: number;\n from_date_time: null;\n to_date_time: null;\n visibility_condition?: { option: number, operator: \"=\" | \"!=\", value: number };\n details?: Detail[];\n condition_attributes: string;\n value?: any;\n length?: number;\n donation?: Donation\n}\n\nexport interface Donation {\n custom_amount_enabled: boolean;\n target_message?: string;\n target_date: string | \"2023-04-18\";\n target_end_date: string | \"2023-04-18\";\n target_amount: number;\n collected_amount: number;\n can_donate: boolean;\n}\n\nexport interface Detail {\n id: number;\n option_id: number;\n name: string;\n additional_price: number;\n option_value: null | string;\n image: null | string;\n color: null | string;\n is_out: boolean;\n skus_availability?: { [sku_id: number]: boolean };\n is_selected: boolean;\n is_default?: 0 | 1;\n code?: string;\n type?: string;\n\n}\n\nexport interface Brand {\n id: string;\n url: string;\n name: string;\n logo: string;\n}\n\nexport interface PreTaxPrice {\n amount: number;\n currency: Currency;\n}\n\nexport enum Currency {\n Sar = \"SAR\",\n}\n\nexport interface Promotion {\n title: string;\n sub_title: string;\n}\n\nexport interface Rating {\n count: number;\n stars: number;\n}\n\nexport interface Tag {\n name: string;\n url: string;\n}\n","\n.s-product-options{\n &-wrapper{\n\n }\n &-option-container{\n\n }\n &-option{\n\n }\n &-option-label{\n\n }\n &-option-content{\n\n }\n &-colors-wrapper{\n\n }\n &-date-element{\n\n }\n &-time-element{\n \n }\n &-datetime-element{\n\n }\n &-image-input{\n\n }\n &-multiple-options-wrapper{\n\n }\n &-splitter{\n\n }\n &-text{\n\n }\n &-textarea{\n\n }\n &-thumbnails-wrapper{\n\n }\n}","import { Component, Prop, h, State, Element, Host, Event, type EventEmitter, Method } from '@stencil/core';\nimport { type Option, DisplayType, type Detail } from './interfaces';\nimport CheckCircleIcon from '../../assets/svg/check.svg';\nimport CameraIcon from '../../assets/svg/camera.svg';\nimport FileIcon from '../../assets/svg/file-upload.svg';\n\n\n@Component({\n tag: 'salla-product-options',\n styleUrl: 'salla-product-options.scss',\n})\nexport class SallaProductOptions {\n\n constructor() {\n this.canDisabled = !salla.config.get('store.settings.product.notify_options_availability');\n salla.lang.onLoaded(() => {\n this.outOfStockText = salla.lang.get(\"pages.products.out_of_stock\");\n this.donationAmount = salla.lang.get('pages.products.donation_amount');\n this.selectDonationAmount = salla.lang.getWithDefault('pages.products.select_donation_amount', 'تحديد مبلغ التبرع');\n this.selectAmount = salla.lang.getWithDefault('pages.products.select_amount', 'اختر المبلغ');\n });\n\n if (this.options) {\n try {\n this.setOptionsData(Array.isArray(this.options) ? this.options : JSON.parse(this.options));\n return;\n } catch (e) {\n salla.log('Bad json passed via options prop');\n }\n }\n if (!Array.isArray(this.optionsData)) {\n salla.log('Options is not an array[] ---> ', this.optionsData);\n this.setOptionsData([]);\n }\n\n if (this.productId && !salla.url.is_page('cart')) {\n salla.api.product.getDetails(this.productId, ['options']).then(resp => this.setOptionsData(resp.data.options));\n }\n }\n\n private setOptionsData(optionsData: Option[]) {\n this.optionsData = optionsData;\n const that = this\n this.optionsData[0]?.details?.forEach(function (detail) {\n Object.entries(detail.skus_availability || {})\n .filter(sku => !sku[1])\n .map(sku => that.outSkus.push(Number(sku[0])));\n });\n }\n\n @Element() host: HTMLElement;\n\n private fileTypes: Record<string, string> = {\n pdf: 'application/pdf',\n png: 'image/png',\n jpg: 'image/jpeg',\n word: 'application/doc,application/ms-doc,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n exl: 'application/excel,application/vnd.ms-excel,application/x-excel,application/x-msexcel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n txt: 'text/plain',\n };\n\n @State() optionsData: Option[]\n @State() outOfStockText = \"\"\n @State() donationAmount: string = salla.lang.get('pages.products.donation_amount')\n @State() selectDonationAmount: string = salla.lang.getWithDefault('pages.products.select_donation_amount', 'تحديد مبلغ التبرع')\n @State() selectAmount: string = salla.lang.getWithDefault('pages.products.select_amount', 'اختر المبلغ')\n @State() isCustomDonation = false;\n @State() selectedOptions = [];\n @State() canDisabled: boolean;\n @State() selectedSkus?: Array<string | number>;\n @State() selectedOutSkus?: Array<string | number>;\n @State() availableDigitalCardValues: Detail[] = []\n\n private outSkus: Array<string | number> = [];\n private donationInput?: HTMLInputElement;\n /**\n * Avoid selection of previous default or selected card value option \n * when switching between digital card country options for the 1st time\n */\n private ignoreDefaultCardValue = false\n /**\n * The id of the product to which the options are going to be fetched for.\n */\n @Prop() productId: number = salla.config.get('page.id');\n\n /**\n * Product detail information.\n */\n @Prop() options: string\n\n /**\n * Get the id's of the selected options.\n * */\n @Method()\n async getSelectedOptionsData() {\n const selectedOptions = {}\n const formData = (this.host as HTMLElement & { getElementSallaData: () => FormData }).getElementSallaData();\n formData.forEach((value, key) => {\n if (key.startsWith('options[')) { (selectedOptions[key.replace('options[', '').replace(']', '')] = value) }\n });\n return selectedOptions;\n }\n\n /**\n * Report options form validity.\n * */\n @Method()\n async reportValidity() {\n const requiredElements = this.host.querySelectorAll('[required]') as unknown as Array<HTMLInputElement>;\n let pass = true;\n for (let i = 0; i < requiredElements.length; i++) {\n //if there is only one invalid option, return false\n if ('reportValidity' in requiredElements[i] && !requiredElements[i].reportValidity()) {\n pass = false;\n }\n }\n return pass;\n }\n\n /**\n * Return true if there is any out of stock options are selected and vise versa.\n * */\n @Method()\n async hasOutOfStockOption() {\n return this.selectedOptions.some(option => option.is_out) || (this.selectedSkus?.length && this.selectedSkus?.every(sku => this.outSkus.includes(sku)));\n }\n\n /**\n * Get selected options.\n * */\n @Method()\n async getSelectedOptions() {\n return this.selectedOptions;\n }\n\n /**\n * Get a specific option by its id.\n * */\n @Method()\n async getOption(option_id) {\n return this.optionsData.find(option => option.id === option_id);\n }\n\n /**\n * An event that emitted when any option is changed.\n */\n @Event() changed: EventEmitter;\n\n // @ts-ignore\n private invalidHandler(event, option: Option) {\n const closestProductOption = (event.target as HTMLInputElement).closest('.s-product-options-option') as HTMLElement;\n if (!salla.url.is_page('cart')) {\n closestProductOption.scrollIntoView({ behavior: 'smooth', block: 'center' });\n }\n closestProductOption.classList.add('s-product-options-option-error');\n }\n\n\n\n private changedHandler(event, option) {\n const data = { event: event, option: option, detail: null };\n if (option.details) {\n const detail = option.details.find((detail) => {\n return Number(detail.id) === Number(event.target.value);\n });\n data.detail = detail\n }\n\n if (option.type === 'country') {\n this.handleCountryOptionChange(event, data.detail)\n }\n\n const optionElement = event.target.closest('.s-product-options-option');\n if (event.target.value\n || ((option.type === DisplayType.FILE || option.type === DisplayType.IMAGE) && event.type === 'added')\n || (option.type === DisplayType.MAP && event.type === 'selected' && (event.target.lat && event.target.lng))) {\n setTimeout(() => {\n optionElement.classList.remove('s-product-options-option-error');\n }, 200);\n }\n\n const index = this.selectedOptions.findIndex(option => option.option_id === data.option.id);\n index > -1 ? this.selectedOptions[index] = {\n ...data.detail,\n option_id: data.option.id\n } : this.selectedOptions.push({ ...data.detail, option_id: data.option.id })\n\n if (option.type === DisplayType.DONATION) {\n salla.event.emit('product-options::donation-changed', {\n id: this.productId,\n price: event.target.value\n });\n }\n this.setSelectedSkus();\n this.handleRequiredMultipleOptions(option);\n this.changed.emit(data);\n salla.event.emit('product-options::change', data);\n }\n\n\n private handleDonationOptions = (event, detail, type) => {\n if (detail === 'custom' && type === 'input') {\n salla.helpers.inputDigitsOnly(event.target)\n salla.event.emit('product-options::donation-changed', {\n id: this.productId,\n price: event.target.value\n });\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n this.isCustomDonation = event.target.value === 'custom';\n if (this.donationInput) {\n if (event.target.value === 'custom') {\n this.donationInput.value = '';\n this.donationInput.focus()\n } else {\n this.donationInput.value = event.target.value;\n }\n if (detail === 'custom') {\n return\n }\n salla.event.emit('product-options::donation-changed', {\n id: this.productId,\n price: event.target.value\n });\n }\n }\n\n private hideLabel = (option) => {\n if (option.type === DisplayType.DONATION && (option.donation && !option.donation.can_donate)) {\n return true;\n }\n return false;\n }\n\n private getExpireDonationMessage = (option) => {\n if (!option.donation) {\n return;\n }\n const completed = option.donation.target_amount <= option.donation.collected_amount;\n return <div class={{ \"s-product-options-donation-message\": true, \"s-product-options-donation-completed\": completed, \"s-product-options-donation-expired\": !completed }}>\n <p>{option.donation.target_message}</p>\n <span>{completed ? salla.money(option.donation.target_amount) : ''}</span>\n </div>\n }\n /**\n * loop throw all selected details, then get common sku, if it's only one, means we selected all of them;\n */\n private setSelectedSkus() {\n this.selectedSkus = this.selectedOptions.map(detail => Object.keys(detail.skus_availability || {}))\n .reduce((p, c) => p.filter(e => c.includes(e)))\n .map(sku => Number(sku));\n }\n\n private handleRequiredMultipleOptions(option) {\n if (option.type !== DisplayType.MULTIPLE_OPTIONS || !option.required) {\n return;\n }\n const optionContainer = this.host.querySelector(`[data-option-id=\"${option.id}\"]`);\n const hasChecked = optionContainer.querySelectorAll('input:checked').length;\n optionContainer.querySelectorAll('input').forEach(input => input.toggleAttribute('required', !hasChecked));\n }\n\n private getLatLng(value, type: 'lat' | 'lng') {\n return value\n ? value.split(',')[type === 'lat' ? 0 : 1]\n : '';\n }\n\n private getDisplayForType(option: Option) {\n if (this[`${option.type}Option`]) {\n return this[`${option.type}Option`](option);\n }\n\n if (option.type === DisplayType.COLOR_PICKER) {\n return this.colorPickerOption(option)\n }\n\n if (option.type === DisplayType.MULTIPLE_OPTIONS) {\n return this.multipleOptions(option);\n }\n\n if (option.type === DisplayType.SINGLE_OPTION) {\n return this.singleOption(option);\n }\n\n if (option.type === DisplayType.DIGITAL_CARD_VALUE) {\n return this.digitalCardValuesOption(option);\n }\n if (option.type === DisplayType.COUNTRY) {\n return this.countryOption(option);\n }\n\n if (option.type === DisplayType.BOOKING && salla.url.is_page(\"cart\")) {\n return <salla-booking-field onInvalidInput={(e) => this.invalidHandler(e, option)} option={option as any} productId={option.value}></salla-booking-field>\n }\n\n salla.log(`Couldn't find options type(${option.type})😢`);\n return '';\n }\n\n protected getOptionShownWhen(option: Option) {\n return option.visibility_condition\n ? { \"data-show-when\": `options[${option.visibility_condition.option}] ${option.visibility_condition.operator} ${option.visibility_condition.value}` }\n : {};\n }\n\n private getAvailableDigitalCardSKUs(detail: Detail) {\n const digitalCardOption = this.optionsData.find(({ type }) => type === 'digital-code-value')\n\n if (!digitalCardOption) throw new Error('product-options:: No digital card options found')\n\n const outofStockSKUs = Object.keys(detail.skus_availability).filter(key => detail.skus_availability[key] === false)\n\n this.availableDigitalCardValues = digitalCardOption.details.filter((op) => {\n\n return !Object.keys(op.skus_availability).filter(SKU_key => outofStockSKUs.includes(SKU_key)).length\n\n })\n\n }\n private handleCountryOptionChange(event: Event, detail: Detail) {\n event.stopImmediatePropagation()\n\n this.ignoreDefaultCardValue = true\n\n const currentCardValue = this.host.querySelector(\"input[data-code-value]:checked\") as HTMLInputElement | null\n\n if (currentCardValue) currentCardValue.checked = false\n\n const digitalCardOption = this.optionsData.find(({ type }) => type === 'digital-code-value')\n\n if (!digitalCardOption) throw new Error('product-options:: No digital card options found')\n\n this.getAvailableDigitalCardSKUs(detail)\n }\n\n private getSelectedDigitalCardOptions(option: Option) {\n const selectedOption = option.details.find(detail => detail.is_selected)\n const defaultOption = option.details.find(detail => !!detail.is_default) || option.details[0] /*option.details[0] only applys for counrty options*/\n if (!['digital-code-value', 'country'].includes(option.type)) return\n\n return selectedOption || defaultOption\n\n\n }\n\n //we need the cart Id for productOption Image\n componentWillLoad() {\n const shouldSelectDefaultOption = this.optionsData.filter(({ type }) => [\"country\", \"digital-card-value\"].includes(type)).length > 0 && salla.url.is_page('cart')\n\n if (shouldSelectDefaultOption) {\n const countryOption = this.optionsData.find(option => option.type === 'country')\n\n const defaultSelection = countryOption && this.getSelectedDigitalCardOptions(countryOption)\n\n if (defaultSelection) {\n this.getAvailableDigitalCardSKUs(defaultSelection)\n }\n }\n this.outOfStockText = salla.lang.get('pages.products.out_of_stock')\n return salla.onReady(() => {\n const needsCartId = (!salla.storage.get('cart.id') && this.optionsData.some(option => ['file', 'image'].includes(option.type)));\n return needsCartId ? salla.api.cart.getCurrentCartId(false, \"salla-product-options\") : null;\n })\n }\n\n render() {\n if (this.optionsData?.length === 0) {\n return;\n }\n\n return (\n <Host class=\"s-product-options-wrapper\">\n {/* TODO:: move salla-conditional-field logic to here, no need of another component*/}\n <salla-conditional-fields>\n {this.optionsData.map((option: Option) =>\n <div key={option.id} class={`s-product-options-option-container${option.visibility_condition ? ' hidden' : ''}`}\n data-option-id={option.id}\n {...this.getOptionShownWhen(option)}>\n {option.name === 'splitter' ?\n this.splitterOption()\n : <div class={{ \"s-product-options-option\": true, \"s-product-options-option-booking\": option.type === DisplayType.BOOKING && salla.url.is_page(\"cart\") }} data-option-type={option.type}\n data-option-required={`${option.required}`}>\n <label htmlFor={`options[${option.id}]`} class={`s-product-options-option-label ${this.hideLabel(option) ? 's-product-options-option-label-hidden' : ''}`}>\n <b>\n {option.name}\n {option.required && <span> * </span>} </b>\n <small>{option.placeholder}</small>\n </label>\n <div class={`s-product-options-option-content ${this.hideLabel(option) || (option.type === DisplayType.BOOKING && salla.url.is_page(\"cart\")) ? 's-product-options-option-content-full-width' : ''}`}>\n {this.getDisplayForType(option)}\n </div>\n </div>}\n </div>\n )}\n </salla-conditional-fields>\n </Host>\n );\n\n }\n\n componentDidLoad() {\n if (this.optionsData?.length === 0 && !this.optionsData.some(option => option.type === DisplayType.DONATION)) {\n return;\n }\n const selectedDonationOption = this.optionsData.find(option => option.type === DisplayType.DONATION)?.details.find(detail => detail.is_selected);\n if (!selectedDonationOption) {\n return;\n }\n setTimeout(() => {\n salla.event.emit('product-options::donation-changed', {\n id: this.productId,\n price: selectedDonationOption.additional_price\n });\n }, 1000);\n }\n //@ts-ignore\n private donationOption(option: Option, product: Product) {\n return <div class=\"s-product-options-donation-wrapper\">\n\n {option.donation?.can_donate ? [\n option.donation ?\n <div key={option.id} class=\"s-product-options-donation-progress\">\n <salla-progress-bar donation={option.donation}>\n </salla-progress-bar>\n </div>\n : '',\n option.details.length ?\n [<h4 key={option.id}>{this.selectAmount}</h4>,\n <div key={option.id} class=\"s-product-options-donation-options\">\n {option.details.map((detail, i) =>\n <div key={option.id} class=\"s-product-options-donation-options-item\">\n <input id={`donation-option-${i}`} type=\"radio\" name=\"donating_option\" checked={detail.is_selected} value={detail.additional_price} onChange={e => this.handleDonationOptions(e, detail, 'option')} />\n <label htmlFor={`donation-option-${i}`}>\n <span>{salla.money(detail.name)}</span>\n </label>\n </div>\n )}\n {option.donation?.custom_amount_enabled ?\n <div class=\"s-product-options-donation-options-item\">\n <input id={\"donation-option-custom\"} type=\"radio\" name=\"donating_option\" value=\"custom\" onChange={e => this.handleDonationOptions(e, 'custom', 'option')} />\n <label htmlFor={\"donation-option-custom\"}>\n <span> {this.selectDonationAmount} </span>\n </label>\n </div>\n : ''\n }\n </div>] : '',\n\n <div key={option.id} class={{ \"s-product-options-donation-input-group\": true, \"shown\": !option.details.length || (option.details.length && this.isCustomDonation) }}>\n <input\n type=\"text\"\n id=\"donating-amount\"\n name=\"donation_amount\"\n class=\"s-form-control\"\n ref={el => { this.donationInput = el as HTMLInputElement }}\n value={\n option.details.length\n && option.details.some(detail => detail.is_selected)\n ? option.details.find(detail => detail.is_selected).additional_price\n : option.value}\n // required\n placeholder={option.placeholder}\n onInput={e => this.handleDonationOptions(e, 'custom', 'input')}\n onBlur={e => this.changedHandler(e, option)}\n onInvalid={(e) => this.invalidHandler(e, option)}\n />\n {/* value={option.value} */}\n <span class=\"s-product-options-donation-amount-currency\">\n {salla.config.currency(salla.config.get('user.currency_code')).symbol}\n </span>\n </div>\n ] :\n this.getExpireDonationMessage(option)\n }\n </div>\n }\n\n private fileUploader(option: Option, additions: Record<string, unknown> | null = null) {\n return <salla-file-upload\n {...(additions || {})}\n payload-name=\"file\"\n value={option.value}\n instant-upload={true}\n name={`options[${option.id}]`}\n required={!option.visibility_condition && option.required}\n height=\"120px\"\n onAdded={(e) => this.changedHandler(e, option)}\n url={salla.cart.api.getUploadImageEndpoint()}\n form-data={{ cart_item_id: this.productId, product_id: this.productId }}\n onInvalidInput={(e) => this.invalidHandler(e, option)}\n class={{ \"s-product-options-image-input\": true, required: option.required }}\n >\n <div class=\"s-product-options-filepond-placeholder\">\n <span class=\"s-product-options-filepond-placeholder-icon\"\n innerHTML={(additions as { accept: string }).accept?.split(',').every(type => type.includes('image'))\n ? CameraIcon\n : FileIcon}\n />\n <p class=\"s-product-options-filepond-placeholder-text\">{salla.lang.get('common.uploader.drag_and_drop')}</p>\n <span class=\"filepond--label-action\">{salla.lang.get('common.uploader.browse')}</span>\n </div>\n </salla-file-upload>\n }\n\n //@ts-ignore\n private imageOption(option: Option) {\n return this.fileUploader(option, { accept: 'image/png,image/jpeg,image/jpg,image/gif' });\n }\n\n //@ts-ignore\n private fileOption(option: Option) {\n const types = option.details.map(detail => this.fileTypes[detail.name]).filter(Boolean);\n return types?.length\n ? this.fileUploader(option, { accept: types.join(',') })\n : 'File types not selected.';\n }\n\n // TODO: (ONLY FOR TESTING!) find a better way to make it testable, e.g. wrap it with a unique class like textOption\n //@ts-ignore\n private numberOption(option: Option) {\n return <input\n type=\"text\"\n value={option.value}\n class=\"s-form-control\"\n required={!option.visibility_condition && option.required}\n name={`options[${option.id}]`}\n placeholder={option.placeholder}\n onBlur={e => this.changedHandler(e, option)}\n onInvalid={(e) => this.invalidHandler(e, option)}\n onInput={e => salla.helpers.inputDigitsOnly(e.target)} />\n }\n\n //@ts-ignore\n private splitterOption() {\n return <div class=\"s-product-options-splitter\" />\n }\n\n //@ts-ignore\n private textOption(option: Option) {\n return <div class=\"s-product-options-text\">\n <input\n type=\"text\"\n value={option.value}\n maxLength={option?.length}\n class='s-form-control'\n required={!option.visibility_condition && option.required}\n name={`options[${option.id}]`}\n placeholder={option.placeholder}\n onInvalid={(e) => this.invalidHandler(e, option)}\n onInput={e => this.changedHandler(e, option)} />\n </div>\n }\n\n //@ts-ignore\n private textareaOption(option: Option) {\n //todo::remove mt-1 class, and if it's okay to remove the tag itself will be great\n return <div class=\"s-product-options-textarea\">\n <div class=\"mt-1\">\n <textarea\n rows={4}\n value={option.value}\n maxLength={option?.length}\n class=\"s-form-control\"\n required={!option.visibility_condition && option.required}\n id={`options[${option.id}]`}\n name={`options[${option.id}]`}\n placeholder={option.placeholder}\n onInvalid={(e) => this.invalidHandler(e, option)}\n onInput={(e) => this.changedHandler(e, option)} />\n </div>\n </div>\n }\n\n //@ts-ignore\n private mapOption(option: Option) {\n return <salla-map\n zoom={15}\n lat={this.getLatLng(option.value, 'lat')}\n lng={this.getLatLng(option.value, 'lng')}\n name={`options[${option.id}]`}\n searchable={true}\n required={option.required}\n onInvalidInput={(e) => this.invalidHandler(e, option)}\n onSelected={e => this.changedHandler(e, option)} />\n }\n\n private colorPickerOption(option: Option) {\n return <salla-color-picker\n onSubmitted={e => this.changedHandler(e, option)}\n name={`options[${option.id}]`}\n required={!option.visibility_condition && option.required}\n onInvalidInput={(e) => this.invalidHandler(e, option)}\n color={option.value} />\n }\n\n /**\n * ============= Date Time options =============\n */\n //@ts-ignore\n private timeOption(option: Option) {\n return <salla-datetime-picker\n noCalendar={true}\n enableTime={true}\n dateFormat=\"h:i K\"\n value={option.value}\n placeholder={option.name}\n required={!option.visibility_condition && option.required}\n name={`options[${option.id}]`}\n class=\"s-product-options-time-element\"\n onInvalidInput={(e) => this.invalidHandler(e, option)}\n onPicked={e => this.changedHandler(e, option)} />\n }\n\n //@ts-ignore\n private dateOption(option: Option) {\n //todo:: consider date-range @see https://github.com/SallaApp/theme-raed/blob/master/src/assets/js/partials/product-options.js#L8-L23\n return <div class=\"s-product-options-date-element\">\n <salla-datetime-picker\n value={option.value}\n placeholder={option.name}\n required={!option.visibility_condition && option.required}\n minDate={new Date()}\n name={`options[${option.id}]`}\n onInvalidInput={(e) => this.invalidHandler(e, option)}\n onPicked={e => this.changedHandler(e, option)} />\n </div>\n }\n\n //@ts-ignore\n private datetimeOption(option: Option) {\n //todo:: consider date-range @see https://github.com/SallaApp/theme-raed/blob/master/src/assets/js/partials/product-options.js#L8-L23\n return <div class=\"s-product-options-datetime-element\">\n <salla-datetime-picker\n enableTime={true}\n value={option.value}\n dateFormat=\"Y-m-d G:i:K\"\n placeholder={option.name}\n required={!option.visibility_condition && option.required}\n name={`options[${option.id}]`}\n maxDate={option.to_date_time}\n minDate={option.from_date_time}\n onInvalidInput={(e) => this.invalidHandler(e, option)}\n onPicked={e => this.changedHandler(e, option)} />\n </div>\n }\n\n /**\n * ============= Advanced options =============\n */\n protected getOptionDetailName(detail: Detail, outOfStock = true, optionType?: string) {\n if (optionType && optionType === DisplayType.COLOR) {\n return detail.name\n + ((outOfStock && this.isOptionDetailOut(detail)) ? ` <br/> <p> ${this.outOfStockText} </p>` : '')\n + (detail.additional_price ? ` <p> (${salla.money(detail.additional_price)}) </p>` : '');\n }\n\n return detail.name\n + ((outOfStock && this.isOptionDetailOut(detail)) ? ` - ${this.outOfStockText}` : '')\n + (detail.additional_price ? ` (${salla.money(detail.additional_price)})` : '');\n }\n\n\n protected isOptionDetailOut(detail: Detail) {\n if (detail.is_out || !detail.skus_availability || !this.selectedSkus?.length) {\n return detail.is_out;\n }\n\n const isDetailSelected = this.selectedOptions.filter(option => option.id === detail.id).length;\n //if the current options is the only selected option, so we are sure that it's not out, because there is no other options selected yet\n if (isDetailSelected && this.selectedOptions.length === 1) {\n return false;\n }\n\n //if current details has sku in the possible outSkus it's out for sure\n if (isDetailSelected) {\n //here we will get the possible outSkus for current selected options\n const outSelectableSkus = this.selectedSkus.filter(sku => this.outSkus.includes(sku));\n return Object.keys(detail.skus_availability).some(sku => outSelectableSkus.includes(Number(sku)))\n }\n\n return this.selectedOptions.some(option => option.is_out && option.option_id !== detail.option_id)\n\n }\n\n private singleOption(option: Option) {\n return <div>\n <select name={`options[${option.id}]`}\n required={!option.visibility_condition && option.required}\n class=\"s-form-control\"\n onInvalid={(e) => this.invalidHandler(e, option)}\n onChange={e => this.changedHandler(e, option)}>\n <option value=\"\">{option.placeholder}</option>\n {\n option?.details.map((detail: Detail) => {\n return <option key={detail.id} value={detail.id} disabled={this.canDisabled && this.isOptionDetailOut(detail)}\n selected={detail.is_selected}>\n {this.getOptionDetailName(detail)}\n </option>\n })\n }\n </select>\n </div>\n }\n\n private multipleOptions(option: Option) {\n const is_required = option.required && !option.details.some(detail => detail.is_selected) && !option.visibility_condition;\n return <div class={{ \"s-product-options-multiple-options-wrapper\": true, 'required': option.required }}>\n {\n option?.details.map((detail: Detail) => {\n return <div key={detail.id}>\n <input type=\"checkbox\"\n value={detail.id}\n disabled={this.isOptionDetailOut(detail)}\n checked={detail.is_selected}\n required={is_required}\n name={`options[${option.id}][]`}\n id={`field-${option.id}-${detail.id}`}\n onChange={(e) => this.changedHandler(e, option)}\n onInvalid={(e) => this.invalidHandler(e, option)}\n aria-describedby={`options[${option.id}]-description`} />\n <label htmlFor={`field-${option.id}-${detail.id}`}>{this.getOptionDetailName(detail)}</label>\n </div>\n })\n }\n </div>\n }\n\n //@ts-ignore\n private colorOption(option: Option) {\n return <fieldset class=\"s-product-options-colors-wrapper\">\n {\n option?.details.map((detail) =>\n <div class=\"s-product-options-colors-item\" key={detail.id}>\n <input type=\"radio\"\n value={detail.id}\n required={!option.visibility_condition && option.required}\n checked={detail.is_selected}\n name={`options[${option.id}]`}\n disabled={this.canDisabled && this.isOptionDetailOut(detail)}\n id={`color-${this.productId}-${option.id}-${detail.id}`}\n onInvalid={(e) => this.invalidHandler(e, option)}\n onChange={e => this.changedHandler(e, option)} />\n <label htmlFor={`color-${this.productId}-${option.id}-${detail.id}`}>\n <span style={{ \"background-color\": detail.color }} />\n <div innerHTML={this.getOptionDetailName(detail, true, option.type)} />\n </label>\n </div>\n )\n }\n </fieldset>\n }\n\n //@ts-ignore\n private thumbnailOption(option: Option) {\n return <div class=\"s-product-options-thumbnails-wrapper\">\n {option.details.map((detail: Detail) => {\n return <div key={detail.id}>\n <input type=\"radio\"\n value={detail.id}\n data-itemid={detail.id} //todo:: why need this? it's already in the value!\n required={!option.visibility_condition && option.required}\n checked={detail.is_selected}\n name={`options[${option.id}]`}\n data-img-id={detail.option_value}\n disabled={this.canDisabled && this.isOptionDetailOut(detail)}\n id={`option_${this.productId}-${option.id}_${detail.id}`}\n onInvalid={(e) => this.invalidHandler(e, option)}\n onChange={(e) => this.changedHandler(e, option)} />\n <label htmlFor={`option_${this.productId}-${option.id}_${detail.id}`}\n data-img-id={detail.option_value}\n class=\"go-to-slide\">\n <img data-src={detail.image} src={detail.image} title={detail.name} alt={detail.name} />\n <span innerHTML={CheckCircleIcon} class=\"s-product-options-thumbnails-icon\" />\n {this.isOptionDetailOut(detail) ?\n [\n <small key={detail.id} class=\"s-product-options-thumbnails-stock-badge\">{this.outOfStockText}</small>,\n this.canDisabled ? <div key={detail.id} class=\"s-product-options-thumbnails-badge-overlay\" /> : '',\n ]\n : ''}\n </label>\n <p>{this.getOptionDetailName(detail, false)} </p>\n </div>\n })}\n </div>\n }\n\n // Digital card options\n private digitalCardValuesOption(option: Option) {\n\n return <div class=\"s-product-options-digital-card-wrapper\">\n {this.availableDigitalCardValues.length > 0 ? this.availableDigitalCardValues.map((detail) => {\n const id = String(detail.id)\n return <label htmlFor={id} key={id} class=\"s-product-options-digital-card-option\">\n <input type=\"radio\" data-code-value class=\"s-form-control s-product-options-digital-card-input\" value={detail.id}\n name={`options[${option.id}]`}\n id={id}\n required={!option.visibility_condition && option.required}\n onInvalid={(e) => this.invalidHandler(e, option)}\n checked={!this.ignoreDefaultCardValue && this.getSelectedDigitalCardOptions(option)?.id === detail.id}\n\n />\n <span>{detail.name} {salla.config?.currency()?.symbol}</span>\n </label>\n })\n : <div class=\"s-product-options-digital-card-out-of-stock\"/>\n }\n </div>\n }\n private countryOption(option: Option) {\n return <div class=\"s-product-options-digital-card-wrapper\">\n {option.details.map((detail) => (\n <label htmlFor={String(detail.id)} key={detail.id} class={{\"s-product-options-digital-card-option\":true,\"s-product-options-digital-card-option-stock-out\":detail.is_out}}>\n <input id={String(detail.id)} type=\"radio\" class=\"s-form-control s-product-options-digital-card-input\" value={detail.id}\n name={`options[${option.id}]`}\n required={!option.visibility_condition && option.required}\n onInvalid={(e) => this.invalidHandler(e, option)}\n onChange={e => this.changedHandler(e, option)}\n checked={this.getSelectedDigitalCardOptions(option)?.id === detail.id && salla.url.is_page('cart')}\n\n />\n <div class=\"s-product-options-country-flag-wrapper\">\n <div class={`s-product-options-country-flag flag iti__flag iti__${String(detail.code).toLocaleLowerCase()}`} />\n </div>\n <span >{detail.name}</span>\n </label>\n ))\n }\n </div>\n\n }\n\n}\n"],"version":3}
|
|
1
|
+
{"file":"salla-product-options.js","mappings":";;;;;;;;;;;;;;;;;AAAA,IAAY,WAsBX;AAtBD,WAAY,WAAW;EACrB,8BAAe,CAAA;EACf,4BAAa,CAAA;EACb,oCAAqB,CAAA;EACrB,oCAAqB,CAAA;EACrB,8BAAe,CAAA;EACf,oDAAqC,CAAA;EACrC,gCAAiB,CAAA;EACjB,8CAA+B,CAAA;EAC/B,wDAAyC,CAAA;EACzC,kCAAmB,CAAA;EACnB,oCAAqB,CAAA;EACrB,4BAAa,CAAA;EACb,oCAAqB,CAAA;EACrB,sCAAuB,CAAA;EACvB,4BAAa,CAAA;EACb,8BAAe,CAAA;EACf,oCAAqB,CAAA;EACrB,0BAAW,CAAA;EACX,4BAAa,CAAA;EACb,4CAA6B,CAAA;EAC7B,kCAAmB,CAAA;AACrB,CAAC,EAtBW,WAAW,KAAX,WAAW,QAsBtB;AAqID,IAAY,QAEX;AAFD,WAAY,QAAQ;EAClB,uBAAW,CAAA;AACb,CAAC,EAFW,QAAQ,KAAR,QAAQ;;;;;;;;;AC3JpB,MAAM,sBAAsB,GAAG,EAAE;;MCWpBA,qBAAmB;EAE9B;;;;IAuCQ,cAAS,GAA2B;MAC1C,GAAG,EAAE,iBAAiB;MACtB,GAAG,EAAE,WAAW;MAChB,GAAG,EAAE,YAAY;MACjB,IAAI,EAAE,+HAA+H;MACrI,GAAG,EAAE,wJAAwJ;MAC7J,GAAG,EAAE,YAAY;KAClB,CAAC;IAcM,YAAO,GAA2B,EAAE,CAAC;;;;;IAMrC,2BAAsB,GAAG,KAAK,CAAA;IAyH9B,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CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,IAAI,EAAC,OAAO,EAAC,KAAK,EAAC,qDAAqD,EAAC,KAAK,EAAE,MAAM,CAAC,EAAE,EACrH,IAAI,EAAE,WAAW,MAAM,CAAC,EAAE,GAAG,EAC7B,QAAQ,EAAE,MAAM,CAAC,MAAM,EACvB,QAAQ,EAAE,CAAC,MAAM,CAAC,oBAAoB,IAAI,MAAM,CAAC,QAAQ,EACzD,SAAS,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,cAAc,CAAC,CAAC,EAAE,MAAM,CAAC,EAChD,QAAQ,EAAE,CAAC,IAAI,IAAI,CAAC,cAAc,CAAC,CAAC,EAAE,MAAM,CAAC,EAC7C,OAAO,EAAE,CAAA,MAAA,IAAI,CAAC,6BAA6B,CAAC,MAAM,CAAC,0CAAE,EAAE,MAAK,MAAM,CAAC,EAAE,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,GAElG,EACF,WAAK,KAAK,EAAC,wCAAwC,IACjD,WAAK,KAAK,EAAE,sDAAsD,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,iBAAiB,EAAE,EAAE,GAAI,CAC3G,EACN,gBAAQ,MAAM,CAAC,IAAI,CAAQ,CACrB,EACT;KAAA,CAAC,CAEE,CAAA;GAEP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["SallaProductOptions"],"sources":["src/components/salla-product-options/interfaces.ts","src/components/salla-product-options/salla-product-options.scss?tag=salla-product-options","src/components/salla-product-options/salla-product-options.tsx"],"sourcesContent":["export enum DisplayType {\n COLOR = \"color\",\n DATE = \"date\",\n DATETIME = \"datetime\",\n DONATION = \"donation\",\n IMAGE = \"image\",\n MULTIPLE_OPTIONS = \"multiple-options\",\n NUMBER = \"number\",\n SINGLE_OPTION = \"single-option\",\n DIGITAL_CARD_VALUE = \"digital-code-value\",\n COUNTRY = \"country\",\n SPLITTER = \"splitter\",\n TEXT = \"text\",\n TEXTAREA = \"textarea\",\n THUMBNAIL = \"thumbnail\",\n TIME = \"time\",\n RADIO = \"radio\",\n CHECKBOX = \"checkbox\",\n MAP = \"map\",\n FILE = \"file\", // similar to image type (file-uploader component)\n COLOR_PICKER = \"color_picker\",\n BOOKING = \"booking\"\n}\n\nexport interface ProductDetail {\n id: string;\n sku: string;\n name: string;\n description: string;\n url: string;\n promotion_title: string;\n subtitle: string;\n type: string;\n status: string;\n price: number;\n sale_price: number;\n regular_price: number;\n starting_price: null;\n quantity: number;\n max_quantity: number;\n discount_ends: number;\n is_taxable: boolean;\n has_read_more: boolean;\n can_add_note: boolean;\n can_show_remained_quantity: boolean;\n can_upload_file: boolean;\n has_custom_form: boolean;\n is_on_sale: boolean;\n is_hidden_quantity: boolean;\n is_available: boolean;\n is_out_of_stock: boolean;\n weight: null;\n calories: null;\n image: SimpleImage;\n brand: Brand;\n donation?: ProductDonation;\n images: Image[];\n tags: Tag[];\n notify_availability: null;\n rating: Rating;\n options: Option[];\n sold_quantity: number;\n category: Category;\n}\n\nexport interface SimpleImage {\n url: string;\n alt: string;\n}\n\nexport interface Category {\n name: string;\n url: string;\n icon: string;\n}\n\nexport interface ProductDonation {\n target_message?: string;\n collected_amount?: number;\n target_amount?: number;\n target_percent?: number;\n target_end_date?: string;\n can_donate: boolean;\n custom_amount_enabled: boolean;\n}\n\nexport interface Image {\n id: number;\n url: string;\n main: boolean;\n three_d_image_url: string;\n alt: string;\n video_url: string;\n type: string;\n sort: number;\n}\n\nexport interface Option {\n id: number;\n name: string;\n required: boolean;\n type: string;\n placeholder: string;\n option_type: string;\n not_same_day_order: boolean;\n availability_range: number;\n from_date_time: null;\n to_date_time: null;\n visibility_condition?: { option: number, operator: \"=\" | \"!=\", value: number };\n details?: Detail[];\n condition_attributes: string;\n value?: any;\n length?: number;\n donation?: Donation\n}\n\nexport interface Donation {\n custom_amount_enabled: boolean;\n target_message?: string;\n target_date: string | \"2023-04-18\";\n target_end_date: string | \"2023-04-18\";\n target_amount: number;\n collected_amount: number;\n can_donate: boolean;\n}\n\nexport interface Detail {\n id: number;\n option_id: number;\n name: string;\n additional_price: number;\n option_value: null | string;\n image: null | string;\n color: null | string;\n is_out: boolean;\n skus_availability?: { [sku_id: number]: boolean };\n is_selected: boolean;\n is_default?: 0 | 1;\n code?: string;\n type?: string;\n\n}\n\nexport interface Brand {\n id: string;\n url: string;\n name: string;\n logo: string;\n}\n\nexport interface PreTaxPrice {\n amount: number;\n currency: Currency;\n}\n\nexport enum Currency {\n Sar = \"SAR\",\n}\n\nexport interface Promotion {\n title: string;\n sub_title: string;\n}\n\nexport interface Rating {\n count: number;\n stars: number;\n}\n\nexport interface Tag {\n name: string;\n url: string;\n}\n","\n.s-product-options{\n &-wrapper{\n\n }\n &-option-container{\n\n }\n &-option{\n\n }\n &-option-label{\n\n }\n &-option-content{\n\n }\n &-colors-wrapper{\n\n }\n &-date-element{\n\n }\n &-time-element{\n \n }\n &-datetime-element{\n\n }\n &-image-input{\n\n }\n &-multiple-options-wrapper{\n\n }\n &-splitter{\n\n }\n &-text{\n\n }\n &-textarea{\n\n }\n &-thumbnails-wrapper{\n\n }\n}","import { Component, Prop, h, State, Element, Host, Event, type EventEmitter, Method } from '@stencil/core';\nimport { type Option, DisplayType, type Detail } from './interfaces';\nimport CheckCircleIcon from '../../assets/svg/check.svg';\nimport CameraIcon from '../../assets/svg/camera.svg';\nimport FileIcon from '../../assets/svg/file-upload.svg';\n\n\n@Component({\n tag: 'salla-product-options',\n styleUrl: 'salla-product-options.scss',\n})\nexport class SallaProductOptions {\n\n constructor() {\n this.canDisabled = !salla.config.get('store.settings.product.notify_options_availability');\n salla.lang.onLoaded(() => {\n this.outOfStockText = salla.lang.get(\"pages.products.out_of_stock\");\n this.donationAmount = salla.lang.get('pages.products.donation_amount');\n this.selectDonationAmount = salla.lang.getWithDefault('pages.products.select_donation_amount', 'تحديد مبلغ التبرع');\n this.selectAmount = salla.lang.getWithDefault('pages.products.select_amount', 'اختر المبلغ');\n });\n\n if (this.options) {\n try {\n this.setOptionsData(Array.isArray(this.options) ? this.options : JSON.parse(this.options));\n return;\n } catch (e) {\n salla.log('Bad json passed via options prop');\n }\n }\n if (!Array.isArray(this.optionsData)) {\n salla.log('Options is not an array[] ---> ', this.optionsData);\n this.setOptionsData([]);\n }\n\n if (this.productId && !salla.url.is_page('cart')) {\n salla.api.product.getDetails(this.productId, ['options']).then(resp => this.setOptionsData(resp.data.options));\n }\n }\n\n private setOptionsData(optionsData: Option[]) {\n this.optionsData = optionsData;\n const that = this\n this.optionsData[0]?.details?.forEach(function (detail) {\n Object.entries(detail.skus_availability || {})\n .filter(sku => !sku[1])\n .map(sku => that.outSkus.push(Number(sku[0])));\n });\n }\n\n @Element() host: HTMLElement;\n\n private fileTypes: Record<string, string> = {\n pdf: 'application/pdf',\n png: 'image/png',\n jpg: 'image/jpeg',\n word: 'application/doc,application/ms-doc,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n exl: 'application/excel,application/vnd.ms-excel,application/x-excel,application/x-msexcel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n txt: 'text/plain',\n };\n\n @State() optionsData: Option[]\n @State() outOfStockText = \"\"\n @State() donationAmount: string = salla.lang.get('pages.products.donation_amount')\n @State() selectDonationAmount: string = salla.lang.getWithDefault('pages.products.select_donation_amount', 'تحديد مبلغ التبرع')\n @State() selectAmount: string = salla.lang.getWithDefault('pages.products.select_amount', 'اختر المبلغ')\n @State() isCustomDonation = false;\n @State() selectedOptions = [];\n @State() canDisabled: boolean;\n @State() selectedSkus?: Array<string | number>;\n @State() selectedOutSkus?: Array<string | number>;\n @State() availableDigitalCardValues: Detail[] = []\n\n private outSkus: Array<string | number> = [];\n private donationInput?: HTMLInputElement;\n /**\n * Avoid selection of previous default or selected card value option \n * when switching between digital card country options for the 1st time\n */\n private ignoreDefaultCardValue = false\n /**\n * The id of the product to which the options are going to be fetched for.\n */\n @Prop() productId: number = salla.config.get('page.id');\n\n /**\n * Product detail information.\n */\n @Prop() options: string\n\n /**\n * Get the id's of the selected options.\n * */\n @Method()\n async getSelectedOptionsData() {\n const selectedOptions = {}\n const formData = (this.host as HTMLElement & { getElementSallaData: () => FormData }).getElementSallaData();\n formData.forEach((value, key) => {\n if (key.startsWith('options[')) { (selectedOptions[key.replace('options[', '').replace(']', '')] = value) }\n });\n return selectedOptions;\n }\n\n /**\n * Report options form validity.\n * */\n @Method()\n async reportValidity() {\n const requiredElements = this.host.querySelectorAll('[required]') as unknown as Array<HTMLInputElement>;\n let pass = true;\n for (let i = 0; i < requiredElements.length; i++) {\n //if there is only one invalid option, return false\n if ('reportValidity' in requiredElements[i] && !requiredElements[i].reportValidity()) {\n pass = false;\n }\n }\n return pass;\n }\n\n /**\n * Return true if there is any out of stock options are selected and vise versa.\n * */\n @Method()\n async hasOutOfStockOption() {\n return this.selectedOptions.some(option => option.is_out) || (this.selectedSkus?.length && this.selectedSkus?.every(sku => this.outSkus.includes(sku)));\n }\n\n /**\n * Get selected options.\n * */\n @Method()\n async getSelectedOptions() {\n return this.selectedOptions;\n }\n\n /**\n * Get a specific option by its id.\n * */\n @Method()\n async getOption(option_id) {\n return this.optionsData.find(option => option.id === option_id);\n }\n\n /**\n * An event that emitted when any option is changed.\n */\n @Event() changed: EventEmitter;\n\n // @ts-ignore\n private invalidHandler(event, option: Option) {\n const closestProductOption = (event.target as HTMLInputElement).closest('.s-product-options-option') as HTMLElement;\n if (!salla.url.is_page('cart')) {\n closestProductOption.scrollIntoView({ behavior: 'smooth', block: 'center' });\n }\n closestProductOption.classList.add('s-product-options-option-error');\n }\n\n\n\n private changedHandler(event, option) {\n const data = { event: event, option: option, detail: null };\n if (option.details) {\n const detail = option.details.find((detail) => {\n return Number(detail.id) === Number(event.target.value);\n });\n data.detail = detail\n }\n\n if (option.type === 'country') {\n this.handleCountryOptionChange(event, data.detail)\n }\n\n const optionElement = event.target.closest('.s-product-options-option');\n if (event.target.value\n || ((option.type === DisplayType.FILE || option.type === DisplayType.IMAGE) && event.type === 'added')\n || (option.type === DisplayType.MAP && event.type === 'selected' && (event.target.lat && event.target.lng))) {\n setTimeout(() => {\n optionElement.classList.remove('s-product-options-option-error');\n }, 200);\n }\n\n const index = this.selectedOptions.findIndex(option => option.option_id === data.option.id);\n index > -1 ? this.selectedOptions[index] = {\n ...data.detail,\n option_id: data.option.id\n } : this.selectedOptions.push({ ...data.detail, option_id: data.option.id })\n\n if (option.type === DisplayType.DONATION) {\n salla.event.emit('product-options::donation-changed', {\n id: this.productId,\n price: event.target.value\n });\n }\n this.setSelectedSkus();\n this.handleRequiredMultipleOptions(option);\n this.changed.emit(data);\n salla.event.emit('product-options::change', data);\n }\n\n\n private handleDonationOptions = (event, detail, type) => {\n if (detail === 'custom' && type === 'input') {\n salla.helpers.inputDigitsOnly(event.target)\n salla.event.emit('product-options::donation-changed', {\n id: this.productId,\n price: event.target.value\n });\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n this.isCustomDonation = event.target.value === 'custom';\n if (this.donationInput) {\n if (event.target.value === 'custom') {\n this.donationInput.value = '';\n this.donationInput.focus()\n } else {\n this.donationInput.value = event.target.value;\n }\n if (detail === 'custom') {\n return\n }\n salla.event.emit('product-options::donation-changed', {\n id: this.productId,\n price: event.target.value\n });\n }\n }\n\n private hideLabel = (option) => {\n if (option.type === DisplayType.DONATION && (option.donation && !option.donation.can_donate)) {\n return true;\n }\n return false;\n }\n\n private getExpireDonationMessage = (option) => {\n if (!option.donation) {\n return;\n }\n const completed = option.donation.target_amount <= option.donation.collected_amount;\n return <div class={{ \"s-product-options-donation-message\": true, \"s-product-options-donation-completed\": completed, \"s-product-options-donation-expired\": !completed }}>\n <p>{option.donation.target_message}</p>\n <span>{completed ? salla.money(option.donation.target_amount) : ''}</span>\n </div>\n }\n /**\n * loop throw all selected details, then get common sku, if it's only one, means we selected all of them;\n */\n private setSelectedSkus() {\n this.selectedSkus = this.selectedOptions.map(detail => Object.keys(detail.skus_availability || {}))\n .reduce((p, c) => p.filter(e => c.includes(e)))\n .map(sku => Number(sku));\n }\n\n private handleRequiredMultipleOptions(option) {\n if (option.type !== DisplayType.MULTIPLE_OPTIONS || !option.required) {\n return;\n }\n const optionContainer = this.host.querySelector(`[data-option-id=\"${option.id}\"]`);\n const hasChecked = optionContainer.querySelectorAll('input:checked').length;\n optionContainer.querySelectorAll('input').forEach(input => input.toggleAttribute('required', !hasChecked));\n }\n\n private getLatLng(value, type: 'lat' | 'lng') {\n return value\n ? value.split(',')[type === 'lat' ? 0 : 1]\n : '';\n }\n\n private getDisplayForType(option: Option) {\n if (this[`${option.type}Option`]) {\n return this[`${option.type}Option`](option);\n }\n\n if (option.type === DisplayType.COLOR_PICKER) {\n return this.colorPickerOption(option)\n }\n\n if (option.type === DisplayType.MULTIPLE_OPTIONS) {\n return this.multipleOptions(option);\n }\n\n if (option.type === DisplayType.SINGLE_OPTION) {\n return this.singleOption(option);\n }\n\n if (option.type === DisplayType.DIGITAL_CARD_VALUE) {\n return this.digitalCardValuesOption(option);\n }\n if (option.type === DisplayType.COUNTRY) {\n return this.countryOption(option);\n }\n\n if (option.type === DisplayType.BOOKING && salla.url.is_page(\"cart\")) {\n return <salla-booking-field onInvalidInput={(e) => this.invalidHandler(e, option)} option={option as any} productId={option.value}></salla-booking-field>\n }\n\n salla.log(`Couldn't find options type(${option.type})😢`);\n return '';\n }\n\n protected getOptionShownWhen(option: Option) {\n return option.visibility_condition\n ? { \"data-show-when\": `options[${option.visibility_condition.option}] ${option.visibility_condition.operator} ${option.visibility_condition.value}` }\n : {};\n }\n\n private getAvailableDigitalCardSKUs(detail: Detail) {\n const digitalCardOption = this.optionsData.find(({ type }) => type === 'digital-code-value')\n\n if (!digitalCardOption) throw new Error('product-options:: No digital card options found')\n\n const outofStockSKUs = Object.keys(detail.skus_availability).filter(key => detail.skus_availability[key] === false)\n\n this.availableDigitalCardValues = digitalCardOption.details.filter((op) => {\n\n return !Object.keys(op.skus_availability).filter(SKU_key => outofStockSKUs.includes(SKU_key)).length\n\n })\n\n }\n private handleCountryOptionChange(event: Event, detail: Detail) {\n event.stopImmediatePropagation()\n\n this.ignoreDefaultCardValue = true\n\n const currentCardValue = this.host.querySelector(\"input[data-code-value]:checked\") as HTMLInputElement | null\n\n if (currentCardValue) currentCardValue.checked = false\n\n const digitalCardOption = this.optionsData.find(({ type }) => type === 'digital-code-value')\n\n if (!digitalCardOption) throw new Error('product-options:: No digital card options found')\n\n this.getAvailableDigitalCardSKUs(detail)\n }\n\n private getSelectedDigitalCardOptions(option: Option) {\n const selectedOption = option.details.find(detail => detail.is_selected)\n const defaultOption = option.details.find(detail => !!detail.is_default) || option.details[0] /*option.details[0] only applys for counrty options*/\n if (!['digital-code-value', 'country'].includes(option.type)) return\n\n return selectedOption || defaultOption\n\n\n }\n\n //we need the cart Id for productOption Image\n componentWillLoad() {\n const shouldSelectDefaultOption = this.optionsData.filter(({ type }) => [\"country\", \"digital-card-value\"].includes(type)).length > 0 && salla.url.is_page('cart')\n\n if (shouldSelectDefaultOption) {\n const countryOption = this.optionsData.find(option => option.type === 'country')\n\n const defaultSelection = countryOption && this.getSelectedDigitalCardOptions(countryOption)\n\n if (defaultSelection) {\n this.getAvailableDigitalCardSKUs(defaultSelection)\n }\n }\n this.outOfStockText = salla.lang.get('pages.products.out_of_stock')\n return salla.onReady(() => {\n const needsCartId = (!salla.storage.get('cart.id') && this.optionsData.some(option => ['file', 'image'].includes(option.type)));\n return needsCartId ? salla.api.cart.getCurrentCartId(false, \"salla-product-options\") : null;\n })\n }\n\n render() {\n if (this.optionsData?.length === 0) {\n return;\n }\n\n return (\n <Host class=\"s-product-options-wrapper\">\n {/* TODO:: move salla-conditional-field logic to here, no need of another component*/}\n <salla-conditional-fields>\n {this.optionsData.map((option: Option) =>\n <div key={option.id} class={`s-product-options-option-container${option.visibility_condition ? ' hidden' : ''}`}\n data-option-id={option.id}\n {...this.getOptionShownWhen(option)}>\n {option.name === 'splitter' ?\n this.splitterOption()\n : <div class={{ \"s-product-options-option\": true, \"s-product-options-option-booking\": option.type === DisplayType.BOOKING && salla.url.is_page(\"cart\") }} data-option-type={option.type}\n data-option-required={`${option.required}`}>\n <label htmlFor={`options[${option.id}]`} class={`s-product-options-option-label ${this.hideLabel(option) ? 's-product-options-option-label-hidden' : ''}`}>\n <b>\n {option.name}\n {option.required && <span> * </span>} </b>\n <small>{option.placeholder}</small>\n </label>\n <div class={`s-product-options-option-content ${this.hideLabel(option) || (option.type === DisplayType.BOOKING && salla.url.is_page(\"cart\")) ? 's-product-options-option-content-full-width' : ''}`}>\n {this.getDisplayForType(option)}\n </div>\n </div>}\n </div>\n )}\n </salla-conditional-fields>\n </Host>\n );\n\n }\n\n componentDidLoad() {\n if (this.optionsData?.length === 0 && !this.optionsData.some(option => option.type === DisplayType.DONATION)) {\n return;\n }\n const selectedDonationOption = this.optionsData.find(option => option.type === DisplayType.DONATION)?.details.find(detail => detail.is_selected);\n if (!selectedDonationOption) {\n return;\n }\n setTimeout(() => {\n salla.event.emit('product-options::donation-changed', {\n id: this.productId,\n price: selectedDonationOption.additional_price\n });\n }, 1000);\n }\n //@ts-ignore\n private donationOption(option: Option, product: Product) {\n return <div class=\"s-product-options-donation-wrapper\">\n\n {option.donation?.can_donate ? [\n option.donation ?\n <div key={option.id} class=\"s-product-options-donation-progress\">\n <salla-progress-bar donation={option.donation}>\n </salla-progress-bar>\n </div>\n : '',\n option.details.length ?\n [<h4 key={option.id}>{this.selectAmount}</h4>,\n <div key={option.id} class=\"s-product-options-donation-options\">\n {option.details.map((detail, i) =>\n <div key={option.id} class=\"s-product-options-donation-options-item\">\n <input id={`donation-option-${i}`} type=\"radio\" name=\"donating_option\" checked={detail.is_selected} value={detail.additional_price} onChange={e => this.handleDonationOptions(e, detail, 'option')} />\n <label htmlFor={`donation-option-${i}`}>\n <span>{salla.money(detail.name)}</span>\n </label>\n </div>\n )}\n {option.donation?.custom_amount_enabled ?\n <div class=\"s-product-options-donation-options-item\">\n <input id={\"donation-option-custom\"} type=\"radio\" name=\"donating_option\" value=\"custom\" onChange={e => this.handleDonationOptions(e, 'custom', 'option')} />\n <label htmlFor={\"donation-option-custom\"}>\n <span> {this.selectDonationAmount} </span>\n </label>\n </div>\n : ''\n }\n </div>] : '',\n\n <div key={option.id} class={{ \"s-product-options-donation-input-group\": true, \"shown\": !option.details.length || (option.details.length && this.isCustomDonation) }}>\n <input\n type=\"text\"\n id=\"donating-amount\"\n name=\"donation_amount\"\n class=\"s-form-control\"\n ref={el => { this.donationInput = el as HTMLInputElement }}\n value={\n option.details.length\n && option.details.some(detail => detail.is_selected)\n ? option.details.find(detail => detail.is_selected).additional_price\n : option.value}\n // required\n placeholder={option.placeholder}\n onInput={e => this.handleDonationOptions(e, 'custom', 'input')}\n onBlur={e => this.changedHandler(e, option)}\n onInvalid={(e) => this.invalidHandler(e, option)}\n />\n {/* value={option.value} */}\n <span class=\"s-product-options-donation-amount-currency\">\n {salla.config.currency(salla.config.get('user.currency_code')).symbol}\n </span>\n </div>\n ] :\n this.getExpireDonationMessage(option)\n }\n </div>\n }\n\n private fileUploader(option: Option, additions: Record<string, unknown> | null = null) {\n return <salla-file-upload\n {...(additions || {})}\n payload-name=\"file\"\n value={option.value}\n instant-upload={true}\n name={`options[${option.id}]`}\n required={!option.visibility_condition && option.required}\n height=\"120px\"\n onAdded={(e) => this.changedHandler(e, option)}\n url={salla.cart.api.getUploadImageEndpoint()}\n form-data={{ cart_item_id: this.productId, product_id: this.productId }}\n onInvalidInput={(e) => this.invalidHandler(e, option)}\n class={{ \"s-product-options-image-input\": true, required: option.required }}\n >\n <div class=\"s-product-options-filepond-placeholder\">\n <span class=\"s-product-options-filepond-placeholder-icon\"\n innerHTML={(additions as { accept: string }).accept?.split(',').every(type => type.includes('image'))\n ? CameraIcon\n : FileIcon}\n />\n <p class=\"s-product-options-filepond-placeholder-text\">{salla.lang.get('common.uploader.drag_and_drop')}</p>\n <span class=\"filepond--label-action\">{salla.lang.get('common.uploader.browse')}</span>\n </div>\n </salla-file-upload>\n }\n\n //@ts-ignore\n private imageOption(option: Option) {\n return this.fileUploader(option, { accept: 'image/png,image/jpeg,image/jpg,image/gif' });\n }\n\n //@ts-ignore\n private fileOption(option: Option) {\n const types = option.details.map(detail => this.fileTypes[detail.name]).filter(Boolean);\n return types?.length\n ? this.fileUploader(option, { accept: types.join(',') })\n : 'File types not selected.';\n }\n\n // TODO: (ONLY FOR TESTING!) find a better way to make it testable, e.g. wrap it with a unique class like textOption\n //@ts-ignore\n private numberOption(option: Option) {\n return <input\n type=\"text\"\n value={option.value}\n class=\"s-form-control\"\n required={!option.visibility_condition && option.required}\n name={`options[${option.id}]`}\n placeholder={option.placeholder}\n onBlur={e => this.changedHandler(e, option)}\n onInvalid={(e) => this.invalidHandler(e, option)}\n onInput={e => salla.helpers.inputDigitsOnly(e.target)} />\n }\n\n //@ts-ignore\n private splitterOption() {\n return <div class=\"s-product-options-splitter\" />\n }\n\n //@ts-ignore\n private textOption(option: Option) {\n return <div class=\"s-product-options-text\">\n <input\n type=\"text\"\n value={option.value}\n maxLength={option?.length}\n class='s-form-control'\n required={!option.visibility_condition && option.required}\n name={`options[${option.id}]`}\n placeholder={option.placeholder}\n onInvalid={(e) => this.invalidHandler(e, option)}\n onInput={e => this.changedHandler(e, option)} />\n </div>\n }\n\n //@ts-ignore\n private textareaOption(option: Option) {\n //todo::remove mt-1 class, and if it's okay to remove the tag itself will be great\n return <div class=\"s-product-options-textarea\">\n <div class=\"mt-1\">\n <textarea\n rows={4}\n value={option.value}\n maxLength={option?.length}\n class=\"s-form-control\"\n required={!option.visibility_condition && option.required}\n id={`options[${option.id}]`}\n name={`options[${option.id}]`}\n placeholder={option.placeholder}\n onInvalid={(e) => this.invalidHandler(e, option)}\n onInput={(e) => this.changedHandler(e, option)} />\n </div>\n </div>\n }\n\n //@ts-ignore\n private mapOption(option: Option) {\n return <salla-map\n zoom={15}\n lat={this.getLatLng(option.value, 'lat')}\n lng={this.getLatLng(option.value, 'lng')}\n name={`options[${option.id}]`}\n searchable={true}\n required={option.required}\n onInvalidInput={(e) => this.invalidHandler(e, option)}\n onSelected={e => this.changedHandler(e, option)} />\n }\n\n private colorPickerOption(option: Option) {\n return <salla-color-picker\n onSubmitted={e => this.changedHandler(e, option)}\n name={`options[${option.id}]`}\n required={!option.visibility_condition && option.required}\n onInvalidInput={(e) => this.invalidHandler(e, option)}\n color={option.value} />\n }\n\n /**\n * ============= Date Time options =============\n */\n //@ts-ignore\n private timeOption(option: Option) {\n return <salla-datetime-picker\n noCalendar={true}\n enableTime={true}\n dateFormat=\"h:i K\"\n value={option.value}\n placeholder={option.name}\n required={!option.visibility_condition && option.required}\n name={`options[${option.id}]`}\n class=\"s-product-options-time-element\"\n onInvalidInput={(e) => this.invalidHandler(e, option)}\n onPicked={e => this.changedHandler(e, option)} />\n }\n\n //@ts-ignore\n private dateOption(option: Option) {\n //todo:: consider date-range @see https://github.com/SallaApp/theme-raed/blob/master/src/assets/js/partials/product-options.js#L8-L23\n return <div class=\"s-product-options-date-element\">\n <salla-datetime-picker\n value={option.value}\n placeholder={option.name}\n required={!option.visibility_condition && option.required}\n minDate={new Date()}\n name={`options[${option.id}]`}\n onInvalidInput={(e) => this.invalidHandler(e, option)}\n onPicked={e => this.changedHandler(e, option)} />\n </div>\n }\n\n //@ts-ignore\n private datetimeOption(option: Option) {\n //todo:: consider date-range @see https://github.com/SallaApp/theme-raed/blob/master/src/assets/js/partials/product-options.js#L8-L23\n return <div class=\"s-product-options-datetime-element\">\n <salla-datetime-picker\n enableTime={true}\n value={option.value}\n dateFormat=\"Y-m-d G:i:K\"\n placeholder={option.name}\n required={!option.visibility_condition && option.required}\n name={`options[${option.id}]`}\n maxDate={option.to_date_time}\n minDate={option.from_date_time}\n onInvalidInput={(e) => this.invalidHandler(e, option)}\n onPicked={e => this.changedHandler(e, option)} />\n </div>\n }\n\n /**\n * ============= Advanced options =============\n */\n protected getOptionDetailName(detail: Detail, outOfStock = true, optionType?: string) {\n if (optionType && optionType === DisplayType.COLOR) {\n return detail.name\n + ((outOfStock && this.isOptionDetailOut(detail)) ? ` <br/> <p> ${this.outOfStockText} </p>` : '')\n + (detail.additional_price ? ` <p> (${salla.money(detail.additional_price)}) </p>` : '');\n }\n\n return detail.name\n + ((outOfStock && this.isOptionDetailOut(detail)) ? ` - ${this.outOfStockText}` : '')\n + (detail.additional_price ? ` (${salla.money(detail.additional_price)})` : '');\n }\n\n\n protected isOptionDetailOut(detail: Detail) {\n if (detail.is_out || !detail.skus_availability || !this.selectedSkus?.length) {\n return detail.is_out;\n }\n\n const isDetailSelected = this.selectedOptions.filter(option => option.id === detail.id).length;\n //if the current options is the only selected option, so we are sure that it's not out, because there is no other options selected yet\n if (isDetailSelected && this.selectedOptions.length === 1) {\n return false;\n }\n\n //if current details has sku in the possible outSkus it's out for sure\n if (isDetailSelected) {\n //here we will get the possible outSkus for current selected options\n const outSelectableSkus = this.selectedSkus.filter(sku => this.outSkus.includes(sku));\n return Object.keys(detail.skus_availability).some(sku => outSelectableSkus.includes(Number(sku)))\n }\n\n return this.selectedOptions.some(option => option.is_out && option.option_id !== detail.option_id)\n\n }\n\n private singleOption(option: Option) {\n return <div>\n <select name={`options[${option.id}]`}\n required={!option.visibility_condition && option.required}\n class=\"s-form-control\"\n onInvalid={(e) => this.invalidHandler(e, option)}\n onChange={e => this.changedHandler(e, option)}>\n <option value=\"\">{option.placeholder}</option>\n {\n option?.details.map((detail: Detail) => {\n return <option key={detail.id} value={detail.id} disabled={this.canDisabled && this.isOptionDetailOut(detail)}\n selected={detail.is_selected}>\n {this.getOptionDetailName(detail)}\n </option>\n })\n }\n </select>\n </div>\n }\n\n private multipleOptions(option: Option) {\n const is_required = option.required && !option.details.some(detail => detail.is_selected) && !option.visibility_condition;\n return <div class={{ \"s-product-options-multiple-options-wrapper\": true, 'required': option.required }}>\n {\n option?.details.map((detail: Detail) => {\n return <div key={detail.id}>\n <input type=\"checkbox\"\n value={detail.id}\n disabled={this.isOptionDetailOut(detail)}\n checked={detail.is_selected}\n required={is_required}\n name={`options[${option.id}][]`}\n id={`field-${option.id}-${detail.id}`}\n onChange={(e) => this.changedHandler(e, option)}\n onInvalid={(e) => this.invalidHandler(e, option)}\n aria-describedby={`options[${option.id}]-description`} />\n <label htmlFor={`field-${option.id}-${detail.id}`}>{this.getOptionDetailName(detail)}</label>\n </div>\n })\n }\n </div>\n }\n\n //@ts-ignore\n private colorOption(option: Option) {\n return <fieldset class=\"s-product-options-colors-wrapper\">\n {\n option?.details.map((detail) =>\n <div class=\"s-product-options-colors-item\" key={detail.id}>\n <input type=\"radio\"\n value={detail.id}\n required={!option.visibility_condition && option.required}\n checked={detail.is_selected}\n name={`options[${option.id}]`}\n disabled={this.canDisabled && this.isOptionDetailOut(detail)}\n id={`color-${this.productId}-${option.id}-${detail.id}`}\n onInvalid={(e) => this.invalidHandler(e, option)}\n onChange={e => this.changedHandler(e, option)} />\n <label htmlFor={`color-${this.productId}-${option.id}-${detail.id}`}>\n <span style={{ \"background-color\": detail.color }} />\n <div innerHTML={this.getOptionDetailName(detail, true, option.type)} />\n </label>\n </div>\n )\n }\n </fieldset>\n }\n\n //@ts-ignore\n private thumbnailOption(option: Option) {\n return <div class=\"s-product-options-thumbnails-wrapper\">\n {option.details.map((detail: Detail) => {\n return <div key={detail.id}>\n <input type=\"radio\"\n value={detail.id}\n data-itemid={detail.id} //todo:: why need this? it's already in the value!\n required={!option.visibility_condition && option.required}\n checked={detail.is_selected}\n name={`options[${option.id}]`}\n data-img-id={detail.option_value}\n disabled={this.canDisabled && this.isOptionDetailOut(detail)}\n id={`option_${this.productId}-${option.id}_${detail.id}`}\n onInvalid={(e) => this.invalidHandler(e, option)}\n onChange={(e) => this.changedHandler(e, option)} />\n <label htmlFor={`option_${this.productId}-${option.id}_${detail.id}`}\n data-img-id={detail.option_value}\n class=\"go-to-slide\">\n <img data-src={detail.image} src={detail.image} title={detail.name} alt={detail.name} />\n <span innerHTML={CheckCircleIcon} class=\"s-product-options-thumbnails-icon\" />\n {this.isOptionDetailOut(detail) ?\n [\n <small key={detail.id} class=\"s-product-options-thumbnails-stock-badge\">{this.outOfStockText}</small>,\n this.canDisabled ? <div key={detail.id} class=\"s-product-options-thumbnails-badge-overlay\" /> : '',\n ]\n : ''}\n </label>\n <p>{this.getOptionDetailName(detail, false)} </p>\n </div>\n })}\n </div>\n }\n\n // Digital card options\n private digitalCardValuesOption(option: Option) {\n\n return <div class=\"s-product-options-digital-card-wrapper\">\n {this.availableDigitalCardValues.length > 0 ? this.availableDigitalCardValues.map((detail) => {\n const id = String(detail.id)\n return <label htmlFor={id} key={id} class=\"s-product-options-digital-card-option\">\n <input type=\"radio\" data-code-value class=\"s-form-control s-product-options-digital-card-input\" value={detail.id}\n name={`options[${option.id}]`}\n id={id}\n required={!option.visibility_condition && option.required}\n onInvalid={(e) => this.invalidHandler(e, option)}\n checked={!this.ignoreDefaultCardValue && this.getSelectedDigitalCardOptions(option)?.id === detail.id}\n\n />\n <span>{detail.name} {salla.config?.currency()?.symbol}</span>\n </label>\n })\n : <div class=\"s-product-options-digital-card-out-of-stock\"/>\n }\n </div>\n }\n private countryOption(option: Option) {\n return <div class=\"s-product-options-digital-card-wrapper\">\n {option.details.map((detail) => (\n <label htmlFor={String(detail.id)} key={detail.id} class={{\"s-product-options-digital-card-option\":true,\"s-product-options-digital-card-option-stock-out\":detail.is_out}}>\n <input id={String(detail.id)} type=\"radio\" class=\"s-form-control s-product-options-digital-card-input\" value={detail.id}\n name={`options[${option.id}]`}\n disabled={detail.is_out}\n required={!option.visibility_condition && option.required}\n onInvalid={(e) => this.invalidHandler(e, option)}\n onChange={e => this.changedHandler(e, option)}\n checked={this.getSelectedDigitalCardOptions(option)?.id === detail.id && salla.url.is_page('cart')}\n\n />\n <div class=\"s-product-options-country-flag-wrapper\">\n <div class={`s-product-options-country-flag flag iti__flag iti__${String(detail.code).toLocaleLowerCase()}`} />\n </div>\n <span >{detail.name}</span>\n </label>\n ))\n }\n </div>\n\n }\n\n}\n"],"version":3}
|