@salla.sa/twilight-components 2.14.306 → 2.14.307
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/{filepond-T68FpD2x.js → filepond-Btud-9cx.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-D2qWU0E8.js → filepond-plugin-file-poster--Gwmscgl.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-BBlP06s2.js → filepond-plugin-file-validate-size-BOJQxGjN.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-DsoFa7eA.js → filepond-plugin-file-validate-type-C77Hrmz7.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-Db2ao8Iq.js → filepond-plugin-image-edit-DI9lM8fO.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-BR30PCYO.js → filepond-plugin-image-exif-orientation-DLoZc-P9.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-CRbzO01p.js → filepond-plugin-image-preview-DHeIf3Qv.js} +1 -1
- package/dist/cjs/{index-_C7Hhk-4.js → index-BW35Qz0q.js} +1 -1
- package/dist/cjs/{index-B-Pk8e4E.js → index-C_8SUOhh.js} +2 -2
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/salla-accordion_62.cjs.entry.js +95 -67
- package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
- package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-item-offers.cjs.entry.js +1 -1
- package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
- package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters.cjs.entry.js +1 -1
- package/dist/cjs/salla-installment.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-program.cjs.entry.js +1 -1
- package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
- package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
- package/dist/cjs/salla-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-orders.cjs.entry.js +1 -1
- package/dist/cjs/salla-payments.cjs.entry.js +1 -1
- package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
- package/dist/cjs/salla-review-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-reviews-page.cjs.entry.js +1 -1
- package/dist/cjs/salla-reviews.cjs.entry.js +1 -1
- package/dist/cjs/salla-social.cjs.entry.js +1 -1
- package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
- package/dist/cjs/salla-verify.cjs.entry.js +1 -1
- package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
- package/dist/cjs/twilight.cjs.js +2 -2
- package/dist/collection/components/salla-file-upload/salla-file-upload.js +23 -14
- package/dist/collection/components/salla-rating-modal/salla-rating-modal.js +72 -61
- package/dist/components/index.js +2 -2
- package/dist/components/salla-file-upload2.js +22 -13
- package/dist/components/salla-rating-modal.js +64 -61
- package/dist/esm/{filepond-CEA-Ut0D.js → filepond-BDCqb9n1.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-CrHfyiKb.js → filepond-plugin-file-poster-Csff9zr1.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-BAjMQFxV.js → filepond-plugin-file-validate-size-uT0vdpSK.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-3WttM4LY.js → filepond-plugin-file-validate-type-C71qG90l.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-gXv8D0gp.js → filepond-plugin-image-edit-AV3f4iVU.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-Cqa1508w.js → filepond-plugin-image-exif-orientation-BrahCgFe.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-k7khQXHq.js → filepond-plugin-image-preview-B73Halt8.js} +1 -1
- package/dist/esm/{index-DzTVR6sF.js → index-CkTB8LrG.js} +2 -2
- package/dist/esm/{index-hJWVffcN.js → index-DAIvUtTl.js} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/salla-accordion_62.entry.js +95 -67
- package/dist/esm/salla-advertisement.entry.js +1 -1
- package/dist/esm/salla-app-install-alert.entry.js +1 -1
- package/dist/esm/salla-apps-icons.entry.js +1 -1
- package/dist/esm/salla-cart-item-offers.entry.js +1 -1
- package/dist/esm/salla-conditional-offer.entry.js +1 -1
- package/dist/esm/salla-contacts.entry.js +1 -1
- package/dist/esm/salla-custom-fields.entry.js +1 -1
- package/dist/esm/salla-filters-widget.entry.js +1 -1
- package/dist/esm/salla-filters.entry.js +1 -1
- package/dist/esm/salla-installment.entry.js +1 -1
- package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
- package/dist/esm/salla-loyalty-program.entry.js +1 -1
- package/dist/esm/salla-metadata.entry.js +1 -1
- package/dist/esm/salla-notification-item.entry.js +1 -1
- package/dist/esm/salla-notifications.entry.js +1 -1
- package/dist/esm/salla-offer.entry.js +1 -1
- package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
- package/dist/esm/salla-order-details-options.entry.js +1 -1
- package/dist/esm/salla-order-details.entry.js +1 -1
- package/dist/esm/salla-order-summary.entry.js +1 -1
- package/dist/esm/salla-order-totals-card.entry.js +1 -1
- package/dist/esm/salla-orders.entry.js +1 -1
- package/dist/esm/salla-payments.entry.js +1 -1
- package/dist/esm/salla-price-range.entry.js +1 -1
- package/dist/esm/salla-review-card.entry.js +1 -1
- package/dist/esm/salla-reviews-page.entry.js +1 -1
- package/dist/esm/salla-reviews.entry.js +1 -1
- package/dist/esm/salla-social.entry.js +1 -1
- package/dist/esm/salla-tiered-offer.entry.js +1 -1
- package/dist/esm/salla-tooltip.entry.js +1 -1
- package/dist/esm/salla-trust-badges.entry.js +1 -1
- package/dist/esm/salla-verify.entry.js +1 -1
- package/dist/esm/salla-wallet.entry.js +1 -1
- package/dist/esm/twilight.js +3 -3
- package/dist/twilight/{p-eff7b7fd.entry.js → p-07e3af79.entry.js} +1 -1
- package/dist/twilight/{p-dc88b0d4.entry.js → p-152cca87.entry.js} +1 -1
- package/dist/twilight/{p-e2a7ad27.entry.js → p-1ac688b1.entry.js} +1 -1
- package/dist/twilight/{p-a6793957.entry.js → p-2bc66d76.entry.js} +1 -1
- package/dist/twilight/{p-8f7c61ae.entry.js → p-2e1acb31.entry.js} +1 -1
- package/dist/twilight/{p-e85c2ce3.entry.js → p-2f0c4c48.entry.js} +1 -1
- package/dist/twilight/{p-146fef48.entry.js → p-369e287b.entry.js} +1 -1
- package/dist/twilight/{p-27797654.entry.js → p-391bfab0.entry.js} +1 -1
- package/dist/twilight/{p-9f7048f9.entry.js → p-39fbc8df.entry.js} +1 -1
- package/dist/twilight/{p-2c10446c.entry.js → p-3d65ce04.entry.js} +1 -1
- package/dist/twilight/{p-7f980b83.entry.js → p-49d27a30.entry.js} +1 -1
- package/dist/twilight/{p-ead30e6f.entry.js → p-4b743277.entry.js} +1 -1
- package/dist/twilight/{p-4be84919.entry.js → p-50066053.entry.js} +1 -1
- package/dist/twilight/{p-e5fa1278.entry.js → p-5e393287.entry.js} +1 -1
- package/dist/twilight/{p-a962dc4e.entry.js → p-683db036.entry.js} +1 -1
- package/dist/twilight/{p-cafa3981.entry.js → p-69d77416.entry.js} +1 -1
- package/dist/twilight/{p-a1c13dc3.entry.js → p-6da8bb12.entry.js} +1 -1
- package/dist/twilight/{p-eaf534c7.entry.js → p-774db722.entry.js} +1 -1
- package/dist/twilight/{p-21474b0b.entry.js → p-7826e12d.entry.js} +1 -1
- package/dist/twilight/{p-f7a3fa8e.entry.js → p-7fec8b2b.entry.js} +1 -1
- package/dist/twilight/{p-CIpEMPXT.js → p-85r8le_w.js} +1 -1
- package/dist/twilight/{p-27735fc2.entry.js → p-89ed3133.entry.js} +1 -1
- package/dist/twilight/{p-CBEtXGh0.js → p-AkZZv6o3.js} +1 -1
- package/dist/twilight/{p-B65_j3d4.js → p-CDzETZL4.js} +1 -1
- package/dist/twilight/{p-BiU9nldp.js → p-CR3Odb2N.js} +1 -1
- package/dist/twilight/{p-DzTVR6sF.js → p-CkTB8LrG.js} +1 -1
- package/dist/twilight/{p-C8nDt0jG.js → p-CoViVjAD.js} +1 -1
- package/dist/twilight/{p-Czub2Z40.js → p-D9xbcyYI.js} +1 -1
- package/dist/twilight/{p-BakkriQz.js → p-Wr2wkBmL.js} +2 -2
- package/dist/twilight/{p-be48e8c4.entry.js → p-a4b4dfb6.entry.js} +1 -1
- package/dist/twilight/{p-0ae9e425.entry.js → p-a5611c44.entry.js} +1 -1
- package/dist/twilight/{p-dcf5a422.entry.js → p-b1eb710a.entry.js} +1 -1
- package/dist/twilight/{p-f2525950.entry.js → p-c4312308.entry.js} +1 -1
- package/dist/twilight/p-c7aec160.entry.js +11 -0
- package/dist/twilight/{p-c3bbc744.entry.js → p-d1e5e51e.entry.js} +1 -1
- package/dist/twilight/{p-8c264b4c.entry.js → p-d3fc316c.entry.js} +1 -1
- package/dist/twilight/{p-e7544665.entry.js → p-d70e73be.entry.js} +1 -1
- package/dist/twilight/{p-da06dd7e.entry.js → p-dbe530e9.entry.js} +1 -1
- package/dist/twilight/p-e0386eb6.entry.js +4 -0
- package/dist/twilight/{p-2a63d302.entry.js → p-e086a18a.entry.js} +1 -1
- package/dist/twilight/{p-cda9559e.entry.js → p-e41ed882.entry.js} +1 -1
- package/dist/twilight/{p-dd107ead.entry.js → p-ea727ca3.entry.js} +1 -1
- package/dist/twilight/{p-D6rcrZ5Y.js → p-xlB0zmD0.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/components/salla-file-upload/salla-file-upload.d.ts +5 -5
- package/dist/types/components/salla-rating-modal/salla-rating-modal.d.ts +21 -19
- package/dist/types/components.d.ts +2 -2
- package/package.json +5 -5
- package/dist/twilight/p-0924f4fa.entry.js +0 -4
- package/dist/twilight/p-7ab35a9b.entry.js +0 -11
|
@@ -14,6 +14,15 @@ export class SallaRatingModal {
|
|
|
14
14
|
constructor() {
|
|
15
15
|
this.hasError = false;
|
|
16
16
|
this.showContactWidget = true;
|
|
17
|
+
this.images = [];
|
|
18
|
+
this.productImages = {};
|
|
19
|
+
this.editItemImages = [];
|
|
20
|
+
this.contact_body = (store, id, customer) => salla.lang.get('pages.rating.contact_subject', { store, id, customer });
|
|
21
|
+
this.editMode = false;
|
|
22
|
+
this.defaultMode = false;
|
|
23
|
+
this.deleteMode = false;
|
|
24
|
+
this.shouldOpenDeleteModal = false;
|
|
25
|
+
this.editItem = null;
|
|
17
26
|
this.dragAndDropFilesLabel = salla.lang.get('common.uploader.drag_and_drop_files');
|
|
18
27
|
this.contactSubjectLabel = salla.lang.get('pages.rating.contact_subject');
|
|
19
28
|
this.editReviewLabel = salla.lang.get('pages.rating.edit_review');
|
|
@@ -27,24 +36,16 @@ export class SallaRatingModal {
|
|
|
27
36
|
this.confirmDeleteBtn = salla.lang.get('common.elements.confirm_delete');
|
|
28
37
|
this.updatedSuccessfullyLabel = salla.lang.get("pages.rating.review_updated_successfully");
|
|
29
38
|
this.deletedSuccessfullyLabel = salla.lang.get("pages.rating.review_deleted_successfully");
|
|
39
|
+
this.contactUsLabel = salla.lang.get('blocks.footer.social');
|
|
30
40
|
this.allowAttachImages = salla.config.get('store.settings.rating.allow_attach_images');
|
|
31
41
|
this.allowContactSupport = salla.config.get('store.settings.rating.allow_contact_support');
|
|
32
|
-
this.contactUsLabel = salla.lang.get('blocks.footer.social');
|
|
33
|
-
this.images = [];
|
|
34
|
-
this.productImages = {};
|
|
35
|
-
this.editItemImages = [];
|
|
36
|
-
this.contact_body = (store, id, customer) => salla.lang.get('pages.rating.contact_subject', { store, id, customer });
|
|
37
|
-
this.editMode = false;
|
|
38
|
-
this.defaultMode = false;
|
|
39
|
-
this.deleteMode = false;
|
|
40
|
-
this.shouldOpenDeleteModal = false;
|
|
41
|
-
this.editItem = null;
|
|
42
42
|
this.contentRefs = [];
|
|
43
43
|
this.hiddenInputs = [];
|
|
44
44
|
this.isOpen = [];
|
|
45
45
|
this.stepsCount = 0;
|
|
46
46
|
this.currentIndex = 0;
|
|
47
47
|
this.submitted = [];
|
|
48
|
+
this.MAX_UPLOAD_LIMIT = 3;
|
|
48
49
|
this.onOpen = (index) => {
|
|
49
50
|
return new Promise((resolve) => {
|
|
50
51
|
anime({
|
|
@@ -75,7 +76,7 @@ export class SallaRatingModal {
|
|
|
75
76
|
await (this.isOpen[index] ? this.onOpen(index) : this.onClose(index));
|
|
76
77
|
await new Promise((resolve) => setTimeout(resolve, 101));
|
|
77
78
|
if (this.body && this.currentTab) {
|
|
78
|
-
setTimeout(() => this.body.setAttribute('style',
|
|
79
|
+
setTimeout(() => this.body.setAttribute('style', `height:${this.currentTab.offsetHeight + (this.editMode ? 60 : 0)}px`));
|
|
79
80
|
}
|
|
80
81
|
};
|
|
81
82
|
salla.onReady(() => {
|
|
@@ -108,8 +109,10 @@ export class SallaRatingModal {
|
|
|
108
109
|
await setNestedAsync('en.trans', 'pages.rating.review_updated_successfully', 'The review has been successfully updated.');
|
|
109
110
|
await setNestedAsync('ar.trans', 'pages.rating.review_deleted_successfully', 'تم حذف التقييم بنجاح');
|
|
110
111
|
await setNestedAsync('en.trans', 'pages.rating.review_deleted_successfully', 'The review has been successfully deleted.');
|
|
111
|
-
await setNestedAsync('ar.trans', '
|
|
112
|
-
await setNestedAsync('en.trans', '
|
|
112
|
+
await setNestedAsync('ar.trans', 'pages.rating.images_count', 'الصور ( :current من أصل :total )');
|
|
113
|
+
await setNestedAsync('en.trans', 'pages.rating.images_count', 'Images ( :current of :total )');
|
|
114
|
+
await setNestedAsync('ar.trans', 'common.uploader.max_three_images', `.أضف ${this.MAX_UPLOAD_LIMIT} صور كحد أقصى`);
|
|
115
|
+
await setNestedAsync('en.trans', 'common.uploader.max_three_images', `Add up to ${this.MAX_UPLOAD_LIMIT} images maximum.`);
|
|
113
116
|
await setNestedAsync('ar.trans', 'common.elements.confirm_delete', 'تأكيد الحذف');
|
|
114
117
|
await setNestedAsync('en.trans', 'common.elements.confirm_delete', 'Confirm deletion');
|
|
115
118
|
this.dragAndDropFilesLabel = salla.lang.get('common.uploader.drag_and_drop_files');
|
|
@@ -138,7 +141,17 @@ export class SallaRatingModal {
|
|
|
138
141
|
return new Promise((resolve) => {
|
|
139
142
|
setTimeout(() => {
|
|
140
143
|
this.modal.open().then(() => this.order || salla.api.withoutNotifier(() => salla.rating.api.order(this.orderId ? this.orderId : salla.config.get('page.id'))).then(res => this.order = res.data))
|
|
141
|
-
.then(() => this.modal.setTitle(salla.lang.get('pages.rating.rate_order')
|
|
144
|
+
.then(() => this.modal.setTitle(`${salla.lang.get('pages.rating.rate_order')} <span class="unicode">(#${this.order.id})</span>`))
|
|
145
|
+
.then(() => {
|
|
146
|
+
// Initialize productImages for all products
|
|
147
|
+
const initialImages = {};
|
|
148
|
+
if (this.order?.products) {
|
|
149
|
+
for (const item of this.order.products) {
|
|
150
|
+
initialImages[item.product.id] = [];
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
this.productImages = initialImages;
|
|
154
|
+
})
|
|
142
155
|
.then(() => this.modal.stopLoading())
|
|
143
156
|
.then(() => this.stepsCount = [this.order.testimonials_enabled, this.order.products_enabled, this.order.shipping_enabled].filter(enabled => enabled).length)
|
|
144
157
|
.then(() => setTimeout(() => this.handleWizard(), 100))
|
|
@@ -177,9 +190,9 @@ export class SallaRatingModal {
|
|
|
177
190
|
}
|
|
178
191
|
}
|
|
179
192
|
async editReview() {
|
|
180
|
-
|
|
193
|
+
const data = {};
|
|
181
194
|
this.editModal.querySelectorAll('[name]').forEach((input) => {
|
|
182
|
-
|
|
195
|
+
const inputData = salla.helpers.inputData(input.name, input.value, data);
|
|
183
196
|
data[inputData.name] = inputData.value;
|
|
184
197
|
});
|
|
185
198
|
data.images && (data.images = data.images.split(','));
|
|
@@ -229,16 +242,16 @@ export class SallaRatingModal {
|
|
|
229
242
|
this.currentTab = current || this.steps[this.currentIndex];
|
|
230
243
|
Helper.toggleClassIf('.s-rating-modal-step-dot', 's-rating-modal-bg-gray', 's-rating-modal-bg-primary', dot => dot != this.dots[this.currentIndex])
|
|
231
244
|
.toggleClassIf('.s-rating-modal-step', 's-rating-modal-active', 's-rating-modal-hidden', tab => tab == this.currentTab);
|
|
232
|
-
if (this.currentIndex
|
|
245
|
+
if (this.currentIndex !== 0) {
|
|
233
246
|
// the animation
|
|
234
247
|
Helper.toggleElementClassIf(this.currentTab, 's-rating-modal-unactive', 's-rating-modal-hidden', () => true);
|
|
235
248
|
setTimeout(() => Helper.toggleElementClassIf(this.currentTab, 's-rating-modal-active', 's-rating-modal-unactive', () => true), 300);
|
|
236
249
|
}
|
|
237
250
|
// Btn text
|
|
238
|
-
|
|
239
|
-
this.nextBtn?.setText(nextType ? salla.lang.get('pages.rating.rate')
|
|
251
|
+
const nextType = this.steps[this.currentIndex + 1]?.dataset.type;
|
|
252
|
+
this.nextBtn?.setText(nextType ? `${salla.lang.get('pages.rating.rate')} ${salla.lang.get(`pages.rating.${nextType}`)}`
|
|
240
253
|
: salla.lang.get('pages.rating.send_ratings'));
|
|
241
|
-
setTimeout(() => this.body?.setAttribute('style',
|
|
254
|
+
setTimeout(() => this.body?.setAttribute('style', `height:${this.currentTab?.offsetHeight}px`));
|
|
242
255
|
}
|
|
243
256
|
previousTab() {
|
|
244
257
|
this.currentIndex > 0 && this.currentIndex--;
|
|
@@ -281,15 +294,13 @@ export class SallaRatingModal {
|
|
|
281
294
|
validationMessage.innerHTML = salla.lang.get(`pages.rating.rate_${type}_stars`).replace(' (:item)', '');
|
|
282
295
|
throw new Error(validationMessage.innerHTML);
|
|
283
296
|
}
|
|
284
|
-
|
|
285
|
-
validationMessage.innerHTML = '';
|
|
286
|
-
}
|
|
297
|
+
validationMessage.innerHTML = '';
|
|
287
298
|
}
|
|
288
299
|
sendFeedback() {
|
|
289
|
-
|
|
300
|
+
const data = {};
|
|
290
301
|
this.currentTab.querySelectorAll('[name]').forEach((input) => {
|
|
291
302
|
//decode names like `<input name="jamal[inner]" value="hi">` to be {name:jamal, value: {inner:"hi"}}
|
|
292
|
-
|
|
303
|
+
const inputData = salla.helpers.inputData(input.name, input.value, data);
|
|
293
304
|
data[inputData.name] = inputData.value;
|
|
294
305
|
});
|
|
295
306
|
if (this.allowAttachImages && data.products) {
|
|
@@ -302,15 +313,15 @@ export class SallaRatingModal {
|
|
|
302
313
|
if (Object.keys(data).length == 0) {
|
|
303
314
|
return;
|
|
304
315
|
}
|
|
305
|
-
data
|
|
306
|
-
data
|
|
316
|
+
data.order_id = this.orderId;
|
|
317
|
+
data.type = this.currentTab.dataset.type;
|
|
307
318
|
this.submitted.push(this.currentIndex);
|
|
308
319
|
return salla.rating.api[this.currentTab.dataset.type](data);
|
|
309
320
|
}
|
|
310
321
|
showThankYou() {
|
|
311
322
|
let seconds = 10;
|
|
312
323
|
let timeToClose = setInterval(() => {
|
|
313
|
-
this.thanksTime.innerHTML =
|
|
324
|
+
this.thanksTime.innerHTML = `00:0${seconds--}`;
|
|
314
325
|
if (seconds > 0) {
|
|
315
326
|
return;
|
|
316
327
|
}
|
|
@@ -345,7 +356,7 @@ export class SallaRatingModal {
|
|
|
345
356
|
if (isOpen.detail) {
|
|
346
357
|
return;
|
|
347
358
|
}
|
|
348
|
-
this.modal
|
|
359
|
+
this.modal?.close();
|
|
349
360
|
this.editItem = null;
|
|
350
361
|
this.editItemImages = [];
|
|
351
362
|
this.hiddenInputs[1] && (this.hiddenInputs[1].value = '');
|
|
@@ -359,11 +370,16 @@ export class SallaRatingModal {
|
|
|
359
370
|
getDeleteModal() {
|
|
360
371
|
return (h("salla-modal", { ref: modal => this.deleteModal = modal, width: "xs", onModalVisibilityChanged: (isOpen) => this.resetData(isOpen) }, h("div", { class: "s-rating-modal-delete-wrapper", ref: el => this.body = el }, h("h3", null, this.confirmDeletionLabel), h("p", null, this.areYouSureLabel), h("div", { class: "s-rating-modal-delete-actions" }, h("salla-button", { loaderPosition: 'center', onClick: () => this.deleteReview() }, this.confirmDeleteBtn), h("salla-button", { color: 'danger', fill: 'outline', onClick: () => this.deleteModal.close() }, this.cancelLabel)))));
|
|
361
372
|
}
|
|
373
|
+
renderUploadedImagesCount(productId) {
|
|
374
|
+
// In edit mode, use editItemImages; in default mode, use productImages
|
|
375
|
+
const imageCount = this.editMode ? this.editItemImages.length : (this.productImages[productId] || []).length;
|
|
376
|
+
return (h("span", { class: "s-rating-modal-upload-count" }, salla.lang.choice("pages.rating.images_count", imageCount, { current: imageCount, total: this.MAX_UPLOAD_LIMIT })));
|
|
377
|
+
}
|
|
362
378
|
getEditModal() {
|
|
363
379
|
return (h("salla-modal", { ref: modal => this.editModal = modal, width: "md", onModalVisibilityChanged: (isOpen) => this.resetData(isOpen) }, h("div", { class: "s-rating-modal-edit-wrapper", ref: el => this.body = el }, this.editType === "store" && this.editItem ? (h("div", { class: "rating-outer-form s-rating-modal-step-wrap s-rating-modal-step", "data-type": "store", ref: currentTab => this.currentTab = currentTab }, h("div", { class: "s-rating-modal-rounded-icon" }, h("img", { src: salla.config.get('store.logo', 'https://assets.salla.sa/cp/assets/images/logo-new.png'), alt: "store name", class: "s-rating-modal-store-logo" })), h("h2", { class: "s-rating-modal-title" }, salla.lang.get('pages.rating.rate_the_store')), h("div", { class: "s-rating-modal-stars-company" }, h("salla-rating-stars", { withLabel: true, size: "large", editable: true, value: this.editItem.stars })), h("textarea", { name: "content", value: this.editItem.content, class: "s-rating-modal-comment", placeholder: salla.lang.get('pages.rating.write_store_rate') }), h("small", { class: "s-rating-modal-validation-msg" }))) : null, this.editType === "shipping" && this.editItem ? (h("div", { class: "rating-outer-form s-rating-modal-step-wrap s-rating-modal-step", "data-type": "shipping", ref: currentTab => this.currentTab = currentTab }, this.editItem.shipping.logo
|
|
364
380
|
? h("div", { class: "s-rating-modal-rounded-icon" }, h("img", { src: this.editItem.shipping.logo, class: "s-rating-modal-shipping-logo", alt: this.editItem.shipping.name }))
|
|
365
|
-
: h("span", { class: "s-rating-modal-icon", innerHTML: ShippingFast }), h("div", { class: "s-rating-modal-title" }, " ", salla.lang.get('pages.rating.rate_shipping')
|
|
366
|
-
this.editItemImages.
|
|
381
|
+
: h("span", { class: "s-rating-modal-icon", innerHTML: ShippingFast }), h("div", { class: "s-rating-modal-title" }, " ", `${salla.lang.get('pages.rating.rate_shipping')} ${this.editItem.shipping.name}`), h("div", { class: "s-rating-modal-stars-company" }, h("salla-rating-stars", { withLabel: true, size: "large", editable: true, value: this.editItem.stars })), h("textarea", { name: "content", class: "s-rating-modal-comment", value: this.editItem.content, placeholder: salla.lang.get('pages.rating.write_shipping_rate') }), h("small", { class: "s-rating-modal-validation-msg" }))) : null, this.editType == "product" && this.editItem ? h("section", { class: "s-rating-modal-step", "data-type": "products", ref: currentTab => this.currentTab = currentTab }, h("div", { class: "s-rating-modal-product" }, h("div", { class: "rating-outer-form", "data-stars-error": salla.lang.get('pages.rating.rate_product_stars') }, h("div", { class: "s-rating-modal-product-img-wrap" }, h("img", { src: this.editItem.product.image.url, alt: this.editItem.product.name, class: "s-rating-modal-product-img" })), h("div", { class: "s-rating-modal-product-details" }, h("div", { class: "s-rating-modal-product-details-main" }, h("div", null, h("h3", { class: "s-rating-modal-product-title" }, " ", this.editItem.product.name), h("div", { class: "s-rating-modal-stars-product" }, h("salla-rating-stars", { withLabel: true, size: "small", editable: true, value: this.editItem.stars }))), this.allowAttachImages && h("salla-button", { class: "s-comments-item-like-btn mt-0", loaderPosition: 'center', fill: 'outline', size: 'small', onClick: () => this.toggleUploader(1) }, h("span", null, this.editItemImages.length ? this.editImagesLabel : this.addImagesLabel), h("span", { innerHTML: ImageIcon }))), h("textarea", { value: this.editItem.content, placeholder: salla.lang.get('pages.rating.write_product_rate'), name: "content", class: "s-rating-modal-comment" }), h("small", { class: "s-rating-modal-validation-msg" }))), this.allowAttachImages && (h("div", { class: "s-rating-modal-uploader is-closed", ref: (el) => (this.contentRefs[1] = el) }, h("salla-file-upload", { name: "images", allowMultiple: true, maxFilesCount: this.MAX_UPLOAD_LIMIT, imagePreviewHeight: 117, filePosterHeight: 117, "instant-upload": true, type: "feedback", files: JSON.stringify(this.editItemImages), payloadName: "files[]", id: `file-${this.editItem.product.id}`, title: this.editItem.product.name, instantUpload: true, accept: "image/png, image/jpeg, image/jpg", url: salla.url.api('upload'), onUploaded: (e) => {
|
|
382
|
+
this.editItemImages = [...this.editItemImages, e.detail];
|
|
367
383
|
this.hiddenInputs[1].value = this.editItemImages.map(img => img.url).join();
|
|
368
384
|
}, onRemoved: (e) => {
|
|
369
385
|
const removedId = e.detail;
|
|
@@ -371,7 +387,7 @@ export class SallaRatingModal {
|
|
|
371
387
|
return;
|
|
372
388
|
this.editItemImages = this.editItemImages.filter(img => img.id !== removedId);
|
|
373
389
|
this.hiddenInputs[1].value = this.editItemImages.map(img => img.url).join();
|
|
374
|
-
}, labelIdle: this.getFilepondPlaceholder() }), h("input", { type: "hidden", name: "images", value: this.editItem.images.join(','), ref: (el) => (this.hiddenInputs[1] = el) })))))
|
|
390
|
+
}, labelIdle: this.getFilepondPlaceholder() }), h("input", { type: "hidden", name: "images", value: this.editItem.images.join(','), ref: (el) => (this.hiddenInputs[1] = el) }), this.renderUploadedImagesCount(this.editItem.product.id)))))
|
|
375
391
|
: null, h("div", { class: "s-rating-modal-footer s-rating-modal-footer-end" }, h("salla-button", { "loader-position": 'center', onClick: () => this.editReview() }, this.editReviewLabel)))));
|
|
376
392
|
}
|
|
377
393
|
render() {
|
|
@@ -382,28 +398,31 @@ export class SallaRatingModal {
|
|
|
382
398
|
return h(Host, { class: "s-rating-modal" }, this.getEditModal());
|
|
383
399
|
}
|
|
384
400
|
if (this.defaultMode) {
|
|
385
|
-
return (h(Host, { class: "s-rating-modal" }, h("salla-modal", { class: "s-rating-modal-wrap", onModalVisibilityChanged: (isOpen) => this.resetData(isOpen), isLoading: true, width: "md", ref: modal => this.modal = modal }, h("div", { slot: 'loading' }, h("div", { class: "s-rating-modal-skeleton" }, h("salla-skeleton", { type: 'circle', height: '80px', width: '80px' }), h("salla-skeleton", { height: '15px', width: '60%' }), h("salla-skeleton", { height: '10px', width: '30%' }), h("div", { class: "s-rating-modal-skeleton-stars" }, [...Array(5)].map(() => h("div", { innerHTML: Star }))), h("salla-skeleton", { height: '100px', width: '100%' }), h("div", { class: "s-rating-modal-skeleton-footer" }, h("salla-skeleton", { height: '40px', width: '30%' })))), !this.hasError && this.order
|
|
401
|
+
return (h(Host, { class: "s-rating-modal" }, h("salla-modal", { class: "s-rating-modal-wrap", onModalVisibilityChanged: (isOpen) => this.resetData(isOpen), isLoading: true, width: "md", ref: modal => this.modal = modal }, h("div", { slot: 'loading' }, h("div", { class: "s-rating-modal-skeleton" }, h("salla-skeleton", { type: 'circle', height: '80px', width: '80px' }), h("salla-skeleton", { height: '15px', width: '60%' }), h("salla-skeleton", { height: '10px', width: '30%' }), h("div", { class: "s-rating-modal-skeleton-stars" }, [...Array(5)].map((v) => h("div", { key: v, innerHTML: Star }))), h("salla-skeleton", { height: '100px', width: '100%' }), h("div", { class: "s-rating-modal-skeleton-footer" }, h("salla-skeleton", { height: '40px', width: '30%' })))), !this.hasError && this.order
|
|
386
402
|
? [h("div", { class: "s-rating-modal-wrapper", ref: el => this.body = el }, this.order?.testimonials_enabled ?
|
|
387
403
|
h("div", { class: "rating-outer-form s-rating-modal-step-wrap s-rating-modal-step s-rating-modal-hidden", "data-type": "store" }, h("div", { class: "s-rating-modal-rounded-icon" }, h("img", { src: salla.config.get('store.logo', 'https://assets.salla.sa/cp/assets/images/logo-new.png'), alt: "store name", class: "s-rating-modal-store-logo" })), h("h2", { class: "s-rating-modal-title" }, salla.lang.get('pages.rating.rate_the_store')), h("div", { class: "s-rating-modal-stars-company" }, h("salla-rating-stars", { withLabel: true, size: "large" })), h("textarea", { name: "comment", class: "s-rating-modal-comment", placeholder: salla.lang.get('pages.rating.write_store_rate') }), h("small", { class: "s-rating-modal-validation-msg" }))
|
|
388
404
|
: '', this.order.products_enabled
|
|
389
|
-
? h("section", { class: "s-rating-modal-step s-rating-modal-hidden", "data-type": "products" }, this.order.products.map((item, index) => h("div", { class: "s-rating-modal-product", key: index }, h("div", { class: "rating-outer-form", "data-stars-error": salla.lang.get('pages.rating.rate_product_stars') }, h("div", { class: "s-rating-modal-product-img-wrap" }, h("img", { src: item.product.thumbnail, alt: item.product.name, class: "s-rating-modal-product-img" })), h("div", { class: "s-rating-modal-product-details" }, h("div", { class: "s-rating-modal-product-details-main" }, h("div", null, h("h3", { class: "s-rating-modal-product-title" }, " ", item.product.name), h("div", { class: "s-rating-modal-stars-product" }, h("salla-rating-stars", { withLabel: true, size: "small", name: `products[${index}][rating]` }))), this.allowAttachImages && h("salla-button", { class:
|
|
390
|
-
|
|
391
|
-
this.productImages
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
this.hiddenInputs[index].value = this.productImages[item.product.id].map(img => img.url);
|
|
405
|
+
? h("section", { class: "s-rating-modal-step s-rating-modal-hidden", "data-type": "products" }, this.order.products.map((item, index) => h("div", { class: "s-rating-modal-product", key: index }, h("div", { class: "rating-outer-form", "data-stars-error": salla.lang.get('pages.rating.rate_product_stars') }, h("div", { class: "s-rating-modal-product-img-wrap" }, h("img", { src: item.product.thumbnail, alt: item.product.name, class: "s-rating-modal-product-img" })), h("div", { class: "s-rating-modal-product-details" }, h("div", { class: "s-rating-modal-product-details-main" }, h("div", null, h("h3", { class: "s-rating-modal-product-title" }, " ", item.product.name), h("div", { class: "s-rating-modal-stars-product" }, h("salla-rating-stars", { withLabel: true, size: "small", name: `products[${index}][rating]` }))), this.allowAttachImages && h("salla-button", { class: "s-comments-item-like-btn mt-0", loaderPosition: 'center', fill: 'outline', size: 'small', onClick: () => this.toggleUploader(index) }, h("span", null, this.addImagesLabel), h("span", { innerHTML: ImageIcon }))), h("input", { type: "hidden", name: `products[${index}][product_id]`, value: item.product.id }), h("textarea", { placeholder: salla.lang.get('pages.rating.write_product_rate'), name: `products[${index}][comment]`, class: "s-rating-modal-comment" }), h("small", { class: "s-rating-modal-validation-msg" }))), this.allowAttachImages && (h("div", { class: "s-rating-modal-uploader is-closed", ref: (el) => (this.contentRefs[index] = el) }, h("salla-file-upload", { name: "image", maxFilesCount: this.MAX_UPLOAD_LIMIT, imagePreviewHeight: 117, "instant-upload": true, type: "feedback", payloadName: "files[]", id: `file-${item.product.id}`, title: item.product.name, allowMultiple: true, instantUpload: true, accept: "image/png, image/jpeg, image/jpg", url: salla.url.api('upload'), onUploaded: (e) => {
|
|
406
|
+
this.productImages = {
|
|
407
|
+
...this.productImages,
|
|
408
|
+
[item.product.id]: [...(this.productImages[item.product.id] || []), e.detail]
|
|
409
|
+
};
|
|
410
|
+
this.hiddenInputs[index].value = this.productImages[item.product.id].map(img => img.url).join(',');
|
|
395
411
|
}, onRemoved: (e) => {
|
|
396
412
|
const removedId = e.detail;
|
|
397
|
-
if (!removedId)
|
|
413
|
+
if (!removedId || !this.productImages[item.product.id])
|
|
398
414
|
return;
|
|
399
|
-
this.productImages
|
|
400
|
-
|
|
401
|
-
|
|
415
|
+
this.productImages = {
|
|
416
|
+
...this.productImages,
|
|
417
|
+
[item.product.id]: this.productImages[item.product.id].filter(img => img.id !== removedId)
|
|
418
|
+
};
|
|
419
|
+
this.hiddenInputs[index].value = this.productImages[item.product.id].map(img => img.url).join(',');
|
|
420
|
+
}, labelIdle: this.getFilepondPlaceholder() }), h("input", { type: "hidden", name: `products[${index}][images]`, value: (this.productImages[item.product.id] || []).map(img => img.url).join(','), ref: (el) => (this.hiddenInputs[index] = el) }), this.renderUploadedImagesCount(item.product.id))))))
|
|
402
421
|
: '', this.order.shipping_enabled && this.order.shipping?.company
|
|
403
422
|
? h("div", { class: "rating-outer-form s-rating-modal-step-wrap s-rating-modal-step s-rating-modal-hidden", "data-type": "shipping" }, h("input", { type: "hidden", name: "shipping_company_id", value: this.order.shipping.company.id }), this.order.shipping.company.logo
|
|
404
423
|
? h("div", { class: "s-rating-modal-rounded-icon" }, h("img", { src: this.order.shipping.company.logo, class: "s-rating-modal-shipping-logo", alt: this.order.shipping.company.name }))
|
|
405
|
-
: h("span", { class: "s-rating-modal-icon", innerHTML: ShippingFast }), h("div", { class: "s-rating-modal-title" }, " ", salla.lang.get('pages.rating.rate_shipping')
|
|
406
|
-
: '', h("div", { class: "s-rating-modal-thanks s-rating-modal-hidden", ref: el => this.thanksTab = el }, h("span", { class: "s-rating-modal-icon", innerHTML: CheckCircle2 }), h("h3", { class: "s-rating-modal-thanks-title" }, salla.lang.get('pages.rating.thanks')), h("div", { class: "s-rating-modal-thanks-msg", innerHTML: this.order.thanks_message }), h("time", { class: "s-rating-modal-thanks-time", ref: el => this.thanksTime = el }))), this.allowContactSupport && this.showContactWidget && (salla.config.get('store.contacts.whatsapp') || salla.config.get('store.contacts.email')) ? h("div", { class: "s-rating-modal-contact" }, h("p", null, this.contactUsLabel), h("div", { class: "s-rating-modal-contact-icons" }, salla.config.get('store.contacts.whatsapp') && h("span", { onClick: () => this.handleSendWhatsApp(), innerHTML: WhatsappIcon }), salla.config.get('store.contacts.email') && h("span", { onClick: () => this.handleSendEmail(), innerHTML: MailIcon }))) : '', h("div", { class: "s-rating-modal-footer" }, h("button", { ref: el => this.backBtn = el, onClick: () => this.previousTab(), class: "s-rating-modal-btn s-rating-modal-unvisiable" }, salla.lang.get('common.elements.back')), this.stepsCount > 1 ? h("ul", { class: "s-rating-modal-dots" }, [0, 1, 2].slice(0, this.stepsCount).map(() => h("li", { class: 's-rating-modal-bg-gray s-rating-modal-step-dot' }))) : '', h("salla-button", { "loader-position": 'center', ref: el => this.nextBtn = el, onClick: () => this.submit() }, salla.lang.get('common.elements.next')))]
|
|
424
|
+
: h("span", { class: "s-rating-modal-icon", innerHTML: ShippingFast }), h("div", { class: "s-rating-modal-title" }, " ", `${salla.lang.get('pages.rating.rate_shipping')} ${this.order.shipping.company.name}`), h("div", { class: "s-rating-modal-stars-company" }, h("salla-rating-stars", { withLabel: true, size: "large" })), h("textarea", { name: "comment", class: "s-rating-modal-comment", placeholder: salla.lang.get('pages.rating.write_shipping_rate') }), h("small", { class: "s-rating-modal-validation-msg" }))
|
|
425
|
+
: '', h("div", { class: "s-rating-modal-thanks s-rating-modal-hidden", ref: el => this.thanksTab = el }, h("span", { class: "s-rating-modal-icon", innerHTML: CheckCircle2 }), h("h3", { class: "s-rating-modal-thanks-title" }, salla.lang.get('pages.rating.thanks')), h("div", { class: "s-rating-modal-thanks-msg", innerHTML: this.order.thanks_message }), h("time", { class: "s-rating-modal-thanks-time", ref: el => this.thanksTime = el }))), this.allowContactSupport && this.showContactWidget && (salla.config.get('store.contacts.whatsapp') || salla.config.get('store.contacts.email')) ? h("div", { class: "s-rating-modal-contact" }, h("p", null, this.contactUsLabel), h("div", { class: "s-rating-modal-contact-icons" }, salla.config.get('store.contacts.whatsapp') && h("span", { onClick: () => this.handleSendWhatsApp(), innerHTML: WhatsappIcon }), salla.config.get('store.contacts.email') && h("span", { onClick: () => this.handleSendEmail(), innerHTML: MailIcon }))) : '', h("div", { class: "s-rating-modal-footer" }, h("button", { ref: el => this.backBtn = el, onClick: () => this.previousTab(), class: "s-rating-modal-btn s-rating-modal-unvisiable" }, salla.lang.get('common.elements.back')), this.stepsCount > 1 ? h("ul", { class: "s-rating-modal-dots" }, [0, 1, 2].slice(0, this.stepsCount).map((v) => h("li", { key: v, class: 's-rating-modal-bg-gray s-rating-modal-step-dot' }))) : '', h("salla-button", { "loader-position": 'center', ref: el => this.nextBtn = el, onClick: () => this.submit() }, salla.lang.get('common.elements.next')))]
|
|
407
426
|
: h("salla-placeholder", { alignment: "center" }))));
|
|
408
427
|
}
|
|
409
428
|
}
|
|
@@ -455,22 +474,6 @@ export class SallaRatingModal {
|
|
|
455
474
|
"hasError": {},
|
|
456
475
|
"showContactWidget": {},
|
|
457
476
|
"errorMessage": {},
|
|
458
|
-
"dragAndDropFilesLabel": {},
|
|
459
|
-
"contactSubjectLabel": {},
|
|
460
|
-
"editReviewLabel": {},
|
|
461
|
-
"allowedImagesTypesLabel": {},
|
|
462
|
-
"addImagesLabel": {},
|
|
463
|
-
"editImagesLabel": {},
|
|
464
|
-
"threeImagesMax": {},
|
|
465
|
-
"areYouSureLabel": {},
|
|
466
|
-
"confirmDeletionLabel": {},
|
|
467
|
-
"cancelLabel": {},
|
|
468
|
-
"confirmDeleteBtn": {},
|
|
469
|
-
"updatedSuccessfullyLabel": {},
|
|
470
|
-
"deletedSuccessfullyLabel": {},
|
|
471
|
-
"allowAttachImages": {},
|
|
472
|
-
"allowContactSupport": {},
|
|
473
|
-
"contactUsLabel": {},
|
|
474
477
|
"images": {},
|
|
475
478
|
"productImages": {},
|
|
476
479
|
"editItemImages": {},
|
|
@@ -495,6 +498,14 @@ export class SallaRatingModal {
|
|
|
495
498
|
"Promise": {
|
|
496
499
|
"location": "global",
|
|
497
500
|
"id": "global::Promise"
|
|
501
|
+
},
|
|
502
|
+
"Record": {
|
|
503
|
+
"location": "global",
|
|
504
|
+
"id": "global::Record"
|
|
505
|
+
},
|
|
506
|
+
"Array": {
|
|
507
|
+
"location": "global",
|
|
508
|
+
"id": "global::Array"
|
|
498
509
|
}
|
|
499
510
|
},
|
|
500
511
|
"return": "Promise<unknown>"
|