@salla.sa/twilight-components 2.14.348 → 2.14.350
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-plugin-file-poster-CStjlaHV.js → filepond-plugin-file-poster-DUgrMVOZ.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-DrcM89vc.js → filepond-plugin-file-validate-size-C14LEY_l.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-DnIoL6mq.js → filepond-plugin-file-validate-type-AbHwQAHY.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-DLV0U0gb.js → filepond-plugin-image-edit-5ydXOhOa.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-tPl3p3z_.js → filepond-plugin-image-exif-orientation-D0oIUOy-.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-WTfIQM6C.js → filepond-plugin-image-preview-Bf_VUYwr.js} +1 -1
- package/dist/cjs/{filepond-B_sfbQx7.js → filepond-qUaAgMcd.js} +1 -1
- package/dist/cjs/{index-CkpcUCU5.js → index-BRdJtc1o.js} +2 -2
- package/dist/cjs/{index-4jrFyN8u.js → index-DKEcPhG9.js} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/salla-accordion_62.cjs.entry.js +100 -28
- 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-BBejdpPH.js → vanilla-picker-CYHmsxIw.js} +1 -1
- package/dist/collection/components/salla-count-down/salla-count-down.js +125 -1
- package/dist/collection/components/salla-order-details/salla-order-details-multiple-bundle-product.js +0 -10
- package/dist/collection/components/salla-product-options/salla-product-options.js +44 -10
- package/dist/collection/components/salla-slider/salla-slider.css +4 -0
- package/dist/collection/components/salla-slider/salla-slider.js +35 -7
- package/dist/components/index.js +2 -2
- package/dist/components/salla-count-down2.js +24 -2
- package/dist/components/salla-order-details-multiple-bundle-product2.js +0 -10
- package/dist/components/salla-product-options2.js +44 -10
- package/dist/components/salla-slider2.js +36 -8
- package/dist/esm/{filepond-BBd4zIxi.js → filepond-DDOVDszb.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-Vvhvcuu3.js → filepond-plugin-file-poster-DK5QZAmf.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-NvdGUEr-.js → filepond-plugin-file-validate-size-BoUr1T-f.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-BwVZhOLd.js → filepond-plugin-file-validate-type-USfq-Egq.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-BOgZn2vW.js → filepond-plugin-image-edit-BzsOppMe.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-BmbDj4hl.js → filepond-plugin-image-exif-orientation-D2x3fkHF.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-CDsLWAPe.js → filepond-plugin-image-preview-CAbtIGaT.js} +1 -1
- package/dist/esm/{index-LmL2BolE.js → index-CkAdPgup.js} +2 -2
- package/dist/esm/{index-BhHl4h44.js → index-unlRcuKr.js} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/salla-accordion_62.entry.js +100 -28
- 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-nCA1ATQw.js → vanilla-picker-7Rdeecyw.js} +1 -1
- package/dist/twilight/{p-133f1a48.entry.js → p-0162ae20.entry.js} +1 -1
- package/dist/twilight/{p-388fb59e.entry.js → p-0587a19b.entry.js} +1 -1
- package/dist/twilight/{p-312c1af1.entry.js → p-0eb554c0.entry.js} +1 -1
- package/dist/twilight/{p-8c111815.entry.js → p-100f7787.entry.js} +1 -1
- package/dist/twilight/{p-45cd70b8.entry.js → p-17618bb7.entry.js} +1 -1
- package/dist/twilight/{p-2ed7cfba.entry.js → p-1d2131a2.entry.js} +1 -1
- package/dist/twilight/{p-3d69e45a.entry.js → p-25e36e28.entry.js} +1 -1
- package/dist/twilight/{p-07add349.entry.js → p-478033b6.entry.js} +1 -1
- package/dist/twilight/{p-6c648552.entry.js → p-4bb743c7.entry.js} +1 -1
- package/dist/twilight/{p-c38c65f0.entry.js → p-50098fb9.entry.js} +1 -1
- package/dist/twilight/{p-74aaf06c.entry.js → p-50e1eb99.entry.js} +1 -1
- package/dist/twilight/{p-c302d3e3.entry.js → p-57bf3aff.entry.js} +1 -1
- package/dist/twilight/{p-fbbd8d5d.entry.js → p-6c0dd774.entry.js} +1 -1
- package/dist/twilight/{p-f1f60ef7.entry.js → p-7c33b8f3.entry.js} +1 -1
- package/dist/twilight/{p-d2ed15e9.entry.js → p-815175b1.entry.js} +1 -1
- package/dist/twilight/p-82f05641.entry.js +4 -0
- package/dist/twilight/{p-b30a12dc.entry.js → p-843a8d82.entry.js} +1 -1
- package/dist/twilight/p-8565cac6.entry.js +4 -0
- package/dist/twilight/{p-48b90fb3.entry.js → p-9b1184eb.entry.js} +1 -1
- package/dist/twilight/{p-v9xIxXO9.js → p-BCXFmuAu.js} +1 -1
- package/dist/twilight/{p-TSs7NqKJ.js → p-BHSXg2s-.js} +1 -1
- package/dist/twilight/{p-D1_qMmD0.js → p-BXAV6QCo.js} +1 -1
- package/dist/twilight/{p-CIEz2m31.js → p-BY-pqCWB.js} +1 -1
- package/dist/twilight/{p-Bf4kQRcH.js → p-BgVF6sgk.js} +1 -1
- package/dist/twilight/p-Ciq2A6DK.js +9 -0
- package/dist/twilight/{p-LmL2BolE.js → p-CkAdPgup.js} +1 -1
- package/dist/twilight/{p-xUcnsSlW.js → p-DGD3SzSN.js} +1 -1
- package/dist/twilight/{p-qNQwLhxq.js → p-De1xuTRp.js} +1 -1
- package/dist/twilight/{p-c0pjDpvN.js → p-DhexS4-2.js} +1 -1
- package/dist/twilight/{p-4d47725f.entry.js → p-a4b3ddc4.entry.js} +1 -1
- package/dist/twilight/{p-549ff403.entry.js → p-a61b0f9c.entry.js} +1 -1
- package/dist/twilight/{p-7c85a102.entry.js → p-aa32cabd.entry.js} +1 -1
- package/dist/twilight/{p-0aef5345.entry.js → p-abcf3b2d.entry.js} +1 -1
- package/dist/twilight/{p-63e9750c.entry.js → p-affbe255.entry.js} +1 -1
- package/dist/twilight/{p-06956c1d.entry.js → p-b5b851dc.entry.js} +1 -1
- package/dist/twilight/{p-bcec0cf0.entry.js → p-b6cddbff.entry.js} +1 -1
- package/dist/twilight/{p-09dceb55.entry.js → p-b8872e5f.entry.js} +1 -1
- package/dist/twilight/{p-cd2c9076.entry.js → p-b8e7613a.entry.js} +1 -1
- package/dist/twilight/{p-f74f1591.entry.js → p-b9648b3c.entry.js} +1 -1
- package/dist/twilight/{p-966ed241.entry.js → p-bd0fda0b.entry.js} +1 -1
- package/dist/twilight/{p-03870195.entry.js → p-c18da320.entry.js} +1 -1
- package/dist/twilight/{p-950f9a87.entry.js → p-c4f190b2.entry.js} +1 -1
- package/dist/twilight/{p-4cd30c07.entry.js → p-c5ac1d40.entry.js} +1 -1
- package/dist/twilight/{p-23ff2132.entry.js → p-d72fc67d.entry.js} +1 -1
- package/dist/twilight/{p-9f39c553.entry.js → p-e5dc45dc.entry.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -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-slider/salla-slider.d.ts +7 -1
- package/dist/types/components.d.ts +48 -0
- package/package.json +5 -5
- package/dist/twilight/p-2c9d0518.entry.js +0 -4
- package/dist/twilight/p-2gPrnQD6.js +0 -9
- package/dist/twilight/p-fff8923d.entry.js +0 -4
|
@@ -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",
|
|
@@ -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;
|
|
@@ -508,19 +508,53 @@ export class SallaProductOptions {
|
|
|
508
508
|
}, []);
|
|
509
509
|
}
|
|
510
510
|
componentDidLoad() {
|
|
511
|
-
if (this.optionsData?.length
|
|
511
|
+
if (!this.optionsData?.length) {
|
|
512
512
|
return;
|
|
513
513
|
}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
514
|
+
// Handle donation options
|
|
515
|
+
const selectedDonationOption = this.optionsData.find(option => option.type === DisplayType.DONATION)?.details?.find(detail => detail.is_selected);
|
|
516
|
+
if (selectedDonationOption) {
|
|
517
|
+
setTimeout(() => {
|
|
518
|
+
salla.event.emit('product-options::donation-changed', {
|
|
519
|
+
id: this.productId,
|
|
520
|
+
price: selectedDonationOption.additional_price
|
|
521
|
+
});
|
|
522
|
+
}, 1000);
|
|
523
|
+
}
|
|
524
|
+
// Handle pre-selected options on product page
|
|
525
|
+
// Call salla.product.getPrice() directly to avoid triggering form validation which causes unwanted scroll
|
|
526
|
+
if (!salla.url.is_page("cart")) {
|
|
527
|
+
const pricingOptionTypes = [
|
|
528
|
+
DisplayType.SINGLE_OPTION,
|
|
529
|
+
DisplayType.MULTIPLE_OPTIONS,
|
|
530
|
+
DisplayType.COLOR,
|
|
531
|
+
DisplayType.THUMBNAIL,
|
|
532
|
+
DisplayType.DONATION,
|
|
533
|
+
DisplayType.DIGITAL_CARD_VALUE,
|
|
534
|
+
DisplayType.COUNTRY
|
|
535
|
+
];
|
|
536
|
+
const hasPreSelectedPricingOption = this.optionsData.some(option => pricingOptionTypes.includes(option.type) &&
|
|
537
|
+
option.details?.some(detail => detail.is_selected));
|
|
538
|
+
if (hasPreSelectedPricingOption) {
|
|
539
|
+
// Use requestAnimationFrame to ensure DOM is fully painted before accessing form
|
|
540
|
+
requestAnimationFrame(() => {
|
|
541
|
+
try {
|
|
542
|
+
const form = this.host.closest('form');
|
|
543
|
+
if (!form)
|
|
544
|
+
return;
|
|
545
|
+
// Validate form belongs to this product to avoid conflicts on complex pages
|
|
546
|
+
const formData = new FormData(form);
|
|
547
|
+
const formProductId = formData.get('id') || formData.get('product_id');
|
|
548
|
+
if (formProductId && String(formProductId) !== String(this.productId))
|
|
549
|
+
return;
|
|
550
|
+
salla.product.getPrice(formData);
|
|
551
|
+
}
|
|
552
|
+
catch (e) {
|
|
553
|
+
salla.log('Error updating price for pre-selected options:', e);
|
|
554
|
+
}
|
|
555
|
+
});
|
|
556
|
+
}
|
|
517
557
|
}
|
|
518
|
-
setTimeout(() => {
|
|
519
|
-
salla.event.emit('product-options::donation-changed', {
|
|
520
|
-
id: this.productId,
|
|
521
|
-
price: selectedDonationOption.additional_price
|
|
522
|
-
});
|
|
523
|
-
}, 1000);
|
|
524
558
|
}
|
|
525
559
|
/**
|
|
526
560
|
* Enable user-initiated validation mode so invalid fields will scroll into view
|
|
@@ -89,7 +89,9 @@ export class SallaSlider {
|
|
|
89
89
|
this.currentIndex = undefined;
|
|
90
90
|
this.isEnd = false;
|
|
91
91
|
this.isBeginning = true;
|
|
92
|
-
|
|
92
|
+
/** Use matchMedia instead of window.innerWidth to avoid forced reflow (Lighthouse recommended) */
|
|
93
|
+
this.isDesktopViewport = typeof window !== 'undefined' ? window.matchMedia('(min-width: 768px)').matches : true;
|
|
94
|
+
this.viewportMediaQuery = null;
|
|
93
95
|
this.hasThumbSlot = false;
|
|
94
96
|
this.pre_defined_config = {
|
|
95
97
|
carousel: {
|
|
@@ -133,6 +135,9 @@ export class SallaSlider {
|
|
|
133
135
|
spaceBetween: 30
|
|
134
136
|
}
|
|
135
137
|
};
|
|
138
|
+
this.onViewportChange = (e) => {
|
|
139
|
+
this.isDesktopViewport = e.matches;
|
|
140
|
+
};
|
|
136
141
|
this.direction = this.direction || document.documentElement.dir;
|
|
137
142
|
}
|
|
138
143
|
// Methods
|
|
@@ -429,11 +434,11 @@ export class SallaSlider {
|
|
|
429
434
|
return pre_defined_config;
|
|
430
435
|
}
|
|
431
436
|
getThumbsDirection() {
|
|
432
|
-
const { verticalThumbs,
|
|
433
|
-
if (verticalThumbs &&
|
|
437
|
+
const { verticalThumbs, isDesktopViewport, direction } = this;
|
|
438
|
+
if (verticalThumbs && !isDesktopViewport && direction === 'rtl') {
|
|
434
439
|
return 'rtl';
|
|
435
440
|
}
|
|
436
|
-
if (verticalThumbs &&
|
|
441
|
+
if (verticalThumbs && isDesktopViewport && direction === 'rtl') {
|
|
437
442
|
return 'ltr';
|
|
438
443
|
}
|
|
439
444
|
return direction;
|
|
@@ -451,6 +456,8 @@ export class SallaSlider {
|
|
|
451
456
|
// Backward compatibility: lazy load data-background as background-image (removed in Swiper v9+)
|
|
452
457
|
this.loadLazyBackgrounds();
|
|
453
458
|
this.slider.on('slideChange', () => this.loadLazyBackgrounds());
|
|
459
|
+
// Add swiper-lazy-loaded to lazy images when visible
|
|
460
|
+
this.observeLazyImages();
|
|
454
461
|
// Expose slider events
|
|
455
462
|
this.slider.on('slideChange', (slider) => {
|
|
456
463
|
//todo:: it doesn't change when loop is active, always will be false
|
|
@@ -486,7 +493,7 @@ export class SallaSlider {
|
|
|
486
493
|
classes += this.verticalThumbs ? ' s-slider-vertical ' : ' s-slider-horizontal ';
|
|
487
494
|
classes += this.arrowsCentered ? ' s-slider-v-centered ' : '';
|
|
488
495
|
classes += this.gridThumbs ? ' s-slider-with-grid-thumbs ' : '';
|
|
489
|
-
return (h(Host, { key: '
|
|
496
|
+
return (h(Host, { key: '44f6baf2ec3a6421cd8d8ce6779c6ce781cecc7f', class: 's-slider-wrapper ' + classes }, this.blockTitle || this.showControls ?
|
|
490
497
|
h("div", { class: "s-slider-block__title" }, this.blockTitle ?
|
|
491
498
|
h("div", { class: "s-slider-block__title-right" }, h("h2", null, this.blockTitle), this.blockSubtitle ? h("p", { innerHTML: this.blockSubtitle }) : '')
|
|
492
499
|
: '', h("div", { class: "s-slider-block__title-left" }, this.displayAllUrl ?
|
|
@@ -494,11 +501,28 @@ export class SallaSlider {
|
|
|
494
501
|
: '', this.showControls ?
|
|
495
502
|
h("div", { class: "s-slider-block__title-nav", dir: "rtl" }, h("button", { "aria-label": "Previous Slide", class: "s-slider-prev s-slider-nav-arrow" }, h("span", { class: "s-slider-button-icon", innerHTML: this.direction == 'rtl' ? ArrowRightIcon : ArrowLeftIcon })), h("button", { "aria-label": "Next Slide", class: "s-slider-next s-slider-nav-arrow" }, h("span", { class: "s-slider-button-icon", innerHTML: this.direction == 'rtl' ? ArrowLeftIcon : ArrowRightIcon })))
|
|
496
503
|
: ''))
|
|
497
|
-
: '', h("div", { key: '
|
|
504
|
+
: '', h("div", { key: '384d3224e9e2f9ad08d71093ee4c6f907232c07e', class: "swiper s-slider-container", ref: el => this.sliderContainer = el, dir: this.vertical ? "ltr" : this.direction }, h("slot", { key: '578756df5b652d9b7e86d3f0424e4ec886b7a75f' }), h("div", { key: '7966a00ec720374a3dac1533d72fdfeb31db8105', class: "swiper-wrapper s-slider-swiper-wrapper", ref: el => this.sliderWrapper = el }, h("slot", { key: '39f9656cabb053dc4878ae1f2bd94a6efc19f975', name: 'items' })), this.pagination ? h("div", { class: "swiper-pagination" }) : ''), this.type == 'thumbs' && this.hasThumbSlot ? h("div", { class: "s-slider-thumbs" }, h("div", { class: "swiper s-slider-thumbs-container", dir: this.getThumbsDirection(), ref: el => this.thumbsSliderContainer = el }, h("div", { class: { "s-slider-swiper-wrapper swiper-wrapper": true, "s-slider-grid-thumbs": this.gridThumbs }, ref: el => this.thumbsSliderWrapper = el }, h("slot", { name: "thumbs" })), this.showThumbsControls ?
|
|
498
505
|
h("div", { class: "s-slider-thumbs-nav", dir: "rtl" }, h("button", { "aria-label": "Previous Slide", class: "s-slider-thumbs-prev s-slider-nav-arrow" }, h("span", { class: "s-slider-button-icon", innerHTML: this.direction == 'rtl' ? ArrowRightIcon : ArrowLeftIcon })), h("button", { "aria-label": "Next Slide", class: "s-slider-thumbs-next s-slider-nav-arrow" }, h("span", { class: "s-slider-button-icon", innerHTML: this.direction == 'rtl' ? ArrowLeftIcon : ArrowRightIcon })))
|
|
499
506
|
: null))
|
|
500
507
|
: null));
|
|
501
508
|
}
|
|
509
|
+
/** Observe all .swiper-lazy images and add swiper-lazy-loaded when they enter viewport. */
|
|
510
|
+
observeLazyImages() {
|
|
511
|
+
const lazyEls = this.sliderContainer?.querySelectorAll('.swiper-lazy:not(.swiper-lazy-loaded)');
|
|
512
|
+
if (!lazyEls?.length)
|
|
513
|
+
return;
|
|
514
|
+
if (!this.lazyImageObserver) {
|
|
515
|
+
this.lazyImageObserver = new IntersectionObserver((entries, observer) => {
|
|
516
|
+
entries.forEach(entry => {
|
|
517
|
+
if (!entry.isIntersecting)
|
|
518
|
+
return;
|
|
519
|
+
entry.target.classList.add('swiper-lazy-loaded');
|
|
520
|
+
observer.unobserve(entry.target);
|
|
521
|
+
});
|
|
522
|
+
}, { rootMargin: '50px' });
|
|
523
|
+
}
|
|
524
|
+
lazyEls.forEach(el => this.lazyImageObserver.observe(el));
|
|
525
|
+
}
|
|
502
526
|
/** Lazy load data-background for active slide and adjacent slides (backward compat for Swiper v9+). */
|
|
503
527
|
loadLazyBackgrounds() {
|
|
504
528
|
if (!this.slider?.slides)
|
|
@@ -551,9 +575,13 @@ export class SallaSlider {
|
|
|
551
575
|
this.flattenSlotToElements(this.thumbsSliderWrapper, 'div[slot="thumbs"]');
|
|
552
576
|
}
|
|
553
577
|
this.initSlider();
|
|
578
|
+
this.viewportMediaQuery = window.matchMedia('(min-width: 768px)');
|
|
579
|
+
this.viewportMediaQuery.addEventListener('change', this.onViewportChange);
|
|
554
580
|
}
|
|
555
581
|
disconnectedCallback() {
|
|
582
|
+
this.viewportMediaQuery?.removeEventListener('change', this.onViewportChange);
|
|
556
583
|
this.lazyObserver?.disconnect();
|
|
584
|
+
this.lazyImageObserver?.disconnect();
|
|
557
585
|
}
|
|
558
586
|
static get is() { return "salla-slider"; }
|
|
559
587
|
static get originalStyleUrls() {
|
|
@@ -999,7 +1027,7 @@ export class SallaSlider {
|
|
|
999
1027
|
"isEnd": {},
|
|
1000
1028
|
"isBeginning": {},
|
|
1001
1029
|
"displayAllTitle": {},
|
|
1002
|
-
"
|
|
1030
|
+
"isDesktopViewport": {}
|
|
1003
1031
|
};
|
|
1004
1032
|
}
|
|
1005
1033
|
static get events() {
|