@salla.sa/twilight-components 2.11.81 → 2.11.83
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-add-product-button.cjs.entry.js +10 -3
- package/dist/cjs/salla-button_37.cjs.entry.js +10 -5
- package/dist/collection/components/salla-add-product-button/salla-add-product-button.js +10 -3
- package/dist/collection/components/salla-count-down/salla-count-down.js +4 -1
- package/dist/collection/components/salla-quick-buy/salla-quick-buy.js +3 -2
- package/dist/collection/components/salla-verify/salla-verify.js +1 -1
- package/dist/components/salla-add-product-button.js +10 -3
- package/dist/components/salla-count-down.js +4 -1
- package/dist/components/salla-quick-buy2.js +5 -3
- package/dist/components/salla-verify2.js +1 -1
- package/dist/esm/salla-add-product-button.entry.js +10 -3
- package/dist/esm/salla-button_37.entry.js +10 -5
- package/dist/esm-es5/salla-add-product-button.entry.js +1 -1
- package/dist/esm-es5/salla-button_37.entry.js +2 -2
- package/dist/twilight/{p-69b00700.system.entry.js → p-244303eb.system.entry.js} +1 -1
- package/dist/twilight/p-2845b9fd.system.js +1 -1
- package/dist/twilight/p-7707edf6.entry.js +4 -0
- package/dist/twilight/{p-eb1ead89.entry.js → p-8e030b88.entry.js} +2 -2
- package/dist/twilight/{p-bbbcd73e.system.entry.js → p-c3b17cfd.system.entry.js} +2 -2
- package/dist/twilight/twilight.esm.js +1 -1
- package/package.json +4 -4
- package/dist/twilight/p-5eeea91d.entry.js +0 -4
|
@@ -92,7 +92,12 @@ const SallaAddProductButton = class {
|
|
|
92
92
|
return Object.assign(Object.assign({}, this.getBtnAttributes()), { type: this.supportStickyBar && window.innerWidth <= 768 ? 'plain' : this.productType == 'donating' ? 'donate' : 'buy' });
|
|
93
93
|
}
|
|
94
94
|
componentWillLoad() {
|
|
95
|
+
var _a;
|
|
95
96
|
this.passedLabel = this.host.innerHTML.replace('<!---->', '').trim();
|
|
97
|
+
if (!!this.passedLabel && window.innerWidth >= 768) {
|
|
98
|
+
(_a = this.btn) === null || _a === void 0 ? void 0 : _a.setText(this.passedLabel);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
96
101
|
if (this.host.hasAttribute('type') && this.host.getAttribute('type') === 'submit' && this.supportStickyBar) {
|
|
97
102
|
window.addEventListener('resize', () => {
|
|
98
103
|
var _a, _b;
|
|
@@ -145,12 +150,14 @@ const SallaAddProductButton = class {
|
|
|
145
150
|
});
|
|
146
151
|
}
|
|
147
152
|
componentDidRender() {
|
|
148
|
-
var _a;
|
|
153
|
+
var _a, _b;
|
|
149
154
|
//if label not passed, get label
|
|
150
|
-
if (!!this.passedLabel && !this.supportStickyBar) {
|
|
155
|
+
if (!!this.passedLabel && (!this.supportStickyBar || window.innerWidth >= 768)) {
|
|
156
|
+
// if passed label, set it
|
|
157
|
+
(_a = this.btn) === null || _a === void 0 ? void 0 : _a.setText(this.passedLabel);
|
|
151
158
|
return;
|
|
152
159
|
}
|
|
153
|
-
(
|
|
160
|
+
(_b = this.btn) === null || _b === void 0 ? void 0 : _b.setText(this.getLabel());
|
|
154
161
|
salla.lang.onLoaded(() => { var _a; return (_a = this.btn) === null || _a === void 0 ? void 0 : _a.setText(this.getLabel()); });
|
|
155
162
|
}
|
|
156
163
|
get host() { return index.getElement(this); }
|
|
@@ -2740,7 +2740,10 @@ const SallaCountDown = class {
|
|
|
2740
2740
|
this.startCountDown();
|
|
2741
2741
|
}
|
|
2742
2742
|
render() {
|
|
2743
|
-
if (!this.
|
|
2743
|
+
if (!this.date) {
|
|
2744
|
+
return;
|
|
2745
|
+
}
|
|
2746
|
+
else if (this.date && !this.isValidDate(this.date)) {
|
|
2744
2747
|
return index.h("div", { class: "s-count-down-text-center" }, this.invalidDate);
|
|
2745
2748
|
}
|
|
2746
2749
|
return (index.h(index.Host, { class: "s-count-down-wrapper" }, index.h("ul", { class: `s-count-down-list ${this.boxed ? 's-count-down-boxed' : ''} ${this.offerEnded ? 's-count-down-ended' : ''} s-count-down-${this.size} s-count-down-${this.color}` }, index.h("li", { class: "s-count-down-item" }, index.h("div", { class: "s-count-down-item-value", ref: el => this.secondsEl = el }, this.number(0)), this.labeled && index.h("div", { class: "s-count-down-item-label" }, this.secondsLabel)), index.h("li", { class: "s-count-down-item" }, index.h("div", { class: "s-count-down-item-value", ref: el => this.minutesEl = el }, this.number(0)), this.labeled && index.h("div", { class: "s-count-down-item-label" }, this.minutesLabel)), index.h("li", { class: "s-count-down-item" }, index.h("div", { class: "s-count-down-item-value", ref: el => this.hoursEl = el }, this.number(0)), this.labeled && index.h("div", { class: "s-count-down-item-label" }, this.hoursLabel)), index.h("li", { class: "s-count-down-item" }, index.h("div", { class: "s-count-down-item-value", ref: el => this.daysEl = el }, this.number(0)), this.labeled && index.h("div", { class: "s-count-down-item-label" }, this.daysLabel))), this.offerEnded && index.h("div", { class: "s-count-down-end-text" }, !!this.endText ? this.endText : this.endLabel)));
|
|
@@ -25995,7 +25998,8 @@ window.SallaApplePay = {
|
|
|
25995
25998
|
}))
|
|
25996
25999
|
};
|
|
25997
26000
|
|
|
25998
|
-
|
|
26001
|
+
//applePay doesn't allow iframes
|
|
26002
|
+
if (window.ApplePaySession && undefined.self === undefined.top && ApplePaySession.canMakePayments()) {
|
|
25999
26003
|
SallaApplePay.init();
|
|
26000
26004
|
} else {
|
|
26001
26005
|
// You can hide the Apple Pay button easy with add data-show-if-apple-pay-supported to element like <div data-show-if-apple-pay-supported>
|
|
@@ -26144,11 +26148,12 @@ const SallaQuickBuy = class {
|
|
|
26144
26148
|
this.currency = response.data.base_currency_price.currency;
|
|
26145
26149
|
});
|
|
26146
26150
|
}
|
|
26147
|
-
|
|
26151
|
+
let isNotIframe = window.self !== window.top;
|
|
26152
|
+
this.isApplePayActive = isNotIframe && ((_a = window.ApplePaySession) === null || _a === void 0 ? void 0 : _a.canMakePayments())
|
|
26148
26153
|
&& ((_b = salla.config.get('store.settings.payments')) === null || _b === void 0 ? void 0 : _b.includes('apple_pay'));
|
|
26149
26154
|
let applePaySdk = document.getElementById('apple-pay-sdk');
|
|
26150
26155
|
if (applePaySdk || !this.isApplePayActive) {
|
|
26151
|
-
salla.logger.warn('🍏 Pay: Skipped load apple pay because ' + (applePaySdk ? 'already loaded' : 'is not available in the browser'));
|
|
26156
|
+
salla.logger.warn('🍏 Pay: Skipped load apple pay because ' + (applePaySdk ? 'already loaded' : (isNotIframe ? 'is not available in the browser' : 'is iframe')));
|
|
26152
26157
|
resolve(true);
|
|
26153
26158
|
return;
|
|
26154
26159
|
}
|
|
@@ -29604,7 +29609,7 @@ const SallaVerify = class {
|
|
|
29604
29609
|
}
|
|
29605
29610
|
render() {
|
|
29606
29611
|
return this.display == 'inline' ? index.h(index.Host, null, this.myBody()) :
|
|
29607
|
-
index.h("salla-modal", { width: "xs", class: "s-verify", ref: modal => this.modal = modal, "modal-title": this.title }, index.h("span", { slot: 'icon', innerHTML: this.type == "mobile" ? AndroidPhoneIcon : MailIcon }), this.myBody());
|
|
29612
|
+
index.h("salla-modal", { width: "xs", class: "s-verify", ref: modal => this.modal = modal, "modal-title": this.title }, index.h("span", { slot: 'icon', class: "s-verify-header-icon", innerHTML: this.type == "mobile" ? AndroidPhoneIcon : MailIcon }), this.myBody());
|
|
29608
29613
|
}
|
|
29609
29614
|
myBody() {
|
|
29610
29615
|
return (index.h("div", { class: "s-verify-body", ref: body => this.body = body }, index.h("div", { class: "s-verify-message", innerHTML: salla.lang.get('pages.profile.verify_message') }), index.h("input", { type: "hidden", name: "code", maxlength: "4", required: true, ref: code => this.code = code }), index.h("div", { class: "s-verify-codes", dir: "ltr" }, [1, 2, 3, 4].map(() => index.h("input", { type: "tel", autocomplete: "one-time-code", pattern: "[0-9]*", inputmode: "numeric", maxlength: "1", class: "s-verify-input", onInput: e => salla.helpers.inputDigitsOnly(e.target), onPaste: e => this.handlePaste(e), onKeyUp: e => this.handleKeyUp(e), required: true }))), index.h("div", { slot: "footer", class: "s-verify-footer" }, index.h("salla-button", { class: "s-verify-submit", "loader-position": 'center', disabled: true, onClick: () => this.submit(), ref: b => this.btn = b }, salla.lang.get('pages.profile.verify')), index.h("p", { class: "s-verify-resend-message", ref: el => this.resendMessage = el }, salla.lang.get('blocks.header.resend_after'), index.h("b", { class: "s-verify-timer", ref: el => this.timer = el })), index.h("a", { href: "#", class: "s-verify-resend", onClick: () => this.resendCode(), ref: el => this.resend = el }, salla.lang.get('blocks.comments.submit'))), index.h("slot", { name: "after-footer" })));
|
|
@@ -82,7 +82,12 @@ export class SallaAddProductButton {
|
|
|
82
82
|
return Object.assign(Object.assign({}, this.getBtnAttributes()), { type: this.supportStickyBar && window.innerWidth <= 768 ? 'plain' : this.productType == 'donating' ? 'donate' : 'buy' });
|
|
83
83
|
}
|
|
84
84
|
componentWillLoad() {
|
|
85
|
+
var _a;
|
|
85
86
|
this.passedLabel = this.host.innerHTML.replace('<!---->', '').trim();
|
|
87
|
+
if (!!this.passedLabel && window.innerWidth >= 768) {
|
|
88
|
+
(_a = this.btn) === null || _a === void 0 ? void 0 : _a.setText(this.passedLabel);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
86
91
|
if (this.host.hasAttribute('type') && this.host.getAttribute('type') === 'submit' && this.supportStickyBar) {
|
|
87
92
|
window.addEventListener('resize', () => {
|
|
88
93
|
var _a, _b;
|
|
@@ -144,12 +149,14 @@ export class SallaAddProductButton {
|
|
|
144
149
|
});
|
|
145
150
|
}
|
|
146
151
|
componentDidRender() {
|
|
147
|
-
var _a;
|
|
152
|
+
var _a, _b;
|
|
148
153
|
//if label not passed, get label
|
|
149
|
-
if (!!this.passedLabel && !this.supportStickyBar) {
|
|
154
|
+
if (!!this.passedLabel && (!this.supportStickyBar || window.innerWidth >= 768)) {
|
|
155
|
+
// if passed label, set it
|
|
156
|
+
(_a = this.btn) === null || _a === void 0 ? void 0 : _a.setText(this.passedLabel);
|
|
150
157
|
return;
|
|
151
158
|
}
|
|
152
|
-
(
|
|
159
|
+
(_b = this.btn) === null || _b === void 0 ? void 0 : _b.setText(this.getLabel());
|
|
153
160
|
salla.lang.onLoaded(() => { var _a; return (_a = this.btn) === null || _a === void 0 ? void 0 : _a.setText(this.getLabel()); });
|
|
154
161
|
}
|
|
155
162
|
static get is() { return "salla-add-product-button"; }
|
|
@@ -68,7 +68,10 @@ export class SallaCountDown {
|
|
|
68
68
|
this.startCountDown();
|
|
69
69
|
}
|
|
70
70
|
render() {
|
|
71
|
-
if (!this.
|
|
71
|
+
if (!this.date) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
else if (this.date && !this.isValidDate(this.date)) {
|
|
72
75
|
return h("div", { class: "s-count-down-text-center" }, this.invalidDate);
|
|
73
76
|
}
|
|
74
77
|
return (h(Host, { class: "s-count-down-wrapper" },
|
|
@@ -143,11 +143,12 @@ export class SallaQuickBuy {
|
|
|
143
143
|
this.currency = response.data.base_currency_price.currency;
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
|
-
|
|
146
|
+
let isNotIframe = window.self !== window.top;
|
|
147
|
+
this.isApplePayActive = isNotIframe && ((_a = window.ApplePaySession) === null || _a === void 0 ? void 0 : _a.canMakePayments())
|
|
147
148
|
&& ((_b = salla.config.get('store.settings.payments')) === null || _b === void 0 ? void 0 : _b.includes('apple_pay'));
|
|
148
149
|
let applePaySdk = document.getElementById('apple-pay-sdk');
|
|
149
150
|
if (applePaySdk || !this.isApplePayActive) {
|
|
150
|
-
salla.logger.warn('🍏 Pay: Skipped load apple pay because ' + (applePaySdk ? 'already loaded' : 'is not available in the browser'));
|
|
151
|
+
salla.logger.warn('🍏 Pay: Skipped load apple pay because ' + (applePaySdk ? 'already loaded' : (isNotIframe ? 'is not available in the browser' : 'is iframe')));
|
|
151
152
|
resolve(true);
|
|
152
153
|
return;
|
|
153
154
|
}
|
|
@@ -169,7 +169,7 @@ export class SallaVerify {
|
|
|
169
169
|
render() {
|
|
170
170
|
return this.display == 'inline' ? h(Host, null, this.myBody()) :
|
|
171
171
|
h("salla-modal", { width: "xs", class: "s-verify", ref: modal => this.modal = modal, "modal-title": this.title },
|
|
172
|
-
h("span", { slot: 'icon', innerHTML: this.type == "mobile" ? AndroidPhoneIcon : MailIcon }),
|
|
172
|
+
h("span", { slot: 'icon', class: "s-verify-header-icon", innerHTML: this.type == "mobile" ? AndroidPhoneIcon : MailIcon }),
|
|
173
173
|
this.myBody());
|
|
174
174
|
}
|
|
175
175
|
myBody() {
|
|
@@ -95,7 +95,12 @@ const SallaAddProductButton$1 = /*@__PURE__*/ proxyCustomElement(class extends H
|
|
|
95
95
|
return Object.assign(Object.assign({}, this.getBtnAttributes()), { type: this.supportStickyBar && window.innerWidth <= 768 ? 'plain' : this.productType == 'donating' ? 'donate' : 'buy' });
|
|
96
96
|
}
|
|
97
97
|
componentWillLoad() {
|
|
98
|
+
var _a;
|
|
98
99
|
this.passedLabel = this.host.innerHTML.replace('<!---->', '').trim();
|
|
100
|
+
if (!!this.passedLabel && window.innerWidth >= 768) {
|
|
101
|
+
(_a = this.btn) === null || _a === void 0 ? void 0 : _a.setText(this.passedLabel);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
99
104
|
if (this.host.hasAttribute('type') && this.host.getAttribute('type') === 'submit' && this.supportStickyBar) {
|
|
100
105
|
window.addEventListener('resize', () => {
|
|
101
106
|
var _a, _b;
|
|
@@ -148,12 +153,14 @@ const SallaAddProductButton$1 = /*@__PURE__*/ proxyCustomElement(class extends H
|
|
|
148
153
|
});
|
|
149
154
|
}
|
|
150
155
|
componentDidRender() {
|
|
151
|
-
var _a;
|
|
156
|
+
var _a, _b;
|
|
152
157
|
//if label not passed, get label
|
|
153
|
-
if (!!this.passedLabel && !this.supportStickyBar) {
|
|
158
|
+
if (!!this.passedLabel && (!this.supportStickyBar || window.innerWidth >= 768)) {
|
|
159
|
+
// if passed label, set it
|
|
160
|
+
(_a = this.btn) === null || _a === void 0 ? void 0 : _a.setText(this.passedLabel);
|
|
154
161
|
return;
|
|
155
162
|
}
|
|
156
|
-
(
|
|
163
|
+
(_b = this.btn) === null || _b === void 0 ? void 0 : _b.setText(this.getLabel());
|
|
157
164
|
salla.lang.onLoaded(() => { var _a; return (_a = this.btn) === null || _a === void 0 ? void 0 : _a.setText(this.getLabel()); });
|
|
158
165
|
}
|
|
159
166
|
get host() { return this; }
|
|
@@ -73,7 +73,10 @@ const SallaCountDown$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
73
73
|
this.startCountDown();
|
|
74
74
|
}
|
|
75
75
|
render() {
|
|
76
|
-
if (!this.
|
|
76
|
+
if (!this.date) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
else if (this.date && !this.isValidDate(this.date)) {
|
|
77
80
|
return h("div", { class: "s-count-down-text-center" }, this.invalidDate);
|
|
78
81
|
}
|
|
79
82
|
return (h(Host, { class: "s-count-down-wrapper" }, h("ul", { class: `s-count-down-list ${this.boxed ? 's-count-down-boxed' : ''} ${this.offerEnded ? 's-count-down-ended' : ''} s-count-down-${this.size} s-count-down-${this.color}` }, h("li", { class: "s-count-down-item" }, h("div", { class: "s-count-down-item-value", ref: el => this.secondsEl = el }, this.number(0)), this.labeled && h("div", { class: "s-count-down-item-label" }, this.secondsLabel)), h("li", { class: "s-count-down-item" }, h("div", { class: "s-count-down-item-value", ref: el => this.minutesEl = el }, this.number(0)), this.labeled && h("div", { class: "s-count-down-item-label" }, this.minutesLabel)), h("li", { class: "s-count-down-item" }, h("div", { class: "s-count-down-item-value", ref: el => this.hoursEl = el }, this.number(0)), this.labeled && h("div", { class: "s-count-down-item-label" }, this.hoursLabel)), h("li", { class: "s-count-down-item" }, h("div", { class: "s-count-down-item-value", ref: el => this.daysEl = el }, this.number(0)), this.labeled && h("div", { class: "s-count-down-item-label" }, this.daysLabel))), this.offerEnded && h("div", { class: "s-count-down-end-text" }, !!this.endText ? this.endText : this.endLabel)));
|
|
@@ -2396,7 +2396,8 @@ window.SallaApplePay = {
|
|
|
2396
2396
|
}))
|
|
2397
2397
|
};
|
|
2398
2398
|
|
|
2399
|
-
|
|
2399
|
+
//applePay doesn't allow iframes
|
|
2400
|
+
if (window.ApplePaySession && undefined.self === undefined.top && ApplePaySession.canMakePayments()) {
|
|
2400
2401
|
SallaApplePay.init();
|
|
2401
2402
|
} else {
|
|
2402
2403
|
// You can hide the Apple Pay button easy with add data-show-if-apple-pay-supported to element like <div data-show-if-apple-pay-supported>
|
|
@@ -2546,11 +2547,12 @@ const SallaQuickBuy = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
2546
2547
|
this.currency = response.data.base_currency_price.currency;
|
|
2547
2548
|
});
|
|
2548
2549
|
}
|
|
2549
|
-
|
|
2550
|
+
let isNotIframe = window.self !== window.top;
|
|
2551
|
+
this.isApplePayActive = isNotIframe && ((_a = window.ApplePaySession) === null || _a === void 0 ? void 0 : _a.canMakePayments())
|
|
2550
2552
|
&& ((_b = salla.config.get('store.settings.payments')) === null || _b === void 0 ? void 0 : _b.includes('apple_pay'));
|
|
2551
2553
|
let applePaySdk = document.getElementById('apple-pay-sdk');
|
|
2552
2554
|
if (applePaySdk || !this.isApplePayActive) {
|
|
2553
|
-
salla.logger.warn('🍏 Pay: Skipped load apple pay because ' + (applePaySdk ? 'already loaded' : 'is not available in the browser'));
|
|
2555
|
+
salla.logger.warn('🍏 Pay: Skipped load apple pay because ' + (applePaySdk ? 'already loaded' : (isNotIframe ? 'is not available in the browser' : 'is iframe')));
|
|
2554
2556
|
resolve(true);
|
|
2555
2557
|
return;
|
|
2556
2558
|
}
|
|
@@ -179,7 +179,7 @@ const SallaVerify = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
179
179
|
}
|
|
180
180
|
render() {
|
|
181
181
|
return this.display == 'inline' ? h(Host, null, this.myBody()) :
|
|
182
|
-
h("salla-modal", { width: "xs", class: "s-verify", ref: modal => this.modal = modal, "modal-title": this.title }, h("span", { slot: 'icon', innerHTML: this.type == "mobile" ? AndroidPhoneIcon : email }), this.myBody());
|
|
182
|
+
h("salla-modal", { width: "xs", class: "s-verify", ref: modal => this.modal = modal, "modal-title": this.title }, h("span", { slot: 'icon', class: "s-verify-header-icon", innerHTML: this.type == "mobile" ? AndroidPhoneIcon : email }), this.myBody());
|
|
183
183
|
}
|
|
184
184
|
myBody() {
|
|
185
185
|
return (h("div", { class: "s-verify-body", ref: body => this.body = body }, h("div", { class: "s-verify-message", innerHTML: salla.lang.get('pages.profile.verify_message') }), h("input", { type: "hidden", name: "code", maxlength: "4", required: true, ref: code => this.code = code }), h("div", { class: "s-verify-codes", dir: "ltr" }, [1, 2, 3, 4].map(() => h("input", { type: "tel", autocomplete: "one-time-code", pattern: "[0-9]*", inputmode: "numeric", maxlength: "1", class: "s-verify-input", onInput: e => salla.helpers.inputDigitsOnly(e.target), onPaste: e => this.handlePaste(e), onKeyUp: e => this.handleKeyUp(e), required: true }))), h("div", { slot: "footer", class: "s-verify-footer" }, h("salla-button", { class: "s-verify-submit", "loader-position": 'center', disabled: true, onClick: () => this.submit(), ref: b => this.btn = b }, salla.lang.get('pages.profile.verify')), h("p", { class: "s-verify-resend-message", ref: el => this.resendMessage = el }, salla.lang.get('blocks.header.resend_after'), h("b", { class: "s-verify-timer", ref: el => this.timer = el })), h("a", { href: "#", class: "s-verify-resend", onClick: () => this.resendCode(), ref: el => this.resend = el }, salla.lang.get('blocks.comments.submit'))), h("slot", { name: "after-footer" })));
|
|
@@ -88,7 +88,12 @@ const SallaAddProductButton = class {
|
|
|
88
88
|
return Object.assign(Object.assign({}, this.getBtnAttributes()), { type: this.supportStickyBar && window.innerWidth <= 768 ? 'plain' : this.productType == 'donating' ? 'donate' : 'buy' });
|
|
89
89
|
}
|
|
90
90
|
componentWillLoad() {
|
|
91
|
+
var _a;
|
|
91
92
|
this.passedLabel = this.host.innerHTML.replace('<!---->', '').trim();
|
|
93
|
+
if (!!this.passedLabel && window.innerWidth >= 768) {
|
|
94
|
+
(_a = this.btn) === null || _a === void 0 ? void 0 : _a.setText(this.passedLabel);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
92
97
|
if (this.host.hasAttribute('type') && this.host.getAttribute('type') === 'submit' && this.supportStickyBar) {
|
|
93
98
|
window.addEventListener('resize', () => {
|
|
94
99
|
var _a, _b;
|
|
@@ -141,12 +146,14 @@ const SallaAddProductButton = class {
|
|
|
141
146
|
});
|
|
142
147
|
}
|
|
143
148
|
componentDidRender() {
|
|
144
|
-
var _a;
|
|
149
|
+
var _a, _b;
|
|
145
150
|
//if label not passed, get label
|
|
146
|
-
if (!!this.passedLabel && !this.supportStickyBar) {
|
|
151
|
+
if (!!this.passedLabel && (!this.supportStickyBar || window.innerWidth >= 768)) {
|
|
152
|
+
// if passed label, set it
|
|
153
|
+
(_a = this.btn) === null || _a === void 0 ? void 0 : _a.setText(this.passedLabel);
|
|
147
154
|
return;
|
|
148
155
|
}
|
|
149
|
-
(
|
|
156
|
+
(_b = this.btn) === null || _b === void 0 ? void 0 : _b.setText(this.getLabel());
|
|
150
157
|
salla.lang.onLoaded(() => { var _a; return (_a = this.btn) === null || _a === void 0 ? void 0 : _a.setText(this.getLabel()); });
|
|
151
158
|
}
|
|
152
159
|
get host() { return getElement(this); }
|
|
@@ -2736,7 +2736,10 @@ const SallaCountDown = class {
|
|
|
2736
2736
|
this.startCountDown();
|
|
2737
2737
|
}
|
|
2738
2738
|
render() {
|
|
2739
|
-
if (!this.
|
|
2739
|
+
if (!this.date) {
|
|
2740
|
+
return;
|
|
2741
|
+
}
|
|
2742
|
+
else if (this.date && !this.isValidDate(this.date)) {
|
|
2740
2743
|
return h("div", { class: "s-count-down-text-center" }, this.invalidDate);
|
|
2741
2744
|
}
|
|
2742
2745
|
return (h(Host, { class: "s-count-down-wrapper" }, h("ul", { class: `s-count-down-list ${this.boxed ? 's-count-down-boxed' : ''} ${this.offerEnded ? 's-count-down-ended' : ''} s-count-down-${this.size} s-count-down-${this.color}` }, h("li", { class: "s-count-down-item" }, h("div", { class: "s-count-down-item-value", ref: el => this.secondsEl = el }, this.number(0)), this.labeled && h("div", { class: "s-count-down-item-label" }, this.secondsLabel)), h("li", { class: "s-count-down-item" }, h("div", { class: "s-count-down-item-value", ref: el => this.minutesEl = el }, this.number(0)), this.labeled && h("div", { class: "s-count-down-item-label" }, this.minutesLabel)), h("li", { class: "s-count-down-item" }, h("div", { class: "s-count-down-item-value", ref: el => this.hoursEl = el }, this.number(0)), this.labeled && h("div", { class: "s-count-down-item-label" }, this.hoursLabel)), h("li", { class: "s-count-down-item" }, h("div", { class: "s-count-down-item-value", ref: el => this.daysEl = el }, this.number(0)), this.labeled && h("div", { class: "s-count-down-item-label" }, this.daysLabel))), this.offerEnded && h("div", { class: "s-count-down-end-text" }, !!this.endText ? this.endText : this.endLabel)));
|
|
@@ -25991,7 +25994,8 @@ window.SallaApplePay = {
|
|
|
25991
25994
|
}))
|
|
25992
25995
|
};
|
|
25993
25996
|
|
|
25994
|
-
|
|
25997
|
+
//applePay doesn't allow iframes
|
|
25998
|
+
if (window.ApplePaySession && undefined.self === undefined.top && ApplePaySession.canMakePayments()) {
|
|
25995
25999
|
SallaApplePay.init();
|
|
25996
26000
|
} else {
|
|
25997
26001
|
// You can hide the Apple Pay button easy with add data-show-if-apple-pay-supported to element like <div data-show-if-apple-pay-supported>
|
|
@@ -26140,11 +26144,12 @@ const SallaQuickBuy = class {
|
|
|
26140
26144
|
this.currency = response.data.base_currency_price.currency;
|
|
26141
26145
|
});
|
|
26142
26146
|
}
|
|
26143
|
-
|
|
26147
|
+
let isNotIframe = window.self !== window.top;
|
|
26148
|
+
this.isApplePayActive = isNotIframe && ((_a = window.ApplePaySession) === null || _a === void 0 ? void 0 : _a.canMakePayments())
|
|
26144
26149
|
&& ((_b = salla.config.get('store.settings.payments')) === null || _b === void 0 ? void 0 : _b.includes('apple_pay'));
|
|
26145
26150
|
let applePaySdk = document.getElementById('apple-pay-sdk');
|
|
26146
26151
|
if (applePaySdk || !this.isApplePayActive) {
|
|
26147
|
-
salla.logger.warn('🍏 Pay: Skipped load apple pay because ' + (applePaySdk ? 'already loaded' : 'is not available in the browser'));
|
|
26152
|
+
salla.logger.warn('🍏 Pay: Skipped load apple pay because ' + (applePaySdk ? 'already loaded' : (isNotIframe ? 'is not available in the browser' : 'is iframe')));
|
|
26148
26153
|
resolve(true);
|
|
26149
26154
|
return;
|
|
26150
26155
|
}
|
|
@@ -29600,7 +29605,7 @@ const SallaVerify = class {
|
|
|
29600
29605
|
}
|
|
29601
29606
|
render() {
|
|
29602
29607
|
return this.display == 'inline' ? h(Host, null, this.myBody()) :
|
|
29603
|
-
h("salla-modal", { width: "xs", class: "s-verify", ref: modal => this.modal = modal, "modal-title": this.title }, h("span", { slot: 'icon', innerHTML: this.type == "mobile" ? AndroidPhoneIcon : MailIcon }), this.myBody());
|
|
29608
|
+
h("salla-modal", { width: "xs", class: "s-verify", ref: modal => this.modal = modal, "modal-title": this.title }, h("span", { slot: 'icon', class: "s-verify-header-icon", innerHTML: this.type == "mobile" ? AndroidPhoneIcon : MailIcon }), this.myBody());
|
|
29604
29609
|
}
|
|
29605
29610
|
myBody() {
|
|
29606
29611
|
return (h("div", { class: "s-verify-body", ref: body => this.body = body }, h("div", { class: "s-verify-message", innerHTML: salla.lang.get('pages.profile.verify_message') }), h("input", { type: "hidden", name: "code", maxlength: "4", required: true, ref: code => this.code = code }), h("div", { class: "s-verify-codes", dir: "ltr" }, [1, 2, 3, 4].map(() => h("input", { type: "tel", autocomplete: "one-time-code", pattern: "[0-9]*", inputmode: "numeric", maxlength: "1", class: "s-verify-input", onInput: e => salla.helpers.inputDigitsOnly(e.target), onPaste: e => this.handlePaste(e), onKeyUp: e => this.handleKeyUp(e), required: true }))), h("div", { slot: "footer", class: "s-verify-footer" }, h("salla-button", { class: "s-verify-submit", "loader-position": 'center', disabled: true, onClick: () => this.submit(), ref: b => this.btn = b }, salla.lang.get('pages.profile.verify')), h("p", { class: "s-verify-resend-message", ref: el => this.resendMessage = el }, salla.lang.get('blocks.header.resend_after'), h("b", { class: "s-verify-timer", ref: el => this.timer = el })), h("a", { href: "#", class: "s-verify-resend", onClick: () => this.resendCode(), ref: el => this.resend = el }, salla.lang.get('blocks.comments.submit'))), h("slot", { name: "after-footer" })));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
var __awaiter=this&&this.__awaiter||function(t,e,i,s){function n(t){return t instanceof i?t:new i((function(e){e(t)}))}return new(i||(i=Promise))((function(i,o){function r(t){try{u(s.next(t))}catch(t){o(t)}}function a(t){try{u(s["throw"](t))}catch(t){o(t)}}function u(t){t.done?i(t.value):n(t.value).then(r,a)}u((s=s.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},s,n,o,r;return r={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(r[Symbol.iterator]=function(){return this}),r;function a(t){return function(e){return u([t,e])}}function u(r){if(s)throw new TypeError("Generator is already executing.");while(i)try{if(s=1,n&&(o=r[0]&2?n["return"]:r[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,r[1])).done)return o;if(n=0,o)r=[r[0]&2,o.value];switch(r[0]){case 0:case 1:o=r;break;case 4:i.label++;return{value:r[1],done:false};case 5:i.label++;n=r[1];r=[0];continue;case 7:r=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(r[0]===6||r[0]===2)){i=0;continue}if(r[0]===3&&(!o||r[1]>o[0]&&r[1]<o[3])){i.label=r[1];break}if(r[0]===6&&i.label<o[1]){i.label=o[1];o=r;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(r);break}if(o[2])i.ops.pop();i.trys.pop();continue}r=e.call(t,i)}catch(t){r=[6,t];n=0}finally{s=o=0}if(r[0]&5)throw r[1];return{value:r[0]?r[1]:void 0,done:true}}};
|
|
2
2
|
/*!
|
|
3
3
|
* Crafted with ❤ by Salla
|
|
4
|
-
*/import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-f1d446ac.js";import{C as Cart}from"./cart-8c60b447.js";var sallaAddProductButtonCss=":host{display:block}salla-add-product-button[width=wide]{width:100%}";var SallaAddProductButton=function(){function t(t){var e=this;registerInstance(this,t);this.success=createEvent(this,"success",7);this.failed=createEvent(this,"failed",7);this.hostAttributes={};this.productStatus="sale";this.productType="product";this.selectedOptions=[];salla.onReady((function(){e.showQuickBuy=e.quickBuy&&!!salla.config.get("store.settings.buy_now")}))}t.prototype.getLabel=function(){if(this.productStatus==="sale"){if(this.supportStickyBar&&window.innerWidth<=768){return Cart}return salla.lang.get("pages.cart.add_to_cart")}if(this.productType!=="donating"){return salla.lang.get("pages.products.out_of_stock")}return salla.lang.get("pages.products.donation_exceed")};t.prototype.addProductToCart=function(t){var e=this;if(this.productType==="booking"){t.preventDefault();return this.addBookingProduct()}if(this.hostAttributes.type==="submit"){return false}t.preventDefault();var i=Object.entries({id:this.productId,donating_amount:this.donatingAmount,quantity:this.quantity,endpoint:"quickAdd"}).reduce((function(t,e){var i=e[0],s=e[1];return s?(t[i]=s,t):t}),{});return salla.cart.addItem(i).then((function(t){e.selectedOptions=[];e.success.emit(t)})).catch((function(t){return e.failed.emit(t)}))};t.prototype.addBookingProduct=function(){var t=this;if(salla.config.isGuest()){salla.auth.api.setAfterLoginEvent("booking::add",this.productId);salla.event.dispatch("login::open");return}return salla.booking.add(this.productId).then((function(e){return t.success.emit(e)})).catch((function(e){return t.failed.emit(e)}))};t.prototype.getBtnAttributes=function(){for(var t=0;t<this.host.attributes.length;t++){if(!["id","class"].includes(this.host.attributes[t].name)){this.hostAttributes[this.host.attributes[t].name]=this.host.attributes[t].value}}return this.hostAttributes};t.prototype.getQuickBuyBtnAttributes=function(){return Object.assign(Object.assign({},this.getBtnAttributes()),{type:this.supportStickyBar&&window.innerWidth<=768?"plain":this.productType=="donating"?"donate":"buy"})};t.prototype.componentWillLoad=function(){var t=this;this.passedLabel=this.host.innerHTML.replace("\x3c!----\x3e","").trim();if(this.host.hasAttribute("type")&&this.host.getAttribute("type")==="submit"&&this.supportStickyBar){window.addEventListener("resize",(function(){var e,i;if(window.innerWidth>=768&&!!t.passedLabel){(e=t.btn)===null||e===void 0?void 0:e.setText(t.passedLabel)}else{(i=t.btn)===null||i===void 0?void 0:i.setText(t.getLabel())}}))}};t.prototype.render=function(){var t=this;var e;if((e=this.host.closest(".swiper-slide"))===null||e===void 0?void 0:e.classList.contains("swiper-slide-duplicate")){return""}if(this.hasSubscribedOptions){return h(Host,null,h("salla-product-availability",Object.assign({},this.getBtnAttributes(),{"is-subscribed":true}),h("span",{class:"s-hidden"},h("slot",null))))}if(this.productStatus==="out-and-notify"&&this.channels||this.hasOutOfStockOption){return h(Host,null,h("salla-product-availability",Object.assign({},this.getBtnAttributes()),h("span",{class:"s-hidden"},h("slot",null))))}return h(Host,{class:{"s-add-product-button-with-quick-buy":this.showQuickBuy,"s-add-product-button-with-sticky-bar":this.supportStickyBar}},h("salla-button",Object.assign({color:this.productStatus==="sale"?"primary":"light",type:"button",fill:this.productStatus==="sale"?"solid":"outline",ref:function(e){return t.btn=e},onClick:function(e){return t.addProductToCart(e)},disabled:this.productStatus!=="sale"},this.getBtnAttributes(),{"loader-position":"center"}),h("slot",null)),this.showQuickBuy?h("salla-quick-buy",Object.assign({},this.getQuickBuyBtnAttributes())):"")};t.prototype.componentDidLoad=function(){var t=this;if(!this.notifyOptionsAvailability){return}salla.event.on("product-options::change",(function(e){return __awaiter(t,void 0,void 0,(function(){var t,i,s,n,o,r;var a=this;return __generator(this,(function(u){switch(u.label){case 0:if(!["thumbnail","color","single-option"].includes(e.option.type)){return[2]}this.hasSubscribedOptions=false;s=this;return[4,(t=document.querySelector('salla-product-options[product-id="'.concat(this.productId,'"]')))===null||t===void 0?void 0:t.getSelectedOptions()];case 1:s.selectedOptions=u.sent();n=this;return[4,(i=document.querySelector('salla-product-options[product-id="'.concat(this.productId,'"]')))===null||i===void 0?void 0:i.hasOutOfStockOption()];case 2:n.hasOutOfStockOption=u.sent();o=salla.storage.get("product-".concat(this.productId,"-subscribed-options"));if(!o&&!this.subscribedOptions||!this.hasOutOfStockOption){return[2]}if(salla.config.isGuest()){r=o?o.map((function(t){return t.split(",").map((function(t){return parseInt(t)}))})):[];this.hasSubscribedOptions=r.length>0&&r.some((function(t){return t.every((function(t){return a.selectedOptions.some((function(e){return e.id===t}))}))}))}else{this.hasSubscribedOptions=this.subscribedOptions&&this.subscribedOptions!=="null"&&this.subscribedOptions!=="[]"?JSON.parse(this.subscribedOptions).some((function(t){return t.every((function(t){return a.selectedOptions.some((function(e){return e.id===t}))}))})):false}return[2]}}))}))}))};t.prototype.componentDidRender=function(){var t=this;var e;if(!!this.passedLabel
|
|
4
|
+
*/import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-f1d446ac.js";import{C as Cart}from"./cart-8c60b447.js";var sallaAddProductButtonCss=":host{display:block}salla-add-product-button[width=wide]{width:100%}";var SallaAddProductButton=function(){function t(t){var e=this;registerInstance(this,t);this.success=createEvent(this,"success",7);this.failed=createEvent(this,"failed",7);this.hostAttributes={};this.productStatus="sale";this.productType="product";this.selectedOptions=[];salla.onReady((function(){e.showQuickBuy=e.quickBuy&&!!salla.config.get("store.settings.buy_now")}))}t.prototype.getLabel=function(){if(this.productStatus==="sale"){if(this.supportStickyBar&&window.innerWidth<=768){return Cart}return salla.lang.get("pages.cart.add_to_cart")}if(this.productType!=="donating"){return salla.lang.get("pages.products.out_of_stock")}return salla.lang.get("pages.products.donation_exceed")};t.prototype.addProductToCart=function(t){var e=this;if(this.productType==="booking"){t.preventDefault();return this.addBookingProduct()}if(this.hostAttributes.type==="submit"){return false}t.preventDefault();var i=Object.entries({id:this.productId,donating_amount:this.donatingAmount,quantity:this.quantity,endpoint:"quickAdd"}).reduce((function(t,e){var i=e[0],s=e[1];return s?(t[i]=s,t):t}),{});return salla.cart.addItem(i).then((function(t){e.selectedOptions=[];e.success.emit(t)})).catch((function(t){return e.failed.emit(t)}))};t.prototype.addBookingProduct=function(){var t=this;if(salla.config.isGuest()){salla.auth.api.setAfterLoginEvent("booking::add",this.productId);salla.event.dispatch("login::open");return}return salla.booking.add(this.productId).then((function(e){return t.success.emit(e)})).catch((function(e){return t.failed.emit(e)}))};t.prototype.getBtnAttributes=function(){for(var t=0;t<this.host.attributes.length;t++){if(!["id","class"].includes(this.host.attributes[t].name)){this.hostAttributes[this.host.attributes[t].name]=this.host.attributes[t].value}}return this.hostAttributes};t.prototype.getQuickBuyBtnAttributes=function(){return Object.assign(Object.assign({},this.getBtnAttributes()),{type:this.supportStickyBar&&window.innerWidth<=768?"plain":this.productType=="donating"?"donate":"buy"})};t.prototype.componentWillLoad=function(){var t=this;var e;this.passedLabel=this.host.innerHTML.replace("\x3c!----\x3e","").trim();if(!!this.passedLabel&&window.innerWidth>=768){(e=this.btn)===null||e===void 0?void 0:e.setText(this.passedLabel);return}if(this.host.hasAttribute("type")&&this.host.getAttribute("type")==="submit"&&this.supportStickyBar){window.addEventListener("resize",(function(){var e,i;if(window.innerWidth>=768&&!!t.passedLabel){(e=t.btn)===null||e===void 0?void 0:e.setText(t.passedLabel)}else{(i=t.btn)===null||i===void 0?void 0:i.setText(t.getLabel())}}))}};t.prototype.render=function(){var t=this;var e;if((e=this.host.closest(".swiper-slide"))===null||e===void 0?void 0:e.classList.contains("swiper-slide-duplicate")){return""}if(this.hasSubscribedOptions){return h(Host,null,h("salla-product-availability",Object.assign({},this.getBtnAttributes(),{"is-subscribed":true}),h("span",{class:"s-hidden"},h("slot",null))))}if(this.productStatus==="out-and-notify"&&this.channels||this.hasOutOfStockOption){return h(Host,null,h("salla-product-availability",Object.assign({},this.getBtnAttributes()),h("span",{class:"s-hidden"},h("slot",null))))}return h(Host,{class:{"s-add-product-button-with-quick-buy":this.showQuickBuy,"s-add-product-button-with-sticky-bar":this.supportStickyBar}},h("salla-button",Object.assign({color:this.productStatus==="sale"?"primary":"light",type:"button",fill:this.productStatus==="sale"?"solid":"outline",ref:function(e){return t.btn=e},onClick:function(e){return t.addProductToCart(e)},disabled:this.productStatus!=="sale"},this.getBtnAttributes(),{"loader-position":"center"}),h("slot",null)),this.showQuickBuy?h("salla-quick-buy",Object.assign({},this.getQuickBuyBtnAttributes())):"")};t.prototype.componentDidLoad=function(){var t=this;if(!this.notifyOptionsAvailability){return}salla.event.on("product-options::change",(function(e){return __awaiter(t,void 0,void 0,(function(){var t,i,s,n,o,r;var a=this;return __generator(this,(function(u){switch(u.label){case 0:if(!["thumbnail","color","single-option"].includes(e.option.type)){return[2]}this.hasSubscribedOptions=false;s=this;return[4,(t=document.querySelector('salla-product-options[product-id="'.concat(this.productId,'"]')))===null||t===void 0?void 0:t.getSelectedOptions()];case 1:s.selectedOptions=u.sent();n=this;return[4,(i=document.querySelector('salla-product-options[product-id="'.concat(this.productId,'"]')))===null||i===void 0?void 0:i.hasOutOfStockOption()];case 2:n.hasOutOfStockOption=u.sent();o=salla.storage.get("product-".concat(this.productId,"-subscribed-options"));if(!o&&!this.subscribedOptions||!this.hasOutOfStockOption){return[2]}if(salla.config.isGuest()){r=o?o.map((function(t){return t.split(",").map((function(t){return parseInt(t)}))})):[];this.hasSubscribedOptions=r.length>0&&r.some((function(t){return t.every((function(t){return a.selectedOptions.some((function(e){return e.id===t}))}))}))}else{this.hasSubscribedOptions=this.subscribedOptions&&this.subscribedOptions!=="null"&&this.subscribedOptions!=="[]"?JSON.parse(this.subscribedOptions).some((function(t){return t.every((function(t){return a.selectedOptions.some((function(e){return e.id===t}))}))})):false}return[2]}}))}))}))};t.prototype.componentDidRender=function(){var t=this;var e,i;if(!!this.passedLabel&&(!this.supportStickyBar||window.innerWidth>=768)){(e=this.btn)===null||e===void 0?void 0:e.setText(this.passedLabel);return}(i=this.btn)===null||i===void 0?void 0:i.setText(this.getLabel());salla.lang.onLoaded((function(){var e;return(e=t.btn)===null||e===void 0?void 0:e.setText(t.getLabel())}))};Object.defineProperty(t.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();SallaAddProductButton.style=sallaAddProductButtonCss;export{SallaAddProductButton as salla_add_product_button};
|