@salla.sa/twilight-components 1.0.94 → 1.0.96
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-add-product-button_6.cjs.entry.js +11 -9
- package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-login-modal.cjs.entry.js +3 -18
- package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-verify-modal.cjs.entry.js +11 -7
- package/dist/cjs/twilight-components.cjs.js +1 -1
- package/dist/collection/components/salla-localization-modal/salla-localization-modal.js +1 -1
- package/dist/collection/components/salla-login-modal/salla-login-modal.js +5 -21
- package/dist/collection/components/salla-modal/salla-modal.js +5 -34
- package/dist/collection/components/salla-offer-modal/salla-offer-modal.js +1 -1
- package/dist/collection/components/salla-search/salla-search.js +6 -17
- package/dist/collection/components/salla-tel-input/salla-tel-input.js +2 -2
- package/dist/collection/components/salla-verify-modal/salla-verify-modal.js +12 -7
- package/dist/components/salla-localization-modal.js +1 -1
- package/dist/components/salla-login-modal.js +3 -19
- package/dist/components/salla-modal2.js +5 -5
- package/dist/components/salla-offer-modal.js +1 -1
- package/dist/components/salla-search.js +6 -4
- package/dist/components/salla-tel-input2.js +2 -2
- package/dist/components/salla-verify-modal2.js +12 -7
- package/dist/esm/loader.js +1 -1
- package/dist/esm/salla-add-product-button_6.entry.js +11 -9
- package/dist/esm/salla-localization-modal.entry.js +1 -1
- package/dist/esm/salla-login-modal.entry.js +3 -18
- package/dist/esm/salla-offer-modal.entry.js +1 -1
- package/dist/esm/salla-verify-modal.entry.js +11 -7
- package/dist/esm/twilight-components.js +1 -1
- package/dist/twilight-components/p-2b1c3490.entry.js +4 -0
- package/dist/twilight-components/p-6a736d5c.entry.js +4 -0
- package/dist/twilight-components/p-7fae6b84.entry.js +4 -0
- package/dist/twilight-components/p-9e05640e.entry.js +4 -0
- package/dist/twilight-components/p-c0709d5f.entry.js +4 -0
- package/dist/twilight-components/twilight-components.esm.js +1 -1
- package/dist/types/components/salla-login-modal/salla-login-modal.d.ts +0 -1
- package/dist/types/components/salla-modal/salla-modal.d.ts +0 -3
- package/dist/types/components/salla-search/salla-search.d.ts +1 -0
- package/dist/types/components/salla-verify-modal/salla-verify-modal.d.ts +1 -0
- package/dist/types/components.d.ts +0 -2
- package/package.json +1 -1
- package/dist/twilight-components/p-37e0a91d.entry.js +0 -4
- package/dist/twilight-components/p-74df54ad.entry.js +0 -4
- package/dist/twilight-components/p-8264d586.entry.js +0 -4
- package/dist/twilight-components/p-cf78ba07.entry.js +0 -4
- package/dist/twilight-components/p-f0a1d8d8.entry.js +0 -4
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -17,7 +17,7 @@ const patchEsm = () => {
|
|
|
17
17
|
const defineCustomElements = (win, options) => {
|
|
18
18
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
19
19
|
return patchEsm().then(() => {
|
|
20
|
-
return index.bootstrapLazy([["salla-add-product-button_6.cjs",[[4,"salla-add-product-button",{"channels":[513],"quantity":[514],"donatingAmount":[514,"donating-amount"],"productId":[520,"product-id"],"productStatus":[513,"product-status"],"productType":[513,"product-type"],"disabled":[516]}],[0,"salla-search",{"inline":[4],"oval":[4],"height":[2],"results":[32],"placeholder":[32],"noResultsText":[32]}
|
|
20
|
+
return index.bootstrapLazy([["salla-add-product-button_6.cjs",[[4,"salla-add-product-button",{"channels":[513],"quantity":[514],"donatingAmount":[514,"donating-amount"],"productId":[520,"product-id"],"productStatus":[513,"product-status"],"productType":[513,"product-type"],"disabled":[516]}],[0,"salla-search",{"inline":[4],"oval":[4],"height":[2],"results":[32],"placeholder":[32],"noResultsText":[32]}],[0,"salla-product-availability",{"channels":[1],"productId":[2,"product-id"],"isSubscribed":[1028,"is-subscribed"],"subTitle":[32],"mobileLabel":[32],"emailLabel":[32],"emailPlaceholder":[32],"subscribedMessage":[32],"title_":[32],"emailErrorMsg":[32],"isVisitorSubscribed":[32]}],[0,"salla-tel-input",{"phone":[1025],"name":[1],"countryCode":[1025,"country-code"],"mobileRequired":[32],"countryCodeLabel":[32],"mobileLabel":[32],"tooShort":[32],"tooLong":[32],"invalidCountryCode":[32],"invalidNumber":[32],"errorMap":[32],"getValues":[64],"isValid":[64]}],[4,"salla-button",{"shape":[513],"color":[513],"fill":[513],"size":[513],"width":[513],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"wide":[4],"href":[1],"load":[64],"stop":[64],"setText":[64],"disable":[64],"enable":[64]}],[4,"salla-modal",{"isClosable":[1028,"is-closable"],"width":[513],"position":[513],"visible":[516],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"noPadding":[4,"no-padding"],"subTitle":[1,"sub-title"],"icon":[1],"iconStyle":[1,"icon-style"],"imageIcon":[1,"image-icon"],"modalTitle":[32],"open":[64],"close":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]}]]],["salla-login-modal.cjs",[[4,"salla-login-modal",{"isEmailAllowed":[1028,"is-email-allowed"],"isMobileAllowed":[1028,"is-mobile-allowed"],"isEmailRequired":[1028,"is-email-required"],"title":[32],"loginTypeTitle":[32],"loginText":[32],"smsLabel":[32],"mobileLabel":[32],"emailLabel":[32],"enterText":[32],"bySMSText":[32],"byEmailText":[32],"emailErrorMsg":[32],"firstNameLabel":[32],"lastNameLabel":[32],"firstNameErrorMsg":[32],"lastNameErrorMsg":[32],"open":[64]},[[8,"verified","onVerified"]]]]],["salla-rating-modal.cjs",[[0,"salla-rating-modal",{"orderId":[2,"order-id"],"order":[32],"open":[64],"close":[64]}]]],["salla-branches.cjs",[[4,"salla-branches",{"position":[1],"displayAs":[1,"display-as"],"browseProductsFrom":[1,"browse-products-from"],"branches":[16],"current":[1026],"open":[32],"selected":[32],"isOpenedBefore":[32],"show":[64],"hide":[64]}]]],["salla-localization-modal.cjs",[[0,"salla-localization-modal",{"language":[1537],"currency":[1537],"languages":[32],"currencies":[32],"languagesTitle":[32],"currenciesTitle":[32],"isLoading":[32],"open":[64],"close":[64],"submit":[64]}]]],["salla-offer-modal.cjs",[[0,"salla-offer-modal",{"offer":[32],"offer_name":[32],"offer_message":[32],"offer_expires_in":[32],"remember_my_choice":[32],"add_to_cart":[32],"out_of_stock":[32],"open":[64],"showOffer":[64]}]]],["salla-conditional-fields.cjs",[[4,"salla-conditional-fields",null,[[0,"change","changeHandler"]]]]],["salla-infinite-scroll.cjs",[[4,"salla-infinite-scroll",{"nextPage":[1,"next-page"],"autoload":[1028],"container":[1],"item":[1],"loadMore":[32],"noMore":[32],"failedToLoad":[32]}]]],["salla-installment.cjs",[[0,"salla-installment",{"price":[1],"language":[1],"currency":[1],"tamaraIsActive":[32],"tabbyIsActive":[32],"spotiiIsActive":[32]}]]],["salla-quantity-input.cjs",[[4,"salla-quantity-input",{"quantity":[32],"decrease":[64],"increase":[64],"setValue":[64]}]]],["salla-sizes-table.cjs",[[1,"salla-sizes-table"]]],["salla-verify-modal.cjs",[[4,"salla-verify-modal",{"withoutModal":[4,"without-modal"],"type":[1025],"autoReload":[4,"auto-reload"],"title":[32],"resendAfter":[32],"isProfileVerify":[32],"getCode":[64],"open":[64]}]]],["salla-rating-stars.cjs",[[0,"salla-rating-stars",{"name":[1],"size":[1],"value":[2]}]]]], options);
|
|
21
21
|
});
|
|
22
22
|
};
|
|
23
23
|
|
|
@@ -200,8 +200,6 @@ const sallaModalCss = "";
|
|
|
200
200
|
const SallaModal = class {
|
|
201
201
|
constructor(hostRef) {
|
|
202
202
|
index.registerInstance(this, hostRef);
|
|
203
|
-
this.modalOpened = index.createEvent(this, "modalOpened", 7);
|
|
204
|
-
this.modalClosed = index.createEvent(this, "modalClosed", 7);
|
|
205
203
|
this.isClosable = true; //todo::rename unclude
|
|
206
204
|
/**
|
|
207
205
|
* The size of the modal
|
|
@@ -235,16 +233,18 @@ const SallaModal = class {
|
|
|
235
233
|
salla.event.on('modal::open', btn => btn.dataset.target == this.host.id && this.open());
|
|
236
234
|
salla.event.on('modal::close', btn => btn.dataset.target == this.host.id && this.close());
|
|
237
235
|
this.modalTitle = this.host.getAttribute('modal-title');
|
|
236
|
+
// close modal on Escape button clicked
|
|
237
|
+
Helper.Helper.onKeyUp(document.body, e => e.keyCode === 27 && this.closeModal());
|
|
238
238
|
}
|
|
239
239
|
handleVisible(newValue) {
|
|
240
240
|
if (!newValue) {
|
|
241
|
+
salla.event.dispatch('modalClosed');
|
|
241
242
|
this.toggleModal(false);
|
|
242
|
-
this.modalClosed.emit();
|
|
243
243
|
return;
|
|
244
244
|
}
|
|
245
|
+
salla.event.dispatch('modalOpened');
|
|
245
246
|
this.host.classList.remove('s-hidden');
|
|
246
247
|
setTimeout(() => this.toggleModal(true)); //small amont of time to running toggle After adding hidden
|
|
247
|
-
this.modalOpened.emit();
|
|
248
248
|
}
|
|
249
249
|
/**
|
|
250
250
|
* Open the modal
|
|
@@ -474,12 +474,14 @@ const SallaSearch = class {
|
|
|
474
474
|
this.placeholder = salla.lang.get('blocks.header.search_placeholder');
|
|
475
475
|
this.noResultsText = salla.lang.get('common.elements.no_options');
|
|
476
476
|
});
|
|
477
|
+
salla.event.on('modalOpened', () => this.onModalOpen());
|
|
478
|
+
salla.event.on('modalClosed', () => this.onModalClose());
|
|
477
479
|
}
|
|
478
480
|
onModalOpen() {
|
|
479
|
-
this.
|
|
481
|
+
setTimeout(() => this.searchInput.focus(), 300);
|
|
480
482
|
}
|
|
481
483
|
onModalClose() {
|
|
482
|
-
this.
|
|
484
|
+
this.searchInput.value = '';
|
|
483
485
|
this.results = undefined;
|
|
484
486
|
this.afterSearching();
|
|
485
487
|
this.container.classList.remove('s-search-no-results');
|
|
@@ -520,7 +522,7 @@ const SallaSearch = class {
|
|
|
520
522
|
}
|
|
521
523
|
render() {
|
|
522
524
|
var _a;
|
|
523
|
-
const searchContent = index.h("div", { class: { 's-search-container': true, 's-search-inline': this.inline }, ref: container => this.container = container, style: this.oval ? { borderRadius: this.height / 2 + 'px' } : {} }, index.h("input", { class: "s-search-input", type: "text", placeholder: this.placeholder, onInput: e => this.search(e), style: { height: this.height + 'px' } }), index.h("span", { class: "s-search-icon-wrap" }, index.h("i", { class: "s-search-icon sicon-search", ref: el => this.searchIcon = el })), index.h("div", { class: "s-search-results" }, (_a = this.results) === null || _a === void 0 ? void 0 :
|
|
525
|
+
const searchContent = index.h("div", { class: { 's-search-container': true, 's-search-inline': this.inline }, ref: container => this.container = container, style: this.oval ? { borderRadius: this.height / 2 + 'px' } : {} }, index.h("input", { class: "s-search-input", type: "text", placeholder: this.placeholder, onInput: e => this.search(e), style: { height: this.height + 'px' }, ref: input => this.searchInput = input }), index.h("span", { class: "s-search-icon-wrap" }, index.h("i", { class: "s-search-icon sicon-search", ref: el => this.searchIcon = el })), index.h("div", { class: "s-search-results" }, (_a = this.results) === null || _a === void 0 ? void 0 :
|
|
524
526
|
_a.data.map(item => index.h("a", { href: item.url, class: { "s-search-product": true, 's-search-product-not-available': !item.is_available }, innerHTML: this.productSlot
|
|
525
527
|
.replace(/\{name\}/g, item.name)
|
|
526
528
|
.replace(/\{price\}/g, salla.money(item.price))
|
|
@@ -1938,7 +1940,7 @@ const SallaTelInput = class {
|
|
|
1938
1940
|
Helper.Helper.setHost(this.host);
|
|
1939
1941
|
salla.lang.onLoaded(() => {
|
|
1940
1942
|
this.mobileLabel = salla.lang.get('common.elements.mobile');
|
|
1941
|
-
this.countryCodeLabel = salla.lang.get('common.country_code');
|
|
1943
|
+
this.countryCodeLabel = salla.lang.get('common.elements.country_code');
|
|
1942
1944
|
this.invalidNumber = salla.lang.get('common.errors.invalid_value', { attribute: this.mobileLabel });
|
|
1943
1945
|
this.invalidCountryCode = salla.lang.get('common.errors.invalid_value', { attribute: this.countryCodeLabel });
|
|
1944
1946
|
this.tooShort = salla.lang.get('common.errors.too_short', { attribute: this.mobileLabel });
|
|
@@ -1990,7 +1992,7 @@ const SallaTelInput = class {
|
|
|
1990
1992
|
this.countryCodeInput.value = data.iso2.toUpperCase();
|
|
1991
1993
|
});
|
|
1992
1994
|
// on blur: validate
|
|
1993
|
-
this.phoneInput.addEventListener('blur', () => this.isValid());
|
|
1995
|
+
// this.phoneInput.addEventListener('blur', () => this.isValid());
|
|
1994
1996
|
// on keyup / change flag: reset
|
|
1995
1997
|
this.phoneInput.addEventListener('input', e => {
|
|
1996
1998
|
salla.helpers.inputDigitsOnly(e.target);
|
|
@@ -60,7 +60,7 @@ const SallaLocalizationModal = class {
|
|
|
60
60
|
}
|
|
61
61
|
async getCurrencies() {
|
|
62
62
|
this.currency = this.currency || salla.config.get('user.currency_code');
|
|
63
|
-
return this.currencies.length > 1 ? null : await salla.config.currencies().then(data => this.currencies = data);
|
|
63
|
+
return this.currencies.length > 1 ? null : await salla.config.currencies().then(data => this.currencies = Object.values(data || {}));
|
|
64
64
|
}
|
|
65
65
|
onChangeCurrency(event) {
|
|
66
66
|
this.currency = event.target.value;
|
|
@@ -26,21 +26,6 @@ const SallaLoginModal = class {
|
|
|
26
26
|
*/
|
|
27
27
|
this.isEmailRequired = salla.config.get('store.settings.auth.is_email_required', false);
|
|
28
28
|
this.regType = 'phone';
|
|
29
|
-
this.title = salla.lang.get('blocks.header.login');
|
|
30
|
-
this.loginTypeTitle = salla.lang.get('blocks.header.select_login_way');
|
|
31
|
-
this.loginText = salla.lang.get('blocks.header.login');
|
|
32
|
-
this.smsLabel = salla.lang.get('blocks.header.sms');
|
|
33
|
-
this.mobileLabel = salla.lang.get('common.elements.mobile');
|
|
34
|
-
this.emailLabel = salla.lang.get('common.elements.email');
|
|
35
|
-
this.enterText = salla.lang.get('blocks.header.enter');
|
|
36
|
-
this.bySMSText = salla.lang.get('blocks.header.login_by_sms');
|
|
37
|
-
this.byEmailText = salla.lang.get('blocks.header.login_by_email');
|
|
38
|
-
this.emailErrorMsg = salla.lang.get('common.elements.email_is_valid');
|
|
39
|
-
this.firstNameLabel = salla.lang.get('blocks.header.your_name');
|
|
40
|
-
this.lastNameLabel = salla.lang.get('pages.profile.last_name');
|
|
41
|
-
this.firstNameErrorMsg = salla.lang.get('common.errors.field_required', { attribute: this.firstNameLabel });
|
|
42
|
-
this.lastNameErrorMsg = salla.lang.get('common.errors.field_required', { attribute: this.lastNameLabel });
|
|
43
|
-
this.translationsLoaded = false;
|
|
44
29
|
this.typing = (e, submitMethod) => {
|
|
45
30
|
const error = e.target.nextElementSibling;
|
|
46
31
|
e.target.classList.remove('s-has-error');
|
|
@@ -101,7 +86,6 @@ const SallaLoginModal = class {
|
|
|
101
86
|
(_b = this.smsBtn) === null || _b === void 0 ? void 0 : _b.setText(salla.lang.get('blocks.header.enter'));
|
|
102
87
|
(_c = this.emailBtn) === null || _c === void 0 ? void 0 : _c.setText(salla.lang.get('blocks.header.enter'));
|
|
103
88
|
(_d = this.regBtn) === null || _d === void 0 ? void 0 : _d.setText(salla.lang.get('blocks.header.register'));
|
|
104
|
-
this.translationsLoaded = true;
|
|
105
89
|
});
|
|
106
90
|
salla.auth.event.onVerificationFailed(() => {
|
|
107
91
|
//
|
|
@@ -196,13 +180,14 @@ const SallaLoginModal = class {
|
|
|
196
180
|
field.nextElementSibling['innerText'] = '* ' + errorMsg;
|
|
197
181
|
}
|
|
198
182
|
render() {
|
|
199
|
-
return
|
|
183
|
+
return (index.h("salla-modal", { id: "salla-login", icon: "sicon-user", "modal-title": this.title, ref: modal => this.modal = modal, width: "xs" }, index.h("div", { class: "s-login-modal-wrapper" }, this.isEmailAllowed && this.isMobileAllowed ?
|
|
200
184
|
index.h("div", { class: "s-login-modal-tab", ref: tab => this.homeTab = tab }, index.h("p", { class: "s-login-modal-sub-title" }, this.loginTypeTitle), index.h("slot", { name: "before-login-type" }), index.h("a", { href: "#", class: "s-login-modal-main-btn", onClick: (evt) => this.showTab(this.mobileTab, evt) }, index.h("i", { class: "s-login-modal-main-btn-icon sicon-phone" }), index.h("span", { class: "s-login-modal-main-btn-text" }, this.smsLabel), index.h("i", { class: "sicon-keyboard_arrow_left arrow" })), index.h("a", { href: "#", class: "s-login-modal-main-btn", onClick: (evt) => this.showTab(this.emailTab, evt) }, index.h("i", { class: "s-login-modal-main-btn-icon sicon-mail" }), index.h("span", { class: "s-login-modal-main-btn-text" }, this.emailLabel), index.h("i", { class: "sicon-keyboard_arrow_left arrow" })), index.h("slot", { name: "after-login-type" }))
|
|
201
185
|
: '', this.isMobileAllowed ?
|
|
202
186
|
index.h("div", { class: "s-login-modal-tab", ref: tab => this.mobileTab = tab }, index.h("slot", { name: "before-login-mobile" }), index.h("label", { class: "s-login-modal-label" }, this.mobileLabel), index.h("salla-tel-input", { ref: el => this.loginTelInput = el, onKeyDown: e => this.typing(e, this.loginBySMS) }), index.h("salla-button", { "loader-position": 'center', width: "wide", onClick: () => this.loginBySMS(), ref: b => this.smsBtn = b }, salla.lang.get('blocks.header.enter')), this.isEmailAllowed ?
|
|
203
187
|
index.h("a", { href: "#", onClick: () => this.showTab(this.emailTab), class: "s-login-modal-link" }, this.byEmailText) : '', index.h("slot", { name: "after-login-mobile" })) : '', this.isEmailAllowed ?
|
|
204
188
|
index.h("div", { class: "s-login-modal-tab", ref: tab => this.emailTab = tab }, index.h("slot", { name: "before-login-email" }), index.h("label", { class: "s-login-modal-label" }, this.emailLabel), index.h("input", { type: "email", ref: el => this.loginEmail = el, onKeyDown: e => this.typing(e, this.loginByEmail), placeholder: "your@email.com", class: "s-login-modal-input s-ltr" }), index.h("span", { class: "s-login-modal-error-message" }), index.h("salla-button", { "loader-position": 'center', width: "wide", onClick: () => this.loginByEmail(), ref: b => this.emailBtn = b }, salla.lang.get('blocks.header.enter')), this.isMobileAllowed ?
|
|
205
|
-
index.h("a", { href: "#", onClick: () => this.showTab(this.mobileTab), class: "s-login-modal-link" }, this.bySMSText)
|
|
189
|
+
index.h("a", { href: "#", onClick: () => this.showTab(this.mobileTab), class: "s-login-modal-link" }, this.bySMSText)
|
|
190
|
+
: '', index.h("slot", { name: "after-login-email" })) : '', index.h("salla-verify-modal", { withoutModal: true, ref: tab => this.verifyTab = tab, autoReload: false }, index.h("a", { onClick: () => this.showTab(this.regType == 'phone' ? this.mobileTab : this.emailTab), class: "s-verify-modal-back sicon-arrow-right", slot: "after-footer", href: "#" })), index.h("div", { ref: tab => this.registrationTab = tab }, index.h("slot", { name: "before-registration" }), index.h("div", null, index.h("label", { class: "s-login-modal-label" }, this.firstNameLabel), index.h("input", { type: "text", class: "s-login-modal-input", ref: el => this.firstName = el, onKeyDown: e => this.typing(e, this.newUser), placeholder: salla.lang.get('pages.profile.first_name') }), index.h("span", { class: "s-login-modal-error-message" })), index.h("div", null, index.h("label", { class: "s-login-modal-label" }, this.lastNameLabel), index.h("input", { type: "text", class: "s-login-modal-input", ref: el => this.lastName = el, onKeyDown: e => this.typing(e, this.newUser), placeholder: salla.lang.get('pages.profile.last_name') }), index.h("span", { class: "s-login-modal-error-message" })), index.h("div", { ref: el => this.regMobileBlock = el, class: "mb-1.5" }, index.h("label", { class: "s-login-modal-label" }, this.mobileLabel), index.h("salla-tel-input", { ref: el => this.regTelInput = el, onKeyDown: e => this.typing(e, this.newUser) })), index.h("div", { ref: el => this.regEmailBlock = el, class: "mb-1.5" }, index.h("label", { class: "s-login-modal-label" }, this.emailLabel), index.h("input", { type: "email", ref: el => this.regEmail = el, onKeyDown: e => this.typing(e, this.newUser), placeholder: "your@email.com", class: "s-login-modal-input s-ltr" }), index.h("span", { class: "s-login-modal-error-message" })), index.h("salla-button", { "loader-position": 'center', width: "wide", onClick: () => this.newUser(), ref: b => this.regBtn = b }, salla.lang.get('blocks.header.register')), index.h("slot", { name: "after-registration" })))));
|
|
206
191
|
}
|
|
207
192
|
get host() { return index.getElement(this); }
|
|
208
193
|
};
|
|
@@ -22,7 +22,7 @@ const SallaOfferModal = class {
|
|
|
22
22
|
Helper.Helper.setHost(this.host);
|
|
23
23
|
salla.lang.onLoaded(() => {
|
|
24
24
|
this.offer_expires_in = salla.lang.get('pages.products.offer_expires_in');
|
|
25
|
-
this.remember_my_choice = salla.lang.get('common.remember_my_choice');
|
|
25
|
+
this.remember_my_choice = salla.lang.get('common.elements.remember_my_choice');
|
|
26
26
|
this.add_to_cart = salla.lang.get('pages.cart.add_to_cart');
|
|
27
27
|
this.out_of_stock = salla.lang.get('pages.products.out_of_stock');
|
|
28
28
|
});
|
|
@@ -23,6 +23,7 @@ const SallaVerifyModal = class {
|
|
|
23
23
|
* should auto reloading the page after success verification
|
|
24
24
|
*/
|
|
25
25
|
this.autoReload = true;
|
|
26
|
+
this.resendAfter = 30;
|
|
26
27
|
/**
|
|
27
28
|
* to use: `salla.api.auth.verify` or `salla.profile.verify`
|
|
28
29
|
*/
|
|
@@ -45,6 +46,10 @@ const SallaVerifyModal = class {
|
|
|
45
46
|
this.title = salla.lang.get('pages.profile.verify_title') + salla.lang.get('common.elements.' + data.type);
|
|
46
47
|
(_a = this.modal) === null || _a === void 0 ? void 0 : _a.setTitle(this.title);
|
|
47
48
|
});
|
|
49
|
+
salla.event.on('modalClosed', () => {
|
|
50
|
+
this.resendAfter = 0;
|
|
51
|
+
this.timer.innerHTML = '30 : 00';
|
|
52
|
+
});
|
|
48
53
|
}
|
|
49
54
|
/**
|
|
50
55
|
* Get current code
|
|
@@ -110,15 +115,15 @@ const SallaVerifyModal = class {
|
|
|
110
115
|
}
|
|
111
116
|
resendTimer() {
|
|
112
117
|
Helper.Helper.showElement(this.resendMessage).hideElement(this.resend);
|
|
113
|
-
|
|
118
|
+
this.resendAfter = 30;
|
|
114
119
|
let timerId = setInterval(() => {
|
|
115
|
-
if (resendAfter
|
|
116
|
-
|
|
120
|
+
if (this.resendAfter <= 0) {
|
|
121
|
+
clearInterval(timerId);
|
|
117
122
|
Helper.Helper.hideElement(this.resendMessage).showElement(this.resend);
|
|
118
123
|
}
|
|
119
124
|
else {
|
|
120
|
-
this.timer.innerHTML = `${resendAfter >= 10 ? resendAfter : '0' + resendAfter} : 00`;
|
|
121
|
-
resendAfter--;
|
|
125
|
+
this.timer.innerHTML = `${this.resendAfter >= 10 ? this.resendAfter : '0' + this.resendAfter} : 00`;
|
|
126
|
+
this.resendAfter--;
|
|
122
127
|
}
|
|
123
128
|
}, 1000);
|
|
124
129
|
}
|
|
@@ -130,8 +135,7 @@ const SallaVerifyModal = class {
|
|
|
130
135
|
this.otpInputs[0].focus();
|
|
131
136
|
})
|
|
132
137
|
.then(() => salla.api.auth.resend(this.data))
|
|
133
|
-
.
|
|
134
|
-
.catch(() => this.resendTimer());
|
|
138
|
+
.finally(() => this.resendTimer());
|
|
135
139
|
}
|
|
136
140
|
submit() {
|
|
137
141
|
let data = Object.assign({ code: this.code.value }, this.data);
|
|
@@ -18,5 +18,5 @@ const patchBrowser = () => {
|
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
patchBrowser().then(options => {
|
|
21
|
-
return index.bootstrapLazy([["salla-add-product-button_6.cjs",[[4,"salla-add-product-button",{"channels":[513],"quantity":[514],"donatingAmount":[514,"donating-amount"],"productId":[520,"product-id"],"productStatus":[513,"product-status"],"productType":[513,"product-type"],"disabled":[516]}],[0,"salla-search",{"inline":[4],"oval":[4],"height":[2],"results":[32],"placeholder":[32],"noResultsText":[32]}
|
|
21
|
+
return index.bootstrapLazy([["salla-add-product-button_6.cjs",[[4,"salla-add-product-button",{"channels":[513],"quantity":[514],"donatingAmount":[514,"donating-amount"],"productId":[520,"product-id"],"productStatus":[513,"product-status"],"productType":[513,"product-type"],"disabled":[516]}],[0,"salla-search",{"inline":[4],"oval":[4],"height":[2],"results":[32],"placeholder":[32],"noResultsText":[32]}],[0,"salla-product-availability",{"channels":[1],"productId":[2,"product-id"],"isSubscribed":[1028,"is-subscribed"],"subTitle":[32],"mobileLabel":[32],"emailLabel":[32],"emailPlaceholder":[32],"subscribedMessage":[32],"title_":[32],"emailErrorMsg":[32],"isVisitorSubscribed":[32]}],[0,"salla-tel-input",{"phone":[1025],"name":[1],"countryCode":[1025,"country-code"],"mobileRequired":[32],"countryCodeLabel":[32],"mobileLabel":[32],"tooShort":[32],"tooLong":[32],"invalidCountryCode":[32],"invalidNumber":[32],"errorMap":[32],"getValues":[64],"isValid":[64]}],[4,"salla-button",{"shape":[513],"color":[513],"fill":[513],"size":[513],"width":[513],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"wide":[4],"href":[1],"load":[64],"stop":[64],"setText":[64],"disable":[64],"enable":[64]}],[4,"salla-modal",{"isClosable":[1028,"is-closable"],"width":[513],"position":[513],"visible":[516],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"noPadding":[4,"no-padding"],"subTitle":[1,"sub-title"],"icon":[1],"iconStyle":[1,"icon-style"],"imageIcon":[1,"image-icon"],"modalTitle":[32],"open":[64],"close":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]}]]],["salla-login-modal.cjs",[[4,"salla-login-modal",{"isEmailAllowed":[1028,"is-email-allowed"],"isMobileAllowed":[1028,"is-mobile-allowed"],"isEmailRequired":[1028,"is-email-required"],"title":[32],"loginTypeTitle":[32],"loginText":[32],"smsLabel":[32],"mobileLabel":[32],"emailLabel":[32],"enterText":[32],"bySMSText":[32],"byEmailText":[32],"emailErrorMsg":[32],"firstNameLabel":[32],"lastNameLabel":[32],"firstNameErrorMsg":[32],"lastNameErrorMsg":[32],"open":[64]},[[8,"verified","onVerified"]]]]],["salla-rating-modal.cjs",[[0,"salla-rating-modal",{"orderId":[2,"order-id"],"order":[32],"open":[64],"close":[64]}]]],["salla-branches.cjs",[[4,"salla-branches",{"position":[1],"displayAs":[1,"display-as"],"browseProductsFrom":[1,"browse-products-from"],"branches":[16],"current":[1026],"open":[32],"selected":[32],"isOpenedBefore":[32],"show":[64],"hide":[64]}]]],["salla-localization-modal.cjs",[[0,"salla-localization-modal",{"language":[1537],"currency":[1537],"languages":[32],"currencies":[32],"languagesTitle":[32],"currenciesTitle":[32],"isLoading":[32],"open":[64],"close":[64],"submit":[64]}]]],["salla-offer-modal.cjs",[[0,"salla-offer-modal",{"offer":[32],"offer_name":[32],"offer_message":[32],"offer_expires_in":[32],"remember_my_choice":[32],"add_to_cart":[32],"out_of_stock":[32],"open":[64],"showOffer":[64]}]]],["salla-conditional-fields.cjs",[[4,"salla-conditional-fields",null,[[0,"change","changeHandler"]]]]],["salla-infinite-scroll.cjs",[[4,"salla-infinite-scroll",{"nextPage":[1,"next-page"],"autoload":[1028],"container":[1],"item":[1],"loadMore":[32],"noMore":[32],"failedToLoad":[32]}]]],["salla-installment.cjs",[[0,"salla-installment",{"price":[1],"language":[1],"currency":[1],"tamaraIsActive":[32],"tabbyIsActive":[32],"spotiiIsActive":[32]}]]],["salla-quantity-input.cjs",[[4,"salla-quantity-input",{"quantity":[32],"decrease":[64],"increase":[64],"setValue":[64]}]]],["salla-sizes-table.cjs",[[1,"salla-sizes-table"]]],["salla-verify-modal.cjs",[[4,"salla-verify-modal",{"withoutModal":[4,"without-modal"],"type":[1025],"autoReload":[4,"auto-reload"],"title":[32],"resendAfter":[32],"isProfileVerify":[32],"getCode":[64],"open":[64]}]]],["salla-rating-stars.cjs",[[0,"salla-rating-stars",{"name":[1],"size":[1],"value":[2]}]]]], options);
|
|
22
22
|
});
|
|
@@ -58,7 +58,7 @@ export class SallaLocalizationModal {
|
|
|
58
58
|
}
|
|
59
59
|
async getCurrencies() {
|
|
60
60
|
this.currency = this.currency || salla.config.get('user.currency_code');
|
|
61
|
-
return this.currencies.length > 1 ? null : await salla.config.currencies().then(data => this.currencies = data);
|
|
61
|
+
return this.currencies.length > 1 ? null : await salla.config.currencies().then(data => this.currencies = Object.values(data || {}));
|
|
62
62
|
}
|
|
63
63
|
onChangeCurrency(event) {
|
|
64
64
|
this.currency = event.target.value;
|
|
@@ -29,21 +29,6 @@ export class SallaLoginModal {
|
|
|
29
29
|
*/
|
|
30
30
|
this.isEmailRequired = salla.config.get('store.settings.auth.is_email_required', false);
|
|
31
31
|
this.regType = 'phone';
|
|
32
|
-
this.title = salla.lang.get('blocks.header.login');
|
|
33
|
-
this.loginTypeTitle = salla.lang.get('blocks.header.select_login_way');
|
|
34
|
-
this.loginText = salla.lang.get('blocks.header.login');
|
|
35
|
-
this.smsLabel = salla.lang.get('blocks.header.sms');
|
|
36
|
-
this.mobileLabel = salla.lang.get('common.elements.mobile');
|
|
37
|
-
this.emailLabel = salla.lang.get('common.elements.email');
|
|
38
|
-
this.enterText = salla.lang.get('blocks.header.enter');
|
|
39
|
-
this.bySMSText = salla.lang.get('blocks.header.login_by_sms');
|
|
40
|
-
this.byEmailText = salla.lang.get('blocks.header.login_by_email');
|
|
41
|
-
this.emailErrorMsg = salla.lang.get('common.elements.email_is_valid');
|
|
42
|
-
this.firstNameLabel = salla.lang.get('blocks.header.your_name');
|
|
43
|
-
this.lastNameLabel = salla.lang.get('pages.profile.last_name');
|
|
44
|
-
this.firstNameErrorMsg = salla.lang.get('common.errors.field_required', { attribute: this.firstNameLabel });
|
|
45
|
-
this.lastNameErrorMsg = salla.lang.get('common.errors.field_required', { attribute: this.lastNameLabel });
|
|
46
|
-
this.translationsLoaded = false;
|
|
47
32
|
this.typing = (e, submitMethod) => {
|
|
48
33
|
const error = e.target.nextElementSibling;
|
|
49
34
|
e.target.classList.remove('s-has-error');
|
|
@@ -104,7 +89,6 @@ export class SallaLoginModal {
|
|
|
104
89
|
(_b = this.smsBtn) === null || _b === void 0 ? void 0 : _b.setText(salla.lang.get('blocks.header.enter'));
|
|
105
90
|
(_c = this.emailBtn) === null || _c === void 0 ? void 0 : _c.setText(salla.lang.get('blocks.header.enter'));
|
|
106
91
|
(_d = this.regBtn) === null || _d === void 0 ? void 0 : _d.setText(salla.lang.get('blocks.header.register'));
|
|
107
|
-
this.translationsLoaded = true;
|
|
108
92
|
});
|
|
109
93
|
salla.auth.event.onVerificationFailed(() => {
|
|
110
94
|
//
|
|
@@ -199,7 +183,7 @@ export class SallaLoginModal {
|
|
|
199
183
|
field.nextElementSibling['innerText'] = '* ' + errorMsg;
|
|
200
184
|
}
|
|
201
185
|
render() {
|
|
202
|
-
return
|
|
186
|
+
return (h("salla-modal", { id: "salla-login", icon: "sicon-user", "modal-title": this.title, ref: modal => this.modal = modal, width: "xs" },
|
|
203
187
|
h("div", { class: "s-login-modal-wrapper" },
|
|
204
188
|
this.isEmailAllowed && this.isMobileAllowed ?
|
|
205
189
|
h("div", { class: "s-login-modal-tab", ref: tab => this.homeTab = tab },
|
|
@@ -232,7 +216,8 @@ export class SallaLoginModal {
|
|
|
232
216
|
h("span", { class: "s-login-modal-error-message" }),
|
|
233
217
|
h("salla-button", { "loader-position": 'center', width: "wide", onClick: () => this.loginByEmail(), ref: b => this.emailBtn = b }, salla.lang.get('blocks.header.enter')),
|
|
234
218
|
this.isMobileAllowed ?
|
|
235
|
-
h("a", { href: "#", onClick: () => this.showTab(this.mobileTab), class: "s-login-modal-link" }, this.bySMSText)
|
|
219
|
+
h("a", { href: "#", onClick: () => this.showTab(this.mobileTab), class: "s-login-modal-link" }, this.bySMSText)
|
|
220
|
+
: '',
|
|
236
221
|
h("slot", { name: "after-login-email" })) : '',
|
|
237
222
|
h("salla-verify-modal", { withoutModal: true, ref: tab => this.verifyTab = tab, autoReload: false },
|
|
238
223
|
h("a", { onClick: () => this.showTab(this.regType == 'phone' ? this.mobileTab : this.emailTab), class: "s-verify-modal-back sicon-arrow-right", slot: "after-footer", href: "#" })),
|
|
@@ -254,7 +239,7 @@ export class SallaLoginModal {
|
|
|
254
239
|
h("input", { type: "email", ref: el => this.regEmail = el, onKeyDown: e => this.typing(e, this.newUser), placeholder: "your@email.com", class: "s-login-modal-input s-ltr" }),
|
|
255
240
|
h("span", { class: "s-login-modal-error-message" })),
|
|
256
241
|
h("salla-button", { "loader-position": 'center', width: "wide", onClick: () => this.newUser(), ref: b => this.regBtn = b }, salla.lang.get('blocks.header.register')),
|
|
257
|
-
h("slot", { name: "after-registration" })))))
|
|
242
|
+
h("slot", { name: "after-registration" })))));
|
|
258
243
|
}
|
|
259
244
|
static get is() { return "salla-login-modal"; }
|
|
260
245
|
static get originalStyleUrls() { return {
|
|
@@ -333,8 +318,7 @@ export class SallaLoginModal {
|
|
|
333
318
|
"firstNameLabel": {},
|
|
334
319
|
"lastNameLabel": {},
|
|
335
320
|
"firstNameErrorMsg": {},
|
|
336
|
-
"lastNameErrorMsg": {}
|
|
337
|
-
"translationsLoaded": {}
|
|
321
|
+
"lastNameErrorMsg": {}
|
|
338
322
|
}; }
|
|
339
323
|
static get methods() { return {
|
|
340
324
|
"open": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import { Component, h, Prop, Host, Element,
|
|
4
|
+
import { Component, h, Prop, Host, Element, Watch, Method, State } from '@stencil/core';
|
|
5
5
|
import Helper from "../../Helpers/Helper";
|
|
6
6
|
/**
|
|
7
7
|
* @slot footer - The footer of modal
|
|
@@ -41,16 +41,18 @@ export class SallaModal {
|
|
|
41
41
|
salla.event.on('modal::open', btn => btn.dataset.target == this.host.id && this.open());
|
|
42
42
|
salla.event.on('modal::close', btn => btn.dataset.target == this.host.id && this.close());
|
|
43
43
|
this.modalTitle = this.host.getAttribute('modal-title');
|
|
44
|
+
// close modal on Escape button clicked
|
|
45
|
+
Helper.onKeyUp(document.body, e => e.keyCode === 27 && this.closeModal());
|
|
44
46
|
}
|
|
45
47
|
handleVisible(newValue) {
|
|
46
48
|
if (!newValue) {
|
|
49
|
+
salla.event.dispatch('modalClosed');
|
|
47
50
|
this.toggleModal(false);
|
|
48
|
-
this.modalClosed.emit();
|
|
49
51
|
return;
|
|
50
52
|
}
|
|
53
|
+
salla.event.dispatch('modalOpened');
|
|
51
54
|
this.host.classList.remove('s-hidden');
|
|
52
55
|
setTimeout(() => this.toggleModal(true)); //small amont of time to running toggle After adding hidden
|
|
53
|
-
this.modalOpened.emit();
|
|
54
56
|
}
|
|
55
57
|
/**
|
|
56
58
|
* Open the modal
|
|
@@ -364,37 +366,6 @@ export class SallaModal {
|
|
|
364
366
|
static get states() { return {
|
|
365
367
|
"modalTitle": {}
|
|
366
368
|
}; }
|
|
367
|
-
static get events() { return [{
|
|
368
|
-
"method": "modalOpened",
|
|
369
|
-
"name": "modalOpened",
|
|
370
|
-
"bubbles": true,
|
|
371
|
-
"cancelable": true,
|
|
372
|
-
"composed": true,
|
|
373
|
-
"docs": {
|
|
374
|
-
"tags": [],
|
|
375
|
-
"text": ""
|
|
376
|
-
},
|
|
377
|
-
"complexType": {
|
|
378
|
-
"original": "any",
|
|
379
|
-
"resolved": "any",
|
|
380
|
-
"references": {}
|
|
381
|
-
}
|
|
382
|
-
}, {
|
|
383
|
-
"method": "modalClosed",
|
|
384
|
-
"name": "modalClosed",
|
|
385
|
-
"bubbles": true,
|
|
386
|
-
"cancelable": true,
|
|
387
|
-
"composed": true,
|
|
388
|
-
"docs": {
|
|
389
|
-
"tags": [],
|
|
390
|
-
"text": ""
|
|
391
|
-
},
|
|
392
|
-
"complexType": {
|
|
393
|
-
"original": "any",
|
|
394
|
-
"resolved": "any",
|
|
395
|
-
"references": {}
|
|
396
|
-
}
|
|
397
|
-
}]; }
|
|
398
369
|
static get methods() { return {
|
|
399
370
|
"open": {
|
|
400
371
|
"complexType": {
|
|
@@ -19,7 +19,7 @@ export class SallaOfferModal {
|
|
|
19
19
|
Helper.setHost(this.host);
|
|
20
20
|
salla.lang.onLoaded(() => {
|
|
21
21
|
this.offer_expires_in = salla.lang.get('pages.products.offer_expires_in');
|
|
22
|
-
this.remember_my_choice = salla.lang.get('common.remember_my_choice');
|
|
22
|
+
this.remember_my_choice = salla.lang.get('common.elements.remember_my_choice');
|
|
23
23
|
this.add_to_cart = salla.lang.get('pages.cart.add_to_cart');
|
|
24
24
|
this.out_of_stock = salla.lang.get('pages.products.out_of_stock');
|
|
25
25
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import { Component, Prop, h, State, Element
|
|
4
|
+
import { Component, Prop, h, State, Element } from '@stencil/core';
|
|
5
5
|
import Helper from "../../Helpers/Helper";
|
|
6
6
|
/**
|
|
7
7
|
* @slot product - Replaces products card in the results, has replaceable props `{name}`, `{price}`, `{regular_price}`, `{image}`.
|
|
@@ -20,12 +20,14 @@ export class SallaSearch {
|
|
|
20
20
|
this.placeholder = salla.lang.get('blocks.header.search_placeholder');
|
|
21
21
|
this.noResultsText = salla.lang.get('common.elements.no_options');
|
|
22
22
|
});
|
|
23
|
+
salla.event.on('modalOpened', () => this.onModalOpen());
|
|
24
|
+
salla.event.on('modalClosed', () => this.onModalClose());
|
|
23
25
|
}
|
|
24
26
|
onModalOpen() {
|
|
25
|
-
this.
|
|
27
|
+
setTimeout(() => this.searchInput.focus(), 300);
|
|
26
28
|
}
|
|
27
29
|
onModalClose() {
|
|
28
|
-
this.
|
|
30
|
+
this.searchInput.value = '';
|
|
29
31
|
this.results = undefined;
|
|
30
32
|
this.afterSearching();
|
|
31
33
|
this.container.classList.remove('s-search-no-results');
|
|
@@ -67,7 +69,7 @@ export class SallaSearch {
|
|
|
67
69
|
render() {
|
|
68
70
|
var _a;
|
|
69
71
|
const searchContent = h("div", { class: { 's-search-container': true, 's-search-inline': this.inline }, ref: container => this.container = container, style: this.oval ? { borderRadius: this.height / 2 + 'px' } : {} },
|
|
70
|
-
h("input", { class: "s-search-input", type: "text", placeholder: this.placeholder, onInput: e => this.search(e), style: { height: this.height + 'px' } }),
|
|
72
|
+
h("input", { class: "s-search-input", type: "text", placeholder: this.placeholder, onInput: e => this.search(e), style: { height: this.height + 'px' }, ref: input => this.searchInput = input }),
|
|
71
73
|
h("span", { class: "s-search-icon-wrap" },
|
|
72
74
|
h("i", { class: "s-search-icon sicon-search", ref: el => this.searchIcon = el })),
|
|
73
75
|
h("div", { class: "s-search-results" }, (_a = this.results) === null || _a === void 0 ? void 0 :
|
|
@@ -157,17 +159,4 @@ export class SallaSearch {
|
|
|
157
159
|
"noResultsText": {}
|
|
158
160
|
}; }
|
|
159
161
|
static get elementRef() { return "host"; }
|
|
160
|
-
static get listeners() { return [{
|
|
161
|
-
"name": "modalOpened",
|
|
162
|
-
"method": "onModalOpen",
|
|
163
|
-
"target": undefined,
|
|
164
|
-
"capture": false,
|
|
165
|
-
"passive": false
|
|
166
|
-
}, {
|
|
167
|
-
"name": "modalClosed",
|
|
168
|
-
"method": "onModalClose",
|
|
169
|
-
"target": undefined,
|
|
170
|
-
"capture": false,
|
|
171
|
-
"passive": false
|
|
172
|
-
}]; }
|
|
173
162
|
}
|
|
@@ -24,7 +24,7 @@ export class SallaTelInput {
|
|
|
24
24
|
Helper.setHost(this.host);
|
|
25
25
|
salla.lang.onLoaded(() => {
|
|
26
26
|
this.mobileLabel = salla.lang.get('common.elements.mobile');
|
|
27
|
-
this.countryCodeLabel = salla.lang.get('common.country_code');
|
|
27
|
+
this.countryCodeLabel = salla.lang.get('common.elements.country_code');
|
|
28
28
|
this.invalidNumber = salla.lang.get('common.errors.invalid_value', { attribute: this.mobileLabel });
|
|
29
29
|
this.invalidCountryCode = salla.lang.get('common.errors.invalid_value', { attribute: this.countryCodeLabel });
|
|
30
30
|
this.tooShort = salla.lang.get('common.errors.too_short', { attribute: this.mobileLabel });
|
|
@@ -76,7 +76,7 @@ export class SallaTelInput {
|
|
|
76
76
|
this.countryCodeInput.value = data.iso2.toUpperCase();
|
|
77
77
|
});
|
|
78
78
|
// on blur: validate
|
|
79
|
-
this.phoneInput.addEventListener('blur', () => this.isValid());
|
|
79
|
+
// this.phoneInput.addEventListener('blur', () => this.isValid());
|
|
80
80
|
// on keyup / change flag: reset
|
|
81
81
|
this.phoneInput.addEventListener('input', e => {
|
|
82
82
|
salla.helpers.inputDigitsOnly(e.target);
|
|
@@ -18,6 +18,7 @@ export class SallaVerifyModal {
|
|
|
18
18
|
* should auto reloading the page after success verification
|
|
19
19
|
*/
|
|
20
20
|
this.autoReload = true;
|
|
21
|
+
this.resendAfter = 30;
|
|
21
22
|
/**
|
|
22
23
|
* to use: `salla.api.auth.verify` or `salla.profile.verify`
|
|
23
24
|
*/
|
|
@@ -40,6 +41,10 @@ export class SallaVerifyModal {
|
|
|
40
41
|
this.title = salla.lang.get('pages.profile.verify_title') + salla.lang.get('common.elements.' + data.type);
|
|
41
42
|
(_a = this.modal) === null || _a === void 0 ? void 0 : _a.setTitle(this.title);
|
|
42
43
|
});
|
|
44
|
+
salla.event.on('modalClosed', () => {
|
|
45
|
+
this.resendAfter = 0;
|
|
46
|
+
this.timer.innerHTML = '30 : 00';
|
|
47
|
+
});
|
|
43
48
|
}
|
|
44
49
|
/**
|
|
45
50
|
* Get current code
|
|
@@ -105,15 +110,15 @@ export class SallaVerifyModal {
|
|
|
105
110
|
}
|
|
106
111
|
resendTimer() {
|
|
107
112
|
Helper.showElement(this.resendMessage).hideElement(this.resend);
|
|
108
|
-
|
|
113
|
+
this.resendAfter = 30;
|
|
109
114
|
let timerId = setInterval(() => {
|
|
110
|
-
if (resendAfter
|
|
111
|
-
|
|
115
|
+
if (this.resendAfter <= 0) {
|
|
116
|
+
clearInterval(timerId);
|
|
112
117
|
Helper.hideElement(this.resendMessage).showElement(this.resend);
|
|
113
118
|
}
|
|
114
119
|
else {
|
|
115
|
-
this.timer.innerHTML = `${resendAfter >= 10 ? resendAfter : '0' + resendAfter} : 00`;
|
|
116
|
-
resendAfter--;
|
|
120
|
+
this.timer.innerHTML = `${this.resendAfter >= 10 ? this.resendAfter : '0' + this.resendAfter} : 00`;
|
|
121
|
+
this.resendAfter--;
|
|
117
122
|
}
|
|
118
123
|
}, 1000);
|
|
119
124
|
}
|
|
@@ -125,8 +130,7 @@ export class SallaVerifyModal {
|
|
|
125
130
|
this.otpInputs[0].focus();
|
|
126
131
|
})
|
|
127
132
|
.then(() => salla.api.auth.resend(this.data))
|
|
128
|
-
.
|
|
129
|
-
.catch(() => this.resendTimer());
|
|
133
|
+
.finally(() => this.resendTimer());
|
|
130
134
|
}
|
|
131
135
|
submit() {
|
|
132
136
|
let data = Object.assign({ code: this.code.value }, this.data);
|
|
@@ -220,6 +224,7 @@ export class SallaVerifyModal {
|
|
|
220
224
|
}; }
|
|
221
225
|
static get states() { return {
|
|
222
226
|
"title": {},
|
|
227
|
+
"resendAfter": {},
|
|
223
228
|
"isProfileVerify": {}
|
|
224
229
|
}; }
|
|
225
230
|
static get events() { return [{
|
|
@@ -59,7 +59,7 @@ const SallaLocalizationModal$1 = /*@__PURE__*/ proxyCustomElement(class extends
|
|
|
59
59
|
}
|
|
60
60
|
async getCurrencies() {
|
|
61
61
|
this.currency = this.currency || salla.config.get('user.currency_code');
|
|
62
|
-
return this.currencies.length > 1 ? null : await salla.config.currencies().then(data => this.currencies = data);
|
|
62
|
+
return this.currencies.length > 1 ? null : await salla.config.currencies().then(data => this.currencies = Object.values(data || {}));
|
|
63
63
|
}
|
|
64
64
|
onChangeCurrency(event) {
|
|
65
65
|
this.currency = event.target.value;
|