@salla.sa/twilight-components 1.0.13 → 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 +5 -2
- 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 +2 -2
- 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 -0
- 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
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-0b5b5867.js');
|
|
6
|
+
const Helper = require('./Helper-8852feaa.js');
|
|
7
|
+
|
|
8
|
+
const sallaRatingCss = ":host{display:block}";
|
|
9
|
+
|
|
10
|
+
const SallaRating = class {
|
|
11
|
+
constructor(hostRef) {
|
|
12
|
+
index.registerInstance(this, hostRef);
|
|
13
|
+
this.stars = [1, 2, 3, 4, 5];
|
|
14
|
+
this.order = {
|
|
15
|
+
shipping: { id: 5622 },
|
|
16
|
+
products: [
|
|
17
|
+
{
|
|
18
|
+
"title": "ميكروفون عالى الجودة",
|
|
19
|
+
"image": "https://salla-dev.s3.eu-central-1.amazonaws.com/Mvyk/pMdEEyMVpZFj4L1Hrdm2g48AuiSx0TrKULBiOnPo.jpg",
|
|
20
|
+
"price": "10,978.00 ر.س",
|
|
21
|
+
"qty": "2",
|
|
22
|
+
"totalBefore": "1120 ر.س",
|
|
23
|
+
"discount": "-5%",
|
|
24
|
+
"total": "1064 ر.س",
|
|
25
|
+
"id": "2314513454",
|
|
26
|
+
"getOptimusRouteKey": "7351233357"
|
|
27
|
+
},
|
|
28
|
+
// {
|
|
29
|
+
// "title": "وحدة تحكم لمشغل العاب",
|
|
30
|
+
// "image": "https://salla-dev.s3.eu-central-1.amazonaws.com/Mvyk/NOa4kHvOkd1hBWHk3JIgAo1602oVACfuWGFz3vXv.jpg",
|
|
31
|
+
// "price": "10,978.00 ر.س",
|
|
32
|
+
// "qty": "2",
|
|
33
|
+
// "totalBefore": "1120 ر.س",
|
|
34
|
+
// "discount": "-5%",
|
|
35
|
+
// "total": "1064 ر.س",
|
|
36
|
+
// "id": "9842833",
|
|
37
|
+
// "getOptimusRouteKey": "735152357"
|
|
38
|
+
// },
|
|
39
|
+
{
|
|
40
|
+
"title": "ساعة ذكية بنظام اندرويد",
|
|
41
|
+
"image": "https://salla-dev.s3.eu-central-1.amazonaws.com/Mvyk/T4kTqYNuPAZmPMLw1bx92RnjVMZyFszVXOUZQsFJ.jpg",
|
|
42
|
+
"price": "10,978.00 ر.س",
|
|
43
|
+
"qty": "2",
|
|
44
|
+
"totalBefore": "1120 ر.س",
|
|
45
|
+
"discount": "-5%",
|
|
46
|
+
"total": "1064 ر.س",
|
|
47
|
+
"id": "679822376",
|
|
48
|
+
"getOptimusRouteKey": "73233357"
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
};
|
|
52
|
+
this.isProductsRating = false;
|
|
53
|
+
this.ratingChain = Promise.resolve();
|
|
54
|
+
this.stepsCount = 0;
|
|
55
|
+
Helper.Helper.setHost(this.host);
|
|
56
|
+
}
|
|
57
|
+
async show() {
|
|
58
|
+
return this.modal.show();
|
|
59
|
+
}
|
|
60
|
+
async hide() {
|
|
61
|
+
return this.modal.hide();
|
|
62
|
+
}
|
|
63
|
+
componentWillLoad() {
|
|
64
|
+
this.stepsCount = [this.isStoreRating, this.isProductsRating, this.isShippingRating].filter(item => item).length;
|
|
65
|
+
this.getData();
|
|
66
|
+
}
|
|
67
|
+
componentDidRender() {
|
|
68
|
+
this.show();
|
|
69
|
+
this.initiateRating();
|
|
70
|
+
}
|
|
71
|
+
initiateRating() {
|
|
72
|
+
this.highlightSelectedStars();
|
|
73
|
+
this.starsRating();
|
|
74
|
+
this.handleWizard();
|
|
75
|
+
const step = this.host.querySelector('.step:first-child');
|
|
76
|
+
this.setModalHeight(step);
|
|
77
|
+
salla.event.on('submit::order-rating', () => this.sendRating().then(() => {
|
|
78
|
+
let seconds = 10;
|
|
79
|
+
let timeToClose = setInterval(() => {
|
|
80
|
+
seconds--;
|
|
81
|
+
this.host.querySelector('.close-time').innerHTML = `00:0${seconds}`;
|
|
82
|
+
if (seconds == 0) {
|
|
83
|
+
this.hide();
|
|
84
|
+
clearInterval(timeToClose);
|
|
85
|
+
}
|
|
86
|
+
}, 1000);
|
|
87
|
+
this.host.querySelector('.wizard-footer').classList.add('opacity-0', 'pointer-events-0');
|
|
88
|
+
Helper.Helper.toggle('.step', 'hidden', 'block', () => true);
|
|
89
|
+
Helper.Helper.toggle('.thankyou-view', 'is-opened', 'hidden', () => true);
|
|
90
|
+
const thankYouView = this.host.querySelector('.thankyou-view');
|
|
91
|
+
this.setModalHeight(thankYouView);
|
|
92
|
+
setTimeout(() => {
|
|
93
|
+
Helper.Helper.toggleElement(thankYouView, ['opacity-1', 'translate-x-0'], ['opacity-0', 'translate-x-3'], () => true);
|
|
94
|
+
}, 200);
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
97
|
+
// handle wizard
|
|
98
|
+
handleWizard() {
|
|
99
|
+
var _a;
|
|
100
|
+
let index = 0, steps = this.host.querySelectorAll(".step"), dots = this.host.querySelectorAll(".step-dot"), nextBtnText = this.host.querySelector('#next-btn .btn-text');
|
|
101
|
+
// show first step
|
|
102
|
+
this.showActiveStep(steps, dots, index);
|
|
103
|
+
// handle btn text
|
|
104
|
+
nextBtnText.innerHTML = ((_a = steps[index + 1]) === null || _a === void 0 ? void 0 : _a.dataset.stepName) || 'إرسال التقييم';
|
|
105
|
+
Helper.Helper.onClick("#prev-btn", () => {
|
|
106
|
+
var _a;
|
|
107
|
+
index > 0 && index--;
|
|
108
|
+
this.showActiveStep(steps, dots, index);
|
|
109
|
+
nextBtnText.innerHTML = ((_a = steps[index + 1]) === null || _a === void 0 ? void 0 : _a.dataset.stepName) || 'إرسال التقييم';
|
|
110
|
+
index == 0 && Helper.Helper.toggle('#prev-btn', ['pointer-events-none', 'opacity-0'], 'block', () => true);
|
|
111
|
+
});
|
|
112
|
+
Helper.Helper.onClick("#next-btn", () => {
|
|
113
|
+
var _a;
|
|
114
|
+
this.ratingValidation();
|
|
115
|
+
if (index == this.stepsCount - 1) {
|
|
116
|
+
salla.event.dispatch("submit::order-rating");
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
index < this.stepsCount - 1 && index++;
|
|
120
|
+
this.showActiveStep(steps, dots, index);
|
|
121
|
+
nextBtnText.innerHTML = ((_a = steps[index + 1]) === null || _a === void 0 ? void 0 : _a.dataset.stepName) || 'إرسال التقييم';
|
|
122
|
+
Helper.Helper.toggle('#prev-btn', 'block', ['pointer-events-none', 'opacity-0'], () => true);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
showActiveStep(steps, dots, currentIndex) {
|
|
127
|
+
Helper.Helper.toggle('.step-dot', 'bg-gray-200', 'bg-primay', () => true);
|
|
128
|
+
this.stepsCount > 1 && Helper.Helper.toggleElement(dots[currentIndex], 'bg-primary', 'bg-gray-200', () => true);
|
|
129
|
+
// hide all steps
|
|
130
|
+
Helper.Helper.toggle('.step', ['hidden', 'opacity-0', 'translate-x-3'], ['active', 'opacity-1', 'translate-x-0'], () => true);
|
|
131
|
+
Helper.Helper.toggleElement(steps[currentIndex], 'active', 'hidden', () => true);
|
|
132
|
+
this.setModalHeight(steps[currentIndex]);
|
|
133
|
+
setTimeout(() => {
|
|
134
|
+
Helper.Helper.toggleElement(steps[currentIndex], ['opacity-1', 'translate-x-0'], ['opacity-0', 'translate-x-3',], () => true);
|
|
135
|
+
}, 200);
|
|
136
|
+
}
|
|
137
|
+
setModalHeight(current) {
|
|
138
|
+
const wrapper = this.host.querySelector('.s-order-rating-steps-wrapper');
|
|
139
|
+
setTimeout(() => {
|
|
140
|
+
wrapper === null || wrapper === void 0 ? void 0 : wrapper.setAttribute('style', 'height:' + (current === null || current === void 0 ? void 0 : current.scrollHeight) + 'px');
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
// send feedback rating and validation
|
|
144
|
+
sendRating() {
|
|
145
|
+
Helper.Helper.all('.rating-section', ratingSection => {
|
|
146
|
+
let type = ratingSection.dataset.type;
|
|
147
|
+
let formsData = [];
|
|
148
|
+
ratingSection.querySelectorAll('.rating-outer-form')
|
|
149
|
+
.forEach((form) => {
|
|
150
|
+
let formData = {};
|
|
151
|
+
form.querySelectorAll('[name]')
|
|
152
|
+
.forEach(function (input) {
|
|
153
|
+
let inputData = salla.helpers.inputData(input.name, input.value, formData);
|
|
154
|
+
formData[inputData.name] = inputData.value;
|
|
155
|
+
});
|
|
156
|
+
formsData = [];
|
|
157
|
+
formsData.push(formData);
|
|
158
|
+
this.sendFeedback(type, formsData);
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
return this.ratingChain;
|
|
162
|
+
}
|
|
163
|
+
sendFeedback(type, formsData) {
|
|
164
|
+
if (!formsData || formsData.length == 0) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
this.nextBtn.load();
|
|
168
|
+
salla.config.canLeave = false;
|
|
169
|
+
this.ratingChain = salla.feedback.api[type](formsData[0])
|
|
170
|
+
.then(function () {
|
|
171
|
+
salla.config.canLeave = true;
|
|
172
|
+
}).catch(() => salla.config.canLeave = true);
|
|
173
|
+
}
|
|
174
|
+
ratingValidation() {
|
|
175
|
+
let errorMsg = '';
|
|
176
|
+
document.querySelectorAll('.rating-section.active')
|
|
177
|
+
.forEach((ratingSection) => {
|
|
178
|
+
ratingSection.querySelectorAll('.rating-outer-form')
|
|
179
|
+
.forEach((rating) => {
|
|
180
|
+
let ratingInput = rating.querySelector('.rating_hidden_input');
|
|
181
|
+
let commentInput = rating.querySelector('.comment');
|
|
182
|
+
// let sectionTitle = rating.querySelector('.section-title');
|
|
183
|
+
let validationMessage = rating.querySelector('.validation-message');
|
|
184
|
+
if (ratingInput.value && commentInput.value && commentInput.value.length > 3) {
|
|
185
|
+
commentInput.classList.remove('has-error');
|
|
186
|
+
// sectionTitle?.classList.remove('has-error', 'text-red-400');
|
|
187
|
+
validationMessage.innerHTML = '';
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
else if (commentInput.value && commentInput.value.length > 3) {
|
|
191
|
+
commentInput.classList.remove('has-error');
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
commentInput.classList.add('has-error');
|
|
195
|
+
}
|
|
196
|
+
// sectionTitle?.classList.add('has-error', 'text-red-400');
|
|
197
|
+
errorMsg = ratingInput.value
|
|
198
|
+
? (salla.lang.get('common.errors.not_less_than_chars', { chars: 4 }) + ' ' + commentInput.getAttribute('placeholder'))
|
|
199
|
+
: (rating.dataset.starsError || salla.lang.get('pages.rating.rate_store_stars'));
|
|
200
|
+
validationMessage.innerHTML = errorMsg;
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
//Fire error to prevent sending rating
|
|
204
|
+
if (errorMsg) {
|
|
205
|
+
// scroll to first error
|
|
206
|
+
let ratingErrors = document.querySelectorAll('.has-error');
|
|
207
|
+
if (ratingErrors.length) {
|
|
208
|
+
let firstError = ratingErrors[0].offsetTop;
|
|
209
|
+
window.scrollTo({ top: firstError - 80 }); // 80 = fixed nav height
|
|
210
|
+
}
|
|
211
|
+
throw new Error(errorMsg);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
// getdata
|
|
215
|
+
getData() {
|
|
216
|
+
salla.api.order.endpointsMethods.details = 'get';
|
|
217
|
+
salla.order.api.details(salla.config.page.id).then(data => console.log(data));
|
|
218
|
+
}
|
|
219
|
+
// handle star rating
|
|
220
|
+
starsRating() {
|
|
221
|
+
let selectedClasses = ['selected', 'text-theme-yellow'];
|
|
222
|
+
// Listen for form submissions
|
|
223
|
+
salla.document.event.onSubmit('.rate-element', function (event) {
|
|
224
|
+
// Prevent form from submitting
|
|
225
|
+
event.preventDefault();
|
|
226
|
+
// Get the selected star - activeElement is not supported in safari
|
|
227
|
+
var activeStars = event.target.querySelectorAll('.btn--star.hovered');
|
|
228
|
+
var selected = activeStars[activeStars.length - 1];
|
|
229
|
+
if (!selected)
|
|
230
|
+
return;
|
|
231
|
+
var selectedIndex = parseInt(selected.dataset.star, 10);
|
|
232
|
+
event.target.querySelector('.rating_hidden_input').value = selectedIndex;
|
|
233
|
+
// Get all stars in this form (only search in the form, not the whole document)
|
|
234
|
+
// Loop through each star, and add or remove the `.selected` class to toggle highlighting
|
|
235
|
+
event.target
|
|
236
|
+
.querySelectorAll('.btn--star')
|
|
237
|
+
.forEach(function (star, index) {
|
|
238
|
+
if (index < selectedIndex) {
|
|
239
|
+
// Selected star or before it, Add highlighting
|
|
240
|
+
star.classList.add(...selectedClasses);
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
// After selected star, Remove highlight
|
|
244
|
+
star.classList.remove(...selectedClasses);
|
|
245
|
+
});
|
|
246
|
+
// Remove aria-pressed from any previously selected star
|
|
247
|
+
var previousRating = event.target.querySelector('.star[aria-pressed="true"]');
|
|
248
|
+
if (previousRating) {
|
|
249
|
+
previousRating.removeAttribute('aria-pressed');
|
|
250
|
+
}
|
|
251
|
+
// Add aria-pressed role to the selected button
|
|
252
|
+
selected.setAttribute('aria-pressed', true);
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
highlightSelectedStars() {
|
|
256
|
+
let hover = ['hovered', 'text-theme-yellow'];
|
|
257
|
+
Helper.Helper.all('.rate-element', el => {
|
|
258
|
+
let starElements = el.querySelectorAll('.btn--star');
|
|
259
|
+
// remove hovered state from stars ---
|
|
260
|
+
el.addEventListener('mouseout', () => el.querySelectorAll('.btn--star').forEach(star => star.classList.remove(...hover)));
|
|
261
|
+
starElements.forEach((starElement, index) => {
|
|
262
|
+
starElement.addEventListener('mouseover', () => {
|
|
263
|
+
starElement.classList.add(...hover);
|
|
264
|
+
if (index <= 1) {
|
|
265
|
+
starElement.previousElementSibling.tagName === 'BUTTON' ? starElement.previousElementSibling.classList.add(...hover) : null;
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
for (let i = 0; i < index; i++) {
|
|
269
|
+
starElements[i].classList.add(...hover);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
starElement.addEventListener('mouseout', () => {
|
|
274
|
+
starElement.classList.contains(...hover) ? starElement.classList.remove(...hover) : null;
|
|
275
|
+
});
|
|
276
|
+
});
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
// render
|
|
280
|
+
render() {
|
|
281
|
+
return (index.h(index.Host, null, index.h("salla-modal", { class: "hidden", "modal-width": "w-[800px]", ref: modal => this.modal = modal, title: salla.lang.get('pages.rating.rate_order') + ' <span class="unicode">(#' + this.orderId + ')</span>' }, index.h("div", { class: "s-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()), index.h("div", { class: "wizard-footer relative flex justify-between items-center" }, index.h("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" }, "\u0627\u0644\u0633\u0627\u0628\u0642"), this.stepsCount > 1 ?
|
|
282
|
+
index.h("ul", { class: "flex justify-center text-center space-s-1.5 flex-1" }, [0, 1, 2].slice(0, this.stepsCount).map(index$1 => index.h("li", { class: `${index$1 == 0 ? 'bg-primary' : 'bg-gray-200'} step-dot w-2.5 h-2.5 rounded-full transition-colors duration-300` }))) : '', index.h("salla-button", { id: "next-btn", class: "w-28", ref: nextBtn => this.nextBtn = nextBtn }, "\u0627\u0644\u062A\u0627\u0644\u064A")))));
|
|
283
|
+
}
|
|
284
|
+
renderStoreRating() {
|
|
285
|
+
return (index.h("section", { class: "step rating-section active transition-all duration-500 opacity-0 translate-x-3 hidden", "data-type": "store", "data-step-name": "\u062A\u0642\u064A\u064A\u0645 \u0627\u0644\u0645\u062A\u062C\u0631" }, index.h("div", { class: "rating-outer-form", "data-stars-error": salla.lang.get('pages.rating.rate_store_stars') }, index.h("input", { type: "hidden", name: "order_id", value: this.orderId }), index.h("input", { type: "hidden", name: "type", value: "store" }), index.h("div", { class: "flex flex-col items-center " }, index.h("div", { class: "w-28 h-28 border border-gray-200 rounded-full flex items-center justify-center mb-4" }, index.h("img", { src: "https://salla-dev.s3.eu-central-1.amazonaws.com/Mvyk/X3NKcY7nhaFQlR7kBBHvfDpMY48cerunKrmDA1gi.png", alt: "store name", class: "w-12 object-contain" })), index.h("h2", { class: "section-title text-lg font-bold mb-4" }, salla.lang.get('pages.rating.rate_the_store'))), index.h("div", { class: "rating-wrap flex items-center flex justify-center mb-4" }, index.h("form", { class: "rate-element rate-element--has-label" }, this.getStarsRating())), index.h("textarea", { id: "storeReview", name: "comment", class: "form-input comment h-20", placeholder: salla.lang.get('pages.rating.write_store_rate') }), index.h("small", { class: "text-red-400 validation-message" }))));
|
|
286
|
+
}
|
|
287
|
+
renderProductsRating() {
|
|
288
|
+
return (index.h("section", { class: "step rating-section products-section transition-all duration-500 opacity-0 translate-x-3 hidden", "data-type": "product", "data-step-name": "\u062A\u0642\u064A\u064A\u0645 \u0627\u0644\u0645\u0646\u062A\u062C\u0627\u062A" }, index.h("div", { class: "overflow-hidden" }, this.order.products.map((item, index$1) => index.h("div", { class: "rating-outer-form mb-8 last:mb-0", "data-stars-error": salla.lang.get('pages.rating.rate_product_stars', { "item": item.title }) }, index.h("div", { class: "product-item" }, index.h("div", { class: "flex space-s-5" }, index.h("img", { src: item.image, alt: item.title, class: "w-18 h-14 object-cover rounded-md" }), index.h("div", { class: "flex-1" }, index.h("h3", { class: "section-title leading-5 mb-1.5 font-bold md:text-sm" }, " ", item.title), index.h("div", { class: "rw-product-entry__rate" }, index.h("div", { class: "rating-wrap flex items-center space-s-4" }, index.h("form", { class: "rate-element rate-element--has-label" }, this.getStarsRating())), index.h("input", { type: "hidden", name: "order_id", value: this.orderId }), index.h("input", { type: "hidden", name: `products[${index$1}][product_id]`, value: item.getOptimusRouteKey }), index.h("input", { type: "hidden", name: "type", value: "products" }), index.h("textarea", { "data-product-id": item.id, name: `products[${index$1}][comment]`, id: `productReview_${item.id}`, class: "comment form-input h-20 product-review", placeholder: salla.lang.get('pages.rating.write_product_rate') }), index.h("small", { class: "text-red-400 validation-message" }))))))))));
|
|
289
|
+
}
|
|
290
|
+
renderShippingRating() {
|
|
291
|
+
return (index.h("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": "\u062A\u0642\u064A\u064A\u0645 \u0634\u0631\u0643\u0629 \u0627\u0644\u0634\u062D\u0646" }, index.h("div", { class: "rating-outer-form", "data-stars-error": salla.lang.get('pages.rating.rate_shipping_stars') }, index.h("input", { type: "hidden", name: "order_id", value: this.orderId }), index.h("input", { type: "hidden", name: "shipping_company_id", value: this.order.shipping.id }), index.h("input", { type: "hidden", name: "type", value: "shipping" }), index.h("div", { class: "flex flex-col items-center " }, index.h("div", { class: "w-28 h-28 overflow-hidden border border-gray-200 rounded-full flex items-center justify-center mb-4" }, index.h("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" })), index.h("h2", { class: "section-title text-lg font-bold mb-4" }, " ", salla.lang.get('pages.rating.rate_shipping'), " \u0627\u0631\u0627\u0645\u0643\u0633")), index.h("div", { class: "rating-wrap flex flex justify-center mb-4" }, index.h("form", { class: "rate-element ratFeedbackPresentere-element--has-label" }, this.getStarsRating())), index.h("textarea", { id: "shippingReview", name: "comment", class: "form-input comment h-20 mb-2", placeholder: salla.lang.get('pages.rating.write_shipping_rate') }), index.h("small", { class: "text-red-400 validation-message" }))));
|
|
292
|
+
}
|
|
293
|
+
renderThanksView() {
|
|
294
|
+
return (index.h("div", { class: "thankyou-view px-8 text-center transition-all duration-500 opacity-0 translate-x-3 hidden" }, index.h("span", { class: "w-20 h-20 text-4xl inline-flex justify-center items-center bg-gray-50 rounded-full text-primary sicon-check-circle2" }), index.h("div", { class: "mt-4 mb-6" }, index.h("h3", { class: "font-bold" }, salla.lang.get('pages.rating.thanks')), index.h("div", { class: "text-gray-400 text-sm", innerHTML: this.thanksMsg })), index.h("a", { href: "#!", onClick: () => this.hide(), class: "btn btn-primary h-10 flex-none px-8" }, "\u0639\u0648\u062F\u0629 \u0625\u0644\u064A \u062A\u0641\u0627\u0635\u064A\u0644 \u0627\u0644\u0637\u0644\u0628"), index.h("time", { class: "close-time text-gray-400 block h-6 mt-3 text-sm" })));
|
|
295
|
+
}
|
|
296
|
+
getStarsRating() {
|
|
297
|
+
return (index.h("div", { class: "mb-1" }, index.h("input", { type: "hidden", class: "rating_hidden_input", name: "rating", value: "" }), this.stars.map((star) => index.h("button", { type: "submit", class: "btn btn--transparent px-1 text-2xl text-gray-400 btn--star", "data-star": star }, index.h("i", { class: "sicon-star2" })))));
|
|
298
|
+
}
|
|
299
|
+
get host() { return index.getElement(this); }
|
|
300
|
+
};
|
|
301
|
+
SallaRating.style = sallaRatingCss;
|
|
302
|
+
|
|
303
|
+
exports.salla_rating = SallaRating;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index-0b5b5867.js');
|
|
4
|
+
const Helper = require('./Helper-8852feaa.js');
|
|
5
|
+
|
|
6
|
+
const SallaSearch = class {
|
|
7
|
+
constructor(hostRef) {
|
|
8
|
+
index.registerInstance(this, hostRef);
|
|
9
|
+
var _a, _b;
|
|
10
|
+
this.results = [];
|
|
11
|
+
/**
|
|
12
|
+
* Override search placeholder.
|
|
13
|
+
*/
|
|
14
|
+
this.placeholder = salla.lang.get('blocks.header.search_placeholder');
|
|
15
|
+
/**
|
|
16
|
+
* Override no results error message.
|
|
17
|
+
*/
|
|
18
|
+
this.noResultsText = salla.lang.get('common.elements.no_options');
|
|
19
|
+
Helper.Helper.setHost(this.host);
|
|
20
|
+
this.buttonSlot = ((_a = Helper.Helper.getElement('[slot="button"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || '<i class="sicon-search font-bold"></i>';
|
|
21
|
+
this.productSlot = ((_b = Helper.Helper.getElement('[slot="product"]')) === null || _b === void 0 ? void 0 : _b.innerHTML) || this.getDefaultProductSlot();
|
|
22
|
+
}
|
|
23
|
+
onModalClose() {
|
|
24
|
+
Helper.Helper.getElement('.s-search-input').value = '';
|
|
25
|
+
this.results = [];
|
|
26
|
+
this.afterSearching();
|
|
27
|
+
}
|
|
28
|
+
getDefaultProductSlot() {
|
|
29
|
+
return '<a target="_blank" href={url} class="s-search-product-image-container">' +
|
|
30
|
+
' <img class="s-search-product-image" src="{image}" alt="{name}"/>' +
|
|
31
|
+
'</a>' +
|
|
32
|
+
'<div class="s-search-product-details">' +
|
|
33
|
+
' <div class="s-search-product-name">{name}</div> <div class="s-search-product-price">{price}</div>' +
|
|
34
|
+
'</div>';
|
|
35
|
+
}
|
|
36
|
+
//todo:: reset data when closing
|
|
37
|
+
search(e) {
|
|
38
|
+
Helper.Helper.hideElement(this.noResults);
|
|
39
|
+
if (e.target.value.length === 0) {
|
|
40
|
+
this.results = [];
|
|
41
|
+
this.afterSearching();
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (e.target.value.length <= 2) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
//run loading spinner or stop it
|
|
48
|
+
Helper.Helper.toggleElement(this.searchIcon, 's-search-spinner-loader', 'sicon-search', () => true);
|
|
49
|
+
salla.search.api.search(e.target.value)
|
|
50
|
+
.then(response => this.results = response.results)
|
|
51
|
+
.catch(err => err !== 'Query Same As Previous!' ? this.results = [] : null)
|
|
52
|
+
.finally(() => this.afterSearching(/*isEmpty*/ false));
|
|
53
|
+
}
|
|
54
|
+
afterSearching(isEmpty = true) {
|
|
55
|
+
this.noResults.style.display = isEmpty || this.results.length > 0 ? 'none' : 'block';
|
|
56
|
+
Helper.Helper.toggleElement(this.container, 's-search-container-open', 'no-results', () => this.results.length)
|
|
57
|
+
.toggleElement(this.searchIcon, 's-search-spinner-loader', 'sicon-search', () => false); //stop searching anime
|
|
58
|
+
salla.search.api.previousQuery = ''; //avoid having error 'Query Same As Previous' after reopen modal;
|
|
59
|
+
}
|
|
60
|
+
render() {
|
|
61
|
+
var _a;
|
|
62
|
+
return (index.h(index.Host, { class: "s-search" }, index.h("button", { onClick: () => this.modal.show(), class: "s-search-button-icon", innerHTML: this.buttonSlot }), index.h("salla-modal", { ref: modal => this.modal = modal }, index.h("div", { class: "s-search-container", slot: "body", ref: container => this.container = container }, index.h("input", { class: "s-search-input", type: "text", placeholder: this.placeholder, onInput: e => this.search(e) }), index.h("span", { class: "s-search-icon" }, index.h("i", { class: "sicon-search", ref: el => this.searchIcon = el })), index.h("div", { class: "s-search-results" }, (_a = this.results) === null || _a === void 0 ? void 0 :
|
|
63
|
+
_a.map(item => {
|
|
64
|
+
var _a;
|
|
65
|
+
return index.h("div", { class: "s-search-product", innerHTML: this.productSlot
|
|
66
|
+
.replace(/\{name\}/g, item.title)
|
|
67
|
+
.replace(/\{price\}/g, (_a = item.price) === null || _a === void 0 ? void 0 : _a.after) //todo:: get discounted price too
|
|
68
|
+
.replace(/\{url\}/g, item.url)
|
|
69
|
+
.replace(/\{image\}/g, item.thumb) });
|
|
70
|
+
}), index.h("p", { ref: el => this.noResults = el, class: "s-search-no-results" }, this.noResultsText))))));
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Run it one time after load
|
|
74
|
+
*/
|
|
75
|
+
componentDidLoad() {
|
|
76
|
+
this.afterSearching();
|
|
77
|
+
}
|
|
78
|
+
get host() { return index.getElement(this); }
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
exports.SallaSearch = SallaSearch;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const sallaSearch = require('./salla-search-311c7053.js');
|
|
6
|
+
require('./index-0b5b5867.js');
|
|
7
|
+
require('./Helper-8852feaa.js');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
exports.salla_search = sallaSearch.SallaSearch;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-0b5b5867.js');
|
|
6
|
+
const Helper = require('./Helper-8852feaa.js');
|
|
7
|
+
|
|
8
|
+
const SallaVerify = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
index.registerInstance(this, hostRef);
|
|
11
|
+
Helper.Helper.setHost(this.host);
|
|
12
|
+
salla.event.on('profile::verify.mobile', data => this.show(data));
|
|
13
|
+
}
|
|
14
|
+
show({ international_mobile: mobile, _country_iso2: country_code }) {
|
|
15
|
+
this.mobile = mobile;
|
|
16
|
+
this.country_code = country_code;
|
|
17
|
+
this.resendTimer();
|
|
18
|
+
this.otpInputs = document.querySelectorAll('.s-verify-input');
|
|
19
|
+
this.otpInputs[0].focus();
|
|
20
|
+
Helper.Helper.onKeyUp('.s-verify-input', event => {
|
|
21
|
+
var _a, _b, _c, _d;
|
|
22
|
+
let key = event.keyCode || event.charCode;
|
|
23
|
+
salla.helpers.digitsOnly(event.target);
|
|
24
|
+
if (event.target.value) {
|
|
25
|
+
(_a = event.target.nextElementSibling) === null || _a === void 0 ? void 0 : _a.focus();
|
|
26
|
+
(_b = event.target.nextElementSibling) === null || _b === void 0 ? void 0 : _b.select();
|
|
27
|
+
}
|
|
28
|
+
else if ([8, 46].includes(key)) {
|
|
29
|
+
(_c = event.target.previousElementSibling) === null || _c === void 0 ? void 0 : _c.focus();
|
|
30
|
+
(_d = event.target.previousElementSibling) === null || _d === void 0 ? void 0 : _d.select();
|
|
31
|
+
}
|
|
32
|
+
this.toggleOTPSubmit();
|
|
33
|
+
});
|
|
34
|
+
Helper.Helper.on('paste', '.s-verify-input', event => {
|
|
35
|
+
let text = event.clipboardData.getData('text').toArabicDigits().replace(/[^0-9.]/g, '').replace('..', '.');
|
|
36
|
+
this.otpInputs.forEach((input, i) => input.value = text[i] || '');
|
|
37
|
+
this.toggleOTPSubmit();
|
|
38
|
+
setTimeout(() => this.otpInputs[3].focus(), 100);
|
|
39
|
+
});
|
|
40
|
+
return this.modal.show();
|
|
41
|
+
}
|
|
42
|
+
toggleOTPSubmit() {
|
|
43
|
+
let otp = [];
|
|
44
|
+
this.otpInputs.forEach(input => input.value && otp.push(input.value));
|
|
45
|
+
this.code.value = otp.join('');
|
|
46
|
+
if (otp.length === 4) {
|
|
47
|
+
this.btn.removeAttribute('disabled');
|
|
48
|
+
this.btn.click();
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
this.btn.setAttribute('disabled', '');
|
|
52
|
+
}
|
|
53
|
+
resendTimer() {
|
|
54
|
+
Helper.Helper.showElement(this.resendMessage).hideElement(this.resend);
|
|
55
|
+
let resendAfter = 30;
|
|
56
|
+
let timerId = setInterval(() => {
|
|
57
|
+
if (resendAfter === -1) {
|
|
58
|
+
clearTimeout(timerId);
|
|
59
|
+
Helper.Helper.hideElement(this.resendMessage).showElement(this.resend);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
this.timer.innerHTML = `${resendAfter >= 10 ? resendAfter : '0' + resendAfter} : 00`;
|
|
63
|
+
resendAfter--;
|
|
64
|
+
}
|
|
65
|
+
}, 1000);
|
|
66
|
+
}
|
|
67
|
+
submit() {
|
|
68
|
+
return this.btn.load()
|
|
69
|
+
.then(() => this.btn.disable())
|
|
70
|
+
.then(() => salla.document.api.request('profile/verify-mobile', {
|
|
71
|
+
mobile: this.mobile,
|
|
72
|
+
country_code: this.country_code,
|
|
73
|
+
code: this.code.value
|
|
74
|
+
})).then(() => this.btn.stop() && this.btn.disable())
|
|
75
|
+
.then(() => this.modal.hide())
|
|
76
|
+
.then(() => window.location.reload())
|
|
77
|
+
.catch(() => this.btn.stop() && this.btn.enable());
|
|
78
|
+
}
|
|
79
|
+
resendCode() {
|
|
80
|
+
return this.btn.stop()
|
|
81
|
+
.then(() => this.btn.disable())
|
|
82
|
+
.then(() => {
|
|
83
|
+
this.otpInputs.forEach(input => input.value = '');
|
|
84
|
+
this.otpInputs[0].focus();
|
|
85
|
+
})
|
|
86
|
+
.then(() => salla.api.auth.resend({ phone: this.mobile, country_code: this.country_code }))
|
|
87
|
+
.then(() => this.resendTimer())
|
|
88
|
+
.catch(() => this.resendTimer());
|
|
89
|
+
}
|
|
90
|
+
render() {
|
|
91
|
+
return (index.h("salla-modal", { id: "s-verify", ref: modal => this.modal = modal, title: salla.lang.get('pages.profile.verify_title') }, index.h("div", { class: "s-verify-message", innerHTML: salla.lang.get('pages.profile.verify_message') }), index.h("label", { class: "s-verify-label" }, salla.lang.get('pages.profile.verify_placeholder')), index.h("input", { type: "hidden", name: "code", maxlength: "4", required: true, ref: code => this.code = code }), index.h("div", { class: "s-verify-codes", dir: "ltr" }, [1, 2, 3, 4].map(() => index.h("input", { type: "text", maxlength: "1", class: "s-verify-input", required: true }))), index.h("div", { slot: "footer", class: "s-verify-footer" }, index.h("salla-button", { class: "s-verify-submit", disabled: true, onClick: () => this.submit(), ref: b => this.btn = b }, salla.lang.get('pages.profile.verify')), index.h("p", { class: "s-verify-resend-message", ref: el => this.resendMessage = el }, salla.lang.get('blocks.header.resend_after'), index.h("b", { class: "s-verify-timer", ref: el => this.timer = el })), index.h("a", { href: "#", class: "s-verify-resend", onClick: () => this.resendCode(), ref: el => this.resend = el }, salla.lang.get('blocks.comments.submit')))));
|
|
92
|
+
}
|
|
93
|
+
get host() { return index.getElement(this); }
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
exports.salla_verify = SallaVerify;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index-0b5b5867.js');
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
Stencil Client Patch Browser v2.8.1 | MIT Licensed | https://stenciljs.com
|
|
7
|
+
*/
|
|
8
|
+
const patchBrowser = () => {
|
|
9
|
+
const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('twilight-components.cjs.js', document.baseURI).href));
|
|
10
|
+
const opts = {};
|
|
11
|
+
if (importMeta !== '') {
|
|
12
|
+
opts.resourcesUrl = new URL('.', importMeta).href;
|
|
13
|
+
}
|
|
14
|
+
return index.promiseResolve(opts);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
patchBrowser().then(options => {
|
|
18
|
+
return index.bootstrapLazy([["salla-button.cjs",[[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.cjs",[[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.cjs",[[4,"salla-branches",{"position":[1],"displayAs":[1,"display-as"],"browseProductsFrom":[1,"browse-products-from"],"branches":[16],"current":[1026],"open":[32],"selected":[32],"isOpenedBefore":[32],"show":[64],"hide":[64]}]]],["salla-localization.cjs",[[4,"salla-localization",{"languagesTitle":[1,"languages-title"],"currenciesTitle":[1,"currencies-title"],"ok":[1],"show":[64],"hide":[64],"submit":[64]}]]],["salla-product-availability.cjs",[[4,"salla-product-availability",{"channels":[1],"buttonText":[1,"button-text"],"countryCode":[1,"country-code"],"subscribeText":[1,"subscribe-text"],"cancelText":[1,"cancel-text"],"subTitle":[1,"sub-title"],"mobileLabel":[1,"mobile-label"],"emailLabel":[1,"email-label"],"mobilePlaceholder":[1,"mobile-placeholder"],"emailPlaceholder":[1,"email-placeholder"],"productId":[2,"product-id"],"subscribedMessage":[1,"subscribed-message"],"isSubscribed":[1028,"is-subscribed"],"submit":[64]}]]],["salla-rating.cjs",[[0,"salla-rating",{"orderId":[2,"order-id"],"thanksMsg":[1,"thanks-msg"],"isStoreRating":[4,"is-store-rating"],"isProductsRating":[4,"is-products-rating"],"isShippingRating":[4,"is-shipping-rating"],"show":[64],"hide":[64]}]]],["salla-verify.cjs",[[0,"salla-verify"]]],["salla-search.cjs",[[0,"salla-search",{"placeholder":[1],"noResultsText":[1,"no-results-text"],"results":[32]},[[0,"close","onModalClose"]]]]]], options);
|
|
19
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
class Helper extends salla.AppHelpers {
|
|
2
|
+
setHost(host) {
|
|
3
|
+
this.host = host;
|
|
4
|
+
}
|
|
5
|
+
getElement(selector) {
|
|
6
|
+
return this.host.querySelector(selector);
|
|
7
|
+
}
|
|
8
|
+
getAttribute(selector, attribute) {
|
|
9
|
+
var _a;
|
|
10
|
+
return (_a = this.getElement(selector)) === null || _a === void 0 ? void 0 : _a.getAttribute(attribute);
|
|
11
|
+
}
|
|
12
|
+
val(selector) {
|
|
13
|
+
return this.getAttribute(selector, 'value');
|
|
14
|
+
}
|
|
15
|
+
isUser() {
|
|
16
|
+
return !!salla.config.is_user;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export default new Helper;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"entries": [
|
|
3
|
+
"./components/salla-login/salla-login.js",
|
|
4
|
+
"./components/salla-search/salla-search.js",
|
|
5
|
+
"./components/salla-branches/salla-branches.js",
|
|
6
|
+
"./components/salla-button/salla-button.js",
|
|
7
|
+
"./components/salla-localization/salla-localization.js",
|
|
8
|
+
"./components/salla-modal/salla-modal.js",
|
|
9
|
+
"./components/salla-product-availability/salla-product-availability.js",
|
|
10
|
+
"./components/salla-rating/salla-rating.js",
|
|
11
|
+
"./components/salla-verify/salla-verify.js"
|
|
12
|
+
],
|
|
13
|
+
"compiler": {
|
|
14
|
+
"name": "@stencil/core",
|
|
15
|
+
"version": "2.8.1",
|
|
16
|
+
"typescriptVersion": "4.2.3"
|
|
17
|
+
},
|
|
18
|
+
"collections": [],
|
|
19
|
+
"bundles": []
|
|
20
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var fs = require('fs'), path = require('path'), util = require('util');
|
|
2
|
+
|
|
3
|
+
var dirToJSON = function (dir, done) {
|
|
4
|
+
var results = [];
|
|
5
|
+
|
|
6
|
+
function recWalk(d, res) {
|
|
7
|
+
var list = fs.readdirSync(d);
|
|
8
|
+
list.forEach((name) => {
|
|
9
|
+
var file = path.resolve(d, name);
|
|
10
|
+
var stat = fs.statSync(file);
|
|
11
|
+
if (stat && stat.isDirectory()) {
|
|
12
|
+
var title;
|
|
13
|
+
if (name) {
|
|
14
|
+
title = 'salla-' + name
|
|
15
|
+
}
|
|
16
|
+
res.push({ title: title, file: name + '/readme.md' });
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
try {
|
|
22
|
+
recWalk(dir, results);
|
|
23
|
+
done(null, results);
|
|
24
|
+
} catch (err) {
|
|
25
|
+
done(err);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
dirToJSON("src/components", function (err, results) {
|
|
30
|
+
if (err) console.log(err);
|
|
31
|
+
else fs.writeFile('src/components/summary.json', JSON.stringify(results), 'utf8', function (err) {
|
|
32
|
+
if (err) throw err;
|
|
33
|
+
console.log('Saved!');
|
|
34
|
+
});
|
|
35
|
+
});
|