@salla.sa/twilight-components 2.14.350 → 2.14.352
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/{Helper-B5NunIdR.js → Helper-DHRnzcFm.js} +14 -0
- package/dist/cjs/{filepond-qUaAgMcd.js → filepond-XtsZ6xtH.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-DUgrMVOZ.js → filepond-plugin-file-poster-Bj84Ypvg.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-C14LEY_l.js → filepond-plugin-file-validate-size-aYfb4yYH.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-AbHwQAHY.js → filepond-plugin-file-validate-type-CJsd6rXl.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-5ydXOhOa.js → filepond-plugin-image-edit-DRlBSg36.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-D0oIUOy-.js → filepond-plugin-image-exif-orientation-SY8c6DzI.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-Bf_VUYwr.js → filepond-plugin-image-preview-iqhJmUmU.js} +1 -1
- package/dist/cjs/{index-DKEcPhG9.js → index-C7-280f4.js} +1 -1
- package/dist/cjs/{index-BRdJtc1o.js → index-Z-cyrNSM.js} +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/salla-accordion_62.cjs.entry.js +25 -36
- 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 +2 -2
- package/dist/cjs/salla-filters.cjs.entry.js +2 -2
- 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 +2 -2
- 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-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 +2 -2
- 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 +2 -2
- package/dist/cjs/salla-reviews.cjs.entry.js +2 -2
- 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 +1 -1
- package/dist/cjs/{vanilla-picker-CYHmsxIw.js → vanilla-picker-Dq7F5bE1.js} +1 -1
- package/dist/collection/Helpers/Helper.js +14 -0
- package/dist/collection/components/salla-products-list/salla-products-list.js +9 -22
- package/dist/collection/components/salla-products-slider/salla-products-slider.js +9 -7
- package/dist/components/Helper.js +14 -0
- package/dist/components/index.js +2 -2
- package/dist/components/salla-products-list2.js +7 -20
- package/dist/components/salla-products-slider2.js +7 -5
- package/dist/esm/{Helper-Bt5Zv9cl.js → Helper-B5RLi6Xo.js} +14 -0
- package/dist/esm/{filepond-DDOVDszb.js → filepond-Dg4ZKM-u.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-DK5QZAmf.js → filepond-plugin-file-poster-BUIjdsnA.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-BoUr1T-f.js → filepond-plugin-file-validate-size-DgZMMqmi.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-USfq-Egq.js → filepond-plugin-file-validate-type-DA9tDSFr.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-BzsOppMe.js → filepond-plugin-image-edit-dotdnN4Z.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-D2x3fkHF.js → filepond-plugin-image-exif-orientation-oSI8aLU-.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-CAbtIGaT.js → filepond-plugin-image-preview-DEefQK61.js} +1 -1
- package/dist/esm/{index-unlRcuKr.js → index-B7E8Tmgi.js} +1 -1
- package/dist/esm/{index-CkAdPgup.js → index-D2-TtAhI.js} +2 -2
- package/dist/esm/loader.js +2 -2
- package/dist/esm/salla-accordion_62.entry.js +25 -36
- 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 +2 -2
- package/dist/esm/salla-filters.entry.js +2 -2
- 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 +2 -2
- 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-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 +2 -2
- 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 +2 -2
- package/dist/esm/salla-reviews.entry.js +2 -2
- 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 +2 -2
- package/dist/esm/{vanilla-picker-7Rdeecyw.js → vanilla-picker-DkUGzUrx.js} +1 -1
- package/dist/twilight/{p-aa32cabd.entry.js → p-01bccbf2.entry.js} +1 -1
- package/dist/twilight/{p-815175b1.entry.js → p-0effc34b.entry.js} +1 -1
- package/dist/twilight/{p-843a8d82.entry.js → p-22d83528.entry.js} +1 -1
- package/dist/twilight/{p-9b1184eb.entry.js → p-2aa0a4e2.entry.js} +1 -1
- package/dist/twilight/{p-478033b6.entry.js → p-30403778.entry.js} +1 -1
- package/dist/twilight/{p-0eb554c0.entry.js → p-3a74b551.entry.js} +1 -1
- package/dist/twilight/{p-6c0dd774.entry.js → p-4a594c06.entry.js} +1 -1
- package/dist/twilight/p-4e416704.entry.js +4 -0
- package/dist/twilight/{p-57bf3aff.entry.js → p-5dbf4cec.entry.js} +1 -1
- package/dist/twilight/{p-c4f190b2.entry.js → p-67c327a8.entry.js} +1 -1
- package/dist/twilight/{p-b6cddbff.entry.js → p-6b0a03f6.entry.js} +1 -1
- package/dist/twilight/{p-a4b3ddc4.entry.js → p-6c2807c8.entry.js} +1 -1
- package/dist/twilight/{p-c5ac1d40.entry.js → p-6ce3f119.entry.js} +1 -1
- package/dist/twilight/{p-b9648b3c.entry.js → p-6d886b96.entry.js} +1 -1
- package/dist/twilight/{p-b8872e5f.entry.js → p-7b3ca138.entry.js} +1 -1
- package/dist/twilight/{p-bd0fda0b.entry.js → p-81df7a2e.entry.js} +1 -1
- package/dist/twilight/{p-7c33b8f3.entry.js → p-8e7fa4a9.entry.js} +1 -1
- package/dist/twilight/{p-0587a19b.entry.js → p-933881d3.entry.js} +1 -1
- package/dist/twilight/{p-4bb743c7.entry.js → p-9b8f5399.entry.js} +1 -1
- package/dist/twilight/{p-affbe255.entry.js → p-9d35196f.entry.js} +1 -1
- package/dist/twilight/{p-1d2131a2.entry.js → p-9fa5ffcf.entry.js} +1 -1
- package/dist/twilight/{p-BY-pqCWB.js → p-B0ba6Gec.js} +2 -2
- package/dist/twilight/{p-BgVF6sgk.js → p-C2bMx7q5.js} +1 -1
- package/dist/twilight/{p-De1xuTRp.js → p-Cmkcwiop.js} +1 -1
- package/dist/twilight/{p-BHSXg2s-.js → p-Czq4p9Qp.js} +1 -1
- package/dist/twilight/{p-CkAdPgup.js → p-D2-TtAhI.js} +1 -1
- package/dist/twilight/{p-DGD3SzSN.js → p-DJ557xys.js} +1 -1
- package/dist/twilight/{p-Ciq2A6DK.js → p-DPqkW1aD.js} +2 -2
- package/dist/twilight/p-DgNC8L6e.js +4 -0
- package/dist/twilight/{p-BXAV6QCo.js → p-DhcC83-2.js} +1 -1
- package/dist/twilight/{p-BCXFmuAu.js → p-_JhF_Kvb.js} +1 -1
- package/dist/twilight/{p-100f7787.entry.js → p-a42d626d.entry.js} +1 -1
- package/dist/twilight/{p-17618bb7.entry.js → p-a858523c.entry.js} +1 -1
- package/dist/twilight/{p-d72fc67d.entry.js → p-b1af2aca.entry.js} +1 -1
- package/dist/twilight/{p-25e36e28.entry.js → p-b208650b.entry.js} +1 -1
- package/dist/twilight/{p-0162ae20.entry.js → p-b9d0212c.entry.js} +1 -1
- package/dist/twilight/{p-8565cac6.entry.js → p-cf66ab4d.entry.js} +1 -1
- package/dist/twilight/{p-50e1eb99.entry.js → p-d4faa0f6.entry.js} +1 -1
- package/dist/twilight/{p-b5b851dc.entry.js → p-db526796.entry.js} +1 -1
- package/dist/twilight/{p-b8e7613a.entry.js → p-e26cc25b.entry.js} +1 -1
- package/dist/twilight/{p-abcf3b2d.entry.js → p-e5c01983.entry.js} +1 -1
- package/dist/twilight/{p-c18da320.entry.js → p-e73c28a8.entry.js} +1 -1
- package/dist/twilight/{p-a61b0f9c.entry.js → p-ed60a726.entry.js} +1 -1
- package/dist/twilight/{p-50098fb9.entry.js → p-f6ffc708.entry.js} +1 -1
- package/dist/twilight/{p-e5dc45dc.entry.js → p-fea62668.entry.js} +1 -1
- package/dist/twilight/{p-DhexS4-2.js → p-q-O0srMP.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/Helpers/Helper.d.ts +2 -0
- package/dist/types/components/salla-products-list/salla-products-list.d.ts +1 -1
- package/dist/types/components/salla-products-slider/salla-products-slider.d.ts +1 -1
- package/dist/types/components.d.ts +4 -4
- package/package.json +5 -5
- package/dist/twilight/p-82f05641.entry.js +0 -4
- package/dist/twilight/p-Dljb4XCt.js +0 -4
|
@@ -203,19 +203,6 @@ const SallaProductsList = /*@__PURE__*/ proxyCustomElement(class SallaProductsLi
|
|
|
203
203
|
//as a request they don't want to let the user to open the product details
|
|
204
204
|
//todo:: find a better way to handle this request
|
|
205
205
|
this.getSource() === 'landing-page' && (product.url = '');
|
|
206
|
-
try {
|
|
207
|
-
// Add source query param to product URL for tracking in Product Viewed event
|
|
208
|
-
if (this.source && product.url && !product.url.includes('s-product-source=')) {
|
|
209
|
-
const [urlWithoutFragment, fragment] = product.url.split('#');
|
|
210
|
-
const separator = urlWithoutFragment.includes('?') ? '&' : '?';
|
|
211
|
-
const pageSlug = salla.config?.get('page.slug') || 'unknown';
|
|
212
|
-
const sourceValue = `${pageSlug}.${this.source}`;
|
|
213
|
-
product.url = `${urlWithoutFragment}${separator}s-product-source=${sourceValue}${fragment ? '#' + fragment : ''}`;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
catch (error) {
|
|
217
|
-
Salla.log('Error with source');
|
|
218
|
-
}
|
|
219
206
|
const customComponentTag = this.hasCustomComponent ? this.productCardComponent : 'salla-product-card';
|
|
220
207
|
const productCard = document.createElement(customComponentTag);
|
|
221
208
|
productCard.product = product;
|
|
@@ -223,15 +210,15 @@ const SallaProductsList = /*@__PURE__*/ proxyCustomElement(class SallaProductsLi
|
|
|
223
210
|
this.applyHorizontalCardStyles(productCard);
|
|
224
211
|
// Attach click event listener to save the current products snapshot
|
|
225
212
|
productCard.addEventListener('click', (event) => {
|
|
226
|
-
if (!this.hasInfiniteScroll) {
|
|
227
|
-
return;
|
|
228
|
-
}
|
|
229
213
|
const target = event.target;
|
|
230
214
|
// Check if the clicked element is an anchor or inside an anchor
|
|
231
215
|
const anchor = target.closest('a');
|
|
232
216
|
if (anchor) {
|
|
233
|
-
this.
|
|
234
|
-
|
|
217
|
+
Helper.saveProductSource(this.getSource());
|
|
218
|
+
if (this.hasInfiniteScroll) {
|
|
219
|
+
this.takeStateSnapshot();
|
|
220
|
+
sessionStorage.setItem(this.lastViewedProductKey, product.id);
|
|
221
|
+
}
|
|
235
222
|
}
|
|
236
223
|
});
|
|
237
224
|
return productCard;
|
|
@@ -561,7 +548,7 @@ const SallaProductsList = /*@__PURE__*/ proxyCustomElement(class SallaProductsLi
|
|
|
561
548
|
}
|
|
562
549
|
getInitialData() {
|
|
563
550
|
this.loading();
|
|
564
|
-
return salla.product.api.fetch({ source: this.getSource(), source_value: this.getSourceValue(), limit: this.limit }).then(async (response) => {
|
|
551
|
+
return salla.product.api.fetch({ source: Helper.getApiSource(this.getSource()), source_value: this.getSourceValue(), limit: this.limit }).then(async (response) => {
|
|
565
552
|
if (!response.data.length) {
|
|
566
553
|
this.showPlaceholder = true;
|
|
567
554
|
this.placeholderLoader && this.placeholderLoader.remove();
|
|
@@ -587,7 +574,7 @@ const SallaProductsList = /*@__PURE__*/ proxyCustomElement(class SallaProductsLi
|
|
|
587
574
|
.then(() => {
|
|
588
575
|
this.hasCustomComponent = !!customElements.get(this.productCardComponent);
|
|
589
576
|
this.sourceValueIsValid = !!(this.getSourceValue() || this.isSourceWithoutValue());
|
|
590
|
-
this.hasInfiniteScroll = !['json', 'selected', 'related', 'landing-page'].includes(this.getSource()) && !this.limit;
|
|
577
|
+
this.hasInfiniteScroll = !['json', 'selected', 'related', 'landing-page', 'recently'].includes(this.getSource()) && !this.limit;
|
|
591
578
|
let searchParams = new URLSearchParams(window.location.search);
|
|
592
579
|
try {
|
|
593
580
|
this.sortBy = this.sortBy || searchParams.get('sort') || searchParams.get('by');
|
|
@@ -57,7 +57,7 @@ const SallaProductsSlider = /*@__PURE__*/ proxyCustomElement(class SallaProducts
|
|
|
57
57
|
this.isReady = false;
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
|
-
return salla.product.api.fetch({ source: this.getSource(), source_value: this.getSourceValue(), limit: this.limit })
|
|
60
|
+
return salla.product.api.fetch({ source: Helper.getApiSource(this.getSource()), source_value: this.getSourceValue(), limit: this.limit })
|
|
61
61
|
.then(response => Helper.injectExtraFieldsToResponse(response))
|
|
62
62
|
.then(response => {
|
|
63
63
|
this.productsData = response.data;
|
|
@@ -87,18 +87,20 @@ const SallaProductsSlider = /*@__PURE__*/ proxyCustomElement(class SallaProducts
|
|
|
87
87
|
getItemHTML(product) {
|
|
88
88
|
//as a request they don't want to let the user to open the product details
|
|
89
89
|
//todo:: find a better way to handle this request
|
|
90
|
-
this.getSource() === 'landing-page'
|
|
90
|
+
const isLandingPage = this.getSource() === 'landing-page';
|
|
91
|
+
isLandingPage && (product.url = '');
|
|
92
|
+
const handleClick = isLandingPage ? undefined : () => Helper.saveProductSource(this.getSource());
|
|
91
93
|
if (this.hasCustomComponent && this.productCardComponent.toLowerCase() == 'custom-salla-product-card') {
|
|
92
|
-
return h("div", { class: "s-products-slider-card" }, h("custom-salla-product-card", { product: product, source: this.getSource(), "source-value": this.getSourceValue() }));
|
|
94
|
+
return h("div", { class: "s-products-slider-card", onClick: handleClick }, h("custom-salla-product-card", { product: product, source: this.getSource(), "source-value": this.getSourceValue() }));
|
|
93
95
|
}
|
|
94
96
|
if (this.hasCustomComponent) {
|
|
95
97
|
const customElem = document.createElement(this.productCardComponent);
|
|
96
98
|
customElem.setAttribute('product', JSON.stringify(product));
|
|
97
99
|
customElem.setAttribute('source', this.getSource());
|
|
98
100
|
customElem.setAttribute('source-value', this.getSourceValue());
|
|
99
|
-
return h("div", { class: "s-products-slider-card", innerHTML: customElem.outerHTML });
|
|
101
|
+
return h("div", { class: "s-products-slider-card", onClick: handleClick, innerHTML: customElem.outerHTML });
|
|
100
102
|
}
|
|
101
|
-
return h("div", { class: "s-products-slider-card" }, h("salla-product-card", { "show-quantity":
|
|
103
|
+
return h("div", { class: "s-products-slider-card", onClick: handleClick }, h("salla-product-card", { "show-quantity": isLandingPage, "hide-add-btn": isLandingPage, "shadow-on-hover": true, product: product }));
|
|
102
104
|
}
|
|
103
105
|
canRender() {
|
|
104
106
|
return this.sourceValueIsValid && this.isReady;
|
|
@@ -51,6 +51,10 @@ class Helper {
|
|
|
51
51
|
'components.most_sales_products': 'sales', //temporary, delete it after two days from now
|
|
52
52
|
}[source || salla.config.get('page.slug')] || source || 'latest';
|
|
53
53
|
}
|
|
54
|
+
getApiSource(source) {
|
|
55
|
+
const apiSourceMap = { 'recently': 'selected' };
|
|
56
|
+
return apiSourceMap[source] || source;
|
|
57
|
+
}
|
|
54
58
|
getPageTitleForSource(source) {
|
|
55
59
|
source = {
|
|
56
60
|
'brands': 'common.titles.brands',
|
|
@@ -177,6 +181,16 @@ class Helper {
|
|
|
177
181
|
productsIncludes() {
|
|
178
182
|
return this.includes?.filter(field => field != 'metadata');
|
|
179
183
|
}
|
|
184
|
+
saveProductSource(source) {
|
|
185
|
+
if (!source)
|
|
186
|
+
return;
|
|
187
|
+
try {
|
|
188
|
+
sessionStorage.setItem('s-viewed-source', source);
|
|
189
|
+
}
|
|
190
|
+
catch (error) {
|
|
191
|
+
salla.logger.warn('Error saving product source to session storage');
|
|
192
|
+
}
|
|
193
|
+
}
|
|
180
194
|
parseJson(includes) {
|
|
181
195
|
if (typeof includes !== 'string') {
|
|
182
196
|
return includes;
|