@salla.sa/twilight-components 1.6.5 → 1.6.7
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/salla-button_27.cjs.entry.js +10 -7
- package/dist/collection/components/salla-gifting/salla-gifting.css +0 -13
- package/dist/collection/components/salla-gifting/salla-gifting.js +7 -4
- package/dist/collection/components/salla-offer-modal/salla-offer-modal.js +2 -2
- package/dist/components/salla-gifting.js +8 -5
- package/dist/components/salla-offer-modal.js +2 -2
- package/dist/esm/salla-button_27.entry.js +10 -7
- package/dist/twilight-components/{p-6087187d.entry.js → p-8ba20094.entry.js} +1 -1
- package/dist/twilight-components/twilight-components.esm.js +1 -1
- package/package.json +3 -3
|
@@ -18816,11 +18816,12 @@ const GiftSharing = `<!-- Generated by IcoMoon.io -->
|
|
|
18816
18816
|
</svg>
|
|
18817
18817
|
`;
|
|
18818
18818
|
|
|
18819
|
-
const sallaGiftingCss = ".s-gifting-steps-wrapper{transition:0.2s cubic-bezier(0.55, 0, 0.1, 1) 0s}.
|
|
18819
|
+
const sallaGiftingCss = ".s-gifting-steps-wrapper{transition:0.2s cubic-bezier(0.55, 0, 0.1, 1) 0s}.s-gifting-select{background-image:url(\"data:image/svg+xml;utf8,<svg fill='black' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>\")}";
|
|
18820
18820
|
|
|
18821
18821
|
const SallaGifting = class {
|
|
18822
18822
|
constructor(hostRef) {
|
|
18823
18823
|
index$1.registerInstance(this, hostRef);
|
|
18824
|
+
this.selectImageForYourGift = salla.lang.get('blocks.buy_as_gift.select_image_or_upload');
|
|
18824
18825
|
this.currentStep = 1;
|
|
18825
18826
|
this.showCalendar = false;
|
|
18826
18827
|
this.showGiftText = false;
|
|
@@ -18839,6 +18840,7 @@ const SallaGifting = class {
|
|
|
18839
18840
|
this.timeZone = null;
|
|
18840
18841
|
salla.lang.onLoaded(() => {
|
|
18841
18842
|
this.selectImageOrUpload = salla.lang.get('blocks.buy_as_gift.select_image_or_upload');
|
|
18843
|
+
this.selectImageForYourGift = salla.lang.get('blocks.buy_as_gift.select_image_for_your_gift');
|
|
18842
18844
|
this.step1Elems = document.querySelectorAll('.gift-step-1 .anime-item');
|
|
18843
18845
|
this.step2Elems = document.querySelectorAll('.gift-step-2 .anime-item');
|
|
18844
18846
|
this.imageCover = document.querySelector('.s-gifting-modal-uploader');
|
|
@@ -18850,7 +18852,6 @@ const SallaGifting = class {
|
|
|
18850
18852
|
this.sectionSubtitle = salla.lang.get('blocks.buy_as_gift.gift_the_one_you_love_message');
|
|
18851
18853
|
this.sectionBtnText = salla.lang.get('blocks.buy_as_gift.send_as_a_gift');
|
|
18852
18854
|
this.giftDetails = salla.lang.get('blocks.buy_as_gift.gift_details');
|
|
18853
|
-
this.selectImageForYourGift = salla.lang.get('blocks.buy_as_gift.select_image_for_your_gift');
|
|
18854
18855
|
this.selectGiftMessage = salla.lang.get('blocks.buy_as_gift.select_gift_message');
|
|
18855
18856
|
this.giftCustomText = salla.lang.get('blocks.buy_as_gift.gift_custom_text');
|
|
18856
18857
|
this.textId = salla.lang.get('blocks.buy_as_gift.text_id');
|
|
@@ -18881,7 +18882,7 @@ const SallaGifting = class {
|
|
|
18881
18882
|
})
|
|
18882
18883
|
.catch(e => {
|
|
18883
18884
|
var _a, _b, _c, _d;
|
|
18884
|
-
this.hasError =
|
|
18885
|
+
this.hasError = false;
|
|
18885
18886
|
this.errorMessage = ((_c = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) === null || _c === void 0 ? void 0 : _c.message) || ((_d = e.response) === null || _d === void 0 ? void 0 : _d.data);
|
|
18886
18887
|
})
|
|
18887
18888
|
.finally(() => this.modal.stopLoading()));
|
|
@@ -18918,12 +18919,13 @@ const SallaGifting = class {
|
|
|
18918
18919
|
let dataID = event.target.children[event.target.selectedIndex].getAttribute('data-id');
|
|
18919
18920
|
let customID = dataID == "custom";
|
|
18920
18921
|
this.showGiftText = customID;
|
|
18921
|
-
// dataID ? this.selectedGiftTextOption = dataID : this.selectedGiftTextOption = undefined;
|
|
18922
18922
|
if (dataID) {
|
|
18923
18923
|
this.selectedGiftTextOption = dataID;
|
|
18924
|
+
customID ? this.selectedText = undefined : this.selectedText = event.target.value;
|
|
18924
18925
|
this.setWrapperHeight(1, 150, 0);
|
|
18925
18926
|
}
|
|
18926
18927
|
else {
|
|
18928
|
+
this.selectedText = undefined;
|
|
18927
18929
|
this.selectedGiftTextOption = undefined;
|
|
18928
18930
|
this.setWrapperHeight(1, 150, -25);
|
|
18929
18931
|
}
|
|
@@ -19132,6 +19134,7 @@ const SallaGifting = class {
|
|
|
19132
19134
|
};
|
|
19133
19135
|
return await salla.product.addGiftToCart(this.productId, payload, true).then((resp) => {
|
|
19134
19136
|
console.log(resp);
|
|
19137
|
+
this.modal.close();
|
|
19135
19138
|
}).catch((e) => {
|
|
19136
19139
|
if (e.response.status == 422) {
|
|
19137
19140
|
this.errors = e.response.data.error.fields;
|
|
@@ -19153,7 +19156,7 @@ const SallaGifting = class {
|
|
|
19153
19156
|
index$1.h("div", { class: "s-gifting-steps-wrapper steps-wrapper" }, index$1.h("div", { class: "s-gifting-step-one gift-step-1" }, index$1.h("div", { class: "s-gifting-modal-uploader-title anime-item opacity-0" }, this.selectImageForYourGift), index$1.h("div", { class: "s-gifting-modal-uploader anime-item opacity-0" }, index$1.h("span", { class: "s-gifting-remove-preview", onClick: () => this.removePreview(), innerHTML: Cancel }), this.selectImageOrUpload && index$1.h("salla-file-upload", { "instant-upload": true, labelIdle: this.getFilepondPlaceholder(), serverConfig: this.getServerConfig(), onRemove: () => this.handleRemoveImage() }, " ")), index$1.h("div", { class: "anime-item opacity-0" }, !this.uploadedImage && !!this.gift && this.gift.gift_images.length > 0 ?
|
|
19154
19157
|
index$1.h("salla-swiper", { "space-between-items": "10", "item-per-view": "4" }, (_a = this.gift) === null || _a === void 0 ? void 0 : _a.gift_images.map((item) => index$1.h("img", { class: "s-gifting-image s-gifting-clickable", src: item.url, onClick: () => this.setPreview(item), alt: `${item.id}` })))
|
|
19155
19158
|
: "", index$1.h("div", { class: "s-form-group s-gifting-selectText anime-item opacity-0" }, index$1.h("label", { htmlFor: "gift-text-selection", class: "s-form-label" }, this.selectGiftMessage), index$1.h("select", { id: "gift-text-selection", name: "gift-text-selection", class: "s-form-control s-gifting-select", onChange: e => this.toggleGiftText(e) }, index$1.h("option", { "data-id": null, selected: true }, this.selectGiftMessage), (_b = this.gift) === null || _b === void 0 ? void 0 :
|
|
19156
|
-
_b.gift_texts.map((txt) => index$1.h("option", { "data-id": txt.id, value: txt.text, key: txt.id }, txt.text)), index$1.h("option", { "data-id": "custom" }, this.giftCustomText))), index$1.h("div", { class: this.showGiftText ? "s-form-group anime-item opacity-0 s-gifting-textarea shown" : "s-form-group s-gifting-textarea hide" }, index$1.h("label", { htmlFor: "gift-custom-text", class: "s-form-label" }, this.giftCustomText), index$1.h("div", { class: "mt-1" }, index$1.h("textarea", { onInput: (event) => this.handleTextAreaChange(event), rows: 4, name: "gift-custom-text", id: "gift-custom-text", class: "s-form-control" }))), index$1.h("div", { class: "anime-item opacity-0" }, index$1.h("salla-button", { color: "primary", width: "wide", onClick: () => this.goToStep2() }, index$1.h("span", null, this.nextStep))))), index$1.h("div", { class: "s-gifting-step-two gift-step-2" }, index$1.h("div", { class: this.errors && this.errors['sender_name'] ? "s-form-group s-form-has-error anime-item opacity-0" : "s-form-group anime-item opacity-0" }, index$1.h("label", { htmlFor: "sender_name", class: "s-form-label" }, this.senderNameLabel), index$1.h("input", { type: "text", class: "s-form-control", name: "sender_name", id: "sender_name", value: this.senderName, onInput: (event) => this.handleSenderName(event), placeholder: "" }), this.errors && this.errors['sender_name'] ? index$1.h("span", { class: "text-danger text-xs" }, this.errors['sender_name']) : ''), index$1.h("div", { class: this.errors && this.errors['receiver.name'] ? "s-form-group s-form-has-error anime-item opacity-0" : "s-form-group anime-item opacity-0" }, index$1.h("label", { htmlFor: "receiver_name", class: "s-form-label" }, this.receiverNameFieldLabel), index$1.h("input", { type: "text", class: "s-form-control", name: "receiver_name", id: "receiver_name", value: "", onInput: (event) => this.handleReceiverName(event), placeholder: "" }), this.errors && this.errors['receiver.name'] ? index$1.h("span", { class: "text-danger text-xs" }, this.errors['receiver.name']) : ''), index$1.h("div", { class: this.errors && this.errors['receiver.mobile'] ? "s-form-group s-form-has-error anime-item opacity-0" : "s-form-group anime-item opacity-0" }, index$1.h("label", { class: "s-form-label" }, this.receiverMobileFieldLabel), index$1.h("salla-tel-input", { class: "s-gifting-tel-input", phone: this.receiverMobile, countryCode: this.receiverCountryCode, onPhoneEntered: (e) => this.handlePhoneInputChange(e) }), this.errors && this.errors['receiver.mobile'] ? index$1.h("span", { class: "text-danger text-xs" }, this.errors['receiver.mobile']) : ''), index$1.h("div", { class: "anime-item opacity-0" }, index$1.h("label", { class: "s-gifting-schedule s-gifting-clickable", htmlFor: "schedule" }, index$1.h("input", { type: "checkbox", name: 'schedule', id: 'schedule', onChange: () => this.toggleCalendar(), class: "s-checkbox" }), index$1.h("span", { class: "s-form-label" }, " ", this.sendLater, " "))), index$1.h("div", { class: this.getCalendarClasses() }, index$1.h("label", { class: "s-form-label" }, this.selectSendDateAndTime), index$1.h("salla-datetime-picker", { value: this.deliveryDate, placeholder: this.selectSendDateAndTime, "enable-time": true, "date-format": "Y-m-d H:i", onPicked: (event) => this.handleDateTimePicker(event) }), index$1.h("span", { class: "s-gifting-calendar-hint" }, this.canNotEditOrderAfterSelectDate)), index$1.h("div", { class: "s-gifting-step-two-footer anime-item opacity-0" }, index$1.h("a", { href: "#!", innerHTML: this.currentLang == 'ar' ? ArrowRightIcon : ArrowLeftIcon, onClick: () => this.goToStep1() }), index$1.h("salla-button", { onClick: () => this.submitForm(), color: "primary", width: 'wide' }, index$1.h("span", null, this.sendGift)))))
|
|
19159
|
+
_b.gift_texts.map((txt) => index$1.h("option", { "data-id": txt.id, value: txt.text, key: txt.id }, txt.text)), index$1.h("option", { "data-id": "custom" }, this.giftCustomText))), index$1.h("div", { class: this.showGiftText ? "s-form-group anime-item opacity-0 s-gifting-textarea shown" : "s-form-group s-gifting-textarea hide" }, index$1.h("label", { htmlFor: "gift-custom-text", class: "s-form-label" }, this.giftCustomText), index$1.h("div", { class: "mt-1" }, index$1.h("textarea", { onInput: (event) => this.handleTextAreaChange(event), rows: 4, name: "gift-custom-text", id: "gift-custom-text", class: "s-form-control" }))), index$1.h("div", { class: "anime-item opacity-0" }, index$1.h("salla-button", { color: "primary", width: "wide", onClick: () => this.goToStep2() }, index$1.h("span", null, this.nextStep))))), index$1.h("div", { class: "s-gifting-step-two gift-step-2" }, index$1.h("div", { class: this.errors && this.errors['sender_name'] ? "s-form-group s-form-has-error anime-item opacity-0" : "s-form-group anime-item opacity-0" }, index$1.h("label", { htmlFor: "sender_name", class: "s-form-label" }, this.senderNameLabel), index$1.h("input", { type: "text", class: "s-form-control", name: "sender_name", id: "sender_name", value: this.senderName, onInput: (event) => this.handleSenderName(event), placeholder: "" }), this.errors && this.errors['sender_name'] ? index$1.h("span", { class: "text-danger text-xs" }, this.errors['sender_name']) : ''), index$1.h("div", { class: this.errors && this.errors['receiver.name'] ? "s-form-group s-form-has-error anime-item opacity-0" : "s-form-group anime-item opacity-0" }, index$1.h("label", { htmlFor: "receiver_name", class: "s-form-label" }, this.receiverNameFieldLabel), index$1.h("input", { type: "text", class: "s-form-control", name: "receiver_name", id: "receiver_name", value: "", onInput: (event) => this.handleReceiverName(event), placeholder: "" }), this.errors && this.errors['receiver.name'] ? index$1.h("span", { class: "text-danger text-xs" }, this.errors['receiver.name']) : ''), index$1.h("div", { class: this.errors && this.errors['receiver.mobile'] ? "s-form-group s-form-has-error anime-item opacity-0" : "s-form-group anime-item opacity-0" }, index$1.h("label", { class: "s-form-label" }, this.receiverMobileFieldLabel), index$1.h("salla-tel-input", { class: "s-gifting-tel-input", phone: this.receiverMobile, countryCode: this.receiverCountryCode, onPhoneEntered: (e) => this.handlePhoneInputChange(e) }), this.errors && this.errors['receiver.mobile'] ? index$1.h("span", { class: "text-danger text-xs" }, this.errors['receiver.mobile']) : ''), index$1.h("div", { class: "anime-item opacity-0" }, index$1.h("label", { class: "s-gifting-schedule s-gifting-clickable", htmlFor: "schedule" }, index$1.h("input", { type: "checkbox", name: 'schedule', id: 'schedule', onChange: () => this.toggleCalendar(), class: "s-checkbox" }), index$1.h("span", { class: "s-form-label" }, " ", this.sendLater, " "))), index$1.h("div", { class: this.getCalendarClasses() }, index$1.h("label", { class: "s-form-label" }, this.selectSendDateAndTime), index$1.h("salla-datetime-picker", { value: this.deliveryDate, placeholder: this.selectSendDateAndTime, "enable-time": true, "date-format": "Y-m-d H:i K", onPicked: (event) => this.handleDateTimePicker(event) }), index$1.h("span", { class: "s-gifting-calendar-hint" }, this.canNotEditOrderAfterSelectDate)), index$1.h("div", { class: "s-gifting-step-two-footer anime-item opacity-0" }, index$1.h("a", { href: "#!", innerHTML: this.currentLang == 'ar' ? ArrowRightIcon : ArrowLeftIcon, onClick: () => this.goToStep1() }), index$1.h("salla-button", { onClick: () => this.submitForm(), color: "primary", width: 'wide' }, index$1.h("span", null, this.sendGift)))))
|
|
19157
19160
|
], index$1.h("slot", { name: "footer" })))
|
|
19158
19161
|
];
|
|
19159
19162
|
}
|
|
@@ -20135,14 +20138,14 @@ const SallaOfferModal = class {
|
|
|
20135
20138
|
async open(product_id) {
|
|
20136
20139
|
//TODO:: make sure there is only one offer
|
|
20137
20140
|
this.modal.open();
|
|
20138
|
-
return salla.api.withoutNotifier(salla.product.offers(product_id)
|
|
20141
|
+
return salla.api.withoutNotifier(salla.product.offers(product_id)
|
|
20139
20142
|
.then(response => this.showOffer(response.data[0]))
|
|
20140
20143
|
.catch(e => {
|
|
20141
20144
|
var _a, _b, _c, _d;
|
|
20142
20145
|
this.hasError = true;
|
|
20143
20146
|
this.errorMessage = ((_c = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) === null || _c === void 0 ? void 0 : _c.message) || ((_d = e.response) === null || _d === void 0 ? void 0 : _d.data);
|
|
20144
20147
|
})
|
|
20145
|
-
.finally(() => setTimeout(() => { this.modal.stopLoading(); }, 1000));
|
|
20148
|
+
.finally(() => setTimeout(() => { this.modal.stopLoading(); }, 1000)));
|
|
20146
20149
|
}
|
|
20147
20150
|
/**
|
|
20148
20151
|
* Show offer details
|
|
@@ -2,19 +2,6 @@
|
|
|
2
2
|
transition: 0.2s cubic-bezier(0.55, 0, 0.1, 1) 0s;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
.is-current-step-2 .gift-step-1,
|
|
6
|
-
.is-current-step-1 .gift-step-2 {
|
|
7
|
-
pointer-events: none;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.is-current-step-1 .gift-step-2 {
|
|
11
|
-
transform: translateX(105%);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.s-gifting-modal .s-modal-body::-webkit-scrollbar {
|
|
15
|
-
display: none;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
5
|
.s-gifting-select {
|
|
19
6
|
background-image: url("data:image/svg+xml;utf8,<svg fill='black' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
|
|
20
7
|
}
|
|
@@ -10,6 +10,7 @@ import Cancel from '../../assets/svg/cancel.svg';
|
|
|
10
10
|
import GiftSharing from '../../assets/svg/gift-sharing.svg';
|
|
11
11
|
export class SallaGifting {
|
|
12
12
|
constructor() {
|
|
13
|
+
this.selectImageForYourGift = salla.lang.get('blocks.buy_as_gift.select_image_or_upload');
|
|
13
14
|
this.currentStep = 1;
|
|
14
15
|
this.showCalendar = false;
|
|
15
16
|
this.showGiftText = false;
|
|
@@ -28,6 +29,7 @@ export class SallaGifting {
|
|
|
28
29
|
this.timeZone = null;
|
|
29
30
|
salla.lang.onLoaded(() => {
|
|
30
31
|
this.selectImageOrUpload = salla.lang.get('blocks.buy_as_gift.select_image_or_upload');
|
|
32
|
+
this.selectImageForYourGift = salla.lang.get('blocks.buy_as_gift.select_image_for_your_gift');
|
|
31
33
|
this.step1Elems = document.querySelectorAll('.gift-step-1 .anime-item');
|
|
32
34
|
this.step2Elems = document.querySelectorAll('.gift-step-2 .anime-item');
|
|
33
35
|
this.imageCover = document.querySelector('.s-gifting-modal-uploader');
|
|
@@ -39,7 +41,6 @@ export class SallaGifting {
|
|
|
39
41
|
this.sectionSubtitle = salla.lang.get('blocks.buy_as_gift.gift_the_one_you_love_message');
|
|
40
42
|
this.sectionBtnText = salla.lang.get('blocks.buy_as_gift.send_as_a_gift');
|
|
41
43
|
this.giftDetails = salla.lang.get('blocks.buy_as_gift.gift_details');
|
|
42
|
-
this.selectImageForYourGift = salla.lang.get('blocks.buy_as_gift.select_image_for_your_gift');
|
|
43
44
|
this.selectGiftMessage = salla.lang.get('blocks.buy_as_gift.select_gift_message');
|
|
44
45
|
this.giftCustomText = salla.lang.get('blocks.buy_as_gift.gift_custom_text');
|
|
45
46
|
this.textId = salla.lang.get('blocks.buy_as_gift.text_id');
|
|
@@ -70,7 +71,7 @@ export class SallaGifting {
|
|
|
70
71
|
})
|
|
71
72
|
.catch(e => {
|
|
72
73
|
var _a, _b, _c, _d;
|
|
73
|
-
this.hasError =
|
|
74
|
+
this.hasError = false;
|
|
74
75
|
this.errorMessage = ((_c = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) === null || _c === void 0 ? void 0 : _c.message) || ((_d = e.response) === null || _d === void 0 ? void 0 : _d.data);
|
|
75
76
|
})
|
|
76
77
|
.finally(() => this.modal.stopLoading()));
|
|
@@ -107,12 +108,13 @@ export class SallaGifting {
|
|
|
107
108
|
let dataID = event.target.children[event.target.selectedIndex].getAttribute('data-id');
|
|
108
109
|
let customID = dataID == "custom";
|
|
109
110
|
this.showGiftText = customID;
|
|
110
|
-
// dataID ? this.selectedGiftTextOption = dataID : this.selectedGiftTextOption = undefined;
|
|
111
111
|
if (dataID) {
|
|
112
112
|
this.selectedGiftTextOption = dataID;
|
|
113
|
+
customID ? this.selectedText = undefined : this.selectedText = event.target.value;
|
|
113
114
|
this.setWrapperHeight(1, 150, 0);
|
|
114
115
|
}
|
|
115
116
|
else {
|
|
117
|
+
this.selectedText = undefined;
|
|
116
118
|
this.selectedGiftTextOption = undefined;
|
|
117
119
|
this.setWrapperHeight(1, 150, -25);
|
|
118
120
|
}
|
|
@@ -321,6 +323,7 @@ export class SallaGifting {
|
|
|
321
323
|
};
|
|
322
324
|
return await salla.product.addGiftToCart(this.productId, payload, true).then((resp) => {
|
|
323
325
|
console.log(resp);
|
|
326
|
+
this.modal.close();
|
|
324
327
|
}).catch((e) => {
|
|
325
328
|
if (e.response.status == 422) {
|
|
326
329
|
this.errors = e.response.data.error.fields;
|
|
@@ -420,7 +423,7 @@ export class SallaGifting {
|
|
|
420
423
|
" "))),
|
|
421
424
|
h("div", { class: this.getCalendarClasses() },
|
|
422
425
|
h("label", { class: "s-form-label" }, this.selectSendDateAndTime),
|
|
423
|
-
h("salla-datetime-picker", { value: this.deliveryDate, placeholder: this.selectSendDateAndTime, "enable-time": true, "date-format": "Y-m-d H:i", onPicked: (event) => this.handleDateTimePicker(event) }),
|
|
426
|
+
h("salla-datetime-picker", { value: this.deliveryDate, placeholder: this.selectSendDateAndTime, "enable-time": true, "date-format": "Y-m-d H:i K", onPicked: (event) => this.handleDateTimePicker(event) }),
|
|
424
427
|
h("span", { class: "s-gifting-calendar-hint" }, this.canNotEditOrderAfterSelectDate)),
|
|
425
428
|
h("div", { class: "s-gifting-step-two-footer anime-item opacity-0" },
|
|
426
429
|
h("a", { href: "#!", innerHTML: this.currentLang == 'ar' ? RightArrow : LeftArrow, onClick: () => this.goToStep1() }),
|
|
@@ -41,14 +41,14 @@ export class SallaOfferModal {
|
|
|
41
41
|
async open(product_id) {
|
|
42
42
|
//TODO:: make sure there is only one offer
|
|
43
43
|
this.modal.open();
|
|
44
|
-
return salla.api.withoutNotifier(salla.product.offers(product_id)
|
|
44
|
+
return salla.api.withoutNotifier(salla.product.offers(product_id)
|
|
45
45
|
.then(response => this.showOffer(response.data[0]))
|
|
46
46
|
.catch(e => {
|
|
47
47
|
var _a, _b, _c, _d;
|
|
48
48
|
this.hasError = true;
|
|
49
49
|
this.errorMessage = ((_c = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) === null || _c === void 0 ? void 0 : _c.message) || ((_d = e.response) === null || _d === void 0 ? void 0 : _d.data);
|
|
50
50
|
})
|
|
51
|
-
.finally(() => setTimeout(() => { this.modal.stopLoading(); }, 1000));
|
|
51
|
+
.finally(() => setTimeout(() => { this.modal.stopLoading(); }, 1000)));
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
54
|
* Show offer details
|
|
@@ -29,12 +29,13 @@ const GiftSharing = `<!-- Generated by IcoMoon.io -->
|
|
|
29
29
|
</svg>
|
|
30
30
|
`;
|
|
31
31
|
|
|
32
|
-
const sallaGiftingCss = ".s-gifting-steps-wrapper{transition:0.2s cubic-bezier(0.55, 0, 0.1, 1) 0s}.
|
|
32
|
+
const sallaGiftingCss = ".s-gifting-steps-wrapper{transition:0.2s cubic-bezier(0.55, 0, 0.1, 1) 0s}.s-gifting-select{background-image:url(\"data:image/svg+xml;utf8,<svg fill='black' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>\")}";
|
|
33
33
|
|
|
34
34
|
const SallaGifting$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
35
35
|
constructor() {
|
|
36
36
|
super();
|
|
37
37
|
this.__registerHost();
|
|
38
|
+
this.selectImageForYourGift = salla.lang.get('blocks.buy_as_gift.select_image_or_upload');
|
|
38
39
|
this.currentStep = 1;
|
|
39
40
|
this.showCalendar = false;
|
|
40
41
|
this.showGiftText = false;
|
|
@@ -53,6 +54,7 @@ const SallaGifting$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
53
54
|
this.timeZone = null;
|
|
54
55
|
salla.lang.onLoaded(() => {
|
|
55
56
|
this.selectImageOrUpload = salla.lang.get('blocks.buy_as_gift.select_image_or_upload');
|
|
57
|
+
this.selectImageForYourGift = salla.lang.get('blocks.buy_as_gift.select_image_for_your_gift');
|
|
56
58
|
this.step1Elems = document.querySelectorAll('.gift-step-1 .anime-item');
|
|
57
59
|
this.step2Elems = document.querySelectorAll('.gift-step-2 .anime-item');
|
|
58
60
|
this.imageCover = document.querySelector('.s-gifting-modal-uploader');
|
|
@@ -64,7 +66,6 @@ const SallaGifting$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
64
66
|
this.sectionSubtitle = salla.lang.get('blocks.buy_as_gift.gift_the_one_you_love_message');
|
|
65
67
|
this.sectionBtnText = salla.lang.get('blocks.buy_as_gift.send_as_a_gift');
|
|
66
68
|
this.giftDetails = salla.lang.get('blocks.buy_as_gift.gift_details');
|
|
67
|
-
this.selectImageForYourGift = salla.lang.get('blocks.buy_as_gift.select_image_for_your_gift');
|
|
68
69
|
this.selectGiftMessage = salla.lang.get('blocks.buy_as_gift.select_gift_message');
|
|
69
70
|
this.giftCustomText = salla.lang.get('blocks.buy_as_gift.gift_custom_text');
|
|
70
71
|
this.textId = salla.lang.get('blocks.buy_as_gift.text_id');
|
|
@@ -95,7 +96,7 @@ const SallaGifting$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
95
96
|
})
|
|
96
97
|
.catch(e => {
|
|
97
98
|
var _a, _b, _c, _d;
|
|
98
|
-
this.hasError =
|
|
99
|
+
this.hasError = false;
|
|
99
100
|
this.errorMessage = ((_c = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) === null || _c === void 0 ? void 0 : _c.message) || ((_d = e.response) === null || _d === void 0 ? void 0 : _d.data);
|
|
100
101
|
})
|
|
101
102
|
.finally(() => this.modal.stopLoading()));
|
|
@@ -132,12 +133,13 @@ const SallaGifting$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
132
133
|
let dataID = event.target.children[event.target.selectedIndex].getAttribute('data-id');
|
|
133
134
|
let customID = dataID == "custom";
|
|
134
135
|
this.showGiftText = customID;
|
|
135
|
-
// dataID ? this.selectedGiftTextOption = dataID : this.selectedGiftTextOption = undefined;
|
|
136
136
|
if (dataID) {
|
|
137
137
|
this.selectedGiftTextOption = dataID;
|
|
138
|
+
customID ? this.selectedText = undefined : this.selectedText = event.target.value;
|
|
138
139
|
this.setWrapperHeight(1, 150, 0);
|
|
139
140
|
}
|
|
140
141
|
else {
|
|
142
|
+
this.selectedText = undefined;
|
|
141
143
|
this.selectedGiftTextOption = undefined;
|
|
142
144
|
this.setWrapperHeight(1, 150, -25);
|
|
143
145
|
}
|
|
@@ -346,6 +348,7 @@ const SallaGifting$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
346
348
|
};
|
|
347
349
|
return await salla.product.addGiftToCart(this.productId, payload, true).then((resp) => {
|
|
348
350
|
console.log(resp);
|
|
351
|
+
this.modal.close();
|
|
349
352
|
}).catch((e) => {
|
|
350
353
|
if (e.response.status == 422) {
|
|
351
354
|
this.errors = e.response.data.error.fields;
|
|
@@ -367,7 +370,7 @@ const SallaGifting$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
367
370
|
h("div", { class: "s-gifting-steps-wrapper steps-wrapper" }, h("div", { class: "s-gifting-step-one gift-step-1" }, h("div", { class: "s-gifting-modal-uploader-title anime-item opacity-0" }, this.selectImageForYourGift), h("div", { class: "s-gifting-modal-uploader anime-item opacity-0" }, h("span", { class: "s-gifting-remove-preview", onClick: () => this.removePreview(), innerHTML: Cancel }), this.selectImageOrUpload && h("salla-file-upload", { "instant-upload": true, labelIdle: this.getFilepondPlaceholder(), serverConfig: this.getServerConfig(), onRemove: () => this.handleRemoveImage() }, " ")), h("div", { class: "anime-item opacity-0" }, !this.uploadedImage && !!this.gift && this.gift.gift_images.length > 0 ?
|
|
368
371
|
h("salla-swiper", { "space-between-items": "10", "item-per-view": "4" }, (_a = this.gift) === null || _a === void 0 ? void 0 : _a.gift_images.map((item) => h("img", { class: "s-gifting-image s-gifting-clickable", src: item.url, onClick: () => this.setPreview(item), alt: `${item.id}` })))
|
|
369
372
|
: "", h("div", { class: "s-form-group s-gifting-selectText anime-item opacity-0" }, h("label", { htmlFor: "gift-text-selection", class: "s-form-label" }, this.selectGiftMessage), h("select", { id: "gift-text-selection", name: "gift-text-selection", class: "s-form-control s-gifting-select", onChange: e => this.toggleGiftText(e) }, h("option", { "data-id": null, selected: true }, this.selectGiftMessage), (_b = this.gift) === null || _b === void 0 ? void 0 :
|
|
370
|
-
_b.gift_texts.map((txt) => h("option", { "data-id": txt.id, value: txt.text, key: txt.id }, txt.text)), h("option", { "data-id": "custom" }, this.giftCustomText))), h("div", { class: this.showGiftText ? "s-form-group anime-item opacity-0 s-gifting-textarea shown" : "s-form-group s-gifting-textarea hide" }, h("label", { htmlFor: "gift-custom-text", class: "s-form-label" }, this.giftCustomText), h("div", { class: "mt-1" }, h("textarea", { onInput: (event) => this.handleTextAreaChange(event), rows: 4, name: "gift-custom-text", id: "gift-custom-text", class: "s-form-control" }))), h("div", { class: "anime-item opacity-0" }, h("salla-button", { color: "primary", width: "wide", onClick: () => this.goToStep2() }, h("span", null, this.nextStep))))), h("div", { class: "s-gifting-step-two gift-step-2" }, h("div", { class: this.errors && this.errors['sender_name'] ? "s-form-group s-form-has-error anime-item opacity-0" : "s-form-group anime-item opacity-0" }, h("label", { htmlFor: "sender_name", class: "s-form-label" }, this.senderNameLabel), h("input", { type: "text", class: "s-form-control", name: "sender_name", id: "sender_name", value: this.senderName, onInput: (event) => this.handleSenderName(event), placeholder: "" }), this.errors && this.errors['sender_name'] ? h("span", { class: "text-danger text-xs" }, this.errors['sender_name']) : ''), h("div", { class: this.errors && this.errors['receiver.name'] ? "s-form-group s-form-has-error anime-item opacity-0" : "s-form-group anime-item opacity-0" }, h("label", { htmlFor: "receiver_name", class: "s-form-label" }, this.receiverNameFieldLabel), h("input", { type: "text", class: "s-form-control", name: "receiver_name", id: "receiver_name", value: "", onInput: (event) => this.handleReceiverName(event), placeholder: "" }), this.errors && this.errors['receiver.name'] ? h("span", { class: "text-danger text-xs" }, this.errors['receiver.name']) : ''), h("div", { class: this.errors && this.errors['receiver.mobile'] ? "s-form-group s-form-has-error anime-item opacity-0" : "s-form-group anime-item opacity-0" }, h("label", { class: "s-form-label" }, this.receiverMobileFieldLabel), h("salla-tel-input", { class: "s-gifting-tel-input", phone: this.receiverMobile, countryCode: this.receiverCountryCode, onPhoneEntered: (e) => this.handlePhoneInputChange(e) }), this.errors && this.errors['receiver.mobile'] ? h("span", { class: "text-danger text-xs" }, this.errors['receiver.mobile']) : ''), h("div", { class: "anime-item opacity-0" }, h("label", { class: "s-gifting-schedule s-gifting-clickable", htmlFor: "schedule" }, h("input", { type: "checkbox", name: 'schedule', id: 'schedule', onChange: () => this.toggleCalendar(), class: "s-checkbox" }), h("span", { class: "s-form-label" }, " ", this.sendLater, " "))), h("div", { class: this.getCalendarClasses() }, h("label", { class: "s-form-label" }, this.selectSendDateAndTime), h("salla-datetime-picker", { value: this.deliveryDate, placeholder: this.selectSendDateAndTime, "enable-time": true, "date-format": "Y-m-d H:i", onPicked: (event) => this.handleDateTimePicker(event) }), h("span", { class: "s-gifting-calendar-hint" }, this.canNotEditOrderAfterSelectDate)), h("div", { class: "s-gifting-step-two-footer anime-item opacity-0" }, h("a", { href: "#!", innerHTML: this.currentLang == 'ar' ? ArrowRightIcon : LeftArrow, onClick: () => this.goToStep1() }), h("salla-button", { onClick: () => this.submitForm(), color: "primary", width: 'wide' }, h("span", null, this.sendGift)))))
|
|
373
|
+
_b.gift_texts.map((txt) => h("option", { "data-id": txt.id, value: txt.text, key: txt.id }, txt.text)), h("option", { "data-id": "custom" }, this.giftCustomText))), h("div", { class: this.showGiftText ? "s-form-group anime-item opacity-0 s-gifting-textarea shown" : "s-form-group s-gifting-textarea hide" }, h("label", { htmlFor: "gift-custom-text", class: "s-form-label" }, this.giftCustomText), h("div", { class: "mt-1" }, h("textarea", { onInput: (event) => this.handleTextAreaChange(event), rows: 4, name: "gift-custom-text", id: "gift-custom-text", class: "s-form-control" }))), h("div", { class: "anime-item opacity-0" }, h("salla-button", { color: "primary", width: "wide", onClick: () => this.goToStep2() }, h("span", null, this.nextStep))))), h("div", { class: "s-gifting-step-two gift-step-2" }, h("div", { class: this.errors && this.errors['sender_name'] ? "s-form-group s-form-has-error anime-item opacity-0" : "s-form-group anime-item opacity-0" }, h("label", { htmlFor: "sender_name", class: "s-form-label" }, this.senderNameLabel), h("input", { type: "text", class: "s-form-control", name: "sender_name", id: "sender_name", value: this.senderName, onInput: (event) => this.handleSenderName(event), placeholder: "" }), this.errors && this.errors['sender_name'] ? h("span", { class: "text-danger text-xs" }, this.errors['sender_name']) : ''), h("div", { class: this.errors && this.errors['receiver.name'] ? "s-form-group s-form-has-error anime-item opacity-0" : "s-form-group anime-item opacity-0" }, h("label", { htmlFor: "receiver_name", class: "s-form-label" }, this.receiverNameFieldLabel), h("input", { type: "text", class: "s-form-control", name: "receiver_name", id: "receiver_name", value: "", onInput: (event) => this.handleReceiverName(event), placeholder: "" }), this.errors && this.errors['receiver.name'] ? h("span", { class: "text-danger text-xs" }, this.errors['receiver.name']) : ''), h("div", { class: this.errors && this.errors['receiver.mobile'] ? "s-form-group s-form-has-error anime-item opacity-0" : "s-form-group anime-item opacity-0" }, h("label", { class: "s-form-label" }, this.receiverMobileFieldLabel), h("salla-tel-input", { class: "s-gifting-tel-input", phone: this.receiverMobile, countryCode: this.receiverCountryCode, onPhoneEntered: (e) => this.handlePhoneInputChange(e) }), this.errors && this.errors['receiver.mobile'] ? h("span", { class: "text-danger text-xs" }, this.errors['receiver.mobile']) : ''), h("div", { class: "anime-item opacity-0" }, h("label", { class: "s-gifting-schedule s-gifting-clickable", htmlFor: "schedule" }, h("input", { type: "checkbox", name: 'schedule', id: 'schedule', onChange: () => this.toggleCalendar(), class: "s-checkbox" }), h("span", { class: "s-form-label" }, " ", this.sendLater, " "))), h("div", { class: this.getCalendarClasses() }, h("label", { class: "s-form-label" }, this.selectSendDateAndTime), h("salla-datetime-picker", { value: this.deliveryDate, placeholder: this.selectSendDateAndTime, "enable-time": true, "date-format": "Y-m-d H:i K", onPicked: (event) => this.handleDateTimePicker(event) }), h("span", { class: "s-gifting-calendar-hint" }, this.canNotEditOrderAfterSelectDate)), h("div", { class: "s-gifting-step-two-footer anime-item opacity-0" }, h("a", { href: "#!", innerHTML: this.currentLang == 'ar' ? ArrowRightIcon : LeftArrow, onClick: () => this.goToStep1() }), h("salla-button", { onClick: () => this.submitForm(), color: "primary", width: 'wide' }, h("span", null, this.sendGift)))))
|
|
371
374
|
], h("slot", { name: "footer" })))
|
|
372
375
|
];
|
|
373
376
|
}
|
|
@@ -69,14 +69,14 @@ const SallaOfferModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
69
69
|
async open(product_id) {
|
|
70
70
|
//TODO:: make sure there is only one offer
|
|
71
71
|
this.modal.open();
|
|
72
|
-
return salla.api.withoutNotifier(salla.product.offers(product_id)
|
|
72
|
+
return salla.api.withoutNotifier(salla.product.offers(product_id)
|
|
73
73
|
.then(response => this.showOffer(response.data[0]))
|
|
74
74
|
.catch(e => {
|
|
75
75
|
var _a, _b, _c, _d;
|
|
76
76
|
this.hasError = true;
|
|
77
77
|
this.errorMessage = ((_c = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) === null || _c === void 0 ? void 0 : _c.message) || ((_d = e.response) === null || _d === void 0 ? void 0 : _d.data);
|
|
78
78
|
})
|
|
79
|
-
.finally(() => setTimeout(() => { this.modal.stopLoading(); }, 1000));
|
|
79
|
+
.finally(() => setTimeout(() => { this.modal.stopLoading(); }, 1000)));
|
|
80
80
|
}
|
|
81
81
|
/**
|
|
82
82
|
* Show offer details
|
|
@@ -18812,11 +18812,12 @@ const GiftSharing = `<!-- Generated by IcoMoon.io -->
|
|
|
18812
18812
|
</svg>
|
|
18813
18813
|
`;
|
|
18814
18814
|
|
|
18815
|
-
const sallaGiftingCss = ".s-gifting-steps-wrapper{transition:0.2s cubic-bezier(0.55, 0, 0.1, 1) 0s}.
|
|
18815
|
+
const sallaGiftingCss = ".s-gifting-steps-wrapper{transition:0.2s cubic-bezier(0.55, 0, 0.1, 1) 0s}.s-gifting-select{background-image:url(\"data:image/svg+xml;utf8,<svg fill='black' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>\")}";
|
|
18816
18816
|
|
|
18817
18817
|
const SallaGifting = class {
|
|
18818
18818
|
constructor(hostRef) {
|
|
18819
18819
|
registerInstance(this, hostRef);
|
|
18820
|
+
this.selectImageForYourGift = salla.lang.get('blocks.buy_as_gift.select_image_or_upload');
|
|
18820
18821
|
this.currentStep = 1;
|
|
18821
18822
|
this.showCalendar = false;
|
|
18822
18823
|
this.showGiftText = false;
|
|
@@ -18835,6 +18836,7 @@ const SallaGifting = class {
|
|
|
18835
18836
|
this.timeZone = null;
|
|
18836
18837
|
salla.lang.onLoaded(() => {
|
|
18837
18838
|
this.selectImageOrUpload = salla.lang.get('blocks.buy_as_gift.select_image_or_upload');
|
|
18839
|
+
this.selectImageForYourGift = salla.lang.get('blocks.buy_as_gift.select_image_for_your_gift');
|
|
18838
18840
|
this.step1Elems = document.querySelectorAll('.gift-step-1 .anime-item');
|
|
18839
18841
|
this.step2Elems = document.querySelectorAll('.gift-step-2 .anime-item');
|
|
18840
18842
|
this.imageCover = document.querySelector('.s-gifting-modal-uploader');
|
|
@@ -18846,7 +18848,6 @@ const SallaGifting = class {
|
|
|
18846
18848
|
this.sectionSubtitle = salla.lang.get('blocks.buy_as_gift.gift_the_one_you_love_message');
|
|
18847
18849
|
this.sectionBtnText = salla.lang.get('blocks.buy_as_gift.send_as_a_gift');
|
|
18848
18850
|
this.giftDetails = salla.lang.get('blocks.buy_as_gift.gift_details');
|
|
18849
|
-
this.selectImageForYourGift = salla.lang.get('blocks.buy_as_gift.select_image_for_your_gift');
|
|
18850
18851
|
this.selectGiftMessage = salla.lang.get('blocks.buy_as_gift.select_gift_message');
|
|
18851
18852
|
this.giftCustomText = salla.lang.get('blocks.buy_as_gift.gift_custom_text');
|
|
18852
18853
|
this.textId = salla.lang.get('blocks.buy_as_gift.text_id');
|
|
@@ -18877,7 +18878,7 @@ const SallaGifting = class {
|
|
|
18877
18878
|
})
|
|
18878
18879
|
.catch(e => {
|
|
18879
18880
|
var _a, _b, _c, _d;
|
|
18880
|
-
this.hasError =
|
|
18881
|
+
this.hasError = false;
|
|
18881
18882
|
this.errorMessage = ((_c = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) === null || _c === void 0 ? void 0 : _c.message) || ((_d = e.response) === null || _d === void 0 ? void 0 : _d.data);
|
|
18882
18883
|
})
|
|
18883
18884
|
.finally(() => this.modal.stopLoading()));
|
|
@@ -18914,12 +18915,13 @@ const SallaGifting = class {
|
|
|
18914
18915
|
let dataID = event.target.children[event.target.selectedIndex].getAttribute('data-id');
|
|
18915
18916
|
let customID = dataID == "custom";
|
|
18916
18917
|
this.showGiftText = customID;
|
|
18917
|
-
// dataID ? this.selectedGiftTextOption = dataID : this.selectedGiftTextOption = undefined;
|
|
18918
18918
|
if (dataID) {
|
|
18919
18919
|
this.selectedGiftTextOption = dataID;
|
|
18920
|
+
customID ? this.selectedText = undefined : this.selectedText = event.target.value;
|
|
18920
18921
|
this.setWrapperHeight(1, 150, 0);
|
|
18921
18922
|
}
|
|
18922
18923
|
else {
|
|
18924
|
+
this.selectedText = undefined;
|
|
18923
18925
|
this.selectedGiftTextOption = undefined;
|
|
18924
18926
|
this.setWrapperHeight(1, 150, -25);
|
|
18925
18927
|
}
|
|
@@ -19128,6 +19130,7 @@ const SallaGifting = class {
|
|
|
19128
19130
|
};
|
|
19129
19131
|
return await salla.product.addGiftToCart(this.productId, payload, true).then((resp) => {
|
|
19130
19132
|
console.log(resp);
|
|
19133
|
+
this.modal.close();
|
|
19131
19134
|
}).catch((e) => {
|
|
19132
19135
|
if (e.response.status == 422) {
|
|
19133
19136
|
this.errors = e.response.data.error.fields;
|
|
@@ -19149,7 +19152,7 @@ const SallaGifting = class {
|
|
|
19149
19152
|
h("div", { class: "s-gifting-steps-wrapper steps-wrapper" }, h("div", { class: "s-gifting-step-one gift-step-1" }, h("div", { class: "s-gifting-modal-uploader-title anime-item opacity-0" }, this.selectImageForYourGift), h("div", { class: "s-gifting-modal-uploader anime-item opacity-0" }, h("span", { class: "s-gifting-remove-preview", onClick: () => this.removePreview(), innerHTML: Cancel }), this.selectImageOrUpload && h("salla-file-upload", { "instant-upload": true, labelIdle: this.getFilepondPlaceholder(), serverConfig: this.getServerConfig(), onRemove: () => this.handleRemoveImage() }, " ")), h("div", { class: "anime-item opacity-0" }, !this.uploadedImage && !!this.gift && this.gift.gift_images.length > 0 ?
|
|
19150
19153
|
h("salla-swiper", { "space-between-items": "10", "item-per-view": "4" }, (_a = this.gift) === null || _a === void 0 ? void 0 : _a.gift_images.map((item) => h("img", { class: "s-gifting-image s-gifting-clickable", src: item.url, onClick: () => this.setPreview(item), alt: `${item.id}` })))
|
|
19151
19154
|
: "", h("div", { class: "s-form-group s-gifting-selectText anime-item opacity-0" }, h("label", { htmlFor: "gift-text-selection", class: "s-form-label" }, this.selectGiftMessage), h("select", { id: "gift-text-selection", name: "gift-text-selection", class: "s-form-control s-gifting-select", onChange: e => this.toggleGiftText(e) }, h("option", { "data-id": null, selected: true }, this.selectGiftMessage), (_b = this.gift) === null || _b === void 0 ? void 0 :
|
|
19152
|
-
_b.gift_texts.map((txt) => h("option", { "data-id": txt.id, value: txt.text, key: txt.id }, txt.text)), h("option", { "data-id": "custom" }, this.giftCustomText))), h("div", { class: this.showGiftText ? "s-form-group anime-item opacity-0 s-gifting-textarea shown" : "s-form-group s-gifting-textarea hide" }, h("label", { htmlFor: "gift-custom-text", class: "s-form-label" }, this.giftCustomText), h("div", { class: "mt-1" }, h("textarea", { onInput: (event) => this.handleTextAreaChange(event), rows: 4, name: "gift-custom-text", id: "gift-custom-text", class: "s-form-control" }))), h("div", { class: "anime-item opacity-0" }, h("salla-button", { color: "primary", width: "wide", onClick: () => this.goToStep2() }, h("span", null, this.nextStep))))), h("div", { class: "s-gifting-step-two gift-step-2" }, h("div", { class: this.errors && this.errors['sender_name'] ? "s-form-group s-form-has-error anime-item opacity-0" : "s-form-group anime-item opacity-0" }, h("label", { htmlFor: "sender_name", class: "s-form-label" }, this.senderNameLabel), h("input", { type: "text", class: "s-form-control", name: "sender_name", id: "sender_name", value: this.senderName, onInput: (event) => this.handleSenderName(event), placeholder: "" }), this.errors && this.errors['sender_name'] ? h("span", { class: "text-danger text-xs" }, this.errors['sender_name']) : ''), h("div", { class: this.errors && this.errors['receiver.name'] ? "s-form-group s-form-has-error anime-item opacity-0" : "s-form-group anime-item opacity-0" }, h("label", { htmlFor: "receiver_name", class: "s-form-label" }, this.receiverNameFieldLabel), h("input", { type: "text", class: "s-form-control", name: "receiver_name", id: "receiver_name", value: "", onInput: (event) => this.handleReceiverName(event), placeholder: "" }), this.errors && this.errors['receiver.name'] ? h("span", { class: "text-danger text-xs" }, this.errors['receiver.name']) : ''), h("div", { class: this.errors && this.errors['receiver.mobile'] ? "s-form-group s-form-has-error anime-item opacity-0" : "s-form-group anime-item opacity-0" }, h("label", { class: "s-form-label" }, this.receiverMobileFieldLabel), h("salla-tel-input", { class: "s-gifting-tel-input", phone: this.receiverMobile, countryCode: this.receiverCountryCode, onPhoneEntered: (e) => this.handlePhoneInputChange(e) }), this.errors && this.errors['receiver.mobile'] ? h("span", { class: "text-danger text-xs" }, this.errors['receiver.mobile']) : ''), h("div", { class: "anime-item opacity-0" }, h("label", { class: "s-gifting-schedule s-gifting-clickable", htmlFor: "schedule" }, h("input", { type: "checkbox", name: 'schedule', id: 'schedule', onChange: () => this.toggleCalendar(), class: "s-checkbox" }), h("span", { class: "s-form-label" }, " ", this.sendLater, " "))), h("div", { class: this.getCalendarClasses() }, h("label", { class: "s-form-label" }, this.selectSendDateAndTime), h("salla-datetime-picker", { value: this.deliveryDate, placeholder: this.selectSendDateAndTime, "enable-time": true, "date-format": "Y-m-d H:i", onPicked: (event) => this.handleDateTimePicker(event) }), h("span", { class: "s-gifting-calendar-hint" }, this.canNotEditOrderAfterSelectDate)), h("div", { class: "s-gifting-step-two-footer anime-item opacity-0" }, h("a", { href: "#!", innerHTML: this.currentLang == 'ar' ? ArrowRightIcon : ArrowLeftIcon, onClick: () => this.goToStep1() }), h("salla-button", { onClick: () => this.submitForm(), color: "primary", width: 'wide' }, h("span", null, this.sendGift)))))
|
|
19155
|
+
_b.gift_texts.map((txt) => h("option", { "data-id": txt.id, value: txt.text, key: txt.id }, txt.text)), h("option", { "data-id": "custom" }, this.giftCustomText))), h("div", { class: this.showGiftText ? "s-form-group anime-item opacity-0 s-gifting-textarea shown" : "s-form-group s-gifting-textarea hide" }, h("label", { htmlFor: "gift-custom-text", class: "s-form-label" }, this.giftCustomText), h("div", { class: "mt-1" }, h("textarea", { onInput: (event) => this.handleTextAreaChange(event), rows: 4, name: "gift-custom-text", id: "gift-custom-text", class: "s-form-control" }))), h("div", { class: "anime-item opacity-0" }, h("salla-button", { color: "primary", width: "wide", onClick: () => this.goToStep2() }, h("span", null, this.nextStep))))), h("div", { class: "s-gifting-step-two gift-step-2" }, h("div", { class: this.errors && this.errors['sender_name'] ? "s-form-group s-form-has-error anime-item opacity-0" : "s-form-group anime-item opacity-0" }, h("label", { htmlFor: "sender_name", class: "s-form-label" }, this.senderNameLabel), h("input", { type: "text", class: "s-form-control", name: "sender_name", id: "sender_name", value: this.senderName, onInput: (event) => this.handleSenderName(event), placeholder: "" }), this.errors && this.errors['sender_name'] ? h("span", { class: "text-danger text-xs" }, this.errors['sender_name']) : ''), h("div", { class: this.errors && this.errors['receiver.name'] ? "s-form-group s-form-has-error anime-item opacity-0" : "s-form-group anime-item opacity-0" }, h("label", { htmlFor: "receiver_name", class: "s-form-label" }, this.receiverNameFieldLabel), h("input", { type: "text", class: "s-form-control", name: "receiver_name", id: "receiver_name", value: "", onInput: (event) => this.handleReceiverName(event), placeholder: "" }), this.errors && this.errors['receiver.name'] ? h("span", { class: "text-danger text-xs" }, this.errors['receiver.name']) : ''), h("div", { class: this.errors && this.errors['receiver.mobile'] ? "s-form-group s-form-has-error anime-item opacity-0" : "s-form-group anime-item opacity-0" }, h("label", { class: "s-form-label" }, this.receiverMobileFieldLabel), h("salla-tel-input", { class: "s-gifting-tel-input", phone: this.receiverMobile, countryCode: this.receiverCountryCode, onPhoneEntered: (e) => this.handlePhoneInputChange(e) }), this.errors && this.errors['receiver.mobile'] ? h("span", { class: "text-danger text-xs" }, this.errors['receiver.mobile']) : ''), h("div", { class: "anime-item opacity-0" }, h("label", { class: "s-gifting-schedule s-gifting-clickable", htmlFor: "schedule" }, h("input", { type: "checkbox", name: 'schedule', id: 'schedule', onChange: () => this.toggleCalendar(), class: "s-checkbox" }), h("span", { class: "s-form-label" }, " ", this.sendLater, " "))), h("div", { class: this.getCalendarClasses() }, h("label", { class: "s-form-label" }, this.selectSendDateAndTime), h("salla-datetime-picker", { value: this.deliveryDate, placeholder: this.selectSendDateAndTime, "enable-time": true, "date-format": "Y-m-d H:i K", onPicked: (event) => this.handleDateTimePicker(event) }), h("span", { class: "s-gifting-calendar-hint" }, this.canNotEditOrderAfterSelectDate)), h("div", { class: "s-gifting-step-two-footer anime-item opacity-0" }, h("a", { href: "#!", innerHTML: this.currentLang == 'ar' ? ArrowRightIcon : ArrowLeftIcon, onClick: () => this.goToStep1() }), h("salla-button", { onClick: () => this.submitForm(), color: "primary", width: 'wide' }, h("span", null, this.sendGift)))))
|
|
19153
19156
|
], h("slot", { name: "footer" })))
|
|
19154
19157
|
];
|
|
19155
19158
|
}
|
|
@@ -20131,14 +20134,14 @@ const SallaOfferModal = class {
|
|
|
20131
20134
|
async open(product_id) {
|
|
20132
20135
|
//TODO:: make sure there is only one offer
|
|
20133
20136
|
this.modal.open();
|
|
20134
|
-
return salla.api.withoutNotifier(salla.product.offers(product_id)
|
|
20137
|
+
return salla.api.withoutNotifier(salla.product.offers(product_id)
|
|
20135
20138
|
.then(response => this.showOffer(response.data[0]))
|
|
20136
20139
|
.catch(e => {
|
|
20137
20140
|
var _a, _b, _c, _d;
|
|
20138
20141
|
this.hasError = true;
|
|
20139
20142
|
this.errorMessage = ((_c = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) === null || _c === void 0 ? void 0 : _c.message) || ((_d = e.response) === null || _d === void 0 ? void 0 : _d.data);
|
|
20140
20143
|
})
|
|
20141
|
-
.finally(() => setTimeout(() => { this.modal.stopLoading(); }, 1000));
|
|
20144
|
+
.finally(() => setTimeout(() => { this.modal.stopLoading(); }, 1000)));
|
|
20142
20145
|
}
|
|
20143
20146
|
/**
|
|
20144
20147
|
* Show offer details
|