@salla.sa/twilight-components 2.14.228 → 2.14.229
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-CywMIIRz.js → app-globals-BpIPTuWk.js} +3 -3
- package/dist/cjs/{app-globals-CywMIIRz.js.map → app-globals-BpIPTuWk.js.map} +1 -1
- package/dist/cjs/{index-0hx4qRUA.js → index-KccCEykN.js} +4 -4
- package/dist/cjs/{index-0hx4qRUA.js.map → index-KccCEykN.js.map} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- 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 +4 -4
- 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 +1 -1
- 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 +2 -2
- package/dist/collection/components/salla-conditional-offer/salla-conditional-offer.js +3 -3
- package/dist/collection/components/salla-conditional-offer/salla-conditional-offer.js.map +1 -1
- package/dist/components/index.js +2 -2
- package/dist/components/index.js.map +1 -1
- package/dist/components/salla-conditional-offer.js +3 -3
- package/dist/components/salla-conditional-offer.js.map +1 -1
- package/dist/esm/{app-globals-CUKRDLAx.js → app-globals-BZCILndm.js} +3 -3
- package/dist/esm/{app-globals-CUKRDLAx.js.map → app-globals-BZCILndm.js.map} +1 -1
- package/dist/esm/{index-CNDQzdP7.js → index-uTwIMGTZ.js} +4 -4
- package/dist/esm/{index-CNDQzdP7.js.map → index-uTwIMGTZ.js.map} +1 -1
- package/dist/esm/loader.js +3 -3
- 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 +4 -4
- 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 +1 -1
- 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 +3 -3
- package/dist/esm-es5/{app-globals-CUKRDLAx.js → app-globals-BZCILndm.js} +2 -2
- package/dist/esm-es5/{app-globals-CUKRDLAx.js.map → app-globals-BZCILndm.js.map} +1 -1
- package/dist/esm-es5/{index-CNDQzdP7.js → index-uTwIMGTZ.js} +3 -3
- package/dist/esm-es5/{index-CNDQzdP7.js.map → index-uTwIMGTZ.js.map} +1 -1
- 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 +1 -1
- 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 +1 -1
- package/dist/esm-es5/salla-notification-item.entry.js +1 -1
- package/dist/esm-es5/salla-notifications.entry.js +1 -1
- package/dist/esm-es5/salla-offer.entry.js +1 -1
- package/dist/esm-es5/salla-order-summary.entry.js +1 -1
- package/dist/esm-es5/salla-orders.entry.js +1 -1
- 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 +1 -1
- 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-66c7a2e8.system.entry.js → p-06121f61.system.entry.js} +2 -2
- package/dist/twilight/{p-f2645988.entry.js → p-064991bd.entry.js} +2 -2
- package/dist/twilight/{p-0f3534fc.system.entry.js → p-08ae39fd.system.entry.js} +2 -2
- package/dist/twilight/{p-11d8de98.system.entry.js → p-0cf232d4.system.entry.js} +2 -2
- package/dist/twilight/{p-beac6d8e.entry.js → p-0ed72423.entry.js} +2 -2
- package/dist/twilight/{p-4f256783.entry.js → p-13ef30ff.entry.js} +2 -2
- package/dist/twilight/{p-fb61d02c.entry.js → p-160cef1c.entry.js} +2 -2
- package/dist/twilight/{p-c991e16b.entry.js → p-1c1f2e96.entry.js} +6 -6
- package/dist/twilight/{p-3e3ec5b5.entry.js → p-2147132d.entry.js} +2 -2
- package/dist/twilight/{p-e34c37d6.system.entry.js → p-230824bf.system.entry.js} +2 -2
- package/dist/twilight/{p-1a000178.system.entry.js → p-2539d9a9.system.entry.js} +2 -2
- package/dist/twilight/{p-c25ee5db.entry.js → p-258fdfe8.entry.js} +2 -2
- package/dist/twilight/{p-7e11444f.entry.js → p-29984c80.entry.js} +2 -2
- package/dist/twilight/{p-9a1eac46.entry.js → p-2f83207c.entry.js} +2 -2
- package/dist/twilight/{p-5704f84e.system.entry.js → p-36c7e6d7.system.entry.js} +2 -2
- package/dist/twilight/{p-71d4f300.system.entry.js → p-3862ded8.system.entry.js} +2 -2
- package/dist/twilight/{p-8b35c143.system.entry.js → p-3fbc0740.system.entry.js} +2 -2
- package/dist/twilight/{p-0169eec4.entry.js → p-45620cb5.entry.js} +2 -2
- package/dist/twilight/{p-850cc43e.system.entry.js → p-45af6d5f.system.entry.js} +2 -2
- package/dist/twilight/{p-e6efb7f9.system.entry.js → p-481b6bcf.system.entry.js} +2 -2
- package/dist/twilight/{p-bc48d7b8.system.entry.js → p-48ab4e24.system.entry.js} +2 -2
- package/dist/twilight/{p-9165a64d.entry.js → p-4befb128.entry.js} +2 -2
- package/dist/twilight/{p-b39543c1.system.entry.js → p-4f852631.system.entry.js} +2 -2
- package/dist/twilight/{p-39f531cc.entry.js → p-51f461f3.entry.js} +2 -2
- package/dist/twilight/{p-e23170f9.system.entry.js → p-550cae04.system.entry.js} +2 -2
- package/dist/twilight/{p-b5bb38a8.entry.js → p-560b9ba3.entry.js} +2 -2
- package/dist/twilight/{p-c7692780.entry.js → p-56a2f2ce.entry.js} +2 -2
- package/dist/twilight/{p-6957616a.entry.js → p-58e3f07b.entry.js} +2 -2
- package/dist/twilight/{p-331e6845.system.entry.js → p-5d544da2.system.entry.js} +2 -2
- package/dist/twilight/p-600fc4be.system.entry.js +5 -0
- package/dist/twilight/p-600fc4be.system.entry.js.map +1 -0
- package/dist/twilight/{p-8446830b.system.entry.js → p-6899a6f6.system.entry.js} +2 -2
- package/dist/twilight/p-70db2d4e.system.entry.js +5 -0
- package/dist/twilight/{p-149de98d.entry.js → p-751d4aad.entry.js} +2 -2
- package/dist/twilight/{p-590216eb.entry.js → p-7bd3640b.entry.js} +2 -2
- package/dist/twilight/{p-0b2cb090.entry.js → p-80700df9.entry.js} +2 -2
- package/dist/twilight/{p-8dc7bd7e.entry.js → p-80bc850c.entry.js} +2 -2
- package/dist/twilight/{p-08e57dc8.entry.js → p-80ce5698.entry.js} +2 -2
- package/dist/twilight/{p-43f297d3.entry.js → p-81b86d4b.entry.js} +2 -2
- package/dist/twilight/{p-73ea40c2.system.entry.js → p-845bfe77.system.entry.js} +2 -2
- package/dist/twilight/{p-4489393c.system.entry.js → p-8504d011.system.entry.js} +2 -2
- package/dist/twilight/{p-5621e1a0.entry.js → p-8645f64f.entry.js} +2 -2
- package/dist/twilight/{p-ERYBUQyA.system.js.map → p-886vx98h.system.js.map} +1 -1
- package/dist/twilight/{p-e160c850.system.entry.js → p-88d35160.system.entry.js} +2 -2
- package/dist/twilight/{p-BcWqsmX2.system.js.map → p-8Rer7EXu.system.js.map} +1 -1
- package/dist/twilight/{p-D0A3U0he.system.js.map → p-8nixWS15.system.js.map} +1 -1
- package/dist/twilight/{p-973b4a3b.system.entry.js → p-9d658a72.system.entry.js} +2 -2
- package/dist/twilight/p-9d8cb3df.entry.js +5 -0
- package/dist/twilight/p-9d8cb3df.entry.js.map +1 -0
- package/dist/twilight/{p-b32a3ff9.entry.js → p-9f2daf11.entry.js} +2 -2
- package/dist/twilight/{p-A5LotHFs.system.js.map → p-B0xOcfR4.system.js.map} +1 -1
- package/dist/twilight/{p-DUTAFn8C.system.js.map → p-B6NDuIUg.system.js.map} +1 -1
- package/dist/twilight/{p-CBqzu3xn.system.js.map → p-BURJU68j.system.js.map} +1 -1
- package/dist/twilight/{p-sDk273rP.system.js.map → p-BVO7DM0I.system.js.map} +1 -1
- package/dist/twilight/{p-DDibL7s9.system.js.map → p-Bm9P2AqL.system.js.map} +1 -1
- package/dist/twilight/{p-BdjxDTWq.system.js → p-BoX1YoZL.system.js} +2 -2
- package/dist/twilight/{p-BdjxDTWq.system.js.map → p-BoX1YoZL.system.js.map} +1 -1
- package/dist/twilight/{p-DZw1UYox.system.js.map → p-Bq5_nH5K.system.js.map} +1 -1
- package/dist/twilight/{p-7RKo2TrS.system.js.map → p-BsiQgjhg.system.js.map} +1 -1
- package/dist/twilight/{p-Bw-w1vO5.system.js.map → p-BxD1RjlT.system.js.map} +1 -1
- package/dist/twilight/{p-zeaQ7puS.system.js.map → p-C3kspn6z.system.js.map} +1 -1
- package/dist/twilight/{p-CFLu8Qr5.system.js.map → p-CEnEuqvr.system.js.map} +1 -1
- package/dist/twilight/{p-vBTXOrr5.system.js → p-CO2c0tFL.system.js} +2 -2
- package/dist/twilight/{p-vBTXOrr5.system.js.map → p-CO2c0tFL.system.js.map} +1 -1
- package/dist/twilight/{p-BkrCg4Tl.system.js.map → p-CQIP-F6y.system.js.map} +1 -1
- package/dist/twilight/{p-BqcDdYxx.system.js.map → p-CT5QEbCs.system.js.map} +1 -1
- package/dist/twilight/{p-BpTGIHt8.system.js.map → p-C_c7nRps.system.js.map} +1 -1
- package/dist/twilight/{p-DcDP1ooH.system.js → p-Chzz_LDL.system.js} +3 -3
- package/dist/twilight/{p-DcDP1ooH.system.js.map → p-Chzz_LDL.system.js.map} +1 -1
- package/dist/twilight/{p-Bizi6Y8w.system.js.map → p-ClUIbKLz.system.js.map} +1 -1
- package/dist/twilight/{p-C6ZcRXfC.js → p-Cpv-H9QO.js} +2 -2
- package/dist/twilight/{p-C6ZcRXfC.js.map → p-Cpv-H9QO.js.map} +1 -1
- package/dist/twilight/{p-CFI-2rTe.system.js.map → p-CsOXnUlA.system.js.map} +1 -1
- package/dist/twilight/{p-BhGLFial.system.js.map → p-CtfG8vJk.system.js.map} +1 -1
- package/dist/twilight/{p-DFmdxLJn.system.js.map → p-CuRphQ2O.system.js.map} +1 -1
- package/dist/twilight/{p-CJcCCRXC.system.js.map → p-D2UsHEOo.system.js.map} +1 -1
- package/dist/twilight/{p-CVgn2oKO.system.js.map → p-D9djE3u9.system.js.map} +1 -1
- package/dist/twilight/{p-tG6tZrRA.system.js.map → p-DPvbVDUB.system.js.map} +1 -1
- package/dist/twilight/p-DXIQmqRW.system.js.map +1 -0
- package/dist/twilight/{p-BFDx-9R3.system.js.map → p-DlrkegKC.system.js.map} +1 -1
- package/dist/twilight/{p-CIokohPT.system.js.map → p-Dm3YFK8c.system.js.map} +1 -1
- package/dist/twilight/{p-DRquBHEo.system.js.map → p-DpcgwSax.system.js.map} +1 -1
- package/dist/twilight/{p-DUS17Zz-.system.js.map → p-Ow-kOnfX.system.js.map} +1 -1
- package/dist/twilight/{p-CQw6hbqN.system.js.map → p-Q3qz1aQg.system.js.map} +1 -1
- package/dist/twilight/{p-CMpqjkGm.system.js.map → p-UXdSmY3n.system.js.map} +1 -1
- package/dist/twilight/{p-1mI1fhai.system.js.map → p-a0EYQzL3.system.js.map} +1 -1
- package/dist/twilight/{p-c3552207.entry.js → p-a16ecc9d.entry.js} +2 -2
- package/dist/twilight/{p-4d553bba.system.entry.js → p-a222ad24.system.entry.js} +2 -2
- package/dist/twilight/{p-a7654fed.system.entry.js → p-aaab96da.system.entry.js} +2 -2
- package/dist/twilight/{p-00b8c002.entry.js → p-afbbbb73.entry.js} +2 -2
- package/dist/twilight/{p-2fdc2aec.system.entry.js → p-b112893e.system.entry.js} +2 -2
- package/dist/twilight/{p-c6df4072.system.entry.js → p-b30f4481.system.entry.js} +2 -2
- package/dist/twilight/{p-78e79386.system.entry.js → p-b5bbcf1a.system.entry.js} +2 -2
- package/dist/twilight/{p-43a00683.system.entry.js → p-bac69caa.system.entry.js} +2 -2
- package/dist/twilight/{p-8940c4cc.entry.js → p-bc947447.entry.js} +2 -2
- package/dist/twilight/{p-7f010a1f.system.entry.js → p-bf5d5375.system.entry.js} +2 -2
- package/dist/twilight/{p-a5ab889e.system.entry.js → p-c2319979.system.entry.js} +2 -2
- package/dist/twilight/{p-cffc4a47.entry.js → p-c6b5fa5c.entry.js} +2 -2
- package/dist/twilight/{p-fd2c4c29.entry.js → p-cb577695.entry.js} +2 -2
- package/dist/twilight/{p-12865797.entry.js → p-cf16c5b6.entry.js} +2 -2
- package/dist/twilight/{p-6674ff60.entry.js → p-d6d158ac.entry.js} +2 -2
- package/dist/twilight/{p-33caa5c9.system.entry.js → p-db051ac6.system.entry.js} +2 -2
- package/dist/twilight/{p-6ae8297d.system.entry.js → p-ea313a20.system.entry.js} +2 -2
- package/dist/twilight/{p-0fb4368c.entry.js → p-eee1b538.entry.js} +2 -2
- package/dist/twilight/{p-0acc337d.system.entry.js → p-f134bc31.system.entry.js} +2 -2
- package/dist/twilight/{p-38fc8939.system.entry.js → p-f718fce5.system.entry.js} +2 -2
- package/dist/twilight/{p-06721e7c.entry.js → p-fb6a0296.entry.js} +2 -2
- package/dist/twilight/{p-C5YV0HRP.system.js.map → p-jFQLtU7n.system.js.map} +1 -1
- package/dist/twilight/{p-DNTy-aSU.system.js.map → p-nx-q5kJr.system.js.map} +1 -1
- package/dist/twilight/{p-CNDQzdP7.js → p-uTwIMGTZ.js} +3 -3
- package/dist/twilight/{p-CNDQzdP7.js.map → p-uTwIMGTZ.js.map} +1 -1
- package/dist/twilight/{p-7mw7ykXE.system.js.map → p-uqDS_0s2.system.js.map} +1 -1
- package/dist/twilight/salla-conditional-offer.entry.esm.js.map +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/twilight/twilight.js +1 -1
- package/package.json +5 -5
- package/dist/twilight/p-22e25d12.entry.js +0 -5
- package/dist/twilight/p-22e25d12.entry.js.map +0 -1
- package/dist/twilight/p-Cz_wOczc.system.js.map +0 -1
- package/dist/twilight/p-c9907836.system.entry.js +0 -5
- package/dist/twilight/p-c9907836.system.entry.js.map +0 -1
- package/dist/twilight/p-d5780002.system.entry.js +0 -5
- /package/dist/twilight/{p-66c7a2e8.system.entry.js.map → p-06121f61.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-f2645988.entry.js.map → p-064991bd.entry.js.map} +0 -0
- /package/dist/twilight/{p-0f3534fc.system.entry.js.map → p-08ae39fd.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-11d8de98.system.entry.js.map → p-0cf232d4.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-beac6d8e.entry.js.map → p-0ed72423.entry.js.map} +0 -0
- /package/dist/twilight/{p-4f256783.entry.js.map → p-13ef30ff.entry.js.map} +0 -0
- /package/dist/twilight/{p-fb61d02c.entry.js.map → p-160cef1c.entry.js.map} +0 -0
- /package/dist/twilight/{p-c991e16b.entry.js.map → p-1c1f2e96.entry.js.map} +0 -0
- /package/dist/twilight/{p-3e3ec5b5.entry.js.map → p-2147132d.entry.js.map} +0 -0
- /package/dist/twilight/{p-e34c37d6.system.entry.js.map → p-230824bf.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-1a000178.system.entry.js.map → p-2539d9a9.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-c25ee5db.entry.js.map → p-258fdfe8.entry.js.map} +0 -0
- /package/dist/twilight/{p-7e11444f.entry.js.map → p-29984c80.entry.js.map} +0 -0
- /package/dist/twilight/{p-9a1eac46.entry.js.map → p-2f83207c.entry.js.map} +0 -0
- /package/dist/twilight/{p-5704f84e.system.entry.js.map → p-36c7e6d7.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-71d4f300.system.entry.js.map → p-3862ded8.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-8b35c143.system.entry.js.map → p-3fbc0740.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-0169eec4.entry.js.map → p-45620cb5.entry.js.map} +0 -0
- /package/dist/twilight/{p-850cc43e.system.entry.js.map → p-45af6d5f.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-e6efb7f9.system.entry.js.map → p-481b6bcf.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-bc48d7b8.system.entry.js.map → p-48ab4e24.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-9165a64d.entry.js.map → p-4befb128.entry.js.map} +0 -0
- /package/dist/twilight/{p-b39543c1.system.entry.js.map → p-4f852631.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-39f531cc.entry.js.map → p-51f461f3.entry.js.map} +0 -0
- /package/dist/twilight/{p-e23170f9.system.entry.js.map → p-550cae04.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-b5bb38a8.entry.js.map → p-560b9ba3.entry.js.map} +0 -0
- /package/dist/twilight/{p-c7692780.entry.js.map → p-56a2f2ce.entry.js.map} +0 -0
- /package/dist/twilight/{p-6957616a.entry.js.map → p-58e3f07b.entry.js.map} +0 -0
- /package/dist/twilight/{p-331e6845.system.entry.js.map → p-5d544da2.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-8446830b.system.entry.js.map → p-6899a6f6.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-d5780002.system.entry.js.map → p-70db2d4e.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-149de98d.entry.js.map → p-751d4aad.entry.js.map} +0 -0
- /package/dist/twilight/{p-590216eb.entry.js.map → p-7bd3640b.entry.js.map} +0 -0
- /package/dist/twilight/{p-0b2cb090.entry.js.map → p-80700df9.entry.js.map} +0 -0
- /package/dist/twilight/{p-8dc7bd7e.entry.js.map → p-80bc850c.entry.js.map} +0 -0
- /package/dist/twilight/{p-08e57dc8.entry.js.map → p-80ce5698.entry.js.map} +0 -0
- /package/dist/twilight/{p-43f297d3.entry.js.map → p-81b86d4b.entry.js.map} +0 -0
- /package/dist/twilight/{p-73ea40c2.system.entry.js.map → p-845bfe77.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-4489393c.system.entry.js.map → p-8504d011.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-5621e1a0.entry.js.map → p-8645f64f.entry.js.map} +0 -0
- /package/dist/twilight/{p-e160c850.system.entry.js.map → p-88d35160.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-973b4a3b.system.entry.js.map → p-9d658a72.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-b32a3ff9.entry.js.map → p-9f2daf11.entry.js.map} +0 -0
- /package/dist/twilight/{p-c3552207.entry.js.map → p-a16ecc9d.entry.js.map} +0 -0
- /package/dist/twilight/{p-4d553bba.system.entry.js.map → p-a222ad24.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-a7654fed.system.entry.js.map → p-aaab96da.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-00b8c002.entry.js.map → p-afbbbb73.entry.js.map} +0 -0
- /package/dist/twilight/{p-2fdc2aec.system.entry.js.map → p-b112893e.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-c6df4072.system.entry.js.map → p-b30f4481.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-78e79386.system.entry.js.map → p-b5bbcf1a.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-43a00683.system.entry.js.map → p-bac69caa.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-8940c4cc.entry.js.map → p-bc947447.entry.js.map} +0 -0
- /package/dist/twilight/{p-7f010a1f.system.entry.js.map → p-bf5d5375.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-a5ab889e.system.entry.js.map → p-c2319979.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-cffc4a47.entry.js.map → p-c6b5fa5c.entry.js.map} +0 -0
- /package/dist/twilight/{p-fd2c4c29.entry.js.map → p-cb577695.entry.js.map} +0 -0
- /package/dist/twilight/{p-12865797.entry.js.map → p-cf16c5b6.entry.js.map} +0 -0
- /package/dist/twilight/{p-6674ff60.entry.js.map → p-d6d158ac.entry.js.map} +0 -0
- /package/dist/twilight/{p-33caa5c9.system.entry.js.map → p-db051ac6.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-6ae8297d.system.entry.js.map → p-ea313a20.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-0fb4368c.entry.js.map → p-eee1b538.entry.js.map} +0 -0
- /package/dist/twilight/{p-0acc337d.system.entry.js.map → p-f134bc31.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-38fc8939.system.entry.js.map → p-f718fce5.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-06721e7c.entry.js.map → p-fb6a0296.entry.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var __awaiter=this&&this.__awaiter||function(t,s,e,n){function i(t){return t instanceof e?t:new e((function(s){s(t)}))}return new(e||(e=Promise))((function(e,r){function c(t){try{a(n.next(t))}catch(t){r(t)}}function o(t){try{a(n["throw"](t))}catch(t){r(t)}}function a(t){t.done?e(t.value):i(t.value).then(c,o)}a((n=n.apply(t,s||[])).next())}))};var __generator=this&&this.__generator||function(t,s){var e={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},n,i,r,c;return c={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(c[Symbol.iterator]=function(){return this}),c;function o(t){return function(s){return a([t,s])}}function a(o){if(n)throw new TypeError("Generator is already executing.");while(c&&(c=0,o[0]&&(e=0)),e)try{if(n=1,i&&(r=o[0]&2?i["return"]:o[0]?i["throw"]||((r=i["return"])&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;if(i=0,r)o=[o[0]&2,r.value];switch(o[0]){case 0:case 1:r=o;break;case 4:e.label++;return{value:o[1],done:false};case 5:e.label++;i=o[1];o=[0];continue;case 7:o=e.ops.pop();e.trys.pop();continue;default:if(!(r=e.trys,r=r.length>0&&r[r.length-1])&&(o[0]===6||o[0]===2)){e=0;continue}if(o[0]===3&&(!r||o[1]>r[0]&&o[1]<r[3])){e.label=o[1];break}if(o[0]===6&&e.label<r[1]){e.label=r[1];r=o;break}if(r&&e.label<r[2]){e.label=r[2];e.ops.push(o);break}if(r[2])e.ops.pop();e.trys.pop();continue}o=s.call(t,e)}catch(t){o=[6,t];i=0}finally{n=r=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
|
-
*/import{r as registerInstance,h}from"./index-
|
|
4
|
+
*/import{r as registerInstance,h}from"./index-uTwIMGTZ.js";import{S as SpecialDiscountIcon,A as ArrowDownIcon}from"./special-discount-yRO-ZESF.js";import{G as GiftIcon}from"./gift-C0JNGIpa.js";var TagMoneyIcon='\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 FireIcon='\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 DiscountCouponIcon='\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';var sallaCartItemOffersCss=":host{display:block}";var SallaCartItemOffers=function(){function t(t){var s=this;registerInstance(this,t);this.internalOffers=[];this.showAll=false;this.freeLabel="";this.receivedOffer="";this.discountAmountLabel="";this.showMoreOffers="";this.icons={DiscountCouponIcon:DiscountCouponIcon,GiftIcon:GiftIcon,FireIcon:FireIcon,SpecialDiscountIcon:SpecialDiscountIcon,TagMoneyIcon:TagMoneyIcon};this.visibleOffersCount=3;this.handleCartItemUpdated=function(t){var e=t.data.cart.items.find((function(t){return t.id===s.itemId}));if((e===null||e===void 0?void 0:e.id)===s.itemId){s.internalQuantity=e.quantity;s.internalOffers=e.detailed_offers||[];s.internalProductPrice=e.product_price}};this.toggleShowAll=function(){s.showAll=!s.showAll}}t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(s){switch(s.label){case 0:return[4,Salla.onReady()];case 1:s.sent();return[4,salla.lang.onLoaded((function(){t.freeLabel=salla.lang.get("common.elements.freeExclam");t.receivedOffer=salla.lang.get("pages.cart.received_offer");t.discountAmountLabel=salla.lang.get("pages.cart.discount_amount");t.showMoreOffers=salla.lang.get("pages.cart.show_more_offers")}))];case 2:s.sent();this.internalQuantity=this.quantity;this.internalOffers=this.parseOffers(this.offers);this.internalProductPrice=this.productPrice;return[2]}}))}))};t.prototype.componentDidLoad=function(){var t=this;salla.event.on("cart::item.updated",(function(s){return t.handleCartItemUpdated(s)}))};t.prototype.parseOffers=function(t){try{if(typeof t!=="string"){console.warn("Offers is not a string. Returning as-is.",t);return Array.isArray(t)?t:[]}return JSON.parse(t||"[]")}catch(t){console.error("Failed to parse offers",t);return[]}};Object.defineProperty(t.prototype,"visibleOffers",{get:function(){return this.internalOffers.slice(0,this.visibleOffersCount)},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"hiddenOffers",{get:function(){return this.internalOffers.slice(this.visibleOffersCount)},enumerable:false,configurable:true});t.prototype.getPaidQty=function(t,s){return t-s.free_quantity};t.prototype.renderOffer=function(t,s){var e=this.getPaidQty(t,s);return h("div",{class:"s-cart-item-offers-box"},s.free_quantity>0&&e>0&&h("div",{class:"s-cart-item-offers-paid-free"},h("div",{class:"s-cart-item-offers-line"},salla.helpers.number(e)," × ",h("span",{innerHTML:salla.money(this.internalProductPrice)})),h("div",{class:"s-cart-item-offers-line"},salla.helpers.number(s.free_quantity)," ×",h("span",{class:"s-cart-item-offers-regular-price",innerHTML:salla.money(this.internalProductPrice)}),h("span",{class:"s-cart-item-offers-free-label"},this.freeLabel))),h("div",{class:"s-cart-item-offers-details"},h("span",{class:"s-cart-item-offers-icon",innerHTML:this.icons[s.discount_icon]||""}),h("div",null,h("p",{class:"s-cart-item-offers-title"},this.receivedOffer.replace(":offer",s.offer_name)),h("p",{class:"s-cart-item-offers-discount"},h("span",{innerHTML:this.discountAmountLabel.replace(":amount",salla.money(s.discount_amount.toFixed(2)))})))))};t.prototype.render=function(){var t=this;var s,e;if(!((s=this.internalOffers)===null||s===void 0?void 0:s.length)){return null}return h("div",{class:"s-cart-item-offers-container",id:"offers_list_".concat(this.itemId)},this.visibleOffers.map((function(s){return t.renderOffer(t.internalQuantity,s)})),((e=this.internalOffers)===null||e===void 0?void 0:e.length)>this.visibleOffersCount&&h("div",{class:"s-cart-item-offers-show-more"},h("button",{class:"s-cart-item-offers-show-more-btn",onClick:this.toggleShowAll,type:"button"},h("span",{class:"s-cart-item-offers-show-more-label"},"+",this.hiddenOffers.length," ",this.showMoreOffers,h("span",{innerHTML:ArrowDownIcon,class:{"s-cart-item-offers-arrow-icon":true,"s-cart-item-offers-arrow-open":this.showAll}})))),this.showAll&&h("div",{class:"s-cart-item-offers-collapsed",id:"offers_".concat(this.itemId)},this.hiddenOffers.map((function(s){return t.renderOffer(t.internalQuantity,s)}))))};return t}();SallaCartItemOffers.style=sallaCartItemOffersCss;export{SallaCartItemOffers as salla_cart_item_offers};
|
|
5
5
|
//# sourceMappingURL=salla-cart-item-offers.entry.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as registerInstance,h,H as Host}from"./index-
|
|
4
|
+
import{r as registerInstance,h,H as Host}from"./index-uTwIMGTZ.js";var DiscountType;(function(i){i["PERCENTAGE"]="percentage";i["FIXED"]="fixed";i["FREE_PRODUCT"]="free_product"})(DiscountType||(DiscountType={}));var OfferType;(function(i){i["PRODUCT_COUNT"]="products_count";i["PRODUCT_PURCHASE"]="order_amount"})(OfferType||(OfferType={}));var sallaConditionalOfferCss=":host{display:block}";var SallaConditionalOffer=function(){function i(i){registerInstance(this,i);this.offer=null;this.products={};this.isLoading=false;this.canRender=true}i.prototype.componentWillLoad=function(){var i=this;salla.onReady().then((function(){var i,n,t;if(!((i=salla.config.get("store.features"))===null||i===void 0?void 0:i.includes("conditional-offer"))||salla.storage.get("cart")!==""&&!((t=(n=salla.storage.get("cart"))===null||n===void 0?void 0:n.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(n){var t=n.data;i.offer=t.find((function(i){return i.type==="conditional"}));if(!i.offer){i.canRender=false;return}i.isLoading=true;i.offer.details.discounts.unshift({value:0,min_spend:0});return i.updateInitialOfferValue()})).then((function(){if(!i.offer)return;return i.getProducts()})).then((function(){if(!i.offer)return;salla.event.on("cart::updated",(function(n){return i.updateOfferValues(n)}))})).catch((function(n){i.canRender=false;salla.logger.warn("salla-conditional-offer:: ",n)})).finally((function(){i.isLoading=false}))};i.prototype.getProducts=function(){var i=this;var n=this.offer.details.discounts.filter((function(i){var n=i.type;return n===DiscountType.FREE_PRODUCT})).map((function(i){var n=i.value;return n}));if(n.length>0){return salla.product.fetch({source:"selected",source_value:n}).then((function(n){var t=n.data;t.forEach((function(n){var t=n.id,e=n.url,o=n.image;i.products[t]={url:e,image:o}}))}))}};i.prototype.updateInitialOfferValue=function(){var i=this;return salla.api.cart.details().then((function(n){var t=n.data.cart;return i.updateOfferValues(t)}))};i.prototype.updateOfferValues=function(i){var n=i.items,t=i.sub_total;var e,o;var r=this.offer.details.based_on===OfferType.PRODUCT_COUNT?(e=n===null||n===void 0?void 0:n.reduce((function(i,n){var t=n.quantity;return i+t}),0))!==null&&e!==void 0?e:0:t;this.offer=Object.assign(Object.assign({},this.offer),{details:Object.assign(Object.assign({},(o=this.offer)===null||o===void 0?void 0:o.details),{current_value:r})});return this.offer};i.prototype.getCheckpointContent=function(i){var n,t;if(i.type===DiscountType.PERCENTAGE)return"".concat(i.value,"%");if(i.type===DiscountType.FIXED)return salla.money(i.value);if(i.type!==DiscountType.FREE_PRODUCT){salla.logger.error("salla-conditional-offer:: unexpected type (".concat(i.type,")!"));return""}var e=this.products[i.value];if(!e){salla.logger.error("salla-conditional-offer:: there is no product with id (".concat(i.value,")!"));return""}return h("a",{class:"s-conditional-offer-product-link",href:e.url},h("img",{class:"s-conditional-offer-checkpoint-image-content",loading:"lazy",decoding:"async",alt:((n=e===null||e===void 0?void 0:e.image)===null||n===void 0?void 0:n.alt)||"",src:(t=e===null||e===void 0?void 0:e.image)===null||t===void 0?void 0:t.url}))};i.prototype.getOfferType=function(i){var n;var t=(n=this.offer.details)===null||n===void 0?void 0:n.based_on;if(t===OfferType.PRODUCT_COUNT)return salla.lang.choice("blocks.header.products_count",i.min_spend);if(t===OfferType.PRODUCT_PURCHASE)return salla.money(i.min_spend);salla.logger.warn("salla-conditional-offer:: Unexpected offer detail's based_on value: ".concat(t));return"".concat(i.min_spend)};i.prototype.clamp=function(i,n,t){return Math.max(n,Math.min(i,t))};i.prototype.mapValueRanges=function(i,n,t,e,o){var r=(i-n)*(o-e)/(t-n)+e;if(r===Number.POSITIVE_INFINITY)return 100;if(r===Number.NEGATIVE_INFINITY)return 0;return this.clamp(r,0,100)};i.prototype.getCheckPointView=function(i,n){var t,e;var o=this.offer.details.discounts.findIndex((function(n){var t=n.min_spend;return t===i.min_spend}));var r=(e=(t=this.offer.details.discounts[o-1])===null||t===void 0?void 0:t.min_spend)!==null&&e!==void 0?e:0;var a=this.mapValueRanges(this.offer.details.current_value,r,i.min_spend,0,100);var s=i.min_spend<=this.offer.details.current_value;return h("div",{class:"s-conditional-offer-checkpoint-container"},n>0?[h("div",{key:"progress-line",class:"s-conditional-offer-progress-line-container"},h("div",{class:"s-conditional-offer-progress-line-inactive"}),h("div",{class:"s-conditional-offer-progress-line-active",style:{width:"".concat(a,"%")}})),h("div",{key:"checkpoint",class:"s-conditional-offer-checkpoint ".concat(s?"s-conditional-offer-active-checkpoint":"")},h("div",{class:"s-conditional-offer-item-avatar-content ".concat(s?"active":""),innerHTML:this.products&&this.getCheckpointContent(i)}),h("div",{class:"s-conditional-offer-checkpoint-label ".concat(s?"active":""),innerHTML:this.getOfferType(i)}))]:h("div",{key:"label",class:{"s-conditional-offer-checkpoint-label":true,"first-checkpoint":n===0,active:s},innerHTML:this.getOfferType(i)}))};i.prototype.getLoadingSkeletonView=function(){return h(Host,{class:"s-conditional-offer-container"},h("div",{class:"s-conditional-offer-skeleton-inner-container"},h("div",{class:"s-conditional-offer-skeleton-subtitle"},h("salla-skeleton",{height:"16px",width:"30%"})),h("div",{class:"s-conditional-offer-skeleton-subtitle"},h("salla-skeleton",{height:"16px",width:"35%"})),h("div",{class:"s-conditional-offer-skeleton-checkpoints-wrapper"},Array(3).fill(null).map((function(){return[h("salla-skeleton",{key:"checkpoint-line",height:"8px"}),h("div",{key:"checkpoint"},h("salla-skeleton",{height:"60px",width:"60px",type:"circle"}))]})))))};i.prototype.render=function(){var i=this;if(!this.canRender)return null;if(this.isLoading)return this.getLoadingSkeletonView();if(!this.offer)return null;return h(Host,{class:"s-conditional-offer-container"},h("div",{class:"s-conditional-offer-title-wrapper"},h("div",{class:"s-conditional-offer-title"},this.offer.title),this.offer.description?h("div",{class:"s-conditional-offer-subtitle"},this.offer.description," ",h("i",{class:"sicon-information"})):null),h("div",{class:"s-conditional-offer-progress-container"},this.offer.details.discounts.map((function(n,t){return h("div",{class:{"flex-1":t>0},key:n.min_spend},i.getCheckPointView(n,t))}))))};return i}();SallaConditionalOffer.style=sallaConditionalOfferCss;export{SallaConditionalOffer as salla_conditional_offer};
|
|
5
5
|
//# sourceMappingURL=salla-conditional-offer.entry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"salla-conditional-offer.entry.js","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"],"names":[],"mappings":";;;;;AAEA,IAAY,YAIX;AAJD,CAAA,UAAY,YAAY,EAAA;AACpB,IAAA,YAAA,CAAA,YAAA,CAAA,GAAA,YAAyB;AACzB,IAAA,YAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,YAAA,CAAA,cAAA,CAAA,GAAA,cAA6B;AACjC,CAAC,EAJW,YAAY,KAAZ,YAAY,GAIvB,EAAA,CAAA,CAAA;AAED,IAAY,SAGX;AAHD,CAAA,UAAY,SAAS,EAAA;AACjB,IAAA,SAAA,CAAA,eAAA,CAAA,GAAA,gBAAgC;AAChC,IAAA,SAAA,CAAA,kBAAA,CAAA,GAAA,cAAiC;AACrC,CAAC,EAHW,SAAS,KAAT,SAAS,GAGpB,EAAA,CAAA,CAAA;;ACXD,MAAM,wBAAwB,GAAG,sBAAsB;;MCc1C,qBAAqB,GAAA,MAAA;AAJlC,IAAA,WAAA,CAAA,OAAA,EAAA;;AAMa,QAAA,IAAK,CAAA,KAAA,GAAU,IAAI;AACnB,QAAA,IAAQ,CAAA,QAAA,GAAmD,EAAE;AAC7D,QAAA,IAAS,CAAA,SAAA,GAAG,KAAK;AACjB,QAAA,IAAS,CAAA,SAAA,GAAG,IAAI;AAwL5B;IAtLG,iBAAiB,GAAA;AACb,QAAA,KAAK,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,MAAK;;YACtB,IAAI,EAAC,CAAA,EAAA,GAAA,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,gBAAgB,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AAC,2BAA2B,EAAA,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAO,EAC9D,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,CAAA,CAAA,KAAA,EAAA,EAAK,KAAK,EAAC,8BAA8B,EAAA,EAC9D,IAAI,CAAC,KAAK,CAAC,WAAW,OAAE,CAAG,CAAA,GAAA,EAAA,EAAA,KAAK,EAAC,mBAAmB,EAAA,CAAG,CACtD,GAAG,IAAI,CACX,EACN,CAAK,CAAA,KAAA,EAAA,EAAA,KAAK,EAAC,wCAAwC,EAC9C,EAAA,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,MAC9C,CAAK,CAAA,KAAA,EAAA,EAAA,KAAK,EAAE,EAAE,QAAQ,EAAE,KAAK,GAAG,CAAC,EAAE,EAAE,GAAG,EAAE,QAAQ,CAAC,SAAS,EACvD,EAAA,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,KAAK,CAAC,CACtC,CACT,CAAC,CACA,CACH;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"salla-conditional-offer.entry.js","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) ?? 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"],"names":[],"mappings":";;;;;AAEA,IAAY,YAIX;AAJD,CAAA,UAAY,YAAY,EAAA;AACpB,IAAA,YAAA,CAAA,YAAA,CAAA,GAAA,YAAyB;AACzB,IAAA,YAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,YAAA,CAAA,cAAA,CAAA,GAAA,cAA6B;AACjC,CAAC,EAJW,YAAY,KAAZ,YAAY,GAIvB,EAAA,CAAA,CAAA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C,CAAK,CAAA,KAAA,EAAA,EAAA,KAAK,EAAE,EAAE,QAAQ,EAAE,KAAK,GAAG,CAAC,EAAE,EAAE,GAAG,EAAE,QAAQ,CAAC,SAAS,EACvD,EAAA,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,KAAK,CAAC,CACtC,CACT,CAAC,CACA,CACH;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as registerInstance,h,H as Host,g as getElement}from"./index-
|
|
4
|
+
import{r as registerInstance,h,H as Host,g as getElement}from"./index-uTwIMGTZ.js";import{w as whatsapp}from"./whatsapp2-DWksgowB.js";import{M as MailIcon}from"./mail-DmgxDvXL.js";var mobile='\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>iphone</title>\n<path d="M15.053 27.613c0.133 0.12 0.28 0.213 0.44 0.28s0.333 0.107 0.507 0.107c0.36 0 0.693-0.135 0.947-0.387 0.12-0.135 0.213-0.28 0.28-0.44 0.080-0.16 0.107-0.333 0.107-0.507 0-0.347-0.147-0.695-0.387-0.947-0.507-0.493-1.387-0.493-1.893 0-0.12 0.12-0.213 0.267-0.28 0.44-0.067 0.16-0.107 0.333-0.107 0.507s0.040 0.347 0.107 0.507 0.16 0.305 0.28 0.44zM24 0h-16c-2.205 0-4 1.795-4 4v24c0 2.205 1.795 4 4 4h16c2.205 0 4-1.795 4-4v-24c0-2.205-1.795-4-4-4zM25.333 28c0 0.736-0.599 1.333-1.333 1.333h-16c-0.735 0-1.333-0.597-1.333-1.333v-4h18.667zM25.333 21.333h-18.667v-17.333c0-0.735 0.599-1.333 1.333-1.333h16c0.735 0 1.333 0.599 1.333 1.333z"></path>\n</svg>\n';var phone='\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>phone</title>\n<path d="M30.823 21.713l-3.883-3.883c-1.569-1.568-4.12-1.568-5.689 0l-2.568 2.568c-3.063-1.499-5.583-4.019-7.081-7.083l2.568-2.567c0.759-0.76 1.177-1.771 1.177-2.845s-0.419-2.084-1.179-2.844l-3.881-3.881c-1.52-1.521-4.171-1.521-5.689 0l-1.845 1.847c-2.22 2.219-3.183 5.407-2.573 8.527 1.98 10.144 10.125 18.292 20.269 20.271 0.616 0.121 1.236 0.18 1.849 0.18 2.492 0 4.896-0.972 6.677-2.752l1.847-1.847c1.568-1.571 1.568-4.121 0.001-5.691zM28.936 25.517l-1.845 1.847c-1.592 1.592-3.883 2.283-6.132 1.841-9.089-1.776-16.388-9.075-18.163-18.165-0.439-2.247 0.249-4.539 1.841-6.129l1.847-1.847c0.256-0.257 0.596-0.397 0.959-0.397s0.703 0.14 0.959 0.397l3.883 3.883c0.256 0.256 0.397 0.596 0.397 0.959s-0.141 0.703-0.397 0.96l-3.22 3.217c-0.383 0.384-0.496 0.959-0.287 1.457 1.813 4.339 5.343 7.868 9.683 9.684 0.497 0.207 1.073 0.095 1.457-0.288l3.22-3.22c0.529-0.529 1.389-0.528 1.917 0l3.881 3.883c0.528 0.529 0.528 1.389 0 1.919z"></path>\n</svg>\n';var telegram='\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>paper-plane-o</title>\n<path d="M31.5 0.482c0.375 0.268 0.554 0.696 0.482 1.143l-4.571 27.429c-0.054 0.339-0.268 0.625-0.571 0.804-0.161 0.089-0.357 0.143-0.554 0.143-0.143 0-0.286-0.036-0.429-0.089l-9.411-3.839-5.321 5.839c-0.214 0.25-0.518 0.375-0.839 0.375-0.143 0-0.286-0.018-0.411-0.071-0.446-0.179-0.732-0.607-0.732-1.071v-8.071l-8.429-3.446c-0.411-0.161-0.679-0.536-0.714-0.982-0.036-0.429 0.196-0.839 0.571-1.054l29.714-17.143c0.375-0.232 0.857-0.214 1.214 0.036zM25.393 27.25l3.946-23.625-25.607 14.768 6 2.446 15.411-11.411-8.536 14.232z"></path>\n</svg>\n';var sallaContactsCss=".unicode{unicode-bidi:-webkit-plaintext;unicode-bidi:plaintext}";var SallaContacts=function(){function t(t){var s=this;registerInstance(this,t);var n;this.contacts=salla.config.get("store.contacts");this.iconsList={mobile:mobile,whatsapp:whatsapp,phone:phone,telegram:telegram,email:MailIcon};this.contactSlot=((n=this.host.querySelector('[slot="contact"]'))===null||n===void 0?void 0:n.innerHTML)||'<a href={link} class="s-contacts-item"><span class="s-contacts-icon">{icon}</span>'.concat(!this.iconsOnly&&"<span class='unicode'>{value}</span>","</a>");salla.onReady((function(){s.contacts=salla.config.get("store.contacts")}));salla.lang.onLoaded((function(){s.contactsTitle=s.contactsTitle||salla.lang.get("blocks.footer.social")}))}t.prototype.getContactsArray=function(){return Object.entries(this.contacts).filter((function(t){var s=t[0],n=t[1];return n!==""})).map((function(t){var s=t[0],n=t[1];return{type:s,value:n}}))};t.prototype.getContactLink=function(t){var s=this.contacts[t];switch(t){case"phone":case"mobile":return"tel:".concat(s);case"whatsapp":return salla.url.get("whatsapp/send");case"email":return"mailto:".concat(s);case"telegram":return s.startsWith("https://t.me/")?s:"https://t.me/".concat(s);default:return s}};t.prototype.getContactIcon=function(t){return this.iconsList[t]};t.prototype.componentWillLoad=function(){return new Promise((function(t){return salla.onReady(t)}))};t.prototype.render=function(){var t=this;var s=this.getContactsArray();if(!s||s.length==0){return}if(this.isHeader){return h(Host,{class:"s-contacts s-contacts-header"},s.filter((function(t){return t.type=="phone"||t.type=="email"})).map((function(s,n){return h("a",{href:t.getContactLink(s.type),key:n,class:"s-contacts-topnav-link"},s.type==="email"?s.value:[h("span",null,t.contactsTitle,": "),h("a",{class:"unicode",href:t.iconsList[s.type]},s.value)])})))}return h(Host,{class:"s-contacts"},!this.hideTitle&&h("h3",{class:"s-contacts-title"},this.contactsTitle),h("div",{class:{"s-contacts-list":true,"s-contacts-list-horizontal":this.horizontal,"s-contacts-list-vertical":!this.horizontal,"s-contacts-list-icons-only":this.iconsOnly}},s.map((function(s,n){return h("div",{key:n,id:"contact-slot",innerHTML:t.contactSlot.replace(/\{icon\}/g,t.getContactIcon(s.type)).replace(/\{value\}/g,s.value.toString()).replace(/\{link\}/g,t.getContactLink(s.type))})}))))};t.prototype.componentDidRender=function(){var t;(t=this.host.querySelector('[slot="contact"]'))===null||t===void 0?void 0:t.remove()};Object.defineProperty(t.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();SallaContacts.style=sallaContactsCss;export{SallaContacts as salla_contacts};
|
|
5
5
|
//# sourceMappingURL=salla-contacts.entry.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var __awaiter=this&&this.__awaiter||function(t,e,i,n){function s(t){return t instanceof i?t:new i((function(e){e(t)}))}return new(i||(i=Promise))((function(i,r){function a(t){try{f(n.next(t))}catch(t){r(t)}}function o(t){try{f(n["throw"](t))}catch(t){r(t)}}function f(t){t.done?i(t.value):s(t.value).then(a,o)}f((n=n.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var i={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},n,s,r,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(t){return function(e){return f([t,e])}}function f(o){if(n)throw new TypeError("Generator is already executing.");while(a&&(a=0,o[0]&&(i=0)),i)try{if(n=1,s&&(r=o[0]&2?s["return"]:o[0]?s["throw"]||((r=s["return"])&&r.call(s),0):s.next)&&!(r=r.call(s,o[1])).done)return r;if(s=0,r)o=[o[0]&2,r.value];switch(o[0]){case 0:case 1:r=o;break;case 4:i.label++;return{value:o[1],done:false};case 5:i.label++;s=o[1];o=[0];continue;case 7:o=i.ops.pop();i.trys.pop();continue;default:if(!(r=i.trys,r=r.length>0&&r[r.length-1])&&(o[0]===6||o[0]===2)){i=0;continue}if(o[0]===3&&(!r||o[1]>r[0]&&o[1]<r[3])){i.label=o[1];break}if(o[0]===6&&i.label<r[1]){i.label=r[1];r=o;break}if(r&&i.label<r[2]){i.label=r[2];i.ops.push(o);break}if(r[2])i.ops.pop();i.trys.pop();continue}o=e.call(t,i)}catch(t){o=[6,t];s=0}finally{n=r=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
|
-
*/import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-
|
|
4
|
+
*/import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-uTwIMGTZ.js";import{H as Helper}from"./Helper-CzEjEM5j.js";import{F as FilterOptionTypes}from"./interfaces-DL4h2bc3.js";import"./anime.es-CgtvEd63.js";var sallaFiltersWidgetCss=":host{display:block}";var SallaFiltersWidget=function(){function t(t){registerInstance(this,t);this.changed=createEvent(this,"changed");this.initHeight=195;this.isOpen=true;this.isShowMore=false;this.showMoreLabel="عرض المزيد";this.showLessLabel="عرض أقل";this.page=salla.config.get("page")}t.prototype.connectedCallback=function(){var t=this;this.withLoadMore=this.option.key!="price"&&Array.isArray(this.option.values)&&this.option.values.length>8;salla.onReady((function(){t.page=salla.config.get("page")}));salla.lang.onLoaded((function(){t.showMoreLabel=salla.lang.getWithDefault("common.titles.more",t.showMoreLabel);t.showLessLabel=salla.lang.getWithDefault("common.elements.show_less",t.showLessLabel)}))};t.prototype.componentDidLoad=function(){this.widgetValues.scrollHeight<this.initHeight&&(this.withLoadMore=false);this.withLoadMore&&this.widgetValues&&(this.widgetValues.style.maxHeight="".concat(this.initHeight,"px"));this.widgetContent.style.height="".concat(this.widgetContent.scrollHeight,"px")};t.prototype.setWidgetHeight=function(){return __awaiter(this,arguments,void 0,(function(t){var e=this;if(t===void 0){t=250}return __generator(this,(function(i){this.widgetContent.removeAttribute("style");setTimeout((function(){var t=e.widgetContent.scrollHeight;e.widgetContent.style.height=t+"px"}),t);return[2]}))}))};t.prototype.reset=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){if(this.option.type===FilterOptionTypes.RANGE){this.priceRange.reset()}Array.from(this.host.querySelectorAll("input")).forEach((function(t){return t.checked=false}));return[2]}))}))};t.prototype.showMore=function(){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(e){this.isShowMore=!this.isShowMore;this.widgetContent.style.height="auto";this.widgetValues.style.maxHeight=this.isShowMore?"".concat(this.widgetValues.scrollHeight,"px"):"".concat(this.initHeight,"px");setTimeout((function(){t.widgetContent.style.height="".concat(t.widgetContent.scrollHeight,"px")}),400);return[2]}))}))};t.prototype.toggleWidget=function(){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(e){this.isOpen=!this.isOpen;Helper.toggleElementClassIf(this.widgetContent,"s-filters-widget-opened","s-filters-widget-closed",(function(){return t.isOpen}));return[2]}))}))};t.prototype.renderFilterOption=function(t){var e=this;if(![FilterOptionTypes.VALUES,FilterOptionTypes.MINIMUM,FilterOptionTypes.VARIANTS].includes(t.type)){return""}return t.values.map((function(i,n){var s=typeof i=="number"?i:i.key||i.value;return h("label",{class:"s-filters-label",htmlFor:"".concat(t.key,"-option-").concat(s),key:"".concat(t.key,"-option-").concat(s)},h("input",{id:"".concat(t.key,"-option-").concat(s),name:t.key,type:"radio",checked:e.isSelectedOption(t,s),class:"s-filters-radio",onChange:function(i){return e.changed.emit({event:i,option:t,value:s})}}),e.getOptionLabel(t,i))}))};t.prototype.isSelectedOption=function(t,e){if(t.type===FilterOptionTypes.MINIMUM){return this.filtersData[t.key]==e}if(t.type===FilterOptionTypes.VARIANTS){return this.filtersData[t.type]&&this.filtersData[t.type][Object.keys(this.filtersData[t.type])[0]]==e}if(t.type===FilterOptionTypes.RANGE){return this.filtersData[t.key]&&this.filtersData[t.key].min==e.min&&this.filtersData[t.key].max==e.max}if(t.type===FilterOptionTypes.VALUES){return this.filtersData[t.key]&&Number(this.filtersData[t.key])==Number(e)}return false};t.prototype.getOptionLabel=function(t,e){if(t.key=="rating"){return h("salla-rating-stars",{size:"small",value:e})}var i=e.value||"null";return h("span",{class:"s-filters-option-name"},i)};t.prototype.render=function(){var t=this;return h(Host,{key:"d6f2078b058a8244a95a78e879886f3b04e0e1c0",class:"s-filters-widget-container"},h("h3",{key:"40ff9f985604de49752b38c0fc66611cd1811857",class:"s-filters-widget-title",onClick:function(){return t.toggleWidget()}},h("span",{key:"06847af2f3f089afb3223e4ce4c56bfa1cb195d5"},this.option.label),h("span",{key:"8ecf9c638f7ad163cda5f7235ecac66661cf8e68",class:"s-filters-widget-plusminus ".concat(this.isOpen?"s-filters-widget-plusminus-active":"")})),h("div",{key:"15c98c71532ec2bf1f43f3e9bcc1d964a0f3d88d",class:"s-filters-widget-content",ref:function(e){return t.widgetContent=e}},h("div",{key:"f1221b0ce096e1fda0044776bfdba952a990230c",class:"s-filters-widget-values",ref:function(e){return t.widgetValues=e}},h("slot",{key:"1612242828f38a9c086d2a7887174bcdde05618b"}),this.option.type!==FilterOptionTypes.RANGE?this.renderFilterOption(this.option):h("salla-price-range",{onChanged:function(e){t.changed.emit(e.detail)},ref:function(e){return t.priceRange=e},filtersData:this.filtersData,option:this.option})),this.withLoadMore&&h("a",{key:"5726822a429c26ee9ddadaf7351e8d32a3a98695",class:"s-filters-widget-more",onClick:function(){return t.showMore()}},!this.isShowMore?this.showMoreLabel:this.showLessLabel)))};Object.defineProperty(t.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();SallaFiltersWidget.style=sallaFiltersWidgetCss;export{SallaFiltersWidget as salla_filters_widget};
|
|
5
5
|
//# sourceMappingURL=salla-filters-widget.entry.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var __awaiter=this&&this.__awaiter||function(t,e,r,i){function n(t){return t instanceof r?t:new r((function(e){e(t)}))}return new(r||(r=Promise))((function(r,a){function s(t){try{l(i.next(t))}catch(t){a(t)}}function o(t){try{l(i["throw"](t))}catch(t){a(t)}}function l(t){t.done?r(t.value):n(t.value).then(s,o)}l((i=i.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,n,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(e){return l([t,e])}}function l(o){if(i)throw new TypeError("Generator is already executing.");while(s&&(s=0,o[0]&&(r=0)),r)try{if(i=1,n&&(a=o[0]&2?n["return"]:o[0]?n["throw"]||((a=n["return"])&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;if(n=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++;n=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=e.call(t,r)}catch(t){o=[6,t];n=0}finally{i=a=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
|
-
*/import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-
|
|
4
|
+
*/import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-uTwIMGTZ.js";import{F as FilterOptionTypes}from"./interfaces-DL4h2bc3.js";import{H as Helper}from"./Helper-CzEjEM5j.js";import"./anime.es-CgtvEd63.js";var sallaFiltersCss=":host{display:block}.s-rating-stars-small{line-height:12px}.s-filters-radio{background-image:none !important}";var SallaFilters=function(){function t(t){var e=this;registerInstance(this,t);this.changed=createEvent(this,"changed");this.isReady=false;this.filtersData={};salla.event.on("filters::hidden",(function(){return e.host.style.display="none"}));salla.lang.onLoaded((function(){e.apply=salla.lang.get("pages.checkout.apply");e.reset=salla.lang.get("pages.categories.filters_reset")}));salla.event.on("filters::fetched",(function(t){var r=t.filters;e.host.style.display="";var i={};e.filters=r.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=FilterOptionTypes.VALUES;var r=t.values,n=r.max,a=r.min;t.values=[5,4,3,2,1].filter((function(t){return t>=a||t<=n}))}if(e.filtersData.variants&&t.type==FilterOptionTypes.VARIANTS){i.variants=e.filtersData.variants}if(e.filtersData[t.key]&&t.type!==FilterOptionTypes.VARIANTS){i[t.key]=e.filtersData[t.key]}var s=new URLSearchParams(window.location.search);var o=false;for(var l=0,f=s.keys();l<f.length;l++){var u=f[l];if(u.includes("filters")){o=true;break}}if(salla.config.get("page.slug")=="product.index"&&Object.keys(i).length==0&&!o){var c=window.location.href;var h=salla.config.get("page.id");var d=c.indexOf("?")!==-1?"&":"?";var v=c+d+"filters[category_id]="+h;i.category_id=h;window.history.pushState({path:v},"",v)}return t}));e.filtersData=i;e.host.childNodes.forEach((function(t){return __awaiter(e,void 0,void 0,(function(){var e;return __generator(this,(function(r){switch(r.label){case 0:e=t.setWidgetHeight;if(!e)return[3,2];return[4,t.setWidgetHeight()];case 1:e=r.sent();r.label=2;case 2:return[2,e]}}))}))}))}))}t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var t,e,r;return __generator(this,(function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);t=new URLSearchParams(window.location.search);e=this;return[4,Helper.extractFiltersFromUrl(t)];case 1:e.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 e=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 n=0,a=i.searchParams.entries();n<a.length;n++){var s=a[n][0];if(s.startsWith("filters")){i.searchParams.delete(s)}}var o=e.encodeFilters(e.filtersData);var l=i.search.split("&").filter((function(t){return!t.includes("filters")})).join("&");if(l){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",e.filtersData);e.changed.emit(e.filtersData)}),300);return[2]}))}))};t.prototype.encodeFilters=function(t,e){if(e===void 0){e="filters"}var r=[];for(var i in t){if(Object.prototype.hasOwnProperty.call(t,i)){var n=t[i];var a=e?"".concat(e,"[").concat(i,"]"):i;if(Array.isArray(n)){for(var s=0;s<n.length;s++){r.push("".concat(a,"[").concat(s,"]=").concat(n[s]))}}else if(typeof n==="object"&&n!==null){r.push(this.encodeFilters(n,a))}else{var o="".concat(a,"=").concat(n);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 e=Array.from(t.keys()).filter((function(t){return!t.startsWith("filters[")})).map((function(e){return"".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(t.get(e)))})).join("&");var r=e?"".concat(window.location.pathname,"?").concat(e):window.location.pathname;window.history.pushState({},"",r)};t.prototype.handleOptionChange=function(t,e,r){if(e.type===FilterOptionTypes.RANGE){this.filtersData[e.key]=r}var i=t.target.checked;if(e.type===FilterOptionTypes.VARIANTS){this.filtersData.variants=this.filtersData.variants||{};i&&(this.filtersData.variants[e.key]=r);i||delete this.filtersData.variants[e.key]}else if(t.target.type=="radio"){i&&(this.filtersData[e.key]=r);i||delete this.filtersData[e.key]}else if(t.target.type=="checkbox"){this.filtersData[e.key]=this.filtersData[e.key]||[];if(i){this.filtersData[e.key].push(r)}this.filtersData[e.key]=this.filtersData[e.key].filter((function(t){return t!=r}))}this.applyFilters()};t.prototype.render=function(){var t=this;var e,r;return h(Host,{key:"d62d9a867f140a911cb5da11a1034511fd230745"},(e=this.filters)===null||e===void 0?void 0:e.map((function(e){return h("salla-filters-widget",{option:e,filtersData:t.filtersData,onChanged:function(e){var r=e.detail,i=r.event,n=r.option,a=r.value;t.handleOptionChange(i,n,a)}})})),((r=this.filters)===null||r===void 0?void 0:r.length)?h("div",{class:"s-filters-footer"},h("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 getElement(this)},enumerable:false,configurable:true});return t}();SallaFilters.style=sallaFiltersCss;export{SallaFilters as salla_filters};
|
|
5
5
|
//# sourceMappingURL=salla-filters.entry.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var __awaiter=this&&this.__awaiter||function(t,a,i,e){function n(t){return t instanceof i?t:new i((function(a){a(t)}))}return new(i||(i=Promise))((function(i,r){function s(t){try{l(e.next(t))}catch(t){r(t)}}function o(t){try{l(e["throw"](t))}catch(t){r(t)}}function l(t){t.done?i(t.value):n(t.value).then(s,o)}l((e=e.apply(t,a||[])).next())}))};var __generator=this&&this.__generator||function(t,a){var i={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},e,n,r,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(a){return l([t,a])}}function l(o){if(e)throw new TypeError("Generator is already executing.");while(s&&(s=0,o[0]&&(i=0)),i)try{if(e=1,n&&(r=o[0]&2?n["return"]:o[0]?n["throw"]||((r=n["return"])&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;if(n=0,r)o=[o[0]&2,r.value];switch(o[0]){case 0:case 1:r=o;break;case 4:i.label++;return{value:o[1],done:false};case 5:i.label++;n=o[1];o=[0];continue;case 7:o=i.ops.pop();i.trys.pop();continue;default:if(!(r=i.trys,r=r.length>0&&r[r.length-1])&&(o[0]===6||o[0]===2)){i=0;continue}if(o[0]===3&&(!r||o[1]>r[0]&&o[1]<r[3])){i.label=o[1];break}if(o[0]===6&&i.label<r[1]){i.label=r[1];r=o;break}if(r&&i.label<r[2]){i.label=r[2];i.ops.push(o);break}if(r[2])i.ops.pop();i.trys.pop();continue}o=a.call(t,i)}catch(t){o=[6,t];n=0}finally{e=r=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
|
-
*/import{r as registerInstance,h,H as Host,g as getElement}from"./index-CNDQzdP7.js";var sallaInstallmentCss="salla-installment:empty{display:none}#tabbyPromoWrapper{background:white;border-radius:0.375rem;-webkit-transition:-webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:-webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1), -webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);margin-bottom:20px;border:unset !important;font-weight:500}.salla-y #tabbyPromoWrapper{border:1px solid var(--color-grey-dark);border-radius:12px}#tabbyPromoWrapper:hover{-webkit-box-shadow:0 0 rgba(0, 0, 0, 0), 0 0 rgba(0, 0, 0, 0), 5px 10px 30px rgba(43, 45, 52, 0.0509803922);box-shadow:0 0 rgba(0, 0, 0, 0), 0 0 rgba(0, 0, 0, 0), 5px 10px 30px rgba(43, 45, 52, 0.0509803922)}#tabbyPromoWrapper #tabbyPromo *{font-family:var(--font-main)}#tabbyPromoWrapper #tabbyPromo>div>div{max-width:none;-webkit-box-shadow:none;box-shadow:none;border:none}#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet{max-width:100%;min-height:100px;padding:18px 20px;border:none !important}#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet__text,#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet__link{font-size:var(--font-sm);color:var(--color-text) !important}#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet__link{font-weight:bold}.tabby-promo-wrapper #tabby-promo{font-family:var(--font-main) !important}.tabby-promo-wrapper #tabby-promo .tabby-promo__feature-title{font-size:var(--font-md)}.tabby-promo-wrapper #tabby-promo .tabby-promo__feature-desc{font-size:var(--font-sm);line-height:20px}.tamara-product-widget{margin-bottom:20px}.tamara-product-widget,.spotii-wrapper{min-height:100px;position:relative;color:var(--main-text-color);font-size:var(--font-sm);line-height:1.25;padding:20px 20px 20px 115px !important;background:white;border-radius:0.375rem;-webkit-transition:-webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:-webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1), -webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);border:unset !important;font-family:inherit !important;font-weight:500}.salla-y .tamara-product-widget,.salla-y .spotii-wrapper{border-radius:12px;border:1px solid var(--color-grey-dark)}.tamara-product-widget:hover,.spotii-wrapper:hover{-webkit-box-shadow:0 0 rgba(0, 0, 0, 0), 0 0 rgba(0, 0, 0, 0), 5px 10px 30px rgba(43, 45, 52, 0.0509803922);box-shadow:0 0 rgba(0, 0, 0, 0), 0 0 rgba(0, 0, 0, 0), 5px 10px 30px rgba(43, 45, 52, 0.0509803922)}.tamara-product-widget .spotii-logo,.spotii-wrapper .spotii-logo{float:left;margin:0 0 0 -75px}.ltr .tamara-product-widget,.ltr .spotii-wrapper{text-align:left;padding:18px 100px 18px 20px !important}.ltr .tamara-product-widget .spotii-logo,.ltr .spotii-wrapper .spotii-logo{float:right;margin:0 -75px 0 0}.ltr .tamara-product-widget .spotii-product-widget,.ltr .spotii-wrapper .spotii-product-widget{text-align:left !important}.spotii-wrapper{margin-bottom:20px}.spotii-wrapper .spotii-promo{font-size:var(--font-md)}.spotii-wrapper .spotii-product-widget{font-size:var(--font-sm) !important;margin-top:10px}.tamara-product-widget .tamara-logo{position:absolute;left:20px !important;top:35px !important;margin:0 !important;height:24px !important}.ltr .tamara-product-widget .tamara-logo{right:20px !important;left:auto !important}.tamara-product-widget span{font-family:var(--font-main);font-size:var(--font-sm);color:var(--color-text)}.tamara-product-widget span:last-child{display:block;position:relative;margin-top:8px}.tamara-popup__wrap{overflow:auto !important}.s-installment-mispay-wrapper,.s-installment-madfu-wrapper,.s-installment-emkan-wrapper,.s-installment-rajehi-wrapper{font-size:14px;text-align:right;padding:20px;gap:42px;line-height:22px;color:rgb(0, 0, 0);min-width:100%;-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;background-color:white;border-radius:10px;margin:15px 0;display:-ms-flexbox;display:flex;-webkit-transition:-webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:-webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1), -webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1)}.s-installment-mispay-wrapper:hover,.s-installment-madfu-wrapper:hover,.s-installment-emkan-wrapper:hover,.s-installment-rajehi-wrapper:hover{-webkit-box-shadow:0 0 rgba(0, 0, 0, 0), 0 0 rgba(0, 0, 0, 0), 5px 10px 30px rgba(43, 45, 52, 0.0509803922);box-shadow:0 0 rgba(0, 0, 0, 0), 0 0 rgba(0, 0, 0, 0), 5px 10px 30px rgba(43, 45, 52, 0.0509803922)}.s-installment-mispay-content,.s-installment-madfu-content,.s-installment-emkan-content,.s-installment-rajehi-content{display:-ms-flexbox;display:flex;-ms-flex-direction:row-reverse;flex-direction:row-reverse;width:100%;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;gap:1rem}.s-installment-mispay-content-text,.s-installment-madfu-content-text,.s-installment-emkan-content-text,.s-installment-rajehi-content-text{color:var(--main-text-color);font-size:14px;font-weight:500;margin:0 16px 0 0;width:80%;left:14px;text-align:left}.s-installment-mispay-content img,.s-installment-madfu-content img,.s-installment-emkan-content img,.s-installment-rajehi-content img{height:28px;width:70px;display:inline-block;max-height:100%;vertical-align:middle;fill:none;stroke:unset;width:auto}.rtl .s-installment-mispay-content-text,.rtl .s-installment-madfu-content-text,.rtl .s-installment-emkan-content-text,.rtl .s-installment-rajehi-content-text{right:14px;text-align:right;margin:0 0 0 16px}.rtl .s-installment-mispay-content img,.rtl .s-installment-madfu-content img,.rtl .s-installment-emkan-content img,.rtl .s-installment-rajehi-content img{left:14px !important}.ltr .s-installment-mispay-content img,.ltr .s-installment-madfu-content img,.ltr .s-installment-emkan-content img,.ltr .s-installment-rajehi-content img{right:14px !important}.s-installment-rajehi-content img{width:70px !important;height:40px !important}.s-installment-emkan-content img{height:35px !important}";var SallaInstallment=function(){function t(t){registerInstance(this,t);this.tabbyBorderRemoved=false;this.tabbyRemoveBorderTries=0;this.language=salla.config.get("user.language_code");this.currency=salla.config.get("user.currency_code");this.country=salla.config.get("user.country_code");this.installment_sheria_text=function(t,a){return salla.lang.get(t,a)}}t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var t,a;var i=this;return __generator(this,(function(e){switch(e.label){case 0:return[4,salla.onReady()];case 1:e.sent();return[4,salla.lang.onLoaded()];case 2:e.sent();this.currency=salla.config.get("user.currency_code")||"SAR";this.language=salla.config.get("user.language_code")||"ar";this.country=salla.config.get("user.country_code")||"SA";t=[{key:"pages.products.installments",installments:3},{key:"pages.products.installments_emkan",installments:5}];t.forEach((function(t){i.installment_sheria_text(t.key,{payment:salla.money(parseFloat(i.price)),amount:salla.money((parseFloat(i.price)/t.installments).toFixed(2)).replace(/\.00$/,""),installments:t.installments})}));a=salla.config.get("store.settings.installments");if(a){this.tamaraIsActive=a.tamara;this.tabbyIsActive=a.tabby;this.spotiiIsActive=a.spotii;this.mispayActive=a.mispay;this.emkanIsActive=a.emkan;this.madfuActive=a.madfu;this.rajehiIsActive=a.mokafaa_alrajhi}salla.event.on("product::price.updated",(function(t){var a=t.data;if(!a.price||a.price==i.price){return}i.price=a.price;i.renderInstallments(true)}));return[2]}}))}))};t.prototype.componentDidLoad=function(){this.renderInstallments()};t.prototype.render=function(){var t;var a=this.currency==="SAR";if(!this.isValidPrice(this.price)){return""}return h(Host,null,this.tamaraIsActive&&(((t=this.tamaraIsActive)===null||t===void 0?void 0:t.publicKey)?h("div",{class:"mb-5"},h("tamara-widget",{type:"tamara-summary","inline-type":"2",amount:this.price})):h("div",{class:"tamara-product-widget","data-price":this.price,"data-currency":this.currency,"data-lang":this.language,"data-payment-type":"installment"})),this.tabbyIsActive?h("div",{id:"tabbyPromoWrapper"},h("div",{id:"tabbyPromo"})):"",this.spotiiIsActive?h("div",{class:"spotii-wrapper"},h("div",{class:"spotii-promo"})):"",this.shouldShowMispay()&&(this.mispayActive.publicKey?h("div",{class:"mb-5"},h("mispay-widget",{amount:this.price,lang:this.language})):h("div",{class:"s-installment-mispay-wrapper"},h("div",{class:"s-installment-mispay-content"},h("img",{src:salla.url.cdn("images/payment/png/mispay.png"),alt:"mispay"}),h("span",{class:"s-installment-mispay-content-text",innerHTML:this.installment_sheria_text("pages.products.installments",{payment:salla.money(parseFloat(this.price)),amount:salla.money((parseFloat(this.price)/4).toFixed(2)),installments:4})})))),this.emkanIsActive&&this.currency==="SAR"?h("div",{class:"s-installment-emkan-wrapper"},h("div",{class:"s-installment-emkan-content"},h("img",{src:salla.url.cdn("images/payment/png/emkan.png"),alt:"emkan"}),h("span",{class:"s-installment-emkan-content-text",innerHTML:this.installment_sheria_text("pages.products.installments_emkan",{payment:salla.money(parseFloat(this.price)),installments:5})}))):"",this.madfuActive&&this.currency==="SAR"?h("div",{class:"s-installment-madfu-wrapper"},h("div",{class:"s-installment-madfu-content"},h("img",{src:salla.url.cdn("images/payment/png/madfu.png"),alt:"madfu"}),h("span",{class:"s-installment-madfu-content-text"},salla.lang.get("pages.products.installments_madfu")))):"",a&&this.rajehiIsActive?h("div",{class:"s-installment-rajehi-wrapper"},h("div",{class:"s-installment-rajehi-content"},h("img",{src:salla.url.cdn("images/payment/png/mokafaa_alrajhi_loyalty.png"),alt:"mokafaa_alrajhi_loyalty"}),h("span",{class:"s-installment-rajehi-content-text"},salla.lang.get("pages.products.rajahi_earn_points",{points:Math.floor(+this.price*this.rajehiIsActive.pointsPerRiyal)})))):"")};t.prototype.renderInstallments=function(t){var a=this;if(t===void 0){t=false}if(!this.isValidPrice(this.price)){return}if(this.tamaraIsActive){this.loadTamara({isUpdating:t})}if(this.tabbyIsActive){if(t){var i=this.host.querySelector("#tabbyPromoWrapper");if(i){i.remove()}var e=document.createElement("div");e.setAttribute("id","tabbyPromoWrapper");var n=document.createElement("div");n.setAttribute("id","tabbyPromo");e.appendChild(n);this.host.appendChild(e);var r=document.querySelector('script[src="https://checkout.tabby.ai/tabby-promo.js"]');if(r){r.remove()}}var s=document.createElement("script");s.setAttribute("src","https://checkout.tabby.ai/tabby-promo.js");document.head.appendChild(s);s.onload=function(){var t=window.TabbyPromo;new t({selector:"#tabbyPromo",currency:a.currency,price:a.price,lang:a.language,publicKey:salla.config.get("store.settings.installments.tabby.publicKey"),merchantCode:salla.config.get("store.settings.installments.tabby.merchantCode")});document.querySelectorAll(".tabby-promo-snippet__logo").forEach((function(t){t.setAttribute("aria-label","Tabby Logo")}))};this.removeTabbyBorder()}if(this.spotiiIsActive){if(t){var o=this.host.querySelector(".spotii-wrapper");if(o){o.remove()}var l=document.createElement("div");l.classList.add("spotii-wrapper");var p=document.createElement("div");p.classList.add("spotii-promo");l.appendChild(p);this.host.appendChild(l);var m=document.querySelector('script[src="'+salla.url.cdn("js/price-widget-ar-salla.js")+'"]');if(m){m.remove()}}var c=salla.money((Number(this.price)/3).toFixed(2),false);var d=salla.config.get("theme.is_rtl",true);window.spotiiConfig={targetXPath:[".spotii-wrapper"],renderToPath:[".spotii-promo"],numberOfPayment:3,currency:this.currency,templateLine:"${textOne} ${number} ${textTwo} "+c+"${logo} ${info}",textOne:d?"جزء الدفع على":"Split it into",textTwo:d?"أقساط متساوية بدون تكاليف اضافية بقيمة":"payments of",textThree:"مع",price:this.price};var h=document.createElement("script");h.setAttribute("src",salla.url.cdn("js/price-widget-ar-salla.js"));document.head.appendChild(h)}if(this.shouldShowMispay()&&this.mispayActive.publicKey){this.loadExternalScript({position:"head",src:"https://widget.mispay.co/v1/sdk.js?authorize=".concat(this.mispayActive.publicKey)})}};t.prototype.isValidPrice=function(t){var a=/^\d+(\.\d{1,2})?$/;var i=a.test(t);var e=parseFloat(t)>0;return i&&e};t.prototype.loadExternalScript=function(t){var a=t.src,i=t.onLoad,e=t.position;var n=document.createElement("script");n.src=a;n.onload=i;document[e].appendChild(n)};t.prototype.loadTamara=function(t){var a=this;var i=t.isUpdating;var e,n;var r=!!((e=this.tamaraIsActive)===null||e===void 0?void 0:e.publicKey);if(i){setTimeout((function(){var t,a;if(r){return(t=window.TamaraWidgetV2)===null||t===void 0?void 0:t.refresh()}(a=window.TamaraProductWidget)===null||a===void 0?void 0:a.render()}),300)}else{if(r){var s=salla.config.get("user.language_code");var o=["ar","en"].includes(s)?s:"ar";var l=(n=this.currency)===null||n===void 0?void 0:n.slice(0,-1);var p=["SA","AE","KW","BH","OM","QA"].includes(l)?l:null;if(!p){console.error("Tamara: Country code is not supported",l)}else{window.tamaraWidgetConfig={lang:o,country:p,publicKey:this.tamaraIsActive.publicKey,style:{fontSize:"14px"}};this.loadExternalScript({position:"head",src:"https://cdn.tamara.co/widget-v2/tamara-widget.js"})}}else{this.loadExternalScript({position:"head",src:"https://cdn.tamara.co/widget/product-widget.min.js",onLoad:function(){window.TamaraProductWidget.init({lang:a.language});setTimeout((function(){window.TamaraProductWidget.render()}),300)}})}}};t.prototype.shouldShowMispay=function(){return this.currency==="SAR"&&this.mispayActive};t.prototype.removeTabbyBorder=function(){var t=this;if(this.tabbyBorderRemoved||this.tabbyRemoveBorderTries>5){return}this.tabbyRemoveBorderTries++;setTimeout((function(){var a=document.querySelector("#tabbyPromo>div>div");a=a&&a.shadowRoot?a.shadowRoot.querySelector('div[class^="styles__tabby-promo-snippet--"]'):null;if(a){a.style="border: none; margin: 15px 0!important;";t.tabbyBorderRemoved=true}else{t.removeTabbyBorder()}}),this.tabbyRemoveBorderTries*500)};Object.defineProperty(t.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();SallaInstallment.style=sallaInstallmentCss;export{SallaInstallment as salla_installment};
|
|
4
|
+
*/import{r as registerInstance,h,H as Host,g as getElement}from"./index-uTwIMGTZ.js";var sallaInstallmentCss="salla-installment:empty{display:none}#tabbyPromoWrapper{background:white;border-radius:0.375rem;-webkit-transition:-webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:-webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1), -webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);margin-bottom:20px;border:unset !important;font-weight:500}.salla-y #tabbyPromoWrapper{border:1px solid var(--color-grey-dark);border-radius:12px}#tabbyPromoWrapper:hover{-webkit-box-shadow:0 0 rgba(0, 0, 0, 0), 0 0 rgba(0, 0, 0, 0), 5px 10px 30px rgba(43, 45, 52, 0.0509803922);box-shadow:0 0 rgba(0, 0, 0, 0), 0 0 rgba(0, 0, 0, 0), 5px 10px 30px rgba(43, 45, 52, 0.0509803922)}#tabbyPromoWrapper #tabbyPromo *{font-family:var(--font-main)}#tabbyPromoWrapper #tabbyPromo>div>div{max-width:none;-webkit-box-shadow:none;box-shadow:none;border:none}#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet{max-width:100%;min-height:100px;padding:18px 20px;border:none !important}#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet__text,#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet__link{font-size:var(--font-sm);color:var(--color-text) !important}#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet__link{font-weight:bold}.tabby-promo-wrapper #tabby-promo{font-family:var(--font-main) !important}.tabby-promo-wrapper #tabby-promo .tabby-promo__feature-title{font-size:var(--font-md)}.tabby-promo-wrapper #tabby-promo .tabby-promo__feature-desc{font-size:var(--font-sm);line-height:20px}.tamara-product-widget{margin-bottom:20px}.tamara-product-widget,.spotii-wrapper{min-height:100px;position:relative;color:var(--main-text-color);font-size:var(--font-sm);line-height:1.25;padding:20px 20px 20px 115px !important;background:white;border-radius:0.375rem;-webkit-transition:-webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:-webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1), -webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);border:unset !important;font-family:inherit !important;font-weight:500}.salla-y .tamara-product-widget,.salla-y .spotii-wrapper{border-radius:12px;border:1px solid var(--color-grey-dark)}.tamara-product-widget:hover,.spotii-wrapper:hover{-webkit-box-shadow:0 0 rgba(0, 0, 0, 0), 0 0 rgba(0, 0, 0, 0), 5px 10px 30px rgba(43, 45, 52, 0.0509803922);box-shadow:0 0 rgba(0, 0, 0, 0), 0 0 rgba(0, 0, 0, 0), 5px 10px 30px rgba(43, 45, 52, 0.0509803922)}.tamara-product-widget .spotii-logo,.spotii-wrapper .spotii-logo{float:left;margin:0 0 0 -75px}.ltr .tamara-product-widget,.ltr .spotii-wrapper{text-align:left;padding:18px 100px 18px 20px !important}.ltr .tamara-product-widget .spotii-logo,.ltr .spotii-wrapper .spotii-logo{float:right;margin:0 -75px 0 0}.ltr .tamara-product-widget .spotii-product-widget,.ltr .spotii-wrapper .spotii-product-widget{text-align:left !important}.spotii-wrapper{margin-bottom:20px}.spotii-wrapper .spotii-promo{font-size:var(--font-md)}.spotii-wrapper .spotii-product-widget{font-size:var(--font-sm) !important;margin-top:10px}.tamara-product-widget .tamara-logo{position:absolute;left:20px !important;top:35px !important;margin:0 !important;height:24px !important}.ltr .tamara-product-widget .tamara-logo{right:20px !important;left:auto !important}.tamara-product-widget span{font-family:var(--font-main);font-size:var(--font-sm);color:var(--color-text)}.tamara-product-widget span:last-child{display:block;position:relative;margin-top:8px}.tamara-popup__wrap{overflow:auto !important}.s-installment-mispay-wrapper,.s-installment-madfu-wrapper,.s-installment-emkan-wrapper,.s-installment-rajehi-wrapper{font-size:14px;text-align:right;padding:20px;gap:42px;line-height:22px;color:rgb(0, 0, 0);min-width:100%;-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;background-color:white;border-radius:10px;margin:15px 0;display:-ms-flexbox;display:flex;-webkit-transition:-webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:-webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1), -webkit-box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1)}.s-installment-mispay-wrapper:hover,.s-installment-madfu-wrapper:hover,.s-installment-emkan-wrapper:hover,.s-installment-rajehi-wrapper:hover{-webkit-box-shadow:0 0 rgba(0, 0, 0, 0), 0 0 rgba(0, 0, 0, 0), 5px 10px 30px rgba(43, 45, 52, 0.0509803922);box-shadow:0 0 rgba(0, 0, 0, 0), 0 0 rgba(0, 0, 0, 0), 5px 10px 30px rgba(43, 45, 52, 0.0509803922)}.s-installment-mispay-content,.s-installment-madfu-content,.s-installment-emkan-content,.s-installment-rajehi-content{display:-ms-flexbox;display:flex;-ms-flex-direction:row-reverse;flex-direction:row-reverse;width:100%;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;gap:1rem}.s-installment-mispay-content-text,.s-installment-madfu-content-text,.s-installment-emkan-content-text,.s-installment-rajehi-content-text{color:var(--main-text-color);font-size:14px;font-weight:500;margin:0 16px 0 0;width:80%;left:14px;text-align:left}.s-installment-mispay-content img,.s-installment-madfu-content img,.s-installment-emkan-content img,.s-installment-rajehi-content img{height:28px;width:70px;display:inline-block;max-height:100%;vertical-align:middle;fill:none;stroke:unset;width:auto}.rtl .s-installment-mispay-content-text,.rtl .s-installment-madfu-content-text,.rtl .s-installment-emkan-content-text,.rtl .s-installment-rajehi-content-text{right:14px;text-align:right;margin:0 0 0 16px}.rtl .s-installment-mispay-content img,.rtl .s-installment-madfu-content img,.rtl .s-installment-emkan-content img,.rtl .s-installment-rajehi-content img{left:14px !important}.ltr .s-installment-mispay-content img,.ltr .s-installment-madfu-content img,.ltr .s-installment-emkan-content img,.ltr .s-installment-rajehi-content img{right:14px !important}.s-installment-rajehi-content img{width:70px !important;height:40px !important}.s-installment-emkan-content img{height:35px !important}";var SallaInstallment=function(){function t(t){registerInstance(this,t);this.tabbyBorderRemoved=false;this.tabbyRemoveBorderTries=0;this.language=salla.config.get("user.language_code");this.currency=salla.config.get("user.currency_code");this.country=salla.config.get("user.country_code");this.installment_sheria_text=function(t,a){return salla.lang.get(t,a)}}t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var t,a;var i=this;return __generator(this,(function(e){switch(e.label){case 0:return[4,salla.onReady()];case 1:e.sent();return[4,salla.lang.onLoaded()];case 2:e.sent();this.currency=salla.config.get("user.currency_code")||"SAR";this.language=salla.config.get("user.language_code")||"ar";this.country=salla.config.get("user.country_code")||"SA";t=[{key:"pages.products.installments",installments:3},{key:"pages.products.installments_emkan",installments:5}];t.forEach((function(t){i.installment_sheria_text(t.key,{payment:salla.money(parseFloat(i.price)),amount:salla.money((parseFloat(i.price)/t.installments).toFixed(2)).replace(/\.00$/,""),installments:t.installments})}));a=salla.config.get("store.settings.installments");if(a){this.tamaraIsActive=a.tamara;this.tabbyIsActive=a.tabby;this.spotiiIsActive=a.spotii;this.mispayActive=a.mispay;this.emkanIsActive=a.emkan;this.madfuActive=a.madfu;this.rajehiIsActive=a.mokafaa_alrajhi}salla.event.on("product::price.updated",(function(t){var a=t.data;if(!a.price||a.price==i.price){return}i.price=a.price;i.renderInstallments(true)}));return[2]}}))}))};t.prototype.componentDidLoad=function(){this.renderInstallments()};t.prototype.render=function(){var t;var a=this.currency==="SAR";if(!this.isValidPrice(this.price)){return""}return h(Host,null,this.tamaraIsActive&&(((t=this.tamaraIsActive)===null||t===void 0?void 0:t.publicKey)?h("div",{class:"mb-5"},h("tamara-widget",{type:"tamara-summary","inline-type":"2",amount:this.price})):h("div",{class:"tamara-product-widget","data-price":this.price,"data-currency":this.currency,"data-lang":this.language,"data-payment-type":"installment"})),this.tabbyIsActive?h("div",{id:"tabbyPromoWrapper"},h("div",{id:"tabbyPromo"})):"",this.spotiiIsActive?h("div",{class:"spotii-wrapper"},h("div",{class:"spotii-promo"})):"",this.shouldShowMispay()&&(this.mispayActive.publicKey?h("div",{class:"mb-5"},h("mispay-widget",{amount:this.price,lang:this.language})):h("div",{class:"s-installment-mispay-wrapper"},h("div",{class:"s-installment-mispay-content"},h("img",{src:salla.url.cdn("images/payment/png/mispay.png"),alt:"mispay"}),h("span",{class:"s-installment-mispay-content-text",innerHTML:this.installment_sheria_text("pages.products.installments",{payment:salla.money(parseFloat(this.price)),amount:salla.money((parseFloat(this.price)/4).toFixed(2)),installments:4})})))),this.emkanIsActive&&this.currency==="SAR"?h("div",{class:"s-installment-emkan-wrapper"},h("div",{class:"s-installment-emkan-content"},h("img",{src:salla.url.cdn("images/payment/png/emkan.png"),alt:"emkan"}),h("span",{class:"s-installment-emkan-content-text",innerHTML:this.installment_sheria_text("pages.products.installments_emkan",{payment:salla.money(parseFloat(this.price)),installments:5})}))):"",this.madfuActive&&this.currency==="SAR"?h("div",{class:"s-installment-madfu-wrapper"},h("div",{class:"s-installment-madfu-content"},h("img",{src:salla.url.cdn("images/payment/png/madfu.png"),alt:"madfu"}),h("span",{class:"s-installment-madfu-content-text"},salla.lang.get("pages.products.installments_madfu")))):"",a&&this.rajehiIsActive?h("div",{class:"s-installment-rajehi-wrapper"},h("div",{class:"s-installment-rajehi-content"},h("img",{src:salla.url.cdn("images/payment/png/mokafaa_alrajhi_loyalty.png"),alt:"mokafaa_alrajhi_loyalty"}),h("span",{class:"s-installment-rajehi-content-text"},salla.lang.get("pages.products.rajahi_earn_points",{points:Math.floor(+this.price*this.rajehiIsActive.pointsPerRiyal)})))):"")};t.prototype.renderInstallments=function(t){var a=this;if(t===void 0){t=false}if(!this.isValidPrice(this.price)){return}if(this.tamaraIsActive){this.loadTamara({isUpdating:t})}if(this.tabbyIsActive){if(t){var i=this.host.querySelector("#tabbyPromoWrapper");if(i){i.remove()}var e=document.createElement("div");e.setAttribute("id","tabbyPromoWrapper");var n=document.createElement("div");n.setAttribute("id","tabbyPromo");e.appendChild(n);this.host.appendChild(e);var r=document.querySelector('script[src="https://checkout.tabby.ai/tabby-promo.js"]');if(r){r.remove()}}var s=document.createElement("script");s.setAttribute("src","https://checkout.tabby.ai/tabby-promo.js");document.head.appendChild(s);s.onload=function(){var t=window.TabbyPromo;new t({selector:"#tabbyPromo",currency:a.currency,price:a.price,lang:a.language,publicKey:salla.config.get("store.settings.installments.tabby.publicKey"),merchantCode:salla.config.get("store.settings.installments.tabby.merchantCode")});document.querySelectorAll(".tabby-promo-snippet__logo").forEach((function(t){t.setAttribute("aria-label","Tabby Logo")}))};this.removeTabbyBorder()}if(this.spotiiIsActive){if(t){var o=this.host.querySelector(".spotii-wrapper");if(o){o.remove()}var l=document.createElement("div");l.classList.add("spotii-wrapper");var p=document.createElement("div");p.classList.add("spotii-promo");l.appendChild(p);this.host.appendChild(l);var m=document.querySelector('script[src="'+salla.url.cdn("js/price-widget-ar-salla.js")+'"]');if(m){m.remove()}}var c=salla.money((Number(this.price)/3).toFixed(2),false);var d=salla.config.get("theme.is_rtl",true);window.spotiiConfig={targetXPath:[".spotii-wrapper"],renderToPath:[".spotii-promo"],numberOfPayment:3,currency:this.currency,templateLine:"${textOne} ${number} ${textTwo} "+c+"${logo} ${info}",textOne:d?"جزء الدفع على":"Split it into",textTwo:d?"أقساط متساوية بدون تكاليف اضافية بقيمة":"payments of",textThree:"مع",price:this.price};var h=document.createElement("script");h.setAttribute("src",salla.url.cdn("js/price-widget-ar-salla.js"));document.head.appendChild(h)}if(this.shouldShowMispay()&&this.mispayActive.publicKey){this.loadExternalScript({position:"head",src:"https://widget.mispay.co/v1/sdk.js?authorize=".concat(this.mispayActive.publicKey)})}};t.prototype.isValidPrice=function(t){var a=/^\d+(\.\d{1,2})?$/;var i=a.test(t);var e=parseFloat(t)>0;return i&&e};t.prototype.loadExternalScript=function(t){var a=t.src,i=t.onLoad,e=t.position;var n=document.createElement("script");n.src=a;n.onload=i;document[e].appendChild(n)};t.prototype.loadTamara=function(t){var a=this;var i=t.isUpdating;var e,n;var r=!!((e=this.tamaraIsActive)===null||e===void 0?void 0:e.publicKey);if(i){setTimeout((function(){var t,a;if(r){return(t=window.TamaraWidgetV2)===null||t===void 0?void 0:t.refresh()}(a=window.TamaraProductWidget)===null||a===void 0?void 0:a.render()}),300)}else{if(r){var s=salla.config.get("user.language_code");var o=["ar","en"].includes(s)?s:"ar";var l=(n=this.currency)===null||n===void 0?void 0:n.slice(0,-1);var p=["SA","AE","KW","BH","OM","QA"].includes(l)?l:null;if(!p){console.error("Tamara: Country code is not supported",l)}else{window.tamaraWidgetConfig={lang:o,country:p,publicKey:this.tamaraIsActive.publicKey,style:{fontSize:"14px"}};this.loadExternalScript({position:"head",src:"https://cdn.tamara.co/widget-v2/tamara-widget.js"})}}else{this.loadExternalScript({position:"head",src:"https://cdn.tamara.co/widget/product-widget.min.js",onLoad:function(){window.TamaraProductWidget.init({lang:a.language});setTimeout((function(){window.TamaraProductWidget.render()}),300)}})}}};t.prototype.shouldShowMispay=function(){return this.currency==="SAR"&&this.mispayActive};t.prototype.removeTabbyBorder=function(){var t=this;if(this.tabbyBorderRemoved||this.tabbyRemoveBorderTries>5){return}this.tabbyRemoveBorderTries++;setTimeout((function(){var a=document.querySelector("#tabbyPromo>div>div");a=a&&a.shadowRoot?a.shadowRoot.querySelector('div[class^="styles__tabby-promo-snippet--"]'):null;if(a){a.style="border: none; margin: 15px 0!important;";t.tabbyBorderRemoved=true}else{t.removeTabbyBorder()}}),this.tabbyRemoveBorderTries*500)};Object.defineProperty(t.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();SallaInstallment.style=sallaInstallmentCss;export{SallaInstallment as salla_installment};
|
|
5
5
|
//# sourceMappingURL=salla-installment.entry.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as registerInstance,c as createEvent,h,H as Host}from"./index-
|
|
4
|
+
import{r as registerInstance,c as createEvent,h,H as Host}from"./index-uTwIMGTZ.js";var sallaLoyaltyPrizeItemCss="salla-loyalty-prize-item:hover{-webkit-box-shadow:0 5px 15px 1px rgba(0, 0, 0, 0.04) !important;box-shadow:0 5px 15px 1px rgba(0, 0, 0, 0.04) !important}";var SallaLoyaltyPrizeItem=function(){function e(e){registerInstance(this,e);this.prizeItemSelected=createEvent(this,"prizeItemSelected")}e.prototype.onPrizeItemClick=function(){this.prizeItemSelected.emit(this.item)};e.prototype.render=function(){return h(Host,{key:"601dbcf73e68678eecc912c14c2b1be612a78551"},h("div",{key:"074f8b4cb736bfabd5885d9df77bf74e7c4829a1",onClick:this.onPrizeItemClick.bind(this)},h("img",{key:"4bec672992f7e998bde639295831a5c9ad5f5088",class:"s-loyalty-prize-item-image",src:this.item.image,alt:this.item.name}),h("div",{key:"c8f858a7f406fe8e9123c57df627a4b6a2cbd719",class:"s-loyalty-prize-item-title"},this.item.name),h("div",{key:"81b954aa730e07c7f32ee538692581dede3543db",class:"s-loyalty-prize-item-subtitle"},this.item.description),h("div",{key:"b7baeada2da364fec6ee7bd606b595b1f652d8a8",class:"s-loyalty-prize-item-points"},this.item.cost_points," Points")))};return e}();SallaLoyaltyPrizeItem.style=sallaLoyaltyPrizeItemCss;export{SallaLoyaltyPrizeItem as salla_loyalty_prize_item};
|
|
5
5
|
//# sourceMappingURL=salla-loyalty-prize-item.entry.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var __awaiter=this&&this.__awaiter||function(t,a,r,l){function e(t){return t instanceof r?t:new r((function(a){a(t)}))}return new(r||(r=Promise))((function(r,s){function o(t){try{i(l.next(t))}catch(t){s(t)}}function n(t){try{i(l["throw"](t))}catch(t){s(t)}}function i(t){t.done?r(t.value):e(t.value).then(o,n)}i((l=l.apply(t,a||[])).next())}))};var __generator=this&&this.__generator||function(t,a){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},l,e,s,o;return o={next:n(0),throw:n(1),return:n(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function n(t){return function(a){return i([t,a])}}function i(n){if(l)throw new TypeError("Generator is already executing.");while(o&&(o=0,n[0]&&(r=0)),r)try{if(l=1,e&&(s=n[0]&2?e["return"]:n[0]?e["throw"]||((s=e["return"])&&s.call(e),0):e.next)&&!(s=s.call(e,n[1])).done)return s;if(e=0,s)n=[n[0]&2,s.value];switch(n[0]){case 0:case 1:s=n;break;case 4:r.label++;return{value:n[1],done:false};case 5:r.label++;e=n[1];n=[0];continue;case 7:n=r.ops.pop();r.trys.pop();continue;default:if(!(s=r.trys,s=s.length>0&&s[s.length-1])&&(n[0]===6||n[0]===2)){r=0;continue}if(n[0]===3&&(!s||n[1]>s[0]&&n[1]<s[3])){r.label=n[1];break}if(n[0]===6&&r.label<s[1]){r.label=s[1];s=n;break}if(s&&r.label<s[2]){r.label=s[2];r.ops.push(n);break}if(s[2])r.ops.pop();r.trys.pop();continue}n=a.call(t,r)}catch(t){n=[6,t];e=0}finally{l=s=0}if(n[0]&5)throw n[1];return{value:n[0]?n[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(t,a,r){if(r||arguments.length===2)for(var l=0,e=a.length,s;l<e;l++){if(s||!(l in a)){if(!s)s=Array.prototype.slice.call(a,0,l);s[l]=a[l]}}return t.concat(s||Array.prototype.slice.call(a))};
|
|
2
2
|
/*!
|
|
3
3
|
* Crafted with ❤ by Salla
|
|
4
|
-
*/import{r as registerInstance,h,H as Host}from"./index-
|
|
4
|
+
*/import{r as registerInstance,h,H as Host}from"./index-uTwIMGTZ.js";import{G as GiftIcon}from"./gift-C0JNGIpa.js";var sallaLoyaltyProgramCss="";var formatDate=function(t){if(!t)return"";return new Date(Number(t)).toLocaleDateString(salla.lang.locale,{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"numeric"})};var translateKey=function(t){if(!t)return"";try{var a=t.toLowerCase();var r=salla.lang.get("pages.loyalty_program.".concat(a));return r==="pages.loyalty_program.".concat(a)?t:r}catch(a){return t}};var SallaWalletTable=function(){function t(t){var a=this;registerInstance(this,t);this.loyaltyPointsArray=[];this.isLoadingLoyalty=false;this.nextPageUrlLoyalty="";this.handleClick=function(){a.loadMoreLoyaltyPoints()}}t.prototype.componentWillLoad=function(){var t=this;return salla.onReady().then((function(){t.loadLoyaltyPoints()}))};t.prototype.loadLoyaltyPoints=function(){return __awaiter(this,void 0,void 0,(function(){var t,a,r;return __generator(this,(function(l){switch(l.label){case 0:this.isLoadingLoyalty=true;l.label=1;case 1:l.trys.push([1,3,4,5]);t="/balance/points?page=1";return[4,salla.api.request(t)];case 2:a=l.sent();this.loyaltyPointsArray=a.data;this.nextPageUrlLoyalty=a.cursor.next;return[3,5];case 3:r=l.sent();console.error("Error loading loyalty points transactions",r);return[3,5];case 4:this.isLoadingLoyalty=false;return[7];case 5:return[2]}}))}))};t.prototype.loadMoreLoyaltyPoints=function(){return __awaiter(this,void 0,void 0,(function(){var t,a,r;return __generator(this,(function(l){switch(l.label){case 0:if(!this.nextPageUrlLoyalty)return[2];this.isLoadingLoyalty=true;l.label=1;case 1:l.trys.push([1,3,4,5]);return[4,salla.api.request(this.nextPageUrlLoyalty)];case 2:a=l.sent();this.loyaltyPointsArray=__spreadArray(__spreadArray([],this.loyaltyPointsArray,true),a.data,true);this.nextPageUrlLoyalty=((t=a.cursor)===null||t===void 0?void 0:t.next)||"";return[3,5];case 3:r=l.sent();console.error("Error loading more loyalty points",r);return[3,5];case 4:this.isLoadingLoyalty=false;return[7];case 5:return[2]}}))}))};t.prototype.render=function(){return h(Host,{key:"985386d18096b99ef6114a6e21363900c5dab374"},h("div",{key:"67bb4fceebc5ef047cd3b0ee5b94297e4c9d9d17"},this.isLoadingLoyalty?h("salla-loading",null):h("div",null,this.loyaltyPointsArray.length>0?h("div",null,h("table",{class:"s-loyalty-program-table"},h("thead",{class:"s-loyalty-program-table-head"},h("tr",{class:"s-loyalty-program-table-head-tr"},h("th",{scope:"col",class:"s-loyalty-program-table-head-tr-th"},salla.lang.get("pages.wallet.points")),h("th",{scope:"col",class:"s-loyalty-program-table-head-tr-th"},salla.lang.get("pages.wallet.date")),h("th",{scope:"col",class:"s-loyalty-program-table-head-tr-th"},salla.lang.get("pages.wallet.expiry_date")),h("th",{scope:"col",class:"s-loyalty-program-table-head-tr-th"},salla.lang.get("common.elements.note")),h("th",{scope:"col",class:"s-loyalty-program-table-head-tr-th"},salla.lang.get("common.elements.status")))),h("tbody",{class:"s-loyalty-program-table-tbody"},this.loyaltyPointsArray.map((function(t){return h("tr",{class:"s-loyalty-program-table-tbody-tr"},h("td",{class:"s-loyalty-program-table-tbody-tr-td"},(t===null||t===void 0?void 0:t.type)==="plus"?"+":"",(t===null||t===void 0?void 0:t.points)||""," ",salla.lang.get("pages.loyalty_program.point")),h("td",{class:"s-loyalty-program-table-tbody-tr-td"},formatDate((t===null||t===void 0?void 0:t.created_at)?Number(t.created_at)*1e3:undefined)),h("td",{class:"s-loyalty-program-table-tbody-tr-td"},formatDate(t===null||t===void 0?void 0:t.points_expire_date)),h("td",{class:"s-loyalty-program-table-tbody-tr-td"},translateKey(t===null||t===void 0?void 0:t.key)),h("td",{class:"s-loyalty-program-table-tbody-tr-td"},translateKey(t===null||t===void 0?void 0:t.status_key)))})))),h("div",{class:"s-infinite-scroll-wrapper"},!!this.nextPageUrlLoyalty&&h("salla-button",{onClick:this.handleClick,loading:this.isLoadingLoyalty},salla.lang.get("common.elements.load_more")))):h("div",null,h("div",{class:"s-loyalty-program-table-empty-state"},h("span",{innerHTML:GiftIcon}),h("div",{class:"s-loyalty-program-table-placeholder-title"},salla.lang.get("pages.loyalty_program.no_loyality_points_title")),h("div",{class:"s-loyalty-program-table-placeholder-sub-title"},salla.lang.get("pages.loyalty_program.no_loyality_points_sub_title")))))))};return t}();SallaWalletTable.style=sallaLoyaltyProgramCss;export{SallaWalletTable as salla_loyalty_program};
|
|
5
5
|
//# sourceMappingURL=salla-loyalty-program.entry.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var __awaiter=this&&this.__awaiter||function(t,a,e,r){function n(t){return t instanceof e?t:new e((function(a){a(t)}))}return new(e||(e=Promise))((function(e,s){function i(t){try{l(r.next(t))}catch(t){s(t)}}function o(t){try{l(r["throw"](t))}catch(t){s(t)}}function l(t){t.done?e(t.value):n(t.value).then(i,o)}l((r=r.apply(t,a||[])).next())}))};var __generator=this&&this.__generator||function(t,a){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,n,s,i;return i={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function o(t){return function(a){return l([t,a])}}function l(o){if(r)throw new TypeError("Generator is already executing.");while(i&&(i=0,o[0]&&(e=0)),e)try{if(r=1,n&&(s=o[0]&2?n["return"]:o[0]?n["throw"]||((s=n["return"])&&s.call(n),0):n.next)&&!(s=s.call(n,o[1])).done)return s;if(n=0,s)o=[o[0]&2,s.value];switch(o[0]){case 0:case 1:s=o;break;case 4:e.label++;return{value:o[1],done:false};case 5:e.label++;n=o[1];o=[0];continue;case 7:o=e.ops.pop();e.trys.pop();continue;default:if(!(s=e.trys,s=s.length>0&&s[s.length-1])&&(o[0]===6||o[0]===2)){e=0;continue}if(o[0]===3&&(!s||o[1]>s[0]&&o[1]<s[3])){e.label=o[1];break}if(o[0]===6&&e.label<s[1]){e.label=s[1];s=o;break}if(s&&e.label<s[2]){e.label=s[2];e.ops.push(o);break}if(s[2])e.ops.pop();e.trys.pop();continue}o=a.call(t,e)}catch(t){o=[6,t];n=0}finally{r=s=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
|
-
*/import{r as registerInstance,h,H as Host,g as getElement}from"./index-
|
|
4
|
+
*/import{r as registerInstance,h,H as Host,g as getElement}from"./index-uTwIMGTZ.js";var sallaMetadataCss="";var SallaMetadata=function(){function t(t){registerInstance(this,t);this.entity="product";this.specs=[];this.download=salla.lang.get("pages.thank_you.download");if(this.entityId){try{this.entityId=Array.isArray(this.entityId)?this.entityId:JSON.parse(this.entityId);return}catch(t){salla.log("Bad json passed via entityId prop")}}}t.prototype.getValue=function(t){if(t.type==="file"){return'<a href="'.concat(t.value,'" class="text-primary" target="_blank"><span class="sicon-download"></span> ').concat(this.download,"</a>")}if(t.type==="url"){return'<a href="'.concat(t.value,'" class="text-blue-700 underline" target="_blank">').concat(t.value,"</a>")}if(t.type==="date"){var a=new Date(t.value);var e=String(a.getDate()).padStart(2,"0");var r=String(a.getMonth()+1).padStart(2,"0");var n=a.getFullYear();var s="".concat(e,"/").concat(r,"/").concat(n);return s}return t.value};t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var t,a,e;return __generator(this,(function(r){switch(r.label){case 0:return[4,salla.onReady()];case 1:r.sent();if(!((t=salla.config.get("store.features"))===null||t===void 0?void 0:t.includes("custom-fields"))){return[2,salla.logger.error("feature custom-fields is not activated")]}if(!this.entityId&&(salla.url.is_page("product.single")||salla.url.is_page("product.showNewUrls"))){this.entityId=salla.config.get("page.id")}if(!this.entityId){return[2,salla.logger.error("can't render salla-metadata without enity-id prop!")]}return[4,salla.lang.onLoaded()];case 2:r.sent();this.download=salla.lang.get("pages.thank_you.download");return[4,Salla.api.metadata.fetchValues(this.entity,this.entityId)];case 3:e=r.sent();this.specs=(a=e.data[0])===null||a===void 0?void 0:a.sections;return[2]}}))}))};t.prototype.render=function(){var t=this;if(!this.specs.length){return}return h(Host,{class:"s-metadata-wrapper"},this.specs.map((function(a){return h("div",{class:"s-metadata-box"},h("div",{class:"s-metadata-box-header"},h("i",{class:"sicon-list"}),a.name),a.fields.map((function(a){return h("div",{class:"s-metadata-row"},h("p",{class:"s-metadata-row-name"},a.name),h("p",{class:"s-metadata-row-value",innerHTML:t.getValue(a)}))})))})))};Object.defineProperty(t.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();SallaMetadata.style=sallaMetadataCss;export{SallaMetadata as salla_metadata};
|
|
5
5
|
//# sourceMappingURL=salla-metadata.entry.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as registerInstance,h}from"./index-
|
|
4
|
+
import{r as registerInstance,h}from"./index-uTwIMGTZ.js";var sallaNotificationsCss="";var SallaNotificationItem=function(){function i(i){registerInstance(this,i)}i.prototype.render=function(){return h("a",{key:"f4818ac9b7dc2573dd1ac8aa31aabc82454ea439",href:this.notification.url,class:{"s-notifications-item":true,"s-notifications-item-shadow":true,"s-notifications-item-read":!this.notification.is_new}},h("span",{key:"3766a4eb835408bf293054be3e04a561e1510728",class:"s-notifications-item-icon"},h("i",{key:"e9b1e4a18f22e765053b7d62f83a4af6e426bd47",class:{"s-notifications-item-icon sicon-bell-ring":true,"s-notifications-item-icon-new":this.notification.is_new}})),h("div",{key:"2005bcf68b61bb0aa5606480f703e4ee4cfbd415",class:"s-notifications-item-content"},h("div",{key:"a60fdc96431899c0c3183512ea81477f52e550d0",class:"s-notifications-item-content-leading"},h("h4",{key:"fb0eb1efe08440a1e2c12dc1af263adba0413d2b"},this.notification.title),h("p",{key:"c32790ad29bd267323d86e5c3abdec1ab75c09b2"},this.notification.sub_title)),h("span",{key:"e8fbfea5e91fe7d16c489a285502eaab08b16fd5",class:"s-notifications-item-content-trailing"},h("i",{key:"ea9fb9cf6ac2f9c84cde152fa1381e884971cba4",class:"sicon-time s-notifications-item-content-trailing-icon"}),h("span",{key:"1fb25f1463210c8ab467dff8aea22d9c4510301c"},this.notification.date))))};return i}();SallaNotificationItem.style=sallaNotificationsCss;export{SallaNotificationItem as salla_notification_item};
|
|
5
5
|
//# sourceMappingURL=salla-notification-item.entry.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var __awaiter=this&&this.__awaiter||function(t,n,i,e){function r(t){return t instanceof i?t:new i((function(n){n(t)}))}return new(i||(i=Promise))((function(i,o){function a(t){try{u(e.next(t))}catch(t){o(t)}}function s(t){try{u(e["throw"](t))}catch(t){o(t)}}function u(t){t.done?i(t.value):r(t.value).then(a,s)}u((e=e.apply(t,n||[])).next())}))};var __generator=this&&this.__generator||function(t,n){var i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},e,r,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(t){return function(n){return u([t,n])}}function u(s){if(e)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(i=0)),i)try{if(e=1,r&&(o=s[0]&2?r["return"]:s[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;if(r=0,o)s=[s[0]&2,o.value];switch(s[0]){case 0:case 1:o=s;break;case 4:i.label++;return{value:s[1],done:false};case 5:i.label++;r=s[1];s=[0];continue;case 7:s=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){i=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(s[0]===6&&i.label<o[1]){i.label=o[1];o=s;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(s);break}if(o[2])i.ops.pop();i.trys.pop();continue}s=n.call(t,i)}catch(t){s=[6,t];r=0}finally{e=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};
|
|
2
2
|
/*!
|
|
3
3
|
* Crafted with ❤ by Salla
|
|
4
|
-
*/import{r as registerInstance,h,g as getElement}from"./index-
|
|
4
|
+
*/import{r as registerInstance,h,g as getElement}from"./index-uTwIMGTZ.js";import{H as Helper}from"./Helper-CzEjEM5j.js";import"./anime.es-CgtvEd63.js";var sallaNotificationsCss="";var SallaNotifications=function(){function t(t){var n=this;registerInstance(this,t);this.itemPerPage=10;this.no_notifications_trans=salla.lang.get("blocks.header.no_notifications");this.load_more_text_trans=salla.lang.get("common.elements.load_more");salla.lang.onLoaded((function(){n.no_notifications_trans=salla.lang.get("blocks.header.no_notifications");n.load_more_text_trans=salla.lang.get("common.elements.load_more")}))}t.prototype.loading=function(t){if(t===void 0){t=true}var n;var i=(n=this.status)===null||n===void 0?void 0:n.querySelector(".s-button-text");if(i){Helper.toggleElementClassIf(i,"s-button-hide","s-button-show",(function(){return t}));this.btnLoader.style.display=t?"inherit":"none"}};t.prototype.getNotificationCard=function(t){var n=document.createElement("salla-notification-item");n.notification=t;n.classList.add("s-block");return n};t.prototype.render=function(){var t=this;var n;if(this.showPlaceholder){return h("div",{class:"s-notifications-no-content"},h("salla-placeholder",{alignment:"center"},h("span",{slot:"title"},this.no_notifications_trans)))}return h("div",{class:"s-notifications-wrapper"},h("div",{class:"s-notifications-container",ref:function(n){return t.wrapper=n}}),this.nextPage&&h("div",{class:"s-infinite-scroll-wrapper",ref:function(n){return t.status=n}},h("button",{onClick:function(){return t.loadMore()},class:"s-infinite-scroll-btn s-button-btn s-button-primary"},h("span",{class:"s-button-text s-infinite-scroll-btn-text"},(n=this.loadMoreText)!==null&&n!==void 0?n:this.load_more_text_trans),h("span",{class:"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader",ref:function(n){return t.btnLoader=n},style:{display:"none"}}))))};t.prototype.handleResponse=function(t){var n=this;return t.map((function(t){return n.getNotificationCard(t)}))};t.prototype.initiateInfiniteScroll=function(){var t=this;var n,i,e;if(!this.wrapper){salla.logger.error("Wrapper is undefined. Cannot initiate infinite scroll.");return}this.infiniteScroll=salla.infiniteScroll.initiate(this.wrapper,this.wrapper,{path:function(){return t.nextPage},history:true,nextPage:this.nextPage,scrollThreshold:false},true);(n=this.infiniteScroll)===null||n===void 0?void 0:n.on("request",(function(n){t.loading()}));(i=this.infiniteScroll)===null||i===void 0?void 0:i.on("load",(function(n){var i;t.loading(false);t.pagination=n.pagination;t.nextPage=((i=n.pagination.links)===null||i===void 0?void 0:i.next)||null;t.handleResponse(n.data).forEach((function(n){return t.wrapper.append(n)}));var e=t.host.querySelectorAll("salla-notification-item:not(.animated)");Helper.animateItems(e)}));(e=this.infiniteScroll)===null||e===void 0?void 0:e.on("error",(function(t){salla.logger.error("Error loading more comments:",t)}))};t.prototype.loadInitialData=function(){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(n){switch(n.label){case 0:return[4,salla.api.notifications.fetch({per_page:this.itemPerPage}).then((function(n){var i;t.pagination=n.pagination;t.total=n.pagination.total;t.nextPage=((i=n.pagination.links)===null||i===void 0?void 0:i.next)||null;setTimeout((function(){if(!n.data.length){return t.showPlaceholder=true}t.handleResponse(n.data).forEach((function(n){return t.wrapper.append(n)}));t.initiateInfiniteScroll();var i=t.wrapper.querySelectorAll("salla-notification-item:not(.animated)");Helper.animateItems(i)}),100)})).catch((function(n){salla.logger.error(n);t.showPlaceholder=true;t.loading(false)}))];case 1:n.sent();return[2]}}))}))};t.prototype.loadMore=function(){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(n){(t=this.infiniteScroll)===null||t===void 0?void 0:t.loadNextPage();return[2]}))}))};t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,this.loadInitialData()];case 1:t.sent();return[2]}}))}))};Object.defineProperty(t.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();SallaNotifications.style=sallaNotificationsCss;export{SallaNotifications as salla_notifications};
|
|
5
5
|
//# sourceMappingURL=salla-notifications.entry.js.map
|