@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,816 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
import { I as IconVerified } from './check.js';
|
|
6
|
-
import { C as CameraIcon } from './camera.js';
|
|
7
|
-
import { d as defineCustomElement$b } from './salla-booking-field2.js';
|
|
8
|
-
import { d as defineCustomElement$a } from './salla-button2.js';
|
|
9
|
-
import { d as defineCustomElement$9 } from './salla-color-picker2.js';
|
|
10
|
-
import { d as defineCustomElement$8 } from './salla-conditional-fields2.js';
|
|
11
|
-
import { d as defineCustomElement$7 } from './salla-datetime-picker2.js';
|
|
12
|
-
import { d as defineCustomElement$6 } from './salla-file-upload2.js';
|
|
13
|
-
import { d as defineCustomElement$5 } from './salla-loading2.js';
|
|
14
|
-
import { d as defineCustomElement$4 } from './salla-map2.js';
|
|
15
|
-
import { d as defineCustomElement$3 } from './salla-modal2.js';
|
|
16
|
-
import { d as defineCustomElement$2 } from './salla-progress-bar2.js';
|
|
17
|
-
|
|
18
|
-
var DisplayType;
|
|
19
|
-
(function (DisplayType) {
|
|
20
|
-
DisplayType["COLOR"] = "color";
|
|
21
|
-
DisplayType["DATE"] = "date";
|
|
22
|
-
DisplayType["DATETIME"] = "datetime";
|
|
23
|
-
DisplayType["DONATION"] = "donation";
|
|
24
|
-
DisplayType["IMAGE"] = "image";
|
|
25
|
-
DisplayType["MULTIPLE_OPTIONS"] = "multiple-options";
|
|
26
|
-
DisplayType["NUMBER"] = "number";
|
|
27
|
-
DisplayType["SINGLE_OPTION"] = "single-option";
|
|
28
|
-
DisplayType["DIGITAL_CARD_VALUE"] = "digital-code-value";
|
|
29
|
-
DisplayType["COUNTRY"] = "country";
|
|
30
|
-
DisplayType["SPLITTER"] = "splitter";
|
|
31
|
-
DisplayType["TEXT"] = "text";
|
|
32
|
-
DisplayType["TEXTAREA"] = "textarea";
|
|
33
|
-
DisplayType["THUMBNAIL"] = "thumbnail";
|
|
34
|
-
DisplayType["TIME"] = "time";
|
|
35
|
-
DisplayType["RADIO"] = "radio";
|
|
36
|
-
DisplayType["CHECKBOX"] = "checkbox";
|
|
37
|
-
DisplayType["MAP"] = "map";
|
|
38
|
-
DisplayType["FILE"] = "file";
|
|
39
|
-
DisplayType["COLOR_PICKER"] = "color_picker";
|
|
40
|
-
DisplayType["BOOKING"] = "booking";
|
|
41
|
-
})(DisplayType || (DisplayType = {}));
|
|
42
|
-
var Currency;
|
|
43
|
-
(function (Currency) {
|
|
44
|
-
Currency["Sar"] = "SAR";
|
|
45
|
-
})(Currency || (Currency = {}));
|
|
46
|
-
|
|
47
|
-
var FileIcon = `<!-- Generated by IcoMoon.io -->
|
|
48
|
-
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
|
49
|
-
<title>file-upload</title>
|
|
50
|
-
<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>
|
|
51
|
-
</svg>
|
|
52
|
-
`;
|
|
53
|
-
|
|
54
|
-
const sallaProductOptionsCss = "";
|
|
55
|
-
|
|
56
|
-
const SallaProductOptions$1 = /*@__PURE__*/ proxyCustomElement(class SallaProductOptions extends HTMLElement {
|
|
57
|
-
constructor() {
|
|
58
|
-
super();
|
|
59
|
-
this.__registerHost();
|
|
60
|
-
this.changed = createEvent(this, "changed", 7);
|
|
61
|
-
this.fileTypes = {
|
|
62
|
-
pdf: 'application/pdf',
|
|
63
|
-
png: 'image/png',
|
|
64
|
-
jpg: 'image/jpeg',
|
|
65
|
-
word: 'application/doc,application/ms-doc,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
66
|
-
exl: 'application/excel,application/vnd.ms-excel,application/x-excel,application/x-msexcel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
67
|
-
txt: 'text/plain',
|
|
68
|
-
};
|
|
69
|
-
this.outOfStockText = "";
|
|
70
|
-
this.donationAmount = salla.lang.get('pages.products.donation_amount');
|
|
71
|
-
this.selectDonationAmount = salla.lang.getWithDefault('pages.products.select_donation_amount', 'تحديد مبلغ التبرع');
|
|
72
|
-
this.selectAmount = salla.lang.getWithDefault('pages.products.select_amount', 'اختر المبلغ');
|
|
73
|
-
this.isCustomDonation = false;
|
|
74
|
-
this.selectedOptions = [];
|
|
75
|
-
this.disableCardValue = true;
|
|
76
|
-
this.availableDigitalCardValues = [];
|
|
77
|
-
this.userInitiatedValidation = false;
|
|
78
|
-
this.outSkus = [];
|
|
79
|
-
/**
|
|
80
|
-
* Avoid selection of previous default or selected card value option
|
|
81
|
-
* when switching between digital card country options for the 1st time
|
|
82
|
-
*/
|
|
83
|
-
this.ignoreDefaultCardValue = false;
|
|
84
|
-
/**
|
|
85
|
-
* The id of the product to which the options are going to be fetched for.
|
|
86
|
-
*/
|
|
87
|
-
this.productId = salla.config.get('page.id');
|
|
88
|
-
this.handleDonationOptions = (event, detail, type) => {
|
|
89
|
-
if (detail === 'custom' && type === 'input') {
|
|
90
|
-
salla.helpers.inputDigitsOnly(event.target);
|
|
91
|
-
salla.event.emit('product-options::donation-changed', {
|
|
92
|
-
id: this.productId,
|
|
93
|
-
price: event.target.value
|
|
94
|
-
});
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
event.preventDefault();
|
|
98
|
-
event.stopPropagation();
|
|
99
|
-
this.isCustomDonation = event.target.value === 'custom';
|
|
100
|
-
if (this.donationInput) {
|
|
101
|
-
if (event.target.value === 'custom') {
|
|
102
|
-
this.donationInput.value = '';
|
|
103
|
-
this.donationInput.focus();
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
this.donationInput.value = event.target.value;
|
|
107
|
-
}
|
|
108
|
-
if (detail === 'custom') {
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
salla.event.emit('product-options::donation-changed', {
|
|
112
|
-
id: this.productId,
|
|
113
|
-
price: event.target.value
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
this.hideLabel = (option) => {
|
|
118
|
-
if (option.type === DisplayType.DONATION && (option.donation && !option.donation.can_donate)) {
|
|
119
|
-
return true;
|
|
120
|
-
}
|
|
121
|
-
return false;
|
|
122
|
-
};
|
|
123
|
-
this.getExpireDonationMessage = (option) => {
|
|
124
|
-
if (!option.donation) {
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
const completed = option.donation.target_amount <= option.donation.collected_amount;
|
|
128
|
-
return h("div", { class: { "s-product-options-donation-message": true, "s-product-options-donation-completed": completed, "s-product-options-donation-expired": !completed } }, h("p", null, option.donation.target_message), h("span", { innerHTML: completed ? salla.money(option.donation.target_amount) : '' }));
|
|
129
|
-
};
|
|
130
|
-
this.canDisabled = !salla.config.get('store.settings.product.notify_options_availability') || salla.url.is_page('cart');
|
|
131
|
-
salla.lang.onLoaded(() => {
|
|
132
|
-
this.outOfStockText = salla.lang.get("pages.products.out_of_stock");
|
|
133
|
-
this.donationAmount = salla.lang.get('pages.products.donation_amount');
|
|
134
|
-
this.selectDonationAmount = salla.lang.getWithDefault('pages.products.select_donation_amount', 'تحديد مبلغ التبرع');
|
|
135
|
-
this.selectAmount = salla.lang.getWithDefault('pages.products.select_amount', 'اختر المبلغ');
|
|
136
|
-
});
|
|
137
|
-
if (this.options) {
|
|
138
|
-
try {
|
|
139
|
-
this.setOptionsData(Array.isArray(this.options) ? this.options : JSON.parse(this.options));
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
catch (e) {
|
|
143
|
-
salla.log('Bad json passed via options prop');
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
if (!Array.isArray(this.optionsData)) {
|
|
147
|
-
salla.log('Options is not an array[] ---> ', this.optionsData);
|
|
148
|
-
this.setOptionsData([]);
|
|
149
|
-
}
|
|
150
|
-
if (this.productId && !salla.url.is_page('cart')) {
|
|
151
|
-
salla.api.product.getDetails(this.productId, ['options']).then(resp => this.setOptionsData(resp.data.options));
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Sets the options data for the product
|
|
156
|
-
* @param optionsData - Array of product options
|
|
157
|
-
*/
|
|
158
|
-
async setOptionsData(optionsData) {
|
|
159
|
-
this.optionsData = optionsData;
|
|
160
|
-
const that = this;
|
|
161
|
-
this.optionsData[0]?.details?.forEach(function (detail) {
|
|
162
|
-
Object.entries(detail.skus_availability || {})
|
|
163
|
-
.filter(sku => !sku[1])
|
|
164
|
-
.map(sku => that.outSkus.push(Number(sku[0])));
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Get the id's of the selected options.
|
|
169
|
-
* */
|
|
170
|
-
async getSelectedOptionsData() {
|
|
171
|
-
const selectedOptions = {};
|
|
172
|
-
const formData = this.host.getElementSallaData();
|
|
173
|
-
formData.forEach((value, key) => {
|
|
174
|
-
if (key.startsWith('options[')) {
|
|
175
|
-
(selectedOptions[key.replace('options[', '').replace(']', '')] = value);
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
return selectedOptions;
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Report options form validity.
|
|
182
|
-
* */
|
|
183
|
-
async reportValidity() {
|
|
184
|
-
const requiredElements = this.host.querySelectorAll('[required]');
|
|
185
|
-
let pass = true;
|
|
186
|
-
for (let i = 0; i < requiredElements.length; i++) {
|
|
187
|
-
//if there is only one invalid option, return false
|
|
188
|
-
if ('reportValidity' in requiredElements[i] && !requiredElements[i].reportValidity()) {
|
|
189
|
-
pass = false;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
return pass;
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Return true if there is any out of stock options are selected and vise versa.
|
|
196
|
-
* */
|
|
197
|
-
async hasOutOfStockOption() {
|
|
198
|
-
return this.selectedOptions.some(option => option.is_out) || (this.selectedSkus?.length && this.selectedSkus?.every(sku => this.outSkus.includes(sku)));
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* Get selected options.
|
|
202
|
-
* */
|
|
203
|
-
async getSelectedOptions() {
|
|
204
|
-
return this.selectedOptions;
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Get a specific option by its id.
|
|
208
|
-
* */
|
|
209
|
-
async getOption(option_id) {
|
|
210
|
-
return this.optionsData.find(option => option.id === option_id);
|
|
211
|
-
}
|
|
212
|
-
// @ts-ignore
|
|
213
|
-
invalidHandler(event, option) {
|
|
214
|
-
const closestProductOption = event.target.closest('.s-product-options-option');
|
|
215
|
-
if (!closestProductOption.classList.contains('s-product-options-option-error')) {
|
|
216
|
-
closestProductOption.classList.add('s-product-options-option-error');
|
|
217
|
-
}
|
|
218
|
-
if (this.userInitiatedValidation && !salla.url.is_page('cart')) {
|
|
219
|
-
const firstInvalidElement = this.host.querySelector('.s-product-options-option-error');
|
|
220
|
-
if (firstInvalidElement === closestProductOption) {
|
|
221
|
-
this.scrollToElement(closestProductOption);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
scrollToElement(element) {
|
|
226
|
-
if (element) {
|
|
227
|
-
element.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
changedHandler(event, option, fireChangeEvent = true) {
|
|
231
|
-
const data = {
|
|
232
|
-
event: event,
|
|
233
|
-
option: option,
|
|
234
|
-
detail: null,
|
|
235
|
-
productId: this.productId
|
|
236
|
-
};
|
|
237
|
-
if (option.details) {
|
|
238
|
-
const detail = option.details.find((detail) => {
|
|
239
|
-
return Number(detail.id) === Number(event.target.value);
|
|
240
|
-
});
|
|
241
|
-
data.detail = detail;
|
|
242
|
-
}
|
|
243
|
-
if (option.type === 'country') {
|
|
244
|
-
this.handleCountryOptionChange(event, data.detail);
|
|
245
|
-
}
|
|
246
|
-
const optionElement = event.target.closest('.s-product-options-option');
|
|
247
|
-
if (event.target.value ||
|
|
248
|
-
((option.type === DisplayType.FILE || option.type === DisplayType.IMAGE) && event.type === 'added') ||
|
|
249
|
-
(option.type === DisplayType.MAP && event.type === 'selected' && (event.target.lat && event.target.lng))) {
|
|
250
|
-
setTimeout(() => {
|
|
251
|
-
optionElement.classList.remove('s-product-options-option-error');
|
|
252
|
-
}, 200);
|
|
253
|
-
}
|
|
254
|
-
if (option.type === DisplayType.DONATION) {
|
|
255
|
-
salla.event.emit('product-options::donation-changed', {
|
|
256
|
-
id: this.productId,
|
|
257
|
-
price: event.target.value
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
this.setSelectedSkus();
|
|
261
|
-
this.handleRequiredMultipleOptions(option);
|
|
262
|
-
const index = this.selectedOptions.findIndex(opt => opt.option_id === data.option.id);
|
|
263
|
-
if (data.option.type === DisplayType.MULTIPLE_OPTIONS) {
|
|
264
|
-
// Handle multiple selections
|
|
265
|
-
const detailIndex = this.selectedOptions.findIndex(opt => opt.option_id === data.option.id && opt?.id === data.detail?.id);
|
|
266
|
-
if (detailIndex > -1) {
|
|
267
|
-
// If the option is already selected, remove it (unselect)
|
|
268
|
-
this.selectedOptions.splice(detailIndex, 1);
|
|
269
|
-
}
|
|
270
|
-
else {
|
|
271
|
-
// If the option is not selected, add it to the selectedOptions array
|
|
272
|
-
this.selectedOptions.push({ ...data.detail, option_id: data.option.id });
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
else {
|
|
276
|
-
// Handle single selection
|
|
277
|
-
if (!data.detail || Object.keys(data.detail).length === 0) {
|
|
278
|
-
// If there is no value for the single-select, remove it from the selectedOptions array
|
|
279
|
-
if (index > -1) {
|
|
280
|
-
this.selectedOptions.splice(index, 1);
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
else {
|
|
284
|
-
// If a value exists, update or add the selection
|
|
285
|
-
if (index > -1) {
|
|
286
|
-
// Replace the existing selection with the new one
|
|
287
|
-
this.selectedOptions[index] = { ...data.detail, option_id: data.option.id };
|
|
288
|
-
}
|
|
289
|
-
else {
|
|
290
|
-
// If no selection exists for this input, add the new selection
|
|
291
|
-
this.selectedOptions.push({ ...data.detail, option_id: data.option.id });
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
// Update optionsData directly
|
|
296
|
-
this.optionsData = this.optionsData.map(opt => {
|
|
297
|
-
if (opt.id === data.option.id) {
|
|
298
|
-
return {
|
|
299
|
-
...opt,
|
|
300
|
-
details: opt.details.map(detail => ({
|
|
301
|
-
...detail,
|
|
302
|
-
is_selected: data.option.type === DisplayType.MULTIPLE_OPTIONS
|
|
303
|
-
? this.selectedOptions.some(selected => selected.id === detail.id)
|
|
304
|
-
: Number(detail.id) === Number(data.detail?.id),
|
|
305
|
-
value: data.detail?.value
|
|
306
|
-
}))
|
|
307
|
-
};
|
|
308
|
-
}
|
|
309
|
-
return opt;
|
|
310
|
-
});
|
|
311
|
-
// Emit the event only if fireChangeEvent is true
|
|
312
|
-
if (fireChangeEvent) {
|
|
313
|
-
this.changed.emit(data);
|
|
314
|
-
salla.event.emit('product-options::change', data);
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
/**
|
|
318
|
-
* loop throw all selected details, then get common sku, if it's only one, means we selected all of them;
|
|
319
|
-
*/
|
|
320
|
-
setSelectedSkus() {
|
|
321
|
-
this.selectedSkus = this.selectedOptions.map(detail => Object.keys(detail.skus_availability || {}))
|
|
322
|
-
.reduce((p, c) => p.filter(e => c.includes(e)), []) // Initialize accumulator as an empty array
|
|
323
|
-
.map(sku => Number(sku));
|
|
324
|
-
}
|
|
325
|
-
handleRequiredMultipleOptions(option) {
|
|
326
|
-
if (option.type !== DisplayType.MULTIPLE_OPTIONS || !option.required) {
|
|
327
|
-
return;
|
|
328
|
-
}
|
|
329
|
-
const optionContainer = this.host.querySelector(`[data-option-id="${option.id}"]`);
|
|
330
|
-
const hasChecked = optionContainer.querySelectorAll('input:checked').length;
|
|
331
|
-
optionContainer.querySelectorAll('input').forEach(input => input.toggleAttribute('required', !hasChecked));
|
|
332
|
-
}
|
|
333
|
-
getLatLng(value, type) {
|
|
334
|
-
return value
|
|
335
|
-
? value.split(',')[type === 'lat' ? 0 : 1]
|
|
336
|
-
: '';
|
|
337
|
-
}
|
|
338
|
-
getDisplayForType(option) {
|
|
339
|
-
if (this[`${option.type}Option`]) {
|
|
340
|
-
return this[`${option.type}Option`](option);
|
|
341
|
-
}
|
|
342
|
-
if (option.type === DisplayType.COLOR_PICKER) {
|
|
343
|
-
return this.colorPickerOption(option);
|
|
344
|
-
}
|
|
345
|
-
if (option.type === DisplayType.MULTIPLE_OPTIONS) {
|
|
346
|
-
return this.multipleOptions(option);
|
|
347
|
-
}
|
|
348
|
-
if (option.type === DisplayType.SINGLE_OPTION) {
|
|
349
|
-
return this.singleOption(option);
|
|
350
|
-
}
|
|
351
|
-
if (option.type === DisplayType.DIGITAL_CARD_VALUE) {
|
|
352
|
-
return this.digitalCardValuesOption(option);
|
|
353
|
-
}
|
|
354
|
-
if (option.type === DisplayType.COUNTRY) {
|
|
355
|
-
return this.countryOption(option);
|
|
356
|
-
}
|
|
357
|
-
if (option.type === DisplayType.BOOKING && salla.url.is_page("cart")) {
|
|
358
|
-
return h("salla-booking-field", { onInvalidInput: (e) => this.invalidHandler(e, option), option: option, productId: option.value });
|
|
359
|
-
}
|
|
360
|
-
salla.log(`Couldn't find options type(${option.type})😢`);
|
|
361
|
-
return '';
|
|
362
|
-
}
|
|
363
|
-
getOptionShownWhen(option) {
|
|
364
|
-
return option.visibility_condition
|
|
365
|
-
? { "data-show-when": `options[${option.visibility_condition.option}] ${option.visibility_condition.operator} ${option.visibility_condition.value}` }
|
|
366
|
-
: {};
|
|
367
|
-
}
|
|
368
|
-
getAvailableDigitalCardSKUs(detail) {
|
|
369
|
-
const digitalCardOption = this.optionsData.find(({ type }) => type === 'digital-code-value');
|
|
370
|
-
if (!digitalCardOption)
|
|
371
|
-
throw new Error('product-options:: No digital card options found');
|
|
372
|
-
const outofStockSKUs = Object.keys(detail.skus_availability).filter(key => detail.skus_availability[key] === false);
|
|
373
|
-
this.availableDigitalCardValues = digitalCardOption.details.filter((op) => {
|
|
374
|
-
return !Object.keys(op.skus_availability).filter(SKU_key => outofStockSKUs.includes(SKU_key)).length;
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
|
-
handleCountryOptionChange(event, detail) {
|
|
378
|
-
event.stopImmediatePropagation();
|
|
379
|
-
this.ignoreDefaultCardValue = true;
|
|
380
|
-
const currentCardValue = this.host.querySelector("input[data-code-value]:checked");
|
|
381
|
-
if (currentCardValue)
|
|
382
|
-
currentCardValue.checked = false;
|
|
383
|
-
const digitalCardOption = this.optionsData.find(({ type }) => type === 'digital-code-value');
|
|
384
|
-
if (!digitalCardOption)
|
|
385
|
-
throw new Error('product-options:: No digital card options found');
|
|
386
|
-
this.getAvailableDigitalCardSKUs(detail);
|
|
387
|
-
}
|
|
388
|
-
getSelectedDigitalCardOptions(option) {
|
|
389
|
-
const selectedOption = option.details.find(detail => detail.is_selected);
|
|
390
|
-
const defaultOption = option.details.find(detail => !!detail.is_default) || option.details[0]; /*option.details[0] only applys for counrty options*/
|
|
391
|
-
if (!['digital-code-value', 'country'].includes(option.type))
|
|
392
|
-
return;
|
|
393
|
-
return selectedOption || defaultOption;
|
|
394
|
-
}
|
|
395
|
-
//we need the cart Id for productOption Image
|
|
396
|
-
async componentWillLoad() {
|
|
397
|
-
if (salla.url.is_page("cart")) {
|
|
398
|
-
this.disableCardValue = false;
|
|
399
|
-
this.fillSelectedOptions();
|
|
400
|
-
}
|
|
401
|
-
if (this.config) {
|
|
402
|
-
try {
|
|
403
|
-
this.optionConfig = typeof this.config === 'string' ? JSON.parse(this.config) : this.config;
|
|
404
|
-
}
|
|
405
|
-
catch (error) {
|
|
406
|
-
console.error('Failed to parse JSON in config prop:', error);
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
const shouldSelectDefaultOption = this.optionsData.filter(({ type }) => ["country", "digital-card-value"].includes(type)).length > 0 && salla.url.is_page('cart');
|
|
410
|
-
if (shouldSelectDefaultOption) {
|
|
411
|
-
const countryOption = this.optionsData.find(option => option.type === 'country');
|
|
412
|
-
const defaultSelection = countryOption && this.getSelectedDigitalCardOptions(countryOption);
|
|
413
|
-
if (defaultSelection) {
|
|
414
|
-
this.getAvailableDigitalCardSKUs(defaultSelection);
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
this.outOfStockText = salla.lang.get('pages.products.out_of_stock');
|
|
418
|
-
await salla.onReady();
|
|
419
|
-
document.addEventListener("paste", this.handlePaste.bind(this));
|
|
420
|
-
const needsCartId = (!salla.storage.get('cart.id') && this.optionsData.some(option => ['file', 'image'].includes(option.type)));
|
|
421
|
-
return needsCartId ? salla.api.cart.getCurrentCartId(false, "salla-product-options") : null;
|
|
422
|
-
}
|
|
423
|
-
/**
|
|
424
|
-
* This is a workaround for a bug in iOS 26 Safari, when pasting English text to RTL inputs, it adds extra text!!
|
|
425
|
-
* To avoid any break changes, we will make it only work on these conditions:
|
|
426
|
-
* - content_copyright is on
|
|
427
|
-
* - Apple Pay is enabled (means it's iOS/safari)
|
|
428
|
-
* - Input is an input or textarea
|
|
429
|
-
* - Salla form control
|
|
430
|
-
* - Options array
|
|
431
|
-
*/
|
|
432
|
-
handlePaste(event) {
|
|
433
|
-
const target = event.target;
|
|
434
|
-
if (!Salla.config.get('store.settings.content_copyright')
|
|
435
|
-
|| !Salla.helpers.hasApplePay()
|
|
436
|
-
|| !(target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement)
|
|
437
|
-
|| !target.classList.contains('s-form-control')
|
|
438
|
-
|| !target.name.startsWith('options[')) {
|
|
439
|
-
return;
|
|
440
|
-
}
|
|
441
|
-
// Prevent default paste (to avoid Safari inserting extra content)
|
|
442
|
-
event.preventDefault();
|
|
443
|
-
// Read only the clipboard data
|
|
444
|
-
const text = event.clipboardData?.getData("text") || "";
|
|
445
|
-
// Insert it manually at cursor if you want
|
|
446
|
-
const start = target.selectionStart;
|
|
447
|
-
const end = target.selectionEnd;
|
|
448
|
-
const newValue = target.value.slice(0, start) + text + target.value.slice(end);
|
|
449
|
-
target.value = newValue;
|
|
450
|
-
// Reset cursor position
|
|
451
|
-
target.setSelectionRange(start + text.length, start + text.length);
|
|
452
|
-
}
|
|
453
|
-
hideDigitalCardsOptions(option) {
|
|
454
|
-
return (this.disableCardValue && option.type === DisplayType.DIGITAL_CARD_VALUE && !salla.url.is_page("cart"));
|
|
455
|
-
}
|
|
456
|
-
render() {
|
|
457
|
-
if (this.optionsData?.length === 0) {
|
|
458
|
-
return;
|
|
459
|
-
}
|
|
460
|
-
return (h(Host, { class: "s-product-options-wrapper" }, h("salla-conditional-fields", null, this.optionsData.map((option) => 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' ?
|
|
461
|
-
this.splitterOption()
|
|
462
|
-
: 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}` }, h("label", { htmlFor: `options[${option.id}]`, class: `s-product-options-option-label ${this.hideLabel(option) ? 's-product-options-option-label-hidden' : ''}` }, h("b", null, option.name, option.required && h("span", null, " * "), " "), h("small", null, option.placeholder)), 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))))))));
|
|
463
|
-
}
|
|
464
|
-
generateUniqueKey(defaultValue) {
|
|
465
|
-
return this.uniqueKey ? `${defaultValue}-${this.uniqueKey}` : defaultValue;
|
|
466
|
-
}
|
|
467
|
-
fillSelectedOptions() {
|
|
468
|
-
this.selectedOptions = this.optionsData.reduce((acc, opt) => {
|
|
469
|
-
const selectedDetails = opt.details.filter(detail => detail.is_selected);
|
|
470
|
-
const mappedDetails = selectedDetails.map(detail => ({
|
|
471
|
-
...detail,
|
|
472
|
-
option_id: opt.id
|
|
473
|
-
}));
|
|
474
|
-
return acc.concat(mappedDetails);
|
|
475
|
-
}, []);
|
|
476
|
-
}
|
|
477
|
-
componentDidLoad() {
|
|
478
|
-
if (this.optionsData?.length === 0 && !this.optionsData.some(option => option.type === DisplayType.DONATION)) {
|
|
479
|
-
return;
|
|
480
|
-
}
|
|
481
|
-
const selectedDonationOption = this.optionsData.find(option => option.type === DisplayType.DONATION)?.details.find(detail => detail.is_selected);
|
|
482
|
-
if (!selectedDonationOption) {
|
|
483
|
-
return;
|
|
484
|
-
}
|
|
485
|
-
setTimeout(() => {
|
|
486
|
-
salla.event.emit('product-options::donation-changed', {
|
|
487
|
-
id: this.productId,
|
|
488
|
-
price: selectedDonationOption.additional_price
|
|
489
|
-
});
|
|
490
|
-
}, 1000);
|
|
491
|
-
}
|
|
492
|
-
/**
|
|
493
|
-
* Enable user-initiated validation mode so invalid fields will scroll into view
|
|
494
|
-
*/
|
|
495
|
-
async enableUserInitiatedValidation() {
|
|
496
|
-
this.userInitiatedValidation = true;
|
|
497
|
-
}
|
|
498
|
-
/**
|
|
499
|
-
* Validate options and trigger scrolling to the first invalid option if any
|
|
500
|
-
*/
|
|
501
|
-
async validateAndScroll() {
|
|
502
|
-
await this.enableUserInitiatedValidation();
|
|
503
|
-
return this.reportValidity();
|
|
504
|
-
}
|
|
505
|
-
//@ts-ignore
|
|
506
|
-
donationOption(option, product) {
|
|
507
|
-
return h("div", { class: "s-product-options-donation-wrapper" }, option.donation?.can_donate ? [
|
|
508
|
-
option.donation ?
|
|
509
|
-
h("div", { key: option.id, class: "s-product-options-donation-progress" }, h("salla-progress-bar", { donation: option.donation }))
|
|
510
|
-
: '',
|
|
511
|
-
option.details.length ?
|
|
512
|
-
[h("h4", { key: option.id }, this.selectAmount), h("div", { key: option.id, class: "s-product-options-donation-options" }, option.details.map((detail, i) => h("div", { key: option.id, class: "s-product-options-donation-options-item" }, 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') }), h("label", { htmlFor: this.generateUniqueKey(`donation-option-${i}`) }, h("span", { innerHTML: salla.money(detail.name) })))), option.donation?.custom_amount_enabled ?
|
|
513
|
-
h("div", { class: "s-product-options-donation-options-item" }, h("input", { id: this.generateUniqueKey("donation-option-custom"), type: "radio", name: "donating_option", value: "custom", onChange: e => this.handleDonationOptions(e, 'custom', 'option') }), h("label", { htmlFor: this.generateUniqueKey("donation-option-custom") }, h("span", null, " ", this.selectDonationAmount, " ")))
|
|
514
|
-
: '')] : '',
|
|
515
|
-
h("div", { key: option.id, class: { "s-product-options-donation-input-group": true, "shown": !option.details.length || (option.details.length && this.isCustomDonation) } }, h("input", { type: "text", id: "donating-amount", name: "donation_amount", class: "s-form-control", ref: el => { this.donationInput = el; }, value: option.details.length
|
|
516
|
-
&& option.details.some(detail => detail.is_selected)
|
|
517
|
-
? option.details.find(detail => detail.is_selected).additional_price
|
|
518
|
-
: option.value,
|
|
519
|
-
// required
|
|
520
|
-
placeholder: option.placeholder, onInput: e => this.handleDonationOptions(e, 'custom', 'input'), onBlur: e => this.changedHandler(e, option), onInvalid: (e) => this.invalidHandler(e, option) }), h("span", { class: "s-product-options-donation-amount-currency" }, salla.config.currency(salla.config.get('user.currency_code')).symbol))
|
|
521
|
-
] :
|
|
522
|
-
this.getExpireDonationMessage(option));
|
|
523
|
-
}
|
|
524
|
-
fileUploader(option, additions = null) {
|
|
525
|
-
return 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 } }, h("div", { class: "s-product-options-filepond-placeholder" }, h("span", { class: "s-product-options-filepond-placeholder-icon", innerHTML: additions.accept?.split(',').every(type => type.includes('image'))
|
|
526
|
-
? CameraIcon
|
|
527
|
-
: FileIcon }), h("p", { class: "s-product-options-filepond-placeholder-text" }, salla.lang.get('common.uploader.drag_and_drop')), h("span", { class: "filepond--label-action" }, salla.lang.get('common.uploader.browse'))));
|
|
528
|
-
}
|
|
529
|
-
//@ts-ignore
|
|
530
|
-
imageOption(option) {
|
|
531
|
-
return this.fileUploader(option, { accept: 'image/png,image/jpeg,image/jpg,image/gif' });
|
|
532
|
-
}
|
|
533
|
-
//@ts-ignore
|
|
534
|
-
fileOption(option) {
|
|
535
|
-
const types = option.details.map(detail => this.fileTypes[detail.name]).filter(Boolean);
|
|
536
|
-
return types?.length
|
|
537
|
-
? this.fileUploader(option, { accept: types.join(',') })
|
|
538
|
-
: 'File types not selected.';
|
|
539
|
-
}
|
|
540
|
-
// TODO: (ONLY FOR TESTING!) find a better way to make it testable, e.g. wrap it with a unique class like textOption
|
|
541
|
-
//@ts-ignore
|
|
542
|
-
numberOption(option) {
|
|
543
|
-
return 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) });
|
|
544
|
-
}
|
|
545
|
-
//@ts-ignore
|
|
546
|
-
splitterOption() {
|
|
547
|
-
return h("div", { class: "s-product-options-splitter" });
|
|
548
|
-
}
|
|
549
|
-
//@ts-ignore
|
|
550
|
-
textOption(option) {
|
|
551
|
-
return h("div", { class: "s-product-options-text" }, 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) }));
|
|
552
|
-
}
|
|
553
|
-
//@ts-ignore
|
|
554
|
-
textareaOption(option) {
|
|
555
|
-
//todo::remove mt-1 class, and if it's okay to remove the tag itself will be great
|
|
556
|
-
return h("div", { class: "s-product-options-textarea" }, h("div", { class: "mt-1" }, 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) })));
|
|
557
|
-
}
|
|
558
|
-
//@ts-ignore
|
|
559
|
-
mapOption(option) {
|
|
560
|
-
return 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) });
|
|
561
|
-
}
|
|
562
|
-
colorPickerOption(option) {
|
|
563
|
-
return 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 });
|
|
564
|
-
}
|
|
565
|
-
/**
|
|
566
|
-
* ============= Date Time options =============
|
|
567
|
-
*/
|
|
568
|
-
//@ts-ignore
|
|
569
|
-
timeOption(option) {
|
|
570
|
-
return 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) });
|
|
571
|
-
}
|
|
572
|
-
//@ts-ignore
|
|
573
|
-
dateOption(option) {
|
|
574
|
-
//todo:: consider date-range @see https://github.com/SallaApp/theme-raed/blob/master/src/assets/js/partials/product-options.js#L8-L23
|
|
575
|
-
return h("div", { class: "s-product-options-date-element" }, 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) }));
|
|
576
|
-
}
|
|
577
|
-
//@ts-ignore
|
|
578
|
-
datetimeOption(option) {
|
|
579
|
-
//todo:: consider date-range @see https://github.com/SallaApp/theme-raed/blob/master/src/assets/js/partials/product-options.js#L8-L23
|
|
580
|
-
return h("div", { class: "s-product-options-datetime-element" }, 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) }));
|
|
581
|
-
}
|
|
582
|
-
/**
|
|
583
|
-
* ============= Advanced options =============
|
|
584
|
-
*/
|
|
585
|
-
getOptionDetailName(detail, outOfStock = true, optionType) {
|
|
586
|
-
let detailName;
|
|
587
|
-
if (optionType && optionType === DisplayType.COLOR) {
|
|
588
|
-
detailName = detail.name
|
|
589
|
-
+ ((outOfStock && this.isOptionDetailOut(detail) && !salla.url.is_page("cart")) && !this.hideOutLabel ? ` <br/> <p> ${this.outOfStockText} </p>` : '')
|
|
590
|
-
+ (detail.additional_price ? ` <p> (${salla.money(detail.additional_price, false)}) </p>` : '');
|
|
591
|
-
}
|
|
592
|
-
if (!detailName) {
|
|
593
|
-
detailName = detail.name
|
|
594
|
-
+ ((outOfStock && this.isOptionDetailOut(detail) && !salla.url.is_page("cart")) && !this.hideOutLabel ? ` - ${this.outOfStockText}` : '')
|
|
595
|
-
+ (detail.additional_price ? ` (${salla.money(detail.additional_price, false)})` : '');
|
|
596
|
-
}
|
|
597
|
-
//Some merchants adding price to the names of the options,
|
|
598
|
-
//and because we are using this inside select option, we need to replace the html currency symbol with the store currency symbol
|
|
599
|
-
return detailName.replace('<i class=sicon-sar></i>', salla.config.currency()?.symbol || 'ر.س');
|
|
600
|
-
}
|
|
601
|
-
isOptionDetailOut(detail) {
|
|
602
|
-
if (detail.is_out || !detail.skus_availability || !this.selectedSkus?.length) {
|
|
603
|
-
return detail.is_out;
|
|
604
|
-
}
|
|
605
|
-
const isDetailSelected = this.selectedOptions.filter(option => option.id === detail.id).length;
|
|
606
|
-
//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
|
|
607
|
-
if (isDetailSelected && this.selectedOptions.length === 1) {
|
|
608
|
-
return false;
|
|
609
|
-
}
|
|
610
|
-
//if current details has sku in the possible outSkus it's out for sure
|
|
611
|
-
if (isDetailSelected) {
|
|
612
|
-
//here we will get the possible outSkus for current selected options
|
|
613
|
-
const outSelectableSkus = this.selectedSkus.filter(sku => this.outSkus.includes(sku));
|
|
614
|
-
return Object.keys(detail.skus_availability).some(sku => outSelectableSkus.includes(Number(sku)));
|
|
615
|
-
}
|
|
616
|
-
return this.selectedOptions.some(option => option.is_out && option.option_id !== detail.option_id);
|
|
617
|
-
}
|
|
618
|
-
/**
|
|
619
|
-
* Renders a single input element (radio or checkbox) for an option detail.
|
|
620
|
-
* @param type - The type of input element ('radio' or 'checkbox').
|
|
621
|
-
* @param detail - The detail object representing an option detail.
|
|
622
|
-
* @param option - The parent option object containing the details.
|
|
623
|
-
* @param isRequired - Indicates if the input is required based on the option's rules.
|
|
624
|
-
* @param name - The name attribute for the input element.
|
|
625
|
-
* @returns HTMLElement - A labeled input element.
|
|
626
|
-
*/
|
|
627
|
-
renderInput(type, detail, option, isRequired, name, buttonStyle) {
|
|
628
|
-
const id = this.generateUniqueKey(`${type}-${option.id}-${detail.id}`);
|
|
629
|
-
const isDisabled = this.isOptionDetailOut(detail);
|
|
630
|
-
return (h("label", { class: {
|
|
631
|
-
"s-product-options-disabled": isDisabled,
|
|
632
|
-
} }, 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) }), h("div", { class: { "s-product-options-grid-mode-span": buttonStyle, "s-product-options-disabled": isDisabled } }, this.getOptionDetailName(detail))));
|
|
633
|
-
}
|
|
634
|
-
/**
|
|
635
|
-
* Renders a collection of input elements for all details of an option.
|
|
636
|
-
* @param type - The type of input elements ('radio' or 'checkbox').
|
|
637
|
-
* @param option - The parent option object containing the details.
|
|
638
|
-
* @param isRequired - Indicates if the inputs are required based on the option's rules.
|
|
639
|
-
* @returns HTMLElement[] - An array of labeled input elements.
|
|
640
|
-
*/
|
|
641
|
-
renderOptionDetails(type, option, isRequired, buttonStyle = false) {
|
|
642
|
-
const name = type === 'radio' ? `options[${option.id}]` : `options[${option.id}][]`;
|
|
643
|
-
return option?.details.map((detail) => this.renderInput(type, detail, option, isRequired, name, buttonStyle));
|
|
644
|
-
}
|
|
645
|
-
/**
|
|
646
|
-
* Renders a dropdown (select) element for a single-option selection.
|
|
647
|
-
* @param option - The parent option object.
|
|
648
|
-
* @returns HTMLElement - A select dropdown element with all option details.
|
|
649
|
-
*/
|
|
650
|
-
renderSelect(option) {
|
|
651
|
-
return (h("div", null, 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) }, h("option", { value: "" }, option.placeholder), option?.details.map((detail) => (h("option", { key: detail.id, value: detail.id, disabled: this.canDisabled && this.isOptionDetailOut(detail), selected: detail.is_selected }, this.getOptionDetailName(detail)))))));
|
|
652
|
-
}
|
|
653
|
-
/**
|
|
654
|
-
* Renders a grid-based layout for option inputs (radio or checkbox).
|
|
655
|
-
* @param type - The type of input elements ('radio' or 'checkbox').
|
|
656
|
-
* @param option - The parent option object containing the details.
|
|
657
|
-
* @param isRequired - Indicates if the inputs are required based on the option's rules.
|
|
658
|
-
* @returns HTMLElement - A grid-based container with input elements.
|
|
659
|
-
*/
|
|
660
|
-
renderButtonStyle(type, option, isRequired) {
|
|
661
|
-
return (h("div", { class: "s-product-options-grid-mode" }, this.renderOptionDetails(type, option, isRequired, true)));
|
|
662
|
-
}
|
|
663
|
-
/**
|
|
664
|
-
* Renders a single-option selection, either as a grid or dropdown, based on configuration.
|
|
665
|
-
* @param option - The parent option object.
|
|
666
|
-
* @returns HTMLElement - The rendered single-option element.
|
|
667
|
-
*/
|
|
668
|
-
singleOption(option) {
|
|
669
|
-
const buttonStyle = this.optionConfig?.['single-option']?.type === 'button';
|
|
670
|
-
const isRequired = !option.visibility_condition && option.required;
|
|
671
|
-
return buttonStyle
|
|
672
|
-
? this.renderButtonStyle('radio', option, isRequired)
|
|
673
|
-
: this.renderSelect(option);
|
|
674
|
-
}
|
|
675
|
-
/**
|
|
676
|
-
* Renders a multiple-option selection, either as a grid or list, based on configuration.
|
|
677
|
-
* @param option - The parent option object.
|
|
678
|
-
* @returns HTMLElement - The rendered multiple-option element.
|
|
679
|
-
*/
|
|
680
|
-
multipleOptions(option) {
|
|
681
|
-
const buttonStyle = this.optionConfig?.['multiple-option']?.type === 'button';
|
|
682
|
-
const isRequired = option.required &&
|
|
683
|
-
!option.details.some((detail) => detail.is_selected) &&
|
|
684
|
-
!option.visibility_condition;
|
|
685
|
-
return buttonStyle
|
|
686
|
-
? this.renderButtonStyle('checkbox', option, isRequired)
|
|
687
|
-
: (h("div", { class: {
|
|
688
|
-
's-product-options-multiple-options-wrapper': true,
|
|
689
|
-
required: option.required,
|
|
690
|
-
} }, this.renderOptionDetails('checkbox', option, isRequired)));
|
|
691
|
-
}
|
|
692
|
-
//@ts-ignore
|
|
693
|
-
colorOption(option) {
|
|
694
|
-
return (h("fieldset", { class: "s-product-options-colors-wrapper" }, option?.details.map((detail) => (h("div", { class: "s-product-options-colors-item", key: detail.id }, 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) }), h("label", { htmlFor: this.generateUniqueKey(`color-${this.productId}-${option.id}-${detail.id}`) }, h("span", { style: { backgroundColor: detail.color } }), h("div", { innerHTML: this.getOptionDetailName(detail, true, option.type) })))))));
|
|
695
|
-
}
|
|
696
|
-
//@ts-ignore
|
|
697
|
-
thumbnailOption(option) {
|
|
698
|
-
return h("div", { class: "s-product-options-thumbnails-wrapper" }, option.details.map((detail) => {
|
|
699
|
-
return h("div", { key: detail.id }, 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) }), h("label", { htmlFor: this.generateUniqueKey(`option_${this.productId}-${option.id}_${detail.id}`), "data-img-id": detail.option_value, class: "go-to-slide" }, h("img", { "data-src": detail.image, src: detail.image, title: detail.name, alt: detail.name }), h("span", { innerHTML: IconVerified, class: "s-product-options-thumbnails-icon" }), this.isOptionDetailOut(detail) ?
|
|
700
|
-
[
|
|
701
|
-
h("small", { key: detail.id, class: "s-product-options-thumbnails-stock-badge" }, this.outOfStockText),
|
|
702
|
-
this.canDisabled ? h("div", { key: detail.id, class: "s-product-options-thumbnails-badge-overlay" }) : '',
|
|
703
|
-
]
|
|
704
|
-
: ''), h("p", null, this.getOptionDetailName(detail, false), " "));
|
|
705
|
-
}));
|
|
706
|
-
}
|
|
707
|
-
// Digital card options
|
|
708
|
-
digitalCardValuesOption(option) {
|
|
709
|
-
return h("div", { class: "s-product-options-digital-card-wrapper" }, this.availableDigitalCardValues.length > 0 ? this.availableDigitalCardValues.map((detail) => {
|
|
710
|
-
const id = String(detail.id);
|
|
711
|
-
return h("label", { htmlFor: this.generateUniqueKey(id.toString()), key: id, class: "s-product-options-digital-card-option" }, 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 } : {}) }), h("span", null, detail.name, " ", salla.config?.currency()?.symbol));
|
|
712
|
-
})
|
|
713
|
-
: h("div", { class: "s-product-options-digital-card-out-of-stock" }));
|
|
714
|
-
}
|
|
715
|
-
countryOption(option) {
|
|
716
|
-
return h("div", { class: "s-product-options-digital-card-wrapper" }, option.details.map((detail) => {
|
|
717
|
-
return 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 } }, 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 } : {}) }), 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` }), h("span", null, detail.name));
|
|
718
|
-
}));
|
|
719
|
-
}
|
|
720
|
-
get host() { return this; }
|
|
721
|
-
static get style() { return sallaProductOptionsCss; }
|
|
722
|
-
}, [0, "salla-product-options", {
|
|
723
|
-
"productId": [2, "product-id"],
|
|
724
|
-
"options": [1],
|
|
725
|
-
"hideOutLabel": [1, "hide-out-label"],
|
|
726
|
-
"uniqueKey": [1, "unique-key"],
|
|
727
|
-
"config": [1],
|
|
728
|
-
"optionsData": [32],
|
|
729
|
-
"outOfStockText": [32],
|
|
730
|
-
"donationAmount": [32],
|
|
731
|
-
"selectDonationAmount": [32],
|
|
732
|
-
"selectAmount": [32],
|
|
733
|
-
"isCustomDonation": [32],
|
|
734
|
-
"selectedOptions": [32],
|
|
735
|
-
"canDisabled": [32],
|
|
736
|
-
"selectedSkus": [32],
|
|
737
|
-
"selectedOutSkus": [32],
|
|
738
|
-
"disableCardValue": [32],
|
|
739
|
-
"availableDigitalCardValues": [32],
|
|
740
|
-
"userInitiatedValidation": [32],
|
|
741
|
-
"setOptionsData": [64],
|
|
742
|
-
"getSelectedOptionsData": [64],
|
|
743
|
-
"reportValidity": [64],
|
|
744
|
-
"hasOutOfStockOption": [64],
|
|
745
|
-
"getSelectedOptions": [64],
|
|
746
|
-
"getOption": [64],
|
|
747
|
-
"enableUserInitiatedValidation": [64],
|
|
748
|
-
"validateAndScroll": [64]
|
|
749
|
-
}]);
|
|
750
|
-
function defineCustomElement$1() {
|
|
751
|
-
if (typeof customElements === "undefined") {
|
|
752
|
-
return;
|
|
753
|
-
}
|
|
754
|
-
const components = ["salla-product-options", "salla-booking-field", "salla-button", "salla-color-picker", "salla-conditional-fields", "salla-datetime-picker", "salla-file-upload", "salla-loading", "salla-map", "salla-modal", "salla-progress-bar"];
|
|
755
|
-
components.forEach(tagName => { switch (tagName) {
|
|
756
|
-
case "salla-product-options":
|
|
757
|
-
if (!customElements.get(tagName)) {
|
|
758
|
-
customElements.define(tagName, SallaProductOptions$1);
|
|
759
|
-
}
|
|
760
|
-
break;
|
|
761
|
-
case "salla-booking-field":
|
|
762
|
-
if (!customElements.get(tagName)) {
|
|
763
|
-
defineCustomElement$b();
|
|
764
|
-
}
|
|
765
|
-
break;
|
|
766
|
-
case "salla-button":
|
|
767
|
-
if (!customElements.get(tagName)) {
|
|
768
|
-
defineCustomElement$a();
|
|
769
|
-
}
|
|
770
|
-
break;
|
|
771
|
-
case "salla-color-picker":
|
|
772
|
-
if (!customElements.get(tagName)) {
|
|
773
|
-
defineCustomElement$9();
|
|
774
|
-
}
|
|
775
|
-
break;
|
|
776
|
-
case "salla-conditional-fields":
|
|
777
|
-
if (!customElements.get(tagName)) {
|
|
778
|
-
defineCustomElement$8();
|
|
779
|
-
}
|
|
780
|
-
break;
|
|
781
|
-
case "salla-datetime-picker":
|
|
782
|
-
if (!customElements.get(tagName)) {
|
|
783
|
-
defineCustomElement$7();
|
|
784
|
-
}
|
|
785
|
-
break;
|
|
786
|
-
case "salla-file-upload":
|
|
787
|
-
if (!customElements.get(tagName)) {
|
|
788
|
-
defineCustomElement$6();
|
|
789
|
-
}
|
|
790
|
-
break;
|
|
791
|
-
case "salla-loading":
|
|
792
|
-
if (!customElements.get(tagName)) {
|
|
793
|
-
defineCustomElement$5();
|
|
794
|
-
}
|
|
795
|
-
break;
|
|
796
|
-
case "salla-map":
|
|
797
|
-
if (!customElements.get(tagName)) {
|
|
798
|
-
defineCustomElement$4();
|
|
799
|
-
}
|
|
800
|
-
break;
|
|
801
|
-
case "salla-modal":
|
|
802
|
-
if (!customElements.get(tagName)) {
|
|
803
|
-
defineCustomElement$3();
|
|
804
|
-
}
|
|
805
|
-
break;
|
|
806
|
-
case "salla-progress-bar":
|
|
807
|
-
if (!customElements.get(tagName)) {
|
|
808
|
-
defineCustomElement$2();
|
|
809
|
-
}
|
|
810
|
-
break;
|
|
811
|
-
} });
|
|
812
|
-
}
|
|
813
|
-
defineCustomElement$1();
|
|
4
|
+
import { S as SallaProductOptions$1, d as defineCustomElement$1 } from './salla-product-options2.js';
|
|
814
5
|
|
|
815
6
|
const SallaProductOptions = SallaProductOptions$1;
|
|
816
7
|
const defineCustomElement = defineCustomElement$1;
|