@salla.sa/twilight-components 2.11.92 → 2.11.94

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.
Files changed (93) hide show
  1. package/dist/cjs/{app-globals-25af4319.js → app-globals-e30d3301.js} +2 -2
  2. package/dist/cjs/{app-globals-25af4319.js.map → app-globals-e30d3301.js.map} +1 -1
  3. package/dist/cjs/loader.cjs.js +2 -2
  4. package/dist/cjs/salla-add-product-button_40.cjs.entry.js +12 -11
  5. package/dist/cjs/salla-add-product-button_40.cjs.entry.js.map +1 -1
  6. package/dist/cjs/salla-products-list.cjs.entry.js +11 -8
  7. package/dist/cjs/salla-products-list.cjs.entry.js.map +1 -1
  8. package/dist/cjs/salla-products-slider.cjs.entry.js +5 -1
  9. package/dist/cjs/salla-products-slider.cjs.entry.js.map +1 -1
  10. package/dist/cjs/twilight.cjs.js +2 -2
  11. package/dist/collection/components/salla-loyalty/salla-loyalty.js +0 -4
  12. package/dist/collection/components/salla-loyalty/salla-loyalty.js.map +1 -1
  13. package/dist/collection/components/salla-product-card/salla-product-card.js +2 -2
  14. package/dist/collection/components/salla-product-card/salla-product-card.js.map +1 -1
  15. package/dist/collection/components/salla-products-list/salla-products-list.js +17 -13
  16. package/dist/collection/components/salla-products-list/salla-products-list.js.map +1 -1
  17. package/dist/collection/components/salla-products-slider/salla-products-slider.js +7 -2
  18. package/dist/collection/components/salla-products-slider/salla-products-slider.js.map +1 -1
  19. package/dist/collection/components/salla-slider/salla-slider.js +50 -10
  20. package/dist/collection/components/salla-slider/salla-slider.js.map +1 -1
  21. package/dist/components/index.js +1 -1
  22. package/dist/components/index.js.map +1 -1
  23. package/dist/components/salla-loyalty.js +0 -4
  24. package/dist/components/salla-loyalty.js.map +1 -1
  25. package/dist/components/salla-product-card2.js +1 -2
  26. package/dist/components/salla-product-card2.js.map +1 -1
  27. package/dist/components/salla-products-list.js +14 -10
  28. package/dist/components/salla-products-list.js.map +1 -1
  29. package/dist/components/salla-products-slider.js +7 -2
  30. package/dist/components/salla-products-slider.js.map +1 -1
  31. package/dist/components/salla-slider2.js +13 -6
  32. package/dist/components/salla-slider2.js.map +1 -1
  33. package/dist/esm/{app-globals-138bc479.js → app-globals-22fdb799.js} +2 -2
  34. package/dist/esm/{app-globals-138bc479.js.map → app-globals-22fdb799.js.map} +1 -1
  35. package/dist/esm/loader.js +2 -2
  36. package/dist/esm/salla-add-product-button_40.entry.js +12 -11
  37. package/dist/esm/salla-add-product-button_40.entry.js.map +1 -1
  38. package/dist/esm/salla-products-list.entry.js +11 -8
  39. package/dist/esm/salla-products-list.entry.js.map +1 -1
  40. package/dist/esm/salla-products-slider.entry.js +5 -1
  41. package/dist/esm/salla-products-slider.entry.js.map +1 -1
  42. package/dist/esm/twilight.js +2 -2
  43. package/dist/esm-es5/{app-globals-138bc479.js → app-globals-22fdb799.js} +2 -2
  44. package/dist/esm-es5/app-globals-22fdb799.js.map +1 -0
  45. package/dist/esm-es5/loader.js +1 -1
  46. package/dist/esm-es5/loader.js.map +1 -1
  47. package/dist/esm-es5/salla-add-product-button_40.entry.js +1 -1
  48. package/dist/esm-es5/salla-add-product-button_40.entry.js.map +1 -1
  49. package/dist/esm-es5/salla-products-list.entry.js +1 -1
  50. package/dist/esm-es5/salla-products-list.entry.js.map +1 -1
  51. package/dist/esm-es5/salla-products-slider.entry.js +1 -1
  52. package/dist/esm-es5/salla-products-slider.entry.js.map +1 -1
  53. package/dist/esm-es5/twilight.js +1 -1
  54. package/dist/esm-es5/twilight.js.map +1 -1
  55. package/dist/twilight/p-07d3cdea.entry.js +5 -0
  56. package/dist/twilight/p-07d3cdea.entry.js.map +1 -0
  57. package/dist/twilight/{p-73aacf46.system.entry.js → p-152e1cd4.system.entry.js} +2 -2
  58. package/dist/twilight/p-152e1cd4.system.entry.js.map +1 -0
  59. package/dist/twilight/p-1aa9d7fe.system.entry.js +5 -0
  60. package/dist/twilight/p-1aa9d7fe.system.entry.js.map +1 -0
  61. package/dist/twilight/{p-5615c33d.system.js → p-39e2cba3.system.js} +2 -2
  62. package/dist/twilight/p-39e2cba3.system.js.map +1 -0
  63. package/dist/twilight/{p-1356d900.system.js → p-437c62e8.system.js} +2 -2
  64. package/dist/twilight/{p-1356d900.system.js.map → p-437c62e8.system.js.map} +1 -1
  65. package/dist/twilight/p-5316354e.system.entry.js +5 -0
  66. package/dist/twilight/p-5316354e.system.entry.js.map +1 -0
  67. package/dist/twilight/p-abd87984.entry.js +5 -0
  68. package/dist/twilight/p-abd87984.entry.js.map +1 -0
  69. package/dist/twilight/{p-a04518c5.entry.js → p-b28388c6.entry.js} +2 -2
  70. package/dist/twilight/p-b28388c6.entry.js.map +1 -0
  71. package/dist/twilight/{p-aca7dcc7.js → p-ecb2ba59.js} +2 -2
  72. package/dist/twilight/p-ecb2ba59.js.map +1 -0
  73. package/dist/twilight/twilight.esm.js +1 -1
  74. package/dist/twilight/twilight.esm.js.map +1 -1
  75. package/dist/twilight/twilight.js +1 -1
  76. package/dist/types/components/salla-products-list/salla-products-list.d.ts +2 -1
  77. package/dist/types/components/salla-products-slider/salla-products-slider.d.ts +1 -0
  78. package/dist/types/components/salla-slider/salla-slider.d.ts +9 -1
  79. package/dist/types/components.d.ts +18 -2
  80. package/package.json +5 -5
  81. package/dist/esm-es5/app-globals-138bc479.js.map +0 -1
  82. package/dist/twilight/p-15174057.system.entry.js +0 -5
  83. package/dist/twilight/p-15174057.system.entry.js.map +0 -1
  84. package/dist/twilight/p-173726b9.system.entry.js +0 -5
  85. package/dist/twilight/p-173726b9.system.entry.js.map +0 -1
  86. package/dist/twilight/p-5615c33d.system.js.map +0 -1
  87. package/dist/twilight/p-73aacf46.system.entry.js.map +0 -1
  88. package/dist/twilight/p-90cc80c6.entry.js +0 -5
  89. package/dist/twilight/p-90cc80c6.entry.js.map +0 -1
  90. package/dist/twilight/p-91dee585.entry.js +0 -5
  91. package/dist/twilight/p-91dee585.entry.js.map +0 -1
  92. package/dist/twilight/p-a04518c5.entry.js.map +0 -1
  93. package/dist/twilight/p-aca7dcc7.js.map +0 -1
@@ -74,11 +74,7 @@ const SallaLoyalty$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
74
74
  super();
75
75
  this.__registerHost();
76
76
  this.loyaltyProgram = undefined;
77
- this.buttonLoading = false;
78
77
  this.selectedItem = undefined;
79
- this.askConfirmation = false;
80
- this.is_loggedin = false;
81
- this.hasError = false;
82
78
  /**
83
79
  * Does the merchant allow to login using email
84
80
  */
