crmbonus-component-wake 2.0.97 → 2.0.99

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 (92) hide show
  1. package/dist/cjs/countdown-timer_5.cjs.entry.js +8 -5
  2. package/dist/cjs/countdown-timer_5.cjs.entry.js.map +1 -1
  3. package/dist/cjs/crm-bonus-form.cjs.entry.js +1 -1
  4. package/dist/cjs/crm-bonus.cjs.entry.js +1 -1
  5. package/dist/cjs/crm-giftback-form_2.cjs.entry.js +18 -10
  6. package/dist/cjs/crm-giftback-form_2.cjs.entry.js.map +1 -1
  7. package/dist/cjs/crmbonus-component-wake.cjs.js +1 -1
  8. package/dist/cjs/crmbonus.service-b31b7396.js.map +1 -1
  9. package/dist/cjs/{index-f903012c.js → index-6054ed44.js} +3 -3
  10. package/dist/cjs/index-6054ed44.js.map +1 -0
  11. package/dist/cjs/index.cjs.js +1 -1
  12. package/dist/cjs/loader.cjs.js +1 -1
  13. package/dist/cjs/phone-input-mask.cjs.entry.js +1 -1
  14. package/dist/cjs/{utils-666a842d.js → utils-e9413ee3.js} +4 -3
  15. package/dist/cjs/utils-e9413ee3.js.map +1 -0
  16. package/dist/collection/components/giftback-form/giftback-form.js +18 -10
  17. package/dist/collection/components/giftback-form/giftback-form.js.map +1 -1
  18. package/dist/collection/components/giftback-form/subcomponents/giftback-info/giftback-info.js +9 -5
  19. package/dist/collection/components/giftback-form/subcomponents/giftback-info/giftback-info.js.map +1 -1
  20. package/dist/collection/services/crmbonus.service.js.map +1 -1
  21. package/dist/collection/utils/utils.js +3 -2
  22. package/dist/collection/utils/utils.js.map +1 -1
  23. package/dist/components/crm-bonus-form.js +1 -1
  24. package/dist/components/crm-bonus.js +5 -5
  25. package/dist/components/crm-giftback-form.js +1 -1
  26. package/dist/components/giftback-info.js +1 -1
  27. package/dist/components/index.js +1 -1
  28. package/dist/components/{p-cb164cb2.js → p-3c196b20.js} +22 -14
  29. package/dist/components/p-3c196b20.js.map +1 -0
  30. package/dist/components/{p-f0449fc0.js → p-69799798.js} +2 -2
  31. package/dist/components/{p-f0449fc0.js.map → p-69799798.js.map} +1 -1
  32. package/dist/components/{p-24bdfca4.js → p-7cfea8fe.js} +2 -2
  33. package/dist/components/p-7cfea8fe.js.map +1 -0
  34. package/dist/components/{p-f9381072.js → p-a6fefb58.js} +11 -7
  35. package/dist/components/p-a6fefb58.js.map +1 -0
  36. package/dist/components/{p-d3bfac80.js → p-ba369e65.js} +4 -3
  37. package/dist/components/p-ba369e65.js.map +1 -0
  38. package/dist/components/p-c44e2f02.js.map +1 -1
  39. package/dist/components/{p-3dd9a571.js → p-ffa42f74.js} +2 -2
  40. package/dist/components/{p-3dd9a571.js.map → p-ffa42f74.js.map} +1 -1
  41. package/dist/components/phone-cancel-input.js +1 -1
  42. package/dist/components/phone-form.js +1 -1
  43. package/dist/components/phone-input-mask.js +1 -1
  44. package/dist/components/phone-input.js +1 -1
  45. package/dist/crmbonus-component-wake/crmbonus-component-wake.esm.js +1 -1
  46. package/dist/crmbonus-component-wake/crmbonus-component-wake.esm.js.map +1 -1
  47. package/dist/crmbonus-component-wake/index.esm.js +1 -1
  48. package/dist/crmbonus-component-wake/{p-a5a145b8.entry.js → p-147ba861.entry.js} +2 -2
  49. package/dist/crmbonus-component-wake/p-2833eaeb.entry.js +2 -0
  50. package/dist/crmbonus-component-wake/p-2833eaeb.entry.js.map +1 -0
  51. package/dist/crmbonus-component-wake/{p-e118fc35.entry.js → p-33c1eeca.entry.js} +2 -2
  52. package/dist/crmbonus-component-wake/p-3ccbcc11.entry.js +2 -0
  53. package/dist/crmbonus-component-wake/p-3ccbcc11.entry.js.map +1 -0
  54. package/dist/crmbonus-component-wake/{p-24bdfca4.js → p-7cfea8fe.js} +2 -2
  55. package/dist/crmbonus-component-wake/{p-24bdfca4.js.map → p-7cfea8fe.js.map} +1 -1
  56. package/dist/crmbonus-component-wake/{p-5eddbe5e.entry.js → p-9cd20349.entry.js} +2 -2
  57. package/dist/crmbonus-component-wake/{p-d3bfac80.js → p-ba369e65.js} +2 -2
  58. package/dist/crmbonus-component-wake/p-ba369e65.js.map +1 -0
  59. package/dist/crmbonus-component-wake/p-c44e2f02.js.map +1 -1
  60. package/dist/esm/countdown-timer_5.entry.js +8 -5
  61. package/dist/esm/countdown-timer_5.entry.js.map +1 -1
  62. package/dist/esm/crm-bonus-form.entry.js +1 -1
  63. package/dist/esm/crm-bonus.entry.js +1 -1
  64. package/dist/esm/crm-giftback-form_2.entry.js +18 -10
  65. package/dist/esm/crm-giftback-form_2.entry.js.map +1 -1
  66. package/dist/esm/crmbonus-component-wake.js +1 -1
  67. package/dist/esm/crmbonus.service-774ebe83.js.map +1 -1
  68. package/dist/esm/{index-23a034bf.js → index-5b567099.js} +2 -2
  69. package/dist/esm/index-5b567099.js.map +1 -0
  70. package/dist/esm/index.js +1 -1
  71. package/dist/esm/loader.js +1 -1
  72. package/dist/esm/phone-input-mask.entry.js +1 -1
  73. package/dist/esm/{utils-02d50e38.js → utils-d642b4db.js} +4 -3
  74. package/dist/esm/utils-d642b4db.js.map +1 -0
  75. package/dist/types/components/giftback-form/subcomponents/giftback-info/giftback-info.d.ts +1 -0
  76. package/package.json +1 -1
  77. package/dist/cjs/index-f903012c.js.map +0 -1
  78. package/dist/cjs/utils-666a842d.js.map +0 -1
  79. package/dist/components/p-24bdfca4.js.map +0 -1
  80. package/dist/components/p-cb164cb2.js.map +0 -1
  81. package/dist/components/p-d3bfac80.js.map +0 -1
  82. package/dist/components/p-f9381072.js.map +0 -1
  83. package/dist/crmbonus-component-wake/p-5f8b033a.entry.js +0 -2
  84. package/dist/crmbonus-component-wake/p-5f8b033a.entry.js.map +0 -1
  85. package/dist/crmbonus-component-wake/p-d3bfac80.js.map +0 -1
  86. package/dist/crmbonus-component-wake/p-e37a10a1.entry.js +0 -2
  87. package/dist/crmbonus-component-wake/p-e37a10a1.entry.js.map +0 -1
  88. package/dist/esm/index-23a034bf.js.map +0 -1
  89. package/dist/esm/utils-02d50e38.js.map +0 -1
  90. /package/dist/crmbonus-component-wake/{p-a5a145b8.entry.js.map → p-147ba861.entry.js.map} +0 -0
  91. /package/dist/crmbonus-component-wake/{p-e118fc35.entry.js.map → p-33c1eeca.entry.js.map} +0 -0
  92. /package/dist/crmbonus-component-wake/{p-5eddbe5e.entry.js.map → p-9cd20349.entry.js.map} +0 -0
@@ -14,6 +14,6 @@ var StatusGiftBackProcess;
14
14
  StatusGiftBackProcess["NO_BONUS"] = "no_bonus";
15
15
  })(StatusGiftBackProcess || (StatusGiftBackProcess = {}));
16
16
 
17
- export { MESSAGE_ERROR_INVALID_NUMBER as M, StepFormEnum as S, StatusGiftBackProcess as a };
17
+ export { MESSAGE_ERROR_INVALID_NUMBER as M, StepFormEnum as S };
18
18
 
19
- //# sourceMappingURL=index-23a034bf.js.map
19
+ //# sourceMappingURL=index-5b567099.js.map
@@ -0,0 +1 @@
1
+ {"file":"index-5b567099.js","mappings":"IAAY;AAAZ,WAAY,YAAY;IACpB,yDAAa,CAAA;IACb,2DAAc,CAAA;IACd,uDAAY,CAAA;IACZ,+DAAgB,CAAA;IAChB,2DAAc,CAAA;IACd,iEAAiB,CAAA;AACrB,CAAC,EAPW,YAAY,KAAZ,YAAY,QAOvB;MAEY,4BAA4B,GAAE,kBAAiB;AAG5D,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAC7B,8CAAqB,CAAA;IACrB,8CAAqB,CAAA;AACzB,CAAC,EAHW,qBAAqB,KAArB,qBAAqB;;;;","names":[],"sources":["src/contants/index.ts"],"sourcesContent":["export enum StepFormEnum {\n STEP_NAME = 0,\n STEP_PHONE = 1,\n STEP_PIN = 2,\n STEP_RESERVE = 3,\n STEP_APPLY = 4,\n STEP_NO_BONUS = 5\n}\n\nexport const MESSAGE_ERROR_INVALID_NUMBER= \"Número inválido\"\n\n\nexport enum StatusGiftBackProcess {\n VALIDATE = \"validate\",\n NO_BONUS = \"no_bonus\"\n}"],"version":3}
package/dist/esm/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export { f as format } from './utils-02d50e38.js';
1
+ export { f as format } from './utils-d642b4db.js';
2
2
 
