crmbonus-component-wake 2.0.72 → 2.0.74

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 (38) hide show
  1. package/dist/cjs/countdown-timer_4.cjs.entry.js +18 -9
  2. package/dist/cjs/countdown-timer_4.cjs.entry.js.map +1 -1
  3. package/dist/cjs/crm-giftback-form.cjs.entry.js +16 -13
  4. package/dist/cjs/crm-giftback-form.cjs.entry.js.map +1 -1
  5. package/dist/cjs/crmbonus-component-wake.cjs.js +1 -1
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/collection/components/giftback-form/giftback-form.js +16 -13
  8. package/dist/collection/components/giftback-form/giftback-form.js.map +1 -1
  9. package/dist/collection/components/giftback-form/subcomponents/giftback-info/giftback-info.js +22 -10
  10. package/dist/collection/components/giftback-form/subcomponents/giftback-info/giftback-info.js.map +1 -1
  11. package/dist/components/crm-bonus.js +2 -2
  12. package/dist/components/crm-giftback-form.js +1 -1
  13. package/dist/components/giftback-info.js +1 -1
  14. package/dist/components/{p-a4fd3bc8.js → p-984bc7d0.js} +18 -15
  15. package/dist/components/p-984bc7d0.js.map +1 -0
  16. package/dist/components/{p-c95d6c01.js → p-d4cfdf80.js} +21 -10
  17. package/dist/components/p-d4cfdf80.js.map +1 -0
  18. package/dist/crmbonus-component-wake/crmbonus-component-wake.esm.js +1 -1
  19. package/dist/crmbonus-component-wake/crmbonus-component-wake.esm.js.map +1 -1
  20. package/dist/crmbonus-component-wake/p-0160f5f5.entry.js +2 -0
  21. package/dist/crmbonus-component-wake/p-0160f5f5.entry.js.map +1 -0
  22. package/dist/crmbonus-component-wake/p-feadb94b.entry.js +2 -0
  23. package/dist/crmbonus-component-wake/p-feadb94b.entry.js.map +1 -0
  24. package/dist/esm/countdown-timer_4.entry.js +18 -9
  25. package/dist/esm/countdown-timer_4.entry.js.map +1 -1
  26. package/dist/esm/crm-giftback-form.entry.js +16 -13
  27. package/dist/esm/crm-giftback-form.entry.js.map +1 -1
  28. package/dist/esm/crmbonus-component-wake.js +1 -1
  29. package/dist/esm/loader.js +1 -1
  30. package/dist/types/components/giftback-form/giftback-form.d.ts +2 -2
  31. package/dist/types/components/giftback-form/subcomponents/giftback-info/giftback-info.d.ts +2 -0
  32. package/package.json +1 -1
  33. package/dist/components/p-a4fd3bc8.js.map +0 -1
  34. package/dist/components/p-c95d6c01.js.map +0 -1
  35. package/dist/crmbonus-component-wake/p-c04d7aac.entry.js +0 -2
  36. package/dist/crmbonus-component-wake/p-c04d7aac.entry.js.map +0 -1
  37. package/dist/crmbonus-component-wake/p-d6314a45.entry.js +0 -2
  38. package/dist/crmbonus-component-wake/p-d6314a45.entry.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"giftback-info.js","sourceRoot":"","sources":["../../../../../../src/components/giftback-form/subcomponents/giftback-info/giftback-info.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAG1D,OAAO,OAAO,MAAM,uBAAuB,CAAA;AAM3C,MAAM,OAAO,YAAY;;yBACQ,CAAC;8BACI,MAAM;uBAEb,KAAK;qBACC;YAC7B,UAAU,EAAE,EAAE;YACd,MAAM,EAAE,EAAE;YACV,eAAe,EAAE,IAAI;YACrB,YAAY,EAAE,EAAE;YAChB,eAAe,EAAE,EAAE;YACnB,iBAAiB,EAAE,EAAE;YACrB,UAAU,EAAE,GAAG;SAClB;;;8BAIiC,EAAE;;IAEpC,iBAAiB;QACb,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC;QAEhE,IAAI,CAAC,mBAAmB,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAEnD,IAAI,CAAC,cAAc,GAAG,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC1D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E,GAAG,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,GAChD;0CAEE;gBACR;oBACI,8DACI,IAAI,EAAC,OAAO,EACZ,IAAI,EAAC,gBAAgB,EACrB,KAAK,EAAC,SAAS,EACf,OAAO,EAAE,IAAI,CAAC,cAAc,KAAK,SAAS,EAC1C,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,GACpD;mDAEE,CACN;YACN,4DAAK,KAAK,EAAC,UAAU,2DAEf,CACJ,CACT,CAAC;IACN,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import { Component, Prop, State, h } from \"@stencil/core\";\nimport { IBonus } from \"../../../../dto/validate.pin.bonus\";\n\nimport i18next from '../../../../i18n/i18n'\n\n@Component({\n tag: 'giftback-info',\n styleUrls: ['giftback-info.css']\n})\nexport class GiftbackInfo {\n @State() usedValue: number = 0;\n @State() selectedOption: string = 'none';\n\n @Prop() loading: boolean = false;\n @Prop() bonus: Partial<IBonus> = {\n totalBonus: 52,\n cartId: \"\",\n minimumPurchase: 6000,\n bonusBalance: 25,\n calculatedValue: 25,\n firstValidityDate: \"\",\n totalValue: 200\n };\n @Prop() reserve: (amountRedeemed: number) => void;\n @Prop() cancel: () => void;\n\n @State() sliderPosition: number = 50;\n\n componentWillLoad() {\n this.usedValue = parseFloat(this.bonus.bonusBalance.toString());\n\n this.buildPositionSlider(0, this.bonus.totalBonus);\n\n this.selectedOption = localStorage.getItem(\"bc:used\");\n }\n\n handleSliderChange(event: Event) {\n const input = event.target as HTMLInputElement;\n this.usedValue = parseFloat(input.value);\n\n // Calculando a posição do texto com base no valor do slider\n // const percentage = ((this.usedValue - parseInt(input.min)) / (parseInt(input.max) - parseInt(input.min))) * 100;\n // this.sliderPosition = percentage;\n\n this.buildPositionSlider(parseFloat(input.min), parseFloat(input.max))\n }\n\n\n private buildPositionSlider(min:number, max: number) {\n // Calculando a posição do texto com base no valor do slider\n const percentage = ((this.usedValue - min) / (max - min)) * 100;\n this.sliderPosition = percentage;\n }\n\n async handleOptionChange(option: string) {\n this.selectedOption = option;\n localStorage.setItem(\"bc:used\", option)\n switch (this.selectedOption) {\n case 'use':\n await this.reserve(this.usedValue)\n break;\n case 'dontUse':\n await this.cancel()\n break;\n default:\n }\n }\n render() {\n const remainingGiftback = this.bonus.minimumPurchase - this.bonus.totalValue;\n\n const translateDescription = i18next.t(\"giftDescription\", { amount: `${this.bonus.totalBonus.toFixed(2).replace(\".\", \",\")}`, custom_name: \"Giftback\" })\n\n return (\n\n <div class=\"giftback-container\">\n <div class=\"container-description\">\n <p innerHTML={translateDescription}></p>\n </div>\n <div class=\"slider-wrapper\">\n <div\n class=\"slider-value\"\n style={{\n left: `calc(${this.sliderPosition}% - 20px)`, // Ajuste para centralizar o texto\n }}\n >\n R$ {this.usedValue.toFixed(2).replace(\".\", \",\")}\n </div>\n <input\n disabled\n type=\"range\"\n min=\"0\"\n max={this.bonus.totalBonus}\n value={this.usedValue}\n class=\"slider\"\n step=\"0.01\"\n onInput={(event) => this.handleSliderChange(event)}\n style={{\n background: `linear-gradient(to right, #6D6D5F ${this.sliderPosition}%, #ddd ${this.sliderPosition}%)`,\n }}\n />\n </div>\n <p>\n Adicione <strong>R$ {remainingGiftback < 0 ? \"0,00\" : remainingGiftback.toFixed(2).replace(\".\", \",\")}</strong> ao carrinho para atingir o valor\n máximo!\n </p>\n <div class=\"options\">\n <label>\n <input\n type=\"radio\"\n name=\"giftbackOption\"\n value=\"use\"\n checked={this.selectedOption === 'use'}\n onChange={() => this.handleOptionChange('use')}\n />\n Usar o meu Giftback\n </label>\n <label>\n <input\n type=\"radio\"\n name=\"giftbackOption\"\n value=\"dontUse\"\n checked={this.selectedOption === 'dontUse'}\n onChange={() => this.handleOptionChange('dontUse')}\n />\n Não usar o meu Giftback\n </label>\n </div>\n <div class=\"info-box\">\n O Giftback será aplicado na próxima etapa.\n </div>\n </div>\n );\n }\n}"]}
1
+ {"version":3,"file":"giftback-info.js","sourceRoot":"","sources":["../../../../../../src/components/giftback-form/subcomponents/giftback-info/giftback-info.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAGjE,OAAO,OAAO,MAAM,uBAAuB,CAAA;AAM3C,MAAM,OAAO,YAAY;;yBACQ,CAAC;8BACI,MAAM;uBAEb,KAAK;qBACC;YAC7B,UAAU,EAAE,CAAC;YACb,MAAM,EAAE,EAAE;YACV,eAAe,EAAE,CAAC;YAClB,YAAY,EAAE,CAAC;YACf,eAAe,EAAE,CAAC;YAClB,iBAAiB,EAAE,EAAE;YACrB,UAAU,EAAE,CAAC;SAChB;;;8BAIiC,EAAE;;IAGpC,YAAY;QACR,IAAI,CAAC,WAAW,EAAE,CAAA;IACtB,CAAC;IAEO,WAAW;QACf,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC;QAChE,IAAI,CAAC,mBAAmB,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACvD,CAAC;IAED,iBAAiB;QACb,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,IAAI,CAAC,cAAc,GAAG,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC1D,CAAC;IAED,kBAAkB,CAAC,KAAY;QAC3B,MAAM,KAAK,GAAG,KAAK,CAAC,MAA0B,CAAC;QAC/C,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAEzC,4DAA4D;QAC5D,mHAAmH;QACnH,oCAAoC;QAEpC,IAAI,CAAC,mBAAmB,CAAC,UAAU,CAAC,KAAK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AC,kBAAkB,CAAC,SAAS,CAAC,GACpD;mDAEE,CACN;YACN,4DAAK,KAAK,EAAC,UAAU,2DAEf,CACJ,CACT,CAAC;IACN,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import { Component, Prop, State, Watch, h } from \"@stencil/core\";\nimport { IBonus } from \"../../../../dto/validate.pin.bonus\";\n\nimport i18next from '../../../../i18n/i18n'\n\n@Component({\n tag: 'giftback-info',\n styleUrls: ['giftback-info.css']\n})\nexport class GiftbackInfo {\n @State() usedValue: number = 0;\n @State() selectedOption: string = 'none';\n\n @Prop() loading: boolean = false;\n @Prop() bonus: Partial<IBonus> = {\n totalBonus: 0,\n cartId: \"\",\n minimumPurchase: 0,\n bonusBalance: 0,\n calculatedValue: 0,\n firstValidityDate: \"\",\n totalValue: 0\n };\n @Prop() reserve: (amountRedeemed: number) => void;\n @Prop() cancel: () => void;\n\n @State() sliderPosition: number = 50;\n\n @Watch(\"bonus\") \n changedBonus() {\n this.updateBonus()\n }\n\n private updateBonus() {\n this.usedValue = parseFloat(this.bonus.bonusBalance.toString());\n this.buildPositionSlider(0, this.bonus.totalBonus);\n }\n\n componentWillLoad() {\n this.updateBonus();\n this.selectedOption = localStorage.getItem(\"bc:used\");\n }\n\n handleSliderChange(event: Event) {\n const input = event.target as HTMLInputElement;\n this.usedValue = parseFloat(input.value);\n\n // Calculando a posição do texto com base no valor do slider\n // const percentage = ((this.usedValue - parseInt(input.min)) / (parseInt(input.max) - parseInt(input.min))) * 100;\n // this.sliderPosition = percentage;\n\n this.buildPositionSlider(parseFloat(input.min), parseFloat(input.max))\n }\n\n\n private buildPositionSlider(min:number, max: number) {\n // Calculando a posição do texto com base no valor do slider\n const percentage = ((this.usedValue - min) / (max - min)) * 100;\n this.sliderPosition = percentage;\n }\n\n async handleOptionChange(option: string) {\n this.selectedOption = option;\n localStorage.setItem(\"bc:used\", option)\n switch (this.selectedOption) {\n case 'use':\n await this.reserve(this.usedValue)\n break;\n case 'dontUse':\n await this.cancel()\n break;\n default:\n }\n }\n render() {\n const remainingGiftback = this.bonus.minimumPurchase - this.bonus.totalValue;\n\n const translateDescription = i18next.t(\"giftDescription\", { amount: `${this.bonus.totalBonus.toFixed(2).replace(\".\", \",\")}`, custom_name: \"Giftback\" })\n\n return (\n\n <div class=\"giftback-container\">\n <div class=\"container-description\">\n <p innerHTML={translateDescription}></p>\n </div>\n <div class=\"slider-wrapper\">\n <div\n class=\"slider-value\"\n style={{\n left: `calc(${this.sliderPosition}% - 20px)`, // Ajuste para centralizar o texto\n }}\n >\n R$ {this.usedValue.toFixed(2).replace(\".\", \",\")}\n </div>\n <input\n disabled\n type=\"range\"\n min=\"0\"\n max={this.bonus.totalBonus}\n value={this.usedValue}\n class=\"slider\"\n step=\"0.01\"\n onInput={(event) => this.handleSliderChange(event)}\n style={{\n background: `linear-gradient(to right, #6D6D5F ${this.sliderPosition}%, #ddd ${this.sliderPosition}%)`,\n }}\n />\n </div>\n <p>\n Adicione <strong>R$ {remainingGiftback < 0 ? \"0,00\" : remainingGiftback.toFixed(2).replace(\".\", \",\")}</strong> ao carrinho para atingir o valor\n máximo!\n </p>\n <div class=\"options\">\n <label>\n <input\n type=\"radio\"\n name=\"giftbackOption\"\n value=\"use\"\n checked={this.selectedOption === 'use'}\n onChange={() => this.handleOptionChange('use')}\n />\n Usar o meu Giftback\n </label>\n <label>\n <input\n type=\"radio\"\n name=\"giftbackOption\"\n value=\"dontUse\"\n checked={this.selectedOption === 'dontUse'}\n onChange={() => this.handleOptionChange('dontUse')}\n />\n Não usar o meu Giftback\n </label>\n </div>\n <div class=\"info-box\">\n O Giftback será aplicado na próxima etapa.\n </div>\n </div>\n );\n }\n}"]}
@@ -4,8 +4,8 @@ import { S as StepFormEnum } from './p-a561251a.js';
4
4
  import { i as instance } from './p-fb505488.js';
5
5
  import { d as defineCustomElement$9 } from './p-8bc69d9b.js';
6
6
  import { d as defineCustomElement$8 } from './p-2db8985c.js';
7
- import { d as defineCustomElement$7 } from './p-a4fd3bc8.js';
8
- import { d as defineCustomElement$6 } from './p-c95d6c01.js';
7
+ import { d as defineCustomElement$7 } from './p-984bc7d0.js';
8
+ import { d as defineCustomElement$6 } from './p-d4cfdf80.js';
9
9
  import { d as defineCustomElement$5 } from './p-bfe98629.js';
10
10
  import { d as defineCustomElement$4 } from './p-e957883c.js';
11
11
  import { d as defineCustomElement$3 } from './p-c933623f.js';
@@ -1,4 +1,4 @@
1
- import { C as CrmBonus, d as defineCustomElement$1 } from './p-a4fd3bc8.js';
1
+ import { C as CrmBonus, d as defineCustomElement$1 } from './p-984bc7d0.js';
2
2
 
3
3
  const CrmGiftbackForm = CrmBonus;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { G as GiftbackInfo$1, d as defineCustomElement$1 } from './p-c95d6c01.js';
