@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
|
@@ -3,24 +3,31 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { Component, Host, h, Prop, State, Event } from '@stencil/core';
|
|
5
5
|
import HideIcon from '../../assets/svg/eye-off.svg';
|
|
6
|
+
import CelebrationIcon from '../../assets/svg/party-horn.svg';
|
|
6
7
|
export class SallaQuickOrder {
|
|
7
8
|
constructor() {
|
|
9
|
+
this.errorMessages = {
|
|
10
|
+
terms: 'Terms should be agreed.',
|
|
11
|
+
name: 'Name with at least 3 chars is required.',
|
|
12
|
+
email: 'Correct email is required.',
|
|
13
|
+
phone: 'Correct Phone is required.',
|
|
14
|
+
};
|
|
8
15
|
/**
|
|
9
16
|
* quick order title
|
|
10
17
|
*/
|
|
11
|
-
this.quickOrderTitle = '
|
|
18
|
+
this.quickOrderTitle = 'ليش تنتظر؟';
|
|
12
19
|
/**
|
|
13
20
|
* quick order sub title
|
|
14
21
|
*/
|
|
15
|
-
this.subTitle = '
|
|
22
|
+
this.subTitle = 'احصل على المنتج مباشرة الآن';
|
|
16
23
|
/**
|
|
17
24
|
* quick order pay button text
|
|
18
25
|
*/
|
|
19
|
-
this.payButtonTitle = '
|
|
26
|
+
this.payButtonTitle = 'اطلب المنتج';
|
|
20
27
|
/**
|
|
21
28
|
* quick order confirm pay button text
|
|
22
29
|
*/
|
|
23
|
-
this.confirmPayButtonTitle = '
|
|
30
|
+
this.confirmPayButtonTitle = 'اشتر الآن';
|
|
24
31
|
/**
|
|
25
32
|
* agreement text from server or from props
|
|
26
33
|
*/
|
|
@@ -33,14 +40,13 @@ export class SallaQuickOrder {
|
|
|
33
40
|
* Quick Order Style
|
|
34
41
|
*/
|
|
35
42
|
this.quickOrderStyle = 'default';
|
|
36
|
-
|
|
37
|
-
* states
|
|
38
|
-
*/
|
|
39
|
-
this.isGuest = true;
|
|
43
|
+
this.isAvailable = false;
|
|
40
44
|
this.oneClick = false;
|
|
41
45
|
this.expanded = false;
|
|
42
46
|
this.isTermsRequired = false;
|
|
43
47
|
this.countryCode = salla.config.get('user.country_code', 'SA') || 'SA';
|
|
48
|
+
this.errors = [];
|
|
49
|
+
this.submitSucess = false;
|
|
44
50
|
//Langugae states
|
|
45
51
|
this.placeHolderEmail = salla.lang.get('common.elements.email');
|
|
46
52
|
this.emailOptional = salla.lang.get('common.elements.optional');
|
|
@@ -48,119 +54,174 @@ export class SallaQuickOrder {
|
|
|
48
54
|
this.agreementModalHead = salla.lang.get('pages.checkout.full_agreement');
|
|
49
55
|
this.userNameLabel = salla.lang.get('pages.products.your_name');
|
|
50
56
|
this.termsChecked = false;
|
|
51
|
-
this.isGuest = Salla.config.isGuest();
|
|
52
57
|
this.productId = this.productId || salla.config.get('page.id');
|
|
53
|
-
this.user = salla.config.get('user') || salla.storage.get('user') || {};
|
|
54
|
-
this.countryCode = this.user.country_code || this.countryCode;
|
|
55
58
|
salla.lang.onLoaded(() => {
|
|
56
59
|
this.placeHolderEmail = salla.lang.get('common.elements.email');
|
|
57
60
|
this.emailOptional = salla.lang.get('common.elements.optional');
|
|
58
61
|
this.agreementShowText = salla.lang.get('pages.checkout.show_full_agreement');
|
|
59
62
|
this.agreementModalHead = salla.lang.get('pages.checkout.full_agreement');
|
|
60
63
|
this.userNameLabel = salla.lang.get('pages.products.your_name');
|
|
61
|
-
this.
|
|
64
|
+
this.errorMessages.terms = salla.lang.get('pages.checkout.check_agreement');
|
|
65
|
+
this.errorMessages.email = salla.lang.get('pages.checkout.email_required');
|
|
66
|
+
this.errorMessages.phone = salla.lang.get('common.errors.field_required', { attribute: salla.lang.get('common.elements.mobile') });
|
|
67
|
+
this.errorMessages.name = salla.lang.get('common.errors.field_required', { attribute: this.userNameLabel });
|
|
62
68
|
});
|
|
63
69
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
fetchQuickCheckout() {
|
|
71
|
+
return salla.api.withoutNotifier(() => salla.api.cart.getQuickCheckoutSettings().then(res => {
|
|
72
|
+
var _a, _b;
|
|
73
|
+
this.isAvailable = true;
|
|
74
|
+
this.quickOrderTitle = res.data.title;
|
|
75
|
+
this.subTitle = res.data.sub_title;
|
|
76
|
+
this.payButtonTitle = res.data.order_now_button;
|
|
77
|
+
this.isEmailRequired = res.data.is_email_required;
|
|
78
|
+
this.isTermsRequired = res.data.show_agreement;
|
|
79
|
+
this.agreementText = res.data.agreement;
|
|
80
|
+
this.confirmPayButtonTitle = res.data.confirm_button;
|
|
81
|
+
this.thanksMessage = res.data.thanks_message;
|
|
82
|
+
this.quickOrderStyle = res.data.style;
|
|
83
|
+
this.user = salla.config.get('user') || salla.storage.get('user') || {};
|
|
84
|
+
this.countryCode = ((_a = this.user) === null || _a === void 0 ? void 0 : _a.country_code) || this.countryCode;
|
|
85
|
+
// make email required if user is gust or is required from server
|
|
86
|
+
this.isEmailRequired = ((_b = this.user) === null || _b === void 0 ? void 0 : _b.email) ? false : this.isEmailRequired;
|
|
87
|
+
// check if one click is available
|
|
88
|
+
this.oneClick = !(this.isTermsRequired || this.isEmailRequired) && this.user !== null;
|
|
89
|
+
}));
|
|
90
|
+
}
|
|
91
|
+
getBtnColor() {
|
|
92
|
+
return this.quickOrderStyle === 'default' ? 'light' : 'primary';
|
|
93
|
+
}
|
|
94
|
+
getDarkOrLight() {
|
|
95
|
+
return this.quickOrderStyle === 'default' && salla.config.get('theme.color.is_dark') ? 'dark' : 'light';
|
|
75
96
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
97
|
+
getStyleColor() {
|
|
98
|
+
return {
|
|
99
|
+
gray: '#f3f3f3',
|
|
100
|
+
white: '#ffffff',
|
|
101
|
+
default: salla.config.get('theme.color.primary'),
|
|
102
|
+
}[this.quickOrderStyle] || '#f3f3f3';
|
|
103
|
+
}
|
|
104
|
+
async submit(checkOneClick = false) {
|
|
105
|
+
if (checkOneClick && !this.oneClick) {
|
|
106
|
+
this.expanded = !this.expanded;
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
return this.getPayload()
|
|
110
|
+
.then((payload) => salla.api.cart.createQuickCheckout(payload))
|
|
111
|
+
.then(() => {
|
|
112
|
+
this.quickOrderSubmited.emit();
|
|
113
|
+
this.submitSucess = true;
|
|
114
|
+
})
|
|
115
|
+
.catch(error => error && console.error(error));
|
|
116
|
+
}
|
|
117
|
+
async isValid() {
|
|
118
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
80
119
|
const inputErrorClass = 's-has-error';
|
|
81
|
-
|
|
82
|
-
if (this.
|
|
83
|
-
this.
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
isValid = false;
|
|
95
|
-
}
|
|
120
|
+
this.errors = [];
|
|
121
|
+
if (this.isTermsRequired && !this.termsChecked) {
|
|
122
|
+
this.termsInput.classList.add(inputErrorClass);
|
|
123
|
+
this.errors.push(this.errorMessages.terms);
|
|
124
|
+
}
|
|
125
|
+
const emailValue = (_a = this.emailInput) === null || _a === void 0 ? void 0 : _a.value;
|
|
126
|
+
const nameValue = (_b = this.nameInput) === null || _b === void 0 ? void 0 : _b.value;
|
|
127
|
+
const phone = await ((_c = this.phoneInput) === null || _c === void 0 ? void 0 : _c.getValues());
|
|
128
|
+
const phoneValue = phone === null || phone === void 0 ? void 0 : phone.phone;
|
|
129
|
+
if (Salla.config.isGuest()) {
|
|
130
|
+
(_d = this.nameInput) === null || _d === void 0 ? void 0 : _d.classList.remove(inputErrorClass);
|
|
131
|
+
(_e = this.emailInput) === null || _e === void 0 ? void 0 : _e.classList.remove(inputErrorClass);
|
|
132
|
+
(_f = this.phoneInput) === null || _f === void 0 ? void 0 : _f.classList.remove(inputErrorClass);
|
|
96
133
|
// email check
|
|
97
|
-
if (this.isEmailRequired && (emailValue
|
|
98
|
-
this.emailInput.classList.add(inputErrorClass);
|
|
99
|
-
|
|
134
|
+
if (this.isEmailRequired && (!emailValue || !/\S+@\S+\.\S+/.test(emailValue))) {
|
|
135
|
+
(_g = this.emailInput) === null || _g === void 0 ? void 0 : _g.classList.add(inputErrorClass);
|
|
136
|
+
this.errors.push(this.errorMessages.email);
|
|
100
137
|
}
|
|
101
138
|
// phone check
|
|
102
|
-
if (phoneValue
|
|
103
|
-
this.phoneInput.classList.add(inputErrorClass);
|
|
104
|
-
|
|
139
|
+
if (!phoneValue || !/^\d+$/.test(phoneValue)) {
|
|
140
|
+
(_h = this.phoneInput) === null || _h === void 0 ? void 0 : _h.classList.add(inputErrorClass);
|
|
141
|
+
this.errors.push(this.errorMessages.phone);
|
|
105
142
|
}
|
|
106
143
|
// name check
|
|
107
|
-
if (nameValue
|
|
108
|
-
this.nameInput.classList.add(inputErrorClass);
|
|
109
|
-
|
|
144
|
+
if (!nameValue || nameValue.length < 3) {
|
|
145
|
+
(_j = this.nameInput) === null || _j === void 0 ? void 0 : _j.classList.add(inputErrorClass);
|
|
146
|
+
this.errors.push(this.errorMessages.name);
|
|
110
147
|
}
|
|
111
|
-
if (!isValid)
|
|
112
|
-
return;
|
|
113
148
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
this.
|
|
149
|
+
return this.errors.length === 0;
|
|
150
|
+
}
|
|
151
|
+
async getPayload() {
|
|
152
|
+
var _a, _b, _c, _d, _e, _f;
|
|
153
|
+
if (this.oneClick) {
|
|
154
|
+
return {
|
|
155
|
+
product_ids: [this.productId],
|
|
156
|
+
agreement: true,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
if (!(await this.isValid())) {
|
|
160
|
+
this.errors.forEach(error => console.error(error));
|
|
161
|
+
throw 'Validation failed.';
|
|
126
162
|
}
|
|
163
|
+
return {
|
|
164
|
+
product_ids: [this.productId],
|
|
165
|
+
email: (_a = this.emailInput) === null || _a === void 0 ? void 0 : _a.value,
|
|
166
|
+
phone: (_c = (await ((_b = this.phoneInput) === null || _b === void 0 ? void 0 : _b.getValues()))) === null || _c === void 0 ? void 0 : _c.phone,
|
|
167
|
+
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,
|
|
168
|
+
name: (_f = this.nameInput) === null || _f === void 0 ? void 0 : _f.value,
|
|
169
|
+
agreement: this.termsChecked,
|
|
170
|
+
};
|
|
127
171
|
}
|
|
128
|
-
formatAgreementText(agreement_text, length) {
|
|
172
|
+
formatAgreementText(agreement_text, length = 150) {
|
|
129
173
|
if (!agreement_text)
|
|
130
174
|
return '';
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
175
|
+
if (agreement_text.length <= length)
|
|
176
|
+
return agreement_text;
|
|
177
|
+
const parsedToDOM = new DOMParser().parseFromString(agreement_text, 'text/html');
|
|
178
|
+
return parsedToDOM.documentElement.innerText.substring(0, length) + '...';
|
|
179
|
+
}
|
|
180
|
+
clearErrors() {
|
|
181
|
+
var _a, _b, _c, _d;
|
|
182
|
+
this.errors = [];
|
|
183
|
+
(_a = this.termsInput) === null || _a === void 0 ? void 0 : _a.classList.remove('s-has-error');
|
|
184
|
+
(_b = this.emailInput) === null || _b === void 0 ? void 0 : _b.classList.remove('s-has-error');
|
|
185
|
+
(_c = this.nameInput) === null || _c === void 0 ? void 0 : _c.classList.remove('s-has-error');
|
|
186
|
+
(_d = this.phoneInput) === null || _d === void 0 ? void 0 : _d.classList.remove('s-has-error');
|
|
134
187
|
}
|
|
135
188
|
render() {
|
|
136
|
-
|
|
137
|
-
|
|
189
|
+
if (!this.isAvailable) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
if (this.submitSucess) {
|
|
193
|
+
return (h(Host, { class: "s-quick-order" },
|
|
194
|
+
h("div", { class: 's-quick-order-confirm' },
|
|
195
|
+
h("i", { innerHTML: CelebrationIcon }),
|
|
196
|
+
h("span", null, this.thanksMessage))));
|
|
197
|
+
}
|
|
198
|
+
return (h(Host, { class: `s-quick-order s-quick-order-${this.getDarkOrLight()}` },
|
|
199
|
+
h("div", { class: `s-quick-order-container s-quick-order-${this.quickOrderStyle}`, style: { backgroundColor: this.getStyleColor() } },
|
|
138
200
|
h("div", { class: "s-quick-order-button-cont" },
|
|
139
201
|
h("div", null,
|
|
140
202
|
h("h1", null, this.quickOrderTitle),
|
|
141
203
|
h("p", null, this.subTitle)),
|
|
142
|
-
h("salla-button", { onClick: () =>
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
this.isTermsRequired && (h("
|
|
152
|
-
h("input", { onChange: () =>
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
h("salla-button", { color: "primary", width: "wide", onClick: () => {
|
|
159
|
-
this.submit();
|
|
160
|
-
} }, this.payButtonTitle)),
|
|
204
|
+
h("salla-button", { onClick: () => this.submit(true), color: this.getBtnColor() }, this.oneClick
|
|
205
|
+
? this.confirmPayButtonTitle : this.expanded ? h("i", { innerHTML: HideIcon }) : this.confirmPayButtonTitle)),
|
|
206
|
+
h("div", { class: 's-quick-order-expandable ' + (this.expanded ? 's-quick-order-show' : '') },
|
|
207
|
+
Salla.config.isGuest() && [
|
|
208
|
+
h("input", { type: "text", value: this.user.name, placeholder: this.user.name || this.userNameLabel, ref: el => (this.nameInput = el), onFocus: () => this.clearErrors() }),
|
|
209
|
+
h("div", { class: 's-quick-order-flex-input' },
|
|
210
|
+
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() }),
|
|
211
|
+
h("salla-tel-input", { phone: this.user.mobile, ref: el => (this.phoneInput = el), onFocus: () => this.clearErrors(), onBlur: () => this.clearErrors() })),
|
|
212
|
+
],
|
|
213
|
+
this.isTermsRequired && (h("label", { class: "s-quick-order-checkbox-container" },
|
|
214
|
+
h("input", { onChange: () => (this.termsChecked = this.termsInput.checked), ref: el => (this.termsInput = el), type: "checkbox", onFocus: () => this.clearErrors() }),
|
|
215
|
+
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)))))),
|
|
216
|
+
this.errors.length > 0 && (h("div", { class: "s-quick-order-errors" }, this.errors.map(error => h("p", null,
|
|
217
|
+
"- ",
|
|
218
|
+
error)))),
|
|
219
|
+
h("salla-button", { color: this.getBtnColor(), width: "wide", onClick: () => this.submit() }, this.payButtonTitle)),
|
|
161
220
|
h("salla-modal", { "modal-title": this.agreementModalHead, ref: modal => (this.agreementModal = modal) },
|
|
162
|
-
h("article",
|
|
163
|
-
|
|
221
|
+
h("article", { innerHTML: this.agreementText })))));
|
|
222
|
+
}
|
|
223
|
+
componentDidLoad() {
|
|
224
|
+
this.fetchQuickCheckout();
|
|
164
225
|
}
|
|
165
226
|
static get is() { return "salla-quick-order"; }
|
|
166
227
|
static get originalStyleUrls() { return {
|
|
@@ -185,8 +246,8 @@ export class SallaQuickOrder {
|
|
|
185
246
|
"text": "quick order title"
|
|
186
247
|
},
|
|
187
248
|
"attribute": "quick-order-title",
|
|
188
|
-
"reflect":
|
|
189
|
-
"defaultValue": "'
|
|
249
|
+
"reflect": false,
|
|
250
|
+
"defaultValue": "'\u0644\u064A\u0634 \u062A\u0646\u062A\u0638\u0631\u061F'"
|
|
190
251
|
},
|
|
191
252
|
"subTitle": {
|
|
192
253
|
"type": "string",
|
|
@@ -203,8 +264,8 @@ export class SallaQuickOrder {
|
|
|
203
264
|
"text": "quick order sub title"
|
|
204
265
|
},
|
|
205
266
|
"attribute": "sub-title",
|
|
206
|
-
"reflect":
|
|
207
|
-
"defaultValue": "'
|
|
267
|
+
"reflect": false,
|
|
268
|
+
"defaultValue": "'\u0627\u062D\u0635\u0644 \u0639\u0644\u0649 \u0627\u0644\u0645\u0646\u062A\u062C \u0645\u0628\u0627\u0634\u0631\u0629 \u0627\u0644\u0622\u0646'"
|
|
208
269
|
},
|
|
209
270
|
"payButtonTitle": {
|
|
210
271
|
"type": "string",
|
|
@@ -221,8 +282,8 @@ export class SallaQuickOrder {
|
|
|
221
282
|
"text": "quick order pay button text"
|
|
222
283
|
},
|
|
223
284
|
"attribute": "pay-button-title",
|
|
224
|
-
"reflect":
|
|
225
|
-
"defaultValue": "'
|
|
285
|
+
"reflect": false,
|
|
286
|
+
"defaultValue": "'\u0627\u0637\u0644\u0628 \u0627\u0644\u0645\u0646\u062A\u062C'"
|
|
226
287
|
},
|
|
227
288
|
"confirmPayButtonTitle": {
|
|
228
289
|
"type": "string",
|
|
@@ -239,8 +300,8 @@ export class SallaQuickOrder {
|
|
|
239
300
|
"text": "quick order confirm pay button text"
|
|
240
301
|
},
|
|
241
302
|
"attribute": "confirm-pay-button-title",
|
|
242
|
-
"reflect":
|
|
243
|
-
"defaultValue": "'
|
|
303
|
+
"reflect": false,
|
|
304
|
+
"defaultValue": "'\u0627\u0634\u062A\u0631 \u0627\u0644\u0622\u0646'"
|
|
244
305
|
},
|
|
245
306
|
"agreementText": {
|
|
246
307
|
"type": "string",
|
|
@@ -257,7 +318,7 @@ export class SallaQuickOrder {
|
|
|
257
318
|
"text": "agreement text from server or from props"
|
|
258
319
|
},
|
|
259
320
|
"attribute": "agreement-text",
|
|
260
|
-
"reflect":
|
|
321
|
+
"reflect": false,
|
|
261
322
|
"defaultValue": "salla.lang.get(\n 'pages.checkout.show_full_agreement'\n )"
|
|
262
323
|
},
|
|
263
324
|
"isEmailRequired": {
|
|
@@ -275,7 +336,7 @@ export class SallaQuickOrder {
|
|
|
275
336
|
"text": "is email required"
|
|
276
337
|
},
|
|
277
338
|
"attribute": "is-email-required",
|
|
278
|
-
"reflect":
|
|
339
|
+
"reflect": false,
|
|
279
340
|
"defaultValue": "false"
|
|
280
341
|
},
|
|
281
342
|
"productId": {
|
|
@@ -293,7 +354,7 @@ export class SallaQuickOrder {
|
|
|
293
354
|
"text": "product id local or from page"
|
|
294
355
|
},
|
|
295
356
|
"attribute": "product-id",
|
|
296
|
-
"reflect":
|
|
357
|
+
"reflect": false
|
|
297
358
|
},
|
|
298
359
|
"thanksMessage": {
|
|
299
360
|
"type": "string",
|
|
@@ -310,14 +371,14 @@ export class SallaQuickOrder {
|
|
|
310
371
|
"text": "product id local or from page"
|
|
311
372
|
},
|
|
312
373
|
"attribute": "thanks-message",
|
|
313
|
-
"reflect":
|
|
374
|
+
"reflect": false
|
|
314
375
|
},
|
|
315
376
|
"quickOrderStyle": {
|
|
316
377
|
"type": "string",
|
|
317
378
|
"mutable": true,
|
|
318
379
|
"complexType": {
|
|
319
|
-
"original": "
|
|
320
|
-
"resolved": "
|
|
380
|
+
"original": "'gray' | 'white' | 'default'",
|
|
381
|
+
"resolved": "\"default\" | \"gray\" | \"white\"",
|
|
321
382
|
"references": {}
|
|
322
383
|
},
|
|
323
384
|
"required": false,
|
|
@@ -327,17 +388,19 @@ export class SallaQuickOrder {
|
|
|
327
388
|
"text": "Quick Order Style"
|
|
328
389
|
},
|
|
329
390
|
"attribute": "quick-order-style",
|
|
330
|
-
"reflect":
|
|
391
|
+
"reflect": false,
|
|
331
392
|
"defaultValue": "'default'"
|
|
332
393
|
}
|
|
333
394
|
}; }
|
|
334
395
|
static get states() { return {
|
|
335
|
-
"isGuest": {},
|
|
336
396
|
"user": {},
|
|
397
|
+
"isAvailable": {},
|
|
337
398
|
"oneClick": {},
|
|
338
399
|
"expanded": {},
|
|
339
400
|
"isTermsRequired": {},
|
|
340
401
|
"countryCode": {},
|
|
402
|
+
"errors": {},
|
|
403
|
+
"submitSucess": {},
|
|
341
404
|
"placeHolderEmail": {},
|
|
342
405
|
"emailOptional": {},
|
|
343
406
|
"agreementShowText": {},
|
|
@@ -56,6 +56,7 @@ export class SallaScopees {
|
|
|
56
56
|
* Opens the scope modal.
|
|
57
57
|
*/
|
|
58
58
|
async open(mode = ModeType.DEFAULT, product_id = null) {
|
|
59
|
+
this.hasError = false;
|
|
59
60
|
this.mode = [ModeType.AVAILABILITY, ModeType.DEFAULT].includes(mode) ? mode : ModeType.DEFAULT;
|
|
60
61
|
this.loading = !this.loadedScopes[this.mode];
|
|
61
62
|
this.setScopeValues([]);
|