@salla.sa/twilight-components 2.14.252 → 2.14.253
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-ChKTQEJ9.js → app-globals-BoVwS_2u.js} +3 -3
- package/dist/cjs/{app-globals-ChKTQEJ9.js.map → app-globals-BoVwS_2u.js.map} +1 -1
- package/dist/cjs/{index-DtXwvL5X.js → index-DxXe1Ylr.js} +16 -16
- package/dist/cjs/index-DxXe1Ylr.js.map +1 -0
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/salla-accordion.salla-accordion-body.salla-accordion-head.salla-order-details-options.entry.cjs.js.map +1 -0
- package/dist/cjs/salla-accordion_4.cjs.entry.js +202 -0
- package/dist/cjs/salla-accordion_4.cjs.entry.js.map +1 -0
- package/dist/cjs/salla-add-product-button_51.cjs.entry.js +48 -48
- 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 +3 -3
- 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 +3 -3
- package/dist/cjs/salla-filters.cjs.entry.js +2 -2
- package/dist/cjs/salla-installment.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +2 -2
- package/dist/cjs/salla-loyalty-program.cjs.entry.js +2 -2
- package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
- package/dist/cjs/salla-notification-item.cjs.entry.js +2 -2
- 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 +80 -0
- package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js.map +1 -0
- package/dist/cjs/salla-order-details-multiple-bundle-product.entry.cjs.js.map +1 -0
- package/dist/cjs/salla-order-details.cjs.entry.js +53 -0
- package/dist/cjs/salla-order-details.cjs.entry.js.map +1 -0
- package/dist/cjs/salla-order-details.entry.cjs.js.map +1 -0
- package/dist/cjs/salla-order-summary.cjs.entry.js +2 -2
- package/dist/cjs/salla-orders.cjs.entry.js +1 -1
- package/dist/cjs/salla-payments.cjs.entry.js +3 -3
- package/dist/cjs/salla-price-range.cjs.entry.js +3 -3
- package/dist/cjs/salla-product-options.cjs.entry.js +1 -1
- package/dist/cjs/salla-review-card.cjs.entry.js +2 -2
- package/dist/cjs/salla-reviews-page.cjs.entry.js +2 -2
- package/dist/cjs/salla-reviews.cjs.entry.js +2 -2
- package/dist/cjs/salla-social.cjs.entry.js +2 -2
- package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-tooltip.cjs.entry.js +2 -2
- package/dist/cjs/salla-verify.cjs.entry.js +1 -1
- package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
- package/dist/cjs/twilight.cjs.js +3 -3
- package/dist/collection/collection-manifest.json +3 -0
- package/dist/collection/components/salla-accordion/salla-accordion-head.js +2 -2
- package/dist/collection/components/salla-accordion/salla-accordion-head.js.map +1 -1
- package/dist/collection/components/salla-accordion/salla-accordion.js +43 -1
- package/dist/collection/components/salla-accordion/salla-accordion.js.map +1 -1
- package/dist/collection/components/salla-alert/salla-alert.js +1 -1
- package/dist/collection/components/salla-booking-field/salla-booking-field.js +1 -1
- package/dist/collection/components/salla-bottom-alert/salla-bottom-alert.js +2 -2
- package/dist/collection/components/salla-cart-summary/salla-cart-summary.js +1 -1
- package/dist/collection/components/salla-color-picker/salla-color-picker.js +1 -1
- package/dist/collection/components/salla-comment-form/salla-comment-form.js +1 -1
- package/dist/collection/components/salla-comments/salla-comment-item.js +3 -3
- package/dist/collection/components/salla-conditional-fields/salla-conditional-fields.js +1 -1
- package/dist/collection/components/salla-count-down/salla-count-down.js +1 -1
- package/dist/collection/components/salla-datetime-picker/salla-datetime-picker.js +1 -1
- package/dist/collection/components/salla-file-upload/salla-file-upload.js +2 -2
- package/dist/collection/components/salla-filters/salla-filters.js +1 -1
- package/dist/collection/components/salla-filters-widget/salla-filters-widget.js +2 -2
- package/dist/collection/components/salla-gifting/salla-gifting.js +2 -2
- package/dist/collection/components/salla-list-tile/salla-list-tile.js +1 -1
- package/dist/collection/components/salla-loading/salla-loading.js +1 -1
- package/dist/collection/components/salla-localization-modal/salla-localization-modal.js +1 -1
- package/dist/collection/components/salla-loyalty/salla-loyalty-prize-item.js +1 -1
- package/dist/collection/components/salla-loyalty-program/salla-loyalty-program.js +1 -1
- package/dist/collection/components/salla-maintenance-alert/salla-maintenance-alert.js +1 -1
- package/dist/collection/components/salla-map/salla-map.js +3 -3
- package/dist/collection/components/salla-notifications/salla-notification-item.js +1 -1
- package/dist/collection/components/salla-offer-modal/salla-offer-modal.js +1 -1
- package/dist/collection/components/salla-order-details/interfaces.js +2 -0
- package/dist/collection/components/salla-order-details/interfaces.js.map +1 -0
- package/dist/collection/components/salla-order-details/salla-order-details-multiple-bundle-product.css +0 -0
- package/dist/collection/components/salla-order-details/salla-order-details-multiple-bundle-product.js +152 -0
- package/dist/collection/components/salla-order-details/salla-order-details-multiple-bundle-product.js.map +1 -0
- package/dist/collection/components/salla-order-details/salla-order-details-options.css +0 -0
- package/dist/collection/components/salla-order-details/salla-order-details-options.js +177 -0
- package/dist/collection/components/salla-order-details/salla-order-details-options.js.map +1 -0
- package/dist/collection/components/salla-order-details/salla-order-details.css +0 -0
- package/dist/collection/components/salla-order-details/salla-order-details.js +93 -0
- package/dist/collection/components/salla-order-details/salla-order-details.js.map +1 -0
- package/dist/collection/components/salla-order-summary/salla-order-summary.js +1 -1
- package/dist/collection/components/salla-payments/salla-payments.js +2 -2
- package/dist/collection/components/salla-placeholder/salla-placeholder.js +1 -1
- package/dist/collection/components/salla-price-range/salla-price-range.js +2 -2
- package/dist/collection/components/salla-product-availability/salla-product-availability.js +1 -1
- package/dist/collection/components/salla-product-card/salla-product-card.js +5 -5
- package/dist/collection/components/salla-product-size-guide/salla-product-size-guide.js +2 -2
- package/dist/collection/components/salla-quantity-input/salla-quantity-input.js +1 -1
- package/dist/collection/components/salla-quick-buy/salla-quick-buy.js +1 -1
- package/dist/collection/components/salla-review-card/salla-review-card.js +1 -1
- package/dist/collection/components/salla-reviews/salla-reviews.js +1 -1
- package/dist/collection/components/salla-reviews-page/salla-reviews-page.js +1 -1
- package/dist/collection/components/salla-scopes/salla-scopes.js +1 -1
- package/dist/collection/components/salla-search/salla-search.js +3 -3
- package/dist/collection/components/salla-skeleton/salla-skeleton.js +1 -1
- package/dist/collection/components/salla-slider/salla-slider.js +2 -2
- package/dist/collection/components/salla-social/salla-social.js +1 -1
- package/dist/collection/components/salla-social-share/salla-social-share.js +1 -1
- package/dist/collection/components/salla-tabs/salla-tab-content.js +1 -1
- package/dist/collection/components/salla-tabs/salla-tab-header.js +1 -1
- package/dist/collection/components/salla-tabs/salla-tabs.js +1 -1
- package/dist/collection/components/salla-tel-input/salla-tel-input.js +1 -1
- package/dist/collection/components/salla-tooltip/salla-tooltip.js +1 -1
- package/dist/collection/components/salla-user-settings/salla-user-settings.js +1 -1
- package/dist/components/index.js +2 -2
- package/dist/components/index.js.map +1 -1
- package/dist/components/salla-accordion-body.js +1 -27
- package/dist/components/salla-accordion-body.js.map +1 -1
- package/dist/components/salla-accordion-body2.js +35 -0
- package/dist/components/salla-accordion-body2.js.map +1 -0
- package/dist/components/salla-accordion-head.js +1 -59
- package/dist/components/salla-accordion-head.js.map +1 -1
- package/dist/components/salla-accordion-head2.js +67 -0
- package/dist/components/salla-accordion-head2.js.map +1 -0
- package/dist/components/salla-accordion.js +1 -59
- package/dist/components/salla-accordion.js.map +1 -1
- package/dist/components/salla-accordion2.js +71 -0
- package/dist/components/salla-accordion2.js.map +1 -0
- package/dist/components/salla-alert.js +1 -1
- package/dist/components/salla-booking-field2.js +1 -1
- package/dist/components/salla-bottom-alert.js +2 -2
- package/dist/components/salla-cart-summary.js +1 -1
- package/dist/components/salla-color-picker2.js +1 -1
- package/dist/components/salla-comment-form2.js +1 -1
- package/dist/components/salla-comment-item2.js +3 -3
- package/dist/components/salla-conditional-fields2.js +1 -1
- package/dist/components/salla-count-down2.js +1 -1
- package/dist/components/salla-datetime-picker2.js +1 -1
- package/dist/components/salla-file-upload2.js +2 -2
- package/dist/components/salla-filters-widget2.js +2 -2
- package/dist/components/salla-filters.js +1 -1
- package/dist/components/salla-gifting.js +2 -2
- package/dist/components/salla-list-tile2.js +1 -1
- package/dist/components/salla-loading2.js +1 -1
- package/dist/components/salla-localization-modal.js +1 -1
- package/dist/components/salla-loyalty-prize-item.js +1 -1
- package/dist/components/salla-loyalty-program.js +1 -1
- package/dist/components/salla-maintenance-alert.js +1 -1
- package/dist/components/salla-map2.js +3 -3
- package/dist/components/salla-notification-item2.js +1 -1
- package/dist/components/salla-offer-modal.js +1 -1
- package/dist/components/salla-order-details-multiple-bundle-product.d.ts +11 -0
- package/dist/components/salla-order-details-multiple-bundle-product.js +12 -0
- package/dist/components/salla-order-details-multiple-bundle-product.js.map +1 -0
- package/dist/components/salla-order-details-multiple-bundle-product2.js +144 -0
- package/dist/components/salla-order-details-multiple-bundle-product2.js.map +1 -0
- package/dist/components/salla-order-details-options.d.ts +11 -0
- package/dist/components/salla-order-details-options.js +12 -0
- package/dist/components/salla-order-details-options.js.map +1 -0
- package/dist/components/salla-order-details-options2.js +145 -0
- package/dist/components/salla-order-details-options2.js.map +1 -0
- package/dist/components/salla-order-details.d.ts +11 -0
- package/dist/components/salla-order-details.js +127 -0
- package/dist/components/salla-order-details.js.map +1 -0
- package/dist/components/salla-order-summary.js +1 -1
- package/dist/components/salla-payments.js +2 -2
- package/dist/components/salla-placeholder2.js +1 -1
- package/dist/components/salla-price-range2.js +2 -2
- package/dist/components/salla-product-availability2.js +1 -1
- package/dist/components/salla-product-card2.js +5 -5
- package/dist/components/salla-product-size-guide.js +2 -2
- package/dist/components/salla-quantity-input.js +1 -1
- package/dist/components/salla-quick-buy2.js +1 -1
- package/dist/components/salla-review-card2.js +1 -1
- package/dist/components/salla-reviews-page.js +1 -1
- package/dist/components/salla-reviews.js +1 -1
- package/dist/components/salla-scopes.js +1 -1
- package/dist/components/salla-search.js +3 -3
- package/dist/components/salla-skeleton2.js +1 -1
- package/dist/components/salla-slider2.js +2 -2
- package/dist/components/salla-social-share.js +1 -1
- package/dist/components/salla-social.js +1 -1
- package/dist/components/salla-tab-content2.js +1 -1
- package/dist/components/salla-tab-header2.js +1 -1
- package/dist/components/salla-tabs2.js +1 -1
- package/dist/components/salla-tel-input2.js +1 -1
- package/dist/components/salla-tooltip2.js +1 -1
- package/dist/components/salla-user-settings.js +1 -1
- package/dist/esm/{app-globals-3b0DwjjK.js → app-globals-5yxEmkuB.js} +3 -3
- package/dist/esm/{app-globals-3b0DwjjK.js.map → app-globals-5yxEmkuB.js.map} +1 -1
- package/dist/esm/{index-D4D34Ujk.js → index-Hw2jlaNN.js} +16 -16
- package/dist/esm/index-Hw2jlaNN.js.map +1 -0
- package/dist/esm/loader.js +4 -4
- package/dist/esm/salla-accordion.salla-accordion-body.salla-accordion-head.salla-order-details-options.entry.js.map +1 -0
- package/dist/esm/salla-accordion_4.entry.js +197 -0
- package/dist/esm/salla-accordion_4.entry.js.map +1 -0
- package/dist/esm/salla-add-product-button_51.entry.js +48 -48
- 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 +3 -3
- 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 +3 -3
- package/dist/esm/salla-filters.entry.js +2 -2
- package/dist/esm/salla-installment.entry.js +1 -1
- package/dist/esm/salla-loyalty-prize-item.entry.js +2 -2
- package/dist/esm/salla-loyalty-program.entry.js +2 -2
- package/dist/esm/salla-metadata.entry.js +1 -1
- package/dist/esm/salla-notification-item.entry.js +2 -2
- 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 +78 -0
- package/dist/esm/salla-order-details-multiple-bundle-product.entry.js.map +1 -0
- package/dist/esm/salla-order-details.entry.js +51 -0
- package/dist/esm/salla-order-details.entry.js.map +1 -0
- package/dist/esm/salla-order-summary.entry.js +2 -2
- package/dist/esm/salla-orders.entry.js +1 -1
- package/dist/esm/salla-payments.entry.js +3 -3
- package/dist/esm/salla-price-range.entry.js +3 -3
- package/dist/esm/salla-product-options.entry.js +1 -1
- package/dist/esm/salla-review-card.entry.js +2 -2
- package/dist/esm/salla-reviews-page.entry.js +2 -2
- package/dist/esm/salla-reviews.entry.js +2 -2
- package/dist/esm/salla-social.entry.js +2 -2
- package/dist/esm/salla-tiered-offer.entry.js +1 -1
- package/dist/esm/salla-tooltip.entry.js +2 -2
- package/dist/esm/salla-verify.entry.js +1 -1
- package/dist/esm/salla-wallet.entry.js +1 -1
- package/dist/esm/twilight.js +4 -4
- package/dist/esm-es5/{app-globals-3b0DwjjK.js → app-globals-5yxEmkuB.js} +2 -2
- package/dist/esm-es5/{app-globals-3b0DwjjK.js.map → app-globals-5yxEmkuB.js.map} +1 -1
- package/dist/esm-es5/{index-D4D34Ujk.js → index-Hw2jlaNN.js} +3 -3
- package/dist/esm-es5/index-Hw2jlaNN.js.map +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/salla-accordion.salla-accordion-body.salla-accordion-head.salla-order-details-options.entry.js.map +1 -0
- package/dist/esm-es5/salla-accordion_4.entry.js +5 -0
- package/dist/esm-es5/salla-accordion_4.entry.js.map +1 -0
- package/dist/esm-es5/salla-add-product-button_51.entry.js +3 -3
- 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 +2 -2
- package/dist/esm-es5/salla-filters.entry.js +1 -1
- package/dist/esm-es5/salla-installment.entry.js +1 -1
- package/dist/esm-es5/salla-loyalty-prize-item.entry.js +1 -1
- package/dist/esm-es5/salla-loyalty-program.entry.js +1 -1
- package/dist/esm-es5/salla-metadata.entry.js +2 -2
- package/dist/esm-es5/salla-notification-item.entry.js +1 -1
- package/dist/esm-es5/salla-notifications.entry.js +2 -2
- package/dist/esm-es5/salla-offer.entry.js +1 -1
- package/dist/esm-es5/salla-order-details-multiple-bundle-product.entry.js +5 -0
- package/dist/esm-es5/salla-order-details-multiple-bundle-product.entry.js.map +1 -0
- package/dist/esm-es5/salla-order-details.entry.js +5 -0
- package/dist/esm-es5/salla-order-details.entry.js.map +1 -0
- 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 +2 -2
- 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-d513da6f.entry.js → p-0065a55b.entry.js} +2 -2
- package/dist/twilight/{p-c9678188.system.entry.js → p-05cf8f0f.system.entry.js} +2 -2
- package/dist/twilight/{p-8213a9ef.system.entry.js → p-066a5e95.system.entry.js} +2 -2
- package/dist/twilight/{p-81aeef6a.entry.js → p-0a58ecb2.entry.js} +2 -2
- package/dist/twilight/{p-5b882c52.system.entry.js → p-0ab8c50f.system.entry.js} +2 -2
- package/dist/twilight/{p-d84eb47c.entry.js → p-13efdbe3.entry.js} +2 -2
- package/dist/twilight/{p-4af5ffea.entry.js → p-13f1a287.entry.js} +2 -2
- package/dist/twilight/{p-6e24a5f0.system.entry.js → p-15c42251.system.entry.js} +2 -2
- package/dist/twilight/{p-8c0822f7.system.entry.js → p-17567b38.system.entry.js} +2 -2
- package/dist/twilight/p-184bc156.system.entry.js +5 -0
- package/dist/twilight/p-184bc156.system.entry.js.map +1 -0
- package/dist/twilight/{p-648fb6ca.entry.js → p-204e0ad2.entry.js} +2 -2
- package/dist/twilight/{p-63cba8e3.entry.js → p-210ccdae.entry.js} +2 -2
- package/dist/twilight/{p-d0004953.entry.js → p-240b86ef.entry.js} +2 -2
- package/dist/twilight/{p-dd83a408.entry.js → p-27206d63.entry.js} +2 -2
- package/dist/twilight/{p-c84819d5.entry.js → p-35dd7512.entry.js} +4 -4
- package/dist/twilight/{p-2af0da5a.system.entry.js → p-38675c42.system.entry.js} +2 -2
- package/dist/twilight/{p-7234c5f2.system.entry.js → p-3cdd4d44.system.entry.js} +2 -2
- package/dist/twilight/{p-8359eb2a.entry.js → p-3e9ceed0.entry.js} +2 -2
- package/dist/twilight/{p-a18f81a8.system.entry.js → p-447f03b5.system.entry.js} +2 -2
- package/dist/twilight/{p-2ecf868e.entry.js → p-4b7e613a.entry.js} +2 -2
- package/dist/twilight/{p-d5750810.entry.js → p-4d5387e9.entry.js} +2 -2
- package/dist/twilight/{p-ad0fedcd.system.entry.js → p-53fb14d0.system.entry.js} +2 -2
- package/dist/twilight/p-5db51240.system.entry.js +5 -0
- package/dist/twilight/{p-aad20f10.system.entry.js → p-61f590ca.system.entry.js} +2 -2
- package/dist/twilight/p-6a179bc3.system.entry.js +5 -0
- package/dist/twilight/p-6a179bc3.system.entry.js.map +1 -0
- package/dist/twilight/{p-407d19d8.system.entry.js → p-6a51cb91.system.entry.js} +2 -2
- package/dist/twilight/{p-95adf84e.entry.js → p-6abfa7ed.entry.js} +2 -2
- package/dist/twilight/{p-45b61475.entry.js → p-6f66faea.entry.js} +2 -2
- package/dist/twilight/{p-f57bcc51.entry.js → p-7187b729.entry.js} +2 -2
- package/dist/twilight/{p-c87d6aa6.system.entry.js → p-765562b8.system.entry.js} +4 -4
- package/dist/twilight/p-76d92026.entry.js +5 -0
- package/dist/twilight/p-76d92026.entry.js.map +1 -0
- package/dist/twilight/{p-6a0b5799.entry.js → p-78deca48.entry.js} +2 -2
- package/dist/twilight/{p-3483eb09.system.entry.js → p-7dce6627.system.entry.js} +2 -2
- package/dist/twilight/p-7f28b72e.entry.js +5 -0
- package/dist/twilight/p-7f28b72e.entry.js.map +1 -0
- package/dist/twilight/{p-396198a2.entry.js → p-83f6408a.entry.js} +2 -2
- package/dist/twilight/{p-d097a67d.system.entry.js → p-888de4b8.system.entry.js} +2 -2
- package/dist/twilight/{p-Ccj70VFr.system.js.map → p-8SAlNoQ7.system.js.map} +1 -1
- package/dist/twilight/{p-CZGaqTus.system.js.map → p-8cuU9AcW.system.js.map} +1 -1
- package/dist/twilight/{p-1b24ea99.system.entry.js → p-8e807035.system.entry.js} +2 -2
- package/dist/twilight/{p-6b716e82.system.entry.js → p-8fcff962.system.entry.js} +2 -2
- package/dist/twilight/p-9a8a57f0.entry.js +5 -0
- package/dist/twilight/{p-1a9eebb6.system.entry.js → p-9cb1a11d.system.entry.js} +2 -2
- package/dist/twilight/{p-CDmxJQ_1.system.js.map → p-B10yx9se.system.js.map} +1 -1
- package/dist/twilight/{p-BHI6mAw4.system.js.map → p-BKsOE9n5.system.js.map} +1 -1
- package/dist/twilight/{p-BRsVFuI-.system.js.map → p-BzHfWaAI.system.js.map} +1 -1
- package/dist/twilight/{p-ByNC3ygM.system.js.map → p-C0IcnmR-.system.js.map} +1 -1
- package/dist/twilight/{p-B_aBck2N.system.js.map → p-C0Tc4qY_.system.js.map} +1 -1
- package/dist/twilight/{p-e-FAhVeu.system.js.map → p-C72wuhae.system.js.map} +1 -1
- package/dist/twilight/{p-BrxIkK1y.system.js.map → p-CDuCVzYE.system.js.map} +1 -1
- package/dist/twilight/{p-CgDN9ZEV.system.js.map → p-CK7f65RE.system.js.map} +1 -1
- package/dist/twilight/{p-B0xoNOFR.system.js → p-CQDiSGcm.system.js} +3 -3
- package/dist/twilight/p-CQDiSGcm.system.js.map +1 -0
- package/dist/twilight/{p-CVW8a0jw.system.js.map → p-Crz5Om7F.system.js.map} +1 -1
- package/dist/twilight/p-D6vllM1-.system.js.map +1 -0
- package/dist/twilight/{p-O_6m6zp3.system.js.map → p-DHIqW0kb.system.js.map} +1 -1
- package/dist/twilight/{p-DxRZfb-O.system.js → p-DHVFvgH-.system.js} +2 -2
- package/dist/twilight/{p-DxRZfb-O.system.js.map → p-DHVFvgH-.system.js.map} +1 -1
- package/dist/twilight/{p-DvrwOwqK.system.js.map → p-DNXP15r0.system.js.map} +1 -1
- package/dist/twilight/{p-Bqv1miCk.system.js.map → p-DNsqaxY7.system.js.map} +1 -1
- package/dist/twilight/{p-BxORDCZ3.system.js.map → p-DTx9WCBY.system.js.map} +1 -1
- package/dist/twilight/{p-TrPvZWq-.system.js.map → p-DVKxP5is.system.js.map} +1 -1
- package/dist/twilight/p-DVpqfl3D.system.js.map +1 -0
- package/dist/twilight/{p-BXoB3JpD.system.js.map → p-DZTRKwds.system.js.map} +1 -1
- package/dist/twilight/{p-CaCB348j.system.js.map → p-DZajWqW2.system.js.map} +1 -1
- package/dist/twilight/{p-BbDuw4AO.system.js.map → p-Da2A-hsX.system.js.map} +1 -1
- package/dist/twilight/{p-CNqFfslE.system.js.map → p-DgVuWfs6.system.js.map} +1 -1
- package/dist/twilight/p-Dhlfiere.system.js +5 -0
- package/dist/twilight/{p-DMKkUrkS.system.js.map → p-Dhlfiere.system.js.map} +1 -1
- package/dist/twilight/{p-DVnmchft.system.js.map → p-DkCrulih.system.js.map} +1 -1
- package/dist/twilight/{p-CB3G0Z8y.system.js.map → p-Du8MMxWf.system.js.map} +1 -1
- package/dist/twilight/{p-u0que_SA.system.js.map → p-DvSX1guT.system.js.map} +1 -1
- package/dist/twilight/{p-D4D34Ujk.js → p-Hw2jlaNN.js} +3 -3
- package/dist/twilight/p-Hw2jlaNN.js.map +1 -0
- package/dist/twilight/{p-C-vbYsMC.system.js.map → p-N45BdAU8.system.js.map} +1 -1
- package/dist/twilight/{p-DNiQ_YXx.js → p-NSLkL4Dn.js} +2 -2
- package/dist/twilight/{p-DNiQ_YXx.js.map → p-NSLkL4Dn.js.map} +1 -1
- package/dist/twilight/{p-OzJ9XEsV.system.js.map → p-QNwQUqLM.system.js.map} +1 -1
- package/dist/twilight/{p-DlRNuq8n.system.js.map → p-XDYW48AK.system.js.map} +1 -1
- package/dist/twilight/{p-1055f2fb.entry.js → p-a8cf78c0.entry.js} +2 -2
- package/dist/twilight/p-a9c9a4ac.entry.js +5 -0
- package/dist/twilight/p-a9c9a4ac.entry.js.map +1 -0
- package/dist/twilight/{p-669db4df.entry.js → p-b13ef44c.entry.js} +2 -2
- package/dist/twilight/{p-d15630dd.entry.js → p-b492c336.entry.js} +2 -2
- package/dist/twilight/{p-f745fcad.entry.js → p-b51bb42b.entry.js} +2 -2
- package/dist/twilight/{p-3eaddcf1.entry.js → p-bb1a0f6b.entry.js} +2 -2
- package/dist/twilight/{p-5542a867.entry.js → p-bca6b6b2.entry.js} +2 -2
- package/dist/twilight/{p-fbe10567.entry.js → p-bdca9c9c.entry.js} +2 -2
- package/dist/twilight/p-be2938da.entry.js +5 -0
- package/dist/twilight/{p-58085711.entry.js → p-c5b5a947.entry.js} +2 -2
- package/dist/twilight/{p-BJUBMQeL.system.js.map → p-cK_8A-PC.system.js.map} +1 -1
- package/dist/twilight/{p-CiGTTlgd.system.js.map → p-cR7gWxFU.system.js.map} +1 -1
- package/dist/twilight/p-d314110a.system.entry.js +5 -0
- package/dist/twilight/p-d314110a.system.entry.js.map +1 -0
- package/dist/twilight/{p-13324cdd.system.entry.js → p-d33197dc.system.entry.js} +3 -3
- package/dist/twilight/{p-e9bc1fa4.system.entry.js → p-d3c9cfbb.system.entry.js} +2 -2
- package/dist/twilight/{p-e823d4e8.system.entry.js → p-d4017888.system.entry.js} +2 -2
- package/dist/twilight/{p-442340d3.system.entry.js → p-d43b5d6a.system.entry.js} +2 -2
- package/dist/twilight/{p-2ae75a1c.entry.js → p-d7604122.entry.js} +2 -2
- package/dist/twilight/{p-ebd4ac51.system.entry.js → p-d8039b97.system.entry.js} +2 -2
- package/dist/twilight/{p-423d91f5.system.entry.js → p-db9674c2.system.entry.js} +2 -2
- package/dist/twilight/{p-a1d102d3.system.entry.js → p-eb292930.system.entry.js} +2 -2
- package/dist/twilight/{p-60bf8746.system.entry.js → p-ec034bd2.system.entry.js} +2 -2
- package/dist/twilight/{p-ab7cc63a.system.entry.js → p-f07ad750.system.entry.js} +2 -2
- package/dist/twilight/{p-06b95a05.system.entry.js → p-f0b1ceef.system.entry.js} +2 -2
- package/dist/twilight/p-f5aefbca.system.entry.js +5 -0
- package/dist/twilight/{p-17c50686.entry.js → p-fb399776.entry.js} +2 -2
- package/dist/twilight/{p-e784d087.entry.js → p-fe81524d.entry.js} +2 -2
- package/dist/twilight/p-fed7a7a5.system.entry.js +5 -0
- package/dist/twilight/{p-C9DFiJHW.system.js.map → p-jx7CG3rj.system.js.map} +1 -1
- package/dist/twilight/{p-ofxyuLsh.system.js.map → p-lRCsnz7i.system.js.map} +1 -1
- package/dist/twilight/p-oqUqe5ch.system.js.map +1 -0
- package/dist/twilight/{p-Cs3Irr4v.system.js.map → p-xRJ6wvh1.system.js.map} +1 -1
- package/dist/twilight/salla-accordion.salla-accordion-body.salla-accordion-head.salla-order-details-options.entry.esm.js.map +1 -0
- package/dist/twilight/salla-order-details-multiple-bundle-product.entry.esm.js.map +1 -0
- package/dist/twilight/salla-order-details.entry.esm.js.map +1 -0
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/twilight/twilight.js +1 -1
- package/dist/types/components/salla-accordion/salla-accordion.d.ts +2 -0
- package/dist/types/components/salla-order-details/interfaces.d.ts +55 -0
- package/dist/types/components/salla-order-details/salla-order-details-multiple-bundle-product.d.ts +22 -0
- package/dist/types/components/salla-order-details/salla-order-details-options.d.ts +23 -0
- package/dist/types/components/salla-order-details/salla-order-details.d.ts +14 -0
- package/dist/types/components.d.ts +173 -0
- package/package.json +5 -5
- package/dist/cjs/index-DtXwvL5X.js.map +0 -1
- package/dist/cjs/salla-accordion-body.cjs.entry.js +0 -23
- package/dist/cjs/salla-accordion-body.cjs.entry.js.map +0 -1
- package/dist/cjs/salla-accordion-body.entry.cjs.js.map +0 -1
- package/dist/cjs/salla-accordion-head.cjs.entry.js +0 -52
- package/dist/cjs/salla-accordion-head.cjs.entry.js.map +0 -1
- package/dist/cjs/salla-accordion-head.entry.cjs.js.map +0 -1
- package/dist/cjs/salla-accordion.cjs.entry.js +0 -51
- package/dist/cjs/salla-accordion.cjs.entry.js.map +0 -1
- package/dist/cjs/salla-accordion.entry.cjs.js.map +0 -1
- package/dist/esm/index-D4D34Ujk.js.map +0 -1
- package/dist/esm/salla-accordion-body.entry.js +0 -21
- package/dist/esm/salla-accordion-body.entry.js.map +0 -1
- package/dist/esm/salla-accordion-head.entry.js +0 -50
- package/dist/esm/salla-accordion-head.entry.js.map +0 -1
- package/dist/esm/salla-accordion.entry.js +0 -49
- package/dist/esm/salla-accordion.entry.js.map +0 -1
- package/dist/esm-es5/index-D4D34Ujk.js.map +0 -1
- package/dist/esm-es5/salla-accordion-body.entry.js +0 -5
- package/dist/esm-es5/salla-accordion-body.entry.js.map +0 -1
- package/dist/esm-es5/salla-accordion-head.entry.js +0 -5
- package/dist/esm-es5/salla-accordion-head.entry.js.map +0 -1
- package/dist/esm-es5/salla-accordion.entry.js +0 -5
- package/dist/esm-es5/salla-accordion.entry.js.map +0 -1
- package/dist/twilight/p-154fc672.entry.js +0 -5
- package/dist/twilight/p-154fc672.entry.js.map +0 -1
- package/dist/twilight/p-17ee3d18.entry.js +0 -5
- package/dist/twilight/p-40e20722.system.entry.js +0 -5
- package/dist/twilight/p-40e20722.system.entry.js.map +0 -1
- package/dist/twilight/p-4d6baea7.system.entry.js +0 -5
- package/dist/twilight/p-4d6baea7.system.entry.js.map +0 -1
- package/dist/twilight/p-553bc6b4.system.entry.js +0 -5
- package/dist/twilight/p-63a5bdc6.entry.js +0 -5
- package/dist/twilight/p-63a5bdc6.entry.js.map +0 -1
- package/dist/twilight/p-7eff7dc5.system.entry.js +0 -5
- package/dist/twilight/p-B0xoNOFR.system.js.map +0 -1
- package/dist/twilight/p-BN8tVPbo.system.js.map +0 -1
- package/dist/twilight/p-Cc6e2YrQ.system.js.map +0 -1
- package/dist/twilight/p-D4D34Ujk.js.map +0 -1
- package/dist/twilight/p-DMKkUrkS.system.js +0 -5
- package/dist/twilight/p-Daef3WlT.system.js.map +0 -1
- package/dist/twilight/p-c0363ba7.entry.js +0 -5
- package/dist/twilight/p-c0363ba7.entry.js.map +0 -1
- package/dist/twilight/p-e2ab2b64.system.entry.js +0 -5
- package/dist/twilight/p-e2ab2b64.system.entry.js.map +0 -1
- package/dist/twilight/p-ef38f4ac.system.entry.js +0 -5
- package/dist/twilight/p-fcc64f6d.entry.js +0 -5
- package/dist/twilight/salla-accordion-body.entry.esm.js.map +0 -1
- package/dist/twilight/salla-accordion-head.entry.esm.js.map +0 -1
- package/dist/twilight/salla-accordion.entry.esm.js.map +0 -1
- /package/dist/twilight/{p-d513da6f.entry.js.map → p-0065a55b.entry.js.map} +0 -0
- /package/dist/twilight/{p-c9678188.system.entry.js.map → p-05cf8f0f.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-8213a9ef.system.entry.js.map → p-066a5e95.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-81aeef6a.entry.js.map → p-0a58ecb2.entry.js.map} +0 -0
- /package/dist/twilight/{p-5b882c52.system.entry.js.map → p-0ab8c50f.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-d84eb47c.entry.js.map → p-13efdbe3.entry.js.map} +0 -0
- /package/dist/twilight/{p-4af5ffea.entry.js.map → p-13f1a287.entry.js.map} +0 -0
- /package/dist/twilight/{p-6e24a5f0.system.entry.js.map → p-15c42251.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-8c0822f7.system.entry.js.map → p-17567b38.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-648fb6ca.entry.js.map → p-204e0ad2.entry.js.map} +0 -0
- /package/dist/twilight/{p-63cba8e3.entry.js.map → p-210ccdae.entry.js.map} +0 -0
- /package/dist/twilight/{p-d0004953.entry.js.map → p-240b86ef.entry.js.map} +0 -0
- /package/dist/twilight/{p-dd83a408.entry.js.map → p-27206d63.entry.js.map} +0 -0
- /package/dist/twilight/{p-c84819d5.entry.js.map → p-35dd7512.entry.js.map} +0 -0
- /package/dist/twilight/{p-2af0da5a.system.entry.js.map → p-38675c42.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-7234c5f2.system.entry.js.map → p-3cdd4d44.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-8359eb2a.entry.js.map → p-3e9ceed0.entry.js.map} +0 -0
- /package/dist/twilight/{p-a18f81a8.system.entry.js.map → p-447f03b5.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-2ecf868e.entry.js.map → p-4b7e613a.entry.js.map} +0 -0
- /package/dist/twilight/{p-d5750810.entry.js.map → p-4d5387e9.entry.js.map} +0 -0
- /package/dist/twilight/{p-ad0fedcd.system.entry.js.map → p-53fb14d0.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-553bc6b4.system.entry.js.map → p-5db51240.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-aad20f10.system.entry.js.map → p-61f590ca.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-407d19d8.system.entry.js.map → p-6a51cb91.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-95adf84e.entry.js.map → p-6abfa7ed.entry.js.map} +0 -0
- /package/dist/twilight/{p-45b61475.entry.js.map → p-6f66faea.entry.js.map} +0 -0
- /package/dist/twilight/{p-f57bcc51.entry.js.map → p-7187b729.entry.js.map} +0 -0
- /package/dist/twilight/{p-c87d6aa6.system.entry.js.map → p-765562b8.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-6a0b5799.entry.js.map → p-78deca48.entry.js.map} +0 -0
- /package/dist/twilight/{p-3483eb09.system.entry.js.map → p-7dce6627.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-396198a2.entry.js.map → p-83f6408a.entry.js.map} +0 -0
- /package/dist/twilight/{p-d097a67d.system.entry.js.map → p-888de4b8.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-1b24ea99.system.entry.js.map → p-8e807035.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-6b716e82.system.entry.js.map → p-8fcff962.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-17ee3d18.entry.js.map → p-9a8a57f0.entry.js.map} +0 -0
- /package/dist/twilight/{p-1a9eebb6.system.entry.js.map → p-9cb1a11d.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-1055f2fb.entry.js.map → p-a8cf78c0.entry.js.map} +0 -0
- /package/dist/twilight/{p-669db4df.entry.js.map → p-b13ef44c.entry.js.map} +0 -0
- /package/dist/twilight/{p-d15630dd.entry.js.map → p-b492c336.entry.js.map} +0 -0
- /package/dist/twilight/{p-f745fcad.entry.js.map → p-b51bb42b.entry.js.map} +0 -0
- /package/dist/twilight/{p-3eaddcf1.entry.js.map → p-bb1a0f6b.entry.js.map} +0 -0
- /package/dist/twilight/{p-5542a867.entry.js.map → p-bca6b6b2.entry.js.map} +0 -0
- /package/dist/twilight/{p-fbe10567.entry.js.map → p-bdca9c9c.entry.js.map} +0 -0
- /package/dist/twilight/{p-fcc64f6d.entry.js.map → p-be2938da.entry.js.map} +0 -0
- /package/dist/twilight/{p-58085711.entry.js.map → p-c5b5a947.entry.js.map} +0 -0
- /package/dist/twilight/{p-13324cdd.system.entry.js.map → p-d33197dc.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-e9bc1fa4.system.entry.js.map → p-d3c9cfbb.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-e823d4e8.system.entry.js.map → p-d4017888.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-442340d3.system.entry.js.map → p-d43b5d6a.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-2ae75a1c.entry.js.map → p-d7604122.entry.js.map} +0 -0
- /package/dist/twilight/{p-ebd4ac51.system.entry.js.map → p-d8039b97.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-423d91f5.system.entry.js.map → p-db9674c2.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-a1d102d3.system.entry.js.map → p-eb292930.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-60bf8746.system.entry.js.map → p-ec034bd2.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-ab7cc63a.system.entry.js.map → p-f07ad750.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-06b95a05.system.entry.js.map → p-f0b1ceef.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-ef38f4ac.system.entry.js.map → p-f5aefbca.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-17c50686.entry.js.map → p-fb399776.entry.js.map} +0 -0
- /package/dist/twilight/{p-e784d087.entry.js.map → p-fe81524d.entry.js.map} +0 -0
- /package/dist/twilight/{p-7eff7dc5.system.entry.js.map → p-fed7a7a5.system.entry.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(t,n,i,e){function r(t){return t instanceof i?t:new i((function(n){n(t)}))}return new(i||(i=Promise))((function(i,o){function a(t){try{
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(t,n,i,e){function r(t){return t instanceof i?t:new i((function(n){n(t)}))}return new(i||(i=Promise))((function(i,o){function a(t){try{l(e.next(t))}catch(t){o(t)}}function s(t){try{l(e["throw"](t))}catch(t){o(t)}}function l(t){t.done?i(t.value):r(t.value).then(a,s)}l((e=e.apply(t,n||[])).next())}))};var __generator=this&&this.__generator||function(t,n){var i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},e,r,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(t){return function(n){return l([t,n])}}function l(s){if(e)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(i=0)),i)try{if(e=1,r&&(o=s[0]&2?r["return"]:s[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;if(r=0,o)s=[s[0]&2,o.value];switch(s[0]){case 0:case 1:o=s;break;case 4:i.label++;return{value:s[1],done:false};case 5:i.label++;r=s[1];s=[0];continue;case 7:s=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){i=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(s[0]===6&&i.label<o[1]){i.label=o[1];o=s;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(s);break}if(o[2])i.ops.pop();i.trys.pop();continue}s=n.call(t,i)}catch(t){s=[6,t];r=0}finally{e=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};
|
|
2
2
|
/*!
|
|
3
3
|
* Crafted with ❤ by Salla
|
|
4
|
-
*/import{r as registerInstance,h,g as getElement}from"./index-
|
|
4
|
+
*/import{r as registerInstance,h,g as getElement}from"./index-Hw2jlaNN.js";import{H as Helper}from"./Helper-DGKT_pIJ.js";import"./anime.es-CgtvEd63.js";var sallaNotificationsCss="";var SallaNotifications=function(){function t(t){var n=this;registerInstance(this,t);this.itemPerPage=10;this.no_notifications_trans=salla.lang.get("blocks.header.no_notifications");this.load_more_text_trans=salla.lang.get("common.elements.load_more");salla.lang.onLoaded((function(){n.no_notifications_trans=salla.lang.get("blocks.header.no_notifications");n.load_more_text_trans=salla.lang.get("common.elements.load_more")}))}t.prototype.loading=function(t){if(t===void 0){t=true}var n;var i=(n=this.status)===null||n===void 0?void 0:n.querySelector(".s-button-text");if(i){Helper.toggleElementClassIf(i,"s-button-hide","s-button-show",(function(){return t}));this.btnLoader.style.display=t?"inherit":"none"}};t.prototype.getNotificationCard=function(t){var n=document.createElement("salla-notification-item");n.notification=t;n.classList.add("s-block");return n};t.prototype.render=function(){var t=this;var n;if(this.showPlaceholder){return h("div",{class:"s-notifications-no-content"},h("salla-placeholder",{alignment:"center"},h("span",{slot:"title"},this.no_notifications_trans)))}return h("div",{class:"s-notifications-wrapper"},h("div",{class:"s-notifications-container",ref:function(n){return t.wrapper=n}}),this.nextPage&&h("div",{class:"s-infinite-scroll-wrapper",ref:function(n){return t.status=n}},h("button",{onClick:function(){return t.loadMore()},class:"s-infinite-scroll-btn s-button-btn s-button-primary"},h("span",{class:"s-button-text s-infinite-scroll-btn-text"},(n=this.loadMoreText)!==null&&n!==void 0?n:this.load_more_text_trans),h("span",{class:"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader",ref:function(n){return t.btnLoader=n},style:{display:"none"}}))))};t.prototype.handleResponse=function(t){var n=this;return t.map((function(t){return n.getNotificationCard(t)}))};t.prototype.initiateInfiniteScroll=function(){var t=this;var n,i,e;if(!this.wrapper){salla.logger.error("Wrapper is undefined. Cannot initiate infinite scroll.");return}this.infiniteScroll=salla.infiniteScroll.initiate(this.wrapper,this.wrapper,{path:function(){return t.nextPage},history:true,nextPage:this.nextPage,scrollThreshold:false},true);(n=this.infiniteScroll)===null||n===void 0?void 0:n.on("request",(function(n){t.loading()}));(i=this.infiniteScroll)===null||i===void 0?void 0:i.on("load",(function(n){var i;t.loading(false);t.pagination=n.pagination;t.nextPage=((i=n.pagination.links)===null||i===void 0?void 0:i.next)||null;t.handleResponse(n.data).forEach((function(n){return t.wrapper.append(n)}));var e=t.host.querySelectorAll("salla-notification-item:not(.animated)");Helper.animateItems(e)}));(e=this.infiniteScroll)===null||e===void 0?void 0:e.on("error",(function(t){salla.logger.error("Error loading more comments:",t)}))};t.prototype.loadInitialData=function(){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(n){switch(n.label){case 0:return[4,salla.api.notifications.fetch({per_page:this.itemPerPage}).then((function(n){var i;t.pagination=n.pagination;t.total=n.pagination.total;t.nextPage=((i=n.pagination.links)===null||i===void 0?void 0:i.next)||null;setTimeout((function(){if(!n.data.length){return t.showPlaceholder=true}t.handleResponse(n.data).forEach((function(n){return t.wrapper.append(n)}));t.initiateInfiniteScroll();var i=t.wrapper.querySelectorAll("salla-notification-item:not(.animated)");Helper.animateItems(i)}),100)})).catch((function(n){salla.logger.error(n);t.showPlaceholder=true;t.loading(false)}))];case 1:n.sent();return[2]}}))}))};t.prototype.loadMore=function(){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(n){(t=this.infiniteScroll)===null||t===void 0?void 0:t.loadNextPage();return[2]}))}))};t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,this.loadInitialData()];case 1:t.sent();return[2]}}))}))};Object.defineProperty(t.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();SallaNotifications.style=sallaNotificationsCss;export{SallaNotifications as salla_notifications};
|
|
5
5
|
//# sourceMappingURL=salla-notifications.entry.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var __awaiter=this&&this.__awaiter||function(e,r,t,s){function n(e){return e instanceof t?e:new t((function(r){r(e)}))}return new(t||(t=Promise))((function(t,a){function i(e){try{f(s.next(e))}catch(e){a(e)}}function o(e){try{f(s["throw"](e))}catch(e){a(e)}}function f(e){e.done?t(e.value):n(e.value).then(i,o)}f((s=s.apply(e,r||[])).next())}))};var __generator=this&&this.__generator||function(e,r){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},s,n,a,i;return i={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function o(e){return function(r){return f([e,r])}}function f(o){if(s)throw new TypeError("Generator is already executing.");while(i&&(i=0,o[0]&&(t=0)),t)try{if(s=1,n&&(a=o[0]&2?n["return"]:o[0]?n["throw"]||((a=n["return"])&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;if(n=0,a)o=[o[0]&2,a.value];switch(o[0]){case 0:case 1:a=o;break;case 4:t.label++;return{value:o[1],done:false};case 5:t.label++;n=o[1];o=[0];continue;case 7:o=t.ops.pop();t.trys.pop();continue;default:if(!(a=t.trys,a=a.length>0&&a[a.length-1])&&(o[0]===6||o[0]===2)){t=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){t.label=o[1];break}if(o[0]===6&&t.label<a[1]){t.label=a[1];a=o;break}if(a&&t.label<a[2]){t.label=a[2];t.ops.push(o);break}if(a[2])t.ops.pop();t.trys.pop();continue}o=r.call(e,t)}catch(e){o=[6,e];n=0}finally{s=a=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}};
|
|
2
2
|
/*!
|
|
3
3
|
* Crafted with ❤ by Salla
|
|
4
|
-
*/import{r as registerInstance,h,g as getElement}from"./index-D4D34Ujk.js";var PageType;(function(e){e["ProductDetail"]="product.single";e["Cart"]="cart"})(PageType||(PageType={}));var OfferType;(function(e){e["Conditional"]="conditional";e["PercentageOrFixed"]="fixed";e["DiscountsTable"]="discounts_table";e["Bank"]="bank";e["BuyXGetY"]="buy_x_get_y";e["SpecialPrice"]="special_price"})(OfferType||(OfferType={}));var sallaOfferCss='.s-offer-wrapper .s-slider-block__title h2{font-size:1.125rem;line-height:1.75rem;color:#f87171}.s-offer-wrapper .s-slider-block__title h2::before{font-family:"sallaicons";content:"\\ee30" !important;position:absolute;top:1rem;font-size:3rem;font-weight:400;line-height:1;color:#fef2f2}.s-offer-bank-wrapper-sinlge-item{display:-ms-flexbox;display:flex;-ms-flex-align:center !important;align-items:center !important;gap:14px}.s-offer-bank-wrapper{display:-ms-flexbox !important;display:flex !important;width:100% !important}';var SallaOffer=function(){function e(e){var r=this;registerInstance(this,e);var t;this.productCardComponent="custom-salla-product-card";this.offersList=[];this.isMultipleBank=false;this.isBankOffer=false;this.canRender=false;this.showOffer=salla.config.get("store.settings.product.show_special_offers");this.offer_with_price_text=salla.lang.get("pages.offer.with_price",{price:""});this.with_discount_text=salla.lang.get("pages.products.with_a_discount");this.product_discount_text=salla.lang.get("pages.products.discount");this.special_offer_text=salla.lang.get("pages.products.special_offer");this.multipleBankOfferTitleText=salla.lang.get("pages.offer.multiple_bank_offers_title");this.multipleBankOfferTitleDescription=salla.lang.get("pages.offer.multiple_bank_offers_message");this.buy_quantity_text=function(e){return salla.lang.get("pages.offer.buy_quantity",{quantity:e})};salla.lang.onLoaded((function(){r.offer_with_price_text=salla.lang.get("pages.offer.with_price");r.with_discount_text=salla.lang.get("pages.products.with_a_discount");r.product_discount_text=salla.lang.get("pages.products.discount");r.special_offer_text=salla.lang.get("pages.products.special_offer");r.multipleBankOfferTitleText=salla.lang.get("pages.offer.multiple_bank_offers_title");r.multipleBankOfferTitleDescription=salla.lang.get("pages.offer.multiple_bank_offers_message");r.buy_quantity_text(0)}));salla.onReady((function(){r.currentPage=salla.config.get("page.slug");r.userCurrency=salla.config.get("currencies")[salla.config.get("user.currency_code")].symbol}));this.categorySlot=((t=this.host.querySelector('[slot="category"]'))===null||t===void 0?void 0:t.innerHTML)||'<a href={url} class="s-offer-slide-cat-entry"><i class={icon}></i><h4>{name}</h4></a>'}e.prototype.getEndpointByPageName=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(r){switch(r.label){case 0:if(!(this.currentPage==PageType.Cart))return[3,2];return[4,Salla.cart.getCurrentCartId()];case 1:e=r.sent();return[2,"offers/cart/".concat(e)];case 2:if(this.currentPage==PageType.ProductDetail){return[2,"offers/product/".concat(salla.config.get("page.id"))]}return[2,"offers"]}}))}))};e.prototype.emitPromotionViewed=function(){if(!(this.offersList.length&&this.canRender&&this.showOffer))return;var e={id:this.offersList[0].id,name:this.offersList[0].title,creative:this.offersList[0].description||"",position:1};salla.event.emit("promotion::viewed",[e])};e.prototype.emitPromotionClicked=function(e){if(e===void 0){e=1}if(!(this.offersList.length&&this.canRender&&this.showOffer))return;var r={id:this.offersList[0].id,name:this.offersList[0].title,creative:this.offersList[0].description||"",position:e};salla.event.emit("promotion::clicked",[r])};e.prototype.componentWillLoad=function(){var e=this;this.hasCustomComponent=!!customElements.get(this.productCardComponent);return new Promise((function(e){return salla.onReady(e)})).then((function(){e.showOffer=!salla.url.is_page("product.single")||salla.config.get("store.settings.product.show_special_offers");if(e.showOffer){return}throw new Error("Merchant disabled showing the offers on product page")})).then((function(){return __awaiter(e,void 0,void 0,(function(){var e,r;return __generator(this,(function(t){switch(t.label){case 0:r=(e=salla.api).request;return[4,this.getEndpointByPageName()];case 1:return[2,r.apply(e,[t.sent()])]}}))}))})).then((function(r){if(!(e.offersList=r.data).length){throw new Error("salla-offers:: There is no offers!")}var t=e.offersList.find((function(e){return[OfferType.SpecialPrice,OfferType.Bank,OfferType.BuyXGetY,OfferType.DiscountsTable].includes(e.type)}));if(!t){throw new Error("salla-offers:: Offer type not supported yet!")}if(t.type===OfferType.DiscountsTable){return e.offersList=[t]}if(e.isBankOffer=t.type===OfferType.Bank){e.offersList=e.offersList.filter((function(e){return e.type===OfferType.Bank}));e.isMultipleBank=e.offersList.length>1;return e.offersList}if(t.type===OfferType.SpecialPrice){var s=t.details;return s.apply_to==="product"?salla.product.api.fetch({source:"selected",source_value:s.targets}).then((function(r){t.details.products=r.data;return e.offersList=[t]})):salla.product.api.categories().then((function(r){var n=e.findCategories(r.data,s.targets);t.details.categories=n;return e.offersList=[t]}))}var n=t.details.get;return n.source==="products"?salla.product.api.fetch({source:"selected",source_value:n.source_value}).then((function(r){n.products=r.data;t.details.get=n;return e.offersList=[t]})):salla.product.api.categories().then((function(r){n.categories=e.findCategories(r.data,n.source_value);t.details.get=n;return e.offersList=[t]}))})).then((function(r){salla.storage.set(e.getStorageKey(),{offers:r,stored_at:(new Date).getTime()});e.canRender=true})).catch((function(e){salla.logger.warn(e)}))};e.prototype.componentDidLoad=function(){var e=this.host.querySelector(".s-slider-block__title-nav");e===null||e===void 0?void 0:e.classList.add("s-offer-bank-payment-nav");this.emitPromotionViewed()};e.prototype.findCategories=function(e,r){var t;var s=[];for(var n=0,a=e;n<a.length;n++){var i=a[n];if(r.includes(i.id_||i.id)){s.push(i)}if(((t=i.sub_categories)===null||t===void 0?void 0:t.length)>0){s=s.concat(this.findCategories(i.sub_categories,r))}}return s};e.prototype.getStorageKey=function(){try{var e=salla.config.get("page.slug").replace(".","_");var r=salla.lang.getLocale();var t=salla.config.currency().code;if(!e||!r||!t){throw new Error("Unable to get the storage key.")}return"s-offers-".concat(e,"-").concat(salla.config.get("page.id"),"-").concat(r,"-").concat(t)}catch(e){return""}};e.prototype.getOffersFromStorage=function(){var e=salla.storage.get(this.getStorageKey());if(!e||e.stored_at<(new Date).getTime()-10*60*1e3){salla.storage.remove(this.getStorageKey());return null}this.canRender=true;return Promise.resolve(e.offers)};e.prototype.render=function(){var e=this;if(!this.offersList.length||!this.canRender||!this.showOffer)return null;var r=this.offersList[0];var t=this.isBankOffer?this.isMultipleBank?this.multipleBankOfferTitleText:null:r.title;var s=this.isBankOffer?this.isMultipleBank?this.multipleBankOfferTitleDescription:null:r.description;var n={"block-title":t,"block-subTitle":s,"show-controls":this.isMultipleBank};return h("div",{class:"s-offer-wrapper",onClick:function(){return e.emitPromotionClicked()}},h("p",{class:"s-offer-corner-badge"},this.special_offer_text),h("salla-slider",Object.assign({type:"carousel",id:"offer-slider"},n),h("div",{slot:"items"},this.renderSectionForOfferType(r.type))))};e.prototype.renderSectionForOfferType=function(e){if(this.isBankOffer){return this.renderBankSection()}if(e==OfferType.SpecialPrice){return this.renderSpecialPriceSection()}if(e==OfferType.BuyXGetY){return this.renderBuyXGetYSection()}return this.renderDiscountTableSection()};e.prototype.getCategoriesSection=function(e){return h("div",{class:"s-offer-slide-one-sixth swiper-slide",innerHTML:this.categorySlot.replace(/\{url\}/g,e.url).replace(/\{icon\}/g,e.icon||"sicon-store").replace(/\{name\}/g,e.name)})};e.prototype.renderBuyXGetYSection=function(){var e=this;var r,t;var s=this.offersList[0].details;return[(r=s.get.products)===null||r===void 0?void 0:r.map((function(r){return h("div",{class:"s-offer-slide-one-fourth"},e.hasCustomComponent?h(e.productCardComponent,{product:r}):h("salla-product-card",{"shadow-on-hover":true,product:r}))})),(t=s.get.categories)===null||t===void 0?void 0:t.map((function(r){return e.getCategoriesSection(r)}))]};e.prototype.renderBankSection=function(){var e=this;return this.offersList.map((function(r){return h("div",{class:{"s-offer-slide-one-sixth":e.isMultipleBank,"s-offer-bank-wrapper-sinlge-item":!e.isMultipleBank}},h("div",{class:{"s-offer-bank-wrapper":true,"s-offer-slide-one-sixth":!e.isMultipleBank,"s-offer-bank-wrapper-multi-spacer":e.isMultipleBank}},h("div",{class:"s-offer-bank-logo"},h("img",{src:r.details.logo||salla.url.cdn("images/s-empty.png"),"data-src":r.details.logo,alt:r.title+" offer"})),h("ul",{class:"s-offer-bank-payment-wrapper"},r.details.payments.map((function(e){return h("li",{class:"s-offer-bank-payment-single"},h("img",{src:salla.url.cdn("images/payment/"+e+".png")||salla.url.cdn("images/s-empty.png"),"data-src":salla.url.cdn("images/payment/"+e+".png"),alt:"payment"}))}))),e.isMultipleBank?h("p",{class:"s-offer-bank-payment-discount-percent"},"".concat(e.product_discount_text," ").concat(r.details.discount_value).concat(r.details.discount_type==="percentage"&&"%")):""),!e.isMultipleBank?h("div",{class:"s-offer-bank-message s-offer-slide-one-fourth"},h("h2",null,e.offersList[0].title),h("p",{innerHTML:e.generateBankDescription(e.offersList[0].description,r.details.discount_value)})):"")}))};e.prototype.generateBankDescription=function(e,r){return e.replace(new RegExp("".concat(r," %")),'<span class="s-offer-bank-message-amount">'.concat(r," %</span>"))};e.prototype.renderDiscountTableSection=function(){var e=this;var r;var t=this.offersList[0];var s=t.details.show_price_after_discount;return(r=this.offersList[0].details.discounts)===null||r===void 0?void 0:r.map((function(r){return h("div",{class:"s-offer-slide-one-fourth"},h("div",{class:"s-offer-slide-offer-entry"},h("div",{class:"s-offer-slide-offer-entry-price-quantity-container"},h("p",{class:"s-offer-slide-offer-entry-quantity"},e.buy_quantity_text(r.quantity)),s?h("div",{class:"s-offer-slide-offer-entry-price"},h("span",null,e.offer_with_price_text),h("span",{class:"s-offer-slide-offer-entry-price-amount"},r.discounted_amount)," ",h("span",null,e.userCurrency)):""),h("p",{class:"s-offer-slide-offer-entry-price-amount-percent"},e.with_discount_text,"(",h("span",null,r.percentage,!!r.percentage&&"%"),")")))}))};e.prototype.renderSpecialPriceSection=function(){var e=this;var r,t;var s=this.offersList[0].details;return[s.apply_to==="product"&&((r=s.products)===null||r===void 0?void 0:r.map((function(r){return h("div",{class:"s-offer-slide-one-fourth"},e.hasCustomComponent?h(e.productCardComponent,{product:r}):h("salla-product-card",{"shadow-on-hover":true,product:r}))}))),s.apply_to==="category"&&((t=s.categories)===null||t===void 0?void 0:t.map((function(r){return e.getCategoriesSection(r)})))]};Object.defineProperty(e.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();SallaOffer.style=sallaOfferCss;export{SallaOffer as salla_offer};
|
|
4
|
+
*/import{r as registerInstance,h,g as getElement}from"./index-Hw2jlaNN.js";var PageType;(function(e){e["ProductDetail"]="product.single";e["Cart"]="cart"})(PageType||(PageType={}));var OfferType;(function(e){e["Conditional"]="conditional";e["PercentageOrFixed"]="fixed";e["DiscountsTable"]="discounts_table";e["Bank"]="bank";e["BuyXGetY"]="buy_x_get_y";e["SpecialPrice"]="special_price"})(OfferType||(OfferType={}));var sallaOfferCss='.s-offer-wrapper .s-slider-block__title h2{font-size:1.125rem;line-height:1.75rem;color:#f87171}.s-offer-wrapper .s-slider-block__title h2::before{font-family:"sallaicons";content:"\\ee30" !important;position:absolute;top:1rem;font-size:3rem;font-weight:400;line-height:1;color:#fef2f2}.s-offer-bank-wrapper-sinlge-item{display:-ms-flexbox;display:flex;-ms-flex-align:center !important;align-items:center !important;gap:14px}.s-offer-bank-wrapper{display:-ms-flexbox !important;display:flex !important;width:100% !important}';var SallaOffer=function(){function e(e){var r=this;registerInstance(this,e);var t;this.productCardComponent="custom-salla-product-card";this.offersList=[];this.isMultipleBank=false;this.isBankOffer=false;this.canRender=false;this.showOffer=salla.config.get("store.settings.product.show_special_offers");this.offer_with_price_text=salla.lang.get("pages.offer.with_price",{price:""});this.with_discount_text=salla.lang.get("pages.products.with_a_discount");this.product_discount_text=salla.lang.get("pages.products.discount");this.special_offer_text=salla.lang.get("pages.products.special_offer");this.multipleBankOfferTitleText=salla.lang.get("pages.offer.multiple_bank_offers_title");this.multipleBankOfferTitleDescription=salla.lang.get("pages.offer.multiple_bank_offers_message");this.buy_quantity_text=function(e){return salla.lang.get("pages.offer.buy_quantity",{quantity:e})};salla.lang.onLoaded((function(){r.offer_with_price_text=salla.lang.get("pages.offer.with_price");r.with_discount_text=salla.lang.get("pages.products.with_a_discount");r.product_discount_text=salla.lang.get("pages.products.discount");r.special_offer_text=salla.lang.get("pages.products.special_offer");r.multipleBankOfferTitleText=salla.lang.get("pages.offer.multiple_bank_offers_title");r.multipleBankOfferTitleDescription=salla.lang.get("pages.offer.multiple_bank_offers_message");r.buy_quantity_text(0)}));salla.onReady((function(){r.currentPage=salla.config.get("page.slug");r.userCurrency=salla.config.get("currencies")[salla.config.get("user.currency_code")].symbol}));this.categorySlot=((t=this.host.querySelector('[slot="category"]'))===null||t===void 0?void 0:t.innerHTML)||'<a href={url} class="s-offer-slide-cat-entry"><i class={icon}></i><h4>{name}</h4></a>'}e.prototype.getEndpointByPageName=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(r){switch(r.label){case 0:if(!(this.currentPage==PageType.Cart))return[3,2];return[4,Salla.cart.getCurrentCartId()];case 1:e=r.sent();return[2,"offers/cart/".concat(e)];case 2:if(this.currentPage==PageType.ProductDetail){return[2,"offers/product/".concat(salla.config.get("page.id"))]}return[2,"offers"]}}))}))};e.prototype.emitPromotionViewed=function(){if(!(this.offersList.length&&this.canRender&&this.showOffer))return;var e={id:this.offersList[0].id,name:this.offersList[0].title,creative:this.offersList[0].description||"",position:1};salla.event.emit("promotion::viewed",[e])};e.prototype.emitPromotionClicked=function(e){if(e===void 0){e=1}if(!(this.offersList.length&&this.canRender&&this.showOffer))return;var r={id:this.offersList[0].id,name:this.offersList[0].title,creative:this.offersList[0].description||"",position:e};salla.event.emit("promotion::clicked",[r])};e.prototype.componentWillLoad=function(){var e=this;this.hasCustomComponent=!!customElements.get(this.productCardComponent);return new Promise((function(e){return salla.onReady(e)})).then((function(){e.showOffer=!salla.url.is_page("product.single")||salla.config.get("store.settings.product.show_special_offers");if(e.showOffer){return}throw new Error("Merchant disabled showing the offers on product page")})).then((function(){return __awaiter(e,void 0,void 0,(function(){var e,r;return __generator(this,(function(t){switch(t.label){case 0:r=(e=salla.api).request;return[4,this.getEndpointByPageName()];case 1:return[2,r.apply(e,[t.sent()])]}}))}))})).then((function(r){if(!(e.offersList=r.data).length){throw new Error("salla-offers:: There is no offers!")}var t=e.offersList.find((function(e){return[OfferType.SpecialPrice,OfferType.Bank,OfferType.BuyXGetY,OfferType.DiscountsTable].includes(e.type)}));if(!t){throw new Error("salla-offers:: Offer type not supported yet!")}if(t.type===OfferType.DiscountsTable){return e.offersList=[t]}if(e.isBankOffer=t.type===OfferType.Bank){e.offersList=e.offersList.filter((function(e){return e.type===OfferType.Bank}));e.isMultipleBank=e.offersList.length>1;return e.offersList}if(t.type===OfferType.SpecialPrice){var s=t.details;return s.apply_to==="product"?salla.product.api.fetch({source:"selected",source_value:s.targets}).then((function(r){t.details.products=r.data;return e.offersList=[t]})):salla.product.api.categories().then((function(r){var n=e.findCategories(r.data,s.targets);t.details.categories=n;return e.offersList=[t]}))}var n=t.details.get;return n.source==="products"?salla.product.api.fetch({source:"selected",source_value:n.source_value}).then((function(r){n.products=r.data;t.details.get=n;return e.offersList=[t]})):salla.product.api.categories().then((function(r){n.categories=e.findCategories(r.data,n.source_value);t.details.get=n;return e.offersList=[t]}))})).then((function(r){salla.storage.set(e.getStorageKey(),{offers:r,stored_at:(new Date).getTime()});e.canRender=true})).catch((function(e){salla.logger.warn(e)}))};e.prototype.componentDidLoad=function(){var e=this.host.querySelector(".s-slider-block__title-nav");e===null||e===void 0?void 0:e.classList.add("s-offer-bank-payment-nav");this.emitPromotionViewed()};e.prototype.findCategories=function(e,r){var t;var s=[];for(var n=0,a=e;n<a.length;n++){var i=a[n];if(r.includes(i.id_||i.id)){s.push(i)}if(((t=i.sub_categories)===null||t===void 0?void 0:t.length)>0){s=s.concat(this.findCategories(i.sub_categories,r))}}return s};e.prototype.getStorageKey=function(){try{var e=salla.config.get("page.slug").replace(".","_");var r=salla.lang.getLocale();var t=salla.config.currency().code;if(!e||!r||!t){throw new Error("Unable to get the storage key.")}return"s-offers-".concat(e,"-").concat(salla.config.get("page.id"),"-").concat(r,"-").concat(t)}catch(e){return""}};e.prototype.getOffersFromStorage=function(){var e=salla.storage.get(this.getStorageKey());if(!e||e.stored_at<(new Date).getTime()-10*60*1e3){salla.storage.remove(this.getStorageKey());return null}this.canRender=true;return Promise.resolve(e.offers)};e.prototype.render=function(){var e=this;if(!this.offersList.length||!this.canRender||!this.showOffer)return null;var r=this.offersList[0];var t=this.isBankOffer?this.isMultipleBank?this.multipleBankOfferTitleText:null:r.title;var s=this.isBankOffer?this.isMultipleBank?this.multipleBankOfferTitleDescription:null:r.description;var n={"block-title":t,"block-subTitle":s,"show-controls":this.isMultipleBank};return h("div",{class:"s-offer-wrapper",onClick:function(){return e.emitPromotionClicked()}},h("p",{class:"s-offer-corner-badge"},this.special_offer_text),h("salla-slider",Object.assign({type:"carousel",id:"offer-slider"},n),h("div",{slot:"items"},this.renderSectionForOfferType(r.type))))};e.prototype.renderSectionForOfferType=function(e){if(this.isBankOffer){return this.renderBankSection()}if(e==OfferType.SpecialPrice){return this.renderSpecialPriceSection()}if(e==OfferType.BuyXGetY){return this.renderBuyXGetYSection()}return this.renderDiscountTableSection()};e.prototype.getCategoriesSection=function(e){return h("div",{class:"s-offer-slide-one-sixth swiper-slide",innerHTML:this.categorySlot.replace(/\{url\}/g,e.url).replace(/\{icon\}/g,e.icon||"sicon-store").replace(/\{name\}/g,e.name)})};e.prototype.renderBuyXGetYSection=function(){var e=this;var r,t;var s=this.offersList[0].details;return[(r=s.get.products)===null||r===void 0?void 0:r.map((function(r){return h("div",{class:"s-offer-slide-one-fourth"},e.hasCustomComponent?h(e.productCardComponent,{product:r}):h("salla-product-card",{"shadow-on-hover":true,product:r}))})),(t=s.get.categories)===null||t===void 0?void 0:t.map((function(r){return e.getCategoriesSection(r)}))]};e.prototype.renderBankSection=function(){var e=this;return this.offersList.map((function(r){return h("div",{class:{"s-offer-slide-one-sixth":e.isMultipleBank,"s-offer-bank-wrapper-sinlge-item":!e.isMultipleBank}},h("div",{class:{"s-offer-bank-wrapper":true,"s-offer-slide-one-sixth":!e.isMultipleBank,"s-offer-bank-wrapper-multi-spacer":e.isMultipleBank}},h("div",{class:"s-offer-bank-logo"},h("img",{src:r.details.logo||salla.url.cdn("images/s-empty.png"),"data-src":r.details.logo,alt:r.title+" offer"})),h("ul",{class:"s-offer-bank-payment-wrapper"},r.details.payments.map((function(e){return h("li",{class:"s-offer-bank-payment-single"},h("img",{src:salla.url.cdn("images/payment/"+e+".png")||salla.url.cdn("images/s-empty.png"),"data-src":salla.url.cdn("images/payment/"+e+".png"),alt:"payment"}))}))),e.isMultipleBank?h("p",{class:"s-offer-bank-payment-discount-percent"},"".concat(e.product_discount_text," ").concat(r.details.discount_value).concat(r.details.discount_type==="percentage"&&"%")):""),!e.isMultipleBank?h("div",{class:"s-offer-bank-message s-offer-slide-one-fourth"},h("h2",null,e.offersList[0].title),h("p",{innerHTML:e.generateBankDescription(e.offersList[0].description,r.details.discount_value)})):"")}))};e.prototype.generateBankDescription=function(e,r){return e.replace(new RegExp("".concat(r," %")),'<span class="s-offer-bank-message-amount">'.concat(r," %</span>"))};e.prototype.renderDiscountTableSection=function(){var e=this;var r;var t=this.offersList[0];var s=t.details.show_price_after_discount;return(r=this.offersList[0].details.discounts)===null||r===void 0?void 0:r.map((function(r){return h("div",{class:"s-offer-slide-one-fourth"},h("div",{class:"s-offer-slide-offer-entry"},h("div",{class:"s-offer-slide-offer-entry-price-quantity-container"},h("p",{class:"s-offer-slide-offer-entry-quantity"},e.buy_quantity_text(r.quantity)),s?h("div",{class:"s-offer-slide-offer-entry-price"},h("span",null,e.offer_with_price_text),h("span",{class:"s-offer-slide-offer-entry-price-amount"},r.discounted_amount)," ",h("span",null,e.userCurrency)):""),h("p",{class:"s-offer-slide-offer-entry-price-amount-percent"},e.with_discount_text,"(",h("span",null,r.percentage,!!r.percentage&&"%"),")")))}))};e.prototype.renderSpecialPriceSection=function(){var e=this;var r,t;var s=this.offersList[0].details;return[s.apply_to==="product"&&((r=s.products)===null||r===void 0?void 0:r.map((function(r){return h("div",{class:"s-offer-slide-one-fourth"},e.hasCustomComponent?h(e.productCardComponent,{product:r}):h("salla-product-card",{"shadow-on-hover":true,product:r}))}))),s.apply_to==="category"&&((t=s.categories)===null||t===void 0?void 0:t.map((function(r){return e.getCategoriesSection(r)})))]};Object.defineProperty(e.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();SallaOffer.style=sallaOfferCss;export{SallaOffer as salla_offer};
|
|
5
5
|
//# sourceMappingURL=salla-offer.entry.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Crafted with ❤ by Salla
|
|
3
|
+
*/
|
|
4
|
+
import{r as registerInstance,h,H as Host}from"./index-Hw2jlaNN.js";var sallaOrderDetailsMultipleBundleProductCss="";var SallaproductDetailsMultipleBundleProduct=function(){function i(i){registerInstance(this,i);this.placeholderImage=salla.url.cdn("images/s-empty.png")}i.prototype.getProductImage=function(){var i;if(!((i=this.productDetails)===null||i===void 0?void 0:i.image)){return this.placeholderImage}if(typeof this.productDetails.image==="string"){return this.productDetails.image}return this.productDetails.image.url||this.placeholderImage||salla.url.cdn("images/s-empty.png")};i.prototype.getProductImageAlt=function(){var i,s,t;if(!((i=this.productDetails)===null||i===void 0?void 0:i.image)||typeof this.productDetails.image==="string"){return((s=this.productDetails)===null||s===void 0?void 0:s.name)||""}return this.productDetails.image.alt||((t=this.productDetails)===null||t===void 0?void 0:t.name)||""};i.prototype.getAccordionId=function(){var i;return"accordion-".concat(((i=this.productDetails)===null||i===void 0?void 0:i.id)||"default")};i.prototype.getAccordionKey=function(){var i;return((i=this.productDetails)===null||i===void 0?void 0:i.id)||"default"};i.prototype.shouldBeCollapsible=function(){var i,s;if(this.collapsible!==undefined){return this.collapsible}return((s=(i=this.productDetails)===null||i===void 0?void 0:i.options)===null||s===void 0?void 0:s.length)>0};i.prototype.renderProductPrice=function(){if(!this.productDetails){return null}var i=this.productDetails,s=i.is_on_sale,t=i.sale_price,l=i.regular_price,r=i.price;if(s&&t){return h("div",null,h("span",{class:"s-order-details-product-price s-order-details-product-price-sale"},h("span",{innerHTML:salla.money(t)})),l&&h("span",{class:"s-order-details-product-regular-price"},h("span",{innerHTML:salla.money(l)})))}return h("span",{class:"s-order-details-product-price"},h("span",{innerHTML:salla.money(r)}))};i.prototype.renderOptions=function(){var i,s;if(!((s=(i=this.productDetails)===null||i===void 0?void 0:i.options)===null||s===void 0?void 0:s.length)){return null}return h("salla-accordion-body",null,h("div",{class:"s-order-details-options"},h("salla-order-details-options",{options:this.productDetails.options})))};i.prototype.render=function(){var i,s,t;if(!this.productDetails){return null}var l=this.shouldBeCollapsible();return h(Host,{class:"s-order-details-bundle-wrapper"},h("salla-accordion",{key:this.getAccordionKey(),collapsed:false,bordered:true,collapsible:l,id:this.getAccordionId(),size:"sm"},h("salla-accordion-head",null,h("div",{class:"s-order-details-product"},h("div",{class:"s-order-details-product-content"},h("div",{class:"s-order-details-product-info"},h("div",{class:"s-order-details-product-image"},h("img",{src:this.getProductImage(),alt:this.getProductImageAlt()})),h("div",{class:"s-order-details-product-details"},h("a",{href:((i=this.productDetails)===null||i===void 0?void 0:i.url)||"#",class:"s-order-details-product-name"},((s=this.productDetails)===null||s===void 0?void 0:s.name)||""),this.renderProductPrice(),((t=this.productDetails)===null||t===void 0?void 0:t.quantity)&&h("span",{class:"s-order-details-product-quantity"},"×",this.productDetails.quantity)))))),this.renderOptions()))};return i}();SallaproductDetailsMultipleBundleProduct.style=sallaOrderDetailsMultipleBundleProductCss;export{SallaproductDetailsMultipleBundleProduct as salla_order_details_multiple_bundle_product};
|
|
5
|
+
//# sourceMappingURL=salla-order-details-multiple-bundle-product.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"salla-order-details-multiple-bundle-product.entry.js","sources":["src/components/salla-order-details/salla-order-details-multiple-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":";;;;;AAAA,MAAM,yCAAyC,GAAG,EAAE;;MCYvC,wCAAwC,GAAA,MAAA;AAJrD,IAAA,WAAA,CAAA,OAAA,EAAA;;;QAYU,IAAgB,CAAA,gBAAA,GAAW,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,oBAAoB,CAAC;AAgIvE;IA9HS,eAAe,GAAA;;AACrB,QAAA,IAAI,EAAC,CAAA,EAAA,GAAA,IAAI,CAAC,cAAc,MAAE,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAA,KAAK,CAAA,EAAE;YAC/B,OAAO,IAAI,CAAC,gBAAgB;;;QAI9B,IAAI,OAAO,IAAI,CAAC,cAAc,CAAC,KAAK,KAAK,QAAQ,EAAE;AACjD,YAAA,OAAO,IAAI,CAAC,cAAc,CAAC,KAAK;;QAGlC,QACE,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC,gBAAgB,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,oBAAoB,CAAC;;IAIzF,kBAAkB,GAAA;;AACxB,QAAA,IAAI,EAAC,CAAA,EAAA,GAAA,IAAI,CAAC,cAAc,0CAAE,KAAK,CAAA,IAAI,OAAO,IAAI,CAAC,cAAc,CAAC,KAAK,KAAK,QAAQ,EAAE;AAChF,YAAA,OAAO,CAAA,MAAA,IAAI,CAAC,cAAc,MAAE,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAA,IAAI,KAAI,EAAE;;AAGxC,QAAA,OAAO,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,KAAI,CAAA,EAAA,GAAA,IAAI,CAAC,cAAc,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAE,IAAI,CAAA,IAAI,EAAE;;IAGjE,cAAc,GAAA;;AACpB,QAAA,OAAO,CAAa,UAAA,EAAA,CAAA,CAAA,EAAA,GAAA,IAAI,CAAC,cAAc,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAE,EAAE,KAAI,SAAS,EAAE;;IAGpD,eAAe,GAAA;;AACrB,QAAA,OAAO,CAAA,MAAA,IAAI,CAAC,cAAc,MAAE,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAA,EAAE,KAAI,SAAS;;IAGrC,mBAAmB,GAAA;;AACzB,QAAA,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,EAAE;YAClC,OAAO,IAAI,CAAC,WAAW;;QAEzB,OAAO,CAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,IAAI,CAAC,cAAc,MAAE,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAA,OAAO,MAAE,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAA,MAAM,IAAG,CAAC;;IAGzC,kBAAkB,GAAA;AACxB,QAAA,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;AACxB,YAAA,OAAO,IAAI;;AAGb,QAAA,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,cAAqB;AAEnF,QAAA,IAAI,UAAU,IAAI,UAAU,EAAE;AAC5B,YAAA,QACE,CAAA,CAAA,KAAA,EAAA,IAAA,EACE,CAAM,CAAA,MAAA,EAAA,EAAA,KAAK,EAAC,kEAAkE,EAAA,EAC5E,CAAM,CAAA,MAAA,EAAA,EAAA,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,EAAA,CAAS,CAC5C,EACN,aAAa,KACZ,CAAM,CAAA,MAAA,EAAA,EAAA,KAAK,EAAC,uCAAuC,EAAA,EACjD,CAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,EAAS,CAAA,CAC/C,CACR,CACG;;AAIV,QAAA,QACE,CAAA,CAAA,MAAA,EAAA,EAAM,KAAK,EAAC,+BAA+B,EAAA,EACzC,CAAM,CAAA,MAAA,EAAA,EAAA,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAAA,CAAS,CACvC;;IAIH,aAAa,GAAA;;QACnB,IAAI,EAAC,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,IAAI,CAAC,cAAc,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAE,OAAO,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAE,MAAM,CAAA,EAAE;AACzC,YAAA,OAAO,IAAI;;AAGb,QAAA,QACE,CAAA,CAAA,sBAAA,EAAA,IAAA,EACE,CAAK,CAAA,KAAA,EAAA,EAAA,KAAK,EAAC,yBAAyB,EAAA,EAClC,CAA6B,CAAA,6BAAA,EAAA,EAAA,OAAO,EAAE,IAAI,CAAC,cAAc,CAAC,OAAO,EAAI,CAAA,CACjE,CACe;;IAI3B,MAAM,GAAA;;AACJ,QAAA,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;AACxB,YAAA,OAAO,IAAI;;AAGb,QAAA,MAAM,gBAAgB,GAAG,IAAI,CAAC,mBAAmB,EAAE;AAEnD,QAAA,QACE,CAAC,CAAA,IAAI,EAAC,EAAA,KAAK,EAAC,gCAAgC,EAAA,EAC1C,CAAA,CAAA,iBAAA,EAAA,EACE,GAAG,EAAE,IAAI,CAAC,eAAe,EAAE,EAC3B,SAAS,EAAE,KAAK,EAChB,QAAQ,EAAE,IAAI,EACd,WAAW,EAAE,gBAAgB,EAC7B,EAAE,EAAE,IAAI,CAAC,cAAc,EAAE,EACzB,IAAI,EAAC,IAAI,EAAA,EAET,CAAA,CAAA,sBAAA,EAAA,IAAA,EACE,CAAK,CAAA,KAAA,EAAA,EAAA,KAAK,EAAC,yBAAyB,EAAA,EAClC,CAAK,CAAA,KAAA,EAAA,EAAA,KAAK,EAAC,iCAAiC,EAAA,EAC1C,CAAK,CAAA,KAAA,EAAA,EAAA,KAAK,EAAC,8BAA8B,EAAA,EACvC,CAAK,CAAA,KAAA,EAAA,EAAA,KAAK,EAAC,+BAA+B,EAAA,EACxC,CAAA,CAAA,KAAA,EAAA,EAAK,GAAG,EAAE,IAAI,CAAC,eAAe,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,kBAAkB,EAAE,GAAI,CAChE,EACN,CAAK,CAAA,KAAA,EAAA,EAAA,KAAK,EAAC,iCAAiC,EAAA,EAC1C,CAAG,CAAA,GAAA,EAAA,EAAA,IAAI,EAAE,CAAA,CAAA,EAAA,GAAA,IAAI,CAAC,cAAc,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAE,GAAG,KAAI,GAAG,EAAE,KAAK,EAAC,8BAA8B,EAC3E,EAAA,CAAA,CAAA,EAAA,GAAA,IAAI,CAAC,cAAc,MAAE,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAA,IAAI,KAAI,EAAE,CAC9B,EACH,IAAI,CAAC,kBAAkB,EAAE,EACzB,CAAA,CAAA,EAAA,GAAA,IAAI,CAAC,cAAc,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAE,QAAQ,MAC5B,CAAA,CAAA,MAAA,EAAA,EAAM,KAAK,EAAC,kCAAkC,EAAA,YAC1C,IAAI,CAAC,cAAc,CAAC,QAAQ,CACzB,CACR,CACG,CACF,CACF,CACF,CACe,EAEtB,IAAI,CAAC,aAAa,EAAE,CACL,CACb;;;;;;;"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Crafted with ❤ by Salla
|
|
3
|
+
*/
|
|
4
|
+
import{r as registerInstance,h,F as Fragment,H as Host}from"./index-Hw2jlaNN.js";var sallaOrderDetailsCss="";var SallaOrderDetails=function(){function e(e){registerInstance(this,e)}e.prototype.parseOrderDetailsData=function(e){this.parsedOrderDetailsData=e;if(typeof this.orderDetails==="string"){this.parsedOrderDetailsData=JSON.parse(e)}else{this.parsedOrderDetailsData=e}};e.prototype.componentWillLoad=function(){this.parseOrderDetailsData(this.orderDetails);console.log("Parent componentWillLoad - parsedOrderDetailsData:",this.parsedOrderDetailsData)};e.prototype.renderOrderDetailsContent=function(){if(!this.parsedOrderDetailsData){console.warn("No parsedOrderDetailsData available");return null}return[this.parsedOrderDetailsData.options&&this.parsedOrderDetailsData.options.length>0&&h("salla-order-details-options",{options:this.parsedOrderDetailsData.options}),this.parsedOrderDetailsData.sub_products&&this.parsedOrderDetailsData.sub_products.length>0&&h(Fragment,null,h("h2",{class:"s-order-details-bundle-title"},salla.lang.get("pages.orders.sub_products")),h("div",{class:"s-order-details-bundle-content"},this.parsedOrderDetailsData.sub_products.map((function(e){return h("salla-order-details-multiple-bundle-product",{key:e===null||e===void 0?void 0:e.id,productDetails:e})}))))]};e.prototype.render=function(){return h(Host,{key:"d76fce6a442aca11f3544a9f101ea4245a9317db",class:"s-order-details-wrapper"},this.renderOrderDetailsContent())};Object.defineProperty(e,"watchers",{get:function(){return{orderDetails:["parseOrderDetailsData"]}},enumerable:false,configurable:true});return e}();SallaOrderDetails.style=sallaOrderDetailsCss;export{SallaOrderDetails as salla_order_details};
|
|
5
|
+
//# sourceMappingURL=salla-order-details.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"salla-order-details.entry.js","sources":["src/components/salla-order-details/salla-order-details.scss?tag=salla-order-details","src/components/salla-order-details/salla-order-details.tsx"],"sourcesContent":["","import { Component, Host, h, Prop, State, Watch, Fragment } from '@stencil/core';\nimport { OrderProduct } from './interfaces';\n\n/**\n * @salla/ui-components\n * The `salla-order-details` component renders a collapsible summary for an order product with optional options list.\n * It uses the salla-accordion component to provide collapsible functionality.\n */\n@Component({\n tag: 'salla-order-details',\n styleUrl: 'salla-order-details.scss',\n})\nexport class SallaOrderDetails {\n @Prop() orderDetails: string | OrderProduct;\n\n @State() parsedOrderDetailsData: OrderProduct;\n\n @Watch('orderDetails')\n private parseOrderDetailsData(newValue: string | OrderProduct) {\n this.parsedOrderDetailsData = newValue as OrderProduct;\n if (typeof this.orderDetails === 'string') {\n this.parsedOrderDetailsData = JSON.parse(newValue as string);\n } else {\n this.parsedOrderDetailsData = newValue as OrderProduct;\n }\n }\n\n componentWillLoad() {\n this.parseOrderDetailsData(this.orderDetails);\n console.log('Parent componentWillLoad - parsedOrderDetailsData:', this.parsedOrderDetailsData);\n }\n\n private renderOrderDetailsContent() {\n // Check if we have parsed data\n if (!this.parsedOrderDetailsData) {\n console.warn('No parsedOrderDetailsData available');\n return null;\n }\n\n return [\n /* Product Options */\n this.parsedOrderDetailsData.options && this.parsedOrderDetailsData.options.length > 0 && (\n <salla-order-details-options options={this.parsedOrderDetailsData.options} />\n ),\n\n /* Bundle Subproducts */\n this.parsedOrderDetailsData.sub_products &&\n this.parsedOrderDetailsData.sub_products.length > 0 && (\n <Fragment>\n <h2 class=\"s-order-details-bundle-title\">\n {salla.lang.get('pages.orders.sub_products')}\n </h2>\n <div class=\"s-order-details-bundle-content\">\n {this.parsedOrderDetailsData.sub_products.map(product => (\n <salla-order-details-multiple-bundle-product\n key={product?.id}\n productDetails={product}\n />\n ))}\n </div>\n </Fragment>\n ),\n ];\n }\n\n render() {\n return <Host class=\"s-order-details-wrapper\">{this.renderOrderDetailsContent()}</Host>;\n }\n}\n"],"names":[],"mappings":";;;;;AAAA,MAAM,oBAAoB,GAAG,EAAE;;MCYlB,iBAAiB,GAAA,MAAA;;;;AAMpB,IAAA,qBAAqB,CAAC,QAA+B,EAAA;AAC3D,QAAA,IAAI,CAAC,sBAAsB,GAAG,QAAwB;AACtD,QAAA,IAAI,OAAO,IAAI,CAAC,YAAY,KAAK,QAAQ,EAAE;YACzC,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC,KAAK,CAAC,QAAkB,CAAC;;aACvD;AACL,YAAA,IAAI,CAAC,sBAAsB,GAAG,QAAwB;;;IAI1D,iBAAiB,GAAA;AACf,QAAA,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,YAAY,CAAC;QAC7C,OAAO,CAAC,GAAG,CAAC,oDAAoD,EAAE,IAAI,CAAC,sBAAsB,CAAC;;IAGxF,yBAAyB,GAAA;;AAE/B,QAAA,IAAI,CAAC,IAAI,CAAC,sBAAsB,EAAE;AAChC,YAAA,OAAO,CAAC,IAAI,CAAC,qCAAqC,CAAC;AACnD,YAAA,OAAO,IAAI;;QAGb,OAAO;;AAEL,YAAA,IAAI,CAAC,sBAAsB,CAAC,OAAO,IAAI,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,KACnF,CAAA,CAAA,6BAAA,EAAA,EAA6B,OAAO,EAAE,IAAI,CAAC,sBAAsB,CAAC,OAAO,EAAA,CAAI,CAC9E;;YAGD,IAAI,CAAC,sBAAsB,CAAC,YAAY;gBACtC,IAAI,CAAC,sBAAsB,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,KACjD,CAAA,CAAC,QAAQ,EAAA,IAAA,EACP,CAAA,CAAA,IAAA,EAAA,EAAI,KAAK,EAAC,8BAA8B,EAAA,EACrC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,2BAA2B,CAAC,CACzC,EACL,CAAA,CAAA,KAAA,EAAA,EAAK,KAAK,EAAC,gCAAgC,EACxC,EAAA,IAAI,CAAC,sBAAsB,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,KACnD,CAAA,CAAA,6CAAA,EAAA,EACE,GAAG,EAAE,OAAO,KAAP,IAAA,IAAA,OAAO,KAAP,MAAA,GAAA,MAAA,GAAA,OAAO,CAAE,EAAE,EAChB,cAAc,EAAE,OAAO,EACvB,CAAA,CACH,CAAC,CACE,CACG,CACZ;SACJ;;IAGH,MAAM,GAAA;AACJ,QAAA,OAAO,CAAC,CAAA,IAAI,EAAC,EAAA,GAAA,EAAA,0CAAA,EAAA,KAAK,EAAC,yBAAyB,EAAE,EAAA,IAAI,CAAC,yBAAyB,EAAE,CAAQ;;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(n,t,e,r){function i(n){return n instanceof e?n:new e((function(t){t(n)}))}return new(e||(e=Promise))((function(e,s){function
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(n,t,e,r){function i(n){return n instanceof e?n:new e((function(t){t(n)}))}return new(e||(e=Promise))((function(e,s){function c(n){try{o(r.next(n))}catch(n){s(n)}}function a(n){try{o(r["throw"](n))}catch(n){s(n)}}function o(n){n.done?e(n.value):i(n.value).then(c,a)}o((r=r.apply(n,t||[])).next())}))};var __generator=this&&this.__generator||function(n,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,c;return c={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(c[Symbol.iterator]=function(){return this}),c;function a(n){return function(t){return o([n,t])}}function o(a){if(r)throw new TypeError("Generator is already executing.");while(c&&(c=0,a[0]&&(e=0)),e)try{if(r=1,i&&(s=a[0]&2?i["return"]:a[0]?i["throw"]||((s=i["return"])&&s.call(i),0):i.next)&&!(s=s.call(i,a[1])).done)return s;if(i=0,s)a=[a[0]&2,s.value];switch(a[0]){case 0:case 1:s=a;break;case 4:e.label++;return{value:a[1],done:false};case 5:e.label++;i=a[1];a=[0];continue;case 7:a=e.ops.pop();e.trys.pop();continue;default:if(!(s=e.trys,s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){e=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){e.label=a[1];break}if(a[0]===6&&e.label<s[1]){e.label=s[1];s=a;break}if(s&&e.label<s[2]){e.label=s[2];e.ops.push(a);break}if(s[2])e.ops.pop();e.trys.pop();continue}a=t.call(n,e)}catch(n){a=[6,n];i=0}finally{r=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};
|
|
2
2
|
/*!
|
|
3
3
|
* Crafted with ❤ by Salla
|
|
4
|
-
*/import{r as registerInstance,h}from"./index-
|
|
4
|
+
*/import{r as registerInstance,h}from"./index-Hw2jlaNN.js";import{I as IconVerified}from"./check-uTyAzPSy.js";var iconFileArchive='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>file-archive</title>\n<path d="M17.333 16h-5.333c-0.737 0-1.333 0.597-1.333 1.333v2.667c0 2.205 1.795 4 4 4s4-1.795 4-4v-2.667c0-0.736-0.596-1.333-1.333-1.333zM16 20c0 0.735-0.597 1.333-1.333 1.333s-1.333-0.599-1.333-1.333v-1.333h2.667zM17.333 12h-5.333c-0.737 0-1.333 0.597-1.333 1.333s0.596 1.333 1.333 1.333h5.333c0.737 0 1.333-0.597 1.333-1.333s-0.596-1.333-1.333-1.333zM28.943 8.391l-8-8c-0.249-0.251-0.588-0.391-0.943-0.391h-13.333c-2.205 0-4 1.795-4 4v24c0 2.205 1.795 4 4 4h18.667c2.205 0 4-1.795 4-4v-18.667c0-0.353-0.14-0.693-0.391-0.943zM26.667 28c0 0.735-0.597 1.333-1.333 1.333h-18.667c-0.736 0-1.333-0.599-1.333-1.333v-24c0-0.735 0.597-1.333 1.333-1.333h12.781l7.219 7.219zM17.333 8h-5.333c-0.737 0-1.333 0.597-1.333 1.333s0.596 1.333 1.333 1.333h5.333c0.737 0 1.333-0.597 1.333-1.333s-0.596-1.333-1.333-1.333zM17.333 4h-5.333c-0.737 0-1.333 0.597-1.333 1.333s0.596 1.333 1.333 1.333h5.333c0.737 0 1.333-0.597 1.333-1.333s-0.596-1.333-1.333-1.333z"></path>\n</svg>\n';var iconDownload='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>download</title>\n<path d="M15.056 20.941c0.123 0.124 0.271 0.221 0.435 0.289 0.163 0.067 0.336 0.103 0.509 0.103s0.347-0.036 0.509-0.103c0.164-0.068 0.311-0.165 0.435-0.289l5.332-5.332c0.521-0.521 0.521-1.364 0-1.885s-1.364-0.521-1.885 0l-3.057 3.057v-12.781c0-0.737-0.597-1.333-1.333-1.333s-1.333 0.596-1.333 1.333v12.781l-3.057-3.057c-0.521-0.521-1.364-0.521-1.885 0s-0.521 1.364 0 1.885zM25.333 26.667h-18.667c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333h18.667c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333z"></path>\n</svg>\n';var iconCopy='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>swap-stroke</title>\n<path d="M6.667 18.667h-2.667c-0.736 0-1.333-0.597-1.333-1.333v-13.333c0-0.736 0.597-1.333 1.333-1.333h13.333c0.736 0 1.333 0.597 1.333 1.333v2.667c0 0.737 0.596 1.333 1.333 1.333s1.333-0.596 1.333-1.333v-2.667c0-2.205-1.795-4-4-4h-13.333c-2.205 0-4 1.795-4 4v13.333c0 2.205 1.795 4 4 4h2.667c0.737 0 1.333-0.596 1.333-1.333s-0.596-1.333-1.333-1.333zM28 10.667h-13.333c-2.205 0-4 1.795-4 4v13.333c0 2.205 1.795 4 4 4h13.333c2.205 0 4-1.795 4-4v-13.333c0-2.205-1.795-4-4-4zM29.333 28c0 0.736-0.597 1.333-1.333 1.333h-13.333c-0.736 0-1.333-0.597-1.333-1.333v-13.333c0-0.736 0.597-1.333 1.333-1.333h13.333c0.736 0 1.333 0.597 1.333 1.333z"></path>\n</svg>\n';var iconCreditCard='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>debit-card-back</title>\n<path d="M30 28h-28c-1.105 0-2-0.895-2-2v0-18c0-1.105 0.895-2 2-2v0h28c1.105 0 2 0.895 2 2v0 18c0 1.105-0.895 2-2 2v0zM30 26v0zM2 8v18h28v-18zM31 14h-30c-0.552 0-1-0.448-1-1s0.448-1 1-1v0h30c0.552 0 1 0.448 1 1s-0.448 1-1 1v0zM11 22h-6c-0.552 0-1-0.448-1-1s0.448-1 1-1v0h6c0.552 0 1 0.448 1 1s-0.448 1-1 1v0zM24 24c-2.209 0-4-1.791-4-4s1.791-4 4-4c2.209 0 4 1.791 4 4v0c0 2.209-1.791 4-4 4v0zM24 18c-1.105 0-2 0.895-2 2s0.895 2 2 2c1.105 0 2-0.895 2-2v0c0-1.105-0.895-2-2-2v0zM20 24c-2.209 0-4-1.791-4-4s1.791-4 4-4v0c0.002 0 0.005 0 0.007 0 1.032 0 1.972 0.398 2.673 1.048l-0.003-0.002c0.191 0.183 0.311 0.439 0.311 0.724 0 0.552-0.448 1-1 1-0.257 0-0.492-0.097-0.669-0.257l0.001 0.001c-0.345-0.319-0.807-0.514-1.315-0.514-0.002 0-0.003 0-0.005 0h0c-1.105 0-2 0.895-2 2s0.895 2 2 2v0c0.002 0 0.004 0 0.007 0 0.508 0 0.971-0.195 1.317-0.515l-0.001 0.001c0.179-0.171 0.422-0.276 0.689-0.276 0.552 0 1 0.448 1 1 0 0.295-0.128 0.56-0.331 0.743l-0.001 0.001c-0.699 0.648-1.638 1.046-2.671 1.046-0.003 0-0.007 0-0.010 0h0.001z"></path>\n</svg>\n';var sallaOrderSummaryCss=":host{display:block}";var SallaOrderSummary=function(){function n(n){registerInstance(this,n);this.codeCopied=null;this.noItemFound=true;this.order_items=[];this.isDigitalCard=function(n){return n.product.type==="codes"};this.isDigitalProduct=function(n){return n.product.type==="digital"}}n.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var n=this;return __generator(this,(function(t){switch(t.label){case 0:salla.lang.onLoaded((function(){n.codes_text=salla.lang.get("pages.thank_you.codes");n.copy_text=salla.lang.get("common.elements.copy");n.files_text=salla.lang.get("pages.thank_you.files");n.download_text=salla.lang.get("pages.thank_you.download")}));return[4,this.getOrderItems()];case 1:return[2,t.sent()]}}))}))};n.prototype.copyToClipboardHandler=function(n){var t=this;if(navigator&&"clipboard"in navigator){try{navigator.clipboard.writeText(n).then((function(){t.codeCopied=n;t.copyCodeButtonTimeout=setTimeout((function(){t.codeCopied=null}),3e3)}))}catch(n){salla.loggers.error("copy functionality is not supported by the browser")}}};n.prototype.getOrderItems=function(){return __awaiter(this,void 0,void 0,(function(){var n,t,e,r,i,s;var c=this;return __generator(this,(function(a){switch(a.label){case 0:n=this.orderId||salla.config.get("page.id");t="Failed to fetch order items";if(!n){salla.logger.error(t);throw new Error(t)}a.label=1;case 1:a.trys.push([1,3,,4]);return[4,salla.api.request("orders/".concat(n))];case 2:e=a.sent().data.items,r=e===void 0?[]:e;i=r.some((function(n){return c.isDigitalCard(n)||c.isDigitalProduct(n)}));if(i){this.order_items=r;this.noItemFound=false}return[3,4];case 3:s=a.sent();salla.logger.error(t);return[3,4];case 4:return[2]}}))}))};n.prototype.disconnectedCallback=function(){this.copyCodeButtonTimeout&&clearTimeout(this.copyCodeButtonTimeout)};n.prototype.render=function(){var n=this;return h("ul",{key:"14eed8e219bcde5b32d5fddb95bb8727e980c56c",class:"s-order-summary-wrapper"},this.noItemFound?h("salla-placeholder",{alignment:"center"},h("span",{slot:"title"})):this.order_items.map((function(t){return n.isDigitalCard(t)?h("li",{key:t.product.id,class:"s-order-summary-item"},h("h2",{class:"s-order-summary-item-title"},n.codes_text," (",t.name,")"),t.codes.map((function(t){return h("div",{key:t.code,class:"s-order-summary-code-item-wrapper"},h("p",null,h("span",{innerHTML:iconCreditCard}),h("span",null,t.code)),h("salla-button",{class:"s-order-summary-item-copy-button ".concat(n.codeCopied===t.code?"copied":""),onClick:function(){return n.copyToClipboardHandler(t.code)},shape:"link"},h("span",{innerHTML:n.codeCopied===t.code?IconVerified:iconCopy}),h("span",null,n.copy_text)))}))):n.isDigitalProduct(t)?h("li",{key:t.product.id,class:"s-order-summary-item"},h("h2",{class:"s-order-summary-item-title"},n.files_text," (",t.name,")"),h("ul",null,t.files.map((function(t){return h("li",{class:"s-order-summary-digital-item-wrapper"},h("div",null,h("span",{innerHTML:iconFileArchive}),h("span",null,t.name)),h("a",{href:t.url,target:"_blank",class:"s-order-summary-item-download"},h("span",{innerHTML:iconDownload}),h("span",null,n.download_text)))})))):null})))};return n}();SallaOrderSummary.style=sallaOrderSummaryCss;export{SallaOrderSummary as salla_order_summary};
|
|
5
5
|
//# sourceMappingURL=salla-order-summary.entry.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var __awaiter=this&&this.__awaiter||function(t,e,r,s){function n(t){return t instanceof r?t:new r((function(e){e(t)}))}return new(r||(r=Promise))((function(r,o){function a(t){try{l(s.next(t))}catch(t){o(t)}}function i(t){try{l(s["throw"](t))}catch(t){o(t)}}function l(t){t.done?r(t.value):n(t.value).then(a,i)}l((s=s.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},s,n,o,a;return a={next:i(0),throw:i(1),return:i(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function i(t){return function(e){return l([t,e])}}function l(i){if(s)throw new TypeError("Generator is already executing.");while(a&&(a=0,i[0]&&(r=0)),r)try{if(s=1,n&&(o=i[0]&2?n["return"]:i[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;if(n=0,o)i=[i[0]&2,o.value];switch(i[0]){case 0:case 1:o=i;break;case 4:r.label++;return{value:i[1],done:false};case 5:r.label++;n=i[1];i=[0];continue;case 7:i=r.ops.pop();r.trys.pop();continue;default:if(!(o=r.trys,o=o.length>0&&o[o.length-1])&&(i[0]===6||i[0]===2)){r=0;continue}if(i[0]===3&&(!o||i[1]>o[0]&&i[1]<o[3])){r.label=i[1];break}if(i[0]===6&&r.label<o[1]){r.label=o[1];o=i;break}if(o&&r.label<o[2]){r.label=o[2];r.ops.push(i);break}if(o[2])r.ops.pop();r.trys.pop();continue}i=e.call(t,r)}catch(t){i=[6,t];n=0}finally{s=o=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}};
|
|
2
2
|
/*!
|
|
3
3
|
* Crafted with ❤ by Salla
|
|
4
|
-
*/import{r as registerInstance,h,g as getElement}from"./index-
|
|
4
|
+
*/import{r as registerInstance,h,g as getElement}from"./index-Hw2jlaNN.js";import{H as Helper}from"./Helper-DGKT_pIJ.js";import"./anime.es-CgtvEd63.js";var sallaOrdersCss=":host{display:block}";var SallaOrder=function(){function t(t){var e=this;registerInstance(this,t);this.orderNumberText=salla.lang.get("pages.thank_you.order_id");this.totalOrderText=salla.lang.get("pages.orders.total");this.orderDateText=salla.lang.get("pages.orders.date");this.orderStatusText=salla.lang.get("pages.orders.status");this.noOrderText=salla.lang.get("pages.orders.non_orders");this.load_more_text_trans=salla.lang.get("common.elements.load_more");this.languageCode=salla.lang.locale;this.orders=[];salla.lang.onLoaded((function(){e.languageCode=salla.lang.locale;e.orderNumberText=salla.lang.get("pages.thank_you.order_id");e.totalOrderText=salla.lang.get("pages.orders.total");e.orderDateText=salla.lang.get("pages.orders.date");e.orderStatusText=salla.lang.get("pages.orders.status");e.noOrderText=salla.lang.get("pages.orders.non_orders");e.load_more_text_trans=salla.lang.get("common.elements.load_more")}))}t.prototype.loading=function(t){if(t===void 0){t=true}var e;var r=(e=this.status)===null||e===void 0?void 0:e.querySelector(".s-button-text");if(r){Helper.toggleElementClassIf(r,"s-button-hide","s-button-show",(function(){return t}));this.btnLoader.style.display=t?"inherit":"none"}};t.prototype.initiateInfiniteScroll=function(){var t=this;var e,r,s;if(!this.hasInfiniteScroll){return}if(!this.wrapper){salla.logger.error("Wrapper is undefined. Cannot initiate infinite scroll.");return}this.infiniteScroll=salla.infiniteScroll.initiate(this.wrapper,this.wrapper,{path:function(){return t.nextPage},history:false,nextPage:this.nextPage,scrollThreshold:false},true);(e=this.infiniteScroll)===null||e===void 0?void 0:e.on("request",(function(e){t.loading()}));(r=this.infiniteScroll)===null||r===void 0?void 0:r.on("load",(function(e){var r,s;t.loading(false);t.pagination=e.pagination;t.nextPage=((s=(r=e.pagination)===null||r===void 0?void 0:r.links)===null||s===void 0?void 0:s.next)||null;t.handleResponse(e.data).forEach((function(e){t.wrapper.append(e)}));var n=t.host.querySelectorAll(".s-orders-table-tbody-tr:not(.animated)");Helper.animateItems(n)}));(s=this.infiniteScroll)===null||s===void 0?void 0:s.on("error",(function(t){salla.logger.error("Error loading more comments:",t)}))};t.prototype.loadMore=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.infiniteScroll.loadNextPage();return[2]}))}))};t.prototype.handleResponse=function(t){var e=this;return t.map((function(t){return e.getSingleOrderItem(t)}))};t.prototype.loadInitialData=function(){return __awaiter(this,void 0,void 0,(function(){var t;var e=this;return __generator(this,(function(r){switch(r.label){case 0:t=new URL(window.location.href);return[4,salla.order.api.fetch(Object.assign(Object.assign({},this.params),{types:[""],feedback_status:t.searchParams.get("feedback_status")})).then((function(t){var r,s,n,o;e.orders=t.data;e.hasInfiniteScroll=!!((r=t.pagination)===null||r===void 0?void 0:r.links.next);e.pagination=t.pagination;e.total=(s=t.pagination)===null||s===void 0?void 0:s.total;e.nextPage=((o=(n=t.pagination)===null||n===void 0?void 0:n.links)===null||o===void 0?void 0:o.next)||null;if(!e.orders.length){e.showPlaceholder=true;return e.loading(false)}setTimeout((function(){e.handleResponse(t.data).forEach((function(t){e.wrapper.append(t)}));e.initiateInfiniteScroll();var r=e.wrapper.querySelectorAll(".s-orders-table-tbody-tr:not(.animated)");Helper.animateItems(r)}),100)})).catch((function(t){e.showPlaceholder=true;e.loading(false);salla.logger.error(t)}))];case 1:r.sent();return[2]}}))}))};t.prototype.getSingleOrderItem=function(t){var e=document.createElement("tr");e.classList.add("s-orders-table-tbody-tr","s-orders-table-tbody-tr-shadow");var r=document.createElement("td");r.classList.add("s-orders-table-tbody-tr-td");var s=document.createElement("div");s.classList.add("s-orders-table-tbody-tr-td-content");var n=document.createElement("span");n.classList.add("s-orders-mobile-title");n.textContent=this.orderNumberText+":";var o=document.createElement("span");o.classList.add("s-orders-reference-id");o.textContent="#"+t.reference_id;s.appendChild(n);s.appendChild(o);if(t.source=="buy_as_gift"){var a=document.createElement("i");a.classList.add("sicon-gift-sharing","s-orders-buy-as-gift-icon");s.appendChild(a)}var i=document.createElement("a");i.href=t.url;s.appendChild(i);var l=document.createElement("div");l.classList.add("s-orders-copy-to-clipboard-button");var d=document.createElement("salla-button");d.classList.add("relative");d.setAttribute("color","dark");d.setAttribute("shape","link");d.dataset.content=t.reference_id.toString();d.addEventListener("click",(function(t){Helper.copyToClipboard(t);Helper.toggleElementClassIf(d,"copied","code-to-copy",(function(){return true}));setTimeout((function(){Helper.toggleElementClassIf(d,"code-to-copy","copied",(function(){return true}))}),1e3)}));var u=document.createElement("span");u.textContent="#"+t.reference_id;var c=document.createElement("i");c.classList.add("sicon-swap-stroke","s-orders-copy-to-clipboard-button-icon");var h=salla.config.get("theme.is_rtl",true);if(h){d.appendChild(c);d.appendChild(u)}else{d.appendChild(u);d.appendChild(c)}l.appendChild(d);s.appendChild(l);r.appendChild(s);e.appendChild(r);var f=document.createElement("td");f.classList.add("s-orders-table-tbody-tr-td");var v=document.createElement("div");v.classList.add("s-orders-table-tbody-tr-td-content");var b=document.createElement("span");b.classList.add("s-orders-mobile-title");b.textContent=this.totalOrderText+":";var p=document.createElement("div");p.innerHTML=salla.money(t.total);var m=document.createElement("a");m.href=t.url;v.appendChild(b);v.appendChild(p);v.appendChild(m);f.appendChild(v);e.appendChild(f);var y=document.createElement("td");y.classList.add("s-orders-table-tbody-tr-td");var g=document.createElement("div");g.classList.add("s-orders-table-tbody-tr-td-content");var _=document.createElement("span");_.classList.add("s-orders-mobile-title");_.textContent=this.orderDateText+":";var w=document.createElement("div");w.textContent=Helper.formatDateFromString(t.created_at.date,salla.helpers.number,this.languageCode);var k=document.createElement("a");k.href=t.url;g.appendChild(_);g.appendChild(w);g.appendChild(k);y.appendChild(g);e.appendChild(y);var x=document.createElement("td");x.classList.add("s-orders-table-tbody-tr-td");var H=document.createElement("div");H.classList.add("s-orders-table-tbody-tr-td-content");var O=document.createElement("span");O.classList.add("s-orders-mobile-title");O.textContent=this.orderStatusText+":";var j=document.createElement("span");j.classList.add("s-orders-status-container");j.style.color=t.status.color;var C=document.createElement("i");C.classList.add(t.status.icon);var E=document.createElement("span");E.textContent=t.status.name;j.appendChild(C);j.appendChild(E);H.appendChild(O);H.appendChild(j);var S=document.createElement("i");S.classList.add("sicon-star2","s-orders-status-rated",t.is_rated?"s-orders-rated-text":"s-orders-unrated-text");H.appendChild(S);var T=document.createElement("a");T.href=t.url;H.appendChild(T);x.appendChild(H);e.appendChild(x);return e};t.prototype.render=function(){var t=this;var e;if(this.showPlaceholder){return h("div",{class:"s-orders-no-content"},h("i",{class:"sicon-packed-box icon"}),h("p",null,this.noOrderText))}return h("div",{class:"s-orders-wrapper"},h("table",{class:"s-orders-table"},h("thead",{class:"s-orders-table-head"},h("tr",{class:"s-orders-table-head-tr"},h("th",{class:"s-orders-table-head-tr-th",scope:"col"},this.orderNumberText),h("th",{class:"s-orders-table-head-tr-th",scope:"col"},this.totalOrderText),h("th",{class:"s-orders-table-head-tr-th",scope:"col"},this.orderDateText),h("th",{class:"s-orders-table-head-tr-th",scope:"col"},this.orderStatusText))),h("tbody",{class:"s-orders-table-tbody",ref:function(e){return t.wrapper=e}})),this.nextPage&&h("div",{class:"s-infinite-scroll-wrapper",ref:function(e){return t.status=e}},h("button",{onClick:function(){return t.loadMore()},class:"s-infinite-scroll-btn s-button-btn s-button-primary"},h("span",{class:"s-button-text s-infinite-scroll-btn-text"},(e=this.loadMoreText)!==null&&e!==void 0?e:this.load_more_text_trans),h("span",{class:"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader",ref:function(e){return t.btnLoader=e},style:{display:"none"}}))))};t.prototype.componentWillLoad=function(){var t=this;return salla.onReady().then((function(){return t.loadInitialData()})).then((function(){return t.initiateInfiniteScroll()}))};Object.defineProperty(t.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();SallaOrder.style=sallaOrdersCss;export{SallaOrder as salla_orders};
|
|
5
5
|
//# sourceMappingURL=salla-orders.entry.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as registerInstance,h,H as Host,g as getElement}from"./index-
|
|
4
|
+
import{r as registerInstance,h,H as Host,g as getElement}from"./index-Hw2jlaNN.js";var sallaPaymentsCss=":host{display:block}";var SallaPayments=function(){function a(a){registerInstance(this,a);this.exclude=[]}a.prototype.componentWillLoad=function(){var a=this;return salla.onReady().then((function(){var s,t,i;if(typeof a.exclude==="string"){try{a.exclude=JSON.parse(a.exclude)}catch(s){salla.logger.error("salla-payments:: failed to parse the exclude props!",a.exclude);a.exclude=[]}}a.placeholderImage=salla.url.cdn("images/s-empty.png");a.paymentSlot=((s=a.host.querySelector('[slot="payment"]'))===null||s===void 0?void 0:s.innerHTML)||'<li class="s-payments-list-item"><img class="lazy" width="100%" height="100%" src="'.concat(a.placeholderImage,'" data-src="{image}" alt={payment} /><li>');a.sbcSlot=((t=a.host.querySelector('[slot="sbc"]'))===null||t===void 0?void 0:t.innerHTML)||'<li class="s-payments-list-item"><a target="_blank" href="{link}"> <img width="100%" height="100%" src="'.concat(a.placeholderImage,'" data-src={image} class="lazy s-payments-sbc-image" alt="SBC"/></a><li>');a.codSlot=((i=a.host.querySelector('[slot="cod"]'))===null||i===void 0?void 0:i.innerHTML)||'<li class="s-payments-list-item"> <img width="100%" height="100%" src="'.concat(a.placeholderImage,'" data-src={image} class="lazy" alt="COD"/><li>');a.payments=salla.config.get("store.settings.payments")}))};a.prototype.render=function(){var a=this;var s=!this.exclude.includes("made-in-ksa")&&salla.config.get("store.settings.made_in_ksa");var t=this.exclude.includes("sbc")?null:salla.config.get("store.settings.certificate.id");return h(Host,{key:"a1a26ba03aa60491071f0e63bac40de3ad91bce6",class:"s-payments-list-wrap"},h("ul",{key:"d31ca162e83aade956f45d8f517029942a748646",class:"s-payments-list"},s&&h("li",{key:"552e3e57345d01ab33bfd20094cbcf8f702c6efa",class:"s-payments-list-item"},h("img",{key:"04eb9c9a1950edc9ea3c2e218fbe6c5c21d65f6a",class:"lazy",width:"100%",height:"100%",decoding:"async",loading:"lazy","data-src":salla.url.cdn("images/made-in-ksa.svg",58,58),alt:"made in KSA certified"})),this.payments.map((function(s){return s=="cod"?h("div",{id:"cod-slot",innerHTML:a.codSlot.replace(/\{image\}/g,salla.url.cdn("images/payment/cod_mini.png",58,58))}):h("div",{id:"payment-slot",innerHTML:a.paymentSlot.replace(/\{image\}/g,salla.url.cdn("images/payment/".concat(s,"_mini.png"),58,58)).replace(/\{payment\}/g,s)})})),t&&h("div",{key:"5f69b3c936edf8039006d6ecd73e3c44b74b9167",id:"sbc-slot",innerHTML:this.sbcSlot.replace(/\{image\}/g,salla.url.cdn("images/sbc.png",58,58)).replace(/\{link\}/g,"https://eauthenticate.saudibusiness.gov.sa/certificate-details/".concat(t))})))};a.prototype.componentDidLoad=function(){var a;(a=document.lazyLoadInstance)===null||a===void 0?void 0:a.update(this.host.querySelectorAll(".lazy"));this.host.querySelectorAll(".lazy").forEach((function(a){a.addEventListener("load",(function(){a.setAttribute("width","100%");a.setAttribute("height","100%")}))}))};a.prototype.componentDidRender=function(){var a,s,t;this.host.querySelectorAll("#payment-slot").forEach((function(a){return a.replaceWith(a.firstChild)}));this.host.querySelectorAll("#sbc-slot").forEach((function(a){return a.replaceWith(a.firstChild)}));this.host.querySelectorAll("#cod-slot").forEach((function(a){return a.replaceWith(a.firstChild)}));(a=this.host.querySelector('[slot="payment"]'))===null||a===void 0?void 0:a.remove();(s=this.host.querySelector('[slot="sbc"]'))===null||s===void 0?void 0:s.remove();(t=this.host.querySelector('[slot="cod"]'))===null||t===void 0?void 0:t.remove()};Object.defineProperty(a.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return a}();SallaPayments.style=sallaPaymentsCss;export{SallaPayments as salla_payments};
|
|
5
5
|
//# sourceMappingURL=salla-payments.entry.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(t,e,i,r){function n(t){return t instanceof i?t:new i((function(e){e(t)}))}return new(i||(i=Promise))((function(i,
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(t,e,i,r){function n(t){return t instanceof i?t:new i((function(e){e(t)}))}return new(i||(i=Promise))((function(i,a){function s(t){try{l(r.next(t))}catch(t){a(t)}}function c(t){try{l(r["throw"](t))}catch(t){a(t)}}function l(t){t.done?i(t.value):n(t.value).then(s,c)}l((r=r.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var i={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,n,a,s;return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(t){return function(e){return l([t,e])}}function l(c){if(r)throw new TypeError("Generator is already executing.");while(s&&(s=0,c[0]&&(i=0)),i)try{if(r=1,n&&(a=c[0]&2?n["return"]:c[0]?n["throw"]||((a=n["return"])&&a.call(n),0):n.next)&&!(a=a.call(n,c[1])).done)return a;if(n=0,a)c=[c[0]&2,a.value];switch(c[0]){case 0:case 1:a=c;break;case 4:i.label++;return{value:c[1],done:false};case 5:i.label++;n=c[1];c=[0];continue;case 7:c=i.ops.pop();i.trys.pop();continue;default:if(!(a=i.trys,a=a.length>0&&a[a.length-1])&&(c[0]===6||c[0]===2)){i=0;continue}if(c[0]===3&&(!a||c[1]>a[0]&&c[1]<a[3])){i.label=c[1];break}if(c[0]===6&&i.label<a[1]){i.label=a[1];a=c;break}if(a&&i.label<a[2]){i.label=a[2];i.ops.push(c);break}if(a[2])i.ops.pop();i.trys.pop();continue}c=e.call(t,i)}catch(t){c=[6,t];n=0}finally{r=a=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}};
|
|
2
2
|
/*!
|
|
3
3
|
* Crafted with ❤ by Salla
|
|
4
|
-
*/import{r as registerInstance,c as createEvent,h,H as Host}from"./index-
|
|
4
|
+
*/import{r as registerInstance,c as createEvent,h,H as Host}from"./index-Hw2jlaNN.js";import{a as arrowLeft}from"./arrow-left-BedNk7k1.js";var arrowRight='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>arrow-right</title>\n<path d="M29.217 15.465c-0.019-0.044-0.056-0.077-0.080-0.119-0.067-0.116-0.139-0.227-0.236-0.317-0.011-0.009-0.013-0.024-0.024-0.033l-10.667-9.333c-0.553-0.484-1.396-0.429-1.881 0.125-0.484 0.555-0.428 1.396 0.127 1.881l7.996 6.997h-20.452c-0.737 0-1.333 0.597-1.333 1.333s0.596 1.333 1.333 1.333h20.452l-7.996 6.997c-0.555 0.485-0.611 1.327-0.127 1.881 0.264 0.3 0.633 0.455 1.004 0.455 0.312 0 0.625-0.109 0.877-0.331l10.667-9.333c0.011-0.009 0.015-0.024 0.024-0.033 0.097-0.091 0.169-0.201 0.236-0.317 0.024-0.041 0.060-0.075 0.080-0.119 0.073-0.163 0.116-0.343 0.116-0.533s-0.043-0.371-0.116-0.535z"></path>\n</svg>\n';var sallaPriceRangeCss=":host{display:block}.rtl .rtl-range-slider,[dir=rtl] .rtl-range-slider{-webkit-transform:rotateY(180deg);transform:rotateY(180deg)}.rtl .rtl-range-numbers,[dir=rtl] .rtl-range-numbers{-ms-flex-direction:row-reverse;flex-direction:row-reverse}.rtl .form-select,.rtl select,[dir=rtl] .form-select,[dir=rtl] select{background-position:left 0.5rem center;padding-right:12px}.rtl .menu-divide li:not(:last-child):after,[dir=rtl] .menu-divide li:not(:last-child):after{left:0;right:auto}input[type=range]::-webkit-slider-thumb{pointer-events:all;width:24px;height:24px;-webkit-appearance:none}[type=checkbox]:checked{background-size:80%}";var SallaPriceRange=function(){function t(t){registerInstance(this,t);this.changed=createEvent(this,"changed");this.min=0;this.max=1e4;this.moreThanLabel="أكثر من";this.lessThanLabel="أقل من";this.toLabel="الى";this.fromLabel="من";this.typing=false;this.isMin=false;this.isRTL=salla.config.get("theme.is_rtl",true);this.filterValues=[]}t.prototype.connectedCallback=function(){var t=this;var e;if(this.filtersData&&((e=this.filtersData)===null||e===void 0?void 0:e.price)){this.minPrice=this.filtersData.price.min;this.maxPrice=this.filtersData.price.max}salla.lang.onLoaded((function(){t.moreThanLabel=salla.lang.getWithDefault("common.elements.more_than",t.moreThanLabel);t.lessThanLabel=salla.lang.getWithDefault("common.elements.less_than",t.lessThanLabel);t.toLabel=salla.lang.getWithDefault("common.elements.to",t.toLabel);t.fromLabel=salla.lang.getWithDefault("common.elements.from",t.fromLabel)}));if(this.option.values.length==1){return}if(this.option.values.length<=5){this.filterValues=this.option.values;return}var i=Math.ceil(this.option.values.length/5);for(var r=0;r<this.option.values.length;r+=i){this.filterValues.push(this.option.values.slice(r,r+i).reduce((function(t,e){t.to=e.to;t.count+=e.count;return t})))}};t.prototype.reset=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.minInput.value=null;this.maxInput.value=null;this.minPrice=null;this.maxPrice=null;return[2]}))}))};t.prototype.getPriceLabel=function(t){if(isNaN(t.from)||t.from<1){return"".concat(this.lessThanLabel," ").concat(salla.money(t.to))}if(isNaN(t.to)||t.to<1){return"".concat(this.moreThanLabel," ").concat(salla.money(t.from))}return"".concat(salla.money(t.from)," ").concat(this.toLabel," ").concat(salla.money(t.to))};t.prototype.minInputValidation=function(t){if(t&&(t>this.max||this.maxPrice&&t>this.maxPrice)){return}if(t<this.min){this.minPrice=this.min;return}if(t){this.minPrice=t}};t.prototype.maxInputValidation=function(t){if(t&&(t<this.min||this.minPrice&&t<this.minPrice)){return}if(t>this.max){this.maxPrice=this.max;return}};t.prototype.changedEventHandler=function(t){return __awaiter(this,void 0,void 0,(function(){var e,i;return __generator(this,(function(r){salla.helpers.inputDigitsOnly(this.minInput);salla.helpers.inputDigitsOnly(this.maxInput);e=this.minPrice?+this.minPrice*1:null;i=this.maxPrice?+this.maxPrice*1:null;if(!this.maxPrice){this.maxPrice=""}if(this.isMin){this.minInputValidation(e)}else{if(!this.minPrice){this.minPrice=0}this.maxInputValidation(i)}this.isReady&&this.changed.emit({event:t,option:this.option,value:{max:this.maxPrice,min:this.minPrice}});return[2]}))}))};t.prototype.handleMinMaxPrice=function(t,e){this.minPrice=e.from;this.maxPrice=e.to!=="*"?e.to:"";this.changedEventHandler(t)};t.prototype.isChecked=function(t){if(!this.minPrice&&!this.maxPrice){return false}var e=(t.from<1||t.from=="*")&&this.minPrice==0||t.from==this.minPrice;var i=t.to=="*"||!t.to||t.to==this.maxPrice;return e&&i};t.prototype.handleMinPrice=function(t){this.isMin=true;var e=t.target.value;this.minPrice=e===""?0:e};t.prototype.handleMaxPrice=function(t){this.isMin=false;var e=t.target.value;this.maxPrice=e===undefined?"":e};t.prototype.render=function(){var t=this;return h(Host,{key:"dc09f4be81c3652da570b522894917f6b70faf61"},this.filterValues.map((function(e,i){return h("label",{class:"s-filters-label",htmlFor:"".concat(t.option.key,"-").concat(i),key:i},h("input",{id:"".concat(t.option.key,"-").concat(i),name:"price",type:"radio",checked:t.isChecked(e),class:"s-filters-radio",onChange:function(i){return t.handleMinMaxPrice(i,e)}}),h("span",{innerHTML:t.getPriceLabel(e)}))})),h("div",{key:"97f20e2bcff15d906dc5566a7f147339e4423138",class:"flex justify-center items-center"},h("div",{key:"4c631a9f5c77890bcffd365db6dab471ba989246",class:"relative max-w-xl w-full"},h("div",{key:"3e4c53b29c4e6fa90eba1a23f646d8391b1ce462",class:"s-price-range-inputs"},h("div",{key:"6bb515095db500d78c5cc22f2bd25635d157793d",class:"s-price-range-relative"},h("div",{key:"59617a36c7095a0766155521afb20d517fc5321a",class:"s-price-range-currency"}," ",salla.config.currency().symbol),h("input",{key:"bc1ae88ba28bcc11a7373cad13cdd2104646023b",type:"number",maxlength:"5",ref:function(e){return t.minInput=e},onBlur:function(e){return t.handleMinPrice(e)},value:this.minPrice,placeholder:this.fromLabel,class:"s-price-range-number-input"})),h("div",{key:"49e12143570efe2f019e9a3240f9d1c184482f9c",class:"s-price-range-gray-text"}," -"),h("div",{key:"1e61ef602dbb0f1622bbd7279f15b5ef71d0f2db",class:"s-price-range-relative"},h("div",{key:"5aac7489a79f52156f382e0e4e181b6d0a8e5fb3",class:"s-price-range-currency"}," ",salla.config.currency().symbol),h("input",{key:"104a3ce0be1d461715fdc6a29d0df33a8a378ad3",type:"number",maxlength:"5",ref:function(e){return t.maxInput=e},onBlur:function(e){return t.handleMaxPrice(e)},value:this.maxPrice,placeholder:this.toLabel,class:"s-price-range-number-input","aria-describedby":"price-currency"})),h("salla-button",{key:"2e722552816b6ceabf030d596fac580e1fa8d41a",color:"gray",shape:"icon",size:"small",fill:"outline",onClick:function(e){return t.changedEventHandler(e)}},h("span",{key:"6f41a0dfa95c9910ab5d17e98ba815444fab8cca",innerHTML:this.isRTL?arrowLeft:arrowRight}))))))};t.prototype.componentDidLoad=function(){this.isReady=true};return t}();SallaPriceRange.style=sallaPriceRangeCss;export{SallaPriceRange as salla_price_range};
|
|
5
5
|
//# sourceMappingURL=salla-price-range.entry.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var __awaiter=this&&this.__awaiter||function(t,n,i,o){function r(t){return t instanceof i?t:new i((function(n){n(t)}))}return new(i||(i=Promise))((function(i,e){function a(t){try{u(o.next(t))}catch(t){e(t)}}function s(t){try{u(o["throw"](t))}catch(t){e(t)}}function u(t){t.done?i(t.value):r(t.value).then(a,s)}u((o=o.apply(t,n||[])).next())}))};var __generator=this&&this.__generator||function(t,n){var i={label:0,sent:function(){if(e[0]&1)throw e[1];return e[1]},trys:[],ops:[]},o,r,e,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(t){return function(n){return u([t,n])}}function u(s){if(o)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(i=0)),i)try{if(o=1,r&&(e=s[0]&2?r["return"]:s[0]?r["throw"]||((e=r["return"])&&e.call(r),0):r.next)&&!(e=e.call(r,s[1])).done)return e;if(r=0,e)s=[s[0]&2,e.value];switch(s[0]){case 0:case 1:e=s;break;case 4:i.label++;return{value:s[1],done:false};case 5:i.label++;r=s[1];s=[0];continue;case 7:s=i.ops.pop();i.trys.pop();continue;default:if(!(e=i.trys,e=e.length>0&&e[e.length-1])&&(s[0]===6||s[0]===2)){i=0;continue}if(s[0]===3&&(!e||s[1]>e[0]&&s[1]<e[3])){i.label=s[1];break}if(s[0]===6&&i.label<e[1]){i.label=e[1];e=s;break}if(e&&i.label<e[2]){i.label=e[2];i.ops.push(s);break}if(e[2])i.ops.pop();i.trys.pop();continue}s=n.call(t,i)}catch(t){s=[6,t];r=0}finally{o=e=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};
|
|
2
2
|
/*!
|
|
3
3
|
* Crafted with ❤ by Salla
|
|
4
|
-
*/import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-D4D34Ujk.js";import{I as IconVerified}from"./check-uTyAzPSy.js";import{C as CameraIcon}from"./camera-C6jIkM-X.js";var DisplayType;(function(t){t["COLOR"]="color";t["DATE"]="date";t["DATETIME"]="datetime";t["DONATION"]="donation";t["IMAGE"]="image";t["MULTIPLE_OPTIONS"]="multiple-options";t["NUMBER"]="number";t["SINGLE_OPTION"]="single-option";t["DIGITAL_CARD_VALUE"]="digital-code-value";t["COUNTRY"]="country";t["SPLITTER"]="splitter";t["TEXT"]="text";t["TEXTAREA"]="textarea";t["THUMBNAIL"]="thumbnail";t["TIME"]="time";t["RADIO"]="radio";t["CHECKBOX"]="checkbox";t["MAP"]="map";t["FILE"]="file";t["COLOR_PICKER"]="color_picker";t["BOOKING"]="booking"})(DisplayType||(DisplayType={}));var Currency;(function(t){t["Sar"]="SAR"})(Currency||(Currency={}));var FileIcon='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>file-upload</title>\n<path d="M21.333 24c0.341 0 0.683-0.131 0.943-0.391 0.521-0.521 0.521-1.364 0-1.885l-5.333-5.333c-0.123-0.123-0.271-0.22-0.433-0.288-0.327-0.135-0.693-0.135-1.019 0-0.163 0.068-0.311 0.165-0.433 0.288l-5.333 5.333c-0.521 0.521-0.521 1.364 0 1.885s1.364 0.521 1.885 0l3.057-3.057v10.115c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-10.115l3.057 3.057c0.26 0.26 0.601 0.391 0.943 0.391zM28.943 9.724l-9.333-9.333c-0.249-0.251-0.589-0.391-0.943-0.391h-12c-2.205 0-4 1.795-4 4v24c0 2.205 1.795 4 4 4h4c0.736 0 1.333-0.597 1.333-1.333s-0.597-1.333-1.333-1.333h-4c-0.735 0-1.333-0.599-1.333-1.333v-24c0-0.735 0.599-1.333 1.333-1.333h11.448l8.552 8.552v16.781c0 0.735-0.599 1.333-1.333 1.333h-4c-0.736 0-1.333 0.597-1.333 1.333s0.597 1.333 1.333 1.333h4c2.205 0 4-1.795 4-4v-17.333c0-0.353-0.14-0.693-0.391-0.943z"></path>\n</svg>\n';var sallaProductOptionsCss="";var SallaProductOptions=function(){function t(t){var n=this;registerInstance(this,t);this.changed=createEvent(this,"changed");this.fileTypes={pdf:"application/pdf",png:"image/png",jpg:"image/jpeg",word:"application/doc,application/ms-doc,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document",exl:"application/excel,application/vnd.ms-excel,application/x-excel,application/x-msexcel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",txt:"text/plain"};this.outOfStockText="";this.donationAmount=salla.lang.get("pages.products.donation_amount");this.selectDonationAmount=salla.lang.getWithDefault("pages.products.select_donation_amount","تحديد مبلغ التبرع");this.selectAmount=salla.lang.getWithDefault("pages.products.select_amount","اختر المبلغ");this.isCustomDonation=false;this.selectedOptions=[];this.disableCardValue=true;this.availableDigitalCardValues=[];this.outSkus=[];this.ignoreDefaultCardValue=false;this.productId=salla.config.get("page.id");this.handleDonationOptions=function(t,i,o){if(i==="custom"&&o==="input"){salla.helpers.inputDigitsOnly(t.target);salla.event.emit("product-options::donation-changed",{id:n.productId,price:t.target.value});return}t.preventDefault();t.stopPropagation();n.isCustomDonation=t.target.value==="custom";if(n.donationInput){if(t.target.value==="custom"){n.donationInput.value="";n.donationInput.focus()}else{n.donationInput.value=t.target.value}if(i==="custom"){return}salla.event.emit("product-options::donation-changed",{id:n.productId,price:t.target.value})}};this.hideLabel=function(t){if(t.type===DisplayType.DONATION&&(t.donation&&!t.donation.can_donate)){return true}return false};this.getExpireDonationMessage=function(t){if(!t.donation){return}var n=t.donation.target_amount<=t.donation.collected_amount;return h("div",{class:{"s-product-options-donation-message":true,"s-product-options-donation-completed":n,"s-product-options-donation-expired":!n}},h("p",null,t.donation.target_message),h("span",{innerHTML:n?salla.money(t.donation.target_amount):""}))};this.canDisabled=!salla.config.get("store.settings.product.notify_options_availability")||salla.url.is_page("cart");salla.lang.onLoaded((function(){n.outOfStockText=salla.lang.get("pages.products.out_of_stock");n.donationAmount=salla.lang.get("pages.products.donation_amount");n.selectDonationAmount=salla.lang.getWithDefault("pages.products.select_donation_amount","تحديد مبلغ التبرع");n.selectAmount=salla.lang.getWithDefault("pages.products.select_amount","اختر المبلغ")}));if(this.options){try{this.setOptionsData(Array.isArray(this.options)?this.options:JSON.parse(this.options));return}catch(t){salla.log("Bad json passed via options prop")}}if(!Array.isArray(this.optionsData)){salla.log("Options is not an array[] ---\x3e ",this.optionsData);this.setOptionsData([])}if(this.productId&&!salla.url.is_page("cart")){salla.api.product.getDetails(this.productId,["options"]).then((function(t){return n.setOptionsData(t.data.options)}))}}t.prototype.setOptionsData=function(t){return __awaiter(this,void 0,void 0,(function(){var n,i,o;return __generator(this,(function(r){this.optionsData=t;o=this;(i=(n=this.optionsData[0])===null||n===void 0?void 0:n.details)===null||i===void 0?void 0:i.forEach((function(t){Object.entries(t.skus_availability||{}).filter((function(t){return!t[1]})).map((function(t){return o.outSkus.push(Number(t[0]))}))}));return[2]}))}))};t.prototype.getSelectedOptionsData=function(){return __awaiter(this,void 0,void 0,(function(){var t,n;return __generator(this,(function(i){t={};n=this.host.getElementSallaData();n.forEach((function(n,i){if(i.startsWith("options[")){t[i.replace("options[","").replace("]","")]=n}}));return[2,t]}))}))};t.prototype.reportValidity=function(){return __awaiter(this,void 0,void 0,(function(){var t,n,i;return __generator(this,(function(o){t=this.host.querySelectorAll("[required]");n=true;for(i=0;i<t.length;i++){if("reportValidity"in t[i]&&!t[i].reportValidity()){n=false}}return[2,n]}))}))};t.prototype.hasOutOfStockOption=function(){return __awaiter(this,void 0,void 0,(function(){var t,n;var i=this;return __generator(this,(function(o){return[2,this.selectedOptions.some((function(t){return t.is_out}))||((t=this.selectedSkus)===null||t===void 0?void 0:t.length)&&((n=this.selectedSkus)===null||n===void 0?void 0:n.every((function(t){return i.outSkus.includes(t)})))]}))}))};t.prototype.getSelectedOptions=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,this.selectedOptions]}))}))};t.prototype.getOption=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){return[2,this.optionsData.find((function(n){return n.id===t}))]}))}))};t.prototype.invalidHandler=function(t,n){var i=t.target.closest(".s-product-options-option");if(!i.classList.contains("s-product-options-option-error")){i.classList.add("s-product-options-option-error")}if(!salla.url.is_page("cart")){var o=this.host.querySelector(".s-product-options-option-error");if(o===i){this.scrollToElement(i)}}};t.prototype.scrollToElement=function(t){if(t){t.scrollIntoView({behavior:"smooth",block:"center"})}};t.prototype.changedHandler=function(t,n,i){var o=this;if(i===void 0){i=true}var r={event:t,option:n,detail:null,productId:this.productId};if(n.details){var e=n.details.find((function(n){return Number(n.id)===Number(t.target.value)}));r.detail=e}if(n.type==="country"){this.handleCountryOptionChange(t,r.detail)}var a=t.target.closest(".s-product-options-option");if(t.target.value||(n.type===DisplayType.FILE||n.type===DisplayType.IMAGE)&&t.type==="added"||n.type===DisplayType.MAP&&t.type==="selected"&&(t.target.lat&&t.target.lng)){setTimeout((function(){a.classList.remove("s-product-options-option-error")}),200)}if(n.type===DisplayType.DONATION){salla.event.emit("product-options::donation-changed",{id:this.productId,price:t.target.value})}this.setSelectedSkus();this.handleRequiredMultipleOptions(n);var s=this.selectedOptions.findIndex((function(t){return t.option_id===r.option.id}));if(r.option.type===DisplayType.MULTIPLE_OPTIONS){var u=this.selectedOptions.findIndex((function(t){var n;return t.option_id===r.option.id&&(t===null||t===void 0?void 0:t.id)===((n=r.detail)===null||n===void 0?void 0:n.id)}));if(u>-1){this.selectedOptions.splice(u,1)}else{this.selectedOptions.push(Object.assign(Object.assign({},r.detail),{option_id:r.option.id}))}}else{if(!r.detail||Object.keys(r.detail).length===0){if(s>-1){this.selectedOptions.splice(s,1)}}else{if(s>-1){this.selectedOptions[s]=Object.assign(Object.assign({},r.detail),{option_id:r.option.id})}else{this.selectedOptions.push(Object.assign(Object.assign({},r.detail),{option_id:r.option.id}))}}}this.optionsData=this.optionsData.map((function(t){if(t.id===r.option.id){return Object.assign(Object.assign({},t),{details:t.details.map((function(t){var n,i;return Object.assign(Object.assign({},t),{is_selected:r.option.type===DisplayType.MULTIPLE_OPTIONS?o.selectedOptions.some((function(n){return n.id===t.id})):Number(t.id)===Number((n=r.detail)===null||n===void 0?void 0:n.id),value:(i=r.detail)===null||i===void 0?void 0:i.value})}))})}return t}));if(i){this.changed.emit(r);salla.event.emit("product-options::change",r)}};t.prototype.setSelectedSkus=function(){this.selectedSkus=this.selectedOptions.map((function(t){return Object.keys(t.skus_availability||{})})).reduce((function(t,n){return t.filter((function(t){return n.includes(t)}))}),[]).map((function(t){return Number(t)}))};t.prototype.handleRequiredMultipleOptions=function(t){if(t.type!==DisplayType.MULTIPLE_OPTIONS||!t.required){return}var n=this.host.querySelector('[data-option-id="'.concat(t.id,'"]'));var i=n.querySelectorAll("input:checked").length;n.querySelectorAll("input").forEach((function(t){return t.toggleAttribute("required",!i)}))};t.prototype.getLatLng=function(t,n){return t?t.split(",")[n==="lat"?0:1]:""};t.prototype.getDisplayForType=function(t){var n=this;if(this["".concat(t.type,"Option")]){return this["".concat(t.type,"Option")](t)}if(t.type===DisplayType.COLOR_PICKER){return this.colorPickerOption(t)}if(t.type===DisplayType.MULTIPLE_OPTIONS){return this.multipleOptions(t)}if(t.type===DisplayType.SINGLE_OPTION){return this.singleOption(t)}if(t.type===DisplayType.DIGITAL_CARD_VALUE){return this.digitalCardValuesOption(t)}if(t.type===DisplayType.COUNTRY){return this.countryOption(t)}if(t.type===DisplayType.BOOKING&&salla.url.is_page("cart")){return h("salla-booking-field",{onInvalidInput:function(i){return n.invalidHandler(i,t)},option:t,productId:t.value})}salla.log("Couldn't find options type(".concat(t.type,")😢"));return""};t.prototype.getOptionShownWhen=function(t){return t.visibility_condition?{"data-show-when":"options[".concat(t.visibility_condition.option,"] ").concat(t.visibility_condition.operator," ").concat(t.visibility_condition.value)}:{}};t.prototype.getAvailableDigitalCardSKUs=function(t){var n=this.optionsData.find((function(t){var n=t.type;return n==="digital-code-value"}));if(!n)throw new Error("product-options:: No digital card options found");var i=Object.keys(t.skus_availability).filter((function(n){return t.skus_availability[n]===false}));this.availableDigitalCardValues=n.details.filter((function(t){return!Object.keys(t.skus_availability).filter((function(t){return i.includes(t)})).length}))};t.prototype.handleCountryOptionChange=function(t,n){t.stopImmediatePropagation();this.ignoreDefaultCardValue=true;var i=this.host.querySelector("input[data-code-value]:checked");if(i)i.checked=false;var o=this.optionsData.find((function(t){var n=t.type;return n==="digital-code-value"}));if(!o)throw new Error("product-options:: No digital card options found");this.getAvailableDigitalCardSKUs(n)};t.prototype.getSelectedDigitalCardOptions=function(t){var n=t.details.find((function(t){return t.is_selected}));var i=t.details.find((function(t){return!!t.is_default}))||t.details[0];if(!["digital-code-value","country"].includes(t.type))return;return n||i};t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var t,n,i,o;return __generator(this,(function(r){switch(r.label){case 0:if(salla.url.is_page("cart")){this.disableCardValue=false;this.fillSelectedOptions()}if(this.config){try{this.optionConfig=typeof this.config==="string"?JSON.parse(this.config):this.config}catch(t){console.error("Failed to parse JSON in config prop:",t)}}t=this.optionsData.filter((function(t){var n=t.type;return["country","digital-card-value"].includes(n)})).length>0&&salla.url.is_page("cart");if(t){n=this.optionsData.find((function(t){return t.type==="country"}));i=n&&this.getSelectedDigitalCardOptions(n);if(i){this.getAvailableDigitalCardSKUs(i)}}this.outOfStockText=salla.lang.get("pages.products.out_of_stock");return[4,salla.onReady()];case 1:r.sent();document.addEventListener("paste",this.handlePaste.bind(this));o=!salla.storage.get("cart.id")&&this.optionsData.some((function(t){return["file","image"].includes(t.type)}));return[2,o?salla.api.cart.getCurrentCartId(false,"salla-product-options"):null]}}))}))};t.prototype.handlePaste=function(t){var n;var i=t.target;if(!Salla.config.get("store.settings.content_copyright")||!Salla.helpers.hasApplePay()||!(i instanceof HTMLInputElement||i instanceof HTMLTextAreaElement)||!i.classList.contains("s-form-control")||!i.name.startsWith("options[")){return}t.preventDefault();var o=((n=t.clipboardData)===null||n===void 0?void 0:n.getData("text"))||"";var r=i.selectionStart;var e=i.selectionEnd;var a=i.value.slice(0,r)+o+i.value.slice(e);i.value=a;i.setSelectionRange(r+o.length,r+o.length)};t.prototype.hideDigitalCardsOptions=function(t){return this.disableCardValue&&t.type===DisplayType.DIGITAL_CARD_VALUE&&!salla.url.is_page("cart")};t.prototype.render=function(){var t=this;var n;if(((n=this.optionsData)===null||n===void 0?void 0:n.length)===0){return}return h(Host,{class:"s-product-options-wrapper"},h("salla-conditional-fields",null,this.optionsData.map((function(n){return h("div",Object.assign({key:n.id,class:"s-product-options-option-container".concat(n.visibility_condition||t.hideDigitalCardsOptions(n)?" hidden":""),"data-option-id":n.id},t.getOptionShownWhen(n)),n.name==="splitter"?t.splitterOption():h("div",{class:{"s-product-options-option":true,"s-product-options-option-booking":n.type===DisplayType.BOOKING&&salla.url.is_page("cart")},"data-option-type":n.type,"data-option-required":"".concat(n.required)},h("label",{htmlFor:"options[".concat(n.id,"]"),class:"s-product-options-option-label ".concat(t.hideLabel(n)?"s-product-options-option-label-hidden":"")},h("b",null,n.name,n.required&&h("span",null," * ")," "),h("small",null,n.placeholder)),h("div",{class:"s-product-options-option-content ".concat(t.hideLabel(n)||n.type===DisplayType.BOOKING&&salla.url.is_page("cart")?"s-product-options-option-content-full-width":"")},t.getDisplayForType(n))))}))))};t.prototype.generateUniqueKey=function(t){return this.uniqueKey?"".concat(t,"-").concat(this.uniqueKey):t};t.prototype.fillSelectedOptions=function(){this.selectedOptions=this.optionsData.reduce((function(t,n){var i=n.details.filter((function(t){return t.is_selected}));var o=i.map((function(t){return Object.assign(Object.assign({},t),{option_id:n.id})}));return t.concat(o)}),[])};t.prototype.triggerProductFormSelectionEvents=function(){var t=this;var n=function(t){return["change","input"].forEach((function(n){return t.dispatchEvent(new window.Event(n,{bubbles:true}))}))};var i=this.host.closest("form");if(i){n(i)}else{var o=new MutationObserver((function(){var i=t.host.closest("form");if(i){n(i);o.disconnect()}}));o.observe(document.body,{childList:true,subtree:true})}};t.prototype.componentDidLoad=function(){var t=this;var n,i;if(salla.url.is_page("product.single")){this.triggerProductFormSelectionEvents()}if(((n=this.optionsData)===null||n===void 0?void 0:n.length)===0&&!this.optionsData.some((function(t){return t.type===DisplayType.DONATION}))){return}var o=(i=this.optionsData.find((function(t){return t.type===DisplayType.DONATION})))===null||i===void 0?void 0:i.details.find((function(t){return t.is_selected}));if(!o){return}setTimeout((function(){salla.event.emit("product-options::donation-changed",{id:t.productId,price:o.additional_price})}),1e3)};t.prototype.donationOption=function(t,n){var i=this;var o,r;return h("div",{class:"s-product-options-donation-wrapper"},((o=t.donation)===null||o===void 0?void 0:o.can_donate)?[t.donation?h("div",{key:t.id,class:"s-product-options-donation-progress"},h("salla-progress-bar",{donation:t.donation})):"",t.details.length?[h("h4",{key:t.id},this.selectAmount),h("div",{key:t.id,class:"s-product-options-donation-options"},t.details.map((function(n,o){return h("div",{key:t.id,class:"s-product-options-donation-options-item"},h("input",{id:i.generateUniqueKey("donation-option-".concat(o)),type:"radio",name:"donating_option",checked:n.is_selected,value:n.additional_price,onChange:function(t){return i.handleDonationOptions(t,n,"option")}}),h("label",{htmlFor:i.generateUniqueKey("donation-option-".concat(o))},h("span",{innerHTML:salla.money(n.name)})))})),((r=t.donation)===null||r===void 0?void 0:r.custom_amount_enabled)?h("div",{class:"s-product-options-donation-options-item"},h("input",{id:this.generateUniqueKey("donation-option-custom"),type:"radio",name:"donating_option",value:"custom",onChange:function(t){return i.handleDonationOptions(t,"custom","option")}}),h("label",{htmlFor:this.generateUniqueKey("donation-option-custom")},h("span",null," ",this.selectDonationAmount," "))):"")]:"",h("div",{key:t.id,class:{"s-product-options-donation-input-group":true,shown:!t.details.length||t.details.length&&this.isCustomDonation}},h("input",{type:"text",id:"donating-amount",name:"donation_amount",class:"s-form-control",ref:function(t){i.donationInput=t},value:t.details.length&&t.details.some((function(t){return t.is_selected}))?t.details.find((function(t){return t.is_selected})).additional_price:t.value,placeholder:t.placeholder,onInput:function(t){return i.handleDonationOptions(t,"custom","input")},onBlur:function(n){return i.changedHandler(n,t)},onInvalid:function(n){return i.invalidHandler(n,t)}}),h("span",{class:"s-product-options-donation-amount-currency"},salla.config.currency(salla.config.get("user.currency_code")).symbol))]:this.getExpireDonationMessage(t))};t.prototype.fileUploader=function(t,n){var i=this;if(n===void 0){n=null}var o;return h("salla-file-upload",Object.assign({},n||{},{"payload-name":"file",value:t.value,"instant-upload":true,name:"options[".concat(t.id,"]"),required:!t.visibility_condition&&t.required,height:"120px",onAdded:function(n){return i.changedHandler(n,t)},url:salla.cart.api.getUploadImageEndpoint(),"form-data":{cart_item_id:this.productId,product_id:this.productId},onInvalidInput:function(n){return i.invalidHandler(n,t)},class:{"s-product-options-image-input":true,required:t.required}}),h("div",{class:"s-product-options-filepond-placeholder"},h("span",{class:"s-product-options-filepond-placeholder-icon",innerHTML:((o=n.accept)===null||o===void 0?void 0:o.split(",").every((function(t){return t.includes("image")})))?CameraIcon:FileIcon}),h("p",{class:"s-product-options-filepond-placeholder-text"},salla.lang.get("common.uploader.drag_and_drop")),h("span",{class:"filepond--label-action"},salla.lang.get("common.uploader.browse"))))};t.prototype.imageOption=function(t){return this.fileUploader(t,{accept:"image/png,image/jpeg,image/jpg,image/gif"})};t.prototype.fileOption=function(t){var n=this;var i=t.details.map((function(t){return n.fileTypes[t.name]})).filter(Boolean);return(i===null||i===void 0?void 0:i.length)?this.fileUploader(t,{accept:i.join(",")}):"File types not selected."};t.prototype.numberOption=function(t){var n=this;return h("input",{type:"text",value:t.value,class:"s-form-control",required:!t.visibility_condition&&t.required,name:"options[".concat(t.id,"]"),placeholder:t.placeholder,onBlur:function(i){return n.changedHandler(i,t)},onInvalid:function(i){return n.invalidHandler(i,t)},onInput:function(t){return salla.helpers.inputDigitsOnly(t.target)}})};t.prototype.splitterOption=function(){return h("div",{class:"s-product-options-splitter"})};t.prototype.textOption=function(t){var n=this;return h("div",{class:"s-product-options-text"},h("input",{type:"text",value:t.value,maxLength:t===null||t===void 0?void 0:t.length,class:"s-form-control",required:!t.visibility_condition&&t.required,name:"options[".concat(t.id,"]"),placeholder:t.placeholder,onInvalid:function(i){return n.invalidHandler(i,t)},onChange:function(i){return n.changedHandler(i,t)}}))};t.prototype.textareaOption=function(t){var n=this;return h("div",{class:"s-product-options-textarea"},h("div",{class:"mt-1"},h("textarea",{rows:4,value:t.value,maxLength:t===null||t===void 0?void 0:t.length,class:"s-form-control",required:!t.visibility_condition&&t.required,id:"options[".concat(t.id,"]"),name:"options[".concat(t.id,"]"),placeholder:t.placeholder,onInvalid:function(i){return n.invalidHandler(i,t)},onChange:function(i){return n.changedHandler(i,t)}})))};t.prototype.mapOption=function(t){var n=this;return h("salla-map",{zoom:15,lat:this.getLatLng(t.value,"lat"),lng:this.getLatLng(t.value,"lng"),name:"options[".concat(t.id,"]"),searchable:true,required:t.required,onInvalidInput:function(i){return n.invalidHandler(i,t)},onSelected:function(i){return n.changedHandler(i,t)}})};t.prototype.colorPickerOption=function(t){var n=this;return h("salla-color-picker",{onSubmitted:function(i){return n.changedHandler(i,t)},name:"options[".concat(t.id,"]"),required:!t.visibility_condition&&t.required,onInvalidInput:function(i){return n.invalidHandler(i,t)},color:t.value})};t.prototype.timeOption=function(t){var n=this;return h("salla-datetime-picker",{noCalendar:true,enableTime:true,dateFormat:"h:i K",value:t.value,placeholder:t.name,required:!t.visibility_condition&&t.required,name:"options[".concat(t.id,"]"),class:"s-product-options-time-element",onInvalidInput:function(i){return n.invalidHandler(i,t)},onPicked:function(i){return n.changedHandler(i,t)}})};t.prototype.dateOption=function(t){var n=this;return h("div",{class:"s-product-options-date-element"},h("salla-datetime-picker",{value:t.value,placeholder:t.name,required:!t.visibility_condition&&t.required,minDate:new Date,name:"options[".concat(t.id,"]"),onInvalidInput:function(i){return n.invalidHandler(i,t)},onPicked:function(i){return n.changedHandler(i,t)}}))};t.prototype.datetimeOption=function(t){var n=this;return h("div",{class:"s-product-options-datetime-element"},h("salla-datetime-picker",{enableTime:true,value:t.value,dateFormat:"Y-m-d G:i:K",placeholder:t.name,required:!t.visibility_condition&&t.required,name:"options[".concat(t.id,"]"),maxDate:t.to_date_time,minDate:t.from_date_time,onInvalidInput:function(i){return n.invalidHandler(i,t)},onPicked:function(i){return n.changedHandler(i,t)}}))};t.prototype.getOptionDetailName=function(t,n,i){if(n===void 0){n=true}var o;var r;if(i&&i===DisplayType.COLOR){r=t.name+(n&&this.isOptionDetailOut(t)&&!salla.url.is_page("cart")&&!this.hideOutLabel?" <br/> <p> ".concat(this.outOfStockText," </p>"):"")+(t.additional_price?" <p> (".concat(salla.money(t.additional_price,false),") </p>"):"")}if(!r){r=t.name+(n&&this.isOptionDetailOut(t)&&!salla.url.is_page("cart")&&!this.hideOutLabel?" - ".concat(this.outOfStockText):"")+(t.additional_price?" (".concat(salla.money(t.additional_price,false),")"):"")}return r.replace("<i class=sicon-sar></i>",((o=salla.config.currency())===null||o===void 0?void 0:o.symbol)||"ر.س")};t.prototype.isOptionDetailOut=function(t){var n=this;var i;if(t.is_out||!t.skus_availability||!((i=this.selectedSkus)===null||i===void 0?void 0:i.length)){return t.is_out}var o=this.selectedOptions.filter((function(n){return n.id===t.id})).length;if(o&&this.selectedOptions.length===1){return false}if(o){var r=this.selectedSkus.filter((function(t){return n.outSkus.includes(t)}));return Object.keys(t.skus_availability).some((function(t){return r.includes(Number(t))}))}return this.selectedOptions.some((function(n){return n.is_out&&n.option_id!==t.option_id}))};t.prototype.renderInput=function(t,n,i,o,r,e){var a=this;var s=this.generateUniqueKey("".concat(t,"-").concat(i.id,"-").concat(n.id));var u=this.isOptionDetailOut(n);return h("label",{class:{"s-product-options-disabled":u}},h("input",{id:s,type:t,name:r,value:n.id,disabled:u,required:o,checked:n.is_selected,onInvalid:function(t){return a.invalidHandler(t,i)},onChange:function(t){return a.changedHandler(t,i)}}),h("div",{class:{"s-product-options-grid-mode-span":e,"s-product-options-disabled":u}},this.getOptionDetailName(n)))};t.prototype.renderOptionDetails=function(t,n,i,o){var r=this;if(o===void 0){o=false}var e=t==="radio"?"options[".concat(n.id,"]"):"options[".concat(n.id,"][]");return n===null||n===void 0?void 0:n.details.map((function(a){return r.renderInput(t,a,n,i,e,o)}))};t.prototype.renderSelect=function(t){var n=this;return h("div",null,h("select",{name:"options[".concat(t.id,"]"),required:!t.visibility_condition&&t.required,class:"s-form-control",onInvalid:function(i){return n.invalidHandler(i,t)},onChange:function(i){return n.changedHandler(i,t)}},h("option",{value:""},t.placeholder),t===null||t===void 0?void 0:t.details.map((function(t){return h("option",{key:t.id,value:t.id,disabled:n.canDisabled&&n.isOptionDetailOut(t),selected:t.is_selected},n.getOptionDetailName(t))}))))};t.prototype.renderButtonStyle=function(t,n,i){return h("div",{class:"s-product-options-grid-mode"},this.renderOptionDetails(t,n,i,true))};t.prototype.singleOption=function(t){var n,i;var o=((i=(n=this.optionConfig)===null||n===void 0?void 0:n["single-option"])===null||i===void 0?void 0:i.type)==="button";var r=!t.visibility_condition&&t.required;return o?this.renderButtonStyle("radio",t,r):this.renderSelect(t)};t.prototype.multipleOptions=function(t){var n,i;var o=((i=(n=this.optionConfig)===null||n===void 0?void 0:n["multiple-option"])===null||i===void 0?void 0:i.type)==="button";var r=t.required&&!t.details.some((function(t){return t.is_selected}))&&!t.visibility_condition;return o?this.renderButtonStyle("checkbox",t,r):h("div",{class:{"s-product-options-multiple-options-wrapper":true,required:t.required}},this.renderOptionDetails("checkbox",t,r))};t.prototype.colorOption=function(t){var n=this;return h("fieldset",{class:"s-product-options-colors-wrapper"},t===null||t===void 0?void 0:t.details.map((function(i){return h("div",{class:"s-product-options-colors-item",key:i.id},h("input",{type:"radio",value:i.id,required:!t.visibility_condition&&t.required,checked:i.is_selected,name:"options[".concat(t.id,"]"),disabled:n.canDisabled&&n.isOptionDetailOut(i),id:n.generateUniqueKey("color-".concat(n.productId,"-").concat(t.id,"-").concat(i.id)),onInvalid:function(i){return n.invalidHandler(i,t)},onChange:function(i){return n.changedHandler(i,t)}}),h("label",{htmlFor:n.generateUniqueKey("color-".concat(n.productId,"-").concat(t.id,"-").concat(i.id))},h("span",{style:{backgroundColor:i.color}}),h("div",{innerHTML:n.getOptionDetailName(i,true,t.type)})))})))};t.prototype.thumbnailOption=function(t){var n=this;return h("div",{class:"s-product-options-thumbnails-wrapper"},t.details.map((function(i){return h("div",{key:i.id},h("input",{type:"radio",value:i.id,"data-itemid":i.id,required:!t.visibility_condition&&t.required,checked:i.is_selected,name:"options[".concat(t.id,"]"),"data-img-id":i.option_value,disabled:n.canDisabled&&n.isOptionDetailOut(i),id:n.generateUniqueKey("option_".concat(n.productId,"-").concat(t.id,"_").concat(i.id)),onInvalid:function(i){return n.invalidHandler(i,t)},onChange:function(i){return n.changedHandler(i,t)}}),h("label",{htmlFor:n.generateUniqueKey("option_".concat(n.productId,"-").concat(t.id,"_").concat(i.id)),"data-img-id":i.option_value,class:"go-to-slide"},h("img",{"data-src":i.image,src:i.image,title:i.name,alt:i.name}),h("span",{innerHTML:IconVerified,class:"s-product-options-thumbnails-icon"}),n.isOptionDetailOut(i)?[h("small",{key:i.id,class:"s-product-options-thumbnails-stock-badge"},n.outOfStockText),n.canDisabled?h("div",{key:i.id,class:"s-product-options-thumbnails-badge-overlay"}):""]:""),h("p",null,n.getOptionDetailName(i,false)," "))})))};t.prototype.digitalCardValuesOption=function(t){var n=this;return h("div",{class:"s-product-options-digital-card-wrapper"},this.availableDigitalCardValues.length>0?this.availableDigitalCardValues.map((function(i){var o,r,e;var a=String(i.id);return h("label",{htmlFor:n.generateUniqueKey(a.toString()),key:a,class:"s-product-options-digital-card-option"},h("input",Object.assign({type:"radio","data-code-value":true,class:"s-form-control s-product-options-digital-card-input",value:i.id,name:"options[".concat(t.id,"]"),id:n.generateUniqueKey(a.toString()),required:!t.visibility_condition&&t.required,onInvalid:function(i){return n.invalidHandler(i,t)}},!n.ignoreDefaultCardValue?{defaultChecked:((o=n.getSelectedDigitalCardOptions(t))===null||o===void 0?void 0:o.id)===i.id}:{})),h("span",null,i.name," ",(e=(r=salla.config)===null||r===void 0?void 0:r.currency())===null||e===void 0?void 0:e.symbol))})):h("div",{class:"s-product-options-digital-card-out-of-stock"}))};t.prototype.countryOption=function(t){var n=this;return h("div",{class:"s-product-options-digital-card-wrapper"},t.details.map((function(i){var o;return h("label",{htmlFor:n.generateUniqueKey(i.id.toString()),key:i.id,class:{"s-product-options-digital-card-option":true,"s-product-options-digital-card-option-stock-out":i.is_out}},h("input",Object.assign({id:n.generateUniqueKey(i.id.toString()),type:"radio",class:"s-form-control s-product-options-digital-card-input",value:i.id,name:"options[".concat(t.id,"]"),disabled:i.is_out,required:!t.visibility_condition&&t.required,onInvalid:function(i){return n.invalidHandler(i,t)},onChange:function(i){return n.changedHandler(i,t)},onClick:function(){n.disableCardValue=false}},salla.url.is_page("cart")?{defaultChecked:((o=n.getSelectedDigitalCardOptions(t))===null||o===void 0?void 0:o.id)===i.id}:{})),h("img",{loading:"lazy",alt:i.code,height:24,width:24,class:"s-product-options-country-flag",src:"https://cdn.assets.salla.network/prod/admin/cp/assets/flags/1x1/".concat(String(i.code).toLocaleLowerCase(),".svg")}),h("span",null,i.name))})))};Object.defineProperty(t.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();SallaProductOptions.style=sallaProductOptionsCss;export{SallaProductOptions as salla_product_options};
|
|
4
|
+
*/import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-Hw2jlaNN.js";import{I as IconVerified}from"./check-uTyAzPSy.js";import{C as CameraIcon}from"./camera-C6jIkM-X.js";var DisplayType;(function(t){t["COLOR"]="color";t["DATE"]="date";t["DATETIME"]="datetime";t["DONATION"]="donation";t["IMAGE"]="image";t["MULTIPLE_OPTIONS"]="multiple-options";t["NUMBER"]="number";t["SINGLE_OPTION"]="single-option";t["DIGITAL_CARD_VALUE"]="digital-code-value";t["COUNTRY"]="country";t["SPLITTER"]="splitter";t["TEXT"]="text";t["TEXTAREA"]="textarea";t["THUMBNAIL"]="thumbnail";t["TIME"]="time";t["RADIO"]="radio";t["CHECKBOX"]="checkbox";t["MAP"]="map";t["FILE"]="file";t["COLOR_PICKER"]="color_picker";t["BOOKING"]="booking"})(DisplayType||(DisplayType={}));var Currency;(function(t){t["Sar"]="SAR"})(Currency||(Currency={}));var FileIcon='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>file-upload</title>\n<path d="M21.333 24c0.341 0 0.683-0.131 0.943-0.391 0.521-0.521 0.521-1.364 0-1.885l-5.333-5.333c-0.123-0.123-0.271-0.22-0.433-0.288-0.327-0.135-0.693-0.135-1.019 0-0.163 0.068-0.311 0.165-0.433 0.288l-5.333 5.333c-0.521 0.521-0.521 1.364 0 1.885s1.364 0.521 1.885 0l3.057-3.057v10.115c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-10.115l3.057 3.057c0.26 0.26 0.601 0.391 0.943 0.391zM28.943 9.724l-9.333-9.333c-0.249-0.251-0.589-0.391-0.943-0.391h-12c-2.205 0-4 1.795-4 4v24c0 2.205 1.795 4 4 4h4c0.736 0 1.333-0.597 1.333-1.333s-0.597-1.333-1.333-1.333h-4c-0.735 0-1.333-0.599-1.333-1.333v-24c0-0.735 0.599-1.333 1.333-1.333h11.448l8.552 8.552v16.781c0 0.735-0.599 1.333-1.333 1.333h-4c-0.736 0-1.333 0.597-1.333 1.333s0.597 1.333 1.333 1.333h4c2.205 0 4-1.795 4-4v-17.333c0-0.353-0.14-0.693-0.391-0.943z"></path>\n</svg>\n';var sallaProductOptionsCss="";var SallaProductOptions=function(){function t(t){var n=this;registerInstance(this,t);this.changed=createEvent(this,"changed");this.fileTypes={pdf:"application/pdf",png:"image/png",jpg:"image/jpeg",word:"application/doc,application/ms-doc,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document",exl:"application/excel,application/vnd.ms-excel,application/x-excel,application/x-msexcel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",txt:"text/plain"};this.outOfStockText="";this.donationAmount=salla.lang.get("pages.products.donation_amount");this.selectDonationAmount=salla.lang.getWithDefault("pages.products.select_donation_amount","تحديد مبلغ التبرع");this.selectAmount=salla.lang.getWithDefault("pages.products.select_amount","اختر المبلغ");this.isCustomDonation=false;this.selectedOptions=[];this.disableCardValue=true;this.availableDigitalCardValues=[];this.outSkus=[];this.ignoreDefaultCardValue=false;this.productId=salla.config.get("page.id");this.handleDonationOptions=function(t,i,o){if(i==="custom"&&o==="input"){salla.helpers.inputDigitsOnly(t.target);salla.event.emit("product-options::donation-changed",{id:n.productId,price:t.target.value});return}t.preventDefault();t.stopPropagation();n.isCustomDonation=t.target.value==="custom";if(n.donationInput){if(t.target.value==="custom"){n.donationInput.value="";n.donationInput.focus()}else{n.donationInput.value=t.target.value}if(i==="custom"){return}salla.event.emit("product-options::donation-changed",{id:n.productId,price:t.target.value})}};this.hideLabel=function(t){if(t.type===DisplayType.DONATION&&(t.donation&&!t.donation.can_donate)){return true}return false};this.getExpireDonationMessage=function(t){if(!t.donation){return}var n=t.donation.target_amount<=t.donation.collected_amount;return h("div",{class:{"s-product-options-donation-message":true,"s-product-options-donation-completed":n,"s-product-options-donation-expired":!n}},h("p",null,t.donation.target_message),h("span",{innerHTML:n?salla.money(t.donation.target_amount):""}))};this.canDisabled=!salla.config.get("store.settings.product.notify_options_availability")||salla.url.is_page("cart");salla.lang.onLoaded((function(){n.outOfStockText=salla.lang.get("pages.products.out_of_stock");n.donationAmount=salla.lang.get("pages.products.donation_amount");n.selectDonationAmount=salla.lang.getWithDefault("pages.products.select_donation_amount","تحديد مبلغ التبرع");n.selectAmount=salla.lang.getWithDefault("pages.products.select_amount","اختر المبلغ")}));if(this.options){try{this.setOptionsData(Array.isArray(this.options)?this.options:JSON.parse(this.options));return}catch(t){salla.log("Bad json passed via options prop")}}if(!Array.isArray(this.optionsData)){salla.log("Options is not an array[] ---\x3e ",this.optionsData);this.setOptionsData([])}if(this.productId&&!salla.url.is_page("cart")){salla.api.product.getDetails(this.productId,["options"]).then((function(t){return n.setOptionsData(t.data.options)}))}}t.prototype.setOptionsData=function(t){return __awaiter(this,void 0,void 0,(function(){var n,i,o;return __generator(this,(function(r){this.optionsData=t;o=this;(i=(n=this.optionsData[0])===null||n===void 0?void 0:n.details)===null||i===void 0?void 0:i.forEach((function(t){Object.entries(t.skus_availability||{}).filter((function(t){return!t[1]})).map((function(t){return o.outSkus.push(Number(t[0]))}))}));return[2]}))}))};t.prototype.getSelectedOptionsData=function(){return __awaiter(this,void 0,void 0,(function(){var t,n;return __generator(this,(function(i){t={};n=this.host.getElementSallaData();n.forEach((function(n,i){if(i.startsWith("options[")){t[i.replace("options[","").replace("]","")]=n}}));return[2,t]}))}))};t.prototype.reportValidity=function(){return __awaiter(this,void 0,void 0,(function(){var t,n,i;return __generator(this,(function(o){t=this.host.querySelectorAll("[required]");n=true;for(i=0;i<t.length;i++){if("reportValidity"in t[i]&&!t[i].reportValidity()){n=false}}return[2,n]}))}))};t.prototype.hasOutOfStockOption=function(){return __awaiter(this,void 0,void 0,(function(){var t,n;var i=this;return __generator(this,(function(o){return[2,this.selectedOptions.some((function(t){return t.is_out}))||((t=this.selectedSkus)===null||t===void 0?void 0:t.length)&&((n=this.selectedSkus)===null||n===void 0?void 0:n.every((function(t){return i.outSkus.includes(t)})))]}))}))};t.prototype.getSelectedOptions=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,this.selectedOptions]}))}))};t.prototype.getOption=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){return[2,this.optionsData.find((function(n){return n.id===t}))]}))}))};t.prototype.invalidHandler=function(t,n){var i=t.target.closest(".s-product-options-option");if(!i.classList.contains("s-product-options-option-error")){i.classList.add("s-product-options-option-error")}if(!salla.url.is_page("cart")){var o=this.host.querySelector(".s-product-options-option-error");if(o===i){this.scrollToElement(i)}}};t.prototype.scrollToElement=function(t){if(t){t.scrollIntoView({behavior:"smooth",block:"center"})}};t.prototype.changedHandler=function(t,n,i){var o=this;if(i===void 0){i=true}var r={event:t,option:n,detail:null,productId:this.productId};if(n.details){var e=n.details.find((function(n){return Number(n.id)===Number(t.target.value)}));r.detail=e}if(n.type==="country"){this.handleCountryOptionChange(t,r.detail)}var a=t.target.closest(".s-product-options-option");if(t.target.value||(n.type===DisplayType.FILE||n.type===DisplayType.IMAGE)&&t.type==="added"||n.type===DisplayType.MAP&&t.type==="selected"&&(t.target.lat&&t.target.lng)){setTimeout((function(){a.classList.remove("s-product-options-option-error")}),200)}if(n.type===DisplayType.DONATION){salla.event.emit("product-options::donation-changed",{id:this.productId,price:t.target.value})}this.setSelectedSkus();this.handleRequiredMultipleOptions(n);var s=this.selectedOptions.findIndex((function(t){return t.option_id===r.option.id}));if(r.option.type===DisplayType.MULTIPLE_OPTIONS){var u=this.selectedOptions.findIndex((function(t){var n;return t.option_id===r.option.id&&(t===null||t===void 0?void 0:t.id)===((n=r.detail)===null||n===void 0?void 0:n.id)}));if(u>-1){this.selectedOptions.splice(u,1)}else{this.selectedOptions.push(Object.assign(Object.assign({},r.detail),{option_id:r.option.id}))}}else{if(!r.detail||Object.keys(r.detail).length===0){if(s>-1){this.selectedOptions.splice(s,1)}}else{if(s>-1){this.selectedOptions[s]=Object.assign(Object.assign({},r.detail),{option_id:r.option.id})}else{this.selectedOptions.push(Object.assign(Object.assign({},r.detail),{option_id:r.option.id}))}}}this.optionsData=this.optionsData.map((function(t){if(t.id===r.option.id){return Object.assign(Object.assign({},t),{details:t.details.map((function(t){var n,i;return Object.assign(Object.assign({},t),{is_selected:r.option.type===DisplayType.MULTIPLE_OPTIONS?o.selectedOptions.some((function(n){return n.id===t.id})):Number(t.id)===Number((n=r.detail)===null||n===void 0?void 0:n.id),value:(i=r.detail)===null||i===void 0?void 0:i.value})}))})}return t}));if(i){this.changed.emit(r);salla.event.emit("product-options::change",r)}};t.prototype.setSelectedSkus=function(){this.selectedSkus=this.selectedOptions.map((function(t){return Object.keys(t.skus_availability||{})})).reduce((function(t,n){return t.filter((function(t){return n.includes(t)}))}),[]).map((function(t){return Number(t)}))};t.prototype.handleRequiredMultipleOptions=function(t){if(t.type!==DisplayType.MULTIPLE_OPTIONS||!t.required){return}var n=this.host.querySelector('[data-option-id="'.concat(t.id,'"]'));var i=n.querySelectorAll("input:checked").length;n.querySelectorAll("input").forEach((function(t){return t.toggleAttribute("required",!i)}))};t.prototype.getLatLng=function(t,n){return t?t.split(",")[n==="lat"?0:1]:""};t.prototype.getDisplayForType=function(t){var n=this;if(this["".concat(t.type,"Option")]){return this["".concat(t.type,"Option")](t)}if(t.type===DisplayType.COLOR_PICKER){return this.colorPickerOption(t)}if(t.type===DisplayType.MULTIPLE_OPTIONS){return this.multipleOptions(t)}if(t.type===DisplayType.SINGLE_OPTION){return this.singleOption(t)}if(t.type===DisplayType.DIGITAL_CARD_VALUE){return this.digitalCardValuesOption(t)}if(t.type===DisplayType.COUNTRY){return this.countryOption(t)}if(t.type===DisplayType.BOOKING&&salla.url.is_page("cart")){return h("salla-booking-field",{onInvalidInput:function(i){return n.invalidHandler(i,t)},option:t,productId:t.value})}salla.log("Couldn't find options type(".concat(t.type,")😢"));return""};t.prototype.getOptionShownWhen=function(t){return t.visibility_condition?{"data-show-when":"options[".concat(t.visibility_condition.option,"] ").concat(t.visibility_condition.operator," ").concat(t.visibility_condition.value)}:{}};t.prototype.getAvailableDigitalCardSKUs=function(t){var n=this.optionsData.find((function(t){var n=t.type;return n==="digital-code-value"}));if(!n)throw new Error("product-options:: No digital card options found");var i=Object.keys(t.skus_availability).filter((function(n){return t.skus_availability[n]===false}));this.availableDigitalCardValues=n.details.filter((function(t){return!Object.keys(t.skus_availability).filter((function(t){return i.includes(t)})).length}))};t.prototype.handleCountryOptionChange=function(t,n){t.stopImmediatePropagation();this.ignoreDefaultCardValue=true;var i=this.host.querySelector("input[data-code-value]:checked");if(i)i.checked=false;var o=this.optionsData.find((function(t){var n=t.type;return n==="digital-code-value"}));if(!o)throw new Error("product-options:: No digital card options found");this.getAvailableDigitalCardSKUs(n)};t.prototype.getSelectedDigitalCardOptions=function(t){var n=t.details.find((function(t){return t.is_selected}));var i=t.details.find((function(t){return!!t.is_default}))||t.details[0];if(!["digital-code-value","country"].includes(t.type))return;return n||i};t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var t,n,i,o;return __generator(this,(function(r){switch(r.label){case 0:if(salla.url.is_page("cart")){this.disableCardValue=false;this.fillSelectedOptions()}if(this.config){try{this.optionConfig=typeof this.config==="string"?JSON.parse(this.config):this.config}catch(t){console.error("Failed to parse JSON in config prop:",t)}}t=this.optionsData.filter((function(t){var n=t.type;return["country","digital-card-value"].includes(n)})).length>0&&salla.url.is_page("cart");if(t){n=this.optionsData.find((function(t){return t.type==="country"}));i=n&&this.getSelectedDigitalCardOptions(n);if(i){this.getAvailableDigitalCardSKUs(i)}}this.outOfStockText=salla.lang.get("pages.products.out_of_stock");return[4,salla.onReady()];case 1:r.sent();document.addEventListener("paste",this.handlePaste.bind(this));o=!salla.storage.get("cart.id")&&this.optionsData.some((function(t){return["file","image"].includes(t.type)}));return[2,o?salla.api.cart.getCurrentCartId(false,"salla-product-options"):null]}}))}))};t.prototype.handlePaste=function(t){var n;var i=t.target;if(!Salla.config.get("store.settings.content_copyright")||!Salla.helpers.hasApplePay()||!(i instanceof HTMLInputElement||i instanceof HTMLTextAreaElement)||!i.classList.contains("s-form-control")||!i.name.startsWith("options[")){return}t.preventDefault();var o=((n=t.clipboardData)===null||n===void 0?void 0:n.getData("text"))||"";var r=i.selectionStart;var e=i.selectionEnd;var a=i.value.slice(0,r)+o+i.value.slice(e);i.value=a;i.setSelectionRange(r+o.length,r+o.length)};t.prototype.hideDigitalCardsOptions=function(t){return this.disableCardValue&&t.type===DisplayType.DIGITAL_CARD_VALUE&&!salla.url.is_page("cart")};t.prototype.render=function(){var t=this;var n;if(((n=this.optionsData)===null||n===void 0?void 0:n.length)===0){return}return h(Host,{class:"s-product-options-wrapper"},h("salla-conditional-fields",null,this.optionsData.map((function(n){return h("div",Object.assign({key:n.id,class:"s-product-options-option-container".concat(n.visibility_condition||t.hideDigitalCardsOptions(n)?" hidden":""),"data-option-id":n.id},t.getOptionShownWhen(n)),n.name==="splitter"?t.splitterOption():h("div",{class:{"s-product-options-option":true,"s-product-options-option-booking":n.type===DisplayType.BOOKING&&salla.url.is_page("cart")},"data-option-type":n.type,"data-option-required":"".concat(n.required)},h("label",{htmlFor:"options[".concat(n.id,"]"),class:"s-product-options-option-label ".concat(t.hideLabel(n)?"s-product-options-option-label-hidden":"")},h("b",null,n.name,n.required&&h("span",null," * ")," "),h("small",null,n.placeholder)),h("div",{class:"s-product-options-option-content ".concat(t.hideLabel(n)||n.type===DisplayType.BOOKING&&salla.url.is_page("cart")?"s-product-options-option-content-full-width":"")},t.getDisplayForType(n))))}))))};t.prototype.generateUniqueKey=function(t){return this.uniqueKey?"".concat(t,"-").concat(this.uniqueKey):t};t.prototype.fillSelectedOptions=function(){this.selectedOptions=this.optionsData.reduce((function(t,n){var i=n.details.filter((function(t){return t.is_selected}));var o=i.map((function(t){return Object.assign(Object.assign({},t),{option_id:n.id})}));return t.concat(o)}),[])};t.prototype.triggerProductFormSelectionEvents=function(){var t=this;var n=function(t){return["change","input"].forEach((function(n){return t.dispatchEvent(new window.Event(n,{bubbles:true}))}))};var i=this.host.closest("form");if(i){n(i)}else{var o=new MutationObserver((function(){var i=t.host.closest("form");if(i){n(i);o.disconnect()}}));o.observe(document.body,{childList:true,subtree:true})}};t.prototype.componentDidLoad=function(){var t=this;var n,i;if(salla.url.is_page("product.single")){this.triggerProductFormSelectionEvents()}if(((n=this.optionsData)===null||n===void 0?void 0:n.length)===0&&!this.optionsData.some((function(t){return t.type===DisplayType.DONATION}))){return}var o=(i=this.optionsData.find((function(t){return t.type===DisplayType.DONATION})))===null||i===void 0?void 0:i.details.find((function(t){return t.is_selected}));if(!o){return}setTimeout((function(){salla.event.emit("product-options::donation-changed",{id:t.productId,price:o.additional_price})}),1e3)};t.prototype.donationOption=function(t,n){var i=this;var o,r;return h("div",{class:"s-product-options-donation-wrapper"},((o=t.donation)===null||o===void 0?void 0:o.can_donate)?[t.donation?h("div",{key:t.id,class:"s-product-options-donation-progress"},h("salla-progress-bar",{donation:t.donation})):"",t.details.length?[h("h4",{key:t.id},this.selectAmount),h("div",{key:t.id,class:"s-product-options-donation-options"},t.details.map((function(n,o){return h("div",{key:t.id,class:"s-product-options-donation-options-item"},h("input",{id:i.generateUniqueKey("donation-option-".concat(o)),type:"radio",name:"donating_option",checked:n.is_selected,value:n.additional_price,onChange:function(t){return i.handleDonationOptions(t,n,"option")}}),h("label",{htmlFor:i.generateUniqueKey("donation-option-".concat(o))},h("span",{innerHTML:salla.money(n.name)})))})),((r=t.donation)===null||r===void 0?void 0:r.custom_amount_enabled)?h("div",{class:"s-product-options-donation-options-item"},h("input",{id:this.generateUniqueKey("donation-option-custom"),type:"radio",name:"donating_option",value:"custom",onChange:function(t){return i.handleDonationOptions(t,"custom","option")}}),h("label",{htmlFor:this.generateUniqueKey("donation-option-custom")},h("span",null," ",this.selectDonationAmount," "))):"")]:"",h("div",{key:t.id,class:{"s-product-options-donation-input-group":true,shown:!t.details.length||t.details.length&&this.isCustomDonation}},h("input",{type:"text",id:"donating-amount",name:"donation_amount",class:"s-form-control",ref:function(t){i.donationInput=t},value:t.details.length&&t.details.some((function(t){return t.is_selected}))?t.details.find((function(t){return t.is_selected})).additional_price:t.value,placeholder:t.placeholder,onInput:function(t){return i.handleDonationOptions(t,"custom","input")},onBlur:function(n){return i.changedHandler(n,t)},onInvalid:function(n){return i.invalidHandler(n,t)}}),h("span",{class:"s-product-options-donation-amount-currency"},salla.config.currency(salla.config.get("user.currency_code")).symbol))]:this.getExpireDonationMessage(t))};t.prototype.fileUploader=function(t,n){var i=this;if(n===void 0){n=null}var o;return h("salla-file-upload",Object.assign({},n||{},{"payload-name":"file",value:t.value,"instant-upload":true,name:"options[".concat(t.id,"]"),required:!t.visibility_condition&&t.required,height:"120px",onAdded:function(n){return i.changedHandler(n,t)},url:salla.cart.api.getUploadImageEndpoint(),"form-data":{cart_item_id:this.productId,product_id:this.productId},onInvalidInput:function(n){return i.invalidHandler(n,t)},class:{"s-product-options-image-input":true,required:t.required}}),h("div",{class:"s-product-options-filepond-placeholder"},h("span",{class:"s-product-options-filepond-placeholder-icon",innerHTML:((o=n.accept)===null||o===void 0?void 0:o.split(",").every((function(t){return t.includes("image")})))?CameraIcon:FileIcon}),h("p",{class:"s-product-options-filepond-placeholder-text"},salla.lang.get("common.uploader.drag_and_drop")),h("span",{class:"filepond--label-action"},salla.lang.get("common.uploader.browse"))))};t.prototype.imageOption=function(t){return this.fileUploader(t,{accept:"image/png,image/jpeg,image/jpg,image/gif"})};t.prototype.fileOption=function(t){var n=this;var i=t.details.map((function(t){return n.fileTypes[t.name]})).filter(Boolean);return(i===null||i===void 0?void 0:i.length)?this.fileUploader(t,{accept:i.join(",")}):"File types not selected."};t.prototype.numberOption=function(t){var n=this;return h("input",{type:"text",value:t.value,class:"s-form-control",required:!t.visibility_condition&&t.required,name:"options[".concat(t.id,"]"),placeholder:t.placeholder,onBlur:function(i){return n.changedHandler(i,t)},onInvalid:function(i){return n.invalidHandler(i,t)},onInput:function(t){return salla.helpers.inputDigitsOnly(t.target)}})};t.prototype.splitterOption=function(){return h("div",{class:"s-product-options-splitter"})};t.prototype.textOption=function(t){var n=this;return h("div",{class:"s-product-options-text"},h("input",{type:"text",value:t.value,maxLength:t===null||t===void 0?void 0:t.length,class:"s-form-control",required:!t.visibility_condition&&t.required,name:"options[".concat(t.id,"]"),placeholder:t.placeholder,onInvalid:function(i){return n.invalidHandler(i,t)},onChange:function(i){return n.changedHandler(i,t)}}))};t.prototype.textareaOption=function(t){var n=this;return h("div",{class:"s-product-options-textarea"},h("div",{class:"mt-1"},h("textarea",{rows:4,value:t.value,maxLength:t===null||t===void 0?void 0:t.length,class:"s-form-control",required:!t.visibility_condition&&t.required,id:"options[".concat(t.id,"]"),name:"options[".concat(t.id,"]"),placeholder:t.placeholder,onInvalid:function(i){return n.invalidHandler(i,t)},onChange:function(i){return n.changedHandler(i,t)}})))};t.prototype.mapOption=function(t){var n=this;return h("salla-map",{zoom:15,lat:this.getLatLng(t.value,"lat"),lng:this.getLatLng(t.value,"lng"),name:"options[".concat(t.id,"]"),searchable:true,required:t.required,onInvalidInput:function(i){return n.invalidHandler(i,t)},onSelected:function(i){return n.changedHandler(i,t)}})};t.prototype.colorPickerOption=function(t){var n=this;return h("salla-color-picker",{onSubmitted:function(i){return n.changedHandler(i,t)},name:"options[".concat(t.id,"]"),required:!t.visibility_condition&&t.required,onInvalidInput:function(i){return n.invalidHandler(i,t)},color:t.value})};t.prototype.timeOption=function(t){var n=this;return h("salla-datetime-picker",{noCalendar:true,enableTime:true,dateFormat:"h:i K",value:t.value,placeholder:t.name,required:!t.visibility_condition&&t.required,name:"options[".concat(t.id,"]"),class:"s-product-options-time-element",onInvalidInput:function(i){return n.invalidHandler(i,t)},onPicked:function(i){return n.changedHandler(i,t)}})};t.prototype.dateOption=function(t){var n=this;return h("div",{class:"s-product-options-date-element"},h("salla-datetime-picker",{value:t.value,placeholder:t.name,required:!t.visibility_condition&&t.required,minDate:new Date,name:"options[".concat(t.id,"]"),onInvalidInput:function(i){return n.invalidHandler(i,t)},onPicked:function(i){return n.changedHandler(i,t)}}))};t.prototype.datetimeOption=function(t){var n=this;return h("div",{class:"s-product-options-datetime-element"},h("salla-datetime-picker",{enableTime:true,value:t.value,dateFormat:"Y-m-d G:i:K",placeholder:t.name,required:!t.visibility_condition&&t.required,name:"options[".concat(t.id,"]"),maxDate:t.to_date_time,minDate:t.from_date_time,onInvalidInput:function(i){return n.invalidHandler(i,t)},onPicked:function(i){return n.changedHandler(i,t)}}))};t.prototype.getOptionDetailName=function(t,n,i){if(n===void 0){n=true}var o;var r;if(i&&i===DisplayType.COLOR){r=t.name+(n&&this.isOptionDetailOut(t)&&!salla.url.is_page("cart")&&!this.hideOutLabel?" <br/> <p> ".concat(this.outOfStockText," </p>"):"")+(t.additional_price?" <p> (".concat(salla.money(t.additional_price,false),") </p>"):"")}if(!r){r=t.name+(n&&this.isOptionDetailOut(t)&&!salla.url.is_page("cart")&&!this.hideOutLabel?" - ".concat(this.outOfStockText):"")+(t.additional_price?" (".concat(salla.money(t.additional_price,false),")"):"")}return r.replace("<i class=sicon-sar></i>",((o=salla.config.currency())===null||o===void 0?void 0:o.symbol)||"ر.س")};t.prototype.isOptionDetailOut=function(t){var n=this;var i;if(t.is_out||!t.skus_availability||!((i=this.selectedSkus)===null||i===void 0?void 0:i.length)){return t.is_out}var o=this.selectedOptions.filter((function(n){return n.id===t.id})).length;if(o&&this.selectedOptions.length===1){return false}if(o){var r=this.selectedSkus.filter((function(t){return n.outSkus.includes(t)}));return Object.keys(t.skus_availability).some((function(t){return r.includes(Number(t))}))}return this.selectedOptions.some((function(n){return n.is_out&&n.option_id!==t.option_id}))};t.prototype.renderInput=function(t,n,i,o,r,e){var a=this;var s=this.generateUniqueKey("".concat(t,"-").concat(i.id,"-").concat(n.id));var u=this.isOptionDetailOut(n);return h("label",{class:{"s-product-options-disabled":u}},h("input",{id:s,type:t,name:r,value:n.id,disabled:u,required:o,checked:n.is_selected,onInvalid:function(t){return a.invalidHandler(t,i)},onChange:function(t){return a.changedHandler(t,i)}}),h("div",{class:{"s-product-options-grid-mode-span":e,"s-product-options-disabled":u}},this.getOptionDetailName(n)))};t.prototype.renderOptionDetails=function(t,n,i,o){var r=this;if(o===void 0){o=false}var e=t==="radio"?"options[".concat(n.id,"]"):"options[".concat(n.id,"][]");return n===null||n===void 0?void 0:n.details.map((function(a){return r.renderInput(t,a,n,i,e,o)}))};t.prototype.renderSelect=function(t){var n=this;return h("div",null,h("select",{name:"options[".concat(t.id,"]"),required:!t.visibility_condition&&t.required,class:"s-form-control",onInvalid:function(i){return n.invalidHandler(i,t)},onChange:function(i){return n.changedHandler(i,t)}},h("option",{value:""},t.placeholder),t===null||t===void 0?void 0:t.details.map((function(t){return h("option",{key:t.id,value:t.id,disabled:n.canDisabled&&n.isOptionDetailOut(t),selected:t.is_selected},n.getOptionDetailName(t))}))))};t.prototype.renderButtonStyle=function(t,n,i){return h("div",{class:"s-product-options-grid-mode"},this.renderOptionDetails(t,n,i,true))};t.prototype.singleOption=function(t){var n,i;var o=((i=(n=this.optionConfig)===null||n===void 0?void 0:n["single-option"])===null||i===void 0?void 0:i.type)==="button";var r=!t.visibility_condition&&t.required;return o?this.renderButtonStyle("radio",t,r):this.renderSelect(t)};t.prototype.multipleOptions=function(t){var n,i;var o=((i=(n=this.optionConfig)===null||n===void 0?void 0:n["multiple-option"])===null||i===void 0?void 0:i.type)==="button";var r=t.required&&!t.details.some((function(t){return t.is_selected}))&&!t.visibility_condition;return o?this.renderButtonStyle("checkbox",t,r):h("div",{class:{"s-product-options-multiple-options-wrapper":true,required:t.required}},this.renderOptionDetails("checkbox",t,r))};t.prototype.colorOption=function(t){var n=this;return h("fieldset",{class:"s-product-options-colors-wrapper"},t===null||t===void 0?void 0:t.details.map((function(i){return h("div",{class:"s-product-options-colors-item",key:i.id},h("input",{type:"radio",value:i.id,required:!t.visibility_condition&&t.required,checked:i.is_selected,name:"options[".concat(t.id,"]"),disabled:n.canDisabled&&n.isOptionDetailOut(i),id:n.generateUniqueKey("color-".concat(n.productId,"-").concat(t.id,"-").concat(i.id)),onInvalid:function(i){return n.invalidHandler(i,t)},onChange:function(i){return n.changedHandler(i,t)}}),h("label",{htmlFor:n.generateUniqueKey("color-".concat(n.productId,"-").concat(t.id,"-").concat(i.id))},h("span",{style:{backgroundColor:i.color}}),h("div",{innerHTML:n.getOptionDetailName(i,true,t.type)})))})))};t.prototype.thumbnailOption=function(t){var n=this;return h("div",{class:"s-product-options-thumbnails-wrapper"},t.details.map((function(i){return h("div",{key:i.id},h("input",{type:"radio",value:i.id,"data-itemid":i.id,required:!t.visibility_condition&&t.required,checked:i.is_selected,name:"options[".concat(t.id,"]"),"data-img-id":i.option_value,disabled:n.canDisabled&&n.isOptionDetailOut(i),id:n.generateUniqueKey("option_".concat(n.productId,"-").concat(t.id,"_").concat(i.id)),onInvalid:function(i){return n.invalidHandler(i,t)},onChange:function(i){return n.changedHandler(i,t)}}),h("label",{htmlFor:n.generateUniqueKey("option_".concat(n.productId,"-").concat(t.id,"_").concat(i.id)),"data-img-id":i.option_value,class:"go-to-slide"},h("img",{"data-src":i.image,src:i.image,title:i.name,alt:i.name}),h("span",{innerHTML:IconVerified,class:"s-product-options-thumbnails-icon"}),n.isOptionDetailOut(i)?[h("small",{key:i.id,class:"s-product-options-thumbnails-stock-badge"},n.outOfStockText),n.canDisabled?h("div",{key:i.id,class:"s-product-options-thumbnails-badge-overlay"}):""]:""),h("p",null,n.getOptionDetailName(i,false)," "))})))};t.prototype.digitalCardValuesOption=function(t){var n=this;return h("div",{class:"s-product-options-digital-card-wrapper"},this.availableDigitalCardValues.length>0?this.availableDigitalCardValues.map((function(i){var o,r,e;var a=String(i.id);return h("label",{htmlFor:n.generateUniqueKey(a.toString()),key:a,class:"s-product-options-digital-card-option"},h("input",Object.assign({type:"radio","data-code-value":true,class:"s-form-control s-product-options-digital-card-input",value:i.id,name:"options[".concat(t.id,"]"),id:n.generateUniqueKey(a.toString()),required:!t.visibility_condition&&t.required,onInvalid:function(i){return n.invalidHandler(i,t)}},!n.ignoreDefaultCardValue?{defaultChecked:((o=n.getSelectedDigitalCardOptions(t))===null||o===void 0?void 0:o.id)===i.id}:{})),h("span",null,i.name," ",(e=(r=salla.config)===null||r===void 0?void 0:r.currency())===null||e===void 0?void 0:e.symbol))})):h("div",{class:"s-product-options-digital-card-out-of-stock"}))};t.prototype.countryOption=function(t){var n=this;return h("div",{class:"s-product-options-digital-card-wrapper"},t.details.map((function(i){var o;return h("label",{htmlFor:n.generateUniqueKey(i.id.toString()),key:i.id,class:{"s-product-options-digital-card-option":true,"s-product-options-digital-card-option-stock-out":i.is_out}},h("input",Object.assign({id:n.generateUniqueKey(i.id.toString()),type:"radio",class:"s-form-control s-product-options-digital-card-input",value:i.id,name:"options[".concat(t.id,"]"),disabled:i.is_out,required:!t.visibility_condition&&t.required,onInvalid:function(i){return n.invalidHandler(i,t)},onChange:function(i){return n.changedHandler(i,t)},onClick:function(){n.disableCardValue=false}},salla.url.is_page("cart")?{defaultChecked:((o=n.getSelectedDigitalCardOptions(t))===null||o===void 0?void 0:o.id)===i.id}:{})),h("img",{loading:"lazy",alt:i.code,height:24,width:24,class:"s-product-options-country-flag",src:"https://cdn.assets.salla.network/prod/admin/cp/assets/flags/1x1/".concat(String(i.code).toLocaleLowerCase(),".svg")}),h("span",null,i.name))})))};Object.defineProperty(t.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();SallaProductOptions.style=sallaProductOptionsCss;export{SallaProductOptions as salla_product_options};
|
|
5
5
|
//# sourceMappingURL=salla-product-options.entry.js.map
|