@salla.sa/twilight-components 2.14.267 → 2.14.269
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/{app-globals-CHVPOl9V.js → app-globals-B7YAF7ga.js} +1 -1
- package/dist/cjs/{filepond-DRd4_s2v.js → filepond-D6XPg5kE.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-DgrI1jkW.js → filepond-plugin-file-poster-Ca3ug6Xt.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-DDaoAhJ6.js → filepond-plugin-file-validate-size-DS2Mw0bF.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-DEDV1a3V.js → filepond-plugin-file-validate-type-i3PdqD02.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-CPDGO4As.js → filepond-plugin-image-edit-BnJ1hRjZ.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-BRgevbMC.js → filepond-plugin-image-exif-orientation-eA-6o0CQ.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-DYGUzAm7.js → filepond-plugin-image-preview-rPJIbgJl.js} +1 -1
- package/dist/cjs/{index-C7arMWIB.js → index-CEuiWga2.js} +2 -2
- package/dist/cjs/{index-DXIo87Tk.js → index-m1BoKmuw.js} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/salla-accordion_4.cjs.entry.js +1 -1
- package/dist/cjs/salla-add-product-button_51.cjs.entry.js +35 -19
- 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-booking-field_2.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 +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 -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-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-product-options.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-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/collection/components/salla-add-product-button/salla-add-product-button.js +11 -5
- package/dist/collection/components/salla-login-modal/salla-login-modal.js +15 -5
- package/dist/components/index.js +2 -2
- package/dist/components/salla-add-product-button2.js +11 -5
- package/dist/components/salla-login-modal.js +15 -5
- package/dist/esm/{app-globals-mR93fe4w.js → app-globals-iDxf7CbG.js} +1 -1
- package/dist/esm/{filepond-DjrTyRS6.js → filepond-CkstHAv8.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-PEdA9y9p.js → filepond-plugin-file-poster-YjotDtvM.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-BRP8EqLj.js → filepond-plugin-file-validate-size-CfYe9saz.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-oap4DCYj.js → filepond-plugin-file-validate-type-D11qazvk.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-Bvj24IHY.js → filepond-plugin-image-edit-BkSt-Ki1.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-CGcS6jKF.js → filepond-plugin-image-exif-orientation-C2zdDQVD.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-Bd3LP9bc.js → filepond-plugin-image-preview-CARveiMV.js} +1 -1
- package/dist/esm/{index-BSp_SAn6.js → index-CW7BJxwK.js} +2 -2
- package/dist/esm/{index-BKlB0LJo.js → index-exk9-UlL.js} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/salla-accordion_4.entry.js +1 -1
- package/dist/esm/salla-add-product-button_51.entry.js +35 -19
- 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-booking-field_2.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 +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 -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-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-product-options.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-verify.entry.js +1 -1
- package/dist/esm/salla-wallet.entry.js +1 -1
- package/dist/esm/twilight.js +3 -3
- package/dist/twilight/{p-072c6b64.entry.js → p-08965c8a.entry.js} +1 -1
- package/dist/twilight/{p-ba2bad24.entry.js → p-13f3603f.entry.js} +1 -1
- package/dist/twilight/{p-1d103017.entry.js → p-17277556.entry.js} +1 -1
- package/dist/twilight/{p-e5539fc7.entry.js → p-1d9eee8d.entry.js} +1 -1
- package/dist/twilight/{p-ecb77312.entry.js → p-226f53ef.entry.js} +1 -1
- package/dist/twilight/{p-89659f7a.entry.js → p-257420f8.entry.js} +1 -1
- package/dist/twilight/{p-a695e3b6.entry.js → p-2c378384.entry.js} +1 -1
- package/dist/twilight/{p-2c96cfdf.entry.js → p-2cad7c7d.entry.js} +1 -1
- package/dist/twilight/{p-8a783da7.entry.js → p-4cac426a.entry.js} +1 -1
- package/dist/twilight/{p-ad7f62eb.entry.js → p-502eb830.entry.js} +1 -1
- package/dist/twilight/{p-60a093f1.entry.js → p-5b6961cf.entry.js} +1 -1
- package/dist/twilight/{p-8d71342f.entry.js → p-6c518217.entry.js} +1 -1
- package/dist/twilight/{p-71fad6c0.entry.js → p-773aad5f.entry.js} +1 -1
- package/dist/twilight/{p-38b110ac.entry.js → p-7a78935c.entry.js} +1 -1
- package/dist/twilight/{p-0b2a463a.entry.js → p-7c32836f.entry.js} +1 -1
- package/dist/twilight/{p-431a4cd8.entry.js → p-7f7f7eea.entry.js} +1 -1
- package/dist/twilight/{p-f92480a2.entry.js → p-80851455.entry.js} +1 -1
- package/dist/twilight/{p-c4_T7k1X.js → p-B6Gr8Kqx.js} +1 -1
- package/dist/twilight/{p-BSp_SAn6.js → p-CW7BJxwK.js} +2 -2
- package/dist/twilight/{p-C9AUQgJM.js → p-D4IjJ5dP.js} +1 -1
- package/dist/twilight/{p--M0fKW6W.js → p-DICYBv-S.js} +1 -1
- package/dist/twilight/{p-Ba1RIuVG.js → p-DVpUP3Ee.js} +2 -2
- package/dist/twilight/{p-DOUOHu42.js → p-Db6gELNJ.js} +1 -1
- package/dist/twilight/{p-CsGVv0Wz.js → p-Df8sri_v.js} +1 -1
- package/dist/twilight/{p-DvCwaAfs.js → p-DuGXoJuk.js} +1 -1
- package/dist/twilight/{p-d267dd67.entry.js → p-a52a811c.entry.js} +1 -1
- package/dist/twilight/{p-5e6df0f2.entry.js → p-a875574d.entry.js} +1 -1
- package/dist/twilight/{p-33ed545b.entry.js → p-ae3ea336.entry.js} +1 -1
- package/dist/twilight/{p-c40ec87b.entry.js → p-b296aaf2.entry.js} +1 -1
- package/dist/twilight/{p-769a4f2c.entry.js → p-b753e41d.entry.js} +1 -1
- package/dist/twilight/{p-7b764c4d.entry.js → p-bfd2610a.entry.js} +1 -1
- package/dist/twilight/p-cGITsIod.js +9 -0
- package/dist/twilight/{p-8c6f935e.entry.js → p-ceb52fb8.entry.js} +1 -1
- package/dist/twilight/{p-6ae72cb1.entry.js → p-d00dcdc2.entry.js} +1 -1
- package/dist/twilight/{p-43e92061.entry.js → p-d598d23b.entry.js} +1 -1
- package/dist/twilight/p-da626246.entry.js +11 -0
- package/dist/twilight/{p-0f8564ba.entry.js → p-ddcf9b97.entry.js} +1 -1
- package/dist/twilight/{p-8cf1162f.entry.js → p-e51bf0cd.entry.js} +1 -1
- package/dist/twilight/{p-95994e91.entry.js → p-e807c9d9.entry.js} +1 -1
- package/dist/twilight/{p-a97b26d4.entry.js → p-eafec9e8.entry.js} +1 -1
- package/dist/twilight/{p-618cdb9c.entry.js → p-eba7fe7d.entry.js} +1 -1
- package/dist/twilight/{p-275e7747.entry.js → p-f3f7f09f.entry.js} +1 -1
- package/dist/twilight/{p-CfFJPXVG.js → p-t1jwrj3i.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/components/salla-add-product-button/salla-add-product-button.d.ts +1 -1
- package/package.json +5 -5
- package/dist/twilight/p-753c0985.entry.js +0 -11
- package/dist/twilight/p-CToUtIYp.js +0 -9
|
@@ -78,8 +78,11 @@ const SallaAddProductButton = /*@__PURE__*/ proxyCustomElement(class SallaAddPro
|
|
|
78
78
|
const optionsEl = document.querySelector(`salla-product-options[product-id="${this.productId}"]`);
|
|
79
79
|
if (optionsEl && typeof optionsEl.validateAndScroll === 'function') {
|
|
80
80
|
return optionsEl.validateAndScroll()
|
|
81
|
-
.then((isValid) => {
|
|
82
|
-
|
|
81
|
+
.then(async (isValid) => {
|
|
82
|
+
// Call validate hook
|
|
83
|
+
const ctx = { isValid, component: this };
|
|
84
|
+
await salla.hooks.call('salla-add-product-button', 'validate', ctx);
|
|
85
|
+
if (!ctx.isValid) {
|
|
83
86
|
this.btn?.enable();
|
|
84
87
|
return;
|
|
85
88
|
}
|
|
@@ -92,7 +95,7 @@ const SallaAddProductButton = /*@__PURE__*/ proxyCustomElement(class SallaAddPro
|
|
|
92
95
|
// Fallback if options component not found
|
|
93
96
|
return this._proceedAddToCart();
|
|
94
97
|
}
|
|
95
|
-
_proceedAddToCart() {
|
|
98
|
+
async _proceedAddToCart() {
|
|
96
99
|
/**
|
|
97
100
|
* by default the quick add is just an alias for add item function
|
|
98
101
|
* but its work only when the id is the only value is passed via the object
|
|
@@ -104,8 +107,9 @@ const SallaAddProductButton = /*@__PURE__*/ proxyCustomElement(class SallaAddPro
|
|
|
104
107
|
quantity: this.quantity,
|
|
105
108
|
endpoint: 'quickAdd'
|
|
106
109
|
}).reduce((a, [k, v]) => (v ? (a[k] = v, a) : a), {});
|
|
110
|
+
// Use the potentially modified data
|
|
107
111
|
return salla.cart.addItem(data)
|
|
108
|
-
.then(response => {
|
|
112
|
+
.then(async (response) => {
|
|
109
113
|
this.selectedOptions = [];
|
|
110
114
|
this.btn?.enable();
|
|
111
115
|
this.success.emit(response);
|
|
@@ -185,7 +189,9 @@ const SallaAddProductButton = /*@__PURE__*/ proxyCustomElement(class SallaAddPro
|
|
|
185
189
|
'w-full': !document.getElementById('fast-checkout-js') || ['financial_support', 'donating'].includes(this.productType) // This is a temporary fix until all themes fully support the fast checkout -- To be removed later
|
|
186
190
|
} }, h("salla-button", { color: this.productStatus === 'sale' ? 'primary' : 'light', type: "button", fill: this.productStatus === 'sale' ? 'solid' : 'outline', ref: el => this.btn = el, onClick: event => this.addProductToCart(event), disabled: this.productStatus !== 'sale', ...this.getBtnAttributes(), "loader-position": "center" }, h("slot", null)), this.showQuickBuy && !!document.getElementById('fast-checkout-js') && !['financial_support', 'donating'].includes(this.productType) ? this.miniCheckoutWidget() : ''), this.showQuickBuy && this.isApplePayActive ? h("salla-quick-buy", { ...this.getQuickBuyBtnAttributes() }) : '');
|
|
187
191
|
}
|
|
188
|
-
componentDidLoad() {
|
|
192
|
+
async componentDidLoad() {
|
|
193
|
+
// Register this component for hooks system, already on it logic to run componentDidLoad trigger
|
|
194
|
+
await Salla.hooks.registerComponent('salla-add-product-button', this);
|
|
189
195
|
if (!this.notifyOptionsAvailability) {
|
|
190
196
|
return;
|
|
191
197
|
}
|
|
@@ -208,7 +208,8 @@ const SallaLoginModal$1 = /*@__PURE__*/ proxyCustomElement(class SallaLoginModal
|
|
|
208
208
|
}
|
|
209
209
|
async handleIframeStorageAction(value) {
|
|
210
210
|
let token, cartUserId = salla.storage.get('cart.user_id');
|
|
211
|
-
|
|
211
|
+
let withCartReset = false;
|
|
212
|
+
Object.entries(value).filter(item => !Salla.storage.get(item[0]))
|
|
212
213
|
.forEach(([key, value]) => {
|
|
213
214
|
salla.log('Shared storage from accounts domain', key, value);
|
|
214
215
|
let cleanedValue = (typeof value === 'string') ? value?.replace(/^"|"$/g, '') : value;
|
|
@@ -216,17 +217,26 @@ const SallaLoginModal$1 = /*@__PURE__*/ proxyCustomElement(class SallaLoginModal
|
|
|
216
217
|
if (key === 'token') {
|
|
217
218
|
token = cleanedValue;
|
|
218
219
|
}
|
|
219
|
-
if (key === 'user' && cartUserId && cleanedValue.id !== cartUserId) {
|
|
220
|
-
|
|
220
|
+
if (key === 'user' && cartUserId && (cleanedValue.id !== cartUserId)) {
|
|
221
|
+
withCartReset = true;
|
|
221
222
|
}
|
|
222
223
|
});
|
|
223
224
|
if (token) {
|
|
224
225
|
this.modal.close();
|
|
225
|
-
|
|
226
|
-
|
|
226
|
+
Salla.auth.event.tokenFetched(token);
|
|
227
|
+
try {
|
|
228
|
+
await Salla.cart.api.assign();
|
|
229
|
+
}
|
|
230
|
+
catch (error) {
|
|
231
|
+
Salla.log('Error on assign');
|
|
232
|
+
}
|
|
233
|
+
await Salla.cart.api.assign();
|
|
234
|
+
withCartReset && Salla.cart.reset();
|
|
235
|
+
!Salla.auth.api.isSessionless() && await Salla.auth.api.request('auth/jwt');
|
|
227
236
|
setTimeout(() => window.location.reload(), 100);
|
|
228
237
|
return;
|
|
229
238
|
}
|
|
239
|
+
withCartReset && Salla.cart.reset();
|
|
230
240
|
}
|
|
231
241
|
sendMessageToIframe(message) {
|
|
232
242
|
if (!this.iframe)
|