favesalon-embed 1.0.16 → 1.0.18

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 (49) hide show
  1. package/dist/custom-elements/index.d.ts +30 -0
  2. package/dist/favesalon-embed/activate-form.entry.js +1 -1
  3. package/dist/favesalon-embed/buy-giftcard-form.entry.js +168 -95
  4. package/dist/favesalon-embed/buy-giftcard-verification.entry.js +38 -18
  5. package/dist/favesalon-embed/change-password-form.entry.js +1 -1
  6. package/dist/favesalon-embed/chat-box.entry.js +1 -1
  7. package/dist/favesalon-embed/chat-button.entry.js +1 -1
  8. package/dist/favesalon-embed/chat-form.entry.js +1 -1
  9. package/dist/favesalon-embed/chat-messages.entry.js +1 -1
  10. package/dist/favesalon-embed/chat-rooms.entry.js +2 -2
  11. package/dist/favesalon-embed/favesalon-embed.esm.js +1 -1
  12. package/dist/favesalon-embed/icon-checked.entry.js +19 -0
  13. package/dist/favesalon-embed/icon-date.entry.js +19 -0
  14. package/dist/favesalon-embed/icon-loading.entry.js +19 -0
  15. package/dist/favesalon-embed/icon-location-marker.entry.js +19 -0
  16. package/dist/favesalon-embed/icon-phone.entry.js +19 -0
  17. package/dist/favesalon-embed/inputmask-afacb9e0.js +3777 -0
  18. package/dist/favesalon-embed/login-form.entry.js +1 -1
  19. package/dist/favesalon-embed/register-form.entry.js +1 -1
  20. package/dist/favesalon-embed/reset-password-form.entry.js +1 -1
  21. package/dist/favesalon-embed/salon-info.entry.js +1 -1
  22. package/dist/favesalon-embed/salon-latest-reviews.entry.js +2 -2
  23. package/dist/favesalon-embed/salon-latest-styles.entry.js +1 -1
  24. package/dist/favesalon-embed/salon-locations.entry.js +2 -2
  25. package/dist/favesalon-embed/salon-lookbook.entry.js +1 -1
  26. package/dist/favesalon-embed/salon-reviews.entry.js +1 -1
  27. package/dist/favesalon-embed/salon-schedules.entry.js +1 -1
  28. package/dist/favesalon-embed/salon-services.entry.js +1 -1
  29. package/dist/favesalon-embed/salon-stylists.entry.js +1 -1
  30. package/dist/favesalon-embed/{services-baa3f112.js → services-82948efc.js} +8 -8
  31. package/dist/favesalon-embed/style-detail.entry.js +1 -1
  32. package/dist/favesalon-embed/{utils-fd30fb29.js → utils-359c37f7.js} +4 -3
  33. package/dist/favesalon-embed/wizard-existing-user.entry.js +37 -15
  34. package/dist/favesalon-embed/wizard-new-user.entry.js +36 -14
  35. package/dist/types/components/buy-giftcard-form/buy-giftcard-form.d.ts +4 -1
  36. package/dist/types/components/buy-giftcard-verification/buy-giftcard-verification.d.ts +2 -0
  37. package/dist/types/components/icon-checked/icon-checked.d.ts +4 -0
  38. package/dist/types/components/icon-date/icon-date.d.ts +4 -0
  39. package/dist/types/components/icon-loading/icon-loading.d.ts +4 -0
  40. package/dist/types/components/icon-location-marker/icon-location-marker.d.ts +4 -0
  41. package/dist/types/components/icon-phone/icon-phone.d.ts +4 -0
  42. package/dist/types/components.d.ts +75 -0
  43. package/dist/types/services/services.d.ts +3 -3
  44. package/package.json +2 -1
  45. package/dist/favesalon-embed/services-3dd9f820.js +0 -24104
  46. package/dist/favesalon-embed/services-45c0e274.js +0 -24122
  47. package/dist/favesalon-embed/services-65861516.js +0 -24095
  48. package/dist/favesalon-embed/services-935ba09f.js +0 -24118
  49. package/dist/favesalon-embed/services-9a686ade.js +0 -24122
@@ -68,6 +68,36 @@ export const GoogleMap: {
68
68
  new (): GoogleMap;
69
69
  };
70
70
 
71
+ interface IconChecked extends Components.IconChecked, HTMLElement {}
72
+ export const IconChecked: {
73
+ prototype: IconChecked;
74
+ new (): IconChecked;
75
+ };
76
+
77
+ interface IconDate extends Components.IconDate, HTMLElement {}
78
+ export const IconDate: {
79
+ prototype: IconDate;
80
+ new (): IconDate;
81
+ };
82
+
83
+ interface IconLoading extends Components.IconLoading, HTMLElement {}
84
+ export const IconLoading: {
85
+ prototype: IconLoading;
86
+ new (): IconLoading;
87
+ };
88
+
89
+ interface IconLocationMarker extends Components.IconLocationMarker, HTMLElement {}
90
+ export const IconLocationMarker: {
91
+ prototype: IconLocationMarker;
92
+ new (): IconLocationMarker;
93
+ };
94
+
95
+ interface IconPhone extends Components.IconPhone, HTMLElement {}
96
+ export const IconPhone: {
97
+ prototype: IconPhone;
98
+ new (): IconPhone;
99
+ };
100
+
71
101
  interface LoginForm extends Components.LoginForm, HTMLElement {}