1
+ import { G as GiftbackInfo$1, d as defineCustomElement$1 } from './p-d4cfdf80.js';
2
2
 
3
3
  const GiftbackInfo = GiftbackInfo$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -5,7 +5,7 @@ import { g as getInfoCustomization } from './p-75ba7b9a.js';
5
5
  import { i as instance } from './p-fb505488.js';
6
6
  import { d as defineCustomElement$7 } from './p-8bc69d9b.js';
7
7
  import { d as defineCustomElement$6 } from './p-2db8985c.js';
8
- import { d as defineCustomElement$5 } from './p-c95d6c01.js';
8
+ import { d as defineCustomElement$5 } from './p-d4cfdf80.js';
9
9
  import { d as defineCustomElement$4 } from './p-bfe98629.js';
10
10
  import { d as defineCustomElement$3 } from './p-e957883c.js';
11
11
  import { d as defineCustomElement$2 } from './p-c933623f.js';
@@ -44,12 +44,14 @@ const CrmBonus = /*@__PURE__*/ proxyCustomElement(class CrmBonus extends H {
44
44
  const _bonus = localStorage.getItem(getKeyReserveByCartId(this.cartId));
45
45
  if (_bonus) {
46
46
  const bonus = JSON.parse(_bonus);
47
+ this.bonus = bonus;
47
48
  this.phone = bonus.phone;
48
49
  this.pinInfo = {
49
50
  storeId: bonus.storeId,
50
51
  userId: bonus.userId
51
52
  };
52
53
  await this.validateBonus("2018");
54
+ this.step = StepFormEnum.STEP_RESERVE;
53
55
  }
54
56
  }
55
57
  async handleSendPin(phone) {
@@ -61,18 +63,19 @@ const CrmBonus = /*@__PURE__*/ proxyCustomElement(class CrmBonus extends H {
61
63
  this.phone = phone;
62
64
  this.sendPin();
63
65
  }
64
- componentWillLoad() {
66
+ async componentWillLoad() {
65
67
  this.sucess = "";
66
68
  this.error = "";
67
69
  this.config = getInfoCustomization(this.storeName);
68
- this.handleApply();
70
+ await this.handleApply();
69
71
  }
70
- handleApply() {
71
- const bonus = localStorage.getItem(getKeyReserveByCartId(this.cartId));
72
- if (bonus) {
73
- this.bonus = JSON.parse(bonus);
74
- this.step = StepFormEnum.STEP_RESERVE;
75
- }
72
+ async handleApply() {
73
+ await this.processBonus();
74
+ // const bonus = localStorage.getItem(getKeyReserveByCartId(this.cartId));
75
+ // if (bonus) {
76
+ // this.bonus = JSON.parse(bonus);
77
+ // this.step = StepFormEnum.STEP_RESERVE;
78
+ // }
76
79
  }
77
80
  convertStringToNumber() {
78
81
  const _phone = this.phone.replace(/\D/g, '');
@@ -194,11 +197,11 @@ const CrmBonus = /*@__PURE__*/ proxyCustomElement(class CrmBonus extends H {
194
197
  });
195
198
  }
196
199
  render() {
197
- return (h("div", { key: '50cb7f1d168127e5ef15ee728c5ab376c6b56eae', class: "crm-container-form fbits-responsive-carrinho-desconto" }, h("label", { key: 'ea97bf9b616826be4b861bdad61f5ff362a7eac4', class: "crm-title" }, this.config.giftbackTitle), this.step === StepFormEnum.STEP_PHONE &&
198
- h("phone-form", { key: '25094c38c8d70305d55f10131ea2e84258faf627', value: this.customer.phone, config: this.config, loading: this.loading, handlerSubmit: (phone) => this.handleSendPin(phone) }), this.step === StepFormEnum.STEP_PIN &&
199
- h("pin-form", { key: '1abbf4b064920586102eb983e44b937de5d71092', config: this.config, phone: this.phone, cancel: () => this.changePhone(), resend: () => this.sendPin(), validate: (data) => this.validateBonus(data), loading: this.loading }, this.sucess && h("p", { key: '6643e540d05642bdabc7a004b2165f8c401848e4', class: "crm-message-info" }, this.sucess), this.error && h("p", { key: 'e38dd84f1eda48a8936753b185b56bfd5147e89f', class: "crm-message-error" }, this.error)), this.step === StepFormEnum.STEP_RESERVE &&
200
- h("giftback-info", { key: '084007d5a1e9d16f3d30fd742278c62c4c013ce6', loading: this.loading, cancel: () => this.handleCancel(), bonus: this.bonus, reserve: (amountRedeemed) => this.reserveApply(amountRedeemed) }), this.step === StepFormEnum.STEP_NO_BONUS &&
201
- (h("div", { key: '8d214593cd77985b2e2ccedd75c0feb29a73cf44', class: "container-message" }, instance.t("noGiftback", { storename: this.config.giftbackTitle })))));
200
+ return (h("div", { key: 'bcdcaf47c056325591abc1aca2af8b139b687905', class: "crm-container-form fbits-responsive-carrinho-desconto" }, h("label", { key: 'e5a07f16ec6209c01abcfbd43628c510ba87bbc7', class: "crm-title" }, this.config.giftbackTitle), this.step === StepFormEnum.STEP_PHONE &&
201
+ h("phone-form", { key: '9c928594efaee7f7ebd503b2144eec1ba9c1e8a5', value: this.customer.phone, config: this.config, loading: this.loading, handlerSubmit: (phone) => this.handleSendPin(phone) }), this.step === StepFormEnum.STEP_PIN &&
202
+ h("pin-form", { key: 'd1280fb5e3b71b004b641af35fc4a1f8df85ced8', config: this.config, phone: this.phone, cancel: () => this.changePhone(), resend: () => this.sendPin(), validate: (data) => this.validateBonus(data), loading: this.loading }, this.sucess && h("p", { key: 'eab06087abbac2ce8fada74cd9313ef87ea63ab9', class: "crm-message-info" }, this.sucess), this.error && h("p", { key: '822b7d1058e8e9dfcdc3a2351984aeed3e8fca6c', class: "crm-message-error" }, this.error)), this.step === StepFormEnum.STEP_RESERVE &&
203
+ h("giftback-info", { key: 'e45d28b56f8a8e831050b8afc4075ccbf3bb10b3', loading: this.loading, cancel: () => this.handleCancel(), bonus: this.bonus, reserve: (amountRedeemed) => this.reserveApply(amountRedeemed) }), this.step === StepFormEnum.STEP_NO_BONUS &&
204
+ (h("div", { key: 'bed09587cfcd07465345dbca12ef15657c641680', class: "container-message" }, instance.t("noGiftback", { storename: this.config.giftbackTitle })))));
202
205
  }
203
206
  static get style() { return CrmGiftbackFormStyle0; }
204
207
  }, [0, "crm-giftback-form", {
@@ -272,4 +275,4 @@ defineCustomElement();
272
275
 
273
276
  export { CrmBonus as C, defineCustomElement as d };
274
277
 
275
- //# sourceMappingURL=p-a4fd3bc8.js.map
278
+ //# sourceMappingURL=p-984bc7d0.js.map
@@ -0,0 +1 @@
1
+ {"file":"p-984bc7d0.js","mappings":";;;;;;;;;;;;;AAAA,MAAM,eAAe,GAAG,i9BAAi9B,CAAC;AAC1+B,8BAAe,eAAe;;MCajB,QAAQ;;;;;QAGX,oBAAe,GAAoB,eAAe,CAAC,WAAW,EAAE,CAAC;;;;;;uBAQ7C,KAAK;;;;oBAIH,YAAY,CAAC,UAAU;;sBAG3B,EAAE;qBACH,EAAE;;6BAGF,KAAK;;IAI9B,MAAM,OAAO,CAAC,IAAkB;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;KACjB;IAGD,MAAM,YAAY;QAChB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,qBAAqB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QAGxE,IAAG,MAAM,EAAE;YAET,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;YAEhC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;YAEnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;YACzB,IAAI,CAAC,OAAO,GAAG;gBACb,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,MAAM,EAAE,KAAK,CAAC,MAAM;aACrB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-giftback-form","src/components/giftback-form/giftback-form.tsx"],"sourcesContent":["* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\n:host {\n --crmfont-sizebodymd: 14px;\n --crmline-heightbodymd: 20px;\n --crmletter-spacingtitle-md: 0px\n}\n\n.container-message {\n font-family: Roboto;\n font-size: var(--crmfont-sizebodymd);\n font-weight: 400;\n line-height: var(--crmline-heightbodymd);\n letter-spacing: var(--crmletter-spacingtitle-md);\n text-align: left;\n text-underline-position: from-font;\n text-decoration-skip-ink: none;\n}\n\n.crm-container-form {\n display: flex;\n flex-direction: column;\n justify-content: space-around;\n height: auto;\n padding: 20px 24px 20px 24px;\n border: 1px solid #CCCC;\n writing-mode: horizontal-tb;\n gap: 16px;\n border-top: 1px solid #ccc !important;\n border-bottom: 1px solid #ccc !important;\n}\n\n/* .fbits-responsive-carrinho-desconto {\n overflow: hidden;\n border: 1px solid #ccc;\n border-top: 0;\n border-bottom: 0;\n} */\n\n.crm-phone-form {\n display: flex;\n flex-direction: column;\n height: 100%;\n /* justify-content: space-around; */\n gap: 16px;\n}\n\n.crm-subtitle {\n font-size: 14px;\n color: var(--crm-btn);\n}\n\n.crm-title {\n font-weight: 700;\n line-height: 20px;\n color: #262626;\n font-size: 16px;\n}\n\n.crm-message-info {\n color: #619013;\n font-weight: 500;\n font-size: 12px;\n}\n\n.crm-message-error {\n color: #E11D48;\n font-weight: 500;\n font-size: 12px;\n}","import { Component, Method, Prop, State, h } from \"@stencil/core\";\nimport { CrmBonusService } from \"../../services/crmbonus.service\";\nimport { StepFormEnum } from \"../../contants\";\nimport { IPinSent } from '../../dto/pin.sent'\nimport { IBonus, ICustomer, IProccesPinBonusDto, IProduct } from \"../../dto/validate.pin.bonus\";\nimport { IInfoStore, getInfoCustomization } from \"../../helpers/info.config.helper\";\n\nimport i18next from \"../../i18n/i18n\"\nimport { getKeyReserveByCartId } from \"../../utils/keys.storage\";\n\n@Component({\n tag: 'crm-giftback-form',\n styleUrl: 'giftback-form.css'\n})\nexport class CrmBonus {\n // private phoneInputMask: HTMLPhoneFormElement;\n\n private crmBonusService: CrmBonusService = CrmBonusService.getInstance();\n\n @Prop({ attribute: 'storename' }) storeName;\n @Prop() cartId;\n @Prop() products: Array<IProduct>;\n @Prop() customer: ICustomer;\n\n @State() value: string;\n @State() loading: boolean = false;\n @State() message: string;\n @State() phone: string;\n @State() pinInfo: IPinSent;\n @State() step: StepFormEnum = StepFormEnum.STEP_PHONE;\n @State() bonus: IBonus;\n\n @State() sucess: string = \"\";\n @State() error: string = \"\";\n @State() config: IInfoStore;\n\n @State() hasApplyBonus = false;\n\n\n @Method()\n async setStep(step: StepFormEnum) {\n this.step = step\n }\n\n @Method()\n async processBonus() {\n this.sucess = \"\";\n const _bonus = localStorage.getItem(getKeyReserveByCartId(this.cartId));\n\n\n if(_bonus) {\n\n const bonus = JSON.parse(_bonus)\n\n this.bonus = bonus;\n\n this.phone = bonus.phone;\n this.pinInfo = {\n storeId: bonus.storeId,\n userId: bonus.userId\n }\n\n await this.validateBonus(\"2018\");\n this.step = StepFormEnum.STEP_RESERVE;\n \n }\n \n \n }\n\n async handleSendPin(phone: string) {\n\n this.message = \"\"\n if (!phone) {\n this.message = \"Informe seu telefone\";\n return;\n }\n\n this.phone = phone;\n\n this.sendPin()\n }\n\n async componentWillLoad() {\n this.sucess = \"\";\n this.error = \"\"\n this.config = getInfoCustomization(this.storeName);\n\n await this.handleApply()\n\n }\n\n async handleApply() {\n await this.processBonus();\n \n // const bonus = localStorage.getItem(getKeyReserveByCartId(this.cartId));\n\n // if (bonus) {\n // this.bonus = JSON.parse(bonus);\n // this.step = StepFormEnum.STEP_RESERVE; \n // }\n\n }\n\n private convertStringToNumber(): number {\n const _phone = this.phone.replace(/\\D/g, '');\n return Number(_phone);\n }\n\n public async sendPin() {\n this.loading = true;\n this.message = \"\";\n this.sucess = \"\";\n this.error = \"\"\n\n try {\n\n const _phone = this.convertStringToNumber()\n\n this.pinInfo = await this.crmBonusService.sendPin(_phone, \"\", this.storeName);\n\n this.step = StepFormEnum.STEP_PIN;\n\n } catch (error) {\n this.message = error?.response?.data?.message\n } finally {\n this.loading = false\n }\n }\n\n changePhone() {\n this.sucess = \"\";\n this.error = \"\"\n this.step = StepFormEnum.STEP_PHONE;\n }\n\n public async validateBonus(pin: string) {\n\n if (this.sucess) {\n this.step = StepFormEnum.STEP_RESERVE;\n return\n }\n\n this.loading = true;\n this.sucess = \"\";\n this.error = \"\";\n const payload: IProccesPinBonusDto = {\n pin: pin,\n cellphone: this.phone.toString(),\n storeId: this.pinInfo.storeId.toString(),\n userId: this.pinInfo.userId.toString(),\n checkoutId: this.cartId,\n checkoutProducts: this.products,\n name: null,\n storeName: this.storeName\n }\n\n try {\n this.bonus = await this.crmBonusService.validatePinBonus(payload);\n\n if (!this.bonus.hasBonus) {\n this.loading = false;\n this.step = StepFormEnum.STEP_NO_BONUS;\n return\n }\n\n this.sucess = \"Código validado com sucesso!\";\n localStorage.setItem(getKeyReserveByCartId(this.cartId), JSON.stringify({ ...this.bonus, phone: this.phone }));\n\n } catch (error) {\n const _error: string = error?.response?.data?.message;\n\n if (_error.includes(\"Pin\")) {\n this.error = \"Código inválido!\"\n } else {\n this.error = _error;\n this.step = StepFormEnum.STEP_NO_BONUS;\n }\n\n\n } finally {\n this.loading = false;\n }\n }\n\n public handleCancel() {\n // this.step = StepFormEnum.STEP_PHONE;\n this.cancel()\n }\n\n async cancel() {\n this.message = \"\";\n this.loading = true;\n try {\n await this.crmBonusService.cancel(this.cartId);\n // localStorage.removeItem(this.cartId);\n this.save(0)\n } catch (error) {\n this.message = \"Não consegui cancelar o bônus, tente novamente!\"\n } finally {\n this.loading = false;\n }\n }\n\n public async reserveApply(amount: number) {\n this.loading = true;\n this.message = \"\";\n try {\n await this.reserve(amount);\n this.save(amount);\n\n } catch (error) {\n this.message = \"ocorreu um error ao solicitar a aplicação do bonus! tente novamente\"\n\n this.step = StepFormEnum.STEP_NO_BONUS;\n localStorage.removeItem(this.cartId);\n } finally {\n this.loading = false;\n }\n }\n\n save(amount: number) {\n localStorage.setItem(this.cartId, amount.toString());\n }\n\n public async reserve(amount: number) {\n\n await this.crmBonusService.reserve({\n redeemedBonus: amount,\n cartId: this.cartId,\n ticket: this.cartId,\n grossValue: Number(this.bonus.totalValue),\n storeName: this.storeName,\n storeId: this.bonus.storeId.toString(),\n userId: this.bonus.userId\n });\n }\n\n render() {\n return (\n <div class=\"crm-container-form fbits-responsive-carrinho-desconto\" >\n <label class=\"crm-title\">{this.config.giftbackTitle}</label>\n\n {this.step === StepFormEnum.STEP_PHONE &&\n <phone-form\n value={this.customer.phone}\n config={this.config}\n loading={this.loading}\n handlerSubmit={(phone) => this.handleSendPin(phone)}\n />}\n {\n this.step === StepFormEnum.STEP_PIN &&\n <pin-form\n config={this.config}\n phone={this.phone}\n cancel={() => this.changePhone()}\n resend={() => this.sendPin()}\n validate={(data) => this.validateBonus(data)}\n loading={this.loading}\n >\n {this.sucess && <p class=\"crm-message-info\">{this.sucess}</p>}\n {this.error && <p class=\"crm-message-error\">{this.error}</p>}\n\n </pin-form>\n }\n\n {\n this.step === StepFormEnum.STEP_RESERVE &&\n <giftback-info\n loading={this.loading}\n cancel={() => this.handleCancel()}\n bonus={this.bonus}\n reserve={(amountRedeemed: number) => this.reserveApply(amountRedeemed)}\n />\n }\n\n\n {\n this.step === StepFormEnum.STEP_NO_BONUS &&\n (\n <div class=\"container-message\">\n {i18next.t(\"noGiftback\", { storename: this.config.giftbackTitle })}\n </div>\n )\n\n }\n </div>\n )\n }\n}"],"version":3}
@@ -12,21 +12,27 @@ const GiftbackInfo = /*@__PURE__*/ proxyCustomElement(class GiftbackInfo extends
12
12
  this.selectedOption = 'none';
13
13
  this.loading = false;
14
14
  this.bonus = {
15
- totalBonus: 52,
15
+ totalBonus: 0,
16
16
  cartId: "",
17
- minimumPurchase: 6000,
18
- bonusBalance: 25,
19
- calculatedValue: 25,
17
+ minimumPurchase: 0,
18
+ bonusBalance: 0,
19
+ calculatedValue: 0,
20
20
  firstValidityDate: "",
21
- totalValue: 200
21
+ totalValue: 0
22
22
  };
23
23
  this.reserve = undefined;
24
24
  this.cancel = undefined;
25
25
  this.sliderPosition = 50;
26
26
  }
27
- componentWillLoad() {
27
+ changedBonus() {
28
+ this.updateBonus();
29
+ }
30
+ updateBonus() {
28
31
  this.usedValue = parseFloat(this.bonus.bonusBalance.toString());
29
32
  this.buildPositionSlider(0, this.bonus.totalBonus);
33
+ }
34
+ componentWillLoad() {
35
+ this.updateBonus();
30
36
  this.selectedOption = localStorage.getItem("bc:used");
31
37
  }
32
38
  handleSliderChange(event) {
@@ -57,12 +63,15 @@ const GiftbackInfo = /*@__PURE__*/ proxyCustomElement(class GiftbackInfo extends
57
63
  render() {
58
64
  const remainingGiftback = this.bonus.minimumPurchase - this.bonus.totalValue;
59
65
  const translateDescription = instance.t("giftDescription", { amount: `${this.bonus.totalBonus.toFixed(2).replace(".", ",")}`, custom_name: "Giftback" });
60
- return (h("div", { key: 'aa5d49a4086181b9dbef64b8c518a02032f78589', class: "giftback-container" }, h("div", { key: '4472776339ccd19bf069680b234bfd5a2f1a1c06', class: "container-description" }, h("p", { key: 'a423fdad390f3fe982401ad77d3eb4e1d50b8c31', innerHTML: translateDescription })), h("div", { key: '786d40a55dbe607e3861f22540f372e59804791e', class: "slider-wrapper" }, h("div", { key: '228464696ff66eda5e6d41c06a6c6d1819fd89a9', class: "slider-value", style: {
66
+ return (h("div", { key: 'cfaf3240b19d9d0628f307c40fa1d1732ee1958e', class: "giftback-container" }, h("div", { key: '455b4ce24248b5f782a7fc24ee76a96ca1073ea2', class: "container-description" }, h("p", { key: 'c31137459177e4f4d490b85ec233ad56ac3d01a0', innerHTML: translateDescription })), h("div", { key: '5a0b47a17fce0be92cb8cce9791b44502c0abc37', class: "slider-wrapper" }, h("div", { key: '69b4997516b449e107fc0dc6b8e620ff9bcb6843', class: "slider-value", style: {
61
67
  left: `calc(${this.sliderPosition}% - 20px)`, // Ajuste para centralizar o texto
62
- } }, "R$ ", this.usedValue.toFixed(2).replace(".", ",")), h("input", { key: '9af42bf35195868281069976b11d576e1336efab', disabled: true, type: "range", min: "0", max: this.bonus.totalBonus, value: this.usedValue, class: "slider", step: "0.01", onInput: (event) => this.handleSliderChange(event), style: {
68
+ } }, "R$ ", this.usedValue.toFixed(2).replace(".", ",")), h("input", { key: '7f829763c3df0f35512820fc3aa19ceec3a1f9dd', disabled: true, type: "range", min: "0", max: this.bonus.totalBonus, value: this.usedValue, class: "slider", step: "0.01", onInput: (event) => this.handleSliderChange(event), style: {
63
69
  background: `linear-gradient(to right, #6D6D5F ${this.sliderPosition}%, #ddd ${this.sliderPosition}%)`,
64
- } })), h("p", { key: 'b14d9b6ce990f697bdd870008def3fb1cb283925' }, "Adicione ", h("strong", { key: '94a17d86c483a22c621b4e1ee8a64694e742f8ab' }, "R$ ", remainingGiftback < 0 ? "0,00" : remainingGiftback.toFixed(2).replace(".", ",")), " ao carrinho para atingir o valor m\u00E1ximo!"), h("div", { key: '6cf5ac9fb9b3472c184350d493c7066d870760b2', class: "options" }, h("label", { key: 'eaf67ab7de4ebe9c861dfc0f565935ac26d2a381' }, h("input", { key: '83145e475de7657510bc1ebe2afeaa39b388824a', type: "radio", name: "giftbackOption", value: "use", checked: this.selectedOption === 'use', onChange: () => this.handleOptionChange('use') }), "Usar o meu Giftback"), h("label", { key: '1aab34dc451aaedd5f61d90e73d8ff1b22ca561a' }, h("input", { key: '99cdc43abba27433a0abda7083c54718381fd890', type: "radio", name: "giftbackOption", value: "dontUse", checked: this.selectedOption === 'dontUse', onChange: () => this.handleOptionChange('dontUse') }), "N\u00E3o usar o meu Giftback")), h("div", { key: '6af6b2c739411adfac20cdae80f0f6e9c98ca472', class: "info-box" }, "O Giftback ser\u00E1 aplicado na pr\u00F3xima etapa.")));
70
+ } })), h("p", { key: 'f6581d93a233721f1f4c39fbf915db4c52cd1fe3' }, "Adicione ", h("strong", { key: '6475d931cd33e0e2672959e51e2e60bbbc4b86e6' }, "R$ ", remainingGiftback < 0 ? "0,00" : remainingGiftback.toFixed(2).replace(".", ",")), " ao carrinho para atingir o valor m\u00E1ximo!"), h("div", { key: '97a837a518cc4de92bcec8a6b231b53655174899', class: "options" }, h("label", { key: 'a079f347ff8520b71006321617cf9143f7456bc8' }, h("input", { key: 'aeddb1974329abbd1f8bd3b641445580931e2cff', type: "radio", name: "giftbackOption", value: "use", checked: this.selectedOption === 'use', onChange: () => this.handleOptionChange('use') }), "Usar o meu Giftback"), h("label", { key: '87d2ed1cd59aa6a13acdf4f06737cdc016a90790' }, h("input", { key: '86b4df8c2dc048dd412e5d69fad8bd2f83fc7328', type: "radio", name: "giftbackOption", value: "dontUse", checked: this.selectedOption === 'dontUse', onChange: () => this.handleOptionChange('dontUse') }), "N\u00E3o usar o meu Giftback")), h("div", { key: 'f4c8b2f7e03d02b35ee2be9336d303f5a642cdc7', class: "info-box" }, "O Giftback ser\u00E1 aplicado na pr\u00F3xima etapa.")));
65
71
  }
72
+ static get watchers() { return {
73
+ "bonus": ["changedBonus"]
74
+ }; }
66
75
  static get style() { return GiftbackInfoStyle0; }
67
76
  }, [0, "giftback-info", {
68
77
  "loading": [4],
@@ -72,6 +81,8 @@ const GiftbackInfo = /*@__PURE__*/ proxyCustomElement(class GiftbackInfo extends
72
81
  "usedValue": [32],
73
82
  "selectedOption": [32],
74
83
  "sliderPosition": [32]
84
+ }, undefined, {
85
+ "bonus": ["changedBonus"]
75
86
  }]);
76
87
  function defineCustomElement() {
77
88
  if (typeof customElements === "undefined") {
@@ -90,4 +101,4 @@ defineCustomElement();
90
101
 
91
102
  export { GiftbackInfo as G, defineCustomElement as d };
92
103
 
93
- //# sourceMappingURL=p-c95d6c01.js.map
104
+ //# sourceMappingURL=p-d4cfdf80.js.map
@@ -0,0 +1 @@
1
+ {"file":"p-d4cfdf80.js","mappings":";;;AAAA,MAAM,eAAe,GAAG,yyDAAyyD,CAAC;AACl0D,2BAAe,eAAe;;MCQjB,YAAY;;;;yBACQ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AAU,EAAE,qCAAqC,IAAI,CAAC,cAAc,WAAW,IAAI,CAAC,cAAc,IAAI;aACzG,GACH,CACA,EACN,yEACa,wEAAY,iBAAiB,GAAG,CAAC,GAAG,MAAM,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAU,mDAE9G,EACJ,4DAAK,KAAK,EAAC,SAAS,IAChB,gEACI,8DACI,IAAI,EAAC,OAAO,EACZ,IAAI,EAAC,gBAAgB,EACrB,KAAK,EAAC,KAAK,EACX,OAAO,EAAE,IAAI,CAAC,cAAc,KAAK,KAAK,EACtC,QAAQ,EAAE,MAAM,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,GAChD,wBAEE,EACR,gEACI,8DACI,IAAI,EAAC,OAAO,EACZ,IAAI,EAAC,gBAAgB,EACrB,KAAK,EAAC,SAAS,EACf,OAAO,EAAE,IAAI,CAAC,cAAc,KAAK,SAAS,EAC1C,QAAQ,EAAE,MAAM,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,GACpD,iCAEE,CACN,EACN,4DAAK,KAAK,EAAC,UAAU,2DAEf,CACJ,EACR;KACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["i18next"],"sources":["src/components/giftback-form/subcomponents/giftback-info/giftback-info.css?tag=giftback-info","src/components/giftback-form/subcomponents/giftback-info/giftback-info.tsx"],"sourcesContent":[":host {\n --text-color: #6D6D5F\n}\n\n.giftback-container {\n display: flex;\n flex-direction: column;\n gap: 14px;\n}\n\nh3 {\n font-size: 1.2rem;\n margin-bottom: 8px;\n color: #333;\n}\n\n.container-description p {\n font-size: 14px;\n font-weight: 400;\n}\n\n\np {\n font-size: 12px;\n color: #000;\n}\n\n.value-display h2 {\n color: #6D6D5F;\n /* Verde para o valor atual */\n font-size: 1.6rem;\n margin: 16px 0;\n}\n\ninput[type='range'] {\n width: 100%;\n margin: 12px 0;\n -webkit-appearance: none;\n background: #ddd;\n height: 4px;\n border-radius: 4px;\n outline: none;\n padding: 3px;\n}\n\ninput[type='range']::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 16px;\n height: 16px;\n background: var(--text-color);\n /* Azul para o slider */\n border-radius: 50%;\n cursor: pointer;\n}\n\n.options {\n margin: 0px 0;\n display: flex;\n gap: 10px;\n flex-direction: column;\n}\n\n.options label {\n display: block;\n margin: 0px 0;\n font-size: 0.9rem;\n color: #333;\n}\n\n.options input[type='radio'] {\n margin-right: 8px;\n height: 16px;\n width: 16px;\n}\n\n.options input[type='radio'] {\n appearance: none;\n -webkit-appearance: none;\n margin-right: 8px;\n width: 16px;\n height: 16px;\n border: 2px solid #ddd;\n border-radius: 50%;\n background-color: #fff;\n cursor: pointer;\n transition: all 0.3s;\n padding: 0px;\n }\n\n.options input[type='radio']:checked {\n border-color: #000;\n background-color: #FAFAFA;\n border: 4px solid #000;\n}\n\n.info-box {\n background-color: #f9f9f9;\n border: 1px solid #e0e0e0;\n border-radius: 4px;\n padding: 8px;\n font-size: 14px;\n color: #262626;\n line-height: 20px;\n}\n\n.info-icon {\n font-size: 0.9rem;\n cursor: pointer;\n color: #888;\n}\n\nh3 {\n font-size: 1.2rem;\n margin-bottom: 8px;\n color: #333;\n}\n\n.slider-wrapper {\n position: relative;\n margin: 21px 0px 0px 0px;\n}\n\n.slider {\n width: 100%;\n -webkit-appearance: none;\n background: #ddd;\n height: 4px;\n border-radius: 2px;\n outline: none;\n}\n\n.slider::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 16px;\n height: 16px;\n background: var(--text-color);\n /* Azul para o slider */\n border-radius: 50%;\n cursor: pointer;\n}\n\n.slider-value {\n position: absolute;\n top: -30px;\n /* Posição acima do slider */\n font-size: 16px;\n font-weight: 700;\n color: var(--text-color);\n /* Verde para o texto */\n transform: translateX(-50%);\n white-space: nowrap;\n margin-left: 23px;\n}","import { Component, Prop, State, Watch, h } from \"@stencil/core\";\nimport { IBonus } from \"../../../../dto/validate.pin.bonus\";\n\nimport i18next from '../../../../i18n/i18n'\n\n@Component({\n tag: 'giftback-info',\n styleUrls: ['giftback-info.css']\n})\nexport class GiftbackInfo {\n @State() usedValue: number = 0;\n @State() selectedOption: string = 'none';\n\n @Prop() loading: boolean = false;\n @Prop() bonus: Partial<IBonus> = {\n totalBonus: 0,\n cartId: \"\",\n minimumPurchase: 0,\n bonusBalance: 0,\n calculatedValue: 0,\n firstValidityDate: \"\",\n totalValue: 0\n };\n @Prop() reserve: (amountRedeemed: number) => void;\n @Prop() cancel: () => void;\n\n @State() sliderPosition: number = 50;\n\n @Watch(\"bonus\") \n changedBonus() {\n this.updateBonus()\n }\n\n private updateBonus() {\n this.usedValue = parseFloat(this.bonus.bonusBalance.toString());\n this.buildPositionSlider(0, this.bonus.totalBonus);\n }\n\n componentWillLoad() {\n this.updateBonus();\n this.selectedOption = localStorage.getItem(\"bc:used\");\n }\n\n handleSliderChange(event: Event) {\n const input = event.target as HTMLInputElement;\n this.usedValue = parseFloat(input.value);\n\n // Calculando a posição do texto com base no valor do slider\n // const percentage = ((this.usedValue - parseInt(input.min)) / (parseInt(input.max) - parseInt(input.min))) * 100;\n // this.sliderPosition = percentage;\n\n this.buildPositionSlider(parseFloat(input.min), parseFloat(input.max))\n }\n\n\n private buildPositionSlider(min:number, max: number) {\n // Calculando a posição do texto com base no valor do slider\n const percentage = ((this.usedValue - min) / (max - min)) * 100;\n this.sliderPosition = percentage;\n }\n\n async handleOptionChange(option: string) {\n this.selectedOption = option;\n localStorage.setItem(\"bc:used\", option)\n switch (this.selectedOption) {\n case 'use':\n await this.reserve(this.usedValue)\n break;\n case 'dontUse':\n await this.cancel()\n break;\n default:\n }\n }\n render() {\n const remainingGiftback = this.bonus.minimumPurchase - this.bonus.totalValue;\n\n const translateDescription = i18next.t(\"giftDescription\", { amount: `${this.bonus.totalBonus.toFixed(2).replace(\".\", \",\")}`, custom_name: \"Giftback\" })\n\n return (\n\n <div class=\"giftback-container\">\n <div class=\"container-description\">\n <p innerHTML={translateDescription}></p>\n </div>\n <div class=\"slider-wrapper\">\n <div\n class=\"slider-value\"\n style={{\n left: `calc(${this.sliderPosition}% - 20px)`, // Ajuste para centralizar o texto\n }}\n >\n R$ {this.usedValue.toFixed(2).replace(\".\", \",\")}\n </div>\n <input\n disabled\n type=\"range\"\n min=\"0\"\n max={this.bonus.totalBonus}\n value={this.usedValue}\n class=\"slider\"\n step=\"0.01\"\n onInput={(event) => this.handleSliderChange(event)}\n style={{\n background: `linear-gradient(to right, #6D6D5F ${this.sliderPosition}%, #ddd ${this.sliderPosition}%)`,\n }}\n />\n </div>\n <p>\n Adicione <strong>R$ {remainingGiftback < 0 ? \"0,00\" : remainingGiftback.toFixed(2).replace(\".\", \",\")}</strong> ao carrinho para atingir o valor\n máximo!\n </p>\n <div class=\"options\">\n <label>\n <input\n type=\"radio\"\n name=\"giftbackOption\"\n value=\"use\"\n checked={this.selectedOption === 'use'}\n onChange={() => this.handleOptionChange('use')}\n />\n Usar o meu Giftback\n </label>\n <label>\n <input\n type=\"radio\"\n name=\"giftbackOption\"\n value=\"dontUse\"\n checked={this.selectedOption === 'dontUse'}\n onChange={() => this.handleOptionChange('dontUse')}\n />\n Não usar o meu Giftback\n </label>\n </div>\n <div class=\"info-box\">\n O Giftback será aplicado na próxima etapa.\n </div>\n </div>\n );\n }\n}"],"version":3}
@@ -1,2 +1,2 @@
1
- import{p as e,b as n}from"./p-45c0296c.js";export{s as setNonce}from"./p-45c0296c.js";import{g as a}from"./p-e1255160.js";var o=()=>{const n=import.meta.url;const a={};if(n!==""){a.resourcesUrl=new URL(".",n).href}return e(a)};o().then((async e=>{await a();return n([["p-49b323ef",[[2,"crm-bonus",{userId:[2,"userid"],storeName:[8,"storename"],productsInString:[1,"products"],cartId:[8,"cartid"],showModal:[32],products:[32],customer:[32],loading:[32],message:[32],phone:[32],canCancel:[32],amountCancel:[32],sent:[32],session:[32],resetBonus:[64]},null,{productsInString:["watchProducts"]}]]],["p-c121f6fc",[[1,"crm-bonus-form",{storeName:[8,"storename"],cartId:[8,"cart-id"],products:[16],customer:[16],sent:[16],stepNext:[2,"step-next"],phone:[2],loadingModal:[4,"loading-modal"],saveStore:[16],cancel:[16],handleCustomerName:[16],loading:[32],step:[32],message:[32],bonus:[32],setStep:[64]}]]],["p-d95bd37f",[[0,"phone-cancel-input",{sendPin:[16],loading:[4],value:[1]}]]],["p-450423b5",[[0,"phone-input",{sendPin:[16],loading:[4],value:[1]}]]],["p-a950d747",[[1,"app-modal",{isOpen:[516,"is-open"],modalTitle:[1,"modal-title"]}]]],["p-a465c900",[[0,"crm-bonus-note",{cartId:[8,"cartid"],storename:[8],url:[32],config:[32]}]]],["p-64441d8f",[[0,"pedido-finalizado",{cartId:[1,"cartid"],orderId:[2,"orderid"],metadadoString:[1,"metadado"]}]]],["p-0152eebc",[[0,"crm-button",{txtBtn:[1,"txt-btn"],loading:[4],handleClick:[16]}]]],["p-b7103956",[[1,"phone-input-mask",{initialValue:[1,"initial-value"],disabled:[4],phone:[32],message:[32],getPhone:[64]}]]],["p-da97c793",[[1,"loading-spinner",{size:[1],color:[1]}]]],["p-d6314a45",[[0,"phone-form",{value:[1],loading:[4],handlerSubmit:[16],config:[16]}],[1,"pin-form",{validate:[16],cancel:[16],resend:[16],sent:[16],loading:[4],phone:[1],config:[16],pin:[32],isVerified:[32],canResend:[32]}],[0,"giftback-info",{loading:[4],bonus:[16],reserve:[16],cancel:[16],usedValue:[32],selectedOption:[32],sliderPosition:[32]}],[1,"countdown-timer",{downtime:[16],counter:[32]}]]],["p-c04d7aac",[[0,"crm-giftback-form",{storeName:[8,"storename"],cartId:[8,"cart-id"],products:[16],customer:[16],value:[32],loading:[32],message:[32],phone:[32],pinInfo:[32],step:[32],bonus:[32],sucess:[32],error:[32],config:[32],hasApplyBonus:[32],setStep:[64],processBonus:[64]}]]],["p-5d209c28",[[1,"giftback-pin",{sent:[16],validate:[16],cancel:[16],loading:[4],pin:[32],isVerified:[32]}],[1,"giftback-progress",{loading:[4],bonus:[16],reserve:[16],cancel:[16],usedValue:[32]}],[0,"name-input",{value:[1],loading:[4],applyName:[16],cancel:[16],newValue:[32],message:[32]}],[1,"giftback-finish"]]]],e)}));
1
+ import{p as e,b as n}from"./p-45c0296c.js";export{s as setNonce}from"./p-45c0296c.js";import{g as a}from"./p-e1255160.js";var o=()=>{const n=import.meta.url;const a={};if(n!==""){a.resourcesUrl=new URL(".",n).href}return e(a)};o().then((async e=>{await a();return n([["p-49b323ef",[[2,"crm-bonus",{userId:[2,"userid"],storeName:[8,"storename"],productsInString:[1,"products"],cartId:[8,"cartid"],showModal:[32],products:[32],customer:[32],loading:[32],message:[32],phone:[32],canCancel:[32],amountCancel:[32],sent:[32],session:[32],resetBonus:[64]},null,{productsInString:["watchProducts"]}]]],["p-c121f6fc",[[1,"crm-bonus-form",{storeName:[8,"storename"],cartId:[8,"cart-id"],products:[16],customer:[16],sent:[16],stepNext:[2,"step-next"],phone:[2],loadingModal:[4,"loading-modal"],saveStore:[16],cancel:[16],handleCustomerName:[16],loading:[32],step:[32],message:[32],bonus:[32],setStep:[64]}]]],["p-d95bd37f",[[0,"phone-cancel-input",{sendPin:[16],loading:[4],value:[1]}]]],["p-450423b5",[[0,"phone-input",{sendPin:[16],loading:[4],value:[1]}]]],["p-a950d747",[[1,"app-modal",{isOpen:[516,"is-open"],modalTitle:[1,"modal-title"]}]]],["p-a465c900",[[0,"crm-bonus-note",{cartId:[8,"cartid"],storename:[8],url:[32],config:[32]}]]],["p-64441d8f",[[0,"pedido-finalizado",{cartId:[1,"cartid"],orderId:[2,"orderid"],metadadoString:[1,"metadado"]}]]],["p-0152eebc",[[0,"crm-button",{txtBtn:[1,"txt-btn"],loading:[4],handleClick:[16]}]]],["p-b7103956",[[1,"phone-input-mask",{initialValue:[1,"initial-value"],disabled:[4],phone:[32],message:[32],getPhone:[64]}]]],["p-da97c793",[[1,"loading-spinner",{size:[1],color:[1]}]]],["p-0160f5f5",[[0,"phone-form",{value:[1],loading:[4],handlerSubmit:[16],config:[16]}],[1,"pin-form",{validate:[16],cancel:[16],resend:[16],sent:[16],loading:[4],phone:[1],config:[16],pin:[32],isVerified:[32],canResend:[32]}],[0,"giftback-info",{loading:[4],bonus:[16],reserve:[16],cancel:[16],usedValue:[32],selectedOption:[32],sliderPosition:[32]},null,{bonus:["changedBonus"]}],[1,"countdown-timer",{downtime:[16],counter:[32]}]]],["p-feadb94b",[[0,"crm-giftback-form",{storeName:[8,"storename"],cartId:[8,"cart-id"],products:[16],customer:[16],value:[32],loading:[32],message:[32],phone:[32],pinInfo:[32],step:[32],bonus:[32],sucess:[32],error:[32],config:[32],hasApplyBonus:[32],setStep:[64],processBonus:[64]}]]],["p-5d209c28",[[1,"giftback-pin",{sent:[16],validate:[16],cancel:[16],loading:[4],pin:[32],isVerified:[32]}],[1,"giftback-progress",{loading:[4],bonus:[16],reserve:[16],cancel:[16],usedValue:[32]}],[0,"name-input",{value:[1],loading:[4],applyName:[16],cancel:[16],newValue:[32],message:[32]}],[1,"giftback-finish"]]]],e)}));
2
2
  //# sourceMappingURL=crmbonus-component-wake.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["patchBrowser","importMeta","url","opts","resourcesUrl","URL","href","promiseResolve","then","async","options","globalScripts","bootstrapLazy","userId","storeName","productsInString","cartId","showModal","products","customer","loading","message","phone","canCancel","amountCancel","sent","session","resetBonus","stepNext","loadingModal","saveStore","cancel","handleCustomerName","step","bonus","setStep","sendPin","value","isOpen","modalTitle","storename","config","orderId","metadadoString","txtBtn","handleClick","initialValue","disabled","getPhone","size","color","handlerSubmit","validate","resend","pin","isVerified","canResend","reserve","usedValue","selectedOption","sliderPosition","downtime","counter","pinInfo","sucess","error","hasApplyBonus","processBonus","applyName","newValue"],"sources":["node_modules/@stencil/core/internal/client/patch-browser.js","@lazy-browser-entrypoint?app-data=conditional"],"sourcesContent":["/*\n Stencil Client Patch Browser v4.22.2 | MIT Licensed | https://stenciljs.com\n */\n\n// src/client/client-patch-browser.ts\nimport { BUILD, NAMESPACE } from \"@stencil/core/internal/app-data\";\nimport { consoleDevInfo, doc, H, promiseResolve } from \"@stencil/core\";\nvar patchBrowser = () => {\n if (BUILD.isDev && !BUILD.isTesting) {\n consoleDevInfo(\"Running in development mode.\");\n }\n if (BUILD.cloneNodeFix) {\n patchCloneNodeFix(H.prototype);\n }\n const scriptElm = BUILD.scriptDataOpts ? Array.from(doc.querySelectorAll(\"script\")).find(\n (s) => new RegExp(`/${NAMESPACE}(\\\\.esm)?\\\\.js($|\\\\?|#)`).test(s.src) || s.getAttribute(\"data-stencil-namespace\") === NAMESPACE\n ) : null;\n const importMeta = import.meta.url;\n const opts = BUILD.scriptDataOpts ? (scriptElm || {})[\"data-opts\"] || {} : {};\n if (importMeta !== \"\") {\n opts.resourcesUrl = new URL(\".\", importMeta).href;\n }\n return promiseResolve(opts);\n};\nvar patchCloneNodeFix = (HTMLElementPrototype) => {\n const nativeCloneNodeFn = HTMLElementPrototype.cloneNode;\n HTMLElementPrototype.cloneNode = function(deep) {\n if (this.nodeName === \"TEMPLATE\") {\n return nativeCloneNodeFn.call(this, deep);\n }\n const clonedNode = nativeCloneNodeFn.call(this, false);\n const srcChildNodes = this.childNodes;\n if (deep) {\n for (let i = 0; i < srcChildNodes.length; i++) {\n if (srcChildNodes[i].nodeType !== 2) {\n clonedNode.appendChild(srcChildNodes[i].cloneNode(true));\n }\n }\n }\n return clonedNode;\n };\n};\nexport {\n patchBrowser\n};\n","export { setNonce } from '@stencil/core';\nimport { bootstrapLazy } from '@stencil/core';\nimport { patchBrowser } from '@stencil/core/internal/client/patch-browser';\nimport { globalScripts } from '@stencil/core/internal/app-globals';\npatchBrowser().then(async (options) => {\n await globalScripts();\n return bootstrapLazy([/*!__STENCIL_LAZY_DATA__*/], options);\n});\n"],"mappings":"0HAOA,IAAIA,EAAe,KAUjB,MAAMC,cAAyBC,IAC/B,MAAMC,EAAqE,GAC3E,GAAIF,IAAe,GAAI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AA,6BAAAC,SAAA,KAAAC,QAAA,gDAAAhD,UAAA,gBAAAE,OAAA,cAAAE,SAAA,KAAAC,SAAA,KAAAkB,MAAA,KAAAjB,QAAA,KAAAC,QAAA,KAAAC,MAAA,KAAAyC,QAAA,KAAA9B,KAAA,KAAAC,MAAA,KAAA8B,OAAA,KAAAC,MAAA,KAAAxB,OAAA,KAAAyB,cAAA,KAAA/B,QAAA,KAAAgC,aAAA,2CAAA1C,KAAA,KAAA2B,SAAA,KAAArB,OAAA,KAAAX,QAAA,IAAAkC,IAAA,KAAAC,WAAA,+BAAAnC,QAAA,IAAAc,MAAA,KAAAuB,QAAA,KAAA1B,OAAA,KAAA2B,UAAA,wBAAArB,MAAA,IAAAjB,QAAA,IAAAgD,UAAA,KAAArC,OAAA,KAAAsC,SAAA,KAAAhD,QAAA,gCAAAX,EAAA","ignoreList":[]}
1
+ {"version":3,"names":["patchBrowser","importMeta","url","opts","resourcesUrl","URL","href","promiseResolve","then","async","options","globalScripts","bootstrapLazy","userId","storeName","productsInString","cartId","showModal","products","customer","loading","message","phone","canCancel","amountCancel","sent","session","resetBonus","stepNext","loadingModal","saveStore","cancel","handleCustomerName","step","bonus","setStep","sendPin","value","isOpen","modalTitle","storename","config","orderId","metadadoString","txtBtn","handleClick","initialValue","disabled","getPhone","size","color","handlerSubmit","validate","resend","pin","isVerified","canResend","reserve","usedValue","selectedOption","sliderPosition","downtime","counter","pinInfo","sucess","error","hasApplyBonus","processBonus","applyName","newValue"],"sources":["node_modules/@stencil/core/internal/client/patch-browser.js","@lazy-browser-entrypoint?app-data=conditional"],"sourcesContent":["/*\n Stencil Client Patch Browser v4.22.2 | MIT Licensed | https://stenciljs.com\n */\n\n// src/client/client-patch-browser.ts\nimport { BUILD, NAMESPACE } from \"@stencil/core/internal/app-data\";\nimport { consoleDevInfo, doc, H, promiseResolve } from \"@stencil/core\";\nvar patchBrowser = () => {\n if (BUILD.isDev && !BUILD.isTesting) {\n consoleDevInfo(\"Running in development mode.\");\n }\n if (BUILD.cloneNodeFix) {\n patchCloneNodeFix(H.prototype);\n }\n const scriptElm = BUILD.scriptDataOpts ? Array.from(doc.querySelectorAll(\"script\")).find(\n (s) => new RegExp(`/${NAMESPACE}(\\\\.esm)?\\\\.js($|\\\\?|#)`).test(s.src) || s.getAttribute(\"data-stencil-namespace\") === NAMESPACE\n ) : null;\n const importMeta = import.meta.url;\n const opts = BUILD.scriptDataOpts ? (scriptElm || {})[\"data-opts\"] || {} : {};\n if (importMeta !== \"\") {\n opts.resourcesUrl = new URL(\".\", importMeta).href;\n }\n return promiseResolve(opts);\n};\nvar patchCloneNodeFix = (HTMLElementPrototype) => {\n const nativeCloneNodeFn = HTMLElementPrototype.cloneNode;\n HTMLElementPrototype.cloneNode = function(deep) {\n if (this.nodeName === \"TEMPLATE\") {\n return nativeCloneNodeFn.call(this, deep);\n }\n const clonedNode = nativeCloneNodeFn.call(this, false);\n const srcChildNodes = this.childNodes;\n if (deep) {\n for (let i = 0; i < srcChildNodes.length; i++) {\n if (srcChildNodes[i].nodeType !== 2) {\n clonedNode.appendChild(srcChildNodes[i].cloneNode(true));\n }\n }\n }\n return clonedNode;\n };\n};\nexport {\n patchBrowser\n};\n","export { setNonce } from '@stencil/core';\nimport { bootstrapLazy } from '@stencil/core';\nimport { patchBrowser } from '@stencil/core/internal/client/patch-browser';\nimport { globalScripts } from '@stencil/core/internal/app-globals';\npatchBrowser().then(async (options) => {\n await globalScripts();\n return bootstrapLazy([/*!__STENCIL_LAZY_DATA__*/], options);\n});\n"],"mappings":"0HAOA,IAAIA,EAAe,KAUjB,MAAMC,cAAyBC,IAC/B,MAAMC,EAAqE,GAC3E,GAAIF,IAAe,GAAI,CACrBE,EAAKC,aAAe,IAAIC,IAAI,IAAKJ,GAAYK,IACjD,CACE,OAAOC,EAAeJ,EAAK,EClB7BH,IAAeQ,MAAKC,MAAOC,UACnBC,IACN,OAAOC,EAAc,+BAA8B,CAAAC,OAAS,aAAAC,UAAA,gBAAAC,iBA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,KAAAC,MAAA,KAAA8B,OAAA,KAAAC,MAAA,KAAAxB,OAAA,KAAAyB,cAAA,KAAA/B,QAAA,KAAAgC,aAAA,2CAAA1C,KAAA,KAAA2B,SAAA,KAAArB,OAAA,KAAAX,QAAA,IAAAkC,IAAA,KAAAC,WAAA,+BAAAnC,QAAA,IAAAc,MAAA,KAAAuB,QAAA,KAAA1B,OAAA,KAAA2B,UAAA,wBAAArB,MAAA,IAAAjB,QAAA,IAAAgD,UAAA,KAAArC,OAAA,KAAAsC,SAAA,KAAAhD,QAAA,gCAAAX,EAAA","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ import{r as e,h as t,H as i}from"./p-45c0296c.js";import{i as o}from"./p-fb505488.js";const n=class{constructor(t){e(this,t);this.downtime=undefined;this.counter=30}componentWillLoad(){this.intervalId=setInterval((()=>{if(this.counter>0){this.counter--}else{clearInterval(this.intervalId);this.downtime()}}),1e3)}disconnectedCallback(){clearInterval(this.intervalId)}render(){return t("label",{key:"6313656b73bec34e3e4e5099c2bd7633e025588e"},this.counter,"s")}};const a=":host{--text-color:#6D6D5F}.giftback-container{display:flex;flex-direction:column;gap:14px}h3{font-size:1.2rem;margin-bottom:8px;color:#333}.container-description p{font-size:14px;font-weight:400}p{font-size:12px;color:#000}.value-display h2{color:#6D6D5F;font-size:1.6rem;margin:16px 0}input[type='range']{width:100%;margin:12px 0;-webkit-appearance:none;background:#ddd;height:4px;border-radius:4px;outline:none;padding:3px}input[type='range']::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:16px;height:16px;background:var(--text-color);border-radius:50%;cursor:pointer}.options{margin:0px 0;display:flex;gap:10px;flex-direction:column}.options label{display:block;margin:0px 0;font-size:0.9rem;color:#333}.options input[type='radio']{margin-right:8px;height:16px;width:16px}.options input[type='radio']{appearance:none;-webkit-appearance:none;margin-right:8px;width:16px;height:16px;border:2px solid #ddd;border-radius:50%;background-color:#fff;cursor:pointer;transition:all 0.3s;padding:0px}.options input[type='radio']:checked{border-color:#000;background-color:#FAFAFA;border:4px solid #000}.info-box{background-color:#f9f9f9;border:1px solid #e0e0e0;border-radius:4px;padding:8px;font-size:14px;color:#262626;line-height:20px}.info-icon{font-size:0.9rem;cursor:pointer;color:#888}h3{font-size:1.2rem;margin-bottom:8px;color:#333}.slider-wrapper{position:relative;margin:21px 0px 0px 0px}.slider{width:100%;-webkit-appearance:none;background:#ddd;height:4px;border-radius:2px;outline:none}.slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:16px;height:16px;background:var(--text-color);border-radius:50%;cursor:pointer}.slider-value{position:absolute;top:-30px;font-size:16px;font-weight:700;color:var(--text-color);transform:translateX(-50%);white-space:nowrap;margin-left:23px}";const r=a;const s=class{constructor(t){e(this,t);this.usedValue=0;this.selectedOption="none";this.loading=false;this.bonus={totalBonus:0,cartId:"",minimumPurchase:0,bonusBalance:0,calculatedValue:0,firstValidityDate:"",totalValue:0};this.reserve=undefined;this.cancel=undefined;this.sliderPosition=50}changedBonus(){this.updateBonus()}updateBonus(){this.usedValue=parseFloat(this.bonus.bonusBalance.toString());this.buildPositionSlider(0,this.bonus.totalBonus)}componentWillLoad(){this.updateBonus();this.selectedOption=localStorage.getItem("bc:used")}handleSliderChange(e){const t=e.target;this.usedValue=parseFloat(t.value);this.buildPositionSlider(parseFloat(t.min),parseFloat(t.max))}buildPositionSlider(e,t){const i=(this.usedValue-e)/(t-e)*100;this.sliderPosition=i}async handleOptionChange(e){this.selectedOption=e;localStorage.setItem("bc:used",e);switch(this.selectedOption){case"use":await this.reserve(this.usedValue);break;case"dontUse":await this.cancel();break}}render(){const e=this.bonus.minimumPurchase-this.bonus.totalValue;const i=o.t("giftDescription",{amount:`${this.bonus.totalBonus.toFixed(2).replace(".",",")}`,custom_name:"Giftback"});return t("div",{key:"cfaf3240b19d9d0628f307c40fa1d1732ee1958e",class:"giftback-container"},t("div",{key:"455b4ce24248b5f782a7fc24ee76a96ca1073ea2",class:"container-description"},t("p",{key:"c31137459177e4f4d490b85ec233ad56ac3d01a0",innerHTML:i})),t("div",{key:"5a0b47a17fce0be92cb8cce9791b44502c0abc37",class:"slider-wrapper"},t("div",{key:"69b4997516b449e107fc0dc6b8e620ff9bcb6843",class:"slider-value",style:{left:`calc(${this.sliderPosition}% - 20px)`}},"R$ ",this.usedValue.toFixed(2).replace(".",",")),t("input",{key:"7f829763c3df0f35512820fc3aa19ceec3a1f9dd",disabled:true,type:"range",min:"0",max:this.bonus.totalBonus,value:this.usedValue,class:"slider",step:"0.01",onInput:e=>this.handleSliderChange(e),style:{background:`linear-gradient(to right, #6D6D5F ${this.sliderPosition}%, #ddd ${this.sliderPosition}%)`}})),t("p",{key:"f6581d93a233721f1f4c39fbf915db4c52cd1fe3"},"Adicione ",t("strong",{key:"6475d931cd33e0e2672959e51e2e60bbbc4b86e6"},"R$ ",e<0?"0,00":e.toFixed(2).replace(".",","))," ao carrinho para atingir o valor máximo!"),t("div",{key:"97a837a518cc4de92bcec8a6b231b53655174899",class:"options"},t("label",{key:"a079f347ff8520b71006321617cf9143f7456bc8"},t("input",{key:"aeddb1974329abbd1f8bd3b641445580931e2cff",type:"radio",name:"giftbackOption",value:"use",checked:this.selectedOption==="use",onChange:()=>this.handleOptionChange("use")}),"Usar o meu Giftback"),t("label",{key:"87d2ed1cd59aa6a13acdf4f06737cdc016a90790"},t("input",{key:"86b4df8c2dc048dd412e5d69fad8bd2f83fc7328",type:"radio",name:"giftbackOption",value:"dontUse",checked:this.selectedOption==="dontUse",onChange:()=>this.handleOptionChange("dontUse")}),"Não usar o meu Giftback")),t("div",{key:"f4c8b2f7e03d02b35ee2be9336d303f5a642cdc7",class:"info-box"},"O Giftback será aplicado na próxima etapa."))}static get watchers(){return{bonus:["changedBonus"]}}};s.style=r;const c="*{margin:0;padding:0;box-sizing:border-box}:host{--crmfont-sizebodymd:14px;--crmline-heightbodymd:20px;--crmletter-spacingtitle-md:0px}.container-message{font-family:Roboto;font-size:var(--crmfont-sizebodymd);font-weight:400;line-height:var(--crmline-heightbodymd);letter-spacing:var(--crmletter-spacingtitle-md);text-align:left;text-underline-position:from-font;text-decoration-skip-ink:none}.crm-container-form{display:flex;flex-direction:column;justify-content:space-around;height:auto;padding:20px 24px 20px 24px;border:1px solid #CCCC;writing-mode:horizontal-tb;gap:16px;border-top:1px solid #ccc !important;border-bottom:1px solid #ccc !important}.crm-phone-form{display:flex;flex-direction:column;height:100%;gap:16px}.crm-subtitle{font-size:14px;color:var(--crm-btn)}.crm-title{font-weight:700;line-height:20px;color:#262626;font-size:16px}.crm-message-info{color:#619013;font-weight:500;font-size:12px}.crm-message-error{color:#E11D48;font-weight:500;font-size:12px}";const d=c;const p=class{constructor(t){e(this,t);this.value=undefined;this.loading=undefined;this.handlerSubmit=undefined;this.config=undefined}async handlePhone(){const e=await this.phoneInputMask.getPhone();await this.handlerSubmit(e)}render(){var e;return t(i,{key:"a1fa8f1b45d663be5a434ac12af569100ad05f99",class:"crm-phone-form"},t("label",{key:"b374c22ba75e76f482379a7bfc1d1c202e72d9a9",class:"crm-subtitle"},"Digite o seu celular para verificar se há desconto disponível nessa compra"),t("phone-input-mask",{key:"f0816190a397e74a9afb6fc3fe90ee3b00eab3be",initialValue:this.value,ref:e=>this.phoneInputMask=e}),t("crm-button",{key:"864a2c0365f1695fb88a2ccdee75b5341ab634f7",txtBtn:((e=this.config)===null||e===void 0?void 0:e.btnApplyBonusLabel)||"Avançar",loading:this.loading,handleClick:()=>this.handlePhone()}))}};p.style=d;const l=":host{display:block;font-family:Arial, sans-serif}.form-container-pin{display:flex;flex-direction:column;align-items:center}.pin-container{display:flex;justify-content:start;gap:10px}input{width:40px;height:48px;font-size:14px;text-align:center;border:1px solid #ccc;border-radius:5px}button{padding:10px 20px;background-color:#ddd;border:none;border-radius:5px;cursor:pointer}.success{color:green;margin-top:10px}.button{top:50%;background-color:#6c6c7e;color:#fff;border:none;border-radius:10px;padding:15px;min-height:30px;min-width:120px;font-size:20px;cursor:pointer}.button-cancel{top:50%;background-color:#ffffff;color:#1e1c1c;border:1px solid gray;border-radius:10px;padding:10px;min-height:30px;min-width:120px;font-size:19px;cursor:pointer}.crm-description{font-size:14px;width:100%;display:flex;gap:9px}.crm-description a{font-weight:bold;cursor:pointer;text-decoration:underline}.crm-description div{display:flex;gap:5px}";const f=l;const h="*{margin:0;padding:0;box-sizing:border-box}:host{--crmfont-sizebodymd:14px;--crmline-heightbodymd:20px;--crmletter-spacingtitle-md:0px}.container-message{font-family:Roboto;font-size:var(--crmfont-sizebodymd);font-weight:400;line-height:var(--crmline-heightbodymd);letter-spacing:var(--crmletter-spacingtitle-md);text-align:left;text-underline-position:from-font;text-decoration-skip-ink:none}.crm-container-form{display:flex;flex-direction:column;justify-content:space-around;height:auto;padding:20px 24px 20px 24px;border:1px solid #CCCC;writing-mode:horizontal-tb;gap:16px;border-top:1px solid #ccc !important;border-bottom:1px solid #ccc !important}.crm-phone-form{display:flex;flex-direction:column;height:100%;gap:16px}.crm-subtitle{font-size:14px;color:var(--crm-btn)}.crm-title{font-weight:700;line-height:20px;color:#262626;font-size:16px}.crm-message-info{color:#619013;font-weight:500;font-size:12px}.crm-message-error{color:#E11D48;font-weight:500;font-size:12px}";const b=h;const m=class{constructor(t){e(this,t);this.validate=undefined;this.cancel=undefined;this.resend=undefined;this.sent=undefined;this.loading=false;this.phone=undefined;this.config=undefined;this.pin=["","","",""];this.isVerified=false;this.canResend=false}componentWillLoad(){this.canResend=false}handleInput(e,t){const i=e.target;const o=i.value.slice(0,1);this.pin[t]=o;if(o&&t<this.pin.length-1){const e=i.nextElementSibling;e===null||e===void 0?void 0:e.focus()}this.pin=[...this.pin]}validatePin(){this.validate(this.pin.join(""))}verifyPin(){const e=this.pin.join("");if(e==="9999"){this.isVerified=true}}handleTimeout(){this.canResend=true}async handleResend(){await this.resend();this.canResend=false;this.pin=["","","",""]}render(){var e;return t("div",{key:"eafa00ec4ec2e33aa0941b5610945c40aefdff20",class:"crm-phone-form"},t("label",{key:"f41c3d596d49b0d4beab6202f98c85dce4fa9dfa",class:"crm-subtitle"},o.t("pin-sutitle")," ",t("strong",{key:"1e8fe82b99200bb74b3148fd3bd2e6f3d6a9f71b"},"+55 ",this.phone)),t("div",{key:"a847274eb88b0e8a740a54a32ec5bd6026b3a83d",class:"pin-container"},this.pin.map(((e,i)=>t("input",{type:"text",maxLength:1,value:this.pin[i],onInput:e=>this.handleInput(e,i)})))),t("slot",{key:"6b2ab8941fc6c2c0e596744be76ad4060d090d4f"}),t("p",{key:"f81fe581fdfac99298ec7edcebbc0808142647aa",class:"crm-description"}," Não recebeu?",!this.canResend&&t("label",{key:"c818707aec856895a92c640170b45bcb0911261a"}," Reenviar em ",t("countdown-timer",{key:"9b32c89194a419eb86d2ffe36a370c5961a0a1e1",downtime:()=>this.handleTimeout()})," "),this.canResend&&t("div",{key:"a070efe17ff6a7f6f8b2c696e67f17d1f5c8058d"},t("a",{key:"6ed4cf4abe25b38eaa5844049b6161f18adf332f",onClick:()=>this.handleResend()},"Reenviar"),t("a",{key:"f0179af1cace207e8c6e06de9d977e0ea5062dfe",onClick:()=>this.cancel()},"Trocar número"))),t("crm-button",{key:"3352c222bc9b15b5b3e3fd6bfeedf01e1e0b0e76",txtBtn:((e=this.config)===null||e===void 0?void 0:e.btnApplyBonusLabel)||"Avançar",loading:this.loading,handleClick:()=>this.validatePin()}))}};m.style=f+b;export{n as countdown_timer,s as giftback_info,p as phone_form,m as pin_form};
2
+ //# sourceMappingURL=p-0160f5f5.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CountdownTimer","componentWillLoad","this","intervalId","setInterval","counter","clearInterval","downtime","disconnectedCallback","render","h","key","giftbackInfoCss","GiftbackInfoStyle0","GiftbackInfo","totalBonus","cartId","minimumPurchase","bonusBalance","calculatedValue","firstValidityDate","totalValue","changedBonus","updateBonus","usedValue","parseFloat","bonus","toString","buildPositionSlider","selectedOption","localStorage","getItem","handleSliderChange","event","input","target","value","min","max","percentage","sliderPosition","handleOptionChange","option","setItem","reserve","cancel","remainingGiftback","translateDescription","i18next","t","amount","toFixed","replace","custom_name","class","innerHTML","style","left","disabled","type","step","onInput","background","name","checked","onChange","giftbackFormCss","PhoneFormStyle0","PhoneForm","handlePhone","phone","phoneInputMask","getPhone","handlerSubmit","Host","initialValue","ref","txtBtn","_a","config","btnApplyBonusLabel","loading","handleClick","pinFormCss","PinFormStyle0","PinFormStyle1","GiftbackPin","canResend","handleInput","index","slice","pin","length","nextInput","nextElementSibling","focus","validatePin","validate","join","verifyPin","pinCode","isVerified","handleTimeout","handleResend","resend","map","_","maxLength","onClick"],"sources":["src/components/countdown-timer/countdown-timer.tsx","src/components/giftback-form/subcomponents/giftback-info/giftback-info.css?tag=giftback-info","src/components/giftback-form/subcomponents/giftback-info/giftback-info.tsx","src/components/giftback-form/giftback-form.css?tag=phone-form","src/components/giftback-form/subcomponents/phone-form/phone-form.tsx","src/components/giftback-form/subcomponents/pin-form/pin-form.css?tag=pin-form&encapsulation=shadow","src/components/giftback-form/giftback-form.css?tag=pin-form&encapsulation=shadow","src/components/giftback-form/subcomponents/pin-form/pin-form.tsx"],"sourcesContent":["import { Component, h, Prop, State } from '@stencil/core';\n\n@Component({\n tag: 'countdown-timer',\n shadow: true,\n})\nexport class CountdownTimer {\n\n @Prop() downtime: () => void;\n\n @State() counter: number = 30;\n private intervalId: NodeJS.Timer;\n\n componentWillLoad() {\n this.intervalId = setInterval(() => {\n if (this.counter > 0) {\n this.counter--;\n } else {\n clearInterval(this.intervalId);\n\n this.downtime()\n }\n }, 1000); // Intervalo de 1 segundo\n }\n\n disconnectedCallback() {\n clearInterval(this.intervalId);\n }\n\n render() {\n return (\n <label>{this.counter}s</label>\n );\n }\n}\n",":host {\n --text-color: #6D6D5F\n}\n\n.giftback-container {\n display: flex;\n flex-direction: column;\n gap: 14px;\n}\n\nh3 {\n font-size: 1.2rem;\n margin-bottom: 8px;\n color: #333;\n}\n\n.container-description p {\n font-size: 14px;\n font-weight: 400;\n}\n\n\np {\n font-size: 12px;\n color: #000;\n}\n\n.value-display h2 {\n color: #6D6D5F;\n /* Verde para o valor atual */\n font-size: 1.6rem;\n margin: 16px 0;\n}\n\ninput[type='range'] {\n width: 100%;\n margin: 12px 0;\n -webkit-appearance: none;\n background: #ddd;\n height: 4px;\n border-radius: 4px;\n outline: none;\n padding: 3px;\n}\n\ninput[type='range']::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 16px;\n height: 16px;\n background: var(--text-color);\n /* Azul para o slider */\n border-radius: 50%;\n cursor: pointer;\n}\n\n.options {\n margin: 0px 0;\n display: flex;\n gap: 10px;\n flex-direction: column;\n}\n\n.options label {\n display: block;\n margin: 0px 0;\n font-size: 0.9rem;\n color: #333;\n}\n\n.options input[type='radio'] {\n margin-right: 8px;\n height: 16px;\n width: 16px;\n}\n\n.options input[type='radio'] {\n appearance: none;\n -webkit-appearance: none;\n margin-right: 8px;\n width: 16px;\n height: 16px;\n border: 2px solid #ddd;\n border-radius: 50%;\n background-color: #fff;\n cursor: pointer;\n transition: all 0.3s;\n padding: 0px;\n }\n\n.options input[type='radio']:checked {\n border-color: #000;\n background-color: #FAFAFA;\n border: 4px solid #000;\n}\n\n.info-box {\n background-color: #f9f9f9;\n border: 1px solid #e0e0e0;\n border-radius: 4px;\n padding: 8px;\n font-size: 14px;\n color: #262626;\n line-height: 20px;\n}\n\n.info-icon {\n font-size: 0.9rem;\n cursor: pointer;\n color: #888;\n}\n\nh3 {\n font-size: 1.2rem;\n margin-bottom: 8px;\n color: #333;\n}\n\n.slider-wrapper {\n position: relative;\n margin: 21px 0px 0px 0px;\n}\n\n.slider {\n width: 100%;\n -webkit-appearance: none;\n background: #ddd;\n height: 4px;\n border-radius: 2px;\n outline: none;\n}\n\n.slider::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 16px;\n height: 16px;\n background: var(--text-color);\n /* Azul para o slider */\n border-radius: 50%;\n cursor: pointer;\n}\n\n.slider-value {\n position: absolute;\n top: -30px;\n /* Posição acima do slider */\n font-size: 16px;\n font-weight: 700;\n color: var(--text-color);\n /* Verde para o texto */\n transform: translateX(-50%);\n white-space: nowrap;\n margin-left: 23px;\n}","import { Component, Prop, State, Watch, h } from \"@stencil/core\";\nimport { IBonus } from \"../../../../dto/validate.pin.bonus\";\n\nimport i18next from '../../../../i18n/i18n'\n\n@Component({\n tag: 'giftback-info',\n styleUrls: ['giftback-info.css']\n})\nexport class GiftbackInfo {\n @State() usedValue: number = 0;\n @State() selectedOption: string = 'none';\n\n @Prop() loading: boolean = false;\n @Prop() bonus: Partial<IBonus> = {\n totalBonus: 0,\n cartId: \"\",\n minimumPurchase: 0,\n bonusBalance: 0,\n calculatedValue: 0,\n firstValidityDate: \"\",\n totalValue: 0\n };\n @Prop() reserve: (amountRedeemed: number) => void;\n @Prop() cancel: () => void;\n\n @State() sliderPosition: number = 50;\n\n @Watch(\"bonus\") \n changedBonus() {\n this.updateBonus()\n }\n\n private updateBonus() {\n this.usedValue = parseFloat(this.bonus.bonusBalance.toString());\n this.buildPositionSlider(0, this.bonus.totalBonus);\n }\n\n componentWillLoad() {\n this.updateBonus();\n this.selectedOption = localStorage.getItem(\"bc:used\");\n }\n\n handleSliderChange(event: Event) {\n const input = event.target as HTMLInputElement;\n this.usedValue = parseFloat(input.value);\n\n // Calculando a posição do texto com base no valor do slider\n // const percentage = ((this.usedValue - parseInt(input.min)) / (parseInt(input.max) - parseInt(input.min))) * 100;\n // this.sliderPosition = percentage;\n\n this.buildPositionSlider(parseFloat(input.min), parseFloat(input.max))\n }\n\n\n private buildPositionSlider(min:number, max: number) {\n // Calculando a posição do texto com base no valor do slider\n const percentage = ((this.usedValue - min) / (max - min)) * 100;\n this.sliderPosition = percentage;\n }\n\n async handleOptionChange(option: string) {\n this.selectedOption = option;\n localStorage.setItem(\"bc:used\", option)\n switch (this.selectedOption) {\n case 'use':\n await this.reserve(this.usedValue)\n break;\n case 'dontUse':\n await this.cancel()\n break;\n default:\n }\n }\n render() {\n const remainingGiftback = this.bonus.minimumPurchase - this.bonus.totalValue;\n\n const translateDescription = i18next.t(\"giftDescription\", { amount: `${this.bonus.totalBonus.toFixed(2).replace(\".\", \",\")}`, custom_name: \"Giftback\" })\n\n return (\n\n <div class=\"giftback-container\">\n <div class=\"container-description\">\n <p innerHTML={translateDescription}></p>\n </div>\n <div class=\"slider-wrapper\">\n <div\n class=\"slider-value\"\n style={{\n left: `calc(${this.sliderPosition}% - 20px)`, // Ajuste para centralizar o texto\n }}\n >\n R$ {this.usedValue.toFixed(2).replace(\".\", \",\")}\n </div>\n <input\n disabled\n type=\"range\"\n min=\"0\"\n max={this.bonus.totalBonus}\n value={this.usedValue}\n class=\"slider\"\n step=\"0.01\"\n onInput={(event) => this.handleSliderChange(event)}\n style={{\n background: `linear-gradient(to right, #6D6D5F ${this.sliderPosition}%, #ddd ${this.sliderPosition}%)`,\n }}\n />\n </div>\n <p>\n Adicione <strong>R$ {remainingGiftback < 0 ? \"0,00\" : remainingGiftback.toFixed(2).replace(\".\", \",\")}</strong> ao carrinho para atingir o valor\n máximo!\n </p>\n <div class=\"options\">\n <label>\n <input\n type=\"radio\"\n name=\"giftbackOption\"\n value=\"use\"\n checked={this.selectedOption === 'use'}\n onChange={() => this.handleOptionChange('use')}\n />\n Usar o meu Giftback\n </label>\n <label>\n <input\n type=\"radio\"\n name=\"giftbackOption\"\n value=\"dontUse\"\n checked={this.selectedOption === 'dontUse'}\n onChange={() => this.handleOptionChange('dontUse')}\n />\n Não usar o meu Giftback\n </label>\n </div>\n <div class=\"info-box\">\n O Giftback será aplicado na próxima etapa.\n </div>\n </div>\n );\n }\n}","* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\n:host {\n --crmfont-sizebodymd: 14px;\n --crmline-heightbodymd: 20px;\n --crmletter-spacingtitle-md: 0px\n}\n\n.container-message {\n font-family: Roboto;\n font-size: var(--crmfont-sizebodymd);\n font-weight: 400;\n line-height: var(--crmline-heightbodymd);\n letter-spacing: var(--crmletter-spacingtitle-md);\n text-align: left;\n text-underline-position: from-font;\n text-decoration-skip-ink: none;\n}\n\n.crm-container-form {\n display: flex;\n flex-direction: column;\n justify-content: space-around;\n height: auto;\n padding: 20px 24px 20px 24px;\n border: 1px solid #CCCC;\n writing-mode: horizontal-tb;\n gap: 16px;\n border-top: 1px solid #ccc !important;\n border-bottom: 1px solid #ccc !important;\n}\n\n/* .fbits-responsive-carrinho-desconto {\n overflow: hidden;\n border: 1px solid #ccc;\n border-top: 0;\n border-bottom: 0;\n} */\n\n.crm-phone-form {\n display: flex;\n flex-direction: column;\n height: 100%;\n /* justify-content: space-around; */\n gap: 16px;\n}\n\n.crm-subtitle {\n font-size: 14px;\n color: var(--crm-btn);\n}\n\n.crm-title {\n font-weight: 700;\n line-height: 20px;\n color: #262626;\n font-size: 16px;\n}\n\n.crm-message-info {\n color: #619013;\n font-weight: 500;\n font-size: 12px;\n}\n\n.crm-message-error {\n color: #E11D48;\n font-weight: 500;\n font-size: 12px;\n}","import { Component, Host, Prop, h } from \"@stencil/core\";\nimport { IInfoStore } from \"../../../../helpers/info.config.helper\";\n\n@Component({\n tag: 'phone-form',\n styleUrl: '../../giftback-form.css'\n})\nexport class PhoneForm {\n\n private phoneInputMask: HTMLPhoneInputMaskElement;\n\n @Prop() value: string;\n @Prop() loading: boolean;\n @Prop() handlerSubmit: (phone: string) => void;\n\n @Prop() config: IInfoStore;\n\n\n async handlePhone() {\n\n const phone = await this.phoneInputMask.getPhone()\n\n await this.handlerSubmit(phone);\n }\n\n\n render() {\n return (\n <Host class=\"crm-phone-form\">\n <label class=\"crm-subtitle\" >Digite o seu celular para verificar se há desconto disponível nessa compra</label>\n <phone-input-mask initialValue={this.value} ref={ref => this.phoneInputMask = ref} />\n\n <crm-button txtBtn={this.config?.btnApplyBonusLabel || \"Avançar\"} loading={this.loading} handleClick={() => this.handlePhone() } />\n </Host>\n )\n }\n}",":host {\n display: block;\n font-family: Arial, sans-serif;\n}\n\n.form-container-pin {\n display: flex;\n flex-direction: column;\n align-items: center;\n}\n\n.pin-container {\n display: flex;\n /* margin: 26px 0; */\n justify-content: start;\n gap: 10px;\n}\n\ninput {\n width: 40px;\n height: 48px;\n font-size: 14px;\n text-align: center;\n border: 1px solid #ccc;\n border-radius: 5px;\n}\n\nbutton {\n padding: 10px 20px;\n background-color: #ddd;\n border: none;\n border-radius: 5px;\n cursor: pointer;\n}\n\n\n.success {\n color: green;\n margin-top: 10px;\n}\n\n.button {\n top: 50%;\n background-color: #6c6c7e;\n color: #fff;\n border: none;\n border-radius: 10px;\n padding: 15px;\n min-height: 30px;\n min-width: 120px;\n font-size: 20px;\n cursor: pointer;\n}\n\n.button-cancel {\n top: 50%;\n background-color: #ffffff;\n color: #1e1c1c;\n border: 1px solid gray;\n border-radius: 10px;\n padding: 10px;\n min-height: 30px;\n min-width: 120px;\n font-size: 19px;\n cursor: pointer;\n}\n\n.crm-description {\n font-size: 14px;\n width: 100%;\n display: flex;\n gap: 9px;\n}\n\n.crm-description a {\n font-weight: bold;\n cursor: pointer;\n text-decoration: underline;\n}\n\n.crm-description div {\n display: flex;\n gap: 5px;\n}","* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\n:host {\n --crmfont-sizebodymd: 14px;\n --crmline-heightbodymd: 20px;\n --crmletter-spacingtitle-md: 0px\n}\n\n.container-message {\n font-family: Roboto;\n font-size: var(--crmfont-sizebodymd);\n font-weight: 400;\n line-height: var(--crmline-heightbodymd);\n letter-spacing: var(--crmletter-spacingtitle-md);\n text-align: left;\n text-underline-position: from-font;\n text-decoration-skip-ink: none;\n}\n\n.crm-container-form {\n display: flex;\n flex-direction: column;\n justify-content: space-around;\n height: auto;\n padding: 20px 24px 20px 24px;\n border: 1px solid #CCCC;\n writing-mode: horizontal-tb;\n gap: 16px;\n border-top: 1px solid #ccc !important;\n border-bottom: 1px solid #ccc !important;\n}\n\n/* .fbits-responsive-carrinho-desconto {\n overflow: hidden;\n border: 1px solid #ccc;\n border-top: 0;\n border-bottom: 0;\n} */\n\n.crm-phone-form {\n display: flex;\n flex-direction: column;\n height: 100%;\n /* justify-content: space-around; */\n gap: 16px;\n}\n\n.crm-subtitle {\n font-size: 14px;\n color: var(--crm-btn);\n}\n\n.crm-title {\n font-weight: 700;\n line-height: 20px;\n color: #262626;\n font-size: 16px;\n}\n\n.crm-message-info {\n color: #619013;\n font-weight: 500;\n font-size: 12px;\n}\n\n.crm-message-error {\n color: #E11D48;\n font-weight: 500;\n font-size: 12px;\n}","import { Component, h, Prop, State } from '@stencil/core';\nimport { IPinSent } from '../../../../dto/pin.sent';\nimport i18next from '../../../../i18n/i18n'\nimport { IInfoStore } from '../../../../helpers/info.config.helper';\n\n@Component({\n tag: 'pin-form',\n styleUrls: ['pin-form.css', '../../giftback-form.css'],\n shadow: true,\n})\nexport class GiftbackPin {\n\n @Prop() validate: (pin: string) => void;\n @Prop() cancel: () => void;\n @Prop() resend: () => void;\n\n @Prop() sent: IPinSent;\n @Prop() loading: boolean = false;\n @Prop() phone: string;\n @Prop() config: IInfoStore;\n\n @State() pin: string[] = ['', '', '', ''];\n @State() isVerified: boolean = false;\n @State() canResend: boolean = false;\n\n componentWillLoad() {\n this.canResend = false;\n }\n\n handleInput(event: Event, index: number) {\n const input = event.target as HTMLInputElement;\n const value = input.value.slice(0, 1); // Limitar a um único dígito\n this.pin[index] = value;\n\n // Focar no próximo campo, se possível\n if (value && index < this.pin.length - 1) {\n const nextInput = input.nextElementSibling as HTMLInputElement;\n nextInput?.focus();\n }\n\n this.pin = [...this.pin];\n }\n\n validatePin() {\n this.validate(this.pin.join(\"\"))\n }\n\n verifyPin() {\n const pinCode = this.pin.join('');\n if (pinCode === '9999') {\n this.isVerified = true;\n }\n }\n\n handleTimeout() {\n this.canResend = true;\n }\n\n async handleResend() {\n await this.resend();\n\n this.canResend = false;\n this.pin = ['', '', '', '']\n }\n\n render() {\n return (\n <div class=\"crm-phone-form\">\n <label class=\"crm-subtitle\" >{i18next.t('pin-sutitle')} <strong>+55 {this.phone}</strong></label>\n <div class=\"pin-container\">\n {this.pin.map((_, index) => (\n <input\n type=\"text\"\n maxLength={1}\n value={this.pin[index]}\n onInput={(event) => this.handleInput(event, index)}\n />\n ))}\n </div>\n\n <slot></slot>\n\n <p class=\"crm-description\"> Não recebeu?\n {\n !this.canResend && <label> Reenviar em <countdown-timer downtime={() => this.handleTimeout()} /> </label>\n }\n {\n this.canResend && (\n <div >\n <a onClick={() => this.handleResend()}>Reenviar</a>\n <a onClick={() => this.cancel()}>Trocar número</a>\n </div>\n )\n }\n </p>\n <crm-button txtBtn={this.config?.btnApplyBonusLabel || \"Avançar\"} loading={this.loading} handleClick={() => this.validatePin()} />\n </div >\n );\n }\n}\n"],"mappings":"4FAMaA,EAAc,M,8DAII,E,CAG3B,iBAAAC,GACIC,KAAKC,WAAaC,aAAY,KAC1B,GAAIF,KAAKG,QAAU,EAAG,CAClBH,KAAKG,S,KACF,CACHC,cAAcJ,KAAKC,YAEnBD,KAAKK,U,IAEV,I,CAGP,oBAAAC,GACIF,cAAcJ,KAAKC,W,CAGvB,MAAAM,GACI,OACIC,EAAA,SAAAC,IAAA,4CAAQT,KAAKG,QAAO,I,GC/BhC,MAAMO,EAAkB,0yDACxB,MAAAC,EAAeD,E,MCQFE,EAAY,M,wCACQ,E,oBACK,O,aAEP,M,WACM,CAC7BC,WAAY,EACZC,OAAQ,GACRC,gBAAiB,EACjBC,aAAc,EACdC,gBAAiB,EACjBC,kBAAmB,GACnBC,WAAY,G,iEAKkB,E,CAGlC,YAAAC,GACIpB,KAAKqB,a,CAGD,WAAAA,GACJrB,KAAKsB,UAAYC,WAAWvB,KAAKwB,MAAMR,aAAaS,YACpDzB,KAAK0B,oBAAoB,EAAG1B,KAAKwB,MAAMX,W,CAG3C,iBAAAd,GACIC,KAAKqB,cACLrB,KAAK2B,eAAiBC,aAAaC,QAAQ,U,CAG/C,kBAAAC,CAAmBC,GACf,MAAMC,EAAQD,EAAME,OACpBjC,KAAKsB,UAAYC,WAAWS,EAAME,OAMl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KqF,WACD7E,EAAA,OAAAC,IAAA,4CACID,EAAA,KAAAC,IAAA,2CAAGiG,QAAS,IAAM1G,KAAKqG,gBAAc,YACrC7F,EAAA,KAAAC,IAAA,2CAAGiG,QAAS,IAAM1G,KAAK2C,UAAQ,mBAK/CnC,EAAA,cAAAC,IAAA,2CAAYkE,SAAQC,EAAA5E,KAAK6E,UAAM,MAAAD,SAAA,SAAAA,EAAEE,qBAAsB,UAAWC,QAAS/E,KAAK+E,QAASC,YAAa,IAAMhF,KAAK8F,gB","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ import{r as t,h as i}from"./p-45c0296c.js";import{C as s,g as e}from"./p-a7ddcab4.js";import{S as o}from"./p-a561251a.js";import{g as a}from"./p-75ba7b9a.js";import{i as n}from"./p-fb505488.js";const h="*{margin:0;padding:0;box-sizing:border-box}:host{--crmfont-sizebodymd:14px;--crmline-heightbodymd:20px;--crmletter-spacingtitle-md:0px}.container-message{font-family:Roboto;font-size:var(--crmfont-sizebodymd);font-weight:400;line-height:var(--crmline-heightbodymd);letter-spacing:var(--crmletter-spacingtitle-md);text-align:left;text-underline-position:from-font;text-decoration-skip-ink:none}.crm-container-form{display:flex;flex-direction:column;justify-content:space-around;height:auto;padding:20px 24px 20px 24px;border:1px solid #CCCC;writing-mode:horizontal-tb;gap:16px;border-top:1px solid #ccc !important;border-bottom:1px solid #ccc !important}.crm-phone-form{display:flex;flex-direction:column;height:100%;gap:16px}.crm-subtitle{font-size:14px;color:var(--crm-btn)}.crm-title{font-weight:700;line-height:20px;color:#262626;font-size:16px}.crm-message-info{color:#619013;font-weight:500;font-size:12px}.crm-message-error{color:#E11D48;font-weight:500;font-size:12px}";const c=h;const r=class{constructor(i){t(this,i);this.crmBonusService=s.getInstance();this.storeName=undefined;this.cartId=undefined;this.products=undefined;this.customer=undefined;this.value=undefined;this.loading=false;this.message=undefined;this.phone=undefined;this.pinInfo=undefined;this.step=o.STEP_PHONE;this.bonus=undefined;this.sucess="";this.error="";this.config=undefined;this.hasApplyBonus=false}async setStep(t){this.step=t}async processBonus(){this.sucess="";const t=localStorage.getItem(e(this.cartId));if(t){const i=JSON.parse(t);this.bonus=i;this.phone=i.phone;this.pinInfo={storeId:i.storeId,userId:i.userId};await this.validateBonus("2018");this.step=o.STEP_RESERVE}}async handleSendPin(t){this.message="";if(!t){this.message="Informe seu telefone";return}this.phone=t;this.sendPin()}async componentWillLoad(){this.sucess="";this.error="";this.config=a(this.storeName);await this.handleApply()}async handleApply(){await this.processBonus()}convertStringToNumber(){const t=this.phone.replace(/\D/g,"");return Number(t)}async sendPin(){var t,i;this.loading=true;this.message="";this.sucess="";this.error="";try{const t=this.convertStringToNumber();this.pinInfo=await this.crmBonusService.sendPin(t,"",this.storeName);this.step=o.STEP_PIN}catch(s){this.message=(i=(t=s===null||s===void 0?void 0:s.response)===null||t===void 0?void 0:t.data)===null||i===void 0?void 0:i.message}finally{this.loading=false}}changePhone(){this.sucess="";this.error="";this.step=o.STEP_PHONE}async validateBonus(t){var i,s;if(this.sucess){this.step=o.STEP_RESERVE;return}this.loading=true;this.sucess="";this.error="";const a={pin:t,cellphone:this.phone.toString(),storeId:this.pinInfo.storeId.toString(),userId:this.pinInfo.userId.toString(),checkoutId:this.cartId,checkoutProducts:this.products,name:null,storeName:this.storeName};try{this.bonus=await this.crmBonusService.validatePinBonus(a);if(!this.bonus.hasBonus){this.loading=false;this.step=o.STEP_NO_BONUS;return}this.sucess="Código validado com sucesso!";localStorage.setItem(e(this.cartId),JSON.stringify(Object.assign(Object.assign({},this.bonus),{phone:this.phone})))}catch(t){const e=(s=(i=t===null||t===void 0?void 0:t.response)===null||i===void 0?void 0:i.data)===null||s===void 0?void 0:s.message;if(e.includes("Pin")){this.error="Código inválido!"}else{this.error=e;this.step=o.STEP_NO_BONUS}}finally{this.loading=false}}handleCancel(){this.cancel()}async cancel(){this.message="";this.loading=true;try{await this.crmBonusService.cancel(this.cartId);this.save(0)}catch(t){this.message="Não consegui cancelar o bônus, tente novamente!"}finally{this.loading=false}}async reserveApply(t){this.loading=true;this.message="";try{await this.reserve(t);this.save(t)}catch(t){this.message="ocorreu um error ao solicitar a aplicação do bonus! tente novamente";this.step=o.STEP_NO_BONUS;localStorage.removeItem(this.cartId)}finally{this.loading=false}}save(t){localStorage.setItem(this.cartId,t.toString())}async reserve(t){await this.crmBonusService.reserve({redeemedBonus:t,cartId:this.cartId,ticket:this.cartId,grossValue:Number(this.bonus.totalValue),storeName:this.storeName,storeId:this.bonus.storeId.toString(),userId:this.bonus.userId})}render(){return i("div",{key:"bcdcaf47c056325591abc1aca2af8b139b687905",class:"crm-container-form fbits-responsive-carrinho-desconto"},i("label",{key:"e5a07f16ec6209c01abcfbd43628c510ba87bbc7",class:"crm-title"},this.config.giftbackTitle),this.step===o.STEP_PHONE&&i("phone-form",{key:"9c928594efaee7f7ebd503b2144eec1ba9c1e8a5",value:this.customer.phone,config:this.config,loading:this.loading,handlerSubmit:t=>this.handleSendPin(t)}),this.step===o.STEP_PIN&&i("pin-form",{key:"d1280fb5e3b71b004b641af35fc4a1f8df85ced8",config:this.config,phone:this.phone,cancel:()=>this.changePhone(),resend:()=>this.sendPin(),validate:t=>this.validateBonus(t),loading:this.loading},this.sucess&&i("p",{key:"eab06087abbac2ce8fada74cd9313ef87ea63ab9",class:"crm-message-info"},this.sucess),this.error&&i("p",{key:"822b7d1058e8e9dfcdc3a2351984aeed3e8fca6c",class:"crm-message-error"},this.error)),this.step===o.STEP_RESERVE&&i("giftback-info",{key:"e45d28b56f8a8e831050b8afc4075ccbf3bb10b3",loading:this.loading,cancel:()=>this.handleCancel(),bonus:this.bonus,reserve:t=>this.reserveApply(t)}),this.step===o.STEP_NO_BONUS&&i("div",{key:"bed09587cfcd07465345dbca12ef15657c641680",class:"container-message"},n.t("noGiftback",{storename:this.config.giftbackTitle})))}};r.style=c;export{r as crm_giftback_form};
2
+ //# sourceMappingURL=p-feadb94b.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["giftbackFormCss","CrmGiftbackFormStyle0","CrmBonus","this","crmBonusService","CrmBonusService","getInstance","StepFormEnum","STEP_PHONE","setStep","step","processBonus","sucess","_bonus","localStorage","getItem","getKeyReserveByCartId","cartId","bonus","JSON","parse","phone","pinInfo","storeId","userId","validateBonus","STEP_RESERVE","handleSendPin","message","sendPin","componentWillLoad","error","config","getInfoCustomization","storeName","handleApply","convertStringToNumber","_phone","replace","Number","loading","STEP_PIN","_b","_a","response","data","changePhone","pin","payload","cellphone","toString","checkoutId","checkoutProducts","products","name","validatePinBonus","hasBonus","STEP_NO_BONUS","setItem","stringify","Object","assign","_error","includes","handleCancel","cancel","save","reserveApply","amount","reserve","removeItem","redeemedBonus","ticket","grossValue","totalValue","render","h","key","class","giftbackTitle","value","customer","handlerSubmit","resend","validate","amountRedeemed","i18next","t","storename"],"sources":["src/components/giftback-form/giftback-form.css?tag=crm-giftback-form","src/components/giftback-form/giftback-form.tsx"],"sourcesContent":["* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\n:host {\n --crmfont-sizebodymd: 14px;\n --crmline-heightbodymd: 20px;\n --crmletter-spacingtitle-md: 0px\n}\n\n.container-message {\n font-family: Roboto;\n font-size: var(--crmfont-sizebodymd);\n font-weight: 400;\n line-height: var(--crmline-heightbodymd);\n letter-spacing: var(--crmletter-spacingtitle-md);\n text-align: left;\n text-underline-position: from-font;\n text-decoration-skip-ink: none;\n}\n\n.crm-container-form {\n display: flex;\n flex-direction: column;\n justify-content: space-around;\n height: auto;\n padding: 20px 24px 20px 24px;\n border: 1px solid #CCCC;\n writing-mode: horizontal-tb;\n gap: 16px;\n border-top: 1px solid #ccc !important;\n border-bottom: 1px solid #ccc !important;\n}\n\n/* .fbits-responsive-carrinho-desconto {\n overflow: hidden;\n border: 1px solid #ccc;\n border-top: 0;\n border-bottom: 0;\n} */\n\n.crm-phone-form {\n display: flex;\n flex-direction: column;\n height: 100%;\n /* justify-content: space-around; */\n gap: 16px;\n}\n\n.crm-subtitle {\n font-size: 14px;\n color: var(--crm-btn);\n}\n\n.crm-title {\n font-weight: 700;\n line-height: 20px;\n color: #262626;\n font-size: 16px;\n}\n\n.crm-message-info {\n color: #619013;\n font-weight: 500;\n font-size: 12px;\n}\n\n.crm-message-error {\n color: #E11D48;\n font-weight: 500;\n font-size: 12px;\n}","import { Component, Method, Prop, State, h } from \"@stencil/core\";\nimport { CrmBonusService } from \"../../services/crmbonus.service\";\nimport { StepFormEnum } from \"../../contants\";\nimport { IPinSent } from '../../dto/pin.sent'\nimport { IBonus, ICustomer, IProccesPinBonusDto, IProduct } from \"../../dto/validate.pin.bonus\";\nimport { IInfoStore, getInfoCustomization } from \"../../helpers/info.config.helper\";\n\nimport i18next from \"../../i18n/i18n\"\nimport { getKeyReserveByCartId } from \"../../utils/keys.storage\";\n\n@Component({\n tag: 'crm-giftback-form',\n styleUrl: 'giftback-form.css'\n})\nexport class CrmBonus {\n // private phoneInputMask: HTMLPhoneFormElement;\n\n private crmBonusService: CrmBonusService = CrmBonusService.getInstance();\n\n @Prop({ attribute: 'storename' }) storeName;\n @Prop() cartId;\n @Prop() products: Array<IProduct>;\n @Prop() customer: ICustomer;\n\n @State() value: string;\n @State() loading: boolean = false;\n @State() message: string;\n @State() phone: string;\n @State() pinInfo: IPinSent;\n @State() step: StepFormEnum = StepFormEnum.STEP_PHONE;\n @State() bonus: IBonus;\n\n @State() sucess: string = \"\";\n @State() error: string = \"\";\n @State() config: IInfoStore;\n\n @State() hasApplyBonus = false;\n\n\n @Method()\n async setStep(step: StepFormEnum) {\n this.step = step\n }\n\n @Method()\n async processBonus() {\n this.sucess = \"\";\n const _bonus = localStorage.getItem(getKeyReserveByCartId(this.cartId));\n\n\n if(_bonus) {\n\n const bonus = JSON.parse(_bonus)\n\n this.bonus = bonus;\n\n this.phone = bonus.phone;\n this.pinInfo = {\n storeId: bonus.storeId,\n userId: bonus.userId\n }\n\n await this.validateBonus(\"2018\");\n this.step = StepFormEnum.STEP_RESERVE;\n \n }\n \n \n }\n\n async handleSendPin(phone: string) {\n\n this.message = \"\"\n if (!phone) {\n this.message = \"Informe seu telefone\";\n return;\n }\n\n this.phone = phone;\n\n this.sendPin()\n }\n\n async componentWillLoad() {\n this.sucess = \"\";\n this.error = \"\"\n this.config = getInfoCustomization(this.storeName);\n\n await this.handleApply()\n\n }\n\n async handleApply() {\n await this.processBonus();\n \n // const bonus = localStorage.getItem(getKeyReserveByCartId(this.cartId));\n\n // if (bonus) {\n // this.bonus = JSON.parse(bonus);\n // this.step = StepFormEnum.STEP_RESERVE; \n // }\n\n }\n\n private convertStringToNumber(): number {\n const _phone = this.phone.replace(/\\D/g, '');\n return Number(_phone);\n }\n\n public async sendPin() {\n this.loading = true;\n this.message = \"\";\n this.sucess = \"\";\n this.error = \"\"\n\n try {\n\n const _phone = this.convertStringToNumber()\n\n this.pinInfo = await this.crmBonusService.sendPin(_phone, \"\", this.storeName);\n\n this.step = StepFormEnum.STEP_PIN;\n\n } catch (error) {\n this.message = error?.response?.data?.message\n } finally {\n this.loading = false\n }\n }\n\n changePhone() {\n this.sucess = \"\";\n this.error = \"\"\n this.step = StepFormEnum.STEP_PHONE;\n }\n\n public async validateBonus(pin: string) {\n\n if (this.sucess) {\n this.step = StepFormEnum.STEP_RESERVE;\n return\n }\n\n this.loading = true;\n this.sucess = \"\";\n this.error = \"\";\n const payload: IProccesPinBonusDto = {\n pin: pin,\n cellphone: this.phone.toString(),\n storeId: this.pinInfo.storeId.toString(),\n userId: this.pinInfo.userId.toString(),\n checkoutId: this.cartId,\n checkoutProducts: this.products,\n name: null,\n storeName: this.storeName\n }\n\n try {\n this.bonus = await this.crmBonusService.validatePinBonus(payload);\n\n if (!this.bonus.hasBonus) {\n this.loading = false;\n this.step = StepFormEnum.STEP_NO_BONUS;\n return\n }\n\n this.sucess = \"Código validado com sucesso!\";\n localStorage.setItem(getKeyReserveByCartId(this.cartId), JSON.stringify({ ...this.bonus, phone: this.phone }));\n\n } catch (error) {\n const _error: string = error?.response?.data?.message;\n\n if (_error.includes(\"Pin\")) {\n this.error = \"Código inválido!\"\n } else {\n this.error = _error;\n this.step = StepFormEnum.STEP_NO_BONUS;\n }\n\n\n } finally {\n this.loading = false;\n }\n }\n\n public handleCancel() {\n // this.step = StepFormEnum.STEP_PHONE;\n this.cancel()\n }\n\n async cancel() {\n this.message = \"\";\n this.loading = true;\n try {\n await this.crmBonusService.cancel(this.cartId);\n // localStorage.removeItem(this.cartId);\n this.save(0)\n } catch (error) {\n this.message = \"Não consegui cancelar o bônus, tente novamente!\"\n } finally {\n this.loading = false;\n }\n }\n\n public async reserveApply(amount: number) {\n this.loading = true;\n this.message = \"\";\n try {\n await this.reserve(amount);\n this.save(amount);\n\n } catch (error) {\n this.message = \"ocorreu um error ao solicitar a aplicação do bonus! tente novamente\"\n\n this.step = StepFormEnum.STEP_NO_BONUS;\n localStorage.removeItem(this.cartId);\n } finally {\n this.loading = false;\n }\n }\n\n save(amount: number) {\n localStorage.setItem(this.cartId, amount.toString());\n }\n\n public async reserve(amount: number) {\n\n await this.crmBonusService.reserve({\n redeemedBonus: amount,\n cartId: this.cartId,\n ticket: this.cartId,\n grossValue: Number(this.bonus.totalValue),\n storeName: this.storeName,\n storeId: this.bonus.storeId.toString(),\n userId: this.bonus.userId\n });\n }\n\n render() {\n return (\n <div class=\"crm-container-form fbits-responsive-carrinho-desconto\" >\n <label class=\"crm-title\">{this.config.giftbackTitle}</label>\n\n {this.step === StepFormEnum.STEP_PHONE &&\n <phone-form\n value={this.customer.phone}\n config={this.config}\n loading={this.loading}\n handlerSubmit={(phone) => this.handleSendPin(phone)}\n />}\n {\n this.step === StepFormEnum.STEP_PIN &&\n <pin-form\n config={this.config}\n phone={this.phone}\n cancel={() => this.changePhone()}\n resend={() => this.sendPin()}\n validate={(data) => this.validateBonus(data)}\n loading={this.loading}\n >\n {this.sucess && <p class=\"crm-message-info\">{this.sucess}</p>}\n {this.error && <p class=\"crm-message-error\">{this.error}</p>}\n\n </pin-form>\n }\n\n {\n this.step === StepFormEnum.STEP_RESERVE &&\n <giftback-info\n loading={this.loading}\n cancel={() => this.handleCancel()}\n bonus={this.bonus}\n reserve={(amountRedeemed: number) => this.reserveApply(amountRedeemed)}\n />\n }\n\n\n {\n this.step === StepFormEnum.STEP_NO_BONUS &&\n (\n <div class=\"container-message\">\n {i18next.t(\"noGiftback\", { storename: this.config.giftbackTitle })}\n </div>\n )\n\n }\n </div>\n )\n }\n}"],"mappings":"kMAAA,MAAMA,EAAkB,k9BACxB,MAAAC,EAAeD,E,MCaFE,EAAQ,M,yBAGXC,KAAAC,gBAAmCC,EAAgBC,c,iIAQ/B,M,6EAIEC,EAAaC,W,iCAGjB,G,WACD,G,yCAGA,K,CAIzB,aAAMC,CAAQC,GACZP,KAAKO,KAAOA,C,CAId,kBAAMC,GACJR,KAAKS,OAAS,GACd,MAAMC,EAASC,aAAaC,QAAQC,EAAsBb,KAAKc,SAG/D,GAAGJ,EAAQ,CAET,MAAMK,EAAQC,KAAKC,MAAMP,GAEzBV,KAAKe,MAAQA,EAEbf,KAAKkB,MAAQH,EAAMG,MACnBlB,KAAKmB,QAAU,CACbC,QAASL,EAAMK,QACfC,OAAQN,EAAMM,cAGVrB,KAAKsB,cAAc,QACzBtB,KAAKO,KAAOH,EAAamB,Y,EAO7B,mBAAMC,CAAcN,GAElBlB,KAAKyB,QAAU,GACf,IAAKP,EAAO,CACVlB,KAAKyB,QAAU,uBACf,M,CAGFzB,KAAKkB,MAAQA,EAEblB,KAAK0B,S,CAGP,uBAAMC,GACJ3B,KAAKS,OAAS,GACdT,KAAK4B,MAAQ,GACb5B,KAAK6B,OAASC,EAAqB9B,KAAK+B,iBAElC/B,KAAKgC,a,CAIb,iBAAMA,SACEhC,KAAKQ,c,CAWL,qBAAAyB,GACN,MAAMC,EAASlC,KAAKkB,MAAMiB,QAAQ,MAAO,IACzC,OAAOC,OAAOF,E,CAGT,aAAMR,G,QACX1B,KAAKqC,QAAU,KACfrC,KAAKyB,QAAU,GACfzB,KAAK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7E,KAAK8E,SAAS5D,MACrBW,OAAQ7B,KAAK6B,OACbQ,QAASrC,KAAKqC,QACd0C,cAAgB7D,GAAUlB,KAAKwB,cAAcN,KAG/ClB,KAAKO,OAASH,EAAakC,UAC3BmC,EAAA,YAAAC,IAAA,2CACE7C,OAAQ7B,KAAK6B,OACbX,MAAOlB,KAAKkB,MACZ4C,OAAQ,IAAM9D,KAAK2C,cACnBqC,OAAQ,IAAMhF,KAAK0B,UACnBuD,SAAWvC,GAAS1C,KAAKsB,cAAcoB,GACvCL,QAASrC,KAAKqC,SAEbrC,KAAKS,QAAUgE,EAAA,KAAAC,IAAA,2CAAGC,MAAM,oBAAoB3E,KAAKS,QACjDT,KAAK4B,OAAS6C,EAAA,KAAAC,IAAA,2CAAGC,MAAM,qBAAqB3E,KAAK4B,QAMpD5B,KAAKO,OAASH,EAAamB,cAC3BkD,EAAA,iBAAAC,IAAA,2CACErC,QAASrC,KAAKqC,QACdyB,OAAQ,IAAM9D,KAAK6D,eACnB9C,MAAOf,KAAKe,MACZmD,QAAUgB,GAA2BlF,KAAKgE,aAAakB,KAMzDlF,KAAKO,OAASH,EAAakD,eAEzBmB,EAAA,OAAAC,IAAA,2CAAKC,MAAM,qBACRQ,EAAQC,EAAE,aAAc,CAAEC,UAAWrF,KAAK6B,OAAO+C,iB","ignoreList":[]}
@@ -36,21 +36,27 @@ const GiftbackInfo = class {
36
36
  this.selectedOption = 'none';
37
37
  this.loading = false;
38
38
  this.bonus = {
39
- totalBonus: 52,
39
+ totalBonus: 0,
40
40
  cartId: "",
41
- minimumPurchase: 6000,
42
- bonusBalance: 25,
43
- calculatedValue: 25,
41
+ minimumPurchase: 0,
42
+ bonusBalance: 0,
43
+ calculatedValue: 0,
44
44
  firstValidityDate: "",
45
- totalValue: 200
45
+ totalValue: 0
46
46
  };
47
47
  this.reserve = undefined;
48
48
  this.cancel = undefined;
49
49
  this.sliderPosition = 50;
50
50
  }
51
- componentWillLoad() {
51
+ changedBonus() {
52
+ this.updateBonus();
53
+ }
54
+ updateBonus() {
52
55
  this.usedValue = parseFloat(this.bonus.bonusBalance.toString());
53
56
  this.buildPositionSlider(0, this.bonus.totalBonus);
57
+ }
58
+ componentWillLoad() {
59
+ this.updateBonus();
54
60
  this.selectedOption = localStorage.getItem("bc:used");
55
61
  }
56
62
  handleSliderChange(event) {
@@ -81,12 +87,15 @@ const GiftbackInfo = class {
81
87
  render() {
82
88
  const remainingGiftback = this.bonus.minimumPurchase - this.bonus.totalValue;
83
89
  const translateDescription = instance.t("giftDescription", { amount: `${this.bonus.totalBonus.toFixed(2).replace(".", ",")}`, custom_name: "Giftback" });
84
- return (h("div", { key: 'aa5d49a4086181b9dbef64b8c518a02032f78589', class: "giftback-container" }, h("div", { key: '4472776339ccd19bf069680b234bfd5a2f1a1c06', class: "container-description" }, h("p", { key: 'a423fdad390f3fe982401ad77d3eb4e1d50b8c31', innerHTML: translateDescription })), h("div", { key: '786d40a55dbe607e3861f22540f372e59804791e', class: "slider-wrapper" }, h("div", { key: '228464696ff66eda5e6d41c06a6c6d1819fd89a9', class: "slider-value", style: {
90
+ return (h("div", { key: 'cfaf3240b19d9d0628f307c40fa1d1732ee1958e', class: "giftback-container" }, h("div", { key: '455b4ce24248b5f782a7fc24ee76a96ca1073ea2', class: "container-description" }, h("p", { key: 'c31137459177e4f4d490b85ec233ad56ac3d01a0', innerHTML: translateDescription })), h("div", { key: '5a0b47a17fce0be92cb8cce9791b44502c0abc37', class: "slider-wrapper" }, h("div", { key: '69b4997516b449e107fc0dc6b8e620ff9bcb6843', class: "slider-value", style: {
85
91
  left: `calc(${this.sliderPosition}% - 20px)`, // Ajuste para centralizar o texto
86
- } }, "R$ ", this.usedValue.toFixed(2).replace(".", ",")), h("input", { key: '9af42bf35195868281069976b11d576e1336efab', disabled: true, type: "range", min: "0", max: this.bonus.totalBonus, value: this.usedValue, class: "slider", step: "0.01", onInput: (event) => this.handleSliderChange(event), style: {
92
+ } }, "R$ ", this.usedValue.toFixed(2).replace(".", ",")), h("input", { key: '7f829763c3df0f35512820fc3aa19ceec3a1f9dd', disabled: true, type: "range", min: "0", max: this.bonus.totalBonus, value: this.usedValue, class: "slider", step: "0.01", onInput: (event) => this.handleSliderChange(event), style: {
87
93
  background: `linear-gradient(to right, #6D6D5F ${this.sliderPosition}%, #ddd ${this.sliderPosition}%)`,
88
- } })), h("p", { key: 'b14d9b6ce990f697bdd870008def3fb1cb283925' }, "Adicione ", h("strong", { key: '94a17d86c483a22c621b4e1ee8a64694e742f8ab' }, "R$ ", remainingGiftback < 0 ? "0,00" : remainingGiftback.toFixed(2).replace(".", ",")), " ao carrinho para atingir o valor m\u00E1ximo!"), h("div", { key: '6cf5ac9fb9b3472c184350d493c7066d870760b2', class: "options" }, h("label", { key: 'eaf67ab7de4ebe9c861dfc0f565935ac26d2a381' }, h("input", { key: '83145e475de7657510bc1ebe2afeaa39b388824a', type: "radio", name: "giftbackOption", value: "use", checked: this.selectedOption === 'use', onChange: () => this.handleOptionChange('use') }), "Usar o meu Giftback"), h("label", { key: '1aab34dc451aaedd5f61d90e73d8ff1b22ca561a' }, h("input", { key: '99cdc43abba27433a0abda7083c54718381fd890', type: "radio", name: "giftbackOption", value: "dontUse", checked: this.selectedOption === 'dontUse', onChange: () => this.handleOptionChange('dontUse') }), "N\u00E3o usar o meu Giftback")), h("div", { key: '6af6b2c739411adfac20cdae80f0f6e9c98ca472', class: "info-box" }, "O Giftback ser\u00E1 aplicado na pr\u00F3xima etapa.")));
94
+ } })), h("p", { key: 'f6581d93a233721f1f4c39fbf915db4c52cd1fe3' }, "Adicione ", h("strong", { key: '6475d931cd33e0e2672959e51e2e60bbbc4b86e6' }, "R$ ", remainingGiftback < 0 ? "0,00" : remainingGiftback.toFixed(2).replace(".", ",")), " ao carrinho para atingir o valor m\u00E1ximo!"), h("div", { key: '97a837a518cc4de92bcec8a6b231b53655174899', class: "options" }, h("label", { key: 'a079f347ff8520b71006321617cf9143f7456bc8' }, h("input", { key: 'aeddb1974329abbd1f8bd3b641445580931e2cff', type: "radio", name: "giftbackOption", value: "use", checked: this.selectedOption === 'use', onChange: () => this.handleOptionChange('use') }), "Usar o meu Giftback"), h("label", { key: '87d2ed1cd59aa6a13acdf4f06737cdc016a90790' }, h("input", { key: '86b4df8c2dc048dd412e5d69fad8bd2f83fc7328', type: "radio", name: "giftbackOption", value: "dontUse", checked: this.selectedOption === 'dontUse', onChange: () => this.handleOptionChange('dontUse') }), "N\u00E3o usar o meu Giftback")), h("div", { key: 'f4c8b2f7e03d02b35ee2be9336d303f5a642cdc7', class: "info-box" }, "O Giftback ser\u00E1 aplicado na pr\u00F3xima etapa.")));
89
95
  }
96
+ static get watchers() { return {
97
+ "bonus": ["changedBonus"]
98
+ }; }
90
99
  };
91
100
  GiftbackInfo.style = GiftbackInfoStyle0;
92
101