@salla.sa/twilight-components 2.14.271 → 2.14.273
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/{filepond-DZKo1pV9.js → filepond-B6LUaQ9F.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-Ddu0-eEg.js → filepond-plugin-file-poster-DlB67Vv3.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-B2VId_n-.js → filepond-plugin-file-validate-size-D7kuqaEC.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-lGUMFCde.js → filepond-plugin-file-validate-type-CliXp1Qt.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-BlEvC0bv.js → filepond-plugin-image-edit-BRIZbIyN.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-C9yPmasn.js → filepond-plugin-image-exif-orientation-bFbWHyQs.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-BPQ9o2YT.js → filepond-plugin-image-preview-24nxaVX6.js} +1 -1
- package/dist/cjs/{index-DpqjX7F3.js → index-BpUrZ_-D.js} +136 -26
- package/dist/cjs/{index-4c5cqxT-.js → index-xI-pRoDr.js} +1 -1
- package/dist/cjs/loader.cjs.js +3 -4
- package/dist/cjs/{salla-add-product-button_51.cjs.entry.js → salla-accordion_62.cjs.entry.js} +2104 -121
- 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-cart-item-offers.cjs.entry.js +1 -1
- package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters.cjs.entry.js +1 -1
- package/dist/cjs/salla-installment.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-program.cjs.entry.js +1 -1
- package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
- package/dist/cjs/salla-notification-item.cjs.entry.js +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 +1 -1
- package/dist/cjs/{salla-accordion_4.cjs.entry.js → salla-order-details-options.cjs.entry.js} +1 -100
- package/dist/cjs/salla-order-details.cjs.entry.js +2 -2
- 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-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 -4
- package/dist/collection/collection-manifest.json +5 -0
- package/dist/collection/components/salla-accordion/salla-accordion-head.js +8 -2
- package/dist/collection/components/salla-comments/salla-comments.js +20 -1
- package/dist/collection/components/salla-conditional-fields/salla-conditional-fields.js +33 -5
- package/dist/collection/components/salla-login-modal/salla-login-modal.js +0 -1
- package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-cart.css +0 -0
- package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-cart.js +89 -0
- package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-details.css +0 -0
- package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-details.js +195 -0
- package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-options-modal.css +3 -0
- package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-options-modal.js +595 -0
- package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-slider.css +0 -0
- package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-slider.js +174 -0
- package/dist/collection/components/salla-multiple-bundle-product/interfaces.js +1 -0
- package/dist/collection/components/salla-multiple-bundle-product/salla-multiple-bundle-product.css +3 -0
- package/dist/collection/components/salla-multiple-bundle-product/salla-multiple-bundle-product.js +132 -0
- 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/salla-order-details.js +1 -1
- 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-options/salla-product-options.js +105 -22
- 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/salla-accordion-head2.js +2 -2
- package/dist/components/salla-comments.js +20 -1
- package/dist/components/salla-conditional-fields2.js +28 -6
- package/dist/components/salla-login-modal.js +0 -1
- package/dist/components/salla-multiple-bundle-product-cart.d.ts +11 -0
- package/dist/components/salla-multiple-bundle-product-cart.js +9 -0
- package/dist/components/salla-multiple-bundle-product-cart2.js +153 -0
- package/dist/components/salla-multiple-bundle-product-details.d.ts +11 -0
- package/dist/components/salla-multiple-bundle-product-details.js +9 -0
- package/dist/components/salla-multiple-bundle-product-details2.js +283 -0
- package/dist/components/salla-multiple-bundle-product-options-modal.d.ts +11 -0
- package/dist/components/salla-multiple-bundle-product-options-modal.js +9 -0
- package/dist/components/salla-multiple-bundle-product-options-modal2.js +585 -0
- package/dist/components/salla-multiple-bundle-product-slider.d.ts +11 -0
- package/dist/components/salla-multiple-bundle-product-slider.js +9 -0
- package/dist/components/salla-multiple-bundle-product-slider2.js +81 -0
- package/dist/components/salla-multiple-bundle-product.d.ts +11 -0
- package/dist/components/salla-multiple-bundle-product.js +210 -0
- package/dist/components/salla-notification-item2.js +1 -1
- package/dist/components/salla-offer-modal.js +1 -1
- package/dist/components/salla-order-details.js +1 -1
- 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-options.js +1 -810
- package/dist/{esm/salla-product-options.entry.js → components/salla-product-options2.js} +197 -30
- 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/{filepond-DbqR2fSR.js → filepond-C8M-qAIs.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-oSU_je8q.js → filepond-plugin-file-poster-UfHq-uvl.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-DBNbjpCq.js → filepond-plugin-file-validate-size-DZ15xnJZ.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-FNihY0D1.js → filepond-plugin-file-validate-type-CWR9opI0.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-BvLwmvqS.js → filepond-plugin-image-edit-XbR1h-bg.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-CzDuHCvL.js → filepond-plugin-image-exif-orientation-cSRDvvXQ.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-OJew5tLP.js → filepond-plugin-image-preview-B-SvzNFg.js} +1 -1
- package/dist/esm/{index-DFnMPSip.js → index-Q_DltBmK.js} +1 -1
- package/dist/esm/{index-DXrQDmAN.js → index-gLeBNvS1.js} +136 -26
- package/dist/esm/loader.js +3 -4
- package/dist/esm/{salla-add-product-button_51.entry.js → salla-accordion_62.entry.js} +2084 -112
- 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-cart-item-offers.entry.js +1 -1
- package/dist/esm/salla-conditional-offer.entry.js +1 -1
- package/dist/esm/salla-contacts.entry.js +1 -1
- package/dist/esm/salla-filters-widget.entry.js +1 -1
- package/dist/esm/salla-filters.entry.js +1 -1
- package/dist/esm/salla-installment.entry.js +1 -1
- package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
- package/dist/esm/salla-loyalty-program.entry.js +1 -1
- package/dist/esm/salla-metadata.entry.js +1 -1
- package/dist/esm/salla-notification-item.entry.js +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 +1 -1
- package/dist/esm/{salla-accordion_4.entry.js → salla-order-details-options.entry.js} +2 -98
- package/dist/esm/salla-order-details.entry.js +2 -2
- 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-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 +3 -4
- package/dist/twilight/{p-11c1fc02.entry.js → p-00d8544c.entry.js} +1 -1
- package/dist/twilight/{p-c87e16b6.entry.js → p-06d126b6.entry.js} +1 -1
- package/dist/twilight/{p-adc5a167.entry.js → p-1cc68ef5.entry.js} +1 -1
- package/dist/twilight/{p-yWcVqMiP.js → p-1ekWkYOJ.js} +1 -1
- package/dist/twilight/p-21b37923.entry.js +4 -0
- package/dist/twilight/{p-c2f0f504.entry.js → p-263b9b06.entry.js} +1 -1
- package/dist/twilight/{p-c0450f72.entry.js → p-2787ff9f.entry.js} +1 -1
- package/dist/twilight/p-3c1484b9.entry.js +11 -0
- package/dist/twilight/{p-6ed0de44.entry.js → p-5057b400.entry.js} +1 -1
- package/dist/twilight/{p-5c67f412.entry.js → p-5278b873.entry.js} +1 -1
- package/dist/twilight/{p-1d1672e8.entry.js → p-56f7a2ba.entry.js} +1 -1
- package/dist/twilight/{p-5aa17da1.entry.js → p-697db5c6.entry.js} +1 -1
- package/dist/twilight/{p-81131b67.entry.js → p-73a8296a.entry.js} +1 -1
- package/dist/twilight/{p-93b26c0b.entry.js → p-7603a820.entry.js} +1 -1
- package/dist/twilight/{p-86f00281.entry.js → p-7c8d7ca3.entry.js} +1 -1
- package/dist/twilight/{p-62312d5b.entry.js → p-80a07063.entry.js} +1 -1
- package/dist/twilight/{p-e987bf56.entry.js → p-82c156ab.entry.js} +1 -1
- package/dist/twilight/{p-fed06a9f.entry.js → p-8380c411.entry.js} +1 -1
- package/dist/twilight/{p-906ec5e3.entry.js → p-946e5649.entry.js} +1 -1
- package/dist/twilight/{p-01b67a23.entry.js → p-9bcd9c87.entry.js} +1 -1
- package/dist/twilight/p-9c477fdf.entry.js +4 -0
- package/dist/twilight/{p-B3DRwtQ_.js → p-B-nQtFTN.js} +1 -1
- package/dist/twilight/{p-BeXdXg7Q.js → p-BI2zk2yo.js} +1 -1
- package/dist/twilight/{p-E9O3bnHS.js → p-BRD27esZ.js} +1 -1
- package/dist/twilight/{p-MbgAyDn3.js → p-CUYEEJ4c.js} +1 -1
- package/dist/twilight/{p-BvKpNEUI.js → p-DUvdNUoC.js} +1 -1
- package/dist/twilight/{p-C3joUrVg.js → p-DhR67rwu.js} +1 -1
- package/dist/twilight/p-a01dd6b7.entry.js +4 -0
- package/dist/twilight/{p-849be825.entry.js → p-a3e000ef.entry.js} +1 -1
- package/dist/twilight/{p-0e18add0.entry.js → p-a6c14a64.entry.js} +1 -1
- package/dist/twilight/p-b0b79820.entry.js +4 -0
- package/dist/twilight/{p-57e8c6b5.entry.js → p-b5581886.entry.js} +1 -1
- package/dist/twilight/p-b81437f4.entry.js +4 -0
- package/dist/twilight/{p-591043a2.entry.js → p-bf010154.entry.js} +1 -1
- package/dist/twilight/{p-d3022e35.entry.js → p-c0388251.entry.js} +1 -1
- package/dist/twilight/{p-a71a3922.entry.js → p-c9ab361e.entry.js} +1 -1
- package/dist/twilight/{p-d8e500cc.entry.js → p-ed85bc00.entry.js} +1 -1
- package/dist/twilight/p-f7863a58.entry.js +4 -0
- package/dist/twilight/{p-DXrQDmAN.js → p-gLeBNvS1.js} +2 -2
- package/dist/twilight/{p-BQuXdlAk.js → p-j4lbZMJ0.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/components/salla-accordion/salla-accordion-head.d.ts +6 -0
- package/dist/types/components/salla-conditional-fields/salla-conditional-fields.d.ts +2 -0
- package/dist/types/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-cart.d.ts +10 -0
- package/dist/types/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-details.d.ts +20 -0
- package/dist/types/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-options-modal.d.ts +46 -0
- package/dist/types/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-slider.d.ts +22 -0
- package/dist/types/components/salla-multiple-bundle-product/interfaces.d.ts +101 -0
- package/dist/types/components/salla-multiple-bundle-product/salla-multiple-bundle-product.d.ts +42 -0
- package/dist/types/components/salla-product-options/salla-product-options.d.ts +21 -1
- package/dist/types/components.d.ts +298 -2
- package/package.json +5 -5
- package/dist/cjs/app-globals-DfTgypwp.js +0 -38
- package/dist/cjs/camera-DytepEoK.js +0 -13
- package/dist/cjs/minus-CCryh1qf.js +0 -21
- package/dist/cjs/salla-booking-field_2.cjs.entry.js +0 -280
- package/dist/cjs/salla-product-options.cjs.entry.js +0 -715
- package/dist/esm/app-globals-i4_OI7UA.js +0 -36
- package/dist/esm/camera-C6jIkM-X.js +0 -11
- package/dist/esm/minus-DfeagqF1.js +0 -18
- package/dist/esm/salla-booking-field_2.entry.js +0 -277
- package/dist/twilight/p-137e1751.entry.js +0 -4
- package/dist/twilight/p-18cd5d66.entry.js +0 -4
- package/dist/twilight/p-36b30807.entry.js +0 -4
- package/dist/twilight/p-6159654b.entry.js +0 -4
- package/dist/twilight/p-9d9e5493.entry.js +0 -4
- package/dist/twilight/p-C6jIkM-X.js +0 -4
- package/dist/twilight/p-CqZlwzcH.js +0 -4
- package/dist/twilight/p-DfeagqF1.js +0 -4
- package/dist/twilight/p-affed6bd.entry.js +0 -11
- package/dist/twilight/p-cfbd199f.entry.js +0 -4
- package/dist/twilight/p-d060275b.entry.js +0 -4
- package/dist/twilight/p-e162d003.entry.js +0 -4
|
@@ -1,715 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Crafted with ❤ by Salla
|
|
3
|
-
*/
|
|
4
|
-
'use strict';
|
|
5
|
-
|
|
6
|
-
var index = require('./index-DpqjX7F3.js');
|
|
7
|
-
var check = require('./check-CLRvuniI.js');
|
|
8
|
-
var camera = require('./camera-DytepEoK.js');
|
|
9
|
-
|
|
10
|
-
var DisplayType;
|
|
11
|
-
(function (DisplayType) {
|
|
12
|
-
DisplayType["COLOR"] = "color";
|
|
13
|
-
DisplayType["DATE"] = "date";
|
|
14
|
-
DisplayType["DATETIME"] = "datetime";
|
|
15
|
-
DisplayType["DONATION"] = "donation";
|
|
16
|
-
DisplayType["IMAGE"] = "image";
|
|
17
|
-
DisplayType["MULTIPLE_OPTIONS"] = "multiple-options";
|
|
18
|
-
DisplayType["NUMBER"] = "number";
|
|
19
|
-
DisplayType["SINGLE_OPTION"] = "single-option";
|
|
20
|
-
DisplayType["DIGITAL_CARD_VALUE"] = "digital-code-value";
|
|
21
|
-
DisplayType["COUNTRY"] = "country";
|
|
22
|
-
DisplayType["SPLITTER"] = "splitter";
|
|
23
|
-
DisplayType["TEXT"] = "text";
|
|
24
|
-
DisplayType["TEXTAREA"] = "textarea";
|
|
25
|
-
DisplayType["THUMBNAIL"] = "thumbnail";
|
|
26
|
-
DisplayType["TIME"] = "time";
|
|
27
|
-
DisplayType["RADIO"] = "radio";
|
|
28
|
-
DisplayType["CHECKBOX"] = "checkbox";
|
|
29
|
-
DisplayType["MAP"] = "map";
|
|
30
|
-
DisplayType["FILE"] = "file";
|
|
31
|
-
DisplayType["COLOR_PICKER"] = "color_picker";
|
|
32
|
-
DisplayType["BOOKING"] = "booking";
|
|
33
|
-
})(DisplayType || (DisplayType = {}));
|
|
34
|
-
var Currency;
|
|
35
|
-
(function (Currency) {
|
|
36
|
-
Currency["Sar"] = "SAR";
|
|
37
|
-
})(Currency || (Currency = {}));
|
|
38
|
-
|
|
39
|
-
var FileIcon = `<!-- Generated by IcoMoon.io -->
|
|
40
|
-
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
|
41
|
-
<title>file-upload</title>
|
|
42
|
-
<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>
|
|
43
|
-
</svg>
|
|
44
|
-
`;
|
|
45
|
-
|
|
46
|
-
const sallaProductOptionsCss = "";
|
|
47
|
-
|
|
48
|
-
const SallaProductOptions = class {
|
|
49
|
-
constructor(hostRef) {
|
|
50
|
-
index.registerInstance(this, hostRef);
|
|
51
|
-
this.changed = index.createEvent(this, "changed");
|
|
52
|
-
this.fileTypes = {
|
|
53
|
-
pdf: 'application/pdf',
|
|
54
|
-
png: 'image/png',
|
|
55
|
-
jpg: 'image/jpeg',
|
|
56
|
-
word: 'application/doc,application/ms-doc,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
57
|
-
exl: 'application/excel,application/vnd.ms-excel,application/x-excel,application/x-msexcel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
58
|
-
txt: 'text/plain',
|
|
59
|
-
};
|
|
60
|
-
this.outOfStockText = "";
|
|
61
|
-
this.donationAmount = salla.lang.get('pages.products.donation_amount');
|
|
62
|
-
this.selectDonationAmount = salla.lang.getWithDefault('pages.products.select_donation_amount', 'تحديد مبلغ التبرع');
|
|
63
|
-
this.selectAmount = salla.lang.getWithDefault('pages.products.select_amount', 'اختر المبلغ');
|
|
64
|
-
this.isCustomDonation = false;
|
|
65
|
-
this.selectedOptions = [];
|
|
66
|
-
this.disableCardValue = true;
|
|
67
|
-
this.availableDigitalCardValues = [];
|
|
68
|
-
this.userInitiatedValidation = false;
|
|
69
|
-
this.outSkus = [];
|
|
70
|
-
/**
|
|
71
|
-
* Avoid selection of previous default or selected card value option
|
|
72
|
-
* when switching between digital card country options for the 1st time
|
|
73
|
-
*/
|
|
74
|
-
this.ignoreDefaultCardValue = false;
|
|
75
|
-
/**
|
|
76
|
-
* The id of the product to which the options are going to be fetched for.
|
|
77
|
-
*/
|
|
78
|
-
this.productId = salla.config.get('page.id');
|
|
79
|
-
this.handleDonationOptions = (event, detail, type) => {
|
|
80
|
-
if (detail === 'custom' && type === 'input') {
|
|
81
|
-
salla.helpers.inputDigitsOnly(event.target);
|
|
82
|
-
salla.event.emit('product-options::donation-changed', {
|
|
83
|
-
id: this.productId,
|
|
84
|
-
price: event.target.value
|
|
85
|
-
});
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
event.preventDefault();
|
|
89
|
-
event.stopPropagation();
|
|
90
|
-
this.isCustomDonation = event.target.value === 'custom';
|
|
91
|
-
if (this.donationInput) {
|
|
92
|
-
if (event.target.value === 'custom') {
|
|
93
|
-
this.donationInput.value = '';
|
|
94
|
-
this.donationInput.focus();
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
this.donationInput.value = event.target.value;
|
|
98
|
-
}
|
|
99
|
-
if (detail === 'custom') {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
salla.event.emit('product-options::donation-changed', {
|
|
103
|
-
id: this.productId,
|
|
104
|
-
price: event.target.value
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
this.hideLabel = (option) => {
|
|
109
|
-
if (option.type === DisplayType.DONATION && (option.donation && !option.donation.can_donate)) {
|
|
110
|
-
return true;
|
|
111
|
-
}
|
|
112
|
-
return false;
|
|
113
|
-
};
|
|
114
|
-
this.getExpireDonationMessage = (option) => {
|
|
115
|
-
if (!option.donation) {
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
const completed = option.donation.target_amount <= option.donation.collected_amount;
|
|
119
|
-
return index.h("div", { class: { "s-product-options-donation-message": true, "s-product-options-donation-completed": completed, "s-product-options-donation-expired": !completed } }, index.h("p", null, option.donation.target_message), index.h("span", { innerHTML: completed ? salla.money(option.donation.target_amount) : '' }));
|
|
120
|
-
};
|
|
121
|
-
this.canDisabled = !salla.config.get('store.settings.product.notify_options_availability') || salla.url.is_page('cart');
|
|
122
|
-
salla.lang.onLoaded(() => {
|
|
123
|
-
this.outOfStockText = salla.lang.get("pages.products.out_of_stock");
|
|
124
|
-
this.donationAmount = salla.lang.get('pages.products.donation_amount');
|
|
125
|
-
this.selectDonationAmount = salla.lang.getWithDefault('pages.products.select_donation_amount', 'تحديد مبلغ التبرع');
|
|
126
|
-
this.selectAmount = salla.lang.getWithDefault('pages.products.select_amount', 'اختر المبلغ');
|
|
127
|
-
});
|
|
128
|
-
if (this.options) {
|
|
129
|
-
try {
|
|
130
|
-
this.setOptionsData(Array.isArray(this.options) ? this.options : JSON.parse(this.options));
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
catch (e) {
|
|
134
|
-
salla.log('Bad json passed via options prop');
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
if (!Array.isArray(this.optionsData)) {
|
|
138
|
-
salla.log('Options is not an array[] ---> ', this.optionsData);
|
|
139
|
-
this.setOptionsData([]);
|
|
140
|
-
}
|
|
141
|
-
if (this.productId && !salla.url.is_page('cart')) {
|
|
142
|
-
salla.api.product.getDetails(this.productId, ['options']).then(resp => this.setOptionsData(resp.data.options));
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Sets the options data for the product
|
|
147
|
-
* @param optionsData - Array of product options
|
|
148
|
-
*/
|
|
149
|
-
async setOptionsData(optionsData) {
|
|
150
|
-
this.optionsData = optionsData;
|
|
151
|
-
const that = this;
|
|
152
|
-
this.optionsData[0]?.details?.forEach(function (detail) {
|
|
153
|
-
Object.entries(detail.skus_availability || {})
|
|
154
|
-
.filter(sku => !sku[1])
|
|
155
|
-
.map(sku => that.outSkus.push(Number(sku[0])));
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Get the id's of the selected options.
|
|
160
|
-
* */
|
|
161
|
-
async getSelectedOptionsData() {
|
|
162
|
-
const selectedOptions = {};
|
|
163
|
-
const formData = this.host.getElementSallaData();
|
|
164
|
-
formData.forEach((value, key) => {
|
|
165
|
-
if (key.startsWith('options[')) {
|
|
166
|
-
(selectedOptions[key.replace('options[', '').replace(']', '')] = value);
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
return selectedOptions;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Report options form validity.
|
|
173
|
-
* */
|
|
174
|
-
async reportValidity() {
|
|
175
|
-
const requiredElements = this.host.querySelectorAll('[required]');
|
|
176
|
-
let pass = true;
|
|
177
|
-
for (let i = 0; i < requiredElements.length; i++) {
|
|
178
|
-
//if there is only one invalid option, return false
|
|
179
|
-
if ('reportValidity' in requiredElements[i] && !requiredElements[i].reportValidity()) {
|
|
180
|
-
pass = false;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
return pass;
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* Return true if there is any out of stock options are selected and vise versa.
|
|
187
|
-
* */
|
|
188
|
-
async hasOutOfStockOption() {
|
|
189
|
-
return this.selectedOptions.some(option => option.is_out) || (this.selectedSkus?.length && this.selectedSkus?.every(sku => this.outSkus.includes(sku)));
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Get selected options.
|
|
193
|
-
* */
|
|
194
|
-
async getSelectedOptions() {
|
|
195
|
-
return this.selectedOptions;
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Get a specific option by its id.
|
|
199
|
-
* */
|
|
200
|
-
async getOption(option_id) {
|
|
201
|
-
return this.optionsData.find(option => option.id === option_id);
|
|
202
|
-
}
|
|
203
|
-
// @ts-ignore
|
|
204
|
-
invalidHandler(event, option) {
|
|
205
|
-
const closestProductOption = event.target.closest('.s-product-options-option');
|
|
206
|
-
if (!closestProductOption.classList.contains('s-product-options-option-error')) {
|
|
207
|
-
closestProductOption.classList.add('s-product-options-option-error');
|
|
208
|
-
}
|
|
209
|
-
if (this.userInitiatedValidation && !salla.url.is_page('cart')) {
|
|
210
|
-
const firstInvalidElement = this.host.querySelector('.s-product-options-option-error');
|
|
211
|
-
if (firstInvalidElement === closestProductOption) {
|
|
212
|
-
this.scrollToElement(closestProductOption);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
scrollToElement(element) {
|
|
217
|
-
if (element) {
|
|
218
|
-
element.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
changedHandler(event, option, fireChangeEvent = true) {
|
|
222
|
-
const data = {
|
|
223
|
-
event: event,
|
|
224
|
-
option: option,
|
|
225
|
-
detail: null,
|
|
226
|
-
productId: this.productId
|
|
227
|
-
};
|
|
228
|
-
if (option.details) {
|
|
229
|
-
const detail = option.details.find((detail) => {
|
|
230
|
-
return Number(detail.id) === Number(event.target.value);
|
|
231
|
-
});
|
|
232
|
-
data.detail = detail;
|
|
233
|
-
}
|
|
234
|
-
if (option.type === 'country') {
|
|
235
|
-
this.handleCountryOptionChange(event, data.detail);
|
|
236
|
-
}
|
|
237
|
-
const optionElement = event.target.closest('.s-product-options-option');
|
|
238
|
-
if (event.target.value ||
|
|
239
|
-
((option.type === DisplayType.FILE || option.type === DisplayType.IMAGE) && event.type === 'added') ||
|
|
240
|
-
(option.type === DisplayType.MAP && event.type === 'selected' && (event.target.lat && event.target.lng))) {
|
|
241
|
-
setTimeout(() => {
|
|
242
|
-
optionElement.classList.remove('s-product-options-option-error');
|
|
243
|
-
}, 200);
|
|
244
|
-
}
|
|
245
|
-
if (option.type === DisplayType.DONATION) {
|
|
246
|
-
salla.event.emit('product-options::donation-changed', {
|
|
247
|
-
id: this.productId,
|
|
248
|
-
price: event.target.value
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
this.setSelectedSkus();
|
|
252
|
-
this.handleRequiredMultipleOptions(option);
|
|
253
|
-
const index = this.selectedOptions.findIndex(opt => opt.option_id === data.option.id);
|
|
254
|
-
if (data.option.type === DisplayType.MULTIPLE_OPTIONS) {
|
|
255
|
-
// Handle multiple selections
|
|
256
|
-
const detailIndex = this.selectedOptions.findIndex(opt => opt.option_id === data.option.id && opt?.id === data.detail?.id);
|
|
257
|
-
if (detailIndex > -1) {
|
|
258
|
-
// If the option is already selected, remove it (unselect)
|
|
259
|
-
this.selectedOptions.splice(detailIndex, 1);
|
|
260
|
-
}
|
|
261
|
-
else {
|
|
262
|
-
// If the option is not selected, add it to the selectedOptions array
|
|
263
|
-
this.selectedOptions.push({ ...data.detail, option_id: data.option.id });
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
else {
|
|
267
|
-
// Handle single selection
|
|
268
|
-
if (!data.detail || Object.keys(data.detail).length === 0) {
|
|
269
|
-
// If there is no value for the single-select, remove it from the selectedOptions array
|
|
270
|
-
if (index > -1) {
|
|
271
|
-
this.selectedOptions.splice(index, 1);
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
else {
|
|
275
|
-
// If a value exists, update or add the selection
|
|
276
|
-
if (index > -1) {
|
|
277
|
-
// Replace the existing selection with the new one
|
|
278
|
-
this.selectedOptions[index] = { ...data.detail, option_id: data.option.id };
|
|
279
|
-
}
|
|
280
|
-
else {
|
|
281
|
-
// If no selection exists for this input, add the new selection
|
|
282
|
-
this.selectedOptions.push({ ...data.detail, option_id: data.option.id });
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
// Update optionsData directly
|
|
287
|
-
this.optionsData = this.optionsData.map(opt => {
|
|
288
|
-
if (opt.id === data.option.id) {
|
|
289
|
-
return {
|
|
290
|
-
...opt,
|
|
291
|
-
details: opt.details.map(detail => ({
|
|
292
|
-
...detail,
|
|
293
|
-
is_selected: data.option.type === DisplayType.MULTIPLE_OPTIONS
|
|
294
|
-
? this.selectedOptions.some(selected => selected.id === detail.id)
|
|
295
|
-
: Number(detail.id) === Number(data.detail?.id),
|
|
296
|
-
value: data.detail?.value
|
|
297
|
-
}))
|
|
298
|
-
};
|
|
299
|
-
}
|
|
300
|
-
return opt;
|
|
301
|
-
});
|
|
302
|
-
// Emit the event only if fireChangeEvent is true
|
|
303
|
-
if (fireChangeEvent) {
|
|
304
|
-
this.changed.emit(data);
|
|
305
|
-
salla.event.emit('product-options::change', data);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
/**
|
|
309
|
-
* loop throw all selected details, then get common sku, if it's only one, means we selected all of them;
|
|
310
|
-
*/
|
|
311
|
-
setSelectedSkus() {
|
|
312
|
-
this.selectedSkus = this.selectedOptions.map(detail => Object.keys(detail.skus_availability || {}))
|
|
313
|
-
.reduce((p, c) => p.filter(e => c.includes(e)), []) // Initialize accumulator as an empty array
|
|
314
|
-
.map(sku => Number(sku));
|
|
315
|
-
}
|
|
316
|
-
handleRequiredMultipleOptions(option) {
|
|
317
|
-
if (option.type !== DisplayType.MULTIPLE_OPTIONS || !option.required) {
|
|
318
|
-
return;
|
|
319
|
-
}
|
|
320
|
-
const optionContainer = this.host.querySelector(`[data-option-id="${option.id}"]`);
|
|
321
|
-
const hasChecked = optionContainer.querySelectorAll('input:checked').length;
|
|
322
|
-
optionContainer.querySelectorAll('input').forEach(input => input.toggleAttribute('required', !hasChecked));
|
|
323
|
-
}
|
|
324
|
-
getLatLng(value, type) {
|
|
325
|
-
return value
|
|
326
|
-
? value.split(',')[type === 'lat' ? 0 : 1]
|
|
327
|
-
: '';
|
|
328
|
-
}
|
|
329
|
-
getDisplayForType(option) {
|
|
330
|
-
if (this[`${option.type}Option`]) {
|
|
331
|
-
return this[`${option.type}Option`](option);
|
|
332
|
-
}
|
|
333
|
-
if (option.type === DisplayType.COLOR_PICKER) {
|
|
334
|
-
return this.colorPickerOption(option);
|
|
335
|
-
}
|
|
336
|
-
if (option.type === DisplayType.MULTIPLE_OPTIONS) {
|
|
337
|
-
return this.multipleOptions(option);
|
|
338
|
-
}
|
|
339
|
-
if (option.type === DisplayType.SINGLE_OPTION) {
|
|
340
|
-
return this.singleOption(option);
|
|
341
|
-
}
|
|
342
|
-
if (option.type === DisplayType.DIGITAL_CARD_VALUE) {
|
|
343
|
-
return this.digitalCardValuesOption(option);
|
|
344
|
-
}
|
|
345
|
-
if (option.type === DisplayType.COUNTRY) {
|
|
346
|
-
return this.countryOption(option);
|
|
347
|
-
}
|
|
348
|
-
if (option.type === DisplayType.BOOKING && salla.url.is_page("cart")) {
|
|
349
|
-
return index.h("salla-booking-field", { onInvalidInput: (e) => this.invalidHandler(e, option), option: option, productId: option.value });
|
|
350
|
-
}
|
|
351
|
-
salla.log(`Couldn't find options type(${option.type})😢`);
|
|
352
|
-
return '';
|
|
353
|
-
}
|
|
354
|
-
getOptionShownWhen(option) {
|
|
355
|
-
return option.visibility_condition
|
|
356
|
-
? { "data-show-when": `options[${option.visibility_condition.option}] ${option.visibility_condition.operator} ${option.visibility_condition.value}` }
|
|
357
|
-
: {};
|
|
358
|
-
}
|
|
359
|
-
getAvailableDigitalCardSKUs(detail) {
|
|
360
|
-
const digitalCardOption = this.optionsData.find(({ type }) => type === 'digital-code-value');
|
|
361
|
-
if (!digitalCardOption)
|
|
362
|
-
throw new Error('product-options:: No digital card options found');
|
|
363
|
-
const outofStockSKUs = Object.keys(detail.skus_availability).filter(key => detail.skus_availability[key] === false);
|
|
364
|
-
this.availableDigitalCardValues = digitalCardOption.details.filter((op) => {
|
|
365
|
-
return !Object.keys(op.skus_availability).filter(SKU_key => outofStockSKUs.includes(SKU_key)).length;
|
|
366
|
-
});
|
|
367
|
-
}
|
|
368
|
-
handleCountryOptionChange(event, detail) {
|
|
369
|
-
event.stopImmediatePropagation();
|
|
370
|
-
this.ignoreDefaultCardValue = true;
|
|
371
|
-
const currentCardValue = this.host.querySelector("input[data-code-value]:checked");
|
|
372
|
-
if (currentCardValue)
|
|
373
|
-
currentCardValue.checked = false;
|
|
374
|
-
const digitalCardOption = this.optionsData.find(({ type }) => type === 'digital-code-value');
|
|
375
|
-
if (!digitalCardOption)
|
|
376
|
-
throw new Error('product-options:: No digital card options found');
|
|
377
|
-
this.getAvailableDigitalCardSKUs(detail);
|
|
378
|
-
}
|
|
379
|
-
getSelectedDigitalCardOptions(option) {
|
|
380
|
-
const selectedOption = option.details.find(detail => detail.is_selected);
|
|
381
|
-
const defaultOption = option.details.find(detail => !!detail.is_default) || option.details[0]; /*option.details[0] only applys for counrty options*/
|
|
382
|
-
if (!['digital-code-value', 'country'].includes(option.type))
|
|
383
|
-
return;
|
|
384
|
-
return selectedOption || defaultOption;
|
|
385
|
-
}
|
|
386
|
-
//we need the cart Id for productOption Image
|
|
387
|
-
async componentWillLoad() {
|
|
388
|
-
if (salla.url.is_page("cart")) {
|
|
389
|
-
this.disableCardValue = false;
|
|
390
|
-
this.fillSelectedOptions();
|
|
391
|
-
}
|
|
392
|
-
if (this.config) {
|
|
393
|
-
try {
|
|
394
|
-
this.optionConfig = typeof this.config === 'string' ? JSON.parse(this.config) : this.config;
|
|
395
|
-
}
|
|
396
|
-
catch (error) {
|
|
397
|
-
console.error('Failed to parse JSON in config prop:', error);
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
const shouldSelectDefaultOption = this.optionsData.filter(({ type }) => ["country", "digital-card-value"].includes(type)).length > 0 && salla.url.is_page('cart');
|
|
401
|
-
if (shouldSelectDefaultOption) {
|
|
402
|
-
const countryOption = this.optionsData.find(option => option.type === 'country');
|
|
403
|
-
const defaultSelection = countryOption && this.getSelectedDigitalCardOptions(countryOption);
|
|
404
|
-
if (defaultSelection) {
|
|
405
|
-
this.getAvailableDigitalCardSKUs(defaultSelection);
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
this.outOfStockText = salla.lang.get('pages.products.out_of_stock');
|
|
409
|
-
await salla.onReady();
|
|
410
|
-
document.addEventListener("paste", this.handlePaste.bind(this));
|
|
411
|
-
const needsCartId = (!salla.storage.get('cart.id') && this.optionsData.some(option => ['file', 'image'].includes(option.type)));
|
|
412
|
-
return needsCartId ? salla.api.cart.getCurrentCartId(false, "salla-product-options") : null;
|
|
413
|
-
}
|
|
414
|
-
/**
|
|
415
|
-
* This is a workaround for a bug in iOS 26 Safari, when pasting English text to RTL inputs, it adds extra text!!
|
|
416
|
-
* To avoid any break changes, we will make it only work on these conditions:
|
|
417
|
-
* - content_copyright is on
|
|
418
|
-
* - Apple Pay is enabled (means it's iOS/safari)
|
|
419
|
-
* - Input is an input or textarea
|
|
420
|
-
* - Salla form control
|
|
421
|
-
* - Options array
|
|
422
|
-
*/
|
|
423
|
-
handlePaste(event) {
|
|
424
|
-
const target = event.target;
|
|
425
|
-
if (!Salla.config.get('store.settings.content_copyright')
|
|
426
|
-
|| !Salla.helpers.hasApplePay()
|
|
427
|
-
|| !(target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement)
|
|
428
|
-
|| !target.classList.contains('s-form-control')
|
|
429
|
-
|| !target.name.startsWith('options[')) {
|
|
430
|
-
return;
|
|
431
|
-
}
|
|
432
|
-
// Prevent default paste (to avoid Safari inserting extra content)
|
|
433
|
-
event.preventDefault();
|
|
434
|
-
// Read only the clipboard data
|
|
435
|
-
const text = event.clipboardData?.getData("text") || "";
|
|
436
|
-
// Insert it manually at cursor if you want
|
|
437
|
-
const start = target.selectionStart;
|
|
438
|
-
const end = target.selectionEnd;
|
|
439
|
-
const newValue = target.value.slice(0, start) + text + target.value.slice(end);
|
|
440
|
-
target.value = newValue;
|
|
441
|
-
// Reset cursor position
|
|
442
|
-
target.setSelectionRange(start + text.length, start + text.length);
|
|
443
|
-
}
|
|
444
|
-
hideDigitalCardsOptions(option) {
|
|
445
|
-
return (this.disableCardValue && option.type === DisplayType.DIGITAL_CARD_VALUE && !salla.url.is_page("cart"));
|
|
446
|
-
}
|
|
447
|
-
render() {
|
|
448
|
-
if (this.optionsData?.length === 0) {
|
|
449
|
-
return;
|
|
450
|
-
}
|
|
451
|
-
return (index.h(index.Host, { class: "s-product-options-wrapper" }, index.h("salla-conditional-fields", null, this.optionsData.map((option) => index.h("div", { key: option.id, class: `s-product-options-option-container${option.visibility_condition || this.hideDigitalCardsOptions(option) ? ' hidden' : ''}`, "data-option-id": option.id, ...this.getOptionShownWhen(option) }, option.name === 'splitter' ?
|
|
452
|
-
this.splitterOption()
|
|
453
|
-
: index.h("div", { class: { "s-product-options-option": true, "s-product-options-option-booking": option.type === DisplayType.BOOKING && salla.url.is_page("cart") }, "data-option-type": option.type, "data-option-required": `${option.required}` }, index.h("label", { htmlFor: `options[${option.id}]`, class: `s-product-options-option-label ${this.hideLabel(option) ? 's-product-options-option-label-hidden' : ''}` }, index.h("b", null, option.name, option.required && index.h("span", null, " * "), " "), index.h("small", null, option.placeholder)), index.h("div", { class: `s-product-options-option-content ${this.hideLabel(option) || (option.type === DisplayType.BOOKING && salla.url.is_page("cart")) ? 's-product-options-option-content-full-width' : ''}` }, this.getDisplayForType(option))))))));
|
|
454
|
-
}
|
|
455
|
-
generateUniqueKey(defaultValue) {
|
|
456
|
-
return this.uniqueKey ? `${defaultValue}-${this.uniqueKey}` : defaultValue;
|
|
457
|
-
}
|
|
458
|
-
fillSelectedOptions() {
|
|
459
|
-
this.selectedOptions = this.optionsData.reduce((acc, opt) => {
|
|
460
|
-
const selectedDetails = opt.details.filter(detail => detail.is_selected);
|
|
461
|
-
const mappedDetails = selectedDetails.map(detail => ({
|
|
462
|
-
...detail,
|
|
463
|
-
option_id: opt.id
|
|
464
|
-
}));
|
|
465
|
-
return acc.concat(mappedDetails);
|
|
466
|
-
}, []);
|
|
467
|
-
}
|
|
468
|
-
componentDidLoad() {
|
|
469
|
-
if (this.optionsData?.length === 0 && !this.optionsData.some(option => option.type === DisplayType.DONATION)) {
|
|
470
|
-
return;
|
|
471
|
-
}
|
|
472
|
-
const selectedDonationOption = this.optionsData.find(option => option.type === DisplayType.DONATION)?.details.find(detail => detail.is_selected);
|
|
473
|
-
if (!selectedDonationOption) {
|
|
474
|
-
return;
|
|
475
|
-
}
|
|
476
|
-
setTimeout(() => {
|
|
477
|
-
salla.event.emit('product-options::donation-changed', {
|
|
478
|
-
id: this.productId,
|
|
479
|
-
price: selectedDonationOption.additional_price
|
|
480
|
-
});
|
|
481
|
-
}, 1000);
|
|
482
|
-
}
|
|
483
|
-
/**
|
|
484
|
-
* Enable user-initiated validation mode so invalid fields will scroll into view
|
|
485
|
-
*/
|
|
486
|
-
async enableUserInitiatedValidation() {
|
|
487
|
-
this.userInitiatedValidation = true;
|
|
488
|
-
}
|
|
489
|
-
/**
|
|
490
|
-
* Validate options and trigger scrolling to the first invalid option if any
|
|
491
|
-
*/
|
|
492
|
-
async validateAndScroll() {
|
|
493
|
-
await this.enableUserInitiatedValidation();
|
|
494
|
-
return this.reportValidity();
|
|
495
|
-
}
|
|
496
|
-
//@ts-ignore
|
|
497
|
-
donationOption(option, product) {
|
|
498
|
-
return index.h("div", { class: "s-product-options-donation-wrapper" }, option.donation?.can_donate ? [
|
|
499
|
-
option.donation ?
|
|
500
|
-
index.h("div", { key: option.id, class: "s-product-options-donation-progress" }, index.h("salla-progress-bar", { donation: option.donation }))
|
|
501
|
-
: '',
|
|
502
|
-
option.details.length ?
|
|
503
|
-
[index.h("h4", { key: option.id }, this.selectAmount), index.h("div", { key: option.id, class: "s-product-options-donation-options" }, option.details.map((detail, i) => index.h("div", { key: option.id, class: "s-product-options-donation-options-item" }, index.h("input", { id: this.generateUniqueKey(`donation-option-${i}`), type: "radio", name: "donating_option", checked: detail.is_selected, value: detail.additional_price, onChange: e => this.handleDonationOptions(e, detail, 'option') }), index.h("label", { htmlFor: this.generateUniqueKey(`donation-option-${i}`) }, index.h("span", { innerHTML: salla.money(detail.name) })))), option.donation?.custom_amount_enabled ?
|
|
504
|
-
index.h("div", { class: "s-product-options-donation-options-item" }, index.h("input", { id: this.generateUniqueKey("donation-option-custom"), type: "radio", name: "donating_option", value: "custom", onChange: e => this.handleDonationOptions(e, 'custom', 'option') }), index.h("label", { htmlFor: this.generateUniqueKey("donation-option-custom") }, index.h("span", null, " ", this.selectDonationAmount, " ")))
|
|
505
|
-
: '')] : '',
|
|
506
|
-
index.h("div", { key: option.id, class: { "s-product-options-donation-input-group": true, "shown": !option.details.length || (option.details.length && this.isCustomDonation) } }, index.h("input", { type: "text", id: "donating-amount", name: "donation_amount", class: "s-form-control", ref: el => { this.donationInput = el; }, value: option.details.length
|
|
507
|
-
&& option.details.some(detail => detail.is_selected)
|
|
508
|
-
? option.details.find(detail => detail.is_selected).additional_price
|
|
509
|
-
: option.value,
|
|
510
|
-
// required
|
|
511
|
-
placeholder: option.placeholder, onInput: e => this.handleDonationOptions(e, 'custom', 'input'), onBlur: e => this.changedHandler(e, option), onInvalid: (e) => this.invalidHandler(e, option) }), index.h("span", { class: "s-product-options-donation-amount-currency" }, salla.config.currency(salla.config.get('user.currency_code')).symbol))
|
|
512
|
-
] :
|
|
513
|
-
this.getExpireDonationMessage(option));
|
|
514
|
-
}
|
|
515
|
-
fileUploader(option, additions = null) {
|
|
516
|
-
return index.h("salla-file-upload", { ...(additions || {}), "payload-name": "file", value: option.value, "instant-upload": true, name: `options[${option.id}]`, required: !option.visibility_condition && option.required, height: "120px", onAdded: (e) => this.changedHandler(e, option), url: salla.cart.api.getUploadImageEndpoint(), "form-data": { cart_item_id: this.productId, product_id: this.productId }, onInvalidInput: (e) => this.invalidHandler(e, option), class: { "s-product-options-image-input": true, required: option.required } }, index.h("div", { class: "s-product-options-filepond-placeholder" }, index.h("span", { class: "s-product-options-filepond-placeholder-icon", innerHTML: additions.accept?.split(',').every(type => type.includes('image'))
|
|
517
|
-
? camera.CameraIcon
|
|
518
|
-
: FileIcon }), index.h("p", { class: "s-product-options-filepond-placeholder-text" }, salla.lang.get('common.uploader.drag_and_drop')), index.h("span", { class: "filepond--label-action" }, salla.lang.get('common.uploader.browse'))));
|
|
519
|
-
}
|
|
520
|
-
//@ts-ignore
|
|
521
|
-
imageOption(option) {
|
|
522
|
-
return this.fileUploader(option, { accept: 'image/png,image/jpeg,image/jpg,image/gif' });
|
|
523
|
-
}
|
|
524
|
-
//@ts-ignore
|
|
525
|
-
fileOption(option) {
|
|
526
|
-
const types = option.details.map(detail => this.fileTypes[detail.name]).filter(Boolean);
|
|
527
|
-
return types?.length
|
|
528
|
-
? this.fileUploader(option, { accept: types.join(',') })
|
|
529
|
-
: 'File types not selected.';
|
|
530
|
-
}
|
|
531
|
-
// TODO: (ONLY FOR TESTING!) find a better way to make it testable, e.g. wrap it with a unique class like textOption
|
|
532
|
-
//@ts-ignore
|
|
533
|
-
numberOption(option) {
|
|
534
|
-
return index.h("input", { type: "text", value: option.value, class: "s-form-control", required: !option.visibility_condition && option.required, name: `options[${option.id}]`, placeholder: option.placeholder, onBlur: e => this.changedHandler(e, option), onInvalid: (e) => this.invalidHandler(e, option), onInput: e => salla.helpers.inputDigitsOnly(e.target) });
|
|
535
|
-
}
|
|
536
|
-
//@ts-ignore
|
|
537
|
-
splitterOption() {
|
|
538
|
-
return index.h("div", { class: "s-product-options-splitter" });
|
|
539
|
-
}
|
|
540
|
-
//@ts-ignore
|
|
541
|
-
textOption(option) {
|
|
542
|
-
return index.h("div", { class: "s-product-options-text" }, index.h("input", { type: "text", value: option.value, maxLength: option?.length, class: 's-form-control', required: !option.visibility_condition && option.required, name: `options[${option.id}]`, placeholder: option.placeholder, onInvalid: (e) => this.invalidHandler(e, option), onChange: e => this.changedHandler(e, option) }));
|
|
543
|
-
}
|
|
544
|
-
//@ts-ignore
|
|
545
|
-
textareaOption(option) {
|
|
546
|
-
//todo::remove mt-1 class, and if it's okay to remove the tag itself will be great
|
|
547
|
-
return index.h("div", { class: "s-product-options-textarea" }, index.h("div", { class: "mt-1" }, index.h("textarea", { rows: 4, value: option.value, maxLength: option?.length, class: "s-form-control", required: !option.visibility_condition && option.required, id: `options[${option.id}]`, name: `options[${option.id}]`, placeholder: option.placeholder, onInvalid: (e) => this.invalidHandler(e, option), onChange: (e) => this.changedHandler(e, option) })));
|
|
548
|
-
}
|
|
549
|
-
//@ts-ignore
|
|
550
|
-
mapOption(option) {
|
|
551
|
-
return index.h("salla-map", { zoom: 15, lat: this.getLatLng(option.value, 'lat'), lng: this.getLatLng(option.value, 'lng'), name: `options[${option.id}]`, searchable: true, required: option.required, onInvalidInput: (e) => this.invalidHandler(e, option), onSelected: e => this.changedHandler(e, option) });
|
|
552
|
-
}
|
|
553
|
-
colorPickerOption(option) {
|
|
554
|
-
return index.h("salla-color-picker", { onSubmitted: e => this.changedHandler(e, option), name: `options[${option.id}]`, required: !option.visibility_condition && option.required, onInvalidInput: (e) => this.invalidHandler(e, option), color: option.value });
|
|
555
|
-
}
|
|
556
|
-
/**
|
|
557
|
-
* ============= Date Time options =============
|
|
558
|
-
*/
|
|
559
|
-
//@ts-ignore
|
|
560
|
-
timeOption(option) {
|
|
561
|
-
return index.h("salla-datetime-picker", { noCalendar: true, enableTime: true, dateFormat: "h:i K", value: option.value, placeholder: option.name, required: !option.visibility_condition && option.required, name: `options[${option.id}]`, class: "s-product-options-time-element", onInvalidInput: (e) => this.invalidHandler(e, option), onPicked: e => this.changedHandler(e, option) });
|
|
562
|
-
}
|
|
563
|
-
//@ts-ignore
|
|
564
|
-
dateOption(option) {
|
|
565
|
-
//todo:: consider date-range @see https://github.com/SallaApp/theme-raed/blob/master/src/assets/js/partials/product-options.js#L8-L23
|
|
566
|
-
return index.h("div", { class: "s-product-options-date-element" }, index.h("salla-datetime-picker", { value: option.value, placeholder: option.name, required: !option.visibility_condition && option.required, minDate: new Date(), name: `options[${option.id}]`, onInvalidInput: (e) => this.invalidHandler(e, option), onPicked: e => this.changedHandler(e, option) }));
|
|
567
|
-
}
|
|
568
|
-
//@ts-ignore
|
|
569
|
-
datetimeOption(option) {
|
|
570
|
-
//todo:: consider date-range @see https://github.com/SallaApp/theme-raed/blob/master/src/assets/js/partials/product-options.js#L8-L23
|
|
571
|
-
return index.h("div", { class: "s-product-options-datetime-element" }, index.h("salla-datetime-picker", { enableTime: true, value: option.value, dateFormat: "Y-m-d G:i:K", placeholder: option.name, required: !option.visibility_condition && option.required, name: `options[${option.id}]`, maxDate: option.to_date_time, minDate: option.from_date_time, onInvalidInput: (e) => this.invalidHandler(e, option), onPicked: e => this.changedHandler(e, option) }));
|
|
572
|
-
}
|
|
573
|
-
/**
|
|
574
|
-
* ============= Advanced options =============
|
|
575
|
-
*/
|
|
576
|
-
getOptionDetailName(detail, outOfStock = true, optionType) {
|
|
577
|
-
let detailName;
|
|
578
|
-
if (optionType && optionType === DisplayType.COLOR) {
|
|
579
|
-
detailName = detail.name
|
|
580
|
-
+ ((outOfStock && this.isOptionDetailOut(detail) && !salla.url.is_page("cart")) && !this.hideOutLabel ? ` <br/> <p> ${this.outOfStockText} </p>` : '')
|
|
581
|
-
+ (detail.additional_price ? ` <p> (${salla.money(detail.additional_price, false)}) </p>` : '');
|
|
582
|
-
}
|
|
583
|
-
if (!detailName) {
|
|
584
|
-
detailName = detail.name
|
|
585
|
-
+ ((outOfStock && this.isOptionDetailOut(detail) && !salla.url.is_page("cart")) && !this.hideOutLabel ? ` - ${this.outOfStockText}` : '')
|
|
586
|
-
+ (detail.additional_price ? ` (${salla.money(detail.additional_price, false)})` : '');
|
|
587
|
-
}
|
|
588
|
-
//Some merchants adding price to the names of the options,
|
|
589
|
-
//and because we are using this inside select option, we need to replace the html currency symbol with the store currency symbol
|
|
590
|
-
return detailName.replace('<i class=sicon-sar></i>', salla.config.currency()?.symbol || 'ر.س');
|
|
591
|
-
}
|
|
592
|
-
isOptionDetailOut(detail) {
|
|
593
|
-
if (detail.is_out || !detail.skus_availability || !this.selectedSkus?.length) {
|
|
594
|
-
return detail.is_out;
|
|
595
|
-
}
|
|
596
|
-
const isDetailSelected = this.selectedOptions.filter(option => option.id === detail.id).length;
|
|
597
|
-
//if the current options is the only selected option, so we are sure that it's not out, because there is no other options selected yet
|
|
598
|
-
if (isDetailSelected && this.selectedOptions.length === 1) {
|
|
599
|
-
return false;
|
|
600
|
-
}
|
|
601
|
-
//if current details has sku in the possible outSkus it's out for sure
|
|
602
|
-
if (isDetailSelected) {
|
|
603
|
-
//here we will get the possible outSkus for current selected options
|
|
604
|
-
const outSelectableSkus = this.selectedSkus.filter(sku => this.outSkus.includes(sku));
|
|
605
|
-
return Object.keys(detail.skus_availability).some(sku => outSelectableSkus.includes(Number(sku)));
|
|
606
|
-
}
|
|
607
|
-
return this.selectedOptions.some(option => option.is_out && option.option_id !== detail.option_id);
|
|
608
|
-
}
|
|
609
|
-
/**
|
|
610
|
-
* Renders a single input element (radio or checkbox) for an option detail.
|
|
611
|
-
* @param type - The type of input element ('radio' or 'checkbox').
|
|
612
|
-
* @param detail - The detail object representing an option detail.
|
|
613
|
-
* @param option - The parent option object containing the details.
|
|
614
|
-
* @param isRequired - Indicates if the input is required based on the option's rules.
|
|
615
|
-
* @param name - The name attribute for the input element.
|
|
616
|
-
* @returns HTMLElement - A labeled input element.
|
|
617
|
-
*/
|
|
618
|
-
renderInput(type, detail, option, isRequired, name, buttonStyle) {
|
|
619
|
-
const id = this.generateUniqueKey(`${type}-${option.id}-${detail.id}`);
|
|
620
|
-
const isDisabled = this.isOptionDetailOut(detail);
|
|
621
|
-
return (index.h("label", { class: {
|
|
622
|
-
"s-product-options-disabled": isDisabled,
|
|
623
|
-
} }, index.h("input", { id: id, type: type, name: name, value: detail.id, disabled: isDisabled, required: isRequired, checked: detail.is_selected, onInvalid: (e) => this.invalidHandler(e, option), onChange: (e) => this.changedHandler(e, option) }), index.h("div", { class: { "s-product-options-grid-mode-span": buttonStyle, "s-product-options-disabled": isDisabled } }, this.getOptionDetailName(detail))));
|
|
624
|
-
}
|
|
625
|
-
/**
|
|
626
|
-
* Renders a collection of input elements for all details of an option.
|
|
627
|
-
* @param type - The type of input elements ('radio' or 'checkbox').
|
|
628
|
-
* @param option - The parent option object containing the details.
|
|
629
|
-
* @param isRequired - Indicates if the inputs are required based on the option's rules.
|
|
630
|
-
* @returns HTMLElement[] - An array of labeled input elements.
|
|
631
|
-
*/
|
|
632
|
-
renderOptionDetails(type, option, isRequired, buttonStyle = false) {
|
|
633
|
-
const name = type === 'radio' ? `options[${option.id}]` : `options[${option.id}][]`;
|
|
634
|
-
return option?.details.map((detail) => this.renderInput(type, detail, option, isRequired, name, buttonStyle));
|
|
635
|
-
}
|
|
636
|
-
/**
|
|
637
|
-
* Renders a dropdown (select) element for a single-option selection.
|
|
638
|
-
* @param option - The parent option object.
|
|
639
|
-
* @returns HTMLElement - A select dropdown element with all option details.
|
|
640
|
-
*/
|
|
641
|
-
renderSelect(option) {
|
|
642
|
-
return (index.h("div", null, index.h("select", { name: `options[${option.id}]`, required: !option.visibility_condition && option.required, class: "s-form-control", onInvalid: (e) => this.invalidHandler(e, option), onChange: (e) => this.changedHandler(e, option) }, index.h("option", { value: "" }, option.placeholder), option?.details.map((detail) => (index.h("option", { key: detail.id, value: detail.id, disabled: this.canDisabled && this.isOptionDetailOut(detail), selected: detail.is_selected }, this.getOptionDetailName(detail)))))));
|
|
643
|
-
}
|
|
644
|
-
/**
|
|
645
|
-
* Renders a grid-based layout for option inputs (radio or checkbox).
|
|
646
|
-
* @param type - The type of input elements ('radio' or 'checkbox').
|
|
647
|
-
* @param option - The parent option object containing the details.
|
|
648
|
-
* @param isRequired - Indicates if the inputs are required based on the option's rules.
|
|
649
|
-
* @returns HTMLElement - A grid-based container with input elements.
|
|
650
|
-
*/
|
|
651
|
-
renderButtonStyle(type, option, isRequired) {
|
|
652
|
-
return (index.h("div", { class: "s-product-options-grid-mode" }, this.renderOptionDetails(type, option, isRequired, true)));
|
|
653
|
-
}
|
|
654
|
-
/**
|
|
655
|
-
* Renders a single-option selection, either as a grid or dropdown, based on configuration.
|
|
656
|
-
* @param option - The parent option object.
|
|
657
|
-
* @returns HTMLElement - The rendered single-option element.
|
|
658
|
-
*/
|
|
659
|
-
singleOption(option) {
|
|
660
|
-
const buttonStyle = this.optionConfig?.['single-option']?.type === 'button';
|
|
661
|
-
const isRequired = !option.visibility_condition && option.required;
|
|
662
|
-
return buttonStyle
|
|
663
|
-
? this.renderButtonStyle('radio', option, isRequired)
|
|
664
|
-
: this.renderSelect(option);
|
|
665
|
-
}
|
|
666
|
-
/**
|
|
667
|
-
* Renders a multiple-option selection, either as a grid or list, based on configuration.
|
|
668
|
-
* @param option - The parent option object.
|
|
669
|
-
* @returns HTMLElement - The rendered multiple-option element.
|
|
670
|
-
*/
|
|
671
|
-
multipleOptions(option) {
|
|
672
|
-
const buttonStyle = this.optionConfig?.['multiple-option']?.type === 'button';
|
|
673
|
-
const isRequired = option.required &&
|
|
674
|
-
!option.details.some((detail) => detail.is_selected) &&
|
|
675
|
-
!option.visibility_condition;
|
|
676
|
-
return buttonStyle
|
|
677
|
-
? this.renderButtonStyle('checkbox', option, isRequired)
|
|
678
|
-
: (index.h("div", { class: {
|
|
679
|
-
's-product-options-multiple-options-wrapper': true,
|
|
680
|
-
required: option.required,
|
|
681
|
-
} }, this.renderOptionDetails('checkbox', option, isRequired)));
|
|
682
|
-
}
|
|
683
|
-
//@ts-ignore
|
|
684
|
-
colorOption(option) {
|
|
685
|
-
return (index.h("fieldset", { class: "s-product-options-colors-wrapper" }, option?.details.map((detail) => (index.h("div", { class: "s-product-options-colors-item", key: detail.id }, index.h("input", { type: "radio", value: detail.id, required: !option.visibility_condition && option.required, checked: detail.is_selected, name: `options[${option.id}]`, disabled: this.canDisabled && this.isOptionDetailOut(detail), id: this.generateUniqueKey(`color-${this.productId}-${option.id}-${detail.id}`), onInvalid: (e) => this.invalidHandler(e, option), onChange: (e) => this.changedHandler(e, option) }), index.h("label", { htmlFor: this.generateUniqueKey(`color-${this.productId}-${option.id}-${detail.id}`) }, index.h("span", { style: { backgroundColor: detail.color } }), index.h("div", { innerHTML: this.getOptionDetailName(detail, true, option.type) })))))));
|
|
686
|
-
}
|
|
687
|
-
//@ts-ignore
|
|
688
|
-
thumbnailOption(option) {
|
|
689
|
-
return index.h("div", { class: "s-product-options-thumbnails-wrapper" }, option.details.map((detail) => {
|
|
690
|
-
return index.h("div", { key: detail.id }, index.h("input", { type: "radio", value: detail.id, "data-itemid": detail.id, required: !option.visibility_condition && option.required, checked: detail.is_selected, name: `options[${option.id}]`, "data-img-id": detail.option_value, disabled: this.canDisabled && this.isOptionDetailOut(detail), id: this.generateUniqueKey(`option_${this.productId}-${option.id}_${detail.id}`), onInvalid: (e) => this.invalidHandler(e, option), onChange: (e) => this.changedHandler(e, option) }), index.h("label", { htmlFor: this.generateUniqueKey(`option_${this.productId}-${option.id}_${detail.id}`), "data-img-id": detail.option_value, class: "go-to-slide" }, index.h("img", { "data-src": detail.image, src: detail.image, title: detail.name, alt: detail.name }), index.h("span", { innerHTML: check.IconVerified, class: "s-product-options-thumbnails-icon" }), this.isOptionDetailOut(detail) ?
|
|
691
|
-
[
|
|
692
|
-
index.h("small", { key: detail.id, class: "s-product-options-thumbnails-stock-badge" }, this.outOfStockText),
|
|
693
|
-
this.canDisabled ? index.h("div", { key: detail.id, class: "s-product-options-thumbnails-badge-overlay" }) : '',
|
|
694
|
-
]
|
|
695
|
-
: ''), index.h("p", null, this.getOptionDetailName(detail, false), " "));
|
|
696
|
-
}));
|
|
697
|
-
}
|
|
698
|
-
// Digital card options
|
|
699
|
-
digitalCardValuesOption(option) {
|
|
700
|
-
return index.h("div", { class: "s-product-options-digital-card-wrapper" }, this.availableDigitalCardValues.length > 0 ? this.availableDigitalCardValues.map((detail) => {
|
|
701
|
-
const id = String(detail.id);
|
|
702
|
-
return index.h("label", { htmlFor: this.generateUniqueKey(id.toString()), key: id, class: "s-product-options-digital-card-option" }, index.h("input", { type: "radio", "data-code-value": true, class: "s-form-control s-product-options-digital-card-input", value: detail.id, name: `options[${option.id}]`, id: this.generateUniqueKey(id.toString()), required: !option.visibility_condition && option.required, onInvalid: (e) => this.invalidHandler(e, option), ...(!this.ignoreDefaultCardValue ? { defaultChecked: this.getSelectedDigitalCardOptions(option)?.id === detail.id } : {}) }), index.h("span", null, detail.name, " ", salla.config?.currency()?.symbol));
|
|
703
|
-
})
|
|
704
|
-
: index.h("div", { class: "s-product-options-digital-card-out-of-stock" }));
|
|
705
|
-
}
|
|
706
|
-
countryOption(option) {
|
|
707
|
-
return index.h("div", { class: "s-product-options-digital-card-wrapper" }, option.details.map((detail) => {
|
|
708
|
-
return index.h("label", { htmlFor: this.generateUniqueKey(detail.id.toString()), key: detail.id, class: { "s-product-options-digital-card-option": true, "s-product-options-digital-card-option-stock-out": detail.is_out } }, index.h("input", { id: this.generateUniqueKey(detail.id.toString()), type: "radio", class: "s-form-control s-product-options-digital-card-input", value: detail.id, name: `options[${option.id}]`, disabled: detail.is_out, required: !option.visibility_condition && option.required, onInvalid: (e) => this.invalidHandler(e, option), onChange: e => this.changedHandler(e, option), onClick: () => { this.disableCardValue = false; }, ...(salla.url.is_page("cart") ? { defaultChecked: this.getSelectedDigitalCardOptions(option)?.id === detail.id } : {}) }), index.h("img", { loading: 'lazy', alt: detail.code, height: 24, width: 24, class: "s-product-options-country-flag", src: `https://cdn.assets.salla.network/prod/admin/cp/assets/flags/1x1/${String(detail.code).toLocaleLowerCase()}.svg` }), index.h("span", null, detail.name));
|
|
709
|
-
}));
|
|
710
|
-
}
|
|
711
|
-
get host() { return index.getElement(this); }
|
|
712
|
-
};
|
|
713
|
-
SallaProductOptions.style = sallaProductOptionsCss;
|
|
714
|
-
|
|
715
|
-
exports.salla_product_options = SallaProductOptions;
|