72
102
  export const LoginForm: {
73
103
  prototype: LoginForm;
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, h } from './index-888e99e3.js';
2
- import { H as HttpService, g as get_1 } from './services-9a686ade.js';
2
+ import { H as HttpService, g as get_1 } from './services-82948efc.js';
3
3
  import { C as Colors } from './colors-ea36347a.js';
4
4
  import './_commonjsHelpers-9bc404fc.js';
5
5
 
@@ -1,5 +1,6 @@
1
1
  import { r as registerInstance, h } from './index-888e99e3.js';
2
- import { _ as _root, i as isSymbol_1, a as isObject_1, H as HttpService, d as dayjs_min, b as dateFormat, g as get_1, s as shortDateFormat, c as getSalonImage, e as getSalonAddress } from './services-9a686ade.js';
2
+ import { I as Inputmask } from './inputmask-afacb9e0.js';
3
+ import { _ as _root, i as isSymbol_1, a as isObject_1, H as HttpService, d as dayjs_min, b as dateFormat, g as get_1, s as shortDateFormat, c as getSalonImage, e as getSalonAddress } from './services-82948efc.js';
3
4
  import { c as createCommonjsModule, g as getDefaultExportFromCjs } from './_commonjsHelpers-9bc404fc.js';
4
5
  import { C as Colors } from './colors-ea36347a.js';
5
6
 