@@ -1 +1 @@
1
- {"file":"salla-loyalty.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAM,eAAe,GAAG,EAAE;;MCebA,cAAY;EAEvB;;;IA0BS,mBAAc,GAAmB,SAAS,CAAC;IAC3C,kBAAa,GAAY,KAAK,CAAC;IAC/B,iBAAY,GAAqB,SAAS,CAAC;IAC3C,oBAAe,GAAY,KAAK,CAAC;IACjC,gBAAW,GAAY,KAAK,CAAC;IAC7B,aAAQ,GAAY,KAAK,CAAC;;;;IAyB3B,eAAU,GAAY,IAAI,CAAC;;;;IAK3B,gBAAW,GAAY,IAAI,CAAC;;;;IAK5B,iBAAY,GAAY,KAAK,CAAC;IAjEpC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,eAAe,EAAE,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IAEnD,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC;MAC1B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAA;KACxB,CAAC,CAAA;IAEF,KAAK,CAAC,OAAO,CAAC;MACZ,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,CAAA;KACzC,CAAC,CAAA;IAEF,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC;MAClB,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,qCAAq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,IAAI,EAAC,aAAa,IAAE,IAAI,CAAC,YAAY,CAAQ,GAAG,EAAE,CAC7D,CAEZ;KACf,CAAC;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["SallaLoyalty","CancelIcon","Star2"],"sources":["./src/components/salla-loyalty/salla-loyalty.scss?tag=salla-loyalty","./src/components/salla-loyalty/salla-loyalty.tsx"],"sourcesContent":["","import {Item, LoyaltyProgram, Prize} from './loyalty-schema';\nimport {Component, h, Method, Prop, State} from '@stencil/core';\nimport Star2 from '../../assets/svg/star2.svg';\nimport Star3 from '../../assets/svg/star3.svg';\nimport CancelIcon from '../../assets/svg/cancel.svg';\nimport GiftImg from '../../assets/svg/flat.svg';\n\n/**\n * @slot widget - When used, will activate the component and needs to emit `loyalty::open` event to open the modal. If not provided the default value will be used.\n * @slot points-applied-widget - Widget to show information about the already exchanged points. It should have it's own resetting action and call the `resetExchange` method. If not provided, it will use the default value.\n */\n@Component({\n tag: 'salla-loyalty',\n styleUrl: 'salla-loyalty.scss',\n})\nexport class SallaLoyalty {\n\n constructor() {\n salla.event.on('loyalty::open', () => this.open());\n\n salla.auth.event.onLoggedIn(() => {\n this.is_loggedin = true\n })\n\n salla.onReady(() => {\n this.is_loggedin = salla.config.isUser()\n })\n\n salla.lang.onLoaded(() => {\n this.guestMessage = salla.lang.get('pages.loyalty_program.guest_message');\n this.translationLoaded = true;\n })\n\n salla.cart.event.onUpdated(cart => {\n this.prizePoints = cart.loyalty.prize?.points;\n this.prizeTitle = cart.loyalty.prize?.title;\n this.customerPoints = cart.loyalty.customer_points || this.customerPoints;\n })\n }\n\n private modal: HTMLSallaModalElement;\n private confirmationModal: HTMLSallaModalElement;\n\n @State() loyaltyProgram: LoyaltyProgram = undefined;\n @State() buttonLoading: boolean = false;\n @State() selectedItem: Item | undefined = undefined;\n @State() askConfirmation: boolean = false;\n @State() is_loggedin: boolean = false;\n @State() hasError: boolean = false;\n\n @State() errorMessage: string;\n\n //todo:: drop it\n @State() translationLoaded: boolean;\n\n /**\n * The exchanged prize point\n */\n @Prop({mutable: true, reflect: true}) prizePoints: string | number;\n\n /**\n * Available customer points with which they can exchange.\n */\n @Prop({mutable: true, reflect: true}) customerPoints: number;\n\n /**\n * The prize title\n */\n @Prop({mutable: true, reflect: true}) prizeTitle: string;\n\n /**\n * Does the merchant allow to login using email\n */\n @Prop() allowEmail: boolean = true;\n\n /**\n * Does the merchant/current location for visitor allow to login using mobile, By default outside KSA is `false`\n */\n @Prop() allowMobile: boolean = true;\n\n /**\n * Does the merchant require registration with email & mobile\n */\n @Prop() requireEmail: boolean = false;\n\n //todo:: change it to state\n /**\n * Message to show for guest users.\n */\n @Prop({mutable: true}) guestMessage: string\n\n\n private setSelectedPrizeItem(item) {\n if (!this.selectedItem || this.selectedItem?.id != item.id) {\n this.selectedItem = item;\n } else {\n this.selectedItem = undefined\n }\n }\n\n private handleLongText(text: string) {\n if (text.length > 150) {\n return text.substring(0, 150) + '...';\n }\n\n return text;\n }\n\n private prizeItem(item: Item) {\n let klass = {\n 's-loyalty-prize-item-selected': !!this.selectedItem && this.selectedItem?.id == item.id,\n \"s-loyalty-prize-item\": true\n }\n return <div onClick={() => this.setSelectedPrizeItem(item)} class={klass}>\n <img class=\"s-loyalty-prize-item-image\" src={item.image} alt={item.name}/>\n <div class=\"s-loyalty-prize-item-title\">{item.name}</div>\n <div class=\"s-loyalty-prize-item-subtitle\">{this.handleLongText(item.description)}</div>\n <div class=\"s-loyalty-prize-item-points\">\n {item.cost_points} {salla.lang.get('pages.loyalty_program.point')}\n <div class=\"s-loyalty-prize-item-check\">\n <div></div>\n </div>\n </div>\n </div>\n }\n\n private getConfirmationModal() {\n return [\n <salla-placeholder alignment=\"center\" icon={Star3} class=\"s-loyalty-confirmation-modal-content\">\n <div slot=\"title\" class=\"s-loyalty-confirmation-title\">\n {salla.lang.get('pages.loyalty_program.exchange_points')}\n </div>\n <div slot=\"description\">\n {salla.lang.get('pages.loyalty_program.are_you_sure_to_exchange')} ( <strong>{this.selectedItem?.cost_points}</strong> {salla.lang.get('pages.loyalty_program.point')} ) {salla.lang.get('pages.loyalty_program.for')} ( <strong>{this.selectedItem?.name}</strong> )\n </div>\n </salla-placeholder>,\n <div class=\"s-loyalty-confirmation-actions\">\n <salla-button fill='outline' width=\"wide\"\n onClick={() => this.cancelProcess()}>{salla.lang.get('pages.loyalty_program.cancellation')}</salla-button>\n <salla-button loading={this.buttonLoading} width=\"wide\"\n onClick={() => this.exchangeLoyaltyPoint()}>{salla.lang.get('pages.loyalty_program.confirm')}</salla-button>\n </div>\n ]\n }\n\n private getAfterExchangeUI() {\n return <slot name='points-applied-widget'>\n <salla-list-tile class=\"s-loyalty-after-exchange\">\n <div slot=\"title\" class=\"s-loyalty-after-exchange-title\">\n {this.prizeTitle} &nbsp; - &nbsp; {this.prizePoints} {salla.lang.get('pages.loyalty_program.point')}\n </div>\n <div slot='action' class=\"s-loyalty-after-exchange-action\">\n <salla-button class=\"s-loyalty-after-exchange-reset\" shape=\"icon\" fill='outline' color=\"danger\" size=\"small\"\n onClick={() => this.resetExchange()}>\n <span innerHTML={CancelIcon}/>\n </salla-button>\n </div>\n </salla-list-tile>\n </slot>\n }\n\n /**\n * Show loyalty modal\n */\n @Method()\n async open() {\n if (!this.is_loggedin) return salla.event.dispatch('login::open');\n this.modal?.open()\n return await salla.loyalty.getProgram()\n .then(response => {\n this.loyaltyProgram = response.data as LoyaltyProgram\n })\n .catch(e => {\n this.hasError = true;\n this.errorMessage = e.response?.data?.error?.message || e.response?.data;\n })\n .finally(() => this.modal?.stopLoading())\n\n }\n\n /**\n *\n * Hide loyalty modal\n */\n @Method()\n async close() {\n return this.modal.close();\n }\n\n /**\n *\n * Cancel Exchanged prizes\n */\n @Method()\n async resetExchange() {\n return await salla.loyalty.reset();\n }\n\n /**\n * Open Confirmation modal\n */\n private async openConfirmation() {\n return await this.modal.close()\n .then(() => this.confirmationModal?.open())\n .catch(e => console.log(e))\n }\n\n /**\n * Cancel process\n */\n private async cancelProcess() {\n return await this.confirmationModal.close()\n .then(() => this.selectedItem = null)\n .catch(e => console.log(e))\n }\n\n /**\n * Exchange loyalty points with the selected prize item\n * @param {number} loyalty_prize_id\n *\n */\n @Method()\n async exchangeLoyaltyPoint() {\n this.buttonLoading = true;\n return await salla.loyalty.exchange(this.selectedItem?.id)\n .then(() => this.selectedItem.key == \"FREE_PRODUCT\" && salla.url.is_page('cart') && window.location.reload())\n .finally(() => {\n this.buttonLoading = false;\n this.cancelProcess()\n }\n )\n }\n\n render() {\n\n // A. when the exchange is done, and we have the final prize points to show it in cart page\n if (this.prizePoints) {\n return this.getAfterExchangeUI();\n }\n\n //todo:: change all translations to states\n return [\n <slot name='widget'>\n {/* B. he wants to use the default widget by pass the customer points . */}\n {\n this.customerPoints ?\n <salla-list-tile class='s-loyalty-widget'>\n <div slot=\"icon\" class=\"s-loyalty-widget-icon\" innerHTML={Star2}/>\n <div slot=\"subtitle\">\n {this.customerPoints ? salla.lang.get('pages.loyalty_program.cart_total_point_summary', {\"balance\": this.customerPoints}) : this.guestMessage}\n <salla-button shape=\"link\" color=\"primary\" onClick={() => salla.event.dispatch(\"loyalty::open\")}>\n {this.customerPoints ? salla.lang.get('pages.loyalty_program.cart_point_exchange_now') : salla.lang.get('blocks.header.login')}\n </salla-button>\n </div>\n </salla-list-tile> :\n ''\n }\n </slot>,\n <salla-modal noPadding width=\"sm\"\n ref={modal => this.confirmationModal = modal}>\n {this.getConfirmationModal()}\n </salla-modal>,\n <salla-modal isLoading={true} has-skeleton={true} width=\"md\" ref={modal => this.modal = modal}>\n <div slot=\"loading\">\n <div class=\"s-loyalty-skeleton\">\n <salla-list-tile class=\"s-loyalty-header\">\n <div slot=\"icon\" class=\"s-loyalty-header-icon\">\n <salla-skeleton type=\"circle\" height='6rem' width='6rem'/>\n </div>\n\n <div slot=\"title\" class=\"s-loyalty-header-title mb-5\">\n <salla-skeleton height='15px' width='50%'/>\n </div>\n <div slot=\"subtitle\" class=\"s-loyalty-header-subtitle\">\n <salla-skeleton height='10px'/>\n <salla-skeleton height='10px' width='75%'/>\n </div>\n\n </salla-list-tile>\n <div class=\"s-loyalty-skeleton-cards\">\n {[...Array(3)].map(() =>\n <div class=\"s-loyalty-prize-item swiper-slide\">\n <salla-skeleton height='9rem'/>\n <div class=\"s-loyalty-prize-item-title\">\n <salla-skeleton height='15px' width='75%'/>\n </div>\n <div class=\"s-loyalty-prize-item-subtitle\">\n <salla-skeleton height='10px' width='50%'/>\n <salla-skeleton height='10px' width='25%'/>\n </div>\n <div class=\"s-loyalty-prize-item-points\">\n <salla-skeleton height='15px' width='100px'/>\n <div class=\"s-loyalty-prize-item-check\">\n <salla-skeleton height='1rem' width='1rem' type='circle'/>\n </div>\n </div>\n </div>\n )}\n </div>\n </div>\n </div>\n {\n !this.hasError && !!this.loyaltyProgram ?\n [\n <salla-list-tile id='s-loyalty-header' class=\"s-loyalty-header\">\n <div slot=\"icon\" class=\"s-loyalty-header-icon\" innerHTML={GiftImg}/>\n\n <div slot=\"title\" class=\"s-loyalty-header-title\">\n {this.loyaltyProgram.prize_promotion_title}\n </div>\n\n <div slot=\"subtitle\" class=\"s-loyalty-header-subtitle\">\n {this.loyaltyProgram.prize_promotion_description}\n </div>\n\n </salla-list-tile>,\n <salla-tabs>\n {this.loyaltyProgram.prizes.map((prize: Prize) =>\n <salla-tab-header slot=\"header\" name={prize.title}>\n <span>{prize.title}</span>\n </salla-tab-header>\n )}\n {this.loyaltyProgram.prizes.map((prize: Prize, index) =>\n <salla-tab-content slot=\"content\" name={prize.title}>\n <salla-slider\n class=\"s-loyalty-slider\"\n loop={false}\n controls-outer={true}\n id={'loyalty-popup-slider-' + index}\n type=\"carousel\">\n <div slot='items'>\n {prize.items.map((item: Item) =>\n this.prizeItem(item)\n )}\n </div>\n </salla-slider>\n </salla-tab-content>\n )}\n </salla-tabs>,\n <salla-button disabled={!this.selectedItem} width=\"wide\"\n class=\"s-loyalty-program-redeem-btn\"\n onClick={() => this.openConfirmation()}>{salla.lang.get('pages.loyalty_program.exchange_points')}</salla-button>,\n\n ]\n : <salla-placeholder class=\"s-loyalty-placeholder\" alignment=\"center\">\n {!!this.errorMessage ? <span slot=\"description\">{this.errorMessage}</span> : ''}\n </salla-placeholder>\n }\n </salla-modal>,\n ];\n }\n}\n"],"version":3}
1
+ {"file":"salla-loyalty.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAM,eAAe,GAAG,EAAE;;MCebA,cAAY;EAEvB;;;IA0BS,mBAAc,GAAmB,SAAS,CAAC;IAE3C,iBAAY,GAAqB,SAAS,CAAC;;;;IA4B5C,eAAU,GAAY,IAAI,CAAC;;;;IAK3B,gBAAW,GAAY,IAAI,CAAC;;;;IAK5B,iBAAY,GAAY,KAAK,CAAC;IAjEpC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,eAAe,EAAE,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IAEnD,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC;MAC1B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAA;KACxB,CAAC,CAAA;IAEF,KAAK,CAAC,OAAO,CAAC;MACZ,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,CAAA;KACzC,CAAC,CAAA;IAEF,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC;MAClB,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;MAC1E,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;KAC/B,CAAC,CAAA;IAEF,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI;;MAC7B,IAAI,CAAC,WAAW,GAAG,M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;;;;;;;;;;;;;;;;;;;;;;;;;","names":["SallaLoyalty","CancelIcon","Star2"],"sources":["./src/components/salla-loyalty/salla-loyalty.scss?tag=salla-loyalty","./src/components/salla-loyalty/salla-loyalty.tsx"],"sourcesContent":["","import {Item, LoyaltyProgram, Prize} from './loyalty-schema';\nimport {Component, h, Method, Prop, State} from '@stencil/core';\nimport Star2 from '../../assets/svg/star2.svg';\nimport Star3 from '../../assets/svg/star3.svg';\nimport CancelIcon from '../../assets/svg/cancel.svg';\nimport GiftImg from '../../assets/svg/flat.svg';\n\n/**\n * @slot widget - When used, will activate the component and needs to emit `loyalty::open` event to open the modal. If not provided the default value will be used.\n * @slot points-applied-widget - Widget to show information about the already exchanged points. It should have it's own resetting action and call the `resetExchange` method. If not provided, it will use the default value.\n */\n@Component({\n tag: 'salla-loyalty',\n styleUrl: 'salla-loyalty.scss',\n})\nexport class SallaLoyalty {\n\n constructor() {\n salla.event.on('loyalty::open', () => this.open());\n\n salla.auth.event.onLoggedIn(() => {\n this.is_loggedin = true\n })\n\n salla.onReady(() => {\n this.is_loggedin = salla.config.isUser()\n })\n\n salla.lang.onLoaded(() => {\n this.guestMessage = salla.lang.get('pages.loyalty_program.guest_message');\n this.translationLoaded = true;\n })\n\n salla.cart.event.onUpdated(cart => {\n this.prizePoints = cart.loyalty.prize?.points;\n this.prizeTitle = cart.loyalty.prize?.title;\n this.customerPoints = cart.loyalty.customer_points || this.customerPoints;\n })\n }\n\n private modal: HTMLSallaModalElement;\n private confirmationModal: HTMLSallaModalElement;\n\n @State() loyaltyProgram: LoyaltyProgram = undefined;\n @State() buttonLoading: boolean;\n @State() selectedItem: Item | undefined = undefined;\n @State() askConfirmation: boolean;\n @State() is_loggedin: boolean;\n @State() hasError: boolean;\n\n @State() errorMessage: string;\n\n //todo:: drop it\n @State() translationLoaded: boolean;\n\n /**\n * The exchanged prize point\n */\n @Prop({mutable: true, reflect: true}) prizePoints: string | number;\n\n /**\n * Available customer points with which they can exchange.\n */\n @Prop({mutable: true, reflect: true}) customerPoints: number;\n\n /**\n * The prize title\n */\n @Prop({mutable: true, reflect: true}) prizeTitle: string;\n\n /**\n * Does the merchant allow to login using email\n */\n @Prop() allowEmail: boolean = true;\n\n /**\n * Does the merchant/current location for visitor allow to login using mobile, By default outside KSA is `false`\n */\n @Prop() allowMobile: boolean = true;\n\n /**\n * Does the merchant require registration with email & mobile\n */\n @Prop() requireEmail: boolean = false;\n\n //todo:: change it to state\n /**\n * Message to show for guest users.\n */\n @Prop({mutable: true}) guestMessage: string\n\n\n private setSelectedPrizeItem(item) {\n if (!this.selectedItem || this.selectedItem?.id != item.id) {\n this.selectedItem = item;\n } else {\n this.selectedItem = undefined\n }\n }\n\n private handleLongText(text: string) {\n if (text.length > 150) {\n return text.substring(0, 150) + '...';\n }\n\n return text;\n }\n\n private prizeItem(item: Item) {\n let klass = {\n 's-loyalty-prize-item-selected': !!this.selectedItem && this.selectedItem?.id == item.id,\n \"s-loyalty-prize-item\": true\n }\n return <div onClick={() => this.setSelectedPrizeItem(item)} class={klass}>\n <img class=\"s-loyalty-prize-item-image\" src={item.image} alt={item.name}/>\n <div class=\"s-loyalty-prize-item-title\">{item.name}</div>\n <div class=\"s-loyalty-prize-item-subtitle\">{this.handleLongText(item.description)}</div>\n <div class=\"s-loyalty-prize-item-points\">\n {item.cost_points} {salla.lang.get('pages.loyalty_program.point')}\n <div class=\"s-loyalty-prize-item-check\">\n <div></div>\n </div>\n </div>\n </div>\n }\n\n private getConfirmationModal() {\n return [\n <salla-placeholder alignment=\"center\" icon={Star3} class=\"s-loyalty-confirmation-modal-content\">\n <div slot=\"title\" class=\"s-loyalty-confirmation-title\">\n {salla.lang.get('pages.loyalty_program.exchange_points')}\n </div>\n <div slot=\"description\">\n {salla.lang.get('pages.loyalty_program.are_you_sure_to_exchange')} ( <strong>{this.selectedItem?.cost_points}</strong> {salla.lang.get('pages.loyalty_program.point')} ) {salla.lang.get('pages.loyalty_program.for')} ( <strong>{this.selectedItem?.name}</strong> )\n </div>\n </salla-placeholder>,\n <div class=\"s-loyalty-confirmation-actions\">\n <salla-button fill='outline' width=\"wide\"\n onClick={() => this.cancelProcess()}>{salla.lang.get('pages.loyalty_program.cancellation')}</salla-button>\n <salla-button loading={this.buttonLoading} width=\"wide\"\n onClick={() => this.exchangeLoyaltyPoint()}>{salla.lang.get('pages.loyalty_program.confirm')}</salla-button>\n </div>\n ]\n }\n\n private getAfterExchangeUI() {\n return <slot name='points-applied-widget'>\n <salla-list-tile class=\"s-loyalty-after-exchange\">\n <div slot=\"title\" class=\"s-loyalty-after-exchange-title\">\n {this.prizeTitle} &nbsp; - &nbsp; {this.prizePoints} {salla.lang.get('pages.loyalty_program.point')}\n </div>\n <div slot='action' class=\"s-loyalty-after-exchange-action\">\n <salla-button class=\"s-loyalty-after-exchange-reset\" shape=\"icon\" fill='outline' color=\"danger\" size=\"small\"\n onClick={() => this.resetExchange()}>\n <span innerHTML={CancelIcon}/>\n </salla-button>\n </div>\n </salla-list-tile>\n </slot>\n }\n\n /**\n * Show loyalty modal\n */\n @Method()\n async open() {\n if (!this.is_loggedin) return salla.event.dispatch('login::open');\n this.modal?.open()\n return await salla.loyalty.getProgram()\n .then(response => {\n this.loyaltyProgram = response.data as LoyaltyProgram\n })\n .catch(e => {\n this.hasError = true;\n this.errorMessage = e.response?.data?.error?.message || e.response?.data;\n })\n .finally(() => this.modal?.stopLoading())\n\n }\n\n /**\n *\n * Hide loyalty modal\n */\n @Method()\n async close() {\n return this.modal.close();\n }\n\n /**\n *\n * Cancel Exchanged prizes\n */\n @Method()\n async resetExchange() {\n return await salla.loyalty.reset();\n }\n\n /**\n * Open Confirmation modal\n */\n private async openConfirmation() {\n return await this.modal.close()\n .then(() => this.confirmationModal?.open())\n .catch(e => console.log(e))\n }\n\n /**\n * Cancel process\n */\n private async cancelProcess() {\n return await this.confirmationModal.close()\n .then(() => this.selectedItem = null)\n .catch(e => console.log(e))\n }\n\n /**\n * Exchange loyalty points with the selected prize item\n * @param {number} loyalty_prize_id\n *\n */\n @Method()\n async exchangeLoyaltyPoint() {\n this.buttonLoading = true;\n return await salla.loyalty.exchange(this.selectedItem?.id)\n .then(() => this.selectedItem.key == \"FREE_PRODUCT\" && salla.url.is_page('cart') && window.location.reload())\n .finally(() => {\n this.buttonLoading = false;\n this.cancelProcess()\n }\n )\n }\n\n render() {\n\n // A. when the exchange is done, and we have the final prize points to show it in cart page\n if (this.prizePoints) {\n return this.getAfterExchangeUI();\n }\n\n //todo:: change all translations to states\n return [\n <slot name='widget'>\n {/* B. he wants to use the default widget by pass the customer points . */}\n {\n this.customerPoints ?\n <salla-list-tile class='s-loyalty-widget'>\n <div slot=\"icon\" class=\"s-loyalty-widget-icon\" innerHTML={Star2}/>\n <div slot=\"subtitle\">\n {this.customerPoints ? salla.lang.get('pages.loyalty_program.cart_total_point_summary', {\"balance\": this.customerPoints}) : this.guestMessage}\n <salla-button shape=\"link\" color=\"primary\" onClick={() => salla.event.dispatch(\"loyalty::open\")}>\n {this.customerPoints ? salla.lang.get('pages.loyalty_program.cart_point_exchange_now') : salla.lang.get('blocks.header.login')}\n </salla-button>\n </div>\n </salla-list-tile> :\n ''\n }\n </slot>,\n <salla-modal noPadding width=\"sm\"\n ref={modal => this.confirmationModal = modal}>\n {this.getConfirmationModal()}\n </salla-modal>,\n <salla-modal isLoading={true} has-skeleton={true} width=\"md\" ref={modal => this.modal = modal}>\n <div slot=\"loading\">\n <div class=\"s-loyalty-skeleton\">\n <salla-list-tile class=\"s-loyalty-header\">\n <div slot=\"icon\" class=\"s-loyalty-header-icon\">\n <salla-skeleton type=\"circle\" height='6rem' width='6rem'/>\n </div>\n\n <div slot=\"title\" class=\"s-loyalty-header-title mb-5\">\n <salla-skeleton height='15px' width='50%'/>\n </div>\n <div slot=\"subtitle\" class=\"s-loyalty-header-subtitle\">\n <salla-skeleton height='10px'/>\n <salla-skeleton height='10px' width='75%'/>\n </div>\n\n </salla-list-tile>\n <div class=\"s-loyalty-skeleton-cards\">\n {[...Array(3)].map(() =>\n <div class=\"s-loyalty-prize-item swiper-slide\">\n <salla-skeleton height='9rem'/>\n <div class=\"s-loyalty-prize-item-title\">\n <salla-skeleton height='15px' width='75%'/>\n </div>\n <div class=\"s-loyalty-prize-item-subtitle\">\n <salla-skeleton height='10px' width='50%'/>\n <salla-skeleton height='10px' width='25%'/>\n </div>\n <div class=\"s-loyalty-prize-item-points\">\n <salla-skeleton height='15px' width='100px'/>\n <div class=\"s-loyalty-prize-item-check\">\n <salla-skeleton height='1rem' width='1rem' type='circle'/>\n </div>\n </div>\n </div>\n )}\n </div>\n </div>\n </div>\n {\n !this.hasError && !!this.loyaltyProgram ?\n [\n <salla-list-tile id='s-loyalty-header' class=\"s-loyalty-header\">\n <div slot=\"icon\" class=\"s-loyalty-header-icon\" innerHTML={GiftImg}/>\n\n <div slot=\"title\" class=\"s-loyalty-header-title\">\n {this.loyaltyProgram.prize_promotion_title}\n </div>\n\n <div slot=\"subtitle\" class=\"s-loyalty-header-subtitle\">\n {this.loyaltyProgram.prize_promotion_description}\n </div>\n\n </salla-list-tile>,\n <salla-tabs>\n {this.loyaltyProgram.prizes.map((prize: Prize) =>\n <salla-tab-header slot=\"header\" name={prize.title}>\n <span>{prize.title}</span>\n </salla-tab-header>\n )}\n {this.loyaltyProgram.prizes.map((prize: Prize, index) =>\n <salla-tab-content slot=\"content\" name={prize.title}>\n <salla-slider\n class=\"s-loyalty-slider\"\n loop={false}\n controls-outer={true}\n id={'loyalty-popup-slider-' + index}\n type=\"carousel\">\n <div slot='items'>\n {prize.items.map((item: Item) =>\n this.prizeItem(item)\n )}\n </div>\n </salla-slider>\n </salla-tab-content>\n )}\n </salla-tabs>,\n <salla-button disabled={!this.selectedItem} width=\"wide\"\n class=\"s-loyalty-program-redeem-btn\"\n onClick={() => this.openConfirmation()}>{salla.lang.get('pages.loyalty_program.exchange_points')}</salla-button>,\n\n ]\n : <salla-placeholder class=\"s-loyalty-placeholder\" alignment=\"center\">\n {!!this.errorMessage ? <span slot=\"description\">{this.errorMessage}</span> : ''}\n </salla-placeholder>\n }\n </salla-modal>,\n ];\n }\n}\n"],"version":3}
@@ -92,8 +92,7 @@ const SallaProductCard = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
92
92
  return h("div", { class: "s-product-card-sale-price" }, h("h4", null, this.getPriceFormat(this.productData.sale_price)), h("span", null, this.getPriceFormat((_a = this.productData) === null || _a === void 0 ? void 0 : _a.regular_price)));
93
93
  }
94
94
  if (this.productData.starting_price) {
95
- return h("div", { class: "s-product-card-starting-price" }, h("p", null, this.startingPrice), h("h4", null, " ", (_b = this.productData) === null || _b === void 0 ? void 0 :
96
- _b.starting_price, " "));
95
+ return h("div", { class: "s-product-card-starting-price" }, h("p", null, this.startingPrice), h("h4", null, " ", this.getPriceFormat((_b = this.productData) === null || _b === void 0 ? void 0 : _b.starting_price), " "));
97
96
  }
98
97
  return h("h4", { class: "s-product-card-price" }, this.getPriceFormat((_c = this.productData) === null || _c === void 0 ? void 0 : _c.price));
99
98
  }
