@salla.sa/twilight-components 2.11.3 → 2.11.4

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.
Files changed (33) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/salla-button_37.cjs.entry.js +856 -346
  3. package/dist/cjs/twilight.cjs.js +1 -1
  4. package/dist/collection/components/salla-datetime-picker/salla-datetime-picker.js +48 -20
  5. package/dist/collection/components/salla-file-upload/salla-file-upload.js +278 -678
  6. package/dist/collection/components/salla-gifting/salla-gifting.js +24 -43
  7. package/dist/collection/components/salla-login-modal/salla-login-modal.js +21 -39
  8. package/dist/collection/components/salla-product-options/salla-product-options.js +27 -42
  9. package/dist/collection/components/salla-user-menu/salla-user-menu.js +1 -0
  10. package/dist/components/salla-datetime-picker2.js +8 -12
  11. package/dist/components/salla-file-upload2.js +783 -214
  12. package/dist/components/salla-gifting.js +22 -41
  13. package/dist/components/salla-login-modal.js +21 -39
  14. package/dist/components/salla-product-options.js +26 -41
  15. package/dist/components/salla-user-menu.js +1 -0
  16. package/dist/esm/loader.js +1 -1
  17. package/dist/esm/salla-button_37.entry.js +856 -346
  18. package/dist/esm/twilight.js +1 -1
  19. package/dist/esm-es5/loader.js +1 -1
  20. package/dist/esm-es5/salla-button_37.entry.js +11 -5
  21. package/dist/esm-es5/twilight.js +1 -1
  22. package/dist/twilight/p-0a16e246.system.js +1 -1
  23. package/dist/twilight/p-2e7701fe.entry.js +36 -0
  24. package/dist/twilight/{p-5ca2cbe3.system.entry.js → p-3db06115.system.entry.js} +11 -5
  25. package/dist/twilight/twilight.esm.js +1 -1
  26. package/dist/types/components/salla-datetime-picker/salla-datetime-picker.d.ts +9 -3
  27. package/dist/types/components/salla-file-upload/salla-file-upload.d.ts +52 -104
  28. package/dist/types/components/salla-gifting/salla-gifting.d.ts +13 -13
  29. package/dist/types/components/salla-product-options/interfaces.d.ts +1 -0
  30. package/dist/types/components/salla-product-options/salla-product-options.d.ts +3 -4
  31. package/dist/types/components.d.ts +81 -217
  32. package/package.json +5 -4
  33. package/dist/twilight/p-cfe3a7ef.entry.js +0 -30
@@ -72,15 +72,15 @@ export class SallaGifting {
72
72
  .finally(() => this.modal.stopLoading());
73
73
  }
74
74
  /**
75
- *
76
- * Hide / close the gifting modal window
77
- */
75
+ *
76
+ * Hide / close the gifting modal window
77
+ */
78
78
  async close() {
79
79
  return this.modal.close();
80
80
  }
