@hhgtech/hhg-components 1.29.374-beta-4 → 1.29.375
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/{InputDate-877c23c7.js → InputDate-9746e093.js} +3 -3
- package/build/{LastPeriod-dce971c7.js → LastPeriod-b3289339.js} +1 -1
- package/build/{MobileBottomNavigationIcon-879f9756.js → MobileBottomNavigationIcon-e1b98872.js} +3 -3
- package/build/{Spinner-229e09f1.js → Spinner-d314a67a.js} +1 -1
- package/build/{WhatsApp-5ab7c58d.js → WhatsApp-a8b76a33.js} +1 -1
- package/build/adapters.js +19 -19
- package/build/atoms.js +48 -48
- package/build/babyGrowth.js +83 -83
- package/build/cache.js +2 -2
- package/build/care.js +17 -17
- package/build/careBookingSearchBar.js +14 -14
- package/build/careBookingSearchBarV2.js +15 -15
- package/build/components/mantine/phone/index.d.ts +0 -2
- package/build/components.js +96 -97
- package/build/{constants-4aa46cbb.js → constants-6af492f0.js} +1 -1
- package/build/constants.js +3 -3
- package/build/constantsDomainLocales.js +1 -1
- package/build/constantsRiskScreener.js +2 -2
- package/build/constantsSite.js +2 -2
- package/build/{core-f2b87dfd.js → core-1953f8f6.js} +1 -1
- package/build/{dataTransform-cfc6325f.js → dataTransform-299d341e.js} +1 -1
- package/build/ecom.js +4 -4
- package/build/{editor-7954fc77.js → editor-9e5803b8.js} +11 -11
- package/build/embeddedHeathToolCards_babyGrowth.js +23 -23
- package/build/embeddedHeathToolCards_babyPoop.js +19 -19
- package/build/embeddedHeathToolCards_babyVaccine.js +22 -22
- package/build/embeddedHeathToolCards_bmi_bmi.js +25 -25
- package/build/embeddedHeathToolCards_bmrBmr.js +25 -25
- package/build/embeddedHeathToolCards_dueDate_dueDate.js +22 -22
- package/build/embeddedHeathToolCards_ovulation_ovulation.js +22 -22
- package/build/embeddedHeathToolCards_pwg_pwg.js +26 -26
- package/build/embeddedHeathToolCards_targetHeartRate.js +27 -27
- package/build/esm/{InputDate-2d1744e8.js → InputDate-c0b788ac.js} +3 -3
- package/build/esm/{LastPeriod-4edad391.js → LastPeriod-da33c15d.js} +1 -1
- package/build/esm/{MobileBottomNavigationIcon-58e04c72.js → MobileBottomNavigationIcon-12879b99.js} +3 -3
- package/build/esm/{Spinner-a8a10423.js → Spinner-db469081.js} +1 -1
- package/build/esm/{WhatsApp-1b8c1d61.js → WhatsApp-73d081fc.js} +1 -1
- package/build/esm/adapters.js +19 -19
- package/build/esm/atoms.js +48 -48
- package/build/esm/babyGrowth.js +83 -83
- package/build/esm/cache.js +2 -2
- package/build/esm/care.js +17 -17
- package/build/esm/careBookingSearchBar.js +14 -14
- package/build/esm/careBookingSearchBarV2.js +15 -15
- package/build/esm/components/mantine/phone/index.d.ts +0 -2
- package/build/esm/components.js +96 -97
- package/build/esm/{constants-b2d46ae1.js → constants-18894c10.js} +1 -1
- package/build/esm/constants.js +3 -3
- package/build/esm/constantsDomainLocales.js +1 -1
- package/build/esm/constantsRiskScreener.js +2 -2
- package/build/esm/constantsSite.js +2 -2
- package/build/esm/{core-cdb21f41.js → core-9f8d6b2f.js} +1 -1
- package/build/esm/{dataTransform-65a659b9.js → dataTransform-7a22b3a7.js} +1 -1
- package/build/esm/ecom.js +4 -4
- package/build/esm/{editor-ab9eebab.js → editor-df66b793.js} +11 -11
- package/build/esm/embeddedHeathToolCards_babyGrowth.js +23 -23
- package/build/esm/embeddedHeathToolCards_babyPoop.js +19 -19
- package/build/esm/embeddedHeathToolCards_babyVaccine.js +22 -22
- package/build/esm/embeddedHeathToolCards_bmi_bmi.js +25 -25
- package/build/esm/embeddedHeathToolCards_bmrBmr.js +25 -25
- package/build/esm/embeddedHeathToolCards_dueDate_dueDate.js +22 -22
- package/build/esm/embeddedHeathToolCards_ovulation_ovulation.js +22 -22
- package/build/esm/embeddedHeathToolCards_pwg_pwg.js +26 -26
- package/build/esm/embeddedHeathToolCards_targetHeartRate.js +27 -27
- package/build/esm/footer.js +21 -21
- package/build/esm/gAssets.js +2 -2
- package/build/esm/{healthTools-b3cf91fc.js → healthTools-f90bfa20.js} +1 -1
- package/build/esm/healthToolsCardWrapper.js +18 -18
- package/build/esm/healthToolsForm.js +33 -33
- package/build/esm/hooks.js +13 -13
- package/build/esm/i18n.js +56 -14
- package/build/esm/i18nV2.js +2 -2
- package/build/esm/{index-b0408a4c.js → index-07b81bb7.js} +27 -36
- package/build/esm/{index-91a9cf15.js → index-0a217701.js} +1 -1
- package/build/esm/{index-0dbb9857.js → index-0c735d3c.js} +17 -17
- package/build/esm/{index-96f04c6f.js → index-0e19d192.js} +2 -2
- package/build/esm/{index-7b234b2f.js → index-126572b4.js} +17 -17
- package/build/esm/{index-af781e76.js → index-128f0837.js} +3 -3
- package/build/esm/{index-4a7d9b16.js → index-13feaf1a.js} +4 -4
- package/build/esm/{index-1ce2f300.js → index-1a274479.js} +1 -1
- package/build/esm/{index-bf06cb9e.js → index-1c00c095.js} +16 -16
- package/build/esm/{index-dc2e59c8.js → index-1fd83190.js} +2 -2
- package/build/esm/{index-9fd572cf.js → index-26f91073.js} +2 -2
- package/build/esm/{index-29eb6825.js → index-2a6cde75.js} +2 -2
- package/build/esm/{index-0d13ebdc.js → index-316933cd.js} +17 -17
- package/build/esm/{index-2ecdf8f7.js → index-34ffb6c1.js} +16 -16
- package/build/esm/{index-80849ded.js → index-388b5a52.js} +3 -3
- package/build/esm/{index-ad7b17d1.js → index-3c763567.js} +24 -24
- package/build/esm/{index-24e6abe4.js → index-3e1277d2.js} +2 -2
- package/build/esm/{index-86f33571.js → index-46b0d30a.js} +2 -2
- package/build/esm/{index-bb401984.js → index-4ba59648.js} +2 -2
- package/build/esm/{index-6cde560e.js → index-4f0a6c84.js} +3 -3
- package/build/esm/{index-5dd7d058.js → index-53894be7.js} +16 -16
- package/build/esm/{index-a6e497c8.js → index-56b5378a.js} +15 -15
- package/build/esm/{index-9fb49296.js → index-57aabb5e.js} +7 -7
- package/build/esm/{index-34a2735d.js → index-5a7a5244.js} +31 -31
- package/build/esm/{index-09f6ffac.js → index-5aef6986.js} +25 -25
- package/build/esm/{index-1dd399ff.js → index-5d0200f0.js} +6 -6
- package/build/esm/{index-a7f46108.js → index-5e6dc6db.js} +3 -3
- package/build/esm/{index-99d4fdc5.js → index-61a111f8.js} +7 -7
- package/build/esm/{index-07405452.js → index-681d28d8.js} +2 -2
- package/build/esm/{index-29b629ba.js → index-6a5f45df.js} +1 -1
- package/build/esm/{index-d99d8050.js → index-6ac72472.js} +2 -2
- package/build/esm/{index-0b415d96.js → index-6e1ef507.js} +13 -13
- package/build/esm/{index-3abd9462.js → index-6fac949c.js} +2 -2
- package/build/esm/{index-ab98d2e6.js → index-760ba1e0.js} +10 -10
- package/build/esm/{index-0a373dbd.js → index-7dbb26d3.js} +6 -6
- package/build/esm/{index-e9ef9c5f.js → index-7e78248e.js} +6 -6
- package/build/esm/{index-ecc33faa.js → index-7f770fe8.js} +6 -6
- package/build/esm/{index-84163960.js → index-8b74f8e4.js} +1 -1
- package/build/esm/{index-00eec91f.js → index-8c47541d.js} +32 -32
- package/build/esm/{index-c12fa11f.js → index-90bb49a7.js} +18 -18
- package/build/esm/{index-0875a025.js → index-98cfd37b.js} +13 -13
- package/build/esm/{index-36e7f702.js → index-996fae38.js} +32 -32
- package/build/esm/{index-9024c338.js → index-99b5a528.js} +3 -3
- package/build/esm/{index-1da437a9.js → index-9bfc12bd.js} +21 -21
- package/build/esm/{index-679ad173.js → index-9fe97cf0.js} +1 -1
- package/build/esm/{index-396001bf.js → index-a4c8373a.js} +3 -3
- package/build/esm/{index-551bea97.js → index-ad8d1314.js} +1 -1
- package/build/esm/{index-1c12fb8b.js → index-b23acf00.js} +17 -17
- package/build/esm/{index-798f9e4d.js → index-c3500f4e.js} +2 -2
- package/build/esm/{index-dfb2ffea.js → index-cc1d1a1a.js} +2 -2
- package/build/esm/{index-113e360a.js → index-cd5faa30.js} +1 -1
- package/build/esm/{index-b7697f7b.js → index-d1038670.js} +2 -2
- package/build/esm/{index-39dddbb8.js → index-d2068808.js} +18 -18
- package/build/esm/{index-9f1abe5b.js → index-d534eff3.js} +3 -3
- package/build/esm/{index-b45bb27d.js → index-db312639.js} +8 -8
- package/build/esm/{index-1f9a2231.js → index-df5a5394.js} +5 -5
- package/build/esm/{index-be7ff82e.js → index-dfb047ee.js} +16 -16
- package/build/esm/{index-0b1e4b7f.js → index-e04827a2.js} +13 -13
- package/build/esm/{index-e3f57899.js → index-eeb5bd9e.js} +13 -13
- package/build/esm/{index-1fe0be54.js → index-ef33fd3f.js} +1 -1
- package/build/esm/{index-ce1be417.js → index-ef81684d.js} +6 -6
- package/build/esm/{index-5eb619ff.js → index-f3b8d349.js} +22 -22
- package/build/esm/{index-68074a37.js → index-f5f10d16.js} +1 -1
- package/build/esm/{index-fcf40ad6.js → index-f9f05826.js} +5 -5
- package/build/esm/index.js +117 -118
- package/build/esm/interfaces/types/index.d.ts +0 -1
- package/build/esm/{labelSorting-0480782a.js → labelSorting-5231682b.js} +4 -4
- package/build/esm/lead/helpers.d.ts +1 -56
- package/build/esm/lead/index.d.ts +1 -2
- package/build/esm/lead/services/index.d.ts +0 -21
- package/build/esm/lead/store/index.d.ts +0 -1
- package/build/esm/lead.js +986 -2162
- package/build/esm/{logoIcon-6aa39f66.js → logoIcon-c50c983d.js} +2 -2
- package/build/esm/mantine.js +25 -25
- package/build/esm/misc.js +17 -17
- package/build/esm/miscGetDynamicHealthTool.js +4 -4
- package/build/esm/miscGetSocialList.js +8 -8
- package/build/esm/miscScreenSizeContext.js +1 -1
- package/build/esm/mobileBottomNavigation.js +5 -5
- package/build/esm/mobileBottomNavigationIcon.js +5 -5
- package/build/esm/molecules.js +73 -74
- package/build/esm/moleculesArticleCard.js +6 -6
- package/build/esm/moleculesArticleCardV2.js +16 -16
- package/build/esm/navigation.js +45 -46
- package/build/esm/navigationLogoutPopup.js +9 -9
- package/build/esm/navigationProfileButton.js +23 -23
- package/build/esm/onboardingV2.js +29 -29
- package/build/esm/organisms.js +49 -50
- package/build/esm/{post-bd18ae33.js → post-6fd50030.js} +2 -2
- package/build/esm/profileNavigation.js +19 -19
- package/build/esm/progressBar.js +1 -1
- package/build/esm/pwg.js +22 -22
- package/build/esm/ssoV2/api/featureFlag.d.ts +1 -2
- package/build/esm/ssoV2.js +40 -53
- package/build/esm/{store-1b3563da.js → store-1c63d8b0.js} +183 -6
- package/build/esm/subot.js +35 -36
- package/build/esm/surveyOrPremiumBanner.js +32 -33
- package/build/esm/surveyQuestionCard.js +10 -10
- package/build/esm/{surveyThankyouCard-e0cb0e4f.js → surveyThankyouCard-a0c5903d.js} +5 -5
- package/build/esm/together.js +55 -56
- package/build/esm/togetherApiUtils.js +4 -4
- package/build/esm/togetherAtoms.js +30 -30
- package/build/esm/togetherComponentGlobalContext.js +4 -4
- package/build/esm/togetherMolecules.js +50 -51
- package/build/esm/togetherMoleculesCardAuthor.js +28 -28
- package/build/esm/togetherMoleculesPostImagePreview.js +11 -11
- package/build/esm/togetherMoleculesProfileDetail.js +38 -39
- package/build/esm/togetherOrganisms.js +49 -50
- package/build/esm/togetherRichTextEditor.js +17 -17
- package/build/esm/togetherShareBox.js +10 -10
- package/build/esm/{treePopoverMenu-957c961f.js → treePopoverMenu-a42b3049.js} +19 -19
- package/build/esm/{types-eb7bf5f2.js → types-580c541f.js} +2 -2
- package/build/esm/types.js +2 -2
- package/build/esm/{useCategory-6138ae0c.js → useCategory-b739faac.js} +5 -5
- package/build/esm/{useHealthToolCache-e2d184a8.js → useHealthToolCache-87091430.js} +1 -1
- package/build/esm/{useMantineLocale-80e1b6e8.js → useMantineLocale-27cbe6c8.js} +6 -6
- package/build/esm/{usePlacesAutocomplete-c4749ddc.js → usePlacesAutocomplete-b2c58eae.js} +1 -1
- package/build/esm/{useScreenSize-e7eac93f.js → useScreenSize-9f683ab9.js} +2 -2
- package/build/esm/useTogetherAuthRequiredAction.js +9 -10
- package/build/esm/{utils-d8da27f5.js → utils-0714a33c.js} +2 -2
- package/build/esm/{utils-2b1d5bd6.js → utils-c1df8b61.js} +2 -2
- package/build/esm/{utils-cc00d05a.js → utils-c3c90e9c.js} +4 -5
- package/build/esm/{utils-b919951c.js → utils-ec0a690b.js} +3 -3
- package/build/esm/vaccination.js +21 -21
- package/build/footer.js +21 -21
- package/build/gAssets.js +2 -2
- package/build/{healthTools-a016cb8d.js → healthTools-c138e13a.js} +1 -1
- package/build/healthToolsCardWrapper.js +18 -18
- package/build/healthToolsForm.js +33 -33
- package/build/hooks.js +13 -13
- package/build/i18n.js +57 -16
- package/build/i18nV2.js +1 -1
- package/build/{index-585a5bae.js → index-008eedb8.js} +7 -7
- package/build/{index-cb49c1bb.js → index-02e0fc3f.js} +2 -2
- package/build/{index-cbf55622.js → index-0649d573.js} +6 -6
- package/build/{index-88b43a3e.js → index-06b6f920.js} +5 -5
- package/build/{index-ca3c8063.js → index-06f14e03.js} +32 -32
- package/build/{index-0651afe0.js → index-0b4028d0.js} +2 -2
- package/build/{index-223317ad.js → index-1007e179.js} +2 -2
- package/build/{index-2878facd.js → index-11217e12.js} +4 -4
- package/build/{index-5cb3f50f.js → index-169f743e.js} +13 -13
- package/build/{index-bbfb5456.js → index-1d4f69ed.js} +1 -1
- package/build/{index-bb3901d9.js → index-1da24aa7.js} +16 -16
- package/build/{index-acd931c2.js → index-1de4bd11.js} +17 -17
- package/build/{index-7ba64550.js → index-201a8d71.js} +3 -3
- package/build/{index-4b85a78a.js → index-22387adf.js} +6 -6
- package/build/{index-0ba8ea71.js → index-2364e8df.js} +6 -6
- package/build/{index-1699773f.js → index-25bf564e.js} +25 -25
- package/build/{index-a105395a.js → index-2965cadb.js} +1 -1
- package/build/{index-228adb0f.js → index-3c5af87d.js} +2 -2
- package/build/{index-dd62cf24.js → index-3d563929.js} +1 -1
- package/build/{index-a9694d80.js → index-3f93e79e.js} +18 -18
- package/build/{index-d5fc7635.js → index-446beb43.js} +2 -2
- package/build/{index-b6a6c539.js → index-4bfd812a.js} +1 -1
- package/build/{index-0a5e6408.js → index-50426772.js} +27 -36
- package/build/{index-05035d2b.js → index-5387bc40.js} +5 -5
- package/build/{index-3b093a8b.js → index-59d5c076.js} +16 -16
- package/build/{index-a0064d3e.js → index-5d8490cb.js} +1 -1
- package/build/{index-2f099fb7.js → index-6568d0d4.js} +7 -7
- package/build/{index-f2b654c4.js → index-6937ab6f.js} +17 -17
- package/build/{index-af6f003e.js → index-72db33ac.js} +2 -2
- package/build/{index-18565e54.js → index-7306bd8c.js} +18 -18
- package/build/{index-220172c4.js → index-7cc099d8.js} +3 -3
- package/build/{index-a2de13bb.js → index-8a3b8367.js} +2 -2
- package/build/{index-3d227b95.js → index-92e68ec9.js} +13 -13
- package/build/{index-a6738c7d.js → index-98b8aa1a.js} +3 -3
- package/build/{index-752817df.js → index-99272d11.js} +16 -16
- package/build/{index-7b7b50dc.js → index-9b9e59a2.js} +1 -1
- package/build/{index-5005ce85.js → index-a09cd67f.js} +1 -1
- package/build/{index-eab7c34b.js → index-a2637997.js} +13 -13
- package/build/{index-d30c98c8.js → index-a62351d2.js} +22 -22
- package/build/{index-a734e870.js → index-aa5a595c.js} +8 -8
- package/build/{index-934b8ae0.js → index-aa749e85.js} +17 -17
- package/build/{index-d6a16d97.js → index-ad7933f9.js} +1 -1
- package/build/{index-39ff1669.js → index-af21979d.js} +17 -17
- package/build/{index-ffa642f4.js → index-b81a335e.js} +2 -2
- package/build/{index-cc2888bb.js → index-bd129201.js} +1 -1
- package/build/{index-50d7ebaa.js → index-bf1efdbb.js} +6 -6
- package/build/{index-253ec2d9.js → index-c034f39c.js} +2 -2
- package/build/{index-6851924c.js → index-c60ecec1.js} +16 -16
- package/build/{index-72d32bf1.js → index-c926a6a3.js} +6 -6
- package/build/{index-db6611f1.js → index-ca8ec47e.js} +3 -3
- package/build/{index-85a69b52.js → index-d15413c2.js} +24 -24
- package/build/{index-817d411d.js → index-d1da0386.js} +32 -32
- package/build/{index-06f80018.js → index-d4caff5b.js} +2 -2
- package/build/{index-0084363f.js → index-dd83dbad.js} +10 -10
- package/build/{index-9b773d37.js → index-dda0b9d1.js} +3 -3
- package/build/{index-79a16c97.js → index-e5f20367.js} +2 -2
- package/build/{index-bca93346.js → index-e6660745.js} +2 -2
- package/build/{index-d99a6332.js → index-e7f07eca.js} +31 -31
- package/build/{index-c58f317f.js → index-e81dd9db.js} +13 -13
- package/build/{index-69a5e880.js → index-e98b6385.js} +2 -2
- package/build/{index-c81cfcf9.js → index-ecc24c2c.js} +3 -3
- package/build/{index-a33a5b8c.js → index-f05dc08c.js} +2 -2
- package/build/{index-ce4cd7f0.js → index-f90e1c8e.js} +21 -21
- package/build/{index-36e65c85.js → index-fe1b090f.js} +15 -15
- package/build/index.js +117 -118
- package/build/interfaces/types/index.d.ts +0 -1
- package/build/{labelSorting-cfeffd52.js → labelSorting-b5d28c8b.js} +4 -4
- package/build/lead/helpers.d.ts +1 -56
- package/build/lead/index.d.ts +1 -2
- package/build/lead/services/index.d.ts +0 -21
- package/build/lead/store/index.d.ts +0 -1
- package/build/lead.js +1034 -2211
- package/build/{logoIcon-0269990f.js → logoIcon-5c2ba163.js} +2 -2
- package/build/mantine.js +22 -22
- package/build/misc.js +17 -17
- package/build/miscGetDynamicHealthTool.js +4 -4
- package/build/miscGetSocialList.js +8 -8
- package/build/miscScreenSizeContext.js +1 -1
- package/build/mobileBottomNavigation.js +5 -5
- package/build/mobileBottomNavigationIcon.js +5 -5
- package/build/molecules.js +73 -74
- package/build/moleculesArticleCard.js +6 -6
- package/build/moleculesArticleCardV2.js +16 -16
- package/build/navigation.js +45 -46
- package/build/navigationLogoutPopup.js +9 -9
- package/build/navigationProfileButton.js +23 -23
- package/build/onboardingV2.js +28 -28
- package/build/organisms.js +49 -50
- package/build/{post-954dd984.js → post-34bb441f.js} +2 -2
- package/build/profileNavigation.js +19 -19
- package/build/progressBar.js +1 -1
- package/build/pwg.js +22 -22
- package/build/ssoV2/api/featureFlag.d.ts +1 -2
- package/build/ssoV2.js +117 -130
- package/build/{store-f8263e4e.js → store-1ddbc453.js} +196 -8
- package/build/subot.js +34 -35
- package/build/surveyOrPremiumBanner.js +32 -33
- package/build/surveyQuestionCard.js +10 -10
- package/build/{surveyThankyouCard-bb3a138d.js → surveyThankyouCard-ac96d4b4.js} +5 -5
- package/build/together.js +55 -56
- package/build/togetherApiUtils.js +4 -4
- package/build/togetherAtoms.js +30 -30
- package/build/togetherComponentGlobalContext.js +4 -4
- package/build/togetherMolecules.js +50 -51
- package/build/togetherMoleculesCardAuthor.js +28 -28
- package/build/togetherMoleculesPostImagePreview.js +11 -11
- package/build/togetherMoleculesProfileDetail.js +38 -39
- package/build/togetherOrganisms.js +49 -50
- package/build/togetherRichTextEditor.js +17 -17
- package/build/togetherShareBox.js +10 -10
- package/build/{treePopoverMenu-6e79ee16.js → treePopoverMenu-faee82ba.js} +19 -19
- package/build/{types-33c0756b.js → types-6a849d0f.js} +2 -2
- package/build/types.js +2 -2
- package/build/{useCategory-49d6eb99.js → useCategory-457cf1c5.js} +5 -5
- package/build/{useHealthToolCache-111b486d.js → useHealthToolCache-8246efd1.js} +1 -1
- package/build/{useMantineLocale-89cc8207.js → useMantineLocale-70ce0f42.js} +6 -6
- package/build/{usePlacesAutocomplete-951ae89e.js → usePlacesAutocomplete-c1253ff8.js} +1 -1
- package/build/{useScreenSize-f2c19a70.js → useScreenSize-0d50d147.js} +2 -2
- package/build/useTogetherAuthRequiredAction.js +9 -10
- package/build/{utils-2de3e40a.js → utils-0a02bd15.js} +2 -2
- package/build/{utils-91d25828.js → utils-47903e31.js} +3 -3
- package/build/{utils-dd3a3402.js → utils-4c8af11f.js} +2 -2
- package/build/{utils-b64f9207.js → utils-e1a9bf2b.js} +8 -9
- package/build/vaccination.js +21 -21
- package/package.json +3 -3
- package/build/components/mantine/phoneInput/PhoneInput.d.ts +0 -17
- package/build/components/mantine/phoneInput/index.d.ts +0 -1
- package/build/esm/components/mantine/phoneInput/PhoneInput.d.ts +0 -17
- package/build/esm/components/mantine/phoneInput/index.d.ts +0 -1
- package/build/esm/index-2688ff72.js +0 -183
- package/build/esm/lead/LeadGen.type.d.ts +0 -34
- package/build/esm/lead/LeadGenForm/LeadGenForm.d.ts +0 -41
- package/build/esm/lead/LeadGenForm/LeadGenForm.helpers.d.ts +0 -2
- package/build/esm/lead/LeadGenForm/LeadGenForm.styled.d.ts +0 -5
- package/build/esm/lead/LeadGenForm/LeadGenFormPhone.d.ts +0 -17
- package/build/esm/lead/LeadGenForm/LeadGenThankYou.d.ts +0 -20
- package/build/esm/lead/LeadGenForm/index.d.ts +0 -3
- package/build/esm/lead/LeadGenForm/textField/index.d.ts +0 -13
- package/build/esm/lead/LeadGenForm/textField/index.styled.d.ts +0 -11
- package/build/esm/lead/LeadGenSubscriptionBox/LeadGenContext.d.ts +0 -66
- package/build/esm/lead/LeadGenSubscriptionBox/LeadGenSubscriptionBox.d.ts +0 -4
- package/build/esm/lead/LeadGenSubscriptionBox/LeadGenSubscriptionBox.styled.d.ts +0 -21
- package/build/esm/lead/LeadGenSubscriptionBox/LeadGenSubscriptionBoxA.d.ts +0 -3
- package/build/esm/lead/LeadGenSubscriptionBox/LeadGenSubscriptionBoxContainer.d.ts +0 -24
- package/build/esm/lead/LeadGenSubscriptionBox/index.d.ts +0 -1
- package/build/esm/lead/LeadGenTranslationContext.d.ts +0 -6
- package/build/esm/translationsProvider-dac81da4.js +0 -55
- package/build/index-c69ba434.js +0 -196
- package/build/lead/LeadGen.type.d.ts +0 -34
- package/build/lead/LeadGenForm/LeadGenForm.d.ts +0 -41
- package/build/lead/LeadGenForm/LeadGenForm.helpers.d.ts +0 -2
- package/build/lead/LeadGenForm/LeadGenForm.styled.d.ts +0 -5
- package/build/lead/LeadGenForm/LeadGenFormPhone.d.ts +0 -17
- package/build/lead/LeadGenForm/LeadGenThankYou.d.ts +0 -20
- package/build/lead/LeadGenForm/index.d.ts +0 -3
- package/build/lead/LeadGenForm/textField/index.d.ts +0 -13
- package/build/lead/LeadGenForm/textField/index.styled.d.ts +0 -11
- package/build/lead/LeadGenSubscriptionBox/LeadGenContext.d.ts +0 -66
- package/build/lead/LeadGenSubscriptionBox/LeadGenSubscriptionBox.d.ts +0 -4
- package/build/lead/LeadGenSubscriptionBox/LeadGenSubscriptionBox.styled.d.ts +0 -21
- package/build/lead/LeadGenSubscriptionBox/LeadGenSubscriptionBoxA.d.ts +0 -3
- package/build/lead/LeadGenSubscriptionBox/LeadGenSubscriptionBoxContainer.d.ts +0 -24
- package/build/lead/LeadGenSubscriptionBox/index.d.ts +0 -1
- package/build/lead/LeadGenTranslationContext.d.ts +0 -6
- package/build/translationsProvider-681225a2.js +0 -62
- /package/build/{BMI_BOYS.percentile.monthly-405a630a.js → BMI_BOYS.percentile.monthly-df2482bd.js} +0 -0
- /package/build/{BMI_BOYS.percentile.weekly-07b1b016.js → BMI_BOYS.percentile.weekly-035eb626.js} +0 -0
- /package/build/{BMI_BOYS.percentile.yearly-a40fb757.js → BMI_BOYS.percentile.yearly-5fe8b43f.js} +0 -0
- /package/build/{BMI_BOYS.zscore.monthly-c7e09504.js → BMI_BOYS.zscore.monthly-324ae79e.js} +0 -0
- /package/build/{BMI_BOYS.zscore.weekly-376d05a8.js → BMI_BOYS.zscore.weekly-0f5f08fc.js} +0 -0
- /package/build/{BMI_BOYS.zscore.yearly-b7f75a2e.js → BMI_BOYS.zscore.yearly-83add2b5.js} +0 -0
- /package/build/{BMI_GIRLS.percentile.monthly-d3a0643a.js → BMI_GIRLS.percentile.monthly-19bcd66d.js} +0 -0
- /package/build/{BMI_GIRLS.percentile.weekly-ce5d4cdb.js → BMI_GIRLS.percentile.weekly-3f7c8830.js} +0 -0
- /package/build/{BMI_GIRLS.percentile.yearly-1f97a795.js → BMI_GIRLS.percentile.yearly-032b7aa7.js} +0 -0
- /package/build/{BMI_GIRLS.zscore.monthly-077489ec.js → BMI_GIRLS.zscore.monthly-345313ae.js} +0 -0
- /package/build/{BMI_GIRLS.zscore.weekly-e50841f6.js → BMI_GIRLS.zscore.weekly-4bff215b.js} +0 -0
- /package/build/{BMI_GIRLS.zscore.yearly-8aca994b.js → BMI_GIRLS.zscore.yearly-b090beec.js} +0 -0
- /package/build/{ChevronDown-bc69de3a.js → ChevronDown-41194899.js} +0 -0
- /package/build/{Close-390f3c2d.js → Close-2add3da2.js} +0 -0
- /package/build/{Google-2265b4b5.js → Google-39a84f2a.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.percentile.monthly-ca597e32.js → HEAD CIRCUM_BOYS.percentile.monthly-c2fab73c.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.percentile.weekly-50eec743.js → HEAD CIRCUM_BOYS.percentile.weekly-166966e5.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.percentile.yearly-848e6544.js → HEAD CIRCUM_BOYS.percentile.yearly-f779680b.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.zscore.monthly-d58e5439.js → HEAD CIRCUM_BOYS.zscore.monthly-e2ded6bc.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.zscore.weekly-bbd82265.js → HEAD CIRCUM_BOYS.zscore.weekly-beb5c911.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.zscore.yearly-7db39b45.js → HEAD CIRCUM_BOYS.zscore.yearly-b85cf0d6.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.percentile.monthly-0a97ff9e.js → HEAD CIRCUM_GIRLS.percentile.monthly-d681a0ee.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.percentile.weekly-c78bc5c5.js → HEAD CIRCUM_GIRLS.percentile.weekly-9e4cb570.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.percentile.yearly-cda42a30.js → HEAD CIRCUM_GIRLS.percentile.yearly-23f33f5d.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.zscore.monthly-51674c76.js → HEAD CIRCUM_GIRLS.zscore.monthly-2bae97cf.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.zscore.weekly-65eda1af.js → HEAD CIRCUM_GIRLS.zscore.weekly-999a9564.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.zscore.yearly-d5af3abf.js → HEAD CIRCUM_GIRLS.zscore.yearly-c5ee4f98.js} +0 -0
- /package/build/{HEIGHT_BOYS.percentile.monthly-70ea2220.js → HEIGHT_BOYS.percentile.monthly-af1bbd51.js} +0 -0
- /package/build/{HEIGHT_BOYS.percentile.weekly-3fc2233e.js → HEIGHT_BOYS.percentile.weekly-dc4597cf.js} +0 -0
- /package/build/{HEIGHT_BOYS.percentile.yearly-02bbd1ea.js → HEIGHT_BOYS.percentile.yearly-226b11ca.js} +0 -0
- /package/build/{HEIGHT_BOYS.zscore.monthly-476f71f1.js → HEIGHT_BOYS.zscore.monthly-2ce0c9c1.js} +0 -0
- /package/build/{HEIGHT_BOYS.zscore.weekly-5229b9be.js → HEIGHT_BOYS.zscore.weekly-3cbf2c2a.js} +0 -0
- /package/build/{HEIGHT_BOYS.zscore.yearly-5046fb8e.js → HEIGHT_BOYS.zscore.yearly-1c8a3c1d.js} +0 -0
- /package/build/{HEIGHT_GIRLS.percentile.monthly-36db0ab0.js → HEIGHT_GIRLS.percentile.monthly-c8266607.js} +0 -0
- /package/build/{HEIGHT_GIRLS.percentile.weekly-c7667e72.js → HEIGHT_GIRLS.percentile.weekly-db44a8d4.js} +0 -0
- /package/build/{HEIGHT_GIRLS.percentile.yearly-8614198b.js → HEIGHT_GIRLS.percentile.yearly-a85b0b4d.js} +0 -0
- /package/build/{HEIGHT_GIRLS.zscore.monthly-0cab9bf4.js → HEIGHT_GIRLS.zscore.monthly-7893ef51.js} +0 -0
- /package/build/{HEIGHT_GIRLS.zscore.weekly-077d6997.js → HEIGHT_GIRLS.zscore.weekly-b40844c5.js} +0 -0
- /package/build/{HEIGHT_GIRLS.zscore.yearly-ff1ea86f.js → HEIGHT_GIRLS.zscore.yearly-9f26867c.js} +0 -0
- /package/build/{Locale-608d8aa7.js → Locale-836a0da1.js} +0 -0
- /package/build/{Visible-60bb588d.js → Visible-51d5d954.js} +0 -0
- /package/build/{WEIGHT_BOYS.percentile.monthly-d1a868a3.js → WEIGHT_BOYS.percentile.monthly-e075c1a3.js} +0 -0
- /package/build/{WEIGHT_BOYS.percentile.weekly-07187b39.js → WEIGHT_BOYS.percentile.weekly-b8a78276.js} +0 -0
- /package/build/{WEIGHT_BOYS.percentile.yearly-eef61209.js → WEIGHT_BOYS.percentile.yearly-f2d9c7c9.js} +0 -0
- /package/build/{WEIGHT_BOYS.zscore.monthly-11a57778.js → WEIGHT_BOYS.zscore.monthly-0c7c819f.js} +0 -0
- /package/build/{WEIGHT_BOYS.zscore.weekly-3fe2b4d2.js → WEIGHT_BOYS.zscore.weekly-b19ddebe.js} +0 -0
- /package/build/{WEIGHT_BOYS.zscore.yearly-37eba4a4.js → WEIGHT_BOYS.zscore.yearly-0c6b12a8.js} +0 -0
- /package/build/{WEIGHT_GIRLS.percentile.monthly-db6cef50.js → WEIGHT_GIRLS.percentile.monthly-c8002622.js} +0 -0
- /package/build/{WEIGHT_GIRLS.percentile.weekly-3b49590f.js → WEIGHT_GIRLS.percentile.weekly-bfc763f2.js} +0 -0
- /package/build/{WEIGHT_GIRLS.percentile.yearly-d86b6625.js → WEIGHT_GIRLS.percentile.yearly-88606367.js} +0 -0
- /package/build/{WEIGHT_GIRLS.zscore.monthly-b8a2d43b.js → WEIGHT_GIRLS.zscore.monthly-8ac01726.js} +0 -0
- /package/build/{WEIGHT_GIRLS.zscore.weekly-51f15303.js → WEIGHT_GIRLS.zscore.weekly-bda518a0.js} +0 -0
- /package/build/{WEIGHT_GIRLS.zscore.yearly-415922de.js → WEIGHT_GIRLS.zscore.yearly-c8521c02.js} +0 -0
- /package/build/{animation-1dff46f2.js → animation-953a4127.js} +0 -0
- /package/build/{constants-fcc28c66.js → constants-1416f348.js} +0 -0
- /package/build/{constants-a59bae5a.js → constants-32022ceb.js} +0 -0
- /package/build/{constants-1459a83e.js → constants-49711f56.js} +0 -0
- /package/build/{dataTransform-e813ed6a.js → dataTransform-4de10d58.js} +0 -0
- /package/build/{doctor-cb7a7cfc.js → doctor-3bc8f39e.js} +0 -0
- /package/build/esm/{BMI_BOYS.percentile.monthly-f3c22ef1.js → BMI_BOYS.percentile.monthly-01cdb562.js} +0 -0
- /package/build/esm/{BMI_BOYS.percentile.weekly-318e11ef.js → BMI_BOYS.percentile.weekly-8893dd3e.js} +0 -0
- /package/build/esm/{BMI_BOYS.percentile.yearly-d8aa6920.js → BMI_BOYS.percentile.yearly-9d4b69c9.js} +0 -0
- /package/build/esm/{BMI_BOYS.zscore.monthly-fa3be4d9.js → BMI_BOYS.zscore.monthly-c6671ee4.js} +0 -0
- /package/build/esm/{BMI_BOYS.zscore.weekly-9606a55c.js → BMI_BOYS.zscore.weekly-92e1d131.js} +0 -0
- /package/build/esm/{BMI_BOYS.zscore.yearly-4779c33b.js → BMI_BOYS.zscore.yearly-05bbdd7b.js} +0 -0
- /package/build/esm/{BMI_GIRLS.percentile.monthly-8d7bff9c.js → BMI_GIRLS.percentile.monthly-ec51639e.js} +0 -0
- /package/build/esm/{BMI_GIRLS.percentile.weekly-04fe9074.js → BMI_GIRLS.percentile.weekly-7c0c8b4a.js} +0 -0
- /package/build/esm/{BMI_GIRLS.percentile.yearly-815d739d.js → BMI_GIRLS.percentile.yearly-6cc143f2.js} +0 -0
- /package/build/esm/{BMI_GIRLS.zscore.monthly-893015d6.js → BMI_GIRLS.zscore.monthly-1f018468.js} +0 -0
- /package/build/esm/{BMI_GIRLS.zscore.weekly-cc80e658.js → BMI_GIRLS.zscore.weekly-af5a4b2b.js} +0 -0
- /package/build/esm/{BMI_GIRLS.zscore.yearly-6a80cde6.js → BMI_GIRLS.zscore.yearly-c7a07f25.js} +0 -0
- /package/build/esm/{ChevronDown-948cd754.js → ChevronDown-42f671e1.js} +0 -0
- /package/build/esm/{Close-79f9c8c5.js → Close-5e54b2d5.js} +0 -0
- /package/build/esm/{Google-04b6682f.js → Google-6652e3bc.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.percentile.monthly-9d0248e5.js → HEAD CIRCUM_BOYS.percentile.monthly-7e66fc3a.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.percentile.weekly-a776948c.js → HEAD CIRCUM_BOYS.percentile.weekly-64473467.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.percentile.yearly-c99a242d.js → HEAD CIRCUM_BOYS.percentile.yearly-08606ae2.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.zscore.monthly-c94643ef.js → HEAD CIRCUM_BOYS.zscore.monthly-4e140e3f.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.zscore.weekly-cdf1ea50.js → HEAD CIRCUM_BOYS.zscore.weekly-4e1b5770.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.zscore.yearly-9f4d04da.js → HEAD CIRCUM_BOYS.zscore.yearly-0dec10da.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.monthly-d0b2ff79.js → HEAD CIRCUM_GIRLS.percentile.monthly-d18303ca.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.weekly-4f6856df.js → HEAD CIRCUM_GIRLS.percentile.weekly-55770071.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.yearly-936dabd2.js → HEAD CIRCUM_GIRLS.percentile.yearly-25e4a2c9.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.monthly-f503bf4f.js → HEAD CIRCUM_GIRLS.zscore.monthly-d33b6246.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.weekly-a9355b2d.js → HEAD CIRCUM_GIRLS.zscore.weekly-abef6f22.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.yearly-795bffd6.js → HEAD CIRCUM_GIRLS.zscore.yearly-444bc2b4.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.percentile.monthly-693d85ff.js → HEIGHT_BOYS.percentile.monthly-dc5d6faf.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.percentile.weekly-a778d94d.js → HEIGHT_BOYS.percentile.weekly-75b1b9f1.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.percentile.yearly-9cf0eb3b.js → HEIGHT_BOYS.percentile.yearly-bc5c7a34.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.zscore.monthly-7a32dbec.js → HEIGHT_BOYS.zscore.monthly-bbad4abb.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.zscore.weekly-01d778a3.js → HEIGHT_BOYS.zscore.weekly-736c87b3.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.zscore.yearly-f9c8fc3e.js → HEIGHT_BOYS.zscore.yearly-31f0f935.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.percentile.monthly-9966ef76.js → HEIGHT_GIRLS.percentile.monthly-95c5c1fc.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.percentile.weekly-94548ffe.js → HEIGHT_GIRLS.percentile.weekly-12d97ac4.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.percentile.yearly-a03dc269.js → HEIGHT_GIRLS.percentile.yearly-c188d8d7.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.zscore.monthly-557a853d.js → HEIGHT_GIRLS.zscore.monthly-2885a84f.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.zscore.weekly-bfad8a41.js → HEIGHT_GIRLS.zscore.weekly-4623c6b8.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.zscore.yearly-82208285.js → HEIGHT_GIRLS.zscore.yearly-0f241320.js} +0 -0
- /package/build/esm/{Locale-645224b1.js → Locale-cd9c33a3.js} +0 -0
- /package/build/esm/{Visible-6b232e0c.js → Visible-4b6153b5.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.percentile.monthly-c2ba61f3.js → WEIGHT_BOYS.percentile.monthly-52cbd675.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.percentile.weekly-a2227777.js → WEIGHT_BOYS.percentile.weekly-d9aebf61.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.percentile.yearly-aadf37bd.js → WEIGHT_BOYS.percentile.yearly-2f93ab0a.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.zscore.monthly-626abe60.js → WEIGHT_BOYS.zscore.monthly-249fcf8d.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.zscore.weekly-90f9c427.js → WEIGHT_BOYS.zscore.weekly-293fb368.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.zscore.yearly-5437ef19.js → WEIGHT_BOYS.zscore.yearly-ba2bba37.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.percentile.monthly-8162ecc6.js → WEIGHT_GIRLS.percentile.monthly-db69de41.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.percentile.weekly-487bcb64.js → WEIGHT_GIRLS.percentile.weekly-fb7303bc.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.percentile.yearly-faba19c1.js → WEIGHT_GIRLS.percentile.yearly-7604d8f5.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.zscore.monthly-c07f1793.js → WEIGHT_GIRLS.zscore.monthly-998a69bf.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.zscore.weekly-4bbce9e7.js → WEIGHT_GIRLS.zscore.weekly-468c577f.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.zscore.yearly-681a5574.js → WEIGHT_GIRLS.zscore.yearly-0f83301c.js} +0 -0
- /package/build/esm/{animation-2d0f4aa0.js → animation-3b7fbeb8.js} +0 -0
- /package/build/esm/{constants-d2a882e1.js → constants-56418598.js} +0 -0
- /package/build/esm/{constants-6036c3b5.js → constants-8550ea4b.js} +0 -0
- /package/build/esm/{constants-14911af0.js → constants-936d56a3.js} +0 -0
- /package/build/esm/{dataTransform-1e40a135.js → dataTransform-1365e4e2.js} +0 -0
- /package/build/esm/{doctor-72a2c028.js → doctor-933f26b5.js} +0 -0
- /package/build/esm/{index-8de8f7f0.js → index-0db4da34.js} +0 -0
- /package/build/esm/{index-f148865f.js → index-243908c8.js} +0 -0
- /package/build/esm/{index-83d3a9a2.js → index-578f4600.js} +0 -0
- /package/build/esm/{index-c3a24335.js → index-610d69af.js} +0 -0
- /package/build/esm/{index-ed07bb88.js → index-66938a55.js} +0 -0
- /package/build/esm/{index-7f8c17be.js → index-a318c025.js} +0 -0
- /package/build/esm/{index-558cb332.js → index-cb171154.js} +0 -0
- /package/build/esm/{index-3c4f726d.js → index-f44c62ca.js} +0 -0
- /package/build/esm/{index.styles-0dbdf2b4.js → index.styles-4a412578.js} +0 -0
- /package/build/esm/{localizeNumberFormat-59a95171.js → localizeNumberFormat-79aefc62.js} +0 -0
- /package/build/esm/{normalizeLink-ced8b6a3.js → normalizeLink-69a06b00.js} +0 -0
- /package/build/esm/{number-4eedb3fc.js → number-7472b20c.js} +0 -0
- /package/build/esm/{other-68ac8404.js → other-756a8244.js} +0 -0
- /package/build/esm/{paths-193824df.js → paths-f75a5925.js} +0 -0
- /package/build/esm/{translationsContext-dccf2103.js → translationsContext-1df74fcc.js} +0 -0
- /package/build/esm/{tslib.es6-ae8d1850.js → tslib.es6-6b8750ce.js} +0 -0
- /package/build/esm/{types-32c72a0c.js → types-160c2989.js} +0 -0
- /package/build/esm/{useIsInit-f2ba6b67.js → useIsInit-9df1e8e2.js} +0 -0
- /package/build/esm/{useOutsideClick-9ce3c0f0.js → useOutsideClick-1023869e.js} +0 -0
- /package/build/esm/{useScrollbarSize-4c4c3eaa.js → useScrollbarSize-0adaf38c.js} +0 -0
- /package/build/esm/{useUniqueId-f1f0c8a8.js → useUniqueId-0d0b484a.js} +0 -0
- /package/build/esm/{utils-6ab4908f.js → utils-ee78bcad.js} +0 -0
- /package/build/{index-86c58f8b.js → index-215c8c86.js} +0 -0
- /package/build/{index-e6b1775d.js → index-39692ed5.js} +0 -0
- /package/build/{index-4ea44e96.js → index-51127a60.js} +0 -0
- /package/build/{index-4520c363.js → index-6602fed3.js} +0 -0
- /package/build/{index-f6aa6d45.js → index-6b6c86d5.js} +0 -0
- /package/build/{index-560b56b1.js → index-7155ed17.js} +0 -0
- /package/build/{index-8497154e.js → index-e80a72b8.js} +0 -0
- /package/build/{index-da3e2cd5.js → index-f73f06bf.js} +0 -0
- /package/build/{index.styles-330e816a.js → index.styles-01d7e5fb.js} +0 -0
- /package/build/{localizeNumberFormat-5db51302.js → localizeNumberFormat-18110dda.js} +0 -0
- /package/build/{normalizeLink-733224f2.js → normalizeLink-b8d7fe5a.js} +0 -0
- /package/build/{number-2aa5b606.js → number-94987413.js} +0 -0
- /package/build/{other-000eae02.js → other-23c85ba5.js} +0 -0
- /package/build/{paths-48b12f16.js → paths-2de4f842.js} +0 -0
- /package/build/{translationsContext-ac71e4c7.js → translationsContext-55646101.js} +0 -0
- /package/build/{tslib.es6-217a5733.js → tslib.es6-a4e6f6fe.js} +0 -0
- /package/build/{types-4a912ba2.js → types-a7667594.js} +0 -0
- /package/build/{useIsInit-09ae2cfc.js → useIsInit-407bd907.js} +0 -0
- /package/build/{useOutsideClick-c405fe35.js → useOutsideClick-205a8b3e.js} +0 -0
- /package/build/{useScrollbarSize-979f36e2.js → useScrollbarSize-ff4a550a.js} +0 -0
- /package/build/{useUniqueId-391fa11f.js → useUniqueId-188a010a.js} +0 -0
- /package/build/{utils-3b6801b1.js → utils-eb50a5d6.js} +0 -0
package/build/esm/lead.js
CHANGED
|
@@ -1,73 +1,52 @@
|
|
|
1
|
-
import { _ as __rest, a as __awaiter } from './tslib.es6-
|
|
2
|
-
import React__default, { createContext, useMemo, useEffect, useRef, useState, useContext, useCallback
|
|
3
|
-
import { createStyles, Box, Button as Button$1,
|
|
1
|
+
import { _ as __rest, a as __awaiter } from './tslib.es6-6b8750ce.js';
|
|
2
|
+
import React__default, { createContext, useMemo, useEffect, useRef, useState, useContext, useCallback } from 'react';
|
|
3
|
+
import { createStyles, Box, Button as Button$1, Autocomplete, clsx, Input as Input$1, TextInput, NumberInput as NumberInput$1, Portal, Transition, Overlay } from '@mantine/core';
|
|
4
4
|
import dayjs from 'dayjs';
|
|
5
5
|
import debounce from 'lodash/debounce';
|
|
6
|
-
import { createFormContext
|
|
7
|
-
import {
|
|
6
|
+
import { createFormContext } from '@mantine/form';
|
|
7
|
+
import { u as useTranslations } from './index-ad8d1314.js';
|
|
8
|
+
import { T as TranslationsContext } from './translationsContext-1df74fcc.js';
|
|
8
9
|
import { getCookie, setCookie } from './miscCookieHelper.js';
|
|
9
|
-
import {
|
|
10
|
-
import { T as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
import { B as Button } from './index-91a9cf15.js';
|
|
16
|
-
import './index.styles-0dbdf2b4.js';
|
|
10
|
+
import { b as getWrapperDomWithSelector, a as getPopupWrapperDom } from './utils-ee78bcad.js';
|
|
11
|
+
import { T as Text } from './index-c3500f4e.js';
|
|
12
|
+
import { S as Select, d as Checkbox, I as Input, R as Radio, P as Phone, N as NumberInput, O as OTP } from './index-07b81bb7.js';
|
|
13
|
+
import { D as DatePicker } from './index-7e78248e.js';
|
|
14
|
+
import { B as Button } from './index-0a217701.js';
|
|
15
|
+
import './index.styles-4a412578.js';
|
|
17
16
|
import { useClickOutside } from '@mantine/hooks';
|
|
18
|
-
import './useMantineLocale-
|
|
19
|
-
import { C as COMMON_DATE_TRANSLATE_KEY } from './index-
|
|
20
|
-
import './index-
|
|
21
|
-
import { Z as ZINDEX_SSO, I as ISO_FORMAT } from './index-
|
|
22
|
-
import './other-
|
|
23
|
-
import './index-
|
|
24
|
-
import { M as MAPPED_LOCALE } from './utils-
|
|
25
|
-
import
|
|
26
|
-
import { u as usePlacesAutocomplete, G as GOOGLE_API_KEY } from './usePlacesAutocomplete-
|
|
27
|
-
import { H as Heading$1 } from './index-
|
|
28
|
-
import { t as translationsMap$1 } from './translationsProvider-dac81da4.js';
|
|
29
|
-
import { L as LOCALE } from './Locale-645224b1.js';
|
|
17
|
+
import './useMantineLocale-27cbe6c8.js';
|
|
18
|
+
import { C as COMMON_DATE_TRANSLATE_KEY } from './index-cd5faa30.js';
|
|
19
|
+
import './index-a318c025.js';
|
|
20
|
+
import { Z as ZINDEX_SSO, I as ISO_FORMAT } from './index-5e6dc6db.js';
|
|
21
|
+
import './other-756a8244.js';
|
|
22
|
+
import './index-388b5a52.js';
|
|
23
|
+
import { M as MAPPED_LOCALE } from './utils-c1df8b61.js';
|
|
24
|
+
import '@mantine/dates';
|
|
25
|
+
import { u as usePlacesAutocomplete, G as GOOGLE_API_KEY } from './usePlacesAutocomplete-b2c58eae.js';
|
|
26
|
+
import { H as Heading$1 } from './index-1fd83190.js';
|
|
30
27
|
import { v1 } from 'uuid';
|
|
31
|
-
import {
|
|
28
|
+
import { i as isVideo } from './index-66938a55.js';
|
|
29
|
+
import { D as DrawerComponent } from './index-4ba59648.js';
|
|
30
|
+
import { u as useScreenSize } from './useScreenSize-9f683ab9.js';
|
|
31
|
+
import { createPortal } from 'react-dom';
|
|
32
|
+
import { css } from '@emotion/react';
|
|
32
33
|
import styled from '@emotion/styled';
|
|
33
34
|
import { theme } from './miscTheme.js';
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import { D as DrawerComponent } from './index-bb401984.js';
|
|
38
|
-
import { u as useScreenSize } from './useScreenSize-e7eac93f.js';
|
|
39
|
-
import { createPortal } from 'react-dom';
|
|
40
|
-
import { B as Button$2 } from './index-96f04c6f.js';
|
|
41
|
-
import { I as InputDate } from './InputDate-2d1744e8.js';
|
|
42
|
-
import { C as Close } from './Close-79f9c8c5.js';
|
|
43
|
-
import './constantsIsProduction.js';
|
|
44
|
-
import './normalizeLink-ced8b6a3.js';
|
|
45
|
-
import './constantsDomainLocales.js';
|
|
35
|
+
import { B as Button$2 } from './index-0e19d192.js';
|
|
36
|
+
import { I as InputDate } from './InputDate-c0b788ac.js';
|
|
37
|
+
import { C as Close } from './Close-5e54b2d5.js';
|
|
46
38
|
import '@hhgtech/icons/other';
|
|
47
39
|
import '@mantine/carousel';
|
|
40
|
+
import './Locale-cd9c33a3.js';
|
|
48
41
|
import 'classnames';
|
|
49
|
-
import './useUniqueId-
|
|
42
|
+
import './useUniqueId-0d0b484a.js';
|
|
50
43
|
import './constantsSite.js';
|
|
51
44
|
import '@hhgtech/icons/core';
|
|
52
45
|
import '@mantine/notifications';
|
|
46
|
+
import './constantsDomainLocales.js';
|
|
47
|
+
import './constantsIsProduction.js';
|
|
53
48
|
import 'date-fns/locale';
|
|
54
49
|
import './constantsRiskScreener.js';
|
|
55
|
-
import './i18n-values/en-PH.js';
|
|
56
|
-
import './i18n-values/hi-IN.js';
|
|
57
|
-
import './i18n-values/id-ID.js';
|
|
58
|
-
import './i18n-values/km-KH.js';
|
|
59
|
-
import './i18n-values/ms-MY.js';
|
|
60
|
-
import './i18n-values/my-MM.js';
|
|
61
|
-
import './i18n-values/th-TH.js';
|
|
62
|
-
import './i18n-values/tl-PH.js';
|
|
63
|
-
import './i18n-values/vi-VN.js';
|
|
64
|
-
import './i18n-values/vi-VN_MB.js';
|
|
65
|
-
import './i18n-values/zh-TW.js';
|
|
66
|
-
import './index-558cb332.js';
|
|
67
|
-
import 'slugify';
|
|
68
|
-
import 'string-format';
|
|
69
|
-
import './togetherApiPaths.js';
|
|
70
|
-
import './constants-14911af0.js';
|
|
71
50
|
import 'vaul';
|
|
72
51
|
|
|
73
52
|
const LeadGenComponentContext = createContext({});
|
|
@@ -94,7 +73,7 @@ if (sessionStorage.getItem('insider_object')) {
|
|
|
94
73
|
}
|
|
95
74
|
const docLang = document.documentElement.lang;
|
|
96
75
|
// TODO: country code
|
|
97
|
-
const LEAD_LOCALE_DATA
|
|
76
|
+
const LEAD_LOCALE_DATA = {
|
|
98
77
|
'vi-VN': {
|
|
99
78
|
popupLang: 'vi',
|
|
100
79
|
countryCode: 'vn',
|
|
@@ -136,7 +115,7 @@ const LEAD_LOCALE_DATA$1 = {
|
|
|
136
115
|
countryCodeNumber: 91,
|
|
137
116
|
},
|
|
138
117
|
};
|
|
139
|
-
const LEAD_LOCALE = LEAD_LOCALE_DATA
|
|
118
|
+
const LEAD_LOCALE = LEAD_LOCALE_DATA[docLang] || LEAD_LOCALE_DATA['vi-VN'];
|
|
140
119
|
function LEAD_RESET_VAR() {
|
|
141
120
|
// LEAD_CURRENT_URL = location.href.toLowerCase();
|
|
142
121
|
LEAD_CURRENT_URL =
|
|
@@ -157,11 +136,6 @@ const LEAD_TIMEZONE_DATA = {
|
|
|
157
136
|
9: 'Asia/Manila', // Philippines / Filipinos Site
|
|
158
137
|
};
|
|
159
138
|
|
|
160
|
-
const LEADGEN_ACTIONS = {
|
|
161
|
-
SHOW: 'SHOW',
|
|
162
|
-
SCROLL: 'SCROLL',
|
|
163
|
-
TIME: 'TIME',
|
|
164
|
-
};
|
|
165
139
|
const LEADGEN_LAYOUT = {
|
|
166
140
|
LightBoxA: 'LightBoxA',
|
|
167
141
|
LightBoxB: 'LightBoxB',
|
|
@@ -191,10 +165,8 @@ const LEADGEN_BLOCK = {
|
|
|
191
165
|
DropdownBlock: 'DropdownBlock',
|
|
192
166
|
CheckboxBlock: 'CheckboxBlock',
|
|
193
167
|
TncBlock: 'TncBlock',
|
|
194
|
-
TitleBlock: 'TitleBlock',
|
|
195
|
-
SubtitleBlock: 'SubtitleBlock',
|
|
196
168
|
};
|
|
197
|
-
const
|
|
169
|
+
const LEADGEN_BLOCK_IN_FORM = [
|
|
198
170
|
LEADGEN_BLOCK.TextBlock,
|
|
199
171
|
LEADGEN_BLOCK.NumberBlock,
|
|
200
172
|
LEADGEN_BLOCK.DateBlock,
|
|
@@ -209,59 +181,7 @@ const LEADGEN_BLOCK_INPUT = [
|
|
|
209
181
|
LEADGEN_BLOCK.CheckboxBlock,
|
|
210
182
|
LEADGEN_BLOCK.TncBlock,
|
|
211
183
|
];
|
|
212
|
-
const leadGenFieldNamePhone = (listBlockAdded) => {
|
|
213
|
-
return listBlockAdded
|
|
214
|
-
.filter(({ name }) => [
|
|
215
|
-
LEADGEN_BLOCK.PhoneBlock,
|
|
216
|
-
LEADGEN_BLOCK.PhoneOtpBlock,
|
|
217
|
-
LEADGEN_BLOCK.WhatsappOtpBlock,
|
|
218
|
-
LEADGEN_BLOCK.ZaloOtpBlock,
|
|
219
|
-
].includes(name))
|
|
220
|
-
.map(({ data }) => data.value);
|
|
221
|
-
};
|
|
222
184
|
const SSO_MAP_LEAD = ['name', 'email', 'birthday', 'phone', 'gender'];
|
|
223
|
-
const LEAD_LOCALE_DATA = {
|
|
224
|
-
'vi-VN': {
|
|
225
|
-
popupLang: 'vi',
|
|
226
|
-
countryCode: 'vn',
|
|
227
|
-
countryCodeNumber: 84,
|
|
228
|
-
},
|
|
229
|
-
'id-ID': {
|
|
230
|
-
popupLang: 'id',
|
|
231
|
-
countryCode: 'id',
|
|
232
|
-
countryCodeNumber: 62,
|
|
233
|
-
},
|
|
234
|
-
'th-TH': {
|
|
235
|
-
popupLang: 'th',
|
|
236
|
-
countryCode: 'th',
|
|
237
|
-
countryCodeNumber: 66,
|
|
238
|
-
},
|
|
239
|
-
'ms-MY': {
|
|
240
|
-
popupLang: 'ms',
|
|
241
|
-
countryCode: 'my',
|
|
242
|
-
countryCodeNumber: 60,
|
|
243
|
-
},
|
|
244
|
-
'zh-TW': {
|
|
245
|
-
popupLang: 'zh',
|
|
246
|
-
countryCode: 'tw',
|
|
247
|
-
countryCodeNumber: 886,
|
|
248
|
-
},
|
|
249
|
-
'km-KH': {
|
|
250
|
-
popupLang: 'km',
|
|
251
|
-
countryCode: 'kh',
|
|
252
|
-
countryCodeNumber: 855,
|
|
253
|
-
},
|
|
254
|
-
'my-MM': {
|
|
255
|
-
popupLang: 'my',
|
|
256
|
-
countryCode: 'mm',
|
|
257
|
-
countryCodeNumber: 95,
|
|
258
|
-
},
|
|
259
|
-
'hi-IN': {
|
|
260
|
-
popupLang: 'hi',
|
|
261
|
-
countryCode: 'in',
|
|
262
|
-
countryCodeNumber: 91,
|
|
263
|
-
},
|
|
264
|
-
};
|
|
265
185
|
const mappingSSOToLead = (userInfoProps) => {
|
|
266
186
|
var _a, _b;
|
|
267
187
|
try {
|
|
@@ -277,7 +197,7 @@ const mappingSSOToLead = (userInfoProps) => {
|
|
|
277
197
|
if (ssoKey === 'birthday') {
|
|
278
198
|
const dob = dayjs(initValue, 'YYYY-MM-DD', true);
|
|
279
199
|
if (dob.isValid()) {
|
|
280
|
-
user.birthday = dob
|
|
200
|
+
user.birthday = dob;
|
|
281
201
|
}
|
|
282
202
|
}
|
|
283
203
|
else if (ssoKey === 'gender') {
|
|
@@ -300,83 +220,16 @@ const mappingSSOToLead = (userInfoProps) => {
|
|
|
300
220
|
catch (error) {
|
|
301
221
|
return;
|
|
302
222
|
}
|
|
303
|
-
};
|
|
304
|
-
const formatCampaignDetail = (campaign) => {
|
|
305
|
-
if (!campaign) {
|
|
306
|
-
return {};
|
|
307
|
-
}
|
|
308
|
-
try {
|
|
309
|
-
const { extra_fields, thank_you_image } = campaign || {};
|
|
310
|
-
const { textBlocks: exTextBlocks, imageBlocks: exImageBlocks, listBlockAdded: exListBlockAdded, listBlockThankyou: exListBlockThankyou, actionBlocks: exActionBlocks, } = extra_fields;
|
|
311
|
-
const textBlocks = JSON.parse(exTextBlocks);
|
|
312
|
-
const imageBlocks = JSON.parse(exImageBlocks);
|
|
313
|
-
const listBlockAdded = JSON.parse(exListBlockAdded);
|
|
314
|
-
const listBlockThankyou = JSON.parse(exListBlockThankyou);
|
|
315
|
-
const actionBlocks = JSON.parse(exActionBlocks);
|
|
316
|
-
const ThankYouBlock = {
|
|
317
|
-
image: { src: thank_you_image },
|
|
318
|
-
};
|
|
319
|
-
listBlockThankyou.forEach((block) => {
|
|
320
|
-
const { name, data } = block || {};
|
|
321
|
-
const { value: htmlText, align, newtab, url } = data || {};
|
|
322
|
-
switch (name) {
|
|
323
|
-
case LEADGEN_BLOCK.TitleBlock: {
|
|
324
|
-
ThankYouBlock.title = { htmlText, align };
|
|
325
|
-
}
|
|
326
|
-
case LEADGEN_BLOCK.SubtitleBlock: {
|
|
327
|
-
ThankYouBlock.description = { htmlText, align };
|
|
328
|
-
}
|
|
329
|
-
case LEADGEN_BLOCK.LinkButtonBlock: {
|
|
330
|
-
ThankYouBlock.button = { htmlText, newtab, url };
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
});
|
|
334
|
-
return Object.assign(Object.assign({}, campaign), { extra_fields: Object.assign(Object.assign({}, extra_fields), { textBlocks,
|
|
335
|
-
imageBlocks,
|
|
336
|
-
listBlockAdded,
|
|
337
|
-
listBlockThankyou,
|
|
338
|
-
actionBlocks }), ThankYouBlock });
|
|
339
|
-
}
|
|
340
|
-
catch (error) {
|
|
341
|
-
return {};
|
|
342
|
-
}
|
|
343
223
|
};
|
|
344
224
|
|
|
345
225
|
class Store {
|
|
346
226
|
constructor() {
|
|
347
|
-
this.apiSsoUrl = 'https://staging-id.hellobacsi.com/';
|
|
348
227
|
this.apiLeadUrl = 'https://dev.leadgen.hellobacsi.com/';
|
|
349
228
|
this.apiSubotUrl = 'https://staging-service-subot.hellohealthgroup.com/';
|
|
350
229
|
}
|
|
351
230
|
}
|
|
352
231
|
const leadStore = new Store();
|
|
353
232
|
|
|
354
|
-
const METHOD = {
|
|
355
|
-
GET: 'get',
|
|
356
|
-
POST: 'POST',
|
|
357
|
-
};
|
|
358
|
-
const LEADGEN_API_PATH = {
|
|
359
|
-
V2_CAMPAIGN: 'api/v2/campaign',
|
|
360
|
-
V2_SUBSCRIPTION_LEAD: 'api/v2/subscription-box',
|
|
361
|
-
V2_SUBSCRIPTION_INFO: 'api/campaign/get-title',
|
|
362
|
-
};
|
|
363
|
-
const SSO_API_PATH = {
|
|
364
|
-
USER_UPDATE: 'api/user/update',
|
|
365
|
-
};
|
|
366
|
-
const ssoApi = {
|
|
367
|
-
call(_a) {
|
|
368
|
-
var { url, data } = _a, config = __rest(_a, ["url", "data"]);
|
|
369
|
-
const token = getCookie(BEARER_TOKEN_COOKIE);
|
|
370
|
-
config.body = JSON.stringify(data);
|
|
371
|
-
config.headers = {
|
|
372
|
-
'Content-Type': 'application/json',
|
|
373
|
-
Authorization: `Bearer ${token}`,
|
|
374
|
-
};
|
|
375
|
-
return fetch(`${leadStore.apiSsoUrl}${url}`, config)
|
|
376
|
-
.then((res) => res.json())
|
|
377
|
-
.catch(() => ({}));
|
|
378
|
-
},
|
|
379
|
-
};
|
|
380
233
|
const leadApi = {
|
|
381
234
|
call(_a) {
|
|
382
235
|
var { url, data = undefined } = _a, config = __rest(_a, ["url", "data"]);
|
|
@@ -480,54 +333,8 @@ const verifyOtpLead = ({ phone, otp, type, }) => {
|
|
|
480
333
|
},
|
|
481
334
|
});
|
|
482
335
|
};
|
|
483
|
-
const getCampaignByCode = (campaign_code) => {
|
|
484
|
-
return leadApi.call({
|
|
485
|
-
url: `${LEADGEN_API_PATH.V2_CAMPAIGN}/${campaign_code}`,
|
|
486
|
-
method: METHOD.GET,
|
|
487
|
-
});
|
|
488
|
-
};
|
|
489
|
-
const getSubscriptionBoxInfo = ({ category, site, }) => {
|
|
490
|
-
return leadApi.call({
|
|
491
|
-
url: `${LEADGEN_API_PATH.V2_SUBSCRIPTION_INFO}?category=${category}&site=${site}`,
|
|
492
|
-
method: METHOD.GET,
|
|
493
|
-
});
|
|
494
|
-
};
|
|
495
|
-
const postSubscriptionBoxLead = ({ data }) => {
|
|
496
|
-
return leadApi.call({
|
|
497
|
-
url: LEADGEN_API_PATH.V2_SUBSCRIPTION_LEAD,
|
|
498
|
-
method: METHOD.POST,
|
|
499
|
-
data,
|
|
500
|
-
});
|
|
501
|
-
};
|
|
502
|
-
const postUserInfoFromLeadGen = ({ name }) => {
|
|
503
|
-
return ssoApi.call({
|
|
504
|
-
url: SSO_API_PATH.USER_UPDATE,
|
|
505
|
-
method: METHOD.POST,
|
|
506
|
-
data: { name },
|
|
507
|
-
});
|
|
508
|
-
};
|
|
509
|
-
const campaignPostImpression = ({ code, action, title_article, ga_client_id, cookie_id, extra, url, referrer, }) => {
|
|
510
|
-
return leadApi.call({
|
|
511
|
-
url: `api/campaign/${code}/impression`,
|
|
512
|
-
method: METHOD.POST,
|
|
513
|
-
data: {
|
|
514
|
-
action,
|
|
515
|
-
title_article,
|
|
516
|
-
cookie_id,
|
|
517
|
-
ga_client_id,
|
|
518
|
-
url,
|
|
519
|
-
extra,
|
|
520
|
-
referrer,
|
|
521
|
-
},
|
|
522
|
-
});
|
|
523
|
-
};
|
|
524
336
|
const Service = {
|
|
525
337
|
campaignGetById,
|
|
526
|
-
getCampaignByCode,
|
|
527
|
-
getSubscriptionBoxInfo,
|
|
528
|
-
postSubscriptionBoxLead,
|
|
529
|
-
postUserInfoFromLeadGen,
|
|
530
|
-
campaignPostImpression,
|
|
531
338
|
validateEmailOrPhoneOnSubot,
|
|
532
339
|
validateEmailOrPhoneOnLeadGen,
|
|
533
340
|
validatePhoneNumberOnLeadGen,
|
|
@@ -867,7 +674,7 @@ const Description = (_a) => {
|
|
|
867
674
|
return description ? (React__default.createElement(Text, Object.assign({ size: "p3" }, rest), description)) : null;
|
|
868
675
|
};
|
|
869
676
|
|
|
870
|
-
const LeadGenContext
|
|
677
|
+
const LeadGenContext = createContext({});
|
|
871
678
|
|
|
872
679
|
var useStyles$2 = createStyles(() => {
|
|
873
680
|
return {
|
|
@@ -931,7 +738,7 @@ const SubtitleBlock$1 = ({ children, align, }) => (React__default.createElement(
|
|
|
931
738
|
const TitleBlock$1 = ({ children, align, }) => (React__default.createElement("h2", { className: `lead-modal__title ${'le-text-align-' + (align || '')} ${LEAD_CLASS}` }, children));
|
|
932
739
|
|
|
933
740
|
const Fields = ({ listBlockAdded, popupId, locale, onClose, onOtherSubmit, styles, classNames, popoverProps, }) => {
|
|
934
|
-
const { primaryColor } = useContext(LeadGenContext
|
|
741
|
+
const { primaryColor } = useContext(LeadGenContext);
|
|
935
742
|
const { classes, cx } = useStyles$2(undefined, {
|
|
936
743
|
name: 'LeadGen__Field',
|
|
937
744
|
styles,
|
|
@@ -1046,7 +853,7 @@ const Heading = (_a) => {
|
|
|
1046
853
|
|
|
1047
854
|
const FormComponent = ({ styles, className, classNames, fillInfo, popoverProps, submitProps, }) => {
|
|
1048
855
|
var _a;
|
|
1049
|
-
const { primaryColor } = useContext(LeadGenContext
|
|
856
|
+
const { primaryColor } = useContext(LeadGenContext);
|
|
1050
857
|
const { listBlockAdded, leadFormConfig: { form, validateObj }, validatingEmailRef, validatingPhoneRef, formRef, setFormRef, onClose, onOtherSubmit, actionBlocks, locale, setShowOtpPhone, onSubmit, } = useContext(LeadGenComponentContext);
|
|
1051
858
|
const { classes, cx } = useStyles$1(undefined, {
|
|
1052
859
|
name: 'LeadGen__FormComponent',
|
|
@@ -1561,1600 +1368,59 @@ const translationsMap = {
|
|
|
1561
1368
|
'tl-PH': enPH,
|
|
1562
1369
|
};
|
|
1563
1370
|
const getTranslations = (locale) => {
|
|
1564
|
-
const translations =
|
|
1371
|
+
const translations = translationsMap[locale];
|
|
1565
1372
|
if (translations) {
|
|
1566
1373
|
return translations;
|
|
1567
1374
|
}
|
|
1568
1375
|
return translationsMap['en-PH'];
|
|
1569
1376
|
};
|
|
1570
1377
|
|
|
1571
|
-
const
|
|
1572
|
-
const
|
|
1573
|
-
const
|
|
1574
|
-
|
|
1378
|
+
const useImageSize = (src) => {
|
|
1379
|
+
const [width, setWidth] = useState(16);
|
|
1380
|
+
const [height, setHeight] = useState(9);
|
|
1381
|
+
const [loaded, setLoaded] = useState(false);
|
|
1382
|
+
// load src image to get its width and height
|
|
1383
|
+
useEffect(() => {
|
|
1384
|
+
setLoaded(false);
|
|
1385
|
+
if (src) {
|
|
1386
|
+
const img = new Image();
|
|
1387
|
+
img.addEventListener('load', () => {
|
|
1388
|
+
setWidth(img.naturalWidth);
|
|
1389
|
+
setHeight(img.naturalHeight);
|
|
1390
|
+
setLoaded(true);
|
|
1391
|
+
});
|
|
1392
|
+
img.addEventListener('error', () => {
|
|
1393
|
+
setWidth(16);
|
|
1394
|
+
setHeight(9);
|
|
1395
|
+
setLoaded(true);
|
|
1396
|
+
});
|
|
1397
|
+
img.src = src;
|
|
1398
|
+
}
|
|
1399
|
+
else {
|
|
1400
|
+
setWidth(16);
|
|
1401
|
+
setHeight(9);
|
|
1402
|
+
setLoaded(true);
|
|
1403
|
+
}
|
|
1404
|
+
}, [src]);
|
|
1405
|
+
return {
|
|
1406
|
+
loaded,
|
|
1407
|
+
width,
|
|
1408
|
+
height,
|
|
1409
|
+
};
|
|
1575
1410
|
};
|
|
1576
1411
|
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
}
|
|
1587
|
-
const
|
|
1588
|
-
|
|
1589
|
-
for (let i = newArray.length - 1; i > 0; i--) {
|
|
1590
|
-
const j = Math.floor(Math.random() * (i + 1));
|
|
1591
|
-
const temp = newArray[i];
|
|
1592
|
-
newArray[i] = newArray[j];
|
|
1593
|
-
newArray[j] = temp;
|
|
1594
|
-
}
|
|
1595
|
-
return newArray;
|
|
1596
|
-
};
|
|
1597
|
-
const getTimeByTimezone = (timeZone = 'UTC') => {
|
|
1598
|
-
const date = new Date();
|
|
1599
|
-
return new Date(date.toLocaleString('en-US', { timeZone }));
|
|
1600
|
-
};
|
|
1601
|
-
const parseDateByCampaignTime = (dateStr) => {
|
|
1602
|
-
// Format like this: 2023-04-04 00:00:00
|
|
1603
|
-
try {
|
|
1604
|
-
const [datePart, timePart] = dateStr.split(' ');
|
|
1605
|
-
const [year, month, day] = datePart.split('-').map(Number);
|
|
1606
|
-
const [hours, minutes, seconds] = timePart.split(':').map(Number);
|
|
1607
|
-
/** JavaScript counts months from 0 to 11 */
|
|
1608
|
-
return new Date(year, month - 1, day, hours, minutes, seconds);
|
|
1609
|
-
}
|
|
1610
|
-
catch (err) {
|
|
1611
|
-
return null;
|
|
1612
|
-
}
|
|
1613
|
-
};
|
|
1614
|
-
const checkCampaignNowInTimeframe = (c) => {
|
|
1615
|
-
var _a;
|
|
1616
|
-
const siteId = ((_a = c.site) === null || _a === void 0 ? void 0 : _a.id) || 1;
|
|
1617
|
-
const startedAtStr = c.started_at;
|
|
1618
|
-
const endedAtStr = c.ended_at;
|
|
1619
|
-
const startedDate = parseDateByCampaignTime(startedAtStr);
|
|
1620
|
-
const endedDate = parseDateByCampaignTime(endedAtStr);
|
|
1621
|
-
if (!startedDate || !endedDate) {
|
|
1622
|
-
return false;
|
|
1623
|
-
}
|
|
1624
|
-
const timeZone = LEAD_TIMEZONE_DATA[siteId];
|
|
1625
|
-
const nowWithTimezoneMs = getTimeByTimezone(timeZone).getTime();
|
|
1626
|
-
if (nowWithTimezoneMs <= endedDate.getTime() &&
|
|
1627
|
-
nowWithTimezoneMs >= startedDate.getTime()) {
|
|
1628
|
-
listCampaignScheduledToActivated.push(c);
|
|
1629
|
-
return true;
|
|
1630
|
-
}
|
|
1631
|
-
return false;
|
|
1632
|
-
};
|
|
1633
|
-
function checkCampaignActiveButExpireAlready(c) {
|
|
1634
|
-
var _a;
|
|
1635
|
-
/** Do not setup timeframe for this campaign. No need to check */
|
|
1636
|
-
if (c.forever === 1) {
|
|
1637
|
-
return true;
|
|
1638
|
-
}
|
|
1639
|
-
const startedAtStr = c.started_at;
|
|
1640
|
-
const endedAtStr = c.ended_at;
|
|
1641
|
-
const startedDate = parseDateByCampaignTime(startedAtStr);
|
|
1642
|
-
const endedDate = parseDateByCampaignTime(endedAtStr);
|
|
1643
|
-
/** Do not setup timeframe for this campaign. No need to check */
|
|
1644
|
-
if (!startedDate || !endedDate) {
|
|
1645
|
-
return true;
|
|
1646
|
-
}
|
|
1647
|
-
const siteId = ((_a = c.site) === null || _a === void 0 ? void 0 : _a.id) || 1;
|
|
1648
|
-
const timeZone = LEAD_TIMEZONE_DATA[siteId];
|
|
1649
|
-
const nowWithTimezoneMs = getTimeByTimezone(timeZone).getTime();
|
|
1650
|
-
/** Check if this expire already, do not show */
|
|
1651
|
-
if (nowWithTimezoneMs > endedDate.getTime()) {
|
|
1652
|
-
listCampaignActiveButExpired.push(c);
|
|
1653
|
-
return false;
|
|
1654
|
-
}
|
|
1655
|
-
return true;
|
|
1656
|
-
}
|
|
1657
|
-
function shouldNotDisplayIfExcludeAllSponsors(c) {
|
|
1658
|
-
var _a;
|
|
1659
|
-
const excludeSponsored = Number((_a = c.rules.find((i) => i.rule == 'exclude_sponsored')) === null || _a === void 0 ? void 0 : _a.value);
|
|
1660
|
-
const isSponsored = Boolean(document.querySelector('.hhg-disclaimer-text'));
|
|
1661
|
-
if (isSponsored && excludeSponsored) {
|
|
1662
|
-
listCampaignExcludeSonsored.push(c);
|
|
1663
|
-
return true;
|
|
1664
|
-
}
|
|
1665
|
-
return false;
|
|
1666
|
-
}
|
|
1667
|
-
function shouldDisplayWithCurrentSponsor(c) {
|
|
1668
|
-
var _a, _b;
|
|
1669
|
-
try {
|
|
1670
|
-
// TODO: BE will rename `exclude_sponsored_list` later
|
|
1671
|
-
const stringOrArray = (_a = c.rules.find((i) => i.rule == 'exclude_sponsored_list')) === null || _a === void 0 ? void 0 : _a.value;
|
|
1672
|
-
const whiteListSponsors = stringOrArray instanceof Array ? stringOrArray : JSON.parse(stringOrArray);
|
|
1673
|
-
const dataSponsoredId = Number((_b = document
|
|
1674
|
-
.querySelector('[data-sponsored-id]')) === null || _b === void 0 ? void 0 : _b.getAttribute('data-sponsored-id'));
|
|
1675
|
-
// There is no config for sponsor id and white list, should show as default
|
|
1676
|
-
if (!dataSponsoredId ||
|
|
1677
|
-
dataSponsoredId <= 0 ||
|
|
1678
|
-
whiteListSponsors.length === 0) {
|
|
1679
|
-
return true;
|
|
1680
|
-
}
|
|
1681
|
-
// Check the dataSponsoredId exists in the white list or not.
|
|
1682
|
-
const isExist = whiteListSponsors.find((s) => s.id == dataSponsoredId);
|
|
1683
|
-
if (isExist) {
|
|
1684
|
-
return true;
|
|
1685
|
-
}
|
|
1686
|
-
listCampaignDifferentSponsor.push({ id: c.id, rules: c.rules });
|
|
1687
|
-
return false;
|
|
1688
|
-
}
|
|
1689
|
-
catch (err) {
|
|
1690
|
-
// Default is show
|
|
1691
|
-
return true;
|
|
1692
|
-
}
|
|
1693
|
-
}
|
|
1694
|
-
const filterFnCampaign = (c) => {
|
|
1695
|
-
if (shouldNotDisplayIfExcludeAllSponsors(c)) {
|
|
1696
|
-
return false;
|
|
1697
|
-
}
|
|
1698
|
-
else if (!shouldDisplayWithCurrentSponsor(c)) {
|
|
1699
|
-
return false;
|
|
1700
|
-
}
|
|
1701
|
-
/** Active */
|
|
1702
|
-
if (c.formatted_status === 1) {
|
|
1703
|
-
return checkCampaignActiveButExpireAlready(c);
|
|
1704
|
-
}
|
|
1705
|
-
/** Schedule */
|
|
1706
|
-
if (c.formatted_status === 0) {
|
|
1707
|
-
listCampaignScheduled.push(c);
|
|
1708
|
-
return checkCampaignNowInTimeframe(c);
|
|
1709
|
-
}
|
|
1710
|
-
return false;
|
|
1711
|
-
};
|
|
1712
|
-
const fillterApprearanceTimeCampaign = (c) => {
|
|
1713
|
-
var _a;
|
|
1714
|
-
try {
|
|
1715
|
-
const isTimeInRange = (currentTime, startTime, endTime) => {
|
|
1716
|
-
const startParts = startTime.split(':');
|
|
1717
|
-
const endParts = endTime.split(':');
|
|
1718
|
-
const startDate = new Date();
|
|
1719
|
-
startDate.setHours(Number(startParts[0]), Number(startParts[1]), 0, 0);
|
|
1720
|
-
const endDate = new Date();
|
|
1721
|
-
endDate.setHours(Number(endParts[0]), Number(endParts[1]), 0, 0);
|
|
1722
|
-
return currentTime >= startDate && currentTime <= endDate;
|
|
1723
|
-
};
|
|
1724
|
-
const rulesApprValue = (_a = c.rules.find((i) => i.rule == 'appearance_time')) === null || _a === void 0 ? void 0 : _a.value;
|
|
1725
|
-
const startTime = rulesApprValue.startTime;
|
|
1726
|
-
const endTime = rulesApprValue.endTime || '23:59';
|
|
1727
|
-
if (!startTime) {
|
|
1728
|
-
return true;
|
|
1729
|
-
}
|
|
1730
|
-
if (isTimeInRange(new Date(), startTime, endTime)) {
|
|
1731
|
-
return true;
|
|
1732
|
-
}
|
|
1733
|
-
listCampaignNotDisplayInRangeOfTime.push(c);
|
|
1734
|
-
return false;
|
|
1735
|
-
}
|
|
1736
|
-
catch (err) {
|
|
1737
|
-
return true;
|
|
1738
|
-
}
|
|
1739
|
-
};
|
|
1740
|
-
let timeoutRef = null;
|
|
1741
|
-
let LEAD_SCROLL_EVENT = null;
|
|
1742
|
-
function clearPassiveEvent() {
|
|
1743
|
-
if (timeoutRef) {
|
|
1744
|
-
clearTimeout(timeoutRef);
|
|
1745
|
-
timeoutRef = null;
|
|
1746
|
-
}
|
|
1747
|
-
if (LEAD_SCROLL_EVENT) {
|
|
1748
|
-
window.removeEventListener('scroll', LEAD_SCROLL_EVENT);
|
|
1749
|
-
LEAD_SCROLL_EVENT = null;
|
|
1750
|
-
}
|
|
1751
|
-
}
|
|
1752
|
-
function checkShowPopup({ leadApi, leadSiteId, leadDomain, onShowPopup, DEBUG_URL, }) {
|
|
1753
|
-
// clear previous passive event, check for new condition
|
|
1754
|
-
clearPassiveEvent();
|
|
1755
|
-
const leadCurrentUrl = DEBUG_URL ||
|
|
1756
|
-
('https://' +
|
|
1757
|
-
location.hostname +
|
|
1758
|
-
location.pathname +
|
|
1759
|
-
location.search).toLowerCase();
|
|
1760
|
-
fetch(leadApi + 'api/campaign/' + leadSiteId, {
|
|
1761
|
-
method: 'POST',
|
|
1762
|
-
headers: {
|
|
1763
|
-
'Content-Type': 'application/json',
|
|
1764
|
-
},
|
|
1765
|
-
body: JSON.stringify({
|
|
1766
|
-
url: leadCurrentUrl,
|
|
1767
|
-
ga_client_id: getCookie('_ga') || null,
|
|
1768
|
-
}),
|
|
1769
|
-
})
|
|
1770
|
-
.then((response) => {
|
|
1771
|
-
return response.json();
|
|
1772
|
-
// return mockLeadData || response.json()
|
|
1773
|
-
})
|
|
1774
|
-
.then((data) => {
|
|
1775
|
-
var _a, _b, _c, _d;
|
|
1776
|
-
LeadLog('List campagin: ', data);
|
|
1777
|
-
LEAD_RESET_VAR();
|
|
1778
|
-
if (data._status == 1) {
|
|
1779
|
-
const campaigns = (((_b = (_a = data._data) === null || _a === void 0 ? void 0 : _a.campaigns) === null || _b === void 0 ? void 0 : _b.filter(filterFnCampaign)) || []).filter(fillterApprearanceTimeCampaign);
|
|
1780
|
-
if (!getCookie('hhg-id')) {
|
|
1781
|
-
setCookie('hhg-id', v1(), {
|
|
1782
|
-
domain: '.' + leadDomain,
|
|
1783
|
-
path: '/',
|
|
1784
|
-
});
|
|
1785
|
-
LeadLog('😍 Set HHG ID cookie');
|
|
1786
|
-
}
|
|
1787
|
-
// getCookie('hhg-id')
|
|
1788
|
-
// TODO: HP-534 Filter desktop
|
|
1789
|
-
let campaignsDevice = [];
|
|
1790
|
-
if (isMobile()) {
|
|
1791
|
-
campaignsDevice = campaigns.filter((c) => c.device_types.some((d) => d.id == LEAD_DEVICE_TYPE.MOBILE));
|
|
1792
|
-
}
|
|
1793
|
-
else {
|
|
1794
|
-
campaignsDevice = campaigns.filter((c) => c.device_types.some((d) => d.id == LEAD_DEVICE_TYPE.DESKTOP));
|
|
1795
|
-
}
|
|
1796
|
-
LeadLog(`👓 campaignsDevice`, campaignsDevice);
|
|
1797
|
-
LeadLog('--listCampaignScheduled', listCampaignScheduled);
|
|
1798
|
-
LeadLog('--listCampaignScheduledToActivated', listCampaignScheduledToActivated);
|
|
1799
|
-
LeadLog('--listCampaignActiveButExpired', listCampaignActiveButExpired);
|
|
1800
|
-
LeadLog('--listCampaignExcludeSonsored', listCampaignExcludeSonsored);
|
|
1801
|
-
LeadLog('--listCampaignDifferentSponsor', listCampaignDifferentSponsor);
|
|
1802
|
-
LeadLog('--listCampaignNotDisplayInRangeOfTime', listCampaignNotDisplayInRangeOfTime);
|
|
1803
|
-
// Check links
|
|
1804
|
-
let listLinksObj = campaignsDevice
|
|
1805
|
-
.map((i, index) => i.targets
|
|
1806
|
-
.filter((i) => i.type == CAMPAIGN_TARGET_TYPE.LINKS)
|
|
1807
|
-
.map((i) => (Object.assign(Object.assign({}, i), { campaignIndex: index }))))
|
|
1808
|
-
.flat(1);
|
|
1809
|
-
// Check list link match current href
|
|
1810
|
-
listLinksObj = listLinksObj.filter((i) => {
|
|
1811
|
-
var _a;
|
|
1812
|
-
const target = new URL(String(i.target).toLowerCase());
|
|
1813
|
-
if (i.option == 'exact_match')
|
|
1814
|
-
// FOR TEST LOCAL:
|
|
1815
|
-
// return Boolean(location.pathname === target.pathname)
|
|
1816
|
-
return Boolean(leadCurrentUrl === ((_a = target.href) === null || _a === void 0 ? void 0 : _a.toLowerCase()));
|
|
1817
|
-
if (i.option == 'start_with') {
|
|
1818
|
-
// FOR TEST LOCAL:
|
|
1819
|
-
// if (location.pathname.includes(target.pathname)) {
|
|
1820
|
-
if (leadCurrentUrl.includes(String(i.target).toLowerCase())) {
|
|
1821
|
-
const listExcluding = i.sub_target
|
|
1822
|
-
.filter((i) => i.option == 'excluding')
|
|
1823
|
-
.map((i) => { var _a; return (_a = i.value) === null || _a === void 0 ? void 0 : _a.toLowerCase(); });
|
|
1824
|
-
return !listExcluding.includes(leadCurrentUrl.split('?')[0]);
|
|
1825
|
-
}
|
|
1826
|
-
else {
|
|
1827
|
-
return false;
|
|
1828
|
-
}
|
|
1829
|
-
}
|
|
1830
|
-
});
|
|
1831
|
-
// Check tags
|
|
1832
|
-
const listMetaTag = Array.from(document.getElementsByTagName('META')).filter((i) => i.getAttribute('property') == 'article:tag');
|
|
1833
|
-
const listTags = listMetaTag.map((i) => i.content);
|
|
1834
|
-
let listCampaignHasTag = [];
|
|
1835
|
-
let listTagsObj = [];
|
|
1836
|
-
if (listTags && listTags.length) {
|
|
1837
|
-
listCampaignHasTag = campaignsDevice
|
|
1838
|
-
.map((i, index) => i.targets
|
|
1839
|
-
.filter((i) => i.type == CAMPAIGN_TARGET_TYPE.TAGS)
|
|
1840
|
-
.map((i) => (Object.assign(Object.assign({}, i), { campaignIndex: index }))))
|
|
1841
|
-
.flat(1);
|
|
1842
|
-
listTagsObj = listCampaignHasTag.filter((i) => listTags.includes(i.target));
|
|
1843
|
-
}
|
|
1844
|
-
const listCampaginsMatch = [...listLinksObj, ...listTagsObj];
|
|
1845
|
-
const cookieKeys = document.cookie
|
|
1846
|
-
.split('; ')
|
|
1847
|
-
.map((i) => i.split('=')[0]);
|
|
1848
|
-
const listCampaignCodeSubmited = cookieKeys.filter((i) => i.includes('lead_submited'));
|
|
1849
|
-
LeadLog(`--listCampaignCodeSubmited`, listCampaignCodeSubmited);
|
|
1850
|
-
const listCampaignCodeClosed = cookieKeys.filter((i) => i.includes('lead_closed'));
|
|
1851
|
-
LeadLog(`--listCampaignCodeClosed`, listCampaignCodeClosed);
|
|
1852
|
-
const listCampaignSubmitedClosed = [
|
|
1853
|
-
...listCampaignCodeSubmited,
|
|
1854
|
-
...listCampaignCodeClosed,
|
|
1855
|
-
];
|
|
1856
|
-
const listCampaignNoSubmitedClosed = listCampaginsMatch.filter((i) => {
|
|
1857
|
-
const hasSubmited = listCampaignSubmitedClosed.some((k) => k.includes(campaignsDevice[i.campaignIndex].code));
|
|
1858
|
-
return !hasSubmited;
|
|
1859
|
-
});
|
|
1860
|
-
const listCampaignValid = getShuffleArray(listCampaignNoSubmitedClosed);
|
|
1861
|
-
// .sort(
|
|
1862
|
-
// (a, b) =>
|
|
1863
|
-
// (listCampaignValid[a.campaignIndex]?.score || 0) -
|
|
1864
|
-
// (listCampaignValid[b.campaignIndex]?.score || 0),
|
|
1865
|
-
// )
|
|
1866
|
-
LeadLog('--listCampaignValid : ', listCampaignValid);
|
|
1867
|
-
if (listCampaignValid && listCampaignValid.length) {
|
|
1868
|
-
const CAMPAIGN_SHOW = campaignsDevice[listCampaignValid[0].campaignIndex];
|
|
1869
|
-
LeadLog(`CAMPAIGN_SHOW`, CAMPAIGN_SHOW);
|
|
1870
|
-
const { rules } = CAMPAIGN_SHOW;
|
|
1871
|
-
// CHECK RULE TRIGGER POPUP
|
|
1872
|
-
const timeoutRule = Number((_c = rules.find((i) => i.rule == 'time')) === null || _c === void 0 ? void 0 : _c.value);
|
|
1873
|
-
LeadLog(`timeoutRule`, timeoutRule);
|
|
1874
|
-
const scrollRule = Number((_d = rules.find((i) => i.rule == 'scroll')) === null || _d === void 0 ? void 0 : _d.value);
|
|
1875
|
-
LeadLog(`scrollRule`, scrollRule);
|
|
1876
|
-
let impressionAction = 'TIME';
|
|
1877
|
-
if (Number.isInteger(timeoutRule)) {
|
|
1878
|
-
impressionAction = 'TIME';
|
|
1879
|
-
LeadLog('✨ SHOW AWESOME POPUP AFTER: ', timeoutRule, ' seconds');
|
|
1880
|
-
timeoutRef = setTimeout(() => {
|
|
1881
|
-
onShowPopup === null || onShowPopup === void 0 ? void 0 : onShowPopup(CAMPAIGN_SHOW, impressionAction);
|
|
1882
|
-
}, timeoutRule * 1000);
|
|
1883
|
-
}
|
|
1884
|
-
if (Number.isInteger(scrollRule)) {
|
|
1885
|
-
impressionAction = 'SCROLL';
|
|
1886
|
-
LeadLog('✨ SHOW AWESOME AFTER: SCROLL', scrollRule, ' %');
|
|
1887
|
-
const $p = document.querySelector(`[data-url="${location.pathname}"]`) ||
|
|
1888
|
-
document.querySelector('body');
|
|
1889
|
-
const pct = $p.getBoundingClientRect().top;
|
|
1890
|
-
const pb = $p.offsetHeight;
|
|
1891
|
-
LeadLog(`👓 Element check scroll: `, $p);
|
|
1892
|
-
LEAD_SCROLL_EVENT = function leadScollCheckHandler() {
|
|
1893
|
-
const wt = window.pageYOffset || document.documentElement.scrollTop;
|
|
1894
|
-
let percent = 0;
|
|
1895
|
-
if (wt >= pct) {
|
|
1896
|
-
percent = Math.round(((wt - pct) / (pb - innerHeight)) * 100);
|
|
1897
|
-
}
|
|
1898
|
-
LeadLog('---Scroll', percent, scrollRule);
|
|
1899
|
-
// TODO: CHECK FOOTER HEIGHT
|
|
1900
|
-
if (percent >= scrollRule) {
|
|
1901
|
-
window.removeEventListener('scroll', LEAD_SCROLL_EVENT);
|
|
1902
|
-
onShowPopup === null || onShowPopup === void 0 ? void 0 : onShowPopup(CAMPAIGN_SHOW, impressionAction);
|
|
1903
|
-
}
|
|
1904
|
-
};
|
|
1905
|
-
window.addEventListener('scroll', LEAD_SCROLL_EVENT, {
|
|
1906
|
-
passive: true,
|
|
1907
|
-
});
|
|
1908
|
-
}
|
|
1909
|
-
}
|
|
1910
|
-
else {
|
|
1911
|
-
LeadLog('🚧 No lead campaigns on current URL, tags');
|
|
1912
|
-
}
|
|
1913
|
-
}
|
|
1914
|
-
})
|
|
1915
|
-
.catch((err) => {
|
|
1916
|
-
LeadLog(`Lead error: `, err);
|
|
1917
|
-
});
|
|
1918
|
-
}
|
|
1919
|
-
const LeadLog = (...params) => {
|
|
1920
|
-
if (process.env.NODE_ENV !== 'production' ||
|
|
1921
|
-
(process.env.NEXT_PUBLIC_DEPLOY_ENV &&
|
|
1922
|
-
process.env.NEXT_PUBLIC_DEPLOY_ENV !== 'production') ||
|
|
1923
|
-
(typeof localStorage !== 'undefined' &&
|
|
1924
|
-
localStorage.getItem('hhg_debug') === 'true')) {
|
|
1925
|
-
console.log(...params);
|
|
1926
|
-
}
|
|
1927
|
-
};
|
|
1928
|
-
|
|
1929
|
-
const LeadGenContext = createContext({
|
|
1930
|
-
submit(value) {
|
|
1931
|
-
/** Init for FAKING function */
|
|
1932
|
-
LeadLog('** LeadGen Submit : ', value);
|
|
1933
|
-
return Promise.reject(value);
|
|
1934
|
-
},
|
|
1935
|
-
submitSubscriptionBox(value) {
|
|
1936
|
-
/** Init for FAKING function */
|
|
1937
|
-
LeadLog('** LeadGen SubmitSubscriptionBox : ', value);
|
|
1938
|
-
return Promise.reject(value);
|
|
1939
|
-
},
|
|
1940
|
-
impression(value) {
|
|
1941
|
-
/** Init for FAKING function */
|
|
1942
|
-
LeadLog('** LeadGen Impression : ', value);
|
|
1943
|
-
return Promise.reject(value);
|
|
1944
|
-
},
|
|
1945
|
-
/** For Subscription Box */
|
|
1946
|
-
subscriptionIcon: '',
|
|
1947
|
-
subscriptionTitle: '',
|
|
1948
|
-
});
|
|
1949
|
-
const LeadGenContextProvider = (props) => {
|
|
1950
|
-
const { campaign_code: campaignCodeProps, apiSsoUrl, apiLeadUrl, apiSubotUrl, locale: localeProps, forceCampaign: forceCampaignProps, extraValues, articleId = 1, categoryId = 1, siteDomain: site_domain, children, } = props;
|
|
1951
|
-
const [forceCampaign, setForceCampaign] = useState(forceCampaignProps);
|
|
1952
|
-
const [subscriptionInfo, setSubscriptionInfo] = useState({
|
|
1953
|
-
subscriptionIcon: '',
|
|
1954
|
-
subscriptionTitle: '',
|
|
1955
|
-
});
|
|
1956
|
-
const locale = useMemo(() => {
|
|
1957
|
-
return localeProps || LOCALE['PhilippinesEnglish'];
|
|
1958
|
-
}, [localeProps]);
|
|
1959
|
-
const leadGenContextValue = useMemo(() => (Object.assign(Object.assign({}, props), { forceCampaign })), [...Object.values(props), forceCampaign]);
|
|
1960
|
-
const { url, campaign_id, campaign_code, cookie_id, ga_client_id, category_id, article_id, article_title, } = useMemo(() => ({
|
|
1961
|
-
url: location.href.toLowerCase() || '',
|
|
1962
|
-
cookie_id: getCookie('hhg-id') || null,
|
|
1963
|
-
ga_client_id: getCookie('_ga'),
|
|
1964
|
-
campaign_id: forceCampaign === null || forceCampaign === void 0 ? void 0 : forceCampaign.id,
|
|
1965
|
-
campaign_code: campaignCodeProps || (forceCampaign === null || forceCampaign === void 0 ? void 0 : forceCampaign.code),
|
|
1966
|
-
category_id: categoryId,
|
|
1967
|
-
article_id: articleId,
|
|
1968
|
-
article_title: document.title || '',
|
|
1969
|
-
}), [campaignCodeProps, articleId, categoryId, forceCampaign === null || forceCampaign === void 0 ? void 0 : forceCampaign.id]);
|
|
1970
|
-
const fetchCampaign = useCallback((campaign_code) => {
|
|
1971
|
-
Service.getCampaignByCode(campaign_code).then((res) => {
|
|
1972
|
-
const { _data } = res || {};
|
|
1973
|
-
const { campaigns } = _data || {};
|
|
1974
|
-
LeadLog('** LeadGen Campaign : ', campaigns);
|
|
1975
|
-
setForceCampaign(formatCampaignDetail(campaigns));
|
|
1976
|
-
});
|
|
1977
|
-
}, [campaignCodeProps]);
|
|
1978
|
-
// TODO : Update form for LeadGen
|
|
1979
|
-
const submit = useCallback((data) => {
|
|
1980
|
-
return Service.postSubscriptionBoxLead({ data });
|
|
1981
|
-
}, []);
|
|
1982
|
-
const submitSubscriptionBox = useCallback((value) => {
|
|
1983
|
-
const data = Object.assign(Object.assign(Object.assign(Object.assign({}, value), { campaign_id,
|
|
1984
|
-
site_domain, url: (value === null || value === void 0 ? void 0 : value.url) || url, ga_client_id: (value === null || value === void 0 ? void 0 : value.ga_client_id) || ga_client_id }), extraValues), { article_id,
|
|
1985
|
-
category_id, article_title: (extraValues === null || extraValues === void 0 ? void 0 : extraValues.article_title) || article_title });
|
|
1986
|
-
return Service.postSubscriptionBoxLead({ data });
|
|
1987
|
-
}, [
|
|
1988
|
-
extraValues,
|
|
1989
|
-
site_domain,
|
|
1990
|
-
campaign_id,
|
|
1991
|
-
article_id,
|
|
1992
|
-
article_title,
|
|
1993
|
-
category_id,
|
|
1994
|
-
url,
|
|
1995
|
-
ga_client_id,
|
|
1996
|
-
]);
|
|
1997
|
-
const impression = useCallback((value) => {
|
|
1998
|
-
return Service.campaignPostImpression({
|
|
1999
|
-
url: (value === null || value === void 0 ? void 0 : value.url) || url,
|
|
2000
|
-
action: (value === null || value === void 0 ? void 0 : value.action) || LEADGEN_ACTIONS.SCROLL,
|
|
2001
|
-
code: (value === null || value === void 0 ? void 0 : value.code) || campaign_code,
|
|
2002
|
-
title_article: (value === null || value === void 0 ? void 0 : value.title_article) || article_title,
|
|
2003
|
-
cookie_id: (value === null || value === void 0 ? void 0 : value.cookie_id) || cookie_id,
|
|
2004
|
-
ga_client_id: (value === null || value === void 0 ? void 0 : value.ga_client_id) || ga_client_id,
|
|
2005
|
-
extra: (value === null || value === void 0 ? void 0 : value.extra) || Object.assign({ cookie_id,
|
|
2006
|
-
article_id, subscription_title: subscriptionInfo.subscriptionTitle }, extraValues),
|
|
2007
|
-
referrer: value === null || value === void 0 ? void 0 : value.referrer,
|
|
2008
|
-
});
|
|
2009
|
-
}, [
|
|
2010
|
-
extraValues,
|
|
2011
|
-
campaign_id,
|
|
2012
|
-
url,
|
|
2013
|
-
campaign_code,
|
|
2014
|
-
article_title,
|
|
2015
|
-
cookie_id,
|
|
2016
|
-
ga_client_id,
|
|
2017
|
-
article_id,
|
|
2018
|
-
subscriptionInfo.subscriptionTitle,
|
|
2019
|
-
]);
|
|
2020
|
-
useEffect(() => {
|
|
2021
|
-
if (forceCampaignProps) {
|
|
2022
|
-
setForceCampaign(forceCampaignProps);
|
|
2023
|
-
return;
|
|
2024
|
-
}
|
|
2025
|
-
/** For Subscription Box */
|
|
2026
|
-
if (categoryId) {
|
|
2027
|
-
Service.getSubscriptionBoxInfo({
|
|
2028
|
-
category: categoryId,
|
|
2029
|
-
site: site_domain,
|
|
2030
|
-
}).then((res) => {
|
|
2031
|
-
const { _data } = res || {};
|
|
2032
|
-
const { item, campaign_code } = _data || {};
|
|
2033
|
-
const { icon, content } = item || {};
|
|
2034
|
-
LeadLog('** LeadGen SubscriptionBox campaign_code : ', campaign_code);
|
|
2035
|
-
LeadLog('** LeadGen SubscriptionBox subscription_icon : ', icon);
|
|
2036
|
-
LeadLog('** LeadGen SubscriptionBox subscription_title : ', content);
|
|
2037
|
-
setSubscriptionInfo({
|
|
2038
|
-
subscriptionIcon: icon,
|
|
2039
|
-
subscriptionTitle: content,
|
|
2040
|
-
});
|
|
2041
|
-
if (campaign_code) {
|
|
2042
|
-
fetchCampaign(campaign_code);
|
|
2043
|
-
}
|
|
2044
|
-
});
|
|
2045
|
-
return;
|
|
2046
|
-
}
|
|
2047
|
-
if (campaignCodeProps) {
|
|
2048
|
-
fetchCampaign(campaignCodeProps);
|
|
2049
|
-
}
|
|
2050
|
-
}, [campaignCodeProps, categoryId]);
|
|
2051
|
-
useEffect(() => {
|
|
2052
|
-
leadStore.apiSsoUrl = apiSsoUrl;
|
|
2053
|
-
leadStore.apiLeadUrl = apiLeadUrl;
|
|
2054
|
-
leadStore.apiSubotUrl = apiSubotUrl;
|
|
2055
|
-
}, [apiLeadUrl, apiSubotUrl, apiSsoUrl]);
|
|
2056
|
-
if (!forceCampaign || !(forceCampaign === null || forceCampaign === void 0 ? void 0 : forceCampaign.id)) {
|
|
2057
|
-
return null;
|
|
2058
|
-
}
|
|
2059
|
-
return (React__default.createElement(LeadGenContext.Provider, { value: Object.assign(Object.assign(Object.assign({}, leadGenContextValue), subscriptionInfo), { submit,
|
|
2060
|
-
submitSubscriptionBox,
|
|
2061
|
-
impression }) },
|
|
2062
|
-
React__default.createElement(LeadGenTranslationProvider, { locale: locale }, children)));
|
|
2063
|
-
};
|
|
2064
|
-
const useLeadGenContext = () => {
|
|
2065
|
-
const context = useContext(LeadGenContext);
|
|
2066
|
-
return Object.assign(Object.assign({}, context), { apiLeadUrl: context.apiLeadUrl || leadStore.apiLeadUrl, apiSubotUrl: context.apiSubotUrl || leadStore.apiSubotUrl });
|
|
2067
|
-
};
|
|
2068
|
-
|
|
2069
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
2070
|
-
const customParseFormat = require('dayjs/plugin/customParseFormat');
|
|
2071
|
-
dayjs.extend(customParseFormat);
|
|
2072
|
-
// You can give context variables any name
|
|
2073
|
-
const [LeadFormProvider, useLeadFormContext, useLeadForm] = createFormContext();
|
|
2074
|
-
const useLeadFormConfig = ({ listBlockAdded = [], validatingPhoneRef, validatingEmailRef, campaignId, campaign_subot_id = [], userInfo, format, }) => {
|
|
2075
|
-
var _a;
|
|
2076
|
-
const { t } = useTranslations();
|
|
2077
|
-
const initialValues = useMemo(() => mappingSSOToLead(userInfo), [userInfo === null || userInfo === void 0 ? void 0 : userInfo.id]);
|
|
2078
|
-
const LEAD_LOCALE = LEAD_LOCALE_DATA[(_a = document === null || document === void 0 ? void 0 : document.documentElement) === null || _a === void 0 ? void 0 : _a.lang] ||
|
|
2079
|
-
LEAD_LOCALE_DATA['vi-VN'];
|
|
2080
|
-
const validateObj = useMemo(() => {
|
|
2081
|
-
const InputBlocks = [
|
|
2082
|
-
'TextBlock',
|
|
2083
|
-
'NumberBlock',
|
|
2084
|
-
'EmailBlock',
|
|
2085
|
-
'PhoneBlock',
|
|
2086
|
-
'DateBlock',
|
|
2087
|
-
'CheckboxBlock',
|
|
2088
|
-
'RadioBlock',
|
|
2089
|
-
'DropdownBlock',
|
|
2090
|
-
'PhoneOtpBlock',
|
|
2091
|
-
'WhatsappOtpBlock',
|
|
2092
|
-
'ZaloOtpBlock',
|
|
2093
|
-
'LocationBlock',
|
|
2094
|
-
'TncBlock',
|
|
2095
|
-
];
|
|
2096
|
-
// ALL are required and can skip if not touched yet
|
|
2097
|
-
const withSharedCheck = (name, cb,
|
|
2098
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2099
|
-
block) => {
|
|
2100
|
-
return (value) => {
|
|
2101
|
-
var _a;
|
|
2102
|
-
const isBLockRequired = (_a = block === null || block === void 0 ? void 0 : block.data) === null || _a === void 0 ? void 0 : _a.required;
|
|
2103
|
-
if (!formRef.current.isTouched(name))
|
|
2104
|
-
return;
|
|
2105
|
-
if ((typeof value === 'string' && value.trim() === '') ||
|
|
2106
|
-
typeof value === 'undefined' ||
|
|
2107
|
-
(Array.isArray(value) && value.length === 0)) {
|
|
2108
|
-
return isBLockRequired
|
|
2109
|
-
? t('validator.required')
|
|
2110
|
-
: cb === null || cb === void 0 ? void 0 : cb(value);
|
|
2111
|
-
}
|
|
2112
|
-
return cb === null || cb === void 0 ? void 0 : cb(value);
|
|
2113
|
-
};
|
|
2114
|
-
};
|
|
2115
|
-
return listBlockAdded
|
|
2116
|
-
.filter((b) => InputBlocks.includes(b.name))
|
|
2117
|
-
.reduce((r, b) => {
|
|
2118
|
-
const { name: fieldType, data } = b || {};
|
|
2119
|
-
const { value: fieldName, required } = data || {};
|
|
2120
|
-
const isRequired = required !== null && required !== void 0 ? required : true;
|
|
2121
|
-
if (fieldType === 'NumberBlock') {
|
|
2122
|
-
return Object.assign(Object.assign({}, r), { [fieldName]: withSharedCheck(fieldName, (value) => {
|
|
2123
|
-
if (value && isNaN(Number(value))) {
|
|
2124
|
-
return t('validator.number');
|
|
2125
|
-
}
|
|
2126
|
-
}, b) });
|
|
2127
|
-
}
|
|
2128
|
-
else if (fieldType === 'EmailBlock') {
|
|
2129
|
-
return Object.assign(Object.assign({}, r), { [fieldName]: withSharedCheck(fieldName, (value) => {
|
|
2130
|
-
if (value && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) {
|
|
2131
|
-
return t('validator.email');
|
|
2132
|
-
}
|
|
2133
|
-
if (!value)
|
|
2134
|
-
return;
|
|
2135
|
-
validatingEmailRef.current = true;
|
|
2136
|
-
setTimeout(() => {
|
|
2137
|
-
formRef.current.setFieldError(fieldName, 'Validating...');
|
|
2138
|
-
checkUsedEmailOrPhoneWithCache(campaignId, campaign_subot_id, {
|
|
2139
|
-
email: value,
|
|
2140
|
-
})
|
|
2141
|
-
.then((tKey) => {
|
|
2142
|
-
if (tKey) {
|
|
2143
|
-
formRef.current.setFieldError(fieldName, t(tKey));
|
|
2144
|
-
}
|
|
2145
|
-
else {
|
|
2146
|
-
formRef.current.clearFieldError(fieldName);
|
|
2147
|
-
}
|
|
2148
|
-
validatingEmailRef.current = false;
|
|
2149
|
-
})
|
|
2150
|
-
.catch((e) => {
|
|
2151
|
-
console.error(e);
|
|
2152
|
-
formRef.current.setFieldError(fieldName, e.message || 'Something went wrong');
|
|
2153
|
-
validatingEmailRef.current = false;
|
|
2154
|
-
});
|
|
2155
|
-
}, 200);
|
|
2156
|
-
}, b) });
|
|
2157
|
-
}
|
|
2158
|
-
else if (fieldType === 'PhoneBlock' ||
|
|
2159
|
-
fieldType === 'PhoneOtpBlock' ||
|
|
2160
|
-
fieldType === 'ZaloOtpBlock' ||
|
|
2161
|
-
fieldType === 'WhatsappOtpBlock') {
|
|
2162
|
-
return Object.assign(Object.assign({}, r), { [fieldName]: withSharedCheck(fieldName, (value) => {
|
|
2163
|
-
if (value &&
|
|
2164
|
-
window.intlTelInputUtils &&
|
|
2165
|
-
!window.intlTelInputUtils.isValidNumber(String(value), LEAD_LOCALE.countryCode)) {
|
|
2166
|
-
return t('validator.phone');
|
|
2167
|
-
}
|
|
2168
|
-
if (!value)
|
|
2169
|
-
return;
|
|
2170
|
-
validatingPhoneRef.current = true;
|
|
2171
|
-
setTimeout(() => {
|
|
2172
|
-
formRef.current.setFieldError(fieldName, 'Validating...');
|
|
2173
|
-
if (b.data.singleSubmission) {
|
|
2174
|
-
checkUsedPhoneOnlyWithCache(campaignId, value)
|
|
2175
|
-
.then((tKey) => {
|
|
2176
|
-
if (tKey) {
|
|
2177
|
-
formRef.current.setFieldError(fieldName, t(tKey));
|
|
2178
|
-
}
|
|
2179
|
-
else {
|
|
2180
|
-
formRef.current.clearFieldError(fieldName);
|
|
2181
|
-
}
|
|
2182
|
-
validatingPhoneRef.current = false;
|
|
2183
|
-
})
|
|
2184
|
-
.catch((err) => {
|
|
2185
|
-
console.error(err);
|
|
2186
|
-
formRef.current.setFieldError(fieldName, err.message || 'Something went wrong');
|
|
2187
|
-
validatingPhoneRef.current = false;
|
|
2188
|
-
});
|
|
2189
|
-
}
|
|
2190
|
-
else {
|
|
2191
|
-
checkUsedEmailOrPhoneWithCache(campaignId, campaign_subot_id, {
|
|
2192
|
-
phone: value,
|
|
2193
|
-
})
|
|
2194
|
-
.then((tKey) => {
|
|
2195
|
-
if (tKey) {
|
|
2196
|
-
formRef.current.setFieldError(fieldName, t(tKey));
|
|
2197
|
-
}
|
|
2198
|
-
else {
|
|
2199
|
-
formRef.current.clearFieldError(fieldName);
|
|
2200
|
-
}
|
|
2201
|
-
validatingPhoneRef.current = false;
|
|
2202
|
-
})
|
|
2203
|
-
.catch((e) => {
|
|
2204
|
-
console.error(e);
|
|
2205
|
-
formRef.current.setFieldError(fieldName, e.message || 'Something went wrong');
|
|
2206
|
-
validatingPhoneRef.current = false;
|
|
2207
|
-
});
|
|
2208
|
-
}
|
|
2209
|
-
}, 200);
|
|
2210
|
-
}, b) });
|
|
2211
|
-
}
|
|
2212
|
-
else if (fieldType === 'DateBlock') {
|
|
2213
|
-
return Object.assign(Object.assign({}, r), { [fieldName]: withSharedCheck(fieldName, (value) => {
|
|
2214
|
-
if (!isRequired && !value) {
|
|
2215
|
-
return;
|
|
2216
|
-
}
|
|
2217
|
-
const errMsg = t('validator.dateInvalid');
|
|
2218
|
-
const dayInJS = typeof value === 'string'
|
|
2219
|
-
? dayjs(value, format, true)
|
|
2220
|
-
: dayjs(value);
|
|
2221
|
-
if (!dayInJS.isValid()) {
|
|
2222
|
-
return errMsg;
|
|
2223
|
-
}
|
|
2224
|
-
}, b) });
|
|
2225
|
-
}
|
|
2226
|
-
else if (fieldType === 'TncBlock') {
|
|
2227
|
-
return Object.assign(Object.assign({}, r), { [`TNC-` + b.id]: withSharedCheck('TNC-' + b.id, (value) => {
|
|
2228
|
-
if (isRequired && !value) {
|
|
2229
|
-
return t('validator.required');
|
|
2230
|
-
}
|
|
2231
|
-
}, b) });
|
|
2232
|
-
}
|
|
2233
|
-
else {
|
|
2234
|
-
return Object.assign(Object.assign({}, r), { [fieldName]: withSharedCheck(fieldName, undefined, b) });
|
|
2235
|
-
}
|
|
2236
|
-
}, {});
|
|
2237
|
-
}, [listBlockAdded.map((b) => b.name).join(','), format]);
|
|
2238
|
-
const form = useLeadForm({
|
|
2239
|
-
validateInputOnChange: true,
|
|
2240
|
-
validateInputOnBlur: true,
|
|
2241
|
-
clearInputErrorOnChange: true,
|
|
2242
|
-
validate: validateObj,
|
|
2243
|
-
initialValues,
|
|
2244
|
-
});
|
|
2245
|
-
const formRef = useRef(form);
|
|
2246
|
-
formRef.current = form;
|
|
2247
|
-
return { form, validateObj };
|
|
2248
|
-
};
|
|
2249
|
-
|
|
2250
|
-
const StyledLeadGenThankYou = styled.div `
|
|
2251
|
-
display: flex;
|
|
2252
|
-
gap: 8px;
|
|
2253
|
-
flex-direction: column;
|
|
2254
|
-
padding-block: 24px;
|
|
2255
|
-
|
|
2256
|
-
.leadgen-image {
|
|
2257
|
-
width: 120px;
|
|
2258
|
-
height: 120px;
|
|
2259
|
-
margin-inline: auto;
|
|
2260
|
-
object-fit: contain;
|
|
2261
|
-
object-position: center;
|
|
2262
|
-
text-align: center;
|
|
2263
|
-
}
|
|
2264
|
-
|
|
2265
|
-
.leadgen-title {
|
|
2266
|
-
margin-block: 0;
|
|
2267
|
-
color: ${theme.colors.gray900};
|
|
2268
|
-
font-weight: 700;
|
|
2269
|
-
font-size: 18px;
|
|
2270
|
-
line-height: 28px;
|
|
2271
|
-
letter-spacing: -0.2px;
|
|
2272
|
-
}
|
|
2273
|
-
|
|
2274
|
-
.leadgen-description {
|
|
2275
|
-
margin-block: 0;
|
|
2276
|
-
color: ${theme.colors.gray600};
|
|
2277
|
-
font-weight: 400;
|
|
2278
|
-
font-size: 14px;
|
|
2279
|
-
line-height: 22px;
|
|
2280
|
-
letter-spacing: -0.2px;
|
|
2281
|
-
text-align: center;
|
|
2282
|
-
}
|
|
2283
|
-
|
|
2284
|
-
> [data-align] {
|
|
2285
|
-
&[data-align='right'] {
|
|
2286
|
-
text-align: right;
|
|
2287
|
-
}
|
|
2288
|
-
&[data-align='center'] {
|
|
2289
|
-
text-align: center;
|
|
2290
|
-
}
|
|
2291
|
-
}
|
|
2292
|
-
`;
|
|
2293
|
-
const LeadGenThankYou = ({ image, title, description, showButton = false, button, className, style, }) => {
|
|
2294
|
-
const { src } = image;
|
|
2295
|
-
const { htmlText: titleText, align: titleAlign } = title;
|
|
2296
|
-
const { htmlText: descriptionText, align: descriptionAlign } = description;
|
|
2297
|
-
const { htmlText: buttonText, newtab, url, onClick } = button;
|
|
2298
|
-
return (React__default.createElement(StyledLeadGenThankYou, { className: className, style: style },
|
|
2299
|
-
React__default.createElement("img", { src: src, alt: "", className: "leadgen-thankyou_image leadgen-image" }),
|
|
2300
|
-
React__default.createElement("p", { className: "leadgen-thankyou_title leadgen-title", "data-align": titleAlign }, titleText),
|
|
2301
|
-
React__default.createElement("p", { className: "leadgen-thankyou_description leadgen-description", "data-align": descriptionAlign }, descriptionText),
|
|
2302
|
-
!!buttonText && showButton && (React__default.createElement(Button$1, { component: url ? 'a' : 'button', target: newtab ? '_blank' : undefined, href: url, size: "lg", variant: "filled", className: "leadgen-thankyoue_btn leadgen-btn", onClick: onClick }, buttonText))));
|
|
2303
|
-
};
|
|
2304
|
-
|
|
2305
|
-
const StyledLeadGenSubscriptionBoxBody = styled.div `
|
|
2306
|
-
margin-top: 16px;
|
|
2307
|
-
.leadgen-btn {
|
|
2308
|
-
margin-top: 16px;
|
|
2309
|
-
}
|
|
2310
|
-
`;
|
|
2311
|
-
const StyledLeadGenSubscriptionBoxHeaderImage = styled.div `
|
|
2312
|
-
margin-top: 3px;
|
|
2313
|
-
margin-right: 20px;
|
|
2314
|
-
width: 44px;
|
|
2315
|
-
height: 44px;
|
|
2316
|
-
|
|
2317
|
-
img {
|
|
2318
|
-
width: 100%;
|
|
2319
|
-
height: 100%;
|
|
2320
|
-
object-fix: contain;
|
|
2321
|
-
onject-position: center;
|
|
2322
|
-
}
|
|
2323
|
-
|
|
2324
|
-
:has(img[src='']) {
|
|
2325
|
-
display: none;
|
|
2326
|
-
}
|
|
2327
|
-
`;
|
|
2328
|
-
const StyledLeadGenSubscriptionBoxHeader = styled.div `
|
|
2329
|
-
display: flex;
|
|
2330
|
-
align-items: center;
|
|
2331
|
-
margin-bottom: 16px;
|
|
2332
|
-
.leadgen-title {
|
|
2333
|
-
margin-bottom: 0;
|
|
2334
|
-
flex: 1;
|
|
2335
|
-
min-width: 0;
|
|
2336
|
-
color: ${theme.colors.gray900};
|
|
2337
|
-
font-size: 18px;
|
|
2338
|
-
font-weight: 400;
|
|
2339
|
-
line-height: 1.4;
|
|
2340
|
-
letter-spacing: -0.8px;
|
|
2341
|
-
}
|
|
2342
|
-
`;
|
|
2343
|
-
const StyledLeadGenSubscriptionBox = styled.div `
|
|
2344
|
-
padding: 16px;
|
|
2345
|
-
border: 1px solid ${theme.colors.neutral100};
|
|
2346
|
-
border-radius: 12px;
|
|
2347
|
-
margin-inline: auto;
|
|
2348
|
-
.leadgen-form_inputs {
|
|
2349
|
-
.leadgen-form_input {
|
|
2350
|
-
width: 100%;
|
|
2351
|
-
}
|
|
2352
|
-
}
|
|
2353
|
-
|
|
2354
|
-
.leadgen-form_input {
|
|
2355
|
-
.mantine-Input-wrapper {
|
|
2356
|
-
max-height: 56px;
|
|
2357
|
-
}
|
|
2358
|
-
}
|
|
2359
|
-
|
|
2360
|
-
@media screen and (min-width: 768px) {
|
|
2361
|
-
.leadgen-subscription_box_body {
|
|
2362
|
-
display: flex;
|
|
2363
|
-
> form {
|
|
2364
|
-
flex: 1;
|
|
2365
|
-
min-width: 0;
|
|
2366
|
-
|
|
2367
|
-
.leadgen-form_inputs {
|
|
2368
|
-
.leadgen-form_input {
|
|
2369
|
-
width: calc(50% - 4px);
|
|
2370
|
-
}
|
|
2371
|
-
}
|
|
2372
|
-
}
|
|
2373
|
-
|
|
2374
|
-
.leadgen-btn {
|
|
2375
|
-
margin-top: 0;
|
|
2376
|
-
margin-left: 8px;
|
|
2377
|
-
width: auto;
|
|
2378
|
-
min-height: 56px;
|
|
2379
|
-
}
|
|
2380
|
-
}
|
|
2381
|
-
}
|
|
2382
|
-
`;
|
|
2383
|
-
const StyledLeadGenSubscriptionBoxA = styled.div `
|
|
2384
|
-
.leadgen-form_input {
|
|
2385
|
-
--phone-select: 45px;
|
|
2386
|
-
.PhoneInput {
|
|
2387
|
-
--phone-select: 45px;
|
|
2388
|
-
.PhoneInputCountry {
|
|
2389
|
-
margin-top: 1px;
|
|
2390
|
-
pointer-events: none;
|
|
2391
|
-
.PhoneInputCountryIconImg,
|
|
2392
|
-
.PhoneInputArrowContainer {
|
|
2393
|
-
display: none;
|
|
2394
|
-
}
|
|
2395
|
-
}
|
|
2396
|
-
}
|
|
2397
|
-
}
|
|
2398
|
-
`;
|
|
2399
|
-
|
|
2400
|
-
const PhoneInput = forwardRef((props, ref) => {
|
|
2401
|
-
const { defaultCountry, id: idProps, name, placeholder, label, labelElement, labelProps, description, descriptionProps, withAsterisk, inputMode, inputContainer, inputWrapperOrder, error, className, classNames, style, styles } = props, restProps = __rest(props, ["defaultCountry", "id", "name", "placeholder", "label", "labelElement", "labelProps", "description", "descriptionProps", "withAsterisk", "inputMode", "inputContainer", "inputWrapperOrder", "error", "className", "classNames", "style", "styles"]);
|
|
2402
|
-
const id = idProps || v1() + name;
|
|
2403
|
-
return (React__default.createElement(Input$1.Wrapper, { size: "md", label: label, labelElement: labelElement, labelProps: Object.assign({ htmlFor: id }, labelProps), description: description, descriptionProps: descriptionProps, withAsterisk: withAsterisk, inputMode: inputMode, inputContainer: inputContainer, inputWrapperOrder: inputWrapperOrder, error: error, "data-invalid": !!error, className: className, classNames: classNames, style: style, styles: styles },
|
|
2404
|
-
React__default.createElement("div", { className: "mantine-Input-wrapper" },
|
|
2405
|
-
React__default.createElement(Phone, Object.assign({}, restProps, { id: id, ref: ref, name: name, spellCheck: false, placeholder: placeholder, defaultCountry: defaultCountry, className: "mantine-Input-input", type: "tel", "data-control": "tel" })))));
|
|
2406
|
-
});
|
|
2407
|
-
|
|
2408
|
-
const formatLeadGenFormValue = (values, blocks) => {
|
|
2409
|
-
const newValues = {};
|
|
2410
|
-
for (const block of blocks) {
|
|
2411
|
-
const { data } = block || {};
|
|
2412
|
-
const { value: fieldName } = data || {};
|
|
2413
|
-
if (fieldName in values) {
|
|
2414
|
-
newValues[fieldName] = values[fieldName];
|
|
2415
|
-
}
|
|
2416
|
-
}
|
|
2417
|
-
return newValues;
|
|
2418
|
-
};
|
|
2419
|
-
|
|
2420
|
-
const StyledLeadGenFormInner = styled.div `
|
|
2421
|
-
display: flex;
|
|
2422
|
-
flex-wrap: wrap;
|
|
2423
|
-
gap: 8px;
|
|
2424
|
-
.leadgen-form_input {
|
|
2425
|
-
width: calc(50% - 4px);
|
|
2426
|
-
}
|
|
2427
|
-
|
|
2428
|
-
.leadgen-form_input_checkbox {
|
|
2429
|
-
width: 100%;
|
|
2430
|
-
}
|
|
2431
|
-
`;
|
|
2432
|
-
|
|
2433
|
-
const cssInputNotShrink$1 = css `
|
|
2434
|
-
height: 100% !important;
|
|
2435
|
-
min-height: calc(var(--container-height, 56px) * 22 / 56);
|
|
2436
|
-
color: ${theme.colors.gray800};
|
|
2437
|
-
font-size: var(--input, 16px);
|
|
2438
|
-
line-height: calc(var(--container-height, 56px) * 22 / 56);
|
|
2439
|
-
border: none !important;
|
|
2440
|
-
border-radius: 0 !important;
|
|
2441
|
-
outline: none !important;
|
|
2442
|
-
box-shadow: none !important;
|
|
2443
|
-
padding: 0;
|
|
2444
|
-
cursor: pointer;
|
|
2445
|
-
opacity: 0;
|
|
2446
|
-
|
|
2447
|
-
::placeholder {
|
|
2448
|
-
color: ${theme.colors.gray400};
|
|
2449
|
-
}
|
|
2450
|
-
`;
|
|
2451
|
-
const cssInputShrink$1 = css `
|
|
2452
|
-
height: auto !important;
|
|
2453
|
-
cursor: text;
|
|
2454
|
-
opacity: 1;
|
|
2455
|
-
transition: 0.1s ease-in-out all;
|
|
2456
|
-
`;
|
|
2457
|
-
const cssLabelNotShrink$1 = css `
|
|
2458
|
-
position: absolute;
|
|
2459
|
-
top: calc(var(--container-height) / 2);
|
|
2460
|
-
left: var(--space-x, 16px);
|
|
2461
|
-
color: ${theme.colors.gray400};
|
|
2462
|
-
font-size: var(--label-not-shrink, 16px);
|
|
2463
|
-
font-weight: 400;
|
|
2464
|
-
line-height: calc(var(--container-height, 56px) * 18 / 56);
|
|
2465
|
-
margin: 0;
|
|
2466
|
-
z-index: 1;
|
|
2467
|
-
cursor: pointer;
|
|
2468
|
-
transform: translateY(-50%);
|
|
2469
|
-
transition: 0.125s ease-in all;
|
|
2470
|
-
`;
|
|
2471
|
-
const cssLabelShrink$1 = css `
|
|
2472
|
-
color: ${theme.colors.gray600};
|
|
2473
|
-
font-weight: 600;
|
|
2474
|
-
font-size: var(--label-shrink, 12px);
|
|
2475
|
-
top: calc(var(--container-height) * 7 / 56);
|
|
2476
|
-
transform: none;
|
|
2477
|
-
transition: 0.125s ease-out all;
|
|
2478
|
-
`;
|
|
2479
|
-
const cssWrapperInputNotShrink$1 = css `
|
|
2480
|
-
min-height: var(--container-height, 56px);
|
|
2481
|
-
display: flex;
|
|
2482
|
-
align-items: flex-end;
|
|
2483
|
-
border: 1px solid ${theme.colors.gray200};
|
|
2484
|
-
border-radius: 8px;
|
|
2485
|
-
background-color: #fff;
|
|
2486
|
-
padding-inline: var(--space-x, 16px);
|
|
2487
|
-
padding-block: var(--space-y-not-shrink, 16px);
|
|
2488
|
-
cursor: pointer;
|
|
2489
|
-
pointer-events: none;
|
|
2490
|
-
|
|
2491
|
-
&:has(.mantine-Input-rightSection) {
|
|
2492
|
-
padding-right: var(--container-height, 56px);
|
|
2493
|
-
}
|
|
2494
|
-
|
|
2495
|
-
.mantine-Input-icon {
|
|
2496
|
-
display: none;
|
|
2497
|
-
}
|
|
2498
|
-
|
|
2499
|
-
.mantine-NumberInput-control {
|
|
2500
|
-
border-color: ${theme.colors.gray200};
|
|
2501
|
-
}
|
|
2502
|
-
`;
|
|
2503
|
-
const cssWrapperInputShrink$1 = css `
|
|
2504
|
-
height: auto;
|
|
2505
|
-
min-height: var(--container-height, 56px);
|
|
2506
|
-
padding-block: var(--space-y-shrink, 7px);
|
|
2507
|
-
cursor: text;
|
|
2508
|
-
pointer-events: auto;
|
|
2509
|
-
`;
|
|
2510
|
-
const cssInputWrapperError$1 = css `
|
|
2511
|
-
color: ${theme.colors.red800};
|
|
2512
|
-
font-size: 12px;
|
|
2513
|
-
line-height: 1.5;
|
|
2514
|
-
`;
|
|
2515
|
-
const StyledTextFieldContainer$1 = styled.div `
|
|
2516
|
-
--space-x: 16px;
|
|
2517
|
-
--space-y-not-shrink: 16px;
|
|
2518
|
-
--space-y-shrink: 7px;
|
|
2519
|
-
--container-height: 56px;
|
|
2520
|
-
--label-not-shrink: 16px;
|
|
2521
|
-
--label-shrink: 12px;
|
|
2522
|
-
--input: 16px;
|
|
2523
|
-
|
|
2524
|
-
position: relative;
|
|
2525
|
-
min-width: 100px;
|
|
2526
|
-
max-width: 100%;
|
|
2527
|
-
display: inline-block;
|
|
2528
|
-
|
|
2529
|
-
.textField_wrapper {
|
|
2530
|
-
display: inline-block;
|
|
2531
|
-
width: 100%;
|
|
2532
|
-
cursor: pointer;
|
|
2533
|
-
}
|
|
2534
|
-
|
|
2535
|
-
.mantine-InputWrapper-root {
|
|
2536
|
-
&[data-invalid='true'] {
|
|
2537
|
-
.mantine-Input-wrapper {
|
|
2538
|
-
border-color: ${theme.colors.red400};
|
|
2539
|
-
}
|
|
2540
|
-
}
|
|
2541
|
-
|
|
2542
|
-
.mantine-Input-wrapper {
|
|
2543
|
-
&:has([data-invalid]) {
|
|
2544
|
-
border-color: ${theme.colors.red400};
|
|
2545
|
-
}
|
|
2546
|
-
}
|
|
2547
|
-
|
|
2548
|
-
.mantine-InputWrapper-error {
|
|
2549
|
-
font-size: 12px !important;
|
|
2550
|
-
}
|
|
2551
|
-
}
|
|
2552
|
-
|
|
2553
|
-
.mantine-InputWrapper-label {
|
|
2554
|
-
${cssLabelNotShrink$1}
|
|
2555
|
-
}
|
|
2556
|
-
|
|
2557
|
-
.mantine-Input-wrapper {
|
|
2558
|
-
${cssWrapperInputNotShrink$1}
|
|
2559
|
-
|
|
2560
|
-
+ .mantine-Popover-dropdown[data-position="bottom-start"] {
|
|
2561
|
-
left: 0 !important;
|
|
2562
|
-
}
|
|
2563
|
-
+ .mantine-Popover-dropdown[data-position='top-start'] {
|
|
2564
|
-
top: unset !important;
|
|
2565
|
-
left: 0 !important;
|
|
2566
|
-
bottom: 100% !important;
|
|
2567
|
-
}
|
|
2568
|
-
}
|
|
2569
|
-
|
|
2570
|
-
.mantine-Input-input {
|
|
2571
|
-
${cssInputNotShrink$1}
|
|
2572
|
-
}
|
|
2573
|
-
|
|
2574
|
-
&.textField_shrink,
|
|
2575
|
-
&:focus-within {
|
|
2576
|
-
.mantine-InputWrapper-label {
|
|
2577
|
-
${cssLabelShrink$1}
|
|
2578
|
-
}
|
|
2579
|
-
|
|
2580
|
-
.mantine-Input-wrapper {
|
|
2581
|
-
${cssWrapperInputShrink$1}
|
|
2582
|
-
&.mantine-Select-wrapper {
|
|
2583
|
-
.mantine-Select-rightSection {
|
|
2584
|
-
pointer-events: auto !important;
|
|
2585
|
-
}
|
|
2586
|
-
}
|
|
2587
|
-
}
|
|
2588
|
-
|
|
2589
|
-
.mantine-Input-input {
|
|
2590
|
-
${cssInputShrink$1}
|
|
2591
|
-
}
|
|
2592
|
-
|
|
2593
|
-
&:has(.PhoneInput) {
|
|
2594
|
-
.mantine-InputWrapper-label {
|
|
2595
|
-
left: var(--space-x, 16px);
|
|
2596
|
-
}
|
|
2597
|
-
.PhoneInput {
|
|
2598
|
-
.PhoneInputInput {
|
|
2599
|
-
opacity: 1;
|
|
2600
|
-
}
|
|
2601
|
-
}
|
|
2602
|
-
}
|
|
2603
|
-
}
|
|
2604
|
-
|
|
2605
|
-
.PhoneInput {
|
|
2606
|
-
--phone-select: 75px;
|
|
2607
|
-
--phone-input-space-x: 8px;
|
|
2608
|
-
width: 100%;
|
|
2609
|
-
opacity: 1;
|
|
2610
|
-
border: none;
|
|
2611
|
-
.PhoneInputCountry {
|
|
2612
|
-
background-color: transparent;
|
|
2613
|
-
border: none;
|
|
2614
|
-
padding: 0;
|
|
2615
|
-
width: var(--phone-select, 75px);
|
|
2616
|
-
}
|
|
2617
|
-
.PhoneInputInput {
|
|
2618
|
-
flex: 1;
|
|
2619
|
-
min-width: 0;
|
|
2620
|
-
line-height: 1.5;
|
|
2621
|
-
outline: none !important;
|
|
2622
|
-
border: none;
|
|
2623
|
-
box-shadow: none;
|
|
2624
|
-
padding: 0 var(--phone-input-space-x, 8px);
|
|
2625
|
-
opacity: 0;
|
|
2626
|
-
color: ${theme.colors.gray800} !important;
|
|
2627
|
-
:focus {
|
|
2628
|
-
color: ${theme.colors.gray800} !important;
|
|
2629
|
-
}
|
|
2630
|
-
}
|
|
2631
|
-
}
|
|
2632
|
-
|
|
2633
|
-
&:has(.PhoneInput) {
|
|
2634
|
-
.mantine-InputWrapper-label {
|
|
2635
|
-
left: calc(
|
|
2636
|
-
var(--space-x, 16px) + var(--phone-select, 75px) +
|
|
2637
|
-
var(--phone-input-space-x, 8px)
|
|
2638
|
-
);
|
|
2639
|
-
}
|
|
2640
|
-
}
|
|
2641
|
-
`;
|
|
2642
|
-
const StyledChoiceFieldContainer$1 = styled.div `
|
|
2643
|
-
&.leadgen-form_checkbox,
|
|
2644
|
-
&.leadgen-form_radio {
|
|
2645
|
-
width: 100%;
|
|
2646
|
-
}
|
|
2647
|
-
|
|
2648
|
-
&.leadgen-form_dropdown {
|
|
2649
|
-
width: calc(50% - 12px);
|
|
2650
|
-
}
|
|
2651
|
-
|
|
2652
|
-
.mantine-InputWrapper-root {
|
|
2653
|
-
display: block;
|
|
2654
|
-
.mantine-InputWrapper-error {
|
|
2655
|
-
font-size: 12px !important;
|
|
2656
|
-
}
|
|
2657
|
-
}
|
|
2658
|
-
|
|
2659
|
-
.mantine-InputWrapper-label {
|
|
2660
|
-
margin-bottom: 0.5rem;
|
|
2661
|
-
color: ${theme.colors.gray800};
|
|
2662
|
-
font-size: 16px;
|
|
2663
|
-
font-weight: 400;
|
|
2664
|
-
line-height: 1.5;
|
|
2665
|
-
}
|
|
2666
|
-
|
|
2667
|
-
.mantine-Radio-root,
|
|
2668
|
-
.mantine-Checkbox-root {
|
|
2669
|
-
gap: 8px;
|
|
2670
|
-
min-width: calc(50% - 4px);
|
|
2671
|
-
|
|
2672
|
-
input[type='radio'],
|
|
2673
|
-
input[type='checkbox'] {
|
|
2674
|
-
border-color: ${theme.colors.gray600};
|
|
2675
|
-
width: 18px;
|
|
2676
|
-
height: 18px;
|
|
2677
|
-
}
|
|
2678
|
-
input[type='checkbox'] {
|
|
2679
|
-
border-radius: 4px;
|
|
2680
|
-
}
|
|
2681
|
-
|
|
2682
|
-
&[data-checked='true'] {
|
|
2683
|
-
input[type='radio'],
|
|
2684
|
-
input[type='checkbox'] {
|
|
2685
|
-
border-color: ${theme.colors.primary600};
|
|
2686
|
-
+ svg {
|
|
2687
|
-
color: ${theme.colors.primary600};
|
|
2688
|
-
}
|
|
2689
|
-
}
|
|
2690
|
-
|
|
2691
|
-
input[type='radio'] {
|
|
2692
|
-
background-color: white;
|
|
2693
|
-
}
|
|
2694
|
-
}
|
|
2695
|
-
|
|
2696
|
-
.mantine-Checkbox-input {
|
|
2697
|
-
&:checked {
|
|
2698
|
-
border-color: ${theme.colors.primary600};
|
|
2699
|
-
}
|
|
2700
|
-
}
|
|
2701
|
-
}
|
|
2702
|
-
|
|
2703
|
-
.mantine-Radio-inner,
|
|
2704
|
-
.mantine-Checkbox-inner {
|
|
2705
|
-
width: 24px;
|
|
2706
|
-
height: 24px;
|
|
2707
|
-
display: flex;
|
|
2708
|
-
align-items: center;
|
|
2709
|
-
justify-content: center;
|
|
2710
|
-
}
|
|
2711
|
-
|
|
2712
|
-
.mantine-Radio-body,
|
|
2713
|
-
.mantine-Checkbox-body {
|
|
2714
|
-
display: flex;
|
|
2715
|
-
align-items: center;
|
|
2716
|
-
}
|
|
2717
|
-
|
|
2718
|
-
.mantine-Radio-label,
|
|
2719
|
-
.mantine-Checkbox-label {
|
|
2720
|
-
padding-left: 8px;
|
|
2721
|
-
color: ${theme.colors.gray800};
|
|
2722
|
-
font-size: 14px;
|
|
2723
|
-
line-height: 1.4;
|
|
2724
|
-
letter-spacing: -0.2px;
|
|
2725
|
-
}
|
|
2726
|
-
|
|
2727
|
-
.leadgen-choiceContainer {
|
|
2728
|
-
display: flex;
|
|
2729
|
-
flex-wrap: wrap;
|
|
2730
|
-
align-items: flex-start;
|
|
2731
|
-
gap: 8px;
|
|
2732
|
-
}
|
|
2733
|
-
|
|
2734
|
-
.mantine-InputWrapper-error {
|
|
2735
|
-
${cssInputWrapperError$1}
|
|
2736
|
-
}
|
|
2737
|
-
`;
|
|
2738
|
-
|
|
2739
|
-
const TextField$1 = (props) => {
|
|
2740
|
-
const { shrink: shrinkProps, onChangeShrink, className, children } = props, restProps = __rest(props, ["shrink", "onChangeShrink", "className", "children"]);
|
|
2741
|
-
const containerRef = useClickOutside(() => {
|
|
2742
|
-
if (shrinkProps) {
|
|
2743
|
-
return;
|
|
2744
|
-
}
|
|
2745
|
-
setShrink(false);
|
|
2746
|
-
onChangeShrink === null || onChangeShrink === void 0 ? void 0 : onChangeShrink(false);
|
|
2747
|
-
});
|
|
2748
|
-
const [shrink, setShrink] = useState(shrinkProps);
|
|
2749
|
-
const onClick = useCallback((e) => {
|
|
2750
|
-
setShrink(true);
|
|
2751
|
-
onChangeShrink === null || onChangeShrink === void 0 ? void 0 : onChangeShrink(true);
|
|
2752
|
-
if (shrink) {
|
|
2753
|
-
return;
|
|
2754
|
-
}
|
|
2755
|
-
const $textEl = e.currentTarget.querySelectorAll('input:not([disabled]):not([type="submit"]),select:not([disabled]),textarea:not([disabled])');
|
|
2756
|
-
const $focusEl = $textEl.item($textEl.length - 1);
|
|
2757
|
-
if ($focusEl) {
|
|
2758
|
-
$focusEl.focus();
|
|
2759
|
-
setTimeout(() => {
|
|
2760
|
-
$focusEl.scrollIntoView({
|
|
2761
|
-
behavior: 'auto',
|
|
2762
|
-
block: 'center',
|
|
2763
|
-
inline: 'start',
|
|
2764
|
-
});
|
|
2765
|
-
}, 100);
|
|
2766
|
-
}
|
|
2767
|
-
}, [shrink]);
|
|
2768
|
-
useEffect(() => {
|
|
2769
|
-
setShrink(shrinkProps);
|
|
2770
|
-
}, [shrinkProps]);
|
|
2771
|
-
return (React__default.createElement(StyledTextFieldContainer$1, Object.assign({ shrink: shrink, className: clsx(className, 'textField', { textField_shrink: !!shrink }) }, restProps),
|
|
2772
|
-
React__default.createElement("div", { ref: containerRef, onClick: onClick, className: "textField_wrapper" }, children)));
|
|
2773
|
-
};
|
|
2774
|
-
const ChoiceField$1 = (props) => {
|
|
2775
|
-
const { children, className } = props, restProps = __rest(props, ["children", "className"]);
|
|
2776
|
-
return (React__default.createElement(StyledChoiceFieldContainer$1, Object.assign({ className: clsx(className, 'choiceField') }, restProps), children));
|
|
2777
|
-
};
|
|
2778
|
-
|
|
2779
|
-
const libraries = ['places'];
|
|
2780
|
-
const GoogleLocationBlock = (props) => {
|
|
2781
|
-
var _a;
|
|
2782
|
-
const { inputWrapperOrder = ['label', 'input', 'description', 'error'], defaultValue, value: valueProps, onChange: onChangeProps, locale } = props, restProps = __rest(props, ["inputWrapperOrder", "defaultValue", "value", "onChange", "locale"]);
|
|
2783
|
-
const [LoadScript, setLoadScript] = useState(null);
|
|
2784
|
-
const [value, setValue] = useState(defaultValue || valueProps);
|
|
2785
|
-
const { predictions } = usePlacesAutocomplete(value, '', locale === 'tl-PH' ? 'en' : (_a = locale === null || locale === void 0 ? void 0 : locale.split('-')) === null || _a === void 0 ? void 0 : _a[0]);
|
|
2786
|
-
const onChangeAutocomplete = useCallback((s) => {
|
|
2787
|
-
setValue(s);
|
|
2788
|
-
onChangeProps === null || onChangeProps === void 0 ? void 0 : onChangeProps(s);
|
|
2789
|
-
}, []);
|
|
2790
|
-
const onClickItem = useCallback((item) => {
|
|
2791
|
-
/** For sure get value */
|
|
2792
|
-
setValue(item.value);
|
|
2793
|
-
const predCur = predictions === null || predictions === void 0 ? void 0 : predictions.find(({ description }) => description === item.value);
|
|
2794
|
-
onChangeProps === null || onChangeProps === void 0 ? void 0 : onChangeProps(item.value, predCur === null || predCur === void 0 ? void 0 : predCur.rawData);
|
|
2795
|
-
}, [onChangeProps, predictions]);
|
|
2796
|
-
useEffect(() => {
|
|
2797
|
-
setValue(valueProps);
|
|
2798
|
-
}, [valueProps]);
|
|
2799
|
-
useEffect(() => {
|
|
2800
|
-
var _a, _b, _c;
|
|
2801
|
-
// only load extra google script when not yet loaded
|
|
2802
|
-
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) && !LoadScript) {
|
|
2803
|
-
import('@react-google-maps/api').then((m) => {
|
|
2804
|
-
setLoadScript(() => m.LoadScript);
|
|
2805
|
-
});
|
|
2806
|
-
}
|
|
2807
|
-
}, []);
|
|
2808
|
-
return (React__default.createElement(Autocomplete, Object.assign({ defaultValue: defaultValue, value: value, onChange: onChangeAutocomplete, data: predictions.map((pred) => {
|
|
2809
|
-
return { value: pred.description, label: pred.description };
|
|
2810
|
-
}), filter: () => true, onItemSubmit: onClickItem, inputWrapperOrder: inputWrapperOrder, zIndex: ZINDEX_SSO - 9e6 + 2, withinPortal: true, styles: { dropdown: { pointerEvents: 'auto' } }, inputContainer: (children) => {
|
|
2811
|
-
return (React__default.createElement(React__default.Fragment, null,
|
|
2812
|
-
LoadScript && (React__default.createElement(LoadScript, { googleMapsApiKey: GOOGLE_API_KEY, libraries: libraries, loadingElement: React__default.createElement(React__default.Fragment, null), style: { width: '100%' } })),
|
|
2813
|
-
children));
|
|
2814
|
-
} }, restProps)));
|
|
2815
|
-
};
|
|
2816
|
-
|
|
2817
|
-
const LeadGenForm = forwardRef((props, ref) => {
|
|
2818
|
-
const { locale, blocks, scrollToErrorField = true, form: formProps, rules: validate, initialValues, onFinish, onFinishFailed, className, style, } = props;
|
|
2819
|
-
const formRef = useRef(null);
|
|
2820
|
-
const form = formProps || useForm({ initialValues, validate });
|
|
2821
|
-
const middlewareFinish = useCallback((values, event) => {
|
|
2822
|
-
/** Set `touched` all values for validation when submiting */
|
|
2823
|
-
form.setTouched(blocks.reduce((touched, { data }) => {
|
|
2824
|
-
touched[data.value] = true;
|
|
2825
|
-
return touched;
|
|
2826
|
-
}, {}));
|
|
2827
|
-
/** Wait for `touched` state and then submit */
|
|
2828
|
-
setTimeout(() => {
|
|
2829
|
-
const { hasErrors } = form.validate();
|
|
2830
|
-
if (hasErrors) {
|
|
2831
|
-
return;
|
|
2832
|
-
}
|
|
2833
|
-
onFinish === null || onFinish === void 0 ? void 0 : onFinish(formatLeadGenFormValue(values, blocks), event);
|
|
2834
|
-
}, 100);
|
|
2835
|
-
}, [form, blocks]);
|
|
2836
|
-
const middlewareFinishFailed = useCallback((errors, values, events) => {
|
|
2837
|
-
if (scrollToErrorField && errors) {
|
|
2838
|
-
const firstErrorKey = Object.keys(errors)[0];
|
|
2839
|
-
const firstErrorElement = document.querySelector(`[name="${firstErrorKey}"]`);
|
|
2840
|
-
if (firstErrorElement && (firstErrorElement === null || firstErrorElement === void 0 ? void 0 : firstErrorElement.focus)) {
|
|
2841
|
-
setTimeout(() => {
|
|
2842
|
-
firstErrorElement === null || firstErrorElement === void 0 ? void 0 : firstErrorElement.focus();
|
|
2843
|
-
firstErrorElement.scrollIntoView({
|
|
2844
|
-
behavior: 'auto',
|
|
2845
|
-
block: 'center',
|
|
2846
|
-
inline: 'center',
|
|
2847
|
-
});
|
|
2848
|
-
}, 100);
|
|
2849
|
-
}
|
|
2850
|
-
}
|
|
2851
|
-
onFinishFailed === null || onFinishFailed === void 0 ? void 0 : onFinishFailed(errors, values, events);
|
|
2852
|
-
}, [scrollToErrorField]);
|
|
2853
|
-
useEffect(() => {
|
|
2854
|
-
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
2855
|
-
if (!window.intlTelInputUtils) {
|
|
2856
|
-
yield require('intl-tel-input/build/js/utils');
|
|
2857
|
-
}
|
|
2858
|
-
}))();
|
|
2859
|
-
}, []);
|
|
2860
|
-
useImperativeHandle(ref, () => (Object.assign(Object.assign({}, form), { submit: () => {
|
|
2861
|
-
formRef.current.requestSubmit();
|
|
2862
|
-
} })), [form, formRef]);
|
|
2863
|
-
if (!blocks || !blocks.length) {
|
|
2864
|
-
return null;
|
|
2865
|
-
}
|
|
2866
|
-
return (React__default.createElement("form", { ref: formRef, onSubmit: form.onSubmit(middlewareFinish, middlewareFinishFailed), className: className, style: style },
|
|
2867
|
-
React__default.createElement(StyledLeadGenFormInner, { className: "leadgen-form_inputs" }, blocks.map((block, idx) => {
|
|
2868
|
-
const { id, name: blockName, data } = block;
|
|
2869
|
-
const { placeholder, value: name, required, listQuestion, valueHTML, isSendMailChimp = false, } = data;
|
|
2870
|
-
const formInputProps = form.getInputProps(name);
|
|
2871
|
-
const { value, error } = formInputProps;
|
|
2872
|
-
const reactKey = `${id}-${idx}`;
|
|
2873
|
-
switch (blockName) {
|
|
2874
|
-
case LEADGEN_BLOCK.TextBlock: {
|
|
2875
|
-
return (React__default.createElement(TextField$1, { key: reactKey, shrink: !!value, className: "leadgen-form_input" },
|
|
2876
|
-
React__default.createElement(TextInput, Object.assign({ name: name, spellCheck: false, withAsterisk: required, label: placeholder, placeholder: placeholder, inputWrapperOrder: LEADGEN_ORDER_INPUT_WRAPPER, type: "text", "data-control": "text" }, formInputProps))));
|
|
2877
|
-
}
|
|
2878
|
-
case LEADGEN_BLOCK.NumberBlock: {
|
|
2879
|
-
return (React__default.createElement(TextField$1, { key: reactKey, shrink: !!value, className: "leadgen-form_input" },
|
|
2880
|
-
React__default.createElement(NumberInput$1, Object.assign({ name: value, spellCheck: false, withAsterisk: required, label: placeholder, placeholder: placeholder, inputWrapperOrder: LEADGEN_ORDER_INPUT_WRAPPER, type: "number", "data-control": "number" }, formInputProps))));
|
|
2881
|
-
}
|
|
2882
|
-
case LEADGEN_BLOCK.EmailBlock: {
|
|
2883
|
-
return (React__default.createElement(TextField$1, { key: reactKey, shrink: !!value, className: "leadgen-form_input" },
|
|
2884
|
-
React__default.createElement(TextInput, Object.assign({ name: name, spellCheck: false, withAsterisk: required, label: placeholder, placeholder: placeholder, inputWrapperOrder: LEADGEN_ORDER_INPUT_WRAPPER, "data-control": "email" }, formInputProps))));
|
|
2885
|
-
}
|
|
2886
|
-
case LEADGEN_BLOCK.PhoneOtpBlock:
|
|
2887
|
-
case LEADGEN_BLOCK.WhatsappOtpBlock:
|
|
2888
|
-
case LEADGEN_BLOCK.ZaloOtpBlock:
|
|
2889
|
-
case LEADGEN_BLOCK.PhoneBlock: {
|
|
2890
|
-
return (React__default.createElement(TextField$1, { key: reactKey, shrink: !!value, className: "leadgen-form_input" },
|
|
2891
|
-
React__default.createElement(PhoneInput, Object.assign({ name: name, spellCheck: false, withAsterisk: required, label: placeholder, placeholder: placeholder, inputWrapperOrder: LEADGEN_ORDER_INPUT_WRAPPER, defaultCountry: (locale ? MAPPED_LOCALE[locale] || 'VN' : 'VN'), type: "text", "data-control": "text" }, formInputProps))));
|
|
2892
|
-
}
|
|
2893
|
-
case LEADGEN_BLOCK.LocationBlock: {
|
|
2894
|
-
return (React__default.createElement(TextField$1, { key: reactKey, shrink: !!value, className: "leadgen-form_input" },
|
|
2895
|
-
React__default.createElement(GoogleLocationBlock, Object.assign({ name: name, withAsterisk: required, label: placeholder, placeholder: placeholder, inputWrapperOrder: LEADGEN_ORDER_INPUT_WRAPPER, locale: locale, "data-control": "text" }, formInputProps))));
|
|
2896
|
-
}
|
|
2897
|
-
case LEADGEN_BLOCK.DateBlock: {
|
|
2898
|
-
return (React__default.createElement(TextField$1, { key: reactKey, shrink: !!value, className: "leadgen-form_input" },
|
|
2899
|
-
React__default.createElement(DateInput, Object.assign({ locale: (MAPPED_LOCALE === null || MAPPED_LOCALE === void 0 ? void 0 : MAPPED_LOCALE[locale]) || MAPPED_LOCALE['vi-VN'], valueFormat: "DD/MM/YYYY", name: name, withAsterisk: required, label: placeholder, placeholder: placeholder, inputWrapperOrder: LEADGEN_ORDER_INPUT_WRAPPER, type: "default", "data-control": "date" }, formInputProps))));
|
|
2900
|
-
}
|
|
2901
|
-
case LEADGEN_BLOCK.DropdownBlock:
|
|
2902
|
-
return (React__default.createElement(TextField$1, { key: reactKey, shrink: !!value, className: "leadgen-form_input" },
|
|
2903
|
-
React__default.createElement("div", { style: { display: 'none' }, "data-extra": true, "data-name": value, "data-control": 'dropdown' }),
|
|
2904
|
-
React__default.createElement(Select$1, Object.assign({ name: name, withAsterisk: required, label: placeholder, placeholder: placeholder, data: listQuestion.map((l) => ({
|
|
2905
|
-
value: l.value,
|
|
2906
|
-
label: l.placeholder,
|
|
2907
|
-
})) }, formInputProps))));
|
|
2908
|
-
case LEADGEN_BLOCK.CheckboxBlock: {
|
|
2909
|
-
const formInputCheckboxProps = form.getInputProps(name, {
|
|
2910
|
-
type: 'checkbox',
|
|
2911
|
-
});
|
|
2912
|
-
return (React__default.createElement(ChoiceField$1, { className: "leadgen-form_input leadgen-form_input_checkbox", key: reactKey },
|
|
2913
|
-
isSendMailChimp && (React__default.createElement("div", { style: { display: 'none' }, "data-name": name + '-mailchimp' })),
|
|
2914
|
-
React__default.createElement(Checkbox$1.Group, Object.assign({ size: "md", withAsterisk: required, label: placeholder, value: value, sx: {
|
|
2915
|
-
display: 'flex',
|
|
2916
|
-
flexDirection: 'column',
|
|
2917
|
-
flexWrap: 'wrap',
|
|
2918
|
-
gap: 8,
|
|
2919
|
-
}, inputWrapperOrder: LEADGEN_ORDER_INPUT_WRAPPER, inputContainer: (children) => {
|
|
2920
|
-
return (React__default.createElement("div", { className: "leadgen-choiceContainer" }, children));
|
|
2921
|
-
} }, formInputCheckboxProps), listQuestion.map((l, _idx) => (React__default.createElement(Checkbox$1, { name: name, key: _idx, value: l.value, label: l.placeholder, "data-control": "checkbox" }))))));
|
|
2922
|
-
}
|
|
2923
|
-
case LEADGEN_BLOCK.RadioBlock: {
|
|
2924
|
-
return (React__default.createElement(ChoiceField$1, { className: "leadgen-form_input leadgen-form_input_checkbox", key: reactKey },
|
|
2925
|
-
isSendMailChimp && (React__default.createElement("div", { style: { display: 'none' }, "data-name": name + '-mailchimp' })),
|
|
2926
|
-
React__default.createElement(Radio$1.Group, Object.assign({ size: "md", withAsterisk: required, label: placeholder, value: value, spellCheck: true, inputWrapperOrder: LEADGEN_ORDER_INPUT_WRAPPER, inputContainer: (children) => {
|
|
2927
|
-
return (React__default.createElement("div", { className: "leadgen-choiceContainer" }, children));
|
|
2928
|
-
} }, formInputProps), listQuestion.map((l, _index) => (React__default.createElement(Radio$1, { name: name, key: _index, value: l.value, label: l.placeholder, "data-control": "radio" }))))));
|
|
2929
|
-
}
|
|
2930
|
-
case LEADGEN_BLOCK.TncBlock:
|
|
2931
|
-
return (React__default.createElement(ChoiceField$1, { className: "leadgen-form_input leadgen-form_input_checkbox", key: reactKey },
|
|
2932
|
-
React__default.createElement(Input$1.Wrapper, { error: error },
|
|
2933
|
-
React__default.createElement(Checkbox$1, Object.assign({ value: value, name: 'TNC-' + id, label: React__default.createElement("p", { className: "lead-modal__tnc-link", dangerouslySetInnerHTML: { __html: valueHTML } }), className: "tnc-block", "data-control": "checkbox" }, formInputProps)))));
|
|
2934
|
-
default: {
|
|
2935
|
-
return null;
|
|
2936
|
-
}
|
|
2937
|
-
}
|
|
2938
|
-
}))));
|
|
2939
|
-
});
|
|
2940
|
-
|
|
2941
|
-
const LEADGEN_ORDER_INPUT_WRAPPER = ['label', 'input', 'description', 'error'];
|
|
2942
|
-
|
|
2943
|
-
const LeadGenSubscriptionBoxA = (props) => {
|
|
2944
|
-
const { loading, image, title, submitText, locale, blocks, form, rules, onFinish, } = props;
|
|
2945
|
-
const formRef = useRef();
|
|
2946
|
-
const imageComp = useMemo(() => {
|
|
2947
|
-
if (!image) {
|
|
2948
|
-
return null;
|
|
2949
|
-
}
|
|
2950
|
-
return (React__default.createElement(StyledLeadGenSubscriptionBoxHeaderImage, null,
|
|
2951
|
-
React__default.createElement("img", { src: image, alt: "" })));
|
|
2952
|
-
}, [image]);
|
|
2953
|
-
const titleComp = useMemo(() => {
|
|
2954
|
-
if (typeof title === 'string') {
|
|
2955
|
-
return (React__default.createElement("p", { className: "leadgen-title", dangerouslySetInnerHTML: { __html: title } }));
|
|
2956
|
-
}
|
|
2957
|
-
return React__default.createElement("p", { className: "leadgen-title" }, title);
|
|
2958
|
-
}, [title]);
|
|
2959
|
-
return (React__default.createElement(StyledLeadGenSubscriptionBoxA, { className: "subcription_box_A" },
|
|
2960
|
-
React__default.createElement(StyledLeadGenSubscriptionBoxHeader, { className: "leadgen-subscription_box_header" },
|
|
2961
|
-
imageComp,
|
|
2962
|
-
titleComp),
|
|
2963
|
-
React__default.createElement(StyledLeadGenSubscriptionBoxBody, { className: "leadgen-subscription_box_body" },
|
|
2964
|
-
React__default.createElement(LeadGenForm, { ref: formRef, form: form, rules: rules, blocks: blocks, locale: locale, onFinish: onFinish, className: "leadgen-subscription_box_form" }),
|
|
2965
|
-
React__default.createElement(Button$1, { disabled: loading, loading: loading, variant: "filled", size: "lg", onClick: () => {
|
|
2966
|
-
formRef.current.submit();
|
|
2967
|
-
}, className: "leadgen-btn leadgen-btn_action", fullWidth: true }, submitText))));
|
|
2968
|
-
};
|
|
2969
|
-
|
|
2970
|
-
const LeadGenSubscriptionBoxWithoutMemo = ({ locale, userInfo, forceCampaign, categoryId, }) => {
|
|
2971
|
-
var _a, _b, _c;
|
|
2972
|
-
const { image, extra_fields, id: campaign_id, bot_id: campaign_subot_id = [], ThankYouBlock, } = forceCampaign || {};
|
|
2973
|
-
const { textBlocks, listBlockAdded, actionBlocks } = extra_fields || {};
|
|
2974
|
-
const { submitBlock } = actionBlocks || {};
|
|
2975
|
-
const { apiLeadUrl, subscriptionIcon, subscriptionTitle, submitSubscriptionBox, impression, onFinish, } = useLeadGenContext();
|
|
2976
|
-
const { t } = useTranslations();
|
|
2977
|
-
const { action: { pushNotifications }, } = useContext(TogetherComponentGlobalContext);
|
|
2978
|
-
const refContainer = useRef(null);
|
|
2979
|
-
const [loading, setLoading] = useState(false);
|
|
2980
|
-
const [showThankyou, setShowThankyou] = useState(false);
|
|
2981
|
-
const validatingEmailRef = useRef(false);
|
|
2982
|
-
const validatingPhoneRef = useRef(false);
|
|
2983
|
-
const { form, validateObj } = useLeadFormConfig({
|
|
2984
|
-
listBlockAdded,
|
|
2985
|
-
campaignId: campaign_id,
|
|
2986
|
-
campaign_subot_id,
|
|
2987
|
-
validatingEmailRef,
|
|
2988
|
-
validatingPhoneRef,
|
|
2989
|
-
userInfo,
|
|
2990
|
-
});
|
|
2991
|
-
const subscription_title = useMemo(() => {
|
|
2992
|
-
var _a, _b;
|
|
2993
|
-
return subscriptionTitle ||
|
|
2994
|
-
((_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) ||
|
|
2995
|
-
t('leadgen.message.title.default');
|
|
2996
|
-
}, [subscriptionTitle, (_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]);
|
|
2997
|
-
const { image: thankyouImage, title: thankyouTitle, description: thankyouDescription, button: thankyouButton, } = ThankYouBlock || {};
|
|
2998
|
-
const intersectionObserverCallback = useCallback((entries) => {
|
|
2999
|
-
entries.forEach((entry) => {
|
|
3000
|
-
const { isIntersecting, target } = entry;
|
|
3001
|
-
if (!showThankyou &&
|
|
3002
|
-
isIntersecting &&
|
|
3003
|
-
target === refContainer.current) {
|
|
3004
|
-
impression();
|
|
3005
|
-
}
|
|
3006
|
-
});
|
|
3007
|
-
}, [impression, showThankyou]);
|
|
3008
|
-
const IObserver = new IntersectionObserver(intersectionObserverCallback);
|
|
3009
|
-
const middlewareOnSubmit = useCallback((values) => __awaiter(void 0, void 0, void 0, function* () {
|
|
3010
|
-
const newValues = {
|
|
3011
|
-
subscription_title,
|
|
3012
|
-
};
|
|
3013
|
-
const ssoValues = {
|
|
3014
|
-
sso_user_id: undefined,
|
|
3015
|
-
sso_uuid: undefined,
|
|
3016
|
-
sso_verified_profile: undefined,
|
|
3017
|
-
};
|
|
3018
|
-
const valueKeys = Object.keys(values);
|
|
3019
|
-
for (const key of valueKeys) {
|
|
3020
|
-
const isPhoneField = leadGenFieldNamePhone(listBlockAdded).some((k) => k === key);
|
|
3021
|
-
if (isPhoneField) {
|
|
3022
|
-
const phone = parsePhoneNumber(values[key]);
|
|
3023
|
-
if (phone.isValid()) {
|
|
3024
|
-
/** Seperate `area_code` and `phone_number` for BE */
|
|
3025
|
-
newValues['area_code'] = `+${phone.countryCallingCode}`;
|
|
3026
|
-
newValues['phone_number'] = phone.nationalNumber;
|
|
3027
|
-
/** Only case login has this update */
|
|
3028
|
-
if ((userInfo === null || userInfo === void 0 ? void 0 : userInfo.id) && (userInfo === null || userInfo === void 0 ? void 0 : userInfo.uid)) {
|
|
3029
|
-
ssoValues['sso_verified_profile'] =
|
|
3030
|
-
phone.number === (userInfo === null || userInfo === void 0 ? void 0 : userInfo.phone) ? 1 : 0;
|
|
3031
|
-
ssoValues['sso_user_id'] = userInfo === null || userInfo === void 0 ? void 0 : userInfo.id;
|
|
3032
|
-
ssoValues['sso_uuid'] = userInfo === null || userInfo === void 0 ? void 0 : userInfo.uid;
|
|
3033
|
-
}
|
|
3034
|
-
}
|
|
3035
|
-
continue;
|
|
3036
|
-
}
|
|
3037
|
-
newValues[key] = values[key];
|
|
3038
|
-
}
|
|
3039
|
-
setLoading(true);
|
|
3040
|
-
try {
|
|
3041
|
-
const reqValues = Object.assign(Object.assign({}, newValues), ssoValues);
|
|
3042
|
-
const { _data } = (yield submitSubscriptionBox(reqValues)) || {};
|
|
3043
|
-
const { model } = _data || {};
|
|
3044
|
-
if (model && (model === null || model === void 0 ? void 0 : model.id)) {
|
|
3045
|
-
setShowThankyou(true);
|
|
3046
|
-
const metaValues = {
|
|
3047
|
-
blocks: listBlockAdded || [],
|
|
3048
|
-
isUpdateSso: false,
|
|
3049
|
-
};
|
|
3050
|
-
/**
|
|
3051
|
-
* https://hhgdev.atlassian.net/browse/EL-468
|
|
3052
|
-
* This feature is just using in Subscription Box
|
|
3053
|
-
*/
|
|
3054
|
-
if (newValues === null || newValues === void 0 ? void 0 : newValues.name) {
|
|
3055
|
-
const { _data: ssoData, code: ssoErrorCode } = yield Service.postUserInfoFromLeadGen({ name: newValues === null || newValues === void 0 ? void 0 : newValues.name });
|
|
3056
|
-
if (ssoErrorCode && !ssoData) {
|
|
3057
|
-
return;
|
|
3058
|
-
}
|
|
3059
|
-
metaValues.isUpdateSso = true;
|
|
3060
|
-
onFinish === null || onFinish === void 0 ? void 0 : onFinish(reqValues, metaValues);
|
|
3061
|
-
return;
|
|
3062
|
-
}
|
|
3063
|
-
onFinish === null || onFinish === void 0 ? void 0 : onFinish(reqValues, metaValues);
|
|
3064
|
-
}
|
|
3065
|
-
}
|
|
3066
|
-
catch (error) {
|
|
3067
|
-
LeadLog('** LeadGen SubscriptionBox error : ', error);
|
|
3068
|
-
pushNotifications({
|
|
3069
|
-
message: t('leadgen.message.error.default'),
|
|
3070
|
-
type: 'danger',
|
|
3071
|
-
});
|
|
3072
|
-
}
|
|
3073
|
-
setLoading(false);
|
|
3074
|
-
}), [
|
|
3075
|
-
subscription_title,
|
|
3076
|
-
listBlockAdded,
|
|
3077
|
-
userInfo === null || userInfo === void 0 ? void 0 : userInfo.id,
|
|
3078
|
-
userInfo === null || userInfo === void 0 ? void 0 : userInfo.uid,
|
|
3079
|
-
userInfo === null || userInfo === void 0 ? void 0 : userInfo.phone,
|
|
3080
|
-
]);
|
|
3081
|
-
useEffect(() => {
|
|
3082
|
-
if (refContainer.current) {
|
|
3083
|
-
IObserver.observe(refContainer.current);
|
|
3084
|
-
}
|
|
3085
|
-
return () => {
|
|
3086
|
-
IObserver.disconnect();
|
|
3087
|
-
};
|
|
3088
|
-
}, [categoryId]);
|
|
3089
|
-
return (React__default.createElement("div", { ref: refContainer },
|
|
3090
|
-
React__default.createElement(StyledLeadGenSubscriptionBox, null,
|
|
3091
|
-
showThankyou && (React__default.createElement(LeadGenThankYou, { image: Object.assign(Object.assign({}, thankyouImage), { src: thankyouImage.src || `${apiLeadUrl}admin/img/thanksyou.png` }), title: thankyouTitle, description: thankyouDescription, button: thankyouButton })),
|
|
3092
|
-
!showThankyou && (React__default.createElement(LeadGenSubscriptionBoxA, { loading: loading, image: subscriptionIcon || image, title: subscription_title, submitText: (_c = submitBlock === null || submitBlock === void 0 ? void 0 : submitBlock.data) === null || _c === void 0 ? void 0 : _c.value, blocks: listBlockAdded, locale: locale, form: form, rules: validateObj, onFinish: middlewareOnSubmit })))));
|
|
3093
|
-
};
|
|
3094
|
-
const LeadGenSubscriptionBox$1 = memo(LeadGenSubscriptionBoxWithoutMemo);
|
|
3095
|
-
|
|
3096
|
-
const Container = () => {
|
|
3097
|
-
const context = useContext(LeadGenContext);
|
|
3098
|
-
const { campaign_code, locale, siteId, siteDomain, userInfo, forceCampaign } = context;
|
|
3099
|
-
if (!forceCampaign || !(forceCampaign === null || forceCampaign === void 0 ? void 0 : forceCampaign.id)) {
|
|
3100
|
-
return null;
|
|
3101
|
-
}
|
|
3102
|
-
return (React__default.createElement(LeadGenSubscriptionBox$1, { locale: locale, siteId: siteId, siteDomain: siteDomain, userInfo: userInfo, forceCampaign: forceCampaign, campaign_code: campaign_code }));
|
|
3103
|
-
};
|
|
3104
|
-
Container.displayName = 'LeadGenSubscriptionBox';
|
|
3105
|
-
const LeadGenSubscriptionBoxContainer = (props) => {
|
|
3106
|
-
const { apiUrl, apiSubotUrl } = props;
|
|
3107
|
-
return (React__default.createElement(LeadGenContextProvider, Object.assign({}, props, { apiLeadUrl: apiUrl, apiSubotUrl: apiSubotUrl }),
|
|
3108
|
-
React__default.createElement(Container, null)));
|
|
3109
|
-
};
|
|
3110
|
-
const LeadGenSubscriptionBox = LeadGenSubscriptionBoxContainer;
|
|
3111
|
-
|
|
3112
|
-
const useImageSize = (src) => {
|
|
3113
|
-
const [width, setWidth] = useState(16);
|
|
3114
|
-
const [height, setHeight] = useState(9);
|
|
3115
|
-
const [loaded, setLoaded] = useState(false);
|
|
3116
|
-
// load src image to get its width and height
|
|
3117
|
-
useEffect(() => {
|
|
3118
|
-
setLoaded(false);
|
|
3119
|
-
if (src) {
|
|
3120
|
-
const img = new Image();
|
|
3121
|
-
img.addEventListener('load', () => {
|
|
3122
|
-
setWidth(img.naturalWidth);
|
|
3123
|
-
setHeight(img.naturalHeight);
|
|
3124
|
-
setLoaded(true);
|
|
3125
|
-
});
|
|
3126
|
-
img.addEventListener('error', () => {
|
|
3127
|
-
setWidth(16);
|
|
3128
|
-
setHeight(9);
|
|
3129
|
-
setLoaded(true);
|
|
3130
|
-
});
|
|
3131
|
-
img.src = src;
|
|
3132
|
-
}
|
|
3133
|
-
else {
|
|
3134
|
-
setWidth(16);
|
|
3135
|
-
setHeight(9);
|
|
3136
|
-
setLoaded(true);
|
|
3137
|
-
}
|
|
3138
|
-
}, [src]);
|
|
3139
|
-
return {
|
|
3140
|
-
loaded,
|
|
3141
|
-
width,
|
|
3142
|
-
height,
|
|
3143
|
-
};
|
|
3144
|
-
};
|
|
3145
|
-
|
|
3146
|
-
const CloseButton = ({ onClose, containerClassName, svgClassName, }) => (React__default.createElement("button", { onClick: onClose, className: `le-newbuilder-close-button js-modal__close ${containerClassName || ''}` },
|
|
3147
|
-
React__default.createElement("svg", { width: "1em", height: "1em", viewBox: "0 0 20 20", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", className: svgClassName },
|
|
3148
|
-
React__default.createElement("path", { d: "M9.99981 10.8432L14.0583 14.9017C14.1691 15.0125 14.3083 15.0691 14.476 15.0717C14.6437 15.0743 14.7854 15.0176 14.9013 14.9017C15.0172 14.7858 15.0752 14.6453 15.0752 14.4802C15.0752 14.3151 15.0172 14.1746 14.9013 14.0587L10.8429 10.0002L14.9013 5.9417C15.0121 5.83094 15.0688 5.69172 15.0713 5.52402C15.0739 5.35634 15.0172 5.21456 14.9013 5.09866C14.7854 4.98276 14.6449 4.9248 14.4798 4.9248C14.3147 4.9248 14.1742 4.98276 14.0583 5.09866L9.99981 9.15712L5.94133 5.09866C5.83057 4.98789 5.69135 4.93122 5.52365 4.92866C5.35598 4.92609 5.21419 4.98276 5.09829 5.09866C4.98239 5.21456 4.92444 5.35506 4.92444 5.52018C4.92444 5.6853 4.98239 5.82581 5.09829 5.9417L9.15675 10.0002L5.09829 14.0587C4.98752 14.1694 4.93085 14.3087 4.9283 14.4763C4.92572 14.644 4.98239 14.7858 5.09829 14.9017C5.21419 15.0176 5.3547 15.0756 5.51982 15.0756C5.68493 15.0756 5.82544 15.0176 5.94133 14.9017L9.99981 10.8432Z" }))));
|
|
3149
|
-
|
|
3150
|
-
// url: imageBlocks.imageMobile.data.url
|
|
3151
|
-
// newTab: imageBlocks.imageMobile.data.newtab
|
|
3152
|
-
// imageMobile: campaignShow.image
|
|
3153
|
-
// imageDestkop: campaignShow.image_desktop
|
|
3154
|
-
const CenterTabLayout = ({ popupId, url, newTab, imageDestkop, imageMobile, onClose, onOtherSubmit, }) => {
|
|
3155
|
-
const { width: imageMobileWidth, height: imageMobileHeight, loaded: imageMobileLoaded, } = useImageSize(imageMobile);
|
|
3156
|
-
const { width: imageDestkopWidth, height: imageDestkopHeight, loaded: imageDestkopLoaded, } = useImageSize(imageDestkop);
|
|
3157
|
-
if (!imageMobileLoaded || !imageDestkopLoaded)
|
|
1412
|
+
const CloseButton = ({ onClose, containerClassName, svgClassName, }) => (React__default.createElement("button", { onClick: onClose, className: `le-newbuilder-close-button js-modal__close ${containerClassName || ''}` },
|
|
1413
|
+
React__default.createElement("svg", { width: "1em", height: "1em", viewBox: "0 0 20 20", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", className: svgClassName },
|
|
1414
|
+
React__default.createElement("path", { d: "M9.99981 10.8432L14.0583 14.9017C14.1691 15.0125 14.3083 15.0691 14.476 15.0717C14.6437 15.0743 14.7854 15.0176 14.9013 14.9017C15.0172 14.7858 15.0752 14.6453 15.0752 14.4802C15.0752 14.3151 15.0172 14.1746 14.9013 14.0587L10.8429 10.0002L14.9013 5.9417C15.0121 5.83094 15.0688 5.69172 15.0713 5.52402C15.0739 5.35634 15.0172 5.21456 14.9013 5.09866C14.7854 4.98276 14.6449 4.9248 14.4798 4.9248C14.3147 4.9248 14.1742 4.98276 14.0583 5.09866L9.99981 9.15712L5.94133 5.09866C5.83057 4.98789 5.69135 4.93122 5.52365 4.92866C5.35598 4.92609 5.21419 4.98276 5.09829 5.09866C4.98239 5.21456 4.92444 5.35506 4.92444 5.52018C4.92444 5.6853 4.98239 5.82581 5.09829 5.9417L9.15675 10.0002L5.09829 14.0587C4.98752 14.1694 4.93085 14.3087 4.9283 14.4763C4.92572 14.644 4.98239 14.7858 5.09829 14.9017C5.21419 15.0176 5.3547 15.0756 5.51982 15.0756C5.68493 15.0756 5.82544 15.0176 5.94133 14.9017L9.99981 10.8432Z" }))));
|
|
1415
|
+
|
|
1416
|
+
// url: imageBlocks.imageMobile.data.url
|
|
1417
|
+
// newTab: imageBlocks.imageMobile.data.newtab
|
|
1418
|
+
// imageMobile: campaignShow.image
|
|
1419
|
+
// imageDestkop: campaignShow.image_desktop
|
|
1420
|
+
const CenterTabLayout = ({ popupId, url, newTab, imageDestkop, imageMobile, onClose, onOtherSubmit, }) => {
|
|
1421
|
+
const { width: imageMobileWidth, height: imageMobileHeight, loaded: imageMobileLoaded, } = useImageSize(imageMobile);
|
|
1422
|
+
const { width: imageDestkopWidth, height: imageDestkopHeight, loaded: imageDestkopLoaded, } = useImageSize(imageDestkop);
|
|
1423
|
+
if (!imageMobileLoaded || !imageDestkopLoaded)
|
|
3158
1424
|
return null;
|
|
3159
1425
|
return (React__default.createElement("div", { id: popupId, className: "lead-modal-wrapper", "data-popup-url": location.pathname, "data-popup-type": "center_tab" },
|
|
3160
1426
|
React__default.createElement("div", { className: "le-center-tab-popup" },
|
|
@@ -3223,7 +1489,7 @@ const FloatingLayout = ({ popupId, url, title, urlText, titleAlign, subtitle, su
|
|
|
3223
1489
|
};
|
|
3224
1490
|
|
|
3225
1491
|
const ThankyouPopup = ({ title, titleAlign, subtitle, subtitleAlign, link, linkNewTab, linkText, image, }) => {
|
|
3226
|
-
const { primaryColor } = useContext(LeadGenContext
|
|
1492
|
+
const { primaryColor } = useContext(LeadGenContext);
|
|
3227
1493
|
const { width: imageWidth, height: imageHeight, loaded: imageLoaded, } = useImageSize(image);
|
|
3228
1494
|
if (!imageLoaded)
|
|
3229
1495
|
return null;
|
|
@@ -3391,6 +1657,222 @@ const EmptyComponent = ({ onClose, onContinue, }) => {
|
|
|
3391
1657
|
React__default.createElement(Button$1, { onClick: onContinue, size: "lg", variant: "filled", fullWidth: false, className: "leadgen-btn leadgen-btn_empty_again" }, t('lead.empty.submitAgain')))));
|
|
3392
1658
|
};
|
|
3393
1659
|
|
|
1660
|
+
const libraries = ['places'];
|
|
1661
|
+
const GoogleLocationBlock = (props) => {
|
|
1662
|
+
var _a;
|
|
1663
|
+
const { inputWrapperOrder = ['label', 'input', 'description', 'error'], defaultValue, value: valueProps, onChange: onChangeProps, locale } = props, restProps = __rest(props, ["inputWrapperOrder", "defaultValue", "value", "onChange", "locale"]);
|
|
1664
|
+
const [LoadScript, setLoadScript] = useState(null);
|
|
1665
|
+
const [value, setValue] = useState(defaultValue || valueProps);
|
|
1666
|
+
const { predictions } = usePlacesAutocomplete(value, '', locale === 'tl-PH' ? 'en' : (_a = locale === null || locale === void 0 ? void 0 : locale.split('-')) === null || _a === void 0 ? void 0 : _a[0]);
|
|
1667
|
+
const onChangeAutocomplete = useCallback((s) => {
|
|
1668
|
+
setValue(s);
|
|
1669
|
+
onChangeProps === null || onChangeProps === void 0 ? void 0 : onChangeProps(s);
|
|
1670
|
+
}, []);
|
|
1671
|
+
const onClickItem = useCallback((item) => {
|
|
1672
|
+
/** For sure get value */
|
|
1673
|
+
setValue(item.value);
|
|
1674
|
+
const predCur = predictions === null || predictions === void 0 ? void 0 : predictions.find(({ description }) => description === item.value);
|
|
1675
|
+
onChangeProps === null || onChangeProps === void 0 ? void 0 : onChangeProps(item.value, predCur === null || predCur === void 0 ? void 0 : predCur.rawData);
|
|
1676
|
+
}, [onChangeProps, predictions]);
|
|
1677
|
+
useEffect(() => {
|
|
1678
|
+
setValue(valueProps);
|
|
1679
|
+
}, [valueProps]);
|
|
1680
|
+
useEffect(() => {
|
|
1681
|
+
var _a, _b, _c;
|
|
1682
|
+
// only load extra google script when not yet loaded
|
|
1683
|
+
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) && !LoadScript) {
|
|
1684
|
+
import('@react-google-maps/api').then((m) => {
|
|
1685
|
+
setLoadScript(() => m.LoadScript);
|
|
1686
|
+
});
|
|
1687
|
+
}
|
|
1688
|
+
}, []);
|
|
1689
|
+
return (React__default.createElement(Autocomplete, Object.assign({ defaultValue: defaultValue, value: value, onChange: onChangeAutocomplete, data: predictions.map((pred) => {
|
|
1690
|
+
return { value: pred.description, label: pred.description };
|
|
1691
|
+
}), filter: () => true, onItemSubmit: onClickItem, inputWrapperOrder: inputWrapperOrder, zIndex: ZINDEX_SSO - 9e6 + 2, withinPortal: true, styles: { dropdown: { pointerEvents: 'auto' } }, inputContainer: (children) => {
|
|
1692
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
1693
|
+
LoadScript && (React__default.createElement(LoadScript, { googleMapsApiKey: GOOGLE_API_KEY, libraries: libraries, loadingElement: React__default.createElement(React__default.Fragment, null), style: { width: '100%' } })),
|
|
1694
|
+
children));
|
|
1695
|
+
} }, restProps)));
|
|
1696
|
+
};
|
|
1697
|
+
|
|
1698
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
1699
|
+
const customParseFormat = require('dayjs/plugin/customParseFormat');
|
|
1700
|
+
dayjs.extend(customParseFormat);
|
|
1701
|
+
// You can give context variables any name
|
|
1702
|
+
const [LeadFormProvider, useLeadFormContext, useLeadForm] = createFormContext();
|
|
1703
|
+
const useLeadFormConfig = ({ listBlockAdded = [], validatingPhoneRef, validatingEmailRef, campaignId, campaign_subot_id = [], userInfo, format, }) => {
|
|
1704
|
+
const { t } = useTranslations();
|
|
1705
|
+
const initialValues = useMemo(() => mappingSSOToLead(userInfo), [userInfo === null || userInfo === void 0 ? void 0 : userInfo.id]);
|
|
1706
|
+
const validateObj = useMemo(() => {
|
|
1707
|
+
const InputBlocks = [
|
|
1708
|
+
'TextBlock',
|
|
1709
|
+
'NumberBlock',
|
|
1710
|
+
'EmailBlock',
|
|
1711
|
+
'PhoneBlock',
|
|
1712
|
+
'DateBlock',
|
|
1713
|
+
'CheckboxBlock',
|
|
1714
|
+
'RadioBlock',
|
|
1715
|
+
'DropdownBlock',
|
|
1716
|
+
'PhoneOtpBlock',
|
|
1717
|
+
'WhatsappOtpBlock',
|
|
1718
|
+
'ZaloOtpBlock',
|
|
1719
|
+
'LocationBlock',
|
|
1720
|
+
'TncBlock',
|
|
1721
|
+
];
|
|
1722
|
+
// ALL are required and can skip if not touched yet
|
|
1723
|
+
const withSharedCheck = (name, cb,
|
|
1724
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1725
|
+
block) => {
|
|
1726
|
+
return (value) => {
|
|
1727
|
+
var _a;
|
|
1728
|
+
const isBLockRequired = (_a = block === null || block === void 0 ? void 0 : block.data) === null || _a === void 0 ? void 0 : _a.required;
|
|
1729
|
+
if (!formRef.current.isTouched(name))
|
|
1730
|
+
return;
|
|
1731
|
+
if ((typeof value === 'string' && value.trim() === '') ||
|
|
1732
|
+
typeof value === 'undefined' ||
|
|
1733
|
+
(Array.isArray(value) && value.length === 0)) {
|
|
1734
|
+
return isBLockRequired
|
|
1735
|
+
? t('validator.required')
|
|
1736
|
+
: cb === null || cb === void 0 ? void 0 : cb(value);
|
|
1737
|
+
}
|
|
1738
|
+
return cb === null || cb === void 0 ? void 0 : cb(value);
|
|
1739
|
+
};
|
|
1740
|
+
};
|
|
1741
|
+
return listBlockAdded
|
|
1742
|
+
.filter((b) => InputBlocks.includes(b.name))
|
|
1743
|
+
.reduce((r, b) => {
|
|
1744
|
+
const { name: fieldType, data } = b || {};
|
|
1745
|
+
const { value: fieldName, required } = data || {};
|
|
1746
|
+
const isRequired = required !== null && required !== void 0 ? required : true;
|
|
1747
|
+
if (fieldType === 'NumberBlock') {
|
|
1748
|
+
return Object.assign(Object.assign({}, r), { [fieldName]: withSharedCheck(fieldName, (value) => {
|
|
1749
|
+
if (value && isNaN(Number(value))) {
|
|
1750
|
+
return t('validator.number');
|
|
1751
|
+
}
|
|
1752
|
+
}, b) });
|
|
1753
|
+
}
|
|
1754
|
+
else if (fieldType === 'EmailBlock') {
|
|
1755
|
+
return Object.assign(Object.assign({}, r), { [fieldName]: withSharedCheck(fieldName, (value) => {
|
|
1756
|
+
if (value && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) {
|
|
1757
|
+
return t('validator.email');
|
|
1758
|
+
}
|
|
1759
|
+
if (!value)
|
|
1760
|
+
return;
|
|
1761
|
+
validatingEmailRef.current = true;
|
|
1762
|
+
setTimeout(() => {
|
|
1763
|
+
formRef.current.setFieldError(fieldName, 'Validating...');
|
|
1764
|
+
checkUsedEmailOrPhoneWithCache(campaignId, campaign_subot_id, {
|
|
1765
|
+
email: value,
|
|
1766
|
+
})
|
|
1767
|
+
.then((tKey) => {
|
|
1768
|
+
if (tKey) {
|
|
1769
|
+
formRef.current.setFieldError(fieldName, t(tKey));
|
|
1770
|
+
}
|
|
1771
|
+
else {
|
|
1772
|
+
formRef.current.clearFieldError(fieldName);
|
|
1773
|
+
}
|
|
1774
|
+
validatingEmailRef.current = false;
|
|
1775
|
+
})
|
|
1776
|
+
.catch((e) => {
|
|
1777
|
+
console.error(e);
|
|
1778
|
+
formRef.current.setFieldError(fieldName, e.message || 'Something went wrong');
|
|
1779
|
+
validatingEmailRef.current = false;
|
|
1780
|
+
});
|
|
1781
|
+
}, 200);
|
|
1782
|
+
}, b) });
|
|
1783
|
+
}
|
|
1784
|
+
else if (fieldType === 'PhoneBlock' ||
|
|
1785
|
+
fieldType === 'PhoneOtpBlock' ||
|
|
1786
|
+
fieldType === 'ZaloOtpBlock' ||
|
|
1787
|
+
fieldType === 'WhatsappOtpBlock') {
|
|
1788
|
+
return Object.assign(Object.assign({}, r), { [fieldName]: withSharedCheck(fieldName, (value) => {
|
|
1789
|
+
if (value &&
|
|
1790
|
+
window.intlTelInputUtils &&
|
|
1791
|
+
!window.intlTelInputUtils.isValidNumber(String(value), LEAD_LOCALE.countryCode)) {
|
|
1792
|
+
return t('validator.phone');
|
|
1793
|
+
}
|
|
1794
|
+
if (!value)
|
|
1795
|
+
return;
|
|
1796
|
+
validatingPhoneRef.current = true;
|
|
1797
|
+
setTimeout(() => {
|
|
1798
|
+
formRef.current.setFieldError(fieldName, 'Validating...');
|
|
1799
|
+
if (b.data.singleSubmission) {
|
|
1800
|
+
checkUsedPhoneOnlyWithCache(campaignId, value)
|
|
1801
|
+
.then((tKey) => {
|
|
1802
|
+
if (tKey) {
|
|
1803
|
+
formRef.current.setFieldError(fieldName, t(tKey));
|
|
1804
|
+
}
|
|
1805
|
+
else {
|
|
1806
|
+
formRef.current.clearFieldError(fieldName);
|
|
1807
|
+
}
|
|
1808
|
+
validatingPhoneRef.current = false;
|
|
1809
|
+
})
|
|
1810
|
+
.catch((err) => {
|
|
1811
|
+
console.error(err);
|
|
1812
|
+
formRef.current.setFieldError(fieldName, err.message || 'Something went wrong');
|
|
1813
|
+
validatingPhoneRef.current = false;
|
|
1814
|
+
});
|
|
1815
|
+
}
|
|
1816
|
+
else {
|
|
1817
|
+
checkUsedEmailOrPhoneWithCache(campaignId, campaign_subot_id, {
|
|
1818
|
+
phone: value,
|
|
1819
|
+
})
|
|
1820
|
+
.then((tKey) => {
|
|
1821
|
+
if (tKey) {
|
|
1822
|
+
formRef.current.setFieldError(fieldName, t(tKey));
|
|
1823
|
+
}
|
|
1824
|
+
else {
|
|
1825
|
+
formRef.current.clearFieldError(fieldName);
|
|
1826
|
+
}
|
|
1827
|
+
validatingPhoneRef.current = false;
|
|
1828
|
+
})
|
|
1829
|
+
.catch((e) => {
|
|
1830
|
+
console.error(e);
|
|
1831
|
+
formRef.current.setFieldError(fieldName, e.message || 'Something went wrong');
|
|
1832
|
+
validatingPhoneRef.current = false;
|
|
1833
|
+
});
|
|
1834
|
+
}
|
|
1835
|
+
}, 200);
|
|
1836
|
+
}, b) });
|
|
1837
|
+
}
|
|
1838
|
+
else if (fieldType === 'DateBlock') {
|
|
1839
|
+
return Object.assign(Object.assign({}, r), { [fieldName]: withSharedCheck(fieldName, (value) => {
|
|
1840
|
+
if (!isRequired && !value) {
|
|
1841
|
+
return;
|
|
1842
|
+
}
|
|
1843
|
+
const errMsg = t('validator.dateInvalid');
|
|
1844
|
+
const dayInJS = typeof value === 'string'
|
|
1845
|
+
? dayjs(value, format, true)
|
|
1846
|
+
: dayjs(value);
|
|
1847
|
+
if (!dayInJS.isValid()) {
|
|
1848
|
+
return errMsg;
|
|
1849
|
+
}
|
|
1850
|
+
}, b) });
|
|
1851
|
+
}
|
|
1852
|
+
else if (fieldType === 'TncBlock') {
|
|
1853
|
+
return Object.assign(Object.assign({}, r), { [`TNC-` + b.id]: withSharedCheck('TNC-' + b.id, (value) => {
|
|
1854
|
+
if (isRequired && !value) {
|
|
1855
|
+
return t('validator.required');
|
|
1856
|
+
}
|
|
1857
|
+
}, b) });
|
|
1858
|
+
}
|
|
1859
|
+
else {
|
|
1860
|
+
return Object.assign(Object.assign({}, r), { [fieldName]: withSharedCheck(fieldName, undefined, b) });
|
|
1861
|
+
}
|
|
1862
|
+
}, {});
|
|
1863
|
+
}, [listBlockAdded.map((b) => b.name).join(','), format]);
|
|
1864
|
+
const form = useLeadForm({
|
|
1865
|
+
validateInputOnChange: true,
|
|
1866
|
+
validateInputOnBlur: true,
|
|
1867
|
+
clearInputErrorOnChange: true,
|
|
1868
|
+
validate: validateObj,
|
|
1869
|
+
initialValues,
|
|
1870
|
+
});
|
|
1871
|
+
const formRef = useRef(form);
|
|
1872
|
+
formRef.current = form;
|
|
1873
|
+
return { form, validateObj };
|
|
1874
|
+
};
|
|
1875
|
+
|
|
3394
1876
|
const SubtitleBlock = ({ children, align, }) => (React__default.createElement("p", { className: `lead-modal__description ${'le-text-align-' + (align || '')} ${LEAD_CLASS}` }, children));
|
|
3395
1877
|
|
|
3396
1878
|
const cssInputNotShrink = css `
|
|
@@ -3717,13 +2199,11 @@ const TextField = (props) => {
|
|
|
3717
2199
|
const $focusEl = $textEl.item($textEl.length - 1);
|
|
3718
2200
|
if ($focusEl) {
|
|
3719
2201
|
$focusEl.focus();
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
});
|
|
3726
|
-
}, 100);
|
|
2202
|
+
$focusEl.scrollIntoView({
|
|
2203
|
+
behavior: 'auto',
|
|
2204
|
+
block: 'center',
|
|
2205
|
+
inline: 'start',
|
|
2206
|
+
});
|
|
3727
2207
|
}
|
|
3728
2208
|
}, [shrink]);
|
|
3729
2209
|
useEffect(() => {
|
|
@@ -3954,7 +2434,7 @@ const HeaderImage = ({ src, ratio = 3 / 2, className, style, }) => {
|
|
|
3954
2434
|
};
|
|
3955
2435
|
|
|
3956
2436
|
const OtpBlock = ({ otpData, onSuccess, autoSendWhenOpen, }) => {
|
|
3957
|
-
const { primaryColor } = useContext(LeadGenContext
|
|
2437
|
+
const { primaryColor } = useContext(LeadGenContext);
|
|
3958
2438
|
const { t } = useTranslations();
|
|
3959
2439
|
const phone = otpData.phone;
|
|
3960
2440
|
const otpType = otpData.type;
|
|
@@ -4053,358 +2533,702 @@ const OtpBlock = ({ otpData, onSuccess, autoSendWhenOpen, }) => {
|
|
|
4053
2533
|
if (autoSendWhenOpen && !resendTimer) {
|
|
4054
2534
|
sendOtp();
|
|
4055
2535
|
}
|
|
4056
|
-
}, []);
|
|
4057
|
-
return (React__default.createElement("form", { onSubmit: (e) => {
|
|
4058
|
-
e.preventDefault();
|
|
4059
|
-
submitOtp();
|
|
4060
|
-
}, className: "lead-phone-otp-form leadgen-form leadgen-form_otp" },
|
|
4061
|
-
React__default.createElement(FormContainer, { title: t('lead.otp.title'), description: t('lead.otp.desc', {
|
|
4062
|
-
phone: `<strong>${displayPhone}</strong>`,
|
|
4063
|
-
}), footer: React__default.createElement(React__default.Fragment, null,
|
|
4064
|
-
React__default.createElement(Button$1, { type: "submit", size: "lg", variant: "filled", className: `lead-modal__btn leadgen-btn_action ${LEAD_CLASS}`, color: primaryColor, disabled: !otp, loading: isSubmitLoading }, t('lead.otp.verify')),
|
|
4065
|
-
React__default.createElement(Button$1, { type: "button", size: "lg", variant: "light", className: `lead-modal__btn lead-phone-otp-button leadgen-btn_action ${LEAD_CLASS}`, color: primaryColor, onClick: () => {
|
|
4066
|
-
sendOtp();
|
|
4067
|
-
}, disabled: !!resendTimer }, t('lead.otp.resend', {
|
|
4068
|
-
timer: resendTimer ? ` (${resendTimer}s)` : '',
|
|
4069
|
-
}))) },
|
|
4070
|
-
React__default.createElement("div", { className: "leadgen-form_inner" },
|
|
4071
|
-
React__default.createElement(Input.Wrapper, { error: isDirty ? errorMsg : undefined, className: "leadgen-form_field" },
|
|
4072
|
-
React__default.createElement(OTP, { ref: inputRef, name: '_' + name + '-otp', value: otp, onChange: (v) => {
|
|
4073
|
-
setIsDirty(true);
|
|
4074
|
-
setOtp(v.toString());
|
|
4075
|
-
if (isDirty && !v)
|
|
4076
|
-
setErrorMsg('OTP is required');
|
|
4077
|
-
else
|
|
4078
|
-
setErrorMsg(undefined);
|
|
4079
|
-
} }))))));
|
|
2536
|
+
}, []);
|
|
2537
|
+
return (React__default.createElement("form", { onSubmit: (e) => {
|
|
2538
|
+
e.preventDefault();
|
|
2539
|
+
submitOtp();
|
|
2540
|
+
}, className: "lead-phone-otp-form leadgen-form leadgen-form_otp" },
|
|
2541
|
+
React__default.createElement(FormContainer, { title: t('lead.otp.title'), description: t('lead.otp.desc', {
|
|
2542
|
+
phone: `<strong>${displayPhone}</strong>`,
|
|
2543
|
+
}), footer: React__default.createElement(React__default.Fragment, null,
|
|
2544
|
+
React__default.createElement(Button$1, { type: "submit", size: "lg", variant: "filled", className: `lead-modal__btn leadgen-btn_action ${LEAD_CLASS}`, color: primaryColor, disabled: !otp, loading: isSubmitLoading }, t('lead.otp.verify')),
|
|
2545
|
+
React__default.createElement(Button$1, { type: "button", size: "lg", variant: "light", className: `lead-modal__btn lead-phone-otp-button leadgen-btn_action ${LEAD_CLASS}`, color: primaryColor, onClick: () => {
|
|
2546
|
+
sendOtp();
|
|
2547
|
+
}, disabled: !!resendTimer }, t('lead.otp.resend', {
|
|
2548
|
+
timer: resendTimer ? ` (${resendTimer}s)` : '',
|
|
2549
|
+
}))) },
|
|
2550
|
+
React__default.createElement("div", { className: "leadgen-form_inner" },
|
|
2551
|
+
React__default.createElement(Input.Wrapper, { error: isDirty ? errorMsg : undefined, className: "leadgen-form_field" },
|
|
2552
|
+
React__default.createElement(OTP, { ref: inputRef, name: '_' + name + '-otp', value: otp, onChange: (v) => {
|
|
2553
|
+
setIsDirty(true);
|
|
2554
|
+
setOtp(v.toString());
|
|
2555
|
+
if (isDirty && !v)
|
|
2556
|
+
setErrorMsg('OTP is required');
|
|
2557
|
+
else
|
|
2558
|
+
setErrorMsg(undefined);
|
|
2559
|
+
} }))))));
|
|
2560
|
+
};
|
|
2561
|
+
|
|
2562
|
+
// url: imageBlocks.imageMobile.data.url
|
|
2563
|
+
// newTab: imageBlocks.imageMobile.data.newtab
|
|
2564
|
+
// image: campaignShow.image
|
|
2565
|
+
// imageDestkop: campaignShow.image_desktop
|
|
2566
|
+
const LEADGEN_LAYOUT_NOT_SHOW_IN_MOBILE = [
|
|
2567
|
+
LEADGEN_LAYOUT.Fullscreen,
|
|
2568
|
+
LEADGEN_LAYOUT.Slider,
|
|
2569
|
+
];
|
|
2570
|
+
const LEADGEN_LIMIT_LIGHTBOXB = 6;
|
|
2571
|
+
const LEADGEN_SHOW_HEADER = [
|
|
2572
|
+
'LightBoxA',
|
|
2573
|
+
'InlineA',
|
|
2574
|
+
LEADGEN_LAYOUT.Sidebar,
|
|
2575
|
+
LEADGEN_LAYOUT.Slider,
|
|
2576
|
+
];
|
|
2577
|
+
const LightboxLayout = ({ popupId, extraFields, onClose: onCloseProp, onOtherSubmit, imageMobile, imageDesktop, imageOverlayMobile, imageOverlayDesktop, imageBackground, currentLayout, title, onSubmit, showThankyou, campaignId, campaign_subot_id, locale, showEmpty, setShowEmpty, userInfo, }) => {
|
|
2578
|
+
var _a, _b;
|
|
2579
|
+
const { primaryColor } = useContext(LeadGenContext);
|
|
2580
|
+
const { isMobile } = useScreenSize();
|
|
2581
|
+
const [open, setOpen] = useState(!!campaignId);
|
|
2582
|
+
const [showOtpPhone, setShowOtpPhone] = useState(null);
|
|
2583
|
+
const [isSubmitLoading, setIsSubmitLoading] = useState(false);
|
|
2584
|
+
const [snap, setSnap] = useState(0.8);
|
|
2585
|
+
const formRef = useRef();
|
|
2586
|
+
const onClose = () => {
|
|
2587
|
+
if (showOtpPhone) {
|
|
2588
|
+
setShowOtpPhone(null);
|
|
2589
|
+
}
|
|
2590
|
+
else {
|
|
2591
|
+
onCloseProp === null || onCloseProp === void 0 ? void 0 : onCloseProp();
|
|
2592
|
+
}
|
|
2593
|
+
};
|
|
2594
|
+
const textBlocks = JSON.parse(extraFields.textBlocks);
|
|
2595
|
+
const listBlockAdded = JSON.parse(extraFields.listBlockAdded);
|
|
2596
|
+
const actionBlocks = JSON.parse(extraFields.actionBlocks);
|
|
2597
|
+
const popUpSubmitText = actionBlocks.submitBlock.data.value;
|
|
2598
|
+
const currentPath = location.pathname;
|
|
2599
|
+
const { align: descriptionAlign, value: description } = textBlocks.subtitleBlock.data || {};
|
|
2600
|
+
const { align: titleAlign } = textBlocks.titleBlock.data || {};
|
|
2601
|
+
const isSlider = currentLayout === LEADGEN_LAYOUT.Slider;
|
|
2602
|
+
const isSidebar = currentLayout === LEADGEN_LAYOUT.Sidebar;
|
|
2603
|
+
const isLightBox = currentLayout.includes('LightBox');
|
|
2604
|
+
const isLightBoxA = currentLayout === LEADGEN_LAYOUT.LightBoxA;
|
|
2605
|
+
const isLightBoxB = currentLayout === LEADGEN_LAYOUT.LightBoxB;
|
|
2606
|
+
const isInline = currentLayout.includes('Inline');
|
|
2607
|
+
const isFullscreen = currentLayout === LEADGEN_LAYOUT.Fullscreen;
|
|
2608
|
+
const isInPage = isInline || isSidebar;
|
|
2609
|
+
const isDrawer = isLightBoxB && isMobile;
|
|
2610
|
+
const limitFieldsLightBoxB = isLightBoxB && listBlockAdded.length <= LEADGEN_LIMIT_LIGHTBOXB;
|
|
2611
|
+
const hasForm = isLightBoxA
|
|
2612
|
+
? listBlockAdded.some((item) => LEADGEN_BLOCK_IN_FORM.some((k) => k === (item === null || item === void 0 ? void 0 : item.name)))
|
|
2613
|
+
: true;
|
|
2614
|
+
const headerInsideFormContainer = isSlider || isLightBoxA || isFullscreen;
|
|
2615
|
+
const showHeader = !!imageMobile || !!imageDesktop;
|
|
2616
|
+
const onlyHeader = !title && !description;
|
|
2617
|
+
const showButtonClose = !isInline;
|
|
2618
|
+
if (window.innerWidth < 769 &&
|
|
2619
|
+
LEADGEN_LAYOUT_NOT_SHOW_IN_MOBILE.includes(currentLayout)) {
|
|
2620
|
+
console.log('😎 Not show fullscreen, slider on mobile ');
|
|
2621
|
+
return null;
|
|
2622
|
+
}
|
|
2623
|
+
useEffect(() => {
|
|
2624
|
+
if (isLightBox || isFullscreen) {
|
|
2625
|
+
document.body.classList.add('noscroll');
|
|
2626
|
+
}
|
|
2627
|
+
if (!window.intlTelInputUtils) {
|
|
2628
|
+
require('intl-tel-input/build/js/utils');
|
|
2629
|
+
}
|
|
2630
|
+
clearCacheUsedEmailOrPhone();
|
|
2631
|
+
}, []);
|
|
2632
|
+
const validatingPhoneRef = useRef(false);
|
|
2633
|
+
const validatingEmailRef = useRef(false);
|
|
2634
|
+
const { form, validateObj } = useLeadFormConfig({
|
|
2635
|
+
listBlockAdded,
|
|
2636
|
+
validatingPhoneRef,
|
|
2637
|
+
validatingEmailRef,
|
|
2638
|
+
campaignId,
|
|
2639
|
+
campaign_subot_id,
|
|
2640
|
+
userInfo,
|
|
2641
|
+
format: (_a = (ISO_FORMAT[locale] || ISO_FORMAT['vi-VN'])) === null || _a === void 0 ? void 0 : _a.dateFormat,
|
|
2642
|
+
});
|
|
2643
|
+
const middlewareOnSubmit = (e) => {
|
|
2644
|
+
e.preventDefault();
|
|
2645
|
+
// mark all as touched to allow validation
|
|
2646
|
+
const fields = Object.keys(validateObj);
|
|
2647
|
+
const fieldStatus = fields.reduce((acc, cur) => {
|
|
2648
|
+
acc[cur] = true;
|
|
2649
|
+
return acc;
|
|
2650
|
+
}, {});
|
|
2651
|
+
form.setTouched(fieldStatus);
|
|
2652
|
+
if (validatingEmailRef.current || validatingPhoneRef.current) {
|
|
2653
|
+
return;
|
|
2654
|
+
}
|
|
2655
|
+
setTimeout(() => {
|
|
2656
|
+
form.onSubmit((v) => {
|
|
2657
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
2658
|
+
if (Object.keys(form.errors).length)
|
|
2659
|
+
return;
|
|
2660
|
+
let newShowOtpPhone = null;
|
|
2661
|
+
if (listBlockAdded.findIndex((x) => x.name === LEADGEN_BLOCK.PhoneOtpBlock) > -1) {
|
|
2662
|
+
// not submit yet, open otp
|
|
2663
|
+
const fieldName = (_b = (_a = listBlockAdded.find((x) => x.name === LEADGEN_BLOCK.PhoneOtpBlock)) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.value;
|
|
2664
|
+
if ((_c = v[fieldName]) === null || _c === void 0 ? void 0 : _c.startsWith('+')) {
|
|
2665
|
+
newShowOtpPhone = {
|
|
2666
|
+
phone: v[fieldName],
|
|
2667
|
+
type: 'phone',
|
|
2668
|
+
};
|
|
2669
|
+
}
|
|
2670
|
+
}
|
|
2671
|
+
if (listBlockAdded.findIndex((x) => x.name === LEADGEN_BLOCK.WhatsappOtpBlock) > -1) {
|
|
2672
|
+
// not submit yet, open otp
|
|
2673
|
+
const fieldName = (_e = (_d = listBlockAdded.find((x) => x.name === LEADGEN_BLOCK.WhatsappOtpBlock)) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.value;
|
|
2674
|
+
if ((_f = v[fieldName]) === null || _f === void 0 ? void 0 : _f.startsWith('+')) {
|
|
2675
|
+
newShowOtpPhone = {
|
|
2676
|
+
phone: v[fieldName],
|
|
2677
|
+
type: 'whatsapp',
|
|
2678
|
+
};
|
|
2679
|
+
}
|
|
2680
|
+
}
|
|
2681
|
+
if (listBlockAdded.findIndex((x) => x.name === LEADGEN_BLOCK.ZaloOtpBlock) > -1) {
|
|
2682
|
+
// not submit yet, open otp
|
|
2683
|
+
const fieldName = (_h = (_g = listBlockAdded.find((x) => x.name === LEADGEN_BLOCK.ZaloOtpBlock)) === null || _g === void 0 ? void 0 : _g.data) === null || _h === void 0 ? void 0 : _h.value;
|
|
2684
|
+
if ((_j = v[fieldName]) === null || _j === void 0 ? void 0 : _j.startsWith('+')) {
|
|
2685
|
+
newShowOtpPhone = {
|
|
2686
|
+
phone: v[fieldName],
|
|
2687
|
+
type: 'zalo',
|
|
2688
|
+
};
|
|
2689
|
+
}
|
|
2690
|
+
}
|
|
2691
|
+
if (newShowOtpPhone) {
|
|
2692
|
+
setIsSubmitLoading(true);
|
|
2693
|
+
Service.sendSMSOtpLead(newShowOtpPhone)
|
|
2694
|
+
.then((res) => {
|
|
2695
|
+
var _a;
|
|
2696
|
+
const respMessage = (_a = res === null || res === void 0 ? void 0 : res._messages) === null || _a === void 0 ? void 0 : _a[0];
|
|
2697
|
+
if (respMessage === 'This phone number was verified') {
|
|
2698
|
+
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(formRef.current, v);
|
|
2699
|
+
return;
|
|
2700
|
+
}
|
|
2701
|
+
setShowOtpPhone(newShowOtpPhone);
|
|
2702
|
+
})
|
|
2703
|
+
.finally(() => {
|
|
2704
|
+
setIsSubmitLoading(false);
|
|
2705
|
+
});
|
|
2706
|
+
return;
|
|
2707
|
+
}
|
|
2708
|
+
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(formRef.current, v);
|
|
2709
|
+
})(e);
|
|
2710
|
+
}, 100);
|
|
2711
|
+
};
|
|
2712
|
+
const onOpenChange = (_open) => {
|
|
2713
|
+
setOpen(_open);
|
|
2714
|
+
if (!_open) {
|
|
2715
|
+
setTimeout(() => {
|
|
2716
|
+
onClose();
|
|
2717
|
+
}, 250);
|
|
2718
|
+
}
|
|
2719
|
+
};
|
|
2720
|
+
const { width: imageBackgroundWidth, height: imageBackgroundHeight, loaded: imageBackgroundLoaded, } = useImageSize(imageBackground);
|
|
2721
|
+
const { loaded: imageMobileLoaded } = useImageSize(imageMobile);
|
|
2722
|
+
const { loaded: imageDesktopLoaded } = useImageSize(imageDesktop);
|
|
2723
|
+
const renderAfterImageSizes = imageMobileLoaded &&
|
|
2724
|
+
imageDesktopLoaded &&
|
|
2725
|
+
(isFullscreen ? imageBackgroundLoaded : true);
|
|
2726
|
+
const ButtonSubmit = useMemo(() => {
|
|
2727
|
+
var _a;
|
|
2728
|
+
return !((_a = actionBlocks === null || actionBlocks === void 0 ? void 0 : actionBlocks.submitBlock) === null || _a === void 0 ? void 0 : _a.isHide) && (React__default.createElement(Button$1, { size: "lg", id: "lead-submit", type: "submit", variant: "filled", className: "leadgen-btn leadgen-btn_action", loading: isSubmitLoading }, popUpSubmitText));
|
|
2729
|
+
}, [popUpSubmitText, isSubmitLoading, (_b = actionBlocks === null || actionBlocks === void 0 ? void 0 : actionBlocks.submitBlock) === null || _b === void 0 ? void 0 : _b.isHide]);
|
|
2730
|
+
const LinkButtonBlock = listBlockAdded.filter(({ name }) => name == LEADGEN_BLOCK.LinkButtonBlock);
|
|
2731
|
+
const ButtonLink = !!(LinkButtonBlock === null || LinkButtonBlock === void 0 ? void 0 : LinkButtonBlock.length) && (React__default.createElement(React__default.Fragment, null, LinkButtonBlock.map((item, index) => {
|
|
2732
|
+
var _a, _b, _c;
|
|
2733
|
+
return (React__default.createElement(Button$1, { key: `${item.name}-${index}`, component: "a", href: (_a = item === null || item === void 0 ? void 0 : item.data) === null || _a === void 0 ? void 0 : _a.url, target: ((_b = item === null || item === void 0 ? void 0 : item.data) === null || _b === void 0 ? void 0 : _b.newtab) ? '_blank' : undefined, size: "lg", variant: "filled", className: "leadgen-btn leadgen-btn_action", color: primaryColor, onClick: () => {
|
|
2734
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
2735
|
+
onOtherSubmit === null || onOtherSubmit === void 0 ? void 0 : onOtherSubmit();
|
|
2736
|
+
} }, (_c = item === null || item === void 0 ? void 0 : item.data) === null || _c === void 0 ? void 0 : _c.value));
|
|
2737
|
+
})));
|
|
2738
|
+
const PopupHeader = showHeader && (React__default.createElement("header", { className: clsx('leadgen-header', { 'leadgen-header_only': onlyHeader }) }, LEADGEN_SHOW_HEADER.includes(currentLayout) ? (React__default.createElement(HeaderImage, { src: imageMobile, className: "lead-modal__image" })) : (React__default.createElement(React__default.Fragment, null,
|
|
2739
|
+
React__default.createElement(HeaderImage, { src: imageDesktop, className: "le-only-desktop lead-modal__image" }),
|
|
2740
|
+
React__default.createElement(HeaderImage, { src: imageMobile, className: "le-only-mobile lead-modal__image" })))));
|
|
2741
|
+
const PopupEmpty = showEmpty && (React__default.createElement(EmptyComponent, { onClose: onClose, onContinue: () => setShowEmpty(false) }));
|
|
2742
|
+
const PopupForm = (React__default.createElement(LeadFormProvider, { form: form },
|
|
2743
|
+
React__default.createElement("form", { ref: formRef, className: "leadgen-form", onSubmit: middlewareOnSubmit },
|
|
2744
|
+
React__default.createElement(FormContainer, { title: title, titleAlign: titleAlign, description: description, descriptionAlign: descriptionAlign, header: headerInsideFormContainer && PopupHeader, footer: hasForm ? ButtonSubmit : ButtonLink, "data-hidden-form": !hasForm },
|
|
2745
|
+
React__default.createElement("div", { className: "leadgen-form_inner" },
|
|
2746
|
+
React__default.createElement(LightboxFields, { listBlockAdded: listBlockAdded, popupId: popupId, locale: locale, onClose: onClose, onOtherSubmit: onOtherSubmit }))))));
|
|
2747
|
+
const PopupOtp = showOtpPhone && (React__default.createElement(OtpBlock, { otpData: showOtpPhone, autoSendWhenOpen: false, onSuccess: () => {
|
|
2748
|
+
setShowOtpPhone(null);
|
|
2749
|
+
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(formRef.current, form.values);
|
|
2750
|
+
} }));
|
|
2751
|
+
const PopupThankYou = showThankyou && (React__default.createElement(ThankyouPopup, { title: showThankyou.title, titleAlign: showThankyou.titleAlign, subtitle: showThankyou.subtitle, subtitleAlign: showThankyou.subtitleAlign, link: showThankyou.link, linkNewTab: showThankyou.linkNewTab, linkText: showThankyou.linkText, image: showThankyou.image }));
|
|
2752
|
+
const PopupContent = (React__default.createElement("div", { className: clsx('leadgen-content', {
|
|
2753
|
+
'leadgen-content_small': limitFieldsLightBoxB,
|
|
2754
|
+
}) },
|
|
2755
|
+
!headerInsideFormContainer && PopupHeader,
|
|
2756
|
+
!onlyHeader && (React__default.createElement("div", { className: "leadgen-inner" },
|
|
2757
|
+
PopupThankYou,
|
|
2758
|
+
!showThankyou && (React__default.createElement(React__default.Fragment, null,
|
|
2759
|
+
PopupOtp,
|
|
2760
|
+
PopupEmpty,
|
|
2761
|
+
!(showOtpPhone || showEmpty) && PopupForm))))));
|
|
2762
|
+
const styleOverlay = useMemo(() => {
|
|
2763
|
+
let styleContent = `.leadgen-inner {background-repeat: no-repeat;background-size: cover;background-position:center;}`;
|
|
2764
|
+
if (isMobile && imageOverlayMobile) {
|
|
2765
|
+
styleContent += `.leadgen-inner {background-image: url(${imageOverlayMobile});}`;
|
|
2766
|
+
}
|
|
2767
|
+
if (!isMobile && imageOverlayDesktop) {
|
|
2768
|
+
styleContent += `@media screen and (min-width:768px) {.leadgen-inner {background-image: url(${imageOverlayDesktop});}}`;
|
|
2769
|
+
}
|
|
2770
|
+
return styleContent;
|
|
2771
|
+
}, [isMobile, imageOverlayDesktop, imageOverlayMobile]);
|
|
2772
|
+
const PopupWrapper = (React__default.createElement(React__default.Fragment, null,
|
|
2773
|
+
React__default.createElement("style", { dangerouslySetInnerHTML: { __html: styleOverlay } }),
|
|
2774
|
+
React__default.createElement("div", { className: clsx('leadgen-wrapper', {
|
|
2775
|
+
'leadgen-wrapper_small': limitFieldsLightBoxB,
|
|
2776
|
+
}) },
|
|
2777
|
+
showButtonClose && (React__default.createElement(CloseButton, { onClose: () => onOpenChange(false), containerClassName: "leadgen-close_btn" })),
|
|
2778
|
+
PopupContent)));
|
|
2779
|
+
const popupContainerClassName = clsx('leadgen', `leadgen-${currentLayout}`, {
|
|
2780
|
+
'leadgen-lightbox': isLightBox,
|
|
2781
|
+
'leadgen-inline': isInPage,
|
|
2782
|
+
'leadgen-slider': isSlider,
|
|
2783
|
+
});
|
|
2784
|
+
const PopupContainer = isDrawer ? (React__default.createElement(DrawerComponent, { fadeFromIndex: ZINDEX_SSO - 9e6, open: open, snapPoints: [0.8, 1], activeSnapPoint: snap, setActiveSnapPoint: setSnap, onOpenChange: onOpenChange, overlayClassName: popupContainerClassName, className: "leadgen-drawer" },
|
|
2785
|
+
PopupWrapper,
|
|
2786
|
+
React__default.createElement("div", { style: { position: 'absolute', inset: 0, zIndex: snap === 1 ? -1 : 1 }, onClick: () => setSnap(1) }))) : (React__default.createElement("div", { id: popupId, "data-popup-url": currentPath, "data-popup-type": "lightbox-inline", className: popupContainerClassName },
|
|
2787
|
+
isFullscreen ? (React__default.createElement("img", { className: "le-only-desktop le-fullscreen-img", draggable: false, src: imageBackground || '', style: {
|
|
2788
|
+
aspectRatio: `${imageBackgroundWidth}/${imageBackgroundHeight}`,
|
|
2789
|
+
} })) : null,
|
|
2790
|
+
PopupWrapper));
|
|
2791
|
+
if (!renderAfterImageSizes)
|
|
2792
|
+
return null;
|
|
2793
|
+
if (isLightBox || isFullscreen || isSlider) {
|
|
2794
|
+
return PopupContainer;
|
|
2795
|
+
}
|
|
2796
|
+
else if (isSidebar) {
|
|
2797
|
+
return React__default.createElement(SideBarLayout, { content: PopupContainer });
|
|
2798
|
+
}
|
|
2799
|
+
else if (isInline) {
|
|
2800
|
+
return (React__default.createElement(InlineLayout, { content: PopupContainer, inlinePosition: extraFields.popupInlinePosition }));
|
|
2801
|
+
}
|
|
2802
|
+
return null;
|
|
2803
|
+
};
|
|
2804
|
+
|
|
2805
|
+
const SkinLayout = ({ popupId, link, linkText, linkNewTab, onClose, imageMobile, imageDesktop, currentLayout, onOtherSubmit, }) => {
|
|
2806
|
+
const currentPath = location.pathname;
|
|
2807
|
+
const { width: imageMobileWidth, height: imageMobileHeight, loaded: imageMobileLoaded, } = useImageSize(imageMobile);
|
|
2808
|
+
const { width: imageDesktopWidth, height: imageDesktopHeight, loaded: imageDesktopLoaded, } = useImageSize(imageDesktop);
|
|
2809
|
+
if (!imageMobileLoaded || !imageDesktopLoaded)
|
|
2810
|
+
return null;
|
|
2811
|
+
return (React__default.createElement("div", { id: popupId, className: "lead-modal-wrapper", "data-popup-url": currentPath, "data-popup-type": "skin_ab" },
|
|
2812
|
+
currentLayout == 'SkinA' ? (React__default.createElement("aside", { className: "le-only-desktop" },
|
|
2813
|
+
React__default.createElement("div", { className: "le-skin-a-desktop" },
|
|
2814
|
+
React__default.createElement("div", { style: { position: 'relative' } },
|
|
2815
|
+
React__default.createElement("img", { src: imageDesktop, style: {
|
|
2816
|
+
aspectRatio: `${imageDesktopWidth}/${imageDesktopHeight}`,
|
|
2817
|
+
} }),
|
|
2818
|
+
React__default.createElement("a", { style: {
|
|
2819
|
+
position: 'absolute',
|
|
2820
|
+
top: '75%',
|
|
2821
|
+
left: '50%',
|
|
2822
|
+
transform: 'translate(-50%, -50%)',
|
|
2823
|
+
textAlign: 'center',
|
|
2824
|
+
width: 'calc(100% - 15px)',
|
|
2825
|
+
}, href: link, target: linkNewTab ? 'blank' : '_parent' },
|
|
2826
|
+
React__default.createElement("button", { onClick: onOtherSubmit, className: "le-joinbow-btn js-popup-other-submit" }, linkText)),
|
|
2827
|
+
React__default.createElement(CloseButton, { onClose: onClose, containerClassName: "close-button-top-right" }))))) : currentLayout == 'SkinB' ? (React__default.createElement("aside", { className: "le-only-desktop" },
|
|
2828
|
+
React__default.createElement("div", { className: "" },
|
|
2829
|
+
React__default.createElement("div", { style: { position: 'relative', zIndex: 10000 } },
|
|
2830
|
+
React__default.createElement("img", { src: imageDesktop, style: {
|
|
2831
|
+
width: '100%',
|
|
2832
|
+
aspectRatio: `${imageDesktopWidth}/${imageDesktopHeight}`,
|
|
2833
|
+
} }),
|
|
2834
|
+
React__default.createElement("a", { style: {
|
|
2835
|
+
position: 'absolute',
|
|
2836
|
+
top: '75%',
|
|
2837
|
+
left: '50%',
|
|
2838
|
+
transform: 'translate(-50%, -50%)',
|
|
2839
|
+
textAlign: 'center',
|
|
2840
|
+
width: '100%',
|
|
2841
|
+
}, href: link, target: linkNewTab ? 'blank' : '_parent' },
|
|
2842
|
+
React__default.createElement("button", { onClick: onOtherSubmit, className: "le-joinbow-btn-mobile js-popup-other-submit" }, linkText)),
|
|
2843
|
+
React__default.createElement(CloseButton, { containerClassName: "close-button-top-right", onClose: onClose }))))) : null,
|
|
2844
|
+
React__default.createElement("aside", { className: "le-only-mobile" },
|
|
2845
|
+
React__default.createElement("div", { className: "le-skin-mobile" },
|
|
2846
|
+
React__default.createElement("div", { style: { position: 'relative' } },
|
|
2847
|
+
isVideo(imageMobile) ? (React__default.createElement("video", { muted: true, autoPlay: true, loop: true },
|
|
2848
|
+
React__default.createElement("source", { src: imageMobile, type: "video/mp4" }))) : (React__default.createElement("img", { src: imageMobile, style: {
|
|
2849
|
+
width: '100%',
|
|
2850
|
+
aspectRatio: `${imageMobileWidth}/${imageMobileHeight}`,
|
|
2851
|
+
} })),
|
|
2852
|
+
React__default.createElement("a", { style: {
|
|
2853
|
+
position: 'absolute',
|
|
2854
|
+
top: '82%',
|
|
2855
|
+
left: '50%',
|
|
2856
|
+
transform: 'translate(-50%, -50%)',
|
|
2857
|
+
textAlign: 'center',
|
|
2858
|
+
maxWidth: 'calc(100% - 15px)',
|
|
2859
|
+
}, href: link, target: linkNewTab ? 'blank' : '_parent' },
|
|
2860
|
+
React__default.createElement("button", { onClick: onOtherSubmit, className: "le-joinbow-btn-mobile js-popup-other-submit" }, linkText)),
|
|
2861
|
+
React__default.createElement(CloseButton, { containerClassName: "close-button-top-right", svgClassName: "le-mobile-btn", onClose: onClose }))))));
|
|
4080
2862
|
};
|
|
4081
2863
|
|
|
4082
2864
|
// url: imageBlocks.imageMobile.data.url
|
|
4083
2865
|
// newTab: imageBlocks.imageMobile.data.newtab
|
|
4084
2866
|
// image: campaignShow.image
|
|
4085
2867
|
// imageDestkop: campaignShow.image_desktop
|
|
4086
|
-
const
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
2868
|
+
const TabLayout = ({ popupId, url, newTab, image, onClose, onOtherSubmit, }) => {
|
|
2869
|
+
const { width: imageWidth, height: imageHeight, loaded: imageLoaded, } = useImageSize(image);
|
|
2870
|
+
if (!imageLoaded)
|
|
2871
|
+
return null;
|
|
2872
|
+
return (React__default.createElement("div", { id: popupId, className: "lead-modal-wrapper", "data-popup-url": location.pathname, "data-popup-type": "tab" },
|
|
2873
|
+
React__default.createElement("div", { className: "le-tab-popup" },
|
|
2874
|
+
React__default.createElement("div", { style: { position: 'relative' } },
|
|
2875
|
+
React__default.createElement("a", { href: url, target: newTab ? 'blank' : '_parent', onClick: onOtherSubmit },
|
|
2876
|
+
React__default.createElement("img", { className: "js-popup-other-submit", src: image, style: {
|
|
2877
|
+
aspectRatio: `${imageWidth}/${imageHeight}`,
|
|
2878
|
+
} })),
|
|
2879
|
+
React__default.createElement(CloseButton, { onClose: onClose, containerClassName: "close-button-top-right" })))));
|
|
2880
|
+
};
|
|
2881
|
+
|
|
2882
|
+
// import mockLeadData from './mockLeadData'
|
|
2883
|
+
const listCampaignScheduled = [];
|
|
2884
|
+
const listCampaignScheduledToActivated = [];
|
|
2885
|
+
const listCampaignActiveButExpired = [];
|
|
2886
|
+
const listCampaignExcludeSonsored = [];
|
|
2887
|
+
const listCampaignDifferentSponsor = [];
|
|
2888
|
+
const listCampaignNotDisplayInRangeOfTime = [];
|
|
2889
|
+
function isMobile() {
|
|
2890
|
+
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|Opera Mini/i.test(navigator.userAgent);
|
|
2891
|
+
}
|
|
2892
|
+
const getShuffleArray = (array) => {
|
|
2893
|
+
const newArray = [...array];
|
|
2894
|
+
for (let i = newArray.length - 1; i > 0; i--) {
|
|
2895
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
2896
|
+
const temp = newArray[i];
|
|
2897
|
+
newArray[i] = newArray[j];
|
|
2898
|
+
newArray[j] = temp;
|
|
2899
|
+
}
|
|
2900
|
+
return newArray;
|
|
2901
|
+
};
|
|
2902
|
+
const getTimeByTimezone = (timeZone = 'UTC') => {
|
|
2903
|
+
const date = new Date();
|
|
2904
|
+
return new Date(date.toLocaleString('en-US', { timeZone }));
|
|
2905
|
+
};
|
|
2906
|
+
const parseDateByCampaignTime = (dateStr) => {
|
|
2907
|
+
// Format like this: 2023-04-04 00:00:00
|
|
2908
|
+
try {
|
|
2909
|
+
const [datePart, timePart] = dateStr.split(' ');
|
|
2910
|
+
const [year, month, day] = datePart.split('-').map(Number);
|
|
2911
|
+
const [hours, minutes, seconds] = timePart.split(':').map(Number);
|
|
2912
|
+
/** JavaScript counts months from 0 to 11 */
|
|
2913
|
+
return new Date(year, month - 1, day, hours, minutes, seconds);
|
|
2914
|
+
}
|
|
2915
|
+
catch (err) {
|
|
2916
|
+
return null;
|
|
2917
|
+
}
|
|
2918
|
+
};
|
|
2919
|
+
const checkCampaignNowInTimeframe = (c) => {
|
|
2920
|
+
var _a;
|
|
2921
|
+
const siteId = ((_a = c.site) === null || _a === void 0 ? void 0 : _a.id) || 1;
|
|
2922
|
+
const startedAtStr = c.started_at;
|
|
2923
|
+
const endedAtStr = c.ended_at;
|
|
2924
|
+
const startedDate = parseDateByCampaignTime(startedAtStr);
|
|
2925
|
+
const endedDate = parseDateByCampaignTime(endedAtStr);
|
|
2926
|
+
if (!startedDate || !endedDate) {
|
|
2927
|
+
return false;
|
|
2928
|
+
}
|
|
2929
|
+
const timeZone = LEAD_TIMEZONE_DATA[siteId];
|
|
2930
|
+
const nowWithTimezoneMs = getTimeByTimezone(timeZone).getTime();
|
|
2931
|
+
if (nowWithTimezoneMs <= endedDate.getTime() &&
|
|
2932
|
+
nowWithTimezoneMs >= startedDate.getTime()) {
|
|
2933
|
+
listCampaignScheduledToActivated.push(c);
|
|
2934
|
+
return true;
|
|
2935
|
+
}
|
|
2936
|
+
return false;
|
|
2937
|
+
};
|
|
2938
|
+
function checkCampaignActiveButExpireAlready(c) {
|
|
2939
|
+
var _a;
|
|
2940
|
+
/** Do not setup timeframe for this campaign. No need to check */
|
|
2941
|
+
if (c.forever === 1) {
|
|
2942
|
+
return true;
|
|
2943
|
+
}
|
|
2944
|
+
const startedAtStr = c.started_at;
|
|
2945
|
+
const endedAtStr = c.ended_at;
|
|
2946
|
+
const startedDate = parseDateByCampaignTime(startedAtStr);
|
|
2947
|
+
const endedDate = parseDateByCampaignTime(endedAtStr);
|
|
2948
|
+
/** Do not setup timeframe for this campaign. No need to check */
|
|
2949
|
+
if (!startedDate || !endedDate) {
|
|
2950
|
+
return true;
|
|
2951
|
+
}
|
|
2952
|
+
const siteId = ((_a = c.site) === null || _a === void 0 ? void 0 : _a.id) || 1;
|
|
2953
|
+
const timeZone = LEAD_TIMEZONE_DATA[siteId];
|
|
2954
|
+
const nowWithTimezoneMs = getTimeByTimezone(timeZone).getTime();
|
|
2955
|
+
/** Check if this expire already, do not show */
|
|
2956
|
+
if (nowWithTimezoneMs > endedDate.getTime()) {
|
|
2957
|
+
listCampaignActiveButExpired.push(c);
|
|
2958
|
+
return false;
|
|
2959
|
+
}
|
|
2960
|
+
return true;
|
|
2961
|
+
}
|
|
2962
|
+
function shouldNotDisplayIfExcludeAllSponsors(c) {
|
|
2963
|
+
var _a;
|
|
2964
|
+
const excludeSponsored = Number((_a = c.rules.find((i) => i.rule == 'exclude_sponsored')) === null || _a === void 0 ? void 0 : _a.value);
|
|
2965
|
+
const isSponsored = Boolean(document.querySelector('.hhg-disclaimer-text'));
|
|
2966
|
+
if (isSponsored && excludeSponsored) {
|
|
2967
|
+
listCampaignExcludeSonsored.push(c);
|
|
2968
|
+
return true;
|
|
2969
|
+
}
|
|
2970
|
+
return false;
|
|
2971
|
+
}
|
|
2972
|
+
function shouldDisplayWithCurrentSponsor(c) {
|
|
4098
2973
|
var _a, _b;
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
2974
|
+
try {
|
|
2975
|
+
// TODO: BE will rename `exclude_sponsored_list` later
|
|
2976
|
+
const stringOrArray = (_a = c.rules.find((i) => i.rule == 'exclude_sponsored_list')) === null || _a === void 0 ? void 0 : _a.value;
|
|
2977
|
+
const whiteListSponsors = stringOrArray instanceof Array ? stringOrArray : JSON.parse(stringOrArray);
|
|
2978
|
+
const dataSponsoredId = Number((_b = document
|
|
2979
|
+
.querySelector('[data-sponsored-id]')) === null || _b === void 0 ? void 0 : _b.getAttribute('data-sponsored-id'));
|
|
2980
|
+
// There is no config for sponsor id and white list, should show as default
|
|
2981
|
+
if (!dataSponsoredId ||
|
|
2982
|
+
dataSponsoredId <= 0 ||
|
|
2983
|
+
whiteListSponsors.length === 0) {
|
|
2984
|
+
return true;
|
|
4109
2985
|
}
|
|
4110
|
-
|
|
4111
|
-
|
|
2986
|
+
// Check the dataSponsoredId exists in the white list or not.
|
|
2987
|
+
const isExist = whiteListSponsors.find((s) => s.id == dataSponsoredId);
|
|
2988
|
+
if (isExist) {
|
|
2989
|
+
return true;
|
|
4112
2990
|
}
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
const listBlockAdded = JSON.parse(extraFields.listBlockAdded);
|
|
4116
|
-
const actionBlocks = JSON.parse(extraFields.actionBlocks);
|
|
4117
|
-
const popUpSubmitText = actionBlocks.submitBlock.data.value;
|
|
4118
|
-
const currentPath = location.pathname;
|
|
4119
|
-
const { align: descriptionAlign, value: description } = textBlocks.subtitleBlock.data || {};
|
|
4120
|
-
const { align: titleAlign } = textBlocks.titleBlock.data || {};
|
|
4121
|
-
const isSlider = currentLayout === LEADGEN_LAYOUT.Slider;
|
|
4122
|
-
const isSidebar = currentLayout === LEADGEN_LAYOUT.Sidebar;
|
|
4123
|
-
const isLightBox = currentLayout.includes('LightBox');
|
|
4124
|
-
const isLightBoxA = currentLayout === LEADGEN_LAYOUT.LightBoxA;
|
|
4125
|
-
const isLightBoxB = currentLayout === LEADGEN_LAYOUT.LightBoxB;
|
|
4126
|
-
const isInline = currentLayout.includes('Inline');
|
|
4127
|
-
const isFullscreen = currentLayout === LEADGEN_LAYOUT.Fullscreen;
|
|
4128
|
-
const isInPage = isInline || isSidebar;
|
|
4129
|
-
const isDrawer = isLightBoxB && isMobile;
|
|
4130
|
-
const limitFieldsLightBoxB = isLightBoxB && listBlockAdded.length <= LEADGEN_LIMIT_LIGHTBOXB;
|
|
4131
|
-
const hasForm = isLightBoxA
|
|
4132
|
-
? listBlockAdded.some((item) => LEADGEN_BLOCK_INPUT.some((k) => k === (item === null || item === void 0 ? void 0 : item.name)))
|
|
4133
|
-
: true;
|
|
4134
|
-
const headerInsideFormContainer = isSlider || isLightBoxA || isFullscreen;
|
|
4135
|
-
const showHeader = !!imageMobile || !!imageDesktop;
|
|
4136
|
-
const onlyHeader = !title && !description;
|
|
4137
|
-
const showButtonClose = !isInline;
|
|
4138
|
-
if (window.innerWidth < 769 &&
|
|
4139
|
-
LEADGEN_LAYOUT_NOT_SHOW_IN_MOBILE.includes(currentLayout)) {
|
|
4140
|
-
console.log('😎 Not show fullscreen, slider on mobile ');
|
|
4141
|
-
return null;
|
|
2991
|
+
listCampaignDifferentSponsor.push({ id: c.id, rules: c.rules });
|
|
2992
|
+
return false;
|
|
4142
2993
|
}
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
2994
|
+
catch (err) {
|
|
2995
|
+
// Default is show
|
|
2996
|
+
return true;
|
|
2997
|
+
}
|
|
2998
|
+
}
|
|
2999
|
+
const filterFnCampaign = (c) => {
|
|
3000
|
+
if (shouldNotDisplayIfExcludeAllSponsors(c)) {
|
|
3001
|
+
return false;
|
|
3002
|
+
}
|
|
3003
|
+
else if (!shouldDisplayWithCurrentSponsor(c)) {
|
|
3004
|
+
return false;
|
|
3005
|
+
}
|
|
3006
|
+
/** Active */
|
|
3007
|
+
if (c.formatted_status === 1) {
|
|
3008
|
+
return checkCampaignActiveButExpireAlready(c);
|
|
3009
|
+
}
|
|
3010
|
+
/** Schedule */
|
|
3011
|
+
if (c.formatted_status === 0) {
|
|
3012
|
+
listCampaignScheduled.push(c);
|
|
3013
|
+
return checkCampaignNowInTimeframe(c);
|
|
3014
|
+
}
|
|
3015
|
+
return false;
|
|
3016
|
+
};
|
|
3017
|
+
const fillterApprearanceTimeCampaign = (c) => {
|
|
3018
|
+
var _a;
|
|
3019
|
+
try {
|
|
3020
|
+
const isTimeInRange = (currentTime, startTime, endTime) => {
|
|
3021
|
+
const startParts = startTime.split(':');
|
|
3022
|
+
const endParts = endTime.split(':');
|
|
3023
|
+
const startDate = new Date();
|
|
3024
|
+
startDate.setHours(Number(startParts[0]), Number(startParts[1]), 0, 0);
|
|
3025
|
+
const endDate = new Date();
|
|
3026
|
+
endDate.setHours(Number(endParts[0]), Number(endParts[1]), 0, 0);
|
|
3027
|
+
return currentTime >= startDate && currentTime <= endDate;
|
|
3028
|
+
};
|
|
3029
|
+
const rulesApprValue = (_a = c.rules.find((i) => i.rule == 'appearance_time')) === null || _a === void 0 ? void 0 : _a.value;
|
|
3030
|
+
const startTime = rulesApprValue.startTime;
|
|
3031
|
+
const endTime = rulesApprValue.endTime || '23:59';
|
|
3032
|
+
if (!startTime) {
|
|
3033
|
+
return true;
|
|
4149
3034
|
}
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
const validatingPhoneRef = useRef(false);
|
|
4153
|
-
const validatingEmailRef = useRef(false);
|
|
4154
|
-
const { form, validateObj } = useLeadFormConfig({
|
|
4155
|
-
listBlockAdded,
|
|
4156
|
-
validatingPhoneRef,
|
|
4157
|
-
validatingEmailRef,
|
|
4158
|
-
campaignId,
|
|
4159
|
-
campaign_subot_id,
|
|
4160
|
-
userInfo,
|
|
4161
|
-
format: (_a = (ISO_FORMAT[locale] || ISO_FORMAT['vi-VN'])) === null || _a === void 0 ? void 0 : _a.dateFormat,
|
|
4162
|
-
});
|
|
4163
|
-
const onFocus = (e) => {
|
|
4164
|
-
const target = e.target;
|
|
4165
|
-
target.scrollIntoView({
|
|
4166
|
-
block: 'center',
|
|
4167
|
-
inline: 'nearest',
|
|
4168
|
-
behavior: 'auto',
|
|
4169
|
-
});
|
|
4170
|
-
};
|
|
4171
|
-
const middlewareOnSubmit = (e) => {
|
|
4172
|
-
e.preventDefault();
|
|
4173
|
-
// mark all as touched to allow validation
|
|
4174
|
-
const fields = Object.keys(validateObj);
|
|
4175
|
-
const fieldStatus = fields.reduce((acc, cur) => {
|
|
4176
|
-
acc[cur] = true;
|
|
4177
|
-
return acc;
|
|
4178
|
-
}, {});
|
|
4179
|
-
form.setTouched(fieldStatus);
|
|
4180
|
-
if (validatingEmailRef.current || validatingPhoneRef.current) {
|
|
4181
|
-
return;
|
|
3035
|
+
if (isTimeInRange(new Date(), startTime, endTime)) {
|
|
3036
|
+
return true;
|
|
4182
3037
|
}
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
3038
|
+
listCampaignNotDisplayInRangeOfTime.push(c);
|
|
3039
|
+
return false;
|
|
3040
|
+
}
|
|
3041
|
+
catch (err) {
|
|
3042
|
+
return true;
|
|
3043
|
+
}
|
|
3044
|
+
};
|
|
3045
|
+
let timeoutRef = null;
|
|
3046
|
+
let LEAD_SCROLL_EVENT = null;
|
|
3047
|
+
function clearPassiveEvent() {
|
|
3048
|
+
if (timeoutRef) {
|
|
3049
|
+
clearTimeout(timeoutRef);
|
|
3050
|
+
timeoutRef = null;
|
|
3051
|
+
}
|
|
3052
|
+
if (LEAD_SCROLL_EVENT) {
|
|
3053
|
+
window.removeEventListener('scroll', LEAD_SCROLL_EVENT);
|
|
3054
|
+
LEAD_SCROLL_EVENT = null;
|
|
3055
|
+
}
|
|
3056
|
+
}
|
|
3057
|
+
function checkShowPopup({ leadApi, leadSiteId, leadDomain, onShowPopup, DEBUG_URL, }) {
|
|
3058
|
+
// clear previous passive event, check for new condition
|
|
3059
|
+
clearPassiveEvent();
|
|
3060
|
+
const leadCurrentUrl = DEBUG_URL ||
|
|
3061
|
+
('https://' +
|
|
3062
|
+
location.hostname +
|
|
3063
|
+
location.pathname +
|
|
3064
|
+
location.search).toLowerCase();
|
|
3065
|
+
fetch(leadApi + 'api/campaign/' + leadSiteId, {
|
|
3066
|
+
method: 'POST',
|
|
3067
|
+
headers: {
|
|
3068
|
+
'Content-Type': 'application/json',
|
|
3069
|
+
},
|
|
3070
|
+
body: JSON.stringify({
|
|
3071
|
+
url: leadCurrentUrl,
|
|
3072
|
+
ga_client_id: getCookie('_ga') || null,
|
|
3073
|
+
}),
|
|
3074
|
+
})
|
|
3075
|
+
.then((response) => {
|
|
3076
|
+
return response.json();
|
|
3077
|
+
// return mockLeadData || response.json()
|
|
3078
|
+
})
|
|
3079
|
+
.then((data) => {
|
|
3080
|
+
var _a, _b, _c, _d;
|
|
3081
|
+
LeadLog('List campagin: ', data);
|
|
3082
|
+
LEAD_RESET_VAR();
|
|
3083
|
+
if (data._status == 1) {
|
|
3084
|
+
const campaigns = (((_b = (_a = data._data) === null || _a === void 0 ? void 0 : _a.campaigns) === null || _b === void 0 ? void 0 : _b.filter(filterFnCampaign)) || []).filter(fillterApprearanceTimeCampaign);
|
|
3085
|
+
if (!getCookie('hhg-id')) {
|
|
3086
|
+
setCookie('hhg-id', v1(), {
|
|
3087
|
+
domain: '.' + leadDomain,
|
|
3088
|
+
path: '/',
|
|
3089
|
+
});
|
|
3090
|
+
LeadLog('😍 Set HHG ID cookie');
|
|
3091
|
+
}
|
|
3092
|
+
// getCookie('hhg-id')
|
|
3093
|
+
// TODO: HP-534 Filter desktop
|
|
3094
|
+
let campaignsDevice = [];
|
|
3095
|
+
if (isMobile()) {
|
|
3096
|
+
campaignsDevice = campaigns.filter((c) => c.device_types.some((d) => d.id == LEAD_DEVICE_TYPE.MOBILE));
|
|
3097
|
+
}
|
|
3098
|
+
else {
|
|
3099
|
+
campaignsDevice = campaigns.filter((c) => c.device_types.some((d) => d.id == LEAD_DEVICE_TYPE.DESKTOP));
|
|
3100
|
+
}
|
|
3101
|
+
LeadLog(`👓 campaignsDevice`, campaignsDevice);
|
|
3102
|
+
LeadLog('--listCampaignScheduled', listCampaignScheduled);
|
|
3103
|
+
LeadLog('--listCampaignScheduledToActivated', listCampaignScheduledToActivated);
|
|
3104
|
+
LeadLog('--listCampaignActiveButExpired', listCampaignActiveButExpired);
|
|
3105
|
+
LeadLog('--listCampaignExcludeSonsored', listCampaignExcludeSonsored);
|
|
3106
|
+
LeadLog('--listCampaignDifferentSponsor', listCampaignDifferentSponsor);
|
|
3107
|
+
LeadLog('--listCampaignNotDisplayInRangeOfTime', listCampaignNotDisplayInRangeOfTime);
|
|
3108
|
+
// Check links
|
|
3109
|
+
let listLinksObj = campaignsDevice
|
|
3110
|
+
.map((i, index) => i.targets
|
|
3111
|
+
.filter((i) => i.type == CAMPAIGN_TARGET_TYPE.LINKS)
|
|
3112
|
+
.map((i) => (Object.assign(Object.assign({}, i), { campaignIndex: index }))))
|
|
3113
|
+
.flat(1);
|
|
3114
|
+
// Check list link match current href
|
|
3115
|
+
listLinksObj = listLinksObj.filter((i) => {
|
|
3116
|
+
var _a;
|
|
3117
|
+
const target = new URL(String(i.target).toLowerCase());
|
|
3118
|
+
if (i.option == 'exact_match')
|
|
3119
|
+
// FOR TEST LOCAL:
|
|
3120
|
+
// return Boolean(location.pathname === target.pathname)
|
|
3121
|
+
return Boolean(leadCurrentUrl === ((_a = target.href) === null || _a === void 0 ? void 0 : _a.toLowerCase()));
|
|
3122
|
+
if (i.option == 'start_with') {
|
|
3123
|
+
// FOR TEST LOCAL:
|
|
3124
|
+
// if (location.pathname.includes(target.pathname)) {
|
|
3125
|
+
if (leadCurrentUrl.includes(String(i.target).toLowerCase())) {
|
|
3126
|
+
const listExcluding = i.sub_target
|
|
3127
|
+
.filter((i) => i.option == 'excluding')
|
|
3128
|
+
.map((i) => { var _a; return (_a = i.value) === null || _a === void 0 ? void 0 : _a.toLowerCase(); });
|
|
3129
|
+
return !listExcluding.includes(leadCurrentUrl.split('?')[0]);
|
|
4197
3130
|
}
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
// not submit yet, open otp
|
|
4201
|
-
const fieldName = (_e = (_d = listBlockAdded.find((x) => x.name === LEADGEN_BLOCK.WhatsappOtpBlock)) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.value;
|
|
4202
|
-
if ((_f = v[fieldName]) === null || _f === void 0 ? void 0 : _f.startsWith('+')) {
|
|
4203
|
-
newShowOtpPhone = {
|
|
4204
|
-
phone: v[fieldName],
|
|
4205
|
-
type: 'whatsapp',
|
|
4206
|
-
};
|
|
3131
|
+
else {
|
|
3132
|
+
return false;
|
|
4207
3133
|
}
|
|
4208
3134
|
}
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
3135
|
+
});
|
|
3136
|
+
// Check tags
|
|
3137
|
+
const listMetaTag = Array.from(document.getElementsByTagName('META')).filter((i) => i.getAttribute('property') == 'article:tag');
|
|
3138
|
+
const listTags = listMetaTag.map((i) => i.content);
|
|
3139
|
+
let listCampaignHasTag = [];
|
|
3140
|
+
let listTagsObj = [];
|
|
3141
|
+
if (listTags && listTags.length) {
|
|
3142
|
+
listCampaignHasTag = campaignsDevice
|
|
3143
|
+
.map((i, index) => i.targets
|
|
3144
|
+
.filter((i) => i.type == CAMPAIGN_TARGET_TYPE.TAGS)
|
|
3145
|
+
.map((i) => (Object.assign(Object.assign({}, i), { campaignIndex: index }))))
|
|
3146
|
+
.flat(1);
|
|
3147
|
+
listTagsObj = listCampaignHasTag.filter((i) => listTags.includes(i.target));
|
|
3148
|
+
}
|
|
3149
|
+
const listCampaginsMatch = [...listLinksObj, ...listTagsObj];
|
|
3150
|
+
const cookieKeys = document.cookie
|
|
3151
|
+
.split('; ')
|
|
3152
|
+
.map((i) => i.split('=')[0]);
|
|
3153
|
+
const listCampaignCodeSubmited = cookieKeys.filter((i) => i.includes('lead_submited'));
|
|
3154
|
+
LeadLog(`--listCampaignCodeSubmited`, listCampaignCodeSubmited);
|
|
3155
|
+
const listCampaignCodeClosed = cookieKeys.filter((i) => i.includes('lead_closed'));
|
|
3156
|
+
LeadLog(`--listCampaignCodeClosed`, listCampaignCodeClosed);
|
|
3157
|
+
const listCampaignSubmitedClosed = [
|
|
3158
|
+
...listCampaignCodeSubmited,
|
|
3159
|
+
...listCampaignCodeClosed,
|
|
3160
|
+
];
|
|
3161
|
+
const listCampaignNoSubmitedClosed = listCampaginsMatch.filter((i) => {
|
|
3162
|
+
const hasSubmited = listCampaignSubmitedClosed.some((k) => k.includes(campaignsDevice[i.campaignIndex].code));
|
|
3163
|
+
return !hasSubmited;
|
|
3164
|
+
});
|
|
3165
|
+
const listCampaignValid = getShuffleArray(listCampaignNoSubmitedClosed);
|
|
3166
|
+
// .sort(
|
|
3167
|
+
// (a, b) =>
|
|
3168
|
+
// (listCampaignValid[a.campaignIndex]?.score || 0) -
|
|
3169
|
+
// (listCampaignValid[b.campaignIndex]?.score || 0),
|
|
3170
|
+
// )
|
|
3171
|
+
LeadLog('--listCampaignValid : ', listCampaignValid);
|
|
3172
|
+
if (listCampaignValid && listCampaignValid.length) {
|
|
3173
|
+
const CAMPAIGN_SHOW = campaignsDevice[listCampaignValid[0].campaignIndex];
|
|
3174
|
+
LeadLog(`CAMPAIGN_SHOW`, CAMPAIGN_SHOW);
|
|
3175
|
+
const { rules } = CAMPAIGN_SHOW;
|
|
3176
|
+
// CHECK RULE TRIGGER POPUP
|
|
3177
|
+
const timeoutRule = Number((_c = rules.find((i) => i.rule == 'time')) === null || _c === void 0 ? void 0 : _c.value);
|
|
3178
|
+
LeadLog(`timeoutRule`, timeoutRule);
|
|
3179
|
+
const scrollRule = Number((_d = rules.find((i) => i.rule == 'scroll')) === null || _d === void 0 ? void 0 : _d.value);
|
|
3180
|
+
LeadLog(`scrollRule`, scrollRule);
|
|
3181
|
+
let impressionAction = 'TIME';
|
|
3182
|
+
if (Number.isInteger(timeoutRule)) {
|
|
3183
|
+
impressionAction = 'TIME';
|
|
3184
|
+
LeadLog('✨ SHOW AWESOME POPUP AFTER: ', timeoutRule, ' seconds');
|
|
3185
|
+
timeoutRef = setTimeout(() => {
|
|
3186
|
+
onShowPopup === null || onShowPopup === void 0 ? void 0 : onShowPopup(CAMPAIGN_SHOW, impressionAction);
|
|
3187
|
+
}, timeoutRule * 1000);
|
|
4218
3188
|
}
|
|
4219
|
-
if (
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
3189
|
+
if (Number.isInteger(scrollRule)) {
|
|
3190
|
+
impressionAction = 'SCROLL';
|
|
3191
|
+
LeadLog('✨ SHOW AWESOME AFTER: SCROLL', scrollRule, ' %');
|
|
3192
|
+
const $p = document.querySelector(`[data-url="${location.pathname}"]`) ||
|
|
3193
|
+
document.querySelector('body');
|
|
3194
|
+
const pct = $p.getBoundingClientRect().top;
|
|
3195
|
+
const pb = $p.offsetHeight;
|
|
3196
|
+
LeadLog(`👓 Element check scroll: `, $p);
|
|
3197
|
+
LEAD_SCROLL_EVENT = function leadScollCheckHandler() {
|
|
3198
|
+
const wt = window.pageYOffset || document.documentElement.scrollTop;
|
|
3199
|
+
let percent = 0;
|
|
3200
|
+
if (wt >= pct) {
|
|
3201
|
+
percent = Math.round(((wt - pct) / (pb - innerHeight)) * 100);
|
|
4228
3202
|
}
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
3203
|
+
LeadLog('---Scroll', percent, scrollRule);
|
|
3204
|
+
// TODO: CHECK FOOTER HEIGHT
|
|
3205
|
+
if (percent >= scrollRule) {
|
|
3206
|
+
window.removeEventListener('scroll', LEAD_SCROLL_EVENT);
|
|
3207
|
+
onShowPopup === null || onShowPopup === void 0 ? void 0 : onShowPopup(CAMPAIGN_SHOW, impressionAction);
|
|
3208
|
+
}
|
|
3209
|
+
};
|
|
3210
|
+
window.addEventListener('scroll', LEAD_SCROLL_EVENT, {
|
|
3211
|
+
passive: true,
|
|
4233
3212
|
});
|
|
4234
|
-
return;
|
|
4235
3213
|
}
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
const onOpenChange = (_open) => {
|
|
4241
|
-
setOpen(_open);
|
|
4242
|
-
if (!_open) {
|
|
4243
|
-
setTimeout(() => {
|
|
4244
|
-
onClose();
|
|
4245
|
-
}, 250);
|
|
4246
|
-
}
|
|
4247
|
-
};
|
|
4248
|
-
const { width: imageBackgroundWidth, height: imageBackgroundHeight, loaded: imageBackgroundLoaded, } = useImageSize(imageBackground);
|
|
4249
|
-
const { loaded: imageMobileLoaded } = useImageSize(imageMobile);
|
|
4250
|
-
const { loaded: imageDesktopLoaded } = useImageSize(imageDesktop);
|
|
4251
|
-
const renderAfterImageSizes = imageMobileLoaded &&
|
|
4252
|
-
imageDesktopLoaded &&
|
|
4253
|
-
(isFullscreen ? imageBackgroundLoaded : true);
|
|
4254
|
-
const ButtonSubmit = useMemo(() => {
|
|
4255
|
-
var _a;
|
|
4256
|
-
return !((_a = actionBlocks === null || actionBlocks === void 0 ? void 0 : actionBlocks.submitBlock) === null || _a === void 0 ? void 0 : _a.isHide) && (React__default.createElement(Button$1, { size: "lg", id: "lead-submit", type: "submit", variant: "filled", className: "leadgen-btn leadgen-btn_action", loading: isSubmitLoading }, popUpSubmitText));
|
|
4257
|
-
}, [popUpSubmitText, isSubmitLoading, (_b = actionBlocks === null || actionBlocks === void 0 ? void 0 : actionBlocks.submitBlock) === null || _b === void 0 ? void 0 : _b.isHide]);
|
|
4258
|
-
const LinkButtonBlock = listBlockAdded.filter(({ name }) => name == LEADGEN_BLOCK.LinkButtonBlock);
|
|
4259
|
-
const ButtonLink = !!(LinkButtonBlock === null || LinkButtonBlock === void 0 ? void 0 : LinkButtonBlock.length) && (React__default.createElement(React__default.Fragment, null, LinkButtonBlock.map((item, index) => {
|
|
4260
|
-
var _a, _b, _c;
|
|
4261
|
-
return (React__default.createElement(Button$1, { key: `${item.name}-${index}`, component: "a", href: (_a = item === null || item === void 0 ? void 0 : item.data) === null || _a === void 0 ? void 0 : _a.url, target: ((_b = item === null || item === void 0 ? void 0 : item.data) === null || _b === void 0 ? void 0 : _b.newtab) ? '_blank' : undefined, size: "lg", variant: "filled", className: "leadgen-btn leadgen-btn_action", color: primaryColor, onClick: () => {
|
|
4262
|
-
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
4263
|
-
onOtherSubmit === null || onOtherSubmit === void 0 ? void 0 : onOtherSubmit();
|
|
4264
|
-
} }, (_c = item === null || item === void 0 ? void 0 : item.data) === null || _c === void 0 ? void 0 : _c.value));
|
|
4265
|
-
})));
|
|
4266
|
-
const PopupHeader = showHeader && (React__default.createElement("header", { className: clsx('leadgen-header', { 'leadgen-header_only': onlyHeader }) }, LEADGEN_SHOW_HEADER.includes(currentLayout) ? (React__default.createElement(HeaderImage, { src: imageMobile, className: "lead-modal__image" })) : (React__default.createElement(React__default.Fragment, null,
|
|
4267
|
-
React__default.createElement(HeaderImage, { src: imageDesktop, className: "le-only-desktop lead-modal__image" }),
|
|
4268
|
-
React__default.createElement(HeaderImage, { src: imageMobile, className: "le-only-mobile lead-modal__image" })))));
|
|
4269
|
-
const PopupEmpty = showEmpty && (React__default.createElement(EmptyComponent, { onClose: onClose, onContinue: () => setShowEmpty(false) }));
|
|
4270
|
-
const PopupForm = (React__default.createElement(LeadFormProvider, { form: form },
|
|
4271
|
-
React__default.createElement("form", { ref: formRef, className: "leadgen-form", onFocus: onFocus, onSubmit: middlewareOnSubmit },
|
|
4272
|
-
React__default.createElement(FormContainer, { title: title, titleAlign: titleAlign, description: description, descriptionAlign: descriptionAlign, header: headerInsideFormContainer && PopupHeader, footer: hasForm ? ButtonSubmit : ButtonLink, "data-hidden-form": !hasForm },
|
|
4273
|
-
React__default.createElement("div", { className: "leadgen-form_inner" },
|
|
4274
|
-
React__default.createElement(LightboxFields, { listBlockAdded: listBlockAdded, popupId: popupId, locale: locale, onClose: onClose, onOtherSubmit: onOtherSubmit }))))));
|
|
4275
|
-
const PopupOtp = showOtpPhone && (React__default.createElement(OtpBlock, { otpData: showOtpPhone, autoSendWhenOpen: false, onSuccess: () => {
|
|
4276
|
-
setShowOtpPhone(null);
|
|
4277
|
-
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(formRef.current, form.values);
|
|
4278
|
-
} }));
|
|
4279
|
-
const PopupThankYou = showThankyou && (React__default.createElement(ThankyouPopup, { title: showThankyou.title, titleAlign: showThankyou.titleAlign, subtitle: showThankyou.subtitle, subtitleAlign: showThankyou.subtitleAlign, link: showThankyou.link, linkNewTab: showThankyou.linkNewTab, linkText: showThankyou.linkText, image: showThankyou.image }));
|
|
4280
|
-
const PopupContent = (React__default.createElement("div", { className: clsx('leadgen-content', {
|
|
4281
|
-
'leadgen-content_small': limitFieldsLightBoxB,
|
|
4282
|
-
}) },
|
|
4283
|
-
!headerInsideFormContainer && PopupHeader,
|
|
4284
|
-
!onlyHeader && (React__default.createElement("div", { className: "leadgen-inner" },
|
|
4285
|
-
PopupThankYou,
|
|
4286
|
-
!showThankyou && (React__default.createElement(React__default.Fragment, null,
|
|
4287
|
-
PopupOtp,
|
|
4288
|
-
PopupEmpty,
|
|
4289
|
-
!(showOtpPhone || showEmpty) && PopupForm))))));
|
|
4290
|
-
const styleOverlay = useMemo(() => {
|
|
4291
|
-
let styleContent = `.leadgen-inner {background-repeat: no-repeat;background-size: cover;background-position:center;}`;
|
|
4292
|
-
if (isMobile && imageOverlayMobile) {
|
|
4293
|
-
styleContent += `.leadgen-inner {background-image: url(${imageOverlayMobile});}`;
|
|
4294
|
-
}
|
|
4295
|
-
if (!isMobile && imageOverlayDesktop) {
|
|
4296
|
-
styleContent += `@media screen and (min-width:768px) {.leadgen-inner {background-image: url(${imageOverlayDesktop});}}`;
|
|
3214
|
+
}
|
|
3215
|
+
else {
|
|
3216
|
+
LeadLog('🚧 No lead campaigns on current URL, tags');
|
|
3217
|
+
}
|
|
4297
3218
|
}
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
React__default.createElement("style", { dangerouslySetInnerHTML: { __html: styleOverlay } }),
|
|
4302
|
-
React__default.createElement("div", { className: clsx('leadgen-wrapper', {
|
|
4303
|
-
'leadgen-wrapper_small': limitFieldsLightBoxB,
|
|
4304
|
-
}) },
|
|
4305
|
-
showButtonClose && (React__default.createElement(CloseButton, { onClose: () => onOpenChange(false), containerClassName: "leadgen-close_btn" })),
|
|
4306
|
-
PopupContent)));
|
|
4307
|
-
const popupContainerClassName = clsx('leadgen', `leadgen-${currentLayout}`, {
|
|
4308
|
-
'leadgen-lightbox': isLightBox,
|
|
4309
|
-
'leadgen-inline': isInPage,
|
|
4310
|
-
'leadgen-slider': isSlider,
|
|
3219
|
+
})
|
|
3220
|
+
.catch((err) => {
|
|
3221
|
+
LeadLog(`Lead error: `, err);
|
|
4311
3222
|
});
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
return null;
|
|
4321
|
-
if (isLightBox || isFullscreen || isSlider) {
|
|
4322
|
-
return PopupContainer;
|
|
4323
|
-
}
|
|
4324
|
-
else if (isSidebar) {
|
|
4325
|
-
return React__default.createElement(SideBarLayout, { content: PopupContainer });
|
|
4326
|
-
}
|
|
4327
|
-
else if (isInline) {
|
|
4328
|
-
return (React__default.createElement(InlineLayout, { content: PopupContainer, inlinePosition: extraFields.popupInlinePosition }));
|
|
3223
|
+
}
|
|
3224
|
+
const LeadLog = (...params) => {
|
|
3225
|
+
if (process.env.NODE_ENV !== 'production' ||
|
|
3226
|
+
(process.env.NEXT_PUBLIC_DEPLOY_ENV &&
|
|
3227
|
+
process.env.NEXT_PUBLIC_DEPLOY_ENV !== 'production') ||
|
|
3228
|
+
(typeof localStorage !== 'undefined' &&
|
|
3229
|
+
localStorage.getItem('hhg_debug') === 'true')) {
|
|
3230
|
+
console.log(...params);
|
|
4329
3231
|
}
|
|
4330
|
-
return null;
|
|
4331
|
-
};
|
|
4332
|
-
|
|
4333
|
-
const SkinLayout = ({ popupId, link, linkText, linkNewTab, onClose, imageMobile, imageDesktop, currentLayout, onOtherSubmit, }) => {
|
|
4334
|
-
const currentPath = location.pathname;
|
|
4335
|
-
const { width: imageMobileWidth, height: imageMobileHeight, loaded: imageMobileLoaded, } = useImageSize(imageMobile);
|
|
4336
|
-
const { width: imageDesktopWidth, height: imageDesktopHeight, loaded: imageDesktopLoaded, } = useImageSize(imageDesktop);
|
|
4337
|
-
if (!imageMobileLoaded || !imageDesktopLoaded)
|
|
4338
|
-
return null;
|
|
4339
|
-
return (React__default.createElement("div", { id: popupId, className: "lead-modal-wrapper", "data-popup-url": currentPath, "data-popup-type": "skin_ab" },
|
|
4340
|
-
currentLayout == 'SkinA' ? (React__default.createElement("aside", { className: "le-only-desktop" },
|
|
4341
|
-
React__default.createElement("div", { className: "le-skin-a-desktop" },
|
|
4342
|
-
React__default.createElement("div", { style: { position: 'relative' } },
|
|
4343
|
-
React__default.createElement("img", { src: imageDesktop, style: {
|
|
4344
|
-
aspectRatio: `${imageDesktopWidth}/${imageDesktopHeight}`,
|
|
4345
|
-
} }),
|
|
4346
|
-
React__default.createElement("a", { style: {
|
|
4347
|
-
position: 'absolute',
|
|
4348
|
-
top: '75%',
|
|
4349
|
-
left: '50%',
|
|
4350
|
-
transform: 'translate(-50%, -50%)',
|
|
4351
|
-
textAlign: 'center',
|
|
4352
|
-
width: 'calc(100% - 15px)',
|
|
4353
|
-
}, href: link, target: linkNewTab ? 'blank' : '_parent' },
|
|
4354
|
-
React__default.createElement("button", { onClick: onOtherSubmit, className: "le-joinbow-btn js-popup-other-submit" }, linkText)),
|
|
4355
|
-
React__default.createElement(CloseButton, { onClose: onClose, containerClassName: "close-button-top-right" }))))) : currentLayout == 'SkinB' ? (React__default.createElement("aside", { className: "le-only-desktop" },
|
|
4356
|
-
React__default.createElement("div", { className: "" },
|
|
4357
|
-
React__default.createElement("div", { style: { position: 'relative', zIndex: 10000 } },
|
|
4358
|
-
React__default.createElement("img", { src: imageDesktop, style: {
|
|
4359
|
-
width: '100%',
|
|
4360
|
-
aspectRatio: `${imageDesktopWidth}/${imageDesktopHeight}`,
|
|
4361
|
-
} }),
|
|
4362
|
-
React__default.createElement("a", { style: {
|
|
4363
|
-
position: 'absolute',
|
|
4364
|
-
top: '75%',
|
|
4365
|
-
left: '50%',
|
|
4366
|
-
transform: 'translate(-50%, -50%)',
|
|
4367
|
-
textAlign: 'center',
|
|
4368
|
-
width: '100%',
|
|
4369
|
-
}, href: link, target: linkNewTab ? 'blank' : '_parent' },
|
|
4370
|
-
React__default.createElement("button", { onClick: onOtherSubmit, className: "le-joinbow-btn-mobile js-popup-other-submit" }, linkText)),
|
|
4371
|
-
React__default.createElement(CloseButton, { containerClassName: "close-button-top-right", onClose: onClose }))))) : null,
|
|
4372
|
-
React__default.createElement("aside", { className: "le-only-mobile" },
|
|
4373
|
-
React__default.createElement("div", { className: "le-skin-mobile" },
|
|
4374
|
-
React__default.createElement("div", { style: { position: 'relative' } },
|
|
4375
|
-
isVideo(imageMobile) ? (React__default.createElement("video", { muted: true, autoPlay: true, loop: true },
|
|
4376
|
-
React__default.createElement("source", { src: imageMobile, type: "video/mp4" }))) : (React__default.createElement("img", { src: imageMobile, style: {
|
|
4377
|
-
width: '100%',
|
|
4378
|
-
aspectRatio: `${imageMobileWidth}/${imageMobileHeight}`,
|
|
4379
|
-
} })),
|
|
4380
|
-
React__default.createElement("a", { style: {
|
|
4381
|
-
position: 'absolute',
|
|
4382
|
-
top: '82%',
|
|
4383
|
-
left: '50%',
|
|
4384
|
-
transform: 'translate(-50%, -50%)',
|
|
4385
|
-
textAlign: 'center',
|
|
4386
|
-
maxWidth: 'calc(100% - 15px)',
|
|
4387
|
-
}, href: link, target: linkNewTab ? 'blank' : '_parent' },
|
|
4388
|
-
React__default.createElement("button", { onClick: onOtherSubmit, className: "le-joinbow-btn-mobile js-popup-other-submit" }, linkText)),
|
|
4389
|
-
React__default.createElement(CloseButton, { containerClassName: "close-button-top-right", svgClassName: "le-mobile-btn", onClose: onClose }))))));
|
|
4390
|
-
};
|
|
4391
|
-
|
|
4392
|
-
// url: imageBlocks.imageMobile.data.url
|
|
4393
|
-
// newTab: imageBlocks.imageMobile.data.newtab
|
|
4394
|
-
// image: campaignShow.image
|
|
4395
|
-
// imageDestkop: campaignShow.image_desktop
|
|
4396
|
-
const TabLayout = ({ popupId, url, newTab, image, onClose, onOtherSubmit, }) => {
|
|
4397
|
-
const { width: imageWidth, height: imageHeight, loaded: imageLoaded, } = useImageSize(image);
|
|
4398
|
-
if (!imageLoaded)
|
|
4399
|
-
return null;
|
|
4400
|
-
return (React__default.createElement("div", { id: popupId, className: "lead-modal-wrapper", "data-popup-url": location.pathname, "data-popup-type": "tab" },
|
|
4401
|
-
React__default.createElement("div", { className: "le-tab-popup" },
|
|
4402
|
-
React__default.createElement("div", { style: { position: 'relative' } },
|
|
4403
|
-
React__default.createElement("a", { href: url, target: newTab ? 'blank' : '_parent', onClick: onOtherSubmit },
|
|
4404
|
-
React__default.createElement("img", { className: "js-popup-other-submit", src: image, style: {
|
|
4405
|
-
aspectRatio: `${imageWidth}/${imageHeight}`,
|
|
4406
|
-
} })),
|
|
4407
|
-
React__default.createElement(CloseButton, { onClose: onClose, containerClassName: "close-button-top-right" })))));
|
|
4408
3232
|
};
|
|
4409
3233
|
|
|
4410
3234
|
function getCategoryLevel(t = 'Xin chao {{category_2}} extra') {
|
|
@@ -4420,7 +3244,7 @@ function getCategoryLevel(t = 'Xin chao {{category_2}} extra') {
|
|
|
4420
3244
|
}
|
|
4421
3245
|
const NewLeadPopup = ({ campaign, action, onSubmit, onClose, showThankyou, locale, showEmpty, setShowEmpty, userInfo, }) => {
|
|
4422
3246
|
var _a, _b;
|
|
4423
|
-
const { apiUrl, siteDomain } = useContext(LeadGenContext
|
|
3247
|
+
const { apiUrl, siteDomain } = useContext(LeadGenContext);
|
|
4424
3248
|
useEffect(() => {
|
|
4425
3249
|
const gaCookie = getCookie('_ga') || null;
|
|
4426
3250
|
fetch(`${apiUrl}api/campaign/${code}/impression`, {
|
|
@@ -4815,7 +3639,7 @@ const _LeadGen = ({ apiUrl: apiUrlProp, siteDomain, siteId, locale, primaryColor
|
|
|
4815
3639
|
leadStartTimeRef.current = Date.now();
|
|
4816
3640
|
}
|
|
4817
3641
|
}, [showCampaign]);
|
|
4818
|
-
return (React__default.createElement(LeadGenContext
|
|
3642
|
+
return (React__default.createElement(LeadGenContext.Provider, { value: { primaryColor, apiUrl, siteDomain, siteId, locale } },
|
|
4819
3643
|
React__default.createElement(TranslationsContext.Provider, { value: { locale, values: getTranslations(locale) } }, children ? (React__default.createElement(Component, { campaign: showCampaign, onSubmit: onSubmit, onClose: onClose, showThankyou: showThankyou, setShowThankyou: setShowThankyou, locale: locale, showEmpty: showEmpty, setShowEmpty: setShowEmpty, userInfo: userInfo }, children)) : (React__default.createElement(Portal, { target: getPopupWrapperDom() },
|
|
4820
3644
|
React__default.createElement(Box, { sx: { position: 'fixed', zIndex: ZINDEX_SSO - 9e6 } },
|
|
4821
3645
|
React__default.createElement(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) => {
|
|
@@ -4835,4 +3659,4 @@ LeadGen.Thankyou = Thankyou;
|
|
|
4835
3659
|
LeadGen.OtpForm = OtpBlock$1;
|
|
4836
3660
|
LeadGen.Close = Close;
|
|
4837
3661
|
|
|
4838
|
-
export { LeadGen
|
|
3662
|
+
export { LeadGen };
|