@@ -1 +1 @@
1
- {"file":"salla-product-card2.js","mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,MAAM,mBAAmB,GAAG,ghBAAghB;;MCY/hB,gBAAgB;EAC3B;;;;IAEE,KAAK,CAAC,OAAO,CAAC;MACZ,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;MAC1E,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,KAAK,IAAI,CAAC,kBAAkB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;MAC9E,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,KAAK,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;MACjF,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC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AmB,IAAE,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAQ,CACjD,EAE1B,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,SAAS;QAChC,oBACE,KAAK,EAAC,MAAM,EACZ,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,OAAO,EACb,GAAG,EAAE,EAAE,IAAI,IAAI,CAAC,WAAW,GAAG,EAAE,gBACrB,2BAA2B,EACtC,KAAK,EAAC,sCAAsC,EAC5C,OAAO,EAAE,MAAM,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,aACjD,kBAAkB,IAC1B,YAAM,KAAK,EAAC,SAAS,EAAC,SAAS,EAAE,KAAK,GAAG,CAC5B;UACb,EAAE,CACF;QACJ,EAAE,CACF,CACD,EACP;GACH;EAED,gBAAgB;;IACd,MAAA,QAAQ,CAAC,gBAAgB,0CAAE,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,6BAA6B,CAAC,CAAC,CAAC;IAC5F,IAAI,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,QAAQ,KAAI,IAAI,CAAC,SAAS,EAAE;MAChD,IAAI,CAAC,aAAa,EAAE,CAAC;KACtB;IAED,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE;MACrG,IAAI,CAAC,kBAAkB,EAAE,CAAC;KAC3B;GACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/salla-product-card/salla-product-card.scss?tag=salla-product-card","./src/components/salla-product-card/salla-product-card.tsx"],"sourcesContent":[".s-product-card {\n &-entry {}\n\n &-image {\n &::before {\n font-family: \"sallaicons\";\n content: \"\\ec1f\" !important;\n }\n }\n\n &-vertical {}\n\n &-horizontal {}\n\n &-fit-height {}\n\n &-special {}\n\n &-full-image {}\n\n &-minimal {}\n\n &-donation {}\n\n &-shadow {}\n\n &-out-of-stock {}\n\n &-wishlist-btn {}\n\n &-content {\n &-main {}\n\n &-sub {}\n\n &-footer {}\n\n &-title {}\n\n &-subtitle {}\n\n &-pie {\n &-svg {\n circle {\n transition: stroke-dashoffset 1s linear;\n -webkit-transition: stroke-dashoffset 1s linear;\n -moz-transition: stroke-dashoffset 1s linear;\n -ms-transition: stroke-dashoffset 1s linear;\n -o-transition: stroke-dashoffset 1s linear;\n stroke: #E8EDF2;\n stroke-width: 2px;\n stroke-linecap: round;\n fill: none\n }\n\n &-base {}\n\n &-bar {\n stroke: var(--color-primary) !important;\n stroke-dasharray: 100 100;\n stroke-dashoffset: 100\n }\n }\n }\n\n // for special card\n &-extra-padding {}\n }\n\n &-donation-input {}\n}\n","import {Component, Host, h, Prop, State, Element} from '@stencil/core';\nimport Heart from '../../assets/svg/heart.svg';\n\n/**\n * @slot add-to-cart-label - Add to cart label.\n */\n@Component({\n tag: 'salla-product-card',\n styleUrl: 'salla-product-card.scss',\n assetsDirs: ['assets']\n})\n\nexport class SallaProductCard {\n constructor() {\n // Store configs\n salla.onReady(() => {\n this.fitImageHeight = salla.config.get('store.settings.product.fit_type');\n salla.wishlist.event.onAdded((_res, id) => this.toggleFavoriteIcon(true, id));\n salla.wishlist.event.onRemoved((_res, id) => this.toggleFavoriteIcon(false, id));\n this.placeholder = salla.url.asset(salla.config.get('theme.settings.placeholder'));\n });\n\n // Language\n salla.lang.onLoaded(() => {\n this.remained = salla.lang.get('pages.products.remained');\n this.donationAmount = salla.lang.get('pages.products.donation_amount');\n this.startingPrice = salla.lang.get('pages.products.starting_price');\n this.addToCart = salla.lang.get('pages.cart.add_to_cart');\n this.outOfStock = salla.lang.get('pages.products.out_of_stock');\n })\n\n // Parse product data\n if (this.product) {\n try {\n this.productData = typeof this.product == 'object' ? this.product : JSON.parse(this.product);\n return;\n } catch (e) {\n salla.log('Bad json passed via product prop');\n }\n }\n }\n\n @Element() host: HTMLElement;\n // State\n @State() productData: any;\n @State() fitImageHeight: boolean;\n @State() remained: string;\n @State() outOfStock: string;\n @State() donationAmount: string;\n @State() startingPrice: string;\n @State() addToCart: string;\n @State() placeholder: string;\n\n\n // Refs\n private pie: any;\n private wishlistBtn: HTMLSallaButtonElement;\n\n // Props\n\n\n /**\n * Product information.\n */\n @Prop() product: string;\n\n /**\n * Horizontal card.\n */\n @Prop() horizontal: boolean;\n\n /**\n * Support shadow on hover.\n */\n @Prop() shadowOnHover: boolean;\n\n /**\n * Hide add to cart button.\n */\n @Prop() hideAddBtn: boolean;\n\n /**\n * Full image card.\n */\n @Prop() fullImage: boolean;\n\n /**\n * Minimal card.\n */\n @Prop() minimal: boolean;\n\n /**\n * Special card.\n */\n @Prop() isSpecial: boolean;\n\n /**\n * Show quantity.\n */\n @Prop() showQuantity: boolean;\n\n\n // Private Methods\n private initCircleBar() {\n let qty = this.productData.quantity,\n total = this.productData.quantity > 100 ? this.productData.quantity * 2 : 100,\n roundPercent = (qty / total) * 100,\n bar = this.pie.querySelector('.s-product-card-content-pie-svg-bar'),\n strokeDashOffsetValue = 100 - roundPercent;\n bar.style.strokeDashoffset = strokeDashOffsetValue;\n }\n\n private toggleFavoriteIcon(isAdded = true, id = null) {\n if (id && id !== this.productData.id) {\n return;\n }\n this.wishlistBtn?.classList.toggle('s-product-card-wishlist-added', isAdded);\n }\n\n private formatDate(date) {\n let d = new Date(date);\n return `${d.getFullYear()}-${d.getMonth() + 1}-${d.getDate()}`;\n }\n\n private getProductBadge() {\n if (this.productData.promotion_title) {\n return <div class=\"s-product-card-promotion-title\">{this.productData.promotion_title}</div>\n }\n if (this.showQuantity && this.productData?.quantity) {\n return <div\n class=\"s-product-card-quantity\">{this.remained} {salla.helpers.number(this.productData?.quantity)}</div>\n }\n if (this.showQuantity && this.productData?.is_out_of_stock) {\n return <div class=\"s-product-card-out-badge\">{this.outOfStock}</div>\n }\n return '';\n\n }\n\n getPriceFormat(price) {\n if (!price) {\n return;\n }\n\n return salla.money(price);\n }\n\n private getProductPrice() {\n if (this.productData.is_on_sale) {\n return <div class=\"s-product-card-sale-price\">\n <h4>{this.getPriceFormat(this.productData.sale_price)}</h4>\n <span>{this.getPriceFormat(this.productData?.regular_price)}</span>\n </div>;\n }\n if (this.productData.starting_price) {\n return <div class=\"s-product-card-starting-price\"><p>{this.startingPrice}</p>\n <h4> {this.productData?.starting_price} </h4></div>\n }\n return <h4 class=\"s-product-card-price\">{this.getPriceFormat(this.productData?.price)}</h4>\n }\n\n render() {\n const classes = {\n 's-product-card-entry': true,\n 's-product-card-vertical': !this.horizontal && !this.fullImage && !this.minimal,\n 's-product-card-horizontal': this.horizontal && !this.fullImage && !this.minimal,\n 's-product-card-fit-height': this.fitImageHeight && !this.isSpecial && !this.fullImage && !this.minimal,\n 's-product-card-special': this.isSpecial,\n 's-product-card-full-image': this.fullImage,\n 's-product-card-minimal': this.minimal,\n 's-product-card-donation': this.productData?.is_donation,\n 's-product-card-shadow': this.shadowOnHover,\n 's-product-card-out-of-stock': this.productData?.is_out_of_stock,\n };\n return (\n <Host id={`product-${this.productData?.id}`} class={classes}>\n <div class={!this.fullImage ? 's-product-card-image' : 's-product-card-image-full'}>\n <a href={this.productData?.url}>\n <img class={`s-product-card-image-${salla.url.is_placeholder(this.productData?.image?.url)\n ? 'contain'\n : this.fitImageHeight\n ? this.fitImageHeight\n : 'cover'} lazy`}\n src={this.placeholder}\n alt={this.productData?.image?.alt}\n data-src={this.productData?.image?.url || this.productData?.thumbnail}\n />\n {!this.fullImage && !this.minimal ? this.getProductBadge() : ''}\n </a>\n {this.fullImage && <a href={this.productData?.url} class=\"s-product-card-overlay\"/>}\n {!this.horizontal && !this.fullImage ?\n <salla-button\n shape=\"icon\"\n fill=\"none\"\n color=\"light\"\n aria-label=\"Add or remove to wishlist\"\n ref={el => this.wishlistBtn = el}\n class=\"s-product-card-wishlist-btn animated\"\n onClick={() => salla.wishlist.toggle(this.productData.id)}>\n <span innerHTML={Heart}/>\n </salla-button> : ''\n }\n </div>\n <div class=\"s-product-card-content\">\n {this.isSpecial && this.productData?.quantity ?\n <div class=\"s-product-card-content-pie\" ref={pie => this.pie = pie}>\n <span>\n <b>{salla.helpers.number(this.productData?.quantity)}</b>\n {this.remained}\n </span>\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"-2 -1 36 34\" class=\"s-product-card-content-pie-svg\">\n <circle cx=\"16\" cy=\"16\" r=\"15.9155\" class=\"s-product-card-content-pie-svg-base\"/>\n <circle cx=\"16\" cy=\"16\" r=\"15.9155\" class=\"s-product-card-content-pie-svg-bar\"/>\n </svg>\n </div>\n : ''}\n\n <div class={{'s-product-card-content-main': true, 's-product-card-content-extra-padding': this.isSpecial}}>\n <h3 class=\"s-product-card-content-title\">\n <a href={this.productData?.url}>{this.productData?.name}</a>\n </h3>\n\n {this.productData?.subtitle && !this.minimal ?\n <p class=\"s-product-card-content-subtitle\">{this.productData?.subtitle}</p>\n : ''}\n </div>\n {this.productData?.is_donation && !this.minimal && !this.fullImage ?\n [<salla-progress-bar donation={this.productData?.donation}/>,\n <div class=\"s-product-card-donation-input\">\n {this.productData?.can_donate ?\n [<label htmlFor=\"donation-amount\">{this.donationAmount} <span>*</span></label>,\n <input\n type=\"text\"\n data-digits\n id=\"donation-amount\"\n name=\"donating_amount\"\n class=\"s-form-control\"\n placeholder={this.donationAmount}/>]\n : ''}\n </div>]\n : ''}\n <div class={{'s-product-card-content-sub': true, 's-product-card-content-extra-padding': this.isSpecial}}>\n {this.getProductPrice()}\n </div>\n\n {this.isSpecial && this.productData.discount_ends\n ? <salla-count-down date={this.formatDate(this.productData.discount_ends)} end-of-day={true} boxed={true}\n labeled={true}/>\n : ''}\n\n\n {!this.hideAddBtn ?\n <div class=\"s-product-card-content-footer\">\n {/* @ts-ignore */}\n <salla-add-product-button fill=\"outline\" width=\"wide\"\n product-id={this.productData.id}\n product-status={this.productData.status}\n product-type={this.productData.type}>\n <slot name=\"add-to-cart-label\">{this.productData.add_to_cart_label}</slot>\n </salla-add-product-button>\n\n {this.horizontal || this.fullImage ?\n <salla-button\n shape=\"icon\"\n fill=\"none\"\n color=\"light\"\n ref={el => this.wishlistBtn = el}\n aria-label=\"Add or remove to wishlist\"\n class=\"s-product-card-wishlist-btn animated\"\n onClick={() => salla.wishlist.toggle(this.productData.id)}\n data-id=\"{{ product.id }}\">\n <span class=\"text-xl\" innerHTML={Heart}/>\n </salla-button>\n : ''}\n </div>\n : ''}\n </div>\n </Host>\n );\n }\n\n componentDidLoad() {\n document.lazyLoadInstance?.update(document.querySelectorAll('.s-product-card-image .lazy'));\n if (this.productData?.quantity && this.isSpecial) {\n this.initCircleBar();\n }\n\n if (!salla.config.isGuest() && salla.storage.get('salla::wishlist', []).includes(this.productData.id)) {\n this.toggleFavoriteIcon();\n }\n }\n\n}\n"],"version":3}
1
+ {"file":"salla-product-card2.js","mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,MAAM,mBAAmB,GAAG,ghBAAghB;;MCY/hB,gBAAgB;EAC3B;;;;IAEE,KAAK,CAAC,OAAO,CAAC;MACZ,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;MAC1E,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,KAAK,IAAI,CAAC,kBAAkB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;MAC9E,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,KAAK,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;MACjF,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CA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,EAAC,mBAAmB,IAAE,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAQ,CACjD,EAE1B,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,SAAS;QAChC,oBACE,KAAK,EAAC,MAAM,EACZ,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,OAAO,EACb,GAAG,EAAE,EAAE,IAAI,IAAI,CAAC,WAAW,GAAG,EAAE,gBACrB,2BAA2B,EACtC,KAAK,EAAC,sCAAsC,EAC5C,OAAO,EAAE,MAAM,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,aACjD,kBAAkB,IAC1B,YAAM,KAAK,EAAC,SAAS,EAAC,SAAS,EAAE,KAAK,GAAG,CAC5B;UACb,EAAE,CACF;QACJ,EAAE,CACF,CACD,EACP;GACH;EAED,gBAAgB;;IACd,MAAA,QAAQ,CAAC,gBAAgB,0CAAE,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,6BAA6B,CAAC,CAAC,CAAC;IAC5F,IAAI,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,QAAQ,KAAI,IAAI,CAAC,SAAS,EAAE;MAChD,IAAI,CAAC,aAAa,EAAE,CAAC;KACtB;IAED,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE;MACrG,IAAI,CAAC,kBAAkB,EAAE,CAAC;KAC3B;GACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/salla-product-card/salla-product-card.scss?tag=salla-product-card","./src/components/salla-product-card/salla-product-card.tsx"],"sourcesContent":[".s-product-card {\n &-entry {}\n\n &-image {\n &::before {\n font-family: \"sallaicons\";\n content: \"\\ec1f\" !important;\n }\n }\n\n &-vertical {}\n\n &-horizontal {}\n\n &-fit-height {}\n\n &-special {}\n\n &-full-image {}\n\n &-minimal {}\n\n &-donation {}\n\n &-shadow {}\n\n &-out-of-stock {}\n\n &-wishlist-btn {}\n\n &-content {\n &-main {}\n\n &-sub {}\n\n &-footer {}\n\n &-title {}\n\n &-subtitle {}\n\n &-pie {\n &-svg {\n circle {\n transition: stroke-dashoffset 1s linear;\n -webkit-transition: stroke-dashoffset 1s linear;\n -moz-transition: stroke-dashoffset 1s linear;\n -ms-transition: stroke-dashoffset 1s linear;\n -o-transition: stroke-dashoffset 1s linear;\n stroke: #E8EDF2;\n stroke-width: 2px;\n stroke-linecap: round;\n fill: none\n }\n\n &-base {}\n\n &-bar {\n stroke: var(--color-primary) !important;\n stroke-dasharray: 100 100;\n stroke-dashoffset: 100\n }\n }\n }\n\n // for special card\n &-extra-padding {}\n }\n\n &-donation-input {}\n}\n","import {Component, Host, h, Prop, State, Element} from '@stencil/core';\nimport Heart from '../../assets/svg/heart.svg';\n\n/**\n * @slot add-to-cart-label - Add to cart label.\n */\n@Component({\n tag: 'salla-product-card',\n styleUrl: 'salla-product-card.scss',\n assetsDirs: ['assets']\n})\n\nexport class SallaProductCard {\n constructor() {\n // Store configs\n salla.onReady(() => {\n this.fitImageHeight = salla.config.get('store.settings.product.fit_type');\n salla.wishlist.event.onAdded((_res, id) => this.toggleFavoriteIcon(true, id));\n salla.wishlist.event.onRemoved((_res, id) => this.toggleFavoriteIcon(false, id));\n this.placeholder = salla.url.asset(salla.config.get('theme.settings.placeholder'));\n });\n\n // Language\n salla.lang.onLoaded(() => {\n this.remained = salla.lang.get('pages.products.remained');\n this.donationAmount = salla.lang.get('pages.products.donation_amount');\n this.startingPrice = salla.lang.get('pages.products.starting_price');\n this.addToCart = salla.lang.get('pages.cart.add_to_cart');\n this.outOfStock = salla.lang.get('pages.products.out_of_stock');\n })\n\n // Parse product data\n if (this.product) {\n try {\n this.productData = typeof this.product == 'object' ? this.product : JSON.parse(this.product);\n return;\n } catch (e) {\n salla.log('Bad json passed via product prop');\n }\n }\n }\n\n @Element() host: HTMLElement;\n // State\n @State() productData: any;\n @State() fitImageHeight: boolean;\n @State() remained: string;\n @State() outOfStock: string;\n @State() donationAmount: string;\n @State() startingPrice: string;\n @State() addToCart: string;\n @State() placeholder: string;\n\n\n // Refs\n private pie: any;\n private wishlistBtn: HTMLSallaButtonElement;\n\n // Props\n\n\n /**\n * Product information.\n */\n @Prop() product: string;\n\n /**\n * Horizontal card.\n */\n @Prop() horizontal: boolean;\n\n /**\n * Support shadow on hover.\n */\n @Prop() shadowOnHover: boolean;\n\n /**\n * Hide add to cart button.\n */\n @Prop() hideAddBtn: boolean;\n\n /**\n * Full image card.\n */\n @Prop() fullImage: boolean;\n\n /**\n * Minimal card.\n */\n @Prop() minimal: boolean;\n\n /**\n * Special card.\n */\n @Prop() isSpecial: boolean;\n\n /**\n * Show quantity.\n */\n @Prop() showQuantity: boolean;\n\n\n // Private Methods\n private initCircleBar() {\n let qty = this.productData.quantity,\n total = this.productData.quantity > 100 ? this.productData.quantity * 2 : 100,\n roundPercent = (qty / total) * 100,\n bar = this.pie.querySelector('.s-product-card-content-pie-svg-bar'),\n strokeDashOffsetValue = 100 - roundPercent;\n bar.style.strokeDashoffset = strokeDashOffsetValue;\n }\n\n private toggleFavoriteIcon(isAdded = true, id = null) {\n if (id && id !== this.productData.id) {\n return;\n }\n this.wishlistBtn?.classList.toggle('s-product-card-wishlist-added', isAdded);\n }\n\n private formatDate(date) {\n let d = new Date(date);\n return `${d.getFullYear()}-${d.getMonth() + 1}-${d.getDate()}`;\n }\n\n private getProductBadge() {\n if (this.productData.promotion_title) {\n return <div class=\"s-product-card-promotion-title\">{this.productData.promotion_title}</div>\n }\n if (this.showQuantity && this.productData?.quantity) {\n return <div\n class=\"s-product-card-quantity\">{this.remained} {salla.helpers.number(this.productData?.quantity)}</div>\n }\n if (this.showQuantity && this.productData?.is_out_of_stock) {\n return <div class=\"s-product-card-out-badge\">{this.outOfStock}</div>\n }\n return '';\n\n }\n\n getPriceFormat(price) {\n if (!price) {\n return;\n }\n\n return salla.money(price);\n }\n\n private getProductPrice() {\n if (this.productData.is_on_sale) {\n return <div class=\"s-product-card-sale-price\">\n <h4>{this.getPriceFormat(this.productData.sale_price)}</h4>\n <span>{this.getPriceFormat(this.productData?.regular_price)}</span>\n </div>;\n }\n if (this.productData.starting_price) {\n return <div class=\"s-product-card-starting-price\"><p>{this.startingPrice}</p>\n <h4> {this.getPriceFormat(this.productData?.starting_price)} </h4></div>\n }\n return <h4 class=\"s-product-card-price\">{this.getPriceFormat(this.productData?.price)}</h4>\n }\n\n render() {\n const classes = {\n 's-product-card-entry': true,\n 's-product-card-vertical': !this.horizontal && !this.fullImage && !this.minimal,\n 's-product-card-horizontal': this.horizontal && !this.fullImage && !this.minimal,\n 's-product-card-fit-height': this.fitImageHeight && !this.isSpecial && !this.fullImage && !this.minimal,\n 's-product-card-special': this.isSpecial,\n 's-product-card-full-image': this.fullImage,\n 's-product-card-minimal': this.minimal,\n 's-product-card-donation': this.productData?.is_donation,\n 's-product-card-shadow': this.shadowOnHover,\n 's-product-card-out-of-stock': this.productData?.is_out_of_stock,\n };\n return (\n <Host id={`product-${this.productData?.id}`} class={classes}>\n <div class={!this.fullImage ? 's-product-card-image' : 's-product-card-image-full'}>\n <a href={this.productData?.url}>\n <img class={`s-product-card-image-${salla.url.is_placeholder(this.productData?.image?.url)\n ? 'contain'\n : this.fitImageHeight\n ? this.fitImageHeight\n : 'cover'} lazy`}\n src={this.placeholder}\n alt={this.productData?.image?.alt}\n data-src={this.productData?.image?.url || this.productData?.thumbnail}\n />\n {!this.fullImage && !this.minimal ? this.getProductBadge() : ''}\n </a>\n {this.fullImage && <a href={this.productData?.url} class=\"s-product-card-overlay\"/>}\n {!this.horizontal && !this.fullImage ?\n <salla-button\n shape=\"icon\"\n fill=\"none\"\n color=\"light\"\n aria-label=\"Add or remove to wishlist\"\n ref={el => this.wishlistBtn = el}\n class=\"s-product-card-wishlist-btn animated\"\n onClick={() => salla.wishlist.toggle(this.productData.id)}>\n <span innerHTML={Heart}/>\n </salla-button> : ''\n }\n </div>\n <div class=\"s-product-card-content\">\n {this.isSpecial && this.productData?.quantity ?\n <div class=\"s-product-card-content-pie\" ref={pie => this.pie = pie}>\n <span>\n <b>{salla.helpers.number(this.productData?.quantity)}</b>\n {this.remained}\n </span>\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"-2 -1 36 34\" class=\"s-product-card-content-pie-svg\">\n <circle cx=\"16\" cy=\"16\" r=\"15.9155\" class=\"s-product-card-content-pie-svg-base\"/>\n <circle cx=\"16\" cy=\"16\" r=\"15.9155\" class=\"s-product-card-content-pie-svg-bar\"/>\n </svg>\n </div>\n : ''}\n\n <div class={{'s-product-card-content-main': true, 's-product-card-content-extra-padding': this.isSpecial}}>\n <h3 class=\"s-product-card-content-title\">\n <a href={this.productData?.url}>{this.productData?.name}</a>\n </h3>\n\n {this.productData?.subtitle && !this.minimal ?\n <p class=\"s-product-card-content-subtitle\">{this.productData?.subtitle}</p>\n : ''}\n </div>\n {this.productData?.is_donation && !this.minimal && !this.fullImage ?\n [<salla-progress-bar donation={this.productData?.donation}/>,\n <div class=\"s-product-card-donation-input\">\n {this.productData?.can_donate ?\n [<label htmlFor=\"donation-amount\">{this.donationAmount} <span>*</span></label>,\n <input\n type=\"text\"\n data-digits\n id=\"donation-amount\"\n name=\"donating_amount\"\n class=\"s-form-control\"\n placeholder={this.donationAmount}/>]\n : ''}\n </div>]\n : ''}\n <div class={{'s-product-card-content-sub': true, 's-product-card-content-extra-padding': this.isSpecial}}>\n {this.getProductPrice()}\n </div>\n\n {this.isSpecial && this.productData.discount_ends\n ? <salla-count-down date={this.formatDate(this.productData.discount_ends)} end-of-day={true} boxed={true}\n labeled={true}/>\n : ''}\n\n\n {!this.hideAddBtn ?\n <div class=\"s-product-card-content-footer\">\n {/* @ts-ignore */}\n <salla-add-product-button fill=\"outline\" width=\"wide\"\n product-id={this.productData.id}\n product-status={this.productData.status}\n product-type={this.productData.type}>\n <slot name=\"add-to-cart-label\">{this.productData.add_to_cart_label}</slot>\n </salla-add-product-button>\n\n {this.horizontal || this.fullImage ?\n <salla-button\n shape=\"icon\"\n fill=\"none\"\n color=\"light\"\n ref={el => this.wishlistBtn = el}\n aria-label=\"Add or remove to wishlist\"\n class=\"s-product-card-wishlist-btn animated\"\n onClick={() => salla.wishlist.toggle(this.productData.id)}\n data-id=\"{{ product.id }}\">\n <span class=\"text-xl\" innerHTML={Heart}/>\n </salla-button>\n : ''}\n </div>\n : ''}\n </div>\n </Host>\n );\n }\n\n componentDidLoad() {\n document.lazyLoadInstance?.update(document.querySelectorAll('.s-product-card-image .lazy'));\n if (this.productData?.quantity && this.isSpecial) {\n this.initCircleBar();\n }\n\n if (!salla.config.isGuest() && salla.storage.get('salla::wishlist', []).includes(this.productData.id)) {\n this.toggleFavoriteIcon();\n }\n }\n\n}\n"],"version":3}
@@ -30,11 +30,15 @@ const SallaProductsList$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLE
30
30
  'landing-page': 'landing-page',
