@salla.sa/twilight-components 1.6.15-alpha.20 → 1.6.15-alpha.3
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-ccab76e9.js → index-98e1eea0.js} +2 -2
- package/dist/cjs/{index-2d91726c.js → index-cac2fd59.js} +10 -89
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/salla-add-product-button.cjs.entry.js +1 -1
- package/dist/cjs/{salla-button_29.cjs.entry.js → salla-button_27.cjs.entry.js} +107 -231
- package/dist/cjs/salla-conditional-fields.cjs.entry.js +1 -1
- package/dist/cjs/salla-installment.cjs.entry.js +9 -4
- package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
- package/dist/cjs/salla-select.cjs.entry.js +1 -1
- package/dist/cjs/twilight.cjs.js +3 -3
- package/dist/collection/Helpers/Helper.js +15 -22
- package/dist/collection/collection-manifest.json +0 -2
- package/dist/collection/components/salla-gifting/salla-gifting.js +3 -9
- package/dist/collection/components/salla-infinite-scroll/salla-infinite-scroll.js +2 -1
- package/dist/collection/components/salla-installment/salla-installment.css +0 -3
- package/dist/collection/components/salla-installment/salla-installment.js +7 -2
- package/dist/collection/components/salla-localization-modal/salla-localization-modal.js +4 -2
- package/dist/collection/components/salla-login-modal/salla-login-modal.js +1 -1
- package/dist/collection/components/salla-modal/salla-modal.js +9 -18
- package/dist/collection/components/salla-offer-modal/salla-offer-modal.js +28 -61
- package/dist/collection/components/salla-placeholder/salla-placeholder.js +6 -6
- package/dist/collection/components/salla-product-availability/salla-product-availability.js +2 -2
- package/dist/collection/components/salla-product-size-guide/salla-product-size-guide.js +32 -32
- package/dist/collection/components/salla-quantity-input/salla-quantity-input.js +1 -1
- package/dist/collection/components/salla-rating-modal/salla-rating-modal.js +18 -15
- package/dist/collection/components/salla-rating-stars/salla-rating-stars.js +1 -1
- package/dist/collection/components/salla-search/salla-search.js +4 -3
- package/dist/collection/components/salla-swiper/salla-swiper.js +0 -1
- package/dist/collection/components/salla-tel-input/salla-tel-input.js +4 -2
- package/dist/collection/components/salla-verify/salla-verify.js +33 -38
- package/dist/components/Helper.js +15 -22
- package/dist/components/index.d.ts +0 -2
- package/dist/components/index.js +2 -4
- package/dist/components/salla-gifting.js +3 -7
- package/dist/components/salla-infinite-scroll.js +1 -0
- package/dist/components/salla-installment.js +8 -3
- package/dist/components/salla-localization-modal.js +4 -2
- package/dist/components/salla-login-modal.js +1 -1
- package/dist/components/salla-modal2.js +8 -10
- package/dist/components/salla-offer-modal.js +19 -41
- package/dist/components/salla-placeholder2.js +2 -2
- package/dist/components/salla-product-availability2.js +1 -1
- package/dist/components/salla-product-size-guide.js +6 -13
- package/dist/components/salla-rating-modal.js +21 -21
- package/dist/components/salla-rating-stars2.js +1 -1
- package/dist/components/salla-search.js +4 -3
- package/dist/components/salla-swiper2.js +0 -1
- package/dist/components/salla-tel-input2.js +3 -1
- package/dist/components/salla-verify2.js +31 -37
- package/dist/esm/{index-03197930.js → index-0ce70ad2.js} +10 -89
- package/dist/esm/{index-1cc8829f.js → index-294a3ac7.js} +2 -2
- package/dist/esm/loader.js +3 -3
- package/dist/esm/salla-add-product-button.entry.js +1 -1
- package/dist/esm/{salla-button_29.entry.js → salla-button_27.entry.js} +108 -230
- package/dist/esm/salla-conditional-fields.entry.js +1 -1
- package/dist/esm/salla-installment.entry.js +9 -4
- package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
- package/dist/esm/salla-scopes.entry.js +1 -1
- package/dist/esm/salla-select.entry.js +1 -1
- package/dist/esm/twilight.js +3 -3
- package/dist/esm-es5/index-0ce70ad2.js +4 -0
- package/dist/esm-es5/index-294a3ac7.js +24 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/salla-add-product-button.entry.js +1 -1
- package/dist/esm-es5/salla-button_27.entry.js +34 -0
- package/dist/esm-es5/salla-conditional-fields.entry.js +1 -1
- package/dist/esm-es5/salla-installment.entry.js +1 -1
- package/dist/esm-es5/salla-loyalty-prize-item.entry.js +1 -1
- package/dist/esm-es5/salla-scopes.entry.js +1 -1
- package/dist/esm-es5/salla-select.entry.js +1 -1
- package/dist/esm-es5/twilight.js +1 -1
- package/dist/twilight/p-05eb9983.system.js +24 -0
- package/dist/twilight/p-0db2b810.entry.js +4 -0
- package/dist/twilight/{p-2b8f1167.entry.js → p-10ac9c79.entry.js} +1 -1
- package/dist/twilight/{p-06ecc027.entry.js → p-13129ac9.entry.js} +1 -1
- package/dist/twilight/{p-f0415183.system.entry.js → p-1914490f.system.entry.js} +1 -1
- package/dist/twilight/p-24e726cc.system.entry.js +34 -0
- package/dist/twilight/{p-3feb37f5.system.entry.js → p-26a23097.system.entry.js} +1 -1
- package/dist/twilight/p-44829812.system.js +4 -0
- package/dist/twilight/{p-092ad6d4.entry.js → p-521b6fde.entry.js} +1 -1
- package/dist/twilight/p-5b6fe797.js +24 -0
- package/dist/twilight/{p-bac267ae.entry.js → p-97daba27.entry.js} +1 -1
- package/dist/twilight/{p-a1cd00a6.system.entry.js → p-a7caaba3.system.entry.js} +1 -1
- package/dist/twilight/{p-20584294.entry.js → p-bbc94b9b.entry.js} +1 -1
- package/dist/twilight/p-ca68752d.js +5 -0
- package/dist/twilight/p-ce3e3fa2.system.entry.js +4 -0
- package/dist/twilight/p-d64f3123.entry.js +22 -0
- package/dist/twilight/p-db0ba553.system.js +5 -0
- package/dist/twilight/{p-f7bb47ef.system.entry.js → p-dd9b3c90.system.entry.js} +1 -1
- package/dist/twilight/{p-a82f8d33.system.entry.js → p-f610b6bf.system.entry.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/twilight/twilight.js +1 -1
- package/dist/types/Helpers/Helper.d.ts +6 -6
- package/dist/types/components/salla-installment/salla-installment.d.ts +2 -1
- package/dist/types/components/salla-modal/salla-modal.d.ts +0 -1
- package/dist/types/components/salla-offer-modal/offer-schema.d.ts +0 -1
- package/dist/types/components/salla-offer-modal/salla-offer-modal.d.ts +0 -4
- package/dist/types/components/salla-placeholder/salla-placeholder.d.ts +3 -3
- package/dist/types/components/salla-rating-modal/salla-rating-modal.d.ts +1 -2
- package/dist/types/components/salla-verify/salla-verify.d.ts +1 -2
- package/dist/types/components.d.ts +7 -35
- package/package.json +4 -4
- package/dist/collection/components/salla-cart-summary/salla-cart-summary.css +0 -3
- package/dist/collection/components/salla-cart-summary/salla-cart-summary.js +0 -35
- package/dist/collection/components/salla-user-settings/salla-user-settings.css +0 -0
- package/dist/collection/components/salla-user-settings/salla-user-settings.js +0 -107
- package/dist/components/salla-cart-summary.d.ts +0 -11
- package/dist/components/salla-cart-summary.js +0 -53
- package/dist/components/salla-user-settings.d.ts +0 -11
- package/dist/components/salla-user-settings.js +0 -116
- package/dist/esm-es5/index-03197930.js +0 -4
- package/dist/esm-es5/index-1cc8829f.js +0 -24
- package/dist/esm-es5/salla-button_29.entry.js +0 -34
- package/dist/twilight/p-2bdd14ea.entry.js +0 -22
- package/dist/twilight/p-a058465b.system.js +0 -24
- package/dist/twilight/p-a2cc9062.entry.js +0 -4
- package/dist/twilight/p-b95c5d8c.system.entry.js +0 -34
- package/dist/twilight/p-c571b40b.js +0 -5
- package/dist/twilight/p-ca961962.system.js +0 -5
- package/dist/twilight/p-ee91a41b.system.js +0 -4
- package/dist/twilight/p-f59fe82e.js +0 -24
- package/dist/twilight/p-f99821d3.system.entry.js +0 -4
- package/dist/types/components/salla-cart-summary/salla-cart-summary.d.ts +0 -6
- package/dist/types/components/salla-user-settings/salla-user-settings.d.ts +0 -18
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
4
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
5
|
-
import { C as Cancel } from './cancel.js';
|
|
6
5
|
import { H as Helper } from './Helper.js';
|
|
6
|
+
import { C as Cancel } from './cancel.js';
|
|
7
7
|
import { d as defineCustomElement$1 } from './salla-loading2.js';
|
|
8
8
|
|
|
9
9
|
const AlertEngineIcon = `<!-- Generated by IcoMoon.io -->
|
|
@@ -71,9 +71,12 @@ const SallaModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
71
71
|
* Set the style of the header icon.
|
|
72
72
|
*/
|
|
73
73
|
this.iconStyle = undefined;
|
|
74
|
+
Helper.setHost(this.host);
|
|
74
75
|
salla.event.on('modal::open', target => target == this.host.id && this.open());
|
|
75
76
|
salla.event.on('modal::close', target => target == this.host.id && this.close());
|
|
76
77
|
this.modalTitle = this.host.getAttribute('modal-title');
|
|
78
|
+
// close modal on Escape button clicked
|
|
79
|
+
Helper.onKeyUp(document.body, e => e.keyCode === 27 && this.closeModal());
|
|
77
80
|
}
|
|
78
81
|
handleVisible(newValue) {
|
|
79
82
|
if (!newValue) {
|
|
@@ -85,11 +88,6 @@ const SallaModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
85
88
|
this.host.classList.remove('s-hidden');
|
|
86
89
|
setTimeout(() => this.toggleModal(true)); //small amont of time to running toggle After adding hidden
|
|
87
90
|
}
|
|
88
|
-
handleKeyUp(ev) {
|
|
89
|
-
if (ev.key === "KeyUp") {
|
|
90
|
-
this.closeModal();
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
91
|
/**
|
|
94
92
|
* Open the modal
|
|
95
93
|
*/
|
|
@@ -157,15 +155,15 @@ const SallaModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
157
155
|
render() {
|
|
158
156
|
this.host.id = this.host.id || 'salla-modal';
|
|
159
157
|
if (this.isLoading) {
|
|
160
|
-
return (h(Host, { class: 'salla-modal s-modal s-modal-container s-hidden', "aria-modal": "true", role: "dialog"
|
|
158
|
+
return (h(Host, { class: 'salla-modal s-modal s-modal-container s-hidden', "aria-modal": "true", role: "dialog" }, h("div", { class: "s-modal-overlay", ref: el => this.overlay = el, onClick: () => this.closeModal() }), h("div", { class: "s-modal-wrapper" }, h("span", { class: 's-modal-spacer s-modal-align-' + this.position }, "\u200B"), h("div", { class: 's-modal-body ' + 's-modal-align-' + this.position + ' s-modal-' + this.getWidth() + (this.noPadding ? ' s-modal-nopadding' : ' s-modal-padding') }, h("slot", { name: "loading" }, h("salla-loading", null)), h("div", { class: "s-hidden" }, h("slot", null))))));
|
|
161
159
|
}
|
|
162
160
|
return (h(Host, { class: 'salla-modal s-modal s-modal-container s-hidden', "aria-modal": "true", role: "dialog" }, h("div", { class: "s-modal-overlay", ref: el => this.overlay = el, onClick: () => this.closeModal() }), h("div", { class: "s-modal-wrapper" }, h("span", { class: 's-modal-spacer s-modal-align-' + this.position }, "\u200B"), h("div", { class: 's-modal-body ' + 's-modal-align-' + this.position + ' s-modal-' + this.getWidth() + (this.noPadding ? ' s-modal-nopadding' : ' s-modal-padding') }, h("div", { class: { 's-modal-header': true, 's-modal-is-center': this.centered } }, this.isClosable ?
|
|
163
161
|
h("button", { class: "s-modal-close", onClick: () => this.closeModal(), type: "button" }, h("span", { innerHTML: Cancel }))
|
|
164
162
|
: '', this.modalTitle || this.subTitle ?
|
|
165
163
|
h("div", { class: "s-modal-header-inner" }, h("slot", { name: 'icon' }, !!this.iconStyle ?
|
|
166
164
|
h("div", { class: this.iconBlockClasses(), innerHTML: this.iconStyle == 'error' ? AlertEngineIcon : CheckCircle2 })
|
|
167
|
-
: ''), h("div", { class: "s-modal-header-content" },
|
|
168
|
-
:
|
|
165
|
+
: ''), h("div", { class: "s-modal-header-content" }, h("div", { class: { 's-modal-title': true, 's-modal-title-below': this.subTitleFirst }, innerHTML: this.modalTitle }), h("p", { class: { 's-modal-sub-title': true }, innerHTML: this.subTitle })))
|
|
166
|
+
: ""), h("slot", null), h("slot", { name: "footer" })))));
|
|
169
167
|
}
|
|
170
168
|
//move the modal as root dom, because we need the model to be outside the forms
|
|
171
169
|
componentDidLoad() {
|
|
@@ -194,7 +192,7 @@ const SallaModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
194
192
|
"setTitle": [64],
|
|
195
193
|
"loading": [64],
|
|
196
194
|
"stopLoading": [64]
|
|
197
|
-
}
|
|
195
|
+
}]);
|
|
198
196
|
function defineCustomElement() {
|
|
199
197
|
if (typeof customElements === "undefined") {
|
|
200
198
|
return;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
4
|
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
5
|
+
import { H as Helper } from './Helper.js';
|
|
5
6
|
import { K as KeyboardArrowRightIcon } from './keyboard_arrow_right.js';
|
|
6
7
|
import { d as defineCustomElement$6 } from './salla-button2.js';
|
|
7
8
|
import { d as defineCustomElement$5 } from './salla-loading2.js';
|
|
@@ -46,15 +47,13 @@ const SallaOfferModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
46
47
|
this.offer = null;
|
|
47
48
|
this.hasError = false;
|
|
48
49
|
this.translationLoaded = false;
|
|
49
|
-
|
|
50
|
-
salla.event.on('offer-modal::open', product_id => this.open(product_id));
|
|
50
|
+
Helper.setHost(this.host);
|
|
51
|
+
salla.event.on('offer-modal::open', (product_id) => this.open(product_id));
|
|
51
52
|
salla.lang.onLoaded(() => {
|
|
52
|
-
this.addToCartLabel = salla.lang.get("pages.cart.add_to_cart");
|
|
53
53
|
this.translationLoaded = true;
|
|
54
54
|
});
|
|
55
|
-
this.categorySlot = ((_a =
|
|
56
|
-
this.productSlot = ((_b =
|
|
57
|
-
salla.event.on('offer-modal::open', product_id => this.open(product_id));
|
|
55
|
+
this.categorySlot = ((_a = Helper.getElement('[slot="category"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || `<span class="s-offer-modal-badge-icon">{tagIcon}</span><span class="s-offer-modal-badge-text">{name}</span>`;
|
|
56
|
+
this.productSlot = ((_b = Helper.getElement('[slot="product"]')) === null || _b === void 0 ? void 0 : _b.innerHTML) || this.defaultProductSlot();
|
|
58
57
|
salla.product.event.onOfferExisted(offer => {
|
|
59
58
|
if (salla.storage.get('remember-offer-' + offer.id)) {
|
|
60
59
|
salla.log('User selected to don\'t show this offer again.');
|
|
@@ -68,7 +67,6 @@ const SallaOfferModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
68
67
|
* @param product_id
|
|
69
68
|
*/
|
|
70
69
|
async open(product_id) {
|
|
71
|
-
this.productID = product_id;
|
|
72
70
|
//TODO:: make sure there is only one offer
|
|
73
71
|
this.modal.open();
|
|
74
72
|
return salla.api.withoutNotifier(() => salla.product.offers(product_id))
|
|
@@ -93,35 +91,6 @@ const SallaOfferModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
93
91
|
rememberMe(event) {
|
|
94
92
|
salla.storage.set('remember-offer-' + this.offer.id, event.target.checked);
|
|
95
93
|
}
|
|
96
|
-
addToCart(qty) {
|
|
97
|
-
//todo:: add enhancement, to cover the previous quantity, because if the discount to add two, user already added one before.
|
|
98
|
-
salla.api.withoutNotifier(() => salla.cart.quickAdd(this.productID, qty)).then(() => this.modal.close());
|
|
99
|
-
}
|
|
100
|
-
getOfferContent() {
|
|
101
|
-
var _a, _b, _c, _d;
|
|
102
|
-
if ((_a = this.offer.get.products) === null || _a === void 0 ? void 0 : _a.length) {
|
|
103
|
-
return h("div", { class: "s-offer-modal-scrolled-slider-wrap" }, h("div", { class: "s-offer-modal-body s-offer-modal-scrolled-slider" }, (_b = this.offer.get.products) === null || _b === void 0 ? void 0 : _b.map(product => h("div", { class: {
|
|
104
|
-
"s-offer-modal-product": true,
|
|
105
|
-
"s-offer-modal-slider-item": true,
|
|
106
|
-
"s-offer-modal-not-available": !product.is_available
|
|
107
|
-
}, id: 'product_' + product.id, innerHTML: this.productSlot
|
|
108
|
-
.replace(/\{name\}/g, product.name)
|
|
109
|
-
.replace(/\{url\}/g, product.url)
|
|
110
|
-
.replace(/\{image\}/g, product.thumbnail)
|
|
111
|
-
.replace(/\{price\}/g, product.has_special_price
|
|
112
|
-
? salla.money(product.price) + '<span class="s-offer-modal-product-old-price">' + salla.money(product.regular_price) + '</span>'
|
|
113
|
-
: salla.money(product.price)) }, h("div", { class: "s-offer-modal-btn-wrap" }, h("salla-button", { width: "wide", fill: 'outline', "data-id": product.id, disabled: !product.is_available, "loader-position": "center", onClick: this.addItem }, product.is_available ? salla.lang.get('pages.cart.add_to_cart') : salla.lang.get('pages.products.out_of_stock')))))), h("div", { class: "s-offer-modal-slider-nav" }, h("button", { class: "s-offer-modal-nav-btn s-offer-modal-prev-btn" }, h("span", { class: "s-offer-modal-nav-btn-icon", innerHTML: KeyboardArrowLeftIcon })), h("button", { class: "s-offer-modal-nav-btn s-offer-modal-next-btn" }, h("span", { class: "s-offer-modal-nav-btn-icon", innerHTML: KeyboardArrowRightIcon }))));
|
|
114
|
-
}
|
|
115
|
-
else if ((_c = this.offer.get.categories) === null || _c === void 0 ? void 0 : _c.length) {
|
|
116
|
-
return h("div", { class: "s-offer-modal-scrolled-slider-wrap" }, h("div", { class: "s-offer-modal-body s-offer-modal-scrolled-slider" }, this.offer.get.categories.map(category => h("a", { href: category.urls.customer, class: "s-offer-modal-badge s-offer-modal-slider-item", innerHTML: this.categorySlot
|
|
117
|
-
.replace(/\{tagIcon\}/g, Tag)
|
|
118
|
-
.replace(/\{name\}/g, category.name)
|
|
119
|
-
.replace(/\{url\}/g, category.urls.customer) }))), h("div", { class: "s-offer-modal-slider-nav" }, h("button", { class: "s-offer-modal-nav-btn s-offer-modal-prev-btn" }, h("span", { class: "s-offer-modal-nav-btn-icon", innerHTML: KeyboardArrowLeftIcon })), h("button", { class: "s-offer-modal-nav-btn s-offer-modal-next-btn" }, h("span", { class: "s-offer-modal-nav-btn-icon", innerHTML: KeyboardArrowRightIcon }))));
|
|
120
|
-
}
|
|
121
|
-
else if (this.offer.get.discounts_table) {
|
|
122
|
-
return h("div", { class: "s-offer-modal-discount-table" }, h("table", null, h("tbody", null, (_d = this.offer.get.discounts_table) === null || _d === void 0 ? void 0 : _d.map(discount => h("tr", null, h("td", null, discount.text), h("td", { class: "s-offer-modal-discount-table-cell" }, h("salla-button", { fill: "outline", shape: "btn", color: "primary", size: "medium", width: "normal", onClick: () => this.addToCart(discount.quantity) }, this.addToCartLabel)))))));
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
94
|
//todo:: pass event then use sallaButton from it
|
|
126
95
|
addItem() {
|
|
127
96
|
// this here, is sallaButton
|
|
@@ -138,17 +107,28 @@ const SallaOfferModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
138
107
|
'</div>';
|
|
139
108
|
}
|
|
140
109
|
render() {
|
|
110
|
+
var _a, _b;
|
|
141
111
|
return h("salla-modal", { "sub-title-first": true, "has-skeleton": true, "sub-title": this.offer_message, ref: modal => this.modal = modal, isLoading: true }, h("div", { slot: 'loading' }, h("div", { class: "s-offer-modal-skeleton" }, h("div", { class: "s-offer-modal-skeleton-header" }, h("salla-skeleton", { type: 'circle', height: '80px', width: '80px' }), h("salla-skeleton", { height: '15px', width: '50%' }), h("salla-skeleton", { height: '10px', width: '30%' })), h("div", { class: "s-offer-modal-skeleton-items" }, [...Array(3)].map(() => h("div", { class: "s-offer-modal-skeleton-item" }, h("salla-skeleton", { height: '9rem' }), h("div", { class: "s-offer-modal-skeleton-item-title" }, h("salla-skeleton", { height: '15px', width: '100%' })), h("div", { class: "s-offer-modal-skeleton-item-subtitle" }, h("salla-skeleton", { height: '9px', width: '50%' }), h("div", { innerHTML: Cart2 }))))), h("div", { class: "s-offer-modal-skeleton-footer" }, h("salla-skeleton", { height: '15px', width: '50%' }), h("salla-skeleton", { height: '15px', width: '30%' })))), !this.hasError && this.offer !== null
|
|
142
|
-
? [h("span", { slot: 'icon', class: "s-offer-modal-header-icon", innerHTML: SpecialDiscountIcon }),
|
|
112
|
+
? [h("span", { slot: 'icon', class: "s-offer-modal-header-icon", innerHTML: SpecialDiscountIcon }), h("div", { class: "s-offer-modal-scrolled-slider-wrap" }, h("div", { class: "s-offer-modal-body s-offer-modal-scrolled-slider" }, ((_a = this.offer.get.categories) === null || _a === void 0 ? void 0 : _a.length) > 0
|
|
113
|
+
? this.offer.get.categories.map(category => h("a", { href: category.urls.customer, class: "s-offer-modal-badge s-offer-modal-slider-item", innerHTML: this.categorySlot
|
|
114
|
+
.replace(/\{tagIcon\}/g, Tag)
|
|
115
|
+
.replace(/\{name\}/g, category.name)
|
|
116
|
+
.replace(/\{url\}/g, category.urls.customer) }))
|
|
117
|
+
: (_b = this.offer.get.products) === null || _b === void 0 ? void 0 : _b.map(product => h("div", { class: { "s-offer-modal-product": true, "s-offer-modal-slider-item": true, "s-offer-modal-not-available": !product.is_available }, id: 'product_' + product.id, innerHTML: this.productSlot
|
|
118
|
+
.replace(/\{name\}/g, product.name)
|
|
119
|
+
.replace(/\{url\}/g, product.url)
|
|
120
|
+
.replace(/\{image\}/g, product.thumbnail)
|
|
121
|
+
.replace(/\{price\}/g, product.has_special_price
|
|
122
|
+
? salla.money(product.price) + '<span class="s-offer-modal-product-old-price">' + salla.money(product.regular_price) + '</span>'
|
|
123
|
+
: salla.money(product.price)) }, h("div", { class: "s-offer-modal-btn-wrap" }, h("salla-button", { width: "wide", fill: 'outline', "data-id": product.id, disabled: !product.is_available, "loader-position": "center", onClick: this.addItem }, product.is_available ? salla.lang.get('pages.cart.add_to_cart') : salla.lang.get('pages.products.out_of_stock')))))), h("div", { class: "s-offer-modal-slider-nav" }, h("button", { class: "s-offer-modal-nav-btn s-offer-modal-prev-btn" }, h("span", { class: "s-offer-modal-nav-btn-icon", innerHTML: KeyboardArrowLeftIcon })), h("button", { class: "s-offer-modal-nav-btn s-offer-modal-next-btn" }, h("span", { class: "s-offer-modal-nav-btn-icon", innerHTML: KeyboardArrowRightIcon })))), h("div", { class: "s-offer-modal-footer", slot: "footer" }, this.offer.formatted_date ?
|
|
143
124
|
h("p", { class: "s-offer-modal-expiry" }, salla.lang.get('pages.products.offer_expires_in'), " ", this.offer.formatted_date)
|
|
144
125
|
: '', h("label", { class: "s-offer-modal-remember-label" }, h("input", { type: "checkbox", onChange: e => this.rememberMe(e), class: "s-offer-modal-remember-input" }), "\u00A0 ", salla.lang.get('common.elements.remember_my_choice'))),
|
|
145
126
|
] :
|
|
146
127
|
h("salla-placeholder", { class: "s-loyalty-placeholder", alignment: "center" }, !!this.errorMessage ? h("span", { slot: "description" }, this.errorMessage) : ''));
|
|
147
128
|
}
|
|
148
129
|
componentDidRender() {
|
|
149
|
-
var _a, _b;
|
|
150
130
|
// Sooo mini Slider
|
|
151
|
-
if (this.offer &&
|
|
131
|
+
if (this.offer && window.screen.width > 639) {
|
|
152
132
|
let sliderWrap = this.modal.querySelector('.s-offer-modal-scrolled-slider-wrap'), slider = this.modal.querySelector('.s-offer-modal-scrolled-slider'), navButtons = this.modal.querySelectorAll('.s-offer-modal-nav-btn'), nexBtn = this.modal.querySelector('.s-offer-modal-next-btn'), prevBtn = this.modal.querySelector('.s-offer-modal-prev-btn'), items = this.modal.querySelectorAll('.s-offer-modal-slider-item'), sliderNavMargin = 20, // space before displaying the next/prev btns.
|
|
153
133
|
current = 0, // current slide
|
|
154
134
|
slidesToScroll = 3, itemsLength = items.length;
|
|
@@ -199,9 +179,7 @@ const SallaOfferModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
199
179
|
"offer_message": [32],
|
|
200
180
|
"hasError": [32],
|
|
201
181
|
"errorMessage": [32],
|
|
202
|
-
"productID": [32],
|
|
203
182
|
"translationLoaded": [32],
|
|
204
|
-
"addToCartLabel": [32],
|
|
205
183
|
"open": [64],
|
|
206
184
|
"showOffer": [64]
|
|
207
185
|
}]);
|
|
@@ -18,7 +18,7 @@ const SallaPlaceholder = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
18
18
|
this.__registerHost();
|
|
19
19
|
this.translationLoaded = false;
|
|
20
20
|
/**
|
|
21
|
-
* Custom icon to display, defaults to [`
|
|
21
|
+
* Custom icon to display, defaults to [`sicon-inbox`]
|
|
22
22
|
*/
|
|
23
23
|
this.icon = Inbox;
|
|
24
24
|
/**
|
|
@@ -26,7 +26,7 @@ const SallaPlaceholder = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
26
26
|
*/
|
|
27
27
|
this.alignment = 'left';
|
|
28
28
|
/**
|
|
29
|
-
* The size of the icon. Defaults to [`md`]
|
|
29
|
+
* The size of the icon. Defaults to [`md`]
|
|
30
30
|
*/
|
|
31
31
|
this.iconSize = 'md';
|
|
32
32
|
salla.lang.onLoaded(() => {
|
|
@@ -21,7 +21,7 @@ const SallaProductAvailability = /*@__PURE__*/ proxyCustomElement(class extends
|
|
|
21
21
|
constructor() {
|
|
22
22
|
super();
|
|
23
23
|
this.__registerHost();
|
|
24
|
-
this.isUser =
|
|
24
|
+
this.isUser = Helper.isUser();
|
|
25
25
|
this.translationLoaded = false;
|
|
26
26
|
/**
|
|
27
27
|
* product id that can visitor subscribe to its availability notification
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
4
|
+
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
5
|
+
import { H as Helper } from './Helper.js';
|
|
5
6
|
import { d as defineCustomElement$8 } from './salla-loading2.js';
|
|
6
7
|
import { d as defineCustomElement$7 } from './salla-modal2.js';
|
|
7
8
|
import { d as defineCustomElement$6 } from './salla-placeholder2.js';
|
|
@@ -10,13 +11,6 @@ import { d as defineCustomElement$4 } from './salla-tab-content2.js';
|
|
|
10
11
|
import { d as defineCustomElement$3 } from './salla-tab-header2.js';
|
|
11
12
|
import { d as defineCustomElement$2 } from './salla-tabs2.js';
|
|
12
13
|
|
|
13
|
-
const PencilRuler = `<!-- Generated by IcoMoon.io -->
|
|
14
|
-
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
|
15
|
-
<title>pencil-ruler</title>
|
|
16
|
-
<path d="M3.057 11.609c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l6.667-6.667c0.521-0.521 0.521-1.364 0-1.885l-1.285-1.285c-1.143-1.143-2.661-1.772-4.276-1.772-1.616 0-3.135 0.629-4.276 1.772-1.143 1.141-1.772 2.66-1.772 4.276 0 1.615 0.629 3.135 1.772 4.276zM3.657 3.657c1.277-1.277 3.504-1.277 4.781 0l0.343 0.343-4.781 4.781-0.343-0.343c-0.639-0.639-0.991-1.488-0.991-2.391s0.352-1.752 0.991-2.391zM29.317 20.972c-0.2-0.707-0.932-1.119-1.645-0.921-0.709 0.2-1.121 0.937-0.921 1.645l1.987 7.041-7.041-1.987c-0.707-0.195-1.444 0.213-1.645 0.921-0.2 0.708 0.212 1.445 0.921 1.645l9.333 2.633c0.119 0.032 0.24 0.049 0.361 0.049 0.349 0 0.689-0.137 0.943-0.391 0.341-0.341 0.472-0.84 0.34-1.305zM31.609 8.772l-8.381-8.381c-0.5-0.5-1.385-0.5-1.885 0l-8.171 8.171s-0.001 0-0.001 0.001 0 0.001-0.001 0.001l-4.607 4.607s0 0-0.001 0 0 0 0 0.001l-8.171 8.171c-0.251 0.249-0.391 0.588-0.391 0.943 0 0.353 0.14 0.693 0.391 0.943l8.381 8.381c0.249 0.251 0.589 0.391 0.943 0.391s0.693-0.14 0.943-0.391l20.952-20.952c0.521-0.521 0.521-1.365 0-1.885zM9.715 28.781l-6.495-6.496 1.676-1.676 1.851 1.851c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.364 0-1.885l-1.851-1.851 2.724-2.724 3.008 3.008c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.364 0-1.885l-3.008-3.008 2.724-2.724 1.851 1.851c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.52 0.521-1.364 0-1.885l-1.851-1.851 2.724-2.724 3.008 3.008c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.365 0-1.885l-3.008-3.008 1.677-1.677 6.496 6.496z"></path>
|
|
17
|
-
</svg>
|
|
18
|
-
`;
|
|
19
|
-
|
|
20
14
|
const sallaProductSizeGuideCss = "";
|
|
21
15
|
|
|
22
16
|
const SallaProductSizeGuide$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
@@ -24,6 +18,7 @@ const SallaProductSizeGuide$1 = /*@__PURE__*/ proxyCustomElement(class extends H
|
|
|
24
18
|
super();
|
|
25
19
|
this.__registerHost();
|
|
26
20
|
this.hasError = false;
|
|
21
|
+
Helper.setHost(document);
|
|
27
22
|
salla.event.on('size-guide::open', (product_id) => this.open(product_id));
|
|
28
23
|
salla.lang.onLoaded(() => {
|
|
29
24
|
this.placeholder_title = salla.lang.get('pages.products.size_guide_placeholder');
|
|
@@ -61,11 +56,9 @@ const SallaProductSizeGuide$1 = /*@__PURE__*/ proxyCustomElement(class extends H
|
|
|
61
56
|
return h("salla-placeholder", { alignment: "center", iconSize: "xl" }, h("div", { slot: "title" }, this.placeholder_title), h("div", { slot: "description" }, this.placeholder_description));
|
|
62
57
|
}
|
|
63
58
|
render() {
|
|
64
|
-
return (h(
|
|
65
|
-
[
|
|
66
|
-
|
|
67
|
-
]
|
|
68
|
-
: this.showPlaceholder(), h("slot", { name: "footer" })));
|
|
59
|
+
return (h(Host, { class: "s-product-size-guide-block" }, h("salla-modal", { id: 'salla-product-size-guide-modal', isLoading: true, "has-skeleton": true, width: "md", ref: modal => this.modal = modal }, h("div", { slot: "loading" }, h("div", { class: "s-product-size-guide-skeleton" }, h("salla-skeleton", { height: '15px', width: '25%' }), h("div", { class: "s-product-size-guide-skeleton-header" }, h("salla-skeleton", { height: '40px' }), h("salla-skeleton", { height: '40px' }), h("salla-skeleton", { height: '40px' }), h("salla-skeleton", { height: '40px' })), h("div", { class: "s-product-size-guide-skeleton-content" }, h("salla-skeleton", { height: '15px', width: '25%' }), h("salla-skeleton", { height: '10px', width: '75%' }), h("salla-skeleton", { height: '10px', width: '50%' }), h("salla-skeleton", { height: '10px', width: '75%' }), h("salla-skeleton", { height: '10px', width: '100%' }), h("salla-skeleton", { height: '10px', width: '25%' }), h("salla-skeleton", { height: '10px', width: '60%' }), h("salla-skeleton", { height: '10px', width: '45%' }), h("salla-skeleton", { height: '10px', width: '30%' })))), h("slot", { name: "header" }), !this.hasError && !!this.guides ?
|
|
60
|
+
[h("div", { class: "container px-8" }, h("salla-tabs", null, this.guides.map((guide) => h("salla-tab-header", { slot: "header", name: guide.name }, h("span", null, guide.name))), this.guides.map((guide) => h("salla-tab-content", { slot: "content", name: guide.name }, h("div", { innerHTML: guide.description })))))]
|
|
61
|
+
: this.showPlaceholder(), h("slot", { name: "footer" }))));
|
|
69
62
|
}
|
|
70
63
|
get host() { return this; }
|
|
71
64
|
static get style() { return sallaProductSizeGuideCss; }
|
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
4
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
5
|
-
import { C as CheckCircle2, d as defineCustomElement$5 } from './salla-modal2.js';
|
|
6
5
|
import { H as Helper } from './Helper.js';
|
|
7
|
-
import { d as defineCustomElement$
|
|
8
|
-
import { d as defineCustomElement$6 } from './salla-
|
|
9
|
-
import { d as defineCustomElement$
|
|
6
|
+
import { C as CheckCircle2, d as defineCustomElement$4 } from './salla-modal2.js';
|
|
7
|
+
import { d as defineCustomElement$6 } from './salla-button2.js';
|
|
8
|
+
import { d as defineCustomElement$5 } from './salla-loading2.js';
|
|
10
9
|
import { d as defineCustomElement$3 } from './salla-rating-stars2.js';
|
|
11
10
|
import { d as defineCustomElement$2 } from './salla-skeleton2.js';
|
|
12
11
|
|
|
@@ -39,6 +38,7 @@ const SallaRatingModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
|
39
38
|
*/
|
|
40
39
|
this.orderId = salla.config.get('page.id');
|
|
41
40
|
this.translationLoaded = false;
|
|
41
|
+
Helper.setHost(document);
|
|
42
42
|
salla.event.on('rating::open', () => this.open());
|
|
43
43
|
salla.lang.onLoaded(() => {
|
|
44
44
|
this.translationLoaded = true;
|
|
@@ -48,17 +48,22 @@ const SallaRatingModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
|
48
48
|
* Show the rating modal
|
|
49
49
|
*/
|
|
50
50
|
async open() {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
.then(
|
|
54
|
-
.then(() => this.modal.stopLoading())
|
|
55
|
-
.then(() => this.stepsCount = [this.order.testimonials_enabled, this.order.products_enabled, this.order.shipping_enabled].filter(enabled => enabled).length)
|
|
56
|
-
.then(() => setTimeout(() => this.handleWizard(), 100))
|
|
51
|
+
this.modal.open();
|
|
52
|
+
return await salla.api.withoutNotifier(() => salla.rating.api.order(this.orderId))
|
|
53
|
+
.then(res => this.order = res.data)
|
|
57
54
|
.catch(e => {
|
|
58
55
|
var _a, _b, _c, _d;
|
|
59
56
|
this.hasError = true;
|
|
60
57
|
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);
|
|
61
|
-
|
|
58
|
+
})
|
|
59
|
+
.finally(() => {
|
|
60
|
+
var _a, _b, _c;
|
|
61
|
+
this.modal.setTitle(`${salla.lang.get('pages.rating.rate_order')} <span class="unicode">${!!this.order ? `(#${this.order.id})` : ''}</span>`);
|
|
62
|
+
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;
|
|
63
|
+
setTimeout(() => this.handleWizard(), 100);
|
|
64
|
+
setTimeout(() => {
|
|
65
|
+
this.modal.stopLoading();
|
|
66
|
+
}, 1000);
|
|
62
67
|
});
|
|
63
68
|
}
|
|
64
69
|
/**
|
|
@@ -87,7 +92,7 @@ const SallaRatingModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
|
87
92
|
let nextType = (_a = this.steps[this.currentIndex + 1]) === null || _a === void 0 ? void 0 : _a.dataset.type;
|
|
88
93
|
(_b = this.nextBtn) === null || _b === void 0 ? void 0 : _b.setText(nextType ? salla.lang.get('pages.rating.rate') + ' ' + salla.lang.get('pages.rating.' + nextType)
|
|
89
94
|
: salla.lang.get('pages.rating.send_ratings'));
|
|
90
|
-
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.
|
|
95
|
+
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'); });
|
|
91
96
|
}
|
|
92
97
|
previousTab() {
|
|
93
98
|
this.currentIndex > 0 && this.currentIndex--;
|
|
@@ -173,7 +178,7 @@ const SallaRatingModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
|
173
178
|
? h("div", { class: "s-rating-modal-rounded-icon" }, h("img", { src: this.order.shipping.company.logo, class: "s-rating-modal-shipping-logo", alt: this.order.shipping.company.name }))
|
|
174
179
|
: h("span", { class: "s-rating-modal-icon", innerHTML: ShippingFast }), h("div", { class: "s-rating-modal-title" }, " ", salla.lang.get('pages.rating.rate_shipping') + ' ' + this.order.shipping.company.name), h("div", { class: "s-rating-modal-stars-company" }, h("salla-rating-stars", { size: "large" })), h("textarea", { name: "comment", class: "s-rating-modal-comment", placeholder: salla.lang.get('pages.rating.write_shipping_rate') }), h("small", { class: "s-rating-modal-validation-msg" }))
|
|
175
180
|
: '', h("div", { class: "s-rating-modal-thanks s-rating-modal-hidden", ref: el => this.thanksTab = el }, h("span", { class: "s-rating-modal-icon", innerHTML: CheckCircle2 }), h("h3", { class: "s-rating-modal-thanks-title" }, salla.lang.get('pages.rating.thanks')), h("div", { class: "s-rating-modal-thanks-msg", innerHTML: this.order.thanks_message }), h("time", { class: "s-rating-modal-thanks-time", ref: el => this.thanksTime = el }))), h("div", { class: "s-rating-modal-footer" }, 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')), 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' }))) : '', h("salla-button", { "loader-position": 'center', ref: el => this.nextBtn = el, onClick: () => this.submit() }, salla.lang.get('common.elements.next'))),]
|
|
176
|
-
:
|
|
181
|
+
: '')));
|
|
177
182
|
}
|
|
178
183
|
componentDidLoad() {
|
|
179
184
|
salla.event.dispatch('rating::ready', this);
|
|
@@ -193,7 +198,7 @@ function defineCustomElement$1() {
|
|
|
193
198
|
if (typeof customElements === "undefined") {
|
|
194
199
|
return;
|
|
195
200
|
}
|
|
196
|
-
const components = ["salla-rating-modal", "salla-button", "salla-loading", "salla-modal", "salla-
|
|
201
|
+
const components = ["salla-rating-modal", "salla-button", "salla-loading", "salla-modal", "salla-rating-stars", "salla-skeleton"];
|
|
197
202
|
components.forEach(tagName => { switch (tagName) {
|
|
198
203
|
case "salla-rating-modal":
|
|
199
204
|
if (!customElements.get(tagName)) {
|
|
@@ -201,21 +206,16 @@ function defineCustomElement$1() {
|
|
|
201
206
|
}
|
|
202
207
|
break;
|
|
203
208
|
case "salla-button":
|
|
204
|
-
if (!customElements.get(tagName)) {
|
|
205
|
-
defineCustomElement$7();
|
|
206
|
-
}
|
|
207
|
-
break;
|
|
208
|
-
case "salla-loading":
|
|
209
209
|
if (!customElements.get(tagName)) {
|
|
210
210
|
defineCustomElement$6();
|
|
211
211
|
}
|
|
212
212
|
break;
|
|
213
|
-
case "salla-
|
|
213
|
+
case "salla-loading":
|
|
214
214
|
if (!customElements.get(tagName)) {
|
|
215
215
|
defineCustomElement$5();
|
|
216
216
|
}
|
|
217
217
|
break;
|
|
218
|
-
case "salla-
|
|
218
|
+
case "salla-modal":
|
|
219
219
|
if (!customElements.get(tagName)) {
|
|
220
220
|
defineCustomElement$4();
|
|
221
221
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
4
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
5
|
-
import { S as Star2 } from './star2.js';
|
|
6
5
|
import { H as Helper } from './Helper.js';
|
|
6
|
+
import { S as Star2 } from './star2.js';
|
|
7
7
|
|
|
8
8
|
const sallaRatingStarsCss = "";
|
|
9
9
|
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
4
|
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
5
|
-
import { S as Search } from './search.js';
|
|
6
5
|
import { H as Helper } from './Helper.js';
|
|
6
|
+
import { S as Search } from './search.js';
|
|
7
7
|
import { d as defineCustomElement$3 } from './salla-loading2.js';
|
|
8
8
|
import { d as defineCustomElement$2 } from './salla-modal2.js';
|
|
9
9
|
|
|
@@ -31,7 +31,8 @@ const SallaSearch$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
31
31
|
* Sets the height of the input
|
|
32
32
|
*/
|
|
33
33
|
this.height = 60;
|
|
34
|
-
|
|
34
|
+
Helper.setHost(this.host);
|
|
35
|
+
this.productSlot = ((_a = Helper.getElement('[slot="product"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || this.getDefaultProductSlot();
|
|
35
36
|
salla.event.on('search::open', () => this.open());
|
|
36
37
|
salla.lang.onLoaded(() => {
|
|
37
38
|
this.translationLoaded = true;
|
|
@@ -81,7 +82,7 @@ const SallaSearch$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
81
82
|
}
|
|
82
83
|
}
|
|
83
84
|
search(val) {
|
|
84
|
-
this.noResults
|
|
85
|
+
Helper.hideElement(this.noResults);
|
|
85
86
|
//run loading spinner or stop it
|
|
86
87
|
this.loading = true;
|
|
87
88
|
salla.product.search(val)
|
|
@@ -4999,7 +4999,6 @@ const SallaSwiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement$1
|
|
|
4999
4999
|
}
|
|
5000
5000
|
initSwiper() {
|
|
5001
5001
|
for (const slide of this.swiperWrapper.children) {
|
|
5002
|
-
//todo:: use `s-swiper-slide`
|
|
5003
5002
|
slide.classList.add('swiper-slide');
|
|
5004
5003
|
}
|
|
5005
5004
|
this.swiper = new Swiper(this.swiperContainer, {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
5
5
|
import { a as createCommonjsModule } from './_commonjsHelpers.js';
|
|
6
|
+
import { H as Helper } from './Helper.js';
|
|
6
7
|
|
|
7
8
|
var intlTelInput$1 = createCommonjsModule(function (module) {
|
|
8
9
|
/*
|
|
@@ -1378,7 +1379,7 @@ const SallaTelInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
1378
1379
|
/**
|
|
1379
1380
|
* Current country_code
|
|
1380
1381
|
*/
|
|
1381
|
-
this.countryCode = salla.config.get('user.country_code', 'SA')
|
|
1382
|
+
this.countryCode = salla.config.get('user.country_code', 'SA');
|
|
1382
1383
|
this.countryCodeLabel = salla.lang.get('common.country_code');
|
|
1383
1384
|
this.mobileLabel = salla.lang.get('common.elements.mobile');
|
|
1384
1385
|
this.tooShort = salla.lang.get('common.errors.too_short', { attribute: this.mobileLabel });
|
|
@@ -1386,6 +1387,7 @@ const SallaTelInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
1386
1387
|
this.invalidCountryCode = salla.lang.get('common.errors.invalid_value', { attribute: this.countryCodeLabel });
|
|
1387
1388
|
this.invalidNumber = salla.lang.get('common.errors.invalid_value', { attribute: this.mobileLabel });
|
|
1388
1389
|
this.errorMap = [this.invalidNumber, this.invalidCountryCode, this.tooShort, this.tooLong, this.invalidNumber];
|
|
1390
|
+
Helper.setHost(this.host);
|
|
1389
1391
|
salla.lang.onLoaded(() => {
|
|
1390
1392
|
this.mobileLabel = salla.lang.get('common.elements.mobile');
|
|
1391
1393
|
this.countryCodeLabel = salla.lang.get('common.elements.country_code');
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
4
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
5
|
-
import {
|
|
5
|
+
import { H as Helper } from './Helper.js';
|
|
6
6
|
import { d as defineCustomElement$3 } from './salla-button2.js';
|
|
7
7
|
import { d as defineCustomElement$2 } from './salla-loading2.js';
|
|
8
8
|
import { d as defineCustomElement$1 } from './salla-modal2.js';
|
|
@@ -21,6 +21,7 @@ const SallaVerify = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
21
21
|
super();
|
|
22
22
|
this.__registerHost();
|
|
23
23
|
this.verified = createEvent(this, "verified", 7);
|
|
24
|
+
this.initiated = false;
|
|
24
25
|
this.translationLoaded = false;
|
|
25
26
|
/**
|
|
26
27
|
* Should render component without modal
|
|
@@ -43,6 +44,7 @@ const SallaVerify = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
43
44
|
* to use: `salla.api.auth.verify` or `salla.profile.verify`
|
|
44
45
|
*/
|
|
45
46
|
this.isProfileVerify = false;
|
|
47
|
+
// Helper.setHost(this.host);
|
|
46
48
|
salla.lang.onLoaded(() => {
|
|
47
49
|
var _a;
|
|
48
50
|
this.translationLoaded = true;
|
|
@@ -65,30 +67,6 @@ const SallaVerify = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
65
67
|
this.timer.innerHTML = '30 : 00';
|
|
66
68
|
});
|
|
67
69
|
}
|
|
68
|
-
handleKeyUp(ev) {
|
|
69
|
-
var _a, _b, _c, _d;
|
|
70
|
-
if (['Alt', 'Shift', 'Control', 'AltGraph', 'Ctrl'].includes(ev.key)) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
let key = ev.keyCode || ev.charCode;
|
|
74
|
-
if (ev.target.value) {
|
|
75
|
-
(_a = ev.target.nextElementSibling) === null || _a === void 0 ? void 0 : _a.focus();
|
|
76
|
-
(_b = ev.target.nextElementSibling) === null || _b === void 0 ? void 0 : _b.select();
|
|
77
|
-
}
|
|
78
|
-
else if ([8, 46].includes(key)) {
|
|
79
|
-
(_c = ev.target.previousElementSibling) === null || _c === void 0 ? void 0 : _c.focus();
|
|
80
|
-
(_d = ev.target.previousElementSibling) === null || _d === void 0 ? void 0 : _d.select();
|
|
81
|
-
}
|
|
82
|
-
this.toggleOTPSubmit();
|
|
83
|
-
}
|
|
84
|
-
handlePaste(ev) {
|
|
85
|
-
let text = salla.helpers.number(ev.clipboardData.getData('text'))
|
|
86
|
-
.replace(/[^0-9.]/g, '')
|
|
87
|
-
.replace('..', '.');
|
|
88
|
-
this.otpInputs.forEach((input, i) => input.value = text[i] || '');
|
|
89
|
-
this.toggleOTPSubmit();
|
|
90
|
-
setTimeout(() => this.otpInputs[3].focus(), 100);
|
|
91
|
-
}
|
|
92
70
|
/**
|
|
93
71
|
* Get current code
|
|
94
72
|
* @return {string}
|
|
@@ -107,6 +85,30 @@ const SallaVerify = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
107
85
|
this.type = this.data.type;
|
|
108
86
|
this.resendTimer();
|
|
109
87
|
this.otpInputs = this.body.querySelectorAll('.s-verify-input');
|
|
88
|
+
if (!this.initiated) {
|
|
89
|
+
Helper.on('input', '.s-verify-input', e => salla.helpers.inputDigitsOnly(e.target));
|
|
90
|
+
Helper.onKeyUp('.s-verify-input', event => {
|
|
91
|
+
var _a, _b, _c, _d;
|
|
92
|
+
let key = event.keyCode || event.charCode;
|
|
93
|
+
if (event.target.value) {
|
|
94
|
+
(_a = event.target.nextElementSibling) === null || _a === void 0 ? void 0 : _a.focus();
|
|
95
|
+
(_b = event.target.nextElementSibling) === null || _b === void 0 ? void 0 : _b.select();
|
|
96
|
+
}
|
|
97
|
+
else if ([8, 46].includes(key)) {
|
|
98
|
+
(_c = event.target.previousElementSibling) === null || _c === void 0 ? void 0 : _c.focus();
|
|
99
|
+
(_d = event.target.previousElementSibling) === null || _d === void 0 ? void 0 : _d.select();
|
|
100
|
+
}
|
|
101
|
+
this.toggleOTPSubmit();
|
|
102
|
+
});
|
|
103
|
+
Helper.on('paste', '.s-verify-input', event => {
|
|
104
|
+
let text = salla.helpers.number(event.clipboardData.getData('text')).replace(/[^0-9.]/g, '').replace('..', '.');
|
|
105
|
+
this.otpInputs.forEach((input, i) => input.value = text[i] || '');
|
|
106
|
+
this.toggleOTPSubmit();
|
|
107
|
+
setTimeout(() => this.otpInputs[3].focus(), 100);
|
|
108
|
+
});
|
|
109
|
+
// return this.modal.open();
|
|
110
|
+
this.initiated = true;
|
|
111
|
+
}
|
|
110
112
|
this.reset();
|
|
111
113
|
this.display == 'modal' && ((_a = this.modal) === null || _a === void 0 ? void 0 : _a.setTitle(this.title));
|
|
112
114
|
this.modal.open();
|
|
@@ -130,14 +132,12 @@ const SallaVerify = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
130
132
|
this.otpInputs[0].focus();
|
|
131
133
|
}
|
|
132
134
|
resendTimer() {
|
|
133
|
-
this.resendMessage.
|
|
134
|
-
this.resend.style.display = 'none';
|
|
135
|
+
Helper.showElement(this.resendMessage).hideElement(this.resend);
|
|
135
136
|
this.resendAfter = 30;
|
|
136
137
|
let timerId = setInterval(() => {
|
|
137
138
|
if (this.resendAfter <= 0) {
|
|
138
139
|
clearInterval(timerId);
|
|
139
|
-
this.
|
|
140
|
-
this.resendMessage.style.display = 'none';
|
|
140
|
+
Helper.hideElement(this.resendMessage).showElement(this.resend);
|
|
141
141
|
}
|
|
142
142
|
else {
|
|
143
143
|
this.timer.innerHTML = `${this.resendAfter >= 10 ? this.resendAfter : '0' + this.resendAfter} : 00`;
|
|
@@ -156,12 +156,6 @@ const SallaVerify = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
156
156
|
.finally(() => this.resendTimer());
|
|
157
157
|
}
|
|
158
158
|
submit() {
|
|
159
|
-
//if code not 4 digits, focus on the after filled input,
|
|
160
|
-
if (this.code.value.length < 4) {
|
|
161
|
-
this.otpInputs[this.code.value.length].focus();
|
|
162
|
-
salla.log('Trying to submit without 4 digits!');
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
159
|
let data = Object.assign({ code: this.code.value }, this.data);
|
|
166
160
|
return this.btn.load()
|
|
167
161
|
.then(() => this.btn.disable())
|
|
@@ -177,10 +171,10 @@ const SallaVerify = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
177
171
|
}
|
|
178
172
|
render() {
|
|
179
173
|
return this.display == 'inline' ? h(Host, null, this.myBody()) :
|
|
180
|
-
h("salla-modal", { width: "xs", class: "s-verify", ref: modal => this.modal = modal, "modal-title": this.title }, h("span", { slot: 'icon', innerHTML:
|
|
174
|
+
h("salla-modal", { width: "xs", class: "s-verify", ref: modal => this.modal = modal, "modal-title": this.title }, h("span", { slot: 'icon', innerHTML: AndroidPhoneIcon }), this.myBody());
|
|
181
175
|
}
|
|
182
176
|
myBody() {
|
|
183
|
-
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",
|
|
177
|
+
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", 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" })));
|
|
184
178
|
}
|
|
185
179
|
get host() { return this; }
|
|
186
180
|
static get style() { return sallaVerifyCss; }
|