@salla.sa/twilight-components 1.0.22 → 1.0.24
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.cjs.js +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/salla-branches.cjs.entry.js +5 -2
- package/dist/cjs/salla-button_5.cjs.entry.js +79 -29
- package/dist/cjs/salla-localization.cjs.entry.js +6 -4
- package/dist/cjs/salla-login-c74587ef.js +154 -0
- package/dist/cjs/salla-offer.cjs.entry.js +2 -2
- package/dist/cjs/salla-rating.cjs.entry.js +12 -9
- package/dist/cjs/{salla-search-45173394.js → salla-search-eb0112c0.js} +16 -23
- package/dist/cjs/salla-search.cjs.entry.js +1 -1
- package/dist/cjs/twilight-components.cjs.js +1 -1
- package/dist/collection/components/salla-branches/salla-branches.js +7 -3
- package/dist/collection/components/salla-button/salla-button.js +2 -0
- package/dist/collection/components/salla-localization/salla-localization.js +11 -60
- package/dist/collection/components/salla-login/salla-login.css +15 -2
- package/dist/collection/components/salla-login/salla-login.js +132 -252
- package/dist/collection/components/salla-modal/salla-modal.css +0 -0
- package/dist/collection/components/salla-modal/salla-modal.js +28 -20
- package/dist/collection/components/salla-offer/salla-offer.js +2 -2
- package/dist/collection/components/salla-rating/salla-rating.js +12 -9
- package/dist/collection/components/salla-search/salla-search.css +1 -0
- package/dist/collection/components/salla-search/salla-search.js +19 -62
- package/dist/collection/components/salla-search/search-response.js +1 -0
- package/dist/collection/components/salla-tel-input/salla-tel-input.js +86 -6
- package/dist/collection/components/salla-verify/salla-verify.js +18 -13
- package/dist/esm/index.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/salla-branches.entry.js +5 -2
- package/dist/esm/salla-button_5.entry.js +79 -29
- package/dist/esm/salla-localization.entry.js +6 -4
- package/dist/esm/salla-login-d08f0d7e.js +152 -0
- package/dist/esm/salla-offer.entry.js +2 -2
- package/dist/esm/salla-rating.entry.js +12 -9
- package/dist/esm/{salla-search-5e691ebb.js → salla-search-57bd45eb.js} +16 -23
- package/dist/esm/salla-search.entry.js +1 -1
- package/dist/esm/twilight-components.js +1 -1
- package/dist/twilight-components/index.esm.js +1 -1
- package/dist/twilight-components/p-1918a33c.js +1 -0
- package/dist/twilight-components/p-22f06d26.entry.js +1 -0
- package/dist/twilight-components/p-47f3d098.entry.js +1 -0
- package/dist/twilight-components/p-5bf5ce53.entry.js +1 -0
- package/dist/twilight-components/p-aa9880cb.entry.js +1 -0
- package/dist/twilight-components/p-b195e28c.entry.js +1 -0
- package/dist/twilight-components/p-e6a3a0dc.entry.js +1 -0
- package/dist/twilight-components/p-e7edc889.js +1 -0
- package/dist/twilight-components/twilight-components.esm.js +1 -1
- package/dist/types/components/salla-branches/salla-branches.d.ts +1 -0
- package/dist/types/components/salla-login/salla-login.d.ts +21 -12
- package/dist/types/components/salla-search/salla-search.d.ts +2 -7
- package/dist/types/components/salla-search/search-response.d.ts +18 -0
- package/dist/types/components/salla-tel-input/salla-tel-input.d.ts +18 -6
- package/dist/types/components/salla-verify/salla-verify.d.ts +2 -2
- package/dist/types/components.d.ts +5 -43
- package/package.json +1 -1
- package/dist/cjs/salla-login-c438bb35.js +0 -128
- package/dist/esm/salla-login-dd957742.js +0 -126
- package/dist/twilight-components/p-1a6d8171.entry.js +0 -1
- package/dist/twilight-components/p-1deb8111.entry.js +0 -1
- package/dist/twilight-components/p-3a4d963e.js +0 -1
- package/dist/twilight-components/p-5b2eb87d.entry.js +0 -1
- package/dist/twilight-components/p-7fbdf746.entry.js +0 -1
- package/dist/twilight-components/p-81a61f4e.js +0 -1
- package/dist/twilight-components/p-ce991664.entry.js +0 -1
- package/dist/twilight-components/p-da73fc9b.entry.js +0 -1
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const sallaLogin = require('./salla-login-
|
|
6
|
-
const sallaSearch = require('./salla-search-
|
|
5
|
+
const sallaLogin = require('./salla-login-c74587ef.js');
|
|
6
|
+
const sallaSearch = require('./salla-search-eb0112c0.js');
|
|
7
7
|
require('./index-714023c8.js');
|
|
8
8
|
require('./Helper-fcea994c.js');
|
|
9
9
|
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -14,7 +14,7 @@ const patchEsm = () => {
|
|
|
14
14
|
const defineCustomElements = (win, options) => {
|
|
15
15
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
16
|
return patchEsm().then(() => {
|
|
17
|
-
return index.bootstrapLazy([["salla-button_5.cjs",[[0,"salla-login",{"isEmailAllowed":[4,"is-email-allowed"],"
|
|
17
|
+
return index.bootstrapLazy([["salla-button_5.cjs",[[0,"salla-login",{"isEmailAllowed":[4,"is-email-allowed"],"title":[32],"loginTypeTitle":[32],"loginText":[32],"smsLabel":[32],"mobileLabel":[32],"emailLabel":[32],"enterText":[32],"bySMSText":[32],"byEmailText":[32],"isEmailValid":[32],"firstNameLabel":[32],"lastNameLabel":[32],"firstNameRequired":[32],"lastNameRequired":[32],"show":[64]},[[0,"verified","onVerified"],[0,"backClicked","onbackClicked"]]],[0,"salla-verify",{"withoutModal":[4,"without-modal"],"url":[513],"by":[1],"isShowBack":[4,"is-show-back"],"autoReload":[4,"auto-reload"],"getCode":[64],"show":[64]}],[0,"salla-tel-input",{"phone":[1025],"countryCode":[1025,"country-code"],"countryKey":[1025,"country-key"],"invalidNumber":[32],"invalidCountryCode":[32],"tooShort":[32],"tooLong":[32],"mobileLabel":[32],"mobileRequired":[32],"getValues":[64],"isValid":[64]}],[4,"salla-button",{"btnStyle":[513,"btn-style"],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"wide":[4],"load":[64],"stop":[64],"disable":[64],"enable":[64]}],[4,"salla-modal",{"error":[4],"success":[4],"primary":[4],"isClosable":[1028,"is-closable"],"width":[513],"position":[513],"visible":[516],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"subTitle":[1,"sub-title"],"icon":[1],"imageIcon":[1,"image-icon"],"title":[32],"show":[64],"hide":[64],"setTitle":[64],"loading":[64],"stopLoading":[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],"ok":[32],"show":[64],"hide":[64]}]]],["salla-localization.cjs",[[4,"salla-localization",{"languagesTitle":[32],"currenciesTitle":[32],"ok":[32],"show":[64],"hide":[64],"submit":[64]}]]],["salla-offer.cjs",[[0,"salla-offer",{"offer":[32],"show":[64]}]]],["salla-product-availability.cjs",[[4,"salla-product-availability",{"channels":[1],"buttonText":[1,"button-text"],"countryCode":[1,"country-code"],"subscribeText":[1,"subscribe-text"],"cancelText":[1,"cancel-text"],"subTitle":[1,"sub-title"],"mobileLabel":[1,"mobile-label"],"emailLabel":[1,"email-label"],"mobilePlaceholder":[1,"mobile-placeholder"],"emailPlaceholder":[1,"email-placeholder"],"productId":[2,"product-id"],"subscribedMessage":[1,"subscribed-message"],"isSubscribed":[1028,"is-subscribed"],"submit":[64]}]]],["salla-rating.cjs",[[0,"salla-rating",{"order":[32],"show":[64],"hide":[64]}]]],["salla-search.cjs",[[0,"salla-search",{"results":[32],"placeholder":[32],"noResultsText":[32]},[[0,"modalOpened","onModalOpen"],[0,"modalClosed","onModalClose"]]]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -42,6 +42,9 @@ const SallaBranches = class {
|
|
|
42
42
|
: 'التسوق من فرع آخر';
|
|
43
43
|
};
|
|
44
44
|
salla.event.on('branches::show', () => this.show());
|
|
45
|
+
salla.event.on('languages::translations.loaded', () => {
|
|
46
|
+
this.ok = salla.lang.get('common.elements.ok');
|
|
47
|
+
});
|
|
45
48
|
}
|
|
46
49
|
async show() {
|
|
47
50
|
return this.modal.show();
|
|
@@ -63,7 +66,7 @@ const SallaBranches = class {
|
|
|
63
66
|
}, 300);
|
|
64
67
|
}
|
|
65
68
|
render() {
|
|
66
|
-
return (index.h("salla-modal", { icon: "sicon-store-alt", title: "\u0641\u0631\u0639 \u0627\u0644\u0631\u064A\u0627\u0636", "sub-title": "\u0623\u0646\u062A \u0627\u0644\u0622\u0646 \u062A\u062A\u0635\u0641\u062D \u0627\u0644\u0645\u062A\u062C\u0631 \u0645\u0646", "sub-title-first": true, "is-closable": !this.isOpenedBefore && this.displayAs == 'popup' ? 'false' : 'true', ref: modal => this.modal = modal,
|
|
69
|
+
return (index.h("salla-modal", { icon: "sicon-store-alt", title: "\u0641\u0631\u0639 \u0627\u0644\u0631\u064A\u0627\u0636", "sub-title": "\u0623\u0646\u062A \u0627\u0644\u0622\u0646 \u062A\u062A\u0635\u0641\u062D \u0627\u0644\u0645\u062A\u062C\u0631 \u0645\u0646", "sub-title-first": true, "is-closable": !this.isOpenedBefore && this.displayAs == 'popup' ? 'false' : 'true', ref: modal => this.modal = modal, width: "sm", id: "s-branches-modal", class: "hidden" }, index.h("h4", { class: "s-branches-title" }, this.formTitle()), this.branches.length <= 5 ?
|
|
67
70
|
index.h("div", { class: "s-branches-space-v" }, this.branches.map((branch) => index.h("div", { class: "s-branches-input-wrap" }, index.h("input", { id: this.position + '_branch_' + branch.id, disabled: !branch.open && this.isChoiceable(), name: "lang", type: "radio", value: branch.id, onChange: (event) => this.handelChange(event), class: {
|
|
68
71
|
's-branches-input': true,
|
|
69
72
|
'opacity-50': !branch.open,
|
|
@@ -77,7 +80,7 @@ const SallaBranches = class {
|
|
|
77
80
|
index.h("span", { class: this.statusColor(branch) }, branch.tag)))))
|
|
78
81
|
:
|
|
79
82
|
index.h("select", { class: "s-branches-select", onInput: (event) => this.handelChange(event) }, this.branches.map(branch => (index.h("option", { value: branch.id, disabled: !branch.open, selected: this.selected == branch.id }, branch.name, " ", branch.open ? '' : '- مُغلق')))), this.isChoiceable() ?
|
|
80
|
-
index.h("slot", { name: "footer" }, index.h("salla-button", { ref: btn => this.btn = btn, onClick: () => this.handleSubmit(), class: "s-branches-submit", wide: true },
|
|
83
|
+
index.h("slot", { name: "footer" }, index.h("salla-button", { ref: btn => this.btn = btn, onClick: () => this.handleSubmit(), class: "s-branches-submit", wide: true }, this.ok))
|
|
81
84
|
: ''));
|
|
82
85
|
}
|
|
83
86
|
componentDidRender() {
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-714023c8.js');
|
|
6
6
|
const Helper = require('./Helper-fcea994c.js');
|
|
7
|
-
const sallaLogin = require('./salla-login-
|
|
7
|
+
const sallaLogin = require('./salla-login-c74587ef.js');
|
|
8
8
|
|
|
9
9
|
const sallaButtonCss = ":host{display:block}";
|
|
10
10
|
|
|
@@ -41,6 +41,8 @@ const SallaButton = class {
|
|
|
41
41
|
}
|
|
42
42
|
async stop() {
|
|
43
43
|
this.host.removeAttribute('loading');
|
|
44
|
+
if (this.loaderPosition == 'center')
|
|
45
|
+
this.text.classList.remove('s-button-hide');
|
|
44
46
|
return this.host;
|
|
45
47
|
}
|
|
46
48
|
async disable() {
|
|
@@ -77,6 +79,8 @@ const SallaButton = class {
|
|
|
77
79
|
};
|
|
78
80
|
SallaButton.style = sallaButtonCss;
|
|
79
81
|
|
|
82
|
+
const sallaModalCss = "";
|
|
83
|
+
|
|
80
84
|
const SallaModal = class {
|
|
81
85
|
constructor(hostRef) {
|
|
82
86
|
index.registerInstance(this, hostRef);
|
|
@@ -156,26 +160,26 @@ const SallaModal = class {
|
|
|
156
160
|
return (
|
|
157
161
|
//todo:: use suitable class name instead of hidden
|
|
158
162
|
index.h(index.Host, { class: 's-modal-container hidden', "aria-modal": "true", role: "dialog" }, index.h("div", { class: "s-modal-wrapper" }, index.h("div", { class: "s-modal-overlay", ref: el => this.overlay = el, onClick: () => this.closeModal() }), index.h("span", { class: 's-modal-spacer s-modal-align-' + this.position }, "\u200B"), index.h("div", { class: 's-modal-body ' + 's-modal-align-' + this.position + ' s-modal-' + this.width, slot: "body" }, this.isLoading
|
|
159
|
-
? index.h("
|
|
163
|
+
? index.h("div", { class: "s-modal-loader-wrap" }, index.h("span", { class: "s-modal-loader" }))
|
|
160
164
|
:
|
|
161
165
|
[index.h("div", { class: { 's-modal-header': true, 's-modal-is-center': this.icon != '' || this.imageIcon != '' } }, this.isClosable ?
|
|
162
166
|
index.h("button", { class: "s-modal-close", onClick: () => this.closeModal(), type: "button" }, index.h("span", { class: "sicon-cancel" }))
|
|
163
|
-
: '', this.
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
167
|
+
: '', this.title || this.subTitle ?
|
|
168
|
+
index.h("div", { class: "s-modal-header-inner" }, this.error || this.success || this.icon
|
|
169
|
+
? index.h("div", { class: {
|
|
170
|
+
's-modal-icon': true,
|
|
171
|
+
's-modal-bg-error': this.error,
|
|
172
|
+
's-modal-bg-success': this.success,
|
|
173
|
+
's-modal-bg-normal': !this.error && !this.success,
|
|
174
|
+
's-modal-bg-primary': this.primary
|
|
175
|
+
} }, index.h("i", { class: {
|
|
176
|
+
[this.icon]: true,
|
|
177
|
+
's-modal-text-error': this.error,
|
|
178
|
+
's-modal-text-success': this.success,
|
|
179
|
+
} }))
|
|
180
|
+
: this.imageIcon ?
|
|
181
|
+
index.h("img", { class: "s-modal-header-img", src: this.imageIcon })
|
|
182
|
+
: '', index.h("div", { class: "s-modal-header-content" }, index.h("div", { class: { 's-modal-title': true, 's-modal-title-below': this.subTitleFirst }, innerHTML: this.title }), index.h("p", { class: { 's-modal-sub-title': true }, innerHTML: this.subTitle })))
|
|
179
183
|
: ''),
|
|
180
184
|
index.h("slot", null),
|
|
181
185
|
index.h("slot", { name: "footer" })
|
|
@@ -186,6 +190,7 @@ const SallaModal = class {
|
|
|
186
190
|
"visible": ["handleVisible"]
|
|
187
191
|
}; }
|
|
188
192
|
};
|
|
193
|
+
SallaModal.style = sallaModalCss;
|
|
189
194
|
|
|
190
195
|
function createCommonjsModule(fn, basedir, module) {
|
|
191
196
|
return module = {
|
|
@@ -1563,9 +1568,18 @@ var intlTelInput = intlTelInput$1;
|
|
|
1563
1568
|
const SallaTelInput = class {
|
|
1564
1569
|
constructor(hostRef) {
|
|
1565
1570
|
index.registerInstance(this, hostRef);
|
|
1571
|
+
this.enterClicked = index.createEvent(this, "enterClicked", 7);
|
|
1566
1572
|
this.countryCode = "SA";
|
|
1567
1573
|
this.countryKey = "+966";
|
|
1568
1574
|
Helper.Helper.setHost(this.host);
|
|
1575
|
+
salla.event.on('languages::translations.loaded', () => {
|
|
1576
|
+
this.mobileLabel = salla.lang.get('common.elements.mobile');
|
|
1577
|
+
this.invalidNumber = salla.lang.get('common.errors.invalid_value', { attribute: this.mobileLabel });
|
|
1578
|
+
this.invalidCountryCode = salla.lang.get('common.errors.invalid_value', { attribute: this.mobileLabel });
|
|
1579
|
+
this.tooShort = salla.lang.get('common.errors.too_short', { attribute: this.mobileLabel });
|
|
1580
|
+
this.tooLong = salla.lang.get('common.errors.too_long', { attribute: this.mobileLabel });
|
|
1581
|
+
this.mobileRequired = salla.lang.get('common.errors.field_required', { attribute: this.mobileLabel });
|
|
1582
|
+
});
|
|
1569
1583
|
}
|
|
1570
1584
|
async getValues() {
|
|
1571
1585
|
this.phone = this.phoneInput.value;
|
|
@@ -1573,11 +1587,25 @@ const SallaTelInput = class {
|
|
|
1573
1587
|
this.countryKey = this.countryKeyInput.value;
|
|
1574
1588
|
return { phone: this.phoneInput.value, countryCode: this.countryCodeInput.value, countryKey: this.countryKeyInput.value };
|
|
1575
1589
|
}
|
|
1590
|
+
async isValid() {
|
|
1591
|
+
const errorMap = [this.invalidNumber, this.invalidCountryCode, this.tooShort, this.tooLong, this.invalidNumber];
|
|
1592
|
+
this.reset();
|
|
1593
|
+
if (this.iti.isValidNumber())
|
|
1594
|
+
return true;
|
|
1595
|
+
if (!this.phoneInput.value.trim()) {
|
|
1596
|
+
this.phoneInput.classList.add("s-has-error");
|
|
1597
|
+
this.errorMsg.innerText = this.mobileRequired || '';
|
|
1598
|
+
return;
|
|
1599
|
+
}
|
|
1600
|
+
this.phoneInput.classList.add("s-has-error");
|
|
1601
|
+
let errorCode = this.iti.getValidationError();
|
|
1602
|
+
this.errorMsg.innerText = errorMap[errorCode] || '';
|
|
1603
|
+
return false;
|
|
1604
|
+
}
|
|
1576
1605
|
initTelInput() {
|
|
1577
|
-
|
|
1578
|
-
document.querySelectorAll('.tel-input').forEach((intlInput) => {
|
|
1606
|
+
this.host.querySelectorAll('.tel-input').forEach((intlInput) => {
|
|
1579
1607
|
salla.helpers.digitsOnly(intlInput);
|
|
1580
|
-
|
|
1608
|
+
this.iti = intlTelInput(intlInput, {
|
|
1581
1609
|
initialCountry: intlInput.dataset.code || 'sa',
|
|
1582
1610
|
preferredCountries: ['sa', 'ae', 'kw', 'bh', 'qa', 'iq', 'om', 'ye', 'eg', 'jo', 'sy', 'ps', 'sd', 'lb', 'dz', 'tn', 'ma', 'ly'],
|
|
1583
1611
|
formatOnDisplay: false,
|
|
@@ -1586,18 +1614,35 @@ const SallaTelInput = class {
|
|
|
1586
1614
|
utilsScript: 'https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.12/js/utils.min.js',
|
|
1587
1615
|
});
|
|
1588
1616
|
intlInput.addEventListener("countrychange", () => {
|
|
1589
|
-
let data = iti.getSelectedCountryData();
|
|
1617
|
+
let data = this.iti.getSelectedCountryData();
|
|
1590
1618
|
this.host.querySelectorAll('.country_code').forEach((input) => input.value = data.iso2.toUpperCase());
|
|
1591
1619
|
this.host.querySelectorAll('.country_key').forEach((input) => {
|
|
1592
1620
|
input.value = ('+' + data.dialCode).replace('++', '+');
|
|
1593
1621
|
});
|
|
1594
1622
|
});
|
|
1623
|
+
// on blur: validate
|
|
1624
|
+
intlInput.addEventListener('blur', () => {
|
|
1625
|
+
this.isValid();
|
|
1626
|
+
});
|
|
1627
|
+
// on keyup / change flag: reset
|
|
1628
|
+
// this.phoneInput.addEventListener('change', () => this.reset());
|
|
1629
|
+
salla.document.event.onKeyup('.tel-input', e => {
|
|
1630
|
+
if (e.key == 'Enter')
|
|
1631
|
+
return;
|
|
1632
|
+
salla.helpers.digitsOnly(e.target);
|
|
1633
|
+
this.reset();
|
|
1634
|
+
});
|
|
1595
1635
|
});
|
|
1596
1636
|
}
|
|
1637
|
+
reset() {
|
|
1638
|
+
this.phoneInput.classList.remove("s-has-error");
|
|
1639
|
+
this.errorMsg.innerHTML = "";
|
|
1640
|
+
}
|
|
1641
|
+
;
|
|
1597
1642
|
render() {
|
|
1598
|
-
return (index.h(index.Host, null, index.h("input", { type: "tel", name: "mobile", "data-code": this.countryCode, value: this.phone, ref: el => this.phoneInput = el, class: "s-tel-input-control tel-input s-ltr" }), index.h("input", { type: "hidden", name: "country_code", value: this.countryCode, ref: el => this.countryCodeInput = el, class: "country_code" }), index.h("input", { type: "hidden", name: "country_key", value: this.countryKey, ref: el => this.countryKeyInput = el, class: "country_key" })));
|
|
1643
|
+
return (index.h(index.Host, null, index.h("input", { type: "tel", name: "mobile", "data-code": this.countryCode, value: this.phone, ref: el => this.phoneInput = el, class: "s-tel-input-control tel-input s-ltr" }), index.h("span", { class: "s-tel-input-error-msg", ref: el => this.errorMsg = el }), index.h("input", { type: "hidden", name: "country_code", value: this.countryCode, ref: el => this.countryCodeInput = el, class: "country_code" }), index.h("input", { type: "hidden", name: "country_key", value: this.countryKey, ref: el => this.countryKeyInput = el, class: "country_key" })));
|
|
1599
1644
|
}
|
|
1600
|
-
|
|
1645
|
+
componentDidLoad() {
|
|
1601
1646
|
this.initTelInput();
|
|
1602
1647
|
}
|
|
1603
1648
|
get host() { return index.getElement(this); }
|
|
@@ -1608,7 +1653,6 @@ const SallaVerify = class {
|
|
|
1608
1653
|
index.registerInstance(this, hostRef);
|
|
1609
1654
|
this.verified = index.createEvent(this, "verified", 7);
|
|
1610
1655
|
this.backClicked = index.createEvent(this, "backClicked", 7);
|
|
1611
|
-
this.url = 'profile/verify-mobile';
|
|
1612
1656
|
this.by = 'sms';
|
|
1613
1657
|
this.autoReload = true;
|
|
1614
1658
|
Helper.Helper.setHost(this.host);
|
|
@@ -1616,7 +1660,10 @@ const SallaVerify = class {
|
|
|
1616
1660
|
this.modal = { show: () => '', hide: () => '' };
|
|
1617
1661
|
}
|
|
1618
1662
|
else {
|
|
1619
|
-
salla.event.on('profile::verify.mobile', data =>
|
|
1663
|
+
salla.event.on('profile::verify.mobile', data => {
|
|
1664
|
+
this.url = 'profile/verify-mobile';
|
|
1665
|
+
this.show(data);
|
|
1666
|
+
});
|
|
1620
1667
|
}
|
|
1621
1668
|
}
|
|
1622
1669
|
async getCode() {
|
|
@@ -1693,9 +1740,12 @@ const SallaVerify = class {
|
|
|
1693
1740
|
.catch(() => this.resendTimer());
|
|
1694
1741
|
}
|
|
1695
1742
|
submit() {
|
|
1743
|
+
let data = Object.assign({ code: this.code.value }, this.data);
|
|
1696
1744
|
return this.btn.load()
|
|
1697
1745
|
.then(() => this.btn.disable())
|
|
1698
|
-
.then(() =>
|
|
1746
|
+
.then(() => this.url
|
|
1747
|
+
? salla.api.auth.request(this.url, data)
|
|
1748
|
+
: salla.api.auth.verify(this.by == 'sms' ? 'mobile' : this.by, data))
|
|
1699
1749
|
.then(response => this.verified.emit(response))
|
|
1700
1750
|
.then(() => this.btn.stop() && this.btn.disable())
|
|
1701
1751
|
.then(() => this.modal.hide())
|
|
@@ -1712,8 +1762,8 @@ const SallaVerify = class {
|
|
|
1712
1762
|
// <label class="s-verify-label">{salla.lang.get('pages.profile.verify_placeholder')}</label>,
|
|
1713
1763
|
index.h("input", { type: "hidden", name: "code", maxlength: "4", required: true, ref: code => this.code = code }),
|
|
1714
1764
|
index.h("div", { class: "s-verify-codes", dir: "ltr" }, [1, 2, 3, 4].map(() => index.h("input", { type: "text", maxlength: "1", class: "s-verify-input", required: true }))),
|
|
1715
|
-
index.h("div", { slot: "footer", class: "s-verify-footer" }, index.h("salla-button", { class: "s-verify-submit", disabled: true, onClick: () => this.submit(), ref: b => this.btn = b }, salla.lang.get('pages.profile.verify')), index.h("p", { class: "s-verify-resend-message", ref: el => this.resendMessage = el }, salla.lang.get('blocks.header.resend_after'), index.h("b", { class: "s-verify-timer", ref: el => this.timer = el })), index.h("a", { href: "#", class: "s-verify-resend", onClick: () => this.resendCode(), ref: el => this.resend = el }, salla.lang.get('blocks.comments.submit')), this.
|
|
1716
|
-
index.h("a", { href: "#", class: "s-verify-
|
|
1765
|
+
index.h("div", { slot: "footer", class: "s-verify-footer" }, index.h("salla-button", { class: "s-verify-submit", disabled: true, onClick: () => this.submit(), ref: b => this.btn = b }, salla.lang.get('pages.profile.verify')), index.h("p", { class: "s-verify-resend-message", ref: el => this.resendMessage = el }, salla.lang.get('blocks.header.resend_after'), index.h("b", { class: "s-verify-timer", ref: el => this.timer = el })), index.h("a", { href: "#", class: "s-verify-resend", onClick: () => this.resendCode(), ref: el => this.resend = el }, salla.lang.get('blocks.comments.submit')), this.isShowBack ?
|
|
1766
|
+
index.h("a", { href: "#", class: "s-verify-back", onClick: () => this.backClicked.emit() }, index.h("i", { class: "sicon-arrow-right" }))
|
|
1717
1767
|
: '')
|
|
1718
1768
|
];
|
|
1719
1769
|
}
|
|
@@ -11,11 +11,13 @@ const SallaLocalization = class {
|
|
|
11
11
|
var _a, _b;
|
|
12
12
|
this.language = salla.config.get('language', {});
|
|
13
13
|
this.currency = salla.config.get('currency', {});
|
|
14
|
-
this.languagesTitle = salla.lang.get('common.titles.language');
|
|
15
|
-
this.currenciesTitle = salla.lang.get('common.titles.currency');
|
|
16
|
-
this.ok = salla.lang.get('common.elements.ok');
|
|
17
14
|
Helper.Helper.setHost(this.host);
|
|
18
15
|
salla.event.on('localization::show', () => this.show());
|
|
16
|
+
salla.event.on('languages::translations.loaded', () => {
|
|
17
|
+
this.languagesTitle = salla.lang.get('common.titles.language');
|
|
18
|
+
this.currenciesTitle = salla.lang.get('common.titles.currency');
|
|
19
|
+
this.ok = salla.lang.get('common.elements.ok');
|
|
20
|
+
});
|
|
19
21
|
/**
|
|
20
22
|
* letting developer to insert his own slot like:
|
|
21
23
|
* <salla-localization>
|
|
@@ -53,7 +55,7 @@ const SallaLocalization = class {
|
|
|
53
55
|
.then(() => url && (window.location.href = url));
|
|
54
56
|
}
|
|
55
57
|
render() {
|
|
56
|
-
return (index.h("salla-modal", { id: "salla-localization", class: "hidden", ref: modal => this.modal = modal,
|
|
58
|
+
return (index.h("salla-modal", { id: "salla-localization", class: "hidden", ref: modal => this.modal = modal, width: "xs" }, index.h("div", { slot: "header" }, index.h("slot", { name: "header" })), index.h("div", { class: "s-localization-inner" }, this.languages.length > 1 ?
|
|
57
59
|
index.h("div", { class: "s-localization-section" }, index.h("label", { class: "s-localization-title" }, this.languagesTitle), index.h("div", { class: "s-localization-section-inner" }, this.languages.length < 6 ?
|
|
58
60
|
this.languages.map(lang => index.h("div", { class: "s-localization-item" }, index.h("input", { class: "s-localization-input", type: "radio", checked: this.language.code == lang.code, onChange: () => this.language = lang, name: "language", id: 'lang-' + lang.code.toLowerCase(), value: lang.code }), index.h("div", { id: "language-slot", innerHTML: this.languageSlot
|
|
59
61
|
.replace(/\{name\}/g, lang.name)
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index-714023c8.js');
|
|
4
|
+
const Helper = require('./Helper-fcea994c.js');
|
|
5
|
+
|
|
6
|
+
const sallaLoginCss = "salla-verify{display:block}#salla-login .s-modal-body{overflow:inherit}";
|
|
7
|
+
|
|
8
|
+
const SallaLogin = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
index.registerInstance(this, hostRef);
|
|
11
|
+
this.isEmailAllowed = true;
|
|
12
|
+
this.regType = 'phone';
|
|
13
|
+
this.typing = (e, submitMethod) => {
|
|
14
|
+
const error = e.target.nextElementSibling;
|
|
15
|
+
e.target.classList.remove('s-has-error');
|
|
16
|
+
(error === null || error === void 0 ? void 0 : error.classList.contains('s-login-error-message')) && (error.innerText = '');
|
|
17
|
+
e.key == 'Enter' && submitMethod();
|
|
18
|
+
};
|
|
19
|
+
this.loginBySMS = async () => {
|
|
20
|
+
const { phone, countryCode } = await this.loginTelInput.getValues();
|
|
21
|
+
const isPhoneValid = await this.loginTelInput.isValid();
|
|
22
|
+
if (!isPhoneValid)
|
|
23
|
+
return;
|
|
24
|
+
this.smsBtn.load()
|
|
25
|
+
.then(() => this.smsBtn.disable())
|
|
26
|
+
.then(() => salla.auth.api.login({ type: 'mobile', phone: phone, country_code: countryCode }))
|
|
27
|
+
.then(() => this.smsBtn.stop() && this.smsBtn.enable())
|
|
28
|
+
.then(() => this.showTab(this.verifyTab))
|
|
29
|
+
.then(() => this.verifyTab.by = 'sms')
|
|
30
|
+
.then(() => this.verifyTab.show({ phone: phone, country_code: countryCode }));
|
|
31
|
+
};
|
|
32
|
+
this.loginByEmail = () => {
|
|
33
|
+
if (!Helper.Helper.isValidEmail(this.loginEmail.value)) {
|
|
34
|
+
this.validateField(this.loginEmail, this.isEmailValid);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
this.emailBtn.load()
|
|
38
|
+
.then(() => this.emailBtn.disable())
|
|
39
|
+
.then(() => salla.auth.api.login({ type: 'email', email: this.loginEmail.value }))
|
|
40
|
+
.then(() => this.emailBtn.stop() && this.emailBtn.enable())
|
|
41
|
+
.then(() => this.showTab(this.verifyTab))
|
|
42
|
+
.then(() => this.verifyTab.by = 'email')
|
|
43
|
+
.then(() => this.verifyTab.show({ email: this.loginEmail.value }));
|
|
44
|
+
};
|
|
45
|
+
this.newUser = async () => {
|
|
46
|
+
const { phone: regPhone, countryCode, countryKey } = await this.regTelInput.getValues();
|
|
47
|
+
await this.newUserValidation();
|
|
48
|
+
await this.regBtn.load();
|
|
49
|
+
await this.regBtn.disable();
|
|
50
|
+
this.verifyTab.getCode()
|
|
51
|
+
.then(code => salla.auth.api.register({
|
|
52
|
+
first_name: this.firstName.value,
|
|
53
|
+
last_name: this.lastName.value,
|
|
54
|
+
phone: regPhone || this.loginTelInput.phone,
|
|
55
|
+
email: this.regEmail.value || this.loginEmail.value,
|
|
56
|
+
country_code: countryCode,
|
|
57
|
+
country_key: countryKey,
|
|
58
|
+
code: code,
|
|
59
|
+
verified_by: this.regType,
|
|
60
|
+
}))
|
|
61
|
+
.then(() => window.location.reload())
|
|
62
|
+
.catch(() => this.regBtn.stop() && this.regBtn.enable());
|
|
63
|
+
};
|
|
64
|
+
this.title = this.host.title || salla.lang.get('blocks.header.login');
|
|
65
|
+
this.host.removeAttribute('title');
|
|
66
|
+
salla.event.on('languages::translations.loaded', () => {
|
|
67
|
+
this.loginTypeTitle = salla.lang.get('blocks.header.select_login_way');
|
|
68
|
+
this.loginText = salla.lang.get('blocks.header.login');
|
|
69
|
+
this.smsLabel = salla.lang.get('blocks.header.sms');
|
|
70
|
+
this.mobileLabel = salla.lang.get('common.elements.mobile');
|
|
71
|
+
this.emailLabel = salla.lang.get('common.elements.email');
|
|
72
|
+
this.enterText = salla.lang.get('blocks.header.enter');
|
|
73
|
+
this.bySMSText = salla.lang.get('blocks.header.login_by_sms');
|
|
74
|
+
this.byEmailText = salla.lang.get('blocks.header.login_by_email');
|
|
75
|
+
this.title = salla.lang.get('blocks.header.login');
|
|
76
|
+
this.isEmailValid = salla.lang.get('common.elements.email_is_valid');
|
|
77
|
+
this.firstNameLabel = salla.lang.get('blocks.header.your_name');
|
|
78
|
+
this.lastNameLabel = salla.lang.get('pages.profile.last_name');
|
|
79
|
+
this.firstNameRequired = salla.lang.get('common.errors.field_required', { attribute: this.firstNameLabel });
|
|
80
|
+
this.lastNameRequired = salla.lang.get('common.errors.field_required', { attribute: this.lastNameLabel });
|
|
81
|
+
});
|
|
82
|
+
salla.auth.event.onVerificationFailed(() => {
|
|
83
|
+
//
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* @param {CustomEvent|{details:{case:'new_customer'|'authenticated', redirect_url:string|null}}} event
|
|
88
|
+
*/
|
|
89
|
+
onVerified(event) {
|
|
90
|
+
if (!event.detail.case) {
|
|
91
|
+
console.log('verified but without case!');
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (event.detail.case === "new_customer") {
|
|
95
|
+
return this.showTab(this.registrationTab);
|
|
96
|
+
}
|
|
97
|
+
//TODO::It looks that is this workaround🤔
|
|
98
|
+
if (salla.auth.event.getTypeActionOnVerified() !== 'redirect') {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (event.redirect_url) {
|
|
102
|
+
return window.location.href = event.redirect_url;
|
|
103
|
+
}
|
|
104
|
+
window.location.reload();
|
|
105
|
+
}
|
|
106
|
+
// from salla-verify comp
|
|
107
|
+
onbackClicked() {
|
|
108
|
+
this.regType == 'phone' ? this.showTab(this.mobileTab) : this.showTab(this.emailTab);
|
|
109
|
+
}
|
|
110
|
+
async show() {
|
|
111
|
+
this.showTab(this.isEmailAllowed ? this.homeTab : this.mobileTab);
|
|
112
|
+
return this.modal.show();
|
|
113
|
+
}
|
|
114
|
+
showTab(tab, evt) {
|
|
115
|
+
evt === null || evt === void 0 ? void 0 : evt.preventDefault();
|
|
116
|
+
[this.homeTab, this.mobileTab, this.emailTab, this.verifyTab, this.registrationTab].map(el => Helper.Helper.toggleElement(el, 'visible', 'hidden', () => el == tab));
|
|
117
|
+
setTimeout(() => { [this.homeTab, this.mobileTab, this.emailTab, this.verifyTab, this.registrationTab].map(el => Helper.Helper.toggleElement(el, 's-login-active', 's-login-unactive', () => el == tab)); }, 200);
|
|
118
|
+
setTimeout(() => { this.host.querySelector('.s-login-wrapper').setAttribute('style', 'height:' + (tab === null || tab === void 0 ? void 0 : tab.scrollHeight) + 'px'); });
|
|
119
|
+
if ([this.mobileTab, this.emailTab].includes(tab)) {
|
|
120
|
+
this.regType = tab === this.mobileTab ? 'phone' : 'email';
|
|
121
|
+
}
|
|
122
|
+
let isRegistrationTab = tab == this.registrationTab;
|
|
123
|
+
isRegistrationTab && this.firstName.focus();
|
|
124
|
+
this.modal.setTitle(isRegistrationTab ? salla.lang.get('common.titles.registration') : this.title);
|
|
125
|
+
if (!isRegistrationTab) {
|
|
126
|
+
Helper.Helper.toggleElement(this.regMobileBlock, 's-hidden', 's-block', () => this.regType === 'phone')
|
|
127
|
+
.toggleElement(this.regEmailBlock, 's-hidden', 's-block', () => this.regType === 'email');
|
|
128
|
+
}
|
|
129
|
+
return this;
|
|
130
|
+
}
|
|
131
|
+
async newUserValidation() {
|
|
132
|
+
const isPhoneReg = this.regType == "phone", isEmailReg = this.regType == "email", isFirstNameValid = this.firstName.value.length > 0, isLastNameValid = this.lastName.value.length > 0, isEmailValid = Helper.Helper.isValidEmail(this.regEmail.value || isEmailReg && this.loginEmail.value), isPhoneValid = await this.regTelInput.isValid() || isPhoneReg && await this.loginTelInput.isValid();
|
|
133
|
+
if (isEmailValid && isPhoneValid && isFirstNameValid && isLastNameValid)
|
|
134
|
+
return;
|
|
135
|
+
!isEmailValid && this.validateField(this.regEmail, this.isEmailValid);
|
|
136
|
+
!isFirstNameValid && this.validateField(this.firstName, this.firstNameRequired);
|
|
137
|
+
!isLastNameValid && this.validateField(this.lastName, this.lastNameRequired);
|
|
138
|
+
throw ('Please insert required fields');
|
|
139
|
+
}
|
|
140
|
+
validateField(field, errorMsg) {
|
|
141
|
+
field.classList.add('s-has-error');
|
|
142
|
+
field.nextElementSibling['innerText'] = '* ' + errorMsg;
|
|
143
|
+
}
|
|
144
|
+
render() {
|
|
145
|
+
return (index.h("salla-modal", { id: "salla-login", icon: "sicon-user", title: this.title, ref: modal => this.modal = modal, width: "xs" }, index.h("div", { class: "s-login-wrapper" }, this.isEmailAllowed ?
|
|
146
|
+
index.h("div", { class: "s-login-tab", ref: tab => this.homeTab = tab }, index.h("p", { class: "s-login-sub-title" }, this.loginTypeTitle), index.h("a", { href: "#", class: "s-login-main-btn", onClick: (evt) => this.showTab(this.mobileTab, evt) }, index.h("i", { class: "s-login-main-btn-icon sicon-phone" }), index.h("span", { class: "s-login-main-btn-text" }, this.smsLabel), index.h("i", { class: "main-btn-arrow sicon-keyboard_arrow_left" })), index.h("a", { href: "#", class: "s-login-main-btn", onClick: (evt) => this.showTab(this.emailTab, evt) }, index.h("i", { class: "s-login-main-btn-icon sicon-mail" }), index.h("span", { class: "s-login-main-btn-text" }, this.emailLabel), index.h("i", { class: "main-btn-arrow sicon-keyboard_arrow_left" })))
|
|
147
|
+
: '', index.h("div", { class: "s-login-tab", ref: tab => this.mobileTab = tab }, index.h("label", { class: "s-login-label" }, this.mobileLabel), index.h("salla-tel-input", { ref: el => this.loginTelInput = el, onKeyDown: e => this.typing(e, this.loginBySMS) }), index.h("salla-button", { wide: true, onClick: () => this.loginBySMS(), ref: b => this.smsBtn = b }, this.enterText), this.isEmailAllowed ? index.h("a", { href: "#", onClick: () => this.showTab(this.emailTab), class: "s-login-link" }, this.byEmailText) : ''), this.isEmailAllowed ?
|
|
148
|
+
index.h("div", { class: "s-login-tab", ref: tab => this.emailTab = tab }, index.h("label", { class: "s-login-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-input s-ltr" }), index.h("span", { class: "s-login-error-message" }), index.h("salla-button", { wide: true, onClick: () => this.loginByEmail(), ref: b => this.emailBtn = b }, this.enterText), index.h("a", { href: "#", onClick: () => this.showTab(this.mobileTab), class: "s-login-link" }, this.bySMSText)) : '', index.h("salla-verify", { "without-modal": true, ref: tab => this.verifyTab = tab, autoReload: false, "is-show-back": true }), index.h("div", { ref: tab => this.registrationTab = tab }, index.h("label", { class: "s-login-label" }, this.firstNameLabel), index.h("input", { type: "text", class: "s-login-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-error-message" }), index.h("label", { class: "s-login-label" }, this.lastNameLabel), index.h("input", { type: "text", class: "s-login-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-error-message" }), index.h("div", { ref: el => this.regMobileBlock = el, class: "mb-1.5" }, index.h("label", { class: "s-login-label" }, this.mobileLabel), index.h("salla-tel-input", { phone: '', 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-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-input s-ltr" }), index.h("span", { class: "s-login-error-message" })), index.h("salla-button", { wide: true, onClick: () => this.newUser(), ref: b => this.regBtn = b }, salla.lang.get('blocks.header.register'))))));
|
|
149
|
+
}
|
|
150
|
+
get host() { return index.getElement(this); }
|
|
151
|
+
};
|
|
152
|
+
SallaLogin.style = sallaLoginCss;
|
|
153
|
+
|
|
154
|
+
exports.SallaLogin = SallaLogin;
|
|
@@ -16,7 +16,7 @@ const SallaOffer = class {
|
|
|
16
16
|
this.productSlot = ((_c = Helper.Helper.getElement('[slot="product"]')) === null || _c === void 0 ? void 0 : _c.innerHTML) || this.defaultProductSlot();
|
|
17
17
|
salla.offer.event.onExisted(data => {
|
|
18
18
|
//TODO:: use the best, should we hide the offer by product Id or Offer id🤔
|
|
19
|
-
if (salla.
|
|
19
|
+
if (salla.localData.get('remember-offer-' + data.offer.offer_id)) {
|
|
20
20
|
salla.log('User selected to don\'t show this offer again.');
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
@@ -30,7 +30,7 @@ const SallaOffer = class {
|
|
|
30
30
|
.then(response => this.offer = response.data[0]);
|
|
31
31
|
}
|
|
32
32
|
rememberMe(event) {
|
|
33
|
-
salla.
|
|
33
|
+
salla.localData.set('remember-offer-' + this.offer.id, event.target.checked);
|
|
34
34
|
}
|
|
35
35
|
addItem() {
|
|
36
36
|
// this here, is sallaButton
|
|
@@ -61,11 +61,13 @@ const SallaRating = class {
|
|
|
61
61
|
showActiveStep(current = null) {
|
|
62
62
|
var _a;
|
|
63
63
|
this.currentTab = current || this.steps[this.currentIndex];
|
|
64
|
-
Helper.Helper.toggle('.s-rating-step', 's-rating-
|
|
65
|
-
.toggle('.s-rating-step
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
Helper.Helper.toggle('.s-rating-step-dot', 's-rating-bg-gray', 's-rating-bg-primary', dot => dot != this.dots[this.currentIndex])
|
|
65
|
+
.toggle('.s-rating-step', 's-rating-active', 's-rating-hidden', tab => tab == this.currentTab);
|
|
66
|
+
if (this.currentIndex != 0) {
|
|
67
|
+
// the animation
|
|
68
|
+
Helper.Helper.toggleElement(this.currentTab, 's-rating-unactive', 's-rating-hidden', () => true);
|
|
69
|
+
setTimeout(() => Helper.Helper.toggleElement(this.currentTab, 's-rating-active', 's-rating-unactive', () => true), 300);
|
|
70
|
+
}
|
|
69
71
|
// Btn text
|
|
70
72
|
let nextType = (_a = this.steps[this.currentIndex + 1]) === null || _a === void 0 ? void 0 : _a.dataset.type;
|
|
71
73
|
this.nextBtn.querySelector('.s-button-text').innerHTML = nextType
|
|
@@ -113,6 +115,7 @@ const SallaRating = class {
|
|
|
113
115
|
this.nextBtn.stop();
|
|
114
116
|
salla.config.canLeave = true;
|
|
115
117
|
this.currentIndex == this.stepsCount && this.showThankYou();
|
|
118
|
+
this.modal.isClosable = false;
|
|
116
119
|
});
|
|
117
120
|
}
|
|
118
121
|
submittedBefore() {
|
|
@@ -173,15 +176,15 @@ const SallaRating = class {
|
|
|
173
176
|
render() {
|
|
174
177
|
return (index.h(index.Host, null, index.h("salla-modal", { isLoading: true, width: "md", ref: modal => this.modal = modal }, this.order
|
|
175
178
|
? [index.h("div", { class: "s-rating-wrapper", ref: el => this.body = el }, this.order.testimonials_enabled ?
|
|
176
|
-
index.h("div", { class: "rating-outer-form s-rating-step-wrap s-rating-step", "data-type": "store" }, index.h("div", { class: "s-rating-rounded-icon" }, index.h("img", { src: salla.get('store.logo'), alt: "store name", class: "s-rating-store-logo" })), index.h("h2", { class: "s-rating-title" }, salla.lang.get('pages.rating.rate_the_store')), index.h("div", { class: "s-rating-stars-company" }, " ", this.renderRatingStars('large')), index.h("textarea", { id: "storeReview", name: "comment", class: "s-rating-comment", placeholder: salla.lang.get('pages.rating.write_store_rate') }), index.h("small", { class: "s-rating-validation-msg" }))
|
|
179
|
+
index.h("div", { class: "rating-outer-form s-rating-step-wrap s-rating-step s-rating-hidden", "data-type": "store" }, index.h("div", { class: "s-rating-rounded-icon" }, index.h("img", { src: salla.get('store.logo'), alt: "store name", class: "s-rating-store-logo" })), index.h("h2", { class: "s-rating-title" }, salla.lang.get('pages.rating.rate_the_store')), index.h("div", { class: "s-rating-stars-company" }, " ", this.renderRatingStars('large')), index.h("textarea", { id: "storeReview", name: "comment", class: "s-rating-comment", placeholder: salla.lang.get('pages.rating.write_store_rate') }), index.h("small", { class: "s-rating-validation-msg" }))
|
|
177
180
|
: '', this.order.products_enabled
|
|
178
|
-
? index.h("section", { class: "s-rating-step", "data-type": "products" }, this.order.products.map((item, index$1) => index.h("div", { class: "rating-outer-form s-rating-product", "data-stars-error": salla.lang.get('pages.rating.rate_product_stars') }, index.h("img", { src: item.product.thumbnail, alt: item.product.name, class: "s-rating-product-img" }), index.h("div", { class: "s-rating-product-details" }, index.h("h3", { class: "s-rating-product-title" }, " ", item.product.name), index.h("div", { class: "s-rating-stars-product" }, " ", this.renderRatingStars('small', `products[${index$1}][rating]`)), index.h("input", { type: "hidden", name: `products[${index$1}][product_id]`, value: item.product.id }), index.h("textarea", { placeholder: salla.lang.get('pages.rating.write_product_rate'), name: `products[${index$1}][comment]`, class: "s-rating-comment" }), index.h("small", { class: "s-rating-validation-msg" })))))
|
|
181
|
+
? index.h("section", { class: "s-rating-step s-rating-hidden", "data-type": "products" }, this.order.products.map((item, index$1) => index.h("div", { class: "rating-outer-form s-rating-product", "data-stars-error": salla.lang.get('pages.rating.rate_product_stars') }, index.h("img", { src: item.product.thumbnail, alt: item.product.name, class: "s-rating-product-img" }), index.h("div", { class: "s-rating-product-details" }, index.h("h3", { class: "s-rating-product-title" }, " ", item.product.name), index.h("div", { class: "s-rating-stars-product" }, " ", this.renderRatingStars('small', `products[${index$1}][rating]`)), index.h("input", { type: "hidden", name: `products[${index$1}][product_id]`, value: item.product.id }), index.h("textarea", { placeholder: salla.lang.get('pages.rating.write_product_rate'), name: `products[${index$1}][comment]`, class: "s-rating-comment" }), index.h("small", { class: "s-rating-validation-msg" })))))
|
|
179
182
|
: '', this.order.shipping_enabled
|
|
180
|
-
? index.h("div", { class: "rating-outer-form s-rating-step-wrap s-rating-step", "data-type": "shipping" }, index.h("input", { type: "hidden", name: "shipping_company_id", value: this.order.shipping.company.id }), this.order.shipping.company.logo
|
|
183
|
+
? index.h("div", { class: "rating-outer-form s-rating-step-wrap s-rating-step s-rating-hidden", "data-type": "shipping" }, index.h("input", { type: "hidden", name: "shipping_company_id", value: this.order.shipping.company.id }), this.order.shipping.company.logo
|
|
181
184
|
? index.h("div", { class: "s-rating-rounded-icon" }, index.h("img", { src: this.order.shipping.company.logo, class: "s-rating-shipping-logo", alt: this.order.shipping.company.name }))
|
|
182
185
|
: index.h("span", { class: "s-rating-icon sicon-shipping-fast" }), index.h("div", { class: "s-rating-title" }, " ", salla.lang.get('pages.rating.rate_shipping') + ' ' + this.order.shipping.company.name), index.h("div", { class: "s-rating-stars-company" }, this.renderRatingStars('large')), index.h("textarea", { name: "comment", class: "s-rating-comment", placeholder: salla.lang.get('pages.rating.write_shipping_rate') }), index.h("small", { class: "s-rating-validation-msg" }))
|
|
183
186
|
: '', index.h("div", { class: "s-rating-thanks s-rating-hidden", ref: el => this.thanksTab = el }, index.h("span", { class: "s-rating-icon sicon-check-circle2" }), index.h("h3", { class: "s-rating-thanks-title" }, salla.lang.get('pages.rating.thanks')), index.h("div", { class: "s-rating-thanks-msg", innerHTML: this.order.thanks_message }), index.h("time", { class: "s-rating-thanks-time", ref: el => this.thanksTime = el }))),
|
|
184
|
-
index.h("div", { class: "s-rating-footer" }, index.h("button", { ref: el => this.backBtn = el, onClick: () => this.previousTab(), class: "s-rating-btn s-rating-unvisiable" }, salla.lang.get('common.elements.back')), this.stepsCount > 1 ? index.h("ul", { class: "s-rating-dots" }, [0, 1, 2].slice(0, this.stepsCount).map(() => index.h("li", { class: 's-rating-bg-gray s-rating-step-dot' }))) : '', index.h("salla-button", { ref: el => this.nextBtn = el, onClick: () => this.submit() }, salla.lang.get('common.elements.next'))),]
|
|
187
|
+
index.h("div", { class: "s-rating-footer" }, index.h("button", { ref: el => this.backBtn = el, onClick: () => this.previousTab(), class: "s-rating-btn s-rating-unvisiable" }, salla.lang.get('common.elements.back')), this.stepsCount > 1 ? index.h("ul", { class: "s-rating-dots" }, [0, 1, 2].slice(0, this.stepsCount).map(() => index.h("li", { class: 's-rating-bg-gray s-rating-step-dot' }))) : '', index.h("salla-button", { "loader-position": 'center', ref: el => this.nextBtn = el, onClick: () => this.submit() }, salla.lang.get('common.elements.next'))),]
|
|
185
188
|
: '')));
|
|
186
189
|
}
|
|
187
190
|
componentDidRender() {
|