@salla.sa/twilight-components 1.0.14 → 1.0.15
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-8852feaa.js +23 -0
- package/dist/cjs/index-0b5b5867.js +1656 -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.cjs.entry.js +77 -0
- package/dist/cjs/salla-localization.cjs.entry.js +77 -0
- package/dist/cjs/salla-login-6a54572d.js +14 -0
- package/dist/cjs/salla-login_2.cjs.entry.js +97 -0
- package/dist/cjs/salla-product-availability.cjs.entry.js +75 -0
- package/dist/cjs/salla-rating.cjs.entry.js +303 -0
- package/dist/cjs/salla-search-311c7053.js +81 -0
- package/dist/cjs/salla-search.cjs.entry.js +11 -0
- package/dist/cjs/salla-verify.cjs.entry.js +96 -0
- package/dist/cjs/twilight-components.cjs.js +19 -0
- package/dist/collection/Helpers/Helper.js +19 -0
- package/dist/collection/collection-manifest.json +20 -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 +235 -0
- package/dist/collection/components/salla-button/salla-button.css +3 -0
- package/dist/collection/components/salla-button/salla-button.js +243 -0
- package/dist/collection/components/salla-localization/salla-localization.js +200 -0
- package/dist/collection/components/salla-login/salla-login.js +31 -0
- package/dist/collection/components/salla-modal/salla-modal.js +360 -0
- package/dist/collection/components/salla-product-availability/salla-product-availability.js +331 -0
- package/dist/collection/components/salla-rating/salla-rating.css +3 -0
- package/dist/collection/components/salla-rating/salla-rating.js +488 -0
- package/dist/collection/components/salla-search/salla-search.js +132 -0
- package/dist/collection/components/salla-verify/salla-verify.js +99 -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 +53 -0
- package/dist/collection/plugins/tailwind-theme/index.js +26 -0
- package/dist/{twilight-components → esm}/Helper-81ac9a8c.js +0 -0
- package/dist/esm/index-8b97d225.js +1628 -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/multi-warehouse.entry.js → esm/salla-branches.entry.js} +16 -17
- package/dist/{twilight-components → esm}/salla-button.entry.js +1 -1
- package/dist/{twilight-components → esm}/salla-localization.entry.js +1 -1
- package/dist/{twilight-components/salla-login-97e0a9ab.js → esm/salla-login-c9c9fa57.js} +1 -1
- package/dist/{twilight-components/salla-modal.entry.js → esm/salla-login_2.entry.js} +16 -9
- package/dist/{twilight-components → esm}/salla-product-availability.entry.js +1 -1
- package/dist/{twilight-components → esm}/salla-rating.entry.js +9 -5
- package/dist/esm/salla-search-add7bdb6.js +79 -0
- package/dist/esm/salla-search.entry.js +3 -0
- package/dist/{twilight-components → esm}/salla-verify.entry.js +1 -1
- 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 -3
- package/dist/twilight-components/p-010b8dfd.entry.js +1 -0
- package/dist/twilight-components/p-0ceecf63.js +1 -0
- package/dist/twilight-components/p-32d29245.entry.js +1 -0
- package/dist/twilight-components/p-50e70ad4.entry.js +1 -0
- package/dist/twilight-components/p-68c9f122.entry.js +1 -0
- package/dist/twilight-components/p-8126278e.entry.js +1 -0
- package/dist/twilight-components/p-9bc28e0c.js +1 -0
- package/dist/twilight-components/p-9d327a79.entry.js +1 -0
- package/dist/twilight-components/p-b05450bc.entry.js +1 -0
- package/dist/twilight-components/p-bd5da080.js +1 -0
- package/dist/twilight-components/p-cb1c59a2.js +1 -0
- package/dist/twilight-components/p-d584d0c7.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/{multi-warehouse/multi-warehouse.d.ts → salla-branches/salla-branches.d.ts} +1 -1
- package/dist/types/components/salla-modal/salla-modal.d.ts +3 -0
- package/dist/types/components/salla-rating/salla-rating.d.ts +2 -2
- package/dist/types/components/salla-search/salla-search.d.ts +20 -17
- package/dist/types/components.d.ts +19 -15
- 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-8cf58712.js +0 -3010
- package/dist/twilight-components/salla-login.entry.js +0 -2
- package/dist/twilight-components/salla-search-df1c9b54.js +0 -95
- package/dist/twilight-components/salla-search.entry.js +0 -2
- package/dist/twilight-components/shadow-css-bc14d9fd.js +0 -389
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
export { S as salla_login } from './salla-login-c9c9fa57.js';
|
|
2
|
+
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-8b97d225.js';
|
|
2
3
|
import { H as Helper } from './Helper-81ac9a8c.js';
|
|
3
4
|
|
|
4
5
|
const SallaModal = class {
|
|
@@ -6,17 +7,22 @@ const SallaModal = class {
|
|
|
6
7
|
registerInstance(this, hostRef);
|
|
7
8
|
this.ready = createEvent(this, "ready", 7);
|
|
8
9
|
this.close = createEvent(this, "close", 7);
|
|
10
|
+
var _a;
|
|
9
11
|
this.error = false;
|
|
10
12
|
this.success = false;
|
|
11
13
|
this.isClosable = true;
|
|
12
14
|
this.modalWidth = 'w-96'; //todo use friendly names
|
|
13
15
|
this.visible = false;
|
|
16
|
+
this.subTitleFirst = false;
|
|
14
17
|
this.subTitle = '';
|
|
15
18
|
this.icon = '';
|
|
19
|
+
this.imageIcon = '';
|
|
20
|
+
Helper.setHost(this.host);
|
|
16
21
|
salla.event.on('modal::open', btn => btn.dataset.target == this.host.id && this.show());
|
|
17
22
|
salla.event.on('modal::close', btn => btn.dataset.target == this.host.id && this.hide());
|
|
18
23
|
this.title = this.host.title;
|
|
19
24
|
this.host.removeAttribute('title');
|
|
25
|
+
(_a = Helper.getElement('[slot=body]')) === null || _a === void 0 ? void 0 : _a.classList.add('s-modal-body');
|
|
20
26
|
}
|
|
21
27
|
handleVisible(newValue) {
|
|
22
28
|
if (!newValue) {
|
|
@@ -41,11 +47,9 @@ const SallaModal = class {
|
|
|
41
47
|
return this.host;
|
|
42
48
|
}
|
|
43
49
|
toggleModal(isOpen) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
.toggleElement(this.
|
|
47
|
-
'opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95', //remove these classes
|
|
48
|
-
() => isOpen)
|
|
50
|
+
Helper.toggleElement(this.host.querySelector('.s-modal-body'), 's-modal-entering', 's-modal-leaving', () => isOpen)
|
|
51
|
+
.toggleElement(this.host.querySelector('[slot=body]'), 's-modal-entering', 's-modal-leaving', () => isOpen)
|
|
52
|
+
.toggleElement(this.overlay, 's-modal-entering', 's-modal-overlay-leaving', () => isOpen)
|
|
49
53
|
.toggleElement(document.body, 'modal-is-open', 'modal-is-closed', () => isOpen);
|
|
50
54
|
if (!isOpen) {
|
|
51
55
|
setTimeout(() => this.host.classList.add('hidden'), 350);
|
|
@@ -60,8 +64,7 @@ const SallaModal = class {
|
|
|
60
64
|
//todo:: pref for each modal
|
|
61
65
|
render() {
|
|
62
66
|
this.host.id = this.host.id || 'salla-modal';
|
|
63
|
-
return (h(Host, { class: 's-modal-container hidden', "aria-modal": "true", role: "dialog" }, h("div", { class: "s-modal-wrapper" }, h("div", { class: "s-modal-overlay", onClick: () => this.closeModal() }), h("span", { class: "s-modal-spacer" }, "\u200B"), h("div", { class: 's-modal-body ' + this.modalWidth }, h("div", { class: { 's-modal-header': true,
|
|
64
|
-
'text-center': this.icon != '' } }, this.isClosable ?
|
|
67
|
+
return (h(Host, { class: 's-modal-container hidden', "aria-modal": "true", role: "dialog" }, h("div", { class: "s-modal-wrapper" }, h("div", { class: "s-modal-overlay", ref: el => this.overlay = el, onClick: () => this.closeModal() }), h("span", { class: "s-modal-spacer" }, "\u200B"), h("slot", { name: "body" }, h("div", { class: 's-modal-body ' + this.modalWidth }, h("div", { class: { 's-modal-header': true, 's-modal-is-center': this.icon != '' || this.imageIcon != '' } }, this.isClosable ?
|
|
65
68
|
h("button", { class: "s-modal-close cursor-pointer", onClick: () => this.closeModal(), type: "button" }, h("span", { class: "sicon-cancel" }))
|
|
66
69
|
: '', this.error || this.success || this.icon
|
|
67
70
|
? h("div", { class: {
|
|
@@ -74,7 +77,11 @@ const SallaModal = class {
|
|
|
74
77
|
's-modal-text-error': this.error,
|
|
75
78
|
's-modal-text-success': this.success,
|
|
76
79
|
} }))
|
|
77
|
-
:
|
|
80
|
+
: this.imageIcon ?
|
|
81
|
+
h("img", { class: "s-modal-header-img", src: this.imageIcon })
|
|
82
|
+
: '', this.title || this.subTitle ?
|
|
83
|
+
h("div", { class: "s-modal-header-content" }, h("div", { class: { 's-modal-title': true, 's-modal-title-below': this.subTitleFirst }, innerHTML: this.title }), h("p", { class: { 's-modal-sub-title': true }, innerHTML: this.subTitle }))
|
|
84
|
+
: ''), h("slot", null), h("slot", { name: "footer" }))))));
|
|
78
85
|
}
|
|
79
86
|
get host() { return getElement(this); }
|
|
80
87
|
static get watchers() { return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, h,
|
|
1
|
+
import { r as registerInstance, h, H as Host, g as getElement } from './index-8b97d225.js';
|
|
2
2
|
import { H as Helper } from './Helper-81ac9a8c.js';
|
|
3
3
|
|
|
4
4
|
const SallaProductAvailability = class {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, h,
|
|
1
|
+
import { r as registerInstance, h, H as Host, g as getElement } from './index-8b97d225.js';
|
|
2
2
|
import { H as Helper } from './Helper-81ac9a8c.js';
|
|
3
3
|
|
|
4
4
|
const sallaRatingCss = ":host{display:block}";
|
|
@@ -92,18 +92,21 @@ const SallaRating = class {
|
|
|
92
92
|
}
|
|
93
93
|
// handle wizard
|
|
94
94
|
handleWizard() {
|
|
95
|
-
|
|
95
|
+
var _a;
|
|
96
|
+
let index = 0, steps = this.host.querySelectorAll(".step"), dots = this.host.querySelectorAll(".step-dot"), nextBtnText = this.host.querySelector('#next-btn .btn-text');
|
|
96
97
|
// show first step
|
|
97
98
|
this.showActiveStep(steps, dots, index);
|
|
98
99
|
// handle btn text
|
|
99
|
-
|
|
100
|
-
// change to be seprated method
|
|
100
|
+
nextBtnText.innerHTML = ((_a = steps[index + 1]) === null || _a === void 0 ? void 0 : _a.dataset.stepName) || 'إرسال التقييم';
|
|
101
101
|
Helper.onClick("#prev-btn", () => {
|
|
102
|
+
var _a;
|
|
102
103
|
index > 0 && index--;
|
|
103
104
|
this.showActiveStep(steps, dots, index);
|
|
105
|
+
nextBtnText.innerHTML = ((_a = steps[index + 1]) === null || _a === void 0 ? void 0 : _a.dataset.stepName) || 'إرسال التقييم';
|
|
104
106
|
index == 0 && Helper.toggle('#prev-btn', ['pointer-events-none', 'opacity-0'], 'block', () => true);
|
|
105
107
|
});
|
|
106
108
|
Helper.onClick("#next-btn", () => {
|
|
109
|
+
var _a;
|
|
107
110
|
this.ratingValidation();
|
|
108
111
|
if (index == this.stepsCount - 1) {
|
|
109
112
|
salla.event.dispatch("submit::order-rating");
|
|
@@ -111,6 +114,7 @@ const SallaRating = class {
|
|
|
111
114
|
else {
|
|
112
115
|
index < this.stepsCount - 1 && index++;
|
|
113
116
|
this.showActiveStep(steps, dots, index);
|
|
117
|
+
nextBtnText.innerHTML = ((_a = steps[index + 1]) === null || _a === void 0 ? void 0 : _a.dataset.stepName) || 'إرسال التقييم';
|
|
114
118
|
Helper.toggle('#prev-btn', 'block', ['pointer-events-none', 'opacity-0'], () => true);
|
|
115
119
|
}
|
|
116
120
|
});
|
|
@@ -206,7 +210,7 @@ const SallaRating = class {
|
|
|
206
210
|
// getdata
|
|
207
211
|
getData() {
|
|
208
212
|
salla.api.order.endpointsMethods.details = 'get';
|
|
209
|
-
salla.order.api.details(salla.config.page.id).then(data => console.log(
|
|
213
|
+
salla.order.api.details(salla.config.page.id).then(data => console.log(data));
|
|
210
214
|
}
|
|
211
215
|
// handle star rating
|
|
212
216
|
starsRating() {
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { r as registerInstance, h, H as Host, g as getElement } from './index-8b97d225.js';
|
|
2
|
+
import { H as Helper } from './Helper-81ac9a8c.js';
|
|
3
|
+
|
|
4
|
+
const SallaSearch = class {
|
|
5
|
+
constructor(hostRef) {
|
|
6
|
+
registerInstance(this, hostRef);
|
|
7
|
+
var _a, _b;
|
|
8
|
+
this.results = [];
|
|
9
|
+
/**
|
|
10
|
+
* Override search placeholder.
|
|
11
|
+
*/
|
|
12
|
+
this.placeholder = salla.lang.get('blocks.header.search_placeholder');
|
|
13
|
+
/**
|
|
14
|
+
* Override no results error message.
|
|
15
|
+
*/
|
|
16
|
+
this.noResultsText = salla.lang.get('common.elements.no_options');
|
|
17
|
+
Helper.setHost(this.host);
|
|
18
|
+
this.buttonSlot = ((_a = Helper.getElement('[slot="button"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || '<i class="sicon-search font-bold"></i>';
|
|
19
|
+
this.productSlot = ((_b = Helper.getElement('[slot="product"]')) === null || _b === void 0 ? void 0 : _b.innerHTML) || this.getDefaultProductSlot();
|
|
20
|
+
}
|
|
21
|
+
onModalClose() {
|
|
22
|
+
Helper.getElement('.s-search-input').value = '';
|
|
23
|
+
this.results = [];
|
|
24
|
+
this.afterSearching();
|
|
25
|
+
}
|
|
26
|
+
getDefaultProductSlot() {
|
|
27
|
+
return '<a target="_blank" href={url} class="s-search-product-image-container">' +
|
|
28
|
+
' <img class="s-search-product-image" src="{image}" alt="{name}"/>' +
|
|
29
|
+
'</a>' +
|
|
30
|
+
'<div class="s-search-product-details">' +
|
|
31
|
+
' <div class="s-search-product-name">{name}</div> <div class="s-search-product-price">{price}</div>' +
|
|
32
|
+
'</div>';
|
|
33
|
+
}
|
|
34
|
+
//todo:: reset data when closing
|
|
35
|
+
search(e) {
|
|
36
|
+
Helper.hideElement(this.noResults);
|
|
37
|
+
if (e.target.value.length === 0) {
|
|
38
|
+
this.results = [];
|
|
39
|
+
this.afterSearching();
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (e.target.value.length <= 2) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
//run loading spinner or stop it
|
|
46
|
+
Helper.toggleElement(this.searchIcon, 's-search-spinner-loader', 'sicon-search', () => true);
|
|
47
|
+
salla.search.api.search(e.target.value)
|
|
48
|
+
.then(response => this.results = response.results)
|
|
49
|
+
.catch(err => err !== 'Query Same As Previous!' ? this.results = [] : null)
|
|
50
|
+
.finally(() => this.afterSearching(/*isEmpty*/ false));
|
|
51
|
+
}
|
|
52
|
+
afterSearching(isEmpty = true) {
|
|
53
|
+
this.noResults.style.display = isEmpty || this.results.length > 0 ? 'none' : 'block';
|
|
54
|
+
Helper.toggleElement(this.container, 's-search-container-open', 'no-results', () => this.results.length)
|
|
55
|
+
.toggleElement(this.searchIcon, 's-search-spinner-loader', 'sicon-search', () => false); //stop searching anime
|
|
56
|
+
salla.search.api.previousQuery = ''; //avoid having error 'Query Same As Previous' after reopen modal;
|
|
57
|
+
}
|
|
58
|
+
render() {
|
|
59
|
+
var _a;
|
|
60
|
+
return (h(Host, { class: "s-search" }, h("button", { onClick: () => this.modal.show(), class: "s-search-button-icon", innerHTML: this.buttonSlot }), h("salla-modal", { ref: modal => this.modal = modal }, h("div", { class: "s-search-container", slot: "body", ref: container => this.container = container }, h("input", { class: "s-search-input", type: "text", placeholder: this.placeholder, onInput: e => this.search(e) }), h("span", { class: "s-search-icon" }, h("i", { class: "sicon-search", ref: el => this.searchIcon = el })), h("div", { class: "s-search-results" }, (_a = this.results) === null || _a === void 0 ? void 0 :
|
|
61
|
+
_a.map(item => {
|
|
62
|
+
var _a;
|
|
63
|
+
return h("div", { class: "s-search-product", innerHTML: this.productSlot
|
|
64
|
+
.replace(/\{name\}/g, item.title)
|
|
65
|
+
.replace(/\{price\}/g, (_a = item.price) === null || _a === void 0 ? void 0 : _a.after) //todo:: get discounted price too
|
|
66
|
+
.replace(/\{url\}/g, item.url)
|
|
67
|
+
.replace(/\{image\}/g, item.thumb) });
|
|
68
|
+
}), h("p", { ref: el => this.noResults = el, class: "s-search-no-results" }, this.noResultsText))))));
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Run it one time after load
|
|
72
|
+
*/
|
|
73
|
+
componentDidLoad() {
|
|
74
|
+
this.afterSearching();
|
|
75
|
+
}
|
|
76
|
+
get host() { return getElement(this); }
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export { SallaSearch as S };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { p as promiseResolve, b as bootstrapLazy } from './index-8b97d225.js';
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
Stencil Client Patch Browser v2.8.1 | MIT Licensed | https://stenciljs.com
|
|
5
|
+
*/
|
|
6
|
+
const patchBrowser = () => {
|
|
7
|
+
const importMeta = import.meta.url;
|
|
8
|
+
const opts = {};
|
|
9
|
+
if (importMeta !== '') {
|
|
10
|
+
opts.resourcesUrl = new URL('.', importMeta).href;
|
|
11
|
+
}
|
|
12
|
+
return promiseResolve(opts);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
patchBrowser().then(options => {
|
|
16
|
+
return bootstrapLazy([["salla-button",[[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]}]]],["salla-login_2",[[0,"salla-login"],[4,"salla-modal",{"error":[4],"success":[4],"isClosable":[1028,"is-closable"],"modalWidth":[513,"modal-width"],"visible":[516],"subTitleFirst":[4,"sub-title-first"],"subTitle":[1,"sub-title"],"icon":[1],"imageIcon":[1,"image-icon"],"show":[64],"hide":[64],"setTitle":[64]}]]],["salla-branches",[[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",[[4,"salla-localization",{"languagesTitle":[1,"languages-title"],"currenciesTitle":[1,"currencies-title"],"ok":[1],"show":[64],"hide":[64],"submit":[64]}]]],["salla-product-availability",[[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",[[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-verify",[[0,"salla-verify"]]],["salla-search",[[0,"salla-search",{"placeholder":[1],"noResultsText":[1,"no-results-text"],"results":[32]},[[0,"close","onModalClose"]]]]]], options);
|
|
17
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./cjs/index.cjs.js');
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './esm/index.js';
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export { S as SallaSearch } from './salla-search-df1c9b54.js';
|
|
3
|
-
import './index-8cf58712.js';
|
|
1
|
+
export{S as SallaLogin}from"./p-bd5da080.js";export{S as SallaSearch}from"./p-0ceecf63.js";import"./p-cb1c59a2.js";import"./p-9bc28e0c.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{S as salla_login}from"./p-bd5da080.js";import{r as s,c as t,h as i,H as l,g as a}from"./p-cb1c59a2.js";import{H as o}from"./p-9bc28e0c.js";const e=class{constructor(i){var l;s(this,i),this.ready=t(this,"ready",7),this.close=t(this,"close",7),this.error=!1,this.success=!1,this.isClosable=!0,this.modalWidth="w-96",this.visible=!1,this.subTitleFirst=!1,this.subTitle="",this.icon="",this.imageIcon="",o.setHost(this.host),salla.event.on("modal::open",(s=>s.dataset.target==this.host.id&&this.show())),salla.event.on("modal::close",(s=>s.dataset.target==this.host.id&&this.hide())),this.title=this.host.title,this.host.removeAttribute("title"),null===(l=o.getElement("[slot=body]"))||void 0===l||l.classList.add("s-modal-body")}handleVisible(s){if(!s)return this.toggleModal(!1),void this.close.emit();this.host.classList.remove("hidden"),setTimeout((()=>this.toggleModal(!0))),this.ready.emit()}async show(){return this.host.setAttribute("visible",""),this.host}async hide(){return this.host.removeAttribute("visible"),this.host}async setTitle(s){return this.title=s,this.host}toggleModal(s){o.toggleElement(this.host.querySelector(".s-modal-body"),"s-modal-entering","s-modal-leaving",(()=>s)).toggleElement(this.host.querySelector("[slot=body]"),"s-modal-entering","s-modal-leaving",(()=>s)).toggleElement(this.overlay,"s-modal-entering","s-modal-overlay-leaving",(()=>s)).toggleElement(document.body,"modal-is-open","modal-is-closed",(()=>s)),s||setTimeout((()=>this.host.classList.add("hidden")),350)}closeModal(){this.isClosable&&this.host.removeAttribute("visible")}render(){return this.host.id=this.host.id||"salla-modal",i(l,{class:"s-modal-container hidden","aria-modal":"true",role:"dialog"},i("div",{class:"s-modal-wrapper"},i("div",{class:"s-modal-overlay",ref:s=>this.overlay=s,onClick:()=>this.closeModal()}),i("span",{class:"s-modal-spacer"},""),i("slot",{name:"body"},i("div",{class:"s-modal-body "+this.modalWidth},i("div",{class:{"s-modal-header":!0,"s-modal-is-center":""!=this.icon||""!=this.imageIcon}},this.isClosable?i("button",{class:"s-modal-close cursor-pointer",onClick:()=>this.closeModal(),type:"button"},i("span",{class:"sicon-cancel"})):"",this.error||this.success||this.icon?i("div",{class:{"s-modal-icon":!0,"s-modal-bg-error":this.error,"s-modal-bg-success":this.success,"s-modal-bg-normal":!this.error&&!this.success}},i("i",{class:{[this.icon]:!0,"s-modal-text-error":this.error,"s-modal-text-success":this.success}})):this.imageIcon?i("img",{class:"s-modal-header-img",src:this.imageIcon}):"",this.title||this.subTitle?i("div",{class:"s-modal-header-content"},i("div",{class:{"s-modal-title":!0,"s-modal-title-below":this.subTitleFirst},innerHTML:this.title}),i("p",{class:{"s-modal-sub-title":!0},innerHTML:this.subTitle})):""),i("slot",null),i("slot",{name:"footer"})))))}get host(){return a(this)}static get watchers(){return{visible:["handleVisible"]}}};export{e as salla_modal}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as s,h as t,H as i,g as a}from"./p-cb1c59a2.js";import{H as e}from"./p-9bc28e0c.js";const r=class{constructor(t){var i,a;s(this,t),this.results=[],this.placeholder=salla.lang.get("blocks.header.search_placeholder"),this.noResultsText=salla.lang.get("common.elements.no_options"),e.setHost(this.host),this.buttonSlot=(null===(i=e.getElement('[slot="button"]'))||void 0===i?void 0:i.innerHTML)||'<i class="sicon-search font-bold"></i>',this.productSlot=(null===(a=e.getElement('[slot="product"]'))||void 0===a?void 0:a.innerHTML)||this.getDefaultProductSlot()}onModalClose(){e.getElement(".s-search-input").value="",this.results=[],this.afterSearching()}getDefaultProductSlot(){return'<a target="_blank" href={url} class="s-search-product-image-container"> <img class="s-search-product-image" src="{image}" alt="{name}"/></a><div class="s-search-product-details"> <div class="s-search-product-name">{name}</div> <div class="s-search-product-price">{price}</div></div>'}search(s){if(e.hideElement(this.noResults),0===s.target.value.length)return this.results=[],void this.afterSearching();s.target.value.length<=2||(e.toggleElement(this.searchIcon,"s-search-spinner-loader","sicon-search",(()=>!0)),salla.search.api.search(s.target.value).then((s=>this.results=s.results)).catch((s=>"Query Same As Previous!"!==s?this.results=[]:null)).finally((()=>this.afterSearching(!1))))}afterSearching(s=!0){this.noResults.style.display=s||this.results.length>0?"none":"block",e.toggleElement(this.container,"s-search-container-open","no-results",(()=>this.results.length)).toggleElement(this.searchIcon,"s-search-spinner-loader","sicon-search",(()=>!1)),salla.search.api.previousQuery=""}render(){var s;return t(i,{class:"s-search"},t("button",{onClick:()=>this.modal.show(),class:"s-search-button-icon",innerHTML:this.buttonSlot}),t("salla-modal",{ref:s=>this.modal=s},t("div",{class:"s-search-container",slot:"body",ref:s=>this.container=s},t("input",{class:"s-search-input",type:"text",placeholder:this.placeholder,onInput:s=>this.search(s)}),t("span",{class:"s-search-icon"},t("i",{class:"sicon-search",ref:s=>this.searchIcon=s})),t("div",{class:"s-search-results"},null===(s=this.results)||void 0===s?void 0:s.map((s=>{var i;return t("div",{class:"s-search-product",innerHTML:this.productSlot.replace(/\{name\}/g,s.title).replace(/\{price\}/g,null===(i=s.price)||void 0===i?void 0:i.after).replace(/\{url\}/g,s.url).replace(/\{image\}/g,s.thumb)})})),t("p",{ref:s=>this.noResults=s,class:"s-search-no-results"},this.noResultsText)))))}componentDidLoad(){this.afterSearching()}get host(){return a(this)}};export{r as S}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{S as salla_search}from"./p-0ceecf63.js";import"./p-cb1c59a2.js";import"./p-9bc28e0c.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as l,h as s,g as a}from"./p-cb1c59a2.js";import{H as i}from"./p-9bc28e0c.js";const t=class{constructor(s){var a,t;l(this,s),this.language=salla.config.language,this.currency=salla.config.currency,this.languagesTitle=salla.lang.get("common.titles.language"),this.currenciesTitle=salla.lang.get("common.titles.currency"),this.ok=salla.lang.get("common.elements.ok"),i.setHost(this.host),salla.event.on("localization::show",(()=>this.show())),this.languageSlot=(null===(a=i.getElement('[slot="language"]'))||void 0===a?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>',this.currencySlot=(null===(t=i.getElement('[slot="currency"]'))||void 0===t?void 0:t.innerHTML)||'<label class="s-localization-label" for="currency-{code}"><span>{name}</span><small class="s-localization-currency">{code}</small></label>'}async show(){return this.modal.show()}async hide(){return this.modal.hide()}async submit(){let l;this.btn.load().then((()=>{if(this.currency&&this.currency.code!==salla.config.currency.code)return l=window.location.href,salla.currency.api.change(this.currency.code)})).then((()=>{this.language&&this.language.code!==salla.config.language.code&&(l=this.language.url)})).then((()=>this.btn.stop())).then((()=>this.hide())).then((()=>l&&(window.location.href=l)))}render(){return s("salla-modal",{id:"salla-localization",class:"hidden",ref:l=>this.modal=l},s("slot",{name:"header"},s("div",{slot:"header"})),s("div",{class:"s-localization-inner"},salla.config.languages?s("div",{class:"s-localization-section"},s("label",{class:"s-localization-title"},this.languagesTitle),s("fieldset",{class:"s-localization-fieldset"},s("div",{class:"s-localization-section-inner"},salla.config.languages.map((l=>s("div",{class:"s-localization-item"},s("input",{class:"s-localization-input",type:"radio",checked:this.language.code==l.code,onChange:()=>this.language=l,name:"language",id:"lang-"+l.code.toLowerCase(),value:l.code}),s("div",{id:"language-slot",innerHTML:this.languageSlot.replace(/\{name\}/g,l.name).replace(/\{code\}/g,l.code).replace(/\{country_code\}/g,l.country_code)}))))))):"",salla.config.currencies?s("div",{class:"s-localization-section"},s("label",{class:"s-localization-title"},this.currenciesTitle),s("fieldset",{class:"s-localization-fieldset"},s("div",{class:"s-localization-section-inner"},salla.config.currencies.map((l=>s("div",{class:"s-localization-item"},s("input",{class:"s-localization-input",type:"radio",name:"currency",checked:this.currency.code==l.code,onChange:()=>this.currency=l,id:"currency-"+l.code,value:l.code}),s("div",{id:"currency-slot",innerHTML:this.currencySlot.replace(/\{name\}/g,l.name).replace(/\{code\}/g,l.code).replace(/\{country_code\}/g,l.country_code)}))))))):""),s("p",{slot:"footer"},s("slot",{name:"footer"},s("salla-button",{wide:!0,ref:l=>this.btn=l,onClick:()=>this.submit()},this.ok))))}componentDidRender(){this.host.querySelectorAll("#currency-slot").forEach((l=>l.replaceWith(l.firstChild))),this.host.querySelectorAll("#language-slot").forEach((l=>l.replaceWith(l.firstChild)))}get host(){return a(this)}};export{t as salla_localization}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,h as s,g as i}from"./p-cb1c59a2.js";import{H as e}from"./p-9bc28e0c.js";const a=class{constructor(s){t(this,s),this.btnStyle="primary",this.loading=!1,this.disabled=!1,this.loaderPosition="before",this.wide=!1,this.hostAttributes={};for(let t=0;t<this.host.attributes.length;t++)this.hostAttributes[this.host.attributes[t].name]=this.host.attributes[t].value;this.hostAttributes.type=this.hostAttributes.type||"button",this.hostAttributes.class+=" s-button-btn btn--has-loading btn-"+this.btnStyle+(this.wide?" s-button-wide ":"")+"loader-"+this.loaderPosition+("before"==this.loaderPosition?" flex-row-reverse":""),delete this.hostAttributes["btn-style"],delete this.hostAttributes.id,this.wide&&this.host.classList.add("s-button-wide")}async load(){return"center"==this.loaderPosition&&this.host.querySelector(".btn-text").classList.add("opacity-0"),this.host.setAttribute("loading",""),this.host}async stop(){return this.host.removeAttribute("loading"),this.host}async disable(){this.host.setAttribute("disabled","")}async enable(){this.host.removeAttribute("disabled")}handleVisible(t,s){this.btn.classList.remove("btn-"+s),this.btn.classList.add("btn-"+t)}handleLoading(t){e.toggleElement(this.btn,"btn--is-loading","btn--no-loading",(()=>t))}render(){return s("button",Object.assign({ref:t=>this.btn=t,disabled:this.disabled},this.hostAttributes),s("span",{class:"btn-text transition-opacity duration-300"},s("slot",null)),this.loading?s("span",{class:{"loader loader--small s-button-loader":!0,"absolute right-2":"start"===this.loaderPosition,"absolute left-2":"end"===this.loaderPosition,"absolute top-1/2 left-1/2 !-translate-x-1/2 !-translate-y-1/2 !m-0":"center"===this.loaderPosition}}):"")}get host(){return i(this)}static get watchers(){return{btnStyle:["handleVisible"],loading:["handleLoading"]}}};a.style=":host{display:block}";export{a as salla_button}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as s,h as e,g as t}from"./p-cb1c59a2.js";let i=require("store/src/store-engine"),a=require("store/storages/sessionStorage"),l=i.createStore(a);const h=class{constructor(e){s(this,e),this.open=!1,this.isOpenedBefore=l.get("branch-choosed-before"),this.displayAs="default",this.browseProductsFrom="all",this.branches=[{id:1,name:"فرع الرياض",open:!0,available:!0,limited:!1,tag:"متوفر"},{id:2,name:"فرع جدة",open:!1,available:!1,limited:!1,tag:"غير متوفر"},{id:3,name:"فرع مكة",open:!0,available:!0,limited:!1,tag:"متوفر"},{id:4,name:"فرع المدينة",open:!0,available:!0,limited:!1,tag:"متوفر"},{id:5,name:"فرع جازان",open:!0,available:!0,limited:!0,tag:"الكمية محدودة"}],this.current=1,this.currentBranch=s=>this.branches.filter((s=>s.id==this.current))[0][s],this.statusColor=(s=null)=>s?s.limited?"text-red-400":s.available?"text-green-500":"text-gray-400":this.currentBranch("limited")?"text-red-400":this.currentBranch("available")?"text-green-500":"text-gray-400",this.isChoiceable=()=>"all"!==this.browseProductsFrom&&"single"==this.position||"header"==this.position,this.formTitle=()=>this.isChoiceable()?"توفر المنتج في الفروع الآخرى":"التسوق من فرع آخر",salla.event.on("branches::show",(()=>this.show()))}async show(){return this.modal.show()}async hide(){return this.modal.hide()}handelChange(s){this.selected=s.target.value}handleSubmit(){this.btn.load().then((()=>{setTimeout((()=>location.reload()),2e3)})),l.set("branch-choosed-before",!0),this.show(),setTimeout((()=>{this.current=this.selected}),300)}render(){return e("salla-modal",{icon:"sicon-store-alt",title:"فرع الرياض","sub-title":"أنت الآن تتصفح المتجر من","sub-title-first":!0,"is-closable":this.isOpenedBefore||"popup"!=this.displayAs?"true":"false",ref:s=>this.modal=s,"modal-width":"w-116",id:"s-branches-modal",class:"hidden"},e("fieldset",null,e("h4",{class:"s-branches-title"},this.formTitle()),e("legend",{class:"s-branches-sr-only"},this.formTitle()),this.branches.length<=5?e("div",{class:"s-branches-space-v"},this.branches.map((s=>e("div",{class:"s-branches-input-wrap"},e("input",{id:this.position+"_branch_"+s.id,disabled:!s.open&&this.isChoiceable(),name:"lang",type:"radio",value:s.id,onChange:s=>this.handelChange(s),class:{"s-branches-input":!0,"opacity-50":!s.open,hidden:!this.isChoiceable()},checked:this.current==s.id}),e("label",{htmlFor:this.position+"_branch_"+s.id,class:{"s-branches-label":!0,"s-branches-clickable":this.isChoiceable()}},e("span",{class:{"s-branches-is-closed":!s.open}},s.name),this.isChoiceable()?e("small",{class:"s-branches-closed-badge"},s.open?"":"مُغلق"):e("span",{class:this.statusColor(s)},s.tag)))))):e("select",{class:"s-branches-select",onInput:s=>this.handelChange(s)},this.branches.map((s=>e("option",{value:s.id,disabled:!s.open,selected:this.selected==s.id},s.name," ",s.open?"":"- مُغلق"))))),this.isChoiceable()?e("slot",{name:"footer"},e("salla-button",{"loader-position":"before",ref:s=>this.btn=s,onClick:()=>this.handleSubmit(),class:"s-branches-submit"},salla.lang.get("common.elements.ok"))):"")}componentDidRender(){this.isOpenedBefore||"popup"!=this.displayAs||this.show()}get host(){return t(this)}};h.style=":host{display:block}";export{h as salla_branches}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
class t extends salla.AppHelpers{setHost(t){this.host=t}getElement(t){return this.host.querySelector(t)}getAttribute(t,e){var s;return null===(s=this.getElement(t))||void 0===s?void 0:s.getAttribute(e)}val(t){return this.getAttribute(t,"value")}isUser(){return!!salla.config.is_user}}const e=new t;export{e as H}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as s,h as i,g as e}from"./p-cb1c59a2.js";import{H as t}from"./p-9bc28e0c.js";const l=class{constructor(i){s(this,i),t.setHost(this.host),salla.event.on("profile::verify.mobile",(s=>this.show(s)))}show({international_mobile:s,_country_iso2:i}){return this.mobile=s,this.country_code=i,this.resendTimer(),this.otpInputs=document.querySelectorAll(".s-verify-input"),this.otpInputs[0].focus(),t.onKeyUp(".s-verify-input",(s=>{var i,e,t,l;let r=s.keyCode||s.charCode;salla.helpers.digitsOnly(s.target),s.target.value?(null===(i=s.target.nextElementSibling)||void 0===i||i.focus(),null===(e=s.target.nextElementSibling)||void 0===e||e.select()):[8,46].includes(r)&&(null===(t=s.target.previousElementSibling)||void 0===t||t.focus(),null===(l=s.target.previousElementSibling)||void 0===l||l.select()),this.toggleOTPSubmit()})),t.on("paste",".s-verify-input",(s=>{let i=s.clipboardData.getData("text").toArabicDigits().replace(/[^0-9.]/g,"").replace("..",".");this.otpInputs.forEach(((s,e)=>s.value=i[e]||"")),this.toggleOTPSubmit(),setTimeout((()=>this.otpInputs[3].focus()),100)})),this.modal.show()}toggleOTPSubmit(){let s=[];if(this.otpInputs.forEach((i=>i.value&&s.push(i.value))),this.code.value=s.join(""),4===s.length)return this.btn.removeAttribute("disabled"),void this.btn.click();this.btn.setAttribute("disabled","")}resendTimer(){t.showElement(this.resendMessage).hideElement(this.resend);let s=30,i=setInterval((()=>{-1===s?(clearTimeout(i),t.hideElement(this.resendMessage).showElement(this.resend)):(this.timer.innerHTML=`${s>=10?s:"0"+s} : 00`,s--)}),1e3)}submit(){return this.btn.load().then((()=>this.btn.disable())).then((()=>salla.document.api.request("profile/verify-mobile",{mobile:this.mobile,country_code:this.country_code,code:this.code.value}))).then((()=>this.btn.stop()&&this.btn.disable())).then((()=>this.modal.hide())).then((()=>window.location.reload())).catch((()=>this.btn.stop()&&this.btn.enable()))}resendCode(){return this.btn.stop().then((()=>this.btn.disable())).then((()=>{this.otpInputs.forEach((s=>s.value="")),this.otpInputs[0].focus()})).then((()=>salla.api.auth.resend({phone:this.mobile,country_code:this.country_code}))).then((()=>this.resendTimer())).catch((()=>this.resendTimer()))}render(){return i("salla-modal",{id:"s-verify",ref:s=>this.modal=s,title:salla.lang.get("pages.profile.verify_title")},i("div",{class:"s-verify-message",innerHTML:salla.lang.get("pages.profile.verify_message")}),i("label",{class:"s-verify-label"},salla.lang.get("pages.profile.verify_placeholder")),i("input",{type:"hidden",name:"code",maxlength:"4",required:!0,ref:s=>this.code=s}),i("div",{class:"s-verify-codes",dir:"ltr"},[1,2,3,4].map((()=>i("input",{type:"text",maxlength:"1",class:"s-verify-input",required:!0})))),i("div",{slot:"footer",class:"s-verify-footer"},i("salla-button",{class:"s-verify-submit",disabled:!0,onClick:()=>this.submit(),ref:s=>this.btn=s},salla.lang.get("pages.profile.verify")),i("p",{class:"s-verify-resend-message",ref:s=>this.resendMessage=s},salla.lang.get("blocks.header.resend_after"),i("b",{class:"s-verify-timer",ref:s=>this.timer=s})),i("a",{href:"#",class:"s-verify-resend",onClick:()=>this.resendCode(),ref:s=>this.resend=s},salla.lang.get("blocks.comments.submit"))))}get host(){return e(this)}};export{l as salla_verify}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,h as e,H as a,g as s}from"./p-cb1c59a2.js";import{H as i}from"./p-9bc28e0c.js";const r=class{constructor(e){t(this,e),this.stars=[1,2,3,4,5],this.order={shipping:{id:5622},products:[{title:"ميكروفون عالى الجودة",image:"https://salla-dev.s3.eu-central-1.amazonaws.com/Mvyk/pMdEEyMVpZFj4L1Hrdm2g48AuiSx0TrKULBiOnPo.jpg",price:"10,978.00 ر.س",qty:"2",totalBefore:"1120 ر.س",discount:"-5%",total:"1064 ر.س",id:"2314513454",getOptimusRouteKey:"7351233357"},{title:"ساعة ذكية بنظام اندرويد",image:"https://salla-dev.s3.eu-central-1.amazonaws.com/Mvyk/T4kTqYNuPAZmPMLw1bx92RnjVMZyFszVXOUZQsFJ.jpg",price:"10,978.00 ر.س",qty:"2",totalBefore:"1120 ر.س",discount:"-5%",total:"1064 ر.س",id:"679822376",getOptimusRouteKey:"73233357"}]},this.isProductsRating=!1,this.ratingChain=Promise.resolve(),this.stepsCount=0,i.setHost(this.host)}async show(){return this.modal.show()}async hide(){return this.modal.hide()}componentWillLoad(){this.stepsCount=[this.isStoreRating,this.isProductsRating,this.isShippingRating].filter((t=>t)).length,this.getData()}componentDidRender(){this.show(),this.initiateRating()}initiateRating(){this.highlightSelectedStars(),this.starsRating(),this.handleWizard();const t=this.host.querySelector(".step:first-child");this.setModalHeight(t),salla.event.on("submit::order-rating",(()=>this.sendRating().then((()=>{let t=10,e=setInterval((()=>{t--,this.host.querySelector(".close-time").innerHTML=`00:0${t}`,0==t&&(this.hide(),clearInterval(e))}),1e3);this.host.querySelector(".wizard-footer").classList.add("opacity-0","pointer-events-0"),i.toggle(".step","hidden","block",(()=>!0)),i.toggle(".thankyou-view","is-opened","hidden",(()=>!0));const a=this.host.querySelector(".thankyou-view");this.setModalHeight(a),setTimeout((()=>{i.toggleElement(a,["opacity-1","translate-x-0"],["opacity-0","translate-x-3"],(()=>!0))}),200)}))))}handleWizard(){var t;let e=0,a=this.host.querySelectorAll(".step"),s=this.host.querySelectorAll(".step-dot"),r=this.host.querySelector("#next-btn .btn-text");this.showActiveStep(a,s,e),r.innerHTML=(null===(t=a[e+1])||void 0===t?void 0:t.dataset.stepName)||"إرسال التقييم",i.onClick("#prev-btn",(()=>{var t;e>0&&e--,this.showActiveStep(a,s,e),r.innerHTML=(null===(t=a[e+1])||void 0===t?void 0:t.dataset.stepName)||"إرسال التقييم",0==e&&i.toggle("#prev-btn",["pointer-events-none","opacity-0"],"block",(()=>!0))})),i.onClick("#next-btn",(()=>{var t;this.ratingValidation(),e==this.stepsCount-1?salla.event.dispatch("submit::order-rating"):(e<this.stepsCount-1&&e++,this.showActiveStep(a,s,e),r.innerHTML=(null===(t=a[e+1])||void 0===t?void 0:t.dataset.stepName)||"إرسال التقييم",i.toggle("#prev-btn","block",["pointer-events-none","opacity-0"],(()=>!0)))}))}showActiveStep(t,e,a){i.toggle(".step-dot","bg-gray-200","bg-primay",(()=>!0)),this.stepsCount>1&&i.toggleElement(e[a],"bg-primary","bg-gray-200",(()=>!0)),i.toggle(".step",["hidden","opacity-0","translate-x-3"],["active","opacity-1","translate-x-0"],(()=>!0)),i.toggleElement(t[a],"active","hidden",(()=>!0)),this.setModalHeight(t[a]),setTimeout((()=>{i.toggleElement(t[a],["opacity-1","translate-x-0"],["opacity-0","translate-x-3"],(()=>!0))}),200)}setModalHeight(t){const e=this.host.querySelector(".s-order-rating-steps-wrapper");setTimeout((()=>{null==e||e.setAttribute("style","height:"+(null==t?void 0:t.scrollHeight)+"px")}))}sendRating(){return i.all(".rating-section",(t=>{let e=t.dataset.type,a=[];t.querySelectorAll(".rating-outer-form").forEach((t=>{let s={};t.querySelectorAll("[name]").forEach((function(t){let e=salla.helpers.inputData(t.name,t.value,s);s[e.name]=e.value})),a=[],a.push(s),this.sendFeedback(e,a)}))})),this.ratingChain}sendFeedback(t,e){e&&0!=e.length&&(this.nextBtn.load(),salla.config.canLeave=!1,this.ratingChain=salla.feedback.api[t](e[0]).then((function(){salla.config.canLeave=!0})).catch((()=>salla.config.canLeave=!0)))}ratingValidation(){let t="";if(document.querySelectorAll(".rating-section.active").forEach((e=>{e.querySelectorAll(".rating-outer-form").forEach((e=>{let a=e.querySelector(".rating_hidden_input"),s=e.querySelector(".comment"),i=e.querySelector(".validation-message");if(a.value&&s.value&&s.value.length>3)return s.classList.remove("has-error"),void(i.innerHTML="");s.value&&s.value.length>3?s.classList.remove("has-error"):s.classList.add("has-error"),t=a.value?salla.lang.get("common.errors.not_less_than_chars",{chars:4})+" "+s.getAttribute("placeholder"):e.dataset.starsError||salla.lang.get("pages.rating.rate_store_stars"),i.innerHTML=t}))})),t){let e=document.querySelectorAll(".has-error");throw e.length&&window.scrollTo({top:e[0].offsetTop-80}),new Error(t)}}getData(){salla.api.order.endpointsMethods.details="get",salla.order.api.details(salla.config.page.id).then((t=>console.log(t)))}starsRating(){let t=["selected","text-theme-yellow"];salla.document.event.onSubmit(".rate-element",(function(e){e.preventDefault();var a=e.target.querySelectorAll(".btn--star.hovered"),s=a[a.length-1];if(s){var i=parseInt(s.dataset.star,10);e.target.querySelector(".rating_hidden_input").value=i,e.target.querySelectorAll(".btn--star").forEach((function(e,a){a<i?e.classList.add(...t):e.classList.remove(...t)}));var r=e.target.querySelector('.star[aria-pressed="true"]');r&&r.removeAttribute("aria-pressed"),s.setAttribute("aria-pressed",!0)}}))}highlightSelectedStars(){let t=["hovered","text-theme-yellow"];i.all(".rate-element",(e=>{let a=e.querySelectorAll(".btn--star");e.addEventListener("mouseout",(()=>e.querySelectorAll(".btn--star").forEach((e=>e.classList.remove(...t))))),a.forEach(((e,s)=>{e.addEventListener("mouseover",(()=>{if(e.classList.add(...t),s<=1)"BUTTON"===e.previousElementSibling.tagName&&e.previousElementSibling.classList.add(...t);else for(let e=0;e<s;e++)a[e].classList.add(...t)})),e.addEventListener("mouseout",(()=>{e.classList.contains(...t)&&e.classList.remove(...t)}))}))}))}render(){return e(a,null,e("salla-modal",{class:"hidden","modal-width":"w-[800px]",ref:t=>this.modal=t,title:salla.lang.get("pages.rating.rate_order")+' <span class="unicode">(#'+this.orderId+")</span>"},e("div",{class:"s-order-rating-steps-wrapper mt-12 mb-10 transition-all duration-300 ease-elastic"},this.isStoreRating&&this.renderStoreRating(),this.isProductsRating&&this.renderProductsRating(),this.isShippingRating&&this.renderShippingRating(),this.renderThanksView()),e("div",{class:"wizard-footer relative flex justify-between items-center"},e("button",{id:"prev-btn",class:"font-bold text-sm w-28 h-10 px-4 text-primary hover:text-primary-d opacity-0 pointer-events-none duration-300 transition-all"},"السابق"),this.stepsCount>1?e("ul",{class:"flex justify-center text-center space-s-1.5 flex-1"},[0,1,2].slice(0,this.stepsCount).map((t=>e("li",{class:(0==t?"bg-primary":"bg-gray-200")+" step-dot w-2.5 h-2.5 rounded-full transition-colors duration-300"})))):"",e("salla-button",{id:"next-btn",class:"w-28",ref:t=>this.nextBtn=t},"التالي"))))}renderStoreRating(){return e("section",{class:"step rating-section active transition-all duration-500 opacity-0 translate-x-3 hidden","data-type":"store","data-step-name":"تقييم المتجر"},e("div",{class:"rating-outer-form","data-stars-error":salla.lang.get("pages.rating.rate_store_stars")},e("input",{type:"hidden",name:"order_id",value:this.orderId}),e("input",{type:"hidden",name:"type",value:"store"}),e("div",{class:"flex flex-col items-center "},e("div",{class:"w-28 h-28 border border-gray-200 rounded-full flex items-center justify-center mb-4"},e("img",{src:"https://salla-dev.s3.eu-central-1.amazonaws.com/Mvyk/X3NKcY7nhaFQlR7kBBHvfDpMY48cerunKrmDA1gi.png",alt:"store name",class:"w-12 object-contain"})),e("h2",{class:"section-title text-lg font-bold mb-4"},salla.lang.get("pages.rating.rate_the_store"))),e("div",{class:"rating-wrap flex items-center flex justify-center mb-4"},e("form",{class:"rate-element rate-element--has-label"},this.getStarsRating())),e("textarea",{id:"storeReview",name:"comment",class:"form-input comment h-20",placeholder:salla.lang.get("pages.rating.write_store_rate")}),e("small",{class:"text-red-400 validation-message"})))}renderProductsRating(){return e("section",{class:"step rating-section products-section transition-all duration-500 opacity-0 translate-x-3 hidden","data-type":"product","data-step-name":"تقييم المنتجات"},e("div",{class:"overflow-hidden"},this.order.products.map(((t,a)=>e("div",{class:"rating-outer-form mb-8 last:mb-0","data-stars-error":salla.lang.get("pages.rating.rate_product_stars",{item:t.title})},e("div",{class:"product-item"},e("div",{class:"flex space-s-5"},e("img",{src:t.image,alt:t.title,class:"w-18 h-14 object-cover rounded-md"}),e("div",{class:"flex-1"},e("h3",{class:"section-title leading-5 mb-1.5 font-bold md:text-sm"}," ",t.title),e("div",{class:"rw-product-entry__rate"},e("div",{class:"rating-wrap flex items-center space-s-4"},e("form",{class:"rate-element rate-element--has-label"},this.getStarsRating())),e("input",{type:"hidden",name:"order_id",value:this.orderId}),e("input",{type:"hidden",name:`products[${a}][product_id]`,value:t.getOptimusRouteKey}),e("input",{type:"hidden",name:"type",value:"products"}),e("textarea",{"data-product-id":t.id,name:`products[${a}][comment]`,id:`productReview_${t.id}`,class:"comment form-input h-20 product-review",placeholder:salla.lang.get("pages.rating.write_product_rate")}),e("small",{class:"text-red-400 validation-message"}))))))))))}renderShippingRating(){return e("section",{class:"step rating-section py-5 rounded-md transition-all duration-500 opacity-0 translate-x-3 hidden","data-type":"shipping","data-step-name":"تقييم شركة الشحن"},e("div",{class:"rating-outer-form","data-stars-error":salla.lang.get("pages.rating.rate_shipping_stars")},e("input",{type:"hidden",name:"order_id",value:this.orderId}),e("input",{type:"hidden",name:"shipping_company_id",value:this.order.shipping.id}),e("input",{type:"hidden",name:"type",value:"shipping"}),e("div",{class:"flex flex-col items-center "},e("div",{class:"w-28 h-28 overflow-hidden border border-gray-200 rounded-full flex items-center justify-center mb-4"},e("img",{src:"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcScPt4R6KaKDldrXb-9pUljFwL3m6A72BhN6p1qZJKprwC6VbCWC_8ASZgiJAoL_l7DepM&usqp=CAU",alt:"company name",class:"w-full h-full object-contain"})),e("h2",{class:"section-title text-lg font-bold mb-4"}," ",salla.lang.get("pages.rating.rate_shipping")," ارامكس")),e("div",{class:"rating-wrap flex flex justify-center mb-4"},e("form",{class:"rate-element ratFeedbackPresentere-element--has-label"},this.getStarsRating())),e("textarea",{id:"shippingReview",name:"comment",class:"form-input comment h-20 mb-2",placeholder:salla.lang.get("pages.rating.write_shipping_rate")}),e("small",{class:"text-red-400 validation-message"})))}renderThanksView(){return e("div",{class:"thankyou-view px-8 text-center transition-all duration-500 opacity-0 translate-x-3 hidden"},e("span",{class:"w-20 h-20 text-4xl inline-flex justify-center items-center bg-gray-50 rounded-full text-primary sicon-check-circle2"}),e("div",{class:"mt-4 mb-6"},e("h3",{class:"font-bold"},salla.lang.get("pages.rating.thanks")),e("div",{class:"text-gray-400 text-sm",innerHTML:this.thanksMsg})),e("a",{href:"#!",onClick:()=>this.hide(),class:"btn btn-primary h-10 flex-none px-8"},"عودة إلي تفاصيل الطلب"),e("time",{class:"close-time text-gray-400 block h-6 mt-3 text-sm"}))}getStarsRating(){return e("div",{class:"mb-1"},e("input",{type:"hidden",class:"rating_hidden_input",name:"rating",value:""}),this.stars.map((t=>e("button",{type:"submit",class:"btn btn--transparent px-1 text-2xl text-gray-400 btn--star","data-star":t},e("i",{class:"sicon-star2"})))))}get host(){return s(this)}};r.style=":host{display:block}";export{r as salla_rating}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,h as s}from"./p-cb1c59a2.js";const t=class{constructor(s){e(this,s)}render(){return s("salla-modal",{id:"salla-login",title:"سجل دخول إلى الموقع"},s("div",{id:"showLoginMethods"},s("p",{class:"text-sm text-gray-text mb-5"},"اختر الوسيلة المناسبة"),s("div",{id:"openEmailLogin",class:"mb-2.5 box-content relative rounded-md border border-border-color bg-white py-5 pe-4 ps-5 flex items-center space-s-3 hover:border-gray-200"},s("div",{class:"flex-shrink-0"},s("div",{class:"bg-primary w-12 h-12 text-lg text-white rounded-icon"},s("i",{class:"sicon-mail"}))),s("div",{class:"flex-1 min-w-0"},s("a",{href:"#",class:"focus:outline-none flex justify-between items-center"},s("div",{class:"flex-1"},s("span",{class:"absolute inset-0","aria-hidden":"true"}),s("p",{class:"text-sm text-gray-text"},"سجل دخول"),s("h6",{class:"font-boldf"},"البريد الإلكتروني")),s("i",{class:"sicon-keyboard_arrow_left text-primary text-xl"})))),s("div",{class:"box-content relative rounded-md border border-border-color bg-white py-5 pe-4 ps-5 flex items-center space-s-3 hover:border-gray-200"},s("div",{class:"flex-shrink-0"},s("div",{class:"bg-primary w-12 h-12 text-lg text-white rounded-icon"},s("i",{class:"sicon-phone"}))),s("div",{class:"flex-1 min-w-0"},s("a",{href:"#",class:"focus:outline-none flex justify-between items-center"},s("div",{class:"flex-1"},s("span",{class:"absolute inset-0","aria-hidden":"true"}),s("p",{class:"text-sm text-gray-text"},"سجل دخول"),s("h6",{class:"font-boldf"},"الهاتف")),s("i",{class:"sicon-keyboard_arrow_left text-primary text-xl"}))))))}};export{t as S}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e,t,l=!1,n=!1,o=!1,s=!1;const i="undefined"!=typeof window?window:{},r=i.document||{head:{}},c={t:0,l:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,l,n)=>e.addEventListener(t,l,n),rel:(e,t,l,n)=>e.removeEventListener(t,l,n),ce:(e,t)=>new CustomEvent(e,t)},f=e=>Promise.resolve(e),a=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(e){}return!1})(),u=(e,t,l)=>{l&&l.map((([l,n,o])=>{const s=e,i=$(t,o),r=d(l);c.ael(s,n,i,r),(t.o=t.o||[]).push((()=>c.rel(s,n,i,r)))}))},$=(e,t)=>l=>{try{256&e.t?e.i[t](l):(e.u=e.u||[]).push([t,l])}catch(e){se(e)}},d=e=>0!=(2&e),h="http://www.w3.org/1999/xlink",y=new WeakMap,p=e=>"sc-"+e.$,m={},b=e=>"object"==(e=typeof e)||"function"===e,w=(e,t,...l)=>{let n=null,o=null,s=null,i=!1,r=!1,c=[];const f=t=>{for(let l=0;l<t.length;l++)n=t[l],Array.isArray(n)?f(n):null!=n&&"boolean"!=typeof n&&((i="function"!=typeof e&&!b(n))&&(n+=""),i&&r?c[c.length-1].h+=n:c.push(i?k(null,n):n),r=i)};if(f(l),t){t.key&&(o=t.key),t.name&&(s=t.name);{const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}}const a=k(e,null);return a.p=t,c.length>0&&(a.m=c),a.k=o,a.g=s,a},k=(e,t)=>({t:0,S:e,h:t,v:null,m:null,p:null,k:null,g:null}),g={},S=(e,t,l,n,o,s)=>{if(l!==n){let r=oe(e,t),f=t.toLowerCase();if("class"===t){const t=e.classList,o=j(l),s=j(n);t.remove(...o.filter((e=>e&&!s.includes(e)))),t.add(...s.filter((e=>e&&!o.includes(e))))}else if("style"===t){for(const t in l)n&&null!=n[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in n)l&&n[t]===l[t]||(t.includes("-")?e.style.setProperty(t,n[t]):e.style[t]=n[t])}else if("key"===t);else if("ref"===t)n&&n(e);else if(r||"o"!==t[0]||"n"!==t[1]){const i=b(n);if((r||i&&null!==n)&&!o)try{if(e.tagName.includes("-"))e[t]=n;else{let o=null==n?"":n;"list"===t?r=!1:null!=l&&e[t]==o||(e[t]=o)}}catch(e){}let c=!1;f!==(f=f.replace(/^xlink\:?/,""))&&(t=f,c=!0),null==n||!1===n?!1===n&&""!==e.getAttribute(t)||(c?e.removeAttributeNS(h,t):e.removeAttribute(t)):(!r||4&s||o)&&!i&&(n=!0===n?"":n,c?e.setAttributeNS(h,t,n):e.setAttribute(t,n))}else t="-"===t[2]?t.slice(3):oe(i,f)?f.slice(2):f[2]+t.slice(3),l&&c.rel(e,t,l,!1),n&&c.ael(e,t,n,!1)}},v=/\s/,j=e=>e?e.split(v):[],M=(e,t,l,n)=>{const o=11===t.v.nodeType&&t.v.host?t.v.host:t.v,s=e&&e.p||m,i=t.p||m;for(n in s)n in i||S(o,n,s[n],void 0,l,t.t);for(n in i)S(o,n,s[n],i[n],l,t.t)},O=(n,s,i)=>{let c,f,a,u=s.m[i],$=0;if(l||(o=!0,"slot"===u.S&&(u.t|=u.m?2:1)),null!==u.h)c=u.v=r.createTextNode(u.h);else if(1&u.t)c=u.v=r.createTextNode("");else if(c=u.v=r.createElement(2&u.t?"slot-fb":u.S),M(null,u,!1),u.m)for($=0;$<u.m.length;++$)f=O(n,u,$),f&&c.appendChild(f);return c["s-hn"]=t,3&u.t&&(c["s-sr"]=!0,c["s-cr"]=e,c["s-sn"]=u.g||"",a=n&&n.m&&n.m[i],a&&a.S===u.S&&n.v&&C(n.v,!1)),c},C=(e,l)=>{c.t|=1;const n=e.childNodes;for(let e=n.length-1;e>=0;e--){const s=n[e];s["s-hn"]!==t&&s["s-ol"]&&(L(s).insertBefore(s,T(s)),s["s-ol"].remove(),s["s-ol"]=void 0,o=!0),l&&C(s,l)}c.t&=-2},R=(e,t,l,n,o,s)=>{let i,r=e["s-cr"]&&e["s-cr"].parentNode||e;for(;o<=s;++o)n[o]&&(i=O(null,l,o),i&&(n[o].v=i,r.insertBefore(i,T(t))))},x=(e,t,l,o,s)=>{for(;t<=l;++t)(o=e[t])&&(s=o.v,H(o),n=!0,s["s-ol"]?s["s-ol"].remove():C(s,!0),s.remove())},P=(e,t)=>e.S===t.S&&("slot"===e.S?e.g===t.g:e.k===t.k),T=e=>e&&e["s-ol"]||e,L=e=>(e["s-ol"]?e["s-ol"]:e).parentNode,E=(e,t)=>{const l=t.v=e.v,n=e.m,o=t.m,s=t.h;let i;null===s?("slot"===t.S||M(e,t,!1),null!==n&&null!==o?((e,t,l,n)=>{let o,s,i=0,r=0,c=0,f=0,a=t.length-1,u=t[0],$=t[a],d=n.length-1,h=n[0],y=n[d];for(;i<=a&&r<=d;)if(null==u)u=t[++i];else if(null==$)$=t[--a];else if(null==h)h=n[++r];else if(null==y)y=n[--d];else if(P(u,h))E(u,h),u=t[++i],h=n[++r];else if(P($,y))E($,y),$=t[--a],y=n[--d];else if(P(u,y))"slot"!==u.S&&"slot"!==y.S||C(u.v.parentNode,!1),E(u,y),e.insertBefore(u.v,$.v.nextSibling),u=t[++i],y=n[--d];else if(P($,h))"slot"!==u.S&&"slot"!==y.S||C($.v.parentNode,!1),E($,h),e.insertBefore($.v,u.v),$=t[--a],h=n[++r];else{for(c=-1,f=i;f<=a;++f)if(t[f]&&null!==t[f].k&&t[f].k===h.k){c=f;break}c>=0?(s=t[c],s.S!==h.S?o=O(t&&t[r],l,c):(E(s,h),t[c]=void 0,o=s.v),h=n[++r]):(o=O(t&&t[r],l,r),h=n[++r]),o&&L(u.v).insertBefore(o,T(u.v))}i>a?R(e,null==n[d+1]?null:n[d+1].v,l,n,r,d):r>d&&x(t,i,a)})(l,n,t,o):null!==o?(null!==e.h&&(l.textContent=""),R(l,null,t,o,0,o.length-1)):null!==n&&x(n,0,n.length-1)):(i=l["s-cr"])?i.parentNode.textContent=s:e.h!==s&&(l.data=s)},W=e=>{let t,l,n,o,s,i,r=e.childNodes;for(l=0,n=r.length;l<n;l++)if(t=r[l],1===t.nodeType){if(t["s-sr"])for(s=t["s-sn"],t.hidden=!1,o=0;o<n;o++)if(i=r[o].nodeType,r[o]["s-hn"]!==t["s-hn"]||""!==s){if(1===i&&s===r[o].getAttribute("slot")){t.hidden=!0;break}}else if(1===i||3===i&&""!==r[o].textContent.trim()){t.hidden=!0;break}W(t)}},A=[],D=e=>{let t,l,o,s,i,r,c=0,f=e.childNodes,a=f.length;for(;c<a;c++){if(t=f[c],t["s-sr"]&&(l=t["s-cr"])&&l.parentNode)for(o=l.parentNode.childNodes,s=t["s-sn"],r=o.length-1;r>=0;r--)l=o[r],l["s-cn"]||l["s-nr"]||l["s-hn"]===t["s-hn"]||(F(l,s)?(i=A.find((e=>e.j===l)),n=!0,l["s-sn"]=l["s-sn"]||s,i?i.M=t:A.push({M:t,j:l}),l["s-sr"]&&A.map((e=>{F(e.j,l["s-sn"])&&(i=A.find((e=>e.j===l)),i&&!e.M&&(e.M=i.M))}))):A.some((e=>e.j===l))||A.push({j:l}));1===t.nodeType&&D(t)}},F=(e,t)=>1===e.nodeType?null===e.getAttribute("slot")&&""===t||e.getAttribute("slot")===t:e["s-sn"]===t||""===t,H=e=>{e.p&&e.p.ref&&e.p.ref(null),e.m&&e.m.map(H)},N=e=>te(e).O,U=(e,t,l)=>{const n=N(e);return{emit:e=>q(n,t,{bubbles:!!(4&l),composed:!!(2&l),cancelable:!!(1&l),detail:e})}},q=(e,t,l)=>{const n=c.ce(t,l);return e.dispatchEvent(n),n},V=(e,t)=>{t&&!e.C&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.C=t)))},_=(e,t)=>{if(e.t|=16,!(4&e.t))return V(e,e.R),ye((()=>z(e,t)));e.t|=512},z=(e,t)=>{const l=e.i;let n;return t&&(e.t|=256,e.u&&(e.u.map((([e,t])=>K(l,e,t))),e.u=null),n=K(l,"componentWillLoad")),Q(n,(()=>B(e,l,t)))},B=async(e,t,l)=>{const n=e.O,o=n["s-rc"];l&&(e=>{const t=e.P;((e,t)=>{let l=p(t),n=ce.get(l);if(e=11===e.nodeType?e:r,n)if("string"==typeof n){let t,o=y.get(e=e.head||e);o||y.set(e,o=new Set),o.has(l)||(t=r.createElement("style"),t.innerHTML=n,e.insertBefore(t,e.querySelector("link")),o&&o.add(l))}else e.adoptedStyleSheets.includes(n)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,n])})(e.O.getRootNode(),t)})(e);G(e,t),o&&(o.map((e=>e())),n["s-rc"]=void 0);{const t=n["s-p"],l=()=>I(e);0===t.length?l():(Promise.all(t).then(l),e.t|=4,t.length=0)}},G=(s,i)=>{try{i=i.render(),s.t&=-17,s.t|=2,((s,i)=>{const f=s.O,a=s.P,u=s.T||k(null,null),$=(e=>e&&e.S===g)(i)?i:w(null,null,i);if(t=f.tagName,a.L&&($.p=$.p||{},a.L.map((([e,t])=>$.p[t]=f[e]))),$.S=null,$.t|=4,s.T=$,$.v=u.v=f,e=f["s-cr"],l=0!=(1&a.t),n=!1,E(u,$),c.t|=1,o){let e,t,l,n,o,s;D($.v);let i=0;for(;i<A.length;i++)e=A[i],t=e.j,t["s-ol"]||(l=r.createTextNode(""),l["s-nr"]=t,t.parentNode.insertBefore(t["s-ol"]=l,t));for(i=0;i<A.length;i++)if(e=A[i],t=e.j,e.M){for(n=e.M.parentNode,o=e.M.nextSibling,l=t["s-ol"];l=l.previousSibling;)if(s=l["s-nr"],s&&s["s-sn"]===t["s-sn"]&&n===s.parentNode&&(s=s.nextSibling,!s||!s["s-nr"])){o=s;break}(!o&&n!==t.parentNode||t.nextSibling!==o)&&t!==o&&(!t["s-hn"]&&t["s-ol"]&&(t["s-hn"]=t["s-ol"].parentNode.nodeName),n.insertBefore(t,o))}else 1===t.nodeType&&(t.hidden=!0)}n&&W($.v),c.t&=-2,A.length=0})(s,i)}catch(e){se(e,s.O)}return null},I=e=>{const t=e.O,l=e.i,n=e.R;K(l,"componentDidRender"),64&e.t||(e.t|=64,X(t),K(l,"componentDidLoad"),e.W(t),n||J()),e.A(t),e.C&&(e.C(),e.C=void 0),512&e.t&&he((()=>_(e,!1))),e.t&=-517},J=()=>{X(r.documentElement),he((()=>q(i,"appload",{detail:{namespace:"twilight-components"}})))},K=(e,t,l)=>{if(e&&e[t])try{return e[t](l)}catch(e){se(e)}},Q=(e,t)=>e&&e.then?e.then(t):t(),X=e=>e.classList.add("hydrated"),Y=(e,t,l)=>{if(t.D){e.watchers&&(t.F=e.watchers);const n=Object.entries(t.D),o=e.prototype;if(n.map((([e,[n]])=>{31&n||2&l&&32&n?Object.defineProperty(o,e,{get(){return((e,t)=>te(this).H.get(t))(0,e)},set(l){((e,t,l,n)=>{const o=te(e),s=o.O,i=o.H.get(t),r=o.t,c=o.i;if(l=((e,t)=>null==e||b(e)?e:4&t?"false"!==e&&(""===e||!!e):2&t?parseFloat(e):1&t?e+"":e)(l,n.D[t][0]),!(8&r&&void 0!==i||l===i)&&(o.H.set(t,l),c)){if(n.F&&128&r){const e=n.F[t];e&&e.map((e=>{try{c[e](l,i,t)}catch(e){se(e,s)}}))}2==(18&r)&&_(o,!1)}})(this,e,l,t)},configurable:!0,enumerable:!0}):1&l&&64&n&&Object.defineProperty(o,e,{value(...t){const l=te(this);return l.N.then((()=>l.i[e](...t)))}})})),1&l){const l=new Map;o.attributeChangedCallback=function(e,t,n){c.jmp((()=>{const t=l.get(e);this.hasOwnProperty(t)&&(n=this[t],delete this[t]),this[t]=(null!==n||"boolean"!=typeof this[t])&&n}))},e.observedAttributes=n.filter((([e,t])=>15&t[0])).map((([e,n])=>{const o=n[1]||e;return l.set(o,e),512&n[0]&&t.L.push([e,o]),o}))}}return e},Z=(e,t={})=>{const l=[],n=t.exclude||[],o=i.customElements,s=r.head,f=s.querySelector("meta[charset]"),$=r.createElement("style"),d=[];let h,y=!0;Object.assign(c,t),c.l=new URL(t.resourcesUrl||"./",r.baseURI).href,e.map((e=>e[1].map((t=>{const s={t:t[0],$:t[1],D:t[2],U:t[3]};s.D=t[2],s.U=t[3],s.L=[],s.F={};const i=s.$,f=class extends HTMLElement{constructor(e){super(e),ne(e=this,s)}connectedCallback(){h&&(clearTimeout(h),h=null),y?d.push(this):c.jmp((()=>(e=>{if(0==(1&c.t)){const t=te(e),l=t.P,n=()=>{};if(1&t.t)u(e,t,l.U);else{t.t|=1,12&l.t&&(e=>{const t=e["s-cr"]=r.createComment("");t["s-cn"]=!0,e.insertBefore(t,e.firstChild)})(e);{let l=e;for(;l=l.parentNode||l.host;)if(l["s-p"]){V(t,t.R=l);break}}l.D&&Object.entries(l.D).map((([t,[l]])=>{if(31&l&&e.hasOwnProperty(t)){const l=e[t];delete e[t],e[t]=l}})),(async(e,t,l,n,o)=>{if(0==(32&t.t)){{if(t.t|=32,(o=re(l)).then){const e=()=>{};o=await o,e()}o.isProxied||(l.F=o.watchers,Y(o,l,2),o.isProxied=!0);const e=()=>{};t.t|=8;try{new o(t)}catch(e){se(e)}t.t&=-9,t.t|=128,e()}if(o.style){let e=o.style;const t=p(l);if(!ce.has(t)){const n=()=>{};((e,t,l)=>{let n=ce.get(e);a&&l?(n=n||new CSSStyleSheet,n.replace(t)):n=t,ce.set(e,n)})(t,e,!!(1&l.t)),n()}}}const s=t.R,i=()=>_(t,!0);s&&s["s-rc"]?s["s-rc"].push(i):i()})(0,t,l)}n()}})(this)))}disconnectedCallback(){c.jmp((()=>(()=>{if(0==(1&c.t)){const e=te(this);e.o&&(e.o.map((e=>e())),e.o=void 0)}})()))}componentOnReady(){return te(this).q}};s.V=e[0],n.includes(i)||o.get(i)||(l.push(i),o.define(i,Y(f,s,1)))})))),$.innerHTML=l+"{visibility:hidden}.hydrated{visibility:inherit}",$.setAttribute("data-styles",""),s.insertBefore($,f?f.nextSibling:s.firstChild),y=!1,d.length?d.map((e=>e.connectedCallback())):c.jmp((()=>h=setTimeout(J,30)))},ee=new WeakMap,te=e=>ee.get(e),le=(e,t)=>ee.set(t.i=e,t),ne=(e,t)=>{const l={t:0,O:e,P:t,H:new Map};return l.N=new Promise((e=>l.A=e)),l.q=new Promise((e=>l.W=e)),e["s-p"]=[],e["s-rc"]=[],u(e,l,t.U),ee.set(e,l)},oe=(e,t)=>t in e,se=(e,t)=>(0,console.error)(e,t),ie=new Map,re=e=>{const t=e.$.replace(/-/g,"_"),l=e.V,n=ie.get(l);return n?n[t]:import(`./${l}.entry.js`).then((e=>(ie.set(l,e),e[t])),se)},ce=new Map,fe=[],ae=[],ue=(e,t)=>l=>{e.push(l),s||(s=!0,t&&4&c.t?he(de):c.raf(de))},$e=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){se(e)}e.length=0},de=()=>{$e(fe),$e(ae),(s=fe.length>0)&&c.raf(de)},he=e=>f().then(e),ye=ue(ae,!0);export{g as H,Z as b,U as c,N as g,w as h,f as p,le as r}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,h as s,H as i,g as l}from"./p-cb1c59a2.js";import{H as a}from"./p-9bc28e0c.js";const e=class{constructor(s){t(this,s),this.isUser=a.isUser(),this.buttonText=salla.lang.get("pages.products.notify_availability"),this.countryCode=salla.config.country_code||"SA",this.subscribeText=salla.lang.get("common.elements.submit"),this.cancelText=salla.lang.get("common.elements.cancel"),this.subTitle=salla.lang.get("pages.products.notify_availability_subtitle"),this.mobileLabel=salla.lang.get("common.elements.mobile"),this.emailLabel=salla.lang.get("common.elements.email"),this.mobilePlaceholder=salla.lang.get("common.elements.mobile_placeholder"),this.emailPlaceholder=salla.lang.get("common.elements.email_placeholder"),this.productId=salla.config.page.id,this.subscribedMessage=salla.lang.get("pages.products.notify_availability_success"),this.isSubscribed=!1,this.isUser||(this.channelsWatcher(this.channels),this.title_=this.host.title||salla.lang.get("pages.products.notify_availability_title"),this.host.removeAttribute("title"))}channelsWatcher(t){this.channels_=t.split(",")}async submit(){if(this.isUser)return salla.api.product.availabilitySubscribe(this.productId).then((()=>this.isSubscribed=!0));let t={id:this.productId,country_code:this.countryCode};return""!==this.mobile.value&&(t.mobile=this.mobile.value),""!==this.email.value&&(t.email=this.email.value),this.btn.load().then((()=>this.btn.disable())).then((()=>salla.api.product.availabilitySubscribe(t))).then((()=>this.isSubscribed=!0)).then((()=>this.btn.stop())).then((()=>this.modal.hide())).catch((()=>this.btn.stop()&&this.btn.enable()))}render(){return s(i,null,this.isSubscribed?s("div",{class:"s-product-availability-subscribed"},this.subscribedMessage):s("slot",null,s("salla-button",{wide:!0,onClick:()=>this.isUser?this.submit():this.modal.show()},this.buttonText)),this.isUser||this.isSubscribed?"":this.renderModal())}renderModal(){return s("salla-modal",{ref:t=>this.modal=t,title:this.title_,subTitle:this.subTitle,icon:"sicon-bell-ring",modalWidth:"w-96"},s("div",{class:"s-product-availability-body"},this.channels_.includes("email")?[s("label",{class:"s-product-availability-label"},this.emailLabel),s("input",{class:"s-product-availability-input",placeholder:this.emailPlaceholder,ref:t=>this.email=t,type:"email"})]:"",this.channels_.includes("sms")?[s("label",{class:"s-product-availability-label"},this.mobileLabel),s("input",{class:"s-product-availability-input",placeholder:this.mobilePlaceholder,ref:t=>this.mobile=t,type:"text"}),s("input",{type:"hidden",value:this.countryCode})]:""),s("div",{slot:"footer",class:"s-product-availability-footer"},s("salla-button",{wide:!0,ref:t=>this.btn=t,onClick:()=>this.submit()},this.subscribeText),s("salla-button",{wide:!0,"btn-style":"outline"},this.cancelText)))}get host(){return l(this)}static get watchers(){return{channels:["channelsWatcher"]}}};export{e as salla_product_availability}
|
|
@@ -1,125 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { g as globalScripts } from './app-globals-0f993ce5.js';
|
|
3
|
-
|
|
4
|
-
/*
|
|
5
|
-
Stencil Client Patch Browser v2.8.1 | MIT Licensed | https://stenciljs.com
|
|
6
|
-
*/
|
|
7
|
-
const getDynamicImportFunction = (namespace) => `__sc_import_${namespace.replace(/\s|-/g, '_')}`;
|
|
8
|
-
const patchBrowser = () => {
|
|
9
|
-
// NOTE!! This fn cannot use async/await!
|
|
10
|
-
if (BUILD.isDev && !BUILD.isTesting) {
|
|
11
|
-
consoleDevInfo('Running in development mode.');
|
|
12
|
-
}
|
|
13
|
-
if (BUILD.cssVarShim) {
|
|
14
|
-
// shim css vars
|
|
15
|
-
plt.$cssShim$ = win.__cssshim;
|
|
16
|
-
}
|
|
17
|
-
if (BUILD.cloneNodeFix) {
|
|
18
|
-
// opted-in to polyfill cloneNode() for slot polyfilled components
|
|
19
|
-
patchCloneNodeFix(H.prototype);
|
|
20
|
-
}
|
|
21
|
-
if (BUILD.profile && !performance.mark) {
|
|
22
|
-
// not all browsers support performance.mark/measure (Safari 10)
|
|
23
|
-
performance.mark = performance.measure = () => {
|
|
24
|
-
/*noop*/
|
|
25
|
-
};
|
|
26
|
-
performance.getEntriesByName = () => [];
|
|
27
|
-
}
|
|
28
|
-
// @ts-ignore
|
|
29
|
-
const scriptElm = BUILD.scriptDataOpts || BUILD.safari10 || BUILD.dynamicImportShim
|
|
30
|
-
? Array.from(doc.querySelectorAll('script')).find((s) => new RegExp(`\/${NAMESPACE}(\\.esm)?\\.js($|\\?|#)`).test(s.src) ||
|
|
31
|
-
s.getAttribute('data-stencil-namespace') === NAMESPACE)
|
|
32
|
-
: null;
|
|
33
|
-
const importMeta = import.meta.url;
|
|
34
|
-
const opts = BUILD.scriptDataOpts ? scriptElm['data-opts'] || {} : {};
|
|
35
|
-
if (BUILD.safari10 && 'onbeforeload' in scriptElm && !history.scrollRestoration /* IS_ESM_BUILD */) {
|
|
36
|
-
// Safari < v11 support: This IF is true if it's Safari below v11.
|
|
37
|
-
// This fn cannot use async/await since Safari didn't support it until v11,
|
|
38
|
-
// however, Safari 10 did support modules. Safari 10 also didn't support "nomodule",
|
|
39
|
-
// so both the ESM file and nomodule file would get downloaded. Only Safari
|
|
40
|
-
// has 'onbeforeload' in the script, and "history.scrollRestoration" was added
|
|
41
|
-
// to Safari in v11. Return a noop then() so the async/await ESM code doesn't continue.
|
|
42
|
-
// IS_ESM_BUILD is replaced at build time so this check doesn't happen in systemjs builds.
|
|
43
|
-
return {
|
|
44
|
-
then() {
|
|
45
|
-
/* promise noop */
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
if (!BUILD.safari10 && importMeta !== '') {
|
|
50
|
-
opts.resourcesUrl = new URL('.', importMeta).href;
|
|
51
|
-
}
|
|
52
|
-
else if (BUILD.dynamicImportShim || BUILD.safari10) {
|
|
53
|
-
opts.resourcesUrl = new URL('.', new URL(scriptElm.getAttribute('data-resources-url') || scriptElm.src, win.location.href)).href;
|
|
54
|
-
if (BUILD.dynamicImportShim) {
|
|
55
|
-
patchDynamicImport(opts.resourcesUrl, scriptElm);
|
|
56
|
-
}
|
|
57
|
-
if (BUILD.dynamicImportShim && !win.customElements) {
|
|
58
|
-
// module support, but no custom elements support (Old Edge)
|
|
59
|
-
// @ts-ignore
|
|
60
|
-
return import(/* webpackChunkName: "polyfills-dom" */ './dom-d08ba8aa.js').then(() => opts);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
return promiseResolve(opts);
|
|
64
|
-
};
|
|
65
|
-
const patchDynamicImport = (base, orgScriptElm) => {
|
|
66
|
-
const importFunctionName = getDynamicImportFunction(NAMESPACE);
|
|
67
|
-
try {
|
|
68
|
-
// test if this browser supports dynamic imports
|
|
69
|
-
// There is a caching issue in V8, that breaks using import() in Function
|
|
70
|
-
// By generating a random string, we can workaround it
|
|
71
|
-
// Check https://bugs.chromium.org/p/chromium/issues/detail?id=990810 for more info
|
|
72
|
-
win[importFunctionName] = new Function('w', `return import(w);//${Math.random()}`);
|
|
73
|
-
}
|
|
74
|
-
catch (e) {
|
|
75
|
-
// this shim is specifically for browsers that do support "esm" imports
|
|
76
|
-
// however, they do NOT support "dynamic" imports
|
|
77
|
-
// basically this code is for old Edge, v18 and below
|
|
78
|
-
const moduleMap = new Map();
|
|
79
|
-
win[importFunctionName] = (src) => {
|
|
80
|
-
const url = new URL(src, base).href;
|
|
81
|
-
let mod = moduleMap.get(url);
|
|
82
|
-
if (!mod) {
|
|
83
|
-
const script = doc.createElement('script');
|
|
84
|
-
script.type = 'module';
|
|
85
|
-
script.crossOrigin = orgScriptElm.crossOrigin;
|
|
86
|
-
script.src = URL.createObjectURL(new Blob([`import * as m from '${url}'; window.${importFunctionName}.m = m;`], {
|
|
87
|
-
type: 'application/javascript',
|
|
88
|
-
}));
|
|
89
|
-
mod = new Promise((resolve) => {
|
|
90
|
-
script.onload = () => {
|
|
91
|
-
resolve(win[importFunctionName].m);
|
|
92
|
-
script.remove();
|
|
93
|
-
};
|
|
94
|
-
});
|
|
95
|
-
moduleMap.set(url, mod);
|
|
96
|
-
doc.head.appendChild(script);
|
|
97
|
-
}
|
|
98
|
-
return mod;
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
const patchCloneNodeFix = (HTMLElementPrototype) => {
|
|
103
|
-
const nativeCloneNodeFn = HTMLElementPrototype.cloneNode;
|
|
104
|
-
HTMLElementPrototype.cloneNode = function (deep) {
|
|
105
|
-
if (this.nodeName === 'TEMPLATE') {
|
|
106
|
-
return nativeCloneNodeFn.call(this, deep);
|
|
107
|
-
}
|
|
108
|
-
const clonedNode = nativeCloneNodeFn.call(this, false);
|
|
109
|
-
const srcChildNodes = this.childNodes;
|
|
110
|
-
if (deep) {
|
|
111
|
-
for (let i = 0; i < srcChildNodes.length; i++) {
|
|
112
|
-
// Node.ATTRIBUTE_NODE === 2, and checking because IE11
|
|
113
|
-
if (srcChildNodes[i].nodeType !== 2) {
|
|
114
|
-
clonedNode.appendChild(srcChildNodes[i].cloneNode(true));
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
return clonedNode;
|
|
119
|
-
};
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
patchBrowser().then(options => {
|
|
123
|
-
globalScripts();
|
|
124
|
-
return bootstrapLazy([["salla-button",[[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]}]]],["salla-modal",[[4,"salla-modal",{"error":[4],"success":[4],"isClosable":[1028,"is-closable"],"modalWidth":[513,"modal-width"],"visible":[516],"subTitle":[1,"sub-title"],"icon":[1],"show":[64],"hide":[64],"setTitle":[64]}]]],["multi-warehouse",[[4,"multi-warehouse",{"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",[[4,"salla-localization",{"languagesTitle":[1,"languages-title"],"currenciesTitle":[1,"currencies-title"],"ok":[1],"show":[64],"hide":[64],"submit":[64]}]]],["salla-product-availability",[[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",[[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-verify",[[0,"salla-verify"]]],["salla-login",[[0,"salla-login"]]],["salla-search",[[4,"salla-search",{"searchPlaceholder":[1,"search-placeholder"],"noResultsText":[1,"no-results-text"],"searchTerm":[32],"results":[32],"fetchStatus":[32],"showResult":[32],"showModal":[32]}]]]], options);
|
|
125
|
-
});
|
|
1
|
+
import{p as e,b as s}from"./p-cb1c59a2.js";(()=>{const s=import.meta.url,l={};return""!==s&&(l.resourcesUrl=new URL(".",s).href),e(l)})().then((e=>s([["p-68c9f122",[[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]}]]],["p-010b8dfd",[[0,"salla-login"],[4,"salla-modal",{error:[4],success:[4],isClosable:[1028,"is-closable"],modalWidth:[513,"modal-width"],visible:[516],subTitleFirst:[4,"sub-title-first"],subTitle:[1,"sub-title"],icon:[1],imageIcon:[1,"image-icon"],show:[64],hide:[64],setTitle:[64]}]]],["p-8126278e",[[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]}]]],["p-50e70ad4",[[4,"salla-localization",{languagesTitle:[1,"languages-title"],currenciesTitle:[1,"currencies-title"],ok:[1],show:[64],hide:[64],submit:[64]}]]],["p-d584d0c7",[[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]}]]],["p-b05450bc",[[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]}]]],["p-9d327a79",[[0,"salla-verify"]]],["p-32d29245",[[0,"salla-search",{placeholder:[1],noResultsText:[1,"no-results-text"],results:[32]},[[0,"close","onModalClose"]]]]]],e)));
|
|
@@ -6,9 +6,12 @@ export declare class SallaModal {
|
|
|
6
6
|
isClosable: boolean;
|
|
7
7
|
modalWidth: string;
|
|
8
8
|
visible: boolean;
|
|
9
|
+
subTitleFirst: boolean;
|
|
9
10
|
subTitle: string;
|
|
10
11
|
icon: string;
|
|
12
|
+
imageIcon: string;
|
|
11
13
|
private title;
|
|
14
|
+
private overlay;
|
|
12
15
|
host: HTMLElement;
|
|
13
16
|
ready: EventEmitter;
|
|
14
17
|
close: EventEmitter;
|
|
@@ -8,8 +8,8 @@ export declare class SallaRating {
|
|
|
8
8
|
isStoreRating: boolean;
|
|
9
9
|
isProductsRating: boolean;
|
|
10
10
|
isShippingRating: boolean;
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
ratingChain: Promise<void>;
|
|
12
|
+
stepsCount: number;
|
|
13
13
|
private modal;
|
|
14
14
|
host: HTMLElement;
|
|
15
15
|
show(): Promise<HTMLElement>;
|