@salla.sa/twilight-components 2.12.6 → 2.12.8
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-4b66abc1.js → app-globals-4f8bbf37.js} +2 -2
- package/dist/cjs/app-globals-4f8bbf37.js.map +1 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/salla-add-product-button_40.cjs.entry.js +19 -26
- package/dist/cjs/salla-add-product-button_40.cjs.entry.js.map +1 -1
- package/dist/cjs/salla-product-options.cjs.entry.js +2 -1
- package/dist/cjs/salla-product-options.cjs.entry.js.map +1 -1
- package/dist/cjs/twilight.cjs.js +1 -1
- package/dist/collection/components/salla-add-product-button/salla-add-product-button.js +1 -1
- 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 +2 -1
- package/dist/collection/components/salla-product-options/salla-product-options.js.map +1 -1
- package/dist/collection/components/salla-quick-order/salla-quick-order.css +3 -0
- package/dist/collection/components/salla-social-share/salla-social-share.js +16 -23
- package/dist/collection/components/salla-social-share/salla-social-share.js.map +1 -1
- package/dist/collection/components/salla-user-menu/salla-user-menu.js +1 -1
- package/dist/collection/components/salla-user-menu/salla-user-menu.js.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/salla-add-product-button2.js +1 -1
- package/dist/components/salla-add-product-button2.js.map +1 -1
- package/dist/components/salla-product-options.js +2 -1
- package/dist/components/salla-product-options.js.map +1 -1
- package/dist/components/salla-quick-order.js +1 -1
- package/dist/components/salla-quick-order.js.map +1 -1
- package/dist/components/salla-social-share.js +16 -23
- package/dist/components/salla-social-share.js.map +1 -1
- package/dist/components/salla-user-menu.js +1 -1
- package/dist/components/salla-user-menu.js.map +1 -1
- package/dist/esm/{app-globals-4d6e9944.js → app-globals-9b658056.js} +2 -2
- package/dist/esm/app-globals-9b658056.js.map +1 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/salla-add-product-button_40.entry.js +19 -26
- package/dist/esm/salla-add-product-button_40.entry.js.map +1 -1
- package/dist/esm/salla-product-options.entry.js +2 -1
- package/dist/esm/salla-product-options.entry.js.map +1 -1
- package/dist/esm/twilight.js +1 -1
- package/dist/esm-es5/{app-globals-4d6e9944.js → app-globals-9b658056.js} +2 -2
- package/dist/esm-es5/app-globals-9b658056.js.map +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/salla-add-product-button_40.entry.js +2 -2
- package/dist/esm-es5/salla-add-product-button_40.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/esm-es5/twilight.js +1 -1
- package/dist/twilight/{p-6727a00e.system.js → p-03cfdef7.system.js} +2 -2
- package/dist/twilight/{p-1ffb1df3.js → p-17d95443.js} +2 -2
- package/dist/twilight/p-17d95443.js.map +1 -0
- package/dist/twilight/{p-5f434037.system.js → p-21935458.system.js} +2 -2
- package/dist/twilight/p-21935458.system.js.map +1 -0
- package/dist/twilight/{p-f303a498.system.entry.js → p-9a09ec73.system.entry.js} +3 -3
- package/dist/twilight/p-9a09ec73.system.entry.js.map +1 -0
- package/dist/twilight/{p-39da1865.system.entry.js → p-9c38bff9.system.entry.js} +2 -2
- package/dist/twilight/p-9c38bff9.system.entry.js.map +1 -0
- package/dist/twilight/{p-f352e833.entry.js → p-d511f5f7.entry.js} +3 -3
- package/dist/twilight/p-d511f5f7.entry.js.map +1 -0
- package/dist/twilight/p-d5a1906c.entry.js +5 -0
- package/dist/twilight/p-d5a1906c.entry.js.map +1 -0
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/twilight/twilight.js +1 -1
- package/dist/types/components/salla-social-share/salla-social-share.d.ts +0 -1
- package/package.json +5 -4
- package/dist/cjs/app-globals-4b66abc1.js.map +0 -1
- package/dist/esm/app-globals-4d6e9944.js.map +0 -1
- package/dist/esm-es5/app-globals-4d6e9944.js.map +0 -1
- package/dist/twilight/p-1ffb1df3.js.map +0 -1
- package/dist/twilight/p-39da1865.system.entry.js.map +0 -1
- package/dist/twilight/p-5f434037.system.js.map +0 -1
- package/dist/twilight/p-d9dd6370.entry.js +0 -5
- package/dist/twilight/p-d9dd6370.entry.js.map +0 -1
- package/dist/twilight/p-f303a498.system.entry.js.map +0 -1
- package/dist/twilight/p-f352e833.entry.js.map +0 -1
- /package/dist/twilight/{p-6727a00e.system.js.map → p-03cfdef7.system.js.map} +0 -0
|
@@ -34,7 +34,7 @@ const SallaAddProductButton = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
|
34
34
|
this.selectedOptions = [];
|
|
35
35
|
this.showQuickBuy = undefined;
|
|
36
36
|
salla.onReady(() => {
|
|
37
|
-
this.showQuickBuy = this.quickBuy && !!salla.config.get('store.settings.buy_now');
|
|
37
|
+
this.showQuickBuy = this.quickBuy && !!salla.config.get('store.settings.buy_now') && this.productStatus == 'sale' && this.productType !== 'booking';
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
getLabel() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"salla-add-product-button2.js","mappings":";;;;;;;;;;;;AAAA,MAAM,wBAAwB,GAAG,sEAAsE;;MCO1F,qBAAqB;EAMhC;;;;;IAJQ,mBAAc,GAAQ,EAAE,CAAC;;;;;;;;;yBAoDyC,MAAM;uBAKuD,SAAS;;;2BAWzG,EAAE;;IA/DvC,KAAK,CAAC,OAAO,CAAC;MACZ,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;KACnF,CAAC,CAAC;GACJ;EAsEO,QAAQ;IACd,IAAI,IAAI,CAAC,aAAa,KAAK,MAAM,IAAI,IAAI,CAAC,gBAAgB,IAAI,MAAM,CAAC,UAAU,IAAI,GAAG,IAAI,IAAI,CAAC,YAAY,EA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AE,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\n@Component({\n tag: 'salla-add-product-button',\n styleUrl: 'salla-add-product-button.css'\n})\nexport class SallaAddProductButton {\n\n private hostAttributes: any = {};\n private btn?: HTMLSallaButtonElement;\n private passedLabel: string;\n\n constructor() {\n salla.onReady(() => {\n this.showQuickBuy = this.quickBuy && !!salla.config.get('store.settings.buy_now');\n });\n }\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\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) {\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\n\n componentWillLoad(): void {\n this.passedLabel = this.host.innerHTML.replace('<!---->', '').trim();\n if (!!this.passedLabel && window.innerWidth >= 768) {\n this.btn?.setText(this.passedLabel);\n return;\n }\n if (this.host.hasAttribute('type') && this.host.getAttribute('type') === 'submit' && this.supportStickyBar) {\n window.addEventListener('resize', () => {\n if (window.innerWidth >= 768 && !!this.passedLabel) {\n this.btn?.setText(this.passedLabel)\n } else {\n this.btn?.setText(this.getLabel())\n }\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 }}>\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 ? <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;;MCO1F,qBAAqB;EAMhC;;;;;IAJQ,mBAAc,GAAQ,EAAE,CAAC;;;;;;;;;yBAoDyC,MAAM;uBAKuD,SAAS;;;2BAWzG,EAAE;;IA/DvC,KAAK,CAAC,OAAO,CAAC;MACZ,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,wBAAwB,CAAC,IAAI,IAAI,CAAC,aAAa,IAAI,MAAM,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,CAAC;KACrJ,CAAC,CAAC;GACJ;EAsEO,QAAQ;IACd,IAAI,IAAI,CAAC,aAA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ag=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\n@Component({\n tag: 'salla-add-product-button',\n styleUrl: 'salla-add-product-button.css'\n})\nexport class SallaAddProductButton {\n\n private hostAttributes: any = {};\n private btn?: HTMLSallaButtonElement;\n private passedLabel: string;\n\n constructor() {\n salla.onReady(() => {\n this.showQuickBuy = this.quickBuy && !!salla.config.get('store.settings.buy_now') && this.productStatus == 'sale' && this.productType !== 'booking';\n });\n }\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\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) {\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\n\n componentWillLoad(): void {\n this.passedLabel = this.host.innerHTML.replace('<!---->', '').trim();\n if (!!this.passedLabel && window.innerWidth >= 768) {\n this.btn?.setText(this.passedLabel);\n return;\n }\n if (this.host.hasAttribute('type') && this.host.getAttribute('type') === 'submit' && this.supportStickyBar) {\n window.addEventListener('resize', () => {\n if (window.innerWidth >= 768 && !!this.passedLabel) {\n this.btn?.setText(this.passedLabel)\n } else {\n this.btn?.setText(this.getLabel())\n }\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 }}>\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 ? <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}
|
|
@@ -243,9 +243,10 @@ const SallaProductOptions$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
|
243
243
|
}
|
|
244
244
|
//@ts-ignore
|
|
245
245
|
donationOption(option, product) {
|
|
246
|
+
var _a;
|
|
246
247
|
return h("div", { class: "s-product-options-donation-wrapper" }, option.donation ?
|
|
247
248
|
h("div", { class: "s-product-options-donation-progress" }, h("salla-progress-bar", { donation: option.donation }))
|
|
248
|
-
: '', h("div", { class: "s-product-options-donation-input-group" }, h("input", { type: "text", id: "donating-amount", name: "donating_amount", class: "s-form-control", value: option.value, required: true, placeholder: option.placeholder, onInput: e => salla.helpers.inputDigitsOnly(e.target), onBlur: e => this.changedHandler(e, option), onInvalid: (e) => this.invalidHandler(e, option) }), h("span", { class: "s-product-options-donation-amount-currency" }, salla.config.currency(salla.config.get('user.currency_code')).symbol)));
|
|
249
|
+
: '', ((_a = option.donation) === null || _a === void 0 ? void 0 : _a.can_donate) ? h("div", { class: "s-product-options-donation-input-group" }, h("input", { type: "text", id: "donating-amount", name: "donating_amount", class: "s-form-control", value: option.value, required: true, placeholder: option.placeholder, onInput: e => salla.helpers.inputDigitsOnly(e.target), onBlur: e => this.changedHandler(e, option), onInvalid: (e) => this.invalidHandler(e, option) }), h("span", { class: "s-product-options-donation-amount-currency" }, salla.config.currency(salla.config.get('user.currency_code')).symbol)) : '');
|
|
249
250
|
}
|
|
250
251
|
fileUploader(option, additions = null) {
|
|
251
252
|
return h("salla-file-upload", Object.assign({}, (additions || {}), { "payload-name": "file", value: option.value, "instant-upload": true, name: `options[${option.id}]`, required: option.required, height: "120px", onAdded: (e) => this.changedHandler(e, option), url: salla.cart.api.getUploadImageEndpoint(), "form-data": { cart_item_id: this.productId, product_id: this.productId }, onInvalidInput: (e) => this.invalidHandler(e, option), class: { "s-product-options-image-input": true, required: option.required } }), h("div", { class: "s-product-options-filepond-placeholder" }, h("span", { class: "s-product-options-filepond-placeholder-icon", innerHTML: additions.accept && additions.accept.split(',').every(type => type.includes('image'))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"salla-product-options.js","mappings":";;;;;;;;;;;;;;;AAAA,IAAY,WAoBX;AApBD,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,oCAAqB,CAAA;EACrB,4BAAa,CAAA;EACb,oCAAqB,CAAA;EACrB,sCAAuB,CAAA;EACvB,4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BAChB,MAAM,CAAC,YAAY,EAChC,QAAQ,EAAE,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,EAC5D,EAAE,EAAE,UAAU,IAAI,CAAC,SAAS,IAAI,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC,EAAE,EAAE,EACxD,SAAS,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,cAAc,CAAC,CAAC,EAAE,MAAM,CAAC,EAChD,QAAQ,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,cAAc,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG,EACzD,aAAO,OAAO,EAAE,UAAU,IAAI,CAAC,SAAS,IAAI,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC,EAAE,EAAE,iBAChD,MAAM,CAAC,YAAY,EAChC,KAAK,EAAC,aAAa,IACxB,uBAAe,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,CAAC,IAAI,GAAG,EACvF,YAAM,SAAS,EAAE,eAAe,EAAE,KAAK,EAAC,mCAAmC,GAAE,EAC5E,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC;QAC7B;UACE,aAAO,KAAK,EAAC,0CAA0C,IAAE,IAAI,CAAC,cAAc,CAAS;UACrF,IAAI,CAAC,WAAW,GAAG,WAAK,KAAK,EAAC,4CAA4C,GAAE,GAAG,EAAE;SAClF;UACC,EAAE,CACA,EACR,aAAI,IAAI,CAAC,mBAAmB,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAC7C,CAAA;KACP,CAAC,CACE,CAAA;GACP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","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 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\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}\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 donation?: Donation\n}\n\nexport interface Donation {\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}\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, EventEmitter, Method} from '@stencil/core';\nimport {Option, DisplayType, 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.products.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 });\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 let 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\n @Element() host: HTMLElement;\n\n private fileTypes: Object = {\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: string = ''\n @State() donationAmount: string = salla.lang.get('pages.products.donation_amount')\n @State() selectedOptions: Array<any> = [];\n @State() canDisabled: boolean;\n @State() selectedSkus?: Array<string | number>;\n @State() selectedOutSkus?: Array<string | number>;\n private outSkus: Array<string | number> = [];\n\n\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 let selectedOptions = {}\n let formData = (this.host as any).getElementSallaData();\n formData.forEach(function (value, key) {\n 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 let requiredElements: Array<HTMLInputElement> = this.host.querySelectorAll('[required]') as any;\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 private changedHandler(event, option) {\n let data = {event: event, option: option, detail: null};\n if (option.details) {\n let detail = option.details.find((detail) => {\n return Number(detail.id) === Number(event.target.value);\n });\n data.detail = detail\n }\n\n let 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 this.setSelectedSkus();\n this.handleRequiredMultipleOptions(option);\n this.changed.emit(data);\n salla.event.emit('product-options::change', data);\n }\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 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 //we need the cart Id for productOption Image\n componentWillLoad() {\n this.outOfStockText = salla.lang.get('pages.products.out_of_stock')\n return salla.api.cart.getCurrentCartId();\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 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\" data-option-type={option.type}\n data-option-required={`${option.required}`}>\n <label htmlFor={'options[' + option.id + ']'} class=\"s-product-options-option-label\">\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\">\n {this.getDisplayForType(option)}\n </div>\n </div>}\n </div>\n )}\n </salla-conditional-fields>\n </Host>\n );\n\n }\n\n //@ts-ignore\n private donationOption(option: Option, product: Product) {\n return <div class=\"s-product-options-donation-wrapper\">\n {\n option.donation ?\n <div class=\"s-product-options-donation-progress\">\n <salla-progress-bar donation={option.donation}>\n </salla-progress-bar>\n </div>\n : ''\n }\n <div class=\"s-product-options-donation-input-group\">\n <input\n type=\"text\"\n id=\"donating-amount\"\n name=\"donating_amount\"\n class=\"s-form-control\"\n value={option.value}\n required\n placeholder={option.placeholder}\n onInput={e => salla.helpers.inputDigitsOnly(e.target)}\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 </div>\n }\n\n private fileUploader(option: Option, additions: Object | 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.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 any).accept && (additions as any).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 let 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.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 class='s-form-control'\n required={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 class=\"s-form-control\"\n required={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.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.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.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.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: boolean = 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 let 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 let 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.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 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 return <div class={{\"s-product-options-multiple-options-wrapper\": true, 'required': option.required}}>\n {\n option?.details.map((detail: Detail) => {\n return <div>\n <input type=\"checkbox\"\n value={detail.id}\n disabled={this.isOptionDetailOut(detail)}\n checked={detail.is_selected}\n required={option.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\">\n <input type=\"radio\"\n value={detail.id}\n required={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)}></div>\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>\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.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 class=\"s-product-options-thumbnails-stock-badge\">{this.outOfStockText}</small>,\n this.canDisabled ? <div 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"],"version":3}
|
|
1
|
+
{"file":"salla-product-options.js","mappings":";;;;;;;;;;;;;;;AAAA,IAAY,WAoBX;AApBD,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,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;AAE/B,CAAC,EApBW,WAAW,KAAX,WAAW,QAoBtB;AA8HD,IAAY,QAEX;AAFD,WAAY,QAAQ;EAClB,uBAAW,CAAA;AACb,CAAC,EAFW,QAAQ,KAAR,QAAQ;;;;;;;;;;;;;;;;AClJpB,MAAM,sBAAsB,GAAG,EAAE;;MCWpBA,qBAAmB;EAE9B;;;;IAsCQ,cAAS,GAAW;MAC1B,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;IASM,YAAO,GAA2B,EAAE,CAAC;;0BANX,EAAE;0BACF,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,gCAAgC,CAAC;2BAC3C,EAAE;;;;qBAUb,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC;;IA3DrD,IAAI,CAAC,WAAW,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,qDAAqD,CAAC,CAAC;IAC5F,KAAK,CAAC,IAAI,CAAC,QAAQ,CAA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AiB,CAAC,MAAM,CAAC;QAC7B;UACE,aAAO,KAAK,EAAC,0CAA0C,IAAE,IAAI,CAAC,cAAc,CAAS;UACrF,IAAI,CAAC,WAAW,GAAG,WAAK,KAAK,EAAC,4CAA4C,GAAE,GAAG,EAAE;SAClF;UACC,EAAE,CACA,EACR,aAAI,IAAI,CAAC,mBAAmB,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAC7C,CAAA;KACP,CAAC,CACE,CAAA;GACP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","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 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\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}\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 donation?: Donation\n}\n\nexport interface Donation {\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}\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, EventEmitter, Method} from '@stencil/core';\nimport {Option, DisplayType, 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.products.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 });\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 let 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\n @Element() host: HTMLElement;\n\n private fileTypes: Object = {\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: string = ''\n @State() donationAmount: string = salla.lang.get('pages.products.donation_amount')\n @State() selectedOptions: Array<any> = [];\n @State() canDisabled: boolean;\n @State() selectedSkus?: Array<string | number>;\n @State() selectedOutSkus?: Array<string | number>;\n private outSkus: Array<string | number> = [];\n\n\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 let selectedOptions = {}\n let formData = (this.host as any).getElementSallaData();\n formData.forEach(function (value, key) {\n 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 let requiredElements: Array<HTMLInputElement> = this.host.querySelectorAll('[required]') as any;\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 private changedHandler(event, option) {\n let data = {event: event, option: option, detail: null};\n if (option.details) {\n let detail = option.details.find((detail) => {\n return Number(detail.id) === Number(event.target.value);\n });\n data.detail = detail\n }\n\n let 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 this.setSelectedSkus();\n this.handleRequiredMultipleOptions(option);\n this.changed.emit(data);\n salla.event.emit('product-options::change', data);\n }\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 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 //we need the cart Id for productOption Image\n componentWillLoad() {\n this.outOfStockText = salla.lang.get('pages.products.out_of_stock')\n return salla.api.cart.getCurrentCartId();\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 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\" data-option-type={option.type}\n data-option-required={`${option.required}`}>\n <label htmlFor={'options[' + option.id + ']'} class=\"s-product-options-option-label\">\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\">\n {this.getDisplayForType(option)}\n </div>\n </div>}\n </div>\n )}\n </salla-conditional-fields>\n </Host>\n );\n\n }\n\n //@ts-ignore\n private donationOption(option: Option, product: Product) {\n return <div class=\"s-product-options-donation-wrapper\">\n {\n option.donation ?\n <div class=\"s-product-options-donation-progress\">\n <salla-progress-bar donation={option.donation}>\n </salla-progress-bar>\n </div>\n : ''\n }\n {option.donation?.can_donate ? <div class=\"s-product-options-donation-input-group\">\n <input\n type=\"text\"\n id=\"donating-amount\"\n name=\"donating_amount\"\n class=\"s-form-control\"\n value={option.value}\n required\n placeholder={option.placeholder}\n onInput={e => salla.helpers.inputDigitsOnly(e.target)}\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 </div>\n }\n\n private fileUploader(option: Option, additions: Object | 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.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 any).accept && (additions as any).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 let 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.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 class='s-form-control'\n required={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 class=\"s-form-control\"\n required={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.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.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.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.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: boolean = 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 let 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 let 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.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 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 return <div class={{\"s-product-options-multiple-options-wrapper\": true, 'required': option.required}}>\n {\n option?.details.map((detail: Detail) => {\n return <div>\n <input type=\"checkbox\"\n value={detail.id}\n disabled={this.isOptionDetailOut(detail)}\n checked={detail.is_selected}\n required={option.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\">\n <input type=\"radio\"\n value={detail.id}\n required={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)}></div>\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>\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.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 class=\"s-product-options-thumbnails-stock-badge\">{this.outOfStockText}</small>,\n this.canDisabled ? <div 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"],"version":3}
|
|
@@ -30,7 +30,7 @@ const IphoneXIcon = `<!-- Generated by IcoMoon.io -->
|
|
|
30
30
|
</svg>
|
|
31
31
|
`;
|
|
32
32
|
|
|
33
|
-
const sallaQuickOrderCss = "";
|
|
33
|
+
const sallaQuickOrderCss = ".s-quick-order-expandable:not(.s-quick-order-shown){overflow:hidden}";
|
|
34
34
|
|
|
35
35
|
const SallaQuickOrder$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
36
36
|
constructor() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"salla-quick-order.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAM,kBAAkB,GAAG,EAAE;;MCahBA,iBAAe;EAgF1B;;;;2BA9DiD,YAAY;oBAInB,6BAA6B;0BAIvB,aAAa;iCAIN,WAAW;yBAInB,KAAK,CAAC,IAAI,CAAC,GAAG,CAC3D,oCAAoC,CACrC;2BAIiD,KAAK;;;2BAcgB,SAAS;;uBAOhD,KAAK;oBACR,KAAK;oBACL,KAAK;2BACE,KAAK;uBACV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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["SallaQuickOrder","CancelIcon","MailIcon"],"sources":["./src/components/salla-quick-order/salla-quick-order.scss?tag=salla-quick-order","./src/components/salla-quick-order/salla-quick-order.tsx"],"sourcesContent":["\n.s-quick-order{\n &-container{\n\n }\n &-button-cont{\n\n }\n // The collapsible content. Hidden by default\n &-expandable{\n\n }\n // Shown state of the collapsible content\n &-shown{\n\n }\n &-terms{\n\n }\n &-confirm{\n\n }\n}","import {Component, Host, h, Prop, State, Event, EventEmitter, Element} from '@stencil/core';\nimport CelebrationIcon from '../../assets/svg/party-horn.svg';\nimport PortraitIcon from '../../assets/svg/portrait.svg';\nimport IphoneXIcon from '../../assets/svg/iphone-x.svg';\nimport MailIcon from '../../assets/svg/mail.svg';\nimport {CartRequest, QuickOrderSetting} from '@salla.sa/twilight/types/api/cart';\nimport quickOrderPayload = CartRequest.quickOrderPayload;\nimport CancelIcon from '../../assets/svg/cancel.svg';\n\n@Component({\n tag: 'salla-quick-order',\n styleUrl: 'salla-quick-order.scss',\n})\nexport class SallaQuickOrder {\n\n @Element() host: HTMLElement;\n\n\n // modal refs\n private agreementModal: HTMLSallaModalElement;\n\n // input refs\n private nameInput: HTMLInputElement;\n private emailInput: HTMLInputElement;\n private phoneInput: HTMLSallaTelInputElement;\n private termsInput: HTMLInputElement;\n private submitBtn: HTMLSallaButtonElement;\n\n /**\n * quick order title\n */\n @Prop({mutable: true}) quickOrderTitle: string = 'ليش تنتظر؟';\n /**\n * quick order sub title\n */\n @Prop({mutable: true}) subTitle: string = 'احصل على المنتج مباشرة الآن';\n /**\n * quick order pay button text\n */\n @Prop({mutable: true}) payButtonTitle: string = 'اطلب المنتج';\n /**\n * quick order confirm pay button text\n */\n @Prop({mutable: true}) confirmPayButtonTitle: string = 'اشتر الآن';\n /**\n * agreement text from server or from props\n */\n @Prop({mutable: true}) agreementText: string = salla.lang.get(\n 'pages.checkout.show_full_agreement'\n );\n /**\n * is email required\n */\n @Prop({mutable: true}) isEmailRequired: boolean = false;\n /**\n * product id local or from page\n */\n @Prop({mutable: true}) productId: string;\n\n /**\n * product id local or from page\n */\n @Prop({mutable: true}) thanksMessage: string;\n\n /**\n * Quick Order Style\n */\n @Prop({mutable: true}) quickOrderStyle: 'gray' | 'white' | 'default' = 'default';\n\n /*\n * states\n */\n\n @State() user: any;\n @State() isAvailable: boolean = false;\n @State() oneClick: boolean = false;\n @State() expanded: boolean = false;\n @State() isTermsRequired: boolean = false;\n @State() countryCode: string = salla.config.get('user.country_code', 'SA') || 'SA';\n @State() submitSucess: boolean = false;\n //Langugae states\n @State() placeHolderEmail: string = salla.lang.get('common.elements.email');\n @State() emailOptional: string = salla.lang.get('common.elements.optional');\n @State() agreementShowText: string = salla.lang.get('pages.checkout.show_full_agreement');\n @State() agreementModalHead: string = salla.lang.get('pages.checkout.full_agreement');\n @State() userNameLabel: string = salla.lang.get('pages.products.your_name');\n @State() termsChecked: boolean = false;\n\n /**\n * Custome DOM event emitter when order gets submitted successfully.\n */\n @Event() quickOrderSubmited: EventEmitter;\n\n constructor() {\n salla.onReady(() => {\n this.productId = this.productId || salla.config.get('page.id');\n })\n\n salla.lang.onLoaded(() => {\n this.placeHolderEmail = salla.lang.get('common.elements.email');\n this.emailOptional = salla.lang.get('common.elements.optional');\n this.agreementShowText = salla.lang.get('pages.checkout.show_full_agreement');\n this.agreementModalHead = salla.lang.get('pages.checkout.full_agreement');\n this.userNameLabel = salla.lang.get('pages.products.your_name');\n });\n }\n\n private getBtnColor() {\n return this.quickOrderStyle === 'default' ? 'light' : 'primary';\n }\n\n private getErrorMessage(type, name) {\n return name == 'terms'\n ? salla.lang.get('pages.checkout.check_agreement')\n : salla.lang.get(`common.errors.${type}`, {attribute: name == 'name' ? this.userNameLabel : this.placeHolderEmail});\n }\n\n private handleInvalidInput(e) {\n let input = e.target;\n let validity = input.validity;\n let errorMessage;\n if (validity.valueMissing) {\n errorMessage = this.getErrorMessage('field_required', input.name);\n console.log(this.getErrorMessage('field_required', input.name));\n } else if (validity.typeMismatch) {\n errorMessage = this.getErrorMessage('invalid_value', input.name);\n }\n input.setCustomValidity(errorMessage);\n }\n\n\n private async setWrapperHeight() {\n let expandable: HTMLElement = this.host.querySelector('.s-quick-order-expandable') as HTMLElement;\n setTimeout(() => {\n if (expandable.style.maxHeight || this.oneClick) {\n expandable.style.maxHeight = null;\n } else {\n expandable.style.maxHeight = expandable.scrollHeight + \"px\";\n }\n }, 50);\n }\n\n private getDarkOrLight() {\n return this.quickOrderStyle === 'default' && salla.config.get('theme.color.is_dark') ? 'dark' : 'light';\n }\n\n private getStyleColor() {\n return {\n gray: '#f3f3f3',\n white: '#ffffff',\n default: salla.config.get('theme.color.primary'),\n }[this.quickOrderStyle] || '#f3f3f3';\n }\n\n async submit(e, checkOneClick: boolean = false) {\n e.preventDefault();\n if (checkOneClick && !this.oneClick) {\n this.expanded = !this.expanded;\n this.setWrapperHeight();\n return;\n }\n\n return this.submitBtn.load()\n .then(() => this.getPayload())\n .then((payload: quickOrderPayload) => salla.api.cart.createQuickOrder(payload))\n .then(() => {\n setTimeout(() => {\n this.submitBtn.stop();\n this.submitSucess = true;\n this.quickOrderSubmited.emit();\n }, 200);\n })\n .catch(error => error && (console.error(error), this.submitBtn.stop()));\n }\n\n private async getPayload(): Promise<CartRequest.quickOrderPayload | Object | false> {\n if (this.oneClick) {\n return {\n product_ids: [this.productId],\n agreement: true,\n };\n }\n\n return {\n product_ids: [this.productId],\n email: this.emailInput?.value,\n phone: Number((await this.phoneInput?.getValues())?.phone),\n country_code: (await this.phoneInput?.getValues())?.countryCode || this.countryCode,\n name: this.nameInput?.value,\n agreement: this.termsChecked,\n };\n }\n\n formatAgreementText(agreement_text, length = 150) {\n if (!agreement_text) return '';\n if (agreement_text.length <= length) return agreement_text;\n const parsedToDOM = new DOMParser().parseFromString(agreement_text, 'text/html');\n return parsedToDOM.documentElement.innerText.substring(0, length) + '...';\n }\n\n private loadQuickOrderSettings() {\n let data = salla.config.get('store.settings.product.quick_order');\n if (!data) {\n return Promise.resolve();\n }\n\n this.user = salla.config.get('user') || salla.storage.get('user') || {};\n this.countryCode = this.user?.country_code || this.countryCode;\n // make email required if user is gust or is required from server\n this.isEmailRequired = this.user?.email ? false : this.isEmailRequired;\n // check if one click is available\n this.oneClick = this.user?.email;\n this.initComponentData(data);\n return Promise.resolve();\n\n // return salla.api.withoutNotifier(() => salla.api.cart.getQuickOrderSettings().then(res => this.initComponentData(res.data)));\n }\n\n private initComponentData(data: QuickOrderSetting) {\n this.quickOrderTitle = data.title;\n this.subTitle = data.sub_title;\n this.payButtonTitle = data.order_now_button;\n this.isEmailRequired = data.is_email_required;\n this.isTermsRequired = data.show_agreement;\n this.agreementText = data.agreement;\n this.confirmPayButtonTitle = data.confirm_button;\n this.thanksMessage = data.thanks_message;\n this.quickOrderStyle = data.style;\n this.isAvailable = true;\n // toggle oneClick if true\n this.oneClick = this.oneClick && !this.isTermsRequired\n }\n\n componentWillLoad() {\n return new Promise(resolve => salla.onReady(() => this.loadQuickOrderSettings().then(resolve)))\n }\n\n render() {\n if (!this.isAvailable) {\n return;\n }\n if (this.submitSucess) {\n return (\n <Host class=\"s-quick-order\">\n <div class={'s-quick-order-confirm'} style={{\n backgroundColor: salla.config.get('theme.color.primary') + '10',\n borderColor: salla.config.get('theme.color.primary') + '10',\n color: salla.config.get('theme.color.primary')\n }}>\n <i innerHTML={CelebrationIcon}/>\n <span>{this.thanksMessage}</span>\n </div>\n </Host>\n );\n }\n return (\n <Host class={`s-quick-order s-quick-order-${this.getDarkOrLight()}`}>\n <div class={`s-quick-order-container s-quick-order-${this.quickOrderStyle}`}\n style={{backgroundColor: this.getStyleColor()}}>\n <div class=\"s-quick-order-button-cont\">\n {/*todo:: if we can remove this dom, lets do it*/}\n <div>\n <h3>{this.quickOrderTitle}</h3>\n <p>{this.subTitle}</p>\n </div>\n\n <salla-button class={this.expanded ? \"s-quick-order-btn-close\" : \"\"} onClick={(e) => this.submit(e, true)}\n color={this.getBtnColor()}>\n {this.oneClick\n ? this.confirmPayButtonTitle : this.expanded ? <i innerHTML={CancelIcon}/> : this.confirmPayButtonTitle}\n </salla-button>\n </div>\n <form onSubmit={(e) => this.submit(e)}\n class={'s-quick-order-expandable ' + (this.expanded ? 's-quick-order-shown' : '')}>\n {/*we don't need to show name & phone & email unless it's guest*/}\n {Salla.config.isGuest() &&\n [\n <div class=\"s-form-group\">\n <span innerHTML={PortraitIcon}/>\n <input type=\"text\"\n required\n class=\"s-form-control s-quick-order-phone-field\"\n name='name'\n placeholder={this.userNameLabel}\n ref={el => (this.nameInput = el)}\n />\n </div>\n ,\n <div class=\"s-quick-order-flex-input\">\n <div class=\"s-form-group\">\n <span innerHTML={IphoneXIcon}/>\n <salla-tel-input ref={el => (this.phoneInput = el)}/>\n </div>\n <div class=\"s-form-group\">\n <span innerHTML={MailIcon}/>\n <input type=\"email\"\n class=\"s-form-control s-quick-order-email-field\"\n name='email'\n required={this.isEmailRequired}\n placeholder={this.placeHolderEmail + ' ' + (this.isEmailRequired ? '' : this.emailOptional)}\n ref={el => (this.emailInput = el)}\n />\n </div>\n </div>,\n ]\n }\n {this.isTermsRequired && (\n <label htmlFor=\"terms\" class=\"s-quick-order-terms\">\n <input type=\"checkbox\" required name='terms' id='terms' ref={el => (this.termsInput = el)}\n onChange={() => (this.termsChecked = this.termsInput.checked)} class=\"s-checkbox\"/>\n <span class=\"s-form-label\"> <div innerHTML={this.formatAgreementText(this.agreementText, 150)}>\n {this.agreementText.length > 150 && (\n <salla-button shape=\"link\" onClick={() => this.agreementModal.open()}>\n {this.agreementShowText}\n </salla-button>\n )}\n </div> </span>\n </label>\n )}\n {/* @ts-ignore */}\n <salla-button type=\"submit\" color={this.getBtnColor()} width=\"wide\" ref={el => (this.submitBtn = el)}>\n {this.payButtonTitle}\n </salla-button>\n </form>\n <salla-modal modal-title={this.agreementModalHead} ref={modal => (this.agreementModal = modal)}>\n <article innerHTML={this.agreementText}/>\n </salla-modal>\n </div>\n </Host>\n );\n }\n\n componentDidLoad() {\n this.host.querySelectorAll('input').forEach(input => {\n input.addEventListener('invalid', e => {\n this.handleInvalidInput(e);\n });\n input.addEventListener('input', () => {\n input.setCustomValidity('');\n input.reportValidity();\n }\n );\n });\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"salla-quick-order.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAM,kBAAkB,GAAG,sEAAsE;;MCapFA,iBAAe;EAgF1B;;;;2BA9DiD,YAAY;oBAInB,6BAA6B;0BAIvB,aAAa;iCAIN,WAAW;yBAInB,KAAK,CAAC,IAAI,CAAC,GAAG,CAC3D,oCAAoC,CACrC;2BAIiD,KAAK;;;2BAcgB,SAAS;;uBAOhD,KAAK;oBACR,KAAK;oBACL,KAAK;2BACE,KAAK;uBACV,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,mBAAmB,EAAE,IAAI,CAAC,IAAI,IAAI;wBACjD,KAAK;4BAEF,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,uBAAuB,CAAC;yBAC1C,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,0BAA0B,CAAC;6BACtC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,oCAAoC,CAAC;8BACnD,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,+BAA+B,CAAC;yBACpD,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,0BAA0B,CAAC;wBAC1C,KAAK;IAQpC,KAAK,CAAC,OAAO,CAAC;MACZ,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;KAChE,CAAC,CAAA;IAEF,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC;MAClB,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;MAChE,IAAI,CA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,KAAK,KAAK,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,IAC5F,eAAS,SAAS,EAAE,IAAI,CAAC,aAAa,GAAG,CAC7B,CACV,CACD,EACP;GACH;EAED,gBAAgB;IACd,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK;MAC/C,KAAK,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC;QACjC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;OAC5B,CAAC,CAAC;MACH,KAAK,CAAC,gBAAgB,CAAC,OAAO,EAAE;QAC5B,KAAK,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;QAC5B,KAAK,CAAC,cAAc,EAAE,CAAC;OACxB,CACF,CAAC;KACH,CAAC,CAAC;GACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["SallaQuickOrder","CancelIcon","MailIcon"],"sources":["./src/components/salla-quick-order/salla-quick-order.scss?tag=salla-quick-order","./src/components/salla-quick-order/salla-quick-order.tsx"],"sourcesContent":["\n.s-quick-order{\n &-container{\n\n }\n &-button-cont{\n\n }\n // The collapsible content. Hidden by default\n &-expandable{\n &:not(.s-quick-order-shown){\n overflow: hidden;\n }\n }\n // Shown state of the collapsible content\n &-shown{\n\n }\n &-terms{\n\n }\n &-confirm{\n\n }\n}","import {Component, Host, h, Prop, State, Event, EventEmitter, Element} from '@stencil/core';\nimport CelebrationIcon from '../../assets/svg/party-horn.svg';\nimport PortraitIcon from '../../assets/svg/portrait.svg';\nimport IphoneXIcon from '../../assets/svg/iphone-x.svg';\nimport MailIcon from '../../assets/svg/mail.svg';\nimport {CartRequest, QuickOrderSetting} from '@salla.sa/twilight/types/api/cart';\nimport quickOrderPayload = CartRequest.quickOrderPayload;\nimport CancelIcon from '../../assets/svg/cancel.svg';\n\n@Component({\n tag: 'salla-quick-order',\n styleUrl: 'salla-quick-order.scss',\n})\nexport class SallaQuickOrder {\n\n @Element() host: HTMLElement;\n\n\n // modal refs\n private agreementModal: HTMLSallaModalElement;\n\n // input refs\n private nameInput: HTMLInputElement;\n private emailInput: HTMLInputElement;\n private phoneInput: HTMLSallaTelInputElement;\n private termsInput: HTMLInputElement;\n private submitBtn: HTMLSallaButtonElement;\n\n /**\n * quick order title\n */\n @Prop({mutable: true}) quickOrderTitle: string = 'ليش تنتظر؟';\n /**\n * quick order sub title\n */\n @Prop({mutable: true}) subTitle: string = 'احصل على المنتج مباشرة الآن';\n /**\n * quick order pay button text\n */\n @Prop({mutable: true}) payButtonTitle: string = 'اطلب المنتج';\n /**\n * quick order confirm pay button text\n */\n @Prop({mutable: true}) confirmPayButtonTitle: string = 'اشتر الآن';\n /**\n * agreement text from server or from props\n */\n @Prop({mutable: true}) agreementText: string = salla.lang.get(\n 'pages.checkout.show_full_agreement'\n );\n /**\n * is email required\n */\n @Prop({mutable: true}) isEmailRequired: boolean = false;\n /**\n * product id local or from page\n */\n @Prop({mutable: true}) productId: string;\n\n /**\n * product id local or from page\n */\n @Prop({mutable: true}) thanksMessage: string;\n\n /**\n * Quick Order Style\n */\n @Prop({mutable: true}) quickOrderStyle: 'gray' | 'white' | 'default' = 'default';\n\n /*\n * states\n */\n\n @State() user: any;\n @State() isAvailable: boolean = false;\n @State() oneClick: boolean = false;\n @State() expanded: boolean = false;\n @State() isTermsRequired: boolean = false;\n @State() countryCode: string = salla.config.get('user.country_code', 'SA') || 'SA';\n @State() submitSucess: boolean = false;\n //Langugae states\n @State() placeHolderEmail: string = salla.lang.get('common.elements.email');\n @State() emailOptional: string = salla.lang.get('common.elements.optional');\n @State() agreementShowText: string = salla.lang.get('pages.checkout.show_full_agreement');\n @State() agreementModalHead: string = salla.lang.get('pages.checkout.full_agreement');\n @State() userNameLabel: string = salla.lang.get('pages.products.your_name');\n @State() termsChecked: boolean = false;\n\n /**\n * Custome DOM event emitter when order gets submitted successfully.\n */\n @Event() quickOrderSubmited: EventEmitter;\n\n constructor() {\n salla.onReady(() => {\n this.productId = this.productId || salla.config.get('page.id');\n })\n\n salla.lang.onLoaded(() => {\n this.placeHolderEmail = salla.lang.get('common.elements.email');\n this.emailOptional = salla.lang.get('common.elements.optional');\n this.agreementShowText = salla.lang.get('pages.checkout.show_full_agreement');\n this.agreementModalHead = salla.lang.get('pages.checkout.full_agreement');\n this.userNameLabel = salla.lang.get('pages.products.your_name');\n });\n }\n\n private getBtnColor() {\n return this.quickOrderStyle === 'default' ? 'light' : 'primary';\n }\n\n private getErrorMessage(type, name) {\n return name == 'terms'\n ? salla.lang.get('pages.checkout.check_agreement')\n : salla.lang.get(`common.errors.${type}`, {attribute: name == 'name' ? this.userNameLabel : this.placeHolderEmail});\n }\n\n private handleInvalidInput(e) {\n let input = e.target;\n let validity = input.validity;\n let errorMessage;\n if (validity.valueMissing) {\n errorMessage = this.getErrorMessage('field_required', input.name);\n console.log(this.getErrorMessage('field_required', input.name));\n } else if (validity.typeMismatch) {\n errorMessage = this.getErrorMessage('invalid_value', input.name);\n }\n input.setCustomValidity(errorMessage);\n }\n\n\n private async setWrapperHeight() {\n let expandable: HTMLElement = this.host.querySelector('.s-quick-order-expandable') as HTMLElement;\n setTimeout(() => {\n if (expandable.style.maxHeight || this.oneClick) {\n expandable.style.maxHeight = null;\n } else {\n expandable.style.maxHeight = expandable.scrollHeight + \"px\";\n }\n }, 50);\n }\n\n private getDarkOrLight() {\n return this.quickOrderStyle === 'default' && salla.config.get('theme.color.is_dark') ? 'dark' : 'light';\n }\n\n private getStyleColor() {\n return {\n gray: '#f3f3f3',\n white: '#ffffff',\n default: salla.config.get('theme.color.primary'),\n }[this.quickOrderStyle] || '#f3f3f3';\n }\n\n async submit(e, checkOneClick: boolean = false) {\n e.preventDefault();\n if (checkOneClick && !this.oneClick) {\n this.expanded = !this.expanded;\n this.setWrapperHeight();\n return;\n }\n\n return this.submitBtn.load()\n .then(() => this.getPayload())\n .then((payload: quickOrderPayload) => salla.api.cart.createQuickOrder(payload))\n .then(() => {\n setTimeout(() => {\n this.submitBtn.stop();\n this.submitSucess = true;\n this.quickOrderSubmited.emit();\n }, 200);\n })\n .catch(error => error && (console.error(error), this.submitBtn.stop()));\n }\n\n private async getPayload(): Promise<CartRequest.quickOrderPayload | Object | false> {\n if (this.oneClick) {\n return {\n product_ids: [this.productId],\n agreement: true,\n };\n }\n\n return {\n product_ids: [this.productId],\n email: this.emailInput?.value,\n phone: Number((await this.phoneInput?.getValues())?.phone),\n country_code: (await this.phoneInput?.getValues())?.countryCode || this.countryCode,\n name: this.nameInput?.value,\n agreement: this.termsChecked,\n };\n }\n\n formatAgreementText(agreement_text, length = 150) {\n if (!agreement_text) return '';\n if (agreement_text.length <= length) return agreement_text;\n const parsedToDOM = new DOMParser().parseFromString(agreement_text, 'text/html');\n return parsedToDOM.documentElement.innerText.substring(0, length) + '...';\n }\n\n private loadQuickOrderSettings() {\n let data = salla.config.get('store.settings.product.quick_order');\n if (!data) {\n return Promise.resolve();\n }\n\n this.user = salla.config.get('user') || salla.storage.get('user') || {};\n this.countryCode = this.user?.country_code || this.countryCode;\n // make email required if user is gust or is required from server\n this.isEmailRequired = this.user?.email ? false : this.isEmailRequired;\n // check if one click is available\n this.oneClick = this.user?.email;\n this.initComponentData(data);\n return Promise.resolve();\n\n // return salla.api.withoutNotifier(() => salla.api.cart.getQuickOrderSettings().then(res => this.initComponentData(res.data)));\n }\n\n private initComponentData(data: QuickOrderSetting) {\n this.quickOrderTitle = data.title;\n this.subTitle = data.sub_title;\n this.payButtonTitle = data.order_now_button;\n this.isEmailRequired = data.is_email_required;\n this.isTermsRequired = data.show_agreement;\n this.agreementText = data.agreement;\n this.confirmPayButtonTitle = data.confirm_button;\n this.thanksMessage = data.thanks_message;\n this.quickOrderStyle = data.style;\n this.isAvailable = true;\n // toggle oneClick if true\n this.oneClick = this.oneClick && !this.isTermsRequired\n }\n\n componentWillLoad() {\n return new Promise(resolve => salla.onReady(() => this.loadQuickOrderSettings().then(resolve)))\n }\n\n render() {\n if (!this.isAvailable) {\n return;\n }\n if (this.submitSucess) {\n return (\n <Host class=\"s-quick-order\">\n <div class={'s-quick-order-confirm'} style={{\n backgroundColor: salla.config.get('theme.color.primary') + '10',\n borderColor: salla.config.get('theme.color.primary') + '10',\n color: salla.config.get('theme.color.primary')\n }}>\n <i innerHTML={CelebrationIcon}/>\n <span>{this.thanksMessage}</span>\n </div>\n </Host>\n );\n }\n return (\n <Host class={`s-quick-order s-quick-order-${this.getDarkOrLight()}`}>\n <div class={`s-quick-order-container s-quick-order-${this.quickOrderStyle}`}\n style={{backgroundColor: this.getStyleColor()}}>\n <div class=\"s-quick-order-button-cont\">\n {/*todo:: if we can remove this dom, lets do it*/}\n <div>\n <h3>{this.quickOrderTitle}</h3>\n <p>{this.subTitle}</p>\n </div>\n\n <salla-button class={this.expanded ? \"s-quick-order-btn-close\" : \"\"} onClick={(e) => this.submit(e, true)}\n color={this.getBtnColor()}>\n {this.oneClick\n ? this.confirmPayButtonTitle : this.expanded ? <i innerHTML={CancelIcon}/> : this.confirmPayButtonTitle}\n </salla-button>\n </div>\n <form onSubmit={(e) => this.submit(e)}\n class={'s-quick-order-expandable ' + (this.expanded ? 's-quick-order-shown' : '')}>\n {/*we don't need to show name & phone & email unless it's guest*/}\n {Salla.config.isGuest() &&\n [\n <div class=\"s-form-group\">\n <span innerHTML={PortraitIcon}/>\n <input type=\"text\"\n required\n class=\"s-form-control s-quick-order-phone-field\"\n name='name'\n placeholder={this.userNameLabel}\n ref={el => (this.nameInput = el)}\n />\n </div>\n ,\n <div class=\"s-quick-order-flex-input\">\n <div class=\"s-form-group\">\n <span innerHTML={IphoneXIcon}/>\n <salla-tel-input ref={el => (this.phoneInput = el)}/>\n </div>\n <div class=\"s-form-group\">\n <span innerHTML={MailIcon}/>\n <input type=\"email\"\n class=\"s-form-control s-quick-order-email-field\"\n name='email'\n required={this.isEmailRequired}\n placeholder={this.placeHolderEmail + ' ' + (this.isEmailRequired ? '' : this.emailOptional)}\n ref={el => (this.emailInput = el)}\n />\n </div>\n </div>,\n ]\n }\n {this.isTermsRequired && (\n <label htmlFor=\"terms\" class=\"s-quick-order-terms\">\n <input type=\"checkbox\" required name='terms' id='terms' ref={el => (this.termsInput = el)}\n onChange={() => (this.termsChecked = this.termsInput.checked)} class=\"s-checkbox\"/>\n <span class=\"s-form-label\"> <div innerHTML={this.formatAgreementText(this.agreementText, 150)}>\n {this.agreementText.length > 150 && (\n <salla-button shape=\"link\" onClick={() => this.agreementModal.open()}>\n {this.agreementShowText}\n </salla-button>\n )}\n </div> </span>\n </label>\n )}\n {/* @ts-ignore */}\n <salla-button type=\"submit\" color={this.getBtnColor()} width=\"wide\" ref={el => (this.submitBtn = el)}>\n {this.payButtonTitle}\n </salla-button>\n </form>\n <salla-modal modal-title={this.agreementModalHead} ref={modal => (this.agreementModal = modal)}>\n <article innerHTML={this.agreementText}/>\n </salla-modal>\n </div>\n </Host>\n );\n }\n\n componentDidLoad() {\n this.host.querySelectorAll('input').forEach(input => {\n input.addEventListener('invalid', e => {\n this.handleInvalidInput(e);\n });\n input.addEventListener('input', () => {\n input.setCustomValidity('');\n input.reportValidity();\n }\n );\n });\n }\n}\n"],"version":3}
|
|
@@ -88,47 +88,40 @@ const SallaSocialShare$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
|
88
88
|
* Activate or open the share menu.
|
|
89
89
|
*/
|
|
90
90
|
async open() {
|
|
91
|
-
|
|
92
|
-
if (this.opened) {
|
|
93
|
-
this.shareMenu.classList.add('opened');
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
this.shareMenu.classList.remove('opened');
|
|
97
|
-
}
|
|
98
|
-
new anime.timeline().add({
|
|
91
|
+
const animateList = new anime.timeline().add({
|
|
99
92
|
targets: this.shareMenu,
|
|
100
93
|
translateY: [-50, 0],
|
|
101
94
|
opacity: [0, 1],
|
|
102
95
|
duration: 300,
|
|
103
96
|
podding: '0',
|
|
104
97
|
easing: 'easeInOutSine'
|
|
105
|
-
})
|
|
106
|
-
|
|
98
|
+
});
|
|
99
|
+
animateList.add({
|
|
100
|
+
targets: this.shareMenu.children,
|
|
107
101
|
translateZ: 0,
|
|
108
102
|
translateY: [-30, 0],
|
|
109
103
|
scaleY: [0, 1],
|
|
110
104
|
opacity: [0, 1],
|
|
111
|
-
duration:
|
|
105
|
+
duration: 1400,
|
|
112
106
|
delay: anime.stagger(100)
|
|
113
107
|
}, '-=200');
|
|
108
|
+
this.opened = !this.opened;
|
|
109
|
+
if (this.opened) {
|
|
110
|
+
this.shareMenu.classList.add('opened');
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
animateList.pause();
|
|
114
|
+
animateList.seek(0);
|
|
115
|
+
this.shareMenu.classList.remove('opened');
|
|
116
|
+
}
|
|
114
117
|
}
|
|
115
118
|
async refresh() {
|
|
116
119
|
var _a;
|
|
117
|
-
|
|
118
|
-
(_a = document.getElementById('a2a-script')) === null || _a === void 0 ? void 0 : _a.remove();
|
|
119
|
-
const script = document.createElement('script');
|
|
120
|
-
script.src = 'https://static.addtoany.com/menu/page.js';
|
|
121
|
-
script.setAttribute('id', 'a2a-script');
|
|
122
|
-
script.async = true;
|
|
123
|
-
script.onload = function () {
|
|
124
|
-
window.a2a_config.locale = salla.config.get('user.language_code', salla.lang.getLocale());
|
|
125
|
-
};
|
|
126
|
-
document.body.appendChild(script);
|
|
127
|
-
}
|
|
120
|
+
(_a = window.a2a) === null || _a === void 0 ? void 0 : _a.init('page');
|
|
128
121
|
}
|
|
129
122
|
render() {
|
|
130
123
|
return (h("div", { class: "s-social-share-wrapper" }, h("slot", { name: 'widget' }, h("salla-button", { "aria-label": "Share", onClick: () => this.open(), class: "s-social-share-btn", shape: "icon", fill: "outline", color: "light" }, h("span", { innerHTML: this.opened ? Cancel : ShareAlt }))), h("ul", { ref: el => this.shareMenu = el, class: "s-social-share-list a2a_kit share", "data-a2a-url": this.url ? this.url : window.location.href, "data-a2a-title": this.urlName ? this.urlName : document.title }, this.platforms.split(',').map(platform => {
|
|
131
|
-
return (h("li",
|
|
124
|
+
return (h("li", null, h("a", { class: `a2a_button_${platform}`, "aria-label": `Share Via ${platform}` }, this.platformIcons.map((icon) => {
|
|
132
125
|
if (icon.name === platform) {
|
|
133
126
|
return h("span", { class: "s-social-share-icon", innerHTML: icon.icon });
|
|
134
127
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"salla-social-share.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAY,OAMX;AAND,WAAY,OAAO;EACf,gCAAqB,CAAA;EACrB,8BAAmB,CAAA;EACnB,gCAAqB,CAAA;EACrB,0BAAe,CAAA;EACf,kCAAuB,CAAA;AAC3B,CAAC,EANW,OAAO,KAAP,OAAO;;;;;;;;;ACAnB,MAAM,mBAAmB,GAAG,EAAE;;MCmBjBA,kBAAgB;;;;
|
|
1
|
+
{"file":"salla-social-share.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAY,OAMX;AAND,WAAY,OAAO;EACf,gCAAqB,CAAA;EACrB,8BAAmB,CAAA;EACnB,gCAAqB,CAAA;EACrB,0BAAe,CAAA;EACf,kCAAuB,CAAA;AAC3B,CAAC,EANW,OAAO,KAAP,OAAO;;;;;;;;;ACAnB,MAAM,mBAAmB,GAAG,EAAE;;MCmBjBA,kBAAgB;;;;kBAIA,KAAK;wBACO,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,SAAS,CAAC;yBACtF,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ,EAAE,EAAE;QACnF,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,OAAO,CAAC,QAAQ;OACvB,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI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AAC,OAAO,GAAG,QAAQ,CAAC,KAAK,IACrN,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,QAAQ;MACrC,QACE,cACE,SAAG,KAAK,EAAE,cAAc,QAAQ,EAAE,gBAAc,aAAa,QAAQ,EAAE,IAGnE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,IAAS;QAC/B,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE;UAC1B,OAAO,YAAM,KAAK,EAAC,qBAAqB,EAAC,SAAS,EAAE,IAAI,CAAC,IAAI,GAAS,CAAA;SACvE;OACF,CAAC,CAEF,CACD,EACL;KACH,CAAC,CAEC,CACD,EAEN;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["SallaSocialShare"],"sources":["./src/components/salla-social-share/interfaces.ts","./src/components/salla-social-share/salla-social-share.scss?tag=salla-social-share","./src/components/salla-social-share/salla-social-share.tsx"],"sourcesContent":["export enum Socials {\n FACEBOOK = \"facebook\",\n TWITTER = \"twitter\",\n WHATSAPP = \"whatsapp\",\n EMAIL = \"email\",\n COPY_LINK = \"copy_link\"\n}","","import { Component, Prop, h, State, Method } from '@stencil/core';\nimport anime from 'animejs';\nimport facebook from '../../assets/svg/facebook.svg';\nimport twitter from '../../assets/svg/twitter.svg';\nimport copy_link from '../../assets/svg/link.svg';\nimport email from '../../assets/svg/mail.svg';\nimport whatsapp from '../../assets/svg/whatsapp.svg';\nimport { Socials } from './interfaces';\nimport Cancel from \"../../assets/svg/cancel.svg\";\nimport ShareAlt from \"../../assets/svg/share-alt.svg\";\n\n/**\n * @slot widget - An action that can be used to activete or open the component by calling the `open` method.\n */\n@Component({\n tag: 'salla-social-share',\n styleUrl: 'salla-social-share.scss'\n})\n\nexport class SallaSocialShare {\n\n private shareMenu?: HTMLUListElement;\n\n @State() opened: boolean = false;\n @State() allPlatforms: Array<string> = [Socials.WHATSAPP, Socials.FACEBOOK, Socials.TWITTER, Socials.EMAIL, Socials.COPY_LINK];\n @State() platformIcons: Array<object> = [{ icon: whatsapp, name: Socials.WHATSAPP }, {\n icon: facebook,\n name: Socials.FACEBOOK\n }, { icon: twitter, name: Socials.TWITTER }, { icon: email, name: Socials.EMAIL }, {\n icon: copy_link,\n name: Socials.COPY_LINK\n }];\n @State() convertedPlatforms: Array<string> = [];\n\n /**\n * page url that will be shared custom | current page url\n */\n @Prop({ reflect: true }) url: string = \"\";\n\n /**\n * page url name that will be shared custom | current page url\n */\n @Prop({ reflect: true }) urlName: string = \"\"\n\n /**\n * selected platforms to share | all platforms\n */\n @Prop({ reflect: true }) platforms: string = 'facebook,twitter,whatsapp,email,copy_link';\n\n componentWillLoad() {\n if (document.getElementById('a2a-script')) {\n return;\n }\n\n const script = document.createElement('script');\n script.src = 'https://static.addtoany.com/menu/page.js';\n script.setAttribute('id', 'a2a-script');\n script.async = true;\n script.onload = function () {\n window.a2a_config.locale = salla.config.get('user.language_code', salla.lang.getLocale());\n };\n document.body.appendChild(script);\n }\n\n\n /**\n * Activate or open the share menu.\n */\n @Method()\n async open() {\n const animateList = new (anime as any).timeline().add({\n targets: this.shareMenu,\n translateY: [-50, 0],\n opacity: [0, 1],\n duration: 300,\n podding: '0',\n easing: 'easeInOutSine'\n })\n animateList.add({\n targets: this.shareMenu.children,\n translateZ: 0,\n translateY: [-30, 0],\n scaleY: [0, 1],\n opacity: [0, 1],\n duration: 1400,\n delay: anime.stagger(100)\n }, '-=200');\n\n this.opened = !this.opened;\n \n \n if (this.opened) {\n this.shareMenu.classList.add('opened');\n } else {\n animateList.pause();\n animateList.seek(0);\n this.shareMenu.classList.remove('opened');\n }\n\n }\n @Method()\n async refresh() {\n window.a2a?.init('page');\n }\n\n render() {\n return (\n <div class=\"s-social-share-wrapper\">\n\n <slot name='widget'>\n\n <salla-button aria-label=\"Share\" onClick={() => this.open()} class=\"s-social-share-btn\" shape=\"icon\"\n fill=\"outline\" color=\"light\"\n >\n <span innerHTML={this.opened ? Cancel : ShareAlt}></span>\n </salla-button>\n </slot>\n\n <ul ref={el => this.shareMenu = el as HTMLUListElement} class=\"s-social-share-list a2a_kit share\" data-a2a-url={this.url ? this.url : window.location.href} data-a2a-title={this.urlName ? this.urlName : document.title}>\n {this.platforms.split(',').map(platform => {\n return (\n <li>\n <a class={`a2a_button_${platform}`} aria-label={`Share Via ${platform}`}>\n\n {\n this.platformIcons.map((icon: any) => {\n if (icon.name === platform) {\n return <span class=\"s-social-share-icon\" innerHTML={icon.icon}></span>\n }\n })\n }\n </a>\n </li>\n );\n })\n }\n </ul>\n </div>\n\n );\n }\n}\n"],"version":3}
|