@@ -325,7 +326,7 @@ var teConnectJs = createCommonjsModule(function (module, exports) {
325
326
 
326
327
  const teConnectJs$1 = /*@__PURE__*/getDefaultExportFromCjs(teConnectJs);
327
328
 
328
- const buyGiftcardFormCss = "buy-giftcard-form{display:block;width:100%}.buy-giftcard-form *{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}";
329
+ const buyGiftcardFormCss = "buy-giftcard-form{display:block;width:100%}.buy-giftcard-form *{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.fs-input--date::-webkit-calendar-picker-indicator{cursor:pointer;background-color:#f00;position:absolute;right:0;top:0;height:48px;width:48px}@media (max-width: 768px){.fs--form--actions{position:fixed;left:0;right:0;bottom:0;padding:16px;-moz-box-shadow:0px 0px 24px rgba(0, 0, 0, 0.25);-webkit-box-shadow:0px 0px 24px rgba(0, 0, 0, 0.25);box-shadow:0px 0px 24px rgba(0, 0, 0, 0.25)}}";
329
330
 
330
331
  var DeliveryType;
331
332
  (function (DeliveryType) {
@@ -362,6 +363,11 @@ const customStyles = {
362
363
  const BuyGiftcardForm = class {
363
364
  constructor(hostRef) {
364
365
  registerInstance(this, hostRef);
366
+ this.onClickDeliveryDone = () => {
367
+ const targetElement = document.getElementById('page--gift-card-style');
368
+ targetElement && targetElement.scrollIntoView();
369
+ this.isDeliveryDoneVisible = false;
370
+ };
365
371
  this.onChangeEmail = debounce_1((recipientEmail) => {
366
372
  this.recipientEmail = recipientEmail;
367
373
  if (this.recipientEmailConfirm) {
@@ -379,6 +385,7 @@ const BuyGiftcardForm = class {
379
385
  }, 300);
380
386
  this.onChangeConfirmEmail = debounce_1((recipientEmailConfirm) => {
381
387
  this.recipientEmailConfirm = recipientEmailConfirm;
388
+ this.isDeliveryDoneVisible = !!recipientEmailConfirm;
382
389
  if (this.recipientEmail) {
383
390
  if (this.deliveryType === DeliveryType.Email) {
384
391
  this.isInvalidEmails = recipientEmailConfirm !== this.recipientEmail;
@@ -393,6 +400,7 @@ const BuyGiftcardForm = class {
393
400
  }
394
401
  }, 300);
395
402
  this.onSubmitGiftCardForm = async () => {
403
+ this.errorMessage = null;
396
404
  const recipientEmailStr = String(this.recipientEmail).replaceAll(' ', '');
397
405
  const isInvalidEmailFormats = this.deliveryType === DeliveryType.Email && recipientEmailStr.indexOf('@') === -1;
398
406
  if (this.deliveryType === DeliveryType.Email && (!recipientEmailStr || isInvalidEmailFormats || this.isInvalidEmails)) {
@@ -405,9 +413,24 @@ const BuyGiftcardForm = class {
405
413
  ? 'Inputted phones are invalid'
406
414
  : 'Inputted phones are not matched';
407
415
  }
408
- else if (this.customAmount || this.selectedAmount) {
409
- this.step = FormStep.PaymentInfo;
410
- setTimeout(() => this.initMagensaPayment(), 350);
416
+ else {
417
+ if (this.customAmount || this.selectedAmount) {
418
+ if (this.recipientFirstName && this.recipientLastName) {
419
+ if (this.selectedStyleId) {
420
+ this.step = FormStep.PaymentInfo;
421
+ setTimeout(() => this.initMagensaPayment(), 350);
422
+ }
423
+ else {
424
+ this.errorMessage = 'Please select a gift card style';
425
+ }
426
+ }
427
+ else {
428
+ this.errorMessage = 'Please enter your first & last name';
429
+ }
430
+ }
431
+ else {
432
+ this.errorMessage = 'Please select Gift card amount';
433
+ }
411
434
  }
412
435
  };
413
436
  this.salonId = undefined;
@@ -432,6 +455,7 @@ const BuyGiftcardForm = class {
432
455
  this.isInvalidEmails = undefined;
433
456
  this.isInvalidPhones = undefined;
434
457
  this.selectedStyleId = undefined;
458
+ this.isDeliveryDoneVisible = undefined;
435
459
  }
436
460
  async componentDidLoad() {
437
461
  const promises = [
@@ -467,7 +491,7 @@ const BuyGiftcardForm = class {
467
491
  }
468
492
  renderPaymentOnlineDisabled() {
469
493
  return (h("div", { style: { paddingTop: '24px', textAlign: 'center' } }, h("div", { style: { fontSize: '24px', fontWeight: '700', lineHeight: '1.4' } }, "Online Gift Card is not available"), h("div", { style: { marginTop: '12px' } }, "Please call us for assistance or visit salon. Thanks!"), h("div", { style: { marginTop: '12px' } }, h("a", { rel: "noopener noreferrer", href: `tel:${this.salonInfo.businessPhone}` }, h("button", { type: "button", style: {
470
- background: Colors.Secondary,
494
+ backgroundColor: Colors.Secondary,
471
495
  border: `1px solid ${Colors.Secondary}`,
472
496
  borderRadius: '8px',
473
497
  color: Colors.White,
@@ -492,63 +516,75 @@ const BuyGiftcardForm = class {
492
516
  marginTop: '12px',
493
517
  } }, totalAmount > 0 && (h("div", null, h("div", { style: { display: 'flex' } }, recommendAmounts.map((recommendValue, idx) => {
494
518
  const isSelected = this.selectedAmount === recommendValue;
495
- return (h("button", { type: "button", key: `gc--recommend-amount--${recommendValue}`, value: recommendValue, onClick: () => this.selectedAmount = recommendValue, style: {
496
- border: `1px solid ${Colors.Gray02}`,
519
+ return (h("button", { type: "button", key: `gc--recommend-amount--${recommendValue}`, value: recommendValue, onClick: () => {
520
+ this.selectedAmount = recommendValue;
521
+ this.customAmount = recommendValue;
522
+ }, style: {
523
+ border: `1px solid ${Colors.Gray03}`,
497
524
  backgroundColor: Colors.White,
498
525
  color: Colors.TextColor,
499
526
  borderRadius: '0px',
500
527
  cursor: 'pointer',
501
528
  height: '48px',
502
- minWidth: '64px',
529
+ minWidth: '48px',
503
530
  display: 'flex',
504
531
  justifyContent: 'center',
505
532
  alignItems: 'center',
506
533
  fontSize: '18px',
534
+ fontWeight: '600',
507
535
  padding: '8px 12px',
508
536
  ...idx === 0 ? { borderRadius: '8px 0 0 8px', } : {},
509
537
  ...idx === (totalAmount - 1) ? { borderRadius: '0 8px 8px 0' } : {},
510
- ...isSelected ? { backgroundColor: Colors.Gray01, fontWeight: '600' } : {},
538
+ ...isSelected ? { backgroundColor: Colors.Secondary, color: Colors.White, fontWeight: '600' } : {},
511
539
  } }, "$", recommendValue));
512
540
  })))), acceptCustomAmount && (h("div", { style: { position: 'relative', marginLeft: '16px', maxWith: '160px' } }, h("span", { style: {
541
+ fontWeight: '600',
513
542
  position: 'absolute',
514
543
  left: '14px',
515
544
  top: '50%',
516
545
  fontSize: '18px',
517
546
  transform: 'translate(0, -50%)',
518
- } }, "$"), h("input", { type: "number", value: this.customAmount, onInput: (evt) => this.customAmount = evt.target.value, style: {
519
- border: `1px solid ${Colors.Gray02}`,
547
+ } }, "$"), h("input", { type: "number", placeholder: "Enter a number", min: 1, value: this.customAmount, onInput: (evt) => {
548
+ this.selectedAmount = null;
549
+ this.customAmount = evt.target.value;
550
+ }, style: {
551
+ border: `1px solid ${Colors.Gray03}`,
520
552
  backgroundColor: Colors.White,
521
553
  color: Colors.TextColor,
522
554
  borderRadius: '8px',
523
- padding: '8px 16px 8px 32px',
555
+ padding: '8px 16px 8px 28px',
524
556
  height: '48px',
525
557
  width: '100%',
526
558
  fontSize: '18px',
527
559
  fontWeight: '600',
528
560
  } })))), h("div", { style: {
529
- borderTop: `1px solid ${Colors.Gray02}`,
561
+ borderTop: `1px solid ${Colors.Gray03}`,
530
562
  marginTop: '24px',
531
563
  paddingTop: '16px',
532
564
  } }, h("div", { style: { fontSize: '18px' } }, "Recipient name"), h("div", { style: { display: 'flex', alignItems: 'center', marginTop: '12px' } }, h("div", { style: { width: '48%' } }, h("input", { placeholder: "First name", type: "text", value: this.recipientFirstName, onInput: (evt) => {
533
565
  this.recipientFirstName = evt.target.value.trim();
534
566
  }, style: {
535
- border: `1px solid ${Colors.Gray02}`,
567
+ border: `1px solid ${Colors.Gray03}`,
536
568
  backgroundColor: Colors.White,
537
569
  color: Colors.TextColor,
538
570
  borderRadius: '8px',
539
571
  padding: '8px 16px',
540
572
  height: '48px',
541
573
  width: '100%',
574
+ fontSize: '18px',
575
+ fontWeight: '600',
542
576
  } })), h("div", { style: { width: '48%', marginLeft: '4%' } }, h("input", { placeholder: "Last name", type: "text", value: this.recipientLastName, onInput: (evt) => {
543
577
  this.recipientLastName = evt.target.value.trim();
544
578
  }, style: {
545
- border: `1px solid ${Colors.Gray02}`,
579
+ border: `1px solid ${Colors.Gray03}`,
546
580
  backgroundColor: Colors.White,
547
581
  color: Colors.TextColor,
548
582
  borderRadius: '8px',
549
583
  padding: '8px 16px',
550
584
  height: '48px',
551
585
  width: '100%',
586
+ fontSize: '18px',
587
+ fontWeight: '600',
552
588
  } })))), h("div", { style: { marginTop: '24px' } }, h("div", { style: { fontSize: '18px' } }, "Delivery method?"), h("div", { style: { display: 'flex', marginTop: '12px' } }, h("div", { style: {
553
589
  cursor: 'pointer',
554
590
  display: 'flex',
@@ -557,8 +593,17 @@ const BuyGiftcardForm = class {
557
593
  this.recipientEmail = null;
558
594
  this.recipientEmailConfirm = null;
559
595
  this.deliveryType = DeliveryType.Email;
596
+ this.isDeliveryDoneVisible = false;
597
+ if (this.deliveryInput) {
598
+ this.deliveryInput.placeholder = 'Enter email';
599
+ Inputmask.remove(this.deliveryInput);
600
+ }
601
+ if (this.deliveryReenterInput) {
602
+ this.deliveryReenterInput.placeholder = 'Re-enter email';
603
+ Inputmask.remove(this.deliveryReenterInput);
604
+ }
560
605
  } }, h("span", { style: {
561
- border: `1px solid ${Colors.Gray02}`,
606
+ border: `1px solid ${Colors.Gray03}`,
562
607
  backgroundClip: 'content-box',
563
608
  borderRadius: '50%',
564
609
  height: '16px',
@@ -577,8 +622,17 @@ const BuyGiftcardForm = class {
577
622
  this.recipientEmail = null;
578
623
  this.recipientEmailConfirm = null;
579
624
  this.deliveryType = DeliveryType.SMS;
625
+ this.isDeliveryDoneVisible = false;
626
+ if (this.deliveryInput) {
627
+ this.deliveryInput.placeholder = 'Enter phone';
628
+ Inputmask({ mask: '(999) 999-9999' }).mask(this.deliveryInput);
629
+ }
630
+ if (this.deliveryReenterInput) {
631
+ this.deliveryReenterInput.placeholder = 'Re-enter phone';
632
+ Inputmask({ mask: '(999) 999-9999' }).mask(this.deliveryReenterInput);
633
+ }
580
634
  } }, h("span", { style: {
581
- border: `1px solid ${Colors.Gray02}`,
635
+ border: `1px solid ${Colors.Gray03}`,
582
636
  backgroundClip: 'content-box',
583
637
  borderRadius: '50%',
584
638
  height: '16px',
@@ -592,23 +646,43 @@ const BuyGiftcardForm = class {
592
646
  display: 'flex',
593
647
  alignItems: 'center',
594
648
  marginTop: '24px',
595
- } }, h("div", { style: { width: '48%' } }, h("input", { placeholder: isDeliveryEmail ? 'Enter email' : 'Enter phone', type: "text", value: this.recipientEmail, onInput: (evt) => this.onChangeEmail(evt.target.value.trim()), style: {
596
- border: `1px solid ${Colors.Gray02}`,
649
+ } }, h("div", { style: { width: '48%' } }, h("input", { type: "text", ref: el => this.deliveryInput = el, placeholder: isDeliveryEmail ? 'Enter email' : 'Enter phone', onInput: (evt) => this.onChangeEmail(evt.target.value.trim()), style: {
650
+ border: `1px solid ${Colors.Gray03}`,
597
651
  backgroundColor: Colors.White,
598
652
  color: Colors.TextColor,
599
653
  borderRadius: '8px',
600
654
  padding: '8px 16px',
601
655
  height: '48px',
602
656
  width: '100%',
603
- } })), h("div", { style: { width: '48%', marginLeft: '4%' } }, h("input", { placeholder: isDeliveryEmail ? 'Re-enter email' : 'Re-enter phone', type: "text", value: this.recipientEmailConfirm, onInput: (evt) => this.onChangeConfirmEmail(evt.target.value.trim()), style: {
604
- border: `1px solid ${Colors.Gray02}`,
657
+ fontSize: '18px',
658
+ fontWeight: '600',
659
+ } })), h("div", { style: { width: '48%', marginLeft: '4%', position: 'relative' } }, h("input", { type: "text", ref: el => this.deliveryReenterInput = el, placeholder: isDeliveryEmail ? 'Re-enter email' : 'Re-enter phone', onInput: (evt) => this.onChangeConfirmEmail(evt.target.value.trim()), style: {
660
+ border: `1px solid ${Colors.Gray03}`,
605
661
  backgroundColor: Colors.White,
606
662
  color: Colors.TextColor,
607
663
  borderRadius: '8px',
608
664
  padding: '8px 16px',
609
665
  height: '48px',
610
666
  width: '100%',
611
- } }))), this.isInvalidEmails && (h("div", { style: {
667
+ fontSize: '18px',
668
+ fontWeight: '600',
669
+ } }), this.isDeliveryDoneVisible && (h("button", { type: "button", style: {
670
+ backgroundColor: Colors.Secondary,
671
+ border: `1px solid ${Colors.Secondary}`,
672
+ borderRadius: '8px',
673
+ cursor: 'pointer',
674
+ color: Colors.White,
675
+ fontSize: '16px',
676
+ fontWeight: '700',
677
+ paddingLeft: '24px',
678
+ paddingRight: '24px',
679
+ height: '48px',
680
+ position: 'absolute',
681
+ marginTop: '2px',
682
+ top: '100%',
683
+ right: '0',
684
+ zIndex: '10',
685
+ }, onClick: () => this.onClickDeliveryDone() }, "Done")))), this.isInvalidEmails && (h("div", { style: {
612
686
  color: Colors.Red03,
613
687
  fontSize: '90%',
614
688
  marginTop: '16px',
@@ -621,8 +695,8 @@ const BuyGiftcardForm = class {
621
695
  backgroundColor: Colors.Info01,
622
696
  marginTop: '16px',
623
697
  padding: '16px',
624
- } }, "Gift card info will send to your email once it cannot delivery to recipient")), giftCardStyles.length > 0 && (h("div", { style: {
625
- borderTop: `1px solid ${Colors.Gray02}`,
698
+ } }, "Gift card info will send to your email once it cannot delivery to recipient")), h("div", { id: "page--gift-card-style" }), giftCardStyles.length > 0 && (h("div", { style: {
699
+ borderTop: `1px solid ${Colors.Gray03}`,
626
700
  marginTop: '24px',
627
701
  paddingTop: '16px',
628
702
  } }, h("div", { style: { fontSize: '18px' } }, "Select Gift Card style"), h("div", { style: { marginTop: '12px' } }, giftCardStyles.map((giftCardStyle, idx) => {
@@ -646,38 +720,56 @@ const BuyGiftcardForm = class {
646
720
  alignItems: 'center',
647
721
  overflow: 'hidden',
648
722
  }, onClick: () => this.selectedStyleId = giftCardStyle.id }, isSelected && (h("div", null, h("div", { style: {
649
- backgroundColor: 'rgba(0, 0, 0, 0.25)',
723
+ backgroundColor: 'rgba(0, 0, 0, 0.35)',
650
724
  borderRadius: '8px',
651
725
  position: 'absolute',
652
726
  inset: '0',
653
727
  zIndex: '3',
654
- } }), h("i", { class: "ri-checkbox-circle-fill", style: {
728
+ } }), h("span", { style: {
655
729
  position: 'absolute',
656
730
  left: '50%',
657
731
  top: '50%',
658
732
  transform: 'translate(-50%, -50%)',
659
- fontSize: '32px',
660
733
  zIndex: '5',
661
- } }))), h("img", { src: giftCardStyle.imageUrl, alt: `Style ${idx + 1}`, style: { position: 'relative', maxHeight: '100%', maxWidth: '100%', zIndex: '2' } }))));
734
+ } }, h("icon-checked", null)))), h("img", { src: giftCardStyle.imageUrl, alt: `Style ${idx + 1}`, style: { position: 'relative', maxHeight: '100%', maxWidth: '100%', zIndex: '2' } }))));
662
735
  })))), h("div", { style: {
663
- borderTop: `1px solid ${Colors.Gray02}`,
736
+ borderTop: `1px solid ${Colors.Gray03}`,
664
737
  marginTop: '24px',
665
738
  paddingTop: '16px',
666
- } }, h("div", { style: { fontSize: '18px' } }, "Delivery date"), h("div", { style: { marginTop: '12px', maxWidth: '50%' } }, h("input", { type: "date", placeholder: "Today", onInput: (evt) => {
667
- this.deliveryDate = evt.target.value.trim();
668
- }, style: {
739
+ } }, h("div", { style: { fontSize: '18px' } }, "Delivery date"), h("div", { style: { marginTop: '12px', maxWidth: '50%', position: 'relative' } }, h("div", { style: {
669
740
  backgroundColor: Colors.White,
670
- border: `1px solid ${Colors.Gray02}`,
741
+ border: `1px solid ${Colors.Gray03}`,
671
742
  color: Colors.TextColor,
672
743
  borderRadius: '8px',
673
744
  padding: '8px 16px',
674
745
  height: '48px',
675
746
  width: '100%',
676
747
  fontSize: '18px',
748
+ display: 'flex',
749
+ alignItems: 'center',
750
+ } }, this.deliveryDate || 'Today'), h("span", { style: {
751
+ color: Colors.Black,
752
+ position: 'absolute',
753
+ right: '0',
754
+ top: '0',
755
+ zIndex: '2',
756
+ height: '48px',
757
+ width: '48px',
758
+ display: 'flex',
759
+ alignItems: 'center',
760
+ justifyContent: 'center',
761
+ paddingTop: '6px',
762
+ } }, h("icon-date", null)), h("input", { class: "fs-input--date", type: "date", placeholder: "Today", min: dayjs_min().format(dateFormat), onInput: (evt) => {
763
+ this.deliveryDate = evt.target.value.trim();
764
+ }, style: {
765
+ position: 'absolute',
766
+ inset: '0',
767
+ opacity: '0',
768
+ zIndex: '3',
677
769
  } })), h("div", { style: { marginTop: '16px' } }, h("textarea", { rows: 4, placeholder: "Include a message...", onInput: (evt) => {
678
770
  this.recipientMessage = evt.target.value.trim();
679
771
  }, style: {
680
- border: `1px solid ${Colors.Gray02}`,
772
+ border: `1px solid ${Colors.Gray03}`,
681
773
  background: Colors.White,
682
774
  color: Colors.TextColor,
683
775
  padding: '16px',
@@ -689,7 +781,7 @@ const BuyGiftcardForm = class {
689
781
  marginTop: '24px',
690
782
  textAlign: 'right',
691
783
  } }, h("button", { type: "button", style: {
692
- background: Colors.Secondary,
784
+ backgroundColor: Colors.Secondary,
693
785
  border: `1px solid ${Colors.Secondary}`,
694
786
  borderRadius: '8px',
695
787
  cursor: 'pointer',
@@ -703,11 +795,20 @@ const BuyGiftcardForm = class {
703
795
  backgroundColor: Colors.Red01,
704
796
  border: `1px solid ${Colors.Red02}`,
705
797
  marginBottom: '24px',
798
+ marginTop: '24px',
706
799
  padding: '16px',
707
800
  } }, this.errorMessage))));
708
801
  }
709
802
  renderPaymentSucceed() {
710
- return (h("div", { style: { paddingTop: '24px', textAlign: 'center' } }, h("div", { style: { fontSize: '24px', fontWeight: '700', lineHeight: '1.4' } }, "Thank you!"), h("div", { style: { marginTop: '12px' } }, "Your gift card has been purchased successfully")));
803
+ return (h("div", { style: { paddingTop: '24px', textAlign: 'center' } }, h("div", { style: {
804
+ color: Colors.Success03,
805
+ alignItems: 'center',
806
+ justifyContent: 'center',
807
+ margin: 'auto',
808
+ display: 'flex',
809
+ height: '90px',
810
+ width: '90px',
811
+ } }, h("icon-checked", { size: 84 })), h("div", { style: { fontSize: '24px', fontWeight: '700', lineHeight: '1.4', marginTop: '24px' } }, "Thank you!"), h("div", { style: { marginTop: '12px' } }, "Your gift card has been purchased successfully")));
711
812
  }
712
813
  async createCardPayment() {
713
814
  try {
@@ -724,49 +825,13 @@ const BuyGiftcardForm = class {
724
825
  async processCardToken(Token) {
725
826
  const defaultErrorMessage = 'Something went wrong when creating payment transaction';
726
827
  try {
727
- const { MPPGv4WSFault, TransactionOutput } = await HttpService().magensaProcessToken({
828
+ const { MPPGv4WSFault, TransactionOutput } = await HttpService().magensaProcessToken(Number(this.salonId), {
728
829
  raw_data: [{
729
830
  Token,
730
- Authentication: {
731
- CustomerCode: this.magensaCredentials.customerCode,
732
- Username: this.magensaCredentials.username,
733
- Password: this.magensaCredentials.password,
734
- },
735
831
  TransactionInput: {
736
832
  TransactionType: 1,
737
833
  ProcessorName: this.magensaCredentials.processorName,
738
- Amount: this.customAmount || this.selectedAmount || 1,
739
- },
740
- }],
741
- });
742
- if (!MPPGv4WSFault && TransactionOutput && TransactionOutput.TransactionID) {
743
- return Promise.resolve({ transactionID: TransactionOutput.TransactionID });
744
- }
745
- let message = MPPGv4WSFault && MPPGv4WSFault.FaultReason;
746
- if (!message && TransactionOutput && TransactionOutput.TransactionMessage) {
747
- message = TransactionOutput.TransactionMessage;
748
- }
749
- return Promise.reject({ message: message || defaultErrorMessage });
750
- }
751
- catch (res) {
752
- return Promise.reject({ message: res.error || defaultErrorMessage });
753
- }
754
- }
755
- async voidPaymentRequest(ReferenceTransactionID) {
756
- const defaultErrorMessage = 'Something went wrong when updating payment transaction status';
757
- try {
758
- const { MPPGv4WSFault, TransactionOutput } = await HttpService().magensaConfirmTransaction({
759
- raw_data: [{
760
- Authentication: {
761
- CustomerCode: this.magensaCredentials.customerCode,
762
- Username: this.magensaCredentials.username,
763
- Password: this.magensaCredentials.password,
764
- },
765
- TransactionInput: {
766
- ReferenceTransactionID,
767
- TransactionType: 4,
768
- ProcessorName: this.magensaCredentials.processorName,
769
- Amount: this.customAmount || this.selectedAmount || 1,
834
+ Amount: Number(this.customAmount || this.selectedAmount || 1).toFixed(2),
770
835
  },
771
836
  }],
772
837
  });
@@ -790,15 +855,14 @@ const BuyGiftcardForm = class {
790
855
  try {
791
856
  const { token } = await this.createCardPayment();
792
857
  const { transactionID } = await this.processCardToken(token);
793
- await this.voidPaymentRequest(transactionID);
794
858
  if (token) {
795
859
  const { giftCardStyles } = this.giftCardSettings || {};
796
860
  const selectedGiftCardStyle = this.selectedStyleId
797
861
  ? ((giftCardStyles || []).find(style => style.id === this.selectedStyleId) || {}).imageUrl : '';
798
862
  const recipientUserEmail = (this.recipientEmail || '').indexOf('@') > -1 ? this.recipientEmail : '';
799
863
  const recipientUserPhone = (this.recipientEmail || '').indexOf('@') === -1 ? this.recipientEmail : '';
800
- await HttpService().onBuyGiftCard(this.salonInfo.id, {
801
- source: token,
864
+ const response = await HttpService().onBuyGiftCard(this.salonInfo.id, {
865
+ source: '',
802
866
  amount: this.customAmount || this.selectedAmount || '',
803
867
  gift_card_style: selectedGiftCardStyle || '',
804
868
  delivery_date: this.deliveryDate ? dayjs_min(this.deliveryDate).format(dateFormat) : dayjs_min().format(dateFormat),
@@ -818,19 +882,22 @@ const BuyGiftcardForm = class {
818
882
  payment_valid: {
819
883
  type: 'magensa',
820
884
  magensa_transaction_id: transactionID,
821
- magensa_user: this.magensaCredentials.username,
822
- magensa_password: this.magensaCredentials.password,
823
- magensa_customer_code: this.magensaCredentials.customerCode,
824
885
  },
825
886
  });
826
- this.step = FormStep.PaymentSucceed;
887
+ const { status, message } = (response.data || {});
888
+ if (status === true) {
889
+ this.step = FormStep.PaymentSucceed;
890
+ }
891
+ else {
892
+ this.errorMessage = message || `Something went wrong when sending your gift card`;
893
+ }
827
894
  }
828
895
  else {
829
896
  this.errorMessage = `Something went wrong with your credit card`;
830
897
  }
831
898
  }
832
899
  catch (error) {
833
- this.errorMessage = error.message || (error.error && error.error.message) || get_1(error, 'response.data.message') || `Something went wrong when purchasing your gift card`;
900
+ this.errorMessage = error.message || (error.error && error.error.message) || get_1(error, 'response.data.message') || `Something went wrong when sending your gift card`;
834
901
  }
835
902
  }
836
903
  this.isSubmitting = false;
@@ -848,9 +915,9 @@ const BuyGiftcardForm = class {
848
915
  fontSize: '18px',
849
916
  fontWeight: '700',
850
917
  marginLeft: '6px',
851
- } }, this.deliveryDate ? dayjs_min(this.deliveryDate).format(shortDateFormat) : 'Today')), h("div", { style: { fontSize: '18px', marginTop: '24px' } }, "Payment"), h("div", { style: { marginTop: '8px', marginLeft: '-6px' } }, h("credit-card-types", null)), h("div", { id: "buy-giftcard--payment", style: { height: '300px', maxWidth: '400px', marginTop: '24px' } }), h("button", { type: "button", disabled: this.isSubmitting, style: {
918
+ } }, this.deliveryDate ? dayjs_min(this.deliveryDate).format(shortDateFormat) : 'Today')), h("div", { style: { fontSize: '18px', marginTop: '24px' } }, "Payment"), h("div", { style: { marginTop: '8px', marginLeft: '-6px' } }, h("credit-card-types", null)), h("div", { id: "buy-giftcard--payment", style: { height: '300px', maxWidth: '400px', marginTop: '24px' } }), h("div", { class: "fs--form--actions" }, h("button", { type: "button", disabled: this.isSubmitting, style: {
852
919
  border: `1px solid ${Colors.Secondary}`,
853
- background: Colors.Secondary,
920
+ backgroundColor: Colors.Secondary,
854
921
  color: Colors.White,
855
922
  borderRadius: '8px',
856
923
  cursor: 'pointer',
@@ -860,26 +927,33 @@ const BuyGiftcardForm = class {
860
927
  paddingRight: '24px',
861
928
  height: '44px',
862
929
  width: '100%',
863
- }, onClick: () => this.onSubmitPaymentForm() }, "Submit")));
930
+ ...this.isSubmitting ? {
931
+ color: Colors.TextColor,
932
+ borderColor: Colors.Gray03,
933
+ backgroundColor: Colors.Gray03,
934
+ } : {},
935
+ }, onClick: () => this.onSubmitPaymentForm() }, "Submit ", this.isSubmitting && (h("span", { style: { marginLeft: '4px' } }, h("icon-loading", null)))), this.errorMessage && (h("div", { style: {
936
+ color: Colors.Red03,
937
+ marginTop: '16px',
938
+ } }, this.errorMessage)))));
864
939
  }
865
940
  renderSalonInfo() {
866
941
  const salonImageUrl = getSalonImage(this.salonInfo);
867
942
  return (h("div", { style: {
868
943
  backgroundColor: Colors.White,
869
- border: `1px solid ${Colors.Gray02}`,
944
+ border: `1px solid ${Colors.Gray03}`,
870
945
  borderRadius: '8px',
871
946
  padding: '24px',
872
947
  } }, h("div", { style: { display: 'flex' } }, salonImageUrl && (h("div", { style: { marginRight: '24px' } }, h("img", { src: salonImageUrl, alt: this.salonInfo.businessName, style: { maxWidth: '84px' } }))), h("div", { style: { flexGrow: '1', flexShrink: '1' } }, h("div", { style: {
873
948
  fontSize: '24px',
874
949
  lineHeight: '1.3',
875
950
  } }, this.salonInfo.businessName), h("div", { style: {
876
- color: Colors.Gray05,
877
951
  display: 'flex',
878
952
  marginTop: '4px',
879
- } }, h("i", { class: "ri-map-pin-line", style: {
953
+ } }, h("span", { style: {
954
+ color: Colors.Gray05,
880
955
  marginRight: '4px',
881
- fontSize: '20px',
882
- } }), h("div", { style: {
956
+ } }, h("icon-location-marker", { size: 18 })), h("div", { style: {
883
957
  flexGrow: '1',
884
958
  flexShrink: '1',
885
959
  overflow: 'hidden',
@@ -887,12 +961,11 @@ const BuyGiftcardForm = class {
887
961
  } }, getSalonAddress(this.salonInfo))), h("div", { style: {
888
962
  display: 'flex',
889
963
  alignItems: 'center',
890
- color: Colors.Gray05,
891
964
  marginTop: '4px',
892
- } }, h("i", { class: "ri-phone-line", style: {
965
+ } }, h("span", { style: {
966
+ color: Colors.Gray05,
893
967
  marginRight: '4px',
894
- fontSize: '20px',
895
- } }), h("div", { style: {
968
+ } }, h("icon-phone", { size: 18 })), h("div", { style: {
896
969
  flexGrow: '1',
897
970
  flexShrink: '1',
898
971
  overflow: 'hidden',