@salla.sa/twilight-components 1.0.21 → 1.0.22
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/Helper-fcea994c.js +23 -0
- package/dist/cjs/index-714023c8.js +1653 -0
- package/dist/cjs/index.cjs.js +13 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/cjs/salla-branches.cjs.entry.js +92 -0
- package/dist/cjs/salla-button_5.cjs.entry.js +1727 -0
- package/dist/cjs/salla-localization.cjs.entry.js +82 -0
- package/dist/cjs/salla-login-c438bb35.js +128 -0
- package/dist/cjs/salla-offer.cjs.entry.js +79 -0
- package/dist/cjs/salla-product-availability.cjs.entry.js +75 -0
- package/dist/cjs/salla-rating.cjs.entry.js +195 -0
- package/dist/cjs/salla-search-45173394.js +85 -0
- package/dist/cjs/salla-search.cjs.entry.js +11 -0
- package/dist/cjs/twilight-components.cjs.js +19 -0
- package/dist/collection/Helpers/Helper.js +19 -0
- package/dist/collection/collection-manifest.json +22 -0
- package/dist/collection/components/generate-summary.js +35 -0
- package/dist/collection/components/salla-branches/salla-branches.css +12 -0
- package/dist/collection/components/salla-branches/salla-branches.js +233 -0
- package/dist/collection/components/salla-button/salla-button.css +3 -0
- package/dist/collection/components/salla-button/salla-button.js +246 -0
- package/dist/collection/components/salla-localization/salla-localization.js +208 -0
- package/dist/collection/components/salla-login/salla-login.css +3 -0
- package/dist/collection/components/salla-login/salla-login.js +380 -0
- package/dist/collection/components/salla-modal/salla-modal.js +477 -0
- package/dist/collection/components/salla-offer/offer-schema.js +1 -0
- package/dist/collection/components/salla-offer/salla-offer.js +110 -0
- package/dist/collection/components/salla-product-availability/salla-product-availability.js +331 -0
- package/dist/collection/components/salla-rating/order-feedback-response.js +1 -0
- package/dist/collection/components/salla-rating/salla-rating.css +7 -0
- package/dist/collection/components/salla-rating/salla-rating.js +277 -0
- package/dist/collection/components/salla-search/salla-search.css +24 -0
- package/dist/collection/components/salla-search/salla-search.js +143 -0
- package/dist/collection/components/salla-tel-input/salla-tel-input.js +121 -0
- package/dist/collection/components/salla-verify/salla-verify.js +280 -0
- package/dist/collection/index.js +2 -0
- package/dist/collection/interfaces/colors.js +1 -0
- package/dist/collection/interfaces/index.js +2 -0
- package/dist/collection/interfaces/ratio.js +1 -0
- package/dist/collection/plugins/tailwind-theme/generator.js +62 -0
- package/dist/collection/plugins/tailwind-theme/index.js +26 -0
- package/dist/{twilight-components → esm}/Helper-d07ebbc7.js +0 -0
- package/dist/esm/index-a1bf769d.js +1625 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/{twilight-components → esm}/salla-branches.entry.js +2 -2
- package/dist/{twilight-components/salla-tel-input.entry.js → esm/salla-button_5.entry.js} +337 -35
- package/dist/{twilight-components → esm}/salla-localization.entry.js +1 -1
- package/dist/{twilight-components/salla-login-57b18c2c.js → esm/salla-login-dd957742.js} +26 -23
- package/dist/{twilight-components → esm}/salla-offer.entry.js +1 -1
- package/dist/{twilight-components → esm}/salla-product-availability.entry.js +1 -1
- package/dist/{twilight-components → esm}/salla-rating.entry.js +71 -108
- package/dist/{twilight-components/salla-search-30fec1e8.js → esm/salla-search-5e691ebb.js} +15 -11
- package/dist/esm/salla-search.entry.js +3 -0
- package/dist/esm/twilight-components.js +17 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/twilight-components/index.esm.js +1 -4
- package/dist/twilight-components/p-1a6d8171.entry.js +1 -0
- package/dist/twilight-components/p-1deb8111.entry.js +1 -0
- package/dist/twilight-components/p-3a4d963e.js +1 -0
- package/dist/twilight-components/p-47f17d3b.js +1 -0
- package/dist/twilight-components/p-5b2eb87d.entry.js +1 -0
- package/dist/twilight-components/p-6a5be894.js +1 -0
- package/dist/twilight-components/p-7fbdf746.entry.js +1 -0
- package/dist/twilight-components/p-7fe5d346.entry.js +1 -0
- package/dist/twilight-components/p-81a61f4e.js +1 -0
- package/dist/twilight-components/p-ce991664.entry.js +1 -0
- package/dist/twilight-components/p-da73fc9b.entry.js +1 -0
- package/dist/twilight-components/twilight-components.css +1 -3
- package/dist/twilight-components/twilight-components.esm.js +1 -125
- package/dist/types/components/salla-login/salla-login.d.ts +3 -3
- package/dist/types/components/salla-modal/salla-modal.d.ts +1 -0
- package/dist/types/components/salla-rating/salla-rating.d.ts +6 -23
- package/dist/types/components/salla-search/salla-search.d.ts +1 -1
- package/dist/types/components/salla-tel-input/salla-tel-input.d.ts +14 -0
- package/dist/types/components/salla-verify/salla-verify.d.ts +3 -1
- package/dist/types/components.d.ts +12 -35
- package/package.json +1 -1
- package/dist/twilight-components/app-globals-0f993ce5.js +0 -3
- package/dist/twilight-components/css-shim-a64b8820.js +0 -4
- package/dist/twilight-components/dom-d08ba8aa.js +0 -73
- package/dist/twilight-components/index-9c087700.js +0 -3010
- package/dist/twilight-components/salla-button.entry.js +0 -75
- package/dist/twilight-components/salla-login.entry.js +0 -3
- package/dist/twilight-components/salla-modal.entry.js +0 -113
- package/dist/twilight-components/salla-search.entry.js +0 -3
- package/dist/twilight-components/salla-verify.entry.js +0 -114
- package/dist/twilight-components/shadow-css-bc14d9fd.js +0 -389
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-714023c8.js');
|
|
6
|
+
const Helper = require('./Helper-fcea994c.js');
|
|
7
|
+
|
|
8
|
+
const SallaLocalization = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
index.registerInstance(this, hostRef);
|
|
11
|
+
var _a, _b;
|
|
12
|
+
this.language = salla.config.get('language', {});
|
|
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
|
+
Helper.Helper.setHost(this.host);
|
|
18
|
+
salla.event.on('localization::show', () => this.show());
|
|
19
|
+
/**
|
|
20
|
+
* letting developer to insert his own slot like:
|
|
21
|
+
* <salla-localization>
|
|
22
|
+
* <div slot="language">...{name}....</div>
|
|
23
|
+
* <div slot="currency">...{name}....</div>
|
|
24
|
+
* </salla-localization>
|
|
25
|
+
* Because scoped templates not supported in stencil );
|
|
26
|
+
* we made a workaround to pass language & currency attributes, then replace names in rendering
|
|
27
|
+
*/
|
|
28
|
+
this.languageSlot = ((_a = Helper.Helper.getElement('[slot="language"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || '<label class="s-localization-label" for="lang-{code}"><span>{name}</span><div class="s-localization-flag flag iti__flag iti__{country_code}"></div></label>';
|
|
29
|
+
this.currencySlot = ((_b = Helper.Helper.getElement('[slot="currency"]')) === null || _b === void 0 ? void 0 : _b.innerHTML) || '<label class="s-localization-label" for="currency-{code}"><span>{name}</span><small class="s-localization-currency">{code}</small></label>';
|
|
30
|
+
this.languages = Object.values(salla.config.get('languages', {}));
|
|
31
|
+
this.currencies = Object.values(salla.config.get('currencies', {}));
|
|
32
|
+
}
|
|
33
|
+
async show() {
|
|
34
|
+
return this.modal.show();
|
|
35
|
+
}
|
|
36
|
+
async hide() {
|
|
37
|
+
return this.modal.hide();
|
|
38
|
+
}
|
|
39
|
+
onChangeCurrency(event) {
|
|
40
|
+
this.currency = salla.config.get('currencies.' + event.target.value);
|
|
41
|
+
}
|
|
42
|
+
onChangeLanguage(event) {
|
|
43
|
+
this.language = salla.config.get('languages.' + event.target.value);
|
|
44
|
+
}
|
|
45
|
+
async submit() {
|
|
46
|
+
let url;
|
|
47
|
+
console.log('this.currency.code::::', this.currency, this.currency.code);
|
|
48
|
+
this.btn.load()
|
|
49
|
+
.then(() => this.currency.code === salla.config.get('user.currency') || ((url = window.location.href) && salla.currency.api.change(this.currency.code)))
|
|
50
|
+
.then(() => this.language.code === salla.config.get('user.language') || (url = this.language.url))
|
|
51
|
+
.then(() => this.btn.stop())
|
|
52
|
+
.then(() => this.hide())
|
|
53
|
+
.then(() => url && (window.location.href = url));
|
|
54
|
+
}
|
|
55
|
+
render() {
|
|
56
|
+
return (index.h("salla-modal", { id: "salla-localization", class: "hidden", ref: modal => this.modal = 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
|
+
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
|
+
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
|
+
.replace(/\{name\}/g, lang.name)
|
|
60
|
+
.replace(/\{code\}/g, lang.code)
|
|
61
|
+
.replace(/\{country_code\}/g, lang.country_code) }))) :
|
|
62
|
+
index.h("select", { class: "s-branches-select", name: "currency", onChange: e => this.onChangeLanguage(e) }, this.languages.map(lang => index.h("option", { value: lang.code, selected: this.language.code == lang.code }, lang.name)))))
|
|
63
|
+
: '', this.currencies.length > 1 ?
|
|
64
|
+
index.h("div", { class: "s-localization-section" }, index.h("label", { class: "s-localization-title" }, this.currenciesTitle), index.h("div", { class: "s-localization-section-inner" }, this.currencies.length < 6 ?
|
|
65
|
+
this.currencies.map(currency => index.h("div", { class: "s-localization-item" }, index.h("input", { class: "s-localization-input", type: "radio", name: "currency", checked: this.currency.code == currency.code, onChange: () => this.currency = currency, id: 'currency-' + currency.code, value: currency.code }), index.h("div", { id: "currency-slot", innerHTML: this.currencySlot
|
|
66
|
+
.replace(/\{name\}/g, currency.name)
|
|
67
|
+
.replace(/\{code\}/g, currency.code)
|
|
68
|
+
.replace(/\{country_code\}/g, currency.country_code) }))) :
|
|
69
|
+
index.h("select", { class: "s-branches-select", name: "currency", onChange: e => this.onChangeCurrency(e) }, this.currencies.map(currency => index.h("option", { value: currency.code, selected: this.currency.code == currency.code }, currency.name)))))
|
|
70
|
+
: ''), index.h("slot", { name: "footer" }, index.h("salla-button", { wide: true, ref: btn => this.btn = btn, onClick: () => this.submit() }, this.ok))));
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* to reduce dom levels we will move slot data into the parent dom
|
|
74
|
+
*/
|
|
75
|
+
componentDidRender() {
|
|
76
|
+
this.host.querySelectorAll('#currency-slot').forEach(el => el.replaceWith(el.firstChild));
|
|
77
|
+
this.host.querySelectorAll('#language-slot').forEach(el => el.replaceWith(el.firstChild));
|
|
78
|
+
}
|
|
79
|
+
get host() { return index.getElement(this); }
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
exports.salla_localization = SallaLocalization;
|
|
@@ -0,0 +1,128 @@
|
|
|
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}";
|
|
7
|
+
|
|
8
|
+
const SallaLogin = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
index.registerInstance(this, hostRef);
|
|
11
|
+
this.regType = 'phone';
|
|
12
|
+
this.isEmailAllowed = true;
|
|
13
|
+
this.loginTypeTitle = salla.lang.get('blocks.header.select_login_way');
|
|
14
|
+
this.loginText = salla.lang.get('blocks.header.login');
|
|
15
|
+
this.smsLabel = salla.lang.get('blocks.header.sms');
|
|
16
|
+
this.mobileLabel = salla.lang.get('common.elements.mobile');
|
|
17
|
+
this.emailLabel = salla.lang.get('common.elements.email');
|
|
18
|
+
this.enterText = salla.lang.get('blocks.header.enter');
|
|
19
|
+
this.bySMSText = salla.lang.get('blocks.header.login_by_sms');
|
|
20
|
+
this.byEmailText = salla.lang.get('blocks.header.login_by_email');
|
|
21
|
+
this.backText = salla.lang.get('common.elements.back');
|
|
22
|
+
this.title = this.host.title || salla.lang.get('blocks.header.login');
|
|
23
|
+
this.host.removeAttribute('title');
|
|
24
|
+
salla.auth.event.onVerificationFailed(() => {
|
|
25
|
+
//
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* @param {CustomEvent|{details:{case:'new_customer'|'authenticated', redirect_url:string|null}}} event
|
|
30
|
+
*/
|
|
31
|
+
onVerified(event) {
|
|
32
|
+
if (!event.detail.case) {
|
|
33
|
+
console.log('verified but without case!');
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (event.detail.case === "new_customer") {
|
|
37
|
+
return this.showTab(this.tab5);
|
|
38
|
+
}
|
|
39
|
+
//TODO::It looks that is this workaround🤔
|
|
40
|
+
if (salla.auth.event.getTypeActionOnVerified() !== 'redirect') {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (event.redirect_url) {
|
|
44
|
+
return window.location.href = event.redirect_url;
|
|
45
|
+
}
|
|
46
|
+
window.location.reload();
|
|
47
|
+
}
|
|
48
|
+
onbackClicked() {
|
|
49
|
+
this.regType == 'phone' ? this.showTab(this.tab2) : this.showTab(this.tab3);
|
|
50
|
+
}
|
|
51
|
+
async show() {
|
|
52
|
+
this.showTab(this.isEmailAllowed ? this.tab1 : this.tab2);
|
|
53
|
+
return this.modal.show();
|
|
54
|
+
}
|
|
55
|
+
showTab(tab) {
|
|
56
|
+
[this.tab1, this.tab2, this.tab3, this.tab4, this.tab5].map(el => Helper.Helper.toggleElement(el, 'visible', 'hidden', () => el == tab));
|
|
57
|
+
setTimeout(() => { [this.tab1, this.tab2, this.tab3, this.tab4, this.tab5].map(el => Helper.Helper.toggleElement(el, 's-login-active', 's-login-unactive', () => el == tab)); }, 200);
|
|
58
|
+
setTimeout(() => { this.host.querySelector('.s-login-wrapper').setAttribute('style', 'height:' + (tab === null || tab === void 0 ? void 0 : tab.scrollHeight) + 'px'); });
|
|
59
|
+
if ([this.tab2, this.tab3].includes(tab)) {
|
|
60
|
+
this.regType = tab === this.tab2 ? 'phone' : 'email';
|
|
61
|
+
}
|
|
62
|
+
let isRegistrationTab = tab == this.tab5;
|
|
63
|
+
isRegistrationTab && this.firstName.focus();
|
|
64
|
+
this.modal.setTitle(isRegistrationTab ? salla.lang.get('common.titles.registration') : this.title);
|
|
65
|
+
if (!isRegistrationTab) {
|
|
66
|
+
Helper.Helper.toggleElement(this.regMobileBlock, 's-hidden', 's-block', () => this.regType === 'phone')
|
|
67
|
+
.toggleElement(this.regEmailBlock, 's-hidden', 's-block', () => this.regType === 'email');
|
|
68
|
+
}
|
|
69
|
+
return this;
|
|
70
|
+
}
|
|
71
|
+
loginByEmail() {
|
|
72
|
+
if (!Helper.Helper.isValidEmail(this.email.value)) {
|
|
73
|
+
this.email.classList.add('s-has-error');
|
|
74
|
+
this.email.nextElementSibling['innerText'] = '* ' + salla.lang.get('common.elements.email_is_valid');
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
this.email.nextElementSibling['innerText'] = '';
|
|
78
|
+
this.email.classList.remove('s-has-error');
|
|
79
|
+
salla.auth.api.login({ type: 'email', email: this.email.value })
|
|
80
|
+
.then(() => this.showTab(this.tab4))
|
|
81
|
+
.then(() => (this.tab4.by = 'email') && (this.tab4.url = 'auth/email/verify'))
|
|
82
|
+
.then(() => this.tab4.show({ email: this.email.value }));
|
|
83
|
+
}
|
|
84
|
+
async loginBySMS() {
|
|
85
|
+
const { phone, countryCode } = await this.loginTelInput.getValues();
|
|
86
|
+
if (phone.length < 6) {
|
|
87
|
+
this.loginTelInput.classList.add('s-has-error');
|
|
88
|
+
this.loginTelInput.nextElementSibling['innerText'] = '* ' + salla.lang.get('mobile_app.strings.incorrect_mobile');
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
this.loginTelInput.nextElementSibling['innerText'] = '';
|
|
92
|
+
this.loginTelInput.classList.remove('s-has-error');
|
|
93
|
+
salla.auth.api.login({ type: 'mobile', phone: phone, country_code: countryCode })
|
|
94
|
+
.then(() => this.showTab(this.tab4))
|
|
95
|
+
.then(() => (this.tab4.by = 'sms') && (this.tab4.url = 'auth/mobile/verify'))
|
|
96
|
+
.then(() => this.tab4.show({ phone: phone, country_code: countryCode }));
|
|
97
|
+
}
|
|
98
|
+
//TODO:: if it's enter, go submit
|
|
99
|
+
typing({ target }) {
|
|
100
|
+
target.type === 'tel' && salla.helpers.digitsOnly(target);
|
|
101
|
+
target.classList.remove('s-has-error');
|
|
102
|
+
target.nextElementSibling.innerText = '';
|
|
103
|
+
}
|
|
104
|
+
async newUser() {
|
|
105
|
+
const { phone: regPhone, countryCode, countryKey } = await this.regTelInput.getValues();
|
|
106
|
+
this.tab4.getCode()
|
|
107
|
+
.then(code => salla.auth.api.register({
|
|
108
|
+
first_name: this.firstName.value,
|
|
109
|
+
last_name: this.lastName.value,
|
|
110
|
+
phone: regPhone || this.loginTelInput.phone,
|
|
111
|
+
email: this.regEmail.value || this.email.value,
|
|
112
|
+
country_code: countryCode,
|
|
113
|
+
country_key: countryKey,
|
|
114
|
+
code: code,
|
|
115
|
+
verified_by: this.regType,
|
|
116
|
+
})).then(() => window.location.reload());
|
|
117
|
+
}
|
|
118
|
+
render() {
|
|
119
|
+
return (index.h("salla-modal", { id: "salla-login", title: this.title, ref: modal => this.modal = modal, width: "xs" }, index.h("div", { class: "s-login-wrapper" }, this.isEmailAllowed ?
|
|
120
|
+
index.h("div", { class: "s-login-tab", ref: tab => this.tab1 = tab }, index.h("p", { class: "s-login-sub-title" }, this.loginTypeTitle), index.h("a", { href: "#", class: "s-login-main-btn", onClick: () => this.showTab(this.tab2) }, 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: () => this.showTab(this.tab3) }, 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" })))
|
|
121
|
+
: '', index.h("div", { class: "s-login-tab", ref: tab => this.tab2 = tab }, index.h("label", { class: "s-login-label" }, this.mobileLabel), index.h("salla-tel-input", { phone: '', ref: el => this.loginTelInput = el }), index.h("span", { class: "s-login-error-message" }), index.h("salla-button", { wide: true, onClick: () => this.loginBySMS() }, this.enterText), this.isEmailAllowed ? index.h("a", { href: "#", onClick: () => this.showTab(this.tab3), class: "s-login-link" }, this.byEmailText) : ''), this.isEmailAllowed ?
|
|
122
|
+
index.h("div", { class: "s-login-tab", ref: tab => this.tab3 = tab }, index.h("label", { class: "s-login-label" }, this.emailLabel), index.h("input", { onChange: () => this.loginByEmail(), type: "email", ref: el => this.email = el, onInput: this.typing, 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() }, this.enterText), index.h("a", { href: "#", onClick: () => this.showTab(this.tab2), class: "s-login-link" }, this.bySMSText)) : '', index.h("salla-verify", { "without-modal": true, ref: tab => this.tab4 = tab, autoReload: false, "back-text": this.backText }), index.h("div", { ref: tab => this.tab5 = tab }, index.h("label", { class: "s-login-label" }, salla.lang.get('blocks.header.your_name')), index.h("input", { type: "text", class: "s-login-input", ref: el => this.firstName = el, placeholder: salla.lang.get('pages.profile.first_name') }), index.h("label", { class: "s-login-label" }, salla.lang.get('pages.profile.last_name')), index.h("input", { type: "text", class: "s-login-input", ref: el => this.lastName = el, placeholder: salla.lang.get('pages.profile.last_name') }), index.h("div", { ref: el => this.regMobileBlock = el }, index.h("label", { class: "s-login-label" }, this.mobileLabel), index.h("salla-tel-input", { phone: '', ref: el => this.regTelInput = el }), index.h("span", { class: "s-login-error-message" })), index.h("div", { ref: el => this.regEmailBlock = el }, index.h("label", { class: "s-login-label" }, this.emailLabel), index.h("input", { type: "email", ref: el => this.regEmail = el, onInput: this.typing, 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() }, salla.lang.get('blocks.header.register'))))));
|
|
123
|
+
}
|
|
124
|
+
get host() { return index.getElement(this); }
|
|
125
|
+
};
|
|
126
|
+
SallaLogin.style = sallaLoginCss;
|
|
127
|
+
|
|
128
|
+
exports.SallaLogin = SallaLogin;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-714023c8.js');
|
|
6
|
+
const Helper = require('./Helper-fcea994c.js');
|
|
7
|
+
|
|
8
|
+
const SallaOffer = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
index.registerInstance(this, hostRef);
|
|
11
|
+
var _a, _b, _c;
|
|
12
|
+
this.offer = null;
|
|
13
|
+
Helper.Helper.setHost(this.host);
|
|
14
|
+
this.headerSlot = ((_a = Helper.Helper.getElement('[slot="header"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || '<b class="s-offer-title">{name}</b><h3 class="s-offer-subtitle">{message}</h3>';
|
|
15
|
+
this.categorySlot = ((_b = Helper.Helper.getElement('[slot="category"]')) === null || _b === void 0 ? void 0 : _b.innerHTML) || '<i class="s-offer-badge-icon sicon-tag"></i><span class="s-offer-badge-text">{name}</span>';
|
|
16
|
+
this.productSlot = ((_c = Helper.Helper.getElement('[slot="product"]')) === null || _c === void 0 ? void 0 : _c.innerHTML) || this.defaultProductSlot();
|
|
17
|
+
salla.offer.event.onExisted(data => {
|
|
18
|
+
//TODO:: use the best, should we hide the offer by product Id or Offer id🤔
|
|
19
|
+
if (salla.localStore.get('remember-offer-' + data.offer.offer_id)) {
|
|
20
|
+
salla.log('User selected to don\'t show this offer again.');
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
this.show(data.product_id);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
async show(productId) {
|
|
27
|
+
return this.modal.show()
|
|
28
|
+
.then(() => salla.api.offer.details(productId))
|
|
29
|
+
//TODO:: make sure there is only one offer
|
|
30
|
+
.then(response => this.offer = response.data[0]);
|
|
31
|
+
}
|
|
32
|
+
rememberMe(event) {
|
|
33
|
+
salla.localStore.set('remember-offer-' + this.offer.id, event.target.checked);
|
|
34
|
+
}
|
|
35
|
+
addItem() {
|
|
36
|
+
// this here, is sallaButton
|
|
37
|
+
this['load']();
|
|
38
|
+
return salla.cart.api
|
|
39
|
+
.quickAdd(this['dataset'].id)
|
|
40
|
+
.finally(() => this['stop']());
|
|
41
|
+
}
|
|
42
|
+
defaultProductSlot() {
|
|
43
|
+
return '<a href={url} class="s-offer-product-image"><img class="s-offer-product-img" src="{image}" /></a>' +
|
|
44
|
+
'<div class="s-offer-product-info">' +
|
|
45
|
+
' <a href={url} class="s-offer-product-name">{name}</a>' +
|
|
46
|
+
' <div class="s-offer-product-price">{price}</div>' +
|
|
47
|
+
'</div>';
|
|
48
|
+
}
|
|
49
|
+
render() {
|
|
50
|
+
var _a, _b;
|
|
51
|
+
return index.h("salla-modal", { ref: modal => this.modal = modal, "is-loading": this.offer === null }, this.offer !== null
|
|
52
|
+
? [index.h("div", { class: "s-offer-header", innerHTML: this.headerSlot
|
|
53
|
+
.replace(/\{name\}/g, this.offer.name)
|
|
54
|
+
.replace(/\{message\}/g, this.offer.message) }),
|
|
55
|
+
index.h("div", { class: "s-offer-body" }, ((_a = this.offer.get.categories) === null || _a === void 0 ? void 0 : _a.length) > 0
|
|
56
|
+
? this.offer.get.categories.map(category => index.h("a", { href: category.urls.customer, class: "s-offer-badge", innerHTML: this.categorySlot
|
|
57
|
+
.replace(/\{name\}/g, category.name)
|
|
58
|
+
.replace(/\{url\}/g, category.urls.customer) }))
|
|
59
|
+
: (_b = this.offer.get.products) === null || _b === void 0 ? void 0 : _b.map(product => index.h("div", { class: "s-offer-product", id: 'product_' + product.id, innerHTML: this.productSlot
|
|
60
|
+
.replace(/\{name\}/g, product.name)
|
|
61
|
+
.replace(/\{url\}/g, product.url)
|
|
62
|
+
.replace(/\{image\}/g, product.thumbnail)
|
|
63
|
+
.replace(/\{price\}/g, product.has_special_price
|
|
64
|
+
? salla.money(product.sale_price) + '<span class="s-offer-product-old-price">' + salla.money(product.regular_price) + '</span>'
|
|
65
|
+
: salla.money(product.price)) }, index.h("salla-button", { "btn-style": 'outline-primary', "data-id": product.id, onClick: this.addItem }, salla.lang.get('pages.cart.add_to_cart'))))),
|
|
66
|
+
index.h("div", { class: "s-offer-footer", slot: "footer" }, this.offer.expiry_date ?
|
|
67
|
+
index.h("p", { class: "s-offer-expiry" }, salla.lang.get('pages.products.offer_expires_in'), " ", this.offer.expiry_date)
|
|
68
|
+
: '', index.h("label", { class: "s-offer-remember-label" }, index.h("input", { type: "checkbox", onChange: e => this.rememberMe(e), class: "s-offer-remember-input" }), "\u00A0 ", salla.lang.get('common.remember_my_choice'))),
|
|
69
|
+
] : '');
|
|
70
|
+
}
|
|
71
|
+
componentDidRender() {
|
|
72
|
+
//todo:: know from where there is hidden attributes to the doms🤔
|
|
73
|
+
//todo:: add animation
|
|
74
|
+
this.modal.querySelectorAll('[hidden]').forEach(el => el.removeAttribute('hidden'));
|
|
75
|
+
}
|
|
76
|
+
get host() { return index.getElement(this); }
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
exports.salla_offer = SallaOffer;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-714023c8.js');
|
|
6
|
+
const Helper = require('./Helper-fcea994c.js');
|
|
7
|
+
|
|
8
|
+
const SallaProductAvailability = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
index.registerInstance(this, hostRef);
|
|
11
|
+
this.isUser = Helper.Helper.isUser();
|
|
12
|
+
this.buttonText = salla.lang.get('pages.products.notify_availability');
|
|
13
|
+
this.countryCode = salla.config.country_code || 'SA';
|
|
14
|
+
this.subscribeText = salla.lang.get('common.elements.submit');
|
|
15
|
+
this.cancelText = salla.lang.get('common.elements.cancel');
|
|
16
|
+
this.subTitle = salla.lang.get('pages.products.notify_availability_subtitle');
|
|
17
|
+
this.mobileLabel = salla.lang.get('common.elements.mobile');
|
|
18
|
+
this.emailLabel = salla.lang.get('common.elements.email');
|
|
19
|
+
this.mobilePlaceholder = salla.lang.get('common.elements.mobile_placeholder');
|
|
20
|
+
this.emailPlaceholder = salla.lang.get('common.elements.email_placeholder');
|
|
21
|
+
this.productId = salla.config.page.id;
|
|
22
|
+
this.subscribedMessage = salla.lang.get('pages.products.notify_availability_success');
|
|
23
|
+
this.isSubscribed = false;
|
|
24
|
+
if (this.isUser) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
this.channelsWatcher(this.channels);
|
|
28
|
+
this.title_ = this.host.title || salla.lang.get('pages.products.notify_availability_title');
|
|
29
|
+
this.host.removeAttribute('title');
|
|
30
|
+
}
|
|
31
|
+
channelsWatcher(newValue) {
|
|
32
|
+
this.channels_ = newValue.split(',');
|
|
33
|
+
}
|
|
34
|
+
async submit() {
|
|
35
|
+
if (this.isUser) {
|
|
36
|
+
return salla.api.product.availabilitySubscribe(this.productId)
|
|
37
|
+
.then(() => this.isSubscribed = true);
|
|
38
|
+
}
|
|
39
|
+
let data = { id: this.productId, country_code: this.countryCode };
|
|
40
|
+
if (this.mobile.value !== '') {
|
|
41
|
+
data['mobile'] = this.mobile.value;
|
|
42
|
+
}
|
|
43
|
+
if (this.email.value !== '') {
|
|
44
|
+
data['email'] = this.email.value;
|
|
45
|
+
}
|
|
46
|
+
return this.btn.load()
|
|
47
|
+
.then(() => this.btn.disable())
|
|
48
|
+
.then(() => salla.api.product.availabilitySubscribe(data))
|
|
49
|
+
.then(() => this.isSubscribed = true) //no need to wait until finishing alert animation
|
|
50
|
+
.then(() => this.btn.stop())
|
|
51
|
+
.then(() => this.modal.hide())
|
|
52
|
+
.catch(() => this.btn.stop() && this.btn.enable());
|
|
53
|
+
}
|
|
54
|
+
render() {
|
|
55
|
+
return (index.h(index.Host, null, this.isSubscribed
|
|
56
|
+
? index.h("div", { class: "s-product-availability-subscribed" }, this.subscribedMessage)
|
|
57
|
+
: index.h("slot", null, index.h("salla-button", { wide: true, onClick: () => this.isUser ? this.submit() : this.modal.show() }, this.buttonText)), this.isUser || this.isSubscribed ? '' : this.renderModal()));
|
|
58
|
+
}
|
|
59
|
+
renderModal() {
|
|
60
|
+
return (index.h("salla-modal", { ref: modal => this.modal = modal, title: this.title_, subTitle: this.subTitle, icon: "sicon-bell-ring", width: "md" }, index.h("div", { class: "s-product-availability-body" }, this.channels_.includes('email') ? [
|
|
61
|
+
index.h("label", { class: "s-product-availability-label" }, this.emailLabel),
|
|
62
|
+
index.h("input", { class: "s-product-availability-input", placeholder: this.emailPlaceholder, ref: el => this.email = el, type: "email" })
|
|
63
|
+
] : '', this.channels_.includes('sms') ? [
|
|
64
|
+
index.h("label", { class: "s-product-availability-label" }, this.mobileLabel),
|
|
65
|
+
index.h("input", { class: "s-product-availability-input", placeholder: this.mobilePlaceholder, ref: el => this.mobile = el, type: "text" }),
|
|
66
|
+
index.h("input", { type: "hidden", value: this.countryCode }),
|
|
67
|
+
] : ''), index.h("div", { slot: "footer", class: "s-product-availability-footer" }, index.h("salla-button", { wide: true, ref: btn => this.btn = btn, onClick: () => this.submit() }, this.subscribeText), index.h("salla-button", { wide: true, "btn-style": "outline" }, this.cancelText))));
|
|
68
|
+
}
|
|
69
|
+
get host() { return index.getElement(this); }
|
|
70
|
+
static get watchers() { return {
|
|
71
|
+
"channels": ["channelsWatcher"]
|
|
72
|
+
}; }
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
exports.salla_product_availability = SallaProductAvailability;
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-714023c8.js');
|
|
6
|
+
const Helper = require('./Helper-fcea994c.js');
|
|
7
|
+
|
|
8
|
+
const sallaRatingCss = ":host{display:block}.unicode{unicode-bidi:plaintext}";
|
|
9
|
+
|
|
10
|
+
const SallaRating = class {
|
|
11
|
+
constructor(hostRef) {
|
|
12
|
+
index.registerInstance(this, hostRef);
|
|
13
|
+
this.stepsCount = 0;
|
|
14
|
+
this.currentIndex = 0;
|
|
15
|
+
this.submitted = [];
|
|
16
|
+
Helper.Helper.setHost(this.host);
|
|
17
|
+
salla.event.on('rating::show', () => this.show());
|
|
18
|
+
}
|
|
19
|
+
async show() {
|
|
20
|
+
return this.modal.show()
|
|
21
|
+
.then(() => salla.feedback.api.order(salla.get('page.id')))
|
|
22
|
+
.then(res => this.order = res.data)
|
|
23
|
+
.then(() => this.modal.setTitle(salla.lang.get('pages.rating.rate_order') + ' <span class="unicode">(#' + this.order.id + ')</span>'))
|
|
24
|
+
.then(() => this.modal.stopLoading())
|
|
25
|
+
.then(() => this.stepsCount = [this.order.testimonials_enabled, this.order.products_enabled, this.order.shipping_enabled].filter(enabled => enabled).length)
|
|
26
|
+
.then(() => setTimeout(() => this.initiateRating(), 100));
|
|
27
|
+
}
|
|
28
|
+
async hide() {
|
|
29
|
+
return this.modal.hide();
|
|
30
|
+
}
|
|
31
|
+
initiateRating() {
|
|
32
|
+
this.handleWizard();
|
|
33
|
+
this.highlightSelectedStars();
|
|
34
|
+
salla.document.event.onSubmit('.s-rating-stars-element', function (event) {
|
|
35
|
+
// Prevent form from submitting
|
|
36
|
+
event.preventDefault();
|
|
37
|
+
// Get the selected star - activeElement is not supported in safari
|
|
38
|
+
let activeStars = event.target.querySelectorAll('.s-rating-btn-star.hovered');
|
|
39
|
+
let selected = activeStars[activeStars.length - 1];
|
|
40
|
+
if (!selected)
|
|
41
|
+
return;
|
|
42
|
+
let selectedIndex = parseInt(selected.dataset.star, 10);
|
|
43
|
+
event.target.querySelector('.rating_hidden_input').value = selectedIndex;
|
|
44
|
+
// Get all stars in this form (only search in the form, not the whole document)
|
|
45
|
+
// Loop through each star, and add or remove the `.selected` class to toggle highlighting
|
|
46
|
+
event.target
|
|
47
|
+
.querySelectorAll('.s-rating-btn-star')
|
|
48
|
+
.forEach((star, index) => Helper.Helper.toggleElement(star, 'selected', 'un-selected', () => index < selectedIndex));
|
|
49
|
+
// Remove aria-pressed from any previously selected star
|
|
50
|
+
event.target.querySelectorAll('.s-rating-btn-star[aria-pressed="true"]').forEach(star => star.removeAttribute('aria-pressed'));
|
|
51
|
+
// Add aria-pressed role to the selected button
|
|
52
|
+
selected.setAttribute('aria-pressed', '');
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
// handle wizard
|
|
56
|
+
handleWizard() {
|
|
57
|
+
this.steps = this.host.querySelectorAll(".s-rating-step");
|
|
58
|
+
this.dots = this.host.querySelectorAll(".s-rating-step-dot");
|
|
59
|
+
this.showActiveStep();
|
|
60
|
+
}
|
|
61
|
+
showActiveStep(current = null) {
|
|
62
|
+
var _a;
|
|
63
|
+
this.currentTab = current || this.steps[this.currentIndex];
|
|
64
|
+
Helper.Helper.toggle('.s-rating-step', 's-rating-active', 's-rating-hidden', tab => tab == this.currentTab)
|
|
65
|
+
.toggle('.s-rating-step-dot', 's-rating-bg-gray', 's-rating-bg-primary', dot => dot != this.dots[this.currentIndex]);
|
|
66
|
+
// the animation
|
|
67
|
+
Helper.Helper.toggleElement(this.currentTab, 's-rating-unactive', 's-rating-hidden', () => true);
|
|
68
|
+
setTimeout(() => Helper.Helper.toggleElement(this.currentTab, 's-rating-active', 's-rating-unactive', () => true), 300);
|
|
69
|
+
// Btn text
|
|
70
|
+
let nextType = (_a = this.steps[this.currentIndex + 1]) === null || _a === void 0 ? void 0 : _a.dataset.type;
|
|
71
|
+
this.nextBtn.querySelector('.s-button-text').innerHTML = nextType
|
|
72
|
+
? salla.lang.get('pages.rating.rate') + ' ' + salla.lang.get('pages.rating.' + nextType)
|
|
73
|
+
: salla.lang.get('pages.rating.send_ratings');
|
|
74
|
+
setTimeout(() => { var _a; return this.body.setAttribute('style', 'height:' + ((_a = this.currentTab) === null || _a === void 0 ? void 0 : _a.scrollHeight) + 'px'); });
|
|
75
|
+
}
|
|
76
|
+
highlightSelectedStars() {
|
|
77
|
+
let hover = ['hovered'];
|
|
78
|
+
Helper.Helper.all('.s-rating-stars-element', el => {
|
|
79
|
+
let starElements = el.querySelectorAll('.s-rating-btn-star');
|
|
80
|
+
// remove hovered state from stars ---
|
|
81
|
+
el.addEventListener('mouseout', () => starElements.forEach(star => star.classList.remove(...hover)));
|
|
82
|
+
starElements.forEach((starElement, index) => {
|
|
83
|
+
starElement.addEventListener('mouseover', () => {
|
|
84
|
+
starElement.classList.add(...hover);
|
|
85
|
+
if (index <= 1) {
|
|
86
|
+
starElement.previousElementSibling.tagName === 'BUTTON' ? starElement.previousElementSibling.classList.add(...hover) : null;
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
for (let i = 0; i < index; i++) {
|
|
90
|
+
starElements[i].classList.add(...hover);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
starElement.addEventListener('mouseout', () => starElement.classList.remove(...hover));
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
previousTab() {
|
|
99
|
+
this.currentIndex > 0 && this.currentIndex--;
|
|
100
|
+
Helper.Helper.toggleElement(this.backBtn, 's-rating-unvisiable', 'block', () => this.currentIndex == 0);
|
|
101
|
+
this.showActiveStep();
|
|
102
|
+
}
|
|
103
|
+
submit() {
|
|
104
|
+
this.submittedBefore() || this.validate();
|
|
105
|
+
salla.config.canLeave = false;
|
|
106
|
+
this.nextBtn.load()
|
|
107
|
+
.then(() => this.submittedBefore() || this.sendFeedback())
|
|
108
|
+
.then(() => this.currentTab.querySelectorAll('[name],.s-rating-btn-star').forEach(el => el.setAttribute('disabled', '')))
|
|
109
|
+
.then(() => this.currentIndex < this.stepsCount && this.currentIndex++)
|
|
110
|
+
.then(() => this.showActiveStep())
|
|
111
|
+
.then(() => Helper.Helper.toggle('#prev-btn', 'block', 's-rating-unvisiable', () => true))
|
|
112
|
+
.finally(() => {
|
|
113
|
+
this.nextBtn.stop();
|
|
114
|
+
salla.config.canLeave = true;
|
|
115
|
+
this.currentIndex == this.stepsCount && this.showThankYou();
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
submittedBefore() {
|
|
119
|
+
return this.submitted.includes(this.currentIndex);
|
|
120
|
+
}
|
|
121
|
+
validate(rating = null, type = null) {
|
|
122
|
+
if (!rating && this.currentTab.dataset.type == 'products') {
|
|
123
|
+
return this.currentTab.querySelectorAll('.rating-outer-form').forEach(rating => this.validate(rating, 'product'));
|
|
124
|
+
}
|
|
125
|
+
rating = rating || this.currentTab;
|
|
126
|
+
let stars = rating.querySelector('.rating_hidden_input').value;
|
|
127
|
+
let comment = rating.querySelector('.s-rating-comment');
|
|
128
|
+
let validationMessage = rating.querySelector('.s-rating-validation-msg');
|
|
129
|
+
if (stars && comment.value && comment.value.length > 3) {
|
|
130
|
+
comment.classList.remove('s-rating-has-error');
|
|
131
|
+
validationMessage.innerHTML = '';
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
type = type || rating['dataset'].type;
|
|
135
|
+
Helper.Helper.toggleElement(comment, 'save', 's-rating-has-error', el => el.value.length > 3);
|
|
136
|
+
throw validationMessage.innerHTML = stars
|
|
137
|
+
? (salla.lang.get('common.errors.not_less_than_chars', { chars: 4 }) + ' ' + comment.getAttribute('placeholder'))
|
|
138
|
+
: salla.lang.get(`pages.rating.rate_${type}_stars`).replace(' (:item)', '');
|
|
139
|
+
}
|
|
140
|
+
sendFeedback() {
|
|
141
|
+
let data = {};
|
|
142
|
+
this.currentTab.querySelectorAll('[name]').forEach((input) => {
|
|
143
|
+
//decode names like `<input name="jamal[inner]" value="hi">` to be name(jamal), value: {inner:"hi"}
|
|
144
|
+
let inputData = salla.helpers.inputData(input.name, input.value, data);
|
|
145
|
+
data[inputData.name] = inputData.value;
|
|
146
|
+
});
|
|
147
|
+
if (Object.keys(data).length == 0) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
data['order_id'] = salla.get('page.id');
|
|
151
|
+
data['type'] = this.currentTab.dataset.type;
|
|
152
|
+
this.submitted.push(this.currentIndex);
|
|
153
|
+
return salla.feedback.api[this.currentTab.dataset.type](data);
|
|
154
|
+
}
|
|
155
|
+
showThankYou() {
|
|
156
|
+
let seconds = 10;
|
|
157
|
+
let timeToClose = setInterval(() => {
|
|
158
|
+
this.thanksTime.innerHTML = '00:0' + (seconds--);
|
|
159
|
+
if (seconds > 0) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
clearInterval(timeToClose);
|
|
163
|
+
this.thanksTime.remove();
|
|
164
|
+
this.hide().then(() => window.location.reload());
|
|
165
|
+
}, 1000);
|
|
166
|
+
this.host.querySelector('.s-rating-footer').classList.add('s-rating-unvisiable');
|
|
167
|
+
this.showActiveStep(this.thanksTab);
|
|
168
|
+
}
|
|
169
|
+
renderRatingStars(size, name = 'rating') {
|
|
170
|
+
return (index.h("form", { class: "s-rating-stars-element" }, index.h("input", { type: "hidden", class: "rating_hidden_input", name: name, value: "" }), [1, 2, 3, 4, 5].map(star => index.h("button", { type: "submit", class: `s-rating-btn-star s-rating-btn-star-` + size, "data-star": star }, index.h("i", { class: "sicon-star2" })))));
|
|
171
|
+
}
|
|
172
|
+
// render
|
|
173
|
+
render() {
|
|
174
|
+
return (index.h(index.Host, null, index.h("salla-modal", { isLoading: true, width: "md", ref: modal => this.modal = modal }, this.order
|
|
175
|
+
? [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" }))
|
|
177
|
+
: '', 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" })))))
|
|
179
|
+
: '', 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
|
|
181
|
+
? 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
|
+
: 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
|
+
: '', 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'))),]
|
|
185
|
+
: '')));
|
|
186
|
+
}
|
|
187
|
+
componentDidRender() {
|
|
188
|
+
//todo:: know from where there is hidden attributes to the doms🤔
|
|
189
|
+
this.modal.querySelectorAll('[hidden]').forEach(el => el.removeAttribute('hidden'));
|
|
190
|
+
}
|
|
191
|
+
get host() { return index.getElement(this); }
|
|
192
|
+
};
|
|
193
|
+
SallaRating.style = sallaRatingCss;
|
|
194
|
+
|
|
195
|
+
exports.salla_rating = SallaRating;
|