@hhgtech/hhg-components 1.29.371-beta-2 → 1.29.371-beta-3
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-0d1e19fb.js → InputDate-61e9c5a1.js} +3 -3
- package/build/{LastPeriod-26f281f7.js → LastPeriod-37f9ad03.js} +1 -1
- package/build/{MobileBottomNavigationIcon-dcf65368.js → MobileBottomNavigationIcon-2504f04b.js} +3 -3
- package/build/{Spinner-c6550ad2.js → Spinner-4a73038c.js} +1 -1
- package/build/{WhatsApp-7d48f03c.js → WhatsApp-48e231e9.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.js +96 -96
- package/build/{constants-1b6b2bb2.js → constants-0773fc84.js} +1 -1
- package/build/constants.js +3 -3
- package/build/constantsDomainLocales.js +1 -1
- package/build/constantsRiskScreener.js +2 -2
- package/build/constantsSite.js +2 -2
- package/build/{core-bb41885a.js → core-b94eb05a.js} +1 -1
- package/build/{dataTransform-530f3ec6.js → dataTransform-866f83fb.js} +1 -1
- package/build/ecom.js +4 -4
- package/build/{editor-8349a6d8.js → editor-67f37f06.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-ae2284cb.js → InputDate-7205d5bf.js} +3 -3
- package/build/esm/{LastPeriod-25c30e46.js → LastPeriod-8fb1da89.js} +1 -1
- package/build/esm/{MobileBottomNavigationIcon-896c49ee.js → MobileBottomNavigationIcon-46d840d7.js} +3 -3
- package/build/esm/{Spinner-a35f3bec.js → Spinner-90f339db.js} +1 -1
- package/build/esm/{WhatsApp-9bdc1da9.js → WhatsApp-60d6e215.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.js +96 -96
- package/build/esm/{constants-e2339e18.js → constants-5c8f80dc.js} +1 -1
- package/build/esm/constants.js +3 -3
- package/build/esm/constantsDomainLocales.js +1 -1
- package/build/esm/constantsRiskScreener.js +2 -2
- package/build/esm/constantsSite.js +2 -2
- package/build/esm/{core-c8568a39.js → core-e470839e.js} +1 -1
- package/build/esm/{dataTransform-911fc0d8.js → dataTransform-bf484109.js} +1 -1
- package/build/esm/ecom.js +4 -4
- package/build/esm/{editor-140efa51.js → editor-0f2f16c6.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-16cbad93.js → healthTools-3f8017a5.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 +14 -56
- package/build/esm/i18nV2.js +2 -2
- package/build/esm/{index-c3b7894f.js → index-0042746f.js} +17 -17
- package/build/esm/{index-855529cf.js → index-07beb988.js} +3 -3
- package/build/esm/{index-ee513777.js → index-0978cfdd.js} +2 -2
- package/build/esm/{index-12800249.js → index-1ad4b807.js} +21 -21
- package/build/esm/{index-f669a9ee.js → index-1f4d454e.js} +22 -22
- package/build/esm/{index-2dbeeae9.js → index-22f4a880.js} +2 -2
- package/build/esm/{index-528124fe.js → index-234cb2cc.js} +2 -2
- package/build/esm/{index-b4b0baa3.js → index-2413498d.js} +13 -13
- package/build/esm/{index-c349792c.js → index-27e79f70.js} +7 -7
- package/build/esm/{index-0f233d2a.js → index-2cbac092.js} +1 -1
- package/build/esm/{index-86e41db8.js → index-2ea81f95.js} +2 -2
- package/build/esm/{index-a175efe5.js → index-34ba8787.js} +4 -4
- package/build/esm/{index-728a3514.js → index-3a3f8652.js} +1 -1
- package/build/esm/{index-caa10f60.js → index-3b4d798b.js} +2 -2
- package/build/esm/{index-8aebd0e7.js → index-40ab3b03.js} +32 -32
- package/build/esm/{index-93fdddd0.js → index-44404be2.js} +3 -3
- package/build/esm/{index-3740026b.js → index-462f2716.js} +16 -16
- package/build/esm/{index-4c8ead8f.js → index-463a4ac6.js} +16 -16
- package/build/esm/{index-88cb038d.js → index-48aacda8.js} +1 -1
- package/build/esm/{index-64d6fcd1.js → index-49cbae4a.js} +2 -2
- package/build/esm/{index-e2237bd3.js → index-5094d18a.js} +5 -5
- package/build/esm/{index-049fffcd.js → index-56ec762e.js} +16 -16
- package/build/esm/{index-14b2f79c.js → index-5bfbb25e.js} +17 -17
- package/build/esm/{index-bb7793b8.js → index-603469cf.js} +31 -31
- package/build/esm/{index-2c533e91.js → index-631ed8f0.js} +13 -13
- package/build/esm/{index-e575b8bf.js → index-64a61d3e.js} +6 -6
- package/build/esm/{index-9f3a2804.js → index-64e7b9c3.js} +10 -10
- package/build/esm/{index-c2706156.js → index-652d6c84.js} +3 -3
- package/build/esm/{index-c88b972e.js → index-6cbb85ce.js} +1 -1
- package/build/esm/{index-33432c2a.js → index-6eed224f.js} +24 -24
- package/build/esm/{index-b8c1e166.js → index-77220ada.js} +17 -17
- package/build/esm/{index-e52d7128.js → index-7b648cab.js} +6 -6
- package/build/esm/{index-cbecf9eb.js → index-857de40f.js} +2 -2
- package/build/esm/{index-718e72c8.js → index-864f7b5b.js} +1 -1
- package/build/esm/{index-2f891acd.js → index-8f0d901b.js} +6 -6
- package/build/esm/{index-46411be5.js → index-9865e182.js} +13 -13
- package/build/esm/{index-d44541c2.js → index-9ebcb339.js} +13 -13
- package/build/esm/{index-4c8e34b8.js → index-a88963d3.js} +2 -2
- package/build/esm/{index-9ebfb087.js → index-a8c524a9.js} +1 -1
- package/build/esm/{index-23c5d324.js → index-ab6306df.js} +2 -2
- package/build/esm/{index-4f5f3fe6.js → index-b194318f.js} +15 -15
- package/build/esm/{index-47d9bb9f.js → index-b448c622.js} +2 -2
- package/build/esm/{index-1ed9178d.js → index-b51ea106.js} +3 -3
- package/build/esm/{index-0003144d.js → index-c0789666.js} +17 -17
- package/build/esm/{index-182fe8b5.js → index-c2617513.js} +3 -3
- package/build/esm/{index-f8acfdc4.js → index-c2757163.js} +8 -8
- package/build/esm/{index-960dbff0.js → index-c9594e55.js} +6 -6
- package/build/esm/{index-81a1973c.js → index-cc9c8870.js} +5 -5
- package/build/esm/{index-32ad9dfc.js → index-cfd3b8dd.js} +7 -7
- package/build/esm/{index-95df04c7.js → index-cfe7c4a6.js} +2 -2
- package/build/esm/{index-a4e46e93.js → index-d77e0c23.js} +1 -1
- package/build/esm/{index-deb6b5d6.js → index-d854a351.js} +18 -18
- package/build/esm/{index-7df0800d.js → index-dba3c9f8.js} +1 -1
- package/build/esm/{index-8bb6001d.js → index-dc733b8a.js} +11 -11
- package/build/esm/{index-38120215.js → index-e0adcb3b.js} +3 -3
- package/build/esm/{index-b52fe2dc.js → index-e3789b8b.js} +16 -16
- package/build/esm/{index-d0ff6f79.js → index-e3c73f61.js} +2 -2
- package/build/esm/{index-0d7a2671.js → index-e5173b05.js} +1 -1
- package/build/esm/{index-85bb7fbd.js → index-e6c329bb.js} +6 -6
- package/build/esm/{index-f8757d1e.js → index-ed5e4009.js} +2 -2
- package/build/esm/{index-61e79ef5.js → index-f74a8323.js} +25 -25
- package/build/esm/{index-e37edf2d.js → index-f8b4f0b3.js} +18 -18
- package/build/esm/{index-d8453a5f.js → index-fcbbfa4b.js} +2 -2
- package/build/esm/{index-b3fb7168.js → index-fcfb5e03.js} +32 -32
- package/build/esm/index.js +117 -117
- package/build/esm/interfaces/types/index.d.ts +1 -0
- package/build/esm/{labelSorting-4de14381.js → labelSorting-9cf83f21.js} +4 -4
- package/build/esm/lead/LeadGen.type.d.ts +31 -0
- package/build/esm/lead/LeadGenForm/LeadGenForm.helpers.d.ts +2 -0
- package/build/esm/lead/LeadGenSubscriptionBox/LeadGenContext.d.ts +63 -0
- package/build/esm/lead/LeadGenSubscriptionBox/LeadGenSubscriptionBox.d.ts +4 -0
- package/build/esm/lead/LeadGenSubscriptionBox/LeadGenSubscriptionBox.styled.d.ts +21 -0
- package/build/esm/lead/LeadGenSubscriptionBox/LeadGenSubscriptionBoxA.d.ts +3 -0
- package/build/esm/lead/LeadGenSubscriptionBox/LeadGenSubscriptionBoxContainer.d.ts +4 -6
- package/build/esm/lead/LeadGenTranslationContext.d.ts +6 -0
- package/build/esm/lead/helpers.d.ts +5 -0
- package/build/esm/lead/services/index.d.ts +7 -2
- package/build/esm/lead/store/index.d.ts +1 -0
- package/build/esm/lead.js +1303 -1102
- package/build/esm/{logoIcon-d5087be5.js → logoIcon-cb8e0653.js} +2 -2
- package/build/esm/mantine.js +25 -25
- package/build/esm/misc.js +17 -17
- package/build/esm/miscGetDynamicHealthTool.js +4 -4
- package/build/esm/miscGetSocialList.js +8 -8
- package/build/esm/miscScreenSizeContext.js +1 -1
- package/build/esm/mobileBottomNavigation.js +5 -5
- package/build/esm/mobileBottomNavigationIcon.js +5 -5
- package/build/esm/molecules.js +73 -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-de497f13.js → post-ed72f334.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.js +29 -29
- package/build/esm/{store-f0b12a72.js → store-8c2e40e8.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-e8316d09.js → surveyThankyouCard-df288b5b.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/translationsProvider-598fb4c6.js +55 -0
- package/build/esm/{treePopoverMenu-a084d0e5.js → treePopoverMenu-f55ffb06.js} +19 -19
- package/build/esm/{types-93e21430.js → types-fe17cb13.js} +2 -2
- package/build/esm/types.js +2 -2
- package/build/esm/{useCategory-425c7fec.js → useCategory-485df8ce.js} +5 -5
- package/build/esm/{useHealthToolCache-c06b6808.js → useHealthToolCache-21c2c43e.js} +1 -1
- package/build/esm/{useMantineLocale-649b965b.js → useMantineLocale-6f10e30e.js} +6 -6
- package/build/esm/{usePlacesAutocomplete-4eb0ee43.js → usePlacesAutocomplete-1043aded.js} +1 -1
- package/build/esm/{useScreenSize-17bb6dde.js → useScreenSize-caf0dd66.js} +2 -2
- package/build/esm/useTogetherAuthRequiredAction.js +9 -9
- package/build/esm/{utils-29c2040a.js → utils-0cb064a5.js} +2 -2
- package/build/esm/{utils-f663115b.js → utils-4d4e79bb.js} +3 -3
- package/build/esm/{utils-1b6fc72b.js → utils-608e1033.js} +4 -4
- package/build/esm/{utils-95d9a6f8.js → utils-be2c60b0.js} +2 -2
- package/build/esm/vaccination.js +21 -21
- package/build/footer.js +21 -21
- package/build/gAssets.js +2 -2
- package/build/{healthTools-e98a1ed7.js → healthTools-6a9f073b.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 +16 -57
- package/build/i18nV2.js +1 -1
- package/build/{index-200e6faa.js → index-00e0387f.js} +1 -1
- package/build/{index-5aa2d881.js → index-05aa2361.js} +2 -2
- package/build/{index-e1cb3449.js → index-0739a213.js} +2 -2
- package/build/{index-9f059cc1.js → index-07842b92.js} +18 -18
- package/build/{index-25921aa8.js → index-080b0aaf.js} +1 -1
- package/build/{index-7b165488.js → index-0c52d734.js} +16 -16
- package/build/{index-ba602d79.js → index-0e998580.js} +18 -18
- package/build/{index-8f5e3ad0.js → index-125f65cd.js} +11 -11
- package/build/{index-6c10d73e.js → index-13879fc8.js} +13 -13
- package/build/{index-66729629.js → index-178544eb.js} +3 -3
- package/build/{index-df2f8389.js → index-1ec480a4.js} +21 -21
- package/build/{index-46c4065a.js → index-2c5ea2c0.js} +16 -16
- package/build/{index-e839b2ff.js → index-2c675ca4.js} +1 -1
- package/build/{index-09555822.js → index-2dde1f98.js} +4 -4
- package/build/{index-18571769.js → index-2e482c2e.js} +16 -16
- package/build/{index-ffda2da6.js → index-347b5bb1.js} +2 -2
- package/build/{index-d63ebb90.js → index-3be634dd.js} +1 -1
- package/build/{index-4e88c711.js → index-47c560a5.js} +2 -2
- package/build/{index-2cc653d3.js → index-4c0627ae.js} +3 -3
- package/build/{index-f3a0dfd7.js → index-4dda9970.js} +5 -5
- package/build/{index-617bca24.js → index-4de45eec.js} +1 -1
- package/build/{index-36a5a4e4.js → index-54b96999.js} +1 -1
- package/build/{index-bd5ab961.js → index-565a5e20.js} +13 -13
- package/build/{index-77116d05.js → index-56dd9661.js} +6 -6
- package/build/{index-a2234d62.js → index-56f422b6.js} +16 -16
- package/build/{index-ee37d82f.js → index-5b0db148.js} +3 -3
- package/build/{index-ec8da2e8.js → index-5f6ebc77.js} +6 -6
- package/build/{index-a47cc653.js → index-61cd7af4.js} +3 -3
- package/build/{index-16bdaa48.js → index-6748439e.js} +8 -8
- package/build/{index-514be104.js → index-686b3e59.js} +1 -1
- package/build/{index-6a59ae49.js → index-696ae54c.js} +17 -17
- package/build/{index-950d7613.js → index-6d5de17c.js} +15 -15
- package/build/{index-fc436ea3.js → index-6ec9d3b4.js} +25 -25
- package/build/{index-f2414e2d.js → index-7013062e.js} +22 -22
- package/build/{index-dbcf604a.js → index-770e2eb7.js} +6 -6
- package/build/{index-4efec07f.js → index-78e2cb65.js} +17 -17
- package/build/{index-71d587b0.js → index-79296333.js} +2 -2
- package/build/{index-93c05133.js → index-81637606.js} +3 -3
- package/build/{index-83d1a574.js → index-81a96c8d.js} +2 -2
- package/build/{index-b649a8ba.js → index-87d3b911.js} +2 -2
- package/build/{index-c379c3e8.js → index-8860da28.js} +1 -1
- package/build/{index-e7cc62aa.js → index-93bc0075.js} +2 -2
- package/build/{index-3fc48063.js → index-9cf6031b.js} +17 -17
- package/build/{index-543f1bf5.js → index-9df0ac34.js} +1 -1
- package/build/{index-c789cb1e.js → index-9f0bcaee.js} +6 -6
- package/build/{index-93e3c4bb.js → index-a3e1ea36.js} +13 -13
- package/build/{index-4bee1063.js → index-a90113f4.js} +2 -2
- package/build/{index-b657945b.js → index-b0be7fa8.js} +2 -2
- package/build/{index-68410cf0.js → index-b3c66e75.js} +2 -2
- package/build/{index-4436a560.js → index-bfa8f8e1.js} +6 -6
- package/build/{index-47742182.js → index-c2596ec2.js} +13 -13
- package/build/{index-99179802.js → index-c5c2105e.js} +32 -32
- package/build/{index-a480f498.js → index-c721c3c3.js} +7 -7
- package/build/{index-52fe183d.js → index-caea14e2.js} +24 -24
- package/build/{index-56f1c900.js → index-cd6ddf39.js} +7 -7
- package/build/{index-136e0545.js → index-d3e5cfef.js} +31 -31
- package/build/{index-10b2cd7c.js → index-d4eecf33.js} +5 -5
- package/build/{index-faca126a.js → index-e0bdefdd.js} +2 -2
- package/build/{index-1aaf66d6.js → index-ebd7b720.js} +2 -2
- package/build/{index-5f899fe0.js → index-f40aef22.js} +3 -3
- package/build/{index-1aa78274.js → index-f651a751.js} +32 -32
- package/build/{index-2c496281.js → index-f6fe92be.js} +10 -10
- package/build/{index-ebb8f1e1.js → index-fdc1ccc3.js} +17 -17
- package/build/{index-02e6344c.js → index-ffaf8d8a.js} +2 -2
- package/build/index.js +117 -117
- package/build/interfaces/types/index.d.ts +1 -0
- package/build/{labelSorting-5fe2aeeb.js → labelSorting-ddd1f2ce.js} +4 -4
- package/build/lead/LeadGen.type.d.ts +31 -0
- package/build/lead/LeadGenForm/LeadGenForm.helpers.d.ts +2 -0
- package/build/lead/LeadGenSubscriptionBox/LeadGenContext.d.ts +63 -0
- package/build/lead/LeadGenSubscriptionBox/LeadGenSubscriptionBox.d.ts +4 -0
- package/build/lead/LeadGenSubscriptionBox/LeadGenSubscriptionBox.styled.d.ts +21 -0
- package/build/lead/LeadGenSubscriptionBox/LeadGenSubscriptionBoxA.d.ts +3 -0
- package/build/lead/LeadGenSubscriptionBox/LeadGenSubscriptionBoxContainer.d.ts +4 -6
- package/build/lead/LeadGenTranslationContext.d.ts +6 -0
- package/build/lead/helpers.d.ts +5 -0
- package/build/lead/services/index.d.ts +7 -2
- package/build/lead/store/index.d.ts +1 -0
- package/build/lead.js +1301 -1100
- package/build/{logoIcon-e91d76f8.js → logoIcon-10d4c2c7.js} +2 -2
- package/build/mantine.js +22 -22
- package/build/misc.js +17 -17
- package/build/miscGetDynamicHealthTool.js +4 -4
- package/build/miscGetSocialList.js +8 -8
- package/build/miscScreenSizeContext.js +1 -1
- package/build/mobileBottomNavigation.js +5 -5
- package/build/mobileBottomNavigationIcon.js +5 -5
- package/build/molecules.js +73 -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-82387f75.js → post-71dba53e.js} +2 -2
- package/build/profileNavigation.js +19 -19
- package/build/progressBar.js +1 -1
- package/build/pwg.js +22 -22
- package/build/ssoV2.js +27 -27
- package/build/{store-df165d26.js → store-162831bf.js} +4 -4
- package/build/subot.js +34 -34
- package/build/surveyOrPremiumBanner.js +32 -32
- package/build/surveyQuestionCard.js +10 -10
- package/build/{surveyThankyouCard-62dad2d7.js → surveyThankyouCard-04e30b65.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/translationsProvider-b383e3b6.js +62 -0
- package/build/{treePopoverMenu-7382036f.js → treePopoverMenu-102e209a.js} +19 -19
- package/build/{types-576b2b76.js → types-8648a9f6.js} +2 -2
- package/build/types.js +2 -2
- package/build/{useCategory-04d757d9.js → useCategory-edc47b24.js} +5 -5
- package/build/{useHealthToolCache-072abc84.js → useHealthToolCache-7ac7bc8b.js} +1 -1
- package/build/{useMantineLocale-365fd06a.js → useMantineLocale-cbfcee76.js} +6 -6
- package/build/{usePlacesAutocomplete-f03b196e.js → usePlacesAutocomplete-d9c9d190.js} +1 -1
- package/build/{useScreenSize-94f7c947.js → useScreenSize-5edbf21b.js} +2 -2
- package/build/useTogetherAuthRequiredAction.js +9 -9
- package/build/{utils-2e05ce67.js → utils-55566c6a.js} +2 -2
- package/build/{utils-6f410155.js → utils-b86dfeef.js} +3 -3
- package/build/{utils-47c77ada.js → utils-b9463401.js} +4 -4
- package/build/{utils-439cb8e4.js → utils-ed4bc922.js} +2 -2
- package/build/vaccination.js +21 -21
- package/package.json +1 -1
- package/build/esm/lead/LeadGenSubscriptionBox/LeadGenSubscriptionBoxContext.d.ts +0 -25
- package/build/esm/lead/LeadGenSubscriptionBox/LeadGenSubscriptionBoxWrapper.d.ts +0 -30
- package/build/lead/LeadGenSubscriptionBox/LeadGenSubscriptionBoxContext.d.ts +0 -25
- package/build/lead/LeadGenSubscriptionBox/LeadGenSubscriptionBoxWrapper.d.ts +0 -30
- /package/build/{BMI_BOYS.percentile.monthly-83d89ed4.js → BMI_BOYS.percentile.monthly-35aa5ebe.js} +0 -0
- /package/build/{BMI_BOYS.percentile.weekly-5dcc0ed0.js → BMI_BOYS.percentile.weekly-06d286f6.js} +0 -0
- /package/build/{BMI_BOYS.percentile.yearly-c4f66a81.js → BMI_BOYS.percentile.yearly-d68cbaef.js} +0 -0
- /package/build/{BMI_BOYS.zscore.monthly-a0fd10b7.js → BMI_BOYS.zscore.monthly-d778ca5f.js} +0 -0
- /package/build/{BMI_BOYS.zscore.weekly-13d5b497.js → BMI_BOYS.zscore.weekly-d40d219b.js} +0 -0
- /package/build/{BMI_BOYS.zscore.yearly-a3f835b6.js → BMI_BOYS.zscore.yearly-b6efcc79.js} +0 -0
- /package/build/{BMI_GIRLS.percentile.monthly-9f5d2e0a.js → BMI_GIRLS.percentile.monthly-0d426264.js} +0 -0
- /package/build/{BMI_GIRLS.percentile.weekly-a255cc0b.js → BMI_GIRLS.percentile.weekly-936b386f.js} +0 -0
- /package/build/{BMI_GIRLS.percentile.yearly-2e6d75f5.js → BMI_GIRLS.percentile.yearly-af29294d.js} +0 -0
- /package/build/{BMI_GIRLS.zscore.monthly-2a66edd4.js → BMI_GIRLS.zscore.monthly-d9f1c7b0.js} +0 -0
- /package/build/{BMI_GIRLS.zscore.weekly-00d01ba9.js → BMI_GIRLS.zscore.weekly-23490287.js} +0 -0
- /package/build/{BMI_GIRLS.zscore.yearly-41bbdf41.js → BMI_GIRLS.zscore.yearly-a846aa7d.js} +0 -0
- /package/build/{ChevronDown-ccf99fab.js → ChevronDown-5961731d.js} +0 -0
- /package/build/{Close-0f84a9f4.js → Close-74cf47e8.js} +0 -0
- /package/build/{Google-e85cf4cf.js → Google-d0c35b20.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.percentile.monthly-9e587327.js → HEAD CIRCUM_BOYS.percentile.monthly-77226b6c.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.percentile.weekly-9057e311.js → HEAD CIRCUM_BOYS.percentile.weekly-72e7afe1.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.percentile.yearly-1221e274.js → HEAD CIRCUM_BOYS.percentile.yearly-98efbbf7.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.zscore.monthly-13079e16.js → HEAD CIRCUM_BOYS.zscore.monthly-3af2a621.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.zscore.weekly-69023c74.js → HEAD CIRCUM_BOYS.zscore.weekly-747e6068.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.zscore.yearly-bfa6ad45.js → HEAD CIRCUM_BOYS.zscore.yearly-c0e7f52b.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.percentile.monthly-8811b66f.js → HEAD CIRCUM_GIRLS.percentile.monthly-d7461423.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.percentile.weekly-1703411c.js → HEAD CIRCUM_GIRLS.percentile.weekly-efc23b48.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.percentile.yearly-496c24bb.js → HEAD CIRCUM_GIRLS.percentile.yearly-eed57f44.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.zscore.monthly-13434ef3.js → HEAD CIRCUM_GIRLS.zscore.monthly-46108e64.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.zscore.weekly-1ea968ce.js → HEAD CIRCUM_GIRLS.zscore.weekly-c8b69243.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.zscore.yearly-807a4a75.js → HEAD CIRCUM_GIRLS.zscore.yearly-aa19583f.js} +0 -0
- /package/build/{HEIGHT_BOYS.percentile.monthly-28aebd1d.js → HEIGHT_BOYS.percentile.monthly-1ce70df3.js} +0 -0
- /package/build/{HEIGHT_BOYS.percentile.weekly-d466ab61.js → HEIGHT_BOYS.percentile.weekly-f2bb70b7.js} +0 -0
- /package/build/{HEIGHT_BOYS.percentile.yearly-63ddadde.js → HEIGHT_BOYS.percentile.yearly-e4d04b02.js} +0 -0
- /package/build/{HEIGHT_BOYS.zscore.monthly-7b16e8dc.js → HEIGHT_BOYS.zscore.monthly-c2bbcded.js} +0 -0
- /package/build/{HEIGHT_BOYS.zscore.weekly-3ef4350e.js → HEIGHT_BOYS.zscore.weekly-0f41d68c.js} +0 -0
- /package/build/{HEIGHT_BOYS.zscore.yearly-e4697c66.js → HEIGHT_BOYS.zscore.yearly-a99fec6a.js} +0 -0
- /package/build/{HEIGHT_GIRLS.percentile.monthly-5bd4edcd.js → HEIGHT_GIRLS.percentile.monthly-ebbb538b.js} +0 -0
- /package/build/{HEIGHT_GIRLS.percentile.weekly-2e065cb1.js → HEIGHT_GIRLS.percentile.weekly-1fd31eca.js} +0 -0
- /package/build/{HEIGHT_GIRLS.percentile.yearly-41b3545d.js → HEIGHT_GIRLS.percentile.yearly-f732d518.js} +0 -0
- /package/build/{HEIGHT_GIRLS.zscore.monthly-9f32c9c7.js → HEIGHT_GIRLS.zscore.monthly-a9088cff.js} +0 -0
- /package/build/{HEIGHT_GIRLS.zscore.weekly-b7cd5590.js → HEIGHT_GIRLS.zscore.weekly-3af9512e.js} +0 -0
- /package/build/{HEIGHT_GIRLS.zscore.yearly-ebee3cc5.js → HEIGHT_GIRLS.zscore.yearly-60b3eab0.js} +0 -0
- /package/build/{Locale-423a6568.js → Locale-7ef9bbac.js} +0 -0
- /package/build/{Visible-92338f3f.js → Visible-24f4ae37.js} +0 -0
- /package/build/{WEIGHT_BOYS.percentile.monthly-4eefe1a5.js → WEIGHT_BOYS.percentile.monthly-937f229b.js} +0 -0
- /package/build/{WEIGHT_BOYS.percentile.weekly-380063d2.js → WEIGHT_BOYS.percentile.weekly-573412d4.js} +0 -0
- /package/build/{WEIGHT_BOYS.percentile.yearly-9dbdb1f9.js → WEIGHT_BOYS.percentile.yearly-8b8ad9fe.js} +0 -0
- /package/build/{WEIGHT_BOYS.zscore.monthly-19754d82.js → WEIGHT_BOYS.zscore.monthly-c20b7ddc.js} +0 -0
- /package/build/{WEIGHT_BOYS.zscore.weekly-ec0f428f.js → WEIGHT_BOYS.zscore.weekly-17ff91ca.js} +0 -0
- /package/build/{WEIGHT_BOYS.zscore.yearly-9d74d8c2.js → WEIGHT_BOYS.zscore.yearly-bf2e850b.js} +0 -0
- /package/build/{WEIGHT_GIRLS.percentile.monthly-21073e61.js → WEIGHT_GIRLS.percentile.monthly-6deb23bc.js} +0 -0
- /package/build/{WEIGHT_GIRLS.percentile.weekly-ae44cb41.js → WEIGHT_GIRLS.percentile.weekly-603d00e9.js} +0 -0
- /package/build/{WEIGHT_GIRLS.percentile.yearly-f3f907f0.js → WEIGHT_GIRLS.percentile.yearly-60cdc8d1.js} +0 -0
- /package/build/{WEIGHT_GIRLS.zscore.monthly-abac081c.js → WEIGHT_GIRLS.zscore.monthly-14c20f6f.js} +0 -0
- /package/build/{WEIGHT_GIRLS.zscore.weekly-6932225c.js → WEIGHT_GIRLS.zscore.weekly-394bbf62.js} +0 -0
- /package/build/{WEIGHT_GIRLS.zscore.yearly-0088e837.js → WEIGHT_GIRLS.zscore.yearly-04c5803f.js} +0 -0
- /package/build/{animation-ca77c785.js → animation-98f0f673.js} +0 -0
- /package/build/{constants-32c87c25.js → constants-15fd8e3c.js} +0 -0
- /package/build/{constants-29396ff5.js → constants-c84c0a84.js} +0 -0
- /package/build/{constants-044654b7.js → constants-ef70697a.js} +0 -0
- /package/build/{dataTransform-50e7906c.js → dataTransform-466b2cef.js} +0 -0
- /package/build/{doctor-3a755c7f.js → doctor-e368b391.js} +0 -0
- /package/build/esm/{BMI_BOYS.percentile.monthly-abe76725.js → BMI_BOYS.percentile.monthly-d847cb51.js} +0 -0
- /package/build/esm/{BMI_BOYS.percentile.weekly-3e510663.js → BMI_BOYS.percentile.weekly-28f99e79.js} +0 -0
- /package/build/esm/{BMI_BOYS.percentile.yearly-7fce9362.js → BMI_BOYS.percentile.yearly-e17cdcd7.js} +0 -0
- /package/build/esm/{BMI_BOYS.zscore.monthly-21ed216d.js → BMI_BOYS.zscore.monthly-c1bcc29a.js} +0 -0
- /package/build/esm/{BMI_BOYS.zscore.weekly-f35f5185.js → BMI_BOYS.zscore.weekly-87c39d2a.js} +0 -0
- /package/build/esm/{BMI_BOYS.zscore.yearly-eaaad5a6.js → BMI_BOYS.zscore.yearly-c34d70cd.js} +0 -0
- /package/build/esm/{BMI_GIRLS.percentile.monthly-28b3c1ba.js → BMI_GIRLS.percentile.monthly-9b3d44a4.js} +0 -0
- /package/build/esm/{BMI_GIRLS.percentile.weekly-dd34efb1.js → BMI_GIRLS.percentile.weekly-1bd0fd46.js} +0 -0
- /package/build/esm/{BMI_GIRLS.percentile.yearly-c31df438.js → BMI_GIRLS.percentile.yearly-914d5a00.js} +0 -0
- /package/build/esm/{BMI_GIRLS.zscore.monthly-8adfec69.js → BMI_GIRLS.zscore.monthly-ec794401.js} +0 -0
- /package/build/esm/{BMI_GIRLS.zscore.weekly-7d9b373d.js → BMI_GIRLS.zscore.weekly-97f06d42.js} +0 -0
- /package/build/esm/{BMI_GIRLS.zscore.yearly-819d894c.js → BMI_GIRLS.zscore.yearly-54289d04.js} +0 -0
- /package/build/esm/{ChevronDown-8c11c372.js → ChevronDown-a4cf7631.js} +0 -0
- /package/build/esm/{Close-a2b7531e.js → Close-a61d81c6.js} +0 -0
- /package/build/esm/{Google-279a197c.js → Google-658e601e.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.percentile.monthly-3a5cea44.js → HEAD CIRCUM_BOYS.percentile.monthly-2504b72e.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.percentile.weekly-3a4d9508.js → HEAD CIRCUM_BOYS.percentile.weekly-945555ab.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.percentile.yearly-a72a0b5c.js → HEAD CIRCUM_BOYS.percentile.yearly-0ecdf4fa.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.zscore.monthly-a286dd91.js → HEAD CIRCUM_BOYS.zscore.monthly-a415c706.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.zscore.weekly-dd262294.js → HEAD CIRCUM_BOYS.zscore.weekly-4301d02a.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.zscore.yearly-ee1ac319.js → HEAD CIRCUM_BOYS.zscore.yearly-db5d50e4.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.monthly-e8d1e9fd.js → HEAD CIRCUM_GIRLS.percentile.monthly-20107e97.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.weekly-198839ae.js → HEAD CIRCUM_GIRLS.percentile.weekly-f7dc82dd.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.yearly-79b86f8c.js → HEAD CIRCUM_GIRLS.percentile.yearly-1593553b.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.monthly-1e7b7b61.js → HEAD CIRCUM_GIRLS.zscore.monthly-bc248172.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.weekly-64aa1094.js → HEAD CIRCUM_GIRLS.zscore.weekly-307991f7.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.yearly-3359bcab.js → HEAD CIRCUM_GIRLS.zscore.yearly-61b0290d.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.percentile.monthly-893a6df2.js → HEIGHT_BOYS.percentile.monthly-9113922c.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.percentile.weekly-f7f68e58.js → HEIGHT_BOYS.percentile.weekly-1f3bcc5f.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.percentile.yearly-2a4a999e.js → HEIGHT_BOYS.percentile.yearly-267121e2.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.zscore.monthly-bf531948.js → HEIGHT_BOYS.zscore.monthly-48d404ae.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.zscore.weekly-d1e9ce51.js → HEIGHT_BOYS.zscore.weekly-6993438a.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.zscore.yearly-c9ecbcc5.js → HEIGHT_BOYS.zscore.yearly-4bf4d1e6.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.percentile.monthly-babc4fa4.js → HEIGHT_GIRLS.percentile.monthly-daa0663f.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.percentile.weekly-20b42db3.js → HEIGHT_GIRLS.percentile.weekly-813f5fd7.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.percentile.yearly-b6d7c046.js → HEIGHT_GIRLS.percentile.yearly-eff8bf30.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.zscore.monthly-11bb3e3a.js → HEIGHT_GIRLS.zscore.monthly-30a32b50.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.zscore.weekly-f1b629d9.js → HEIGHT_GIRLS.zscore.weekly-694139b8.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.zscore.yearly-9b829b5b.js → HEIGHT_GIRLS.zscore.yearly-fd93c8ea.js} +0 -0
- /package/build/esm/{Locale-dca6b17b.js → Locale-08f0c7dd.js} +0 -0
- /package/build/esm/{Visible-712d1456.js → Visible-2bab58e1.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.percentile.monthly-0a9908e2.js → WEIGHT_BOYS.percentile.monthly-ff9ff248.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.percentile.weekly-9563d890.js → WEIGHT_BOYS.percentile.weekly-329cab06.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.percentile.yearly-adad5cd6.js → WEIGHT_BOYS.percentile.yearly-7febf596.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.zscore.monthly-3f3102eb.js → WEIGHT_BOYS.zscore.monthly-45594801.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.zscore.weekly-44f9125d.js → WEIGHT_BOYS.zscore.weekly-9530978c.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.zscore.yearly-7161fd42.js → WEIGHT_BOYS.zscore.yearly-eb72e975.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.percentile.monthly-bf0c65c2.js → WEIGHT_GIRLS.percentile.monthly-05775d79.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.percentile.weekly-0762f532.js → WEIGHT_GIRLS.percentile.weekly-8d9f769e.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.percentile.yearly-e9189916.js → WEIGHT_GIRLS.percentile.yearly-30144bae.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.zscore.monthly-64834b0c.js → WEIGHT_GIRLS.zscore.monthly-cf07d175.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.zscore.weekly-3cf8dbb3.js → WEIGHT_GIRLS.zscore.weekly-33e0d835.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.zscore.yearly-d699006a.js → WEIGHT_GIRLS.zscore.yearly-d608073f.js} +0 -0
- /package/build/esm/{animation-9834951a.js → animation-936439f3.js} +0 -0
- /package/build/esm/{constants-36547463.js → constants-3525e3f2.js} +0 -0
- /package/build/esm/{constants-869289e5.js → constants-39b9db20.js} +0 -0
- /package/build/esm/{constants-42a70d9a.js → constants-dec93ad8.js} +0 -0
- /package/build/esm/{dataTransform-4a09b03b.js → dataTransform-3d760b9f.js} +0 -0
- /package/build/esm/{doctor-56d70c87.js → doctor-76b1e3a5.js} +0 -0
- /package/build/esm/{index-6a5d6941.js → index-037ec766.js} +0 -0
- /package/build/esm/{index-998e0727.js → index-5a380bf2.js} +0 -0
- /package/build/esm/{index-a96ea4e3.js → index-649372bd.js} +0 -0
- /package/build/esm/{index-3c328f9c.js → index-8227d187.js} +0 -0
- /package/build/esm/{index-02b8805d.js → index-b0b1e4dc.js} +0 -0
- /package/build/esm/{index-748d2482.js → index-b2f2ef05.js} +0 -0
- /package/build/esm/{index-7302dec7.js → index-b9fd9fcf.js} +0 -0
- /package/build/esm/{index-8e7db8c3.js → index-f99e0243.js} +0 -0
- /package/build/esm/{index.styles-8613b78f.js → index.styles-24493eed.js} +0 -0
- /package/build/esm/{localizeNumberFormat-6658d02a.js → localizeNumberFormat-5ee70bdb.js} +0 -0
- /package/build/esm/{normalizeLink-fd586b33.js → normalizeLink-70222b22.js} +0 -0
- /package/build/esm/{number-9c1d06bc.js → number-6c0361f0.js} +0 -0
- /package/build/esm/{other-ed0364fa.js → other-04096300.js} +0 -0
- /package/build/esm/{paths-662536c0.js → paths-50ad35fc.js} +0 -0
- /package/build/esm/{translationsContext-3cfa4370.js → translationsContext-1d64cf04.js} +0 -0
- /package/build/esm/{tslib.es6-fa754ad3.js → tslib.es6-b06892b6.js} +0 -0
- /package/build/esm/{types-e902431a.js → types-6b50d489.js} +0 -0
- /package/build/esm/{useIsInit-63ca20f1.js → useIsInit-09563c77.js} +0 -0
- /package/build/esm/{useOutsideClick-31e59438.js → useOutsideClick-461af3f1.js} +0 -0
- /package/build/esm/{useScrollbarSize-3d6f31d4.js → useScrollbarSize-ea155b73.js} +0 -0
- /package/build/esm/{useUniqueId-6fb0b391.js → useUniqueId-879e70af.js} +0 -0
- /package/build/esm/{utils-d75bba00.js → utils-f4fc54ed.js} +0 -0
- /package/build/{index-125aca5c.js → index-1262dfcb.js} +0 -0
- /package/build/{index-521e8b1c.js → index-2e09584a.js} +0 -0
- /package/build/{index-1ea08c60.js → index-312d7d65.js} +0 -0
- /package/build/{index-33b8fe23.js → index-5aac0dc2.js} +0 -0
- /package/build/{index-a1b356b9.js → index-69afccff.js} +0 -0
- /package/build/{index-7aa8ccdc.js → index-8b8d709b.js} +0 -0
- /package/build/{index-ed0818e5.js → index-af135972.js} +0 -0
- /package/build/{index-1c7b9d7f.js → index-cc3c4d6d.js} +0 -0
- /package/build/{index.styles-165831e2.js → index.styles-33ccc931.js} +0 -0
- /package/build/{localizeNumberFormat-7d56d4ff.js → localizeNumberFormat-cf37a5eb.js} +0 -0
- /package/build/{normalizeLink-f1c70675.js → normalizeLink-79d4e277.js} +0 -0
- /package/build/{number-473beeca.js → number-87c5f3a1.js} +0 -0
- /package/build/{other-3398bb78.js → other-81af4989.js} +0 -0
- /package/build/{paths-89d7853b.js → paths-31b6c759.js} +0 -0
- /package/build/{translationsContext-2b777411.js → translationsContext-32ff79c3.js} +0 -0
- /package/build/{tslib.es6-bc883fea.js → tslib.es6-a8bff8b8.js} +0 -0
- /package/build/{types-099a8c64.js → types-40d5f385.js} +0 -0
- /package/build/{useIsInit-f6790d96.js → useIsInit-1dd7e2ba.js} +0 -0
- /package/build/{useOutsideClick-40147129.js → useOutsideClick-009d5b2b.js} +0 -0
- /package/build/{useScrollbarSize-4cec79a0.js → useScrollbarSize-499a8e08.js} +0 -0
- /package/build/{useUniqueId-aa58d374.js → useUniqueId-cf03a9e2.js} +0 -0
- /package/build/{utils-8dca3c43.js → utils-77ed117f.js} +0 -0
package/build/lead.js
CHANGED
|
@@ -2,48 +2,51 @@
|
|
|
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-a8bff8b8.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-4de45eec.js');
|
|
12
|
+
var translationsContext = require('./translationsContext-32ff79c3.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 utils = require('./utils-
|
|
14
|
+
var utils$1 = require('./utils-77ed117f.js');
|
|
15
|
+
var index$1 = require('./index-87d3b911.js');
|
|
16
|
+
var index$2 = require('./index-125f65cd.js');
|
|
17
|
+
var index$4 = require('./index-9f0bcaee.js');
|
|
18
|
+
var utils = require('./utils-ed4bc922.js');
|
|
19
19
|
var dates = require('@mantine/dates');
|
|
20
|
-
var index$7 = require('./index-
|
|
21
|
-
var index$9 = require('./index-
|
|
22
|
-
require('./index-
|
|
23
|
-
require('./useMantineLocale-
|
|
24
|
-
var index$5 = require('./index-
|
|
25
|
-
require('./index.styles-
|
|
20
|
+
var index$7 = require('./index-79296333.js');
|
|
21
|
+
var index$9 = require('./index-080b0aaf.js');
|
|
22
|
+
require('./index-5aac0dc2.js');
|
|
23
|
+
require('./useMantineLocale-cbfcee76.js');
|
|
24
|
+
var index$5 = require('./index-2c675ca4.js');
|
|
25
|
+
require('./index.styles-33ccc931.js');
|
|
26
26
|
var hooks = require('@mantine/hooks');
|
|
27
|
-
require('./other-
|
|
28
|
-
require('./index-
|
|
29
|
-
var usePlacesAutocomplete = require('./usePlacesAutocomplete-
|
|
30
|
-
var index$3 = require('./index-
|
|
31
|
-
var index$6 = require('./index-
|
|
32
|
-
var
|
|
27
|
+
require('./other-81af4989.js');
|
|
28
|
+
require('./index-f40aef22.js');
|
|
29
|
+
var usePlacesAutocomplete = require('./usePlacesAutocomplete-d9c9d190.js');
|
|
30
|
+
var index$3 = require('./index-b3c66e75.js');
|
|
31
|
+
var index$6 = require('./index-b0be7fa8.js');
|
|
32
|
+
var translationsProvider = require('./translationsProvider-b383e3b6.js');
|
|
33
|
+
var Locale = require('./Locale-7ef9bbac.js');
|
|
33
34
|
var uuid = require('uuid');
|
|
34
|
-
var
|
|
35
|
+
var PhoneInputBase = require('react-phone-number-input');
|
|
36
|
+
var styled = require('@emotion/styled');
|
|
35
37
|
var miscTheme = require('./miscTheme.js');
|
|
36
|
-
var
|
|
37
|
-
var
|
|
38
|
-
var
|
|
38
|
+
var react = require('@emotion/react');
|
|
39
|
+
var togetherComponentGlobalContext = require('./utils-b86dfeef.js');
|
|
40
|
+
var index$8 = require('./index-69afccff.js');
|
|
41
|
+
var index$a = require('./index-93bc0075.js');
|
|
42
|
+
var useScreenSize = require('./useScreenSize-5edbf21b.js');
|
|
39
43
|
var ReactDOM = require('react-dom');
|
|
40
|
-
var InputDate = require('./InputDate-
|
|
41
|
-
var Close = require('./Close-
|
|
44
|
+
var InputDate = require('./InputDate-61e9c5a1.js');
|
|
45
|
+
var Close = require('./Close-74cf47e8.js');
|
|
42
46
|
require('@hhgtech/icons/other');
|
|
43
47
|
require('@mantine/carousel');
|
|
44
|
-
require('./Locale-423a6568.js');
|
|
45
48
|
require('classnames');
|
|
46
|
-
require('./useUniqueId-
|
|
49
|
+
require('./useUniqueId-cf03a9e2.js');
|
|
47
50
|
require('./constantsSite.js');
|
|
48
51
|
require('@hhgtech/icons/core');
|
|
49
52
|
require('date-fns/locale');
|
|
@@ -51,6 +54,22 @@ require('./constantsDomainLocales.js');
|
|
|
51
54
|
require('./constantsRiskScreener.js');
|
|
52
55
|
require('./constantsIsProduction.js');
|
|
53
56
|
require('@mantine/notifications');
|
|
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-1262dfcb.js');
|
|
69
|
+
require('slugify');
|
|
70
|
+
require('string-format');
|
|
71
|
+
require('./togetherApiPaths.js');
|
|
72
|
+
require('./constants-15fd8e3c.js');
|
|
54
73
|
require('vaul');
|
|
55
74
|
|
|
56
75
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
@@ -217,6 +236,16 @@ const LEADGEN_BLOCK_INPUT = [
|
|
|
217
236
|
LEADGEN_BLOCK.CheckboxBlock,
|
|
218
237
|
LEADGEN_BLOCK.TncBlock,
|
|
219
238
|
];
|
|
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
|
+
};
|
|
220
249
|
const SSO_MAP_LEAD = ['name', 'email', 'birthday', 'phone', 'gender'];
|
|
221
250
|
const LEAD_LOCALE_DATA = {
|
|
222
251
|
'vi-VN': {
|
|
@@ -342,6 +371,7 @@ const formatCampaignDetail = (campaign) => {
|
|
|
342
371
|
|
|
343
372
|
class Store {
|
|
344
373
|
constructor() {
|
|
374
|
+
this.apiSsoUrl = 'https://staging-id.hellobacsi.com/';
|
|
345
375
|
this.apiLeadUrl = 'https://dev.leadgen.hellobacsi.com/';
|
|
346
376
|
this.apiSubotUrl = 'https://staging-service-subot.hellohealthgroup.com/';
|
|
347
377
|
}
|
|
@@ -354,6 +384,8 @@ const LEADGEN_API_METHOD = {
|
|
|
354
384
|
};
|
|
355
385
|
const LEADGEN_API_PATH = {
|
|
356
386
|
V2_CAMPAIGN: 'api/v2/campaign',
|
|
387
|
+
V2_SUBSCRIPTION_LEAD: 'api/v2/subscription-box',
|
|
388
|
+
V2_SUBSCRIPTION_INFO: 'api/campaign/get-title',
|
|
357
389
|
};
|
|
358
390
|
const leadApi = {
|
|
359
391
|
call(_a) {
|
|
@@ -458,19 +490,28 @@ const verifyOtpLead = ({ phone, otp, type, }) => {
|
|
|
458
490
|
},
|
|
459
491
|
});
|
|
460
492
|
};
|
|
461
|
-
const
|
|
493
|
+
const getCampaignByCode = (campaign_code) => {
|
|
462
494
|
return leadApi.call({
|
|
463
495
|
url: `${LEADGEN_API_PATH.V2_CAMPAIGN}/${campaign_code}`,
|
|
464
496
|
method: LEADGEN_API_METHOD.GET,
|
|
465
497
|
});
|
|
466
498
|
};
|
|
467
|
-
const
|
|
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 }) => {
|
|
468
506
|
return leadApi.call({
|
|
469
|
-
url:
|
|
507
|
+
url: LEADGEN_API_PATH.V2_SUBSCRIPTION_LEAD,
|
|
470
508
|
method: LEADGEN_API_METHOD.POST,
|
|
471
509
|
data,
|
|
472
510
|
});
|
|
473
511
|
};
|
|
512
|
+
const postUserInfoFromLeadGen = ({}) => {
|
|
513
|
+
return;
|
|
514
|
+
};
|
|
474
515
|
const campaignPostImpression = ({ code, action, title_article, ga_client_id, cookie_id, extra, url, referrer, }) => {
|
|
475
516
|
return leadApi.call({
|
|
476
517
|
url: `api/campaign/${code}/impression`,
|
|
@@ -488,8 +529,10 @@ const campaignPostImpression = ({ code, action, title_article, ga_client_id, coo
|
|
|
488
529
|
};
|
|
489
530
|
const Service = {
|
|
490
531
|
campaignGetById,
|
|
491
|
-
|
|
492
|
-
|
|
532
|
+
getCampaignByCode,
|
|
533
|
+
getSubscriptionBoxInfo,
|
|
534
|
+
postSubscriptionBoxLead,
|
|
535
|
+
postUserInfoFromLeadGen,
|
|
493
536
|
campaignPostImpression,
|
|
494
537
|
validateEmailOrPhoneOnSubot,
|
|
495
538
|
validateEmailOrPhoneOnLeadGen,
|
|
@@ -1520,217 +1563,682 @@ const translationsMap = {
|
|
|
1520
1563
|
'tl-PH': enPH,
|
|
1521
1564
|
};
|
|
1522
1565
|
const getTranslations = (locale) => {
|
|
1523
|
-
const translations = translationsMap[locale];
|
|
1566
|
+
const translations = Object.assign(Object.assign({}, translationsProvider.translationsMap[locale]), translationsMap[locale]);
|
|
1524
1567
|
if (translations) {
|
|
1525
1568
|
return translations;
|
|
1526
1569
|
}
|
|
1527
1570
|
return translationsMap['en-PH'];
|
|
1528
1571
|
};
|
|
1529
1572
|
|
|
1530
|
-
const LeadGenContext = React.createContext({});
|
|
1573
|
+
const LeadGenContext$1 = React.createContext({});
|
|
1531
1574
|
|
|
1532
|
-
const
|
|
1533
|
-
const
|
|
1534
|
-
const
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1575
|
+
const LeadGenTranslationProvider = (props) => {
|
|
1576
|
+
const { locale, children } = props;
|
|
1577
|
+
const translationContextValue = React.useMemo(() => ({ locale, values: getTranslations(locale) }), [locale]);
|
|
1578
|
+
return (React__default["default"].createElement(translationsContext.TranslationsContext.Provider, { value: translationContextValue }, children));
|
|
1579
|
+
};
|
|
1580
|
+
|
|
1581
|
+
// import mockLeadData from './mockLeadData'
|
|
1582
|
+
const listCampaignScheduled = [];
|
|
1583
|
+
const listCampaignScheduledToActivated = [];
|
|
1584
|
+
const listCampaignActiveButExpired = [];
|
|
1585
|
+
const listCampaignExcludeSonsored = [];
|
|
1586
|
+
const listCampaignDifferentSponsor = [];
|
|
1587
|
+
const listCampaignNotDisplayInRangeOfTime = [];
|
|
1588
|
+
function isMobile() {
|
|
1589
|
+
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|Opera Mini/i.test(navigator.userAgent);
|
|
1590
|
+
}
|
|
1591
|
+
const getShuffleArray = (array) => {
|
|
1592
|
+
const newArray = [...array];
|
|
1593
|
+
for (let i = newArray.length - 1; i > 0; i--) {
|
|
1594
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
1595
|
+
const temp = newArray[i];
|
|
1596
|
+
newArray[i] = newArray[j];
|
|
1597
|
+
newArray[j] = temp;
|
|
1598
|
+
}
|
|
1599
|
+
return newArray;
|
|
1600
|
+
};
|
|
1601
|
+
const getTimeByTimezone = (timeZone = 'UTC') => {
|
|
1602
|
+
const date = new Date();
|
|
1603
|
+
return new Date(date.toLocaleString('en-US', { timeZone }));
|
|
1604
|
+
};
|
|
1605
|
+
const parseDateByCampaignTime = (dateStr) => {
|
|
1606
|
+
// Format like this: 2023-04-04 00:00:00
|
|
1607
|
+
try {
|
|
1608
|
+
const [datePart, timePart] = dateStr.split(' ');
|
|
1609
|
+
const [year, month, day] = datePart.split('-').map(Number);
|
|
1610
|
+
const [hours, minutes, seconds] = timePart.split(':').map(Number);
|
|
1611
|
+
/** JavaScript counts months from 0 to 11 */
|
|
1612
|
+
return new Date(year, month - 1, day, hours, minutes, seconds);
|
|
1613
|
+
}
|
|
1614
|
+
catch (err) {
|
|
1615
|
+
return null;
|
|
1616
|
+
}
|
|
1617
|
+
};
|
|
1618
|
+
const checkCampaignNowInTimeframe = (c) => {
|
|
1619
|
+
var _a;
|
|
1620
|
+
const siteId = ((_a = c.site) === null || _a === void 0 ? void 0 : _a.id) || 1;
|
|
1621
|
+
const startedAtStr = c.started_at;
|
|
1622
|
+
const endedAtStr = c.ended_at;
|
|
1623
|
+
const startedDate = parseDateByCampaignTime(startedAtStr);
|
|
1624
|
+
const endedDate = parseDateByCampaignTime(endedAtStr);
|
|
1625
|
+
if (!startedDate || !endedDate) {
|
|
1626
|
+
return false;
|
|
1627
|
+
}
|
|
1628
|
+
const timeZone = LEAD_TIMEZONE_DATA[siteId];
|
|
1629
|
+
const nowWithTimezoneMs = getTimeByTimezone(timeZone).getTime();
|
|
1630
|
+
if (nowWithTimezoneMs <= endedDate.getTime() &&
|
|
1631
|
+
nowWithTimezoneMs >= startedDate.getTime()) {
|
|
1632
|
+
listCampaignScheduledToActivated.push(c);
|
|
1633
|
+
return true;
|
|
1634
|
+
}
|
|
1635
|
+
return false;
|
|
1636
|
+
};
|
|
1637
|
+
function checkCampaignActiveButExpireAlready(c) {
|
|
1638
|
+
var _a;
|
|
1639
|
+
/** Do not setup timeframe for this campaign. No need to check */
|
|
1640
|
+
if (c.forever === 1) {
|
|
1641
|
+
return true;
|
|
1642
|
+
}
|
|
1643
|
+
const startedAtStr = c.started_at;
|
|
1644
|
+
const endedAtStr = c.ended_at;
|
|
1645
|
+
const startedDate = parseDateByCampaignTime(startedAtStr);
|
|
1646
|
+
const endedDate = parseDateByCampaignTime(endedAtStr);
|
|
1647
|
+
/** Do not setup timeframe for this campaign. No need to check */
|
|
1648
|
+
if (!startedDate || !endedDate) {
|
|
1649
|
+
return true;
|
|
1650
|
+
}
|
|
1651
|
+
const siteId = ((_a = c.site) === null || _a === void 0 ? void 0 : _a.id) || 1;
|
|
1652
|
+
const timeZone = LEAD_TIMEZONE_DATA[siteId];
|
|
1653
|
+
const nowWithTimezoneMs = getTimeByTimezone(timeZone).getTime();
|
|
1654
|
+
/** Check if this expire already, do not show */
|
|
1655
|
+
if (nowWithTimezoneMs > endedDate.getTime()) {
|
|
1656
|
+
listCampaignActiveButExpired.push(c);
|
|
1657
|
+
return false;
|
|
1658
|
+
}
|
|
1659
|
+
return true;
|
|
1660
|
+
}
|
|
1661
|
+
function shouldNotDisplayIfExcludeAllSponsors(c) {
|
|
1662
|
+
var _a;
|
|
1663
|
+
const excludeSponsored = Number((_a = c.rules.find((i) => i.rule == 'exclude_sponsored')) === null || _a === void 0 ? void 0 : _a.value);
|
|
1664
|
+
const isSponsored = Boolean(document.querySelector('.hhg-disclaimer-text'));
|
|
1665
|
+
if (isSponsored && excludeSponsored) {
|
|
1666
|
+
listCampaignExcludeSonsored.push(c);
|
|
1667
|
+
return true;
|
|
1668
|
+
}
|
|
1669
|
+
return false;
|
|
1670
|
+
}
|
|
1671
|
+
function shouldDisplayWithCurrentSponsor(c) {
|
|
1672
|
+
var _a, _b;
|
|
1673
|
+
try {
|
|
1674
|
+
// TODO: BE will rename `exclude_sponsored_list` later
|
|
1675
|
+
const stringOrArray = (_a = c.rules.find((i) => i.rule == 'exclude_sponsored_list')) === null || _a === void 0 ? void 0 : _a.value;
|
|
1676
|
+
const whiteListSponsors = stringOrArray instanceof Array ? stringOrArray : JSON.parse(stringOrArray);
|
|
1677
|
+
const dataSponsoredId = Number((_b = document
|
|
1678
|
+
.querySelector('[data-sponsored-id]')) === null || _b === void 0 ? void 0 : _b.getAttribute('data-sponsored-id'));
|
|
1679
|
+
// There is no config for sponsor id and white list, should show as default
|
|
1680
|
+
if (!dataSponsoredId ||
|
|
1681
|
+
dataSponsoredId <= 0 ||
|
|
1682
|
+
whiteListSponsors.length === 0) {
|
|
1683
|
+
return true;
|
|
1542
1684
|
}
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
setForceCampaign(formatCampaignDetail(campaigns));
|
|
1548
|
-
});
|
|
1685
|
+
// Check the dataSponsoredId exists in the white list or not.
|
|
1686
|
+
const isExist = whiteListSponsors.find((s) => s.id == dataSponsoredId);
|
|
1687
|
+
if (isExist) {
|
|
1688
|
+
return true;
|
|
1549
1689
|
}
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
leadStore.apiLeadUrl = apiUrlProps;
|
|
1553
|
-
leadStore.apiSubotUrl = apiSubotUrl;
|
|
1554
|
-
return () => {
|
|
1555
|
-
setForceCampaign(null);
|
|
1556
|
-
};
|
|
1557
|
-
}, []);
|
|
1558
|
-
if (!forceCampaign || !(forceCampaign === null || forceCampaign === void 0 ? void 0 : forceCampaign.id)) {
|
|
1559
|
-
return null;
|
|
1690
|
+
listCampaignDifferentSponsor.push({ id: c.id, rules: c.rules });
|
|
1691
|
+
return false;
|
|
1560
1692
|
}
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
const
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1693
|
+
catch (err) {
|
|
1694
|
+
// Default is show
|
|
1695
|
+
return true;
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
const filterFnCampaign = (c) => {
|
|
1699
|
+
if (shouldNotDisplayIfExcludeAllSponsors(c)) {
|
|
1700
|
+
return false;
|
|
1701
|
+
}
|
|
1702
|
+
else if (!shouldDisplayWithCurrentSponsor(c)) {
|
|
1703
|
+
return false;
|
|
1704
|
+
}
|
|
1705
|
+
/** Active */
|
|
1706
|
+
if (c.formatted_status === 1) {
|
|
1707
|
+
return checkCampaignActiveButExpireAlready(c);
|
|
1708
|
+
}
|
|
1709
|
+
/** Schedule */
|
|
1710
|
+
if (c.formatted_status === 0) {
|
|
1711
|
+
listCampaignScheduled.push(c);
|
|
1712
|
+
return checkCampaignNowInTimeframe(c);
|
|
1713
|
+
}
|
|
1714
|
+
return false;
|
|
1715
|
+
};
|
|
1716
|
+
const fillterApprearanceTimeCampaign = (c) => {
|
|
1571
1717
|
var _a;
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
'PhoneBlock',
|
|
1582
|
-
'DateBlock',
|
|
1583
|
-
'CheckboxBlock',
|
|
1584
|
-
'RadioBlock',
|
|
1585
|
-
'DropdownBlock',
|
|
1586
|
-
'PhoneOtpBlock',
|
|
1587
|
-
'WhatsappOtpBlock',
|
|
1588
|
-
'ZaloOtpBlock',
|
|
1589
|
-
'LocationBlock',
|
|
1590
|
-
'TncBlock',
|
|
1591
|
-
];
|
|
1592
|
-
// ALL are required and can skip if not touched yet
|
|
1593
|
-
const withSharedCheck = (name, cb,
|
|
1594
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1595
|
-
block) => {
|
|
1596
|
-
return (value) => {
|
|
1597
|
-
var _a;
|
|
1598
|
-
const isBLockRequired = (_a = block === null || block === void 0 ? void 0 : block.data) === null || _a === void 0 ? void 0 : _a.required;
|
|
1599
|
-
if (!formRef.current.isTouched(name))
|
|
1600
|
-
return;
|
|
1601
|
-
if ((typeof value === 'string' && value.trim() === '') ||
|
|
1602
|
-
typeof value === 'undefined' ||
|
|
1603
|
-
(Array.isArray(value) && value.length === 0)) {
|
|
1604
|
-
return isBLockRequired
|
|
1605
|
-
? t('validator.required')
|
|
1606
|
-
: cb === null || cb === void 0 ? void 0 : cb(value);
|
|
1607
|
-
}
|
|
1608
|
-
return cb === null || cb === void 0 ? void 0 : cb(value);
|
|
1609
|
-
};
|
|
1718
|
+
try {
|
|
1719
|
+
const isTimeInRange = (currentTime, startTime, endTime) => {
|
|
1720
|
+
const startParts = startTime.split(':');
|
|
1721
|
+
const endParts = endTime.split(':');
|
|
1722
|
+
const startDate = new Date();
|
|
1723
|
+
startDate.setHours(Number(startParts[0]), Number(startParts[1]), 0, 0);
|
|
1724
|
+
const endDate = new Date();
|
|
1725
|
+
endDate.setHours(Number(endParts[0]), Number(endParts[1]), 0, 0);
|
|
1726
|
+
return currentTime >= startDate && currentTime <= endDate;
|
|
1610
1727
|
};
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1728
|
+
const rulesApprValue = (_a = c.rules.find((i) => i.rule == 'appearance_time')) === null || _a === void 0 ? void 0 : _a.value;
|
|
1729
|
+
const startTime = rulesApprValue.startTime;
|
|
1730
|
+
const endTime = rulesApprValue.endTime || '23:59';
|
|
1731
|
+
if (!startTime) {
|
|
1732
|
+
return true;
|
|
1733
|
+
}
|
|
1734
|
+
if (isTimeInRange(new Date(), startTime, endTime)) {
|
|
1735
|
+
return true;
|
|
1736
|
+
}
|
|
1737
|
+
listCampaignNotDisplayInRangeOfTime.push(c);
|
|
1738
|
+
return false;
|
|
1739
|
+
}
|
|
1740
|
+
catch (err) {
|
|
1741
|
+
return true;
|
|
1742
|
+
}
|
|
1743
|
+
};
|
|
1744
|
+
let timeoutRef = null;
|
|
1745
|
+
let LEAD_SCROLL_EVENT = null;
|
|
1746
|
+
function clearPassiveEvent() {
|
|
1747
|
+
if (timeoutRef) {
|
|
1748
|
+
clearTimeout(timeoutRef);
|
|
1749
|
+
timeoutRef = null;
|
|
1750
|
+
}
|
|
1751
|
+
if (LEAD_SCROLL_EVENT) {
|
|
1752
|
+
window.removeEventListener('scroll', LEAD_SCROLL_EVENT);
|
|
1753
|
+
LEAD_SCROLL_EVENT = null;
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
function checkShowPopup({ leadApi, leadSiteId, leadDomain, onShowPopup, DEBUG_URL, }) {
|
|
1757
|
+
// clear previous passive event, check for new condition
|
|
1758
|
+
clearPassiveEvent();
|
|
1759
|
+
const leadCurrentUrl = DEBUG_URL ||
|
|
1760
|
+
('https://' +
|
|
1761
|
+
location.hostname +
|
|
1762
|
+
location.pathname +
|
|
1763
|
+
location.search).toLowerCase();
|
|
1764
|
+
fetch(leadApi + 'api/campaign/' + leadSiteId, {
|
|
1765
|
+
method: 'POST',
|
|
1766
|
+
headers: {
|
|
1767
|
+
'Content-Type': 'application/json',
|
|
1768
|
+
},
|
|
1769
|
+
body: JSON.stringify({
|
|
1770
|
+
url: leadCurrentUrl,
|
|
1771
|
+
ga_client_id: miscCookieHelper.getCookie('_ga') || null,
|
|
1772
|
+
}),
|
|
1773
|
+
})
|
|
1774
|
+
.then((response) => {
|
|
1775
|
+
return response.json();
|
|
1776
|
+
// return mockLeadData || response.json()
|
|
1777
|
+
})
|
|
1778
|
+
.then((data) => {
|
|
1779
|
+
var _a, _b, _c, _d;
|
|
1780
|
+
LeadLog('List campagin: ', data);
|
|
1781
|
+
LEAD_RESET_VAR();
|
|
1782
|
+
if (data._status == 1) {
|
|
1783
|
+
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);
|
|
1784
|
+
if (!miscCookieHelper.getCookie('hhg-id')) {
|
|
1785
|
+
miscCookieHelper.setCookie('hhg-id', uuid.v1(), {
|
|
1786
|
+
domain: '.' + leadDomain,
|
|
1787
|
+
path: '/',
|
|
1788
|
+
});
|
|
1789
|
+
LeadLog('😍 Set HHG ID cookie');
|
|
1653
1790
|
}
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
if (value &&
|
|
1660
|
-
window.intlTelInputUtils &&
|
|
1661
|
-
!window.intlTelInputUtils.isValidNumber(String(value), LEAD_LOCALE.countryCode)) {
|
|
1662
|
-
return t('validator.phone');
|
|
1663
|
-
}
|
|
1664
|
-
if (!value)
|
|
1665
|
-
return;
|
|
1666
|
-
validatingPhoneRef.current = true;
|
|
1667
|
-
setTimeout(() => {
|
|
1668
|
-
formRef.current.setFieldError(fieldName, 'Validating...');
|
|
1669
|
-
if (b.data.singleSubmission) {
|
|
1670
|
-
checkUsedPhoneOnlyWithCache(campaignId, value)
|
|
1671
|
-
.then((tKey) => {
|
|
1672
|
-
if (tKey) {
|
|
1673
|
-
formRef.current.setFieldError(fieldName, t(tKey));
|
|
1674
|
-
}
|
|
1675
|
-
else {
|
|
1676
|
-
formRef.current.clearFieldError(fieldName);
|
|
1677
|
-
}
|
|
1678
|
-
validatingPhoneRef.current = false;
|
|
1679
|
-
})
|
|
1680
|
-
.catch((err) => {
|
|
1681
|
-
console.error(err);
|
|
1682
|
-
formRef.current.setFieldError(fieldName, err.message || 'Something went wrong');
|
|
1683
|
-
validatingPhoneRef.current = false;
|
|
1684
|
-
});
|
|
1685
|
-
}
|
|
1686
|
-
else {
|
|
1687
|
-
checkUsedEmailOrPhoneWithCache(campaignId, campaign_subot_id, {
|
|
1688
|
-
phone: value,
|
|
1689
|
-
})
|
|
1690
|
-
.then((tKey) => {
|
|
1691
|
-
if (tKey) {
|
|
1692
|
-
formRef.current.setFieldError(fieldName, t(tKey));
|
|
1693
|
-
}
|
|
1694
|
-
else {
|
|
1695
|
-
formRef.current.clearFieldError(fieldName);
|
|
1696
|
-
}
|
|
1697
|
-
validatingPhoneRef.current = false;
|
|
1698
|
-
})
|
|
1699
|
-
.catch((e) => {
|
|
1700
|
-
console.error(e);
|
|
1701
|
-
formRef.current.setFieldError(fieldName, e.message || 'Something went wrong');
|
|
1702
|
-
validatingPhoneRef.current = false;
|
|
1703
|
-
});
|
|
1704
|
-
}
|
|
1705
|
-
}, 200);
|
|
1706
|
-
}, b) });
|
|
1791
|
+
// getCookie('hhg-id')
|
|
1792
|
+
// TODO: HP-534 Filter desktop
|
|
1793
|
+
let campaignsDevice = [];
|
|
1794
|
+
if (isMobile()) {
|
|
1795
|
+
campaignsDevice = campaigns.filter((c) => c.device_types.some((d) => d.id == LEAD_DEVICE_TYPE.MOBILE));
|
|
1707
1796
|
}
|
|
1708
|
-
else
|
|
1709
|
-
|
|
1710
|
-
if (!isRequired && !value) {
|
|
1711
|
-
return;
|
|
1712
|
-
}
|
|
1713
|
-
const errMsg = t('validator.dateInvalid');
|
|
1714
|
-
const dayInJS = typeof value === 'string'
|
|
1715
|
-
? dayjs__default["default"](value, format, true)
|
|
1716
|
-
: dayjs__default["default"](value);
|
|
1717
|
-
if (!dayInJS.isValid()) {
|
|
1718
|
-
return errMsg;
|
|
1719
|
-
}
|
|
1720
|
-
}, b) });
|
|
1797
|
+
else {
|
|
1798
|
+
campaignsDevice = campaigns.filter((c) => c.device_types.some((d) => d.id == LEAD_DEVICE_TYPE.DESKTOP));
|
|
1721
1799
|
}
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1800
|
+
LeadLog(`👓 campaignsDevice`, campaignsDevice);
|
|
1801
|
+
LeadLog('--listCampaignScheduled', listCampaignScheduled);
|
|
1802
|
+
LeadLog('--listCampaignScheduledToActivated', listCampaignScheduledToActivated);
|
|
1803
|
+
LeadLog('--listCampaignActiveButExpired', listCampaignActiveButExpired);
|
|
1804
|
+
LeadLog('--listCampaignExcludeSonsored', listCampaignExcludeSonsored);
|
|
1805
|
+
LeadLog('--listCampaignDifferentSponsor', listCampaignDifferentSponsor);
|
|
1806
|
+
LeadLog('--listCampaignNotDisplayInRangeOfTime', listCampaignNotDisplayInRangeOfTime);
|
|
1807
|
+
// Check links
|
|
1808
|
+
let listLinksObj = campaignsDevice
|
|
1809
|
+
.map((i, index) => i.targets
|
|
1810
|
+
.filter((i) => i.type == CAMPAIGN_TARGET_TYPE.LINKS)
|
|
1811
|
+
.map((i) => (Object.assign(Object.assign({}, i), { campaignIndex: index }))))
|
|
1812
|
+
.flat(1);
|
|
1813
|
+
// Check list link match current href
|
|
1814
|
+
listLinksObj = listLinksObj.filter((i) => {
|
|
1815
|
+
var _a;
|
|
1816
|
+
const target = new URL(String(i.target).toLowerCase());
|
|
1817
|
+
if (i.option == 'exact_match')
|
|
1818
|
+
// FOR TEST LOCAL:
|
|
1819
|
+
// return Boolean(location.pathname === target.pathname)
|
|
1820
|
+
return Boolean(leadCurrentUrl === ((_a = target.href) === null || _a === void 0 ? void 0 : _a.toLowerCase()));
|
|
1821
|
+
if (i.option == 'start_with') {
|
|
1822
|
+
// FOR TEST LOCAL:
|
|
1823
|
+
// if (location.pathname.includes(target.pathname)) {
|
|
1824
|
+
if (leadCurrentUrl.includes(String(i.target).toLowerCase())) {
|
|
1825
|
+
const listExcluding = i.sub_target
|
|
1826
|
+
.filter((i) => i.option == 'excluding')
|
|
1827
|
+
.map((i) => { var _a; return (_a = i.value) === null || _a === void 0 ? void 0 : _a.toLowerCase(); });
|
|
1828
|
+
return !listExcluding.includes(leadCurrentUrl.split('?')[0]);
|
|
1829
|
+
}
|
|
1830
|
+
else {
|
|
1831
|
+
return false;
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
});
|
|
1835
|
+
// Check tags
|
|
1836
|
+
const listMetaTag = Array.from(document.getElementsByTagName('META')).filter((i) => i.getAttribute('property') == 'article:tag');
|
|
1837
|
+
const listTags = listMetaTag.map((i) => i.content);
|
|
1838
|
+
let listCampaignHasTag = [];
|
|
1839
|
+
let listTagsObj = [];
|
|
1840
|
+
if (listTags && listTags.length) {
|
|
1841
|
+
listCampaignHasTag = campaignsDevice
|
|
1842
|
+
.map((i, index) => i.targets
|
|
1843
|
+
.filter((i) => i.type == CAMPAIGN_TARGET_TYPE.TAGS)
|
|
1844
|
+
.map((i) => (Object.assign(Object.assign({}, i), { campaignIndex: index }))))
|
|
1845
|
+
.flat(1);
|
|
1846
|
+
listTagsObj = listCampaignHasTag.filter((i) => listTags.includes(i.target));
|
|
1847
|
+
}
|
|
1848
|
+
const listCampaginsMatch = [...listLinksObj, ...listTagsObj];
|
|
1849
|
+
const cookieKeys = document.cookie
|
|
1850
|
+
.split('; ')
|
|
1851
|
+
.map((i) => i.split('=')[0]);
|
|
1852
|
+
const listCampaignCodeSubmited = cookieKeys.filter((i) => i.includes('lead_submited'));
|
|
1853
|
+
LeadLog(`--listCampaignCodeSubmited`, listCampaignCodeSubmited);
|
|
1854
|
+
const listCampaignCodeClosed = cookieKeys.filter((i) => i.includes('lead_closed'));
|
|
1855
|
+
LeadLog(`--listCampaignCodeClosed`, listCampaignCodeClosed);
|
|
1856
|
+
const listCampaignSubmitedClosed = [
|
|
1857
|
+
...listCampaignCodeSubmited,
|
|
1858
|
+
...listCampaignCodeClosed,
|
|
1859
|
+
];
|
|
1860
|
+
const listCampaignNoSubmitedClosed = listCampaginsMatch.filter((i) => {
|
|
1861
|
+
const hasSubmited = listCampaignSubmitedClosed.some((k) => k.includes(campaignsDevice[i.campaignIndex].code));
|
|
1862
|
+
return !hasSubmited;
|
|
1863
|
+
});
|
|
1864
|
+
const listCampaignValid = getShuffleArray(listCampaignNoSubmitedClosed);
|
|
1865
|
+
// .sort(
|
|
1866
|
+
// (a, b) =>
|
|
1867
|
+
// (listCampaignValid[a.campaignIndex]?.score || 0) -
|
|
1868
|
+
// (listCampaignValid[b.campaignIndex]?.score || 0),
|
|
1869
|
+
// )
|
|
1870
|
+
LeadLog('--listCampaignValid : ', listCampaignValid);
|
|
1871
|
+
if (listCampaignValid && listCampaignValid.length) {
|
|
1872
|
+
const CAMPAIGN_SHOW = campaignsDevice[listCampaignValid[0].campaignIndex];
|
|
1873
|
+
LeadLog(`CAMPAIGN_SHOW`, CAMPAIGN_SHOW);
|
|
1874
|
+
const { rules } = CAMPAIGN_SHOW;
|
|
1875
|
+
// CHECK RULE TRIGGER POPUP
|
|
1876
|
+
const timeoutRule = Number((_c = rules.find((i) => i.rule == 'time')) === null || _c === void 0 ? void 0 : _c.value);
|
|
1877
|
+
LeadLog(`timeoutRule`, timeoutRule);
|
|
1878
|
+
const scrollRule = Number((_d = rules.find((i) => i.rule == 'scroll')) === null || _d === void 0 ? void 0 : _d.value);
|
|
1879
|
+
LeadLog(`scrollRule`, scrollRule);
|
|
1880
|
+
let impressionAction = 'TIME';
|
|
1881
|
+
if (Number.isInteger(timeoutRule)) {
|
|
1882
|
+
impressionAction = 'TIME';
|
|
1883
|
+
LeadLog('✨ SHOW AWESOME POPUP AFTER: ', timeoutRule, ' seconds');
|
|
1884
|
+
timeoutRef = setTimeout(() => {
|
|
1885
|
+
onShowPopup === null || onShowPopup === void 0 ? void 0 : onShowPopup(CAMPAIGN_SHOW, impressionAction);
|
|
1886
|
+
}, timeoutRule * 1000);
|
|
1887
|
+
}
|
|
1888
|
+
if (Number.isInteger(scrollRule)) {
|
|
1889
|
+
impressionAction = 'SCROLL';
|
|
1890
|
+
LeadLog('✨ SHOW AWESOME AFTER: SCROLL', scrollRule, ' %');
|
|
1891
|
+
const $p = document.querySelector(`[data-url="${location.pathname}"]`) ||
|
|
1892
|
+
document.querySelector('body');
|
|
1893
|
+
const pct = $p.getBoundingClientRect().top;
|
|
1894
|
+
const pb = $p.offsetHeight;
|
|
1895
|
+
LeadLog(`👓 Element check scroll: `, $p);
|
|
1896
|
+
LEAD_SCROLL_EVENT = function leadScollCheckHandler() {
|
|
1897
|
+
const wt = window.pageYOffset || document.documentElement.scrollTop;
|
|
1898
|
+
let percent = 0;
|
|
1899
|
+
if (wt >= pct) {
|
|
1900
|
+
percent = Math.round(((wt - pct) / (pb - innerHeight)) * 100);
|
|
1726
1901
|
}
|
|
1727
|
-
|
|
1902
|
+
LeadLog('---Scroll', percent, scrollRule);
|
|
1903
|
+
// TODO: CHECK FOOTER HEIGHT
|
|
1904
|
+
if (percent >= scrollRule) {
|
|
1905
|
+
window.removeEventListener('scroll', LEAD_SCROLL_EVENT);
|
|
1906
|
+
onShowPopup === null || onShowPopup === void 0 ? void 0 : onShowPopup(CAMPAIGN_SHOW, impressionAction);
|
|
1907
|
+
}
|
|
1908
|
+
};
|
|
1909
|
+
window.addEventListener('scroll', LEAD_SCROLL_EVENT, {
|
|
1910
|
+
passive: true,
|
|
1911
|
+
});
|
|
1912
|
+
}
|
|
1728
1913
|
}
|
|
1729
1914
|
else {
|
|
1730
|
-
|
|
1915
|
+
LeadLog('🚧 No lead campaigns on current URL, tags');
|
|
1731
1916
|
}
|
|
1732
|
-
}
|
|
1733
|
-
}
|
|
1917
|
+
}
|
|
1918
|
+
})
|
|
1919
|
+
.catch((err) => {
|
|
1920
|
+
LeadLog(`Lead error: `, err);
|
|
1921
|
+
});
|
|
1922
|
+
}
|
|
1923
|
+
const LeadLog = (...params) => {
|
|
1924
|
+
if (process.env.NODE_ENV !== 'production' ||
|
|
1925
|
+
(process.env.NEXT_PUBLIC_DEPLOY_ENV &&
|
|
1926
|
+
process.env.NEXT_PUBLIC_DEPLOY_ENV !== 'production') ||
|
|
1927
|
+
(typeof localStorage !== 'undefined' &&
|
|
1928
|
+
localStorage.getItem('hhg_debug') === 'true')) {
|
|
1929
|
+
console.log(...params);
|
|
1930
|
+
}
|
|
1931
|
+
};
|
|
1932
|
+
|
|
1933
|
+
const LeadGenContext = React.createContext({
|
|
1934
|
+
submit(value) {
|
|
1935
|
+
/** Init for FAKING function */
|
|
1936
|
+
LeadLog('** LeadGen Submit : ', value);
|
|
1937
|
+
return Promise.reject(value);
|
|
1938
|
+
},
|
|
1939
|
+
submitSubscriptionBox(value) {
|
|
1940
|
+
/** Init for FAKING function */
|
|
1941
|
+
LeadLog('** LeadGen SubmitSubscriptionBox : ', value);
|
|
1942
|
+
return Promise.reject(value);
|
|
1943
|
+
},
|
|
1944
|
+
impression(value) {
|
|
1945
|
+
/** Init for FAKING function */
|
|
1946
|
+
LeadLog('** LeadGen Impression : ', value);
|
|
1947
|
+
return Promise.reject(value);
|
|
1948
|
+
},
|
|
1949
|
+
/** For Subscription Box */
|
|
1950
|
+
subscriptionIcon: '',
|
|
1951
|
+
subscriptionTitle: '',
|
|
1952
|
+
});
|
|
1953
|
+
const LeadGenContextProvider = (props) => {
|
|
1954
|
+
const { campaign_code: campaignCodeProps, apiSsoUrl, apiLeadUrl, apiSubotUrl, locale: localeProps, forceCampaign: forceCampaignProps, extraValues, articleId = 1, categoryId = 1, siteDomain: site_domain, children, } = props;
|
|
1955
|
+
const [forceCampaign, setForceCampaign] = React.useState(forceCampaignProps);
|
|
1956
|
+
const [subscriptionInfo, setSubscriptionInfo] = React.useState({
|
|
1957
|
+
subscriptionIcon: '',
|
|
1958
|
+
subscriptionTitle: '',
|
|
1959
|
+
});
|
|
1960
|
+
const locale = React.useMemo(() => {
|
|
1961
|
+
return localeProps || Locale.LOCALE['PhilippinesEnglish'];
|
|
1962
|
+
}, [localeProps]);
|
|
1963
|
+
const leadGenContextValue = React.useMemo(() => (Object.assign(Object.assign({}, props), { forceCampaign })), [...Object.values(props), forceCampaign]);
|
|
1964
|
+
const { url, campaign_id, campaign_code, cookie_id, ga_client_id, category_id, article_id, article_title, } = React.useMemo(() => ({
|
|
1965
|
+
url: location.href.toLowerCase() || '',
|
|
1966
|
+
cookie_id: miscCookieHelper.getCookie('hhg-id') || null,
|
|
1967
|
+
ga_client_id: miscCookieHelper.getCookie('_ga'),
|
|
1968
|
+
campaign_id: forceCampaign === null || forceCampaign === void 0 ? void 0 : forceCampaign.id,
|
|
1969
|
+
campaign_code: campaignCodeProps || (forceCampaign === null || forceCampaign === void 0 ? void 0 : forceCampaign.code),
|
|
1970
|
+
category_id: categoryId,
|
|
1971
|
+
article_id: articleId,
|
|
1972
|
+
article_title: document.title || '',
|
|
1973
|
+
}), [campaignCodeProps, articleId, categoryId, forceCampaign === null || forceCampaign === void 0 ? void 0 : forceCampaign.id]);
|
|
1974
|
+
const fetchCampaign = React.useCallback((campaign_code) => {
|
|
1975
|
+
Service.getCampaignByCode(campaign_code).then((res) => {
|
|
1976
|
+
const { _data } = res || {};
|
|
1977
|
+
const { campaigns } = _data || {};
|
|
1978
|
+
LeadLog('** LeadGen Campaign : ', campaigns);
|
|
1979
|
+
setForceCampaign(formatCampaignDetail(campaigns));
|
|
1980
|
+
});
|
|
1981
|
+
}, [campaignCodeProps]);
|
|
1982
|
+
// TODO : Update form for LeadGen
|
|
1983
|
+
const submit = React.useCallback((data) => {
|
|
1984
|
+
return Service.postSubscriptionBoxLead({ data });
|
|
1985
|
+
}, []);
|
|
1986
|
+
const submitSubscriptionBox = React.useCallback((value) => {
|
|
1987
|
+
const data = Object.assign(Object.assign(Object.assign(Object.assign({}, value), { campaign_id,
|
|
1988
|
+
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,
|
|
1989
|
+
category_id, article_title: (extraValues === null || extraValues === void 0 ? void 0 : extraValues.article_title) || article_title });
|
|
1990
|
+
return Service.postSubscriptionBoxLead({ data });
|
|
1991
|
+
}, [
|
|
1992
|
+
extraValues,
|
|
1993
|
+
site_domain,
|
|
1994
|
+
campaign_id,
|
|
1995
|
+
article_id,
|
|
1996
|
+
article_title,
|
|
1997
|
+
category_id,
|
|
1998
|
+
url,
|
|
1999
|
+
ga_client_id,
|
|
2000
|
+
]);
|
|
2001
|
+
const impression = React.useCallback((value) => {
|
|
2002
|
+
return Service.campaignPostImpression({
|
|
2003
|
+
url: (value === null || value === void 0 ? void 0 : value.url) || url,
|
|
2004
|
+
action: (value === null || value === void 0 ? void 0 : value.action) || LEADGEN_ACTIONS.SCROLL,
|
|
2005
|
+
code: (value === null || value === void 0 ? void 0 : value.code) || campaign_code,
|
|
2006
|
+
title_article: (value === null || value === void 0 ? void 0 : value.title_article) || article_title,
|
|
2007
|
+
cookie_id: (value === null || value === void 0 ? void 0 : value.cookie_id) || cookie_id,
|
|
2008
|
+
ga_client_id: (value === null || value === void 0 ? void 0 : value.ga_client_id) || ga_client_id,
|
|
2009
|
+
extra: (value === null || value === void 0 ? void 0 : value.extra) || Object.assign({ cookie_id,
|
|
2010
|
+
article_id, subscription_title: subscriptionInfo.subscriptionTitle }, extraValues),
|
|
2011
|
+
referrer: value === null || value === void 0 ? void 0 : value.referrer,
|
|
2012
|
+
});
|
|
2013
|
+
}, [
|
|
2014
|
+
extraValues,
|
|
2015
|
+
campaign_id,
|
|
2016
|
+
url,
|
|
2017
|
+
campaign_code,
|
|
2018
|
+
article_title,
|
|
2019
|
+
cookie_id,
|
|
2020
|
+
ga_client_id,
|
|
2021
|
+
article_id,
|
|
2022
|
+
subscriptionInfo.subscriptionTitle,
|
|
2023
|
+
]);
|
|
2024
|
+
React.useEffect(() => {
|
|
2025
|
+
if (forceCampaignProps) {
|
|
2026
|
+
setForceCampaign(forceCampaignProps);
|
|
2027
|
+
return;
|
|
2028
|
+
}
|
|
2029
|
+
/** For Subscription Box */
|
|
2030
|
+
if (categoryId) {
|
|
2031
|
+
Service.getSubscriptionBoxInfo({
|
|
2032
|
+
category: categoryId,
|
|
2033
|
+
site: site_domain,
|
|
2034
|
+
}).then((res) => {
|
|
2035
|
+
const { _data } = res || {};
|
|
2036
|
+
const { item, campaign_code } = _data || {};
|
|
2037
|
+
const { icon, content } = item;
|
|
2038
|
+
LeadLog('** LeadGen SubscriptionBox campaign_code : ', campaign_code);
|
|
2039
|
+
LeadLog('** LeadGen SubscriptionBox subscription_icon : ', icon);
|
|
2040
|
+
LeadLog('** LeadGen SubscriptionBox subscription_title : ', content);
|
|
2041
|
+
if (icon && content) {
|
|
2042
|
+
setSubscriptionInfo({
|
|
2043
|
+
subscriptionIcon: icon,
|
|
2044
|
+
subscriptionTitle: content,
|
|
2045
|
+
});
|
|
2046
|
+
}
|
|
2047
|
+
fetchCampaign(campaign_code);
|
|
2048
|
+
});
|
|
2049
|
+
return;
|
|
2050
|
+
}
|
|
2051
|
+
if (campaignCodeProps) {
|
|
2052
|
+
fetchCampaign(campaignCodeProps);
|
|
2053
|
+
}
|
|
2054
|
+
}, [campaignCodeProps, categoryId]);
|
|
2055
|
+
React.useEffect(() => {
|
|
2056
|
+
leadStore.apiSsoUrl = apiSsoUrl;
|
|
2057
|
+
leadStore.apiLeadUrl = apiLeadUrl;
|
|
2058
|
+
leadStore.apiSubotUrl = apiSubotUrl;
|
|
2059
|
+
}, [apiLeadUrl, apiSubotUrl, apiSsoUrl]);
|
|
2060
|
+
if (!forceCampaign || !(forceCampaign === null || forceCampaign === void 0 ? void 0 : forceCampaign.id)) {
|
|
2061
|
+
return null;
|
|
2062
|
+
}
|
|
2063
|
+
return (React__default["default"].createElement(LeadGenContext.Provider, { value: Object.assign(Object.assign(Object.assign({}, leadGenContextValue), subscriptionInfo), { submit,
|
|
2064
|
+
submitSubscriptionBox,
|
|
2065
|
+
impression }) },
|
|
2066
|
+
React__default["default"].createElement(LeadGenTranslationProvider, { locale: locale }, children)));
|
|
2067
|
+
};
|
|
2068
|
+
const useLeadGenContext = () => {
|
|
2069
|
+
const context = React.useContext(LeadGenContext);
|
|
2070
|
+
return Object.assign(Object.assign({}, context), { apiLeadUrl: context.apiLeadUrl || leadStore.apiLeadUrl, apiSubotUrl: context.apiSubotUrl || leadStore.apiSubotUrl });
|
|
2071
|
+
};
|
|
2072
|
+
|
|
2073
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
2074
|
+
const customParseFormat = require('dayjs/plugin/customParseFormat');
|
|
2075
|
+
dayjs__default["default"].extend(customParseFormat);
|
|
2076
|
+
// You can give context variables any name
|
|
2077
|
+
const [LeadFormProvider, useLeadFormContext, useLeadForm] = form.createFormContext();
|
|
2078
|
+
const useLeadFormConfig = ({ listBlockAdded = [], validatingPhoneRef, validatingEmailRef, campaignId, campaign_subot_id = [], userInfo, format, }) => {
|
|
2079
|
+
var _a;
|
|
2080
|
+
const { t } = index.useTranslations();
|
|
2081
|
+
const initialValues = React.useMemo(() => mappingSSOToLead(userInfo), [userInfo === null || userInfo === void 0 ? void 0 : userInfo.id]);
|
|
2082
|
+
const LEAD_LOCALE = LEAD_LOCALE_DATA[(_a = document === null || document === void 0 ? void 0 : document.documentElement) === null || _a === void 0 ? void 0 : _a.lang] ||
|
|
2083
|
+
LEAD_LOCALE_DATA['vi-VN'];
|
|
2084
|
+
const validateObj = React.useMemo(() => {
|
|
2085
|
+
const InputBlocks = [
|
|
2086
|
+
'TextBlock',
|
|
2087
|
+
'NumberBlock',
|
|
2088
|
+
'EmailBlock',
|
|
2089
|
+
'PhoneBlock',
|
|
2090
|
+
'DateBlock',
|
|
2091
|
+
'CheckboxBlock',
|
|
2092
|
+
'RadioBlock',
|
|
2093
|
+
'DropdownBlock',
|
|
2094
|
+
'PhoneOtpBlock',
|
|
2095
|
+
'WhatsappOtpBlock',
|
|
2096
|
+
'ZaloOtpBlock',
|
|
2097
|
+
'LocationBlock',
|
|
2098
|
+
'TncBlock',
|
|
2099
|
+
];
|
|
2100
|
+
// ALL are required and can skip if not touched yet
|
|
2101
|
+
const withSharedCheck = (name, cb,
|
|
2102
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2103
|
+
block) => {
|
|
2104
|
+
return (value) => {
|
|
2105
|
+
var _a;
|
|
2106
|
+
const isBLockRequired = (_a = block === null || block === void 0 ? void 0 : block.data) === null || _a === void 0 ? void 0 : _a.required;
|
|
2107
|
+
if (!formRef.current.isTouched(name))
|
|
2108
|
+
return;
|
|
2109
|
+
if ((typeof value === 'string' && value.trim() === '') ||
|
|
2110
|
+
typeof value === 'undefined' ||
|
|
2111
|
+
(Array.isArray(value) && value.length === 0)) {
|
|
2112
|
+
return isBLockRequired
|
|
2113
|
+
? t('validator.required')
|
|
2114
|
+
: cb === null || cb === void 0 ? void 0 : cb(value);
|
|
2115
|
+
}
|
|
2116
|
+
return cb === null || cb === void 0 ? void 0 : cb(value);
|
|
2117
|
+
};
|
|
2118
|
+
};
|
|
2119
|
+
return listBlockAdded
|
|
2120
|
+
.filter((b) => InputBlocks.includes(b.name))
|
|
2121
|
+
.reduce((r, b) => {
|
|
2122
|
+
const { name: fieldType, data } = b || {};
|
|
2123
|
+
const { value: fieldName, required } = data || {};
|
|
2124
|
+
const isRequired = required !== null && required !== void 0 ? required : true;
|
|
2125
|
+
if (fieldType === 'NumberBlock') {
|
|
2126
|
+
return Object.assign(Object.assign({}, r), { [fieldName]: withSharedCheck(fieldName, (value) => {
|
|
2127
|
+
if (value && isNaN(Number(value))) {
|
|
2128
|
+
return t('validator.number');
|
|
2129
|
+
}
|
|
2130
|
+
}, b) });
|
|
2131
|
+
}
|
|
2132
|
+
else if (fieldType === 'EmailBlock') {
|
|
2133
|
+
return Object.assign(Object.assign({}, r), { [fieldName]: withSharedCheck(fieldName, (value) => {
|
|
2134
|
+
if (value && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) {
|
|
2135
|
+
return t('validator.email');
|
|
2136
|
+
}
|
|
2137
|
+
if (!value)
|
|
2138
|
+
return;
|
|
2139
|
+
validatingEmailRef.current = true;
|
|
2140
|
+
setTimeout(() => {
|
|
2141
|
+
formRef.current.setFieldError(fieldName, 'Validating...');
|
|
2142
|
+
checkUsedEmailOrPhoneWithCache(campaignId, campaign_subot_id, {
|
|
2143
|
+
email: value,
|
|
2144
|
+
})
|
|
2145
|
+
.then((tKey) => {
|
|
2146
|
+
if (tKey) {
|
|
2147
|
+
formRef.current.setFieldError(fieldName, t(tKey));
|
|
2148
|
+
}
|
|
2149
|
+
else {
|
|
2150
|
+
formRef.current.clearFieldError(fieldName);
|
|
2151
|
+
}
|
|
2152
|
+
validatingEmailRef.current = false;
|
|
2153
|
+
})
|
|
2154
|
+
.catch((e) => {
|
|
2155
|
+
console.error(e);
|
|
2156
|
+
formRef.current.setFieldError(fieldName, e.message || 'Something went wrong');
|
|
2157
|
+
validatingEmailRef.current = false;
|
|
2158
|
+
});
|
|
2159
|
+
}, 200);
|
|
2160
|
+
}, b) });
|
|
2161
|
+
}
|
|
2162
|
+
else if (fieldType === 'PhoneBlock' ||
|
|
2163
|
+
fieldType === 'PhoneOtpBlock' ||
|
|
2164
|
+
fieldType === 'ZaloOtpBlock' ||
|
|
2165
|
+
fieldType === 'WhatsappOtpBlock') {
|
|
2166
|
+
return Object.assign(Object.assign({}, r), { [fieldName]: withSharedCheck(fieldName, (value) => {
|
|
2167
|
+
if (value &&
|
|
2168
|
+
window.intlTelInputUtils &&
|
|
2169
|
+
!window.intlTelInputUtils.isValidNumber(String(value), LEAD_LOCALE.countryCode)) {
|
|
2170
|
+
return t('validator.phone');
|
|
2171
|
+
}
|
|
2172
|
+
if (!value)
|
|
2173
|
+
return;
|
|
2174
|
+
validatingPhoneRef.current = true;
|
|
2175
|
+
setTimeout(() => {
|
|
2176
|
+
formRef.current.setFieldError(fieldName, 'Validating...');
|
|
2177
|
+
if (b.data.singleSubmission) {
|
|
2178
|
+
checkUsedPhoneOnlyWithCache(campaignId, value)
|
|
2179
|
+
.then((tKey) => {
|
|
2180
|
+
if (tKey) {
|
|
2181
|
+
formRef.current.setFieldError(fieldName, t(tKey));
|
|
2182
|
+
}
|
|
2183
|
+
else {
|
|
2184
|
+
formRef.current.clearFieldError(fieldName);
|
|
2185
|
+
}
|
|
2186
|
+
validatingPhoneRef.current = false;
|
|
2187
|
+
})
|
|
2188
|
+
.catch((err) => {
|
|
2189
|
+
console.error(err);
|
|
2190
|
+
formRef.current.setFieldError(fieldName, err.message || 'Something went wrong');
|
|
2191
|
+
validatingPhoneRef.current = false;
|
|
2192
|
+
});
|
|
2193
|
+
}
|
|
2194
|
+
else {
|
|
2195
|
+
checkUsedEmailOrPhoneWithCache(campaignId, campaign_subot_id, {
|
|
2196
|
+
phone: value,
|
|
2197
|
+
})
|
|
2198
|
+
.then((tKey) => {
|
|
2199
|
+
if (tKey) {
|
|
2200
|
+
formRef.current.setFieldError(fieldName, t(tKey));
|
|
2201
|
+
}
|
|
2202
|
+
else {
|
|
2203
|
+
formRef.current.clearFieldError(fieldName);
|
|
2204
|
+
}
|
|
2205
|
+
validatingPhoneRef.current = false;
|
|
2206
|
+
})
|
|
2207
|
+
.catch((e) => {
|
|
2208
|
+
console.error(e);
|
|
2209
|
+
formRef.current.setFieldError(fieldName, e.message || 'Something went wrong');
|
|
2210
|
+
validatingPhoneRef.current = false;
|
|
2211
|
+
});
|
|
2212
|
+
}
|
|
2213
|
+
}, 200);
|
|
2214
|
+
}, b) });
|
|
2215
|
+
}
|
|
2216
|
+
else if (fieldType === 'DateBlock') {
|
|
2217
|
+
return Object.assign(Object.assign({}, r), { [fieldName]: withSharedCheck(fieldName, (value) => {
|
|
2218
|
+
if (!isRequired && !value) {
|
|
2219
|
+
return;
|
|
2220
|
+
}
|
|
2221
|
+
const errMsg = t('validator.dateInvalid');
|
|
2222
|
+
const dayInJS = typeof value === 'string'
|
|
2223
|
+
? dayjs__default["default"](value, format, true)
|
|
2224
|
+
: dayjs__default["default"](value);
|
|
2225
|
+
if (!dayInJS.isValid()) {
|
|
2226
|
+
return errMsg;
|
|
2227
|
+
}
|
|
2228
|
+
}, b) });
|
|
2229
|
+
}
|
|
2230
|
+
else if (fieldType === 'TncBlock') {
|
|
2231
|
+
return Object.assign(Object.assign({}, r), { [`TNC-` + b.id]: withSharedCheck('TNC-' + b.id, (value) => {
|
|
2232
|
+
if (isRequired && !value) {
|
|
2233
|
+
return t('validator.required');
|
|
2234
|
+
}
|
|
2235
|
+
}, b) });
|
|
2236
|
+
}
|
|
2237
|
+
else {
|
|
2238
|
+
return Object.assign(Object.assign({}, r), { [fieldName]: withSharedCheck(fieldName, undefined, b) });
|
|
2239
|
+
}
|
|
2240
|
+
}, {});
|
|
2241
|
+
}, [listBlockAdded.map((b) => b.name).join(','), format]);
|
|
1734
2242
|
const form = useLeadForm({
|
|
1735
2243
|
validateInputOnChange: true,
|
|
1736
2244
|
validateInputOnBlur: true,
|
|
@@ -1743,26 +2251,188 @@ const useLeadFormConfig = ({ listBlockAdded = [], validatingPhoneRef, validating
|
|
|
1743
2251
|
return { form, validateObj };
|
|
1744
2252
|
};
|
|
1745
2253
|
|
|
1746
|
-
const
|
|
1747
|
-
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"]);
|
|
1748
|
-
const id = idProps || uuid.v1() + name;
|
|
1749
|
-
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 },
|
|
1750
|
-
React__default["default"].createElement("div", { className: "mantine-Input-wrapper" },
|
|
1751
|
-
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" })))));
|
|
1752
|
-
});
|
|
1753
|
-
|
|
1754
|
-
const StyledLeadGenFormInner = styled__default["default"].div `
|
|
2254
|
+
const StyledLeadGenThankYou = styled__default["default"].div `
|
|
1755
2255
|
display: flex;
|
|
1756
|
-
flex-wrap: wrap;
|
|
1757
2256
|
gap: 8px;
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
}
|
|
2257
|
+
flex-direction: column;
|
|
2258
|
+
padding-block: 24px;
|
|
1761
2259
|
|
|
1762
|
-
.leadgen-
|
|
1763
|
-
width:
|
|
2260
|
+
.leadgen-image {
|
|
2261
|
+
width: 120px;
|
|
2262
|
+
height: 120px;
|
|
2263
|
+
margin-inline: auto;
|
|
2264
|
+
object-fit: contain;
|
|
2265
|
+
object-position: center;
|
|
2266
|
+
text-align: center;
|
|
1764
2267
|
}
|
|
1765
|
-
|
|
2268
|
+
|
|
2269
|
+
.leadgen-title {
|
|
2270
|
+
margin-block: 0;
|
|
2271
|
+
color: ${miscTheme.theme.colors.gray900};
|
|
2272
|
+
font-weight: 700;
|
|
2273
|
+
font-size: 18px;
|
|
2274
|
+
line-height: 28px;
|
|
2275
|
+
letter-spacing: -0.2px;
|
|
2276
|
+
}
|
|
2277
|
+
|
|
2278
|
+
.leadgen-description {
|
|
2279
|
+
margin-block: 0;
|
|
2280
|
+
color: ${miscTheme.theme.colors.gray600};
|
|
2281
|
+
font-weight: 400;
|
|
2282
|
+
font-size: 14px;
|
|
2283
|
+
line-height: 22px;
|
|
2284
|
+
letter-spacing: -0.2px;
|
|
2285
|
+
text-align: center;
|
|
2286
|
+
}
|
|
2287
|
+
|
|
2288
|
+
> [data-align] {
|
|
2289
|
+
&[data-align='right'] {
|
|
2290
|
+
text-align: right;
|
|
2291
|
+
}
|
|
2292
|
+
&[data-align='center'] {
|
|
2293
|
+
text-align: center;
|
|
2294
|
+
}
|
|
2295
|
+
}
|
|
2296
|
+
`;
|
|
2297
|
+
const LeadGenThankYou = ({ image, title, description, showButton = false, button, className, style, }) => {
|
|
2298
|
+
const { src } = image;
|
|
2299
|
+
const { htmlText: titleText, align: titleAlign } = title;
|
|
2300
|
+
const { htmlText: descriptionText, align: descriptionAlign } = description;
|
|
2301
|
+
const { htmlText: buttonText, newtab, url, onClick } = button;
|
|
2302
|
+
return (React__default["default"].createElement(StyledLeadGenThankYou, { className: className, style: style },
|
|
2303
|
+
React__default["default"].createElement("img", { src: src, alt: "", className: "leadgen-thankyou_image leadgen-image" }),
|
|
2304
|
+
React__default["default"].createElement("p", { className: "leadgen-thankyou_title leadgen-title", "data-align": titleAlign }, titleText),
|
|
2305
|
+
React__default["default"].createElement("p", { className: "leadgen-thankyou_description leadgen-description", "data-align": descriptionAlign }, descriptionText),
|
|
2306
|
+
!!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))));
|
|
2307
|
+
};
|
|
2308
|
+
|
|
2309
|
+
const StyledLeadGenSubscriptionBoxBody = styled__default["default"].div `
|
|
2310
|
+
margin-top: 16px;
|
|
2311
|
+
.leadgen-btn {
|
|
2312
|
+
margin-top: 16px;
|
|
2313
|
+
}
|
|
2314
|
+
`;
|
|
2315
|
+
const StyledLeadGenSubscriptionBoxHeaderImage = styled__default["default"].div `
|
|
2316
|
+
margin-top: 3px;
|
|
2317
|
+
margin-right: 20px;
|
|
2318
|
+
width: 44px;
|
|
2319
|
+
height: 44px;
|
|
2320
|
+
|
|
2321
|
+
img {
|
|
2322
|
+
width: 100%;
|
|
2323
|
+
height: 100%;
|
|
2324
|
+
object-fix: contain;
|
|
2325
|
+
onject-position: center;
|
|
2326
|
+
}
|
|
2327
|
+
|
|
2328
|
+
:has(img[src='']) {
|
|
2329
|
+
display: none;
|
|
2330
|
+
}
|
|
2331
|
+
`;
|
|
2332
|
+
const StyledLeadGenSubscriptionBoxHeader = styled__default["default"].div `
|
|
2333
|
+
display: flex;
|
|
2334
|
+
align-items: center;
|
|
2335
|
+
margin-bottom: 16px;
|
|
2336
|
+
.leadgen-title {
|
|
2337
|
+
margin-bottom: 0;
|
|
2338
|
+
flex: 1;
|
|
2339
|
+
min-width: 0;
|
|
2340
|
+
color: ${miscTheme.theme.colors.gray900};
|
|
2341
|
+
font-size: 18px;
|
|
2342
|
+
font-weight: 400;
|
|
2343
|
+
line-height: 1.4;
|
|
2344
|
+
letter-spacing: -0.8px;
|
|
2345
|
+
}
|
|
2346
|
+
`;
|
|
2347
|
+
const StyledLeadGenSubscriptionBox = styled__default["default"].div `
|
|
2348
|
+
padding: 16px;
|
|
2349
|
+
border: 1px solid ${miscTheme.theme.colors.neutral100};
|
|
2350
|
+
border-radius: 12px;
|
|
2351
|
+
margin-inline: auto;
|
|
2352
|
+
.leadgen-form_inputs {
|
|
2353
|
+
.leadgen-form_input {
|
|
2354
|
+
width: 100%;
|
|
2355
|
+
}
|
|
2356
|
+
}
|
|
2357
|
+
|
|
2358
|
+
.leadgen-form_input {
|
|
2359
|
+
.mantine-Input-wrapper {
|
|
2360
|
+
max-height: 56px;
|
|
2361
|
+
}
|
|
2362
|
+
}
|
|
2363
|
+
|
|
2364
|
+
@media screen and (min-width: 768px) {
|
|
2365
|
+
.leadgen-subscription_box_body {
|
|
2366
|
+
display: flex;
|
|
2367
|
+
> form {
|
|
2368
|
+
flex: 1;
|
|
2369
|
+
min-width: 0;
|
|
2370
|
+
|
|
2371
|
+
.leadgen-form_inputs {
|
|
2372
|
+
.leadgen-form_input {
|
|
2373
|
+
width: calc(50% - 4px);
|
|
2374
|
+
}
|
|
2375
|
+
}
|
|
2376
|
+
}
|
|
2377
|
+
|
|
2378
|
+
.leadgen-btn {
|
|
2379
|
+
margin-top: 0;
|
|
2380
|
+
margin-left: 8px;
|
|
2381
|
+
width: auto;
|
|
2382
|
+
min-height: 56px;
|
|
2383
|
+
}
|
|
2384
|
+
}
|
|
2385
|
+
}
|
|
2386
|
+
`;
|
|
2387
|
+
const StyledLeadGenSubscriptionBoxA = styled__default["default"].div `
|
|
2388
|
+
.leadgen-form_input {
|
|
2389
|
+
--phone-select: 45px;
|
|
2390
|
+
.PhoneInput {
|
|
2391
|
+
--phone-select: 45px;
|
|
2392
|
+
.PhoneInputCountry {
|
|
2393
|
+
margin-top: 1px;
|
|
2394
|
+
pointer-events: none;
|
|
2395
|
+
.PhoneInputCountryIconImg,
|
|
2396
|
+
.PhoneInputArrowContainer {
|
|
2397
|
+
display: none;
|
|
2398
|
+
}
|
|
2399
|
+
}
|
|
2400
|
+
}
|
|
2401
|
+
}
|
|
2402
|
+
`;
|
|
2403
|
+
|
|
2404
|
+
const PhoneInput = React.forwardRef((props, ref) => {
|
|
2405
|
+
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"]);
|
|
2406
|
+
const id = idProps || uuid.v1() + name;
|
|
2407
|
+
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 },
|
|
2408
|
+
React__default["default"].createElement("div", { className: "mantine-Input-wrapper" },
|
|
2409
|
+
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" })))));
|
|
2410
|
+
});
|
|
2411
|
+
|
|
2412
|
+
const formatLeadGenFormValue = (values, blocks) => {
|
|
2413
|
+
const newValues = {};
|
|
2414
|
+
for (const block of blocks) {
|
|
2415
|
+
const { data } = block || {};
|
|
2416
|
+
const { value: fieldName } = data || {};
|
|
2417
|
+
if (fieldName in values) {
|
|
2418
|
+
newValues[fieldName] = values[fieldName];
|
|
2419
|
+
}
|
|
2420
|
+
}
|
|
2421
|
+
return newValues;
|
|
2422
|
+
};
|
|
2423
|
+
|
|
2424
|
+
const StyledLeadGenFormInner = styled__default["default"].div `
|
|
2425
|
+
display: flex;
|
|
2426
|
+
flex-wrap: wrap;
|
|
2427
|
+
gap: 8px;
|
|
2428
|
+
.leadgen-form_input {
|
|
2429
|
+
width: calc(50% - 4px);
|
|
2430
|
+
}
|
|
2431
|
+
|
|
2432
|
+
.leadgen-form_input_checkbox {
|
|
2433
|
+
width: 100%;
|
|
2434
|
+
}
|
|
2435
|
+
`;
|
|
1766
2436
|
|
|
1767
2437
|
const cssInputNotShrink$1 = react.css `
|
|
1768
2438
|
height: 100% !important;
|
|
@@ -2152,10 +2822,22 @@ const LeadGenForm = React.forwardRef((props, ref) => {
|
|
|
2152
2822
|
const { locale, blocks, scrollToErrorField = true, form: formProps, rules: validate, initialValues, onFinish, onFinishFailed, className, style, } = props;
|
|
2153
2823
|
const formRef = React.useRef(null);
|
|
2154
2824
|
const form$1 = formProps || form.useForm({ initialValues, validate });
|
|
2155
|
-
const middlewareFinish = (values, event) => {
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2825
|
+
const middlewareFinish = React.useCallback((values, event) => {
|
|
2826
|
+
/** Set `touched` all values for validation when submiting */
|
|
2827
|
+
form$1.setTouched(blocks.reduce((touched, { data }) => {
|
|
2828
|
+
touched[data.value] = true;
|
|
2829
|
+
return touched;
|
|
2830
|
+
}, {}));
|
|
2831
|
+
/** Wait for `touched` state and then submit */
|
|
2832
|
+
setTimeout(() => {
|
|
2833
|
+
const { hasErrors } = form$1.validate();
|
|
2834
|
+
if (hasErrors) {
|
|
2835
|
+
return;
|
|
2836
|
+
}
|
|
2837
|
+
onFinish === null || onFinish === void 0 ? void 0 : onFinish(formatLeadGenFormValue(values, blocks), event);
|
|
2838
|
+
}, 100);
|
|
2839
|
+
}, [form$1, blocks]);
|
|
2840
|
+
const middlewareFinishFailed = React.useCallback((errors, values, events) => {
|
|
2159
2841
|
if (scrollToErrorField && errors) {
|
|
2160
2842
|
const firstErrorKey = Object.keys(errors)[0];
|
|
2161
2843
|
const firstErrorElement = document.querySelector(`[name="${firstErrorKey}"]`);
|
|
@@ -2171,7 +2853,7 @@ const LeadGenForm = React.forwardRef((props, ref) => {
|
|
|
2171
2853
|
}
|
|
2172
2854
|
}
|
|
2173
2855
|
onFinishFailed === null || onFinishFailed === void 0 ? void 0 : onFinishFailed(errors, values, events);
|
|
2174
|
-
};
|
|
2856
|
+
}, [scrollToErrorField]);
|
|
2175
2857
|
React.useEffect(() => {
|
|
2176
2858
|
(() => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
|
|
2177
2859
|
if (!window.intlTelInputUtils) {
|
|
@@ -2179,7 +2861,9 @@ const LeadGenForm = React.forwardRef((props, ref) => {
|
|
|
2179
2861
|
}
|
|
2180
2862
|
}))();
|
|
2181
2863
|
}, []);
|
|
2182
|
-
React.useImperativeHandle(ref, () => (Object.assign(Object.assign({}, form$1), { submit: () =>
|
|
2864
|
+
React.useImperativeHandle(ref, () => (Object.assign(Object.assign({}, form$1), { submit: () => {
|
|
2865
|
+
formRef.current.requestSubmit();
|
|
2866
|
+
} })), [form$1, formRef]);
|
|
2183
2867
|
if (!blocks || !blocks.length) {
|
|
2184
2868
|
return null;
|
|
2185
2869
|
}
|
|
@@ -2247,7 +2931,7 @@ const LeadGenForm = React.forwardRef((props, ref) => {
|
|
|
2247
2931
|
return (React__default["default"].createElement("div", { className: "leadgen-choiceContainer" }, children));
|
|
2248
2932
|
} }, formInputProps), listQuestion.map((l, _index) => (React__default["default"].createElement(core.Radio, { name: name, key: _index, value: l.value, label: l.placeholder, "data-control": "radio" }))))));
|
|
2249
2933
|
}
|
|
2250
|
-
case
|
|
2934
|
+
case LEADGEN_BLOCK.TncBlock:
|
|
2251
2935
|
return (React__default["default"].createElement(ChoiceField$1, { className: "leadgen-form_input leadgen-form_input_checkbox", key: reactKey },
|
|
2252
2936
|
React__default["default"].createElement(core.Input.Wrapper, { error: error },
|
|
2253
2937
|
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)))));
|
|
@@ -2260,287 +2944,156 @@ const LeadGenForm = React.forwardRef((props, ref) => {
|
|
|
2260
2944
|
|
|
2261
2945
|
const LEADGEN_ORDER_INPUT_WRAPPER = ['label', 'input', 'description', 'error'];
|
|
2262
2946
|
|
|
2263
|
-
const
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2947
|
+
const LeadGenSubscriptionBoxA = (props) => {
|
|
2948
|
+
const { loading, image, title, submitText, locale, blocks, form, rules, onFinish, } = props;
|
|
2949
|
+
const formRef = React.useRef();
|
|
2950
|
+
const imageComp = React.useMemo(() => {
|
|
2951
|
+
if (!image) {
|
|
2952
|
+
return null;
|
|
2953
|
+
}
|
|
2954
|
+
return (React__default["default"].createElement(StyledLeadGenSubscriptionBoxHeaderImage, null,
|
|
2955
|
+
React__default["default"].createElement("img", { src: image, alt: "" })));
|
|
2956
|
+
}, [image]);
|
|
2957
|
+
const titleComp = React.useMemo(() => {
|
|
2958
|
+
if (typeof title === 'string') {
|
|
2959
|
+
return (React__default["default"].createElement("p", { className: "leadgen-title", dangerouslySetInnerHTML: { __html: title } }));
|
|
2960
|
+
}
|
|
2961
|
+
return React__default["default"].createElement("p", { className: "leadgen-title" }, title);
|
|
2962
|
+
}, [title]);
|
|
2963
|
+
return (React__default["default"].createElement(StyledLeadGenSubscriptionBoxA, { className: "subcription_box_A" },
|
|
2964
|
+
React__default["default"].createElement(StyledLeadGenSubscriptionBoxHeader, { className: "leadgen-subscription_box_header" },
|
|
2965
|
+
imageComp,
|
|
2966
|
+
titleComp),
|
|
2967
|
+
React__default["default"].createElement(StyledLeadGenSubscriptionBoxBody, { className: "leadgen-subscription_box_body" },
|
|
2968
|
+
React__default["default"].createElement(LeadGenForm, { ref: formRef, form: form, rules: rules, blocks: blocks, locale: locale, onFinish: onFinish, className: "leadgen-subscription_box_form" }),
|
|
2969
|
+
React__default["default"].createElement(core.Button, { disabled: loading, loading: loading, variant: "filled", size: "lg", onClick: () => {
|
|
2970
|
+
formRef.current.submit();
|
|
2971
|
+
}, className: "leadgen-btn leadgen-btn_action", fullWidth: true }, submitText))));
|
|
2972
|
+
};
|
|
2268
2973
|
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2974
|
+
const LeadGenSubscriptionBoxWithoutMemo = ({ locale, userInfo, forceCampaign, categoryId, }) => {
|
|
2975
|
+
var _a, _b, _c;
|
|
2976
|
+
const { image, extra_fields, id: campaign_id, bot_id: campaign_subot_id = [], ThankYouBlock, } = forceCampaign || {};
|
|
2977
|
+
const { textBlocks, listBlockAdded, actionBlocks } = extra_fields || {};
|
|
2978
|
+
const { submitBlock } = actionBlocks || {};
|
|
2979
|
+
const { apiLeadUrl, subscriptionIcon, subscriptionTitle, submitSubscriptionBox, impression, onFinish, } = useLeadGenContext();
|
|
2980
|
+
const { t } = index.useTranslations();
|
|
2981
|
+
const { action: { pushNotifications }, } = React.useContext(togetherComponentGlobalContext.TogetherComponentGlobalContext);
|
|
2982
|
+
const refContainer = React.useRef(null);
|
|
2983
|
+
const [loading, setLoading] = React.useState(false);
|
|
2984
|
+
const [showThankyou, setShowThankyou] = React.useState(false);
|
|
2985
|
+
const validatingEmailRef = React.useRef(false);
|
|
2986
|
+
const validatingPhoneRef = React.useRef(false);
|
|
2987
|
+
const { form, validateObj } = useLeadFormConfig({
|
|
2988
|
+
listBlockAdded,
|
|
2989
|
+
campaignId: campaign_id,
|
|
2990
|
+
campaign_subot_id,
|
|
2991
|
+
validatingEmailRef,
|
|
2992
|
+
validatingPhoneRef,
|
|
2993
|
+
userInfo,
|
|
2994
|
+
});
|
|
2995
|
+
const subscription_title = React.useMemo(() => {
|
|
2996
|
+
var _a, _b;
|
|
2997
|
+
return subscriptionTitle ||
|
|
2998
|
+
((_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) ||
|
|
2999
|
+
t('leadgen.message.title.default');
|
|
3000
|
+
}, [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]);
|
|
3001
|
+
const { image: thankyouImage, title: thankyouTitle, description: thankyouDescription, button: thankyouButton, } = ThankYouBlock || {};
|
|
3002
|
+
const intersectionObserverCallback = React.useCallback((entries) => {
|
|
3003
|
+
entries.forEach((entry) => {
|
|
3004
|
+
const { isIntersecting, target } = entry;
|
|
3005
|
+
if (!showThankyou &&
|
|
3006
|
+
isIntersecting &&
|
|
3007
|
+
target === refContainer.current) {
|
|
3008
|
+
impression();
|
|
3009
|
+
}
|
|
3010
|
+
});
|
|
3011
|
+
}, [impression, showThankyou]);
|
|
3012
|
+
const IObserver = new IntersectionObserver(intersectionObserverCallback);
|
|
3013
|
+
const middlewareOnSubmit = React.useCallback((values) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
|
|
3014
|
+
const newValues = {
|
|
3015
|
+
subscription_title,
|
|
3016
|
+
};
|
|
3017
|
+
const ssoValues = {
|
|
3018
|
+
sso_user_id: undefined,
|
|
3019
|
+
sso_uuid: undefined,
|
|
3020
|
+
sso_verified_profile: undefined,
|
|
3021
|
+
};
|
|
3022
|
+
const valueKeys = Object.keys(values);
|
|
3023
|
+
for (const key of valueKeys) {
|
|
3024
|
+
const isPhoneField = leadGenFieldNamePhone(listBlockAdded).some((k) => k === key);
|
|
3025
|
+
if (isPhoneField) {
|
|
3026
|
+
const phone = PhoneInputBase.parsePhoneNumber(values[key]);
|
|
3027
|
+
if (phone.isValid()) {
|
|
3028
|
+
/** Seperate `area_code` and `phone_number` for BE */
|
|
3029
|
+
newValues['area_code'] = `+${phone.countryCallingCode}`;
|
|
3030
|
+
newValues['phone_number'] = phone.nationalNumber;
|
|
3031
|
+
/** Only case login has this update */
|
|
3032
|
+
if ((userInfo === null || userInfo === void 0 ? void 0 : userInfo.id) && (userInfo === null || userInfo === void 0 ? void 0 : userInfo.uid)) {
|
|
3033
|
+
ssoValues['sso_verified_profile'] =
|
|
3034
|
+
phone.number === (userInfo === null || userInfo === void 0 ? void 0 : userInfo.phone) ? 1 : 0;
|
|
3035
|
+
ssoValues['sso_user_id'] = userInfo === null || userInfo === void 0 ? void 0 : userInfo.id;
|
|
3036
|
+
ssoValues['sso_uuid'] = userInfo === null || userInfo === void 0 ? void 0 : userInfo.uid;
|
|
3037
|
+
}
|
|
3038
|
+
}
|
|
3039
|
+
continue;
|
|
3040
|
+
}
|
|
3041
|
+
newValues[key] = values[key];
|
|
3042
|
+
}
|
|
3043
|
+
setLoading(true);
|
|
3044
|
+
try {
|
|
3045
|
+
const { _data } = (yield submitSubscriptionBox(Object.assign(Object.assign({}, newValues), ssoValues))) || {};
|
|
3046
|
+
const { model } = _data || {};
|
|
3047
|
+
if (model && (model === null || model === void 0 ? void 0 : model.id)) {
|
|
3048
|
+
setShowThankyou(true);
|
|
3049
|
+
onFinish === null || onFinish === void 0 ? void 0 : onFinish(Object.assign(Object.assign({}, newValues), ssoValues), listBlockAdded || []);
|
|
3050
|
+
}
|
|
3051
|
+
}
|
|
3052
|
+
catch (error) {
|
|
3053
|
+
LeadLog('** LeadGen SubscriptionBox error : ', error);
|
|
3054
|
+
pushNotifications({
|
|
3055
|
+
message: t('leadgen.message.error.default'),
|
|
3056
|
+
type: 'danger',
|
|
3057
|
+
});
|
|
3058
|
+
}
|
|
3059
|
+
setLoading(false);
|
|
3060
|
+
}), [
|
|
3061
|
+
subscription_title,
|
|
3062
|
+
listBlockAdded,
|
|
3063
|
+
userInfo === null || userInfo === void 0 ? void 0 : userInfo.id,
|
|
3064
|
+
userInfo === null || userInfo === void 0 ? void 0 : userInfo.uid,
|
|
3065
|
+
userInfo === null || userInfo === void 0 ? void 0 : userInfo.phone,
|
|
3066
|
+
]);
|
|
3067
|
+
React.useEffect(() => {
|
|
3068
|
+
if (refContainer.current) {
|
|
3069
|
+
IObserver.observe(refContainer.current);
|
|
3070
|
+
}
|
|
3071
|
+
return () => {
|
|
3072
|
+
IObserver.disconnect();
|
|
3073
|
+
};
|
|
3074
|
+
}, [categoryId]);
|
|
3075
|
+
return (React__default["default"].createElement("div", { ref: refContainer },
|
|
3076
|
+
React__default["default"].createElement(StyledLeadGenSubscriptionBox, null,
|
|
3077
|
+
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 })),
|
|
3078
|
+
!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 })))));
|
|
3079
|
+
};
|
|
3080
|
+
const LeadGenSubscriptionBox$1 = React.memo(LeadGenSubscriptionBoxWithoutMemo);
|
|
2277
3081
|
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
letter-spacing: -0.2px;
|
|
2294
|
-
text-align: center;
|
|
2295
|
-
}
|
|
2296
|
-
|
|
2297
|
-
> [data-align] {
|
|
2298
|
-
&[data-align='right'] {
|
|
2299
|
-
text-align: right;
|
|
2300
|
-
}
|
|
2301
|
-
&[data-align='center'] {
|
|
2302
|
-
text-align: center;
|
|
2303
|
-
}
|
|
2304
|
-
}
|
|
2305
|
-
`;
|
|
2306
|
-
const LeadGenThankYou = ({ image, title, description, showButton = false, button, className, style, }) => {
|
|
2307
|
-
const { src } = image;
|
|
2308
|
-
const { htmlText: titleText, align: titleAlign } = title;
|
|
2309
|
-
const { htmlText: descriptionText, align: descriptionAlign } = description;
|
|
2310
|
-
const { htmlText: buttonText, newtab, url, onClick } = button;
|
|
2311
|
-
return (React__default["default"].createElement(StyledLeadGenThankYou, { className: className, style: style },
|
|
2312
|
-
React__default["default"].createElement("img", { src: src, alt: "", className: "leadgen-thankyou_image leadgen-image" }),
|
|
2313
|
-
React__default["default"].createElement("p", { className: "leadgen-thankyou_title leadgen-title", "data-align": titleAlign }, titleText),
|
|
2314
|
-
React__default["default"].createElement("p", { className: "leadgen-thankyou_description leadgen-description", "data-align": descriptionAlign }, descriptionText),
|
|
2315
|
-
!!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))));
|
|
2316
|
-
};
|
|
2317
|
-
|
|
2318
|
-
const StyledLeadGenSubscriptionBoxBody = styled__default["default"].div `
|
|
2319
|
-
margin-top: 16px;
|
|
2320
|
-
.leadgen-btn {
|
|
2321
|
-
margin-top: 16px;
|
|
2322
|
-
}
|
|
2323
|
-
`;
|
|
2324
|
-
const StyledLeadGenSubscriptionBoxHeaderImage = styled__default["default"].div `
|
|
2325
|
-
margin-top: 3px;
|
|
2326
|
-
margin-right: 20px;
|
|
2327
|
-
width: 44px;
|
|
2328
|
-
height: 44px;
|
|
2329
|
-
|
|
2330
|
-
img {
|
|
2331
|
-
width: 100%;
|
|
2332
|
-
height: 100%;
|
|
2333
|
-
object-fix: contain;
|
|
2334
|
-
onject-position: center;
|
|
2335
|
-
}
|
|
2336
|
-
|
|
2337
|
-
:has(img[src='']) {
|
|
2338
|
-
display: none;
|
|
2339
|
-
}
|
|
2340
|
-
`;
|
|
2341
|
-
const StyledLeadGenSubscriptionBoxHeader = styled__default["default"].div `
|
|
2342
|
-
display: flex;
|
|
2343
|
-
align-items: center;
|
|
2344
|
-
margin-bottom: 16px;
|
|
2345
|
-
.leadgen-title {
|
|
2346
|
-
margin-bottom: 0;
|
|
2347
|
-
flex: 1;
|
|
2348
|
-
min-width: 0;
|
|
2349
|
-
color: ${miscTheme.theme.colors.gray900};
|
|
2350
|
-
font-size: 18px;
|
|
2351
|
-
font-weight: 600;
|
|
2352
|
-
line-height: 1.4;
|
|
2353
|
-
letter-spacing: -0.8px;
|
|
2354
|
-
}
|
|
2355
|
-
`;
|
|
2356
|
-
const StyledLeadGenSubscriptionBox = styled__default["default"].div `
|
|
2357
|
-
padding: 16px;
|
|
2358
|
-
border: 1px solid ${miscTheme.theme.colors.neutral100};
|
|
2359
|
-
border-radius: 12px;
|
|
2360
|
-
margin-inline: auto;
|
|
2361
|
-
.leadgen-form_inputs {
|
|
2362
|
-
.leadgen-form_input {
|
|
2363
|
-
width: 100%;
|
|
2364
|
-
}
|
|
2365
|
-
}
|
|
2366
|
-
|
|
2367
|
-
.leadgen-form_input {
|
|
2368
|
-
.mantine-Input-wrapper {
|
|
2369
|
-
max-height: 56px;
|
|
2370
|
-
}
|
|
2371
|
-
}
|
|
2372
|
-
|
|
2373
|
-
@media screen and (min-width: 768px) {
|
|
2374
|
-
.leadgen-subscription_box_body {
|
|
2375
|
-
display: flex;
|
|
2376
|
-
> form {
|
|
2377
|
-
flex: 1;
|
|
2378
|
-
min-width: 0;
|
|
2379
|
-
|
|
2380
|
-
.leadgen-form_inputs {
|
|
2381
|
-
.leadgen-form_input {
|
|
2382
|
-
width: calc(50% - 4px);
|
|
2383
|
-
}
|
|
2384
|
-
}
|
|
2385
|
-
}
|
|
2386
|
-
|
|
2387
|
-
.leadgen-btn {
|
|
2388
|
-
margin-top: 0;
|
|
2389
|
-
margin-left: 8px;
|
|
2390
|
-
width: auto;
|
|
2391
|
-
min-height: 56px;
|
|
2392
|
-
}
|
|
2393
|
-
}
|
|
2394
|
-
}
|
|
2395
|
-
`;
|
|
2396
|
-
const LeadGenSubscriptionBoxWithoutMemo = ({ locale, userInfo, siteId, siteDomain, forceCampaign, campaign_code, article_id, subscription_title: subscriptionTitleProps, }) => {
|
|
2397
|
-
var _a, _b, _c;
|
|
2398
|
-
const refContainer = React.useRef(null);
|
|
2399
|
-
const validatingEmailRef = React.useRef(false);
|
|
2400
|
-
const validatingPhoneRef = React.useRef(false);
|
|
2401
|
-
const { image, extra_fields, id: campaign_id, bot_id: campaign_subot_id = [], ThankYouBlock, } = forceCampaign || {};
|
|
2402
|
-
const { textBlocks, listBlockAdded, actionBlocks } = extra_fields || {};
|
|
2403
|
-
const { submitBlock } = actionBlocks || {};
|
|
2404
|
-
const [loading, setLoading] = React.useState(false);
|
|
2405
|
-
const [showThankyou, setShowThankyou] = React.useState(false);
|
|
2406
|
-
const formRef = React.useRef(null);
|
|
2407
|
-
const { form, validateObj } = useLeadFormConfig({
|
|
2408
|
-
listBlockAdded,
|
|
2409
|
-
campaignId: campaign_id,
|
|
2410
|
-
campaign_subot_id,
|
|
2411
|
-
validatingEmailRef,
|
|
2412
|
-
validatingPhoneRef,
|
|
2413
|
-
userInfo,
|
|
2414
|
-
});
|
|
2415
|
-
const subscription_title = React.useMemo(() => { var _a, _b; return subscriptionTitleProps || ((_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); }, [subscriptionTitleProps, (_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]);
|
|
2416
|
-
const { image: thankyouImage, title: thankyouTitle, description: thankyouDescription, button: thankyouButton, } = ThankYouBlock || {};
|
|
2417
|
-
const { apiUrl } = React.useMemo(() => {
|
|
2418
|
-
let apiUrl = leadStore.apiLeadUrl;
|
|
2419
|
-
if (apiUrl.includes('localhost')) {
|
|
2420
|
-
apiUrl = 'https://dev.leadgen.hellobacsi.com/';
|
|
2421
|
-
}
|
|
2422
|
-
return {
|
|
2423
|
-
apiUrl,
|
|
2424
|
-
};
|
|
2425
|
-
}, [siteDomain, siteId]);
|
|
2426
|
-
const url = React.useMemo(() => location.href.toLowerCase() || '', []);
|
|
2427
|
-
const article_title = React.useMemo(() => document.title || '', []);
|
|
2428
|
-
const cookie_id = React.useMemo(() => miscCookieHelper.getCookie('hhg-id') || null, []);
|
|
2429
|
-
const ga_client_id = React.useMemo(() => miscCookieHelper.getCookie('_ga') || null, []);
|
|
2430
|
-
const leadgenImpression = React.useCallback(() => {
|
|
2431
|
-
Service.campaignPostImpression({
|
|
2432
|
-
url,
|
|
2433
|
-
action: LEADGEN_ACTIONS.SCROLL,
|
|
2434
|
-
code: campaign_code,
|
|
2435
|
-
title_article: article_title,
|
|
2436
|
-
cookie_id,
|
|
2437
|
-
ga_client_id,
|
|
2438
|
-
extra: { cookie_id, article_id, subscription_title },
|
|
2439
|
-
});
|
|
2440
|
-
}, [
|
|
2441
|
-
article_id,
|
|
2442
|
-
article_title,
|
|
2443
|
-
cookie_id,
|
|
2444
|
-
ga_client_id,
|
|
2445
|
-
campaign_code,
|
|
2446
|
-
subscription_title,
|
|
2447
|
-
]);
|
|
2448
|
-
const intersectionObserverCallback = React.useCallback((entries) => {
|
|
2449
|
-
entries.forEach((entry) => {
|
|
2450
|
-
const { isIntersecting, target } = entry;
|
|
2451
|
-
if (isIntersecting && target === refContainer.current) {
|
|
2452
|
-
leadgenImpression();
|
|
2453
|
-
}
|
|
2454
|
-
});
|
|
2455
|
-
}, [leadgenImpression]);
|
|
2456
|
-
const IObserver = new IntersectionObserver(intersectionObserverCallback);
|
|
2457
|
-
const middlewareOnSubmit = React.useCallback((value) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
|
|
2458
|
-
const newValue = {
|
|
2459
|
-
url,
|
|
2460
|
-
article_title,
|
|
2461
|
-
cookie_id,
|
|
2462
|
-
ga_client_id,
|
|
2463
|
-
article_id,
|
|
2464
|
-
campaign_id,
|
|
2465
|
-
campaign_code,
|
|
2466
|
-
subscription_title: subscription_title,
|
|
2467
|
-
};
|
|
2468
|
-
listBlockAdded.forEach(({ data: { value: k } }) => {
|
|
2469
|
-
newValue[k] = value[k];
|
|
2470
|
-
});
|
|
2471
|
-
setLoading(true);
|
|
2472
|
-
try {
|
|
2473
|
-
const { _data } = (yield Service.campaignPostLead({ data: newValue })) || {};
|
|
2474
|
-
const { model } = _data;
|
|
2475
|
-
if (model && model.id) {
|
|
2476
|
-
setShowThankyou(true);
|
|
2477
|
-
}
|
|
2478
|
-
}
|
|
2479
|
-
catch (error) {
|
|
2480
|
-
console.log('** Error : ', error);
|
|
2481
|
-
}
|
|
2482
|
-
setLoading(false);
|
|
2483
|
-
}), [
|
|
2484
|
-
url,
|
|
2485
|
-
article_id,
|
|
2486
|
-
article_title,
|
|
2487
|
-
cookie_id,
|
|
2488
|
-
ga_client_id,
|
|
2489
|
-
campaign_code,
|
|
2490
|
-
subscription_title,
|
|
2491
|
-
listBlockAdded,
|
|
2492
|
-
]);
|
|
2493
|
-
React.useEffect(() => {
|
|
2494
|
-
if (refContainer.current) {
|
|
2495
|
-
IObserver.observe(refContainer.current);
|
|
2496
|
-
}
|
|
2497
|
-
return () => {
|
|
2498
|
-
IObserver.disconnect();
|
|
2499
|
-
};
|
|
2500
|
-
}, [
|
|
2501
|
-
url,
|
|
2502
|
-
article_id,
|
|
2503
|
-
article_title,
|
|
2504
|
-
ga_client_id,
|
|
2505
|
-
campaign_id,
|
|
2506
|
-
campaign_code,
|
|
2507
|
-
subscription_title,
|
|
2508
|
-
]);
|
|
2509
|
-
return (React__default["default"].createElement("div", { ref: refContainer },
|
|
2510
|
-
React__default["default"].createElement(StyledLeadGenSubscriptionBox, null,
|
|
2511
|
-
showThankyou && (React__default["default"].createElement(LeadGenThankYou, { image: Object.assign(Object.assign({}, thankyouImage), { src: thankyouImage.src || `${apiUrl}admin/img/thanksyou.png` }), title: thankyouTitle, description: thankyouDescription, button: thankyouButton })),
|
|
2512
|
-
!showThankyou && (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
2513
|
-
React__default["default"].createElement(StyledLeadGenSubscriptionBoxHeader, null,
|
|
2514
|
-
!!image && (React__default["default"].createElement(StyledLeadGenSubscriptionBoxHeaderImage, null,
|
|
2515
|
-
React__default["default"].createElement("img", { src: image, alt: "" }))),
|
|
2516
|
-
React__default["default"].createElement("p", { className: "leadgen-title" }, subscription_title)),
|
|
2517
|
-
React__default["default"].createElement(StyledLeadGenSubscriptionBoxBody, { className: "leadgen-subscription_box_body" },
|
|
2518
|
-
React__default["default"].createElement(LeadGenForm, { ref: formRef, form: form, rules: validateObj, blocks: listBlockAdded, locale: locale, onFinish: middlewareOnSubmit }),
|
|
2519
|
-
React__default["default"].createElement(core.Button, { disabled: loading, loading: loading, variant: "filled", size: "lg", onClick: () => { var _a; return (_a = formRef.current) === null || _a === void 0 ? void 0 : _a.submit(); }, className: "leadgen-btn leadgen-btn_action", fullWidth: true }, (_c = submitBlock === null || submitBlock === void 0 ? void 0 : submitBlock.data) === null || _c === void 0 ? void 0 : _c.value)))))));
|
|
2520
|
-
};
|
|
2521
|
-
const LeadGenSubscriptionBoxWithMemo = React.memo(LeadGenSubscriptionBoxWithoutMemo);
|
|
2522
|
-
|
|
2523
|
-
const Container = () => {
|
|
2524
|
-
const context = React.useContext(LeadGenSubscriptionBoxContext);
|
|
2525
|
-
const {
|
|
2526
|
-
// apiUrl: apiUrlProps,
|
|
2527
|
-
// apiSubotUrl,
|
|
2528
|
-
campaign_code, article_id, subscription_title, locale, siteId, siteDomain, userInfo, forceCampaign, } = context;
|
|
2529
|
-
if (!forceCampaign || !(forceCampaign === null || forceCampaign === void 0 ? void 0 : forceCampaign.id)) {
|
|
2530
|
-
return null;
|
|
2531
|
-
}
|
|
2532
|
-
return (React__default["default"].createElement(LeadGenSubscriptionBoxWithMemo, { locale: locale, userInfo: userInfo, siteId: siteId, siteDomain: siteDomain, forceCampaign: forceCampaign, campaign_code: campaign_code, article_id: article_id, subscription_title: subscription_title }));
|
|
2533
|
-
};
|
|
2534
|
-
Container.displayName = 'LeadGenSubscriptionBox';
|
|
2535
|
-
const LeadGenSubscriptionBoxContainer = (props) => {
|
|
2536
|
-
const { campaign_code } = props;
|
|
2537
|
-
if (!campaign_code) {
|
|
2538
|
-
return null;
|
|
2539
|
-
}
|
|
2540
|
-
return (React__default["default"].createElement(LeadGenSubscriptionBoxProvider, Object.assign({}, props),
|
|
2541
|
-
React__default["default"].createElement(Container, null)));
|
|
2542
|
-
};
|
|
2543
|
-
const LeadGenSubscriptionBox = LeadGenSubscriptionBoxContainer;
|
|
3082
|
+
const Container = () => {
|
|
3083
|
+
const context = React.useContext(LeadGenContext);
|
|
3084
|
+
const { campaign_code, locale, siteId, siteDomain, userInfo, forceCampaign } = context;
|
|
3085
|
+
if (!forceCampaign || !(forceCampaign === null || forceCampaign === void 0 ? void 0 : forceCampaign.id)) {
|
|
3086
|
+
return null;
|
|
3087
|
+
}
|
|
3088
|
+
return (React__default["default"].createElement(LeadGenSubscriptionBox$1, { locale: locale, siteId: siteId, siteDomain: siteDomain, userInfo: userInfo, forceCampaign: forceCampaign, campaign_code: campaign_code }));
|
|
3089
|
+
};
|
|
3090
|
+
Container.displayName = 'LeadGenSubscriptionBox';
|
|
3091
|
+
const LeadGenSubscriptionBoxContainer = (props) => {
|
|
3092
|
+
const { apiUrl, apiSubotUrl } = props;
|
|
3093
|
+
return (React__default["default"].createElement(LeadGenContextProvider, Object.assign({}, props, { apiLeadUrl: apiUrl, apiSubotUrl: apiSubotUrl }),
|
|
3094
|
+
React__default["default"].createElement(Container, null)));
|
|
3095
|
+
};
|
|
3096
|
+
const LeadGenSubscriptionBox = LeadGenSubscriptionBoxContainer;
|
|
2544
3097
|
|
|
2545
3098
|
const useImageSize = (src) => {
|
|
2546
3099
|
const [width, setWidth] = React.useState(16);
|
|
@@ -3609,584 +4162,232 @@ const LightboxLayout = ({ popupId, extraFields, onClose: onCloseProp, onOtherSub
|
|
|
3609
4162
|
form.setTouched(fieldStatus);
|
|
3610
4163
|
if (validatingEmailRef.current || validatingPhoneRef.current) {
|
|
3611
4164
|
return;
|
|
3612
|
-
}
|
|
3613
|
-
setTimeout(() => {
|
|
3614
|
-
form.onSubmit((v) => {
|
|
3615
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
3616
|
-
if (Object.keys(form.errors).length)
|
|
3617
|
-
return;
|
|
3618
|
-
let newShowOtpPhone = null;
|
|
3619
|
-
if (listBlockAdded.findIndex((x) => x.name === LEADGEN_BLOCK.PhoneOtpBlock) > -1) {
|
|
3620
|
-
// not submit yet, open otp
|
|
3621
|
-
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;
|
|
3622
|
-
if ((_c = v[fieldName]) === null || _c === void 0 ? void 0 : _c.startsWith('+')) {
|
|
3623
|
-
newShowOtpPhone = {
|
|
3624
|
-
phone: v[fieldName],
|
|
3625
|
-
type: 'phone',
|
|
3626
|
-
};
|
|
3627
|
-
}
|
|
3628
|
-
}
|
|
3629
|
-
if (listBlockAdded.findIndex((x) => x.name === LEADGEN_BLOCK.WhatsappOtpBlock) > -1) {
|
|
3630
|
-
// not submit yet, open otp
|
|
3631
|
-
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;
|
|
3632
|
-
if ((_f = v[fieldName]) === null || _f === void 0 ? void 0 : _f.startsWith('+')) {
|
|
3633
|
-
newShowOtpPhone = {
|
|
3634
|
-
phone: v[fieldName],
|
|
3635
|
-
type: 'whatsapp',
|
|
3636
|
-
};
|
|
3637
|
-
}
|
|
3638
|
-
}
|
|
3639
|
-
if (listBlockAdded.findIndex((x) => x.name === LEADGEN_BLOCK.ZaloOtpBlock) > -1) {
|
|
3640
|
-
// not submit yet, open otp
|
|
3641
|
-
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;
|
|
3642
|
-
if ((_j = v[fieldName]) === null || _j === void 0 ? void 0 : _j.startsWith('+')) {
|
|
3643
|
-
newShowOtpPhone = {
|
|
3644
|
-
phone: v[fieldName],
|
|
3645
|
-
type: 'zalo',
|
|
3646
|
-
};
|
|
3647
|
-
}
|
|
3648
|
-
}
|
|
3649
|
-
if (newShowOtpPhone) {
|
|
3650
|
-
setIsSubmitLoading(true);
|
|
3651
|
-
Service.sendSMSOtpLead(newShowOtpPhone)
|
|
3652
|
-
.then((res) => {
|
|
3653
|
-
var _a;
|
|
3654
|
-
const respMessage = (_a = res === null || res === void 0 ? void 0 : res._messages) === null || _a === void 0 ? void 0 : _a[0];
|
|
3655
|
-
if (respMessage === 'This phone number was verified') {
|
|
3656
|
-
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(formRef.current, v);
|
|
3657
|
-
return;
|
|
3658
|
-
}
|
|
3659
|
-
setShowOtpPhone(newShowOtpPhone);
|
|
3660
|
-
})
|
|
3661
|
-
.finally(() => {
|
|
3662
|
-
setIsSubmitLoading(false);
|
|
3663
|
-
});
|
|
3664
|
-
return;
|
|
3665
|
-
}
|
|
3666
|
-
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(formRef.current, v);
|
|
3667
|
-
})(e);
|
|
3668
|
-
}, 100);
|
|
3669
|
-
};
|
|
3670
|
-
const onOpenChange = (_open) => {
|
|
3671
|
-
setOpen(_open);
|
|
3672
|
-
if (!_open) {
|
|
3673
|
-
setTimeout(() => {
|
|
3674
|
-
onClose();
|
|
3675
|
-
}, 250);
|
|
3676
|
-
}
|
|
3677
|
-
};
|
|
3678
|
-
const { width: imageBackgroundWidth, height: imageBackgroundHeight, loaded: imageBackgroundLoaded, } = useImageSize(imageBackground);
|
|
3679
|
-
const { loaded: imageMobileLoaded } = useImageSize(imageMobile);
|
|
3680
|
-
const { loaded: imageDesktopLoaded } = useImageSize(imageDesktop);
|
|
3681
|
-
const renderAfterImageSizes = imageMobileLoaded &&
|
|
3682
|
-
imageDesktopLoaded &&
|
|
3683
|
-
(isFullscreen ? imageBackgroundLoaded : true);
|
|
3684
|
-
const ButtonSubmit = React.useMemo(() => {
|
|
3685
|
-
var _a;
|
|
3686
|
-
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));
|
|
3687
|
-
}, [popUpSubmitText, isSubmitLoading, (_b = actionBlocks === null || actionBlocks === void 0 ? void 0 : actionBlocks.submitBlock) === null || _b === void 0 ? void 0 : _b.isHide]);
|
|
3688
|
-
const LinkButtonBlock = listBlockAdded.filter(({ name }) => name == LEADGEN_BLOCK.LinkButtonBlock);
|
|
3689
|
-
const ButtonLink = !!(LinkButtonBlock === null || LinkButtonBlock === void 0 ? void 0 : LinkButtonBlock.length) && (React__default["default"].createElement(React__default["default"].Fragment, null, LinkButtonBlock.map((item, index) => {
|
|
3690
|
-
var _a, _b, _c;
|
|
3691
|
-
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", onClick: () => {
|
|
3692
|
-
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
3693
|
-
onOtherSubmit === null || onOtherSubmit === void 0 ? void 0 : onOtherSubmit();
|
|
3694
|
-
} }, (_c = item === null || item === void 0 ? void 0 : item.data) === null || _c === void 0 ? void 0 : _c.value));
|
|
3695
|
-
})));
|
|
3696
|
-
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,
|
|
3697
|
-
React__default["default"].createElement(HeaderImage, { src: imageDesktop, className: "le-only-desktop lead-modal__image" }),
|
|
3698
|
-
React__default["default"].createElement(HeaderImage, { src: imageMobile, className: "le-only-mobile lead-modal__image" })))));
|
|
3699
|
-
const PopupEmpty = showEmpty && (React__default["default"].createElement(EmptyComponent, { onClose: onClose, onContinue: () => setShowEmpty(false) }));
|
|
3700
|
-
const PopupForm = (React__default["default"].createElement(LeadFormProvider, { form: form },
|
|
3701
|
-
React__default["default"].createElement("form", { ref: formRef, className: "leadgen-form", onFocus: onFocus, onSubmit: middlewareOnSubmit },
|
|
3702
|
-
React__default["default"].createElement(FormContainer, { title: title, titleAlign: titleAlign, description: description, descriptionAlign: descriptionAlign, header: headerInsideFormContainer && PopupHeader, footer: hasForm ? ButtonSubmit : ButtonLink, "data-hidden-form": !hasForm },
|
|
3703
|
-
React__default["default"].createElement("div", { className: "leadgen-form_inner" },
|
|
3704
|
-
React__default["default"].createElement(LightboxFields, { listBlockAdded: listBlockAdded, popupId: popupId, locale: locale, onClose: onClose, onOtherSubmit: onOtherSubmit }))))));
|
|
3705
|
-
const PopupOtp = showOtpPhone && (React__default["default"].createElement(OtpBlock, { otpData: showOtpPhone, autoSendWhenOpen: false, onSuccess: () => {
|
|
3706
|
-
setShowOtpPhone(null);
|
|
3707
|
-
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(formRef.current, form.values);
|
|
3708
|
-
} }));
|
|
3709
|
-
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 }));
|
|
3710
|
-
const PopupContent = (React__default["default"].createElement("div", { className: core.clsx('leadgen-content', {
|
|
3711
|
-
'leadgen-content_small': limitFieldsLightBoxB,
|
|
3712
|
-
}) },
|
|
3713
|
-
!headerInsideFormContainer && PopupHeader,
|
|
3714
|
-
!onlyHeader && (React__default["default"].createElement("div", { className: "leadgen-inner" },
|
|
3715
|
-
PopupThankYou,
|
|
3716
|
-
!showThankyou && (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
3717
|
-
PopupOtp,
|
|
3718
|
-
PopupEmpty,
|
|
3719
|
-
!(showOtpPhone || showEmpty) && PopupForm))))));
|
|
3720
|
-
const styleOverlay = React.useMemo(() => {
|
|
3721
|
-
let styleContent = `.leadgen-inner {background-repeat: no-repeat;background-size: cover;background-position:center;}`;
|
|
3722
|
-
if (isMobile && imageOverlayMobile) {
|
|
3723
|
-
styleContent += `.leadgen-inner {background-image: url(${imageOverlayMobile});}`;
|
|
3724
|
-
}
|
|
3725
|
-
if (!isMobile && imageOverlayDesktop) {
|
|
3726
|
-
styleContent += `@media screen and (min-width:768px) {.leadgen-inner {background-image: url(${imageOverlayDesktop});}}`;
|
|
3727
|
-
}
|
|
3728
|
-
return styleContent;
|
|
3729
|
-
}, [isMobile, imageOverlayDesktop, imageOverlayMobile]);
|
|
3730
|
-
const PopupWrapper = (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
3731
|
-
React__default["default"].createElement("style", { dangerouslySetInnerHTML: { __html: styleOverlay } }),
|
|
3732
|
-
React__default["default"].createElement("div", { className: core.clsx('leadgen-wrapper', {
|
|
3733
|
-
'leadgen-wrapper_small': limitFieldsLightBoxB,
|
|
3734
|
-
}) },
|
|
3735
|
-
showButtonClose && (React__default["default"].createElement(CloseButton, { onClose: () => onOpenChange(false), containerClassName: "leadgen-close_btn" })),
|
|
3736
|
-
PopupContent)));
|
|
3737
|
-
const popupContainerClassName = core.clsx('leadgen', `leadgen-${currentLayout}`, {
|
|
3738
|
-
'leadgen-lightbox': isLightBox,
|
|
3739
|
-
'leadgen-inline': isInPage,
|
|
3740
|
-
'leadgen-slider': isSlider,
|
|
3741
|
-
});
|
|
3742
|
-
const PopupContainer = isDrawer ? (React__default["default"].createElement(index$a.DrawerComponent, { fadeFromIndex: index$7.ZINDEX_SSO - 9e6, open: open, snapPoints: [0.8, 1], activeSnapPoint: snap, setActiveSnapPoint: setSnap, onOpenChange: onOpenChange, overlayClassName: popupContainerClassName, className: "leadgen-drawer" },
|
|
3743
|
-
PopupWrapper,
|
|
3744
|
-
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 },
|
|
3745
|
-
isFullscreen ? (React__default["default"].createElement("img", { className: "le-only-desktop le-fullscreen-img", draggable: false, src: imageBackground || '', style: {
|
|
3746
|
-
aspectRatio: `${imageBackgroundWidth}/${imageBackgroundHeight}`,
|
|
3747
|
-
} })) : null,
|
|
3748
|
-
PopupWrapper));
|
|
3749
|
-
if (!renderAfterImageSizes)
|
|
3750
|
-
return null;
|
|
3751
|
-
if (isLightBox || isFullscreen || isSlider) {
|
|
3752
|
-
return PopupContainer;
|
|
3753
|
-
}
|
|
3754
|
-
else if (isSidebar) {
|
|
3755
|
-
return React__default["default"].createElement(SideBarLayout, { content: PopupContainer });
|
|
3756
|
-
}
|
|
3757
|
-
else if (isInline) {
|
|
3758
|
-
return (React__default["default"].createElement(InlineLayout, { content: PopupContainer, inlinePosition: extraFields.popupInlinePosition }));
|
|
3759
|
-
}
|
|
3760
|
-
return null;
|
|
3761
|
-
};
|
|
3762
|
-
|
|
3763
|
-
const SkinLayout = ({ popupId, link, linkText, linkNewTab, onClose, imageMobile, imageDesktop, currentLayout, onOtherSubmit, }) => {
|
|
3764
|
-
const currentPath = location.pathname;
|
|
3765
|
-
const { width: imageMobileWidth, height: imageMobileHeight, loaded: imageMobileLoaded, } = useImageSize(imageMobile);
|
|
3766
|
-
const { width: imageDesktopWidth, height: imageDesktopHeight, loaded: imageDesktopLoaded, } = useImageSize(imageDesktop);
|
|
3767
|
-
if (!imageMobileLoaded || !imageDesktopLoaded)
|
|
3768
|
-
return null;
|
|
3769
|
-
return (React__default["default"].createElement("div", { id: popupId, className: "lead-modal-wrapper", "data-popup-url": currentPath, "data-popup-type": "skin_ab" },
|
|
3770
|
-
currentLayout == 'SkinA' ? (React__default["default"].createElement("aside", { className: "le-only-desktop" },
|
|
3771
|
-
React__default["default"].createElement("div", { className: "le-skin-a-desktop" },
|
|
3772
|
-
React__default["default"].createElement("div", { style: { position: 'relative' } },
|
|
3773
|
-
React__default["default"].createElement("img", { src: imageDesktop, style: {
|
|
3774
|
-
aspectRatio: `${imageDesktopWidth}/${imageDesktopHeight}`,
|
|
3775
|
-
} }),
|
|
3776
|
-
React__default["default"].createElement("a", { style: {
|
|
3777
|
-
position: 'absolute',
|
|
3778
|
-
top: '75%',
|
|
3779
|
-
left: '50%',
|
|
3780
|
-
transform: 'translate(-50%, -50%)',
|
|
3781
|
-
textAlign: 'center',
|
|
3782
|
-
width: 'calc(100% - 15px)',
|
|
3783
|
-
}, href: link, target: linkNewTab ? 'blank' : '_parent' },
|
|
3784
|
-
React__default["default"].createElement("button", { onClick: onOtherSubmit, className: "le-joinbow-btn js-popup-other-submit" }, linkText)),
|
|
3785
|
-
React__default["default"].createElement(CloseButton, { onClose: onClose, containerClassName: "close-button-top-right" }))))) : currentLayout == 'SkinB' ? (React__default["default"].createElement("aside", { className: "le-only-desktop" },
|
|
3786
|
-
React__default["default"].createElement("div", { className: "" },
|
|
3787
|
-
React__default["default"].createElement("div", { style: { position: 'relative', zIndex: 10000 } },
|
|
3788
|
-
React__default["default"].createElement("img", { src: imageDesktop, style: {
|
|
3789
|
-
width: '100%',
|
|
3790
|
-
aspectRatio: `${imageDesktopWidth}/${imageDesktopHeight}`,
|
|
3791
|
-
} }),
|
|
3792
|
-
React__default["default"].createElement("a", { style: {
|
|
3793
|
-
position: 'absolute',
|
|
3794
|
-
top: '75%',
|
|
3795
|
-
left: '50%',
|
|
3796
|
-
transform: 'translate(-50%, -50%)',
|
|
3797
|
-
textAlign: 'center',
|
|
3798
|
-
width: '100%',
|
|
3799
|
-
}, href: link, target: linkNewTab ? 'blank' : '_parent' },
|
|
3800
|
-
React__default["default"].createElement("button", { onClick: onOtherSubmit, className: "le-joinbow-btn-mobile js-popup-other-submit" }, linkText)),
|
|
3801
|
-
React__default["default"].createElement(CloseButton, { containerClassName: "close-button-top-right", onClose: onClose }))))) : null,
|
|
3802
|
-
React__default["default"].createElement("aside", { className: "le-only-mobile" },
|
|
3803
|
-
React__default["default"].createElement("div", { className: "le-skin-mobile" },
|
|
3804
|
-
React__default["default"].createElement("div", { style: { position: 'relative' } },
|
|
3805
|
-
index$8.isVideo(imageMobile) ? (React__default["default"].createElement("video", { muted: true, autoPlay: true, loop: true },
|
|
3806
|
-
React__default["default"].createElement("source", { src: imageMobile, type: "video/mp4" }))) : (React__default["default"].createElement("img", { src: imageMobile, style: {
|
|
3807
|
-
width: '100%',
|
|
3808
|
-
aspectRatio: `${imageMobileWidth}/${imageMobileHeight}`,
|
|
3809
|
-
} })),
|
|
3810
|
-
React__default["default"].createElement("a", { style: {
|
|
3811
|
-
position: 'absolute',
|
|
3812
|
-
top: '82%',
|
|
3813
|
-
left: '50%',
|
|
3814
|
-
transform: 'translate(-50%, -50%)',
|
|
3815
|
-
textAlign: 'center',
|
|
3816
|
-
maxWidth: 'calc(100% - 15px)',
|
|
3817
|
-
}, href: link, target: linkNewTab ? 'blank' : '_parent' },
|
|
3818
|
-
React__default["default"].createElement("button", { onClick: onOtherSubmit, className: "le-joinbow-btn-mobile js-popup-other-submit" }, linkText)),
|
|
3819
|
-
React__default["default"].createElement(CloseButton, { containerClassName: "close-button-top-right", svgClassName: "le-mobile-btn", onClose: onClose }))))));
|
|
3820
|
-
};
|
|
3821
|
-
|
|
3822
|
-
// url: imageBlocks.imageMobile.data.url
|
|
3823
|
-
// newTab: imageBlocks.imageMobile.data.newtab
|
|
3824
|
-
// image: campaignShow.image
|
|
3825
|
-
// imageDestkop: campaignShow.image_desktop
|
|
3826
|
-
const TabLayout = ({ popupId, url, newTab, image, onClose, onOtherSubmit, }) => {
|
|
3827
|
-
const { width: imageWidth, height: imageHeight, loaded: imageLoaded, } = useImageSize(image);
|
|
3828
|
-
if (!imageLoaded)
|
|
3829
|
-
return null;
|
|
3830
|
-
return (React__default["default"].createElement("div", { id: popupId, className: "lead-modal-wrapper", "data-popup-url": location.pathname, "data-popup-type": "tab" },
|
|
3831
|
-
React__default["default"].createElement("div", { className: "le-tab-popup" },
|
|
3832
|
-
React__default["default"].createElement("div", { style: { position: 'relative' } },
|
|
3833
|
-
React__default["default"].createElement("a", { href: url, target: newTab ? 'blank' : '_parent', onClick: onOtherSubmit },
|
|
3834
|
-
React__default["default"].createElement("img", { className: "js-popup-other-submit", src: image, style: {
|
|
3835
|
-
aspectRatio: `${imageWidth}/${imageHeight}`,
|
|
3836
|
-
} })),
|
|
3837
|
-
React__default["default"].createElement(CloseButton, { onClose: onClose, containerClassName: "close-button-top-right" })))));
|
|
3838
|
-
};
|
|
3839
|
-
|
|
3840
|
-
// import mockLeadData from './mockLeadData'
|
|
3841
|
-
const listCampaignScheduled = [];
|
|
3842
|
-
const listCampaignScheduledToActivated = [];
|
|
3843
|
-
const listCampaignActiveButExpired = [];
|
|
3844
|
-
const listCampaignExcludeSonsored = [];
|
|
3845
|
-
const listCampaignDifferentSponsor = [];
|
|
3846
|
-
const listCampaignNotDisplayInRangeOfTime = [];
|
|
3847
|
-
function isMobile() {
|
|
3848
|
-
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|Opera Mini/i.test(navigator.userAgent);
|
|
3849
|
-
}
|
|
3850
|
-
const getShuffleArray = (array) => {
|
|
3851
|
-
const newArray = [...array];
|
|
3852
|
-
for (let i = newArray.length - 1; i > 0; i--) {
|
|
3853
|
-
const j = Math.floor(Math.random() * (i + 1));
|
|
3854
|
-
const temp = newArray[i];
|
|
3855
|
-
newArray[i] = newArray[j];
|
|
3856
|
-
newArray[j] = temp;
|
|
3857
|
-
}
|
|
3858
|
-
return newArray;
|
|
3859
|
-
};
|
|
3860
|
-
const getTimeByTimezone = (timeZone = 'UTC') => {
|
|
3861
|
-
const date = new Date();
|
|
3862
|
-
return new Date(date.toLocaleString('en-US', { timeZone }));
|
|
3863
|
-
};
|
|
3864
|
-
const parseDateByCampaignTime = (dateStr) => {
|
|
3865
|
-
// Format like this: 2023-04-04 00:00:00
|
|
3866
|
-
try {
|
|
3867
|
-
const [datePart, timePart] = dateStr.split(' ');
|
|
3868
|
-
const [year, month, day] = datePart.split('-').map(Number);
|
|
3869
|
-
const [hours, minutes, seconds] = timePart.split(':').map(Number);
|
|
3870
|
-
/** JavaScript counts months from 0 to 11 */
|
|
3871
|
-
return new Date(year, month - 1, day, hours, minutes, seconds);
|
|
3872
|
-
}
|
|
3873
|
-
catch (err) {
|
|
3874
|
-
return null;
|
|
3875
|
-
}
|
|
3876
|
-
};
|
|
3877
|
-
const checkCampaignNowInTimeframe = (c) => {
|
|
3878
|
-
var _a;
|
|
3879
|
-
const siteId = ((_a = c.site) === null || _a === void 0 ? void 0 : _a.id) || 1;
|
|
3880
|
-
const startedAtStr = c.started_at;
|
|
3881
|
-
const endedAtStr = c.ended_at;
|
|
3882
|
-
const startedDate = parseDateByCampaignTime(startedAtStr);
|
|
3883
|
-
const endedDate = parseDateByCampaignTime(endedAtStr);
|
|
3884
|
-
if (!startedDate || !endedDate) {
|
|
3885
|
-
return false;
|
|
3886
|
-
}
|
|
3887
|
-
const timeZone = LEAD_TIMEZONE_DATA[siteId];
|
|
3888
|
-
const nowWithTimezoneMs = getTimeByTimezone(timeZone).getTime();
|
|
3889
|
-
if (nowWithTimezoneMs <= endedDate.getTime() &&
|
|
3890
|
-
nowWithTimezoneMs >= startedDate.getTime()) {
|
|
3891
|
-
listCampaignScheduledToActivated.push(c);
|
|
3892
|
-
return true;
|
|
3893
|
-
}
|
|
3894
|
-
return false;
|
|
3895
|
-
};
|
|
3896
|
-
function checkCampaignActiveButExpireAlready(c) {
|
|
3897
|
-
var _a;
|
|
3898
|
-
/** Do not setup timeframe for this campaign. No need to check */
|
|
3899
|
-
if (c.forever === 1) {
|
|
3900
|
-
return true;
|
|
3901
|
-
}
|
|
3902
|
-
const startedAtStr = c.started_at;
|
|
3903
|
-
const endedAtStr = c.ended_at;
|
|
3904
|
-
const startedDate = parseDateByCampaignTime(startedAtStr);
|
|
3905
|
-
const endedDate = parseDateByCampaignTime(endedAtStr);
|
|
3906
|
-
/** Do not setup timeframe for this campaign. No need to check */
|
|
3907
|
-
if (!startedDate || !endedDate) {
|
|
3908
|
-
return true;
|
|
3909
|
-
}
|
|
3910
|
-
const siteId = ((_a = c.site) === null || _a === void 0 ? void 0 : _a.id) || 1;
|
|
3911
|
-
const timeZone = LEAD_TIMEZONE_DATA[siteId];
|
|
3912
|
-
const nowWithTimezoneMs = getTimeByTimezone(timeZone).getTime();
|
|
3913
|
-
/** Check if this expire already, do not show */
|
|
3914
|
-
if (nowWithTimezoneMs > endedDate.getTime()) {
|
|
3915
|
-
listCampaignActiveButExpired.push(c);
|
|
3916
|
-
return false;
|
|
3917
|
-
}
|
|
3918
|
-
return true;
|
|
3919
|
-
}
|
|
3920
|
-
function shouldNotDisplayIfExcludeAllSponsors(c) {
|
|
3921
|
-
var _a;
|
|
3922
|
-
const excludeSponsored = Number((_a = c.rules.find((i) => i.rule == 'exclude_sponsored')) === null || _a === void 0 ? void 0 : _a.value);
|
|
3923
|
-
const isSponsored = Boolean(document.querySelector('.hhg-disclaimer-text'));
|
|
3924
|
-
if (isSponsored && excludeSponsored) {
|
|
3925
|
-
listCampaignExcludeSonsored.push(c);
|
|
3926
|
-
return true;
|
|
3927
|
-
}
|
|
3928
|
-
return false;
|
|
3929
|
-
}
|
|
3930
|
-
function shouldDisplayWithCurrentSponsor(c) {
|
|
3931
|
-
var _a, _b;
|
|
3932
|
-
try {
|
|
3933
|
-
// TODO: BE will rename `exclude_sponsored_list` later
|
|
3934
|
-
const stringOrArray = (_a = c.rules.find((i) => i.rule == 'exclude_sponsored_list')) === null || _a === void 0 ? void 0 : _a.value;
|
|
3935
|
-
const whiteListSponsors = stringOrArray instanceof Array ? stringOrArray : JSON.parse(stringOrArray);
|
|
3936
|
-
const dataSponsoredId = Number((_b = document
|
|
3937
|
-
.querySelector('[data-sponsored-id]')) === null || _b === void 0 ? void 0 : _b.getAttribute('data-sponsored-id'));
|
|
3938
|
-
// There is no config for sponsor id and white list, should show as default
|
|
3939
|
-
if (!dataSponsoredId ||
|
|
3940
|
-
dataSponsoredId <= 0 ||
|
|
3941
|
-
whiteListSponsors.length === 0) {
|
|
3942
|
-
return true;
|
|
3943
|
-
}
|
|
3944
|
-
// Check the dataSponsoredId exists in the white list or not.
|
|
3945
|
-
const isExist = whiteListSponsors.find((s) => s.id == dataSponsoredId);
|
|
3946
|
-
if (isExist) {
|
|
3947
|
-
return true;
|
|
3948
|
-
}
|
|
3949
|
-
listCampaignDifferentSponsor.push({ id: c.id, rules: c.rules });
|
|
3950
|
-
return false;
|
|
3951
|
-
}
|
|
3952
|
-
catch (err) {
|
|
3953
|
-
// Default is show
|
|
3954
|
-
return true;
|
|
3955
|
-
}
|
|
3956
|
-
}
|
|
3957
|
-
const filterFnCampaign = (c) => {
|
|
3958
|
-
if (shouldNotDisplayIfExcludeAllSponsors(c)) {
|
|
3959
|
-
return false;
|
|
3960
|
-
}
|
|
3961
|
-
else if (!shouldDisplayWithCurrentSponsor(c)) {
|
|
3962
|
-
return false;
|
|
3963
|
-
}
|
|
3964
|
-
/** Active */
|
|
3965
|
-
if (c.formatted_status === 1) {
|
|
3966
|
-
return checkCampaignActiveButExpireAlready(c);
|
|
3967
|
-
}
|
|
3968
|
-
/** Schedule */
|
|
3969
|
-
if (c.formatted_status === 0) {
|
|
3970
|
-
listCampaignScheduled.push(c);
|
|
3971
|
-
return checkCampaignNowInTimeframe(c);
|
|
3972
|
-
}
|
|
3973
|
-
return false;
|
|
3974
|
-
};
|
|
3975
|
-
const fillterApprearanceTimeCampaign = (c) => {
|
|
3976
|
-
var _a;
|
|
3977
|
-
try {
|
|
3978
|
-
const isTimeInRange = (currentTime, startTime, endTime) => {
|
|
3979
|
-
const startParts = startTime.split(':');
|
|
3980
|
-
const endParts = endTime.split(':');
|
|
3981
|
-
const startDate = new Date();
|
|
3982
|
-
startDate.setHours(Number(startParts[0]), Number(startParts[1]), 0, 0);
|
|
3983
|
-
const endDate = new Date();
|
|
3984
|
-
endDate.setHours(Number(endParts[0]), Number(endParts[1]), 0, 0);
|
|
3985
|
-
return currentTime >= startDate && currentTime <= endDate;
|
|
3986
|
-
};
|
|
3987
|
-
const rulesApprValue = (_a = c.rules.find((i) => i.rule == 'appearance_time')) === null || _a === void 0 ? void 0 : _a.value;
|
|
3988
|
-
const startTime = rulesApprValue.startTime;
|
|
3989
|
-
const endTime = rulesApprValue.endTime || '23:59';
|
|
3990
|
-
if (!startTime) {
|
|
3991
|
-
return true;
|
|
3992
|
-
}
|
|
3993
|
-
if (isTimeInRange(new Date(), startTime, endTime)) {
|
|
3994
|
-
return true;
|
|
3995
|
-
}
|
|
3996
|
-
listCampaignNotDisplayInRangeOfTime.push(c);
|
|
3997
|
-
return false;
|
|
3998
|
-
}
|
|
3999
|
-
catch (err) {
|
|
4000
|
-
return true;
|
|
4001
|
-
}
|
|
4002
|
-
};
|
|
4003
|
-
let timeoutRef = null;
|
|
4004
|
-
let LEAD_SCROLL_EVENT = null;
|
|
4005
|
-
function clearPassiveEvent() {
|
|
4006
|
-
if (timeoutRef) {
|
|
4007
|
-
clearTimeout(timeoutRef);
|
|
4008
|
-
timeoutRef = null;
|
|
4009
|
-
}
|
|
4010
|
-
if (LEAD_SCROLL_EVENT) {
|
|
4011
|
-
window.removeEventListener('scroll', LEAD_SCROLL_EVENT);
|
|
4012
|
-
LEAD_SCROLL_EVENT = null;
|
|
4013
|
-
}
|
|
4014
|
-
}
|
|
4015
|
-
function checkShowPopup({ leadApi, leadSiteId, leadDomain, onShowPopup, DEBUG_URL, }) {
|
|
4016
|
-
// clear previous passive event, check for new condition
|
|
4017
|
-
clearPassiveEvent();
|
|
4018
|
-
const leadCurrentUrl = DEBUG_URL ||
|
|
4019
|
-
('https://' +
|
|
4020
|
-
location.hostname +
|
|
4021
|
-
location.pathname +
|
|
4022
|
-
location.search).toLowerCase();
|
|
4023
|
-
fetch(leadApi + 'api/campaign/' + leadSiteId, {
|
|
4024
|
-
method: 'POST',
|
|
4025
|
-
headers: {
|
|
4026
|
-
'Content-Type': 'application/json',
|
|
4027
|
-
},
|
|
4028
|
-
body: JSON.stringify({
|
|
4029
|
-
url: leadCurrentUrl,
|
|
4030
|
-
ga_client_id: miscCookieHelper.getCookie('_ga') || null,
|
|
4031
|
-
}),
|
|
4032
|
-
})
|
|
4033
|
-
.then((response) => {
|
|
4034
|
-
return response.json();
|
|
4035
|
-
// return mockLeadData || response.json()
|
|
4036
|
-
})
|
|
4037
|
-
.then((data) => {
|
|
4038
|
-
var _a, _b, _c, _d;
|
|
4039
|
-
LeadLog('List campagin: ', data);
|
|
4040
|
-
LEAD_RESET_VAR();
|
|
4041
|
-
if (data._status == 1) {
|
|
4042
|
-
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);
|
|
4043
|
-
if (!miscCookieHelper.getCookie('hhg-id')) {
|
|
4044
|
-
miscCookieHelper.setCookie('hhg-id', uuid.v1(), {
|
|
4045
|
-
domain: '.' + leadDomain,
|
|
4046
|
-
path: '/',
|
|
4047
|
-
});
|
|
4048
|
-
LeadLog('😍 Set HHG ID cookie');
|
|
4049
|
-
}
|
|
4050
|
-
// getCookie('hhg-id')
|
|
4051
|
-
// TODO: HP-534 Filter desktop
|
|
4052
|
-
let campaignsDevice = [];
|
|
4053
|
-
if (isMobile()) {
|
|
4054
|
-
campaignsDevice = campaigns.filter((c) => c.device_types.some((d) => d.id == LEAD_DEVICE_TYPE.MOBILE));
|
|
4055
|
-
}
|
|
4056
|
-
else {
|
|
4057
|
-
campaignsDevice = campaigns.filter((c) => c.device_types.some((d) => d.id == LEAD_DEVICE_TYPE.DESKTOP));
|
|
4058
|
-
}
|
|
4059
|
-
LeadLog(`👓 campaignsDevice`, campaignsDevice);
|
|
4060
|
-
LeadLog('--listCampaignScheduled', listCampaignScheduled);
|
|
4061
|
-
LeadLog('--listCampaignScheduledToActivated', listCampaignScheduledToActivated);
|
|
4062
|
-
LeadLog('--listCampaignActiveButExpired', listCampaignActiveButExpired);
|
|
4063
|
-
LeadLog('--listCampaignExcludeSonsored', listCampaignExcludeSonsored);
|
|
4064
|
-
LeadLog('--listCampaignDifferentSponsor', listCampaignDifferentSponsor);
|
|
4065
|
-
LeadLog('--listCampaignNotDisplayInRangeOfTime', listCampaignNotDisplayInRangeOfTime);
|
|
4066
|
-
// Check links
|
|
4067
|
-
let listLinksObj = campaignsDevice
|
|
4068
|
-
.map((i, index) => i.targets
|
|
4069
|
-
.filter((i) => i.type == CAMPAIGN_TARGET_TYPE.LINKS)
|
|
4070
|
-
.map((i) => (Object.assign(Object.assign({}, i), { campaignIndex: index }))))
|
|
4071
|
-
.flat(1);
|
|
4072
|
-
// Check list link match current href
|
|
4073
|
-
listLinksObj = listLinksObj.filter((i) => {
|
|
4074
|
-
var _a;
|
|
4075
|
-
const target = new URL(String(i.target).toLowerCase());
|
|
4076
|
-
if (i.option == 'exact_match')
|
|
4077
|
-
// FOR TEST LOCAL:
|
|
4078
|
-
// return Boolean(location.pathname === target.pathname)
|
|
4079
|
-
return Boolean(leadCurrentUrl === ((_a = target.href) === null || _a === void 0 ? void 0 : _a.toLowerCase()));
|
|
4080
|
-
if (i.option == 'start_with') {
|
|
4081
|
-
// FOR TEST LOCAL:
|
|
4082
|
-
// if (location.pathname.includes(target.pathname)) {
|
|
4083
|
-
if (leadCurrentUrl.includes(String(i.target).toLowerCase())) {
|
|
4084
|
-
const listExcluding = i.sub_target
|
|
4085
|
-
.filter((i) => i.option == 'excluding')
|
|
4086
|
-
.map((i) => { var _a; return (_a = i.value) === null || _a === void 0 ? void 0 : _a.toLowerCase(); });
|
|
4087
|
-
return !listExcluding.includes(leadCurrentUrl.split('?')[0]);
|
|
4088
|
-
}
|
|
4089
|
-
else {
|
|
4090
|
-
return false;
|
|
4091
|
-
}
|
|
4092
|
-
}
|
|
4093
|
-
});
|
|
4094
|
-
// Check tags
|
|
4095
|
-
const listMetaTag = Array.from(document.getElementsByTagName('META')).filter((i) => i.getAttribute('property') == 'article:tag');
|
|
4096
|
-
const listTags = listMetaTag.map((i) => i.content);
|
|
4097
|
-
let listCampaignHasTag = [];
|
|
4098
|
-
let listTagsObj = [];
|
|
4099
|
-
if (listTags && listTags.length) {
|
|
4100
|
-
listCampaignHasTag = campaignsDevice
|
|
4101
|
-
.map((i, index) => i.targets
|
|
4102
|
-
.filter((i) => i.type == CAMPAIGN_TARGET_TYPE.TAGS)
|
|
4103
|
-
.map((i) => (Object.assign(Object.assign({}, i), { campaignIndex: index }))))
|
|
4104
|
-
.flat(1);
|
|
4105
|
-
listTagsObj = listCampaignHasTag.filter((i) => listTags.includes(i.target));
|
|
4106
|
-
}
|
|
4107
|
-
const listCampaginsMatch = [...listLinksObj, ...listTagsObj];
|
|
4108
|
-
const cookieKeys = document.cookie
|
|
4109
|
-
.split('; ')
|
|
4110
|
-
.map((i) => i.split('=')[0]);
|
|
4111
|
-
const listCampaignCodeSubmited = cookieKeys.filter((i) => i.includes('lead_submited'));
|
|
4112
|
-
LeadLog(`--listCampaignCodeSubmited`, listCampaignCodeSubmited);
|
|
4113
|
-
const listCampaignCodeClosed = cookieKeys.filter((i) => i.includes('lead_closed'));
|
|
4114
|
-
LeadLog(`--listCampaignCodeClosed`, listCampaignCodeClosed);
|
|
4115
|
-
const listCampaignSubmitedClosed = [
|
|
4116
|
-
...listCampaignCodeSubmited,
|
|
4117
|
-
...listCampaignCodeClosed,
|
|
4118
|
-
];
|
|
4119
|
-
const listCampaignNoSubmitedClosed = listCampaginsMatch.filter((i) => {
|
|
4120
|
-
const hasSubmited = listCampaignSubmitedClosed.some((k) => k.includes(campaignsDevice[i.campaignIndex].code));
|
|
4121
|
-
return !hasSubmited;
|
|
4122
|
-
});
|
|
4123
|
-
const listCampaignValid = getShuffleArray(listCampaignNoSubmitedClosed);
|
|
4124
|
-
// .sort(
|
|
4125
|
-
// (a, b) =>
|
|
4126
|
-
// (listCampaignValid[a.campaignIndex]?.score || 0) -
|
|
4127
|
-
// (listCampaignValid[b.campaignIndex]?.score || 0),
|
|
4128
|
-
// )
|
|
4129
|
-
LeadLog('--listCampaignValid : ', listCampaignValid);
|
|
4130
|
-
if (listCampaignValid && listCampaignValid.length) {
|
|
4131
|
-
const CAMPAIGN_SHOW = campaignsDevice[listCampaignValid[0].campaignIndex];
|
|
4132
|
-
LeadLog(`CAMPAIGN_SHOW`, CAMPAIGN_SHOW);
|
|
4133
|
-
const { rules } = CAMPAIGN_SHOW;
|
|
4134
|
-
// CHECK RULE TRIGGER POPUP
|
|
4135
|
-
const timeoutRule = Number((_c = rules.find((i) => i.rule == 'time')) === null || _c === void 0 ? void 0 : _c.value);
|
|
4136
|
-
LeadLog(`timeoutRule`, timeoutRule);
|
|
4137
|
-
const scrollRule = Number((_d = rules.find((i) => i.rule == 'scroll')) === null || _d === void 0 ? void 0 : _d.value);
|
|
4138
|
-
LeadLog(`scrollRule`, scrollRule);
|
|
4139
|
-
let impressionAction = 'TIME';
|
|
4140
|
-
if (Number.isInteger(timeoutRule)) {
|
|
4141
|
-
impressionAction = 'TIME';
|
|
4142
|
-
LeadLog('✨ SHOW AWESOME POPUP AFTER: ', timeoutRule, ' seconds');
|
|
4143
|
-
timeoutRef = setTimeout(() => {
|
|
4144
|
-
onShowPopup === null || onShowPopup === void 0 ? void 0 : onShowPopup(CAMPAIGN_SHOW, impressionAction);
|
|
4145
|
-
}, timeoutRule * 1000);
|
|
4165
|
+
}
|
|
4166
|
+
setTimeout(() => {
|
|
4167
|
+
form.onSubmit((v) => {
|
|
4168
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
4169
|
+
if (Object.keys(form.errors).length)
|
|
4170
|
+
return;
|
|
4171
|
+
let newShowOtpPhone = null;
|
|
4172
|
+
if (listBlockAdded.findIndex((x) => x.name === LEADGEN_BLOCK.PhoneOtpBlock) > -1) {
|
|
4173
|
+
// not submit yet, open otp
|
|
4174
|
+
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;
|
|
4175
|
+
if ((_c = v[fieldName]) === null || _c === void 0 ? void 0 : _c.startsWith('+')) {
|
|
4176
|
+
newShowOtpPhone = {
|
|
4177
|
+
phone: v[fieldName],
|
|
4178
|
+
type: 'phone',
|
|
4179
|
+
};
|
|
4180
|
+
}
|
|
4146
4181
|
}
|
|
4147
|
-
if (
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4182
|
+
if (listBlockAdded.findIndex((x) => x.name === LEADGEN_BLOCK.WhatsappOtpBlock) > -1) {
|
|
4183
|
+
// not submit yet, open otp
|
|
4184
|
+
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;
|
|
4185
|
+
if ((_f = v[fieldName]) === null || _f === void 0 ? void 0 : _f.startsWith('+')) {
|
|
4186
|
+
newShowOtpPhone = {
|
|
4187
|
+
phone: v[fieldName],
|
|
4188
|
+
type: 'whatsapp',
|
|
4189
|
+
};
|
|
4190
|
+
}
|
|
4191
|
+
}
|
|
4192
|
+
if (listBlockAdded.findIndex((x) => x.name === LEADGEN_BLOCK.ZaloOtpBlock) > -1) {
|
|
4193
|
+
// not submit yet, open otp
|
|
4194
|
+
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;
|
|
4195
|
+
if ((_j = v[fieldName]) === null || _j === void 0 ? void 0 : _j.startsWith('+')) {
|
|
4196
|
+
newShowOtpPhone = {
|
|
4197
|
+
phone: v[fieldName],
|
|
4198
|
+
type: 'zalo',
|
|
4199
|
+
};
|
|
4200
|
+
}
|
|
4201
|
+
}
|
|
4202
|
+
if (newShowOtpPhone) {
|
|
4203
|
+
setIsSubmitLoading(true);
|
|
4204
|
+
Service.sendSMSOtpLead(newShowOtpPhone)
|
|
4205
|
+
.then((res) => {
|
|
4206
|
+
var _a;
|
|
4207
|
+
const respMessage = (_a = res === null || res === void 0 ? void 0 : res._messages) === null || _a === void 0 ? void 0 : _a[0];
|
|
4208
|
+
if (respMessage === 'This phone number was verified') {
|
|
4209
|
+
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(formRef.current, v);
|
|
4210
|
+
return;
|
|
4166
4211
|
}
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4212
|
+
setShowOtpPhone(newShowOtpPhone);
|
|
4213
|
+
})
|
|
4214
|
+
.finally(() => {
|
|
4215
|
+
setIsSubmitLoading(false);
|
|
4170
4216
|
});
|
|
4217
|
+
return;
|
|
4171
4218
|
}
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4219
|
+
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(formRef.current, v);
|
|
4220
|
+
})(e);
|
|
4221
|
+
}, 100);
|
|
4222
|
+
};
|
|
4223
|
+
const onOpenChange = (_open) => {
|
|
4224
|
+
setOpen(_open);
|
|
4225
|
+
if (!_open) {
|
|
4226
|
+
setTimeout(() => {
|
|
4227
|
+
onClose();
|
|
4228
|
+
}, 250);
|
|
4176
4229
|
}
|
|
4177
|
-
}
|
|
4178
|
-
|
|
4179
|
-
|
|
4230
|
+
};
|
|
4231
|
+
const { width: imageBackgroundWidth, height: imageBackgroundHeight, loaded: imageBackgroundLoaded, } = useImageSize(imageBackground);
|
|
4232
|
+
const { loaded: imageMobileLoaded } = useImageSize(imageMobile);
|
|
4233
|
+
const { loaded: imageDesktopLoaded } = useImageSize(imageDesktop);
|
|
4234
|
+
const renderAfterImageSizes = imageMobileLoaded &&
|
|
4235
|
+
imageDesktopLoaded &&
|
|
4236
|
+
(isFullscreen ? imageBackgroundLoaded : true);
|
|
4237
|
+
const ButtonSubmit = React.useMemo(() => {
|
|
4238
|
+
var _a;
|
|
4239
|
+
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));
|
|
4240
|
+
}, [popUpSubmitText, isSubmitLoading, (_b = actionBlocks === null || actionBlocks === void 0 ? void 0 : actionBlocks.submitBlock) === null || _b === void 0 ? void 0 : _b.isHide]);
|
|
4241
|
+
const LinkButtonBlock = listBlockAdded.filter(({ name }) => name == LEADGEN_BLOCK.LinkButtonBlock);
|
|
4242
|
+
const ButtonLink = !!(LinkButtonBlock === null || LinkButtonBlock === void 0 ? void 0 : LinkButtonBlock.length) && (React__default["default"].createElement(React__default["default"].Fragment, null, LinkButtonBlock.map((item, index) => {
|
|
4243
|
+
var _a, _b, _c;
|
|
4244
|
+
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", onClick: () => {
|
|
4245
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
4246
|
+
onOtherSubmit === null || onOtherSubmit === void 0 ? void 0 : onOtherSubmit();
|
|
4247
|
+
} }, (_c = item === null || item === void 0 ? void 0 : item.data) === null || _c === void 0 ? void 0 : _c.value));
|
|
4248
|
+
})));
|
|
4249
|
+
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,
|
|
4250
|
+
React__default["default"].createElement(HeaderImage, { src: imageDesktop, className: "le-only-desktop lead-modal__image" }),
|
|
4251
|
+
React__default["default"].createElement(HeaderImage, { src: imageMobile, className: "le-only-mobile lead-modal__image" })))));
|
|
4252
|
+
const PopupEmpty = showEmpty && (React__default["default"].createElement(EmptyComponent, { onClose: onClose, onContinue: () => setShowEmpty(false) }));
|
|
4253
|
+
const PopupForm = (React__default["default"].createElement(LeadFormProvider, { form: form },
|
|
4254
|
+
React__default["default"].createElement("form", { ref: formRef, className: "leadgen-form", onFocus: onFocus, onSubmit: middlewareOnSubmit },
|
|
4255
|
+
React__default["default"].createElement(FormContainer, { title: title, titleAlign: titleAlign, description: description, descriptionAlign: descriptionAlign, header: headerInsideFormContainer && PopupHeader, footer: hasForm ? ButtonSubmit : ButtonLink, "data-hidden-form": !hasForm },
|
|
4256
|
+
React__default["default"].createElement("div", { className: "leadgen-form_inner" },
|
|
4257
|
+
React__default["default"].createElement(LightboxFields, { listBlockAdded: listBlockAdded, popupId: popupId, locale: locale, onClose: onClose, onOtherSubmit: onOtherSubmit }))))));
|
|
4258
|
+
const PopupOtp = showOtpPhone && (React__default["default"].createElement(OtpBlock, { otpData: showOtpPhone, autoSendWhenOpen: false, onSuccess: () => {
|
|
4259
|
+
setShowOtpPhone(null);
|
|
4260
|
+
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(formRef.current, form.values);
|
|
4261
|
+
} }));
|
|
4262
|
+
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 }));
|
|
4263
|
+
const PopupContent = (React__default["default"].createElement("div", { className: core.clsx('leadgen-content', {
|
|
4264
|
+
'leadgen-content_small': limitFieldsLightBoxB,
|
|
4265
|
+
}) },
|
|
4266
|
+
!headerInsideFormContainer && PopupHeader,
|
|
4267
|
+
!onlyHeader && (React__default["default"].createElement("div", { className: "leadgen-inner" },
|
|
4268
|
+
PopupThankYou,
|
|
4269
|
+
!showThankyou && (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
4270
|
+
PopupOtp,
|
|
4271
|
+
PopupEmpty,
|
|
4272
|
+
!(showOtpPhone || showEmpty) && PopupForm))))));
|
|
4273
|
+
const styleOverlay = React.useMemo(() => {
|
|
4274
|
+
let styleContent = `.leadgen-inner {background-repeat: no-repeat;background-size: cover;background-position:center;}`;
|
|
4275
|
+
if (isMobile && imageOverlayMobile) {
|
|
4276
|
+
styleContent += `.leadgen-inner {background-image: url(${imageOverlayMobile});}`;
|
|
4277
|
+
}
|
|
4278
|
+
if (!isMobile && imageOverlayDesktop) {
|
|
4279
|
+
styleContent += `@media screen and (min-width:768px) {.leadgen-inner {background-image: url(${imageOverlayDesktop});}}`;
|
|
4280
|
+
}
|
|
4281
|
+
return styleContent;
|
|
4282
|
+
}, [isMobile, imageOverlayDesktop, imageOverlayMobile]);
|
|
4283
|
+
const PopupWrapper = (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
4284
|
+
React__default["default"].createElement("style", { dangerouslySetInnerHTML: { __html: styleOverlay } }),
|
|
4285
|
+
React__default["default"].createElement("div", { className: core.clsx('leadgen-wrapper', {
|
|
4286
|
+
'leadgen-wrapper_small': limitFieldsLightBoxB,
|
|
4287
|
+
}) },
|
|
4288
|
+
showButtonClose && (React__default["default"].createElement(CloseButton, { onClose: () => onOpenChange(false), containerClassName: "leadgen-close_btn" })),
|
|
4289
|
+
PopupContent)));
|
|
4290
|
+
const popupContainerClassName = core.clsx('leadgen', `leadgen-${currentLayout}`, {
|
|
4291
|
+
'leadgen-lightbox': isLightBox,
|
|
4292
|
+
'leadgen-inline': isInPage,
|
|
4293
|
+
'leadgen-slider': isSlider,
|
|
4180
4294
|
});
|
|
4181
|
-
}
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
(
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4295
|
+
const PopupContainer = isDrawer ? (React__default["default"].createElement(index$a.DrawerComponent, { fadeFromIndex: index$7.ZINDEX_SSO - 9e6, open: open, snapPoints: [0.8, 1], activeSnapPoint: snap, setActiveSnapPoint: setSnap, onOpenChange: onOpenChange, overlayClassName: popupContainerClassName, className: "leadgen-drawer" },
|
|
4296
|
+
PopupWrapper,
|
|
4297
|
+
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 },
|
|
4298
|
+
isFullscreen ? (React__default["default"].createElement("img", { className: "le-only-desktop le-fullscreen-img", draggable: false, src: imageBackground || '', style: {
|
|
4299
|
+
aspectRatio: `${imageBackgroundWidth}/${imageBackgroundHeight}`,
|
|
4300
|
+
} })) : null,
|
|
4301
|
+
PopupWrapper));
|
|
4302
|
+
if (!renderAfterImageSizes)
|
|
4303
|
+
return null;
|
|
4304
|
+
if (isLightBox || isFullscreen || isSlider) {
|
|
4305
|
+
return PopupContainer;
|
|
4306
|
+
}
|
|
4307
|
+
else if (isSidebar) {
|
|
4308
|
+
return React__default["default"].createElement(SideBarLayout, { content: PopupContainer });
|
|
4309
|
+
}
|
|
4310
|
+
else if (isInline) {
|
|
4311
|
+
return (React__default["default"].createElement(InlineLayout, { content: PopupContainer, inlinePosition: extraFields.popupInlinePosition }));
|
|
4189
4312
|
}
|
|
4313
|
+
return null;
|
|
4314
|
+
};
|
|
4315
|
+
|
|
4316
|
+
const SkinLayout = ({ popupId, link, linkText, linkNewTab, onClose, imageMobile, imageDesktop, currentLayout, onOtherSubmit, }) => {
|
|
4317
|
+
const currentPath = location.pathname;
|
|
4318
|
+
const { width: imageMobileWidth, height: imageMobileHeight, loaded: imageMobileLoaded, } = useImageSize(imageMobile);
|
|
4319
|
+
const { width: imageDesktopWidth, height: imageDesktopHeight, loaded: imageDesktopLoaded, } = useImageSize(imageDesktop);
|
|
4320
|
+
if (!imageMobileLoaded || !imageDesktopLoaded)
|
|
4321
|
+
return null;
|
|
4322
|
+
return (React__default["default"].createElement("div", { id: popupId, className: "lead-modal-wrapper", "data-popup-url": currentPath, "data-popup-type": "skin_ab" },
|
|
4323
|
+
currentLayout == 'SkinA' ? (React__default["default"].createElement("aside", { className: "le-only-desktop" },
|
|
4324
|
+
React__default["default"].createElement("div", { className: "le-skin-a-desktop" },
|
|
4325
|
+
React__default["default"].createElement("div", { style: { position: 'relative' } },
|
|
4326
|
+
React__default["default"].createElement("img", { src: imageDesktop, style: {
|
|
4327
|
+
aspectRatio: `${imageDesktopWidth}/${imageDesktopHeight}`,
|
|
4328
|
+
} }),
|
|
4329
|
+
React__default["default"].createElement("a", { style: {
|
|
4330
|
+
position: 'absolute',
|
|
4331
|
+
top: '75%',
|
|
4332
|
+
left: '50%',
|
|
4333
|
+
transform: 'translate(-50%, -50%)',
|
|
4334
|
+
textAlign: 'center',
|
|
4335
|
+
width: 'calc(100% - 15px)',
|
|
4336
|
+
}, href: link, target: linkNewTab ? 'blank' : '_parent' },
|
|
4337
|
+
React__default["default"].createElement("button", { onClick: onOtherSubmit, className: "le-joinbow-btn js-popup-other-submit" }, linkText)),
|
|
4338
|
+
React__default["default"].createElement(CloseButton, { onClose: onClose, containerClassName: "close-button-top-right" }))))) : currentLayout == 'SkinB' ? (React__default["default"].createElement("aside", { className: "le-only-desktop" },
|
|
4339
|
+
React__default["default"].createElement("div", { className: "" },
|
|
4340
|
+
React__default["default"].createElement("div", { style: { position: 'relative', zIndex: 10000 } },
|
|
4341
|
+
React__default["default"].createElement("img", { src: imageDesktop, style: {
|
|
4342
|
+
width: '100%',
|
|
4343
|
+
aspectRatio: `${imageDesktopWidth}/${imageDesktopHeight}`,
|
|
4344
|
+
} }),
|
|
4345
|
+
React__default["default"].createElement("a", { style: {
|
|
4346
|
+
position: 'absolute',
|
|
4347
|
+
top: '75%',
|
|
4348
|
+
left: '50%',
|
|
4349
|
+
transform: 'translate(-50%, -50%)',
|
|
4350
|
+
textAlign: 'center',
|
|
4351
|
+
width: '100%',
|
|
4352
|
+
}, href: link, target: linkNewTab ? 'blank' : '_parent' },
|
|
4353
|
+
React__default["default"].createElement("button", { onClick: onOtherSubmit, className: "le-joinbow-btn-mobile js-popup-other-submit" }, linkText)),
|
|
4354
|
+
React__default["default"].createElement(CloseButton, { containerClassName: "close-button-top-right", onClose: onClose }))))) : null,
|
|
4355
|
+
React__default["default"].createElement("aside", { className: "le-only-mobile" },
|
|
4356
|
+
React__default["default"].createElement("div", { className: "le-skin-mobile" },
|
|
4357
|
+
React__default["default"].createElement("div", { style: { position: 'relative' } },
|
|
4358
|
+
index$8.isVideo(imageMobile) ? (React__default["default"].createElement("video", { muted: true, autoPlay: true, loop: true },
|
|
4359
|
+
React__default["default"].createElement("source", { src: imageMobile, type: "video/mp4" }))) : (React__default["default"].createElement("img", { src: imageMobile, style: {
|
|
4360
|
+
width: '100%',
|
|
4361
|
+
aspectRatio: `${imageMobileWidth}/${imageMobileHeight}`,
|
|
4362
|
+
} })),
|
|
4363
|
+
React__default["default"].createElement("a", { style: {
|
|
4364
|
+
position: 'absolute',
|
|
4365
|
+
top: '82%',
|
|
4366
|
+
left: '50%',
|
|
4367
|
+
transform: 'translate(-50%, -50%)',
|
|
4368
|
+
textAlign: 'center',
|
|
4369
|
+
maxWidth: 'calc(100% - 15px)',
|
|
4370
|
+
}, href: link, target: linkNewTab ? 'blank' : '_parent' },
|
|
4371
|
+
React__default["default"].createElement("button", { onClick: onOtherSubmit, className: "le-joinbow-btn-mobile js-popup-other-submit" }, linkText)),
|
|
4372
|
+
React__default["default"].createElement(CloseButton, { containerClassName: "close-button-top-right", svgClassName: "le-mobile-btn", onClose: onClose }))))));
|
|
4373
|
+
};
|
|
4374
|
+
|
|
4375
|
+
// url: imageBlocks.imageMobile.data.url
|
|
4376
|
+
// newTab: imageBlocks.imageMobile.data.newtab
|
|
4377
|
+
// image: campaignShow.image
|
|
4378
|
+
// imageDestkop: campaignShow.image_desktop
|
|
4379
|
+
const TabLayout = ({ popupId, url, newTab, image, onClose, onOtherSubmit, }) => {
|
|
4380
|
+
const { width: imageWidth, height: imageHeight, loaded: imageLoaded, } = useImageSize(image);
|
|
4381
|
+
if (!imageLoaded)
|
|
4382
|
+
return null;
|
|
4383
|
+
return (React__default["default"].createElement("div", { id: popupId, className: "lead-modal-wrapper", "data-popup-url": location.pathname, "data-popup-type": "tab" },
|
|
4384
|
+
React__default["default"].createElement("div", { className: "le-tab-popup" },
|
|
4385
|
+
React__default["default"].createElement("div", { style: { position: 'relative' } },
|
|
4386
|
+
React__default["default"].createElement("a", { href: url, target: newTab ? 'blank' : '_parent', onClick: onOtherSubmit },
|
|
4387
|
+
React__default["default"].createElement("img", { className: "js-popup-other-submit", src: image, style: {
|
|
4388
|
+
aspectRatio: `${imageWidth}/${imageHeight}`,
|
|
4389
|
+
} })),
|
|
4390
|
+
React__default["default"].createElement(CloseButton, { onClose: onClose, containerClassName: "close-button-top-right" })))));
|
|
4190
4391
|
};
|
|
4191
4392
|
|
|
4192
4393
|
function getCategoryLevel(t = 'Xin chao {{category_2}} extra') {
|
|
@@ -4202,7 +4403,7 @@ function getCategoryLevel(t = 'Xin chao {{category_2}} extra') {
|
|
|
4202
4403
|
}
|
|
4203
4404
|
const NewLeadPopup = ({ campaign, action, onSubmit, onClose, showThankyou, locale, showEmpty, setShowEmpty, userInfo, }) => {
|
|
4204
4405
|
var _a, _b;
|
|
4205
|
-
const { apiUrl, siteDomain } = React.useContext(LeadGenContext);
|
|
4406
|
+
const { apiUrl, siteDomain } = React.useContext(LeadGenContext$1);
|
|
4206
4407
|
React.useEffect(() => {
|
|
4207
4408
|
const gaCookie = miscCookieHelper.getCookie('_ga') || null;
|
|
4208
4409
|
fetch(`${apiUrl}api/campaign/${code}/impression`, {
|
|
@@ -4597,7 +4798,7 @@ const _LeadGen = ({ apiUrl: apiUrlProp, siteDomain, siteId, locale, apiSubotUrl,
|
|
|
4597
4798
|
leadStartTimeRef.current = Date.now();
|
|
4598
4799
|
}
|
|
4599
4800
|
}, [showCampaign]);
|
|
4600
|
-
return (React__default["default"].createElement(LeadGenContext.Provider, { value: { apiUrl, siteDomain, siteId, locale } },
|
|
4801
|
+
return (React__default["default"].createElement(LeadGenContext$1.Provider, { value: { apiUrl, siteDomain, siteId, locale } },
|
|
4601
4802
|
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() },
|
|
4602
4803
|
React__default["default"].createElement(core.Box, { sx: { position: 'fixed', zIndex: index$7.ZINDEX_SSO - 9e6 } },
|
|
4603
4804
|
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) => {
|