@hhgtech/hhg-components 1.28.78 → 1.28.80
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/build/Close-b7a203d1.js +29 -0
- package/build/adapters.js +14 -14
- package/build/babyGrowth.js +77 -77
- package/build/cache.js +3 -3
- package/build/care.js +17 -17
- package/build/components.js +55 -55
- package/build/{constants-40575d3d.js → constants-3479888e.js} +2 -2
- package/build/{constants-64137f11.js → constants-bd8afa18.js} +2 -2
- package/build/constants.js +3 -3
- package/build/{core-0fc1ce13.js → core-22367a27.js} +2 -2
- package/build/{dataTransform-cf77fb84.js → dataTransform-29cc3dd2.js} +1 -1
- package/build/ecom.js +6 -6
- package/build/esm/Close-4ca83dfd.js +7 -0
- package/build/esm/adapters.js +14 -14
- package/build/esm/babyGrowth.js +78 -78
- package/build/esm/cache.js +3 -3
- package/build/esm/care.js +17 -17
- package/build/esm/components.js +55 -55
- package/build/esm/{constants-a92f47b1.js → constants-004f080a.js} +2 -2
- package/build/esm/{constants-6f09bf34.js → constants-d53f9101.js} +2 -2
- package/build/esm/constants.js +3 -3
- package/build/esm/{core-c92bee47.js → core-7e4b4d85.js} +2 -2
- package/build/esm/{dataTransform-355c2a44.js → dataTransform-bf6753e4.js} +1 -1
- package/build/esm/ecom.js +6 -6
- package/build/esm/footer.js +19 -19
- package/build/esm/gAssets.js +4 -4
- package/build/esm/{getDynamicHealthTool-65d62045.js → getDynamicHealthTool-296bc3be.js} +4 -4
- package/build/esm/{getSocialList-d5e5ffbf.js → getSocialList-2ebfcd4a.js} +2 -2
- package/build/esm/hooks.js +17 -17
- package/build/esm/i18n.js +2 -2
- package/build/esm/i18nV2.js +2 -2
- package/build/esm/{index-d9e6681f.js → index-14587dbf.js} +8 -8
- package/build/esm/{index-a04d706a.js → index-22221342.js} +2 -2
- package/build/esm/{index-d5c7154c.js → index-2516c87e.js} +4 -4
- package/build/esm/{index-9752b006.js → index-27cc65d4.js} +29 -29
- package/build/esm/{index-0c6555f6.js → index-39528b9b.js} +1 -1
- package/build/esm/index-5849268c.js +24 -0
- package/build/esm/{index-0ba897f6.js → index-76a63956.js} +5 -5
- package/build/esm/{index-5c0d3163.js → index-77f900fd.js} +10 -10
- package/build/esm/{index-abf46db4.js → index-78b15ede.js} +3 -3
- package/build/esm/{index-37af8d4f.js → index-8573ee56.js} +2 -2
- package/build/esm/{index-69eee978.js → index-97d0e5e4.js} +2 -2
- package/build/esm/{index-16780e0b.js → index-98cf27df.js} +6 -6
- package/build/esm/{index-9a1e3714.js → index-991703e4.js} +2 -2
- package/build/esm/{index-4f50641a.js → index-992d5b21.js} +9 -9
- package/build/esm/{index-b31510f1.js → index-9964165a.js} +1 -1
- package/build/esm/{index-142de717.js → index-b42b746d.js} +3 -3
- package/build/esm/{index-cd333dd6.js → index-bb6a15db.js} +2 -2
- package/build/esm/{index-3159a30c.js → index-c6b43ed7.js} +9 -9
- package/build/esm/{index-f1e659ad.js → index-ce7d88c1.js} +3 -3
- package/build/esm/{index-882fb87f.js → index-cf62426e.js} +4 -4
- package/build/esm/{index-fdd8a07c.js → index-d108d803.js} +13 -13
- package/build/esm/{index-3d89625a.js → index-d5783ce8.js} +5 -5
- package/build/esm/{index-d49c59f2.js → index-dc60f279.js} +47 -43
- package/build/esm/{index-c88a79ab.js → index-e329bfff.js} +2 -2
- package/build/esm/{index-de7701bc.js → index-f98bf91e.js} +3 -3
- package/build/esm/index.js +69 -68
- package/build/esm/{index.styled-8998eefe.js → index.styled-938c9e2d.js} +2 -2
- package/build/esm/{index.styles-db6e1045.js → index.styles-cf0b32a3.js} +6 -6
- package/build/esm/lead/components/close.d.ts +9 -0
- package/build/esm/lead/components/context.d.ts +35 -0
- package/build/esm/lead/components/description.d.ts +3 -0
- package/build/esm/lead/components/form/fields/index.d.ts +10 -0
- package/build/esm/lead/components/form/fields/index.styles.d.ts +8 -0
- package/build/esm/lead/components/form/fields/locationBlock.d.ts +6 -0
- package/build/esm/lead/components/form/fields/subtitleBlock.d.ts +5 -0
- package/build/esm/lead/components/form/fields/titleBlock.d.ts +5 -0
- package/build/esm/lead/components/form/formContext.d.ts +12 -0
- package/build/esm/lead/components/form/index.d.ts +5 -0
- package/build/esm/lead/components/form/index.styles.d.ts +15 -0
- package/build/esm/lead/components/heading.d.ts +3 -0
- package/build/esm/lead/components/index.d.ts +12 -0
- package/build/esm/lead/components/otpBlock/index.d.ts +9 -0
- package/build/esm/lead/components/otpBlock/index.styles.d.ts +13 -0
- package/build/esm/lead/components/thankyou.d.ts +4 -0
- package/build/esm/lead/index.d.ts +18 -2
- package/build/esm/lead.js +833 -221
- package/build/esm/mantine.js +19 -19
- package/build/esm/misc.js +17 -17
- package/build/esm/navigation.js +34 -34
- package/build/esm/onboardingV2.js +29 -29
- package/build/esm/pwg.js +18 -18
- package/build/esm/{routing-e0641e19.js → routing-8faaacea.js} +2 -2
- package/build/esm/subot.js +20 -20
- package/build/esm/together.js +33 -32
- package/build/esm/{types-e48d1bc6.js → types-9f020bf6.js} +30 -34
- package/build/esm/{types-6edb0698.js → types-a4e6af19.js} +13 -13
- package/build/esm/types.js +1 -1
- package/build/esm/{useCategory-f08a6273.js → useCategory-b525a974.js} +5 -5
- package/build/esm/{useHealthToolCache-8a7d9f6e.js → useHealthToolCache-f6dcb4d8.js} +2 -2
- package/build/esm/{usePlacesAutocomplete-87e2f95a.js → usePlacesAutocomplete-e14d1036.js} +1 -1
- package/build/esm/{useTranslations-eae057f4.js → useTranslations-a559a7a5.js} +1 -1
- package/build/esm/{utils-76b4cfc5.js → utils-8cfab824.js} +6 -6
- package/build/esm/{utils-277663aa.js → utils-93eb13e7.js} +1 -1
- package/build/esm/{utils-c6ecc48d.js → utils-a88682f9.js} +4 -4
- package/build/esm/vaccination.js +24 -24
- package/build/footer.js +19 -19
- package/build/gAssets.js +4 -4
- package/build/{getDynamicHealthTool-d9accadf.js → getDynamicHealthTool-fe550923.js} +4 -4
- package/build/{getSocialList-5ec06679.js → getSocialList-28b8aa45.js} +2 -2
- package/build/hooks.js +17 -17
- package/build/i18n.js +1 -1
- package/build/i18nV2.js +1 -1
- package/build/{index-81a9d681.js → index-05304b9b.js} +4 -4
- package/build/{index-89b263ae.js → index-14226ab2.js} +46 -42
- package/build/{index-f40707bc.js → index-17f9a72f.js} +2 -2
- package/build/{index-90262260.js → index-1cc3b628.js} +3 -3
- package/build/{index-56b91dfc.js → index-50a331ae.js} +2 -2
- package/build/{index-104d3cf5.js → index-72a41d2b.js} +5 -5
- package/build/{index-1ccc525b.js → index-76bb520c.js} +2 -2
- package/build/{index-5066f448.js → index-830cfc43.js} +13 -13
- package/build/{index-d3aa6c0c.js → index-88286df3.js} +29 -29
- package/build/{index-8b1861d6.js → index-8c630d76.js} +4 -4
- package/build/{index-bd2005e5.js → index-8d87268c.js} +3 -3
- package/build/{index-0f205b8d.js → index-90b4cf6b.js} +10 -10
- package/build/{index-7e38d239.js → index-958f67bb.js} +2 -2
- package/build/{index-39692095.js → index-96b9585a.js} +9 -9
- package/build/{index-fc485132.js → index-a2785ada.js} +3 -3
- package/build/{index-1a6b3538.js → index-a3d460fa.js} +3 -3
- package/build/{index-faecc6fb.js → index-a511db2b.js} +9 -9
- package/build/{index-38ecdf2c.js → index-a79982f7.js} +2 -2
- package/build/{index-8e864883.js → index-a84eedaa.js} +1 -1
- package/build/{index-471a6db2.js → index-a909db6f.js} +2 -2
- package/build/{index-3daa918b.js → index-c194972d.js} +8 -8
- package/build/{index-dc3faaea.js → index-d02a1631.js} +6 -6
- package/build/{index-dd49ba18.js → index-d7aea2d0.js} +1 -1
- package/build/{index-36c874ce.js → index-e3b0bdb0.js} +4 -4
- package/build/{index-d1c248bb.js → index-f77accef.js} +10 -10
- package/build/index.js +113 -112
- package/build/{index.styled-221f7a2a.js → index.styled-2ad9b370.js} +2 -2
- package/build/{index.styles-63c23f64.js → index.styles-2705c1b1.js} +5 -5
- package/build/lead/components/close.d.ts +9 -0
- package/build/lead/components/context.d.ts +35 -0
- package/build/lead/components/description.d.ts +3 -0
- package/build/lead/components/form/fields/index.d.ts +10 -0
- package/build/lead/components/form/fields/index.styles.d.ts +8 -0
- package/build/lead/components/form/fields/locationBlock.d.ts +6 -0
- package/build/lead/components/form/fields/subtitleBlock.d.ts +5 -0
- package/build/lead/components/form/fields/titleBlock.d.ts +5 -0
- package/build/lead/components/form/formContext.d.ts +12 -0
- package/build/lead/components/form/index.d.ts +5 -0
- package/build/lead/components/form/index.styles.d.ts +15 -0
- package/build/lead/components/heading.d.ts +3 -0
- package/build/lead/components/index.d.ts +12 -0
- package/build/lead/components/otpBlock/index.d.ts +9 -0
- package/build/lead/components/otpBlock/index.styles.d.ts +13 -0
- package/build/lead/components/thankyou.d.ts +4 -0
- package/build/lead/index.d.ts +18 -2
- package/build/lead.js +856 -244
- package/build/mantine.js +17 -17
- package/build/misc.js +17 -17
- package/build/navigation.js +34 -34
- package/build/onboardingV2.js +28 -28
- package/build/pwg.js +18 -18
- package/build/{routing-f4f6017a.js → routing-46b3def0.js} +2 -2
- package/build/subot.js +20 -20
- package/build/together.js +33 -32
- package/build/{types-62cb6b9e.js → types-03e001c9.js} +13 -13
- package/build/{types-94c4449c.js → types-55014b2c.js} +656 -660
- package/build/types.js +1 -1
- package/build/{useCategory-5cd180e8.js → useCategory-54dfd7ee.js} +5 -5
- package/build/{useHealthToolCache-a29f76ce.js → useHealthToolCache-a5a6585a.js} +2 -2
- package/build/{usePlacesAutocomplete-c19fd7c5.js → usePlacesAutocomplete-c73d655f.js} +1 -1
- package/build/{useTranslations-a4c6b8f5.js → useTranslations-ee85619b.js} +1 -1
- package/build/{utils-9ba965d4.js → utils-8aee541d.js} +1 -1
- package/build/{utils-6ccbb5ca.js → utils-d583cd84.js} +4 -4
- package/build/{utils-c2445e75.js → utils-da97b7ae.js} +5 -5
- package/build/vaccination.js +24 -24
- package/package.json +1 -1
- package/build/esm/index-71695420.js +0 -24
- /package/build/{BMI_BOYS.percentile.monthly-cd4dbb12.js → BMI_BOYS.percentile.monthly-34095f55.js} +0 -0
- /package/build/{BMI_BOYS.percentile.weekly-57bb5688.js → BMI_BOYS.percentile.weekly-b843a333.js} +0 -0
- /package/build/{BMI_BOYS.percentile.yearly-b8087797.js → BMI_BOYS.percentile.yearly-db0f25db.js} +0 -0
- /package/build/{BMI_BOYS.zscore.monthly-b0f104b3.js → BMI_BOYS.zscore.monthly-36793c3e.js} +0 -0
- /package/build/{BMI_BOYS.zscore.weekly-bf578a42.js → BMI_BOYS.zscore.weekly-92df605a.js} +0 -0
- /package/build/{BMI_BOYS.zscore.yearly-02177a3d.js → BMI_BOYS.zscore.yearly-33a1c871.js} +0 -0
- /package/build/{BMI_GIRLS.percentile.monthly-0f7037f4.js → BMI_GIRLS.percentile.monthly-4bf16f7d.js} +0 -0
- /package/build/{BMI_GIRLS.percentile.weekly-c64fb331.js → BMI_GIRLS.percentile.weekly-3bb97e2c.js} +0 -0
- /package/build/{BMI_GIRLS.percentile.yearly-92c7babb.js → BMI_GIRLS.percentile.yearly-5ff7d694.js} +0 -0
- /package/build/{BMI_GIRLS.zscore.monthly-acd077a4.js → BMI_GIRLS.zscore.monthly-3be0d0e3.js} +0 -0
- /package/build/{BMI_GIRLS.zscore.weekly-cbc31f74.js → BMI_GIRLS.zscore.weekly-6d5c73b8.js} +0 -0
- /package/build/{BMI_GIRLS.zscore.yearly-9ca4ec0a.js → BMI_GIRLS.zscore.yearly-c16c2b7a.js} +0 -0
- /package/build/{ChevronDown-8c713f38.js → ChevronDown-00b6c45c.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.percentile.monthly-4a45c6b1.js → HEAD CIRCUM_BOYS.percentile.monthly-5783abde.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.percentile.weekly-90b85098.js → HEAD CIRCUM_BOYS.percentile.weekly-69accc9b.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.percentile.yearly-68869800.js → HEAD CIRCUM_BOYS.percentile.yearly-6f716357.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.zscore.monthly-df1068cd.js → HEAD CIRCUM_BOYS.zscore.monthly-740d8a88.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.zscore.weekly-58fd2b99.js → HEAD CIRCUM_BOYS.zscore.weekly-75a83e4e.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.zscore.yearly-e90283fb.js → HEAD CIRCUM_BOYS.zscore.yearly-beacfadd.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.percentile.monthly-b147a0ea.js → HEAD CIRCUM_GIRLS.percentile.monthly-4e9309e8.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.percentile.weekly-a71d64c9.js → HEAD CIRCUM_GIRLS.percentile.weekly-8456b0af.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.percentile.yearly-2c787e37.js → HEAD CIRCUM_GIRLS.percentile.yearly-6bf9c34f.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.zscore.monthly-3c443800.js → HEAD CIRCUM_GIRLS.zscore.monthly-561c12d7.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.zscore.weekly-e315a119.js → HEAD CIRCUM_GIRLS.zscore.weekly-27b56db8.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.zscore.yearly-ee8cb903.js → HEAD CIRCUM_GIRLS.zscore.yearly-e571dc07.js} +0 -0
- /package/build/{HEIGHT_BOYS.percentile.monthly-3132cb32.js → HEIGHT_BOYS.percentile.monthly-52109c85.js} +0 -0
- /package/build/{HEIGHT_BOYS.percentile.weekly-6f61a01c.js → HEIGHT_BOYS.percentile.weekly-be6e5b1c.js} +0 -0
- /package/build/{HEIGHT_BOYS.percentile.yearly-870348f0.js → HEIGHT_BOYS.percentile.yearly-3712519c.js} +0 -0
- /package/build/{HEIGHT_BOYS.zscore.monthly-960e19dd.js → HEIGHT_BOYS.zscore.monthly-3ae90dec.js} +0 -0
- /package/build/{HEIGHT_BOYS.zscore.weekly-2a5e17ee.js → HEIGHT_BOYS.zscore.weekly-96915a5d.js} +0 -0
- /package/build/{HEIGHT_BOYS.zscore.yearly-a7de7213.js → HEIGHT_BOYS.zscore.yearly-a3361503.js} +0 -0
- /package/build/{HEIGHT_GIRLS.percentile.monthly-4b7d5d8b.js → HEIGHT_GIRLS.percentile.monthly-d5d14ae4.js} +0 -0
- /package/build/{HEIGHT_GIRLS.percentile.weekly-ad0b7803.js → HEIGHT_GIRLS.percentile.weekly-88d86966.js} +0 -0
- /package/build/{HEIGHT_GIRLS.percentile.yearly-c752b708.js → HEIGHT_GIRLS.percentile.yearly-00fab771.js} +0 -0
- /package/build/{HEIGHT_GIRLS.zscore.monthly-4c49d8bf.js → HEIGHT_GIRLS.zscore.monthly-6c2eeff3.js} +0 -0
- /package/build/{HEIGHT_GIRLS.zscore.weekly-41ffaa90.js → HEIGHT_GIRLS.zscore.weekly-7619a61a.js} +0 -0
- /package/build/{HEIGHT_GIRLS.zscore.yearly-e508c93f.js → HEIGHT_GIRLS.zscore.yearly-122a294d.js} +0 -0
- /package/build/{Subot-89c2bfe5.js → Subot-a11a4e5b.js} +0 -0
- /package/build/{Visible-0683d0c7.js → Visible-c9b6d1c1.js} +0 -0
- /package/build/{WEIGHT_BOYS.percentile.monthly-5a090cb6.js → WEIGHT_BOYS.percentile.monthly-01c99b0d.js} +0 -0
- /package/build/{WEIGHT_BOYS.percentile.weekly-9cfd232a.js → WEIGHT_BOYS.percentile.weekly-76f8bd4a.js} +0 -0
- /package/build/{WEIGHT_BOYS.percentile.yearly-83c4a636.js → WEIGHT_BOYS.percentile.yearly-c41a4d02.js} +0 -0
- /package/build/{WEIGHT_BOYS.zscore.monthly-8e62e97f.js → WEIGHT_BOYS.zscore.monthly-04465ae9.js} +0 -0
- /package/build/{WEIGHT_BOYS.zscore.weekly-efed5638.js → WEIGHT_BOYS.zscore.weekly-fac29a95.js} +0 -0
- /package/build/{WEIGHT_BOYS.zscore.yearly-01c9d037.js → WEIGHT_BOYS.zscore.yearly-66eb62c0.js} +0 -0
- /package/build/{WEIGHT_GIRLS.percentile.monthly-806092bb.js → WEIGHT_GIRLS.percentile.monthly-97e796d5.js} +0 -0
- /package/build/{WEIGHT_GIRLS.percentile.weekly-2d7f3d54.js → WEIGHT_GIRLS.percentile.weekly-908cfdb5.js} +0 -0
- /package/build/{WEIGHT_GIRLS.percentile.yearly-2014adea.js → WEIGHT_GIRLS.percentile.yearly-0e313840.js} +0 -0
- /package/build/{WEIGHT_GIRLS.zscore.monthly-4eeb534d.js → WEIGHT_GIRLS.zscore.monthly-2497ec51.js} +0 -0
- /package/build/{WEIGHT_GIRLS.zscore.weekly-30633442.js → WEIGHT_GIRLS.zscore.weekly-45deda67.js} +0 -0
- /package/build/{WEIGHT_GIRLS.zscore.yearly-5fcb5a74.js → WEIGHT_GIRLS.zscore.yearly-28b55590.js} +0 -0
- /package/build/{animation-8d4719c5.js → animation-1621b827.js} +0 -0
- /package/build/{cookieHelper-b3cb244a.js → cookieHelper-115e3b7b.js} +0 -0
- /package/build/esm/{BMI_BOYS.percentile.monthly-d9dcd396.js → BMI_BOYS.percentile.monthly-f22300a8.js} +0 -0
- /package/build/esm/{BMI_BOYS.percentile.weekly-ca6db25e.js → BMI_BOYS.percentile.weekly-0916c196.js} +0 -0
- /package/build/esm/{BMI_BOYS.percentile.yearly-851d65ea.js → BMI_BOYS.percentile.yearly-1958e38b.js} +0 -0
- /package/build/esm/{BMI_BOYS.zscore.monthly-b38e4a47.js → BMI_BOYS.zscore.monthly-70d4e86e.js} +0 -0
- /package/build/esm/{BMI_BOYS.zscore.weekly-ead9b9b7.js → BMI_BOYS.zscore.weekly-d75f7e4a.js} +0 -0
- /package/build/esm/{BMI_BOYS.zscore.yearly-92be50c0.js → BMI_BOYS.zscore.yearly-1930de04.js} +0 -0
- /package/build/esm/{BMI_GIRLS.percentile.monthly-a5d758d0.js → BMI_GIRLS.percentile.monthly-e1df5f5d.js} +0 -0
- /package/build/esm/{BMI_GIRLS.percentile.weekly-ee96da9f.js → BMI_GIRLS.percentile.weekly-0dab6bc5.js} +0 -0
- /package/build/esm/{BMI_GIRLS.percentile.yearly-aa671473.js → BMI_GIRLS.percentile.yearly-e90dd797.js} +0 -0
- /package/build/esm/{BMI_GIRLS.zscore.monthly-d2d0f9ad.js → BMI_GIRLS.zscore.monthly-e5c49595.js} +0 -0
- /package/build/esm/{BMI_GIRLS.zscore.weekly-cf49eeb5.js → BMI_GIRLS.zscore.weekly-de23cfec.js} +0 -0
- /package/build/esm/{BMI_GIRLS.zscore.yearly-e74d0e82.js → BMI_GIRLS.zscore.yearly-157d5f16.js} +0 -0
- /package/build/esm/{ChevronDown-3cd5b130.js → ChevronDown-dba8fc93.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.percentile.monthly-a9eafb23.js → HEAD CIRCUM_BOYS.percentile.monthly-ba646a48.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.percentile.weekly-15ba606f.js → HEAD CIRCUM_BOYS.percentile.weekly-88bcf790.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.percentile.yearly-3683033e.js → HEAD CIRCUM_BOYS.percentile.yearly-197b10a1.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.zscore.monthly-81eed4ba.js → HEAD CIRCUM_BOYS.zscore.monthly-e8492701.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.zscore.weekly-8c6bc465.js → HEAD CIRCUM_BOYS.zscore.weekly-fdd39166.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.zscore.yearly-344c2df6.js → HEAD CIRCUM_BOYS.zscore.yearly-b9f25c32.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.monthly-c4cbee63.js → HEAD CIRCUM_GIRLS.percentile.monthly-c5c9838b.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.weekly-0485cd9a.js → HEAD CIRCUM_GIRLS.percentile.weekly-c511c542.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.yearly-54823c8c.js → HEAD CIRCUM_GIRLS.percentile.yearly-71243cc4.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.monthly-7bcf1ee7.js → HEAD CIRCUM_GIRLS.zscore.monthly-584142c2.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.weekly-28cc086b.js → HEAD CIRCUM_GIRLS.zscore.weekly-58c12477.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.yearly-ec19dbb3.js → HEAD CIRCUM_GIRLS.zscore.yearly-f5df2c91.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.percentile.monthly-2b005928.js → HEIGHT_BOYS.percentile.monthly-70bda395.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.percentile.weekly-140dfd55.js → HEIGHT_BOYS.percentile.weekly-30c20803.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.percentile.yearly-f8c788c6.js → HEIGHT_BOYS.percentile.yearly-5bbf1dac.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.zscore.monthly-667910e9.js → HEIGHT_BOYS.zscore.monthly-e0538785.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.zscore.weekly-3ad4e67b.js → HEIGHT_BOYS.zscore.weekly-eb71c990.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.zscore.yearly-e9770e82.js → HEIGHT_BOYS.zscore.yearly-4dc9859f.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.percentile.monthly-470374fa.js → HEIGHT_GIRLS.percentile.monthly-e414e4c7.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.percentile.weekly-49f2c32f.js → HEIGHT_GIRLS.percentile.weekly-1b851c3e.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.percentile.yearly-3953c0bc.js → HEIGHT_GIRLS.percentile.yearly-b5d7f6d3.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.zscore.monthly-c9d053a2.js → HEIGHT_GIRLS.zscore.monthly-11d155a8.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.zscore.weekly-4dc7e083.js → HEIGHT_GIRLS.zscore.weekly-5d495735.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.zscore.yearly-2b068c0e.js → HEIGHT_GIRLS.zscore.yearly-be736caf.js} +0 -0
- /package/build/esm/{Subot-479bbb06.js → Subot-7661c139.js} +0 -0
- /package/build/esm/{Visible-4bf23575.js → Visible-d824de49.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.percentile.monthly-5c19ff7a.js → WEIGHT_BOYS.percentile.monthly-9c5b188e.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.percentile.weekly-40f1aa7a.js → WEIGHT_BOYS.percentile.weekly-0fa721f6.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.percentile.yearly-a9a0ec66.js → WEIGHT_BOYS.percentile.yearly-c8a70cab.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.zscore.monthly-b2d0b5ed.js → WEIGHT_BOYS.zscore.monthly-21d3428e.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.zscore.weekly-f47fffcf.js → WEIGHT_BOYS.zscore.weekly-4c58352b.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.zscore.yearly-af5cff3d.js → WEIGHT_BOYS.zscore.yearly-d4dd6ebb.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.percentile.monthly-b1cc3d94.js → WEIGHT_GIRLS.percentile.monthly-cd2ca8d6.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.percentile.weekly-b1e28e33.js → WEIGHT_GIRLS.percentile.weekly-bd2e8484.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.percentile.yearly-f1363e13.js → WEIGHT_GIRLS.percentile.yearly-4079fc0b.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.zscore.monthly-6f377056.js → WEIGHT_GIRLS.zscore.monthly-314c62fd.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.zscore.weekly-7a819a2a.js → WEIGHT_GIRLS.zscore.weekly-b5e5c0f4.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.zscore.yearly-74444860.js → WEIGHT_GIRLS.zscore.yearly-3ebbf40b.js} +0 -0
- /package/build/esm/{animation-7e12e0a4.js → animation-9a852d86.js} +0 -0
- /package/build/esm/{cookieHelper-d72c1c16.js → cookieHelper-fb2f4bf7.js} +0 -0
- /package/build/esm/{index-9962a4ae.js → index-11c2da20.js} +0 -0
- /package/build/esm/{index-358cd506.js → index-cf296b7d.js} +0 -0
- /package/build/esm/{index-dc56a048.js → index-f408e111.js} +0 -0
- /package/build/esm/{isProduction-6b6e5a81.js → isProduction-a14c0289.js} +0 -0
- /package/build/esm/{localizeNumberFormat-1245f676.js → localizeNumberFormat-7ad2018e.js} +0 -0
- /package/build/esm/{normalizeLink-41e77cc7.js → normalizeLink-b27ea7f7.js} +0 -0
- /package/build/esm/{number-bc91c47a.js → number-c4673157.js} +0 -0
- /package/build/esm/{paths-7c14e8ba.js → paths-24a48d7a.js} +0 -0
- /package/build/esm/{theme-9dbe697d.js → theme-b8e10c2e.js} +0 -0
- /package/build/esm/{translationsContext-1767db70.js → translationsContext-a710bd79.js} +0 -0
- /package/build/esm/{tslib.es6-16db9b9d.js → tslib.es6-2581561d.js} +0 -0
- /package/build/esm/{types-e4d6e9a0.js → types-d56b59d0.js} +0 -0
- /package/build/esm/{useIsInit-ac71b6dd.js → useIsInit-5759a12c.js} +0 -0
- /package/build/esm/{useOutsideClick-8106a9aa.js → useOutsideClick-0cd449b6.js} +0 -0
- /package/build/esm/{useScrollbarSize-c8d8a8ab.js → useScrollbarSize-9a2c88e8.js} +0 -0
- /package/build/esm/{useUniqueId-ef872d43.js → useUniqueId-4d87b935.js} +0 -0
- /package/build/esm/{utils-f360454d.js → utils-ad80dd9a.js} +0 -0
- /package/build/{index-83736819.js → index-306faebb.js} +0 -0
- /package/build/{index-2d45199a.js → index-5f30931a.js} +0 -0
- /package/build/{index-a0ab42d5.js → index-7aff6c39.js} +0 -0
- /package/build/{isProduction-2fea4aa7.js → isProduction-253f0a63.js} +0 -0
- /package/build/{localizeNumberFormat-4857ba64.js → localizeNumberFormat-691759ff.js} +0 -0
- /package/build/{normalizeLink-f6101122.js → normalizeLink-289e65d5.js} +0 -0
- /package/build/{number-ad95e7d9.js → number-97ef064d.js} +0 -0
- /package/build/{paths-7da7ad16.js → paths-a793ca70.js} +0 -0
- /package/build/{theme-ca8bb2dd.js → theme-3069f85a.js} +0 -0
- /package/build/{translationsContext-eb3b16d8.js → translationsContext-09f33cc8.js} +0 -0
- /package/build/{tslib.es6-6fa07404.js → tslib.es6-05775979.js} +0 -0
- /package/build/{types-d6abfadd.js → types-ab2e9e82.js} +0 -0
- /package/build/{useIsInit-2a90ae3a.js → useIsInit-91ab8916.js} +0 -0
- /package/build/{useOutsideClick-daecc08d.js → useOutsideClick-e32b8474.js} +0 -0
- /package/build/{useScrollbarSize-2d7f52a6.js → useScrollbarSize-3e2d19c9.js} +0 -0
- /package/build/{useUniqueId-3396b916.js → useUniqueId-3b22c3ca.js} +0 -0
- /package/build/{utils-64e577eb.js → utils-f7881466.js} +0 -0
package/build/lead.js
CHANGED
|
@@ -2,47 +2,48 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var tslib_es6 = require('./tslib.es6-
|
|
5
|
+
var tslib_es6 = require('./tslib.es6-05775979.js');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var debounce = require('lodash/debounce');
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var index
|
|
8
|
+
var form = require('@mantine/form');
|
|
9
|
+
var useTranslations = require('./useTranslations-ee85619b.js');
|
|
10
|
+
var index = require('./index-a84eedaa.js');
|
|
11
11
|
var core = require('@mantine/core');
|
|
12
|
-
|
|
13
|
-
require('./index
|
|
14
|
-
var index = require('./index-
|
|
15
|
-
require('./
|
|
16
|
-
require('./
|
|
17
|
-
require('./
|
|
18
|
-
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
var
|
|
12
|
+
require('./index.styles-2705c1b1.js');
|
|
13
|
+
var index$1 = require('./index-c194972d.js');
|
|
14
|
+
var index$2 = require('./index-a2785ada.js');
|
|
15
|
+
var index$5 = require('./index-a79982f7.js');
|
|
16
|
+
require('./constants-3479888e.js');
|
|
17
|
+
require('./Subot-a11a4e5b.js');
|
|
18
|
+
require('./utils-d583cd84.js');
|
|
19
|
+
var utils$1 = require('./utils-f7881466.js');
|
|
20
|
+
var index$3 = require('./index-72a41d2b.js');
|
|
21
|
+
var theme = require('./theme-3069f85a.js');
|
|
22
|
+
var translationsContext = require('./translationsContext-09f33cc8.js');
|
|
22
23
|
require('string-format');
|
|
23
24
|
require('@mantine/hooks');
|
|
24
|
-
require('./index-
|
|
25
|
-
require('./utils-
|
|
26
|
-
require('./index.styled-
|
|
27
|
-
require('./index-
|
|
28
|
-
var utils = require('./utils-
|
|
25
|
+
require('./index-958f67bb.js');
|
|
26
|
+
require('./utils-da97b7ae.js');
|
|
27
|
+
require('./index.styled-2ad9b370.js');
|
|
28
|
+
require('./index-5f30931a.js');
|
|
29
|
+
var utils = require('./utils-8aee541d.js');
|
|
29
30
|
require('@mantine/dates');
|
|
30
|
-
var usePlacesAutocomplete = require('./usePlacesAutocomplete-
|
|
31
|
-
var
|
|
32
|
-
var
|
|
33
|
-
var index$3 = require('./index-1a6b3538.js');
|
|
31
|
+
var usePlacesAutocomplete = require('./usePlacesAutocomplete-c73d655f.js');
|
|
32
|
+
var index$4 = require('./index-a3d460fa.js');
|
|
33
|
+
var uuid = require('uuid');
|
|
34
34
|
var ReactDOM = require('react-dom');
|
|
35
|
-
var cookieHelper = require('./cookieHelper-
|
|
35
|
+
var cookieHelper = require('./cookieHelper-115e3b7b.js');
|
|
36
36
|
var dayjs = require('dayjs');
|
|
37
|
-
require('./
|
|
37
|
+
var Close = require('./Close-b7a203d1.js');
|
|
38
38
|
require('styled-components');
|
|
39
|
-
require('./animation-
|
|
39
|
+
require('./animation-1621b827.js');
|
|
40
40
|
require('react-keyed-flatten-children');
|
|
41
41
|
require('@hhgtech/icons/other');
|
|
42
42
|
require('@mantine/carousel');
|
|
43
43
|
require('classnames');
|
|
44
|
-
require('./useUniqueId-
|
|
44
|
+
require('./useUniqueId-3b22c3ca.js');
|
|
45
45
|
require('@hhgtech/icons/core');
|
|
46
|
+
require('./isProduction-253f0a63.js');
|
|
46
47
|
require('date-fns/locale');
|
|
47
48
|
require('slugify');
|
|
48
49
|
|
|
@@ -70,6 +71,8 @@ var React__default = /*#__PURE__*/_interopDefault(React);
|
|
|
70
71
|
var debounce__default = /*#__PURE__*/_interopDefault(debounce);
|
|
71
72
|
var dayjs__default = /*#__PURE__*/_interopDefault(dayjs);
|
|
72
73
|
|
|
74
|
+
const LeadGenComponentContext = React.createContext({});
|
|
75
|
+
|
|
73
76
|
const CAMPAIGN_TARGET_TYPE = { LINKS: 1, TAGS: 2 };
|
|
74
77
|
let LEAD_API = 'https://dev.leadgen.hellobacsi.com/';
|
|
75
78
|
const LEAD_DEVICE_TYPE = {
|
|
@@ -134,25 +137,787 @@ const LEAD_LOCALE_DATA = {
|
|
|
134
137
|
countryCodeNumber: 91,
|
|
135
138
|
},
|
|
136
139
|
};
|
|
137
|
-
const LEAD_LOCALE = LEAD_LOCALE_DATA[docLang] || LEAD_LOCALE_DATA['vi-VN'];
|
|
138
|
-
function LEAD_RESET_VAR() {
|
|
139
|
-
// LEAD_CURRENT_URL = location.href.toLowerCase();
|
|
140
|
-
LEAD_CURRENT_URL =
|
|
141
|
-
'https://' + location.hostname + location.pathname + location.search;
|
|
142
|
-
}
|
|
143
|
-
const LEAD_TIMEZONE_DATA = {
|
|
144
|
-
1: 'Asia/Ho_Chi_Minh',
|
|
145
|
-
10: 'Asia/Ho_Chi_Minh',
|
|
146
|
-
11: 'Asia/Ho_Chi_Minh',
|
|
147
|
-
12: 'Asia/Ho_Chi_Minh',
|
|
148
|
-
2: 'Asia/Jakarta',
|
|
149
|
-
3: 'Asia/Bangkok',
|
|
150
|
-
4: 'Asia/Phnom_Penh',
|
|
151
|
-
5: 'Asia/Kuala_Lumpur',
|
|
152
|
-
6: 'Asia/Taipei',
|
|
153
|
-
7: 'Asia/Yangon',
|
|
154
|
-
8: 'Asia/Kolkata',
|
|
155
|
-
9: 'Asia/Manila', // Philippines / Filipinos Site
|
|
140
|
+
const LEAD_LOCALE = LEAD_LOCALE_DATA[docLang] || LEAD_LOCALE_DATA['vi-VN'];
|
|
141
|
+
function LEAD_RESET_VAR() {
|
|
142
|
+
// LEAD_CURRENT_URL = location.href.toLowerCase();
|
|
143
|
+
LEAD_CURRENT_URL =
|
|
144
|
+
'https://' + location.hostname + location.pathname + location.search;
|
|
145
|
+
}
|
|
146
|
+
const LEAD_TIMEZONE_DATA = {
|
|
147
|
+
1: 'Asia/Ho_Chi_Minh',
|
|
148
|
+
10: 'Asia/Ho_Chi_Minh',
|
|
149
|
+
11: 'Asia/Ho_Chi_Minh',
|
|
150
|
+
12: 'Asia/Ho_Chi_Minh',
|
|
151
|
+
2: 'Asia/Jakarta',
|
|
152
|
+
3: 'Asia/Bangkok',
|
|
153
|
+
4: 'Asia/Phnom_Penh',
|
|
154
|
+
5: 'Asia/Kuala_Lumpur',
|
|
155
|
+
6: 'Asia/Taipei',
|
|
156
|
+
7: 'Asia/Yangon',
|
|
157
|
+
8: 'Asia/Kolkata',
|
|
158
|
+
9: 'Asia/Manila', // Philippines / Filipinos Site
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
class Store {
|
|
162
|
+
constructor() {
|
|
163
|
+
this.apiLeadUrl = 'https://dev.leadgen.hellobacsi.com/';
|
|
164
|
+
this.apiSubotUrl = 'https://staging-service-subot.hellohealthgroup.com/';
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
const leadStore = new Store();
|
|
168
|
+
|
|
169
|
+
const leadApi = {
|
|
170
|
+
call(_a) {
|
|
171
|
+
var { url, data = undefined } = _a, config = tslib_es6.__rest(_a, ["url", "data"]);
|
|
172
|
+
config.body = JSON.stringify(data);
|
|
173
|
+
config.headers = {
|
|
174
|
+
'Content-Type': 'application/json',
|
|
175
|
+
};
|
|
176
|
+
return fetch(`${leadStore.apiLeadUrl}${url}`, config)
|
|
177
|
+
.then((res) => res.json())
|
|
178
|
+
.catch(() => ({}));
|
|
179
|
+
},
|
|
180
|
+
};
|
|
181
|
+
const subotApi = {
|
|
182
|
+
call(_a) {
|
|
183
|
+
var { url, data } = _a, config = tslib_es6.__rest(_a, ["url", "data"]);
|
|
184
|
+
config.body = JSON.stringify(data);
|
|
185
|
+
config.headers = {
|
|
186
|
+
'Content-Type': 'application/json',
|
|
187
|
+
};
|
|
188
|
+
return fetch(`${leadStore.apiSubotUrl}${url}`, config)
|
|
189
|
+
.then((res) => res.json())
|
|
190
|
+
.catch(() => ({}));
|
|
191
|
+
},
|
|
192
|
+
};
|
|
193
|
+
const campaignGetById = (id) => {
|
|
194
|
+
return leadApi.call({
|
|
195
|
+
url: `api/internal/campaign/${id}`,
|
|
196
|
+
method: 'get',
|
|
197
|
+
});
|
|
198
|
+
};
|
|
199
|
+
const validateEmailOrPhoneOnLeadGen = ({ campaign_id, email, phone, }) => {
|
|
200
|
+
let phoneToSend = phone;
|
|
201
|
+
// Remove the '0' part. Logic from Back to check between Subot and Lead with different format
|
|
202
|
+
if (phoneToSend && phoneToSend.startsWith('0')) {
|
|
203
|
+
phoneToSend = phoneToSend.substring(1);
|
|
204
|
+
}
|
|
205
|
+
return leadApi.call({
|
|
206
|
+
url: 'api/subot-campaign/check',
|
|
207
|
+
method: 'post',
|
|
208
|
+
data: {
|
|
209
|
+
campaign_id,
|
|
210
|
+
email,
|
|
211
|
+
phone: phoneToSend,
|
|
212
|
+
},
|
|
213
|
+
});
|
|
214
|
+
};
|
|
215
|
+
const validateEmailOrPhoneOnSubot = ({ bot_id, email, phone, }) => {
|
|
216
|
+
let phoneToSend = phone;
|
|
217
|
+
// Remove the '0' part. Logic from Back to check between Subot and Lead with different format
|
|
218
|
+
if (phoneToSend && phoneToSend.startsWith('0')) {
|
|
219
|
+
phoneToSend = phoneToSend.substring(1);
|
|
220
|
+
}
|
|
221
|
+
return subotApi.call({
|
|
222
|
+
url: 'frontend/api/subot-campaign/check',
|
|
223
|
+
method: 'post',
|
|
224
|
+
data: {
|
|
225
|
+
bot_id,
|
|
226
|
+
email,
|
|
227
|
+
phone: phoneToSend,
|
|
228
|
+
},
|
|
229
|
+
});
|
|
230
|
+
};
|
|
231
|
+
const sendSMSOtpLead = ({ phone, type, }) => {
|
|
232
|
+
return leadApi.call({
|
|
233
|
+
url: type === 'phone' ? 'api/sms/otp' : 'api/sms/whatsapp_otp',
|
|
234
|
+
method: 'post',
|
|
235
|
+
data: {
|
|
236
|
+
// The type Whatsapp do not remove the '+'
|
|
237
|
+
phone_number: type === 'phone' ? phone.replace('+', '') : phone,
|
|
238
|
+
},
|
|
239
|
+
});
|
|
240
|
+
};
|
|
241
|
+
const verifyOtpLead = ({ phone, otp, type, }) => {
|
|
242
|
+
return leadApi.call({
|
|
243
|
+
url: type === 'phone' ? 'api/sms/verify' : 'api/sms/whatsapp_verify',
|
|
244
|
+
method: 'post',
|
|
245
|
+
data: {
|
|
246
|
+
// The type Whatsapp do not remove the '+'
|
|
247
|
+
otp_code: otp,
|
|
248
|
+
phone_number: type === 'phone' ? phone.replace('+', '') : phone,
|
|
249
|
+
},
|
|
250
|
+
});
|
|
251
|
+
};
|
|
252
|
+
const Service = {
|
|
253
|
+
campaignGetById,
|
|
254
|
+
validateEmailOrPhoneOnSubot,
|
|
255
|
+
validateEmailOrPhoneOnLeadGen,
|
|
256
|
+
sendSMSOtpLead,
|
|
257
|
+
verifyOtpLead,
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
const checkUsedEmailOrPhone = (campaignId, campaign_subot_id, data) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
|
|
261
|
+
const key = 'email' in data ? 'email' : 'phone';
|
|
262
|
+
const value = 'email' in data ? data.email : data.phone;
|
|
263
|
+
const errorMsg = 'email' in data ? 'validator.emailUsed' : 'validator.phoneUsed';
|
|
264
|
+
/** Check on Leadgen Tool */
|
|
265
|
+
const resLeadGen = yield Service.validateEmailOrPhoneOnLeadGen({
|
|
266
|
+
campaign_id: [campaignId],
|
|
267
|
+
[key]: value, // Can be email or phone
|
|
268
|
+
});
|
|
269
|
+
if (resLeadGen._errorCode === 'SubmitLeadWithBotId_ERR_001' ||
|
|
270
|
+
resLeadGen._errorCode === 'SubmitLeadWithBotId_ERR_002') {
|
|
271
|
+
return errorMsg;
|
|
272
|
+
}
|
|
273
|
+
/** Check on Subot */
|
|
274
|
+
if (campaign_subot_id.length) {
|
|
275
|
+
const resSubot = yield Service.validateEmailOrPhoneOnSubot({
|
|
276
|
+
bot_id: campaign_subot_id,
|
|
277
|
+
[key]: value, // Can be email or phone
|
|
278
|
+
});
|
|
279
|
+
if (resSubot._errorCode === 'CheckSuBotLeadTool_ERR_001') {
|
|
280
|
+
return errorMsg;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
const validatedCache = {
|
|
285
|
+
email: {},
|
|
286
|
+
phone: {},
|
|
287
|
+
};
|
|
288
|
+
const checkUsedEmailOrPhoneWithCache = (campaignId, campaign_subot_id, data) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
|
|
289
|
+
const key = 'email' in data ? 'email' : 'phone';
|
|
290
|
+
const value = 'email' in data ? data.email : data.phone;
|
|
291
|
+
const errorMsg = 'email' in data ? 'validator.emailUsed' : 'validator.phoneUsed';
|
|
292
|
+
if (validatedCache[key][value]) {
|
|
293
|
+
if (validatedCache[key][value].value) {
|
|
294
|
+
return errorMsg;
|
|
295
|
+
}
|
|
296
|
+
else if (!validatedCache[key][value].value &&
|
|
297
|
+
validatedCache[key][value].expire > Date.now()) {
|
|
298
|
+
return '';
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
const res = yield checkUsedEmailOrPhone(campaignId, campaign_subot_id, data);
|
|
302
|
+
if (res) {
|
|
303
|
+
validatedCache[key][value] = {
|
|
304
|
+
value: true,
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
validatedCache[key][value] = {
|
|
309
|
+
value: false,
|
|
310
|
+
expire: Date.now() + 1000 * 60,
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
return res;
|
|
314
|
+
});
|
|
315
|
+
const clearCacheUsedEmailOrPhone = () => {
|
|
316
|
+
validatedCache.email = {};
|
|
317
|
+
validatedCache.phone = {};
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
// You can give context variables any name
|
|
321
|
+
const [LeadFormProvider$1, useLeadFormContext$1, useLeadForm$1] = form.createFormContext();
|
|
322
|
+
const useLeadFormConfig$1 = ({ listBlockAdded = [], validatingPhoneRef, validatingEmailRef, campaignId, campaign_subot_id = [], }) => {
|
|
323
|
+
const { t } = useTranslations.useTranslations();
|
|
324
|
+
const validateObj = React.useMemo(() => {
|
|
325
|
+
const InputBlocks = [
|
|
326
|
+
'TextBlock',
|
|
327
|
+
'NumberBlock',
|
|
328
|
+
'EmailBlock',
|
|
329
|
+
'PhoneBlock',
|
|
330
|
+
'DateBlock',
|
|
331
|
+
'CheckboxBlock',
|
|
332
|
+
'RadioBlock',
|
|
333
|
+
'DropdownBlock',
|
|
334
|
+
'PhoneOtpBlock',
|
|
335
|
+
'WhatsappOtpBlock',
|
|
336
|
+
'LocationBlock',
|
|
337
|
+
'TncBlock',
|
|
338
|
+
];
|
|
339
|
+
// ALL are required and can skip if not touched yet
|
|
340
|
+
const withSharedCheck = (name, cb) => {
|
|
341
|
+
return (value) => {
|
|
342
|
+
if (!formRef.current.isTouched(name))
|
|
343
|
+
return;
|
|
344
|
+
if (typeof value === 'undefined' ||
|
|
345
|
+
value === '' ||
|
|
346
|
+
(Array.isArray(value) && value.length === 0)) {
|
|
347
|
+
return t('validator.required');
|
|
348
|
+
}
|
|
349
|
+
return cb === null || cb === void 0 ? void 0 : cb(value);
|
|
350
|
+
};
|
|
351
|
+
};
|
|
352
|
+
return listBlockAdded
|
|
353
|
+
.filter((b) => InputBlocks.includes(b.name))
|
|
354
|
+
.reduce((r, b) => {
|
|
355
|
+
if (b.name === 'NumberBlock') {
|
|
356
|
+
return Object.assign(Object.assign({}, r), { [b.data.value]: withSharedCheck(b.data.value, (value) => {
|
|
357
|
+
if (isNaN(Number(value))) {
|
|
358
|
+
return t('validator.number');
|
|
359
|
+
}
|
|
360
|
+
}) });
|
|
361
|
+
}
|
|
362
|
+
else if (b.name === 'EmailBlock') {
|
|
363
|
+
return Object.assign(Object.assign({}, r), { [b.data.value]: withSharedCheck(b.data.value, (value) => {
|
|
364
|
+
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) {
|
|
365
|
+
return t('validator.email');
|
|
366
|
+
}
|
|
367
|
+
validatingEmailRef.current = true;
|
|
368
|
+
setTimeout(() => {
|
|
369
|
+
formRef.current.setFieldError(b.data.value, 'Validating...');
|
|
370
|
+
checkUsedEmailOrPhoneWithCache(campaignId, campaign_subot_id, {
|
|
371
|
+
email: value,
|
|
372
|
+
})
|
|
373
|
+
.then((tKey) => {
|
|
374
|
+
if (tKey) {
|
|
375
|
+
formRef.current.setFieldError(b.data.value, t(tKey));
|
|
376
|
+
}
|
|
377
|
+
else {
|
|
378
|
+
formRef.current.clearFieldError(b.data.value);
|
|
379
|
+
}
|
|
380
|
+
validatingEmailRef.current = false;
|
|
381
|
+
})
|
|
382
|
+
.catch((e) => {
|
|
383
|
+
console.error(e);
|
|
384
|
+
formRef.current.setFieldError(b.data.value, e.message || 'Something went wrong');
|
|
385
|
+
validatingEmailRef.current = false;
|
|
386
|
+
});
|
|
387
|
+
}, 200);
|
|
388
|
+
}) });
|
|
389
|
+
}
|
|
390
|
+
else if (b.name === 'PhoneBlock' ||
|
|
391
|
+
b.name === 'PhoneOtpBlock' ||
|
|
392
|
+
b.name === 'WhatsappOtpBlock') {
|
|
393
|
+
return Object.assign(Object.assign({}, r), { [b.data.value]: withSharedCheck(b.data.value, (value) => {
|
|
394
|
+
if (window.intlTelInputUtils &&
|
|
395
|
+
!window.intlTelInputUtils.isValidNumber(String(value), LEAD_LOCALE.countryCode)) {
|
|
396
|
+
return t('validator.phone');
|
|
397
|
+
}
|
|
398
|
+
validatingPhoneRef.current = true;
|
|
399
|
+
setTimeout(() => {
|
|
400
|
+
formRef.current.setFieldError(b.data.value, 'Validating...');
|
|
401
|
+
checkUsedEmailOrPhoneWithCache(campaignId, campaign_subot_id, {
|
|
402
|
+
phone: value,
|
|
403
|
+
})
|
|
404
|
+
.then((tKey) => {
|
|
405
|
+
if (tKey) {
|
|
406
|
+
formRef.current.setFieldError(b.data.value, t(tKey));
|
|
407
|
+
}
|
|
408
|
+
else {
|
|
409
|
+
formRef.current.clearFieldError(b.data.value);
|
|
410
|
+
}
|
|
411
|
+
validatingPhoneRef.current = false;
|
|
412
|
+
})
|
|
413
|
+
.catch((e) => {
|
|
414
|
+
console.error(e);
|
|
415
|
+
formRef.current.setFieldError(b.data.value, e.message || 'Something went wrong');
|
|
416
|
+
validatingPhoneRef.current = false;
|
|
417
|
+
});
|
|
418
|
+
}, 200);
|
|
419
|
+
}) });
|
|
420
|
+
}
|
|
421
|
+
else if (b.name === 'DateBlock') {
|
|
422
|
+
return Object.assign(Object.assign({}, r), { [b.data.value]: withSharedCheck(b.data.value, (value) => {
|
|
423
|
+
if (isNaN(Date.parse(value))) {
|
|
424
|
+
return t('validator.date');
|
|
425
|
+
}
|
|
426
|
+
}) });
|
|
427
|
+
}
|
|
428
|
+
else if (b.name === 'TncBlock') {
|
|
429
|
+
return Object.assign(Object.assign({}, r), { [`TNC-` + b.id]: withSharedCheck('TNC-' + b.id) });
|
|
430
|
+
}
|
|
431
|
+
else {
|
|
432
|
+
return Object.assign(Object.assign({}, r), { [b.data.value]: withSharedCheck(b.data.value) });
|
|
433
|
+
}
|
|
434
|
+
}, {});
|
|
435
|
+
}, [listBlockAdded.map((b) => b.name).join(',')]);
|
|
436
|
+
const form = useLeadForm$1({
|
|
437
|
+
validateInputOnChange: true,
|
|
438
|
+
clearInputErrorOnChange: true,
|
|
439
|
+
validate: validateObj,
|
|
440
|
+
});
|
|
441
|
+
const formRef = React.useRef(form);
|
|
442
|
+
formRef.current = form;
|
|
443
|
+
return { form, validateObj };
|
|
444
|
+
};
|
|
445
|
+
|
|
446
|
+
const Component = ({ campaign, onClose: onCloseProp, onOtherSubmit, onSubmit, showThankyou, locale, children, }) => {
|
|
447
|
+
var _a, _b;
|
|
448
|
+
const extraFields = campaign.extra_fields;
|
|
449
|
+
const campaignId = campaign.id;
|
|
450
|
+
const campaign_subot_id = campaign.bot_id || [];
|
|
451
|
+
const listBlockAdded = JSON.parse(extraFields.listBlockAdded);
|
|
452
|
+
const actionBlocks = JSON.parse(extraFields.actionBlocks);
|
|
453
|
+
const textBlocks = JSON.parse(extraFields.textBlocks);
|
|
454
|
+
const heading = ((_b = (_a = textBlocks === null || textBlocks === void 0 ? void 0 : textBlocks.titleBlock) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.value) || '';
|
|
455
|
+
const description = textBlocks.subtitleBlock.data.value;
|
|
456
|
+
const validatingPhoneRef = React.useRef(false);
|
|
457
|
+
const validatingEmailRef = React.useRef(false);
|
|
458
|
+
const leadFormConfig = useLeadFormConfig$1({
|
|
459
|
+
listBlockAdded,
|
|
460
|
+
validatingPhoneRef,
|
|
461
|
+
validatingEmailRef,
|
|
462
|
+
campaignId,
|
|
463
|
+
campaign_subot_id,
|
|
464
|
+
});
|
|
465
|
+
const [showOtpPhone, setShowOtpPhone] = React.useState(null);
|
|
466
|
+
const formRef = React.useRef();
|
|
467
|
+
const onClose = () => {
|
|
468
|
+
if (showOtpPhone) {
|
|
469
|
+
setShowOtpPhone(null);
|
|
470
|
+
}
|
|
471
|
+
else {
|
|
472
|
+
onCloseProp === null || onCloseProp === void 0 ? void 0 : onCloseProp();
|
|
473
|
+
}
|
|
474
|
+
};
|
|
475
|
+
React.useEffect(() => {
|
|
476
|
+
if (!window.intlTelInputUtils) {
|
|
477
|
+
require('intl-tel-input/build/js/utils');
|
|
478
|
+
}
|
|
479
|
+
clearCacheUsedEmailOrPhone();
|
|
480
|
+
}, []);
|
|
481
|
+
return campaign ? (React__default["default"].createElement(LeadGenComponentContext.Provider, { value: {
|
|
482
|
+
campaignId,
|
|
483
|
+
campaign_subot_id,
|
|
484
|
+
heading,
|
|
485
|
+
description,
|
|
486
|
+
listBlockAdded,
|
|
487
|
+
textBlocks,
|
|
488
|
+
actionBlocks,
|
|
489
|
+
leadFormConfig,
|
|
490
|
+
validatingEmailRef,
|
|
491
|
+
validatingPhoneRef,
|
|
492
|
+
formRef,
|
|
493
|
+
locale,
|
|
494
|
+
onClose,
|
|
495
|
+
onOtherSubmit,
|
|
496
|
+
showOtpPhone,
|
|
497
|
+
setShowOtpPhone,
|
|
498
|
+
onSubmit,
|
|
499
|
+
showThankyou,
|
|
500
|
+
} }, children)) : null;
|
|
501
|
+
};
|
|
502
|
+
|
|
503
|
+
const Description = (_a) => {
|
|
504
|
+
var rest = tslib_es6.__rest(_a, []);
|
|
505
|
+
const { description } = React.useContext(LeadGenComponentContext);
|
|
506
|
+
return description ? (React__default["default"].createElement(index.Text, Object.assign({ size: "p3" }, rest), description)) : null;
|
|
507
|
+
};
|
|
508
|
+
|
|
509
|
+
var useStyles$2 = core.createStyles(() => {
|
|
510
|
+
return {
|
|
511
|
+
control: {},
|
|
512
|
+
};
|
|
513
|
+
});
|
|
514
|
+
|
|
515
|
+
const libraries$1 = ['places'];
|
|
516
|
+
const LocationBlock$1 = ({ name, placeholder, locale, }) => {
|
|
517
|
+
var _a;
|
|
518
|
+
const form = useLeadFormContext$1();
|
|
519
|
+
const [searchValue, setSearchValue] = React.useState('');
|
|
520
|
+
const [address, setAddress] = React.useState('');
|
|
521
|
+
const { predictions } = usePlacesAutocomplete.usePlacesAutocomplete(searchValue, '', locale === 'tl-PH' ? 'en' : (_a = locale === null || locale === void 0 ? void 0 : locale.split('-')) === null || _a === void 0 ? void 0 : _a[0]);
|
|
522
|
+
const [LoadScript, setLoadScript] = React.useState(null);
|
|
523
|
+
const [ready, setReady] = React.useState(false);
|
|
524
|
+
const randRef = React.useRef(Math.random().toString(36).substring(7));
|
|
525
|
+
const options = React.useMemo(() => {
|
|
526
|
+
const _opts = predictions.map((p) => {
|
|
527
|
+
return {
|
|
528
|
+
value: p.description,
|
|
529
|
+
label: p.description,
|
|
530
|
+
};
|
|
531
|
+
});
|
|
532
|
+
const isExist = _opts.find((o) => o.value === address);
|
|
533
|
+
if (!address || isExist) {
|
|
534
|
+
return _opts;
|
|
535
|
+
}
|
|
536
|
+
return [{ value: address, label: address }].concat(_opts);
|
|
537
|
+
}, [predictions, address]);
|
|
538
|
+
React.useEffect(() => {
|
|
539
|
+
var _a, _b, _c;
|
|
540
|
+
// only load extra google script when not yet loaded
|
|
541
|
+
if (!((_c = (_b = (_a = window === null || window === void 0 ? void 0 : window.google) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.places) === null || _c === void 0 ? void 0 : _c.AutocompleteService)) {
|
|
542
|
+
Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@react-google-maps/api')); }).then((m) => {
|
|
543
|
+
setLoadScript(() => m.LoadScript);
|
|
544
|
+
setTimeout(() => {
|
|
545
|
+
setReady(true);
|
|
546
|
+
}, 200);
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
else {
|
|
550
|
+
setReady(true);
|
|
551
|
+
}
|
|
552
|
+
}, []);
|
|
553
|
+
if (!ready)
|
|
554
|
+
return (React__default["default"].createElement("div", { style: {
|
|
555
|
+
height: 73,
|
|
556
|
+
} }));
|
|
557
|
+
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
558
|
+
LoadScript && (React__default["default"].createElement(LoadScript, { googleMapsApiKey: usePlacesAutocomplete.GOOGLE_API_KEY, libraries: libraries$1, loadingElement: React__default["default"].createElement(React__default["default"].Fragment, null) })),
|
|
559
|
+
React__default["default"].createElement("div", { style: { display: 'none' }, "data-extra": true, "data-name": name, "data-control": 'text' }),
|
|
560
|
+
React__default["default"].createElement(index$1.Select, Object.assign({ className: "lead-modal__form-control", label: placeholder, placeholder: placeholder, withAsterisk: true, name: name, data: options, searchValue: searchValue, onSearchChange: (query) => {
|
|
561
|
+
setSearchValue(query);
|
|
562
|
+
}, filter: () => true, clearable: true, searchable: true, onChange: (val) => setAddress(val || ''), icon: React__default["default"].createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none" },
|
|
563
|
+
React__default["default"].createElement("path", { d: "M10 9.792q.605 0 1.032-.427.426-.428.426-1.032 0-.603-.426-1.031A1.4 1.4 0 0 0 10 6.875q-.604 0-1.032.427a1.4 1.4 0 0 0-.426 1.031q0 .604.426 1.032.428.426 1.032.427m0 8.083q-.145 0-.292-.042a.7.7 0 0 1-.27-.145Q6.478 15 5.01 12.708 3.54 10.418 3.54 8.5q0-3.021 1.949-4.823T10 1.875t4.51 1.802q1.95 1.802 1.949 4.823 0 1.917-1.468 4.208-1.47 2.292-4.427 4.98a.7.7 0 0 1-.271.145 1 1 0 0 1-.292.042", fill: "#8C8C8C" })), autoComplete: 'no-auto-complete-' + randRef.current, rightSection: React__default["default"].createElement(React__default["default"].Fragment, null) }, form.getInputProps(name)))));
|
|
564
|
+
};
|
|
565
|
+
|
|
566
|
+
const SubtitleBlock$1 = ({ children, align, }) => (React__default["default"].createElement("p", { className: `lead-modal__description ${'le-text-align-' + (align || '')} ${LEAD_CLASS}` }, children));
|
|
567
|
+
|
|
568
|
+
const TitleBlock$1 = ({ children, align, }) => (React__default["default"].createElement("h2", { className: `lead-modal__title ${'le-text-align-' + (align || '')} ${LEAD_CLASS}` }, children));
|
|
569
|
+
|
|
570
|
+
const Fields = ({ listBlockAdded, popupId, locale, onClose, onOtherSubmit, styles, classNames, }) => {
|
|
571
|
+
const { classes, cx } = useStyles$2(undefined, {
|
|
572
|
+
name: 'LeadGen__Field',
|
|
573
|
+
styles,
|
|
574
|
+
classNames,
|
|
575
|
+
});
|
|
576
|
+
const form = useLeadFormContext$1();
|
|
577
|
+
return (React__default["default"].createElement(React__default["default"].Fragment, null, listBlockAdded.map((b, index) => {
|
|
578
|
+
const { name = '', data = {} } = b || {};
|
|
579
|
+
const { placeholder, value, align, listQuestion, isSendMailChimp = false, newtab, url, } = data;
|
|
580
|
+
switch (name) {
|
|
581
|
+
case 'TitleBlock':
|
|
582
|
+
return (React__default["default"].createElement(TitleBlock$1, { key: index, align: align }, value));
|
|
583
|
+
case 'SubtitleBlock':
|
|
584
|
+
return (React__default["default"].createElement(SubtitleBlock$1, { key: index, align: align }, value));
|
|
585
|
+
case 'TextBlock':
|
|
586
|
+
return (React__default["default"].createElement(index$1.Input, Object.assign({ key: index, withAsterisk: true, spellCheck: false, type: "text", placeholder: placeholder, className: cx('leadgen-control', classes.control),
|
|
587
|
+
// onChangeRaw={(e) => inputOnChange('text', e)}
|
|
588
|
+
label: placeholder, "data-control": "text", name: value }, form.getInputProps(value))));
|
|
589
|
+
case 'NumberBlock':
|
|
590
|
+
return (React__default["default"].createElement(index$1.NumberInput, Object.assign({ key: index, withAsterisk: true, spellCheck: false, type: "number", placeholder: placeholder, className: cx('leadgen-control', classes.control),
|
|
591
|
+
// onChange={(e) => inputOnChange('number', e)}
|
|
592
|
+
label: placeholder, "data-control": "number", name: value }, form.getInputProps(value))));
|
|
593
|
+
case 'EmailBlock':
|
|
594
|
+
return (React__default["default"].createElement(index$1.Input, Object.assign({ key: index, withAsterisk: true, spellCheck: false,
|
|
595
|
+
// type="email"
|
|
596
|
+
placeholder: placeholder, className: cx('leadgen-control', classes.control), label: placeholder, "data-control": "email", name: value }, form.getInputProps(value))));
|
|
597
|
+
case 'PhoneOtpBlock':
|
|
598
|
+
case 'WhatsappOtpBlock':
|
|
599
|
+
case 'PhoneBlock': {
|
|
600
|
+
const id = popupId + '-' + value + '-' + index;
|
|
601
|
+
return (React__default["default"].createElement(index$1.Input.Wrapper, Object.assign({ size: "md", withAsterisk: true, key: index, label: placeholder,
|
|
602
|
+
// error={errorField.phone}
|
|
603
|
+
className: cx('leadgen-control', classes.control), labelProps: {
|
|
604
|
+
htmlFor: id,
|
|
605
|
+
} }, form.getInputProps(value)),
|
|
606
|
+
React__default["default"].createElement(index$1.Phone, { name: value, spellCheck: false, type: "tel", placeholder: placeholder, onChange: (v) => {
|
|
607
|
+
form.setFieldValue(value, v);
|
|
608
|
+
},
|
|
609
|
+
// onBlur={(e) => inputOnBlur('tel', e)}
|
|
610
|
+
id: id, defaultCountry: (locale ? utils.MAPPED_LOCALE[locale] || 'VN' : 'VN'), "data-control": "tel" })));
|
|
611
|
+
}
|
|
612
|
+
case 'LocationBlock': {
|
|
613
|
+
return (React__default["default"].createElement(LocationBlock$1, { key: index, name: value, placeholder: placeholder, locale: locale }));
|
|
614
|
+
}
|
|
615
|
+
case 'DateBlock':
|
|
616
|
+
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
617
|
+
React__default["default"].createElement(index$3.DatePicker, Object.assign({ withAsterisk: true, key: index, type: "default", name: value, placeholder: placeholder, className: cx('leadgen-control', classes.control), label: placeholder, "data-control": "date" }, form.getInputProps(value))),
|
|
618
|
+
React__default["default"].createElement("input", { type: "hidden", name: value, "data-control": "date" })));
|
|
619
|
+
case 'LinkButtonBlock':
|
|
620
|
+
return (React__default["default"].createElement("div", { key: index },
|
|
621
|
+
React__default["default"].createElement("a", { target: newtab ? 'blank' : 'parrent', href: url, style: { textDecoration: 'none' } },
|
|
622
|
+
React__default["default"].createElement(index$2.Button, { type: "button", size: "md", className: `lead-modal__btn ${LEAD_CLASS}`, onClick: () => {
|
|
623
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
624
|
+
onOtherSubmit === null || onOtherSubmit === void 0 ? void 0 : onOtherSubmit();
|
|
625
|
+
} }, value))));
|
|
626
|
+
case 'CheckboxBlock':
|
|
627
|
+
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
628
|
+
isSendMailChimp && (React__default["default"].createElement("div", { style: {
|
|
629
|
+
display: 'none',
|
|
630
|
+
}, "data-name": value + '-mailchimp' })),
|
|
631
|
+
React__default["default"].createElement(index$1.Checkbox.Group, Object.assign({ withAsterisk: true, className: cx('leadgen-control', classes.control), key: index, label: placeholder, size: "md", sx: {
|
|
632
|
+
display: 'flex',
|
|
633
|
+
flexDirection: 'column',
|
|
634
|
+
gap: 8,
|
|
635
|
+
} }, form.getInputProps(value)), listQuestion.map((l, _index) => (React__default["default"].createElement(index$1.Checkbox, { name: value, key: _index, value: l.value, label: l.placeholder, "data-control": "checkbox" }))))));
|
|
636
|
+
case 'RadioBlock':
|
|
637
|
+
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
638
|
+
isSendMailChimp && (React__default["default"].createElement(index$1.Input, { type: "hidden", name: value + '-mailchimp', value: isSendMailChimp })),
|
|
639
|
+
React__default["default"].createElement(index$1.Radio.Group, Object.assign({ withAsterisk: true, className: cx('leadgen-control', classes.control), key: index, label: placeholder, size: "md" }, form.getInputProps(value)), listQuestion.map((l, _index) => (React__default["default"].createElement(index$1.Radio, { name: value, key: _index, value: l.value, label: l.placeholder, "data-control": "radio" }))))));
|
|
640
|
+
case 'DropdownBlock':
|
|
641
|
+
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
642
|
+
React__default["default"].createElement("div", { style: { display: 'none' }, "data-extra": true, "data-name": value, "data-control": 'dropdown' }),
|
|
643
|
+
React__default["default"].createElement(index$1.Select, Object.assign({ key: index, className: cx('leadgen-control', classes.control), label: placeholder, withAsterisk: true, name: value, data: listQuestion.map((l) => ({
|
|
644
|
+
value: l.value,
|
|
645
|
+
label: l.placeholder,
|
|
646
|
+
})) }, form.getInputProps(value)))));
|
|
647
|
+
case 'TncBlock':
|
|
648
|
+
const tncInputProps = form.getInputProps('TNC-' + b.id);
|
|
649
|
+
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
650
|
+
React__default["default"].createElement(index$1.Checkbox, Object.assign({ name: 'TNC-' + b.id, key: b.id, label: React__default["default"].createElement("p", { className: "lead-modal__tnc-link", dangerouslySetInnerHTML: { __html: data.valueHTML } }), className: "tnc-block", "data-control": "checkbox" }, tncInputProps, { error: tncInputProps.error ? React__default["default"].createElement(React__default["default"].Fragment, null) : undefined }))));
|
|
651
|
+
}
|
|
652
|
+
return null;
|
|
653
|
+
})));
|
|
654
|
+
};
|
|
655
|
+
|
|
656
|
+
var useStyles$1 = core.createStyles(() => {
|
|
657
|
+
return {
|
|
658
|
+
root: {},
|
|
659
|
+
header: {},
|
|
660
|
+
heading: {},
|
|
661
|
+
description: {},
|
|
662
|
+
term: {},
|
|
663
|
+
controlList: {},
|
|
664
|
+
control: {},
|
|
665
|
+
submitBtn: {},
|
|
666
|
+
};
|
|
667
|
+
});
|
|
668
|
+
|
|
669
|
+
const Heading = (_a) => {
|
|
670
|
+
var rest = tslib_es6.__rest(_a, []);
|
|
671
|
+
const { heading } = React.useContext(LeadGenComponentContext);
|
|
672
|
+
return heading ? (React__default["default"].createElement(index.Text, Object.assign({ size: "h3" }, rest), heading)) : null;
|
|
673
|
+
};
|
|
674
|
+
|
|
675
|
+
const FormComponent = ({ styles, className, classNames }) => {
|
|
676
|
+
var _a;
|
|
677
|
+
const { listBlockAdded, leadFormConfig: { form, validateObj }, validatingEmailRef, validatingPhoneRef, formRef, onClose, onOtherSubmit, actionBlocks, locale, setShowOtpPhone, onSubmit, } = React.useContext(LeadGenComponentContext);
|
|
678
|
+
const { classes, cx } = useStyles$1(undefined, {
|
|
679
|
+
name: 'LeadGen__FormComponent',
|
|
680
|
+
styles,
|
|
681
|
+
classNames,
|
|
682
|
+
});
|
|
683
|
+
const [checkedTerm, setCheckedTerm] = React.useState(true);
|
|
684
|
+
const [isSubmitLoading, setIsSubmitLoading] = React.useState(false);
|
|
685
|
+
const popUpTermURL = actionBlocks.submitBlock.data.url;
|
|
686
|
+
const popUpTermAgreeText = actionBlocks.submitBlock.data.text;
|
|
687
|
+
const popUpTermText = actionBlocks.submitBlock.data.text2;
|
|
688
|
+
const popUpSubmitText = actionBlocks.submitBlock.data.value;
|
|
689
|
+
const middlewareOnSubmit = (e) => {
|
|
690
|
+
e.preventDefault();
|
|
691
|
+
// mark all as touched to allow validation
|
|
692
|
+
form.setTouched(Object.keys(validateObj).reduce((acc, cur) => {
|
|
693
|
+
acc[cur] = true;
|
|
694
|
+
return acc;
|
|
695
|
+
}, {}));
|
|
696
|
+
if (validatingEmailRef.current || validatingPhoneRef.current) {
|
|
697
|
+
return;
|
|
698
|
+
}
|
|
699
|
+
setTimeout(() => {
|
|
700
|
+
form.onSubmit((v) => {
|
|
701
|
+
var _a, _b, _c, _d, _e, _f;
|
|
702
|
+
if (Object.keys(form.errors).length)
|
|
703
|
+
return;
|
|
704
|
+
let newShowOtpPhone = null;
|
|
705
|
+
if (listBlockAdded.findIndex((x) => x.name === 'PhoneOtpBlock') > -1) {
|
|
706
|
+
// not submit yet, open otp
|
|
707
|
+
const fieldName = (_b = (_a = listBlockAdded.find((x) => x.name === 'PhoneOtpBlock')) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.value;
|
|
708
|
+
if ((_c = v[fieldName]) === null || _c === void 0 ? void 0 : _c.startsWith('+')) {
|
|
709
|
+
newShowOtpPhone = {
|
|
710
|
+
phone: v[fieldName],
|
|
711
|
+
type: 'phone',
|
|
712
|
+
};
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
if (listBlockAdded.findIndex((x) => x.name === 'WhatsappOtpBlock') > -1) {
|
|
716
|
+
// not submit yet, open otp
|
|
717
|
+
const fieldName = (_e = (_d = listBlockAdded.find((x) => x.name === 'WhatsappOtpBlock')) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.value;
|
|
718
|
+
if ((_f = v[fieldName]) === null || _f === void 0 ? void 0 : _f.startsWith('+')) {
|
|
719
|
+
newShowOtpPhone = {
|
|
720
|
+
phone: v[fieldName],
|
|
721
|
+
type: 'whatsapp',
|
|
722
|
+
};
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
if (newShowOtpPhone) {
|
|
726
|
+
setIsSubmitLoading(true);
|
|
727
|
+
Service.sendSMSOtpLead(newShowOtpPhone)
|
|
728
|
+
.then((res) => {
|
|
729
|
+
var _a;
|
|
730
|
+
const respMessage = (_a = res === null || res === void 0 ? void 0 : res._messages) === null || _a === void 0 ? void 0 : _a[0];
|
|
731
|
+
if (respMessage === 'This phone number was verified') {
|
|
732
|
+
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(formRef.current, v);
|
|
733
|
+
return;
|
|
734
|
+
}
|
|
735
|
+
setShowOtpPhone(newShowOtpPhone);
|
|
736
|
+
})
|
|
737
|
+
.finally(() => {
|
|
738
|
+
setIsSubmitLoading(false);
|
|
739
|
+
});
|
|
740
|
+
return;
|
|
741
|
+
}
|
|
742
|
+
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(formRef.current, v);
|
|
743
|
+
})(e);
|
|
744
|
+
}, 100);
|
|
745
|
+
};
|
|
746
|
+
return (React__default["default"].createElement(LeadFormProvider$1, { form: form },
|
|
747
|
+
React__default["default"].createElement(core.Box, { component: "form", ref: formRef, className: cx(className, classes.root), onSubmit: middlewareOnSubmit, styles: styles },
|
|
748
|
+
React__default["default"].createElement("div", { className: classes.header },
|
|
749
|
+
React__default["default"].createElement(Heading, { className: classes.heading }),
|
|
750
|
+
React__default["default"].createElement(Description, { className: classes.description })),
|
|
751
|
+
React__default["default"].createElement("div", { className: classes.controlList },
|
|
752
|
+
React__default["default"].createElement(Fields, { classNames: {
|
|
753
|
+
control: classes.control,
|
|
754
|
+
}, listBlockAdded: listBlockAdded, locale: locale, onClose: onClose, onOtherSubmit: onOtherSubmit })),
|
|
755
|
+
((_a = actionBlocks === null || actionBlocks === void 0 ? void 0 : actionBlocks.submitBlock) === null || _a === void 0 ? void 0 : _a.isHide) ? null : (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
756
|
+
React__default["default"].createElement("div", { className: classes.term },
|
|
757
|
+
React__default["default"].createElement("div", { className: "lead-modal__checkbox" },
|
|
758
|
+
React__default["default"].createElement("input", { id: "lead-term-checkbox", className: `lead-modal__checkbox__input ${LEAD_CLASS}`, type: "checkbox", "aria-label": "Checkbox label", checked: checkedTerm, onChange: (e) => setCheckedTerm(e.currentTarget.checked) }),
|
|
759
|
+
React__default["default"].createElement("div", { className: "lead-modal__checkbox__control", "aria-hidden": "true" })),
|
|
760
|
+
React__default["default"].createElement("label", { htmlFor: "checkbox", className: "lead-modal__checkbox__label" },
|
|
761
|
+
popUpTermAgreeText,
|
|
762
|
+
' ',
|
|
763
|
+
React__default["default"].createElement("span", { style: { fontWeight: 'bold' } },
|
|
764
|
+
React__default["default"].createElement("a", { target: "blank", href: popUpTermURL || 'https://hellobacsi.com/chinh-sach', rel: "noopener noreferrer", style: { textDecoration: 'none' } }, popUpTermText)))),
|
|
765
|
+
React__default["default"].createElement(index$1.Button, { size: "md", id: "lead-submit", type: "submit", className: classes.submitBtn, disabled: !checkedTerm, loading: isSubmitLoading }, popUpSubmitText))))));
|
|
766
|
+
};
|
|
767
|
+
const Form = (props) => {
|
|
768
|
+
const { showOtpPhone, showThankyou } = React.useContext(LeadGenComponentContext);
|
|
769
|
+
return showThankyou || showOtpPhone ? null : React__default["default"].createElement(FormComponent, Object.assign({}, props));
|
|
770
|
+
};
|
|
771
|
+
|
|
772
|
+
var useStyles = core.createStyles(() => {
|
|
773
|
+
return {
|
|
774
|
+
root: {},
|
|
775
|
+
heading: {},
|
|
776
|
+
description: {},
|
|
777
|
+
control: {},
|
|
778
|
+
submitBtn: {},
|
|
779
|
+
resendOtp: {},
|
|
780
|
+
};
|
|
781
|
+
});
|
|
782
|
+
|
|
783
|
+
const OtpBlockComponent = ({ otpData, onSuccess, autoSendWhenOpen, className, styles, classNames, }) => {
|
|
784
|
+
const { t } = useTranslations.useTranslations();
|
|
785
|
+
const phone = otpData.phone;
|
|
786
|
+
const otpType = otpData.type;
|
|
787
|
+
const [otp, setOtp] = React.useState('');
|
|
788
|
+
const [isDirty, setIsDirty] = React.useState(false);
|
|
789
|
+
const [resendTimer, setResendTimer] = React.useState(autoSendWhenOpen ? 0 : 60);
|
|
790
|
+
const inputRef = React.useRef(null);
|
|
791
|
+
const [errorMsg, setErrorMsg] = React.useState();
|
|
792
|
+
const [displayPhone, setDisplayPhone] = React.useState('');
|
|
793
|
+
const formatPhoneNumberIntlRef = React.useRef();
|
|
794
|
+
const [isSubmitLoading, setIsSubmitLoading] = React.useState(false);
|
|
795
|
+
const { classes, cx } = useStyles(undefined, {
|
|
796
|
+
name: 'LeadGen__OTP',
|
|
797
|
+
styles,
|
|
798
|
+
classNames,
|
|
799
|
+
});
|
|
800
|
+
React.useEffect(() => {
|
|
801
|
+
(() => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
|
|
802
|
+
var _a;
|
|
803
|
+
if (!formatPhoneNumberIntlRef.current) {
|
|
804
|
+
const res = yield Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('react-phone-number-input')); });
|
|
805
|
+
formatPhoneNumberIntlRef.current = res.formatPhoneNumberIntl;
|
|
806
|
+
}
|
|
807
|
+
setDisplayPhone(((_a = formatPhoneNumberIntlRef.current) === null || _a === void 0 ? void 0 : _a.call(formatPhoneNumberIntlRef, phone)) || phone);
|
|
808
|
+
}))();
|
|
809
|
+
}, [phone]);
|
|
810
|
+
const sendOtp = () => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
|
|
811
|
+
var _a;
|
|
812
|
+
if (!phone) {
|
|
813
|
+
return;
|
|
814
|
+
}
|
|
815
|
+
const res = yield Service.sendSMSOtpLead({
|
|
816
|
+
phone,
|
|
817
|
+
type: otpType,
|
|
818
|
+
});
|
|
819
|
+
const respMessage = (_a = res === null || res === void 0 ? void 0 : res._messages) === null || _a === void 0 ? void 0 : _a[0];
|
|
820
|
+
if (respMessage === 'Send sms successfully' ||
|
|
821
|
+
respMessage === 'Send WhatsApp successfully') {
|
|
822
|
+
setResendTimer(60);
|
|
823
|
+
setTimeout(() => {
|
|
824
|
+
if (inputRef.current) {
|
|
825
|
+
inputRef.current.focus();
|
|
826
|
+
inputRef.current.scrollIntoView({ block: 'center' });
|
|
827
|
+
}
|
|
828
|
+
}, 100);
|
|
829
|
+
}
|
|
830
|
+
else if (respMessage === 'This phone number was verified') {
|
|
831
|
+
onSuccess();
|
|
832
|
+
}
|
|
833
|
+
else {
|
|
834
|
+
setErrorMsg(respMessage || 'Something went wrong!');
|
|
835
|
+
// const defaultError = f({ id: 'notification.comment.somethingWrong' })
|
|
836
|
+
// setStatusVerifyOTP('idle')
|
|
837
|
+
// pushNotifications({
|
|
838
|
+
// title: respMessage || defaultError,
|
|
839
|
+
// message: '',
|
|
840
|
+
// type: 'danger',
|
|
841
|
+
// })
|
|
842
|
+
}
|
|
843
|
+
});
|
|
844
|
+
const submitOtp = () => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
|
|
845
|
+
if (!phone || !otp) {
|
|
846
|
+
return;
|
|
847
|
+
}
|
|
848
|
+
setIsSubmitLoading(true);
|
|
849
|
+
const res = yield Service.verifyOtpLead({
|
|
850
|
+
phone,
|
|
851
|
+
otp,
|
|
852
|
+
type: otpType,
|
|
853
|
+
});
|
|
854
|
+
const respMessage = res === null || res === void 0 ? void 0 : res._messages[0];
|
|
855
|
+
if (respMessage === 'Verify successfully' ||
|
|
856
|
+
respMessage === 'Verify WhatsApp OTP sucess') {
|
|
857
|
+
onSuccess();
|
|
858
|
+
}
|
|
859
|
+
else if (respMessage === 'This phone number was verified') {
|
|
860
|
+
onSuccess();
|
|
861
|
+
}
|
|
862
|
+
else {
|
|
863
|
+
setErrorMsg(respMessage || 'something Wrong');
|
|
864
|
+
// setIsShowError(true)
|
|
865
|
+
// setStatusVerifyOTP('sent')
|
|
866
|
+
// pushNotifications({
|
|
867
|
+
// title: res?._messages[0] || defaultError,
|
|
868
|
+
// message: '',
|
|
869
|
+
// type: 'danger',
|
|
870
|
+
// })
|
|
871
|
+
}
|
|
872
|
+
setIsSubmitLoading(false);
|
|
873
|
+
});
|
|
874
|
+
React.useEffect(() => {
|
|
875
|
+
setTimeout(() => {
|
|
876
|
+
if (resendTimer > 0) {
|
|
877
|
+
setResendTimer((r) => r - 1);
|
|
878
|
+
}
|
|
879
|
+
}, 1000);
|
|
880
|
+
}, [resendTimer]);
|
|
881
|
+
React.useEffect(() => {
|
|
882
|
+
if (autoSendWhenOpen && !resendTimer) {
|
|
883
|
+
sendOtp();
|
|
884
|
+
}
|
|
885
|
+
}, []);
|
|
886
|
+
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
887
|
+
React__default["default"].createElement(core.Box, { component: "form", onSubmit: (e) => {
|
|
888
|
+
e.preventDefault();
|
|
889
|
+
submitOtp();
|
|
890
|
+
}, className: cx(classes.root, className) },
|
|
891
|
+
React__default["default"].createElement(index$4.Heading, { tag: "h3", className: classes.heading }, t('lead.otp.title')),
|
|
892
|
+
React__default["default"].createElement(index.Text, { size: "p1", className: classes.description }, t('lead.otp.desc', { phone: displayPhone })),
|
|
893
|
+
React__default["default"].createElement(index$1.Input, { ref: inputRef, name: '_' + name + '-otp', spellCheck: false, type: "number", placeholder: "Enter OTP", className: classes.control, label: "Phone OTP", "data-control": "otp", withAsterisk: true, pattern: "[0-9]*", value: otp, maxLength: 6, onChange: (v) => {
|
|
894
|
+
setIsDirty(true);
|
|
895
|
+
setOtp(v);
|
|
896
|
+
if (isDirty && !v)
|
|
897
|
+
setErrorMsg('OTP is required');
|
|
898
|
+
else
|
|
899
|
+
setErrorMsg(undefined);
|
|
900
|
+
}, error: isDirty ? errorMsg : undefined }),
|
|
901
|
+
React__default["default"].createElement(index$1.Button, { type: "submit", size: "md", color: "primary", className: classes.submitBtn,
|
|
902
|
+
// onClick={() => submitOtp()}
|
|
903
|
+
disabled: !otp, loading: isSubmitLoading }, t('lead.otp.verify')),
|
|
904
|
+
React__default["default"].createElement(index$1.Button, { type: "button", size: "md", color: "transparent", className: classes.resendOtp, onClick: () => {
|
|
905
|
+
sendOtp();
|
|
906
|
+
}, disabled: !!resendTimer }, t('lead.otp.resend', {
|
|
907
|
+
timer: resendTimer ? ` (${resendTimer}s)` : '',
|
|
908
|
+
})))));
|
|
909
|
+
};
|
|
910
|
+
const OtpBlock$1 = ({}) => {
|
|
911
|
+
const { showOtpPhone, setShowOtpPhone, onSubmit, formRef, leadFormConfig: { form }, } = React.useContext(LeadGenComponentContext);
|
|
912
|
+
return showOtpPhone ? (React__default["default"].createElement(OtpBlockComponent, { otpData: showOtpPhone, autoSendWhenOpen: false, onSuccess: () => {
|
|
913
|
+
setShowOtpPhone(null);
|
|
914
|
+
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(formRef.current, form.values);
|
|
915
|
+
} })) : null;
|
|
916
|
+
};
|
|
917
|
+
|
|
918
|
+
const Thankyou = ({ children, }) => {
|
|
919
|
+
const { showThankyou } = React.useContext(LeadGenComponentContext);
|
|
920
|
+
return showThankyou ? typeof children(showThankyou) : null;
|
|
156
921
|
};
|
|
157
922
|
|
|
158
923
|
var enPH = {
|
|
@@ -455,165 +1220,6 @@ const FloatingLayout = ({ popupId, url, title, urlText, titleAlign, subtitle, su
|
|
|
455
1220
|
React__default["default"].createElement(CloseButton, { onClose: onClose, containerClassName: "close-button-top-right" }))))));
|
|
456
1221
|
};
|
|
457
1222
|
|
|
458
|
-
class Store {
|
|
459
|
-
constructor() {
|
|
460
|
-
this.apiLeadUrl = 'https://dev.leadgen.hellobacsi.com/';
|
|
461
|
-
this.apiSubotUrl = 'https://staging-service-subot.hellohealthgroup.com/';
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
const leadStore = new Store();
|
|
465
|
-
|
|
466
|
-
const leadApi = {
|
|
467
|
-
call(_a) {
|
|
468
|
-
var { url, data = undefined } = _a, config = tslib_es6.__rest(_a, ["url", "data"]);
|
|
469
|
-
config.body = JSON.stringify(data);
|
|
470
|
-
config.headers = {
|
|
471
|
-
'Content-Type': 'application/json',
|
|
472
|
-
};
|
|
473
|
-
return fetch(`${leadStore.apiLeadUrl}${url}`, config)
|
|
474
|
-
.then((res) => res.json())
|
|
475
|
-
.catch(() => ({}));
|
|
476
|
-
},
|
|
477
|
-
};
|
|
478
|
-
const subotApi = {
|
|
479
|
-
call(_a) {
|
|
480
|
-
var { url, data } = _a, config = tslib_es6.__rest(_a, ["url", "data"]);
|
|
481
|
-
config.body = JSON.stringify(data);
|
|
482
|
-
config.headers = {
|
|
483
|
-
'Content-Type': 'application/json',
|
|
484
|
-
};
|
|
485
|
-
return fetch(`${leadStore.apiSubotUrl}${url}`, config)
|
|
486
|
-
.then((res) => res.json())
|
|
487
|
-
.catch(() => ({}));
|
|
488
|
-
},
|
|
489
|
-
};
|
|
490
|
-
const campaignGetById = (id) => {
|
|
491
|
-
return leadApi.call({
|
|
492
|
-
url: `api/internal/campaign/${id}`,
|
|
493
|
-
method: 'get',
|
|
494
|
-
});
|
|
495
|
-
};
|
|
496
|
-
const validateEmailOrPhoneOnLeadGen = ({ campaign_id, email, phone, }) => {
|
|
497
|
-
let phoneToSend = phone;
|
|
498
|
-
// Remove the '0' part. Logic from Back to check between Subot and Lead with different format
|
|
499
|
-
if (phoneToSend && phoneToSend.startsWith('0')) {
|
|
500
|
-
phoneToSend = phoneToSend.substring(1);
|
|
501
|
-
}
|
|
502
|
-
return leadApi.call({
|
|
503
|
-
url: 'api/subot-campaign/check',
|
|
504
|
-
method: 'post',
|
|
505
|
-
data: {
|
|
506
|
-
campaign_id,
|
|
507
|
-
email,
|
|
508
|
-
phone: phoneToSend,
|
|
509
|
-
},
|
|
510
|
-
});
|
|
511
|
-
};
|
|
512
|
-
const validateEmailOrPhoneOnSubot = ({ bot_id, email, phone, }) => {
|
|
513
|
-
let phoneToSend = phone;
|
|
514
|
-
// Remove the '0' part. Logic from Back to check between Subot and Lead with different format
|
|
515
|
-
if (phoneToSend && phoneToSend.startsWith('0')) {
|
|
516
|
-
phoneToSend = phoneToSend.substring(1);
|
|
517
|
-
}
|
|
518
|
-
return subotApi.call({
|
|
519
|
-
url: 'frontend/api/subot-campaign/check',
|
|
520
|
-
method: 'post',
|
|
521
|
-
data: {
|
|
522
|
-
bot_id,
|
|
523
|
-
email,
|
|
524
|
-
phone: phoneToSend,
|
|
525
|
-
},
|
|
526
|
-
});
|
|
527
|
-
};
|
|
528
|
-
const sendSMSOtpLead = ({ phone, type, }) => {
|
|
529
|
-
return leadApi.call({
|
|
530
|
-
url: type === 'phone' ? 'api/sms/otp' : 'api/sms/whatsapp_otp',
|
|
531
|
-
method: 'post',
|
|
532
|
-
data: {
|
|
533
|
-
// The type Whatsapp do not remove the '+'
|
|
534
|
-
phone_number: type === 'phone' ? phone.replace('+', '') : phone,
|
|
535
|
-
},
|
|
536
|
-
});
|
|
537
|
-
};
|
|
538
|
-
const verifyOtpLead = ({ phone, otp, type, }) => {
|
|
539
|
-
return leadApi.call({
|
|
540
|
-
url: type === 'phone' ? 'api/sms/verify' : 'api/sms/whatsapp_verify',
|
|
541
|
-
method: 'post',
|
|
542
|
-
data: {
|
|
543
|
-
// The type Whatsapp do not remove the '+'
|
|
544
|
-
otp_code: otp,
|
|
545
|
-
phone_number: type === 'phone' ? phone.replace('+', '') : phone,
|
|
546
|
-
},
|
|
547
|
-
});
|
|
548
|
-
};
|
|
549
|
-
const Service = {
|
|
550
|
-
campaignGetById,
|
|
551
|
-
validateEmailOrPhoneOnSubot,
|
|
552
|
-
validateEmailOrPhoneOnLeadGen,
|
|
553
|
-
sendSMSOtpLead,
|
|
554
|
-
verifyOtpLead,
|
|
555
|
-
};
|
|
556
|
-
|
|
557
|
-
const checkUsedEmailOrPhone = (campaignId, campaign_subot_id, data) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
|
|
558
|
-
const key = 'email' in data ? 'email' : 'phone';
|
|
559
|
-
const value = 'email' in data ? data.email : data.phone;
|
|
560
|
-
const errorMsg = 'email' in data ? 'validator.emailUsed' : 'validator.phoneUsed';
|
|
561
|
-
/** Check on Leadgen Tool */
|
|
562
|
-
const resLeadGen = yield Service.validateEmailOrPhoneOnLeadGen({
|
|
563
|
-
campaign_id: [campaignId],
|
|
564
|
-
[key]: value, // Can be email or phone
|
|
565
|
-
});
|
|
566
|
-
if (resLeadGen._errorCode === 'SubmitLeadWithBotId_ERR_001' ||
|
|
567
|
-
resLeadGen._errorCode === 'SubmitLeadWithBotId_ERR_002') {
|
|
568
|
-
return errorMsg;
|
|
569
|
-
}
|
|
570
|
-
/** Check on Subot */
|
|
571
|
-
if (campaign_subot_id.length) {
|
|
572
|
-
const resSubot = yield Service.validateEmailOrPhoneOnSubot({
|
|
573
|
-
bot_id: campaign_subot_id,
|
|
574
|
-
[key]: value, // Can be email or phone
|
|
575
|
-
});
|
|
576
|
-
if (resSubot._errorCode === 'CheckSuBotLeadTool_ERR_001') {
|
|
577
|
-
return errorMsg;
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
});
|
|
581
|
-
const validatedCache = {
|
|
582
|
-
email: {},
|
|
583
|
-
phone: {},
|
|
584
|
-
};
|
|
585
|
-
const checkUsedEmailOrPhoneWithCache = (campaignId, campaign_subot_id, data) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
|
|
586
|
-
const key = 'email' in data ? 'email' : 'phone';
|
|
587
|
-
const value = 'email' in data ? data.email : data.phone;
|
|
588
|
-
const errorMsg = 'email' in data ? 'validator.emailUsed' : 'validator.phoneUsed';
|
|
589
|
-
if (validatedCache[key][value]) {
|
|
590
|
-
if (validatedCache[key][value].value) {
|
|
591
|
-
return errorMsg;
|
|
592
|
-
}
|
|
593
|
-
else if (!validatedCache[key][value].value &&
|
|
594
|
-
validatedCache[key][value].expire > Date.now()) {
|
|
595
|
-
return '';
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
const res = yield checkUsedEmailOrPhone(campaignId, campaign_subot_id, data);
|
|
599
|
-
if (res) {
|
|
600
|
-
validatedCache[key][value] = {
|
|
601
|
-
value: true,
|
|
602
|
-
};
|
|
603
|
-
}
|
|
604
|
-
else {
|
|
605
|
-
validatedCache[key][value] = {
|
|
606
|
-
value: false,
|
|
607
|
-
expire: Date.now() + 1000 * 60,
|
|
608
|
-
};
|
|
609
|
-
}
|
|
610
|
-
return res;
|
|
611
|
-
});
|
|
612
|
-
const clearCacheUsedEmailOrPhone = () => {
|
|
613
|
-
validatedCache.email = {};
|
|
614
|
-
validatedCache.phone = {};
|
|
615
|
-
};
|
|
616
|
-
|
|
617
1223
|
// You can give context variables any name
|
|
618
1224
|
const [LeadFormProvider, useLeadFormContext, useLeadForm] = form.createFormContext();
|
|
619
1225
|
const useLeadFormConfig = ({ listBlockAdded = [], validatingPhoneRef, validatingEmailRef, campaignId, campaign_subot_id = [], }) => {
|
|
@@ -785,7 +1391,7 @@ const LocationBlock = ({ name, placeholder, locale, }) => {
|
|
|
785
1391
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
786
1392
|
LoadScript && (React__default["default"].createElement(LoadScript, { googleMapsApiKey: usePlacesAutocomplete.GOOGLE_API_KEY, libraries: libraries, loadingElement: React__default["default"].createElement(React__default["default"].Fragment, null) })),
|
|
787
1393
|
React__default["default"].createElement("div", { style: { display: 'none' }, "data-extra": true, "data-name": name, "data-control": 'text' }),
|
|
788
|
-
React__default["default"].createElement(index.Select, Object.assign({ className: "lead-modal__form-control", label: placeholder, placeholder: placeholder, withAsterisk: true, name: name, data: options, searchValue: searchValue, onSearchChange: (query) => {
|
|
1394
|
+
React__default["default"].createElement(index$1.Select, Object.assign({ className: "lead-modal__form-control", label: placeholder, placeholder: placeholder, withAsterisk: true, name: name, data: options, searchValue: searchValue, onSearchChange: (query) => {
|
|
789
1395
|
setSearchValue(query);
|
|
790
1396
|
}, filter: () => true, clearable: true, searchable: true, onChange: (val) => setAddress(val || ''), icon: React__default["default"].createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none" },
|
|
791
1397
|
React__default["default"].createElement("path", { d: "M10 9.792q.605 0 1.032-.427.426-.428.426-1.032 0-.603-.426-1.031A1.4 1.4 0 0 0 10 6.875q-.604 0-1.032.427a1.4 1.4 0 0 0-.426 1.031q0 .604.426 1.032.428.426 1.032.427m0 8.083q-.145 0-.292-.042a.7.7 0 0 1-.27-.145Q6.478 15 5.01 12.708 3.54 10.418 3.54 8.5q0-3.021 1.949-4.823T10 1.875t4.51 1.802q1.95 1.802 1.949 4.823 0 1.917-1.468 4.208-1.47 2.292-4.427 4.98a.7.7 0 0 1-.271.145 1 1 0 0 1-.292.042", fill: "#8C8C8C" })), autoComplete: 'no-auto-complete-' + randRef.current, rightSection: React__default["default"].createElement(React__default["default"].Fragment, null) }, form.getInputProps(name)))));
|
|
@@ -797,52 +1403,52 @@ const TitleBlock = ({ children, align, }) => (React__default["default"].createEl
|
|
|
797
1403
|
|
|
798
1404
|
const LightboxFields = ({ listBlockAdded, popupId, locale, onClose, onOtherSubmit, }) => {
|
|
799
1405
|
const form = useLeadFormContext();
|
|
800
|
-
return (React__default["default"].createElement(React__default["default"].Fragment, null, listBlockAdded.map((b, index
|
|
1406
|
+
return (React__default["default"].createElement(React__default["default"].Fragment, null, listBlockAdded.map((b, index) => {
|
|
801
1407
|
const { name = '', data = {} } = b || {};
|
|
802
1408
|
const { placeholder, value, align, listQuestion, isSendMailChimp = false, newtab, url, } = data;
|
|
803
1409
|
switch (name) {
|
|
804
1410
|
case 'TitleBlock':
|
|
805
|
-
return (React__default["default"].createElement(TitleBlock, { key: index
|
|
1411
|
+
return (React__default["default"].createElement(TitleBlock, { key: index, align: align }, value));
|
|
806
1412
|
case 'SubtitleBlock':
|
|
807
|
-
return (React__default["default"].createElement(SubtitleBlock, { key: index
|
|
1413
|
+
return (React__default["default"].createElement(SubtitleBlock, { key: index, align: align }, value));
|
|
808
1414
|
case 'TextBlock':
|
|
809
|
-
return (React__default["default"].createElement(index.Input, Object.assign({ key: index
|
|
1415
|
+
return (React__default["default"].createElement(index$1.Input, Object.assign({ key: index, withAsterisk: true, spellCheck: false, type: "text", placeholder: placeholder, className: "lead-modal__form-control",
|
|
810
1416
|
// onChangeRaw={(e) => inputOnChange('text', e)}
|
|
811
1417
|
label: placeholder, "data-control": "text", name: value }, form.getInputProps(value))));
|
|
812
1418
|
case 'NumberBlock':
|
|
813
|
-
return (React__default["default"].createElement(index.NumberInput, Object.assign({ key: index
|
|
1419
|
+
return (React__default["default"].createElement(index$1.NumberInput, Object.assign({ key: index, withAsterisk: true, spellCheck: false, type: "number", placeholder: placeholder, className: "lead-modal__form-control",
|
|
814
1420
|
// onChange={(e) => inputOnChange('number', e)}
|
|
815
1421
|
label: placeholder, "data-control": "number", name: value }, form.getInputProps(value))));
|
|
816
1422
|
case 'EmailBlock':
|
|
817
|
-
return (React__default["default"].createElement(index.Input, Object.assign({ key: index
|
|
1423
|
+
return (React__default["default"].createElement(index$1.Input, Object.assign({ key: index, withAsterisk: true, spellCheck: false,
|
|
818
1424
|
// type="email"
|
|
819
1425
|
placeholder: placeholder, className: "lead-modal__form-control", label: placeholder, "data-control": "email", name: value }, form.getInputProps(value))));
|
|
820
1426
|
case 'PhoneOtpBlock':
|
|
821
1427
|
case 'WhatsappOtpBlock':
|
|
822
1428
|
case 'PhoneBlock': {
|
|
823
|
-
const id = popupId + '-' + value + '-' + index
|
|
824
|
-
return (React__default["default"].createElement(index.Input.Wrapper, Object.assign({ size: "md", withAsterisk: true, key: index
|
|
1429
|
+
const id = popupId + '-' + value + '-' + index;
|
|
1430
|
+
return (React__default["default"].createElement(index$1.Input.Wrapper, Object.assign({ size: "md", withAsterisk: true, key: index, label: placeholder,
|
|
825
1431
|
// error={errorField.phone}
|
|
826
1432
|
className: "lead-modal__form-control", labelProps: {
|
|
827
1433
|
htmlFor: id,
|
|
828
1434
|
} }, form.getInputProps(value)),
|
|
829
|
-
React__default["default"].createElement(index.Phone, { name: value, spellCheck: false, type: "tel", placeholder: placeholder, onChange: (v) => {
|
|
1435
|
+
React__default["default"].createElement(index$1.Phone, { name: value, spellCheck: false, type: "tel", placeholder: placeholder, onChange: (v) => {
|
|
830
1436
|
form.setFieldValue(value, v);
|
|
831
1437
|
},
|
|
832
1438
|
// onBlur={(e) => inputOnBlur('tel', e)}
|
|
833
1439
|
id: id, defaultCountry: (locale ? utils.MAPPED_LOCALE[locale] || 'VN' : 'VN'), "data-control": "tel" })));
|
|
834
1440
|
}
|
|
835
1441
|
case 'LocationBlock': {
|
|
836
|
-
return (React__default["default"].createElement(LocationBlock, { key: index
|
|
1442
|
+
return (React__default["default"].createElement(LocationBlock, { key: index, name: value, placeholder: placeholder, locale: locale }));
|
|
837
1443
|
}
|
|
838
1444
|
case 'DateBlock':
|
|
839
1445
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
840
|
-
React__default["default"].createElement(index$
|
|
1446
|
+
React__default["default"].createElement(index$3.DatePicker, Object.assign({ withAsterisk: true, key: index, type: "default", name: value, placeholder: placeholder, className: "lead-modal__form-control", label: placeholder, "data-control": "date" }, form.getInputProps(value))),
|
|
841
1447
|
React__default["default"].createElement("input", { type: "hidden", name: value, "data-control": "date" })));
|
|
842
1448
|
case 'LinkButtonBlock':
|
|
843
|
-
return (React__default["default"].createElement("div", { key: index
|
|
1449
|
+
return (React__default["default"].createElement("div", { key: index },
|
|
844
1450
|
React__default["default"].createElement("a", { target: newtab ? 'blank' : 'parrent', href: url, style: { textDecoration: 'none' } },
|
|
845
|
-
React__default["default"].createElement(index$
|
|
1451
|
+
React__default["default"].createElement(index$2.Button, { type: "button", size: "md", className: `lead-modal__btn ${LEAD_CLASS}`, onClick: () => {
|
|
846
1452
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
847
1453
|
onOtherSubmit === null || onOtherSubmit === void 0 ? void 0 : onOtherSubmit();
|
|
848
1454
|
} }, value))));
|
|
@@ -851,26 +1457,26 @@ const LightboxFields = ({ listBlockAdded, popupId, locale, onClose, onOtherSubmi
|
|
|
851
1457
|
isSendMailChimp && (React__default["default"].createElement("div", { style: {
|
|
852
1458
|
display: 'none',
|
|
853
1459
|
}, "data-name": value + '-mailchimp' })),
|
|
854
|
-
React__default["default"].createElement(index.Checkbox.Group, Object.assign({ withAsterisk: true, className: "lead-modal__form-control", key: index
|
|
1460
|
+
React__default["default"].createElement(index$1.Checkbox.Group, Object.assign({ withAsterisk: true, className: "lead-modal__form-control", key: index, label: placeholder, size: "md", sx: {
|
|
855
1461
|
display: 'flex',
|
|
856
1462
|
flexDirection: 'column',
|
|
857
1463
|
gap: 8,
|
|
858
|
-
} }, form.getInputProps(value)), listQuestion.map((l, _index) => (React__default["default"].createElement(index.Checkbox, { name: value, key: _index, value: l.value, label: l.placeholder, "data-control": "checkbox" }))))));
|
|
1464
|
+
} }, form.getInputProps(value)), listQuestion.map((l, _index) => (React__default["default"].createElement(index$1.Checkbox, { name: value, key: _index, value: l.value, label: l.placeholder, "data-control": "checkbox" }))))));
|
|
859
1465
|
case 'RadioBlock':
|
|
860
1466
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
861
|
-
isSendMailChimp && (React__default["default"].createElement(index.Input, { type: "hidden", name: value + '-mailchimp', value: isSendMailChimp })),
|
|
862
|
-
React__default["default"].createElement(index.Radio.Group, Object.assign({ withAsterisk: true, className: "lead-modal__form-control", key: index
|
|
1467
|
+
isSendMailChimp && (React__default["default"].createElement(index$1.Input, { type: "hidden", name: value + '-mailchimp', value: isSendMailChimp })),
|
|
1468
|
+
React__default["default"].createElement(index$1.Radio.Group, Object.assign({ withAsterisk: true, className: "lead-modal__form-control", key: index, label: placeholder, size: "md" }, form.getInputProps(value)), listQuestion.map((l, _index) => (React__default["default"].createElement(index$1.Radio, { name: value, key: _index, value: l.value, label: l.placeholder, "data-control": "radio" }))))));
|
|
863
1469
|
case 'DropdownBlock':
|
|
864
1470
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
865
1471
|
React__default["default"].createElement("div", { style: { display: 'none' }, "data-extra": true, "data-name": value, "data-control": 'dropdown' }),
|
|
866
|
-
React__default["default"].createElement(index.Select, Object.assign({ key: index
|
|
1472
|
+
React__default["default"].createElement(index$1.Select, Object.assign({ key: index, className: "lead-modal__form-control", label: placeholder, withAsterisk: true, name: value, data: listQuestion.map((l) => ({
|
|
867
1473
|
value: l.value,
|
|
868
1474
|
label: l.placeholder,
|
|
869
1475
|
})) }, form.getInputProps(value)))));
|
|
870
1476
|
case 'TncBlock':
|
|
871
1477
|
const tncInputProps = form.getInputProps('TNC-' + b.id);
|
|
872
1478
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
873
|
-
React__default["default"].createElement(index.Checkbox, Object.assign({ name: 'TNC-' + b.id, key: b.id, label: React__default["default"].createElement("p", { className: "lead-modal__tnc-link", dangerouslySetInnerHTML: { __html: data.valueHTML } }), className: "tnc-block", "data-control": "checkbox" }, tncInputProps, { error: tncInputProps.error ? React__default["default"].createElement(React__default["default"].Fragment, null) : undefined }))));
|
|
1479
|
+
React__default["default"].createElement(index$1.Checkbox, Object.assign({ name: 'TNC-' + b.id, key: b.id, label: React__default["default"].createElement("p", { className: "lead-modal__tnc-link", dangerouslySetInnerHTML: { __html: data.valueHTML } }), className: "tnc-block", "data-control": "checkbox" }, tncInputProps, { error: tncInputProps.error ? React__default["default"].createElement(React__default["default"].Fragment, null) : undefined }))));
|
|
874
1480
|
}
|
|
875
1481
|
return null;
|
|
876
1482
|
})));
|
|
@@ -979,9 +1585,9 @@ const OtpBlock = ({ otpData, onSuccess, autoSendWhenOpen, }) => {
|
|
|
979
1585
|
e.preventDefault();
|
|
980
1586
|
submitOtp();
|
|
981
1587
|
}, className: "lead-phone-otp-form" },
|
|
982
|
-
React__default["default"].createElement(index$
|
|
983
|
-
React__default["default"].createElement(index
|
|
984
|
-
React__default["default"].createElement(index.Input, { ref: inputRef, name: '_' + name + '-otp', spellCheck: false, type: "number", placeholder: "Enter OTP", className: "lead-modal__form-control", label: "Phone OTP", "data-control": "otp", withAsterisk: true, pattern: "[0-9]*", value: otp, maxLength: 6, onChange: (v) => {
|
|
1588
|
+
React__default["default"].createElement(index$4.Heading, { tag: "h3", fontWeight: "bold", style: { marginBottom: 4 } }, t('lead.otp.title')),
|
|
1589
|
+
React__default["default"].createElement(index.Text, { size: "p1", color: theme.theme.colors.gray600 }, t('lead.otp.desc', { phone: displayPhone })),
|
|
1590
|
+
React__default["default"].createElement(index$1.Input, { ref: inputRef, name: '_' + name + '-otp', spellCheck: false, type: "number", placeholder: "Enter OTP", className: "lead-modal__form-control", label: "Phone OTP", "data-control": "otp", withAsterisk: true, pattern: "[0-9]*", value: otp, maxLength: 6, onChange: (v) => {
|
|
985
1591
|
setIsDirty(true);
|
|
986
1592
|
setOtp(v);
|
|
987
1593
|
if (isDirty && !v)
|
|
@@ -989,10 +1595,10 @@ const OtpBlock = ({ otpData, onSuccess, autoSendWhenOpen, }) => {
|
|
|
989
1595
|
else
|
|
990
1596
|
setErrorMsg(undefined);
|
|
991
1597
|
}, error: isDirty ? errorMsg : undefined }),
|
|
992
|
-
React__default["default"].createElement(index$
|
|
1598
|
+
React__default["default"].createElement(index$2.Button, { size: "md", color: "primary", className: `lead-modal__btn ${LEAD_CLASS}`,
|
|
993
1599
|
// onClick={() => submitOtp()}
|
|
994
1600
|
disabled: !otp, isLoading: isSubmitLoading }, t('lead.otp.verify')),
|
|
995
|
-
React__default["default"].createElement(index$
|
|
1601
|
+
React__default["default"].createElement(index$2.Button, { type: "button", size: "md", color: "transparent", className: `lead-modal__btn lead-phone-otp-button ${LEAD_CLASS}`, onClick: () => {
|
|
996
1602
|
sendOtp();
|
|
997
1603
|
}, disabled: !!resendTimer }, t('lead.otp.resend', {
|
|
998
1604
|
timer: resendTimer ? ` (${resendTimer}s)` : '',
|
|
@@ -1321,7 +1927,7 @@ const LightboxLayout = ({ popupId, extraFields, onClose: onCloseProp, onOtherSub
|
|
|
1321
1927
|
React__default["default"].createElement("span", { style: { fontWeight: 'bold' } },
|
|
1322
1928
|
React__default["default"].createElement("a", { target: "blank", href: popUpTermURL ||
|
|
1323
1929
|
'https://hellobacsi.com/chinh-sach', rel: "noopener noreferrer", style: { textDecoration: 'none' } }, popUpTermText)))),
|
|
1324
|
-
React__default["default"].createElement(index$
|
|
1930
|
+
React__default["default"].createElement(index$2.Button, { size: "md", id: "lead-submit", type: "submit", className: `lead-modal__btn ${LEAD_CLASS}`, disabled: !checkedTerm, isLoading: isSubmitLoading }, popUpSubmitText))))))))),
|
|
1325
1931
|
!currentLayout.includes('Inline') && (React__default["default"].createElement(CloseButton, { onClose: onClose, containerClassName: "close-button-top-right" }))))));
|
|
1326
1932
|
if (!renderAfterImageSizes)
|
|
1327
1933
|
return null;
|
|
@@ -1895,7 +2501,7 @@ const NewLeadPopup = ({ campaign, action, onSubmit, onClose, showThankyou, local
|
|
|
1895
2501
|
};
|
|
1896
2502
|
|
|
1897
2503
|
// mount css
|
|
1898
|
-
const
|
|
2504
|
+
const _LeadGen = ({ apiUrl: apiUrlProp, siteDomain, siteId, locale, apiSubotUrl, DEBUG_URL, forceCampaign, children, }) => {
|
|
1899
2505
|
var _a;
|
|
1900
2506
|
const scrollEventHandlerRef = React.useRef();
|
|
1901
2507
|
const leadStartTimeRef = React.useRef(Date.now());
|
|
@@ -2152,17 +2758,23 @@ const LeadGen = ({ apiUrl: apiUrlProp, siteDomain, siteId, locale, apiSubotUrl,
|
|
|
2152
2758
|
React__default["default"].createElement(translationsContext.TranslationsContext.Provider, { value: {
|
|
2153
2759
|
locale,
|
|
2154
2760
|
values: getTranslations(locale),
|
|
2155
|
-
} },
|
|
2156
|
-
React__default["default"].createElement(core.
|
|
2157
|
-
React__default["default"].createElement(core.
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2761
|
+
} }, children ? (React__default["default"].createElement(Component, { campaign: showCampaign, onSubmit: onSubmit, onClose: onClose, showThankyou: showThankyou, locale: locale }, children)) : (React__default["default"].createElement(core.Portal, { target: utils$1.getPopupWrapperDom() },
|
|
2762
|
+
React__default["default"].createElement(core.Box, { sx: { position: 'fixed', zIndex: 9999999999 } },
|
|
2763
|
+
React__default["default"].createElement(core.Transition, { mounted: Boolean(((_a = showCampaign === null || showCampaign === void 0 ? void 0 : showCampaign.extra_fields) === null || _a === void 0 ? void 0 : _a.popupVersion) === '2.1'), transition: "fade", duration: 600, timingFunction: "ease" }, (styles) => {
|
|
2764
|
+
var _a;
|
|
2765
|
+
return (React__default["default"].createElement(core.Box, { style: styles }, ((_a = showCampaign === null || showCampaign === void 0 ? void 0 : showCampaign.extra_fields) === null || _a === void 0 ? void 0 : _a.popupVersion) === '2.1' && (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
2766
|
+
!!showCampaign.extra_fields.currentLayout &&
|
|
2767
|
+
!showCampaign.extra_fields.currentLayout.includes('Inline') &&
|
|
2768
|
+
!showCampaign.extra_fields.currentLayout.includes('Sidebar') && (React__default["default"].createElement(core.Overlay, { color: "#000", opacity: 0.5, center: true, zIndex: 400, pos: 'fixed', onClick: () => onClose() })),
|
|
2769
|
+
React__default["default"].createElement(NewLeadPopup, { campaign: showCampaign, action: action, onSubmit: onSubmit, onClose: onClose, showThankyou: showThankyou, locale: locale })))));
|
|
2770
|
+
})))))));
|
|
2771
|
+
};
|
|
2772
|
+
const LeadGen = _LeadGen;
|
|
2773
|
+
LeadGen.Heading = Heading;
|
|
2774
|
+
LeadGen.Description = Description;
|
|
2775
|
+
LeadGen.Form = Form;
|
|
2776
|
+
LeadGen.Thankyou = Thankyou;
|
|
2777
|
+
LeadGen.OtpForm = OtpBlock$1;
|
|
2778
|
+
LeadGen.Close = Close.Close;
|
|
2167
2779
|
|
|
2168
2780
|
exports.LeadGen = LeadGen;
|