@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.
Files changed (143) hide show
  1. package/dist/cjs/{app-globals-CHVPOl9V.js → app-globals-B7YAF7ga.js} +1 -1
  2. package/dist/cjs/{filepond-DRd4_s2v.js → filepond-D6XPg5kE.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-poster-DgrI1jkW.js → filepond-plugin-file-poster-Ca3ug6Xt.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-size-DDaoAhJ6.js → filepond-plugin-file-validate-size-DS2Mw0bF.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-file-validate-type-DEDV1a3V.js → filepond-plugin-file-validate-type-i3PdqD02.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-edit-CPDGO4As.js → filepond-plugin-image-edit-BnJ1hRjZ.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-exif-orientation-BRgevbMC.js → filepond-plugin-image-exif-orientation-eA-6o0CQ.js} +1 -1
  8. package/dist/cjs/{filepond-plugin-image-preview-DYGUzAm7.js → filepond-plugin-image-preview-rPJIbgJl.js} +1 -1
  9. package/dist/cjs/{index-C7arMWIB.js → index-CEuiWga2.js} +2 -2
  10. package/dist/cjs/{index-DXIo87Tk.js → index-m1BoKmuw.js} +1 -1
  11. package/dist/cjs/loader.cjs.js +2 -2
  12. package/dist/cjs/salla-accordion_4.cjs.entry.js +1 -1
  13. package/dist/cjs/salla-add-product-button_51.cjs.entry.js +35 -19
  14. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  15. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  16. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  17. package/dist/cjs/salla-booking-field_2.cjs.entry.js +1 -1
  18. package/dist/cjs/salla-cart-item-offers.cjs.entry.js +1 -1
  19. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  20. package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
  21. package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
  22. package/dist/cjs/salla-filters.cjs.entry.js +1 -1
  23. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  24. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  25. package/dist/cjs/salla-loyalty-program.cjs.entry.js +1 -1
  26. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  30. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  31. package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-orders.cjs.entry.js +1 -1
  34. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  35. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  36. package/dist/cjs/salla-product-options.cjs.entry.js +1 -1
  37. package/dist/cjs/salla-review-card.cjs.entry.js +1 -1
  38. package/dist/cjs/salla-reviews-page.cjs.entry.js +1 -1
  39. package/dist/cjs/salla-reviews.cjs.entry.js +1 -1
  40. package/dist/cjs/salla-social.cjs.entry.js +1 -1
  41. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  42. package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
  43. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  44. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  45. package/dist/cjs/twilight.cjs.js +2 -2
  46. package/dist/collection/components/salla-add-product-button/salla-add-product-button.js +11 -5
  47. package/dist/collection/components/salla-login-modal/salla-login-modal.js +15 -5
  48. package/dist/components/index.js +2 -2
  49. package/dist/components/salla-add-product-button2.js +11 -5
  50. package/dist/components/salla-login-modal.js +15 -5
  51. package/dist/esm/{app-globals-mR93fe4w.js → app-globals-iDxf7CbG.js} +1 -1
  52. package/dist/esm/{filepond-DjrTyRS6.js → filepond-CkstHAv8.js} +1 -1
  53. package/dist/esm/{filepond-plugin-file-poster-PEdA9y9p.js → filepond-plugin-file-poster-YjotDtvM.js} +1 -1
  54. package/dist/esm/{filepond-plugin-file-validate-size-BRP8EqLj.js → filepond-plugin-file-validate-size-CfYe9saz.js} +1 -1
  55. package/dist/esm/{filepond-plugin-file-validate-type-oap4DCYj.js → filepond-plugin-file-validate-type-D11qazvk.js} +1 -1
  56. package/dist/esm/{filepond-plugin-image-edit-Bvj24IHY.js → filepond-plugin-image-edit-BkSt-Ki1.js} +1 -1
  57. package/dist/esm/{filepond-plugin-image-exif-orientation-CGcS6jKF.js → filepond-plugin-image-exif-orientation-C2zdDQVD.js} +1 -1
  58. package/dist/esm/{filepond-plugin-image-preview-Bd3LP9bc.js → filepond-plugin-image-preview-CARveiMV.js} +1 -1
  59. package/dist/esm/{index-BSp_SAn6.js → index-CW7BJxwK.js} +2 -2
  60. package/dist/esm/{index-BKlB0LJo.js → index-exk9-UlL.js} +1 -1
  61. package/dist/esm/loader.js +3 -3
  62. package/dist/esm/salla-accordion_4.entry.js +1 -1
  63. package/dist/esm/salla-add-product-button_51.entry.js +35 -19
  64. package/dist/esm/salla-advertisement.entry.js +1 -1
  65. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  66. package/dist/esm/salla-apps-icons.entry.js +1 -1
  67. package/dist/esm/salla-booking-field_2.entry.js +1 -1
  68. package/dist/esm/salla-cart-item-offers.entry.js +1 -1
  69. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  70. package/dist/esm/salla-contacts.entry.js +1 -1
  71. package/dist/esm/salla-filters-widget.entry.js +1 -1
  72. package/dist/esm/salla-filters.entry.js +1 -1
  73. package/dist/esm/salla-installment.entry.js +1 -1
  74. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  75. package/dist/esm/salla-loyalty-program.entry.js +1 -1
  76. package/dist/esm/salla-metadata.entry.js +1 -1
  77. package/dist/esm/salla-notification-item.entry.js +1 -1
  78. package/dist/esm/salla-notifications.entry.js +1 -1
  79. package/dist/esm/salla-offer.entry.js +1 -1
  80. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  81. package/dist/esm/salla-order-details.entry.js +1 -1
  82. package/dist/esm/salla-order-summary.entry.js +1 -1
  83. package/dist/esm/salla-orders.entry.js +1 -1
  84. package/dist/esm/salla-payments.entry.js +1 -1
  85. package/dist/esm/salla-price-range.entry.js +1 -1
  86. package/dist/esm/salla-product-options.entry.js +1 -1
  87. package/dist/esm/salla-review-card.entry.js +1 -1
  88. package/dist/esm/salla-reviews-page.entry.js +1 -1
  89. package/dist/esm/salla-reviews.entry.js +1 -1
  90. package/dist/esm/salla-social.entry.js +1 -1
  91. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  92. package/dist/esm/salla-tooltip.entry.js +1 -1
  93. package/dist/esm/salla-verify.entry.js +1 -1
  94. package/dist/esm/salla-wallet.entry.js +1 -1
  95. package/dist/esm/twilight.js +3 -3
  96. package/dist/twilight/{p-072c6b64.entry.js → p-08965c8a.entry.js} +1 -1
  97. package/dist/twilight/{p-ba2bad24.entry.js → p-13f3603f.entry.js} +1 -1
  98. package/dist/twilight/{p-1d103017.entry.js → p-17277556.entry.js} +1 -1
  99. package/dist/twilight/{p-e5539fc7.entry.js → p-1d9eee8d.entry.js} +1 -1
  100. package/dist/twilight/{p-ecb77312.entry.js → p-226f53ef.entry.js} +1 -1
  101. package/dist/twilight/{p-89659f7a.entry.js → p-257420f8.entry.js} +1 -1
  102. package/dist/twilight/{p-a695e3b6.entry.js → p-2c378384.entry.js} +1 -1
  103. package/dist/twilight/{p-2c96cfdf.entry.js → p-2cad7c7d.entry.js} +1 -1
  104. package/dist/twilight/{p-8a783da7.entry.js → p-4cac426a.entry.js} +1 -1
  105. package/dist/twilight/{p-ad7f62eb.entry.js → p-502eb830.entry.js} +1 -1
  106. package/dist/twilight/{p-60a093f1.entry.js → p-5b6961cf.entry.js} +1 -1
  107. package/dist/twilight/{p-8d71342f.entry.js → p-6c518217.entry.js} +1 -1
  108. package/dist/twilight/{p-71fad6c0.entry.js → p-773aad5f.entry.js} +1 -1
  109. package/dist/twilight/{p-38b110ac.entry.js → p-7a78935c.entry.js} +1 -1
  110. package/dist/twilight/{p-0b2a463a.entry.js → p-7c32836f.entry.js} +1 -1
  111. package/dist/twilight/{p-431a4cd8.entry.js → p-7f7f7eea.entry.js} +1 -1
  112. package/dist/twilight/{p-f92480a2.entry.js → p-80851455.entry.js} +1 -1
  113. package/dist/twilight/{p-c4_T7k1X.js → p-B6Gr8Kqx.js} +1 -1
  114. package/dist/twilight/{p-BSp_SAn6.js → p-CW7BJxwK.js} +2 -2
  115. package/dist/twilight/{p-C9AUQgJM.js → p-D4IjJ5dP.js} +1 -1
  116. package/dist/twilight/{p--M0fKW6W.js → p-DICYBv-S.js} +1 -1
  117. package/dist/twilight/{p-Ba1RIuVG.js → p-DVpUP3Ee.js} +2 -2
  118. package/dist/twilight/{p-DOUOHu42.js → p-Db6gELNJ.js} +1 -1
  119. package/dist/twilight/{p-CsGVv0Wz.js → p-Df8sri_v.js} +1 -1
  120. package/dist/twilight/{p-DvCwaAfs.js → p-DuGXoJuk.js} +1 -1
  121. package/dist/twilight/{p-d267dd67.entry.js → p-a52a811c.entry.js} +1 -1
  122. package/dist/twilight/{p-5e6df0f2.entry.js → p-a875574d.entry.js} +1 -1
  123. package/dist/twilight/{p-33ed545b.entry.js → p-ae3ea336.entry.js} +1 -1
  124. package/dist/twilight/{p-c40ec87b.entry.js → p-b296aaf2.entry.js} +1 -1
  125. package/dist/twilight/{p-769a4f2c.entry.js → p-b753e41d.entry.js} +1 -1
  126. package/dist/twilight/{p-7b764c4d.entry.js → p-bfd2610a.entry.js} +1 -1
  127. package/dist/twilight/p-cGITsIod.js +9 -0
  128. package/dist/twilight/{p-8c6f935e.entry.js → p-ceb52fb8.entry.js} +1 -1
  129. package/dist/twilight/{p-6ae72cb1.entry.js → p-d00dcdc2.entry.js} +1 -1
  130. package/dist/twilight/{p-43e92061.entry.js → p-d598d23b.entry.js} +1 -1
  131. package/dist/twilight/p-da626246.entry.js +11 -0
  132. package/dist/twilight/{p-0f8564ba.entry.js → p-ddcf9b97.entry.js} +1 -1
  133. package/dist/twilight/{p-8cf1162f.entry.js → p-e51bf0cd.entry.js} +1 -1
  134. package/dist/twilight/{p-95994e91.entry.js → p-e807c9d9.entry.js} +1 -1
  135. package/dist/twilight/{p-a97b26d4.entry.js → p-eafec9e8.entry.js} +1 -1
  136. package/dist/twilight/{p-618cdb9c.entry.js → p-eba7fe7d.entry.js} +1 -1
  137. package/dist/twilight/{p-275e7747.entry.js → p-f3f7f09f.entry.js} +1 -1
  138. package/dist/twilight/{p-CfFJPXVG.js → p-t1jwrj3i.js} +1 -1
  139. package/dist/twilight/twilight.esm.js +1 -1
  140. package/dist/types/components/salla-add-product-button/salla-add-product-button.d.ts +1 -1
  141. package/package.json +5 -5
  142. package/dist/twilight/p-753c0985.entry.js +0 -11
  143. 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
