crmbonus-component-wake 2.1.41-ngrok → 2.1.41-shoulder
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.
- package/LICENSE +21 -21
- package/dist/cjs/app-modal.cjs.entry.js +2 -2
- package/dist/cjs/app-modal.cjs.entry.js.map +1 -1
- package/dist/cjs/bc-crmbonus.cjs.entry.js +28 -0
- package/dist/cjs/bc-crmbonus.cjs.entry.js.map +1 -0
- package/dist/cjs/bc-phone-form_2.cjs.entry.js +333 -0
- package/dist/cjs/bc-phone-form_2.cjs.entry.js.map +1 -0
- package/dist/cjs/bc-wake-crmbonus.cjs.entry.js +18 -0
- package/dist/cjs/bc-wake-crmbonus.cjs.entry.js.map +1 -0
- package/dist/cjs/cart.helper-d1f02660.js +201 -0
- package/dist/cjs/cart.helper-d1f02660.js.map +1 -0
- package/dist/cjs/container-empty.cjs.entry.js +2 -2
- package/dist/cjs/container-empty.cjs.entry.js.map +1 -1
- package/dist/cjs/countdown-timer-v2.cjs.entry.js +2 -2
- package/dist/cjs/countdown-timer-v2.cjs.entry.js.map +1 -1
- package/dist/cjs/countdown-timer_11.cjs.entry.js +55 -43
- package/dist/cjs/countdown-timer_11.cjs.entry.js.map +1 -1
- package/dist/cjs/crm-bonus-note.cjs.entry.js +14 -12
- package/dist/cjs/crm-bonus-note.cjs.entry.js.map +1 -1
- package/dist/cjs/crmbonus-component-wake.cjs.js +2 -2
- package/dist/{components/p-0d09c221.js → cjs/crmbonus.service-ef8fe456.js} +30 -117
- package/dist/cjs/crmbonus.service-ef8fe456.js.map +1 -0
- package/dist/{esm/info.config.helper-e4b8c478.js → cjs/i18n-defaa4f8.js} +3 -30
- package/dist/cjs/i18n-defaa4f8.js.map +1 -0
- package/dist/cjs/{index-a7537457.js → index-e45b352e.js} +17 -1
- package/dist/cjs/index-e45b352e.js.map +1 -0
- package/dist/cjs/info.config.helper-52984ab9.js +36 -0
- package/dist/cjs/info.config.helper-52984ab9.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/pedido-finalizado.cjs.entry.js +6 -5
- package/dist/cjs/pedido-finalizado.cjs.entry.js.map +1 -1
- package/dist/cjs/utils-5d59acb1.js.map +1 -1
- package/dist/collection/assets/svg/money-dollars-svgrepo-com.svg +5 -5
- package/dist/collection/collection-manifest.json +5 -1
- package/dist/collection/components/button/crm-button.css +21 -21
- package/dist/collection/components/button/index.js +1 -1
- package/dist/collection/components/button/index.js.map +1 -1
- package/dist/collection/components/countdown-timer/countdown-timer.js +1 -1
- package/dist/collection/components/countdown-timer/countdown-timer.js.map +1 -1
- package/dist/collection/components/countdown-timer/countdown-timer.v2.js +2 -2
- package/dist/collection/components/countdown-timer/countdown-timer.v2.js.map +1 -1
- package/dist/collection/components/crm-bonus/assets/logo.svg +17 -17
- package/dist/collection/components/crm-bonus/assets/svg/logo.svg +17 -17
- package/dist/collection/components/crm-bonus/crm-bonus.css +86 -82
- package/dist/collection/components/crm-bonus/crm-bonus.js +16 -7
- package/dist/collection/components/crm-bonus/crm-bonus.js.map +1 -1
- package/dist/collection/components/crmbonus/crmbonus.js +26 -0
- package/dist/collection/components/crmbonus/crmbonus.js.map +1 -0
- package/dist/collection/components/crmbonus/subcomponents/phone-form/index.js +95 -0
- package/dist/collection/components/crmbonus/subcomponents/phone-form/index.js.map +1 -0
- package/dist/collection/components/crmbonus/subcomponents/phone-form/styles.scss +5 -0
- package/dist/collection/components/crmbonus/subcomponents/phone-validate/index.js +129 -0
- package/dist/collection/components/crmbonus/subcomponents/phone-validate/index.js.map +1 -0
- package/dist/collection/components/crmbonus/subcomponents/phone-validate/styles.scss +84 -0
- package/dist/collection/components/giftback-form/giftback-form.css +74 -74
- package/dist/collection/components/giftback-form/giftback-form.js +5 -5
- package/dist/collection/components/giftback-form/giftback-form.js.map +1 -1
- package/dist/collection/components/giftback-form/subcomponents/giftback-info/giftback-info.css +181 -181
- package/dist/collection/components/giftback-form/subcomponents/giftback-info/giftback-info.js +6 -6
- package/dist/collection/components/giftback-form/subcomponents/giftback-info/giftback-info.js.map +1 -1
- package/dist/collection/components/giftback-form/subcomponents/giftback-message/giftback-massage.js.map +1 -1
- package/dist/collection/components/giftback-form/subcomponents/phone-form/phone-form.js +1 -1
- package/dist/collection/components/giftback-form/subcomponents/phone-form/phone-form.js.map +1 -1
- package/dist/collection/components/giftback-form/subcomponents/pin-form/pin-form.css +83 -83
- package/dist/collection/components/giftback-form/subcomponents/pin-form/pin-form.js +1 -1
- package/dist/collection/components/giftback-form/subcomponents/pin-form/pin-form.js.map +1 -1
- package/dist/collection/components/loading-container/container-empty.js +1 -1
- package/dist/collection/components/loading-container/container-empty.js.map +1 -1
- package/dist/collection/components/loading-container/loading-container.css +53 -53
- package/dist/collection/components/loading-container/loading-container.js +1 -1
- package/dist/collection/components/loading-container/loading-container.js.map +1 -1
- package/dist/collection/components/loading-spinner/loading-spinner.css +16 -16
- package/dist/collection/components/loading-spinner/loading-spinner.js +1 -1
- package/dist/collection/components/loading-spinner/loading-spinner.js.map +1 -1
- package/dist/collection/components/modal/app-modal.css +44 -44
- package/dist/collection/components/modal/app-modal.js +1 -1
- package/dist/collection/components/modal/app-modal.js.map +1 -1
- package/dist/collection/components/note/crm-bonus-note.css +68 -68
- package/dist/collection/components/note/crm-bonus-note.js +2 -2
- package/dist/collection/components/note/crm-bonus-note.js.map +1 -1
- package/dist/collection/components/pedido/pedido.js +2 -2
- package/dist/collection/components/pedido/pedido.js.map +1 -1
- package/dist/collection/components/phone/phone-input-mask.css +40 -40
- package/dist/collection/components/phone/phone-input-mask.js +1 -1
- package/dist/collection/components/phone/phone-input-mask.js.map +1 -1
- package/dist/collection/components/tooltip/crm-tooltip.css +48 -48
- package/dist/collection/components/tooltip/tooltip.js +1 -1
- package/dist/collection/components/tooltip/tooltip.js.map +1 -1
- package/dist/collection/contants/index.js.map +1 -1
- package/dist/collection/contants/mocks.js.map +1 -1
- package/dist/collection/dto/checkout.dto.js +2 -0
- package/dist/collection/dto/checkout.dto.js.map +1 -0
- package/dist/collection/dto/pin.sent.js.map +1 -1
- package/dist/collection/dto/reserved-info.dto.js.map +1 -1
- package/dist/collection/dto/update.order.dto.js.map +1 -1
- package/dist/collection/dto/validate.pin.bonus.js.map +1 -1
- package/dist/collection/helpers/build.payload.helper.js +1 -0
- package/dist/collection/helpers/build.payload.helper.js.map +1 -1
- package/dist/collection/helpers/cart.helper.js +55 -1
- package/dist/collection/helpers/cart.helper.js.map +1 -1
- package/dist/collection/helpers/info.config.helper.js.map +1 -1
- package/dist/collection/helpers/payload.interface.js.map +1 -1
- package/dist/collection/helpers/time.helper.js.map +1 -1
- package/dist/collection/i18n/i18n.js.map +1 -1
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/objectvalues/cart.wake.js +33 -8
- package/dist/collection/objectvalues/cart.wake.js.map +1 -1
- package/dist/collection/platforms/wake/index.js +8 -0
- package/dist/collection/platforms/wake/index.js.map +1 -0
- package/dist/collection/services/crmbonus.service.js +21 -2
- package/dist/collection/services/crmbonus.service.js.map +1 -1
- package/dist/collection/utils/keys.storage.js.map +1 -1
- package/dist/collection/utils/retry.utils.js.map +1 -1
- package/dist/collection/utils/utils.js.map +1 -1
- package/dist/components/app-modal.js +2 -2
- package/dist/components/app-modal.js.map +1 -1
- package/dist/components/bc-crmbonus.d.ts +11 -0
- package/dist/components/bc-crmbonus.js +8 -0
- package/dist/components/bc-crmbonus.js.map +1 -0
- package/dist/components/bc-phone-form.d.ts +11 -0
- package/dist/components/bc-phone-form.js +8 -0
- package/dist/components/bc-phone-form.js.map +1 -0
- package/dist/components/bc-phone-validate-pin-form.d.ts +11 -0
- package/dist/components/bc-phone-validate-pin-form.js +8 -0
- package/dist/components/bc-phone-validate-pin-form.js.map +1 -0
- package/dist/components/bc-wake-crmbonus.d.ts +11 -0
- package/dist/components/bc-wake-crmbonus.js +74 -0
- package/dist/components/bc-wake-crmbonus.js.map +1 -0
- package/dist/components/container-empty.js +2 -2
- package/dist/components/container-empty.js.map +1 -1
- package/dist/components/countdown-timer-v2.js +2 -2
- package/dist/components/countdown-timer-v2.js.map +1 -1
- package/dist/components/countdown-timer.js +1 -1
- package/dist/components/crm-bonus-note.js +8 -7
- package/dist/components/crm-bonus-note.js.map +1 -1
- package/dist/components/crm-bonus.js +30 -19
- package/dist/components/crm-bonus.js.map +1 -1
- package/dist/components/crm-button.js +1 -1
- package/dist/components/crm-giftback-form.js +1 -1
- package/dist/components/crm-tooltip.js +1 -1
- package/dist/components/giftback-info.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/loading-container.js +1 -1
- package/dist/components/loading-spinner.js +1 -1
- package/dist/components/p-06d73541.js +80 -0
- package/dist/components/p-06d73541.js.map +1 -0
- package/dist/components/p-09f86f1d.js +106 -0
- package/dist/components/p-09f86f1d.js.map +1 -0
- package/dist/components/p-1b441909.js.map +1 -1
- package/dist/components/p-2362455d.js +195 -0
- package/dist/components/p-2362455d.js.map +1 -0
- package/dist/components/p-2fac7f5e.js +78 -0
- package/dist/components/p-2fac7f5e.js.map +1 -0
- package/dist/components/{p-786485b2.js → p-39bd2459.js} +3 -3
- package/dist/components/p-39bd2459.js.map +1 -0
- package/dist/components/{p-144c34f6.js → p-496bc4af.js} +17 -16
- package/dist/components/p-496bc4af.js.map +1 -0
- package/dist/{esm/cart.helper-8c8d4a0a.js → components/p-60787be2.js} +25 -117
- package/dist/components/p-60787be2.js.map +1 -0
- package/dist/components/{p-0a7ccd8c.js → p-6aa17c2b.js} +6 -6
- package/dist/components/p-6aa17c2b.js.map +1 -0
- package/dist/components/{p-c250687d.js → p-80a69118.js} +4 -4
- package/dist/components/p-80a69118.js.map +1 -0
- package/dist/components/p-81e4e697.js +1298 -0
- package/dist/components/p-81e4e697.js.map +1 -0
- package/dist/components/{p-2cece106.js → p-8f45d088.js} +3 -3
- package/dist/components/p-8f45d088.js.map +1 -0
- package/dist/components/{p-9b5c07d8.js → p-9231dc5e.js} +4 -4
- package/dist/components/p-9231dc5e.js.map +1 -0
- package/dist/components/{p-3c8ae82e.js → p-ade5e41e.js} +11 -10
- package/dist/components/p-ade5e41e.js.map +1 -0
- package/dist/components/p-af3ba015.js.map +1 -1
- package/dist/components/{p-e6863cf5.js → p-bf1d624e.js} +6 -6
- package/dist/components/p-bf1d624e.js.map +1 -0
- package/dist/components/{p-8274e2c4.js → p-c1522ad8.js} +3 -3
- package/dist/components/p-c1522ad8.js.map +1 -0
- package/dist/components/p-c53241bf.js.map +1 -1
- package/dist/components/{p-11520f0f.js → p-eabf185c.js} +3 -3
- package/dist/components/p-eabf185c.js.map +1 -0
- package/dist/components/p-ecc51430.js.map +1 -1
- package/dist/components/{p-9d950d25.js → p-f58c9cb2.js} +2 -2
- package/dist/components/p-f58c9cb2.js.map +1 -0
- package/dist/components/pedido-finalizado.js +5 -4
- package/dist/components/pedido-finalizado.js.map +1 -1
- package/dist/components/phone-form.js +1 -1
- package/dist/components/phone-input-mask.js +1 -1
- package/dist/components/pin-form.js +1 -1
- package/dist/crmbonus-component-wake/assets/logo.svg +17 -17
- package/dist/crmbonus-component-wake/crmbonus-component-wake.esm.js +1 -1
- package/dist/crmbonus-component-wake/crmbonus-component-wake.esm.js.map +1 -1
- package/dist/crmbonus-component-wake/{p-ac027576.entry.js → p-06d494c4.entry.js} +2 -2
- package/dist/crmbonus-component-wake/p-06d494c4.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/{p-8c362346.js → p-19848de4.js} +2 -2
- package/dist/crmbonus-component-wake/p-19848de4.js.map +1 -0
- package/dist/crmbonus-component-wake/p-20d0467e.js +2 -0
- package/dist/crmbonus-component-wake/p-20d0467e.js.map +1 -0
- package/dist/crmbonus-component-wake/p-2362455d.js +2 -0
- package/dist/crmbonus-component-wake/p-2362455d.js.map +1 -0
- package/dist/crmbonus-component-wake/p-2dd97532.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-2dd97532.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/p-3e02757c.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-3e02757c.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/p-4cbebe64.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-4cbebe64.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/{p-0d09c221.js → p-60787be2.js} +2 -2
- package/dist/crmbonus-component-wake/p-60787be2.js.map +1 -0
- package/dist/crmbonus-component-wake/p-6e7c09cd.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-6e7c09cd.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/p-9b556ee6.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-9b556ee6.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/p-af3ba015.js.map +1 -1
- package/dist/crmbonus-component-wake/p-b435da9a.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-b435da9a.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/p-c53241bf.js +2 -0
- package/dist/crmbonus-component-wake/p-c53241bf.js.map +1 -0
- package/dist/crmbonus-component-wake/p-c533ea8b.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-c533ea8b.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/p-c7d03986.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-c7d03986.entry.js.map +1 -0
- package/dist/env.js +2 -2
- package/dist/env.js.map +1 -1
- package/dist/esm/app-modal.entry.js +2 -2
- package/dist/esm/app-modal.entry.js.map +1 -1
- package/dist/esm/bc-crmbonus.entry.js +24 -0
- package/dist/esm/bc-crmbonus.entry.js.map +1 -0
- package/dist/esm/bc-phone-form_2.entry.js +328 -0
- package/dist/esm/bc-phone-form_2.entry.js.map +1 -0
- package/dist/esm/bc-wake-crmbonus.entry.js +14 -0
- package/dist/esm/bc-wake-crmbonus.entry.js.map +1 -0
- package/dist/esm/cart.helper-22ecdec9.js +195 -0
- package/dist/esm/cart.helper-22ecdec9.js.map +1 -0
- package/dist/esm/container-empty.entry.js +2 -2
- package/dist/esm/container-empty.entry.js.map +1 -1
- package/dist/esm/countdown-timer-v2.entry.js +2 -2
- package/dist/esm/countdown-timer-v2.entry.js.map +1 -1
- package/dist/esm/countdown-timer_11.entry.js +41 -29
- package/dist/esm/countdown-timer_11.entry.js.map +1 -1
- package/dist/esm/crm-bonus-note.entry.js +9 -7
- package/dist/esm/crm-bonus-note.entry.js.map +1 -1
- package/dist/esm/crmbonus-component-wake.js +3 -3
- package/dist/{cjs/cart.helper-31ba8997.js → esm/crmbonus.service-d83e6bb6.js} +25 -125
- package/dist/esm/crmbonus.service-d83e6bb6.js.map +1 -0
- package/dist/{cjs/info.config.helper-d4b1291b.js → esm/i18n-b9d8b0cc.js} +2 -36
- package/dist/esm/i18n-b9d8b0cc.js.map +1 -0
- package/dist/esm/{index-bdb70d5a.js → index-09314622.js} +16 -2
- package/dist/esm/index-09314622.js.map +1 -0
- package/dist/esm/info.config.helper-156cb9b2.js +32 -0
- package/dist/esm/info.config.helper-156cb9b2.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/pedido-finalizado.entry.js +5 -4
- package/dist/esm/pedido-finalizado.entry.js.map +1 -1
- package/dist/esm/utils-dec6df66.js.map +1 -1
- package/dist/store.js +25 -0
- package/dist/store.js.map +1 -0
- package/dist/types/components/crmbonus/crmbonus.d.ts +9 -0
- package/dist/types/components/crmbonus/subcomponents/phone-form/index.d.ts +13 -0
- package/dist/types/components/crmbonus/subcomponents/phone-validate/index.d.ts +17 -0
- package/dist/types/components.d.ts +76 -0
- package/dist/types/dto/checkout.dto.d.ts +8 -0
- package/dist/types/dto/pin.sent.d.ts +3 -0
- package/dist/types/dto/validate.pin.bonus.d.ts +9 -0
- package/dist/types/helpers/cart.helper.d.ts +1 -0
- package/dist/types/home/darlison/Projects/Bycoders/crmbonus/crmbonus-component/.stencil/env.d.ts +2 -0
- package/dist/types/home/darlison/Projects/Bycoders/crmbonus/crmbonus-component/.stencil/store.d.ts +11 -0
- package/dist/types/objectvalues/cart.wake.d.ts +2 -1
- package/dist/types/platforms/wake/index.d.ts +3 -0
- package/dist/types/services/crmbonus.service.d.ts +4 -2
- package/package.json +59 -58
- package/readme.md +114 -114
- package/dist/cjs/cart.helper-31ba8997.js.map +0 -1
- package/dist/cjs/index-a7537457.js.map +0 -1
- package/dist/cjs/info.config.helper-d4b1291b.js.map +0 -1
- package/dist/components/p-0a7ccd8c.js.map +0 -1
- package/dist/components/p-0d09c221.js.map +0 -1
- package/dist/components/p-11520f0f.js.map +0 -1
- package/dist/components/p-144c34f6.js.map +0 -1
- package/dist/components/p-2cece106.js.map +0 -1
- package/dist/components/p-3c8ae82e.js.map +0 -1
- package/dist/components/p-786485b2.js.map +0 -1
- package/dist/components/p-8274e2c4.js.map +0 -1
- package/dist/components/p-9b5c07d8.js.map +0 -1
- package/dist/components/p-9d950d25.js.map +0 -1
- package/dist/components/p-c250687d.js.map +0 -1
- package/dist/components/p-e6863cf5.js.map +0 -1
- package/dist/crmbonus-component-wake/p-0d09c221.js.map +0 -1
- package/dist/crmbonus-component-wake/p-1644deef.entry.js +0 -2
- package/dist/crmbonus-component-wake/p-1644deef.entry.js.map +0 -1
- package/dist/crmbonus-component-wake/p-60742512.entry.js +0 -2
- package/dist/crmbonus-component-wake/p-60742512.entry.js.map +0 -1
- package/dist/crmbonus-component-wake/p-7e52727e.entry.js +0 -2
- package/dist/crmbonus-component-wake/p-7e52727e.entry.js.map +0 -1
- package/dist/crmbonus-component-wake/p-8c362346.js.map +0 -1
- package/dist/crmbonus-component-wake/p-ac027576.entry.js.map +0 -1
- package/dist/crmbonus-component-wake/p-ac1e7c32.entry.js +0 -2
- package/dist/crmbonus-component-wake/p-ac1e7c32.entry.js.map +0 -1
- package/dist/crmbonus-component-wake/p-b4f52f79.js +0 -2
- package/dist/crmbonus-component-wake/p-b4f52f79.js.map +0 -1
- package/dist/crmbonus-component-wake/p-df80d1b0.entry.js +0 -2
- package/dist/crmbonus-component-wake/p-df80d1b0.entry.js.map +0 -1
- package/dist/esm/cart.helper-8c8d4a0a.js.map +0 -1
- package/dist/esm/index-bdb70d5a.js.map +0 -1
- package/dist/esm/info.config.helper-e4b8c478.js.map +0 -1
- package/dist/types/Users/Darlison/Projects/Bycoders/crmbonus/crmbonus-component/.stencil/env.d.ts +0 -2
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"crm-bonus.js","sourceRoot":"","sources":["../../../../src/components/crm-bonus/crm-bonus.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAElE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAElE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE7D,OAAO,OAAO,MAAM,iBAAiB,CAAA;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,gCAAgC,EAAE,MAAM,2BAA2B,CAAC;AACtF,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAUpD,MAAM,OAAO,QAAQ;;QAEX,oBAAe,GAAoB,eAAe,CAAC,WAAW,EAAE,CAAC;;yBAK5C,KAAK;yBAEJ,KAAK;;wBAIJ;YAC7B,SAAS,EAAE,EAAE;YACb,QAAQ,EAAE,EAAE;YACZ,IAAI,EAAE,EAAE;YACR,KAAK,EAAE,EAAE;SACV;uBAE2B,KAAK;;;yBAGH,KAAK;;;;iCAKN,KAAK;sBAChB,aAAa;;;IAI/B,KAAK,CAAC,UAAU;QACd,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;QAExC,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,IAAI,CAAC,CAAC;YAChE,OAAO,CAAC,GAAG,CAAC,uBAAuB,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Method, Prop, State, h } from '@stencil/core';\r\nimport { IProduct, IProductWake, ICustomer } from '../../dto/validate.pin.bonus';\r\nimport { CrmBonusService } from '../../services/crmbonus.service';\r\nimport { IPinSent } from '../../components';\r\nimport { defaultStyles, StepFormEnum } from '../../contants';\r\n\r\nimport i18next from '../../i18n/i18n'\r\nimport { buildProductsByWake } from '../../helpers/build.payload.helper';\r\nimport { getCart, getInfoBonusByCartIdAndStoreName } from '../../helpers/cart.helper';\r\nimport { CartWake } from '../../objectvalues/cart.wake';\r\nimport { USED_KEY } from '../../utils/keys.storage';\r\nimport { ReservedInfoDTO } from '../../dto/reserved-info.dto';\r\n\r\n@Component({\r\n tag: 'crm-bonus',\r\n styleUrl: 'crm-bonus.css',\r\n assetsDirs: ['assets'],\r\n // scoped: true\r\n shadow: true\r\n})\r\nexport class CrmBonus {\r\n\r\n private crmBonusService: CrmBonusService = CrmBonusService.getInstance();\r\n\r\n private crmBonusRef: HTMLCrmGiftbackFormElement;\r\n\r\n @Prop() cart;\r\n @Prop() canhidden: boolean = false;\r\n\r\n @State() showModal: boolean = false;\r\n\r\n @State() cartWake: CartWake;\r\n\r\n @State() customer: ICustomer = {\r\n birthDate: \"\",\r\n document: \"\",\r\n name: \"\",\r\n phone: \"\"\r\n };\r\n\r\n @State() loading: boolean = false;\r\n @State() message: string;\r\n @State() phone: number;\r\n @State() canCancel: boolean = false;\r\n @State() amountCancel: string;\r\n @State() sent: IPinSent;\r\n\r\n @State() session: string;\r\n @State() loading_reprocess = false;\r\n @State() styles = defaultStyles;\r\n @State() reservedInfo: ReservedInfoDTO;\r\n\r\n @Method()\r\n async resetBonus() {\r\n console.log('[CRMBONUS] - reset bonus');\r\n\r\n try {\r\n await this.crmBonusRef.processBonus(this.buildProducts(), true);\r\n console.log('[BONUS RESETADO]!!!!!');\r\n } catch (err) {\r\n\r\n this.loading = false;\r\n console.log('[error ao reprocessar bonous]');\r\n await this.crmBonusRef.setStep(StepFormEnum.STEP_PHONE);\r\n } finally {\r\n this.loading = false;\r\n }\r\n }\r\n\r\n @Method()\r\n async setloading() {\r\n this.loading_reprocess = !this.loading_reprocess;\r\n }\r\n\r\n @Method()\r\n async reprocess() {\r\n console.log(\"[CRMBONUS] - reprocess\")\r\n this.loading_reprocess = true\r\n\r\n try {\r\n\r\n const isUse = localStorage.getItem(USED_KEY);\r\n\r\n if (!isUse) return;\r\n\r\n this.cartWake = await getCart();\r\n await this.resetBonus();\r\n } catch (err) {\r\n console.debug('[watchProducts]', err.message);\r\n } finally {\r\n this.loading_reprocess = false\r\n }\r\n }\r\n\r\n async componentWillLoad() {\r\n this.loading_reprocess = true;\r\n window.addEventListener('productRemovedFromCart', async () => {\r\n console.log('[CRMBONUS] - productRemovedFromCart');\r\n await this.reprocess()\r\n });\r\n\r\n window.addEventListener('productAddedToCart', async () => {\r\n console.log('[CRMBONUS] - productAddedToCart');\r\n await this.reprocess();\r\n });\r\n\r\n document.querySelectorAll('form').forEach((el) => {\r\n el.addEventListener(\"submit\", async () => {\r\n console.log(\"[CRMBONUS] - Formulário está sendo submetido!\");\r\n await this.reprocess();\r\n });\r\n });\r\n\r\n document.getElementById('validarCupom')?.addEventListener('click', async () => {\r\n console.log(\"[CRMBONUS] - cupom sendo submetido!\");\r\n setTimeout(async () => {\r\n await this.reprocess();\r\n }, 2000);\r\n });\r\n\r\n await this.observerHandle();\r\n\r\n i18next.changeLanguage(i18next.language);\r\n }\r\n\r\n async componentDidLoad() {\r\n try {\r\n await this.loadSession();\r\n this.handleLoad();\r\n await this.loadConfigStore();\r\n } catch (error) {\r\n console.log('bc:err....')\r\n } finally {\r\n this.loading_reprocess = false;\r\n }\r\n }\r\n\r\n private async observerHandle() {\r\n const elements = document.getElementsByTagName('a');\r\n\r\n document.addEventListener('click', (event) => {\r\n //@ts-ignore\r\n console.log('Clique detectado em:', event.target.href);\r\n console.log('Clique detectado em:', event.target);\r\n \r\n //@ts-ignore\r\n if (['validarCupom'].includes(event.target.id)) {\r\n setTimeout(async () => {\r\n await this.reprocess();\r\n this.observerHandle();\r\n }, 2000);\r\n }\r\n });\r\n\r\n //@ts-ignore\r\n for (let el of elements) {\r\n console.log('[el.href]', el.href);\r\n if (el.href.includes('Produto/Delete')) {\r\n el.addEventListener('click', async () => {\r\n console.log('[CRMBONUS] - Produto removido do carrinho');\r\n\r\n setTimeout(async () => {\r\n await this.reprocess();\r\n this.observerHandle();\r\n }, 2000);\r\n\r\n });\r\n }\r\n\r\n if (el.href.includes('Produto/Add')) {\r\n el.addEventListener('click', async () => {\r\n console.log('[CRMBONUS] - Produto adicionado ao carrinho');\r\n setTimeout(async () => {\r\n await this.reprocess();\r\n this.observerHandle();\r\n }, 2000);\r\n });\r\n }\r\n }\r\n }\r\n\r\n async loadConfigStore() {\r\n const [customization, infoBonus] = await Promise.all([\r\n this.crmBonusService.getCustomization(this.cartWake.store.name),\r\n getInfoBonusByCartIdAndStoreName(this.cartWake.id, this.cartWake.store.name)\r\n ]);\r\n\r\n this.reservedInfo = infoBonus;\r\n\r\n if (customization.keepStoreFrontStyle) {\r\n this.styles = null;\r\n }\r\n }\r\n\r\n async fetchCustomer(userId: number, storeName: string) {\r\n try {\r\n return await this.crmBonusService.getCustomer(userId, storeName);\r\n } catch (error) {\r\n console.error('[fetchCustomer] Error fetching customer:', error);\r\n return null;\r\n }\r\n }\r\n\r\n async handleLoad() {\r\n try {\r\n if (this.cartWake.user.id) {\r\n this.fetchCustomer(this.cartWake.user.id, this.cartWake.store.name).then((customer) => {\r\n if (customer) {\r\n this.customer = customer;\r\n }\r\n });\r\n }\r\n\r\n const amount = localStorage.getItem(this.cartWake.id);\r\n\r\n if (amount) {\r\n this.canCancel = true;\r\n this.amountCancel = amount;\r\n }\r\n\r\n await this.buildAndGetProducts(this.cartWake.products);\r\n } catch (error) {\r\n console.log('info customer')\r\n }\r\n }\r\n\r\n async loadSession() {\r\n this.cartWake = this.cart ? new CartWake(JSON.parse(this.cart)) : await getCart();\r\n console.log('[bc:carregou carrinho]');\r\n\r\n this.session = await this.crmBonusService.getToken(this.cartWake.store.name);\r\n console.log('[bc:carregou session]');\r\n setTimeout(() => {\r\n this.loadSession()\r\n }, 1500000)\r\n }\r\n\r\n async buildAndGetProducts(productsWake: IProductWake[]) {\r\n\r\n const key = `bc-products:${this.cartWake.id}`;\r\n\r\n const productsString = JSON.stringify(productsWake)\r\n\r\n localStorage.setItem(key, productsString);\r\n\r\n const products_in_cache = JSON.parse(localStorage.getItem(key));\r\n\r\n const products: Array<IProductWake> = []\r\n\r\n for (const product_cart of productsWake) {\r\n\r\n const [pro] = products_in_cache.filter(p => p.ProdutoVarianteId == product_cart.ProdutoVarianteId)\r\n\r\n //const [ajuste = { Valor: 0 }] = pro.Ajustes.filter(aj => aj.Tipo === \"Formula\")\r\n\r\n if (pro) {\r\n products.push({\r\n ...product_cart,\r\n PrecoPor: pro.PrecoPor,\r\n PrecoDe: pro.PrecoDe,\r\n Quantidade: pro.Quantidade,\r\n Ajustes: pro.Ajustes\r\n })\r\n } else {\r\n products.push(product_cart)\r\n }\r\n\r\n }\r\n\r\n this.cartWake.products = products; //cache_products ? JSON.parse(cache_products) : JSON.parse(this.productsInString);\r\n\r\n }\r\n\r\n public async sendPin(phone: string) {\r\n this.loading = true;\r\n this.message = \"\";\r\n\r\n try {\r\n\r\n const _phone = phone.replace(/\\D/g, '');\r\n this.phone = Number(_phone);\r\n\r\n this.sent = await this.crmBonusService.sendPin(this.phone, this.customer.name, this.cartWake.store.name);;\r\n\r\n await this.crmBonusRef.setStep(StepFormEnum.STEP_PIN);\r\n\r\n this.showModal = true;\r\n } catch (error) {\r\n this.message = error?.response?.data?.message\r\n } finally {\r\n this.loading = false\r\n }\r\n }\r\n\r\n public async sendPinName(customerName: string) {\r\n this.loading = true;\r\n this.message = \"\";\r\n\r\n try {\r\n this.customer.name = customerName;\r\n\r\n this.sent = await this.crmBonusService.sendPin(this.phone, this.customer.name, this.cartWake.store.name);\r\n\r\n await this.crmBonusRef.setStep(StepFormEnum.STEP_PIN);\r\n\r\n this.showModal = true;\r\n } catch (error) {\r\n this.message = error?.response?.data?.message\r\n } finally {\r\n this.loading = false\r\n }\r\n }\r\n\r\n buildProducts(): IProduct[] {\r\n return buildProductsByWake(this.cartWake.products);\r\n }\r\n\r\n handleCloseModal() {\r\n this.showModal = false;\r\n }\r\n\r\n save(amount: number) {\r\n localStorage.setItem(this.cartWake.id, amount.toString());\r\n this.canCancel = true;\r\n this.amountCancel = amount.toString()\r\n }\r\n\r\n async cancel() {\r\n this.message = \"\";\r\n this.loading = true;\r\n try {\r\n await this.crmBonusService.cancel(this.cartWake.id);\r\n this.canCancel = false;\r\n\r\n localStorage.removeItem(this.cartWake.id);\r\n } catch (error) {\r\n this.message = \"Não consegui cancelar o bônus, tente novamente!\"\r\n } finally {\r\n this.loading = false;\r\n }\r\n }\r\n\r\n async handleSendPin(phone: string) {\r\n this.message = \"\"\r\n if (!phone) {\r\n this.message = \"Informe seu telefone\";\r\n return;\r\n }\r\n\r\n this.customer.phone = phone;\r\n const _phone = phone.replace(/\\D/g, '');\r\n this.phone = Number(_phone);\r\n\r\n if (this.customer.name) {\r\n return this.sendPin(phone)\r\n }\r\n\r\n await this.crmBonusRef.setStep(StepFormEnum.STEP_NAME);\r\n this.showModal = true;\r\n }\r\n\r\n render() {\r\n\r\n if (this.canhidden) {\r\n return null;\r\n }\r\n\r\n return (\r\n <loading-container loading={this.loading_reprocess} text='carregando...' >\r\n\r\n {\r\n !this.loading_reprocess && (\r\n <crm-giftback-form\r\n customStyles={this.styles}\r\n style={{ position: \"relative\" }}\r\n ref={ref => this.crmBonusRef = ref}\r\n storeName={this.cartWake.store.name}\r\n products={this.buildProducts()}\r\n cartId={this.cartWake.id}\r\n customer={this.customer}\r\n loadProducts={() => this.buildProducts()}\r\n loadAll={() => this.handleLoad()}\r\n reservedInfo={this.reservedInfo}\r\n />\r\n )\r\n }\r\n </loading-container>\r\n )\r\n }\r\n}\r\n"]}
|
1
|
+
{"version":3,"file":"crm-bonus.js","sourceRoot":"","sources":["../../../../src/components/crm-bonus/crm-bonus.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAElE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAElE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE7D,OAAO,OAAO,MAAM,iBAAiB,CAAA;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,gCAAgC,EAAE,MAAM,2BAA2B,CAAC;AAChG,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAUpD,MAAM,OAAO,QAAQ;;QAEX,oBAAe,GAAoB,eAAe,CAAC,WAAW,EAAE,CAAC;;yBAK5C,KAAK;yBAEJ,KAAK;;wBAIJ;YAC7B,SAAS,EAAE,EAAE;YACb,QAAQ,EAAE,EAAE;YACZ,IAAI,EAAE,EAAE;YACR,KAAK,EAAE,EAAE;SACV;uBAE2B,KAAK;;;yBAGH,KAAK;;;;iCAKN,KAAK;sBAChB,aAAa;;;IAI/B,KAAK,CAAC,UAAU;QACd,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;QAExC,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,IAAI,CAAC,CAAC;YAChE,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;QACvC,CAAC;QAAC,OAAO,GAAG,EAAE,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EAAE,IAAI,CAAC,MAAM,EACzB,KAAK,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,EAC/B,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,GAAG,GAAG,EAClC,SAAS,EAAE,MAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,KAAK,0CAAE,IAAI,EACrC,QAAQ,EAAE,IAAI,CAAC,aAAa,EAAE,EAC9B,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,EACxB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE,EACxC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE,EAChC,YAAY,EAAE,IAAI,CAAC,YAAY,GAC/B,CACH,CAEe,CACrB,CAAA;IACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Method, Prop, State, h } from '@stencil/core';\nimport { IProduct, IProductWake, ICustomer } from '../../dto/validate.pin.bonus';\nimport { CrmBonusService } from '../../services/crmbonus.service';\nimport { IPinSent } from '../../components';\nimport { defaultStyles, StepFormEnum } from '../../contants';\n\nimport i18next from '../../i18n/i18n'\nimport { buildProductsByWake } from '../../helpers/build.payload.helper';\nimport { getCartStoreFront, getInfoBonusByCartIdAndStoreName } from '../../helpers/cart.helper';\nimport { CartWake } from '../../objectvalues/cart.wake';\nimport { USED_KEY } from '../../utils/keys.storage';\nimport { ReservedInfoDTO } from '../../dto/reserved-info.dto';\n\n@Component({\n tag: 'crm-bonus',\n styleUrl: 'crm-bonus.css',\n assetsDirs: ['assets'],\n // scoped: true\n shadow: true\n})\nexport class CrmBonus {\n\n private crmBonusService: CrmBonusService = CrmBonusService.getInstance();\n\n private crmBonusRef: HTMLCrmGiftbackFormElement;\n\n @Prop() cart;\n @Prop() canhidden: boolean = false;\n\n @State() showModal: boolean = false;\n\n @State() cartWake: CartWake;\n\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 @State() styles = defaultStyles;\n @State() reservedInfo: ReservedInfoDTO;\n\n @Method()\n async resetBonus() {\n console.log('[CRMBONUS] - reset bonus');\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 setloading() {\n this.loading_reprocess = !this.loading_reprocess;\n }\n\n @Method()\n async reprocess() {\n console.log(\"[CRMBONUS] - reprocess\")\n this.loading_reprocess = true\n\n try {\n\n const isUse = localStorage.getItem(USED_KEY);\n\n if (!isUse) return;\n\n this.cartWake = await getCartStoreFront();\n await this.resetBonus();\n } catch (err) {\n console.debug('[watchProducts]', err.message);\n } finally {\n this.loading_reprocess = false\n }\n }\n\n async componentWillLoad() {\n this.loading_reprocess = true;\n window.addEventListener('productRemovedFromCart', async () => {\n console.log('[CRMBONUS] - productRemovedFromCart');\n await this.reprocess()\n });\n\n window.addEventListener('productAddedToCart', async () => {\n console.log('[CRMBONUS] - productAddedToCart');\n await this.reprocess();\n });\n\n document.querySelectorAll('form').forEach((el) => {\n el.addEventListener(\"submit\", async () => {\n console.log(\"[CRMBONUS] - Formulário está sendo submetido!\");\n await this.reprocess();\n });\n });\n\n document.getElementById('validarCupom')?.addEventListener('click', async () => {\n console.log(\"[CRMBONUS] - cupom sendo submetido!\");\n setTimeout(async () => {\n await this.reprocess();\n }, 2000);\n });\n\n await this.observerHandle();\n\n i18next.changeLanguage(i18next.language);\n }\n\n async componentDidLoad() {\n try {\n await this.loadSession();\n this.handleLoad();\n await this.loadConfigStore();\n } catch (error) {\n console.log('bc:err....')\n } finally {\n this.loading_reprocess = false;\n }\n }\n\n\n\n private async observerHandle() {\n const elements = document.getElementsByTagName('a');\n\n document.addEventListener('click', (event) => {\n //@ts-ignore\n console.log('Clique detectado em:', event.target.href);\n //@ts-ignore\n console.log('Clique detectado em:', event.target.id);\n console.log('Clique detectado em:', event.target);\n\n //@ts-ignore\n if (['validarCupom', 'removerCupomCarrinho'].includes(event.target.id)) {\n setTimeout(async () => {\n await this.reprocess();\n this.observerHandle();\n }, 2000);\n }\n\n //@ts-ignore\n if(['crm_label'].includes(event.target.id)) {\n this.crmBonusService.saveTracking(this.cartWake?.id, { action: 'click_label', storeName: this.cartWake?.store?.name });\n }\n });\n \n\n //@ts-ignore\n for (let el of elements) {\n console.log('[el.href]', el.href);\n if (el.href.includes('Produto/Delete')) {\n el.addEventListener('click', async () => {\n console.log('[CRMBONUS] - Produto removido do carrinho');\n\n setTimeout(async () => {\n await this.reprocess();\n this.observerHandle();\n }, 2000);\n\n });\n }\n\n if (el.href.includes('Produto/Add')) {\n el.addEventListener('click', async () => {\n console.log('[CRMBONUS] - Produto adicionado ao carrinho');\n setTimeout(async () => {\n await this.reprocess();\n this.observerHandle();\n }, 2000);\n });\n }\n }\n }\n\n async loadConfigStore() {\n const [customization, infoBonus] = await Promise.all([\n this.crmBonusService.getCustomization(this.cartWake.store.name),\n getInfoBonusByCartIdAndStoreName(this.cartWake.id, this.cartWake.store.name)\n ]);\n\n this.reservedInfo = infoBonus;\n\n if (customization.keepStoreFrontStyle) {\n this.styles = null;\n }\n }\n\n async fetchCustomer(userId: number, storeName: string) {\n try {\n return await this.crmBonusService.getCustomer(userId, storeName);\n } catch (error) {\n console.error('[fetchCustomer] Error fetching customer:', error);\n return null;\n }\n }\n\n async handleLoad() {\n try {\n if (this.cartWake.user.id) {\n this.fetchCustomer(this.cartWake.user.id, this.cartWake.store.name).then((customer) => {\n if (customer) {\n this.customer = customer;\n }\n });\n }\n\n const amount = localStorage.getItem(this.cartWake.id);\n\n if (amount) {\n this.canCancel = true;\n this.amountCancel = amount;\n }\n\n await this.buildAndGetProducts(this.cartWake.products);\n } catch (error) {\n console.log('info customer')\n }\n }\n\n async loadSession() {\n this.cartWake = this.cart ? CartWake.fromCheckout(JSON.parse(this.cart)) : await getCartStoreFront();\n console.log('[bc:carregou carrinho]', this.cartWake);\n\n this.session = await this.crmBonusService.getToken(this.cartWake.store.name);\n console.log('[bc:carregou session]');\n setTimeout(() => {\n this.loadSession()\n }, 1500000)\n }\n\n async buildAndGetProducts(productsWake: IProductWake[]) {\n\n const key = `bc-products:${this.cartWake.id}`;\n\n const productsString = JSON.stringify(productsWake)\n\n localStorage.setItem(key, productsString);\n\n const products_in_cache = JSON.parse(localStorage.getItem(key));\n\n const products: Array<IProductWake> = []\n\n for (const product_cart of productsWake) {\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,\n PrecoDe: pro.PrecoDe,\n Quantidade: pro.Quantidade,\n Ajustes: pro.Ajustes\n })\n } else {\n products.push(product_cart)\n }\n\n }\n\n this.cartWake.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.cartWake.store.name);;\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.cartWake.store.name);\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.cartWake?.products || []);\n }\n\n handleCloseModal() {\n this.showModal = false;\n }\n\n save(amount: number) {\n localStorage.setItem(this.cartWake.id, 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.cartWake.id);\n this.canCancel = false;\n\n localStorage.removeItem(this.cartWake.id);\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 if (this.canhidden) {\n return null;\n }\n\n return (\n <loading-container loading={this.loading_reprocess} text='carregando...' >\n { this.loading_reprocess && <div class=\"empty-container\"></div> }\n {\n !this.loading_reprocess && this.cartWake && (\n <crm-giftback-form\n customStyles={this.styles}\n style={{ position: \"relative\" }}\n ref={ref => this.crmBonusRef = ref}\n storeName={this.cartWake?.store?.name}\n products={this.buildProducts()}\n cartId={this.cartWake.id}\n customer={this.customer}\n loadProducts={() => this.buildProducts()}\n loadAll={() => this.handleLoad()}\n reservedInfo={this.reservedInfo}\n />\n )\n }\n </loading-container>\n )\n }\n}\n"]}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import { h } from "@stencil/core";
|
2
|
+
import { CrmBonusService } from "../../services/crmbonus.service";
|
3
|
+
export class CrmBonus {
|
4
|
+
constructor() {
|
5
|
+
this.storeName = 'bycoders';
|
6
|
+
this.crmBonusService = CrmBonusService.getInstance();
|
7
|
+
this.checkout = {};
|
8
|
+
}
|
9
|
+
async handlerToken() {
|
10
|
+
await this.crmBonusService.getToken(this.storeName);
|
11
|
+
}
|
12
|
+
componentDidLoad() {
|
13
|
+
this.handlerToken();
|
14
|
+
}
|
15
|
+
render() {
|
16
|
+
return (h("div", { key: 'cefc590c81f4de1a44fd67cbd599c6a5366f2ee7' }, h("bc-phone-form", { key: '126d01e0c4da26d9c2b56c74580eb2988fbc58ad', storeName: this.storeName }), h("bc-phone-validate-pin-form", { key: 'c08a9c81a1394deb787e5ff7b353aea596985a22', storeName: this.storeName })));
|
17
|
+
}
|
18
|
+
static get is() { return "bc-crmbonus"; }
|
19
|
+
static get encapsulation() { return "shadow"; }
|
20
|
+
static get states() {
|
21
|
+
return {
|
22
|
+
"checkout": {}
|
23
|
+
};
|
24
|
+
}
|
25
|
+
}
|
26
|
+
//# sourceMappingURL=crmbonus.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"crmbonus.js","sourceRoot":"","sources":["../../../../src/components/crmbonus/crmbonus.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAOlE,MAAM,OAAO,QAAQ;;QAEjB,cAAS,GAAG,UAAU,CAAA;QAEd,oBAAe,GAAG,eAAe,CAAC,WAAW,EAAE,CAAC;wBAEb,EAAE;;IAE7C,KAAK,CAAC,YAAY;QACd,MAAM,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACxD,CAAC;IAED,gBAAgB;QACZ,IAAI,CAAC,YAAY,EAAE,CAAC;IACxB,CAAC;IAGD,MAAM;QACF,OAAO,CACH;YACI,sEAAe,SAAS,EAAE,IAAI,CAAC,SAAS,GAAI;YAE5C,mFAA4B,SAAS,EAAE,IAAI,CAAC,SAAS,GAAI,CACvD,CACT,CAAA;IACL,CAAC;;;;;;CACJ","sourcesContent":["import { Component, h, State } from \"@stencil/core\";\nimport { CrmBonusService } from \"../../services/crmbonus.service\";\nimport { ICheckoutDTO } from \"../../dto/checkout.dto\";\n\n@Component({\n tag: 'bc-crmbonus',\n shadow: true\n})\nexport class CrmBonus {\n\n storeName = 'bycoders'\n\n private crmBonusService = CrmBonusService.getInstance();\n\n @State() checkout: Partial<ICheckoutDTO> = {}\n\n async handlerToken() {\n await this.crmBonusService.getToken(this.storeName);\n }\n\n componentDidLoad() {\n this.handlerToken();\n }\n\n\n render() {\n return (\n <div>\n <bc-phone-form storeName={this.storeName} />\n\n <bc-phone-validate-pin-form storeName={this.storeName} />\n </div>\n )\n }\n}"]}
|
@@ -0,0 +1,95 @@
|
|
1
|
+
import { h } from "@stencil/core";
|
2
|
+
import { CrmBonusService } from "../../../../services/crmbonus.service";
|
3
|
+
import store from "../../../../../store";
|
4
|
+
export class PhoneForm {
|
5
|
+
constructor() {
|
6
|
+
this.crmbonusService = CrmBonusService.getInstance();
|
7
|
+
this.loading = false;
|
8
|
+
this.storeName = '';
|
9
|
+
}
|
10
|
+
async handlerPhone() {
|
11
|
+
this.loading = true;
|
12
|
+
try {
|
13
|
+
const phoneMask = await this.phoneInputMask.getPhone();
|
14
|
+
const phone = phoneMask.replace(/\D/g, '');
|
15
|
+
const send = await this.crmbonusService.sendPin(Number(phone), '', this.storeName);
|
16
|
+
store.checkout.cellphone = Number(phone);
|
17
|
+
store.checkout.crmbonuStoreId = send.storeId;
|
18
|
+
store.checkout.crmbonusUserId = send.userId;
|
19
|
+
}
|
20
|
+
catch (error) {
|
21
|
+
this.actionError.emit({
|
22
|
+
message: error.message
|
23
|
+
});
|
24
|
+
}
|
25
|
+
finally {
|
26
|
+
this.loading = false;
|
27
|
+
}
|
28
|
+
}
|
29
|
+
render() {
|
30
|
+
return (h("div", { key: 'b14641104823437a9ab8d358b9326163b86a1c2e', class: "phone-form" }, h("span", { key: '0c6aca3e25b12f651402086bff2405de112d47ca' }, "Digite o seu celular para verificar se h\u00E1 desconto dispon\u00EDvel nessa compra:"), h("phone-input-mask", { key: '3362b63ed0afcda46a2ec82784786ab3ce139969', ref: ref => this.phoneInputMask = ref }), h("crm-button", { key: '4dfc4e036d8689cbde15edce49b9f71ad73748c3', loading: this.loading, txtBtn: "Avan\u00E7ar", handleClick: () => this.handlerPhone() })));
|
31
|
+
}
|
32
|
+
static get is() { return "bc-phone-form"; }
|
33
|
+
static get encapsulation() { return "shadow"; }
|
34
|
+
static get originalStyleUrls() {
|
35
|
+
return {
|
36
|
+
"$": ["styles.scss"]
|
37
|
+
};
|
38
|
+
}
|
39
|
+
static get styleUrls() {
|
40
|
+
return {
|
41
|
+
"$": ["styles.css"]
|
42
|
+
};
|
43
|
+
}
|
44
|
+
static get properties() {
|
45
|
+
return {
|
46
|
+
"storeName": {
|
47
|
+
"type": "string",
|
48
|
+
"mutable": false,
|
49
|
+
"complexType": {
|
50
|
+
"original": "string",
|
51
|
+
"resolved": "string",
|
52
|
+
"references": {}
|
53
|
+
},
|
54
|
+
"required": false,
|
55
|
+
"optional": false,
|
56
|
+
"docs": {
|
57
|
+
"tags": [],
|
58
|
+
"text": ""
|
59
|
+
},
|
60
|
+
"attribute": "store-name",
|
61
|
+
"reflect": false,
|
62
|
+
"defaultValue": "''"
|
63
|
+
}
|
64
|
+
};
|
65
|
+
}
|
66
|
+
static get states() {
|
67
|
+
return {
|
68
|
+
"loading": {}
|
69
|
+
};
|
70
|
+
}
|
71
|
+
static get events() {
|
72
|
+
return [{
|
73
|
+
"method": "actionError",
|
74
|
+
"name": "actionError",
|
75
|
+
"bubbles": true,
|
76
|
+
"cancelable": true,
|
77
|
+
"composed": true,
|
78
|
+
"docs": {
|
79
|
+
"tags": [],
|
80
|
+
"text": ""
|
81
|
+
},
|
82
|
+
"complexType": {
|
83
|
+
"original": "Partial<{ message: string }>",
|
84
|
+
"resolved": "{ message?: string; }",
|
85
|
+
"references": {
|
86
|
+
"Partial": {
|
87
|
+
"location": "global",
|
88
|
+
"id": "global::Partial"
|
89
|
+
}
|
90
|
+
}
|
91
|
+
}
|
92
|
+
}];
|
93
|
+
}
|
94
|
+
}
|
95
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/components/crmbonus/subcomponents/phone-form/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAExE,OAAO,KAAK,MAAM,sBAAsB,CAAC;AAOzC,MAAM,OAAO,SAAS;;QAIlB,oBAAe,GAAG,eAAe,CAAC,WAAW,EAAE,CAAC;uBAE7B,KAAK;yBAEJ,EAAE;;IAItB,KAAK,CAAC,YAAY;QACd,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC;YACD,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;YACvD,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAC3C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;YAEnF,KAAK,CAAC,QAAQ,CAAC,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;YACzC,KAAK,CAAC,QAAQ,CAAC,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC;YAC7C,KAAK,CAAC,QAAQ,CAAC,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC;QAEhD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;gBAClB,OAAO,EAAE,KAAK,CAAC,OAAO;aACzB,CAAC,CAAC;QACP,CAAC;gBAAS,CAAC;YACP,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACzB,CAAC;IACL,CAAC;IAED,MAAM;QACF,OAAO,CACH,4DAAK,KAAK,EAAC,YAAY;YACnB,uJAAwF;YACxF,yEAAkB,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,cAAc,GAAG,GAAG,GAAI;YAC3D,mEAAY,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAC,cAAS,EAAC,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,GAAI,CAC5F,CACT,CAAA;IACL,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import { Component, Event, EventEmitter, h, Prop, State } from \"@stencil/core\";\nimport { CrmBonusService } from \"../../../../services/crmbonus.service\";\n\nimport store from '../../../../../store';\n\n@Component({\n tag: 'bc-phone-form',\n shadow: true,\n styleUrl: 'styles.scss'\n})\nexport class PhoneForm {\n\n private phoneInputMask: HTMLPhoneInputMaskElement;\n\n crmbonusService = CrmBonusService.getInstance();\n\n @State() loading = false;\n\n @Prop() storeName = '';\n\n @Event() actionError: EventEmitter<Partial<{ message: string }>>;\n\n async handlerPhone() {\n this.loading = true;\n try {\n const phoneMask = await this.phoneInputMask.getPhone();\n const phone = phoneMask.replace(/\\D/g, '');\n const send = await this.crmbonusService.sendPin(Number(phone), '', this.storeName);\n\n store.checkout.cellphone = Number(phone);\n store.checkout.crmbonuStoreId = send.storeId;\n store.checkout.crmbonusUserId = send.userId;\n\n } catch (error) {\n this.actionError.emit({\n message: error.message\n });\n } finally {\n this.loading = false;\n }\n }\n\n render() {\n return (\n <div class=\"phone-form\">\n <span>Digite o seu celular para verificar se há desconto disponível nessa compra:</span>\n <phone-input-mask ref={ref => this.phoneInputMask = ref} />\n <crm-button loading={this.loading} txtBtn=\"Avançar\" handleClick={() => this.handlerPhone()} />\n </div>\n )\n }\n}"]}
|
@@ -0,0 +1,129 @@
|
|
1
|
+
import { h } from "@stencil/core";
|
2
|
+
import i18next from "../../../../i18n/i18n";
|
3
|
+
import store from "../../../../../store";
|
4
|
+
import { CrmBonusService } from "../../../../services/crmbonus.service";
|
5
|
+
export class PhoneValidatePinForm {
|
6
|
+
constructor() {
|
7
|
+
this.crmbonusService = CrmBonusService.getInstance();
|
8
|
+
this.storeName = '';
|
9
|
+
this.phone = undefined;
|
10
|
+
this.cancel = undefined;
|
11
|
+
this.pin = ['', '', '', ''];
|
12
|
+
this.isVerified = false;
|
13
|
+
this.canResend = false;
|
14
|
+
this.loading = false;
|
15
|
+
}
|
16
|
+
handleInput(event, index) {
|
17
|
+
const input = event.target;
|
18
|
+
const value = input.value.slice(0, 1); // Limitar a um único dígito
|
19
|
+
this.pin[index] = value;
|
20
|
+
// Focar no próximo campo, se possível
|
21
|
+
if (value && index < this.pin.length - 1) {
|
22
|
+
const nextInput = input.nextElementSibling;
|
23
|
+
nextInput === null || nextInput === void 0 ? void 0 : nextInput.focus();
|
24
|
+
}
|
25
|
+
this.pin = [...this.pin];
|
26
|
+
}
|
27
|
+
async handleResend() {
|
28
|
+
// await this.resend();
|
29
|
+
this.canResend = false;
|
30
|
+
this.pin = ['', '', '', ''];
|
31
|
+
}
|
32
|
+
buildTime() {
|
33
|
+
const resendDate = localStorage.getItem("bc:resend");
|
34
|
+
if (resendDate) {
|
35
|
+
return resendDate;
|
36
|
+
}
|
37
|
+
const date = new Date();
|
38
|
+
date.setSeconds(date.getSeconds() + 30);
|
39
|
+
localStorage.setItem("bc:resend", date.toString());
|
40
|
+
return date.toString();
|
41
|
+
}
|
42
|
+
handleTimeout() {
|
43
|
+
localStorage.removeItem("bc:resend");
|
44
|
+
this.canResend = true;
|
45
|
+
}
|
46
|
+
validatePin() {
|
47
|
+
console.log('[x][STORE]', store.checkout);
|
48
|
+
// this.crmbonusService.validatePinBonus()
|
49
|
+
}
|
50
|
+
render() {
|
51
|
+
var _a;
|
52
|
+
return (h("div", { key: '0ba777997120acd11e83043f3450bf7288cb5665', class: "crm-phone-form" }, h("label", { key: '75d3ba7803982927d14da4f99c84a1e1cb4a827e', class: "crm-subtitle" }, i18next.t('pin-sutitle'), " ", h("strong", { key: '04042da34bb9b90822187bc5f3d03dd309cc87d0' }, "+55 ", this.phone)), h("div", { key: '8250a29967cacc8eb0c9a00dab6e3e59280e5870', class: "pin-container" }, this.pin.map((_, index) => (h("input", { type: "text", maxLength: 1, value: this.pin[index], onInput: (event) => this.handleInput(event, index) })))), h("slot", { key: 'df1e2e9cc3033ee760ae1bf607e311e0038743cb' }), h("p", { key: 'beeea228c5c108588f38f64052cffed424ff7539', class: "crm-description" }, " N\u00E3o recebeu?", !this.canResend && h("label", { key: 'b304f40425994ddfc905ab3b0c18db738b8a2d3b' }, " Reenviar em", h("countdown-timer", { key: '776f50ddc79cd0813aa49dfa236a955aa5994b7c', minutos: 0, segundos: 30, dataCriacao: this.buildTime(), downtime: () => this.handleTimeout() }), " "), this.canResend && (h("div", { key: '02a4d05b7c15097881cece7752a36671d29162db' }, h("a", { key: 'b6bd0961dc687b8c4f601c668b0ba2cdfa83a339', onClick: () => this.handleResend() }, "Reenviar"), h("a", { key: 'd348c9fe25a728b098b8ef2359a724c9b2956e98', onClick: () => this.cancel() }, "Trocar n\u00FAmero")))), h("crm-button", { key: '0382610ed7d6a7fda3f8851e30e3852320e2ff23', txtBtn: ((_a = store === null || store === void 0 ? void 0 : store.storeConfig) === null || _a === void 0 ? void 0 : _a.btnApplyBonusLabel) || "Avançar", loading: this.loading, handleClick: () => this.validatePin() })));
|
53
|
+
}
|
54
|
+
static get is() { return "bc-phone-validate-pin-form"; }
|
55
|
+
static get encapsulation() { return "shadow"; }
|
56
|
+
static get originalStyleUrls() {
|
57
|
+
return {
|
58
|
+
"$": ["styles.scss"]
|
59
|
+
};
|
60
|
+
}
|
61
|
+
static get styleUrls() {
|
62
|
+
return {
|
63
|
+
"$": ["styles.css"]
|
64
|
+
};
|
65
|
+
}
|
66
|
+
static get properties() {
|
67
|
+
return {
|
68
|
+
"storeName": {
|
69
|
+
"type": "string",
|
70
|
+
"mutable": false,
|
71
|
+
"complexType": {
|
72
|
+
"original": "string",
|
73
|
+
"resolved": "string",
|
74
|
+
"references": {}
|
75
|
+
},
|
76
|
+
"required": false,
|
77
|
+
"optional": false,
|
78
|
+
"docs": {
|
79
|
+
"tags": [],
|
80
|
+
"text": ""
|
81
|
+
},
|
82
|
+
"attribute": "store-name",
|
83
|
+
"reflect": false,
|
84
|
+
"defaultValue": "''"
|
85
|
+
},
|
86
|
+
"phone": {
|
87
|
+
"type": "number",
|
88
|
+
"mutable": false,
|
89
|
+
"complexType": {
|
90
|
+
"original": "number",
|
91
|
+
"resolved": "number",
|
92
|
+
"references": {}
|
93
|
+
},
|
94
|
+
"required": false,
|
95
|
+
"optional": false,
|
96
|
+
"docs": {
|
97
|
+
"tags": [],
|
98
|
+
"text": ""
|
99
|
+
},
|
100
|
+
"attribute": "phone",
|
101
|
+
"reflect": false
|
102
|
+
},
|
103
|
+
"cancel": {
|
104
|
+
"type": "unknown",
|
105
|
+
"mutable": false,
|
106
|
+
"complexType": {
|
107
|
+
"original": "() => void",
|
108
|
+
"resolved": "() => void",
|
109
|
+
"references": {}
|
110
|
+
},
|
111
|
+
"required": false,
|
112
|
+
"optional": false,
|
113
|
+
"docs": {
|
114
|
+
"tags": [],
|
115
|
+
"text": ""
|
116
|
+
}
|
117
|
+
}
|
118
|
+
};
|
119
|
+
}
|
120
|
+
static get states() {
|
121
|
+
return {
|
122
|
+
"pin": {},
|
123
|
+
"isVerified": {},
|
124
|
+
"canResend": {},
|
125
|
+
"loading": {}
|
126
|
+
};
|
127
|
+
}
|
128
|
+
}
|
129
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/components/crmbonus/subcomponents/phone-validate/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,OAAO,MAAM,uBAAuB,CAAA;AAC3C,OAAO,KAAK,MAAM,sBAAsB,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAOxE,MAAM,OAAO,oBAAoB;;QAE7B,oBAAe,GAAG,eAAe,CAAC,WAAW,EAAE,CAAC;yBAEpB,EAAE;;;mBAIL,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;0BACV,KAAK;yBACN,KAAK;uBAChB,KAAK;;IAExB,WAAW,CAAC,KAAY,EAAE,KAAa;QACnC,MAAM,KAAK,GAAG,KAAK,CAAC,MAA0B,CAAC;QAC/C,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,4BAA4B;QACnE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;QAExB,sCAAsC;QACtC,IAAI,KAAK,IAAI,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvC,MAAM,SAAS,GAAG,KAAK,CAAC,kBAAsC,CAAC;YAC/D,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,KAAK,EAAE,CAAC;QACvB,CAAC;QAED,IAAI,CAAC,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,YAA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CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,GACpD,CACL,CAAC,CACA;YAEN,8DAAa;YAEb,0DAAG,KAAK,EAAC,iBAAiB;;gBAElB,CAAC,IAAI,CAAC,SAAS,IAAI;;oBACf,wEAAiB,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,WAAW,EAAE,IAAI,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE,GAAI;wBAAS;gBAG/H,IAAI,CAAC,SAAS,IAAI,CACd;oBACI,0DAAG,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,eAAc;oBACnD,0DAAG,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,yBAAmB,CAChD,CACT,CAEL;YACJ,mEAAY,MAAM,EAAE,CAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,WAAW,0CAAE,kBAAkB,KAAI,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,GAAI,CACtI,CACV,CAAC;IACN,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import { Component, h, Prop, State } from \"@stencil/core\";\n\nimport i18next from '../../../../i18n/i18n'\nimport store from '../../../../../store';\nimport { CrmBonusService } from \"../../../../services/crmbonus.service\";\n\n@Component({\n tag: 'bc-phone-validate-pin-form',\n shadow: true,\n styleUrl: 'styles.scss'\n})\nexport class PhoneValidatePinForm {\n\n crmbonusService = CrmBonusService.getInstance();\n\n @Prop() storeName: string = '';\n @Prop() phone: number;\n @Prop() cancel: () => void;\n\n @State() pin: string[] = ['', '', '', ''];\n @State() isVerified: boolean = false;\n @State() canResend: boolean = false;\n @State() loading = false;\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 async handleResend() {\n // await this.resend();\n\n this.canResend = false;\n this.pin = ['', '', '', ''];\n }\n\n buildTime() {\n const resendDate = localStorage.getItem(\"bc:resend\");\n\n if(resendDate) {\n return resendDate;\n }\n\n const date = new Date();\n date.setSeconds(date.getSeconds() + 30);\n localStorage.setItem(\"bc:resend\", date.toString());\n\n return date.toString();\n }\n\n handleTimeout() {\n localStorage.removeItem(\"bc:resend\")\n this.canResend = true;\n }\n\n validatePin() {\n console.log('[x][STORE]', store.checkout);\n\n // this.crmbonusService.validatePinBonus()\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\n <countdown-timer minutos={0} segundos={30} dataCriacao={this.buildTime()} 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={store?.storeConfig?.btnApplyBonusLabel || \"Avançar\"} loading={this.loading} handleClick={() => this.validatePin()} />\n </div >\n );\n }\n}"]}
|
@@ -0,0 +1,84 @@
|
|
1
|
+
:host {
|
2
|
+
display: block;
|
3
|
+
}
|
4
|
+
|
5
|
+
.form-container-pin {
|
6
|
+
display: flex;
|
7
|
+
flex-direction: column;
|
8
|
+
align-items: center;
|
9
|
+
}
|
10
|
+
|
11
|
+
.pin-container {
|
12
|
+
display: flex;
|
13
|
+
/* margin: 26px 0; */
|
14
|
+
justify-content: start;
|
15
|
+
gap: 10px;
|
16
|
+
}
|
17
|
+
|
18
|
+
.pin-container input {
|
19
|
+
width: 100%;
|
20
|
+
height: 48px;
|
21
|
+
/* font-size: 14px; */
|
22
|
+
text-align: center;
|
23
|
+
border: 1px solid #ccc;
|
24
|
+
border-radius: 5px;
|
25
|
+
}
|
26
|
+
|
27
|
+
button {
|
28
|
+
padding: 10px 20px;
|
29
|
+
background-color: #ddd;
|
30
|
+
border: none;
|
31
|
+
border-radius: 5px;
|
32
|
+
cursor: pointer;
|
33
|
+
}
|
34
|
+
|
35
|
+
|
36
|
+
.success {
|
37
|
+
color: green;
|
38
|
+
margin-top: 10px;
|
39
|
+
}
|
40
|
+
|
41
|
+
.button {
|
42
|
+
top: 50%;
|
43
|
+
background-color: #6c6c7e;
|
44
|
+
color: #fff;
|
45
|
+
border: none;
|
46
|
+
border-radius: 10px;
|
47
|
+
padding: 15px;
|
48
|
+
min-height: 30px;
|
49
|
+
min-width: 120px;
|
50
|
+
/* font-size: 20px; */
|
51
|
+
cursor: pointer;
|
52
|
+
}
|
53
|
+
|
54
|
+
.button-cancel {
|
55
|
+
top: 50%;
|
56
|
+
background-color: #ffffff;
|
57
|
+
color: #1e1c1c;
|
58
|
+
border: 1px solid gray;
|
59
|
+
border-radius: 10px;
|
60
|
+
padding: 10px;
|
61
|
+
min-height: 30px;
|
62
|
+
min-width: 120px;
|
63
|
+
/* font-size: 19px; */
|
64
|
+
cursor: pointer;
|
65
|
+
}
|
66
|
+
|
67
|
+
.crm-description {
|
68
|
+
/* font-size: 14px; */
|
69
|
+
width: 100%;
|
70
|
+
display: flex;
|
71
|
+
gap: 9px;
|
72
|
+
flex-wrap: wrap;
|
73
|
+
}
|
74
|
+
|
75
|
+
.crm-description a {
|
76
|
+
font-weight: bold;
|
77
|
+
cursor: pointer;
|
78
|
+
text-decoration: underline;
|
79
|
+
}
|
80
|
+
|
81
|
+
.crm-description div {
|
82
|
+
display: flex;
|
83
|
+
gap: 5px;
|
84
|
+
}
|
@@ -1,75 +1,75 @@
|
|
1
|
-
* {
|
2
|
-
margin: 0;
|
3
|
-
padding: 0;
|
4
|
-
box-sizing: border-box;
|
5
|
-
}
|
6
|
-
|
7
|
-
:host {
|
8
|
-
--crmfont-sizebodymd: 14px;
|
9
|
-
--crmline-heightbodymd: 20px;
|
10
|
-
--crmletter-spacingtitle-md: 0px
|
11
|
-
}
|
12
|
-
|
13
|
-
.container-message {
|
14
|
-
/* font-size: var(--crmfont-sizebodymd); */
|
15
|
-
font-weight: 400;
|
16
|
-
line-height: var(--crmline-heightbodymd);
|
17
|
-
letter-spacing: var(--crmletter-spacingtitle-md);
|
18
|
-
text-align: left;
|
19
|
-
text-underline-position: from-font;
|
20
|
-
text-decoration-skip-ink: none;
|
21
|
-
}
|
22
|
-
|
23
|
-
.crm-container-form {
|
24
|
-
display: flex;
|
25
|
-
flex-direction: column;
|
26
|
-
justify-content: space-around;
|
27
|
-
height: auto;
|
28
|
-
padding: 20px 24px 20px 24px;
|
29
|
-
border: 1px solid #CCCC;
|
30
|
-
writing-mode: horizontal-tb;
|
31
|
-
gap: 16px;
|
32
|
-
border-top: 1px solid #ccc !important;
|
33
|
-
border-bottom: 1px solid #ccc !important;
|
34
|
-
}
|
35
|
-
|
36
|
-
/* .fbits-responsive-carrinho-desconto {
|
37
|
-
overflow: hidden;
|
38
|
-
border: 1px solid #ccc;
|
39
|
-
border-top: 0;
|
40
|
-
border-bottom: 0;
|
41
|
-
} */
|
42
|
-
|
43
|
-
.crm-phone-form {
|
44
|
-
display: flex;
|
45
|
-
flex-direction: column;
|
46
|
-
height: 100%;
|
47
|
-
/* justify-content: space-around; */
|
48
|
-
gap: 16px;
|
49
|
-
}
|
50
|
-
|
51
|
-
.crm-subtitle {
|
52
|
-
/* font-size: 14px; */
|
53
|
-
font-size: .875rem;
|
54
|
-
line-height: 1.25rem;
|
55
|
-
|
56
|
-
}
|
57
|
-
|
58
|
-
.crm-title {
|
59
|
-
font-weight: 700;
|
60
|
-
line-height: 20px;
|
61
|
-
color: #262626;
|
62
|
-
/* font-size: 16px; */
|
63
|
-
}
|
64
|
-
|
65
|
-
.crm-message-info {
|
66
|
-
color: #619013;
|
67
|
-
font-weight: 500;
|
68
|
-
/* font-size: 12px; */
|
69
|
-
}
|
70
|
-
|
71
|
-
.crm-message-error {
|
72
|
-
color: #E11D48;
|
73
|
-
font-weight: 500;
|
74
|
-
/* font-size: 12px; */
|
1
|
+
* {
|
2
|
+
margin: 0;
|
3
|
+
padding: 0;
|
4
|
+
box-sizing: border-box;
|
5
|
+
}
|
6
|
+
|
7
|
+
:host {
|
8
|
+
--crmfont-sizebodymd: 14px;
|
9
|
+
--crmline-heightbodymd: 20px;
|
10
|
+
--crmletter-spacingtitle-md: 0px
|
11
|
+
}
|
12
|
+
|
13
|
+
.container-message {
|
14
|
+
/* font-size: var(--crmfont-sizebodymd); */
|
15
|
+
font-weight: 400;
|
16
|
+
line-height: var(--crmline-heightbodymd);
|
17
|
+
letter-spacing: var(--crmletter-spacingtitle-md);
|
18
|
+
text-align: left;
|
19
|
+
text-underline-position: from-font;
|
20
|
+
text-decoration-skip-ink: none;
|
21
|
+
}
|
22
|
+
|
23
|
+
.crm-container-form {
|
24
|
+
display: flex;
|
25
|
+
flex-direction: column;
|
26
|
+
justify-content: space-around;
|
27
|
+
height: auto;
|
28
|
+
padding: 20px 24px 20px 24px;
|
29
|
+
border: 1px solid #CCCC;
|
30
|
+
writing-mode: horizontal-tb;
|
31
|
+
gap: 16px;
|
32
|
+
border-top: 1px solid #ccc !important;
|
33
|
+
border-bottom: 1px solid #ccc !important;
|
34
|
+
}
|
35
|
+
|
36
|
+
/* .fbits-responsive-carrinho-desconto {
|
37
|
+
overflow: hidden;
|
38
|
+
border: 1px solid #ccc;
|
39
|
+
border-top: 0;
|
40
|
+
border-bottom: 0;
|
41
|
+
} */
|
42
|
+
|
43
|
+
.crm-phone-form {
|
44
|
+
display: flex;
|
45
|
+
flex-direction: column;
|
46
|
+
height: 100%;
|
47
|
+
/* justify-content: space-around; */
|
48
|
+
gap: 16px;
|
49
|
+
}
|
50
|
+
|
51
|
+
.crm-subtitle {
|
52
|
+
/* font-size: 14px; */
|
53
|
+
font-size: .875rem;
|
54
|
+
line-height: 1.25rem;
|
55
|
+
|
56
|
+
}
|
57
|
+
|
58
|
+
.crm-title {
|
59
|
+
font-weight: 700;
|
60
|
+
line-height: 20px;
|
61
|
+
color: #262626;
|
62
|
+
/* font-size: 16px; */
|
63
|
+
}
|
64
|
+
|
65
|
+
.crm-message-info {
|
66
|
+
color: #619013;
|
67
|
+
font-weight: 500;
|
68
|
+
/* font-size: 12px; */
|
69
|
+
}
|
70
|
+
|
71
|
+
.crm-message-error {
|
72
|
+
color: #E11D48;
|
73
|
+
font-weight: 500;
|
74
|
+
/* font-size: 12px; */
|
75
75
|
}
|