3
3
  //# sourceMappingURL=index.js.map
@@ -5,7 +5,7 @@ import { g as globalScripts } from './app-globals-0f993ce5.js';
5
5
  const defineCustomElements = async (win, options) => {
6
6
  if (typeof window === 'undefined') return undefined;
7
7
  await globalScripts();
8
- return bootstrapLazy([["crm-bonus",[[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],"loading_reprocess":[32],"resetBonus":[64],"reprocess":[64]},null,{"productsInString":["watchProducts"]}]]],["crm-bonus-form",[[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]}]]],["crm-bonus-note",[[0,"crm-bonus-note",{"cartId":[8,"cartid"],"storename":[8],"url":[32],"config":[32],"bonus":[32]}]]],["phone-cancel-input",[[0,"phone-cancel-input",{"sendPin":[16],"loading":[4],"value":[1]}]]],["phone-input",[[0,"phone-input",{"sendPin":[16],"loading":[4],"value":[1]}]]],["app-modal",[[1,"app-modal",{"isOpen":[516,"is-open"],"modalTitle":[1,"modal-title"]}]]],["pedido-finalizado",[[0,"pedido-finalizado",{"cartId":[1,"cartid"],"orderId":[2,"orderid"],"metadadoString":[1,"metadado"]}]]],["crm-button",[[0,"crm-button",{"txtBtn":[1,"txt-btn"],"loading":[4],"handleClick":[16]}]]],["phone-input-mask",[[1,"phone-input-mask",{"initialValue":[1,"initial-value"],"disabled":[4],"phone":[32],"message":[32],"getPhone":[64]}]]],["loading-spinner",[[1,"loading-spinner",{"size":[1],"color":[1]}]]],["countdown-timer_5",[[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]}],[0,"crm-tooltip",{"text":[1],"identity":[1]}]]],["crm-giftback-form_2",[[0,"crm-giftback-form",{"storeName":[8,"storename"],"cartId":[8,"cart-id"],"products":[16],"customer":[16],"loadProducts":[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]}],[4,"loading-container",{"loading":[4]}]]],["giftback-finish_4",[[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"]]]], options);
8
+ return bootstrapLazy([["crm-bonus",[[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],"loading_reprocess":[32],"resetBonus":[64],"reprocess":[64]},null,{"productsInString":["watchProducts"]}]]],["crm-bonus-form",[[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]}]]],["crm-bonus-note",[[0,"crm-bonus-note",{"cartId":[8,"cartid"],"storename":[8],"url":[32],"config":[32],"bonus":[32]}]]],["phone-cancel-input",[[0,"phone-cancel-input",{"sendPin":[16],"loading":[4],"value":[1]}]]],["phone-input",[[0,"phone-input",{"sendPin":[16],"loading":[4],"value":[1]}]]],["app-modal",[[1,"app-modal",{"isOpen":[516,"is-open"],"modalTitle":[1,"modal-title"]}]]],["pedido-finalizado",[[0,"pedido-finalizado",{"cartId":[1,"cartid"],"orderId":[2,"orderid"],"metadadoString":[1,"metadado"]}]]],["crm-button",[[0,"crm-button",{"txtBtn":[1,"txt-btn"],"loading":[4],"handleClick":[16]}]]],["phone-input-mask",[[1,"phone-input-mask",{"initialValue":[1,"initial-value"],"disabled":[4],"phone":[32],"message":[32],"getPhone":[64]}]]],["loading-spinner",[[1,"loading-spinner",{"size":[1],"color":[1]}]]],["countdown-timer_5",[[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],"sliderValuePosition":[32]},null,{"bonus":["changedBonus"]}],[1,"countdown-timer",{"downtime":[16],"counter":[32]}],[0,"crm-tooltip",{"text":[1],"identity":[1]}]]],["crm-giftback-form_2",[[0,"crm-giftback-form",{"storeName":[8,"storename"],"cartId":[8,"cart-id"],"products":[16],"customer":[16],"loadProducts":[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]}],[4,"loading-container",{"loading":[4]}]]],["giftback-finish_4",[[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"]]]], options);
9
9
  };
10
10
 
11
11
  export { defineCustomElements };
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, h } from './index-e8724c8f.js';
2
- import { M as MESSAGE_ERROR_INVALID_NUMBER } from './index-23a034bf.js';
2
+ import { M as MESSAGE_ERROR_INVALID_NUMBER } from './index-5b567099.js';
3
3
 
4
4
  const phoneInputMaskCss = "*{margin:0;padding:0;box-sizing:border-box}.phone{display:block;width:100%;height:24px;padding:6px 12px;font-size:14px;line-height:1.42857143;color:#555;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:0px;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, .075);box-shadow:inset 0 1px 1px rgba(0, 0, 0, .075);-webkit-transition:border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;-o-transition:border-color ease-in-out .15s, box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s, box-shadow ease-in-out .15s}.phone-input-form{width:100%;height:48px;padding:13px 16px 13px 16px;border:1px solid #CCCCCC;font-size:14px}.crm-erro-msg{color:#E11D48;font-size:12px;font-weight:500;margin-top:11px}";
5
5
  const PhoneInputMaskStyle0 = phoneInputMaskCss;
@@ -10,11 +10,12 @@ function defineLimit(remainingGiftback) {
10
10
  function formatDateToBr(dateTime) {
11
11
  // const decodedDateTime = decodeHtmlEntities(dateTime);
12
12
  const [date] = dateTime.split(" ");
13
- if (date.length != 10)
14
- throw new Error("Invalid validateDate");
13
+ if (date.length != 10) {
14
+ return "";
15
+ }
15
16
  return date.split("-").reverse().join("/");
16
17
  }
17
18
 
18
19
  export { formatDateToBr as a, defineLimit as d, format as f };
19
20
 
20
- //# sourceMappingURL=utils-02d50e38.js.map
21
+ //# sourceMappingURL=utils-d642b4db.js.map
@@ -0,0 +1 @@
1
+ {"file":"utils-d642b4db.js","mappings":"SAAgB,MAAM,CAAC,KAAc,EAAE,MAAe,EAAE,IAAa;IACnE,OAAO,CAAC,KAAK,IAAI,EAAE,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,GAAG,IAAI,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;AACjF,CAAC;SAEe,WAAW,CAAC,iBAAyB;IAEnD,OAAO;QACL,iBAAiB,EAAE,iBAAiB,GAAG,CAAC,GAAG,MAAM,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC;QAClG,UAAU,GAAG,iBAAiB,GAAG,CAAC,CAAC;KACpC,CAAA;AACH,CAAC;SAEe,cAAc,CAAC,QAAgB;;IAI7C,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAEnC,IAAI,IAAI,CAAC,MAAM,IAAI,EAAE,EAAE;QACrB,OAAO,EAAE,CAAA;KACV;IAED,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7C;;;;","names":[],"sources":["src/utils/utils.ts"],"sourcesContent":["export function format(first?: string, middle?: string, last?: string): string {\n return (first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : '');\n}\n\nexport function defineLimit(remainingGiftback: number) {\n\n return {\n remainingGiftback: remainingGiftback < 0 ? \"0,00\" : remainingGiftback.toFixed(2).replace(\".\", \",\"),\n isComplete: (remainingGiftback < 0)\n }\n}\n\nexport function formatDateToBr(dateTime: string) {\n\n // const decodedDateTime = decodeHtmlEntities(dateTime);\n\n const [date] = dateTime.split(\" \");\n\n if (date.length != 10) {\n return \"\"\n }\n\n return date.split(\"-\").reverse().join(\"/\");\n}\n\n\n// Decodifica entidades HTML, se houver\nexport const decodeHtmlEntities = (str: string) => {\n const parser = new DOMParser();\n const doc = parser.parseFromString(str, 'text/html');\n\n console.log(\"doc.documentElement\")\n\n return doc.documentElement.textContent || str;\n};\n"],"version":3}
@@ -7,6 +7,7 @@ export declare class GiftbackInfo {
7
7
  reserve: (amountRedeemed: number) => void;
8
8
  cancel: () => void;
9
9
  sliderPosition: number;
10
+ sliderValuePosition: number;
10
11
  changedBonus(): void;
11
12
  private updateBonus;
12
13
  componentWillLoad(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "crmbonus-component-wake",
3
- "version": "2.0.97",
3
+ "version": "2.0.99",
4
4
  "description": "Stencil Component Starter",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -1 +0,0 @@
1
- {"file":"index-f903012c.js","mappings":";;AAAYA;AAAZ,WAAY,YAAY;IACpB,yDAAa,CAAA;IACb,2DAAc,CAAA;IACd,uDAAY,CAAA;IACZ,+DAAgB,CAAA;IAChB,2DAAc,CAAA;IACd,iEAAiB,CAAA;AACrB,CAAC,EAPWA,oBAAY,KAAZA,oBAAY,QAOvB;MAEY,4BAA4B,GAAE,kBAAiB;AAGhDC;AAAZ,WAAY,qBAAqB;IAC7B,8CAAqB,CAAA;IACrB,8CAAqB,CAAA;AACzB,CAAC,EAHWA,6BAAqB,KAArBA,6BAAqB;;;;","names":["StepFormEnum","StatusGiftBackProcess"],"sources":["src/contants/index.ts"],"sourcesContent":["export enum StepFormEnum {\n STEP_NAME = 0,\n STEP_PHONE = 1,\n STEP_PIN = 2,\n STEP_RESERVE = 3,\n STEP_APPLY = 4,\n STEP_NO_BONUS = 5\n}\n\nexport const MESSAGE_ERROR_INVALID_NUMBER= \"Número inválido\"\n\n\nexport enum StatusGiftBackProcess {\n VALIDATE = \"validate\",\n NO_BONUS = \"no_bonus\"\n}"],"version":3}
@@ -1 +0,0 @@
1
- {"file":"utils-666a842d.js","mappings":";;SAAgB,MAAM,CAAC,KAAc,EAAE,MAAe,EAAE,IAAa;IACnE,OAAO,CAAC,KAAK,IAAI,EAAE,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,GAAG,IAAI,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;AACjF,CAAC;SAEe,WAAW,CAAC,iBAAyB;IAEnD,OAAO;QACL,iBAAiB,EAAE,iBAAiB,GAAG,CAAC,GAAG,MAAM,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC;QAClG,UAAU,GAAG,iBAAiB,GAAG,CAAC,CAAC;KACpC,CAAA;AACH,CAAC;SAEe,cAAc,CAAC,QAAgB;;IAI7C,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAEnC,IAAI,IAAI,CAAC,MAAM,IAAI,EAAE;QACnB,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAE1C,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7C;;;;;;","names":[],"sources":["src/utils/utils.ts"],"sourcesContent":["export function format(first?: string, middle?: string, last?: string): string {\n return (first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : '');\n}\n\nexport function defineLimit(remainingGiftback: number) {\n\n return {\n remainingGiftback: remainingGiftback < 0 ? \"0,00\" : remainingGiftback.toFixed(2).replace(\".\", \",\"),\n isComplete: (remainingGiftback < 0)\n }\n}\n\nexport function formatDateToBr(dateTime: string) {\n\n // const decodedDateTime = decodeHtmlEntities(dateTime);\n\n const [date] = dateTime.split(\" \");\n\n if (date.length != 10)\n throw new Error(\"Invalid validateDate\");\n\n return date.split(\"-\").reverse().join(\"/\");\n}\n\n\n// Decodifica entidades HTML, se houver\nexport const decodeHtmlEntities = (str: string) => {\n const parser = new DOMParser();\n const doc = parser.parseFromString(str, 'text/html');\n\n console.log(\"doc.documentElement\")\n\n return doc.documentElement.textContent || str;\n};\n"],"version":3}
@@ -1 +0,0 @@
1
- {"file":"p-24bdfca4.js","mappings":"IAAY;AAAZ,WAAY,YAAY;IACpB,yDAAa,CAAA;IACb,2DAAc,CAAA;IACd,uDAAY,CAAA;IACZ,+DAAgB,CAAA;IAChB,2DAAc,CAAA;IACd,iEAAiB,CAAA;AACrB,CAAC,EAPW,YAAY,KAAZ,YAAY,QAOvB;MAEY,4BAA4B,GAAE,kBAAiB;IAGhD;AAAZ,WAAY,qBAAqB;IAC7B,8CAAqB,CAAA;IACrB,8CAAqB,CAAA;AACzB,CAAC,EAHW,qBAAqB,KAArB,qBAAqB;;;;","names":[],"sources":["src/contants/index.ts"],"sourcesContent":["export enum StepFormEnum {\n STEP_NAME = 0,\n STEP_PHONE = 1,\n STEP_PIN = 2,\n STEP_RESERVE = 3,\n STEP_APPLY = 4,\n STEP_NO_BONUS = 5\n}\n\nexport const MESSAGE_ERROR_INVALID_NUMBER= \"Número inválido\"\n\n\nexport enum StatusGiftBackProcess {\n VALIDATE = \"validate\",\n NO_BONUS = \"no_bonus\"\n}"],"version":3}
@@ -1 +0,0 @@
1
- {"file":"p-cb164cb2.js","mappings":";;;;;;;;;;;;;;;AAAA,MAAM,eAAe,GAAG,i+BAAi+B,CAAC;AAC1/B,8BAAe,eAAe;;MCajB,QAAQ;;;;;QAGX,oBAAe,GAAoB,eAAe,CAAC,WAAW,EAAE,CAAC;;;;;;;uBAS7C,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,CAAC,WAAu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0DAAG,KAAK,EAAC,kBAAkB,IAAE,IAAI,CAAC,MAAM,CAAK,EAC5D,IAAI,CAAC,KAAK,IAAI,0DAAG,KAAK,EAAC,mBAAmB,IAAE,IAAI,CAAC,KAAK,CAAK,CAEnD,EAIX,IAAI,CAAC,IAAI,KAAK,YAAY,CAAC,YAAY;YACvC,sEACE,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,MAAM,EAAE,MAAM,IAAI,CAAC,YAAY,EAAE,EACjC,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,OAAO,EAAE,MAAM,IAAI,CAAC,YAAY,EAAE,GAClC,EAIF,IAAI,CAAC,IAAI,KAAK,YAAY,CAAC,aAAa;aAEtC,4DAAK,KAAK,EAAC,mBAAmB,IAC3BA,QAAO,CAAC,CAAC,CAAC,YAAY,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC,CAC9D,CACP,CAGC,EACP;KACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["i18next"],"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 font-weight: 100;\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 { StatusGiftBackProcess, 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 { USED_KEY, 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 @Prop() loadProducts: () => void;\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(products: IProduct[] = [], hasNewProduct = false) {\n this.sucess = \"\";\n\n console.log('processBonus', [])\n if (hasNewProduct) {\n this.products = products;\n }\n\n const _bonus = localStorage.getItem(getKeyReserveByCartId(this.cartId));\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 const phoneAgain = this.getPhoneNumberAgain();\n\n console.log('phoneAgain', phoneAgain)\n\n if(phoneAgain) {\n this.step = StepFormEnum.STEP_PHONE;\n return\n } \n\n await this.processBonus();\n\n }\n\n getPhoneNumberAgain() {\n const consulta_bonus = localStorage.getItem(getKeyReserveByCartId(this.cartId));\n\n if(!consulta_bonus) return false;\n\n const bonus = JSON.parse(consulta_bonus);\n\n return !bonus.hasBonus;\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.customer?.name, this.storeName);\n\n if (localStorage.getItem(`bc:${this.phone}`)) {\n await this.validateBonus(\"2018\");\n this.step = StepFormEnum.STEP_RESERVE;\n } else {\n this.step = StepFormEnum.STEP_PIN;\n }\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 console.log('this.phone', this.phone)\n\n this.loadProducts();\n\n const used_or_no = localStorage.getItem(USED_KEY);\n\n if (used_or_no == \"dontUse\") {\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.convertStringToNumber(),\n storeId: this.pinInfo.storeId.toString(),\n userId: this.pinInfo.userId.toString(),\n checkoutId: this.cartId,\n checkoutProducts: this.products,\n name: this.customer?.name,\n storeName: this.storeName\n }\n\n try {\n this.bonus = await this.crmBonusService.validatePinBonus(payload);\n\n if (!this.bonus.hasBonus) {\n\n localStorage.setItem(getKeyReserveByCartId(this.cartId), JSON.stringify({ ...this.bonus, phone: this.phone }));\n\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 localStorage.setItem(`bc:${this.phone}`, StatusGiftBackProcess.VALIDATE)\n\n localStorage.setItem(USED_KEY, \"use\");\n localStorage.setItem(this.cartId, this.bonus.bonusBalance.toString());\n\n this.step = StepFormEnum.STEP_RESERVE;\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\n localStorage.setItem(USED_KEY, \"dontUse\");\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\n {/* <loading-container /> */}\n\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={() => this.processBonus()}\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}
@@ -1 +0,0 @@
1
- {"file":"p-d3bfac80.js","mappings":"SAAgB,MAAM,CAAC,KAAc,EAAE,MAAe,EAAE,IAAa;IACnE,OAAO,CAAC,KAAK,IAAI,EAAE,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,GAAG,IAAI,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;AACjF,CAAC;SAEe,WAAW,CAAC,iBAAyB;IAEnD,OAAO;QACL,iBAAiB,EAAE,iBAAiB,GAAG,CAAC,GAAG,MAAM,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC;QAClG,UAAU,GAAG,iBAAiB,GAAG,CAAC,CAAC;KACpC,CAAA;AACH,CAAC;SAEe,cAAc,CAAC,QAAgB;;IAI7C,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAEnC,IAAI,IAAI,CAAC,MAAM,IAAI,EAAE;QACnB,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAE1C,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7C;;;;","names":[],"sources":["src/utils/utils.ts"],"sourcesContent":["export function format(first?: string, middle?: string, last?: string): string {\n return (first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : '');\n}\n\nexport function defineLimit(remainingGiftback: number) {\n\n return {\n remainingGiftback: remainingGiftback < 0 ? \"0,00\" : remainingGiftback.toFixed(2).replace(\".\", \",\"),\n isComplete: (remainingGiftback < 0)\n }\n}\n\nexport function formatDateToBr(dateTime: string) {\n\n // const decodedDateTime = decodeHtmlEntities(dateTime);\n\n const [date] = dateTime.split(\" \");\n\n if (date.length != 10)\n throw new Error(\"Invalid validateDate\");\n\n return date.split(\"-\").reverse().join(\"/\");\n}\n\n\n// Decodifica entidades HTML, se houver\nexport const decodeHtmlEntities = (str: string) => {\n const parser = new DOMParser();\n const doc = parser.parseFromString(str, 'text/html');\n\n console.log(\"doc.documentElement\")\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AC,KAAK,EACX,OAAO,EAAE,IAAI,CAAC,cAAc,KAAK,KAAK,EACtC,QAAQ,EAAE,MAAM,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,GAChD,EACF,kFAA0B,CACxB,EACN,4DAAK,KAAK,EAAC,gBAAgB,IACvB,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,EACF,2FAA8B,CAC5B,CACJ,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 {\n display: flex;\n align-items: center;\n gap: 5px;\n margin: 0 0 10px 0;\n}\n\n.container-description p {\n font-size: 14px;\n font-weight: 400;\n margin: 0px;\n}\n\n\np {\n font-size: 14px;\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 0px 3px 3px;\n}\n\n/* input[type='range']::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 16px;\n height: 16px;\n background: var(--text-color);\n border-radius: 50%;\n cursor: pointer;\n} */\n\ninput[type=\"range\"]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 20px;\n height: 20px;\n background: rgb(109, 109, 95);\n /* Cor do botão */\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: flex;\n margin: 0px 0;\n font-size: 0.9rem;\n color: #333;\n align-items: center;\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}\n\n.options-option {\n display: flex;\n}\n\n\n/* ########################################## */\n","import { Component, Prop, State, Watch, h } from \"@stencil/core\";\nimport { IBonus } from \"../../../../dto/validate.pin.bonus\";\n\nimport i18next from '../../../../i18n/i18n'\nimport { USED_KEY } from \"../../../../utils/keys.storage\";\nimport { defineLimit, formatDateToBr } from \"../../../../utils/utils\";\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 = 0;\n\n @Watch(\"bonus\")\n changedBonus() {\n this.updateBonus()\n }\n\n private updateBonus() {\n this.usedValue = this.bonus.bonusBalance;\n this.buildPositionSlider(0, this.bonus.totalBonus);\n }\n\n componentWillLoad() {\n this.updateBonus();\n this.selectedOption = localStorage.getItem(USED_KEY);\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 componentDidLoad() {\n const input: any = document.getElementById(\"position_value_id\")\n\n input.value = this.bonus.bonusBalance;\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\n localStorage.setItem(USED_KEY, 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\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 const limit = defineLimit(remainingGiftback)\n return (\n\n <div class=\"giftback-container\">\n <div class=\"container-description\">\n <p innerHTML={translateDescription}></p>\n <crm-tooltip identity=\"crm-role-description\" text={i18next.t(\"labelUseGiftback\", { minimumPurchase: this.bonus.minimumPurchase, expírationDate: formatDateToBr(this.bonus.firstValidityDate) })} />\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 >\n R$ {this.usedValue.toFixed(2).replace(\".\", \",\")}\n </div>\n <input\n id=\"position_value_id\"\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\n {\n limit.isComplete && (\n <p>\n {i18next.t(\"maxAmount\")}\n </p>\n )\n }\n\n {\n !limit.isComplete && (\n <div class=\"container-description\">\n <p>\n Adicione <strong>R$ {remainingGiftback < 0 ? \"0,00\" : remainingGiftback.toFixed(2).replace(\".\", \",\")}</strong> ao carrinho para atingir o valor\n máximo! <crm-tooltip identity=\"crm-max-description\" text={i18next.t(\"labelamountPartial\")} />\n </p>\n </div>\n )\n }\n\n\n <div class=\"options\">\n <div class=\"options-option\">\n <input\n type=\"radio\"\n name=\"giftbackOption\"\n value=\"use\"\n checked={this.selectedOption === 'use'}\n onChange={() => this.handleOptionChange('use')}\n />\n <p>Usar o meu Giftback</p>\n </div>\n <div class=\"options-option\">\n <input\n type=\"radio\"\n name=\"giftbackOption\"\n value=\"dontUse\"\n checked={this.selectedOption === 'dontUse'}\n onChange={() => this.handleOptionChange('dontUse')}\n />\n <p>Não usar o meu Giftback</p>\n </div>\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 +0,0 @@
1
- import{r as e,h as i,H as t}from"./p-3d6152b1.js";import{i as n}from"./p-e8c19a64.js";import{U as o}from"./p-f9aeffc1.js";import{d as a,a as c}from"./p-d3bfac80.js";const r=class{constructor(i){e(this,i);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 i("label",{key:"6313656b73bec34e3e4e5099c2bd7633e025588e"},this.counter,"s")}};const s="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPg0KPHN2ZyB3aWR0aD0iODAwcHgiIGhlaWdodD0iODAwcHgiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCjxwYXRoIGQ9Ik0xMiAxNy43NUMxMi40MTQyIDE3Ljc1IDEyLjc1IDE3LjQxNDIgMTIuNzUgMTdWMTFDMTIuNzUgMTAuNTg1OCAxMi40MTQyIDEwLjI1IDEyIDEwLjI1QzExLjU4NTggMTAuMjUgMTEuMjUgMTAuNTg1OCAxMS4yNSAxMVYxN0MxMS4yNSAxNy40MTQyIDExLjU4NTggMTcuNzUgMTIgMTcuNzVaIiBmaWxsPSIjMUMyNzRDIi8+DQo8cGF0aCBkPSJNMTIgN0MxMi41NTIzIDcgMTMgNy40NDc3MiAxMyA4QzEzIDguNTUyMjggMTIuNTUyMyA5IDEyIDlDMTEuNDQ3NyA5IDExIDguNTUyMjggMTEgOEMxMSA3LjQ0NzcyIDExLjQ0NzcgNyAxMiA3WiIgZmlsbD0iIzFDMjc0QyIvPg0KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xLjI1IDEyQzEuMjUgNi4wNjI5NCA2LjA2Mjk0IDEuMjUgMTIgMS4yNUMxNy45MzcxIDEuMjUgMjIuNzUgNi4wNjI5NCAyMi43NSAxMkMyMi43NSAxNy45MzcxIDE3LjkzNzEgMjIuNzUgMTIgMjIuNzVDNi4wNjI5NCAyMi43NSAxLjI1IDE3LjkzNzEgMS4yNSAxMlpNMTIgMi43NUM2Ljg5MTM3IDIuNzUgMi43NSA2Ljg5MTM3IDIuNzUgMTJDMi43NSAxNy4xMDg2IDYuODkxMzcgMjEuMjUgMTIgMjEuMjVDMTcuMTA4NiAyMS4yNSAyMS4yNSAxNy4xMDg2IDIxLjI1IDEyQzIxLjI1IDYuODkxMzcgMTcuMTA4NiAyLjc1IDEyIDIuNzVaIiBmaWxsPSIjMUMyNzRDIi8+DQo8L3N2Zz4=";const d=".crm-tooltip-container {\n display: flex;\n\n & img {\n width: 16px;\n margin-left: 3px;\n position: relative;\n }\n}\n\n.crm-tooltip {\n position: relative;\n display: inline-block;\n}\n\n.crm-tooltip .tooltiptext {\n visibility: hidden;\n background-color: black;\n color: #fff;\n text-align: center;\n padding: 8px 12px;\n border-radius: 0px;\n position: absolute;\n z-index: 1;\n min-width: 271px;\n top: 100%;\n left: 50%;\n margin-left: -238px;\n}\n\n@container (max-width: 410px) {\n .crm-tooltip .tooltiptext {\n margin-left: -14px;\n }\n\n .crm-tooltip #crm-role-description {\n margin-left: -151px;\n }\n}\n\n@container (max-width: 250px) {\n .crm-tooltip .tooltiptext {\n margin-left: -201px;\n }\n}\n\n.crm-tooltip:hover .tooltiptext {\n visibility: visible;\n}";const p=d;const l=class{constructor(i){e(this,i);this.text=undefined;this.identity=undefined}render(){return i("div",{key:"8d7de09a39f9f3412c5ee51e884a9900f65ad261",class:"crm-tooltip-container crm-tooltip"},i("img",{key:"7605616f8135d1009a4c8f6a272cedfd66f10b88",src:s}),i("span",{key:"5b7b384d39f5c6b4d733ad129bd99ba8670bde8e",id:this.identity,class:"tooltiptext"},this.text))}};l.style=p;const f=":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{display:flex;align-items:center;gap:5px;margin:0 0 10px 0}.container-description p{font-size:14px;font-weight:400;margin:0px}p{font-size:14px;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 0px 3px 3px}input[type=\"range\"]::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:20px;height:20px;background:rgb(109, 109, 95);border-radius:50%;cursor:pointer}.options{margin:0px 0;display:flex;gap:10px;flex-direction:column}.options label{display:flex;margin:0px 0;font-size:0.9rem;color:#333;align-items:center}.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;}.options-option{display:flex}";const b=f;const h=class{constructor(i){e(this,i);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=0}changedBonus(){this.updateBonus()}updateBonus(){this.usedValue=this.bonus.bonusBalance;this.buildPositionSlider(0,this.bonus.totalBonus)}componentWillLoad(){this.updateBonus();this.selectedOption=localStorage.getItem(o)}handleSliderChange(e){const i=e.target;this.usedValue=parseFloat(i.value);this.buildPositionSlider(parseFloat(i.min),parseFloat(i.max))}componentDidLoad(){const e=document.getElementById("position_value_id");e.value=this.bonus.bonusBalance}buildPositionSlider(e,i){const t=(this.usedValue-e)/(i-e)*100;this.sliderPosition=t}async handleOptionChange(e){this.selectedOption=e;localStorage.setItem(o,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 t=n.t("giftDescription",{amount:`${this.bonus.totalBonus.toFixed(2).replace(".",",")}`,custom_name:"Giftback"});const o=a(e);return i("div",{key:"06bd5fda8f1b1dff75d27133fb27a222ea79475d",class:"giftback-container"},i("div",{key:"e770facaaf3c938dda000885ef42fe30f4b88eaf",class:"container-description"},i("p",{key:"7d7aa390bb8f2c7a1973b38f0071522e7943af47",innerHTML:t}),i("crm-tooltip",{key:"f209c195a0fcd7c4bec0b6227549ba139c41f637",identity:"crm-role-description",text:n.t("labelUseGiftback",{minimumPurchase:this.bonus.minimumPurchase,expírationDate:c(this.bonus.firstValidityDate)})})),i("div",{key:"6160a64dd8a3eea3b1f554349c2d6d0fc7113641",class:"slider-wrapper"},i("div",{key:"e3ca74f1b47613bd0b05339bd2856a942172cb0f",class:"slider-value",style:{left:`calc(${this.sliderPosition}% - 20px)`}},"R$ ",this.usedValue.toFixed(2).replace(".",",")),i("input",{key:"e748d506d25076173a1da4ae02a4869969228e16",id:"position_value_id",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}%)`}})),o.isComplete&&i("p",{key:"49b1525e9e04c7fc08db78a9c999540fdd0df6ea"},n.t("maxAmount")),!o.isComplete&&i("div",{key:"771cdc242af285229b6d23fd9738627f2e419385",class:"container-description"},i("p",{key:"43dca214826cb8dc2a292400c5b02f40e7ce620a"},"Adicione ",i("strong",{key:"3ffbe7777e5e3be5283012de568eddfe3ff1b23d"},"R$ ",e<0?"0,00":e.toFixed(2).replace(".",","))," ao carrinho para atingir o valor máximo! ",i("crm-tooltip",{key:"71bae07de4470c5f9234e74a632713803cda2d7e",identity:"crm-max-description",text:n.t("labelamountPartial")}))),i("div",{key:"23c5cbcea13c5cad47384815b6277fced7529f84",class:"options"},i("div",{key:"5212788f1c1c258324ba83057c60fd0ecb76e29c",class:"options-option"},i("input",{key:"14bf5fceb36b5b9db660e5e067e1ed9c89d31b81",type:"radio",name:"giftbackOption",value:"use",checked:this.selectedOption==="use",onChange:()=>this.handleOptionChange("use")}),i("p",{key:"487dc829efdca6754c967fcc85c58cb2cb7c63e1"},"Usar o meu Giftback")),i("div",{key:"d90651744aa5d3904b61be7d4adc1ec49e3c6676",class:"options-option"},i("input",{key:"4ed8e68cfd86b871668e9de19d4c5420487f4e52",type:"radio",name:"giftbackOption",value:"dontUse",checked:this.selectedOption==="dontUse",onChange:()=>this.handleOptionChange("dontUse")}),i("p",{key:"344fbf40dadc0ef4e3a870e5251a1beb3b5ffd27"},"Não usar o meu Giftback"))),i("div",{key:"3b9a91dad6803aac48b96100c2bbded009677aa1",class:"info-box"},"O Giftback será aplicado na próxima etapa."))}static get watchers(){return{bonus:["changedBonus"]}}};h.style=b;const x="*{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);font-weight:100}.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 g=x;const m=class{constructor(i){e(this,i);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 i(t,{key:"d41578c99f54f76083ad62b2d3e53b969f51c323",class:"crm-phone-form"},i("label",{key:"2c615b13f79cfed14b8c14b713216b5d53e05769",class:"crm-subtitle"},"Digite o seu celular para verificar se há desconto disponível nessa compra:"),i("phone-input-mask",{key:"05383570a3518ef1ae3d0085f8411662eb719486",initialValue:this.value,ref:e=>this.phoneInputMask=e}),i("crm-button",{key:"90289afc0783e5f78a8091c7f53c657721f13641",txtBtn:((e=this.config)===null||e===void 0?void 0:e.btnApplyBonusLabel)||"Avançar",loading:this.loading,handleClick:()=>this.handlePhone()}))}};m.style=g;const u=":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}.pin-container input{width:100%;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 y=u;const k="*{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);font-weight:100}.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 M=k;const I=class{constructor(i){e(this,i);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,i){const t=e.target;const n=t.value.slice(0,1);this.pin[i]=n;if(n&&i<this.pin.length-1){const e=t.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 i("div",{key:"4feca5ebbdcba078f526bcbbb1e8f59cd9f69d2f",class:"crm-phone-form"},i("label",{key:"51653ca43a050fd67dfba6a8525bfe3791076cff",class:"crm-subtitle"},n.t("pin-sutitle")," ",i("strong",{key:"8a47e532dc3bd566d23057e675261b50c97442c8"},"+55 ",this.phone)),i("div",{key:"eb367b999bb7c491e9cc792b8ea279bff71de435",class:"pin-container"},this.pin.map(((e,t)=>i("input",{type:"text",maxLength:1,value:this.pin[t],onInput:e=>this.handleInput(e,t)})))),i("slot",{key:"377bc33633df2c82ab1970c88e20bdbd9181d525"}),i("p",{key:"96769dc2bac4842ed9e259735381f25451bbe77d",class:"crm-description"}," Não recebeu?",!this.canResend&&i("label",{key:"9c3f25a357ae41aef6c16b11598a1cbd9ea32982"}," Reenviar em ",i("countdown-timer",{key:"a7a98f65cdcf0a88df4ce2f98d8694b0cf5c974c",downtime:()=>this.handleTimeout()})," "),this.canResend&&i("div",{key:"178c9b536d81f49d10240c55edfbe7dbb02076bb"},i("a",{key:"8b07796bd9a3349cdf994ccd963fe4333466eb22",onClick:()=>this.handleResend()},"Reenviar"),i("a",{key:"59289faea47104ec3ebc9818a43dbd205fc0a2bf",onClick:()=>this.cancel()},"Trocar número"))),i("crm-button",{key:"feecbd5c1681ae1adb8bd9ca8ba01b96252f6c5c",txtBtn:((e=this.config)===null||e===void 0?void 0:e.btnApplyBonusLabel)||"Avançar",loading:this.loading,handleClick:()=>this.validatePin()}))}};I.style=y+M;export{r as countdown_timer,l as crm_tooltip,h as giftback_info,m as phone_form,I as pin_form};
2
- //# sourceMappingURL=p-5f8b033a.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["CountdownTimer","componentWillLoad","this","intervalId","setInterval","counter","clearInterval","downtime","disconnectedCallback","render","h","key","infoCircleSvgrepoComSvg","crmTooltipCss","CrmTooltipStyle0","Tooltip","class","src","info","id","identity","text","giftbackInfoCss","GiftbackInfoStyle0","GiftbackInfo","totalBonus","cartId","minimumPurchase","bonusBalance","calculatedValue","firstValidityDate","totalValue","changedBonus","updateBonus","usedValue","bonus","buildPositionSlider","selectedOption","localStorage","getItem","USED_KEY","handleSliderChange","event","input","target","parseFloat","value","min","max","componentDidLoad","document","getElementById","percentage","sliderPosition","handleOptionChange","option","setItem","reserve","cancel","remainingGiftback","translateDescription","i18next","t","amount","toFixed","replace","custom_name","limit","defineLimit","innerHTML","formatDateToBr","style","left","disabled","type","step","onInput","background","isComplete","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/assets/svg/info-circle-svgrepo-com.svg","src/components/tooltip/crm-tooltip.css?tag=crm-tooltip","src/components/tooltip/tooltip.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","<?xml version=\"1.0\" encoding=\"utf-8\"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->\r\n<svg width=\"800px\" height=\"800px\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\r\n<path d=\"M12 17.75C12.4142 17.75 12.75 17.4142 12.75 17V11C12.75 10.5858 12.4142 10.25 12 10.25C11.5858 10.25 11.25 10.5858 11.25 11V17C11.25 17.4142 11.5858 17.75 12 17.75Z\" fill=\"#1C274C\"/>\r\n<path d=\"M12 7C12.5523 7 13 7.44772 13 8C13 8.55228 12.5523 9 12 9C11.4477 9 11 8.55228 11 8C11 7.44772 11.4477 7 12 7Z\" fill=\"#1C274C\"/>\r\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M1.25 12C1.25 6.06294 6.06294 1.25 12 1.25C17.9371 1.25 22.75 6.06294 22.75 12C22.75 17.9371 17.9371 22.75 12 22.75C6.06294 22.75 1.25 17.9371 1.25 12ZM12 2.75C6.89137 2.75 2.75 6.89137 2.75 12C2.75 17.1086 6.89137 21.25 12 21.25C17.1086 21.25 21.25 17.1086 21.25 12C21.25 6.89137 17.1086 2.75 12 2.75Z\" fill=\"#1C274C\"/>\r\n</svg>",".crm-tooltip-container {\n display: flex;\n\n & img {\n width: 16px;\n margin-left: 3px;\n position: relative;\n }\n}\n\n.crm-tooltip {\n position: relative;\n display: inline-block;\n}\n\n.crm-tooltip .tooltiptext {\n visibility: hidden;\n background-color: black;\n color: #fff;\n text-align: center;\n padding: 8px 12px;\n border-radius: 0px;\n position: absolute;\n z-index: 1;\n min-width: 271px;\n top: 100%;\n left: 50%;\n margin-left: -238px;\n}\n\n@container (max-width: 410px) {\n .crm-tooltip .tooltiptext {\n margin-left: -14px;\n }\n\n .crm-tooltip #crm-role-description {\n margin-left: -151px;\n }\n}\n\n@container (max-width: 250px) {\n .crm-tooltip .tooltiptext {\n margin-left: -201px;\n }\n}\n\n.crm-tooltip:hover .tooltiptext {\n visibility: visible;\n}","import { Component, h, Prop } from \"@stencil/core\";\nimport info from '../../assets/svg/info-circle-svgrepo-com.svg';\n\n\n@Component({\n tag: 'crm-tooltip',\n styleUrl: 'crm-tooltip.css'\n})\nexport class Tooltip {\n\n @Prop() text: string;\n @Prop() identity: string;\n\n render() {\n return (\n <div class=\"crm-tooltip-container crm-tooltip\">\n <img src={info} />\n <span id={this.identity} class=\"tooltiptext\">{this.text}</span>\n </div>\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 {\n display: flex;\n align-items: center;\n gap: 5px;\n margin: 0 0 10px 0;\n}\n\n.container-description p {\n font-size: 14px;\n font-weight: 400;\n margin: 0px;\n}\n\n\np {\n font-size: 14px;\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 0px 3px 3px;\n}\n\n/* input[type='range']::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 16px;\n height: 16px;\n background: var(--text-color);\n border-radius: 50%;\n cursor: pointer;\n} */\n\ninput[type=\"range\"]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 20px;\n height: 20px;\n background: rgb(109, 109, 95);\n /* Cor do botão */\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: flex;\n margin: 0px 0;\n font-size: 0.9rem;\n color: #333;\n align-items: center;\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}\n\n.options-option {\n display: flex;\n}\n\n\n/* ########################################## */\n","import { Component, Prop, State, Watch, h } from \"@stencil/core\";\nimport { IBonus } from \"../../../../dto/validate.pin.bonus\";\n\nimport i18next from '../../../../i18n/i18n'\nimport { USED_KEY } from \"../../../../utils/keys.storage\";\nimport { defineLimit, formatDateToBr } from \"../../../../utils/utils\";\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 = 0;\n\n @Watch(\"bonus\")\n changedBonus() {\n this.updateBonus()\n }\n\n private updateBonus() {\n this.usedValue = this.bonus.bonusBalance;\n this.buildPositionSlider(0, this.bonus.totalBonus);\n }\n\n componentWillLoad() {\n this.updateBonus();\n this.selectedOption = localStorage.getItem(USED_KEY);\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 componentDidLoad() {\n const input: any = document.getElementById(\"position_value_id\")\n\n input.value = this.bonus.bonusBalance;\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\n localStorage.setItem(USED_KEY, 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\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 const limit = defineLimit(remainingGiftback)\n return (\n\n <div class=\"giftback-container\">\n <div class=\"container-description\">\n <p innerHTML={translateDescription}></p>\n <crm-tooltip identity=\"crm-role-description\" text={i18next.t(\"labelUseGiftback\", { minimumPurchase: this.bonus.minimumPurchase, expírationDate: formatDateToBr(this.bonus.firstValidityDate) })} />\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 >\n R$ {this.usedValue.toFixed(2).replace(\".\", \",\")}\n </div>\n <input\n id=\"position_value_id\"\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\n {\n limit.isComplete && (\n <p>\n {i18next.t(\"maxAmount\")}\n </p>\n )\n }\n\n {\n !limit.isComplete && (\n <div class=\"container-description\">\n <p>\n Adicione <strong>R$ {remainingGiftback < 0 ? \"0,00\" : remainingGiftback.toFixed(2).replace(\".\", \",\")}</strong> ao carrinho para atingir o valor\n máximo! <crm-tooltip identity=\"crm-max-description\" text={i18next.t(\"labelamountPartial\")} />\n </p>\n </div>\n )\n }\n\n\n <div class=\"options\">\n <div class=\"options-option\">\n <input\n type=\"radio\"\n name=\"giftbackOption\"\n value=\"use\"\n checked={this.selectedOption === 'use'}\n onChange={() => this.handleOptionChange('use')}\n />\n <p>Usar o meu Giftback</p>\n </div>\n <div class=\"options-option\">\n <input\n type=\"radio\"\n name=\"giftbackOption\"\n value=\"dontUse\"\n checked={this.selectedOption === 'dontUse'}\n onChange={() => this.handleOptionChange('dontUse')}\n />\n <p>Não usar o meu Giftback</p>\n </div>\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 font-weight: 100;\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\n.pin-container input {\n width: 100%;\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 font-weight: 100;\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":"2KAMaA,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,EAA0B,yvCCAhC,MAAMC,EAAgB,03BACtB,MAAAC,EAAeD,E,MCOFE,EAAO,M,qEAKhB,MAAAN,GACI,OACIC,EAAA,OAAAC,IAAA,2CAAKK,MAAM,qCACPN,EAAA,OAAAC,IAAA,2CAAKM,IAAKC,IACVR,EAAA,QAAAC,IAAA,2CAAMQ,GAAIjB,KAAKkB,SAAUJ,MAAM,eAAed,KAAKmB,M,aCjBnE,MAAMC,EAAkB,m7DACxB,MAAAC,EAAeD,E,MC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K6F,UAAM,MAAAD,SAAA,SAAAA,EAAEE,qBAAsB,UAAWC,QAAS/F,KAAK+F,QAASC,YAAa,IAAMhG,KAAK8G,gB","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["format","first","middle","last","defineLimit","remainingGiftback","toFixed","replace","isComplete","formatDateToBr","dateTime","date","split","length","Error","reverse","join"],"sources":["src/utils/utils.ts"],"sourcesContent":["export function format(first?: string, middle?: string, last?: string): string {\n return (first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : '');\n}\n\nexport function defineLimit(remainingGiftback: number) {\n\n return {\n remainingGiftback: remainingGiftback < 0 ? \"0,00\" : remainingGiftback.toFixed(2).replace(\".\", \",\"),\n isComplete: (remainingGiftback < 0)\n }\n}\n\nexport function formatDateToBr(dateTime: string) {\n\n // const decodedDateTime = decodeHtmlEntities(dateTime);\n\n const [date] = dateTime.split(\" \");\n\n if (date.length != 10)\n throw new Error(\"Invalid validateDate\");\n\n return date.split(\"-\").reverse().join(\"/\");\n}\n\n\n// Decodifica entidades HTML, se houver\nexport const decodeHtmlEntities = (str: string) => {\n const parser = new DOMParser();\n const doc = parser.parseFromString(str, 'text/html');\n\n console.log(\"doc.documentElement\")\n\n return doc.documentElement.textContent || str;\n};\n"],"mappings":"SAAgBA,EAAOC,EAAgBC,EAAiBC,GACtD,OAAQF,GAAS,KAAOC,EAAS,IAAIA,IAAW,KAAOC,EAAO,IAAIA,IAAS,GAC7E,C,SAEgBC,EAAYC,GAE1B,MAAO,CACLA,kBAAmBA,EAAoB,EAAI,OAASA,EAAkBC,QAAQ,GAAGC,QAAQ,IAAK,KAC9FC,WAAaH,EAAoB,EAErC,C,SAEgBI,EAAeC,GAI7B,MAAOC,GAAQD,EAASE,MAAM,KAE9B,GAAID,EAAKE,QAAU,GACjB,MAAM,IAAIC,MAAM,wBAElB,OAAOH,EAAKC,MAAM,KAAKG,UAAUC,KAAK,IACxC,Q","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- import{r as t,h as i}from"./p-3d6152b1.js";import{C as e}from"./p-c44e2f02.js";import{S as s,a as o}from"./p-24bdfca4.js";import{g as n}from"./p-75ba7b9a.js";import{i as a}from"./p-e8c19a64.js";import{g as r,U as c}from"./p-f9aeffc1.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);font-weight:100}.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=h;const l=class{constructor(i){t(this,i);this.crmBonusService=e.getInstance();this.storeName=undefined;this.cartId=undefined;this.products=undefined;this.customer=undefined;this.loadProducts=undefined;this.value=undefined;this.loading=false;this.message=undefined;this.phone=undefined;this.pinInfo=undefined;this.step=s.STEP_PHONE;this.bonus=undefined;this.sucess="";this.error="";this.config=undefined;this.hasApplyBonus=false}async setStep(t){this.step=t}async processBonus(t=[],i=false){this.sucess="";console.log("processBonus",[]);if(i){this.products=t}const e=localStorage.getItem(r(this.cartId));if(e){const t=JSON.parse(e);this.bonus=t;this.phone=t.phone;this.pinInfo={storeId:t.storeId,userId:t.userId};await this.validateBonus("2018")}}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=n(this.storeName);const t=this.getPhoneNumberAgain();console.log("phoneAgain",t);if(t){this.step=s.STEP_PHONE;return}await this.processBonus()}getPhoneNumberAgain(){const t=localStorage.getItem(r(this.cartId));if(!t)return false;const i=JSON.parse(t);return!i.hasBonus}convertStringToNumber(){const t=this.phone.replace(/\D/g,"");return Number(t)}async sendPin(){var t,i,e;this.loading=true;this.message="";this.sucess="";this.error="";try{const i=this.convertStringToNumber();this.pinInfo=await this.crmBonusService.sendPin(i,(t=this.customer)===null||t===void 0?void 0:t.name,this.storeName);if(localStorage.getItem(`bc:${this.phone}`)){await this.validateBonus("2018");this.step=s.STEP_RESERVE}else{this.step=s.STEP_PIN}}catch(t){this.message=(e=(i=t===null||t===void 0?void 0:t.response)===null||i===void 0?void 0:i.data)===null||e===void 0?void 0:e.message}finally{this.loading=false}}changePhone(){this.sucess="";this.error="";this.step=s.STEP_PHONE}async validateBonus(t){var i,e,n;console.log("this.phone",this.phone);this.loadProducts();const a=localStorage.getItem(c);if(a=="dontUse"){this.step=s.STEP_RESERVE;return}this.loading=true;this.sucess="";this.error="";const h={pin:t,cellphone:this.convertStringToNumber(),storeId:this.pinInfo.storeId.toString(),userId:this.pinInfo.userId.toString(),checkoutId:this.cartId,checkoutProducts:this.products,name:(i=this.customer)===null||i===void 0?void 0:i.name,storeName:this.storeName};try{this.bonus=await this.crmBonusService.validatePinBonus(h);if(!this.bonus.hasBonus){localStorage.setItem(r(this.cartId),JSON.stringify(Object.assign(Object.assign({},this.bonus),{phone:this.phone})));this.loading=false;this.step=s.STEP_NO_BONUS;return}this.sucess="Código validado com sucesso!";localStorage.setItem(r(this.cartId),JSON.stringify(Object.assign(Object.assign({},this.bonus),{phone:this.phone})));localStorage.setItem(`bc:${this.phone}`,o.VALIDATE);localStorage.setItem(c,"use");localStorage.setItem(this.cartId,this.bonus.bonusBalance.toString());this.step=s.STEP_RESERVE}catch(t){const i=(n=(e=t===null||t===void 0?void 0:t.response)===null||e===void 0?void 0:e.data)===null||n===void 0?void 0:n.message;if(i.includes("Pin")){this.error="Código inválido!"}else{this.error=i;this.step=s.STEP_NO_BONUS}}finally{this.loading=false}}handleCancel(){this.cancel()}async cancel(){this.message="";this.loading=true;try{await this.crmBonusService.cancel(this.cartId);localStorage.setItem(c,"dontUse");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=s.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:"778583d054357862ca4ad6a1bd524c409b430911",class:"crm-container-form fbits-responsive-carrinho-desconto"},i("label",{key:"ae1c6c8afbf88d07bb526b0a158916e7ec0014d3",class:"crm-title"},this.config.giftbackTitle),this.step===s.STEP_PHONE&&i("phone-form",{key:"31bf9898b1fdb575ed560aa13b73ec9fd9a5537c",value:this.customer.phone,config:this.config,loading:this.loading,handlerSubmit:t=>this.handleSendPin(t)}),this.step===s.STEP_PIN&&i("pin-form",{key:"55812e5fa6d92c280d65c8f67c45242ca364ac27",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:"cac22336738f13aa8e9ae046786e5a94546677f8",class:"crm-message-info"},this.sucess),this.error&&i("p",{key:"d774390972549f09cf11283521729af42b9d56c8",class:"crm-message-error"},this.error)),this.step===s.STEP_RESERVE&&i("giftback-info",{key:"b42c9837a08e2061e03a484fd897f7e8801f0390",loading:this.loading,cancel:()=>this.handleCancel(),bonus:this.bonus,reserve:()=>this.processBonus()}),this.step===s.STEP_NO_BONUS&&i("div",{key:"f18f039e27fec65525bb7e19ed230718bf8213a6",class:"container-message"},a.t("noGiftback",{storename:this.config.giftbackTitle})))}};l.style=d;const f=".loading-container{position:absolute;top:0;left:0;width:100%;height:100%;background-color:rgba(0, 0, 0, 0.5);display:flex;justify-content:center;align-items:center;z-index:1000;}.loading-spinner{width:50px;height:50px;border:5px solid rgba(255, 255, 255, 0.3);border-top:5px solid white;border-radius:50%;animation:spin 1s linear infinite;}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.relative-xy{position:relative}";const m=f;const p=class{constructor(i){t(this,i);this.loading=true}render(){return i("div",{key:"59fbac8fdb07e1c4a917c9b8ece68d372e8e12e6",class:"relative-xy"},this.loading&&i("div",{key:"7fad2fc77bab910ce3138cd7082cdfcfd63e046a",class:"loading-container"},i("div",{key:"715fc1b2ad9a6e388bd1908d1dcbc075e1bdbfd5",class:"loading-spinner"})),i("slot",{key:"436691253f9ac25e8910598d34fc10028f0484b6"}))}};p.style=m;export{l as crm_giftback_form,p as loading_container};
2
- //# sourceMappingURL=p-e37a10a1.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["giftbackFormCss","CrmGiftbackFormStyle0","CrmBonus","this","crmBonusService","CrmBonusService","getInstance","StepFormEnum","STEP_PHONE","setStep","step","processBonus","products","hasNewProduct","sucess","console","log","_bonus","localStorage","getItem","getKeyReserveByCartId","cartId","bonus","JSON","parse","phone","pinInfo","storeId","userId","validateBonus","handleSendPin","message","sendPin","componentWillLoad","error","config","getInfoCustomization","storeName","phoneAgain","getPhoneNumberAgain","consulta_bonus","hasBonus","convertStringToNumber","_phone","replace","Number","loading","_a","customer","name","STEP_RESERVE","STEP_PIN","_c","_b","response","data","changePhone","pin","loadProducts","used_or_no","USED_KEY","payload","cellphone","toString","checkoutId","checkoutProducts","validatePinBonus","setItem","stringify","Object","assign","STEP_NO_BONUS","StatusGiftBackProcess","VALIDATE","bonusBalance","_error","includes","handleCancel","cancel","save","reserveApply","amount","reserve","removeItem","redeemedBonus","ticket","grossValue","totalValue","render","h","key","class","giftbackTitle","value","handlerSubmit","resend","validate","i18next","t","storename","loadingContainerCss","LoadingContainerStyle0","LoadingContainer"],"sources":["src/components/giftback-form/giftback-form.css?tag=crm-giftback-form","src/components/giftback-form/giftback-form.tsx","src/components/loading-container/loading-container.css?tag=loading-container","src/components/loading-container/loading-container.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 font-weight: 100;\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 { StatusGiftBackProcess, 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 { USED_KEY, 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 @Prop() loadProducts: () => void;\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(products: IProduct[] = [], hasNewProduct = false) {\n this.sucess = \"\";\n\n console.log('processBonus', [])\n if (hasNewProduct) {\n this.products = products;\n }\n\n const _bonus = localStorage.getItem(getKeyReserveByCartId(this.cartId));\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 const phoneAgain = this.getPhoneNumberAgain();\n\n console.log('phoneAgain', phoneAgain)\n\n if(phoneAgain) {\n this.step = StepFormEnum.STEP_PHONE;\n return\n } \n\n await this.processBonus();\n\n }\n\n getPhoneNumberAgain() {\n const consulta_bonus = localStorage.getItem(getKeyReserveByCartId(this.cartId));\n\n if(!consulta_bonus) return false;\n\n const bonus = JSON.parse(consulta_bonus);\n\n return !bonus.hasBonus;\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.customer?.name, this.storeName);\n\n if (localStorage.getItem(`bc:${this.phone}`)) {\n await this.validateBonus(\"2018\");\n this.step = StepFormEnum.STEP_RESERVE;\n } else {\n this.step = StepFormEnum.STEP_PIN;\n }\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 console.log('this.phone', this.phone)\n\n this.loadProducts();\n\n const used_or_no = localStorage.getItem(USED_KEY);\n\n if (used_or_no == \"dontUse\") {\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.convertStringToNumber(),\n storeId: this.pinInfo.storeId.toString(),\n userId: this.pinInfo.userId.toString(),\n checkoutId: this.cartId,\n checkoutProducts: this.products,\n name: this.customer?.name,\n storeName: this.storeName\n }\n\n try {\n this.bonus = await this.crmBonusService.validatePinBonus(payload);\n\n if (!this.bonus.hasBonus) {\n\n localStorage.setItem(getKeyReserveByCartId(this.cartId), JSON.stringify({ ...this.bonus, phone: this.phone }));\n\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 localStorage.setItem(`bc:${this.phone}`, StatusGiftBackProcess.VALIDATE)\n\n localStorage.setItem(USED_KEY, \"use\");\n localStorage.setItem(this.cartId, this.bonus.bonusBalance.toString());\n\n this.step = StepFormEnum.STEP_RESERVE;\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\n localStorage.setItem(USED_KEY, \"dontUse\");\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\n {/* <loading-container /> */}\n\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={() => this.processBonus()}\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}","/* Estilo para centralizar o container do loading */\n.loading-container {\n position: absolute;\n /* Fixa o loading na tela */\n top: 0;\n left: 0;\n width: 100%;\n /* Tamanho total da tela */\n height: 100%;\n background-color: rgba(0, 0, 0, 0.5);\n /* Fundo semitransparente */\n display: flex;\n /* Centraliza o conteúdo */\n justify-content: center;\n align-items: center;\n z-index: 1000;\n /* Coloca o loading acima de outros elementos */\n}\n\n/* Estilo do spinner (círculo giratório) */\n.loading-spinner {\n width: 50px;\n height: 50px;\n border: 5px solid rgba(255, 255, 255, 0.3);\n /* Borda semitransparente */\n border-top: 5px solid white;\n /* Borda que será animada */\n border-radius: 50%;\n /* Faz o círculo */\n animation: spin 1s linear infinite;\n /* Gira continuamente */\n}\n\n/* Keyframes para a animação de rotação */\n@keyframes spin {\n 0% {\n transform: rotate(0deg);\n }\n\n 100% {\n transform: rotate(360deg);\n }\n}\n\n.relative-xy {\n position: relative;\n}","import { Component, Prop, h } from \"@stencil/core\";\n\n@Component({\n tag: 'loading-container',\n styleUrl: 'loading-container.css'\n})\nexport class LoadingContainer {\n\n @Prop() loading: boolean = true;\n\n render() {\n return (\n <div class=\"relative-xy\">\n {\n this.loading && (\n <div class=\"loading-container\">\n <div class=\"loading-spinner\">\n\n </div>\n \n </div>\n )\n }\n <slot></slot>\n </div>\n )\n }\n}"],"mappings":"6OAAA,MAAMA,EAAkB,k+BACxB,MAAAC,EAAeD,E,MCaFE,EAAQ,M,yBAGXC,KAAAC,gBAAmCC,EAAgBC,c,6JAS/B,M,6EAIEC,EAAaC,W,iCAGjB,G,WACD,G,yCAGA,K,CAIzB,aAAMC,CAAQC,GACZP,KAAKO,KAAOA,C,CAId,kBAAMC,CAAaC,EAAuB,GAAIC,EAAgB,OAC5DV,KAAKW,OAAS,GAEdC,QAAQC,IAAI,eAAgB,IAC5B,GAAIH,EAAe,CACjBV,KAAKS,SAAWA,C,CAGlB,MAAMK,EAASC,aAAaC,QAAQC,EAAsBjB,KAAKkB,SAE/D,GAAIJ,EAAQ,CAEV,MAAMK,EAAQC,KAAKC,MAAMP,GAEzBd,KAAKmB,MAAQA,EAEbnB,KAAKsB,MAAQH,EAAMG,MACnBtB,KAAKuB,QAAU,CACbC,QAASL,EAAMK,QACfC,OAAQN,EAAMM,cAGVzB,KAAK0B,cAAc,O,EAQ7B,mBAAMC,CAAcL,GAElBtB,KAAK4B,QAAU,GACf,IAAKN,EAAO,CACVtB,KAAK4B,QAAU,uBACf,M,CAGF5B,KAAKsB,MAAQA,EAEbtB,KAAK6B,S,CAGP,uBAAMC,GACJ9B,KAAKW,OAAS,GACdX,KAAK+B,MAAQ,GACb/B,KAAKgC,OAASC,EAAqBjC,KAAKkC,WAExC,MAAMC,EAAanC,KAAKoC,sBAExBxB,QAAQC,IAAI,aAAcsB,GAE1B,GAAGA,EAAY,CACbnC,KAAKO,KAAOH,EAAaC,WACzB,M,OAGIL,KAAKQ,c,CAIb,mBAAA4B,GACE,MAAMC,EAAiBtB,aAAaC,QAAQC,EAAsBjB,KAAKkB,SAEvE,IAAImB,EAAgB,OAAO,MAE3B,MAAMlB,EAAQC,K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,SAEb3C,KAAKW,QAAU2E,EAAA,KAAAC,IAAA,2CAAGC,MAAM,oBAAoBxF,KAAKW,QACjDX,KAAK+B,OAASuD,EAAA,KAAAC,IAAA,2CAAGC,MAAM,qBAAqBxF,KAAK+B,QAMpD/B,KAAKO,OAASH,EAAa2C,cAC3BuC,EAAA,iBAAAC,IAAA,2CACE5C,QAAS3C,KAAK2C,QACdgC,OAAQ,IAAM3E,KAAK0E,eACnBvD,MAAOnB,KAAKmB,MACZ4D,QAAS,IAAM/E,KAAKQ,iBAKtBR,KAAKO,OAASH,EAAagE,eAEzBkB,EAAA,OAAAC,IAAA,2CAAKC,MAAM,qBACRM,EAAQC,EAAE,aAAc,CAAEC,UAAWhG,KAAKgC,OAAOyD,iB,aC7ThE,MAAMQ,EAAsB,+bAC5B,MAAAC,EAAeD,E,MCKFE,EAAgB,M,sCAEE,I,CAE3B,MAAAd,GACI,OACIC,EAAA,OAAAC,IAAA,2CAAKC,MAAM,eAEHxF,KAAK2C,SACD2C,EAAA,OAAAC,IAAA,2CAAKC,MAAM,qBACPF,EAAA,OAAAC,IAAA,2CAAKC,MAAM,qBAOvBF,EAAA,QAAAC,IAAA,6C","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"file":"index-23a034bf.js","mappings":"IAAY;AAAZ,WAAY,YAAY;IACpB,yDAAa,CAAA;IACb,2DAAc,CAAA;IACd,uDAAY,CAAA;IACZ,+DAAgB,CAAA;IAChB,2DAAc,CAAA;IACd,iEAAiB,CAAA;AACrB,CAAC,EAPW,YAAY,KAAZ,YAAY,QAOvB;MAEY,4BAA4B,GAAE,kBAAiB;IAGhD;AAAZ,WAAY,qBAAqB;IAC7B,8CAAqB,CAAA;IACrB,8CAAqB,CAAA;AACzB,CAAC,EAHW,qBAAqB,KAArB,qBAAqB;;;;","names":[],"sources":["src/contants/index.ts"],"sourcesContent":["export enum StepFormEnum {\n STEP_NAME = 0,\n STEP_PHONE = 1,\n STEP_PIN = 2,\n STEP_RESERVE = 3,\n STEP_APPLY = 4,\n STEP_NO_BONUS = 5\n}\n\nexport const MESSAGE_ERROR_INVALID_NUMBER= \"Número inválido\"\n\n\nexport enum StatusGiftBackProcess {\n VALIDATE = \"validate\",\n NO_BONUS = \"no_bonus\"\n}"],"version":3}
@@ -1 +0,0 @@
1
- {"file":"utils-02d50e38.js","mappings":"SAAgB,MAAM,CAAC,KAAc,EAAE,MAAe,EAAE,IAAa;IACnE,OAAO,CAAC,KAAK,IAAI,EAAE,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,GAAG,IAAI,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;AACjF,CAAC;SAEe,WAAW,CAAC,iBAAyB;IAEnD,OAAO;QACL,iBAAiB,EAAE,iBAAiB,GAAG,CAAC,GAAG,MAAM,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC;QAClG,UAAU,GAAG,iBAAiB,GAAG,CAAC,CAAC;KACpC,CAAA;AACH,CAAC;SAEe,cAAc,CAAC,QAAgB;;IAI7C,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAEnC,IAAI,IAAI,CAAC,MAAM,IAAI,EAAE;QACnB,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAE1C,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7C;;;;","names":[],"sources":["src/utils/utils.ts"],"sourcesContent":["export function format(first?: string, middle?: string, last?: string): string {\n return (first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : '');\n}\n\nexport function defineLimit(remainingGiftback: number) {\n\n return {\n remainingGiftback: remainingGiftback < 0 ? \"0,00\" : remainingGiftback.toFixed(2).replace(\".\", \",\"),\n isComplete: (remainingGiftback < 0)\n }\n}\n\nexport function formatDateToBr(dateTime: string) {\n\n // const decodedDateTime = decodeHtmlEntities(dateTime);\n\n const [date] = dateTime.split(\" \");\n\n if (date.length != 10)\n throw new Error(\"Invalid validateDate\");\n\n return date.split(\"-\").reverse().join(\"/\");\n}\n\n\n// Decodifica entidades HTML, se houver\nexport const decodeHtmlEntities = (str: string) => {\n const parser = new DOMParser();\n const doc = parser.parseFromString(str, 'text/html');\n\n console.log(\"doc.documentElement\")\n\n return doc.documentElement.textContent || str;\n};\n"],"version":3}