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