- if (!isValid) {
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
- Object.entries(value).filter(item => !salla.storage.get(item[0]))
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
- salla.cart.reset();
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
- salla.auth.event.tokenFetched(token);
226
- !salla.auth.api.isSessionless() && await salla.auth.api.request('auth/jwt');
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)
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import { L as LazyLoad } from './index-BSp_SAn6.js';
4
+ import { L as LazyLoad } from './index-CW7BJxwK.js';
5
5
 
6
6
  function appGlobalScript () {
7
7
  // Only initialize it one time for the entire application
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import { a as getDefaultExportFromCjs } from './index-BSp_SAn6.js';
4
+ import { a as getDefaultExportFromCjs } from './index-CW7BJxwK.js';
5
5
 
6
6
  function _mergeNamespaces(n, m) {
7
7
  m.forEach(function (e) {
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import { a as getDefaultExportFromCjs } from './index-BSp_SAn6.js';
4
+ import { a as getDefaultExportFromCjs } from './index-CW7BJxwK.js';
5
5
 
6
6
  function _mergeNamespaces(n, m) {
7
7
  m.forEach(function (e) {
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import { a as getDefaultExportFromCjs } from './index-BSp_SAn6.js';
4
+ import { a as getDefaultExportFromCjs } from './index-CW7BJxwK.js';
5
5
 
6
6
  function _mergeNamespaces(n, m) {
7
7
  m.forEach(function (e) {
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import { a as getDefaultExportFromCjs } from './index-BSp_SAn6.js';
4
+ import { a as getDefaultExportFromCjs } from './index-CW7BJxwK.js';
5
5
 
6
6
  function _mergeNamespaces(n, m) {
7
7
  m.forEach(function (e) {
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import { a as getDefaultExportFromCjs } from './index-BSp_SAn6.js';
4
+ import { a as getDefaultExportFromCjs } from './index-CW7BJxwK.js';
5
5
 
6
6
  function _mergeNamespaces(n, m) {
7
7
  m.forEach(function (e) {
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import { a as getDefaultExportFromCjs } from './index-BSp_SAn6.js';
4
+ import { a as getDefaultExportFromCjs } from './index-CW7BJxwK.js';
5
5
 
6
6
  function _mergeNamespaces(n, m) {
7
7
  m.forEach(function (e) {
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import { a as getDefaultExportFromCjs } from './index-BSp_SAn6.js';
4
+ import { a as getDefaultExportFromCjs } from './index-CW7BJxwK.js';
5
5
 
6
6
  function _mergeNamespaces(n, m) {
7
7
  m.forEach(function (e) {