@salla.sa/twilight-components 2.14.346 → 2.14.349
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-D3JT19b9.js → filepond-DFhbfTkt.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-vIqpi5Jb.js → filepond-plugin-file-poster-Dj4Zm459.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-CGka-OOR.js → filepond-plugin-file-validate-size-DsH6GzKJ.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-D5Xexu4N.js → filepond-plugin-file-validate-type-DfaEudMs.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-CIxcoEFX.js → filepond-plugin-image-edit-gz-CV83v.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-yRezDeUb.js → filepond-plugin-image-exif-orientation-DfkLjcpx.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-CPE8T2_S.js → filepond-plugin-image-preview-BxaEwNCI.js} +1 -1
- package/dist/cjs/{index-B_jylE1-.js → index-C9ymZIiv.js} +1 -1
- package/dist/cjs/{index-CBbHmJY_.js → index-DcTksD2K.js} +2 -2
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/salla-accordion_62.cjs.entry.js +10395 -1320
- 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-custom-fields.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-hook.cjs.entry.js +1 -1
- package/dist/cjs/salla-installment.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-program.cjs.entry.js +1 -1
- package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
- package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
- package/dist/cjs/salla-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -11
- package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-orders.cjs.entry.js +1 -1
- package/dist/cjs/salla-payments.cjs.entry.js +1 -1
- package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
- package/dist/cjs/salla-review-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-reviews-page.cjs.entry.js +1 -1
- package/dist/cjs/salla-reviews.cjs.entry.js +1 -1
- package/dist/cjs/salla-social.cjs.entry.js +1 -1
- package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
- package/dist/cjs/salla-verify.cjs.entry.js +1 -1
- package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
- package/dist/cjs/twilight.cjs.js +2 -2
- package/dist/cjs/vanilla-picker-BYDLZw1n.js +1045 -0
- package/dist/collection/components/salla-color-picker/salla-color-picker.js +67 -37
- package/dist/collection/components/salla-count-down/salla-count-down.js +125 -1
- package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-options-modal.js +4 -5
- package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-slider.js +1 -1
- package/dist/collection/components/salla-order-details/salla-order-details-multiple-bundle-product.js +0 -10
- package/dist/collection/components/salla-products-slider/salla-products-slider.js +3 -0
- package/dist/collection/components/salla-quick-buy/salla-quick-buy.js +68 -55
- package/dist/collection/components/salla-slider/salla-slider.css +691 -238
- package/dist/collection/components/salla-slider/salla-slider.js +96 -58
- package/dist/components/index.js +2 -2
- package/dist/components/salla-color-picker2.js +69 -1056
- package/dist/components/salla-count-down2.js +24 -2
- package/dist/components/salla-multiple-bundle-product-options-modal2.js +4 -5
- package/dist/components/salla-multiple-bundle-product-slider2.js +1 -1
- package/dist/components/salla-order-details-multiple-bundle-product2.js +0 -10
- package/dist/components/salla-products-slider2.js +3 -0
- package/dist/components/salla-quick-buy2.js +367 -139
- package/dist/components/salla-slider2.js +9881 -61
- package/dist/components/vanilla-picker.js +1043 -0
- package/dist/esm/{filepond-ESI025KA.js → filepond-DQR2YBu7.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-CWHjkl55.js → filepond-plugin-file-poster-XvYa1rlk.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-B7W5i7Mk.js → filepond-plugin-file-validate-size-BRBnctOE.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-B1Ny76Ep.js → filepond-plugin-file-validate-type-BuD6F1gi.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-DfqS6NSZ.js → filepond-plugin-image-edit-BJ8YnBRL.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-3kpdQNdB.js → filepond-plugin-image-exif-orientation-BGad_AoX.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-Ck91BQiY.js → filepond-plugin-image-preview-Cb6UzPfa.js} +1 -1
- package/dist/esm/{index-gdKTeC4S.js → index-Bhszo8cU.js} +2 -2
- package/dist/esm/{index-5xSCOnsp.js → index-DIfeuyTs.js} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/salla-accordion_62.entry.js +10395 -1320
- 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-custom-fields.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-hook.entry.js +1 -1
- package/dist/esm/salla-installment.entry.js +1 -1
- package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
- package/dist/esm/salla-loyalty-program.entry.js +1 -1
- package/dist/esm/salla-metadata.entry.js +1 -1
- package/dist/esm/salla-notification-item.entry.js +1 -1
- package/dist/esm/salla-notifications.entry.js +1 -1
- package/dist/esm/salla-offer.entry.js +1 -1
- package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -11
- package/dist/esm/salla-order-details-options.entry.js +1 -1
- package/dist/esm/salla-order-details.entry.js +1 -1
- package/dist/esm/salla-order-summary.entry.js +1 -1
- package/dist/esm/salla-order-totals-card.entry.js +1 -1
- package/dist/esm/salla-orders.entry.js +1 -1
- package/dist/esm/salla-payments.entry.js +1 -1
- package/dist/esm/salla-price-range.entry.js +1 -1
- package/dist/esm/salla-review-card.entry.js +1 -1
- package/dist/esm/salla-reviews-page.entry.js +1 -1
- package/dist/esm/salla-reviews.entry.js +1 -1
- package/dist/esm/salla-social.entry.js +1 -1
- package/dist/esm/salla-tiered-offer.entry.js +1 -1
- package/dist/esm/salla-tooltip.entry.js +1 -1
- package/dist/esm/salla-trust-badges.entry.js +1 -1
- package/dist/esm/salla-verify.entry.js +1 -1
- package/dist/esm/salla-wallet.entry.js +1 -1
- package/dist/esm/twilight.js +3 -3
- package/dist/esm/vanilla-picker-C4Kwbr5L.js +1043 -0
- package/dist/twilight/{p-936a76d1.entry.js → p-004be2ff.entry.js} +1 -1
- package/dist/twilight/{p-0a4b04a4.entry.js → p-0daa34c4.entry.js} +1 -1
- package/dist/twilight/{p-6bd166a7.entry.js → p-112e9574.entry.js} +1 -1
- package/dist/twilight/{p-369ada5a.entry.js → p-129e02c2.entry.js} +1 -1
- package/dist/twilight/{p-d5da6f45.entry.js → p-1bfef164.entry.js} +1 -1
- package/dist/twilight/{p-36a95a0f.entry.js → p-25f64b3e.entry.js} +1 -1
- package/dist/twilight/{p-8563e747.entry.js → p-307b5fa0.entry.js} +1 -1
- package/dist/twilight/{p-a7a488d5.entry.js → p-46fb77ce.entry.js} +1 -1
- package/dist/twilight/{p-b0e7c134.entry.js → p-48617181.entry.js} +1 -1
- package/dist/twilight/{p-4e98e961.entry.js → p-48df4495.entry.js} +1 -1
- package/dist/twilight/p-4fc33cee.entry.js +4 -0
- package/dist/twilight/{p-aefe5639.entry.js → p-55c9e7fe.entry.js} +1 -1
- package/dist/twilight/{p-5570cae4.entry.js → p-574bd55f.entry.js} +1 -1
- package/dist/twilight/{p-ef0fa205.entry.js → p-5bb9ace5.entry.js} +1 -1
- package/dist/twilight/{p-eab13555.entry.js → p-60747f3b.entry.js} +1 -1
- package/dist/twilight/{p-3e410acd.entry.js → p-6222b0fa.entry.js} +1 -1
- package/dist/twilight/{p-b8f7b4eb.entry.js → p-64c18854.entry.js} +1 -1
- package/dist/twilight/{p-e465a952.entry.js → p-66c5dcd3.entry.js} +1 -1
- package/dist/twilight/{p-343c8271.entry.js → p-7a706d50.entry.js} +1 -1
- package/dist/twilight/{p-ad2b2919.entry.js → p-911bbc7d.entry.js} +1 -1
- package/dist/twilight/{p-7b5906b8.entry.js → p-9f541d63.entry.js} +1 -1
- package/dist/twilight/{p-DId3Z42j.js → p-B-MyfVCv.js} +1 -1
- package/dist/twilight/{p-D3JRC8L6.js → p-BVmy-j16.js} +1 -1
- package/dist/twilight/{p-gdKTeC4S.js → p-Bhszo8cU.js} +1 -1
- package/dist/twilight/{p-CUtvZOiz.js → p-BvldZUSR.js} +1 -1
- package/dist/twilight/{p-CMYBgZIX.js → p-ByJhdNbq.js} +1 -1
- package/dist/twilight/{p-DH5ljldi.js → p-CmuTtBET.js} +1 -1
- package/dist/twilight/{p-EnsROQgl.js → p-CuNS5C_o.js} +2 -2
- package/dist/twilight/{p-DpJnHcvE.js → p-Cy9bcLMa.js} +1 -1
- package/dist/twilight/{p-rYLDeLaL.js → p-DAM1DKLB.js} +1 -1
- package/dist/twilight/p-NTgp-Syt.js +11 -0
- package/dist/twilight/{p-5099bc51.entry.js → p-a25fe3c1.entry.js} +1 -1
- package/dist/twilight/{p-49638a91.entry.js → p-a5df8334.entry.js} +1 -1
- package/dist/twilight/{p-46b242d9.entry.js → p-a6f250b8.entry.js} +1 -1
- package/dist/twilight/{p-ebd8dbf8.entry.js → p-ae93ed50.entry.js} +1 -1
- package/dist/twilight/{p-f64cd638.entry.js → p-af8daa75.entry.js} +1 -1
- package/dist/twilight/{p-8100a941.entry.js → p-b0abcc89.entry.js} +1 -1
- package/dist/twilight/{p-360a28b9.entry.js → p-b8a203c1.entry.js} +1 -1
- package/dist/twilight/p-cadbe7b6.entry.js +4 -0
- package/dist/twilight/{p-1037bca4.entry.js → p-cc43a1bd.entry.js} +1 -1
- package/dist/twilight/{p-db68f32e.entry.js → p-cc6238be.entry.js} +1 -1
- package/dist/twilight/{p-158398ff.entry.js → p-de290cc2.entry.js} +1 -1
- package/dist/twilight/{p-8a1aa61c.entry.js → p-ed0f40e2.entry.js} +1 -1
- package/dist/twilight/{p-003a77fe.entry.js → p-f3d3e11e.entry.js} +1 -1
- package/dist/twilight/{p-8418b725.entry.js → p-f4bf39fb.entry.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/components/salla-color-picker/interfaces.d.ts +9 -0
- package/dist/types/components/salla-color-picker/salla-color-picker.d.ts +4 -1
- package/dist/types/components/salla-count-down/salla-count-down.d.ts +22 -0
- package/dist/types/components/salla-order-details/salla-order-details-multiple-bundle-product.d.ts +0 -1
- package/dist/types/components/salla-products-slider/salla-products-slider.d.ts +1 -0
- package/dist/types/components/salla-quick-buy/salla-quick-buy.d.ts +2 -0
- package/dist/types/components/salla-slider/salla-slider.d.ts +12 -3
- package/dist/types/components.d.ts +48 -0
- package/package.json +6 -6
- package/dist/twilight/p-04e81b46.entry.js +0 -11
- package/dist/twilight/p-1445c077.entry.js +0 -4
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
4
|
import { h, Host } from "@stencil/core";
|
|
5
|
-
import Picker from "vanilla-picker";
|
|
6
5
|
import ArrowDown from "../../assets/svg/keyboard_arrow_down.svg";
|
|
7
6
|
export class SallaColorPicker {
|
|
8
7
|
constructor() {
|
|
8
|
+
/** Lazy-loaded to avoid bundling vanilla-picker (Babel polyfills) into main/hydrate bundle. */
|
|
9
|
+
this.picker = null;
|
|
10
|
+
this.pickerReady = null;
|
|
9
11
|
/**
|
|
10
12
|
* File input name for the native formData
|
|
11
13
|
*/
|
|
@@ -33,14 +35,18 @@ export class SallaColorPicker {
|
|
|
33
35
|
this.enableAlpha = false;
|
|
34
36
|
}
|
|
35
37
|
colorChangeHandler(color) {
|
|
36
|
-
this.colorInput
|
|
38
|
+
if (this.colorInput)
|
|
39
|
+
this.colorInput.value = color.hex;
|
|
37
40
|
this.colorChanged.emit(color);
|
|
38
41
|
}
|
|
39
|
-
submittedHandler(color) {
|
|
40
|
-
this.setColorValue(color.rgbaString, true);
|
|
41
|
-
this.canvas
|
|
42
|
-
|
|
43
|
-
this.colorInput
|
|
42
|
+
async submittedHandler(color) {
|
|
43
|
+
await this.setColorValue(color.rgbaString, true);
|
|
44
|
+
if (this.canvas)
|
|
45
|
+
this.canvas.style.backgroundColor = color.rgbString;
|
|
46
|
+
if (this.colorInput) {
|
|
47
|
+
this.colorInput.value = color.hex;
|
|
48
|
+
this.colorInput.dispatchEvent(new window.Event('change', { bubbles: true }));
|
|
49
|
+
}
|
|
44
50
|
this.submitted.emit(color);
|
|
45
51
|
}
|
|
46
52
|
popupOpenedHandler(color) {
|
|
@@ -51,6 +57,13 @@ export class SallaColorPicker {
|
|
|
51
57
|
this.popupClosed.emit(color);
|
|
52
58
|
}
|
|
53
59
|
/** Methods */
|
|
60
|
+
async ensurePicker() {
|
|
61
|
+
if (this.picker)
|
|
62
|
+
return this.picker;
|
|
63
|
+
if (this.pickerReady)
|
|
64
|
+
return await this.pickerReady;
|
|
65
|
+
throw new Error('Color picker not initialized');
|
|
66
|
+
}
|
|
54
67
|
/**
|
|
55
68
|
* Set the picker options.
|
|
56
69
|
*
|
|
@@ -58,7 +71,8 @@ export class SallaColorPicker {
|
|
|
58
71
|
* @param {Object} options
|
|
59
72
|
*/
|
|
60
73
|
async setPickerOption(options) {
|
|
61
|
-
this.
|
|
74
|
+
const picker = await this.ensurePicker();
|
|
75
|
+
picker.setOptions(options);
|
|
62
76
|
}
|
|
63
77
|
/**
|
|
64
78
|
* Move the popup to a different parent, optionally opening it at the same time.
|
|
@@ -70,7 +84,8 @@ export class SallaColorPicker {
|
|
|
70
84
|
* @param {boolean} openImmediately
|
|
71
85
|
*/
|
|
72
86
|
async movePopUp(options, openImmediately) {
|
|
73
|
-
this.
|
|
87
|
+
const picker = await this.ensurePicker();
|
|
88
|
+
picker.movePopup(options, openImmediately);
|
|
74
89
|
}
|
|
75
90
|
/**
|
|
76
91
|
* Set/initialize the picker's color.
|
|
@@ -82,25 +97,31 @@ export class SallaColorPicker {
|
|
|
82
97
|
* @param {boolean} triggerEvent
|
|
83
98
|
*/
|
|
84
99
|
async setColorValue(color, triggerEvent) {
|
|
85
|
-
this.
|
|
100
|
+
const picker = await this.ensurePicker();
|
|
101
|
+
picker.setColor(color, triggerEvent);
|
|
86
102
|
}
|
|
87
103
|
/**
|
|
88
104
|
* Show/open the picker.
|
|
89
105
|
*/
|
|
90
106
|
async openPicker() {
|
|
91
|
-
this.
|
|
107
|
+
const picker = await this.ensurePicker();
|
|
108
|
+
picker.show();
|
|
92
109
|
}
|
|
93
110
|
/**
|
|
94
111
|
* Close/Hide the picker.
|
|
95
112
|
*/
|
|
96
113
|
async closePicker() {
|
|
97
|
-
this.
|
|
114
|
+
const picker = await this.ensurePicker();
|
|
115
|
+
picker.hide();
|
|
98
116
|
}
|
|
99
117
|
/**
|
|
100
118
|
* Release all resources used by this picker instance.
|
|
101
119
|
*/
|
|
102
120
|
async destroyPicker() {
|
|
103
|
-
this.
|
|
121
|
+
const picker = await this.ensurePicker();
|
|
122
|
+
picker.destroy();
|
|
123
|
+
this.picker = null;
|
|
124
|
+
this.pickerReady = null;
|
|
104
125
|
}
|
|
105
126
|
componentWillLoad() {
|
|
106
127
|
salla.onReady(() => {
|
|
@@ -109,7 +130,10 @@ export class SallaColorPicker {
|
|
|
109
130
|
}
|
|
110
131
|
setPopInPosition() {
|
|
111
132
|
const popup = this.host.querySelector('.picker_wrapper');
|
|
112
|
-
const
|
|
133
|
+
const widgetEl = this.host.querySelector('.s-color-picker-widget');
|
|
134
|
+
if (!popup || !widgetEl)
|
|
135
|
+
return;
|
|
136
|
+
const widgetPosition = widgetEl.getBoundingClientRect();
|
|
113
137
|
const widgetToWindowEq = window.innerWidth / 2 - widgetPosition.width / 2;
|
|
114
138
|
const widgetInLeft = widgetToWindowEq > widgetPosition.x;
|
|
115
139
|
const widgetInRight = widgetToWindowEq < widgetPosition.x;
|
|
@@ -126,35 +150,41 @@ export class SallaColorPicker {
|
|
|
126
150
|
}
|
|
127
151
|
}
|
|
128
152
|
initColorPicker() {
|
|
129
|
-
this.
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
153
|
+
this.pickerReady = import('vanilla-picker').then((mod) => {
|
|
154
|
+
const Picker = mod.default;
|
|
155
|
+
const picker = new Picker({
|
|
156
|
+
parent: this.host,
|
|
157
|
+
color: this.color,
|
|
158
|
+
popup: 'bottom',
|
|
159
|
+
alpha: this.enableAlpha,
|
|
160
|
+
editor: this.showTextField,
|
|
161
|
+
editorFormat: this.format,
|
|
162
|
+
cancelButton: this.showCancelButton,
|
|
163
|
+
onChange: (color) => this.colorChangeHandler(color),
|
|
164
|
+
onDone: (color) => this.submittedHandler(color),
|
|
165
|
+
onOpen: (color) => this.popupOpenedHandler(color),
|
|
166
|
+
onClose: (color) => this.popupClosedHandler(color),
|
|
167
|
+
});
|
|
168
|
+
this.picker = picker;
|
|
169
|
+
return this.picker;
|
|
143
170
|
});
|
|
144
171
|
}
|
|
145
172
|
render() {
|
|
146
|
-
return (h(Host, { key: '
|
|
173
|
+
return (h(Host, { key: 'f6a001611bf20e8264346028c848490cf94c686a', class: "s-color-picker-main" }, h("slot", { key: '79648d165d81f200e064c8ef56a138f6b66757ed', name: "widget" }, h("div", { key: '95e7a8b7a92f5bb8f6f05b8cd39e6c91710e52a2', class: "s-color-picker-widget" }, h("div", { key: '24813d1de9a5834cfd37edf7affd4be94608f96c', class: "s-color-picker-widget-canvas", ref: dv => this.canvas = dv }), h("span", { key: '5f29f537140bc4b74431fc33229563cb1b7ce231', innerHTML: ArrowDown }))), h("input", { key: '188a9d7233388fca9a25cd5d319c0973448b07bc', class: "s-hidden", name: this.name, required: this.required, value: this.color, ref: color => this.colorInput = color })));
|
|
147
174
|
}
|
|
148
175
|
componentDidLoad() {
|
|
149
|
-
this.canvas
|
|
176
|
+
if (this.canvas)
|
|
177
|
+
this.canvas.style.backgroundColor = this.color;
|
|
150
178
|
this.initColorPicker();
|
|
151
|
-
this.colorInput
|
|
152
|
-
this.
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
this.colorInput.
|
|
156
|
-
|
|
157
|
-
|
|
179
|
+
if (this.colorInput) {
|
|
180
|
+
this.colorInput.addEventListener('invalid', (e) => {
|
|
181
|
+
this.invalidInput.emit(e);
|
|
182
|
+
});
|
|
183
|
+
this.colorInput.addEventListener('input', () => {
|
|
184
|
+
this.colorInput.setCustomValidity('');
|
|
185
|
+
this.colorInput.reportValidity();
|
|
186
|
+
});
|
|
187
|
+
}
|
|
158
188
|
}
|
|
159
189
|
static get is() { return "salla-color-picker"; }
|
|
160
190
|
static get originalStyleUrls() {
|
|
@@ -130,6 +130,16 @@ export class SallaCountDown {
|
|
|
130
130
|
this.normalizedPreOrder?.availability_date &&
|
|
131
131
|
this.renderPreOrderToBeAvailableOn(), this.renderPreOrderCountDown()));
|
|
132
132
|
}
|
|
133
|
+
renderPrefixText() {
|
|
134
|
+
if (!this.prefixText)
|
|
135
|
+
return null;
|
|
136
|
+
return h("span", { class: "s-count-down-prefix-text" }, this.prefixText);
|
|
137
|
+
}
|
|
138
|
+
renderButton() {
|
|
139
|
+
if (!this.withButton || !this.buttonText)
|
|
140
|
+
return null;
|
|
141
|
+
return h("salla-button", { color: "primary", size: "medium", href: this.buttonHref }, this.buttonIcon ? h("i", { class: this.buttonIcon }) : null, h("span", null, this.buttonText));
|
|
142
|
+
}
|
|
133
143
|
renderContent() {
|
|
134
144
|
if (!this.date)
|
|
135
145
|
return null;
|
|
@@ -142,7 +152,7 @@ export class SallaCountDown {
|
|
|
142
152
|
return this.renderCountDown();
|
|
143
153
|
}
|
|
144
154
|
render() {
|
|
145
|
-
return (h(Host, { key: '
|
|
155
|
+
return (h(Host, { key: '11e7cf7cf77bbde82d990107b7ccda8f1fc9ad6f', class: `s-count-down-wrapper ${this.preOrder && this.isValidDate(this.date) ? 's-count-down-pre-order' : ''} ${this.horizontal ? 's-count-down-horizontal' : ''} ${this.withButton ? 's-count-down-with-button' : ''}` }, this.renderPrefixText(), this.renderContent(), this.offerEnded && this.renderOfferEnded(), this.renderButton()));
|
|
146
156
|
}
|
|
147
157
|
static get is() { return "salla-count-down"; }
|
|
148
158
|
static get originalStyleUrls() {
|
|
@@ -200,6 +210,120 @@ export class SallaCountDown {
|
|
|
200
210
|
"setter": false,
|
|
201
211
|
"reflect": false
|
|
202
212
|
},
|
|
213
|
+
"horizontal": {
|
|
214
|
+
"type": "boolean",
|
|
215
|
+
"attribute": "horizontal",
|
|
216
|
+
"mutable": false,
|
|
217
|
+
"complexType": {
|
|
218
|
+
"original": "boolean",
|
|
219
|
+
"resolved": "boolean",
|
|
220
|
+
"references": {}
|
|
221
|
+
},
|
|
222
|
+
"required": false,
|
|
223
|
+
"optional": true,
|
|
224
|
+
"docs": {
|
|
225
|
+
"tags": [],
|
|
226
|
+
"text": "If true, applies compact horizontal layout"
|
|
227
|
+
},
|
|
228
|
+
"getter": false,
|
|
229
|
+
"setter": false,
|
|
230
|
+
"reflect": false
|
|
231
|
+
},
|
|
232
|
+
"withButton": {
|
|
233
|
+
"type": "boolean",
|
|
234
|
+
"attribute": "with-button",
|
|
235
|
+
"mutable": false,
|
|
236
|
+
"complexType": {
|
|
237
|
+
"original": "boolean",
|
|
238
|
+
"resolved": "boolean",
|
|
239
|
+
"references": {}
|
|
240
|
+
},
|
|
241
|
+
"required": false,
|
|
242
|
+
"optional": true,
|
|
243
|
+
"docs": {
|
|
244
|
+
"tags": [],
|
|
245
|
+
"text": "If true, renders a slot for an action button alongside the countdown"
|
|
246
|
+
},
|
|
247
|
+
"getter": false,
|
|
248
|
+
"setter": false,
|
|
249
|
+
"reflect": false
|
|
250
|
+
},
|
|
251
|
+
"prefixText": {
|
|
252
|
+
"type": "string",
|
|
253
|
+
"attribute": "prefix-text",
|
|
254
|
+
"mutable": false,
|
|
255
|
+
"complexType": {
|
|
256
|
+
"original": "string",
|
|
257
|
+
"resolved": "string",
|
|
258
|
+
"references": {}
|
|
259
|
+
},
|
|
260
|
+
"required": false,
|
|
261
|
+
"optional": true,
|
|
262
|
+
"docs": {
|
|
263
|
+
"tags": [],
|
|
264
|
+
"text": "The prefix text to show before the countdown"
|
|
265
|
+
},
|
|
266
|
+
"getter": false,
|
|
267
|
+
"setter": false,
|
|
268
|
+
"reflect": false
|
|
269
|
+
},
|
|
270
|
+
"buttonHref": {
|
|
271
|
+
"type": "string",
|
|
272
|
+
"attribute": "button-href",
|
|
273
|
+
"mutable": false,
|
|
274
|
+
"complexType": {
|
|
275
|
+
"original": "string",
|
|
276
|
+
"resolved": "string",
|
|
277
|
+
"references": {}
|
|
278
|
+
},
|
|
279
|
+
"required": false,
|
|
280
|
+
"optional": true,
|
|
281
|
+
"docs": {
|
|
282
|
+
"tags": [],
|
|
283
|
+
"text": "The button href to show with the countdown"
|
|
284
|
+
},
|
|
285
|
+
"getter": false,
|
|
286
|
+
"setter": false,
|
|
287
|
+
"reflect": false
|
|
288
|
+
},
|
|
289
|
+
"buttonText": {
|
|
290
|
+
"type": "string",
|
|
291
|
+
"attribute": "button-text",
|
|
292
|
+
"mutable": false,
|
|
293
|
+
"complexType": {
|
|
294
|
+
"original": "string",
|
|
295
|
+
"resolved": "string",
|
|
296
|
+
"references": {}
|
|
297
|
+
},
|
|
298
|
+
"required": false,
|
|
299
|
+
"optional": true,
|
|
300
|
+
"docs": {
|
|
301
|
+
"tags": [],
|
|
302
|
+
"text": "The button text to show with the countdown"
|
|
303
|
+
},
|
|
304
|
+
"getter": false,
|
|
305
|
+
"setter": false,
|
|
306
|
+
"reflect": false
|
|
307
|
+
},
|
|
308
|
+
"buttonIcon": {
|
|
309
|
+
"type": "string",
|
|
310
|
+
"attribute": "button-icon",
|
|
311
|
+
"mutable": false,
|
|
312
|
+
"complexType": {
|
|
313
|
+
"original": "string",
|
|
314
|
+
"resolved": "string",
|
|
315
|
+
"references": {}
|
|
316
|
+
},
|
|
317
|
+
"required": false,
|
|
318
|
+
"optional": true,
|
|
319
|
+
"docs": {
|
|
320
|
+
"tags": [],
|
|
321
|
+
"text": "The button icon to show with the countdown"
|
|
322
|
+
},
|
|
323
|
+
"getter": false,
|
|
324
|
+
"setter": false,
|
|
325
|
+
"reflect": false
|
|
326
|
+
},
|
|
203
327
|
"boxed": {
|
|
204
328
|
"type": "boolean",
|
|
205
329
|
"attribute": "boxed",
|
|
@@ -455,22 +455,21 @@ export class SallaMultipleBundleProductOptionsModal {
|
|
|
455
455
|
const cacheKey = this.generateCacheKey(this.sectionId, this.productIndex, productId);
|
|
456
456
|
const resetToken = this.optionsResetTokens[cacheKey] || 0;
|
|
457
457
|
const isDisabled = this.isLoading || optionsWithSelectedState.some(opt => opt.details.some(d => d.is_selected && d.is_out === true));
|
|
458
|
-
return (h(Host, { key: '28786c060499c9bfbacf025b75f21d0e8a2d6ab1' }, h("salla-modal", { key: '6322c0542ca2769f50ed6fc616c6d5c72d456c9c', isLoading: this.isLoading, ref: el => (this.modal = el), width: "md", centered: false, id: `s-multiple-bundle-product-options-modal-options-${productId}`, class: "s-multiple-bundle-product-options-modal-wrapper" }, h("div", { key: '812707c4108b5bdefa97e1ff7537998083e2403b', slot: "loading" }, h("salla-skeleton", { key: 'e82b875495873b66414ee4a75d845823373b4914', height: "100%", width: "100%" })), this.product?.images && this.product?.images.length > 0 && (h("salla-slider", { key: '
|
|
458
|
+
return (h(Host, { key: '28786c060499c9bfbacf025b75f21d0e8a2d6ab1' }, h("salla-modal", { key: '6322c0542ca2769f50ed6fc616c6d5c72d456c9c', isLoading: this.isLoading, ref: el => (this.modal = el), width: "md", centered: false, id: `s-multiple-bundle-product-options-modal-options-${productId}`, class: "s-multiple-bundle-product-options-modal-wrapper" }, h("div", { key: '812707c4108b5bdefa97e1ff7537998083e2403b', slot: "loading" }, h("salla-skeleton", { key: 'e82b875495873b66414ee4a75d845823373b4914', height: "100%", width: "100%" })), this.product?.images && this.product?.images.length > 0 && (h("salla-slider", { key: 'f1f3545637b182257f9107972a819ae9819de137', id: `details-slider-${this.product?.id}`, type: "thumbs", loop: false, "auto-height": true, "listen-to-thumbnails-option": true, showThumbsControls: false, controlsOuter: false, showControls: false, class: "s-multiple-bundle-product-options-modal-slider", verticalThumbs: true, thumbsConfig: {
|
|
459
459
|
centeredSlides: true,
|
|
460
460
|
centeredSlidesBounds: true,
|
|
461
461
|
slidesPerView: Math.min(5, Math.max(1, this.product?.images.length)),
|
|
462
462
|
watchOverflow: true,
|
|
463
|
-
watchSlidesVisibility: true,
|
|
464
463
|
watchSlidesProgress: true,
|
|
465
464
|
direction: 'vertical',
|
|
466
465
|
spaceBetween: 10,
|
|
467
|
-
} }, h("div", { key: '
|
|
466
|
+
} }, h("div", { key: '97b50195903a01376e057bc99ddb353fd3dfdb2b', slot: "items" }, this.product?.images &&
|
|
468
467
|
this.product?.images.map((image, index) => (h("div", { key: index, class: "swiper-slide" }, h("img", { src: image.url, alt: image.alt || `${this.product?.name} - Image ${index + 1}`, loading: "lazy", onError: e => {
|
|
469
468
|
e.target.style.display = 'none';
|
|
470
|
-
} }))))), this.product?.images && this.product?.images.length > 1 && (h("div", { key: '
|
|
469
|
+
} }))))), this.product?.images && this.product?.images.length > 1 && (h("div", { key: 'ff943c9c8f175ff1c0374a13153b33889c468dda', slot: "thumbs" }, this.product?.images &&
|
|
471
470
|
this.product?.images.map((image, index) => (h("div", { key: index, "data-caption": `${this.product?.name} - Image ${index + 1}` }, h("img", { src: image.url, loading: "eager", class: "s-multiple-bundle-product-options-modal-slider-thumb", title: `${this.product?.name} - ${index + 1}`, alt: image.alt || `${this.product?.name} - ${index + 1}`, onError: e => {
|
|
472
471
|
e.target.style.display = 'none';
|
|
473
|
-
} })))))))), h("salla-product-options", { options: JSON.stringify(optionsWithSelectedState), key: `${cacheKey}-reset-${resetToken}`, "product-id": productId, "unique-key": `${cacheKey}-reset-${resetToken}` }), h("div", { key: '
|
|
472
|
+
} })))))))), h("salla-product-options", { options: JSON.stringify(optionsWithSelectedState), key: `${cacheKey}-reset-${resetToken}`, "product-id": productId, "unique-key": `${cacheKey}-reset-${resetToken}` }), h("div", { key: '7555836d26018f6405bc54a1cd735b4030d4bdf1', slot: "footer" }, h("div", { key: 'a7ee5f19a4c11a1c61e4dc026fa8673e0ab74c3f', class: "s-multiple-bundle-product-options-modal-footer" }, h("salla-button", { key: '1da19964053766f3a1339ea0e77ab7aaa4d8a003', onClick: e => this.onSave(e), loading: this.isLoading, disabled: isDisabled }, this.isLoading
|
|
474
473
|
? salla.lang.get('common.elements.saving')
|
|
475
474
|
: salla.lang.get('common.elements.save')))))));
|
|
476
475
|
}
|
|
@@ -97,7 +97,7 @@ export class SallaMultipleBundleProductSlider {
|
|
|
97
97
|
: KeyBoardArrowRightIcon;
|
|
98
98
|
return (h("div", { class: `s-multiple-bundle-product-slide-one-third ${product.quantity == 0
|
|
99
99
|
? 's-multiple-bundle-product-slide-one-third-disabled'
|
|
100
|
-
: ''}`, key: product.id }, h("div", { class: "s-multiple-bundle-product-card" }, h("div", { class: "s-multiple-bundle-product-image-wrapper", onClick: () => this.handleProductClick(product, productIndex) }, h("input", { id: this.generateEventName(this.section.id, productIndex), type: "checkbox", class: "s-multiple-bundle-product-checkbox", checked: isChecked, name: this.generateEventName(this.section.id, productIndex), value: product.id }), h("img", { src: product.image.url || salla.url.cdn('images/s-empty.png'), loading: "lazy", alt: product.image.alt || product.name, class: "s-multiple-bundle-product-image" })), h("div", { class: "s-multiple-bundle-product-content-wrapper" }, h("div", { class: "s-multiple-bundle-product-content" }, h("div", { class: "s-multiple-bundle-product-details" }, h("div", { class: "s-multiple-bundle-product-title-wrapper" }, h("h2", { class: "s-multiple-bundle-product-title" }, h("a", { href: product?.url || '#', target: "_blank", rel: "noopener noreferrer" }, product.name))), h("div", { class: "s-multiple-bundle-product-price-wrapper" }, h("span", { class: "s-multiple-bundle-product-price" }, h("span", { innerHTML: salla.money(product.price) })), product.sale_price > 0 && (h("span", { class: "s-multiple-bundle-product-price-discount" }, h("span", { innerHTML: salla.money(product.
|
|
100
|
+
: ''}`, key: product.id }, h("div", { class: "s-multiple-bundle-product-card" }, h("div", { class: "s-multiple-bundle-product-image-wrapper", onClick: () => this.handleProductClick(product, productIndex) }, h("input", { id: this.generateEventName(this.section.id, productIndex), type: "checkbox", class: "s-multiple-bundle-product-checkbox", checked: isChecked, name: this.generateEventName(this.section.id, productIndex), value: product.id }), h("img", { src: product.image.url || salla.url.cdn('images/s-empty.png'), loading: "lazy", alt: product.image.alt || product.name, class: "s-multiple-bundle-product-image" })), h("div", { class: "s-multiple-bundle-product-content-wrapper" }, h("div", { class: "s-multiple-bundle-product-content" }, h("div", { class: "s-multiple-bundle-product-details" }, h("div", { class: "s-multiple-bundle-product-title-wrapper" }, h("h2", { class: "s-multiple-bundle-product-title" }, h("a", { href: product?.url || '#', target: "_blank", rel: "noopener noreferrer" }, product.name))), h("div", { class: "s-multiple-bundle-product-price-wrapper" }, h("span", { class: "s-multiple-bundle-product-price" }, h("span", { innerHTML: salla.money(product.price) })), product.sale_price > 0 && (h("span", { class: "s-multiple-bundle-product-price-discount" }, h("span", { innerHTML: salla.money(product.regular_price) }))))), product.quantity_in_group > 0 && product.quantity !== 0 && (h("span", { class: "s-multiple-bundle-product-badge" }, salla.lang.get('pages.products.pieces'), h("span", null, product.quantity_in_group))), product.quantity === 0 && (h("span", { class: "s-multiple-bundle-product-badge" }, salla.lang.get('pages.products.quantity_in_group_finished')))), product.options?.length > 0 && (h("button", { class: "s-multiple-bundle-product-button", onClick: () => this.handleOptionsClick(product), type: "button" }, optionsButtonLabel, h("span", { class: "s-multiple-bundle-product-button-icon", innerHTML: optionsArrowIcon })))))));
|
|
101
101
|
})))));
|
|
102
102
|
}
|
|
103
103
|
static get is() { return "salla-multiple-bundle-product-slider"; }
|
|
@@ -40,16 +40,6 @@ export class SallaproductDetailsMultipleBundleProduct {
|
|
|
40
40
|
}
|
|
41
41
|
return this.productDetails?.options?.length > 0;
|
|
42
42
|
}
|
|
43
|
-
renderProductPrice() {
|
|
44
|
-
if (!this.productDetails) {
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
const { is_on_sale, sale_price, regular_price, price } = this.productDetails;
|
|
48
|
-
if (is_on_sale && sale_price) {
|
|
49
|
-
return (h("div", null, h("span", { class: "s-order-details-product-price s-order-details-product-price-sale" }, h("span", { innerHTML: salla.money(sale_price) })), regular_price && (h("span", { class: "s-order-details-product-regular-price" }, h("span", { innerHTML: salla.money(regular_price) })))));
|
|
50
|
-
}
|
|
51
|
-
return (h("span", { class: "s-order-details-product-price" }, h("span", { innerHTML: salla.money(price) })));
|
|
52
|
-
}
|
|
53
43
|
renderOptions() {
|
|
54
44
|
if (!this.productDetails?.options?.length) {
|
|
55
45
|
return null;
|
|
@@ -63,6 +63,9 @@ export class SallaProductsSlider {
|
|
|
63
63
|
}
|
|
64
64
|
}, 1000);
|
|
65
65
|
}
|
|
66
|
+
async componentDidLoad() {
|
|
67
|
+
await Salla.hooks.registerComponent('salla-products-slider', this);
|
|
68
|
+
}
|
|
66
69
|
isSourceWithoutValue() {
|
|
67
70
|
return ['offers', 'latest', 'sales', 'top-rated'].includes(this.getSource());
|
|
68
71
|
}
|
|
@@ -25,7 +25,8 @@ export class SallaQuickBuy {
|
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
async quickBuyHandler() {
|
|
28
|
-
|
|
28
|
+
// user guest and guest-checkout not enabled
|
|
29
|
+
if (salla.config.isGuest() && !this.isGuestCheckout()) {
|
|
29
30
|
this.requireLogin.emit({ productId: this.productId });
|
|
30
31
|
// todo (low) :: find a way to re-fire the method after success
|
|
31
32
|
let afterLoginEvent = "salla-quick-buy::user.logged-in";
|
|
@@ -63,7 +64,7 @@ export class SallaQuickBuy {
|
|
|
63
64
|
salla.event.dispatch('payments::apple-pay.start-transaction', {
|
|
64
65
|
amount: this.amount, // 1000
|
|
65
66
|
currency: this.currency || 'SAR', // SAR
|
|
66
|
-
requiredShippingContactFields: this.
|
|
67
|
+
requiredShippingContactFields: this.getRequiredShippingContactFields(),
|
|
67
68
|
shippingMethods: this.isRequireShipping ? [] : undefined,
|
|
68
69
|
supportedNetworks: salla.config.get('store.settings.buy_now.networks'),
|
|
69
70
|
supportedCountries: salla.config.get('store.settings.buy_now.countries'),
|
|
@@ -114,7 +115,10 @@ export class SallaQuickBuy {
|
|
|
114
115
|
shippingContactSelected: this.isRequireShipping ? {
|
|
115
116
|
url: salla.url.get('checkout/{id}/address/add'),
|
|
116
117
|
} : undefined,
|
|
117
|
-
|
|
118
|
+
guestContactSelected: this.isGuestCheckout() ? {
|
|
119
|
+
url: salla.url.get('checkout/{id}/customer'),
|
|
120
|
+
} : undefined,
|
|
121
|
+
onCouponCodeChanged: {
|
|
118
122
|
url: salla.url.get('checkout/{id}/coupons')
|
|
119
123
|
},
|
|
120
124
|
recalculateTotal: {
|
|
@@ -126,70 +130,79 @@ export class SallaQuickBuy {
|
|
|
126
130
|
}
|
|
127
131
|
});
|
|
128
132
|
}
|
|
133
|
+
isGuestCheckout() {
|
|
134
|
+
return salla.config.isGuest() && salla.config.get('store.features').includes('guest-checkout');
|
|
135
|
+
}
|
|
136
|
+
getRequiredShippingContactFields() {
|
|
137
|
+
let fields = [];
|
|
138
|
+
if (this.isRequireShipping) {
|
|
139
|
+
fields.push('postalAddress');
|
|
140
|
+
}
|
|
141
|
+
if (this.isGuestCheckout()) {
|
|
142
|
+
fields.push('email', 'phone', 'name');
|
|
143
|
+
}
|
|
144
|
+
return fields;
|
|
145
|
+
}
|
|
129
146
|
componentWillLoad() {
|
|
130
147
|
console.log('🍏 Pay: Quick Buy Component Loaded');
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
this.isApplePayActive = salla.helpers.hasApplePay()
|
|
171
|
-
&& salla.config.get('store.settings.payments')?.includes('apple_pay')
|
|
172
|
-
&& salla.config.get('store.settings.is_salla_gateway', false);
|
|
173
|
-
let applePaySdk = document.getElementById('apple-pay-sdk');
|
|
174
|
-
if (applePaySdk || !this.isApplePayActive) {
|
|
175
|
-
salla.logger.warn('🍏 Pay: Skipped load apple pay because ' + (applePaySdk ? 'already loaded' : 'is not available in the browser'));
|
|
176
|
-
resolve(true);
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
148
|
+
const canMakePayments = typeof window !== 'undefined' && !!window.ApplePaySession?.canMakePayments?.();
|
|
149
|
+
const storeHasApplePay = salla?.config?.get?.('store.settings.payments')?.includes?.('apple_pay') ?? true;
|
|
150
|
+
const isSallaGateway = salla?.config?.get?.('store.settings.is_salla_gateway', false) ?? true;
|
|
151
|
+
this.isApplePayActive = canMakePayments && storeHasApplePay && isSallaGateway;
|
|
152
|
+
const runInit = async () => {
|
|
153
|
+
if (!this.currency && salla?.config?.get) {
|
|
154
|
+
this.currency = salla.config.get('store.settings.buy_now.multi_currency') ? salla.config.get('user.currency_code') : 'SAR';
|
|
155
|
+
}
|
|
156
|
+
if (!this.productId && salla?.config?.get && salla.url?.is_page) {
|
|
157
|
+
this.productId = salla.config.get('page.id');
|
|
158
|
+
}
|
|
159
|
+
if (!this.applePayOnly && !this.productId) {
|
|
160
|
+
salla?.logger?.warn?.('🍏 Pay: Failed load the quick buy, the product id is missing');
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
if ((!this.amount || !this.isRequireShipping) && this.productId && salla?.product?.getDetails) {
|
|
164
|
+
await salla.product.getDetails(this.productId, []).then((response) => {
|
|
165
|
+
this.amount = response.data.price;
|
|
166
|
+
this.isRequireShipping = response?.data?.is_require_shipping || false;
|
|
167
|
+
}).catch((error) => {
|
|
168
|
+
salla?.logger?.warn?.('🍏 Pay: Failed load the quick buy, get the product details failed: ', error);
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
if (this.type === 'donate' && salla?.event?.on) {
|
|
172
|
+
salla.event.on('product-options::donation-changed', (data) => {
|
|
173
|
+
if (String(data.id) !== String(this.productId))
|
|
174
|
+
return;
|
|
175
|
+
this.amount = data.price;
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
else if (salla?.url?.is_page?.('product.single') && salla?.product?.event?.onPriceUpdated) {
|
|
179
|
+
salla.product.event.onPriceUpdated(response => { this.amount = response.data.price; });
|
|
180
|
+
}
|
|
181
|
+
this.isApplePayActive = (salla?.helpers?.hasApplePay?.() ?? canMakePayments)
|
|
182
|
+
&& (salla?.config?.get?.('store.settings.payments')?.includes?.('apple_pay') ?? storeHasApplePay)
|
|
183
|
+
&& (salla?.config?.get?.('store.settings.is_salla_gateway', false) ?? isSallaGateway);
|
|
184
|
+
if (!document.getElementById('apple-pay-sdk') && this.isApplePayActive) {
|
|
179
185
|
const script = document.createElement('script');
|
|
180
186
|
script.src = 'https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js';
|
|
181
187
|
script.setAttribute('id', 'apple-pay-sdk');
|
|
182
188
|
script.async = true;
|
|
183
189
|
document.body.appendChild(script);
|
|
184
|
-
|
|
185
|
-
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
return new Promise((resolve) => {
|
|
193
|
+
if (typeof salla?.onReady === 'function') {
|
|
194
|
+
salla.onReady(() => runInit().then(() => resolve(true)));
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
runInit().then(() => resolve(true));
|
|
198
|
+
}
|
|
186
199
|
});
|
|
187
200
|
}
|
|
188
201
|
render() {
|
|
189
|
-
return h(Host, { key: '
|
|
202
|
+
return h(Host, { key: '9a36fa6b7163dae6feed474712e3d0c3003d012c' }, this.quickBuyButton());
|
|
190
203
|
}
|
|
191
204
|
quickBuyButton() {
|
|
192
|
-
return h("apple-pay-button", { locale: salla
|
|
205
|
+
return h("apple-pay-button", { locale: salla?.config?.get?.('user.language_code') || 'ar', onClick: () => this.quickBuyHandler(), "data-quick-purchase": "applepay", class: "s-quick-buy-apple-pay", "data-is-applepay": "1", buttonstyle: "black", type: this.type });
|
|
193
206
|
}
|
|
194
207
|
static get is() { return "salla-quick-buy"; }
|
|
195
208
|
static get originalStyleUrls() {
|