@salla.sa/twilight-components 2.14.251 → 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-0qyY-ElC.js → app-globals-BoVwS_2u.js} +3 -3
- package/dist/cjs/{app-globals-0qyY-ElC.js.map → app-globals-BoVwS_2u.js.map} +1 -1
- package/dist/cjs/{index-CxIOfeMA.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-BBUHVW9U.js → app-globals-5yxEmkuB.js} +3 -3
- package/dist/esm/{app-globals-BBUHVW9U.js.map → app-globals-5yxEmkuB.js.map} +1 -1
- package/dist/esm/{index-aC-cHVMV.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-BBUHVW9U.js → app-globals-5yxEmkuB.js} +2 -2
- package/dist/esm-es5/{app-globals-BBUHVW9U.js.map → app-globals-5yxEmkuB.js.map} +1 -1
- package/dist/esm-es5/{index-aC-cHVMV.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 +1 -1
- package/dist/esm-es5/salla-filters.entry.js +1 -1
- package/dist/esm-es5/salla-installment.entry.js +1 -1
- package/dist/esm-es5/salla-loyalty-prize-item.entry.js +1 -1
- package/dist/esm-es5/salla-loyalty-program.entry.js +1 -1
- package/dist/esm-es5/salla-metadata.entry.js +2 -2
- package/dist/esm-es5/salla-notification-item.entry.js +1 -1
- package/dist/esm-es5/salla-notifications.entry.js +2 -2
- package/dist/esm-es5/salla-offer.entry.js +1 -1
- package/dist/esm-es5/salla-order-details-multiple-bundle-product.entry.js +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-04b3d375.entry.js → p-0065a55b.entry.js} +2 -2
- package/dist/twilight/{p-6a16b86d.system.entry.js → p-05cf8f0f.system.entry.js} +2 -2
- package/dist/twilight/p-066a5e95.system.entry.js +5 -0
- package/dist/twilight/{p-342eda73.entry.js → p-0a58ecb2.entry.js} +2 -2
- package/dist/twilight/{p-1d08e23e.system.entry.js → p-0ab8c50f.system.entry.js} +2 -2
- package/dist/twilight/{p-3407c5ef.entry.js → p-13efdbe3.entry.js} +2 -2
- package/dist/twilight/{p-94b99a34.entry.js → p-13f1a287.entry.js} +2 -2
- package/dist/twilight/{p-e29eb090.system.entry.js → p-15c42251.system.entry.js} +2 -2
- package/dist/twilight/{p-09117f81.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-21c35fec.entry.js → p-204e0ad2.entry.js} +2 -2
- package/dist/twilight/{p-d01c0575.entry.js → p-210ccdae.entry.js} +2 -2
- package/dist/twilight/{p-9c2bf5c2.entry.js → p-240b86ef.entry.js} +2 -2
- package/dist/twilight/{p-18bd19bd.entry.js → p-27206d63.entry.js} +2 -2
- package/dist/twilight/{p-779536eb.entry.js → p-35dd7512.entry.js} +4 -4
- package/dist/twilight/{p-fabacea5.system.entry.js → p-38675c42.system.entry.js} +2 -2
- package/dist/twilight/{p-4d318ffc.system.entry.js → p-3cdd4d44.system.entry.js} +2 -2
- package/dist/twilight/{p-56074b1e.entry.js → p-3e9ceed0.entry.js} +2 -2
- package/dist/twilight/{p-b75d729a.system.entry.js → p-447f03b5.system.entry.js} +2 -2
- package/dist/twilight/{p-9f75e64f.entry.js → p-4b7e613a.entry.js} +2 -2
- package/dist/twilight/{p-a94e5163.entry.js → p-4d5387e9.entry.js} +2 -2
- package/dist/twilight/{p-b9a992c8.system.entry.js → p-53fb14d0.system.entry.js} +2 -2
- package/dist/twilight/p-5db51240.system.entry.js +5 -0
- package/dist/twilight/{p-f777295c.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-9297d5d0.system.entry.js → p-6a51cb91.system.entry.js} +2 -2
- package/dist/twilight/{p-5dda0431.entry.js → p-6abfa7ed.entry.js} +2 -2
- package/dist/twilight/{p-8a55a076.entry.js → p-6f66faea.entry.js} +2 -2
- package/dist/twilight/{p-efcf803a.entry.js → p-7187b729.entry.js} +2 -2
- package/dist/twilight/{p-49051076.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-70688702.entry.js → p-78deca48.entry.js} +2 -2
- package/dist/twilight/{p-7f9f9400.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-0d0836f3.entry.js → p-83f6408a.entry.js} +2 -2
- package/dist/twilight/{p-b7bb5a85.system.entry.js → p-888de4b8.system.entry.js} +2 -2
- package/dist/twilight/{p-CHKd1ZbK.system.js.map → p-8SAlNoQ7.system.js.map} +1 -1
- package/dist/twilight/{p-DoomSogT.system.js.map → p-8cuU9AcW.system.js.map} +1 -1
- package/dist/twilight/{p-29440936.system.entry.js → p-8e807035.system.entry.js} +2 -2
- package/dist/twilight/{p-08b3ea63.system.entry.js → p-8fcff962.system.entry.js} +2 -2
- package/dist/twilight/p-9a8a57f0.entry.js +5 -0
- package/dist/twilight/{p-1b9e31b1.system.entry.js → p-9cb1a11d.system.entry.js} +2 -2
- package/dist/twilight/{p-Chh9LXws.system.js.map → p-B10yx9se.system.js.map} +1 -1
- package/dist/twilight/{p-sLrIToFR.system.js.map → p-BKsOE9n5.system.js.map} +1 -1
- package/dist/twilight/{p-24T5fnEM.system.js.map → p-BzHfWaAI.system.js.map} +1 -1
- package/dist/twilight/{p-C3l3EpVC.system.js.map → p-C0IcnmR-.system.js.map} +1 -1
- package/dist/twilight/{p-81UxRwTN.system.js.map → p-C0Tc4qY_.system.js.map} +1 -1
- package/dist/twilight/{p-D1othg3r.system.js.map → p-C72wuhae.system.js.map} +1 -1
- package/dist/twilight/{p-fkQosYiP.system.js.map → p-CDuCVzYE.system.js.map} +1 -1
- package/dist/twilight/{p-YRdrauTw.system.js.map → p-CK7f65RE.system.js.map} +1 -1
- package/dist/twilight/{p-9cvlynxW.system.js → p-CQDiSGcm.system.js} +3 -3
- package/dist/twilight/p-CQDiSGcm.system.js.map +1 -0
- package/dist/twilight/{p-63hxYOEG.system.js.map → p-Crz5Om7F.system.js.map} +1 -1
- package/dist/twilight/p-D6vllM1-.system.js.map +1 -0
- package/dist/twilight/{p-o3nk7iqR.system.js.map → p-DHIqW0kb.system.js.map} +1 -1
- package/dist/twilight/{p-Bl7BRAvB.system.js → p-DHVFvgH-.system.js} +2 -2
- package/dist/twilight/{p-Bl7BRAvB.system.js.map → p-DHVFvgH-.system.js.map} +1 -1
- package/dist/twilight/{p-Cie2T8Bo.system.js.map → p-DNXP15r0.system.js.map} +1 -1
- package/dist/twilight/{p-3etOZ9ok.system.js.map → p-DNsqaxY7.system.js.map} +1 -1
- package/dist/twilight/{p-gyc8toCS.system.js.map → p-DTx9WCBY.system.js.map} +1 -1
- package/dist/twilight/{p-a3gxDXSb.system.js.map → p-DVKxP5is.system.js.map} +1 -1
- package/dist/twilight/p-DVpqfl3D.system.js.map +1 -0
- package/dist/twilight/{p-Craz4PUF.system.js.map → p-DZTRKwds.system.js.map} +1 -1
- package/dist/twilight/{p-Dohhf_R_.system.js.map → p-DZajWqW2.system.js.map} +1 -1
- package/dist/twilight/{p-Uzujt2uQ.system.js.map → p-Da2A-hsX.system.js.map} +1 -1
- package/dist/twilight/{p-CbFmk86R.system.js.map → p-DgVuWfs6.system.js.map} +1 -1
- package/dist/twilight/p-Dhlfiere.system.js +5 -0
- package/dist/twilight/{p-CBqvheHa.system.js.map → p-Dhlfiere.system.js.map} +1 -1
- package/dist/twilight/{p-DOCHKq2e.system.js.map → p-DkCrulih.system.js.map} +1 -1
- package/dist/twilight/{p-7HslI1sO.system.js.map → p-Du8MMxWf.system.js.map} +1 -1
- package/dist/twilight/{p-De28Pl5h.system.js.map → p-DvSX1guT.system.js.map} +1 -1
- package/dist/twilight/{p-aC-cHVMV.js → p-Hw2jlaNN.js} +3 -3
- package/dist/twilight/p-Hw2jlaNN.js.map +1 -0
- package/dist/twilight/{p-DbkDylL6.system.js.map → p-N45BdAU8.system.js.map} +1 -1
- package/dist/twilight/{p-cW_hSk8i.js → p-NSLkL4Dn.js} +2 -2
- package/dist/twilight/{p-cW_hSk8i.js.map → p-NSLkL4Dn.js.map} +1 -1
- package/dist/twilight/{p-BZAlfa8A.system.js.map → p-QNwQUqLM.system.js.map} +1 -1
- package/dist/twilight/{p-DobF7Qkv.system.js.map → p-XDYW48AK.system.js.map} +1 -1
- package/dist/twilight/{p-75203eae.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-65d9d657.entry.js → p-b13ef44c.entry.js} +2 -2
- package/dist/twilight/{p-47fc4553.entry.js → p-b492c336.entry.js} +2 -2
- package/dist/twilight/{p-b0584206.entry.js → p-b51bb42b.entry.js} +2 -2
- package/dist/twilight/{p-3fb416fa.entry.js → p-bb1a0f6b.entry.js} +2 -2
- package/dist/twilight/{p-92fb3adc.entry.js → p-bca6b6b2.entry.js} +2 -2
- package/dist/twilight/{p-af7ace10.entry.js → p-bdca9c9c.entry.js} +2 -2
- package/dist/twilight/p-be2938da.entry.js +5 -0
- package/dist/twilight/{p-3438bc0c.entry.js → p-c5b5a947.entry.js} +2 -2
- package/dist/twilight/{p-DOHYAySQ.system.js.map → p-cK_8A-PC.system.js.map} +1 -1
- package/dist/twilight/{p-BaUsKGrq.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-8c2a97cf.system.entry.js → p-d33197dc.system.entry.js} +3 -3
- package/dist/twilight/{p-2d2fce30.system.entry.js → p-d3c9cfbb.system.entry.js} +2 -2
- package/dist/twilight/{p-56628b3c.system.entry.js → p-d4017888.system.entry.js} +2 -2
- package/dist/twilight/{p-0e931dd0.system.entry.js → p-d43b5d6a.system.entry.js} +2 -2
- package/dist/twilight/{p-a3c00836.entry.js → p-d7604122.entry.js} +2 -2
- package/dist/twilight/{p-e5cd34c3.system.entry.js → p-d8039b97.system.entry.js} +2 -2
- package/dist/twilight/{p-4a4cad07.system.entry.js → p-db9674c2.system.entry.js} +2 -2
- package/dist/twilight/{p-92a2ce11.system.entry.js → p-eb292930.system.entry.js} +2 -2
- package/dist/twilight/{p-f9735e19.system.entry.js → p-ec034bd2.system.entry.js} +3 -3
- package/dist/twilight/{p-2f85174e.system.entry.js → p-f07ad750.system.entry.js} +2 -2
- package/dist/twilight/{p-939b203a.system.entry.js → p-f0b1ceef.system.entry.js} +2 -2
- package/dist/twilight/p-f5aefbca.system.entry.js +5 -0
- package/dist/twilight/{p-7e1c3fd9.entry.js → p-fb399776.entry.js} +2 -2
- package/dist/twilight/{p-5054fc18.entry.js → p-fe81524d.entry.js} +2 -2
- package/dist/twilight/p-fed7a7a5.system.entry.js +5 -0
- package/dist/twilight/{p-BSHk_PNC.system.js.map → p-jx7CG3rj.system.js.map} +1 -1
- package/dist/twilight/{p-DFTLMdWL.system.js.map → p-lRCsnz7i.system.js.map} +1 -1
- package/dist/twilight/p-oqUqe5ch.system.js.map +1 -0
- package/dist/twilight/{p-B-6fJi1f.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-CxIOfeMA.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-aC-cHVMV.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-aC-cHVMV.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-03f5a937.entry.js +0 -5
- package/dist/twilight/p-0443edb2.entry.js +0 -5
- package/dist/twilight/p-0443edb2.entry.js.map +0 -1
- package/dist/twilight/p-3b207dc4.system.entry.js +0 -5
- package/dist/twilight/p-3e82f611.entry.js +0 -5
- package/dist/twilight/p-3e82f611.entry.js.map +0 -1
- package/dist/twilight/p-61471a8d.system.entry.js +0 -5
- package/dist/twilight/p-61471a8d.system.entry.js.map +0 -1
- package/dist/twilight/p-6943af29.system.entry.js +0 -5
- package/dist/twilight/p-6943af29.system.entry.js.map +0 -1
- package/dist/twilight/p-8d02af0b.system.entry.js +0 -5
- package/dist/twilight/p-98ca67d7.entry.js +0 -5
- package/dist/twilight/p-9b7b035c.entry.js +0 -5
- package/dist/twilight/p-9b7b035c.entry.js.map +0 -1
- package/dist/twilight/p-9cvlynxW.system.js.map +0 -1
- package/dist/twilight/p-B6pAHU4P.system.js.map +0 -1
- package/dist/twilight/p-CBqvheHa.system.js +0 -5
- package/dist/twilight/p-D74Dhmc1.system.js.map +0 -1
- package/dist/twilight/p-QCD41AKz.system.js.map +0 -1
- package/dist/twilight/p-a5b4c38f.system.entry.js +0 -5
- package/dist/twilight/p-aC-cHVMV.js.map +0 -1
- package/dist/twilight/p-b1f25cb5.system.entry.js +0 -5
- package/dist/twilight/p-e1a599fb.system.entry.js +0 -5
- package/dist/twilight/p-e1a599fb.system.entry.js.map +0 -1
- 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-04b3d375.entry.js.map → p-0065a55b.entry.js.map} +0 -0
- /package/dist/twilight/{p-6a16b86d.system.entry.js.map → p-05cf8f0f.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-8d02af0b.system.entry.js.map → p-066a5e95.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-342eda73.entry.js.map → p-0a58ecb2.entry.js.map} +0 -0
- /package/dist/twilight/{p-1d08e23e.system.entry.js.map → p-0ab8c50f.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-3407c5ef.entry.js.map → p-13efdbe3.entry.js.map} +0 -0
- /package/dist/twilight/{p-94b99a34.entry.js.map → p-13f1a287.entry.js.map} +0 -0
- /package/dist/twilight/{p-e29eb090.system.entry.js.map → p-15c42251.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-09117f81.system.entry.js.map → p-17567b38.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-21c35fec.entry.js.map → p-204e0ad2.entry.js.map} +0 -0
- /package/dist/twilight/{p-d01c0575.entry.js.map → p-210ccdae.entry.js.map} +0 -0
- /package/dist/twilight/{p-9c2bf5c2.entry.js.map → p-240b86ef.entry.js.map} +0 -0
- /package/dist/twilight/{p-18bd19bd.entry.js.map → p-27206d63.entry.js.map} +0 -0
- /package/dist/twilight/{p-779536eb.entry.js.map → p-35dd7512.entry.js.map} +0 -0
- /package/dist/twilight/{p-fabacea5.system.entry.js.map → p-38675c42.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-4d318ffc.system.entry.js.map → p-3cdd4d44.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-56074b1e.entry.js.map → p-3e9ceed0.entry.js.map} +0 -0
- /package/dist/twilight/{p-b75d729a.system.entry.js.map → p-447f03b5.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-9f75e64f.entry.js.map → p-4b7e613a.entry.js.map} +0 -0
- /package/dist/twilight/{p-a94e5163.entry.js.map → p-4d5387e9.entry.js.map} +0 -0
- /package/dist/twilight/{p-b9a992c8.system.entry.js.map → p-53fb14d0.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-3b207dc4.system.entry.js.map → p-5db51240.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-f777295c.system.entry.js.map → p-61f590ca.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-9297d5d0.system.entry.js.map → p-6a51cb91.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-5dda0431.entry.js.map → p-6abfa7ed.entry.js.map} +0 -0
- /package/dist/twilight/{p-8a55a076.entry.js.map → p-6f66faea.entry.js.map} +0 -0
- /package/dist/twilight/{p-efcf803a.entry.js.map → p-7187b729.entry.js.map} +0 -0
- /package/dist/twilight/{p-49051076.system.entry.js.map → p-765562b8.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-70688702.entry.js.map → p-78deca48.entry.js.map} +0 -0
- /package/dist/twilight/{p-7f9f9400.system.entry.js.map → p-7dce6627.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-0d0836f3.entry.js.map → p-83f6408a.entry.js.map} +0 -0
- /package/dist/twilight/{p-b7bb5a85.system.entry.js.map → p-888de4b8.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-29440936.system.entry.js.map → p-8e807035.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-08b3ea63.system.entry.js.map → p-8fcff962.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-98ca67d7.entry.js.map → p-9a8a57f0.entry.js.map} +0 -0
- /package/dist/twilight/{p-1b9e31b1.system.entry.js.map → p-9cb1a11d.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-75203eae.entry.js.map → p-a8cf78c0.entry.js.map} +0 -0
- /package/dist/twilight/{p-65d9d657.entry.js.map → p-b13ef44c.entry.js.map} +0 -0
- /package/dist/twilight/{p-47fc4553.entry.js.map → p-b492c336.entry.js.map} +0 -0
- /package/dist/twilight/{p-b0584206.entry.js.map → p-b51bb42b.entry.js.map} +0 -0
- /package/dist/twilight/{p-3fb416fa.entry.js.map → p-bb1a0f6b.entry.js.map} +0 -0
- /package/dist/twilight/{p-92fb3adc.entry.js.map → p-bca6b6b2.entry.js.map} +0 -0
- /package/dist/twilight/{p-af7ace10.entry.js.map → p-bdca9c9c.entry.js.map} +0 -0
- /package/dist/twilight/{p-03f5a937.entry.js.map → p-be2938da.entry.js.map} +0 -0
- /package/dist/twilight/{p-3438bc0c.entry.js.map → p-c5b5a947.entry.js.map} +0 -0
- /package/dist/twilight/{p-8c2a97cf.system.entry.js.map → p-d33197dc.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-2d2fce30.system.entry.js.map → p-d3c9cfbb.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-56628b3c.system.entry.js.map → p-d4017888.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-0e931dd0.system.entry.js.map → p-d43b5d6a.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-a3c00836.entry.js.map → p-d7604122.entry.js.map} +0 -0
- /package/dist/twilight/{p-e5cd34c3.system.entry.js.map → p-d8039b97.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-4a4cad07.system.entry.js.map → p-db9674c2.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-92a2ce11.system.entry.js.map → p-eb292930.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-f9735e19.system.entry.js.map → p-ec034bd2.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-2f85174e.system.entry.js.map → p-f07ad750.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-939b203a.system.entry.js.map → p-f0b1ceef.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-a5b4c38f.system.entry.js.map → p-f5aefbca.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-7e1c3fd9.entry.js.map → p-fb399776.entry.js.map} +0 -0
- /package/dist/twilight/{p-5054fc18.entry.js.map → p-fe81524d.entry.js.map} +0 -0
- /package/dist/twilight/{p-b1f25cb5.system.entry.js.map → p-fed7a7a5.system.entry.js.map} +0 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Crafted with ❤ by Salla
|
|
3
|
+
*/
|
|
4
|
+
import{r as s,h as i,H as r}from"./p-Hw2jlaNN.js";const t="";const l=class{constructor(i){s(this,i);this.placeholderImage=salla.url.cdn("images/s-empty.png")}getProductImage(){var s;if(!((s=this.productDetails)===null||s===void 0?void 0:s.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")}getProductImageAlt(){var s,i,r;if(!((s=this.productDetails)===null||s===void 0?void 0:s.image)||typeof this.productDetails.image==="string"){return((i=this.productDetails)===null||i===void 0?void 0:i.name)||""}return this.productDetails.image.alt||((r=this.productDetails)===null||r===void 0?void 0:r.name)||""}getAccordionId(){var s;return`accordion-${((s=this.productDetails)===null||s===void 0?void 0:s.id)||"default"}`}getAccordionKey(){var s;return((s=this.productDetails)===null||s===void 0?void 0:s.id)||"default"}shouldBeCollapsible(){var s,i;if(this.collapsible!==undefined){return this.collapsible}return((i=(s=this.productDetails)===null||s===void 0?void 0:s.options)===null||i===void 0?void 0:i.length)>0}renderProductPrice(){if(!this.productDetails){return null}const{is_on_sale:s,sale_price:r,regular_price:t,price:l}=this.productDetails;if(s&&r){return i("div",null,i("span",{class:"s-order-details-product-price s-order-details-product-price-sale"},i("span",{innerHTML:salla.money(r)})),t&&i("span",{class:"s-order-details-product-regular-price"},i("span",{innerHTML:salla.money(t)})))}return i("span",{class:"s-order-details-product-price"},i("span",{innerHTML:salla.money(l)}))}renderOptions(){var s,r;if(!((r=(s=this.productDetails)===null||s===void 0?void 0:s.options)===null||r===void 0?void 0:r.length)){return null}return i("salla-accordion-body",null,i("div",{class:"s-order-details-options"},i("salla-order-details-options",{options:this.productDetails.options})))}render(){var s,t,l;if(!this.productDetails){return null}const e=this.shouldBeCollapsible();return i(r,{class:"s-order-details-bundle-wrapper"},i("salla-accordion",{key:this.getAccordionKey(),collapsed:false,bordered:true,collapsible:e,id:this.getAccordionId(),size:"sm"},i("salla-accordion-head",null,i("div",{class:"s-order-details-product"},i("div",{class:"s-order-details-product-content"},i("div",{class:"s-order-details-product-info"},i("div",{class:"s-order-details-product-image"},i("img",{src:this.getProductImage(),alt:this.getProductImageAlt()})),i("div",{class:"s-order-details-product-details"},i("a",{href:((s=this.productDetails)===null||s===void 0?void 0:s.url)||"#",class:"s-order-details-product-name"},((t=this.productDetails)===null||t===void 0?void 0:t.name)||""),this.renderProductPrice(),((l=this.productDetails)===null||l===void 0?void 0:l.quantity)&&i("span",{class:"s-order-details-product-quantity"},"×",this.productDetails.quantity)))))),this.renderOptions()))}};l.style=t;export{l as salla_order_details_multiple_bundle_product};
|
|
5
|
+
//# sourceMappingURL=p-76d92026.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["sallaOrderDetailsMultipleBundleProductCss","SallaproductDetailsMultipleBundleProduct","constructor","hostRef","this","placeholderImage","salla","url","cdn","getProductImage","_a","productDetails","image","getProductImageAlt","_b","name","alt","_c","getAccordionId","id","getAccordionKey","shouldBeCollapsible","collapsible","undefined","options","length","renderProductPrice","is_on_sale","sale_price","regular_price","price","h","class","innerHTML","money","renderOptions","render","collapsibleState","Host","key","collapsed","bordered","size","src","href","quantity"],"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":[null,"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"],"mappings":";;;kDAAA,MAAMA,EAA4C,G,MCYrCC,EAAwC,MAJrD,WAAAC,CAAAC,G,UAYUC,KAAgBC,iBAAWC,MAAMC,IAAIC,IAAI,qBAgIlD,CA9HS,eAAAC,G,MACN,MAAKC,EAAAN,KAAKO,kBAAgB,MAAAD,SAAA,SAAAA,EAAAE,OAAO,CAC/B,OAAOR,KAAKC,gB,CAId,UAAWD,KAAKO,eAAeC,QAAU,SAAU,CACjD,OAAOR,KAAKO,eAAeC,K,CAG7B,OACER,KAAKO,eAAeC,MAAML,KAAOH,KAAKC,kBAAoBC,MAAMC,IAAIC,IAAI,qB,CAIpE,kBAAAK,G,UACN,MAAKH,EAAAN,KAAKO,kBAAc,MAAAD,SAAA,SAAAA,EAAEE,eAAgBR,KAAKO,eAAeC,QAAU,SAAU,CAChF,QAAOE,EAAAV,KAAKO,kBAAgB,MAAAG,SAAA,SAAAA,EAAAC,OAAQ,E,CAGtC,OAAOX,KAAKO,eAAeC,MAAMI,OAAOC,EAAAb,KAAKO,kBAAc,MAAAM,SAAA,SAAAA,EAAEF,OAAQ,E,CAG/D,cAAAG,G,MACN,MAAO,eAAaR,EAAAN,KAAKO,kBAAc,MAAAD,SAAA,SAAAA,EAAES,KAAM,W,CAGzC,eAAAC,G,MACN,QAAOV,EAAAN,KAAKO,kBAAgB,MAAAD,SAA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ACTD,EAAA,OAAKY,IAAKvC,KAAKK,kBAAmBO,IAAKZ,KAAKS,wBAE9CkB,EAAK,OAAAC,MAAM,mCACTD,EAAG,KAAAa,OAAMlC,EAAAN,KAAKO,kBAAc,MAAAD,SAAA,SAAAA,EAAEH,MAAO,IAAKyB,MAAM,kCAC7ClB,EAAAV,KAAKO,kBAAgB,MAAAG,SAAA,SAAAA,EAAAC,OAAQ,IAE/BX,KAAKsB,uBACLT,EAAAb,KAAKO,kBAAc,MAAAM,SAAA,SAAAA,EAAE4B,WACpBd,EAAA,QAAMC,MAAM,oCAAkC,IAC1C5B,KAAKO,eAAekC,eASnCzC,KAAK+B,iB","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as s,h as t}from"./p-
|
|
5
|
-
//# sourceMappingURL=p-
|
|
4
|
+
import{r as s,h as t}from"./p-Hw2jlaNN.js";import{S as i,A as e}from"./p-yRO-ZESF.js";import{G as c}from"./p-C0JNGIpa.js";var a=`\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>tag-money</title>\n<path d="M20.567 11.433c-0.521-0.521-1.364-0.521-1.885 0l-0.524 0.524c-1.28-0.819-3.091-0.681-4.191 0.419-0.631 0.631-0.976 1.468-0.976 2.359 0 0.889 0.347 1.727 0.976 2.357l0.943 0.943c0.171 0.171 0.195 0.368 0.195 0.472s-0.025 0.301-0.196 0.472c-0.169 0.169-0.367 0.195-0.471 0.195s-0.301-0.025-0.472-0.195l-2.357-2.357c-0.521-0.521-1.364-0.521-1.885 0s-0.521 1.364 0 1.885l0.944 0.941-0.472 0.472c-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l0.519-0.519c0.54 0.359 1.173 0.553 1.837 0.553 0.892 0 1.729-0.348 2.357-0.976 0.631-0.631 0.976-1.467 0.976-2.357s-0.347-1.727-0.976-2.357l-0.943-0.943c-0.26-0.26-0.26-0.684 0-0.944 0.259-0.259 0.683-0.261 0.944 0l1.885 1.887c0.521 0.521 1.364 0.521 1.885 0 0.521-0.52 0.521-1.364 0-1.885l-0.472-0.472 0.472-0.472c0.521-0.521 0.521-1.365 0.001-1.887zM28 0h-9.344c-1.059 0-2.056 0.411-2.809 1.153l-14.673 14.456c-1.56 1.56-1.561 4.097-0.001 5.657l9.56 9.56c0.755 0.755 1.76 1.172 2.828 1.173h0.003c1.068 0 2.072-0.416 2.833-1.179l14.451-14.668c0.743-0.753 1.153-1.751 1.153-2.809v-9.344c0-2.205-1.795-4-4-4zM29.333 13.344c0 0.353-0.137 0.685-0.385 0.937l-14.444 14.661c-0.252 0.252-0.587 0.391-0.941 0.391-0.001 0-0.001 0-0.001 0-0.356-0.001-0.691-0.139-0.943-0.392l-9.561-9.56c-0.52-0.52-0.52-1.365-0.005-1.88l14.667-14.449c0.253-0.248 0.585-0.385 0.937-0.385h9.344c0.736 0 1.333 0.597 1.333 1.333zM24 6.673c-0.737 0-1.333 0.604-1.333 1.341s0.596 1.333 1.333 1.333 1.333-0.596 1.333-1.333v-0.015c0-0.737-0.596-1.327-1.333-1.327z"></path>\n</svg>\n`;var r=`\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>fire</title>\n<path d="M21.56 3.009c-0.052-0.047-0.116-0.065-0.173-0.103-0.073-0.048-0.143-0.1-0.223-0.132-0.083-0.033-0.165-0.047-0.252-0.063-0.081-0.016-0.16-0.035-0.243-0.035-0.089 0-0.172 0.020-0.26 0.037-0.080 0.016-0.159 0.028-0.236 0.059-0.084 0.035-0.157 0.088-0.235 0.14-0.053 0.036-0.115 0.053-0.165 0.097-0.049 0.044-0.988 0.895-2.288 2.255-2.364-2.839-4.476-4.815-4.576-4.908-0.056-0.052-0.127-0.075-0.188-0.115-0.075-0.049-0.143-0.105-0.224-0.137-0.080-0.032-0.163-0.041-0.245-0.057-0.085-0.016-0.167-0.040-0.252-0.040-0.084 0-0.163 0.023-0.245 0.039-0.087 0.016-0.172 0.025-0.253 0.059-0.080 0.032-0.147 0.087-0.22 0.135-0.063 0.041-0.133 0.064-0.189 0.116-0.453 0.423-11.092 10.408-11.092 18.095 0 7.977 4.935 13.549 12 13.549h8.667c6.673 0 11.333-5.115 11.333-12.439 0-7.052-10.013-16.167-10.44-16.552zM20.667 29.333h-7.777c-2.924 0-4.889-2.044-4.889-5.084 0-2.317 2.816-6.441 4.888-8.887 0.76 0.909 2.755 3.397 3.969 5.869 0.212 0.431 0.639 0.715 1.117 0.743 0.489 0.031 0.937-0.203 1.197-0.605 0.552-0.849 1.109-1.596 1.497-2.093 1.491 1.897 3.331 4.78 3.331 6.399 0 2.188-1.34 3.659-3.333 3.659zM26.537 27.052c0.081-0.44 0.129-0.899 0.129-1.377 0-3.269-3.713-7.847-4.46-8.735l-0.523-0.617c-0.507-0.599-1.528-0.599-2.035 0l-0.531 0.627c-0.147 0.175-0.495 0.599-0.936 1.187-1.595-2.597-3.495-4.776-3.595-4.889l-0.697-0.793c-0.507-0.577-1.499-0.577-2.004 0l-0.697 0.795c-0.6 0.684-5.856 6.803-5.856 11.001 0 0.881 0.127 1.712 0.356 2.484-1.896-1.933-3.023-4.821-3.023-8.283 0-4.915 6.073-11.997 9.329-15.255 1.001 1.008 2.692 2.789 4.368 4.927 0.243 0.309 0.609 0.496 1.001 0.509h0.048c0.376 0 0.735-0.159 0.988-0.439 0.889-0.981 1.693-1.795 2.269-2.359 3.051 2.965 8.663 9.323 8.663 13.727 0 3.171-1.031 5.769-2.796 7.491z"></path>\n</svg>\n`;var o=`\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>discount-coupon</title>\n<path d="M27 28h-22c-0.552 0-1-0.448-1-1v0c0-1.657-1.343-3-3-3v0c-0.552 0-1-0.448-1-1v0-12c0-0.552 0.448-1 1-1v0c1.657 0 3-1.343 3-3v0c0-0.552 0.448-1 1-1v0h22c0.552 0 1 0.448 1 1v0c0 1.657 1.343 3 3 3v0c0.552 0 1 0.448 1 1v0 12c0 0.552-0.448 1-1 1v0c-1.657 0-3 1.343-3 3v0c0 0.552-0.448 1-1 1v0zM5.9 26h20.2c0.415-1.964 1.936-3.485 3.867-3.894l0.033-0.006v-10.2c-1.964-0.415-3.485-1.936-3.894-3.867l-0.006-0.033h-20.2c-0.415 1.964-1.936 3.485-3.867 3.894l-0.033 0.006v10.2c1.964 0.415 3.485 1.936 3.894 3.867l0.006 0.033zM20 7h2v3h-2v-3zM20 12h2v4h-2v-4zM20 18h2v4h-2v-4zM20 24h2v3h-2v-3zM9 16c-1.657 0-3-1.343-3-3s1.343-3 3-3c1.657 0 3 1.343 3 3v0c0 1.657-1.343 3-3 3v0zM9 12c-0.552 0-1 0.448-1 1s0.448 1 1 1c0.552 0 1-0.448 1-1v0c0-0.552-0.448-1-1-1v0zM15 24c-1.657 0-3-1.343-3-3s1.343-3 3-3c1.657 0 3 1.343 3 3v0c0 1.657-1.343 3-3 3v0zM15 20c-0.552 0-1 0.448-1 1s0.448 1 1 1c0.552 0 1-0.448 1-1v0c0-0.552-0.448-1-1-1v0zM7 24c-0.552-0-1-0.448-1-1 0-0.244 0.088-0.468 0.233-0.642l-0.001 0.002 10-12c0.185-0.221 0.461-0.36 0.769-0.36 0.553 0 1.001 0.448 1.001 1.001 0 0.245-0.088 0.469-0.233 0.643l0.001-0.002-10 12c-0.185 0.22-0.46 0.358-0.767 0.358-0.001 0-0.002 0-0.003 0h0z"></path>\n</svg>\n`;const l=":host{display:block}";const n=class{constructor(t){s(this,t);this.internalOffers=[];this.showAll=false;this.freeLabel="";this.receivedOffer="";this.discountAmountLabel="";this.showMoreOffers="";this.icons={DiscountCouponIcon:o,GiftIcon:c,FireIcon:r,SpecialDiscountIcon:i,TagMoneyIcon:a};this.visibleOffersCount=3;this.handleCartItemUpdated=s=>{const t=s.data.cart.items.find((s=>s.id===this.itemId));if((t===null||t===void 0?void 0:t.id)===this.itemId){this.internalQuantity=t.quantity;this.internalOffers=t.detailed_offers||[];this.internalProductPrice=t.product_price}};this.toggleShowAll=()=>{this.showAll=!this.showAll}}async componentWillLoad(){await Salla.onReady();await salla.lang.onLoaded((()=>{this.freeLabel=salla.lang.get("common.elements.freeExclam");this.receivedOffer=salla.lang.get("pages.cart.received_offer");this.discountAmountLabel=salla.lang.get("pages.cart.discount_amount");this.showMoreOffers=salla.lang.get("pages.cart.show_more_offers")}));this.internalQuantity=this.quantity;this.internalOffers=this.parseOffers(this.offers);this.internalProductPrice=this.productPrice}componentDidLoad(){salla.event.on("cart::item.updated",(s=>this.handleCartItemUpdated(s)))}parseOffers(s){try{if(typeof s!=="string"){console.warn("Offers is not a string. Returning as-is.",s);return Array.isArray(s)?s:[]}return JSON.parse(s||"[]")}catch(s){console.error("Failed to parse offers",s);return[]}}get visibleOffers(){return this.internalOffers.slice(0,this.visibleOffersCount)}get hiddenOffers(){return this.internalOffers.slice(this.visibleOffersCount)}getPaidQty(s,t){return s-t.free_quantity}renderOffer(s,i){const e=this.getPaidQty(s,i);return t("div",{class:"s-cart-item-offers-box"},i.free_quantity>0&&e>0&&t("div",{class:"s-cart-item-offers-paid-free"},t("div",{class:"s-cart-item-offers-line"},salla.helpers.number(e)," × ",t("span",{innerHTML:salla.money(this.internalProductPrice)})),t("div",{class:"s-cart-item-offers-line"},salla.helpers.number(i.free_quantity)," ×",t("span",{class:"s-cart-item-offers-regular-price",innerHTML:salla.money(this.internalProductPrice)}),t("span",{class:"s-cart-item-offers-free-label"},this.freeLabel))),t("div",{class:"s-cart-item-offers-details"},t("span",{class:`s-cart-item-offers-icon`,innerHTML:this.icons[i.discount_icon]||""}),t("div",null,t("p",{class:"s-cart-item-offers-title"},this.receivedOffer.replace(":offer",i.offer_name)),t("p",{class:"s-cart-item-offers-discount"},t("span",{innerHTML:this.discountAmountLabel.replace(":amount",salla.money(i.discount_amount.toFixed(2)))})))))}render(){var s,i;if(!((s=this.internalOffers)===null||s===void 0?void 0:s.length)){return null}return t("div",{class:"s-cart-item-offers-container",id:`offers_list_${this.itemId}`},this.visibleOffers.map((s=>this.renderOffer(this.internalQuantity,s))),((i=this.internalOffers)===null||i===void 0?void 0:i.length)>this.visibleOffersCount&&t("div",{class:"s-cart-item-offers-show-more"},t("button",{class:"s-cart-item-offers-show-more-btn",onClick:this.toggleShowAll,type:"button"},t("span",{class:"s-cart-item-offers-show-more-label"},"+",this.hiddenOffers.length," ",this.showMoreOffers,t("span",{innerHTML:e,class:{"s-cart-item-offers-arrow-icon":true,"s-cart-item-offers-arrow-open":this.showAll}})))),this.showAll&&t("div",{class:"s-cart-item-offers-collapsed",id:`offers_${this.itemId}`},this.hiddenOffers.map((s=>this.renderOffer(this.internalQuantity,s)))))}};n.style=l;export{n as salla_cart_item_offers};
|
|
5
|
+
//# sourceMappingURL=p-78deca48.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
|
-
*/System.register(["./p-9cvlynxW.system.js","./p-Dxc5oJG6.system.js","./p-DTevZS21.system.js"],(function(t){"use strict";var n,i,o,r,e,a,s;return{setters:[function(t){n=t.r;i=t.c;o=t.h;r=t.H;e=t.g},function(t){a=t.I},function(t){s=t.C}],execute:function(){var u;(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"})(u||(u={}));var c;(function(t){t["Sar"]="SAR"})(c||(c={}));var l='\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 d="";var p=t("salla_product_options",function(){function t(t){var r=this;n(this,t);this.changed=i(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,n,i){if(n==="custom"&&i==="input"){salla.helpers.inputDigitsOnly(t.target);salla.event.emit("product-options::donation-changed",{id:r.productId,price:t.target.value});return}t.preventDefault();t.stopPropagation();r.isCustomDonation=t.target.value==="custom";if(r.donationInput){if(t.target.value==="custom"){r.donationInput.value="";r.donationInput.focus()}else{r.donationInput.value=t.target.value}if(n==="custom"){return}salla.event.emit("product-options::donation-changed",{id:r.productId,price:t.target.value})}};this.hideLabel=function(t){if(t.type===u.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 o("div",{class:{"s-product-options-donation-message":true,"s-product-options-donation-completed":n,"s-product-options-donation-expired":!n}},o("p",null,t.donation.target_message),o("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(){r.outOfStockText=salla.lang.get("pages.products.out_of_stock");r.donationAmount=salla.lang.get("pages.products.donation_amount");r.selectDonationAmount=salla.lang.getWithDefault("pages.products.select_donation_amount","تحديد مبلغ التبرع");r.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 r.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===u.FILE||n.type===u.IMAGE)&&t.type==="added"||n.type===u.MAP&&t.type==="selected"&&(t.target.lat&&t.target.lng)){setTimeout((function(){a.classList.remove("s-product-options-option-error")}),200)}if(n.type===u.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===u.MULTIPLE_OPTIONS){var c=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(c>-1){this.selectedOptions.splice(c,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===u.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!==u.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===u.COLOR_PICKER){return this.colorPickerOption(t)}if(t.type===u.MULTIPLE_OPTIONS){return this.multipleOptions(t)}if(t.type===u.SINGLE_OPTION){return this.singleOption(t)}if(t.type===u.DIGITAL_CARD_VALUE){return this.digitalCardValuesOption(t)}if(t.type===u.COUNTRY){return this.countryOption(t)}if(t.type===u.BOOKING&&salla.url.is_page("cart")){return o("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===u.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 o(r,{class:"s-product-options-wrapper"},o("salla-conditional-fields",null,this.optionsData.map((function(n){return o("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():o("div",{class:{"s-product-options-option":true,"s-product-options-option-booking":n.type===u.BOOKING&&salla.url.is_page("cart")},"data-option-type":n.type,"data-option-required":"".concat(n.required)},o("label",{htmlFor:"options[".concat(n.id,"]"),class:"s-product-options-option-label ".concat(t.hideLabel(n)?"s-product-options-option-label-hidden":"")},o("b",null,n.name,n.required&&o("span",null," * ")," "),o("small",null,n.placeholder)),o("div",{class:"s-product-options-option-content ".concat(t.hideLabel(n)||n.type===u.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===u.DONATION}))){return}var o=(i=this.optionsData.find((function(t){return t.type===u.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 r,e;return o("div",{class:"s-product-options-donation-wrapper"},((r=t.donation)===null||r===void 0?void 0:r.can_donate)?[t.donation?o("div",{key:t.id,class:"s-product-options-donation-progress"},o("salla-progress-bar",{donation:t.donation})):"",t.details.length?[o("h4",{key:t.id},this.selectAmount),o("div",{key:t.id,class:"s-product-options-donation-options"},t.details.map((function(n,r){return o("div",{key:t.id,class:"s-product-options-donation-options-item"},o("input",{id:i.generateUniqueKey("donation-option-".concat(r)),type:"radio",name:"donating_option",checked:n.is_selected,value:n.additional_price,onChange:function(t){return i.handleDonationOptions(t,n,"option")}}),o("label",{htmlFor:i.generateUniqueKey("donation-option-".concat(r))},o("span",{innerHTML:salla.money(n.name)})))})),((e=t.donation)===null||e===void 0?void 0:e.custom_amount_enabled)?o("div",{class:"s-product-options-donation-options-item"},o("input",{id:this.generateUniqueKey("donation-option-custom"),type:"radio",name:"donating_option",value:"custom",onChange:function(t){return i.handleDonationOptions(t,"custom","option")}}),o("label",{htmlFor:this.generateUniqueKey("donation-option-custom")},o("span",null," ",this.selectDonationAmount," "))):"")]:"",o("div",{key:t.id,class:{"s-product-options-donation-input-group":true,shown:!t.details.length||t.details.length&&this.isCustomDonation}},o("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)}}),o("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 r;return o("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}}),o("div",{class:"s-product-options-filepond-placeholder"},o("span",{class:"s-product-options-filepond-placeholder-icon",innerHTML:((r=n.accept)===null||r===void 0?void 0:r.split(",").every((function(t){return t.includes("image")})))?s:l}),o("p",{class:"s-product-options-filepond-placeholder-text"},salla.lang.get("common.uploader.drag_and_drop")),o("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 o("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 o("div",{class:"s-product-options-splitter"})};t.prototype.textOption=function(t){var n=this;return o("div",{class:"s-product-options-text"},o("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 o("div",{class:"s-product-options-textarea"},o("div",{class:"mt-1"},o("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 o("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 o("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 o("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 o("div",{class:"s-product-options-date-element"},o("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 o("div",{class:"s-product-options-datetime-element"},o("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===u.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,r,e,a){var s=this;var u=this.generateUniqueKey("".concat(t,"-").concat(i.id,"-").concat(n.id));var c=this.isOptionDetailOut(n);return o("label",{class:{"s-product-options-disabled":c}},o("input",{id:u,type:t,name:e,value:n.id,disabled:c,required:r,checked:n.is_selected,onInvalid:function(t){return s.invalidHandler(t,i)},onChange:function(t){return s.changedHandler(t,i)}}),o("div",{class:{"s-product-options-grid-mode-span":a,"s-product-options-disabled":c}},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 o("div",null,o("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)}},o("option",{value:""},t.placeholder),t===null||t===void 0?void 0:t.details.map((function(t){return o("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 o("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 r=((i=(n=this.optionConfig)===null||n===void 0?void 0:n["multiple-option"])===null||i===void 0?void 0:i.type)==="button";var e=t.required&&!t.details.some((function(t){return t.is_selected}))&&!t.visibility_condition;return r?this.renderButtonStyle("checkbox",t,e):o("div",{class:{"s-product-options-multiple-options-wrapper":true,required:t.required}},this.renderOptionDetails("checkbox",t,e))};t.prototype.colorOption=function(t){var n=this;return o("fieldset",{class:"s-product-options-colors-wrapper"},t===null||t===void 0?void 0:t.details.map((function(i){return o("div",{class:"s-product-options-colors-item",key:i.id},o("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)}}),o("label",{htmlFor:n.generateUniqueKey("color-".concat(n.productId,"-").concat(t.id,"-").concat(i.id))},o("span",{style:{backgroundColor:i.color}}),o("div",{innerHTML:n.getOptionDetailName(i,true,t.type)})))})))};t.prototype.thumbnailOption=function(t){var n=this;return o("div",{class:"s-product-options-thumbnails-wrapper"},t.details.map((function(i){return o("div",{key:i.id},o("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)}}),o("label",{htmlFor:n.generateUniqueKey("option_".concat(n.productId,"-").concat(t.id,"_").concat(i.id)),"data-img-id":i.option_value,class:"go-to-slide"},o("img",{"data-src":i.image,src:i.image,title:i.name,alt:i.name}),o("span",{innerHTML:a,class:"s-product-options-thumbnails-icon"}),n.isOptionDetailOut(i)?[o("small",{key:i.id,class:"s-product-options-thumbnails-stock-badge"},n.outOfStockText),n.canDisabled?o("div",{key:i.id,class:"s-product-options-thumbnails-badge-overlay"}):""]:""),o("p",null,n.getOptionDetailName(i,false)," "))})))};t.prototype.digitalCardValuesOption=function(t){var n=this;return o("div",{class:"s-product-options-digital-card-wrapper"},this.availableDigitalCardValues.length>0?this.availableDigitalCardValues.map((function(i){var r,e,a;var s=String(i.id);return o("label",{htmlFor:n.generateUniqueKey(s.toString()),key:s,class:"s-product-options-digital-card-option"},o("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(s.toString()),required:!t.visibility_condition&&t.required,onInvalid:function(i){return n.invalidHandler(i,t)}},!n.ignoreDefaultCardValue?{defaultChecked:((r=n.getSelectedDigitalCardOptions(t))===null||r===void 0?void 0:r.id)===i.id}:{})),o("span",null,i.name," ",(a=(e=salla.config)===null||e===void 0?void 0:e.currency())===null||a===void 0?void 0:a.symbol))})):o("div",{class:"s-product-options-digital-card-out-of-stock"}))};t.prototype.countryOption=function(t){var n=this;return o("div",{class:"s-product-options-digital-card-wrapper"},t.details.map((function(i){var r;return o("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}},o("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:((r=n.getSelectedDigitalCardOptions(t))===null||r===void 0?void 0:r.id)===i.id}:{})),o("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")}),o("span",null,i.name))})))};Object.defineProperty(t.prototype,"host",{get:function(){return e(this)},enumerable:false,configurable:true});return t}());p.style=d}}}));
|
|
5
|
-
//# sourceMappingURL=p-
|
|
4
|
+
*/System.register(["./p-CQDiSGcm.system.js","./p-Dxc5oJG6.system.js","./p-DTevZS21.system.js"],(function(t){"use strict";var n,i,o,r,e,a,s;return{setters:[function(t){n=t.r;i=t.c;o=t.h;r=t.H;e=t.g},function(t){a=t.I},function(t){s=t.C}],execute:function(){var u;(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"})(u||(u={}));var c;(function(t){t["Sar"]="SAR"})(c||(c={}));var l='\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 d="";var p=t("salla_product_options",function(){function t(t){var r=this;n(this,t);this.changed=i(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,n,i){if(n==="custom"&&i==="input"){salla.helpers.inputDigitsOnly(t.target);salla.event.emit("product-options::donation-changed",{id:r.productId,price:t.target.value});return}t.preventDefault();t.stopPropagation();r.isCustomDonation=t.target.value==="custom";if(r.donationInput){if(t.target.value==="custom"){r.donationInput.value="";r.donationInput.focus()}else{r.donationInput.value=t.target.value}if(n==="custom"){return}salla.event.emit("product-options::donation-changed",{id:r.productId,price:t.target.value})}};this.hideLabel=function(t){if(t.type===u.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 o("div",{class:{"s-product-options-donation-message":true,"s-product-options-donation-completed":n,"s-product-options-donation-expired":!n}},o("p",null,t.donation.target_message),o("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(){r.outOfStockText=salla.lang.get("pages.products.out_of_stock");r.donationAmount=salla.lang.get("pages.products.donation_amount");r.selectDonationAmount=salla.lang.getWithDefault("pages.products.select_donation_amount","تحديد مبلغ التبرع");r.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 r.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===u.FILE||n.type===u.IMAGE)&&t.type==="added"||n.type===u.MAP&&t.type==="selected"&&(t.target.lat&&t.target.lng)){setTimeout((function(){a.classList.remove("s-product-options-option-error")}),200)}if(n.type===u.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===u.MULTIPLE_OPTIONS){var c=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(c>-1){this.selectedOptions.splice(c,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===u.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!==u.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===u.COLOR_PICKER){return this.colorPickerOption(t)}if(t.type===u.MULTIPLE_OPTIONS){return this.multipleOptions(t)}if(t.type===u.SINGLE_OPTION){return this.singleOption(t)}if(t.type===u.DIGITAL_CARD_VALUE){return this.digitalCardValuesOption(t)}if(t.type===u.COUNTRY){return this.countryOption(t)}if(t.type===u.BOOKING&&salla.url.is_page("cart")){return o("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===u.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 o(r,{class:"s-product-options-wrapper"},o("salla-conditional-fields",null,this.optionsData.map((function(n){return o("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():o("div",{class:{"s-product-options-option":true,"s-product-options-option-booking":n.type===u.BOOKING&&salla.url.is_page("cart")},"data-option-type":n.type,"data-option-required":"".concat(n.required)},o("label",{htmlFor:"options[".concat(n.id,"]"),class:"s-product-options-option-label ".concat(t.hideLabel(n)?"s-product-options-option-label-hidden":"")},o("b",null,n.name,n.required&&o("span",null," * ")," "),o("small",null,n.placeholder)),o("div",{class:"s-product-options-option-content ".concat(t.hideLabel(n)||n.type===u.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===u.DONATION}))){return}var o=(i=this.optionsData.find((function(t){return t.type===u.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 r,e;return o("div",{class:"s-product-options-donation-wrapper"},((r=t.donation)===null||r===void 0?void 0:r.can_donate)?[t.donation?o("div",{key:t.id,class:"s-product-options-donation-progress"},o("salla-progress-bar",{donation:t.donation})):"",t.details.length?[o("h4",{key:t.id},this.selectAmount),o("div",{key:t.id,class:"s-product-options-donation-options"},t.details.map((function(n,r){return o("div",{key:t.id,class:"s-product-options-donation-options-item"},o("input",{id:i.generateUniqueKey("donation-option-".concat(r)),type:"radio",name:"donating_option",checked:n.is_selected,value:n.additional_price,onChange:function(t){return i.handleDonationOptions(t,n,"option")}}),o("label",{htmlFor:i.generateUniqueKey("donation-option-".concat(r))},o("span",{innerHTML:salla.money(n.name)})))})),((e=t.donation)===null||e===void 0?void 0:e.custom_amount_enabled)?o("div",{class:"s-product-options-donation-options-item"},o("input",{id:this.generateUniqueKey("donation-option-custom"),type:"radio",name:"donating_option",value:"custom",onChange:function(t){return i.handleDonationOptions(t,"custom","option")}}),o("label",{htmlFor:this.generateUniqueKey("donation-option-custom")},o("span",null," ",this.selectDonationAmount," "))):"")]:"",o("div",{key:t.id,class:{"s-product-options-donation-input-group":true,shown:!t.details.length||t.details.length&&this.isCustomDonation}},o("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)}}),o("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 r;return o("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}}),o("div",{class:"s-product-options-filepond-placeholder"},o("span",{class:"s-product-options-filepond-placeholder-icon",innerHTML:((r=n.accept)===null||r===void 0?void 0:r.split(",").every((function(t){return t.includes("image")})))?s:l}),o("p",{class:"s-product-options-filepond-placeholder-text"},salla.lang.get("common.uploader.drag_and_drop")),o("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 o("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 o("div",{class:"s-product-options-splitter"})};t.prototype.textOption=function(t){var n=this;return o("div",{class:"s-product-options-text"},o("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 o("div",{class:"s-product-options-textarea"},o("div",{class:"mt-1"},o("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 o("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 o("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 o("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 o("div",{class:"s-product-options-date-element"},o("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 o("div",{class:"s-product-options-datetime-element"},o("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===u.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,r,e,a){var s=this;var u=this.generateUniqueKey("".concat(t,"-").concat(i.id,"-").concat(n.id));var c=this.isOptionDetailOut(n);return o("label",{class:{"s-product-options-disabled":c}},o("input",{id:u,type:t,name:e,value:n.id,disabled:c,required:r,checked:n.is_selected,onInvalid:function(t){return s.invalidHandler(t,i)},onChange:function(t){return s.changedHandler(t,i)}}),o("div",{class:{"s-product-options-grid-mode-span":a,"s-product-options-disabled":c}},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 o("div",null,o("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)}},o("option",{value:""},t.placeholder),t===null||t===void 0?void 0:t.details.map((function(t){return o("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 o("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 r=((i=(n=this.optionConfig)===null||n===void 0?void 0:n["multiple-option"])===null||i===void 0?void 0:i.type)==="button";var e=t.required&&!t.details.some((function(t){return t.is_selected}))&&!t.visibility_condition;return r?this.renderButtonStyle("checkbox",t,e):o("div",{class:{"s-product-options-multiple-options-wrapper":true,required:t.required}},this.renderOptionDetails("checkbox",t,e))};t.prototype.colorOption=function(t){var n=this;return o("fieldset",{class:"s-product-options-colors-wrapper"},t===null||t===void 0?void 0:t.details.map((function(i){return o("div",{class:"s-product-options-colors-item",key:i.id},o("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)}}),o("label",{htmlFor:n.generateUniqueKey("color-".concat(n.productId,"-").concat(t.id,"-").concat(i.id))},o("span",{style:{backgroundColor:i.color}}),o("div",{innerHTML:n.getOptionDetailName(i,true,t.type)})))})))};t.prototype.thumbnailOption=function(t){var n=this;return o("div",{class:"s-product-options-thumbnails-wrapper"},t.details.map((function(i){return o("div",{key:i.id},o("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)}}),o("label",{htmlFor:n.generateUniqueKey("option_".concat(n.productId,"-").concat(t.id,"_").concat(i.id)),"data-img-id":i.option_value,class:"go-to-slide"},o("img",{"data-src":i.image,src:i.image,title:i.name,alt:i.name}),o("span",{innerHTML:a,class:"s-product-options-thumbnails-icon"}),n.isOptionDetailOut(i)?[o("small",{key:i.id,class:"s-product-options-thumbnails-stock-badge"},n.outOfStockText),n.canDisabled?o("div",{key:i.id,class:"s-product-options-thumbnails-badge-overlay"}):""]:""),o("p",null,n.getOptionDetailName(i,false)," "))})))};t.prototype.digitalCardValuesOption=function(t){var n=this;return o("div",{class:"s-product-options-digital-card-wrapper"},this.availableDigitalCardValues.length>0?this.availableDigitalCardValues.map((function(i){var r,e,a;var s=String(i.id);return o("label",{htmlFor:n.generateUniqueKey(s.toString()),key:s,class:"s-product-options-digital-card-option"},o("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(s.toString()),required:!t.visibility_condition&&t.required,onInvalid:function(i){return n.invalidHandler(i,t)}},!n.ignoreDefaultCardValue?{defaultChecked:((r=n.getSelectedDigitalCardOptions(t))===null||r===void 0?void 0:r.id)===i.id}:{})),o("span",null,i.name," ",(a=(e=salla.config)===null||e===void 0?void 0:e.currency())===null||a===void 0?void 0:a.symbol))})):o("div",{class:"s-product-options-digital-card-out-of-stock"}))};t.prototype.countryOption=function(t){var n=this;return o("div",{class:"s-product-options-digital-card-wrapper"},t.details.map((function(i){var r;return o("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}},o("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:((r=n.getSelectedDigitalCardOptions(t))===null||r===void 0?void 0:r.id)===i.id}:{})),o("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")}),o("span",null,i.name))})))};Object.defineProperty(t.prototype,"host",{get:function(){return e(this)},enumerable:false,configurable:true});return t}());p.style=d}}}));
|
|
5
|
+
//# sourceMappingURL=p-7dce6627.system.entry.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Crafted with ❤ by Salla
|
|
3
|
+
*/
|
|
4
|
+
import{r as s,h as t,H as a,g as e,c as o}from"./p-Hw2jlaNN.js";import{p as i,m as r}from"./p-DfeagqF1.js";const c="";const l=class{constructor(t){s(this,t);this.collapsible=true;this.bordered=false;this.size="md";this.collapsed=true;this.dir=document.dir||"rtl"}directionChangedHandler(s){this.dir=s.detail.dir}handleCollapse(s){this.collapsed=s.detail.payload.collapsed}setcollapsibleProp(){const s=this.host.querySelector("salla-accordion-head");if(this.collapsible&&s){s.setAttribute("collapsible","true");s.setAttribute("collapsed",this.collapsed.toString())}}componentDidRender(){this.setcollapsibleProp();const s=this.host.querySelector("salla-accordion-body");if(this.collapsible){this.host.setAttribute("data-collapsed",this.collapsed.toString());s===null||s===void 0?void 0:s.setAttribute("data-collapsed",this.collapsed.toString())}}render(){return t(a,{key:"ed8e4c0f24fa4462654e94fa46706e892c141351",class:`s-accordion-wrapper ${this.dir} ${this.bordered?"s-accordion-wrapper-bordered":""} ${this.size?`size-${this.size}`:""}`,"data-collapsed":this.collapsed.toString()},t("slot",{key:"1dbda01c073f3018a55ebcf5d8613a82a5dc6b27"}))}get host(){return e(this)}};l.style=c;const d="";const n=class{constructor(t){s(this,t)}render(){return t(a,{key:"298d42a5bf1bcefdb181ec35060220cf749b56ed",class:"s-accordion-body-wrapper"},t("slot",{key:"6ab081e8b71b5dc69fb66fbdec82b4725ab53b0d"}))}};n.style=d;const h="";const p=class{constructor(t){s(this,t);this.accordionToggle=o(this,"accordionToggle");this.collapsible=false;this.collapsed=true}emitCollapsePanel(){this.accordionToggle.emit({payload:{collapsed:this.collapsed}})}toggleCollapse(){var s,t,a;if(!this.collapsible)return;this.collapsed=!this.collapsed;(s=this.host.parentElement)===null||s===void 0?void 0:s.setAttribute("data-collapsed",this.collapsed.toString());(a=(t=this.host.parentElement)===null||t===void 0?void 0:t.querySelector("salla-accordion-body"))===null||a===void 0?void 0:a.setAttribute("data-collapsed",this.collapsed.toString());this.emitCollapsePanel()}render(){return t(a,{key:"9bb7ad4ad615f5316968b48839b2433619bd3850","data-collapsed":this.collapsed.toString(),onClick:()=>this.toggleCollapse(),class:"s-accordion-head-wrapper"},t("div",{key:"6826492e1c552440d6407435dfe4e0ca3915cdf4",class:"s-accordion-head-wrapper-start"},t("slot",{key:"2c19c500b57444ac8f69c2f64616904a819f54da",name:"title"}),t("slot",{key:"a6ed0daccd969ec94128f5f749ccddfa9f62e5d3",name:"subtitle"}),t("slot",{key:"adc2122dce76eee34653bc3f47324188c89d80f1",name:"html"})),(this.collapsible||this.host.querySelector('[slot="note"]'))&&t("div",{key:"f61363b6836fb857a0e832de99175936ec4bce29",class:"s-accordion-head-wrapper-end"},t("slot",{key:"15ee81e943714b30bfbaf718364f5d34b14617eb",name:"note"}),this.collapsible&&t("button",{key:"c5f8d32af544ddfba7b2fc2f273ae5b2e8cb7ae5",class:{"s-accordion-head-wrapper-toggle":true,active:!this.collapsed},onClick:s=>{s.stopPropagation();this.toggleCollapse()}},t("span",{key:"4c4e3fa6ddeda1a59f65ba47665a9203356037a6",class:"s-accordion-head-wrapper-toggle-icon",innerHTML:this.collapsed?i:r}))))}get host(){return e(this)}};p.style=h;var f=`\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-fill</title>\n<path d="M28 10.667h-2.667c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333h2.667c0.735 0 1.333 0.597 1.333 1.333v13.333c0 0.736-0.599 1.333-1.333 1.333h-13.333c-0.735 0-1.333-0.597-1.333-1.333v-2.667c0-0.737-0.597-1.333-1.333-1.333s-1.333 0.596-1.333 1.333v2.667c0 2.205 1.795 4 4 4h13.333c2.205 0 4-1.795 4-4v-13.333c0-2.205-1.795-4-4-4zM21.333 17.333v-13.333c0-2.205-1.795-4-4-4h-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-4zM2.667 17.333v-13.333c0-0.736 0.599-1.333 1.333-1.333h13.333c0.735 0 1.333 0.597 1.333 1.333v13.333c0 0.736-0.599 1.333-1.333 1.333h-13.333c-0.735 0-1.333-0.597-1.333-1.333z"></path>\n</svg>\n`;const b="";const u=class{constructor(t){s(this,t);this.bordered=true;this.placeholderImage="images/placeholder.png";this.optionsData=[]}componentWillLoad(){this.parseOptionsData()}componentWillUpdate(){this.parseOptionsData()}parseOptionsData(){if(!this.options){this.optionsData=[];return}if(typeof this.options==="string"){try{this.optionsData=JSON.parse(this.options)}catch(s){this.optionsData=[]}}else{this.optionsData=Array.isArray(this.options)?this.options:[]}}renderOptionValue(s){if(s.is_image){return t("div",{class:"s-order-details-option-image-container"},t("a",{href:s.value,target:"_blank"},t("img",{class:"s-order-details-option-image",src:s.value||this.placeholderImage,alt:s.name})))}if(s.color){return t("span",{title:s.value,class:"s-order-details-option-color-swatch",style:{backgroundColor:s.color}})}if(s.is_file){return t("a",{href:s.value,target:"_blank",class:"s-order-details-option-file-link"},"Attachments")}if(s.is_color_picker){return t("div",{class:"s-order-details-option-color-picker"},t("div",{class:"s-order-details-option-color-picker-content"},t("span",{class:"s-order-details-option-color-picker-text"},s.value),t("span",{class:"s-order-details-option-color-picker-swatch",style:{backgroundColor:s.value,width:"1rem"}})),t("salla-button",{onClick:t=>this.copyToClipboard(t,s.value),shape:"link",class:"s-order-details-option-color-picker-button"},t("span",{class:"s-order-details-option-color-copy-icon",innerHTML:f})))}if(s.is_map&&s.latitude&&s.longitude){return t("salla-map",{id:`location_map_${s.id}`,class:`map_${s.id}`,zoom:15,readonly:true,lat:s.latitude,lng:s.longitude},t("div",{slot:"button"},t("button",{type:"button",class:"s-order-details-option-map-button",onClick:()=>this.openMap(s.id)},"Show Location")))}return t("span",{class:"s-order-details-option-default-text"},s.display_value||s.value)}copyToClipboard(s,t){s.preventDefault();if(navigator.clipboard){navigator.clipboard.writeText(t)}}openMap(s){const t=document.querySelector(`salla-map.map_${s}`);if(t&&t.open){t.open()}}render(){if(!this.optionsData.length){return null}const s=this.bordered?"s-order-details-options-container":"s-order-details-options-container-borderless";return t(a,{class:"s-order-details-options-wrapper"},t("h2",{class:"s-order-details-options-title"},salla.lang.get("pages.cart.item_options")),t("div",{class:s},t("dl",{class:"s-order-details-options-list"},this.optionsData.map((s=>t("div",{key:s.id,class:"s-order-details-options-item"},t("dt",{class:"s-order-details-options-item-name"},s.name,":"),t("dd",{class:s.is_image?"s-order-details-options-item-value-image":"s-order-details-options-item-value-text"},this.renderOptionValue(s))))))))}};u.style=b;export{l as salla_accordion,n as salla_accordion_body,p as salla_accordion_head,u as salla_order_details_options};
|
|
5
|
+
//# sourceMappingURL=p-7f28b72e.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["sallaAccordionCss","SallaAccordion","constructor","hostRef","this","collapsible","bordered","size","collapsed","dir","document","directionChangedHandler","event","detail","handleCollapse","payload","setcollapsibleProp","head","host","querySelector","setAttribute","toString","componentDidRender","body","render","h","Host","key","class","sallaAccordionBodyCss","SallaAccordionBody","sallaAccordionHeadCss","SallaAccordionHead","emitCollapsePanel","accordionToggle","emit","toggleCollapse","_a","parentElement","_c","_b","onClick","name","active","e","stopPropagation","innerHTML","plusIcon","minusIcon","sallaOrderDetailsOptionsCss","SallaOrderDetailsOptions","placeholderImage","optionsData","componentWillLoad","parseOptionsData","componentWillUpdate","options","JSON","parse","Array","isArray","renderOptionValue","option","is_image","href","value","target","src","alt","color","title","style","backgroundColor","is_file","is_color_picker","width","copyToClipboard","shape","copyIcon","is_map","latitude","longitude","id","zoom","readonly","lat","lng","slot","type","openMap","display_value","content","preventDefault","navigator","clipboard","writeText","optionId","mapElement","open","length","containerClasses","salla","lang","get","map"],"sources":["src/components/salla-accordion/salla-accordion.scss?tag=salla-accordion","src/components/salla-accordion/salla-accordion.tsx","src/components/salla-accordion/salla-accordion-body.scss?tag=salla-accordion-body","src/components/salla-accordion/salla-accordion-body.tsx","src/components/salla-accordion/salla-accordion-head.scss?tag=salla-accordion-head","src/components/salla-accordion/salla-accordion-head.tsx","src/components/salla-order-details/salla-order-details-options.scss?tag=salla-order-details-options","src/components/salla-order-details/salla-order-details-options.tsx"],"sourcesContent":["\n","import { Component, Host, h, Element, Prop, State, Listen } from '@stencil/core';\n\n/**\n * @salla/ui-components\n * The `salla-accordion` component represents an accordion element.\n * Use this component to encapsulate content within a collapsible section.\n */\n@Component({\n tag: 'salla-accordion',\n styleUrl: 'salla-accordion.scss',\n shadow: false\n})\nexport class SallaAccordion {\n /** Reference to the host element. */\n @Element() host: HTMLElement;\n\n /** Should the accordion be collapsible or not. Default is true. */\n @Prop() collapsible: boolean = true;\n\n @Prop() bordered: boolean = false;\n\n @Prop() size: \"sm\" | \"md\" | \"lg\" = \"md\";\n\n /** Detect if accordion collapsed or not. */\n @Prop({ mutable: true, reflect: true }) collapsed: boolean = true;\n\n /** Represents the direction of the layout. */\n @State() dir: string = document.dir || 'rtl';\n\n @Listen('salla::language.change', { target: 'document' })\n directionChangedHandler(event: CustomEvent) {\n this.dir = event.detail.dir;\n }\n\n @Listen('accordionToggle')\n handleCollapse(event: CustomEvent) {\n this.collapsed = event.detail.payload.collapsed;\n }\n\n private setcollapsibleProp(): void {\n const head = this.host.querySelector('salla-accordion-head');\n if (this.collapsible && head) {\n head.setAttribute('collapsible', 'true');\n head.setAttribute('collapsed', this.collapsed.toString());\n }\n }\n\n componentDidRender() {\n this.setcollapsibleProp();\n\n const body = this.host.querySelector('salla-accordion-body');\n if (this.collapsible) {\n this.host.setAttribute('data-collapsed', this.collapsed.toString());\n body?.setAttribute('data-collapsed', this.collapsed.toString());\n }\n }\n\n render() {\n return (\n <Host class={`s-accordion-wrapper ${this.dir} ${this.bordered ? 's-accordion-wrapper-bordered' : ''} ${this.size ? `size-${this.size}` : ''}`} data-collapsed={this.collapsed.toString()}>\n <slot></slot>\n </Host>\n );\n }\n}\n","\n","import { Component, Host, h } from '@stencil/core';\n\n/**\n * @salla/ui-components\n * The `salla-accordion-body` component represents the body/content of an accordion.\n */\n@Component({\n tag: 'salla-accordion-body',\n styleUrl: 'salla-accordion-body.scss',\n shadow: false\n})\nexport class SallaAccordionBody {\n render() {\n return (\n <Host class=\"s-accordion-body-wrapper\">\n <slot></slot>\n </Host>\n );\n }\n}\n","\n","import { Component, Element, Event, EventEmitter, Host, h, Prop } from '@stencil/core';\nimport plusIcon from '../../assets/svg/add.svg';\nimport minusIcon from '../../assets/svg/minus.svg';\n\n/**\n * @salla/ui-components\n * The `salla-accordion-head` component represents the header of an accordion.\n */\n@Component({\n tag: 'salla-accordion-head',\n styleUrl: 'salla-accordion-head.scss',\n shadow: false,\n})\nexport class SallaAccordionHead {\n @Element() host: HTMLElement;\n\n /** Should the accordion be collapsible or not. */\n @Prop() collapsible: boolean = false;\n\n /** Current collapsed state */\n @Prop({ mutable: true, reflect: true }) collapsed: boolean = true;\n\n /**\n * Emitted when the accordion head is clicked and the collapsed state changes.\n * Only emitted when the component is collapsible.\n *\n * @event accordionToggle\n * @type {Object}\n * @property {Object} detail.payload - The event payload\n * @property {boolean} detail.payload.collapsed - The new collapsed state\n */\n @Event() accordionToggle: EventEmitter<Object>;\n\n private emitCollapsePanel(): void {\n this.accordionToggle.emit({\n payload: {\n collapsed: this.collapsed,\n },\n });\n }\n\n private toggleCollapse() {\n if (!this.collapsible) return;\n this.collapsed = !this.collapsed;\n this.host.parentElement?.setAttribute('data-collapsed', this.collapsed.toString());\n this.host.parentElement\n ?.querySelector('salla-accordion-body')\n ?.setAttribute('data-collapsed', this.collapsed.toString());\n this.emitCollapsePanel();\n }\n\n render() {\n return (\n <Host\n data-collapsed={this.collapsed.toString()}\n onClick={() => this.toggleCollapse()}\n class=\"s-accordion-head-wrapper\"\n >\n <div class=\"s-accordion-head-wrapper-start\">\n <slot name=\"title\"></slot>\n <slot name=\"subtitle\"></slot>\n <slot name=\"html\"></slot>\n </div>\n\n {(this.collapsible || this.host.querySelector('[slot=\"note\"]')) && (\n <div class=\"s-accordion-head-wrapper-end\">\n <slot name=\"note\"></slot>\n {this.collapsible && (\n <button\n class={{\n 's-accordion-head-wrapper-toggle': true,\n active: !this.collapsed,\n }}\n onClick={e => {\n e.stopPropagation();\n this.toggleCollapse();\n }}\n >\n <span\n class=\"s-accordion-head-wrapper-toggle-icon\"\n innerHTML={this.collapsed ? plusIcon : minusIcon}\n ></span>\n </button>\n )}\n </div>\n )}\n </Host>\n );\n }\n}\n",null,"import { Component, Host, h, Prop, State } from '@stencil/core';\nimport { ProductOption } from './interfaces';\nimport copyIcon from '../../assets/svg/swap-fill.svg';\n\n/**\n * @salla/ui-components\n * The `salla-order-details-options` component renders product options for order details.\n * It displays various types of options including colors, images, files, maps, and text values.\n */\n@Component({\n tag: 'salla-order-details-options',\n styleUrl: 'salla-order-details-options.scss',\n})\nexport class SallaOrderDetailsOptions {\n /** Product options to display */\n @Prop() options?: ProductOption[] | string;\n\n /** Whether to show the options in a bordered container */\n @Prop() bordered?: boolean = true;\n\n /** Placeholder image URL when option image is not available */\n @Prop() placeholderImage: string = 'images/placeholder.png';\n\n /** Parsed options data */\n @State() optionsData: ProductOption[] = [];\n\n componentWillLoad() {\n this.parseOptionsData();\n }\n\n componentWillUpdate() {\n this.parseOptionsData();\n }\n\n private parseOptionsData() {\n if (!this.options) {\n this.optionsData = [];\n return;\n }\n\n if (typeof this.options === 'string') {\n try {\n this.optionsData = JSON.parse(this.options);\n } catch (e) {\n // Invalid options JSON, fallback to empty array\n this.optionsData = [];\n }\n } else {\n this.optionsData = Array.isArray(this.options) ? this.options : [];\n }\n }\n\n private renderOptionValue(option: ProductOption) {\n // Handle image options\n if (option.is_image) {\n return (\n <div class=\"s-order-details-option-image-container\">\n <a href={option.value as string} target=\"_blank\">\n <img\n class=\"s-order-details-option-image\"\n src={(option.value as string) || this.placeholderImage}\n alt={option.name}\n />\n </a>\n </div>\n );\n }\n\n // Handle color options\n if (option.color) {\n return (\n <span\n title={option.value as string}\n class=\"s-order-details-option-color-swatch\"\n style={{ backgroundColor: option.color }}\n ></span>\n );\n }\n\n // Handle file options\n if (option.is_file) {\n return (\n <a href={option.value as string} target=\"_blank\" class=\"s-order-details-option-file-link\">\n Attachments\n </a>\n );\n }\n\n // Handle color picker options\n if (option.is_color_picker) {\n return (\n <div class=\"s-order-details-option-color-picker\">\n <div class=\"s-order-details-option-color-picker-content\">\n <span class=\"s-order-details-option-color-picker-text\">{option.value}</span>\n <span\n class=\"s-order-details-option-color-picker-swatch\"\n style={{ backgroundColor: option.value as string, width: '1rem' }}\n ></span>\n </div>\n <salla-button\n onClick={e => this.copyToClipboard(e, option.value as string)}\n shape=\"link\"\n class=\"s-order-details-option-color-picker-button\"\n >\n <span class=\"s-order-details-option-color-copy-icon\" innerHTML={copyIcon}></span>\n </salla-button>\n </div>\n );\n }\n\n // Handle map options\n if (option.is_map && option.latitude && option.longitude) {\n return (\n <salla-map\n id={`location_map_${option.id}`}\n class={`map_${option.id}`}\n zoom={15}\n readonly\n lat={option.latitude as number}\n lng={option.longitude as number}\n >\n <div slot=\"button\">\n <button\n type=\"button\"\n class=\"s-order-details-option-map-button\"\n onClick={() => this.openMap(option.id)}\n >\n Show Location\n </button>\n </div>\n </salla-map>\n );\n }\n\n // Default text value\n return (\n <span class=\"s-order-details-option-default-text\">\n {option.display_value || option.value}\n </span>\n );\n }\n\n private copyToClipboard(event: Event, content: string) {\n event.preventDefault();\n if (navigator.clipboard) {\n navigator.clipboard.writeText(content);\n }\n }\n\n private openMap(optionId: string | number) {\n const mapElement = document.querySelector(`salla-map.map_${optionId}`) as any;\n if (mapElement && mapElement.open) {\n mapElement.open();\n }\n }\n\n render() {\n if (!this.optionsData.length) {\n return null;\n }\n\n const containerClasses = this.bordered\n ? 's-order-details-options-container'\n : 's-order-details-options-container-borderless';\n\n return (\n <Host class=\"s-order-details-options-wrapper\">\n <h2 class=\"s-order-details-options-title\">{salla.lang.get('pages.cart.item_options')}</h2>\n <div class={containerClasses}>\n <dl class=\"s-order-details-options-list\">\n {this.optionsData.map(option => (\n <div key={option.id} class=\"s-order-details-options-item\">\n <dt class=\"s-order-details-options-item-name\">{option.name}:</dt>\n <dd\n class={\n option.is_image\n ? 's-order-details-options-item-value-image'\n : 's-order-details-options-item-value-text'\n }\n >\n {this.renderOptionValue(option)}\n </dd>\n </div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r as s,h as a,H as t,g as l}from"./p-Hw2jlaNN.js";const r=":host{display:block}";const i=class{constructor(a){s(this,a);var t;this.apps=salla.config.get("store.apps");this.appSlot=((t=this.host.querySelector('[slot="app"]'))===null||t===void 0?void 0:t.innerHTML)||`<img alt={name} src={icon} />`;salla.onReady((()=>{this.apps=salla.config.get("store.apps")}));salla.lang.onLoaded((()=>{this.appsTitle=salla.lang.get("blocks.footer.download_apps")}))}getAppsArray(){return Object.entries(this.apps).map((([s,a])=>({name:s,value:a})))}componentWillLoad(){return new Promise((s=>salla.onReady(s)))}render(){const s=this.getAppsArray();if(Array.isArray(s)&&!s.length){return}return a(t,{class:"s-apps-icons"},!this.hideTitle&&a("h3",null,this.appsTitle),a("div",{class:{"s-apps-icons-list":true,vertical:this.vertical}},s.map(((s,t)=>a("a",{key:t,href:s.value,rel:"noreferrer",target:"_blank",class:"s-apps-icons-item",id:"app-slot",innerHTML:this.appSlot.replace(/\{icon\}/g,salla.url.cdn(`images/${s.name}.png`)).replace(/\{name\}/g,s.name)})))))}componentDidRender(){var s;(s=this.host.querySelector('[slot="app"]'))===null||s===void 0?void 0:s.remove()}get host(){return l(this)}};i.style=r;export{i as salla_apps_icons};
|
|
5
|
+
//# sourceMappingURL=p-83f6408a.entry.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
System.register(["./p-
|
|
5
|
-
//# sourceMappingURL=p-
|
|
4
|
+
System.register(["./p-CQDiSGcm.system.js"],(function(t){"use strict";var s,n,a,i;return{setters:[function(t){s=t.r;n=t.h;a=t.H;i=t.g}],execute:function(){var r=":host{display:block}";var e=t("salla_apps_icons",function(){function t(t){var n=this;s(this,t);var a;this.apps=salla.config.get("store.apps");this.appSlot=((a=this.host.querySelector('[slot="app"]'))===null||a===void 0?void 0:a.innerHTML)||"<img alt={name} src={icon} />";salla.onReady((function(){n.apps=salla.config.get("store.apps")}));salla.lang.onLoaded((function(){n.appsTitle=salla.lang.get("blocks.footer.download_apps")}))}t.prototype.getAppsArray=function(){return Object.entries(this.apps).map((function(t){var s=t[0],n=t[1];return{name:s,value:n}}))};t.prototype.componentWillLoad=function(){return new Promise((function(t){return salla.onReady(t)}))};t.prototype.render=function(){var t=this;var s=this.getAppsArray();if(Array.isArray(s)&&!s.length){return}return n(a,{class:"s-apps-icons"},!this.hideTitle&&n("h3",null,this.appsTitle),n("div",{class:{"s-apps-icons-list":true,vertical:this.vertical}},s.map((function(s,a){return n("a",{key:a,href:s.value,rel:"noreferrer",target:"_blank",class:"s-apps-icons-item",id:"app-slot",innerHTML:t.appSlot.replace(/\{icon\}/g,salla.url.cdn("images/".concat(s.name,".png"))).replace(/\{name\}/g,s.name)})}))))};t.prototype.componentDidRender=function(){var t;(t=this.host.querySelector('[slot="app"]'))===null||t===void 0?void 0:t.remove()};Object.defineProperty(t.prototype,"host",{get:function(){return i(this)},enumerable:false,configurable:true});return t}());e.style=r}}}));
|
|
5
|
+
//# sourceMappingURL=p-888de4b8.system.entry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"p-CHKd1ZbK.system.js","sources":["src/components/salla-verify/salla-verify.scss?tag=salla-verify","src/components/salla-verify/salla-verify.tsx"],"sourcesContent":["/*\n* Verify Component: verify step in login and register and displays after the user change it's phone number.\n* You can use these classes to target the elements in the component.\n*/\n\nsalla-verify {\n display: block;\n}\n\n.s-verify {\n &-host{\n \n }\n &-message {\n\n }\n &-label {\n\n }\n &-codes {\n\n }\n &-input {\n // Hide number input arrows\n /* Chrome, Safari, Edge, Opera */\n &::-webkit-outer-spin-button,\n &::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n /* Firefox */\n &[type=number] {\n -moz-appearance: textfield;\n }\n }\n &-footer {\n\n }\n &-submit {\n\n }\n &-resend-message {\n\n }\n &-timer {\n\n }\n &-resend {\n\n }\n &-back {\n \n }\n}\n","import { Component, Host, Element, Event, EventEmitter, h, Method, Prop, State } from '@stencil/core';\nimport AndroidPhoneIcon from '../../assets/svg/android-phone.svg';\nimport MailIcon from '../../assets/svg/mail.svg';\n\n/**\n * @slot footer - Replaces the footer, by default it contains: verify button, resend, and timer\n * @slot after-footer - placeholder position\n */\n@Component({ tag: 'salla-verify', styleUrl: 'salla-verify.scss' })\n\nexport class SallaVerify {\n constructor() {\n salla.lang.onLoaded(() => {\n this.translationLoaded = true;\n this.title = salla.lang.get('pages.profile.verify_title') + salla.lang.get('common.elements.' + this.type);\n this.modal?.setTitle(this.title);\n });\n\n if (this.display == 'inline') {\n this.modal = { open: () => '', close: () => '', setTitle: () => '' };\n return;\n }\n\n //todo:: change this way, now we fire the event from the backend, we should listen to salla.profile.event.onUpdated\n salla.event.on('profile::verification', data => {\n let payload = Array.isArray(data) ? data[0] : data;\n this.isProfileVerify = true;\n this.open(payload);\n this.title = salla.lang.get('pages.profile.verify_title') + salla.lang.get('common.elements.' + payload.type);\n this.modal?.setTitle(this.title);\n });\n\n salla.event.on('modalClosed', () => {\n this.resendAfter = 0;\n this.timer.innerHTML = '30 : 00';\n });\n\n }\n\n private modal: HTMLSallaModalElement | any;\n private body: HTMLDivElement;\n private code: HTMLInputElement;\n private btn: HTMLSallaButtonElement;\n private resendMessage: HTMLParagraphElement;\n private timer: HTMLElement;\n private resend: HTMLAnchorElement;\n private otpInputs: NodeListOf<HTMLInputElement>;\n private firstOtpInput: HTMLInputElement;\n private data: { type: 'mobile' | 'email', phone?: string, country_code?: string, email?: string };\n\n @State() translationLoaded: boolean = false;\n\n @Element() host: HTMLElement;\n /**\n * Should render component without modal\n */\n @Prop() display: 'inline' | 'modal' = 'modal';\n\n /**\n * Verifying method\n */\n @Prop({ mutable: true }) type: 'mobile' | 'email' = 'mobile';\n /**\n * should auto reloading the page after success verification\n */\n @Prop() autoReload: boolean = true;\n\n /**\n * Once the api verify success, it will be login the customer in web pages\n */\n @Prop() supportWebAuth: boolean = true;\n\n /**\n * Event when success verification\n */\n @Event() verified: EventEmitter;\n\n @State() title: string;\n\n @State() resendAfter: number = 30;\n @State() hasError: boolean;\n @State() errorMessage: string;\n /**\n * to use: `salla.api.auth.verify` or `salla.profile.verify`\n */\n @State() isProfileVerify: boolean = false;\n \n private splitNumber(e: any) {\n this.resetError();\n let data = e.data || e.target.value; // Chrome doesn't get the e.data, it's always empty, fallback to value then.\n if (!data) return; // Shouldn't happen, just in case.\n if (data.length === 1) return; // Here is a normal behavior, not a paste action.\n this.modifyNext(e.target, data);\n }\n \n private modifyNext(el: HTMLInputElement, data: string) {\n el.value = data[0]; // Apply first item to first input\n data = data.substring(1); // remove the first char.\n if (el.nextElementSibling && data.length) {\n // Do the same with the next element and next data\n this.modifyNext(el.nextElementSibling as HTMLInputElement, data);\n } else if (!el.nextElementSibling && data.length === 0) {\n el.focus();\n } else if (el.nextElementSibling && data.length === 0) {\n (el.nextElementSibling as HTMLInputElement).focus();\n }\n }\n \n private checkAllInputs() {\n let allFilled = true;\n for (let i = 0; i < this.otpInputs.length; i++) {\n if (this.otpInputs[i].value === '') {\n allFilled = false;\n }\n }\n return allFilled;\n }\n\n private handleKeyUp(ev) {\n this.resetError();\n if (['Alt', 'Shift', 'Control', 'AltGraph', 'Ctrl'].includes(ev.key)) {\n return;\n }\n let key = ev.keyCode || ev.charCode;\n if (ev.target.value) {\n ev.target.nextElementSibling?.focus();\n ev.target.nextElementSibling?.select();\n } else if ([8, 46].includes(key)) {\n ev.target.previousElementSibling?.focus();\n ev.target.previousElementSibling?.select();\n }\n // If the target is populated to quickly, value length can be > 1\n if (ev.target.value.length > 1) {\n this.splitNumber(ev);\n }\n }\n\n private handlePaste(ev: ClipboardEvent) {\n this.resetError();\n const clipboardText = salla.helpers.number(ev.clipboardData.getData('text')) || '';\n let text = clipboardText.replace(/[^0-9]/g, '');\n \n text = text.substring(0, this.otpInputs.length);\n\n this.otpInputs.forEach(input => input.value = '');\n this.modifyNext(this.otpInputs[0], text);\n }\n\n private handleInput(ev) {\n this.resetError();\n salla.helpers.inputDigitsOnly(ev.target)\n // check if all otpInputs has values then send the request\n if (this.checkAllInputs()) {\n setTimeout(() => {\n this.toggleOTPSubmit();\n }, 100);\n }\n }\n\n private resetError() {\n this.hasError = false;\n this.errorMessage = '';\n }\n private handleFocus(ev) {\n // If the focus element is the first one, do nothing\n if (ev.target === this.firstOtpInput) return;\n // If value of input 1 is empty, focus it.\n if (this.firstOtpInput?.value == '') {\n this.firstOtpInput.focus();\n }\n // If value of a previous input is empty, focus it.\n // To remove if you don't wanna force user respecting the fields order.\n if (ev.target.previousElementSibling.value == '') {\n ev.target.previousElementSibling.focus();\n }\n }\n\n /**\n * Get current code\n * @return {string}\n */\n @Method()\n async getCode() {\n return this.code.value;\n }\n\n /**\n * Open verifying modal\n * @param data\n */\n @Method()\n async open(data) {\n this.data = data;\n this.data.type = this.data.type || this.type;\n this.type = this.data.type;\n this.resendTimer();\n this.otpInputs = this.body.querySelectorAll('.s-verify-input');\n this.firstOtpInput = this.body.querySelector('#otp-1');\n this.reset();\n this.resetError();\n this.display == 'modal' && this.modal?.setTitle(this.title);\n this.modal.open();\n this.firstOtpInput?.addEventListener('input', e => this.splitNumber(e));\n // focus the first input after opening the modal\n setTimeout(() => this.otpInputs[0].focus(), 100);\n }\n\n private toggleOTPSubmit() {\n let otp = []\n this.otpInputs.forEach(input => input.value && otp.push(input.value));\n\n this.code.value = otp.join('');\n\n if (otp.length === 4) {\n this.btn.disable()\n this.btn.click();\n return;\n }\n\n this.btn.enable()\n }\n\n private reset() {\n this.otpInputs.forEach((input) => input.value = '');\n this.code.value = '';\n this.otpInputs[0].focus();\n }\n\n private resendTimer() {\n this.resendMessage.style.display = 'block';\n this.resend.style.display = 'none';\n this.resendAfter = 30;\n\n let timerId = setInterval(() => {\n if (this.resendAfter <= 0) {\n clearInterval(timerId);\n this.resend.style.display = 'block';\n this.resendMessage.style.display = 'none';\n } else {\n this.timer.innerHTML = `${this.resendAfter >= 10 ? this.resendAfter : '0' + this.resendAfter} : 00`;\n this.resendAfter--;\n }\n }, 1000);\n }\n\n private resendCode() {\n return this.btn.stop()\n .then(() => this.btn.disable())\n .then(() => {\n this.otpInputs.forEach(input => input.value = '');\n this.otpInputs[0].focus();\n })\n .then(() => salla.api.auth.resend(this.data))\n .finally(() => this.resendTimer());\n }\n\n private submit() {\n //if code not 4 digits, focus on the after filled input,\n if (this.code.value.length < 4) {\n this.otpInputs[this.code.value.length].focus();\n salla.log('Trying to submit without 4 digits!');\n return;\n }\n\n let data = { code: this.code.value, ...this.data };\n\n return this.btn.load()\n .then(() => this.btn.disable())\n .then(() => this.isProfileVerify ? salla.profile.verify(data) : salla.auth.verify(data, this.supportWebAuth))\n .then(response => this.verified.emit(response))\n .then(() => this.btn.stop() && this.btn.disable())\n .then(() => this.modal.close())\n .then(() => this.autoReload && window.location.reload())\n .catch((error) => {\n this.hasError = true;\n this.errorMessage = error.response?.data?.error?.message || salla.lang.get('common.errors.error_occurred');\n if (!error.response) {\n console.log('Unexpected error', error);\n } else {\n salla.logger.error(error);\n }\n this.btn.stop() && this.btn.enable() && this.reset()\n });\n }\n\n render() {\n return this.display == 'inline' ? <Host>{this.myBody()}</Host> :\n <salla-modal width=\"xs\" class=\"s-verify\" ref={modal => this.modal = modal}\n modal-title={this.title}>\n <span slot='icon' class=\"s-verify-header-icon\" innerHTML={this.type == \"mobile\" ? AndroidPhoneIcon : MailIcon}></span>\n {this.myBody()}\n </salla-modal>;\n }\n\n\n private myBody() {\n return (\n <div class=\"s-verify-body\" ref={body => this.body = body}>\n <div class=\"s-verify-message\" innerHTML={salla.lang.get('pages.profile.verify_message')} />\n <slot name=\"mobile\" />\n <slot name=\"email\" />\n <input type=\"hidden\" name=\"code\" maxlength=\"4\" required ref={code => this.code = code} />\n <div class={{\"s-verify-codes\": true, \"has-error\": this.hasError}} dir=\"ltr\">\n {[1, 2, 3, 4].map((i) => <input type=\"number\" autocomplete=\"one-time-code\" pattern=\"[0-9]*\" inputmode=\"numeric\"\n maxlength=\"1\" value=\"\" id={`otp-${i}`} class={{\"s-verify-input\": true, \"s-has-error\": this.hasError}}\n onInput={e => this.handleInput(e)}\n onPaste={e => this.handlePaste(e)}\n onKeyUp={e => this.handleKeyUp(e)}\n onFocus={e => this.handleFocus(e)}\n required />)}\n </div>\n {this.hasError && this.errorMessage ? <span class=\"s-verify-error-message\">\n {this.errorMessage}\n </span> : ''}\n <div slot=\"footer\" class=\"s-verify-footer\">\n <salla-button class=\"s-verify-submit\" loader-position='center' disabled={true}\n onClick={() => this.submit()}\n ref={b => this.btn = b}>\n {salla.lang.get('pages.profile.verify')}\n </salla-button>\n <p class=\"s-verify-resend-message\" ref={el => this.resendMessage = el}>\n {salla.lang.get('blocks.header.resend_after')}\n <b class=\"s-verify-timer\" ref={el => this.timer = el}></b></p>\n <a href=\"#\" class=\"s-verify-resend\" onClick={() => this.resendCode()}\n ref={el => this.resend = el}>{salla.lang.get('blocks.comments.submit')}</a>\n </div>\n <slot name=\"after-footer\" />\n </div>\n );\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;MAAA,MAAM,cAAc,GAAG,4NAA4N;;YCUtO,WAAW,2BAAA,MAAA;MACtB,IAAA,WAAA,CAAA,OAAA,EAAA;;;MAuCS,QAAA,IAAiB,CAAA,iBAAA,GAAY,KAAK;MAG3C;;MAEG;MACK,QAAA,IAAO,CAAA,OAAA,GAAuB,OAAO;MAE7C;;MAEG;MACsB,QAAA,IAAI,CAAA,IAAA,GAAuB,QAAQ;MAC5D;;MAEG;MACK,QAAA,IAAU,CAAA,UAAA,GAAY,IAAI;MAElC;;MAEG;MACK,QAAA,IAAc,CAAA,cAAA,GAAY,IAAI;MAS7B,QAAA,IAAW,CAAA,WAAA,GAAW,EAAE;MAGjC;;MAEG;MACM,QAAA,IAAe,CAAA,eAAA,GAAY,KAAK;MAzEvC,QAAA,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAK;;MACvB,YAAA,IAAI,CAAC,i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C,CAAA,CAAA,GAAA,EAAA,EAAG,KAAK,EAAC,gBAAgB,EAAC,GAAG,EAAE,EAAE,IAAI,IAAI,CAAC,KAAK,GAAG,EAAE,GAAM,CAAI,EAChE,CAAA,CAAA,GAAA,EAAA,EAAG,IAAI,EAAC,GAAG,EAAC,KAAK,EAAC,iBAAiB,EAAC,OAAO,EAAE,MAAM,IAAI,CAAC,UAAU,EAAE,EAClE,GAAG,EAAE,EAAE,IAAI,IAAI,CAAC,MAAM,GAAG,EAAE,EAAA,EAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAK,CACzE,EACN,CAAA,CAAA,MAAA,EAAA,EAAM,IAAI,EAAC,cAAc,EAAG,CAAA,CACxB;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"p-8SAlNoQ7.system.js","sources":["src/components/salla-verify/salla-verify.scss?tag=salla-verify","src/components/salla-verify/salla-verify.tsx"],"sourcesContent":["/*\n* Verify Component: verify step in login and register and displays after the user change it's phone number.\n* You can use these classes to target the elements in the component.\n*/\n\nsalla-verify {\n display: block;\n}\n\n.s-verify {\n &-host{\n \n }\n &-message {\n\n }\n &-label {\n\n }\n &-codes {\n\n }\n &-input {\n // Hide number input arrows\n /* Chrome, Safari, Edge, Opera */\n &::-webkit-outer-spin-button,\n &::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n /* Firefox */\n &[type=number] {\n -moz-appearance: textfield;\n }\n }\n &-footer {\n\n }\n &-submit {\n\n }\n &-resend-message {\n\n }\n &-timer {\n\n }\n &-resend {\n\n }\n &-back {\n \n }\n}\n","import { Component, Host, Element, Event, EventEmitter, h, Method, Prop, State } from '@stencil/core';\nimport AndroidPhoneIcon from '../../assets/svg/android-phone.svg';\nimport MailIcon from '../../assets/svg/mail.svg';\n\n/**\n * @slot footer - Replaces the footer, by default it contains: verify button, resend, and timer\n * @slot after-footer - placeholder position\n */\n@Component({ tag: 'salla-verify', styleUrl: 'salla-verify.scss' })\n\nexport class SallaVerify {\n constructor() {\n salla.lang.onLoaded(() => {\n this.translationLoaded = true;\n this.title = salla.lang.get('pages.profile.verify_title') + salla.lang.get('common.elements.' + this.type);\n this.modal?.setTitle(this.title);\n });\n\n if (this.display == 'inline') {\n this.modal = { open: () => '', close: () => '', setTitle: () => '' };\n return;\n }\n\n //todo:: change this way, now we fire the event from the backend, we should listen to salla.profile.event.onUpdated\n salla.event.on('profile::verification', data => {\n let payload = Array.isArray(data) ? data[0] : data;\n this.isProfileVerify = true;\n this.open(payload);\n this.title = salla.lang.get('pages.profile.verify_title') + salla.lang.get('common.elements.' + payload.type);\n this.modal?.setTitle(this.title);\n });\n\n salla.event.on('modalClosed', () => {\n this.resendAfter = 0;\n this.timer.innerHTML = '30 : 00';\n });\n\n }\n\n private modal: HTMLSallaModalElement | any;\n private body: HTMLDivElement;\n private code: HTMLInputElement;\n private btn: HTMLSallaButtonElement;\n private resendMessage: HTMLParagraphElement;\n private timer: HTMLElement;\n private resend: HTMLAnchorElement;\n private otpInputs: NodeListOf<HTMLInputElement>;\n private firstOtpInput: HTMLInputElement;\n private data: { type: 'mobile' | 'email', phone?: string, country_code?: string, email?: string };\n\n @State() translationLoaded: boolean = false;\n\n @Element() host: HTMLElement;\n /**\n * Should render component without modal\n */\n @Prop() display: 'inline' | 'modal' = 'modal';\n\n /**\n * Verifying method\n */\n @Prop({ mutable: true }) type: 'mobile' | 'email' = 'mobile';\n /**\n * should auto reloading the page after success verification\n */\n @Prop() autoReload: boolean = true;\n\n /**\n * Once the api verify success, it will be login the customer in web pages\n */\n @Prop() supportWebAuth: boolean = true;\n\n /**\n * Event when success verification\n */\n @Event() verified: EventEmitter;\n\n @State() title: string;\n\n @State() resendAfter: number = 30;\n @State() hasError: boolean;\n @State() errorMessage: string;\n /**\n * to use: `salla.api.auth.verify` or `salla.profile.verify`\n */\n @State() isProfileVerify: boolean = false;\n \n private splitNumber(e: any) {\n this.resetError();\n let data = e.data || e.target.value; // Chrome doesn't get the e.data, it's always empty, fallback to value then.\n if (!data) return; // Shouldn't happen, just in case.\n if (data.length === 1) return; // Here is a normal behavior, not a paste action.\n this.modifyNext(e.target, data);\n }\n \n private modifyNext(el: HTMLInputElement, data: string) {\n el.value = data[0]; // Apply first item to first input\n data = data.substring(1); // remove the first char.\n if (el.nextElementSibling && data.length) {\n // Do the same with the next element and next data\n this.modifyNext(el.nextElementSibling as HTMLInputElement, data);\n } else if (!el.nextElementSibling && data.length === 0) {\n el.focus();\n } else if (el.nextElementSibling && data.length === 0) {\n (el.nextElementSibling as HTMLInputElement).focus();\n }\n }\n \n private checkAllInputs() {\n let allFilled = true;\n for (let i = 0; i < this.otpInputs.length; i++) {\n if (this.otpInputs[i].value === '') {\n allFilled = false;\n }\n }\n return allFilled;\n }\n\n private handleKeyUp(ev) {\n this.resetError();\n if (['Alt', 'Shift', 'Control', 'AltGraph', 'Ctrl'].includes(ev.key)) {\n return;\n }\n let key = ev.keyCode || ev.charCode;\n if (ev.target.value) {\n ev.target.nextElementSibling?.focus();\n ev.target.nextElementSibling?.select();\n } else if ([8, 46].includes(key)) {\n ev.target.previousElementSibling?.focus();\n ev.target.previousElementSibling?.select();\n }\n // If the target is populated to quickly, value length can be > 1\n if (ev.target.value.length > 1) {\n this.splitNumber(ev);\n }\n }\n\n private handlePaste(ev: ClipboardEvent) {\n this.resetError();\n const clipboardText = salla.helpers.number(ev.clipboardData.getData('text')) || '';\n let text = clipboardText.replace(/[^0-9]/g, '');\n \n text = text.substring(0, this.otpInputs.length);\n\n this.otpInputs.forEach(input => input.value = '');\n this.modifyNext(this.otpInputs[0], text);\n }\n\n private handleInput(ev) {\n this.resetError();\n salla.helpers.inputDigitsOnly(ev.target)\n // check if all otpInputs has values then send the request\n if (this.checkAllInputs()) {\n setTimeout(() => {\n this.toggleOTPSubmit();\n }, 100);\n }\n }\n\n private resetError() {\n this.hasError = false;\n this.errorMessage = '';\n }\n private handleFocus(ev) {\n // If the focus element is the first one, do nothing\n if (ev.target === this.firstOtpInput) return;\n // If value of input 1 is empty, focus it.\n if (this.firstOtpInput?.value == '') {\n this.firstOtpInput.focus();\n }\n // If value of a previous input is empty, focus it.\n // To remove if you don't wanna force user respecting the fields order.\n if (ev.target.previousElementSibling.value == '') {\n ev.target.previousElementSibling.focus();\n }\n }\n\n /**\n * Get current code\n * @return {string}\n */\n @Method()\n async getCode() {\n return this.code.value;\n }\n\n /**\n * Open verifying modal\n * @param data\n */\n @Method()\n async open(data) {\n this.data = data;\n this.data.type = this.data.type || this.type;\n this.type = this.data.type;\n this.resendTimer();\n this.otpInputs = this.body.querySelectorAll('.s-verify-input');\n this.firstOtpInput = this.body.querySelector('#otp-1');\n this.reset();\n this.resetError();\n this.display == 'modal' && this.modal?.setTitle(this.title);\n this.modal.open();\n this.firstOtpInput?.addEventListener('input', e => this.splitNumber(e));\n // focus the first input after opening the modal\n setTimeout(() => this.otpInputs[0].focus(), 100);\n }\n\n private toggleOTPSubmit() {\n let otp = []\n this.otpInputs.forEach(input => input.value && otp.push(input.value));\n\n this.code.value = otp.join('');\n\n if (otp.length === 4) {\n this.btn.disable()\n this.btn.click();\n return;\n }\n\n this.btn.enable()\n }\n\n private reset() {\n this.otpInputs.forEach((input) => input.value = '');\n this.code.value = '';\n this.otpInputs[0].focus();\n }\n\n private resendTimer() {\n this.resendMessage.style.display = 'block';\n this.resend.style.display = 'none';\n this.resendAfter = 30;\n\n let timerId = setInterval(() => {\n if (this.resendAfter <= 0) {\n clearInterval(timerId);\n this.resend.style.display = 'block';\n this.resendMessage.style.display = 'none';\n } else {\n this.timer.innerHTML = `${this.resendAfter >= 10 ? this.resendAfter : '0' + this.resendAfter} : 00`;\n this.resendAfter--;\n }\n }, 1000);\n }\n\n private resendCode() {\n return this.btn.stop()\n .then(() => this.btn.disable())\n .then(() => {\n this.otpInputs.forEach(input => input.value = '');\n this.otpInputs[0].focus();\n })\n .then(() => salla.api.auth.resend(this.data))\n .finally(() => this.resendTimer());\n }\n\n private submit() {\n //if code not 4 digits, focus on the after filled input,\n if (this.code.value.length < 4) {\n this.otpInputs[this.code.value.length].focus();\n salla.log('Trying to submit without 4 digits!');\n return;\n }\n\n let data = { code: this.code.value, ...this.data };\n\n return this.btn.load()\n .then(() => this.btn.disable())\n .then(() => this.isProfileVerify ? salla.profile.verify(data) : salla.auth.verify(data, this.supportWebAuth))\n .then(response => this.verified.emit(response))\n .then(() => this.btn.stop() && this.btn.disable())\n .then(() => this.modal.close())\n .then(() => this.autoReload && window.location.reload())\n .catch((error) => {\n this.hasError = true;\n this.errorMessage = error.response?.data?.error?.message || salla.lang.get('common.errors.error_occurred');\n if (!error.response) {\n console.log('Unexpected error', error);\n } else {\n salla.logger.error(error);\n }\n this.btn.stop() && this.btn.enable() && this.reset()\n });\n }\n\n render() {\n return this.display == 'inline' ? <Host>{this.myBody()}</Host> :\n <salla-modal width=\"xs\" class=\"s-verify\" ref={modal => this.modal = modal}\n modal-title={this.title}>\n <span slot='icon' class=\"s-verify-header-icon\" innerHTML={this.type == \"mobile\" ? AndroidPhoneIcon : MailIcon}></span>\n {this.myBody()}\n </salla-modal>;\n }\n\n\n private myBody() {\n return (\n <div class=\"s-verify-body\" ref={body => this.body = body}>\n <div class=\"s-verify-message\" innerHTML={salla.lang.get('pages.profile.verify_message')} />\n <slot name=\"mobile\" />\n <slot name=\"email\" />\n <input type=\"hidden\" name=\"code\" maxlength=\"4\" required ref={code => this.code = code} />\n <div class={{\"s-verify-codes\": true, \"has-error\": this.hasError}} dir=\"ltr\">\n {[1, 2, 3, 4].map((i) => <input type=\"number\" autocomplete=\"one-time-code\" pattern=\"[0-9]*\" inputmode=\"numeric\"\n maxlength=\"1\" value=\"\" id={`otp-${i}`} class={{\"s-verify-input\": true, \"s-has-error\": this.hasError}}\n onInput={e => this.handleInput(e)}\n onPaste={e => this.handlePaste(e)}\n onKeyUp={e => this.handleKeyUp(e)}\n onFocus={e => this.handleFocus(e)}\n required />)}\n </div>\n {this.hasError && this.errorMessage ? <span class=\"s-verify-error-message\">\n {this.errorMessage}\n </span> : ''}\n <div slot=\"footer\" class=\"s-verify-footer\">\n <salla-button class=\"s-verify-submit\" loader-position='center' disabled={true}\n onClick={() => this.submit()}\n ref={b => this.btn = b}>\n {salla.lang.get('pages.profile.verify')}\n </salla-button>\n <p class=\"s-verify-resend-message\" ref={el => this.resendMessage = el}>\n {salla.lang.get('blocks.header.resend_after')}\n <b class=\"s-verify-timer\" ref={el => this.timer = el}></b></p>\n <a href=\"#\" class=\"s-verify-resend\" onClick={() => this.resendCode()}\n ref={el => this.resend = el}>{salla.lang.get('blocks.comments.submit')}</a>\n </div>\n <slot name=\"after-footer\" />\n </div>\n );\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;MAAA,MAAM,cAAc,GAAG,4NAA4N;;YCUtO,WAAW,2BAAA,MAAA;MACtB,IAAA,WAAA,CAAA,OAAA,EAAA;;;MAuCS,QAAA,IAAiB,CAAA,iBAAA,GAAY,KAAK;MAG3C;;MAEG;MACK,QAAA,IAAO,CAAA,OAAA,GAAuB,OAAO;MAE7C;;MAEG;MACsB,QAAA,IAAI,CAAA,IAAA,GAAuB,QAAQ;MAC5D;;MAEG;MACK,QAAA,IAAU,CAAA,UAAA,GAAY,IAAI;MAElC;;MAEG;MACK,QAAA,IAAc,CAAA,cAAA,GAAY,IAAI;MAS7B,QAAA,IAAW,CAAA,WAAA,GAAW,EAAE;MAGjC;;MAEG;MACM,QAAA,IAAe,CAAA,eAAA,GAAY,KAAK;MAzEvC,QAAA,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAK;;MACvB,YAAA,IAAI,CAAC,iBAAiB,GAAG,IAAI;kBAC7B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,4BAA4B,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAAC;MAC1G,YAAA,CAAA,EAAA,GAA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OAAO,EAAE,MAAM,IAAI,CAAC,UAAU,EAAE,EAClE,GAAG,EAAE,EAAE,IAAI,IAAI,CAAC,MAAM,GAAG,EAAE,EAAA,EAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAK,CACzE,EACN,CAAA,CAAA,MAAA,EAAA,EAAM,IAAI,EAAC,cAAc,EAAG,CAAA,CACxB;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"p-DoomSogT.system.js","sources":["src/components/salla-notifications/salla-notifications.scss?tag=salla-notifications","src/components/salla-notifications/salla-notifications.tsx"],"sourcesContent":["","import { Component, h, State, Prop, Element } from '@stencil/core';\nimport { Notification } from \"./interfaces\"\nimport {Pagination} from \"../../interfaces\"\nimport Helper from '../../Helpers/Helper';\n\n@Component({\n tag: 'salla-notifications',\n styleUrl: 'salla-notifications.scss',\n})\nexport class SallaNotifications {\n\n constructor() {\n salla.lang.onLoaded(() => {\n this.no_notifications_trans = salla.lang.get('blocks.header.no_notifications');\n this.load_more_text_trans = salla.lang.get('common.elements.load_more')\n })\n }\n\n /**\n * Load more text\n */\n @Prop() loadMoreText: string;\n\n /**\n * Number of notifications to load per request.\n */\n @Prop() itemPerPage: number = 10;\n\n @State() pagination: Pagination;\n @State() total: number;\n @State() showPlaceholder: boolean;\n @State() nextPage: string;\n\n @State() no_notifications_trans = salla.lang.get('blocks.header.no_notifications')\n @State() load_more_text_trans = salla.lang.get('common.elements.load_more');\n\n private status: any;\n private btnLoader: any;\n private infiniteScroll: any;\n private wrapper: any;\n\n @Element() host: HTMLElement;\n\n // Show/hide loading\n private loading(isLoading = true) {\n let btnText = this.status?.querySelector('.s-button-text');\n if (btnText) {\n Helper.toggleElementClassIf(btnText, 's-button-hide', 's-button-show', () => isLoading);\n this.btnLoader.style.display = isLoading ? 'inherit' : 'none';\n }\n }\n\n private getNotificationCard(notification: Notification) {\n const notificationItem = document.createElement('salla-notification-item') as HTMLSallaNotificationItemElement;\n notificationItem.notification = notification;\n notificationItem.classList.add('s-block');\n return notificationItem;\n }\n\n\n render() {\n if (this.showPlaceholder) {\n return <div class=\"s-notifications-no-content\">\n <salla-placeholder alignment='center'>\n <span slot='title'>\n {this.no_notifications_trans}\n </span>\n </salla-placeholder>\n </div>\n }\n\n return <div class=\"s-notifications-wrapper\">\n <div class=\"s-notifications-container\" ref={wrapper => this.wrapper = wrapper}></div>\n\n {this.nextPage && (\n <div class=\"s-infinite-scroll-wrapper\" ref={status => this.status = status}>\n <button onClick={() => this.loadMore()} class=\"s-infinite-scroll-btn s-button-btn s-button-primary\">\n <span class=\"s-button-text s-infinite-scroll-btn-text\">{this.loadMoreText ?? this.load_more_text_trans}</span>\n <span class=\"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader\" ref={btnLoader => this.btnLoader = btnLoader} style={{ \"display\": \"none\" }}></span>\n </button>\n </div>\n )}\n </div>\n }\n\n\n private handleResponse(notificationsList: Notification[]) {\n return notificationsList.map(notification => this.getNotificationCard(notification))\n }\n\n private initiateInfiniteScroll() {\n if (!this.wrapper) {\n salla.logger.error('Wrapper is undefined. Cannot initiate infinite scroll.');\n return;\n }\n\n this.infiniteScroll = salla.infiniteScroll.initiate(this.wrapper, this.wrapper, {\n path: () => this.nextPage,\n history: true,\n nextPage: this.nextPage,\n scrollThreshold: false,\n }, true);\n\n this.infiniteScroll?.on('request', _response => {\n this.loading();\n });\n\n this.infiniteScroll?.on('load', response => {\n this.loading(false);\n this.pagination = response.pagination;\n this.nextPage = response.pagination.links?.next || null;\n this.handleResponse(response.data).forEach(data => this.wrapper.append(data))\n let items = this.host.querySelectorAll('salla-notification-item:not(.animated)');\n Helper.animateItems(items);\n });\n\n this.infiniteScroll?.on('error', (e) => {\n salla.logger.error('Error loading more comments:', e);\n });\n }\n\n private async loadInitialData() {\n await salla.api.notifications.fetch({\"per_page\": this.itemPerPage})\n .then(resp => {\n this.pagination = resp.pagination;\n this.total = resp.pagination.total;\n this.nextPage = resp.pagination.links?.next || null;\n\n // if (!this.notifications.length) {\n // this.showPlaceholder = true;\n // return this.loading(false);\n // }\n\n setTimeout(() => {\n if (!resp.data.length) {\n return this.showPlaceholder = true;\n }\n this.handleResponse(resp.data).forEach(data => this.wrapper.append(data))\n this.initiateInfiniteScroll();\n let items = this.wrapper.querySelectorAll('salla-notification-item:not(.animated)');\n Helper.animateItems(items);\n }, 100)\n })\n .catch(error => {\n salla.logger.error(error)\n this.showPlaceholder = true;\n this.loading(false)\n })\n }\n\n // Get next page\n async loadMore() {\n this.infiniteScroll?.loadNextPage();\n }\n\n async componentWillLoad() {\n await this.loadInitialData();\n }\n\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;YAAA,MAAM,qBAAqB,GAAG,EAAE;;kBCSnB,kBAAkB,kCAAA,MAAA;YAE7B,IAAA,WAAA,CAAA,OAAA,EAAA;;YAYA;;YAEG;YACK,QAAA,IAAW,CAAA,WAAA,GAAW,EAAE;oBAOvB,IAAsB,CAAA,sBAAA,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,gCAAgC,CAAC;oBACzE,IAAoB,CAAA,oBAAA,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,2BAA2B,CAAC;YAtBzE,QAAA,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAK;wBACvB,IAAI,CAAC,sBAAsB,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,gCAAgC,CAAC;wBAC9E,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,2BAA2B,CAAC;YACzE,SAAC,CAAC;YACH;;gBA4BO,OAAO,CAAC,SAAS,GAAG,IAAI,EAAA;;YAC9B,QAAA,IAAI,OAAO,GAAG,CAAA,EAAA,GAAA,IAAI,CAAC,MAAM,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAE,aAAa,CAAC,gBAAgB,CAAC;oBAC1D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UAAU,CAAC,KAAK,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAE,IAAI,KAAI,IAAI;;;;;wBAOnD,UAAU,CAAC,MAAK;YACd,gBAAA,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YACrB,oBAAA,OAAO,IAAI,CAAC,eAAe,GAAG,IAAI;;4BAEpC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;4BACzE,IAAI,CAAC,sBAAsB,EAAE;4BAC7B,IAAI,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,wCAAwC,CAAC;YACnF,gBAAA,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC;yBAC3B,EAAE,GAAG,CAAC;YACT,SAAC;yBACA,KAAK,CAAC,KAAK,IAAG;YACb,YAAA,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;YACzB,YAAA,IAAI,CAAC,eAAe,GAAG,IAAI;YAC3B,YAAA,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;YACrB,SAAC,CAAC;;;YAIN,IAAA,MAAM,QAAQ,GAAA;;oBACZ,CAAA,EAAA,GAAA,IAAI,CAAC,cAAc,MAAE,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAA,YAAY,EAAE;;YAGrC,IAAA,MAAM,iBAAiB,GAAA;YACrB,QAAA,MAAM,IAAI,CAAC,eAAe,EAAE;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"p-8cuU9AcW.system.js","sources":["src/components/salla-notifications/salla-notifications.scss?tag=salla-notifications","src/components/salla-notifications/salla-notifications.tsx"],"sourcesContent":["","import { Component, h, State, Prop, Element } from '@stencil/core';\nimport { Notification } from \"./interfaces\"\nimport {Pagination} from \"../../interfaces\"\nimport Helper from '../../Helpers/Helper';\n\n@Component({\n tag: 'salla-notifications',\n styleUrl: 'salla-notifications.scss',\n})\nexport class SallaNotifications {\n\n constructor() {\n salla.lang.onLoaded(() => {\n this.no_notifications_trans = salla.lang.get('blocks.header.no_notifications');\n this.load_more_text_trans = salla.lang.get('common.elements.load_more')\n })\n }\n\n /**\n * Load more text\n */\n @Prop() loadMoreText: string;\n\n /**\n * Number of notifications to load per request.\n */\n @Prop() itemPerPage: number = 10;\n\n @State() pagination: Pagination;\n @State() total: number;\n @State() showPlaceholder: boolean;\n @State() nextPage: string;\n\n @State() no_notifications_trans = salla.lang.get('blocks.header.no_notifications')\n @State() load_more_text_trans = salla.lang.get('common.elements.load_more');\n\n private status: any;\n private btnLoader: any;\n private infiniteScroll: any;\n private wrapper: any;\n\n @Element() host: HTMLElement;\n\n // Show/hide loading\n private loading(isLoading = true) {\n let btnText = this.status?.querySelector('.s-button-text');\n if (btnText) {\n Helper.toggleElementClassIf(btnText, 's-button-hide', 's-button-show', () => isLoading);\n this.btnLoader.style.display = isLoading ? 'inherit' : 'none';\n }\n }\n\n private getNotificationCard(notification: Notification) {\n const notificationItem = document.createElement('salla-notification-item') as HTMLSallaNotificationItemElement;\n notificationItem.notification = notification;\n notificationItem.classList.add('s-block');\n return notificationItem;\n }\n\n\n render() {\n if (this.showPlaceholder) {\n return <div class=\"s-notifications-no-content\">\n <salla-placeholder alignment='center'>\n <span slot='title'>\n {this.no_notifications_trans}\n </span>\n </salla-placeholder>\n </div>\n }\n\n return <div class=\"s-notifications-wrapper\">\n <div class=\"s-notifications-container\" ref={wrapper => this.wrapper = wrapper}></div>\n\n {this.nextPage && (\n <div class=\"s-infinite-scroll-wrapper\" ref={status => this.status = status}>\n <button onClick={() => this.loadMore()} class=\"s-infinite-scroll-btn s-button-btn s-button-primary\">\n <span class=\"s-button-text s-infinite-scroll-btn-text\">{this.loadMoreText ?? this.load_more_text_trans}</span>\n <span class=\"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader\" ref={btnLoader => this.btnLoader = btnLoader} style={{ \"display\": \"none\" }}></span>\n </button>\n </div>\n )}\n </div>\n }\n\n\n private handleResponse(notificationsList: Notification[]) {\n return notificationsList.map(notification => this.getNotificationCard(notification))\n }\n\n private initiateInfiniteScroll() {\n if (!this.wrapper) {\n salla.logger.error('Wrapper is undefined. Cannot initiate infinite scroll.');\n return;\n }\n\n this.infiniteScroll = salla.infiniteScroll.initiate(this.wrapper, this.wrapper, {\n path: () => this.nextPage,\n history: true,\n nextPage: this.nextPage,\n scrollThreshold: false,\n }, true);\n\n this.infiniteScroll?.on('request', _response => {\n this.loading();\n });\n\n this.infiniteScroll?.on('load', response => {\n this.loading(false);\n this.pagination = response.pagination;\n this.nextPage = response.pagination.links?.next || null;\n this.handleResponse(response.data).forEach(data => this.wrapper.append(data))\n let items = this.host.querySelectorAll('salla-notification-item:not(.animated)');\n Helper.animateItems(items);\n });\n\n this.infiniteScroll?.on('error', (e) => {\n salla.logger.error('Error loading more comments:', e);\n });\n }\n\n private async loadInitialData() {\n await salla.api.notifications.fetch({\"per_page\": this.itemPerPage})\n .then(resp => {\n this.pagination = resp.pagination;\n this.total = resp.pagination.total;\n this.nextPage = resp.pagination.links?.next || null;\n\n // if (!this.notifications.length) {\n // this.showPlaceholder = true;\n // return this.loading(false);\n // }\n\n setTimeout(() => {\n if (!resp.data.length) {\n return this.showPlaceholder = true;\n }\n this.handleResponse(resp.data).forEach(data => this.wrapper.append(data))\n this.initiateInfiniteScroll();\n let items = this.wrapper.querySelectorAll('salla-notification-item:not(.animated)');\n Helper.animateItems(items);\n }, 100)\n })\n .catch(error => {\n salla.logger.error(error)\n this.showPlaceholder = true;\n this.loading(false)\n })\n }\n\n // Get next page\n async loadMore() {\n this.infiniteScroll?.loadNextPage();\n }\n\n async componentWillLoad() {\n await this.loadInitialData();\n }\n\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;YAAA,MAAM,qBAAqB,GAAG,EAAE;;kBCSnB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,wCAAwC,CAAC;YACnF,gBAAA,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC;yBAC3B,EAAE,GAAG,CAAC;YACT,SAAC;yBACA,KAAK,CAAC,KAAK,IAAG;YACb,YAAA,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;YACzB,YAAA,IAAI,CAAC,eAAe,GAAG,IAAI;YAC3B,YAAA,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;YACrB,SAAC,CAAC;;;YAIN,IAAA,MAAM,QAAQ,GAAA;;oBACZ,CAAA,EAAA,GAAA,IAAI,CAAC,cAAc,MAAE,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAA,YAAY,EAAE;;YAGrC,IAAA,MAAM,iBAAiB,GAAA;YACrB,QAAA,MAAM,IAAI,CAAC,eAAe,EAAE;;;;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
System.register(["./p-
|
|
5
|
-
//# sourceMappingURL=p-
|
|
4
|
+
System.register(["./p-CQDiSGcm.system.js","./p-CmE8W9Xg.system.js","./p-Be8TJdpm.system.js"],(function(t){"use strict";var n,s,e,c,i,a;return{setters:[function(t){n=t.r;s=t.h;e=t.H;c=t.g},function(t){i=t.w},function(t){a=t.M}],execute:function(){var o='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>iphone</title>\n<path d="M15.053 27.613c0.133 0.12 0.28 0.213 0.44 0.28s0.333 0.107 0.507 0.107c0.36 0 0.693-0.135 0.947-0.387 0.12-0.135 0.213-0.28 0.28-0.44 0.080-0.16 0.107-0.333 0.107-0.507 0-0.347-0.147-0.695-0.387-0.947-0.507-0.493-1.387-0.493-1.893 0-0.12 0.12-0.213 0.267-0.28 0.44-0.067 0.16-0.107 0.333-0.107 0.507s0.040 0.347 0.107 0.507 0.16 0.305 0.28 0.44zM24 0h-16c-2.205 0-4 1.795-4 4v24c0 2.205 1.795 4 4 4h16c2.205 0 4-1.795 4-4v-24c0-2.205-1.795-4-4-4zM25.333 28c0 0.736-0.599 1.333-1.333 1.333h-16c-0.735 0-1.333-0.597-1.333-1.333v-4h18.667zM25.333 21.333h-18.667v-17.333c0-0.735 0.599-1.333 1.333-1.333h16c0.735 0 1.333 0.599 1.333 1.333z"></path>\n</svg>\n';var l='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>phone</title>\n<path d="M30.823 21.713l-3.883-3.883c-1.569-1.568-4.12-1.568-5.689 0l-2.568 2.568c-3.063-1.499-5.583-4.019-7.081-7.083l2.568-2.567c0.759-0.76 1.177-1.771 1.177-2.845s-0.419-2.084-1.179-2.844l-3.881-3.881c-1.52-1.521-4.171-1.521-5.689 0l-1.845 1.847c-2.22 2.219-3.183 5.407-2.573 8.527 1.98 10.144 10.125 18.292 20.269 20.271 0.616 0.121 1.236 0.18 1.849 0.18 2.492 0 4.896-0.972 6.677-2.752l1.847-1.847c1.568-1.571 1.568-4.121 0.001-5.691zM28.936 25.517l-1.845 1.847c-1.592 1.592-3.883 2.283-6.132 1.841-9.089-1.776-16.388-9.075-18.163-18.165-0.439-2.247 0.249-4.539 1.841-6.129l1.847-1.847c0.256-0.257 0.596-0.397 0.959-0.397s0.703 0.14 0.959 0.397l3.883 3.883c0.256 0.256 0.397 0.596 0.397 0.959s-0.141 0.703-0.397 0.96l-3.22 3.217c-0.383 0.384-0.496 0.959-0.287 1.457 1.813 4.339 5.343 7.868 9.683 9.684 0.497 0.207 1.073 0.095 1.457-0.288l3.22-3.22c0.529-0.529 1.389-0.528 1.917 0l3.881 3.883c0.528 0.529 0.528 1.389 0 1.919z"></path>\n</svg>\n';var r='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>paper-plane-o</title>\n<path d="M31.5 0.482c0.375 0.268 0.554 0.696 0.482 1.143l-4.571 27.429c-0.054 0.339-0.268 0.625-0.571 0.804-0.161 0.089-0.357 0.143-0.554 0.143-0.143 0-0.286-0.036-0.429-0.089l-9.411-3.839-5.321 5.839c-0.214 0.25-0.518 0.375-0.839 0.375-0.143 0-0.286-0.018-0.411-0.071-0.446-0.179-0.732-0.607-0.732-1.071v-8.071l-8.429-3.446c-0.411-0.161-0.679-0.536-0.714-0.982-0.036-0.429 0.196-0.839 0.571-1.054l29.714-17.143c0.375-0.232 0.857-0.214 1.214 0.036zM25.393 27.25l3.946-23.625-25.607 14.768 6 2.446 15.411-11.411-8.536 14.232z"></path>\n</svg>\n';var h=".unicode{unicode-bidi:-webkit-plaintext;unicode-bidi:plaintext}";var u=t("salla_contacts",function(){function t(t){var s=this;n(this,t);var e;this.contacts=salla.config.get("store.contacts");this.iconsList={mobile:o,whatsapp:i,phone:l,telegram:r,email:a};this.contactSlot=((e=this.host.querySelector('[slot="contact"]'))===null||e===void 0?void 0:e.innerHTML)||'<a href={link} class="s-contacts-item"><span class="s-contacts-icon">{icon}</span>'.concat(!this.iconsOnly&&"<span class='unicode'>{value}</span>","</a>");salla.onReady((function(){s.contacts=salla.config.get("store.contacts")}));salla.lang.onLoaded((function(){s.contactsTitle=s.contactsTitle||salla.lang.get("blocks.footer.social")}))}t.prototype.getContactsArray=function(){return Object.entries(this.contacts).filter((function(t){var n=t[0],s=t[1];return s!==""})).map((function(t){var n=t[0],s=t[1];return{type:n,value:s}}))};t.prototype.getContactLink=function(t){var n=this.contacts[t];switch(t){case"phone":case"mobile":return"tel:".concat(n);case"whatsapp":return salla.url.get("whatsapp/send");case"email":return"mailto:".concat(n);case"telegram":return n.startsWith("https://t.me/")?n:"https://t.me/".concat(n);default:return n}};t.prototype.getContactIcon=function(t){return this.iconsList[t]};t.prototype.componentWillLoad=function(){return new Promise((function(t){return salla.onReady(t)}))};t.prototype.render=function(){var t=this;var n=this.getContactsArray();if(!n||n.length==0){return}if(this.isHeader){return s(e,{class:"s-contacts s-contacts-header"},n.filter((function(t){return t.type=="phone"||t.type=="email"})).map((function(n,e){return s("a",{href:t.getContactLink(n.type),key:e,class:"s-contacts-topnav-link"},n.type==="email"?n.value:[s("span",null,t.contactsTitle,": "),s("a",{class:"unicode",href:t.iconsList[n.type]},n.value)])})))}return s(e,{class:"s-contacts"},!this.hideTitle&&s("h3",{class:"s-contacts-title"},this.contactsTitle),s("div",{class:{"s-contacts-list":true,"s-contacts-list-horizontal":this.horizontal,"s-contacts-list-vertical":!this.horizontal,"s-contacts-list-icons-only":this.iconsOnly}},n.map((function(n,e){return s("div",{key:e,id:"contact-slot",innerHTML:t.contactSlot.replace(/\{icon\}/g,t.getContactIcon(n.type)).replace(/\{value\}/g,n.value.toString()).replace(/\{link\}/g,t.getContactLink(n.type))})}))))};t.prototype.componentDidRender=function(){var t;(t=this.host.querySelector('[slot="contact"]'))===null||t===void 0?void 0:t.remove()};Object.defineProperty(t.prototype,"host",{get:function(){return c(this)},enumerable:false,configurable:true});return t}());u.style=h}}}));
|
|
5
|
+
//# sourceMappingURL=p-8e807035.system.entry.js.map
|