@hhgtech/hhg-components 1.29.372-beta-2 → 1.29.373
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-53510fc6.js → InputDate-39bd6171.js} +20 -20
- package/build/{LastPeriod-97a41212.js → LastPeriod-277f41c6.js} +1 -1
- package/build/{Locale-a6cfbd0c.js → Locale-2723c28f.js} +0 -1
- package/build/{MobileBottomNavigationIcon-adde2568.js → MobileBottomNavigationIcon-663adc1f.js} +3 -3
- package/build/{Spinner-8aadaea4.js → Spinner-b867278e.js} +1 -1
- package/build/{WhatsApp-d1ecfc43.js → WhatsApp-3745791a.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/atoms/logo/index.d.ts +1 -1
- package/build/components/mantine/phone/index.d.ts +0 -2
- package/build/components.js +96 -96
- package/build/{constants-e794cab6.js → constants-979354be.js} +1 -1
- package/build/{constants-1d734061.js → constants-f818e265.js} +0 -1
- package/build/constants.js +3 -3
- package/build/constantsDomainLocales.js +1 -3
- package/build/constantsRiskScreener.js +2 -2
- package/build/constantsSite.js +2 -2
- package/build/{core-752b36de.js → core-0bfb3bf0.js} +1 -1
- package/build/{dataTransform-0a5fe360.js → dataTransform-60ef068f.js} +1 -1
- package/build/ecom.js +4 -4
- package/build/{editor-63f2487a.js → editor-6b13b33c.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-fc760765.js → InputDate-d47f4a01.js} +20 -20
- package/build/esm/{LastPeriod-0553ce0c.js → LastPeriod-5036dd88.js} +1 -1
- package/build/esm/{Locale-dd2625fa.js → Locale-07134c93.js} +0 -1
- package/build/esm/{MobileBottomNavigationIcon-25af9080.js → MobileBottomNavigationIcon-9a6febe7.js} +3 -3
- package/build/esm/{Spinner-ea23fbfb.js → Spinner-a41322b5.js} +1 -1
- package/build/esm/{WhatsApp-72789740.js → WhatsApp-e19fd45d.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/atoms/logo/index.d.ts +1 -1
- package/build/esm/components/mantine/phone/index.d.ts +0 -2
- package/build/esm/components.js +96 -96
- package/build/esm/{constants-0f0116ef.js → constants-1e234074.js} +1 -1
- package/build/esm/{constants-3523c601.js → constants-20c3d5eb.js} +0 -1
- package/build/esm/constants.js +3 -3
- package/build/esm/constantsDomainLocales.js +1 -3
- package/build/esm/constantsRiskScreener.js +2 -2
- package/build/esm/constantsSite.js +2 -2
- package/build/esm/{core-c99557e1.js → core-2e1d801d.js} +1 -1
- package/build/esm/{dataTransform-6e4cf75a.js → dataTransform-674194af.js} +1 -1
- package/build/esm/ecom.js +4 -4
- package/build/esm/{editor-9a8b3577.js → editor-1c141e18.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-e923053c.js → healthTools-369c0656.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 +55 -14
- package/build/esm/i18nV2.js +2 -2
- package/build/esm/{index-346818d6.js → index-00d1d057.js} +6 -6
- package/build/esm/{index-c3841e4d.js → index-01a293ec.js} +27 -36
- package/build/esm/{index-af35b428.js → index-03684b81.js} +3 -3
- package/build/esm/{index-f824c0e2.js → index-043873f3.js} +16 -16
- package/build/esm/{index-70296026.js → index-0c71a30f.js} +17 -17
- package/build/esm/{index-6888dffa.js → index-10e9d1b7.js} +17 -17
- package/build/esm/{index-c07f5c07.js → index-11ac8aea.js} +1 -1
- package/build/esm/{index-1f0f5aca.js → index-1366b5aa.js} +10 -10
- package/build/esm/{index-d4520e91.js → index-1a1ccc71.js} +8 -8
- package/build/esm/{index-4ff7c62a.js → index-1b71077d.js} +2 -2
- package/build/esm/{index-e1426133.js → index-1d8bd28b.js} +22 -22
- package/build/esm/{index-a4e6b5ce.js → index-1e07e28a.js} +2 -2
- package/build/esm/{index-96704673.js → index-2146fe51.js} +1 -1
- package/build/esm/{index-8c90983b.js → index-279897da.js} +1 -1
- package/build/esm/{index-5466e357.js → index-292cce89.js} +1 -1
- package/build/esm/{index-9530557d.js → index-321f7852.js} +17 -17
- package/build/esm/{index-4ed57f85.js → index-380b8316.js} +2 -2
- package/build/esm/{index-871051cf.js → index-38aca112.js} +3 -3
- package/build/esm/{index-0423b372.js → index-39835a89.js} +2 -2
- package/build/esm/{index-fd855849.js → index-3a1495d6.js} +5 -5
- package/build/esm/{index-37a63220.js → index-44ac19ab.js} +7 -7
- package/build/esm/{index-c3ce6157.js → index-45add692.js} +6 -6
- package/build/esm/{index-e40243b0.js → index-45c7be3c.js} +3 -3
- package/build/esm/{index-a9feb783.js → index-4bcc31a6.js} +32 -32
- package/build/esm/{index-370af621.js → index-52accd51.js} +2 -39
- package/build/esm/{index-3e1814c1.js → index-53f5e323.js} +1 -1
- package/build/esm/{index-45505f2c.js → index-5b0fec76.js} +2 -2
- package/build/esm/{index-f34dad0c.js → index-6cff42a5.js} +16 -16
- package/build/esm/{index-f47da5bb.js → index-6d9a63ae.js} +13 -13
- package/build/esm/{index-f4b25e8f.js → index-6e8d0eb7.js} +13 -13
- package/build/esm/{index-96e04fc8.js → index-6ed2eaa5.js} +16 -16
- package/build/esm/{index-08b9a262.js → index-745cdca5.js} +16 -16
- package/build/esm/{index-8f8bc043.js → index-82a1b9c3.js} +15 -15
- package/build/esm/{index-1881a822.js → index-843a933c.js} +2 -2
- package/build/esm/{index-cf6b6574.js → index-84a9daf8.js} +18 -18
- package/build/esm/{index-12b37e1d.js → index-85550d91.js} +6 -6
- package/build/esm/{index-65f141c1.js → index-87fc69f5.js} +1 -1
- package/build/esm/{index-1096cc1a.js → index-94453b7b.js} +3 -3
- package/build/esm/{index-2d19a560.js → index-9ab17c42.js} +31 -31
- package/build/esm/{index-5b650465.js → index-9f09262e.js} +1 -1
- package/build/esm/{index-1b73eed5.js → index-a0a5dbea.js} +4 -4
- package/build/esm/{index-3bc6ddd1.js → index-a34096b4.js} +17 -17
- package/build/esm/{index-3b1703aa.js → index-a4866cef.js} +13 -13
- package/build/esm/{index-4cc9b880.js → index-a4f611de.js} +1 -1
- package/build/esm/{index-23d3743e.js → index-a7eee506.js} +2 -2
- package/build/esm/{index-e388493a.js → index-acbcda8e.js} +18 -18
- package/build/esm/{index-290638a8.js → index-b20b637a.js} +2 -2
- package/build/esm/{index-81ccb624.js → index-b520cbab.js} +2 -2
- package/build/esm/{index-3222872e.js → index-bb64b141.js} +25 -25
- package/build/esm/{index-5b0939a8.js → index-c89611db.js} +3 -3
- package/build/esm/{index-dd664bf5.js → index-d41d469d.js} +3 -3
- package/build/esm/{index-a369d413.js → index-d972356e.js} +5 -5
- package/build/esm/{index-a7927623.js → index-d9a5e563.js} +2 -2
- package/build/esm/{index-6a2e5610.js → index-dd6a1724.js} +21 -21
- package/build/esm/{index-d3eb4e0d.js → index-de9e0ceb.js} +2 -2
- package/build/esm/{index-97ca081d.js → index-dfc48cf4.js} +2 -2
- package/build/esm/{index-4f0f3097.js → index-e13e7f89.js} +24 -24
- package/build/esm/{index-6f990758.js → index-e1a8672b.js} +6 -6
- package/build/esm/{index-17f4cc07.js → index-e447e9fc.js} +6 -6
- package/build/esm/{index-9b8d4fd0.js → index-e86fb7af.js} +1 -1
- package/build/esm/{index-b35d49d4.js → index-eb9376f6.js} +32 -32
- package/build/esm/{index-79890213.js → index-f0928248.js} +2 -2
- package/build/esm/{index-19b02397.js → index-fbc9646e.js} +7 -7
- package/build/esm/{index-8d9fbcc3.js → index-fd247adc.js} +13 -13
- package/build/esm/index.js +117 -117
- package/build/esm/interfaces/constants/domainLocales.d.ts +0 -2
- package/build/esm/interfaces/constants/index.d.ts +1 -1
- package/build/esm/interfaces/types/Locale.d.ts +1 -2
- package/build/esm/interfaces/types/index.d.ts +1 -2
- package/build/esm/{labelSorting-af5bf1b1.js → labelSorting-2e2b4521.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/layouts/lightbox/formContext.d.ts +1 -2
- package/build/esm/lead/services/index.d.ts +0 -19
- package/build/esm/lead/store/index.d.ts +0 -1
- package/build/esm/lead.css +1 -1
- package/build/esm/lead.js +995 -2191
- package/build/esm/{logoIcon-48572541.js → logoIcon-82673d69.js} +2 -8
- 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 -73
- package/build/esm/moleculesArticleCard.js +6 -6
- package/build/esm/moleculesArticleCardV2.js +16 -16
- package/build/esm/navigation.js +45 -45
- 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 -49
- package/build/esm/{post-5ecb65c5.js → post-b303aabc.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 +39 -51
- package/build/esm/{store-18fd61ec.js → store-906da6e3.js} +4 -4
- package/build/esm/subot.js +35 -35
- package/build/esm/surveyOrPremiumBanner.js +32 -32
- package/build/esm/surveyQuestionCard.js +10 -10
- package/build/esm/{surveyThankyouCard-6c4ba9c3.js → surveyThankyouCard-d56a88b7.js} +5 -5
- package/build/esm/together.js +55 -55
- 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 -50
- package/build/esm/togetherMoleculesCardAuthor.js +28 -28
- package/build/esm/togetherMoleculesPostImagePreview.js +11 -11
- package/build/esm/togetherMoleculesProfileDetail.js +38 -38
- package/build/esm/togetherOrganisms.js +49 -49
- package/build/esm/togetherRichTextEditor.js +17 -17
- package/build/esm/togetherShareBox.js +10 -10
- package/build/esm/{treePopoverMenu-d2e708d8.js → treePopoverMenu-a764e8b3.js} +19 -19
- package/build/esm/{types-2c7ea5b1.js → types-1732e205.js} +2 -2
- package/build/esm/types.js +2 -2
- package/build/esm/{useCategory-98903303.js → useCategory-f344e24b.js} +5 -18
- package/build/esm/{useHealthToolCache-c0de2d5a.js → useHealthToolCache-611a21f2.js} +1 -1
- package/build/esm/{useMantineLocale-3dcc1724.js → useMantineLocale-2648ca03.js} +6 -8
- package/build/esm/{usePlacesAutocomplete-bfb0db64.js → usePlacesAutocomplete-e6a27296.js} +1 -1
- package/build/esm/{useScreenSize-cc7d6c7a.js → useScreenSize-34cbd783.js} +2 -2
- package/build/esm/useTogetherAuthRequiredAction.js +9 -9
- package/build/esm/{utils-fd471902.js → utils-0b69d7c1.js} +2 -2
- package/build/esm/{utils-6e5d68e8.js → utils-786037e3.js} +2 -2
- package/build/esm/{utils-064598a5.js → utils-b4cfd8d0.js} +3 -3
- package/build/esm/{utils-cedbce5b.js → utils-bd8204f1.js} +4 -4
- package/build/esm/vaccination.js +21 -21
- package/build/footer.js +21 -21
- package/build/gAssets.js +2 -2
- package/build/{healthTools-0dc6a117.js → healthTools-ea6e9b1a.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 +56 -16
- package/build/i18nV2.js +1 -1
- package/build/{index-4aef88ff.js → index-02ec2ce8.js} +1 -1
- package/build/{index-f519625e.js → index-03843c98.js} +27 -36
- package/build/{index-d4cc55d5.js → index-0569146b.js} +2 -2
- package/build/{index-04498acf.js → index-05d7e388.js} +16 -16
- package/build/{index-0f337c0c.js → index-09a4fdcc.js} +2 -2
- package/build/{index-e4c4a47e.js → index-0d7e63f1.js} +2 -2
- package/build/{index-5367382b.js → index-0f3397db.js} +24 -24
- package/build/{index-1badbcf0.js → index-1126e8c3.js} +13 -13
- package/build/{index-9f76eff8.js → index-1daa798a.js} +2 -2
- package/build/{index-920ce764.js → index-1f1f0c5c.js} +6 -6
- package/build/{index-51226aea.js → index-1f2581dc.js} +16 -16
- package/build/{index-7280eafc.js → index-211155ad.js} +7 -7
- package/build/{index-ad640b16.js → index-2ac06f25.js} +1 -1
- package/build/{index-9a3f589b.js → index-2d183ddd.js} +21 -21
- package/build/{index-956f121c.js → index-30445f01.js} +3 -3
- package/build/{index-8ad0770c.js → index-313986f8.js} +2 -39
- package/build/{index-b30545be.js → index-3521b764.js} +2 -2
- package/build/{index-3a2dcdb1.js → index-3802f7d1.js} +2 -2
- package/build/{index-ca360d1b.js → index-3879b270.js} +32 -32
- package/build/{index-5dcab081.js → index-3a00a873.js} +6 -6
- package/build/{index-22677d6f.js → index-3a860bc9.js} +18 -18
- package/build/{index-477103d5.js → index-3b36be31.js} +17 -17
- package/build/{index-103b6d52.js → index-3d634a4e.js} +15 -15
- package/build/{index-01925084.js → index-45b7f806.js} +13 -13
- package/build/{index-4f9a53eb.js → index-46410bb9.js} +25 -25
- package/build/{index-d766b652.js → index-465c24d5.js} +3 -3
- package/build/{index-f7b562d7.js → index-4a9a2c03.js} +5 -5
- package/build/{index-588763ca.js → index-53923d20.js} +2 -2
- package/build/{index-6ae674be.js → index-54823cfb.js} +13 -13
- package/build/{index-e06e527b.js → index-5ce573da.js} +10 -10
- package/build/{index-7021af67.js → index-674c1e8f.js} +6 -6
- package/build/{index-a5b6bf95.js → index-6929b526.js} +6 -6
- package/build/{index-1ec23a8c.js → index-6b4e8c24.js} +1 -1
- package/build/{index-704521de.js → index-780b89ca.js} +2 -2
- package/build/{index-c88eca7a.js → index-781d5c05.js} +2 -2
- package/build/{index-379d705c.js → index-8249ac09.js} +1 -1
- package/build/{index-09051bb1.js → index-82f50b82.js} +13 -13
- package/build/{index-25405264.js → index-862151dc.js} +3 -3
- package/build/{index-e37e8c94.js → index-872cfb2b.js} +2 -2
- package/build/{index-549d3920.js → index-88e57242.js} +3 -3
- package/build/{index-ba2f1673.js → index-9311a66a.js} +3 -3
- package/build/{index-2bea9f69.js → index-9aaa0051.js} +1 -1
- package/build/{index-5ef55da1.js → index-9bbc1cc0.js} +2 -2
- package/build/{index-c5193758.js → index-9cfb6f01.js} +1 -1
- package/build/{index-c7b180a8.js → index-9ffc892e.js} +32 -32
- package/build/{index-d9db5903.js → index-ac236671.js} +1 -1
- package/build/{index-e76a2d6b.js → index-ad3fac95.js} +17 -17
- package/build/{index-8f7e7733.js → index-ad7af6c9.js} +2 -2
- package/build/{index-1c224e52.js → index-b1ff851d.js} +6 -6
- package/build/{index-1e7383be.js → index-b5b2f96c.js} +1 -1
- package/build/{index-da72b1e4.js → index-b6cf7572.js} +5 -5
- package/build/{index-f7a352ec.js → index-b7230632.js} +16 -16
- package/build/{index-3424b721.js → index-c001a050.js} +1 -1
- package/build/{index-5d752841.js → index-c880f609.js} +17 -17
- package/build/{index-e90fd8b1.js → index-ced4a459.js} +2 -2
- package/build/{index-abf4568e.js → index-d3458e6c.js} +18 -18
- package/build/{index-50f21f67.js → index-d47f22b8.js} +22 -22
- package/build/{index-03dd0804.js → index-d54c5bff.js} +31 -31
- package/build/{index-ce264aab.js → index-e7bb57be.js} +4 -4
- package/build/{index-5eab3cf1.js → index-eb122fd8.js} +8 -8
- package/build/{index-695380e6.js → index-ecb288e0.js} +3 -3
- package/build/{index-8b3c6bb6.js → index-eea151e5.js} +17 -17
- package/build/{index-c03d5b05.js → index-f1cc4236.js} +7 -7
- package/build/{index-d3aa7ac9.js → index-f8b6c1a4.js} +16 -16
- package/build/index.js +117 -117
- package/build/interfaces/constants/domainLocales.d.ts +0 -2
- package/build/interfaces/constants/index.d.ts +1 -1
- package/build/interfaces/types/Locale.d.ts +1 -2
- package/build/interfaces/types/index.d.ts +1 -2
- package/build/{labelSorting-f0a2b329.js → labelSorting-91e042b2.js} +4 -4
- package/build/lead/helpers.d.ts +1 -56
- package/build/lead/index.d.ts +1 -2
- package/build/lead/layouts/lightbox/formContext.d.ts +1 -2
- package/build/lead/services/index.d.ts +0 -19
- package/build/lead/store/index.d.ts +0 -1
- package/build/lead.css +1 -1
- package/build/lead.js +997 -2194
- package/build/{logoIcon-abf47ead.js → logoIcon-0d6bf2cb.js} +2 -8
- 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 -73
- package/build/moleculesArticleCard.js +6 -6
- package/build/moleculesArticleCardV2.js +16 -16
- package/build/navigation.js +45 -45
- package/build/navigationLogoutPopup.js +9 -9
- package/build/navigationProfileButton.js +23 -23
- package/build/onboardingV2.js +28 -28
- package/build/organisms.js +49 -49
- package/build/{post-e39c948f.js → post-0a654de4.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 +37 -49
- package/build/{store-19496022.js → store-4f2a5549.js} +4 -4
- package/build/subot.js +34 -34
- package/build/surveyOrPremiumBanner.js +32 -32
- package/build/surveyQuestionCard.js +10 -10
- package/build/{surveyThankyouCard-c4a46538.js → surveyThankyouCard-df7eca0d.js} +5 -5
- package/build/together.js +55 -55
- package/build/togetherApiUtils.js +4 -4
- package/build/togetherAtoms.js +30 -30
- package/build/togetherComponentGlobalContext.js +4 -4
- package/build/togetherMolecules.js +50 -50
- package/build/togetherMoleculesCardAuthor.js +28 -28
- package/build/togetherMoleculesPostImagePreview.js +11 -11
- package/build/togetherMoleculesProfileDetail.js +38 -38
- package/build/togetherOrganisms.js +49 -49
- package/build/togetherRichTextEditor.js +17 -17
- package/build/togetherShareBox.js +10 -10
- package/build/{treePopoverMenu-452d5155.js → treePopoverMenu-6d84be70.js} +19 -19
- package/build/{types-2aa2c266.js → types-25f74bad.js} +2 -2
- package/build/types.js +2 -2
- package/build/{useCategory-4efd9a6a.js → useCategory-45d025d3.js} +5 -18
- package/build/{useHealthToolCache-e5fe0a19.js → useHealthToolCache-45e11da8.js} +1 -1
- package/build/{useMantineLocale-481b8a13.js → useMantineLocale-641ac8c6.js} +6 -8
- package/build/{usePlacesAutocomplete-26f79d1c.js → usePlacesAutocomplete-8554270f.js} +1 -1
- package/build/{useScreenSize-03cd2dde.js → useScreenSize-f2c93dfe.js} +2 -2
- package/build/useTogetherAuthRequiredAction.js +9 -9
- package/build/{utils-be9f0bd7.js → utils-0204d947.js} +2 -2
- package/build/{utils-abfdf38e.js → utils-55730e46.js} +4 -4
- package/build/{utils-4addbbdb.js → utils-7a0cd70f.js} +2 -2
- package/build/{utils-10a24a63.js → utils-c7cc1f19.js} +3 -3
- 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/i18n-values/zh-CN.js +0 -855
- package/build/esm/lead/LeadGen.type.d.ts +0 -31
- 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 -63
- 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 -23
- package/build/esm/lead/LeadGenSubscriptionBox/index.d.ts +0 -1
- package/build/esm/lead/LeadGenTranslationContext.d.ts +0 -6
- package/build/esm/translationsProvider-058aa9f4.js +0 -55
- package/build/i18n-values/zh-CN.js +0 -866
- package/build/lead/LeadGen.type.d.ts +0 -31
- 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 -63
- 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 -23
- package/build/lead/LeadGenSubscriptionBox/index.d.ts +0 -1
- package/build/lead/LeadGenTranslationContext.d.ts +0 -6
- package/build/translationsProvider-2988368b.js +0 -62
- /package/build/{BMI_BOYS.percentile.monthly-a94ca606.js → BMI_BOYS.percentile.monthly-8657c76a.js} +0 -0
- /package/build/{BMI_BOYS.percentile.weekly-836a362e.js → BMI_BOYS.percentile.weekly-f4dc0c4d.js} +0 -0
- /package/build/{BMI_BOYS.percentile.yearly-2da80d18.js → BMI_BOYS.percentile.yearly-3ca55467.js} +0 -0
- /package/build/{BMI_BOYS.zscore.monthly-ddabfd0d.js → BMI_BOYS.zscore.monthly-005bd4d2.js} +0 -0
- /package/build/{BMI_BOYS.zscore.weekly-44db2028.js → BMI_BOYS.zscore.weekly-8dc3f934.js} +0 -0
- /package/build/{BMI_BOYS.zscore.yearly-34644dac.js → BMI_BOYS.zscore.yearly-f3aa27f6.js} +0 -0
- /package/build/{BMI_GIRLS.percentile.monthly-e049696d.js → BMI_GIRLS.percentile.monthly-f0d63ea0.js} +0 -0
- /package/build/{BMI_GIRLS.percentile.weekly-17bc9a3f.js → BMI_GIRLS.percentile.weekly-89550f05.js} +0 -0
- /package/build/{BMI_GIRLS.percentile.yearly-8f603d39.js → BMI_GIRLS.percentile.yearly-fbdf6f62.js} +0 -0
- /package/build/{BMI_GIRLS.zscore.monthly-59affc15.js → BMI_GIRLS.zscore.monthly-ebcb1b0c.js} +0 -0
- /package/build/{BMI_GIRLS.zscore.weekly-6fcf7879.js → BMI_GIRLS.zscore.weekly-05b95ccc.js} +0 -0
- /package/build/{BMI_GIRLS.zscore.yearly-adf6fe1d.js → BMI_GIRLS.zscore.yearly-f1019188.js} +0 -0
- /package/build/{ChevronDown-c3f711b6.js → ChevronDown-8a456bfa.js} +0 -0
- /package/build/{Close-af38b8d8.js → Close-f5683b6c.js} +0 -0
- /package/build/{Google-89d9d352.js → Google-d8fbb79c.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.percentile.monthly-41afcfce.js → HEAD CIRCUM_BOYS.percentile.monthly-0dabbe9a.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.percentile.weekly-57391036.js → HEAD CIRCUM_BOYS.percentile.weekly-c8802a77.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.percentile.yearly-c3f58e37.js → HEAD CIRCUM_BOYS.percentile.yearly-4a875ed6.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.zscore.monthly-1e58b0be.js → HEAD CIRCUM_BOYS.zscore.monthly-985b1e26.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.zscore.weekly-1cab9188.js → HEAD CIRCUM_BOYS.zscore.weekly-fce154c7.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.zscore.yearly-c10f93fe.js → HEAD CIRCUM_BOYS.zscore.yearly-bb11148b.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.percentile.monthly-f3d4a5d0.js → HEAD CIRCUM_GIRLS.percentile.monthly-a2cfdbf7.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.percentile.weekly-13024b99.js → HEAD CIRCUM_GIRLS.percentile.weekly-8a05f050.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.percentile.yearly-31bd2df8.js → HEAD CIRCUM_GIRLS.percentile.yearly-654300c6.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.zscore.monthly-62c93cbe.js → HEAD CIRCUM_GIRLS.zscore.monthly-efc688a5.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.zscore.weekly-48764d7e.js → HEAD CIRCUM_GIRLS.zscore.weekly-c2a93f80.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.zscore.yearly-6ee35298.js → HEAD CIRCUM_GIRLS.zscore.yearly-a4cebc93.js} +0 -0
- /package/build/{HEIGHT_BOYS.percentile.monthly-cedda272.js → HEIGHT_BOYS.percentile.monthly-5ef11f01.js} +0 -0
- /package/build/{HEIGHT_BOYS.percentile.weekly-a7d3426e.js → HEIGHT_BOYS.percentile.weekly-8ed943db.js} +0 -0
- /package/build/{HEIGHT_BOYS.percentile.yearly-af32bacb.js → HEIGHT_BOYS.percentile.yearly-6978da52.js} +0 -0
- /package/build/{HEIGHT_BOYS.zscore.monthly-c1ec0f1a.js → HEIGHT_BOYS.zscore.monthly-fe7f2a83.js} +0 -0
- /package/build/{HEIGHT_BOYS.zscore.weekly-a99cd461.js → HEIGHT_BOYS.zscore.weekly-56770ae4.js} +0 -0
- /package/build/{HEIGHT_BOYS.zscore.yearly-65531c25.js → HEIGHT_BOYS.zscore.yearly-7f747c0d.js} +0 -0
- /package/build/{HEIGHT_GIRLS.percentile.monthly-c3c68ff1.js → HEIGHT_GIRLS.percentile.monthly-11ef591b.js} +0 -0
- /package/build/{HEIGHT_GIRLS.percentile.weekly-7789077e.js → HEIGHT_GIRLS.percentile.weekly-d5f902bd.js} +0 -0
- /package/build/{HEIGHT_GIRLS.percentile.yearly-c552b2cd.js → HEIGHT_GIRLS.percentile.yearly-b29fcf3f.js} +0 -0
- /package/build/{HEIGHT_GIRLS.zscore.monthly-f5c30e44.js → HEIGHT_GIRLS.zscore.monthly-c2b950c6.js} +0 -0
- /package/build/{HEIGHT_GIRLS.zscore.weekly-aa7359b8.js → HEIGHT_GIRLS.zscore.weekly-fafb77e5.js} +0 -0
- /package/build/{HEIGHT_GIRLS.zscore.yearly-a3121654.js → HEIGHT_GIRLS.zscore.yearly-51e2ac88.js} +0 -0
- /package/build/{Visible-c0e317b6.js → Visible-e68ad984.js} +0 -0
- /package/build/{WEIGHT_BOYS.percentile.monthly-546f7888.js → WEIGHT_BOYS.percentile.monthly-95579d1b.js} +0 -0
- /package/build/{WEIGHT_BOYS.percentile.weekly-38af0491.js → WEIGHT_BOYS.percentile.weekly-0d85437f.js} +0 -0
- /package/build/{WEIGHT_BOYS.percentile.yearly-f008340d.js → WEIGHT_BOYS.percentile.yearly-a68e7946.js} +0 -0
- /package/build/{WEIGHT_BOYS.zscore.monthly-e8802481.js → WEIGHT_BOYS.zscore.monthly-e2ab176e.js} +0 -0
- /package/build/{WEIGHT_BOYS.zscore.weekly-409ed8cf.js → WEIGHT_BOYS.zscore.weekly-ed00829a.js} +0 -0
- /package/build/{WEIGHT_BOYS.zscore.yearly-df392705.js → WEIGHT_BOYS.zscore.yearly-6c5f3d8d.js} +0 -0
- /package/build/{WEIGHT_GIRLS.percentile.monthly-524fe0d4.js → WEIGHT_GIRLS.percentile.monthly-a81b7004.js} +0 -0
- /package/build/{WEIGHT_GIRLS.percentile.weekly-81a69fd3.js → WEIGHT_GIRLS.percentile.weekly-927efb7f.js} +0 -0
- /package/build/{WEIGHT_GIRLS.percentile.yearly-020535af.js → WEIGHT_GIRLS.percentile.yearly-2e15c4ad.js} +0 -0
- /package/build/{WEIGHT_GIRLS.zscore.monthly-14b4e77b.js → WEIGHT_GIRLS.zscore.monthly-5ff1be24.js} +0 -0
- /package/build/{WEIGHT_GIRLS.zscore.weekly-5520f50e.js → WEIGHT_GIRLS.zscore.weekly-8e9d9fa1.js} +0 -0
- /package/build/{WEIGHT_GIRLS.zscore.yearly-25e801fa.js → WEIGHT_GIRLS.zscore.yearly-0711078f.js} +0 -0
- /package/build/{animation-ffcf687b.js → animation-f1d48882.js} +0 -0
- /package/build/{constants-459aab55.js → constants-26168815.js} +0 -0
- /package/build/{constants-75af6d16.js → constants-ec1dc828.js} +0 -0
- /package/build/{dataTransform-8d6c3c6f.js → dataTransform-795c88ab.js} +0 -0
- /package/build/{doctor-0c5af8d7.js → doctor-bd84be05.js} +0 -0
- /package/build/esm/{BMI_BOYS.percentile.monthly-98b80b28.js → BMI_BOYS.percentile.monthly-f87c0cec.js} +0 -0
- /package/build/esm/{BMI_BOYS.percentile.weekly-2fe6652f.js → BMI_BOYS.percentile.weekly-df88fe6a.js} +0 -0
- /package/build/esm/{BMI_BOYS.percentile.yearly-08013b35.js → BMI_BOYS.percentile.yearly-efab1e50.js} +0 -0
- /package/build/esm/{BMI_BOYS.zscore.monthly-98cafee7.js → BMI_BOYS.zscore.monthly-bca64885.js} +0 -0
- /package/build/esm/{BMI_BOYS.zscore.weekly-a2873e74.js → BMI_BOYS.zscore.weekly-c6b2fe02.js} +0 -0
- /package/build/esm/{BMI_BOYS.zscore.yearly-4f3248cd.js → BMI_BOYS.zscore.yearly-6e275a3f.js} +0 -0
- /package/build/esm/{BMI_GIRLS.percentile.monthly-e3a3a60e.js → BMI_GIRLS.percentile.monthly-e0af8146.js} +0 -0
- /package/build/esm/{BMI_GIRLS.percentile.weekly-67a60ae0.js → BMI_GIRLS.percentile.weekly-ab0faec2.js} +0 -0
- /package/build/esm/{BMI_GIRLS.percentile.yearly-f5289f0a.js → BMI_GIRLS.percentile.yearly-067f0d6e.js} +0 -0
- /package/build/esm/{BMI_GIRLS.zscore.monthly-ea2c6c7d.js → BMI_GIRLS.zscore.monthly-a9bd5e5b.js} +0 -0
- /package/build/esm/{BMI_GIRLS.zscore.weekly-31ebf715.js → BMI_GIRLS.zscore.weekly-a50beb6f.js} +0 -0
- /package/build/esm/{BMI_GIRLS.zscore.yearly-0f5cd13e.js → BMI_GIRLS.zscore.yearly-47a98d22.js} +0 -0
- /package/build/esm/{ChevronDown-d4216c49.js → ChevronDown-05754bcf.js} +0 -0
- /package/build/esm/{Close-a1570e5a.js → Close-9039a072.js} +0 -0
- /package/build/esm/{Google-836ba7ee.js → Google-c488a1bf.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.percentile.monthly-c5b52221.js → HEAD CIRCUM_BOYS.percentile.monthly-5864cf59.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.percentile.weekly-5939b5e3.js → HEAD CIRCUM_BOYS.percentile.weekly-48c99d09.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.percentile.yearly-287b382c.js → HEAD CIRCUM_BOYS.percentile.yearly-c0c2b01a.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.zscore.monthly-82522fd4.js → HEAD CIRCUM_BOYS.zscore.monthly-1fbdc3b5.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.zscore.weekly-f888f299.js → HEAD CIRCUM_BOYS.zscore.weekly-12617919.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.zscore.yearly-4fd9b4f0.js → HEAD CIRCUM_BOYS.zscore.yearly-2d4773af.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.monthly-accd234c.js → HEAD CIRCUM_GIRLS.percentile.monthly-7eaf5b74.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.weekly-11df9b57.js → HEAD CIRCUM_GIRLS.percentile.weekly-07718321.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.yearly-832d6d96.js → HEAD CIRCUM_GIRLS.percentile.yearly-5c40e3ef.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.monthly-d796cff8.js → HEAD CIRCUM_GIRLS.zscore.monthly-bbc744a0.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.weekly-dbdfd713.js → HEAD CIRCUM_GIRLS.zscore.weekly-71c3530d.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.yearly-bbd50143.js → HEAD CIRCUM_GIRLS.zscore.yearly-562448de.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.percentile.monthly-13bf1524.js → HEIGHT_BOYS.percentile.monthly-f229f4c1.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.percentile.weekly-ee262d0f.js → HEIGHT_BOYS.percentile.weekly-6372f64c.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.percentile.yearly-878b6fed.js → HEIGHT_BOYS.percentile.yearly-79b5c4cd.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.zscore.monthly-86a939d1.js → HEIGHT_BOYS.zscore.monthly-c25e6418.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.zscore.weekly-2314a0c1.js → HEIGHT_BOYS.zscore.weekly-c6164b2d.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.zscore.yearly-9c94c8e1.js → HEIGHT_BOYS.zscore.yearly-1ac79b25.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.percentile.monthly-7590684f.js → HEIGHT_GIRLS.percentile.monthly-57be4fe7.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.percentile.weekly-680b838e.js → HEIGHT_GIRLS.percentile.weekly-3bd60cda.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.percentile.yearly-798c4744.js → HEIGHT_GIRLS.percentile.yearly-2392717d.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.zscore.monthly-3e584eb1.js → HEIGHT_GIRLS.zscore.monthly-e4da0130.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.zscore.weekly-e5d7976a.js → HEIGHT_GIRLS.zscore.weekly-398cab51.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.zscore.yearly-494e461f.js → HEIGHT_GIRLS.zscore.yearly-0aa6db35.js} +0 -0
- /package/build/esm/{Visible-af1dbd44.js → Visible-fe1a671b.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.percentile.monthly-1ae7df4c.js → WEIGHT_BOYS.percentile.monthly-4fe46448.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.percentile.weekly-8c22f2be.js → WEIGHT_BOYS.percentile.weekly-61cd4679.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.percentile.yearly-becb5697.js → WEIGHT_BOYS.percentile.yearly-175962e7.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.zscore.monthly-0a194058.js → WEIGHT_BOYS.zscore.monthly-5b48638d.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.zscore.weekly-9145c833.js → WEIGHT_BOYS.zscore.weekly-f765de66.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.zscore.yearly-4fb5c591.js → WEIGHT_BOYS.zscore.yearly-2810ea3a.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.percentile.monthly-2e282f8b.js → WEIGHT_GIRLS.percentile.monthly-edd22d58.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.percentile.weekly-e69f82dc.js → WEIGHT_GIRLS.percentile.weekly-16b503c8.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.percentile.yearly-c463294f.js → WEIGHT_GIRLS.percentile.yearly-b0f7b0e3.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.zscore.monthly-e9990c7e.js → WEIGHT_GIRLS.zscore.monthly-bafd7336.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.zscore.weekly-64fe359e.js → WEIGHT_GIRLS.zscore.weekly-13e3b15d.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.zscore.yearly-299f776b.js → WEIGHT_GIRLS.zscore.yearly-cb2c7ca0.js} +0 -0
- /package/build/esm/{animation-de92eac9.js → animation-4e68b089.js} +0 -0
- /package/build/esm/{constants-f5042816.js → constants-8fa39e2b.js} +0 -0
- /package/build/esm/{constants-347788b2.js → constants-fbf3481e.js} +0 -0
- /package/build/esm/{dataTransform-50fd6ddf.js → dataTransform-0d67f5f8.js} +0 -0
- /package/build/esm/{doctor-11fffc6e.js → doctor-391af6d0.js} +0 -0
- /package/build/esm/{index-45e1c9a1.js → index-2795fa56.js} +0 -0
- /package/build/esm/{index-89498cd6.js → index-2e6714c4.js} +0 -0
- /package/build/esm/{index-664497df.js → index-348e7549.js} +0 -0
- /package/build/esm/{index-db6cad26.js → index-5400fc7b.js} +0 -0
- /package/build/esm/{index-06e4ca77.js → index-6cc7eff8.js} +0 -0
- /package/build/esm/{index-b8e1ece4.js → index-7320bb4e.js} +0 -0
- /package/build/esm/{index-2a8894e6.js → index-832b09c0.js} +0 -0
- /package/build/esm/{index-e7737ff7.js → index-c6c69fc7.js} +0 -0
- /package/build/esm/{index.styles-a1185717.js → index.styles-74d4cd9a.js} +0 -0
- /package/build/esm/{localizeNumberFormat-1fdb8aa8.js → localizeNumberFormat-5dadff83.js} +0 -0
- /package/build/esm/{normalizeLink-321e9bca.js → normalizeLink-9ad88b8a.js} +0 -0
- /package/build/esm/{number-1d1c965d.js → number-4874a84c.js} +0 -0
- /package/build/esm/{other-2483b757.js → other-c1d47dbe.js} +0 -0
- /package/build/esm/{paths-4600a9c1.js → paths-d493ff83.js} +0 -0
- /package/build/esm/{translationsContext-8c982b59.js → translationsContext-6860109f.js} +0 -0
- /package/build/esm/{tslib.es6-5338c038.js → tslib.es6-37ac3f80.js} +0 -0
- /package/build/esm/{types-d9ab84a2.js → types-bafec1d0.js} +0 -0
- /package/build/esm/{useIsInit-a4da83cb.js → useIsInit-a50d4693.js} +0 -0
- /package/build/esm/{useOutsideClick-cd806f77.js → useOutsideClick-6c8cc9bd.js} +0 -0
- /package/build/esm/{useScrollbarSize-abd71947.js → useScrollbarSize-10b6c5db.js} +0 -0
- /package/build/esm/{useUniqueId-58e62fe5.js → useUniqueId-add5ca42.js} +0 -0
- /package/build/esm/{utils-bad138ab.js → utils-fd0077ec.js} +0 -0
- /package/build/{index-ffba7b3c.js → index-3cfbcf67.js} +0 -0
- /package/build/{index-857c287a.js → index-4e5503ea.js} +0 -0
- /package/build/{index-e0e69a8c.js → index-6fa267ee.js} +0 -0
- /package/build/{index-0baf46a9.js → index-7a99b28f.js} +0 -0
- /package/build/{index-88d9a33b.js → index-a2652f78.js} +0 -0
- /package/build/{index-10d959d5.js → index-ab45e0ad.js} +0 -0
- /package/build/{index-222ea420.js → index-b9a8d994.js} +0 -0
- /package/build/{index-5a53d685.js → index-f3df447c.js} +0 -0
- /package/build/{index.styles-cdfc2015.js → index.styles-98bdc2ef.js} +0 -0
- /package/build/{localizeNumberFormat-bd72b6e3.js → localizeNumberFormat-6a6886ee.js} +0 -0
- /package/build/{normalizeLink-4f6ec0e4.js → normalizeLink-b31bd775.js} +0 -0
- /package/build/{number-75eec17b.js → number-144eafe9.js} +0 -0
- /package/build/{other-c454606b.js → other-bf9b4bcf.js} +0 -0
- /package/build/{paths-4d6918f2.js → paths-e9fc7b80.js} +0 -0
- /package/build/{translationsContext-03c93e26.js → translationsContext-a085d37d.js} +0 -0
- /package/build/{tslib.es6-5d29380d.js → tslib.es6-6a38b123.js} +0 -0
- /package/build/{types-cafd9617.js → types-33611582.js} +0 -0
- /package/build/{useIsInit-0773f875.js → useIsInit-330b1f95.js} +0 -0
- /package/build/{useOutsideClick-398b0bb1.js → useOutsideClick-e79b1002.js} +0 -0
- /package/build/{useScrollbarSize-1b60cab4.js → useScrollbarSize-1e7e0424.js} +0 -0
- /package/build/{useUniqueId-c9bbb0bd.js → useUniqueId-8da5848c.js} +0 -0
- /package/build/{utils-ce39dcb2.js → utils-80ddfe39.js} +0 -0
package/build/lead.js
CHANGED
|
@@ -2,51 +2,47 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var tslib_es6 = require('./tslib.es6-
|
|
5
|
+
var tslib_es6 = require('./tslib.es6-6a38b123.js');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var core = require('@mantine/core');
|
|
8
8
|
var dayjs = require('dayjs');
|
|
9
9
|
var debounce = require('lodash/debounce');
|
|
10
10
|
var form = require('@mantine/form');
|
|
11
|
-
var index = require('./index-
|
|
12
|
-
var translationsContext = require('./translationsContext-
|
|
11
|
+
var index = require('./index-9cfb6f01.js');
|
|
12
|
+
var translationsContext = require('./translationsContext-a085d37d.js');
|
|
13
13
|
var miscCookieHelper = require('./miscCookieHelper.js');
|
|
14
|
-
var utils$1 = require('./utils-
|
|
15
|
-
var index$1 = require('./index-
|
|
16
|
-
var index$2 = require('./index-
|
|
17
|
-
var index$4 = require('./index-
|
|
18
|
-
var index$3 = require('./index-
|
|
19
|
-
require('./index.styles-
|
|
14
|
+
var utils$1 = require('./utils-80ddfe39.js');
|
|
15
|
+
var index$1 = require('./index-3521b764.js');
|
|
16
|
+
var index$2 = require('./index-03843c98.js');
|
|
17
|
+
var index$4 = require('./index-1f1f0c5c.js');
|
|
18
|
+
var index$3 = require('./index-ac236671.js');
|
|
19
|
+
require('./index.styles-98bdc2ef.js');
|
|
20
20
|
var hooks = require('@mantine/hooks');
|
|
21
|
-
require('./useMantineLocale-
|
|
22
|
-
|
|
23
|
-
require('./index-
|
|
24
|
-
var index$
|
|
25
|
-
require('./other-
|
|
26
|
-
require('./index-
|
|
27
|
-
var utils = require('./utils-
|
|
28
|
-
|
|
29
|
-
var usePlacesAutocomplete = require('./usePlacesAutocomplete-
|
|
30
|
-
var index$5 = require('./index-
|
|
31
|
-
var translationsProvider = require('./translationsProvider-2988368b.js');
|
|
32
|
-
var Locale = require('./Locale-a6cfbd0c.js');
|
|
21
|
+
require('./useMantineLocale-641ac8c6.js');
|
|
22
|
+
require('./index-c001a050.js');
|
|
23
|
+
require('./index-7a99b28f.js');
|
|
24
|
+
var index$7 = require('./index-313986f8.js');
|
|
25
|
+
require('./other-bf9b4bcf.js');
|
|
26
|
+
require('./index-ecb288e0.js');
|
|
27
|
+
var utils = require('./utils-0204d947.js');
|
|
28
|
+
require('@mantine/dates');
|
|
29
|
+
var usePlacesAutocomplete = require('./usePlacesAutocomplete-8554270f.js');
|
|
30
|
+
var index$5 = require('./index-781d5c05.js');
|
|
33
31
|
var uuid = require('uuid');
|
|
34
|
-
var
|
|
32
|
+
var index$6 = require('./index-6fa267ee.js');
|
|
33
|
+
var index$9 = require('./index-1daa798a.js');
|
|
34
|
+
var useScreenSize = require('./useScreenSize-f2c93dfe.js');
|
|
35
|
+
var ReactDOM = require('react-dom');
|
|
36
|
+
var react = require('@emotion/react');
|
|
35
37
|
var styled = require('@emotion/styled');
|
|
36
38
|
var miscTheme = require('./miscTheme.js');
|
|
37
|
-
var
|
|
38
|
-
var
|
|
39
|
-
var index$7 = require('./index-e0e69a8c.js');
|
|
40
|
-
var index$a = require('./index-9f76eff8.js');
|
|
41
|
-
var useScreenSize = require('./useScreenSize-03cd2dde.js');
|
|
42
|
-
var ReactDOM = require('react-dom');
|
|
43
|
-
var index$9 = require('./index-e90fd8b1.js');
|
|
44
|
-
var InputDate = require('./InputDate-53510fc6.js');
|
|
45
|
-
var Close = require('./Close-af38b8d8.js');
|
|
39
|
+
var index$8 = require('./index-ced4a459.js');
|
|
40
|
+
var Close = require('./Close-f5683b6c.js');
|
|
46
41
|
require('@hhgtech/icons/other');
|
|
47
42
|
require('@mantine/carousel');
|
|
43
|
+
require('./Locale-2723c28f.js');
|
|
48
44
|
require('classnames');
|
|
49
|
-
require('./useUniqueId-
|
|
45
|
+
require('./useUniqueId-8da5848c.js');
|
|
50
46
|
require('./constantsSite.js');
|
|
51
47
|
require('@hhgtech/icons/core');
|
|
52
48
|
require('@mantine/notifications');
|
|
@@ -54,22 +50,6 @@ require('./constantsDomainLocales.js');
|
|
|
54
50
|
require('./constantsIsProduction.js');
|
|
55
51
|
require('date-fns/locale');
|
|
56
52
|
require('./constantsRiskScreener.js');
|
|
57
|
-
require('./i18n-values/en-PH.js');
|
|
58
|
-
require('./i18n-values/hi-IN.js');
|
|
59
|
-
require('./i18n-values/id-ID.js');
|
|
60
|
-
require('./i18n-values/km-KH.js');
|
|
61
|
-
require('./i18n-values/ms-MY.js');
|
|
62
|
-
require('./i18n-values/my-MM.js');
|
|
63
|
-
require('./i18n-values/th-TH.js');
|
|
64
|
-
require('./i18n-values/tl-PH.js');
|
|
65
|
-
require('./i18n-values/vi-VN.js');
|
|
66
|
-
require('./i18n-values/vi-VN_MB.js');
|
|
67
|
-
require('./i18n-values/zh-TW.js');
|
|
68
|
-
require('./index-10d959d5.js');
|
|
69
|
-
require('slugify');
|
|
70
|
-
require('string-format');
|
|
71
|
-
require('./togetherApiPaths.js');
|
|
72
|
-
require('./constants-75af6d16.js');
|
|
73
53
|
require('vaul');
|
|
74
54
|
|
|
75
55
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
@@ -121,7 +101,7 @@ if (sessionStorage.getItem('insider_object')) {
|
|
|
121
101
|
}
|
|
122
102
|
const docLang = document.documentElement.lang;
|
|
123
103
|
// TODO: country code
|
|
124
|
-
const LEAD_LOCALE_DATA
|
|
104
|
+
const LEAD_LOCALE_DATA = {
|
|
125
105
|
'vi-VN': {
|
|
126
106
|
popupLang: 'vi',
|
|
127
107
|
countryCode: 'vn',
|
|
@@ -163,7 +143,7 @@ const LEAD_LOCALE_DATA$1 = {
|
|
|
163
143
|
countryCodeNumber: 91,
|
|
164
144
|
},
|
|
165
145
|
};
|
|
166
|
-
const LEAD_LOCALE = LEAD_LOCALE_DATA
|
|
146
|
+
const LEAD_LOCALE = LEAD_LOCALE_DATA[docLang] || LEAD_LOCALE_DATA['vi-VN'];
|
|
167
147
|
function LEAD_RESET_VAR() {
|
|
168
148
|
// LEAD_CURRENT_URL = location.href.toLowerCase();
|
|
169
149
|
LEAD_CURRENT_URL =
|
|
@@ -184,11 +164,6 @@ const LEAD_TIMEZONE_DATA = {
|
|
|
184
164
|
9: 'Asia/Manila', // Philippines / Filipinos Site
|
|
185
165
|
};
|
|
186
166
|
|
|
187
|
-
const LEADGEN_ACTIONS = {
|
|
188
|
-
SHOW: 'SHOW',
|
|
189
|
-
SCROLL: 'SCROLL',
|
|
190
|
-
TIME: 'TIME',
|
|
191
|
-
};
|
|
192
167
|
const LEADGEN_LAYOUT = {
|
|
193
168
|
LightBoxA: 'LightBoxA',
|
|
194
169
|
LightBoxB: 'LightBoxB',
|
|
@@ -218,10 +193,8 @@ const LEADGEN_BLOCK = {
|
|
|
218
193
|
DropdownBlock: 'DropdownBlock',
|
|
219
194
|
CheckboxBlock: 'CheckboxBlock',
|
|
220
195
|
TncBlock: 'TncBlock',
|
|
221
|
-
TitleBlock: 'TitleBlock',
|
|
222
|
-
SubtitleBlock: 'SubtitleBlock',
|
|
223
196
|
};
|
|
224
|
-
const
|
|
197
|
+
const LEADGEN_BLOCK_IN_FORM = [
|
|
225
198
|
LEADGEN_BLOCK.TextBlock,
|
|
226
199
|
LEADGEN_BLOCK.NumberBlock,
|
|
227
200
|
LEADGEN_BLOCK.DateBlock,
|
|
@@ -236,59 +209,7 @@ const LEADGEN_BLOCK_INPUT = [
|
|
|
236
209
|
LEADGEN_BLOCK.CheckboxBlock,
|
|
237
210
|
LEADGEN_BLOCK.TncBlock,
|
|
238
211
|
];
|
|
239
|
-
const leadGenFieldNamePhone = (listBlockAdded) => {
|
|
240
|
-
return listBlockAdded
|
|
241
|
-
.filter(({ name }) => [
|
|
242
|
-
LEADGEN_BLOCK.PhoneBlock,
|
|
243
|
-
LEADGEN_BLOCK.PhoneOtpBlock,
|
|
244
|
-
LEADGEN_BLOCK.WhatsappOtpBlock,
|
|
245
|
-
LEADGEN_BLOCK.ZaloOtpBlock,
|
|
246
|
-
].includes(name))
|
|
247
|
-
.map(({ data }) => data.value);
|
|
248
|
-
};
|
|
249
212
|
const SSO_MAP_LEAD = ['name', 'email', 'birthday', 'phone', 'gender'];
|
|
250
|
-
const LEAD_LOCALE_DATA = {
|
|
251
|
-
'vi-VN': {
|
|
252
|
-
popupLang: 'vi',
|
|
253
|
-
countryCode: 'vn',
|
|
254
|
-
countryCodeNumber: 84,
|
|
255
|
-
},
|
|
256
|
-
'id-ID': {
|
|
257
|
-
popupLang: 'id',
|
|
258
|
-
countryCode: 'id',
|
|
259
|
-
countryCodeNumber: 62,
|
|
260
|
-
},
|
|
261
|
-
'th-TH': {
|
|
262
|
-
popupLang: 'th',
|
|
263
|
-
countryCode: 'th',
|
|
264
|
-
countryCodeNumber: 66,
|
|
265
|
-
},
|
|
266
|
-
'ms-MY': {
|
|
267
|
-
popupLang: 'ms',
|
|
268
|
-
countryCode: 'my',
|
|
269
|
-
countryCodeNumber: 60,
|
|
270
|
-
},
|
|
271
|
-
'zh-TW': {
|
|
272
|
-
popupLang: 'zh',
|
|
273
|
-
countryCode: 'tw',
|
|
274
|
-
countryCodeNumber: 886,
|
|
275
|
-
},
|
|
276
|
-
'km-KH': {
|
|
277
|
-
popupLang: 'km',
|
|
278
|
-
countryCode: 'kh',
|
|
279
|
-
countryCodeNumber: 855,
|
|
280
|
-
},
|
|
281
|
-
'my-MM': {
|
|
282
|
-
popupLang: 'my',
|
|
283
|
-
countryCode: 'mm',
|
|
284
|
-
countryCodeNumber: 95,
|
|
285
|
-
},
|
|
286
|
-
'hi-IN': {
|
|
287
|
-
popupLang: 'hi',
|
|
288
|
-
countryCode: 'in',
|
|
289
|
-
countryCodeNumber: 91,
|
|
290
|
-
},
|
|
291
|
-
};
|
|
292
213
|
const mappingSSOToLead = (userInfoProps) => {
|
|
293
214
|
var _a, _b;
|
|
294
215
|
try {
|
|
@@ -304,7 +225,7 @@ const mappingSSOToLead = (userInfoProps) => {
|
|
|
304
225
|
if (ssoKey === 'birthday') {
|
|
305
226
|
const dob = dayjs__default["default"](initValue, 'YYYY-MM-DD', true);
|
|
306
227
|
if (dob.isValid()) {
|
|
307
|
-
user.birthday = dob
|
|
228
|
+
user.birthday = dob;
|
|
308
229
|
}
|
|
309
230
|
}
|
|
310
231
|
else if (ssoKey === 'gender') {
|
|
@@ -327,66 +248,16 @@ const mappingSSOToLead = (userInfoProps) => {
|
|
|
327
248
|
catch (error) {
|
|
328
249
|
return;
|
|
329
250
|
}
|
|
330
|
-
};
|
|
331
|
-
const formatCampaignDetail = (campaign) => {
|
|
332
|
-
if (!campaign) {
|
|
333
|
-
return {};
|
|
334
|
-
}
|
|
335
|
-
try {
|
|
336
|
-
const { extra_fields, thank_you_image } = campaign || {};
|
|
337
|
-
const { textBlocks: exTextBlocks, imageBlocks: exImageBlocks, listBlockAdded: exListBlockAdded, listBlockThankyou: exListBlockThankyou, actionBlocks: exActionBlocks, } = extra_fields;
|
|
338
|
-
const textBlocks = JSON.parse(exTextBlocks);
|
|
339
|
-
const imageBlocks = JSON.parse(exImageBlocks);
|
|
340
|
-
const listBlockAdded = JSON.parse(exListBlockAdded);
|
|
341
|
-
const listBlockThankyou = JSON.parse(exListBlockThankyou);
|
|
342
|
-
const actionBlocks = JSON.parse(exActionBlocks);
|
|
343
|
-
const ThankYouBlock = {
|
|
344
|
-
image: { src: thank_you_image },
|
|
345
|
-
};
|
|
346
|
-
listBlockThankyou.forEach((block) => {
|
|
347
|
-
const { name, data } = block || {};
|
|
348
|
-
const { value: htmlText, align, newtab, url } = data || {};
|
|
349
|
-
switch (name) {
|
|
350
|
-
case LEADGEN_BLOCK.TitleBlock: {
|
|
351
|
-
ThankYouBlock.title = { htmlText, align };
|
|
352
|
-
}
|
|
353
|
-
case LEADGEN_BLOCK.SubtitleBlock: {
|
|
354
|
-
ThankYouBlock.description = { htmlText, align };
|
|
355
|
-
}
|
|
356
|
-
case LEADGEN_BLOCK.LinkButtonBlock: {
|
|
357
|
-
ThankYouBlock.button = { htmlText, newtab, url };
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
});
|
|
361
|
-
return Object.assign(Object.assign({}, campaign), { extra_fields: Object.assign(Object.assign({}, extra_fields), { textBlocks,
|
|
362
|
-
imageBlocks,
|
|
363
|
-
listBlockAdded,
|
|
364
|
-
listBlockThankyou,
|
|
365
|
-
actionBlocks }), ThankYouBlock });
|
|
366
|
-
}
|
|
367
|
-
catch (error) {
|
|
368
|
-
return {};
|
|
369
|
-
}
|
|
370
251
|
};
|
|
371
252
|
|
|
372
253
|
class Store {
|
|
373
254
|
constructor() {
|
|
374
|
-
this.apiSsoUrl = 'https://staging-id.hellobacsi.com/';
|
|
375
255
|
this.apiLeadUrl = 'https://dev.leadgen.hellobacsi.com/';
|
|
376
256
|
this.apiSubotUrl = 'https://staging-service-subot.hellohealthgroup.com/';
|
|
377
257
|
}
|
|
378
258
|
}
|
|
379
259
|
const leadStore = new Store();
|
|
380
260
|
|
|
381
|
-
const LEADGEN_API_METHOD = {
|
|
382
|
-
GET: 'get',
|
|
383
|
-
POST: 'POST',
|
|
384
|
-
};
|
|
385
|
-
const LEADGEN_API_PATH = {
|
|
386
|
-
V2_CAMPAIGN: 'api/v2/campaign',
|
|
387
|
-
V2_SUBSCRIPTION_LEAD: 'api/v2/subscription-box',
|
|
388
|
-
V2_SUBSCRIPTION_INFO: 'api/campaign/get-title',
|
|
389
|
-
};
|
|
390
261
|
const leadApi = {
|
|
391
262
|
call(_a) {
|
|
392
263
|
var { url, data = undefined } = _a, config = tslib_es6.__rest(_a, ["url", "data"]);
|
|
@@ -490,50 +361,8 @@ const verifyOtpLead = ({ phone, otp, type, }) => {
|
|
|
490
361
|
},
|
|
491
362
|
});
|
|
492
363
|
};
|
|
493
|
-
const getCampaignByCode = (campaign_code) => {
|
|
494
|
-
return leadApi.call({
|
|
495
|
-
url: `${LEADGEN_API_PATH.V2_CAMPAIGN}/${campaign_code}`,
|
|
496
|
-
method: LEADGEN_API_METHOD.GET,
|
|
497
|
-
});
|
|
498
|
-
};
|
|
499
|
-
const getSubscriptionBoxInfo = ({ category, site, }) => {
|
|
500
|
-
return leadApi.call({
|
|
501
|
-
url: `${LEADGEN_API_PATH.V2_SUBSCRIPTION_INFO}?category=${category}&site=${site}`,
|
|
502
|
-
method: LEADGEN_API_METHOD.GET,
|
|
503
|
-
});
|
|
504
|
-
};
|
|
505
|
-
const postSubscriptionBoxLead = ({ data }) => {
|
|
506
|
-
return leadApi.call({
|
|
507
|
-
url: LEADGEN_API_PATH.V2_SUBSCRIPTION_LEAD,
|
|
508
|
-
method: LEADGEN_API_METHOD.POST,
|
|
509
|
-
data,
|
|
510
|
-
});
|
|
511
|
-
};
|
|
512
|
-
const postUserInfoFromLeadGen = ({}) => {
|
|
513
|
-
return;
|
|
514
|
-
};
|
|
515
|
-
const campaignPostImpression = ({ code, action, title_article, ga_client_id, cookie_id, extra, url, referrer, }) => {
|
|
516
|
-
return leadApi.call({
|
|
517
|
-
url: `api/campaign/${code}/impression`,
|
|
518
|
-
method: LEADGEN_API_METHOD.POST,
|
|
519
|
-
data: {
|
|
520
|
-
action,
|
|
521
|
-
title_article,
|
|
522
|
-
cookie_id,
|
|
523
|
-
ga_client_id,
|
|
524
|
-
url,
|
|
525
|
-
extra,
|
|
526
|
-
referrer,
|
|
527
|
-
},
|
|
528
|
-
});
|
|
529
|
-
};
|
|
530
364
|
const Service = {
|
|
531
365
|
campaignGetById,
|
|
532
|
-
getCampaignByCode,
|
|
533
|
-
getSubscriptionBoxInfo,
|
|
534
|
-
postSubscriptionBoxLead,
|
|
535
|
-
postUserInfoFromLeadGen,
|
|
536
|
-
campaignPostImpression,
|
|
537
366
|
validateEmailOrPhoneOnSubot,
|
|
538
367
|
validateEmailOrPhoneOnLeadGen,
|
|
539
368
|
validatePhoneNumberOnLeadGen,
|
|
@@ -873,7 +702,7 @@ const Description = (_a) => {
|
|
|
873
702
|
return description ? (React__default["default"].createElement(index$1.Text, Object.assign({ size: "p3" }, rest), description)) : null;
|
|
874
703
|
};
|
|
875
704
|
|
|
876
|
-
const LeadGenContext
|
|
705
|
+
const LeadGenContext = React.createContext({});
|
|
877
706
|
|
|
878
707
|
var useStyles$2 = core.createStyles(() => {
|
|
879
708
|
return {
|
|
@@ -937,7 +766,7 @@ const SubtitleBlock$1 = ({ children, align, }) => (React__default["default"].cre
|
|
|
937
766
|
const TitleBlock$1 = ({ children, align, }) => (React__default["default"].createElement("h2", { className: `lead-modal__title ${'le-text-align-' + (align || '')} ${LEAD_CLASS}` }, children));
|
|
938
767
|
|
|
939
768
|
const Fields = ({ listBlockAdded, popupId, locale, onClose, onOtherSubmit, styles, classNames, popoverProps, }) => {
|
|
940
|
-
const { primaryColor } = React.useContext(LeadGenContext
|
|
769
|
+
const { primaryColor } = React.useContext(LeadGenContext);
|
|
941
770
|
const { classes, cx } = useStyles$2(undefined, {
|
|
942
771
|
name: 'LeadGen__Field',
|
|
943
772
|
styles,
|
|
@@ -1052,7 +881,7 @@ const Heading = (_a) => {
|
|
|
1052
881
|
|
|
1053
882
|
const FormComponent = ({ styles, className, classNames, fillInfo, popoverProps, submitProps, }) => {
|
|
1054
883
|
var _a;
|
|
1055
|
-
const { primaryColor } = React.useContext(LeadGenContext
|
|
884
|
+
const { primaryColor } = React.useContext(LeadGenContext);
|
|
1056
885
|
const { listBlockAdded, leadFormConfig: { form, validateObj }, validatingEmailRef, validatingPhoneRef, formRef, setFormRef, onClose, onOtherSubmit, actionBlocks, locale, setShowOtpPhone, onSubmit, } = React.useContext(LeadGenComponentContext);
|
|
1057
886
|
const { classes, cx } = useStyles$1(undefined, {
|
|
1058
887
|
name: 'LeadGen__FormComponent',
|
|
@@ -1329,7 +1158,6 @@ var enPH = {
|
|
|
1329
1158
|
"validator.min": "jQuery.validator.format('Please enter a value greater than or equal to {0}.",
|
|
1330
1159
|
"validator.emailUsed": "Email already in use for this campaign.",
|
|
1331
1160
|
"validator.phoneUsed": "Your phone number already in use for this campaign.",
|
|
1332
|
-
"validator.dateInvalid": "This date is not valid, please update.",
|
|
1333
1161
|
"lead.otp.title": "Enter OTP",
|
|
1334
1162
|
"lead.otp.desc": "We have sent an OTP to your mobile number {phone}",
|
|
1335
1163
|
"lead.otp.verify": "Verify",
|
|
@@ -1338,10 +1166,7 @@ var enPH = {
|
|
|
1338
1166
|
"lead.otp.phonePlaceholder": "Enter OTP",
|
|
1339
1167
|
"lead.empty.title": "Oops, seem your information is empty, do you want to submit the information again?",
|
|
1340
1168
|
"lead.empty.cancel": "Cancel",
|
|
1341
|
-
"lead.empty.submitAgain": "Submit again"
|
|
1342
|
-
"common.day": "Day",
|
|
1343
|
-
"common.month": "Month",
|
|
1344
|
-
"common.year": "Year"
|
|
1169
|
+
"lead.empty.submitAgain": "Submit again"
|
|
1345
1170
|
};
|
|
1346
1171
|
|
|
1347
1172
|
var hiIN = {
|
|
@@ -1352,7 +1177,6 @@ var hiIN = {
|
|
|
1352
1177
|
"validator.maxlength": "कृपया {0} अक्षर से अधिक दर्ज न करें",
|
|
1353
1178
|
"validator.minlength": "कृपया कम से कम {0} अक्षर दर्ज करें",
|
|
1354
1179
|
"validator.phone": "कृपया एक वैध संख्या दर्ज करें",
|
|
1355
|
-
"validator.dateInvalid": "यह तिथि मान्य नहीं है, कृपया अपडेट करें।",
|
|
1356
1180
|
"validator.emailUsed": "Email already in use for this campaign.",
|
|
1357
1181
|
"validator.phoneUsed": "Your phone number already in use for this campaign.",
|
|
1358
1182
|
"lead.otp.title": "Enter OTP",
|
|
@@ -1361,10 +1185,7 @@ var hiIN = {
|
|
|
1361
1185
|
"lead.otp.resend": "Resend OTP{timer}",
|
|
1362
1186
|
"lead.empty.title": "ऊप्स! लगता है आपकी जानकारी खाली है। क्या आप जानकारी फिर से सबमिट करना चाहते हैं?",
|
|
1363
1187
|
"lead.empty.cancel": "रद्द करें",
|
|
1364
|
-
"lead.empty.submitAgain": "फिर से सबमिट करें"
|
|
1365
|
-
"common.day": "साल",
|
|
1366
|
-
"common.month": "महीना",
|
|
1367
|
-
"common.year": ""
|
|
1188
|
+
"lead.empty.submitAgain": "फिर से सबमिट करें"
|
|
1368
1189
|
};
|
|
1369
1190
|
|
|
1370
1191
|
var idID = {
|
|
@@ -1377,7 +1198,6 @@ var idID = {
|
|
|
1377
1198
|
"validator.phone": "Tolong daftarkan nomor telepon yang valid",
|
|
1378
1199
|
"validator.emailUsed": "Email sudah digunakan untuk kampanye ini.",
|
|
1379
1200
|
"validator.phoneUsed": "Nomor telepon Anda sudah digunakan untuk kampanye ini.",
|
|
1380
|
-
"validator.dateInvalid": "Tanggal ini tidak valid, silakan perbarui",
|
|
1381
1201
|
"lead.otp.title": "Masukkan OTP",
|
|
1382
1202
|
"lead.otp.desc": "Kami telah mengirimkan OTP ke nomor ponsel Anda {phone}",
|
|
1383
1203
|
"lead.otp.verify": "Verifikasi",
|
|
@@ -1386,10 +1206,7 @@ var idID = {
|
|
|
1386
1206
|
"lead.otp.phonePlaceholder": "Masukkan OTP",
|
|
1387
1207
|
"lead.empty.title": "Oops, sepertinya informasi Anda kosong. Apakah Anda ingin mengirimkan informasi lagi?",
|
|
1388
1208
|
"lead.empty.cancel": "Batal",
|
|
1389
|
-
"lead.empty.submitAgain": "Kirim lagi"
|
|
1390
|
-
"common.day": "Hari",
|
|
1391
|
-
"common.month": "Bulan",
|
|
1392
|
-
"common.year": "Tahun"
|
|
1209
|
+
"lead.empty.submitAgain": "Kirim lagi"
|
|
1393
1210
|
};
|
|
1394
1211
|
|
|
1395
1212
|
var kmKH = {
|
|
@@ -1402,7 +1219,6 @@ var kmKH = {
|
|
|
1402
1219
|
"validator.phone": "សូមវាយបញ្ចូលលេខឲ្យបានត្រឹមត្រូវ",
|
|
1403
1220
|
"validator.emailUsed": "អ៊ីមែលត្រូវបានប្រើប្រាស់សម្រាប់យុទ្ធនាការនេះរួចហើយ។",
|
|
1404
1221
|
"validator.phoneUsed": "លេខទូរស័ព្ទរបស់អ្នកត្រូវបានប្រើប្រាស់សម្រាប់យុទ្ធនាការនេះរួចហើយ។",
|
|
1405
|
-
"validator.dateInvalid": "កាលបរិច្ឆេទនេះមិនត្រឹមត្រូវទេ សូមធ្វើបច្ចុប្បន្នភាព។",
|
|
1406
1222
|
"lead.otp.title": "បញ្ចូល OTP",
|
|
1407
1223
|
"lead.otp.desc": "យើងបានផ្ញើ OTP ទៅកាន់លេខទូរសព្ទរបស់អ្នក {phone}",
|
|
1408
1224
|
"lead.otp.verify": "ផ្ទៀងផ្ទាត់",
|
|
@@ -1411,10 +1227,7 @@ var kmKH = {
|
|
|
1411
1227
|
"lead.otp.phonePlaceholder": "បញ្ចូល OTP",
|
|
1412
1228
|
"lead.empty.title": "អូុបស! ហាក់ដូចជាព័ត៌មានរបស់អ្នកទទេ។ តើអ្នកចង់ដាក់ស្នើព័ត៌មានម្តងទៀតទេ?",
|
|
1413
1229
|
"lead.empty.cancel": "លុបចោល",
|
|
1414
|
-
"lead.empty.submitAgain": "ដាក់ស្នើម្ដងទៀត"
|
|
1415
|
-
"common.day": "ឆ្នាំ",
|
|
1416
|
-
"common.month": "ខែ",
|
|
1417
|
-
"common.year": "ថ្ងៃ"
|
|
1230
|
+
"lead.empty.submitAgain": "ដាក់ស្នើម្ដងទៀត"
|
|
1418
1231
|
};
|
|
1419
1232
|
|
|
1420
1233
|
var msMY = {
|
|
@@ -1427,7 +1240,6 @@ var msMY = {
|
|
|
1427
1240
|
"validator.phone": "Sila masukkan no telefon yang sah.",
|
|
1428
1241
|
"validator.emailUsed": "Emel sudah digunakan untuk kempen ini.",
|
|
1429
1242
|
"validator.phoneUsed": "Nombor telefon anda sudah digunakan untuk kempen ini.",
|
|
1430
|
-
"validator.dateInvalid": "Tarikh ini tidak sah, sila kemas kini",
|
|
1431
1243
|
"lead.otp.title": "Masukkan OTP",
|
|
1432
1244
|
"lead.otp.desc": "Kami telah menghantar OTP ke nombor telefon bimbit anda {phone}",
|
|
1433
1245
|
"lead.otp.verify": "Sahkan",
|
|
@@ -1436,10 +1248,7 @@ var msMY = {
|
|
|
1436
1248
|
"lead.otp.phonePlaceholder": "Masukkan OTP",
|
|
1437
1249
|
"lead.empty.title": "Oops, nampaknya maklumat anda kosong. Adakah anda ingin menghantar maklumat semula?",
|
|
1438
1250
|
"lead.empty.cancel": "Batal",
|
|
1439
|
-
"lead.empty.submitAgain": "Hantar semula"
|
|
1440
|
-
"common.day": "Hari",
|
|
1441
|
-
"common.month": "Bulan",
|
|
1442
|
-
"common.year": "Tahun"
|
|
1251
|
+
"lead.empty.submitAgain": "Hantar semula"
|
|
1443
1252
|
};
|
|
1444
1253
|
|
|
1445
1254
|
var myMM = {
|
|
@@ -1452,7 +1261,6 @@ var myMM = {
|
|
|
1452
1261
|
"validator.phone": "မှန်ကန်သော ဖုန်းနံပါတ်ထည့်သွင်းပါ",
|
|
1453
1262
|
"validator.emailUsed": "ဤအေကာင့်အတွက် အီးမေးလ်ကို အသုံးပြုပြီးဖြစ်ပါသည်။",
|
|
1454
1263
|
"validator.phoneUsed": "ဤအေကာင့်အတွက် သင့်ဖုန်းနံပါတ်ကို အသုံးပြုပြီးဖြစ်ပါသည်။",
|
|
1455
|
-
"validator.dateInvalid": "ယနေ့စွဲမှားနေသည်၊ ကျေးဇူးပြု၍ ပြင်ဆင်ပါ။",
|
|
1456
1264
|
"lead.otp.title": "OTP ကိုထည့်ပါ",
|
|
1457
1265
|
"lead.otp.desc": "ကျွန်ုပ်တို့သည် OTP ကိုသင့်ဖုန်းနံပါတ် {phone} သို့ပို့ခဲ့သည်",
|
|
1458
1266
|
"lead.otp.verify": "အတည်ပြုပါ",
|
|
@@ -1461,10 +1269,7 @@ var myMM = {
|
|
|
1461
1269
|
"lead.otp.phonePlaceholder": "OTP ကိုထည့်ပါ",
|
|
1462
1270
|
"lead.empty.title": "အုပ်စ်! သင့်အချက်အလက်သည် ဗလာဖြစ်နေသလိုဖြစ်သည်။ ထပ်မံတင်သွင်းလိုပါသလား?",
|
|
1463
1271
|
"lead.empty.cancel": "မလုပ်ဆောင်ပါ",
|
|
1464
|
-
"lead.empty.submitAgain": "ထပ်မံတင်သွင်းပါ"
|
|
1465
|
-
"common.day": "ရက်",
|
|
1466
|
-
"common.month": "လ",
|
|
1467
|
-
"common.year": "နှစ်"
|
|
1272
|
+
"lead.empty.submitAgain": "ထပ်မံတင်သွင်းပါ"
|
|
1468
1273
|
};
|
|
1469
1274
|
|
|
1470
1275
|
var thTH = {
|
|
@@ -1477,7 +1282,6 @@ var thTH = {
|
|
|
1477
1282
|
"validator.phone": "กรุณาใส่ตัวเลขที่ถูกต้อง",
|
|
1478
1283
|
"validator.emailUsed": "อีเมลนี้ถูกใช้สำหรับแคมเปญนี้แล้ว",
|
|
1479
1284
|
"validator.phoneUsed": "หมายเลขโทรศัพท์ของคุณถูกใช้สำหรับแคมเปญนี้แล้ว",
|
|
1480
|
-
"validator.dateInvalid": "วันที่นี้ไม่ถูกต้อง โปรดอัปเดต",
|
|
1481
1285
|
"lead.otp.title": "ป้อน OTP",
|
|
1482
1286
|
"lead.otp.desc": "เราได้ส่ง OTP ไปยังหมายเลขโทรศัพท์มือถือของคุณ {phone}",
|
|
1483
1287
|
"lead.otp.verify": "ยืนยัน",
|
|
@@ -1486,10 +1290,7 @@ var thTH = {
|
|
|
1486
1290
|
"lead.otp.phonePlaceholder": "ป้อน OTP",
|
|
1487
1291
|
"lead.empty.title": "อุ๊ปส์! ดูเหมือนว่าข้อมูลของคุณว่างเปล่า คุณต้องการส่งข้อมูลอีกครั้งหรือไม่?",
|
|
1488
1292
|
"lead.empty.cancel": "ยกเลิก",
|
|
1489
|
-
"lead.empty.submitAgain": "ส่งอีกครั้ง"
|
|
1490
|
-
"common.day": "วัน",
|
|
1491
|
-
"common.month": "เดือน",
|
|
1492
|
-
"common.year": "ปี"
|
|
1293
|
+
"lead.empty.submitAgain": "ส่งอีกครั้ง"
|
|
1493
1294
|
};
|
|
1494
1295
|
|
|
1495
1296
|
var viVN = {
|
|
@@ -1513,7 +1314,6 @@ var viVN = {
|
|
|
1513
1314
|
"validator.phone": "Nhập đúng định dạng số điện thoại",
|
|
1514
1315
|
"validator.emailUsed": "Email này đã được sử dụng.",
|
|
1515
1316
|
"validator.phoneUsed": "Số điện thoại này đã được sử dụng.",
|
|
1516
|
-
"validator.dateInvalid": "Ngày này không hợp lệ, vui lòng cập nhật.",
|
|
1517
1317
|
"lead.otp.title": "Nhập OTP",
|
|
1518
1318
|
"lead.otp.desc": "Chúng tôi đã gửi OTP đến số điện thoại của bạn {phone}",
|
|
1519
1319
|
"lead.otp.verify": "Xác minh",
|
|
@@ -1522,10 +1322,7 @@ var viVN = {
|
|
|
1522
1322
|
"lead.otp.phonePlaceholder": "Nhập OTP",
|
|
1523
1323
|
"lead.empty.title": "Oops, có vẻ như thông tin của bạn đang trống. Bạn có muốn gửi lại thông tin không?",
|
|
1524
1324
|
"lead.empty.cancel": "Hủy",
|
|
1525
|
-
"lead.empty.submitAgain": "Gửi lại"
|
|
1526
|
-
"common.day": "Ngày",
|
|
1527
|
-
"common.month": "Tháng",
|
|
1528
|
-
"common.year": "Năm"
|
|
1325
|
+
"lead.empty.submitAgain": "Gửi lại"
|
|
1529
1326
|
};
|
|
1530
1327
|
|
|
1531
1328
|
var zhTW = {
|
|
@@ -1538,7 +1335,6 @@ var zhTW = {
|
|
|
1538
1335
|
"validator.phone": "請填入有效的電話號碼",
|
|
1539
1336
|
"validator.emailUsed": "此電子郵件已被使用於此活動。",
|
|
1540
1337
|
"validator.phoneUsed": "您的手機號碼已被使用於此活動。",
|
|
1541
|
-
"validator.dateInvalid": "此日期無效,請更新.",
|
|
1542
1338
|
"lead.otp.title": "輸入 OTP",
|
|
1543
1339
|
"lead.otp.desc": "我們已將 OTP 發送到您的手機號碼 {phone}",
|
|
1544
1340
|
"lead.otp.verify": "驗證",
|
|
@@ -1547,10 +1343,7 @@ var zhTW = {
|
|
|
1547
1343
|
"lead.otp.phonePlaceholder": "輸入 OTP",
|
|
1548
1344
|
"lead.empty.title": "哎呀,您的資訊似乎是空的,您想要重新提交資訊嗎?",
|
|
1549
1345
|
"lead.empty.cancel": "取消",
|
|
1550
|
-
"lead.empty.submitAgain": "重新提交"
|
|
1551
|
-
"common.day": "日",
|
|
1552
|
-
"common.month": "月",
|
|
1553
|
-
"common.year": "年"
|
|
1346
|
+
"lead.empty.submitAgain": "重新提交"
|
|
1554
1347
|
};
|
|
1555
1348
|
|
|
1556
1349
|
const translationsMap = {
|
|
@@ -1562,1599 +1355,73 @@ const translationsMap = {
|
|
|
1562
1355
|
'my-MM': myMM,
|
|
1563
1356
|
'km-KH': kmKH,
|
|
1564
1357
|
'zh-TW': zhTW,
|
|
1565
|
-
'zh-CN': zhTW,
|
|
1566
1358
|
'th-TH': thTH,
|
|
1567
1359
|
'tl-PH': enPH,
|
|
1568
1360
|
};
|
|
1569
1361
|
const getTranslations = (locale) => {
|
|
1570
|
-
const translations =
|
|
1362
|
+
const translations = translationsMap[locale];
|
|
1571
1363
|
if (translations) {
|
|
1572
1364
|
return translations;
|
|
1573
1365
|
}
|
|
1574
1366
|
return translationsMap['en-PH'];
|
|
1575
1367
|
};
|
|
1576
1368
|
|
|
1577
|
-
const
|
|
1578
|
-
const
|
|
1579
|
-
const
|
|
1580
|
-
|
|
1369
|
+
const useImageSize = (src) => {
|
|
1370
|
+
const [width, setWidth] = React.useState(16);
|
|
1371
|
+
const [height, setHeight] = React.useState(9);
|
|
1372
|
+
const [loaded, setLoaded] = React.useState(false);
|
|
1373
|
+
// load src image to get its width and height
|
|
1374
|
+
React.useEffect(() => {
|
|
1375
|
+
setLoaded(false);
|
|
1376
|
+
if (src) {
|
|
1377
|
+
const img = new Image();
|
|
1378
|
+
img.addEventListener('load', () => {
|
|
1379
|
+
setWidth(img.naturalWidth);
|
|
1380
|
+
setHeight(img.naturalHeight);
|
|
1381
|
+
setLoaded(true);
|
|
1382
|
+
});
|
|
1383
|
+
img.addEventListener('error', () => {
|
|
1384
|
+
setWidth(16);
|
|
1385
|
+
setHeight(9);
|
|
1386
|
+
setLoaded(true);
|
|
1387
|
+
});
|
|
1388
|
+
img.src = src;
|
|
1389
|
+
}
|
|
1390
|
+
else {
|
|
1391
|
+
setWidth(16);
|
|
1392
|
+
setHeight(9);
|
|
1393
|
+
setLoaded(true);
|
|
1394
|
+
}
|
|
1395
|
+
}, [src]);
|
|
1396
|
+
return {
|
|
1397
|
+
loaded,
|
|
1398
|
+
width,
|
|
1399
|
+
height,
|
|
1400
|
+
};
|
|
1581
1401
|
};
|
|
1582
1402
|
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
}
|
|
1593
|
-
const
|
|
1594
|
-
|
|
1595
|
-
for (let i = newArray.length - 1; i > 0; i--) {
|
|
1596
|
-
const j = Math.floor(Math.random() * (i + 1));
|
|
1597
|
-
const temp = newArray[i];
|
|
1598
|
-
newArray[i] = newArray[j];
|
|
1599
|
-
newArray[j] = temp;
|
|
1600
|
-
}
|
|
1601
|
-
return newArray;
|
|
1602
|
-
};
|
|
1603
|
-
const getTimeByTimezone = (timeZone = 'UTC') => {
|
|
1604
|
-
const date = new Date();
|
|
1605
|
-
return new Date(date.toLocaleString('en-US', { timeZone }));
|
|
1606
|
-
};
|
|
1607
|
-
const parseDateByCampaignTime = (dateStr) => {
|
|
1608
|
-
// Format like this: 2023-04-04 00:00:00
|
|
1609
|
-
try {
|
|
1610
|
-
const [datePart, timePart] = dateStr.split(' ');
|
|
1611
|
-
const [year, month, day] = datePart.split('-').map(Number);
|
|
1612
|
-
const [hours, minutes, seconds] = timePart.split(':').map(Number);
|
|
1613
|
-
/** JavaScript counts months from 0 to 11 */
|
|
1614
|
-
return new Date(year, month - 1, day, hours, minutes, seconds);
|
|
1615
|
-
}
|
|
1616
|
-
catch (err) {
|
|
1617
|
-
return null;
|
|
1618
|
-
}
|
|
1619
|
-
};
|
|
1620
|
-
const checkCampaignNowInTimeframe = (c) => {
|
|
1621
|
-
var _a;
|
|
1622
|
-
const siteId = ((_a = c.site) === null || _a === void 0 ? void 0 : _a.id) || 1;
|
|
1623
|
-
const startedAtStr = c.started_at;
|
|
1624
|
-
const endedAtStr = c.ended_at;
|
|
1625
|
-
const startedDate = parseDateByCampaignTime(startedAtStr);
|
|
1626
|
-
const endedDate = parseDateByCampaignTime(endedAtStr);
|
|
1627
|
-
if (!startedDate || !endedDate) {
|
|
1628
|
-
return false;
|
|
1629
|
-
}
|
|
1630
|
-
const timeZone = LEAD_TIMEZONE_DATA[siteId];
|
|
1631
|
-
const nowWithTimezoneMs = getTimeByTimezone(timeZone).getTime();
|
|
1632
|
-
if (nowWithTimezoneMs <= endedDate.getTime() &&
|
|
1633
|
-
nowWithTimezoneMs >= startedDate.getTime()) {
|
|
1634
|
-
listCampaignScheduledToActivated.push(c);
|
|
1635
|
-
return true;
|
|
1636
|
-
}
|
|
1637
|
-
return false;
|
|
1638
|
-
};
|
|
1639
|
-
function checkCampaignActiveButExpireAlready(c) {
|
|
1640
|
-
var _a;
|
|
1641
|
-
/** Do not setup timeframe for this campaign. No need to check */
|
|
1642
|
-
if (c.forever === 1) {
|
|
1643
|
-
return true;
|
|
1644
|
-
}
|
|
1645
|
-
const startedAtStr = c.started_at;
|
|
1646
|
-
const endedAtStr = c.ended_at;
|
|
1647
|
-
const startedDate = parseDateByCampaignTime(startedAtStr);
|
|
1648
|
-
const endedDate = parseDateByCampaignTime(endedAtStr);
|
|
1649
|
-
/** Do not setup timeframe for this campaign. No need to check */
|
|
1650
|
-
if (!startedDate || !endedDate) {
|
|
1651
|
-
return true;
|
|
1652
|
-
}
|
|
1653
|
-
const siteId = ((_a = c.site) === null || _a === void 0 ? void 0 : _a.id) || 1;
|
|
1654
|
-
const timeZone = LEAD_TIMEZONE_DATA[siteId];
|
|
1655
|
-
const nowWithTimezoneMs = getTimeByTimezone(timeZone).getTime();
|
|
1656
|
-
/** Check if this expire already, do not show */
|
|
1657
|
-
if (nowWithTimezoneMs > endedDate.getTime()) {
|
|
1658
|
-
listCampaignActiveButExpired.push(c);
|
|
1659
|
-
return false;
|
|
1660
|
-
}
|
|
1661
|
-
return true;
|
|
1662
|
-
}
|
|
1663
|
-
function shouldNotDisplayIfExcludeAllSponsors(c) {
|
|
1664
|
-
var _a;
|
|
1665
|
-
const excludeSponsored = Number((_a = c.rules.find((i) => i.rule == 'exclude_sponsored')) === null || _a === void 0 ? void 0 : _a.value);
|
|
1666
|
-
const isSponsored = Boolean(document.querySelector('.hhg-disclaimer-text'));
|
|
1667
|
-
if (isSponsored && excludeSponsored) {
|
|
1668
|
-
listCampaignExcludeSonsored.push(c);
|
|
1669
|
-
return true;
|
|
1670
|
-
}
|
|
1671
|
-
return false;
|
|
1672
|
-
}
|
|
1673
|
-
function shouldDisplayWithCurrentSponsor(c) {
|
|
1674
|
-
var _a, _b;
|
|
1675
|
-
try {
|
|
1676
|
-
// TODO: BE will rename `exclude_sponsored_list` later
|
|
1677
|
-
const stringOrArray = (_a = c.rules.find((i) => i.rule == 'exclude_sponsored_list')) === null || _a === void 0 ? void 0 : _a.value;
|
|
1678
|
-
const whiteListSponsors = stringOrArray instanceof Array ? stringOrArray : JSON.parse(stringOrArray);
|
|
1679
|
-
const dataSponsoredId = Number((_b = document
|
|
1680
|
-
.querySelector('[data-sponsored-id]')) === null || _b === void 0 ? void 0 : _b.getAttribute('data-sponsored-id'));
|
|
1681
|
-
// There is no config for sponsor id and white list, should show as default
|
|
1682
|
-
if (!dataSponsoredId ||
|
|
1683
|
-
dataSponsoredId <= 0 ||
|
|
1684
|
-
whiteListSponsors.length === 0) {
|
|
1685
|
-
return true;
|
|
1686
|
-
}
|
|
1687
|
-
// Check the dataSponsoredId exists in the white list or not.
|
|
1688
|
-
const isExist = whiteListSponsors.find((s) => s.id == dataSponsoredId);
|
|
1689
|
-
if (isExist) {
|
|
1690
|
-
return true;
|
|
1691
|
-
}
|
|
1692
|
-
listCampaignDifferentSponsor.push({ id: c.id, rules: c.rules });
|
|
1693
|
-
return false;
|
|
1694
|
-
}
|
|
1695
|
-
catch (err) {
|
|
1696
|
-
// Default is show
|
|
1697
|
-
return true;
|
|
1698
|
-
}
|
|
1699
|
-
}
|
|
1700
|
-
const filterFnCampaign = (c) => {
|
|
1701
|
-
if (shouldNotDisplayIfExcludeAllSponsors(c)) {
|
|
1702
|
-
return false;
|
|
1703
|
-
}
|
|
1704
|
-
else if (!shouldDisplayWithCurrentSponsor(c)) {
|
|
1705
|
-
return false;
|
|
1706
|
-
}
|
|
1707
|
-
/** Active */
|
|
1708
|
-
if (c.formatted_status === 1) {
|
|
1709
|
-
return checkCampaignActiveButExpireAlready(c);
|
|
1710
|
-
}
|
|
1711
|
-
/** Schedule */
|
|
1712
|
-
if (c.formatted_status === 0) {
|
|
1713
|
-
listCampaignScheduled.push(c);
|
|
1714
|
-
return checkCampaignNowInTimeframe(c);
|
|
1715
|
-
}
|
|
1716
|
-
return false;
|
|
1717
|
-
};
|
|
1718
|
-
const fillterApprearanceTimeCampaign = (c) => {
|
|
1719
|
-
var _a;
|
|
1720
|
-
try {
|
|
1721
|
-
const isTimeInRange = (currentTime, startTime, endTime) => {
|
|
1722
|
-
const startParts = startTime.split(':');
|
|
1723
|
-
const endParts = endTime.split(':');
|
|
1724
|
-
const startDate = new Date();
|
|
1725
|
-
startDate.setHours(Number(startParts[0]), Number(startParts[1]), 0, 0);
|
|
1726
|
-
const endDate = new Date();
|
|
1727
|
-
endDate.setHours(Number(endParts[0]), Number(endParts[1]), 0, 0);
|
|
1728
|
-
return currentTime >= startDate && currentTime <= endDate;
|
|
1729
|
-
};
|
|
1730
|
-
const rulesApprValue = (_a = c.rules.find((i) => i.rule == 'appearance_time')) === null || _a === void 0 ? void 0 : _a.value;
|
|
1731
|
-
const startTime = rulesApprValue.startTime;
|
|
1732
|
-
const endTime = rulesApprValue.endTime || '23:59';
|
|
1733
|
-
if (!startTime) {
|
|
1734
|
-
return true;
|
|
1735
|
-
}
|
|
1736
|
-
if (isTimeInRange(new Date(), startTime, endTime)) {
|
|
1737
|
-
return true;
|
|
1738
|
-
}
|
|
1739
|
-
listCampaignNotDisplayInRangeOfTime.push(c);
|
|
1740
|
-
return false;
|
|
1741
|
-
}
|
|
1742
|
-
catch (err) {
|
|
1743
|
-
return true;
|
|
1744
|
-
}
|
|
1745
|
-
};
|
|
1746
|
-
let timeoutRef = null;
|
|
1747
|
-
let LEAD_SCROLL_EVENT = null;
|
|
1748
|
-
function clearPassiveEvent() {
|
|
1749
|
-
if (timeoutRef) {
|
|
1750
|
-
clearTimeout(timeoutRef);
|
|
1751
|
-
timeoutRef = null;
|
|
1752
|
-
}
|
|
1753
|
-
if (LEAD_SCROLL_EVENT) {
|
|
1754
|
-
window.removeEventListener('scroll', LEAD_SCROLL_EVENT);
|
|
1755
|
-
LEAD_SCROLL_EVENT = null;
|
|
1756
|
-
}
|
|
1757
|
-
}
|
|
1758
|
-
function checkShowPopup({ leadApi, leadSiteId, leadDomain, onShowPopup, DEBUG_URL, }) {
|
|
1759
|
-
// clear previous passive event, check for new condition
|
|
1760
|
-
clearPassiveEvent();
|
|
1761
|
-
const leadCurrentUrl = DEBUG_URL ||
|
|
1762
|
-
('https://' +
|
|
1763
|
-
location.hostname +
|
|
1764
|
-
location.pathname +
|
|
1765
|
-
location.search).toLowerCase();
|
|
1766
|
-
fetch(leadApi + 'api/campaign/' + leadSiteId, {
|
|
1767
|
-
method: 'POST',
|
|
1768
|
-
headers: {
|
|
1769
|
-
'Content-Type': 'application/json',
|
|
1770
|
-
},
|
|
1771
|
-
body: JSON.stringify({
|
|
1772
|
-
url: leadCurrentUrl,
|
|
1773
|
-
ga_client_id: miscCookieHelper.getCookie('_ga') || null,
|
|
1774
|
-
}),
|
|
1775
|
-
})
|
|
1776
|
-
.then((response) => {
|
|
1777
|
-
return response.json();
|
|
1778
|
-
// return mockLeadData || response.json()
|
|
1779
|
-
})
|
|
1780
|
-
.then((data) => {
|
|
1781
|
-
var _a, _b, _c, _d;
|
|
1782
|
-
LeadLog('List campagin: ', data);
|
|
1783
|
-
LEAD_RESET_VAR();
|
|
1784
|
-
if (data._status == 1) {
|
|
1785
|
-
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);
|
|
1786
|
-
if (!miscCookieHelper.getCookie('hhg-id')) {
|
|
1787
|
-
miscCookieHelper.setCookie('hhg-id', uuid.v1(), {
|
|
1788
|
-
domain: '.' + leadDomain,
|
|
1789
|
-
path: '/',
|
|
1790
|
-
});
|
|
1791
|
-
LeadLog('😍 Set HHG ID cookie');
|
|
1792
|
-
}
|
|
1793
|
-
// getCookie('hhg-id')
|
|
1794
|
-
// TODO: HP-534 Filter desktop
|
|
1795
|
-
let campaignsDevice = [];
|
|
1796
|
-
if (isMobile()) {
|
|
1797
|
-
campaignsDevice = campaigns.filter((c) => c.device_types.some((d) => d.id == LEAD_DEVICE_TYPE.MOBILE));
|
|
1798
|
-
}
|
|
1799
|
-
else {
|
|
1800
|
-
campaignsDevice = campaigns.filter((c) => c.device_types.some((d) => d.id == LEAD_DEVICE_TYPE.DESKTOP));
|
|
1801
|
-
}
|
|
1802
|
-
LeadLog(`👓 campaignsDevice`, campaignsDevice);
|
|
1803
|
-
LeadLog('--listCampaignScheduled', listCampaignScheduled);
|
|
1804
|
-
LeadLog('--listCampaignScheduledToActivated', listCampaignScheduledToActivated);
|
|
1805
|
-
LeadLog('--listCampaignActiveButExpired', listCampaignActiveButExpired);
|
|
1806
|
-
LeadLog('--listCampaignExcludeSonsored', listCampaignExcludeSonsored);
|
|
1807
|
-
LeadLog('--listCampaignDifferentSponsor', listCampaignDifferentSponsor);
|
|
1808
|
-
LeadLog('--listCampaignNotDisplayInRangeOfTime', listCampaignNotDisplayInRangeOfTime);
|
|
1809
|
-
// Check links
|
|
1810
|
-
let listLinksObj = campaignsDevice
|
|
1811
|
-
.map((i, index) => i.targets
|
|
1812
|
-
.filter((i) => i.type == CAMPAIGN_TARGET_TYPE.LINKS)
|
|
1813
|
-
.map((i) => (Object.assign(Object.assign({}, i), { campaignIndex: index }))))
|
|
1814
|
-
.flat(1);
|
|
1815
|
-
// Check list link match current href
|
|
1816
|
-
listLinksObj = listLinksObj.filter((i) => {
|
|
1817
|
-
var _a;
|
|
1818
|
-
const target = new URL(String(i.target).toLowerCase());
|
|
1819
|
-
if (i.option == 'exact_match')
|
|
1820
|
-
// FOR TEST LOCAL:
|
|
1821
|
-
// return Boolean(location.pathname === target.pathname)
|
|
1822
|
-
return Boolean(leadCurrentUrl === ((_a = target.href) === null || _a === void 0 ? void 0 : _a.toLowerCase()));
|
|
1823
|
-
if (i.option == 'start_with') {
|
|
1824
|
-
// FOR TEST LOCAL:
|
|
1825
|
-
// if (location.pathname.includes(target.pathname)) {
|
|
1826
|
-
if (leadCurrentUrl.includes(String(i.target).toLowerCase())) {
|
|
1827
|
-
const listExcluding = i.sub_target
|
|
1828
|
-
.filter((i) => i.option == 'excluding')
|
|
1829
|
-
.map((i) => { var _a; return (_a = i.value) === null || _a === void 0 ? void 0 : _a.toLowerCase(); });
|
|
1830
|
-
return !listExcluding.includes(leadCurrentUrl.split('?')[0]);
|
|
1831
|
-
}
|
|
1832
|
-
else {
|
|
1833
|
-
return false;
|
|
1834
|
-
}
|
|
1835
|
-
}
|
|
1836
|
-
});
|
|
1837
|
-
// Check tags
|
|
1838
|
-
const listMetaTag = Array.from(document.getElementsByTagName('META')).filter((i) => i.getAttribute('property') == 'article:tag');
|
|
1839
|
-
const listTags = listMetaTag.map((i) => i.content);
|
|
1840
|
-
let listCampaignHasTag = [];
|
|
1841
|
-
let listTagsObj = [];
|
|
1842
|
-
if (listTags && listTags.length) {
|
|
1843
|
-
listCampaignHasTag = campaignsDevice
|
|
1844
|
-
.map((i, index) => i.targets
|
|
1845
|
-
.filter((i) => i.type == CAMPAIGN_TARGET_TYPE.TAGS)
|
|
1846
|
-
.map((i) => (Object.assign(Object.assign({}, i), { campaignIndex: index }))))
|
|
1847
|
-
.flat(1);
|
|
1848
|
-
listTagsObj = listCampaignHasTag.filter((i) => listTags.includes(i.target));
|
|
1849
|
-
}
|
|
1850
|
-
const listCampaginsMatch = [...listLinksObj, ...listTagsObj];
|
|
1851
|
-
const cookieKeys = document.cookie
|
|
1852
|
-
.split('; ')
|
|
1853
|
-
.map((i) => i.split('=')[0]);
|
|
1854
|
-
const listCampaignCodeSubmited = cookieKeys.filter((i) => i.includes('lead_submited'));
|
|
1855
|
-
LeadLog(`--listCampaignCodeSubmited`, listCampaignCodeSubmited);
|
|
1856
|
-
const listCampaignCodeClosed = cookieKeys.filter((i) => i.includes('lead_closed'));
|
|
1857
|
-
LeadLog(`--listCampaignCodeClosed`, listCampaignCodeClosed);
|
|
1858
|
-
const listCampaignSubmitedClosed = [
|
|
1859
|
-
...listCampaignCodeSubmited,
|
|
1860
|
-
...listCampaignCodeClosed,
|
|
1861
|
-
];
|
|
1862
|
-
const listCampaignNoSubmitedClosed = listCampaginsMatch.filter((i) => {
|
|
1863
|
-
const hasSubmited = listCampaignSubmitedClosed.some((k) => k.includes(campaignsDevice[i.campaignIndex].code));
|
|
1864
|
-
return !hasSubmited;
|
|
1865
|
-
});
|
|
1866
|
-
const listCampaignValid = getShuffleArray(listCampaignNoSubmitedClosed);
|
|
1867
|
-
// .sort(
|
|
1868
|
-
// (a, b) =>
|
|
1869
|
-
// (listCampaignValid[a.campaignIndex]?.score || 0) -
|
|
1870
|
-
// (listCampaignValid[b.campaignIndex]?.score || 0),
|
|
1871
|
-
// )
|
|
1872
|
-
LeadLog('--listCampaignValid : ', listCampaignValid);
|
|
1873
|
-
if (listCampaignValid && listCampaignValid.length) {
|
|
1874
|
-
const CAMPAIGN_SHOW = campaignsDevice[listCampaignValid[0].campaignIndex];
|
|
1875
|
-
LeadLog(`CAMPAIGN_SHOW`, CAMPAIGN_SHOW);
|
|
1876
|
-
const { rules } = CAMPAIGN_SHOW;
|
|
1877
|
-
// CHECK RULE TRIGGER POPUP
|
|
1878
|
-
const timeoutRule = Number((_c = rules.find((i) => i.rule == 'time')) === null || _c === void 0 ? void 0 : _c.value);
|
|
1879
|
-
LeadLog(`timeoutRule`, timeoutRule);
|
|
1880
|
-
const scrollRule = Number((_d = rules.find((i) => i.rule == 'scroll')) === null || _d === void 0 ? void 0 : _d.value);
|
|
1881
|
-
LeadLog(`scrollRule`, scrollRule);
|
|
1882
|
-
let impressionAction = 'TIME';
|
|
1883
|
-
if (Number.isInteger(timeoutRule)) {
|
|
1884
|
-
impressionAction = 'TIME';
|
|
1885
|
-
LeadLog('✨ SHOW AWESOME POPUP AFTER: ', timeoutRule, ' seconds');
|
|
1886
|
-
timeoutRef = setTimeout(() => {
|
|
1887
|
-
onShowPopup === null || onShowPopup === void 0 ? void 0 : onShowPopup(CAMPAIGN_SHOW, impressionAction);
|
|
1888
|
-
}, timeoutRule * 1000);
|
|
1889
|
-
}
|
|
1890
|
-
if (Number.isInteger(scrollRule)) {
|
|
1891
|
-
impressionAction = 'SCROLL';
|
|
1892
|
-
LeadLog('✨ SHOW AWESOME AFTER: SCROLL', scrollRule, ' %');
|
|
1893
|
-
const $p = document.querySelector(`[data-url="${location.pathname}"]`) ||
|
|
1894
|
-
document.querySelector('body');
|
|
1895
|
-
const pct = $p.getBoundingClientRect().top;
|
|
1896
|
-
const pb = $p.offsetHeight;
|
|
1897
|
-
LeadLog(`👓 Element check scroll: `, $p);
|
|
1898
|
-
LEAD_SCROLL_EVENT = function leadScollCheckHandler() {
|
|
1899
|
-
const wt = window.pageYOffset || document.documentElement.scrollTop;
|
|
1900
|
-
let percent = 0;
|
|
1901
|
-
if (wt >= pct) {
|
|
1902
|
-
percent = Math.round(((wt - pct) / (pb - innerHeight)) * 100);
|
|
1903
|
-
}
|
|
1904
|
-
LeadLog('---Scroll', percent, scrollRule);
|
|
1905
|
-
// TODO: CHECK FOOTER HEIGHT
|
|
1906
|
-
if (percent >= scrollRule) {
|
|
1907
|
-
window.removeEventListener('scroll', LEAD_SCROLL_EVENT);
|
|
1908
|
-
onShowPopup === null || onShowPopup === void 0 ? void 0 : onShowPopup(CAMPAIGN_SHOW, impressionAction);
|
|
1909
|
-
}
|
|
1910
|
-
};
|
|
1911
|
-
window.addEventListener('scroll', LEAD_SCROLL_EVENT, {
|
|
1912
|
-
passive: true,
|
|
1913
|
-
});
|
|
1914
|
-
}
|
|
1915
|
-
}
|
|
1916
|
-
else {
|
|
1917
|
-
LeadLog('🚧 No lead campaigns on current URL, tags');
|
|
1918
|
-
}
|
|
1919
|
-
}
|
|
1920
|
-
})
|
|
1921
|
-
.catch((err) => {
|
|
1922
|
-
LeadLog(`Lead error: `, err);
|
|
1923
|
-
});
|
|
1924
|
-
}
|
|
1925
|
-
const LeadLog = (...params) => {
|
|
1926
|
-
if (process.env.NODE_ENV !== 'production' ||
|
|
1927
|
-
(process.env.NEXT_PUBLIC_DEPLOY_ENV &&
|
|
1928
|
-
process.env.NEXT_PUBLIC_DEPLOY_ENV !== 'production') ||
|
|
1929
|
-
(typeof localStorage !== 'undefined' &&
|
|
1930
|
-
localStorage.getItem('hhg_debug') === 'true')) {
|
|
1931
|
-
console.log(...params);
|
|
1932
|
-
}
|
|
1933
|
-
};
|
|
1934
|
-
|
|
1935
|
-
const LeadGenContext = React.createContext({
|
|
1936
|
-
submit(value) {
|
|
1937
|
-
/** Init for FAKING function */
|
|
1938
|
-
LeadLog('** LeadGen Submit : ', value);
|
|
1939
|
-
return Promise.reject(value);
|
|
1940
|
-
},
|
|
1941
|
-
submitSubscriptionBox(value) {
|
|
1942
|
-
/** Init for FAKING function */
|
|
1943
|
-
LeadLog('** LeadGen SubmitSubscriptionBox : ', value);
|
|
1944
|
-
return Promise.reject(value);
|
|
1945
|
-
},
|
|
1946
|
-
impression(value) {
|
|
1947
|
-
/** Init for FAKING function */
|
|
1948
|
-
LeadLog('** LeadGen Impression : ', value);
|
|
1949
|
-
return Promise.reject(value);
|
|
1950
|
-
},
|
|
1951
|
-
/** For Subscription Box */
|
|
1952
|
-
subscriptionIcon: '',
|
|
1953
|
-
subscriptionTitle: '',
|
|
1954
|
-
});
|
|
1955
|
-
const LeadGenContextProvider = (props) => {
|
|
1956
|
-
const { campaign_code: campaignCodeProps, apiSsoUrl, apiLeadUrl, apiSubotUrl, locale: localeProps, forceCampaign: forceCampaignProps, extraValues, articleId = 1, categoryId = 1, siteDomain: site_domain, children, } = props;
|
|
1957
|
-
const [forceCampaign, setForceCampaign] = React.useState(forceCampaignProps);
|
|
1958
|
-
const [subscriptionInfo, setSubscriptionInfo] = React.useState({
|
|
1959
|
-
subscriptionIcon: '',
|
|
1960
|
-
subscriptionTitle: '',
|
|
1961
|
-
});
|
|
1962
|
-
const locale = React.useMemo(() => {
|
|
1963
|
-
return localeProps || Locale.LOCALE['PhilippinesEnglish'];
|
|
1964
|
-
}, [localeProps]);
|
|
1965
|
-
const leadGenContextValue = React.useMemo(() => (Object.assign(Object.assign({}, props), { forceCampaign })), [...Object.values(props), forceCampaign]);
|
|
1966
|
-
const { url, campaign_id, campaign_code, cookie_id, ga_client_id, category_id, article_id, article_title, } = React.useMemo(() => ({
|
|
1967
|
-
url: location.href.toLowerCase() || '',
|
|
1968
|
-
cookie_id: miscCookieHelper.getCookie('hhg-id') || null,
|
|
1969
|
-
ga_client_id: miscCookieHelper.getCookie('_ga'),
|
|
1970
|
-
campaign_id: forceCampaign === null || forceCampaign === void 0 ? void 0 : forceCampaign.id,
|
|
1971
|
-
campaign_code: campaignCodeProps || (forceCampaign === null || forceCampaign === void 0 ? void 0 : forceCampaign.code),
|
|
1972
|
-
category_id: categoryId,
|
|
1973
|
-
article_id: articleId,
|
|
1974
|
-
article_title: document.title || '',
|
|
1975
|
-
}), [campaignCodeProps, articleId, categoryId, forceCampaign === null || forceCampaign === void 0 ? void 0 : forceCampaign.id]);
|
|
1976
|
-
const fetchCampaign = React.useCallback((campaign_code) => {
|
|
1977
|
-
Service.getCampaignByCode(campaign_code).then((res) => {
|
|
1978
|
-
const { _data } = res || {};
|
|
1979
|
-
const { campaigns } = _data || {};
|
|
1980
|
-
LeadLog('** LeadGen Campaign : ', campaigns);
|
|
1981
|
-
setForceCampaign(formatCampaignDetail(campaigns));
|
|
1982
|
-
});
|
|
1983
|
-
}, [campaignCodeProps]);
|
|
1984
|
-
// TODO : Update form for LeadGen
|
|
1985
|
-
const submit = React.useCallback((data) => {
|
|
1986
|
-
return Service.postSubscriptionBoxLead({ data });
|
|
1987
|
-
}, []);
|
|
1988
|
-
const submitSubscriptionBox = React.useCallback((value) => {
|
|
1989
|
-
const data = Object.assign(Object.assign(Object.assign(Object.assign({}, value), { campaign_id,
|
|
1990
|
-
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,
|
|
1991
|
-
category_id, article_title: (extraValues === null || extraValues === void 0 ? void 0 : extraValues.article_title) || article_title });
|
|
1992
|
-
return Service.postSubscriptionBoxLead({ data });
|
|
1993
|
-
}, [
|
|
1994
|
-
extraValues,
|
|
1995
|
-
site_domain,
|
|
1996
|
-
campaign_id,
|
|
1997
|
-
article_id,
|
|
1998
|
-
article_title,
|
|
1999
|
-
category_id,
|
|
2000
|
-
url,
|
|
2001
|
-
ga_client_id,
|
|
2002
|
-
]);
|
|
2003
|
-
const impression = React.useCallback((value) => {
|
|
2004
|
-
return Service.campaignPostImpression({
|
|
2005
|
-
url: (value === null || value === void 0 ? void 0 : value.url) || url,
|
|
2006
|
-
action: (value === null || value === void 0 ? void 0 : value.action) || LEADGEN_ACTIONS.SCROLL,
|
|
2007
|
-
code: (value === null || value === void 0 ? void 0 : value.code) || campaign_code,
|
|
2008
|
-
title_article: (value === null || value === void 0 ? void 0 : value.title_article) || article_title,
|
|
2009
|
-
cookie_id: (value === null || value === void 0 ? void 0 : value.cookie_id) || cookie_id,
|
|
2010
|
-
ga_client_id: (value === null || value === void 0 ? void 0 : value.ga_client_id) || ga_client_id,
|
|
2011
|
-
extra: (value === null || value === void 0 ? void 0 : value.extra) || Object.assign({ cookie_id,
|
|
2012
|
-
article_id, subscription_title: subscriptionInfo.subscriptionTitle }, extraValues),
|
|
2013
|
-
referrer: value === null || value === void 0 ? void 0 : value.referrer,
|
|
2014
|
-
});
|
|
2015
|
-
}, [
|
|
2016
|
-
extraValues,
|
|
2017
|
-
campaign_id,
|
|
2018
|
-
url,
|
|
2019
|
-
campaign_code,
|
|
2020
|
-
article_title,
|
|
2021
|
-
cookie_id,
|
|
2022
|
-
ga_client_id,
|
|
2023
|
-
article_id,
|
|
2024
|
-
subscriptionInfo.subscriptionTitle,
|
|
2025
|
-
]);
|
|
2026
|
-
React.useEffect(() => {
|
|
2027
|
-
if (forceCampaignProps) {
|
|
2028
|
-
setForceCampaign(forceCampaignProps);
|
|
2029
|
-
return;
|
|
2030
|
-
}
|
|
2031
|
-
/** For Subscription Box */
|
|
2032
|
-
if (categoryId) {
|
|
2033
|
-
Service.getSubscriptionBoxInfo({
|
|
2034
|
-
category: categoryId,
|
|
2035
|
-
site: site_domain,
|
|
2036
|
-
}).then((res) => {
|
|
2037
|
-
const { _data } = res || {};
|
|
2038
|
-
const { item, campaign_code } = _data || {};
|
|
2039
|
-
const { icon, content } = item || {};
|
|
2040
|
-
LeadLog('** LeadGen SubscriptionBox campaign_code : ', campaign_code);
|
|
2041
|
-
LeadLog('** LeadGen SubscriptionBox subscription_icon : ', icon);
|
|
2042
|
-
LeadLog('** LeadGen SubscriptionBox subscription_title : ', content);
|
|
2043
|
-
if (icon && content) {
|
|
2044
|
-
setSubscriptionInfo({
|
|
2045
|
-
subscriptionIcon: icon,
|
|
2046
|
-
subscriptionTitle: content,
|
|
2047
|
-
});
|
|
2048
|
-
}
|
|
2049
|
-
if (campaign_code) {
|
|
2050
|
-
fetchCampaign(campaign_code);
|
|
2051
|
-
}
|
|
2052
|
-
});
|
|
2053
|
-
return;
|
|
2054
|
-
}
|
|
2055
|
-
if (campaignCodeProps) {
|
|
2056
|
-
fetchCampaign(campaignCodeProps);
|
|
2057
|
-
}
|
|
2058
|
-
}, [campaignCodeProps, categoryId]);
|
|
2059
|
-
React.useEffect(() => {
|
|
2060
|
-
leadStore.apiSsoUrl = apiSsoUrl;
|
|
2061
|
-
leadStore.apiLeadUrl = apiLeadUrl;
|
|
2062
|
-
leadStore.apiSubotUrl = apiSubotUrl;
|
|
2063
|
-
}, [apiLeadUrl, apiSubotUrl, apiSsoUrl]);
|
|
2064
|
-
if (!forceCampaign || !(forceCampaign === null || forceCampaign === void 0 ? void 0 : forceCampaign.id)) {
|
|
2065
|
-
return null;
|
|
2066
|
-
}
|
|
2067
|
-
return (React__default["default"].createElement(LeadGenContext.Provider, { value: Object.assign(Object.assign(Object.assign({}, leadGenContextValue), subscriptionInfo), { submit,
|
|
2068
|
-
submitSubscriptionBox,
|
|
2069
|
-
impression }) },
|
|
2070
|
-
React__default["default"].createElement(LeadGenTranslationProvider, { locale: locale }, children)));
|
|
2071
|
-
};
|
|
2072
|
-
const useLeadGenContext = () => {
|
|
2073
|
-
const context = React.useContext(LeadGenContext);
|
|
2074
|
-
return Object.assign(Object.assign({}, context), { apiLeadUrl: context.apiLeadUrl || leadStore.apiLeadUrl, apiSubotUrl: context.apiSubotUrl || leadStore.apiSubotUrl });
|
|
2075
|
-
};
|
|
2076
|
-
|
|
2077
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
2078
|
-
const customParseFormat = require('dayjs/plugin/customParseFormat');
|
|
2079
|
-
dayjs__default["default"].extend(customParseFormat);
|
|
2080
|
-
// You can give context variables any name
|
|
2081
|
-
const [LeadFormProvider, useLeadFormContext, useLeadForm] = form.createFormContext();
|
|
2082
|
-
const useLeadFormConfig = ({ listBlockAdded = [], validatingPhoneRef, validatingEmailRef, campaignId, campaign_subot_id = [], userInfo, format, }) => {
|
|
2083
|
-
var _a;
|
|
2084
|
-
const { t } = index.useTranslations();
|
|
2085
|
-
const initialValues = React.useMemo(() => mappingSSOToLead(userInfo), [userInfo === null || userInfo === void 0 ? void 0 : userInfo.id]);
|
|
2086
|
-
const LEAD_LOCALE = LEAD_LOCALE_DATA[(_a = document === null || document === void 0 ? void 0 : document.documentElement) === null || _a === void 0 ? void 0 : _a.lang] ||
|
|
2087
|
-
LEAD_LOCALE_DATA['vi-VN'];
|
|
2088
|
-
const validateObj = React.useMemo(() => {
|
|
2089
|
-
const InputBlocks = [
|
|
2090
|
-
'TextBlock',
|
|
2091
|
-
'NumberBlock',
|
|
2092
|
-
'EmailBlock',
|
|
2093
|
-
'PhoneBlock',
|
|
2094
|
-
'DateBlock',
|
|
2095
|
-
'CheckboxBlock',
|
|
2096
|
-
'RadioBlock',
|
|
2097
|
-
'DropdownBlock',
|
|
2098
|
-
'PhoneOtpBlock',
|
|
2099
|
-
'WhatsappOtpBlock',
|
|
2100
|
-
'ZaloOtpBlock',
|
|
2101
|
-
'LocationBlock',
|
|
2102
|
-
'TncBlock',
|
|
2103
|
-
];
|
|
2104
|
-
// ALL are required and can skip if not touched yet
|
|
2105
|
-
const withSharedCheck = (name, cb,
|
|
2106
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2107
|
-
block) => {
|
|
2108
|
-
return (value) => {
|
|
2109
|
-
var _a;
|
|
2110
|
-
const isBLockRequired = (_a = block === null || block === void 0 ? void 0 : block.data) === null || _a === void 0 ? void 0 : _a.required;
|
|
2111
|
-
if (!formRef.current.isTouched(name))
|
|
2112
|
-
return;
|
|
2113
|
-
if ((typeof value === 'string' && value.trim() === '') ||
|
|
2114
|
-
typeof value === 'undefined' ||
|
|
2115
|
-
(Array.isArray(value) && value.length === 0)) {
|
|
2116
|
-
return isBLockRequired
|
|
2117
|
-
? t('validator.required')
|
|
2118
|
-
: cb === null || cb === void 0 ? void 0 : cb(value);
|
|
2119
|
-
}
|
|
2120
|
-
return cb === null || cb === void 0 ? void 0 : cb(value);
|
|
2121
|
-
};
|
|
2122
|
-
};
|
|
2123
|
-
return listBlockAdded
|
|
2124
|
-
.filter((b) => InputBlocks.includes(b.name))
|
|
2125
|
-
.reduce((r, b) => {
|
|
2126
|
-
const { name: fieldType, data } = b || {};
|
|
2127
|
-
const { value: fieldName, required } = data || {};
|
|
2128
|
-
const isRequired = required !== null && required !== void 0 ? required : true;
|
|
2129
|
-
if (fieldType === 'NumberBlock') {
|
|
2130
|
-
return Object.assign(Object.assign({}, r), { [fieldName]: withSharedCheck(fieldName, (value) => {
|
|
2131
|
-
if (value && isNaN(Number(value))) {
|
|
2132
|
-
return t('validator.number');
|
|
2133
|
-
}
|
|
2134
|
-
}, b) });
|
|
2135
|
-
}
|
|
2136
|
-
else if (fieldType === 'EmailBlock') {
|
|
2137
|
-
return Object.assign(Object.assign({}, r), { [fieldName]: withSharedCheck(fieldName, (value) => {
|
|
2138
|
-
if (value && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) {
|
|
2139
|
-
return t('validator.email');
|
|
2140
|
-
}
|
|
2141
|
-
if (!value)
|
|
2142
|
-
return;
|
|
2143
|
-
validatingEmailRef.current = true;
|
|
2144
|
-
setTimeout(() => {
|
|
2145
|
-
formRef.current.setFieldError(fieldName, 'Validating...');
|
|
2146
|
-
checkUsedEmailOrPhoneWithCache(campaignId, campaign_subot_id, {
|
|
2147
|
-
email: value,
|
|
2148
|
-
})
|
|
2149
|
-
.then((tKey) => {
|
|
2150
|
-
if (tKey) {
|
|
2151
|
-
formRef.current.setFieldError(fieldName, t(tKey));
|
|
2152
|
-
}
|
|
2153
|
-
else {
|
|
2154
|
-
formRef.current.clearFieldError(fieldName);
|
|
2155
|
-
}
|
|
2156
|
-
validatingEmailRef.current = false;
|
|
2157
|
-
})
|
|
2158
|
-
.catch((e) => {
|
|
2159
|
-
console.error(e);
|
|
2160
|
-
formRef.current.setFieldError(fieldName, e.message || 'Something went wrong');
|
|
2161
|
-
validatingEmailRef.current = false;
|
|
2162
|
-
});
|
|
2163
|
-
}, 200);
|
|
2164
|
-
}, b) });
|
|
2165
|
-
}
|
|
2166
|
-
else if (fieldType === 'PhoneBlock' ||
|
|
2167
|
-
fieldType === 'PhoneOtpBlock' ||
|
|
2168
|
-
fieldType === 'ZaloOtpBlock' ||
|
|
2169
|
-
fieldType === 'WhatsappOtpBlock') {
|
|
2170
|
-
return Object.assign(Object.assign({}, r), { [fieldName]: withSharedCheck(fieldName, (value) => {
|
|
2171
|
-
if (value &&
|
|
2172
|
-
window.intlTelInputUtils &&
|
|
2173
|
-
!window.intlTelInputUtils.isValidNumber(String(value), LEAD_LOCALE.countryCode)) {
|
|
2174
|
-
return t('validator.phone');
|
|
2175
|
-
}
|
|
2176
|
-
if (!value)
|
|
2177
|
-
return;
|
|
2178
|
-
validatingPhoneRef.current = true;
|
|
2179
|
-
setTimeout(() => {
|
|
2180
|
-
formRef.current.setFieldError(fieldName, 'Validating...');
|
|
2181
|
-
if (b.data.singleSubmission) {
|
|
2182
|
-
checkUsedPhoneOnlyWithCache(campaignId, value)
|
|
2183
|
-
.then((tKey) => {
|
|
2184
|
-
if (tKey) {
|
|
2185
|
-
formRef.current.setFieldError(fieldName, t(tKey));
|
|
2186
|
-
}
|
|
2187
|
-
else {
|
|
2188
|
-
formRef.current.clearFieldError(fieldName);
|
|
2189
|
-
}
|
|
2190
|
-
validatingPhoneRef.current = false;
|
|
2191
|
-
})
|
|
2192
|
-
.catch((err) => {
|
|
2193
|
-
console.error(err);
|
|
2194
|
-
formRef.current.setFieldError(fieldName, err.message || 'Something went wrong');
|
|
2195
|
-
validatingPhoneRef.current = false;
|
|
2196
|
-
});
|
|
2197
|
-
}
|
|
2198
|
-
else {
|
|
2199
|
-
checkUsedEmailOrPhoneWithCache(campaignId, campaign_subot_id, {
|
|
2200
|
-
phone: value,
|
|
2201
|
-
})
|
|
2202
|
-
.then((tKey) => {
|
|
2203
|
-
if (tKey) {
|
|
2204
|
-
formRef.current.setFieldError(fieldName, t(tKey));
|
|
2205
|
-
}
|
|
2206
|
-
else {
|
|
2207
|
-
formRef.current.clearFieldError(fieldName);
|
|
2208
|
-
}
|
|
2209
|
-
validatingPhoneRef.current = false;
|
|
2210
|
-
})
|
|
2211
|
-
.catch((e) => {
|
|
2212
|
-
console.error(e);
|
|
2213
|
-
formRef.current.setFieldError(fieldName, e.message || 'Something went wrong');
|
|
2214
|
-
validatingPhoneRef.current = false;
|
|
2215
|
-
});
|
|
2216
|
-
}
|
|
2217
|
-
}, 200);
|
|
2218
|
-
}, b) });
|
|
2219
|
-
}
|
|
2220
|
-
else if (fieldType === 'DateBlock') {
|
|
2221
|
-
return Object.assign(Object.assign({}, r), { [fieldName]: withSharedCheck(fieldName, (value) => {
|
|
2222
|
-
if (!isRequired && !value) {
|
|
2223
|
-
return;
|
|
2224
|
-
}
|
|
2225
|
-
const errMsg = t('validator.dateInvalid');
|
|
2226
|
-
const dayInJS = typeof value === 'string'
|
|
2227
|
-
? dayjs__default["default"](value, format, true)
|
|
2228
|
-
: dayjs__default["default"](value);
|
|
2229
|
-
if (!dayInJS.isValid()) {
|
|
2230
|
-
return errMsg;
|
|
2231
|
-
}
|
|
2232
|
-
}, b) });
|
|
2233
|
-
}
|
|
2234
|
-
else if (fieldType === 'TncBlock') {
|
|
2235
|
-
return Object.assign(Object.assign({}, r), { [`TNC-` + b.id]: withSharedCheck('TNC-' + b.id, (value) => {
|
|
2236
|
-
if (isRequired && !value) {
|
|
2237
|
-
return t('validator.required');
|
|
2238
|
-
}
|
|
2239
|
-
}, b) });
|
|
2240
|
-
}
|
|
2241
|
-
else {
|
|
2242
|
-
return Object.assign(Object.assign({}, r), { [fieldName]: withSharedCheck(fieldName, undefined, b) });
|
|
2243
|
-
}
|
|
2244
|
-
}, {});
|
|
2245
|
-
}, [listBlockAdded.map((b) => b.name).join(','), format]);
|
|
2246
|
-
const form = useLeadForm({
|
|
2247
|
-
validateInputOnChange: true,
|
|
2248
|
-
validateInputOnBlur: true,
|
|
2249
|
-
clearInputErrorOnChange: true,
|
|
2250
|
-
validate: validateObj,
|
|
2251
|
-
initialValues,
|
|
2252
|
-
});
|
|
2253
|
-
const formRef = React.useRef(form);
|
|
2254
|
-
formRef.current = form;
|
|
2255
|
-
return { form, validateObj };
|
|
2256
|
-
};
|
|
2257
|
-
|
|
2258
|
-
const StyledLeadGenThankYou = styled__default["default"].div `
|
|
2259
|
-
display: flex;
|
|
2260
|
-
gap: 8px;
|
|
2261
|
-
flex-direction: column;
|
|
2262
|
-
padding-block: 24px;
|
|
2263
|
-
|
|
2264
|
-
.leadgen-image {
|
|
2265
|
-
width: 120px;
|
|
2266
|
-
height: 120px;
|
|
2267
|
-
margin-inline: auto;
|
|
2268
|
-
object-fit: contain;
|
|
2269
|
-
object-position: center;
|
|
2270
|
-
text-align: center;
|
|
2271
|
-
}
|
|
2272
|
-
|
|
2273
|
-
.leadgen-title {
|
|
2274
|
-
margin-block: 0;
|
|
2275
|
-
color: ${miscTheme.theme.colors.gray900};
|
|
2276
|
-
font-weight: 700;
|
|
2277
|
-
font-size: 18px;
|
|
2278
|
-
line-height: 28px;
|
|
2279
|
-
letter-spacing: -0.2px;
|
|
2280
|
-
}
|
|
2281
|
-
|
|
2282
|
-
.leadgen-description {
|
|
2283
|
-
margin-block: 0;
|
|
2284
|
-
color: ${miscTheme.theme.colors.gray600};
|
|
2285
|
-
font-weight: 400;
|
|
2286
|
-
font-size: 14px;
|
|
2287
|
-
line-height: 22px;
|
|
2288
|
-
letter-spacing: -0.2px;
|
|
2289
|
-
text-align: center;
|
|
2290
|
-
}
|
|
2291
|
-
|
|
2292
|
-
> [data-align] {
|
|
2293
|
-
&[data-align='right'] {
|
|
2294
|
-
text-align: right;
|
|
2295
|
-
}
|
|
2296
|
-
&[data-align='center'] {
|
|
2297
|
-
text-align: center;
|
|
2298
|
-
}
|
|
2299
|
-
}
|
|
2300
|
-
`;
|
|
2301
|
-
const LeadGenThankYou = ({ image, title, description, showButton = false, button, className, style, }) => {
|
|
2302
|
-
const { src } = image;
|
|
2303
|
-
const { htmlText: titleText, align: titleAlign } = title;
|
|
2304
|
-
const { htmlText: descriptionText, align: descriptionAlign } = description;
|
|
2305
|
-
const { htmlText: buttonText, newtab, url, onClick } = button;
|
|
2306
|
-
return (React__default["default"].createElement(StyledLeadGenThankYou, { className: className, style: style },
|
|
2307
|
-
React__default["default"].createElement("img", { src: src, alt: "", className: "leadgen-thankyou_image leadgen-image" }),
|
|
2308
|
-
React__default["default"].createElement("p", { className: "leadgen-thankyou_title leadgen-title", "data-align": titleAlign }, titleText),
|
|
2309
|
-
React__default["default"].createElement("p", { className: "leadgen-thankyou_description leadgen-description", "data-align": descriptionAlign }, descriptionText),
|
|
2310
|
-
!!buttonText && showButton && (React__default["default"].createElement(core.Button, { component: url ? 'a' : 'button', target: newtab ? '_blank' : undefined, href: url, size: "lg", variant: "filled", className: "leadgen-thankyoue_btn leadgen-btn", onClick: onClick }, buttonText))));
|
|
2311
|
-
};
|
|
2312
|
-
|
|
2313
|
-
const StyledLeadGenSubscriptionBoxBody = styled__default["default"].div `
|
|
2314
|
-
margin-top: 16px;
|
|
2315
|
-
.leadgen-btn {
|
|
2316
|
-
margin-top: 16px;
|
|
2317
|
-
}
|
|
2318
|
-
`;
|
|
2319
|
-
const StyledLeadGenSubscriptionBoxHeaderImage = styled__default["default"].div `
|
|
2320
|
-
margin-top: 3px;
|
|
2321
|
-
margin-right: 20px;
|
|
2322
|
-
width: 44px;
|
|
2323
|
-
height: 44px;
|
|
2324
|
-
|
|
2325
|
-
img {
|
|
2326
|
-
width: 100%;
|
|
2327
|
-
height: 100%;
|
|
2328
|
-
object-fix: contain;
|
|
2329
|
-
onject-position: center;
|
|
2330
|
-
}
|
|
2331
|
-
|
|
2332
|
-
:has(img[src='']) {
|
|
2333
|
-
display: none;
|
|
2334
|
-
}
|
|
2335
|
-
`;
|
|
2336
|
-
const StyledLeadGenSubscriptionBoxHeader = styled__default["default"].div `
|
|
2337
|
-
display: flex;
|
|
2338
|
-
align-items: center;
|
|
2339
|
-
margin-bottom: 16px;
|
|
2340
|
-
.leadgen-title {
|
|
2341
|
-
margin-bottom: 0;
|
|
2342
|
-
flex: 1;
|
|
2343
|
-
min-width: 0;
|
|
2344
|
-
color: ${miscTheme.theme.colors.gray900};
|
|
2345
|
-
font-size: 18px;
|
|
2346
|
-
font-weight: 400;
|
|
2347
|
-
line-height: 1.4;
|
|
2348
|
-
letter-spacing: -0.8px;
|
|
2349
|
-
}
|
|
2350
|
-
`;
|
|
2351
|
-
const StyledLeadGenSubscriptionBox = styled__default["default"].div `
|
|
2352
|
-
padding: 16px;
|
|
2353
|
-
border: 1px solid ${miscTheme.theme.colors.neutral100};
|
|
2354
|
-
border-radius: 12px;
|
|
2355
|
-
margin-inline: auto;
|
|
2356
|
-
.leadgen-form_inputs {
|
|
2357
|
-
.leadgen-form_input {
|
|
2358
|
-
width: 100%;
|
|
2359
|
-
}
|
|
2360
|
-
}
|
|
2361
|
-
|
|
2362
|
-
.leadgen-form_input {
|
|
2363
|
-
.mantine-Input-wrapper {
|
|
2364
|
-
max-height: 56px;
|
|
2365
|
-
}
|
|
2366
|
-
}
|
|
2367
|
-
|
|
2368
|
-
@media screen and (min-width: 768px) {
|
|
2369
|
-
.leadgen-subscription_box_body {
|
|
2370
|
-
display: flex;
|
|
2371
|
-
> form {
|
|
2372
|
-
flex: 1;
|
|
2373
|
-
min-width: 0;
|
|
2374
|
-
|
|
2375
|
-
.leadgen-form_inputs {
|
|
2376
|
-
.leadgen-form_input {
|
|
2377
|
-
width: calc(50% - 4px);
|
|
2378
|
-
}
|
|
2379
|
-
}
|
|
2380
|
-
}
|
|
2381
|
-
|
|
2382
|
-
.leadgen-btn {
|
|
2383
|
-
margin-top: 0;
|
|
2384
|
-
margin-left: 8px;
|
|
2385
|
-
width: auto;
|
|
2386
|
-
min-height: 56px;
|
|
2387
|
-
}
|
|
2388
|
-
}
|
|
2389
|
-
}
|
|
2390
|
-
`;
|
|
2391
|
-
const StyledLeadGenSubscriptionBoxA = styled__default["default"].div `
|
|
2392
|
-
.leadgen-form_input {
|
|
2393
|
-
--phone-select: 45px;
|
|
2394
|
-
.PhoneInput {
|
|
2395
|
-
--phone-select: 45px;
|
|
2396
|
-
.PhoneInputCountry {
|
|
2397
|
-
margin-top: 1px;
|
|
2398
|
-
pointer-events: none;
|
|
2399
|
-
.PhoneInputCountryIconImg,
|
|
2400
|
-
.PhoneInputArrowContainer {
|
|
2401
|
-
display: none;
|
|
2402
|
-
}
|
|
2403
|
-
}
|
|
2404
|
-
}
|
|
2405
|
-
}
|
|
2406
|
-
`;
|
|
2407
|
-
|
|
2408
|
-
const PhoneInput = React.forwardRef((props, ref) => {
|
|
2409
|
-
const { defaultCountry, id: idProps, name, placeholder, label, labelElement, labelProps, description, descriptionProps, withAsterisk, inputMode, inputContainer, inputWrapperOrder, error, className, classNames, style, styles } = props, restProps = tslib_es6.__rest(props, ["defaultCountry", "id", "name", "placeholder", "label", "labelElement", "labelProps", "description", "descriptionProps", "withAsterisk", "inputMode", "inputContainer", "inputWrapperOrder", "error", "className", "classNames", "style", "styles"]);
|
|
2410
|
-
const id = idProps || uuid.v1() + name;
|
|
2411
|
-
return (React__default["default"].createElement(core.Input.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 },
|
|
2412
|
-
React__default["default"].createElement("div", { className: "mantine-Input-wrapper" },
|
|
2413
|
-
React__default["default"].createElement(index$2.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" })))));
|
|
2414
|
-
});
|
|
2415
|
-
|
|
2416
|
-
const formatLeadGenFormValue = (values, blocks) => {
|
|
2417
|
-
const newValues = {};
|
|
2418
|
-
for (const block of blocks) {
|
|
2419
|
-
const { data } = block || {};
|
|
2420
|
-
const { value: fieldName } = data || {};
|
|
2421
|
-
if (fieldName in values) {
|
|
2422
|
-
newValues[fieldName] = values[fieldName];
|
|
2423
|
-
}
|
|
2424
|
-
}
|
|
2425
|
-
return newValues;
|
|
2426
|
-
};
|
|
2427
|
-
|
|
2428
|
-
const StyledLeadGenFormInner = styled__default["default"].div `
|
|
2429
|
-
display: flex;
|
|
2430
|
-
flex-wrap: wrap;
|
|
2431
|
-
gap: 8px;
|
|
2432
|
-
.leadgen-form_input {
|
|
2433
|
-
width: calc(50% - 4px);
|
|
2434
|
-
}
|
|
2435
|
-
|
|
2436
|
-
.leadgen-form_input_checkbox {
|
|
2437
|
-
width: 100%;
|
|
2438
|
-
}
|
|
2439
|
-
`;
|
|
2440
|
-
|
|
2441
|
-
const cssInputNotShrink$1 = react.css `
|
|
2442
|
-
height: 100% !important;
|
|
2443
|
-
min-height: calc(var(--container-height, 56px) * 22 / 56);
|
|
2444
|
-
color: ${miscTheme.theme.colors.gray800};
|
|
2445
|
-
font-size: var(--input, 16px);
|
|
2446
|
-
line-height: calc(var(--container-height, 56px) * 22 / 56);
|
|
2447
|
-
border: none !important;
|
|
2448
|
-
border-radius: 0 !important;
|
|
2449
|
-
outline: none !important;
|
|
2450
|
-
box-shadow: none !important;
|
|
2451
|
-
padding: 0;
|
|
2452
|
-
cursor: pointer;
|
|
2453
|
-
opacity: 0;
|
|
2454
|
-
|
|
2455
|
-
::placeholder {
|
|
2456
|
-
color: ${miscTheme.theme.colors.gray400};
|
|
2457
|
-
}
|
|
2458
|
-
`;
|
|
2459
|
-
const cssInputShrink$1 = react.css `
|
|
2460
|
-
height: auto !important;
|
|
2461
|
-
cursor: text;
|
|
2462
|
-
opacity: 1;
|
|
2463
|
-
transition: 0.1s ease-in-out all;
|
|
2464
|
-
`;
|
|
2465
|
-
const cssLabelNotShrink$1 = react.css `
|
|
2466
|
-
position: absolute;
|
|
2467
|
-
top: calc(var(--container-height) / 2);
|
|
2468
|
-
left: var(--space-x, 16px);
|
|
2469
|
-
color: ${miscTheme.theme.colors.gray400};
|
|
2470
|
-
font-size: var(--label-not-shrink, 16px);
|
|
2471
|
-
font-weight: 400;
|
|
2472
|
-
line-height: calc(var(--container-height, 56px) * 18 / 56);
|
|
2473
|
-
margin: 0;
|
|
2474
|
-
z-index: 1;
|
|
2475
|
-
cursor: pointer;
|
|
2476
|
-
transform: translateY(-50%);
|
|
2477
|
-
transition: 0.125s ease-in all;
|
|
2478
|
-
`;
|
|
2479
|
-
const cssLabelShrink$1 = react.css `
|
|
2480
|
-
color: ${miscTheme.theme.colors.gray600};
|
|
2481
|
-
font-weight: 600;
|
|
2482
|
-
font-size: var(--label-shrink, 12px);
|
|
2483
|
-
top: calc(var(--container-height) * 7 / 56);
|
|
2484
|
-
transform: none;
|
|
2485
|
-
transition: 0.125s ease-out all;
|
|
2486
|
-
`;
|
|
2487
|
-
const cssWrapperInputNotShrink$1 = react.css `
|
|
2488
|
-
min-height: var(--container-height, 56px);
|
|
2489
|
-
display: flex;
|
|
2490
|
-
align-items: flex-end;
|
|
2491
|
-
border: 1px solid ${miscTheme.theme.colors.gray200};
|
|
2492
|
-
border-radius: 8px;
|
|
2493
|
-
background-color: #fff;
|
|
2494
|
-
padding-inline: var(--space-x, 16px);
|
|
2495
|
-
padding-block: var(--space-y-not-shrink, 16px);
|
|
2496
|
-
cursor: pointer;
|
|
2497
|
-
pointer-events: none;
|
|
2498
|
-
|
|
2499
|
-
&:has(.mantine-Input-rightSection) {
|
|
2500
|
-
padding-right: var(--container-height, 56px);
|
|
2501
|
-
}
|
|
2502
|
-
|
|
2503
|
-
.mantine-Input-icon {
|
|
2504
|
-
display: none;
|
|
2505
|
-
}
|
|
2506
|
-
|
|
2507
|
-
.mantine-NumberInput-control {
|
|
2508
|
-
border-color: ${miscTheme.theme.colors.gray200};
|
|
2509
|
-
}
|
|
2510
|
-
`;
|
|
2511
|
-
const cssWrapperInputShrink$1 = react.css `
|
|
2512
|
-
height: auto;
|
|
2513
|
-
min-height: var(--container-height, 56px);
|
|
2514
|
-
padding-block: var(--space-y-shrink, 7px);
|
|
2515
|
-
cursor: text;
|
|
2516
|
-
pointer-events: auto;
|
|
2517
|
-
`;
|
|
2518
|
-
const cssInputWrapperError$1 = react.css `
|
|
2519
|
-
color: ${miscTheme.theme.colors.red800};
|
|
2520
|
-
font-size: 12px;
|
|
2521
|
-
line-height: 1.5;
|
|
2522
|
-
`;
|
|
2523
|
-
const StyledTextFieldContainer$1 = styled__default["default"].div `
|
|
2524
|
-
--space-x: 16px;
|
|
2525
|
-
--space-y-not-shrink: 16px;
|
|
2526
|
-
--space-y-shrink: 7px;
|
|
2527
|
-
--container-height: 56px;
|
|
2528
|
-
--label-not-shrink: 16px;
|
|
2529
|
-
--label-shrink: 12px;
|
|
2530
|
-
--input: 16px;
|
|
2531
|
-
|
|
2532
|
-
position: relative;
|
|
2533
|
-
min-width: 100px;
|
|
2534
|
-
max-width: 100%;
|
|
2535
|
-
display: inline-block;
|
|
2536
|
-
|
|
2537
|
-
.textField_wrapper {
|
|
2538
|
-
display: inline-block;
|
|
2539
|
-
width: 100%;
|
|
2540
|
-
cursor: pointer;
|
|
2541
|
-
}
|
|
2542
|
-
|
|
2543
|
-
.mantine-InputWrapper-root {
|
|
2544
|
-
&[data-invalid='true'] {
|
|
2545
|
-
.mantine-Input-wrapper {
|
|
2546
|
-
border-color: ${miscTheme.theme.colors.red400};
|
|
2547
|
-
}
|
|
2548
|
-
}
|
|
2549
|
-
|
|
2550
|
-
.mantine-Input-wrapper {
|
|
2551
|
-
&:has([data-invalid]) {
|
|
2552
|
-
border-color: ${miscTheme.theme.colors.red400};
|
|
2553
|
-
}
|
|
2554
|
-
}
|
|
2555
|
-
|
|
2556
|
-
.mantine-InputWrapper-error {
|
|
2557
|
-
font-size: 12px !important;
|
|
2558
|
-
}
|
|
2559
|
-
}
|
|
2560
|
-
|
|
2561
|
-
.mantine-InputWrapper-label {
|
|
2562
|
-
${cssLabelNotShrink$1}
|
|
2563
|
-
}
|
|
2564
|
-
|
|
2565
|
-
.mantine-Input-wrapper {
|
|
2566
|
-
${cssWrapperInputNotShrink$1}
|
|
2567
|
-
|
|
2568
|
-
+ .mantine-Popover-dropdown[data-position="bottom-start"] {
|
|
2569
|
-
left: 0 !important;
|
|
2570
|
-
}
|
|
2571
|
-
+ .mantine-Popover-dropdown[data-position='top-start'] {
|
|
2572
|
-
top: unset !important;
|
|
2573
|
-
left: 0 !important;
|
|
2574
|
-
bottom: 100% !important;
|
|
2575
|
-
}
|
|
2576
|
-
}
|
|
2577
|
-
|
|
2578
|
-
.mantine-Input-input {
|
|
2579
|
-
${cssInputNotShrink$1}
|
|
2580
|
-
}
|
|
2581
|
-
|
|
2582
|
-
&.textField_shrink,
|
|
2583
|
-
&:focus-within {
|
|
2584
|
-
.mantine-InputWrapper-label {
|
|
2585
|
-
${cssLabelShrink$1}
|
|
2586
|
-
}
|
|
2587
|
-
|
|
2588
|
-
.mantine-Input-wrapper {
|
|
2589
|
-
${cssWrapperInputShrink$1}
|
|
2590
|
-
&.mantine-Select-wrapper {
|
|
2591
|
-
.mantine-Select-rightSection {
|
|
2592
|
-
pointer-events: auto !important;
|
|
2593
|
-
}
|
|
2594
|
-
}
|
|
2595
|
-
}
|
|
2596
|
-
|
|
2597
|
-
.mantine-Input-input {
|
|
2598
|
-
${cssInputShrink$1}
|
|
2599
|
-
}
|
|
2600
|
-
|
|
2601
|
-
&:has(.PhoneInput) {
|
|
2602
|
-
.mantine-InputWrapper-label {
|
|
2603
|
-
left: var(--space-x, 16px);
|
|
2604
|
-
}
|
|
2605
|
-
.PhoneInput {
|
|
2606
|
-
.PhoneInputInput {
|
|
2607
|
-
opacity: 1;
|
|
2608
|
-
}
|
|
2609
|
-
}
|
|
2610
|
-
}
|
|
2611
|
-
}
|
|
2612
|
-
|
|
2613
|
-
.PhoneInput {
|
|
2614
|
-
--phone-select: 75px;
|
|
2615
|
-
--phone-input-space-x: 8px;
|
|
2616
|
-
width: 100%;
|
|
2617
|
-
opacity: 1;
|
|
2618
|
-
border: none;
|
|
2619
|
-
.PhoneInputCountry {
|
|
2620
|
-
background-color: transparent;
|
|
2621
|
-
border: none;
|
|
2622
|
-
padding: 0;
|
|
2623
|
-
width: var(--phone-select, 75px);
|
|
2624
|
-
}
|
|
2625
|
-
.PhoneInputInput {
|
|
2626
|
-
flex: 1;
|
|
2627
|
-
min-width: 0;
|
|
2628
|
-
line-height: 1.5;
|
|
2629
|
-
outline: none !important;
|
|
2630
|
-
border: none;
|
|
2631
|
-
box-shadow: none;
|
|
2632
|
-
padding: 0 var(--phone-input-space-x, 8px);
|
|
2633
|
-
opacity: 0;
|
|
2634
|
-
color: ${miscTheme.theme.colors.gray800} !important;
|
|
2635
|
-
:focus {
|
|
2636
|
-
color: ${miscTheme.theme.colors.gray800} !important;
|
|
2637
|
-
}
|
|
2638
|
-
}
|
|
2639
|
-
}
|
|
2640
|
-
|
|
2641
|
-
&:has(.PhoneInput) {
|
|
2642
|
-
.mantine-InputWrapper-label {
|
|
2643
|
-
left: calc(
|
|
2644
|
-
var(--space-x, 16px) + var(--phone-select, 75px) +
|
|
2645
|
-
var(--phone-input-space-x, 8px)
|
|
2646
|
-
);
|
|
2647
|
-
}
|
|
2648
|
-
}
|
|
2649
|
-
`;
|
|
2650
|
-
const StyledChoiceFieldContainer$1 = styled__default["default"].div `
|
|
2651
|
-
&.leadgen-form_checkbox,
|
|
2652
|
-
&.leadgen-form_radio {
|
|
2653
|
-
width: 100%;
|
|
2654
|
-
}
|
|
2655
|
-
|
|
2656
|
-
&.leadgen-form_dropdown {
|
|
2657
|
-
width: calc(50% - 12px);
|
|
2658
|
-
}
|
|
2659
|
-
|
|
2660
|
-
.mantine-InputWrapper-root {
|
|
2661
|
-
display: block;
|
|
2662
|
-
.mantine-InputWrapper-error {
|
|
2663
|
-
font-size: 12px !important;
|
|
2664
|
-
}
|
|
2665
|
-
}
|
|
2666
|
-
|
|
2667
|
-
.mantine-InputWrapper-label {
|
|
2668
|
-
margin-bottom: 0.5rem;
|
|
2669
|
-
color: ${miscTheme.theme.colors.gray800};
|
|
2670
|
-
font-size: 16px;
|
|
2671
|
-
font-weight: 400;
|
|
2672
|
-
line-height: 1.5;
|
|
2673
|
-
}
|
|
2674
|
-
|
|
2675
|
-
.mantine-Radio-root,
|
|
2676
|
-
.mantine-Checkbox-root {
|
|
2677
|
-
gap: 8px;
|
|
2678
|
-
min-width: calc(50% - 4px);
|
|
2679
|
-
|
|
2680
|
-
input[type='radio'],
|
|
2681
|
-
input[type='checkbox'] {
|
|
2682
|
-
border-color: ${miscTheme.theme.colors.gray600};
|
|
2683
|
-
width: 18px;
|
|
2684
|
-
height: 18px;
|
|
2685
|
-
}
|
|
2686
|
-
input[type='checkbox'] {
|
|
2687
|
-
border-radius: 4px;
|
|
2688
|
-
}
|
|
2689
|
-
|
|
2690
|
-
&[data-checked='true'] {
|
|
2691
|
-
input[type='radio'],
|
|
2692
|
-
input[type='checkbox'] {
|
|
2693
|
-
border-color: ${miscTheme.theme.colors.primary600};
|
|
2694
|
-
+ svg {
|
|
2695
|
-
color: ${miscTheme.theme.colors.primary600};
|
|
2696
|
-
}
|
|
2697
|
-
}
|
|
2698
|
-
|
|
2699
|
-
input[type='radio'] {
|
|
2700
|
-
background-color: white;
|
|
2701
|
-
}
|
|
2702
|
-
}
|
|
2703
|
-
|
|
2704
|
-
.mantine-Checkbox-input {
|
|
2705
|
-
&:checked {
|
|
2706
|
-
border-color: ${miscTheme.theme.colors.primary600};
|
|
2707
|
-
}
|
|
2708
|
-
}
|
|
2709
|
-
}
|
|
2710
|
-
|
|
2711
|
-
.mantine-Radio-inner,
|
|
2712
|
-
.mantine-Checkbox-inner {
|
|
2713
|
-
width: 24px;
|
|
2714
|
-
height: 24px;
|
|
2715
|
-
display: flex;
|
|
2716
|
-
align-items: center;
|
|
2717
|
-
justify-content: center;
|
|
2718
|
-
}
|
|
2719
|
-
|
|
2720
|
-
.mantine-Radio-body,
|
|
2721
|
-
.mantine-Checkbox-body {
|
|
2722
|
-
display: flex;
|
|
2723
|
-
align-items: center;
|
|
2724
|
-
}
|
|
2725
|
-
|
|
2726
|
-
.mantine-Radio-label,
|
|
2727
|
-
.mantine-Checkbox-label {
|
|
2728
|
-
padding-left: 8px;
|
|
2729
|
-
color: ${miscTheme.theme.colors.gray800};
|
|
2730
|
-
font-size: 14px;
|
|
2731
|
-
line-height: 1.4;
|
|
2732
|
-
letter-spacing: -0.2px;
|
|
2733
|
-
}
|
|
2734
|
-
|
|
2735
|
-
.leadgen-choiceContainer {
|
|
2736
|
-
display: flex;
|
|
2737
|
-
flex-wrap: wrap;
|
|
2738
|
-
align-items: flex-start;
|
|
2739
|
-
gap: 8px;
|
|
2740
|
-
}
|
|
2741
|
-
|
|
2742
|
-
.mantine-InputWrapper-error {
|
|
2743
|
-
${cssInputWrapperError$1}
|
|
2744
|
-
}
|
|
2745
|
-
`;
|
|
2746
|
-
|
|
2747
|
-
const TextField$1 = (props) => {
|
|
2748
|
-
const { shrink: shrinkProps, onChangeShrink, className, children } = props, restProps = tslib_es6.__rest(props, ["shrink", "onChangeShrink", "className", "children"]);
|
|
2749
|
-
const containerRef = hooks.useClickOutside(() => {
|
|
2750
|
-
if (shrinkProps) {
|
|
2751
|
-
return;
|
|
2752
|
-
}
|
|
2753
|
-
setShrink(false);
|
|
2754
|
-
onChangeShrink === null || onChangeShrink === void 0 ? void 0 : onChangeShrink(false);
|
|
2755
|
-
});
|
|
2756
|
-
const [shrink, setShrink] = React.useState(shrinkProps);
|
|
2757
|
-
const onClick = React.useCallback((e) => {
|
|
2758
|
-
setShrink(true);
|
|
2759
|
-
onChangeShrink === null || onChangeShrink === void 0 ? void 0 : onChangeShrink(true);
|
|
2760
|
-
if (shrink) {
|
|
2761
|
-
return;
|
|
2762
|
-
}
|
|
2763
|
-
const $textEl = e.currentTarget.querySelectorAll('input:not([disabled]):not([type="submit"]),select:not([disabled]),textarea:not([disabled])');
|
|
2764
|
-
const $focusEl = $textEl.item($textEl.length - 1);
|
|
2765
|
-
if ($focusEl) {
|
|
2766
|
-
$focusEl.focus();
|
|
2767
|
-
setTimeout(() => {
|
|
2768
|
-
$focusEl.scrollIntoView({
|
|
2769
|
-
behavior: 'auto',
|
|
2770
|
-
block: 'center',
|
|
2771
|
-
inline: 'start',
|
|
2772
|
-
});
|
|
2773
|
-
}, 100);
|
|
2774
|
-
}
|
|
2775
|
-
}, [shrink]);
|
|
2776
|
-
React.useEffect(() => {
|
|
2777
|
-
setShrink(shrinkProps);
|
|
2778
|
-
}, [shrinkProps]);
|
|
2779
|
-
return (React__default["default"].createElement(StyledTextFieldContainer$1, Object.assign({ shrink: shrink, className: core.clsx(className, 'textField', { textField_shrink: !!shrink }) }, restProps),
|
|
2780
|
-
React__default["default"].createElement("div", { ref: containerRef, onClick: onClick, className: "textField_wrapper" }, children)));
|
|
2781
|
-
};
|
|
2782
|
-
const ChoiceField$1 = (props) => {
|
|
2783
|
-
const { children, className } = props, restProps = tslib_es6.__rest(props, ["children", "className"]);
|
|
2784
|
-
return (React__default["default"].createElement(StyledChoiceFieldContainer$1, Object.assign({ className: core.clsx(className, 'choiceField') }, restProps), children));
|
|
2785
|
-
};
|
|
2786
|
-
|
|
2787
|
-
const libraries = ['places'];
|
|
2788
|
-
const GoogleLocationBlock = (props) => {
|
|
2789
|
-
var _a;
|
|
2790
|
-
const { inputWrapperOrder = ['label', 'input', 'description', 'error'], defaultValue, value: valueProps, onChange: onChangeProps, locale } = props, restProps = tslib_es6.__rest(props, ["inputWrapperOrder", "defaultValue", "value", "onChange", "locale"]);
|
|
2791
|
-
const [LoadScript, setLoadScript] = React.useState(null);
|
|
2792
|
-
const [value, setValue] = React.useState(defaultValue || valueProps);
|
|
2793
|
-
const { predictions } = usePlacesAutocomplete.usePlacesAutocomplete(value, '', locale === 'tl-PH' ? 'en' : (_a = locale === null || locale === void 0 ? void 0 : locale.split('-')) === null || _a === void 0 ? void 0 : _a[0]);
|
|
2794
|
-
const onChangeAutocomplete = React.useCallback((s) => {
|
|
2795
|
-
setValue(s);
|
|
2796
|
-
onChangeProps === null || onChangeProps === void 0 ? void 0 : onChangeProps(s);
|
|
2797
|
-
}, []);
|
|
2798
|
-
const onClickItem = React.useCallback((item) => {
|
|
2799
|
-
/** For sure get value */
|
|
2800
|
-
setValue(item.value);
|
|
2801
|
-
const predCur = predictions === null || predictions === void 0 ? void 0 : predictions.find(({ description }) => description === item.value);
|
|
2802
|
-
onChangeProps === null || onChangeProps === void 0 ? void 0 : onChangeProps(item.value, predCur === null || predCur === void 0 ? void 0 : predCur.rawData);
|
|
2803
|
-
}, [onChangeProps, predictions]);
|
|
2804
|
-
React.useEffect(() => {
|
|
2805
|
-
setValue(valueProps);
|
|
2806
|
-
}, [valueProps]);
|
|
2807
|
-
React.useEffect(() => {
|
|
2808
|
-
var _a, _b, _c;
|
|
2809
|
-
// only load extra google script when not yet loaded
|
|
2810
|
-
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) {
|
|
2811
|
-
Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@react-google-maps/api')); }).then((m) => {
|
|
2812
|
-
setLoadScript(() => m.LoadScript);
|
|
2813
|
-
});
|
|
2814
|
-
}
|
|
2815
|
-
}, []);
|
|
2816
|
-
return (React__default["default"].createElement(core.Autocomplete, Object.assign({ defaultValue: defaultValue, value: value, onChange: onChangeAutocomplete, data: predictions.map((pred) => {
|
|
2817
|
-
return { value: pred.description, label: pred.description };
|
|
2818
|
-
}), filter: () => true, onItemSubmit: onClickItem, inputWrapperOrder: inputWrapperOrder, zIndex: index$6.ZINDEX_SSO - 9e6 + 2, withinPortal: true, styles: { dropdown: { pointerEvents: 'auto' } }, inputContainer: (children) => {
|
|
2819
|
-
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
2820
|
-
LoadScript && (React__default["default"].createElement(LoadScript, { googleMapsApiKey: usePlacesAutocomplete.GOOGLE_API_KEY, libraries: libraries, loadingElement: React__default["default"].createElement(React__default["default"].Fragment, null), style: { width: '100%' } })),
|
|
2821
|
-
children));
|
|
2822
|
-
} }, restProps)));
|
|
2823
|
-
};
|
|
2824
|
-
|
|
2825
|
-
const LeadGenForm = React.forwardRef((props, ref) => {
|
|
2826
|
-
const { locale, blocks, scrollToErrorField = true, form: formProps, rules: validate, initialValues, onFinish, onFinishFailed, className, style, } = props;
|
|
2827
|
-
const formRef = React.useRef(null);
|
|
2828
|
-
const form$1 = formProps || form.useForm({ initialValues, validate });
|
|
2829
|
-
const middlewareFinish = React.useCallback((values, event) => {
|
|
2830
|
-
/** Set `touched` all values for validation when submiting */
|
|
2831
|
-
form$1.setTouched(blocks.reduce((touched, { data }) => {
|
|
2832
|
-
touched[data.value] = true;
|
|
2833
|
-
return touched;
|
|
2834
|
-
}, {}));
|
|
2835
|
-
/** Wait for `touched` state and then submit */
|
|
2836
|
-
setTimeout(() => {
|
|
2837
|
-
const { hasErrors } = form$1.validate();
|
|
2838
|
-
if (hasErrors) {
|
|
2839
|
-
return;
|
|
2840
|
-
}
|
|
2841
|
-
onFinish === null || onFinish === void 0 ? void 0 : onFinish(formatLeadGenFormValue(values, blocks), event);
|
|
2842
|
-
}, 100);
|
|
2843
|
-
}, [form$1, blocks]);
|
|
2844
|
-
const middlewareFinishFailed = React.useCallback((errors, values, events) => {
|
|
2845
|
-
if (scrollToErrorField && errors) {
|
|
2846
|
-
const firstErrorKey = Object.keys(errors)[0];
|
|
2847
|
-
const firstErrorElement = document.querySelector(`[name="${firstErrorKey}"]`);
|
|
2848
|
-
if (firstErrorElement && (firstErrorElement === null || firstErrorElement === void 0 ? void 0 : firstErrorElement.focus)) {
|
|
2849
|
-
setTimeout(() => {
|
|
2850
|
-
firstErrorElement === null || firstErrorElement === void 0 ? void 0 : firstErrorElement.focus();
|
|
2851
|
-
firstErrorElement.scrollIntoView({
|
|
2852
|
-
behavior: 'auto',
|
|
2853
|
-
block: 'center',
|
|
2854
|
-
inline: 'center',
|
|
2855
|
-
});
|
|
2856
|
-
}, 100);
|
|
2857
|
-
}
|
|
2858
|
-
}
|
|
2859
|
-
onFinishFailed === null || onFinishFailed === void 0 ? void 0 : onFinishFailed(errors, values, events);
|
|
2860
|
-
}, [scrollToErrorField]);
|
|
2861
|
-
React.useEffect(() => {
|
|
2862
|
-
(() => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
|
|
2863
|
-
if (!window.intlTelInputUtils) {
|
|
2864
|
-
yield require('intl-tel-input/build/js/utils');
|
|
2865
|
-
}
|
|
2866
|
-
}))();
|
|
2867
|
-
}, []);
|
|
2868
|
-
React.useImperativeHandle(ref, () => (Object.assign(Object.assign({}, form$1), { submit: () => {
|
|
2869
|
-
formRef.current.requestSubmit();
|
|
2870
|
-
} })), [form$1, formRef]);
|
|
2871
|
-
if (!blocks || !blocks.length) {
|
|
2872
|
-
return null;
|
|
2873
|
-
}
|
|
2874
|
-
return (React__default["default"].createElement("form", { ref: formRef, onSubmit: form$1.onSubmit(middlewareFinish, middlewareFinishFailed), className: className, style: style },
|
|
2875
|
-
React__default["default"].createElement(StyledLeadGenFormInner, { className: "leadgen-form_inputs" }, blocks.map((block, idx) => {
|
|
2876
|
-
const { id, name: blockName, data } = block;
|
|
2877
|
-
const { placeholder, value: name, required, listQuestion, valueHTML, isSendMailChimp = false, } = data;
|
|
2878
|
-
const formInputProps = form$1.getInputProps(name);
|
|
2879
|
-
const { value, error } = formInputProps;
|
|
2880
|
-
const reactKey = `${id}-${idx}`;
|
|
2881
|
-
switch (blockName) {
|
|
2882
|
-
case LEADGEN_BLOCK.TextBlock: {
|
|
2883
|
-
return (React__default["default"].createElement(TextField$1, { key: reactKey, shrink: !!value, className: "leadgen-form_input" },
|
|
2884
|
-
React__default["default"].createElement(core.TextInput, Object.assign({ name: name, spellCheck: false, withAsterisk: required, label: placeholder, placeholder: placeholder, inputWrapperOrder: LEADGEN_ORDER_INPUT_WRAPPER, type: "text", "data-control": "text" }, formInputProps))));
|
|
2885
|
-
}
|
|
2886
|
-
case LEADGEN_BLOCK.NumberBlock: {
|
|
2887
|
-
return (React__default["default"].createElement(TextField$1, { key: reactKey, shrink: !!value, className: "leadgen-form_input" },
|
|
2888
|
-
React__default["default"].createElement(core.NumberInput, Object.assign({ name: value, spellCheck: false, withAsterisk: required, label: placeholder, placeholder: placeholder, inputWrapperOrder: LEADGEN_ORDER_INPUT_WRAPPER, type: "number", "data-control": "number" }, formInputProps))));
|
|
2889
|
-
}
|
|
2890
|
-
case LEADGEN_BLOCK.EmailBlock: {
|
|
2891
|
-
return (React__default["default"].createElement(TextField$1, { key: reactKey, shrink: !!value, className: "leadgen-form_input" },
|
|
2892
|
-
React__default["default"].createElement(core.TextInput, Object.assign({ name: name, spellCheck: false, withAsterisk: required, label: placeholder, placeholder: placeholder, inputWrapperOrder: LEADGEN_ORDER_INPUT_WRAPPER, "data-control": "email" }, formInputProps))));
|
|
2893
|
-
}
|
|
2894
|
-
case LEADGEN_BLOCK.PhoneOtpBlock:
|
|
2895
|
-
case LEADGEN_BLOCK.WhatsappOtpBlock:
|
|
2896
|
-
case LEADGEN_BLOCK.ZaloOtpBlock:
|
|
2897
|
-
case LEADGEN_BLOCK.PhoneBlock: {
|
|
2898
|
-
return (React__default["default"].createElement(TextField$1, { key: reactKey, shrink: !!value, className: "leadgen-form_input" },
|
|
2899
|
-
React__default["default"].createElement(PhoneInput, Object.assign({ name: name, spellCheck: false, withAsterisk: required, label: placeholder, placeholder: placeholder, inputWrapperOrder: LEADGEN_ORDER_INPUT_WRAPPER, defaultCountry: (locale ? utils.MAPPED_LOCALE[locale] || 'VN' : 'VN'), type: "text", "data-control": "text" }, formInputProps))));
|
|
2900
|
-
}
|
|
2901
|
-
case LEADGEN_BLOCK.LocationBlock: {
|
|
2902
|
-
return (React__default["default"].createElement(TextField$1, { key: reactKey, shrink: !!value, className: "leadgen-form_input" },
|
|
2903
|
-
React__default["default"].createElement(GoogleLocationBlock, Object.assign({ name: name, withAsterisk: required, label: placeholder, placeholder: placeholder, inputWrapperOrder: LEADGEN_ORDER_INPUT_WRAPPER, locale: locale, "data-control": "text" }, formInputProps))));
|
|
2904
|
-
}
|
|
2905
|
-
case LEADGEN_BLOCK.DateBlock: {
|
|
2906
|
-
return (React__default["default"].createElement(TextField$1, { key: reactKey, shrink: !!value, className: "leadgen-form_input" },
|
|
2907
|
-
React__default["default"].createElement(dates.DateInput, Object.assign({ locale: (utils.MAPPED_LOCALE === null || utils.MAPPED_LOCALE === void 0 ? void 0 : utils.MAPPED_LOCALE[locale]) || utils.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))));
|
|
2908
|
-
}
|
|
2909
|
-
case LEADGEN_BLOCK.DropdownBlock:
|
|
2910
|
-
return (React__default["default"].createElement(TextField$1, { key: reactKey, shrink: !!value, className: "leadgen-form_input" },
|
|
2911
|
-
React__default["default"].createElement("div", { style: { display: 'none' }, "data-extra": true, "data-name": value, "data-control": 'dropdown' }),
|
|
2912
|
-
React__default["default"].createElement(core.Select, Object.assign({ name: name, withAsterisk: required, label: placeholder, placeholder: placeholder, data: listQuestion.map((l) => ({
|
|
2913
|
-
value: l.value,
|
|
2914
|
-
label: l.placeholder,
|
|
2915
|
-
})) }, formInputProps))));
|
|
2916
|
-
case LEADGEN_BLOCK.CheckboxBlock: {
|
|
2917
|
-
const formInputCheckboxProps = form$1.getInputProps(name, {
|
|
2918
|
-
type: 'checkbox',
|
|
2919
|
-
});
|
|
2920
|
-
return (React__default["default"].createElement(ChoiceField$1, { className: "leadgen-form_input leadgen-form_input_checkbox", key: reactKey },
|
|
2921
|
-
isSendMailChimp && (React__default["default"].createElement("div", { style: { display: 'none' }, "data-name": name + '-mailchimp' })),
|
|
2922
|
-
React__default["default"].createElement(core.Checkbox.Group, Object.assign({ size: "md", withAsterisk: required, label: placeholder, value: value, sx: {
|
|
2923
|
-
display: 'flex',
|
|
2924
|
-
flexDirection: 'column',
|
|
2925
|
-
flexWrap: 'wrap',
|
|
2926
|
-
gap: 8,
|
|
2927
|
-
}, inputWrapperOrder: LEADGEN_ORDER_INPUT_WRAPPER, inputContainer: (children) => {
|
|
2928
|
-
return (React__default["default"].createElement("div", { className: "leadgen-choiceContainer" }, children));
|
|
2929
|
-
} }, formInputCheckboxProps), listQuestion.map((l, _idx) => (React__default["default"].createElement(core.Checkbox, { name: name, key: _idx, value: l.value, label: l.placeholder, "data-control": "checkbox" }))))));
|
|
2930
|
-
}
|
|
2931
|
-
case LEADGEN_BLOCK.RadioBlock: {
|
|
2932
|
-
return (React__default["default"].createElement(ChoiceField$1, { className: "leadgen-form_input leadgen-form_input_checkbox", key: reactKey },
|
|
2933
|
-
isSendMailChimp && (React__default["default"].createElement("div", { style: { display: 'none' }, "data-name": name + '-mailchimp' })),
|
|
2934
|
-
React__default["default"].createElement(core.Radio.Group, Object.assign({ size: "md", withAsterisk: required, label: placeholder, value: value, spellCheck: true, inputWrapperOrder: LEADGEN_ORDER_INPUT_WRAPPER, inputContainer: (children) => {
|
|
2935
|
-
return (React__default["default"].createElement("div", { className: "leadgen-choiceContainer" }, children));
|
|
2936
|
-
} }, formInputProps), listQuestion.map((l, _index) => (React__default["default"].createElement(core.Radio, { name: name, key: _index, value: l.value, label: l.placeholder, "data-control": "radio" }))))));
|
|
2937
|
-
}
|
|
2938
|
-
case LEADGEN_BLOCK.TncBlock:
|
|
2939
|
-
return (React__default["default"].createElement(ChoiceField$1, { className: "leadgen-form_input leadgen-form_input_checkbox", key: reactKey },
|
|
2940
|
-
React__default["default"].createElement(core.Input.Wrapper, { error: error },
|
|
2941
|
-
React__default["default"].createElement(core.Checkbox, Object.assign({ value: value, name: 'TNC-' + id, label: React__default["default"].createElement("p", { className: "lead-modal__tnc-link", dangerouslySetInnerHTML: { __html: valueHTML } }), className: "tnc-block", "data-control": "checkbox" }, formInputProps)))));
|
|
2942
|
-
default: {
|
|
2943
|
-
return null;
|
|
2944
|
-
}
|
|
2945
|
-
}
|
|
2946
|
-
}))));
|
|
2947
|
-
});
|
|
2948
|
-
|
|
2949
|
-
const LEADGEN_ORDER_INPUT_WRAPPER = ['label', 'input', 'description', 'error'];
|
|
2950
|
-
|
|
2951
|
-
const LeadGenSubscriptionBoxA = (props) => {
|
|
2952
|
-
const { loading, image, title, submitText, locale, blocks, form, rules, onFinish, } = props;
|
|
2953
|
-
const formRef = React.useRef();
|
|
2954
|
-
const imageComp = React.useMemo(() => {
|
|
2955
|
-
if (!image) {
|
|
2956
|
-
return null;
|
|
2957
|
-
}
|
|
2958
|
-
return (React__default["default"].createElement(StyledLeadGenSubscriptionBoxHeaderImage, null,
|
|
2959
|
-
React__default["default"].createElement("img", { src: image, alt: "" })));
|
|
2960
|
-
}, [image]);
|
|
2961
|
-
const titleComp = React.useMemo(() => {
|
|
2962
|
-
if (typeof title === 'string') {
|
|
2963
|
-
return (React__default["default"].createElement("p", { className: "leadgen-title", dangerouslySetInnerHTML: { __html: title } }));
|
|
2964
|
-
}
|
|
2965
|
-
return React__default["default"].createElement("p", { className: "leadgen-title" }, title);
|
|
2966
|
-
}, [title]);
|
|
2967
|
-
return (React__default["default"].createElement(StyledLeadGenSubscriptionBoxA, { className: "subcription_box_A" },
|
|
2968
|
-
React__default["default"].createElement(StyledLeadGenSubscriptionBoxHeader, { className: "leadgen-subscription_box_header" },
|
|
2969
|
-
imageComp,
|
|
2970
|
-
titleComp),
|
|
2971
|
-
React__default["default"].createElement(StyledLeadGenSubscriptionBoxBody, { className: "leadgen-subscription_box_body" },
|
|
2972
|
-
React__default["default"].createElement(LeadGenForm, { ref: formRef, form: form, rules: rules, blocks: blocks, locale: locale, onFinish: onFinish, className: "leadgen-subscription_box_form" }),
|
|
2973
|
-
React__default["default"].createElement(core.Button, { disabled: loading, loading: loading, variant: "filled", size: "lg", onClick: () => {
|
|
2974
|
-
formRef.current.submit();
|
|
2975
|
-
}, className: "leadgen-btn leadgen-btn_action", fullWidth: true }, submitText))));
|
|
2976
|
-
};
|
|
2977
|
-
|
|
2978
|
-
const LeadGenSubscriptionBoxWithoutMemo = ({ locale, userInfo, forceCampaign, categoryId, }) => {
|
|
2979
|
-
var _a, _b, _c;
|
|
2980
|
-
const { image, extra_fields, id: campaign_id, bot_id: campaign_subot_id = [], ThankYouBlock, } = forceCampaign || {};
|
|
2981
|
-
const { textBlocks, listBlockAdded, actionBlocks } = extra_fields || {};
|
|
2982
|
-
const { submitBlock } = actionBlocks || {};
|
|
2983
|
-
const { apiLeadUrl, subscriptionIcon, subscriptionTitle, submitSubscriptionBox, impression, onFinish, } = useLeadGenContext();
|
|
2984
|
-
const { t } = index.useTranslations();
|
|
2985
|
-
const { action: { pushNotifications }, } = React.useContext(togetherComponentGlobalContext.TogetherComponentGlobalContext);
|
|
2986
|
-
const refContainer = React.useRef(null);
|
|
2987
|
-
const [loading, setLoading] = React.useState(false);
|
|
2988
|
-
const [showThankyou, setShowThankyou] = React.useState(false);
|
|
2989
|
-
const validatingEmailRef = React.useRef(false);
|
|
2990
|
-
const validatingPhoneRef = React.useRef(false);
|
|
2991
|
-
const { form, validateObj } = useLeadFormConfig({
|
|
2992
|
-
listBlockAdded,
|
|
2993
|
-
campaignId: campaign_id,
|
|
2994
|
-
campaign_subot_id,
|
|
2995
|
-
validatingEmailRef,
|
|
2996
|
-
validatingPhoneRef,
|
|
2997
|
-
userInfo,
|
|
2998
|
-
});
|
|
2999
|
-
const subscription_title = React.useMemo(() => {
|
|
3000
|
-
var _a, _b;
|
|
3001
|
-
return subscriptionTitle ||
|
|
3002
|
-
((_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) ||
|
|
3003
|
-
t('leadgen.message.title.default');
|
|
3004
|
-
}, [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]);
|
|
3005
|
-
const { image: thankyouImage, title: thankyouTitle, description: thankyouDescription, button: thankyouButton, } = ThankYouBlock || {};
|
|
3006
|
-
const intersectionObserverCallback = React.useCallback((entries) => {
|
|
3007
|
-
entries.forEach((entry) => {
|
|
3008
|
-
const { isIntersecting, target } = entry;
|
|
3009
|
-
if (!showThankyou &&
|
|
3010
|
-
isIntersecting &&
|
|
3011
|
-
target === refContainer.current) {
|
|
3012
|
-
impression();
|
|
3013
|
-
}
|
|
3014
|
-
});
|
|
3015
|
-
}, [impression, showThankyou]);
|
|
3016
|
-
const IObserver = new IntersectionObserver(intersectionObserverCallback);
|
|
3017
|
-
const middlewareOnSubmit = React.useCallback((values) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
|
|
3018
|
-
const newValues = {
|
|
3019
|
-
subscription_title,
|
|
3020
|
-
};
|
|
3021
|
-
const ssoValues = {
|
|
3022
|
-
sso_user_id: undefined,
|
|
3023
|
-
sso_uuid: undefined,
|
|
3024
|
-
sso_verified_profile: undefined,
|
|
3025
|
-
};
|
|
3026
|
-
const valueKeys = Object.keys(values);
|
|
3027
|
-
for (const key of valueKeys) {
|
|
3028
|
-
const isPhoneField = leadGenFieldNamePhone(listBlockAdded).some((k) => k === key);
|
|
3029
|
-
if (isPhoneField) {
|
|
3030
|
-
const phone = PhoneInputBase.parsePhoneNumber(values[key]);
|
|
3031
|
-
if (phone.isValid()) {
|
|
3032
|
-
/** Seperate `area_code` and `phone_number` for BE */
|
|
3033
|
-
newValues['area_code'] = `+${phone.countryCallingCode}`;
|
|
3034
|
-
newValues['phone_number'] = phone.nationalNumber;
|
|
3035
|
-
/** Only case login has this update */
|
|
3036
|
-
if ((userInfo === null || userInfo === void 0 ? void 0 : userInfo.id) && (userInfo === null || userInfo === void 0 ? void 0 : userInfo.uid)) {
|
|
3037
|
-
ssoValues['sso_verified_profile'] =
|
|
3038
|
-
phone.number === (userInfo === null || userInfo === void 0 ? void 0 : userInfo.phone) ? 1 : 0;
|
|
3039
|
-
ssoValues['sso_user_id'] = userInfo === null || userInfo === void 0 ? void 0 : userInfo.id;
|
|
3040
|
-
ssoValues['sso_uuid'] = userInfo === null || userInfo === void 0 ? void 0 : userInfo.uid;
|
|
3041
|
-
}
|
|
3042
|
-
}
|
|
3043
|
-
continue;
|
|
3044
|
-
}
|
|
3045
|
-
newValues[key] = values[key];
|
|
3046
|
-
}
|
|
3047
|
-
setLoading(true);
|
|
3048
|
-
try {
|
|
3049
|
-
const { _data } = (yield submitSubscriptionBox(Object.assign(Object.assign({}, newValues), ssoValues))) || {};
|
|
3050
|
-
const { model } = _data || {};
|
|
3051
|
-
if (model && (model === null || model === void 0 ? void 0 : model.id)) {
|
|
3052
|
-
setShowThankyou(true);
|
|
3053
|
-
onFinish === null || onFinish === void 0 ? void 0 : onFinish(Object.assign(Object.assign({}, newValues), ssoValues), listBlockAdded || []);
|
|
3054
|
-
}
|
|
3055
|
-
}
|
|
3056
|
-
catch (error) {
|
|
3057
|
-
LeadLog('** LeadGen SubscriptionBox error : ', error);
|
|
3058
|
-
pushNotifications({
|
|
3059
|
-
message: t('leadgen.message.error.default'),
|
|
3060
|
-
type: 'danger',
|
|
3061
|
-
});
|
|
3062
|
-
}
|
|
3063
|
-
setLoading(false);
|
|
3064
|
-
}), [
|
|
3065
|
-
subscription_title,
|
|
3066
|
-
listBlockAdded,
|
|
3067
|
-
userInfo === null || userInfo === void 0 ? void 0 : userInfo.id,
|
|
3068
|
-
userInfo === null || userInfo === void 0 ? void 0 : userInfo.uid,
|
|
3069
|
-
userInfo === null || userInfo === void 0 ? void 0 : userInfo.phone,
|
|
3070
|
-
]);
|
|
3071
|
-
React.useEffect(() => {
|
|
3072
|
-
if (refContainer.current) {
|
|
3073
|
-
IObserver.observe(refContainer.current);
|
|
3074
|
-
}
|
|
3075
|
-
return () => {
|
|
3076
|
-
IObserver.disconnect();
|
|
3077
|
-
};
|
|
3078
|
-
}, [categoryId]);
|
|
3079
|
-
return (React__default["default"].createElement("div", { ref: refContainer },
|
|
3080
|
-
React__default["default"].createElement(StyledLeadGenSubscriptionBox, null,
|
|
3081
|
-
showThankyou && (React__default["default"].createElement(LeadGenThankYou, { image: Object.assign(Object.assign({}, thankyouImage), { src: thankyouImage.src || `${apiLeadUrl}admin/img/thanksyou.png` }), title: thankyouTitle, description: thankyouDescription, button: thankyouButton })),
|
|
3082
|
-
!showThankyou && (React__default["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 })))));
|
|
3083
|
-
};
|
|
3084
|
-
const LeadGenSubscriptionBox$1 = React.memo(LeadGenSubscriptionBoxWithoutMemo);
|
|
3085
|
-
|
|
3086
|
-
const Container = () => {
|
|
3087
|
-
const context = React.useContext(LeadGenContext);
|
|
3088
|
-
const { campaign_code, locale, siteId, siteDomain, userInfo, forceCampaign } = context;
|
|
3089
|
-
if (!forceCampaign || !(forceCampaign === null || forceCampaign === void 0 ? void 0 : forceCampaign.id)) {
|
|
3090
|
-
return null;
|
|
3091
|
-
}
|
|
3092
|
-
return (React__default["default"].createElement(LeadGenSubscriptionBox$1, { locale: locale, siteId: siteId, siteDomain: siteDomain, userInfo: userInfo, forceCampaign: forceCampaign, campaign_code: campaign_code }));
|
|
3093
|
-
};
|
|
3094
|
-
Container.displayName = 'LeadGenSubscriptionBox';
|
|
3095
|
-
const LeadGenSubscriptionBoxContainer = (props) => {
|
|
3096
|
-
const { apiUrl, apiSubotUrl } = props;
|
|
3097
|
-
return (React__default["default"].createElement(LeadGenContextProvider, Object.assign({}, props, { apiLeadUrl: apiUrl, apiSubotUrl: apiSubotUrl }),
|
|
3098
|
-
React__default["default"].createElement(Container, null)));
|
|
3099
|
-
};
|
|
3100
|
-
const LeadGenSubscriptionBox = LeadGenSubscriptionBoxContainer;
|
|
3101
|
-
|
|
3102
|
-
const useImageSize = (src) => {
|
|
3103
|
-
const [width, setWidth] = React.useState(16);
|
|
3104
|
-
const [height, setHeight] = React.useState(9);
|
|
3105
|
-
const [loaded, setLoaded] = React.useState(false);
|
|
3106
|
-
// load src image to get its width and height
|
|
3107
|
-
React.useEffect(() => {
|
|
3108
|
-
setLoaded(false);
|
|
3109
|
-
if (src) {
|
|
3110
|
-
const img = new Image();
|
|
3111
|
-
img.addEventListener('load', () => {
|
|
3112
|
-
setWidth(img.naturalWidth);
|
|
3113
|
-
setHeight(img.naturalHeight);
|
|
3114
|
-
setLoaded(true);
|
|
3115
|
-
});
|
|
3116
|
-
img.addEventListener('error', () => {
|
|
3117
|
-
setWidth(16);
|
|
3118
|
-
setHeight(9);
|
|
3119
|
-
setLoaded(true);
|
|
3120
|
-
});
|
|
3121
|
-
img.src = src;
|
|
3122
|
-
}
|
|
3123
|
-
else {
|
|
3124
|
-
setWidth(16);
|
|
3125
|
-
setHeight(9);
|
|
3126
|
-
setLoaded(true);
|
|
3127
|
-
}
|
|
3128
|
-
}, [src]);
|
|
3129
|
-
return {
|
|
3130
|
-
loaded,
|
|
3131
|
-
width,
|
|
3132
|
-
height,
|
|
3133
|
-
};
|
|
3134
|
-
};
|
|
3135
|
-
|
|
3136
|
-
const CloseButton = ({ onClose, containerClassName, svgClassName, }) => (React__default["default"].createElement("button", { onClick: onClose, className: `le-newbuilder-close-button js-modal__close ${containerClassName || ''}` },
|
|
3137
|
-
React__default["default"].createElement("svg", { width: "1em", height: "1em", viewBox: "0 0 20 20", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", className: svgClassName },
|
|
3138
|
-
React__default["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" }))));
|
|
3139
|
-
|
|
3140
|
-
// url: imageBlocks.imageMobile.data.url
|
|
3141
|
-
// newTab: imageBlocks.imageMobile.data.newtab
|
|
3142
|
-
// imageMobile: campaignShow.image
|
|
3143
|
-
// imageDestkop: campaignShow.image_desktop
|
|
3144
|
-
const CenterTabLayout = ({ popupId, url, newTab, imageDestkop, imageMobile, onClose, onOtherSubmit, }) => {
|
|
3145
|
-
const { width: imageMobileWidth, height: imageMobileHeight, loaded: imageMobileLoaded, } = useImageSize(imageMobile);
|
|
3146
|
-
const { width: imageDestkopWidth, height: imageDestkopHeight, loaded: imageDestkopLoaded, } = useImageSize(imageDestkop);
|
|
3147
|
-
if (!imageMobileLoaded || !imageDestkopLoaded)
|
|
1403
|
+
const CloseButton = ({ onClose, containerClassName, svgClassName, }) => (React__default["default"].createElement("button", { onClick: onClose, className: `le-newbuilder-close-button js-modal__close ${containerClassName || ''}` },
|
|
1404
|
+
React__default["default"].createElement("svg", { width: "1em", height: "1em", viewBox: "0 0 20 20", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", className: svgClassName },
|
|
1405
|
+
React__default["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" }))));
|
|
1406
|
+
|
|
1407
|
+
// url: imageBlocks.imageMobile.data.url
|
|
1408
|
+
// newTab: imageBlocks.imageMobile.data.newtab
|
|
1409
|
+
// imageMobile: campaignShow.image
|
|
1410
|
+
// imageDestkop: campaignShow.image_desktop
|
|
1411
|
+
const CenterTabLayout = ({ popupId, url, newTab, imageDestkop, imageMobile, onClose, onOtherSubmit, }) => {
|
|
1412
|
+
const { width: imageMobileWidth, height: imageMobileHeight, loaded: imageMobileLoaded, } = useImageSize(imageMobile);
|
|
1413
|
+
const { width: imageDestkopWidth, height: imageDestkopHeight, loaded: imageDestkopLoaded, } = useImageSize(imageDestkop);
|
|
1414
|
+
if (!imageMobileLoaded || !imageDestkopLoaded)
|
|
3148
1415
|
return null;
|
|
3149
1416
|
return (React__default["default"].createElement("div", { id: popupId, className: "lead-modal-wrapper", "data-popup-url": location.pathname, "data-popup-type": "center_tab" },
|
|
3150
1417
|
React__default["default"].createElement("div", { className: "le-center-tab-popup" },
|
|
3151
1418
|
React__default["default"].createElement("div", { style: { position: 'relative' } },
|
|
3152
1419
|
React__default["default"].createElement("a", { className: "js-popup-other-submit", href: url, target: newTab ? 'blank' : '_parent', onClick: onOtherSubmit },
|
|
3153
|
-
index$
|
|
1420
|
+
index$6.isVideo(imageMobile) ? (React__default["default"].createElement("video", { loop: true, muted: true, autoPlay: true, className: "le-only-mobile" },
|
|
3154
1421
|
React__default["default"].createElement("source", { src: imageMobile }))) : (React__default["default"].createElement("img", { className: "le-only-mobile", src: imageMobile, style: {
|
|
3155
1422
|
aspectRatio: `${imageMobileWidth}/${imageMobileHeight}`,
|
|
3156
1423
|
} })),
|
|
3157
|
-
index$
|
|
1424
|
+
index$6.isVideo(imageDestkop) ? (React__default["default"].createElement("video", { loop: true, muted: true, autoPlay: true, className: "le-only-desktop" },
|
|
3158
1425
|
React__default["default"].createElement("source", { src: imageDestkop }))) : (React__default["default"].createElement("img", { className: "le-only-desktop", src: imageDestkop, style: {
|
|
3159
1426
|
aspectRatio: `${imageDestkopWidth}/${imageDestkopHeight}`,
|
|
3160
1427
|
} }))),
|
|
@@ -3213,7 +1480,7 @@ const FloatingLayout = ({ popupId, url, title, urlText, titleAlign, subtitle, su
|
|
|
3213
1480
|
};
|
|
3214
1481
|
|
|
3215
1482
|
const ThankyouPopup = ({ title, titleAlign, subtitle, subtitleAlign, link, linkNewTab, linkText, image, }) => {
|
|
3216
|
-
const { primaryColor } = React.useContext(LeadGenContext
|
|
1483
|
+
const { primaryColor } = React.useContext(LeadGenContext);
|
|
3217
1484
|
const { width: imageWidth, height: imageHeight, loaded: imageLoaded, } = useImageSize(image);
|
|
3218
1485
|
if (!imageLoaded)
|
|
3219
1486
|
return null;
|
|
@@ -3381,6 +1648,211 @@ const EmptyComponent = ({ onClose, onContinue, }) => {
|
|
|
3381
1648
|
React__default["default"].createElement(core.Button, { onClick: onContinue, size: "lg", variant: "filled", fullWidth: false, className: "leadgen-btn leadgen-btn_empty_again" }, t('lead.empty.submitAgain')))));
|
|
3382
1649
|
};
|
|
3383
1650
|
|
|
1651
|
+
const libraries = ['places'];
|
|
1652
|
+
const GoogleLocationBlock = (props) => {
|
|
1653
|
+
var _a;
|
|
1654
|
+
const { inputWrapperOrder = ['label', 'input', 'description', 'error'], defaultValue, value: valueProps, onChange: onChangeProps, locale } = props, restProps = tslib_es6.__rest(props, ["inputWrapperOrder", "defaultValue", "value", "onChange", "locale"]);
|
|
1655
|
+
const [LoadScript, setLoadScript] = React.useState(null);
|
|
1656
|
+
const [value, setValue] = React.useState(defaultValue || valueProps);
|
|
1657
|
+
const { predictions } = usePlacesAutocomplete.usePlacesAutocomplete(value, '', locale === 'tl-PH' ? 'en' : (_a = locale === null || locale === void 0 ? void 0 : locale.split('-')) === null || _a === void 0 ? void 0 : _a[0]);
|
|
1658
|
+
const onChangeAutocomplete = React.useCallback((s) => {
|
|
1659
|
+
setValue(s);
|
|
1660
|
+
onChangeProps === null || onChangeProps === void 0 ? void 0 : onChangeProps(s);
|
|
1661
|
+
}, []);
|
|
1662
|
+
const onClickItem = React.useCallback((item) => {
|
|
1663
|
+
/** For sure get value */
|
|
1664
|
+
setValue(item.value);
|
|
1665
|
+
const predCur = predictions === null || predictions === void 0 ? void 0 : predictions.find(({ description }) => description === item.value);
|
|
1666
|
+
onChangeProps === null || onChangeProps === void 0 ? void 0 : onChangeProps(item.value, predCur === null || predCur === void 0 ? void 0 : predCur.rawData);
|
|
1667
|
+
}, [onChangeProps, predictions]);
|
|
1668
|
+
React.useEffect(() => {
|
|
1669
|
+
setValue(valueProps);
|
|
1670
|
+
}, [valueProps]);
|
|
1671
|
+
React.useEffect(() => {
|
|
1672
|
+
var _a, _b, _c;
|
|
1673
|
+
// only load extra google script when not yet loaded
|
|
1674
|
+
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) {
|
|
1675
|
+
Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@react-google-maps/api')); }).then((m) => {
|
|
1676
|
+
setLoadScript(() => m.LoadScript);
|
|
1677
|
+
});
|
|
1678
|
+
}
|
|
1679
|
+
}, []);
|
|
1680
|
+
return (React__default["default"].createElement(core.Autocomplete, Object.assign({ defaultValue: defaultValue, value: value, onChange: onChangeAutocomplete, data: predictions.map((pred) => {
|
|
1681
|
+
return { value: pred.description, label: pred.description };
|
|
1682
|
+
}), filter: () => true, onItemSubmit: onClickItem, inputWrapperOrder: inputWrapperOrder, zIndex: index$7.ZINDEX_SSO - 9e6 + 2, withinPortal: true, styles: { dropdown: { pointerEvents: 'auto' } }, inputContainer: (children) => {
|
|
1683
|
+
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
1684
|
+
LoadScript && (React__default["default"].createElement(LoadScript, { googleMapsApiKey: usePlacesAutocomplete.GOOGLE_API_KEY, libraries: libraries, loadingElement: React__default["default"].createElement(React__default["default"].Fragment, null), style: { width: '100%' } })),
|
|
1685
|
+
children));
|
|
1686
|
+
} }, restProps)));
|
|
1687
|
+
};
|
|
1688
|
+
|
|
1689
|
+
// You can give context variables any name
|
|
1690
|
+
const [LeadFormProvider, useLeadFormContext, useLeadForm] = form.createFormContext();
|
|
1691
|
+
const useLeadFormConfig = ({ listBlockAdded = [], validatingPhoneRef, validatingEmailRef, campaignId, campaign_subot_id = [], userInfo, }) => {
|
|
1692
|
+
const { t } = index.useTranslations();
|
|
1693
|
+
const initialValues = React.useMemo(() => mappingSSOToLead(userInfo), [userInfo === null || userInfo === void 0 ? void 0 : userInfo.id]);
|
|
1694
|
+
const validateObj = React.useMemo(() => {
|
|
1695
|
+
const InputBlocks = [
|
|
1696
|
+
'TextBlock',
|
|
1697
|
+
'NumberBlock',
|
|
1698
|
+
'EmailBlock',
|
|
1699
|
+
'PhoneBlock',
|
|
1700
|
+
'DateBlock',
|
|
1701
|
+
'CheckboxBlock',
|
|
1702
|
+
'RadioBlock',
|
|
1703
|
+
'DropdownBlock',
|
|
1704
|
+
'PhoneOtpBlock',
|
|
1705
|
+
'WhatsappOtpBlock',
|
|
1706
|
+
'ZaloOtpBlock',
|
|
1707
|
+
'LocationBlock',
|
|
1708
|
+
'TncBlock',
|
|
1709
|
+
];
|
|
1710
|
+
// ALL are required and can skip if not touched yet
|
|
1711
|
+
const withSharedCheck = (name, cb,
|
|
1712
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1713
|
+
block) => {
|
|
1714
|
+
return (value) => {
|
|
1715
|
+
var _a;
|
|
1716
|
+
const isBLockRequired = (_a = block === null || block === void 0 ? void 0 : block.data) === null || _a === void 0 ? void 0 : _a.required;
|
|
1717
|
+
if (!formRef.current.isTouched(name))
|
|
1718
|
+
return;
|
|
1719
|
+
if ((typeof value === 'string' && value.replace(' ', '') === '') ||
|
|
1720
|
+
typeof value === 'undefined' ||
|
|
1721
|
+
value === '' ||
|
|
1722
|
+
(Array.isArray(value) && value.length === 0)) {
|
|
1723
|
+
return isBLockRequired
|
|
1724
|
+
? t('validator.required')
|
|
1725
|
+
: cb === null || cb === void 0 ? void 0 : cb(value);
|
|
1726
|
+
}
|
|
1727
|
+
return cb === null || cb === void 0 ? void 0 : cb(value);
|
|
1728
|
+
};
|
|
1729
|
+
};
|
|
1730
|
+
return listBlockAdded
|
|
1731
|
+
.filter((b) => InputBlocks.includes(b.name))
|
|
1732
|
+
.reduce((r, b) => {
|
|
1733
|
+
var _a;
|
|
1734
|
+
const isRequired = (_a = b.data.required) !== null && _a !== void 0 ? _a : true;
|
|
1735
|
+
if (b.name === 'NumberBlock') {
|
|
1736
|
+
return Object.assign(Object.assign({}, r), { [b.data.value]: withSharedCheck(b.data.value, (value) => {
|
|
1737
|
+
if (value && isNaN(Number(value))) {
|
|
1738
|
+
return t('validator.number');
|
|
1739
|
+
}
|
|
1740
|
+
}, b) });
|
|
1741
|
+
}
|
|
1742
|
+
else if (b.name === 'EmailBlock') {
|
|
1743
|
+
return Object.assign(Object.assign({}, r), { [b.data.value]: withSharedCheck(b.data.value, (value) => {
|
|
1744
|
+
if (value && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) {
|
|
1745
|
+
return t('validator.email');
|
|
1746
|
+
}
|
|
1747
|
+
if (!value)
|
|
1748
|
+
return;
|
|
1749
|
+
validatingEmailRef.current = true;
|
|
1750
|
+
setTimeout(() => {
|
|
1751
|
+
formRef.current.setFieldError(b.data.value, 'Validating...');
|
|
1752
|
+
checkUsedEmailOrPhoneWithCache(campaignId, campaign_subot_id, {
|
|
1753
|
+
email: value,
|
|
1754
|
+
})
|
|
1755
|
+
.then((tKey) => {
|
|
1756
|
+
if (tKey) {
|
|
1757
|
+
formRef.current.setFieldError(b.data.value, t(tKey));
|
|
1758
|
+
}
|
|
1759
|
+
else {
|
|
1760
|
+
formRef.current.clearFieldError(b.data.value);
|
|
1761
|
+
}
|
|
1762
|
+
validatingEmailRef.current = false;
|
|
1763
|
+
})
|
|
1764
|
+
.catch((e) => {
|
|
1765
|
+
console.error(e);
|
|
1766
|
+
formRef.current.setFieldError(b.data.value, e.message || 'Something went wrong');
|
|
1767
|
+
validatingEmailRef.current = false;
|
|
1768
|
+
});
|
|
1769
|
+
}, 200);
|
|
1770
|
+
}, b) });
|
|
1771
|
+
}
|
|
1772
|
+
else if (b.name === 'PhoneBlock' ||
|
|
1773
|
+
b.name === 'PhoneOtpBlock' ||
|
|
1774
|
+
b.name === 'ZaloOtpBlock' ||
|
|
1775
|
+
b.name === 'WhatsappOtpBlock') {
|
|
1776
|
+
return Object.assign(Object.assign({}, r), { [b.data.value]: withSharedCheck(b.data.value, (value) => {
|
|
1777
|
+
if (value &&
|
|
1778
|
+
window.intlTelInputUtils &&
|
|
1779
|
+
!window.intlTelInputUtils.isValidNumber(String(value), LEAD_LOCALE.countryCode)) {
|
|
1780
|
+
return t('validator.phone');
|
|
1781
|
+
}
|
|
1782
|
+
if (!value)
|
|
1783
|
+
return;
|
|
1784
|
+
validatingPhoneRef.current = true;
|
|
1785
|
+
setTimeout(() => {
|
|
1786
|
+
formRef.current.setFieldError(b.data.value, 'Validating...');
|
|
1787
|
+
if (b.data.singleSubmission) {
|
|
1788
|
+
checkUsedPhoneOnlyWithCache(campaignId, value)
|
|
1789
|
+
.then((tKey) => {
|
|
1790
|
+
if (tKey) {
|
|
1791
|
+
formRef.current.setFieldError(b.data.value, t(tKey));
|
|
1792
|
+
}
|
|
1793
|
+
else {
|
|
1794
|
+
formRef.current.clearFieldError(b.data.value);
|
|
1795
|
+
}
|
|
1796
|
+
validatingPhoneRef.current = false;
|
|
1797
|
+
})
|
|
1798
|
+
.catch((err) => {
|
|
1799
|
+
console.error(err);
|
|
1800
|
+
formRef.current.setFieldError(b.data.value, err.message || 'Something went wrong');
|
|
1801
|
+
validatingPhoneRef.current = false;
|
|
1802
|
+
});
|
|
1803
|
+
}
|
|
1804
|
+
else {
|
|
1805
|
+
checkUsedEmailOrPhoneWithCache(campaignId, campaign_subot_id, {
|
|
1806
|
+
phone: value,
|
|
1807
|
+
})
|
|
1808
|
+
.then((tKey) => {
|
|
1809
|
+
if (tKey) {
|
|
1810
|
+
formRef.current.setFieldError(b.data.value, t(tKey));
|
|
1811
|
+
}
|
|
1812
|
+
else {
|
|
1813
|
+
formRef.current.clearFieldError(b.data.value);
|
|
1814
|
+
}
|
|
1815
|
+
validatingPhoneRef.current = false;
|
|
1816
|
+
})
|
|
1817
|
+
.catch((e) => {
|
|
1818
|
+
console.error(e);
|
|
1819
|
+
formRef.current.setFieldError(b.data.value, e.message || 'Something went wrong');
|
|
1820
|
+
validatingPhoneRef.current = false;
|
|
1821
|
+
});
|
|
1822
|
+
}
|
|
1823
|
+
}, 200);
|
|
1824
|
+
}, b) });
|
|
1825
|
+
}
|
|
1826
|
+
else if (b.name === 'DateBlock') {
|
|
1827
|
+
return Object.assign(Object.assign({}, r), { [b.data.value]: withSharedCheck(b.data.value, (value) => {
|
|
1828
|
+
if (value && isNaN(Date.parse(value))) {
|
|
1829
|
+
return t('validator.date');
|
|
1830
|
+
}
|
|
1831
|
+
}, b) });
|
|
1832
|
+
}
|
|
1833
|
+
else if (b.name === 'TncBlock') {
|
|
1834
|
+
return Object.assign(Object.assign({}, r), { [`TNC-` + b.id]: withSharedCheck('TNC-' + b.id, (value) => {
|
|
1835
|
+
if (isRequired && !value) {
|
|
1836
|
+
return t('validator.required');
|
|
1837
|
+
}
|
|
1838
|
+
}, b) });
|
|
1839
|
+
}
|
|
1840
|
+
else {
|
|
1841
|
+
return Object.assign(Object.assign({}, r), { [b.data.value]: withSharedCheck(b.data.value, undefined, b) });
|
|
1842
|
+
}
|
|
1843
|
+
}, {});
|
|
1844
|
+
}, [listBlockAdded.map((b) => b.name).join(',')]);
|
|
1845
|
+
const form = useLeadForm({
|
|
1846
|
+
validateInputOnChange: true,
|
|
1847
|
+
clearInputErrorOnChange: true,
|
|
1848
|
+
validate: validateObj,
|
|
1849
|
+
initialValues,
|
|
1850
|
+
});
|
|
1851
|
+
const formRef = React.useRef(form);
|
|
1852
|
+
formRef.current = form;
|
|
1853
|
+
return { form, validateObj };
|
|
1854
|
+
};
|
|
1855
|
+
|
|
3384
1856
|
const SubtitleBlock = ({ children, align, }) => (React__default["default"].createElement("p", { className: `lead-modal__description ${'le-text-align-' + (align || '')} ${LEAD_CLASS}` }, children));
|
|
3385
1857
|
|
|
3386
1858
|
const cssInputNotShrink = react.css `
|
|
@@ -3707,13 +2179,11 @@ const TextField = (props) => {
|
|
|
3707
2179
|
const $focusEl = $textEl.item($textEl.length - 1);
|
|
3708
2180
|
if ($focusEl) {
|
|
3709
2181
|
$focusEl.focus();
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
});
|
|
3716
|
-
}, 100);
|
|
2182
|
+
$focusEl.scrollIntoView({
|
|
2183
|
+
behavior: 'auto',
|
|
2184
|
+
block: 'center',
|
|
2185
|
+
inline: 'start',
|
|
2186
|
+
});
|
|
3717
2187
|
}
|
|
3718
2188
|
}, [shrink]);
|
|
3719
2189
|
React.useEffect(() => {
|
|
@@ -3730,14 +2200,8 @@ const ChoiceField = (props) => {
|
|
|
3730
2200
|
const TitleBlock = ({ children, align, }) => (React__default["default"].createElement("h2", { className: `lead-modal__title ${'le-text-align-' + (align || '')} ${LEAD_CLASS}` }, children));
|
|
3731
2201
|
|
|
3732
2202
|
const LightboxFields = ({ listBlockAdded, popupId, locale, onClose, onOtherSubmit, }) => {
|
|
3733
|
-
const { t } = index.useTranslations();
|
|
3734
2203
|
const form = useLeadFormContext();
|
|
3735
2204
|
const formValues = form.values;
|
|
3736
|
-
const labelTuples = React.useMemo(() => {
|
|
3737
|
-
return ((index$6.ISO_FORMAT === null || index$6.ISO_FORMAT === void 0 ? void 0 : index$6.ISO_FORMAT[locale]) || index$6.ISO_FORMAT['vi-VN']).dateFormat
|
|
3738
|
-
.split('/')
|
|
3739
|
-
.map((key) => { var _a; return t((_a = index$8.COMMON_DATE_TRANSLATE_KEY === null || index$8.COMMON_DATE_TRANSLATE_KEY === void 0 ? void 0 : index$8.COMMON_DATE_TRANSLATE_KEY[key]) === null || _a === void 0 ? void 0 : _a.id); });
|
|
3740
|
-
}, [locale]);
|
|
3741
2205
|
return (React__default["default"].createElement(React__default["default"].Fragment, null, listBlockAdded.map((b, index) => {
|
|
3742
2206
|
var _a;
|
|
3743
2207
|
const { name = '', data = {}, id } = b || {};
|
|
@@ -3787,15 +2251,17 @@ const LightboxFields = ({ listBlockAdded, popupId, locale, onClose, onOtherSubmi
|
|
|
3787
2251
|
return (React__default["default"].createElement(TextField, { key: index, shrink: !!formValue, className: "lead-modal__form-control leadgen-form_field" },
|
|
3788
2252
|
React__default["default"].createElement(GoogleLocationBlock, Object.assign({ withAsterisk: required, name: value, placeholder: placeholder, label: placeholder, "data-control": "text", locale: locale, inputWrapperOrder: ['label', 'input', 'description', 'error'] }, form.getInputProps(value)))));
|
|
3789
2253
|
}
|
|
3790
|
-
case 'DateBlock':
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
2254
|
+
case 'DateBlock':
|
|
2255
|
+
return (React__default["default"].createElement(TextField, { key: index, shrink: !!formValue, className: "lead-modal__form-control leadgen-form_field" },
|
|
2256
|
+
React__default["default"].createElement(index$4.DatePicker, Object.assign({ clearable: true, withAsterisk: required, type: "default", name: value, placeholder: placeholder, label: placeholder, inputWrapperOrder: ['label', 'input', 'description', 'error'], inputContainer: (children) => {
|
|
2257
|
+
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
2258
|
+
children,
|
|
2259
|
+
React__default["default"].createElement("input", { type: "hidden", "data-control": "date", name: value, value: formValue })));
|
|
2260
|
+
} }, form.getInputProps(value)))));
|
|
3795
2261
|
case 'LinkButtonBlock':
|
|
3796
2262
|
return (React__default["default"].createElement("div", { key: index },
|
|
3797
2263
|
React__default["default"].createElement("a", { target: newtab ? 'blank' : 'parrent', href: url, style: { textDecoration: 'none' } },
|
|
3798
|
-
React__default["default"].createElement(index$
|
|
2264
|
+
React__default["default"].createElement(index$8.Button, { type: "button", size: "md", className: `lead-modal__btn ${LEAD_CLASS}`, onClick: () => {
|
|
3799
2265
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
3800
2266
|
onOtherSubmit === null || onOtherSubmit === void 0 ? void 0 : onOtherSubmit();
|
|
3801
2267
|
} }, value))));
|
|
@@ -3834,7 +2300,7 @@ const LightboxFields = ({ listBlockAdded, popupId, locale, onClose, onOtherSubmi
|
|
|
3834
2300
|
label: l.placeholder,
|
|
3835
2301
|
})) }, form.getInputProps(value)))));
|
|
3836
2302
|
case 'TncBlock':
|
|
3837
|
-
const
|
|
2303
|
+
const _c = form.getInputProps(`TNC-${id}`), { error } = _c, tncInputProps = tslib_es6.__rest(_c, ["error"]);
|
|
3838
2304
|
return (React__default["default"].createElement(ChoiceField, { className: "leadgen-form_checkbox", key: id },
|
|
3839
2305
|
React__default["default"].createElement(core.Input.Wrapper, { error: error },
|
|
3840
2306
|
React__default["default"].createElement(index$2.Checkbox, Object.assign({ name: 'TNC-' + id, label: React__default["default"].createElement("p", { className: "lead-modal__tnc-link", dangerouslySetInnerHTML: { __html: data.valueHTML } }), className: "tnc-block", "data-control": "checkbox" }, tncInputProps)))));
|
|
@@ -3940,11 +2406,11 @@ const HeaderImage = ({ src, ratio = 3 / 2, className, style, }) => {
|
|
|
3940
2406
|
if (!src) {
|
|
3941
2407
|
return null;
|
|
3942
2408
|
}
|
|
3943
|
-
return (React__default["default"].createElement(StyleHeaderImage, { paddingTop: (1 / ratio) * 100, className: core.clsx(className, 'leadgen-header_image'), style: style }, index$
|
|
2409
|
+
return (React__default["default"].createElement(StyleHeaderImage, { paddingTop: (1 / ratio) * 100, className: core.clsx(className, 'leadgen-header_image'), style: style }, index$6.isVideo(src) ? (React__default["default"].createElement("video", { muted: true, autoPlay: true, loop: true, className: "leadgen-header_image_feature leadgen-header_image_video", src: src })) : (React__default["default"].createElement("img", { src: src, draggable: "false", alt: "", className: "leadgen-header_image_feature leadgen-header_image_image" }))));
|
|
3944
2410
|
};
|
|
3945
2411
|
|
|
3946
2412
|
const OtpBlock = ({ otpData, onSuccess, autoSendWhenOpen, }) => {
|
|
3947
|
-
const { primaryColor } = React.useContext(LeadGenContext
|
|
2413
|
+
const { primaryColor } = React.useContext(LeadGenContext);
|
|
3948
2414
|
const { t } = index.useTranslations();
|
|
3949
2415
|
const phone = otpData.phone;
|
|
3950
2416
|
const otpType = otpData.type;
|
|
@@ -4030,371 +2496,709 @@ const OtpBlock = ({ otpData, onSuccess, autoSendWhenOpen, }) => {
|
|
|
4030
2496
|
// type: 'danger',
|
|
4031
2497
|
// })
|
|
4032
2498
|
}
|
|
4033
|
-
setIsSubmitLoading(false);
|
|
4034
|
-
});
|
|
4035
|
-
React.useEffect(() => {
|
|
4036
|
-
setTimeout(() => {
|
|
4037
|
-
if (resendTimer > 0) {
|
|
4038
|
-
setResendTimer((r) => r - 1);
|
|
4039
|
-
}
|
|
4040
|
-
}, 1000);
|
|
4041
|
-
}, [resendTimer]);
|
|
4042
|
-
React.useEffect(() => {
|
|
4043
|
-
if (autoSendWhenOpen && !resendTimer) {
|
|
4044
|
-
sendOtp();
|
|
2499
|
+
setIsSubmitLoading(false);
|
|
2500
|
+
});
|
|
2501
|
+
React.useEffect(() => {
|
|
2502
|
+
setTimeout(() => {
|
|
2503
|
+
if (resendTimer > 0) {
|
|
2504
|
+
setResendTimer((r) => r - 1);
|
|
2505
|
+
}
|
|
2506
|
+
}, 1000);
|
|
2507
|
+
}, [resendTimer]);
|
|
2508
|
+
React.useEffect(() => {
|
|
2509
|
+
if (autoSendWhenOpen && !resendTimer) {
|
|
2510
|
+
sendOtp();
|
|
2511
|
+
}
|
|
2512
|
+
}, []);
|
|
2513
|
+
return (React__default["default"].createElement("form", { onSubmit: (e) => {
|
|
2514
|
+
e.preventDefault();
|
|
2515
|
+
submitOtp();
|
|
2516
|
+
}, className: "lead-phone-otp-form leadgen-form leadgen-form_otp" },
|
|
2517
|
+
React__default["default"].createElement(FormContainer, { title: t('lead.otp.title'), description: t('lead.otp.desc', {
|
|
2518
|
+
phone: `<strong>${displayPhone}</strong>`,
|
|
2519
|
+
}), footer: React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
2520
|
+
React__default["default"].createElement(core.Button, { 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')),
|
|
2521
|
+
React__default["default"].createElement(core.Button, { type: "button", size: "lg", variant: "light", className: `lead-modal__btn lead-phone-otp-button leadgen-btn_action ${LEAD_CLASS}`, color: primaryColor, onClick: () => {
|
|
2522
|
+
sendOtp();
|
|
2523
|
+
}, disabled: !!resendTimer }, t('lead.otp.resend', {
|
|
2524
|
+
timer: resendTimer ? ` (${resendTimer}s)` : '',
|
|
2525
|
+
}))) },
|
|
2526
|
+
React__default["default"].createElement("div", { className: "leadgen-form_inner" },
|
|
2527
|
+
React__default["default"].createElement(index$2.Input.Wrapper, { error: isDirty ? errorMsg : undefined, className: "leadgen-form_field" },
|
|
2528
|
+
React__default["default"].createElement(index$2.OTP, { ref: inputRef, name: '_' + name + '-otp', value: otp, onChange: (v) => {
|
|
2529
|
+
setIsDirty(true);
|
|
2530
|
+
setOtp(v.toString());
|
|
2531
|
+
if (isDirty && !v)
|
|
2532
|
+
setErrorMsg('OTP is required');
|
|
2533
|
+
else
|
|
2534
|
+
setErrorMsg(undefined);
|
|
2535
|
+
} }))))));
|
|
2536
|
+
};
|
|
2537
|
+
|
|
2538
|
+
// url: imageBlocks.imageMobile.data.url
|
|
2539
|
+
// newTab: imageBlocks.imageMobile.data.newtab
|
|
2540
|
+
// image: campaignShow.image
|
|
2541
|
+
// imageDestkop: campaignShow.image_desktop
|
|
2542
|
+
const LEADGEN_LAYOUT_NOT_SHOW_IN_MOBILE = [
|
|
2543
|
+
LEADGEN_LAYOUT.Fullscreen,
|
|
2544
|
+
LEADGEN_LAYOUT.Slider,
|
|
2545
|
+
];
|
|
2546
|
+
const LEADGEN_LIMIT_LIGHTBOXB = 6;
|
|
2547
|
+
const LEADGEN_SHOW_HEADER = [
|
|
2548
|
+
'LightBoxA',
|
|
2549
|
+
'InlineA',
|
|
2550
|
+
LEADGEN_LAYOUT.Sidebar,
|
|
2551
|
+
LEADGEN_LAYOUT.Slider,
|
|
2552
|
+
];
|
|
2553
|
+
const LightboxLayout = ({ popupId, extraFields, onClose: onCloseProp, onOtherSubmit, imageMobile, imageDesktop, imageOverlayMobile, imageOverlayDesktop, imageBackground, currentLayout, title, onSubmit, showThankyou, campaignId, campaign_subot_id, locale, showEmpty, setShowEmpty, userInfo, }) => {
|
|
2554
|
+
var _a;
|
|
2555
|
+
const { primaryColor } = React.useContext(LeadGenContext);
|
|
2556
|
+
const { isMobile } = useScreenSize.useScreenSize();
|
|
2557
|
+
const [open, setOpen] = React.useState(!!campaignId);
|
|
2558
|
+
const [showOtpPhone, setShowOtpPhone] = React.useState(null);
|
|
2559
|
+
const [isSubmitLoading, setIsSubmitLoading] = React.useState(false);
|
|
2560
|
+
const [snap, setSnap] = React.useState(0.8);
|
|
2561
|
+
const formRef = React.useRef();
|
|
2562
|
+
const onClose = () => {
|
|
2563
|
+
if (showOtpPhone) {
|
|
2564
|
+
setShowOtpPhone(null);
|
|
2565
|
+
}
|
|
2566
|
+
else {
|
|
2567
|
+
onCloseProp === null || onCloseProp === void 0 ? void 0 : onCloseProp();
|
|
2568
|
+
}
|
|
2569
|
+
};
|
|
2570
|
+
const textBlocks = JSON.parse(extraFields.textBlocks);
|
|
2571
|
+
const listBlockAdded = JSON.parse(extraFields.listBlockAdded);
|
|
2572
|
+
const actionBlocks = JSON.parse(extraFields.actionBlocks);
|
|
2573
|
+
const popUpSubmitText = actionBlocks.submitBlock.data.value;
|
|
2574
|
+
const currentPath = location.pathname;
|
|
2575
|
+
const { align: descriptionAlign, value: description } = textBlocks.subtitleBlock.data || {};
|
|
2576
|
+
const { align: titleAlign } = textBlocks.titleBlock.data || {};
|
|
2577
|
+
const isSlider = currentLayout === LEADGEN_LAYOUT.Slider;
|
|
2578
|
+
const isSidebar = currentLayout === LEADGEN_LAYOUT.Sidebar;
|
|
2579
|
+
const isLightBox = currentLayout.includes('LightBox');
|
|
2580
|
+
const isLightBoxA = currentLayout === LEADGEN_LAYOUT.LightBoxA;
|
|
2581
|
+
const isLightBoxB = currentLayout === LEADGEN_LAYOUT.LightBoxB;
|
|
2582
|
+
const isInline = currentLayout.includes('Inline');
|
|
2583
|
+
const isFullscreen = currentLayout === LEADGEN_LAYOUT.Fullscreen;
|
|
2584
|
+
const isInPage = isInline || isSidebar;
|
|
2585
|
+
const isDrawer = isLightBoxB && isMobile;
|
|
2586
|
+
const limitFieldsLightBoxB = isLightBoxB && listBlockAdded.length <= LEADGEN_LIMIT_LIGHTBOXB;
|
|
2587
|
+
const hasForm = isLightBoxA
|
|
2588
|
+
? listBlockAdded.some((item) => LEADGEN_BLOCK_IN_FORM.some((k) => k === (item === null || item === void 0 ? void 0 : item.name)))
|
|
2589
|
+
: true;
|
|
2590
|
+
const headerInsideFormContainer = isSlider || isLightBoxA || isFullscreen;
|
|
2591
|
+
const showHeader = !!imageMobile || !!imageDesktop;
|
|
2592
|
+
const onlyHeader = !title && !description;
|
|
2593
|
+
const showButtonClose = !isInline;
|
|
2594
|
+
if (window.innerWidth < 769 &&
|
|
2595
|
+
LEADGEN_LAYOUT_NOT_SHOW_IN_MOBILE.includes(currentLayout)) {
|
|
2596
|
+
console.log('😎 Not show fullscreen, slider on mobile ');
|
|
2597
|
+
return null;
|
|
2598
|
+
}
|
|
2599
|
+
React.useEffect(() => {
|
|
2600
|
+
if (isLightBox || isFullscreen) {
|
|
2601
|
+
document.body.classList.add('noscroll');
|
|
2602
|
+
}
|
|
2603
|
+
if (!window.intlTelInputUtils) {
|
|
2604
|
+
require('intl-tel-input/build/js/utils');
|
|
2605
|
+
}
|
|
2606
|
+
clearCacheUsedEmailOrPhone();
|
|
2607
|
+
}, []);
|
|
2608
|
+
const validatingPhoneRef = React.useRef(false);
|
|
2609
|
+
const validatingEmailRef = React.useRef(false);
|
|
2610
|
+
const { form, validateObj } = useLeadFormConfig({
|
|
2611
|
+
listBlockAdded,
|
|
2612
|
+
validatingPhoneRef,
|
|
2613
|
+
validatingEmailRef,
|
|
2614
|
+
campaignId,
|
|
2615
|
+
campaign_subot_id,
|
|
2616
|
+
userInfo,
|
|
2617
|
+
});
|
|
2618
|
+
const middlewareOnSubmit = (e) => {
|
|
2619
|
+
e.preventDefault();
|
|
2620
|
+
// mark all as touched to allow validation
|
|
2621
|
+
form.setTouched(Object.keys(validateObj).reduce((acc, cur) => {
|
|
2622
|
+
acc[cur] = true;
|
|
2623
|
+
return acc;
|
|
2624
|
+
}, {}));
|
|
2625
|
+
if (validatingEmailRef.current || validatingPhoneRef.current) {
|
|
2626
|
+
return;
|
|
2627
|
+
}
|
|
2628
|
+
setTimeout(() => {
|
|
2629
|
+
form.onSubmit((v) => {
|
|
2630
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
2631
|
+
if (Object.keys(form.errors).length)
|
|
2632
|
+
return;
|
|
2633
|
+
let newShowOtpPhone = null;
|
|
2634
|
+
if (listBlockAdded.findIndex((x) => x.name === LEADGEN_BLOCK.PhoneOtpBlock) > -1) {
|
|
2635
|
+
// not submit yet, open otp
|
|
2636
|
+
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;
|
|
2637
|
+
if ((_c = v[fieldName]) === null || _c === void 0 ? void 0 : _c.startsWith('+')) {
|
|
2638
|
+
newShowOtpPhone = {
|
|
2639
|
+
phone: v[fieldName],
|
|
2640
|
+
type: 'phone',
|
|
2641
|
+
};
|
|
2642
|
+
}
|
|
2643
|
+
}
|
|
2644
|
+
if (listBlockAdded.findIndex((x) => x.name === LEADGEN_BLOCK.WhatsappOtpBlock) > -1) {
|
|
2645
|
+
// not submit yet, open otp
|
|
2646
|
+
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;
|
|
2647
|
+
if ((_f = v[fieldName]) === null || _f === void 0 ? void 0 : _f.startsWith('+')) {
|
|
2648
|
+
newShowOtpPhone = {
|
|
2649
|
+
phone: v[fieldName],
|
|
2650
|
+
type: 'whatsapp',
|
|
2651
|
+
};
|
|
2652
|
+
}
|
|
2653
|
+
}
|
|
2654
|
+
if (listBlockAdded.findIndex((x) => x.name === LEADGEN_BLOCK.ZaloOtpBlock) > -1) {
|
|
2655
|
+
// not submit yet, open otp
|
|
2656
|
+
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;
|
|
2657
|
+
if ((_j = v[fieldName]) === null || _j === void 0 ? void 0 : _j.startsWith('+')) {
|
|
2658
|
+
newShowOtpPhone = {
|
|
2659
|
+
phone: v[fieldName],
|
|
2660
|
+
type: 'zalo',
|
|
2661
|
+
};
|
|
2662
|
+
}
|
|
2663
|
+
}
|
|
2664
|
+
if (newShowOtpPhone) {
|
|
2665
|
+
setIsSubmitLoading(true);
|
|
2666
|
+
Service.sendSMSOtpLead(newShowOtpPhone)
|
|
2667
|
+
.then((res) => {
|
|
2668
|
+
var _a;
|
|
2669
|
+
const respMessage = (_a = res === null || res === void 0 ? void 0 : res._messages) === null || _a === void 0 ? void 0 : _a[0];
|
|
2670
|
+
if (respMessage === 'This phone number was verified') {
|
|
2671
|
+
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(formRef.current, v);
|
|
2672
|
+
return;
|
|
2673
|
+
}
|
|
2674
|
+
setShowOtpPhone(newShowOtpPhone);
|
|
2675
|
+
})
|
|
2676
|
+
.finally(() => {
|
|
2677
|
+
setIsSubmitLoading(false);
|
|
2678
|
+
});
|
|
2679
|
+
return;
|
|
2680
|
+
}
|
|
2681
|
+
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(formRef.current, v);
|
|
2682
|
+
})(e);
|
|
2683
|
+
}, 100);
|
|
2684
|
+
};
|
|
2685
|
+
const onOpenChange = (_open) => {
|
|
2686
|
+
setOpen(_open);
|
|
2687
|
+
if (!_open) {
|
|
2688
|
+
setTimeout(() => {
|
|
2689
|
+
onClose();
|
|
2690
|
+
}, 250);
|
|
2691
|
+
}
|
|
2692
|
+
};
|
|
2693
|
+
const { width: imageBackgroundWidth, height: imageBackgroundHeight, loaded: imageBackgroundLoaded, } = useImageSize(imageBackground);
|
|
2694
|
+
const { loaded: imageMobileLoaded } = useImageSize(imageMobile);
|
|
2695
|
+
const { loaded: imageDesktopLoaded } = useImageSize(imageDesktop);
|
|
2696
|
+
const renderAfterImageSizes = imageMobileLoaded &&
|
|
2697
|
+
imageDesktopLoaded &&
|
|
2698
|
+
(isFullscreen ? imageBackgroundLoaded : true);
|
|
2699
|
+
const ButtonSubmit = !((_a = actionBlocks === null || actionBlocks === void 0 ? void 0 : actionBlocks.submitBlock) === null || _a === void 0 ? void 0 : _a.isHide) && (React__default["default"].createElement(core.Button, { size: "lg", id: "lead-submit", type: "submit", variant: "filled", className: "leadgen-btn leadgen-btn_action", color: primaryColor, loading: isSubmitLoading }, popUpSubmitText));
|
|
2700
|
+
const LinkButtonBlock = listBlockAdded.filter(({ name }) => name == LEADGEN_BLOCK.LinkButtonBlock);
|
|
2701
|
+
const ButtonLink = !!(LinkButtonBlock === null || LinkButtonBlock === void 0 ? void 0 : LinkButtonBlock.length) && (React__default["default"].createElement(React__default["default"].Fragment, null, LinkButtonBlock.map((item, index) => {
|
|
2702
|
+
var _a, _b, _c;
|
|
2703
|
+
return (React__default["default"].createElement(core.Button, { 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: () => {
|
|
2704
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
2705
|
+
onOtherSubmit === null || onOtherSubmit === void 0 ? void 0 : onOtherSubmit();
|
|
2706
|
+
} }, (_c = item === null || item === void 0 ? void 0 : item.data) === null || _c === void 0 ? void 0 : _c.value));
|
|
2707
|
+
})));
|
|
2708
|
+
const PopupHeader = showHeader && (React__default["default"].createElement("header", { className: core.clsx('leadgen-header', { 'leadgen-header_only': onlyHeader }) }, LEADGEN_SHOW_HEADER.includes(currentLayout) ? (React__default["default"].createElement(HeaderImage, { src: imageMobile, className: "lead-modal__image" })) : (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
2709
|
+
React__default["default"].createElement(HeaderImage, { src: imageDesktop, className: "le-only-desktop lead-modal__image" }),
|
|
2710
|
+
React__default["default"].createElement(HeaderImage, { src: imageMobile, className: "le-only-mobile lead-modal__image" })))));
|
|
2711
|
+
const PopupEmpty = showEmpty && (React__default["default"].createElement(EmptyComponent, { onClose: onClose, onContinue: () => setShowEmpty(false) }));
|
|
2712
|
+
const PopupForm = (React__default["default"].createElement(LeadFormProvider, { form: form },
|
|
2713
|
+
React__default["default"].createElement("form", { ref: formRef, className: "leadgen-form", onSubmit: middlewareOnSubmit },
|
|
2714
|
+
React__default["default"].createElement(FormContainer, { title: title, titleAlign: titleAlign, description: description, descriptionAlign: descriptionAlign, header: headerInsideFormContainer && PopupHeader, footer: hasForm ? ButtonSubmit : ButtonLink, "data-hidden-form": !hasForm },
|
|
2715
|
+
React__default["default"].createElement("div", { className: "leadgen-form_inner" },
|
|
2716
|
+
React__default["default"].createElement(LightboxFields, { listBlockAdded: listBlockAdded, popupId: popupId, locale: locale, onClose: onClose, onOtherSubmit: onOtherSubmit }))))));
|
|
2717
|
+
const PopupOtp = showOtpPhone && (React__default["default"].createElement(OtpBlock, { otpData: showOtpPhone, autoSendWhenOpen: false, onSuccess: () => {
|
|
2718
|
+
setShowOtpPhone(null);
|
|
2719
|
+
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(formRef.current, form.values);
|
|
2720
|
+
} }));
|
|
2721
|
+
const PopupThankYou = showThankyou && (React__default["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 }));
|
|
2722
|
+
const PopupContent = (React__default["default"].createElement("div", { className: core.clsx('leadgen-content', {
|
|
2723
|
+
'leadgen-content_small': limitFieldsLightBoxB,
|
|
2724
|
+
}) },
|
|
2725
|
+
!headerInsideFormContainer && PopupHeader,
|
|
2726
|
+
!onlyHeader && (React__default["default"].createElement("div", { className: "leadgen-inner" },
|
|
2727
|
+
PopupThankYou,
|
|
2728
|
+
!showThankyou && (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
2729
|
+
PopupOtp,
|
|
2730
|
+
PopupEmpty,
|
|
2731
|
+
!(showOtpPhone || showEmpty) && PopupForm))))));
|
|
2732
|
+
const styleOverlay = React.useMemo(() => {
|
|
2733
|
+
let styleContent = `.leadgen-inner {background-repeat: no-repeat;background-size: cover;background-position:center;}`;
|
|
2734
|
+
if (isMobile && imageOverlayMobile) {
|
|
2735
|
+
styleContent += `.leadgen-inner {background-image: url(${imageOverlayMobile});}`;
|
|
2736
|
+
}
|
|
2737
|
+
if (!isMobile && imageOverlayDesktop) {
|
|
2738
|
+
styleContent += `@media screen and (min-width:768px) {.leadgen-inner {background-image: url(${imageOverlayDesktop});}}`;
|
|
4045
2739
|
}
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
2740
|
+
return styleContent;
|
|
2741
|
+
}, [isMobile, imageOverlayDesktop, imageOverlayMobile]);
|
|
2742
|
+
const PopupWrapper = (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
2743
|
+
React__default["default"].createElement("style", { dangerouslySetInnerHTML: { __html: styleOverlay } }),
|
|
2744
|
+
React__default["default"].createElement("div", { className: core.clsx('leadgen-wrapper', {
|
|
2745
|
+
'leadgen-wrapper_small': limitFieldsLightBoxB,
|
|
2746
|
+
}) },
|
|
2747
|
+
showButtonClose && (React__default["default"].createElement(CloseButton, { onClose: () => onOpenChange(false), containerClassName: "leadgen-close_btn" })),
|
|
2748
|
+
PopupContent)));
|
|
2749
|
+
const popupContainerClassName = core.clsx('leadgen', `leadgen-${currentLayout}`, {
|
|
2750
|
+
'leadgen-lightbox': isLightBox,
|
|
2751
|
+
'leadgen-inline': isInPage,
|
|
2752
|
+
'leadgen-slider': isSlider,
|
|
2753
|
+
});
|
|
2754
|
+
const PopupContainer = isDrawer ? (React__default["default"].createElement(index$9.DrawerComponent, { fadeFromIndex: index$7.ZINDEX_SSO - 9e6, open: open, snapPoints: [0.8, 1], activeSnapPoint: snap, setActiveSnapPoint: setSnap, onOpenChange: onOpenChange, overlayClassName: popupContainerClassName, className: "leadgen-drawer" },
|
|
2755
|
+
PopupWrapper,
|
|
2756
|
+
React__default["default"].createElement("div", { style: { position: 'absolute', inset: 0, zIndex: snap === 1 ? -1 : 1 }, onClick: () => setSnap(1) }))) : (React__default["default"].createElement("div", { id: popupId, "data-popup-url": currentPath, "data-popup-type": "lightbox-inline", className: popupContainerClassName },
|
|
2757
|
+
isFullscreen ? (React__default["default"].createElement("img", { className: "le-only-desktop le-fullscreen-img", draggable: false, src: imageBackground || '', style: {
|
|
2758
|
+
aspectRatio: `${imageBackgroundWidth}/${imageBackgroundHeight}`,
|
|
2759
|
+
} })) : null,
|
|
2760
|
+
PopupWrapper));
|
|
2761
|
+
if (!renderAfterImageSizes)
|
|
2762
|
+
return null;
|
|
2763
|
+
if (isLightBox || isFullscreen || isSlider) {
|
|
2764
|
+
return PopupContainer;
|
|
2765
|
+
}
|
|
2766
|
+
else if (isSidebar) {
|
|
2767
|
+
return React__default["default"].createElement(SideBarLayout, { content: PopupContainer });
|
|
2768
|
+
}
|
|
2769
|
+
else if (isInline) {
|
|
2770
|
+
return (React__default["default"].createElement(InlineLayout, { content: PopupContainer, inlinePosition: extraFields.popupInlinePosition }));
|
|
2771
|
+
}
|
|
2772
|
+
return null;
|
|
2773
|
+
};
|
|
2774
|
+
|
|
2775
|
+
const SkinLayout = ({ popupId, link, linkText, linkNewTab, onClose, imageMobile, imageDesktop, currentLayout, onOtherSubmit, }) => {
|
|
2776
|
+
const currentPath = location.pathname;
|
|
2777
|
+
const { width: imageMobileWidth, height: imageMobileHeight, loaded: imageMobileLoaded, } = useImageSize(imageMobile);
|
|
2778
|
+
const { width: imageDesktopWidth, height: imageDesktopHeight, loaded: imageDesktopLoaded, } = useImageSize(imageDesktop);
|
|
2779
|
+
if (!imageMobileLoaded || !imageDesktopLoaded)
|
|
2780
|
+
return null;
|
|
2781
|
+
return (React__default["default"].createElement("div", { id: popupId, className: "lead-modal-wrapper", "data-popup-url": currentPath, "data-popup-type": "skin_ab" },
|
|
2782
|
+
currentLayout == 'SkinA' ? (React__default["default"].createElement("aside", { className: "le-only-desktop" },
|
|
2783
|
+
React__default["default"].createElement("div", { className: "le-skin-a-desktop" },
|
|
2784
|
+
React__default["default"].createElement("div", { style: { position: 'relative' } },
|
|
2785
|
+
React__default["default"].createElement("img", { src: imageDesktop, style: {
|
|
2786
|
+
aspectRatio: `${imageDesktopWidth}/${imageDesktopHeight}`,
|
|
2787
|
+
} }),
|
|
2788
|
+
React__default["default"].createElement("a", { style: {
|
|
2789
|
+
position: 'absolute',
|
|
2790
|
+
top: '75%',
|
|
2791
|
+
left: '50%',
|
|
2792
|
+
transform: 'translate(-50%, -50%)',
|
|
2793
|
+
textAlign: 'center',
|
|
2794
|
+
width: 'calc(100% - 15px)',
|
|
2795
|
+
}, href: link, target: linkNewTab ? 'blank' : '_parent' },
|
|
2796
|
+
React__default["default"].createElement("button", { onClick: onOtherSubmit, className: "le-joinbow-btn js-popup-other-submit" }, linkText)),
|
|
2797
|
+
React__default["default"].createElement(CloseButton, { onClose: onClose, containerClassName: "close-button-top-right" }))))) : currentLayout == 'SkinB' ? (React__default["default"].createElement("aside", { className: "le-only-desktop" },
|
|
2798
|
+
React__default["default"].createElement("div", { className: "" },
|
|
2799
|
+
React__default["default"].createElement("div", { style: { position: 'relative', zIndex: 10000 } },
|
|
2800
|
+
React__default["default"].createElement("img", { src: imageDesktop, style: {
|
|
2801
|
+
width: '100%',
|
|
2802
|
+
aspectRatio: `${imageDesktopWidth}/${imageDesktopHeight}`,
|
|
2803
|
+
} }),
|
|
2804
|
+
React__default["default"].createElement("a", { style: {
|
|
2805
|
+
position: 'absolute',
|
|
2806
|
+
top: '75%',
|
|
2807
|
+
left: '50%',
|
|
2808
|
+
transform: 'translate(-50%, -50%)',
|
|
2809
|
+
textAlign: 'center',
|
|
2810
|
+
width: '100%',
|
|
2811
|
+
}, href: link, target: linkNewTab ? 'blank' : '_parent' },
|
|
2812
|
+
React__default["default"].createElement("button", { onClick: onOtherSubmit, className: "le-joinbow-btn-mobile js-popup-other-submit" }, linkText)),
|
|
2813
|
+
React__default["default"].createElement(CloseButton, { containerClassName: "close-button-top-right", onClose: onClose }))))) : null,
|
|
2814
|
+
React__default["default"].createElement("aside", { className: "le-only-mobile" },
|
|
2815
|
+
React__default["default"].createElement("div", { className: "le-skin-mobile" },
|
|
2816
|
+
React__default["default"].createElement("div", { style: { position: 'relative' } },
|
|
2817
|
+
index$6.isVideo(imageMobile) ? (React__default["default"].createElement("video", { muted: true, autoPlay: true, loop: true },
|
|
2818
|
+
React__default["default"].createElement("source", { src: imageMobile, type: "video/mp4" }))) : (React__default["default"].createElement("img", { src: imageMobile, style: {
|
|
2819
|
+
width: '100%',
|
|
2820
|
+
aspectRatio: `${imageMobileWidth}/${imageMobileHeight}`,
|
|
2821
|
+
} })),
|
|
2822
|
+
React__default["default"].createElement("a", { style: {
|
|
2823
|
+
position: 'absolute',
|
|
2824
|
+
top: '82%',
|
|
2825
|
+
left: '50%',
|
|
2826
|
+
transform: 'translate(-50%, -50%)',
|
|
2827
|
+
textAlign: 'center',
|
|
2828
|
+
maxWidth: 'calc(100% - 15px)',
|
|
2829
|
+
}, href: link, target: linkNewTab ? 'blank' : '_parent' },
|
|
2830
|
+
React__default["default"].createElement("button", { onClick: onOtherSubmit, className: "le-joinbow-btn-mobile js-popup-other-submit" }, linkText)),
|
|
2831
|
+
React__default["default"].createElement(CloseButton, { containerClassName: "close-button-top-right", svgClassName: "le-mobile-btn", onClose: onClose }))))));
|
|
4070
2832
|
};
|
|
4071
2833
|
|
|
4072
2834
|
// url: imageBlocks.imageMobile.data.url
|
|
4073
2835
|
// newTab: imageBlocks.imageMobile.data.newtab
|
|
4074
2836
|
// image: campaignShow.image
|
|
4075
2837
|
// imageDestkop: campaignShow.image_desktop
|
|
4076
|
-
const
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
2838
|
+
const TabLayout = ({ popupId, url, newTab, image, onClose, onOtherSubmit, }) => {
|
|
2839
|
+
const { width: imageWidth, height: imageHeight, loaded: imageLoaded, } = useImageSize(image);
|
|
2840
|
+
if (!imageLoaded)
|
|
2841
|
+
return null;
|
|
2842
|
+
return (React__default["default"].createElement("div", { id: popupId, className: "lead-modal-wrapper", "data-popup-url": location.pathname, "data-popup-type": "tab" },
|
|
2843
|
+
React__default["default"].createElement("div", { className: "le-tab-popup" },
|
|
2844
|
+
React__default["default"].createElement("div", { style: { position: 'relative' } },
|
|
2845
|
+
React__default["default"].createElement("a", { href: url, target: newTab ? 'blank' : '_parent', onClick: onOtherSubmit },
|
|
2846
|
+
React__default["default"].createElement("img", { className: "js-popup-other-submit", src: image, style: {
|
|
2847
|
+
aspectRatio: `${imageWidth}/${imageHeight}`,
|
|
2848
|
+
} })),
|
|
2849
|
+
React__default["default"].createElement(CloseButton, { onClose: onClose, containerClassName: "close-button-top-right" })))));
|
|
2850
|
+
};
|
|
2851
|
+
|
|
2852
|
+
// import mockLeadData from './mockLeadData'
|
|
2853
|
+
const listCampaignScheduled = [];
|
|
2854
|
+
const listCampaignScheduledToActivated = [];
|
|
2855
|
+
const listCampaignActiveButExpired = [];
|
|
2856
|
+
const listCampaignExcludeSonsored = [];
|
|
2857
|
+
const listCampaignDifferentSponsor = [];
|
|
2858
|
+
const listCampaignNotDisplayInRangeOfTime = [];
|
|
2859
|
+
function isMobile() {
|
|
2860
|
+
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|Opera Mini/i.test(navigator.userAgent);
|
|
2861
|
+
}
|
|
2862
|
+
const getShuffleArray = (array) => {
|
|
2863
|
+
const newArray = [...array];
|
|
2864
|
+
for (let i = newArray.length - 1; i > 0; i--) {
|
|
2865
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
2866
|
+
const temp = newArray[i];
|
|
2867
|
+
newArray[i] = newArray[j];
|
|
2868
|
+
newArray[j] = temp;
|
|
2869
|
+
}
|
|
2870
|
+
return newArray;
|
|
2871
|
+
};
|
|
2872
|
+
const getTimeByTimezone = (timeZone = 'UTC') => {
|
|
2873
|
+
const date = new Date();
|
|
2874
|
+
return new Date(date.toLocaleString('en-US', { timeZone }));
|
|
2875
|
+
};
|
|
2876
|
+
const parseDateByCampaignTime = (dateStr) => {
|
|
2877
|
+
// Format like this: 2023-04-04 00:00:00
|
|
2878
|
+
try {
|
|
2879
|
+
const [datePart, timePart] = dateStr.split(' ');
|
|
2880
|
+
const [year, month, day] = datePart.split('-').map(Number);
|
|
2881
|
+
const [hours, minutes, seconds] = timePart.split(':').map(Number);
|
|
2882
|
+
/** JavaScript counts months from 0 to 11 */
|
|
2883
|
+
return new Date(year, month - 1, day, hours, minutes, seconds);
|
|
2884
|
+
}
|
|
2885
|
+
catch (err) {
|
|
2886
|
+
return null;
|
|
2887
|
+
}
|
|
2888
|
+
};
|
|
2889
|
+
const checkCampaignNowInTimeframe = (c) => {
|
|
2890
|
+
var _a;
|
|
2891
|
+
const siteId = ((_a = c.site) === null || _a === void 0 ? void 0 : _a.id) || 1;
|
|
2892
|
+
const startedAtStr = c.started_at;
|
|
2893
|
+
const endedAtStr = c.ended_at;
|
|
2894
|
+
const startedDate = parseDateByCampaignTime(startedAtStr);
|
|
2895
|
+
const endedDate = parseDateByCampaignTime(endedAtStr);
|
|
2896
|
+
if (!startedDate || !endedDate) {
|
|
2897
|
+
return false;
|
|
2898
|
+
}
|
|
2899
|
+
const timeZone = LEAD_TIMEZONE_DATA[siteId];
|
|
2900
|
+
const nowWithTimezoneMs = getTimeByTimezone(timeZone).getTime();
|
|
2901
|
+
if (nowWithTimezoneMs <= endedDate.getTime() &&
|
|
2902
|
+
nowWithTimezoneMs >= startedDate.getTime()) {
|
|
2903
|
+
listCampaignScheduledToActivated.push(c);
|
|
2904
|
+
return true;
|
|
2905
|
+
}
|
|
2906
|
+
return false;
|
|
2907
|
+
};
|
|
2908
|
+
function checkCampaignActiveButExpireAlready(c) {
|
|
2909
|
+
var _a;
|
|
2910
|
+
/** Do not setup timeframe for this campaign. No need to check */
|
|
2911
|
+
if (c.forever === 1) {
|
|
2912
|
+
return true;
|
|
2913
|
+
}
|
|
2914
|
+
const startedAtStr = c.started_at;
|
|
2915
|
+
const endedAtStr = c.ended_at;
|
|
2916
|
+
const startedDate = parseDateByCampaignTime(startedAtStr);
|
|
2917
|
+
const endedDate = parseDateByCampaignTime(endedAtStr);
|
|
2918
|
+
/** Do not setup timeframe for this campaign. No need to check */
|
|
2919
|
+
if (!startedDate || !endedDate) {
|
|
2920
|
+
return true;
|
|
2921
|
+
}
|
|
2922
|
+
const siteId = ((_a = c.site) === null || _a === void 0 ? void 0 : _a.id) || 1;
|
|
2923
|
+
const timeZone = LEAD_TIMEZONE_DATA[siteId];
|
|
2924
|
+
const nowWithTimezoneMs = getTimeByTimezone(timeZone).getTime();
|
|
2925
|
+
/** Check if this expire already, do not show */
|
|
2926
|
+
if (nowWithTimezoneMs > endedDate.getTime()) {
|
|
2927
|
+
listCampaignActiveButExpired.push(c);
|
|
2928
|
+
return false;
|
|
2929
|
+
}
|
|
2930
|
+
return true;
|
|
2931
|
+
}
|
|
2932
|
+
function shouldNotDisplayIfExcludeAllSponsors(c) {
|
|
2933
|
+
var _a;
|
|
2934
|
+
const excludeSponsored = Number((_a = c.rules.find((i) => i.rule == 'exclude_sponsored')) === null || _a === void 0 ? void 0 : _a.value);
|
|
2935
|
+
const isSponsored = Boolean(document.querySelector('.hhg-disclaimer-text'));
|
|
2936
|
+
if (isSponsored && excludeSponsored) {
|
|
2937
|
+
listCampaignExcludeSonsored.push(c);
|
|
2938
|
+
return true;
|
|
2939
|
+
}
|
|
2940
|
+
return false;
|
|
2941
|
+
}
|
|
2942
|
+
function shouldDisplayWithCurrentSponsor(c) {
|
|
2943
|
+
var _a, _b;
|
|
2944
|
+
try {
|
|
2945
|
+
// TODO: BE will rename `exclude_sponsored_list` later
|
|
2946
|
+
const stringOrArray = (_a = c.rules.find((i) => i.rule == 'exclude_sponsored_list')) === null || _a === void 0 ? void 0 : _a.value;
|
|
2947
|
+
const whiteListSponsors = stringOrArray instanceof Array ? stringOrArray : JSON.parse(stringOrArray);
|
|
2948
|
+
const dataSponsoredId = Number((_b = document
|
|
2949
|
+
.querySelector('[data-sponsored-id]')) === null || _b === void 0 ? void 0 : _b.getAttribute('data-sponsored-id'));
|
|
2950
|
+
// There is no config for sponsor id and white list, should show as default
|
|
2951
|
+
if (!dataSponsoredId ||
|
|
2952
|
+
dataSponsoredId <= 0 ||
|
|
2953
|
+
whiteListSponsors.length === 0) {
|
|
2954
|
+
return true;
|
|
4099
2955
|
}
|
|
4100
|
-
|
|
4101
|
-
|
|
2956
|
+
// Check the dataSponsoredId exists in the white list or not.
|
|
2957
|
+
const isExist = whiteListSponsors.find((s) => s.id == dataSponsoredId);
|
|
2958
|
+
if (isExist) {
|
|
2959
|
+
return true;
|
|
4102
2960
|
}
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
const listBlockAdded = JSON.parse(extraFields.listBlockAdded);
|
|
4106
|
-
const actionBlocks = JSON.parse(extraFields.actionBlocks);
|
|
4107
|
-
const popUpSubmitText = actionBlocks.submitBlock.data.value;
|
|
4108
|
-
const currentPath = location.pathname;
|
|
4109
|
-
const { align: descriptionAlign, value: description } = textBlocks.subtitleBlock.data || {};
|
|
4110
|
-
const { align: titleAlign } = textBlocks.titleBlock.data || {};
|
|
4111
|
-
const isSlider = currentLayout === LEADGEN_LAYOUT.Slider;
|
|
4112
|
-
const isSidebar = currentLayout === LEADGEN_LAYOUT.Sidebar;
|
|
4113
|
-
const isLightBox = currentLayout.includes('LightBox');
|
|
4114
|
-
const isLightBoxA = currentLayout === LEADGEN_LAYOUT.LightBoxA;
|
|
4115
|
-
const isLightBoxB = currentLayout === LEADGEN_LAYOUT.LightBoxB;
|
|
4116
|
-
const isInline = currentLayout.includes('Inline');
|
|
4117
|
-
const isFullscreen = currentLayout === LEADGEN_LAYOUT.Fullscreen;
|
|
4118
|
-
const isInPage = isInline || isSidebar;
|
|
4119
|
-
const isDrawer = isLightBoxB && isMobile;
|
|
4120
|
-
const limitFieldsLightBoxB = isLightBoxB && listBlockAdded.length <= LEADGEN_LIMIT_LIGHTBOXB;
|
|
4121
|
-
const hasForm = isLightBoxA
|
|
4122
|
-
? listBlockAdded.some((item) => LEADGEN_BLOCK_INPUT.some((k) => k === (item === null || item === void 0 ? void 0 : item.name)))
|
|
4123
|
-
: true;
|
|
4124
|
-
const headerInsideFormContainer = isSlider || isLightBoxA || isFullscreen;
|
|
4125
|
-
const showHeader = !!imageMobile || !!imageDesktop;
|
|
4126
|
-
const onlyHeader = !title && !description;
|
|
4127
|
-
const showButtonClose = !isInline;
|
|
4128
|
-
if (window.innerWidth < 769 &&
|
|
4129
|
-
LEADGEN_LAYOUT_NOT_SHOW_IN_MOBILE.includes(currentLayout)) {
|
|
4130
|
-
console.log('😎 Not show fullscreen, slider on mobile ');
|
|
4131
|
-
return null;
|
|
2961
|
+
listCampaignDifferentSponsor.push({ id: c.id, rules: c.rules });
|
|
2962
|
+
return false;
|
|
4132
2963
|
}
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
2964
|
+
catch (err) {
|
|
2965
|
+
// Default is show
|
|
2966
|
+
return true;
|
|
2967
|
+
}
|
|
2968
|
+
}
|
|
2969
|
+
const filterFnCampaign = (c) => {
|
|
2970
|
+
if (shouldNotDisplayIfExcludeAllSponsors(c)) {
|
|
2971
|
+
return false;
|
|
2972
|
+
}
|
|
2973
|
+
else if (!shouldDisplayWithCurrentSponsor(c)) {
|
|
2974
|
+
return false;
|
|
2975
|
+
}
|
|
2976
|
+
/** Active */
|
|
2977
|
+
if (c.formatted_status === 1) {
|
|
2978
|
+
return checkCampaignActiveButExpireAlready(c);
|
|
2979
|
+
}
|
|
2980
|
+
/** Schedule */
|
|
2981
|
+
if (c.formatted_status === 0) {
|
|
2982
|
+
listCampaignScheduled.push(c);
|
|
2983
|
+
return checkCampaignNowInTimeframe(c);
|
|
2984
|
+
}
|
|
2985
|
+
return false;
|
|
2986
|
+
};
|
|
2987
|
+
const fillterApprearanceTimeCampaign = (c) => {
|
|
2988
|
+
var _a;
|
|
2989
|
+
try {
|
|
2990
|
+
const isTimeInRange = (currentTime, startTime, endTime) => {
|
|
2991
|
+
const startParts = startTime.split(':');
|
|
2992
|
+
const endParts = endTime.split(':');
|
|
2993
|
+
const startDate = new Date();
|
|
2994
|
+
startDate.setHours(Number(startParts[0]), Number(startParts[1]), 0, 0);
|
|
2995
|
+
const endDate = new Date();
|
|
2996
|
+
endDate.setHours(Number(endParts[0]), Number(endParts[1]), 0, 0);
|
|
2997
|
+
return currentTime >= startDate && currentTime <= endDate;
|
|
2998
|
+
};
|
|
2999
|
+
const rulesApprValue = (_a = c.rules.find((i) => i.rule == 'appearance_time')) === null || _a === void 0 ? void 0 : _a.value;
|
|
3000
|
+
const startTime = rulesApprValue.startTime;
|
|
3001
|
+
const endTime = rulesApprValue.endTime || '23:59';
|
|
3002
|
+
if (!startTime) {
|
|
3003
|
+
return true;
|
|
4139
3004
|
}
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
const validatingPhoneRef = React.useRef(false);
|
|
4143
|
-
const validatingEmailRef = React.useRef(false);
|
|
4144
|
-
const { form, validateObj } = useLeadFormConfig({
|
|
4145
|
-
listBlockAdded,
|
|
4146
|
-
validatingPhoneRef,
|
|
4147
|
-
validatingEmailRef,
|
|
4148
|
-
campaignId,
|
|
4149
|
-
campaign_subot_id,
|
|
4150
|
-
userInfo,
|
|
4151
|
-
format: (_a = (index$6.ISO_FORMAT[locale] || index$6.ISO_FORMAT['vi-VN'])) === null || _a === void 0 ? void 0 : _a.dateFormat,
|
|
4152
|
-
});
|
|
4153
|
-
const onFocus = (e) => {
|
|
4154
|
-
const target = e.target;
|
|
4155
|
-
target.scrollIntoView({
|
|
4156
|
-
block: 'center',
|
|
4157
|
-
inline: 'nearest',
|
|
4158
|
-
behavior: 'auto',
|
|
4159
|
-
});
|
|
4160
|
-
};
|
|
4161
|
-
const middlewareOnSubmit = (e) => {
|
|
4162
|
-
e.preventDefault();
|
|
4163
|
-
// mark all as touched to allow validation
|
|
4164
|
-
const fields = Object.keys(validateObj);
|
|
4165
|
-
const fieldStatus = fields.reduce((acc, cur) => {
|
|
4166
|
-
acc[cur] = true;
|
|
4167
|
-
return acc;
|
|
4168
|
-
}, {});
|
|
4169
|
-
form.setTouched(fieldStatus);
|
|
4170
|
-
if (validatingEmailRef.current || validatingPhoneRef.current) {
|
|
4171
|
-
return;
|
|
3005
|
+
if (isTimeInRange(new Date(), startTime, endTime)) {
|
|
3006
|
+
return true;
|
|
4172
3007
|
}
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
3008
|
+
listCampaignNotDisplayInRangeOfTime.push(c);
|
|
3009
|
+
return false;
|
|
3010
|
+
}
|
|
3011
|
+
catch (err) {
|
|
3012
|
+
return true;
|
|
3013
|
+
}
|
|
3014
|
+
};
|
|
3015
|
+
let timeoutRef = null;
|
|
3016
|
+
let LEAD_SCROLL_EVENT = null;
|
|
3017
|
+
function clearPassiveEvent() {
|
|
3018
|
+
if (timeoutRef) {
|
|
3019
|
+
clearTimeout(timeoutRef);
|
|
3020
|
+
timeoutRef = null;
|
|
3021
|
+
}
|
|
3022
|
+
if (LEAD_SCROLL_EVENT) {
|
|
3023
|
+
window.removeEventListener('scroll', LEAD_SCROLL_EVENT);
|
|
3024
|
+
LEAD_SCROLL_EVENT = null;
|
|
3025
|
+
}
|
|
3026
|
+
}
|
|
3027
|
+
function checkShowPopup({ leadApi, leadSiteId, leadDomain, onShowPopup, DEBUG_URL, }) {
|
|
3028
|
+
// clear previous passive event, check for new condition
|
|
3029
|
+
clearPassiveEvent();
|
|
3030
|
+
const leadCurrentUrl = DEBUG_URL ||
|
|
3031
|
+
('https://' +
|
|
3032
|
+
location.hostname +
|
|
3033
|
+
location.pathname +
|
|
3034
|
+
location.search).toLowerCase();
|
|
3035
|
+
fetch(leadApi + 'api/campaign/' + leadSiteId, {
|
|
3036
|
+
method: 'POST',
|
|
3037
|
+
headers: {
|
|
3038
|
+
'Content-Type': 'application/json',
|
|
3039
|
+
},
|
|
3040
|
+
body: JSON.stringify({
|
|
3041
|
+
url: leadCurrentUrl,
|
|
3042
|
+
ga_client_id: miscCookieHelper.getCookie('_ga') || null,
|
|
3043
|
+
}),
|
|
3044
|
+
})
|
|
3045
|
+
.then((response) => {
|
|
3046
|
+
return response.json();
|
|
3047
|
+
// return mockLeadData || response.json()
|
|
3048
|
+
})
|
|
3049
|
+
.then((data) => {
|
|
3050
|
+
var _a, _b, _c, _d;
|
|
3051
|
+
LeadLog('List campagin: ', data);
|
|
3052
|
+
LEAD_RESET_VAR();
|
|
3053
|
+
if (data._status == 1) {
|
|
3054
|
+
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);
|
|
3055
|
+
if (!miscCookieHelper.getCookie('hhg-id')) {
|
|
3056
|
+
miscCookieHelper.setCookie('hhg-id', uuid.v1(), {
|
|
3057
|
+
domain: '.' + leadDomain,
|
|
3058
|
+
path: '/',
|
|
3059
|
+
});
|
|
3060
|
+
LeadLog('😍 Set HHG ID cookie');
|
|
3061
|
+
}
|
|
3062
|
+
// getCookie('hhg-id')
|
|
3063
|
+
// TODO: HP-534 Filter desktop
|
|
3064
|
+
let campaignsDevice = [];
|
|
3065
|
+
if (isMobile()) {
|
|
3066
|
+
campaignsDevice = campaigns.filter((c) => c.device_types.some((d) => d.id == LEAD_DEVICE_TYPE.MOBILE));
|
|
3067
|
+
}
|
|
3068
|
+
else {
|
|
3069
|
+
campaignsDevice = campaigns.filter((c) => c.device_types.some((d) => d.id == LEAD_DEVICE_TYPE.DESKTOP));
|
|
3070
|
+
}
|
|
3071
|
+
LeadLog(`👓 campaignsDevice`, campaignsDevice);
|
|
3072
|
+
LeadLog('--listCampaignScheduled', listCampaignScheduled);
|
|
3073
|
+
LeadLog('--listCampaignScheduledToActivated', listCampaignScheduledToActivated);
|
|
3074
|
+
LeadLog('--listCampaignActiveButExpired', listCampaignActiveButExpired);
|
|
3075
|
+
LeadLog('--listCampaignExcludeSonsored', listCampaignExcludeSonsored);
|
|
3076
|
+
LeadLog('--listCampaignDifferentSponsor', listCampaignDifferentSponsor);
|
|
3077
|
+
LeadLog('--listCampaignNotDisplayInRangeOfTime', listCampaignNotDisplayInRangeOfTime);
|
|
3078
|
+
// Check links
|
|
3079
|
+
let listLinksObj = campaignsDevice
|
|
3080
|
+
.map((i, index) => i.targets
|
|
3081
|
+
.filter((i) => i.type == CAMPAIGN_TARGET_TYPE.LINKS)
|
|
3082
|
+
.map((i) => (Object.assign(Object.assign({}, i), { campaignIndex: index }))))
|
|
3083
|
+
.flat(1);
|
|
3084
|
+
// Check list link match current href
|
|
3085
|
+
listLinksObj = listLinksObj.filter((i) => {
|
|
3086
|
+
var _a;
|
|
3087
|
+
const target = new URL(String(i.target).toLowerCase());
|
|
3088
|
+
if (i.option == 'exact_match')
|
|
3089
|
+
// FOR TEST LOCAL:
|
|
3090
|
+
// return Boolean(location.pathname === target.pathname)
|
|
3091
|
+
return Boolean(leadCurrentUrl === ((_a = target.href) === null || _a === void 0 ? void 0 : _a.toLowerCase()));
|
|
3092
|
+
if (i.option == 'start_with') {
|
|
3093
|
+
// FOR TEST LOCAL:
|
|
3094
|
+
// if (location.pathname.includes(target.pathname)) {
|
|
3095
|
+
if (leadCurrentUrl.includes(String(i.target).toLowerCase())) {
|
|
3096
|
+
const listExcluding = i.sub_target
|
|
3097
|
+
.filter((i) => i.option == 'excluding')
|
|
3098
|
+
.map((i) => { var _a; return (_a = i.value) === null || _a === void 0 ? void 0 : _a.toLowerCase(); });
|
|
3099
|
+
return !listExcluding.includes(leadCurrentUrl.split('?')[0]);
|
|
4187
3100
|
}
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
// not submit yet, open otp
|
|
4191
|
-
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;
|
|
4192
|
-
if ((_f = v[fieldName]) === null || _f === void 0 ? void 0 : _f.startsWith('+')) {
|
|
4193
|
-
newShowOtpPhone = {
|
|
4194
|
-
phone: v[fieldName],
|
|
4195
|
-
type: 'whatsapp',
|
|
4196
|
-
};
|
|
3101
|
+
else {
|
|
3102
|
+
return false;
|
|
4197
3103
|
}
|
|
4198
3104
|
}
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
3105
|
+
});
|
|
3106
|
+
// Check tags
|
|
3107
|
+
const listMetaTag = Array.from(document.getElementsByTagName('META')).filter((i) => i.getAttribute('property') == 'article:tag');
|
|
3108
|
+
const listTags = listMetaTag.map((i) => i.content);
|
|
3109
|
+
let listCampaignHasTag = [];
|
|
3110
|
+
let listTagsObj = [];
|
|
3111
|
+
if (listTags && listTags.length) {
|
|
3112
|
+
listCampaignHasTag = campaignsDevice
|
|
3113
|
+
.map((i, index) => i.targets
|
|
3114
|
+
.filter((i) => i.type == CAMPAIGN_TARGET_TYPE.TAGS)
|
|
3115
|
+
.map((i) => (Object.assign(Object.assign({}, i), { campaignIndex: index }))))
|
|
3116
|
+
.flat(1);
|
|
3117
|
+
listTagsObj = listCampaignHasTag.filter((i) => listTags.includes(i.target));
|
|
3118
|
+
}
|
|
3119
|
+
const listCampaginsMatch = [...listLinksObj, ...listTagsObj];
|
|
3120
|
+
const cookieKeys = document.cookie
|
|
3121
|
+
.split('; ')
|
|
3122
|
+
.map((i) => i.split('=')[0]);
|
|
3123
|
+
const listCampaignCodeSubmited = cookieKeys.filter((i) => i.includes('lead_submited'));
|
|
3124
|
+
LeadLog(`--listCampaignCodeSubmited`, listCampaignCodeSubmited);
|
|
3125
|
+
const listCampaignCodeClosed = cookieKeys.filter((i) => i.includes('lead_closed'));
|
|
3126
|
+
LeadLog(`--listCampaignCodeClosed`, listCampaignCodeClosed);
|
|
3127
|
+
const listCampaignSubmitedClosed = [
|
|
3128
|
+
...listCampaignCodeSubmited,
|
|
3129
|
+
...listCampaignCodeClosed,
|
|
3130
|
+
];
|
|
3131
|
+
const listCampaignNoSubmitedClosed = listCampaginsMatch.filter((i) => {
|
|
3132
|
+
const hasSubmited = listCampaignSubmitedClosed.some((k) => k.includes(campaignsDevice[i.campaignIndex].code));
|
|
3133
|
+
return !hasSubmited;
|
|
3134
|
+
});
|
|
3135
|
+
const listCampaignValid = getShuffleArray(listCampaignNoSubmitedClosed);
|
|
3136
|
+
// .sort(
|
|
3137
|
+
// (a, b) =>
|
|
3138
|
+
// (listCampaignValid[a.campaignIndex]?.score || 0) -
|
|
3139
|
+
// (listCampaignValid[b.campaignIndex]?.score || 0),
|
|
3140
|
+
// )
|
|
3141
|
+
LeadLog('--listCampaignValid : ', listCampaignValid);
|
|
3142
|
+
if (listCampaignValid && listCampaignValid.length) {
|
|
3143
|
+
const CAMPAIGN_SHOW = campaignsDevice[listCampaignValid[0].campaignIndex];
|
|
3144
|
+
LeadLog(`CAMPAIGN_SHOW`, CAMPAIGN_SHOW);
|
|
3145
|
+
const { rules } = CAMPAIGN_SHOW;
|
|
3146
|
+
// CHECK RULE TRIGGER POPUP
|
|
3147
|
+
const timeoutRule = Number((_c = rules.find((i) => i.rule == 'time')) === null || _c === void 0 ? void 0 : _c.value);
|
|
3148
|
+
LeadLog(`timeoutRule`, timeoutRule);
|
|
3149
|
+
const scrollRule = Number((_d = rules.find((i) => i.rule == 'scroll')) === null || _d === void 0 ? void 0 : _d.value);
|
|
3150
|
+
LeadLog(`scrollRule`, scrollRule);
|
|
3151
|
+
let impressionAction = 'TIME';
|
|
3152
|
+
if (Number.isInteger(timeoutRule)) {
|
|
3153
|
+
impressionAction = 'TIME';
|
|
3154
|
+
LeadLog('✨ SHOW AWESOME POPUP AFTER: ', timeoutRule, ' seconds');
|
|
3155
|
+
timeoutRef = setTimeout(() => {
|
|
3156
|
+
onShowPopup === null || onShowPopup === void 0 ? void 0 : onShowPopup(CAMPAIGN_SHOW, impressionAction);
|
|
3157
|
+
}, timeoutRule * 1000);
|
|
4208
3158
|
}
|
|
4209
|
-
if (
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
3159
|
+
if (Number.isInteger(scrollRule)) {
|
|
3160
|
+
impressionAction = 'SCROLL';
|
|
3161
|
+
LeadLog('✨ SHOW AWESOME AFTER: SCROLL', scrollRule, ' %');
|
|
3162
|
+
const $p = document.querySelector(`[data-url="${location.pathname}"]`) ||
|
|
3163
|
+
document.querySelector('body');
|
|
3164
|
+
const pct = $p.getBoundingClientRect().top;
|
|
3165
|
+
const pb = $p.offsetHeight;
|
|
3166
|
+
LeadLog(`👓 Element check scroll: `, $p);
|
|
3167
|
+
LEAD_SCROLL_EVENT = function leadScollCheckHandler() {
|
|
3168
|
+
const wt = window.pageYOffset || document.documentElement.scrollTop;
|
|
3169
|
+
let percent = 0;
|
|
3170
|
+
if (wt >= pct) {
|
|
3171
|
+
percent = Math.round(((wt - pct) / (pb - innerHeight)) * 100);
|
|
4218
3172
|
}
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
3173
|
+
LeadLog('---Scroll', percent, scrollRule);
|
|
3174
|
+
// TODO: CHECK FOOTER HEIGHT
|
|
3175
|
+
if (percent >= scrollRule) {
|
|
3176
|
+
window.removeEventListener('scroll', LEAD_SCROLL_EVENT);
|
|
3177
|
+
onShowPopup === null || onShowPopup === void 0 ? void 0 : onShowPopup(CAMPAIGN_SHOW, impressionAction);
|
|
3178
|
+
}
|
|
3179
|
+
};
|
|
3180
|
+
window.addEventListener('scroll', LEAD_SCROLL_EVENT, {
|
|
3181
|
+
passive: true,
|
|
4223
3182
|
});
|
|
4224
|
-
return;
|
|
4225
3183
|
}
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
const onOpenChange = (_open) => {
|
|
4231
|
-
setOpen(_open);
|
|
4232
|
-
if (!_open) {
|
|
4233
|
-
setTimeout(() => {
|
|
4234
|
-
onClose();
|
|
4235
|
-
}, 250);
|
|
4236
|
-
}
|
|
4237
|
-
};
|
|
4238
|
-
const { width: imageBackgroundWidth, height: imageBackgroundHeight, loaded: imageBackgroundLoaded, } = useImageSize(imageBackground);
|
|
4239
|
-
const { loaded: imageMobileLoaded } = useImageSize(imageMobile);
|
|
4240
|
-
const { loaded: imageDesktopLoaded } = useImageSize(imageDesktop);
|
|
4241
|
-
const renderAfterImageSizes = imageMobileLoaded &&
|
|
4242
|
-
imageDesktopLoaded &&
|
|
4243
|
-
(isFullscreen ? imageBackgroundLoaded : true);
|
|
4244
|
-
const ButtonSubmit = React.useMemo(() => {
|
|
4245
|
-
var _a;
|
|
4246
|
-
return !((_a = actionBlocks === null || actionBlocks === void 0 ? void 0 : actionBlocks.submitBlock) === null || _a === void 0 ? void 0 : _a.isHide) && (React__default["default"].createElement(core.Button, { size: "lg", id: "lead-submit", type: "submit", variant: "filled", className: "leadgen-btn leadgen-btn_action", loading: isSubmitLoading }, popUpSubmitText));
|
|
4247
|
-
}, [popUpSubmitText, isSubmitLoading, (_b = actionBlocks === null || actionBlocks === void 0 ? void 0 : actionBlocks.submitBlock) === null || _b === void 0 ? void 0 : _b.isHide]);
|
|
4248
|
-
const LinkButtonBlock = listBlockAdded.filter(({ name }) => name == LEADGEN_BLOCK.LinkButtonBlock);
|
|
4249
|
-
const ButtonLink = !!(LinkButtonBlock === null || LinkButtonBlock === void 0 ? void 0 : LinkButtonBlock.length) && (React__default["default"].createElement(React__default["default"].Fragment, null, LinkButtonBlock.map((item, index) => {
|
|
4250
|
-
var _a, _b, _c;
|
|
4251
|
-
return (React__default["default"].createElement(core.Button, { 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: () => {
|
|
4252
|
-
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
4253
|
-
onOtherSubmit === null || onOtherSubmit === void 0 ? void 0 : onOtherSubmit();
|
|
4254
|
-
} }, (_c = item === null || item === void 0 ? void 0 : item.data) === null || _c === void 0 ? void 0 : _c.value));
|
|
4255
|
-
})));
|
|
4256
|
-
const PopupHeader = showHeader && (React__default["default"].createElement("header", { className: core.clsx('leadgen-header', { 'leadgen-header_only': onlyHeader }) }, LEADGEN_SHOW_HEADER.includes(currentLayout) ? (React__default["default"].createElement(HeaderImage, { src: imageMobile, className: "lead-modal__image" })) : (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
4257
|
-
React__default["default"].createElement(HeaderImage, { src: imageDesktop, className: "le-only-desktop lead-modal__image" }),
|
|
4258
|
-
React__default["default"].createElement(HeaderImage, { src: imageMobile, className: "le-only-mobile lead-modal__image" })))));
|
|
4259
|
-
const PopupEmpty = showEmpty && (React__default["default"].createElement(EmptyComponent, { onClose: onClose, onContinue: () => setShowEmpty(false) }));
|
|
4260
|
-
const PopupForm = (React__default["default"].createElement(LeadFormProvider, { form: form },
|
|
4261
|
-
React__default["default"].createElement("form", { ref: formRef, className: "leadgen-form", onFocus: onFocus, onSubmit: middlewareOnSubmit },
|
|
4262
|
-
React__default["default"].createElement(FormContainer, { title: title, titleAlign: titleAlign, description: description, descriptionAlign: descriptionAlign, header: headerInsideFormContainer && PopupHeader, footer: hasForm ? ButtonSubmit : ButtonLink, "data-hidden-form": !hasForm },
|
|
4263
|
-
React__default["default"].createElement("div", { className: "leadgen-form_inner" },
|
|
4264
|
-
React__default["default"].createElement(LightboxFields, { listBlockAdded: listBlockAdded, popupId: popupId, locale: locale, onClose: onClose, onOtherSubmit: onOtherSubmit }))))));
|
|
4265
|
-
const PopupOtp = showOtpPhone && (React__default["default"].createElement(OtpBlock, { otpData: showOtpPhone, autoSendWhenOpen: false, onSuccess: () => {
|
|
4266
|
-
setShowOtpPhone(null);
|
|
4267
|
-
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(formRef.current, form.values);
|
|
4268
|
-
} }));
|
|
4269
|
-
const PopupThankYou = showThankyou && (React__default["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 }));
|
|
4270
|
-
const PopupContent = (React__default["default"].createElement("div", { className: core.clsx('leadgen-content', {
|
|
4271
|
-
'leadgen-content_small': limitFieldsLightBoxB,
|
|
4272
|
-
}) },
|
|
4273
|
-
!headerInsideFormContainer && PopupHeader,
|
|
4274
|
-
!onlyHeader && (React__default["default"].createElement("div", { className: "leadgen-inner" },
|
|
4275
|
-
PopupThankYou,
|
|
4276
|
-
!showThankyou && (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
4277
|
-
PopupOtp,
|
|
4278
|
-
PopupEmpty,
|
|
4279
|
-
!(showOtpPhone || showEmpty) && PopupForm))))));
|
|
4280
|
-
const styleOverlay = React.useMemo(() => {
|
|
4281
|
-
let styleContent = `.leadgen-inner {background-repeat: no-repeat;background-size: cover;background-position:center;}`;
|
|
4282
|
-
if (isMobile && imageOverlayMobile) {
|
|
4283
|
-
styleContent += `.leadgen-inner {background-image: url(${imageOverlayMobile});}`;
|
|
4284
|
-
}
|
|
4285
|
-
if (!isMobile && imageOverlayDesktop) {
|
|
4286
|
-
styleContent += `@media screen and (min-width:768px) {.leadgen-inner {background-image: url(${imageOverlayDesktop});}}`;
|
|
3184
|
+
}
|
|
3185
|
+
else {
|
|
3186
|
+
LeadLog('🚧 No lead campaigns on current URL, tags');
|
|
3187
|
+
}
|
|
4287
3188
|
}
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
React__default["default"].createElement("style", { dangerouslySetInnerHTML: { __html: styleOverlay } }),
|
|
4292
|
-
React__default["default"].createElement("div", { className: core.clsx('leadgen-wrapper', {
|
|
4293
|
-
'leadgen-wrapper_small': limitFieldsLightBoxB,
|
|
4294
|
-
}) },
|
|
4295
|
-
showButtonClose && (React__default["default"].createElement(CloseButton, { onClose: () => onOpenChange(false), containerClassName: "leadgen-close_btn" })),
|
|
4296
|
-
PopupContent)));
|
|
4297
|
-
const popupContainerClassName = core.clsx('leadgen', `leadgen-${currentLayout}`, {
|
|
4298
|
-
'leadgen-lightbox': isLightBox,
|
|
4299
|
-
'leadgen-inline': isInPage,
|
|
4300
|
-
'leadgen-slider': isSlider,
|
|
3189
|
+
})
|
|
3190
|
+
.catch((err) => {
|
|
3191
|
+
LeadLog(`Lead error: `, err);
|
|
4301
3192
|
});
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
return null;
|
|
4311
|
-
if (isLightBox || isFullscreen || isSlider) {
|
|
4312
|
-
return PopupContainer;
|
|
4313
|
-
}
|
|
4314
|
-
else if (isSidebar) {
|
|
4315
|
-
return React__default["default"].createElement(SideBarLayout, { content: PopupContainer });
|
|
4316
|
-
}
|
|
4317
|
-
else if (isInline) {
|
|
4318
|
-
return (React__default["default"].createElement(InlineLayout, { content: PopupContainer, inlinePosition: extraFields.popupInlinePosition }));
|
|
3193
|
+
}
|
|
3194
|
+
const LeadLog = (...params) => {
|
|
3195
|
+
if (process.env.NODE_ENV !== 'production' ||
|
|
3196
|
+
(process.env.NEXT_PUBLIC_DEPLOY_ENV &&
|
|
3197
|
+
process.env.NEXT_PUBLIC_DEPLOY_ENV !== 'production') ||
|
|
3198
|
+
(typeof localStorage !== 'undefined' &&
|
|
3199
|
+
localStorage.getItem('hhg_debug') === 'true')) {
|
|
3200
|
+
console.log(...params);
|
|
4319
3201
|
}
|
|
4320
|
-
return null;
|
|
4321
|
-
};
|
|
4322
|
-
|
|
4323
|
-
const SkinLayout = ({ popupId, link, linkText, linkNewTab, onClose, imageMobile, imageDesktop, currentLayout, onOtherSubmit, }) => {
|
|
4324
|
-
const currentPath = location.pathname;
|
|
4325
|
-
const { width: imageMobileWidth, height: imageMobileHeight, loaded: imageMobileLoaded, } = useImageSize(imageMobile);
|
|
4326
|
-
const { width: imageDesktopWidth, height: imageDesktopHeight, loaded: imageDesktopLoaded, } = useImageSize(imageDesktop);
|
|
4327
|
-
if (!imageMobileLoaded || !imageDesktopLoaded)
|
|
4328
|
-
return null;
|
|
4329
|
-
return (React__default["default"].createElement("div", { id: popupId, className: "lead-modal-wrapper", "data-popup-url": currentPath, "data-popup-type": "skin_ab" },
|
|
4330
|
-
currentLayout == 'SkinA' ? (React__default["default"].createElement("aside", { className: "le-only-desktop" },
|
|
4331
|
-
React__default["default"].createElement("div", { className: "le-skin-a-desktop" },
|
|
4332
|
-
React__default["default"].createElement("div", { style: { position: 'relative' } },
|
|
4333
|
-
React__default["default"].createElement("img", { src: imageDesktop, style: {
|
|
4334
|
-
aspectRatio: `${imageDesktopWidth}/${imageDesktopHeight}`,
|
|
4335
|
-
} }),
|
|
4336
|
-
React__default["default"].createElement("a", { style: {
|
|
4337
|
-
position: 'absolute',
|
|
4338
|
-
top: '75%',
|
|
4339
|
-
left: '50%',
|
|
4340
|
-
transform: 'translate(-50%, -50%)',
|
|
4341
|
-
textAlign: 'center',
|
|
4342
|
-
width: 'calc(100% - 15px)',
|
|
4343
|
-
}, href: link, target: linkNewTab ? 'blank' : '_parent' },
|
|
4344
|
-
React__default["default"].createElement("button", { onClick: onOtherSubmit, className: "le-joinbow-btn js-popup-other-submit" }, linkText)),
|
|
4345
|
-
React__default["default"].createElement(CloseButton, { onClose: onClose, containerClassName: "close-button-top-right" }))))) : currentLayout == 'SkinB' ? (React__default["default"].createElement("aside", { className: "le-only-desktop" },
|
|
4346
|
-
React__default["default"].createElement("div", { className: "" },
|
|
4347
|
-
React__default["default"].createElement("div", { style: { position: 'relative', zIndex: 10000 } },
|
|
4348
|
-
React__default["default"].createElement("img", { src: imageDesktop, style: {
|
|
4349
|
-
width: '100%',
|
|
4350
|
-
aspectRatio: `${imageDesktopWidth}/${imageDesktopHeight}`,
|
|
4351
|
-
} }),
|
|
4352
|
-
React__default["default"].createElement("a", { style: {
|
|
4353
|
-
position: 'absolute',
|
|
4354
|
-
top: '75%',
|
|
4355
|
-
left: '50%',
|
|
4356
|
-
transform: 'translate(-50%, -50%)',
|
|
4357
|
-
textAlign: 'center',
|
|
4358
|
-
width: '100%',
|
|
4359
|
-
}, href: link, target: linkNewTab ? 'blank' : '_parent' },
|
|
4360
|
-
React__default["default"].createElement("button", { onClick: onOtherSubmit, className: "le-joinbow-btn-mobile js-popup-other-submit" }, linkText)),
|
|
4361
|
-
React__default["default"].createElement(CloseButton, { containerClassName: "close-button-top-right", onClose: onClose }))))) : null,
|
|
4362
|
-
React__default["default"].createElement("aside", { className: "le-only-mobile" },
|
|
4363
|
-
React__default["default"].createElement("div", { className: "le-skin-mobile" },
|
|
4364
|
-
React__default["default"].createElement("div", { style: { position: 'relative' } },
|
|
4365
|
-
index$7.isVideo(imageMobile) ? (React__default["default"].createElement("video", { muted: true, autoPlay: true, loop: true },
|
|
4366
|
-
React__default["default"].createElement("source", { src: imageMobile, type: "video/mp4" }))) : (React__default["default"].createElement("img", { src: imageMobile, style: {
|
|
4367
|
-
width: '100%',
|
|
4368
|
-
aspectRatio: `${imageMobileWidth}/${imageMobileHeight}`,
|
|
4369
|
-
} })),
|
|
4370
|
-
React__default["default"].createElement("a", { style: {
|
|
4371
|
-
position: 'absolute',
|
|
4372
|
-
top: '82%',
|
|
4373
|
-
left: '50%',
|
|
4374
|
-
transform: 'translate(-50%, -50%)',
|
|
4375
|
-
textAlign: 'center',
|
|
4376
|
-
maxWidth: 'calc(100% - 15px)',
|
|
4377
|
-
}, href: link, target: linkNewTab ? 'blank' : '_parent' },
|
|
4378
|
-
React__default["default"].createElement("button", { onClick: onOtherSubmit, className: "le-joinbow-btn-mobile js-popup-other-submit" }, linkText)),
|
|
4379
|
-
React__default["default"].createElement(CloseButton, { containerClassName: "close-button-top-right", svgClassName: "le-mobile-btn", onClose: onClose }))))));
|
|
4380
|
-
};
|
|
4381
|
-
|
|
4382
|
-
// url: imageBlocks.imageMobile.data.url
|
|
4383
|
-
// newTab: imageBlocks.imageMobile.data.newtab
|
|
4384
|
-
// image: campaignShow.image
|
|
4385
|
-
// imageDestkop: campaignShow.image_desktop
|
|
4386
|
-
const TabLayout = ({ popupId, url, newTab, image, onClose, onOtherSubmit, }) => {
|
|
4387
|
-
const { width: imageWidth, height: imageHeight, loaded: imageLoaded, } = useImageSize(image);
|
|
4388
|
-
if (!imageLoaded)
|
|
4389
|
-
return null;
|
|
4390
|
-
return (React__default["default"].createElement("div", { id: popupId, className: "lead-modal-wrapper", "data-popup-url": location.pathname, "data-popup-type": "tab" },
|
|
4391
|
-
React__default["default"].createElement("div", { className: "le-tab-popup" },
|
|
4392
|
-
React__default["default"].createElement("div", { style: { position: 'relative' } },
|
|
4393
|
-
React__default["default"].createElement("a", { href: url, target: newTab ? 'blank' : '_parent', onClick: onOtherSubmit },
|
|
4394
|
-
React__default["default"].createElement("img", { className: "js-popup-other-submit", src: image, style: {
|
|
4395
|
-
aspectRatio: `${imageWidth}/${imageHeight}`,
|
|
4396
|
-
} })),
|
|
4397
|
-
React__default["default"].createElement(CloseButton, { onClose: onClose, containerClassName: "close-button-top-right" })))));
|
|
4398
3202
|
};
|
|
4399
3203
|
|
|
4400
3204
|
function getCategoryLevel(t = 'Xin chao {{category_2}} extra') {
|
|
@@ -4410,7 +3214,7 @@ function getCategoryLevel(t = 'Xin chao {{category_2}} extra') {
|
|
|
4410
3214
|
}
|
|
4411
3215
|
const NewLeadPopup = ({ campaign, action, onSubmit, onClose, showThankyou, locale, showEmpty, setShowEmpty, userInfo, }) => {
|
|
4412
3216
|
var _a, _b;
|
|
4413
|
-
const { apiUrl, siteDomain } = React.useContext(LeadGenContext
|
|
3217
|
+
const { apiUrl, siteDomain } = React.useContext(LeadGenContext);
|
|
4414
3218
|
React.useEffect(() => {
|
|
4415
3219
|
const gaCookie = miscCookieHelper.getCookie('_ga') || null;
|
|
4416
3220
|
fetch(`${apiUrl}api/campaign/${code}/impression`, {
|
|
@@ -4805,9 +3609,9 @@ const _LeadGen = ({ apiUrl: apiUrlProp, siteDomain, siteId, locale, primaryColor
|
|
|
4805
3609
|
leadStartTimeRef.current = Date.now();
|
|
4806
3610
|
}
|
|
4807
3611
|
}, [showCampaign]);
|
|
4808
|
-
return (React__default["default"].createElement(LeadGenContext
|
|
3612
|
+
return (React__default["default"].createElement(LeadGenContext.Provider, { value: { primaryColor, apiUrl, siteDomain, siteId, locale } },
|
|
4809
3613
|
React__default["default"].createElement(translationsContext.TranslationsContext.Provider, { value: { locale, values: getTranslations(locale) } }, children ? (React__default["default"].createElement(Component, { campaign: showCampaign, onSubmit: onSubmit, onClose: onClose, showThankyou: showThankyou, setShowThankyou: setShowThankyou, locale: locale, showEmpty: showEmpty, setShowEmpty: setShowEmpty, userInfo: userInfo }, children)) : (React__default["default"].createElement(core.Portal, { target: utils$1.getPopupWrapperDom() },
|
|
4810
|
-
React__default["default"].createElement(core.Box, { sx: { position: 'fixed', zIndex: index$
|
|
3614
|
+
React__default["default"].createElement(core.Box, { sx: { position: 'fixed', zIndex: index$7.ZINDEX_SSO - 9e6 } },
|
|
4811
3615
|
React__default["default"].createElement(core.Transition, { mounted: Boolean(((_a = showCampaign === null || showCampaign === void 0 ? void 0 : showCampaign.extra_fields) === null || _a === void 0 ? void 0 : _a.popupVersion) === '2.1'), transition: "fade", duration: 600, timingFunction: "ease" }, (styles) => {
|
|
4812
3616
|
var _a;
|
|
4813
3617
|
return (React__default["default"].createElement(core.Box, { style: styles }, ((_a = showCampaign === null || showCampaign === void 0 ? void 0 : showCampaign.extra_fields) === null || _a === void 0 ? void 0 : _a.popupVersion) === '2.1' && (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
@@ -4826,4 +3630,3 @@ LeadGen.OtpForm = OtpBlock$1;
|
|
|
4826
3630
|
LeadGen.Close = Close.Close;
|
|
4827
3631
|
|
|
4828
3632
|
exports.LeadGen = LeadGen;
|
|
4829
|
-
exports.LeadGenSubscriptionBox = LeadGenSubscriptionBox;
|