31
31
  'product.index.tag': 'tags',
32
32
  }[salla.config.get('page.slug')] || 'latest';
33
- this.sourceValue = this.sourceValue || this.getSourceValue();
33
+ let parsedSourceValue = this.sourceValue = this.sourceValue || this.getSourceValue();
34
+ if (this.sourceValue && ['categories', 'brands', 'tags', 'selected'].includes(this.source) && typeof this.sourceValue == 'string') {
35
+ parsedSourceValue = JSON.parse(this.sourceValue);
36
+ }
37
+ this.parsedSourceValue = parsedSourceValue;
34
38
  this.sourceValueIsValid = !!(this.sourceValue || ['latest', 'offers'].includes(this.source));
39
+ this.buildNextPageUrl();
35
40
  this.isReady = true;
36
41
  });
37
- this.buildNextPageUrl();
38
42
  if (!this.sourceValueIsValid) {
39
43
  salla.logger.warn(`source-value prop is required for source [${this.source}]`);
40
44
  return;
@@ -88,12 +92,11 @@ const SallaProductsList$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLE
88
92
  return;
89
93
  }
90
94
  if (['search', 'related', 'landing-page'].includes(this.source)) {
91
- this.nextPage = salla.url.api(`products?source=${this.source}&source_value=${this.sourceValue}${this.urlPrefix}`);
95
+ this.nextPage = salla.url.api(`products?source=${this.source}&source_value=${this.parsedSourceValue}${this.urlPrefix}`);
92
96
  return;
93
97
  }
