@salla.sa/twilight-components 1.0.17 → 1.0.18
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/Helper-81ac9a8c.js → twilight-components/Helper-d07ebbc7.js} +1 -1
- 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-8966d27f.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 +18 -16
- package/dist/{esm/salla-login-32d25ffa.js → twilight-components/salla-login-7c25f64b.js} +2 -2
- package/dist/twilight-components/salla-login-b92c73dc.js +127 -0
- 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 +46 -0
- package/dist/{esm → twilight-components}/salla-product-availability.entry.js +2 -2
- package/dist/{esm → twilight-components}/salla-rating.entry.js +2 -2
- package/dist/{esm/salla-search-f552c487.js → twilight-components/salla-search-69f2d9c1.js} +2 -2
- package/dist/twilight-components/salla-search.entry.js +3 -0
- package/dist/{collection/components/salla-verify/salla-verify.js → twilight-components/salla-verify.entry.js} +16 -140
- 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-localization/salla-localization.d.ts +2 -0
- package/dist/types/components/salla-login/salla-login.d.ts +3 -2
- package/dist/types/components/salla-offer/salla-offer.d.ts +50 -2
- package/dist/types/components/salla-verify/salla-verify.d.ts +2 -0
- package/dist/types/components.d.ts +6 -1
- package/package.json +1 -1
- package/dist/cjs/Helper-8852feaa.js +0 -23
- package/dist/cjs/index-0b5b5867.js +0 -1656
- 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_4.cjs.entry.js +0 -299
- package/dist/cjs/salla-localization.cjs.entry.js +0 -80
- package/dist/cjs/salla-login-342876b9.js +0 -118
- package/dist/cjs/salla-offer.cjs.entry.js +0 -25
- 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-28da4616.js +0 -81
- 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 -21
- 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 -206
- package/dist/collection/components/salla-login/salla-login.js +0 -348
- package/dist/collection/components/salla-modal/salla-modal.js +0 -459
- package/dist/collection/components/salla-offer/salla-offer.js +0 -40
- 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/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-8b97d225.js +0 -1628
- 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-button_4.entry.js +0 -292
- package/dist/esm/salla-offer.entry.js +0 -21
- 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-33990e49.entry.js +0 -1
- package/dist/twilight-components/p-36683152.js +0 -1
- package/dist/twilight-components/p-3cfede65.entry.js +0 -1
- package/dist/twilight-components/p-648661c8.entry.js +0 -1
- package/dist/twilight-components/p-93c3ac79.js +0 -1
- package/dist/twilight-components/p-9bc28e0c.js +0 -1
- package/dist/twilight-components/p-a923a51e.entry.js +0 -1
- package/dist/twilight-components/p-bc278b0e.entry.js +0 -1
- package/dist/twilight-components/p-cb1c59a2.js +0 -1
- package/dist/twilight-components/p-fa04c4b6.entry.js +0 -1
- package/dist/twilight-components/p-fa2f0e64.entry.js +0 -1
|
@@ -1,292 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-8b97d225.js';
|
|
2
|
-
import { H as Helper } from './Helper-81ac9a8c.js';
|
|
3
|
-
export { S as salla_login } from './salla-login-32d25ffa.js';
|
|
4
|
-
|
|
5
|
-
const sallaButtonCss = ":host{display:block}";
|
|
6
|
-
|
|
7
|
-
const SallaButton = class {
|
|
8
|
-
constructor(hostRef) {
|
|
9
|
-
registerInstance(this, hostRef);
|
|
10
|
-
this.btnStyle = 'primary';
|
|
11
|
-
this.loading = false;
|
|
12
|
-
this.disabled = false;
|
|
13
|
-
this.loaderPosition = 'before';
|
|
14
|
-
this.wide = false;
|
|
15
|
-
this.hostAttributes = {};
|
|
16
|
-
//============= Initiate Button Attributes =============//
|
|
17
|
-
for (let i = 0; i < this.host.attributes.length; i++) {
|
|
18
|
-
this.hostAttributes[this.host.attributes[i].name] = this.host.attributes[i].value;
|
|
19
|
-
}
|
|
20
|
-
this.hostAttributes.type = this.hostAttributes.type || 'button';
|
|
21
|
-
this.hostAttributes.class += ' s-button-btn btn--has-loading'
|
|
22
|
-
+ ' s-button-' + this.btnStyle
|
|
23
|
-
+ (this.wide ? ' s-button-wide ' : '')
|
|
24
|
-
+ ' loader-' + this.loaderPosition
|
|
25
|
-
+ (this.loaderPosition == 'before' ? ' s-button-loader-after' : '');
|
|
26
|
-
delete this.hostAttributes['btn-style'];
|
|
27
|
-
delete this.hostAttributes['id'];
|
|
28
|
-
if (this.wide) {
|
|
29
|
-
this.host.classList.add('s-button-wide');
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
async load() {
|
|
33
|
-
if (this.loaderPosition == 'center')
|
|
34
|
-
this.text.classList.add('s-button-hide');
|
|
35
|
-
this.host.setAttribute('loading', '');
|
|
36
|
-
return this.host;
|
|
37
|
-
}
|
|
38
|
-
async stop() {
|
|
39
|
-
this.host.removeAttribute('loading');
|
|
40
|
-
return this.host;
|
|
41
|
-
}
|
|
42
|
-
async disable() {
|
|
43
|
-
this.host.setAttribute('disabled', '');
|
|
44
|
-
}
|
|
45
|
-
async enable() {
|
|
46
|
-
this.host.removeAttribute('disabled');
|
|
47
|
-
}
|
|
48
|
-
handleVisible(newKind, oldKind) {
|
|
49
|
-
//todo::use united styles
|
|
50
|
-
this.btn.classList.remove('btn-' + oldKind);
|
|
51
|
-
this.btn.classList.add('btn-' + newKind);
|
|
52
|
-
}
|
|
53
|
-
handleLoading(newVal) {
|
|
54
|
-
//todo::use united styles
|
|
55
|
-
Helper.toggleElement(this.btn, 'btn--is-loading', 'btn--no-loading', () => newVal);
|
|
56
|
-
}
|
|
57
|
-
render() {
|
|
58
|
-
return (
|
|
59
|
-
//TODO:: use HOST then fake button behaviours
|
|
60
|
-
h(Host, { class: "s-button-host-tag" }, h("button", Object.assign({ ref: btn => this.btn = btn, disabled: this.disabled }, this.hostAttributes), h("span", { class: "s-button-text", ref: el => this.text = el }, h("slot", null)), this.loading ? h("span", { class: {
|
|
61
|
-
//todo::use united styles
|
|
62
|
-
's-button-loader': true,
|
|
63
|
-
's-button-loader-start': this.loaderPosition === 'start',
|
|
64
|
-
's-button-loader-end': this.loaderPosition === 'end',
|
|
65
|
-
's-button-loader-center': this.loaderPosition === 'center',
|
|
66
|
-
} }) : '')));
|
|
67
|
-
}
|
|
68
|
-
get host() { return getElement(this); }
|
|
69
|
-
static get watchers() { return {
|
|
70
|
-
"btnStyle": ["handleVisible"],
|
|
71
|
-
"loading": ["handleLoading"]
|
|
72
|
-
}; }
|
|
73
|
-
};
|
|
74
|
-
SallaButton.style = sallaButtonCss;
|
|
75
|
-
|
|
76
|
-
const SallaModal = class {
|
|
77
|
-
constructor(hostRef) {
|
|
78
|
-
registerInstance(this, hostRef);
|
|
79
|
-
this.modalOpened = createEvent(this, "modalOpened", 7);
|
|
80
|
-
this.modalClosed = createEvent(this, "modalClosed", 7);
|
|
81
|
-
var _a;
|
|
82
|
-
//todo:: unite three colors (error, success, primary) in one prop
|
|
83
|
-
this.error = false;
|
|
84
|
-
this.success = false;
|
|
85
|
-
this.primary = false;
|
|
86
|
-
this.isClosable = true;
|
|
87
|
-
this.width = 'md';
|
|
88
|
-
this.visible = false;
|
|
89
|
-
this.isLoading = false;
|
|
90
|
-
this.subTitleFirst = false;
|
|
91
|
-
this.subTitle = '';
|
|
92
|
-
this.icon = '';
|
|
93
|
-
this.imageIcon = '';
|
|
94
|
-
Helper.setHost(this.host);
|
|
95
|
-
salla.event.on('modal::open', btn => btn.dataset.target == this.host.id && this.show());
|
|
96
|
-
salla.event.on('modal::close', btn => btn.dataset.target == this.host.id && this.hide());
|
|
97
|
-
this.title = this.host.title;
|
|
98
|
-
this.host.removeAttribute('title');
|
|
99
|
-
(_a = Helper.getElement('[slot=body]')) === null || _a === void 0 ? void 0 : _a.classList.add('s-modal-body', 's-modal-' + this.width);
|
|
100
|
-
}
|
|
101
|
-
handleVisible(newValue) {
|
|
102
|
-
if (!newValue) {
|
|
103
|
-
this.toggleModal(false);
|
|
104
|
-
this.modalClosed.emit();
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
this.host.classList.remove('hidden');
|
|
108
|
-
setTimeout(() => this.toggleModal(true)); //small amont of time to running toggle After adding hidden
|
|
109
|
-
this.modalOpened.emit();
|
|
110
|
-
}
|
|
111
|
-
async show() {
|
|
112
|
-
this.host.setAttribute('visible', '');
|
|
113
|
-
return this.host;
|
|
114
|
-
}
|
|
115
|
-
async hide() {
|
|
116
|
-
this.host.removeAttribute('visible');
|
|
117
|
-
return this.host;
|
|
118
|
-
}
|
|
119
|
-
async setTitle(title) {
|
|
120
|
-
this.title = title;
|
|
121
|
-
return this.host;
|
|
122
|
-
}
|
|
123
|
-
async loading() {
|
|
124
|
-
this.isLoading = true;
|
|
125
|
-
return this.host;
|
|
126
|
-
}
|
|
127
|
-
async stopLoading() {
|
|
128
|
-
this.isLoading = false;
|
|
129
|
-
return this.host;
|
|
130
|
-
}
|
|
131
|
-
toggleModal(isOpen) {
|
|
132
|
-
Helper
|
|
133
|
-
// .toggleElement(this.host.querySelector('.s-modal-body'), 's-modal-entering', 's-modal-leaving', () => isOpen)
|
|
134
|
-
.toggleElement(this.host.querySelector('[slot=body]') || this.host, 's-modal-entering', 's-modal-leaving', () => isOpen)
|
|
135
|
-
.toggleElement(this.overlay, 's-modal-entering', 's-modal-overlay-leaving', () => isOpen)
|
|
136
|
-
//todo:: use united class names
|
|
137
|
-
.toggleElement(document.body, 'modal-is-open', 'modal-is-closed', () => isOpen);
|
|
138
|
-
if (!isOpen) {
|
|
139
|
-
setTimeout(() => this.host.classList.add('hidden'), 350);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
closeModal() {
|
|
143
|
-
if (!this.isClosable) {
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
this.host.removeAttribute('visible');
|
|
147
|
-
}
|
|
148
|
-
//todo:: pref for each modal
|
|
149
|
-
render() {
|
|
150
|
-
this.host.id = this.host.id || 'salla-modal';
|
|
151
|
-
return (
|
|
152
|
-
//todo:: use suitable class name instead of hidden
|
|
153
|
-
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 ' + 's-modal-' + this.width, slot: "body" }, this.isLoading
|
|
154
|
-
? h("span", null, "Loading...")
|
|
155
|
-
: [h("div", { class: { 's-modal-header': true, 's-modal-is-center': this.icon != '' || this.imageIcon != '' } }, this.isClosable ?
|
|
156
|
-
//todo:: remove cursor-pointer
|
|
157
|
-
h("button", { class: "s-modal-close cursor-pointer", onClick: () => this.closeModal(), type: "button" }, h("span", { class: "sicon-cancel" }))
|
|
158
|
-
: '', this.error || this.success || this.icon
|
|
159
|
-
? h("div", { class: {
|
|
160
|
-
's-modal-icon': true,
|
|
161
|
-
's-modal-bg-error': this.error,
|
|
162
|
-
's-modal-bg-success': this.success,
|
|
163
|
-
's-modal-bg-normal': !this.error && !this.success,
|
|
164
|
-
's-modal-bg-primary': this.primary
|
|
165
|
-
} }, h("i", { class: {
|
|
166
|
-
[this.icon]: true,
|
|
167
|
-
's-modal-text-error': this.error,
|
|
168
|
-
's-modal-text-success': this.success,
|
|
169
|
-
} }))
|
|
170
|
-
: this.imageIcon ?
|
|
171
|
-
h("img", { class: "s-modal-header-img", src: this.imageIcon })
|
|
172
|
-
: '', this.title || this.subTitle ?
|
|
173
|
-
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 }))
|
|
174
|
-
: ''),
|
|
175
|
-
h("slot", null),
|
|
176
|
-
h("slot", { name: "footer" })
|
|
177
|
-
])))));
|
|
178
|
-
}
|
|
179
|
-
get host() { return getElement(this); }
|
|
180
|
-
static get watchers() { return {
|
|
181
|
-
"visible": ["handleVisible"]
|
|
182
|
-
}; }
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
const SallaVerify = class {
|
|
186
|
-
constructor(hostRef) {
|
|
187
|
-
registerInstance(this, hostRef);
|
|
188
|
-
this.verified = createEvent(this, "verified", 7);
|
|
189
|
-
this.url = 'profile/verify-mobile';
|
|
190
|
-
this.by = 'sms';
|
|
191
|
-
this.autoReload = true;
|
|
192
|
-
Helper.setHost(this.host);
|
|
193
|
-
if (this.withoutModal) {
|
|
194
|
-
this.modal = { show: () => '', hide: () => '' };
|
|
195
|
-
}
|
|
196
|
-
else {
|
|
197
|
-
salla.event.on('profile::verify.mobile', data => this.show(data));
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
async getCode() {
|
|
201
|
-
return this.code.value;
|
|
202
|
-
}
|
|
203
|
-
async show(data) {
|
|
204
|
-
this.data = data;
|
|
205
|
-
this.resendTimer();
|
|
206
|
-
this.otpInputs = document.querySelectorAll('.s-verify-input');
|
|
207
|
-
this.otpInputs[0].focus();
|
|
208
|
-
Helper.on('input', '.s-verify-input', e => salla.helpers.digitsOnly(e.target));
|
|
209
|
-
Helper.onKeyUp('.s-verify-input', event => {
|
|
210
|
-
var _a, _b, _c, _d;
|
|
211
|
-
let key = event.keyCode || event.charCode;
|
|
212
|
-
if (event.target.value) {
|
|
213
|
-
(_a = event.target.nextElementSibling) === null || _a === void 0 ? void 0 : _a.focus();
|
|
214
|
-
(_b = event.target.nextElementSibling) === null || _b === void 0 ? void 0 : _b.select();
|
|
215
|
-
}
|
|
216
|
-
else if ([8, 46].includes(key)) {
|
|
217
|
-
(_c = event.target.previousElementSibling) === null || _c === void 0 ? void 0 : _c.focus();
|
|
218
|
-
(_d = event.target.previousElementSibling) === null || _d === void 0 ? void 0 : _d.select();
|
|
219
|
-
}
|
|
220
|
-
this.toggleOTPSubmit();
|
|
221
|
-
});
|
|
222
|
-
Helper.on('paste', '.s-verify-input', event => {
|
|
223
|
-
let text = event.clipboardData.getData('text').toArabicDigits().replace(/[^0-9.]/g, '').replace('..', '.');
|
|
224
|
-
this.otpInputs.forEach((input, i) => input.value = text[i] || '');
|
|
225
|
-
this.toggleOTPSubmit();
|
|
226
|
-
setTimeout(() => this.otpInputs[3].focus(), 100);
|
|
227
|
-
});
|
|
228
|
-
return this.modal.show();
|
|
229
|
-
}
|
|
230
|
-
toggleOTPSubmit() {
|
|
231
|
-
let otp = [];
|
|
232
|
-
this.otpInputs.forEach(input => input.value && otp.push(input.value));
|
|
233
|
-
this.code.value = otp.join('');
|
|
234
|
-
if (otp.length === 4) {
|
|
235
|
-
this.btn.removeAttribute('disabled');
|
|
236
|
-
this.btn.click();
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
|
-
this.btn.setAttribute('disabled', '');
|
|
240
|
-
}
|
|
241
|
-
resendTimer() {
|
|
242
|
-
Helper.showElement(this.resendMessage).hideElement(this.resend);
|
|
243
|
-
let resendAfter = 30;
|
|
244
|
-
let timerId = setInterval(() => {
|
|
245
|
-
if (resendAfter === -1) {
|
|
246
|
-
clearTimeout(timerId);
|
|
247
|
-
Helper.hideElement(this.resendMessage).showElement(this.resend);
|
|
248
|
-
}
|
|
249
|
-
else {
|
|
250
|
-
this.timer.innerHTML = `${resendAfter >= 10 ? resendAfter : '0' + resendAfter} : 00`;
|
|
251
|
-
resendAfter--;
|
|
252
|
-
}
|
|
253
|
-
}, 1000);
|
|
254
|
-
}
|
|
255
|
-
resendCode() {
|
|
256
|
-
return this.btn.stop()
|
|
257
|
-
.then(() => this.btn.disable())
|
|
258
|
-
.then(() => {
|
|
259
|
-
this.otpInputs.forEach(input => input.value = '');
|
|
260
|
-
this.otpInputs[0].focus();
|
|
261
|
-
})
|
|
262
|
-
.then(() => salla.api.auth.resend(Object.assign({ resend_by: this.by }, this.data)))
|
|
263
|
-
.then(() => this.resendTimer())
|
|
264
|
-
.catch(() => this.resendTimer());
|
|
265
|
-
}
|
|
266
|
-
submit() {
|
|
267
|
-
return this.btn.load()
|
|
268
|
-
.then(() => this.btn.disable())
|
|
269
|
-
.then(() => salla.document.api.request(this.url, Object.assign({ code: this.code.value }, this.data)))
|
|
270
|
-
.then(response => this.verified.emit(response))
|
|
271
|
-
.then(() => this.btn.stop() && this.btn.disable())
|
|
272
|
-
.then(() => this.modal.hide())
|
|
273
|
-
.then(() => this.autoReload && window.location.reload())
|
|
274
|
-
.catch(() => this.btn.stop() && this.btn.enable());
|
|
275
|
-
}
|
|
276
|
-
render() {
|
|
277
|
-
return this.withoutModal ? this.myBody() :
|
|
278
|
-
h("salla-modal", { id: "s-verify", ref: modal => this.modal = modal, title: salla.lang.get('pages.profile.verify_title') }, this.myBody());
|
|
279
|
-
}
|
|
280
|
-
myBody() {
|
|
281
|
-
return [
|
|
282
|
-
h("div", { class: "s-verify-message", innerHTML: salla.lang.get('pages.profile.verify_message') }),
|
|
283
|
-
h("label", { class: "s-verify-label" }, salla.lang.get('pages.profile.verify_placeholder')),
|
|
284
|
-
h("input", { type: "hidden", name: "code", maxlength: "4", required: true, ref: code => this.code = code }),
|
|
285
|
-
h("div", { class: "s-verify-codes", dir: "ltr" }, [1, 2, 3, 4].map(() => h("input", { type: "text", maxlength: "1", class: "s-verify-input", required: true }))),
|
|
286
|
-
h("div", { slot: "footer", class: "s-verify-footer" }, h("salla-button", { class: "s-verify-submit", disabled: true, onClick: () => this.submit(), ref: b => this.btn = b }, salla.lang.get('pages.profile.verify')), h("p", { class: "s-verify-resend-message", ref: el => this.resendMessage = el }, salla.lang.get('blocks.header.resend_after'), h("b", { class: "s-verify-timer", ref: el => this.timer = el })), h("a", { href: "#", class: "s-verify-resend", onClick: () => this.resendCode(), ref: el => this.resend = el }, salla.lang.get('blocks.comments.submit')))
|
|
287
|
-
];
|
|
288
|
-
}
|
|
289
|
-
get host() { return getElement(this); }
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
export { SallaButton as salla_button, SallaModal as salla_modal, SallaVerify as salla_verify };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, h, g as getElement } from './index-8b97d225.js';
|
|
2
|
-
|
|
3
|
-
const SallaOffer = class {
|
|
4
|
-
constructor(hostRef) {
|
|
5
|
-
registerInstance(this, hostRef);
|
|
6
|
-
salla.offer.event.onExisted(data => this.show(data.offer.offer_id));
|
|
7
|
-
}
|
|
8
|
-
async show(offerId) {
|
|
9
|
-
this.modal.show();
|
|
10
|
-
console.log(offerId);
|
|
11
|
-
}
|
|
12
|
-
render() {
|
|
13
|
-
return h("salla-modal", { ref: modal => this.modal = modal, "is-loading": true }, h("slot", null));
|
|
14
|
-
}
|
|
15
|
-
componentDidLoad() {
|
|
16
|
-
//
|
|
17
|
-
}
|
|
18
|
-
get host() { return getElement(this); }
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export { SallaOffer as salla_offer };
|
|
@@ -1,17 +0,0 @@
|
|
|
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",[[0,"salla-login",{"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,"modalClosed","onModalClose"]]],[0,"salla-verify",{"withoutModal":[4,"without-modal"],"url":[1],"by":[1],"autoReload":[4,"auto-reload"],"getCode":[64],"show":[64]}],[4,"salla-button",{"btnStyle":[513,"btn-style"],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"wide":[4],"load":[64],"stop":[64],"disable":[64],"enable":[64]}],[4,"salla-modal",{"error":[4],"success":[4],"primary":[4],"isClosable":[1028,"is-closable"],"width":[513],"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",[[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-offer",[[4,"salla-offer",{"show":[64]}]]],["salla-search",[[0,"salla-search",{"placeholder":[1],"noResultsText":[1,"no-results-text"],"results":[32]},[[0,"modalClosed","onModalClose"]]]]]], options);
|
|
17
|
-
});
|
package/dist/index.cjs.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('./cjs/index.cjs.js');
|
package/dist/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './esm/index.js';
|
|
@@ -1 +0,0 @@
|
|
|
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",width:"md"},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 +0,0 @@
|
|
|
1
|
-
import{r as s,h as t,H as a,g as i}from"./p-cb1c59a2.js";import{H as e}from"./p-9bc28e0c.js";const r=class{constructor(t){var a,i;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===(a=e.getElement('[slot="button"]'))||void 0===a?void 0:a.innerHTML)||'<i class="sicon-search"></i>',this.productSlot=(null===(i=e.getElement('[slot="product"]'))||void 0===i?void 0:i.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(a,{class:"s-search"},t("button",{onClick:()=>this.modal.show(),class:"s-search-button",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 a;return t("div",{class:"s-search-product",innerHTML:this.productSlot.replace(/\{name\}/g,s.title).replace(/\{price\}/g,null===(a=s.price)||void 0===a?void 0:a.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 i(this)}};export{r as S}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,h as s,H as a,g as i}from"./p-cb1c59a2.js";import{H as e}from"./p-9bc28e0c.js";const r=class{constructor(s){t(this,s),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/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"}],storeLogo:"https://salla-dev.s3.eu-central-1.amazonaws.com/Mvyk/X3NKcY7nhaFQlR7kBBHvfDpMY48cerunKrmDA1gi.png",shippingLogo:"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcScPt4R6KaKDldrXb-9pUljFwL3m6A72BhN6p1qZJKprwC6VbCWC_8ASZgiJAoL_l7DepM&usqp=CAU"},this.isStoreRating=!1,this.isProductsRating=!1,this.isShippingRating=!1,this.ratingChain=Promise.resolve(),this.stepsCount=0,e.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}componentDidRender(){this.show(),this.initiateRating()}initiateRating(){this.handleWizard(),this.handleSubmitRating(),this.starsRating(),this.highlightSelectedStars()}handleWizard(){let t=0,s=this.host.querySelectorAll(".s-rating-step"),a=this.host.querySelectorAll(".s-rating-step-dot"),i=this.host.querySelector("#next-btn .s-button-text");this.setModalHeight(s[0]),this.showActiveStep(s,a,t,i),e.onClick("#prev-btn",(()=>{t>0&&t--,this.showActiveStep(s,a,t,i),0==t&&e.toggle("#prev-btn","s-rating-unvisiable","block",(()=>!0))})),e.onClick("#next-btn",(()=>{this.ratingValidation(),t==this.stepsCount-1?salla.event.dispatch("submit::order-rating"):(t<this.stepsCount-1&&t++,this.showActiveStep(s,a,t,i),e.toggle("#prev-btn","block","s-rating-unvisiable",(()=>!0)))}))}showActiveStep(t,s,a,i){var r;e.toggle(".s-rating-step","s-rating-hidden","s-rating-active",(()=>!0)),e.toggleElement(t[a],"s-rating-unactive","s-rating-hidden",(()=>!0)),setTimeout((()=>e.toggleElement(t[a],"s-rating-active","s-rating-unactive",(()=>!0))),200),e.toggle(".s-rating-step-dot","s-rating-bg-gray","s-rating-bg-primary",(()=>!0)),this.stepsCount>1&&e.toggleElement(s[a],"s-rating-bg-primary","s-rating-bg-gray",(()=>!0)),i.innerHTML=(null===(r=t[a+1])||void 0===r?void 0:r.dataset.stepName)||salla.lang.get("pages.rating.send_ratings"),this.setModalHeight(t[a])}setModalHeight(t){const s=this.host.querySelector(".s-rating-wrapper");setTimeout((()=>null==s?void 0:s.setAttribute("style","height:"+(null==t?void 0:t.scrollHeight)+"px")))}handleSubmitRating(){salla.event.on("submit::order-rating",(()=>this.sendRating().then((()=>{let t=this.host.querySelector(".s-rating-thanks"),s=10,a=setInterval((()=>{s--,this.host.querySelector(".s-rating-thanks-time").innerHTML=`00:0${s}`,0==s&&(this.hide(),clearInterval(a))}),1e3);e.toggle(".s-rating-step","s-rating-hidden","s-rating-active",(()=>!0)),this.host.querySelector(".s-rating-footer").classList.add("s-rating-unvisiable"),e.toggleElement(t,"s-rating-unactive","s-rating-hidden",(()=>!0)),setTimeout((()=>e.toggleElement(t,"s-rating-active","s-rating-unactive",(()=>!0))),200),this.setModalHeight(t)}))))}starsRating(){let t=["selected"];salla.document.event.onSubmit(".s-rating-stars-element",(function(s){s.preventDefault();var a=s.target.querySelectorAll(".s-rating-btn-star.hovered"),i=a[a.length-1];if(i){var e=parseInt(i.dataset.star,10);s.target.querySelector(".rating_hidden_input").value=e,s.target.querySelectorAll(".s-rating-btn-star").forEach((function(s,a){a<e?s.classList.add(...t):s.classList.remove(...t)}));var r=s.target.querySelector('.s-rating-btn-star[aria-pressed="true"]');r&&r.removeAttribute("aria-pressed"),i.setAttribute("aria-pressed",!0)}}))}highlightSelectedStars(){let t=["hovered"];e.all(".s-rating-stars-element",(s=>{let a=s.querySelectorAll(".s-rating-btn-star");s.addEventListener("mouseout",(()=>a.forEach((s=>s.classList.remove(...t))))),a.forEach(((s,i)=>{s.addEventListener("mouseover",(()=>{if(s.classList.add(...t),i<=1)"BUTTON"===s.previousElementSibling.tagName&&s.previousElementSibling.classList.add(...t);else for(let s=0;s<i;s++)a[s].classList.add(...t)})),s.addEventListener("mouseout",(()=>{s.classList.contains(...t)&&s.classList.remove(...t)}))}))}))}sendRating(){return e.all(".s-rating-step",(t=>{let s=t.dataset.type,a=[];t.querySelectorAll(".rating-outer-form").forEach((t=>{let i={};t.querySelectorAll("[name]").forEach((function(t){let s=salla.helpers.inputData(t.name,t.value,i);i[s.name]=s.value})),a=[],a.push(i),this.sendFeedback(s,a)}))})),this.ratingChain}sendFeedback(t,s){s&&0!=s.length&&(this.nextBtn.load(),salla.config.canLeave=!1,this.ratingChain=salla.feedback.api[t](s[0]).then((function(){salla.config.canLeave=!0})).catch((()=>salla.config.canLeave=!0)))}ratingValidation(){let t="";if(document.querySelectorAll(".s-rating-step.s-rating-active").forEach((s=>{s.querySelectorAll(".rating-outer-form").forEach((s=>{let a=s.querySelector(".rating_hidden_input"),i=s.querySelector(".s-rating-comment"),e=s.querySelector(".s-rating-validation-msg");if(a.value&&i.value&&i.value.length>3)return i.classList.remove("s-rating-has-error"),void(e.innerHTML="");i.value&&i.value.length>3?i.classList.remove("s-rating-has-error"):i.classList.add("s-rating-has-error"),t=a.value?salla.lang.get("common.errors.not_less_than_chars",{chars:4})+" "+i.getAttribute("placeholder"):s.dataset.starsError||salla.lang.get("pages.rating.rate_store_stars"),e.innerHTML=t}))})),t)throw new Error(t)}render(){return s(a,null,s("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>"},s("div",{class:"s-rating-wrapper "},this.isStoreRating&&this.renderStoreRating(),this.isProductsRating&&this.renderProductsRating(),this.isShippingRating&&this.renderShippingRating(),this.renderThanksView()),s("div",{class:"s-rating-footer"},s("button",{id:"prev-btn",class:"s-rating-btn s-rating-unvisiable"},salla.lang.get("pages.order.rating_prev")),this.stepsCount>1?s("ul",{class:"s-rating-dots"},[0,1,2].slice(0,this.stepsCount).map((t=>s("li",{class:(0==t?"s-rating-bg-primary":"s-rating-bg-gray")+" s-rating-step-dot"})))):"",s("salla-button",{id:"next-btn",ref:t=>this.nextBtn=t},"التالي"))))}renderStoreRating(){return s("section",{class:"s-rating-step","data-type":"store","data-step-name":salla.lang.get("pages.rating.rate")+" "+salla.lang.get("pages.rating.store")},s("div",{class:"rating-outer-form s-rating-step-wrap","data-stars-error":salla.lang.get("pages.rating.rate_store_stars")},s("input",{type:"hidden",name:"order_id",value:this.orderId}),s("input",{type:"hidden",name:"type",value:"store"}),s("div",{class:"s-rating-rounded-icon"},s("img",{src:this.order.storeLogo,alt:"store name",class:"s-rating-store-logo"})),s("h2",{class:"s-rating-title"},salla.lang.get("pages.rating.rate_the_store")),s("div",{class:"s-rating-stars-company"}," ",this.getStarsRating("large")),s("textarea",{id:"storeReview",name:"comment",class:"s-rating-comment",placeholder:salla.lang.get("pages.rating.write_store_rate")}),s("small",{class:"s-rating-validation-msg"})))}renderShippingRating(){return s("section",{class:"s-rating-step","data-type":"shipping","data-step-name":salla.lang.get("pages.rating.rate")+" "+salla.lang.get("pages.rating.shipping")},s("div",{class:"rating-outer-form s-rating-step-wrap","data-stars-error":salla.lang.get("pages.rating.rate_shipping_stars")},s("input",{type:"hidden",name:"order_id",value:this.orderId}),s("input",{type:"hidden",name:"shipping_company_id",value:this.order.shipping.id}),s("input",{type:"hidden",name:"type",value:"shipping"}),s("div",{class:"s-rating-rounded-icon"},s("img",{src:this.order.shippingLogo,alt:"company name",class:"s-rating-shipping-logo"})),s("h2",{class:"s-rating-title"}," ",salla.lang.get("pages.rating.rate_shipping")," ارامكس"),s("div",{class:"s-rating-stars-company"}," ",this.getStarsRating("large")),s("textarea",{id:"shippingReview",name:"comment",class:"s-rating-comment",placeholder:salla.lang.get("pages.rating.write_shipping_rate")}),s("small",{class:"s-rating-validation-msg"})))}renderProductsRating(){return s("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(((t,a)=>s("div",{class:"rating-outer-form s-rating-product","data-stars-error":salla.lang.get("pages.order.rate_product_stars")},s("img",{src:t.image,alt:t.title,class:"s-rating-product-img"}),s("div",{class:"s-rating-product-details"},s("h3",{class:"s-rating-product-title"}," ",t.title),s("div",{class:"s-rating-stars-product"}," ",this.getStarsRating("small")),s("input",{type:"hidden",name:"order_id",value:this.orderId}),s("input",{type:"hidden",name:`products[${a}][product_id]`,value:t.getOptimusRouteKey}),s("input",{type:"hidden",name:"type",value:"products"}),s("textarea",{"data-product-id":t.id,name:`products[${a}][comment]`,id:`productReview_${t.id}`,class:"s-rating-comment",placeholder:salla.lang.get("pages.rating.write_product_rate")}),s("small",{class:"s-rating-validation-msg"}))))))}renderThanksView(){return s("div",{class:"s-rating-thanks s-rating-hidden"},s("span",{class:"s-rating-thanks-icon sicon-check-circle2"}),s("h3",{class:"s-rating-thanks-title"},salla.lang.get("pages.rating.thanks")),s("div",{class:"s-rating-thanks-msg",innerHTML:this.thanksMsg}),s("a",{href:"#!",onClick:()=>this.hide(),class:"s-rating-thanks-btn"},"عودة إلي تفاصيل الطلب"),s("time",{class:"s-rating-thanks-time"}))}getStarsRating(t){return s("form",{class:"s-rating-stars-element"},s("input",{type:"hidden",class:"rating_hidden_input",name:"rating",value:""}),[1,2,3,4,5].map((a=>s("button",{type:"submit",class:"s-rating-btn-star s-rating-btn-star-"+t,"data-star":a},s("i",{class:"sicon-star2"})))))}get host(){return i(this)}};r.style=":host{display:block}.unicode{unicode-bidi:plaintext}";export{r as salla_rating}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as s,h as o,g as t}from"./p-cb1c59a2.js";const a=class{constructor(o){s(this,o),salla.offer.event.onExisted((s=>this.show(s.offer.offer_id)))}async show(s){this.modal.show(),console.log(s)}render(){return o("salla-modal",{ref:s=>this.modal=s,"is-loading":!0},o("slot",null))}componentDidLoad(){}get host(){return t(this)}};export{a as salla_offer}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as s,h as i,g as l}from"./p-cb1c59a2.js";import{H as t}from"./p-9bc28e0c.js";const e=class{constructor(i){s(this,i),this.regType="sms",this.loginTypeTitle=salla.lang.get("blocks.header.select_login_way"),this.loginText=salla.lang.get("blocks.header.login"),this.smsLabel=salla.lang.get("blocks.header.sms"),this.mobileLabel=salla.lang.get("common.elements.mobile"),this.emailLabel=salla.lang.get("common.elements.email"),this.enterText=salla.lang.get("blocks.header.enter"),this.bySMSText=salla.lang.get("blocks.header.login_by_sms"),this.byEmailText=salla.lang.get("blocks.header.login_by_email"),this.backText=salla.lang.get("common.elements.back"),this.title=this.host.title||salla.lang.get("blocks.header.login"),this.host.removeAttribute("title"),salla.auth.event.onVerificationFailed((()=>{}))}onVerified(s){if(s.detail.case){if("new_customer"===s.detail.case)return this.showTab(this.tab5);if("redirect"===salla.auth.event.getTypeActionOnVerified())return s.redirect_url?window.location.href=s.redirect_url:void window.location.reload()}else console.log("verified but without case!")}onModalClose(){this.showTab(this.tab1)}async show(){return this.modal.show()}showTab(s){[this.tab1,this.tab2,this.tab3,this.tab4,this.tab5].map((i=>t.toggleElement(i,"visible","hidden",(()=>i==s)))),[this.tab2,this.tab3].includes(s)&&(this.regType=s===this.tab2?"sms":"email");let i=s==this.tab5;return this.modal.setTitle(i?salla.lang.get("common.titles.registration"):this.title),i||t.toggleElement(this.regMobileBlock,"s-hidden","s-block",(()=>"sms"===this.regType)).toggleElement(this.regEmailBlock,"s-hidden","s-block",(()=>"email"===this.regType)),this}loginByEmail(){if(!t.isValidEmail(this.email.value))return this.email.classList.add("s-has-error"),void(this.email.nextElementSibling.innerText="* "+salla.lang.get("common.elements.email_is_valid"));this.email.nextElementSibling.innerText="",this.email.classList.remove("s-has-error"),salla.auth.api.login({type:"email",email:this.email.value}).then((()=>this.showTab(this.tab4))).then((()=>(this.tab4.by="email")&&(this.tab4.url="auth/email/verify"))).then((()=>this.tab4.show({email:this.email.value})))}loginBySMS(){if(this.mobile.value.length<6)return this.mobile.classList.add("s-has-error"),void(this.mobile.nextElementSibling.innerText="* "+salla.lang.get("mobile_app.strings.incorrect_mobile"));this.mobile.nextElementSibling.innerText="",this.mobile.classList.remove("s-has-error"),salla.auth.api.login({type:"sms",mobile:this.mobile.value}).then((()=>this.showTab(this.tab4))).then((()=>(this.tab4.by="sms")&&(this.tab4.url="auth/mobile/verify"))).then((()=>this.tab4.show({mobile:this.mobile.value,country_code:"SA"})))}typing({target:s}){"tel"===s.type&&salla.helpers.digitsOnly(s),s.classList.remove("s-has-error"),s.nextElementSibling.innerText=""}newUser(){this.tab4.getCode().then((s=>salla.auth.api.register({first_name:this.firstName.value,last_name:this.lastName.value,phone:this.regMobile.value||this.mobile.value,email:this.regEmail.value||this.email.value,country_code:"",country_key:"",code:s,verified_by:this.regType})))}render(){return i("salla-modal",{id:"salla-login",title:this.title,ref:s=>this.modal=s,width:"xs"},i("div",{class:"s-login-tab",ref:s=>this.tab1=s},i("p",{class:"s-login-sub-title"},this.loginTypeTitle),i("a",{href:"#",class:"s-login-main-btn",onClick:()=>this.showTab(this.tab2)},i("i",{class:"s-login-main-btn-icon sicon-phone"}),i("span",{class:"s-login-main-btn-text"},this.smsLabel),i("i",{class:"main-btn-arrow sicon-keyboard_arrow_left"})),i("a",{href:"#",class:"s-login-main-btn",onClick:()=>this.showTab(this.tab3)},i("i",{class:"s-login-main-btn-icon sicon-mail"}),i("span",{class:"s-login-main-btn-text"},this.emailLabel),i("i",{class:"main-btn-arrow sicon-keyboard_arrow_left"}))),i("div",{class:"s-login-tab",ref:s=>this.tab2=s},i("label",{class:"s-login-label"},this.mobileLabel),i("input",{type:"tel",ref:s=>this.mobile=s,onInput:this.typing,placeholder:"5xx xxx xxx",class:"s-login-input s-ltr"}),i("span",{class:"s-login-error-message"}),i("salla-button",{wide:!0,onClick:()=>this.loginBySMS()},this.enterText),i("a",{href:"#",onClick:()=>this.showTab(this.tab3),class:"s-login-link"},this.byEmailText)),i("div",{class:"s-login-tab",ref:s=>this.tab3=s},i("label",{class:"s-login-label"},this.emailLabel),i("input",{type:"email",ref:s=>this.email=s,onInput:this.typing,placeholder:"your@email.com",class:"s-login-input s-ltr"}),i("span",{class:"s-login-error-message"}),i("salla-button",{wide:!0,onClick:()=>this.loginByEmail()},this.enterText),i("a",{href:"#",onClick:()=>this.showTab(this.tab2),class:"s-login-link"},this.bySMSText)),i("salla-verify",{"without-modal":!0,ref:s=>this.tab4=s,autoReload:!1}),i("div",{ref:s=>this.tab5=s},i("label",{class:"s-login-label"},salla.lang.get("blocks.header.your_name")),i("div",{class:"s-login-input-group"},i("input",{type:"text",class:"s-login-input",ref:s=>this.firstName=s,placeholder:salla.lang.get("pages.profile.first_name")}),i("input",{type:"text",class:"s-login-input",ref:s=>this.lastName=s,placeholder:salla.lang.get("pages.profile.last_name")})),i("div",{ref:s=>this.regMobileBlock=s},i("label",{class:"s-login-label"},this.mobileLabel),i("input",{type:"tel",ref:s=>this.regMobile=s,onInput:this.typing,placeholder:"5xx xxx xxx",class:"s-login-input s-ltr"}),i("span",{class:"s-login-error-message"})),i("div",{ref:s=>this.regEmailBlock=s},i("label",{class:"s-login-label"},this.emailLabel),i("input",{type:"email",ref:s=>this.regEmail=s,onInput:this.typing,placeholder:"your@email.com",class:"s-login-input s-ltr"}),i("span",{class:"s-login-error-message"})),i("salla-button",{wide:!0,onClick:()=>this.newUser()},salla.lang.get("blocks.header.register"))))}componentDidRender(){this.showTab(this.tab1)}get host(){return l(this)}};export{e as S}
|
|
@@ -1 +0,0 @@
|
|
|
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}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as a,h as s,g as l}from"./p-cb1c59a2.js";import{H as i}from"./p-9bc28e0c.js";const t=class{constructor(s){var l,t;a(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===(l=i.getElement('[slot="language"]'))||void 0===l?void 0:l.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()}onChangeCurrency(a){this.currency=salla.config.currencies.filter((s=>s.code==a.target.value))[0]}onChangeLanguage(a){this.language=salla.config.languages.filter((s=>s.code==a.target.value))[0]}async submit(){let a;console.log("this.currency.code::::",this.currency,this.currency.code),this.btn.load().then((()=>this.currency.code===salla.config.currency.code||(a=window.location.href)&&salla.currency.api.change(this.currency.code))).then((()=>this.language.code===salla.config.language.code||(a=this.language.url))).then((()=>this.btn.stop())).then((()=>this.hide())).then((()=>a&&(window.location.href=a)))}render(){return s("salla-modal",{id:"salla-localization",class:"hidden",ref:a=>this.modal=a,"modal-width":"xs"},s("div",{slot:"header"},s("slot",{name:"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("div",{class:"s-localization-section-inner"},salla.config.languages.length<6?salla.config.languages.map((a=>s("div",{class:"s-localization-item"},s("input",{class:"s-localization-input",type:"radio",checked:this.language.code==a.code,onChange:()=>this.language=a,name:"language",id:"lang-"+a.code.toLowerCase(),value:a.code}),s("div",{id:"language-slot",innerHTML:this.languageSlot.replace(/\{name\}/g,a.name).replace(/\{code\}/g,a.code).replace(/\{country_code\}/g,a.country_code)})))):s("select",{class:"s-branches-select",name:"currency",onChange:a=>this.onChangeLanguage(a)},salla.config.languages.map((a=>s("option",{value:a.code,selected:this.language.code==a.code},a.name)))))):"",salla.config.currencies?s("div",{class:"s-localization-section"},s("label",{class:"s-localization-title"},this.currenciesTitle),s("div",{class:"s-localization-section-inner"},salla.config.currencies.length<6?salla.config.currencies.map((a=>s("div",{class:"s-localization-item"},s("input",{class:"s-localization-input",type:"radio",name:"currency",checked:this.currency.code==a.code,onChange:()=>this.currency=a,id:"currency-"+a.code,value:a.code}),s("div",{id:"currency-slot",innerHTML:this.currencySlot.replace(/\{name\}/g,a.name).replace(/\{code\}/g,a.code).replace(/\{country_code\}/g,a.country_code)})))):s("select",{class:"s-branches-select",name:"currency",onChange:a=>this.onChangeCurrency(a)},salla.config.currencies.map((a=>s("option",{value:a.code,selected:this.currency.code==a.code},a.name)))))):""),s("slot",{name:"footer"},s("salla-button",{wide:!0,ref:a=>this.btn=a,onClick:()=>this.submit()},this.ok)))}componentDidRender(){this.host.querySelectorAll("#currency-slot").forEach((a=>a.replaceWith(a.firstChild))),this.host.querySelectorAll("#language-slot").forEach((a=>a.replaceWith(a.firstChild)))}get host(){return l(this)}};export{t as salla_localization}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{S as salla_search}from"./p-36683152.js";import"./p-cb1c59a2.js";import"./p-9bc28e0c.js";
|
|
@@ -1 +0,0 @@
|
|
|
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}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as s,h as e,g as t}from"./p-cb1c59a2.js";let a=require("store/src/store-engine"),i=require("store/storages/sessionStorage"),h=a.createStore(i);const l=class{constructor(e){s(this,e),this.open=!1,this.isOpenedBefore=h.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?"s-branches-color-red":s.available?"s-branches-color-green":"s-branches-color-gray":this.currentBranch("limited")?"s-branches-color-red":this.currentBranch("available")?"s-branches-color-green":"s-branches-color-gray",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)})),h.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":"sm",id:"s-branches-modal",class:"hidden"},e("h4",{class:"s-branches-title"},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",{ref:s=>this.btn=s,onClick:()=>this.handleSubmit(),class:"s-branches-submit",wide:!0},salla.lang.get("common.elements.ok"))):"")}componentDidRender(){this.isOpenedBefore||"popup"!=this.displayAs||this.show()}get host(){return t(this)}};l.style=":host{display:block}";export{l as salla_branches}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as s,h as t,H as i,g as e,c as l}from"./p-cb1c59a2.js";import{H as a}from"./p-9bc28e0c.js";export{S as salla_login}from"./p-93c3ac79.js";const h=class{constructor(t){s(this,t),this.btnStyle="primary",this.loading=!1,this.disabled=!1,this.loaderPosition="before",this.wide=!1,this.hostAttributes={};for(let s=0;s<this.host.attributes.length;s++)this.hostAttributes[this.host.attributes[s].name]=this.host.attributes[s].value;this.hostAttributes.type=this.hostAttributes.type||"button",this.hostAttributes.class+=" s-button-btn btn--has-loading s-button-"+this.btnStyle+(this.wide?" s-button-wide ":"")+" loader-"+this.loaderPosition+("before"==this.loaderPosition?" s-button-loader-after":""),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.text.classList.add("s-button-hide"),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(s,t){this.btn.classList.remove("btn-"+t),this.btn.classList.add("btn-"+s)}handleLoading(s){a.toggleElement(this.btn,"btn--is-loading","btn--no-loading",(()=>s))}render(){return t(i,{class:"s-button-host-tag"},t("button",Object.assign({ref:s=>this.btn=s,disabled:this.disabled},this.hostAttributes),t("span",{class:"s-button-text",ref:s=>this.text=s},t("slot",null)),this.loading?t("span",{class:{"s-button-loader":!0,"s-button-loader-start":"start"===this.loaderPosition,"s-button-loader-end":"end"===this.loaderPosition,"s-button-loader-center":"center"===this.loaderPosition}}):""))}get host(){return e(this)}static get watchers(){return{btnStyle:["handleVisible"],loading:["handleLoading"]}}};h.style=":host{display:block}";const o=class{constructor(t){var i;s(this,t),this.modalOpened=l(this,"modalOpened",7),this.modalClosed=l(this,"modalClosed",7),this.error=!1,this.success=!1,this.primary=!1,this.isClosable=!0,this.width="md",this.visible=!1,this.isLoading=!1,this.subTitleFirst=!1,this.subTitle="",this.icon="",this.imageIcon="",a.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===(i=a.getElement("[slot=body]"))||void 0===i||i.classList.add("s-modal-body","s-modal-"+this.width)}handleVisible(s){if(!s)return this.toggleModal(!1),void this.modalClosed.emit();this.host.classList.remove("hidden"),setTimeout((()=>this.toggleModal(!0))),this.modalOpened.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}async loading(){return this.isLoading=!0,this.host}async stopLoading(){return this.isLoading=!1,this.host}toggleModal(s){a.toggleElement(this.host.querySelector("[slot=body]")||this.host,"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",t(i,{class:"s-modal-container hidden","aria-modal":"true",role:"dialog"},t("div",{class:"s-modal-wrapper"},t("div",{class:"s-modal-overlay",ref:s=>this.overlay=s,onClick:()=>this.closeModal()}),t("span",{class:"s-modal-spacer"},""),t("slot",{name:"body"},t("div",{class:"s-modal-body s-modal-"+this.width,slot:"body"},this.isLoading?t("span",null,"Loading..."):[t("div",{class:{"s-modal-header":!0,"s-modal-is-center":""!=this.icon||""!=this.imageIcon}},this.isClosable?t("button",{class:"s-modal-close cursor-pointer",onClick:()=>this.closeModal(),type:"button"},t("span",{class:"sicon-cancel"})):"",this.error||this.success||this.icon?t("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,"s-modal-bg-primary":this.primary}},t("i",{class:{[this.icon]:!0,"s-modal-text-error":this.error,"s-modal-text-success":this.success}})):this.imageIcon?t("img",{class:"s-modal-header-img",src:this.imageIcon}):"",this.title||this.subTitle?t("div",{class:"s-modal-header-content"},t("div",{class:{"s-modal-title":!0,"s-modal-title-below":this.subTitleFirst},innerHTML:this.title}),t("p",{class:{"s-modal-sub-title":!0},innerHTML:this.subTitle})):""),t("slot",null),t("slot",{name:"footer"})]))))}get host(){return e(this)}static get watchers(){return{visible:["handleVisible"]}}},r=class{constructor(t){s(this,t),this.verified=l(this,"verified",7),this.url="profile/verify-mobile",this.by="sms",this.autoReload=!0,a.setHost(this.host),this.withoutModal?this.modal={show:()=>"",hide:()=>""}:salla.event.on("profile::verify.mobile",(s=>this.show(s)))}async getCode(){return this.code.value}async show(s){return this.data=s,this.resendTimer(),this.otpInputs=document.querySelectorAll(".s-verify-input"),this.otpInputs[0].focus(),a.on("input",".s-verify-input",(s=>salla.helpers.digitsOnly(s.target))),a.onKeyUp(".s-verify-input",(s=>{var t,i,e,l;let a=s.keyCode||s.charCode;s.target.value?(null===(t=s.target.nextElementSibling)||void 0===t||t.focus(),null===(i=s.target.nextElementSibling)||void 0===i||i.select()):[8,46].includes(a)&&(null===(e=s.target.previousElementSibling)||void 0===e||e.focus(),null===(l=s.target.previousElementSibling)||void 0===l||l.select()),this.toggleOTPSubmit()})),a.on("paste",".s-verify-input",(s=>{let t=s.clipboardData.getData("text").toArabicDigits().replace(/[^0-9.]/g,"").replace("..",".");this.otpInputs.forEach(((s,i)=>s.value=t[i]||"")),this.toggleOTPSubmit(),setTimeout((()=>this.otpInputs[3].focus()),100)})),this.modal.show()}toggleOTPSubmit(){let s=[];if(this.otpInputs.forEach((t=>t.value&&s.push(t.value))),this.code.value=s.join(""),4===s.length)return this.btn.removeAttribute("disabled"),void this.btn.click();this.btn.setAttribute("disabled","")}resendTimer(){a.showElement(this.resendMessage).hideElement(this.resend);let s=30,t=setInterval((()=>{-1===s?(clearTimeout(t),a.hideElement(this.resendMessage).showElement(this.resend)):(this.timer.innerHTML=`${s>=10?s:"0"+s} : 00`,s--)}),1e3)}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(Object.assign({resend_by:this.by},this.data)))).then((()=>this.resendTimer())).catch((()=>this.resendTimer()))}submit(){return this.btn.load().then((()=>this.btn.disable())).then((()=>salla.document.api.request(this.url,Object.assign({code:this.code.value},this.data)))).then((s=>this.verified.emit(s))).then((()=>this.btn.stop()&&this.btn.disable())).then((()=>this.modal.hide())).then((()=>this.autoReload&&window.location.reload())).catch((()=>this.btn.stop()&&this.btn.enable()))}render(){return this.withoutModal?this.myBody():t("salla-modal",{id:"s-verify",ref:s=>this.modal=s,title:salla.lang.get("pages.profile.verify_title")},this.myBody())}myBody(){return[t("div",{class:"s-verify-message",innerHTML:salla.lang.get("pages.profile.verify_message")}),t("label",{class:"s-verify-label"},salla.lang.get("pages.profile.verify_placeholder")),t("input",{type:"hidden",name:"code",maxlength:"4",required:!0,ref:s=>this.code=s}),t("div",{class:"s-verify-codes",dir:"ltr"},[1,2,3,4].map((()=>t("input",{type:"text",maxlength:"1",class:"s-verify-input",required:!0})))),t("div",{slot:"footer",class:"s-verify-footer"},t("salla-button",{class:"s-verify-submit",disabled:!0,onClick:()=>this.submit(),ref:s=>this.btn=s},salla.lang.get("pages.profile.verify")),t("p",{class:"s-verify-resend-message",ref:s=>this.resendMessage=s},salla.lang.get("blocks.header.resend_after"),t("b",{class:"s-verify-timer",ref:s=>this.timer=s})),t("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{h as salla_button,o as salla_modal,r as salla_verify}
|