@salla.sa/twilight-components 2.11.70 → 2.11.72

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.
@@ -23291,7 +23291,7 @@ const SallaProductAvailability = class {
23291
23291
  this.title_ = this.host.title || salla.lang.get('pages.products.notify_availability_title');
23292
23292
  this.host.removeAttribute('title');
23293
23293
  //todo:: fix this to cover options too
23294
- this.isVisitorSubscribed = ''; //salla.storage.get(`product-${this.productId}-subscribed`);
23294
+ this.isVisitorSubscribed = !this.notifyOptionsAvailability ? salla.storage.get(`product-${this.productId}-subscribed`) : '';
23295
23295
  }
23296
23296
  channelsWatcher(newValue) {
23297
23297
  this.channels_ = !!newValue ? newValue.split(',') : [];
@@ -23320,6 +23320,7 @@ const SallaProductAvailability = class {
23320
23320
  .then(() => {
23321
23321
  if (!this.notifyOptionsAvailability) {
23322
23322
  salla.storage.set(`product-${this.productId}-subscribed`, true);
23323
+ this.isSubscribed = true;
23323
23324
  return;
23324
23325
  }
23325
23326
  if (payload.options.length) {
@@ -23328,12 +23329,12 @@ const SallaProductAvailability = class {
23328
23329
  if (!options.includes(selectedOptionsString)) {
23329
23330
  options.push(selectedOptionsString);
23330
23331
  salla.storage.set(`product-${this.productId}-subscribed-options`, options);
23332
+ this.isSubscribed = true;
23331
23333
  }
23332
23334
  else {
23333
23335
  salla.log('already subscribed to this options');
23334
23336
  }
23335
23337
  }
23336
- this.isSubscribed = true;
23337
23338
  })
23338
23339
  .then(() => this.btn.stop())
23339
23340
  .then(() => this.modal.close())
@@ -26054,7 +26055,7 @@ const SallaQuickBuy = class {
26054
26055
  requiredShippingContactFields: this.isRequireShipping ? ['postalAddress'] : null,
26055
26056
  shippingMethods: this.isRequireShipping ? [] : null,
26056
26057
  supportedNetworks: salla.config.get('store.settings.buy_now.networks'),
26057
- // supportedCountries: data.applepay_supported_networks, // todo :: later get it from store settings with countries
26058
+ supportedCountries: salla.config.get('store.settings.buy_now.countries'),
26058
26059
  validateMerchant: {
26059
26060
  url: salla.url.get('checkout/applepay/validate'),
26060
26061
  onSuccess: () => {
@@ -26136,7 +26137,9 @@ const SallaQuickBuy = class {
26136
26137
  if (salla.url.is_page('product.single')) {
26137
26138
  salla.product.event.onPriceUpdated(response => this.amount = response.data.price);
26138
26139
  }
26139
- this.isApplePayActive = ((_a = window.ApplePaySession) === null || _a === void 0 ? void 0 : _a.canMakePayments()) && ((_b = salla.config.get('store.settings.payments')) === null || _b === void 0 ? void 0 : _b.includes('apple_pay'));
26140
+ this.isApplePayActive = ((_a = window.ApplePaySession) === null || _a === void 0 ? void 0 : _a.canMakePayments())
26141
+ && ((_b = salla.config.get('store.settings.payments')) === null || _b === void 0 ? void 0 : _b.includes('apple_pay'))
26142
+ && salla.config.get('user.currency_code') === 'SAR';
26140
26143
  let applePaySdk = document.getElementById('apple-pay-sdk');
26141
26144
  if (applePaySdk || !this.isApplePayActive) {
26142
26145
  salla.logger.warn('🍏 Pay: Skipped load apple pay because ' + (applePaySdk ? 'already loaded' : 'is not available in the browser'));
@@ -294,7 +294,7 @@ const SallaProductOptions = class {
294
294
  getOptionDetailName(detail, outOfStock = true, optionType) {
295
295
  if (optionType && optionType == DisplayType.COLOR) {
296
296
  return detail.name
297
- + ((outOfStock && this.isOptionDetailOut(detail)) ? ` <br/> <p> ${this.outOfStockText} </p>` : '')
297
+ + ((outOfStock && this.isOptionDetailOut(detail)) ? ` <br/> <p> ${salla.lang.get("pages.products.out_of_stock")} </p>` : '')
298
298
  + (detail.additional_price ? ` <p> (${salla.money(detail.additional_price)}) </p>` : '');
299
299
  }
300
300
  return detail.name
@@ -60,7 +60,7 @@ export class SallaProductAvailability {
60
60
  this.title_ = this.host.title || salla.lang.get('pages.products.notify_availability_title');
61
61
  this.host.removeAttribute('title');
62
62
  //todo:: fix this to cover options too
63
- this.isVisitorSubscribed = ''; //salla.storage.get(`product-${this.productId}-subscribed`);
63
+ this.isVisitorSubscribed = !this.notifyOptionsAvailability ? salla.storage.get(`product-${this.productId}-subscribed`) : '';
64
64
  }
65
65
  channelsWatcher(newValue) {
66
66
  this.channels_ = !!newValue ? newValue.split(',') : [];
@@ -89,6 +89,7 @@ export class SallaProductAvailability {
89
89
  .then(() => {
90
90
  if (!this.notifyOptionsAvailability) {
91
91
  salla.storage.set(`product-${this.productId}-subscribed`, true);
92
+ this.isSubscribed = true;
92
93
  return;
93
94
  }
94
95
  if (payload.options.length) {
@@ -97,12 +98,12 @@ export class SallaProductAvailability {
97
98
  if (!options.includes(selectedOptionsString)) {
98
99
  options.push(selectedOptionsString);
99
100
  salla.storage.set(`product-${this.productId}-subscribed-options`, options);
101
+ this.isSubscribed = true;
100
102
  }
101
103
  else {
102
104
  salla.log('already subscribed to this options');
103
105
  }
104
106
  }
105
- this.isSubscribed = true;
106
107
  })
107
108
  .then(() => this.btn.stop())
108
109
  .then(() => this.modal.close())
@@ -270,7 +270,7 @@ export class SallaProductOptions {
270
270
  getOptionDetailName(detail, outOfStock = true, optionType) {
271
271
  if (optionType && optionType == DisplayType.COLOR) {
272
272
  return detail.name
273
- + ((outOfStock && this.isOptionDetailOut(detail)) ? ` <br/> <p> ${this.outOfStockText} </p>` : '')
273
+ + ((outOfStock && this.isOptionDetailOut(detail)) ? ` <br/> <p> ${salla.lang.get("pages.products.out_of_stock")} </p>` : '')
274
274
  + (detail.additional_price ? ` <p> (${salla.money(detail.additional_price)}) </p>` : '');
275
275
  }
276
276
  return detail.name
@@ -67,7 +67,7 @@ export class SallaQuickBuy {
67
67
  requiredShippingContactFields: this.isRequireShipping ? ['postalAddress'] : null,
68
68
  shippingMethods: this.isRequireShipping ? [] : null,
69
69
  supportedNetworks: salla.config.get('store.settings.buy_now.networks'),
70
- // supportedCountries: data.applepay_supported_networks, // todo :: later get it from store settings with countries
70
+ supportedCountries: salla.config.get('store.settings.buy_now.countries'),
71
71
  validateMerchant: {
72
72
  url: salla.url.get('checkout/applepay/validate'),
73
73
  onSuccess: () => {
@@ -149,7 +149,9 @@ export class SallaQuickBuy {
149
149
  if (salla.url.is_page('product.single')) {
150
150
  salla.product.event.onPriceUpdated(response => this.amount = response.data.price);
151
151
  }
152
- this.isApplePayActive = ((_a = window.ApplePaySession) === null || _a === void 0 ? void 0 : _a.canMakePayments()) && ((_b = salla.config.get('store.settings.payments')) === null || _b === void 0 ? void 0 : _b.includes('apple_pay'));
152
+ this.isApplePayActive = ((_a = window.ApplePaySession) === null || _a === void 0 ? void 0 : _a.canMakePayments())
153
+ && ((_b = salla.config.get('store.settings.payments')) === null || _b === void 0 ? void 0 : _b.includes('apple_pay'))
154
+ && salla.config.get('user.currency_code') === 'SAR';
153
155
  let applePaySdk = document.getElementById('apple-pay-sdk');
154
156
  if (applePaySdk || !this.isApplePayActive) {
155
157
  salla.logger.warn('🍏 Pay: Skipped load apple pay because ' + (applePaySdk ? 'already loaded' : 'is not available in the browser'));
@@ -69,7 +69,7 @@ const SallaProductAvailability = /*@__PURE__*/ proxyCustomElement(class extends
69
69
  this.title_ = this.host.title || salla.lang.get('pages.products.notify_availability_title');
70
70
  this.host.removeAttribute('title');
71
71
  //todo:: fix this to cover options too
72
- this.isVisitorSubscribed = ''; //salla.storage.get(`product-${this.productId}-subscribed`);
72
+ this.isVisitorSubscribed = !this.notifyOptionsAvailability ? salla.storage.get(`product-${this.productId}-subscribed`) : '';
73
73
  }
74
74
  channelsWatcher(newValue) {
75
75
  this.channels_ = !!newValue ? newValue.split(',') : [];
@@ -98,6 +98,7 @@ const SallaProductAvailability = /*@__PURE__*/ proxyCustomElement(class extends
98
98
  .then(() => {
99
99
  if (!this.notifyOptionsAvailability) {
100
100
  salla.storage.set(`product-${this.productId}-subscribed`, true);
101
+ this.isSubscribed = true;
101
102
  return;
102
103
  }
103
104
  if (payload.options.length) {
@@ -106,12 +107,12 @@ const SallaProductAvailability = /*@__PURE__*/ proxyCustomElement(class extends
106
107
  if (!options.includes(selectedOptionsString)) {
107
108
  options.push(selectedOptionsString);
108
109
  salla.storage.set(`product-${this.productId}-subscribed-options`, options);
110
+ this.isSubscribed = true;
109
111
  }
110
112
  else {
111
113
  salla.log('already subscribed to this options');
112
114
  }
113
115
  }
114
- this.isSubscribed = true;
115
116
  })
116
117
  .then(() => this.btn.stop())
117
118
  .then(() => this.modal.close())
@@ -300,7 +300,7 @@ const SallaProductOptions$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
300
300
  getOptionDetailName(detail, outOfStock = true, optionType) {
301
301
  if (optionType && optionType == DisplayType.COLOR) {
302
302
  return detail.name
303
- + ((outOfStock && this.isOptionDetailOut(detail)) ? ` <br/> <p> ${this.outOfStockText} </p>` : '')
303
+ + ((outOfStock && this.isOptionDetailOut(detail)) ? ` <br/> <p> ${salla.lang.get("pages.products.out_of_stock")} </p>` : '')
304
304
  + (detail.additional_price ? ` <p> (${salla.money(detail.additional_price)}) </p>` : '');
305
305
  }
306
306
  return detail.name
@@ -2470,7 +2470,7 @@ const SallaQuickBuy = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
2470
2470
  requiredShippingContactFields: this.isRequireShipping ? ['postalAddress'] : null,
2471
2471
  shippingMethods: this.isRequireShipping ? [] : null,
2472
2472
  supportedNetworks: salla.config.get('store.settings.buy_now.networks'),
2473
- // supportedCountries: data.applepay_supported_networks, // todo :: later get it from store settings with countries
2473
+ supportedCountries: salla.config.get('store.settings.buy_now.countries'),
2474
2474
  validateMerchant: {
2475
2475
  url: salla.url.get('checkout/applepay/validate'),
2476
2476
  onSuccess: () => {
@@ -2552,7 +2552,9 @@ const SallaQuickBuy = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
2552
2552
  if (salla.url.is_page('product.single')) {
2553
2553
  salla.product.event.onPriceUpdated(response => this.amount = response.data.price);
2554
2554
  }
2555
- this.isApplePayActive = ((_a = window.ApplePaySession) === null || _a === void 0 ? void 0 : _a.canMakePayments()) && ((_b = salla.config.get('store.settings.payments')) === null || _b === void 0 ? void 0 : _b.includes('apple_pay'));
2555
+ this.isApplePayActive = ((_a = window.ApplePaySession) === null || _a === void 0 ? void 0 : _a.canMakePayments())
2556
+ && ((_b = salla.config.get('store.settings.payments')) === null || _b === void 0 ? void 0 : _b.includes('apple_pay'))
2557
+ && salla.config.get('user.currency_code') === 'SAR';
2556
2558
  let applePaySdk = document.getElementById('apple-pay-sdk');
2557
2559
  if (applePaySdk || !this.isApplePayActive) {
2558
2560
  salla.logger.warn('🍏 Pay: Skipped load apple pay because ' + (applePaySdk ? 'already loaded' : 'is not available in the browser'));
@@ -23287,7 +23287,7 @@ const SallaProductAvailability = class {
23287
23287
  this.title_ = this.host.title || salla.lang.get('pages.products.notify_availability_title');
23288
23288
  this.host.removeAttribute('title');
23289
23289
  //todo:: fix this to cover options too
23290
- this.isVisitorSubscribed = ''; //salla.storage.get(`product-${this.productId}-subscribed`);
23290
+ this.isVisitorSubscribed = !this.notifyOptionsAvailability ? salla.storage.get(`product-${this.productId}-subscribed`) : '';
23291
23291
  }
23292
23292
  channelsWatcher(newValue) {
23293
23293
  this.channels_ = !!newValue ? newValue.split(',') : [];
@@ -23316,6 +23316,7 @@ const SallaProductAvailability = class {
23316
23316
  .then(() => {
23317
23317
  if (!this.notifyOptionsAvailability) {
23318
23318
  salla.storage.set(`product-${this.productId}-subscribed`, true);
23319
+ this.isSubscribed = true;
23319
23320
  return;
23320
23321
  }
23321
23322
  if (payload.options.length) {
@@ -23324,12 +23325,12 @@ const SallaProductAvailability = class {
23324
23325
  if (!options.includes(selectedOptionsString)) {
23325
23326
  options.push(selectedOptionsString);
23326
23327
  salla.storage.set(`product-${this.productId}-subscribed-options`, options);
23328
+ this.isSubscribed = true;
23327
23329
  }
23328
23330
  else {
23329
23331
  salla.log('already subscribed to this options');
23330
23332
  }
23331
23333
  }
23332
- this.isSubscribed = true;
23333
23334
  })
23334
23335
  .then(() => this.btn.stop())
23335
23336
  .then(() => this.modal.close())
@@ -26050,7 +26051,7 @@ const SallaQuickBuy = class {
26050
26051
  requiredShippingContactFields: this.isRequireShipping ? ['postalAddress'] : null,
26051
26052
  shippingMethods: this.isRequireShipping ? [] : null,
26052
26053
  supportedNetworks: salla.config.get('store.settings.buy_now.networks'),
26053
- // supportedCountries: data.applepay_supported_networks, // todo :: later get it from store settings with countries
26054
+ supportedCountries: salla.config.get('store.settings.buy_now.countries'),
26054
26055
  validateMerchant: {
26055
26056
  url: salla.url.get('checkout/applepay/validate'),
26056
26057
  onSuccess: () => {
@@ -26132,7 +26133,9 @@ const SallaQuickBuy = class {
26132
26133
  if (salla.url.is_page('product.single')) {
26133
26134
  salla.product.event.onPriceUpdated(response => this.amount = response.data.price);
26134
26135
  }
26135
- this.isApplePayActive = ((_a = window.ApplePaySession) === null || _a === void 0 ? void 0 : _a.canMakePayments()) && ((_b = salla.config.get('store.settings.payments')) === null || _b === void 0 ? void 0 : _b.includes('apple_pay'));
26136
+ this.isApplePayActive = ((_a = window.ApplePaySession) === null || _a === void 0 ? void 0 : _a.canMakePayments())
26137
+ && ((_b = salla.config.get('store.settings.payments')) === null || _b === void 0 ? void 0 : _b.includes('apple_pay'))
26138
+ && salla.config.get('user.currency_code') === 'SAR';
26136
26139
  let applePaySdk = document.getElementById('apple-pay-sdk');
26137
26140
  if (applePaySdk || !this.isApplePayActive) {
26138
26141
  salla.logger.warn('🍏 Pay: Skipped load apple pay because ' + (applePaySdk ? 'already loaded' : 'is not available in the browser'));
@@ -290,7 +290,7 @@ const SallaProductOptions = class {
290
290
  getOptionDetailName(detail, outOfStock = true, optionType) {
291
291
  if (optionType && optionType == DisplayType.COLOR) {
292
292
  return detail.name
293
- + ((outOfStock && this.isOptionDetailOut(detail)) ? ` <br/> <p> ${this.outOfStockText} </p>` : '')
293
+ + ((outOfStock && this.isOptionDetailOut(detail)) ? ` <br/> <p> ${salla.lang.get("pages.products.out_of_stock")} </p>` : '')
294
294
  + (detail.additional_price ? ` <p> (${salla.money(detail.additional_price)}) </p>` : '');
295
295
  }
296
296
  return detail.name