crmbonus-component-wake 1.0.46 → 2.0.47
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/dist/cjs/app-modal.cjs.entry.js +28 -0
- package/dist/cjs/app-modal.cjs.entry.js.map +1 -0
- package/dist/cjs/countdown-timer_4.cjs.entry.js +170 -0
- package/dist/cjs/countdown-timer_4.cjs.entry.js.map +1 -0
- package/dist/cjs/crm-bonus-form.cjs.entry.js +103 -0
- package/dist/cjs/crm-bonus-form.cjs.entry.js.map +1 -0
- package/dist/cjs/crm-bonus-note.cjs.entry.js +1 -1
- package/dist/cjs/crm-bonus.cjs.entry.js +39 -5
- package/dist/cjs/crm-bonus.cjs.entry.js.map +1 -1
- package/dist/cjs/crm-button.cjs.entry.js +24 -0
- package/dist/cjs/crm-button.cjs.entry.js.map +1 -0
- package/dist/cjs/crm-giftback-form.cjs.entry.js +108 -0
- package/dist/cjs/crm-giftback-form.cjs.entry.js.map +1 -0
- package/dist/cjs/crmbonus-component-wake.cjs.js +2 -2
- package/dist/cjs/giftback-finish_4.cjs.entry.js +5 -5
- package/dist/cjs/giftback-finish_4.cjs.entry.js.map +1 -1
- package/dist/cjs/i18n-db722856.js +2208 -0
- package/dist/cjs/i18n-db722856.js.map +1 -0
- package/dist/cjs/{index-52d8a075.js → index-80419303.js} +9 -4
- package/dist/cjs/index-80419303.js.map +1 -0
- package/dist/cjs/{index-861e0cbe.js → index-fdad75ce.js} +4 -1
- package/dist/cjs/index-fdad75ce.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/loading-spinner.cjs.entry.js +2 -2
- package/dist/cjs/pedido-finalizado.cjs.entry.js +2 -2
- package/dist/cjs/phone-cancel-input.cjs.entry.js +25 -0
- package/dist/cjs/phone-cancel-input.cjs.entry.js.map +1 -0
- package/dist/cjs/phone-input-mask.cjs.entry.js +17 -4
- package/dist/cjs/phone-input-mask.cjs.entry.js.map +1 -1
- package/dist/cjs/phone-input.cjs.entry.js +25 -0
- package/dist/cjs/phone-input.cjs.entry.js.map +1 -0
- package/dist/collection/collection-manifest.json +6 -0
- package/dist/collection/components/button/crm-button.css +22 -0
- package/dist/collection/components/button/index.js +59 -0
- package/dist/collection/components/button/index.js.map +1 -1
- package/dist/collection/components/countdown-timer/countdown-timer.js +51 -0
- package/dist/collection/components/countdown-timer/countdown-timer.js.map +1 -0
- package/dist/collection/components/crm-bonus/crm-bonus.css +0 -3
- package/dist/collection/components/crm-bonus/crm-bonus.js +37 -3
- package/dist/collection/components/crm-bonus/crm-bonus.js.map +1 -1
- package/dist/collection/components/crm-bonus-form/crm-bonus-form.js +1 -1
- package/dist/collection/components/crm-bonus-form/subcomponents/giftback-finish/giftback-finish.js +1 -1
- package/dist/collection/components/crm-bonus-form/subcomponents/giftback-pin/giftback-pin.js +1 -1
- package/dist/collection/components/crm-bonus-form/subcomponents/giftback-progress/giftback-progress.css +1 -0
- package/dist/collection/components/crm-bonus-form/subcomponents/giftback-progress/giftback-progress.js +1 -1
- package/dist/collection/components/crm-bonus-form/subcomponents/name-input/name-input.js +1 -1
- package/dist/collection/components/crm-bonus-form/subcomponents/phone/phone.input.js +1 -1
- package/dist/collection/components/crm-bonus-form/subcomponents/phone-cancel/phone.cancel.input.js +1 -1
- package/dist/collection/components/giftback-form/giftback-form.css +47 -0
- package/dist/collection/components/giftback-form/giftback-form.js +182 -0
- package/dist/collection/components/giftback-form/giftback-form.js.map +1 -0
- package/dist/collection/components/giftback-form/subcomponents/giftback-info/giftback-info.css +152 -0
- package/dist/collection/components/giftback-form/subcomponents/giftback-info/giftback-info.js +143 -0
- package/dist/collection/components/giftback-form/subcomponents/giftback-info/giftback-info.js.map +1 -0
- package/dist/collection/components/giftback-form/subcomponents/phone-form/phone-form.js +80 -0
- package/dist/collection/components/giftback-form/subcomponents/phone-form/phone-form.js.map +1 -0
- package/dist/collection/components/giftback-form/subcomponents/pin-form/pin-form.css +87 -0
- package/dist/collection/components/giftback-form/subcomponents/pin-form/pin-form.js +180 -0
- package/dist/collection/components/giftback-form/subcomponents/pin-form/pin-form.js.map +1 -0
- package/dist/collection/components/loading-spinner/loading-spinner.js +1 -1
- package/dist/collection/components/modal/app-modal.js +1 -1
- package/dist/collection/components/pedido/pedido.js +1 -1
- package/dist/collection/components/phone/phone-input-mask.css +18 -39
- package/dist/collection/components/phone/phone-input-mask.js +17 -3
- package/dist/collection/components/phone/phone-input-mask.js.map +1 -1
- package/dist/collection/contants/index.js +1 -0
- package/dist/collection/contants/index.js.map +1 -1
- package/dist/collection/i18n/i18n.js +24 -0
- package/dist/collection/i18n/i18n.js.map +1 -0
- package/dist/components/app-modal.js +39 -1
- package/dist/components/app-modal.js.map +1 -1
- package/dist/components/countdown-timer.d.ts +11 -0
- package/dist/components/countdown-timer.js +8 -0
- package/dist/components/countdown-timer.js.map +1 -0
- package/dist/components/crm-bonus-form.js +158 -1
- package/dist/components/crm-bonus-form.js.map +1 -1
- package/dist/components/crm-bonus-note.js +1 -1
- package/dist/components/crm-bonus.js +56 -33
- package/dist/components/crm-bonus.js.map +1 -1
- package/dist/components/crm-button.d.ts +11 -0
- package/dist/components/crm-button.js +8 -0
- package/dist/components/crm-button.js.map +1 -0
- package/dist/components/crm-giftback-form.d.ts +11 -0
- package/dist/components/crm-giftback-form.js +8 -0
- package/dist/components/crm-giftback-form.js.map +1 -0
- package/dist/components/giftback-finish.js +1 -1
- package/dist/components/giftback-info.d.ts +11 -0
- package/dist/components/giftback-info.js +8 -0
- package/dist/components/giftback-info.js.map +1 -0
- package/dist/components/giftback-pin.js +1 -1
- package/dist/components/giftback-progress.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/loading-spinner.js +1 -1
- package/dist/components/name-input.js +1 -1
- package/dist/components/{p-0e99f907.js → p-0c1aa75b.js} +4 -4
- package/dist/components/{p-0e99f907.js.map → p-0c1aa75b.js.map} +1 -1
- package/dist/components/p-1539def7.js +44 -0
- package/dist/components/p-1539def7.js.map +1 -0
- package/dist/components/{p-faf7103e.js → p-2f266d73.js} +6 -2
- package/dist/components/p-2f266d73.js.map +1 -0
- package/dist/components/p-39d680b6.js +49 -0
- package/dist/components/p-39d680b6.js.map +1 -0
- package/dist/components/p-7e8a1832.js +76 -0
- package/dist/components/p-7e8a1832.js.map +1 -0
- package/dist/components/p-9a435c31.js +79 -0
- package/dist/components/p-9a435c31.js.map +1 -0
- package/dist/components/p-a7e91243.js +2206 -0
- package/dist/components/p-a7e91243.js.map +1 -0
- package/dist/components/p-b1841bad.js +62 -0
- package/dist/components/p-b1841bad.js.map +1 -0
- package/dist/components/p-bc925ed6.js +112 -0
- package/dist/components/p-bc925ed6.js.map +1 -0
- package/dist/components/{p-ddc0ac71.js → p-bf93729e.js} +3 -3
- package/dist/components/{p-ddc0ac71.js.map → p-bf93729e.js.map} +1 -1
- package/dist/{esm/index-ea02697e.js → components/p-dddd9ee6.js} +3 -2
- package/dist/components/p-dddd9ee6.js.map +1 -0
- package/dist/components/{p-19b83423.js → p-e443d670.js} +4 -4
- package/dist/components/{p-19b83423.js.map → p-e443d670.js.map} +1 -1
- package/dist/components/{p-e2727638.js → p-f2ab4eea.js} +4 -4
- package/dist/components/p-f2ab4eea.js.map +1 -0
- package/dist/components/{p-530006e6.js → p-f5fcff75.js} +3 -3
- package/dist/components/{p-530006e6.js.map → p-f5fcff75.js.map} +1 -1
- package/dist/components/p-f8b4698f.js +174 -0
- package/dist/components/p-f8b4698f.js.map +1 -0
- package/dist/components/pedido-finalizado.js +2 -2
- package/dist/components/phone-cancel-input.js +48 -1
- package/dist/components/phone-cancel-input.js.map +1 -1
- package/dist/components/phone-form.d.ts +11 -0
- package/dist/components/phone-form.js +8 -0
- package/dist/components/phone-form.js.map +1 -0
- package/dist/components/phone-input-mask.js +1 -1
- package/dist/components/phone-input.js +48 -1
- package/dist/components/phone-input.js.map +1 -1
- package/dist/components/pin-form.d.ts +11 -0
- package/dist/components/pin-form.js +8 -0
- package/dist/components/pin-form.js.map +1 -0
- package/dist/crmbonus-component-wake/crmbonus-component-wake.css +1 -0
- 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-2636f2f0.entry.js → p-574108d2.entry.js} +2 -2
- package/dist/crmbonus-component-wake/p-574108d2.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/p-5ede3b10.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-5ede3b10.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/p-61462d71.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-61462d71.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/p-63d2a359.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-63d2a359.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/p-6e6bf96e.js +3 -0
- package/dist/crmbonus-component-wake/p-6e6bf96e.js.map +1 -0
- package/dist/crmbonus-component-wake/p-7aff6c4e.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-7aff6c4e.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/p-83182e85.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-83182e85.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/p-8b9a1aec.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-8b9a1aec.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/p-a7e91243.js +2 -0
- package/dist/crmbonus-component-wake/p-a7e91243.js.map +1 -0
- package/dist/crmbonus-component-wake/p-adb37e26.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-adb37e26.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/p-be553772.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-be553772.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/{p-a01c57ab.entry.js → p-cdd018cc.entry.js} +2 -2
- package/dist/crmbonus-component-wake/{p-001e3e2b.entry.js → p-d6af7631.entry.js} +2 -2
- package/dist/crmbonus-component-wake/{p-9b967605.js → p-dddd9ee6.js} +2 -2
- package/dist/crmbonus-component-wake/p-dddd9ee6.js.map +1 -0
- package/dist/crmbonus-component-wake/{p-5febaa3c.entry.js → p-e23e8d6d.entry.js} +2 -2
- package/dist/crmbonus-component-wake/p-e3b52362.entry.js +2 -0
- package/dist/crmbonus-component-wake/p-e3b52362.entry.js.map +1 -0
- package/dist/esm/app-modal.entry.js +24 -0
- package/dist/esm/app-modal.entry.js.map +1 -0
- package/dist/esm/countdown-timer_4.entry.js +163 -0
- package/dist/esm/countdown-timer_4.entry.js.map +1 -0
- package/dist/esm/crm-bonus-form.entry.js +99 -0
- package/dist/esm/crm-bonus-form.entry.js.map +1 -0
- package/dist/esm/crm-bonus-note.entry.js +1 -1
- package/dist/esm/crm-bonus.entry.js +39 -5
- package/dist/esm/crm-bonus.entry.js.map +1 -1
- package/dist/esm/crm-button.entry.js +20 -0
- package/dist/esm/crm-button.entry.js.map +1 -0
- package/dist/esm/crm-giftback-form.entry.js +104 -0
- package/dist/esm/crm-giftback-form.entry.js.map +1 -0
- package/dist/esm/crmbonus-component-wake.js +3 -3
- package/dist/esm/giftback-finish_4.entry.js +5 -5
- package/dist/esm/giftback-finish_4.entry.js.map +1 -1
- package/dist/esm/i18n-d8b777a9.js +2206 -0
- package/dist/esm/i18n-d8b777a9.js.map +1 -0
- package/dist/esm/index-7101ea0c.js +13 -0
- package/dist/esm/index-7101ea0c.js.map +1 -0
- package/dist/esm/{index-9f7bde48.js → index-a4c14fca.js} +9 -4
- package/dist/esm/index-a4c14fca.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/loading-spinner.entry.js +2 -2
- package/dist/esm/pedido-finalizado.entry.js +2 -2
- package/dist/esm/phone-cancel-input.entry.js +21 -0
- package/dist/esm/phone-cancel-input.entry.js.map +1 -0
- package/dist/esm/phone-input-mask.entry.js +17 -4
- package/dist/esm/phone-input-mask.entry.js.map +1 -1
- package/dist/esm/phone-input.entry.js +21 -0
- package/dist/esm/phone-input.entry.js.map +1 -0
- package/dist/types/components/button/index.d.ts +5 -0
- package/dist/types/components/countdown-timer/countdown-timer.d.ts +8 -0
- package/dist/types/components/giftback-form/giftback-form.d.ts +24 -0
- package/dist/types/components/giftback-form/subcomponents/giftback-info/giftback-info.d.ts +15 -0
- package/dist/types/components/giftback-form/subcomponents/phone-form/phone-form.d.ts +8 -0
- package/dist/types/components/giftback-form/subcomponents/pin-form/pin-form.d.ts +20 -0
- package/dist/types/components/phone/phone-input-mask.d.ts +2 -0
- package/dist/types/components.d.ts +116 -0
- package/dist/types/contants/index.d.ts +1 -0
- package/dist/types/i18n/i18n.d.ts +2 -0
- package/package.json +3 -2
- package/dist/cjs/app-modal_4.cjs.entry.js +0 -157
- package/dist/cjs/app-modal_4.cjs.entry.js.map +0 -1
- package/dist/cjs/index-52d8a075.js.map +0 -1
- package/dist/cjs/index-861e0cbe.js.map +0 -1
- package/dist/components/p-03c2447c.js +0 -170
- package/dist/components/p-03c2447c.js.map +0 -1
- package/dist/components/p-1dbb0f43.js +0 -43
- package/dist/components/p-1dbb0f43.js.map +0 -1
- package/dist/components/p-3c29c6ad.js +0 -62
- package/dist/components/p-3c29c6ad.js.map +0 -1
- package/dist/components/p-41d42a66.js +0 -52
- package/dist/components/p-41d42a66.js.map +0 -1
- package/dist/components/p-6c553ee7.js +0 -52
- package/dist/components/p-6c553ee7.js.map +0 -1
- package/dist/components/p-e2727638.js.map +0 -1
- package/dist/components/p-faf7103e.js.map +0 -1
- package/dist/crmbonus-component-wake/p-2636f2f0.entry.js.map +0 -1
- package/dist/crmbonus-component-wake/p-3582baf8.entry.js +0 -2
- package/dist/crmbonus-component-wake/p-3582baf8.entry.js.map +0 -1
- package/dist/crmbonus-component-wake/p-61df4eb6.entry.js +0 -2
- package/dist/crmbonus-component-wake/p-61df4eb6.entry.js.map +0 -1
- package/dist/crmbonus-component-wake/p-72510682.js +0 -3
- package/dist/crmbonus-component-wake/p-72510682.js.map +0 -1
- package/dist/crmbonus-component-wake/p-9b967605.js.map +0 -1
- package/dist/crmbonus-component-wake/p-dbb64825.entry.js +0 -2
- package/dist/crmbonus-component-wake/p-dbb64825.entry.js.map +0 -1
- package/dist/esm/app-modal_4.entry.js +0 -150
- package/dist/esm/app-modal_4.entry.js.map +0 -1
- package/dist/esm/index-9f7bde48.js.map +0 -1
- package/dist/esm/index-ea02697e.js.map +0 -1
- /package/dist/crmbonus-component-wake/{p-a01c57ab.entry.js.map → p-cdd018cc.entry.js.map} +0 -0
- /package/dist/crmbonus-component-wake/{p-001e3e2b.entry.js.map → p-d6af7631.entry.js.map} +0 -0
- /package/dist/crmbonus-component-wake/{p-5febaa3c.entry.js.map → p-e23e8d6d.entry.js.map} +0 -0
@@ -1 +1 @@
|
|
1
|
-
{"file":"phone-input-mask.entry.cjs.js","mappings":"
|
1
|
+
{"file":"phone-input-mask.entry.cjs.js","mappings":";;;;;;;AAAA,MAAM,iBAAiB,GAAG,ouBAAouB,CAAC;AAC/vB,6BAAe,iBAAiB;;MCOnB,cAAc;;;qBACE,EAAE;uBACA,EAAE;;;;IAK7B,iBAAiB;QACb,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC;KAClC;IAEO,WAAW,CAAC,KAAa;QAE7B,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACzC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;QAE7D,IAAI,CAAC,KAAK;YAAE,OAAO,KAAK,CAAC;QAEzB,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC;QAC7C,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC;QAC9C,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC;QAE7C,OAAO,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,EAAE,CAAC;KACrC;IAEO,WAAW,CAAC,KAAY;QAC5B,MAAM,KAAK,GAAG,KAAK,CAAC,MAA0B,CAAC;QAC/C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAE3C,IAAG,CAAC,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YACvC,IAAI,CAAC,OAAO,GAAGA,oCAA4B,CAAA;SAC9C;aAAM;YACH,IAAI,CAAC,OAAO,GAAG,EAAE,CAAA;SACpB;KACJ;IAED,mBAAmB,CAAC,KAAa;QAC7B,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;QAC3B,MAAM,UAAU,GAAG,yBAAyB,CAAC;QAC7C,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KACjC;IAGM,MAAM,QAAQ;QACjB,OAAO,IAAI,CAAC,KAAK,CAAC;KACrB;IAED,MAAM;QACF,QACIC,oEACIA,oEACI,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,EAAE,EAAC,OAAO,EACV,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,kBAAkB,EACxB,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,OAAO,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,EAC3C,WAAW,EAAC,iBAAiB,GAC/B,EACFA,gEAAG,KAAK,EAAC,cAAc,IAAE,IAAI,CAAC,OAAO,CAAK,CACxC,EAER;KACL;;;;;;","names":["MESSAGE_ERROR_INVALID_NUMBER","h"],"sources":["src/components/phone/phone-input-mask.css?tag=phone-input-mask&encapsulation=shadow","src/components/phone/phone-input-mask.tsx"],"sourcesContent":["* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\n.phone {\n display: block;\n width: 100%;\n height: 24px;\n padding: 6px 12px;\n font-size: 14px;\n line-height: 1.42857143;\n color: #555;\n background-color: #fff;\n background-image: none;\n border: 1px solid #ccc;\n border-radius: 0px;\n -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);\n box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);\n -webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;\n -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;\n transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;\n}\n\n\n.phone-input-form {\n width: 246px;\n height: 48px;\n padding: 13px 16px 13px 16px;\n border: 1px solid #CCCCCC;\n}\n\n.crm-erro-msg {\n color: #E11D48;\n font-size: 12px;\n font-weight: 500;\n margin-top: 11px;\n}\n","import { Component, h, Method, Prop, State } from '@stencil/core';\nimport { MESSAGE_ERROR_INVALID_NUMBER } from '../../contants';\n\n@Component({\n tag: 'phone-input-mask',\n styleUrl: 'phone-input-mask.css',\n shadow: true,\n})\nexport class PhoneInputMask {\n @State() phone: string = '';\n @State() message: string = \"\";\n\n @Prop() initialValue: string;\n @Prop() disabled: boolean;\n\n componentWillLoad() {\n this.phone = this.initialValue;\n }\n\n private formatPhone(value: string): string {\n\n const cleaned = value.replace(/\\D/g, ''); // Remove tudo que não for número\n const match = cleaned.match(/^(\\d{0,2})(\\d{0,5})(\\d{0,4})$/);\n\n if (!match) return value;\n\n const part1 = match[1] ? `(${match[1]}` : '';\n const part2 = match[2] ? `) ${match[2]}` : '';\n const part3 = match[3] ? ` ${match[3]}` : '';\n\n return `${part1}${part2}${part3}`;\n }\n\n private handleInput(event: Event): void {\n const input = event.target as HTMLInputElement;\n this.phone = this.formatPhone(input.value);\n\n if(!this.validatePhoneNumber(input.value)) {\n this.message = MESSAGE_ERROR_INVALID_NUMBER\n } else {\n this.message = \"\"\n }\n }\n\n validatePhoneNumber(phone: string): boolean {\n console.log('phone', phone)\n const phoneRegex = /^\\(\\d{2}\\) \\d{5} \\d{4}$/; // Valida formato (99) 99999-9999\n return phoneRegex.test(phone);\n }\n\n @Method()\n public async getPhone() {\n return this.phone;\n }\n\n render() {\n return (\n <div>\n <input\n disabled={this.disabled}\n id=\"phone\"\n type=\"text\"\n class=\"phone-input-form\"\n value={this.phone}\n onInput={(event) => this.handleInput(event)}\n placeholder=\"(12) 94567-8910\"\n />\n <p class=\"crm-erro-msg\">{this.message}</p>\n </div>\n\n );\n }\n}\n"],"version":3}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
+
|
5
|
+
const index = require('./index-80419303.js');
|
6
|
+
|
7
|
+
const PhoneInput = class {
|
8
|
+
constructor(hostRef) {
|
9
|
+
index.registerInstance(this, hostRef);
|
10
|
+
this.sendPin = undefined;
|
11
|
+
this.loading = undefined;
|
12
|
+
this.value = undefined;
|
13
|
+
}
|
14
|
+
async validatePhone() {
|
15
|
+
const phone = await this.phoneInputMask.getPhone();
|
16
|
+
await this.sendPin(phone);
|
17
|
+
}
|
18
|
+
render() {
|
19
|
+
return (index.h("div", { key: '7388feb890331d696bf51ddc5690707673e06546', class: "form-container" }, index.h("phone-input-mask", { key: 'a3241090e731daa0b558503a9347de7a15f0025e', initialValue: this.value, ref: ref => this.phoneInputMask = ref }), index.h("button", { key: 'd36c5fd1b8cf7dfb0d3100450215c426855e82a6', class: `btn btn-success btnCrm ${this.loading ? 'disabled' : ''} `, disabled: this.loading, onClick: () => this.validatePhone() }, !this.loading ? "validar" : index.h("loading-spinner", { size: "11px", color: "#fff" }))));
|
20
|
+
}
|
21
|
+
};
|
22
|
+
|
23
|
+
exports.phone_input = PhoneInput;
|
24
|
+
|
25
|
+
//# sourceMappingURL=phone-input.cjs.entry.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"file":"phone-input.entry.cjs.js","mappings":";;;;;;MAKa,UAAU;;;;;;;IAQnB,MAAM,aAAa;QACf,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;QACnD,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;KAC7B;IAED,MAAM;QACF,QACIA,kEAAK,KAAK,EAAC,gBAAgB,IACvBA,+EAAkB,YAAY,EAAE,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,IAAI,IAAI,CAAC,cAAc,GAAG,GAAG,GAAI,EACrFA,qEAAQ,KAAK,EAAE,0BAA0B,IAAI,CAAC,OAAO,GAAG,UAAU,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC,aAAa,EAAE,IAE/H,CAAC,IAAI,CAAC,OAAO,GAAG,SAAS,GAAGA,6BAAiB,IAAI,EAAC,MAAM,EAAC,KAAK,EAAC,MAAM,GAAG,CAEvE,CACP,EACT;KACJ;;;;;","names":["h"],"sources":["src/components/crm-bonus-form/subcomponents/phone/phone.input.tsx"],"sourcesContent":["import { Component, Prop, h } from \"@stencil/core\";\n\n@Component({\n tag: 'phone-input'\n})\nexport class PhoneInput {\n\n private phoneInputMask: HTMLPhoneInputMaskElement;\n\n @Prop() sendPin: Function;\n @Prop() loading: boolean;\n @Prop() value: string;\n\n async validatePhone() {\n const phone = await this.phoneInputMask.getPhone();\n await this.sendPin(phone);\n }\n\n render() {\n return (\n <div class=\"form-container\">\n <phone-input-mask initialValue={this.value} ref={ref => this.phoneInputMask = ref} />\n <button class={`btn btn-success btnCrm ${this.loading ? 'disabled' : ''} `} disabled={this.loading} onClick={() => this.validatePhone()}>\n {\n !this.loading ? \"validar\" : <loading-spinner size=\"11px\" color=\"#fff\" />\n }\n </button>\n </div>\n )\n }\n}"],"version":3}
|
@@ -1,5 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"entries": [
|
3
|
+
"components/button/index.js",
|
4
|
+
"components/countdown-timer/countdown-timer.js",
|
3
5
|
"components/crm-bonus/crm-bonus.js",
|
4
6
|
"components/crm-bonus-form/crm-bonus-form.js",
|
5
7
|
"components/crm-bonus-form/subcomponents/giftback-finish/giftback-finish.js",
|
@@ -8,6 +10,10 @@
|
|
8
10
|
"components/crm-bonus-form/subcomponents/name-input/name-input.js",
|
9
11
|
"components/crm-bonus-form/subcomponents/phone/phone.input.js",
|
10
12
|
"components/crm-bonus-form/subcomponents/phone-cancel/phone.cancel.input.js",
|
13
|
+
"components/giftback-form/giftback-form.js",
|
14
|
+
"components/giftback-form/subcomponents/giftback-info/giftback-info.js",
|
15
|
+
"components/giftback-form/subcomponents/phone-form/phone-form.js",
|
16
|
+
"components/giftback-form/subcomponents/pin-form/pin-form.js",
|
11
17
|
"components/loading-spinner/loading-spinner.js",
|
12
18
|
"components/modal/app-modal.js",
|
13
19
|
"components/note/crm-bonus-note.js",
|
@@ -0,0 +1,22 @@
|
|
1
|
+
input, button {
|
2
|
+
margin: 0;
|
3
|
+
padding: 10px; /* Ajuste o valor conforme necessário */
|
4
|
+
}
|
5
|
+
|
6
|
+
.crm-contaner-button {
|
7
|
+
height: auto;
|
8
|
+
width: auto;
|
9
|
+
}
|
10
|
+
|
11
|
+
.crm-button {
|
12
|
+
height: 48px;
|
13
|
+
width: 246px;
|
14
|
+
border: 1px solid #000;
|
15
|
+
padding: 14px 20px;
|
16
|
+
background-color: #000;
|
17
|
+
color: #fff;
|
18
|
+
font-size: 14px;
|
19
|
+
line-height: 20px;
|
20
|
+
font-weight: 500;
|
21
|
+
cursor: pointer;
|
22
|
+
}
|
@@ -1 +1,60 @@
|
|
1
|
+
import { h } from "@stencil/core";
|
2
|
+
export class Button {
|
3
|
+
constructor() {
|
4
|
+
this.txtBtn = undefined;
|
5
|
+
this.loading = undefined;
|
6
|
+
}
|
7
|
+
render() {
|
8
|
+
return (h("div", { key: 'f0ade275b346c654d0ebf889dcfdae42135a4a52', class: "crm-contaner-button" }, h("button", { key: 'ec8c7931debeb592db9107ca7f6cb4972062b2cc', class: "crm-button" }, !this.loading ? this.txtBtn : h("loading-spinner", { size: "15px", color: "#fff" }))));
|
9
|
+
}
|
10
|
+
static get is() { return "crm-button"; }
|
11
|
+
static get originalStyleUrls() {
|
12
|
+
return {
|
13
|
+
"$": ["crm-button.css"]
|
14
|
+
};
|
15
|
+
}
|
16
|
+
static get styleUrls() {
|
17
|
+
return {
|
18
|
+
"$": ["crm-button.css"]
|
19
|
+
};
|
20
|
+
}
|
21
|
+
static get properties() {
|
22
|
+
return {
|
23
|
+
"txtBtn": {
|
24
|
+
"type": "string",
|
25
|
+
"mutable": false,
|
26
|
+
"complexType": {
|
27
|
+
"original": "string",
|
28
|
+
"resolved": "string",
|
29
|
+
"references": {}
|
30
|
+
},
|
31
|
+
"required": false,
|
32
|
+
"optional": false,
|
33
|
+
"docs": {
|
34
|
+
"tags": [],
|
35
|
+
"text": ""
|
36
|
+
},
|
37
|
+
"attribute": "txt-btn",
|
38
|
+
"reflect": false
|
39
|
+
},
|
40
|
+
"loading": {
|
41
|
+
"type": "boolean",
|
42
|
+
"mutable": false,
|
43
|
+
"complexType": {
|
44
|
+
"original": "boolean",
|
45
|
+
"resolved": "boolean",
|
46
|
+
"references": {}
|
47
|
+
},
|
48
|
+
"required": false,
|
49
|
+
"optional": false,
|
50
|
+
"docs": {
|
51
|
+
"tags": [],
|
52
|
+
"text": ""
|
53
|
+
},
|
54
|
+
"attribute": "loading",
|
55
|
+
"reflect": false
|
56
|
+
}
|
57
|
+
};
|
58
|
+
}
|
59
|
+
}
|
1
60
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/button/index.tsx"],"names":[],"mappings":"","sourcesContent":[""]}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/button/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAMnD,MAAM,OAAO,MAAM;;;;;IAKf,MAAM;QACF,OAAO,CACH,4DAAK,KAAK,EAAC,qBAAqB;YAC5B,+DAAQ,KAAK,EAAC,YAAY,IAElB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,uBAAiB,IAAI,EAAC,MAAM,EAAC,KAAK,EAAC,MAAM,GAAG,CAEzE,CACP,CACT,CAAA;IACL,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["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 render() {\n return (\n <div class=\"crm-contaner-button\">\n <button class=\"crm-button\">\n {\n !this.loading ? this.txtBtn : <loading-spinner size=\"15px\" color=\"#fff\" />\n }\n </button>\n </div>\n )\n }\n}"]}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
import { h } from "@stencil/core";
|
2
|
+
export class CountdownTimer {
|
3
|
+
constructor() {
|
4
|
+
this.downtime = undefined;
|
5
|
+
this.counter = 30;
|
6
|
+
}
|
7
|
+
componentWillLoad() {
|
8
|
+
this.intervalId = setInterval(() => {
|
9
|
+
if (this.counter > 0) {
|
10
|
+
this.counter--;
|
11
|
+
}
|
12
|
+
else {
|
13
|
+
clearInterval(this.intervalId);
|
14
|
+
this.downtime();
|
15
|
+
}
|
16
|
+
}, 1000); // Intervalo de 1 segundo
|
17
|
+
}
|
18
|
+
disconnectedCallback() {
|
19
|
+
clearInterval(this.intervalId);
|
20
|
+
}
|
21
|
+
render() {
|
22
|
+
return (h("label", { key: '6313656b73bec34e3e4e5099c2bd7633e025588e' }, this.counter, "s"));
|
23
|
+
}
|
24
|
+
static get is() { return "countdown-timer"; }
|
25
|
+
static get encapsulation() { return "shadow"; }
|
26
|
+
static get properties() {
|
27
|
+
return {
|
28
|
+
"downtime": {
|
29
|
+
"type": "unknown",
|
30
|
+
"mutable": false,
|
31
|
+
"complexType": {
|
32
|
+
"original": "() => void",
|
33
|
+
"resolved": "() => void",
|
34
|
+
"references": {}
|
35
|
+
},
|
36
|
+
"required": false,
|
37
|
+
"optional": false,
|
38
|
+
"docs": {
|
39
|
+
"tags": [],
|
40
|
+
"text": ""
|
41
|
+
}
|
42
|
+
}
|
43
|
+
};
|
44
|
+
}
|
45
|
+
static get states() {
|
46
|
+
return {
|
47
|
+
"counter": {}
|
48
|
+
};
|
49
|
+
}
|
50
|
+
}
|
51
|
+
//# sourceMappingURL=countdown-timer.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"countdown-timer.js","sourceRoot":"","sources":["../../../../src/components/countdown-timer/countdown-timer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAM1D,MAAM,OAAO,cAAc;;;uBAII,EAAE;;IAG7B,iBAAiB;QACb,IAAI,CAAC,UAAU,GAAG,WAAW,CAAC,GAAG,EAAE;YAC/B,IAAI,IAAI,CAAC,OAAO,GAAG,CAAC,EAAE,CAAC;gBACnB,IAAI,CAAC,OAAO,EAAE,CAAC;YACnB,CAAC;iBAAM,CAAC;gBACJ,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;gBAE/B,IAAI,CAAC,QAAQ,EAAE,CAAA;YACnB,CAAC;QACL,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,yBAAyB;IACvC,CAAC;IAED,oBAAoB;QAChB,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACnC,CAAC;IAED,MAAM;QACF,OAAO,CACH;YAAQ,IAAI,CAAC,OAAO;gBAAU,CACjC,CAAC;IACN,CAAC;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import { Component, h, Prop, State } from '@stencil/core';\n\n@Component({\n tag: 'countdown-timer',\n shadow: true,\n})\nexport class CountdownTimer {\n\n @Prop() downtime: () => void;\n\n @State() counter: number = 30;\n private intervalId: NodeJS.Timer;\n\n componentWillLoad() {\n this.intervalId = setInterval(() => {\n if (this.counter > 0) {\n this.counter--;\n } else {\n clearInterval(this.intervalId);\n\n this.downtime()\n }\n }, 1000); // Intervalo de 1 segundo\n }\n\n disconnectedCallback() {\n clearInterval(this.intervalId);\n }\n\n render() {\n return (\n <label>{this.counter}s</label>\n );\n }\n}\n"]}
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import { h } from "@stencil/core";
|
2
2
|
import { CrmBonusService } from "../../services/crmbonus.service";
|
3
3
|
import { StepFormEnum } from "../../contants";
|
4
|
+
import i18next from "../../i18n/i18n";
|
5
|
+
console.log('i18next', i18next.language);
|
4
6
|
export class CrmBonus {
|
5
7
|
constructor() {
|
6
8
|
this.crmBonusService = CrmBonusService.getInstance();
|
@@ -25,6 +27,7 @@ export class CrmBonus {
|
|
25
27
|
this.session = undefined;
|
26
28
|
}
|
27
29
|
async componentWillLoad() {
|
30
|
+
i18next.changeLanguage(i18next.language);
|
28
31
|
await this.loadSession();
|
29
32
|
await this.handleLoad();
|
30
33
|
}
|
@@ -32,7 +35,6 @@ export class CrmBonus {
|
|
32
35
|
try {
|
33
36
|
if (this.userId) {
|
34
37
|
this.customer = await this.crmBonusService.getCustomer(this.userId, this.storeName);
|
35
|
-
console.log('user', this.customer);
|
36
38
|
}
|
37
39
|
const amount = localStorage.getItem(this.cartId);
|
38
40
|
if (amount) {
|
@@ -47,6 +49,9 @@ export class CrmBonus {
|
|
47
49
|
}
|
48
50
|
async loadSession() {
|
49
51
|
this.session = await this.crmBonusService.getToken(this.storeName);
|
52
|
+
setTimeout(() => {
|
53
|
+
this.loadSession();
|
54
|
+
}, 1500000);
|
50
55
|
}
|
51
56
|
async buildAndGetProducts() {
|
52
57
|
const key = `bc-products:${this.cartId}`;
|
@@ -147,8 +152,37 @@ export class CrmBonus {
|
|
147
152
|
this.showModal = true;
|
148
153
|
}
|
149
154
|
render() {
|
150
|
-
return (h("
|
151
|
-
|
155
|
+
return (h("crm-giftback-form", { key: 'b4d6ec601d70a7b3f8c12a14a35ea5b0221b0834', storeName: this.storeName, products: this.buildProducts(), cartId: this.cartId })
|
156
|
+
// <div class="section-cart-crm">
|
157
|
+
// <p class="text-left fbits-responsive-carrinho-desconto-texto">Giftback</p>
|
158
|
+
// <div class="container-button">
|
159
|
+
// {/* <img src={logo} onClick={() => (this.showModal = true)} /> */}
|
160
|
+
// {
|
161
|
+
// this.canCancel ? <phone-cancel-input value={this.amountCancel} sendPin={() => { this.cancel() }} loading={this.loading} />
|
162
|
+
// : <phone-input value={this.customer.phone} sendPin={(phone) => { this.handleSendPin(phone) }} loading={this.loading} />
|
163
|
+
// }
|
164
|
+
// </div>
|
165
|
+
// <p class="message-alert" >{this.message}</p>
|
166
|
+
// <app-modal
|
167
|
+
// isOpen={this.showModal}
|
168
|
+
// modalTitle={`Giftback`}
|
169
|
+
// onModalClosed={() => (this.showModal = false)}
|
170
|
+
// >
|
171
|
+
// <crm-bonus-form
|
172
|
+
// loadingModal={this.loading}
|
173
|
+
// saveStore={(amount: number) => this.save(amount)}
|
174
|
+
// ref={ref => this.crmBonusRef = ref}
|
175
|
+
// sent={this.sent}
|
176
|
+
// phone={this.phone}
|
177
|
+
// cancel={() => this.handleCloseModal()}
|
178
|
+
// storeName={this.storeName}
|
179
|
+
// products={this.buildProducts()}
|
180
|
+
// cartId={this.cartId} customer={this.customer}
|
181
|
+
// handleCustomerName={(name: string) => this.sendPinName(name)}
|
182
|
+
// />
|
183
|
+
// </app-modal>
|
184
|
+
// </div>
|
185
|
+
);
|
152
186
|
}
|
153
187
|
static get is() { return "crm-bonus"; }
|
154
188
|
static get encapsulation() { return "shadow"; }
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"crm-bonus.js","sourceRoot":"","sources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C,KAAK,CAAC,CAAA,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,GAAI,CAEvH;YACN,0DAAG,KAAK,EAAC,eAAe,IAAG,IAAI,CAAC,OAAO,CAAK;YAC5C,kEACE,MAAM,EAAE,IAAI,CAAC,SAAS,EACtB,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;gBAE7C,uEACE,YAAY,EAAE,IAAI,CAAC,OAAO,EAC1B,SAAS,EAAE,CAAC,MAAc,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAChD,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,GAAG,GAAG,EAClC,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,gBAAgB,EAAE,EACrC,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,QAAQ,EAAE,IAAI,CAAC,aAAa,EAAE,EAC9B,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAC5C,kBAAkB,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAC5D,CACQ,CACR,CACP,CAAA;IACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, 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 { StepFormEnum } from '../../contants';\n\n@Component({\n tag: 'crm-bonus',\n styleUrl: 'crm-bonus.css',\n shadow: true,\n assetsDirs: ['assets']\n})\nexport class CrmBonus {\n\n private crmBonusService: CrmBonusService = CrmBonusService.getInstance();\n\n private crmBonusRef: HTMLCrmBonusFormElement;\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\n async componentWillLoad() {\n await this.loadSession()\n await this.handleLoad();\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('user', 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 this.buildAndGetProducts();\n }\n\n\n async loadSession() {\n this.session = await this.crmBonusService.getToken(this.storeName);\n\n }\n\n async buildAndGetProducts() {\n const key = `bc-products:${this.cartId}`;\n const cache_products = localStorage.getItem(key)\n\n if (!cache_products) {\n localStorage.setItem(key, this.productsInString);\n }\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 })\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 this.products.map(product => ({ sku: product.SKU, value: (product.PrecoPor * product.Quantidade), productVariantId: product.ProdutoVarianteId.toString(), quantity: product.Quantidade }))\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 return (\n <div class=\"section-cart-crm\">\n <p class=\"text-left fbits-responsive-carrinho-desconto-texto\">Giftback</p>\n <div class=\"container-button\">\n {/* <img src={logo} onClick={() => (this.showModal = true)} /> */}\n {\n this.canCancel ? <phone-cancel-input value={this.amountCancel} sendPin={() => { this.cancel() }} loading={this.loading} />\n : <phone-input value={this.customer.phone} sendPin={(phone) => { this.handleSendPin(phone) }} loading={this.loading} />\n }\n </div>\n <p class=\"message-alert\" >{this.message}</p>\n <app-modal\n isOpen={this.showModal}\n modalTitle={`Giftback`}\n onModalClosed={() => (this.showModal = false)}\n >\n <crm-bonus-form\n loadingModal={this.loading}\n saveStore={(amount: number) => this.save(amount)}\n ref={ref => this.crmBonusRef = ref}\n sent={this.sent}\n phone={this.phone}\n cancel={() => this.handleCloseModal()}\n storeName={this.storeName}\n products={this.buildProducts()}\n cartId={this.cartId} customer={this.customer}\n handleCustomerName={(name: string) => this.sendPinName(name)}\n />\n </app-modal>\n </div>\n )\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"crm-bonus.js","sourceRoot":"","sources":["../../../../src/components/crm-bonus/crm-bonus.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAElE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,OAAO,MAAM,iBAAiB,CAAA;AAGrC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAA;AAQxC,MAAM,OAAO,QAAQ;;QAEX,oBAAe,GAAoB,eAAe,CAAC,WAAW,EAAE,CAAC;yBAI3C,KAAK;;;;;;wBAOJ;YAC7B,SAAS,EAAE,EAAE;YACb,QAAQ,EAAE,EAAE;YACZ,IAAI,EAAE,EAAE;YACR,KAAK,EAAE,EAAE;SACV;uBAE2B,KAAK;;;yBAGH,KAAK;;;;;IAMnC,KAAK,CAAC,iBAAiB;QACrB,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAEzC,MAAM,IAAI,CAAC,WAAW,EAAE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I,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;YACvB,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QAC5B,CAAC;QAED,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;QACvD,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACxB,CAAC;IAED,MAAM;QACJ,OAAO,CACL,0EACE,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,QAAQ,EAAE,IAAI,CAAC,aAAa,EAAE,EAC9B,MAAM,EAAE,IAAI,CAAC,MAAM,GACnB;QACF,iCAAiC;QACjC,+EAA+E;QAC/E,mCAAmC;QACnC,yEAAyE;QACzE,QAAQ;QACR,mIAAmI;QACnI,kIAAkI;QAClI,QAAQ;QACR,WAAW;QACX,iDAAiD;QACjD,eAAe;QACf,8BAA8B;QAC9B,8BAA8B;QAC9B,qDAAqD;QACrD,MAAM;QACN,sBAAsB;QACtB,oCAAoC;QACpC,0DAA0D;QAC1D,4CAA4C;QAC5C,yBAAyB;QACzB,2BAA2B;QAC3B,+CAA+C;QAC/C,mCAAmC;QACnC,wCAAwC;QACxC,sDAAsD;QACtD,sEAAsE;QACtE,SAAS;QACT,iBAAiB;QACjB,SAAS;SACV,CAAA;IACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, 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 { StepFormEnum } from '../../contants';\n\nimport i18next from '../../i18n/i18n'\n\n\nconsole.log('i18next', i18next.language)\n\n@Component({\n tag: 'crm-bonus',\n styleUrl: 'crm-bonus.css',\n shadow: true,\n assetsDirs: ['assets']\n})\nexport class CrmBonus {\n\n private crmBonusService: CrmBonusService = CrmBonusService.getInstance();\n\n private crmBonusRef: HTMLCrmBonusFormElement;\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\n async componentWillLoad() {\n i18next.changeLanguage(i18next.language);\n\n await this.loadSession()\n await this.handleLoad();\n }\n\n async handleLoad() {\n try {\n if (this.userId) {\n this.customer = await this.crmBonusService.getCustomer(this.userId, this.storeName);\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 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 const cache_products = localStorage.getItem(key)\n\n if (!cache_products) {\n localStorage.setItem(key, this.productsInString);\n }\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 })\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 this.products.map(product => ({ sku: product.SKU, value: (product.PrecoPor * product.Quantidade), productVariantId: product.ProdutoVarianteId.toString(), quantity: product.Quantidade }))\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 return (\n <crm-giftback-form \n storeName={this.storeName}\n products={this.buildProducts()}\n cartId={this.cartId}\n />\n // <div class=\"section-cart-crm\">\n // <p class=\"text-left fbits-responsive-carrinho-desconto-texto\">Giftback</p>\n // <div class=\"container-button\">\n // {/* <img src={logo} onClick={() => (this.showModal = true)} /> */}\n // {\n // this.canCancel ? <phone-cancel-input value={this.amountCancel} sendPin={() => { this.cancel() }} loading={this.loading} />\n // : <phone-input value={this.customer.phone} sendPin={(phone) => { this.handleSendPin(phone) }} loading={this.loading} />\n // }\n // </div>\n // <p class=\"message-alert\" >{this.message}</p>\n // <app-modal\n // isOpen={this.showModal}\n // modalTitle={`Giftback`}\n // onModalClosed={() => (this.showModal = false)}\n // >\n // <crm-bonus-form\n // loadingModal={this.loading}\n // saveStore={(amount: number) => this.save(amount)}\n // ref={ref => this.crmBonusRef = ref}\n // sent={this.sent}\n // phone={this.phone}\n // cancel={() => this.handleCloseModal()}\n // storeName={this.storeName}\n // products={this.buildProducts()}\n // cartId={this.cartId} customer={this.customer}\n // handleCustomerName={(name: string) => this.sendPinName(name)}\n // />\n // </app-modal>\n // </div>\n )\n }\n}\n"]}
|
@@ -84,7 +84,7 @@ export class CrmBonusForm {
|
|
84
84
|
this.cancel();
|
85
85
|
}
|
86
86
|
render() {
|
87
|
-
return (h(Host, { key: '
|
87
|
+
return (h(Host, { key: '56bef07243aafe1abb78fdfd38922801b84c269b' }, this.step == StepFormEnum.STEP_NAME && h("name-input", { key: '685df95ea0cd693f9a62893798464834524f5168', loading: this.loadingModal, value: this.customer.name, applyName: (name) => this.handleCustomerName(name) }), this.step === StepFormEnum.STEP_PIN && h("giftback-pin", { key: 'af82b751ed04382498e25614276ac08d5cade07a', cancel: () => this.handleCancel(), sent: this.sent, validate: (data) => this.validateBonus(data), loading: this.loading }), this.step === StepFormEnum.STEP_RESERVE && h("giftback-progress", { key: '1b493c06bf11bc7596d672fcec789a9f93573751', loading: this.loading, cancel: () => this.handleCancel(), bonus: this.bonus, reserve: (amountRedeemed) => this.reserveApply(amountRedeemed) }), this.step === StepFormEnum.STEP_APPLY && h("giftback-finish", { key: '272438aa4dbc8bb1ef9fdb45d3c2cc657d41ef4a' }), h("p", { key: 'a3a0e8a1be44d65b1edd34e28956d1b34b732fef', class: "message-error" }, this.message)));
|
88
88
|
}
|
89
89
|
static get is() { return "crm-bonus-form"; }
|
90
90
|
static get encapsulation() { return "shadow"; }
|
package/dist/collection/components/crm-bonus-form/subcomponents/giftback-finish/giftback-finish.js
CHANGED
@@ -2,7 +2,7 @@ import { h } from "@stencil/core";
|
|
2
2
|
import success from "../../../crm-bonus/assets/svg/success-svgrepo-com.svg";
|
3
3
|
export class GiftbackFinish {
|
4
4
|
render() {
|
5
|
-
return (h("div", { key: '
|
5
|
+
return (h("div", { key: 'b2db01665e3e19659c35a8c912742352bca4a1ae', class: "message-finish" }, h("img", { key: '0cb6d72a9bb696cf16ee38255cb2d5d6170e5ff1', src: success, width: 80 }), h("p", { key: '489dd5b09d20ff2140be375c1e234d5bf9671622' }, "Legal! O B\u00F4nus ser\u00E1 aplicado na sua compra.")));
|
6
6
|
}
|
7
7
|
static get is() { return "giftback-finish"; }
|
8
8
|
static get encapsulation() { return "shadow"; }
|
package/dist/collection/components/crm-bonus-form/subcomponents/giftback-pin/giftback-pin.js
CHANGED
@@ -30,7 +30,7 @@ export class GiftbackPin {
|
|
30
30
|
}
|
31
31
|
}
|
32
32
|
render() {
|
33
|
-
return (h("div", { key: '
|
33
|
+
return (h("div", { key: '73bbb31f65a9ad70d9749139036f367c5f983be7', class: "form-container-pin" }, h("div", { key: '30a4e1cb8cbec97af32e4535237ddd45b073d47c' }, h("p", { key: '4c5946125ee6cfd8ed00a845df15a65074c482e4' }, "Insira o PIN de 4 d\u00EDgitos enviado por SMS."), h("div", { key: '4d6b00888b126dc0cd786bd0c5bc20ed0a5ad354', class: "pin-container" }, this.pin.map((_, index) => (h("input", { type: "text", maxLength: 1, value: this.pin[index], onInput: (event) => this.handleInput(event, index) }))))), h("div", { key: '759369b39be6716fad568f51107db83d2f39f8c3', class: "footer-button" }, h("button", { key: '4b3e1f2cd4649e4d70ac42eb6eb41c001a159ca8', class: "button-cancel", disabled: this.loading, onClick: () => this.cancel() }, "Cancelar"), h("button", { key: '4872ba1598b806babaff1041ab08a86b3d1e92ef', class: `button ${this.loading ? 'disabled' : ''} `, disabled: this.loading, onClick: () => this.validatePin() }, !this.loading ? "Enviar" : h("loading-spinner", { size: "15px", color: "#fff" })))));
|
34
34
|
}
|
35
35
|
static get is() { return "giftback-pin"; }
|
36
36
|
static get encapsulation() { return "shadow"; }
|
@@ -26,7 +26,7 @@ export class GiftbackProgress {
|
|
26
26
|
}
|
27
27
|
render() {
|
28
28
|
const remainingGiftback = this.bonus.minimumPurchase - this.bonus.totalValue;
|
29
|
-
return (h("div", { key: '
|
29
|
+
return (h("div", { key: 'a5e02f60ab5e081341582ea0b1cfaa05583a22c2', class: "giftback-container" }, h("p", { key: '12eddb011e6a6beda91a1bc937fcacdb891b12a5' }, "Voc\u00EA possui at\u00E9 ", h("strong", { key: 'eb6018fe44106dd2a9928d4efe77dbd17180e3d3' }, "R$ ", this.bonus.totalBonus.toFixed(2)), " de Giftback nessa compra!"), h("p", { key: '065028af79e33d565c82bd55ea2245e3562617e8', class: "validity" }, "V\u00E1lido at\u00E9: ", new Date(this.bonus.firstValidityDate).toLocaleDateString('pt-Br')), h("p", { key: '1ed8896f6301c2c70fb7232190a2c68bc82e5f07' }, "Voc\u00EA est\u00E1 utilizando ", h("strong", { key: 'e2019caa7c7697f73021416632ca884097e21abe' }, "R$ ", this.usedValue.toFixed(2)), " nessa compra"), h("div", { key: 'b0257ef4d99c4009f23a4d9fae52b42d2ef41209', class: "progress-container" }, h("span", { key: 'bb0d1abe791dfcab30e87fea8eb025a9f3787be0' }, "R$ 0"), h("input", { key: 'a4220c65f24d68b56ccf522a46c0bd3d007c9ed6', disabled: true, type: "range", min: "0", step: "0.01", max: this.bonus.totalBonus, value: this.usedValue, onInput: (event) => this.handleSliderChange(event) }), h("span", { key: 'c216b57ffdd2a3613f05db327aad395f1f2e1285' }, "R$ ", this.bonus.totalBonus.toFixed(2))), h("p", { key: '7a5dc6a68801da2c09a33f3cdb6cf82e521be581', class: "remaining" }, "Faltam ", h("strong", { key: '9c20b260d4a95887844aa038e0f74180fff5c1eb' }, "R$ ", remainingGiftback > 0 ? remainingGiftback.toFixed(2) : Number(0).toFixed(2)), " para utilizar o valor total do Giftback."), h("div", { key: 'd99639afcac1ea180ad414ca923391f99f3d5296', class: "footer-button-giftback" }, h("button", { key: '4c1bdd2ea2ecd5037d1c29b6af31c3163fffe84a', class: "button-cancel", disabled: this.loading, onClick: () => this.cancel() }, "Cancelar"), h("button", { key: '77fc073d28272334d51ab7073e34654509c0ac26', class: `button ${this.loading ? 'disabled' : ''} `, disabled: this.loading, onClick: () => this.handleReserve(this.usedValue) }, !this.loading ? "Aplicar" : h("loading-spinner", { size: "10px", color: "#fff" })))));
|
30
30
|
}
|
31
31
|
static get is() { return "giftback-progress"; }
|
32
32
|
static get encapsulation() { return "shadow"; }
|
@@ -19,7 +19,7 @@ export class NameInput {
|
|
19
19
|
this.applyName(name);
|
20
20
|
}
|
21
21
|
render() {
|
22
|
-
return (h("div", { key: '
|
22
|
+
return (h("div", { key: 'dc6b958c6cfb83af8275cf4ff47b1ece5f8f6d93', class: "name-container" }, h("p", { key: 'd9c1105b6aab09acbd970a001735b58eb5104d9b' }, "Seu Nome:"), h("input", { key: 'f562d5e2b1b626245abb5260ad1e197fd9a60e43', class: "bc-form-control", type: "text", value: this.value, onChange: (event) => this.handleChangeName(event) }), h("p", { key: '980d915607979ee8ae8873a2fe17998c46d1ae64' }, this.message), h("div", { key: 'b4e75bbb6ee5c6f53e27722ffad3c6e1b9ae6d7f', class: "footer-button" }, h("button", { key: 'c421fbbe0d0bcf38e057afeb86f864ebb39f9fc8', class: "button-cancel", disabled: this.loading, onClick: () => this.cancel() }, "Cancelar"), h("button", { key: '17d357d3de919698efab46febb5c1ad97c398c77', class: `button ${this.loading ? 'disabled' : ''} `, disabled: this.loading, onClick: () => this.handleSetName(this.newValue) }, !this.loading ? "Continua" : h("loading-spinner", { size: "15px", color: "#fff" })))));
|
23
23
|
}
|
24
24
|
static get is() { return "name-input"; }
|
25
25
|
static get originalStyleUrls() {
|
@@ -10,7 +10,7 @@ export class PhoneInput {
|
|
10
10
|
await this.sendPin(phone);
|
11
11
|
}
|
12
12
|
render() {
|
13
|
-
return (h("div", { key: '
|
13
|
+
return (h("div", { key: '7388feb890331d696bf51ddc5690707673e06546', class: "form-container" }, h("phone-input-mask", { key: 'a3241090e731daa0b558503a9347de7a15f0025e', initialValue: this.value, ref: ref => this.phoneInputMask = ref }), h("button", { key: 'd36c5fd1b8cf7dfb0d3100450215c426855e82a6', class: `btn btn-success btnCrm ${this.loading ? 'disabled' : ''} `, disabled: this.loading, onClick: () => this.validatePhone() }, !this.loading ? "validar" : h("loading-spinner", { size: "11px", color: "#fff" }))));
|
14
14
|
}
|
15
15
|
static get is() { return "phone-input"; }
|
16
16
|
static get properties() {
|
package/dist/collection/components/crm-bonus-form/subcomponents/phone-cancel/phone.cancel.input.js
CHANGED
@@ -10,7 +10,7 @@ export class PhoneCancelInput {
|
|
10
10
|
await this.sendPin(phone);
|
11
11
|
}
|
12
12
|
render() {
|
13
|
-
return (h("div", { key: '
|
13
|
+
return (h("div", { key: '04c879b5671b42602a36a9a88734604fcfa1d1da', class: "form-container" }, h("phone-input-mask", { key: 'a0ced8d74da25026383eac206bbf45f6fa9482e7', initialValue: `Valor aplicado R$ ${this.value}`, ref: ref => this.phoneInputMask = ref, disabled: true }), h("button", { key: '89b08e7af3145068a449fb8e375372c280da7b7a', class: `btn btn-success btnCrm ${this.loading ? 'disabled' : ''} `, disabled: this.loading, onClick: () => this.validatePhone() }, !this.loading ? "Cancelar" : h("loading-spinner", { size: "11px", color: "#fff" }))));
|
14
14
|
}
|
15
15
|
static get is() { return "phone-cancel-input"; }
|
16
16
|
static get properties() {
|
@@ -0,0 +1,47 @@
|
|
1
|
+
* {
|
2
|
+
margin: 0;
|
3
|
+
padding: 0;
|
4
|
+
box-sizing: border-box;
|
5
|
+
}
|
6
|
+
|
7
|
+
.crm-container-form {
|
8
|
+
display: flex;
|
9
|
+
flex-direction: column;
|
10
|
+
justify-content: space-around;
|
11
|
+
height: 337px;
|
12
|
+
padding: 10px;
|
13
|
+
border: 1px solid #CCCCCC;
|
14
|
+
gap: 24px;
|
15
|
+
}
|
16
|
+
|
17
|
+
.crm-phone-form {
|
18
|
+
display: flex;
|
19
|
+
flex-direction: column;
|
20
|
+
height: 100%;
|
21
|
+
/* justify-content: space-around; */
|
22
|
+
gap: 16px;
|
23
|
+
}
|
24
|
+
|
25
|
+
.crm-subtitle {
|
26
|
+
font-size: 14px;
|
27
|
+
color: var(--crm-btn);
|
28
|
+
}
|
29
|
+
|
30
|
+
.crm-title {
|
31
|
+
font-weight: 700;
|
32
|
+
line-height: 20px;
|
33
|
+
color: #262626;
|
34
|
+
font-size: 16px;
|
35
|
+
}
|
36
|
+
|
37
|
+
.crm-message-info {
|
38
|
+
color: #619013;
|
39
|
+
font-weight: 500;
|
40
|
+
font-size: 12px;
|
41
|
+
}
|
42
|
+
|
43
|
+
.crm-message-error {
|
44
|
+
color: #E11D48;
|
45
|
+
font-weight: 500;
|
46
|
+
font-size: 12px;
|
47
|
+
}
|