@salla.sa/twilight-components 1.0.19 → 1.0.20
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/{esm → twilight-components}/Helper-d07ebbc7.js +0 -0
- package/dist/twilight-components/app-globals-0f993ce5.js +3 -0
- package/dist/twilight-components/css-shim-a64b8820.js +4 -0
- package/dist/twilight-components/dom-d08ba8aa.js +73 -0
- package/dist/twilight-components/index-799f93d3.js +3010 -0
- package/dist/twilight-components/index-9c087700.js +3010 -0
- package/dist/twilight-components/index.esm.js +4 -1
- package/dist/{esm → twilight-components}/salla-branches.entry.js +1 -1
- package/dist/twilight-components/salla-button.entry.js +75 -0
- package/dist/{esm → twilight-components}/salla-localization.entry.js +1 -1
- package/dist/{esm/salla-login-38586400.js → twilight-components/salla-login-57b18c2c.js} +1 -1
- package/dist/{cjs/salla-login-008cc893.js → twilight-components/salla-login-663f8d42.js} +13 -15
- package/dist/twilight-components/salla-login.entry.js +3 -0
- package/dist/twilight-components/salla-modal.entry.js +113 -0
- package/dist/twilight-components/salla-offer.entry.js +75 -0
- package/dist/{esm → twilight-components}/salla-product-availability.entry.js +1 -1
- package/dist/{esm → twilight-components}/salla-rating.entry.js +30 -69
- package/dist/{esm/salla-search-ca856aab.js → twilight-components/salla-search-25757808.js} +1 -1
- package/dist/{cjs/salla-search-c7aad59a.js → twilight-components/salla-search-30fec1e8.js} +15 -17
- package/dist/twilight-components/salla-search.entry.js +3 -0
- package/dist/{esm/salla-button_5.entry.js → twilight-components/salla-tel-input.entry.js} +33 -294
- package/dist/twilight-components/salla-verify.entry.js +114 -0
- package/dist/twilight-components/shadow-css-bc14d9fd.js +389 -0
- package/dist/twilight-components/twilight-components.css +3 -1
- package/dist/twilight-components/twilight-components.esm.js +125 -1
- package/dist/types/components/salla-offer/offer-schema.d.ts +47 -0
- package/dist/types/components/salla-offer/salla-offer.d.ts +13 -48
- package/dist/types/components/salla-rating/order-feedback-response.d.ts +62 -0
- package/dist/types/components/salla-rating/salla-rating.d.ts +15 -18
- package/dist/types/components.d.ts +2 -10
- package/package.json +1 -1
- package/dist/cjs/Helper-fcea994c.js +0 -23
- package/dist/cjs/index-4b8b3ffe.js +0 -1696
- package/dist/cjs/index.cjs.js +0 -13
- package/dist/cjs/loader.cjs.js +0 -21
- package/dist/cjs/salla-branches.cjs.entry.js +0 -92
- package/dist/cjs/salla-button_5.cjs.entry.js +0 -1686
- package/dist/cjs/salla-localization.cjs.entry.js +0 -82
- package/dist/cjs/salla-offer.cjs.entry.js +0 -50
- package/dist/cjs/salla-product-availability.cjs.entry.js +0 -75
- package/dist/cjs/salla-rating.cjs.entry.js +0 -300
- package/dist/cjs/salla-search.cjs.entry.js +0 -11
- package/dist/cjs/twilight-components.cjs.js +0 -19
- package/dist/collection/Helpers/Helper.js +0 -19
- package/dist/collection/collection-manifest.json +0 -22
- package/dist/collection/components/generate-summary.js +0 -35
- package/dist/collection/components/salla-branches/salla-branches.css +0 -12
- package/dist/collection/components/salla-branches/salla-branches.js +0 -233
- package/dist/collection/components/salla-button/salla-button.css +0 -3
- package/dist/collection/components/salla-button/salla-button.js +0 -246
- package/dist/collection/components/salla-localization/salla-localization.js +0 -208
- package/dist/collection/components/salla-login/salla-login.css +0 -3
- package/dist/collection/components/salla-login/salla-login.js +0 -378
- package/dist/collection/components/salla-modal/salla-modal.js +0 -459
- package/dist/collection/components/salla-offer/salla-offer.js +0 -81
- package/dist/collection/components/salla-product-availability/salla-product-availability.js +0 -331
- package/dist/collection/components/salla-rating/salla-rating.css +0 -7
- package/dist/collection/components/salla-rating/salla-rating.js +0 -483
- package/dist/collection/components/salla-search/salla-search.js +0 -132
- package/dist/collection/components/salla-tel-input/salla-tel-input.js +0 -14
- package/dist/collection/components/salla-verify/salla-verify.js +0 -273
- package/dist/collection/index.js +0 -2
- package/dist/collection/interfaces/colors.js +0 -1
- package/dist/collection/interfaces/index.js +0 -2
- package/dist/collection/interfaces/ratio.js +0 -1
- package/dist/collection/plugins/tailwind-theme/generator.js +0 -62
- package/dist/collection/plugins/tailwind-theme/index.js +0 -26
- package/dist/esm/index-092659c7.js +0 -1668
- package/dist/esm/index.js +0 -4
- package/dist/esm/loader.js +0 -17
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/css-shim.js +0 -1
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/esm/salla-offer.entry.js +0 -46
- package/dist/esm/salla-search.entry.js +0 -3
- package/dist/esm/twilight-components.js +0 -17
- package/dist/index.cjs.js +0 -1
- package/dist/index.js +0 -1
- package/dist/twilight-components/p-03d0ec44.entry.js +0 -1
- package/dist/twilight-components/p-13a55257.entry.js +0 -1
- package/dist/twilight-components/p-160062c6.js +0 -1
- package/dist/twilight-components/p-47f17d3b.js +0 -1
- package/dist/twilight-components/p-5307c7b5.entry.js +0 -1
- package/dist/twilight-components/p-6a1f43c6.entry.js +0 -1
- package/dist/twilight-components/p-7088e517.entry.js +0 -1
- package/dist/twilight-components/p-924e3c88.js +0 -1
- package/dist/twilight-components/p-e8965b01.js +0 -1
- package/dist/twilight-components/p-ecb1b6cc.entry.js +0 -1
- package/dist/twilight-components/p-f11b401a.entry.js +0 -1
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const index = require('./index-4b8b3ffe.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;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const index = require('./index-4b8b3ffe.js');
|
|
6
|
-
|
|
7
|
-
const SallaOffer = class {
|
|
8
|
-
constructor(hostRef) {
|
|
9
|
-
index.registerInstance(this, hostRef);
|
|
10
|
-
this.offer = null;
|
|
11
|
-
salla.offer.event.onExisted(data => {
|
|
12
|
-
//TODO:: use the best, should we hide the offer by product Id or Offer id🤔
|
|
13
|
-
if (salla.localStore.get('remember-offer-' + data.offer.offer_id)) {
|
|
14
|
-
salla.log('User selected to don\'t show this offer again.');
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
this.show(data.product_id);
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
async show(productId) {
|
|
21
|
-
this.modal.show()
|
|
22
|
-
.then(() => salla.api.offer.details(productId))
|
|
23
|
-
//TODO:: make sure there is only one offer
|
|
24
|
-
.then(response => this.offer = response.data[0])
|
|
25
|
-
.then(() => console.log(this.offer));
|
|
26
|
-
}
|
|
27
|
-
rememberMe(event) {
|
|
28
|
-
salla.localStore.set('remember-offer-' + this.offer.id, event.target.checked);
|
|
29
|
-
}
|
|
30
|
-
render() {
|
|
31
|
-
var _a, _b;
|
|
32
|
-
return index.h("salla-modal", { ref: modal => this.modal = modal, "is-loading": this.offer === null }, this.offer !== null
|
|
33
|
-
? [index.h("div", { class: "s-offer-header" }, index.h("b", { class: "s-offer-title" }, this.offer.name), index.h("h3", { class: "s-offer-subtitle" }, this.offer.message)),
|
|
34
|
-
index.h("div", { class: "s-offer-body" }, ((_a = this.offer.get.categories) === null || _a === void 0 ? void 0 : _a.length) > 0
|
|
35
|
-
? this.offer.get.categories.map(category => index.h("a", { href: category.urls.customer, class: "s-offer-badge" }, index.h("i", { class: "s-offer-badge-icon sicon-tag" }), index.h("span", { class: "s-offer-badge-text" }, category.name)))
|
|
36
|
-
: (_b = this.offer.get.products) === null || _b === void 0 ? void 0 : _b.map(product => index.h("div", { class: "s-offer-product" }, "- ", product.name))),
|
|
37
|
-
index.h("div", { class: "s-offer-footer" }, this.offer.expiry_date ?
|
|
38
|
-
index.h("p", { class: "s-offer-expiry" }, salla.lang.get('pages.products.offer_expires_in'), " ", this.offer.expiry_date)
|
|
39
|
-
: '', 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'))),
|
|
40
|
-
] : '');
|
|
41
|
-
}
|
|
42
|
-
componentDidRender() {
|
|
43
|
-
//todo:: now from where there is hidden attributes to the doms🤔
|
|
44
|
-
//todo:: add animation
|
|
45
|
-
this.modal.querySelectorAll('[hidden]').forEach(el => el.removeAttribute('hidden'));
|
|
46
|
-
}
|
|
47
|
-
get host() { return index.getElement(this); }
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
exports.salla_offer = SallaOffer;
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const index = require('./index-4b8b3ffe.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;
|
|
@@ -1,300 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const index = require('./index-4b8b3ffe.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.order = {
|
|
14
|
-
shipping: { id: 5622 },
|
|
15
|
-
products: [
|
|
16
|
-
{
|
|
17
|
-
"title": "ميكروفون عالى الجودة",
|
|
18
|
-
"image": "https://salla-dev.s3.eu-central-1.amazonaws.com/Mvyk/pMdEEyMVpZFj4L1Hrdm2g48AuiSx0TrKULBiOnPo.jpg",
|
|
19
|
-
"price": "10,978.00 ر.س",
|
|
20
|
-
"qty": "2",
|
|
21
|
-
"totalBefore": "1120 ر.س",
|
|
22
|
-
"discount": "-5%",
|
|
23
|
-
"total": "1064 ر.س",
|
|
24
|
-
"id": "2314513454",
|
|
25
|
-
"getOptimusRouteKey": "7351233357"
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
"title": "ميكروفون عالى الجودة",
|
|
29
|
-
"image": "https://salla-dev.s3.eu-central-1.amazonaws.com/Mvyk/pMdEEyMVpZFj4L1Hrdm2g48AuiSx0TrKULBiOnPo.jpg",
|
|
30
|
-
"price": "10,978.00 ر.س",
|
|
31
|
-
"qty": "2",
|
|
32
|
-
"totalBefore": "1120 ر.س",
|
|
33
|
-
"discount": "-5%",
|
|
34
|
-
"total": "1064 ر.س",
|
|
35
|
-
"id": "2314513454",
|
|
36
|
-
"getOptimusRouteKey": "7351233357"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"title": "ساعة ذكية بنظام اندرويد",
|
|
40
|
-
"image": "https://salla-dev.s3.eu-central-1.amazonaws.com/Mvyk/T4kTqYNuPAZmPMLw1bx92RnjVMZyFszVXOUZQsFJ.jpg",
|
|
41
|
-
"price": "10,978.00 ر.س",
|
|
42
|
-
"qty": "2",
|
|
43
|
-
"totalBefore": "1120 ر.س",
|
|
44
|
-
"discount": "-5%",
|
|
45
|
-
"total": "1064 ر.س",
|
|
46
|
-
"id": "679822376",
|
|
47
|
-
"getOptimusRouteKey": "73233357"
|
|
48
|
-
}
|
|
49
|
-
],
|
|
50
|
-
storeLogo: "https://salla-dev.s3.eu-central-1.amazonaws.com/Mvyk/X3NKcY7nhaFQlR7kBBHvfDpMY48cerunKrmDA1gi.png",
|
|
51
|
-
shippingLogo: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcScPt4R6KaKDldrXb-9pUljFwL3m6A72BhN6p1qZJKprwC6VbCWC_8ASZgiJAoL_l7DepM&usqp=CAU"
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Set to true to display store rating step
|
|
55
|
-
*/
|
|
56
|
-
this.isStoreRating = false;
|
|
57
|
-
/**
|
|
58
|
-
* Set to true to display products rating step
|
|
59
|
-
*/
|
|
60
|
-
this.isProductsRating = false;
|
|
61
|
-
/**
|
|
62
|
-
* Set to true to display shipping rating step
|
|
63
|
-
*/
|
|
64
|
-
this.isShippingRating = false;
|
|
65
|
-
this.ratingChain = Promise.resolve();
|
|
66
|
-
this.stepsCount = 0;
|
|
67
|
-
Helper.Helper.setHost(this.host);
|
|
68
|
-
}
|
|
69
|
-
async show() {
|
|
70
|
-
return this.modal.show();
|
|
71
|
-
}
|
|
72
|
-
async hide() {
|
|
73
|
-
return this.modal.hide();
|
|
74
|
-
}
|
|
75
|
-
componentWillLoad() {
|
|
76
|
-
this.stepsCount = [this.isStoreRating, this.isProductsRating, this.isShippingRating].filter(item => item).length;
|
|
77
|
-
// this.getData();
|
|
78
|
-
}
|
|
79
|
-
componentDidRender() {
|
|
80
|
-
this.show();
|
|
81
|
-
this.initiateRating();
|
|
82
|
-
}
|
|
83
|
-
initiateRating() {
|
|
84
|
-
this.handleWizard();
|
|
85
|
-
this.handleSubmitRating();
|
|
86
|
-
this.starsRating();
|
|
87
|
-
this.highlightSelectedStars();
|
|
88
|
-
}
|
|
89
|
-
// getdata
|
|
90
|
-
// private getData() {
|
|
91
|
-
// salla.api.order.endpointsMethods.details = 'get'
|
|
92
|
-
// salla.order.api.details(salla.config.page.id).then(data => console.log(''));
|
|
93
|
-
// }
|
|
94
|
-
// handle wizard
|
|
95
|
-
handleWizard() {
|
|
96
|
-
let index = 0, steps = this.host.querySelectorAll(".s-rating-step"), dots = this.host.querySelectorAll(".s-rating-step-dot"), nextBtnText = this.host.querySelector('#next-btn .s-button-text');
|
|
97
|
-
this.setModalHeight(steps[0]);
|
|
98
|
-
this.showActiveStep(steps, dots, index, nextBtnText);
|
|
99
|
-
Helper.Helper.onClick("#prev-btn", () => {
|
|
100
|
-
index > 0 && index--;
|
|
101
|
-
this.showActiveStep(steps, dots, index, nextBtnText);
|
|
102
|
-
index == 0 && Helper.Helper.toggle('#prev-btn', 's-rating-unvisiable', 'block', () => true);
|
|
103
|
-
});
|
|
104
|
-
Helper.Helper.onClick("#next-btn", () => {
|
|
105
|
-
this.ratingValidation();
|
|
106
|
-
if (index == this.stepsCount - 1) {
|
|
107
|
-
salla.event.dispatch("submit::order-rating");
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
index < this.stepsCount - 1 && index++;
|
|
111
|
-
this.showActiveStep(steps, dots, index, nextBtnText);
|
|
112
|
-
Helper.Helper.toggle('#prev-btn', 'block', 's-rating-unvisiable', () => true);
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
showActiveStep(steps, dots, index, nextBtnText) {
|
|
117
|
-
var _a;
|
|
118
|
-
// Active step
|
|
119
|
-
Helper.Helper.toggle('.s-rating-step', 's-rating-hidden', 's-rating-active', () => true);
|
|
120
|
-
Helper.Helper.toggleElement(steps[index], 's-rating-unactive', 's-rating-hidden', () => true);
|
|
121
|
-
setTimeout(() => Helper.Helper.toggleElement(steps[index], 's-rating-active', 's-rating-unactive', () => true), 200);
|
|
122
|
-
// Hanle dots
|
|
123
|
-
Helper.Helper.toggle('.s-rating-step-dot', 's-rating-bg-gray', 's-rating-bg-primary', () => true);
|
|
124
|
-
this.stepsCount > 1 && Helper.Helper.toggleElement(dots[index], 's-rating-bg-primary', 's-rating-bg-gray', () => true);
|
|
125
|
-
// Btn text
|
|
126
|
-
nextBtnText.innerHTML = ((_a = steps[index + 1]) === null || _a === void 0 ? void 0 : _a.dataset.stepName) || salla.lang.get('pages.rating.send_ratings');
|
|
127
|
-
this.setModalHeight(steps[index]);
|
|
128
|
-
}
|
|
129
|
-
setModalHeight(current) {
|
|
130
|
-
const wrapper = this.host.querySelector('.s-rating-wrapper');
|
|
131
|
-
setTimeout(() => wrapper === null || wrapper === void 0 ? void 0 : wrapper.setAttribute('style', 'height:' + (current === null || current === void 0 ? void 0 : current.scrollHeight) + 'px'));
|
|
132
|
-
}
|
|
133
|
-
// Listen to submit::order-rating event used in handleWizard()
|
|
134
|
-
handleSubmitRating() {
|
|
135
|
-
salla.event.on('submit::order-rating', () => this.sendRating().then(() => {
|
|
136
|
-
// Handle timer
|
|
137
|
-
let thankYouView = this.host.querySelector('.s-rating-thanks'), seconds = 10;
|
|
138
|
-
let timeToClose = setInterval(() => {
|
|
139
|
-
seconds--;
|
|
140
|
-
this.host.querySelector('.s-rating-thanks-time').innerHTML = `00:0${seconds}`;
|
|
141
|
-
if (seconds == 0) {
|
|
142
|
-
this.hide();
|
|
143
|
-
clearInterval(timeToClose);
|
|
144
|
-
}
|
|
145
|
-
}, 1000);
|
|
146
|
-
// Hide steps and show thanks msg
|
|
147
|
-
Helper.Helper.toggle('.s-rating-step', 's-rating-hidden', 's-rating-active', () => true);
|
|
148
|
-
this.host.querySelector('.s-rating-footer').classList.add('s-rating-unvisiable');
|
|
149
|
-
Helper.Helper.toggleElement(thankYouView, 's-rating-unactive', 's-rating-hidden', () => true);
|
|
150
|
-
setTimeout(() => Helper.Helper.toggleElement(thankYouView, 's-rating-active', 's-rating-unactive', () => true), 200);
|
|
151
|
-
this.setModalHeight(thankYouView);
|
|
152
|
-
}));
|
|
153
|
-
}
|
|
154
|
-
// handle star rating
|
|
155
|
-
starsRating() {
|
|
156
|
-
let selectedClasses = ['selected'];
|
|
157
|
-
// Listen for form submissions
|
|
158
|
-
salla.document.event.onSubmit('.s-rating-stars-element', function (event) {
|
|
159
|
-
// Prevent form from submitting
|
|
160
|
-
event.preventDefault();
|
|
161
|
-
// Get the selected star - activeElement is not supported in safari
|
|
162
|
-
var activeStars = event.target.querySelectorAll('.s-rating-btn-star.hovered');
|
|
163
|
-
var selected = activeStars[activeStars.length - 1];
|
|
164
|
-
if (!selected)
|
|
165
|
-
return;
|
|
166
|
-
var selectedIndex = parseInt(selected.dataset.star, 10);
|
|
167
|
-
event.target.querySelector('.rating_hidden_input').value = selectedIndex;
|
|
168
|
-
// Get all stars in this form (only search in the form, not the whole document)
|
|
169
|
-
// Loop through each star, and add or remove the `.selected` class to toggle highlighting
|
|
170
|
-
event.target
|
|
171
|
-
.querySelectorAll('.s-rating-btn-star')
|
|
172
|
-
.forEach(function (star, index) {
|
|
173
|
-
if (index < selectedIndex) {
|
|
174
|
-
// Selected star or before it, Add highlighting
|
|
175
|
-
star.classList.add(...selectedClasses);
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
// After selected star, Remove highlight
|
|
179
|
-
star.classList.remove(...selectedClasses);
|
|
180
|
-
});
|
|
181
|
-
// Remove aria-pressed from any previously selected star
|
|
182
|
-
var previousRating = event.target.querySelector('.s-rating-btn-star[aria-pressed="true"]');
|
|
183
|
-
if (previousRating) {
|
|
184
|
-
previousRating.removeAttribute('aria-pressed');
|
|
185
|
-
}
|
|
186
|
-
// Add aria-pressed role to the selected button
|
|
187
|
-
selected.setAttribute('aria-pressed', true);
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
highlightSelectedStars() {
|
|
191
|
-
let hover = ['hovered'];
|
|
192
|
-
Helper.Helper.all('.s-rating-stars-element', el => {
|
|
193
|
-
let starElements = el.querySelectorAll('.s-rating-btn-star');
|
|
194
|
-
// remove hovered state from stars ---
|
|
195
|
-
el.addEventListener('mouseout', () => starElements.forEach(star => star.classList.remove(...hover)));
|
|
196
|
-
starElements.forEach((starElement, index) => {
|
|
197
|
-
starElement.addEventListener('mouseover', () => {
|
|
198
|
-
starElement.classList.add(...hover);
|
|
199
|
-
if (index <= 1) {
|
|
200
|
-
starElement.previousElementSibling.tagName === 'BUTTON' ? starElement.previousElementSibling.classList.add(...hover) : null;
|
|
201
|
-
}
|
|
202
|
-
else {
|
|
203
|
-
for (let i = 0; i < index; i++) {
|
|
204
|
-
starElements[i].classList.add(...hover);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
starElement.addEventListener('mouseout', () => {
|
|
209
|
-
starElement.classList.contains(...hover) ? starElement.classList.remove(...hover) : null;
|
|
210
|
-
});
|
|
211
|
-
});
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
// send feedback rating and validation
|
|
215
|
-
sendRating() {
|
|
216
|
-
Helper.Helper.all('.s-rating-step', ratingStep => {
|
|
217
|
-
let type = ratingStep.dataset.type;
|
|
218
|
-
let formsData = [];
|
|
219
|
-
ratingStep.querySelectorAll('.rating-outer-form')
|
|
220
|
-
.forEach((form) => {
|
|
221
|
-
let formData = {};
|
|
222
|
-
form.querySelectorAll('[name]')
|
|
223
|
-
.forEach(function (input) {
|
|
224
|
-
let inputData = salla.helpers.inputData(input.name, input.value, formData);
|
|
225
|
-
formData[inputData.name] = inputData.value;
|
|
226
|
-
});
|
|
227
|
-
formsData = [];
|
|
228
|
-
formsData.push(formData);
|
|
229
|
-
this.sendFeedback(type, formsData);
|
|
230
|
-
});
|
|
231
|
-
});
|
|
232
|
-
return this.ratingChain;
|
|
233
|
-
}
|
|
234
|
-
sendFeedback(type, formsData) {
|
|
235
|
-
if (!formsData || formsData.length == 0) {
|
|
236
|
-
return;
|
|
237
|
-
}
|
|
238
|
-
this.nextBtn.load();
|
|
239
|
-
salla.config.canLeave = false;
|
|
240
|
-
this.ratingChain = salla.feedback.api[type](formsData[0])
|
|
241
|
-
.then(function () {
|
|
242
|
-
salla.config.canLeave = true;
|
|
243
|
-
}).catch(() => salla.config.canLeave = true);
|
|
244
|
-
}
|
|
245
|
-
ratingValidation() {
|
|
246
|
-
let errorMsg = '';
|
|
247
|
-
document.querySelectorAll('.s-rating-step.s-rating-active')
|
|
248
|
-
.forEach((ratingSection) => {
|
|
249
|
-
ratingSection.querySelectorAll('.rating-outer-form')
|
|
250
|
-
.forEach((rating) => {
|
|
251
|
-
let ratingInput = rating.querySelector('.rating_hidden_input');
|
|
252
|
-
let commentInput = rating.querySelector('.s-rating-comment');
|
|
253
|
-
let validationMessage = rating.querySelector('.s-rating-validation-msg');
|
|
254
|
-
if (ratingInput.value && commentInput.value && commentInput.value.length > 3) {
|
|
255
|
-
commentInput.classList.remove('s-rating-has-error');
|
|
256
|
-
validationMessage.innerHTML = '';
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
else if (commentInput.value && commentInput.value.length > 3) {
|
|
260
|
-
commentInput.classList.remove('s-rating-has-error');
|
|
261
|
-
}
|
|
262
|
-
else {
|
|
263
|
-
commentInput.classList.add('s-rating-has-error');
|
|
264
|
-
}
|
|
265
|
-
errorMsg = ratingInput.value
|
|
266
|
-
? (salla.lang.get('common.errors.not_less_than_chars', { chars: 4 }) + ' ' + commentInput.getAttribute('placeholder'))
|
|
267
|
-
: (rating.dataset.starsError || salla.lang.get('pages.rating.rate_store_stars'));
|
|
268
|
-
validationMessage.innerHTML = errorMsg;
|
|
269
|
-
});
|
|
270
|
-
});
|
|
271
|
-
//Fire error to prevent going to next step
|
|
272
|
-
if (errorMsg) {
|
|
273
|
-
throw new Error(errorMsg);
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
// render
|
|
277
|
-
render() {
|
|
278
|
-
return (index.h(index.Host, null, index.h("salla-modal", { class: "hidden", "modal-width": "w-[800px]", ref: modal => this.modal = modal, title: salla.lang.get('pages.rating.rate_order') + ' <span class="unicode">(#' + this.orderId + ')</span>' }, index.h("div", { class: "s-rating-wrapper " }, this.isStoreRating && this.renderStoreRating(), this.isProductsRating && this.renderProductsRating(), this.isShippingRating && this.renderShippingRating(), this.renderThanksView()), index.h("div", { class: "s-rating-footer" }, index.h("button", { id: "prev-btn", class: "s-rating-btn s-rating-unvisiable" }, salla.lang.get('pages.order.rating_prev')), this.stepsCount > 1 ?
|
|
279
|
-
index.h("ul", { class: "s-rating-dots" }, [0, 1, 2].slice(0, this.stepsCount).map(index$1 => index.h("li", { class: `${index$1 == 0 ? 's-rating-bg-primary' : 's-rating-bg-gray'} s-rating-step-dot` }))) : '', index.h("salla-button", { id: "next-btn", ref: nextBtn => this.nextBtn = nextBtn }, "\u0627\u0644\u062A\u0627\u0644\u064A")))));
|
|
280
|
-
}
|
|
281
|
-
renderStoreRating() {
|
|
282
|
-
return (index.h("section", { class: "s-rating-step", "data-type": "store", "data-step-name": salla.lang.get('pages.rating.rate') + ' ' + salla.lang.get('pages.rating.store') }, index.h("div", { class: "rating-outer-form s-rating-step-wrap", "data-stars-error": salla.lang.get('pages.rating.rate_store_stars') }, index.h("input", { type: "hidden", name: "order_id", value: this.orderId }), index.h("input", { type: "hidden", name: "type", value: "store" }), index.h("div", { class: "s-rating-rounded-icon" }, index.h("img", { src: this.order.storeLogo, 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.getStarsRating('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" }))));
|
|
283
|
-
}
|
|
284
|
-
renderShippingRating() {
|
|
285
|
-
return (index.h("section", { class: "s-rating-step", "data-type": "shipping", "data-step-name": salla.lang.get('pages.rating.rate') + ' ' + salla.lang.get('pages.rating.shipping') }, index.h("div", { class: "rating-outer-form s-rating-step-wrap", "data-stars-error": salla.lang.get('pages.rating.rate_shipping_stars') }, index.h("input", { type: "hidden", name: "order_id", value: this.orderId }), index.h("input", { type: "hidden", name: "shipping_company_id", value: this.order.shipping.id }), index.h("input", { type: "hidden", name: "type", value: "shipping" }), index.h("div", { class: "s-rating-rounded-icon" }, index.h("img", { src: this.order.shippingLogo, alt: "company name", class: "s-rating-shipping-logo" })), index.h("h2", { class: "s-rating-title" }, " ", salla.lang.get('pages.rating.rate_shipping'), " \u0627\u0631\u0627\u0645\u0643\u0633"), index.h("div", { class: "s-rating-stars-company" }, " ", this.getStarsRating('large')), index.h("textarea", { id: "shippingReview", name: "comment", class: "s-rating-comment", placeholder: salla.lang.get('pages.rating.write_shipping_rate') }), index.h("small", { class: "s-rating-validation-msg" }))));
|
|
286
|
-
}
|
|
287
|
-
renderProductsRating() {
|
|
288
|
-
return (index.h("section", { class: "s-rating-step", "data-type": "product", "data-step-name": salla.lang.get('pages.rating.rate') + ' ' + salla.lang.get('pages.rating.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.order.rate_product_stars') }, index.h("img", { src: item.image, alt: item.title, class: "s-rating-product-img" }), index.h("div", { class: "s-rating-product-details" }, index.h("h3", { class: "s-rating-product-title" }, " ", item.title), index.h("div", { class: "s-rating-stars-product" }, " ", this.getStarsRating('small')), index.h("input", { type: "hidden", name: "order_id", value: this.orderId }), index.h("input", { type: "hidden", name: `products[${index$1}][product_id]`, value: item.getOptimusRouteKey }), index.h("input", { type: "hidden", name: "type", value: "products" }), index.h("textarea", { "data-product-id": item.id, name: `products[${index$1}][comment]`, id: `productReview_${item.id}`, class: "s-rating-comment", placeholder: salla.lang.get('pages.rating.write_product_rate') }), index.h("small", { class: "s-rating-validation-msg" }))))));
|
|
289
|
-
}
|
|
290
|
-
renderThanksView() {
|
|
291
|
-
return (index.h("div", { class: "s-rating-thanks s-rating-hidden" }, index.h("span", { class: "s-rating-thanks-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.thanksMsg }), index.h("a", { href: "#!", onClick: () => this.hide(), class: "s-rating-thanks-btn" }, "\u0639\u0648\u062F\u0629 \u0625\u0644\u064A \u062A\u0641\u0627\u0635\u064A\u0644 \u0627\u0644\u0637\u0644\u0628"), index.h("time", { class: "s-rating-thanks-time" })));
|
|
292
|
-
}
|
|
293
|
-
getStarsRating(size) {
|
|
294
|
-
return (index.h("form", { class: "s-rating-stars-element" }, index.h("input", { type: "hidden", class: "rating_hidden_input", name: "rating", 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" })))));
|
|
295
|
-
}
|
|
296
|
-
get host() { return index.getElement(this); }
|
|
297
|
-
};
|
|
298
|
-
SallaRating.style = sallaRatingCss;
|
|
299
|
-
|
|
300
|
-
exports.salla_rating = SallaRating;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const sallaSearch = require('./salla-search-c7aad59a.js');
|
|
6
|
-
require('./index-4b8b3ffe.js');
|
|
7
|
-
require('./Helper-fcea994c.js');
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
exports.salla_search = sallaSearch.SallaSearch;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const index = require('./index-4b8b3ffe.js');
|
|
4
|
-
|
|
5
|
-
/*
|
|
6
|
-
Stencil Client Patch Browser v2.8.1 | MIT Licensed | https://stenciljs.com
|
|
7
|
-
*/
|
|
8
|
-
const patchBrowser = () => {
|
|
9
|
-
const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('twilight-components.cjs.js', document.baseURI).href));
|
|
10
|
-
const opts = {};
|
|
11
|
-
if (importMeta !== '') {
|
|
12
|
-
opts.resourcesUrl = new URL('.', importMeta).href;
|
|
13
|
-
}
|
|
14
|
-
return index.promiseResolve(opts);
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
patchBrowser().then(options => {
|
|
18
|
-
return index.bootstrapLazy([["salla-button_5.cjs",[[0,"salla-login",{"isLoginByMail":[4,"is-login-by-mail"],"loginTypeTitle":[1,"login-type-title"],"loginText":[1,"login-text"],"smsLabel":[1,"sms-label"],"mobileLabel":[1,"mobile-label"],"emailLabel":[1,"email-label"],"enterText":[1,"enter-text"],"bySMSText":[1,"by-s-m-s-text"],"byEmailText":[1,"by-email-text"],"backText":[1,"back-text"],"show":[64]},[[0,"verified","onVerified"],[0,"backClicked","onbackClicked"]]],[0,"salla-verify",{"withoutModal":[4,"without-modal"],"url":[1],"by":[1],"backText":[1,"back-text"],"autoReload":[4,"auto-reload"],"getCode":[64],"show":[64]}],[1,"salla-tel-input"],[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],"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],"show":[64],"hide":[64]}]]],["salla-localization.cjs",[[4,"salla-localization",{"languagesTitle":[1,"languages-title"],"currenciesTitle":[1,"currencies-title"],"ok":[1],"show":[64],"hide":[64],"submit":[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",{"orderId":[2,"order-id"],"thanksMsg":[1,"thanks-msg"],"isStoreRating":[4,"is-store-rating"],"isProductsRating":[4,"is-products-rating"],"isShippingRating":[4,"is-shipping-rating"],"show":[64],"hide":[64]}]]],["salla-offer.cjs",[[0,"salla-offer",{"offer":[32],"show":[64]}]]],["salla-search.cjs",[[0,"salla-search",{"placeholder":[1],"noResultsText":[1,"no-results-text"],"results":[32]},[[0,"modalClosed","onModalClose"]]]]]], options);
|
|
19
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
class Helper extends salla.AppHelpers {
|
|
2
|
-
setHost(host) {
|
|
3
|
-
this.host = host;
|
|
4
|
-
}
|
|
5
|
-
getElement(selector) {
|
|
6
|
-
return this.host.querySelector(selector);
|
|
7
|
-
}
|
|
8
|
-
getAttribute(selector, attribute) {
|
|
9
|
-
var _a;
|
|
10
|
-
return (_a = this.getElement(selector)) === null || _a === void 0 ? void 0 : _a.getAttribute(attribute);
|
|
11
|
-
}
|
|
12
|
-
val(selector) {
|
|
13
|
-
return this.getAttribute(selector, 'value');
|
|
14
|
-
}
|
|
15
|
-
isUser() {
|
|
16
|
-
return salla.config.get('user.type') === 'user';
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
export default new Helper;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"entries": [
|
|
3
|
-
"./components/salla-login/salla-login.js",
|
|
4
|
-
"./components/salla-search/salla-search.js",
|
|
5
|
-
"./components/salla-branches/salla-branches.js",
|
|
6
|
-
"./components/salla-button/salla-button.js",
|
|
7
|
-
"./components/salla-localization/salla-localization.js",
|
|
8
|
-
"./components/salla-modal/salla-modal.js",
|
|
9
|
-
"./components/salla-offer/salla-offer.js",
|
|
10
|
-
"./components/salla-product-availability/salla-product-availability.js",
|
|
11
|
-
"./components/salla-rating/salla-rating.js",
|
|
12
|
-
"./components/salla-tel-input/salla-tel-input.js",
|
|
13
|
-
"./components/salla-verify/salla-verify.js"
|
|
14
|
-
],
|
|
15
|
-
"compiler": {
|
|
16
|
-
"name": "@stencil/core",
|
|
17
|
-
"version": "2.8.1",
|
|
18
|
-
"typescriptVersion": "4.2.3"
|
|
19
|
-
},
|
|
20
|
-
"collections": [],
|
|
21
|
-
"bundles": []
|
|
22
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
var fs = require('fs'), path = require('path'), util = require('util');
|
|
2
|
-
|
|
3
|
-
var dirToJSON = function (dir, done) {
|
|
4
|
-
var results = [];
|
|
5
|
-
|
|
6
|
-
function recWalk(d, res) {
|
|
7
|
-
var list = fs.readdirSync(d);
|
|
8
|
-
list.forEach((name) => {
|
|
9
|
-
var file = path.resolve(d, name);
|
|
10
|
-
var stat = fs.statSync(file);
|
|
11
|
-
if (stat && stat.isDirectory()) {
|
|
12
|
-
var title;
|
|
13
|
-
if (name) {
|
|
14
|
-
title = 'salla-' + name
|
|
15
|
-
}
|
|
16
|
-
res.push({ title: title, file: name + '/readme.md' });
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
try {
|
|
22
|
-
recWalk(dir, results);
|
|
23
|
-
done(null, results);
|
|
24
|
-
} catch (err) {
|
|
25
|
-
done(err);
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
dirToJSON("src/components", function (err, results) {
|
|
30
|
-
if (err) console.log(err);
|
|
31
|
-
else fs.writeFile('src/components/summary.json', JSON.stringify(results), 'utf8', function (err) {
|
|
32
|
-
if (err) throw err;
|
|
33
|
-
console.log('Saved!');
|
|
34
|
-
});
|
|
35
|
-
});
|