@salla.sa/twilight-components 2.14.260 → 2.14.261
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-C-RMRzcr.js → app-globals-9KVXzA9b.js} +3 -3
- package/dist/cjs/{app-globals-C-RMRzcr.js.map → app-globals-9KVXzA9b.js.map} +1 -1
- package/dist/cjs/{index-Cb0SQNc9.js → index-CfmOwvmC.js} +4 -4
- package/dist/cjs/index-CfmOwvmC.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/salla-accordion_4.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 +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-details-multiple-bundle-product.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details.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/components/index.js +2 -2
- package/dist/components/index.js.map +1 -1
- package/dist/esm/{app-globals-CYjWTTrt.js → app-globals-BgG-hCSq.js} +3 -3
- package/dist/esm/{app-globals-CYjWTTrt.js.map → app-globals-BgG-hCSq.js.map} +1 -1
- package/dist/esm/{index-DtlYcjlJ.js → index-LSZwJPPB.js} +4 -4
- package/dist/esm/index-LSZwJPPB.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/salla-accordion_4.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 +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-details-multiple-bundle-product.entry.js +1 -1
- package/dist/esm/salla-order-details.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-CYjWTTrt.js → app-globals-BgG-hCSq.js} +2 -2
- package/dist/esm-es5/{app-globals-CYjWTTrt.js.map → app-globals-BgG-hCSq.js.map} +1 -1
- package/dist/esm-es5/{index-DtlYcjlJ.js → index-LSZwJPPB.js} +3 -3
- package/dist/esm-es5/index-LSZwJPPB.js.map +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/salla-accordion_4.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-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 +2 -2
- package/dist/esm-es5/salla-notification-item.entry.js +1 -1
- package/dist/esm-es5/salla-notifications.entry.js +2 -2
- package/dist/esm-es5/salla-offer.entry.js +1 -1
- package/dist/esm-es5/salla-order-details-multiple-bundle-product.entry.js +1 -1
- package/dist/esm-es5/salla-order-details.entry.js +1 -1
- package/dist/esm-es5/salla-order-summary.entry.js +2 -2
- 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-58768895.entry.js → p-008a771c.entry.js} +2 -2
- package/dist/twilight/{p-385257e0.entry.js → p-0407da23.entry.js} +2 -2
- package/dist/twilight/{p-c6fde185.system.entry.js → p-059405fc.system.entry.js} +2 -2
- package/dist/twilight/{p-0303d452.system.entry.js → p-09bc1f72.system.entry.js} +2 -2
- package/dist/twilight/{p-66464e8e.system.entry.js → p-0e1cd76c.system.entry.js} +3 -3
- package/dist/twilight/p-13a2e582.system.entry.js +5 -0
- package/dist/twilight/{p-2bb3b70e.system.entry.js → p-143dd94c.system.entry.js} +2 -2
- package/dist/twilight/{p-1362c93c.system.entry.js → p-188e8d1c.system.entry.js} +2 -2
- package/dist/twilight/p-1f8bf87a.entry.js +5 -0
- package/dist/twilight/{p-d632f1fa.system.entry.js → p-1f93b886.system.entry.js} +2 -2
- package/dist/twilight/{p-57cfb4b1.system.entry.js → p-275332fa.system.entry.js} +2 -2
- package/dist/twilight/{p-db7a231b.entry.js → p-2957c27c.entry.js} +2 -2
- package/dist/twilight/{p-c94f95c1.system.entry.js → p-2ed6d081.system.entry.js} +2 -2
- package/dist/twilight/{p-e0e29fb0.system.entry.js → p-39d68fc1.system.entry.js} +2 -2
- package/dist/twilight/{p-939f9104.entry.js → p-3ede6721.entry.js} +2 -2
- package/dist/twilight/{p-3f20e330.entry.js → p-42bcde7d.entry.js} +2 -2
- package/dist/twilight/{p-7f20c85c.entry.js → p-47de107e.entry.js} +2 -2
- package/dist/twilight/{p-784ee964.system.entry.js → p-4806aee6.system.entry.js} +2 -2
- package/dist/twilight/{p-54a5d0ac.system.entry.js → p-4eef3c0e.system.entry.js} +2 -2
- package/dist/twilight/{p-2323e473.entry.js → p-5271a9e8.entry.js} +2 -2
- package/dist/twilight/{p-0259d6cb.system.entry.js → p-528aa2c4.system.entry.js} +2 -2
- package/dist/twilight/{p-39a319ec.system.entry.js → p-53e00642.system.entry.js} +2 -2
- package/dist/twilight/{p-4cf011a4.system.entry.js → p-5bae6d14.system.entry.js} +2 -2
- package/dist/twilight/{p-93e6452b.system.entry.js → p-64c8b0e2.system.entry.js} +2 -2
- package/dist/twilight/{p-0ba23365.system.entry.js → p-64de4869.system.entry.js} +2 -2
- package/dist/twilight/{p-e28d3b71.entry.js → p-675d4ab7.entry.js} +2 -2
- package/dist/twilight/{p-5f352ca9.system.entry.js → p-68285203.system.entry.js} +2 -2
- package/dist/twilight/{p-f0dd4f76.entry.js → p-68327c54.entry.js} +2 -2
- package/dist/twilight/{p-c0072de1.system.entry.js → p-6a8ba65f.system.entry.js} +3 -3
- package/dist/twilight/{p-099e8eb6.entry.js → p-6ad30bc0.entry.js} +2 -2
- package/dist/twilight/{p-e1e90d0c.entry.js → p-6b1753ce.entry.js} +2 -2
- package/dist/twilight/{p-36b00bb1.system.entry.js → p-71bd4d79.system.entry.js} +2 -2
- package/dist/twilight/{p-d14a8edc.system.entry.js → p-81b99416.system.entry.js} +2 -2
- package/dist/twilight/{p-cbcfb963.entry.js → p-87d32e2f.entry.js} +2 -2
- package/dist/twilight/{p-b23ce243.system.entry.js → p-88e53a1e.system.entry.js} +2 -2
- package/dist/twilight/{p-xfMEaBec.system.js.map → p-8i-yI1XS.system.js.map} +1 -1
- package/dist/twilight/{p-83549a90.entry.js → p-9847a4f4.entry.js} +2 -2
- package/dist/twilight/{p-a80652d3.entry.js → p-9e6c5671.entry.js} +2 -2
- package/dist/twilight/{p-DS9YDo5Q.system.js.map → p-B2wed4KP.system.js.map} +1 -1
- package/dist/twilight/{p-CvcXa2TU.system.js.map → p-B4sHNRyB.system.js.map} +1 -1
- package/dist/twilight/{p-_Zg_vfYO.system.js → p-B52cxJwt.system.js} +2 -2
- package/dist/twilight/{p-_Zg_vfYO.system.js.map → p-B52cxJwt.system.js.map} +1 -1
- package/dist/twilight/{p-BNKx_fXu.system.js.map → p-B7SRc_rs.system.js.map} +1 -1
- package/dist/twilight/{p-t6iSIvKc.system.js.map → p-BBjPvuu7.system.js.map} +1 -1
- package/dist/twilight/{p-C0zi3xso.system.js.map → p-BC-cnFy-.system.js.map} +1 -1
- package/dist/twilight/{p-DqqqpQLX.system.js.map → p-BL3DMysj.system.js.map} +1 -1
- package/dist/twilight/{p-DF5hpYv8.system.js → p-BMCxvVxH.system.js} +2 -2
- package/dist/twilight/{p-DF5hpYv8.system.js.map → p-BMCxvVxH.system.js.map} +1 -1
- package/dist/twilight/{p-lKe9xnuY.system.js.map → p-BMe9fgvJ.system.js.map} +1 -1
- package/dist/twilight/{p-CdPxDxze.system.js.map → p-BtWTphPP.system.js.map} +1 -1
- package/dist/twilight/{p--178guyc.system.js.map → p-C51w7Au-.system.js.map} +1 -1
- package/dist/twilight/{p-C8JDkECr.system.js.map → p-CCJYFUxF.system.js.map} +1 -1
- package/dist/twilight/{p-D2T3kwP1.system.js.map → p-CGmIt4gq.system.js.map} +1 -1
- package/dist/twilight/{p-C_tZ3UPA.system.js.map → p-CLHJmBGj.system.js.map} +1 -1
- package/dist/twilight/{p-Ch2ngfCk.system.js.map → p-CNqf1L3p.system.js.map} +1 -1
- package/dist/twilight/{p-B9diX3Ld.system.js.map → p-C_Jmr6ar.system.js.map} +1 -1
- package/dist/twilight/{p-y6fipjol.system.js.map → p-Cb9M2a-j.system.js.map} +1 -1
- package/dist/twilight/{p-DiFVtThr.system.js → p-Ce2XJNsy.system.js} +3 -3
- package/dist/twilight/p-Ce2XJNsy.system.js.map +1 -0
- package/dist/twilight/{p-D0CcSuA9.system.js.map → p-Cnbdx_CN.system.js.map} +1 -1
- package/dist/twilight/{p-DHzL55RC.system.js.map → p-Co12cj-7.system.js.map} +1 -1
- package/dist/twilight/{p-C6nl4csu.system.js.map → p-D3JDyRUW.system.js.map} +1 -1
- package/dist/twilight/{p-UHVUEdWQ.system.js.map → p-D8jKZnWs.system.js.map} +1 -1
- package/dist/twilight/{p-CX4G4VV7.system.js.map → p-DHFCX5Dz.system.js.map} +1 -1
- package/dist/twilight/{p-CI_HtUC7.system.js.map → p-DN3CCyG-.system.js.map} +1 -1
- package/dist/twilight/{p-C9OfFWmp.system.js.map → p-DNiwBHdX.system.js.map} +1 -1
- package/dist/twilight/{p-FCntN3lB.js → p-DQg5Q6X-.js} +2 -2
- package/dist/twilight/{p-FCntN3lB.js.map → p-DQg5Q6X-.js.map} +1 -1
- package/dist/twilight/{p-BP64ZxhW.system.js.map → p-DS9HrJPI.system.js.map} +1 -1
- package/dist/twilight/{p-NwP5WLUz.system.js.map → p-DVEvrSjN.system.js.map} +1 -1
- package/dist/twilight/{p-Bx7mzn4-.system.js.map → p-DaMdjqfe.system.js.map} +1 -1
- package/dist/twilight/{p-C3b5GFVP.system.js.map → p-DaTp8sB1.system.js.map} +1 -1
- package/dist/twilight/{p-Brt6MZMy.system.js.map → p-DzjfnKbb.system.js.map} +1 -1
- package/dist/twilight/{p-hUWZ36QL.system.js.map → p-H5xAa3Fp.system.js.map} +1 -1
- package/dist/twilight/{p-DtlYcjlJ.js → p-LSZwJPPB.js} +3 -3
- package/dist/twilight/p-LSZwJPPB.js.map +1 -0
- package/dist/twilight/{p-Cl6TP9Ol.system.js.map → p-MzTS1h7j.system.js.map} +1 -1
- package/dist/twilight/{p-DG_xtA-f.system.js.map → p-NCpDIEN8.system.js.map} +1 -1
- package/dist/twilight/{p-DhIVzS4b.system.js.map → p-Xd4af-0t.system.js.map} +1 -1
- package/dist/twilight/{p-3ad79104.entry.js → p-a13fcfe1.entry.js} +2 -2
- package/dist/twilight/{p-109f5735.entry.js → p-a6961af5.entry.js} +2 -2
- package/dist/twilight/{p-f2bac5d5.system.entry.js → p-aa357e2b.system.entry.js} +2 -2
- package/dist/twilight/{p-d71d6dff.entry.js → p-aa49c07f.entry.js} +2 -2
- package/dist/twilight/{p-C25xo2I9.system.js.map → p-aff393D5.system.js.map} +1 -1
- package/dist/twilight/{p-e6d51e3a.entry.js → p-b0d88d59.entry.js} +2 -2
- package/dist/twilight/{p-19061cec.entry.js → p-b7572664.entry.js} +2 -2
- package/dist/twilight/{p-97cc91c4.entry.js → p-b94bc357.entry.js} +2 -2
- package/dist/twilight/{p-ee66c0dd.entry.js → p-c09565da.entry.js} +2 -2
- package/dist/twilight/{p-862ad154.entry.js → p-c38dbed0.entry.js} +2 -2
- package/dist/twilight/{p-5cb3dd8e.system.entry.js → p-c5fa09d1.system.entry.js} +2 -2
- package/dist/twilight/{p-c6a3fdb0.entry.js → p-ccffcd08.entry.js} +2 -2
- package/dist/twilight/{p-9fa8d963.entry.js → p-ce02710a.entry.js} +2 -2
- package/dist/twilight/{p-f1d6fdbf.entry.js → p-d02a08e9.entry.js} +2 -2
- package/dist/twilight/{p-3e960ee9.system.entry.js → p-d1ca52ee.system.entry.js} +2 -2
- package/dist/twilight/{p-3ad485dd.entry.js → p-d1ef5396.entry.js} +2 -2
- package/dist/twilight/{p-1b42ce8a.entry.js → p-d3a36873.entry.js} +2 -2
- package/dist/twilight/{p-7105480a.system.entry.js → p-d62c20f1.system.entry.js} +2 -2
- package/dist/twilight/{p-6a611226.entry.js → p-d660efad.entry.js} +2 -2
- package/dist/twilight/{p-04e33bba.system.entry.js → p-dad1b603.system.entry.js} +2 -2
- package/dist/twilight/{p-55771cda.system.entry.js → p-de2b1078.system.entry.js} +2 -2
- package/dist/twilight/{p-007ca6d7.system.entry.js → p-e5eae8ce.system.entry.js} +2 -2
- package/dist/twilight/p-ea832823.system.entry.js +5 -0
- package/dist/twilight/{p-fba0b0f7.system.entry.js → p-ef823dbd.system.entry.js} +2 -2
- package/dist/twilight/{p-6e1ecf18.entry.js → p-f0cc5b35.entry.js} +2 -2
- package/dist/twilight/{p-d8aab17c.system.entry.js → p-f1218836.system.entry.js} +2 -2
- package/dist/twilight/{p-7dc3a160.system.entry.js → p-f80b373d.system.entry.js} +2 -2
- package/dist/twilight/{p-ef04d7e0.entry.js → p-fa5ead87.entry.js} +2 -2
- package/dist/twilight/{p-d1809737.entry.js → p-fcfd9a2b.entry.js} +2 -2
- package/dist/twilight/{p-138b8ce7.entry.js → p-fe0234a1.entry.js} +2 -2
- package/dist/twilight/{p-BWbXuc8f.system.js.map → p-jGMZVThE.system.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/cjs/index-Cb0SQNc9.js.map +0 -1
- package/dist/esm/index-DtlYcjlJ.js.map +0 -1
- package/dist/esm-es5/index-DtlYcjlJ.js.map +0 -1
- package/dist/twilight/p-DiFVtThr.system.js.map +0 -1
- package/dist/twilight/p-DtlYcjlJ.js.map +0 -1
- package/dist/twilight/p-bcae7f12.system.entry.js +0 -5
- package/dist/twilight/p-ce103d4c.system.entry.js +0 -5
- package/dist/twilight/p-f702aead.entry.js +0 -5
- /package/dist/twilight/{p-58768895.entry.js.map → p-008a771c.entry.js.map} +0 -0
- /package/dist/twilight/{p-385257e0.entry.js.map → p-0407da23.entry.js.map} +0 -0
- /package/dist/twilight/{p-c6fde185.system.entry.js.map → p-059405fc.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-0303d452.system.entry.js.map → p-09bc1f72.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-66464e8e.system.entry.js.map → p-0e1cd76c.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-bcae7f12.system.entry.js.map → p-13a2e582.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-2bb3b70e.system.entry.js.map → p-143dd94c.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-1362c93c.system.entry.js.map → p-188e8d1c.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-f702aead.entry.js.map → p-1f8bf87a.entry.js.map} +0 -0
- /package/dist/twilight/{p-d632f1fa.system.entry.js.map → p-1f93b886.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-57cfb4b1.system.entry.js.map → p-275332fa.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-db7a231b.entry.js.map → p-2957c27c.entry.js.map} +0 -0
- /package/dist/twilight/{p-c94f95c1.system.entry.js.map → p-2ed6d081.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-e0e29fb0.system.entry.js.map → p-39d68fc1.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-939f9104.entry.js.map → p-3ede6721.entry.js.map} +0 -0
- /package/dist/twilight/{p-3f20e330.entry.js.map → p-42bcde7d.entry.js.map} +0 -0
- /package/dist/twilight/{p-7f20c85c.entry.js.map → p-47de107e.entry.js.map} +0 -0
- /package/dist/twilight/{p-784ee964.system.entry.js.map → p-4806aee6.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-54a5d0ac.system.entry.js.map → p-4eef3c0e.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-2323e473.entry.js.map → p-5271a9e8.entry.js.map} +0 -0
- /package/dist/twilight/{p-0259d6cb.system.entry.js.map → p-528aa2c4.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-39a319ec.system.entry.js.map → p-53e00642.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-4cf011a4.system.entry.js.map → p-5bae6d14.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-93e6452b.system.entry.js.map → p-64c8b0e2.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-0ba23365.system.entry.js.map → p-64de4869.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-e28d3b71.entry.js.map → p-675d4ab7.entry.js.map} +0 -0
- /package/dist/twilight/{p-5f352ca9.system.entry.js.map → p-68285203.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-f0dd4f76.entry.js.map → p-68327c54.entry.js.map} +0 -0
- /package/dist/twilight/{p-c0072de1.system.entry.js.map → p-6a8ba65f.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-099e8eb6.entry.js.map → p-6ad30bc0.entry.js.map} +0 -0
- /package/dist/twilight/{p-e1e90d0c.entry.js.map → p-6b1753ce.entry.js.map} +0 -0
- /package/dist/twilight/{p-36b00bb1.system.entry.js.map → p-71bd4d79.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-d14a8edc.system.entry.js.map → p-81b99416.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-cbcfb963.entry.js.map → p-87d32e2f.entry.js.map} +0 -0
- /package/dist/twilight/{p-b23ce243.system.entry.js.map → p-88e53a1e.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-83549a90.entry.js.map → p-9847a4f4.entry.js.map} +0 -0
- /package/dist/twilight/{p-a80652d3.entry.js.map → p-9e6c5671.entry.js.map} +0 -0
- /package/dist/twilight/{p-3ad79104.entry.js.map → p-a13fcfe1.entry.js.map} +0 -0
- /package/dist/twilight/{p-109f5735.entry.js.map → p-a6961af5.entry.js.map} +0 -0
- /package/dist/twilight/{p-f2bac5d5.system.entry.js.map → p-aa357e2b.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-d71d6dff.entry.js.map → p-aa49c07f.entry.js.map} +0 -0
- /package/dist/twilight/{p-e6d51e3a.entry.js.map → p-b0d88d59.entry.js.map} +0 -0
- /package/dist/twilight/{p-19061cec.entry.js.map → p-b7572664.entry.js.map} +0 -0
- /package/dist/twilight/{p-97cc91c4.entry.js.map → p-b94bc357.entry.js.map} +0 -0
- /package/dist/twilight/{p-ee66c0dd.entry.js.map → p-c09565da.entry.js.map} +0 -0
- /package/dist/twilight/{p-862ad154.entry.js.map → p-c38dbed0.entry.js.map} +0 -0
- /package/dist/twilight/{p-5cb3dd8e.system.entry.js.map → p-c5fa09d1.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-c6a3fdb0.entry.js.map → p-ccffcd08.entry.js.map} +0 -0
- /package/dist/twilight/{p-9fa8d963.entry.js.map → p-ce02710a.entry.js.map} +0 -0
- /package/dist/twilight/{p-f1d6fdbf.entry.js.map → p-d02a08e9.entry.js.map} +0 -0
- /package/dist/twilight/{p-3e960ee9.system.entry.js.map → p-d1ca52ee.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-3ad485dd.entry.js.map → p-d1ef5396.entry.js.map} +0 -0
- /package/dist/twilight/{p-1b42ce8a.entry.js.map → p-d3a36873.entry.js.map} +0 -0
- /package/dist/twilight/{p-7105480a.system.entry.js.map → p-d62c20f1.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-6a611226.entry.js.map → p-d660efad.entry.js.map} +0 -0
- /package/dist/twilight/{p-04e33bba.system.entry.js.map → p-dad1b603.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-55771cda.system.entry.js.map → p-de2b1078.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-007ca6d7.system.entry.js.map → p-e5eae8ce.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-ce103d4c.system.entry.js.map → p-ea832823.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-fba0b0f7.system.entry.js.map → p-ef823dbd.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-6e1ecf18.entry.js.map → p-f0cc5b35.entry.js.map} +0 -0
- /package/dist/twilight/{p-d8aab17c.system.entry.js.map → p-f1218836.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-7dc3a160.system.entry.js.map → p-f80b373d.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-ef04d7e0.entry.js.map → p-fa5ead87.entry.js.map} +0 -0
- /package/dist/twilight/{p-d1809737.entry.js.map → p-fcfd9a2b.entry.js.map} +0 -0
- /package/dist/twilight/{p-138b8ce7.entry.js.map → p-fe0234a1.entry.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"p-C0zi3xso.system.js","sources":["src/components/salla-notifications/salla-notifications.scss?tag=salla-notifications","src/components/salla-notifications/salla-notifications.tsx"],"sourcesContent":["","import { Component, h, State, Prop, Element } from '@stencil/core';\nimport { Notification } from \"./interfaces\"\nimport {Pagination} from \"../../interfaces\"\nimport Helper from '../../Helpers/Helper';\n\n@Component({\n tag: 'salla-notifications',\n styleUrl: 'salla-notifications.scss',\n})\nexport class SallaNotifications {\n\n constructor() {\n salla.lang.onLoaded(() => {\n this.no_notifications_trans = salla.lang.get('blocks.header.no_notifications');\n this.load_more_text_trans = salla.lang.get('common.elements.load_more')\n })\n }\n\n /**\n * Load more text\n */\n @Prop() loadMoreText: string;\n\n /**\n * Number of notifications to load per request.\n */\n @Prop() itemPerPage: number = 10;\n\n @State() pagination: Pagination;\n @State() total: number;\n @State() showPlaceholder: boolean;\n @State() nextPage: string;\n\n @State() no_notifications_trans = salla.lang.get('blocks.header.no_notifications')\n @State() load_more_text_trans = salla.lang.get('common.elements.load_more');\n\n private status: any;\n private btnLoader: any;\n private infiniteScroll: any;\n private wrapper: any;\n\n @Element() host: HTMLElement;\n\n // Show/hide loading\n private loading(isLoading = true) {\n let btnText = this.status?.querySelector('.s-button-text');\n if (btnText) {\n Helper.toggleElementClassIf(btnText, 's-button-hide', 's-button-show', () => isLoading);\n this.btnLoader.style.display = isLoading ? 'inherit' : 'none';\n }\n }\n\n private getNotificationCard(notification: Notification) {\n const notificationItem = document.createElement('salla-notification-item') as HTMLSallaNotificationItemElement;\n notificationItem.notification = notification;\n notificationItem.classList.add('s-block');\n return notificationItem;\n }\n\n\n render() {\n if (this.showPlaceholder) {\n return <div class=\"s-notifications-no-content\">\n <salla-placeholder alignment='center'>\n <span slot='title'>\n {this.no_notifications_trans}\n </span>\n </salla-placeholder>\n </div>\n }\n\n return <div class=\"s-notifications-wrapper\">\n <div class=\"s-notifications-container\" ref={wrapper => this.wrapper = wrapper}></div>\n\n {this.nextPage && (\n <div class=\"s-infinite-scroll-wrapper\" ref={status => this.status = status}>\n <button onClick={() => this.loadMore()} class=\"s-infinite-scroll-btn s-button-btn s-button-primary\">\n <span class=\"s-button-text s-infinite-scroll-btn-text\">{this.loadMoreText ?? this.load_more_text_trans}</span>\n <span class=\"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader\" ref={btnLoader => this.btnLoader = btnLoader} style={{ \"display\": \"none\" }}></span>\n </button>\n </div>\n )}\n </div>\n }\n\n\n private handleResponse(notificationsList: Notification[]) {\n return notificationsList.map(notification => this.getNotificationCard(notification))\n }\n\n private initiateInfiniteScroll() {\n if (!this.wrapper) {\n salla.logger.error('Wrapper is undefined. Cannot initiate infinite scroll.');\n return;\n }\n\n this.infiniteScroll = salla.infiniteScroll.initiate(this.wrapper, this.wrapper, {\n path: () => this.nextPage,\n history: true,\n nextPage: this.nextPage,\n scrollThreshold: false,\n }, true);\n\n this.infiniteScroll?.on('request', _response => {\n this.loading();\n });\n\n this.infiniteScroll?.on('load', response => {\n this.loading(false);\n this.pagination = response.pagination;\n this.nextPage = response.pagination.links?.next || null;\n this.handleResponse(response.data).forEach(data => this.wrapper.append(data))\n let items = this.host.querySelectorAll('salla-notification-item:not(.animated)');\n Helper.animateItems(items);\n });\n\n this.infiniteScroll?.on('error', (e) => {\n salla.logger.error('Error loading more comments:', e);\n });\n }\n\n private async loadInitialData() {\n await salla.api.notifications.fetch({\"per_page\": this.itemPerPage})\n .then(resp => {\n this.pagination = resp.pagination;\n this.total = resp.pagination.total;\n this.nextPage = resp.pagination.links?.next || null;\n\n // if (!this.notifications.length) {\n // this.showPlaceholder = true;\n // return this.loading(false);\n // }\n\n setTimeout(() => {\n if (!resp.data.length) {\n return this.showPlaceholder = true;\n }\n this.handleResponse(resp.data).forEach(data => this.wrapper.append(data))\n this.initiateInfiniteScroll();\n let items = this.wrapper.querySelectorAll('salla-notification-item:not(.animated)');\n Helper.animateItems(items);\n }, 100)\n })\n .catch(error => {\n salla.logger.error(error)\n this.showPlaceholder = true;\n this.loading(false)\n })\n }\n\n // Get next page\n async loadMore() {\n this.infiniteScroll?.loadNextPage();\n }\n\n async componentWillLoad() {\n await this.loadInitialData();\n }\n\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;YAAA,MAAM,qBAAqB,GAAG,EAAE;;kBCSnB,kBAAkB,kCAAA,MAAA;YAE7B,IAAA,WAAA,CAAA,OAAA,EAAA;;YAYA;;YAEG;YACK,QAAA,IAAW,CAAA,WAAA,GAAW,EAAE;oBAOvB,IAAsB,CAAA,sBAAA,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,gCAAgC,CAAC;oBACzE,IAAoB,CAAA,oBAAA,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,2BAA2B,CAAC;YAtBzE,QAAA,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAK;wBACvB,IAAI,CAAC,sBAAsB,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,gCAAgC,CAAC;wBAC9E,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,2BAA2B,CAAC;YACzE,SAAC,CAAC;YACH;;gBA4BO,OAAO,CAAC,SAAS,GAAG,IAAI,EAAA;;YAC9B,QAAA,IAAI,OAAO,GAAG,CAAA,EAAA,GAAA,IAAI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/components/salla-notifications/salla-notifications.tsx"],"sourcesContent":["","import { Component, h, State, Prop, Element } from '@stencil/core';\nimport { Notification } from \"./interfaces\"\nimport {Pagination} from \"../../interfaces\"\nimport Helper from '../../Helpers/Helper';\n\n@Component({\n tag: 'salla-notifications',\n styleUrl: 'salla-notifications.scss',\n})\nexport class SallaNotifications {\n\n constructor() {\n salla.lang.onLoaded(() => {\n this.no_notifications_trans = salla.lang.get('blocks.header.no_notifications');\n this.load_more_text_trans = salla.lang.get('common.elements.load_more')\n })\n }\n\n /**\n * Load more text\n */\n @Prop() loadMoreText: string;\n\n /**\n * Number of notifications to load per request.\n */\n @Prop() itemPerPage: number = 10;\n\n @State() pagination: Pagination;\n @State() total: number;\n @State() showPlaceholder: boolean;\n @State() nextPage: string;\n\n @State() no_notifications_trans = salla.lang.get('blocks.header.no_notifications')\n @State() load_more_text_trans = salla.lang.get('common.elements.load_more');\n\n private status: any;\n private btnLoader: any;\n private infiniteScroll: any;\n private wrapper: any;\n\n @Element() host: HTMLElement;\n\n // Show/hide loading\n private loading(isLoading = true) {\n let btnText = this.status?.querySelector('.s-button-text');\n if (btnText) {\n Helper.toggleElementClassIf(btnText, 's-button-hide', 's-button-show', () => isLoading);\n this.btnLoader.style.display = isLoading ? 'inherit' : 'none';\n }\n }\n\n private getNotificationCard(notification: Notification) {\n const notificationItem = document.createElement('salla-notification-item') as HTMLSallaNotificationItemElement;\n notificationItem.notification = notification;\n notificationItem.classList.add('s-block');\n return notificationItem;\n }\n\n\n render() {\n if (this.showPlaceholder) {\n return <div class=\"s-notifications-no-content\">\n <salla-placeholder alignment='center'>\n <span slot='title'>\n {this.no_notifications_trans}\n </span>\n </salla-placeholder>\n </div>\n }\n\n return <div class=\"s-notifications-wrapper\">\n <div class=\"s-notifications-container\" ref={wrapper => this.wrapper = wrapper}></div>\n\n {this.nextPage && (\n <div class=\"s-infinite-scroll-wrapper\" ref={status => this.status = status}>\n <button onClick={() => this.loadMore()} class=\"s-infinite-scroll-btn s-button-btn s-button-primary\">\n <span class=\"s-button-text s-infinite-scroll-btn-text\">{this.loadMoreText ?? this.load_more_text_trans}</span>\n <span class=\"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader\" ref={btnLoader => this.btnLoader = btnLoader} style={{ \"display\": \"none\" }}></span>\n </button>\n </div>\n )}\n </div>\n }\n\n\n private handleResponse(notificationsList: Notification[]) {\n return notificationsList.map(notification => this.getNotificationCard(notification))\n }\n\n private initiateInfiniteScroll() {\n if (!this.wrapper) {\n salla.logger.error('Wrapper is undefined. Cannot initiate infinite scroll.');\n return;\n }\n\n this.infiniteScroll = salla.infiniteScroll.initiate(this.wrapper, this.wrapper, {\n path: () => this.nextPage,\n history: true,\n nextPage: this.nextPage,\n scrollThreshold: false,\n }, true);\n\n this.infiniteScroll?.on('request', _response => {\n this.loading();\n });\n\n this.infiniteScroll?.on('load', response => {\n this.loading(false);\n this.pagination = response.pagination;\n this.nextPage = response.pagination.links?.next || null;\n this.handleResponse(response.data).forEach(data => this.wrapper.append(data))\n let items = this.host.querySelectorAll('salla-notification-item:not(.animated)');\n Helper.animateItems(items);\n });\n\n this.infiniteScroll?.on('error', (e) => {\n salla.logger.error('Error loading more comments:', e);\n });\n }\n\n private async loadInitialData() {\n await salla.api.notifications.fetch({\"per_page\": this.itemPerPage})\n .then(resp => {\n this.pagination = resp.pagination;\n this.total = resp.pagination.total;\n this.nextPage = resp.pagination.links?.next || null;\n\n // if (!this.notifications.length) {\n // this.showPlaceholder = true;\n // return this.loading(false);\n // }\n\n setTimeout(() => {\n if (!resp.data.length) {\n return this.showPlaceholder = true;\n }\n this.handleResponse(resp.data).forEach(data => this.wrapper.append(data))\n this.initiateInfiniteScroll();\n let items = this.wrapper.querySelectorAll('salla-notification-item:not(.animated)');\n Helper.animateItems(items);\n }, 100)\n })\n .catch(error => {\n salla.logger.error(error)\n this.showPlaceholder = true;\n this.loading(false)\n })\n }\n\n // Get next page\n async loadMore() {\n this.infiniteScroll?.loadNextPage();\n }\n\n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AI,CAAC,CAAC;4BACzE,IAAI,CAAC,sBAAsB,EAAE;4BAC7B,IAAI,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,wCAAwC,CAAC;YACnF,gBAAA,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC;yBAC3B,EAAE,GAAG,CAAC;YACT,SAAC;yBACA,KAAK,CAAC,KAAK,IAAG;YACb,YAAA,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;YACzB,YAAA,IAAI,CAAC,eAAe,GAAG,IAAI;YAC3B,YAAA,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;YACrB,SAAC,CAAC;;;YAIN,IAAA,MAAM,QAAQ,GAAA;;oBACZ,CAAA,EAAA,GAAA,IAAI,CAAC,cAAc,MAAE,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAA,YAAY,EAAE;;YAGrC,IAAA,MAAM,iBAAiB,GAAA;YACrB,QAAA,MAAM,IAAI,CAAC,eAAe,EAAE;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"p-
|
|
1
|
+
{"version":3,"file":"p-BL3DMysj.system.js","sources":["src/components/salla-advertisement/salla-advertisement.scss?tag=salla-advertisement","src/components/salla-advertisement/salla-advertisement.tsx"],"sourcesContent":[":host {\n display: block;\n}\n","import { Component, State, Element, h } from '@stencil/core';\nimport { Advertisement } from './interfaces';\nimport AnimeJS from 'animejs';\n/**\n * @name SallaAdvertisement\n * @description A StencilJS component for handling and displaying advertisements in different pages of salla applications.\n * @tag salla-advertisement\n */\n\n/**\n * @slot adv - Replaces the entire advertisement, has replaceable props `{icon}`, `{url}`, `{target}`, `{description}`, `{bg_color}`, `{text_color}`.\n * */\n@Component({\n tag: 'salla-advertisement',\n styleUrl: 'salla-advertisement.scss',\n})\nexport class SallaAdvertisement {\n /**\n * Constructor for initializing the component.\n */\n constructor() {\n salla.onReady(() => {\n this.currentSlug = salla.config.get(\"page.slug\");\n })\n\n this.advSlot = this.host.querySelector('[slot=\"adv\"]')?.innerHTML || `<div class=\"s-advertisement-content\"><h2 class=\"s-advertisement-content-main\">{iconElem}{urlElem}</h2>{closeElem}</div>\n `;\n }\n private readonly advSlot: string;\n // State properties for managing component state\n @State() position: string;\n @State() advertisements: Advertisement[];\n @State() advertIcon: string;\n @State() currentSlug: string = salla.config.get(\"page.slug\");\n\n @Element() private host: HTMLElement;\n\n\n /**\n * Checks whether an advertisement is marked as not visible/dismissed.\n * @param advert - The advertisement to check.\n * @returns True if the advertisement is not visible, false otherwise.\n */\n private isNotVisible(advert: Advertisement): boolean {\n return !!salla.storage.get(`statusAd-${advert.id}`)\n }\n\n /**\n * Sets a flag to control the visibility of an advertisement and triggers an animation when hiding it.\n * @param advert - The advertisement to update.\n * @param flag - The flag indicating whether to display or hide the advertisement.\n */\n private setCanDisplayFlag(advert: Advertisement, flag: boolean): void {\n if (!flag) {\n // Set the statusAd flag to 'dismissed'\n salla.storage.set(`statusAd-${advert.id}`, 'dismissed');\n // Trigger an animation to hide the advertisement\n AnimeJS({\n targets: this.host,\n opacity: [1, 0],\n duration: 300,\n height: [this.host.clientHeight, 0],\n easing: 'easeInOutQuad',\n });\n }\n }\n\n /**\n * Renders the advertisements based on the fetched data and visibility status.\n * @returns JSX for rendering advertisements.\n */\n render() {\n if ((Array.isArray(this.advertisements) && !this.advertisements.length) || !this.advertisements) {\n return;\n }\n return this.advertisements.map((advertisement: Advertisement) => {\n return <div class={{ \"s-hidden\": this.isNotVisible(advertisement), 's-advertisement': true }} data-id={advertisement.id}\n style={{ \"background-color\": advertisement.colors.bg, \"color\": advertisement.colors.text }}>\n <div id=\"adv-slot\" innerHTML={\n this.advSlot\n // Replace the props with the advertisement data\n // !Note: The props with the 'Elem' suffix are for internal use only.\n .replace(\"{iconElem}\", `<i class=\"s-advertisement-content-icon ${advertisement.icon}\"></i>`)\n .replace(\"{urlElem}\", advertisement.url ? `<a href=\"${advertisement.url}\" target=\"${advertisement.target}\">${advertisement.description}</a>` : advertisement.description)\n .replace(\"{closeElem}\", `<button class=\"s-advertisement-action\" aria-label=\"close-alert\"><i class=\"sicon-cancel\"></i></button>`)\n .replace('{icon}', advertisement.icon)\n .replace('{url}', advertisement.url)\n .replace('{target}', advertisement.target)\n .replace('{description}', advertisement.description)\n .replace('{bg_color}', advertisement.colors.bg)\n .replace('{text_color}', advertisement.colors.text)\n }></div>\n </div>\n }\n );\n }\n\n /**\n * Lifecycle method that fetches advertisements before the component is loaded.\n */\n componentWillLoad() {\n // Fetch advertisements based on the current page\n return (new Promise(resolve => salla.onReady(resolve)))\n .then(() => salla.api.advertisement.fetch(this.currentSlug))\n .then(resp => Array.isArray(resp.data) ? resp.data.find(ad => !salla.storage.get(`statusAd-${ad.id}`)) : null)\n .then(ad => this.advertisements = ad ? [ad] : []);\n }\n\n componentDidRender() {\n if ((Array.isArray(this.advertisements) && !this.advertisements.length) || !this.advertisements) {\n return;\n }\n // Add event listener for the close button\n setTimeout(() => {\n let closeBtn = this.host.querySelector('.s-advertisement-action');\n if (closeBtn) {\n closeBtn.addEventListener('click', () => this.setCanDisplayFlag(this.advertisements[0], false));\n }\n });\n\n // Reduce Dom size by removing the slot element\n this.host.querySelectorAll('#adv-slot').forEach(el => el?.replaceWith(el?.firstChild));\n this.host.querySelector('[slot=\"adv\"]')?.remove();\n\n // Trigger an animation to show the advertisement\n AnimeJS({\n targets: this.host,\n opacity: [0, 1],\n duration: 300,\n height: [0, this.host.clientHeight],\n easing: 'easeInOutQuad',\n });\n }\n}\n"],"names":["AnimeJS"],"mappings":";;;;;;;;;;;;;;;;MAAA,MAAM,qBAAqB,GAAG,sBAAsB;;YCgBvC,kBAAkB,kCAAA,MAAA;MAC7B;;MAEE;MACF,IAAA,WAAA,CAAA,OAAA,EAAA;;;cAaS,IAAW,CAAA,WAAA,GAAW,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC;MAZ1D,QAAA,KAA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Aa,CAAC,cAAc,CAAC,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAE,MAAM,EAAE;;MAGjD,QAAAA,KAAO,CAAC;kBACN,OAAO,EAAE,IAAI,CAAC,IAAI;MAClB,YAAA,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;MACf,YAAA,QAAQ,EAAE,GAAG;kBACb,MAAM,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;MACnC,YAAA,MAAM,EAAE,eAAe;MACxB,SAAA,CAAC;;;;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
System.register(["./p-
|
|
5
|
-
//# sourceMappingURL=p-
|
|
4
|
+
System.register(["./p-Ce2XJNsy.system.js"],(function(e){"use strict";var t;return{setters:[function(e){t=e.L}],execute:function(){function n(){if(!document.lazyLoadInstance){document.lazyLoadInstance=new t({use_native:true});document.lazyLoadBackgrounds=new t({elements_selector:".lazy[data-bg]:not(.loaded)"})}if(document.readyState!=="complete"){document.addEventListener("DOMContentLoaded",(function(){return document.lazyLoadInstance.update()}));document.addEventListener("DOMContentLoaded",(function(){return document.lazyLoadBackgrounds.update()}))}salla.infiniteScroll.event.onAppend((function(){document.lazyLoadInstance.update();document.lazyLoadBackgrounds.update()}))}var o=e("g",n)}}}));
|
|
5
|
+
//# sourceMappingURL=p-BMCxvVxH.system.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"p-
|
|
1
|
+
{"version":3,"file":"p-BMCxvVxH.system.js","sources":["src/global/app.ts","@stencil/core/internal/app-globals"],"sourcesContent":["import '@salla.sa/twilight'\nimport LazyLoad from \"vanilla-lazyload\";\n\nexport default function () {\n // Only initialize it one time for the entire application\n if (!document.lazyLoadInstance) {\n document.lazyLoadInstance = new LazyLoad({\n use_native: true,//native not support lazyLoad backgrounds\n // restore_on_error: true,\n // Your custom settings go here\n // callback_finish: () => document.lazyLoadBackgrounds.update(document.querySelectorAll('.lazy[data-bg]:not(.loaded)'))\n });\n document.lazyLoadBackgrounds = new LazyLoad({\n elements_selector: '.lazy[data-bg]:not(.loaded)',\n });\n //native way doesn't load backgrounds\n // document.lazyLoadBackgrounds = new LazyLoad();\n }\n //make sure that lazyLoad will be fired after loading the page too.\n if (document.readyState !== 'complete') {\n document.addEventListener(\"DOMContentLoaded\", () => document.lazyLoadInstance.update());\n document.addEventListener(\"DOMContentLoaded\", () => document.lazyLoadBackgrounds.update());\n }\n\n // fire it after each load more request;\n // @ts-ignore\n salla.infiniteScroll.event.onAppend(() => {\n document.lazyLoadInstance.update();\n document.lazyLoadBackgrounds.update();\n }\n );\n}\n","import appGlobalScript from '/home/runner/work/twilight/twilight/packages/twilight-components/src/global/app.ts';\nexport const globalScripts = appGlobalScript;\nexport const globalStyles = \"\";\n"],"names":[],"mappings":";;;;;;;;;;;;YAGc,wBAAA,IAAA;;YAEZ,IAAA,IAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAE;YAC9B,QAAA,QAAQ,CAAC,gBAAgB,GAAG,IAAI,QAAQ,CAAC;wBACvC,UAAU,EAAE,IAAI;;;;YAIjB,SAAA,CAAC;YACF,QAAA,QAAQ,CAAC,mBAAmB,GAAG,IAAI,QAAQ,CAAC;YACxC,YAAA,iBAAiB,EAAE,6BAA6B;YACnD,SAAA,CAAC;;;;;YAKJ,IAAA,IAAI,QAAQ,CAAC,UAAU,KAAK,UAAU,EAAE;YACtC,QAAA,QAAQ,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,MAAM,QAAQ,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC;YACvF,QAAA,QAAQ,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,MAAM,QAAQ,CAAC,mBAAmB,CAAC,MAAM,EAAE,CAAC;;;;gBAK5F,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAK;YAC/B,QAAA,QAAQ,CAAC,gBAAgB,CAAC,MAAM,EAAE;YAClC,QAAA,QAAQ,CAAC,mBAAmB,CAAC,MAAM,EAAE;YACzC,KAAC,CACJ;YACL;;AC9BY,kBAAC,aAAa,gBAAG;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"p-lKe9xnuY.system.js","sources":["src/components/salla-offer/interfaces.ts","src/components/salla-offer/salla-offer.scss?tag=salla-offer","src/components/salla-offer/salla-offer.tsx"],"sourcesContent":["export enum PageType {\n ProductDetail = \"product.single\",\n Cart = \"cart\"\n}\n\nexport enum OfferType {\n Conditional = \"conditional\",\n PercentageOrFixed = \"fixed\",\n DiscountsTable = \"discounts_table\",\n Bank = \"bank\",\n BuyXGetY = \"buy_x_get_y\",\n SpecialPrice = \"special_price\",\n}\n\n\nexport interface DiscountDetailFixed {\n discount_type: \"fixed\";\n min_spend: number;\n discount_value: number;\n}\n\nexport interface DiscountDetailFreeProduct {\n discount_type: \"free_product\";\n min_spend: number;\n discount_value: number;\n}\n\nexport interface DiscountDetailConditional extends Array<DiscountDetailFixed | DiscountDetailFreeProduct> {}\n\nexport interface DiscountDetailPercentageFixed {\n apply_to: \"all\" | \"products\" | \"categories\" | \"payment_methods\";\n targets: Array<string | number>;\n ends_at: number;\n min_spend: number;\n discount_value: number;\n}\n\nexport interface Discount {\n discounted_amount: any;\n quantity: number;\n percentage: number;\n}\n\nexport interface DiscountDetailTable {\n apply_to: \"all\" | \"products\" | \"categories\" | \"payment_methods\" | \"order\";\n discount_value: number;\n ends_at: string;\n min_items: number;\n min_spend: number;\n show_price_after_discount: boolean;\n discounts: Discount[];\n}\n\nexport interface BankOffer {\n logo: string;\n discount_value: number;\n discount_type: string;\n minimum_spend: number;\n payments: string[];\n}\n\nexport interface SpecialPriceDetail {\n apply_to: \"product\" | \"category\";\n discount_value: number;\n ends_at: number;\n min_items: number; \n min_spend: number;\n targets: Array<string | number>;\n products?: Product[];//we will set this dynamically\n categories?: Category[];//we will set this dynamically\n\n}\n\nexport interface BuyXGetYDetail {\n ends_at: number;\n buy: {\n source: \"product\" | \"category\";\n source_value: number[];\n quantity: number;\n };\n get: {\n source: \"products\" | \"category\";\n source_value: number[];\n type: \"free_product\" | \"percentage\" | \"fixed\";\n value: number;\n products?: Product[];//we will set this dynamically\n categories?: Category[];//we will set this dynamically\n };\n}\n\nexport interface Offer {\n id: number;\n title: string;\n description: string;\n type: OfferType | \"conditional\" | \"fixed\" | \"discounts_table\" | \"bank\" | \"buy_x_get_y\";\n details: DiscountDetailConditional | DiscountDetailPercentageFixed | DiscountDetailTable | BankOffer | BuyXGetYDetail | SpecialPriceDetail;\n}\n\nexport interface Product {\n id: number;\n type: string;\n status: string;\n is_available: boolean;\n sku: string;\n name: string;\n price: { amount: number; currency: string; };\n promotion: { title: string; sub_title: string; };\n sale_price: { amount: number; currency: string; };\n regular_price: { amount: number; currency: string; };\n currency: string;\n url: string;\n thumbnail: string;\n has_special_price: boolean;\n favorite?: any;\n}\n\nexport interface Category {\n id?: string;\n id_?: number;\n name?: string;\n url?: string;\n icon?: string;\n sub_categories?: Category[];\n items?: any[] | null;\n}\n\nexport interface Currency {\n code: string | 'SAR';\n name: string;\n symbol: string;\n amount?: number;\n country_code?: string;\n}\n",".s-offer-wrapper .s-slider-block__title {\n h2 {\n font-size: 1.125rem;\n line-height: 1.75rem;\n color: #f87171;\n\n &::before {\n font-family: \"sallaicons\";\n content: \"\\ee30\" !important;\n position: absolute;\n top: 1rem;\n font-size: 3rem;\n font-weight: 400;\n line-height: 1;\n color: #fef2f2;\n }\n }\n}\n\n.s-offer-bank-wrapper-sinlge-item{\n display: flex;\n align-items: center !important;\n gap: 14px;\n}\n\n.s-offer-bank-wrapper {\n display: flex !important;\n width: 100% !important;\n}\n\n// .s-offer-bank-wrapper {\n // \n// }","import { Component, Element, Prop, State, h } from '@stencil/core';\nimport { Offer, Category, Product, Discount, Currency, BuyXGetYDetail, PageType, OfferType, BankOffer,SpecialPriceDetail, DiscountDetailTable } from './interfaces';\n\n\n/**\n * `salla-offer` is a StencilJS component that displays offers, categories, products, banks, and discount information.\n * It uses the `salla-slider` component for carousel functionality.\n *\n * @slot category - The slot for customizing the category entry layout.\n *\n * @csspart custom - Custom CSS part to target specific elements in the component.\n *\n * @example\n * <salla-offer product-id=\"123\"></salla-offer>\n */\n@Component({\n tag: 'salla-offer',\n styleUrl: 'salla-offer.scss',\n})\nexport class SallaOffer {\n\n constructor() {\n // Language\n salla.lang.onLoaded(() => {\n this.offer_with_price_text = salla.lang.get('pages.offer.with_price');\n this.with_discount_text = salla.lang.get('pages.products.with_a_discount');\n this.product_discount_text = salla.lang.get('pages.products.discount');\n this.special_offer_text = salla.lang.get('pages.products.special_offer');\n this.multipleBankOfferTitleText = salla.lang.get('pages.offer.multiple_bank_offers_title');\n this.multipleBankOfferTitleDescription = salla.lang.get('pages.offer.multiple_bank_offers_message');\n this.buy_quantity_text(0);\n })\n\n salla.onReady(() => {\n this.currentPage = salla.config.get('page.slug')\n this.userCurrency = salla.config.get('currencies')[salla.config.get('user.currency_code')].symbol\n });\n\n this.categorySlot = this.host.querySelector('[slot=\"category\"]')?.innerHTML || '<a href={url} class=\"s-offer-slide-cat-entry\"><i class={icon}></i><h4>{name}</h4></a>';\n }\n\n /**\n * Custom Card Component for the Salla Products List.\n *\n * This component allows you to customize the appearance of individual product cards within a Salla Products List.\n *\n * @example\n * <salla-products-list product-card-component=\"my-custom-card-style1\" ...\n * <salla-products-list product-card-component=\"my-custom-card-style2\" ...\n */\n @Prop() productCardComponent: string = 'custom-salla-product-card';\n\n // Declare component state variables\n @State() offersList: Offer[] = [];\n @State() userCurrency: Currency;\n @State() isMultipleBank: boolean = false;\n @State() title?: string;\n @State() currentPage: string;\n @State() hasCustomComponent: boolean;\n\n @State() isBankOffer: boolean = false;\n @State() canRender: boolean = false;\n @State() showOffer: boolean = salla.config.get('store.settings.product.show_special_offers');\n\n // Default translated texts\n @State() offer_with_price_text: string = salla.lang.get('pages.offer.with_price', { price: '' });\n @State() with_discount_text: string = salla.lang.get('pages.products.with_a_discount')\n @State() product_discount_text: string = salla.lang.get('pages.products.discount')\n @State() special_offer_text: string = salla.lang.get('pages.products.special_offer')\n @State() multipleBankOfferTitleText: string = salla.lang.get('pages.offer.multiple_bank_offers_title')\n @State() multipleBankOfferTitleDescription: string = salla.lang.get('pages.offer.multiple_bank_offers_message')\n @State() buy_quantity_text: (quantity: number) => string = (quantity) => salla.lang.get('pages.offer.buy_quantity', { quantity })\n\n // Reference to the host element\n @Element() host: HTMLElement;\n\n private categorySlot: string;\n\n private async getEndpointByPageName(): Promise<string> {\n if (this.currentPage == PageType.Cart) {\n const cartId = await Salla.cart.getCurrentCartId();\n return `offers/cart/${cartId}`;\n }\n\n if (this.currentPage == PageType.ProductDetail) {\n return `offers/product/${salla.config.get('page.id')}`;\n }\n\n return \"offers\";\n }\n\n /**\n * Emits a promotion viewed event for analytics tracking\n */\n private emitPromotionViewed(): void {\n if(!(this.offersList.length && this.canRender && this.showOffer)) return;\n \n // Transform offer data to match analytics expectations\n const promotionData = {\n id: this.offersList[0].id,\n name: this.offersList[0].title,\n creative: this.offersList[0].description || '',\n position: 1 \n };\n \n salla.event.emit('promotion::viewed', [promotionData]);\n }\n /**\n * Emits a promotion clicked event\n */\n private emitPromotionClicked(position: number = 1): void {\n if(!(this.offersList.length && this.canRender && this.showOffer)) return;\n \n // Transform offer data to match analytics expectations\n const promotionData = {\n id: this.offersList[0].id,\n name: this.offersList[0].title,\n creative: this.offersList[0].description || '',\n position: position\n };\n \n salla.event.emit('promotion::clicked', [promotionData]);\n }\n\n componentWillLoad() {\n this.hasCustomComponent = !!customElements.get(this.productCardComponent);\n // let offers = this.getOffersFromStorage();\n // if (offers) {\n // return offers.then(offersFromStorage => this.offersList = offersFromStorage);\n // }\n\n return (new Promise(resolve => salla.onReady(resolve)))\n .then(() => {\n this.showOffer = !salla.url.is_page('product.single') || salla.config.get('store.settings.product.show_special_offers')\n if (this.showOffer) {\n return;\n }\n throw new Error(\"Merchant disabled showing the offers on product page\");\n }\n )\n .then(async () => salla.api.request(await this.getEndpointByPageName()))\n .then((res) => {\n if (!(this.offersList = res.data).length) {\n throw new Error('salla-offers:: There is no offers!');\n }\n //we support these offers only\n const offer = this.offersList.find(offer => [OfferType.SpecialPrice,OfferType.Bank, OfferType.BuyXGetY, OfferType.DiscountsTable].includes(offer.type as any));\n if (!offer) {\n throw new Error('salla-offers:: Offer type not supported yet!');\n }\n //because there is no need for special handling for discounts table, just skip the other cases\n if (offer.type === OfferType.DiscountsTable) {\n return this.offersList = [offer];\n }\n\n //if it's banks offer, we need to include the other banks overs\n if ((this.isBankOffer = offer.type === OfferType.Bank)) {\n this.offersList = this.offersList.filter(offer => offer.type === OfferType.Bank);\n this.isMultipleBank = this.offersList.length > 1;\n return this.offersList;\n }\n\n //if it's special price offer\n if (offer.type === OfferType.SpecialPrice) {\n const details = offer.details as SpecialPriceDetail;\n\n return details.apply_to === 'product'\n // Avoid additional requests; use `salla-products-slider` and pass the custom card\n ? salla.product.api.fetch({ source: \"selected\", source_value: details.targets})\n .then((response: any) => {\n (offer.details as any).products = response.data; // Set the fetched products\n return this.offersList = [offer];\n })\n : salla.product.api.categories() // Fetch all categories in one query\n .then((res) => {\n const categoriesToRender = this.findCategories(res.data, details.targets); // Extract only the selected categories\n (offer.details as any).categories = categoriesToRender;\n return this.offersList = [offer];\n });\n }\n\n //BuyXGetY offers\n const getY = (offer.details as BuyXGetYDetail).get;\n return getY.source === 'products'\n //todo:: avoid this request, and the handling for the products, just use `salla-products-slider` and don't forget to pass the customcard\n ? salla.product.api.fetch({ source: \"selected\", source_value: getY.source_value })\n .then((response: any) => {\n getY.products = response.data;\n (offer.details as any).get = getY;\n return this.offersList = [offer];\n })//set the products\n : salla.product.api.categories()//get all categories in one query, then extract only the selected one, instead of sending multi requests\n .then((res) => {\n getY.categories = this.findCategories(res.data, getY.source_value);\n (offer.details as any).get = getY;\n return this.offersList = [offer];\n });\n })\n .then((offers: Offer[]) => {\n salla.storage.set(this.getStorageKey(), { offers, stored_at: new Date().getTime() });\n this.canRender = true;\n })\n .catch((error) => {\n salla.logger.warn(error)\n });\n }\n\n componentDidLoad() {\n let nav = this.host.querySelector('.s-slider-block__title-nav');\n nav?.classList.add(\"s-offer-bank-payment-nav\")\n this.emitPromotionViewed();\n }\n\n \n\n\n findCategories(categories: Category[], ids: any[]): Category[] {\n let found: Category[] = [];\n for (const category of categories) {\n if (ids.includes(category.id_ || category.id)) { //here we are using || because we are planning to drop `id_`\n found.push(category);\n }\n if (category.sub_categories?.length > 0) {\n found = found.concat(this.findCategories(category.sub_categories, ids));\n }\n }\n\n return found;\n }\n\n //todo::add to the key params, to make sure it will support multi offers in the same page if it's wanted\n getStorageKey(): string {\n try {\n const pageSlug = salla.config.get('page.slug').replace('.', '_');\n const locale = salla.lang.getLocale();\n const currencyCode = salla.config.currency().code;\n\n if (!pageSlug || !locale || !currencyCode) {\n throw new Error('Unable to get the storage key.');\n }\n\n return `s-offers-${pageSlug}-${salla.config.get('page.id')}-${locale}-${currencyCode}`;\n } catch (error) {\n return '';\n }\n }\n\n //@ts-ignore\n getOffersFromStorage(): null | Promise<Offer[]> {\n let storageOffers = salla.storage.get(this.getStorageKey());\n //if the offers not existed, or it has been stored before 10 minutes from now, ignore it;\n if (!storageOffers || storageOffers.stored_at < (new Date().getTime() - 10 * 60 * 1000)) {\n salla.storage.remove(this.getStorageKey());\n return null;\n }\n this.canRender = true;\n\n //return it as resolve to support .then\n return Promise.resolve(storageOffers.offers);\n }\n\n render() {\n // Check if the offers list is empty or if the component is not ready to render\n if (!this.offersList.length || !this.canRender || !this.showOffer) return null;\n const offer: Offer = this.offersList[0];\n\n const blockTitle = this.isBankOffer ? (this.isMultipleBank ? this.multipleBankOfferTitleText : null) : offer.title;\n const blockSubTitle = this.isBankOffer ? (this.isMultipleBank ? this.multipleBankOfferTitleDescription : null) : offer.description;\n\n const titles = {\n 'block-title': blockTitle,\n 'block-subTitle': blockSubTitle,\n 'show-controls': this.isMultipleBank\n };\n\n return (\n <div class=\"s-offer-wrapper\" onClick={() => this.emitPromotionClicked()}>\n {<p class=\"s-offer-corner-badge\">{this.special_offer_text}</p>}\n {/* discounts table is not a slider, it's a table🤔 */}\n {/* single bank offer is not a slider, it's a dom without slider🤔 */}\n <salla-slider type=\"carousel\" id=\"offer-slider\" {...titles}>\n <div slot='items'>\n {this.renderSectionForOfferType(offer.type)}\n </div>\n </salla-slider>\n </div>\n );\n }\n\n private renderSectionForOfferType(offerType: OfferType | string) {\n if (this.isBankOffer) {\n return this.renderBankSection();\n }\n if (offerType == OfferType.SpecialPrice) {\n return this.renderSpecialPriceSection();\n }\n if (offerType == OfferType.BuyXGetY) {\n return this.renderBuyXGetYSection();\n }\n\n return this.renderDiscountTableSection();\n }\n\n /**\n * Generates content for the categories section.\n *\n * @param offeredCategories - An array of Category objects.\n * @returns An array of HTML elements representing categories.\n */\n private getCategoriesSection(category: Category) {\n return <div class=\"s-offer-slide-one-sixth swiper-slide\" innerHTML={this.categorySlot\n .replace(/\\{url\\}/g, category.url)\n .replace(/\\{icon\\}/g, category.icon || \"sicon-store\")\n .replace(/\\{name\\}/g, category.name)}></div>\n }\n\n private renderBuyXGetYSection() {\n const details = (this.offersList[0].details as BuyXGetYDetail)\n return [\n details.get.products?.map((product: Product) => (\n <div class=\"s-offer-slide-one-fourth\">\n {this.hasCustomComponent\n ? <this.productCardComponent product={product}></this.productCardComponent>\n : <salla-product-card shadow-on-hover product={product}></salla-product-card>}\n </div>\n )),\n details.get.categories?.map((category: Category) => this.getCategoriesSection(category))\n ];\n }\n\n /**\n * Generates content for the bank section.\n *\n * @param offeredBank - An array of Bank objects.\n * @param name - The title of the current offer.\n * @param description - The description of the current offer.\n * @returns An array of HTML elements representing banks.\n *\n * TODO: loop over the list and filter bank types and pass it to this function\n */\n private renderBankSection() {\n return this.offersList.map((bankOffer: Offer) => {\n return <div class={{ \"s-offer-slide-one-sixth\": this.isMultipleBank, \"s-offer-bank-wrapper-sinlge-item\": !this.isMultipleBank }}>\n <div class={{ \"s-offer-bank-wrapper\": true, \"s-offer-slide-one-sixth\": !this.isMultipleBank, \"s-offer-bank-wrapper-multi-spacer\": this.isMultipleBank }}>\n <div class=\"s-offer-bank-logo\">\n <img src={(bankOffer.details as BankOffer).logo || salla.url.cdn('images/s-empty.png')} data-src={(bankOffer.details as BankOffer).logo} alt={bankOffer.title + \" offer\"} />\n </div>\n <ul class=\"s-offer-bank-payment-wrapper\">\n {(bankOffer.details as BankOffer).payments.map((payment: string) => {\n return <li class=\"s-offer-bank-payment-single\">\n <img\n src={salla.url.cdn('images/payment/' + payment + '.png') || salla.url.cdn('images/s-empty.png')}\n data-src={salla.url.cdn('images/payment/' + payment + '.png')}\n alt=\"payment\" />\n </li>\n })}\n </ul>\n {this.isMultipleBank ?\n <p class=\"s-offer-bank-payment-discount-percent\">\n {`${this.product_discount_text} ${(bankOffer.details as BankOffer).discount_value}${(bankOffer.details as BankOffer).discount_type === \"percentage\" && '%'}`}\n </p>\n : \"\"}\n </div>\n {!this.isMultipleBank ?\n <div class=\"s-offer-bank-message s-offer-slide-one-fourth\">\n <h2>{this.offersList[0].title}</h2>\n <p innerHTML={this.generateBankDescription(this.offersList[0].description, (bankOffer.details as BankOffer).discount_value)}></p>\n </div>\n : \"\"}\n </div>\n })\n }\n\n private generateBankDescription(desc: string, value): string {\n return desc.replace(new RegExp(`${value} %`), `<span class=\"s-offer-bank-message-amount\">${value} %</span>`)\n }\n\n /**\n * Generates content for the discount table section.\n *\n * @param discountTable - An array of Discount objects.\n * @returns An array of HTML elements representing discounts_table.\n */\n private renderDiscountTableSection() {\n const offer: Offer = this.offersList[0];\n let show_discounted_price = (offer.details as DiscountDetailTable).show_price_after_discount;\n return (this.offersList[0].details as DiscountDetailTable).discounts?.map((discount: Discount) => <div class=\"s-offer-slide-one-fourth\">\n <div class=\"s-offer-slide-offer-entry\">\n <div class=\"s-offer-slide-offer-entry-price-quantity-container\">\n <p class=\"s-offer-slide-offer-entry-quantity\">{this.buy_quantity_text(discount.quantity)}</p>\n {show_discounted_price ?\n <div class=\"s-offer-slide-offer-entry-price\">\n <span>{this.offer_with_price_text}</span>\n <span class=\"s-offer-slide-offer-entry-price-amount\">{discount.discounted_amount}</span> <span>{this.userCurrency}</span>\n </div> : \"\"}\n </div>\n <p class=\"s-offer-slide-offer-entry-price-amount-percent\">{this.with_discount_text}\n (<span>{discount.percentage}{!!discount.percentage && '%'}</span>)</p>\n </div>\n </div>\n )\n }\n\n private renderSpecialPriceSection() {\n const details = this.offersList[0].details as SpecialPriceDetail;\n\n return [\n // Render products if `apply_to` is \"product\"\n details.apply_to === \"product\" &&\n details.products?.map((product:Product) => (\n <div class=\"s-offer-slide-one-fourth\">\n {this.hasCustomComponent\n ? <this.productCardComponent product={product}></this.productCardComponent>\n : <salla-product-card shadow-on-hover product={product}></salla-product-card>}\n </div>\n )),\n\n // Render categories if `apply_to` is \"category\"\n details.apply_to === \"category\" &&\n details.categories?.map((category: Category) => this.getCategoriesSection(category)),\n ];\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;YAAA,IAAY,QAGX;YAHD,CAAA,UAAY,QAAQ,EAAA;YAClB,IAAA,QAAA,CAAA,eAAA,CAAA,GAAA,gBAAgC;YAChC,IAAA,QAAA,CAAA,MAAA,CAAA,GAAA,MAAa;YACf,CAAC,EAHW,QAAQ,KAAR,QAAQ,GAGnB,EAAA,CAAA,CAAA;YAED,IAAY,SAOX;YAPD,CAAA,UAAY,SAAS,EAAA;YACnB,IAAA,SAAA,CAAA,aAAA,CAAA,GAAA,aAA2B;YAC3B,IAAA,SAAA,CAAA,mBAAA,CAAA,GAAA,OAA2B;YAC3B,IAAA,SAAA,CAAA,gBAAA,CAAA,GAAA,iBAAkC;YAClC,IAAA,SAAA,CAAA,MAAA,CAAA,GAAA,MAAa;YACb,IAAA,SAAA,CAAA,UAAA,CAAA,GAAA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ACN,CAAG,CAAA,GAAA,EAAA,EAAA,KAAK,EAAC,gDAAgD,EAAA,EAAE,IAAI,CAAC,kBAAkB,OAC/E,CAAA,CAAA,MAAA,EAAA,IAAA,EAAO,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,GAAG,CAAQ,MAAK,CACpE,CACF,CACL;;gBAGK,yBAAyB,GAAA;;oBAC/B,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,OAA6B;oBAEhE,OAAO;;wBAEL,OAAO,CAAC,QAAQ,KAAK,SAAS;6BAC9B,CAAA,EAAA,GAAA,OAAO,CAAC,QAAQ,0CAAE,GAAG,CAAC,CAAC,OAAe,MACpC,WAAK,KAAK,EAAC,0BAA0B,EAClC,EAAA,IAAI,CAAC;YACJ,sBAAE,EAAC,IAAI,CAAC,oBAAoB,EAAC,EAAA,OAAO,EAAE,OAAO,EAA8B;YAC3E,sBAAE,mDAAoC,OAAO,EAAE,OAAO,EAAuB,CAAA,CAC3E,CACP,CAAC,CAAA;;wBAGF,OAAO,CAAC,QAAQ,KAAK,UAAU;YAC/B,iBAAA,CAAA,EAAA,GAAA,OAAO,CAAC,UAAU,0CAAE,GAAG,CAAC,CAAC,QAAkB,KAAK,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC,CAAA;qBACrF;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"p-BMe9fgvJ.system.js","sources":["src/components/salla-offer/interfaces.ts","src/components/salla-offer/salla-offer.scss?tag=salla-offer","src/components/salla-offer/salla-offer.tsx"],"sourcesContent":["export enum PageType {\n ProductDetail = \"product.single\",\n Cart = \"cart\"\n}\n\nexport enum OfferType {\n Conditional = \"conditional\",\n PercentageOrFixed = \"fixed\",\n DiscountsTable = \"discounts_table\",\n Bank = \"bank\",\n BuyXGetY = \"buy_x_get_y\",\n SpecialPrice = \"special_price\",\n}\n\n\nexport interface DiscountDetailFixed {\n discount_type: \"fixed\";\n min_spend: number;\n discount_value: number;\n}\n\nexport interface DiscountDetailFreeProduct {\n discount_type: \"free_product\";\n min_spend: number;\n discount_value: number;\n}\n\nexport interface DiscountDetailConditional extends Array<DiscountDetailFixed | DiscountDetailFreeProduct> {}\n\nexport interface DiscountDetailPercentageFixed {\n apply_to: \"all\" | \"products\" | \"categories\" | \"payment_methods\";\n targets: Array<string | number>;\n ends_at: number;\n min_spend: number;\n discount_value: number;\n}\n\nexport interface Discount {\n discounted_amount: any;\n quantity: number;\n percentage: number;\n}\n\nexport interface DiscountDetailTable {\n apply_to: \"all\" | \"products\" | \"categories\" | \"payment_methods\" | \"order\";\n discount_value: number;\n ends_at: string;\n min_items: number;\n min_spend: number;\n show_price_after_discount: boolean;\n discounts: Discount[];\n}\n\nexport interface BankOffer {\n logo: string;\n discount_value: number;\n discount_type: string;\n minimum_spend: number;\n payments: string[];\n}\n\nexport interface SpecialPriceDetail {\n apply_to: \"product\" | \"category\";\n discount_value: number;\n ends_at: number;\n min_items: number; \n min_spend: number;\n targets: Array<string | number>;\n products?: Product[];//we will set this dynamically\n categories?: Category[];//we will set this dynamically\n\n}\n\nexport interface BuyXGetYDetail {\n ends_at: number;\n buy: {\n source: \"product\" | \"category\";\n source_value: number[];\n quantity: number;\n };\n get: {\n source: \"products\" | \"category\";\n source_value: number[];\n type: \"free_product\" | \"percentage\" | \"fixed\";\n value: number;\n products?: Product[];//we will set this dynamically\n categories?: Category[];//we will set this dynamically\n };\n}\n\nexport interface Offer {\n id: number;\n title: string;\n description: string;\n type: OfferType | \"conditional\" | \"fixed\" | \"discounts_table\" | \"bank\" | \"buy_x_get_y\";\n details: DiscountDetailConditional | DiscountDetailPercentageFixed | DiscountDetailTable | BankOffer | BuyXGetYDetail | SpecialPriceDetail;\n}\n\nexport interface Product {\n id: number;\n type: string;\n status: string;\n is_available: boolean;\n sku: string;\n name: string;\n price: { amount: number; currency: string; };\n promotion: { title: string; sub_title: string; };\n sale_price: { amount: number; currency: string; };\n regular_price: { amount: number; currency: string; };\n currency: string;\n url: string;\n thumbnail: string;\n has_special_price: boolean;\n favorite?: any;\n}\n\nexport interface Category {\n id?: string;\n id_?: number;\n name?: string;\n url?: string;\n icon?: string;\n sub_categories?: Category[];\n items?: any[] | null;\n}\n\nexport interface Currency {\n code: string | 'SAR';\n name: string;\n symbol: string;\n amount?: number;\n country_code?: string;\n}\n",".s-offer-wrapper .s-slider-block__title {\n h2 {\n font-size: 1.125rem;\n line-height: 1.75rem;\n color: #f87171;\n\n &::before {\n font-family: \"sallaicons\";\n content: \"\\ee30\" !important;\n position: absolute;\n top: 1rem;\n font-size: 3rem;\n font-weight: 400;\n line-height: 1;\n color: #fef2f2;\n }\n }\n}\n\n.s-offer-bank-wrapper-sinlge-item{\n display: flex;\n align-items: center !important;\n gap: 14px;\n}\n\n.s-offer-bank-wrapper {\n display: flex !important;\n width: 100% !important;\n}\n\n// .s-offer-bank-wrapper {\n // \n// }","import { Component, Element, Prop, State, h } from '@stencil/core';\nimport { Offer, Category, Product, Discount, Currency, BuyXGetYDetail, PageType, OfferType, BankOffer,SpecialPriceDetail, DiscountDetailTable } from './interfaces';\n\n\n/**\n * `salla-offer` is a StencilJS component that displays offers, categories, products, banks, and discount information.\n * It uses the `salla-slider` component for carousel functionality.\n *\n * @slot category - The slot for customizing the category entry layout.\n *\n * @csspart custom - Custom CSS part to target specific elements in the component.\n *\n * @example\n * <salla-offer product-id=\"123\"></salla-offer>\n */\n@Component({\n tag: 'salla-offer',\n styleUrl: 'salla-offer.scss',\n})\nexport class SallaOffer {\n\n constructor() {\n // Language\n salla.lang.onLoaded(() => {\n this.offer_with_price_text = salla.lang.get('pages.offer.with_price');\n this.with_discount_text = salla.lang.get('pages.products.with_a_discount');\n this.product_discount_text = salla.lang.get('pages.products.discount');\n this.special_offer_text = salla.lang.get('pages.products.special_offer');\n this.multipleBankOfferTitleText = salla.lang.get('pages.offer.multiple_bank_offers_title');\n this.multipleBankOfferTitleDescription = salla.lang.get('pages.offer.multiple_bank_offers_message');\n this.buy_quantity_text(0);\n })\n\n salla.onReady(() => {\n this.currentPage = salla.config.get('page.slug')\n this.userCurrency = salla.config.get('currencies')[salla.config.get('user.currency_code')].symbol\n });\n\n this.categorySlot = this.host.querySelector('[slot=\"category\"]')?.innerHTML || '<a href={url} class=\"s-offer-slide-cat-entry\"><i class={icon}></i><h4>{name}</h4></a>';\n }\n\n /**\n * Custom Card Component for the Salla Products List.\n *\n * This component allows you to customize the appearance of individual product cards within a Salla Products List.\n *\n * @example\n * <salla-products-list product-card-component=\"my-custom-card-style1\" ...\n * <salla-products-list product-card-component=\"my-custom-card-style2\" ...\n */\n @Prop() productCardComponent: string = 'custom-salla-product-card';\n\n // Declare component state variables\n @State() offersList: Offer[] = [];\n @State() userCurrency: Currency;\n @State() isMultipleBank: boolean = false;\n @State() title?: string;\n @State() currentPage: string;\n @State() hasCustomComponent: boolean;\n\n @State() isBankOffer: boolean = false;\n @State() canRender: boolean = false;\n @State() showOffer: boolean = salla.config.get('store.settings.product.show_special_offers');\n\n // Default translated texts\n @State() offer_with_price_text: string = salla.lang.get('pages.offer.with_price', { price: '' });\n @State() with_discount_text: string = salla.lang.get('pages.products.with_a_discount')\n @State() product_discount_text: string = salla.lang.get('pages.products.discount')\n @State() special_offer_text: string = salla.lang.get('pages.products.special_offer')\n @State() multipleBankOfferTitleText: string = salla.lang.get('pages.offer.multiple_bank_offers_title')\n @State() multipleBankOfferTitleDescription: string = salla.lang.get('pages.offer.multiple_bank_offers_message')\n @State() buy_quantity_text: (quantity: number) => string = (quantity) => salla.lang.get('pages.offer.buy_quantity', { quantity })\n\n // Reference to the host element\n @Element() host: HTMLElement;\n\n private categorySlot: string;\n\n private async getEndpointByPageName(): Promise<string> {\n if (this.currentPage == PageType.Cart) {\n const cartId = await Salla.cart.getCurrentCartId();\n return `offers/cart/${cartId}`;\n }\n\n if (this.currentPage == PageType.ProductDetail) {\n return `offers/product/${salla.config.get('page.id')}`;\n }\n\n return \"offers\";\n }\n\n /**\n * Emits a promotion viewed event for analytics tracking\n */\n private emitPromotionViewed(): void {\n if(!(this.offersList.length && this.canRender && this.showOffer)) return;\n \n // Transform offer data to match analytics expectations\n const promotionData = {\n id: this.offersList[0].id,\n name: this.offersList[0].title,\n creative: this.offersList[0].description || '',\n position: 1 \n };\n \n salla.event.emit('promotion::viewed', [promotionData]);\n }\n /**\n * Emits a promotion clicked event\n */\n private emitPromotionClicked(position: number = 1): void {\n if(!(this.offersList.length && this.canRender && this.showOffer)) return;\n \n // Transform offer data to match analytics expectations\n const promotionData = {\n id: this.offersList[0].id,\n name: this.offersList[0].title,\n creative: this.offersList[0].description || '',\n position: position\n };\n \n salla.event.emit('promotion::clicked', [promotionData]);\n }\n\n componentWillLoad() {\n this.hasCustomComponent = !!customElements.get(this.productCardComponent);\n // let offers = this.getOffersFromStorage();\n // if (offers) {\n // return offers.then(offersFromStorage => this.offersList = offersFromStorage);\n // }\n\n return (new Promise(resolve => salla.onReady(resolve)))\n .then(() => {\n this.showOffer = !salla.url.is_page('product.single') || salla.config.get('store.settings.product.show_special_offers')\n if (this.showOffer) {\n return;\n }\n throw new Error(\"Merchant disabled showing the offers on product page\");\n }\n )\n .then(async () => salla.api.request(await this.getEndpointByPageName()))\n .then((res) => {\n if (!(this.offersList = res.data).length) {\n throw new Error('salla-offers:: There is no offers!');\n }\n //we support these offers only\n const offer = this.offersList.find(offer => [OfferType.SpecialPrice,OfferType.Bank, OfferType.BuyXGetY, OfferType.DiscountsTable].includes(offer.type as any));\n if (!offer) {\n throw new Error('salla-offers:: Offer type not supported yet!');\n }\n //because there is no need for special handling for discounts table, just skip the other cases\n if (offer.type === OfferType.DiscountsTable) {\n return this.offersList = [offer];\n }\n\n //if it's banks offer, we need to include the other banks overs\n if ((this.isBankOffer = offer.type === OfferType.Bank)) {\n this.offersList = this.offersList.filter(offer => offer.type === OfferType.Bank);\n this.isMultipleBank = this.offersList.length > 1;\n return this.offersList;\n }\n\n //if it's special price offer\n if (offer.type === OfferType.SpecialPrice) {\n const details = offer.details as SpecialPriceDetail;\n\n return details.apply_to === 'product'\n // Avoid additional requests; use `salla-products-slider` and pass the custom card\n ? salla.product.api.fetch({ source: \"selected\", source_value: details.targets})\n .then((response: any) => {\n (offer.details as any).products = response.data; // Set the fetched products\n return this.offersList = [offer];\n })\n : salla.product.api.categories() // Fetch all categories in one query\n .then((res) => {\n const categoriesToRender = this.findCategories(res.data, details.targets); // Extract only the selected categories\n (offer.details as any).categories = categoriesToRender;\n return this.offersList = [offer];\n });\n }\n\n //BuyXGetY offers\n const getY = (offer.details as BuyXGetYDetail).get;\n return getY.source === 'products'\n //todo:: avoid this request, and the handling for the products, just use `salla-products-slider` and don't forget to pass the customcard\n ? salla.product.api.fetch({ source: \"selected\", source_value: getY.source_value })\n .then((response: any) => {\n getY.products = response.data;\n (offer.details as any).get = getY;\n return this.offersList = [offer];\n })//set the products\n : salla.product.api.categories()//get all categories in one query, then extract only the selected one, instead of sending multi requests\n .then((res) => {\n getY.categories = this.findCategories(res.data, getY.source_value);\n (offer.details as any).get = getY;\n return this.offersList = [offer];\n });\n })\n .then((offers: Offer[]) => {\n salla.storage.set(this.getStorageKey(), { offers, stored_at: new Date().getTime() });\n this.canRender = true;\n })\n .catch((error) => {\n salla.logger.warn(error)\n });\n }\n\n componentDidLoad() {\n let nav = this.host.querySelector('.s-slider-block__title-nav');\n nav?.classList.add(\"s-offer-bank-payment-nav\")\n this.emitPromotionViewed();\n }\n\n \n\n\n findCategories(categories: Category[], ids: any[]): Category[] {\n let found: Category[] = [];\n for (const category of categories) {\n if (ids.includes(category.id_ || category.id)) { //here we are using || because we are planning to drop `id_`\n found.push(category);\n }\n if (category.sub_categories?.length > 0) {\n found = found.concat(this.findCategories(category.sub_categories, ids));\n }\n }\n\n return found;\n }\n\n //todo::add to the key params, to make sure it will support multi offers in the same page if it's wanted\n getStorageKey(): string {\n try {\n const pageSlug = salla.config.get('page.slug').replace('.', '_');\n const locale = salla.lang.getLocale();\n const currencyCode = salla.config.currency().code;\n\n if (!pageSlug || !locale || !currencyCode) {\n throw new Error('Unable to get the storage key.');\n }\n\n return `s-offers-${pageSlug}-${salla.config.get('page.id')}-${locale}-${currencyCode}`;\n } catch (error) {\n return '';\n }\n }\n\n //@ts-ignore\n getOffersFromStorage(): null | Promise<Offer[]> {\n let storageOffers = salla.storage.get(this.getStorageKey());\n //if the offers not existed, or it has been stored before 10 minutes from now, ignore it;\n if (!storageOffers || storageOffers.stored_at < (new Date().getTime() - 10 * 60 * 1000)) {\n salla.storage.remove(this.getStorageKey());\n return null;\n }\n this.canRender = true;\n\n //return it as resolve to support .then\n return Promise.resolve(storageOffers.offers);\n }\n\n render() {\n // Check if the offers list is empty or if the component is not ready to render\n if (!this.offersList.length || !this.canRender || !this.showOffer) return null;\n const offer: Offer = this.offersList[0];\n\n const blockTitle = this.isBankOffer ? (this.isMultipleBank ? this.multipleBankOfferTitleText : null) : offer.title;\n const blockSubTitle = this.isBankOffer ? (this.isMultipleBank ? this.multipleBankOfferTitleDescription : null) : offer.description;\n\n const titles = {\n 'block-title': blockTitle,\n 'block-subTitle': blockSubTitle,\n 'show-controls': this.isMultipleBank\n };\n\n return (\n <div class=\"s-offer-wrapper\" onClick={() => this.emitPromotionClicked()}>\n {<p class=\"s-offer-corner-badge\">{this.special_offer_text}</p>}\n {/* discounts table is not a slider, it's a table🤔 */}\n {/* single bank offer is not a slider, it's a dom without slider🤔 */}\n <salla-slider type=\"carousel\" id=\"offer-slider\" {...titles}>\n <div slot='items'>\n {this.renderSectionForOfferType(offer.type)}\n </div>\n </salla-slider>\n </div>\n );\n }\n\n private renderSectionForOfferType(offerType: OfferType | string) {\n if (this.isBankOffer) {\n return this.renderBankSection();\n }\n if (offerType == OfferType.SpecialPrice) {\n return this.renderSpecialPriceSection();\n }\n if (offerType == OfferType.BuyXGetY) {\n return this.renderBuyXGetYSection();\n }\n\n return this.renderDiscountTableSection();\n }\n\n /**\n * Generates content for the categories section.\n *\n * @param offeredCategories - An array of Category objects.\n * @returns An array of HTML elements representing categories.\n */\n private getCategoriesSection(category: Category) {\n return <div class=\"s-offer-slide-one-sixth swiper-slide\" innerHTML={this.categorySlot\n .replace(/\\{url\\}/g, category.url)\n .replace(/\\{icon\\}/g, category.icon || \"sicon-store\")\n .replace(/\\{name\\}/g, category.name)}></div>\n }\n\n private renderBuyXGetYSection() {\n const details = (this.offersList[0].details as BuyXGetYDetail)\n return [\n details.get.products?.map((product: Product) => (\n <div class=\"s-offer-slide-one-fourth\">\n {this.hasCustomComponent\n ? <this.productCardComponent product={product}></this.productCardComponent>\n : <salla-product-card shadow-on-hover product={product}></salla-product-card>}\n </div>\n )),\n details.get.categories?.map((category: Category) => this.getCategoriesSection(category))\n ];\n }\n\n /**\n * Generates content for the bank section.\n *\n * @param offeredBank - An array of Bank objects.\n * @param name - The title of the current offer.\n * @param description - The description of the current offer.\n * @returns An array of HTML elements representing banks.\n *\n * TODO: loop over the list and filter bank types and pass it to this function\n */\n private renderBankSection() {\n return this.offersList.map((bankOffer: Offer) => {\n return <div class={{ \"s-offer-slide-one-sixth\": this.isMultipleBank, \"s-offer-bank-wrapper-sinlge-item\": !this.isMultipleBank }}>\n <div class={{ \"s-offer-bank-wrapper\": true, \"s-offer-slide-one-sixth\": !this.isMultipleBank, \"s-offer-bank-wrapper-multi-spacer\": this.isMultipleBank }}>\n <div class=\"s-offer-bank-logo\">\n <img src={(bankOffer.details as BankOffer).logo || salla.url.cdn('images/s-empty.png')} data-src={(bankOffer.details as BankOffer).logo} alt={bankOffer.title + \" offer\"} />\n </div>\n <ul class=\"s-offer-bank-payment-wrapper\">\n {(bankOffer.details as BankOffer).payments.map((payment: string) => {\n return <li class=\"s-offer-bank-payment-single\">\n <img\n src={salla.url.cdn('images/payment/' + payment + '.png') || salla.url.cdn('images/s-empty.png')}\n data-src={salla.url.cdn('images/payment/' + payment + '.png')}\n alt=\"payment\" />\n </li>\n })}\n </ul>\n {this.isMultipleBank ?\n <p class=\"s-offer-bank-payment-discount-percent\">\n {`${this.product_discount_text} ${(bankOffer.details as BankOffer).discount_value}${(bankOffer.details as BankOffer).discount_type === \"percentage\" && '%'}`}\n </p>\n : \"\"}\n </div>\n {!this.isMultipleBank ?\n <div class=\"s-offer-bank-message s-offer-slide-one-fourth\">\n <h2>{this.offersList[0].title}</h2>\n <p innerHTML={this.generateBankDescription(this.offersList[0].description, (bankOffer.details as BankOffer).discount_value)}></p>\n </div>\n : \"\"}\n </div>\n })\n }\n\n private generateBankDescription(desc: string, value): string {\n return desc.replace(new RegExp(`${value} %`), `<span class=\"s-offer-bank-message-amount\">${value} %</span>`)\n }\n\n /**\n * Generates content for the discount table section.\n *\n * @param discountTable - An array of Discount objects.\n * @returns An array of HTML elements representing discounts_table.\n */\n private renderDiscountTableSection() {\n const offer: Offer = this.offersList[0];\n let show_discounted_price = (offer.details as DiscountDetailTable).show_price_after_discount;\n return (this.offersList[0].details as DiscountDetailTable).discounts?.map((discount: Discount) => <div class=\"s-offer-slide-one-fourth\">\n <div class=\"s-offer-slide-offer-entry\">\n <div class=\"s-offer-slide-offer-entry-price-quantity-container\">\n <p class=\"s-offer-slide-offer-entry-quantity\">{this.buy_quantity_text(discount.quantity)}</p>\n {show_discounted_price ?\n <div class=\"s-offer-slide-offer-entry-price\">\n <span>{this.offer_with_price_text}</span>\n <span class=\"s-offer-slide-offer-entry-price-amount\">{discount.discounted_amount}</span> <span>{this.userCurrency}</span>\n </div> : \"\"}\n </div>\n <p class=\"s-offer-slide-offer-entry-price-amount-percent\">{this.with_discount_text}\n (<span>{discount.percentage}{!!discount.percentage && '%'}</span>)</p>\n </div>\n </div>\n )\n }\n\n private renderSpecialPriceSection() {\n const details = this.offersList[0].details as SpecialPriceDetail;\n\n return [\n // Render products if `apply_to` is \"product\"\n details.apply_to === \"product\" &&\n details.products?.map((product:Product) => (\n <div class=\"s-offer-slide-one-fourth\">\n {this.hasCustomComponent\n ? <this.productCardComponent product={product}></this.productCardComponent>\n : <salla-product-card shadow-on-hover product={product}></salla-product-card>}\n </div>\n )),\n\n // Render categories if `apply_to` is \"category\"\n details.apply_to === \"category\" &&\n details.categories?.map((category: Category) => this.getCategoriesSection(category)),\n ];\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;YAAA,IAAY,QAGX;YAHD,CAAA,UAAY,QAAQ,EAAA;YAClB,IAAA,QAAA,CAAA,eAAA,CAAA,GAAA,gBAAgC;YAChC,IAAA,QAAA,CAAA,MAAA,CAAA,GAAA,MAAa;YACf,CAAC,EAHW,QAAQ,KAAR,QAAQ,GAGnB,EAAA,CAAA,CAAA;YAED,IAAY,SAOX;YAPD,CAAA,UAAY,SAAS,EAAA;YACnB,IAAA,SAAA,CAAA,aAAA,CAAA,GAAA,aAA2B;YAC3B,IAAA,SAAA,CAAA,mBAAA,CAAA,GAAA,OAA2B;YAC3B,IAAA,SAAA,CAAA,gBAAA,CAAA,GAAA,iBAAkC;YAClC,IAAA,SAAA,CAAA,MAAA,CAAA,GAAA,MAAa;YACb,IAAA,SAAA,CAAA,UAAA,CAAA,GAAA,aAAwB;YACxB,IAAA,SAAA,CAAA,cAAA,CAAA,GAAA,eAA8B;YAChC,CAAC,EAPW,SAAS,KAAT,SAAS,GAOpB,EAAA,CAAA,CAAA;;YCZD,MAAM,aAAa,GAAG,khBAAkhB;;kBCmB3hB,UAAU,0BAAA,MAAA;YAErB,IAAA,WAAA,CAAA,OAAA,EAAA;;;YAoBA;;;;;;;;YAQG;YACK,QAAA,IAAoB,CAAA,oBAAA,GAAW,2BAA2B;;YAGzD,QAAA,IAAU,CAAA,UAAA,GAAY,EAAE;YAExB,QAAA,IAAc,CAAA,cAAA,GAAY,KAAK;YAK/B,QAAA,IAAW,CAAA,WAAA,GAAY,KAAK;YAC5B,QAAA,IAAS,CAAA,SAAA,GAAY,KAAK;oBAC1B,IAAS,CAAA,SAAA,GAAY,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,4CAA4C,CAAC;;YAGnF,QAAA,IAAA,C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AO,EAAE,OAAO,EAA8B;YAC3E,sBAAE,mDAAoC,OAAO,EAAE,OAAO,EAAuB,CAAA,CAC3E,CACP,CAAC,CAAA;;wBAGF,OAAO,CAAC,QAAQ,KAAK,UAAU;YAC/B,iBAAA,CAAA,EAAA,GAAA,OAAO,CAAC,UAAU,0CAAE,GAAG,CAAC,CAAC,QAAkB,KAAK,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC,CAAA;qBACrF;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"p-CdPxDxze.system.js","sources":["src/components/salla-tiered-offer/interfaces.ts","src/components/salla-tiered-offer/constants.ts","src/components/salla-tiered-offer/utils.ts","src/components/salla-tiered-offer/salla-tiered-offer.scss?tag=salla-tiered-offer","src/components/salla-tiered-offer/salla-tiered-offer.tsx"],"sourcesContent":["export enum DiscountType {\n PERCENTAGE = \"percentage\",\n FIXED = \"fixed\",\n}\n\n\nexport interface Discount {\n name?: string;\n type?: DiscountType;\n value?: number;\n min_spend?: number;\n}\n\nexport interface TieredOfferDetails {\n based_on?: string;\n ends_at?: number;\n start_value?: number;\n end_value?: number;\n current_value?: number;\n discounts?: Discount[];\n with_current_cart?: boolean;\n applied_with_coupon?: boolean;\n}\n\nexport interface Offer {\n id?: number;\n type?: string;\n title?: string;\n description?: string;\n details?: TieredOfferDetails | null;\n}\n\nexport interface TieredOfferTier {\n name: string;\n tier_name: string;\n discount: string;\n icon: string;\n threshold: number;\n text_color?: string;\n index: number;\n}\n\nexport interface TieredOfferData {\n current_tier: string;\n tiers: TieredOfferTier[];\n}\n\nexport interface TieredOfferConfig {\n staticIcons: string[];\n staticColors: string[];\n}\n","import { TieredOfferConfig } from './interfaces';\nimport StarIcon from '../../assets/svg/star-rounded.svg';\nimport StarsIcon from '../../assets/svg/stars.svg';\nimport GoldIcon from '../../assets/svg/gold.svg';\nimport DiamondIcon from '../../assets/svg/diamond-02.svg';\n\nexport const TIERED_OFFER_CONFIG: TieredOfferConfig = {\n staticIcons: [StarIcon, StarsIcon, GoldIcon, DiamondIcon],\n staticColors: ['#993018', '#444444', '#D18F36', '#315F9C']\n};","import { TieredOfferTier } from './interfaces';\n\nexport class TierUtils {\n /**\n * Find tier by index\n */\n static findTierByIndex(tiers: TieredOfferTier[], index: number): TieredOfferTier | null {\n return tiers.find(tier => tier.index === index) || null;\n }\n\n /**\n * Find tier by tier name\n */\n static findTierByName(tiers: TieredOfferTier[], tierName: string): TieredOfferTier | null {\n return tiers.find(tier => tier.tier_name === tierName) || null;\n }\n\n /**\n * Get tier name by index\n */\n static getTierNameByIndex(tiers: TieredOfferTier[], index: number): string | undefined {\n return this.findTierByIndex(tiers, index)?.tier_name;\n }\n\n /**\n * Find current tier index based on current value\n */\n static findCurrentTierIndex(currentValue: number, tiers: TieredOfferTier[]): number {\n if (!tiers) return 0;\n \n for (let i = tiers.length - 1; i >= 0; i--) {\n if (currentValue >= tiers[i].threshold) {\n return tiers[i].index;\n }\n }\n return 0;\n }\n}","\n// SVG styling for milestone icons \n.s-tiered-offer-milestone-icon {\n svg {\n color: currentColor;\n \n path {\n stroke: currentColor;\n fill: none;\n }\n }\n \n // Active and completed states - fill the star icon, keep others as stroke\n &.s-tiered-offer-milestone-active,\n &.s-tiered-offer-milestone-completed {\n svg {\n path {\n fill: currentColor;\n stroke: none;\n }\n \n // For stroke-based icons (crown, stars, diamond) \n &[fill=\"none\"] path {\n fill: none;\n stroke: currentColor;\n }\n }\n }\n}\n\n// RTL Support \n[dir=\"rtl\"] {\n .s-tiered-offer-progress-wrapper {\n .s-tiered-offer-progress-bg {\n transform: scaleX(-1);\n }\n \n .s-tiered-offer-progress-fill {\n transform: scaleX(-1);\n left: auto;\n }\n }\n\n .flip-x {\n transform: scaleX(-1);\n }\n}\n","import { Component, Host, h, State } from '@stencil/core';\nimport { Offer, TieredOfferTier, TieredOfferData, DiscountType } from './interfaces';\nimport { TIERED_OFFER_CONFIG } from './constants';\nimport { TierUtils } from './utils';\n\n@Component({\n tag: 'salla-tiered-offer',\n styleUrl: 'salla-tiered-offer.scss',\n})\nexport class SallaTieredOffer {\n\n constructor() {\n salla.lang.onLoaded(() => {\n this.loyaltyProgramText = salla.lang.get('blocks.tiered_offer.program_title');\n this.currentTierText = salla.lang.get('blocks.tiered_offer.current_tier');\n this.discountText = salla.lang.get('blocks.tiered_offer.discount');\n this.benefitText = salla.lang.get('blocks.tiered_offer.tier_description');\n });\n }\n\n\n @State() tieredOfferData: TieredOfferData;\n @State() apiOfferData: Offer;\n @State() currentTierIndex: number = 0;\n @State() currentTier: string;\n @State() activeTabTier: string;\n\n @State() canRender: boolean = false;\n @State() isLoading: boolean = false;\n\n // Language strings\n @State() loyaltyProgramText: string;\n @State() currentTierText: string;\n @State() discountText: string;\n @State() benefitText: string;\n\n async componentWillLoad() {\n try {\n await salla.onReady();\n \n if (!this.checkFeatureEnabled()) {\n return;\n }\n \n if (!this.checkCartExists()) {\n return;\n }\n \n this.isLoading = true;\n \n const offerData = await this.fetchTieredOfferData();\n if (!offerData) {\n return;\n }\n \n this.initializeComponent(offerData);\n \n } catch (error) {\n this.canRender = false;\n salla.logger.warn('salla-tiered-offer:: ', error);\n } finally {\n this.isLoading = false;\n }\n }\n \n private checkFeatureEnabled(): boolean {\n return salla.config.get('store.features')?.includes('tiered-offer');\n }\n \n private checkCartExists(): boolean {\n return !!salla.storage.get(\"cart\")?.summary?.count;\n }\n \n private validateCouponCompatibility(offerData: Offer, cartCoupon?: any): boolean {\n // If coupon is applied but offer doesn't support coupons, widget should be hidden\n return !(cartCoupon && !offerData.details?.applied_with_coupon);\n }\n \n private async fetchTieredOfferData(): Promise<Offer | null> {\n try {\n const { data }: { data: Offer[] } = await salla.api.cart.offers();\n const tieredOffer = data.find(offer => offer.type === \"tiered_offer\");\n \n if (!tieredOffer) {\n return null;\n }\n \n // Hide widget if coupon is applied and offer doesn't support coupons\n if (!this.validateCouponCompatibility(tieredOffer, salla.storage.get(\"cart\")?.coupon)) {\n this.canRender = false;\n return null;\n }\n \n return tieredOffer;\n } catch (error) {\n throw error;\n }\n }\n \n private initializeComponent(apiOfferData: Offer): void {\n this.apiOfferData = apiOfferData;\n \n // Map tiered details data to component format\n this.tieredOfferData = this.mapApiDataToTiers(this.apiOfferData);\n this.loyaltyProgramText = this.apiOfferData.title || this.loyaltyProgramText;\n \n // Find current tier index based on current_value from API\n const currentValue = this.apiOfferData.details?.current_value || 0;\n const currentTierIndex = this.findCurrentTierIndex(currentValue);\n \n // Only render if user has reached at least the first tier\n if (currentTierIndex === 0) {\n this.canRender = false;\n return;\n }\n \n this.currentTierIndex = currentTierIndex;\n this.currentTier = TierUtils.getTierNameByIndex(this.tieredOfferData.tiers, currentTierIndex);\n this.activeTabTier = this.currentTier;\n this.canRender = true;\n }\n\n componentDidLoad() {\n salla.event.on(\"cart::updated\", async (updatedCart) => {\n const offerData = await this.fetchTieredOfferData();\n if (offerData) {\n this.updateOfferValues(updatedCart, offerData);\n }\n });\n }\n\n private mapApiDataToTiers(apiData: Offer): TieredOfferData {\n // Sort discounts by min_spend to create proper tier order\n const sortedDiscounts = [...apiData.details.discounts].sort((a, b) => a.min_spend - b.min_spend);\n\n const tiers: TieredOfferTier[] = sortedDiscounts.map((discount, index) => ({\n name: discount.name, \n tier_name: discount.name, \n discount: discount.type === DiscountType.PERCENTAGE ? `${salla.helpers.number(discount.value)}%` : salla.money(discount.value),\n icon: TIERED_OFFER_CONFIG.staticIcons[index] || TIERED_OFFER_CONFIG.staticIcons[0], \n threshold: discount.min_spend,\n text_color: TIERED_OFFER_CONFIG.staticColors[index], \n index: index + 1\n }));\n\n return {\n current_tier: TierUtils.getTierNameByIndex(tiers, this.findCurrentTierIndex(apiData.details.current_value, tiers)),\n tiers\n };\n }\n\n private findCurrentTierIndex(currentValue: number, tiers = this.tieredOfferData?.tiers): number {\n return TierUtils.findCurrentTierIndex(currentValue, tiers || []);\n }\n\n private updateOfferValues(updatedCart: { items: any[], sub_total: number, coupon?: any }, freshOfferData: Offer) {\n if (!freshOfferData || !this.tieredOfferData) {\n return;\n }\n\n // Check coupon compatibility\n if (!this.validateCouponCompatibility(freshOfferData, updatedCart.coupon)) {\n this.canRender = false;\n return;\n }\n\n // If no coupon conflict, show widget\n this.canRender = true;\n\n // Check if this offer should update with cart changes\n if (freshOfferData.details?.with_current_cart === false) {\n return;\n }\n\n // Update current_value in API offer data\n // const currentValue = updatedCart.sub_total;\n // console.log('currentValue #####3', currentValue);\n // this.apiOfferData = {\n // ...this.apiOfferData,\n // details: {\n // ...this.apiOfferData.details,\n // current_value: currentValue\n // }\n // };\n\n // Use current_value from fresh API data instead of cart sub_total\n const currentValue = freshOfferData.details?.current_value || 0;\n this.apiOfferData = freshOfferData;\n\n // Update current tier based on new value\n const newTierIndex = this.findCurrentTierIndex(currentValue);\n\n // Check if user qualifies for any tier\n if (newTierIndex === 0) {\n this.canRender = false;\n return;\n }\n\n // user qualifies show widget\n this.canRender = true;\n this.currentTierIndex = newTierIndex;\n this.currentTier = TierUtils.getTierNameByIndex(this.tieredOfferData.tiers, newTierIndex);\n\n // Update active tab if needed\n if (this.activeTabTier !== this.currentTier) {\n this.activeTabTier = this.currentTier;\n }\n }\n\n private getLoadingSkeletonView() {\n return <Host>\n <div class=\"s-tiered-offer-container\">\n <div class=\"s-tiered-offer-skeleton-wrapper\">\n <div class=\"s-tiered-offer-skeleton-title\">\n <salla-skeleton height=\"16px\" width=\"40%\" />\n </div>\n <div class=\"s-tiered-offer-skeleton-subtitle\">\n <salla-skeleton height=\"20px\" width=\"60%\" />\n </div>\n <div class=\"s-tiered-offer-skeleton-progress\">\n <salla-skeleton height=\"16px\" width=\"100%\" />\n </div>\n <div class=\"s-tiered-offer-skeleton-tabs\">\n <salla-skeleton height=\"50px\" width=\"100%\" />\n </div>\n </div>\n </div>\n </Host>\n }\n\n private getCurrentTierData(): TieredOfferTier {\n return TierUtils.findTierByIndex(this.tieredOfferData.tiers, this.currentTierIndex) || this.tieredOfferData.tiers[0];\n }\n\n private getProgressWidth(): number {\n const currentValue = this.apiOfferData.details?.current_value || 0;\n const totalTiers = this.tieredOfferData.tiers.length;\n \n // Use existing method to find current tier index (which already handles the logic)\n const currentTierIndex = this.findCurrentTierIndex(currentValue);\n \n // Convert to 0-based index for progress calculation\n const completedTiers = currentTierIndex;\n return (completedTiers / totalTiers) * 100;\n }\n\n private handleTabClick = (tierName: string) => {\n this.activeTabTier = tierName;\n }\n \n private calculateMilestonePosition(index: number, totalTiers: number): string {\n if (totalTiers === 1) {\n return 'calc(100% - 18px)';\n }\n const milestonePercent = ((index + 1) / totalTiers) * 100;\n const offsetPercent = 8 / totalTiers;\n return `${Math.max(2, Math.min(95, milestonePercent - offsetPercent))}%`;\n }\n \n private getMilestoneStyles(tier: TieredOfferTier, index: number, totalTiers: number) {\n const isRtl = document.documentElement.dir === 'rtl';\n const adjustedPercent = this.calculateMilestonePosition(index, totalTiers);\n const alignItems = tier.name.length > 6 ? 'flex-end' : 'center';\n \n return {\n [isRtl ? 'right' : 'left']: adjustedPercent,\n alignItems,\n position: 'absolute' as const,\n transform: isRtl ? 'translateX(50%)' : 'translateX(-50%)'\n };\n }\n \n private getMilestoneIconStyles(tier: TieredOfferTier, isCurrent: boolean, isReached: boolean) {\n if (isCurrent) {\n return { color: tier.text_color };\n }\n if (isReached) {\n return { color: 'var(--color-primary)' };\n }\n return {};\n }\n \n private renderProgressBarBackground(progressWidth: number) {\n return [\n <div class=\"s-tiered-offer-progress-bg\"></div>,\n <div \n class=\"s-tiered-offer-progress-fill\"\n style={{ width: `${progressWidth}%` }}>\n </div>\n ];\n }\n \n private renderMilestoneIcon(tier: TieredOfferTier, isCurrent: boolean, isReached: boolean) {\n const iconClasses = [\n 's-tiered-offer-milestone-icon',\n isCurrent ? 's-tiered-offer-milestone-active' : '',\n isReached ? 's-tiered-offer-milestone-completed' : ''\n ].filter(Boolean).join(' ');\n \n return (\n <div \n class={iconClasses}\n style={this.getMilestoneIconStyles(tier, isCurrent, isReached)}>\n <span innerHTML={tier.icon}></span>\n </div>\n );\n }\n \n private renderMilestoneName(tier: TieredOfferTier, isCurrent: boolean) {\n return (\n <div class=\"s-tiered-offer-milestone-name\">\n {isCurrent && (\n <span style={{ color: tier.text_color }}>\n {tier.name}\n </span>\n )}\n </div>\n );\n }\n \n private renderMilestones(currentValue: number, totalTiers: number) {\n const containerClass = totalTiers === 1 \n ? 's-tiered-offer-single-milestone-justify-end' \n : 's-tiered-offer-milestones';\n \n return (\n <div class=\"s-tiered-offer-milestones-wrapper\">\n <div class={containerClass}>\n {this.tieredOfferData.tiers.map((tier, index) => {\n const isReached = currentValue >= tier.threshold;\n const isCurrent = tier.tier_name === this.currentTier;\n \n return (\n <div \n class=\"s-tiered-offer-milestone\"\n style={this.getMilestoneStyles(tier, index, totalTiers)}>\n {this.renderMilestoneIcon(tier, isCurrent, isReached)}\n {this.renderMilestoneName(tier, isCurrent)}\n </div>\n );\n })}\n </div>\n </div>\n );\n }\n\n private renderProgressBar() {\n const progressWidth = this.getProgressWidth();\n const totalTiers = this.tieredOfferData.tiers.length;\n const currentValue = this.apiOfferData.details?.current_value || 0;\n\n return (\n <div class=\"s-tiered-offer-progress-container\">\n <div class=\"s-tiered-offer-progress-wrapper\">\n {this.renderProgressBarBackground(progressWidth)}\n {this.renderMilestones(currentValue, totalTiers)}\n </div>\n </div>\n );\n }\n\n private renderTabs() {\n return (\n <div class=\"s-tiered-offer-tabs-container\">\n {/* Tab Headers */}\n <div class=\"s-tiered-offer-tab-headers\">\n {this.tieredOfferData.tiers.map(tier => {\n const isActive = tier.tier_name === this.activeTabTier;\n return (\n <button \n class={`s-tiered-offer-tab-header ${isActive ? 's-tiered-offer-tab-active' : ''}`}\n onClick={() => this.handleTabClick(tier.tier_name)}>\n <span>{tier.name}</span>\n </button>\n );\n })}\n </div>\n\n {/* Tab Content */}\n <div class=\"s-tiered-offer-tab-content-wrapper\">\n {(() => {\n const activeTier = TierUtils.findTierByName(this.tieredOfferData.tiers, this.activeTabTier);\n if (!activeTier) return null;\n \n return (\n <div class=\"s-tiered-offer-tab-content\">\n <div class=\"s-tiered-offer-tab-content-inner\">\n <div class=\"s-tiered-offer-discount-section\">\n <p class=\"s-tiered-offer-discount-title\">\n {this.discountText} <span innerHTML={activeTier.discount}></span>\n </p>\n <p class=\"s-tiered-offer-benefit-description\">\n {this.benefitText} {activeTier.name}\n </p>\n </div>\n </div>\n </div>\n );\n })()}\n </div>\n </div>\n );\n }\n\n render() {\n \n if (this.isLoading) {\n return this.getLoadingSkeletonView();\n }\n\n if (!this.canRender || !this.tieredOfferData) {\n return null;\n }\n \n\n const currentTierData = this.getCurrentTierData();\n\n return (\n <Host>\n <div class=\"s-tiered-offer-container\">\n {/* Header Section */}\n <div class=\"s-tiered-offer-header\">\n <div class=\"s-tiered-offer-header-content\">\n <p class=\"s-tiered-offer-program-title\">{this.loyaltyProgramText}</p>\n <div class=\"s-tiered-offer-current-tier-name-wrapper\">\n <h2 class=\"s-tiered-offer-current-tier\">\n {this.currentTierText} <span class=\"s-tiered-offer-tier-name\">{currentTierData.name}</span>\n </h2>\n <span innerHTML={currentTierData.icon}></span>\n </div>\n </div>\n </div>\n\n {/* Progress Bar */}\n {this.renderProgressBar()}\n\n {/* Tabs */}\n {this.renderTabs()}\n </div>\n </Host>\n );\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;YAAA,IAAY,YAGX;YAHD,CAAA,UAAY,YAAY,EAAA;YACtB,IAAA,YAAA,CAAA,YAAA,CAAA,GAAA,YAAyB;YACzB,IAAA,YAAA,CAAA,OAAA,CAAA,GAAA,OAAe;YACjB,CAAC,EAHW,YAAY,KAAZ,YAAY,GAGvB,EAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;YCGM,MAAM,mBAAmB,GAAsB;gBACpD,WAAW,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,CAAC;gBACzD,YAAY,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,S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AAE;YAClB,YAAA,OAAO,IAAI,CAAC,sBAAsB,EAAE;;oBAGtC,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;YAC5C,YAAA,OAAO,IAAI;;YAIb,QAAA,MAAM,eAAe,GAAG,IAAI,CAAC,kBAAkB,EAAE;oBAEjD,QACE,EAAC,IAAI,EAAA,IAAA,EACH,CAAK,CAAA,KAAA,EAAA,EAAA,KAAK,EAAC,0BAA0B,EAAA,EAEnC,CAAK,CAAA,KAAA,EAAA,EAAA,KAAK,EAAC,uBAAuB,EAAA,EAChC,CAAK,CAAA,KAAA,EAAA,EAAA,KAAK,EAAC,+BAA+B,EAAA,EACxC,CAAA,CAAA,GAAA,EAAA,EAAG,KAAK,EAAC,8BAA8B,IAAE,IAAI,CAAC,kBAAkB,CAAK,EACrE,CAAK,CAAA,KAAA,EAAA,EAAA,KAAK,EAAC,0CAA0C,EAAA,EACnD,CAAI,CAAA,IAAA,EAAA,EAAA,KAAK,EAAC,6BAA6B,EAAA,EACpC,IAAI,CAAC,eAAe,OAAE,CAAM,CAAA,MAAA,EAAA,EAAA,KAAK,EAAC,0BAA0B,EAAA,EAAE,eAAe,CAAC,IAAI,CAAQ,CACxF,EACL,CAAM,CAAA,MAAA,EAAA,EAAA,SAAS,EAAE,eAAe,CAAC,IAAI,EAAS,CAAA,CAC1C,CACF,CACF,EAGL,IAAI,CAAC,iBAAiB,EAAE,EAGxB,IAAI,CAAC,UAAU,EAAE,CACd,CACD;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"p-BtWTphPP.system.js","sources":["src/components/salla-tiered-offer/interfaces.ts","src/components/salla-tiered-offer/constants.ts","src/components/salla-tiered-offer/utils.ts","src/components/salla-tiered-offer/salla-tiered-offer.scss?tag=salla-tiered-offer","src/components/salla-tiered-offer/salla-tiered-offer.tsx"],"sourcesContent":["export enum DiscountType {\n PERCENTAGE = \"percentage\",\n FIXED = \"fixed\",\n}\n\n\nexport interface Discount {\n name?: string;\n type?: DiscountType;\n value?: number;\n min_spend?: number;\n}\n\nexport interface TieredOfferDetails {\n based_on?: string;\n ends_at?: number;\n start_value?: number;\n end_value?: number;\n current_value?: number;\n discounts?: Discount[];\n with_current_cart?: boolean;\n applied_with_coupon?: boolean;\n}\n\nexport interface Offer {\n id?: number;\n type?: string;\n title?: string;\n description?: string;\n details?: TieredOfferDetails | null;\n}\n\nexport interface TieredOfferTier {\n name: string;\n tier_name: string;\n discount: string;\n icon: string;\n threshold: number;\n text_color?: string;\n index: number;\n}\n\nexport interface TieredOfferData {\n current_tier: string;\n tiers: TieredOfferTier[];\n}\n\nexport interface TieredOfferConfig {\n staticIcons: string[];\n staticColors: string[];\n}\n","import { TieredOfferConfig } from './interfaces';\nimport StarIcon from '../../assets/svg/star-rounded.svg';\nimport StarsIcon from '../../assets/svg/stars.svg';\nimport GoldIcon from '../../assets/svg/gold.svg';\nimport DiamondIcon from '../../assets/svg/diamond-02.svg';\n\nexport const TIERED_OFFER_CONFIG: TieredOfferConfig = {\n staticIcons: [StarIcon, StarsIcon, GoldIcon, DiamondIcon],\n staticColors: ['#993018', '#444444', '#D18F36', '#315F9C']\n};","import { TieredOfferTier } from './interfaces';\n\nexport class TierUtils {\n /**\n * Find tier by index\n */\n static findTierByIndex(tiers: TieredOfferTier[], index: number): TieredOfferTier | null {\n return tiers.find(tier => tier.index === index) || null;\n }\n\n /**\n * Find tier by tier name\n */\n static findTierByName(tiers: TieredOfferTier[], tierName: string): TieredOfferTier | null {\n return tiers.find(tier => tier.tier_name === tierName) || null;\n }\n\n /**\n * Get tier name by index\n */\n static getTierNameByIndex(tiers: TieredOfferTier[], index: number): string | undefined {\n return this.findTierByIndex(tiers, index)?.tier_name;\n }\n\n /**\n * Find current tier index based on current value\n */\n static findCurrentTierIndex(currentValue: number, tiers: TieredOfferTier[]): number {\n if (!tiers) return 0;\n \n for (let i = tiers.length - 1; i >= 0; i--) {\n if (currentValue >= tiers[i].threshold) {\n return tiers[i].index;\n }\n }\n return 0;\n }\n}","\n// SVG styling for milestone icons \n.s-tiered-offer-milestone-icon {\n svg {\n color: currentColor;\n \n path {\n stroke: currentColor;\n fill: none;\n }\n }\n \n // Active and completed states - fill the star icon, keep others as stroke\n &.s-tiered-offer-milestone-active,\n &.s-tiered-offer-milestone-completed {\n svg {\n path {\n fill: currentColor;\n stroke: none;\n }\n \n // For stroke-based icons (crown, stars, diamond) \n &[fill=\"none\"] path {\n fill: none;\n stroke: currentColor;\n }\n }\n }\n}\n\n// RTL Support \n[dir=\"rtl\"] {\n .s-tiered-offer-progress-wrapper {\n .s-tiered-offer-progress-bg {\n transform: scaleX(-1);\n }\n \n .s-tiered-offer-progress-fill {\n transform: scaleX(-1);\n left: auto;\n }\n }\n\n .flip-x {\n transform: scaleX(-1);\n }\n}\n","import { Component, Host, h, State } from '@stencil/core';\nimport { Offer, TieredOfferTier, TieredOfferData, DiscountType } from './interfaces';\nimport { TIERED_OFFER_CONFIG } from './constants';\nimport { TierUtils } from './utils';\n\n@Component({\n tag: 'salla-tiered-offer',\n styleUrl: 'salla-tiered-offer.scss',\n})\nexport class SallaTieredOffer {\n\n constructor() {\n salla.lang.onLoaded(() => {\n this.loyaltyProgramText = salla.lang.get('blocks.tiered_offer.program_title');\n this.currentTierText = salla.lang.get('blocks.tiered_offer.current_tier');\n this.discountText = salla.lang.get('blocks.tiered_offer.discount');\n this.benefitText = salla.lang.get('blocks.tiered_offer.tier_description');\n });\n }\n\n\n @State() tieredOfferData: TieredOfferData;\n @State() apiOfferData: Offer;\n @State() currentTierIndex: number = 0;\n @State() currentTier: string;\n @State() activeTabTier: string;\n\n @State() canRender: boolean = false;\n @State() isLoading: boolean = false;\n\n // Language strings\n @State() loyaltyProgramText: string;\n @State() currentTierText: string;\n @State() discountText: string;\n @State() benefitText: string;\n\n async componentWillLoad() {\n try {\n await salla.onReady();\n \n if (!this.checkFeatureEnabled()) {\n return;\n }\n \n if (!this.checkCartExists()) {\n return;\n }\n \n this.isLoading = true;\n \n const offerData = await this.fetchTieredOfferData();\n if (!offerData) {\n return;\n }\n \n this.initializeComponent(offerData);\n \n } catch (error) {\n this.canRender = false;\n salla.logger.warn('salla-tiered-offer:: ', error);\n } finally {\n this.isLoading = false;\n }\n }\n \n private checkFeatureEnabled(): boolean {\n return salla.config.get('store.features')?.includes('tiered-offer');\n }\n \n private checkCartExists(): boolean {\n return !!salla.storage.get(\"cart\")?.summary?.count;\n }\n \n private validateCouponCompatibility(offerData: Offer, cartCoupon?: any): boolean {\n // If coupon is applied but offer doesn't support coupons, widget should be hidden\n return !(cartCoupon && !offerData.details?.applied_with_coupon);\n }\n \n private async fetchTieredOfferData(): Promise<Offer | null> {\n try {\n const { data }: { data: Offer[] } = await salla.api.cart.offers();\n const tieredOffer = data.find(offer => offer.type === \"tiered_offer\");\n \n if (!tieredOffer) {\n return null;\n }\n \n // Hide widget if coupon is applied and offer doesn't support coupons\n if (!this.validateCouponCompatibility(tieredOffer, salla.storage.get(\"cart\")?.coupon)) {\n this.canRender = false;\n return null;\n }\n \n return tieredOffer;\n } catch (error) {\n throw error;\n }\n }\n \n private initializeComponent(apiOfferData: Offer): void {\n this.apiOfferData = apiOfferData;\n \n // Map tiered details data to component format\n this.tieredOfferData = this.mapApiDataToTiers(this.apiOfferData);\n this.loyaltyProgramText = this.apiOfferData.title || this.loyaltyProgramText;\n \n // Find current tier index based on current_value from API\n const currentValue = this.apiOfferData.details?.current_value || 0;\n const currentTierIndex = this.findCurrentTierIndex(currentValue);\n \n // Only render if user has reached at least the first tier\n if (currentTierIndex === 0) {\n this.canRender = false;\n return;\n }\n \n this.currentTierIndex = currentTierIndex;\n this.currentTier = TierUtils.getTierNameByIndex(this.tieredOfferData.tiers, currentTierIndex);\n this.activeTabTier = this.currentTier;\n this.canRender = true;\n }\n\n componentDidLoad() {\n salla.event.on(\"cart::updated\", async (updatedCart) => {\n const offerData = await this.fetchTieredOfferData();\n if (offerData) {\n this.updateOfferValues(updatedCart, offerData);\n }\n });\n }\n\n private mapApiDataToTiers(apiData: Offer): TieredOfferData {\n // Sort discounts by min_spend to create proper tier order\n const sortedDiscounts = [...apiData.details.discounts].sort((a, b) => a.min_spend - b.min_spend);\n\n const tiers: TieredOfferTier[] = sortedDiscounts.map((discount, index) => ({\n name: discount.name, \n tier_name: discount.name, \n discount: discount.type === DiscountType.PERCENTAGE ? `${salla.helpers.number(discount.value)}%` : salla.money(discount.value),\n icon: TIERED_OFFER_CONFIG.staticIcons[index] || TIERED_OFFER_CONFIG.staticIcons[0], \n threshold: discount.min_spend,\n text_color: TIERED_OFFER_CONFIG.staticColors[index], \n index: index + 1\n }));\n\n return {\n current_tier: TierUtils.getTierNameByIndex(tiers, this.findCurrentTierIndex(apiData.details.current_value, tiers)),\n tiers\n };\n }\n\n private findCurrentTierIndex(currentValue: number, tiers = this.tieredOfferData?.tiers): number {\n return TierUtils.findCurrentTierIndex(currentValue, tiers || []);\n }\n\n private updateOfferValues(updatedCart: { items: any[], sub_total: number, coupon?: any }, freshOfferData: Offer) {\n if (!freshOfferData || !this.tieredOfferData) {\n return;\n }\n\n // Check coupon compatibility\n if (!this.validateCouponCompatibility(freshOfferData, updatedCart.coupon)) {\n this.canRender = false;\n return;\n }\n\n // If no coupon conflict, show widget\n this.canRender = true;\n\n // Check if this offer should update with cart changes\n if (freshOfferData.details?.with_current_cart === false) {\n return;\n }\n\n // Update current_value in API offer data\n // const currentValue = updatedCart.sub_total;\n // console.log('currentValue #####3', currentValue);\n // this.apiOfferData = {\n // ...this.apiOfferData,\n // details: {\n // ...this.apiOfferData.details,\n // current_value: currentValue\n // }\n // };\n\n // Use current_value from fresh API data instead of cart sub_total\n const currentValue = freshOfferData.details?.current_value || 0;\n this.apiOfferData = freshOfferData;\n\n // Update current tier based on new value\n const newTierIndex = this.findCurrentTierIndex(currentValue);\n\n // Check if user qualifies for any tier\n if (newTierIndex === 0) {\n this.canRender = false;\n return;\n }\n\n // user qualifies show widget\n this.canRender = true;\n this.currentTierIndex = newTierIndex;\n this.currentTier = TierUtils.getTierNameByIndex(this.tieredOfferData.tiers, newTierIndex);\n\n // Update active tab if needed\n if (this.activeTabTier !== this.currentTier) {\n this.activeTabTier = this.currentTier;\n }\n }\n\n private getLoadingSkeletonView() {\n return <Host>\n <div class=\"s-tiered-offer-container\">\n <div class=\"s-tiered-offer-skeleton-wrapper\">\n <div class=\"s-tiered-offer-skeleton-title\">\n <salla-skeleton height=\"16px\" width=\"40%\" />\n </div>\n <div class=\"s-tiered-offer-skeleton-subtitle\">\n <salla-skeleton height=\"20px\" width=\"60%\" />\n </div>\n <div class=\"s-tiered-offer-skeleton-progress\">\n <salla-skeleton height=\"16px\" width=\"100%\" />\n </div>\n <div class=\"s-tiered-offer-skeleton-tabs\">\n <salla-skeleton height=\"50px\" width=\"100%\" />\n </div>\n </div>\n </div>\n </Host>\n }\n\n private getCurrentTierData(): TieredOfferTier {\n return TierUtils.findTierByIndex(this.tieredOfferData.tiers, this.currentTierIndex) || this.tieredOfferData.tiers[0];\n }\n\n private getProgressWidth(): number {\n const currentValue = this.apiOfferData.details?.current_value || 0;\n const totalTiers = this.tieredOfferData.tiers.length;\n \n // Use existing method to find current tier index (which already handles the logic)\n const currentTierIndex = this.findCurrentTierIndex(currentValue);\n \n // Convert to 0-based index for progress calculation\n const completedTiers = currentTierIndex;\n return (completedTiers / totalTiers) * 100;\n }\n\n private handleTabClick = (tierName: string) => {\n this.activeTabTier = tierName;\n }\n \n private calculateMilestonePosition(index: number, totalTiers: number): string {\n if (totalTiers === 1) {\n return 'calc(100% - 18px)';\n }\n const milestonePercent = ((index + 1) / totalTiers) * 100;\n const offsetPercent = 8 / totalTiers;\n return `${Math.max(2, Math.min(95, milestonePercent - offsetPercent))}%`;\n }\n \n private getMilestoneStyles(tier: TieredOfferTier, index: number, totalTiers: number) {\n const isRtl = document.documentElement.dir === 'rtl';\n const adjustedPercent = this.calculateMilestonePosition(index, totalTiers);\n const alignItems = tier.name.length > 6 ? 'flex-end' : 'center';\n \n return {\n [isRtl ? 'right' : 'left']: adjustedPercent,\n alignItems,\n position: 'absolute' as const,\n transform: isRtl ? 'translateX(50%)' : 'translateX(-50%)'\n };\n }\n \n private getMilestoneIconStyles(tier: TieredOfferTier, isCurrent: boolean, isReached: boolean) {\n if (isCurrent) {\n return { color: tier.text_color };\n }\n if (isReached) {\n return { color: 'var(--color-primary)' };\n }\n return {};\n }\n \n private renderProgressBarBackground(progressWidth: number) {\n return [\n <div class=\"s-tiered-offer-progress-bg\"></div>,\n <div \n class=\"s-tiered-offer-progress-fill\"\n style={{ width: `${progressWidth}%` }}>\n </div>\n ];\n }\n \n private renderMilestoneIcon(tier: TieredOfferTier, isCurrent: boolean, isReached: boolean) {\n const iconClasses = [\n 's-tiered-offer-milestone-icon',\n isCurrent ? 's-tiered-offer-milestone-active' : '',\n isReached ? 's-tiered-offer-milestone-completed' : ''\n ].filter(Boolean).join(' ');\n \n return (\n <div \n class={iconClasses}\n style={this.getMilestoneIconStyles(tier, isCurrent, isReached)}>\n <span innerHTML={tier.icon}></span>\n </div>\n );\n }\n \n private renderMilestoneName(tier: TieredOfferTier, isCurrent: boolean) {\n return (\n <div class=\"s-tiered-offer-milestone-name\">\n {isCurrent && (\n <span style={{ color: tier.text_color }}>\n {tier.name}\n </span>\n )}\n </div>\n );\n }\n \n private renderMilestones(currentValue: number, totalTiers: number) {\n const containerClass = totalTiers === 1 \n ? 's-tiered-offer-single-milestone-justify-end' \n : 's-tiered-offer-milestones';\n \n return (\n <div class=\"s-tiered-offer-milestones-wrapper\">\n <div class={containerClass}>\n {this.tieredOfferData.tiers.map((tier, index) => {\n const isReached = currentValue >= tier.threshold;\n const isCurrent = tier.tier_name === this.currentTier;\n \n return (\n <div \n class=\"s-tiered-offer-milestone\"\n style={this.getMilestoneStyles(tier, index, totalTiers)}>\n {this.renderMilestoneIcon(tier, isCurrent, isReached)}\n {this.renderMilestoneName(tier, isCurrent)}\n </div>\n );\n })}\n </div>\n </div>\n );\n }\n\n private renderProgressBar() {\n const progressWidth = this.getProgressWidth();\n const totalTiers = this.tieredOfferData.tiers.length;\n const currentValue = this.apiOfferData.details?.current_value || 0;\n\n return (\n <div class=\"s-tiered-offer-progress-container\">\n <div class=\"s-tiered-offer-progress-wrapper\">\n {this.renderProgressBarBackground(progressWidth)}\n {this.renderMilestones(currentValue, totalTiers)}\n </div>\n </div>\n );\n }\n\n private renderTabs() {\n return (\n <div class=\"s-tiered-offer-tabs-container\">\n {/* Tab Headers */}\n <div class=\"s-tiered-offer-tab-headers\">\n {this.tieredOfferData.tiers.map(tier => {\n const isActive = tier.tier_name === this.activeTabTier;\n return (\n <button \n class={`s-tiered-offer-tab-header ${isActive ? 's-tiered-offer-tab-active' : ''}`}\n onClick={() => this.handleTabClick(tier.tier_name)}>\n <span>{tier.name}</span>\n </button>\n );\n })}\n </div>\n\n {/* Tab Content */}\n <div class=\"s-tiered-offer-tab-content-wrapper\">\n {(() => {\n const activeTier = TierUtils.findTierByName(this.tieredOfferData.tiers, this.activeTabTier);\n if (!activeTier) return null;\n \n return (\n <div class=\"s-tiered-offer-tab-content\">\n <div class=\"s-tiered-offer-tab-content-inner\">\n <div class=\"s-tiered-offer-discount-section\">\n <p class=\"s-tiered-offer-discount-title\">\n {this.discountText} <span innerHTML={activeTier.discount}></span>\n </p>\n <p class=\"s-tiered-offer-benefit-description\">\n {this.benefitText} {activeTier.name}\n </p>\n </div>\n </div>\n </div>\n );\n })()}\n </div>\n </div>\n );\n }\n\n render() {\n \n if (this.isLoading) {\n return this.getLoadingSkeletonView();\n }\n\n if (!this.canRender || !this.tieredOfferData) {\n return null;\n }\n \n\n const currentTierData = this.getCurrentTierData();\n\n return (\n <Host>\n <div class=\"s-tiered-offer-container\">\n {/* Header Section */}\n <div class=\"s-tiered-offer-header\">\n <div class=\"s-tiered-offer-header-content\">\n <p class=\"s-tiered-offer-program-title\">{this.loyaltyProgramText}</p>\n <div class=\"s-tiered-offer-current-tier-name-wrapper\">\n <h2 class=\"s-tiered-offer-current-tier\">\n {this.currentTierText} <span class=\"s-tiered-offer-tier-name\">{currentTierData.name}</span>\n </h2>\n <span innerHTML={currentTierData.icon}></span>\n </div>\n </div>\n </div>\n\n {/* Progress Bar */}\n {this.renderProgressBar()}\n\n {/* Tabs */}\n {this.renderTabs()}\n </div>\n </Host>\n );\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;YAAA,IAAY,YAGX;YAHD,CAAA,UAAY,YAAY,EAAA;YACtB,IAAA,YAAA,CAAA,YAAA,CAAA,GAAA,YAAyB;YACzB,IAAA,YAAA,CAAA,OAAA,CAAA,GAAA,OAAe;YACjB,CAAC,EAHW,YAAY,KAAZ,YAAY,GAGvB,EAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;YCGM,MAAM,mBAAmB,GAAsB;gBACpD,WAAW,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,CAAC;gBACzD,YAAY,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS;aAC1D;;kBCPY,SAAS,CAAA;YACpB;;YAEG;YACH,IAAA,OAAO,eAAe,CAAC,KAAwB,EAAE,KAAa,EAAA;YAC5D,QAAA,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC,IAAI,IAAI;;YAGzD;;YAEG;YACH,IAAA,OAAO,cAAc,CAAC,KAAwB,EAAE,QAAgB,EAAA;YAC9D,QAAA,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,SAAS,KAAK,QAAQ,CAAC,IAAI,IAAI;;YAGhE;;YAEG;YACH,IAAA,OAAO,kBAAkB,CAAC,KAAwB,EAAE,KAAa,EAAA;;oBAC/D,OAAO,CAAA,EAAA,GAAA,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,MAAE,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,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AA,EAAA,EAAA,KAAK,EAAC,6BAA6B,EAAA,EACpC,IAAI,CAAC,eAAe,OAAE,CAAM,CAAA,MAAA,EAAA,EAAA,KAAK,EAAC,0BAA0B,EAAA,EAAE,eAAe,CAAC,IAAI,CAAQ,CACxF,EACL,CAAM,CAAA,MAAA,EAAA,EAAA,SAAS,EAAE,eAAe,CAAC,IAAI,EAAS,CAAA,CAC1C,CACF,CACF,EAGL,IAAI,CAAC,iBAAiB,EAAE,EAGxB,IAAI,CAAC,UAAU,EAAE,CACd,CACD;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"p--178guyc.system.js","sources":["src/components/salla-filters-widget/salla-filters-widget.scss?tag=salla-filters-widget","src/components/salla-filters-widget/salla-filters-widget.tsx"],"sourcesContent":[":host {\n display: block;\n}\n","import { Component, Host, h, Method, State, Prop, Event, Element } from '@stencil/core';\nimport Helper from '../../Helpers/Helper';\nimport { Filter, FilterOptionTypes } from \"../salla-filters/interfaces\";\n\n@Component({\n tag: 'salla-filters-widget',\n styleUrl: 'salla-filters-widget.scss',\n})\nexport class SallaFiltersWidget {\n @Element() host: HTMLElement;\n\n /**\n * Show more or less filter options.\n */\n @Prop({ mutable: true }) withLoadMore: boolean;\n\n /**\n * Selected filter options value.\n */\n @Prop({ reflect: true }) filtersData: object;\n\n /**\n * Filter option along with possible values.\n */\n @Prop({ reflect: true }) option: Filter;\n\n\n priceRange: HTMLSallaPriceRangeElement\n\n\n private widgetValues: HTMLElement;\n private widgetContent: HTMLDivElement;\n private initHeight: number = 195;\n\n @State() isOpen: boolean = true;\n @State() isShowMore: boolean = false;\n @State() showMoreLabel: string = \"عرض المزيد\";\n @State() showLessLabel: string = \"عرض أقل\";\n @State() page: any = salla.config.get('page');\n\n /**\n * Custom event emitted up on filter option selection changes.\n */\n @Event() changed: any;\n\n connectedCallback() {\n //lets be smart and don't show 5 and more link for 8 options\n this.withLoadMore = this.option.key != 'price' && Array.isArray(this.option.values) && this.option.values.length > 8;\n salla.onReady(() => {\n this.page = salla.config.get('page');\n })\n salla.lang.onLoaded(() => {\n this.showMoreLabel = salla.lang.getWithDefault('common.titles.more', this.showMoreLabel)\n this.showLessLabel = salla.lang.getWithDefault('common.elements.show_less', this.showLessLabel)\n })\n }\n\n componentDidLoad() {\n this.widgetValues.scrollHeight < this.initHeight && (this.withLoadMore = false);\n (this.withLoadMore && this.widgetValues) && (this.widgetValues.style.maxHeight = `${this.initHeight}px`);\n this.widgetContent.style.height = `${this.widgetContent.scrollHeight}px`;\n }\n\n /**\n * Asynchronously sets the height of a widget element to its current height, allowing for smooth transitions.\n * This function is often used in scenarios where the widget's content changes dynamically, and animating\n * the height adjustment is desired for a smoother user experience.\n *\n * @param {number} [delay=250] - Optional. The delay (in milliseconds) before updating the widget height.\n * Defaults to 250 milliseconds.\n *\n * @returns {Promise<void>} - A Promise that resolves once the widget height is set after the specified delay.\n *\n * @example\n * // Set widget height with the default delay (250 milliseconds)\n * await setWidgetHeight();\n *\n * // Set widget height with a custom delay (e.g., 500 milliseconds)\n * await setWidgetHeight(500);\n */\n @Method()\n async setWidgetHeight(delay = 250) {\n this.widgetContent.removeAttribute('style');\n setTimeout(() => {\n let currentWidgetHeight: number = this.widgetContent.scrollHeight;\n this.widgetContent.style.height = currentWidgetHeight + 'px';\n }, delay)\n }\n\n /**\n * Reset selected filter options.\n */\n @Method()\n async reset() {\n if (this.option.type === FilterOptionTypes.RANGE) {\n this.priceRange.reset()\n }\n Array.from(this.host.querySelectorAll('input')).forEach(input => input.checked = false);\n }\n\n\n /**\n * Action to show more or less filter options.\n */\n @Method()\n async showMore() {\n this.isShowMore = !this.isShowMore\n this.widgetContent.style.height = 'auto';\n this.widgetValues.style.maxHeight = this.isShowMore ? `${this.widgetValues.scrollHeight}px` : `${this.initHeight}px`;\n setTimeout(() => {\n this.widgetContent.style.height = `${this.widgetContent.scrollHeight}px`;\n }, 400); // get height after time of collapse animtion (duration-300)\n }\n\n /**\n * Action to toggle widget open or closed (expand/ collapse).\n */\n @Method()\n async toggleWidget() {\n this.isOpen = !this.isOpen;\n Helper.toggleElementClassIf(this.widgetContent, 's-filters-widget-opened', 's-filters-widget-closed', () => this.isOpen);\n }\n\n renderFilterOption(option: Filter) {\n if (![FilterOptionTypes.VALUES, FilterOptionTypes.MINIMUM, FilterOptionTypes.VARIANTS].includes(option.type)) {\n return '';\n }\n //@ts-ignore\n return option.values.map((filterOption, index) => {\n let value = typeof filterOption == 'number' ? filterOption : (filterOption.key || filterOption.value);\n\n return <label class=\"s-filters-label\" htmlFor={`${option.key}-option-${value}`} key={`${option.key}-option-${value}`}>\n <input\n id={`${option.key}-option-${value}`}\n name={option.key}\n type=\"radio\"\n checked={this.isSelectedOption(option, value)}\n class={`s-filters-radio`}\n onChange={event => this.changed.emit({ event, option, value })}\n />\n {this.getOptionLabel(option, filterOption)}\n </label>\n }\n )\n\n }\n private isSelectedOption(option: Filter, value: any): boolean {\n if (option.type === FilterOptionTypes.MINIMUM) {\n return this.filtersData[option.key] == value;\n }\n if (option.type === FilterOptionTypes.VARIANTS) {\n return this.filtersData[option.type] && this.filtersData[option.type][Object.keys(this.filtersData[option.type])[0]] == value;\n }\n if (option.type === FilterOptionTypes.RANGE) {\n\n return this.filtersData[option.key] && this.filtersData[option.key].min == value.min && this.filtersData[option.key].max == value.max;\n }\n\n if (option.type === FilterOptionTypes.VALUES) {\n return this.filtersData[option.key] && Number(this.filtersData[option.key]) == Number(value);\n }\n return false;\n }\n\n\n\n private getOptionLabel(option: Filter, filterOption) {\n if (option.key == 'rating') {\n //in amazon has stars & up, should we add it, to avoid those people who will come to say I selected 4 why I see 5 sars products\n return <salla-rating-stars size=\"small\" value={filterOption} />;\n }\n let label = filterOption.value || 'null';\n //label+=filterOption.count ? ` (${salla.helpers.number(filterOption.count)})` : '';\n return <span class=\"s-filters-option-name\">{label}</span>;\n }\n\n render() {\n return (\n <Host class=\"s-filters-widget-container\">\n <h3 class=\"s-filters-widget-title\" onClick={() => this.toggleWidget()}>\n <span>{this.option.label}</span>\n <span class={`s-filters-widget-plusminus ${this.isOpen ? 's-filters-widget-plusminus-active' : ''}`} />\n </h3>\n <div class=\"s-filters-widget-content\" ref={(el) => this.widgetContent = el}>\n <div class=\"s-filters-widget-values\" ref={(el) => this.widgetValues = el}>\n <slot />\n {\n this.option.type !== FilterOptionTypes.RANGE\n ? this.renderFilterOption(this.option)\n : <salla-price-range onChanged={(event) => {\n this.changed.emit(event.detail)\n }}\n ref={price => this.priceRange = price}\n filtersData={this.filtersData}\n option={this.option} />\n }\n </div>\n {this.withLoadMore &&\n <a class=\"s-filters-widget-more\"\n onClick={() => this.showMore()}>{!this.isShowMore ? this.showMoreLabel : this.showLessLabel}</a>\n }\n </div>\n </Host>\n );\n }\n\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;MAAA,MAAM,qBAAqB,GAAG,sBAAsB;;YCQvC,kBAAkB,mCAAA,MAAA;MAJ/B,IAAA,WAAA,CAAA,OAAA,EAAA;;;MA4BU,QAAA,IAAU,CAAA,UAAA,GAAW,GAAG;MAEvB,QAAA,IAAM,CAAA,MAAA,GAAY,IAAI;MACtB,QAAA,IAAU,CAAA,UAAA,GAAY,KAAK;MAC3B,QAAA,IAAa,CAAA,aAAA,GAAW,YAAY;MACpC,QAAA,IAAa,CAAA,aAAA,GAAW,SAAS;cACjC,IAAI,CAAA,IAAA,GAAQ,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC;MAwK9C;UAjKC,iBAAiB,GAAA;;MAEf,QAAA,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;MACpH,QAAA,KAAK,CAAC,OAAO,CAAC,MAAK;kBACjB,IAAI,CAAC,IAAI,GAAG,K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AAE,EAAA,EAAG,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAK,CAEhG,CACD;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"p-C51w7Au-.system.js","sources":["src/components/salla-filters-widget/salla-filters-widget.scss?tag=salla-filters-widget","src/components/salla-filters-widget/salla-filters-widget.tsx"],"sourcesContent":[":host {\n display: block;\n}\n","import { Component, Host, h, Method, State, Prop, Event, Element } from '@stencil/core';\nimport Helper from '../../Helpers/Helper';\nimport { Filter, FilterOptionTypes } from \"../salla-filters/interfaces\";\n\n@Component({\n tag: 'salla-filters-widget',\n styleUrl: 'salla-filters-widget.scss',\n})\nexport class SallaFiltersWidget {\n @Element() host: HTMLElement;\n\n /**\n * Show more or less filter options.\n */\n @Prop({ mutable: true }) withLoadMore: boolean;\n\n /**\n * Selected filter options value.\n */\n @Prop({ reflect: true }) filtersData: object;\n\n /**\n * Filter option along with possible values.\n */\n @Prop({ reflect: true }) option: Filter;\n\n\n priceRange: HTMLSallaPriceRangeElement\n\n\n private widgetValues: HTMLElement;\n private widgetContent: HTMLDivElement;\n private initHeight: number = 195;\n\n @State() isOpen: boolean = true;\n @State() isShowMore: boolean = false;\n @State() showMoreLabel: string = \"عرض المزيد\";\n @State() showLessLabel: string = \"عرض أقل\";\n @State() page: any = salla.config.get('page');\n\n /**\n * Custom event emitted up on filter option selection changes.\n */\n @Event() changed: any;\n\n connectedCallback() {\n //lets be smart and don't show 5 and more link for 8 options\n this.withLoadMore = this.option.key != 'price' && Array.isArray(this.option.values) && this.option.values.length > 8;\n salla.onReady(() => {\n this.page = salla.config.get('page');\n })\n salla.lang.onLoaded(() => {\n this.showMoreLabel = salla.lang.getWithDefault('common.titles.more', this.showMoreLabel)\n this.showLessLabel = salla.lang.getWithDefault('common.elements.show_less', this.showLessLabel)\n })\n }\n\n componentDidLoad() {\n this.widgetValues.scrollHeight < this.initHeight && (this.withLoadMore = false);\n (this.withLoadMore && this.widgetValues) && (this.widgetValues.style.maxHeight = `${this.initHeight}px`);\n this.widgetContent.style.height = `${this.widgetContent.scrollHeight}px`;\n }\n\n /**\n * Asynchronously sets the height of a widget element to its current height, allowing for smooth transitions.\n * This function is often used in scenarios where the widget's content changes dynamically, and animating\n * the height adjustment is desired for a smoother user experience.\n *\n * @param {number} [delay=250] - Optional. The delay (in milliseconds) before updating the widget height.\n * Defaults to 250 milliseconds.\n *\n * @returns {Promise<void>} - A Promise that resolves once the widget height is set after the specified delay.\n *\n * @example\n * // Set widget height with the default delay (250 milliseconds)\n * await setWidgetHeight();\n *\n * // Set widget height with a custom delay (e.g., 500 milliseconds)\n * await setWidgetHeight(500);\n */\n @Method()\n async setWidgetHeight(delay = 250) {\n this.widgetContent.removeAttribute('style');\n setTimeout(() => {\n let currentWidgetHeight: number = this.widgetContent.scrollHeight;\n this.widgetContent.style.height = currentWidgetHeight + 'px';\n }, delay)\n }\n\n /**\n * Reset selected filter options.\n */\n @Method()\n async reset() {\n if (this.option.type === FilterOptionTypes.RANGE) {\n this.priceRange.reset()\n }\n Array.from(this.host.querySelectorAll('input')).forEach(input => input.checked = false);\n }\n\n\n /**\n * Action to show more or less filter options.\n */\n @Method()\n async showMore() {\n this.isShowMore = !this.isShowMore\n this.widgetContent.style.height = 'auto';\n this.widgetValues.style.maxHeight = this.isShowMore ? `${this.widgetValues.scrollHeight}px` : `${this.initHeight}px`;\n setTimeout(() => {\n this.widgetContent.style.height = `${this.widgetContent.scrollHeight}px`;\n }, 400); // get height after time of collapse animtion (duration-300)\n }\n\n /**\n * Action to toggle widget open or closed (expand/ collapse).\n */\n @Method()\n async toggleWidget() {\n this.isOpen = !this.isOpen;\n Helper.toggleElementClassIf(this.widgetContent, 's-filters-widget-opened', 's-filters-widget-closed', () => this.isOpen);\n }\n\n renderFilterOption(option: Filter) {\n if (![FilterOptionTypes.VALUES, FilterOptionTypes.MINIMUM, FilterOptionTypes.VARIANTS].includes(option.type)) {\n return '';\n }\n //@ts-ignore\n return option.values.map((filterOption, index) => {\n let value = typeof filterOption == 'number' ? filterOption : (filterOption.key || filterOption.value);\n\n return <label class=\"s-filters-label\" htmlFor={`${option.key}-option-${value}`} key={`${option.key}-option-${value}`}>\n <input\n id={`${option.key}-option-${value}`}\n name={option.key}\n type=\"radio\"\n checked={this.isSelectedOption(option, value)}\n class={`s-filters-radio`}\n onChange={event => this.changed.emit({ event, option, value })}\n />\n {this.getOptionLabel(option, filterOption)}\n </label>\n }\n )\n\n }\n private isSelectedOption(option: Filter, value: any): boolean {\n if (option.type === FilterOptionTypes.MINIMUM) {\n return this.filtersData[option.key] == value;\n }\n if (option.type === FilterOptionTypes.VARIANTS) {\n return this.filtersData[option.type] && this.filtersData[option.type][Object.keys(this.filtersData[option.type])[0]] == value;\n }\n if (option.type === FilterOptionTypes.RANGE) {\n\n return this.filtersData[option.key] && this.filtersData[option.key].min == value.min && this.filtersData[option.key].max == value.max;\n }\n\n if (option.type === FilterOptionTypes.VALUES) {\n return this.filtersData[option.key] && Number(this.filtersData[option.key]) == Number(value);\n }\n return false;\n }\n\n\n\n private getOptionLabel(option: Filter, filterOption) {\n if (option.key == 'rating') {\n //in amazon has stars & up, should we add it, to avoid those people who will come to say I selected 4 why I see 5 sars products\n return <salla-rating-stars size=\"small\" value={filterOption} />;\n }\n let label = filterOption.value || 'null';\n //label+=filterOption.count ? ` (${salla.helpers.number(filterOption.count)})` : '';\n return <span class=\"s-filters-option-name\">{label}</span>;\n }\n\n render() {\n return (\n <Host class=\"s-filters-widget-container\">\n <h3 class=\"s-filters-widget-title\" onClick={() => this.toggleWidget()}>\n <span>{this.option.label}</span>\n <span class={`s-filters-widget-plusminus ${this.isOpen ? 's-filters-widget-plusminus-active' : ''}`} />\n </h3>\n <div class=\"s-filters-widget-content\" ref={(el) => this.widgetContent = el}>\n <div class=\"s-filters-widget-values\" ref={(el) => this.widgetValues = el}>\n <slot />\n {\n this.option.type !== FilterOptionTypes.RANGE\n ? this.renderFilterOption(this.option)\n : <salla-price-range onChanged={(event) => {\n this.changed.emit(event.detail)\n }}\n ref={price => this.priceRange = price}\n filtersData={this.filtersData}\n option={this.option} />\n }\n </div>\n {this.withLoadMore &&\n <a class=\"s-filters-widget-more\"\n onClick={() => this.showMore()}>{!this.isShowMore ? this.showMoreLabel : this.showLessLabel}</a>\n }\n </div>\n </Host>\n );\n }\n\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;MAAA,MAAM,qBAAqB,GAAG,sBAAsB;;YCQvC,kBAAkB,mCAAA,MAAA;MAJ/B,IAAA,WAAA,CAAA,OAAA,EAAA;;;MA4BU,QAAA,IAAU,CAAA,UAAA,GAAW,GAAG;MAEvB,QAAA,IAAM,CAAA,MAAA,GAAY,IAAI;MACtB,QAAA,IAAU,CAAA,UAAA,GAAY,KAAK;MAC3B,QAAA,IAAa,CAAA,aAAA,GAAW,YAAY;MACpC,QAAA,IAAa,CAAA,aAAA,GAAW,SAAS;cACjC,IAAI,CAAA,IAAA,GAAQ,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC;MAwK9C;UAjKC,iBAAiB,GAAA;;MAEf,QAAA,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;MACpH,QAAA,KAAK,CAAC,OAAO,CAAC,MAAK;kBACjB,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC;MACtC,SAAC,CAAC;MACF,QAAA,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAK;MACvB,YAAA,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,oBAAoB,EAAE,IAAI,CAAC,aAAa,CAAC;MACxF,YAAA,I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iple-bundle-product.scss?tag=salla-order-details-multiple-bundle-product","src/components/salla-order-details/salla-order-details-multiple-bundle-product.tsx"],"sourcesContent":["","import { Component, Host, h, Prop } from '@stencil/core';\nimport { OrderProduct } from './interfaces';\n\n/**\n * @salla/ui-components\n * The `salla-order-details-multiple-bundle-product` component renders a collapsible summary for an order multiple bundle product with optional options list.\n * It uses the salla-accordion component to provide collapsible functionality.\n */\n@Component({\n tag: 'salla-order-details-multiple-bundle-product',\n styleUrl: 'salla-order-details-multiple-bundle-product.scss',\n})\nexport class SallaproductDetailsMultipleBundleProduct {\n /** The product data to display */\n @Prop({ attribute: 'product-details' }) productDetails: OrderProduct;\n\n /** Whether the accordion should be collapsible */\n @Prop() collapsible?: boolean;\n\n /** Placeholder image URL when product image is not available */\n @Prop() placeholderImage: string = salla.url.cdn('images/s-empty.png');\n\n private getProductImage(): string {\n if (!this.productDetails?.image) {\n return this.placeholderImage;\n }\n\n // Handle both string and object types for image\n if (typeof this.productDetails.image === 'string') {\n return this.productDetails.image;\n }\n\n return (\n this.productDetails.image.url || this.placeholderImage || salla.url.cdn('images/s-empty.png')\n );\n }\n\n private getProductImageAlt(): string {\n if (!this.productDetails?.image || typeof this.productDetails.image === 'string') {\n return this.productDetails?.name || '';\n }\n\n return this.productDetails.image.alt || this.productDetails?.name || '';\n }\n\n private getAccordionId(): string {\n return `accordion-${this.productDetails?.id || 'default'}`;\n }\n\n private getAccordionKey(): string | number {\n return this.productDetails?.id || 'default';\n }\n\n private shouldBeCollapsible(): boolean {\n if (this.collapsible !== undefined) {\n return this.collapsible;\n }\n return this.productDetails?.options?.length > 0;\n }\n\n private renderProductPrice() {\n if (!this.productDetails) {\n return null;\n }\n\n const { is_on_sale, sale_price, regular_price, price } = this.productDetails as any;\n\n if (is_on_sale && sale_price) {\n return (\n <div>\n <span class=\"s-order-details-product-price s-order-details-product-price-sale\">\n <span innerHTML={salla.money(sale_price)}></span>\n </span>\n {regular_price && (\n <span class=\"s-order-details-product-regular-price\">\n <span innerHTML={salla.money(regular_price)}></span>\n </span>\n )}\n </div>\n );\n }\n\n return (\n <span class=\"s-order-details-product-price\">\n <span innerHTML={salla.money(price)}></span>\n </span>\n );\n }\n\n private renderOptions() {\n if (!this.productDetails?.options?.length) {\n return null;\n }\n\n return (\n <salla-accordion-body>\n <div class=\"s-order-details-options\">\n <salla-order-details-options options={this.productDetails.options} />\n </div>\n </salla-accordion-body>\n );\n }\n\n render() {\n if (!this.productDetails) {\n return null;\n }\n\n const collapsibleState = this.shouldBeCollapsible();\n\n return (\n <Host class=\"s-order-details-bundle-wrapper\">\n <salla-accordion\n key={this.getAccordionKey()}\n collapsed={false}\n bordered={true}\n collapsible={collapsibleState}\n id={this.getAccordionId()}\n size=\"sm\"\n >\n <salla-accordion-head>\n <div class=\"s-order-details-product\">\n <div class=\"s-order-details-product-content\">\n <div class=\"s-order-details-product-info\">\n <div class=\"s-order-details-product-image\">\n <img src={this.getProductImage()} alt={this.getProductImageAlt()} />\n </div>\n <div class=\"s-order-details-product-details\">\n <a href={this.productDetails?.url || '#'} class=\"s-order-details-product-name\">\n {this.productDetails?.name || ''}\n </a>\n {this.renderProductPrice()}\n {this.productDetails?.quantity && (\n <span class=\"s-order-details-product-quantity\">\n ×{this.productDetails.quantity}\n </span>\n )}\n </div>\n </div>\n </div>\n </div>\n </salla-accordion-head>\n\n {this.renderOptions()}\n </salla-accordion>\n </Host>\n );\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;YAAA,MAAM,yCAAyC,GAAG,EAAE;;kBCYvC,wCAAwC,0DAAA,MAAA;YAJrD,IAAA,WAAA,CAAA,OAAA,EAAA;;;oBAYU,IAAgB,CAAA,gBAAA,GAAW,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,oBAAoB,CAAC;YAgIvE;gBA9HS,eAAe,GAAA;;YACrB,QAAA,IAAI,EAAC,CAAA,EAAA,GAAA,IAAI,CAAC,cAAc,MAAE,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,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