94
98
  try {
95
- let ids = JSON.parse(this.sourceValue);
96
- this.nextPage = salla.url.api(`products?source=${this.source}&source_value[]=${ids.join('&source_value[]=')}${this.urlPrefix}`);
99
+ this.nextPage = salla.url.api(`products?source=${this.source}&source_value[]=${this.parsedSourceValue.join('&source_value[]=')}${this.urlPrefix}`);
97
100
  }
98
101
  catch (e) {
99
102
  salla.logger.warn(`source-value prop should be array of ids ex source-value="[1,2,3]" for the source [${this.source}]`);
@@ -159,16 +162,16 @@ const SallaProductsList$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLE
159
162
  return;
160
163
  }
161
164
  if (this.source === 'json') {
162
- if (!this.sourceValue.length) {
165
+ if (!this.parsedSourceValue.length) {
163
166
  this.showPlaceholder = true;
164
167
  return;
165
168
  }
166
- JSON.parse(this.sourceValue).map(product => this.wrapper.append(this.getItemHTML(product)));
169
+ this.parsedSourceValue.map(product => this.wrapper.append(this.getItemHTML(product)));
167
170
  return;
168
171
  }
169
172
  this.initiateInfiniteScroll();
170
173
  this.loading();
171
- salla.product.fetch({ source: this.source, sourceValue: this.sourceValue, filters: this.filters, limit: this.limit })
174
+ salla.product.fetch({ source: this.source, source_value: this.parsedSourceValue, filters: this.filters, limit: this.limit })
172
175
  .then(res => {
173
176
  if (!res.data.length) {
174
177
  this.showPlaceholder = true;
@@ -197,7 +200,7 @@ const SallaProductsList$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLE
197
200
  static get style() { return sallaProductsListCss; }
198
201
  }, [0, "salla-products-list", {
199
202
  "source": [1537],
200
- "sourceValue": [1, "source-value"],
203
+ "sourceValue": [1032, "source-value"],
201
204
  "limit": [1026],
202
205
  "filters": [1025],
203
206
  "page": [32],
@@ -208,7 +211,8 @@ const SallaProductsList$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLE
208
211
  "placeholderText": [32],
209
212
  "isReady": [32],
210
213
  "showPlaceholder": [32],
211
- "urlPrefix": [32]
214
+ "urlPrefix": [32],
215
+ "parsedSourceValue": [32]
212
216
  }]);
213
217
  function defineCustomElement$1() {
214
218
  if (typeof customElements === "undefined") {
@@ -1 +1 @@
1
- {"file":"salla-products-list.js","mappings":";;;;;;;;;;;;AAAA,MAAM,oBAAoB,GAAG,EAAE;;MCOlBA,mBAAiB;EAC5B;;;;IAsGS,SAAI,GAAW,CAAC,CAAC;IAQjB,cAAS,GAAW,EAAE,CAAC;;IA5G9B,KAAK,CAAC,OAAO,CAAC;MACZ,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI;QAC3B,eAAe,EAAE,QAAQ;QACzB,eAAe,EAAE,YAAY;QAC7B,sBAAsB,EAAE,QAAQ;QAChC,sBAAsB,EAAE,QAAQ;QAChC,sBAAsB,EAAE,QAAQ;QAChC,cAAc,EAAE,cAAc;QAC9B,mBAAmB,EAAE,MAAM;OAC5B,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,IAAI,QAAQ,CAAC;MAC7C,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,cAAc,EAAE,CAAA;MAC5D,IAAI,CAAC,kBAAkB,GAAG,CAAC,EAAE,IAAI,CAAC,WAAW,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;MAC7F,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;KACrB,CAAC,CAAC;IACH,IAAI,CAAC,gBAAgB,EAAE,CAAC;IACxB,IAAI,CAAC,IAAI,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=salla-products-list","./src/components/salla-products-list/salla-products-list.tsx"],"sourcesContent":["\n","import { Component, Host, h, Prop, State, Element, Watch } from '@stencil/core';\nimport ShoppingBag from '../../assets/svg/shopping-bag.svg';\n\n@Component({\n tag: 'salla-products-list',\n styleUrl: 'salla-products-list.scss'\n})\nexport class SallaProductsList {\n constructor() {\n // this.source = this.source || 'latest';\n salla.onReady(() => {\n this.source = this.source || {\n 'brands.single': 'brands',\n 'product.index': 'categories',\n 'product.index.latest': 'latest',\n 'product.index.offers': 'offers',\n 'product.index.search': 'search',\n 'landing-page': 'landing-page',\n 'product.index.tag': 'tags',\n }[salla.config.get('page.slug')] || 'latest';\n this.sourceValue = this.sourceValue || this.getSourceValue()\n this.sourceValueIsValid = !!(this.sourceValue || ['latest', 'offers'].includes(this.source));\n this.isReady = true;\n });\n this.buildNextPageUrl();\n if (!this.sourceValueIsValid) {\n salla.logger.warn(`source-value prop is required for source [${this.source}]`);\n return;\n }\n this.hasCustomComponent = !!customElements.get('custom-salla-product-card');\n\n this.hasInfiniteScroll = !['json', 'selected', 'related', 'landing-page'].includes(this.source);\n // Language\n //enhance\n this.status = document.createElement('div');\n this.status.className = 's-infinite-scroll-wrapper';\n this.status.innerHTML = `<div class=\"s-infinite-scroll-status\">\n <p class=\"s-infinite-scroll-last infinite-scroll-last s-hidden\" >${salla.lang.get('common.elements.end_of_content')}</p>\n <p class=\"s-infinite-scroll-error infinite-scroll-error s-hidden\">${salla.lang.get('common.elements.failed_to_load_more')}</p>\n </div>\n <a href=\"#\" class=\"s-infinite-scroll-btn s-button-btn\">\n <span class=\"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader\" style=\"display: none\"></span>\n </a>`;\n this.btnLoader = this.status.querySelector('.s-button-loader');\n salla.lang.onLoaded(() => {\n this.status.querySelector('.s-infinite-scroll-last').innerHTML = salla.lang.get('common.elements.end_of_content');\n this.status.querySelector('.s-infinite-scroll-error').innerHTML = salla.lang.get('common.elements.failed_to_load_more');\n this.placeholderText = salla.lang.get('pages.categories.no_products');\n });\n }\n\n private readonly status: HTMLDivElement;\n private btnLoader: HTMLAnchorElement;\n @Element() host: HTMLElement;\n private wrapper: any;\n private infiniteScroll: any;\n /**\n * The source of the products list\n * @type {string}\n * */\n @Prop({\n reflect: true,\n mutable: true\n }) source: 'categories' | 'latest' | 'related' | 'brands' | 'json' | 'search' | 'tags' | 'selected' | 'offers' | 'landing-page';\n\n /**\n * The source value, cloud be different values as following:\n * - array of ids when `source` in ['categories', 'brands', 'tags', 'selected']\n * - keyword when `source` = 'search'\n * - products payload when `source` = 'json'\n * - product_id when `source` = 'related'\n *\n * @type {string}\n * */\n @Prop() sourceValue: string;\n\n /**\n * Limit for number of products in the list.\n */\n @Prop({mutable: true}) limit: number;\n\n /**\n * Filter parameters. JSON STRING or object\n */\n @Prop({mutable: true}) filters: string;\n\n @Watch('limit')\n validateLimitMaximumValue(_newValue: number, _) {\n if (this.limit) {\n this.urlPrefix += `&per_page=${this.limit > 32 ? 32 : this.limit}}`;\n }\n }\n\n @Watch('filters')\n parseFilters(newValue: string | object, _) {\n this.filters = typeof newValue == 'string' ? JSON.parse(newValue) : newValue\n for (const [key, value] of Object.entries(this.filters)) {\n if (typeof value == \"string\") {\n this.urlPrefix += `&filters[${key}]=${value}}`;\n // TODO: only if there is going to be another type of value\n // otherwise we can remove the `else if` check. Just a fail safety\n } else if (Array.isArray(value)) {\n (value as any).forEach(item => {\n this.urlPrefix += `&filters[${key}][]=${item}}`\n })\n }\n }\n }\n\n // State\n @State() page: number = 1;\n @State() nextPage: string;\n @State() hasInfiniteScroll: boolean;\n @State() hasCustomComponent: boolean;\n @State() sourceValueIsValid: boolean;\n @State() placeholderText: string;\n @State() isReady: boolean;\n @State() showPlaceholder: boolean;\n @State() urlPrefix: string = '';\n\n\n private buildNextPageUrl() {\n if (this.source === 'json') {\n return;\n }\n if (['offers', 'latest'].includes(this.source)) {\n this.nextPage = salla.url.api(`products?source=${this.source}${this.urlPrefix}`);\n return;\n }\n\n if (['search', 'related', 'landing-page'].includes(this.source)) {\n this.nextPage = salla.url.api(`products?source=${this.source}&source_value=${this.sourceValue}${this.urlPrefix}`);\n return;\n }\n\n try {\n let ids: Array<number> = JSON.parse(this.sourceValue);\n this.nextPage = salla.url.api(`products?source=${this.source}&source_value[]=${ids.join('&source_value[]=')}${this.urlPrefix}`);\n } catch (e) {\n salla.logger.warn(`source-value prop should be array of ids ex source-value=\"[1,2,3]\" for the source [${this.source}]`);\n this.sourceValueIsValid = false;\n }\n }\n\n private getSourceValue() {\n if (['landing-page'].includes(this.source)) {\n return `${salla.config.get('page.id')}`\n } else if (['categories', 'brands', 'tags'].includes(this.source)){\n return JSON.stringify([salla.config.get('page.id')])\n }\n return this.sourceValue;\n }\n\n private loading(isLoading = true) {\n this.btnLoader.style.display = isLoading ? 'inherit' : 'none';\n }\n\n private getItemHTML(product) {\n let customComponent: string | HTMLElement = this.hasCustomComponent ? 'custom-salla-product-card' : 'salla-product-card';\n customComponent = document.createElement(customComponent);\n customComponent.setAttribute('product', JSON.stringify(product));\n if (this.source == 'landing-page' && !this.hasCustomComponent) {\n customComponent.toggleAttribute('hide-add-btn', true);\n customComponent.toggleAttribute('show-quantity', true);\n customComponent.classList.add('s-product-card-fit-height');\n }\n customComponent.toggleAttribute('shadow-on-hover', true);\n return customComponent;\n }\n\n private initiateInfiniteScroll() {\n if (!this.hasInfiniteScroll) {\n return;\n }\n\n this.host.insertAdjacentElement('afterend', this.status);\n this.infiniteScroll = salla.infiniteScroll.initiate(this.wrapper, this.wrapper, {\n path: () => this.nextPage,\n history: false,\n nextPage: this.nextPage,\n scrollThreshold: 100,\n }, /* infinite via api*/true);\n\n\n this.infiniteScroll.on('request', () => this.loading())\n this.infiniteScroll.on('load', response => this.infiniteScroll.appendItems(this.handleResponse(response)))\n this.infiniteScroll.on('error', () => {\n this.status.querySelector('.s-infinite-scroll-error').classList.remove('s-hidden')\n this.loading(false);\n });\n }\n\n private canRender() {\n return this.sourceValueIsValid && this.isReady;\n }\n\n render() {\n if (!this.canRender()) {\n return '';\n }\n if (this.showPlaceholder) {\n return <div class=\"s-products-list-placeholder\">\n <span innerHTML={ShoppingBag}></span>\n <p>{this.placeholderText}</p>\n </div>;\n }\n return (\n <Host class=\"s-products-list\">\n <div class=\"s-products-list-wrapper\" ref={wrapper => this.wrapper = wrapper} />\n </Host>\n );\n }\n\n componentDidLoad() {\n if (!this.canRender()) {\n return;\n }\n if (this.source === 'json') {\n if (!this.sourceValue.length) {\n this.showPlaceholder = true;\n return;\n }\n JSON.parse(this.sourceValue).map(product => this.wrapper.append(this.getItemHTML(product)));\n return;\n }\n\n this.initiateInfiniteScroll();\n this.loading();\n salla.product.fetch({source: this.source, sourceValue: this.sourceValue, filters: this.filters, limit: this.limit})\n .then(res => {\n if (!res.data.length) {\n this.showPlaceholder = true;\n this.loading(false);\n return;\n }\n this.handleResponse(res).forEach(card => this.wrapper.append(card));\n })\n }\n\n private handleResponse(response): Array<HTMLElement> {\n //💡 when source is related, cursor will not be existed\n this.nextPage = response.cursor ? response.cursor.next : this.nextPage;\n this.loading(false);\n if (this.hasInfiniteScroll && !this.nextPage) {\n this.infiniteScroll.option({ scrollThreshold: false, loadOnScroll: false });\n this.status.querySelector('.s-infinite-scroll-last').classList.remove('s-hidden');\n }\n return response.data?.map(product => this.getItemHTML(product)) || [];\n }\n}\n"],"version":3}
1
+ {"file":"salla-products-list.js","mappings":";;;;;;;;;;;;AAAA,MAAM,oBAAoB,GAAG,EAAE;;MCOlBA,mBAAiB;EAC5B;;;;IA8GS,SAAI,GAAW,CAAC,CAAC;IAQjB,cAAS,GAAW,EAAE,CAAC;;IApH9B,KAAK,CAAC,OAAO,CAAC;MACZ,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI;QAC3B,eAAe,EAAE,QAAQ;QACzB,eAAe,EAAE,YAAY;QAC7B,sBAAsB,EAAE,QAAQ;QAChC,sBAAsB,EAAE,QAAQ;QAChC,sBAAsB,EAAE,QAAQ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;KACrE,CAAC,CAAA;GACL;EAEO,cAAc,CAAC,QAAQ;;;IAE7B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC;IACvE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACpB,IAAI,IAAI,CAAC,iBAAiB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;MAC5C,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,eAAe,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC;MAC5E,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;KACnF;IACD,OAAO,CAAA,MAAA,QAAQ,CAAC,IAAI,0CAAE,GAAG,CAAC,OAAO,IAAI,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,KAAI,EAAE,CAAC;GACvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["SallaProductsList"],"sources":["./src/components/salla-products-list/salla-products-list.scss?tag=salla-products-list","./src/components/salla-products-list/salla-products-list.tsx"],"sourcesContent":["\n","import { Component, Host, h, Prop, State, Element, Watch } from '@stencil/core';\nimport ShoppingBag from '../../assets/svg/shopping-bag.svg';\n\n@Component({\n tag: 'salla-products-list',\n styleUrl: 'salla-products-list.scss'\n})\nexport class SallaProductsList {\n constructor() {\n // this.source = this.source || 'latest';\n salla.onReady(() => {\n this.source = this.source || {\n 'brands.single': 'brands',\n 'product.index': 'categories',\n 'product.index.latest': 'latest',\n 'product.index.offers': 'offers',\n 'product.index.search': 'search',\n 'landing-page': 'landing-page',\n 'product.index.tag': 'tags',\n }[salla.config.get('page.slug')] || 'latest';\n\n \n let parsedSourceValue = this.sourceValue = this.sourceValue || this.getSourceValue();\n\n if (this.sourceValue && ['categories', 'brands', 'tags', 'selected'].includes(this.source) && typeof this.sourceValue == 'string') {\n parsedSourceValue = JSON.parse(this.sourceValue);\n }\n this.parsedSourceValue = parsedSourceValue;\n this.sourceValueIsValid = !!(this.sourceValue || ['latest', 'offers'].includes(this.source));\n this.buildNextPageUrl();\n this.isReady = true;\n });\n \n if (!this.sourceValueIsValid) {\n salla.logger.warn(`source-value prop is required for source [${this.source}]`);\n return;\n }\n this.hasCustomComponent = !!customElements.get('custom-salla-product-card');\n\n this.hasInfiniteScroll = !['json', 'selected', 'related', 'landing-page'].includes(this.source);\n // Language\n //enhance\n this.status = document.createElement('div');\n this.status.className = 's-infinite-scroll-wrapper';\n this.status.innerHTML = `<div class=\"s-infinite-scroll-status\">\n <p class=\"s-infinite-scroll-last infinite-scroll-last s-hidden\" >${salla.lang.get('common.elements.end_of_content')}</p>\n <p class=\"s-infinite-scroll-error infinite-scroll-error s-hidden\">${salla.lang.get('common.elements.failed_to_load_more')}</p>\n </div>\n <a href=\"#\" class=\"s-infinite-scroll-btn s-button-btn\">\n <span class=\"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader\" style=\"display: none\"></span>\n </a>`;\n this.btnLoader = this.status.querySelector('.s-button-loader');\n salla.lang.onLoaded(() => {\n this.status.querySelector('.s-infinite-scroll-last').innerHTML = salla.lang.get('common.elements.end_of_content');\n this.status.querySelector('.s-infinite-scroll-error').innerHTML = salla.lang.get('common.elements.failed_to_load_more');\n this.placeholderText = salla.lang.get('pages.categories.no_products');\n });\n }\n\n private readonly status: HTMLDivElement;\n private btnLoader: HTMLAnchorElement;\n @Element() host: HTMLElement;\n private wrapper: any;\n private infiniteScroll: any;\n /**\n * The source of the products list\n * @type {string}\n * */\n @Prop({\n reflect: true,\n mutable: true\n }) source: 'categories' | 'latest' | 'related' | 'brands' | 'json' | 'search' | 'tags' | 'selected' | 'offers' | 'landing-page';\n\n /**\n * The source value, cloud be different values as following:\n * - array of ids when `source` in ['categories', 'brands', 'tags', 'selected']\n * - keyword when `source` = 'search'\n * - products payload when `source` = 'json'\n * - product_id when `source` = 'related'\n *\n * @type {string}\n * */\n @Prop({mutable: true}) sourceValue: any;\n\n /**\n * Limit for number of products in the list.\n */\n @Prop({mutable: true}) limit: number;\n\n /**\n * Filter parameters. JSON STRING or object\n */\n @Prop({mutable: true}) filters: string;\n\n @Watch('limit')\n validateLimitMaximumValue(_newValue: number, _) {\n if (this.limit) {\n this.urlPrefix += `&per_page=${this.limit > 32 ? 32 : this.limit}}`;\n }\n }\n\n @Watch('filters')\n parseFilters(newValue: string | object, _) {\n this.filters = typeof newValue == 'string' ? JSON.parse(newValue) : newValue\n for (const [key, value] of Object.entries(this.filters)) {\n if (typeof value == \"string\") {\n this.urlPrefix += `&filters[${key}]=${value}}`;\n // TODO: only if there is going to be another type of value\n // otherwise we can remove the `else if` check. Just a fail safety\n } else if (Array.isArray(value)) {\n (value as any).forEach(item => {\n this.urlPrefix += `&filters[${key}][]=${item}}`\n })\n }\n }\n }\n\n // State\n @State() page: number = 1;\n @State() nextPage: string;\n @State() hasInfiniteScroll: boolean;\n @State() hasCustomComponent: boolean;\n @State() sourceValueIsValid: boolean;\n @State() placeholderText: string;\n @State() isReady: boolean;\n @State() showPlaceholder: boolean;\n @State() urlPrefix: string = '';\n @State() parsedSourceValue: any;\n\n\n private buildNextPageUrl() {\n if (this.source === 'json') {\n return;\n }\n if (['offers', 'latest'].includes(this.source)) {\n this.nextPage = salla.url.api(`products?source=${this.source}${this.urlPrefix}`);\n return;\n }\n\n if (['search', 'related', 'landing-page'].includes(this.source)) {\n this.nextPage = salla.url.api(`products?source=${this.source}&source_value=${this.parsedSourceValue}${this.urlPrefix}`);\n return;\n }\n\n try {\n this.nextPage = salla.url.api(`products?source=${this.source}&source_value[]=${this.parsedSourceValue.join('&source_value[]=')}${this.urlPrefix}`);\n } catch (e) {\n salla.logger.warn(`source-value prop should be array of ids ex source-value=\"[1,2,3]\" for the source [${this.source}]`);\n this.sourceValueIsValid = false;\n }\n }\n\n private getSourceValue() {\n if (['landing-page'].includes(this.source)) {\n return `${salla.config.get('page.id')}`\n } else if (['categories', 'brands', 'tags'].includes(this.source)){\n return JSON.stringify([salla.config.get('page.id')])\n } \n return this.sourceValue;\n }\n\n private loading(isLoading = true) {\n this.btnLoader.style.display = isLoading ? 'inherit' : 'none';\n }\n\n private getItemHTML(product) {\n let customComponent: string | HTMLElement = this.hasCustomComponent ? 'custom-salla-product-card' : 'salla-product-card';\n customComponent = document.createElement(customComponent);\n customComponent.setAttribute('product', JSON.stringify(product));\n if (this.source == 'landing-page' && !this.hasCustomComponent) {\n customComponent.toggleAttribute('hide-add-btn', true);\n customComponent.toggleAttribute('show-quantity', true);\n customComponent.classList.add('s-product-card-fit-height');\n }\n customComponent.toggleAttribute('shadow-on-hover', true);\n return customComponent;\n }\n\n private initiateInfiniteScroll() {\n if (!this.hasInfiniteScroll) {\n return;\n }\n\n this.host.insertAdjacentElement('afterend', this.status);\n this.infiniteScroll = salla.infiniteScroll.initiate(this.wrapper, this.wrapper, {\n path: () => this.nextPage,\n history: false,\n nextPage: this.nextPage,\n scrollThreshold: 100,\n }, /* infinite via api*/true);\n\n\n this.infiniteScroll.on('request', () => this.loading())\n this.infiniteScroll.on('load', response => this.infiniteScroll.appendItems(this.handleResponse(response)))\n this.infiniteScroll.on('error', () => {\n this.status.querySelector('.s-infinite-scroll-error').classList.remove('s-hidden')\n this.loading(false);\n });\n }\n\n private canRender() {\n return this.sourceValueIsValid && this.isReady;\n }\n\n render() {\n if (!this.canRender()) {\n return '';\n }\n if (this.showPlaceholder) {\n return <div class=\"s-products-list-placeholder\">\n <span innerHTML={ShoppingBag}></span>\n <p>{this.placeholderText}</p>\n </div>;\n }\n return (\n <Host class=\"s-products-list\">\n <div class=\"s-products-list-wrapper\" ref={wrapper => this.wrapper = wrapper} />\n </Host>\n );\n }\n\n componentDidLoad() {\n if (!this.canRender()) {\n return;\n }\n if (this.source === 'json') {\n if (!this.parsedSourceValue.length) {\n this.showPlaceholder = true;\n return;\n }\n this.parsedSourceValue.map(product => this.wrapper.append(this.getItemHTML(product)));\n return;\n }\n\n this.initiateInfiniteScroll();\n this.loading();\n salla.product.fetch({source: this.source, source_value: this.parsedSourceValue , filters: this.filters, limit: this.limit})\n .then(res => { \n if (!res.data.length) {\n this.showPlaceholder = true;\n this.loading(false);\n return;\n }\n this.handleResponse(res).forEach(card => this.wrapper.append(card));\n })\n }\n\n private handleResponse(response): Array<HTMLElement> {\n //💡 when source is related, cursor will not be existed\n this.nextPage = response.cursor ? response.cursor.next : this.nextPage;\n this.loading(false);\n if (this.hasInfiniteScroll && !this.nextPage) {\n this.infiniteScroll.option({ scrollThreshold: false, loadOnScroll: false });\n this.status.querySelector('.s-infinite-scroll-last').classList.remove('s-hidden');\n }\n return response.data?.map(product => this.getItemHTML(product)) || [];\n }\n}\n"],"version":3}
@@ -32,7 +32,11 @@ const SallaProductsSlider$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
32
32
  'product.index.tag': 'tags',
33
33
  'product.single': 'related',
34
34
  }[salla.config.get('page.slug')] || 'latest';
35
- this.sourceValue = this.sourceValue || this.getSourceValue();
35
+ let parsedSourceValue = this.sourceValue = this.sourceValue || this.getSourceValue();
36
+ if (this.sourceValue && ['categories', 'brands', 'tags', 'selected'].includes(this.source) && typeof this.sourceValue == 'string') {
37
+ parsedSourceValue = JSON.parse(this.sourceValue);
38
+ }
39
+ this.parsedSourceValue = parsedSourceValue;
36
40
  this.sourceValueIsValid = !!(this.sourceValue || ['latest', 'offers'].includes(this.source));
37
41
  });
38
42
  if (!this.sourceValueIsValid) {
@@ -110,7 +114,8 @@ const SallaProductsSlider$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
110
114
  "sourceValueIsValid": [32],
111
115
  "hasCustomComponent": [32],
112
116
  "urlPrefix": [32],
113
- "apiUrl": [32]
117
+ "apiUrl": [32],
118
+ "parsedSourceValue": [32]
114
119
  }]);
115
120
  function defineCustomElement$1() {
116
121
  if (typeof customElements === "und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I,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EACnF,IAAI,EAAC,UAAU,iBACF,IAAI,CAAC,UAAU,oBACZ,IAAI,CAAC,QAAQ,qBACZ,IAAI,CAAC,aAAa,IAEnC,WAAK,IAAI,EAAC,OAAO,IACd,MAAA,IAAI,CAAC,YAAY,0CAAE,GAAG,CAAC,CAAC,OAAO,KAC9B,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAC1B,CACG,CACO,CACV,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["SallaProductsSlider"],"sources":["./src/components/salla-products-slider/salla-products-slider.scss?tag=salla-products-slider","./src/components/salla-products-slider/salla-products-slider.tsx"],"sourcesContent":[".s-products-slider{\n &-wrapper{\n\n }\n &-slider{\n\n }\n &-card{\n\n }\n}","import {Component, Host, h, Prop, Element, State} from '@stencil/core';\n\n@Component({\n tag: 'salla-products-slider',\n styleUrl: 'salla-products-slider.scss'\n})\nexport class SallaProductsSlider {\n constructor() {\n salla.onReady(() => {\n this.source = this.source || {\n 'brands.single': 'brands',\n 'product.index': 'categories',\n 'product.index.latest': 'latest',\n 'product.index.offers': 'offers',\n 'landing-page': 'landing-page',\n 'product.index.tag': 'tags',\n 'product.single': 'related',\n }[salla.config.get('page.slug')] || 'latest';\n\n this.sourceValue = this.sourceValue || this.getSourceValue()\n this.sourceValueIsValid = !!(this.sourceValue || ['latest', 'offers'].includes(this.source));\n\n });\n if (!this.sourceValueIsValid) {\n salla.logger.warn(`source-value prop is required for source [${this.source}]`);\n return;\n }\n this.hasCustomComponent = !!customElements.get('custom-salla-product-card');\n }\n\n @Element() host: HTMLElement;\n //todo:: support limit, default =10, make sure that maximum is 32,\n\n /**\n * Title of the block - works only if slider is true\n * @type {string}\n * @default ''\n * */\n @Prop() blockTitle: string;\n\n /**\n * Sub title of the block - works only if slider is true\n * @type {string}\n * @default ''\n * */\n @Prop() subTitle: string;\n\n /**\n * Slider Id, if not provided will be generated automatically\n * @type {string}\n * @default ''\n * */\n @Prop() sliderId: string;\n\n /**\n * Display 'ALL' URL\n * @type {string}\n * @default ''\n * */\n @Prop() displayAllUrl: string;\n\n /**\n * Source of the products, if api will get the products from the API, if json will get the products from the products prop\n * @type {string}\n * @default ''\n * */\n @Prop({\n reflect: true,\n mutable: true\n }) source: 'categories' | 'latest' | 'related' | 'brands' | 'json' | 'tags' | 'selected' | 'offers' | 'landing-page';\n\n /**\n * The source value, cloud be different values as following:\n * - array of ids when `source` in ['categories', 'brands', 'tags', 'selected']\n * - products payload when `source` = 'json'\n * - product_id when `source` = 'related'\n *\n * @type {string}\n * */\n @Prop() sourceValue: string;\n\n //todo:: remove this\n @State() productsData: any;\n @State() isReady: boolean;\n @State() sourceValueIsValid: boolean;\n @State() hasCustomComponent: boolean;\n @State() urlPrefix: string = '';\n @State() apiUrl: string = '';\n\n private getSourceValue() {\n if (['landing-page', 'related'].includes(this.source)) {\n return `${salla.config.get('page.id')}`\n } else if (['categories', 'brands', 'tags'].includes(this.source)) {\n return JSON.stringify([salla.config.get('page.id')])\n }\n return this.sourceValue;\n }\n\n private getItemHTML(product) {\n if (this.hasCustomComponent) {\n return <div class=\"s-products-slider-card\">\n <custom-salla-product-card product={product} source={this.source} source-value={this.sourceValue}/>\n </div>;\n }\n\n return <div class=\"s-products-slider-card\">\n <salla-product-card\n show-quantity={this.source == 'landing-page'}\n hide-add-btn={this.source == 'landing-page'}\n shadow-on-hover={true}\n product={product}/>\n </div>;\n }\n\n getApiUrl() {\n if (this.source === 'json') {\n return;\n }\n if (['offers', 'latest'].includes(this.source)) {\n return salla.url.api(`products?source=${this.source}${this.urlPrefix}`);\n }\n if (['related', 'landing-page'].includes(this.source)) {\n return salla.url.api(`products?source=${this.source}&source_value=${this.sourceValue}${this.urlPrefix}`);\n }\n\n try {\n let ids: Array<number> = JSON.parse(this.sourceValue);\n return salla.url.api(`products?source=${this.source}&source_value[]=${ids.join('&source_value[]=')}${this.urlPrefix}`);\n } catch (e) {\n salla.logger.warn(`source-value prop should be array of ids ex source-value=\"[1,2,3]\" for the source [${this.source}]`);\n this.sourceValueIsValid = false;\n }\n }\n\n private canRender() {\n return this.sourceValueIsValid && this.isReady;\n }\n\n componentWillLoad() {\n if (this.source === 'json') {\n this.productsData = JSON.parse(this.sourceValue)\n this.isReady = true\n return;\n }\n salla.api.request(this.getApiUrl(), null, 'get').then(res => {\n this.productsData = res.data\n this.isReady = true\n })\n }\n\n render() {\n if ((this.source == 'related' && salla.config.get('product.related_products')) || !this.canRender()) {\n return;\n }\n return (\n <Host class=\"s-products-slider-wrapper\">\n <salla-slider\n class=\"s-products-slider-slider\"\n id={this.sliderId || `s-products-slider-${Math.random().toString(36).substr(2, 9)}`}\n type=\"carousel\"\n block-title={this.blockTitle}\n block-subTitle={this.subTitle}\n display-all-url={this.displayAllUrl}\n >\n <div slot=\"items\">\n {this.productsData?.map((product) =>\n this.getItemHTML(product)\n )}\n </div>\n </salla-slider>\n </Host>\n );\n }\n\n}\n"],"version":3}
1
+ {"file":"salla-products-slider.js","mappings":";;;;;;;;;;;;;;;;AAAA,MAAM,sBAAsB,GAAG,EAAE;;MCMpBA,qBAAmB;EAC9B;;;IAoFS,cAAS,GAAW,EAAE,CAAC;IACvB,WAAM,GAAW,EAAE,CAAC;IApF3B,KAAK,CAAC,OAAO,CAAC;MACZ,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI;QAC3B,eAAe,EAAE,QAAQ;QACzB,eAAe,EAAE,YAAY;QAC7B,sBAAsB,EAAE,QAAQ;QAChC,sBAAsB,EAAE,QAAQ;QAChC,cAAc,EAAE,cAAc;QAC9B,mBAAmB,EAAE,MAAM;QAC3B,gBAAgB,EAAE,SAAS;OAC5B,CAAC,KAAK,CAAC,MAAM,CAAC,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QAAQ,qBACZ,IAAI,CAAC,aAAa,IAEnC,WAAK,IAAI,EAAC,OAAO,IACd,MAAA,IAAI,CAAC,YAAY,0CAAE,GAAG,CAAC,CAAC,OAAO,KAC9B,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAC1B,CACG,CACO,CACV,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["SallaProductsSlider"],"sources":["./src/components/salla-products-slider/salla-products-slider.scss?tag=salla-products-slider","./src/components/salla-products-slider/salla-products-slider.tsx"],"sourcesContent":[".s-products-slider{\n &-wrapper{\n\n }\n &-slider{\n\n }\n &-card{\n\n }\n}","import {Component, Host, h, Prop, Element, State} from '@stencil/core';\n\n@Component({\n tag: 'salla-products-slider',\n styleUrl: 'salla-products-slider.scss'\n})\nexport class SallaProductsSlider {\n constructor() {\n salla.onReady(() => {\n this.source = this.source || {\n 'brands.single': 'brands',\n 'product.index': 'categories',\n 'product.index.latest': 'latest',\n 'product.index.offers': 'offers',\n 'landing-page': 'landing-page',\n 'product.index.tag': 'tags',\n 'product.single': 'related',\n }[salla.config.get('page.slug')] || 'latest';\n \n let parsedSourceValue = this.sourceValue = this.sourceValue || this.getSourceValue();\n\n if (this.sourceValue && ['categories', 'brands', 'tags', 'selected'].includes(this.source) && typeof this.sourceValue == 'string') {\n parsedSourceValue = JSON.parse(this.sourceValue);\n }\n this.parsedSourceValue = parsedSourceValue;\n this.sourceValueIsValid = !!(this.sourceValue || ['latest', 'offers'].includes(this.source));\n\n });\n if (!this.sourceValueIsValid) {\n salla.logger.warn(`source-value prop is required for source [${this.source}]`);\n return;\n }\n this.hasCustomComponent = !!customElements.get('custom-salla-product-card');\n }\n\n @Element() host: HTMLElement;\n //todo:: support limit, default =10, make sure that maximum is 32,\n\n /**\n * Title of the block - works only if slider is true\n * @type {string}\n * @default ''\n * */\n @Prop() blockTitle: string;\n\n /**\n * Sub title of the block - works only if slider is true\n * @type {string}\n * @default ''\n * */\n @Prop() subTitle: string;\n\n /**\n * Slider Id, if not provided will be generated automatically\n * @type {string}\n * @default ''\n * */\n @Prop() sliderId: string;\n\n /**\n * Display 'ALL' URL\n * @type {string}\n * @default ''\n * */\n @Prop() displayAllUrl: string;\n\n /**\n * Source of the products, if api will get the products from the API, if json will get the products from the products prop\n * @type {string}\n * @default ''\n * */\n @Prop({\n reflect: true,\n mutable: true\n }) source: 'categories' | 'latest' | 'related' | 'brands' | 'json' | 'tags' | 'selected' | 'offers' | 'landing-page';\n\n /**\n * The source value, cloud be different values as following:\n * - array of ids when `source` in ['categories', 'brands', 'tags', 'selected']\n * - products payload when `source` = 'json'\n * - product_id when `source` = 'related'\n *\n * @type {string}\n * */\n @Prop() sourceValue: string;\n\n //todo:: remove this\n @State() productsData: any;\n @State() isReady: boolean;\n @State() sourceValueIsValid: boolean;\n @State() hasCustomComponent: boolean;\n @State() urlPrefix: string = '';\n @State() apiUrl: string = '';\n @State() parsedSourceValue: any;\n private getSourceValue() {\n if (['landing-page', 'related'].includes(this.source)) {\n return `${salla.config.get('page.id')}`\n } else if (['categories', 'brands', 'tags'].includes(this.source)) {\n return JSON.stringify([salla.config.get('page.id')])\n }\n return this.sourceValue;\n }\n\n private getItemHTML(product) {\n if (this.hasCustomComponent) {\n return <div class=\"s-products-slider-card\">\n <custom-salla-product-card product={product} source={this.source} source-value={this.sourceValue}/>\n </div>;\n }\n\n return <div class=\"s-products-slider-card\">\n <salla-product-card\n show-quantity={this.source == 'landing-page'}\n hide-add-btn={this.source == 'landing-page'}\n shadow-on-hover={true}\n product={product}/>\n </div>;\n }\n\n getApiUrl() {\n if (this.source === 'json') {\n return;\n }\n if (['offers', 'latest'].includes(this.source)) {\n return salla.url.api(`products?source=${this.source}${this.urlPrefix}`);\n }\n if (['related', 'landing-page'].includes(this.source)) {\n return salla.url.api(`products?source=${this.source}&source_value=${this.sourceValue}${this.urlPrefix}`);\n }\n\n try {\n let ids: Array<number> = JSON.parse(this.sourceValue);\n return salla.url.api(`products?source=${this.source}&source_value[]=${ids.join('&source_value[]=')}${this.urlPrefix}`);\n } catch (e) {\n salla.logger.warn(`source-value prop should be array of ids ex source-value=\"[1,2,3]\" for the source [${this.source}]`);\n this.sourceValueIsValid = false;\n }\n }\n\n private canRender() {\n return this.sourceValueIsValid && this.isReady;\n }\n\n componentWillLoad() {\n if (this.source === 'json') {\n this.productsData = JSON.parse(this.sourceValue)\n this.isReady = true\n return;\n }\n salla.api.request(this.getApiUrl(), null, 'get').then(res => {\n this.productsData = res.data\n this.isReady = true\n })\n }\n\n render() {\n if ((this.source == 'related' && salla.config.get('product.related_products')) || !this.canRender()) {\n return;\n }\n return (\n <Host class=\"s-products-slider-wrapper\">\n <salla-slider\n class=\"s-products-slider-slider\"\n id={this.sliderId || `s-products-slider-${Math.random().toString(36).substr(2, 9)}`}\n type=\"carousel\"\n block-title={this.blockTitle}\n block-subTitle={this.subTitle}\n display-all-url={this.displayAllUrl}\n >\n <div slot=\"items\">\n {this.productsData?.map((product) =>\n this.getItemHTML(product)\n )}\n </div>\n </salla-slider>\n </Host>\n );\n }\n\n}\n"],"version":3}
@@ -57,6 +57,10 @@ const SallaSwiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
57
57
  * Vertical or Horizontal thumbs slider
58
58
  */
59
59
  this.verticalThumbs = false;
60
+ /**
61
+ * Disable thumbs slider and show it as a grid
62
+ */
63
+ this.gridThumbs = false;
60
64
  /**
61
65
  * Vertical or Horizontal main slider
62
66
  */
@@ -130,7 +134,6 @@ const SallaSwiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
130
134
  this.currentIndex = undefined;
131
135
  this.isEnd = false;
132
136
  this.isBeginning = true;
133
- this.isRTL = document.documentElement.dir === 'rtl';
134
137
  this.hasThumbSlot = false;
135
138
  this.pre_defined_config = {
136
139
  carousel: {
@@ -174,6 +177,7 @@ const SallaSwiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
174
177
  spaceBetween: 30
175
178
  }
176
179
  };
180
+ this.direction = this.direction || document.documentElement.dir;
177
181
  }
178
182
  // Methods
179
183
  /**
@@ -447,17 +451,19 @@ const SallaSwiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
447
451
  classes += this.blockTitle == '' ? ' s-slider-has-notitle s-slider-v-centered ' : '';
448
452
  classes += this.verticalThumbs ? ' s-slider-vertical ' : ' s-slider-horizontal ';
449
453
  classes += this.arrowsCentered ? ' s-slider-v-centered ' : '';
454
+ classes += this.gridThumbs ? ' s-slider-with-grid-thumbs ' : '';
450
455
  return (h(Host, { class: 's-slider-wrapper ' + classes }, this.blockTitle || this.showControls ?
451
456
  h("div", { class: "s-slider-block__title" }, this.blockTitle ?
452
457
  h("div", { class: "s-slider-block__title-right" }, h("h2", null, this.blockTitle), this.blockSubtitle ? h("p", { innerHTML: this.blockSubtitle }) : '')
453
458
  : '', h("div", { class: "s-slider-block__title-left" }, this.displayAllUrl ?
454
459
  h("a", { href: this.displayAllUrl, class: "s-slider-block__display-all" }, this.displayAllTitle)
455
460
  : '', this.showControls ?
456
- h("div", { class: "s-slider-block__title-nav", dir: "rtl" }, h("button", { "aria-label": "Previous Slide", class: "s-slider-prev s-slider-nav-arrow" }, h("span", { class: "s-slider-button-icon", innerHTML: this.isRTL ? KeyboardArrowRightIcon : ArrowLeftIcon })), h("button", { "aria-label": "Next Slide", class: "s-slider-next s-slider-nav-arrow" }, h("span", { class: "s-slider-button-icon", innerHTML: this.isRTL ? ArrowLeftIcon : KeyboardArrowRightIcon })))
461
+ h("div", { class: "s-slider-block__title-nav", dir: "rtl" }, h("button", { "aria-label": "Previous Slide", class: "s-slider-prev s-slider-nav-arrow" }, h("span", { class: "s-slider-button-icon", innerHTML: this.direction == 'rtl' ? KeyboardArrowRightIcon : ArrowLeftIcon })), h("button", { "aria-label": "Next Slide", class: "s-slider-next s-slider-nav-arrow" }, h("span", { class: "s-slider-button-icon", innerHTML: this.direction == 'rtl' ? ArrowLeftIcon : KeyboardArrowRightIcon })))
457
462
  : ''))
458
- : '', h("div", { class: "swiper s-slider-container", ref: el => this.sliderContainer = el, dir: this.vertical ? "ltr" : this.isRTL ? 'rtl' : 'ltr' }, h("slot", null), h("div", { class: "swiper-wrapper s-slider-swiper-wrapper", ref: el => this.sliderWrapper = el }, h("slot", { name: 'items' })), this.pagination ? h("div", { class: "swiper-pagination" }) : ''), this.type == 'thumbs' && this.hasThumbSlot ? h("div", { class: "s-slider-thumbs" }, h("div", { class: "swiper s-slider-thumbs-container", dir: this.verticalThumbs ? "ltr" : this.isRTL ? 'rtl' : 'ltr', ref: el => this.thumbsSliderContainer = el }, h("div", { class: "s-slider-swiper-wrapper swiper-wrapper", ref: el => this.thumbsSliderWrapper = el }, h("slot", { name: "thumbs" })), this.showThumbsControls ?
459
- h("div", { class: "s-slider-thumbs-nav", dir: "rtl" }, h("button", { "aria-label": "Previous Slide", class: "s-slider-thumbs-prev s-slider-nav-arrow" }, h("span", { class: "s-slider-button-icon", innerHTML: this.isRTL ? KeyboardArrowRightIcon : ArrowLeftIcon })), h("button", { "aria-label": "Next Slide", class: "s-slider-thumbs-next s-slider-nav-arrow" }, h("span", { class: "s-slider-button-icon", innerHTML: this.isRTL ? ArrowLeftIcon : KeyboardArrowRightIcon })))
460
- : '')) : ''));
463
+ : '', h("div", { class: "swiper s-slider-container", ref: el => this.sliderContainer = el, dir: this.vertical ? "ltr" : this.direction }, h("slot", null), h("div", { class: "swiper-wrapper s-slider-swiper-wrapper", ref: el => this.sliderWrapper = el }, h("slot", { name: 'items' })), this.pagination ? h("div", { class: "swiper-pagination" }) : ''), this.type == 'thumbs' && this.hasThumbSlot ? h("div", { class: "s-slider-thumbs" }, h("div", { class: "swiper s-slider-thumbs-container", dir: this.verticalThumbs ? "ltr" : this.direction, ref: el => this.thumbsSliderContainer = el }, h("div", { class: { "s-slider-swiper-wrapper swiper-wrapper": true, "s-slider-grid-thumbs": this.gridThumbs }, ref: el => this.thumbsSliderWrapper = el }, h("slot", { name: "thumbs" })), this.showThumbsControls ?
464
+ h("div", { class: "s-slider-thumbs-nav", dir: "rtl" }, h("button", { "aria-label": "Previous Slide", class: "s-slider-thumbs-prev s-slider-nav-arrow" }, h("span", { class: "s-slider-button-icon", innerHTML: this.direction == 'rtl' ? KeyboardArrowRightIcon : ArrowLeftIcon })), h("button", { "aria-label": "Next Slide", class: "s-slider-thumbs-next s-slider-nav-arrow" }, h("span", { class: "s-slider-button-icon", innerHTML: this.direction == 'rtl' ? ArrowLeftIcon : KeyboardArrowRightIcon })))
465
+ : null))
466
+ : null));
461
467
  }
462
468
  componentDidLoad() {
463
469
  let itemsSlot = this.sliderWrapper.querySelector('div[slot="items"]');
@@ -484,6 +490,7 @@ const SallaSwiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
484
490
  "displayAllUrl": [513, "display-all-url"],
485
491
  "arrowsCentered": [516, "arrows-centered"],
486
492
  "verticalThumbs": [516, "vertical-thumbs"],
493
+ "gridThumbs": [516, "grid-thumbs"],
487
494
  "vertical": [516],
488
495
  "autoHeight": [516, "auto-height"],
489
496
  "showControls": [516, "show-controls"],
@@ -494,13 +501,13 @@ const SallaSwiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
494
501
  "pagination": [4],
495
502
  "centered": [4],
496
503
  "loop": [4],
504
+ "direction": [1537],
497
505
  "type": [1],
498
506
  "sliderConfig": [520, "slider-config"],
499
507
  "thumbsConfig": [520, "thumbs-config"],
500
508
  "currentIndex": [32],
501
509
  "isEnd": [32],
502
510
  "isBeginning": [32],
503
- "isRTL": [32],
504
511
  "swiperScript": [32],
505
512
  "displayAllTitle": [32],
506
513
  "slideTo": [64],