@salla.sa/twilight-components 1.6.3 → 1.6.5
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/loader.cjs.js +1 -1
- package/dist/cjs/salla-button_27.cjs.entry.js +27877 -0
- package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +26 -0
- package/dist/cjs/salla-scopes.cjs.entry.js +9 -6
- package/dist/cjs/salla-select.cjs.entry.js +159 -0
- package/dist/cjs/twilight-components.cjs.js +1 -1
- package/dist/collection/assets/svg/caret-down.svg +0 -1
- package/dist/collection/assets/svg/images.svg +0 -1
- package/dist/collection/collection-manifest.json +5 -0
- package/dist/collection/components/salla-datetime-picker/interfaces.js +4 -0
- package/dist/collection/components/salla-datetime-picker/salla-datetime-picker.css +13 -0
- package/dist/collection/components/salla-datetime-picker/salla-datetime-picker.js +1374 -0
- package/dist/collection/components/salla-file-upload/interfaces.js +42 -0
- package/dist/collection/components/salla-file-upload/salla-file-upload.css +219 -0
- package/dist/collection/components/salla-file-upload/salla-file-upload.js +1435 -0
- package/dist/collection/components/salla-gifting/gift-schema.js +4 -0
- package/dist/collection/components/salla-gifting/intefaces.js +4 -0
- package/dist/collection/components/salla-gifting/salla-gifting.css +20 -0
- package/dist/collection/components/salla-gifting/salla-gifting.js +564 -0
- package/dist/collection/components/salla-localization-modal/salla-localization-modal.js +23 -13
- package/dist/collection/components/salla-login-modal/salla-login-modal.js +48 -29
- package/dist/collection/components/salla-loyalty/salla-loyalty-prize-item.css +3 -0
- package/dist/collection/components/salla-loyalty/salla-loyalty-prize-item.js +69 -0
- package/dist/collection/components/salla-loyalty/salla-loyalty.css +0 -4
- package/dist/collection/components/salla-loyalty/salla-loyalty.js +29 -16
- package/dist/collection/components/salla-modal/salla-modal.css +6 -1
- package/dist/collection/components/salla-offer-modal/salla-offer-modal.js +37 -13
- package/dist/collection/components/salla-product-size-guide/salla-product-size-guide.js +23 -8
- package/dist/collection/components/salla-rating-modal/salla-rating-modal.js +87 -64
- package/dist/collection/components/salla-scopes/salla-scopes.js +11 -7
- package/dist/collection/components/salla-search/salla-search.js +1 -1
- package/dist/collection/components/salla-select/salla-select.css +86 -0
- package/dist/collection/components/salla-select/salla-select.js +610 -0
- package/dist/collection/components/salla-social-share/salla-social-share.js +1 -3
- package/dist/collection/components/salla-tel-input/interfaces.js +4 -0
- package/dist/collection/components/salla-tel-input/salla-tel-input.css +1 -2
- package/dist/collection/components/salla-tel-input/salla-tel-input.js +32 -3
- package/dist/collection/components/salla-verify/salla-verify.js +1 -1
- package/dist/collection/global/app.js +15 -12
- package/dist/components/_commonjsHelpers.js +24 -0
- package/dist/components/anime.es.js +1312 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.js +5 -0
- package/dist/components/salla-datetime-picker.d.ts +11 -0
- package/dist/components/salla-datetime-picker.js +9 -0
- package/dist/components/salla-datetime-picker2.js +2876 -0
- package/dist/components/salla-file-upload.d.ts +11 -0
- package/dist/components/salla-file-upload.js +9 -0
- package/dist/components/salla-file-upload2.js +14623 -0
- package/dist/components/salla-gifting.d.ts +11 -0
- package/dist/components/salla-gifting.js +499 -0
- package/dist/components/salla-localization-modal.js +31 -16
- package/dist/components/salla-login-modal.js +37 -20
- package/dist/components/salla-loyalty-prize-item.d.ts +11 -0
- package/dist/components/salla-loyalty-prize-item.js +42 -0
- package/dist/components/salla-loyalty.js +28 -17
- package/dist/components/salla-modal2.js +1 -1
- package/dist/components/salla-offer-modal.js +42 -12
- package/dist/components/salla-product-size-guide.js +21 -6
- package/dist/components/salla-rating-modal.js +47 -19
- package/dist/components/salla-scopes.js +10 -6
- package/dist/components/salla-search.js +1 -1
- package/dist/components/salla-select.d.ts +11 -0
- package/dist/components/salla-select.js +199 -0
- package/dist/components/salla-social-share.js +2 -1311
- package/dist/components/salla-swiper2.js +9 -9
- package/dist/components/salla-tel-input2.js +15 -18
- package/dist/components/salla-verify2.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/salla-button_27.entry.js +27847 -0
- package/dist/esm/salla-loyalty-prize-item.entry.js +22 -0
- package/dist/esm/salla-scopes.entry.js +9 -6
- package/dist/esm/salla-select.entry.js +155 -0
- package/dist/esm/twilight-components.js +1 -1
- package/dist/twilight-components/p-49125b6a.entry.js +4 -0
- package/dist/twilight-components/p-6087187d.entry.js +22 -0
- package/dist/twilight-components/p-9a25753c.entry.js +4 -0
- package/dist/twilight-components/p-df1eb1e5.entry.js +4 -0
- package/dist/twilight-components/twilight-components.esm.js +1 -1
- package/dist/types/components/salla-datetime-picker/interfaces.d.ts +8 -0
- package/dist/types/components/salla-datetime-picker/salla-datetime-picker.d.ts +250 -0
- package/dist/types/components/salla-file-upload/interfaces.d.ts +766 -0
- package/dist/types/components/salla-file-upload/salla-file-upload.d.ts +267 -0
- package/dist/types/components/salla-gifting/gift-schema.d.ts +20 -0
- package/dist/types/components/salla-gifting/intefaces.d.ts +18 -0
- package/dist/types/components/salla-gifting/salla-gifting.d.ts +98 -0
- package/dist/types/components/salla-localization-modal/salla-localization-modal.d.ts +3 -2
- package/dist/types/components/salla-login-modal/salla-login-modal.d.ts +13 -3
- package/dist/types/components/salla-loyalty/salla-loyalty-prize-item.d.ts +8 -0
- package/dist/types/components/salla-loyalty/salla-loyalty.d.ts +2 -0
- package/dist/types/components/salla-offer-modal/salla-offer-modal.d.ts +3 -1
- package/dist/types/components/salla-product-size-guide/salla-product-size-guide.d.ts +4 -0
- package/dist/types/components/salla-rating-modal/salla-rating-modal.d.ts +3 -2
- package/dist/types/components/salla-scopes/salla-scopes.d.ts +1 -0
- package/dist/types/components/salla-select/salla-select.d.ts +110 -0
- package/dist/types/components/salla-tel-input/interfaces.d.ts +4 -0
- package/dist/types/components/salla-tel-input/salla-tel-input.d.ts +3 -0
- package/dist/types/components.d.ts +1253 -10
- package/package.json +3 -3
- package/dist/cjs/salla-button_24.cjs.entry.js +0 -10087
- package/dist/esm/salla-button_24.entry.js +0 -10060
- package/dist/twilight-components/p-30b2c5b0.entry.js +0 -4
- package/dist/twilight-components/p-5fb32395.entry.js +0 -4
|
@@ -5,21 +5,32 @@ import { Component, Host, State, Method, Element, h } from '@stencil/core';
|
|
|
5
5
|
import Helper from "../../Helpers/Helper";
|
|
6
6
|
export class SallaProductSizeGuide {
|
|
7
7
|
constructor() {
|
|
8
|
+
this.hasError = false;
|
|
8
9
|
Helper.setHost(document);
|
|
9
10
|
salla.event.on('size-guide::open', (product_id) => this.open(product_id));
|
|
11
|
+
salla.lang.onLoaded(() => {
|
|
12
|
+
this.placeholder_title = salla.lang.get('pages.products.size_guide_placeholder');
|
|
13
|
+
this.placeholder_description = salla.lang.get('pages.products.size_guide_placeholder_info');
|
|
14
|
+
this.modal_title = salla.lang.get('pages.products.size_guides');
|
|
15
|
+
});
|
|
10
16
|
}
|
|
11
17
|
/**
|
|
12
18
|
* Show the size-guide modal window
|
|
13
19
|
*/
|
|
14
20
|
async open(product_id) {
|
|
15
|
-
this.modal.setTitle(
|
|
21
|
+
this.modal.setTitle(this.modal_title);
|
|
16
22
|
this.modal.open();
|
|
17
|
-
return await salla.product.getSizeGuides(product_id)
|
|
23
|
+
return await salla.api.withoutNotifier(salla.product.getSizeGuides(product_id)
|
|
18
24
|
.then((response) => {
|
|
19
25
|
this.guides = response.data;
|
|
20
26
|
})
|
|
21
|
-
.catch(e =>
|
|
22
|
-
|
|
27
|
+
.catch(e => {
|
|
28
|
+
var _a, _b, _c, _d;
|
|
29
|
+
console.log(e);
|
|
30
|
+
this.hasError = true;
|
|
31
|
+
this.placeholder_description = ((_c = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) === null || _c === void 0 ? void 0 : _c.message) || ((_d = e.response) === null || _d === void 0 ? void 0 : _d.data);
|
|
32
|
+
})
|
|
33
|
+
.finally(() => this.modal.stopLoading()));
|
|
23
34
|
}
|
|
24
35
|
/**
|
|
25
36
|
*
|
|
@@ -31,8 +42,8 @@ export class SallaProductSizeGuide {
|
|
|
31
42
|
// !Todo - Enhance placeholder text
|
|
32
43
|
showPlaceholder() {
|
|
33
44
|
return h("salla-placeholder", { alignment: "center", iconSize: "xl" },
|
|
34
|
-
h("div", { slot: "title" },
|
|
35
|
-
h("div", { slot: "description" },
|
|
45
|
+
h("div", { slot: "title" }, this.placeholder_title),
|
|
46
|
+
h("div", { slot: "description" }, this.placeholder_description));
|
|
36
47
|
}
|
|
37
48
|
render() {
|
|
38
49
|
return (h(Host, { class: "s-product-size-guide-block" },
|
|
@@ -56,7 +67,7 @@ export class SallaProductSizeGuide {
|
|
|
56
67
|
h("salla-skeleton", { height: '10px', width: '45%' }),
|
|
57
68
|
h("salla-skeleton", { height: '10px', width: '30%' })))),
|
|
58
69
|
h("slot", { name: "header" }),
|
|
59
|
-
!!this.guides ?
|
|
70
|
+
!this.hasError && !!this.guides ?
|
|
60
71
|
[h("div", { class: "container px-8" },
|
|
61
72
|
h("salla-tabs", null,
|
|
62
73
|
this.guides.map((guide) => h("salla-tab-header", { slot: "header", name: guide.name },
|
|
@@ -75,7 +86,11 @@ export class SallaProductSizeGuide {
|
|
|
75
86
|
}; }
|
|
76
87
|
static get states() { return {
|
|
77
88
|
"guides": {},
|
|
78
|
-
"productId": {}
|
|
89
|
+
"productId": {},
|
|
90
|
+
"placeholder_title": {},
|
|
91
|
+
"placeholder_description": {},
|
|
92
|
+
"modal_title": {},
|
|
93
|
+
"hasError": {}
|
|
79
94
|
}; }
|
|
80
95
|
static get methods() { return {
|
|
81
96
|
"open": {
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { Component, h, Method, Element, Host, State, Prop } from '@stencil/core';
|
|
5
5
|
import Helper from "../../Helpers/Helper";
|
|
6
|
+
import Star from '../../assets/svg/star.svg';
|
|
6
7
|
import ShippingFast from "../../assets/svg/shipping-fast.svg";
|
|
7
8
|
import CheckCircle2 from "../../assets/svg/check-circle2.svg";
|
|
8
9
|
export class SallaRatingModal {
|
|
9
10
|
constructor() {
|
|
11
|
+
this.hasError = false;
|
|
10
12
|
this.stepsCount = 0;
|
|
11
13
|
this.currentIndex = 0;
|
|
12
14
|
this.submitted = [];
|
|
@@ -25,12 +27,23 @@ export class SallaRatingModal {
|
|
|
25
27
|
* Show the rating modal
|
|
26
28
|
*/
|
|
27
29
|
async open() {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
.then(
|
|
31
|
-
.
|
|
32
|
-
|
|
33
|
-
.
|
|
30
|
+
this.modal.open();
|
|
31
|
+
return await salla.api.withoutNotifier(salla.rating.api.order(this.orderId)
|
|
32
|
+
.then(res => this.order = res.data)
|
|
33
|
+
.catch(e => {
|
|
34
|
+
var _a, _b, _c, _d;
|
|
35
|
+
this.hasError = true;
|
|
36
|
+
this.errorMessage = ((_c = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) === null || _c === void 0 ? void 0 : _c.message) || ((_d = e.response) === null || _d === void 0 ? void 0 : _d.data);
|
|
37
|
+
})
|
|
38
|
+
.finally(() => {
|
|
39
|
+
var _a, _b, _c;
|
|
40
|
+
this.modal.setTitle(`${salla.lang.get('pages.rating.rate_order')} <span class="unicode">${!!this.order ? `(#${this.order.id})` : ''}</span>`);
|
|
41
|
+
this.stepsCount = [(_a = this.order) === null || _a === void 0 ? void 0 : _a.testimonials_enabled, (_b = this.order) === null || _b === void 0 ? void 0 : _b.products_enabled, (_c = this.order) === null || _c === void 0 ? void 0 : _c.shipping_enabled].filter(enabled => enabled).length;
|
|
42
|
+
setTimeout(() => this.handleWizard(), 100);
|
|
43
|
+
setTimeout(() => {
|
|
44
|
+
this.modal.stopLoading();
|
|
45
|
+
}, 1000);
|
|
46
|
+
}));
|
|
34
47
|
}
|
|
35
48
|
/**
|
|
36
49
|
* Show the rating modal
|
|
@@ -45,7 +58,7 @@ export class SallaRatingModal {
|
|
|
45
58
|
this.showActiveStep();
|
|
46
59
|
}
|
|
47
60
|
showActiveStep(current = null) {
|
|
48
|
-
var _a;
|
|
61
|
+
var _a, _b;
|
|
49
62
|
this.currentTab = current || this.steps[this.currentIndex];
|
|
50
63
|
Helper.toggleClassIf('.s-rating-modal-step-dot', 's-rating-modal-bg-gray', 's-rating-modal-bg-primary', dot => dot != this.dots[this.currentIndex])
|
|
51
64
|
.toggleClassIf('.s-rating-modal-step', 's-rating-modal-active', 's-rating-modal-hidden', tab => tab == this.currentTab);
|
|
@@ -56,9 +69,9 @@ export class SallaRatingModal {
|
|
|
56
69
|
}
|
|
57
70
|
// Btn text
|
|
58
71
|
let nextType = (_a = this.steps[this.currentIndex + 1]) === null || _a === void 0 ? void 0 : _a.dataset.type;
|
|
59
|
-
this.nextBtn.setText(nextType ? salla.lang.get('pages.rating.rate') + ' ' + salla.lang.get('pages.rating.' + nextType)
|
|
72
|
+
(_b = this.nextBtn) === null || _b === void 0 ? void 0 : _b.setText(nextType ? salla.lang.get('pages.rating.rate') + ' ' + salla.lang.get('pages.rating.' + nextType)
|
|
60
73
|
: salla.lang.get('pages.rating.send_ratings'));
|
|
61
|
-
setTimeout(() => { var _a; return this.body.setAttribute('style', 'height:' + ((
|
|
74
|
+
setTimeout(() => { var _a, _b; return (_a = this.body) === null || _a === void 0 ? void 0 : _a.setAttribute('style', 'height:' + ((_b = this.currentTab) === null || _b === void 0 ? void 0 : _b.scrollHeight) + 'px'); });
|
|
62
75
|
}
|
|
63
76
|
previousTab() {
|
|
64
77
|
this.currentIndex > 0 && this.currentIndex--;
|
|
@@ -133,57 +146,68 @@ export class SallaRatingModal {
|
|
|
133
146
|
this.showActiveStep(this.thanksTab);
|
|
134
147
|
}
|
|
135
148
|
render() {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
h("div", { class: "s-rating-modal-
|
|
152
|
-
h("
|
|
153
|
-
|
|
154
|
-
h("
|
|
149
|
+
var _a;
|
|
150
|
+
return (h(Host, { class: "s-rating-modal" },
|
|
151
|
+
h("salla-modal", { isLoading: true, width: "md", ref: modal => this.modal = modal },
|
|
152
|
+
h("div", { slot: 'loading' },
|
|
153
|
+
h("div", { class: "s-rating-modal-skeleton" },
|
|
154
|
+
h("salla-skeleton", { type: 'circle', height: '80px', width: '80px' }),
|
|
155
|
+
h("salla-skeleton", { height: '15px', width: '60%' }),
|
|
156
|
+
h("salla-skeleton", { height: '10px', width: '30%' }),
|
|
157
|
+
h("div", { class: "s-rating-modal-skeleton-stars" }, [...Array(5)].map(() => h("div", { innerHTML: Star }))),
|
|
158
|
+
h("salla-skeleton", { height: '100px', width: '100%' }),
|
|
159
|
+
h("div", { class: "s-rating-modal-skeleton-footer" },
|
|
160
|
+
h("salla-skeleton", { height: '40px', width: '30%' })))),
|
|
161
|
+
!this.hasError && this.order
|
|
162
|
+
? [h("div", { class: "s-rating-modal-wrapper", ref: el => this.body = el },
|
|
163
|
+
((_a = this.order) === null || _a === void 0 ? void 0 : _a.testimonials_enabled) ?
|
|
164
|
+
h("div", { class: "rating-outer-form s-rating-modal-step-wrap s-rating-modal-step s-rating-modal-hidden", "data-type": "store" },
|
|
165
|
+
h("div", { class: "s-rating-modal-rounded-icon" },
|
|
166
|
+
h("img", { src: salla.config.get('store.logo', 'https://assets.salla.sa/cp/assets/images/logo-new.png'), alt: "store name", class: "s-rating-modal-store-logo" })),
|
|
167
|
+
h("h2", { class: "s-rating-modal-title" }, salla.lang.get('pages.rating.rate_the_store')),
|
|
168
|
+
h("div", { class: "s-rating-modal-stars-company" },
|
|
169
|
+
h("salla-rating-stars", { size: "large" })),
|
|
170
|
+
h("textarea", { name: "comment", class: "s-rating-modal-comment", placeholder: salla.lang.get('pages.rating.write_store_rate') }),
|
|
171
|
+
h("small", { class: "s-rating-modal-validation-msg" }))
|
|
172
|
+
: '',
|
|
173
|
+
this.order.products_enabled
|
|
174
|
+
? h("section", { class: "s-rating-modal-step s-rating-modal-hidden", "data-type": "products" }, this.order.products.map((item, index) => h("div", { class: "rating-outer-form s-rating-modal-product", "data-stars-error": salla.lang.get('pages.rating.rate_product_stars') },
|
|
175
|
+
h("div", { class: "s-rating-modal-product-img-wrap" },
|
|
176
|
+
h("img", { src: item.product.thumbnail, alt: item.product.name, class: "s-rating-modal-product-img" })),
|
|
177
|
+
h("div", { class: "s-rating-modal-product-details" },
|
|
178
|
+
h("h3", { class: "s-rating-modal-product-title" },
|
|
179
|
+
" ",
|
|
180
|
+
item.product.name),
|
|
181
|
+
h("div", { class: "s-rating-modal-stars-product" },
|
|
182
|
+
h("salla-rating-stars", { size: "small", name: `products[${index}][rating]` })),
|
|
183
|
+
h("input", { type: "hidden", name: `products[${index}][product_id]`, value: item.product.id }),
|
|
184
|
+
h("textarea", { placeholder: salla.lang.get('pages.rating.write_product_rate'), name: `products[${index}][comment]`, class: "s-rating-modal-comment" }),
|
|
185
|
+
h("small", { class: "s-rating-modal-validation-msg" })))))
|
|
186
|
+
: '',
|
|
187
|
+
this.order.shipping_enabled
|
|
188
|
+
? h("div", { class: "rating-outer-form s-rating-modal-step-wrap s-rating-modal-step s-rating-modal-hidden", "data-type": "shipping" },
|
|
189
|
+
h("input", { type: "hidden", name: "shipping_company_id", value: this.order.shipping.company.id }),
|
|
190
|
+
this.order.shipping.company.logo
|
|
191
|
+
? h("div", { class: "s-rating-modal-rounded-icon" },
|
|
192
|
+
h("img", { src: this.order.shipping.company.logo, class: "s-rating-modal-shipping-logo", alt: this.order.shipping.company.name }))
|
|
193
|
+
: h("span", { class: "s-rating-modal-icon", innerHTML: ShippingFast }),
|
|
194
|
+
h("div", { class: "s-rating-modal-title" },
|
|
155
195
|
" ",
|
|
156
|
-
|
|
157
|
-
h("div", { class: "s-rating-modal-stars-
|
|
158
|
-
h("salla-rating-stars", { size: "
|
|
159
|
-
h("
|
|
160
|
-
h("
|
|
161
|
-
|
|
162
|
-
:
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
h("
|
|
166
|
-
this.
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
" ",
|
|
172
|
-
salla.lang.get('pages.rating.rate_shipping') + ' ' + this.order.shipping.company.name),
|
|
173
|
-
h("div", { class: "s-rating-modal-stars-company" },
|
|
174
|
-
h("salla-rating-stars", { size: "large" })),
|
|
175
|
-
h("textarea", { name: "comment", class: "s-rating-modal-comment", placeholder: salla.lang.get('pages.rating.write_shipping_rate') }),
|
|
176
|
-
h("small", { class: "s-rating-modal-validation-msg" }))
|
|
177
|
-
: '',
|
|
178
|
-
h("div", { class: "s-rating-modal-thanks s-rating-modal-hidden", ref: el => this.thanksTab = el },
|
|
179
|
-
h("span", { class: "s-rating-modal-icon", innerHTML: CheckCircle2 }),
|
|
180
|
-
h("h3", { class: "s-rating-modal-thanks-title" }, salla.lang.get('pages.rating.thanks')),
|
|
181
|
-
h("div", { class: "s-rating-modal-thanks-msg", innerHTML: this.order.thanks_message }),
|
|
182
|
-
h("time", { class: "s-rating-modal-thanks-time", ref: el => this.thanksTime = el }))), h("div", { class: "s-rating-modal-footer" },
|
|
183
|
-
h("button", { ref: el => this.backBtn = el, onClick: () => this.previousTab(), class: "s-rating-modal-btn s-rating-modal-unvisiable" }, salla.lang.get('common.elements.back')),
|
|
184
|
-
this.stepsCount > 1 ? h("ul", { class: "s-rating-modal-dots" }, [0, 1, 2].slice(0, this.stepsCount).map(() => h("li", { class: 's-rating-modal-bg-gray s-rating-modal-step-dot' }))) : '',
|
|
185
|
-
h("salla-button", { "loader-position": 'center', ref: el => this.nextBtn = el, onClick: () => this.submit() }, salla.lang.get('common.elements.next'))),]
|
|
186
|
-
: '')));
|
|
196
|
+
salla.lang.get('pages.rating.rate_shipping') + ' ' + this.order.shipping.company.name),
|
|
197
|
+
h("div", { class: "s-rating-modal-stars-company" },
|
|
198
|
+
h("salla-rating-stars", { size: "large" })),
|
|
199
|
+
h("textarea", { name: "comment", class: "s-rating-modal-comment", placeholder: salla.lang.get('pages.rating.write_shipping_rate') }),
|
|
200
|
+
h("small", { class: "s-rating-modal-validation-msg" }))
|
|
201
|
+
: '',
|
|
202
|
+
h("div", { class: "s-rating-modal-thanks s-rating-modal-hidden", ref: el => this.thanksTab = el },
|
|
203
|
+
h("span", { class: "s-rating-modal-icon", innerHTML: CheckCircle2 }),
|
|
204
|
+
h("h3", { class: "s-rating-modal-thanks-title" }, salla.lang.get('pages.rating.thanks')),
|
|
205
|
+
h("div", { class: "s-rating-modal-thanks-msg", innerHTML: this.order.thanks_message }),
|
|
206
|
+
h("time", { class: "s-rating-modal-thanks-time", ref: el => this.thanksTime = el }))), h("div", { class: "s-rating-modal-footer" },
|
|
207
|
+
h("button", { ref: el => this.backBtn = el, onClick: () => this.previousTab(), class: "s-rating-modal-btn s-rating-modal-unvisiable" }, salla.lang.get('common.elements.back')),
|
|
208
|
+
this.stepsCount > 1 ? h("ul", { class: "s-rating-modal-dots" }, [0, 1, 2].slice(0, this.stepsCount).map(() => h("li", { class: 's-rating-modal-bg-gray s-rating-modal-step-dot' }))) : '',
|
|
209
|
+
h("salla-button", { "loader-position": 'center', ref: el => this.nextBtn = el, onClick: () => this.submit() }, salla.lang.get('common.elements.next'))),]
|
|
210
|
+
: '')));
|
|
187
211
|
}
|
|
188
212
|
componentDidLoad() {
|
|
189
213
|
salla.event.dispatch('rating::ready', this);
|
|
@@ -217,22 +241,21 @@ export class SallaRatingModal {
|
|
|
217
241
|
}; }
|
|
218
242
|
static get states() { return {
|
|
219
243
|
"order": {},
|
|
244
|
+
"hasError": {},
|
|
245
|
+
"errorMessage": {},
|
|
220
246
|
"translationLoaded": {}
|
|
221
247
|
}; }
|
|
222
248
|
static get methods() { return {
|
|
223
249
|
"open": {
|
|
224
250
|
"complexType": {
|
|
225
|
-
"signature": "() => Promise<
|
|
251
|
+
"signature": "() => Promise<any>",
|
|
226
252
|
"parameters": [],
|
|
227
253
|
"references": {
|
|
228
254
|
"Promise": {
|
|
229
255
|
"location": "global"
|
|
230
|
-
},
|
|
231
|
-
"NodeJS": {
|
|
232
|
-
"location": "global"
|
|
233
256
|
}
|
|
234
257
|
},
|
|
235
|
-
"return": "Promise<
|
|
258
|
+
"return": "Promise<any>"
|
|
236
259
|
},
|
|
237
260
|
"docs": {
|
|
238
261
|
"text": "Show the rating modal",
|
|
@@ -12,6 +12,7 @@ export class SallaScopees {
|
|
|
12
12
|
this.scopes = [];
|
|
13
13
|
this.originalScopesList = [];
|
|
14
14
|
this.isOpenedBefore = salla.storage.get("branch-choosed-before");
|
|
15
|
+
this.hasError = false;
|
|
15
16
|
/**
|
|
16
17
|
* Optionally open the modal or enforce the pop-up to the viewer
|
|
17
18
|
*/
|
|
@@ -53,9 +54,8 @@ export class SallaScopees {
|
|
|
53
54
|
else {
|
|
54
55
|
this.mode = ModeType.DEFAULT;
|
|
55
56
|
}
|
|
56
|
-
this.modal.loading();
|
|
57
57
|
this.modal.open();
|
|
58
|
-
return await (mode == ModeType.AVAILABILITY ? salla.scope.getProductAvailability(product_id) : salla.scope.get())
|
|
58
|
+
return await salla.api.withoutNotifier((mode == ModeType.AVAILABILITY ? salla.scope.getProductAvailability(product_id) : salla.scope.get())
|
|
59
59
|
.then((resp) => {
|
|
60
60
|
if (mode == ModeType.AVAILABILITY) {
|
|
61
61
|
this.setScopeValues(resp.data);
|
|
@@ -63,10 +63,13 @@ export class SallaScopees {
|
|
|
63
63
|
else {
|
|
64
64
|
this.setScopeValues(resp.data.scopes);
|
|
65
65
|
}
|
|
66
|
-
}).catch(e =>
|
|
66
|
+
}).catch(e => {
|
|
67
|
+
console.log(e);
|
|
68
|
+
this.hasError = true;
|
|
69
|
+
})
|
|
67
70
|
.finally(() => {
|
|
68
71
|
this.modal.stopLoading();
|
|
69
|
-
});
|
|
72
|
+
}));
|
|
70
73
|
}
|
|
71
74
|
/**
|
|
72
75
|
* Submit form to change exsiting scope.
|
|
@@ -175,9 +178,9 @@ export class SallaScopees {
|
|
|
175
178
|
this.originalScopesList.length > this.searchDisplayLimit ?
|
|
176
179
|
h("div", { class: "s-scopes-search-wrapper" },
|
|
177
180
|
h("div", { class: "s-scopes-search-icon", innerHTML: Search }),
|
|
178
|
-
h("input", { type: "text", class: "s-scopes-search-input", onInput: e => this.handleSearchFieldTyping(e), placeholder: salla.lang.get('blocks.scope.searching_for_a_branch') }))
|
|
181
|
+
h("input", { type: "text", class: "s-scopes-search-input", onInput: e => this.handleSearchFieldTyping(e), enterkeyhint: "search", placeholder: salla.lang.get('blocks.scope.searching_for_a_branch') }))
|
|
179
182
|
: "",
|
|
180
|
-
this.scopes.length < 2 ?
|
|
183
|
+
this.hasError || this.scopes.length < 2 ?
|
|
181
184
|
this.placeholderContent()
|
|
182
185
|
: this.mode === ModeType.DEFAULT ? this.defaultContent() : this.availabilityContent()))));
|
|
183
186
|
}
|
|
@@ -238,7 +241,8 @@ export class SallaScopees {
|
|
|
238
241
|
"scopes": {},
|
|
239
242
|
"originalScopesList": {},
|
|
240
243
|
"selected_scope": {},
|
|
241
|
-
"isOpenedBefore": {}
|
|
244
|
+
"isOpenedBefore": {},
|
|
245
|
+
"hasError": {}
|
|
242
246
|
}; }
|
|
243
247
|
static get methods() { return {
|
|
244
248
|
"close": {
|
|
@@ -97,7 +97,7 @@ export class SallaSearch {
|
|
|
97
97
|
render() {
|
|
98
98
|
var _a;
|
|
99
99
|
const searchContent = h("div", { class: { 's-search-container': true, 's-search-inline': this.inline }, ref: container => this.container = container },
|
|
100
|
-
h("input", { type: "
|
|
100
|
+
h("input", { type: "search", enterkeyhint: "search", autocomplete: "off", class: "s-search-input", placeholder: salla.lang.get('blocks.header.search_placeholder'), onInput: e => this.debounceSearch(e), onKeyDown: e => this.handleKeyDown(e), ref: input => this.searchInput = input, style: { height: this.height + 'px', borderRadius: this.oval ? this.height / 2 + 'px' : '' } }),
|
|
101
101
|
h("span", { class: "s-search-icon-wrap" },
|
|
102
102
|
h("span", { class: "s-search-icon", innerHTML: this.loading ? '<i class="s-search-spinner-loader"></i>' : Search })),
|
|
103
103
|
h("div", { class: "s-search-results" }, (_a = this.results) === null || _a === void 0 ? void 0 :
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
.s-select-label {
|
|
2
|
+
display: block;
|
|
3
|
+
margin-bottom: 0.5rem;
|
|
4
|
+
color: #111827;
|
|
5
|
+
font-size: 0.875rem;
|
|
6
|
+
line-height: 1.25rem;
|
|
7
|
+
font-weight: 500;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.s-select-underline {
|
|
11
|
+
display: block;
|
|
12
|
+
padding-left: 0;
|
|
13
|
+
padding-right: 0;
|
|
14
|
+
padding-top: 0.625rem;
|
|
15
|
+
padding-bottom: 0.625rem;
|
|
16
|
+
background-color: transparent;
|
|
17
|
+
color: #6B7280;
|
|
18
|
+
font-size: 0.875rem;
|
|
19
|
+
line-height: 1.25rem;
|
|
20
|
+
width: 100%;
|
|
21
|
+
border-width: 0;
|
|
22
|
+
border-bottom-width: 2px;
|
|
23
|
+
border-color: #E5E7EB;
|
|
24
|
+
appearance: none;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.s-select-outlined {
|
|
28
|
+
display: block;
|
|
29
|
+
padding: 0.625rem;
|
|
30
|
+
padding-top: 0.75rem;
|
|
31
|
+
padding-bottom: 0.75rem;
|
|
32
|
+
padding-left: 1rem;
|
|
33
|
+
padding-right: 1rem;
|
|
34
|
+
background-color: #F9FAFB;
|
|
35
|
+
color: #111827;
|
|
36
|
+
font-size: 0.875rem;
|
|
37
|
+
line-height: 1.25rem;
|
|
38
|
+
width: 100%;
|
|
39
|
+
border-radius: 0.5rem;
|
|
40
|
+
border-width: 1px;
|
|
41
|
+
border-color: #D1D5DB;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.s-select-x-large {
|
|
45
|
+
height: 5rem;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.s-select-large {
|
|
49
|
+
height: 4rem;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.s-select-normal {
|
|
53
|
+
height: 3rem;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.s-select-small {
|
|
57
|
+
height: 3rem;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.s-select-x-small {
|
|
61
|
+
height: 2.5rem;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.s-select-field {
|
|
65
|
+
padding-top: 0.25rem;
|
|
66
|
+
padding-bottom: 0.25rem;
|
|
67
|
+
padding-right: 0.5rem;
|
|
68
|
+
padding-left: 0.5rem;
|
|
69
|
+
margin: 0;
|
|
70
|
+
font-size: 1.125rem;
|
|
71
|
+
line-height: 1.75rem;
|
|
72
|
+
font-weight: 400;
|
|
73
|
+
line-height: 1.75rem;
|
|
74
|
+
width: 100%;
|
|
75
|
+
border-radius: 0.375rem;
|
|
76
|
+
border-color: #9CA3AF;
|
|
77
|
+
box-shadow: none;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.s-select-hint {
|
|
81
|
+
margin-top: 0.25rem;
|
|
82
|
+
color: #374151;
|
|
83
|
+
font-size: 0.875rem;
|
|
84
|
+
line-height: 1.25rem;
|
|
85
|
+
line-height: 1.25rem;
|
|
86
|
+
}
|