@salla.sa/twilight-components 2.14.220 → 2.14.222
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{app-globals-2vTvVXxF.js → app-globals-DPedpk8u.js} +3 -3
- package/dist/cjs/{app-globals-2vTvVXxF.js.map → app-globals-DPedpk8u.js.map} +1 -1
- package/dist/cjs/{index-B04Y8RyW.js → index-BDn6fH9S.js} +8 -4
- package/dist/cjs/index-BDn6fH9S.js.map +1 -0
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/salla-accordion-body.cjs.entry.js +1 -1
- package/dist/cjs/salla-accordion-head.cjs.entry.js +1 -1
- package/dist/cjs/salla-accordion.cjs.entry.js +1 -1
- package/dist/cjs/salla-add-product-button_51.cjs.entry.js +1 -1
- package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
- package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
- package/dist/cjs/salla-booking-field_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-item-offers.cjs.entry.js +1 -1
- package/dist/cjs/salla-conditional-offer.cjs.entry.js +16 -5
- package/dist/cjs/salla-conditional-offer.cjs.entry.js.map +1 -1
- package/dist/cjs/salla-conditional-offer.entry.cjs.js.map +1 -1
- package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters.cjs.entry.js +1 -1
- package/dist/cjs/salla-installment.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-program.cjs.entry.js +1 -1
- package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
- package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
- package/dist/cjs/salla-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
- package/dist/cjs/salla-orders.cjs.entry.js +1 -1
- package/dist/cjs/salla-payments.cjs.entry.js +1 -1
- package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-options.cjs.entry.js +1 -1
- package/dist/cjs/salla-review-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-reviews-page.cjs.entry.js +1 -1
- package/dist/cjs/salla-reviews.cjs.entry.js +1 -1
- package/dist/cjs/salla-social.cjs.entry.js +1 -1
- package/dist/cjs/salla-tiered-offer.cjs.entry.js +338 -0
- package/dist/cjs/salla-tiered-offer.cjs.entry.js.map +1 -0
- package/dist/cjs/salla-tiered-offer.entry.cjs.js.map +1 -0
- package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/salla-verify.cjs.entry.js +1 -1
- package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
- package/dist/cjs/twilight.cjs.js +3 -3
- package/dist/collection/assets/svg/diamond-02.svg +4 -0
- package/dist/collection/assets/svg/gold.svg +6 -0
- package/dist/collection/assets/svg/star-rounded.svg +3 -0
- package/dist/collection/assets/svg/stars.svg +5 -0
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/salla-conditional-offer/salla-conditional-offer.js +15 -4
- package/dist/collection/components/salla-conditional-offer/salla-conditional-offer.js.map +1 -1
- package/dist/collection/components/salla-tiered-offer/constants.js +12 -0
- package/dist/collection/components/salla-tiered-offer/constants.js.map +1 -0
- package/dist/collection/components/salla-tiered-offer/interfaces.js +9 -0
- package/dist/collection/components/salla-tiered-offer/interfaces.js.map +1 -0
- package/dist/collection/components/salla-tiered-offer/salla-tiered-offer.css +26 -0
- package/dist/collection/components/salla-tiered-offer/salla-tiered-offer.js +288 -0
- package/dist/collection/components/salla-tiered-offer/salla-tiered-offer.js.map +1 -0
- package/dist/collection/components/salla-tiered-offer/utils.js +38 -0
- package/dist/collection/components/salla-tiered-offer/utils.js.map +1 -0
- package/dist/components/index.js +2 -2
- package/dist/components/index.js.map +1 -1
- package/dist/components/salla-conditional-offer.js +15 -4
- package/dist/components/salla-conditional-offer.js.map +1 -1
- package/dist/components/salla-tiered-offer.d.ts +11 -0
- package/dist/components/salla-tiered-offer.js +371 -0
- package/dist/components/salla-tiered-offer.js.map +1 -0
- package/dist/esm/{app-globals-DRz9_J1y.js → app-globals-wLakfxcp.js} +3 -3
- package/dist/esm/{app-globals-DRz9_J1y.js.map → app-globals-wLakfxcp.js.map} +1 -1
- package/dist/esm/{index-L1Wml9tS.js → index-Dj2SrCy0.js} +8 -4
- package/dist/esm/index-Dj2SrCy0.js.map +1 -0
- package/dist/esm/loader.js +4 -4
- package/dist/esm/salla-accordion-body.entry.js +1 -1
- package/dist/esm/salla-accordion-head.entry.js +1 -1
- package/dist/esm/salla-accordion.entry.js +1 -1
- package/dist/esm/salla-add-product-button_51.entry.js +1 -1
- package/dist/esm/salla-advertisement.entry.js +1 -1
- package/dist/esm/salla-app-install-alert.entry.js +1 -1
- package/dist/esm/salla-apps-icons.entry.js +1 -1
- package/dist/esm/salla-booking-field_2.entry.js +1 -1
- package/dist/esm/salla-cart-item-offers.entry.js +1 -1
- package/dist/esm/salla-conditional-offer.entry.js +16 -5
- package/dist/esm/salla-conditional-offer.entry.js.map +1 -1
- package/dist/esm/salla-contacts.entry.js +1 -1
- package/dist/esm/salla-filters-widget.entry.js +1 -1
- package/dist/esm/salla-filters.entry.js +1 -1
- package/dist/esm/salla-installment.entry.js +1 -1
- package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
- package/dist/esm/salla-loyalty-program.entry.js +1 -1
- package/dist/esm/salla-metadata.entry.js +1 -1
- package/dist/esm/salla-notification-item.entry.js +1 -1
- package/dist/esm/salla-notifications.entry.js +1 -1
- package/dist/esm/salla-offer.entry.js +1 -1
- package/dist/esm/salla-order-summary.entry.js +1 -1
- package/dist/esm/salla-orders.entry.js +1 -1
- package/dist/esm/salla-payments.entry.js +1 -1
- package/dist/esm/salla-price-range.entry.js +1 -1
- package/dist/esm/salla-product-options.entry.js +1 -1
- package/dist/esm/salla-review-card.entry.js +1 -1
- package/dist/esm/salla-reviews-page.entry.js +1 -1
- package/dist/esm/salla-reviews.entry.js +1 -1
- package/dist/esm/salla-social.entry.js +1 -1
- package/dist/esm/salla-tiered-offer.entry.js +336 -0
- package/dist/esm/salla-tiered-offer.entry.js.map +1 -0
- package/dist/esm/salla-tooltip.entry.js +1 -1
- package/dist/esm/salla-verify.entry.js +1 -1
- package/dist/esm/salla-wallet.entry.js +1 -1
- package/dist/esm/twilight.js +4 -4
- package/dist/esm-es5/{app-globals-DRz9_J1y.js → app-globals-wLakfxcp.js} +2 -2
- package/dist/esm-es5/{app-globals-DRz9_J1y.js.map → app-globals-wLakfxcp.js.map} +1 -1
- package/dist/esm-es5/{index-L1Wml9tS.js → index-Dj2SrCy0.js} +3 -3
- package/dist/esm-es5/index-Dj2SrCy0.js.map +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/salla-accordion-body.entry.js +1 -1
- package/dist/esm-es5/salla-accordion-head.entry.js +1 -1
- package/dist/esm-es5/salla-accordion.entry.js +1 -1
- package/dist/esm-es5/salla-add-product-button_51.entry.js +1 -1
- package/dist/esm-es5/salla-advertisement.entry.js +1 -1
- package/dist/esm-es5/salla-app-install-alert.entry.js +1 -1
- package/dist/esm-es5/salla-apps-icons.entry.js +1 -1
- package/dist/esm-es5/salla-booking-field_2.entry.js +1 -1
- package/dist/esm-es5/salla-cart-item-offers.entry.js +1 -1
- package/dist/esm-es5/salla-conditional-offer.entry.js +1 -1
- package/dist/esm-es5/salla-conditional-offer.entry.js.map +1 -1
- package/dist/esm-es5/salla-contacts.entry.js +1 -1
- package/dist/esm-es5/salla-filters-widget.entry.js +2 -2
- package/dist/esm-es5/salla-filters.entry.js +1 -1
- package/dist/esm-es5/salla-installment.entry.js +1 -1
- package/dist/esm-es5/salla-loyalty-prize-item.entry.js +1 -1
- package/dist/esm-es5/salla-loyalty-program.entry.js +1 -1
- package/dist/esm-es5/salla-metadata.entry.js +2 -2
- package/dist/esm-es5/salla-notification-item.entry.js +1 -1
- package/dist/esm-es5/salla-notifications.entry.js +2 -2
- package/dist/esm-es5/salla-offer.entry.js +1 -1
- package/dist/esm-es5/salla-order-summary.entry.js +2 -2
- package/dist/esm-es5/salla-orders.entry.js +2 -2
- package/dist/esm-es5/salla-payments.entry.js +1 -1
- package/dist/esm-es5/salla-price-range.entry.js +1 -1
- package/dist/esm-es5/salla-product-options.entry.js +1 -1
- package/dist/esm-es5/salla-review-card.entry.js +1 -1
- package/dist/esm-es5/salla-reviews-page.entry.js +1 -1
- package/dist/esm-es5/salla-reviews.entry.js +1 -1
- package/dist/esm-es5/salla-social.entry.js +1 -1
- package/dist/esm-es5/salla-tiered-offer.entry.js +5 -0
- package/dist/esm-es5/salla-tiered-offer.entry.js.map +1 -0
- package/dist/esm-es5/salla-tooltip.entry.js +1 -1
- package/dist/esm-es5/salla-verify.entry.js +1 -1
- package/dist/esm-es5/salla-wallet.entry.js +1 -1
- package/dist/esm-es5/twilight.js +1 -1
- package/dist/twilight/{p-2ac20d02.entry.js → p-00ce3e65.entry.js} +2 -2
- package/dist/twilight/{p-e00746e9.system.entry.js → p-02cc2225.system.entry.js} +2 -2
- package/dist/twilight/{p-0a469ba7.system.entry.js → p-0b16f452.system.entry.js} +3 -3
- package/dist/twilight/{p-3bdebf0d.entry.js → p-109136fc.entry.js} +2 -2
- package/dist/twilight/{p-fe959c9a.system.entry.js → p-12adb702.system.entry.js} +2 -2
- package/dist/twilight/{p-12a13525.entry.js → p-16dfee33.entry.js} +2 -2
- package/dist/twilight/{p-1ccd8b8e.entry.js → p-18537486.entry.js} +2 -2
- package/dist/twilight/{p-2cd40336.system.entry.js → p-1cbc4329.system.entry.js} +2 -2
- package/dist/twilight/{p-fbaa093c.entry.js → p-1cf1344e.entry.js} +2 -2
- package/dist/twilight/{p-a477ee76.system.entry.js → p-1d6100c4.system.entry.js} +2 -2
- package/dist/twilight/{p-75ec194e.system.entry.js → p-29567106.system.entry.js} +2 -2
- package/dist/twilight/{p-962cd525.entry.js → p-315c5fd3.entry.js} +2 -2
- package/dist/twilight/{p-184f98b1.entry.js → p-337fca82.entry.js} +2 -2
- package/dist/twilight/{p-5b8bf0e6.system.entry.js → p-3b02f780.system.entry.js} +2 -2
- package/dist/twilight/{p-Burnn1Qt.js → p-4drPVtGP.js} +2 -2
- package/dist/twilight/{p-Burnn1Qt.js.map → p-4drPVtGP.js.map} +1 -1
- package/dist/twilight/{p-7b7618d5.entry.js → p-5394cdeb.entry.js} +2 -2
- package/dist/twilight/{p-38526ba5.system.entry.js → p-55306475.system.entry.js} +2 -2
- package/dist/twilight/{p-b1ad7c75.entry.js → p-59763129.entry.js} +2 -2
- package/dist/twilight/{p-52156f6d.system.entry.js → p-5cd7ff6d.system.entry.js} +2 -2
- package/dist/twilight/{p-5c918974.entry.js → p-5e1f0ddf.entry.js} +2 -2
- package/dist/twilight/p-618eb3f2.system.entry.js +5 -0
- package/dist/twilight/p-618eb3f2.system.entry.js.map +1 -0
- package/dist/twilight/{p-f6c410c6.entry.js → p-67b54ac4.entry.js} +2 -2
- package/dist/twilight/p-67ebf87e.system.entry.js +5 -0
- package/dist/twilight/{p-76137ff1.entry.js → p-688dd765.entry.js} +2 -2
- package/dist/twilight/{p-284dae41.system.entry.js → p-6ec767ac.system.entry.js} +2 -2
- package/dist/twilight/{p-1af18eb4.entry.js → p-70e74f3c.entry.js} +2 -2
- package/dist/twilight/{p-d9c2f2b0.system.entry.js → p-7236a037.system.entry.js} +2 -2
- package/dist/twilight/{p-30c8b458.system.entry.js → p-7436f972.system.entry.js} +2 -2
- package/dist/twilight/{p-8d9a5dc0.entry.js → p-74647582.entry.js} +2 -2
- package/dist/twilight/{p-Cl_CHxGj.system.js.map → p-78vq_YNh.system.js.map} +1 -1
- package/dist/twilight/{p-c781f7a7.entry.js → p-8162a820.entry.js} +2 -2
- package/dist/twilight/p-864f1430.system.entry.js +5 -0
- package/dist/twilight/{p-47b6e06b.system.entry.js → p-865fc401.system.entry.js} +2 -2
- package/dist/twilight/{p-bfb9457b.system.entry.js → p-87206bd7.system.entry.js} +2 -2
- package/dist/twilight/p-8c08dafb.entry.js +5 -0
- package/dist/twilight/{p-0e4f26bb.system.entry.js → p-8ce2a142.system.entry.js} +2 -2
- package/dist/twilight/{p-60e6d7e6.system.entry.js → p-8d28bf6e.system.entry.js} +2 -2
- package/dist/twilight/{p-d07e552b.system.entry.js → p-97337c52.system.entry.js} +2 -2
- package/dist/twilight/{p-08258532.entry.js → p-9e54e404.entry.js} +2 -2
- package/dist/twilight/{p-C9IwdXDn.system.js.map → p-B-EmhPha.system.js.map} +1 -1
- package/dist/twilight/{p-B0ThVjj_.system.js.map → p-B6apPCKk.system.js.map} +1 -1
- package/dist/twilight/{p-D_Of4cjl.system.js.map → p-BC5TR2o4.system.js.map} +1 -1
- package/dist/twilight/{p-Bvg9GRmu.system.js.map → p-BFLzwSRe.system.js.map} +1 -1
- package/dist/twilight/{p-DFlc0grl.system.js.map → p-BIlNLy1w.system.js.map} +1 -1
- package/dist/twilight/{p-j7nJelMY.system.js.map → p-B_H7JnAQ.system.js.map} +1 -1
- package/dist/twilight/{p-BWD1Mdmj.system.js.map → p-BfizdcIv.system.js.map} +1 -1
- package/dist/twilight/{p-BfxbBmpF.system.js.map → p-BgVK0PPB.system.js.map} +1 -1
- package/dist/twilight/{p-BUNm7oxn.system.js → p-BtfcvLWi.system.js} +2 -2
- package/dist/twilight/{p-BUNm7oxn.system.js.map → p-BtfcvLWi.system.js.map} +1 -1
- package/dist/twilight/{p-BP344v_q.system.js.map → p-BxPxFmIf.system.js.map} +1 -1
- package/dist/twilight/{p-9jT7Wo1H.system.js.map → p-C6Mc-nga.system.js.map} +1 -1
- package/dist/twilight/{p-nuRa4ECK.system.js.map → p-CAhB5SXO.system.js.map} +1 -1
- package/dist/twilight/{p-cWZujtjd.system.js.map → p-CD5EBKFr.system.js.map} +1 -1
- package/dist/twilight/{p-egmUBeji.system.js.map → p-CDPN9ikP.system.js.map} +1 -1
- package/dist/twilight/{p-YvHIMjOJ.system.js.map → p-CE_xhQMS.system.js.map} +1 -1
- package/dist/twilight/{p-Cee0DssD.system.js.map → p-CIzZIur3.system.js.map} +1 -1
- package/dist/twilight/p-CaVNqQXu.system.js +5 -0
- package/dist/twilight/{p-ByGP8fWO.system.js.map → p-CaVNqQXu.system.js.map} +1 -1
- package/dist/twilight/{p-DPreD4Hr.system.js.map → p-CfNLozg0.system.js.map} +1 -1
- package/dist/twilight/p-ClaSC-3N.system.js.map +1 -0
- package/dist/twilight/{p-CIghWdV5.system.js.map → p-Cm8GjH45.system.js.map} +1 -1
- package/dist/twilight/{p-BftU992I.system.js.map → p-CpJOChwF.system.js.map} +1 -1
- package/dist/twilight/{p-BWnEoSJY.system.js.map → p-CsweHiBJ.system.js.map} +1 -1
- package/dist/twilight/{p-CpzD5fce.system.js.map → p-CtiUKful.system.js.map} +1 -1
- package/dist/twilight/{p-nvgYekhd.system.js.map → p-D0vXKNzE.system.js.map} +1 -1
- package/dist/twilight/{p-BCvHzhOW.system.js.map → p-D6fGvShW.system.js.map} +1 -1
- package/dist/twilight/{p-BlpV9vce.system.js.map → p-DInbMpRZ.system.js.map} +1 -1
- package/dist/twilight/{p-DVqtOGyR.system.js.map → p-DRUO4ntA.system.js.map} +1 -1
- package/dist/twilight/{p-L1Wml9tS.js → p-Dj2SrCy0.js} +3 -3
- package/dist/twilight/p-Dj2SrCy0.js.map +1 -0
- package/dist/twilight/{p-DuTXkmaO.system.js → p-DvJ_tnSw.system.js} +6 -6
- package/dist/twilight/p-DvJ_tnSw.system.js.map +1 -0
- package/dist/twilight/{p-DUDOY-ZS.system.js.map → p-DvQIv_6Y.system.js.map} +1 -1
- package/dist/twilight/{p-DwLeLHva.system.js.map → p-Dx2JzDoP.system.js.map} +1 -1
- package/dist/twilight/{p-DmQdqVWv.system.js.map → p-Dzal8dOY.system.js.map} +1 -1
- package/dist/twilight/p-FGWU4ai_.system.js.map +1 -0
- package/dist/twilight/{p-DvZ3uG1Y.system.js.map → p-LondrlGD.system.js.map} +1 -1
- package/dist/twilight/{p-tI_9cOVN.system.js.map → p-Q2yReOd3.system.js.map} +1 -1
- package/dist/twilight/{p-ByVXW9BA.system.js.map → p-WlDhq-4G.system.js.map} +1 -1
- package/dist/twilight/{p-cbadf894.system.entry.js → p-a20b6984.system.entry.js} +2 -2
- package/dist/twilight/{p-b4b5a600.system.entry.js → p-a439d5c1.system.entry.js} +2 -2
- package/dist/twilight/{p-62ba5382.entry.js → p-a531e0e4.entry.js} +2 -2
- package/dist/twilight/{p-342e13e4.system.entry.js → p-acaa2f80.system.entry.js} +2 -2
- package/dist/twilight/{p-154d97db.system.entry.js → p-ae7962ba.system.entry.js} +2 -2
- package/dist/twilight/{p-039b45e6.system.entry.js → p-b167e712.system.entry.js} +2 -2
- package/dist/twilight/{p-9a3f6331.entry.js → p-b42c8720.entry.js} +2 -2
- package/dist/twilight/{p-4291c03c.system.entry.js → p-b477f55b.system.entry.js} +2 -2
- package/dist/twilight/{p-50f789e5.entry.js → p-bc918d89.entry.js} +2 -2
- package/dist/twilight/{p-96d501d2.entry.js → p-c3adc5d9.entry.js} +2 -2
- package/dist/twilight/{p-5a577bf3.system.entry.js → p-c842f73f.system.entry.js} +2 -2
- package/dist/twilight/{p-f72dd4b6.system.entry.js → p-c8cea269.system.entry.js} +2 -2
- package/dist/twilight/{p-90fc2489.entry.js → p-d37bad6f.entry.js} +2 -2
- package/dist/twilight/{p-af1f9cd6.entry.js → p-d85581c6.entry.js} +2 -2
- package/dist/twilight/{p-666189da.system.entry.js → p-d8d9cdcd.system.entry.js} +2 -2
- package/dist/twilight/{p-be1034af.system.entry.js → p-de891990.system.entry.js} +2 -2
- package/dist/twilight/{p-6c83517d.entry.js → p-def552bd.entry.js} +2 -2
- package/dist/twilight/{p-228d58df.system.entry.js → p-e4f73083.system.entry.js} +2 -2
- package/dist/twilight/{p-a3ab451d.entry.js → p-e5872e75.entry.js} +2 -2
- package/dist/twilight/{p-d0a760cc.entry.js → p-ed4c7158.entry.js} +2 -2
- package/dist/twilight/p-ee443b00.entry.js +5 -0
- package/dist/twilight/p-ee443b00.entry.js.map +1 -0
- package/dist/twilight/{p-789f0166.system.entry.js → p-f1f3d74e.system.entry.js} +2 -2
- package/dist/twilight/{p-ca88566e.entry.js → p-f3b8551c.entry.js} +2 -2
- package/dist/twilight/{p-c63ddf33.entry.js → p-f41e7eed.entry.js} +2 -2
- package/dist/twilight/{p-6fcc8ed3.entry.js → p-f4918259.entry.js} +2 -2
- package/dist/twilight/p-f594b721.entry.js +5 -0
- package/dist/twilight/p-f594b721.entry.js.map +1 -0
- package/dist/twilight/{p-5b4f648e.entry.js → p-f9d8f20d.entry.js} +2 -2
- package/dist/twilight/p-fb59e3b5.entry.js +5 -0
- package/dist/twilight/p-ffb9ab7b.system.entry.js +5 -0
- package/dist/twilight/p-ffb9ab7b.system.entry.js.map +1 -0
- package/dist/twilight/{p-DKke2twA.system.js.map → p-jlCh1xBh.system.js.map} +1 -1
- package/dist/twilight/salla-conditional-offer.entry.esm.js.map +1 -1
- package/dist/twilight/salla-tiered-offer.entry.esm.js.map +1 -0
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/twilight/twilight.js +1 -1
- package/dist/types/components/salla-tiered-offer/constants.d.ts +2 -0
- package/dist/types/components/salla-tiered-offer/interfaces.d.ts +44 -0
- package/dist/types/components/salla-tiered-offer/salla-tiered-offer.d.ts +39 -0
- package/dist/types/components/salla-tiered-offer/utils.d.ts +19 -0
- package/dist/types/components.d.ts +13 -0
- package/package.json +5 -5
- package/dist/cjs/index-B04Y8RyW.js.map +0 -1
- package/dist/esm/index-L1Wml9tS.js.map +0 -1
- package/dist/esm-es5/index-L1Wml9tS.js.map +0 -1
- package/dist/twilight/p-0225792d.system.entry.js +0 -5
- package/dist/twilight/p-0225792d.system.entry.js.map +0 -1
- package/dist/twilight/p-2c11821b.entry.js +0 -5
- package/dist/twilight/p-4fd3a01d.entry.js +0 -5
- package/dist/twilight/p-4fd3a01d.entry.js.map +0 -1
- package/dist/twilight/p-57bbd96b.system.entry.js +0 -5
- package/dist/twilight/p-BIOQiBj0.system.js.map +0 -1
- package/dist/twilight/p-ByGP8fWO.system.js +0 -5
- package/dist/twilight/p-DuTXkmaO.system.js.map +0 -1
- package/dist/twilight/p-L1Wml9tS.js.map +0 -1
- package/dist/twilight/p-a198f405.entry.js +0 -5
- package/dist/twilight/p-e58e21db.system.entry.js +0 -5
- /package/dist/twilight/{p-2ac20d02.entry.js.map → p-00ce3e65.entry.js.map} +0 -0
- /package/dist/twilight/{p-e00746e9.system.entry.js.map → p-02cc2225.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-0a469ba7.system.entry.js.map → p-0b16f452.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-3bdebf0d.entry.js.map → p-109136fc.entry.js.map} +0 -0
- /package/dist/twilight/{p-fe959c9a.system.entry.js.map → p-12adb702.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-12a13525.entry.js.map → p-16dfee33.entry.js.map} +0 -0
- /package/dist/twilight/{p-1ccd8b8e.entry.js.map → p-18537486.entry.js.map} +0 -0
- /package/dist/twilight/{p-2cd40336.system.entry.js.map → p-1cbc4329.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-fbaa093c.entry.js.map → p-1cf1344e.entry.js.map} +0 -0
- /package/dist/twilight/{p-a477ee76.system.entry.js.map → p-1d6100c4.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-75ec194e.system.entry.js.map → p-29567106.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-962cd525.entry.js.map → p-315c5fd3.entry.js.map} +0 -0
- /package/dist/twilight/{p-184f98b1.entry.js.map → p-337fca82.entry.js.map} +0 -0
- /package/dist/twilight/{p-5b8bf0e6.system.entry.js.map → p-3b02f780.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-7b7618d5.entry.js.map → p-5394cdeb.entry.js.map} +0 -0
- /package/dist/twilight/{p-38526ba5.system.entry.js.map → p-55306475.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-b1ad7c75.entry.js.map → p-59763129.entry.js.map} +0 -0
- /package/dist/twilight/{p-52156f6d.system.entry.js.map → p-5cd7ff6d.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-5c918974.entry.js.map → p-5e1f0ddf.entry.js.map} +0 -0
- /package/dist/twilight/{p-f6c410c6.entry.js.map → p-67b54ac4.entry.js.map} +0 -0
- /package/dist/twilight/{p-57bbd96b.system.entry.js.map → p-67ebf87e.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-76137ff1.entry.js.map → p-688dd765.entry.js.map} +0 -0
- /package/dist/twilight/{p-284dae41.system.entry.js.map → p-6ec767ac.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-1af18eb4.entry.js.map → p-70e74f3c.entry.js.map} +0 -0
- /package/dist/twilight/{p-d9c2f2b0.system.entry.js.map → p-7236a037.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-30c8b458.system.entry.js.map → p-7436f972.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-8d9a5dc0.entry.js.map → p-74647582.entry.js.map} +0 -0
- /package/dist/twilight/{p-c781f7a7.entry.js.map → p-8162a820.entry.js.map} +0 -0
- /package/dist/twilight/{p-e58e21db.system.entry.js.map → p-864f1430.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-47b6e06b.system.entry.js.map → p-865fc401.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-bfb9457b.system.entry.js.map → p-87206bd7.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-a198f405.entry.js.map → p-8c08dafb.entry.js.map} +0 -0
- /package/dist/twilight/{p-0e4f26bb.system.entry.js.map → p-8ce2a142.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-60e6d7e6.system.entry.js.map → p-8d28bf6e.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-d07e552b.system.entry.js.map → p-97337c52.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-08258532.entry.js.map → p-9e54e404.entry.js.map} +0 -0
- /package/dist/twilight/{p-cbadf894.system.entry.js.map → p-a20b6984.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-b4b5a600.system.entry.js.map → p-a439d5c1.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-62ba5382.entry.js.map → p-a531e0e4.entry.js.map} +0 -0
- /package/dist/twilight/{p-342e13e4.system.entry.js.map → p-acaa2f80.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-154d97db.system.entry.js.map → p-ae7962ba.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-039b45e6.system.entry.js.map → p-b167e712.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-9a3f6331.entry.js.map → p-b42c8720.entry.js.map} +0 -0
- /package/dist/twilight/{p-4291c03c.system.entry.js.map → p-b477f55b.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-50f789e5.entry.js.map → p-bc918d89.entry.js.map} +0 -0
- /package/dist/twilight/{p-96d501d2.entry.js.map → p-c3adc5d9.entry.js.map} +0 -0
- /package/dist/twilight/{p-5a577bf3.system.entry.js.map → p-c842f73f.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-f72dd4b6.system.entry.js.map → p-c8cea269.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-90fc2489.entry.js.map → p-d37bad6f.entry.js.map} +0 -0
- /package/dist/twilight/{p-af1f9cd6.entry.js.map → p-d85581c6.entry.js.map} +0 -0
- /package/dist/twilight/{p-666189da.system.entry.js.map → p-d8d9cdcd.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-be1034af.system.entry.js.map → p-de891990.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-6c83517d.entry.js.map → p-def552bd.entry.js.map} +0 -0
- /package/dist/twilight/{p-228d58df.system.entry.js.map → p-e4f73083.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-a3ab451d.entry.js.map → p-e5872e75.entry.js.map} +0 -0
- /package/dist/twilight/{p-d0a760cc.entry.js.map → p-ed4c7158.entry.js.map} +0 -0
- /package/dist/twilight/{p-789f0166.system.entry.js.map → p-f1f3d74e.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-ca88566e.entry.js.map → p-f3b8551c.entry.js.map} +0 -0
- /package/dist/twilight/{p-c63ddf33.entry.js.map → p-f41e7eed.entry.js.map} +0 -0
- /package/dist/twilight/{p-6fcc8ed3.entry.js.map → p-f4918259.entry.js.map} +0 -0
- /package/dist/twilight/{p-5b4f648e.entry.js.map → p-f9d8f20d.entry.js.map} +0 -0
- /package/dist/twilight/{p-2c11821b.entry.js.map → p-fb59e3b5.entry.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{L as e}from"./p-
|
|
5
|
-
//# sourceMappingURL=p-
|
|
4
|
+
import{L as e}from"./p-Dj2SrCy0.js";function t(){if(!document.lazyLoadInstance){document.lazyLoadInstance=new e({use_native:true});document.lazyLoadBackgrounds=new e({elements_selector:".lazy[data-bg]:not(.loaded)"})}if(document.readyState!=="complete"){document.addEventListener("DOMContentLoaded",(()=>document.lazyLoadInstance.update()));document.addEventListener("DOMContentLoaded",(()=>document.lazyLoadBackgrounds.update()))}salla.infiniteScroll.event.onAppend((()=>{document.lazyLoadInstance.update();document.lazyLoadBackgrounds.update()}))}const o=t;export{o as g};
|
|
5
|
+
//# sourceMappingURL=p-4drPVtGP.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"p-
|
|
1
|
+
{"version":3,"file":"p-4drPVtGP.js","sources":["src/global/app.ts","@stencil/core/internal/app-globals"],"sourcesContent":["import '@salla.sa/twilight'\nimport LazyLoad from \"vanilla-lazyload\";\n\nexport default function () {\n // Only initialize it one time for the entire application\n if (!document.lazyLoadInstance) {\n document.lazyLoadInstance = new LazyLoad({\n use_native: true,//native not support lazyLoad backgrounds\n // restore_on_error: true,\n // Your custom settings go here\n // callback_finish: () => document.lazyLoadBackgrounds.update(document.querySelectorAll('.lazy[data-bg]:not(.loaded)'))\n });\n document.lazyLoadBackgrounds = new LazyLoad({\n elements_selector: '.lazy[data-bg]:not(.loaded)',\n });\n //native way doesn't load backgrounds\n // document.lazyLoadBackgrounds = new LazyLoad();\n }\n //make sure that lazyLoad will be fired after loading the page too.\n if (document.readyState !== 'complete') {\n document.addEventListener(\"DOMContentLoaded\", () => document.lazyLoadInstance.update());\n document.addEventListener(\"DOMContentLoaded\", () => document.lazyLoadBackgrounds.update());\n }\n\n // fire it after each load more request;\n // @ts-ignore\n salla.infiniteScroll.event.onAppend(() => {\n document.lazyLoadInstance.update();\n document.lazyLoadBackgrounds.update();\n }\n );\n}\n","import appGlobalScript from '/home/runner/work/twilight/twilight/packages/twilight-components/src/global/app.ts';\nexport const globalScripts = appGlobalScript;\nexport const globalStyles = \"\";\n"],"names":[],"mappings":";;;;;AAGc,wBAAA,IAAA;;AAEZ,IAAA,IAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAE;AAC9B,QAAA,QAAQ,CAAC,gBAAgB,GAAG,IAAI,QAAQ,CAAC;YACvC,UAAU,EAAE,IAAI;;;;AAIjB,SAAA,CAAC;AACF,QAAA,QAAQ,CAAC,mBAAmB,GAAG,IAAI,QAAQ,CAAC;AACxC,YAAA,iBAAiB,EAAE,6BAA6B;AACnD,SAAA,CAAC;;;;;AAKJ,IAAA,IAAI,QAAQ,CAAC,UAAU,KAAK,UAAU,EAAE;AACtC,QAAA,QAAQ,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,MAAM,QAAQ,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC;AACvF,QAAA,QAAQ,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,MAAM,QAAQ,CAAC,mBAAmB,CAAC,MAAM,EAAE,CAAC;;;;IAK5F,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAK;AAC/B,QAAA,QAAQ,CAAC,gBAAgB,CAAC,MAAM,EAAE;AAClC,QAAA,QAAQ,CAAC,mBAAmB,CAAC,MAAM,EAAE;AACzC,KAAC,CACJ;AACL;;AC9BY,MAAC,aAAa,GAAG;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as e,g as t}from"./p-L1Wml9tS.js";var i;(function(s){s["ProductDetail"]="product.single";s["Cart"]="cart"})(i||(i={}));var r;(function(s){s["Conditional"]="conditional";s["PercentageOrFixed"]="fixed";s["DiscountsTable"]="discounts_table";s["Bank"]="bank";s["BuyXGetY"]="buy_x_get_y";s["SpecialPrice"]="special_price"})(r||(r={}));const a='.s-offer-wrapper .s-slider-block__title h2{font-size:1.125rem;line-height:1.75rem;color:#f87171}.s-offer-wrapper .s-slider-block__title h2::before{font-family:"sallaicons";content:"\\ee30" !important;position:absolute;top:1rem;font-size:3rem;font-weight:400;line-height:1;color:#fef2f2}.s-offer-bank-wrapper-sinlge-item{display:-ms-flexbox;display:flex;-ms-flex-align:center !important;align-items:center !important;gap:14px}.s-offer-bank-wrapper{display:-ms-flexbox !important;display:flex !important;width:100% !important}';const o=class{constructor(e){s(this,e);var t;this.productCardComponent="custom-salla-product-card";this.offersList=[];this.isMultipleBank=false;this.isBankOffer=false;this.canRender=false;this.showOffer=salla.config.get("store.settings.product.show_special_offers");this.offer_with_price_text=salla.lang.get("pages.offer.with_price",{price:""});this.with_discount_text=salla.lang.get("pages.products.with_a_discount");this.product_discount_text=salla.lang.get("pages.products.discount");this.special_offer_text=salla.lang.get("pages.products.special_offer");this.multipleBankOfferTitleText=salla.lang.get("pages.offer.multiple_bank_offers_title");this.multipleBankOfferTitleDescription=salla.lang.get("pages.offer.multiple_bank_offers_message");this.buy_quantity_text=s=>salla.lang.get("pages.offer.buy_quantity",{quantity:s});salla.lang.onLoaded((()=>{this.offer_with_price_text=salla.lang.get("pages.offer.with_price");this.with_discount_text=salla.lang.get("pages.products.with_a_discount");this.product_discount_text=salla.lang.get("pages.products.discount");this.special_offer_text=salla.lang.get("pages.products.special_offer");this.multipleBankOfferTitleText=salla.lang.get("pages.offer.multiple_bank_offers_title");this.multipleBankOfferTitleDescription=salla.lang.get("pages.offer.multiple_bank_offers_message");this.buy_quantity_text(0)}));salla.onReady((()=>{this.currentPage=salla.config.get("page.slug");this.userCurrency=salla.config.get("currencies")[salla.config.get("user.currency_code")].symbol}));this.categorySlot=((t=this.host.querySelector('[slot="category"]'))===null||t===void 0?void 0:t.innerHTML)||'<a href={url} class="s-offer-slide-cat-entry"><i class={icon}></i><h4>{name}</h4></a>'}async getEndpointByPageName(){if(this.currentPage==i.Cart){const s=await Salla.cart.getCurrentCartId();return`offers/cart/${s}`}if(this.currentPage==i.ProductDetail){return`offers/product/${salla.config.get("page.id")}`}return"offers"}emitPromotionViewed(){if(!(this.offersList.length&&this.canRender&&this.showOffer))return;const s={id:this.offersList[0].id,name:this.offersList[0].title,creative:this.offersList[0].description||"",position:1};salla.event.emit("promotion::viewed",[s])}emitPromotionClicked(s=1){if(!(this.offersList.length&&this.canRender&&this.showOffer))return;const e={id:this.offersList[0].id,name:this.offersList[0].title,creative:this.offersList[0].description||"",position:s};salla.event.emit("promotion::clicked",[e])}componentWillLoad(){this.hasCustomComponent=!!customElements.get(this.productCardComponent);return new Promise((s=>salla.onReady(s))).then((()=>{this.showOffer=!salla.url.is_page("product.single")||salla.config.get("store.settings.product.show_special_offers");if(this.showOffer){return}throw new Error("Merchant disabled showing the offers on product page")})).then((async()=>salla.api.request(await this.getEndpointByPageName()))).then((s=>{if(!(this.offersList=s.data).length){throw new Error("salla-offers:: There is no offers!")}const e=this.offersList.find((s=>[r.SpecialPrice,r.Bank,r.BuyXGetY,r.DiscountsTable].includes(s.type)));if(!e){throw new Error("salla-offers:: Offer type not supported yet!")}if(e.type===r.DiscountsTable){return this.offersList=[e]}if(this.isBankOffer=e.type===r.Bank){this.offersList=this.offersList.filter((s=>s.type===r.Bank));this.isMultipleBank=this.offersList.length>1;return this.offersList}if(e.type===r.SpecialPrice){const s=e.details;return s.apply_to==="product"?salla.product.api.fetch({source:"selected",source_value:s.targets}).then((s=>{e.details.products=s.data;return this.offersList=[e]})):salla.product.api.categories().then((t=>{const i=this.findCategories(t.data,s.targets);e.details.categories=i;return this.offersList=[e]}))}const t=e.details.get;return t.source==="products"?salla.product.api.fetch({source:"selected",source_value:t.source_value}).then((s=>{t.products=s.data;e.details.get=t;return this.offersList=[e]})):salla.product.api.categories().then((s=>{t.categories=this.findCategories(s.data,t.source_value);e.details.get=t;return this.offersList=[e]}))})).then((s=>{salla.storage.set(this.getStorageKey(),{offers:s,stored_at:(new Date).getTime()});this.canRender=true})).catch((s=>{salla.logger.warn(s)}))}componentDidLoad(){let s=this.host.querySelector(".s-slider-block__title-nav");s===null||s===void 0?void 0:s.classList.add("s-offer-bank-payment-nav");this.emitPromotionViewed()}findCategories(s,e){var t;let i=[];for(const r of s){if(e.includes(r.id_||r.id)){i.push(r)}if(((t=r.sub_categories)===null||t===void 0?void 0:t.length)>0){i=i.concat(this.findCategories(r.sub_categories,e))}}return i}getStorageKey(){try{const s=salla.config.get("page.slug").replace(".","_");const e=salla.lang.getLocale();const t=salla.config.currency().code;if(!s||!e||!t){throw new Error("Unable to get the storage key.")}return`s-offers-${s}-${salla.config.get("page.id")}-${e}-${t}`}catch(s){return""}}getOffersFromStorage(){let s=salla.storage.get(this.getStorageKey());if(!s||s.stored_at<(new Date).getTime()-10*60*1e3){salla.storage.remove(this.getStorageKey());return null}this.canRender=true;return Promise.resolve(s.offers)}render(){if(!this.offersList.length||!this.canRender||!this.showOffer)return null;const s=this.offersList[0];const t=this.isBankOffer?this.isMultipleBank?this.multipleBankOfferTitleText:null:s.title;const i=this.isBankOffer?this.isMultipleBank?this.multipleBankOfferTitleDescription:null:s.description;const r={"block-title":t,"block-subTitle":i,"show-controls":this.isMultipleBank};return e("div",{class:"s-offer-wrapper",onClick:()=>this.emitPromotionClicked()},e("p",{class:"s-offer-corner-badge"},this.special_offer_text),e("salla-slider",Object.assign({type:"carousel",id:"offer-slider"},r),e("div",{slot:"items"},this.renderSectionForOfferType(s.type))))}renderSectionForOfferType(s){if(this.isBankOffer){return this.renderBankSection()}if(s==r.SpecialPrice){return this.renderSpecialPriceSection()}if(s==r.BuyXGetY){return this.renderBuyXGetYSection()}return this.renderDiscountTableSection()}getCategoriesSection(s){return e("div",{class:"s-offer-slide-one-sixth swiper-slide",innerHTML:this.categorySlot.replace(/\{url\}/g,s.url).replace(/\{icon\}/g,s.icon||"sicon-store").replace(/\{name\}/g,s.name)})}renderBuyXGetYSection(){var s,t;const i=this.offersList[0].details;return[(s=i.get.products)===null||s===void 0?void 0:s.map((s=>e("div",{class:"s-offer-slide-one-fourth"},this.hasCustomComponent?e(this.productCardComponent,{product:s}):e("salla-product-card",{"shadow-on-hover":true,product:s})))),(t=i.get.categories)===null||t===void 0?void 0:t.map((s=>this.getCategoriesSection(s)))]}renderBankSection(){return this.offersList.map((s=>e("div",{class:{"s-offer-slide-one-sixth":this.isMultipleBank,"s-offer-bank-wrapper-sinlge-item":!this.isMultipleBank}},e("div",{class:{"s-offer-bank-wrapper":true,"s-offer-slide-one-sixth":!this.isMultipleBank,"s-offer-bank-wrapper-multi-spacer":this.isMultipleBank}},e("div",{class:"s-offer-bank-logo"},e("img",{src:s.details.logo||salla.url.cdn("images/s-empty.png"),"data-src":s.details.logo,alt:s.title+" offer"})),e("ul",{class:"s-offer-bank-payment-wrapper"},s.details.payments.map((s=>e("li",{class:"s-offer-bank-payment-single"},e("img",{src:salla.url.cdn("images/payment/"+s+".png")||salla.url.cdn("images/s-empty.png"),"data-src":salla.url.cdn("images/payment/"+s+".png"),alt:"payment"}))))),this.isMultipleBank?e("p",{class:"s-offer-bank-payment-discount-percent"},`${this.product_discount_text} ${s.details.discount_value}${s.details.discount_type==="percentage"&&"%"}`):""),!this.isMultipleBank?e("div",{class:"s-offer-bank-message s-offer-slide-one-fourth"},e("h2",null,this.offersList[0].title),e("p",{innerHTML:this.generateBankDescription(this.offersList[0].description,s.details.discount_value)})):"")))}generateBankDescription(s,e){return s.replace(new RegExp(`${e} %`),`<span class="s-offer-bank-message-amount">${e} %</span>`)}renderDiscountTableSection(){var s;const t=this.offersList[0];let i=t.details.show_price_after_discount;return(s=this.offersList[0].details.discounts)===null||s===void 0?void 0:s.map((s=>e("div",{class:"s-offer-slide-one-fourth"},e("div",{class:"s-offer-slide-offer-entry"},e("div",{class:"s-offer-slide-offer-entry-price-quantity-container"},e("p",{class:"s-offer-slide-offer-entry-quantity"},this.buy_quantity_text(s.quantity)),i?e("div",{class:"s-offer-slide-offer-entry-price"},e("span",null,this.offer_with_price_text),e("span",{class:"s-offer-slide-offer-entry-price-amount"},s.discounted_amount)," ",e("span",null,this.userCurrency)):""),e("p",{class:"s-offer-slide-offer-entry-price-amount-percent"},this.with_discount_text,"(",e("span",null,s.percentage,!!s.percentage&&"%"),")")))))}renderSpecialPriceSection(){var s,t;const i=this.offersList[0].details;return[i.apply_to==="product"&&((s=i.products)===null||s===void 0?void 0:s.map((s=>e("div",{class:"s-offer-slide-one-fourth"},this.hasCustomComponent?e(this.productCardComponent,{product:s}):e("salla-product-card",{"shadow-on-hover":true,product:s}))))),i.apply_to==="category"&&((t=i.categories)===null||t===void 0?void 0:t.map((s=>this.getCategoriesSection(s))))]}get host(){return t(this)}};o.style=a;export{o as salla_offer};
|
|
5
|
-
//# sourceMappingURL=p-
|
|
4
|
+
import{r as s,h as e,g as t}from"./p-Dj2SrCy0.js";var i;(function(s){s["ProductDetail"]="product.single";s["Cart"]="cart"})(i||(i={}));var r;(function(s){s["Conditional"]="conditional";s["PercentageOrFixed"]="fixed";s["DiscountsTable"]="discounts_table";s["Bank"]="bank";s["BuyXGetY"]="buy_x_get_y";s["SpecialPrice"]="special_price"})(r||(r={}));const a='.s-offer-wrapper .s-slider-block__title h2{font-size:1.125rem;line-height:1.75rem;color:#f87171}.s-offer-wrapper .s-slider-block__title h2::before{font-family:"sallaicons";content:"\\ee30" !important;position:absolute;top:1rem;font-size:3rem;font-weight:400;line-height:1;color:#fef2f2}.s-offer-bank-wrapper-sinlge-item{display:-ms-flexbox;display:flex;-ms-flex-align:center !important;align-items:center !important;gap:14px}.s-offer-bank-wrapper{display:-ms-flexbox !important;display:flex !important;width:100% !important}';const o=class{constructor(e){s(this,e);var t;this.productCardComponent="custom-salla-product-card";this.offersList=[];this.isMultipleBank=false;this.isBankOffer=false;this.canRender=false;this.showOffer=salla.config.get("store.settings.product.show_special_offers");this.offer_with_price_text=salla.lang.get("pages.offer.with_price",{price:""});this.with_discount_text=salla.lang.get("pages.products.with_a_discount");this.product_discount_text=salla.lang.get("pages.products.discount");this.special_offer_text=salla.lang.get("pages.products.special_offer");this.multipleBankOfferTitleText=salla.lang.get("pages.offer.multiple_bank_offers_title");this.multipleBankOfferTitleDescription=salla.lang.get("pages.offer.multiple_bank_offers_message");this.buy_quantity_text=s=>salla.lang.get("pages.offer.buy_quantity",{quantity:s});salla.lang.onLoaded((()=>{this.offer_with_price_text=salla.lang.get("pages.offer.with_price");this.with_discount_text=salla.lang.get("pages.products.with_a_discount");this.product_discount_text=salla.lang.get("pages.products.discount");this.special_offer_text=salla.lang.get("pages.products.special_offer");this.multipleBankOfferTitleText=salla.lang.get("pages.offer.multiple_bank_offers_title");this.multipleBankOfferTitleDescription=salla.lang.get("pages.offer.multiple_bank_offers_message");this.buy_quantity_text(0)}));salla.onReady((()=>{this.currentPage=salla.config.get("page.slug");this.userCurrency=salla.config.get("currencies")[salla.config.get("user.currency_code")].symbol}));this.categorySlot=((t=this.host.querySelector('[slot="category"]'))===null||t===void 0?void 0:t.innerHTML)||'<a href={url} class="s-offer-slide-cat-entry"><i class={icon}></i><h4>{name}</h4></a>'}async getEndpointByPageName(){if(this.currentPage==i.Cart){const s=await Salla.cart.getCurrentCartId();return`offers/cart/${s}`}if(this.currentPage==i.ProductDetail){return`offers/product/${salla.config.get("page.id")}`}return"offers"}emitPromotionViewed(){if(!(this.offersList.length&&this.canRender&&this.showOffer))return;const s={id:this.offersList[0].id,name:this.offersList[0].title,creative:this.offersList[0].description||"",position:1};salla.event.emit("promotion::viewed",[s])}emitPromotionClicked(s=1){if(!(this.offersList.length&&this.canRender&&this.showOffer))return;const e={id:this.offersList[0].id,name:this.offersList[0].title,creative:this.offersList[0].description||"",position:s};salla.event.emit("promotion::clicked",[e])}componentWillLoad(){this.hasCustomComponent=!!customElements.get(this.productCardComponent);return new Promise((s=>salla.onReady(s))).then((()=>{this.showOffer=!salla.url.is_page("product.single")||salla.config.get("store.settings.product.show_special_offers");if(this.showOffer){return}throw new Error("Merchant disabled showing the offers on product page")})).then((async()=>salla.api.request(await this.getEndpointByPageName()))).then((s=>{if(!(this.offersList=s.data).length){throw new Error("salla-offers:: There is no offers!")}const e=this.offersList.find((s=>[r.SpecialPrice,r.Bank,r.BuyXGetY,r.DiscountsTable].includes(s.type)));if(!e){throw new Error("salla-offers:: Offer type not supported yet!")}if(e.type===r.DiscountsTable){return this.offersList=[e]}if(this.isBankOffer=e.type===r.Bank){this.offersList=this.offersList.filter((s=>s.type===r.Bank));this.isMultipleBank=this.offersList.length>1;return this.offersList}if(e.type===r.SpecialPrice){const s=e.details;return s.apply_to==="product"?salla.product.api.fetch({source:"selected",source_value:s.targets}).then((s=>{e.details.products=s.data;return this.offersList=[e]})):salla.product.api.categories().then((t=>{const i=this.findCategories(t.data,s.targets);e.details.categories=i;return this.offersList=[e]}))}const t=e.details.get;return t.source==="products"?salla.product.api.fetch({source:"selected",source_value:t.source_value}).then((s=>{t.products=s.data;e.details.get=t;return this.offersList=[e]})):salla.product.api.categories().then((s=>{t.categories=this.findCategories(s.data,t.source_value);e.details.get=t;return this.offersList=[e]}))})).then((s=>{salla.storage.set(this.getStorageKey(),{offers:s,stored_at:(new Date).getTime()});this.canRender=true})).catch((s=>{salla.logger.warn(s)}))}componentDidLoad(){let s=this.host.querySelector(".s-slider-block__title-nav");s===null||s===void 0?void 0:s.classList.add("s-offer-bank-payment-nav");this.emitPromotionViewed()}findCategories(s,e){var t;let i=[];for(const r of s){if(e.includes(r.id_||r.id)){i.push(r)}if(((t=r.sub_categories)===null||t===void 0?void 0:t.length)>0){i=i.concat(this.findCategories(r.sub_categories,e))}}return i}getStorageKey(){try{const s=salla.config.get("page.slug").replace(".","_");const e=salla.lang.getLocale();const t=salla.config.currency().code;if(!s||!e||!t){throw new Error("Unable to get the storage key.")}return`s-offers-${s}-${salla.config.get("page.id")}-${e}-${t}`}catch(s){return""}}getOffersFromStorage(){let s=salla.storage.get(this.getStorageKey());if(!s||s.stored_at<(new Date).getTime()-10*60*1e3){salla.storage.remove(this.getStorageKey());return null}this.canRender=true;return Promise.resolve(s.offers)}render(){if(!this.offersList.length||!this.canRender||!this.showOffer)return null;const s=this.offersList[0];const t=this.isBankOffer?this.isMultipleBank?this.multipleBankOfferTitleText:null:s.title;const i=this.isBankOffer?this.isMultipleBank?this.multipleBankOfferTitleDescription:null:s.description;const r={"block-title":t,"block-subTitle":i,"show-controls":this.isMultipleBank};return e("div",{class:"s-offer-wrapper",onClick:()=>this.emitPromotionClicked()},e("p",{class:"s-offer-corner-badge"},this.special_offer_text),e("salla-slider",Object.assign({type:"carousel",id:"offer-slider"},r),e("div",{slot:"items"},this.renderSectionForOfferType(s.type))))}renderSectionForOfferType(s){if(this.isBankOffer){return this.renderBankSection()}if(s==r.SpecialPrice){return this.renderSpecialPriceSection()}if(s==r.BuyXGetY){return this.renderBuyXGetYSection()}return this.renderDiscountTableSection()}getCategoriesSection(s){return e("div",{class:"s-offer-slide-one-sixth swiper-slide",innerHTML:this.categorySlot.replace(/\{url\}/g,s.url).replace(/\{icon\}/g,s.icon||"sicon-store").replace(/\{name\}/g,s.name)})}renderBuyXGetYSection(){var s,t;const i=this.offersList[0].details;return[(s=i.get.products)===null||s===void 0?void 0:s.map((s=>e("div",{class:"s-offer-slide-one-fourth"},this.hasCustomComponent?e(this.productCardComponent,{product:s}):e("salla-product-card",{"shadow-on-hover":true,product:s})))),(t=i.get.categories)===null||t===void 0?void 0:t.map((s=>this.getCategoriesSection(s)))]}renderBankSection(){return this.offersList.map((s=>e("div",{class:{"s-offer-slide-one-sixth":this.isMultipleBank,"s-offer-bank-wrapper-sinlge-item":!this.isMultipleBank}},e("div",{class:{"s-offer-bank-wrapper":true,"s-offer-slide-one-sixth":!this.isMultipleBank,"s-offer-bank-wrapper-multi-spacer":this.isMultipleBank}},e("div",{class:"s-offer-bank-logo"},e("img",{src:s.details.logo||salla.url.cdn("images/s-empty.png"),"data-src":s.details.logo,alt:s.title+" offer"})),e("ul",{class:"s-offer-bank-payment-wrapper"},s.details.payments.map((s=>e("li",{class:"s-offer-bank-payment-single"},e("img",{src:salla.url.cdn("images/payment/"+s+".png")||salla.url.cdn("images/s-empty.png"),"data-src":salla.url.cdn("images/payment/"+s+".png"),alt:"payment"}))))),this.isMultipleBank?e("p",{class:"s-offer-bank-payment-discount-percent"},`${this.product_discount_text} ${s.details.discount_value}${s.details.discount_type==="percentage"&&"%"}`):""),!this.isMultipleBank?e("div",{class:"s-offer-bank-message s-offer-slide-one-fourth"},e("h2",null,this.offersList[0].title),e("p",{innerHTML:this.generateBankDescription(this.offersList[0].description,s.details.discount_value)})):"")))}generateBankDescription(s,e){return s.replace(new RegExp(`${e} %`),`<span class="s-offer-bank-message-amount">${e} %</span>`)}renderDiscountTableSection(){var s;const t=this.offersList[0];let i=t.details.show_price_after_discount;return(s=this.offersList[0].details.discounts)===null||s===void 0?void 0:s.map((s=>e("div",{class:"s-offer-slide-one-fourth"},e("div",{class:"s-offer-slide-offer-entry"},e("div",{class:"s-offer-slide-offer-entry-price-quantity-container"},e("p",{class:"s-offer-slide-offer-entry-quantity"},this.buy_quantity_text(s.quantity)),i?e("div",{class:"s-offer-slide-offer-entry-price"},e("span",null,this.offer_with_price_text),e("span",{class:"s-offer-slide-offer-entry-price-amount"},s.discounted_amount)," ",e("span",null,this.userCurrency)):""),e("p",{class:"s-offer-slide-offer-entry-price-amount-percent"},this.with_discount_text,"(",e("span",null,s.percentage,!!s.percentage&&"%"),")")))))}renderSpecialPriceSection(){var s,t;const i=this.offersList[0].details;return[i.apply_to==="product"&&((s=i.products)===null||s===void 0?void 0:s.map((s=>e("div",{class:"s-offer-slide-one-fourth"},this.hasCustomComponent?e(this.productCardComponent,{product:s}):e("salla-product-card",{"shadow-on-hover":true,product:s}))))),i.apply_to==="category"&&((t=i.categories)===null||t===void 0?void 0:t.map((s=>this.getCategoriesSection(s))))]}get host(){return t(this)}};o.style=a;export{o as salla_offer};
|
|
5
|
+
//# sourceMappingURL=p-5394cdeb.entry.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var __awaiter=this&&this.__awaiter||function(e,t,r,s){function n(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,i){function a(e){try{l(s.next(e))}catch(e){i(e)}}function o(e){try{l(s["throw"](e))}catch(e){i(e)}}function l(e){e.done?r(e.value):n(e.value).then(a,o)}l((s=s.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},s,n,i,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(e){return function(t){return l([e,t])}}function l(o){if(s)throw new TypeError("Generator is already executing.");while(a&&(a=0,o[0]&&(r=0)),r)try{if(s=1,n&&(i=o[0]&2?n["return"]:o[0]?n["throw"]||((i=n["return"])&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;if(n=0,i)o=[o[0]&2,i.value];switch(o[0]){case 0:case 1:i=o;break;case 4:r.label++;return{value:o[1],done:false};case 5:r.label++;n=o[1];o=[0];continue;case 7:o=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(o[0]===6||o[0]===2)){r=0;continue}if(o[0]===3&&(!i||o[1]>i[0]&&o[1]<i[3])){r.label=o[1];break}if(o[0]===6&&r.label<i[1]){r.label=i[1];i=o;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(o);break}if(i[2])r.ops.pop();r.trys.pop();continue}o=t.call(e,r)}catch(e){o=[6,e];n=0}finally{s=i=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}};
|
|
2
2
|
/*!
|
|
3
3
|
* Crafted with ❤ by Salla
|
|
4
|
-
*/System.register(["./p-DuTXkmaO.system.js"],(function(e){"use strict";var t,r,s;return{setters:[function(e){t=e.r;r=e.h;s=e.g}],execute:function(){var n;(function(e){e["ProductDetail"]="product.single";e["Cart"]="cart"})(n||(n={}));var i;(function(e){e["Conditional"]="conditional";e["PercentageOrFixed"]="fixed";e["DiscountsTable"]="discounts_table";e["Bank"]="bank";e["BuyXGetY"]="buy_x_get_y";e["SpecialPrice"]="special_price"})(i||(i={}));var a='.s-offer-wrapper .s-slider-block__title h2{font-size:1.125rem;line-height:1.75rem;color:#f87171}.s-offer-wrapper .s-slider-block__title h2::before{font-family:"sallaicons";content:"\\ee30" !important;position:absolute;top:1rem;font-size:3rem;font-weight:400;line-height:1;color:#fef2f2}.s-offer-bank-wrapper-sinlge-item{display:-ms-flexbox;display:flex;-ms-flex-align:center !important;align-items:center !important;gap:14px}.s-offer-bank-wrapper{display:-ms-flexbox !important;display:flex !important;width:100% !important}';var o=e("salla_offer",function(){function e(e){var r=this;t(this,e);var s;this.productCardComponent="custom-salla-product-card";this.offersList=[];this.isMultipleBank=false;this.isBankOffer=false;this.canRender=false;this.showOffer=salla.config.get("store.settings.product.show_special_offers");this.offer_with_price_text=salla.lang.get("pages.offer.with_price",{price:""});this.with_discount_text=salla.lang.get("pages.products.with_a_discount");this.product_discount_text=salla.lang.get("pages.products.discount");this.special_offer_text=salla.lang.get("pages.products.special_offer");this.multipleBankOfferTitleText=salla.lang.get("pages.offer.multiple_bank_offers_title");this.multipleBankOfferTitleDescription=salla.lang.get("pages.offer.multiple_bank_offers_message");this.buy_quantity_text=function(e){return salla.lang.get("pages.offer.buy_quantity",{quantity:e})};salla.lang.onLoaded((function(){r.offer_with_price_text=salla.lang.get("pages.offer.with_price");r.with_discount_text=salla.lang.get("pages.products.with_a_discount");r.product_discount_text=salla.lang.get("pages.products.discount");r.special_offer_text=salla.lang.get("pages.products.special_offer");r.multipleBankOfferTitleText=salla.lang.get("pages.offer.multiple_bank_offers_title");r.multipleBankOfferTitleDescription=salla.lang.get("pages.offer.multiple_bank_offers_message");r.buy_quantity_text(0)}));salla.onReady((function(){r.currentPage=salla.config.get("page.slug");r.userCurrency=salla.config.get("currencies")[salla.config.get("user.currency_code")].symbol}));this.categorySlot=((s=this.host.querySelector('[slot="category"]'))===null||s===void 0?void 0:s.innerHTML)||'<a href={url} class="s-offer-slide-cat-entry"><i class={icon}></i><h4>{name}</h4></a>'}e.prototype.getEndpointByPageName=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:if(!(this.currentPage==n.Cart))return[3,2];return[4,Salla.cart.getCurrentCartId()];case 1:e=t.sent();return[2,"offers/cart/".concat(e)];case 2:if(this.currentPage==n.ProductDetail){return[2,"offers/product/".concat(salla.config.get("page.id"))]}return[2,"offers"]}}))}))};e.prototype.emitPromotionViewed=function(){if(!(this.offersList.length&&this.canRender&&this.showOffer))return;var e={id:this.offersList[0].id,name:this.offersList[0].title,creative:this.offersList[0].description||"",position:1};salla.event.emit("promotion::viewed",[e])};e.prototype.emitPromotionClicked=function(e){if(e===void 0){e=1}if(!(this.offersList.length&&this.canRender&&this.showOffer))return;var t={id:this.offersList[0].id,name:this.offersList[0].title,creative:this.offersList[0].description||"",position:e};salla.event.emit("promotion::clicked",[t])};e.prototype.componentWillLoad=function(){var e=this;this.hasCustomComponent=!!customElements.get(this.productCardComponent);return new Promise((function(e){return salla.onReady(e)})).then((function(){e.showOffer=!salla.url.is_page("product.single")||salla.config.get("store.settings.product.show_special_offers");if(e.showOffer){return}throw new Error("Merchant disabled showing the offers on product page")})).then((function(){return __awaiter(e,void 0,void 0,(function(){var e,t;return __generator(this,(function(r){switch(r.label){case 0:t=(e=salla.api).request;return[4,this.getEndpointByPageName()];case 1:return[2,t.apply(e,[r.sent()])]}}))}))})).then((function(t){if(!(e.offersList=t.data).length){throw new Error("salla-offers:: There is no offers!")}var r=e.offersList.find((function(e){return[i.SpecialPrice,i.Bank,i.BuyXGetY,i.DiscountsTable].includes(e.type)}));if(!r){throw new Error("salla-offers:: Offer type not supported yet!")}if(r.type===i.DiscountsTable){return e.offersList=[r]}if(e.isBankOffer=r.type===i.Bank){e.offersList=e.offersList.filter((function(e){return e.type===i.Bank}));e.isMultipleBank=e.offersList.length>1;return e.offersList}if(r.type===i.SpecialPrice){var s=r.details;return s.apply_to==="product"?salla.product.api.fetch({source:"selected",source_value:s.targets}).then((function(t){r.details.products=t.data;return e.offersList=[r]})):salla.product.api.categories().then((function(t){var n=e.findCategories(t.data,s.targets);r.details.categories=n;return e.offersList=[r]}))}var n=r.details.get;return n.source==="products"?salla.product.api.fetch({source:"selected",source_value:n.source_value}).then((function(t){n.products=t.data;r.details.get=n;return e.offersList=[r]})):salla.product.api.categories().then((function(t){n.categories=e.findCategories(t.data,n.source_value);r.details.get=n;return e.offersList=[r]}))})).then((function(t){salla.storage.set(e.getStorageKey(),{offers:t,stored_at:(new Date).getTime()});e.canRender=true})).catch((function(e){salla.logger.warn(e)}))};e.prototype.componentDidLoad=function(){var e=this.host.querySelector(".s-slider-block__title-nav");e===null||e===void 0?void 0:e.classList.add("s-offer-bank-payment-nav");this.emitPromotionViewed()};e.prototype.findCategories=function(e,t){var r;var s=[];for(var n=0,i=e;n<i.length;n++){var a=i[n];if(t.includes(a.id_||a.id)){s.push(a)}if(((r=a.sub_categories)===null||r===void 0?void 0:r.length)>0){s=s.concat(this.findCategories(a.sub_categories,t))}}return s};e.prototype.getStorageKey=function(){try{var e=salla.config.get("page.slug").replace(".","_");var t=salla.lang.getLocale();var r=salla.config.currency().code;if(!e||!t||!r){throw new Error("Unable to get the storage key.")}return"s-offers-".concat(e,"-").concat(salla.config.get("page.id"),"-").concat(t,"-").concat(r)}catch(e){return""}};e.prototype.getOffersFromStorage=function(){var e=salla.storage.get(this.getStorageKey());if(!e||e.stored_at<(new Date).getTime()-10*60*1e3){salla.storage.remove(this.getStorageKey());return null}this.canRender=true;return Promise.resolve(e.offers)};e.prototype.render=function(){var e=this;if(!this.offersList.length||!this.canRender||!this.showOffer)return null;var t=this.offersList[0];var s=this.isBankOffer?this.isMultipleBank?this.multipleBankOfferTitleText:null:t.title;var n=this.isBankOffer?this.isMultipleBank?this.multipleBankOfferTitleDescription:null:t.description;var i={"block-title":s,"block-subTitle":n,"show-controls":this.isMultipleBank};return r("div",{class:"s-offer-wrapper",onClick:function(){return e.emitPromotionClicked()}},r("p",{class:"s-offer-corner-badge"},this.special_offer_text),r("salla-slider",Object.assign({type:"carousel",id:"offer-slider"},i),r("div",{slot:"items"},this.renderSectionForOfferType(t.type))))};e.prototype.renderSectionForOfferType=function(e){if(this.isBankOffer){return this.renderBankSection()}if(e==i.SpecialPrice){return this.renderSpecialPriceSection()}if(e==i.BuyXGetY){return this.renderBuyXGetYSection()}return this.renderDiscountTableSection()};e.prototype.getCategoriesSection=function(e){return r("div",{class:"s-offer-slide-one-sixth swiper-slide",innerHTML:this.categorySlot.replace(/\{url\}/g,e.url).replace(/\{icon\}/g,e.icon||"sicon-store").replace(/\{name\}/g,e.name)})};e.prototype.renderBuyXGetYSection=function(){var e=this;var t,s;var n=this.offersList[0].details;return[(t=n.get.products)===null||t===void 0?void 0:t.map((function(t){return r("div",{class:"s-offer-slide-one-fourth"},e.hasCustomComponent?r(e.productCardComponent,{product:t}):r("salla-product-card",{"shadow-on-hover":true,product:t}))})),(s=n.get.categories)===null||s===void 0?void 0:s.map((function(t){return e.getCategoriesSection(t)}))]};e.prototype.renderBankSection=function(){var e=this;return this.offersList.map((function(t){return r("div",{class:{"s-offer-slide-one-sixth":e.isMultipleBank,"s-offer-bank-wrapper-sinlge-item":!e.isMultipleBank}},r("div",{class:{"s-offer-bank-wrapper":true,"s-offer-slide-one-sixth":!e.isMultipleBank,"s-offer-bank-wrapper-multi-spacer":e.isMultipleBank}},r("div",{class:"s-offer-bank-logo"},r("img",{src:t.details.logo||salla.url.cdn("images/s-empty.png"),"data-src":t.details.logo,alt:t.title+" offer"})),r("ul",{class:"s-offer-bank-payment-wrapper"},t.details.payments.map((function(e){return r("li",{class:"s-offer-bank-payment-single"},r("img",{src:salla.url.cdn("images/payment/"+e+".png")||salla.url.cdn("images/s-empty.png"),"data-src":salla.url.cdn("images/payment/"+e+".png"),alt:"payment"}))}))),e.isMultipleBank?r("p",{class:"s-offer-bank-payment-discount-percent"},"".concat(e.product_discount_text," ").concat(t.details.discount_value).concat(t.details.discount_type==="percentage"&&"%")):""),!e.isMultipleBank?r("div",{class:"s-offer-bank-message s-offer-slide-one-fourth"},r("h2",null,e.offersList[0].title),r("p",{innerHTML:e.generateBankDescription(e.offersList[0].description,t.details.discount_value)})):"")}))};e.prototype.generateBankDescription=function(e,t){return e.replace(new RegExp("".concat(t," %")),'<span class="s-offer-bank-message-amount">'.concat(t," %</span>"))};e.prototype.renderDiscountTableSection=function(){var e=this;var t;var s=this.offersList[0];var n=s.details.show_price_after_discount;return(t=this.offersList[0].details.discounts)===null||t===void 0?void 0:t.map((function(t){return r("div",{class:"s-offer-slide-one-fourth"},r("div",{class:"s-offer-slide-offer-entry"},r("div",{class:"s-offer-slide-offer-entry-price-quantity-container"},r("p",{class:"s-offer-slide-offer-entry-quantity"},e.buy_quantity_text(t.quantity)),n?r("div",{class:"s-offer-slide-offer-entry-price"},r("span",null,e.offer_with_price_text),r("span",{class:"s-offer-slide-offer-entry-price-amount"},t.discounted_amount)," ",r("span",null,e.userCurrency)):""),r("p",{class:"s-offer-slide-offer-entry-price-amount-percent"},e.with_discount_text,"(",r("span",null,t.percentage,!!t.percentage&&"%"),")")))}))};e.prototype.renderSpecialPriceSection=function(){var e=this;var t,s;var n=this.offersList[0].details;return[n.apply_to==="product"&&((t=n.products)===null||t===void 0?void 0:t.map((function(t){return r("div",{class:"s-offer-slide-one-fourth"},e.hasCustomComponent?r(e.productCardComponent,{product:t}):r("salla-product-card",{"shadow-on-hover":true,product:t}))}))),n.apply_to==="category"&&((s=n.categories)===null||s===void 0?void 0:s.map((function(t){return e.getCategoriesSection(t)})))]};Object.defineProperty(e.prototype,"host",{get:function(){return s(this)},enumerable:false,configurable:true});return e}());o.style=a}}}));
|
|
5
|
-
//# sourceMappingURL=p-
|
|
4
|
+
*/System.register(["./p-DvJ_tnSw.system.js"],(function(e){"use strict";var t,r,s;return{setters:[function(e){t=e.r;r=e.h;s=e.g}],execute:function(){var n;(function(e){e["ProductDetail"]="product.single";e["Cart"]="cart"})(n||(n={}));var i;(function(e){e["Conditional"]="conditional";e["PercentageOrFixed"]="fixed";e["DiscountsTable"]="discounts_table";e["Bank"]="bank";e["BuyXGetY"]="buy_x_get_y";e["SpecialPrice"]="special_price"})(i||(i={}));var a='.s-offer-wrapper .s-slider-block__title h2{font-size:1.125rem;line-height:1.75rem;color:#f87171}.s-offer-wrapper .s-slider-block__title h2::before{font-family:"sallaicons";content:"\\ee30" !important;position:absolute;top:1rem;font-size:3rem;font-weight:400;line-height:1;color:#fef2f2}.s-offer-bank-wrapper-sinlge-item{display:-ms-flexbox;display:flex;-ms-flex-align:center !important;align-items:center !important;gap:14px}.s-offer-bank-wrapper{display:-ms-flexbox !important;display:flex !important;width:100% !important}';var o=e("salla_offer",function(){function e(e){var r=this;t(this,e);var s;this.productCardComponent="custom-salla-product-card";this.offersList=[];this.isMultipleBank=false;this.isBankOffer=false;this.canRender=false;this.showOffer=salla.config.get("store.settings.product.show_special_offers");this.offer_with_price_text=salla.lang.get("pages.offer.with_price",{price:""});this.with_discount_text=salla.lang.get("pages.products.with_a_discount");this.product_discount_text=salla.lang.get("pages.products.discount");this.special_offer_text=salla.lang.get("pages.products.special_offer");this.multipleBankOfferTitleText=salla.lang.get("pages.offer.multiple_bank_offers_title");this.multipleBankOfferTitleDescription=salla.lang.get("pages.offer.multiple_bank_offers_message");this.buy_quantity_text=function(e){return salla.lang.get("pages.offer.buy_quantity",{quantity:e})};salla.lang.onLoaded((function(){r.offer_with_price_text=salla.lang.get("pages.offer.with_price");r.with_discount_text=salla.lang.get("pages.products.with_a_discount");r.product_discount_text=salla.lang.get("pages.products.discount");r.special_offer_text=salla.lang.get("pages.products.special_offer");r.multipleBankOfferTitleText=salla.lang.get("pages.offer.multiple_bank_offers_title");r.multipleBankOfferTitleDescription=salla.lang.get("pages.offer.multiple_bank_offers_message");r.buy_quantity_text(0)}));salla.onReady((function(){r.currentPage=salla.config.get("page.slug");r.userCurrency=salla.config.get("currencies")[salla.config.get("user.currency_code")].symbol}));this.categorySlot=((s=this.host.querySelector('[slot="category"]'))===null||s===void 0?void 0:s.innerHTML)||'<a href={url} class="s-offer-slide-cat-entry"><i class={icon}></i><h4>{name}</h4></a>'}e.prototype.getEndpointByPageName=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:if(!(this.currentPage==n.Cart))return[3,2];return[4,Salla.cart.getCurrentCartId()];case 1:e=t.sent();return[2,"offers/cart/".concat(e)];case 2:if(this.currentPage==n.ProductDetail){return[2,"offers/product/".concat(salla.config.get("page.id"))]}return[2,"offers"]}}))}))};e.prototype.emitPromotionViewed=function(){if(!(this.offersList.length&&this.canRender&&this.showOffer))return;var e={id:this.offersList[0].id,name:this.offersList[0].title,creative:this.offersList[0].description||"",position:1};salla.event.emit("promotion::viewed",[e])};e.prototype.emitPromotionClicked=function(e){if(e===void 0){e=1}if(!(this.offersList.length&&this.canRender&&this.showOffer))return;var t={id:this.offersList[0].id,name:this.offersList[0].title,creative:this.offersList[0].description||"",position:e};salla.event.emit("promotion::clicked",[t])};e.prototype.componentWillLoad=function(){var e=this;this.hasCustomComponent=!!customElements.get(this.productCardComponent);return new Promise((function(e){return salla.onReady(e)})).then((function(){e.showOffer=!salla.url.is_page("product.single")||salla.config.get("store.settings.product.show_special_offers");if(e.showOffer){return}throw new Error("Merchant disabled showing the offers on product page")})).then((function(){return __awaiter(e,void 0,void 0,(function(){var e,t;return __generator(this,(function(r){switch(r.label){case 0:t=(e=salla.api).request;return[4,this.getEndpointByPageName()];case 1:return[2,t.apply(e,[r.sent()])]}}))}))})).then((function(t){if(!(e.offersList=t.data).length){throw new Error("salla-offers:: There is no offers!")}var r=e.offersList.find((function(e){return[i.SpecialPrice,i.Bank,i.BuyXGetY,i.DiscountsTable].includes(e.type)}));if(!r){throw new Error("salla-offers:: Offer type not supported yet!")}if(r.type===i.DiscountsTable){return e.offersList=[r]}if(e.isBankOffer=r.type===i.Bank){e.offersList=e.offersList.filter((function(e){return e.type===i.Bank}));e.isMultipleBank=e.offersList.length>1;return e.offersList}if(r.type===i.SpecialPrice){var s=r.details;return s.apply_to==="product"?salla.product.api.fetch({source:"selected",source_value:s.targets}).then((function(t){r.details.products=t.data;return e.offersList=[r]})):salla.product.api.categories().then((function(t){var n=e.findCategories(t.data,s.targets);r.details.categories=n;return e.offersList=[r]}))}var n=r.details.get;return n.source==="products"?salla.product.api.fetch({source:"selected",source_value:n.source_value}).then((function(t){n.products=t.data;r.details.get=n;return e.offersList=[r]})):salla.product.api.categories().then((function(t){n.categories=e.findCategories(t.data,n.source_value);r.details.get=n;return e.offersList=[r]}))})).then((function(t){salla.storage.set(e.getStorageKey(),{offers:t,stored_at:(new Date).getTime()});e.canRender=true})).catch((function(e){salla.logger.warn(e)}))};e.prototype.componentDidLoad=function(){var e=this.host.querySelector(".s-slider-block__title-nav");e===null||e===void 0?void 0:e.classList.add("s-offer-bank-payment-nav");this.emitPromotionViewed()};e.prototype.findCategories=function(e,t){var r;var s=[];for(var n=0,i=e;n<i.length;n++){var a=i[n];if(t.includes(a.id_||a.id)){s.push(a)}if(((r=a.sub_categories)===null||r===void 0?void 0:r.length)>0){s=s.concat(this.findCategories(a.sub_categories,t))}}return s};e.prototype.getStorageKey=function(){try{var e=salla.config.get("page.slug").replace(".","_");var t=salla.lang.getLocale();var r=salla.config.currency().code;if(!e||!t||!r){throw new Error("Unable to get the storage key.")}return"s-offers-".concat(e,"-").concat(salla.config.get("page.id"),"-").concat(t,"-").concat(r)}catch(e){return""}};e.prototype.getOffersFromStorage=function(){var e=salla.storage.get(this.getStorageKey());if(!e||e.stored_at<(new Date).getTime()-10*60*1e3){salla.storage.remove(this.getStorageKey());return null}this.canRender=true;return Promise.resolve(e.offers)};e.prototype.render=function(){var e=this;if(!this.offersList.length||!this.canRender||!this.showOffer)return null;var t=this.offersList[0];var s=this.isBankOffer?this.isMultipleBank?this.multipleBankOfferTitleText:null:t.title;var n=this.isBankOffer?this.isMultipleBank?this.multipleBankOfferTitleDescription:null:t.description;var i={"block-title":s,"block-subTitle":n,"show-controls":this.isMultipleBank};return r("div",{class:"s-offer-wrapper",onClick:function(){return e.emitPromotionClicked()}},r("p",{class:"s-offer-corner-badge"},this.special_offer_text),r("salla-slider",Object.assign({type:"carousel",id:"offer-slider"},i),r("div",{slot:"items"},this.renderSectionForOfferType(t.type))))};e.prototype.renderSectionForOfferType=function(e){if(this.isBankOffer){return this.renderBankSection()}if(e==i.SpecialPrice){return this.renderSpecialPriceSection()}if(e==i.BuyXGetY){return this.renderBuyXGetYSection()}return this.renderDiscountTableSection()};e.prototype.getCategoriesSection=function(e){return r("div",{class:"s-offer-slide-one-sixth swiper-slide",innerHTML:this.categorySlot.replace(/\{url\}/g,e.url).replace(/\{icon\}/g,e.icon||"sicon-store").replace(/\{name\}/g,e.name)})};e.prototype.renderBuyXGetYSection=function(){var e=this;var t,s;var n=this.offersList[0].details;return[(t=n.get.products)===null||t===void 0?void 0:t.map((function(t){return r("div",{class:"s-offer-slide-one-fourth"},e.hasCustomComponent?r(e.productCardComponent,{product:t}):r("salla-product-card",{"shadow-on-hover":true,product:t}))})),(s=n.get.categories)===null||s===void 0?void 0:s.map((function(t){return e.getCategoriesSection(t)}))]};e.prototype.renderBankSection=function(){var e=this;return this.offersList.map((function(t){return r("div",{class:{"s-offer-slide-one-sixth":e.isMultipleBank,"s-offer-bank-wrapper-sinlge-item":!e.isMultipleBank}},r("div",{class:{"s-offer-bank-wrapper":true,"s-offer-slide-one-sixth":!e.isMultipleBank,"s-offer-bank-wrapper-multi-spacer":e.isMultipleBank}},r("div",{class:"s-offer-bank-logo"},r("img",{src:t.details.logo||salla.url.cdn("images/s-empty.png"),"data-src":t.details.logo,alt:t.title+" offer"})),r("ul",{class:"s-offer-bank-payment-wrapper"},t.details.payments.map((function(e){return r("li",{class:"s-offer-bank-payment-single"},r("img",{src:salla.url.cdn("images/payment/"+e+".png")||salla.url.cdn("images/s-empty.png"),"data-src":salla.url.cdn("images/payment/"+e+".png"),alt:"payment"}))}))),e.isMultipleBank?r("p",{class:"s-offer-bank-payment-discount-percent"},"".concat(e.product_discount_text," ").concat(t.details.discount_value).concat(t.details.discount_type==="percentage"&&"%")):""),!e.isMultipleBank?r("div",{class:"s-offer-bank-message s-offer-slide-one-fourth"},r("h2",null,e.offersList[0].title),r("p",{innerHTML:e.generateBankDescription(e.offersList[0].description,t.details.discount_value)})):"")}))};e.prototype.generateBankDescription=function(e,t){return e.replace(new RegExp("".concat(t," %")),'<span class="s-offer-bank-message-amount">'.concat(t," %</span>"))};e.prototype.renderDiscountTableSection=function(){var e=this;var t;var s=this.offersList[0];var n=s.details.show_price_after_discount;return(t=this.offersList[0].details.discounts)===null||t===void 0?void 0:t.map((function(t){return r("div",{class:"s-offer-slide-one-fourth"},r("div",{class:"s-offer-slide-offer-entry"},r("div",{class:"s-offer-slide-offer-entry-price-quantity-container"},r("p",{class:"s-offer-slide-offer-entry-quantity"},e.buy_quantity_text(t.quantity)),n?r("div",{class:"s-offer-slide-offer-entry-price"},r("span",null,e.offer_with_price_text),r("span",{class:"s-offer-slide-offer-entry-price-amount"},t.discounted_amount)," ",r("span",null,e.userCurrency)):""),r("p",{class:"s-offer-slide-offer-entry-price-amount-percent"},e.with_discount_text,"(",r("span",null,t.percentage,!!t.percentage&&"%"),")")))}))};e.prototype.renderSpecialPriceSection=function(){var e=this;var t,s;var n=this.offersList[0].details;return[n.apply_to==="product"&&((t=n.products)===null||t===void 0?void 0:t.map((function(t){return r("div",{class:"s-offer-slide-one-fourth"},e.hasCustomComponent?r(e.productCardComponent,{product:t}):r("salla-product-card",{"shadow-on-hover":true,product:t}))}))),n.apply_to==="category"&&((s=n.categories)===null||s===void 0?void 0:s.map((function(t){return e.getCategoriesSection(t)})))]};Object.defineProperty(e.prototype,"host",{get:function(){return s(this)},enumerable:false,configurable:true});return e}());o.style=a}}}));
|
|
5
|
+
//# sourceMappingURL=p-55306475.system.entry.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as a,c,h as s,H as e,g as t}from"./p-
|
|
5
|
-
//# sourceMappingURL=p-
|
|
4
|
+
import{r as a,c,h as s,H as e,g as t}from"./p-Dj2SrCy0.js";import{p as d,m as o}from"./p-DfeagqF1.js";const i="";const l=class{constructor(s){a(this,s);this.accordionToggle=c(this,"accordionToggle");this.collapsible=false;this.collapsed=true}emitCollapsePanel(){this.accordionToggle.emit({payload:{collapsed:this.collapsed}})}toggleCollapse(){var a,c,s;if(!this.collapsible)return;this.collapsed=!this.collapsed;(a=this.host.parentElement)===null||a===void 0?void 0:a.setAttribute("data-collapsed",this.collapsed.toString());(s=(c=this.host.parentElement)===null||c===void 0?void 0:c.querySelector("salla-accordion-body"))===null||s===void 0?void 0:s.setAttribute("data-collapsed",this.collapsed.toString());this.emitCollapsePanel()}render(){return s(e,{key:"9bb7ad4ad615f5316968b48839b2433619bd3850","data-collapsed":this.collapsed.toString(),onClick:()=>this.toggleCollapse(),class:"s-accordion-head-wrapper"},s("div",{key:"6826492e1c552440d6407435dfe4e0ca3915cdf4",class:"s-accordion-head-wrapper-start"},s("slot",{key:"2c19c500b57444ac8f69c2f64616904a819f54da",name:"title"}),s("slot",{key:"a6ed0daccd969ec94128f5f749ccddfa9f62e5d3",name:"subtitle"})),s("div",{key:"ddeff9dcacc42028d272298371c721ce00039176",class:"s-accordion-head-wrapper-end"},s("slot",{key:"daa4d8c9db6484f3fc67cf855250c5bc3cc59314",name:"notification"}),this.collapsible&&s("button",{key:"2bcc66dc07c3ae1ea9a31fbd0c7b8204f1eca2be",class:{"s-accordion-head-wrapper-toggle":true,active:!this.collapsed},onClick:a=>{a.stopPropagation();this.toggleCollapse()}},s("span",{key:"2853844a2fbc662c002f7e2cacb299874c9debb3",class:"s-accordion-head-wrapper-toggle-icon",innerHTML:this.collapsed?d:o}))))}get host(){return t(this)}};l.style=i;export{l as salla_accordion_head};
|
|
5
|
+
//# sourceMappingURL=p-59763129.entry.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var __awaiter=this&&this.__awaiter||function(t,i,n,e){function r(t){return t instanceof n?t:new n((function(i){i(t)}))}return new(n||(n=Promise))((function(n,s){function o(t){try{a(e.next(t))}catch(t){s(t)}}function u(t){try{a(e["throw"](t))}catch(t){s(t)}}function a(t){t.done?n(t.value):r(t.value).then(o,u)}a((e=e.apply(t,i||[])).next())}))};var __generator=this&&this.__generator||function(t,i){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},e,r,s,o;return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(t){return function(i){return a([t,i])}}function a(u){if(e)throw new TypeError("Generator is already executing.");while(o&&(o=0,u[0]&&(n=0)),n)try{if(e=1,r&&(s=u[0]&2?r["return"]:u[0]?r["throw"]||((s=r["return"])&&s.call(r),0):r.next)&&!(s=s.call(r,u[1])).done)return s;if(r=0,s)u=[u[0]&2,s.value];switch(u[0]){case 0:case 1:s=u;break;case 4:n.label++;return{value:u[1],done:false};case 5:n.label++;r=u[1];u=[0];continue;case 7:u=n.ops.pop();n.trys.pop();continue;default:if(!(s=n.trys,s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){n.label=u[1];break}if(u[0]===6&&n.label<s[1]){n.label=s[1];s=u;break}if(s&&n.label<s[2]){n.label=s[2];n.ops.push(u);break}if(s[2])n.ops.pop();n.trys.pop();continue}u=i.call(t,n)}catch(t){u=[6,t];r=0}finally{e=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};
|
|
2
2
|
/*!
|
|
3
3
|
* Crafted with ❤ by Salla
|
|
4
|
-
*/System.register(["./p-
|
|
5
|
-
//# sourceMappingURL=p-
|
|
4
|
+
*/System.register(["./p-DvJ_tnSw.system.js","./p-Be8TJdpm.system.js"],(function(t){"use strict";var i,n,e,r,s,o;return{setters:[function(t){i=t.r;n=t.c;e=t.h;r=t.H;s=t.g},function(t){o=t.M}],execute:function(){var u='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>android-phone</title>\n<path d="M22.667 0h-13.333c-2.941 0-5.333 2.392-5.333 5.333v21.333c0 2.941 2.392 5.333 5.333 5.333h13.333c2.941 0 5.333-2.392 5.333-5.333v-21.333c0-2.941-2.392-5.333-5.333-5.333zM25.333 26.667c0 1.471-1.196 2.667-2.667 2.667h-13.333c-1.471 0-2.667-1.196-2.667-2.667v-2.667h18.667zM25.333 21.333h-18.667v-16c0-1.471 1.196-2.667 2.667-2.667h13.333c1.471 0 2.667 1.196 2.667 2.667zM13.333 28h5.333c0.736 0 1.333-0.597 1.333-1.333s-0.597-1.333-1.333-1.333h-5.333c-0.736 0-1.333 0.597-1.333 1.333s0.597 1.333 1.333 1.333z"></path>\n</svg>\n';var a="salla-verify{display:block}.s-verify-input{}.s-verify-input::-webkit-outer-spin-button,.s-verify-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.s-verify-input[type=number]{-moz-appearance:textfield}";var f=t("salla_verify",function(){function t(t){var e=this;i(this,t);this.verified=n(this,"verified");this.translationLoaded=false;this.display="modal";this.type="mobile";this.autoReload=true;this.supportWebAuth=true;this.resendAfter=30;this.isProfileVerify=false;salla.lang.onLoaded((function(){var t;e.translationLoaded=true;e.title=salla.lang.get("pages.profile.verify_title")+salla.lang.get("common.elements."+e.type);(t=e.modal)===null||t===void 0?void 0:t.setTitle(e.title)}));if(this.display=="inline"){this.modal={open:function(){return""},close:function(){return""},setTitle:function(){return""}};return}salla.event.on("profile::verification",(function(t){var i;var n=Array.isArray(t)?t[0]:t;e.isProfileVerify=true;e.open(n);e.title=salla.lang.get("pages.profile.verify_title")+salla.lang.get("common.elements."+n.type);(i=e.modal)===null||i===void 0?void 0:i.setTitle(e.title)}));salla.event.on("modalClosed",(function(){e.resendAfter=0;e.timer.innerHTML="30 : 00"}))}t.prototype.splitNumber=function(t){this.resetError();var i=t.data||t.target.value;if(!i)return;if(i.length===1)return;this.modifyNext(t.target,i)};t.prototype.modifyNext=function(t,i){t.value=i[0];i=i.substring(1);if(t.nextElementSibling&&i.length){this.modifyNext(t.nextElementSibling,i)}else if(!t.nextElementSibling&&i.length===0){t.focus()}else if(t.nextElementSibling&&i.length===0){t.nextElementSibling.focus()}};t.prototype.checkAllInputs=function(){var t=true;for(var i=0;i<this.otpInputs.length;i++){if(this.otpInputs[i].value===""){t=false}}return t};t.prototype.handleKeyUp=function(t){var i,n,e,r;this.resetError();if(["Alt","Shift","Control","AltGraph","Ctrl"].includes(t.key)){return}var s=t.keyCode||t.charCode;if(t.target.value){(i=t.target.nextElementSibling)===null||i===void 0?void 0:i.focus();(n=t.target.nextElementSibling)===null||n===void 0?void 0:n.select()}else if([8,46].includes(s)){(e=t.target.previousElementSibling)===null||e===void 0?void 0:e.focus();(r=t.target.previousElementSibling)===null||r===void 0?void 0:r.select()}if(t.target.value.length>1){this.splitNumber(t)}};t.prototype.handlePaste=function(t){this.resetError();var i=salla.helpers.number(t.clipboardData.getData("text"))||"";var n=i.replace(/[^0-9]/g,"");n=n.substring(0,this.otpInputs.length);this.otpInputs.forEach((function(t){return t.value=""}));this.modifyNext(this.otpInputs[0],n)};t.prototype.handleInput=function(t){var i=this;this.resetError();salla.helpers.inputDigitsOnly(t.target);if(this.checkAllInputs()){setTimeout((function(){i.toggleOTPSubmit()}),100)}};t.prototype.resetError=function(){this.hasError=false;this.errorMessage=""};t.prototype.handleFocus=function(t){var i;if(t.target===this.firstOtpInput)return;if(((i=this.firstOtpInput)===null||i===void 0?void 0:i.value)==""){this.firstOtpInput.focus()}if(t.target.previousElementSibling.value==""){t.target.previousElementSibling.focus()}};t.prototype.getCode=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,this.code.value]}))}))};t.prototype.open=function(t){return __awaiter(this,void 0,void 0,(function(){var i,n;var e=this;return __generator(this,(function(r){this.data=t;this.data.type=this.data.type||this.type;this.type=this.data.type;this.resendTimer();this.otpInputs=this.body.querySelectorAll(".s-verify-input");this.firstOtpInput=this.body.querySelector("#otp-1");this.reset();this.resetError();this.display=="modal"&&((i=this.modal)===null||i===void 0?void 0:i.setTitle(this.title));this.modal.open();(n=this.firstOtpInput)===null||n===void 0?void 0:n.addEventListener("input",(function(t){return e.splitNumber(t)}));setTimeout((function(){return e.otpInputs[0].focus()}),100);return[2]}))}))};t.prototype.toggleOTPSubmit=function(){var t=[];this.otpInputs.forEach((function(i){return i.value&&t.push(i.value)}));this.code.value=t.join("");if(t.length===4){this.btn.disable();this.btn.click();return}this.btn.enable()};t.prototype.reset=function(){this.otpInputs.forEach((function(t){return t.value=""}));this.code.value="";this.otpInputs[0].focus()};t.prototype.resendTimer=function(){var t=this;this.resendMessage.style.display="block";this.resend.style.display="none";this.resendAfter=30;var i=setInterval((function(){if(t.resendAfter<=0){clearInterval(i);t.resend.style.display="block";t.resendMessage.style.display="none"}else{t.timer.innerHTML="".concat(t.resendAfter>=10?t.resendAfter:"0"+t.resendAfter," : 00");t.resendAfter--}}),1e3)};t.prototype.resendCode=function(){var t=this;return this.btn.stop().then((function(){return t.btn.disable()})).then((function(){t.otpInputs.forEach((function(t){return t.value=""}));t.otpInputs[0].focus()})).then((function(){return salla.api.auth.resend(t.data)})).finally((function(){return t.resendTimer()}))};t.prototype.submit=function(){var t=this;if(this.code.value.length<4){this.otpInputs[this.code.value.length].focus();salla.log("Trying to submit without 4 digits!");return}var i=Object.assign({code:this.code.value},this.data);return this.btn.load().then((function(){return t.btn.disable()})).then((function(){return t.isProfileVerify?salla.profile.verify(i):salla.auth.verify(i,t.supportWebAuth)})).then((function(i){return t.verified.emit(i)})).then((function(){return t.btn.stop()&&t.btn.disable()})).then((function(){return t.modal.close()})).then((function(){return t.autoReload&&window.location.reload()})).catch((function(i){var n,e,r;t.hasError=true;t.errorMessage=((r=(e=(n=i.response)===null||n===void 0?void 0:n.data)===null||e===void 0?void 0:e.error)===null||r===void 0?void 0:r.message)||salla.lang.get("common.errors.error_occurred");if(!i.response){console.log("Unexpected error",i)}else{salla.logger.error(i)}t.btn.stop()&&t.btn.enable()&&t.reset()}))};t.prototype.render=function(){var t=this;return this.display=="inline"?e(r,null,this.myBody()):e("salla-modal",{width:"xs",class:"s-verify",ref:function(i){return t.modal=i},"modal-title":this.title},e("span",{slot:"icon",class:"s-verify-header-icon",innerHTML:this.type=="mobile"?u:o}),this.myBody())};t.prototype.myBody=function(){var t=this;return e("div",{class:"s-verify-body",ref:function(i){return t.body=i}},e("div",{class:"s-verify-message",innerHTML:salla.lang.get("pages.profile.verify_message")}),e("slot",{name:"mobile"}),e("slot",{name:"email"}),e("input",{type:"hidden",name:"code",maxlength:"4",required:true,ref:function(i){return t.code=i}}),e("div",{class:{"s-verify-codes":true,"has-error":this.hasError},dir:"ltr"},[1,2,3,4].map((function(i){return e("input",{type:"number",autocomplete:"one-time-code",pattern:"[0-9]*",inputmode:"numeric",maxlength:"1",value:"",id:"otp-".concat(i),class:{"s-verify-input":true,"s-has-error":t.hasError},onInput:function(i){return t.handleInput(i)},onPaste:function(i){return t.handlePaste(i)},onKeyUp:function(i){return t.handleKeyUp(i)},onFocus:function(i){return t.handleFocus(i)},required:true})}))),this.hasError&&this.errorMessage?e("span",{class:"s-verify-error-message"},this.errorMessage):"",e("div",{slot:"footer",class:"s-verify-footer"},e("salla-button",{class:"s-verify-submit","loader-position":"center",disabled:true,onClick:function(){return t.submit()},ref:function(i){return t.btn=i}},salla.lang.get("pages.profile.verify")),e("p",{class:"s-verify-resend-message",ref:function(i){return t.resendMessage=i}},salla.lang.get("blocks.header.resend_after"),e("b",{class:"s-verify-timer",ref:function(i){return t.timer=i}})),e("a",{href:"#",class:"s-verify-resend",onClick:function(){return t.resendCode()},ref:function(i){return t.resend=i}},salla.lang.get("blocks.comments.submit"))),e("slot",{name:"after-footer"}))};Object.defineProperty(t.prototype,"host",{get:function(){return s(this)},enumerable:false,configurable:true});return t}());f.style=a}}}));
|
|
5
|
+
//# sourceMappingURL=p-5cd7ff6d.system.entry.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as e}from"./p-
|
|
5
|
-
//# sourceMappingURL=p-
|
|
4
|
+
import{r as s,h as e}from"./p-Dj2SrCy0.js";import{a as i}from"./p-BedNk7k1.js";import{H as t}from"./p-DjVGZdqd.js";import"./p-CgtvEd63.js";var a=`\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>quote-open</title>\n<path d="M8 12v-5.333c0-0.737-0.596-1.333-1.333-1.333-3.676 0-6.667 2.991-6.667 6.667v8c0 3.676 2.991 6.667 6.667 6.667h1.333c3.676 0 6.667-2.991 6.667-6.667v-1.333c0-3.676-2.991-6.667-6.667-6.667zM12 20c0 2.205-1.795 4-4 4h-1.333c-2.205 0-4-1.795-4-4v-8c0-1.739 1.115-3.221 2.667-3.772v5.105c0 0.737 0.596 1.333 1.333 1.333h1.333c2.205 0 4 1.795 4 4zM25.333 12v-5.333c0-0.737-0.596-1.333-1.333-1.333-3.676 0-6.667 2.991-6.667 6.667v8c0 3.676 2.991 6.667 6.667 6.667h1.333c3.676 0 6.667-2.991 6.667-6.667v-1.333c0-3.676-2.991-6.667-6.667-6.667zM29.333 20c0 2.205-1.795 4-4 4h-1.333c-2.205 0-4-1.795-4-4v-8c0-1.739 1.115-3.221 2.667-3.772v5.105c0 0.737 0.596 1.333 1.333 1.333h1.333c2.205 0 4 1.795 4 4z"></path>\n</svg>\n`;const l="";const r=class{constructor(e){s(this,e);this.limit=5;this.type="store";this.sort="latest";this.hideCustomerInfo=false;this.reviews=[];this.showReviews=false;this.testimonialText=salla.lang.get("blocks.home.testimonials");this.displayAllLinkText=salla.lang.get("blocks.home.display_all");this.displayAllURL=null;this.source=this.source;salla.onReady((()=>{this.displayAllURL=salla.url.get("testimonials");this.isRTL=salla.config.get("theme.is_rtl",true)}));salla.lang.onLoaded((()=>{this.testimonialText=salla.lang.get("blocks.home.testimonials");this.displayAllLinkText=salla.lang.get("blocks.home.display_all")}))}fetchReviews(){if(this.source==="json"){return Promise.resolve(JSON.parse(this.sourceValue))}const s=["products","categories"].includes(this.source);const e={limit:this.limit,source:this.source,items:s?JSON.parse(this.sourceValue):this.sourceValue,sort:this.sort,type:this.type,hide_customer_info:this.hideCustomerInfo?1:0};return salla.api.request("reviews",{params:e},"get")}componentWillLoad(){return new Promise((s=>salla.onReady(s))).then((()=>this.fetchReviews())).then((s=>s.data||[])).then((s=>{if(s.length){this.reviews=s;this.showReviews=true;t.generateReviewSchema(this.reviews)}}))}render(){return e("div",{key:"0ea9cab5b1f9d4d2b6b74cec987f24c858191217",class:"s-reviews-container"},e("div",{key:"6f17c3033b419b2eaf01f6dc858a4b7ce23bd2c4",class:"s-reviews-header-wrapper"},e("h1",{key:"1e043cca8a56542a297449e3ff5d3e52c93e0997",class:"s-reviews-header"},this.testimonialText),!!this.displayAllLink?e("a",{href:this.displayAllURL,class:"s-reviews-display-all"},this.displayAllLinkText,e("span",{class:"s-reviews-display-all-icon",innerHTML:i})):null),e("salla-slider",{key:"b5aee5d359c8604a5570991f2a7801b651d8321d",centered:true,"slides-per-view":1,type:"testimonials",class:"s-reviews-testimonials-slider","controls-outer":true,"auto-play":true,id:`testimonials-${this.source}-slider`},e("div",{key:"98428b4fde7a2c81567d387c93a9b87ef3245923",slot:"items"},this.reviews.map(((s,i)=>e("div",{key:i,class:"s-reviews-swiper-slide"},e("div",{class:"s-reviews-testimonial"},e("div",{class:"s-reviews-testimonial__inner"},e("div",{class:"s-reviews-testimonial__avatar"},e("img",{src:"images/s-empty.png","data-src":s.avatar,alt:s.name?s.name:"testimonial-"+i,class:"lazy"})),e("div",{class:"s-reviews-testimonial__text"},e("p",{innerHTML:s.content}),e("div",{class:"s-reviews-testimonial__name_wrapper"},e("div",{class:"s-reviews-testimonial__info"},s.name&&e("h2",null,`${s.name}`)),e("div",{class:"s-reviews-testimonial__rating"},e("salla-rating-stars",{size:"small",value:s.stars})))),e("span",{class:"s-reviews-testimonial__icon",innerHTML:a})))))))))}};r.style=l;export{r as salla_reviews};
|
|
5
|
+
//# sourceMappingURL=p-5e1f0ddf.entry.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Crafted with ❤ by Salla
|
|
3
|
+
*/
|
|
4
|
+
System.register(["./p-DvJ_tnSw.system.js"],(function(n){"use strict";var i,t,e;return{setters:[function(n){i=n.r;t=n.h;e=n.H}],execute:function(){var r;(function(n){n["PERCENTAGE"]="percentage";n["FIXED"]="fixed";n["FREE_PRODUCT"]="free_product"})(r||(r={}));var o;(function(n){n["PRODUCT_COUNT"]="products_count";n["PRODUCT_PURCHASE"]="order_amount"})(o||(o={}));var a=":host{display:block}";var s=n("salla_conditional_offer",function(){function n(n){i(this,n);this.offer=null;this.products={};this.isLoading=false;this.canRender=true}n.prototype.componentWillLoad=function(){var n=this;salla.onReady().then((function(){var n,i,t;if(!((n=salla.config.get("store.features"))===null||n===void 0?void 0:n.includes("conditional-offer"))||salla.storage.get("cart")!==""&&!((t=(i=salla.storage.get("cart"))===null||i===void 0?void 0:i.summary)===null||t===void 0?void 0:t.count)){throw new Error("feature or cart object does not existed")}})).then((function(){return salla.api.cart.offers()})).then((function(i){var t=i.data;n.offer=t.find((function(n){return n.type==="conditional"}));if(!n.offer){n.canRender=false;return}n.isLoading=true;n.offer.details.discounts.unshift({value:0,min_spend:0});return n.updateInitialOfferValue()})).then((function(){if(!n.offer)return;return n.getProducts()})).then((function(){if(!n.offer)return;salla.event.on("cart::updated",(function(i){return n.updateOfferValues(i)}))})).catch((function(i){n.canRender=false;salla.logger.warn("salla-conditional-offer:: ",i)})).finally((function(){n.isLoading=false}))};n.prototype.getProducts=function(){var n=this;var i=this.offer.details.discounts.filter((function(n){var i=n.type;return i===r.FREE_PRODUCT})).map((function(n){var i=n.value;return i}));if(i.length>0){return salla.product.fetch({source:"selected",source_value:i}).then((function(i){var t=i.data;t.forEach((function(i){var t=i.id,e=i.url,r=i.image;n.products[t]={url:e,image:r}}))}))}};n.prototype.updateInitialOfferValue=function(){var n=this;return salla.api.cart.details().then((function(i){var t=i.data.cart;return n.updateOfferValues(t)}))};n.prototype.updateOfferValues=function(n){var i=n.items,t=n.sub_total;var e;var r=this.offer.details.based_on===o.PRODUCT_COUNT?i.reduce((function(n,i){var t=i.quantity;return n+t}),0):t;this.offer=Object.assign(Object.assign({},this.offer),{details:Object.assign(Object.assign({},(e=this.offer)===null||e===void 0?void 0:e.details),{current_value:r})});return this.offer};n.prototype.getCheckpointContent=function(n){var i,e;if(n.type===r.PERCENTAGE)return"".concat(n.value,"%");if(n.type===r.FIXED)return salla.money(n.value);if(n.type!==r.FREE_PRODUCT){salla.logger.error("salla-conditional-offer:: unexpected type (".concat(n.type,")!"));return""}var o=this.products[n.value];if(!o){salla.logger.error("salla-conditional-offer:: there is no product with id (".concat(n.value,")!"));return""}return t("a",{class:"s-conditional-offer-product-link",href:o.url},t("img",{class:"s-conditional-offer-checkpoint-image-content",loading:"lazy",decoding:"async",alt:((i=o===null||o===void 0?void 0:o.image)===null||i===void 0?void 0:i.alt)||"",src:(e=o===null||o===void 0?void 0:o.image)===null||e===void 0?void 0:e.url}))};n.prototype.getOfferType=function(n){var i;var t=(i=this.offer.details)===null||i===void 0?void 0:i.based_on;if(t===o.PRODUCT_COUNT)return salla.lang.choice("blocks.header.products_count",n.min_spend);if(t===o.PRODUCT_PURCHASE)return salla.money(n.min_spend);salla.logger.warn("salla-conditional-offer:: Unexpected offer detail's based_on value: ".concat(t));return"".concat(n.min_spend)};n.prototype.clamp=function(n,i,t){return Math.max(i,Math.min(n,t))};n.prototype.mapValueRanges=function(n,i,t,e,r){var o=(n-i)*(r-e)/(t-i)+e;if(o===Number.POSITIVE_INFINITY)return 100;if(o===Number.NEGATIVE_INFINITY)return 0;return this.clamp(o,0,100)};n.prototype.getCheckPointView=function(n,i){var e,r;var o=this.offer.details.discounts.findIndex((function(i){var t=i.min_spend;return t===n.min_spend}));var a=(r=(e=this.offer.details.discounts[o-1])===null||e===void 0?void 0:e.min_spend)!==null&&r!==void 0?r:0;var s=this.mapValueRanges(this.offer.details.current_value,a,n.min_spend,0,100);var l=n.min_spend<=this.offer.details.current_value;return t("div",{class:"s-conditional-offer-checkpoint-container"},i>0?[t("div",{key:"progress-line",class:"s-conditional-offer-progress-line-container"},t("div",{class:"s-conditional-offer-progress-line-inactive"}),t("div",{class:"s-conditional-offer-progress-line-active",style:{width:"".concat(s,"%")}})),t("div",{key:"checkpoint",class:"s-conditional-offer-checkpoint ".concat(l?"s-conditional-offer-active-checkpoint":"")},t("div",{class:"s-conditional-offer-item-avatar-content ".concat(l?"active":""),innerHTML:this.products&&this.getCheckpointContent(n)}),t("div",{class:"s-conditional-offer-checkpoint-label ".concat(l?"active":""),innerHTML:this.getOfferType(n)}))]:t("div",{key:"label",class:{"s-conditional-offer-checkpoint-label":true,"first-checkpoint":i===0,active:l},innerHTML:this.getOfferType(n)}))};n.prototype.getLoadingSkeletonView=function(){return t(e,{class:"s-conditional-offer-container"},t("div",{class:"s-conditional-offer-skeleton-inner-container"},t("div",{class:"s-conditional-offer-skeleton-subtitle"},t("salla-skeleton",{height:"16px",width:"30%"})),t("div",{class:"s-conditional-offer-skeleton-subtitle"},t("salla-skeleton",{height:"16px",width:"35%"})),t("div",{class:"s-conditional-offer-skeleton-checkpoints-wrapper"},Array(3).fill(null).map((function(){return[t("salla-skeleton",{key:"checkpoint-line",height:"8px"}),t("div",{key:"checkpoint"},t("salla-skeleton",{height:"60px",width:"60px",type:"circle"}))]})))))};n.prototype.render=function(){var n=this;if(!this.canRender)return null;if(this.isLoading)return this.getLoadingSkeletonView();if(!this.offer)return null;return t(e,{class:"s-conditional-offer-container"},t("div",{class:"s-conditional-offer-title-wrapper"},t("div",{class:"s-conditional-offer-title"},this.offer.title),this.offer.description?t("div",{class:"s-conditional-offer-subtitle"},this.offer.description," ",t("i",{class:"sicon-information"})):null),t("div",{class:"s-conditional-offer-progress-container"},this.offer.details.discounts.map((function(i,e){return t("div",{class:{"flex-1":e>0},key:i.min_spend},n.getCheckPointView(i,e))}))))};return n}());s.style=a}}}));
|
|
5
|
+
//# sourceMappingURL=p-618eb3f2.system.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DiscountType","OfferType","sallaConditionalOfferCss","SallaConditionalOffer","exports","class_1","hostRef","this","offer","products","isLoading","canRender","prototype","componentWillLoad","_this","salla","onReady","then","_a","config","get","includes","storage","_c","_b","summary","count","Error","api","cart","offers","_d","data","find","type","details","discounts","unshift","value","min_spend","updateInitialOfferValue","getProducts","event","on","updatedCart","updateOfferValues","catch","error","logger","warn","finally","freeProductIDs","filter","FREE_PRODUCT","map","length","product","fetch","source","source_value","forEach","id","url","image","items","sub_total","current_value","based_on","PRODUCT_COUNT","reduce","quantity","Object","assign","getCheckpointContent","discount","PERCENTAGE","concat","FIXED","money","productItem","h","class","href","loading","decoding","alt","src","getOfferType","basedOn","lang","choice","PRODUCT_PURCHASE","clamp","min","max","Math","mapValueRanges","initialMinRange","initialMaxRange","newMinRange","newMaxRange","newRange","Number","POSITIVE_INFINITY","NEGATIVE_INFINITY","getCheckPointView","index","checkpointIndex","findIndex","previousCheckpointValue","progressPercentage","isActive","key","style","width","innerHTML","active","getLoadingSkeletonView","Host","height","Array","fill","render","title","description"],"sources":["src/components/salla-conditional-offer/interfaces.ts","src/components/salla-conditional-offer/salla-conditional-offer.scss?tag=salla-conditional-offer","src/components/salla-conditional-offer/salla-conditional-offer.tsx"],"sourcesContent":["import type { Product } from \"@salla.sa/twilight/types/common\";\n\nexport enum DiscountType {\n PERCENTAGE = \"percentage\",\n FIXED = \"fixed\",\n FREE_PRODUCT = \"free_product\",\n}\n\nexport enum OfferType {\n PRODUCT_COUNT = \"products_count\",\n PRODUCT_PURCHASE = \"order_amount\",\n}\n\nexport interface Discount {\n type?: DiscountType;\n value?: number;\n min_spend?: number;\n max_discount?: number;\n}\n\nexport interface OfferDetails {\n based_on?: OfferType;\n ends_at?: number;\n start_value?: number;\n end_value?: number;\n current_value?: number;\n discounts?: Discount[];\n}\n\nexport interface Offer {\n id?: number;\n type?: string;\n title?: string;\n description?: string;\n details?: OfferDetails | null;\n}\n\n\nexport interface ProductDetail {\n id?: number;\n sku?: string;\n name?: string;\n description?: string;\n url?: string;\n promotion_title?: null;\n subtitle?: null;\n type?: string;\n status?: string;\n price?: number;\n base_currency_price?: BaseCurrencyPrice;\n sale_price?: number;\n regular_price?: number;\n starting_price?: null;\n quantity?: null;\n max_quantity?: number;\n discount_ends?: null;\n is_taxable?: boolean;\n has_read_more?: boolean;\n can_add_note?: boolean;\n can_show_remained_quantity?: boolean;\n can_upload_file?: boolean;\n has_custom_form?: boolean;\n has_metadata?: boolean;\n is_on_sale?: boolean;\n is_hidden_quantity?: boolean;\n is_available?: boolean;\n is_out_of_stock?: boolean;\n is_require_shipping?: boolean;\n weight?: null;\n calories?: null;\n image?: Image;\n currency?: string;\n}\n\nexport interface BaseCurrencyPrice {\n currency?: string;\n amount?: number;\n}\n\nexport interface Image {\n url?: string;\n alt?: string;\n}\n\nexport interface UpdatedCart {\n items: Array<Product>;\n sub_total: number;\n}\n",":host {\n display: block;\n}","import { Component, Host, State, h } from \"@stencil/core\";\nimport {\n type Discount,\n DiscountType,\n type Offer,\n OfferType,\n type UpdatedCart,\n} from \"./interfaces\";\nimport type { Product } from \"@salla.sa/twilight/types/common\";\n\n@Component({\n tag: \"salla-conditional-offer\",\n styleUrl: \"salla-conditional-offer.scss\",\n})\nexport class SallaConditionalOffer {\n\n @State() offer: Offer = null;\n @State() products: Record<string, Pick<Product, 'image' | 'url'>> = {}\n @State() isLoading = false\n @State() canRender = true\n\n componentWillLoad() {\n salla.onReady().then(() => {\n if (!salla.config.get('store.features')?.includes('conditional-offer') || (salla.storage.get(\"cart\") !== '' && !salla.storage.get(\"cart\")?.summary?.count)) {\n throw new Error('feature or cart object does not existed');\n }\n })\n .then(() => salla.api.cart.offers())\n .then(({ data }: { data: Offer[] }) => {\n this.offer = data.find(offer => offer.type === \"conditional\")\n\n if (!this.offer) {\n this.canRender = false\n return;\n }\n\n this.isLoading = true\n this.offer.details.discounts.unshift(({ value: 0, min_spend: 0 }))\n return this.updateInitialOfferValue()\n }).then(() => {\n if (!this.offer) return;\n return this.getProducts()\n }).then(() => {\n if (!this.offer) return;\n salla.event.on(\"cart::updated\", (updatedCart: UpdatedCart) => this.updateOfferValues(updatedCart))\n })\n .catch(error => {\n this.canRender = false\n salla.logger.warn('salla-conditional-offer:: ', error)\n }).finally(() => {\n this.isLoading = false\n })\n\n }\n\n private getProducts() {\n const freeProductIDs = this.offer.details.discounts.filter(({ type }) => type === DiscountType.FREE_PRODUCT).map(({ value }) => value)\n if (freeProductIDs.length > 0) {\n return salla.product.fetch({ source: 'selected', source_value: freeProductIDs }).then(({ data }: { data: Array<Product> }) => {\n data.forEach(({ id, url, image }) => {\n this.products[id] = { url, image }\n })\n })\n }\n }\n\n private updateInitialOfferValue() {\n return salla.api.cart.details().then(({ data: { cart } }: { data: { cart: UpdatedCart } }) => this.updateOfferValues(cart))\n }\n\n private updateOfferValues({ items, sub_total }: UpdatedCart) {\n const current_value = this.offer.details.based_on === OfferType.PRODUCT_COUNT ? items.reduce((count: number, { quantity }) => count + quantity, 0,) : sub_total\n //we need to assign the offer object a new reference to trigger re-rendering\n this.offer = {\n ...this.offer, details: {\n ...this.offer?.details, current_value,\n }\n }\n return this.offer\n }\n\n private getCheckpointContent(discount: Discount) {\n\n if (discount.type === DiscountType.PERCENTAGE) return `${discount.value}%`\n\n if (discount.type === DiscountType.FIXED) return salla.money(discount.value)\n\n if (discount.type !== DiscountType.FREE_PRODUCT) {\n salla.logger.error(`salla-conditional-offer:: unexpected type (${discount.type})!`);\n return \"\";\n }\n\n const productItem = this.products[discount.value]\n\n if (!productItem) {\n salla.logger.error(`salla-conditional-offer:: there is no product with id (${discount.value})!`);\n return \"\";\n }\n\n return <a class=\"s-conditional-offer-product-link\" href={productItem.url} >\n <img\n class=\"s-conditional-offer-checkpoint-image-content\"\n loading=\"lazy\"\n decoding=\"async\"\n alt={productItem?.image?.alt || \"\"}\n src={productItem?.image?.url} />\n </a>\n }\n\n private getOfferType(discount: Discount): string {\n const basedOn = this.offer.details?.based_on;\n if (basedOn === OfferType.PRODUCT_COUNT) return salla.lang.choice(\"blocks.header.products_count\", discount.min_spend);\n if (basedOn === OfferType.PRODUCT_PURCHASE) return salla.money(discount.min_spend);\n\n salla.logger.warn(`salla-conditional-offer:: Unexpected offer detail's based_on value: ${basedOn}`);\n return `${discount.min_spend}`;\n }\n\n private clamp(value: number, min: number, max: number) {\n return Math.max(min, Math.min(value, max));\n }\n\n private mapValueRanges(value: number, initialMinRange: number, initialMaxRange: number, newMinRange: number, newMaxRange: number) {\n\n const newRange = ((value - initialMinRange) * (newMaxRange - newMinRange)) / (initialMaxRange - initialMinRange) + newMinRange;\n\n if (newRange === Number.POSITIVE_INFINITY) return 100\n\n if (newRange === Number.NEGATIVE_INFINITY) return 0\n\n return this.clamp(newRange, 0, 100)\n }\n\n private getCheckPointView(discount: Discount, index: number) {\n const checkpointIndex = this.offer.details.discounts.findIndex(({ min_spend }) => min_spend === discount.min_spend);\n const previousCheckpointValue = this.offer.details.discounts[checkpointIndex - 1]?.min_spend ?? 0;\n const progressPercentage = this.mapValueRanges(this.offer.details.current_value, previousCheckpointValue, discount.min_spend, 0, 100);\n const isActive = discount.min_spend <= this.offer.details.current_value;\n\n return (\n <div class=\"s-conditional-offer-checkpoint-container\">\n {index > 0 ? [\n <div key=\"progress-line\" class=\"s-conditional-offer-progress-line-container\">\n <div class=\"s-conditional-offer-progress-line-inactive\" />\n <div class=\"s-conditional-offer-progress-line-active\" style={{ width: `${progressPercentage}%` }} />\n </div>,\n <div key=\"checkpoint\" class={`s-conditional-offer-checkpoint ${isActive ? \"s-conditional-offer-active-checkpoint\" : \"\"}`} >\n <div class={`s-conditional-offer-item-avatar-content ${isActive ? \"active\" : \"\"}`} innerHTML={this.products && this.getCheckpointContent(discount)}>\n </div>\n <div class={`s-conditional-offer-checkpoint-label ${isActive ? \"active\" : \"\"}`} innerHTML={this.getOfferType(discount)} />\n\n </div>\n ] :\n <div key=\"label\" class={{ \"s-conditional-offer-checkpoint-label\": true, \"first-checkpoint\": index === 0, active: isActive }} innerHTML={this.getOfferType(discount)} />\n }\n </div>\n );\n }\n\n private getLoadingSkeletonView() {\n return <Host class=\"s-conditional-offer-container\" >\n <div class=\"s-conditional-offer-skeleton-inner-container\">\n <div class=\"s-conditional-offer-skeleton-subtitle\">\n <salla-skeleton height=\"16px\" width=\"30%\" />\n </div>\n\n <div class=\"s-conditional-offer-skeleton-subtitle\">\n <salla-skeleton height=\"16px\" width=\"35%\" />\n </div>\n <div class=\"s-conditional-offer-skeleton-checkpoints-wrapper\">\n {Array(3).fill(null).map(() => (\n [<salla-skeleton key=\"checkpoint-line\" height=\"8px\" />,\n <div key=\"checkpoint\">\n <salla-skeleton height=\"60px\" width=\"60px\" type=\"circle\" />\n </div>]\n ))}\n </div>\n\n </div>\n </Host>\n }\n\n render() {\n if (!this.canRender) return null\n if (this.isLoading) return this.getLoadingSkeletonView()\n if (!this.offer) return null\n\n return <Host class=\"s-conditional-offer-container\">\n <div class=\"s-conditional-offer-title-wrapper\">\n <div class=\"s-conditional-offer-title\">{this.offer.title}</div>\n {this.offer.description ? <div class=\"s-conditional-offer-subtitle\">\n {this.offer.description} <i class=\"sicon-information\" />\n </div> : null}\n </div>\n <div class=\"s-conditional-offer-progress-container\">\n {this.offer.details.discounts.map((discount, index) => (\n <div class={{ \"flex-1\": index > 0 }} key={discount.min_spend}>\n {this.getCheckPointView(discount, index)}\n </div>\n ))}\n </div>\n </Host>\n }\n}\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as t}from"./p-
|
|
5
|
-
//# sourceMappingURL=p-
|
|
4
|
+
import{r as s,h as t}from"./p-Dj2SrCy0.js";import{S as i,A as e}from"./p-yRO-ZESF.js";import{G as c}from"./p-C0JNGIpa.js";var r=`\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>tag-money</title>\n<path d="M20.567 11.433c-0.521-0.521-1.364-0.521-1.885 0l-0.524 0.524c-1.28-0.819-3.091-0.681-4.191 0.419-0.631 0.631-0.976 1.468-0.976 2.359 0 0.889 0.347 1.727 0.976 2.357l0.943 0.943c0.171 0.171 0.195 0.368 0.195 0.472s-0.025 0.301-0.196 0.472c-0.169 0.169-0.367 0.195-0.471 0.195s-0.301-0.025-0.472-0.195l-2.357-2.357c-0.521-0.521-1.364-0.521-1.885 0s-0.521 1.364 0 1.885l0.944 0.941-0.472 0.472c-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l0.519-0.519c0.54 0.359 1.173 0.553 1.837 0.553 0.892 0 1.729-0.348 2.357-0.976 0.631-0.631 0.976-1.467 0.976-2.357s-0.347-1.727-0.976-2.357l-0.943-0.943c-0.26-0.26-0.26-0.684 0-0.944 0.259-0.259 0.683-0.261 0.944 0l1.885 1.887c0.521 0.521 1.364 0.521 1.885 0 0.521-0.52 0.521-1.364 0-1.885l-0.472-0.472 0.472-0.472c0.521-0.521 0.521-1.365 0.001-1.887zM28 0h-9.344c-1.059 0-2.056 0.411-2.809 1.153l-14.673 14.456c-1.56 1.56-1.561 4.097-0.001 5.657l9.56 9.56c0.755 0.755 1.76 1.172 2.828 1.173h0.003c1.068 0 2.072-0.416 2.833-1.179l14.451-14.668c0.743-0.753 1.153-1.751 1.153-2.809v-9.344c0-2.205-1.795-4-4-4zM29.333 13.344c0 0.353-0.137 0.685-0.385 0.937l-14.444 14.661c-0.252 0.252-0.587 0.391-0.941 0.391-0.001 0-0.001 0-0.001 0-0.356-0.001-0.691-0.139-0.943-0.392l-9.561-9.56c-0.52-0.52-0.52-1.365-0.005-1.88l14.667-14.449c0.253-0.248 0.585-0.385 0.937-0.385h9.344c0.736 0 1.333 0.597 1.333 1.333zM24 6.673c-0.737 0-1.333 0.604-1.333 1.341s0.596 1.333 1.333 1.333 1.333-0.596 1.333-1.333v-0.015c0-0.737-0.596-1.327-1.333-1.327z"></path>\n</svg>\n`;var a=`\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>fire</title>\n<path d="M21.56 3.009c-0.052-0.047-0.116-0.065-0.173-0.103-0.073-0.048-0.143-0.1-0.223-0.132-0.083-0.033-0.165-0.047-0.252-0.063-0.081-0.016-0.16-0.035-0.243-0.035-0.089 0-0.172 0.020-0.26 0.037-0.080 0.016-0.159 0.028-0.236 0.059-0.084 0.035-0.157 0.088-0.235 0.14-0.053 0.036-0.115 0.053-0.165 0.097-0.049 0.044-0.988 0.895-2.288 2.255-2.364-2.839-4.476-4.815-4.576-4.908-0.056-0.052-0.127-0.075-0.188-0.115-0.075-0.049-0.143-0.105-0.224-0.137-0.080-0.032-0.163-0.041-0.245-0.057-0.085-0.016-0.167-0.040-0.252-0.040-0.084 0-0.163 0.023-0.245 0.039-0.087 0.016-0.172 0.025-0.253 0.059-0.080 0.032-0.147 0.087-0.22 0.135-0.063 0.041-0.133 0.064-0.189 0.116-0.453 0.423-11.092 10.408-11.092 18.095 0 7.977 4.935 13.549 12 13.549h8.667c6.673 0 11.333-5.115 11.333-12.439 0-7.052-10.013-16.167-10.44-16.552zM20.667 29.333h-7.777c-2.924 0-4.889-2.044-4.889-5.084 0-2.317 2.816-6.441 4.888-8.887 0.76 0.909 2.755 3.397 3.969 5.869 0.212 0.431 0.639 0.715 1.117 0.743 0.489 0.031 0.937-0.203 1.197-0.605 0.552-0.849 1.109-1.596 1.497-2.093 1.491 1.897 3.331 4.78 3.331 6.399 0 2.188-1.34 3.659-3.333 3.659zM26.537 27.052c0.081-0.44 0.129-0.899 0.129-1.377 0-3.269-3.713-7.847-4.46-8.735l-0.523-0.617c-0.507-0.599-1.528-0.599-2.035 0l-0.531 0.627c-0.147 0.175-0.495 0.599-0.936 1.187-1.595-2.597-3.495-4.776-3.595-4.889l-0.697-0.793c-0.507-0.577-1.499-0.577-2.004 0l-0.697 0.795c-0.6 0.684-5.856 6.803-5.856 11.001 0 0.881 0.127 1.712 0.356 2.484-1.896-1.933-3.023-4.821-3.023-8.283 0-4.915 6.073-11.997 9.329-15.255 1.001 1.008 2.692 2.789 4.368 4.927 0.243 0.309 0.609 0.496 1.001 0.509h0.048c0.376 0 0.735-0.159 0.988-0.439 0.889-0.981 1.693-1.795 2.269-2.359 3.051 2.965 8.663 9.323 8.663 13.727 0 3.171-1.031 5.769-2.796 7.491z"></path>\n</svg>\n`;var o=`\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>discount-coupon</title>\n<path d="M27 28h-22c-0.552 0-1-0.448-1-1v0c0-1.657-1.343-3-3-3v0c-0.552 0-1-0.448-1-1v0-12c0-0.552 0.448-1 1-1v0c1.657 0 3-1.343 3-3v0c0-0.552 0.448-1 1-1v0h22c0.552 0 1 0.448 1 1v0c0 1.657 1.343 3 3 3v0c0.552 0 1 0.448 1 1v0 12c0 0.552-0.448 1-1 1v0c-1.657 0-3 1.343-3 3v0c0 0.552-0.448 1-1 1v0zM5.9 26h20.2c0.415-1.964 1.936-3.485 3.867-3.894l0.033-0.006v-10.2c-1.964-0.415-3.485-1.936-3.894-3.867l-0.006-0.033h-20.2c-0.415 1.964-1.936 3.485-3.867 3.894l-0.033 0.006v10.2c1.964 0.415 3.485 1.936 3.894 3.867l0.006 0.033zM20 7h2v3h-2v-3zM20 12h2v4h-2v-4zM20 18h2v4h-2v-4zM20 24h2v3h-2v-3zM9 16c-1.657 0-3-1.343-3-3s1.343-3 3-3c1.657 0 3 1.343 3 3v0c0 1.657-1.343 3-3 3v0zM9 12c-0.552 0-1 0.448-1 1s0.448 1 1 1c0.552 0 1-0.448 1-1v0c0-0.552-0.448-1-1-1v0zM15 24c-1.657 0-3-1.343-3-3s1.343-3 3-3c1.657 0 3 1.343 3 3v0c0 1.657-1.343 3-3 3v0zM15 20c-0.552 0-1 0.448-1 1s0.448 1 1 1c0.552 0 1-0.448 1-1v0c0-0.552-0.448-1-1-1v0zM7 24c-0.552-0-1-0.448-1-1 0-0.244 0.088-0.468 0.233-0.642l-0.001 0.002 10-12c0.185-0.221 0.461-0.36 0.769-0.36 0.553 0 1.001 0.448 1.001 1.001 0 0.245-0.088 0.469-0.233 0.643l0.001-0.002-10 12c-0.185 0.22-0.46 0.358-0.767 0.358-0.001 0-0.002 0-0.003 0h0z"></path>\n</svg>\n`;const l=":host{display:block}";const n=class{constructor(t){s(this,t);this.internalOffers=[];this.showAll=false;this.freeLabel="";this.receivedOffer="";this.discountAmountLabel="";this.showMoreOffers="";this.icons={DiscountCouponIcon:o,GiftIcon:c,FireIcon:a,SpecialDiscountIcon:i,TagMoneyIcon:r};this.visibleOffersCount=3;this.handleCartItemUpdated=s=>{const t=s.data.cart.items.find((s=>s.id===this.itemId));if((t===null||t===void 0?void 0:t.id)===this.itemId){this.internalQuantity=t.quantity;this.internalOffers=t.detailed_offers||[];this.internalProductPrice=t.product_price}};this.toggleShowAll=()=>{this.showAll=!this.showAll}}async componentWillLoad(){await Salla.onReady();await salla.lang.onLoaded((()=>{this.freeLabel=salla.lang.get("common.elements.freeExclam");this.receivedOffer=salla.lang.get("pages.cart.received_offer");this.discountAmountLabel=salla.lang.get("pages.cart.discount_amount");this.showMoreOffers=salla.lang.get("pages.cart.show_more_offers")}));this.internalQuantity=this.quantity;this.internalOffers=this.parseOffers(this.offers);this.internalProductPrice=this.productPrice}componentDidLoad(){salla.event.on("cart::item.updated",(s=>this.handleCartItemUpdated(s)))}parseOffers(s){try{if(typeof s!=="string"){console.warn("Offers is not a string. Returning as-is.",s);return Array.isArray(s)?s:[]}return JSON.parse(s||"[]")}catch(s){console.error("Failed to parse offers",s);return[]}}get visibleOffers(){return this.internalOffers.slice(0,this.visibleOffersCount)}get hiddenOffers(){return this.internalOffers.slice(this.visibleOffersCount)}getPaidQty(s,t){return s-t.free_quantity}renderOffer(s,i){const e=this.getPaidQty(s,i);return t("div",{class:"s-cart-item-offers-box"},i.free_quantity>0&&e>0&&t("div",{class:"s-cart-item-offers-paid-free"},t("div",{class:"s-cart-item-offers-line"},salla.helpers.number(e)," × ",t("span",{innerHTML:salla.money(this.internalProductPrice)})),t("div",{class:"s-cart-item-offers-line"},salla.helpers.number(i.free_quantity)," ×",t("span",{class:"s-cart-item-offers-regular-price",innerHTML:salla.money(this.internalProductPrice)}),t("span",{class:"s-cart-item-offers-free-label"},this.freeLabel))),t("div",{class:"s-cart-item-offers-details"},t("span",{class:`s-cart-item-offers-icon`,innerHTML:this.icons[i.discount_icon]||""}),t("div",null,t("p",{class:"s-cart-item-offers-title"},this.receivedOffer.replace(":offer",i.offer_name)),t("p",{class:"s-cart-item-offers-discount"},t("span",{innerHTML:this.discountAmountLabel.replace(":amount",salla.money(i.discount_amount.toFixed(2)))})))))}render(){var s,i;if(!((s=this.internalOffers)===null||s===void 0?void 0:s.length)){return null}return t("div",{class:"s-cart-item-offers-container",id:`offers_list_${this.itemId}`},this.visibleOffers.map((s=>this.renderOffer(this.internalQuantity,s))),((i=this.internalOffers)===null||i===void 0?void 0:i.length)>this.visibleOffersCount&&t("div",{class:"s-cart-item-offers-show-more"},t("button",{class:"s-cart-item-offers-show-more-btn",onClick:this.toggleShowAll,type:"button"},t("span",{class:"s-cart-item-offers-show-more-label"},"+",this.hiddenOffers.length," ",this.showMoreOffers,t("span",{innerHTML:e,class:{"s-cart-item-offers-arrow-icon":true,"s-cart-item-offers-arrow-open":this.showAll}})))),this.showAll&&t("div",{class:"s-cart-item-offers-collapsed",id:`offers_${this.itemId}`},this.hiddenOffers.map((s=>this.renderOffer(this.internalQuantity,s)))))}};n.style=l;export{n as salla_cart_item_offers};
|
|
5
|
+
//# sourceMappingURL=p-67b54ac4.entry.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(t,n,r,i){function e(t){return t instanceof r?t:new r((function(n){n(t)}))}return new(r||(r=Promise))((function(r,a){function s(t){try{u(i.next(t))}catch(t){a(t)}}function o(t){try{u(i["throw"](t))}catch(t){a(t)}}function u(t){t.done?r(t.value):e(t.value).then(s,o)}u((i=i.apply(t,n||[])).next())}))};var __generator=this&&this.__generator||function(t,n){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,e,a,s;return s={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(t){return function(n){return u([t,n])}}function u(o){if(i)throw new TypeError("Generator is already executing.");while(s&&(s=0,o[0]&&(r=0)),r)try{if(i=1,e&&(a=o[0]&2?e["return"]:o[0]?e["throw"]||((a=e["return"])&&a.call(e),0):e.next)&&!(a=a.call(e,o[1])).done)return a;if(e=0,a)o=[o[0]&2,a.value];switch(o[0]){case 0:case 1:a=o;break;case 4:r.label++;return{value:o[1],done:false};case 5:r.label++;e=o[1];o=[0];continue;case 7:o=r.ops.pop();r.trys.pop();continue;default:if(!(a=r.trys,a=a.length>0&&a[a.length-1])&&(o[0]===6||o[0]===2)){r=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){r.label=o[1];break}if(o[0]===6&&r.label<a[1]){r.label=a[1];a=o;break}if(a&&r.label<a[2]){r.label=a[2];r.ops.push(o);break}if(a[2])r.ops.pop();r.trys.pop();continue}o=n.call(t,r)}catch(t){o=[6,t];e=0}finally{i=a=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}};
|
|
2
|
+
/*!
|
|
3
|
+
* Crafted with ❤ by Salla
|
|
4
|
+
*/System.register(["./p-DvJ_tnSw.system.js","./p-Bnro4LR3.system.js","./p-C-c0Msup.system.js","./p-CLqFzsVe.system.js"],(function(t){"use strict";var n,r,i,e,a,s,o;return{setters:[function(t){n=t.r;r=t.c;i=t.h;e=t.H;a=t.g},function(t){s=t.F},function(t){o=t.H},null],execute:function(){var u=":host{display:block}.s-rating-stars-small{line-height:12px}.s-filters-radio{background-image:none !important}";var f=t("salla_filters",function(){function t(t){var i=this;n(this,t);this.changed=r(this,"changed");this.isReady=false;this.filtersData={};salla.event.on("filters::hidden",(function(){return i.host.style.display="none"}));salla.lang.onLoaded((function(){i.apply=salla.lang.get("pages.checkout.apply");i.reset=salla.lang.get("pages.categories.filters_reset")}));salla.event.on("filters::fetched",(function(t){var n=t.filters;i.host.style.display="";var r={};i.filters=n.map((function(t){t.label={category_id:salla.lang.get("common.titles.categories"),brand_id:salla.lang.get("common.titles.brands"),rating:salla.lang.get("pages.categories.filter_rating"),price:salla.lang.get("pages.categories.filter_price")}[t.key]||t.label;if(t.key=="rating"){t.type=s.VALUES;var n=t.values,e=n.max,a=n.min;t.values=[5,4,3,2,1].filter((function(t){return t>=a||t<=e}))}if(i.filtersData.variants&&t.type==s.VARIANTS){r.variants=i.filtersData.variants}if(i.filtersData[t.key]&&t.type!==s.VARIANTS){r[t.key]=i.filtersData[t.key]}var o=new URLSearchParams(window.location.search);var u=false;for(var f=0,c=o.keys();f<c.length;f++){var l=c[f];if(l.includes("filters")){u=true;break}}if(salla.config.get("page.slug")=="product.index"&&Object.keys(r).length==0&&!u){var h=window.location.href;var v=salla.config.get("page.id");var d=h.indexOf("?")!==-1?"&":"?";var w=h+d+"filters[category_id]="+v;r.category_id=v;window.history.pushState({path:w},"",w)}return t}));i.filtersData=r;i.host.childNodes.forEach((function(t){return __awaiter(i,void 0,void 0,(function(){var n;return __generator(this,(function(r){switch(r.label){case 0:n=t.setWidgetHeight;if(!n)return[3,2];return[4,t.setWidgetHeight()];case 1:n=r.sent();r.label=2;case 2:return[2,n]}}))}))}))}))}t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var t,n,r;return __generator(this,(function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);t=new URLSearchParams(window.location.search);n=this;return[4,o.extractFiltersFromUrl(t)];case 1:n.filtersData=i.sent();return[3,3];case 2:r=i.sent();console.warn("failed to get filters from URL",r.message);return[3,3];case 3:return[2]}}))}))};t.prototype.getFilters=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,this.filtersData]}))}))};t.prototype.applyFilters=function(){return __awaiter(this,void 0,void 0,(function(){var t;var n=this;return __generator(this,(function(r){if(!this.isReady){return[2]}t=Object.keys(this.filtersData).length>0;setTimeout((function(){var r;if(t){var i=new URL(window.location.href);for(var e=0,a=i.searchParams.entries();e<a.length;e++){var s=a[e][0];if(s.startsWith("filters")){i.searchParams.delete(s)}}var o=n.encodeFilters(n.filtersData);var u=i.search.split("&").filter((function(t){return!t.includes("filters")})).join("&");if(u){i.search=i.search.split("&filters")[0]+"&"+o}else{i.search="?".concat(o)}window.history.pushState({},"",i.href)}else{var i=new URL(window.location.href);(r=i.searchParams)===null||r===void 0?void 0:r.delete("filters");window.history.pushState({},"",i.toString())}salla.event.emit("salla-filters::changed",n.filtersData);n.changed.emit(n.filtersData)}),300);return[2]}))}))};t.prototype.encodeFilters=function(t,n){if(n===void 0){n="filters"}var r=[];for(var i in t){if(Object.prototype.hasOwnProperty.call(t,i)){var e=t[i];var a=n?"".concat(n,"[").concat(i,"]"):i;if(Array.isArray(e)){for(var s=0;s<e.length;s++){r.push("".concat(a,"[").concat(s,"]=").concat(e[s]))}}else if(typeof e==="object"&&e!==null){r.push(this.encodeFilters(e,a))}else{var o="".concat(a,"=").concat(e);r.push(o)}}}return r.join("&")};t.prototype.resetFilters=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.removeFiltersQueryParams();this.filtersData={};this.host.childNodes.forEach((function(t){return t.reset&&t.reset()}));salla.event.emit("salla-filters::reset");return[2,this.applyFilters()]}))}))};t.prototype.removeFiltersQueryParams=function(){var t=new URLSearchParams(window.location.search);var n=Array.from(t.keys()).filter((function(t){return!t.startsWith("filters[")})).map((function(n){return"".concat(encodeURIComponent(n),"=").concat(encodeURIComponent(t.get(n)))})).join("&");var r=n?"".concat(window.location.pathname,"?").concat(n):window.location.pathname;window.history.pushState({},"",r)};t.prototype.handleOptionChange=function(t,n,r){if(n.type===s.RANGE){this.filtersData[n.key]=r}var i=t.target.checked;if(n.type===s.VARIANTS){this.filtersData.variants=this.filtersData.variants||{};i&&(this.filtersData.variants[n.key]=r);i||delete this.filtersData.variants[n.key]}else if(t.target.type=="radio"){i&&(this.filtersData[n.key]=r);i||delete this.filtersData[n.key]}else if(t.target.type=="checkbox"){this.filtersData[n.key]=this.filtersData[n.key]||[];if(i){this.filtersData[n.key].push(r)}this.filtersData[n.key]=this.filtersData[n.key].filter((function(t){return t!=r}))}this.applyFilters()};t.prototype.render=function(){var t=this;var n,r;return i(e,{key:"d62d9a867f140a911cb5da11a1034511fd230745"},(n=this.filters)===null||n===void 0?void 0:n.map((function(n){return i("salla-filters-widget",{option:n,filtersData:t.filtersData,onChanged:function(n){var r=n.detail,i=r.event,e=r.option,a=r.value;t.handleOptionChange(i,e,a)}})})),((r=this.filters)===null||r===void 0?void 0:r.length)?i("div",{class:"s-filters-footer"},i("salla-button",{color:"gray",fill:"outline",onClick:function(){return t.resetFilters()}},this.reset)):"")};t.prototype.componentDidLoad=function(){this.isReady=true};Object.defineProperty(t.prototype,"host",{get:function(){return a(this)},enumerable:false,configurable:true});return t}());f.style=u}}}));
|
|
5
|
+
//# sourceMappingURL=p-67ebf87e.system.entry.js.map
|