81
81
  /**
82
- * Update the modal height based on the changes on the inner elements height for a specific step OR just a pass a new fixed height
83
- */
82
+ * Update the modal height based on the changes on the inner elements height for a specific step OR just a pass a new fixed height
83
+ */
84
84
  async setWrapperHeight(asStep = 1, delay = 250, additionSpace = 0, newHeight = 0) {
85
85
  let currentStep = document.querySelector(`.gift-step-${asStep}`);
86
86
  setTimeout(() => {
@@ -117,9 +117,9 @@ export class SallaGifting {
117
117
  }
118
118
  }
119
119
  /**
120
- *
121
- * Go to the step 2
122
- */
120
+ *
121
+ * Go to the step 2
122
+ */
123
123
  async goToStep2() {
124
124
  if (!this.selectedGiftTextOption) {
125
125
  this.textSelect.classList.add('s-form-has-error');
@@ -167,9 +167,9 @@ export class SallaGifting {
167
167
  this.parentClass = `is-current-step-${this.currentStep}`;
168
168
  }
169
169
  /**
170
- *
171
- * Go to the step 1
172
- */
170
+ *
171
+ * Go to the step 1
172
+ */
173
173
  goToStep1(e) {
174
174
  e.preventDefault();
175
175
  let stepBackAnime = new anime.timeline({
@@ -239,6 +239,12 @@ export class SallaGifting {
239
239
  handleReceiverName(event) {
240
240
  this.receiverName = event.target.value;
241
241
  }
242
+ handleUploadImage(img) {
243
+ this.uploadedImage = img;
244
+ if (!!this.gift && this.gift.gift_images.length) {
245
+ this.setWrapperHeight(1, 150, 0);
246
+ }
247
+ }
242
248
  handleRemoveImage() {
243
249
  this.uploadedImage = '';
244
250
  if (!!this.gift && this.gift.gift_images.length) {
@@ -266,34 +272,6 @@ export class SallaGifting {
266
272
  "s-form-has-error": !!this.errors && this.errors['deliver_at']
267
273
  };
268
274
  }
269
- // TODO: make it default server config --> add it to file-upload
270
- getServerConfig() {
271
- return {
272
- process: async (_fieldName, file, _metadata, load, error, _progress, abort, _transfer, _options) => {
273
- const formData = new FormData();
274
- formData.append("image_url", file, file.name);
275
- return await salla.product.uploadGiftImage(formData)
276
- .then((resp) => {
277
- this.uploadedImage = resp.data.url;
278
- load('success');
279
- file.metadata = `_${new Date().getTime()}`;
280
- if (!!this.gift && this.gift.gift_images.length) {
281
- this.setWrapperHeight(1, 150, 0);
282
- }
283
- }).catch(e => {
284
- console.log(e);
285
- error('error');
286
- })
287
- .finally(() => {
288
- return {
289
- abort: () => {
290
- abort();
291
- },
292
- };
293
- });
294
- }
295
- };
296
- }
297
275
  async submitForm() {
298
276
  var _a;
299
277
  this.calendarFormGroup.classList.remove('s-form-has-error');
@@ -380,7 +358,7 @@ export class SallaGifting {
380
358
  h("div", { class: "s-gifting-modal-uploader-title anime-item" }, this.selectImageForYourGift),
381
359
  h("div", { class: "s-gifting-modal-uploader anime-item", ref: el => this.uploader = el },
382
360
  h("span", { class: "s-gifting-remove-preview", onClick: () => this.removePreview(), innerHTML: Cancel }),
383
- this.selectImageOrUpload && h("salla-file-upload", { "instant-upload": true, labelIdle: this.getFilepondPlaceholder(), serverConfig: this.getServerConfig(), onRemove: () => this.handleRemoveImage() }, " ")),
361
+ this.selectImageOrUpload && h("salla-file-upload", { "instant-upload": true, name: "image_url", url: salla.url.api(salla.product.api.getUrl('giftImage')), onUploaded: event => this.handleUploadImage(event.detail), labelIdle: this.getFilepondPlaceholder(), onRemoved: () => this.handleRemoveImage() })),
384
362
  h("div", { class: "anime-item" }, !this.uploadedImage && !!this.gift && this.gift.gift_images.length > 0 ?
385
363
  h("salla-slider", { id: "gifting-slider", loop: false, "controls-outer": true, class: "s-gifting-slider", type: "carousel" },
386
364
  h("div", { slot: "items" }, (_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}` }))))
@@ -403,15 +381,18 @@ export class SallaGifting {
403
381
  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" },
404
382
  h("label", { htmlFor: "sender_name", class: "s-form-label" }, this.senderNameLabel),
405
383
  h("input", { type: "text", class: "s-form-control", name: "sender_name", id: "sender_name", value: this.senderName, onInput: (event) => this.handleSenderName(event), placeholder: "" }),
406
- this.errors && this.errors['sender_name'] ? h("span", { class: "text-danger text-xs" }, this.errors['sender_name']) : ''),
384
+ this.errors && this.errors['sender_name'] ?
385
+ h("span", { class: "text-danger text-xs" }, this.errors['sender_name']) : ''),
407
386
  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" },
408
387
  h("label", { htmlFor: "receiver_name", class: "s-form-label" }, this.receiverNameFieldLabel),
409
388
  h("input", { type: "text", class: "s-form-control", name: "receiver_name", id: "receiver_name", value: "", onInput: (event) => this.handleReceiverName(event), placeholder: "" }),
410
- this.errors && this.errors['receiver.name'] ? h("span", { class: "text-danger text-xs" }, this.errors['receiver.name']) : ''),
389
+ this.errors && this.errors['receiver.name'] ?
390
+ h("span", { class: "text-danger text-xs" }, this.errors['receiver.name']) : ''),
411
391
  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" },
412
392
  h("label", { class: "s-form-label" }, this.receiverMobileFieldLabel),
413
393
  h("salla-tel-input", { class: "s-gifting-tel-input", phone: this.receiverMobile, countryCode: this.receiverCountryCode, onPhoneEntered: (e) => this.handlePhoneInputChange(e) }),
414
- this.errors && this.errors['receiver.mobile'] ? h("span", { class: "text-danger text-xs" }, this.errors['receiver.mobile']) : ''),
394
+ this.errors && this.errors['receiver.mobile'] ?
395
+ h("span", { class: "text-danger text-xs" }, this.errors['receiver.mobile']) : ''),
415
396
  h("div", { class: "anime-item opacity-0" },
416
397
  h("label", { class: "s-gifting-schedule s-gifting-clickable", htmlFor: "schedule" },
417
398
  h("input", { type: "checkbox", name: 'schedule', id: 'schedule', onChange: () => this.toggleCalendar(), class: "s-checkbox" }),
@@ -51,7 +51,7 @@ export class SallaLoginModal {
51
51
  const error = e.target.nextElementSibling;
52
52
  e.target.classList.remove('s-has-error');
53
53
  (error === null || error === void 0 ? void 0 : error.classList.contains('s-login-modal-error-message')) && (error.innerText = '');
54
- //it was sending two requests for send two verification requests
54
+ //it was sending two requests for send two verification requests
55
55
  submitMethod && e.key == 'Enter' && submitMethod();
56
56
  };
57
57
  this.loginBySMS = async (event = null) => {
@@ -207,36 +207,23 @@ export class SallaLoginModal {
207
207
  const isLogByPhone = this.regType == "phone", isLogByEmail = this.regType == "email", emailValue = this.regEmail.value || (isLogByEmail && this.loginEmail.value), isEmailValid = Helper.isValidEmail(emailValue), isFirstNameValid = this.firstName.value.length > 0, isLastNameValid = this.lastName.value.length > 0, isPhoneValid = await this.regTelInput.isValid() || isLogByPhone && await this.loginTelInput.isValid(), emailValidation = (emailValue && isEmailValid) || (!emailValue && !this.isEmailRequired);
208
208
  // Custom Fields Validation
209
209
  var isCustomFieldValid = true;
210
- for (const item of this.customFieldsWrapper.children) {
211
- if (item.tagName == "SALLA-FILE-UPLOAD") {
212
- const fileUploader = item;
213
- this.customFieldsValues[fileUploader.id] = fileUploader.uploadedImage;
214
- if (fileUploader.required) {
215
- if (!fileUploader.uploadedImage) {
216
- isCustomFieldValid = false;
217
- const errorMsg = salla.lang.get('common.errors.field_required', { attribute: fileUploader.title });
218
- this.validateField(fileUploader, errorMsg);
219
- }
220
- }
221
- }
222
- if (item.tagName == "INPUT") {
223
- const inputItem = item;
224
- this.customFieldsValues[inputItem.id] = inputItem.value;
225
- if (inputItem.required) {
226
- if (inputItem.value.length == 0) {
227
- isCustomFieldValid = false;
228
- const errorMsg = salla.lang.get('common.errors.field_required', { attribute: inputItem.title });
229
- this.validateField(inputItem, errorMsg);
230
- }
231
- }
210
+ //we should make sure that there is text nodes between children
211
+ this.customFieldsWrapper.childNodes
212
+ .forEach((field) => {
213
+ this.customFieldsValues[field.id] = field['value'];
214
+ if (!field.required || this.customFieldsValues[field.id].length) {
215
+ return;
232
216
  }
233
- }
217
+ isCustomFieldValid = false;
218
+ const errorMsg = salla.lang.get('common.errors.field_required', { attribute: field.title });
219
+ this.validateField(field, errorMsg);
220
+ });
234
221
  if (emailValidation && isPhoneValid && isFirstNameValid && isLastNameValid && isCustomFieldValid)
235
222
  return;
236
223
  !isEmailValid && this.validateField(this.regEmail, this.emailErrorMsg);
237
224
  !isFirstNameValid && this.validateField(this.firstName, this.firstNameErrorMsg);
238
225
  !isLastNameValid && this.validateField(this.lastName, this.lastNameErrorMsg);
239
- throw ('Please insert required fields');
226
+ throw 'Please insert required fields';
240
227
  }
241
228
  getFilepondPlaceholder() {
242
229
  return `<div class="s-login-modal-filepond-placeholder"><span class="s-login-modal-filepond-placeholder-icon">${CameraIcon}</span><p class="s-login-modal-filepond-placeholder-text">${this.dragAndDrop}</p> <span class="filepond--label-action">${this.browseFromFiles}</span></div>`;
@@ -322,20 +309,15 @@ export class SallaLoginModal {
322
309
  h("label", { class: "s-login-modal-label" }, salla.lang.get('common.elements.email')),
323
310
  h("input", { type: "email", ref: el => this.regEmail = el, onKeyDown: e => this.typing(e, this.newUser), placeholder: "your@email.com", class: "s-login-modal-input s-ltr" }),
324
311
  h("span", { class: "s-login-modal-error-message" })),
325
- h("div", { class: "s-login-modal-custom-fields", ref: el => this.customFieldsWrapper = el }, this.customFields.map((field) => {
326
- if (field.type === CustomFieldType.PHOTO) {
327
- return [
328
- h("label", { class: "s-login-modal-label" }, field.label),
329
- h("salla-file-upload", { "instant-upload": true, labelIdle: this.getFilepondPlaceholder(), id: `${field.id}`, title: field.label, required: field.required }),
330
- h("span", { class: "s-login-modal-error-message" })
331
- ];
332
- }
333
- return [
334
- h("label", { class: "s-login-modal-label" }, field.label),
335
- h("input", { type: "text", onKeyDown: e => this.typing(e, this.newUser), onInput: el => field.type == CustomFieldType.NUMBER ? salla.helpers.inputDigitsOnly(el.target) : {}, placeholder: field.description, required: field.required, title: field.label, id: `${field.id}`, class: "s-login-modal-input s-ltr" }),
336
- h("span", { class: "s-login-modal-error-message" })
337
- ];
338
- })),
312
+ h("div", { class: "s-login-modal-custom-fields", ref: el => this.customFieldsWrapper = el }, this.customFields.map((field) => [
313
+ h("label", { class: "s-login-modal-label" }, field.label),
314
+ field.type === CustomFieldType.PHOTO
315
+ ? h("salla-file-upload", { name: "image", "instant-upload": true, id: `${field.id}`, title: field.label, required: field.required, url: salla.url.get('upload-image'),
316
+ // onUploaded={}
317
+ labelIdle: this.getFilepondPlaceholder() })
318
+ : h("input", { type: "text", onKeyDown: e => this.typing(e, this.newUser), onInput: el => field.type == CustomFieldType.NUMBER ? salla.helpers.inputDigitsOnly(el.target) : {}, placeholder: field.description, required: field.required, title: field.label, id: `${field.id}`, class: "s-login-modal-input s-ltr" }),
319
+ h("span", { class: "s-login-modal-error-message" })
320
+ ])),
339
321
  h("salla-button", { "loader-position": 'center', width: "wide", onClick: () => this.newUser(), ref: b => this.regBtn = b }, salla.lang.get('blocks.header.register')),
340
322
  h("slot", { name: "after-registration" })))));
341
323
  }
@@ -1,13 +1,12 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import { Component, Prop, h, State, Host, Event } from '@stencil/core';
4
+ import { Component, Prop, h, State, Element, Host, Event } from '@stencil/core';
5
5
  import { DisplayType } from './interfaces';
6
6
  import CheckCircleIcon from '../../assets/svg/check.svg';
7
7
  import CameraIcon from '../../assets/svg/camera.svg';
8
8
  export class SallaProductOptions {
9
9
  constructor() {
10
- this.uploadedImage = undefined;
11
10
  this.outOfStockText = salla.lang.get("pages.products.out_of_stock");
12
11
  this.donationAmount = salla.lang.get('pages.products.donation_amount');
13
12
  /**
@@ -77,55 +76,40 @@ export class SallaProductOptions {
77
76
  //@ts-ignore
78
77
  donationOption(option) {
79
78
  return h("div", { class: "s-product-options-donation-wrapper" },
80
- h("input", { type: "text", id: "donating-amount", name: "donating_amount", class: "s-form-control", placeholder: option.placeholder, onInput: e => salla.helpers.inputDigitsOnly(e.target), onBlur: e => this.donationMoneyEntered.emit(e) }),
79
+ h("input", { type: "text", id: "donating-amount", name: "donating_amount", class: "s-form-control", value: option.value, placeholder: option.placeholder, onInput: e => salla.helpers.inputDigitsOnly(e.target), onBlur: e => this.donationMoneyEntered.emit(e) }),
81
80
  h("span", { class: "s-product-options-donation-amount-currency" }, salla.config.currency(salla.config.get('user.currency_code')).symbol));
82
81
  }
83
82
  getFilepondPlaceholder() {
83
+ //todo:: add translatable string
84
84
  return `<div class="s-product-options-filepond-placeholder"><span class="s-product-options-filepond-placeholder-icon">${CameraIcon}</span><p class="s-product-options-filepond-placeholder-text">اسحب او افلت الصورة هنا</p> <span class="filepond--label-action">او تصفح من جهازك</span></div>`;
85
85
  }
86
- setUploaderHeight() {
87
- setTimeout(() => {
88
- this.uploader.querySelector('.filepond--root').style.height = '120px';
89
- }, 1000);
86
+ handleOnImageRemoved(event) {
87
+ //todo:: add on remove from cartitem images
88
+ // use salla.url.is_page('cart')
89
+ // call salla.cart.api.deleteImage(file('id'))
90
+ //@ts-ignore
91
+ setTimeout(() => event.target.querySelector('.filepond--root').style.height = '120px', 1000);
92
+ }
93
+ handleOnImageUploaded(event) {
94
+ //todo:: fire imageUploaded from salla-product-options
95
+ event.target.querySelector('.filepond--data input[type="hidden"]').dispatchEvent(new window.Event('change', { bubbles: true }));
90
96
  }
91
97
  //todo:: why we need this way, use the native way!!
92
98
  //@ts-ignore
93
99
  selectThumbnail(e, value) {
94
100
  this.thumbnailSelected.emit(e);
95
101
  }
96
- //todo:: move it to another place, create component if there is no component
97
- //@ts-ignore
98
- getServerConfig(url, option_id) {
99
- return {
100
- process: async (_fieldName, file, _metadata, load, error, _progress, abort, _transfer, _options) => {
101
- const formData = new FormData();
102
- formData.append("image_url", file, file.name);
103
- return await salla.product.uploadGiftImage(formData)
104
- .then((resp) => {
105
- this.uploadedImage = resp.data.url;
106
- load('success');
107
- file.metadata = `_${new Date().getTime()}`;
108
- }).catch(e => {
109
- console.log(e);
110
- error('error');
111
- })
112
- .finally(() => {
113
- return {
114
- abort: () => {
115
- abort();
116
- },
117
- };
118
- });
119
- }
120
- };
121
- }
122
102
  //@ts-ignore
123
103
  imageOption(option) {
124
- return h("salla-file-upload", { "instant-upload": true, ref: element => this.uploader = element, "data-item-id": salla.url.is_page('cart') ? option.id : '', class: { "s-product-options-image-input": true, required: option.required }, labelIdle: this.getFilepondPlaceholder(), onRemove: () => this.setUploaderHeight(), serverConfig: this.getServerConfig(salla.cart.api.getUrl('cart/option-image'), salla.url.is_page('cart') ? option.id : null) });
104
+ return h("salla-file-upload", { "instant-upload": true, name: `options[${option.id}]`, "payload-name": "file", "data-item-id": salla.url.is_page('cart') ? option.id : '', class: { "s-product-options-image-input": true, required: option.required }, labelIdle: this.getFilepondPlaceholder(), onRemoved: event => this.handleOnImageRemoved(event), onUploaded: event => this.handleOnImageUploaded(event), value: option.value, url: salla.cart.api.getUploadImageEndpoint(), "form-data": {
105
+ _token: salla.config.get('_token'),
106
+ cart_item_id: this.productId,
107
+ product_id: this.productId,
108
+ } });
125
109
  }
126
110
  //@ts-ignore
127
111
  numberOption(option) {
128
- return h("input", { placeholder: option.placeholder, name: `options[${option.id}]`, type: "text", onInput: e => salla.helpers.inputDigitsOnly(e.target), onBlur: e => this.numberOptionEntered.emit(e), class: "s-form-control" });
112
+ return h("input", { type: "text", value: option.value, class: "s-form-control", required: option.required, name: `options[${option.id}]`, placeholder: option.placeholder, onBlur: e => this.numberOptionEntered.emit(e), onInput: e => salla.helpers.inputDigitsOnly(e.target) });
129
113
  }
130
114
  //@ts-ignore
131
115
  splitterOption() {
@@ -134,32 +118,33 @@ export class SallaProductOptions {
134
118
  //@ts-ignore
135
119
  textOption(option) {
136
120
  return h("div", { class: "s-product-options-text" },
137
- h("input", { placeholder: option.placeholder, name: `options[${option.id}]`, type: "text", onInput: e => this.textOptionEntered.emit(e), required: option.required, class: 's-form-control' }));
121
+ h("input", { type: "text", value: option.value, class: 's-form-control', required: option.required, name: `options[${option.id}]`, placeholder: option.placeholder, onInput: e => this.textOptionEntered.emit(e) }));
138
122
  }
139
123
  //@ts-ignore
140
124
  textareaOption(option) {
125
+ //todo::remove mt-1 class, and if it's okay to remove the tag itself will be great
141
126
  return h("div", { class: "s-product-options-textarea" },
142
127
  h("div", { class: "mt-1" },
143
- h("textarea", { rows: 4, name: `options[${option.id}]`, required: option.required, id: `options[${option.id}]`, placeholder: option.placeholder, onInput: (e) => this.textareaOptionEntered.emit(e), class: "s-form-control" })));
128
+ h("textarea", { rows: 4, value: option.value, class: "s-form-control", required: option.required, id: `options[${option.id}]`, name: `options[${option.id}]`, placeholder: option.placeholder, onInput: (e) => this.textareaOptionEntered.emit(e) })));
144
129
  }
145
130
  /**
146
131
  * ============= Date Time options =============
147
132
  */
148
133
  //@ts-ignore
149
134
  timeOption(option) {
150
- return h("salla-datetime-picker", { class: "s-product-options-time-element", enableTime: true, placeholder: option.name, noCalendar: true, dateFormat: "h:i K", onPicked: e => this.timeSelected.emit(e) });
135
+ return h("salla-datetime-picker", { noCalendar: true, enableTime: true, dateFormat: "h:i K", value: option.value, placeholder: option.name, required: option.required, name: `options[${option.id}]`, class: "s-product-options-time-element", onPicked: e => this.timeSelected.emit(e) });
151
136
  }
152
137
  //@ts-ignore
153
138
  dateOption(option) {
154
139
  //todo:: consider date-range @see https://github.com/SallaApp/theme-raed/blob/master/src/assets/js/partials/product-options.js#L8-L23
155
140
  return h("div", { class: "s-product-options-date-element" },
156
- h("salla-datetime-picker", { onPicked: e => this.dateSelected.emit(e), placeholder: option.name }));
141
+ h("salla-datetime-picker", { value: option.value, placeholder: option.name, required: option.required, name: `options[${option.id}]`, onPicked: e => this.dateSelected.emit(e) }));
157
142
  }
158
143
  //@ts-ignore
159
144
  datetimeOption(option) {
160
145
  //todo:: consider date-range @see https://github.com/SallaApp/theme-raed/blob/master/src/assets/js/partials/product-options.js#L8-L23
161
146
  return h("div", { class: "s-product-options-datetime-element" },
162
- h("salla-datetime-picker", { mode: "range", dateFormat: "Y-m-d G:i:K", enableTime: true, minDate: option.from_date_time, maxDate: option.to_date_time, placeholder: option.name, onPicked: e => this.dateTimeSelected.emit(e) }));
147
+ h("salla-datetime-picker", { enableTime: true, value: option.value, dateFormat: "Y-m-d G:i:K", placeholder: option.name, required: option.required, name: `options[${option.id}]`, maxDate: option.to_date_time, minDate: option.from_date_time, onPicked: e => this.dateTimeSelected.emit(e) }));
163
148
  }
164
149
  /**
165
150
  * ============= Advanced options =============
@@ -180,7 +165,7 @@ export class SallaProductOptions {
180
165
  multipleOptions(option) {
181
166
  return h("div", { ref: element => this.multipleOptionDom = element, class: { "s-product-options-multiple-options-wrapper": true, 'required': option.required } }, option === null || option === void 0 ? void 0 : option.details.map((detail) => {
182
167
  return h("div", null,
183
- h("input", { type: "checkbox", value: detail.id, disabled: detail.is_out, checked: detail.is_selected, name: `options[${option.id}]`, id: `field-${option.id}-${detail.id}`, onChange: () => this.handleMultiSelectFieldInput(), "aria-describedby": `options[${option.id}]-description` }),
168
+ h("input", { type: "checkbox", value: detail.id, disabled: detail.is_out, checked: detail.is_selected, name: `options[${option.id}][]`, id: `field-${option.id}-${detail.id}`, onChange: () => this.handleMultiSelectFieldInput(), "aria-describedby": `options[${option.id}]-description` }),
184
169
  h("label", { htmlFor: `field-${option.id}-${detail.id}` }, this.getOptionDetailName(detail)));
185
170
  }));
186
171
  }
@@ -254,7 +239,6 @@ export class SallaProductOptions {
254
239
  }; }
255
240
  static get states() { return {
256
241
  "optionsData": {},
257
- "uploadedImage": {},
258
242
  "outOfStockText": {},
259
243
  "donationAmount": {}
260
244
  }; }
@@ -424,4 +408,5 @@ export class SallaProductOptions {
424
408
  "references": {}
425
409
  }
426
410
  }]; }
411
+ static get elementRef() { return "host"; }
427
412
  }
@@ -90,6 +90,7 @@ export class SallaUserMenu {
90
90
  * - is profile page, if user changed his name or avatar, we need to update it
91
91
  * - half hour is passed than last user data fetched
92
92
  */
93
+ //todo:: cover sending two requests in profile page, this may cause auto logout issues🤔
93
94
  if (salla.url.is_page('customer.notifications')
94
95
  || salla.url.is_page('customer.orders.index.pending')
95
96
  || salla.url.is_page('customer.profile')
@@ -2570,7 +2570,7 @@ const SallaDatetimePicker = /*@__PURE__*/ proxyCustomElement(class extends HTMLE
2570
2570
  /**
2571
2571
  * Allows the user to enter a date directly into the input field. By default, direct entry is disabled.
2572
2572
  */
2573
- this.allowInput = false;
2573
+ this.allowInput = true;
2574
2574
  /**
2575
2575
  * Allows the preloading of an invalid date. When disabled, the field will be cleared if the provided date is invalid
2576
2576
  */
@@ -2728,14 +2728,10 @@ const SallaDatetimePicker = /*@__PURE__*/ proxyCustomElement(class extends HTMLE
2728
2728
  */
2729
2729
  this.wrap = false;
2730
2730
  }
2731
- onInputChange(event) {
2732
- this.value = event.target.value;
2733
- this.picked.emit(this.value);
2731
+ render() {
2732
+ return h("div", { class: "s-datetime-picker" }, h("input", { type: "datetime", name: this.name, value: this.value, required: this.required, placeholder: this.placeholder, class: "s-datetime-picker-input", ref: (el) => this.dateInput = el }));
2734
2733
  }
2735
2734
  componentDidLoad() {
2736
- this.initPicker();
2737
- }
2738
- initPicker() {
2739
2735
  let options = {
2740
2736
  allowInput: this.allowInput,
2741
2737
  allowInvalidPreload: this.allowInvalidPreload,
@@ -2781,18 +2777,18 @@ const SallaDatetimePicker = /*@__PURE__*/ proxyCustomElement(class extends HTMLE
2781
2777
  time_24hr: this.time_24hr,
2782
2778
  weekNumbers: this.weekNumbers,
2783
2779
  wrap: this.wrap,
2784
- // onChange: this.handleOnChange(selectedDates, dateStr, instance)
2780
+ // @ts-ignore
2781
+ onChange: (selectedDates, dateStr) => this.picked.emit(this.value = dateStr)
2785
2782
  // onOpen: this.handleOnOpen(selectedDates, dateStr, instance)
2786
2783
  // onClose: this.handleOnClose(selectedDates, dateStr, instance)
2787
2784
  };
2788
2785
  flatpickr(this.dateInput, options);
2789
2786
  }
2790
- render() {
2791
- return (h("div", { class: "s-datetime-picker" }, h("input", { type: "datetime", class: "s-datetime-picker-input", ref: (el) => this.dateInput = el, value: this.value, placeholder: this.placeholder, onInput: this.onInputChange.bind(this) })));
2792
- }
2793
2787
  static get style() { return sallaDatetimePickerCss; }
2794
2788
  }, [0, "salla-datetime-picker", {
2795
- "value": [1025],
2789
+ "value": [1537],
2790
+ "required": [4],
2791
+ "name": [513],
2796
2792
  "placeholder": [1],
2797
2793
  "allowInput": [4, "allow-input"],
2798
2794
  "allowInvalidPreload": [4, "allow-invalid-preload"],