@salla.sa/twilight-components 1.0.9 → 1.0.11
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-8c75b6ac.js → Helper-8852feaa.js} +3 -0
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{multi-warehouse_3.cjs.entry.js → multi-warehouse_4.cjs.entry.js} +91 -10
- package/dist/cjs/salla-localization.cjs.entry.js +35 -11
- package/dist/cjs/salla-product-availability.cjs.entry.js +78 -0
- package/dist/cjs/salla-rating.cjs.entry.js +299 -0
- package/dist/cjs/{salla-search-b9403062.js → salla-search-f9e00be9.js} +1 -0
- package/dist/cjs/salla-search.cjs.entry.js +1 -1
- package/dist/cjs/salla-verify.cjs.entry.js +5 -3
- package/dist/cjs/twilight-components.cjs.js +1 -1
- package/dist/collection/Helpers/Helper.js +3 -0
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/components/multi-warehouse/multi-warehouse.css +13 -0
- package/dist/collection/components/multi-warehouse/multi-warehouse.js +38 -39
- package/dist/collection/components/salla-button/salla-button.js +42 -9
- package/dist/collection/components/salla-localization/salla-localization.js +112 -20
- package/dist/collection/components/salla-modal/salla-modal.js +26 -19
- package/dist/collection/components/salla-product-availability/salla-product-availability.js +333 -0
- package/dist/collection/components/{order-rating/order-rating.css → salla-rating/salla-rating.css} +0 -0
- package/dist/collection/components/salla-rating/salla-rating.js +484 -0
- package/dist/collection/components/salla-search/salla-search.js +1 -0
- package/dist/collection/components/salla-verify/salla-verify.js +4 -2
- package/dist/esm/{Helper-23b2de40.js → Helper-81ac9a8c.js} +3 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{multi-warehouse_3.entry.js → multi-warehouse_4.entry.js} +91 -11
- package/dist/esm/salla-localization.entry.js +35 -11
- package/dist/esm/salla-product-availability.entry.js +74 -0
- package/dist/esm/salla-rating.entry.js +295 -0
- package/dist/esm/{salla-search-5d4a6f1a.js → salla-search-615b8f94.js} +1 -0
- package/dist/esm/salla-search.entry.js +1 -1
- package/dist/esm/salla-verify.entry.js +5 -3
- package/dist/esm/twilight-components.js +1 -1
- package/dist/twilight-components/index.esm.js +1 -1
- package/dist/twilight-components/p-2b8a5fa4.entry.js +1 -0
- package/dist/twilight-components/p-4e37a6cb.entry.js +1 -0
- package/dist/twilight-components/p-751643d8.entry.js +1 -0
- package/dist/twilight-components/{p-4b137380.js → p-8a2410e6.js} +0 -0
- package/dist/twilight-components/p-94b18718.entry.js +1 -0
- package/dist/twilight-components/{p-520446eb.js → p-9bc28e0c.js} +1 -1
- package/dist/twilight-components/p-bb503365.entry.js +1 -0
- package/dist/twilight-components/p-d34bbfc4.entry.js +1 -0
- package/dist/twilight-components/twilight-components.esm.js +1 -1
- package/dist/types/Helpers/Helper.d.ts +1 -0
- package/dist/types/components/multi-warehouse/multi-warehouse.d.ts +1 -0
- package/dist/types/components/salla-button/salla-button.d.ts +2 -1
- package/dist/types/components/salla-localization/salla-localization.d.ts +10 -3
- package/dist/types/components/salla-product-availability/salla-product-availability.d.ts +27 -0
- package/dist/types/components/salla-rating/salla-rating.d.ts +35 -0
- package/dist/types/components.d.ts +76 -17
- package/package.json +1 -1
- package/dist/cjs/order-rating.cjs.entry.js +0 -252
- package/dist/cjs/salla-button.cjs.entry.js +0 -57
- package/dist/collection/components/order-rating/order-rating.js +0 -321
- package/dist/esm/order-rating.entry.js +0 -248
- package/dist/esm/salla-button.entry.js +0 -53
- package/dist/twilight-components/p-653bb9a8.entry.js +0 -1
- package/dist/twilight-components/p-a2395c9d.entry.js +0 -1
- package/dist/twilight-components/p-baeca520.entry.js +0 -1
- package/dist/twilight-components/p-bd10d8d5.entry.js +0 -1
- package/dist/twilight-components/p-ea986bca.entry.js +0 -1
- package/dist/twilight-components/p-f4340bd9.entry.js +0 -1
- package/dist/types/components/order-rating/order-rating.d.ts +0 -20
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host } from './index-643344dc.js';
|
|
2
|
-
import { H as Helper } from './Helper-23b2de40.js';
|
|
3
|
-
|
|
4
|
-
const orderRatingCss = ":host{display:block}";
|
|
5
|
-
|
|
6
|
-
const OrderRating = class {
|
|
7
|
-
constructor(hostRef) {
|
|
8
|
-
registerInstance(this, hostRef);
|
|
9
|
-
this.stars = [1, 2, 3, 4, 5];
|
|
10
|
-
this.order = {
|
|
11
|
-
shipping: { id: 5622 },
|
|
12
|
-
order_id: "179794",
|
|
13
|
-
products: [
|
|
14
|
-
{
|
|
15
|
-
"title": "ميكروفون عالى الجودة",
|
|
16
|
-
"image": "https://salla-dev.s3.eu-central-1.amazonaws.com/Mvyk/pMdEEyMVpZFj4L1Hrdm2g48AuiSx0TrKULBiOnPo.jpg",
|
|
17
|
-
"price": "10,978.00 ر.س",
|
|
18
|
-
"qty": "2",
|
|
19
|
-
"totalBefore": "1120 ر.س",
|
|
20
|
-
"discount": "-5%",
|
|
21
|
-
"total": "1064 ر.س",
|
|
22
|
-
"id": "2314513454",
|
|
23
|
-
"getOptimusRouteKey": "7351233357"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"title": "وحدة تحكم لمشغل العاب",
|
|
27
|
-
"image": "https://salla-dev.s3.eu-central-1.amazonaws.com/Mvyk/NOa4kHvOkd1hBWHk3JIgAo1602oVACfuWGFz3vXv.jpg",
|
|
28
|
-
"price": "10,978.00 ر.س",
|
|
29
|
-
"qty": "2",
|
|
30
|
-
"totalBefore": "1120 ر.س",
|
|
31
|
-
"discount": "-5%",
|
|
32
|
-
"total": "1064 ر.س",
|
|
33
|
-
"id": "9842833",
|
|
34
|
-
"getOptimusRouteKey": "735152357"
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
"title": "ساعة ذكية بنظام اندرويد",
|
|
38
|
-
"image": "https://salla-dev.s3.eu-central-1.amazonaws.com/Mvyk/T4kTqYNuPAZmPMLw1bx92RnjVMZyFszVXOUZQsFJ.jpg",
|
|
39
|
-
"price": "10,978.00 ر.س",
|
|
40
|
-
"qty": "2",
|
|
41
|
-
"totalBefore": "1120 ر.س",
|
|
42
|
-
"discount": "-5%",
|
|
43
|
-
"total": "1064 ر.س",
|
|
44
|
-
"id": "679822376",
|
|
45
|
-
"getOptimusRouteKey": "73233357"
|
|
46
|
-
}
|
|
47
|
-
],
|
|
48
|
-
ratingMessage: {
|
|
49
|
-
1: "غير راضي <span class='emoji mx-1'>😒</span>",
|
|
50
|
-
2: "لم يعجبني <span class='emoji mx-1'>😌</span>",
|
|
51
|
-
3: "معقول <span class='emoji mx-1'>🙄</span>",
|
|
52
|
-
4: "أعجبني <span class='emoji mx-1'>👍</span>",
|
|
53
|
-
5: "أعجبني جداً <span class='emoji mx-1'>🤩</span>"
|
|
54
|
-
},
|
|
55
|
-
settings: {
|
|
56
|
-
isProductsRating: true,
|
|
57
|
-
isStoreRating: true,
|
|
58
|
-
isShippingRating: true,
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
this.ratingChain = Promise.resolve();
|
|
62
|
-
this.wizardInex = 0;
|
|
63
|
-
}
|
|
64
|
-
componentDidRender() {
|
|
65
|
-
this.initiateRating();
|
|
66
|
-
}
|
|
67
|
-
render() {
|
|
68
|
-
return (h(Host, null, h("div", { class: "pannel__body" }, this.order.settings.isStoreRating && this.renderStoreRating(), this.order.settings.isProductsRating && this.renderProductsRating(), this.order.settings.isShippingRating && this.renderShippingRating()), h("div", { class: "pannel__footer relative flex justify-between items-center" }, h("button", { id: "prev-btn", class: "font-bold text-sm text-primary hidden" }, "\u0627\u0644\u0633\u0627\u0628\u0642"), h("ul", { class: "flex justify-center text-center space-s-1.5 py-8 flex-1" }, h("li", { class: "cursor-pointer w-2.5 h-2.5 bg-primary rounded-full transition-colors duration-300" }), h("li", { class: "cursor-pointer w-2.5 h-2.5 bg-gray-200 rounded-full transition-colors duration-300" }), h("li", { class: "cursor-pointer w-2.5 h-2.5 bg-gray-200 rounded-full transition-colors duration-300" })), h("button", { id: "next-btn", class: "btn btn-primary h-10 px-8 flex-none" }, "\u0627\u0644\u062A\u0627\u0644\u064A"))));
|
|
69
|
-
}
|
|
70
|
-
renderProductsRating() {
|
|
71
|
-
return (h("section", { class: "step rating-section products-section hidden", "data-type": "product" }, h("div", { class: "bg-white mb-5 p-5 rounded-md overflow-hidden mb-10" }, this.order.products.map((item, index) => {
|
|
72
|
-
var _a;
|
|
73
|
-
return h("div", { class: "rating-outer-form", "data-stars-error": `يرجى تقييم (${item.title}) بواسطة النجمات` }, h("div", { class: "product-item mb-4" }, h("div", { class: "mb-5" }, h("div", { class: "flex space-s-5 mb-8" }, h("img", { src: item.image, alt: item.title, class: "w-18 h-14 object-cover rounded-md" }), h("div", { class: "flex-1" }, h("h3", { class: "section-title leading-5 mb-1.5 md:text-base" }, " ", item.title), h("div", { class: "rw-product-entry__rate" }, h("div", { class: "rating-wrap flex items-center space-s-4" }, h("form", { class: "rate-element rate-element--has-label" }, this.getStarsRating()), h("p", { class: "rate-label fix-align font-xsm my-0" })), h("input", { type: "hidden", name: "order_id", value: (_a = this.order) === null || _a === void 0 ? void 0 : _a.order_id }), h("input", { type: "hidden", name: `products[${index}][product_id]`, value: item.getOptimusRouteKey }), h("input", { type: "hidden", name: "type", value: "products" }), h("textarea", { "data-product-id": item.id, name: `products[${index}][comment]`, id: `productReview_${item.id}`, class: "comment form-input h-20 product-review", placeholder: `اضف رأيك عن المنتج (${item.title})` }), h("small", { class: "text-red-400 validation-message" })))))));
|
|
74
|
-
}))));
|
|
75
|
-
}
|
|
76
|
-
renderStoreRating() {
|
|
77
|
-
return (h("section", { class: "step rating-section bg-white my-10 p-5 rounded-md mb-5 active", "data-type": "store" }, h("div", { class: "rating-outer-form", "data-stars-error": "\u064A\u0631\u062C\u0649 \u062A\u0642\u064A\u064A\u0645 \u0627\u0644\u0645\u062A\u062C\u0631 \u0628\u0648\u0627\u0633\u0637\u0629 \u0627\u0644\u0646\u062C\u0645\u0627\u062A" }, h("input", { type: "hidden", name: "order_id", value: this.order.order_id }), h("input", { type: "hidden", name: "type", value: "store" }), h("h2", { class: "section-title text-lg font-bold mb-5" }, "\u0643\u064A\u0641 \u0643\u0627\u0646\u062A \u062A\u062C\u0631\u0628\u062A\u0643 \u0645\u0639 \u0627\u0644\u0645\u062A\u062C\u0631 \u0647\u0630\u0647 \u0627\u0644\u0645\u0631\u0629"), h("div", { class: "mb-2" }, h("textarea", { id: "storeReview", name: "comment", class: "form-input comment h-20", placeholder: "\u0627\u0636\u0641 \u0631\u0623\u064A\u0643 \u0639\u0646 \u0627\u0644\u0645\u062A\u062C\u0631.." })), h("div", { class: "rating-wrap flex items-center space-s-4" }, h("form", { class: "rate-element rate-element--has-label" }, this.getStarsRating()), h("p", { class: "rate-label fix-align font-sm center mb-0" })), h("small", { class: "text-red-400 validation-message" }))));
|
|
78
|
-
}
|
|
79
|
-
renderShippingRating() {
|
|
80
|
-
return (h("section", { class: "step rating-section bg-white my-10 p-5 rounded-md mb-5 hidden", "data-type": "shipping" }, h("div", { class: "rating-outer-form", "data-stars-error": "\u064A\u0631\u062C\u0649 \u062A\u0642\u064A\u064A\u0645 \u0634\u0631\u0643\u0629 \u0627\u0644\u0634\u062D\u0646 \u0628\u0648\u0627\u0633\u0637\u0629 \u0627\u0644\u0646\u062C\u0645\u0627\u062A" }, h("input", { type: "hidden", name: "order_id", value: this.order.order_id }), h("input", { type: "hidden", name: "shipping_company_id", value: this.order.shipping.id }), h("input", { type: "hidden", name: "type", value: "shipping" }), h("h2", { class: "section-title text-lg font-bold mb-5" }, "\u062E\u0628\u0631\u0646\u0627 \u0639\u0646 \u062A\u062C\u0631\u0628\u062A\u0643 \u0645\u0639 \u0634\u0631\u0643\u0629 \u0627\u0644\u0634\u062D\u0646"), h("div", { class: "mb-2" }, h("textarea", { id: "shippingReview", name: "comment", class: "form-input comment h-20 mb-2", placeholder: "\u0627\u0636\u0641 \u0631\u0623\u064A\u0643 \u0639\u0646 \u0634\u0631\u0643\u0629 \u0627\u0644\u0634\u062D\u0646" })), h("div", { class: "rating-wrap flex items-center space-s-4" }, h("form", { class: "rate-element ratFeedbackPresentere-element--has-label" }, this.getStarsRating()), h("p", { class: "rate-label fix-align font-sm center mb-0" })), h("small", { class: "text-red-400 validation-message" }))));
|
|
81
|
-
}
|
|
82
|
-
getStarsRating() {
|
|
83
|
-
return (h("div", { class: "mb-1" }, h("input", { type: "hidden", class: "rating_hidden_input", name: "rating", value: "" }), this.stars.map((star) => h("button", { type: "submit", class: "btn btn--transparent px-1 text-lg text-gray-400 btn--star", "data-star": star, "data-text": this.order.ratingMessage[`${star}`] }, h("i", { class: "sicon-star2" })))));
|
|
84
|
-
}
|
|
85
|
-
initiateRating() {
|
|
86
|
-
this.highlightSelectedStars();
|
|
87
|
-
this.starsRating();
|
|
88
|
-
this.handleWizard();
|
|
89
|
-
//show submitRating Button Only When there is a comment field
|
|
90
|
-
// Helper.toggle('#submitRating', 'btn', 'hidden', () => Helper.element('#shippingReview,#storeReview,.product-review'))
|
|
91
|
-
// this.ratingChain = Promise.resolve();
|
|
92
|
-
// Helper.onClick('#submitRating', () => this.sendRating().then(() => window.location.reload()));
|
|
93
|
-
salla.event.on('submit::order-rating', () => this.sendRating().then(() => window.location.reload()));
|
|
94
|
-
}
|
|
95
|
-
handleWizard() {
|
|
96
|
-
let steps = document.querySelectorAll(".step"), stepsCount = document.querySelectorAll(".step").length;
|
|
97
|
-
Helper.onClick("#prev-btn", () => {
|
|
98
|
-
this.wizardInex > 0 && this.wizardInex--;
|
|
99
|
-
this.showActiveStep(steps);
|
|
100
|
-
this.wizardInex == 0 && Helper.toggle('#prev-btn', 'hidden', 'block', () => true);
|
|
101
|
-
});
|
|
102
|
-
Helper.onClick("#next-btn", () => {
|
|
103
|
-
this.ratingValidation();
|
|
104
|
-
this.wizardInex == stepsCount - 1 && salla.event.dispatch("submit::order-rating");
|
|
105
|
-
this.wizardInex < stepsCount - 1 && this.wizardInex++;
|
|
106
|
-
this.showActiveStep(steps);
|
|
107
|
-
Helper.toggle('#prev-btn', 'block', 'hidden', () => true);
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
showActiveStep(steps) {
|
|
111
|
-
Helper.toggle('.step', 'hidden', 'active', () => true);
|
|
112
|
-
Helper.toggleElement(steps[this.wizardInex], 'active', 'hidden', () => true);
|
|
113
|
-
}
|
|
114
|
-
sendRating() {
|
|
115
|
-
// this.ratingValidation()
|
|
116
|
-
Helper.all('.rating-section', ratingSection => {
|
|
117
|
-
let type = ratingSection.dataset.type;
|
|
118
|
-
let formsData = [];
|
|
119
|
-
ratingSection.querySelectorAll('.rating-outer-form')
|
|
120
|
-
.forEach((form) => {
|
|
121
|
-
let formData = {};
|
|
122
|
-
form.querySelectorAll('[name]')
|
|
123
|
-
.forEach(function (input) {
|
|
124
|
-
let inputData = salla.helpers.inputData(input.name, input.value, formData);
|
|
125
|
-
formData[inputData.name] = inputData.value;
|
|
126
|
-
});
|
|
127
|
-
formsData = [];
|
|
128
|
-
formsData.push(formData);
|
|
129
|
-
this.sendFeedback(type, formsData);
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
return this.ratingChain;
|
|
133
|
-
}
|
|
134
|
-
sendFeedback(type, formsData) {
|
|
135
|
-
if (!formsData || formsData.length == 0) {
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
salla.config.canLeave = false;
|
|
139
|
-
this.ratingChain = salla.feedback.api[type](formsData[0])
|
|
140
|
-
.then(function () {
|
|
141
|
-
salla.config.canLeave = true;
|
|
142
|
-
}).catch(() => salla.config.canLeave = true);
|
|
143
|
-
}
|
|
144
|
-
ratingValidation() {
|
|
145
|
-
let errorMsg = '';
|
|
146
|
-
document.querySelectorAll('.rating-section.active')
|
|
147
|
-
.forEach((ratingSection) => {
|
|
148
|
-
ratingSection.querySelectorAll('.rating-outer-form')
|
|
149
|
-
.forEach((rating) => {
|
|
150
|
-
let ratingInput = rating.querySelector('.rating_hidden_input');
|
|
151
|
-
let commentInput = rating.querySelector('.comment');
|
|
152
|
-
let sectionTitle = rating.querySelector('.section-title');
|
|
153
|
-
let validationMessage = rating.querySelector('.validation-message');
|
|
154
|
-
if (ratingInput.value && commentInput.value && commentInput.value.length > 3) {
|
|
155
|
-
commentInput.classList.remove('has-error');
|
|
156
|
-
sectionTitle === null || sectionTitle === void 0 ? void 0 : sectionTitle.classList.remove('has-error', 'text-red-400');
|
|
157
|
-
validationMessage.innerHTML = '';
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
else if (commentInput.value && commentInput.value.length > 3) {
|
|
161
|
-
commentInput.classList.remove('has-error');
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
commentInput.classList.add('has-error');
|
|
165
|
-
}
|
|
166
|
-
sectionTitle === null || sectionTitle === void 0 ? void 0 : sectionTitle.classList.add('has-error', 'text-red-400');
|
|
167
|
-
errorMsg = ratingInput.value
|
|
168
|
-
? (salla.lang.get('common.errors.not_less_than_chars', { chars: 4 }) + ' ' + commentInput.getAttribute('placeholder'))
|
|
169
|
-
: (rating.dataset.starsError || salla.lang.get('pages.rating.rate_store_stars'));
|
|
170
|
-
validationMessage.innerHTML = errorMsg;
|
|
171
|
-
});
|
|
172
|
-
});
|
|
173
|
-
//Fire error to prevent sending rating
|
|
174
|
-
if (errorMsg) {
|
|
175
|
-
// scroll to first error
|
|
176
|
-
let ratingErrors = document.querySelectorAll('.has-error');
|
|
177
|
-
if (ratingErrors.length) {
|
|
178
|
-
let firstError = ratingErrors[0].offsetTop;
|
|
179
|
-
window.scrollTo({ top: firstError - 80 }); // 80 = fixed nav height
|
|
180
|
-
}
|
|
181
|
-
throw new Error(errorMsg);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
// for hovered star ---
|
|
185
|
-
highlightSelectedStars() {
|
|
186
|
-
let hover = ['hovered', 'text-theme-yellow'];
|
|
187
|
-
Helper.all('.rate-element', el => {
|
|
188
|
-
let starElements = el.querySelectorAll('.btn--star');
|
|
189
|
-
// remove hovered state from stars ---
|
|
190
|
-
el.addEventListener('mouseout', () => el.querySelectorAll('.btn--star').forEach(star => star.classList.remove(...hover)));
|
|
191
|
-
starElements.forEach((starElement, index) => {
|
|
192
|
-
starElement.addEventListener('mouseover', () => {
|
|
193
|
-
starElement.classList.add(...hover);
|
|
194
|
-
if (index <= 1) {
|
|
195
|
-
starElement.previousElementSibling.tagName === 'BUTTON' ? starElement.previousElementSibling.classList.add(...hover) : null;
|
|
196
|
-
}
|
|
197
|
-
else {
|
|
198
|
-
for (let i = 0; i < index; i++) {
|
|
199
|
-
starElements[i].classList.add(...hover);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
starElement.addEventListener('mouseout', () => {
|
|
204
|
-
starElement.classList.contains(...hover) ? starElement.classList.remove(...hover) : null;
|
|
205
|
-
});
|
|
206
|
-
});
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
starsRating() {
|
|
210
|
-
let selectedClasses = ['selected', 'text-theme-yellow'];
|
|
211
|
-
// Listen for form submissions
|
|
212
|
-
salla.document.event.onSubmit('.rate-element', function (event) {
|
|
213
|
-
// Prevent form from submitting
|
|
214
|
-
event.preventDefault();
|
|
215
|
-
// Get the selected star - activeElement is not supported in safari
|
|
216
|
-
var activeStars = event.target.querySelectorAll('.btn--star.hovered');
|
|
217
|
-
var selected = activeStars[activeStars.length - 1];
|
|
218
|
-
if (!selected)
|
|
219
|
-
return;
|
|
220
|
-
var selectedIndex = parseInt(selected.dataset.star, 10), selectedText = selected.dataset.text;
|
|
221
|
-
event.target.nextElementSibling.innerHTML = selectedText;
|
|
222
|
-
event.target.querySelector('.rating_hidden_input').value = selectedIndex;
|
|
223
|
-
// Get all stars in this form (only search in the form, not the whole document)
|
|
224
|
-
// Loop through each star, and add or remove the `.selected` class to toggle highlighting
|
|
225
|
-
event.target
|
|
226
|
-
.querySelectorAll('.btn--star')
|
|
227
|
-
.forEach(function (star, index) {
|
|
228
|
-
if (index < selectedIndex) {
|
|
229
|
-
// Selected star or before it, Add highlighting
|
|
230
|
-
star.classList.add(...selectedClasses);
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
// After selected star, Remove highlight
|
|
234
|
-
star.classList.remove(...selectedClasses);
|
|
235
|
-
});
|
|
236
|
-
// Remove aria-pressed from any previously selected star
|
|
237
|
-
var previousRating = event.target.querySelector('.star[aria-pressed="true"]');
|
|
238
|
-
if (previousRating) {
|
|
239
|
-
previousRating.removeAttribute('aria-pressed');
|
|
240
|
-
}
|
|
241
|
-
// Add aria-pressed role to the selected button
|
|
242
|
-
selected.setAttribute('aria-pressed', true);
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
};
|
|
246
|
-
OrderRating.style = orderRatingCss;
|
|
247
|
-
|
|
248
|
-
export { OrderRating as order_rating };
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, h, g as getElement } from './index-643344dc.js';
|
|
2
|
-
import { H as Helper } from './Helper-23b2de40.js';
|
|
3
|
-
|
|
4
|
-
const sallaButtonCss = ":host{display:block}";
|
|
5
|
-
|
|
6
|
-
const SallaButton = class {
|
|
7
|
-
constructor(hostRef) {
|
|
8
|
-
registerInstance(this, hostRef);
|
|
9
|
-
this.kind = 'primary';
|
|
10
|
-
this.loading = false;
|
|
11
|
-
this.disabled = false;
|
|
12
|
-
this.hostAttributes = {};
|
|
13
|
-
for (let i = 0; i < this.host.attributes.length; i++) {
|
|
14
|
-
this.hostAttributes[this.host.attributes[i].name] = this.host.attributes[i].value;
|
|
15
|
-
}
|
|
16
|
-
this.hostAttributes['type'] = this.hostAttributes['type'] || 'button';
|
|
17
|
-
this.hostAttributes['class'] = (this.hostAttributes['class'] || '') + ' s-button-btn btn--has-loading btn-' + this.kind;
|
|
18
|
-
delete this.hostAttributes['kind'];
|
|
19
|
-
delete this.hostAttributes['id'];
|
|
20
|
-
}
|
|
21
|
-
async load() {
|
|
22
|
-
this.host.setAttribute('loading', '');
|
|
23
|
-
return this.host;
|
|
24
|
-
}
|
|
25
|
-
async stop() {
|
|
26
|
-
this.host.removeAttribute('loading');
|
|
27
|
-
return this.host;
|
|
28
|
-
}
|
|
29
|
-
async disable() {
|
|
30
|
-
this.host.setAttribute('disabled', '');
|
|
31
|
-
}
|
|
32
|
-
async enable() {
|
|
33
|
-
this.host.removeAttribute('disabled');
|
|
34
|
-
}
|
|
35
|
-
handleVisible(newKind, oldKind) {
|
|
36
|
-
this.btn.classList.remove('btn-' + oldKind);
|
|
37
|
-
this.btn.classList.add('btn-' + newKind);
|
|
38
|
-
}
|
|
39
|
-
handleLoading(newVal) {
|
|
40
|
-
Helper.toggleElement(this.btn, 'btn--is-loading', 'btn--no-loading', () => newVal);
|
|
41
|
-
}
|
|
42
|
-
render() {
|
|
43
|
-
return (h("button", Object.assign({ ref: btn => this.btn = btn, disabled: this.disabled }, this.hostAttributes), h("slot", null), this.loading ? h("span", { class: "loader loader--small s-button-loader" }) : ''));
|
|
44
|
-
}
|
|
45
|
-
get host() { return getElement(this); }
|
|
46
|
-
static get watchers() { return {
|
|
47
|
-
"kind": ["handleVisible"],
|
|
48
|
-
"loading": ["handleLoading"]
|
|
49
|
-
}; }
|
|
50
|
-
};
|
|
51
|
-
SallaButton.style = sallaButtonCss;
|
|
52
|
-
|
|
53
|
-
export { SallaButton as salla_button };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,h as s,g as i}from"./p-d1ef2268.js";import{H as n}from"./p-520446eb.js";const a=class{constructor(s){t(this,s),this.kind="primary",this.loading=!1,this.disabled=!1,this.hostAttributes={};for(let t=0;t<this.host.attributes.length;t++)this.hostAttributes[this.host.attributes[t].name]=this.host.attributes[t].value;this.hostAttributes.type=this.hostAttributes.type||"button",this.hostAttributes.class=(this.hostAttributes.class||"")+" s-button-btn btn--has-loading btn-"+this.kind,delete this.hostAttributes.kind,delete this.hostAttributes.id}async load(){return this.host.setAttribute("loading",""),this.host}async stop(){return this.host.removeAttribute("loading"),this.host}async disable(){this.host.setAttribute("disabled","")}async enable(){this.host.removeAttribute("disabled")}handleVisible(t,s){this.btn.classList.remove("btn-"+s),this.btn.classList.add("btn-"+t)}handleLoading(t){n.toggleElement(this.btn,"btn--is-loading","btn--no-loading",(()=>t))}render(){return s("button",Object.assign({ref:t=>this.btn=t,disabled:this.disabled},this.hostAttributes),s("slot",null),this.loading?s("span",{class:"loader loader--small s-button-loader"}):"")}get host(){return i(this)}static get watchers(){return{kind:["handleVisible"],loading:["handleLoading"]}}};a.style=":host{display:block}";export{a as salla_button}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as s,h as e,g as i}from"./p-d1ef2268.js";import{H as t}from"./p-520446eb.js";const r=class{constructor(e){s(this,e),t.setHost(this.host),salla.event.on("profile::verify.mobile",(s=>this.show(s)))}show({international_mobile:s,_country_iso2:e}){return this.mobile=s,this.country_code=e,this.resendTimer(),this.otpInputs=document.querySelectorAll(".s-verify-input"),this.otpInputs[0].focus(),t.onKeyUp(".s-verify-input",(s=>{var e,i;let t=s.keyCode||s.charCode;salla.helpers.digitsOnly(s.target),s.target.value?null===(e=s.target.nextElementSibling)||void 0===e||e.focus():[8,46].includes(t)&&(null===(i=s.target.previousElementSibling)||void 0===i||i.focus()),this.toggleOTPSubmit()})),t.on("paste",".s-verify-input",(s=>{let e=s.clipboardData.getData("text").toArabicDigits().replace(/[^0-9.]/g,"").replace("..",".");this.otpInputs.forEach(((s,i)=>s.value=e[i]||"")),this.toggleOTPSubmit(),setTimeout((()=>this.otpInputs[3].focus()),100)})),this.modal.show()}toggleOTPSubmit(){let s=[];if(this.otpInputs.forEach((e=>e.value&&s.push(e.value))),this.code.value=s.join(""),4===s.length)return this.btn.removeAttribute("disabled"),void this.btn.click();this.btn.setAttribute("disabled","")}resendTimer(){t.showElement(this.resendMessage).hideElement(this.resend);let s=30,e=setInterval((()=>{-1===s?(clearTimeout(e),t.hideElement(this.resendMessage).showElement(this.resend)):(this.timer.innerHTML=`${s>=10?s:"0"+s} : 00`,s--)}),1e3)}submit(){return this.btn.load().then((()=>this.btn.disable())).then((()=>salla.document.api.request("profile/verify-mobile",{mobile:this.mobile,country_code:this.country_code,code:this.code.value}))).then((()=>this.btn.stop()&&this.btn.disable())).then((()=>this.modal.hide())).then((()=>window.location.reload())).catch((()=>this.btn.stop()&&this.btn.enable()))}resendCode(){return this.btn.stop().then((()=>this.btn.disable())).then((()=>{this.otpInputs.forEach((s=>s.value="")),this.otpInputs[0].focus()})).then((()=>salla.api.auth.resend({phone:this.mobile,country_code:this.country_code}))).then((()=>this.resendTimer())).catch((()=>this.resendTimer()))}render(){return e("salla-modal",{id:"s-verify",ref:s=>this.modal=s,title:salla.lang.get("pages.profile.verify_title")},e("div",{class:"s-verify-message",innerHTML:salla.lang.get("pages.profile.verify_message")}),e("label",{class:"s-verify-label"},salla.lang.get("pages.profile.verify_placeholder")),e("input",{type:"hidden",name:"code",maxlength:"4",required:!0,ref:s=>this.code=s}),e("div",{class:"s-verify-codes",dir:"ltr"},[1,2,3,4].map((()=>e("input",{type:"text",maxlength:"1",class:"s-verify-input",required:!0})))),e("div",{slot:"footer",class:"s-verify-footer"},e("salla-button",{class:"s-verify-submit",disabled:!0,onClick:()=>this.submit(),ref:s=>this.btn=s},salla.lang.get("pages.profile.verify")),e("p",{class:"s-verify-resend-message",ref:s=>this.resendMessage=s},salla.lang.get("blocks.header.resend_after"),e("b",{class:"s-verify-timer",ref:s=>this.timer=s})),e("a",{href:"#",class:"s-verify-resend",onClick:()=>this.resendCode(),ref:s=>this.resend=s},salla.lang.get("blocks.comments.submit"))))}get host(){return i(this)}};export{r as salla_verify}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{S as salla_search}from"./p-4b137380.js";import"./p-d1ef2268.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,h as e,H as s}from"./p-d1ef2268.js";import{H as a}from"./p-520446eb.js";const i=class{constructor(e){t(this,e),this.stars=[1,2,3,4,5],this.order={shipping:{id:5622},order_id:"179794",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/NOa4kHvOkd1hBWHk3JIgAo1602oVACfuWGFz3vXv.jpg",price:"10,978.00 ر.س",qty:"2",totalBefore:"1120 ر.س",discount:"-5%",total:"1064 ر.س",id:"9842833",getOptimusRouteKey:"735152357"},{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"}],ratingMessage:{1:"غير راضي <span class='emoji mx-1'>😒</span>",2:"لم يعجبني <span class='emoji mx-1'>😌</span>",3:"معقول <span class='emoji mx-1'>🙄</span>",4:"أعجبني <span class='emoji mx-1'>👍</span>",5:"أعجبني جداً <span class='emoji mx-1'>🤩</span>"},settings:{isProductsRating:!0,isStoreRating:!0,isShippingRating:!0}},this.ratingChain=Promise.resolve(),this.wizardInex=0}componentDidRender(){this.initiateRating()}render(){return e(s,null,e("div",{class:"pannel__body"},this.order.settings.isStoreRating&&this.renderStoreRating(),this.order.settings.isProductsRating&&this.renderProductsRating(),this.order.settings.isShippingRating&&this.renderShippingRating()),e("div",{class:"pannel__footer relative flex justify-between items-center"},e("button",{id:"prev-btn",class:"font-bold text-sm text-primary hidden"},"السابق"),e("ul",{class:"flex justify-center text-center space-s-1.5 py-8 flex-1"},e("li",{class:"cursor-pointer w-2.5 h-2.5 bg-primary rounded-full transition-colors duration-300"}),e("li",{class:"cursor-pointer w-2.5 h-2.5 bg-gray-200 rounded-full transition-colors duration-300"}),e("li",{class:"cursor-pointer w-2.5 h-2.5 bg-gray-200 rounded-full transition-colors duration-300"})),e("button",{id:"next-btn",class:"btn btn-primary h-10 px-8 flex-none"},"التالي")))}renderProductsRating(){return e("section",{class:"step rating-section products-section hidden","data-type":"product"},e("div",{class:"bg-white mb-5 p-5 rounded-md overflow-hidden mb-10"},this.order.products.map(((t,s)=>{var a;return e("div",{class:"rating-outer-form","data-stars-error":`يرجى تقييم (${t.title}) بواسطة النجمات`},e("div",{class:"product-item mb-4"},e("div",{class:"mb-5"},e("div",{class:"flex space-s-5 mb-8"},e("img",{src:t.image,alt:t.title,class:"w-18 h-14 object-cover rounded-md"}),e("div",{class:"flex-1"},e("h3",{class:"section-title leading-5 mb-1.5 md:text-base"}," ",t.title),e("div",{class:"rw-product-entry__rate"},e("div",{class:"rating-wrap flex items-center space-s-4"},e("form",{class:"rate-element rate-element--has-label"},this.getStarsRating()),e("p",{class:"rate-label fix-align font-xsm my-0"})),e("input",{type:"hidden",name:"order_id",value:null===(a=this.order)||void 0===a?void 0:a.order_id}),e("input",{type:"hidden",name:`products[${s}][product_id]`,value:t.getOptimusRouteKey}),e("input",{type:"hidden",name:"type",value:"products"}),e("textarea",{"data-product-id":t.id,name:`products[${s}][comment]`,id:`productReview_${t.id}`,class:"comment form-input h-20 product-review",placeholder:`اضف رأيك عن المنتج (${t.title})`}),e("small",{class:"text-red-400 validation-message"})))))))}))))}renderStoreRating(){return e("section",{class:"step rating-section bg-white my-10 p-5 rounded-md mb-5 active","data-type":"store"},e("div",{class:"rating-outer-form","data-stars-error":"يرجى تقييم المتجر بواسطة النجمات"},e("input",{type:"hidden",name:"order_id",value:this.order.order_id}),e("input",{type:"hidden",name:"type",value:"store"}),e("h2",{class:"section-title text-lg font-bold mb-5"},"كيف كانت تجربتك مع المتجر هذه المرة"),e("div",{class:"mb-2"},e("textarea",{id:"storeReview",name:"comment",class:"form-input comment h-20",placeholder:"اضف رأيك عن المتجر.."})),e("div",{class:"rating-wrap flex items-center space-s-4"},e("form",{class:"rate-element rate-element--has-label"},this.getStarsRating()),e("p",{class:"rate-label fix-align font-sm center mb-0"})),e("small",{class:"text-red-400 validation-message"})))}renderShippingRating(){return e("section",{class:"step rating-section bg-white my-10 p-5 rounded-md mb-5 hidden","data-type":"shipping"},e("div",{class:"rating-outer-form","data-stars-error":"يرجى تقييم شركة الشحن بواسطة النجمات"},e("input",{type:"hidden",name:"order_id",value:this.order.order_id}),e("input",{type:"hidden",name:"shipping_company_id",value:this.order.shipping.id}),e("input",{type:"hidden",name:"type",value:"shipping"}),e("h2",{class:"section-title text-lg font-bold mb-5"},"خبرنا عن تجربتك مع شركة الشحن"),e("div",{class:"mb-2"},e("textarea",{id:"shippingReview",name:"comment",class:"form-input comment h-20 mb-2",placeholder:"اضف رأيك عن شركة الشحن"})),e("div",{class:"rating-wrap flex items-center space-s-4"},e("form",{class:"rate-element ratFeedbackPresentere-element--has-label"},this.getStarsRating()),e("p",{class:"rate-label fix-align font-sm center mb-0"})),e("small",{class:"text-red-400 validation-message"})))}getStarsRating(){return e("div",{class:"mb-1"},e("input",{type:"hidden",class:"rating_hidden_input",name:"rating",value:""}),this.stars.map((t=>e("button",{type:"submit",class:"btn btn--transparent px-1 text-lg text-gray-400 btn--star","data-star":t,"data-text":this.order.ratingMessage[`${t}`]},e("i",{class:"sicon-star2"})))))}initiateRating(){this.highlightSelectedStars(),this.starsRating(),this.handleWizard(),salla.event.on("submit::order-rating",(()=>this.sendRating().then((()=>window.location.reload()))))}handleWizard(){let t=document.querySelectorAll(".step"),e=document.querySelectorAll(".step").length;a.onClick("#prev-btn",(()=>{this.wizardInex>0&&this.wizardInex--,this.showActiveStep(t),0==this.wizardInex&&a.toggle("#prev-btn","hidden","block",(()=>!0))})),a.onClick("#next-btn",(()=>{this.ratingValidation(),this.wizardInex==e-1&&salla.event.dispatch("submit::order-rating"),this.wizardInex<e-1&&this.wizardInex++,this.showActiveStep(t),a.toggle("#prev-btn","block","hidden",(()=>!0))}))}showActiveStep(t){a.toggle(".step","hidden","active",(()=>!0)),a.toggleElement(t[this.wizardInex],"active","hidden",(()=>!0))}sendRating(){return a.all(".rating-section",(t=>{let e=t.dataset.type,s=[];t.querySelectorAll(".rating-outer-form").forEach((t=>{let a={};t.querySelectorAll("[name]").forEach((function(t){let e=salla.helpers.inputData(t.name,t.value,a);a[e.name]=e.value})),s=[],s.push(a),this.sendFeedback(e,s)}))})),this.ratingChain}sendFeedback(t,e){e&&0!=e.length&&(salla.config.canLeave=!1,this.ratingChain=salla.feedback.api[t](e[0]).then((function(){salla.config.canLeave=!0})).catch((()=>salla.config.canLeave=!0)))}ratingValidation(){let t="";if(document.querySelectorAll(".rating-section.active").forEach((e=>{e.querySelectorAll(".rating-outer-form").forEach((e=>{let s=e.querySelector(".rating_hidden_input"),a=e.querySelector(".comment"),i=e.querySelector(".section-title"),r=e.querySelector(".validation-message");if(s.value&&a.value&&a.value.length>3)return a.classList.remove("has-error"),null==i||i.classList.remove("has-error","text-red-400"),void(r.innerHTML="");a.value&&a.value.length>3?a.classList.remove("has-error"):a.classList.add("has-error"),null==i||i.classList.add("has-error","text-red-400"),t=s.value?salla.lang.get("common.errors.not_less_than_chars",{chars:4})+" "+a.getAttribute("placeholder"):e.dataset.starsError||salla.lang.get("pages.rating.rate_store_stars"),r.innerHTML=t}))})),t){let e=document.querySelectorAll(".has-error");throw e.length&&window.scrollTo({top:e[0].offsetTop-80}),new Error(t)}}highlightSelectedStars(){let t=["hovered","text-theme-yellow"];a.all(".rate-element",(e=>{let s=e.querySelectorAll(".btn--star");e.addEventListener("mouseout",(()=>e.querySelectorAll(".btn--star").forEach((e=>e.classList.remove(...t))))),s.forEach(((e,a)=>{e.addEventListener("mouseover",(()=>{if(e.classList.add(...t),a<=1)"BUTTON"===e.previousElementSibling.tagName&&e.previousElementSibling.classList.add(...t);else for(let e=0;e<a;e++)s[e].classList.add(...t)})),e.addEventListener("mouseout",(()=>{e.classList.contains(...t)&&e.classList.remove(...t)}))}))}))}starsRating(){let t=["selected","text-theme-yellow"];salla.document.event.onSubmit(".rate-element",(function(e){e.preventDefault();var s=e.target.querySelectorAll(".btn--star.hovered"),a=s[s.length-1];if(a){var i=parseInt(a.dataset.star,10);e.target.nextElementSibling.innerHTML=a.dataset.text,e.target.querySelector(".rating_hidden_input").value=i,e.target.querySelectorAll(".btn--star").forEach((function(e,s){s<i?e.classList.add(...t):e.classList.remove(...t)}));var r=e.target.querySelector('.star[aria-pressed="true"]');r&&r.removeAttribute("aria-pressed"),a.setAttribute("aria-pressed",!0)}}))}};i.style=":host{display:block}";export{i as order_rating}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as s,h as t,g as e,c as i,H as a}from"./p-d1ef2268.js";export{S as salla_login}from"./p-36c87e2e.js";import{H as l}from"./p-520446eb.js";let o=require("store/src/store-engine"),r=require("store/storages/sessionStorage"),n=o.createStore(r);const h=class{constructor(t){s(this,t),this.open=!1,this.isOpenedBefore=n.get("multi-warehouse-opened-before"),this.displayAs="default",this.browseProductsFrom="all",this.branches=[{id:1,name:"فرع الرياض",open:!0,available:!0,limited:!1,tag:"متوفر"},{id:2,name:"فرع جدة",open:!1,available:!1,limited:!1,tag:"غير متوفر"},{id:3,name:"فرع مكة",open:!0,available:!0,limited:!1,tag:"متوفر"},{id:4,name:"فرع المدينة",open:!0,available:!0,limited:!1,tag:"متوفر"},{id:5,name:"فرع جازان",open:!0,available:!0,limited:!0,tag:"الكمية محدودة"}],this.current=1,this.currentBranch=s=>this.branches.filter((s=>s.id==this.current))[0][s],this.statusColor=(s=null)=>s?s.limited?"text-red-400":s.available?"text-green-500":"text-gray-400":this.currentBranch("limited")?"text-red-400":this.currentBranch("available")?"text-green-500":"text-gray-400",this.isChoiceable=()=>"all"!==this.browseProductsFrom&&"single"==this.position||"header"==this.position,this.formTitle=()=>this.isChoiceable()?"توفر المنتج في الفروع الآخرى":"التسوق من فرع آخر",salla.event.on("branches::show",(()=>this.show()))}async show(){return this.modal.show()}async hide(){return this.modal.hide()}handelChange(s){this.selected=s.target.value}handleSubmit(){n.set("multi-warehouse-opened-before",!0),this.show(),setTimeout((()=>{this.current=this.selected}),300)}render(){return t("salla-modal",{"is-closable":this.isOpenedBefore||"popup"!=this.displayAs?"true":"false",ref:s=>this.modal=s,"modal-width":"w-116",id:"multi-warehouse-modal",class:"hidden"},t("slot",{name:"header"},t("div",{slot:"header"})),t("div",null,t("div",{class:"text-right"},t("div",{class:"flex items-center mb-8"},t("div",{class:"flex-shrink-0 sm:mb-0 me-4"},t("div",{class:"h-16 w-16 border border-gray-200 bg-white text-primary rounded-full flex justify-center items-center"},t("span",{class:"sicon-store-alt"}))),t("div",null,t("p",{class:"mt-1 text-xs text-gray-400"},"أنت الآن تتصفح المتجر من"),t("h4",{class:"text-base"},"فرع الرياض"))),t("fieldset",{class:"mt-4"},t("h4",{class:"text-sm text-gray-600 mb-6"},this.formTitle()),t("legend",{class:"sr-only"},this.formTitle()),this.branches.length<=5?t("div",{class:"space-y-5"},this.branches.map((s=>t("div",{class:"flex items-center"},t("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:{"me-3 focus:ring-primary h-4 w-4 text-primary border-gray-300":!0,"opacity-50":!s.open,hidden:!this.isChoiceable()},checked:this.current==s.id}),t("label",{htmlFor:this.position+"_branch_"+s.id,class:{"flex items-center justify-between text-sm font-medium text-gray-700 flex-grow":!0,"cursor-pointer":this.isChoiceable()}},t("span",{class:{"opacity-50":!s.open}},s.name),this.isChoiceable()?t("small",{class:"text-red-400"},s.open?"":"مُغلق"):t("span",{class:this.statusColor(s)},s.tag)))))):t("select",{class:"w-full h-10 transition-colors duration-300 focus:ring-transparent focus:border-primary sm:text-sm border-gray-200 rounded-md appearance-none visibility_condition px-4",onInput:s=>this.handelChange(s)},this.branches.map((s=>t("option",{value:s.id,disabled:!s.open,selected:this.selected==s.id},s.name," ",s.open?"":"- مُغلق"))))))),this.isChoiceable()?t("p",{slot:"footer"},t("slot",{name:"footer"},t("button",{type:"button",class:"mt-8 w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-primary text-base font-medium text-white transition-colors hover:bg-primary-d focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary sm:col-start-2 sm:text-sm",onClick:()=>this.handleSubmit()},salla.lang.get("common.elements.ok")))):"")}componentDidRender(){}get host(){return e(this)}},d=class{constructor(t){s(this,t),this.ready=i(this,"ready",7),this.close=i(this,"close",7),this.error=!1,this.success=!1,this.isClosable=!0,this.modalWidth="w-96",this.visible=!1,this.subTitle="",this.icon="sicon-cancel",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")}handleVisible(s){if(!s)return this.toggleModal(!1),void this.close.emit();this.host.classList.remove("hidden"),setTimeout((()=>this.toggleModal(!0))),this.ready.emit()}async show(){return this.host.setAttribute("visible",""),this.host}async hide(){return this.host.removeAttribute("visible"),this.host}async setTitle(s){return this.title=s,this.host}toggleModal(s){l.toggleElement(this.host.querySelector(".s-modal-overlay"),"ease-out duration-300 opacity-100","opacity-0",(()=>s)).toggleElement(this.host.querySelector(".s-modal-body"),"ease-out duration-300 opacity-100 translate-y-0 sm:scale-100","opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",(()=>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(a,{class:"s-modal-container hidden","aria-modal":"true",role:"dialog"},t("div",{class:"s-modal-wrapper"},t("div",{class:"s-modal-overlay",onClick:()=>this.closeModal()}),t("span",{class:"s-modal-spacer"},""),t("div",{class:"s-modal-body "+this.modalWidth},t("slot",{name:"header"},t("div",{class:"s-modal-header"},this.isClosable?t("button",{class:"s-modal-close cursor-pointer",onClick:()=>this.closeModal(),type:"button"},t("span",{class:"sicon-cancel"})):"",this.error||this.success?t("div",{class:{"s-modal-icon":!0,"s-modal-bg-error":this.error,"s-modal-bg-success":this.success}},t("i",{class:{[this.icon]:!0,"s-modal-text-error":this.error,"s-modal-text-success":this.success}})):"",t("div",{class:"s-modal-title",innerHTML:this.title}),t("p",{class:"s-modal-sub-title",innerHTML:this.subTitle}))),t("slot",null),t("slot",{name:"footer"}))))}get host(){return e(this)}static get watchers(){return{visible:["handleVisible"]}}};export{h as multi_warehouse,d as salla_modal}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as l,h as a,g as s}from"./p-d1ef2268.js";import{H as i}from"./p-520446eb.js";const t=class{constructor(a){l(this,a),i.setHost(this.host),salla.event.on("localization::show",(()=>this.show()))}setCurrentLanguage(l){this.language=l}setCurrentCurrency(l){this.currency=l}async show(){return this.modal.show()}async hide(){return this.modal.hide()}submit(){let l;this.btn.load().then((()=>{if(this.currency&&this.currency.code!==salla.config.currency.code)return l=window.location.href,salla.currency.api.change(this.currency.code)})).then((()=>{this.language&&this.language.code!==salla.config.language.code&&(l=this.language.url)})).then((()=>this.btn.stop())).then((()=>this.hide())).then((()=>l&&(window.location.href=l)))}render(){return a("salla-modal",{id:"salla-localization",class:"hidden",ref:l=>this.modal=l},a("slot",{name:"header"},a("div",{slot:"header"})),a("div",{class:"s-localization-inner"},salla.config.languages?a("div",{class:"s-localization-section"},a("label",{class:"s-localization-title"},salla.lang.get("common.titles.language")),a("fieldset",{class:"s-localization-fieldset"},a("legend",{class:"sr-only"},salla.lang.get("blocks.header.change_language")),a("div",{class:"s-localization-section-inner"},salla.config.languages.map((l=>a("div",{class:"flex items-center"},a("input",{class:"s-localization-input",checked:salla.config.language.code==l.code,onChange:()=>this.setCurrentLanguage(l),id:"lang-"+l.code.toLowerCase(),name:"language",type:"radio",value:l.code}),a("label",{htmlFor:"lang-"+l.code.toLowerCase(),class:"s-localization-label"},a("span",null,l.name),a("div",{class:"s-localization-flag flag iti__flag iti__"+l.country_code})))))))):"",salla.config.currencies?a("div",{class:"s-localization-section"},a("label",{class:"s-localization-title"},salla.lang.get("common.titles.currency")),a("fieldset",{class:"s-localization-fieldset"},a("legend",{class:"sr-only"},salla.lang.get("blocks.header.change_currency")),a("div",{class:"s-localization-section-inner"},salla.config.currencies.map((l=>a("div",{class:"s-localization-item"},a("input",{class:"s-localization-input",checked:salla.config.currency.code==l.code,onChange:()=>this.setCurrentCurrency(l),id:"currency-"+l.code,name:"currency",type:"radio",value:l.code}),a("label",{class:"s-localization-label",htmlFor:"currency-"+l.code},a("span",null,l.name),a("small",{class:"s-localization-currency"},l.code)))))))):""),a("p",{slot:"footer"},a("slot",{name:"footer"},a("salla-button",{ref:l=>this.btn=l,onClick:()=>this.submit(),class:"w-full"},salla.lang.get("common.elements.ok")))))}get host(){return s(this)}};export{t as salla_localization}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export declare class OrderRating {
|
|
2
|
-
stars: Number[];
|
|
3
|
-
order: any;
|
|
4
|
-
ratingChain: Promise<void>;
|
|
5
|
-
wizardInex: number;
|
|
6
|
-
componentDidRender(): void;
|
|
7
|
-
render(): any;
|
|
8
|
-
renderProductsRating(): any;
|
|
9
|
-
renderStoreRating(): any;
|
|
10
|
-
renderShippingRating(): any;
|
|
11
|
-
getStarsRating(): any;
|
|
12
|
-
initiateRating(): void;
|
|
13
|
-
handleWizard(): void;
|
|
14
|
-
showActiveStep(steps: any): void;
|
|
15
|
-
sendRating(): Promise<void>;
|
|
16
|
-
sendFeedback(type: any, formsData: any): void;
|
|
17
|
-
ratingValidation(): void;
|
|
18
|
-
highlightSelectedStars(): void;
|
|
19
|
-
starsRating(): void;
|
|
20
|
-
}
|