@salla.sa/twilight-components 2.11.73 → 2.11.74
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/salla-button_37.cjs.entry.js +12 -16
- package/dist/collection/components/salla-quick-buy/salla-quick-buy.js +17 -22
- package/dist/components/salla-quick-buy2.js +12 -16
- package/dist/esm/salla-button_37.entry.js +12 -16
- package/dist/esm-es5/salla-button_37.entry.js +1 -1
- package/dist/twilight/p-60fb9bb5.system.js +1 -1
- package/dist/twilight/{p-39a28c32.system.entry.js → p-d83b448f.system.entry.js} +1 -1
- package/dist/twilight/{p-b2216a7f.entry.js → p-f5678286.entry.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/components/salla-quick-buy/salla-quick-buy.d.ts +4 -4
- package/dist/types/components.d.ts +8 -8
- package/package.json +2 -2
|
@@ -25998,16 +25998,9 @@ const SallaQuickBuy = class {
|
|
|
25998
25998
|
* Button type.
|
|
25999
25999
|
*
|
|
26000
26000
|
* @type {string}
|
|
26001
|
-
* @default
|
|
26001
|
+
* @default buy
|
|
26002
26002
|
**/
|
|
26003
26003
|
this.type = 'buy';
|
|
26004
|
-
/**
|
|
26005
|
-
* Product amount.
|
|
26006
|
-
*
|
|
26007
|
-
* @type {number}
|
|
26008
|
-
* @default 0
|
|
26009
|
-
**/
|
|
26010
|
-
this.amount = 0;
|
|
26011
26004
|
/**
|
|
26012
26005
|
* Product options, if is empty will get the data from the document.querySelector('salla-product-options[product-id="X"]')
|
|
26013
26006
|
*
|
|
@@ -26051,7 +26044,7 @@ const SallaQuickBuy = class {
|
|
|
26051
26044
|
// noinspection TypeScriptValidateJSTypes
|
|
26052
26045
|
salla.event.dispatch('payments::apple-pay.start-transaction', {
|
|
26053
26046
|
amount: this.amount,
|
|
26054
|
-
currency: this.currency,
|
|
26047
|
+
currency: this.currency || 'SAR',
|
|
26055
26048
|
requiredShippingContactFields: this.isRequireShipping ? ['postalAddress'] : null,
|
|
26056
26049
|
shippingMethods: this.isRequireShipping ? [] : null,
|
|
26057
26050
|
supportedNetworks: salla.config.get('store.settings.buy_now.networks'),
|
|
@@ -26110,10 +26103,10 @@ const SallaQuickBuy = class {
|
|
|
26110
26103
|
componentWillLoad() {
|
|
26111
26104
|
return new Promise((resolve, reject) => {
|
|
26112
26105
|
salla.onReady(async () => {
|
|
26106
|
+
// if (!this.currency) {
|
|
26107
|
+
// this.currency = salla.config.get('user.currency_code');
|
|
26108
|
+
// }
|
|
26113
26109
|
var _a, _b;
|
|
26114
|
-
if (!this.currency) {
|
|
26115
|
-
this.currency = salla.config.get('user.currency_code');
|
|
26116
|
-
}
|
|
26117
26110
|
if (!this.productId && salla.config.get('page.id')) {
|
|
26118
26111
|
this.productId = salla.config.get('page.id');
|
|
26119
26112
|
}
|
|
@@ -26127,7 +26120,8 @@ const SallaQuickBuy = class {
|
|
|
26127
26120
|
if (!this.amount && this.productId) {
|
|
26128
26121
|
await salla.product.getDetails(this.productId, []).then((response) => {
|
|
26129
26122
|
var _a;
|
|
26130
|
-
this.amount = response.data.
|
|
26123
|
+
this.amount = response.data.base_currency_price.amount;
|
|
26124
|
+
this.currency = response.data.base_currency_price.currency;
|
|
26131
26125
|
this.isRequireShipping = ((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.is_require_shipping) || false;
|
|
26132
26126
|
}).catch((error) => {
|
|
26133
26127
|
salla.logger.warn('🍏 Pay: Failed load the quick buy, get the product details failed: ', error);
|
|
@@ -26135,11 +26129,13 @@ const SallaQuickBuy = class {
|
|
|
26135
26129
|
});
|
|
26136
26130
|
}
|
|
26137
26131
|
if (salla.url.is_page('product.single')) {
|
|
26138
|
-
salla.product.event.onPriceUpdated(response =>
|
|
26132
|
+
salla.product.event.onPriceUpdated(response => {
|
|
26133
|
+
this.amount = response.data.base_currency_price.amount;
|
|
26134
|
+
this.currency = response.data.base_currency_price.currency;
|
|
26135
|
+
});
|
|
26139
26136
|
}
|
|
26140
26137
|
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';
|
|
26138
|
+
&& ((_b = salla.config.get('store.settings.payments')) === null || _b === void 0 ? void 0 : _b.includes('apple_pay'));
|
|
26143
26139
|
let applePaySdk = document.getElementById('apple-pay-sdk');
|
|
26144
26140
|
if (applePaySdk || !this.isApplePayActive) {
|
|
26145
26141
|
salla.logger.warn('🍏 Pay: Skipped load apple pay because ' + (applePaySdk ? 'already loaded' : 'is not available in the browser'));
|
|
@@ -10,16 +10,9 @@ export class SallaQuickBuy {
|
|
|
10
10
|
* Button type.
|
|
11
11
|
*
|
|
12
12
|
* @type {string}
|
|
13
|
-
* @default
|
|
13
|
+
* @default buy
|
|
14
14
|
**/
|
|
15
15
|
this.type = 'buy';
|
|
16
|
-
/**
|
|
17
|
-
* Product amount.
|
|
18
|
-
*
|
|
19
|
-
* @type {number}
|
|
20
|
-
* @default 0
|
|
21
|
-
**/
|
|
22
|
-
this.amount = 0;
|
|
23
16
|
/**
|
|
24
17
|
* Product options, if is empty will get the data from the document.querySelector('salla-product-options[product-id="X"]')
|
|
25
18
|
*
|
|
@@ -63,7 +56,7 @@ export class SallaQuickBuy {
|
|
|
63
56
|
// noinspection TypeScriptValidateJSTypes
|
|
64
57
|
salla.event.dispatch('payments::apple-pay.start-transaction', {
|
|
65
58
|
amount: this.amount,
|
|
66
|
-
currency: this.currency,
|
|
59
|
+
currency: this.currency || 'SAR',
|
|
67
60
|
requiredShippingContactFields: this.isRequireShipping ? ['postalAddress'] : null,
|
|
68
61
|
shippingMethods: this.isRequireShipping ? [] : null,
|
|
69
62
|
supportedNetworks: salla.config.get('store.settings.buy_now.networks'),
|
|
@@ -122,10 +115,10 @@ export class SallaQuickBuy {
|
|
|
122
115
|
componentWillLoad() {
|
|
123
116
|
return new Promise((resolve, reject) => {
|
|
124
117
|
salla.onReady(async () => {
|
|
118
|
+
// if (!this.currency) {
|
|
119
|
+
// this.currency = salla.config.get('user.currency_code');
|
|
120
|
+
// }
|
|
125
121
|
var _a, _b;
|
|
126
|
-
if (!this.currency) {
|
|
127
|
-
this.currency = salla.config.get('user.currency_code');
|
|
128
|
-
}
|
|
129
122
|
if (!this.productId && salla.config.get('page.id')) {
|
|
130
123
|
this.productId = salla.config.get('page.id');
|
|
131
124
|
}
|
|
@@ -139,7 +132,8 @@ export class SallaQuickBuy {
|
|
|
139
132
|
if (!this.amount && this.productId) {
|
|
140
133
|
await salla.product.getDetails(this.productId, []).then((response) => {
|
|
141
134
|
var _a;
|
|
142
|
-
this.amount = response.data.
|
|
135
|
+
this.amount = response.data.base_currency_price.amount;
|
|
136
|
+
this.currency = response.data.base_currency_price.currency;
|
|
143
137
|
this.isRequireShipping = ((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.is_require_shipping) || false;
|
|
144
138
|
}).catch((error) => {
|
|
145
139
|
salla.logger.warn('🍏 Pay: Failed load the quick buy, get the product details failed: ', error);
|
|
@@ -147,11 +141,13 @@ export class SallaQuickBuy {
|
|
|
147
141
|
});
|
|
148
142
|
}
|
|
149
143
|
if (salla.url.is_page('product.single')) {
|
|
150
|
-
salla.product.event.onPriceUpdated(response =>
|
|
144
|
+
salla.product.event.onPriceUpdated(response => {
|
|
145
|
+
this.amount = response.data.base_currency_price.amount;
|
|
146
|
+
this.currency = response.data.base_currency_price.currency;
|
|
147
|
+
});
|
|
151
148
|
}
|
|
152
149
|
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';
|
|
150
|
+
&& ((_b = salla.config.get('store.settings.payments')) === null || _b === void 0 ? void 0 : _b.includes('apple_pay'));
|
|
155
151
|
let applePaySdk = document.getElementById('apple-pay-sdk');
|
|
156
152
|
if (applePaySdk || !this.isApplePayActive) {
|
|
157
153
|
salla.logger.warn('🍏 Pay: Skipped load apple pay because ' + (applePaySdk ? 'already loaded' : 'is not available in the browser'));
|
|
@@ -202,7 +198,7 @@ export class SallaQuickBuy {
|
|
|
202
198
|
"text": "{string}"
|
|
203
199
|
}, {
|
|
204
200
|
"name": "default",
|
|
205
|
-
"text": "
|
|
201
|
+
"text": "buy"
|
|
206
202
|
}],
|
|
207
203
|
"text": "Button type."
|
|
208
204
|
},
|
|
@@ -248,11 +244,10 @@ export class SallaQuickBuy {
|
|
|
248
244
|
"name": "default",
|
|
249
245
|
"text": "0"
|
|
250
246
|
}],
|
|
251
|
-
"text": "Product amount."
|
|
247
|
+
"text": "Product amount in base currency (SAR)."
|
|
252
248
|
},
|
|
253
249
|
"attribute": "amount",
|
|
254
|
-
"reflect": true
|
|
255
|
-
"defaultValue": "0"
|
|
250
|
+
"reflect": true
|
|
256
251
|
},
|
|
257
252
|
"currency": {
|
|
258
253
|
"type": "string",
|
|
@@ -270,9 +265,9 @@ export class SallaQuickBuy {
|
|
|
270
265
|
"text": "{string}"
|
|
271
266
|
}, {
|
|
272
267
|
"name": "default",
|
|
273
|
-
"text": "
|
|
268
|
+
"text": "SAR"
|
|
274
269
|
}],
|
|
275
|
-
"text": "
|
|
270
|
+
"text": "base currency"
|
|
276
271
|
},
|
|
277
272
|
"attribute": "currency",
|
|
278
273
|
"reflect": false
|
|
@@ -2413,16 +2413,9 @@ const SallaQuickBuy = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
2413
2413
|
* Button type.
|
|
2414
2414
|
*
|
|
2415
2415
|
* @type {string}
|
|
2416
|
-
* @default
|
|
2416
|
+
* @default buy
|
|
2417
2417
|
**/
|
|
2418
2418
|
this.type = 'buy';
|
|
2419
|
-
/**
|
|
2420
|
-
* Product amount.
|
|
2421
|
-
*
|
|
2422
|
-
* @type {number}
|
|
2423
|
-
* @default 0
|
|
2424
|
-
**/
|
|
2425
|
-
this.amount = 0;
|
|
2426
2419
|
/**
|
|
2427
2420
|
* Product options, if is empty will get the data from the document.querySelector('salla-product-options[product-id="X"]')
|
|
2428
2421
|
*
|
|
@@ -2466,7 +2459,7 @@ const SallaQuickBuy = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
2466
2459
|
// noinspection TypeScriptValidateJSTypes
|
|
2467
2460
|
salla.event.dispatch('payments::apple-pay.start-transaction', {
|
|
2468
2461
|
amount: this.amount,
|
|
2469
|
-
currency: this.currency,
|
|
2462
|
+
currency: this.currency || 'SAR',
|
|
2470
2463
|
requiredShippingContactFields: this.isRequireShipping ? ['postalAddress'] : null,
|
|
2471
2464
|
shippingMethods: this.isRequireShipping ? [] : null,
|
|
2472
2465
|
supportedNetworks: salla.config.get('store.settings.buy_now.networks'),
|
|
@@ -2525,10 +2518,10 @@ const SallaQuickBuy = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
2525
2518
|
componentWillLoad() {
|
|
2526
2519
|
return new Promise((resolve, reject) => {
|
|
2527
2520
|
salla.onReady(async () => {
|
|
2521
|
+
// if (!this.currency) {
|
|
2522
|
+
// this.currency = salla.config.get('user.currency_code');
|
|
2523
|
+
// }
|
|
2528
2524
|
var _a, _b;
|
|
2529
|
-
if (!this.currency) {
|
|
2530
|
-
this.currency = salla.config.get('user.currency_code');
|
|
2531
|
-
}
|
|
2532
2525
|
if (!this.productId && salla.config.get('page.id')) {
|
|
2533
2526
|
this.productId = salla.config.get('page.id');
|
|
2534
2527
|
}
|
|
@@ -2542,7 +2535,8 @@ const SallaQuickBuy = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
2542
2535
|
if (!this.amount && this.productId) {
|
|
2543
2536
|
await salla.product.getDetails(this.productId, []).then((response) => {
|
|
2544
2537
|
var _a;
|
|
2545
|
-
this.amount = response.data.
|
|
2538
|
+
this.amount = response.data.base_currency_price.amount;
|
|
2539
|
+
this.currency = response.data.base_currency_price.currency;
|
|
2546
2540
|
this.isRequireShipping = ((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.is_require_shipping) || false;
|
|
2547
2541
|
}).catch((error) => {
|
|
2548
2542
|
salla.logger.warn('🍏 Pay: Failed load the quick buy, get the product details failed: ', error);
|
|
@@ -2550,11 +2544,13 @@ const SallaQuickBuy = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
2550
2544
|
});
|
|
2551
2545
|
}
|
|
2552
2546
|
if (salla.url.is_page('product.single')) {
|
|
2553
|
-
salla.product.event.onPriceUpdated(response =>
|
|
2547
|
+
salla.product.event.onPriceUpdated(response => {
|
|
2548
|
+
this.amount = response.data.base_currency_price.amount;
|
|
2549
|
+
this.currency = response.data.base_currency_price.currency;
|
|
2550
|
+
});
|
|
2554
2551
|
}
|
|
2555
2552
|
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';
|
|
2553
|
+
&& ((_b = salla.config.get('store.settings.payments')) === null || _b === void 0 ? void 0 : _b.includes('apple_pay'));
|
|
2558
2554
|
let applePaySdk = document.getElementById('apple-pay-sdk');
|
|
2559
2555
|
if (applePaySdk || !this.isApplePayActive) {
|
|
2560
2556
|
salla.logger.warn('🍏 Pay: Skipped load apple pay because ' + (applePaySdk ? 'already loaded' : 'is not available in the browser'));
|
|
@@ -25994,16 +25994,9 @@ const SallaQuickBuy = class {
|
|
|
25994
25994
|
* Button type.
|
|
25995
25995
|
*
|
|
25996
25996
|
* @type {string}
|
|
25997
|
-
* @default
|
|
25997
|
+
* @default buy
|
|
25998
25998
|
**/
|
|
25999
25999
|
this.type = 'buy';
|
|
26000
|
-
/**
|
|
26001
|
-
* Product amount.
|
|
26002
|
-
*
|
|
26003
|
-
* @type {number}
|
|
26004
|
-
* @default 0
|
|
26005
|
-
**/
|
|
26006
|
-
this.amount = 0;
|
|
26007
26000
|
/**
|
|
26008
26001
|
* Product options, if is empty will get the data from the document.querySelector('salla-product-options[product-id="X"]')
|
|
26009
26002
|
*
|
|
@@ -26047,7 +26040,7 @@ const SallaQuickBuy = class {
|
|
|
26047
26040
|
// noinspection TypeScriptValidateJSTypes
|
|
26048
26041
|
salla.event.dispatch('payments::apple-pay.start-transaction', {
|
|
26049
26042
|
amount: this.amount,
|
|
26050
|
-
currency: this.currency,
|
|
26043
|
+
currency: this.currency || 'SAR',
|
|
26051
26044
|
requiredShippingContactFields: this.isRequireShipping ? ['postalAddress'] : null,
|
|
26052
26045
|
shippingMethods: this.isRequireShipping ? [] : null,
|
|
26053
26046
|
supportedNetworks: salla.config.get('store.settings.buy_now.networks'),
|
|
@@ -26106,10 +26099,10 @@ const SallaQuickBuy = class {
|
|
|
26106
26099
|
componentWillLoad() {
|
|
26107
26100
|
return new Promise((resolve, reject) => {
|
|
26108
26101
|
salla.onReady(async () => {
|
|
26102
|
+
// if (!this.currency) {
|
|
26103
|
+
// this.currency = salla.config.get('user.currency_code');
|
|
26104
|
+
// }
|
|
26109
26105
|
var _a, _b;
|
|
26110
|
-
if (!this.currency) {
|
|
26111
|
-
this.currency = salla.config.get('user.currency_code');
|
|
26112
|
-
}
|
|
26113
26106
|
if (!this.productId && salla.config.get('page.id')) {
|
|
26114
26107
|
this.productId = salla.config.get('page.id');
|
|
26115
26108
|
}
|
|
@@ -26123,7 +26116,8 @@ const SallaQuickBuy = class {
|
|
|
26123
26116
|
if (!this.amount && this.productId) {
|
|
26124
26117
|
await salla.product.getDetails(this.productId, []).then((response) => {
|
|
26125
26118
|
var _a;
|
|
26126
|
-
this.amount = response.data.
|
|
26119
|
+
this.amount = response.data.base_currency_price.amount;
|
|
26120
|
+
this.currency = response.data.base_currency_price.currency;
|
|
26127
26121
|
this.isRequireShipping = ((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.is_require_shipping) || false;
|
|
26128
26122
|
}).catch((error) => {
|
|
26129
26123
|
salla.logger.warn('🍏 Pay: Failed load the quick buy, get the product details failed: ', error);
|
|
@@ -26131,11 +26125,13 @@ const SallaQuickBuy = class {
|
|
|
26131
26125
|
});
|
|
26132
26126
|
}
|
|
26133
26127
|
if (salla.url.is_page('product.single')) {
|
|
26134
|
-
salla.product.event.onPriceUpdated(response =>
|
|
26128
|
+
salla.product.event.onPriceUpdated(response => {
|
|
26129
|
+
this.amount = response.data.base_currency_price.amount;
|
|
26130
|
+
this.currency = response.data.base_currency_price.currency;
|
|
26131
|
+
});
|
|
26135
26132
|
}
|
|
26136
26133
|
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';
|
|
26134
|
+
&& ((_b = salla.config.get('store.settings.payments')) === null || _b === void 0 ? void 0 : _b.includes('apple_pay'));
|
|
26139
26135
|
let applePaySdk = document.getElementById('apple-pay-sdk');
|
|
26140
26136
|
if (applePaySdk || !this.isApplePayActive) {
|
|
26141
26137
|
salla.logger.warn('🍏 Pay: Skipped load apple pay because ' + (applePaySdk ? 'already loaded' : 'is not available in the browser'));
|