crmbonus-component-wake 2.0.100 → 2.0.102

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 (143) hide show
  1. package/dist/cjs/app-modal.cjs.entry.js +1 -1
  2. package/dist/cjs/countdown-timer_2.cjs.entry.js +60 -0
  3. package/dist/cjs/countdown-timer_2.cjs.entry.js.map +1 -0
  4. package/dist/cjs/crm-bonus-note.cjs.entry.js +5 -5
  5. package/dist/cjs/crm-bonus-note.cjs.entry.js.map +1 -1
  6. package/dist/cjs/crm-bonus.cjs.entry.js +4 -4
  7. package/dist/cjs/crm-bonus.cjs.entry.js.map +1 -1
  8. package/dist/cjs/crm-giftback-form_2.cjs.entry.js +6 -8
  9. package/dist/cjs/crm-giftback-form_2.cjs.entry.js.map +1 -1
  10. package/dist/cjs/{countdown-timer_5.cjs.entry.js → crm-tooltip_4.cjs.entry.js} +11 -33
  11. package/dist/cjs/crm-tooltip_4.cjs.entry.js.map +1 -0
  12. package/dist/cjs/crmbonus-component-wake.cjs.js +1 -1
  13. package/dist/cjs/loader.cjs.js +1 -1
  14. package/dist/cjs/loading-spinner.cjs.entry.js +1 -1
  15. package/dist/cjs/pedido-finalizado.cjs.entry.js +1 -1
  16. package/dist/cjs/phone-input-mask.cjs.entry.js +1 -1
  17. package/dist/collection/components/countdown-timer/countdown-timer.js +32 -5
  18. package/dist/collection/components/countdown-timer/countdown-timer.js.map +1 -1
  19. package/dist/collection/components/crm-bonus/crm-bonus.js +4 -4
  20. package/dist/collection/components/crm-bonus/crm-bonus.js.map +1 -1
  21. package/dist/collection/components/giftback-form/giftback-form.js +5 -7
  22. package/dist/collection/components/giftback-form/giftback-form.js.map +1 -1
  23. package/dist/collection/components/giftback-form/subcomponents/giftback-info/giftback-info.js +28 -3
  24. package/dist/collection/components/giftback-form/subcomponents/giftback-info/giftback-info.js.map +1 -1
  25. package/dist/collection/components/giftback-form/subcomponents/phone-form/phone-form.js +1 -1
  26. package/dist/collection/components/giftback-form/subcomponents/pin-form/pin-form.js +1 -1
  27. package/dist/collection/components/giftback-form/subcomponents/pin-form/pin-form.js.map +1 -1
  28. package/dist/collection/components/loading-container/loading-container.js +1 -1
  29. package/dist/collection/components/loading-spinner/loading-spinner.js +1 -1
  30. package/dist/collection/components/modal/app-modal.js +1 -1
  31. package/dist/collection/components/note/crm-bonus-note.js +7 -6
  32. package/dist/collection/components/note/crm-bonus-note.js.map +1 -1
  33. package/dist/collection/components/pedido/pedido.js +1 -1
  34. package/dist/collection/components/phone/phone-input-mask.js +1 -1
  35. package/dist/collection/components/tooltip/tooltip.js +1 -1
  36. package/dist/components/app-modal.js +1 -1
  37. package/dist/components/countdown-timer.js +1 -1
  38. package/dist/components/crm-bonus-form.js +4 -4
  39. package/dist/components/crm-bonus-note.js +16 -9
  40. package/dist/components/crm-bonus-note.js.map +1 -1
  41. package/dist/components/crm-bonus.js +14 -14
  42. package/dist/components/crm-bonus.js.map +1 -1
  43. package/dist/components/crm-button.js +1 -1
  44. package/dist/components/crm-giftback-form.js +1 -1
  45. package/dist/components/crm-tooltip.js +1 -1
  46. package/dist/components/giftback-info.js +1 -1
  47. package/dist/components/giftback-pin.js +1 -1
  48. package/dist/components/giftback-progress.js +1 -1
  49. package/dist/components/loading-container.js +1 -1
  50. package/dist/components/loading-spinner.js +1 -1
  51. package/dist/components/name-input.js +1 -1
  52. package/dist/components/{p-078fe899.js → p-05c740f7.js} +16 -6
  53. package/dist/components/p-05c740f7.js.map +1 -0
  54. package/dist/components/{p-ffa42f74.js → p-11085d9b.js} +2 -2
  55. package/dist/components/{p-ffa42f74.js.map → p-11085d9b.js.map} +1 -1
  56. package/dist/components/{p-6aa06f7f.js → p-14f432d2.js} +14 -16
  57. package/dist/components/p-14f432d2.js.map +1 -0
  58. package/dist/components/{p-735f01da.js → p-18a1da25.js} +5 -5
  59. package/dist/components/p-18a1da25.js.map +1 -0
  60. package/dist/components/{p-0949411f.js → p-246a3e9d.js} +2 -2
  61. package/dist/components/{p-0949411f.js.map → p-246a3e9d.js.map} +1 -1
  62. package/dist/components/{p-2f30297f.js → p-47f9da55.js} +2 -2
  63. package/dist/components/{p-2f30297f.js.map → p-47f9da55.js.map} +1 -1
  64. package/dist/components/{p-53259f8a.js → p-58b97429.js} +2 -2
  65. package/dist/components/{p-53259f8a.js.map → p-58b97429.js.map} +1 -1
  66. package/dist/components/{p-86564a17.js → p-6186ddcc.js} +2 -2
  67. package/dist/components/{p-86564a17.js.map → p-6186ddcc.js.map} +1 -1
  68. package/dist/components/{p-69799798.js → p-6c546e48.js} +5 -5
  69. package/dist/components/{p-69799798.js.map → p-6c546e48.js.map} +1 -1
  70. package/dist/components/{p-d1a21f41.js → p-7c744cca.js} +2 -2
  71. package/dist/components/{p-d1a21f41.js.map → p-7c744cca.js.map} +1 -1
  72. package/dist/components/{p-f1fb885c.js → p-cc1ea33f.js} +2 -2
  73. package/dist/components/{p-f1fb885c.js.map → p-cc1ea33f.js.map} +1 -1
  74. package/dist/components/{p-a6fefb58.js → p-ec78743b.js} +17 -6
  75. package/dist/components/p-ec78743b.js.map +1 -0
  76. package/dist/components/{p-169fe768.js → p-fe9c3966.js} +2 -2
  77. package/dist/components/{p-169fe768.js.map → p-fe9c3966.js.map} +1 -1
  78. package/dist/components/pedido-finalizado.js +1 -1
  79. package/dist/components/phone-cancel-input.js +2 -2
  80. package/dist/components/phone-form.js +1 -1
  81. package/dist/components/phone-input-mask.js +1 -1
  82. package/dist/components/phone-input.js +2 -2
  83. package/dist/components/pin-form.js +1 -1
  84. package/dist/crmbonus-component-wake/crmbonus-component-wake.esm.js +1 -1
  85. package/dist/crmbonus-component-wake/crmbonus-component-wake.esm.js.map +1 -1
  86. package/dist/crmbonus-component-wake/p-21464f24.entry.js +2 -0
  87. package/dist/crmbonus-component-wake/p-21464f24.entry.js.map +1 -0
  88. package/dist/crmbonus-component-wake/p-47da93fa.entry.js +2 -0
  89. package/dist/crmbonus-component-wake/p-47da93fa.entry.js.map +1 -0
  90. package/dist/crmbonus-component-wake/{p-e8113d86.entry.js → p-4ac17815.entry.js} +2 -2
  91. package/dist/crmbonus-component-wake/p-4ac17815.entry.js.map +1 -0
  92. package/dist/crmbonus-component-wake/p-5f977af2.entry.js +2 -0
  93. package/dist/crmbonus-component-wake/p-5f977af2.entry.js.map +1 -0
  94. package/dist/crmbonus-component-wake/{p-9cd20349.entry.js → p-620ec1a3.entry.js} +2 -2
  95. package/dist/crmbonus-component-wake/{p-5e62b863.entry.js → p-885fc30e.entry.js} +2 -2
  96. package/dist/crmbonus-component-wake/p-a010961a.entry.js +2 -0
  97. package/dist/crmbonus-component-wake/p-a010961a.entry.js.map +1 -0
  98. package/dist/crmbonus-component-wake/{p-10f6923a.entry.js → p-b873347f.entry.js} +2 -2
  99. package/dist/crmbonus-component-wake/{p-53c1694c.entry.js → p-be3ddacc.entry.js} +2 -2
  100. package/dist/esm/app-modal.entry.js +1 -1
  101. package/dist/esm/countdown-timer_2.entry.js +55 -0
  102. package/dist/esm/countdown-timer_2.entry.js.map +1 -0
  103. package/dist/esm/crm-bonus-note.entry.js +5 -5
  104. package/dist/esm/crm-bonus-note.entry.js.map +1 -1
  105. package/dist/esm/crm-bonus.entry.js +4 -4
  106. package/dist/esm/crm-bonus.entry.js.map +1 -1
  107. package/dist/esm/crm-giftback-form_2.entry.js +6 -8
  108. package/dist/esm/crm-giftback-form_2.entry.js.map +1 -1
  109. package/dist/esm/{countdown-timer_5.entry.js → crm-tooltip_4.entry.js} +12 -33
  110. package/dist/esm/crm-tooltip_4.entry.js.map +1 -0
  111. package/dist/esm/crmbonus-component-wake.js +1 -1
  112. package/dist/esm/loader.js +1 -1
  113. package/dist/esm/loading-spinner.entry.js +1 -1
  114. package/dist/esm/pedido-finalizado.entry.js +1 -1
  115. package/dist/esm/phone-input-mask.entry.js +1 -1
  116. package/dist/types/components/countdown-timer/countdown-timer.d.ts +3 -1
  117. package/dist/types/components/giftback-form/subcomponents/giftback-info/giftback-info.d.ts +2 -0
  118. package/dist/types/components/note/crm-bonus-note.d.ts +1 -0
  119. package/dist/types/components.d.ts +4 -0
  120. package/package.json +1 -1
  121. package/dist/cjs/countdown-timer_5.cjs.entry.js.map +0 -1
  122. package/dist/cjs/crm-button.cjs.entry.js +0 -25
  123. package/dist/cjs/crm-button.cjs.entry.js.map +0 -1
  124. package/dist/components/p-078fe899.js.map +0 -1
  125. package/dist/components/p-6aa06f7f.js.map +0 -1
  126. package/dist/components/p-735f01da.js.map +0 -1
  127. package/dist/components/p-a6fefb58.js.map +0 -1
  128. package/dist/crmbonus-component-wake/p-3389ad52.entry.js +0 -2
  129. package/dist/crmbonus-component-wake/p-3389ad52.entry.js.map +0 -1
  130. package/dist/crmbonus-component-wake/p-33c1eeca.entry.js +0 -2
  131. package/dist/crmbonus-component-wake/p-33c1eeca.entry.js.map +0 -1
  132. package/dist/crmbonus-component-wake/p-3ccbcc11.entry.js +0 -2
  133. package/dist/crmbonus-component-wake/p-3ccbcc11.entry.js.map +0 -1
  134. package/dist/crmbonus-component-wake/p-c2ff5149.entry.js +0 -2
  135. package/dist/crmbonus-component-wake/p-c2ff5149.entry.js.map +0 -1
  136. package/dist/crmbonus-component-wake/p-e8113d86.entry.js.map +0 -1
  137. package/dist/esm/countdown-timer_5.entry.js.map +0 -1
  138. package/dist/esm/crm-button.entry.js +0 -21
  139. package/dist/esm/crm-button.entry.js.map +0 -1
  140. /package/dist/crmbonus-component-wake/{p-9cd20349.entry.js.map → p-620ec1a3.entry.js.map} +0 -0
  141. /package/dist/crmbonus-component-wake/{p-5e62b863.entry.js.map → p-885fc30e.entry.js.map} +0 -0
  142. /package/dist/crmbonus-component-wake/{p-10f6923a.entry.js.map → p-b873347f.entry.js.map} +0 -0
  143. /package/dist/crmbonus-component-wake/{p-53c1694c.entry.js.map → p-be3ddacc.entry.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"names":["infoCircleSvgrepoComSvg","crmTooltipCss","CrmTooltipStyle0","Tooltip","render","h","key","class","src","info","id","this","identity","text","giftbackInfoCss","GiftbackInfoStyle0","GiftbackInfo","totalBonus","cartId","minimumPurchase","bonusBalance","calculatedValue","firstValidityDate","totalValue","changedBonus","updateBonus","usedValue","bonus","buildPositionSlider","componentWillLoad","selectedOption","localStorage","getItem","USED_KEY","handleSliderChange","event","input","target","parseFloat","value","min","max","componentDidLoad","document","getElementById","percentage_init","percentage","sliderPosition","sliderValuePosition","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","_a","config","giftbackTitle","_b","initialValue","downtime","giftbackFormCss","PhoneFormStyle0","PhoneForm","handlePhone","phone","phoneInputMask","getPhone","handlerSubmit","Host","ref","txtBtn","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/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":["<?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\";\nimport { IInfoStore } from \"../../../../helpers/info.config.helper\";\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 @Prop() config: IInfoStore;\n\n @State() sliderPosition: number = 0;\n @State() sliderValuePosition: 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 \n const percentage_init = max * 0.1;\n\n // Calculando a posição do texto com base no valor do slider\n const percentage = ((this.usedValue - min) / (max - min)) * 100;\n \n this.sliderPosition = percentage;\n this.sliderValuePosition = percentage + ( this.usedValue <= percentage_init ? 10 : 0 );\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.sliderValuePosition}% - 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! \n </p>\n <crm-tooltip identity=\"crm-max-description\" text={i18next.t(\"labelamountPartial\")} />\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 {this.config?.giftbackTitle}</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 {this.config?.giftbackTitle}</p>\n </div>\n </div>\n\n <div class=\"info-box\">\n Após <countdown-timer initialValue={120} downtime={() => { }} />, você poderá alterar sua escolha de usar ou não o Giftback.\n </div>\n\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 initialValue={30} 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":"qKAAA,MAAMA,EAA0B,yvCCAhC,MAAMC,EAAgB,03BACtB,MAAAC,EAAeD,E,MCOFE,EAAO,M,qEAKhB,MAAAC,GACI,OACIC,EAAA,OAAAC,IAAA,2CAAKC,MAAM,qCACPF,EAAA,OAAAC,IAAA,2CAAKE,IAAKC,IACVJ,EAAA,QAAAC,IAAA,2CAAMI,GAAIC,KAAKC,SAAUL,MAAM,eAAeI,KAAKE,M,aCjBnE,MAAMC,EAAkB,m7DACxB,MAAAC,EAAeD,E,MCWFE,EAAY,M,wCACQ,E,oBACK,O,aAEP,M,WACM,CAC7BC,WAAY,EACZC,OAAQ,GACRC,gBAAiB,EACjBC,aAAc,EACdC,gBAAiB,EACjBC,kBAAmB,GACnBC,WAAY,G,uFAMkB,E,yBACK,C,CAGvC,YAAAC,GACIb,KAAKc,a,CAGD,WAAAA,GACJd,KAAKe,UAAYf,KAAKgB,MAAMP,aAC5BT,KAAKiB,oBAAoB,EAAGjB,KAAKgB,MAAMV,W,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,SAAQhB,EAAAlE,KAAKmE,UAAM,MAAAD,SAAA,SAAAA,EAAEiB,qBAAsB,UAAWC,QAASpF,KAAKoF,QAASC,YAAa,IAAMrF,KAAKmG,gB","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import{r as n,h as e}from"./p-3d6152b1.js";import{g as t}from"./p-75ba7b9a.js";import{g as i}from"./p-f9aeffc1.js";import{i as a}from"./p-e8c19a64.js";const o="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8Y2lyY2xlIGN4PSIxMiIgY3k9IjEyIiByPSIxMCIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2Utd2lkdGg9IjIiLz4KPHBhdGggZD0iTTE1IDkuOTQ3MjhDMTQuNSA5LjMgMTMuOCA4LjUgMTIgOC41QzEwLjIgOC41IDkgOS41MTM5MyA5IDkuOTQ3MjhDOSAxMC4zODA2IDkuMDY3ODYgMTAuOTI3NyAxMCAxMS41QzEwLjc1MjIgMTEuOTYxOCAxMi42Njg0IDEyLjA0MzkgMTMuNSAxMi41QzE0LjY3OSAxMy4xNDY3IDE0Ljg0OTcgMTMuODIwMiAxNC44NDk3IDE0LjA1MjJDMTQuODQ5NyAxNC42ODM3IDEzLjQxNzUgMTUuNDg1MiAxMiAxNS41QzEwLjUzNiAxNS41MTUzIDkuNSAxNC43IDkgMTQuMDUyMiIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8cGF0aCBkPSJNMTIgN1YxNyIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2Utd2lkdGg9IjEuNSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+Cjwvc3ZnPg==";const c=".note-container {\n border: 1px solid #dddddd;\n padding: 0 15px 15px;\n margin: 0 0 26px 0px;\n display: flex;\n flex-direction: column;\n gap: 13px;\n\n\n & .description {\n display: flex;\n flex-direction: column;\n gap: 13px;\n }\n}\n\n.note-container hr {\n border: 1px solid #CCC;\n}\n\n.note-container .back-cart {\n display: flex;\n text-align: center;\n}\n\n.note-header {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n}\n\n.note-title {\n font-weight: 700;\n text-align: left;\n display: flex;\n gap: 6px;\n align-items: center;\n margin-top: 11px;\n color: #000;\n}\n\n.note-description {\n font-family: Arial;\n color: #6d6d5f;\n padding: 0;\n margin: 0 auto;\n}\n\n.back-cart {\n font-size: .9em;\n color: #27272A;\n text-decoration: none;\n cursor: pointer;\n margin-top: 11px;\n}\n\n.note-description-2 {\n color: var(--crm-scheme-fg-main-inverse, #262626);\n font-family: Roboto;\n font-size: var(--crm-font-size-body-lg, 16px);\n font-style: normal;\n font-weight: var(--crm-font-weight-body-bold, 400);\n line-height: var(--crm-line-height-body-md, 20px);\n letter-spacing: var(--crm-letter-spacing-title-md, 0px);\n margin-top: 11px;\n color: #000;\n}\n\n.note-description-not {\n font-size: 16px;\n}";const d=c;const s=class{constructor(e){n(this,e);this.cartId=undefined;this.storename=undefined;this.url=undefined;this.config=undefined;this.bonus=undefined}componentWillLoad(){this.upadateCheckToFreteAndGetUrl()}upadateCheckToFreteAndGetUrl(){this.config=t(this.storename);const n=document.getElementsByName("forma-envio");n.forEach((n=>{n.checked=false}));this.url=window.location.origin}handleHide(){const n=localStorage.getItem(this.cartId);return!!n}getAmount(){const n=localStorage.getItem(this.cartId);return n?Number(n).toFixed(2).replace(".",",")||"0,00":"0,00"}async backCart(){window.location.href=this.url}hasBonus(){const n=localStorage.getItem(i(this.cartId));const e={hasBonus:false,requestBonus:false};if(n){this.bonus=JSON.parse(n);console.log("bonus",this.bonus);e.hasBonus=this.bonus.hasBonus;e.requestBonus=true}return e}render(){const n=this.config.giftbackTitle||"Giftback";const t=this.hasBonus();return e("div",{key:"dadcd7773ddc22edc998bc9874f528063d2385b9"},e("div",{key:"c4f9ec03a00015d11ca2478a2363b77436c0b6c3",class:"note-container"},e("div",{key:"105ffdb9fffccdd463be397b76cf0a076657af91",class:"note-header"},e("p",{key:"6eafef1a4ded3c0b9d5bf37b21a4e184af31948f",class:"note-title"},e("img",{key:"7ee9a33773fa4d550aeb6ae9c32f49744a091d2f",src:o,width:23}),this.config.giftbackTitle),t.hasBonus&&e("p",{key:"2250436629c1ea34455ed1540f2842db76896066",class:"back-cart",onClick:()=>this.backCart()},a.t("edit"))),t.hasBonus&&e("p",{key:"eba4a532b0ec5bf5e355ffb51750c0a2e0437f34",class:"note-description-2"},a.t("withApplyBonus",{giftbackname:n})," ",e("strong",{key:"54a09e84dd38a4b236e6c92611d00fd0ad3fbea2"},"R$ ",this.getAmount(),".")),t.requestBonus&&!t.hasBonus&&e("p",{key:"4a01a4843b9a8dce9e6570000f116bd6c9d76a13",class:"note-description-not"},a.t("noBonus",{giftbackname:n})),!t.requestBonus&&e("div",{key:"7fbe1b45f578fdb6b8e94735b1af08dd36925acb",class:"description"},e("p",{key:"dd8e5c4a48fb8ca18653f56c2afaaeae6da1c88e",class:"note-description-not"},a.t("backCart")),e("crm-button",{key:"0fb903030f7562c0b3a21d977086e5818718d624",txtBtn:"VOLTAR AO CARRINHO",handleClick:()=>this.backCart()}))))}};s.style=d;export{s as crm_bonus_note};
2
- //# sourceMappingURL=p-e8113d86.entry.js.map
1
+ import{r as n,h as e}from"./p-3d6152b1.js";import{g as t}from"./p-75ba7b9a.js";import{g as i}from"./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g==";const o=".note-container {\n border: 1px solid #dddddd;\n padding: 0 15px 15px;\n margin: 0 0 26px 0px;\n display: flex;\n flex-direction: column;\n gap: 13px;\n\n\n & .description {\n display: flex;\n flex-direction: column;\n gap: 13px;\n }\n}\n\n.note-container hr {\n border: 1px solid #CCC;\n}\n\n.note-container .back-cart {\n display: flex;\n text-align: center;\n}\n\n.note-header {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n}\n\n.note-title {\n font-weight: 700;\n text-align: left;\n display: flex;\n gap: 6px;\n align-items: center;\n margin-top: 11px;\n color: #000;\n}\n\n.note-description {\n font-family: Arial;\n color: #6d6d5f;\n padding: 0;\n margin: 0 auto;\n}\n\n.back-cart {\n font-size: .9em;\n color: #27272A;\n text-decoration: none;\n cursor: pointer;\n margin-top: 11px;\n}\n\n.note-description-2 {\n color: var(--crm-scheme-fg-main-inverse, #262626);\n font-family: Roboto;\n font-size: var(--crm-font-size-body-lg, 16px);\n font-style: normal;\n font-weight: var(--crm-font-weight-body-bold, 400);\n line-height: var(--crm-line-height-body-md, 20px);\n letter-spacing: var(--crm-letter-spacing-title-md, 0px);\n margin-top: 11px;\n color: #000;\n}\n\n.note-description-not {\n font-size: 16px;\n}";const d=o;const s=class{constructor(e){n(this,e);this.cartId=undefined;this.storename=undefined;this.url=undefined;this.config=undefined;this.bonus=undefined;this.showEdit=false}componentWillLoad(){this.upadateCheckToFreteAndGetUrl()}upadateCheckToFreteAndGetUrl(){this.config=t(this.storename);const n=document.getElementsByName("forma-envio");n.forEach((n=>{n.checked=false}));this.url=window.location.origin}handleHide(){const n=localStorage.getItem(this.cartId);return!!n}getAmount(){const n=localStorage.getItem(this.cartId);return n?Number(n).toFixed(2).replace(".",",")||"0,00":"0,00"}async backCart(){window.location.href=this.url}hasBonus(){const n=localStorage.getItem(i(this.cartId));const e={hasBonus:false,requestBonus:false};if(n){this.bonus=JSON.parse(n);e.hasBonus=this.bonus.hasBonus;e.requestBonus=true}return e}render(){const n=this.config.giftbackTitle||"Giftback";const t=this.hasBonus();return e("div",{key:"e918536bb1517ee22a4572ce74988306dbe31f01"},e("div",{key:"958b56abdbe364f70377cd7476ffd893f80630cb",class:"note-container"},e("div",{key:"e79c47ec7000d74af61f794d583faef06d65e812",class:"note-header"},e("p",{key:"d15eba4e26c6091729f0b5d41bfd702d2fdb6f04",class:"note-title"},e("img",{key:"de5ab8deca48cea53f30923ba9cbc5f1bec90d44",src:c,width:23}),this.config.giftbackTitle),t.hasBonus&&e("div",{key:"a14dee6357f4f39de1019b9cf0b8886430342bb2"},this.showEdit&&e("p",{key:"3f86785606b8fa9571283f2ef93011673194ce90",class:"back-cart",onClick:()=>this.backCart()},a.t("edit")),!this.showEdit&&e("countdown-timer",{key:"9d808c66eb2d9f6d443f1a5ecf88733ce22a2445",initialValue:60,downtime:()=>{this.showEdit=true}}))),t.hasBonus&&e("p",{key:"eaca502ac377289c1592fa2316c9c474e464d69d",class:"note-description-2"},a.t("withApplyBonus",{giftbackname:n})," ",e("strong",{key:"298bcd621c6ce2a952853dd4d6ec205b183a1e9c"},"R$ ",this.getAmount(),".")),t.requestBonus&&!t.hasBonus&&e("p",{key:"20326607c5c74cc97dfb6fcb81e9e85ade2ae474",class:"note-description-not"},a.t("noBonus",{giftbackname:n})),!t.requestBonus&&e("div",{key:"faaefcec481ec5ca21bac021003f13f3f5f6cf54",class:"description"},e("p",{key:"a95c95602fdb8e4734d783b6af1d2918adbb5aff",class:"note-description-not"},a.t("backCart")),e("crm-button",{key:"95a8bac95b5eb843005990e7fb01318d99efaaee",txtBtn:"VOLTAR AO CARRINHO",handleClick:()=>this.backCart()}))))}};s.style=d;export{s as crm_bonus_note};
2
+ //# sourceMappingURL=p-4ac17815.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["moneyDollarsSvgrepoComSvg","crmBonusNoteCss","CrmBonusNoteStyle0","CrmBonusNote","componentWillLoad","this","upadateCheckToFreteAndGetUrl","config","getInfoCustomization","storename","envios","document","getElementsByName","forEach","envio","checked","url","window","location","origin","handleHide","amount","localStorage","getItem","cartId","getAmount","Number","toFixed","replace","backCart","href","hasBonus","_bonus","getKeyReserveByCartId","info","requestBonus","bonus","JSON","parse","render","giftbackname","giftbackTitle","infobonus","h","key","class","src","money","width","showEdit","onClick","i18next","t","initialValue","downtime","txtBtn","handleClick"],"sources":["src/assets/svg/money-dollars-svgrepo-com.svg","src/components/note/crm-bonus-note.css?tag=crm-bonus-note","src/components/note/crm-bonus-note.tsx"],"sourcesContent":["<?xml version=\"1.0\" encoding=\"utf-8\"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->\n<svg width=\"800px\" height=\"800px\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<circle cx=\"12\" cy=\"12\" r=\"10\" stroke=\"#000000\" stroke-width=\"2\"/>\n<path d=\"M15 9.94728C14.5 9.3 13.8 8.5 12 8.5C10.2 8.5 9 9.51393 9 9.94728C9 10.3806 9.06786 10.9277 10 11.5C10.7522 11.9618 12.6684 12.0439 13.5 12.5C14.679 13.1467 14.8497 13.8202 14.8497 14.0522C14.8497 14.6837 13.4175 15.4852 12 15.5C10.536 15.5153 9.5 14.7 9 14.0522\" stroke=\"#000000\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 7V17\" stroke=\"#000000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>",".note-container {\n border: 1px solid #dddddd;\n padding: 0 15px 15px;\n margin: 0 0 26px 0px;\n display: flex;\n flex-direction: column;\n gap: 13px;\n\n\n & .description {\n display: flex;\n flex-direction: column;\n gap: 13px;\n }\n}\n\n.note-container hr {\n border: 1px solid #CCC;\n}\n\n.note-container .back-cart {\n display: flex;\n text-align: center;\n}\n\n.note-header {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n}\n\n.note-title {\n font-weight: 700;\n text-align: left;\n display: flex;\n gap: 6px;\n align-items: center;\n margin-top: 11px;\n color: #000;\n}\n\n.note-description {\n font-family: Arial;\n color: #6d6d5f;\n padding: 0;\n margin: 0 auto;\n}\n\n.back-cart {\n font-size: .9em;\n color: #27272A;\n text-decoration: none;\n cursor: pointer;\n margin-top: 11px;\n}\n\n.note-description-2 {\n color: var(--crm-scheme-fg-main-inverse, #262626);\n font-family: Roboto;\n font-size: var(--crm-font-size-body-lg, 16px);\n font-style: normal;\n font-weight: var(--crm-font-weight-body-bold, 400);\n line-height: var(--crm-line-height-body-md, 20px);\n letter-spacing: var(--crm-letter-spacing-title-md, 0px);\n margin-top: 11px;\n color: #000;\n}\n\n.note-description-not {\n font-size: 16px;\n}","import { Component, Prop, State, h } from \"@stencil/core\";\nimport { IInfoStore, getInfoCustomization } from \"../../helpers/info.config.helper\";\n\nimport money from '../../assets/svg/money-dollars-svgrepo-com.svg'\nimport { getKeyReserveByCartId } from \"../../utils/keys.storage\";\nimport i18next from \"../../i18n/i18n\"\nimport { IBonus } from \"../../components\";\n\n@Component({\n tag: 'crm-bonus-note',\n styleUrl: 'crm-bonus-note.css'\n})\nexport class CrmBonusNote {\n\n @Prop({ attribute: 'cartid' }) cartId;\n @Prop({ attribute: \"storename\" }) storename;\n\n @State() url: string;\n @State() config: IInfoStore;\n\n @State() bonus: IBonus;\n\n @State() showEdit: boolean = false;\n\n componentWillLoad() {\n this.upadateCheckToFreteAndGetUrl()\n }\n\n upadateCheckToFreteAndGetUrl() {\n\n this.config = getInfoCustomization(this.storename);\n const envios = document.getElementsByName('forma-envio');\n envios.forEach((envio: any) => {\n envio.checked = false;\n });\n\n this.url = window.location.origin;\n }\n\n handleHide() {\n const amount = localStorage.getItem(this.cartId);\n return !!amount;\n }\n\n getAmount() {\n const amount = localStorage.getItem(this.cartId);\n\n return amount ? Number(amount).toFixed(2).replace(\".\", \",\") || \"0,00\" : \"0,00\";\n }\n\n async backCart() {\n // await CrmBonusService.getInstance().cancelBonus(this.cartId, this.storename);\n window.location.href = this.url;\n\n // localStorage.removeItem(getKeyReserveByCartId(this.cartId));\n }\n\n\n hasBonus() {\n const _bonus = localStorage.getItem(getKeyReserveByCartId(this.cartId));\n\n const info = {\n hasBonus: false,\n requestBonus: false\n }\n\n if (_bonus) {\n this.bonus = JSON.parse(_bonus);\n info.hasBonus = this.bonus.hasBonus;\n info.requestBonus = true;\n }\n\n return info;\n }\n\n render() {\n\n const giftbackname = this.config.giftbackTitle || \"Giftback\";\n\n const infobonus = this.hasBonus()\n\n return (\n <div>\n <div class=\"note-container\">\n <div class=\"note-header\">\n\n <p class=\"note-title\">\n <img src={money} width={23} />\n {this.config.giftbackTitle}\n </p>\n {\n infobonus.hasBonus && (\n <div>\n {this.showEdit && (\n <p class=\"back-cart\" onClick={() => this.backCart()}>\n {i18next.t(\"edit\")}\n </p>\n )}\n {!this.showEdit && <countdown-timer initialValue={60} downtime={() => { this.showEdit = true }} />}\n </div>\n )\n }\n </div>\n\n {\n infobonus.hasBonus &&\n (\n <p class=\"note-description-2\">\n {i18next.t(\"withApplyBonus\", { giftbackname: giftbackname })} <strong>R$ {this.getAmount()}.</strong>\n </p>\n )\n }\n\n {\n (infobonus.requestBonus && !infobonus.hasBonus) &&\n (\n <p class=\"note-description-not\">\n {i18next.t(\"noBonus\", { giftbackname: giftbackname })}\n </p>\n )\n }\n\n {\n !infobonus.requestBonus &&\n (\n <div class=\"description\">\n <p class=\"note-description-not\">\n {i18next.t(\"backCart\")}\n </p>\n <crm-button txtBtn=\"VOLTAR AO CARRINHO\" handleClick={() => this.backCart()} />\n </div>\n )\n }\n\n {/* <a class=\"back-cart\" href={this.url}>\n Voltar ao carrinho\n </a> */}\n </div>\n </div>\n )\n }\n}"],"mappings":"uJAAA,MAAMA,EAA4B,6gCCAlC,MAAMC,EAAkB,k3CACxB,MAAAC,EAAeD,E,MCWFE,EAAY,M,oJAUQ,K,CAE7B,iBAAAC,GACIC,KAAKC,8B,CAGT,4BAAAA,GAEID,KAAKE,OAASC,EAAqBH,KA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AC,IAAA,2CAAGC,MAAM,sBACJM,EAAQC,EAAE,iBAAkB,CAAEZ,aAAcA,IAAe,IAAEG,EAAA,UAAAC,IAAA,kDAAYvC,KAAKoB,YAAW,MAMjGiB,EAAUP,eAAiBO,EAAUX,UAElCY,EAAA,KAAAC,IAAA,2CAAGC,MAAM,wBACJM,EAAQC,EAAE,UAAW,CAAEZ,aAAcA,MAM7CE,EAAUP,cAEPQ,EAAA,OAAAC,IAAA,2CAAKC,MAAM,eACPF,EAAA,KAAAC,IAAA,2CAAGC,MAAM,wBACJM,EAAQC,EAAE,aAEfT,EAAA,cAAAC,IAAA,2CAAYW,OAAO,qBAAqBC,YAAa,IAAMnD,KAAKwB,e","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ import{r as t,h as e}from"./p-3d6152b1.js";const n=class{constructor(e){t(this,e);this.downtime=undefined;this.initialValue=120;this.seconds=30}componentWillLoad(){this.seconds=this.initialValue;this.intervalId=setInterval((()=>{if(this.seconds>0){this.seconds--}else{clearInterval(this.intervalId);this.downtime()}}),1e3)}disconnectedCallback(){clearInterval(this.intervalId)}padLeft(){const t=this.seconds/60;const e=this.seconds%60;if(t<1)return`${e}s`;return`${parseInt(t.toString())}m ${e}s`}render(){return e("label",{key:"3ef46c7cceeb9b7c6e822663ebff0ae54cc07e1d"},this.padLeft())}};const s="input,button{margin:0;padding:10px;}.crm-contaner-button{height:auto;width:auto}.crm-button{height:48px;width:100%;border:1px solid #000;padding:14px 20px;background-color:#000;color:#fff;font-size:14px;line-height:20px;font-weight:500;cursor:pointer}";const i=s;const o=class{constructor(e){t(this,e);this.txtBtn=undefined;this.loading=undefined;this.handleClick=undefined}render(){return e("div",{key:"848df9f754a114343163eae85d34a2acb6b04863",class:"crm-contaner-button"},e("button",{key:"517b761b39ced2615dd04fc42d5aaa98a7d749f6",class:"crm-button",onClick:()=>this.handleClick()},!this.loading?this.txtBtn:e("loading-spinner",{size:"15px",color:"#fff"})))}};o.style=i;export{n as countdown_timer,o as crm_button};
2
+ //# sourceMappingURL=p-5f977af2.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CountdownTimer","componentWillLoad","this","seconds","initialValue","intervalId","setInterval","clearInterval","downtime","disconnectedCallback","padLeft","minutes","parseInt","toString","render","h","key","crmButtonCss","CrmButtonStyle0","Button","class","onClick","handleClick","loading","txtBtn","size","color"],"sources":["src/components/countdown-timer/countdown-timer.tsx","src/components/button/crm-button.css?tag=crm-button","src/components/button/index.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 @Prop() initialValue: number = 120;\n\n @State() seconds: number = 30;\n\n private intervalId: NodeJS.Timer;\n\n componentWillLoad() {\n this.seconds = this.initialValue;\n \n this.intervalId = setInterval(() => {\n if (this.seconds > 0) {\n this.seconds--;\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 padLeft() {\n const minutes = this.seconds / 60; \n const seconds = this.seconds % 60;\n\n if(minutes < 1) return `${seconds}s`\n \n return `${parseInt(minutes.toString())}m ${seconds}s`\n }\n\n render() {\n return (\n <label>{this.padLeft()}</label>\n );\n }\n}\n","input, button {\n margin: 0;\n padding: 10px; /* Ajuste o valor conforme necessário */\n}\n\n.crm-contaner-button {\n height: auto;\n width: auto;\n}\n\n.crm-button {\n height: 48px;\n width: 100%;\n border: 1px solid #000;\n padding: 14px 20px;\n background-color: #000;\n color: #fff;\n font-size: 14px;\n line-height: 20px;\n font-weight: 500;\n cursor: pointer;\n}","import { Component, Prop, h } from \"@stencil/core\";\n\n@Component({\n tag: 'crm-button',\n styleUrl: 'crm-button.css'\n})\nexport class Button {\n\n @Prop() txtBtn: string;\n @Prop() loading: boolean;\n\n @Prop() handleClick: () => void;\n\n render() {\n return (\n <div class=\"crm-contaner-button\">\n <button class=\"crm-button\" onClick={() => this.handleClick()}>\n {\n !this.loading ? this.txtBtn : <loading-spinner size=\"15px\" color=\"#fff\" />\n }\n </button>\n </div>\n )\n }\n}"],"mappings":"iDAMaA,EAAc,M,mEAGQ,I,aAEJ,E,CAI3B,iBAAAC,GACIC,KAAKC,QAAUD,KAAKE,aAEpBF,KAAKG,WAAaC,aAAY,KAC1B,GAAIJ,KAAKC,QAAU,EAAG,CAClBD,KAAKC,S,KACF,CACHI,cAAcL,KAAKG,YAEnBH,KAAKM,U,IAEV,I,CAGP,oBAAAC,GACIF,cAAcL,KAAKG,W,CAGvB,OAAAK,GACI,MAAMC,EAAUT,KAAKC,QAAU,GAC/B,MAAMA,EAAUD,KAAKC,QAAU,GAE/B,GAAGQ,EAAU,EAAG,MAAO,GAAGR,KAE1B,MAAO,GAAGS,SAASD,EAAQE,gBAAgBV,I,CAG/C,MAAAW,GACI,OACIC,EAAA,SAAAC,IAAA,4CAAQd,KAAKQ,U,GC5CzB,MAAMO,EAAe,8PACrB,MAAAC,EAAeD,E,MCKFE,EAAM,M,iGAOf,MAAAL,GACI,OACIC,EAAA,OAAAC,IAAA,2CAAKI,MAAM,uBACPL,EAAA,UAAAC,IAAA,2CAAQI,MAAM,aAAaC,QAAS,IAAMnB,KAAKoB,gBAEtCpB,KAAKqB,QAAUrB,KAAKsB,OAAST,EAAA,mBAAiBU,KAAK,OAAOC,MAAM,U","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import{r as o,h as e}from"./p-3d6152b1.js";import{M as t}from"./p-7cfea8fe.js";const s="*{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}";const i=s;const n=class{constructor(e){o(this,e);this.phone="";this.message="";this.initialValue=undefined;this.disabled=undefined}componentWillLoad(){this.phone=this.initialValue}formatPhone(o){const e=o.replace(/\D/g,"");const t=e.match(/^(\d{0,2})(\d{0,5})(\d{0,4})$/);if(!t)return o;const s=t[1]?`(${t[1]}`:"";const i=t[2]?`) ${t[2]}`:"";const n=t[3]?` ${t[3]}`:"";return`${s}${i}${n}`}handleInput(o){const e=o.target;this.phone=this.formatPhone(e.value);if(!this.validatePhoneNumber(e.value)){this.message=t}else{this.message=""}console.log("phone",this.phone)}validatePhoneNumber(o){if(o.length<15){return true}const e=/^\(\d{2}\) \d{5} \d{4}$/;return e.test(o)}async getPhone(){return this.phone}render(){return e("div",{key:"d2a4ecc86e459dfade16edc01a399fb93819b095"},e("input",{key:"bd13d92a0e897142ff3e74aeefc245b819f7a4c5",disabled:this.disabled,id:"phone",type:"text",class:"phone-input-form",value:this.phone,onInput:o=>this.handleInput(o),placeholder:"(99) 99999 9999"}),e("p",{key:"fbc698847762e15b2449d9657a5f8ff08a3fdd77",class:"crm-erro-msg"},this.message))}};n.style=i;export{n as phone_input_mask};
2
- //# sourceMappingURL=p-9cd20349.entry.js.map
1
+ import{r as o,h as e}from"./p-3d6152b1.js";import{M as t}from"./p-7cfea8fe.js";const s="*{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}";const i=s;const n=class{constructor(e){o(this,e);this.phone="";this.message="";this.initialValue=undefined;this.disabled=undefined}componentWillLoad(){this.phone=this.initialValue}formatPhone(o){const e=o.replace(/\D/g,"");const t=e.match(/^(\d{0,2})(\d{0,5})(\d{0,4})$/);if(!t)return o;const s=t[1]?`(${t[1]}`:"";const i=t[2]?`) ${t[2]}`:"";const n=t[3]?` ${t[3]}`:"";return`${s}${i}${n}`}handleInput(o){const e=o.target;this.phone=this.formatPhone(e.value);if(!this.validatePhoneNumber(e.value)){this.message=t}else{this.message=""}console.log("phone",this.phone)}validatePhoneNumber(o){if(o.length<15){return true}const e=/^\(\d{2}\) \d{5} \d{4}$/;return e.test(o)}async getPhone(){return this.phone}render(){return e("div",{key:"44d9a3f88829cdf269da2ea029ca81197a9ca31e"},e("input",{key:"4af46e5c7eb38f108f3a3b58937b3b5560a0757d",disabled:this.disabled,id:"phone",type:"text",class:"phone-input-form",value:this.phone,onInput:o=>this.handleInput(o),placeholder:"(99) 99999 9999"}),e("p",{key:"5058284a0a7bda9e750cbf4e1134fdc47c7de83e",class:"crm-erro-msg"},this.message))}};n.style=i;export{n as phone_input_mask};
2
+ //# sourceMappingURL=p-620ec1a3.entry.js.map
@@ -1,2 +1,2 @@
1
- import{r as e,c as d,h as a}from"./p-3d6152b1.js";const o=".modal-backdrop{position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0, 0, 0, 0.5);display:none;justify-content:center;align-items:center;z-index:1000}.modal-backdrop.visible{display:flex}.modal{background:white;border-radius:8px;padding:1rem;max-width:500px;width:90%;box-shadow:0 2px 10px rgba(0, 0, 0, 0.3)}.modal-header{display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid #ddd;margin-bottom:1rem}.close-button{background:none;border:none;font-size:1.5rem;cursor:pointer}.modal-body{}";const s=o;const t=class{constructor(a){e(this,a);this.modalClosed=d(this,"modalClosed",7);this.isOpen=false;this.modalTitle=undefined}closeModal(){this.modalClosed.emit()}render(){return a("div",{key:"5c0f884cf7a1cb0b8c6baa883f97d1b045af557d",class:`modal-backdrop ${this.isOpen?"visible":""}`},a("div",{key:"81050ec515bba3b10bf48b2074f0f8edb5327a70",class:"modal"},a("div",{key:"d1265b9172a2783c62bb1679ceecda55e796ca23",class:"modal-header"},a("h3",{key:"24c8ef0db7458ab35a31f76dbe7818b188a0ec00"},this.modalTitle),a("button",{key:"c4c007791e87789c9bf30f34f5fe99d2f6077cb6",class:"close-button",onClick:()=>this.closeModal()},"×")),a("div",{key:"032aa97047f44eb65fcf40dde9700815b8630424",class:"modal-body"},a("slot",{key:"f8287a461cdeda48e868d1dd4eba2ee1bdbf92f3"}))))}};t.style=s;export{t as app_modal};
2
- //# sourceMappingURL=p-5e62b863.entry.js.map
1
+ import{r as e,c as d,h as a}from"./p-3d6152b1.js";const o=".modal-backdrop{position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0, 0, 0, 0.5);display:none;justify-content:center;align-items:center;z-index:1000}.modal-backdrop.visible{display:flex}.modal{background:white;border-radius:8px;padding:1rem;max-width:500px;width:90%;box-shadow:0 2px 10px rgba(0, 0, 0, 0.3)}.modal-header{display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid #ddd;margin-bottom:1rem}.close-button{background:none;border:none;font-size:1.5rem;cursor:pointer}.modal-body{}";const s=o;const t=class{constructor(a){e(this,a);this.modalClosed=d(this,"modalClosed",7);this.isOpen=false;this.modalTitle=undefined}closeModal(){this.modalClosed.emit()}render(){return a("div",{key:"3f44609d2835224eea0668475f6851eab807cfce",class:`modal-backdrop ${this.isOpen?"visible":""}`},a("div",{key:"c7998d2ab6ce04ce722a52712267b0493495cb29",class:"modal"},a("div",{key:"dcc7438d690866d20972f04c6c9ad39f4f2e84da",class:"modal-header"},a("h3",{key:"0257c585eeec3daf72b7b371b557ae699891dba9"},this.modalTitle),a("button",{key:"e0b4f89907a4da774c021bcc3797f5b2fb1f0c0e",class:"close-button",onClick:()=>this.closeModal()},"×")),a("div",{key:"e9efd84c1fd89da8b9df15970b71beae66ea6fb8",class:"modal-body"},a("slot",{key:"6e3371866a4a2adf86a04e30e7a1ed843e7492fb"}))))}};t.style=s;export{t as app_modal};
2
+ //# sourceMappingURL=p-885fc30e.entry.js.map
@@ -0,0 +1,2 @@
1
+ import{r as t,h as s}from"./p-3d6152b1.js";import{C as i}from"./p-c44e2f02.js";import{S as o}from"./p-7cfea8fe.js";import{i as e}from"./p-e8c19a64.js";import"./p-f9aeffc1.js";var a;(function(t){t["P"]="Promocao"})(a||(a={}));function n(t=[]){const s=[];for(const i of t){let t=r(i.Ajustes);s.push({sku:i.SKU,value:i.PrecoPor*i.Quantidade,productVariantId:i.ProdutoVarianteId.toString(),quantity:i.Quantidade,discount:t*-1})}return s}function r(t=[]){let s=0;for(const i of t){if(i.Tipo===a.P){s+=i.Valor}}return s}const c=".container-button.sc-crm-bonus{cursor:pointer;padding:5px 5px 5px 14px}.section-crm.sc-crm-bonus{border:1px solid #dbd4d4;text-align:-webkit-center;margin-bottom:20px}.section-cart-crm.sc-crm-bonus{margin-top:10px}.section-cart-crm.sc-crm-bonus p.sc-crm-bonus{padding:0;margin:0px 0px 0px 15px}.button.sc-crm-bonus{top:50%;background-color:#6c6c7e;color:#fff;border:none;padding:15px;min-height:30px;min-width:120px;font-size:20px;cursor:pointer;margin-left:10px;height:70px}.form-container.sc-crm-bonus{width:97%;display:flex;justify-content:space-around}.btn.sc-crm-bonus{display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-image:none;border:1px solid transparent;border-radius:0px}.form-container.sc-crm-bonus .btnCrm.sc-crm-bonus{background:#00162e;border-color:#00162e;width:30%;color:#fff}.message-alert.sc-crm-bonus{font-family:sans-serif;color:#df4d4d;margin-top:5px}";const h=c;const l=class{constructor(s){t(this,s);this.crmBonusService=i.getInstance();this.showModal=false;this.userId=undefined;this.storeName=undefined;this.productsInString=undefined;this.cartId=undefined;this.products=undefined;this.customer={birthDate:"",document:"",name:"",phone:""};this.loading=false;this.message=undefined;this.phone=undefined;this.canCancel=false;this.amountCancel=undefined;this.sent=undefined;this.session=undefined;this.loading_reprocess=false}async resetBonus(){console.log("[START RESET BONUS]!!!!!");try{await this.crmBonusRef.processBonus(this.buildProducts(),true);console.log("[BONUS RESETADO]!!!!!")}catch(t){this.loading=false;console.log("[error ao reprocessar bonous]");await this.crmBonusRef.setStep(o.STEP_PHONE)}finally{this.loading=false}}async reprocess(t){this.loading_reprocess=true;console.log("[reprocess]");try{console.log("[update products list]");this.productsInString=JSON.stringify(t);await this.handleLoad();await this.resetBonus()}catch(t){console.debug("[watchProducts]",t.message)}finally{this.loading_reprocess=false}}async watchProducts(t){try{console.log("[update products list]");this.productsInString=t;await this.handleLoad();await this.resetBonus()}catch(t){console.debug("[watchProducts]",t.message)}}async componentWillLoad(){e.changeLanguage(e.language);await this.loadSession();await this.loadConfigStore();await this.handleLoad()}async loadConfigStore(){await this.crmBonusService.getCustomization(this.storeName)}async handleLoad(){try{if(this.userId){this.customer=await this.crmBonusService.getCustomer(this.userId,this.storeName);console.log("customer",this.customer)}const t=localStorage.getItem(this.cartId);if(t){this.canCancel=true;this.amountCancel=t}}catch(t){console.log("info customer")}await this.buildAndGetProducts()}async loadSession(){this.session=await this.crmBonusService.getToken(this.storeName);setTimeout((()=>{this.loadSession()}),15e5)}async buildAndGetProducts(){const t=`bc-products:${this.cartId}`;const s={Produtos:[{ProdutoVarianteId:336654,ProdutoId:150139,Nome:"Camiseta All Black",UrlImagem:"https://bycoders.fbitsstatic.net/img/p/336654/336654.jpg?w=100&h=100&v=no-change&qs=ignore",Quantidade:1,PrecoDe:15000.0015,PrecoPor:1.66,Brinde:false,IsDigital:false,PrecoPorComAjustesProduto:0,SKU:"123450",Categoria:"Roupa",CategoriasGoogle:[],Fabricante:"Nike",PrazoEntrega:{Titulo:"",Descricao:"",SegundoTitulo:"",SegundaDescricao:"",PrazoProduto:0},Atributos:[{Nome:"Cor",Valor:"preta",Tipo:0},{Nome:"Tamanho",Valor:"P",Tipo:0}],Metadados:{},Informacoes:[],Recorrencia:null,Url:"https://bycoders.fbits.store/produto/150139",ParcelamentoQuantidade:0,ParcelamentoValor:0,ParcelamentoJuro:false,Valores:[],Ajustes:[{Valor:0,Tipo:"Frete"},{Valor:-.56,Tipo:"Formula"}]}]};this.productsInString=JSON.stringify(s.Produtos);localStorage.setItem(t,this.productsInString);const i=JSON.parse(this.productsInString);const o=JSON.parse(localStorage.getItem(t));const e=[];for(const t of i){const[s]=o.filter((s=>s.ProdutoVarianteId==t.ProdutoVarianteId));const[i={Valor:0}]=s.Ajustes.filter((t=>t.Tipo==="Formula"));if(s){e.push(Object.assign(Object.assign({},t),{PrecoPor:s.PrecoPor+i.Valor*-1,Quantidade:s.Quantidade,Ajustes:s.Ajustes}))}else{e.push(t)}}this.products=e}async sendPin(t){var s,i;this.loading=true;this.message="";try{const s=t.replace(/\D/g,"");this.phone=Number(s);this.sent=await this.crmBonusService.sendPin(this.phone,this.customer.name,this.storeName);await this.crmBonusRef.setStep(o.STEP_PIN);this.showModal=true}catch(t){this.message=(i=(s=t===null||t===void 0?void 0:t.response)===null||s===void 0?void 0:s.data)===null||i===void 0?void 0:i.message}finally{this.loading=false}}async sendPinName(t){var s,i;this.loading=true;this.message="";try{this.customer.name=t;this.sent=await this.crmBonusService.sendPin(this.phone,this.customer.name,this.storeName);await this.crmBonusRef.setStep(o.STEP_PIN);this.showModal=true}catch(t){this.message=(i=(s=t===null||t===void 0?void 0:t.response)===null||s===void 0?void 0:s.data)===null||i===void 0?void 0:i.message}finally{this.loading=false}}buildProducts(){return n(this.products)}handleCloseModal(){this.showModal=false}save(t){localStorage.setItem(this.cartId,t.toString());this.canCancel=true;this.amountCancel=t.toString()}async cancel(){this.message="";this.loading=true;try{await this.crmBonusService.cancel(this.cartId);this.canCancel=false;localStorage.removeItem(this.cartId)}catch(t){this.message="Não consegui cancelar o bônus, tente novamente!"}finally{this.loading=false}}async handleSendPin(t){this.message="";if(!t){this.message="Informe seu telefone";return}this.customer.phone=t;const s=t.replace(/\D/g,"");this.phone=Number(s);if(this.customer.name){return this.sendPin(t)}await this.crmBonusRef.setStep(o.STEP_NAME);this.showModal=true}render(){return s("loading-container",{key:"aafefed6f772b13dafd38918a7ea6c044af5ffef",loading:this.loading_reprocess},s("crm-giftback-form",{key:"4d63961108618f545154e4c0b7a21eafa5fc91c4",style:{position:"relative"},ref:t=>this.crmBonusRef=t,storeName:this.storeName,products:this.buildProducts(),cartId:this.cartId,customer:this.customer,loadProducts:()=>this.buildProducts()}))}static get assetsDirs(){return["assets"]}static get watchers(){return{productsInString:["watchProducts"]}}};l.style=h;export{l as crm_bonus};
2
+ //# sourceMappingURL=p-a010961a.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["AjustesTipoEnum","buildProductsByWake","productsWake","products","pw","discounts","getDiscount","Ajustes","push","sku","SKU","value","PrecoPor","Quantidade","productVariantId","ProdutoVarianteId","toString","quantity","discount","ajustes","Tipo","P","Valor","crmBonusCss","CrmBonusStyle0","CrmBonus","this","crmBonusService","CrmBonusService","getInstance","birthDate","document","name","phone","resetBonus","console","log","crmBonusRef","processBonus","buildProducts","err","loading","setStep","StepFormEnum","STEP_PHONE","reprocess","loading_reprocess","productsInString","JSON","stringify","handleLoad","debug","message","watchProducts","newValue","componentWillLoad","i18next","changeLanguage","language","loadSession","loadConfigStore","getCustomization","storeName","userId","customer","getCustomer","amount","localStorage","getItem","cartId","canCancel","amountCancel","error","buildAndGetProducts","session","getToken","setTimeout","key","cart","Produtos","ProdutoId","Nome","UrlImagem","PrecoDe","Brinde","IsDigital","PrecoPorComAjustesProduto","Categoria","CategoriasGoogle","Fabricante","PrazoEntrega","Titulo","Descricao","SegundoTitulo","SegundaDescricao","PrazoProduto","Atributos","Metadados","Informacoes","Recorrencia","Url","ParcelamentoQuantidade","ParcelamentoValor","ParcelamentoJuro","Valores","setItem","productsInCart","parse","products_in_cache","product_cart","pro","filter","p","ajuste","aj","Object","assign","sendPin","_phone","replace","Number","sent","STEP_PIN","showModal","_b","_a","response","data","sendPinName","customerName","handleCloseModal","save","cancel","removeItem","handleSendPin","STEP_NAME","render","h","style","position","ref","loadProducts"],"sources":["src/dto/validate.pin.bonus.ts","src/helpers/build.payload.helper.ts","src/components/crm-bonus/crm-bonus.css?tag=crm-bonus&encapsulation=scoped","src/components/crm-bonus/crm-bonus.tsx"],"sourcesContent":["export interface IProduct {\n productVariantId: string;\n sku: string;\n value: number;\n quantity: number;\n discount: number;\n}\n\nexport enum AjustesTipoEnum {\n P = \"Promocao\" \n}\n\nexport interface IAjustes {\n Tipo: AjustesTipoEnum;\n Valor: number;\n}\n\nexport interface IProductWake {\n ProdutoVarianteId: number;\n SKU: string;\n PrecoPor: number;\n Quantidade: number;\n Ajustes: IAjustes[];\n}\n\nexport interface ICustomer {\n birthDate: string;\n document: string;\n name: string;\n phone: string;\n}\n\nexport interface IProccesPinBonusDto {\n storeName: string;\n name: string;\n checkoutId: string;\n checkoutProducts: Array<IProduct>;\n storeId: string;\n userId: string;\n cellphone: number;\n pin: string;\n\n}\n\nexport interface IBonus {\n hasBonus: boolean;\n bonusBalance: number;\n totalBonus: number;\n minimumPurchase: number;\n bonusIds: string;\n firstValidityDate: string\n history: [\n {\n validityStart: string;\n validityEnd: string;\n value: number\n },\n {\n validityStart: string;\n validityEnd: string\n value: number\n }\n ]\n storeId: number;\n userId: number;\n cartId: string\n calculatedValue: number;\n totalValue: number\n}\n\n\nexport interface IReserveDTO {\n storeName: string;\n cartId: string;\n grossValue: number;\n redeemedBonus: number;\n ticket: string;\n storeId: string;\n userId: number;\n}","import { AjustesTipoEnum, IAjustes, IProduct, IProductWake } from \"../dto/validate.pin.bonus\";\n\nexport function buildProductsByWake(productsWake: Array<IProductWake> = []): Array<IProduct> {\n\n const products: Array<IProduct> = [];\n\n for ( const pw of productsWake ) {\n let discounts = getDiscount(pw.Ajustes)\n\n products.push(\n {\n sku: pw.SKU,\n value: (pw.PrecoPor * pw.Quantidade),\n productVariantId: pw.ProdutoVarianteId.toString(),\n quantity: pw.Quantidade,\n discount: (discounts * -1)\n }\n )\n }\n\n return products;\n}\n\nfunction getDiscount(ajustes: IAjustes[] = []) {\n \n let discounts = 0;\n \n for(const discount of ajustes) {\n if(discount.Tipo === AjustesTipoEnum.P) {\n discounts += discount.Valor;\n }\n }\n\n return discounts;\n}","\n.container-button {\n /* max-width: 100%; */\n cursor: pointer;\n padding: 5px 5px 5px 14px;\n /* display: flex; */\n}\n\n/* padding: 0 15px 15px;\nborder: 1px solid #ddd;\nmargin-bottom: 20px; */\n\n.section-crm {\n border: 1px solid #dbd4d4;\n /* min-height: 50px; */\n text-align: -webkit-center;\n margin-bottom: 20px;\n}\n\n.section-cart-crm {\n margin-top: 10px;\n}\n\n.section-cart-crm p {\n padding: 0;\n margin: 0px 0px 0px 15px;\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 margin-left: 10px;\n height: 70px;\n}\n\n.form-container {\n width: 97%;\n display: flex;\n justify-content: space-around;\n}\n\n\n.btn {\n display: inline-block;\n padding: 6px 12px;\n margin-bottom: 0;\n font-size: 14px;\n font-weight: 400;\n line-height: 1.42857143;\n text-align: center;\n white-space: nowrap;\n vertical-align: middle;\n -ms-touch-action: manipulation;\n touch-action: manipulation;\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n background-image: none;\n border: 1px solid transparent;\n border-radius: 0px;\n}\n\n.form-container .btnCrm {\n background: #00162e;\n border-color: #00162e;\n width: 30%;\n color: #fff;\n}\n\n.message-alert {\n font-family: sans-serif;\n color: #df4d4d;\n margin-top: 5px;\n}","import { Component, Method, Prop, State, Watch, h } from '@stencil/core';\nimport { IProduct, IProductWake, ICustomer } from '../../dto/validate.pin.bonus';\nimport { CrmBonusService } from '../../services/crmbonus.service';\nimport { IPinSent } from '../../components';\nimport { StepFormEnum } from '../../contants';\n\nimport i18next from '../../i18n/i18n'\nimport { buildProductsByWake } from '../../helpers/build.payload.helper';\n\n@Component({\n tag: 'crm-bonus',\n styleUrl: 'crm-bonus.css',\n scoped: true,\n assetsDirs: ['assets']\n})\nexport class CrmBonus {\n\n private crmBonusService: CrmBonusService = CrmBonusService.getInstance();\n\n private crmBonusRef: HTMLCrmGiftbackFormElement;\n\n @State() showModal: boolean = false;\n @Prop({ attribute: 'userid' }) userId: number;\n @Prop({ attribute: 'storename' }) storeName;\n @Prop({ attribute: 'products' }) productsInString: string;\n @Prop({ attribute: 'cartid' }) cartId;\n\n @State() products: Array<IProductWake>;\n @State() customer: ICustomer = {\n birthDate: \"\",\n document: \"\",\n name: \"\",\n phone: \"\"\n };\n\n @State() loading: boolean = false;\n @State() message: string;\n @State() phone: number;\n @State() canCancel: boolean = false;\n @State() amountCancel: string;\n @State() sent: IPinSent;\n\n @State() session: string;\n @State() loading_reprocess = false;\n\n @Method()\n async resetBonus() {\n console.log('[START RESET BONUS]!!!!!');\n // const used = localStorage.getItem(\"bc:used\");\n\n // if (used == \"use\") {\n // await this.crmBonusService.cancelBonus(this.cartId, this.storeName);\n // }\n\n try {\n await this.crmBonusRef.processBonus(this.buildProducts(), true);\n console.log('[BONUS RESETADO]!!!!!');\n } catch (err) {\n\n this.loading = false;\n console.log('[error ao reprocessar bonous]');\n await this.crmBonusRef.setStep(StepFormEnum.STEP_PHONE);\n } finally {\n this.loading = false;\n }\n }\n\n @Method()\n async reprocess(products: Array<any>) {\n this.loading_reprocess = true\n\n console.log('[reprocess]');\n try {\n console.log('[update products list]');\n this.productsInString = JSON.stringify(products);\n await this.handleLoad();\n\n await this.resetBonus();\n } catch (err) {\n console.debug('[watchProducts]', err.message);\n } finally {\n this.loading_reprocess = false\n }\n }\n\n @Watch(\"productsInString\")\n async watchProducts(newValue: string) {\n try {\n console.log('[update products list]');\n this.productsInString = newValue;\n await this.handleLoad();\n\n await this.resetBonus();\n } catch (err) {\n console.debug('[watchProducts]', err.message);\n }\n }\n\n async componentWillLoad() {\n i18next.changeLanguage(i18next.language);\n\n await this.loadSession();\n await this.loadConfigStore()\n await this.handleLoad();\n }\n\n async loadConfigStore() {\n await this.crmBonusService.getCustomization(this.storeName);\n }\n\n async handleLoad() {\n try {\n if (this.userId) {\n this.customer = await this.crmBonusService.getCustomer(this.userId, this.storeName);\n console.log('customer', this.customer);\n }\n\n const amount = localStorage.getItem(this.cartId);\n\n if (amount) {\n this.canCancel = true;\n this.amountCancel = amount;\n }\n\n } catch (error) {\n console.log('info customer')\n }\n\n await this.buildAndGetProducts();\n }\n\n\n async loadSession() {\n this.session = await this.crmBonusService.getToken(this.storeName);\n\n setTimeout(() => {\n this.loadSession()\n }, 1500000)\n\n }\n\n async buildAndGetProducts() {\n \n const key = `bc-products:${this.cartId}`;\n\n const cart = {Produtos: [{\"ProdutoVarianteId\":336654,\"ProdutoId\":150139,\"Nome\":\"Camiseta All Black\",\"UrlImagem\":\"https://bycoders.fbitsstatic.net/img/p/336654/336654.jpg?w=100&h=100&v=no-change&qs=ignore\",\"Quantidade\":1,\"PrecoDe\":15000.0015,\"PrecoPor\":1.66,\"Brinde\":false,\"IsDigital\":false,\"PrecoPorComAjustesProduto\":0,\"SKU\":\"123450\",\"Categoria\":\"Roupa\",\"CategoriasGoogle\":[],\"Fabricante\":\"Nike\",\"PrazoEntrega\":{\"Titulo\":\"\",\"Descricao\":\"\",\"SegundoTitulo\":\"\",\"SegundaDescricao\":\"\",\"PrazoProduto\":0},\"Atributos\":[{\"Nome\":\"Cor\",\"Valor\":\"preta\",\"Tipo\":0},{\"Nome\":\"Tamanho\",\"Valor\":\"P\",\"Tipo\":0}],\"Metadados\":{},\"Informacoes\":[],\"Recorrencia\":null,\"Url\":\"https://bycoders.fbits.store/produto/150139\",\"ParcelamentoQuantidade\":0,\"ParcelamentoValor\":0,\"ParcelamentoJuro\":false,\"Valores\":[],\"Ajustes\":[{\"Valor\":0,\"Tipo\":\"Frete\"},{\"Valor\":-0.56,\"Tipo\":\"Formula\"}]}]} //await this.crmBonusService.getInfoCart();\n\n this.productsInString = JSON.stringify(cart.Produtos)\n\n localStorage.setItem(key, this.productsInString);\n\n const productsInCart = JSON.parse(this.productsInString);\n const products_in_cache = JSON.parse(localStorage.getItem(key));\n\n const products: Array<IProductWake> = []\n\n for (const product_cart of productsInCart) {\n\n const [pro] = products_in_cache.filter(p => p.ProdutoVarianteId == product_cart.ProdutoVarianteId)\n\n const [ ajuste = { Valor:0 } ] = pro.Ajustes.filter( aj => aj.Tipo === \"Formula\" )\n\n if (pro) {\n products.push({\n ...product_cart,\n PrecoPor: pro.PrecoPor + (ajuste.Valor * -1),\n Quantidade: pro.Quantidade,\n Ajustes: pro.Ajustes\n })\n } else {\n products.push(product_cart)\n }\n\n }\n\n this.products = products; //cache_products ? JSON.parse(cache_products) : JSON.parse(this.productsInString);\n\n }\n\n public async sendPin(phone: string) {\n this.loading = true;\n this.message = \"\";\n\n try {\n\n const _phone = phone.replace(/\\D/g, '');\n this.phone = Number(_phone);\n\n this.sent = await this.crmBonusService.sendPin(this.phone, this.customer.name, this.storeName);;\n\n await this.crmBonusRef.setStep(StepFormEnum.STEP_PIN);\n\n this.showModal = true;\n } catch (error) {\n this.message = error?.response?.data?.message\n } finally {\n this.loading = false\n }\n }\n\n public async sendPinName(customerName: string) {\n this.loading = true;\n this.message = \"\";\n\n try {\n this.customer.name = customerName;\n\n this.sent = await this.crmBonusService.sendPin(this.phone, this.customer.name, this.storeName);;\n\n await this.crmBonusRef.setStep(StepFormEnum.STEP_PIN);\n\n this.showModal = true;\n } catch (error) {\n this.message = error?.response?.data?.message\n } finally {\n this.loading = false\n }\n }\n\n buildProducts(): IProduct[] {\n return buildProductsByWake(this.products);\n }\n\n handleCloseModal() {\n this.showModal = false;\n }\n\n save(amount: number) {\n localStorage.setItem(this.cartId, amount.toString());\n this.canCancel = true;\n this.amountCancel = amount.toString()\n }\n\n async cancel() {\n this.message = \"\";\n this.loading = true;\n try {\n await this.crmBonusService.cancel(this.cartId);\n this.canCancel = false;\n\n localStorage.removeItem(this.cartId);\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 async handleSendPin(phone: string) {\n this.message = \"\"\n if (!phone) {\n this.message = \"Informe seu telefone\";\n return;\n }\n\n this.customer.phone = phone;\n const _phone = phone.replace(/\\D/g, '');\n this.phone = Number(_phone);\n\n if (this.customer.name) {\n return this.sendPin(phone)\n }\n\n await this.crmBonusRef.setStep(StepFormEnum.STEP_NAME);\n this.showModal = true;\n }\n\n render() {\n\n return (\n <loading-container loading={this.loading_reprocess} >\n <crm-giftback-form\n style={{ position: \"relative\" }}\n ref={ref => this.crmBonusRef = ref}\n storeName={this.storeName}\n products={this.buildProducts()}\n cartId={this.cartId}\n customer={this.customer}\n loadProducts={() => this.buildProducts()}\n \n />\n </loading-container>\n )\n }\n}\n"],"mappings":"+KAQA,IAAYA,GAAZ,SAAYA,GACRA,EAAA,eACH,EAFD,CAAYA,MAAe,K,SCNXC,EAAoBC,EAAoC,IAEpE,MAAMC,EAA4B,GAElC,IAAM,MAAMC,KAAMF,EAAe,CAC7B,IAAIG,EAAYC,EAAYF,EAAGG,SAE/BJ,EAASK,KACL,CACIC,IAAKL,EAAGM,IACRC,MAAQP,EAAGQ,SAAWR,EAAGS,WACzBC,iBAAkBV,EAAGW,kBAAkBC,WACvCC,SAAUb,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AAKoC,UAChB3D,SAAUuB,KAAKa,gBACf8B,OAAQ3C,KAAK2C,OACbL,SAAUtC,KAAKsC,SACf6E,aAAc,IAAMnH,KAAKa,kB","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import{r as t,h as s}from"./p-3d6152b1.js";import{C as i}from"./p-c44e2f02.js";import"./p-f9aeffc1.js";const o=class{constructor(s){t(this,s);this.cartId=undefined;this.orderId=undefined;this.metadadoString=undefined}async componentWillLoad(){const t=this.metadadoString?JSON.parse(this.metadadoString):{id:null};if(this.cartId&&this.orderId){i.getInstance().updateOrder({cartId:this.cartId,orderId:this.orderId,cartIdCrm:t.id});const s=`bc-products:${this.cartId}`;localStorage.removeItem(s);localStorage.removeItem(this.cartId)}}render(){return s("div",{key:"5994a82fbeedcc73980f628f0dea243fb0172c86"})}};export{o as pedido_finalizado};
2
- //# sourceMappingURL=p-10f6923a.entry.js.map
1
+ import{r as t,h as s}from"./p-3d6152b1.js";import{C as i}from"./p-c44e2f02.js";import"./p-f9aeffc1.js";const o=class{constructor(s){t(this,s);this.cartId=undefined;this.orderId=undefined;this.metadadoString=undefined}async componentWillLoad(){const t=this.metadadoString?JSON.parse(this.metadadoString):{id:null};if(this.cartId&&this.orderId){i.getInstance().updateOrder({cartId:this.cartId,orderId:this.orderId,cartIdCrm:t.id});const s=`bc-products:${this.cartId}`;localStorage.removeItem(s);localStorage.removeItem(this.cartId)}}render(){return s("div",{key:"6796f6e91c7e0ca6ea1d6c6bb4dc8297c531988b"})}};export{o as pedido_finalizado};
2
+ //# sourceMappingURL=p-b873347f.entry.js.map
@@ -1,2 +1,2 @@
1
- import{r,h as s}from"./p-3d6152b1.js";const t=".spinner{display:inline-block;border:4px solid transparent;border-radius:50%;border-top-color:var(--color, #0078d7);animation:spin 1s linear infinite}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";const n=t;const e=class{constructor(s){r(this,s);this.size="50px";this.color="#0078d7"}render(){return s("div",{key:"647c9d808116de9492a829deccae3bf69318c437",class:"spinner",style:{width:this.size,height:this.size,borderColor:`${this.color} transparent transparent transparent`}})}};e.style=n;export{e as loading_spinner};
2
- //# sourceMappingURL=p-53c1694c.entry.js.map
1
+ import{r,h as s}from"./p-3d6152b1.js";const t=".spinner{display:inline-block;border:4px solid transparent;border-radius:50%;border-top-color:var(--color, #0078d7);animation:spin 1s linear infinite}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";const n=t;const e=class{constructor(s){r(this,s);this.size="50px";this.color="#0078d7"}render(){return s("div",{key:"148b1ced74314541178bf725d205e8271b682335",class:"spinner",style:{width:this.size,height:this.size,borderColor:`${this.color} transparent transparent transparent`}})}};e.style=n;export{e as loading_spinner};
2
+ //# sourceMappingURL=p-be3ddacc.entry.js.map
@@ -14,7 +14,7 @@ const AppModal = class {
14
14
  this.modalClosed.emit();
15
15
  }
16
16
  render() {
17
- return (h("div", { key: '5c0f884cf7a1cb0b8c6baa883f97d1b045af557d', class: `modal-backdrop ${this.isOpen ? 'visible' : ''}` }, h("div", { key: '81050ec515bba3b10bf48b2074f0f8edb5327a70', class: "modal" }, h("div", { key: 'd1265b9172a2783c62bb1679ceecda55e796ca23', class: "modal-header" }, h("h3", { key: '24c8ef0db7458ab35a31f76dbe7818b188a0ec00' }, this.modalTitle), h("button", { key: 'c4c007791e87789c9bf30f34f5fe99d2f6077cb6', class: "close-button", onClick: () => this.closeModal() }, "\u00D7")), h("div", { key: '032aa97047f44eb65fcf40dde9700815b8630424', class: "modal-body" }, h("slot", { key: 'f8287a461cdeda48e868d1dd4eba2ee1bdbf92f3' })))));
17
+ return (h("div", { key: '3f44609d2835224eea0668475f6851eab807cfce', class: `modal-backdrop ${this.isOpen ? 'visible' : ''}` }, h("div", { key: 'c7998d2ab6ce04ce722a52712267b0493495cb29', class: "modal" }, h("div", { key: 'dcc7438d690866d20972f04c6c9ad39f4f2e84da', class: "modal-header" }, h("h3", { key: '0257c585eeec3daf72b7b371b557ae699891dba9' }, this.modalTitle), h("button", { key: 'e0b4f89907a4da774c021bcc3797f5b2fb1f0c0e', class: "close-button", onClick: () => this.closeModal() }, "\u00D7")), h("div", { key: 'e9efd84c1fd89da8b9df15970b71beae66ea6fb8', class: "modal-body" }, h("slot", { key: '6e3371866a4a2adf86a04e30e7a1ed843e7492fb' })))));
18
18
  }
19
19
  };
20
20
  AppModal.style = AppModalStyle0;
@@ -0,0 +1,55 @@
1
+ import { r as registerInstance, h } from './index-e8724c8f.js';
2
+
3
+ const CountdownTimer = class {
4
+ constructor(hostRef) {
5
+ registerInstance(this, hostRef);
6
+ this.downtime = undefined;
7
+ this.initialValue = 120;
8
+ this.seconds = 30;
9
+ }
10
+ componentWillLoad() {
11
+ this.seconds = this.initialValue;
12
+ this.intervalId = setInterval(() => {
13
+ if (this.seconds > 0) {
14
+ this.seconds--;
15
+ }
16
+ else {
17
+ clearInterval(this.intervalId);
18
+ this.downtime();
19
+ }
20
+ }, 1000); // Intervalo de 1 segundo
21
+ }
22
+ disconnectedCallback() {
23
+ clearInterval(this.intervalId);
24
+ }
25
+ padLeft() {
26
+ const minutes = this.seconds / 60;
27
+ const seconds = this.seconds % 60;
28
+ if (minutes < 1)
29
+ return `${seconds}s`;
30
+ return `${parseInt(minutes.toString())}m ${seconds}s`;
31
+ }
32
+ render() {
33
+ return (h("label", { key: '3ef46c7cceeb9b7c6e822663ebff0ae54cc07e1d' }, this.padLeft()));
34
+ }
35
+ };
36
+
37
+ const crmButtonCss = "input,button{margin:0;padding:10px;}.crm-contaner-button{height:auto;width:auto}.crm-button{height:48px;width:100%;border:1px solid #000;padding:14px 20px;background-color:#000;color:#fff;font-size:14px;line-height:20px;font-weight:500;cursor:pointer}";
38
+ const CrmButtonStyle0 = crmButtonCss;
39
+
40
+ const Button = class {
41
+ constructor(hostRef) {
42
+ registerInstance(this, hostRef);
43
+ this.txtBtn = undefined;
44
+ this.loading = undefined;
45
+ this.handleClick = undefined;
46
+ }
47
+ render() {
48
+ return (h("div", { key: '848df9f754a114343163eae85d34a2acb6b04863', class: "crm-contaner-button" }, h("button", { key: '517b761b39ced2615dd04fc42d5aaa98a7d749f6', class: "crm-button", onClick: () => this.handleClick() }, !this.loading ? this.txtBtn : h("loading-spinner", { size: "15px", color: "#fff" }))));
49
+ }
50
+ };
51
+ Button.style = CrmButtonStyle0;
52
+
53
+ export { CountdownTimer as countdown_timer, Button as crm_button };
54
+
55
+ //# sourceMappingURL=countdown-timer_2.entry.js.map
@@ -0,0 +1 @@
1
+ {"file":"countdown-timer.crm-button.entry.js","mappings":";;MAMa,cAAc;;;;4BAGQ,GAAG;uBAEP,EAAE;;IAI7B,iBAAiB;QACb,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC;QAEjC,IAAI,CAAC,UAAU,GAAG,WAAW,CAAC;YAC1B,IAAI,IAAI,CAAC,OAAO,GAAG,CAAC,EAAE;gBAClB,IAAI,CAAC,OAAO,EAAE,CAAC;aAClB;iBAAM;gBACH,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;gBAE/B,IAAI,CAAC,QAAQ,EAAE,CAAA;aAClB;SACJ,EAAE,IAAI,CAAC,CAAC;KACZ;IAED,oBAAoB;QAChB,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;KAClC;IAED,OAAO;QACH,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAElC,IAAG,OAAO,GAAG,CAAC;YAAE,OAAO,GAAG,OAAO,GAAG,CAAA;QAEpC,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,OAAO,GAAG,CAAA;KACxD;IAED,MAAM;QACF,QACI,gEAAQ,IAAI,CAAC,OAAO,EAAE,CAAS,EACjC;KACL;;;AC9CL,MAAM,YAAY,GAAG,6PAA6P,CAAC;AACnR,wBAAe,YAAY;;MCKd,MAAM;;;;;;;IAOf,MAAM;QACF,QACI,4DAAK,KAAK,EAAC,qBAAqB,IAC5B,+DAAQ,KAAK,EAAC,YAAY,EAAC,OAAO,EAAE,MAAM,IAAI,CAAC,WAAW,EAAE,IAEpD,CAAC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,GAAG,uBAAiB,IAAI,EAAC,MAAM,EAAC,KAAK,EAAC,MAAM,GAAG,CAEzE,CACP,EACT;KACJ;;;;;;","names":[],"sources":["src/components/countdown-timer/countdown-timer.tsx","src/components/button/crm-button.css?tag=crm-button","src/components/button/index.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 @Prop() initialValue: number = 120;\n\n @State() seconds: number = 30;\n\n private intervalId: NodeJS.Timer;\n\n componentWillLoad() {\n this.seconds = this.initialValue;\n \n this.intervalId = setInterval(() => {\n if (this.seconds > 0) {\n this.seconds--;\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 padLeft() {\n const minutes = this.seconds / 60; \n const seconds = this.seconds % 60;\n\n if(minutes < 1) return `${seconds}s`\n \n return `${parseInt(minutes.toString())}m ${seconds}s`\n }\n\n render() {\n return (\n <label>{this.padLeft()}</label>\n );\n }\n}\n","input, button {\n margin: 0;\n padding: 10px; /* Ajuste o valor conforme necessário */\n}\n\n.crm-contaner-button {\n height: auto;\n width: auto;\n}\n\n.crm-button {\n height: 48px;\n width: 100%;\n border: 1px solid #000;\n padding: 14px 20px;\n background-color: #000;\n color: #fff;\n font-size: 14px;\n line-height: 20px;\n font-weight: 500;\n cursor: pointer;\n}","import { Component, Prop, h } from \"@stencil/core\";\n\n@Component({\n tag: 'crm-button',\n styleUrl: 'crm-button.css'\n})\nexport class Button {\n\n @Prop() txtBtn: string;\n @Prop() loading: boolean;\n\n @Prop() handleClick: () => void;\n\n render() {\n return (\n <div class=\"crm-contaner-button\">\n <button class=\"crm-button\" onClick={() => this.handleClick()}>\n {\n !this.loading ? this.txtBtn : <loading-spinner size=\"15px\" color=\"#fff\" />\n }\n </button>\n </div>\n )\n }\n}"],"version":3}
@@ -16,6 +16,7 @@ const CrmBonusNote = class {
16
16
  this.url = undefined;
17
17
  this.config = undefined;
18
18
  this.bonus = undefined;
19
+ this.showEdit = false;
19
20
  }
20
21
  componentWillLoad() {
21
22
  this.upadateCheckToFreteAndGetUrl();
@@ -49,7 +50,6 @@ const CrmBonusNote = class {
49
50
  };
50
51
  if (_bonus) {
51
52
  this.bonus = JSON.parse(_bonus);
52
- console.log("bonus", this.bonus);
53
53
  info.hasBonus = this.bonus.hasBonus;
54
54
  info.requestBonus = true;
55
55
  }
@@ -58,10 +58,10 @@ const CrmBonusNote = class {
58
58
  render() {
59
59
  const giftbackname = this.config.giftbackTitle || "Giftback";
60
60
  const infobonus = this.hasBonus();
61
- return (h("div", { key: 'dadcd7773ddc22edc998bc9874f528063d2385b9' }, h("div", { key: 'c4f9ec03a00015d11ca2478a2363b77436c0b6c3', class: "note-container" }, h("div", { key: '105ffdb9fffccdd463be397b76cf0a076657af91', class: "note-header" }, h("p", { key: '6eafef1a4ded3c0b9d5bf37b21a4e184af31948f', class: "note-title" }, h("img", { key: '7ee9a33773fa4d550aeb6ae9c32f49744a091d2f', src: moneyDollarsSvgrepoComSvg, width: 23 }), this.config.giftbackTitle), infobonus.hasBonus && (h("p", { key: '2250436629c1ea34455ed1540f2842db76896066', class: "back-cart", onClick: () => this.backCart() }, instance.t("edit")))), infobonus.hasBonus &&
62
- (h("p", { key: 'eba4a532b0ec5bf5e355ffb51750c0a2e0437f34', class: "note-description-2" }, instance.t("withApplyBonus", { giftbackname: giftbackname }), " ", h("strong", { key: '54a09e84dd38a4b236e6c92611d00fd0ad3fbea2' }, "R$ ", this.getAmount(), "."))), (infobonus.requestBonus && !infobonus.hasBonus) &&
63
- (h("p", { key: '4a01a4843b9a8dce9e6570000f116bd6c9d76a13', class: "note-description-not" }, instance.t("noBonus", { giftbackname: giftbackname }))), !infobonus.requestBonus &&
64
- (h("div", { key: '7fbe1b45f578fdb6b8e94735b1af08dd36925acb', class: "description" }, h("p", { key: 'dd8e5c4a48fb8ca18653f56c2afaaeae6da1c88e', class: "note-description-not" }, instance.t("backCart")), h("crm-button", { key: '0fb903030f7562c0b3a21d977086e5818718d624', txtBtn: "VOLTAR AO CARRINHO", handleClick: () => this.backCart() }))))));
61
+ return (h("div", { key: 'e918536bb1517ee22a4572ce74988306dbe31f01' }, h("div", { key: '958b56abdbe364f70377cd7476ffd893f80630cb', class: "note-container" }, h("div", { key: 'e79c47ec7000d74af61f794d583faef06d65e812', class: "note-header" }, h("p", { key: 'd15eba4e26c6091729f0b5d41bfd702d2fdb6f04', class: "note-title" }, h("img", { key: 'de5ab8deca48cea53f30923ba9cbc5f1bec90d44', src: moneyDollarsSvgrepoComSvg, width: 23 }), this.config.giftbackTitle), infobonus.hasBonus && (h("div", { key: 'a14dee6357f4f39de1019b9cf0b8886430342bb2' }, this.showEdit && (h("p", { key: '3f86785606b8fa9571283f2ef93011673194ce90', class: "back-cart", onClick: () => this.backCart() }, instance.t("edit"))), !this.showEdit && h("countdown-timer", { key: '9d808c66eb2d9f6d443f1a5ecf88733ce22a2445', initialValue: 60, downtime: () => { this.showEdit = true; } })))), infobonus.hasBonus &&
62
+ (h("p", { key: 'eaca502ac377289c1592fa2316c9c474e464d69d', class: "note-description-2" }, instance.t("withApplyBonus", { giftbackname: giftbackname }), " ", h("strong", { key: '298bcd621c6ce2a952853dd4d6ec205b183a1e9c' }, "R$ ", this.getAmount(), "."))), (infobonus.requestBonus && !infobonus.hasBonus) &&
63
+ (h("p", { key: '20326607c5c74cc97dfb6fcb81e9e85ade2ae474', class: "note-description-not" }, instance.t("noBonus", { giftbackname: giftbackname }))), !infobonus.requestBonus &&
64
+ (h("div", { key: 'faaefcec481ec5ca21bac021003f13f3f5f6cf54', class: "description" }, h("p", { key: 'a95c95602fdb8e4734d783b6af1d2918adbb5aff', class: "note-description-not" }, instance.t("backCart")), h("crm-button", { key: '95a8bac95b5eb843005990e7fb01318d99efaaee', txtBtn: "VOLTAR AO CARRINHO", handleClick: () => this.backCart() }))))));
65
65
  }
66
66
  };
67
67
  CrmBonusNote.style = CrmBonusNoteStyle0;
@@ -1 +1 @@
1
- {"file":"crm-bonus-note.entry.js","mappings":";;;;;AAAA,MAAM,yBAAyB,GAAG,4gCAA4gC;;ACA9iC,MAAM,eAAe,GAAG,i3CAAi3C,CAAC;AAC14C,2BAAe,eAAe;;MCWjB,YAAY;;;;;;;;;IAUrB,iBAAiB;QACb,IAAI,CAAC,4BAA4B,EAAE,CAAA;KACtC;IAED,4BAA4B;QAExB,IAAI,CAAC,MAAM,GAAG,oBAAoB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACnD,MAAM,MAAM,GAAG,QAAQ,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC;QACzD,MAAM,CAAC,OAAO,CAAC,CAAC,KAAU;YACtB,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC;SACzB,CAAC,CAAC;QAEH,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;KACrC;IAED,UAAU;QACN,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACjD,OAAO,CAAC,CAAC,MAAM,CAAC;KACnB;IAED,SAAS;QACL,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAEjD,OAAO,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,MAAM,GAAG,MAAM,CAAC;KAClF;IAED,MAAM,QAAQ;;QAEV,MAAM,CA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C,OAAE,wEAAY,IAAI,CAAC,SAAS,EAAE,MAAW,CACrG,CACP,EAID,CAAC,SAAS,CAAC,YAAY,IAAI,CAAC,SAAS,CAAC,QAAQ;aAE1C,0DAAG,KAAK,EAAC,sBAAsB,IAC1BA,QAAO,CAAC,CAAC,CAAC,SAAS,EAAE,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC,CACrD,CACP,EAID,CAAC,SAAS,CAAC,YAAY;aAEnB,4DAAK,KAAK,EAAC,aAAa,IACpB,0DAAG,KAAK,EAAC,sBAAsB,IAC1BA,QAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CACtB,EACJ,mEAAY,MAAM,EAAC,oBAAoB,EAAC,WAAW,EAAE,MAAO,IAAI,CAAC,QAAQ,EAAE,GAAI,CAC7E,CACT,CAMH,CACJ,EACT;KACJ;;;;;;","names":["money","i18next"],"sources":["src/assets/svg/money-dollars-svgrepo-com.svg","src/components/note/crm-bonus-note.css?tag=crm-bonus-note","src/components/note/crm-bonus-note.tsx"],"sourcesContent":["<?xml version=\"1.0\" encoding=\"utf-8\"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->\n<svg width=\"800px\" height=\"800px\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<circle cx=\"12\" cy=\"12\" r=\"10\" stroke=\"#000000\" stroke-width=\"2\"/>\n<path d=\"M15 9.94728C14.5 9.3 13.8 8.5 12 8.5C10.2 8.5 9 9.51393 9 9.94728C9 10.3806 9.06786 10.9277 10 11.5C10.7522 11.9618 12.6684 12.0439 13.5 12.5C14.679 13.1467 14.8497 13.8202 14.8497 14.0522C14.8497 14.6837 13.4175 15.4852 12 15.5C10.536 15.5153 9.5 14.7 9 14.0522\" stroke=\"#000000\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 7V17\" stroke=\"#000000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>",".note-container {\n border: 1px solid #dddddd;\n padding: 0 15px 15px;\n margin: 0 0 26px 0px;\n display: flex;\n flex-direction: column;\n gap: 13px;\n\n\n & .description {\n display: flex;\n flex-direction: column;\n gap: 13px;\n }\n}\n\n.note-container hr {\n border: 1px solid #CCC;\n}\n\n.note-container .back-cart {\n display: flex;\n text-align: center;\n}\n\n.note-header {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n}\n\n.note-title {\n font-weight: 700;\n text-align: left;\n display: flex;\n gap: 6px;\n align-items: center;\n margin-top: 11px;\n color: #000;\n}\n\n.note-description {\n font-family: Arial;\n color: #6d6d5f;\n padding: 0;\n margin: 0 auto;\n}\n\n.back-cart {\n font-size: .9em;\n color: #27272A;\n text-decoration: none;\n cursor: pointer;\n margin-top: 11px;\n}\n\n.note-description-2 {\n color: var(--crm-scheme-fg-main-inverse, #262626);\n font-family: Roboto;\n font-size: var(--crm-font-size-body-lg, 16px);\n font-style: normal;\n font-weight: var(--crm-font-weight-body-bold, 400);\n line-height: var(--crm-line-height-body-md, 20px);\n letter-spacing: var(--crm-letter-spacing-title-md, 0px);\n margin-top: 11px;\n color: #000;\n}\n\n.note-description-not {\n font-size: 16px;\n}","import { Component, Prop, State, h } from \"@stencil/core\";\nimport { IInfoStore, getInfoCustomization } from \"../../helpers/info.config.helper\";\n\nimport money from '../../assets/svg/money-dollars-svgrepo-com.svg'\nimport { getKeyReserveByCartId } from \"../../utils/keys.storage\";\nimport i18next from \"../../i18n/i18n\"\nimport { IBonus } from \"../../components\";\n\n@Component({\n tag: 'crm-bonus-note',\n styleUrl: 'crm-bonus-note.css'\n})\nexport class CrmBonusNote {\n\n @Prop({ attribute: 'cartid' }) cartId;\n @Prop({ attribute: \"storename\" }) storename;\n\n @State() url: string;\n @State() config: IInfoStore;\n\n @State() bonus: IBonus;\n\n componentWillLoad() {\n this.upadateCheckToFreteAndGetUrl()\n }\n\n upadateCheckToFreteAndGetUrl() {\n\n this.config = getInfoCustomization(this.storename);\n const envios = document.getElementsByName('forma-envio');\n envios.forEach((envio: any) => {\n envio.checked = false;\n });\n\n this.url = window.location.origin;\n }\n\n handleHide() {\n const amount = localStorage.getItem(this.cartId);\n return !!amount;\n }\n\n getAmount() {\n const amount = localStorage.getItem(this.cartId);\n\n return amount ? Number(amount).toFixed(2).replace(\".\", \",\") || \"0,00\" : \"0,00\";\n }\n\n async backCart() {\n // await CrmBonusService.getInstance().cancelBonus(this.cartId, this.storename);\n window.location.href = this.url;\n\n // localStorage.removeItem(getKeyReserveByCartId(this.cartId));\n }\n\n\n hasBonus() {\n const _bonus = localStorage.getItem(getKeyReserveByCartId(this.cartId));\n\n const info = {\n hasBonus: false,\n requestBonus: false\n }\n\n if (_bonus) {\n this.bonus = JSON.parse(_bonus);\n\n console.log(\"bonus\", this.bonus);\n\n info.hasBonus = this.bonus.hasBonus;\n info.requestBonus = true;\n }\n\n return info;\n }\n\n render() {\n\n const giftbackname = this.config.giftbackTitle || \"Giftback\";\n\n const infobonus = this.hasBonus()\n\n return (\n <div>\n <div class=\"note-container\">\n <div class=\"note-header\">\n\n <p class=\"note-title\">\n <img src={money} width={23} />\n {this.config.giftbackTitle}\n </p>\n {\n infobonus.hasBonus && (\n <p class=\"back-cart\" onClick={() => this.backCart()}>\n {i18next.t(\"edit\")}\n </p>\n )\n }\n </div>\n\n {\n infobonus.hasBonus &&\n (\n <p class=\"note-description-2\">\n {i18next.t(\"withApplyBonus\", { giftbackname: giftbackname })} <strong>R$ {this.getAmount()}.</strong>\n </p>\n )\n }\n\n {\n (infobonus.requestBonus && !infobonus.hasBonus) &&\n (\n <p class=\"note-description-not\">\n {i18next.t(\"noBonus\", { giftbackname: giftbackname })}\n </p>\n )\n }\n\n {\n !infobonus.requestBonus &&\n (\n <div class=\"description\">\n <p class=\"note-description-not\">\n {i18next.t(\"backCart\")}\n </p>\n <crm-button txtBtn=\"VOLTAR AO CARRINHO\" handleClick={() => this.backCart()} />\n </div>\n )\n }\n\n {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SAAS,CAAC,YAAY,IAAI,CAAC,SAAS,CAAC,QAAQ;aAE1C,0DAAG,KAAK,EAAC,sBAAsB,IAC1BA,QAAO,CAAC,CAAC,CAAC,SAAS,EAAE,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC,CACrD,CACP,EAID,CAAC,SAAS,CAAC,YAAY;aAEnB,4DAAK,KAAK,EAAC,aAAa,IACpB,0DAAG,KAAK,EAAC,sBAAsB,IAC1BA,QAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CACtB,EACJ,mEAAY,MAAM,EAAC,oBAAoB,EAAC,WAAW,EAAE,MAAM,IAAI,CAAC,QAAQ,EAAE,GAAI,CAC5E,CACT,CAMH,CACJ,EACT;KACJ;;;;;;","names":["money","i18next"],"sources":["src/assets/svg/money-dollars-svgrepo-com.svg","src/components/note/crm-bonus-note.css?tag=crm-bonus-note","src/components/note/crm-bonus-note.tsx"],"sourcesContent":["<?xml version=\"1.0\" encoding=\"utf-8\"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->\n<svg width=\"800px\" height=\"800px\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<circle cx=\"12\" cy=\"12\" r=\"10\" stroke=\"#000000\" stroke-width=\"2\"/>\n<path d=\"M15 9.94728C14.5 9.3 13.8 8.5 12 8.5C10.2 8.5 9 9.51393 9 9.94728C9 10.3806 9.06786 10.9277 10 11.5C10.7522 11.9618 12.6684 12.0439 13.5 12.5C14.679 13.1467 14.8497 13.8202 14.8497 14.0522C14.8497 14.6837 13.4175 15.4852 12 15.5C10.536 15.5153 9.5 14.7 9 14.0522\" stroke=\"#000000\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 7V17\" stroke=\"#000000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>",".note-container {\n border: 1px solid #dddddd;\n padding: 0 15px 15px;\n margin: 0 0 26px 0px;\n display: flex;\n flex-direction: column;\n gap: 13px;\n\n\n & .description {\n display: flex;\n flex-direction: column;\n gap: 13px;\n }\n}\n\n.note-container hr {\n border: 1px solid #CCC;\n}\n\n.note-container .back-cart {\n display: flex;\n text-align: center;\n}\n\n.note-header {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n}\n\n.note-title {\n font-weight: 700;\n text-align: left;\n display: flex;\n gap: 6px;\n align-items: center;\n margin-top: 11px;\n color: #000;\n}\n\n.note-description {\n font-family: Arial;\n color: #6d6d5f;\n padding: 0;\n margin: 0 auto;\n}\n\n.back-cart {\n font-size: .9em;\n color: #27272A;\n text-decoration: none;\n cursor: pointer;\n margin-top: 11px;\n}\n\n.note-description-2 {\n color: var(--crm-scheme-fg-main-inverse, #262626);\n font-family: Roboto;\n font-size: var(--crm-font-size-body-lg, 16px);\n font-style: normal;\n font-weight: var(--crm-font-weight-body-bold, 400);\n line-height: var(--crm-line-height-body-md, 20px);\n letter-spacing: var(--crm-letter-spacing-title-md, 0px);\n margin-top: 11px;\n color: #000;\n}\n\n.note-description-not {\n font-size: 16px;\n}","import { Component, Prop, State, h } from \"@stencil/core\";\nimport { IInfoStore, getInfoCustomization } from \"../../helpers/info.config.helper\";\n\nimport money from '../../assets/svg/money-dollars-svgrepo-com.svg'\nimport { getKeyReserveByCartId } from \"../../utils/keys.storage\";\nimport i18next from \"../../i18n/i18n\"\nimport { IBonus } from \"../../components\";\n\n@Component({\n tag: 'crm-bonus-note',\n styleUrl: 'crm-bonus-note.css'\n})\nexport class CrmBonusNote {\n\n @Prop({ attribute: 'cartid' }) cartId;\n @Prop({ attribute: \"storename\" }) storename;\n\n @State() url: string;\n @State() config: IInfoStore;\n\n @State() bonus: IBonus;\n\n @State() showEdit: boolean = false;\n\n componentWillLoad() {\n this.upadateCheckToFreteAndGetUrl()\n }\n\n upadateCheckToFreteAndGetUrl() {\n\n this.config = getInfoCustomization(this.storename);\n const envios = document.getElementsByName('forma-envio');\n envios.forEach((envio: any) => {\n envio.checked = false;\n });\n\n this.url = window.location.origin;\n }\n\n handleHide() {\n const amount = localStorage.getItem(this.cartId);\n return !!amount;\n }\n\n getAmount() {\n const amount = localStorage.getItem(this.cartId);\n\n return amount ? Number(amount).toFixed(2).replace(\".\", \",\") || \"0,00\" : \"0,00\";\n }\n\n async backCart() {\n // await CrmBonusService.getInstance().cancelBonus(this.cartId, this.storename);\n window.location.href = this.url;\n\n // localStorage.removeItem(getKeyReserveByCartId(this.cartId));\n }\n\n\n hasBonus() {\n const _bonus = localStorage.getItem(getKeyReserveByCartId(this.cartId));\n\n const info = {\n hasBonus: false,\n requestBonus: false\n }\n\n if (_bonus) {\n this.bonus = JSON.parse(_bonus);\n info.hasBonus = this.bonus.hasBonus;\n info.requestBonus = true;\n }\n\n return info;\n }\n\n render() {\n\n const giftbackname = this.config.giftbackTitle || \"Giftback\";\n\n const infobonus = this.hasBonus()\n\n return (\n <div>\n <div class=\"note-container\">\n <div class=\"note-header\">\n\n <p class=\"note-title\">\n <img src={money} width={23} />\n {this.config.giftbackTitle}\n </p>\n {\n infobonus.hasBonus && (\n <div>\n {this.showEdit && (\n <p class=\"back-cart\" onClick={() => this.backCart()}>\n {i18next.t(\"edit\")}\n </p>\n )}\n {!this.showEdit && <countdown-timer initialValue={60} downtime={() => { this.showEdit = true }} />}\n </div>\n )\n }\n </div>\n\n {\n infobonus.hasBonus &&\n (\n <p class=\"note-description-2\">\n {i18next.t(\"withApplyBonus\", { giftbackname: giftbackname })} <strong>R$ {this.getAmount()}.</strong>\n </p>\n )\n }\n\n {\n (infobonus.requestBonus && !infobonus.hasBonus) &&\n (\n <p class=\"note-description-not\">\n {i18next.t(\"noBonus\", { giftbackname: giftbackname })}\n </p>\n )\n }\n\n {\n !infobonus.requestBonus &&\n (\n <div class=\"description\">\n <p class=\"note-description-not\">\n {i18next.t(\"backCart\")}\n </p>\n <crm-button txtBtn=\"VOLTAR AO CARRINHO\" handleClick={() => this.backCart()} />\n </div>\n )\n }\n\n {/* <a class=\"back-cart\" href={this.url}>\n Voltar ao carrinho\n </a> */}\n </div>\n </div>\n )\n }\n}"],"version":3}
@@ -141,8 +141,7 @@ const CrmBonus = class {
141
141
  }
142
142
  async buildAndGetProducts() {
143
143
  const key = `bc-products:${this.cartId}`;
144
- const cart = await this.crmBonusService.getInfoCart();
145
- console.log('cart', cart);
144
+ const cart = { Produtos: [{ "ProdutoVarianteId": 336654, "ProdutoId": 150139, "Nome": "Camiseta All Black", "UrlImagem": "https://bycoders.fbitsstatic.net/img/p/336654/336654.jpg?w=100&h=100&v=no-change&qs=ignore", "Quantidade": 1, "PrecoDe": 15000.0015, "PrecoPor": 1.66, "Brinde": false, "IsDigital": false, "PrecoPorComAjustesProduto": 0, "SKU": "123450", "Categoria": "Roupa", "CategoriasGoogle": [], "Fabricante": "Nike", "PrazoEntrega": { "Titulo": "", "Descricao": "", "SegundoTitulo": "", "SegundaDescricao": "", "PrazoProduto": 0 }, "Atributos": [{ "Nome": "Cor", "Valor": "preta", "Tipo": 0 }, { "Nome": "Tamanho", "Valor": "P", "Tipo": 0 }], "Metadados": {}, "Informacoes": [], "Recorrencia": null, "Url": "https://bycoders.fbits.store/produto/150139", "ParcelamentoQuantidade": 0, "ParcelamentoValor": 0, "ParcelamentoJuro": false, "Valores": [], "Ajustes": [{ "Valor": 0, "Tipo": "Frete" }, { "Valor": -0.56, "Tipo": "Formula" }] }] }; //await this.crmBonusService.getInfoCart();
146
145
  this.productsInString = JSON.stringify(cart.Produtos);
147
146
  localStorage.setItem(key, this.productsInString);
148
147
  const productsInCart = JSON.parse(this.productsInString);
@@ -150,8 +149,9 @@ const CrmBonus = class {
150
149
  const products = [];
151
150
  for (const product_cart of productsInCart) {
152
151
  const [pro] = products_in_cache.filter(p => p.ProdutoVarianteId == product_cart.ProdutoVarianteId);
152
+ const [ajuste = { Valor: 0 }] = pro.Ajustes.filter(aj => aj.Tipo === "Formula");
153
153
  if (pro) {
154
- products.push(Object.assign(Object.assign({}, product_cart), { PrecoPor: pro.PrecoPor, Quantidade: pro.Quantidade, Ajustes: pro.Ajustes }));
154
+ products.push(Object.assign(Object.assign({}, product_cart), { PrecoPor: pro.PrecoPor + (ajuste.Valor * -1), Quantidade: pro.Quantidade, Ajustes: pro.Ajustes }));
155
155
  }
156
156
  else {
157
157
  products.push(product_cart);
@@ -236,7 +236,7 @@ const CrmBonus = class {
236
236
  this.showModal = true;
237
237
  }
238
238
  render() {
239
- return (h("loading-container", { key: 'e98e77655bfff81efc64b3e49779edbcaa1d2e73', loading: this.loading_reprocess }, h("crm-giftback-form", { key: 'eaf0f1d178f1f2011a6b04c42351181c00d7de15', style: { position: "relative" }, ref: ref => this.crmBonusRef = ref, storeName: this.storeName, products: this.buildProducts(), cartId: this.cartId, customer: this.customer, loadProducts: () => this.buildProducts() })));
239
+ return (h("loading-container", { key: 'aafefed6f772b13dafd38918a7ea6c044af5ffef', loading: this.loading_reprocess }, h("crm-giftback-form", { key: '4d63961108618f545154e4c0b7a21eafa5fc91c4', style: { position: "relative" }, ref: ref => this.crmBonusRef = ref, storeName: this.storeName, products: this.buildProducts(), cartId: this.cartId, customer: this.customer, loadProducts: () => this.buildProducts() })));
240
240
  }
241
241
  static get assetsDirs() { return ["assets"]; }
242
242
  static get watchers() { return {
@@ -1 +1 @@
1
- {"file":"crm-bonus.entry.js","mappings":";;;;;;AAQA,IAAY,eAEX;AAFD,WAAY,eAAe;IACvB,iCAAc,CAAA;AAClB,CAAC,EAFW,eAAe,KAAf,eAAe;;SCNX,mBAAmB,CAAC,eAAoC,EAAE;IAEtE,MAAM,QAAQ,GAAoB,EAAE,CAAC;IAErC,KAAM,MAAM,EAAE,IAAI,YAAY,EAAG;QAC7B,IAAI,SAAS,GAAG,WAAW,CAAC,EAAE,CAAC,OAAO,CAAC,CAAA;QAEvC,QAAQ,CAAC,IAAI,CACT;YACI,GAAG,EAAE,EAAE,CAAC,GAAG;YACX,KAAK,GAAG,EAAE,CAAC,QAAQ,GAAG,EAA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,GAAG,EAClC,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,QAAQ,EAAE,IAAI,CAAC,aAAa,EAAE,EAC9B,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,YAAY,EAAE,MAAM,IAAI,CAAC,aAAa,EAAE,GAExC,CACgB,EACrB;KACF;;;;;;;;;;","names":["i18next"],"sources":["src/dto/validate.pin.bonus.ts","src/helpers/build.payload.helper.ts","src/components/crm-bonus/crm-bonus.css?tag=crm-bonus&encapsulation=scoped","src/components/crm-bonus/crm-bonus.tsx"],"sourcesContent":["export interface IProduct {\n productVariantId: string;\n sku: string;\n value: number;\n quantity: number;\n discount: number;\n}\n\nexport enum AjustesTipoEnum {\n P = \"Promocao\" \n}\n\nexport interface IAjustes {\n Tipo: AjustesTipoEnum;\n Valor: number;\n}\n\nexport interface IProductWake {\n ProdutoVarianteId: number;\n SKU: string;\n PrecoPor: number;\n Quantidade: number;\n Ajustes: IAjustes[];\n}\n\nexport interface ICustomer {\n birthDate: string;\n document: string;\n name: string;\n phone: string;\n}\n\nexport interface IProccesPinBonusDto {\n storeName: string;\n name: string;\n checkoutId: string;\n checkoutProducts: Array<IProduct>;\n storeId: string;\n userId: string;\n cellphone: number;\n pin: string;\n\n}\n\nexport interface IBonus {\n hasBonus: boolean;\n bonusBalance: number;\n totalBonus: number;\n minimumPurchase: number;\n bonusIds: string;\n firstValidityDate: string\n history: [\n {\n validityStart: string;\n validityEnd: string;\n value: number\n },\n {\n validityStart: string;\n validityEnd: string\n value: number\n }\n ]\n storeId: number;\n userId: number;\n cartId: string\n calculatedValue: number;\n totalValue: number\n}\n\n\nexport interface IReserveDTO {\n storeName: string;\n cartId: string;\n grossValue: number;\n redeemedBonus: number;\n ticket: string;\n storeId: string;\n userId: number;\n}","import { AjustesTipoEnum, IAjustes, IProduct, IProductWake } from \"../dto/validate.pin.bonus\";\n\nexport function buildProductsByWake(productsWake: Array<IProductWake> = []): Array<IProduct> {\n\n const products: Array<IProduct> = [];\n\n for ( const pw of productsWake ) {\n let discounts = getDiscount(pw.Ajustes)\n\n products.push(\n {\n sku: pw.SKU,\n value: (pw.PrecoPor * pw.Quantidade),\n productVariantId: pw.ProdutoVarianteId.toString(),\n quantity: pw.Quantidade,\n discount: (discounts * -1)\n }\n )\n }\n\n return products;\n}\n\nfunction getDiscount(ajustes: IAjustes[] = []) {\n \n let discounts = 0;\n \n for(const discount of ajustes) {\n if(discount.Tipo === AjustesTipoEnum.P) {\n discounts += discount.Valor;\n }\n }\n\n return discounts;\n}","\n.container-button {\n /* max-width: 100%; */\n cursor: pointer;\n padding: 5px 5px 5px 14px;\n /* display: flex; */\n}\n\n/* padding: 0 15px 15px;\nborder: 1px solid #ddd;\nmargin-bottom: 20px; */\n\n.section-crm {\n border: 1px solid #dbd4d4;\n /* min-height: 50px; */\n text-align: -webkit-center;\n margin-bottom: 20px;\n}\n\n.section-cart-crm {\n margin-top: 10px;\n}\n\n.section-cart-crm p {\n padding: 0;\n margin: 0px 0px 0px 15px;\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 margin-left: 10px;\n height: 70px;\n}\n\n.form-container {\n width: 97%;\n display: flex;\n justify-content: space-around;\n}\n\n\n.btn {\n display: inline-block;\n padding: 6px 12px;\n margin-bottom: 0;\n font-size: 14px;\n font-weight: 400;\n line-height: 1.42857143;\n text-align: center;\n white-space: nowrap;\n vertical-align: middle;\n -ms-touch-action: manipulation;\n touch-action: manipulation;\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n background-image: none;\n border: 1px solid transparent;\n border-radius: 0px;\n}\n\n.form-container .btnCrm {\n background: #00162e;\n border-color: #00162e;\n width: 30%;\n color: #fff;\n}\n\n.message-alert {\n font-family: sans-serif;\n color: #df4d4d;\n margin-top: 5px;\n}","import { Component, Method, Prop, State, Watch, h } from '@stencil/core';\nimport { IProduct, IProductWake, ICustomer } from '../../dto/validate.pin.bonus';\nimport { CrmBonusService } from '../../services/crmbonus.service';\nimport { IPinSent } from '../../components';\nimport { StepFormEnum } from '../../contants';\n\nimport i18next from '../../i18n/i18n'\nimport { buildProductsByWake } from '../../helpers/build.payload.helper';\n\n@Component({\n tag: 'crm-bonus',\n styleUrl: 'crm-bonus.css',\n scoped: true,\n assetsDirs: ['assets']\n})\nexport class CrmBonus {\n\n private crmBonusService: CrmBonusService = CrmBonusService.getInstance();\n\n private crmBonusRef: HTMLCrmGiftbackFormElement;\n\n @State() showModal: boolean = false;\n @Prop({ attribute: 'userid' }) userId: number;\n @Prop({ attribute: 'storename' }) storeName;\n @Prop({ attribute: 'products' }) productsInString: string;\n @Prop({ attribute: 'cartid' }) cartId;\n\n @State() products: Array<IProductWake>;\n @State() customer: ICustomer = {\n birthDate: \"\",\n document: \"\",\n name: \"\",\n phone: \"\"\n };\n\n @State() loading: boolean = false;\n @State() message: string;\n @State() phone: number;\n @State() canCancel: boolean = false;\n @State() amountCancel: string;\n @State() sent: IPinSent;\n\n @State() session: string;\n @State() loading_reprocess = false;\n\n @Method()\n async resetBonus() {\n console.log('[START RESET BONUS]!!!!!');\n // const used = localStorage.getItem(\"bc:used\");\n\n // if (used == \"use\") {\n // await this.crmBonusService.cancelBonus(this.cartId, this.storeName);\n // }\n\n try {\n await this.crmBonusRef.processBonus(this.buildProducts(), true);\n console.log('[BONUS RESETADO]!!!!!');\n } catch (err) {\n\n this.loading = false;\n console.log('[error ao reprocessar bonous]');\n await this.crmBonusRef.setStep(StepFormEnum.STEP_PHONE);\n } finally {\n this.loading = false;\n }\n }\n\n @Method()\n async reprocess(products: Array<any>) {\n this.loading_reprocess = true\n\n console.log('[reprocess]');\n try {\n console.log('[update products list]');\n this.productsInString = JSON.stringify(products);\n await this.handleLoad();\n\n await this.resetBonus();\n } catch (err) {\n console.debug('[watchProducts]', err.message);\n } finally {\n this.loading_reprocess = false\n }\n }\n\n @Watch(\"productsInString\")\n async watchProducts(newValue: string) {\n try {\n console.log('[update products list]');\n this.productsInString = newValue;\n await this.handleLoad();\n\n await this.resetBonus();\n } catch (err) {\n console.debug('[watchProducts]', err.message);\n }\n }\n\n async componentWillLoad() {\n i18next.changeLanguage(i18next.language);\n\n await this.loadSession();\n await this.loadConfigStore()\n await this.handleLoad();\n }\n\n async loadConfigStore() {\n await this.crmBonusService.getCustomization(this.storeName);\n }\n\n async handleLoad() {\n try {\n if (this.userId) {\n this.customer = await this.crmBonusService.getCustomer(this.userId, this.storeName);\n console.log('customer', this.customer);\n }\n\n const amount = localStorage.getItem(this.cartId);\n\n if (amount) {\n this.canCancel = true;\n this.amountCancel = amount;\n }\n\n } catch (error) {\n console.log('info customer')\n }\n\n await this.buildAndGetProducts();\n }\n\n\n async loadSession() {\n this.session = await this.crmBonusService.getToken(this.storeName);\n\n setTimeout(() => {\n this.loadSession()\n }, 1500000)\n\n }\n\n async buildAndGetProducts() {\n const key = `bc-products:${this.cartId}`;\n\n const cart = await this.crmBonusService.getInfoCart();\n\n console.log('cart', cart)\n\n this.productsInString = JSON.stringify(cart.Produtos)\n\n localStorage.setItem(key, this.productsInString);\n\n const productsInCart = JSON.parse(this.productsInString);\n const products_in_cache = JSON.parse(localStorage.getItem(key));\n\n const products: Array<IProductWake> = []\n\n for (const product_cart of productsInCart) {\n\n const [pro] = products_in_cache.filter(p => p.ProdutoVarianteId == product_cart.ProdutoVarianteId)\n\n if (pro) {\n products.push({\n ...product_cart,\n PrecoPor: pro.PrecoPor,\n Quantidade: pro.Quantidade,\n Ajustes: pro.Ajustes\n })\n } else {\n products.push(product_cart)\n }\n\n }\n\n this.products = products; //cache_products ? JSON.parse(cache_products) : JSON.parse(this.productsInString);\n\n }\n\n public async sendPin(phone: string) {\n this.loading = true;\n this.message = \"\";\n\n try {\n\n const _phone = phone.replace(/\\D/g, '');\n this.phone = Number(_phone);\n\n this.sent = await this.crmBonusService.sendPin(this.phone, this.customer.name, this.storeName);;\n\n await this.crmBonusRef.setStep(StepFormEnum.STEP_PIN);\n\n this.showModal = true;\n } catch (error) {\n this.message = error?.response?.data?.message\n } finally {\n this.loading = false\n }\n }\n\n public async sendPinName(customerName: string) {\n this.loading = true;\n this.message = \"\";\n\n try {\n this.customer.name = customerName;\n\n this.sent = await this.crmBonusService.sendPin(this.phone, this.customer.name, this.storeName);;\n\n await this.crmBonusRef.setStep(StepFormEnum.STEP_PIN);\n\n this.showModal = true;\n } catch (error) {\n this.message = error?.response?.data?.message\n } finally {\n this.loading = false\n }\n }\n\n buildProducts(): IProduct[] {\n return buildProductsByWake(this.products);\n }\n\n handleCloseModal() {\n this.showModal = false;\n }\n\n save(amount: number) {\n localStorage.setItem(this.cartId, amount.toString());\n this.canCancel = true;\n this.amountCancel = amount.toString()\n }\n\n async cancel() {\n this.message = \"\";\n this.loading = true;\n try {\n await this.crmBonusService.cancel(this.cartId);\n this.canCancel = false;\n\n localStorage.removeItem(this.cartId);\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 async handleSendPin(phone: string) {\n this.message = \"\"\n if (!phone) {\n this.message = \"Informe seu telefone\";\n return;\n }\n\n this.customer.phone = phone;\n const _phone = phone.replace(/\\D/g, '');\n this.phone = Number(_phone);\n\n if (this.customer.name) {\n return this.sendPin(phone)\n }\n\n await this.crmBonusRef.setStep(StepFormEnum.STEP_NAME);\n this.showModal = true;\n }\n\n render() {\n\n return (\n <loading-container loading={this.loading_reprocess} >\n <crm-giftback-form\n style={{ position: \"relative\" }}\n ref={ref => this.crmBonusRef = ref}\n storeName={this.storeName}\n products={this.buildProducts()}\n cartId={this.cartId}\n customer={this.customer}\n loadProducts={() => this.buildProducts()}\n \n />\n </loading-container>\n )\n }\n}\n"],"version":3}
1
+ {"file":"crm-bonus.entry.js","mappings":";;;;;;AAQA,IAAY,eAEX;AAF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O,CAAC,KAAK,CAAC,CAAA;SAC3B;QAED,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;QACvD,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;KACvB;IAED,MAAM;QAEJ,QACE,0EAAmB,OAAO,EAAE,IAAI,CAAC,iBAAiB,IAChD,0EACE,KAAK,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,EAC/B,GAAG,EAAE,GAAG,IAAI,IAAI,CAAC,WAAW,GAAG,GAAG,EAClC,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,QAAQ,EAAE,IAAI,CAAC,aAAa,EAAE,EAC9B,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,YAAY,EAAE,MAAM,IAAI,CAAC,aAAa,EAAE,GAExC,CACgB,EACrB;KACF;;;;;;;;;;","names":["i18next"],"sources":["src/dto/validate.pin.bonus.ts","src/helpers/build.payload.helper.ts","src/components/crm-bonus/crm-bonus.css?tag=crm-bonus&encapsulation=scoped","src/components/crm-bonus/crm-bonus.tsx"],"sourcesContent":["export interface IProduct {\n productVariantId: string;\n sku: string;\n value: number;\n quantity: number;\n discount: number;\n}\n\nexport enum AjustesTipoEnum {\n P = \"Promocao\" \n}\n\nexport interface IAjustes {\n Tipo: AjustesTipoEnum;\n Valor: number;\n}\n\nexport interface IProductWake {\n ProdutoVarianteId: number;\n SKU: string;\n PrecoPor: number;\n Quantidade: number;\n Ajustes: IAjustes[];\n}\n\nexport interface ICustomer {\n birthDate: string;\n document: string;\n name: string;\n phone: string;\n}\n\nexport interface IProccesPinBonusDto {\n storeName: string;\n name: string;\n checkoutId: string;\n checkoutProducts: Array<IProduct>;\n storeId: string;\n userId: string;\n cellphone: number;\n pin: string;\n\n}\n\nexport interface IBonus {\n hasBonus: boolean;\n bonusBalance: number;\n totalBonus: number;\n minimumPurchase: number;\n bonusIds: string;\n firstValidityDate: string\n history: [\n {\n validityStart: string;\n validityEnd: string;\n value: number\n },\n {\n validityStart: string;\n validityEnd: string\n value: number\n }\n ]\n storeId: number;\n userId: number;\n cartId: string\n calculatedValue: number;\n totalValue: number\n}\n\n\nexport interface IReserveDTO {\n storeName: string;\n cartId: string;\n grossValue: number;\n redeemedBonus: number;\n ticket: string;\n storeId: string;\n userId: number;\n}","import { AjustesTipoEnum, IAjustes, IProduct, IProductWake } from \"../dto/validate.pin.bonus\";\n\nexport function buildProductsByWake(productsWake: Array<IProductWake> = []): Array<IProduct> {\n\n const products: Array<IProduct> = [];\n\n for ( const pw of productsWake ) {\n let discounts = getDiscount(pw.Ajustes)\n\n products.push(\n {\n sku: pw.SKU,\n value: (pw.PrecoPor * pw.Quantidade),\n productVariantId: pw.ProdutoVarianteId.toString(),\n quantity: pw.Quantidade,\n discount: (discounts * -1)\n }\n )\n }\n\n return products;\n}\n\nfunction getDiscount(ajustes: IAjustes[] = []) {\n \n let discounts = 0;\n \n for(const discount of ajustes) {\n if(discount.Tipo === AjustesTipoEnum.P) {\n discounts += discount.Valor;\n }\n }\n\n return discounts;\n}","\n.container-button {\n /* max-width: 100%; */\n cursor: pointer;\n padding: 5px 5px 5px 14px;\n /* display: flex; */\n}\n\n/* padding: 0 15px 15px;\nborder: 1px solid #ddd;\nmargin-bottom: 20px; */\n\n.section-crm {\n border: 1px solid #dbd4d4;\n /* min-height: 50px; */\n text-align: -webkit-center;\n margin-bottom: 20px;\n}\n\n.section-cart-crm {\n margin-top: 10px;\n}\n\n.section-cart-crm p {\n padding: 0;\n margin: 0px 0px 0px 15px;\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 margin-left: 10px;\n height: 70px;\n}\n\n.form-container {\n width: 97%;\n display: flex;\n justify-content: space-around;\n}\n\n\n.btn {\n display: inline-block;\n padding: 6px 12px;\n margin-bottom: 0;\n font-size: 14px;\n font-weight: 400;\n line-height: 1.42857143;\n text-align: center;\n white-space: nowrap;\n vertical-align: middle;\n -ms-touch-action: manipulation;\n touch-action: manipulation;\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n background-image: none;\n border: 1px solid transparent;\n border-radius: 0px;\n}\n\n.form-container .btnCrm {\n background: #00162e;\n border-color: #00162e;\n width: 30%;\n color: #fff;\n}\n\n.message-alert {\n font-family: sans-serif;\n color: #df4d4d;\n margin-top: 5px;\n}","import { Component, Method, Prop, State, Watch, h } from '@stencil/core';\nimport { IProduct, IProductWake, ICustomer } from '../../dto/validate.pin.bonus';\nimport { CrmBonusService } from '../../services/crmbonus.service';\nimport { IPinSent } from '../../components';\nimport { StepFormEnum } from '../../contants';\n\nimport i18next from '../../i18n/i18n'\nimport { buildProductsByWake } from '../../helpers/build.payload.helper';\n\n@Component({\n tag: 'crm-bonus',\n styleUrl: 'crm-bonus.css',\n scoped: true,\n assetsDirs: ['assets']\n})\nexport class CrmBonus {\n\n private crmBonusService: CrmBonusService = CrmBonusService.getInstance();\n\n private crmBonusRef: HTMLCrmGiftbackFormElement;\n\n @State() showModal: boolean = false;\n @Prop({ attribute: 'userid' }) userId: number;\n @Prop({ attribute: 'storename' }) storeName;\n @Prop({ attribute: 'products' }) productsInString: string;\n @Prop({ attribute: 'cartid' }) cartId;\n\n @State() products: Array<IProductWake>;\n @State() customer: ICustomer = {\n birthDate: \"\",\n document: \"\",\n name: \"\",\n phone: \"\"\n };\n\n @State() loading: boolean = false;\n @State() message: string;\n @State() phone: number;\n @State() canCancel: boolean = false;\n @State() amountCancel: string;\n @State() sent: IPinSent;\n\n @State() session: string;\n @State() loading_reprocess = false;\n\n @Method()\n async resetBonus() {\n console.log('[START RESET BONUS]!!!!!');\n // const used = localStorage.getItem(\"bc:used\");\n\n // if (used == \"use\") {\n // await this.crmBonusService.cancelBonus(this.cartId, this.storeName);\n // }\n\n try {\n await this.crmBonusRef.processBonus(this.buildProducts(), true);\n console.log('[BONUS RESETADO]!!!!!');\n } catch (err) {\n\n this.loading = false;\n console.log('[error ao reprocessar bonous]');\n await this.crmBonusRef.setStep(StepFormEnum.STEP_PHONE);\n } finally {\n this.loading = false;\n }\n }\n\n @Method()\n async reprocess(products: Array<any>) {\n this.loading_reprocess = true\n\n console.log('[reprocess]');\n try {\n console.log('[update products list]');\n this.productsInString = JSON.stringify(products);\n await this.handleLoad();\n\n await this.resetBonus();\n } catch (err) {\n console.debug('[watchProducts]', err.message);\n } finally {\n this.loading_reprocess = false\n }\n }\n\n @Watch(\"productsInString\")\n async watchProducts(newValue: string) {\n try {\n console.log('[update products list]');\n this.productsInString = newValue;\n await this.handleLoad();\n\n await this.resetBonus();\n } catch (err) {\n console.debug('[watchProducts]', err.message);\n }\n }\n\n async componentWillLoad() {\n i18next.changeLanguage(i18next.language);\n\n await this.loadSession();\n await this.loadConfigStore()\n await this.handleLoad();\n }\n\n async loadConfigStore() {\n await this.crmBonusService.getCustomization(this.storeName);\n }\n\n async handleLoad() {\n try {\n if (this.userId) {\n this.customer = await this.crmBonusService.getCustomer(this.userId, this.storeName);\n console.log('customer', this.customer);\n }\n\n const amount = localStorage.getItem(this.cartId);\n\n if (amount) {\n this.canCancel = true;\n this.amountCancel = amount;\n }\n\n } catch (error) {\n console.log('info customer')\n }\n\n await this.buildAndGetProducts();\n }\n\n\n async loadSession() {\n this.session = await this.crmBonusService.getToken(this.storeName);\n\n setTimeout(() => {\n this.loadSession()\n }, 1500000)\n\n }\n\n async buildAndGetProducts() {\n \n const key = `bc-products:${this.cartId}`;\n\n const cart = {Produtos: [{\"ProdutoVarianteId\":336654,\"ProdutoId\":150139,\"Nome\":\"Camiseta All Black\",\"UrlImagem\":\"https://bycoders.fbitsstatic.net/img/p/336654/336654.jpg?w=100&h=100&v=no-change&qs=ignore\",\"Quantidade\":1,\"PrecoDe\":15000.0015,\"PrecoPor\":1.66,\"Brinde\":false,\"IsDigital\":false,\"PrecoPorComAjustesProduto\":0,\"SKU\":\"123450\",\"Categoria\":\"Roupa\",\"CategoriasGoogle\":[],\"Fabricante\":\"Nike\",\"PrazoEntrega\":{\"Titulo\":\"\",\"Descricao\":\"\",\"SegundoTitulo\":\"\",\"SegundaDescricao\":\"\",\"PrazoProduto\":0},\"Atributos\":[{\"Nome\":\"Cor\",\"Valor\":\"preta\",\"Tipo\":0},{\"Nome\":\"Tamanho\",\"Valor\":\"P\",\"Tipo\":0}],\"Metadados\":{},\"Informacoes\":[],\"Recorrencia\":null,\"Url\":\"https://bycoders.fbits.store/produto/150139\",\"ParcelamentoQuantidade\":0,\"ParcelamentoValor\":0,\"ParcelamentoJuro\":false,\"Valores\":[],\"Ajustes\":[{\"Valor\":0,\"Tipo\":\"Frete\"},{\"Valor\":-0.56,\"Tipo\":\"Formula\"}]}]} //await this.crmBonusService.getInfoCart();\n\n this.productsInString = JSON.stringify(cart.Produtos)\n\n localStorage.setItem(key, this.productsInString);\n\n const productsInCart = JSON.parse(this.productsInString);\n const products_in_cache = JSON.parse(localStorage.getItem(key));\n\n const products: Array<IProductWake> = []\n\n for (const product_cart of productsInCart) {\n\n const [pro] = products_in_cache.filter(p => p.ProdutoVarianteId == product_cart.ProdutoVarianteId)\n\n const [ ajuste = { Valor:0 } ] = pro.Ajustes.filter( aj => aj.Tipo === \"Formula\" )\n\n if (pro) {\n products.push({\n ...product_cart,\n PrecoPor: pro.PrecoPor + (ajuste.Valor * -1),\n Quantidade: pro.Quantidade,\n Ajustes: pro.Ajustes\n })\n } else {\n products.push(product_cart)\n }\n\n }\n\n this.products = products; //cache_products ? JSON.parse(cache_products) : JSON.parse(this.productsInString);\n\n }\n\n public async sendPin(phone: string) {\n this.loading = true;\n this.message = \"\";\n\n try {\n\n const _phone = phone.replace(/\\D/g, '');\n this.phone = Number(_phone);\n\n this.sent = await this.crmBonusService.sendPin(this.phone, this.customer.name, this.storeName);;\n\n await this.crmBonusRef.setStep(StepFormEnum.STEP_PIN);\n\n this.showModal = true;\n } catch (error) {\n this.message = error?.response?.data?.message\n } finally {\n this.loading = false\n }\n }\n\n public async sendPinName(customerName: string) {\n this.loading = true;\n this.message = \"\";\n\n try {\n this.customer.name = customerName;\n\n this.sent = await this.crmBonusService.sendPin(this.phone, this.customer.name, this.storeName);;\n\n await this.crmBonusRef.setStep(StepFormEnum.STEP_PIN);\n\n this.showModal = true;\n } catch (error) {\n this.message = error?.response?.data?.message\n } finally {\n this.loading = false\n }\n }\n\n buildProducts(): IProduct[] {\n return buildProductsByWake(this.products);\n }\n\n handleCloseModal() {\n this.showModal = false;\n }\n\n save(amount: number) {\n localStorage.setItem(this.cartId, amount.toString());\n this.canCancel = true;\n this.amountCancel = amount.toString()\n }\n\n async cancel() {\n this.message = \"\";\n this.loading = true;\n try {\n await this.crmBonusService.cancel(this.cartId);\n this.canCancel = false;\n\n localStorage.removeItem(this.cartId);\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 async handleSendPin(phone: string) {\n this.message = \"\"\n if (!phone) {\n this.message = \"Informe seu telefone\";\n return;\n }\n\n this.customer.phone = phone;\n const _phone = phone.replace(/\\D/g, '');\n this.phone = Number(_phone);\n\n if (this.customer.name) {\n return this.sendPin(phone)\n }\n\n await this.crmBonusRef.setStep(StepFormEnum.STEP_NAME);\n this.showModal = true;\n }\n\n render() {\n\n return (\n <loading-container loading={this.loading_reprocess} >\n <crm-giftback-form\n style={{ position: \"relative\" }}\n ref={ref => this.crmBonusRef = ref}\n storeName={this.storeName}\n products={this.buildProducts()}\n cartId={this.cartId}\n customer={this.customer}\n loadProducts={() => this.buildProducts()}\n \n />\n </loading-container>\n )\n }\n}\n"],"version":3}