@salla.sa/twilight-components 2.9.45 → 2.9.48
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/{index-69084b4e.js → index-4700898c.js} +2 -2
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/salla-button_35.cjs.entry.js +144 -79
- package/dist/cjs/twilight.cjs.js +2 -2
- package/dist/collection/assets/svg/party-horn.svg +1 -1
- package/dist/collection/components/salla-quick-order/salla-quick-order.css +40 -14
- package/dist/collection/components/salla-quick-order/salla-quick-order.js +171 -108
- package/dist/collection/components/salla-scopes/salla-scopes.js +1 -0
- package/dist/components/index.js +2 -2
- package/dist/components/salla-quick-order.js +155 -89
- package/dist/components/salla-scopes.js +1 -0
- package/dist/esm/{index-841c6a09.js → index-55e33cdf.js} +2 -2
- package/dist/esm/loader.js +2 -2
- package/dist/esm/salla-button_35.entry.js +144 -79
- package/dist/esm/twilight.js +2 -2
- package/dist/esm-es5/index-55e33cdf.js +24 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/salla-button_35.entry.js +4 -4
- package/dist/esm-es5/twilight.js +1 -1
- package/dist/twilight/p-0cf11465.system.js +4 -0
- package/dist/twilight/{p-ff6cc430.system.entry.js → p-0de275dc.system.entry.js} +1 -1
- package/dist/twilight/{p-8964c442.entry.js → p-37381192.entry.js} +4 -4
- package/dist/twilight/{p-add0b2aa.system.js → p-6b7896e1.system.js} +2 -2
- package/dist/twilight/{p-ed8fa851.js → p-f286c803.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/twilight/twilight.js +1 -1
- package/dist/types/components/salla-quick-order/salla-quick-order.d.ts +15 -6
- package/dist/types/components.d.ts +2 -2
- package/package.json +3 -3
- package/dist/esm-es5/index-841c6a09.js +0 -24
- package/dist/twilight/p-abaef410.system.js +0 -4
|
@@ -14,29 +14,42 @@ const HideIcon = `<!-- Generated by IcoMoon.io -->
|
|
|
14
14
|
</svg>
|
|
15
15
|
`;
|
|
16
16
|
|
|
17
|
-
const
|
|
17
|
+
const CelebrationIcon = `<!-- Generated by IcoMoon.io -->
|
|
18
|
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
|
19
|
+
<title>party-horn</title>
|
|
20
|
+
<path fill="currentColor" d="M5.333 4.013c0.736 0 1.333-0.596 1.333-1.333v-0.013c0-0.737-0.597-1.327-1.333-1.327s-1.333 0.603-1.333 1.34 0.597 1.333 1.333 1.333zM11.333 10c0.341 0 0.683-0.131 0.943-0.391 1.541-1.54 2.391-3.589 2.391-5.771v-2.505c0-0.737-0.597-1.333-1.333-1.333s-1.333 0.596-1.333 1.333v2.505c0 1.468-0.572 2.848-1.609 3.885-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.601 0.391 0.943 0.391zM18.667 9.993c0.319 0 0.639-0.115 0.895-0.345 0.383-0.347 0.684-0.325 1.497-0.22 0.923 0.124 2.319 0.307 3.636-0.887 1.293-1.172 1.303-2.54 1.308-3.539 0.005-0.887 0.043-1.228 0.432-1.581 0.361-0.327 0.621-0.335 1.493-0.216 0.923 0.12 2.317 0.307 3.635-0.884 0.545-0.495 0.587-1.337 0.093-1.883-0.493-0.547-1.336-0.589-1.884-0.093-0.361 0.325-0.621 0.333-1.493 0.216-0.921-0.119-2.317-0.305-3.635 0.884-1.293 1.173-1.303 2.541-1.308 3.54-0.005 0.885-0.043 1.227-0.432 1.58-0.383 0.348-0.683 0.327-1.497 0.22-0.924-0.124-2.32-0.305-3.636 0.887-0.545 0.495-0.587 1.339-0.092 1.884 0.264 0.291 0.625 0.437 0.988 0.437zM18.667 16.013c0.736 0 1.333-0.596 1.333-1.333v-0.013c0-0.737-0.597-1.327-1.333-1.327s-1.333 0.603-1.333 1.34 0.597 1.333 1.333 1.333zM30.667 17.333h-2.505c-2.179 0-4.228 0.849-5.771 2.391-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.603 0.391 0.944 0.391s0.683-0.131 0.943-0.391c1.023-1.023 2.439-1.609 3.884-1.609h2.505c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333zM30.667 10.66c-0.736 0-1.333 0.603-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.596 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327zM29.333 26.66c-0.736 0-1.333 0.603-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.596 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327zM7.456 11.057c-0.327-0.327-0.799-0.46-1.249-0.356-0.449 0.107-0.812 0.439-0.959 0.876l-5.036 15.113c-0.487 1.457-0.113 3.037 0.973 4.125 0.772 0.771 1.792 1.183 2.84 1.183 0.428 0 0.861-0.068 1.284-0.209l15.112-5.037c0.439-0.145 0.769-0.508 0.876-0.959 0.107-0.449-0.028-0.921-0.355-1.249zM4.467 29.259c-0.503 0.163-1.023 0.043-1.395-0.329-0.373-0.373-0.497-0.896-0.329-1.396l4.355-13.065 10.436 10.435z"></path>
|
|
21
|
+
</svg>
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
const sallaQuickOrderCss = ".s-quick-order.s-quick-order-dark h1,.s-quick-order.s-quick-order-dark p{color:#fff}.s-quick-order .s-quick-order-container{padding:15px;border-radius:6px;margin:10px 0}.s-quick-order .s-quick-order-container .s-quick-order-button-cont{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:baseline;align-items:baseline;margin:10px 0}.s-quick-order .s-quick-order-container .s-quick-order-checkbox-container{display:-ms-flexbox;display:flex;margin:10px 0}.s-quick-order .s-quick-order-container .s-quick-order-checkbox-container input{padding:10px;width:20px;border:1px solid #eee;border-radius:5px;margin:6px}.s-quick-order .s-quick-order-container .s-quick-order-expandable{height:0;max-height:0;-webkit-transition:max-height 1s;transition:max-height 1s;visibility:hidden}.s-quick-order .s-quick-order-container .s-quick-order-expandable.s-quick-order-show{visibility:visible;height:auto;max-height:500px}.s-quick-order .s-quick-order-container .s-quick-order-flex-input{display:-ms-flexbox;display:flex}.s-quick-order .s-quick-order-container input:not([type=checkbox]){padding:10px;width:100%;border:1px solid #eee;border-radius:5px;margin-bottom:10px;height:2.5rem;margin-left:10px}.s-quick-order .s-quick-order-container salla-tel-input{width:100%;height:2.5rem}.s-quick-order .s-quick-order-container .s-quick-order-errors p{color:red}.s-quick-order .s-quick-order-confirm{background:rgba(93, 213, 196, 0.05);border:1px solid rgba(93, 213, 196, 0.5) !important;color:#5dd5c4;border-radius:3px;padding:10px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.s-quick-order .s-quick-order-confirm span{margin:0px 10px}.s-quick-order .s-quick-order-confirm svg{color:#5dd5c4;width:1rem}";
|
|
18
25
|
|
|
19
26
|
const SallaQuickOrder$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
20
27
|
constructor() {
|
|
21
28
|
super();
|
|
22
29
|
this.__registerHost();
|
|
23
30
|
this.quickOrderSubmited = createEvent(this, "quickOrderSubmited", 7);
|
|
31
|
+
this.errorMessages = {
|
|
32
|
+
terms: 'Terms should be agreed.',
|
|
33
|
+
name: 'Name with at least 3 chars is required.',
|
|
34
|
+
email: 'Correct email is required.',
|
|
35
|
+
phone: 'Correct Phone is required.',
|
|
36
|
+
};
|
|
24
37
|
/**
|
|
25
38
|
* quick order title
|
|
26
39
|
*/
|
|
27
|
-
this.quickOrderTitle = '
|
|
40
|
+
this.quickOrderTitle = 'ليش تنتظر؟';
|
|
28
41
|
/**
|
|
29
42
|
* quick order sub title
|
|
30
43
|
*/
|
|
31
|
-
this.subTitle = '
|
|
44
|
+
this.subTitle = 'احصل على المنتج مباشرة الآن';
|
|
32
45
|
/**
|
|
33
46
|
* quick order pay button text
|
|
34
47
|
*/
|
|
35
|
-
this.payButtonTitle = '
|
|
48
|
+
this.payButtonTitle = 'اطلب المنتج';
|
|
36
49
|
/**
|
|
37
50
|
* quick order confirm pay button text
|
|
38
51
|
*/
|
|
39
|
-
this.confirmPayButtonTitle = '
|
|
52
|
+
this.confirmPayButtonTitle = 'اشتر الآن';
|
|
40
53
|
/**
|
|
41
54
|
* agreement text from server or from props
|
|
42
55
|
*/
|
|
@@ -49,14 +62,13 @@ const SallaQuickOrder$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
49
62
|
* Quick Order Style
|
|
50
63
|
*/
|
|
51
64
|
this.quickOrderStyle = 'default';
|
|
52
|
-
|
|
53
|
-
* states
|
|
54
|
-
*/
|
|
55
|
-
this.isGuest = true;
|
|
65
|
+
this.isAvailable = false;
|
|
56
66
|
this.oneClick = false;
|
|
57
67
|
this.expanded = false;
|
|
58
68
|
this.isTermsRequired = false;
|
|
59
69
|
this.countryCode = salla.config.get('user.country_code', 'SA') || 'SA';
|
|
70
|
+
this.errors = [];
|
|
71
|
+
this.submitSucess = false;
|
|
60
72
|
//Langugae states
|
|
61
73
|
this.placeHolderEmail = salla.lang.get('common.elements.email');
|
|
62
74
|
this.emailOptional = salla.lang.get('common.elements.optional');
|
|
@@ -64,118 +76,172 @@ const SallaQuickOrder$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
64
76
|
this.agreementModalHead = salla.lang.get('pages.checkout.full_agreement');
|
|
65
77
|
this.userNameLabel = salla.lang.get('pages.products.your_name');
|
|
66
78
|
this.termsChecked = false;
|
|
67
|
-
this.isGuest = Salla.config.isGuest();
|
|
68
79
|
this.productId = this.productId || salla.config.get('page.id');
|
|
69
|
-
this.user = salla.config.get('user') || salla.storage.get('user') || {};
|
|
70
|
-
this.countryCode = this.user.country_code || this.countryCode;
|
|
71
80
|
salla.lang.onLoaded(() => {
|
|
72
81
|
this.placeHolderEmail = salla.lang.get('common.elements.email');
|
|
73
82
|
this.emailOptional = salla.lang.get('common.elements.optional');
|
|
74
83
|
this.agreementShowText = salla.lang.get('pages.checkout.show_full_agreement');
|
|
75
84
|
this.agreementModalHead = salla.lang.get('pages.checkout.full_agreement');
|
|
76
85
|
this.userNameLabel = salla.lang.get('pages.products.your_name');
|
|
77
|
-
this.
|
|
86
|
+
this.errorMessages.terms = salla.lang.get('pages.checkout.check_agreement');
|
|
87
|
+
this.errorMessages.email = salla.lang.get('pages.checkout.email_required');
|
|
88
|
+
this.errorMessages.phone = salla.lang.get('common.errors.field_required', { attribute: salla.lang.get('common.elements.mobile') });
|
|
89
|
+
this.errorMessages.name = salla.lang.get('common.errors.field_required', { attribute: this.userNameLabel });
|
|
78
90
|
});
|
|
79
91
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
92
|
+
fetchQuickCheckout() {
|
|
93
|
+
return salla.api.withoutNotifier(() => salla.api.cart.getQuickCheckoutSettings().then(res => {
|
|
94
|
+
var _a, _b;
|
|
95
|
+
this.isAvailable = true;
|
|
96
|
+
this.quickOrderTitle = res.data.title;
|
|
97
|
+
this.subTitle = res.data.sub_title;
|
|
98
|
+
this.payButtonTitle = res.data.order_now_button;
|
|
99
|
+
this.isEmailRequired = res.data.is_email_required;
|
|
100
|
+
this.isTermsRequired = res.data.show_agreement;
|
|
101
|
+
this.agreementText = res.data.agreement;
|
|
102
|
+
this.confirmPayButtonTitle = res.data.confirm_button;
|
|
103
|
+
this.thanksMessage = res.data.thanks_message;
|
|
104
|
+
this.quickOrderStyle = res.data.style;
|
|
105
|
+
this.user = salla.config.get('user') || salla.storage.get('user') || {};
|
|
106
|
+
this.countryCode = ((_a = this.user) === null || _a === void 0 ? void 0 : _a.country_code) || this.countryCode;
|
|
107
|
+
// make email required if user is gust or is required from server
|
|
108
|
+
this.isEmailRequired = ((_b = this.user) === null || _b === void 0 ? void 0 : _b.email) ? false : this.isEmailRequired;
|
|
109
|
+
// check if one click is available
|
|
110
|
+
this.oneClick = !(this.isTermsRequired || this.isEmailRequired) && this.user !== null;
|
|
111
|
+
}));
|
|
112
|
+
}
|
|
113
|
+
getBtnColor() {
|
|
114
|
+
return this.quickOrderStyle === 'default' ? 'light' : 'primary';
|
|
91
115
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
116
|
+
getDarkOrLight() {
|
|
117
|
+
return this.quickOrderStyle === 'default' && salla.config.get('theme.color.is_dark') ? 'dark' : 'light';
|
|
118
|
+
}
|
|
119
|
+
getStyleColor() {
|
|
120
|
+
return {
|
|
121
|
+
gray: '#f3f3f3',
|
|
122
|
+
white: '#ffffff',
|
|
123
|
+
default: salla.config.get('theme.color.primary'),
|
|
124
|
+
}[this.quickOrderStyle] || '#f3f3f3';
|
|
125
|
+
}
|
|
126
|
+
async submit(checkOneClick = false) {
|
|
127
|
+
if (checkOneClick && !this.oneClick) {
|
|
128
|
+
this.expanded = !this.expanded;
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
return this.getPayload()
|
|
132
|
+
.then((payload) => salla.api.cart.createQuickCheckout(payload))
|
|
133
|
+
.then(() => {
|
|
134
|
+
this.quickOrderSubmited.emit();
|
|
135
|
+
this.submitSucess = true;
|
|
136
|
+
})
|
|
137
|
+
.catch(error => error && console.error(error));
|
|
138
|
+
}
|
|
139
|
+
async isValid() {
|
|
140
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
96
141
|
const inputErrorClass = 's-has-error';
|
|
97
|
-
|
|
98
|
-
if (this.
|
|
99
|
-
this.
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
isValid = false;
|
|
111
|
-
}
|
|
142
|
+
this.errors = [];
|
|
143
|
+
if (this.isTermsRequired && !this.termsChecked) {
|
|
144
|
+
this.termsInput.classList.add(inputErrorClass);
|
|
145
|
+
this.errors.push(this.errorMessages.terms);
|
|
146
|
+
}
|
|
147
|
+
const emailValue = (_a = this.emailInput) === null || _a === void 0 ? void 0 : _a.value;
|
|
148
|
+
const nameValue = (_b = this.nameInput) === null || _b === void 0 ? void 0 : _b.value;
|
|
149
|
+
const phone = await ((_c = this.phoneInput) === null || _c === void 0 ? void 0 : _c.getValues());
|
|
150
|
+
const phoneValue = phone === null || phone === void 0 ? void 0 : phone.phone;
|
|
151
|
+
if (Salla.config.isGuest()) {
|
|
152
|
+
(_d = this.nameInput) === null || _d === void 0 ? void 0 : _d.classList.remove(inputErrorClass);
|
|
153
|
+
(_e = this.emailInput) === null || _e === void 0 ? void 0 : _e.classList.remove(inputErrorClass);
|
|
154
|
+
(_f = this.phoneInput) === null || _f === void 0 ? void 0 : _f.classList.remove(inputErrorClass);
|
|
112
155
|
// email check
|
|
113
|
-
if (this.isEmailRequired && (emailValue
|
|
114
|
-
this.emailInput.classList.add(inputErrorClass);
|
|
115
|
-
|
|
156
|
+
if (this.isEmailRequired && (!emailValue || !/\S+@\S+\.\S+/.test(emailValue))) {
|
|
157
|
+
(_g = this.emailInput) === null || _g === void 0 ? void 0 : _g.classList.add(inputErrorClass);
|
|
158
|
+
this.errors.push(this.errorMessages.email);
|
|
116
159
|
}
|
|
117
160
|
// phone check
|
|
118
|
-
if (phoneValue
|
|
119
|
-
this.phoneInput.classList.add(inputErrorClass);
|
|
120
|
-
|
|
161
|
+
if (!phoneValue || !/^\d+$/.test(phoneValue)) {
|
|
162
|
+
(_h = this.phoneInput) === null || _h === void 0 ? void 0 : _h.classList.add(inputErrorClass);
|
|
163
|
+
this.errors.push(this.errorMessages.phone);
|
|
121
164
|
}
|
|
122
165
|
// name check
|
|
123
|
-
if (nameValue
|
|
124
|
-
this.nameInput.classList.add(inputErrorClass);
|
|
125
|
-
|
|
166
|
+
if (!nameValue || nameValue.length < 3) {
|
|
167
|
+
(_j = this.nameInput) === null || _j === void 0 ? void 0 : _j.classList.add(inputErrorClass);
|
|
168
|
+
this.errors.push(this.errorMessages.name);
|
|
126
169
|
}
|
|
127
|
-
if (!isValid)
|
|
128
|
-
return;
|
|
129
170
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
this.
|
|
171
|
+
return this.errors.length === 0;
|
|
172
|
+
}
|
|
173
|
+
async getPayload() {
|
|
174
|
+
var _a, _b, _c, _d, _e, _f;
|
|
175
|
+
if (this.oneClick) {
|
|
176
|
+
return {
|
|
177
|
+
product_ids: [this.productId],
|
|
178
|
+
agreement: true,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
if (!(await this.isValid())) {
|
|
182
|
+
this.errors.forEach(error => console.error(error));
|
|
183
|
+
throw 'Validation failed.';
|
|
142
184
|
}
|
|
185
|
+
return {
|
|
186
|
+
product_ids: [this.productId],
|
|
187
|
+
email: (_a = this.emailInput) === null || _a === void 0 ? void 0 : _a.value,
|
|
188
|
+
phone: (_c = (await ((_b = this.phoneInput) === null || _b === void 0 ? void 0 : _b.getValues()))) === null || _c === void 0 ? void 0 : _c.phone,
|
|
189
|
+
country_code: ((_e = (await ((_d = this.phoneInput) === null || _d === void 0 ? void 0 : _d.getValues()))) === null || _e === void 0 ? void 0 : _e.countryCode) || this.countryCode,
|
|
190
|
+
name: (_f = this.nameInput) === null || _f === void 0 ? void 0 : _f.value,
|
|
191
|
+
agreement: this.termsChecked,
|
|
192
|
+
};
|
|
143
193
|
}
|
|
144
|
-
formatAgreementText(agreement_text, length) {
|
|
194
|
+
formatAgreementText(agreement_text, length = 150) {
|
|
145
195
|
if (!agreement_text)
|
|
146
196
|
return '';
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
197
|
+
if (agreement_text.length <= length)
|
|
198
|
+
return agreement_text;
|
|
199
|
+
const parsedToDOM = new DOMParser().parseFromString(agreement_text, 'text/html');
|
|
200
|
+
return parsedToDOM.documentElement.innerText.substring(0, length) + '...';
|
|
201
|
+
}
|
|
202
|
+
clearErrors() {
|
|
203
|
+
var _a, _b, _c, _d;
|
|
204
|
+
this.errors = [];
|
|
205
|
+
(_a = this.termsInput) === null || _a === void 0 ? void 0 : _a.classList.remove('s-has-error');
|
|
206
|
+
(_b = this.emailInput) === null || _b === void 0 ? void 0 : _b.classList.remove('s-has-error');
|
|
207
|
+
(_c = this.nameInput) === null || _c === void 0 ? void 0 : _c.classList.remove('s-has-error');
|
|
208
|
+
(_d = this.phoneInput) === null || _d === void 0 ? void 0 : _d.classList.remove('s-has-error');
|
|
150
209
|
}
|
|
151
210
|
render() {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
211
|
+
if (!this.isAvailable) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
if (this.submitSucess) {
|
|
215
|
+
return (h(Host, { class: "s-quick-order" }, h("div", { class: 's-quick-order-confirm' }, h("i", { innerHTML: CelebrationIcon }), h("span", null, this.thanksMessage))));
|
|
216
|
+
}
|
|
217
|
+
return (h(Host, { class: `s-quick-order s-quick-order-${this.getDarkOrLight()}` }, h("div", { class: `s-quick-order-container s-quick-order-${this.quickOrderStyle}`, style: { backgroundColor: this.getStyleColor() } }, h("div", { class: "s-quick-order-button-cont" }, h("div", null, h("h1", null, this.quickOrderTitle), h("p", null, this.subTitle)), h("salla-button", { onClick: () => this.submit(true), color: this.getBtnColor() }, this.oneClick
|
|
218
|
+
? this.confirmPayButtonTitle : this.expanded ? h("i", { innerHTML: HideIcon }) : this.confirmPayButtonTitle)), h("div", { class: 's-quick-order-expandable ' + (this.expanded ? 's-quick-order-show' : '') }, Salla.config.isGuest() && [
|
|
219
|
+
h("input", { type: "text", value: this.user.name, placeholder: this.user.name || this.userNameLabel, ref: el => (this.nameInput = el), onFocus: () => this.clearErrors() }),
|
|
220
|
+
h("div", { class: 's-quick-order-flex-input' }, h("input", { type: "email", value: this.user.email, required: this.isEmailRequired, placeholder: this.placeHolderEmail + ' ' + (this.isEmailRequired ? '' : this.emailOptional), ref: el => (this.emailInput = el), onFocus: () => this.clearErrors() }), h("salla-tel-input", { phone: this.user.mobile, ref: el => (this.phoneInput = el), onFocus: () => this.clearErrors(), onBlur: () => this.clearErrors() })),
|
|
221
|
+
], this.isTermsRequired && (h("label", { class: "s-quick-order-checkbox-container" }, h("input", { onChange: () => (this.termsChecked = this.termsInput.checked), ref: el => (this.termsInput = el), type: "checkbox", onFocus: () => this.clearErrors() }), this.agreementText && (h("div", { innerHTML: this.formatAgreementText(this.agreementText, 150) }, this.agreementText.length > 150 && (h("salla-button", { shape: "link", onClick: () => this.agreementModal.open() }, this.agreementShowText)))))), this.errors.length > 0 && (h("div", { class: "s-quick-order-errors" }, this.errors.map(error => h("p", null, "- ", error)))), h("salla-button", { color: this.getBtnColor(), width: "wide", onClick: () => this.submit() }, this.payButtonTitle)), h("salla-modal", { "modal-title": this.agreementModalHead, ref: modal => (this.agreementModal = modal) }, h("article", { innerHTML: this.agreementText })))));
|
|
222
|
+
}
|
|
223
|
+
componentDidLoad() {
|
|
224
|
+
this.fetchQuickCheckout();
|
|
161
225
|
}
|
|
162
226
|
static get style() { return sallaQuickOrderCss; }
|
|
163
227
|
}, [0, "salla-quick-order", {
|
|
164
|
-
"quickOrderTitle": [
|
|
165
|
-
"subTitle": [
|
|
166
|
-
"payButtonTitle": [
|
|
167
|
-
"confirmPayButtonTitle": [
|
|
168
|
-
"agreementText": [
|
|
169
|
-
"isEmailRequired": [
|
|
170
|
-
"productId": [
|
|
171
|
-
"thanksMessage": [
|
|
172
|
-
"quickOrderStyle": [
|
|
173
|
-
"isGuest": [32],
|
|
228
|
+
"quickOrderTitle": [1025, "quick-order-title"],
|
|
229
|
+
"subTitle": [1025, "sub-title"],
|
|
230
|
+
"payButtonTitle": [1025, "pay-button-title"],
|
|
231
|
+
"confirmPayButtonTitle": [1025, "confirm-pay-button-title"],
|
|
232
|
+
"agreementText": [1025, "agreement-text"],
|
|
233
|
+
"isEmailRequired": [1028, "is-email-required"],
|
|
234
|
+
"productId": [1025, "product-id"],
|
|
235
|
+
"thanksMessage": [1025, "thanks-message"],
|
|
236
|
+
"quickOrderStyle": [1025, "quick-order-style"],
|
|
174
237
|
"user": [32],
|
|
238
|
+
"isAvailable": [32],
|
|
175
239
|
"oneClick": [32],
|
|
176
240
|
"expanded": [32],
|
|
177
241
|
"isTermsRequired": [32],
|
|
178
242
|
"countryCode": [32],
|
|
243
|
+
"errors": [32],
|
|
244
|
+
"submitSucess": [32],
|
|
179
245
|
"placeHolderEmail": [32],
|
|
180
246
|
"emailOptional": [32],
|
|
181
247
|
"agreementShowText": [32],
|
|
@@ -75,6 +75,7 @@ const SallaScopees = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
75
75
|
* Opens the scope modal.
|
|
76
76
|
*/
|
|
77
77
|
async open(mode = ModeType.DEFAULT, product_id = null) {
|
|
78
|
+
this.hasError = false;
|
|
78
79
|
this.mode = [ModeType.AVAILABILITY, ModeType.DEFAULT].includes(mode) ? mode : ModeType.DEFAULT;
|
|
79
80
|
this.loading = !this.loadedScopes[this.mode];
|
|
80
81
|
this.setScopeValues([]);
|