@hhgtech/hhg-components 1.29.569-beta-1 → 1.29.570

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 (535) hide show
  1. package/build/{InputDate-08857268.js → InputDate-9ebd52ca.js} +5 -5
  2. package/build/{LastPeriod-32f3e955.js → LastPeriod-00b0b47b.js} +1 -1
  3. package/build/{MobileBottomNavigationIcon-50cf9750.js → MobileBottomNavigationIcon-f98b485b.js} +3 -3
  4. package/build/{SiteWideBanner-7dedc50f.js → SiteWideBanner-fedd8edc.js} +13 -13
  5. package/build/{Spinner-093eba96.js → Spinner-18c90fe5.js} +1 -1
  6. package/build/{WhatsApp-63d1377c.js → WhatsApp-061da51d.js} +1 -1
  7. package/build/adapters.js +26 -20
  8. package/build/atoms.js +58 -54
  9. package/build/babyGrowth.js +90 -87
  10. package/build/cache.js +2 -2
  11. package/build/care.js +21 -21
  12. package/build/careBookingSearchBar.js +13 -13
  13. package/build/careBookingSearchBarV2.js +18 -18
  14. package/build/components.js +116 -115
  15. package/build/{constants-8065cb2e.js → constants-25b9497f.js} +1 -1
  16. package/build/{constants-4aae34c0.js → constants-b992173e.js} +1 -1
  17. package/build/constants.js +2 -2
  18. package/build/constantsRiskScreener.js +1 -1
  19. package/build/constantsSite.js +1 -1
  20. package/build/{core-ce1ccab7.js → core-c6026899.js} +1 -1
  21. package/build/{dataTransform-0f22571a.js → dataTransform-02a58a20.js} +1 -1
  22. package/build/ecom.js +4 -4
  23. package/build/{editor-cf6cafe2.js → editor-e6e9e3fb.js} +11 -11
  24. package/build/embeddedHeathToolCards_babyGrowth.js +31 -26
  25. package/build/embeddedHeathToolCards_babyPoop.js +26 -21
  26. package/build/embeddedHeathToolCards_babyVaccine.js +30 -25
  27. package/build/embeddedHeathToolCards_bmi_bmi.js +33 -28
  28. package/build/embeddedHeathToolCards_bmrBmr.js +33 -28
  29. package/build/embeddedHeathToolCards_dueDate_dueDate.js +30 -25
  30. package/build/embeddedHeathToolCards_helpers.js +2 -2
  31. package/build/embeddedHeathToolCards_ovulation_ovulation.js +30 -25
  32. package/build/embeddedHeathToolCards_pwg_pwg.js +32 -27
  33. package/build/embeddedHeathToolCards_targetHeartRate.js +35 -30
  34. package/build/esm/{InputDate-f65a6869.js → InputDate-86aca9f1.js} +5 -5
  35. package/build/esm/{LastPeriod-52712208.js → LastPeriod-0fa55988.js} +1 -1
  36. package/build/esm/{MobileBottomNavigationIcon-001c7c30.js → MobileBottomNavigationIcon-e8c6487b.js} +3 -3
  37. package/build/esm/{SiteWideBanner-7b1d8e06.js → SiteWideBanner-584af462.js} +13 -13
  38. package/build/esm/{Spinner-ea19696d.js → Spinner-bf43cb76.js} +1 -1
  39. package/build/esm/{WhatsApp-82e1ca3c.js → WhatsApp-632c14e2.js} +1 -1
  40. package/build/esm/adapters.js +26 -20
  41. package/build/esm/atoms.js +58 -54
  42. package/build/esm/babyGrowth.js +90 -87
  43. package/build/esm/cache.js +2 -2
  44. package/build/esm/care.js +21 -21
  45. package/build/esm/careBookingSearchBar.js +13 -13
  46. package/build/esm/careBookingSearchBarV2.js +18 -18
  47. package/build/esm/components.js +116 -115
  48. package/build/esm/{constants-3e7d1387.js → constants-2e7ee0b3.js} +1 -1
  49. package/build/esm/{constants-b719e705.js → constants-bc837908.js} +1 -1
  50. package/build/esm/constants.js +2 -2
  51. package/build/esm/constantsRiskScreener.js +1 -1
  52. package/build/esm/constantsSite.js +1 -1
  53. package/build/esm/{core-39483e55.js → core-b5c06568.js} +1 -1
  54. package/build/esm/{dataTransform-26318b95.js → dataTransform-20f020cf.js} +1 -1
  55. package/build/esm/ecom.js +4 -4
  56. package/build/esm/{editor-261cdaf8.js → editor-af36c0ee.js} +11 -11
  57. package/build/esm/embeddedHeathToolCards_babyGrowth.js +31 -26
  58. package/build/esm/embeddedHeathToolCards_babyPoop.js +26 -21
  59. package/build/esm/embeddedHeathToolCards_babyVaccine.js +30 -25
  60. package/build/esm/embeddedHeathToolCards_bmi_bmi.js +33 -28
  61. package/build/esm/embeddedHeathToolCards_bmrBmr.js +33 -28
  62. package/build/esm/embeddedHeathToolCards_dueDate_dueDate.js +30 -25
  63. package/build/esm/embeddedHeathToolCards_helpers.js +2 -2
  64. package/build/esm/embeddedHeathToolCards_ovulation_ovulation.js +30 -25
  65. package/build/esm/embeddedHeathToolCards_pwg_pwg.js +32 -27
  66. package/build/esm/embeddedHeathToolCards_targetHeartRate.js +35 -30
  67. package/build/esm/footer.js +28 -22
  68. package/build/esm/gAssets.js +1 -1
  69. package/build/esm/{healthTools-74923351.js → healthTools-2375f3d7.js} +1 -1
  70. package/build/esm/healthToolsCardWrapper.js +24 -19
  71. package/build/esm/healthToolsForm.js +43 -38
  72. package/build/esm/{helpers-f9d4d699.js → helpers-13942d8c.js} +1 -1
  73. package/build/esm/hooks.js +14 -14
  74. package/build/esm/i18n.js +2 -2
  75. package/build/esm/i18nV2.js +2 -2
  76. package/build/esm/{index-0fc6da63.js → index-09409879.js} +3 -3
  77. package/build/esm/{index-0f163fb9.js → index-0948e312.js} +2 -2
  78. package/build/esm/{index-d7f2db49.js → index-0a262faf.js} +2 -2
  79. package/build/esm/{index-93413a59.js → index-0db64b4f.js} +2 -2
  80. package/build/esm/{index-e315422f.js → index-1002fab9.js} +14 -14
  81. package/build/esm/{index-f34b246a.js → index-1164f7d4.js} +1 -1
  82. package/build/esm/{index-ff5a9cbd.js → index-1486a6da.js} +20 -20
  83. package/build/esm/{index-899790b6.js → index-17856e46.js} +3 -3
  84. package/build/esm/{index-68bdec51.js → index-1f84117b.js} +7 -7
  85. package/build/esm/{index-c7e4b5b8.js → index-21bd6de5.js} +4 -4
  86. package/build/esm/{index-1303a9e9.js → index-22745456.js} +2 -2
  87. package/build/esm/{index-7293d66b.js → index-2e49b6fc.js} +2 -2
  88. package/build/esm/{index-cf36ffd5.js → index-308e99f5.js} +2 -2
  89. package/build/esm/{index-fdb6b767.js → index-33c0d916.js} +17 -17
  90. package/build/esm/{index-e9fc54e1.js → index-3895f110.js} +25 -25
  91. package/build/esm/{index-b181324f.js → index-3bd6d1a3.js} +2 -2
  92. package/build/esm/{index-f2d4a2f2.js → index-3cd77063.js} +13 -13
  93. package/build/esm/{index-dccb9506.js → index-3e9784ab.js} +1 -1
  94. package/build/esm/{index-22b31281.js → index-436b58cd.js} +1 -1
  95. package/build/esm/{index-e0195d3f.js → index-4726d97a.js} +15 -15
  96. package/build/esm/{index-290bbf41.js → index-4a538dfc.js} +7 -7
  97. package/build/esm/{index-cbfdcb39.js → index-4c5be22c.js} +1 -1
  98. package/build/esm/{index-338accdb.js → index-4fb66ae3.js} +3 -3
  99. package/build/esm/{index-78645de3.js → index-4ff88c7c.js} +2 -2
  100. package/build/esm/{index-c2390315.js → index-5237dddb.js} +3 -3
  101. package/build/esm/{index-de1d2f4b.js → index-56d1537a.js} +18 -18
  102. package/build/esm/{index-4de1a090.js → index-672802ff.js} +5 -5
  103. package/build/esm/{index-823b020d.js → index-674ad3f8.js} +16 -16
  104. package/build/esm/{index-67f2cb68.js → index-690ee4c3.js} +2 -2
  105. package/build/esm/{index-1bf05d13.js → index-6ac1e86b.js} +17 -17
  106. package/build/esm/{index-49ca1d61.js → index-6bb00382.js} +21 -21
  107. package/build/esm/{index-d07ebc08.js → index-6ffe8a54.js} +1 -1
  108. package/build/esm/{index-d9c89865.js → index-72cc3c82.js} +7 -7
  109. package/build/esm/{index-f7b4f213.js → index-759ff54d.js} +2 -2
  110. package/build/esm/{index-bd6efd60.js → index-79b6aa9a.js} +13 -13
  111. package/build/esm/{index-36a2f381.js → index-7c58eb2b.js} +11 -11
  112. package/build/esm/{index-4b0275bc.js → index-83ce36b7.js} +17 -17
  113. package/build/esm/{index-3a261dcc.js → index-86256531.js} +3 -3
  114. package/build/esm/{index-899fe463.js → index-86d17c65.js} +3 -3
  115. package/build/esm/{index-de0cab31.js → index-8878ebce.js} +4 -4
  116. package/build/esm/{index-a82cf2a4.js → index-8ea55c3a.js} +16 -16
  117. package/build/esm/{index-d9d6512c.js → index-98d2d8a9.js} +22 -22
  118. package/build/esm/{index-2e6b84ec.js → index-9acc34a7.js} +3 -3
  119. package/build/esm/{index-c220cb03.js → index-a488b4e6.js} +2 -2
  120. package/build/esm/{index-5ef4be51.js → index-a82b9bdc.js} +1 -1
  121. package/build/esm/{index-064eae61.js → index-a83d2663.js} +17 -17
  122. package/build/esm/{index-67cba53d.js → index-a9accacf.js} +9 -9
  123. package/build/esm/{index-228906bf.js → index-aac41a30.js} +3 -3
  124. package/build/esm/{index-c6b033bd.js → index-ac17facc.js} +5 -5
  125. package/build/esm/{index-8f724365.js → index-b0564176.js} +3 -3
  126. package/build/esm/{index-06ce15c7.js → index-b09d9b2e.js} +6 -6
  127. package/build/esm/{index-30db72ed.js → index-b3cddca0.js} +1411 -21
  128. package/build/esm/{index-3cdb3003.js → index-b7f9d0bb.js} +31 -31
  129. package/build/esm/{index-46e890ab.js → index-b9c6f372.js} +6 -6
  130. package/build/esm/{index-7cb9f382.js → index-bdbd4403.js} +17 -17
  131. package/build/esm/{index-3ea9e98b.js → index-c28b5511.js} +34 -34
  132. package/build/esm/{index-7985100a.js → index-c2dd68b0.js} +2 -2
  133. package/build/esm/{index-d338eb23.js → index-c6901973.js} +12 -12
  134. package/build/esm/{index-600299c7.js → index-c98bfa61.js} +14 -14
  135. package/build/esm/{index-b10a746b.js → index-ca5f175f.js} +6 -6
  136. package/build/esm/{index-bd7de61c.js → index-cff8f873.js} +1 -1
  137. package/build/esm/{index-522820f6.js → index-d491a5d8.js} +2 -2
  138. package/build/esm/{index-75547e3b.js → index-d4975c2a.js} +2 -2
  139. package/build/esm/{index-8663499e.js → index-d52d4fc9.js} +16 -16
  140. package/build/esm/{index-96a05e4e.js → index-d8c33a6a.js} +2 -2
  141. package/build/esm/{index-706b41f3.js → index-d991925d.js} +31 -31
  142. package/build/esm/{index-3ee60fb4.js → index-dc8f650b.js} +2 -2
  143. package/build/esm/{index-808e2816.js → index-dd7c098e.js} +2 -2
  144. package/build/esm/{index-1f264400.js → index-df2bf85e.js} +24 -24
  145. package/build/esm/{index-ab67d135.js → index-e1aa2251.js} +3 -3
  146. package/build/esm/{index-4cac470f.js → index-e7bcd704.js} +2 -2
  147. package/build/esm/{index-a7c0ab8f.js → index-f522da5c.js} +19 -19
  148. package/build/esm/{index-f9f312b3.js → index-fa37e9df.js} +5 -5
  149. package/build/esm/index.js +133 -132
  150. package/build/esm/{labelSorting-bf4d4562.js → labelSorting-6693dc3b.js} +4 -4
  151. package/build/esm/lead/LeadGenTranslationContext.d.ts +1 -4
  152. package/build/esm/lead/i18n/index.d.ts +1 -1
  153. package/build/esm/lead.js +5108 -444
  154. package/build/esm/leadRecaptcha.js +2 -2
  155. package/build/esm/{logoIcon-be698bb5.js → logoIcon-26941868.js} +2 -2
  156. package/build/esm/mantine.js +34 -29
  157. package/build/esm/misc.js +17 -17
  158. package/build/esm/miscGetDynamicHealthTool.js +3 -3
  159. package/build/esm/miscGetSocialList.js +6 -6
  160. package/build/esm/miscScreenSizeContext.js +1 -1
  161. package/build/esm/mobileBottomNavigation.js +5 -5
  162. package/build/esm/mobileBottomNavigationIcon.js +5 -5
  163. package/build/esm/molecules.js +91 -90
  164. package/build/esm/moleculesArticleCard.js +5 -5
  165. package/build/esm/moleculesArticleCardV2.js +23 -17
  166. package/build/esm/navigation.js +56 -54
  167. package/build/esm/navigationLogoutPopup.js +10 -10
  168. package/build/esm/navigationProfileButton.js +31 -26
  169. package/build/esm/onboardingV2.js +35 -31
  170. package/build/esm/organisms.js +69 -68
  171. package/build/esm/{post-a5353c8e.js → post-6b391944.js} +2 -2
  172. package/build/esm/profileNavigation.js +24 -19
  173. package/build/esm/progressBar.js +1 -1
  174. package/build/esm/pwg.js +28 -23
  175. package/build/esm/{recaptchaV3-8c953825.js → recaptchaV3-34684488.js} +1 -1
  176. package/build/esm/ssoV2.js +36 -32
  177. package/build/esm/{store-37f3829b.js → store-6afbb89f.js} +3 -3
  178. package/build/esm/subot/captcha/index.d.ts +7 -10
  179. package/build/esm/subot.js +58 -51
  180. package/build/esm/surveyOrPremiumBanner.js +38 -34
  181. package/build/esm/surveyQuestionCard.js +11 -11
  182. package/build/esm/{surveyThankyouCard-50a40b37.js → surveyThankyouCard-1b913b92.js} +5 -5
  183. package/build/esm/together.js +62 -59
  184. package/build/esm/togetherApiUtils.js +6 -6
  185. package/build/esm/togetherAtoms.js +36 -31
  186. package/build/esm/togetherComponentGlobalContext.js +6 -6
  187. package/build/esm/togetherMolecules.js +56 -53
  188. package/build/esm/togetherMoleculesCardAuthor.js +28 -28
  189. package/build/esm/togetherMoleculesPostImagePreview.js +13 -13
  190. package/build/esm/togetherMoleculesProfileDetail.js +44 -40
  191. package/build/esm/togetherOrganisms.js +53 -50
  192. package/build/esm/togetherRichTextEditor.js +20 -20
  193. package/build/esm/togetherShareBox.js +12 -12
  194. package/build/esm/{transform-35a086de.js → transform-3992daea.js} +34 -34
  195. package/build/esm/{translationsProvider-03ac207b.js → translationsProvider-0a7813b1.js} +1 -1
  196. package/build/esm/{treePopoverMenu-7d49a273.js → treePopoverMenu-2b0332f7.js} +18 -18
  197. package/build/esm/{types-5c19398b.js → types-be272abe.js} +1 -1
  198. package/build/esm/types.js +1 -1
  199. package/build/esm/{useCartCareService-66f996a0.js → useCartCareService-cefb1029.js} +1 -1
  200. package/build/esm/{useHealthToolCache-7a2e9ba8.js → useHealthToolCache-c49acdf1.js} +1 -1
  201. package/build/esm/{usePhoneValidator-3566dfd5.js → usePhoneValidator-784fe823.js} +4 -4
  202. package/build/esm/{usePlacesAutocomplete-892c6110.js → usePlacesAutocomplete-0617aed7.js} +1 -1
  203. package/build/esm/{useResolvedCaptureUrls-d0d577bf.js → useResolvedCaptureUrls-054899bd.js} +1 -1
  204. package/build/esm/useTogetherAuthRequiredAction.js +9 -9
  205. package/build/esm/{utils-477765df.js → utils-07ea3389.js} +4 -4
  206. package/build/esm/{utils-e49b4fa5.js → utils-51368802.js} +1 -1
  207. package/build/esm/{utils-6f1e4152.js → utils-a15aaf15.js} +2 -2
  208. package/build/esm/{utils-66a04a73.js → utils-dc631f93.js} +4 -4
  209. package/build/esm/{utils-3386e317.js → utils-f1f4f7e8.js} +5 -5
  210. package/build/esm/vaccination.js +28 -23
  211. package/build/footer.js +28 -22
  212. package/build/gAssets.js +1 -1
  213. package/build/{healthTools-e38bccfa.js → healthTools-2ff3afde.js} +1 -1
  214. package/build/healthToolsCardWrapper.js +24 -19
  215. package/build/healthToolsForm.js +43 -38
  216. package/build/{helpers-ffc5180c.js → helpers-7c1f5ba2.js} +1 -1
  217. package/build/hooks.js +14 -14
  218. package/build/i18n.js +2 -2
  219. package/build/i18nV2.js +1 -1
  220. package/build/{index-fd684023.js → index-02a3adbc.js} +2 -2
  221. package/build/{index-46b8be64.js → index-0a0cd148.js} +5 -5
  222. package/build/{index-b963fdc6.js → index-0cb355e9.js} +2 -2
  223. package/build/{index-43334bc5.js → index-177681f5.js} +18 -18
  224. package/build/{index-6e6593c4.js → index-19bb7271.js} +31 -31
  225. package/build/{index-8d24839c.js → index-1c1dcc52.js} +1 -1
  226. package/build/{index-7b9a044c.js → index-234d78bb.js} +4 -4
  227. package/build/{index-abd1ee07.js → index-25c6d5be.js} +25 -25
  228. package/build/{index-e2eaee59.js → index-2955fa8d.js} +9 -9
  229. package/build/{index-43df760f.js → index-2ac112e5.js} +34 -34
  230. package/build/{index-3c7de285.js → index-3230baad.js} +2 -2
  231. package/build/{index-87d465e0.js → index-32d9e76c.js} +1 -1
  232. package/build/{index-d3067c77.js → index-33cdb702.js} +17 -17
  233. package/build/{index-5e74008a.js → index-3511e1af.js} +16 -16
  234. package/build/{index-95d86eaa.js → index-3ea0608f.js} +1 -1
  235. package/build/{index-40fcb461.js → index-4157eca3.js} +2 -2
  236. package/build/{index-2ff43355.js → index-4187e37c.js} +3 -3
  237. package/build/{index-4c60ec07.js → index-42f7db47.js} +3 -3
  238. package/build/{index-65e1df12.js → index-44993a1e.js} +2 -2
  239. package/build/{index-f6b23d01.js → index-4cdc2006.js} +6 -6
  240. package/build/{index-742cf6ba.js → index-4dd08aab.js} +3 -3
  241. package/build/{index-4caa5fff.js → index-4f69a48e.js} +2 -2
  242. package/build/{index-2d8bc985.js → index-51d01acc.js} +1414 -21
  243. package/build/{index-c81a13c2.js → index-51e0829a.js} +7 -7
  244. package/build/{index-ab28235f.js → index-548d2ac1.js} +2 -2
  245. package/build/{index-e0c5a6b4.js → index-55dac945.js} +3 -3
  246. package/build/{index-2e8f8ebf.js → index-58ad97c9.js} +3 -3
  247. package/build/{index-131ba6b4.js → index-594475ad.js} +21 -21
  248. package/build/{index-e37081c5.js → index-59658a1f.js} +17 -17
  249. package/build/{index-b1b1f9c1.js → index-5ae0a209.js} +16 -16
  250. package/build/{index-69e4902e.js → index-5c94c387.js} +31 -31
  251. package/build/{index-7ec36c5f.js → index-5d9bbd65.js} +2 -2
  252. package/build/{index-8627ab1b.js → index-60bd1fba.js} +3 -3
  253. package/build/{index-06f6a945.js → index-657ed4d4.js} +2 -2
  254. package/build/{index-a824979f.js → index-669bebfa.js} +3 -3
  255. package/build/{index-a47d94e7.js → index-6c423f35.js} +14 -14
  256. package/build/{index-6f8214dc.js → index-6cd51190.js} +1 -1
  257. package/build/{index-5779d508.js → index-6ce7e646.js} +6 -6
  258. package/build/{index-655d9700.js → index-70903c8e.js} +2 -2
  259. package/build/{index-f444e30a.js → index-74a39817.js} +3 -3
  260. package/build/{index-7e007d08.js → index-75e14772.js} +13 -13
  261. package/build/{index-6c7470cb.js → index-77a042e1.js} +12 -12
  262. package/build/{index-de1d16c4.js → index-7e25b4f3.js} +7 -7
  263. package/build/{index-db4d2c5f.js → index-7f36de72.js} +2 -2
  264. package/build/{index-b328d19e.js → index-7ff1ac74.js} +16 -16
  265. package/build/{index-20f6c2f4.js → index-807fd0e4.js} +22 -22
  266. package/build/{index-1c82c2d3.js → index-83924b73.js} +2 -2
  267. package/build/{index-be455ab9.js → index-862570e8.js} +17 -17
  268. package/build/{index-778b4ce5.js → index-881501b2.js} +15 -15
  269. package/build/{index-46cc456c.js → index-93286eef.js} +2 -2
  270. package/build/{index-003b50b7.js → index-93cfde25.js} +19 -19
  271. package/build/{index-8f87f7c3.js → index-967076ad.js} +17 -17
  272. package/build/{index-90a86ef9.js → index-96c50c61.js} +2 -2
  273. package/build/{index-08a43dd1.js → index-9e2d57d8.js} +4 -4
  274. package/build/{index-4bbb737a.js → index-a0ca8856.js} +20 -20
  275. package/build/{index-881f090c.js → index-a2e9b70a.js} +1 -1
  276. package/build/{index-614f3a92.js → index-ae158063.js} +7 -7
  277. package/build/{index-404f44b0.js → index-b3f5d72d.js} +2 -2
  278. package/build/{index-481cd2fa.js → index-b5099834.js} +2 -2
  279. package/build/{index-dabd93aa.js → index-b7ce6c84.js} +3 -3
  280. package/build/{index-75c55095.js → index-ba0188a4.js} +11 -11
  281. package/build/{index-b43251d2.js → index-ba967ab3.js} +1 -1
  282. package/build/{index-82d547d1.js → index-c1b212c8.js} +5 -5
  283. package/build/{index-dc8ec7b2.js → index-c4028ca0.js} +2 -2
  284. package/build/{index-11043d70.js → index-caeeb401.js} +6 -6
  285. package/build/{index-f9d1861d.js → index-d8ef9967.js} +2 -2
  286. package/build/{index-b30dad24.js → index-dd9b1412.js} +1 -1
  287. package/build/{index-e2bb27b3.js → index-e024ff35.js} +5 -5
  288. package/build/{index-f27ce4da.js → index-ea09e421.js} +13 -13
  289. package/build/{index-38100242.js → index-ebb33f1f.js} +24 -24
  290. package/build/{index-581db9b1.js → index-ebd0ec02.js} +3 -3
  291. package/build/{index-00a7007b.js → index-ec6c4d5e.js} +17 -17
  292. package/build/{index-fbd00520.js → index-f85a4de0.js} +14 -14
  293. package/build/index.js +133 -132
  294. package/build/{labelSorting-180ba4cb.js → labelSorting-c4df0590.js} +4 -4
  295. package/build/lead/LeadGenTranslationContext.d.ts +1 -4
  296. package/build/lead/i18n/index.d.ts +1 -1
  297. package/build/lead.js +5218 -535
  298. package/build/leadRecaptcha.js +2 -2
  299. package/build/{logoIcon-20be13cb.js → logoIcon-55134dc4.js} +2 -2
  300. package/build/mantine.js +32 -27
  301. package/build/misc.js +17 -17
  302. package/build/miscGetDynamicHealthTool.js +3 -3
  303. package/build/miscGetSocialList.js +6 -6
  304. package/build/miscScreenSizeContext.js +1 -1
  305. package/build/mobileBottomNavigation.js +5 -5
  306. package/build/mobileBottomNavigationIcon.js +5 -5
  307. package/build/molecules.js +91 -90
  308. package/build/moleculesArticleCard.js +5 -5
  309. package/build/moleculesArticleCardV2.js +23 -17
  310. package/build/navigation.js +56 -54
  311. package/build/navigationLogoutPopup.js +10 -10
  312. package/build/navigationProfileButton.js +31 -26
  313. package/build/onboardingV2.js +34 -30
  314. package/build/organisms.js +69 -68
  315. package/build/{post-8382700f.js → post-ae6cd5df.js} +2 -2
  316. package/build/profileNavigation.js +24 -19
  317. package/build/progressBar.js +1 -1
  318. package/build/pwg.js +28 -23
  319. package/build/{recaptchaV3-63159c36.js → recaptchaV3-01aeba64.js} +1 -1
  320. package/build/ssoV2.js +34 -30
  321. package/build/{store-826b0ee1.js → store-738f12a2.js} +3 -3
  322. package/build/subot/captcha/index.d.ts +7 -10
  323. package/build/subot.js +58 -51
  324. package/build/surveyOrPremiumBanner.js +38 -34
  325. package/build/surveyQuestionCard.js +11 -11
  326. package/build/{surveyThankyouCard-369aeed0.js → surveyThankyouCard-c4cc9785.js} +5 -5
  327. package/build/together.js +62 -59
  328. package/build/togetherApiUtils.js +6 -6
  329. package/build/togetherAtoms.js +36 -31
  330. package/build/togetherComponentGlobalContext.js +6 -6
  331. package/build/togetherMolecules.js +56 -53
  332. package/build/togetherMoleculesCardAuthor.js +28 -28
  333. package/build/togetherMoleculesPostImagePreview.js +13 -13
  334. package/build/togetherMoleculesProfileDetail.js +44 -40
  335. package/build/togetherOrganisms.js +53 -50
  336. package/build/togetherRichTextEditor.js +20 -20
  337. package/build/togetherShareBox.js +12 -12
  338. package/build/{transform-9b22887b.js → transform-bdface58.js} +34 -34
  339. package/build/{translationsProvider-9a31152f.js → translationsProvider-8b5cb380.js} +1 -1
  340. package/build/{treePopoverMenu-8f5a8758.js → treePopoverMenu-7978e490.js} +18 -18
  341. package/build/{types-cbe5b5e9.js → types-51ba8d5f.js} +1 -1
  342. package/build/types.js +1 -1
  343. package/build/{useCartCareService-507956df.js → useCartCareService-12a23cae.js} +1 -1
  344. package/build/{useHealthToolCache-99a35777.js → useHealthToolCache-a14d6044.js} +1 -1
  345. package/build/{usePhoneValidator-e5715929.js → usePhoneValidator-a940ee56.js} +4 -4
  346. package/build/{usePlacesAutocomplete-a2f8202c.js → usePlacesAutocomplete-b97e2338.js} +1 -1
  347. package/build/{useResolvedCaptureUrls-2a1edb01.js → useResolvedCaptureUrls-b4a7e19a.js} +1 -1
  348. package/build/useTogetherAuthRequiredAction.js +9 -9
  349. package/build/{utils-bcfbb6ba.js → utils-200a6650.js} +5 -5
  350. package/build/{utils-bb1e5438.js → utils-39d3f595.js} +4 -4
  351. package/build/{utils-c899d146.js → utils-655fcf34.js} +4 -4
  352. package/build/{utils-16e69573.js → utils-bc439355.js} +2 -2
  353. package/build/{utils-114e1ca6.js → utils-c65ca307.js} +1 -1
  354. package/build/vaccination.js +28 -23
  355. package/package.json +1 -1
  356. package/build/countrySelect-c5552422.js +0 -1436
  357. package/build/esm/countrySelect-5f2fe567.js +0 -1426
  358. package/build/esm/formatTrackingData-66cd5664.js +0 -4708
  359. package/build/esm/lead/LeadGenCore.d.ts +0 -75
  360. package/build/esm/lead/LeadGenSlim.d.ts +0 -33
  361. package/build/esm/lead/i18n/leadTranslations.d.ts +0 -6
  362. package/build/esm/leadSlim.d.ts +0 -1
  363. package/build/esm/leadSlim.js +0 -457
  364. package/build/formatTrackingData-676340eb.js +0 -4757
  365. package/build/lead/LeadGenCore.d.ts +0 -75
  366. package/build/lead/LeadGenSlim.d.ts +0 -33
  367. package/build/lead/i18n/leadTranslations.d.ts +0 -6
  368. package/build/leadSlim.d.ts +0 -1
  369. package/build/leadSlim.js +0 -466
  370. /package/build/{BMI_BOYS.percentile.monthly-ec41f351.js → BMI_BOYS.percentile.monthly-7b48264a.js} +0 -0
  371. /package/build/{BMI_BOYS.percentile.weekly-babe6552.js → BMI_BOYS.percentile.weekly-129bbda2.js} +0 -0
  372. /package/build/{BMI_BOYS.percentile.yearly-f38dc134.js → BMI_BOYS.percentile.yearly-5fb02717.js} +0 -0
  373. /package/build/{BMI_BOYS.zscore.monthly-093d3209.js → BMI_BOYS.zscore.monthly-0b5978f6.js} +0 -0
  374. /package/build/{BMI_BOYS.zscore.weekly-fb26ac25.js → BMI_BOYS.zscore.weekly-711e040a.js} +0 -0
  375. /package/build/{BMI_BOYS.zscore.yearly-12724474.js → BMI_BOYS.zscore.yearly-39ce689a.js} +0 -0
  376. /package/build/{BMI_GIRLS.percentile.monthly-98627e58.js → BMI_GIRLS.percentile.monthly-8916f9e9.js} +0 -0
  377. /package/build/{BMI_GIRLS.percentile.weekly-7d6e1ed5.js → BMI_GIRLS.percentile.weekly-a5d8d437.js} +0 -0
  378. /package/build/{BMI_GIRLS.percentile.yearly-71e3bd23.js → BMI_GIRLS.percentile.yearly-7db6e19a.js} +0 -0
  379. /package/build/{BMI_GIRLS.zscore.monthly-24f3db40.js → BMI_GIRLS.zscore.monthly-76f74077.js} +0 -0
  380. /package/build/{BMI_GIRLS.zscore.weekly-a5a50706.js → BMI_GIRLS.zscore.weekly-5b8ec1fe.js} +0 -0
  381. /package/build/{BMI_GIRLS.zscore.yearly-9b2336b7.js → BMI_GIRLS.zscore.yearly-19b7d20d.js} +0 -0
  382. /package/build/{ChevronDown-08277d27.js → ChevronDown-7aa5239a.js} +0 -0
  383. /package/build/{Google-0aa53046.js → Google-e4c5b102.js} +0 -0
  384. /package/build/{HEAD CIRCUM_BOYS.percentile.monthly-4eee9b4e.js → HEAD CIRCUM_BOYS.percentile.monthly-5f7ab088.js} +0 -0
  385. /package/build/{HEAD CIRCUM_BOYS.percentile.weekly-81e3479c.js → HEAD CIRCUM_BOYS.percentile.weekly-4b0643ff.js} +0 -0
  386. /package/build/{HEAD CIRCUM_BOYS.percentile.yearly-f11a72d0.js → HEAD CIRCUM_BOYS.percentile.yearly-38491538.js} +0 -0
  387. /package/build/{HEAD CIRCUM_BOYS.zscore.monthly-81a9eb32.js → HEAD CIRCUM_BOYS.zscore.monthly-06121ec5.js} +0 -0
  388. /package/build/{HEAD CIRCUM_BOYS.zscore.weekly-be1f0ad1.js → HEAD CIRCUM_BOYS.zscore.weekly-14419797.js} +0 -0
  389. /package/build/{HEAD CIRCUM_BOYS.zscore.yearly-0e088655.js → HEAD CIRCUM_BOYS.zscore.yearly-2402f1cd.js} +0 -0
  390. /package/build/{HEAD CIRCUM_GIRLS.percentile.monthly-f0e7a932.js → HEAD CIRCUM_GIRLS.percentile.monthly-e10b9aa6.js} +0 -0
  391. /package/build/{HEAD CIRCUM_GIRLS.percentile.weekly-7ff2343e.js → HEAD CIRCUM_GIRLS.percentile.weekly-dfd42fbd.js} +0 -0
  392. /package/build/{HEAD CIRCUM_GIRLS.percentile.yearly-33049888.js → HEAD CIRCUM_GIRLS.percentile.yearly-570c5749.js} +0 -0
  393. /package/build/{HEAD CIRCUM_GIRLS.zscore.monthly-9edda77b.js → HEAD CIRCUM_GIRLS.zscore.monthly-1a171872.js} +0 -0
  394. /package/build/{HEAD CIRCUM_GIRLS.zscore.weekly-2e99f6c6.js → HEAD CIRCUM_GIRLS.zscore.weekly-ddfe0d95.js} +0 -0
  395. /package/build/{HEAD CIRCUM_GIRLS.zscore.yearly-57d5f62e.js → HEAD CIRCUM_GIRLS.zscore.yearly-7f73fe04.js} +0 -0
  396. /package/build/{HEIGHT_BOYS.percentile.monthly-be564b0a.js → HEIGHT_BOYS.percentile.monthly-70f949ac.js} +0 -0
  397. /package/build/{HEIGHT_BOYS.percentile.weekly-661cc4fb.js → HEIGHT_BOYS.percentile.weekly-c30b1584.js} +0 -0
  398. /package/build/{HEIGHT_BOYS.percentile.yearly-73170d04.js → HEIGHT_BOYS.percentile.yearly-1d674e57.js} +0 -0
  399. /package/build/{HEIGHT_BOYS.zscore.monthly-b9222d9b.js → HEIGHT_BOYS.zscore.monthly-7d9f3790.js} +0 -0
  400. /package/build/{HEIGHT_BOYS.zscore.weekly-03091216.js → HEIGHT_BOYS.zscore.weekly-32d669bf.js} +0 -0
  401. /package/build/{HEIGHT_BOYS.zscore.yearly-64769782.js → HEIGHT_BOYS.zscore.yearly-a3d14050.js} +0 -0
  402. /package/build/{HEIGHT_GIRLS.percentile.monthly-ab21e817.js → HEIGHT_GIRLS.percentile.monthly-31599c31.js} +0 -0
  403. /package/build/{HEIGHT_GIRLS.percentile.weekly-624f1899.js → HEIGHT_GIRLS.percentile.weekly-65421db3.js} +0 -0
  404. /package/build/{HEIGHT_GIRLS.percentile.yearly-361486e2.js → HEIGHT_GIRLS.percentile.yearly-61c1ec90.js} +0 -0
  405. /package/build/{HEIGHT_GIRLS.zscore.monthly-093817f4.js → HEIGHT_GIRLS.zscore.monthly-5c4d0cc1.js} +0 -0
  406. /package/build/{HEIGHT_GIRLS.zscore.weekly-3144902d.js → HEIGHT_GIRLS.zscore.weekly-703e5f92.js} +0 -0
  407. /package/build/{HEIGHT_GIRLS.zscore.yearly-2aaf2b22.js → HEIGHT_GIRLS.zscore.yearly-4ec4aece.js} +0 -0
  408. /package/build/{Visible-23adc06b.js → Visible-3589ecdf.js} +0 -0
  409. /package/build/{WEIGHT_BOYS.percentile.monthly-306fddae.js → WEIGHT_BOYS.percentile.monthly-3fa2caaa.js} +0 -0
  410. /package/build/{WEIGHT_BOYS.percentile.weekly-b636ff29.js → WEIGHT_BOYS.percentile.weekly-3f3ab6a6.js} +0 -0
  411. /package/build/{WEIGHT_BOYS.percentile.yearly-9020d242.js → WEIGHT_BOYS.percentile.yearly-0e8b97fd.js} +0 -0
  412. /package/build/{WEIGHT_BOYS.zscore.monthly-e03a27ab.js → WEIGHT_BOYS.zscore.monthly-e95a73e4.js} +0 -0
  413. /package/build/{WEIGHT_BOYS.zscore.weekly-ee1d3669.js → WEIGHT_BOYS.zscore.weekly-9fa69332.js} +0 -0
  414. /package/build/{WEIGHT_BOYS.zscore.yearly-bfaa8fdc.js → WEIGHT_BOYS.zscore.yearly-a3b3fd37.js} +0 -0
  415. /package/build/{WEIGHT_GIRLS.percentile.monthly-8ea574e2.js → WEIGHT_GIRLS.percentile.monthly-a60581dd.js} +0 -0
  416. /package/build/{WEIGHT_GIRLS.percentile.weekly-4762f0d4.js → WEIGHT_GIRLS.percentile.weekly-ce7d59e5.js} +0 -0
  417. /package/build/{WEIGHT_GIRLS.percentile.yearly-aefa8dc5.js → WEIGHT_GIRLS.percentile.yearly-6c2dcb5b.js} +0 -0
  418. /package/build/{WEIGHT_GIRLS.zscore.monthly-4b45292d.js → WEIGHT_GIRLS.zscore.monthly-ae847d4b.js} +0 -0
  419. /package/build/{WEIGHT_GIRLS.zscore.weekly-c6126500.js → WEIGHT_GIRLS.zscore.weekly-8fcb8eee.js} +0 -0
  420. /package/build/{WEIGHT_GIRLS.zscore.yearly-e1336d0d.js → WEIGHT_GIRLS.zscore.yearly-904f1266.js} +0 -0
  421. /package/build/{ageGenerate-3906f8ca.js → ageGenerate-cb2b7ad3.js} +0 -0
  422. /package/build/{animation-f547c73c.js → animation-116218a5.js} +0 -0
  423. /package/build/{appearance-149892d5.js → appearance-c75af09e.js} +0 -0
  424. /package/build/{constants-48fbda23.js → constants-06c26920.js} +0 -0
  425. /package/build/{constants-4b5d512b.js → constants-2b73f764.js} +0 -0
  426. /package/build/{constants-422fd344.js → constants-82549a98.js} +0 -0
  427. /package/build/{context-b554da01.js → context-b791251e.js} +0 -0
  428. /package/build/{dataTransform-b6b26189.js → dataTransform-15d1dbe9.js} +0 -0
  429. /package/build/esm/{BMI_BOYS.percentile.monthly-97a20b4d.js → BMI_BOYS.percentile.monthly-3ba45a7b.js} +0 -0
  430. /package/build/esm/{BMI_BOYS.percentile.weekly-382fe034.js → BMI_BOYS.percentile.weekly-4f198fff.js} +0 -0
  431. /package/build/esm/{BMI_BOYS.percentile.yearly-a36776dd.js → BMI_BOYS.percentile.yearly-e1c40939.js} +0 -0
  432. /package/build/esm/{BMI_BOYS.zscore.monthly-d5318e53.js → BMI_BOYS.zscore.monthly-b723f477.js} +0 -0
  433. /package/build/esm/{BMI_BOYS.zscore.weekly-c0f824a0.js → BMI_BOYS.zscore.weekly-76872082.js} +0 -0
  434. /package/build/esm/{BMI_BOYS.zscore.yearly-f10e1edc.js → BMI_BOYS.zscore.yearly-4c65f9b4.js} +0 -0
  435. /package/build/esm/{BMI_GIRLS.percentile.monthly-d1b62437.js → BMI_GIRLS.percentile.monthly-9acc6205.js} +0 -0
  436. /package/build/esm/{BMI_GIRLS.percentile.weekly-7937273c.js → BMI_GIRLS.percentile.weekly-f59f14ac.js} +0 -0
  437. /package/build/esm/{BMI_GIRLS.percentile.yearly-e315a4a3.js → BMI_GIRLS.percentile.yearly-0e3f0688.js} +0 -0
  438. /package/build/esm/{BMI_GIRLS.zscore.monthly-002269dc.js → BMI_GIRLS.zscore.monthly-b4c2b4d3.js} +0 -0
  439. /package/build/esm/{BMI_GIRLS.zscore.weekly-ef9b3638.js → BMI_GIRLS.zscore.weekly-a96f7858.js} +0 -0
  440. /package/build/esm/{BMI_GIRLS.zscore.yearly-bb3de80e.js → BMI_GIRLS.zscore.yearly-a0416fdf.js} +0 -0
  441. /package/build/esm/{ChevronDown-e7a114ab.js → ChevronDown-7abc9558.js} +0 -0
  442. /package/build/esm/{Google-08fae6e7.js → Google-fbfa5959.js} +0 -0
  443. /package/build/esm/{HEAD CIRCUM_BOYS.percentile.monthly-a8c8b0e4.js → HEAD CIRCUM_BOYS.percentile.monthly-175d0f0a.js} +0 -0
  444. /package/build/esm/{HEAD CIRCUM_BOYS.percentile.weekly-56d55514.js → HEAD CIRCUM_BOYS.percentile.weekly-6c938980.js} +0 -0
  445. /package/build/esm/{HEAD CIRCUM_BOYS.percentile.yearly-46e43701.js → HEAD CIRCUM_BOYS.percentile.yearly-2d8e62fd.js} +0 -0
  446. /package/build/esm/{HEAD CIRCUM_BOYS.zscore.monthly-ac9615aa.js → HEAD CIRCUM_BOYS.zscore.monthly-ca7a5051.js} +0 -0
  447. /package/build/esm/{HEAD CIRCUM_BOYS.zscore.weekly-cda1d4cc.js → HEAD CIRCUM_BOYS.zscore.weekly-65be2ed7.js} +0 -0
  448. /package/build/esm/{HEAD CIRCUM_BOYS.zscore.yearly-c18cf4b5.js → HEAD CIRCUM_BOYS.zscore.yearly-c8ba092c.js} +0 -0
  449. /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.monthly-a4a88b52.js → HEAD CIRCUM_GIRLS.percentile.monthly-1a1aaf27.js} +0 -0
  450. /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.weekly-1826323f.js → HEAD CIRCUM_GIRLS.percentile.weekly-e67f1d9c.js} +0 -0
  451. /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.yearly-d5eedc60.js → HEAD CIRCUM_GIRLS.percentile.yearly-07489c1f.js} +0 -0
  452. /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.monthly-18ef25d6.js → HEAD CIRCUM_GIRLS.zscore.monthly-d38a69f2.js} +0 -0
  453. /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.weekly-ff051a7c.js → HEAD CIRCUM_GIRLS.zscore.weekly-659f780b.js} +0 -0
  454. /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.yearly-58cf563d.js → HEAD CIRCUM_GIRLS.zscore.yearly-1b298591.js} +0 -0
  455. /package/build/esm/{HEIGHT_BOYS.percentile.monthly-92c3e91a.js → HEIGHT_BOYS.percentile.monthly-b723062c.js} +0 -0
  456. /package/build/esm/{HEIGHT_BOYS.percentile.weekly-a42a1193.js → HEIGHT_BOYS.percentile.weekly-04ed64cc.js} +0 -0
  457. /package/build/esm/{HEIGHT_BOYS.percentile.yearly-833092a4.js → HEIGHT_BOYS.percentile.yearly-1c998863.js} +0 -0
  458. /package/build/esm/{HEIGHT_BOYS.zscore.monthly-9e073c1a.js → HEIGHT_BOYS.zscore.monthly-c168ec05.js} +0 -0
  459. /package/build/esm/{HEIGHT_BOYS.zscore.weekly-aff31605.js → HEIGHT_BOYS.zscore.weekly-02b9f313.js} +0 -0
  460. /package/build/esm/{HEIGHT_BOYS.zscore.yearly-d722a128.js → HEIGHT_BOYS.zscore.yearly-063b9a59.js} +0 -0
  461. /package/build/esm/{HEIGHT_GIRLS.percentile.monthly-572ed7f0.js → HEIGHT_GIRLS.percentile.monthly-fc2bc0f7.js} +0 -0
  462. /package/build/esm/{HEIGHT_GIRLS.percentile.weekly-0475e2cb.js → HEIGHT_GIRLS.percentile.weekly-aaa0e151.js} +0 -0
  463. /package/build/esm/{HEIGHT_GIRLS.percentile.yearly-8c5b8b29.js → HEIGHT_GIRLS.percentile.yearly-5d318320.js} +0 -0
  464. /package/build/esm/{HEIGHT_GIRLS.zscore.monthly-421bc7c4.js → HEIGHT_GIRLS.zscore.monthly-37dbee5f.js} +0 -0
  465. /package/build/esm/{HEIGHT_GIRLS.zscore.weekly-4bb3a86d.js → HEIGHT_GIRLS.zscore.weekly-cb6f65f3.js} +0 -0
  466. /package/build/esm/{HEIGHT_GIRLS.zscore.yearly-5c09f9bb.js → HEIGHT_GIRLS.zscore.yearly-41f5ca61.js} +0 -0
  467. /package/build/esm/{Visible-caa51992.js → Visible-f8dd9574.js} +0 -0
  468. /package/build/esm/{WEIGHT_BOYS.percentile.monthly-5e4f66cd.js → WEIGHT_BOYS.percentile.monthly-aa54e3a0.js} +0 -0
  469. /package/build/esm/{WEIGHT_BOYS.percentile.weekly-f50c7446.js → WEIGHT_BOYS.percentile.weekly-088b794b.js} +0 -0
  470. /package/build/esm/{WEIGHT_BOYS.percentile.yearly-eb5eed88.js → WEIGHT_BOYS.percentile.yearly-213bb8ce.js} +0 -0
  471. /package/build/esm/{WEIGHT_BOYS.zscore.monthly-52ea2bb3.js → WEIGHT_BOYS.zscore.monthly-a73caed2.js} +0 -0
  472. /package/build/esm/{WEIGHT_BOYS.zscore.weekly-c7ae7dfd.js → WEIGHT_BOYS.zscore.weekly-f716733a.js} +0 -0
  473. /package/build/esm/{WEIGHT_BOYS.zscore.yearly-d57fc87b.js → WEIGHT_BOYS.zscore.yearly-63919d9b.js} +0 -0
  474. /package/build/esm/{WEIGHT_GIRLS.percentile.monthly-19e46985.js → WEIGHT_GIRLS.percentile.monthly-5646fbb1.js} +0 -0
  475. /package/build/esm/{WEIGHT_GIRLS.percentile.weekly-2591859c.js → WEIGHT_GIRLS.percentile.weekly-306d88cf.js} +0 -0
  476. /package/build/esm/{WEIGHT_GIRLS.percentile.yearly-57bc4cc1.js → WEIGHT_GIRLS.percentile.yearly-efa44761.js} +0 -0
  477. /package/build/esm/{WEIGHT_GIRLS.zscore.monthly-465e668f.js → WEIGHT_GIRLS.zscore.monthly-0eb6c8a3.js} +0 -0
  478. /package/build/esm/{WEIGHT_GIRLS.zscore.weekly-f3f2b59c.js → WEIGHT_GIRLS.zscore.weekly-a8058f6d.js} +0 -0
  479. /package/build/esm/{WEIGHT_GIRLS.zscore.yearly-aeb2b42f.js → WEIGHT_GIRLS.zscore.yearly-4f6015c7.js} +0 -0
  480. /package/build/esm/{ageGenerate-77d53d6e.js → ageGenerate-74c2e9c7.js} +0 -0
  481. /package/build/esm/{animation-fc6c2853.js → animation-e3175d08.js} +0 -0
  482. /package/build/esm/{appearance-281ac1d5.js → appearance-c71018df.js} +0 -0
  483. /package/build/esm/{constants-4cb42008.js → constants-7a11f46a.js} +0 -0
  484. /package/build/esm/{constants-e9e71de4.js → constants-c21d8ae3.js} +0 -0
  485. /package/build/esm/{constants-7aa048fc.js → constants-d7235689.js} +0 -0
  486. /package/build/esm/{context-874ddf6d.js → context-d81be133.js} +0 -0
  487. /package/build/esm/{dataTransform-372efcfe.js → dataTransform-c9eeac89.js} +0 -0
  488. /package/build/esm/{index-e4384b7d.js → index-12e998bf.js} +0 -0
  489. /package/build/esm/{index-3bf06e2a.js → index-1cea02c2.js} +0 -0
  490. /package/build/esm/{index-7a991928.js → index-39b9cc52.js} +0 -0
  491. /package/build/esm/{index-d95973b6.js → index-a96ebb13.js} +0 -0
  492. /package/build/esm/{index-7118c49c.js → index-c7cb0101.js} +0 -0
  493. /package/build/esm/{index-56fa1254.js → index-daa46513.js} +0 -0
  494. /package/build/esm/{index-01968d47.js → index-db6af26b.js} +0 -0
  495. /package/build/esm/{index-f0de9a8e.js → index-dfaf91b6.js} +0 -0
  496. /package/build/esm/{index-07d91836.js → index-e038ce4d.js} +0 -0
  497. /package/build/esm/{index.styles-0391c4e0.js → index.styles-c9e74348.js} +0 -0
  498. /package/build/esm/{localizeNumberFormat-bf73c745.js → localizeNumberFormat-c803156a.js} +0 -0
  499. /package/build/esm/{number-d55d7d9c.js → number-64a7542e.js} +0 -0
  500. /package/build/esm/{paths-43c28ddc.js → paths-a3ad6847.js} +0 -0
  501. /package/build/esm/{routing-c42218f5.js → routing-162621b2.js} +0 -0
  502. /package/build/esm/{shared-98eece30.js → shared-eb75e8c5.js} +0 -0
  503. /package/build/esm/{translationsContext-a1ebd15a.js → translationsContext-2ce23027.js} +0 -0
  504. /package/build/esm/{tslib.es6-27efc22b.js → tslib.es6-2430ac70.js} +0 -0
  505. /package/build/esm/{types-75876d99.js → types-d127803a.js} +0 -0
  506. /package/build/esm/{useImageAspectRatio-83db748d.js → useImageAspectRatio-b39c77ec.js} +0 -0
  507. /package/build/esm/{useOutsideClick-81700f84.js → useOutsideClick-5c34d0ee.js} +0 -0
  508. /package/build/esm/{useScrollbarSize-7e1afe9c.js → useScrollbarSize-e81eb6a3.js} +0 -0
  509. /package/build/esm/{useUniqueId-01369143.js → useUniqueId-39017eb1.js} +0 -0
  510. /package/build/esm/{utils-ccb182fe.js → utils-b29fb220.js} +0 -0
  511. /package/build/esm/{utils-c047a679.js → utils-b8b8ee25.js} +0 -0
  512. /package/build/{index-3f18bdc2.js → index-06e8844d.js} +0 -0
  513. /package/build/{index-ffee06c5.js → index-11ef464d.js} +0 -0
  514. /package/build/{index-977b4795.js → index-6d8bca56.js} +0 -0
  515. /package/build/{index-6e5f3e7c.js → index-74946e26.js} +0 -0
  516. /package/build/{index-48e1122b.js → index-7f972e73.js} +0 -0
  517. /package/build/{index-7e38b347.js → index-b0aea26f.js} +0 -0
  518. /package/build/{index-6d517a66.js → index-b57789f4.js} +0 -0
  519. /package/build/{index-5aae3065.js → index-e89c54d4.js} +0 -0
  520. /package/build/{index-31f66c70.js → index-f6d864a4.js} +0 -0
  521. /package/build/{index.styles-791687be.js → index.styles-29a1822e.js} +0 -0
  522. /package/build/{localizeNumberFormat-f6bcfd9d.js → localizeNumberFormat-e1cc74aa.js} +0 -0
  523. /package/build/{number-3d8b43b3.js → number-6fc1dfe4.js} +0 -0
  524. /package/build/{paths-632e7aad.js → paths-af560692.js} +0 -0
  525. /package/build/{routing-5ffec129.js → routing-6a52dd63.js} +0 -0
  526. /package/build/{shared-a4af7c6b.js → shared-2404a68d.js} +0 -0
  527. /package/build/{translationsContext-18f9807b.js → translationsContext-5889fc15.js} +0 -0
  528. /package/build/{tslib.es6-133289ef.js → tslib.es6-d98fb08d.js} +0 -0
  529. /package/build/{types-fd94261c.js → types-869ba50a.js} +0 -0
  530. /package/build/{useImageAspectRatio-0b4451d6.js → useImageAspectRatio-a5dc09c4.js} +0 -0
  531. /package/build/{useOutsideClick-79067ea1.js → useOutsideClick-567b4a52.js} +0 -0
  532. /package/build/{useScrollbarSize-3c797763.js → useScrollbarSize-883050ad.js} +0 -0
  533. /package/build/{useUniqueId-dbfd8fd0.js → useUniqueId-ead9ce35.js} +0 -0
  534. /package/build/{utils-6470579d.js → utils-311b8f16.js} +0 -0
  535. /package/build/{utils-c9773ecc.js → utils-6fe31363.js} +0 -0
@@ -1,4708 +0,0 @@
1
- import React__default, { createContext, useMemo, useContext, useEffect, useRef, useState, useCallback, forwardRef, useImperativeHandle, useLayoutEffect } from 'react';
2
- import { createStyles, Box, Autocomplete, Input as Input$1, Checkbox as Checkbox$1, Radio as Radio$1, Select as Select$1, Flex, clsx, TextInput, NumberInput as NumberInput$1, Button as Button$1, rem, AspectRatio, Badge, Tooltip } from '@mantine/core';
3
- import { S as Select, d as Checkbox, I as Input, R as Radio, P as Phone, N as NumberInput, E as ErrorIcon, O as OTP } from './index-30db72ed.js';
4
- import { D as DatePicker } from './index-06ce15c7.js';
5
- import { T as Text } from './index-cf36ffd5.js';
6
- import { B as Button } from './index-2e6b84ec.js';
7
- import { G as GlobalTextStyleNew, C as CustomStylesType, F as FontWeight } from './index-56fa1254.js';
8
- import './index.styles-0391c4e0.js';
9
- import { T as TranslationsContext } from './translationsContext-a1ebd15a.js';
10
- import { useIntersection } from '@mantine/hooks';
11
- import './index-68bdec51.js';
12
- import { b as getWrapperDomWithSelector, M as MediaQueries } from './utils-c047a679.js';
13
- import './index-228906bf.js';
14
- import { M as MAPPED_LOCALE } from './utils-e49b4fa5.js';
15
- import { DateInput } from '@mantine/dates';
16
- import { c as ZINDEX_SSO, I as ISO_FORMAT } from './index-bd7de61c.js';
17
- import { C as COMMON_DATE_TRANSLATE_KEY } from './index-e4384b7d.js';
18
- import './index-3bf06e2a.js';
19
- import { u as usePlacesAutocomplete, G as GOOGLE_API_KEY } from './usePlacesAutocomplete-892c6110.js';
20
- import { createFormContext, useForm } from '@mantine/form';
21
- import { _ as __awaiter, a as __rest } from './tslib.es6-27efc22b.js';
22
- import { H as Heading$1 } from './index-75547e3b.js';
23
- import { v1 } from 'uuid';
24
- import { i as isVideo } from './index-07d91836.js';
25
- import { I as ImageWrap, u as useScreenSize } from './index-93413a59.js';
26
- import { u as useTextStyles, C as ChoiceField, T as TextField } from './index-7985100a.js';
27
- import styled from '@emotion/styled';
28
- import { motion } from 'framer-motion';
29
- import { theme } from './miscTheme.js';
30
- import { B as BEARER_TOKEN_COOKIE } from './index-de0cab31.js';
31
- import { w as withLeadgenRecaptcha } from './recaptchaV3-8c953825.js';
32
- import { getCookie, setCookie } from './miscCookieHelper.js';
33
- import { createPortal } from 'react-dom';
34
- import { u as useTranslations } from './index-5ef4be51.js';
35
- import { ChevronDown } from '@hhgtech/icons/arrow';
36
- import { MapPin } from '@hhgtech/icons/core';
37
- import dayjs from 'dayjs';
38
- import { I as InputDate } from './InputDate-f65a6869.js';
39
- import { Carousel } from '@mantine/carousel';
40
- import { c as currencyFormat } from './utils-ccb182fe.js';
41
- import { D as DrawerComponent } from './index-522820f6.js';
42
-
43
- const LeadGenComponentContext = createContext({});
44
-
45
- var LEADGEN_LAYOUT;
46
- (function (LEADGEN_LAYOUT) {
47
- LEADGEN_LAYOUT["LightBoxA"] = "LightBoxA";
48
- LEADGEN_LAYOUT["LightBoxB"] = "LightBoxB";
49
- LEADGEN_LAYOUT["SkinA"] = "SkinA";
50
- LEADGEN_LAYOUT["SkinB"] = "SkinB";
51
- LEADGEN_LAYOUT["Floating"] = "Floating";
52
- LEADGEN_LAYOUT["Tab"] = "Tab";
53
- LEADGEN_LAYOUT["InlineA"] = "InlineA";
54
- LEADGEN_LAYOUT["InlineB"] = "InlineB";
55
- LEADGEN_LAYOUT["CenterTab"] = "CenterTab";
56
- LEADGEN_LAYOUT["Sidebar"] = "Sidebar";
57
- LEADGEN_LAYOUT["Fullscreen"] = "Fullscreen";
58
- LEADGEN_LAYOUT["Slider"] = "Slider";
59
- })(LEADGEN_LAYOUT || (LEADGEN_LAYOUT = {}));
60
- const LEADGEN_BLOCK = {
61
- TextBlock: 'TextBlock',
62
- NumberBlock: 'NumberBlock',
63
- DateBlock: 'DateBlock',
64
- EmailBlock: 'EmailBlock',
65
- PhoneBlock: 'PhoneBlock',
66
- PhoneOtpBlock: 'PhoneOtpBlock',
67
- WhatsappOtpBlock: 'WhatsappOtpBlock',
68
- ZaloOtpBlock: 'ZaloOtpBlock',
69
- LocationBlock: 'LocationBlock',
70
- LinkButtonBlock: 'LinkButtonBlock',
71
- RadioBlock: 'RadioBlock',
72
- DropdownBlock: 'DropdownBlock',
73
- CheckboxBlock: 'CheckboxBlock',
74
- TncBlock: 'TncBlock',
75
- TitleBlock: 'TitleBlock',
76
- SubtitleBlock: 'SubtitleBlock',
77
- };
78
- const LEADGEN_BLOCK_INPUT = [
79
- LEADGEN_BLOCK.TextBlock,
80
- LEADGEN_BLOCK.NumberBlock,
81
- LEADGEN_BLOCK.DateBlock,
82
- LEADGEN_BLOCK.EmailBlock,
83
- LEADGEN_BLOCK.PhoneBlock,
84
- LEADGEN_BLOCK.PhoneOtpBlock,
85
- LEADGEN_BLOCK.WhatsappOtpBlock,
86
- LEADGEN_BLOCK.ZaloOtpBlock,
87
- LEADGEN_BLOCK.LocationBlock,
88
- LEADGEN_BLOCK.RadioBlock,
89
- LEADGEN_BLOCK.DropdownBlock,
90
- LEADGEN_BLOCK.CheckboxBlock,
91
- LEADGEN_BLOCK.TncBlock,
92
- ];
93
- const leadGenFieldNamePhone = (listBlockAdded) => {
94
- return listBlockAdded
95
- .filter(({ name }) => [
96
- LEADGEN_BLOCK.PhoneBlock,
97
- LEADGEN_BLOCK.PhoneOtpBlock,
98
- LEADGEN_BLOCK.WhatsappOtpBlock,
99
- LEADGEN_BLOCK.ZaloOtpBlock,
100
- ].includes(name))
101
- .map(({ data }) => data.value);
102
- };
103
- const leadGenFieldRequired = (blocks) => {
104
- if (!(blocks === null || blocks === void 0 ? void 0 : blocks.length)) {
105
- return [];
106
- }
107
- return blocks
108
- .map(({ data, name, id }) => {
109
- const { required, value } = data;
110
- if (name === LEADGEN_BLOCK.TncBlock && id && required) {
111
- return `TNC-${id}`;
112
- }
113
- if (required && typeof data['newtab'] === 'undefined') {
114
- return value;
115
- }
116
- return;
117
- })
118
- .filter(Boolean);
119
- };
120
- const SSO_MAP_LEAD = ['name', 'email', 'birthday', 'phone', 'gender'];
121
- const LEAD_LOCALE_DATA$1 = {
122
- 'vi-VN': {
123
- popupLang: 'vi',
124
- countryCode: 'vn',
125
- countryCodeNumber: 84,
126
- },
127
- 'id-ID': {
128
- popupLang: 'id',
129
- countryCode: 'id',
130
- countryCodeNumber: 62,
131
- },
132
- 'th-TH': {
133
- popupLang: 'th',
134
- countryCode: 'th',
135
- countryCodeNumber: 66,
136
- },
137
- 'ms-MY': {
138
- popupLang: 'ms',
139
- countryCode: 'my',
140
- countryCodeNumber: 60,
141
- },
142
- 'zh-TW': {
143
- popupLang: 'zh',
144
- countryCode: 'tw',
145
- countryCodeNumber: 886,
146
- },
147
- 'km-KH': {
148
- popupLang: 'km',
149
- countryCode: 'kh',
150
- countryCodeNumber: 855,
151
- },
152
- 'my-MM': {
153
- popupLang: 'my',
154
- countryCode: 'mm',
155
- countryCodeNumber: 95,
156
- },
157
- 'hi-IN': {
158
- popupLang: 'hi',
159
- countryCode: 'in',
160
- countryCodeNumber: 91,
161
- },
162
- };
163
- const mappingSSOToLead = (userInfoProps) => {
164
- var _a, _b;
165
- try {
166
- const { id, area_code } = userInfoProps;
167
- if (!userInfoProps || !id) {
168
- return;
169
- }
170
- const user = {};
171
- for (const ssoKey of SSO_MAP_LEAD) {
172
- if (ssoKey in userInfoProps &&
173
- typeof (userInfoProps === null || userInfoProps === void 0 ? void 0 : userInfoProps[ssoKey]) !== 'undefined') {
174
- const initValue = userInfoProps[ssoKey];
175
- if (ssoKey === 'birthday') {
176
- const dob = dayjs(initValue, 'YYYY-MM-DD', true);
177
- if (dob.isValid()) {
178
- user.birthday = dob.toDate();
179
- }
180
- }
181
- else if (ssoKey === 'gender') {
182
- user.gender = initValue.toString();
183
- }
184
- else if (ssoKey === 'phone' && typeof area_code !== 'undefined') {
185
- user.phone = area_code + initValue;
186
- }
187
- else {
188
- user[ssoKey] = initValue;
189
- }
190
- }
191
- }
192
- if (((_a = user === null || user === void 0 ? void 0 : user.email) === null || _a === void 0 ? void 0 : _a.includes('@hhg.com')) ||
193
- ((_b = user === null || user === void 0 ? void 0 : user.email) === null || _b === void 0 ? void 0 : _b.includes('@facebook.com'))) {
194
- delete user.email;
195
- }
196
- return Object.values(user).length ? user : undefined;
197
- }
198
- catch (error) {
199
- return;
200
- }
201
- };
202
- const formatCampaignDetail = (campaign) => {
203
- if (!campaign) {
204
- return {};
205
- }
206
- try {
207
- const { extra_fields, thank_you_image } = campaign || {};
208
- const { textBlocks: exTextBlocks, imageBlocks: exImageBlocks, listBlockAdded: exListBlockAdded, listBlockThankyou: exListBlockThankyou, actionBlocks: exActionBlocks, } = extra_fields;
209
- const textBlocks = JSON.parse(exTextBlocks);
210
- const imageBlocks = JSON.parse(exImageBlocks);
211
- const listBlockAdded = JSON.parse(exListBlockAdded);
212
- const listBlockThankyou = JSON.parse(exListBlockThankyou);
213
- const actionBlocks = JSON.parse(exActionBlocks);
214
- const ThankYouBlock = {
215
- image: { src: thank_you_image },
216
- };
217
- listBlockThankyou.forEach((block) => {
218
- const { name, data } = block || {};
219
- const { value: htmlText, align, newtab, url } = data || {};
220
- switch (name) {
221
- case LEADGEN_BLOCK.TitleBlock: {
222
- ThankYouBlock.title = { htmlText, align };
223
- }
224
- case LEADGEN_BLOCK.SubtitleBlock: {
225
- ThankYouBlock.description = { htmlText, align };
226
- }
227
- case LEADGEN_BLOCK.LinkButtonBlock: {
228
- ThankYouBlock.button = { htmlText, newtab, url };
229
- }
230
- }
231
- });
232
- return Object.assign(Object.assign({}, campaign), { extra_fields: Object.assign(Object.assign({}, extra_fields), { textBlocks,
233
- imageBlocks,
234
- listBlockAdded,
235
- listBlockThankyou,
236
- actionBlocks }), ThankYouBlock });
237
- }
238
- catch (error) {
239
- return {};
240
- }
241
- };
242
-
243
- const CAMPAIGN_TARGET_TYPE = { LINKS: 1, TAGS: 2 };
244
- let LEAD_API = 'https://dev.leadgen.hellobacsi.com/';
245
- const LEAD_DEVICE_TYPE = {
246
- MOBILE: 1,
247
- DESKTOP: 2,
248
- };
249
- let LEAD_CLASS = '';
250
- if (LEAD_API.includes('localhost')) {
251
- LEAD_API = 'https://dev.leadgen.hellobacsi.com/';
252
- }
253
- if (location.hostname.includes('marrybaby.vn')) {
254
- LEAD_CLASS = 'pink';
255
- }
256
- // var LEAD_CURRENT_URL = location.href.toLowerCase();
257
- let LEAD_CURRENT_URL = 'https://' + location.hostname + location.pathname + location.search;
258
- LEAD_CURRENT_URL = LEAD_CURRENT_URL.toLowerCase();
259
- // TODO: set inital object if exists
260
- if (sessionStorage.getItem('insider_object')) {
261
- window.insider_object = JSON.parse(sessionStorage.getItem('insider_object'));
262
- }
263
- const docLang = document.documentElement.lang;
264
- // TODO: country code
265
- const LEAD_LOCALE_DATA = {
266
- 'vi-VN': {
267
- popupLang: 'vi',
268
- countryCode: 'vn',
269
- countryCodeNumber: 84,
270
- },
271
- 'id-ID': {
272
- popupLang: 'id',
273
- countryCode: 'id',
274
- countryCodeNumber: 62,
275
- },
276
- 'th-TH': {
277
- popupLang: 'th',
278
- countryCode: 'th',
279
- countryCodeNumber: 66,
280
- },
281
- 'ms-MY': {
282
- popupLang: 'ms',
283
- countryCode: 'my',
284
- countryCodeNumber: 60,
285
- },
286
- 'zh-TW': {
287
- popupLang: 'zh',
288
- countryCode: 'tw',
289
- countryCodeNumber: 886,
290
- },
291
- 'km-KH': {
292
- popupLang: 'km',
293
- countryCode: 'kh',
294
- countryCodeNumber: 855,
295
- },
296
- 'my-MM': {
297
- popupLang: 'my',
298
- countryCode: 'mm',
299
- countryCodeNumber: 95,
300
- },
301
- 'hi-IN': {
302
- popupLang: 'hi',
303
- countryCode: 'in',
304
- countryCodeNumber: 91,
305
- },
306
- };
307
- const LEAD_LOCALE = LEAD_LOCALE_DATA[docLang] || LEAD_LOCALE_DATA['vi-VN'];
308
- function LEAD_RESET_VAR() {
309
- // LEAD_CURRENT_URL = location.href.toLowerCase();
310
- LEAD_CURRENT_URL =
311
- 'https://' + location.hostname + location.pathname + location.search;
312
- }
313
- const LEAD_TIMEZONE_DATA = {
314
- 1: 'Asia/Ho_Chi_Minh',
315
- 10: 'Asia/Ho_Chi_Minh',
316
- 11: 'Asia/Ho_Chi_Minh',
317
- 12: 'Asia/Ho_Chi_Minh',
318
- 2: 'Asia/Jakarta',
319
- 3: 'Asia/Bangkok',
320
- 4: 'Asia/Phnom_Penh',
321
- 5: 'Asia/Kuala_Lumpur',
322
- 6: 'Asia/Taipei',
323
- 7: 'Asia/Yangon',
324
- 8: 'Asia/Kolkata',
325
- 9: 'Asia/Manila', // Philippines / Filipinos Site
326
- };
327
- const TEMPLATE_ALLOW_NEWTRACKING = [
328
- LEADGEN_LAYOUT.LightBoxA,
329
- LEADGEN_LAYOUT.LightBoxB,
330
- LEADGEN_LAYOUT.InlineA,
331
- LEADGEN_LAYOUT.InlineB,
332
- LEADGEN_LAYOUT.Slider,
333
- LEADGEN_LAYOUT.CenterTab,
334
- ];
335
-
336
- const formatLeadGenFormValue = (values = {}, blocks) => {
337
- const newValues = {};
338
- for (const block of blocks) {
339
- const { data } = block || {};
340
- const { value: fieldName } = data || {};
341
- if (fieldName in values) {
342
- newValues[fieldName] = values[fieldName];
343
- }
344
- }
345
- return newValues;
346
- };
347
-
348
- class Store {
349
- constructor() {
350
- this.apiSsoUrl = 'https://staging-id.hellobacsi.com/';
351
- this.apiLeadUrl = 'https://dev.leadgen.hellobacsi.com/';
352
- this.apiSubotUrl = 'https://staging-service-subot.hellohealthgroup.com/';
353
- }
354
- }
355
- const leadStore = new Store();
356
-
357
- const METHOD = {
358
- GET: 'get',
359
- POST: 'POST',
360
- };
361
- const LEADGEN_ERROR_CODE = {
362
- UNAUTHORIZED: 'UNAUTHORIZED',
363
- };
364
- const LEADGEN_API_PATH = {
365
- V2_CAMPAIGN: 'api/v2/campaign',
366
- V2_SUBSCRIPTION_LEAD: 'api/v2/subscription-box',
367
- V2_SUBSCRIPTION_INFO: 'api/campaign/get-title',
368
- POST_CTA_SUBMIT: 'api/collection/cta-submit',
369
- };
370
- const SSO_API_PATH = {
371
- USER_UPDATE: 'api/user/update',
372
- };
373
- const ssoApi = {
374
- call(_a) {
375
- var { url, data } = _a, config = __rest(_a, ["url", "data"]);
376
- const token = getCookie(BEARER_TOKEN_COOKIE);
377
- config.body = JSON.stringify(data);
378
- config.headers = {
379
- 'Content-Type': 'application/json',
380
- Authorization: `Bearer ${token}`,
381
- };
382
- if (!token) {
383
- return Promise.reject({
384
- code: LEADGEN_ERROR_CODE.UNAUTHORIZED,
385
- _data: '',
386
- });
387
- }
388
- return fetch(`${leadStore.apiSsoUrl}${url}`, config)
389
- .then((res) => res.json())
390
- .catch(() => ({}));
391
- },
392
- };
393
- const leadApi = {
394
- call(_a) {
395
- var { url, data = undefined } = _a, config = __rest(_a, ["url", "data"]);
396
- config.body = JSON.stringify(data);
397
- config.headers = {
398
- 'Content-Type': 'application/json',
399
- };
400
- return fetch(`${leadStore.apiLeadUrl}${url}`, config)
401
- .then((res) => res.json())
402
- .catch(() => ({}));
403
- },
404
- };
405
- const subotApi = {
406
- call(_a) {
407
- var { url, data } = _a, config = __rest(_a, ["url", "data"]);
408
- config.body = JSON.stringify(data);
409
- config.headers = {
410
- 'Content-Type': 'application/json',
411
- };
412
- return fetch(`${leadStore.apiSubotUrl}${url}`, config)
413
- .then((res) => res.json())
414
- .catch(() => ({}));
415
- },
416
- };
417
- const campaignGetById = (id) => {
418
- return leadApi.call({
419
- url: `api/internal/campaign/${id}`,
420
- method: 'get',
421
- });
422
- };
423
- const validateEmailOrPhoneOnLeadGen = ({ campaign_id, email, phone, }) => {
424
- let phoneToSend = phone;
425
- // Remove the '0' part. Logic from Back to check between Subot and Lead with different format
426
- if (phoneToSend && phoneToSend.startsWith('0')) {
427
- phoneToSend = phoneToSend.substring(1);
428
- }
429
- return leadApi.call({
430
- url: 'api/subot-campaign/check',
431
- method: 'post',
432
- data: {
433
- campaign_id,
434
- email,
435
- phone: phoneToSend,
436
- },
437
- });
438
- };
439
- const validateEmailOrPhoneOnSubot = ({ bot_id, email, phone, }) => {
440
- let phoneToSend = phone;
441
- // Remove the '0' part. Logic from Back to check between Subot and Lead with different format
442
- if (phoneToSend && phoneToSend.startsWith('0')) {
443
- phoneToSend = phoneToSend.substring(1);
444
- }
445
- return subotApi.call({
446
- url: 'frontend/api/subot-campaign/check',
447
- method: 'post',
448
- data: {
449
- bot_id,
450
- email,
451
- phone: phoneToSend,
452
- },
453
- });
454
- };
455
- const validatePhoneNumberOnLeadGen = ({ campaign_id, phone, }) => {
456
- return leadApi.call({
457
- url: 'api/collection/log/check-phone-with-campaign',
458
- method: 'post',
459
- data: {
460
- campaign_id,
461
- phone,
462
- },
463
- });
464
- };
465
- const LEAD_OTP_API = {
466
- whatsapp: 'api/sms/whatsapp_otp',
467
- phone: 'api/sms/otp',
468
- zalo: 'api/sms/zalo_otp',
469
- };
470
- const sendSMSOtpLead = ({ phone, type, }) => __awaiter(void 0, void 0, void 0, function* () {
471
- return leadApi.call({
472
- url: LEAD_OTP_API[type],
473
- method: 'post',
474
- data: yield withLeadgenRecaptcha('leadgen_send_otp', {
475
- // The type Whatsapp/Zalo do not remove the '+'
476
- phone_number: type === 'phone' ? phone.replace('+', '') : phone,
477
- }),
478
- });
479
- });
480
- const LEAD_VERIFY_OTP_API = {
481
- whatsapp: 'api/sms/whatsapp_verify',
482
- phone: 'api/sms/verify',
483
- zalo: 'api/sms/zalo_verify',
484
- };
485
- const verifyOtpLead = ({ phone, otp, type, }) => {
486
- return leadApi.call({
487
- url: LEAD_VERIFY_OTP_API[type],
488
- method: 'post',
489
- data: {
490
- // The type Whatsapp/Zalo do not remove the '+'
491
- otp_code: otp,
492
- phone_number: type === 'phone' ? phone.replace('+', '') : phone,
493
- },
494
- });
495
- };
496
- const getCampaignByCode = (campaign_code) => {
497
- return leadApi.call({
498
- url: `${LEADGEN_API_PATH.V2_CAMPAIGN}/${campaign_code}`,
499
- method: METHOD.GET,
500
- });
501
- };
502
- const getSubscriptionBoxInfo = ({ category, site, slug, }) => {
503
- return leadApi.call({
504
- url: `${LEADGEN_API_PATH.V2_SUBSCRIPTION_INFO}?category=${category}&site=${site}&slug=${slug}`,
505
- method: METHOD.GET,
506
- });
507
- };
508
- const postSubscriptionBoxLead = ({ data }) => __awaiter(void 0, void 0, void 0, function* () {
509
- return leadApi.call({
510
- url: LEADGEN_API_PATH.V2_SUBSCRIPTION_LEAD,
511
- method: METHOD.POST,
512
- data: yield withLeadgenRecaptcha('leadgen_subscribe', data),
513
- });
514
- });
515
- const postUserInfoFromLeadGen = ({ name }) => {
516
- return ssoApi.call({
517
- url: SSO_API_PATH.USER_UPDATE,
518
- method: METHOD.POST,
519
- data: { name },
520
- });
521
- };
522
- const campaignPostImpression = ({ code, action, title_article, ga_client_id, cookie_id, extra, url, referrer, }) => {
523
- return leadApi.call({
524
- url: `api/campaign/${code}/impression`,
525
- method: METHOD.POST,
526
- data: {
527
- action,
528
- title_article,
529
- cookie_id,
530
- ga_client_id,
531
- url,
532
- extra,
533
- referrer,
534
- },
535
- });
536
- };
537
- const trackingSubscription = (data) => {
538
- return leadApi.call({
539
- url: `api/collection/tracking-subscription`,
540
- method: METHOD.POST,
541
- data,
542
- });
543
- };
544
- const postPhoneToCtaSubmit = ({ data }) => {
545
- return leadApi.call({
546
- url: LEADGEN_API_PATH.POST_CTA_SUBMIT,
547
- method: METHOD.POST,
548
- data,
549
- });
550
- };
551
- const Service = {
552
- campaignGetById,
553
- getCampaignByCode,
554
- getSubscriptionBoxInfo,
555
- postSubscriptionBoxLead,
556
- postUserInfoFromLeadGen,
557
- campaignPostImpression,
558
- trackingSubscription,
559
- validateEmailOrPhoneOnSubot,
560
- validateEmailOrPhoneOnLeadGen,
561
- validatePhoneNumberOnLeadGen,
562
- sendSMSOtpLead,
563
- verifyOtpLead,
564
- postPhoneToCtaSubmit,
565
- };
566
-
567
- const checkUsedEmailOrPhone = (campaignId, campaign_subot_id, data) => __awaiter(void 0, void 0, void 0, function* () {
568
- const key = 'email' in data ? 'email' : 'phone';
569
- const value = 'email' in data ? data.email : data.phone;
570
- const errorMsg = 'email' in data ? 'validator.emailUsed' : 'validator.phoneUsed';
571
- /** Check on Leadgen Tool */
572
- const resLeadGen = yield Service.validateEmailOrPhoneOnLeadGen({
573
- campaign_id: [campaignId],
574
- [key]: value, // Can be email or phone
575
- });
576
- if (resLeadGen._errorCode === 'SubmitLeadWithBotId_ERR_001' ||
577
- resLeadGen._errorCode === 'SubmitLeadWithBotId_ERR_002') {
578
- return errorMsg;
579
- }
580
- /** Check on Subot */
581
- if (campaign_subot_id.length) {
582
- const resSubot = yield Service.validateEmailOrPhoneOnSubot({
583
- bot_id: campaign_subot_id,
584
- [key]: value, // Can be email or phone
585
- });
586
- if (resSubot._errorCode === 'CheckSuBotLeadTool_ERR_001') {
587
- return errorMsg;
588
- }
589
- }
590
- });
591
- const checkUsedPhoneOnly = (campaignId, phone) => __awaiter(void 0, void 0, void 0, function* () {
592
- var _a;
593
- const resLeadGen = yield Service.validatePhoneNumberOnLeadGen({
594
- campaign_id: campaignId,
595
- phone,
596
- });
597
- if (((_a = resLeadGen === null || resLeadGen === void 0 ? void 0 : resLeadGen._messages) === null || _a === void 0 ? void 0 : _a[0]) === 'Phone was exist') {
598
- return 'validator.phoneUsed';
599
- }
600
- });
601
- const validatedCache = {
602
- email: {},
603
- phone: {},
604
- phoneOnly: {},
605
- };
606
- const checkUsedEmailOrPhoneWithCache = (campaignId, campaign_subot_id, data) => __awaiter(void 0, void 0, void 0, function* () {
607
- const key = 'email' in data ? 'email' : 'phone';
608
- const value = 'email' in data ? data.email : data.phone;
609
- const errorMsg = 'email' in data ? 'validator.emailUsed' : 'validator.phoneUsed';
610
- if (validatedCache[key][value]) {
611
- if (validatedCache[key][value].value) {
612
- return errorMsg;
613
- }
614
- else if (!validatedCache[key][value].value &&
615
- validatedCache[key][value].expire > Date.now()) {
616
- return '';
617
- }
618
- }
619
- const res = yield checkUsedEmailOrPhone(campaignId, campaign_subot_id, data);
620
- if (res) {
621
- validatedCache[key][value] = {
622
- value: true,
623
- };
624
- }
625
- else {
626
- validatedCache[key][value] = {
627
- value: false,
628
- expire: Date.now() + 1000 * 60,
629
- };
630
- }
631
- return res;
632
- });
633
- const checkUsedPhoneOnlyWithCache = (campaignId, phone) => __awaiter(void 0, void 0, void 0, function* () {
634
- if (validatedCache.phoneOnly[phone]) {
635
- if (validatedCache.phoneOnly[phone].value) {
636
- return 'validator.phoneUsed';
637
- }
638
- else if (!validatedCache.phoneOnly[phone].value &&
639
- validatedCache.phoneOnly[phone].expire > Date.now()) {
640
- return '';
641
- }
642
- }
643
- const res = yield checkUsedPhoneOnly(campaignId, phone);
644
- if (res) {
645
- validatedCache.phoneOnly[phone] = {
646
- value: true,
647
- };
648
- }
649
- else {
650
- validatedCache.phoneOnly[phone] = {
651
- value: false,
652
- expire: Date.now() + 1000 * 60,
653
- };
654
- }
655
- return res;
656
- });
657
- const clearCacheUsedEmailOrPhone = () => {
658
- validatedCache.email = {};
659
- validatedCache.phone = {};
660
- validatedCache.phoneOnly = {};
661
- };
662
-
663
- const FormatMessageContext = createContext(null);
664
- const LeadGenTranslationProvider = ({ locale, translations, formatMessage, children, }) => {
665
- const translationContextValue = useMemo(() => ({ locale, values: translations }), [locale, translations]);
666
- return (React__default.createElement(FormatMessageContext.Provider, { value: formatMessage || null }, formatMessage ? (children) : (React__default.createElement(TranslationsContext.Provider, { value: translationContextValue }, children))));
667
- };
668
- const useLeadGenTranslations = () => {
669
- const externalFormatMessage = useContext(FormatMessageContext);
670
- const { t: internalT, locale } = useTranslations();
671
- const t = useMemo(() => {
672
- if (externalFormatMessage) {
673
- return (key, options) => {
674
- return externalFormatMessage({ id: key, defaultMessage: key }, options);
675
- };
676
- }
677
- return internalT;
678
- }, [externalFormatMessage, internalT]);
679
- return { t, locale };
680
- };
681
-
682
- // You can give context variables any name
683
- const [LeadFormProvider$1, useLeadFormContext$1, useLeadForm$1] = createFormContext();
684
- const useLeadFormConfig$1 = ({ listBlockAdded = [], validatingPhoneRef, validatingEmailRef, campaignId, campaign_subot_id = [], userInfo, }) => {
685
- const { t } = useLeadGenTranslations();
686
- const initialValues = useMemo(() => formatLeadGenFormValue(mappingSSOToLead(userInfo), listBlockAdded), [userInfo === null || userInfo === void 0 ? void 0 : userInfo.id]);
687
- useEffect(() => {
688
- if (!window.intlTelInputUtils) {
689
- require('intl-tel-input/build/js/utils');
690
- }
691
- }, []);
692
- const validateObj = useMemo(() => {
693
- const InputBlocks = [
694
- 'TextBlock',
695
- 'NumberBlock',
696
- 'EmailBlock',
697
- 'PhoneBlock',
698
- 'DateBlock',
699
- 'CheckboxBlock',
700
- 'RadioBlock',
701
- 'DropdownBlock',
702
- 'PhoneOtpBlock',
703
- 'WhatsappOtpBlock',
704
- 'ZaloOtpBlock',
705
- 'LocationBlock',
706
- 'TncBlock',
707
- ];
708
- // ALL are required and can skip if not touched yet
709
- const withSharedCheck = (name, cb,
710
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
711
- block) => {
712
- return (value) => {
713
- var _a;
714
- const isBLockRequired = (_a = block === null || block === void 0 ? void 0 : block.data) === null || _a === void 0 ? void 0 : _a.required;
715
- if (!formRef.current.isTouched(name))
716
- return;
717
- if (typeof value === 'undefined' ||
718
- value === '' ||
719
- (Array.isArray(value) && value.length === 0)) {
720
- return isBLockRequired
721
- ? t('validator.required')
722
- : cb === null || cb === void 0 ? void 0 : cb(value);
723
- }
724
- return cb === null || cb === void 0 ? void 0 : cb(value);
725
- };
726
- };
727
- return listBlockAdded
728
- .filter((b) => InputBlocks.includes(b.name))
729
- .reduce((r, b) => {
730
- var _a;
731
- const isRequired = (_a = b.data.required) !== null && _a !== void 0 ? _a : true;
732
- if (b.name === 'NumberBlock') {
733
- return Object.assign(Object.assign({}, r), { [b.data.value]: withSharedCheck(b.data.value, (value) => {
734
- if (value && isNaN(Number(value))) {
735
- return t('validator.number');
736
- }
737
- }, b) });
738
- }
739
- else if (b.name === 'EmailBlock') {
740
- return Object.assign(Object.assign({}, r), { [b.data.value]: withSharedCheck(b.data.value, (value) => {
741
- if (value && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) {
742
- return t('validator.email');
743
- }
744
- if (!value)
745
- return;
746
- validatingEmailRef.current = true;
747
- setTimeout(() => {
748
- formRef.current.setFieldError(b.data.value, 'Validating...');
749
- checkUsedEmailOrPhoneWithCache(campaignId, campaign_subot_id, {
750
- email: value,
751
- })
752
- .then((tKey) => {
753
- if (tKey) {
754
- formRef.current.setFieldError(b.data.value, t(tKey));
755
- }
756
- else {
757
- formRef.current.clearFieldError(b.data.value);
758
- }
759
- validatingEmailRef.current = false;
760
- })
761
- .catch((e) => {
762
- console.error(e);
763
- formRef.current.setFieldError(b.data.value, e.message || 'Something went wrong');
764
- validatingEmailRef.current = false;
765
- });
766
- }, 200);
767
- }, b) });
768
- }
769
- else if (b.name === 'PhoneBlock' ||
770
- b.name === 'PhoneOtpBlock' ||
771
- b.name === 'ZaloOtpBlock' ||
772
- b.name === 'WhatsappOtpBlock') {
773
- return Object.assign(Object.assign({}, r), { [b.data.value]: withSharedCheck(b.data.value, (value) => {
774
- if (value &&
775
- window.intlTelInputUtils &&
776
- !window.intlTelInputUtils.isValidNumber(String(value), LEAD_LOCALE.countryCode)) {
777
- return t('validator.phone');
778
- }
779
- if (!value)
780
- return;
781
- validatingPhoneRef.current = true;
782
- setTimeout(() => {
783
- formRef.current.setFieldError(b.data.value, 'Validating...');
784
- if (b.data.singleSubmission) {
785
- checkUsedPhoneOnlyWithCache(campaignId, value)
786
- .then((tKey) => {
787
- if (tKey) {
788
- formRef.current.setFieldError(b.data.value, t(tKey));
789
- }
790
- else {
791
- formRef.current.clearFieldError(b.data.value);
792
- }
793
- validatingPhoneRef.current = false;
794
- })
795
- .catch((err) => {
796
- console.error(err);
797
- formRef.current.setFieldError(b.data.value, err.message || 'Something went wrong');
798
- validatingPhoneRef.current = false;
799
- });
800
- }
801
- else {
802
- checkUsedEmailOrPhoneWithCache(campaignId, campaign_subot_id, {
803
- phone: value,
804
- })
805
- .then((tKey) => {
806
- if (tKey) {
807
- formRef.current.setFieldError(b.data.value, t(tKey));
808
- }
809
- else {
810
- formRef.current.clearFieldError(b.data.value);
811
- }
812
- validatingPhoneRef.current = false;
813
- })
814
- .catch((e) => {
815
- console.error(e);
816
- formRef.current.setFieldError(b.data.value, e.message || 'Something went wrong');
817
- validatingPhoneRef.current = false;
818
- });
819
- }
820
- }, 200);
821
- }, b) });
822
- }
823
- else if (b.name === 'DateBlock') {
824
- return Object.assign(Object.assign({}, r), { [b.data.value]: withSharedCheck(b.data.value, (value) => {
825
- if (value && isNaN(Date.parse(value))) {
826
- return t('validator.date');
827
- }
828
- }, b) });
829
- }
830
- else if (b.name === 'TncBlock') {
831
- return Object.assign(Object.assign({}, r), { [`TNC-` + b.id]: withSharedCheck('TNC-' + b.id, (value) => {
832
- if (isRequired && !value) {
833
- return t('validator.required');
834
- }
835
- }, b) });
836
- }
837
- else {
838
- return Object.assign(Object.assign({}, r), { [b.data.value]: withSharedCheck(b.data.value, undefined, b) });
839
- }
840
- }, {});
841
- }, [listBlockAdded.map((b) => b.name).join(',')]);
842
- const form = useLeadForm$1({
843
- validateInputOnChange: true,
844
- clearInputErrorOnChange: true,
845
- validate: validateObj,
846
- initialValues,
847
- });
848
- const formRef = useRef(form);
849
- formRef.current = form;
850
- return { form, validateObj };
851
- };
852
-
853
- const Component = ({ campaign, onClose: onCloseProp, onOtherSubmit, onSubmit, showThankyou, setShowThankyou, locale, children, showEmpty, setShowEmpty, userInfo, }) => {
854
- var _a, _b;
855
- const extraFields = campaign.extra_fields;
856
- const campaignId = campaign.id;
857
- const campaign_subot_id = campaign.bot_id || [];
858
- const listBlockAdded = JSON.parse(extraFields.listBlockAdded);
859
- const actionBlocks = JSON.parse(extraFields.actionBlocks);
860
- const textBlocks = JSON.parse(extraFields.textBlocks);
861
- const heading = ((_b = (_a = textBlocks === null || textBlocks === void 0 ? void 0 : textBlocks.titleBlock) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.value) || '';
862
- const description = textBlocks.subtitleBlock.data.value;
863
- const validatingPhoneRef = useRef(false);
864
- const validatingEmailRef = useRef(false);
865
- const leadFormConfig = useLeadFormConfig$1({
866
- listBlockAdded,
867
- validatingPhoneRef,
868
- validatingEmailRef,
869
- campaignId,
870
- campaign_subot_id,
871
- userInfo,
872
- });
873
- const [showOtpPhone, setShowOtpPhone] = useState(null);
874
- const [formRef, setFormRef] = useState(null);
875
- const onClose = () => {
876
- if (showOtpPhone) {
877
- setShowOtpPhone(null);
878
- }
879
- else {
880
- onCloseProp === null || onCloseProp === void 0 ? void 0 : onCloseProp();
881
- }
882
- };
883
- useEffect(() => {
884
- clearCacheUsedEmailOrPhone();
885
- }, []);
886
- return campaign ? (React__default.createElement(LeadGenComponentContext.Provider, { value: {
887
- campaignId,
888
- campaign_subot_id,
889
- heading,
890
- description,
891
- listBlockAdded,
892
- textBlocks,
893
- actionBlocks,
894
- leadFormConfig,
895
- validatingEmailRef,
896
- validatingPhoneRef,
897
- formRef: { current: formRef },
898
- setFormRef,
899
- locale,
900
- onClose,
901
- onOtherSubmit,
902
- showOtpPhone,
903
- setShowOtpPhone,
904
- onSubmit,
905
- showThankyou,
906
- setShowThankyou,
907
- showEmpty,
908
- setShowEmpty,
909
- } }, children)) : null;
910
- };
911
-
912
- const Description = (_a) => {
913
- var rest = __rest(_a, []);
914
- const { description } = useContext(LeadGenComponentContext);
915
- return description ? (React__default.createElement(Text, Object.assign({ size: "p3" }, rest), description)) : null;
916
- };
917
-
918
- const LeadGenContext = createContext({});
919
-
920
- var useStyles$3 = createStyles(() => {
921
- return {
922
- control: {},
923
- };
924
- });
925
-
926
- const libraries$1 = ['places'];
927
- const LocationBlock = ({ name, placeholder, locale, required = true, }) => {
928
- var _a;
929
- const form = useLeadFormContext$1();
930
- const [searchValue, setSearchValue] = useState('');
931
- const [address, setAddress] = useState('');
932
- const { predictions } = usePlacesAutocomplete(searchValue, '', locale === 'tl-PH' ? 'en' : (_a = locale === null || locale === void 0 ? void 0 : locale.split('-')) === null || _a === void 0 ? void 0 : _a[0]);
933
- const [LoadScript, setLoadScript] = useState(null);
934
- const [ready, setReady] = useState(false);
935
- const randRef = useRef(Math.random().toString(36).substring(7));
936
- const options = useMemo(() => {
937
- const _opts = predictions.map((p) => {
938
- return {
939
- value: p.description,
940
- label: p.description,
941
- };
942
- });
943
- const isExist = _opts.find((o) => o.value === address);
944
- if (!address || isExist) {
945
- return _opts;
946
- }
947
- return [{ value: address, label: address }].concat(_opts);
948
- }, [predictions, address]);
949
- useEffect(() => {
950
- var _a, _b, _c;
951
- // only load extra google script when not yet loaded
952
- if (!((_c = (_b = (_a = window === null || window === void 0 ? void 0 : window.google) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.places) === null || _c === void 0 ? void 0 : _c.AutocompleteService)) {
953
- import('@react-google-maps/api').then((m) => {
954
- setLoadScript(() => m.LoadScript);
955
- setTimeout(() => {
956
- setReady(true);
957
- }, 200);
958
- });
959
- }
960
- else {
961
- setReady(true);
962
- }
963
- }, []);
964
- if (!ready)
965
- return (React__default.createElement("div", { style: {
966
- height: 73,
967
- } }));
968
- return (React__default.createElement(React__default.Fragment, null,
969
- LoadScript && (React__default.createElement(LoadScript, { googleMapsApiKey: GOOGLE_API_KEY, libraries: libraries$1, loadingElement: React__default.createElement(React__default.Fragment, null) })),
970
- React__default.createElement("div", { style: { display: 'none' }, "data-extra": true, "data-name": name, "data-control": 'text' }),
971
- React__default.createElement(Select, Object.assign({ className: "lead-modal__form-control", label: placeholder, placeholder: placeholder, withAsterisk: required, name: name, data: options, searchValue: searchValue, onSearchChange: (query) => {
972
- setSearchValue(query);
973
- }, filter: () => true, clearable: true, searchable: true, onChange: (val) => setAddress(val || ''), icon: React__default.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none" },
974
- React__default.createElement("path", { d: "M10 9.792q.605 0 1.032-.427.426-.428.426-1.032 0-.603-.426-1.031A1.4 1.4 0 0 0 10 6.875q-.604 0-1.032.427a1.4 1.4 0 0 0-.426 1.031q0 .604.426 1.032.428.426 1.032.427m0 8.083q-.145 0-.292-.042a.7.7 0 0 1-.27-.145Q6.478 15 5.01 12.708 3.54 10.418 3.54 8.5q0-3.021 1.949-4.823T10 1.875t4.51 1.802q1.95 1.802 1.949 4.823 0 1.917-1.468 4.208-1.47 2.292-4.427 4.98a.7.7 0 0 1-.271.145 1 1 0 0 1-.292.042", fill: "#8C8C8C" })), autoComplete: 'no-auto-complete-' + randRef.current, rightSection: React__default.createElement(React__default.Fragment, null) }, form.getInputProps(name)))));
975
- };
976
-
977
- const SubtitleBlock$1 = ({ children, align, }) => (React__default.createElement("p", { className: `lead-modal__description ${'le-text-align-' + (align || '')} ${LEAD_CLASS}` }, children));
978
-
979
- const TitleBlock$1 = ({ children, align, }) => (React__default.createElement("h2", { className: `lead-modal__title ${'le-text-align-' + (align || '')} ${LEAD_CLASS}` }, children));
980
-
981
- const Fields = ({ listBlockAdded, popupId, locale, onClose, onOtherSubmit, styles, classNames, popoverProps, }) => {
982
- const { primaryColor } = useContext(LeadGenContext);
983
- const { classes, cx } = useStyles$3(undefined, {
984
- name: 'LeadGen__Field',
985
- styles,
986
- classNames,
987
- });
988
- const form = useLeadFormContext$1();
989
- return (React__default.createElement(React__default.Fragment, null, listBlockAdded.map((b, index) => {
990
- var _a;
991
- const { name = '', data = {} } = b || {};
992
- const { placeholder, value, align, listQuestion, isSendMailChimp = false, newtab, url, } = data;
993
- const required = (_a = data.required) !== null && _a !== void 0 ? _a : true;
994
- switch (name) {
995
- case 'TitleBlock':
996
- return (React__default.createElement(TitleBlock$1, { key: index, align: align }, value));
997
- case 'SubtitleBlock':
998
- return (React__default.createElement(SubtitleBlock$1, { key: index, align: align }, value));
999
- case 'TextBlock':
1000
- return (React__default.createElement(Input, Object.assign({ key: index, withAsterisk: required, spellCheck: false, type: "text", placeholder: placeholder, className: cx('leadgen-control', classes.control),
1001
- // onChangeRaw={(e) => inputOnChange('text', e)}
1002
- label: placeholder, "data-control": "text", "data-lead-control": name, "data-is-required": required, name: value }, form.getInputProps(value))));
1003
- case 'NumberBlock':
1004
- return (React__default.createElement(NumberInput, Object.assign({ key: index, withAsterisk: required, spellCheck: false, type: "number", placeholder: placeholder, className: cx('leadgen-control', classes.control),
1005
- // onChange={(e) => inputOnChange('number', e)}
1006
- label: placeholder, "data-control": "number", "data-lead-control": name, "data-is-required": required, name: value }, form.getInputProps(value))));
1007
- case 'EmailBlock':
1008
- return (React__default.createElement(Input, Object.assign({ key: index, withAsterisk: required, spellCheck: false,
1009
- // type="email"
1010
- placeholder: placeholder, className: cx('leadgen-control', classes.control), label: placeholder, "data-control": "email", "data-lead-control": name, "data-is-required": required, name: value }, form.getInputProps(value))));
1011
- case 'PhoneOtpBlock':
1012
- case 'WhatsappOtpBlock':
1013
- case 'ZaloOtpBlock':
1014
- case 'PhoneBlock': {
1015
- const id = popupId + '-' + value + '-' + index;
1016
- return (React__default.createElement(Input.Wrapper, Object.assign({ size: "md", withAsterisk: required, key: index, label: placeholder,
1017
- // error={errorField.phone}
1018
- className: cx('leadgen-control', classes.control), labelProps: {
1019
- htmlFor: id,
1020
- } }, form.getInputProps(value)),
1021
- React__default.createElement(Phone, { name: value, spellCheck: false, type: "tel", placeholder: placeholder, value: form.getInputProps(value).value, onChange: (v) => {
1022
- form.setFieldValue(value, v);
1023
- },
1024
- // onBlur={(e) => inputOnBlur('tel', e)}
1025
- id: id, defaultCountry: (locale ? MAPPED_LOCALE[locale] || 'VN' : 'VN'), "data-control": "tel", "data-lead-control": name, "data-is-required": required })));
1026
- }
1027
- case 'LocationBlock': {
1028
- return (React__default.createElement(LocationBlock, { key: index, name: value, placeholder: placeholder, locale: locale, required: required }));
1029
- }
1030
- case 'DateBlock':
1031
- return (React__default.createElement(React__default.Fragment, null,
1032
- React__default.createElement(DatePicker, Object.assign({ withAsterisk: required, key: index, type: "default", name: value, placeholder: placeholder, className: cx('leadgen-control', classes.control), label: placeholder, "data-control": "date", "data-lead-control": name, "data-is-required": required, popoverProps: popoverProps }, form.getInputProps(value))),
1033
- React__default.createElement("input", { type: "hidden", name: value, "data-control": "date" })));
1034
- case 'LinkButtonBlock':
1035
- return (React__default.createElement("div", { key: index },
1036
- React__default.createElement("a", { target: newtab ? 'blank' : 'parrent', href: url, style: { textDecoration: 'none' } },
1037
- React__default.createElement(Button, { type: "button", size: "md", color: primaryColor, className: `lead-modal__btn ${LEAD_CLASS}`, onClick: () => {
1038
- onClose === null || onClose === void 0 ? void 0 : onClose();
1039
- onOtherSubmit === null || onOtherSubmit === void 0 ? void 0 : onOtherSubmit();
1040
- } }, value))));
1041
- case 'CheckboxBlock':
1042
- return (React__default.createElement(React__default.Fragment, null,
1043
- isSendMailChimp && (React__default.createElement("div", { style: {
1044
- display: 'none',
1045
- }, "data-name": value + '-mailchimp' })),
1046
- React__default.createElement(Checkbox.Group, Object.assign({ withAsterisk: required, className: cx('leadgen-control', classes.control), key: index, label: placeholder, size: "md", sx: {
1047
- display: 'flex',
1048
- flexDirection: 'column',
1049
- gap: 8,
1050
- } }, form.getInputProps(value)), listQuestion.map((l, _index) => (React__default.createElement(Checkbox, { name: value, key: _index, value: l.value, label: l.placeholder, "data-control": "checkbox", "data-lead-control": name, "data-is-required": required }))))));
1051
- case 'RadioBlock':
1052
- return (React__default.createElement(React__default.Fragment, null,
1053
- isSendMailChimp && (React__default.createElement(Input, { type: "hidden", name: value + '-mailchimp', value: isSendMailChimp })),
1054
- React__default.createElement(Radio.Group, Object.assign({ withAsterisk: required, className: cx('leadgen-control', classes.control), key: index, label: placeholder, size: "md" }, form.getInputProps(value)), listQuestion.map((l, _index) => (React__default.createElement(Radio, { name: value, key: _index, value: l.value, label: l.placeholder, "data-control": "radio", "data-lead-control": name, "data-is-required": required }))))));
1055
- case 'DropdownBlock':
1056
- return (React__default.createElement(React__default.Fragment, null,
1057
- React__default.createElement("div", { style: { display: 'none' }, "data-extra": true, "data-name": value, "data-control": 'dropdown', "data-lead-control": name, "data-is-required": required }),
1058
- React__default.createElement(Select, Object.assign({ key: index, className: cx('leadgen-control', classes.control), label: placeholder, withAsterisk: required, name: value, data: listQuestion.map((l) => ({
1059
- value: l.value,
1060
- label: l.placeholder,
1061
- })) }, form.getInputProps(value)))));
1062
- case 'TncBlock':
1063
- const tncInputProps = form.getInputProps('TNC-' + b.id);
1064
- return (React__default.createElement(React__default.Fragment, null,
1065
- React__default.createElement(Checkbox, Object.assign({ name: 'TNC-' + b.id, key: b.id, label: React__default.createElement("p", { className: "lead-modal__tnc-link", dangerouslySetInnerHTML: { __html: data.valueHTML } }), className: "tnc-block", "data-control": "checkbox", "data-lead-control": name, "data-is-required": required }, tncInputProps, { error: tncInputProps.error ? tncInputProps.error : undefined }))));
1066
- }
1067
- return null;
1068
- })));
1069
- };
1070
-
1071
- var useStyles$2 = createStyles((theme) => {
1072
- return {
1073
- root: {},
1074
- header: {},
1075
- heading: {},
1076
- description: {},
1077
- term: {
1078
- a: {
1079
- color: theme.fn.primaryColor(),
1080
- },
1081
- },
1082
- controlList: {},
1083
- control: {},
1084
- submitBtn: {},
1085
- submitBtnWrapper: {},
1086
- };
1087
- });
1088
-
1089
- const Heading = (_a) => {
1090
- var rest = __rest(_a, []);
1091
- const { heading } = useContext(LeadGenComponentContext);
1092
- return heading ? (React__default.createElement(Text, Object.assign({ size: "h3" }, rest), heading)) : null;
1093
- };
1094
-
1095
- const FormComponent = ({ styles, className, classNames, fillInfo, popoverProps, submitProps, }) => {
1096
- var _a;
1097
- const { primaryColor } = useContext(LeadGenContext);
1098
- const { listBlockAdded, leadFormConfig: { form, validateObj }, validatingEmailRef, validatingPhoneRef,
1099
- // formRef,
1100
- setFormRef, onClose, onOtherSubmit, actionBlocks, locale, setShowOtpPhone, onSubmit, } = useContext(LeadGenComponentContext);
1101
- const { classes, cx } = useStyles$2(undefined, {
1102
- name: 'LeadGen__FormComponent',
1103
- styles,
1104
- classNames,
1105
- });
1106
- const [isSubmitLoading, setIsSubmitLoading] = useState(false);
1107
- const popUpSubmitText = actionBlocks.submitBlock.data.value;
1108
- const middlewareOnSubmit = (e) => {
1109
- e.preventDefault();
1110
- // mark all as touched to allow validation
1111
- form.setTouched(Object.keys(validateObj).reduce((acc, cur) => {
1112
- acc[cur] = true;
1113
- return acc;
1114
- }, {}));
1115
- if (validatingEmailRef.current || validatingPhoneRef.current) {
1116
- return;
1117
- }
1118
- setTimeout(() => {
1119
- form.onSubmit((v) => {
1120
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1121
- if (Object.keys(form.errors).length)
1122
- return;
1123
- let newShowOtpPhone = null;
1124
- if (listBlockAdded.findIndex((x) => x.name === 'PhoneOtpBlock') > -1) {
1125
- // not submit yet, open otp
1126
- const fieldName = (_b = (_a = listBlockAdded.find((x) => x.name === 'PhoneOtpBlock')) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.value;
1127
- if ((_c = v[fieldName]) === null || _c === void 0 ? void 0 : _c.startsWith('+')) {
1128
- newShowOtpPhone = {
1129
- phone: v[fieldName],
1130
- type: 'phone',
1131
- };
1132
- }
1133
- }
1134
- if (listBlockAdded.findIndex((x) => x.name === 'WhatsappOtpBlock') > -1) {
1135
- // not submit yet, open otp
1136
- const fieldName = (_e = (_d = listBlockAdded.find((x) => x.name === 'WhatsappOtpBlock')) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.value;
1137
- if ((_f = v[fieldName]) === null || _f === void 0 ? void 0 : _f.startsWith('+')) {
1138
- newShowOtpPhone = {
1139
- phone: v[fieldName],
1140
- type: 'whatsapp',
1141
- };
1142
- }
1143
- }
1144
- if (listBlockAdded.findIndex((x) => x.name === 'ZaloOtpBlock') > -1) {
1145
- // not submit yet, open otp
1146
- const fieldName = (_h = (_g = listBlockAdded.find((x) => x.name === 'ZaloOtpBlock')) === null || _g === void 0 ? void 0 : _g.data) === null || _h === void 0 ? void 0 : _h.value;
1147
- if ((_j = v[fieldName]) === null || _j === void 0 ? void 0 : _j.startsWith('+')) {
1148
- newShowOtpPhone = {
1149
- phone: v[fieldName],
1150
- type: 'zalo',
1151
- };
1152
- }
1153
- }
1154
- if (newShowOtpPhone) {
1155
- setIsSubmitLoading(true);
1156
- Service.sendSMSOtpLead(newShowOtpPhone)
1157
- .then((res) => {
1158
- var _a;
1159
- const respMessage = (_a = res === null || res === void 0 ? void 0 : res._messages) === null || _a === void 0 ? void 0 : _a[0];
1160
- if (respMessage === 'This phone number was verified') {
1161
- onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit();
1162
- return;
1163
- }
1164
- setShowOtpPhone(newShowOtpPhone);
1165
- })
1166
- .finally(() => {
1167
- setIsSubmitLoading(false);
1168
- });
1169
- return;
1170
- }
1171
- onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit();
1172
- })(e);
1173
- }, 100);
1174
- };
1175
- useEffect(() => {
1176
- form === null || form === void 0 ? void 0 : form.setValues(fillInfo);
1177
- }, [fillInfo]);
1178
- return (React__default.createElement(LeadFormProvider$1, { form: form },
1179
- React__default.createElement(Box, { component: "form", ref: (el) => el && setFormRef(el), className: cx(className, classes.root), onSubmit: middlewareOnSubmit, styles: styles },
1180
- React__default.createElement("div", { className: classes.header },
1181
- React__default.createElement(Heading, { className: classes.heading }),
1182
- React__default.createElement(Description, { className: classes.description })),
1183
- React__default.createElement("div", { className: classes.controlList },
1184
- React__default.createElement(Fields, { classNames: {
1185
- control: classes.control,
1186
- }, listBlockAdded: listBlockAdded, locale: locale, onClose: onClose, onOtherSubmit: onOtherSubmit, popoverProps: popoverProps })),
1187
- ((_a = actionBlocks === null || actionBlocks === void 0 ? void 0 : actionBlocks.submitBlock) === null || _a === void 0 ? void 0 : _a.isHide) ? null : (React__default.createElement("div", { className: classes.submitBtnWrapper },
1188
- React__default.createElement(Button, Object.assign({ size: "md", id: "lead-submit", type: "submit", className: classes.submitBtn, loading: isSubmitLoading, color: primaryColor }, submitProps), popUpSubmitText))))));
1189
- };
1190
- const Form = (props) => {
1191
- const { showOtpPhone, showThankyou } = useContext(LeadGenComponentContext);
1192
- return showThankyou || showOtpPhone ? null : React__default.createElement(FormComponent, Object.assign({}, props));
1193
- };
1194
-
1195
- var useStyles$1 = createStyles(() => {
1196
- return {
1197
- root: {},
1198
- header: {},
1199
- heading: {},
1200
- description: {},
1201
- control: {},
1202
- actions: {},
1203
- submitBtn: {},
1204
- resendOtp: {},
1205
- };
1206
- });
1207
-
1208
- const OtpBlockComponent = ({ otpData, onSuccess, autoSendWhenOpen, className, styles, classNames, }) => {
1209
- const { t } = useLeadGenTranslations();
1210
- const phone = otpData.phone;
1211
- const otpType = otpData.type;
1212
- const [otp, setOtp] = useState('');
1213
- const [isDirty, setIsDirty] = useState(false);
1214
- const [resendTimer, setResendTimer] = useState(autoSendWhenOpen ? 0 : 60);
1215
- const inputRef = useRef(null);
1216
- const [errorMsg, setErrorMsg] = useState();
1217
- const [displayPhone, setDisplayPhone] = useState('');
1218
- const formatPhoneNumberIntlRef = useRef();
1219
- const [isSubmitLoading, setIsSubmitLoading] = useState(false);
1220
- const { classes, cx } = useStyles$1(undefined, {
1221
- name: 'LeadGen__OTP',
1222
- styles,
1223
- classNames,
1224
- });
1225
- useEffect(() => {
1226
- (() => __awaiter(void 0, void 0, void 0, function* () {
1227
- var _a;
1228
- if (!formatPhoneNumberIntlRef.current) {
1229
- const res = yield import('react-phone-number-input');
1230
- formatPhoneNumberIntlRef.current = res.formatPhoneNumberIntl;
1231
- }
1232
- setDisplayPhone(((_a = formatPhoneNumberIntlRef.current) === null || _a === void 0 ? void 0 : _a.call(formatPhoneNumberIntlRef, phone)) || phone);
1233
- }))();
1234
- }, [phone]);
1235
- const sendOtp = () => __awaiter(void 0, void 0, void 0, function* () {
1236
- var _a;
1237
- if (!phone) {
1238
- return;
1239
- }
1240
- const res = yield Service.sendSMSOtpLead({
1241
- phone,
1242
- type: otpType,
1243
- });
1244
- const respMessage = (_a = res === null || res === void 0 ? void 0 : res._messages) === null || _a === void 0 ? void 0 : _a[0];
1245
- if (respMessage === 'Send sms successfully' ||
1246
- respMessage === 'Send WhatsApp successfully' ||
1247
- respMessage === 'Send Zalo successfully') {
1248
- setResendTimer(60);
1249
- setTimeout(() => {
1250
- if (inputRef.current) {
1251
- inputRef.current.focus();
1252
- inputRef.current.scrollIntoView({ block: 'center' });
1253
- }
1254
- }, 100);
1255
- }
1256
- else if (respMessage === 'This phone number was verified') {
1257
- onSuccess();
1258
- }
1259
- else {
1260
- setErrorMsg(respMessage || 'Something went wrong!');
1261
- // const defaultError = f({ id: 'notification.comment.somethingWrong' })
1262
- // setStatusVerifyOTP('idle')
1263
- // pushNotifications({
1264
- // title: respMessage || defaultError,
1265
- // message: '',
1266
- // type: 'danger',
1267
- // })
1268
- }
1269
- });
1270
- const submitOtp = () => __awaiter(void 0, void 0, void 0, function* () {
1271
- if (!phone || !otp) {
1272
- return;
1273
- }
1274
- setIsSubmitLoading(true);
1275
- const res = yield Service.verifyOtpLead({
1276
- phone,
1277
- otp,
1278
- type: otpType,
1279
- });
1280
- const respMessage = res === null || res === void 0 ? void 0 : res._messages[0];
1281
- if (respMessage === 'Verify successfully' ||
1282
- respMessage === 'Verify WhatsApp OTP sucess' ||
1283
- respMessage === 'Verify Zalo OTP sucess') {
1284
- onSuccess();
1285
- }
1286
- else if (respMessage === 'This phone number was verified') {
1287
- onSuccess();
1288
- }
1289
- else {
1290
- setErrorMsg(respMessage || 'something Wrong');
1291
- // setIsShowError(true)
1292
- // setStatusVerifyOTP('sent')
1293
- // pushNotifications({
1294
- // title: res?._messages[0] || defaultError,
1295
- // message: '',
1296
- // type: 'danger',
1297
- // })
1298
- }
1299
- setIsSubmitLoading(false);
1300
- });
1301
- useEffect(() => {
1302
- setTimeout(() => {
1303
- if (resendTimer > 0) {
1304
- setResendTimer((r) => r - 1);
1305
- }
1306
- }, 1000);
1307
- }, [resendTimer]);
1308
- useEffect(() => {
1309
- if (autoSendWhenOpen && !resendTimer) {
1310
- sendOtp();
1311
- }
1312
- }, []);
1313
- return (React__default.createElement(React__default.Fragment, null,
1314
- React__default.createElement(Box, { component: "form", onSubmit: (e) => {
1315
- e.preventDefault();
1316
- submitOtp();
1317
- }, className: cx(classes.root, className) },
1318
- React__default.createElement("div", { className: classes.header },
1319
- React__default.createElement(Heading$1, { tag: "h3", className: classes.heading }, t('lead.otp.title')),
1320
- React__default.createElement(Text, { size: "p3", className: classes.description }, t('lead.otp.desc', { phone: displayPhone }))),
1321
- React__default.createElement(Input, { ref: inputRef, name: '_' + name + '-otp', spellCheck: false, type: "number", placeholder: t('lead.otp.phonePlaceholder'), className: classes.control, label: t('lead.otp.phoneLabel'), "data-control": "otp", withAsterisk: true, pattern: "[0-9]*", value: otp, maxLength: 6, onChange: (v) => {
1322
- setIsDirty(true);
1323
- setOtp(v);
1324
- if (isDirty && !v)
1325
- setErrorMsg('OTP is required');
1326
- else
1327
- setErrorMsg(undefined);
1328
- }, error: isDirty ? errorMsg : undefined }),
1329
- React__default.createElement("div", { className: classes.actions },
1330
- React__default.createElement(Button, { type: "submit", size: "md", color: "primary", className: classes.submitBtn,
1331
- // onClick={() => submitOtp()}
1332
- disabled: !otp, loading: isSubmitLoading }, t('lead.otp.verify')),
1333
- React__default.createElement(Button, { type: "button", size: "md", color: "transparent", className: classes.resendOtp, onClick: () => {
1334
- sendOtp();
1335
- }, disabled: !!resendTimer }, t('lead.otp.resend', {
1336
- timer: resendTimer ? ` (${resendTimer}s)` : '',
1337
- }))))));
1338
- };
1339
- const OtpBlock$1 = (_a) => {
1340
- var rest = __rest(_a, []);
1341
- const { showOtpPhone, setShowOtpPhone, onSubmit,
1342
- // formRef,
1343
- // leadFormConfig: { form },
1344
- } = useContext(LeadGenComponentContext);
1345
- return showOtpPhone ? (React__default.createElement(OtpBlockComponent, Object.assign({ otpData: showOtpPhone, autoSendWhenOpen: false, onSuccess: () => {
1346
- setShowOtpPhone(null);
1347
- onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit();
1348
- } }, rest))) : null;
1349
- };
1350
-
1351
- const Thankyou = ({ children, }) => {
1352
- const { showThankyou, setShowThankyou } = useContext(LeadGenComponentContext);
1353
- return showThankyou
1354
- ? children(showThankyou, () => setShowThankyou(null))
1355
- : null;
1356
- };
1357
-
1358
- // import mockLeadData from './mockLeadData'
1359
- const listCampaignScheduled = [];
1360
- const listCampaignScheduledToActivated = [];
1361
- const listCampaignActiveButExpired = [];
1362
- const listCampaignExcludeSonsored = [];
1363
- const listCampaignDifferentSponsor = [];
1364
- const listCampaignNotDisplayInRangeOfTime = [];
1365
- function isMobile() {
1366
- return /Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|Opera Mini/i.test(navigator.userAgent);
1367
- }
1368
- const getShuffleArray = (array) => {
1369
- const newArray = [...array];
1370
- for (let i = newArray.length - 1; i > 0; i--) {
1371
- const j = Math.floor(Math.random() * (i + 1));
1372
- const temp = newArray[i];
1373
- newArray[i] = newArray[j];
1374
- newArray[j] = temp;
1375
- }
1376
- return newArray;
1377
- };
1378
- const getTimeByTimezone = (timeZone = 'UTC') => {
1379
- const date = new Date();
1380
- return new Date(date.toLocaleString('en-US', { timeZone }));
1381
- };
1382
- const parseDateByCampaignTime = (dateStr) => {
1383
- // Format like this: 2023-04-04 00:00:00
1384
- try {
1385
- const [datePart, timePart] = dateStr.split(' ');
1386
- const [year, month, day] = datePart.split('-').map(Number);
1387
- const [hours, minutes, seconds] = timePart.split(':').map(Number);
1388
- /** JavaScript counts months from 0 to 11 */
1389
- return new Date(year, month - 1, day, hours, minutes, seconds);
1390
- }
1391
- catch (err) {
1392
- return null;
1393
- }
1394
- };
1395
- const checkCampaignNowInTimeframe = (c) => {
1396
- var _a;
1397
- const siteId = ((_a = c.site) === null || _a === void 0 ? void 0 : _a.id) || 1;
1398
- const startedAtStr = c.started_at;
1399
- const endedAtStr = c.ended_at;
1400
- const startedDate = parseDateByCampaignTime(startedAtStr);
1401
- const endedDate = parseDateByCampaignTime(endedAtStr);
1402
- if (!startedDate || !endedDate) {
1403
- return false;
1404
- }
1405
- const timeZone = LEAD_TIMEZONE_DATA[siteId];
1406
- const nowWithTimezoneMs = getTimeByTimezone(timeZone).getTime();
1407
- if (nowWithTimezoneMs <= endedDate.getTime() &&
1408
- nowWithTimezoneMs >= startedDate.getTime()) {
1409
- listCampaignScheduledToActivated.push(c);
1410
- return true;
1411
- }
1412
- return false;
1413
- };
1414
- function checkCampaignActiveButExpireAlready(c) {
1415
- var _a;
1416
- /** Do not setup timeframe for this campaign. No need to check */
1417
- if (c.forever === 1) {
1418
- return true;
1419
- }
1420
- const startedAtStr = c.started_at;
1421
- const endedAtStr = c.ended_at;
1422
- const startedDate = parseDateByCampaignTime(startedAtStr);
1423
- const endedDate = parseDateByCampaignTime(endedAtStr);
1424
- /** Do not setup timeframe for this campaign. No need to check */
1425
- if (!startedDate || !endedDate) {
1426
- return true;
1427
- }
1428
- const siteId = ((_a = c.site) === null || _a === void 0 ? void 0 : _a.id) || 1;
1429
- const timeZone = LEAD_TIMEZONE_DATA[siteId];
1430
- const nowWithTimezoneMs = getTimeByTimezone(timeZone).getTime();
1431
- /** Check if this expire already, do not show */
1432
- if (nowWithTimezoneMs > endedDate.getTime()) {
1433
- listCampaignActiveButExpired.push(c);
1434
- return false;
1435
- }
1436
- return true;
1437
- }
1438
- function shouldNotDisplayIfExcludeAllSponsors(c) {
1439
- var _a;
1440
- const excludeSponsored = Number((_a = c.rules.find((i) => i.rule == 'exclude_sponsored')) === null || _a === void 0 ? void 0 : _a.value);
1441
- const isSponsored = Boolean(document.querySelector('.hhg-disclaimer-text'));
1442
- if (isSponsored && excludeSponsored) {
1443
- listCampaignExcludeSonsored.push(c);
1444
- return true;
1445
- }
1446
- return false;
1447
- }
1448
- function shouldDisplayWithCurrentSponsor(c) {
1449
- var _a, _b;
1450
- try {
1451
- // TODO: BE will rename `exclude_sponsored_list` later
1452
- const stringOrArray = (_a = c.rules.find((i) => i.rule == 'exclude_sponsored_list')) === null || _a === void 0 ? void 0 : _a.value;
1453
- const whiteListSponsors = stringOrArray instanceof Array ? stringOrArray : JSON.parse(stringOrArray);
1454
- const dataSponsoredId = Number((_b = document
1455
- .querySelector('[data-sponsored-id]')) === null || _b === void 0 ? void 0 : _b.getAttribute('data-sponsored-id'));
1456
- // There is no config for sponsor id and white list, should show as default
1457
- if (!dataSponsoredId ||
1458
- dataSponsoredId <= 0 ||
1459
- whiteListSponsors.length === 0) {
1460
- return true;
1461
- }
1462
- // Check the dataSponsoredId exists in the white list or not.
1463
- const isExist = whiteListSponsors.find((s) => s.id == dataSponsoredId);
1464
- if (isExist) {
1465
- return true;
1466
- }
1467
- listCampaignDifferentSponsor.push({ id: c.id, rules: c.rules });
1468
- return false;
1469
- }
1470
- catch (err) {
1471
- // Default is show
1472
- return true;
1473
- }
1474
- }
1475
- const filterFnCampaign = (c) => {
1476
- if (shouldNotDisplayIfExcludeAllSponsors(c)) {
1477
- return false;
1478
- }
1479
- else if (!shouldDisplayWithCurrentSponsor(c)) {
1480
- return false;
1481
- }
1482
- /** Active */
1483
- if (c.formatted_status === 1) {
1484
- return checkCampaignActiveButExpireAlready(c);
1485
- }
1486
- /** Schedule */
1487
- if (c.formatted_status === 0) {
1488
- listCampaignScheduled.push(c);
1489
- return checkCampaignNowInTimeframe(c);
1490
- }
1491
- return false;
1492
- };
1493
- const fillterApprearanceTimeCampaign = (c) => {
1494
- var _a;
1495
- try {
1496
- const isTimeInRange = (currentTime, startTime, endTime) => {
1497
- const startParts = startTime.split(':');
1498
- const endParts = endTime.split(':');
1499
- const startDate = new Date();
1500
- startDate.setHours(Number(startParts[0]), Number(startParts[1]), 0, 0);
1501
- const endDate = new Date();
1502
- endDate.setHours(Number(endParts[0]), Number(endParts[1]), 0, 0);
1503
- return currentTime >= startDate && currentTime <= endDate;
1504
- };
1505
- const rulesApprValue = (_a = c.rules.find((i) => i.rule == 'appearance_time')) === null || _a === void 0 ? void 0 : _a.value;
1506
- const startTime = rulesApprValue.startTime;
1507
- const endTime = rulesApprValue.endTime || '23:59';
1508
- if (!startTime) {
1509
- return true;
1510
- }
1511
- if (isTimeInRange(new Date(), startTime, endTime)) {
1512
- return true;
1513
- }
1514
- listCampaignNotDisplayInRangeOfTime.push(c);
1515
- return false;
1516
- }
1517
- catch (err) {
1518
- return true;
1519
- }
1520
- };
1521
- let timeoutRef = null;
1522
- let LEAD_SCROLL_EVENT = null;
1523
- function clearPassiveEvent() {
1524
- if (timeoutRef) {
1525
- clearTimeout(timeoutRef);
1526
- timeoutRef = null;
1527
- }
1528
- if (LEAD_SCROLL_EVENT) {
1529
- window.removeEventListener('scroll', LEAD_SCROLL_EVENT);
1530
- LEAD_SCROLL_EVENT = null;
1531
- }
1532
- }
1533
- function checkShowPopup({ leadApi, leadSiteId, leadDomain, onShowPopup, DEBUG_URL, }) {
1534
- // clear previous passive event, check for new condition
1535
- clearPassiveEvent();
1536
- const leadCurrentUrl = DEBUG_URL ||
1537
- ('https://' +
1538
- location.hostname +
1539
- location.pathname +
1540
- location.search).toLowerCase();
1541
- fetch(leadApi + 'api/campaign/' + leadSiteId, {
1542
- method: 'POST',
1543
- headers: {
1544
- 'Content-Type': 'application/json',
1545
- },
1546
- body: JSON.stringify({
1547
- url: leadCurrentUrl,
1548
- ga_client_id: getCookie('_ga') || null,
1549
- }),
1550
- })
1551
- .then((response) => {
1552
- return response.json();
1553
- // return mockLeadData || response.json()
1554
- })
1555
- .then((data) => {
1556
- var _a, _b, _c, _d;
1557
- LeadLog('List campagin: ', data);
1558
- LEAD_RESET_VAR();
1559
- if (data._status == 1) {
1560
- 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);
1561
- if (!getCookie('hhg-id')) {
1562
- setCookie('hhg-id', v1(), {
1563
- domain: '.' + leadDomain,
1564
- path: '/',
1565
- });
1566
- LeadLog('😍 Set HHG ID cookie');
1567
- }
1568
- // getCookie('hhg-id')
1569
- // TODO: HP-534 Filter desktop
1570
- let campaignsDevice = [];
1571
- if (isMobile()) {
1572
- campaignsDevice = campaigns.filter((c) => c.device_types.some((d) => d.id == LEAD_DEVICE_TYPE.MOBILE));
1573
- }
1574
- else {
1575
- campaignsDevice = campaigns.filter((c) => c.device_types.some((d) => d.id == LEAD_DEVICE_TYPE.DESKTOP));
1576
- }
1577
- LeadLog(`👓 campaignsDevice`, campaignsDevice);
1578
- LeadLog('--listCampaignScheduled', listCampaignScheduled);
1579
- LeadLog('--listCampaignScheduledToActivated', listCampaignScheduledToActivated);
1580
- LeadLog('--listCampaignActiveButExpired', listCampaignActiveButExpired);
1581
- LeadLog('--listCampaignExcludeSonsored', listCampaignExcludeSonsored);
1582
- LeadLog('--listCampaignDifferentSponsor', listCampaignDifferentSponsor);
1583
- LeadLog('--listCampaignNotDisplayInRangeOfTime', listCampaignNotDisplayInRangeOfTime);
1584
- // Check links
1585
- let listLinksObj = campaignsDevice
1586
- .map((i, index) => i.targets
1587
- .filter((i) => i.type == CAMPAIGN_TARGET_TYPE.LINKS)
1588
- .map((i) => (Object.assign(Object.assign({}, i), { campaignIndex: index }))))
1589
- .flat(1);
1590
- // Check list link match current href
1591
- listLinksObj = listLinksObj.filter((i) => {
1592
- var _a;
1593
- const target = new URL(String(i.target).toLowerCase());
1594
- if (i.option == 'exact_match')
1595
- // FOR TEST LOCAL:
1596
- // return Boolean(location.pathname === target.pathname)
1597
- return Boolean(leadCurrentUrl === ((_a = target.href) === null || _a === void 0 ? void 0 : _a.toLowerCase()));
1598
- if (i.option == 'start_with') {
1599
- // FOR TEST LOCAL:
1600
- // if (location.pathname.includes(target.pathname)) {
1601
- if (leadCurrentUrl.includes(String(i.target).toLowerCase())) {
1602
- const listExcluding = i.sub_target
1603
- .filter((i) => i.option == 'excluding')
1604
- .map((i) => { var _a; return (_a = i.value) === null || _a === void 0 ? void 0 : _a.toLowerCase(); });
1605
- return !listExcluding.includes(leadCurrentUrl.split('?')[0]);
1606
- }
1607
- else {
1608
- return false;
1609
- }
1610
- }
1611
- });
1612
- // Check tags
1613
- const listMetaTag = Array.from(document.getElementsByTagName('META')).filter((i) => i.getAttribute('property') == 'article:tag');
1614
- const listTags = listMetaTag.map((i) => i.content);
1615
- let listCampaignHasTag = [];
1616
- let listTagsObj = [];
1617
- if (listTags && listTags.length) {
1618
- listCampaignHasTag = campaignsDevice
1619
- .map((i, index) => i.targets
1620
- .filter((i) => i.type == CAMPAIGN_TARGET_TYPE.TAGS)
1621
- .map((i) => (Object.assign(Object.assign({}, i), { campaignIndex: index }))))
1622
- .flat(1);
1623
- listTagsObj = listCampaignHasTag.filter((i) => listTags.includes(i.target));
1624
- }
1625
- const listCampaginsMatch = [...listLinksObj, ...listTagsObj];
1626
- const cookieKeys = document.cookie
1627
- .split('; ')
1628
- .map((i) => i.split('=')[0]);
1629
- const listCampaignCodeSubmited = cookieKeys.filter((i) => i.includes('lead_submited'));
1630
- LeadLog(`--listCampaignCodeSubmited`, listCampaignCodeSubmited);
1631
- const listCampaignCodeClosed = cookieKeys.filter((i) => i.includes('lead_closed'));
1632
- LeadLog(`--listCampaignCodeClosed`, listCampaignCodeClosed);
1633
- const listCampaignSubmitedClosed = [
1634
- ...listCampaignCodeSubmited,
1635
- ...listCampaignCodeClosed,
1636
- ];
1637
- const listCampaignNoSubmitedClosed = listCampaginsMatch.filter((i) => {
1638
- const hasSubmited = listCampaignSubmitedClosed.some((k) => k.includes(campaignsDevice[i.campaignIndex].code));
1639
- return !hasSubmited;
1640
- });
1641
- const listCampaignValid = getShuffleArray(listCampaignNoSubmitedClosed);
1642
- // .sort(
1643
- // (a, b) =>
1644
- // (listCampaignValid[a.campaignIndex]?.score || 0) -
1645
- // (listCampaignValid[b.campaignIndex]?.score || 0),
1646
- // )
1647
- LeadLog('--listCampaignValid : ', listCampaignValid);
1648
- if (listCampaignValid && listCampaignValid.length) {
1649
- const CAMPAIGN_SHOW = campaignsDevice[listCampaignValid[0].campaignIndex];
1650
- LeadLog(`CAMPAIGN_SHOW`, CAMPAIGN_SHOW);
1651
- const { rules } = CAMPAIGN_SHOW;
1652
- // CHECK RULE TRIGGER POPUP
1653
- const timeoutRule = Number((_c = rules.find((i) => i.rule == 'time')) === null || _c === void 0 ? void 0 : _c.value);
1654
- LeadLog(`timeoutRule`, timeoutRule);
1655
- const scrollRule = Number((_d = rules.find((i) => i.rule == 'scroll')) === null || _d === void 0 ? void 0 : _d.value);
1656
- LeadLog(`scrollRule`, scrollRule);
1657
- let impressionAction = 'TIME';
1658
- if (Number.isInteger(timeoutRule)) {
1659
- impressionAction = 'TIME';
1660
- LeadLog('✨ SHOW AWESOME POPUP AFTER: ', timeoutRule, ' seconds');
1661
- timeoutRef = setTimeout(() => {
1662
- onShowPopup === null || onShowPopup === void 0 ? void 0 : onShowPopup(CAMPAIGN_SHOW, impressionAction);
1663
- }, timeoutRule * 1000);
1664
- }
1665
- if (Number.isInteger(scrollRule)) {
1666
- impressionAction = 'SCROLL';
1667
- LeadLog('✨ SHOW AWESOME AFTER: SCROLL', scrollRule, ' %');
1668
- const $p = document.querySelector(`[data-url="${location.pathname}"]`) ||
1669
- document.querySelector('body');
1670
- const pct = $p.getBoundingClientRect().top;
1671
- const pb = $p.offsetHeight;
1672
- LeadLog(`👓 Element check scroll: `, $p);
1673
- LEAD_SCROLL_EVENT = function leadScollCheckHandler() {
1674
- const wt = window.pageYOffset || document.documentElement.scrollTop;
1675
- let percent = 0;
1676
- if (wt >= pct) {
1677
- percent = Math.round(((wt - pct) / (pb - innerHeight)) * 100);
1678
- }
1679
- LeadLog('---Scroll', percent, scrollRule);
1680
- // TODO: CHECK FOOTER HEIGHT
1681
- if (percent >= scrollRule) {
1682
- window.removeEventListener('scroll', LEAD_SCROLL_EVENT);
1683
- onShowPopup === null || onShowPopup === void 0 ? void 0 : onShowPopup(CAMPAIGN_SHOW, impressionAction);
1684
- }
1685
- };
1686
- window.addEventListener('scroll', LEAD_SCROLL_EVENT, {
1687
- passive: true,
1688
- });
1689
- }
1690
- }
1691
- else {
1692
- LeadLog('🚧 No lead campaigns on current URL, tags');
1693
- }
1694
- }
1695
- })
1696
- .catch((err) => {
1697
- LeadLog(`Lead error: `, err);
1698
- });
1699
- }
1700
- const LeadLog = (...params) => {
1701
- if (process.env.NODE_ENV !== 'production' ||
1702
- (process.env.NEXT_PUBLIC_DEPLOY_ENV &&
1703
- process.env.NEXT_PUBLIC_DEPLOY_ENV !== 'production') ||
1704
- (typeof localStorage !== 'undefined' &&
1705
- localStorage.getItem('hhg_debug') === 'true')) {
1706
- console.log(...params);
1707
- }
1708
- };
1709
-
1710
- const ImpressionTrackingWrapper = ({ children, stayDuration = 3, onImpression, dependency = '', }) => {
1711
- var _a;
1712
- const boxRef = useRef(null);
1713
- const [percent, setPercent] = useState(100);
1714
- const { ref, entry } = useIntersection({
1715
- threshold: percent / 100,
1716
- });
1717
- const [tracked, setTracked] = useState(false);
1718
- useEffect(() => {
1719
- let timer = null;
1720
- let count = 1;
1721
- if ((entry === null || entry === void 0 ? void 0 : entry.isIntersecting) && !tracked) {
1722
- timer = setInterval(() => {
1723
- console.log('Impression count: ', count);
1724
- if (count >= stayDuration) {
1725
- setTracked(true);
1726
- }
1727
- else {
1728
- count += 1;
1729
- }
1730
- }, 1000);
1731
- }
1732
- return () => clearInterval(timer);
1733
- }, [entry === null || entry === void 0 ? void 0 : entry.isIntersecting, tracked]);
1734
- useEffect(() => {
1735
- if (tracked) {
1736
- console.log('Impression call API');
1737
- onImpression();
1738
- }
1739
- }, [tracked]);
1740
- useEffect(() => {
1741
- setTracked(false);
1742
- }, [dependency]);
1743
- useEffect(() => {
1744
- if (boxRef.current.clientHeight > window.innerHeight * 0.8) {
1745
- setPercent(50);
1746
- }
1747
- }, [(_a = boxRef.current) === null || _a === void 0 ? void 0 : _a.clientHeight]);
1748
- return (React__default.createElement(Box, { "data-impression": true, ref: ref },
1749
- React__default.createElement("div", { ref: boxRef }, children)));
1750
- };
1751
-
1752
- // eslint-disable-next-line @typescript-eslint/no-var-requires
1753
- const customParseFormat = require('dayjs/plugin/customParseFormat');
1754
- dayjs.extend(customParseFormat);
1755
- /** https://hhgdev.atlassian.net/browse/EL-565 */
1756
- // const LEADGEN_MAP_VALIDATE = {
1757
- // name: 'leadgen.message.error.name_required',
1758
- // }
1759
- // You can give context variables any name
1760
- const [LeadFormProvider, useLeadFormContext, useLeadForm] = createFormContext();
1761
- const useLeadFormConfig = ({ listBlockAdded = [], validatingPhoneRef, validatingEmailRef, campaignId, campaign_subot_id = [], userInfo, format, }) => {
1762
- var _a;
1763
- const { t } = useLeadGenTranslations();
1764
- const initialValues = useMemo(() => formatLeadGenFormValue(mappingSSOToLead(userInfo), listBlockAdded), [userInfo === null || userInfo === void 0 ? void 0 : userInfo.id]);
1765
- const LEAD_LOCALE = LEAD_LOCALE_DATA$1[(_a = document === null || document === void 0 ? void 0 : document.documentElement) === null || _a === void 0 ? void 0 : _a.lang] ||
1766
- LEAD_LOCALE_DATA$1['vi-VN'];
1767
- const validateObj = useMemo(() => {
1768
- const InputBlocks = [
1769
- 'TextBlock',
1770
- 'NumberBlock',
1771
- 'EmailBlock',
1772
- 'PhoneBlock',
1773
- 'DateBlock',
1774
- 'CheckboxBlock',
1775
- 'RadioBlock',
1776
- 'DropdownBlock',
1777
- 'PhoneOtpBlock',
1778
- 'WhatsappOtpBlock',
1779
- 'ZaloOtpBlock',
1780
- 'LocationBlock',
1781
- 'TncBlock',
1782
- ];
1783
- // ALL are required and can skip if not touched yet
1784
- const withSharedCheck = (name, cb,
1785
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1786
- block) => {
1787
- return (value) => {
1788
- var _a, _b;
1789
- const isBLockRequired = (_a = block === null || block === void 0 ? void 0 : block.data) === null || _a === void 0 ? void 0 : _a.required;
1790
- if (!formRef.current.isTouched(name))
1791
- return;
1792
- if ((typeof value === 'string' && value.trim() === '') ||
1793
- typeof value === 'undefined' ||
1794
- (Array.isArray(value) && value.length === 0)) {
1795
- return isBLockRequired
1796
- ? ((_b = block === null || block === void 0 ? void 0 : block.data) === null || _b === void 0 ? void 0 : _b.requiredMessage) || t('validator.required')
1797
- : cb === null || cb === void 0 ? void 0 : cb(value);
1798
- }
1799
- return cb === null || cb === void 0 ? void 0 : cb(value);
1800
- };
1801
- };
1802
- return listBlockAdded
1803
- .filter((b) => InputBlocks.includes(b.name))
1804
- .reduce((r, b) => {
1805
- const { name: fieldType, data } = b || {};
1806
- const { value: fieldName, required } = data || {};
1807
- const isRequired = required !== null && required !== void 0 ? required : true;
1808
- if (fieldType === 'NumberBlock') {
1809
- return Object.assign(Object.assign({}, r), { [fieldName]: withSharedCheck(fieldName, (value) => {
1810
- if (value && isNaN(Number(value))) {
1811
- return t('validator.number');
1812
- }
1813
- }, b) });
1814
- }
1815
- else if (fieldType === 'EmailBlock') {
1816
- return Object.assign(Object.assign({}, r), { [fieldName]: withSharedCheck(fieldName, (value) => {
1817
- if (value && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) {
1818
- return t('validator.email');
1819
- }
1820
- if (!value)
1821
- return;
1822
- validatingEmailRef.current = true;
1823
- setTimeout(() => {
1824
- formRef.current.setFieldError(fieldName, 'Validating...');
1825
- checkUsedEmailOrPhoneWithCache(campaignId, campaign_subot_id, {
1826
- email: value,
1827
- })
1828
- .then((tKey) => {
1829
- if (tKey) {
1830
- formRef.current.setFieldError(fieldName, t(tKey));
1831
- }
1832
- else {
1833
- formRef.current.clearFieldError(fieldName);
1834
- }
1835
- validatingEmailRef.current = false;
1836
- })
1837
- .catch((e) => {
1838
- console.error(e);
1839
- formRef.current.setFieldError(fieldName, e.message || 'Something went wrong');
1840
- validatingEmailRef.current = false;
1841
- });
1842
- }, 200);
1843
- }, b) });
1844
- }
1845
- else if (fieldType === 'PhoneBlock' ||
1846
- fieldType === 'PhoneOtpBlock' ||
1847
- fieldType === 'ZaloOtpBlock' ||
1848
- fieldType === 'WhatsappOtpBlock') {
1849
- return Object.assign(Object.assign({}, r), { [fieldName]: withSharedCheck(fieldName, (value) => {
1850
- if (value &&
1851
- window.intlTelInputUtils &&
1852
- !window.intlTelInputUtils.isValidNumber(String(value), LEAD_LOCALE.countryCode)) {
1853
- return t('validator.phone');
1854
- }
1855
- if (!value)
1856
- return;
1857
- validatingPhoneRef.current = true;
1858
- setTimeout(() => {
1859
- formRef.current.setFieldError(fieldName, 'Validating...');
1860
- if (b.data.singleSubmission) {
1861
- checkUsedPhoneOnlyWithCache(campaignId, value)
1862
- .then((tKey) => {
1863
- if (tKey) {
1864
- formRef.current.setFieldError(fieldName, t(tKey));
1865
- }
1866
- else {
1867
- formRef.current.clearFieldError(fieldName);
1868
- }
1869
- validatingPhoneRef.current = false;
1870
- })
1871
- .catch((err) => {
1872
- console.error(err);
1873
- formRef.current.setFieldError(fieldName, err.message || 'Something went wrong');
1874
- validatingPhoneRef.current = false;
1875
- });
1876
- }
1877
- else {
1878
- checkUsedEmailOrPhoneWithCache(campaignId, campaign_subot_id, {
1879
- phone: value,
1880
- })
1881
- .then((tKey) => {
1882
- if (tKey) {
1883
- formRef.current.setFieldError(fieldName, t(tKey));
1884
- }
1885
- else {
1886
- formRef.current.clearFieldError(fieldName);
1887
- }
1888
- validatingPhoneRef.current = false;
1889
- })
1890
- .catch((e) => {
1891
- console.error(e);
1892
- formRef.current.setFieldError(fieldName, e.message || 'Something went wrong');
1893
- validatingPhoneRef.current = false;
1894
- });
1895
- }
1896
- }, 200);
1897
- }, b) });
1898
- }
1899
- else if (fieldType === 'DateBlock') {
1900
- return Object.assign(Object.assign({}, r), { [fieldName]: withSharedCheck(fieldName, (value) => {
1901
- if (!isRequired && !value) {
1902
- return;
1903
- }
1904
- const errMsg = t('validator.dateInvalid');
1905
- const dayInJS = typeof value === 'string'
1906
- ? dayjs(value, format, true)
1907
- : dayjs(value);
1908
- if (!dayInJS.isValid()) {
1909
- return errMsg;
1910
- }
1911
- }, b) });
1912
- }
1913
- else if (fieldType === 'TncBlock') {
1914
- return Object.assign(Object.assign({}, r), { [`TNC-` + b.id]: withSharedCheck('TNC-' + b.id, (value) => {
1915
- if (isRequired && !value) {
1916
- return t('validator.required');
1917
- }
1918
- }, b) });
1919
- }
1920
- else {
1921
- return Object.assign(Object.assign({}, r), { [fieldName]: withSharedCheck(fieldName, undefined, b) });
1922
- }
1923
- }, {});
1924
- }, [listBlockAdded.map((b) => b.name).join(','), format]);
1925
- const form = useLeadForm({
1926
- validateInputOnChange: false,
1927
- validateInputOnBlur: true,
1928
- clearInputErrorOnChange: true,
1929
- validate: validateObj,
1930
- initialValues,
1931
- });
1932
- const formRef = useRef(form);
1933
- formRef.current = form;
1934
- return { form, validateObj };
1935
- };
1936
-
1937
- const NoData = ({ className, style }) => {
1938
- return (React__default.createElement("svg", { width: "64", height: "55", viewBox: "0 0 64 55", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, style: style },
1939
- React__default.createElement("path", { d: "M32.6226 54.0001C46.2852 54.0001 57.3652 43.0033 57.3652 29.4239C57.3652 15.8446 46.2852 4.84778 32.6226 4.84778C18.9599 4.84778 7.87988 15.8446 7.87988 29.4239C7.87988 43.0033 18.9599 54.0001 32.6226 54.0001Z", fill: "#E6EAF5" }),
1940
- React__default.createElement("path", { d: "M51.5751 26.2165V41.2537C51.5751 44.3778 49.0342 46.9187 45.8684 46.9187H19.4596C16.3355 46.9187 13.7946 44.4195 13.7529 41.2954C13.7529 41.2537 13.7529 41.2537 13.7529 41.2121V26.2165C13.7529 26.1748 13.7529 26.1748 13.7529 26.1332C13.7529 26.0498 13.7529 25.9665 13.7946 25.8832C13.8362 25.7583 13.8779 25.675 13.9195 25.55L21.0008 12.0123C21.2507 11.4708 21.7922 11.1792 22.3754 11.1792H42.911C43.4941 11.1792 43.994 11.4708 44.2856 12.0123L51.3668 25.55C51.4085 25.6333 51.4501 25.7583 51.4918 25.8832C51.5751 25.9665 51.5751 26.0915 51.5751 26.2165Z", fill: "#D5DDEA" }),
1941
- React__default.createElement("path", { d: "M51.5751 26.2164V42.7949C51.5751 45.0859 49.7423 46.9187 47.4096 46.9187H17.9184C15.6274 46.9187 13.7529 45.0859 13.7529 42.7949V26.1331C13.7529 26.0498 13.7529 25.9665 13.7946 25.8832H23.2918C24.708 25.8832 25.8743 27.0078 25.8743 28.4658C25.8743 29.1739 26.1659 29.8404 26.6241 30.2986C27.124 30.7984 27.7071 31.0483 28.4569 31.0483H36.9127C38.329 31.0483 39.4953 29.9237 39.4953 28.4658C39.4953 27.7576 39.7869 27.0912 40.2451 26.633C40.7449 26.1331 41.3281 25.8832 42.0362 25.8832H51.4918C51.5751 25.9665 51.5751 26.0915 51.5751 26.2164Z", fill: "url(#paint0_linear_2578_27197)" }),
1942
- React__default.createElement("path", { d: "M56.7342 17.6773C57.6774 17.6773 58.442 16.9126 58.442 15.9694C58.442 15.0262 57.6774 14.2616 56.7342 14.2616C55.791 14.2616 55.0264 15.0262 55.0264 15.9694C55.0264 16.9126 55.791 17.6773 56.7342 17.6773Z", fill: "#EAEEF9" }),
1943
- React__default.createElement("path", { d: "M55.0257 12.1373C55.6698 12.1373 56.192 11.6152 56.192 10.971C56.192 10.3269 55.6698 9.80469 55.0257 9.80469C54.3816 9.80469 53.8594 10.3269 53.8594 10.971C53.8594 11.6152 54.3816 12.1373 55.0257 12.1373Z", fill: "#EAEEF9" }),
1944
- React__default.createElement("path", { d: "M7.79034 15.9694C8.43449 15.9694 8.95667 15.4472 8.95667 14.803C8.95667 14.1589 8.43449 13.6367 7.79034 13.6367C7.1462 13.6367 6.62402 14.1589 6.62402 14.803C6.62402 15.4472 7.1462 15.9694 7.79034 15.9694Z", fill: "#EAEEF9" }),
1945
- React__default.createElement("path", { d: "M5.16603 41.6286C6.36229 41.6286 7.33205 40.6588 7.33205 39.4625C7.33205 38.2663 6.36229 37.2965 5.16603 37.2965C3.96976 37.2965 3 38.2663 3 39.4625C3 40.6588 3.96976 41.6286 5.16603 41.6286Z", fill: "#EAEEF9" }),
1946
- React__default.createElement("path", { d: "M43.0864 6.16785C43.6301 12.1024 43.9019 13.4615 42.6711 18.8361C42.2708 20.0309 41.8705 21.3396 41.0128 22.25C39.812 23.6725 37.6392 24.2984 35.8666 23.8432C34.0368 23.388 32.5501 21.7948 32.2071 19.8602C31.9212 18.6654 32.3214 17.2429 33.3507 16.5032C34.4371 15.8204 35.981 15.9911 36.8958 16.8446C37.9251 17.6981 38.3254 19.0068 38.2682 20.2585C38.211 21.5103 37.7536 22.7621 37.1246 23.8432C35.7027 26.5014 35.1173 26.4916 32.2071 30.8575", stroke: "#ABB5CC", strokeMiterlimit: "10", strokeDasharray: "4 4" }),
1947
- React__default.createElement("path", { d: "M46.2749 3.95757C46.0575 4.75059 45.1881 5.03896 44.3187 4.53431C43.3769 4.10176 42.7249 3.74129 42.8698 3.02037C43.0871 2.29945 43.9565 2.22735 44.9708 2.15526C46.2024 2.01108 46.4198 3.16455 46.2749 3.95757Z", fill: "#DAE2EB" }),
1948
- React__default.createElement("path", { d: "M39.2479 4.67842C39.6102 5.32726 40.6245 5.75981 41.3489 5.11098C42.1459 4.39005 42.7979 3.88541 42.4357 3.16448C42.0734 2.51565 41.4938 2.73193 40.2622 2.87611C39.2479 3.09239 38.8132 3.9575 39.2479 4.67842Z", fill: "#DAE2EB" }),
1949
- React__default.createElement("path", { d: "M42.4358 2.01104C42.9429 1.93895 43.4501 2.22732 43.595 2.65987C43.6674 2.80406 43.7399 3.02034 43.7399 3.16452C43.8848 4.17381 43.5225 5.03892 42.9429 5.11102C42.2909 5.2552 41.6389 4.53428 41.5664 3.59707C41.5664 3.3087 41.5664 3.16452 41.5664 2.94824C41.6389 2.4436 41.9286 2.08313 42.4358 2.01104C42.5082 2.01104 42.4358 2.01104 42.4358 2.01104Z", fill: "#989FB0" }),
1950
- React__default.createElement("path", { d: "M27.9127 37.0298C28.4405 37.0298 28.8684 36.6019 28.8684 36.0741C28.8684 35.5463 28.4405 35.1184 27.9127 35.1184C27.3849 35.1184 26.957 35.5463 26.957 36.0741C26.957 36.6019 27.3849 37.0298 27.9127 37.0298Z", fill: "#989FB0" }),
1951
- React__default.createElement("path", { d: "M37.4186 37.0298C37.9464 37.0298 38.3742 36.6019 38.3742 36.0741C38.3742 35.5463 37.9464 35.1184 37.4186 35.1184C36.8908 35.1184 36.4629 35.5463 36.4629 36.0741C36.4629 36.6019 36.8908 37.0298 37.4186 37.0298Z", fill: "#989FB0" }),
1952
- React__default.createElement("path", { d: "M34.2147 43.3063H31.2186C30.7536 43.3063 30.3662 42.9188 30.3662 42.4539C30.3662 41.989 30.7536 41.6016 31.2186 41.6016H34.1889C34.6538 41.6016 35.0413 41.989 35.0413 42.4539C35.0671 42.9188 34.6797 43.3063 34.2147 43.3063Z", fill: "#989FB0" }),
1953
- React__default.createElement("defs", null,
1954
- React__default.createElement("linearGradient", { id: "paint0_linear_2578_27197", x1: "32.6517", y1: "25.3966", x2: "32.6517", y2: "47.1455", gradientUnits: "userSpaceOnUse" },
1955
- React__default.createElement("stop", { stopColor: "#FDFEFF" }),
1956
- React__default.createElement("stop", { offset: "0.9964", stopColor: "#ECF0F5" })))));
1957
- };
1958
-
1959
- const libraries = ['places'];
1960
- const GoogleLocationBlock = (props) => {
1961
- var _a;
1962
- const { inputWrapperOrder = ['label', 'input', 'description', 'error'], defaultValue, value: valueProps, onChange: onChangeProps, locale } = props, restProps = __rest(props, ["inputWrapperOrder", "defaultValue", "value", "onChange", "locale"]);
1963
- const [LoadScript, setLoadScript] = useState(null);
1964
- const [value, setValue] = useState(defaultValue || valueProps);
1965
- const { predictions } = usePlacesAutocomplete(value, '', locale === 'tl-PH' ? 'en' : (_a = locale === null || locale === void 0 ? void 0 : locale.split('-')) === null || _a === void 0 ? void 0 : _a[0]);
1966
- const onChangeAutocomplete = useCallback((s) => {
1967
- setValue(s);
1968
- onChangeProps === null || onChangeProps === void 0 ? void 0 : onChangeProps(s);
1969
- }, []);
1970
- const onClickItem = useCallback((item) => {
1971
- /** For sure get value */
1972
- setValue(item.value);
1973
- const predCur = predictions === null || predictions === void 0 ? void 0 : predictions.find(({ description }) => description === item.value);
1974
- onChangeProps === null || onChangeProps === void 0 ? void 0 : onChangeProps(item.value, predCur === null || predCur === void 0 ? void 0 : predCur.rawData);
1975
- }, [onChangeProps, predictions]);
1976
- useEffect(() => {
1977
- setValue(valueProps);
1978
- }, [valueProps]);
1979
- useEffect(() => {
1980
- var _a, _b, _c;
1981
- // only load extra google script when not yet loaded
1982
- if (!((_c = (_b = (_a = window === null || window === void 0 ? void 0 : window.google) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.places) === null || _c === void 0 ? void 0 : _c.AutocompleteService) && !LoadScript) {
1983
- import('@react-google-maps/api').then((m) => {
1984
- setLoadScript(() => m.LoadScript);
1985
- });
1986
- }
1987
- }, []);
1988
- return (React__default.createElement(Autocomplete, Object.assign({ defaultValue: defaultValue, value: value, onChange: onChangeAutocomplete, data: predictions.map((pred) => {
1989
- return { value: pred.description, label: pred.description };
1990
- }), filter: () => true, onItemSubmit: onClickItem, inputWrapperOrder: inputWrapperOrder, zIndex: ZINDEX_SSO - 9e6 + 2, withinPortal: true, styles: { dropdown: { pointerEvents: 'auto' } }, inputContainer: (children) => {
1991
- return (React__default.createElement(React__default.Fragment, null,
1992
- LoadScript && (React__default.createElement(LoadScript, { googleMapsApiKey: GOOGLE_API_KEY, libraries: libraries, loadingElement: React__default.createElement(React__default.Fragment, null), style: { width: '100%' } })),
1993
- children));
1994
- } }, restProps)));
1995
- };
1996
-
1997
- const StyledLeadGenFormInner = styled.div `
1998
- display: flex;
1999
- flex-wrap: wrap;
2000
- gap: 8px;
2001
- .leadgen-form_input {
2002
- width: calc(50% - 4px);
2003
- }
2004
-
2005
- .leadgen-form_input_checkbox {
2006
- width: 100%;
2007
- }
2008
-
2009
- .mantine-InputWrapper-error {
2010
- margin-top: 4px;
2011
- padding-top: 1px;
2012
- padding-bottom: 1px;
2013
- color: #f44d2c;
2014
- font-size: 12px;
2015
- line-height: 1.5;
2016
- }
2017
- `;
2018
-
2019
- const LeadGenForm = forwardRef((props, ref) => {
2020
- const { locale, blocks, scrollToErrorField = true, form: formProps, rules: validate, initialValues, onFinish, onFinishFailed, className, style, } = props;
2021
- const formRef = useRef(null);
2022
- const form = formProps || useForm({ initialValues, validate });
2023
- const { classes } = useTextStyles();
2024
- const middlewareFinish = useCallback((values, event) => {
2025
- /** Set `touched` all values for validation when submiting */
2026
- form.setTouched(blocks.reduce((touched, { data }) => {
2027
- touched[data.value] = true;
2028
- return touched;
2029
- }, {}));
2030
- /** Wait for `touched` state and then submit */
2031
- setTimeout(() => {
2032
- const { hasErrors } = form.validate();
2033
- if (hasErrors) {
2034
- return;
2035
- }
2036
- onFinish === null || onFinish === void 0 ? void 0 : onFinish(formatLeadGenFormValue(values, blocks), event);
2037
- }, 100);
2038
- }, [form, blocks]);
2039
- const middlewareFinishFailed = useCallback((errors, values, events) => {
2040
- const targetForm = events.target;
2041
- if (scrollToErrorField && errors) {
2042
- const firstErrorKey = Object.keys(errors)[0];
2043
- const firstErrorElement = targetForm.querySelector(`[name="${firstErrorKey}"]`);
2044
- if (firstErrorElement && (firstErrorElement === null || firstErrorElement === void 0 ? void 0 : firstErrorElement.focus)) {
2045
- setTimeout(() => {
2046
- firstErrorElement === null || firstErrorElement === void 0 ? void 0 : firstErrorElement.focus();
2047
- firstErrorElement.scrollIntoView({
2048
- behavior: 'auto',
2049
- block: 'center',
2050
- inline: 'center',
2051
- });
2052
- }, 100);
2053
- }
2054
- }
2055
- onFinishFailed === null || onFinishFailed === void 0 ? void 0 : onFinishFailed(errors, values, events);
2056
- }, [scrollToErrorField]);
2057
- useEffect(() => {
2058
- (() => __awaiter(void 0, void 0, void 0, function* () {
2059
- if (!window.intlTelInputUtils) {
2060
- yield require('intl-tel-input/build/js/utils');
2061
- }
2062
- }))();
2063
- }, []);
2064
- useImperativeHandle(ref, () => (Object.assign(Object.assign({}, form), { submit: () => {
2065
- formRef.current.requestSubmit();
2066
- } })), [form, formRef]);
2067
- if (!blocks || !blocks.length) {
2068
- return null;
2069
- }
2070
- return (React__default.createElement("form", { ref: formRef, onSubmit: form.onSubmit(middlewareFinish, middlewareFinishFailed), className: className, style: style },
2071
- React__default.createElement(StyledLeadGenFormInner, { className: "leadgen-form_inputs" }, blocks.map((block, idx) => {
2072
- const { id, name: blockName, data } = block;
2073
- const { placeholder: label, value: name, required, listQuestion, valueHTML, isSendMailChimp = false, } = data;
2074
- const formInputProps = form.getInputProps(name);
2075
- const { value, error } = formInputProps;
2076
- const reactKey = `${id}-${idx}`;
2077
- switch (blockName) {
2078
- case LEADGEN_BLOCK.TextBlock: {
2079
- return (React__default.createElement(TextField, { key: reactKey, shrink: !!value, className: "leadgen-form_input" },
2080
- React__default.createElement(TextField.Control, null, ({ shrink }) => (React__default.createElement(TextInput, Object.assign({ name: name, spellCheck: false, withAsterisk: required, label: React__default.createElement(Text, { size: shrink ? 'p3' : 'p2', variant: "secondary", weight: "halfBold" }, label), placeholder: " ", inputWrapperOrder: LEADGEN_ORDER_INPUT_WRAPPER, type: "text", "data-control": "text" }, formInputProps, { error: error && (React__default.createElement(Flex, { align: 'center', gap: 4 },
2081
- React__default.createElement(ErrorIcon, { size: 12 }),
2082
- React__default.createElement(Text, { size: "c1", variant: "error" }, error))), styles: (theme) => ({
2083
- input: Object.assign(Object.assign({}, GlobalTextStyleNew(theme)[CustomStylesType.LEADGEN].p2), { color: theme.colors.gray[9], fontWeight: FontWeight.halfBold }),
2084
- }) }))))));
2085
- }
2086
- case LEADGEN_BLOCK.NumberBlock: {
2087
- return (React__default.createElement(TextField, { key: reactKey, shrink: !!value, className: "leadgen-form_input" },
2088
- React__default.createElement(TextField.Control, null, (shrink) => (React__default.createElement(NumberInput$1, Object.assign({ name: value, spellCheck: false, withAsterisk: required, label: React__default.createElement(Text, { size: shrink ? 'p3' : 'p2', variant: "secondary", weight: "halfBold" }, label), placeholder: " ", inputWrapperOrder: LEADGEN_ORDER_INPUT_WRAPPER, type: "number", "data-control": "number" }, formInputProps, { error: error && (React__default.createElement(Flex, { align: 'center', gap: 4 },
2089
- React__default.createElement(ErrorIcon, { size: 12 }),
2090
- React__default.createElement(Text, { size: "c1", variant: "error" }, error))) }))))));
2091
- }
2092
- case LEADGEN_BLOCK.EmailBlock: {
2093
- return (React__default.createElement(TextField, { key: reactKey, shrink: !!value, className: "leadgen-form_input" },
2094
- React__default.createElement(TextField.Control, null, (shrink) => (React__default.createElement(TextInput, Object.assign({ name: name, spellCheck: false, withAsterisk: required, label: React__default.createElement(Text, { size: shrink ? 'p3' : 'p2', variant: "secondary", weight: "halfBold" }, label), placeholder: " ", inputWrapperOrder: LEADGEN_ORDER_INPUT_WRAPPER, "data-control": "email" }, formInputProps, { error: error && (React__default.createElement(Flex, { align: 'center', gap: 4 },
2095
- React__default.createElement(ErrorIcon, { size: 12 }),
2096
- React__default.createElement(Text, { size: "c1", variant: "error" }, error))) }))))));
2097
- }
2098
- case LEADGEN_BLOCK.PhoneOtpBlock:
2099
- case LEADGEN_BLOCK.WhatsappOtpBlock:
2100
- case LEADGEN_BLOCK.ZaloOtpBlock:
2101
- case LEADGEN_BLOCK.PhoneBlock: {
2102
- return (React__default.createElement(TextField, { key: reactKey, shrink: !!value, className: clsx('leadgen-form_input', {
2103
- 'leadgen-form_field_error': !!error,
2104
- }) },
2105
- React__default.createElement(TextField.Control, null, ({ shrink }) => (React__default.createElement(Input$1.Wrapper, { withAsterisk: required, "data-invalid": !!error, label: React__default.createElement(Text, { size: shrink ? 'p3' : 'p2', variant: "secondary", weight: "halfBold" }, label), inputWrapperOrder: [
2106
- 'label',
2107
- 'input',
2108
- 'description',
2109
- 'error',
2110
- ], error: error && (React__default.createElement(Flex, { align: 'center', gap: 4 },
2111
- React__default.createElement(ErrorIcon, { size: 12 }),
2112
- React__default.createElement(Text, { size: "c1", variant: "error" }, error))) },
2113
- React__default.createElement(Box, { className: "mantine-Input-wrapper", sx: (theme) => ({
2114
- '.PhoneInput .PhoneInputInput': Object.assign(Object.assign({}, GlobalTextStyleNew(theme)[CustomStylesType.LEADGEN].p2), { color: theme.colors.gray[9], fontWeight: FontWeight.halfBold }),
2115
- }) },
2116
- React__default.createElement(Phone, Object.assign({ className: `mantine-Input-input ${classes.p2}`, name: name, spellCheck: false, placeholder: " ", defaultCountry: (locale
2117
- ? MAPPED_LOCALE[locale] || 'VN'
2118
- : 'VN'), type: "text", "data-control": "tel" }, formInputProps))))))));
2119
- }
2120
- case LEADGEN_BLOCK.LocationBlock: {
2121
- return (React__default.createElement(TextField, { key: reactKey, shrink: !!value, className: "leadgen-form_input" },
2122
- React__default.createElement(GoogleLocationBlock, Object.assign({ name: name, withAsterisk: required, label: label, placeholder: " ", inputWrapperOrder: LEADGEN_ORDER_INPUT_WRAPPER, locale: locale, "data-control": "text" }, formInputProps, { error: error && (React__default.createElement(Flex, { align: 'center', gap: 4 },
2123
- React__default.createElement(ErrorIcon, { size: 12 }),
2124
- React__default.createElement(Text, { size: "c1", variant: "error" }, error))) }))));
2125
- }
2126
- case LEADGEN_BLOCK.DateBlock: {
2127
- return (React__default.createElement(TextField, { key: reactKey, shrink: !!value, className: "leadgen-form_input" },
2128
- React__default.createElement(DateInput, Object.assign({ locale: (MAPPED_LOCALE === null || MAPPED_LOCALE === void 0 ? void 0 : MAPPED_LOCALE[locale]) || MAPPED_LOCALE['vi-VN'], valueFormat: "DD/MM/YYYY", name: name, withAsterisk: required, label: label, placeholder: " ", inputWrapperOrder: LEADGEN_ORDER_INPUT_WRAPPER, type: "default", "data-control": "date" }, formInputProps))));
2129
- }
2130
- case LEADGEN_BLOCK.DropdownBlock:
2131
- return (React__default.createElement(TextField, { key: reactKey, shrink: !!value, className: "leadgen-form_input" },
2132
- React__default.createElement("div", { style: { display: 'none' }, "data-extra": true, "data-name": value, "data-control": 'dropdown' }),
2133
- React__default.createElement(Select$1, Object.assign({ name: name, withAsterisk: required, label: label, placeholder: " ", searchable: true, data: listQuestion.map((l) => ({
2134
- value: l.value,
2135
- label: l.placeholder,
2136
- })), nothingFound: React__default.createElement(NoData, null), styles: {
2137
- item: {
2138
- paddingBlock: 12,
2139
- paddingInline: 10,
2140
- fontSize: 16,
2141
- lineHeight: 1.5,
2142
- },
2143
- nothingFound: {
2144
- fontSize: 54,
2145
- paddingBlock: 30,
2146
- },
2147
- itemsWrapper: {
2148
- padding: 6,
2149
- },
2150
- dropdown: {
2151
- '.mantine-ScrollArea-scrollbar[data-orientation="vertical"]': {
2152
- '--radix-scroll-area-thumb-width': '6px',
2153
- width: 'var(--radix-scroll-area-thumb-width)',
2154
- paddingInline: 0,
2155
- },
2156
- },
2157
- }, maxDropdownHeight: 192 }, formInputProps))));
2158
- case LEADGEN_BLOCK.CheckboxBlock: {
2159
- const formInputCheckboxProps = form.getInputProps(name, {
2160
- type: 'checkbox',
2161
- });
2162
- return (React__default.createElement(ChoiceField, { className: "leadgen-form_input leadgen-form_input_checkbox", key: reactKey },
2163
- isSendMailChimp && (React__default.createElement("div", { style: { display: 'none' }, "data-name": name + '-mailchimp' })),
2164
- React__default.createElement(Checkbox$1.Group, Object.assign({ size: "md", withAsterisk: required, label: label, value: value, sx: {
2165
- display: 'flex',
2166
- flexDirection: 'column',
2167
- flexWrap: 'wrap',
2168
- gap: 8,
2169
- }, inputWrapperOrder: LEADGEN_ORDER_INPUT_WRAPPER, inputContainer: (children) => {
2170
- return (React__default.createElement("div", { className: "leadgen-choiceContainer" }, children));
2171
- } }, formInputCheckboxProps), listQuestion.map((l, _idx) => (React__default.createElement(Checkbox$1, { name: name, key: _idx, value: l.value, label: l.placeholder, "data-control": "checkbox" }))))));
2172
- }
2173
- case LEADGEN_BLOCK.RadioBlock: {
2174
- return (React__default.createElement(ChoiceField, { className: "leadgen-form_input leadgen-form_input_checkbox", key: reactKey },
2175
- isSendMailChimp && (React__default.createElement("div", { style: { display: 'none' }, "data-name": name + '-mailchimp' })),
2176
- React__default.createElement(Radio$1.Group, Object.assign({ size: "md", withAsterisk: required, label: label, value: value, spellCheck: true, inputWrapperOrder: LEADGEN_ORDER_INPUT_WRAPPER, inputContainer: (children) => {
2177
- return (React__default.createElement("div", { className: "leadgen-choiceContainer" }, children));
2178
- } }, formInputProps), listQuestion.map((l, _index) => (React__default.createElement(Radio$1, { name: name, key: _index, value: l.value, label: l.placeholder, "data-control": "radio" }))))));
2179
- }
2180
- case LEADGEN_BLOCK.TncBlock:
2181
- return (React__default.createElement(ChoiceField, { className: "leadgen-form_input leadgen-form_input_checkbox", key: reactKey },
2182
- React__default.createElement(Input$1.Wrapper, { error: error },
2183
- 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)))));
2184
- default: {
2185
- return null;
2186
- }
2187
- }
2188
- }))));
2189
- });
2190
-
2191
- const LEADGEN_ORDER_INPUT_WRAPPER = ['label', 'input', 'description', 'error'];
2192
-
2193
- var enPH = {
2194
- "validator.required": "This field is required.",
2195
- "validator.remote": "Please fix this field.",
2196
- "validator.email": "Please enter a valid email address.",
2197
- "validator.phone": "Please input correct phone number.",
2198
- "validator.url": "Please enter a valid URL.",
2199
- "validator.date": "Please enter a valid date.",
2200
- "validator.dateISO": "Please enter a valid date (ISO).",
2201
- "validator.number": "Please enter a valid number.",
2202
- "validator.digits": "Please enter only digits.",
2203
- "validator.creditcard": "Please enter a valid credit card number.",
2204
- "validator.equalTo": "Please enter the same value again.",
2205
- "validator.accept": "Please enter a value with a valid extension.",
2206
- "validator.maxlength": "jQuery.validator.format('Please enter no more than {0} characters.",
2207
- "validator.minlength": "jQuery.validator.format('Please enter at least {0} characters.",
2208
- "validator.rangelength": "jQuery.validator.format('Please enter a value between {0} and {1} characters long.",
2209
- "validator.range": "jQuery.validator.format('Please enter a value between {0} and {1}.",
2210
- "validator.max": "jQuery.validator.format('Please enter a value less than or equal to {0}.",
2211
- "validator.min": "jQuery.validator.format('Please enter a value greater than or equal to {0}.",
2212
- "validator.emailUsed": "Email already in use for this campaign.",
2213
- "validator.phoneUsed": "Your phone number already in use for this campaign.",
2214
- "validator.dateInvalid": "This date is not valid, please update.",
2215
- "lead.otp.title": "Enter OTP",
2216
- "lead.otp.desc": "We have sent an OTP to your mobile number {phone}",
2217
- "lead.otp.verify": "Verify",
2218
- "lead.otp.resend": "Resend OTP{timer}",
2219
- "lead.otp.phoneLabel": "Phone OTP",
2220
- "lead.otp.phonePlaceholder": "Enter OTP",
2221
- "lead.empty.title": "Oops, seem your information is empty, do you want to submit the information again?",
2222
- "lead.empty.cancel": "Cancel",
2223
- "lead.empty.submitAgain": "Submit again",
2224
- "inlineFreebie.freeSample.title": "Free Sample",
2225
- "inlineFreebie.luckyDrawGift.title": "Lucky-draw Gift",
2226
- "inlineFreebie.value": "Value",
2227
- "common.day": "Day",
2228
- "common.month": "Month",
2229
- "common.year": "Year"
2230
- };
2231
-
2232
- var hiIN = {
2233
- "validator.required": "इस क्षेत्र की आवश्यकता है।",
2234
- "validator.email": "कृपया एक मान्य ईमेल पता दर्ज करें",
2235
- "validator.number": "कृपया एक वैध संख्या दर्ज करें",
2236
- "validator.digits": "कृपया केवल अंक दर्ज करें",
2237
- "validator.maxlength": "कृपया {0} अक्षर से अधिक दर्ज न करें",
2238
- "validator.minlength": "कृपया कम से कम {0} अक्षर दर्ज करें",
2239
- "validator.phone": "कृपया एक वैध संख्या दर्ज करें",
2240
- "validator.dateInvalid": "यह तिथि मान्य नहीं है, कृपया अपडेट करें।",
2241
- "validator.emailUsed": "Email already in use for this campaign.",
2242
- "validator.phoneUsed": "Your phone number already in use for this campaign.",
2243
- "lead.otp.title": "Enter OTP",
2244
- "lead.otp.desc": "We have sent an OTP to your mobile number {phone}",
2245
- "lead.otp.verify": "Verify",
2246
- "lead.otp.resend": "Resend OTP{timer}",
2247
- "lead.empty.title": "ऊप्स! लगता है आपकी जानकारी खाली है। क्या आप जानकारी फिर से सबमिट करना चाहते हैं?",
2248
- "lead.empty.cancel": "रद्द करें",
2249
- "lead.empty.submitAgain": "फिर से सबमिट करें",
2250
- "inlineFreebie.freeSample.title": "मुफ्त नमूना",
2251
- "inlineFreebie.luckyDrawGift.title": "लकी-ड्रा गिफ्ट",
2252
- "inlineFreebie.value": "मूल्य",
2253
- "common.day": "साल",
2254
- "common.month": "महीना",
2255
- "common.year": ""
2256
- };
2257
-
2258
- var idID = {
2259
- "validator.required": "Kolom ini wajib diisi",
2260
- "validator.email": "Tolong daftarkan email yang valid",
2261
- "validator.number": "Tolong daftarkan nomor telepon yang valid",
2262
- "validator.digits": "Tolong masukkan angka saja",
2263
- "validator.maxlength": "Jangan memasukkan lebih dari {0} karakter",
2264
- "validator.minlength": "Tolong ketik sedikitnya {0} karakter",
2265
- "validator.phone": "Tolong daftarkan nomor telepon yang valid",
2266
- "validator.emailUsed": "Email sudah digunakan untuk kampanye ini.",
2267
- "validator.phoneUsed": "Nomor telepon Anda sudah digunakan untuk kampanye ini.",
2268
- "validator.dateInvalid": "Tanggal ini tidak valid, silakan perbarui",
2269
- "lead.otp.title": "Masukkan OTP",
2270
- "lead.otp.desc": "Kami telah mengirimkan OTP ke nomor ponsel Anda {phone}",
2271
- "lead.otp.verify": "Verifikasi",
2272
- "lead.otp.resend": "Kirim Ulang OTP {timer}",
2273
- "lead.otp.phoneLabel": "OTP Telepon",
2274
- "lead.otp.phonePlaceholder": "Masukkan OTP",
2275
- "lead.empty.title": "Oops, sepertinya informasi Anda kosong. Apakah Anda ingin mengirimkan informasi lagi?",
2276
- "lead.empty.cancel": "Batal",
2277
- "lead.empty.submitAgain": "Kirim lagi",
2278
- "inlineFreebie.freeSample.title": "Sampel Gratis",
2279
- "inlineFreebie.luckyDrawGift.title": "Hadiah Undian",
2280
- "inlineFreebie.value": "Nilai",
2281
- "common.day": "Hari",
2282
- "common.month": "Bulan",
2283
- "common.year": "Tahun"
2284
- };
2285
-
2286
- var kmKH = {
2287
- "validator.required": "ព័ត៌មាន​ចាំបាច់​ដែល​ត្រូវ​បំពេញ",
2288
- "validator.email": "សូម​វាយ​អាសយដ្ឋាន​អ៊ីម៉ែល​ឲ្យ​បាន​ត្រឹមត្រូវ",
2289
- "validator.number": "សូម​វាយបញ្ចូល​លេខ​ឲ្យ​បាន​ត្រឹមត្រូវ",
2290
- "validator.digits": "វាយ​បញ្ចូល​បាន​តែ​លេខ​ប៉ុណ្ណោះ",
2291
- "validator.maxlength": "សូម​វាយ​បញ្ចូលកុំ​ឲ្យ​លើស {0} តួអក្សរ",
2292
- "validator.minlength": "សូម​វាយ​បញ្ចូល​តិច​បំផុត {0} តួអក្ស",
2293
- "validator.phone": "សូម​វាយបញ្ចូល​លេខ​ឲ្យ​បាន​ត្រឹមត្រូវ",
2294
- "validator.emailUsed": "អ៊ីមែលត្រូវបានប្រើប្រាស់សម្រាប់យុទ្ធនាការនេះរួចហើយ។",
2295
- "validator.phoneUsed": "លេខទូរស័ព្ទរបស់អ្នកត្រូវបានប្រើប្រាស់សម្រាប់យុទ្ធនាការនេះរួចហើយ។",
2296
- "validator.dateInvalid": "កាលបរិច្ឆេទនេះមិនត្រឹមត្រូវទេ សូមធ្វើបច្ចុប្បន្នភាព។",
2297
- "lead.otp.title": "បញ្ចូល OTP",
2298
- "lead.otp.desc": "យើងបានផ្ញើ OTP ទៅកាន់លេខទូរសព្ទរបស់អ្នក {phone}",
2299
- "lead.otp.verify": "ផ្ទៀងផ្ទាត់",
2300
- "lead.otp.resend": "ផ្ញើ OTP ម្តងទៀត {timer}",
2301
- "lead.otp.phoneLabel": "OTP ទូរស័ព្ទ",
2302
- "lead.otp.phonePlaceholder": "បញ្ចូល OTP",
2303
- "lead.empty.title": "អូុបស! ហាក់ដូចជាព័ត៌មានរបស់អ្នកទទេ។ តើអ្នកចង់ដាក់ស្នើព័ត៌មានម្តងទៀតទេ?",
2304
- "lead.empty.cancel": "លុប​ចោល",
2305
- "lead.empty.submitAgain": "ដាក់ស្នើម្ដងទៀត",
2306
- "inlineFreebie.freeSample.title": "សំបុត្រស្រង់ពិន័យ",
2307
- "inlineFreebie.luckyDrawGift.title": "សំបុត្រស្រង់ពិន័យ",
2308
- "inlineFreebie.value": "តម្លៃ",
2309
- "common.day": "ឆ្នាំ",
2310
- "common.month": "ខែ",
2311
- "common.year": "ថ្ងៃ"
2312
- };
2313
-
2314
- var msMY = {
2315
- "validator.required": "Bahagian ini wajib diisi.",
2316
- "validator.email": "Sila masukkan alamat emel yang sah.",
2317
- "validator.number": "Sila masukkan no telefon yang sah.",
2318
- "validator.digits": "Sila masukkan nombor digit sahaja.",
2319
- "validator.maxlength": "Sila masukkan tidak lebih dari {0} aksara",
2320
- "validator.minlength": "Sila masukkan sekurang-kurangnya {0} aksara",
2321
- "validator.phone": "Sila masukkan no telefon yang sah.",
2322
- "validator.emailUsed": "Emel sudah digunakan untuk kempen ini.",
2323
- "validator.phoneUsed": "Nombor telefon anda sudah digunakan untuk kempen ini.",
2324
- "validator.dateInvalid": "Tarikh ini tidak sah, sila kemas kini",
2325
- "lead.otp.title": "Masukkan OTP",
2326
- "lead.otp.desc": "Kami telah menghantar OTP ke nombor telefon bimbit anda {phone}",
2327
- "lead.otp.verify": "Sahkan",
2328
- "lead.otp.resend": "Hantar semula OTP {timer}",
2329
- "lead.otp.phoneLabel": "OTP Telefon",
2330
- "lead.otp.phonePlaceholder": "Masukkan OTP",
2331
- "lead.empty.title": "Oops, nampaknya maklumat anda kosong. Adakah anda ingin menghantar maklumat semula?",
2332
- "lead.empty.cancel": "Batal",
2333
- "lead.empty.submitAgain": "Hantar semula",
2334
- "inlineFreebie.freeSample.title": "Sampel Percuma",
2335
- "inlineFreebie.luckyDrawGift.title": "Hadiah Undian",
2336
- "inlineFreebie.value": "Nilai",
2337
- "common.day": "Hari",
2338
- "common.month": "Bulan",
2339
- "common.year": "Tahun"
2340
- };
2341
-
2342
- var myMM = {
2343
- "validator.required": "ဒီနေရာမှာ ဖြည့်ဖို့ လိုအပ်ပါတယ်",
2344
- "validator.email": "မှန်ကန်သော အီးမေးလ်လိပ်စာထည့်သွင်းပါ",
2345
- "validator.number": "မှန်ကန်သော ဖုန်းနံပါတ်ထည့်သွင်းပါ",
2346
- "validator.digits": "နံပါတ်များသာဖြည့်ပါ",
2347
- "validator.maxlength": "ကျေးဇူးပြု၍ {0} ထပ်မပိုသော ဂဏန်းများသာဖြည့်ပါ",
2348
- "validator.minlength": "ကျေးဇူးပြု၍ အနည်းဆုံး {0} ဂဏန်းဖြည့်ပါ",
2349
- "validator.phone": "မှန်ကန်သော ဖုန်းနံပါတ်ထည့်သွင်းပါ",
2350
- "validator.emailUsed": "ဤအေကာင့်အတွက် အီးမေးလ်ကို အသုံးပြုပြီးဖြစ်ပါသည်။",
2351
- "validator.phoneUsed": "ဤအေကာင့်အတွက် သင့်ဖုန်းနံပါတ်ကို အသုံးပြုပြီးဖြစ်ပါသည်။",
2352
- "validator.dateInvalid": "ယနေ့စွဲမှားနေသည်၊ ကျေးဇူးပြု၍ ပြင်ဆင်ပါ။",
2353
- "lead.otp.title": "OTP ကိုထည့်ပါ",
2354
- "lead.otp.desc": "ကျွန်ုပ်တို့သည် OTP ကိုသင့်ဖုန်းနံပါတ် {phone} သို့ပို့ခဲ့သည်",
2355
- "lead.otp.verify": "အတည်ပြုပါ",
2356
- "lead.otp.resend": "OTP ကိုထပ်မံပို့ရန် {timer}",
2357
- "lead.otp.phoneLabel": "ဖုန်း OTP",
2358
- "lead.otp.phonePlaceholder": "OTP ကိုထည့်ပါ",
2359
- "lead.empty.title": "အုပ်စ်! သင့်အချက်အလက်သည် ဗလာဖြစ်နေသလိုဖြစ်သည်။ ထပ်မံတင်သွင်းလိုပါသလား?",
2360
- "lead.empty.cancel": "မလုပ်ဆောင်ပါ",
2361
- "lead.empty.submitAgain": "ထပ်မံတင်သွင်းပါ",
2362
- "inlineFreebie.freeSample.title": "အခမဲ့အစားအစာ",
2363
- "inlineFreebie.luckyDrawGift.title": "အခမဲ့အစားအစာ",
2364
- "inlineFreebie.value": "တန်ဖိုး",
2365
- "common.day": "ရက်",
2366
- "common.month": "လ",
2367
- "common.year": "နှစ်"
2368
- };
2369
-
2370
- var thTH = {
2371
- "validator.required": "ต้องระบุข้อมูลในช่องนี้",
2372
- "validator.email": "กรุณาใส่อีเมล์ที่ถูกต้อง",
2373
- "validator.number": "กรุณาใส่ตัวเลขที่ถูกต้อง",
2374
- "validator.digits": "กรุณาส่เฉพาะตัวเลข",
2375
- "validator.maxlength": "กรุณาใส่ตัวเลขมากกว่า {0} หลัก",
2376
- "validator.minlength": "กรุณาใส่ตัวเลขอย่างน้อย {0} หลัก",
2377
- "validator.phone": "กรุณาใส่ตัวเลขที่ถูกต้อง",
2378
- "validator.emailUsed": "อีเมลนี้ถูกใช้สำหรับแคมเปญนี้แล้ว",
2379
- "validator.phoneUsed": "หมายเลขโทรศัพท์ของคุณถูกใช้สำหรับแคมเปญนี้แล้ว",
2380
- "validator.dateInvalid": "วันที่นี้ไม่ถูกต้อง โปรดอัปเดต",
2381
- "lead.otp.title": "ป้อน OTP",
2382
- "lead.otp.desc": "เราได้ส่ง OTP ไปยังหมายเลขโทรศัพท์มือถือของคุณ {phone}",
2383
- "lead.otp.verify": "ยืนยัน",
2384
- "lead.otp.resend": "ส่ง OTP อีกครั้ง {timer}",
2385
- "lead.otp.phoneLabel": "OTP โทรศัพท์",
2386
- "lead.otp.phonePlaceholder": "ป้อน OTP",
2387
- "lead.empty.title": "อุ๊ปส์! ดูเหมือนว่าข้อมูลของคุณว่างเปล่า คุณต้องการส่งข้อมูลอีกครั้งหรือไม่?",
2388
- "lead.empty.cancel": "ยกเลิก",
2389
- "lead.empty.submitAgain": "ส่งอีกครั้ง",
2390
- "inlineFreebie.freeSample.title": "ตัวอย่างฟรี",
2391
- "inlineFreebie.luckyDrawGift.title": "ของรางวัลที่ถูกรางวัล",
2392
- "inlineFreebie.value": "ค่า",
2393
- "common.day": "วัน",
2394
- "common.month": "เดือน",
2395
- "common.year": "ปี"
2396
- };
2397
-
2398
- var viVN = {
2399
- "validator.required": "Vui lòng điền mục này",
2400
- "validator.email": "Vui lòng điền email có thật.",
2401
- "validator.number": "Vui lòng điền số có thật",
2402
- "validator.digits": "Vui lòng chỉ điền số",
2403
- "validator.maxlength": "Vui lòng điền dưới {0} số",
2404
- "validator.minlength": "Vui lòng điền hơn {0} số",
2405
- "validator.remote": "Hãy sửa cho đúng.",
2406
- "validator.url": "Hãy nhập URL.",
2407
- "validator.date": "Hãy nhập ngày.",
2408
- "validator.dateISO": "Hãy nhập ngày (ISO).",
2409
- "validator.creditcard": "Hãy nhập số thẻ tín dụng.",
2410
- "validator.equalTo": "Hãy nhập thêm lần nữa.",
2411
- "validator.extension": "Phần mở rộng không đúng.",
2412
- "validator.rangelength": "Hãy nhập từ {0} đến {1} kí tự.",
2413
- "validator.range": "Hãy nhập từ {0} đến {1}.",
2414
- "validator.max": "Hãy nhập từ {0} trở xuống.",
2415
- "validator.min": "Hãy nhập từ {0} trở lên.",
2416
- "validator.phone": "Nhập đúng định dạng số điện thoại",
2417
- "validator.emailUsed": "Email này đã được sử dụng.",
2418
- "validator.phoneUsed": "Số điện thoại này đã được sử dụng.",
2419
- "validator.dateInvalid": "Ngày này không hợp lệ, vui lòng cập nhật.",
2420
- "lead.otp.title": "Nhập OTP",
2421
- "lead.otp.desc": "Chúng tôi đã gửi OTP đến số điện thoại của bạn {phone}",
2422
- "lead.otp.verify": "Xác minh",
2423
- "lead.otp.resend": "Gửi lại OTP {timer}",
2424
- "lead.otp.phoneLabel": "Nhập OTP",
2425
- "lead.otp.phonePlaceholder": "Nhập OTP",
2426
- "lead.empty.title": "Oops, có vẻ như thông tin của bạn đang trống. Bạn có muốn gửi lại thông tin không?",
2427
- "lead.empty.cancel": "Hủy",
2428
- "lead.empty.submitAgain": "Gửi lại",
2429
- "inlineFreebie.freeSample.title": "Dùng thử miễn phí",
2430
- "inlineFreebie.luckyDrawGift.title": "Phần thưởng may mắn",
2431
- "inlineFreebie.value": "Trị giá",
2432
- "common.day": "Ngày",
2433
- "common.month": "Tháng",
2434
- "common.year": "Năm"
2435
- };
2436
-
2437
- var zhTW = {
2438
- "validator.required": "此為必填欄位",
2439
- "validator.email": "請填入有效的 email 地址",
2440
- "validator.number": "請填入有效的電話號碼",
2441
- "validator.digits": "此欄位僅能輸入數字",
2442
- "validator.maxlength": "請輸入少於 {0} 位數",
2443
- "validator.minlength": "請輸入至少 {0} 位數",
2444
- "validator.phone": "請填入有效的電話號碼",
2445
- "validator.emailUsed": "此電子郵件已被使用於此活動。",
2446
- "validator.phoneUsed": "您的手機號碼已被使用於此活動。",
2447
- "validator.dateInvalid": "此日期無效,請更新.",
2448
- "lead.otp.title": "輸入 OTP",
2449
- "lead.otp.desc": "我們已將 OTP 發送到您的手機號碼 {phone}",
2450
- "lead.otp.verify": "驗證",
2451
- "lead.otp.resend": "重新發送 OTP {timer}",
2452
- "lead.otp.phoneLabel": "電話 OTP",
2453
- "lead.otp.phonePlaceholder": "輸入 OTP",
2454
- "lead.empty.title": "哎呀,您的資訊似乎是空的,您想要重新提交資訊嗎?",
2455
- "lead.empty.cancel": "取消",
2456
- "lead.empty.submitAgain": "重新提交",
2457
- "inlineFreebie.freeSample.title": "免費試用",
2458
- "inlineFreebie.luckyDrawGift.title": "幸運抽獎禮品",
2459
- "inlineFreebie.value": "價值",
2460
- "common.day": "日",
2461
- "common.month": "月",
2462
- "common.year": "年"
2463
- };
2464
-
2465
- /** The translations lead has of its own, by locale. */
2466
- const leadTranslationsMap = {
2467
- 'en-PH': enPH,
2468
- 'vi-VN': viVN,
2469
- 'hi-IN': hiIN,
2470
- 'id-ID': idID,
2471
- 'ms-MY': msMY,
2472
- 'my-MM': myMM,
2473
- 'km-KH': kmKH,
2474
- 'zh-TW': zhTW,
2475
- 'zh-SG': zhTW,
2476
- 'th-TH': thTH,
2477
- 'tl-PH': enPH,
2478
- };
2479
- /**
2480
- * Every translation lead shows in `locale`: the shared library translations
2481
- * of that locale, given by the caller, with the ones of lead on top.
2482
- */
2483
- const withLeadTranslations = (locale, libraryTranslations) => (Object.assign(Object.assign({}, libraryTranslations), leadTranslationsMap[locale]));
2484
-
2485
- const useImageSize = (src) => {
2486
- const [width, setWidth] = useState(16);
2487
- const [height, setHeight] = useState(9);
2488
- const [loaded, setLoaded] = useState(false);
2489
- // load src image to get its width and height
2490
- useEffect(() => {
2491
- setLoaded(false);
2492
- if (src) {
2493
- const img = new Image();
2494
- img.addEventListener('load', () => {
2495
- setWidth(img.naturalWidth);
2496
- setHeight(img.naturalHeight);
2497
- setLoaded(true);
2498
- });
2499
- img.addEventListener('error', () => {
2500
- setWidth(16);
2501
- setHeight(9);
2502
- setLoaded(true);
2503
- });
2504
- img.src = src;
2505
- }
2506
- else {
2507
- setWidth(16);
2508
- setHeight(9);
2509
- setLoaded(true);
2510
- }
2511
- }, [src]);
2512
- return {
2513
- loaded,
2514
- width,
2515
- height,
2516
- };
2517
- };
2518
-
2519
- const CloseButton = ({ onClose, containerClassName, svgClassName, }) => (React__default.createElement("button", { onClick: onClose, className: `le-newbuilder-close-button js-modal__close ${containerClassName || ''}` },
2520
- React__default.createElement("svg", { width: "1em", height: "1em", viewBox: "0 0 20 20", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", className: svgClassName },
2521
- React__default.createElement("path", { d: "M9.99981 10.8432L14.0583 14.9017C14.1691 15.0125 14.3083 15.0691 14.476 15.0717C14.6437 15.0743 14.7854 15.0176 14.9013 14.9017C15.0172 14.7858 15.0752 14.6453 15.0752 14.4802C15.0752 14.3151 15.0172 14.1746 14.9013 14.0587L10.8429 10.0002L14.9013 5.9417C15.0121 5.83094 15.0688 5.69172 15.0713 5.52402C15.0739 5.35634 15.0172 5.21456 14.9013 5.09866C14.7854 4.98276 14.6449 4.9248 14.4798 4.9248C14.3147 4.9248 14.1742 4.98276 14.0583 5.09866L9.99981 9.15712L5.94133 5.09866C5.83057 4.98789 5.69135 4.93122 5.52365 4.92866C5.35598 4.92609 5.21419 4.98276 5.09829 5.09866C4.98239 5.21456 4.92444 5.35506 4.92444 5.52018C4.92444 5.6853 4.98239 5.82581 5.09829 5.9417L9.15675 10.0002L5.09829 14.0587C4.98752 14.1694 4.93085 14.3087 4.9283 14.4763C4.92572 14.644 4.98239 14.7858 5.09829 14.9017C5.21419 15.0176 5.3547 15.0756 5.51982 15.0756C5.68493 15.0756 5.82544 15.0176 5.94133 14.9017L9.99981 10.8432Z" }))));
2522
-
2523
- // url: imageBlocks.imageMobile.data.url
2524
- // newTab: imageBlocks.imageMobile.data.newtab
2525
- // imageMobile: campaignShow.image
2526
- // imageDestkop: campaignShow.image_desktop
2527
- const CenterTabLayout = ({ popupId, url, newTab, imageDestkop, imageMobile, onClose, onOtherSubmit, doImpression, }) => {
2528
- const { width: imageMobileWidth, height: imageMobileHeight, loaded: imageMobileLoaded, } = useImageSize(imageMobile);
2529
- const { width: imageDestkopWidth, height: imageDestkopHeight, loaded: imageDestkopLoaded, } = useImageSize(imageDestkop);
2530
- useEffect(() => {
2531
- (() => __awaiter(void 0, void 0, void 0, function* () {
2532
- yield doImpression();
2533
- }))();
2534
- }, []);
2535
- useEffect(() => {
2536
- if (popupId && imageMobileLoaded && imageDestkopLoaded) {
2537
- document.body.classList.add('noscroll');
2538
- }
2539
- return () => {
2540
- document.body.classList.remove('noscroll');
2541
- };
2542
- }, [popupId, imageMobileLoaded, imageDestkopLoaded]);
2543
- if (!imageMobileLoaded || !imageDestkopLoaded)
2544
- return null;
2545
- return (React__default.createElement("div", { id: popupId, className: "leadgen lead-modal-wrapper", "data-popup-url": location.pathname, "data-popup-type": "center_tab" },
2546
- React__default.createElement("div", { className: "le-center-tab-popup" },
2547
- React__default.createElement("div", { style: { position: 'relative' } },
2548
- React__default.createElement("a", { className: "js-popup-other-submit", href: url, target: newTab ? 'blank' : '_parent', onClick: (e) => __awaiter(void 0, void 0, void 0, function* () {
2549
- e.preventDefault();
2550
- onOtherSubmit({
2551
- type: 'redirects',
2552
- preventTrackingClose: true,
2553
- });
2554
- yield doImpression({
2555
- type: 'redirects',
2556
- });
2557
- window.open(url, newTab ? 'blank' : '_parent');
2558
- }) },
2559
- isVideo(imageMobile) ? (React__default.createElement("video", { loop: true, muted: true, autoPlay: true, className: "le-only-mobile" },
2560
- React__default.createElement("source", { src: imageMobile }))) : (React__default.createElement("img", { className: "le-only-mobile", src: imageMobile, style: {
2561
- aspectRatio: `${imageMobileWidth}/${imageMobileHeight}`,
2562
- } })),
2563
- isVideo(imageDestkop) ? (React__default.createElement("video", { loop: true, muted: true, autoPlay: true, className: "le-only-desktop" },
2564
- React__default.createElement("source", { src: imageDestkop }))) : (React__default.createElement("img", { className: "le-only-desktop", src: imageDestkop, style: {
2565
- aspectRatio: `${imageDestkopWidth}/${imageDestkopHeight}`,
2566
- } }))),
2567
- React__default.createElement(CloseButton, { onClose: onClose, containerClassName: "close-button-top-right" })))));
2568
- };
2569
-
2570
- // title: titleText
2571
- // titleAlign: textBlocks.titleBlock.data.align
2572
- // subtitle: textBlocks.subtitleBlock.data.value
2573
- // subtitleAlign: textBlocks.subtitleBlock.data.align
2574
- // url: actionBlocks.linkButtonBlock.data.url
2575
- // urlText: actionBlocks.linkButtonBlock.data.value
2576
- // newTab: actionBlocks.linkButtonBlock.data.newtab
2577
- // imageMobile: campaignShow.image
2578
- // imageDesktop: campaignShow.image_desktop
2579
- const FloatingLayout = ({ popupId, url, title, urlText, titleAlign, subtitle, subtitleAlign, newTab, imageDesktop, imageMobile, onClose, onOtherSubmit, }) => {
2580
- const { width: imageMobileWidth, height: imageMobileHeight, loaded: imageMobileLoaded, } = useImageSize(imageMobile);
2581
- const { width: imageDesktopWidth, height: imageDesktopHeight, loaded: imageDesktopLoaded, } = useImageSize(imageDesktop);
2582
- if (!imageMobileLoaded || !imageDesktopLoaded)
2583
- return null;
2584
- return (React__default.createElement("div", { id: popupId, className: "lead-modal-wrapper lead-floating-wrapper", "data-popup-url": location.pathname, "data-popup-type": "floating" },
2585
- React__default.createElement("aside", { className: "le-only-desktop" },
2586
- React__default.createElement("div", { className: "le-floating-desktop" },
2587
- React__default.createElement("div", { className: "le-floating-desktop-wrap", style: { position: 'relative', background: '#fff' } },
2588
- imageDesktop ? (React__default.createElement("div", null,
2589
- React__default.createElement("img", { style: {
2590
- maxWidth: 120,
2591
- borderTopLeftRadius: 5,
2592
- borderBottomLeftRadius: 5,
2593
- aspectRatio: `${imageDesktopWidth}/${imageDesktopHeight}`,
2594
- }, src: imageDesktop }))) : null,
2595
- React__default.createElement("div", { style: { padding: 20 } },
2596
- React__default.createElement("div", { className: `le-floating-desktop-title le-text-align-${titleAlign}` }, title),
2597
- React__default.createElement("div", { className: `le-floating-desktop-desc le-text-align-${subtitleAlign}` }, subtitle)),
2598
- React__default.createElement("a", { target: newTab ? 'blank' : '_parent', style: { marginLeft: 35, textDecoration: 'none' }, href: url },
2599
- React__default.createElement("button", { className: "le-joinbow-floating-btn js-popup-other-submit", onClick: onOtherSubmit }, urlText)),
2600
- React__default.createElement(CloseButton, { onClose: onClose, containerClassName: "close-button-top-right" })))),
2601
- React__default.createElement("aside", { className: "le-only-mobile" },
2602
- React__default.createElement("div", { className: "le-floating-mobile" },
2603
- React__default.createElement("div", { className: "le-floating-mobile-wrap", style: { position: 'relative', background: '#fff' } },
2604
- React__default.createElement("aside", { style: { display: 'flex', justifyContent: 'space-between' } },
2605
- React__default.createElement("div", null,
2606
- React__default.createElement("div", { className: `le-floating-mobile-title le-text-align-${titleAlign}` }, title),
2607
- React__default.createElement("div", { className: `le-floating-mobile-desc le-text-align-${subtitleAlign}` }, subtitle)),
2608
- imageMobile ? (React__default.createElement("div", null,
2609
- React__default.createElement("img", { style: {
2610
- marginLeft: 15,
2611
- marginTop: 4,
2612
- maxWidth: 100,
2613
- aspectRatio: `${imageMobileWidth}/${imageMobileHeight}`,
2614
- }, src: imageMobile }))) : null),
2615
- React__default.createElement("div", { style: { textAlign: 'center', marginTop: 10 } },
2616
- React__default.createElement("a", { target: newTab ? 'blank' : '_parent', href: url, style: { textDecoration: 'none' } },
2617
- React__default.createElement("button", { className: "le-joinbow-floating-btn js-popup-other-submit", onClick: onOtherSubmit }, urlText))),
2618
- React__default.createElement(CloseButton, { onClose: onClose, containerClassName: "close-button-top-right" }))))));
2619
- };
2620
-
2621
- function useScrollTo() {
2622
- const scrollTo = useCallback((element, to, duration = 500) => {
2623
- if (!element)
2624
- return;
2625
- const start = element.scrollTop;
2626
- const change = to - start;
2627
- const startTime = performance.now();
2628
- const easeInOutQuad = (t) => {
2629
- return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
2630
- };
2631
- const animateScroll = (currentTime) => {
2632
- const elapsed = currentTime - startTime;
2633
- const progress = Math.min(elapsed / duration, 1);
2634
- element.scrollTop = start + change * easeInOutQuad(progress);
2635
- if (progress < 1) {
2636
- requestAnimationFrame(animateScroll);
2637
- }
2638
- };
2639
- requestAnimationFrame(animateScroll);
2640
- }, []);
2641
- return scrollTo;
2642
- }
2643
-
2644
- const useViewportDimensions = () => {
2645
- const dimensionsRef = useRef({ width: 0, height: 0 });
2646
- const [dimensions, setDimensions] = useState(() => ({
2647
- width: window.screen.availWidth,
2648
- height: window.screen.availHeight,
2649
- }));
2650
- useEffect(() => {
2651
- var _a;
2652
- function visualViewport(e) {
2653
- if (dimensionsRef.current.width === e.target.width &&
2654
- dimensionsRef.current.height === e.target.height) {
2655
- return;
2656
- }
2657
- const newDimensions = {
2658
- width: e.target.width,
2659
- height: e.target.height,
2660
- };
2661
- dimensionsRef.current = newDimensions;
2662
- setDimensions(newDimensions);
2663
- }
2664
- (_a = window.visualViewport) === null || _a === void 0 ? void 0 : _a.addEventListener('resize', visualViewport);
2665
- return () => {
2666
- var _a;
2667
- (_a = window.visualViewport) === null || _a === void 0 ? void 0 : _a.removeEventListener('resize', visualViewport);
2668
- };
2669
- }, []);
2670
- return useMemo(() => (Object.assign({}, dimensions)), [dimensions.height, dimensions.width]);
2671
- };
2672
-
2673
- // Default handling for Safari & Chrome
2674
- function useViewportPushedByKeyboard(threshold = 20) {
2675
- const ref = useRef(null);
2676
- const [isPushed, setIsPushed] = useState(false);
2677
- useEffect(() => {
2678
- const check = () => {
2679
- if (!ref.current)
2680
- return;
2681
- const rect = ref.current.getBoundingClientRect();
2682
- const diff = window.innerHeight - rect.bottom;
2683
- setIsPushed(diff > threshold);
2684
- };
2685
- window.addEventListener('resize', check);
2686
- const id = setInterval(check, 300); // fallback để cập nhật khi resize không đủ
2687
- return () => {
2688
- window.removeEventListener('resize', check);
2689
- clearInterval(id);
2690
- };
2691
- }, [threshold]);
2692
- return { isPushed, bottomRef: ref };
2693
- }
2694
- function useKeyboardOpen(isAndroid = false) {
2695
- const [keyOpen, setKeyOpen] = useState(false);
2696
- useEffect(() => {
2697
- var _a;
2698
- const initialHeight = window.innerHeight;
2699
- const onResize = () => {
2700
- var _a, _b;
2701
- const diff = initialHeight - ((_b = (_a = window.visualViewport) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b : window.innerHeight);
2702
- if (diff > 150) {
2703
- console.log('🟡 Keyboard likely opened');
2704
- setKeyOpen(true);
2705
- }
2706
- else {
2707
- console.log('⚪️ Keyboard likely closed');
2708
- setKeyOpen(false);
2709
- }
2710
- };
2711
- (_a = window.visualViewport) === null || _a === void 0 ? void 0 : _a.addEventListener('resize', onResize);
2712
- return () => { var _a; return (_a = window.visualViewport) === null || _a === void 0 ? void 0 : _a.removeEventListener('resize', onResize); };
2713
- }, [isAndroid]);
2714
- return keyOpen;
2715
- }
2716
-
2717
- function isMac() {
2718
- return testPlatform(/^Mac/);
2719
- }
2720
- function isIPhone() {
2721
- return testPlatform(/^iPhone/);
2722
- }
2723
- function isIPad() {
2724
- return (testPlatform(/^iPad/) ||
2725
- // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
2726
- (isMac() && navigator.maxTouchPoints > 1));
2727
- }
2728
- function isIOS() {
2729
- return isIPhone() || isIPad();
2730
- }
2731
- function testPlatform(re) {
2732
- return typeof window !== 'undefined' && window.navigator != null
2733
- ? re.test(window.navigator.platform)
2734
- : undefined;
2735
- }
2736
-
2737
- function chain(...callbacks) {
2738
- return (...args) => {
2739
- for (const callback of callbacks) {
2740
- if (typeof callback === 'function') {
2741
- callback(...args);
2742
- }
2743
- }
2744
- };
2745
- }
2746
-
2747
- function isScrollable(node) {
2748
- const style = window.getComputedStyle(node);
2749
- return /(auto|scroll)/.test(style.overflow + style.overflowX + style.overflowY);
2750
- }
2751
-
2752
- const getParentScroll = (element) => {
2753
- if (element === document.documentElement || element === document.body) {
2754
- return element;
2755
- }
2756
- const parentElement = element.parentElement;
2757
- if (isScrollable(parentElement)) {
2758
- return parentElement;
2759
- }
2760
- return getParentScroll(parentElement);
2761
- };
2762
-
2763
- // This code comes from https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/overlays/src/usePreventScroll.ts
2764
- const KEYBOARD_BUFFER = 24;
2765
- const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
2766
- // @ts-ignore
2767
- const visualViewport = typeof document !== 'undefined' && window.visualViewport;
2768
- // HTML input types that do not cause the software keyboard to appear.
2769
- const nonTextInputTypes = new Set([
2770
- 'checkbox',
2771
- 'radio',
2772
- 'range',
2773
- 'color',
2774
- 'file',
2775
- 'image',
2776
- 'button',
2777
- 'submit',
2778
- 'reset',
2779
- ]);
2780
- // The number of active usePreventScroll calls. Used to determine whether to revert back to the original page style/scroll position
2781
- let preventScrollCount = 0;
2782
- let restore;
2783
- /**
2784
- * Prevents scrolling on the document body on mount, and
2785
- * restores it on unmount. Also ensures that content does not
2786
- * shift due to the scrollbars disappearing.
2787
- */
2788
- function usePreventScroll(options = {}) {
2789
- const { isDisabled } = options;
2790
- useIsomorphicLayoutEffect(() => {
2791
- if (isDisabled) {
2792
- return;
2793
- }
2794
- preventScrollCount++;
2795
- if (preventScrollCount === 1) {
2796
- if (isIOS()) {
2797
- restore = preventScrollMobileSafari();
2798
- }
2799
- }
2800
- return () => {
2801
- preventScrollCount--;
2802
- if (preventScrollCount === 0) {
2803
- restore === null || restore === void 0 ? void 0 : restore();
2804
- }
2805
- };
2806
- }, [isDisabled]);
2807
- }
2808
- // Mobile Safari is a whole different beast. Even with overflow: hidden,
2809
- // it still scrolls the page in many situations:
2810
- //
2811
- // 1. When the bottom toolbar and address bar are collapsed, page scrolling is always allowed.
2812
- // 2. When the keyboard is visible, the viewport does not resize. Instead, the keyboard covers part of
2813
- // it, so it becomes scrollable.
2814
- // 3. When tapping on an input, the page always scrolls so that the input is centered in the visual viewport.
2815
- // This may cause even fixed position elements to scroll off the screen.
2816
- // 4. When using the next/previous buttons in the keyboard to navigate between inputs, the whole page always
2817
- // scrolls, even if the input is inside a nested scrollable element that could be scrolled instead.
2818
- //
2819
- // In order to work around these cases, and prevent scrolling without jankiness, we do a few things:
2820
- //
2821
- // 1. Prevent default on `touchmove` events that are not in a scrollable element. This prevents touch scrolling
2822
- // on the window.
2823
- // 2. Prevent default on `touchmove` events inside a scrollable element when the scroll position is at the
2824
- // top or bottom. This avoids the whole page scrolling instead, but does prevent overscrolling.
2825
- // 3. Prevent default on `touchend` events on input elements and handle focusing the element ourselves.
2826
- // 4. When focusing an input, apply a transform to trick Safari into thinking the input is at the top
2827
- // of the page, which prevents it from scrolling the page. After the input is focused, scroll the element
2828
- // into view ourselves, without scrolling the whole page.
2829
- // 5. Offset the body by the scroll position using a negative margin and scroll to the top. This should appear the
2830
- // same visually, but makes the actual scroll position always zero. This is required to make all of the
2831
- // above work or Safari will still try to scroll the page when focusing an input.
2832
- // 6. As a last resort, handle window scroll events, and scroll back to the top. This can happen when attempting
2833
- // to navigate to an input with the next/previous buttons that's outside a modal.
2834
- function preventScrollMobileSafari() {
2835
- let scrollable;
2836
- let lastY = 0;
2837
- const onTouchStart = (e) => {
2838
- // Store the nearest scrollable parent element from the element that the user touched.
2839
- scrollable = getParentScroll(e.target);
2840
- if (scrollable === document.documentElement &&
2841
- scrollable === document.body) {
2842
- return;
2843
- }
2844
- lastY = e.changedTouches[0].pageY;
2845
- };
2846
- const onTouchMove = (e) => {
2847
- // Prevent scrolling the window.
2848
- if (!scrollable ||
2849
- scrollable === document.documentElement ||
2850
- scrollable === document.body) {
2851
- e.preventDefault();
2852
- return;
2853
- }
2854
- // Prevent scrolling up when at the top and scrolling down when at the bottom
2855
- // of a nested scrollable area, otherwise mobile Safari will start scrolling
2856
- // the window instead. Unfortunately, this disables bounce scrolling when at
2857
- // the top but it's the best we can do.
2858
- const y = e.changedTouches[0].pageY;
2859
- const scrollTop = scrollable.scrollTop;
2860
- const bottom = scrollable.scrollHeight - scrollable.clientHeight;
2861
- if (bottom === 0) {
2862
- return;
2863
- }
2864
- if ((scrollTop <= 0 && y > lastY) || (scrollTop >= bottom && y < lastY)) {
2865
- e.preventDefault();
2866
- }
2867
- lastY = y;
2868
- };
2869
- const onTouchEnd = (e) => {
2870
- const target = e.target;
2871
- // Apply this change if we're not already focused on the target element
2872
- if (isInput(target) && target !== document.activeElement) {
2873
- e.preventDefault();
2874
- // Apply a transform to trick Safari into thinking the input is at the top of the page
2875
- // so it doesn't try to scroll it into view. When tapping on an input, this needs to
2876
- // be done before the "focus" event, so we have to focus the element ourselves.
2877
- target.style.transform = 'translateY(-2000px)';
2878
- target.focus();
2879
- requestAnimationFrame(() => {
2880
- target.style.transform = '';
2881
- });
2882
- }
2883
- };
2884
- const onFocus = (e) => {
2885
- const target = e.target;
2886
- if (isInput(target)) {
2887
- // Transform also needs to be applied in the focus event in cases where focus moves
2888
- // other than tapping on an input directly, e.g. the next/previous buttons in the
2889
- // software keyboard. In these cases, it seems applying the transform in the focus event
2890
- // is good enough, whereas when tapping an input, it must be done before the focus event. 🤷‍♂️
2891
- target.style.transform = 'translateY(-2000px)';
2892
- requestAnimationFrame(() => {
2893
- target.style.transform = '';
2894
- // This will have prevented the browser from scrolling the focused element into view,
2895
- // so we need to do this ourselves in a way that doesn't cause the whole page to scroll.
2896
- if (visualViewport) {
2897
- if (visualViewport.height < window.innerHeight) {
2898
- // If the keyboard is already visible, do this after one additional frame
2899
- // to wait for the transform to be removed.
2900
- requestAnimationFrame(() => {
2901
- scrollIntoView(target);
2902
- });
2903
- }
2904
- else {
2905
- // Otherwise, wait for the visual viewport to resize before scrolling so we can
2906
- // measure the correct position to scroll to.
2907
- visualViewport.addEventListener('resize', () => scrollIntoView(target), { once: true });
2908
- }
2909
- }
2910
- });
2911
- }
2912
- };
2913
- const onWindowScroll = () => {
2914
- // Last resort. If the window scrolled, scroll it back to the top.
2915
- // It should always be at the top because the body will have a negative margin (see below).
2916
- window.scrollTo(0, 0);
2917
- };
2918
- // Record the original scroll position so we can restore it.
2919
- // Then apply a negative margin to the body to offset it by the scroll position. This will
2920
- // enable us to scroll the window to the top, which is required for the rest of this to work.
2921
- const scrollX = window.pageXOffset;
2922
- const scrollY = window.pageYOffset;
2923
- const restoreStyles = chain(setStyle(document.documentElement, 'paddingRight', `${window.innerWidth - document.documentElement.clientWidth}px`));
2924
- // Scroll to the top. The negative margin on the body will make this appear the same.
2925
- window.scrollTo(0, 0);
2926
- const removeEvents = chain(addEvent(document, 'touchstart', onTouchStart, {
2927
- passive: false,
2928
- capture: true,
2929
- }), addEvent(document, 'touchmove', onTouchMove, {
2930
- passive: false,
2931
- capture: true,
2932
- }), addEvent(document, 'touchend', onTouchEnd, {
2933
- passive: false,
2934
- capture: true,
2935
- }), addEvent(document, 'focus', onFocus, true), addEvent(window, 'scroll', onWindowScroll));
2936
- return () => {
2937
- // Restore styles and scroll the page back to where it was.
2938
- restoreStyles();
2939
- removeEvents();
2940
- window.scrollTo(scrollX, scrollY);
2941
- };
2942
- }
2943
- // Sets a CSS property on an element, and returns a function to revert it to the previous value.
2944
- function setStyle(element, style, value) {
2945
- // https://github.com/microsoft/TypeScript/issues/17827#issuecomment-391663310
2946
- // @ts-ignore
2947
- const cur = element.style[style];
2948
- // @ts-ignore
2949
- element.style[style] = value;
2950
- return () => {
2951
- // @ts-ignore
2952
- element.style[style] = cur;
2953
- };
2954
- }
2955
- // Adds an event listener to an element, and returns a function to remove it.
2956
- function addEvent(target, event, handler, options) {
2957
- // @ts-ignore
2958
- target.addEventListener(event, handler, options);
2959
- return () => {
2960
- // @ts-ignore
2961
- target.removeEventListener(event, handler, options);
2962
- };
2963
- }
2964
- function scrollIntoView(target) {
2965
- const root = document.scrollingElement || document.documentElement;
2966
- while (target && target !== root) {
2967
- // Find the parent scrollable element and adjust the scroll position if the target is not already in view.
2968
- const scrollable = getParentScroll(target);
2969
- if (scrollable !== document.documentElement &&
2970
- scrollable !== document.body &&
2971
- scrollable !== target) {
2972
- const scrollableTop = scrollable.getBoundingClientRect().top;
2973
- const targetTop = target.getBoundingClientRect().top;
2974
- const targetBottom = target.getBoundingClientRect().bottom;
2975
- // Buffer is needed for some edge cases
2976
- const keyboardHeight = scrollable.getBoundingClientRect().bottom + KEYBOARD_BUFFER;
2977
- if (targetBottom > keyboardHeight) {
2978
- scrollable.scrollTop += targetTop - scrollableTop;
2979
- }
2980
- }
2981
- // @ts-ignore
2982
- target = scrollable.parentElement;
2983
- }
2984
- }
2985
- function isInput(target) {
2986
- return ((target instanceof HTMLInputElement &&
2987
- !nonTextInputTypes.has(target.type)) ||
2988
- target instanceof HTMLTextAreaElement ||
2989
- (target instanceof HTMLElement && target.isContentEditable));
2990
- }
2991
-
2992
- const StyledLeadGenLightBoxBFooter = styled.div `
2993
- padding-top: calc(var(--spacing-y, 20px) * 8 / 20);
2994
- padding-inline: var(--spacing-x, 20px);
2995
- padding-bottom: var(--spacing-y, 20px);
2996
- `;
2997
- const StyledLeadGenLightBoxBBody = styled.div `
2998
- flex: 1;
2999
- min-height: 0;
3000
- overflow: auto;
3001
- padding-inline: var(--spacing-y, 20px);
3002
- padding-block: calc(var(--spacing-x, 20px) * 8 / 20);
3003
- &::-webkit-scrollbar {
3004
- width: 6px;
3005
- height: 6px;
3006
- }
3007
-
3008
- &::-webkit-scrollbar-track {
3009
- background-color: transparent;
3010
- }
3011
-
3012
- &::-webkit-scrollbar-thumb {
3013
- background-color: rgba(0, 0, 0, 0.4);
3014
- border-radius: 6px;
3015
- }
3016
- `;
3017
- const StyledLeadGenLightBoxBHeader = styled.div `
3018
- display: flex;
3019
- padding-top: var(--spacing-y, 20px);
3020
- padding-inline: var(--spacing-x, 20px);
3021
- padding-bottom: calc(var(--spacing-y, 20px) * 8 / 20);
3022
- `;
3023
- const StyledLeadGenLightBoxBWrapper = styled.div `
3024
- height: 100%;
3025
- display: flex;
3026
- flex-direction: column;
3027
- `;
3028
- const StyledLeadGenLightBoxB = styled.div `
3029
- --spacing-x: 20px;
3030
- --spacing-y: 20px;
3031
- --close-width: 24px;
3032
- --close-height: 24px;
3033
-
3034
- // For old version, Wrap every thing in children
3035
- &[data-type='LightBoxB_typeA'] {
3036
- height: 100%;
3037
- width: 100%;
3038
- .leadgen-wrapper,
3039
- .leadgen-inner,
3040
- .leadgen-form {
3041
- height: 100%;
3042
- }
3043
- .leadgen-content {
3044
- height: 100%;
3045
- display: flex;
3046
- flex-direction: column;
3047
- }
3048
- .leadgen-header {
3049
- display: none;
3050
- }
3051
- .leadgen-title {
3052
- padding-right: calc(var(--close-width, 24px) * 50 / 24);
3053
- }
3054
- .leadgen-description {
3055
- display: none;
3056
- }
3057
- .leadgen-body {
3058
- flex: 1;
3059
- min-height: 0;
3060
- }
3061
-
3062
- .leadgen-close_btn {
3063
- top: var(--spacing-y, 20px);
3064
- right: var(--spacing-x, 20px);
3065
- width: var(--close-width, 24px) !important;
3066
- height: var(--close-height, 24px);
3067
- box-shadow: none;
3068
- font-size: 24px;
3069
- }
3070
-
3071
- .leadgen-empty_footer {
3072
- .leadgen-btn {
3073
- flex: 1;
3074
- min-width: 0;
3075
- }
3076
- }
3077
-
3078
- .leadgen-form_body {
3079
- overflow: auto;
3080
- animation: scrolling forwards;
3081
- animation-timeline: scroll(self);
3082
- }
3083
- @keyframes scrolling {
3084
- 0%,
3085
- to {
3086
- border-bottom: 1px solid ${theme.colors.neutral100};
3087
- }
3088
- }
3089
- }
3090
- `;
3091
- const StyledMotionContainer = styled(motion.div) `
3092
- position: fixed;
3093
- inset: 0;
3094
- z-index: ${ZINDEX_SSO + 1};
3095
- background-color: #fff;
3096
- `;
3097
-
3098
- const PREFIX_CLS = 'LightBoxB_typeA';
3099
- const DURATION = 1000 * 0.5;
3100
- const DRAWER_STYLE = {
3101
- visible: {
3102
- opacity: 1,
3103
- translateY: '0px',
3104
- transitionProperty: 'translate',
3105
- transitionDuration: '0.25s',
3106
- },
3107
- hidden: {
3108
- opacity: 0,
3109
- translateY: '100%',
3110
- transitionProperty: 'translate',
3111
- transitionDuration: '0.25s',
3112
- },
3113
- };
3114
- const LeadGenLightBoxBTypeA = (props) => {
3115
- const { visible, onVisible, icon, title, buttonText, blocks, children } = props, restProps = __rest(props, ["visible", "onVisible", "icon", "title", "buttonText", "blocks", "children"]);
3116
- const formRef = useRef();
3117
- const [open, setOpen] = useState(visible);
3118
- const { height } = useViewportDimensions();
3119
- usePreventScroll();
3120
- const onOpenChange = useCallback((open) => {
3121
- if (!open) {
3122
- // Wait for duration of animation
3123
- setTimeout(() => {
3124
- onVisible === null || onVisible === void 0 ? void 0 : onVisible(open);
3125
- }, DURATION);
3126
- return;
3127
- }
3128
- onVisible === null || onVisible === void 0 ? void 0 : onVisible(open);
3129
- }, [onVisible]);
3130
- const iconComp = useMemo(() => {
3131
- if (!icon) {
3132
- return null;
3133
- }
3134
- return React__default.createElement(React__default.Fragment, null);
3135
- }, [icon]);
3136
- const titleComp = useMemo(() => {
3137
- if (!title) {
3138
- return null;
3139
- }
3140
- return title;
3141
- }, [title]);
3142
- const childrenComp = useMemo(() => {
3143
- if (children) {
3144
- return children;
3145
- }
3146
- return (React__default.createElement(StyledLeadGenLightBoxBWrapper, { className: `${PREFIX_CLS}_wrapper lightboxB_wrapper` },
3147
- React__default.createElement(StyledLeadGenLightBoxBHeader, { className: `${PREFIX_CLS}_header lightboxB_header` },
3148
- React__default.createElement("div", { className: "lightBoxB_header_icon" }, iconComp),
3149
- React__default.createElement("div", { className: "lightBoxB_header_title" }, titleComp),
3150
- React__default.createElement("div", { className: "lightBoxB_header_close", onClick: () => onOpenChange(false) },
3151
- React__default.createElement(CloseButton, null))),
3152
- React__default.createElement(StyledLeadGenLightBoxBBody, { className: `${PREFIX_CLS}_body lightboxB_body` },
3153
- React__default.createElement(LeadGenForm, Object.assign({ ref: formRef, blocks: blocks }, restProps))),
3154
- React__default.createElement(StyledLeadGenLightBoxBFooter, { className: `${PREFIX_CLS}_footer lightboxB_footer` },
3155
- React__default.createElement(Button, { onClick: () => { var _a; return (_a = formRef.current) === null || _a === void 0 ? void 0 : _a.submit(); } }, buttonText))));
3156
- }, [children, onOpenChange]);
3157
- useEffect(() => {
3158
- setOpen(visible);
3159
- }, [visible]);
3160
- return (React__default.createElement(StyledMotionContainer, { animate: open ? 'visible' : 'hidden', variants: DRAWER_STYLE },
3161
- React__default.createElement(StyledLeadGenLightBoxB, { "data-type": "LightBoxB_typeA", style: height ? { maxHeight: height } : undefined }, childrenComp)));
3162
- };
3163
-
3164
- const LeadGenLightBoxB = (props) => {
3165
- return React__default.createElement(LeadGenLightBoxBTypeA, Object.assign({}, props));
3166
- };
3167
-
3168
- const ThankyouPopup = ({ title, titleAlign, subtitle, subtitleAlign, link, linkNewTab, linkText, image, }) => {
3169
- const { primaryColor } = useContext(LeadGenContext);
3170
- const { width: imageWidth, height: imageHeight, loaded: imageLoaded, } = useImageSize(image);
3171
- if (!imageLoaded)
3172
- return null;
3173
- return (React__default.createElement("div", { className: "lead-modal__thank-you leadgen-inner_thankyou" },
3174
- React__default.createElement("div", { style: { width: '100%' } },
3175
- React__default.createElement("img", { src: image, style: {
3176
- maxHeight: 162,
3177
- objectFit: 'cover',
3178
- aspectRatio: `${imageWidth}/${imageHeight}`,
3179
- }, loading: "lazy" }),
3180
- title && (React__default.createElement(Text, { size: "h4", weight: "semiBold", variant: "primary", as: "h3", className: `le-thankyou-title le-text-align-${titleAlign}` }, title)),
3181
- subtitle && (React__default.createElement(Text, { size: "p2", variant: "secondary", className: `le-thankyou-subtitle le-text-align-${subtitleAlign}` }, subtitle.split('\n').map((text, idx, list) => {
3182
- const isShowBr = idx < list.length - 1;
3183
- return (React__default.createElement(React__default.Fragment, null,
3184
- text,
3185
- isShowBr && React__default.createElement("br", null)));
3186
- }))),
3187
- linkText && (React__default.createElement("div", null,
3188
- React__default.createElement("a", { href: link, target: linkNewTab ? '_blank' : 'parrent', rel: "noreferrer" },
3189
- React__default.createElement(Button, { className: `lead-modal__btn ${LEAD_CLASS}`, color: primaryColor }, linkText)))))));
3190
- };
3191
-
3192
- const InlineLayout = ({ content, inlinePosition, doImpression, }) => {
3193
- const target = useMemo(() => {
3194
- if (!inlinePosition)
3195
- return null;
3196
- const parents = document.querySelectorAll(`[data-url="${location.pathname}"] .body-content`);
3197
- const allChildren = Array.from(parents).reduce((r, p) => {
3198
- return [...r, ...Array.from(p.children)];
3199
- }, []);
3200
- if (allChildren === null || allChildren === void 0 ? void 0 : allChildren.length) {
3201
- // find the third p tag in the body content, some other tags might mix in between
3202
- const allPTags = allChildren.filter((c) => c.nodeName === 'P');
3203
- const allH2Tags = allChildren.filter((c) => c.nodeName === 'H2');
3204
- let target = null;
3205
- switch (inlinePosition) {
3206
- case '1th':
3207
- target = allPTags[0];
3208
- break;
3209
- case '2th':
3210
- target = allPTags[1];
3211
- break;
3212
- case '3th':
3213
- target = allPTags[2];
3214
- break;
3215
- case '4th':
3216
- target = allPTags[3];
3217
- break;
3218
- case '5th':
3219
- target = allPTags[4];
3220
- break;
3221
- case '6th':
3222
- target = allPTags[5];
3223
- break;
3224
- case '7th':
3225
- target = allPTags[6];
3226
- break;
3227
- case '8th':
3228
- target = allPTags[7];
3229
- break;
3230
- case '9th':
3231
- target = allPTags[8];
3232
- break;
3233
- case '10th':
3234
- target = allPTags[9];
3235
- break;
3236
- case '11th':
3237
- target = allPTags[10];
3238
- break;
3239
- case '12th':
3240
- target = allPTags[11];
3241
- break;
3242
- case 'lastP':
3243
- target = allPTags[allPTags.length - 1];
3244
- break;
3245
- case '1thH2':
3246
- target = allH2Tags[0];
3247
- break;
3248
- case '2thH2':
3249
- target = allH2Tags[1];
3250
- break;
3251
- case '3thH2':
3252
- target = allH2Tags[2];
3253
- break;
3254
- case '4thH2':
3255
- target = allH2Tags[3];
3256
- break;
3257
- case '5thH2':
3258
- target = allH2Tags[4];
3259
- break;
3260
- case '6thH2':
3261
- target = allH2Tags[5];
3262
- break;
3263
- case '7thH2':
3264
- target = allH2Tags[6];
3265
- break;
3266
- case '8thH2':
3267
- target = allH2Tags[7];
3268
- break;
3269
- case '9thH2':
3270
- target = allH2Tags[8];
3271
- break;
3272
- case '10thH2':
3273
- target = allH2Tags[9];
3274
- break;
3275
- case 'lastH2':
3276
- target = allH2Tags[allH2Tags.length - 1];
3277
- break;
3278
- }
3279
- if (target) {
3280
- if (!target.parentElement.querySelector('.inline-lead-wrapper')) {
3281
- const wrapper = document.createElement('div');
3282
- wrapper.classList.add('inline-lead-wrapper');
3283
- if (target.nextElementSibling) {
3284
- target.parentElement.insertBefore(wrapper, target.nextElementSibling);
3285
- }
3286
- else {
3287
- target.parentElement.appendChild(wrapper);
3288
- }
3289
- return wrapper;
3290
- }
3291
- else {
3292
- return target.parentElement.querySelector('.inline-lead-wrapper');
3293
- }
3294
- }
3295
- }
3296
- }, [inlinePosition]);
3297
- if (!inlinePosition || !target)
3298
- return null;
3299
- return createPortal(React__default.createElement(ImpressionTrackingWrapper, { onImpression: () => __awaiter(void 0, void 0, void 0, function* () { return yield doImpression(); }) }, content), target);
3300
- };
3301
-
3302
- const SideBarLayout = ({ content }) => {
3303
- const targets = useMemo(() => {
3304
- const targetDoms = Array.from(document.querySelectorAll('.hc2-sidebar-with-ads,.page-main-col .right-col.f-right,.hhg-lead-sidebar'));
3305
- targetDoms.forEach((dom) => {
3306
- if (dom.querySelector('.sidebar-lead-modal-wrapper'))
3307
- return;
3308
- const wrapper = document.createElement('div');
3309
- wrapper.classList.add('sidebar-lead-modal-wrapper');
3310
- dom.prepend(wrapper);
3311
- });
3312
- return targetDoms.map((d) => d.querySelector('.sidebar-lead-modal-wrapper'));
3313
- }, []);
3314
- return (React__default.createElement(React__default.Fragment, null, targets.map((target) => createPortal(content, getWrapperDomWithSelector(target, 'sidebar-lead-modal-wrapper')))));
3315
- };
3316
-
3317
- const EmptyIcon = (props) => {
3318
- const { className, style } = props;
3319
- return (React__default.createElement("svg", { width: "160", height: "160", viewBox: "0 0 160 160", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, style: style },
3320
- React__default.createElement("path", { d: "M79.9974 113.333C98.4069 113.333 113.331 98.4096 113.331 80.0001C113.331 61.5906 98.4069 46.6667 79.9974 46.6667C61.5879 46.6667 46.6641 61.5906 46.6641 80.0001C46.6641 98.4096 61.5879 113.333 79.9974 113.333Z", fill: "#F44D2C" }),
3321
- React__default.createElement("path", { d: "M92.434 95.0004C91.7771 95.0004 91.1213 94.7499 90.6194 94.249L65.7521 69.3807C64.7493 68.3779 64.7493 66.7542 65.7521 65.7524C66.7549 64.7507 68.3786 64.7497 69.3804 65.7524L94.2487 90.6208C95.2515 91.6235 95.2515 93.2473 94.2487 94.249C93.7468 94.7499 93.0909 95.0004 92.434 95.0004Z", fill: "white" }),
3322
- React__default.createElement("path", { d: "M67.5648 95C66.9079 95 66.252 94.7496 65.7501 94.2487C64.7474 93.2459 64.7474 91.6222 65.7501 90.6204L90.6185 65.7521C91.6212 64.7493 93.245 64.7493 94.2467 65.7521C95.2485 66.7549 95.2495 68.3786 94.2467 69.3804L69.3794 94.2487C68.8786 94.7496 68.2217 95 67.5648 95Z", fill: "white" })));
3323
- };
3324
-
3325
- const EmptyComponent = ({ onClose, onContinue, }) => {
3326
- const { t } = useLeadGenTranslations();
3327
- return (React__default.createElement("div", { className: "leadgen-empty" },
3328
- React__default.createElement("div", { className: "leadgen-empty_body" },
3329
- React__default.createElement("div", { className: "leadgen-empty_wrapper" },
3330
- React__default.createElement(EmptyIcon, { className: "leadgen-empty_image" }),
3331
- React__default.createElement("h5", { className: "leadgen-empty_title" }, t('lead.empty.title')))),
3332
- React__default.createElement("div", { className: "leadgen-empty_footer" },
3333
- React__default.createElement(Button$1, { onClick: onClose, size: "lg", variant: "default", fullWidth: false, className: "leadgen-btn leadgen-btn_empty_cancel" }, t('lead.empty.cancel')),
3334
- React__default.createElement(Button$1, { onClick: onContinue, size: "lg", variant: "filled", fullWidth: false, className: "leadgen-btn leadgen-btn_empty_again" }, t('lead.empty.submitAgain')))));
3335
- };
3336
-
3337
- const SubtitleBlock = ({ children, align, }) => (React__default.createElement("p", { className: `lead-modal__description ${'le-text-align-' + (align || '')} ${LEAD_CLASS}` }, children));
3338
-
3339
- const TitleBlock = ({ children, align, }) => (React__default.createElement("h2", { className: `lead-modal__title ${'le-text-align-' + (align || '')} ${LEAD_CLASS}` }, children));
3340
-
3341
- const LightboxFields = ({ listBlockAdded, popupId, locale, hasSubmitBtn, isSubmitLoading, disabledButtonSubmit, }) => {
3342
- const { t } = useLeadGenTranslations();
3343
- const { setRedirectUrl } = useContext(LeadGenContext);
3344
- const form = useLeadFormContext();
3345
- const formValues = form.values;
3346
- const labelTuples = useMemo(() => {
3347
- return ((ISO_FORMAT === null || ISO_FORMAT === void 0 ? void 0 : ISO_FORMAT[locale]) || ISO_FORMAT['vi-VN']).dateFormat
3348
- .split('/')
3349
- .map((key) => { var _a; return t((_a = COMMON_DATE_TRANSLATE_KEY === null || COMMON_DATE_TRANSLATE_KEY === void 0 ? void 0 : COMMON_DATE_TRANSLATE_KEY[key]) === null || _a === void 0 ? void 0 : _a.id); });
3350
- }, [locale]);
3351
- return (React__default.createElement(React__default.Fragment, null, listBlockAdded.map((b, index) => {
3352
- var _a;
3353
- const { name = '', data = {}, id } = b || {};
3354
- const { placeholder: label, value, align, listQuestion, isSendMailChimp = false, newtab, url, } = data;
3355
- const required = (_a = data.required) !== null && _a !== void 0 ? _a : true;
3356
- const formValue = (formValues === null || formValues === void 0 ? void 0 : formValues[value]) || null;
3357
- switch (name) {
3358
- case 'TitleBlock':
3359
- return (React__default.createElement(TitleBlock, { key: index, align: align }, value));
3360
- case 'SubtitleBlock':
3361
- return (React__default.createElement(SubtitleBlock, { key: index, align: align }, value));
3362
- case 'TextBlock':
3363
- return (React__default.createElement(TextField, { key: index, shrink: !!formValue, className: "lead-modal__form-control leadgen-form_field" },
3364
- React__default.createElement(TextField.Control, null, ({ shrink }) => (React__default.createElement(TextInput, Object.assign({ withAsterisk: required, spellCheck: false, type: "text", placeholder: " ",
3365
- // className="lead-modal__form-control leadgen-form_field"
3366
- // onChangeRaw={(e) => inputOnChange('text', e)}
3367
- label: React__default.createElement(Text, { size: shrink ? 'p3' : 'p2', variant: "secondary", weight: "halfBold" }, label), "data-control": "text", "data-lead-control": name, "data-is-required": required, inputWrapperOrder: [
3368
- 'label',
3369
- 'input',
3370
- 'description',
3371
- 'error',
3372
- ] }, form.getInputProps(value), { name: value, error: form.errors[value] && (React__default.createElement(Flex, { align: 'center', gap: 4 },
3373
- React__default.createElement(ErrorIcon, { size: 12 }),
3374
- React__default.createElement(Text, { size: "c1", variant: "error" }, form.errors[value]))), styles: (theme) => ({
3375
- input: Object.assign(Object.assign({}, GlobalTextStyleNew(theme)[CustomStylesType.LEADGEN]
3376
- .p2), { color: theme.colors.gray[9], fontWeight: FontWeight.halfBold }),
3377
- }) }))))));
3378
- case 'NumberBlock':
3379
- return (React__default.createElement(TextField, { key: index, shrink: !!formValue, className: "lead-modal__form-control leadgen-form_field" },
3380
- React__default.createElement(TextField.Control, null, ({ shrink }) => (React__default.createElement(NumberInput$1, Object.assign({ withAsterisk: required, spellCheck: false, type: "number", placeholder: " ",
3381
- // className="lead-modal__form-control leadgen-form_field"
3382
- // onChange={(e) => inputOnChange('number', e)}
3383
- label: React__default.createElement(Text, { size: shrink ? 'p3' : 'p2', variant: "secondary", weight: "halfBold" }, label), "data-control": "number", "data-lead-control": name, "data-is-required": required, name: value, inputWrapperOrder: [
3384
- 'label',
3385
- 'input',
3386
- 'description',
3387
- 'error',
3388
- ] }, form.getInputProps(value), { error: form.errors[value] && (React__default.createElement(Flex, { align: 'center', gap: 4 },
3389
- React__default.createElement(ErrorIcon, { size: 12 }),
3390
- React__default.createElement(Text, { size: "c1", variant: "error" }, form.errors[value]))), styles: (theme) => ({
3391
- input: Object.assign(Object.assign({}, GlobalTextStyleNew(theme)[CustomStylesType.LEADGEN]
3392
- .p2), { color: theme.colors.gray[9], fontWeight: FontWeight.halfBold }),
3393
- }) }))))));
3394
- case 'EmailBlock':
3395
- return (React__default.createElement(TextField, { key: index, shrink: !!formValue, className: "lead-modal__form-control leadgen-form_field" },
3396
- React__default.createElement(TextField.Control, null, ({ shrink }) => (React__default.createElement(TextInput, Object.assign({ withAsterisk: required, spellCheck: false,
3397
- // type="email"
3398
- placeholder: " ",
3399
- // className="lead-modal__form-control leadgen-form_field"
3400
- label: React__default.createElement(Text, { size: shrink ? 'p3' : 'p2', variant: "secondary", weight: "halfBold" }, label), "data-control": "email", "data-lead-control": name, "data-is-required": required, name: value, inputWrapperOrder: [
3401
- 'label',
3402
- 'input',
3403
- 'description',
3404
- 'error',
3405
- ] }, form.getInputProps(value), { error: form.errors[value] && (React__default.createElement(Flex, { align: 'center', gap: 4 },
3406
- React__default.createElement(ErrorIcon, { size: 12 }),
3407
- React__default.createElement(Text, { size: "c1", variant: "error" }, form.errors[value]))), styles: (theme) => ({
3408
- input: Object.assign(Object.assign({}, GlobalTextStyleNew(theme)[CustomStylesType.LEADGEN]
3409
- .p2), { color: theme.colors.gray[9], fontWeight: FontWeight.halfBold }),
3410
- }) }))))));
3411
- case 'PhoneOtpBlock':
3412
- case 'WhatsappOtpBlock':
3413
- case 'ZaloOtpBlock':
3414
- case 'PhoneBlock': {
3415
- const htmlForId = popupId + '-' + value + '-' + index;
3416
- const _b = form.getInputProps(value), { error } = _b, formPhoneInputWrapper = __rest(_b, ["error"]);
3417
- return (React__default.createElement(TextField, { key: index, shrink: !!formValue, className: clsx('lead-modal__form-control leadgen-form_field', {
3418
- 'leadgen-form_field_error': !!error,
3419
- }) },
3420
- React__default.createElement(TextField.Control, null, ({ shrink }) => (React__default.createElement(Input$1.Wrapper, { size: "md", withAsterisk: required, label: React__default.createElement(Text, { size: shrink ? 'p3' : 'p2', variant: "secondary", weight: "halfBold" }, label), "data-invalid": !!error, labelProps: { htmlFor: htmlForId }, inputWrapperOrder: [
3421
- 'label',
3422
- 'input',
3423
- 'description',
3424
- 'error',
3425
- ], error: form.errors[value] && (React__default.createElement(Flex, { align: 'center', gap: 4 },
3426
- React__default.createElement(ErrorIcon, { size: 12 }),
3427
- React__default.createElement(Text, { size: "c1", variant: "error" }, form.errors[value]))) },
3428
- React__default.createElement(Box, { className: "mantine-Input-wrapper", sx: (theme) => ({
3429
- '.PhoneInput .PhoneInputInput': Object.assign(Object.assign({}, GlobalTextStyleNew(theme)[CustomStylesType.LEADGEN].p2), { color: theme.colors.gray[9], fontWeight: FontWeight.halfBold }),
3430
- }) },
3431
- React__default.createElement(Phone, Object.assign({ className: `mantine-Input-input`, name: value, spellCheck: false, type: "tel", placeholder: " ",
3432
- // onBlur={(e) => inputOnBlur('tel', e)}
3433
- id: htmlForId, defaultCountry: (locale
3434
- ? MAPPED_LOCALE[locale] || 'VN'
3435
- : 'VN'), "data-control": "tel", "data-lead-control": name, "data-is-required": required }, formPhoneInputWrapper))))))));
3436
- }
3437
- case 'LocationBlock': {
3438
- return (React__default.createElement(TextField, { key: index, shrink: !!formValue, className: "lead-modal__form-control leadgen-form_field" },
3439
- React__default.createElement(TextField.Control, null, ({ shrink, hasIcon }) => (React__default.createElement(GoogleLocationBlock, Object.assign({ withAsterisk: required, name: value, placeholder: " ", label: React__default.createElement(Text, { size: shrink ? 'p3' : 'p2', variant: "secondary", weight: "halfBold" }, label), "data-control": "text", "data-lead-control": name, "data-is-required": required, locale: locale, inputWrapperOrder: [
3440
- 'label',
3441
- 'input',
3442
- 'description',
3443
- 'error',
3444
- ] }, form.getInputProps(value), { error: form.errors[value] && (React__default.createElement(Flex, { align: 'center', gap: 4 },
3445
- React__default.createElement(ErrorIcon, { size: 12 }),
3446
- React__default.createElement(Text, { size: "c1", variant: "error" }, form.errors[value]))), styles: (theme) => ({
3447
- input: Object.assign(Object.assign(Object.assign({}, GlobalTextStyleNew(theme)[CustomStylesType.LEADGEN]
3448
- .p2), { color: theme.colors.gray[9], fontWeight: FontWeight.halfBold }), (hasIcon && {
3449
- paddingRight: `${rem(28)} !important`,
3450
- })),
3451
- }) })))),
3452
- React__default.createElement(TextField.Icon, { Icon: MapPin })));
3453
- }
3454
- case 'DateBlock': {
3455
- const _c = form.getInputProps(value), { error } = _c, formInputProps = __rest(_c, ["error"]);
3456
- return (React__default.createElement(Input$1.Wrapper, { key: index, size: "md", withAsterisk: required, label: React__default.createElement(Text, { size: "p2", variant: "primary" }, label), "data-invalid": !!error, inputWrapperOrder: ['label', 'input', 'description', 'error'], error: form.errors[value] && (React__default.createElement(Flex, { align: 'center', gap: 4 },
3457
- React__default.createElement(ErrorIcon, { size: 12 }),
3458
- React__default.createElement(Text, { size: "c1", variant: "error" }, form.errors[value]))), className: "lead-modal__form-control leadgen-form_field" },
3459
- React__default.createElement(InputDate, Object.assign({ name: value, error: Boolean(error), locale: locale, "data-extra": true, "data-name": value, "data-control": "date", "data-lead-control": name, "data-is-required": required, className: "leadgen-form_field_date", labelTuples: labelTuples }, formInputProps))));
3460
- }
3461
- case 'LinkButtonBlock':
3462
- return (React__default.createElement("div", { key: index },
3463
- React__default.createElement(Button, Object.assign({ type: hasSubmitBtn ? 'button' : 'submit', size: "md", className: `lead-modal__btn ${LEAD_CLASS}` }, (!hasSubmitBtn && {
3464
- loading: isSubmitLoading,
3465
- disabled: disabledButtonSubmit,
3466
- }), { onClick: () => {
3467
- if (hasSubmitBtn) {
3468
- window.open(url, newtab ? '_blank' : undefined);
3469
- }
3470
- else {
3471
- setRedirectUrl({
3472
- url,
3473
- target: newtab ? '_blank' : undefined,
3474
- });
3475
- }
3476
- } }), value)));
3477
- case 'CheckboxBlock':
3478
- return (React__default.createElement(ChoiceField, { className: "leadgen-form_checkbox", key: index },
3479
- isSendMailChimp && (React__default.createElement("div", { style: {
3480
- display: 'none',
3481
- }, "data-name": value + '-mailchimp' })),
3482
- React__default.createElement(Checkbox.Group, Object.assign({ withAsterisk: required,
3483
- // className="lead-modal__form-control leadgen-form_field"
3484
- label: React__default.createElement(Text, { size: "p2", variant: "primary" }, label), size: "md", sx: {
3485
- display: 'flex',
3486
- flexDirection: 'column',
3487
- flexWrap: 'wrap',
3488
- gap: 8,
3489
- }, inputWrapperOrder: ['label', 'input', 'description', 'error'], inputContainer: (children) => {
3490
- return (React__default.createElement("div", { className: "leadgen-choiceContainer" }, children));
3491
- } }, form.getInputProps(value), { error: form.errors[value] && (React__default.createElement(Flex, { align: 'center', gap: 4 },
3492
- React__default.createElement(ErrorIcon, { size: 12 }),
3493
- React__default.createElement(Text, { size: "c1", variant: "error" }, form.errors[value]))) }), listQuestion.map((l, _index) => (React__default.createElement(Checkbox, { name: value, key: _index, value: l.value, label: React__default.createElement(Text, { size: "p2", variant: "primary" }, l.placeholder), "data-control": "checkbox", "data-lead-control": name, "data-is-required": required }))))));
3494
- case 'RadioBlock':
3495
- return (React__default.createElement(ChoiceField, { className: "leadgen-form_radio", key: index },
3496
- isSendMailChimp && (React__default.createElement(Input$1, { type: "hidden", name: value + '-mailchimp', value: isSendMailChimp })),
3497
- React__default.createElement(Radio.Group, Object.assign({ withAsterisk: required,
3498
- // className="lead-modal__form-control leadgen-form_field"
3499
- label: React__default.createElement(Text, { size: "p2", variant: "primary" }, label), size: "md", inputWrapperOrder: ['label', 'input', 'description', 'error'], inputContainer: (children) => {
3500
- return (React__default.createElement("div", { className: "leadgen-choiceContainer" }, children));
3501
- } }, form.getInputProps(value), { error: form.errors[value] && (React__default.createElement(Flex, { align: 'center', gap: 4 },
3502
- React__default.createElement(ErrorIcon, { size: 12 }),
3503
- React__default.createElement(Text, { size: "c1", variant: "error" }, form.errors[value]))) }), listQuestion.map((l, _index) => (React__default.createElement(Radio, { name: value, key: _index, value: l.value, label: React__default.createElement(Text, { size: "p2", variant: "primary" }, l.placeholder), "data-control": "radio", "data-lead-control": name, "data-is-required": required }))))));
3504
- case 'DropdownBlock':
3505
- return (React__default.createElement(TextField, { shrink: !!formValue, className: "lead-modal__form-control leadgen-form_field DropdownBlock", key: index },
3506
- React__default.createElement(TextField.Control, null, ({ shrink }) => (React__default.createElement(React__default.Fragment, null,
3507
- React__default.createElement("div", { style: { display: 'none' }, "data-extra": true, "data-name": value, "data-control": 'dropdown', "data-lead-control": name, "data-is-required": required }),
3508
- React__default.createElement(Select
3509
- // className="lead-modal__form-control leadgen-form_field"
3510
- , Object.assign({
3511
- // className="lead-modal__form-control leadgen-form_field"
3512
- label: React__default.createElement(Text, { size: shrink ? 'p3' : 'p2', variant: "secondary", weight: "halfBold" }, label), placeholder: " ", searchable: true, withAsterisk: required, name: value, data: listQuestion.map((l) => ({
3513
- value: l.value,
3514
- label: l.placeholder,
3515
- })), nothingFound: React__default.createElement(NoData, null), rightSection: React__default.createElement(TextField.Icon, { Icon: ChevronDown }), styles: (theme) => ({
3516
- wrapper: {
3517
- input: Object.assign(Object.assign({}, GlobalTextStyleNew(theme)[CustomStylesType.LEADGEN].p2), { color: theme.colors.gray[9], fontWeight: FontWeight.halfBold }),
3518
- },
3519
- item: {
3520
- paddingBlock: 12,
3521
- paddingInline: 10,
3522
- fontSize: 16,
3523
- lineHeight: 1.5,
3524
- },
3525
- nothingFound: {
3526
- fontSize: 54,
3527
- paddingBlock: 30,
3528
- },
3529
- itemsWrapper: {
3530
- padding: 6,
3531
- },
3532
- dropdown: {
3533
- '.mantine-ScrollArea-scrollbar[data-orientation="vertical"]': {
3534
- '--radix-scroll-area-thumb-width': '6px',
3535
- width: 'var(--radix-scroll-area-thumb-width)',
3536
- paddingInline: 0,
3537
- },
3538
- },
3539
- }), maxDropdownHeight: 192 }, form.getInputProps(value), { error: form.errors[value] && (React__default.createElement(Flex, { align: 'center', gap: 4 },
3540
- React__default.createElement(ErrorIcon, { size: 12 }),
3541
- React__default.createElement(Text, { size: "c1", variant: "error" }, form.errors[value]))) })))))));
3542
- case 'TncBlock':
3543
- const _d = form.getInputProps(`TNC-${id}`), { error } = _d, tncInputProps = __rest(_d, ["error"]);
3544
- return (React__default.createElement(ChoiceField, { className: "leadgen-form_checkbox", key: id },
3545
- React__default.createElement(Input$1.Wrapper, { error: error && (React__default.createElement(Flex, { align: 'center', gap: 4 },
3546
- React__default.createElement(ErrorIcon, { size: 12 }),
3547
- React__default.createElement(Text, { size: "c1", variant: "error" }, error))) },
3548
- React__default.createElement(Checkbox, Object.assign({ name: 'TNC-' + id, label: React__default.createElement(Text, { as: "span", size: "c1", variant: "secondary", dangerouslySetInnerHTML: { __html: data.valueHTML }, styles: (theme) => ({
3549
- root: {
3550
- a: {
3551
- textDecoration: 'underline !important',
3552
- textUnderlineOffset: '3px',
3553
- color: `${theme.colors.gray[7]} !important`,
3554
- },
3555
- },
3556
- }) }), className: "tnc-block", "data-control": "checkbox", "data-lead-control": name, "data-is-required": required }, tncInputProps)))));
3557
- }
3558
- return null;
3559
- })));
3560
- };
3561
-
3562
- const StyledFormContainer = styled.div `
3563
- height: 100%;
3564
- .leadgen-form_wrapper {
3565
- height: 100%;
3566
- display: flex;
3567
- flex-direction: column;
3568
- }
3569
-
3570
- .leadgen-form_inner {
3571
- flex: 1;
3572
- min-height: 0;
3573
- display: flex;
3574
-
3575
- &:has(.leadgen-header) {
3576
- display: block;
3577
- }
3578
- }
3579
-
3580
- .leadgen-form_body {
3581
- flex: 1;
3582
- min-height: 0;
3583
- ${MediaQueries.mbUp} {
3584
- overflow: auto;
3585
- }
3586
-
3587
- &::-webkit-scrollbar {
3588
- width: 6px;
3589
- height: 6px;
3590
- }
3591
-
3592
- &::-webkit-scrollbar-track {
3593
- background-color: transparent;
3594
- }
3595
-
3596
- &::-webkit-scrollbar-thumb {
3597
- background-color: rgba(0, 0, 0, 0.4);
3598
- border-radius: 6px;
3599
- }
3600
- }
3601
-
3602
- &[data-hidden-form='true'] {
3603
- .leadgen-form_body {
3604
- display: none;
3605
- }
3606
- }
3607
-
3608
- [data-align='right'] {
3609
- text-align: right;
3610
- }
3611
-
3612
- [data-align='center'] {
3613
- text-align: center;
3614
- }
3615
- `;
3616
- /**
3617
- *
3618
- * Use this component inside <form></form> tag
3619
- *
3620
- */
3621
- const FormContainer = (_a) => {
3622
- var { iconComponent, title, titleAlign, description, descriptionAlign, className, style, children, header, footer } = _a, restProps = __rest(_a, ["iconComponent", "title", "titleAlign", "description", "descriptionAlign", "className", "style", "children", "header", "footer"]);
3623
- const HeaderContent = (React__default.createElement("div", { className: "leadgen-form_header" },
3624
- iconComponent,
3625
- React__default.createElement(Text, { as: "h2", size: 'h4', variant: "primary", weight: 'semiBold', className: "leadgen-title", "data-align": titleAlign }, title),
3626
- !!description && (React__default.createElement(Text, { size: "p2", variant: "secondary", title: description, className: "leadgen-description", "data-align": descriptionAlign, dangerouslySetInnerHTML: { __html: description } }))));
3627
- if (!title && !description) {
3628
- return null;
3629
- }
3630
- return (React__default.createElement(StyledFormContainer, Object.assign({ className: clsx(className, 'leadgen-form_container'), style: style }, restProps),
3631
- React__default.createElement("div", { className: "leadgen-form_wrapper" },
3632
- !!header && (React__default.createElement("div", { className: "leadgen-form_scrollable" },
3633
- header,
3634
- HeaderContent,
3635
- React__default.createElement("div", { className: "leadgen-form_body" }, children))),
3636
- !header && (React__default.createElement(React__default.Fragment, null,
3637
- HeaderContent,
3638
- React__default.createElement("div", { className: "leadgen-form_body" }, children))),
3639
- React__default.createElement("div", { className: "leadgen-form_footer" }, footer))));
3640
- };
3641
-
3642
- const StyleHeaderImage = styled.div `
3643
- position: relative;
3644
- overflow: hidden;
3645
- width: 100%;
3646
- height: 100%;
3647
- padding-top: ${({ paddingTop }) => paddingTop}%;
3648
- .leadgen-header_image_feature {
3649
- position: absolute;
3650
- inset: 0;
3651
- min-width: 100%;
3652
- min-height: 100%;
3653
- max-width: 100%;
3654
- max-height: 100%;
3655
- object-fit: cover;
3656
- object-position: center;
3657
- }
3658
- `;
3659
- const HeaderImage = ({ src, ratio = 3 / 2, className, style, }) => {
3660
- if (!src) {
3661
- return null;
3662
- }
3663
- return (React__default.createElement(StyleHeaderImage, { paddingTop: (1 / ratio) * 100, className: clsx(className, 'leadgen-header_image'), style: style }, isVideo(src) ? (React__default.createElement("video", { muted: true, autoPlay: true, loop: true, className: "leadgen-header_image_feature leadgen-header_image_video", src: src })) : (React__default.createElement("img", { src: src, draggable: "false", alt: "", className: "leadgen-header_image_feature leadgen-header_image_image" }))));
3664
- };
3665
-
3666
- const OtpBlock = ({ otpData, onSuccess, autoSendWhenOpen, }) => {
3667
- const { primaryColor } = useContext(LeadGenContext);
3668
- const { t } = useLeadGenTranslations();
3669
- const phone = otpData.phone;
3670
- const otpType = otpData.type;
3671
- const [otp, setOtp] = useState('');
3672
- const [isDirty, setIsDirty] = useState(false);
3673
- const [resendTimer, setResendTimer] = useState(autoSendWhenOpen ? 0 : 60);
3674
- const inputRef = useRef(null);
3675
- const [errorMsg, setErrorMsg] = useState();
3676
- const [displayPhone, setDisplayPhone] = useState('');
3677
- const formatPhoneNumberIntlRef = useRef();
3678
- const [isSubmitLoading, setIsSubmitLoading] = useState(false);
3679
- useEffect(() => {
3680
- (() => __awaiter(void 0, void 0, void 0, function* () {
3681
- var _a;
3682
- if (!formatPhoneNumberIntlRef.current) {
3683
- const res = yield import('react-phone-number-input');
3684
- formatPhoneNumberIntlRef.current = res.formatPhoneNumberIntl;
3685
- }
3686
- setDisplayPhone(((_a = formatPhoneNumberIntlRef.current) === null || _a === void 0 ? void 0 : _a.call(formatPhoneNumberIntlRef, phone)) || phone);
3687
- }))();
3688
- }, [phone]);
3689
- const sendOtp = () => __awaiter(void 0, void 0, void 0, function* () {
3690
- var _a;
3691
- if (!phone) {
3692
- return;
3693
- }
3694
- const res = yield Service.sendSMSOtpLead({
3695
- phone,
3696
- type: otpType,
3697
- });
3698
- const respMessage = (_a = res === null || res === void 0 ? void 0 : res._messages) === null || _a === void 0 ? void 0 : _a[0];
3699
- if (respMessage === 'Send sms successfully' ||
3700
- respMessage === 'Send WhatsApp successfully' ||
3701
- respMessage === 'Send Zalo successfully') {
3702
- setResendTimer(60);
3703
- setTimeout(() => {
3704
- if (inputRef.current) {
3705
- inputRef.current.focus();
3706
- inputRef.current.scrollIntoView({ block: 'center' });
3707
- }
3708
- }, 100);
3709
- }
3710
- else if (respMessage === 'This phone number was verified') {
3711
- onSuccess();
3712
- }
3713
- else {
3714
- setErrorMsg(respMessage || 'Something went wrong!');
3715
- // const defaultError = f({ id: 'notification.comment.somethingWrong' })
3716
- // setStatusVerifyOTP('idle')
3717
- // pushNotifications({
3718
- // title: respMessage || defaultError,
3719
- // message: '',
3720
- // type: 'danger',
3721
- // })
3722
- }
3723
- });
3724
- const submitOtp = () => __awaiter(void 0, void 0, void 0, function* () {
3725
- if (!phone || !otp) {
3726
- return;
3727
- }
3728
- setIsSubmitLoading(true);
3729
- const res = yield Service.verifyOtpLead({
3730
- phone,
3731
- otp,
3732
- type: otpType,
3733
- });
3734
- const respMessage = res === null || res === void 0 ? void 0 : res._messages[0];
3735
- if (respMessage === 'Verify successfully' ||
3736
- respMessage === 'Verify WhatsApp OTP sucess' ||
3737
- respMessage === 'Verify Zalo OTP sucess') {
3738
- onSuccess();
3739
- }
3740
- else if (respMessage === 'This phone number was verified') {
3741
- onSuccess();
3742
- }
3743
- else {
3744
- setErrorMsg(respMessage || 'something Wrong');
3745
- // setIsShowError(true)
3746
- // setStatusVerifyOTP('sent')
3747
- // pushNotifications({
3748
- // title: res?._messages[0] || defaultError,
3749
- // message: '',
3750
- // type: 'danger',
3751
- // })
3752
- }
3753
- setIsSubmitLoading(false);
3754
- });
3755
- useEffect(() => {
3756
- setTimeout(() => {
3757
- if (resendTimer > 0) {
3758
- setResendTimer((r) => r - 1);
3759
- }
3760
- }, 1000);
3761
- }, [resendTimer]);
3762
- useEffect(() => {
3763
- if (autoSendWhenOpen && !resendTimer) {
3764
- sendOtp();
3765
- }
3766
- }, []);
3767
- return (React__default.createElement("form", { onSubmit: (e) => {
3768
- e.preventDefault();
3769
- submitOtp();
3770
- }, className: "lead-phone-otp-form leadgen-form leadgen-form_otp" },
3771
- React__default.createElement(FormContainer, { title: t('lead.otp.title'), description: t('lead.otp.desc', {
3772
- phone: `<strong>${displayPhone}</strong>`,
3773
- }), footer: React__default.createElement(React__default.Fragment, null,
3774
- React__default.createElement(Button$1, { type: "submit", size: "lg", variant: "filled", className: `lead-modal__btn leadgen-btn_action ${LEAD_CLASS}`, color: primaryColor, disabled: !otp, loading: isSubmitLoading }, t('lead.otp.verify')),
3775
- React__default.createElement(Button$1, { type: "button", size: "lg", variant: "light", className: `lead-modal__btn lead-phone-otp-button leadgen-btn_action ${LEAD_CLASS}`, color: primaryColor, onClick: () => {
3776
- sendOtp();
3777
- }, disabled: !!resendTimer }, t('lead.otp.resend', {
3778
- timer: resendTimer ? ` (${resendTimer}s)` : '',
3779
- }))) },
3780
- React__default.createElement("div", { className: "leadgen-form_inner" },
3781
- React__default.createElement(Input.Wrapper, { error: isDirty ? errorMsg : undefined, className: "leadgen-form_field" },
3782
- React__default.createElement(OTP, { ref: inputRef, name: '_' + name + '-otp', value: otp, onChange: (v) => {
3783
- setIsDirty(true);
3784
- setOtp(v.toString());
3785
- if (isDirty && !v)
3786
- setErrorMsg('OTP is required');
3787
- else
3788
- setErrorMsg(undefined);
3789
- } }))))));
3790
- };
3791
-
3792
- const Gift = ({ className, style }) => {
3793
- return (React__default.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, style: style },
3794
- React__default.createElement("path", { d: "M15.8337 9.16675V15.8334C15.8337 17.0612 14.8392 18.0556 13.6114 18.0556H6.38921C5.16144 18.0556 4.16699 17.0612 4.16699 15.8334V9.16675", fill: "#FEC7DC" }),
3795
- React__default.createElement("path", { d: "M10 5.83337V18.0556", stroke: "#FC488D", strokeWidth: "1.33333", strokeLinecap: "round", strokeLinejoin: "round" }),
3796
- React__default.createElement("path", { d: "M4.16699 3.8889C4.16699 2.81557 5.0381 1.94446 6.11144 1.94446C8.9881 1.94446 10.0003 5.83335 10.0003 5.83335H6.11144C5.0381 5.83335 4.16699 4.96224 4.16699 3.8889Z", stroke: "#FC488D", strokeWidth: "1.33333", strokeLinecap: "round", strokeLinejoin: "round" }),
3797
- React__default.createElement("path", { d: "M13.8889 5.83335H10C10 5.83335 11.0122 1.94446 13.8889 1.94446C14.9622 1.94446 15.8333 2.81557 15.8333 3.8889C15.8333 4.96224 14.9622 5.83335 13.8889 5.83335Z", stroke: "#FC488D", strokeWidth: "1.33333", strokeLinecap: "round", strokeLinejoin: "round" }),
3798
- React__default.createElement("path", { d: "M15.8337 9.16675V15.8334C15.8337 17.0612 14.8392 18.0556 13.6114 18.0556H6.38921C5.16144 18.0556 4.16699 17.0612 4.16699 15.8334V9.16675", stroke: "#FC488D", strokeWidth: "1.33333", strokeLinecap: "round", strokeLinejoin: "round" }),
3799
- React__default.createElement("path", { d: "M16.9443 5.83337H3.05545C2.4418 5.83337 1.94434 6.33084 1.94434 6.94449V8.0556C1.94434 8.66924 2.4418 9.16671 3.05545 9.16671H16.9443C17.558 9.16671 18.0554 8.66924 18.0554 8.0556V6.94449C18.0554 6.33084 17.558 5.83337 16.9443 5.83337Z", stroke: "#FC488D", strokeWidth: "1.33333", strokeLinecap: "round", strokeLinejoin: "round" })));
3800
- };
3801
-
3802
- const Star = ({ className, style }) => {
3803
- return (React__default.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, style: style },
3804
- React__default.createElement("path", { d: "M7.76093 1.94434L11.8267 4.92811L16.5893 3.27134L15.0077 8.05978L18.0553 12.0772L13.0127 12.0526L10.1339 16.1928L8.59882 11.3896L3.77148 9.93078L7.86504 6.98645L7.76093 1.94434Z", fill: "#91CAFF" }),
3805
- React__default.createElement("path", { d: "M7.76093 1.94434L11.8267 4.92811L16.5893 3.27134L15.0077 8.05978L18.0553 12.0772L13.0127 12.0526L10.1339 16.1928L8.59882 11.3896L3.77148 9.93078L7.86504 6.98645L7.76093 1.94434Z", stroke: "#2D87F3", strokeWidth: "1.33333", strokeLinecap: "round", strokeLinejoin: "round" }),
3806
- React__default.createElement("path", { d: "M2.22168 17.7777L5.55501 14.4443", stroke: "#2D87F3", strokeWidth: "1.33333", strokeLinecap: "round", strokeLinejoin: "round" }),
3807
- React__default.createElement("path", { d: "M1.94434 13.611L2.49989 13.0554", stroke: "#2D87F3", strokeWidth: "1.33333", strokeLinecap: "round", strokeLinejoin: "round" }),
3808
- React__default.createElement("path", { d: "M6.38867 18.0556L6.94423 17.5", stroke: "#2D87F3", strokeWidth: "1.33333", strokeLinecap: "round", strokeLinejoin: "round" })));
3809
- };
3810
-
3811
- const StyledFreebieCarouselTitle = styled.div `
3812
- display: flex;
3813
- align-items: center;
3814
- gap: ${rem(8)};
3815
- margin-bottom: ${rem(16)};
3816
- `;
3817
- var useStyles = createStyles((theme) => ({
3818
- indicators: {
3819
- bottom: 0,
3820
- gap: rem(4),
3821
- },
3822
- indicator: {
3823
- width: rem(5),
3824
- height: rem(5),
3825
- borderRadius: '100%',
3826
- background: theme.colors.neutral[2],
3827
- opacity: 1,
3828
- '&[data-active]': {
3829
- backgroundColor: theme.fn.primaryColor(),
3830
- },
3831
- },
3832
- container: {
3833
- padding: `0 0 ${rem(21)} 0`,
3834
- },
3835
- root: {
3836
- marginBottom: rem(16),
3837
- },
3838
- }));
3839
-
3840
- const StyledFreebiesCard = styled.div `
3841
- display: flex;
3842
- flex-direction: column;
3843
- border-radius: ${rem(16)};
3844
- box-shadow: 0px 32px 32px -16px rgba(0, 0, 0, 0.04),
3845
- 0px 6px 6px -3px rgba(0, 0, 0, 0.04), 0px 3px 3px -1.5px rgba(0, 0, 0, 0.04),
3846
- 0px 1px 1px -0.5px rgba(0, 0, 0, 0.04);
3847
- background-color: ${theme.colors.white};
3848
-
3849
- .mantine-AspectRatio-root {
3850
- width: 100%;
3851
-
3852
- img {
3853
- border-radius: ${rem(16)} ${rem(16)} 0 0;
3854
- margin: 0;
3855
- }
3856
- }
3857
-
3858
- .mantine-Badge-root {
3859
- height: fit-content;
3860
- width: fit-content;
3861
- position: absolute;
3862
- padding: ${rem(4)} ${rem(8)};
3863
- border-radius: ${rem(8)};
3864
- bottom: ${rem(12)};
3865
- left: ${rem(12)};
3866
-
3867
- .mantine-Text-root {
3868
- line-height: ${rem(12)};
3869
- }
3870
-
3871
- background-color: #00000080;
3872
- }
3873
- `;
3874
- const StyledImageWrap = styled.div `
3875
- width: 100%;
3876
- height: 100%;
3877
- position: relative;
3878
- `;
3879
-
3880
- const FreebieLuckyGiftItem = ({ isHostedByClient, locale, data: { image, name, desc, prize_value, prize_unit, cta_button, winning_slot, }, }) => {
3881
- const { t } = useLeadGenTranslations();
3882
- console.log(prize_value, prize_unit, locale);
3883
- const formattedPrice = prize_value && prize_unit
3884
- ? currencyFormat(prize_value, locale, prize_unit)
3885
- : '';
3886
- return (React__default.createElement(StyledFreebiesCard, null,
3887
- React__default.createElement(StyledImageWrap, null,
3888
- React__default.createElement(AspectRatio, { ratio: 3 / 2 },
3889
- React__default.createElement(ImageWrap, { src: image, alt: name || '' })),
3890
- winning_slot > 0 && (React__default.createElement(Badge, null,
3891
- React__default.createElement(Text, { size: "c2", color: theme.colors.white },
3892
- winning_slot,
3893
- " SLOTS")))),
3894
- React__default.createElement(Box, { p: "12px" },
3895
- React__default.createElement(Tooltip, { label: name, position: "top", withArrow: true },
3896
- React__default.createElement(Text, { lineClamp: 2, size: "title2", mb: rem(4), style: { height: rem(48) } }, name)),
3897
- React__default.createElement(Tooltip, { label: desc, position: "top", withArrow: true },
3898
- React__default.createElement(Text, { lineClamp: 2, size: "p3", mb: rem(16), style: { height: rem(40) } }, desc)),
3899
- React__default.createElement(Text, { size: "p3", fw: 500 },
3900
- React__default.createElement(Text, { as: "span" },
3901
- t('inlineFreebie.value'),
3902
- " "),
3903
- React__default.createElement(Text, { as: "span", color: theme.colors.primaryBase }, formattedPrice)),
3904
- isHostedByClient && (React__default.createElement(Button, { className: "inline-freebie-button" },
3905
- React__default.createElement(Text, { size: "p2" }, cta_button))))));
3906
- };
3907
- const FreebieFreeSampleItem = ({ data: { image, name, desc, cta_button }, }) => (React__default.createElement(StyledFreebiesCard, null,
3908
- React__default.createElement(AspectRatio, { ratio: 3 / 2 },
3909
- React__default.createElement(ImageWrap, { src: image, alt: name || '' })),
3910
- React__default.createElement(Box, { p: "12px" },
3911
- React__default.createElement(Tooltip, { label: name, position: "top", withArrow: true },
3912
- React__default.createElement(Text, { lineClamp: 2, size: "title2", mb: rem(4), style: { height: rem(48) } }, name)),
3913
- React__default.createElement(Tooltip, { label: desc, position: "top", withArrow: true },
3914
- React__default.createElement(Text, { lineClamp: 3, size: "p3", style: { height: rem(60) } }, desc)),
3915
- React__default.createElement(Button, { className: "lucky-gift-button inline-freebie-button" },
3916
- React__default.createElement(Text, { size: "p2" }, cta_button)))));
3917
-
3918
- var EHostedBy;
3919
- (function (EHostedBy) {
3920
- EHostedBy["CLIENT"] = "CLIENT";
3921
- EHostedBy["HHG"] = "HHG";
3922
- })(EHostedBy || (EHostedBy = {}));
3923
- var EFreebieType;
3924
- (function (EFreebieType) {
3925
- EFreebieType["SAMPLE"] = "SAMPLE";
3926
- EFreebieType["LUCKY_DRAW"] = "LUCKY_DRAW";
3927
- })(EFreebieType || (EFreebieType = {}));
3928
-
3929
- const FreebieCarousel = ({ isHostedByClient, data, locale, }) => {
3930
- const { classes } = useStyles(undefined, {
3931
- name: 'Carousel',
3932
- });
3933
- const { t } = useLeadGenTranslations();
3934
- const freeSample = data.filter((item) => item.type === EFreebieType.SAMPLE);
3935
- const luckyGift = data.filter((item) => item.type === EFreebieType.LUCKY_DRAW);
3936
- const isHasLuckyGift = luckyGift.length > 0;
3937
- const isHasFreeSample = freeSample.length > 0;
3938
- const isHasLuckyGiftMoreThanOne = luckyGift.length > 1;
3939
- const isHasFreeSampleMoreThanOne = freeSample.length > 1;
3940
- const luckyGiftCtaButton = luckyGift[0].cta_button;
3941
- return (React__default.createElement(React__default.Fragment, null,
3942
- isHasLuckyGift && (React__default.createElement(React__default.Fragment, null,
3943
- React__default.createElement(StyledFreebieCarouselTitle, null,
3944
- React__default.createElement(Gift, null),
3945
- React__default.createElement(Text, { size: "title2", color: theme.colors.pink800 }, t('inlineFreebie.freeSample.title'))),
3946
- React__default.createElement(Carousel, { slideSize: isHasFreeSampleMoreThanOne ? rem(262) : rem(355), slideGap: rem(12), align: "start", withControls: false, withIndicators: isHasFreeSampleMoreThanOne, classNames: Object.assign({}, classes) }, freeSample.map((item) => (React__default.createElement(Carousel.Slide, { key: `${item.type}-${item.product_code}` },
3947
- React__default.createElement(FreebieFreeSampleItem, { data: item }))))))),
3948
- isHasFreeSample && (React__default.createElement(React__default.Fragment, null,
3949
- React__default.createElement(StyledFreebieCarouselTitle, null,
3950
- React__default.createElement(Star, null),
3951
- React__default.createElement(Text, { size: "title2", color: theme.colors.primaryBase }, t('inlineFreebie.luckyDrawGift.title'))),
3952
- React__default.createElement(Carousel, { slideSize: isHasLuckyGiftMoreThanOne ? rem(262) : rem(355), slideGap: rem(12), align: "start", withControls: false, withIndicators: isHasLuckyGiftMoreThanOne, classNames: Object.assign({}, classes) }, luckyGift.map((item) => (React__default.createElement(Carousel.Slide, { key: `${item.type}-${item.product_code}` },
3953
- React__default.createElement(FreebieLuckyGiftItem, { isHostedByClient: isHostedByClient, data: item, locale: locale }))))),
3954
- !isHostedByClient && (React__default.createElement(Button, { className: "inline-freebie-button" },
3955
- React__default.createElement(Text, { size: "p2" }, luckyGiftCtaButton)))))));
3956
- };
3957
-
3958
- const StyledBox = styled.div `
3959
- margin-bottom: ${rem(4)};
3960
- `;
3961
- const StyledTitle = styled(Text) `
3962
- margin-bottom: ${rem(16)};
3963
- `;
3964
- const StyledBrandImage = styled.img `
3965
- height: ${rem(32)};
3966
- width: auto;
3967
- `;
3968
- const StyledInlineFreebieContainer = styled.div `
3969
- padding: ${rem(16)};
3970
- background-color: ${theme.colors.neutral50};
3971
-
3972
- .inline-freebie-button {
3973
- width: 100%;
3974
- margin-top: ${rem(12)};
3975
-
3976
- .mantine-Text-root {
3977
- color: ${theme.colors.white};
3978
- font-weight: 600;
3979
- }
3980
-
3981
- &.lucky-gift-button {
3982
- background-color: ${theme.colors.pink800};
3983
-
3984
- &:hover {
3985
- background-color: ${theme.colors.pink700};
3986
- }
3987
- }
3988
- }
3989
- `;
3990
-
3991
- const InlineFreebie = ({ campaign, locale, }) => {
3992
- const { hosted_by, brand_image, widget_title, data_freebies } = campaign;
3993
- const isHostedByClient = hosted_by === 'CLIENT';
3994
- return (React__default.createElement(StyledInlineFreebieContainer, null,
3995
- React__default.createElement(StyledBox, null,
3996
- React__default.createElement(StyledBrandImage, { src: brand_image, alt: widget_title || '', loading: "lazy", style: { height: '32px', width: 'auto' } })),
3997
- React__default.createElement(StyledTitle, { size: "title1" }, widget_title || ''),
3998
- React__default.createElement(FreebieCarousel, { isHostedByClient: isHostedByClient, data: data_freebies, locale: locale })));
3999
- };
4000
-
4001
- // url: imageBlocks.imageMobile.data.url
4002
- // newTab: imageBlocks.imageMobile.data.newtab
4003
- // image: campaignShow.image
4004
- // imageDestkop: campaignShow.image_desktop
4005
- const LEADGEN_LAYOUT_NOT_SHOW_IN_MOBILE = [
4006
- LEADGEN_LAYOUT.Fullscreen,
4007
- LEADGEN_LAYOUT.Slider,
4008
- ];
4009
- const LEADGEN_LIMIT_LIGHTBOXB = 6;
4010
- const LEADGEN_SHOW_HEADER = [
4011
- 'LightBoxA',
4012
- 'InlineA',
4013
- LEADGEN_LAYOUT.Sidebar,
4014
- LEADGEN_LAYOUT.Slider,
4015
- ];
4016
- // const CAMPAGE_CODE_LIST_APPLY_NEW_UI = ['ri3lkoxcetjoj39', 'u0adw7hw8kw7t89']
4017
- const CAMPAGE_CODE_LIST_APPLY_NEW_UI = ['ri3lkoxcetjoj39'];
4018
- const LightboxLayout = ({ popupId, extraFields, onClose: onCloseProp, onOtherSubmit, imageMobile, imageDesktop, imageOverlayMobile, imageOverlayDesktop, imageBackground, currentLayout, title, onSubmit, onUnmount, doImpression, showThankyou, campaignId, campaignCode, campaign_subot_id, locale, showEmpty, setShowEmpty, userInfo, action, campaign, }) => {
4019
- var _a, _b;
4020
- const { primaryColor } = useContext(LeadGenContext);
4021
- const { isMobile } = useScreenSize();
4022
- const [open, setOpen] = useState(!!campaignId);
4023
- const [showOtpPhone, setShowOtpPhone] = useState(null);
4024
- const [isSubmitLoading, setIsSubmitLoading] = useState(false);
4025
- const [snap, setSnap] = useState(0.8);
4026
- const isTrackedForm = useRef(false);
4027
- const formRef = useRef();
4028
- const [lastFormRef, setLastFormRef] = useState();
4029
- const onClose = (preventTrackingClose = false) => {
4030
- if (showOtpPhone) {
4031
- setShowOtpPhone(null);
4032
- }
4033
- else {
4034
- onCloseProp === null || onCloseProp === void 0 ? void 0 : onCloseProp({
4035
- formValues: form.values,
4036
- formActiveTime: formActiveTime.current,
4037
- formRef: formRef.current,
4038
- listBlockAdded,
4039
- preventTrackingClose,
4040
- });
4041
- }
4042
- };
4043
- const { height } = useViewportDimensions();
4044
- // usePreventScroll()
4045
- const formActiveTime = useRef(0);
4046
- const textBlocks = JSON.parse(extraFields.textBlocks);
4047
- const listBlockAdded = JSON.parse(extraFields.listBlockAdded);
4048
- const actionBlocks = JSON.parse(extraFields.actionBlocks);
4049
- const popUpSubmitText = actionBlocks.submitBlock.data.value;
4050
- const currentPath = location.pathname;
4051
- const { align: descriptionAlign, value: description } = textBlocks.subtitleBlock.data || {};
4052
- const { align: titleAlign } = textBlocks.titleBlock.data || {};
4053
- const isSlider = currentLayout === LEADGEN_LAYOUT.Slider;
4054
- const isSidebar = currentLayout === LEADGEN_LAYOUT.Sidebar;
4055
- const isLightBox = currentLayout.includes('LightBox');
4056
- const isLightBoxA = currentLayout === LEADGEN_LAYOUT.LightBoxA;
4057
- const isLightBoxB = currentLayout === LEADGEN_LAYOUT.LightBoxB;
4058
- const isInline = currentLayout.includes('Inline') || currentLayout.includes('Freebie');
4059
- const isFreebie = currentLayout.includes('Freebie');
4060
- const isFullscreen = currentLayout === LEADGEN_LAYOUT.Fullscreen;
4061
- const isInPage = isInline || isSidebar;
4062
- const isDrawer = isLightBoxB && isMobile;
4063
- const isNewUI = useMemo(() => CAMPAGE_CODE_LIST_APPLY_NEW_UI.includes(campaignCode), [campaignCode]);
4064
- const limitFieldsLightBoxB = isLightBoxB && listBlockAdded.length <= LEADGEN_LIMIT_LIGHTBOXB;
4065
- const hasForm = isLightBoxA
4066
- ? listBlockAdded.some((item) => LEADGEN_BLOCK_INPUT.some((k) => k === (item === null || item === void 0 ? void 0 : item.name)))
4067
- : true;
4068
- const headerInsideFormContainer = isSlider || isLightBoxA || isFullscreen;
4069
- const showHeader = !!imageMobile || !!imageDesktop;
4070
- const onlyHeader = !title && !description;
4071
- const showButtonClose = !isInline;
4072
- const validatingPhoneRef = useRef(false);
4073
- const validatingEmailRef = useRef(false);
4074
- const { form, validateObj } = useLeadFormConfig({
4075
- listBlockAdded,
4076
- validatingPhoneRef,
4077
- validatingEmailRef,
4078
- campaignId,
4079
- campaign_subot_id,
4080
- userInfo,
4081
- format: (_a = (ISO_FORMAT[locale] || ISO_FORMAT['vi-VN'])) === null || _a === void 0 ? void 0 : _a.dateFormat,
4082
- });
4083
- const popupContentRef = useRef(null);
4084
- const isIos = isIOS();
4085
- const keyOpen = useKeyboardOpen();
4086
- const { isPushed, bottomRef } = useViewportPushedByKeyboard();
4087
- const [bottomSpacing, setBottomSpacing] = useState(0);
4088
- const bottomSpacingRef = useRef(bottomSpacing);
4089
- const isPushedRef = useRef(isPushed);
4090
- const keyOpenRef = useRef(keyOpen);
4091
- const [isScrolling, setIsScrolling] = useState(false);
4092
- const isScrollingRef = useRef(false);
4093
- const gapBottomSpace = useRef(40);
4094
- const initialHeight = useRef(0);
4095
- const scrollTo = useScrollTo();
4096
- const handleDoImpression = useCallback((type = 'impression') => doImpression({
4097
- formValues: form.values,
4098
- formActiveTime: formActiveTime.current,
4099
- formRef: formRef.current,
4100
- listBlockAdded,
4101
- type,
4102
- }), [form]);
4103
- if (window.innerWidth < 769 &&
4104
- LEADGEN_LAYOUT_NOT_SHOW_IN_MOBILE.includes(currentLayout)) {
4105
- console.log('😎 Not show fullscreen, slider on mobile ');
4106
- return null;
4107
- }
4108
- useEffect(() => {
4109
- initialHeight.current = window.innerHeight;
4110
- (isLightBox || isSlider) && handleDoImpression();
4111
- if (isLightBox || isFullscreen) {
4112
- document.body.classList.add('noscroll');
4113
- }
4114
- if (!window.intlTelInputUtils) {
4115
- require('intl-tel-input/build/js/utils');
4116
- }
4117
- clearCacheUsedEmailOrPhone();
4118
- }, []);
4119
- useEffect(() => {
4120
- isPushedRef.current = isPushed;
4121
- }, [isPushed]);
4122
- useEffect(() => {
4123
- keyOpenRef.current = keyOpen;
4124
- }, [keyOpen]);
4125
- useEffect(() => {
4126
- bottomSpacingRef.current = bottomSpacing;
4127
- }, [bottomSpacing]);
4128
- useEffect(() => {
4129
- isScrollingRef.current = isScrolling;
4130
- }, [isScrolling]);
4131
- useEffect(() => {
4132
- formRef.current && setLastFormRef(formRef.current);
4133
- }, [formRef.current]);
4134
- useEffect(() => {
4135
- const handleBeforeUnload = () => {
4136
- !isTrackedForm.current &&
4137
- !showThankyou &&
4138
- (onUnmount === null || onUnmount === void 0 ? void 0 : onUnmount({
4139
- formValues: form.values,
4140
- formActiveTime: formActiveTime.current,
4141
- formRef: lastFormRef,
4142
- listBlockAdded,
4143
- }));
4144
- };
4145
- window.addEventListener('beforeunload', handleBeforeUnload);
4146
- return () => window.removeEventListener('beforeunload', handleBeforeUnload);
4147
- }, [lastFormRef, form.values, showThankyou]);
4148
- useEffect(() => {
4149
- let intervalId = null;
4150
- if (isLightBox && !showThankyou) {
4151
- intervalId = setInterval(() => {
4152
- formActiveTime.current += 1;
4153
- // console.log({ formActiveTime: formActiveTime.current })
4154
- }, 1000);
4155
- }
4156
- return () => clearInterval(intervalId);
4157
- }, [showThankyou]);
4158
- useEffect(() => {
4159
- setBottomSpacing(isMobile && isIos && isLightBoxB
4160
- ? !isPushed && keyOpen
4161
- ? (() => {
4162
- var _a;
4163
- const visualHeight = (_a = window.visualViewport) === null || _a === void 0 ? void 0 : _a.height;
4164
- const isErrorDevice = visualHeight === initialHeight.current;
4165
- return isErrorDevice ? window.innerHeight * 0.4 : visualHeight;
4166
- })()
4167
- : 0
4168
- : 0);
4169
- }, [isPushed, keyOpen, isMobile, isIos, isLightBoxB]);
4170
- const listBlockAddedRequired = useMemo(() => leadGenFieldRequired(listBlockAdded), listBlockAdded);
4171
- const disabledButtonSubmit = useMemo(() => {
4172
- if (listBlockAddedRequired.length) {
4173
- return listBlockAddedRequired.some((k) => !form.values[k]);
4174
- }
4175
- return false;
4176
- }, [...listBlockAddedRequired.map((k) => form.values[k])]);
4177
- const handlePopupContentScroll = () => {
4178
- if (!isScrollingRef.current) {
4179
- const active = document.activeElement;
4180
- if (formRef.current && formRef.current.contains(active)) {
4181
- active.blur();
4182
- }
4183
- }
4184
- };
4185
- const onFocus = (e) => {
4186
- // EL-926 Temporary turn off handling focus form on mobile to fix scrolling bug on lightbox A
4187
- // return false
4188
- e.preventDefault();
4189
- if (!isMobile || !isIos || !isLightBoxB)
4190
- return;
4191
- setTimeout(() => {
4192
- var _a, _b;
4193
- if (!isPushedRef.current && keyOpenRef.current) {
4194
- const input = e.target;
4195
- const rect = input.getBoundingClientRect();
4196
- const inputHeight = rect.height;
4197
- const inputTop = rect.top;
4198
- const viewportHeight = (_a = window.visualViewport) === null || _a === void 0 ? void 0 : _a.height;
4199
- const isErrorDevice = viewportHeight === initialHeight.current;
4200
- const currentTop = inputTop + inputHeight + (isErrorDevice ? 0 : gapBottomSpace.current);
4201
- const currentScrollY = popupContentRef.current.scrollTop;
4202
- const viewPort = isErrorDevice
4203
- ? window.innerHeight * 0.4
4204
- : (_b = window.visualViewport) === null || _b === void 0 ? void 0 : _b.height;
4205
- if (currentTop >= viewPort) {
4206
- const gap = currentTop - viewPort;
4207
- const targetScrollY = currentScrollY + gap;
4208
- if (!isNaN(targetScrollY)) {
4209
- setIsScrolling(true);
4210
- scrollTo(popupContentRef.current, targetScrollY, 400);
4211
- setTimeout(() => {
4212
- setIsScrolling(false);
4213
- }, 500);
4214
- }
4215
- }
4216
- }
4217
- }, 300);
4218
- };
4219
- const middlewareOnSubmit = (e) => {
4220
- e.preventDefault();
4221
- // mark all as touched to allow validation
4222
- const fields = Object.keys(validateObj);
4223
- const fieldStatus = fields.reduce((acc, cur) => {
4224
- acc[cur] = true;
4225
- return acc;
4226
- }, {});
4227
- form.setTouched(fieldStatus);
4228
- if (validatingEmailRef.current || validatingPhoneRef.current) {
4229
- return;
4230
- }
4231
- setTimeout(() => {
4232
- form.onSubmit((v) => {
4233
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
4234
- if (Object.keys(form.errors).length)
4235
- return;
4236
- let newShowOtpPhone = null;
4237
- if (listBlockAdded.findIndex((x) => x.name === LEADGEN_BLOCK.PhoneOtpBlock) > -1) {
4238
- // not submit yet, open otp
4239
- 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;
4240
- if ((_c = v[fieldName]) === null || _c === void 0 ? void 0 : _c.startsWith('+')) {
4241
- newShowOtpPhone = {
4242
- phone: v[fieldName],
4243
- type: 'phone',
4244
- };
4245
- }
4246
- }
4247
- if (listBlockAdded.findIndex((x) => x.name === LEADGEN_BLOCK.WhatsappOtpBlock) > -1) {
4248
- // not submit yet, open otp
4249
- 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;
4250
- if ((_f = v[fieldName]) === null || _f === void 0 ? void 0 : _f.startsWith('+')) {
4251
- newShowOtpPhone = {
4252
- phone: v[fieldName],
4253
- type: 'whatsapp',
4254
- };
4255
- }
4256
- }
4257
- if (listBlockAdded.findIndex((x) => x.name === LEADGEN_BLOCK.ZaloOtpBlock) > -1) {
4258
- // not submit yet, open otp
4259
- 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;
4260
- if ((_j = v[fieldName]) === null || _j === void 0 ? void 0 : _j.startsWith('+')) {
4261
- newShowOtpPhone = {
4262
- phone: v[fieldName],
4263
- type: 'zalo',
4264
- };
4265
- }
4266
- }
4267
- if (newShowOtpPhone) {
4268
- setIsSubmitLoading(true);
4269
- Service.sendSMSOtpLead(newShowOtpPhone)
4270
- .then((res) => {
4271
- var _a;
4272
- const respMessage = (_a = res === null || res === void 0 ? void 0 : res._messages) === null || _a === void 0 ? void 0 : _a[0];
4273
- if (respMessage === 'This phone number was verified') {
4274
- onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit({
4275
- formValues: v,
4276
- formActiveTime: formActiveTime.current,
4277
- formRef: formRef.current,
4278
- listBlockAdded,
4279
- });
4280
- return;
4281
- }
4282
- setShowOtpPhone(newShowOtpPhone);
4283
- })
4284
- .finally(() => {
4285
- setIsSubmitLoading(false);
4286
- });
4287
- return;
4288
- }
4289
- onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit({
4290
- formValues: v,
4291
- formActiveTime: formActiveTime.current,
4292
- formRef: formRef.current,
4293
- listBlockAdded,
4294
- });
4295
- })(e);
4296
- }, 100);
4297
- };
4298
- const onOpenChange = (_open) => {
4299
- setOpen(_open);
4300
- if (!_open) {
4301
- setTimeout(() => {
4302
- onClose();
4303
- }, 250);
4304
- }
4305
- };
4306
- const { width: imageBackgroundWidth, height: imageBackgroundHeight, loaded: imageBackgroundLoaded, } = useImageSize(imageBackground);
4307
- const { loaded: imageMobileLoaded } = useImageSize(imageMobile);
4308
- const { loaded: imageDesktopLoaded } = useImageSize(imageDesktop);
4309
- const renderAfterImageSizes = imageMobileLoaded &&
4310
- imageDesktopLoaded &&
4311
- (isFullscreen ? imageBackgroundLoaded : true);
4312
- const ButtonSubmit = useMemo(() => {
4313
- var _a;
4314
- return !((_a = actionBlocks === null || actionBlocks === void 0 ? void 0 : actionBlocks.submitBlock) === null || _a === void 0 ? void 0 : _a.isHide) && (React__default.createElement(Button, { size: "lg", id: "lead-submit", type: "submit", className: "leadgen-btn leadgen-btn_action", color: primaryColor, loading: isSubmitLoading, disabled: disabledButtonSubmit }, popUpSubmitText));
4315
- }, [
4316
- popUpSubmitText,
4317
- isSubmitLoading,
4318
- disabledButtonSubmit,
4319
- (_b = actionBlocks === null || actionBlocks === void 0 ? void 0 : actionBlocks.submitBlock) === null || _b === void 0 ? void 0 : _b.isHide,
4320
- ]);
4321
- const [btnLinkLoading, setbtnLinkLoading] = useState(false);
4322
- const LinkButtonBlock = listBlockAdded.filter(({ name }) => name == LEADGEN_BLOCK.LinkButtonBlock);
4323
- const ButtonLink = !!(LinkButtonBlock === null || LinkButtonBlock === void 0 ? void 0 : LinkButtonBlock.length) && (React__default.createElement(React__default.Fragment, null, LinkButtonBlock.map((item, index) => {
4324
- var _a;
4325
- return (React__default.createElement(Button, { key: `${item.name}-${index}`, size: "lg", className: "leadgen-btn leadgen-btn_action", color: primaryColor, loading: btnLinkLoading, onClick: (e) => __awaiter(void 0, void 0, void 0, function* () {
4326
- var _b, _c;
4327
- e.preventDefault();
4328
- onClose === null || onClose === void 0 ? void 0 : onClose(true);
4329
- setbtnLinkLoading(true);
4330
- yield handleDoImpression('redirects');
4331
- onOtherSubmit === null || onOtherSubmit === void 0 ? void 0 : onOtherSubmit();
4332
- window.open((_b = item === null || item === void 0 ? void 0 : item.data) === null || _b === void 0 ? void 0 : _b.url, ((_c = item === null || item === void 0 ? void 0 : item.data) === null || _c === void 0 ? void 0 : _c.newtab) ? '_blank' : undefined);
4333
- }) }, (_a = item === null || item === void 0 ? void 0 : item.data) === null || _a === void 0 ? void 0 : _a.value));
4334
- })));
4335
- 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,
4336
- React__default.createElement(HeaderImage, { src: imageDesktop, className: "le-only-desktop lead-modal__image" }),
4337
- React__default.createElement(HeaderImage, { src: imageMobile, className: "le-only-mobile lead-modal__image" })))));
4338
- const PopupEmpty = showEmpty && (React__default.createElement(EmptyComponent, { onClose: onClose, onContinue: () => setShowEmpty(false) }));
4339
- const PopupForm = (React__default.createElement(LeadFormProvider, { form: form },
4340
- React__default.createElement("form", { ref: formRef, className: "leadgen-form", onFocus: onFocus, onSubmit: middlewareOnSubmit },
4341
- React__default.createElement(FormContainer, { title: title, titleAlign: titleAlign, description: description, descriptionAlign: descriptionAlign, header: headerInsideFormContainer && PopupHeader, footer: hasForm ? ButtonSubmit : ButtonLink, "data-hidden-form": !hasForm },
4342
- React__default.createElement("div", { className: "leadgen-form_inner" },
4343
- React__default.createElement(LightboxFields, { listBlockAdded: listBlockAdded, popupId: popupId, locale: locale, onClose: onClose, onOtherSubmit: onOtherSubmit, hasSubmitBtn: Boolean(ButtonSubmit), isSubmitLoading: isSubmitLoading, disabledButtonSubmit: disabledButtonSubmit })))),
4344
- React__default.createElement("div", { style: {
4345
- height: `${bottomSpacing}px`,
4346
- width: '100%',
4347
- transition: 'height .2s ease',
4348
- } })));
4349
- const PopupOtp = showOtpPhone && (React__default.createElement(OtpBlock, { otpData: showOtpPhone, autoSendWhenOpen: false, onSuccess: () => {
4350
- setShowOtpPhone(null);
4351
- onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit({
4352
- formValues: form.values,
4353
- formActiveTime: formActiveTime.current,
4354
- formRef: formRef.current,
4355
- listBlockAdded,
4356
- });
4357
- } }));
4358
- 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 }));
4359
- const PopupContent = (React__default.createElement("div", { ref: popupContentRef, className: clsx('leadgen-content', {
4360
- 'leadgen-content_small': limitFieldsLightBoxB,
4361
- }), onScroll: handlePopupContentScroll },
4362
- !headerInsideFormContainer && PopupHeader,
4363
- !onlyHeader && (React__default.createElement("div", { className: "leadgen-inner" },
4364
- PopupThankYou,
4365
- !showThankyou && (React__default.createElement(React__default.Fragment, null,
4366
- PopupOtp,
4367
- PopupEmpty,
4368
- !(showOtpPhone || showEmpty) && PopupForm)))),
4369
- React__default.createElement("div", { ref: bottomRef, style: {
4370
- position: 'fixed',
4371
- bottom: 0,
4372
- left: 0,
4373
- height: 1,
4374
- width: '100%',
4375
- pointerEvents: 'none',
4376
- } })));
4377
- const styleOverlay = useMemo(() => {
4378
- let styleContent = `.leadgen-inner {background-repeat: no-repeat;background-size: cover;background-position:center;}`;
4379
- if (isMobile && imageOverlayMobile) {
4380
- styleContent += `.leadgen-inner {background-image: url(${imageOverlayMobile});}`;
4381
- }
4382
- if (!isMobile && imageOverlayDesktop) {
4383
- styleContent += `@media screen and (min-width:768px) {.leadgen-inner {background-image: url(${imageOverlayDesktop});}}`;
4384
- }
4385
- return styleContent;
4386
- }, [isMobile, imageOverlayDesktop, imageOverlayMobile]);
4387
- const PopupWrapper = (React__default.createElement(React__default.Fragment, null,
4388
- React__default.createElement("style", { dangerouslySetInnerHTML: { __html: styleOverlay } }),
4389
- React__default.createElement("div", { className: clsx('leadgen-wrapper', {
4390
- 'leadgen-wrapper_small': limitFieldsLightBoxB,
4391
- }) },
4392
- showButtonClose && (React__default.createElement(CloseButton, { onClose: () => onOpenChange(false), containerClassName: "leadgen-close_btn" })),
4393
- PopupContent)));
4394
- const popupContainerClassName = clsx('leadgen', `leadgen-${currentLayout}`, {
4395
- 'leadgen-lightbox': isLightBox,
4396
- 'leadgen-inline': isInPage,
4397
- 'leadgen-slider': isSlider,
4398
- });
4399
- const PopupContainer = isDrawer ? (isNewUI ? (React__default.createElement(LeadGenLightBoxB, { form: form, loading: isSubmitLoading, visible: open, onVisible: () => onOpenChange(false) }, PopupWrapper)) : (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" },
4400
- PopupWrapper,
4401
- React__default.createElement("div", { style: {
4402
- position: 'absolute',
4403
- inset: 0,
4404
- zIndex: snap === 1 ? -1 : 1,
4405
- }, onClick: () => setSnap(1) })))) : (React__default.createElement("div", { id: popupId, "data-popup-url": currentPath, "data-popup-type": "lightbox-inline", className: popupContainerClassName, style: isMobile ? { maxHeight: height } : undefined },
4406
- isFullscreen ? (React__default.createElement("img", { className: "le-only-desktop le-fullscreen-img", draggable: false, src: imageBackground || '', style: {
4407
- aspectRatio: `${imageBackgroundWidth}/${imageBackgroundHeight}`,
4408
- } })) : null,
4409
- PopupWrapper));
4410
- if (!renderAfterImageSizes)
4411
- return null;
4412
- if (isLightBox || isFullscreen || isSlider) {
4413
- return PopupContainer;
4414
- }
4415
- else if (isSidebar) {
4416
- return React__default.createElement(SideBarLayout, { content: PopupContainer });
4417
- }
4418
- else if (isInline) {
4419
- return (React__default.createElement(InlineLayout, { action: action, content: isFreebie ? (React__default.createElement(InlineFreebie, { campaign: campaign.freebie[0], locale: locale })) : (PopupContainer), campaignCode: campaignCode, inlinePosition: extraFields.popupInlinePosition, doImpression: handleDoImpression }));
4420
- }
4421
- return null;
4422
- };
4423
-
4424
- const SkinLayout = ({ popupId, link, linkText, linkNewTab, onClose, imageMobile, imageDesktop, currentLayout, onOtherSubmit, }) => {
4425
- const currentPath = location.pathname;
4426
- const { width: imageMobileWidth, height: imageMobileHeight, loaded: imageMobileLoaded, } = useImageSize(imageMobile);
4427
- const { width: imageDesktopWidth, height: imageDesktopHeight, loaded: imageDesktopLoaded, } = useImageSize(imageDesktop);
4428
- if (!imageMobileLoaded || !imageDesktopLoaded)
4429
- return null;
4430
- return (React__default.createElement("div", { id: popupId, className: "lead-modal-wrapper", "data-popup-url": currentPath, "data-popup-type": "skin_ab" },
4431
- currentLayout == 'SkinA' ? (React__default.createElement("aside", { className: "le-only-desktop" },
4432
- React__default.createElement("div", { className: "le-skin-a-desktop" },
4433
- React__default.createElement("div", { style: { position: 'relative' } },
4434
- React__default.createElement("img", { src: imageDesktop, style: {
4435
- aspectRatio: `${imageDesktopWidth}/${imageDesktopHeight}`,
4436
- } }),
4437
- React__default.createElement("a", { style: {
4438
- position: 'absolute',
4439
- top: '75%',
4440
- left: '50%',
4441
- transform: 'translate(-50%, -50%)',
4442
- textAlign: 'center',
4443
- width: 'calc(100% - 15px)',
4444
- }, href: link, target: linkNewTab ? 'blank' : '_parent' },
4445
- React__default.createElement("button", { onClick: onOtherSubmit, className: "le-joinbow-btn js-popup-other-submit" }, linkText)),
4446
- React__default.createElement(CloseButton, { onClose: onClose, containerClassName: "close-button-top-right" }))))) : currentLayout == 'SkinB' ? (React__default.createElement("aside", { className: "le-only-desktop" },
4447
- React__default.createElement("div", { className: "" },
4448
- React__default.createElement("div", { style: { position: 'relative', zIndex: 10000 } },
4449
- React__default.createElement("img", { src: imageDesktop, style: {
4450
- width: '100%',
4451
- aspectRatio: `${imageDesktopWidth}/${imageDesktopHeight}`,
4452
- } }),
4453
- React__default.createElement("a", { style: {
4454
- position: 'absolute',
4455
- top: '75%',
4456
- left: '50%',
4457
- transform: 'translate(-50%, -50%)',
4458
- textAlign: 'center',
4459
- width: '100%',
4460
- }, href: link, target: linkNewTab ? 'blank' : '_parent' },
4461
- React__default.createElement("button", { onClick: onOtherSubmit, className: "le-joinbow-btn-mobile js-popup-other-submit" }, linkText)),
4462
- React__default.createElement(CloseButton, { containerClassName: "close-button-top-right", onClose: onClose }))))) : null,
4463
- React__default.createElement("aside", { className: "le-only-mobile" },
4464
- React__default.createElement("div", { className: "le-skin-mobile" },
4465
- React__default.createElement("div", { style: { position: 'relative' } },
4466
- isVideo(imageMobile) ? (React__default.createElement("video", { muted: true, autoPlay: true, loop: true },
4467
- React__default.createElement("source", { src: imageMobile, type: "video/mp4" }))) : (React__default.createElement("img", { src: imageMobile, style: {
4468
- width: '100%',
4469
- aspectRatio: `${imageMobileWidth}/${imageMobileHeight}`,
4470
- } })),
4471
- React__default.createElement("a", { style: {
4472
- position: 'absolute',
4473
- top: '82%',
4474
- left: '50%',
4475
- transform: 'translate(-50%, -50%)',
4476
- textAlign: 'center',
4477
- maxWidth: 'calc(100% - 15px)',
4478
- }, href: link, target: linkNewTab ? 'blank' : '_parent' },
4479
- React__default.createElement("button", { onClick: onOtherSubmit, className: "le-joinbow-btn-mobile js-popup-other-submit" }, linkText)),
4480
- React__default.createElement(CloseButton, { containerClassName: "close-button-top-right", svgClassName: "le-mobile-btn", onClose: onClose }))))));
4481
- };
4482
-
4483
- // url: imageBlocks.imageMobile.data.url
4484
- // newTab: imageBlocks.imageMobile.data.newtab
4485
- // image: campaignShow.image
4486
- // imageDestkop: campaignShow.image_desktop
4487
- const TabLayout = ({ popupId, url, newTab, image, onClose, onOtherSubmit, }) => {
4488
- const { width: imageWidth, height: imageHeight, loaded: imageLoaded, } = useImageSize(image);
4489
- if (!imageLoaded)
4490
- return null;
4491
- return (React__default.createElement("div", { id: popupId, className: "lead-modal-wrapper", "data-popup-url": location.pathname, "data-popup-type": "tab" },
4492
- React__default.createElement("div", { className: "le-tab-popup" },
4493
- React__default.createElement("div", { style: { position: 'relative' } },
4494
- React__default.createElement("a", { href: url, target: newTab ? 'blank' : '_parent', onClick: onOtherSubmit },
4495
- React__default.createElement("img", { className: "js-popup-other-submit", src: image, style: {
4496
- aspectRatio: `${imageWidth}/${imageHeight}`,
4497
- } })),
4498
- React__default.createElement(CloseButton, { onClose: onClose, containerClassName: "close-button-top-right" })))));
4499
- };
4500
-
4501
- function getCategoryLevel(t = 'Xin chao {{category_2}} extra') {
4502
- if (t.includes('{{category_')) {
4503
- const cl = '{{category_'.length;
4504
- const sc = t.search('{{category_');
4505
- const sf = t.charAt(cl + sc);
4506
- return +sf;
4507
- }
4508
- else {
4509
- return null;
4510
- }
4511
- }
4512
- const NewLeadPopup = ({ campaign, action, onSubmit, onClose, onUnmount, doImpression, showThankyou, locale, showEmpty, setShowEmpty, userInfo, }) => {
4513
- var _a, _b;
4514
- const { apiUrl, siteDomain } = useContext(LeadGenContext);
4515
- const { extra_fields, image, image_desktop, code, image_background, image_overlay_mobile, image_overlay_desktop, } = campaign || {};
4516
- const { currentLayout } = extra_fields;
4517
- const imageBlocks = extra_fields.imageBlocks
4518
- ? JSON.parse(extra_fields.imageBlocks)
4519
- : {};
4520
- const actionBlocks = JSON.parse(extra_fields.actionBlocks);
4521
- const textBlocks = JSON.parse(extra_fields.textBlocks);
4522
- let titleText = ((_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) || '';
4523
- const categoryData = {
4524
- 1: {},
4525
- 2: {},
4526
- 3: {},
4527
- };
4528
- const popupIdRef = useRef('lead-modal-' + v1());
4529
- const categoryLevel = getCategoryLevel(titleText);
4530
- if (categoryLevel) {
4531
- LeadLog('⚡️ Has categoryLevel', categoryLevel);
4532
- const listMeta = Array.from(document.getElementsByTagName('META'));
4533
- const valueMeta = listMeta.find((i) => i.name === `content_category_${categoryLevel}`);
4534
- const valueMetaEn = listMeta.find((i) => i.name === `content_category_en_${categoryLevel}`);
4535
- if (valueMeta && valueMetaEn) {
4536
- categoryData[categoryLevel] = {
4537
- value: valueMeta.content,
4538
- value_en: valueMetaEn.content,
4539
- };
4540
- titleText = titleText.replace(`{{category_${categoryLevel}}}`, valueMeta.content);
4541
- LeadLog('⚡️ Set categoryData ', categoryLevel);
4542
- }
4543
- else {
4544
- LeadLog('⚡️ No META TAG for categoryLevel, not show popup', categoryLevel);
4545
- return null;
4546
- }
4547
- }
4548
- else {
4549
- LeadLog('⚡️ No categoryLevel', categoryLevel);
4550
- }
4551
- const onOtherSubmit = (params) => {
4552
- var _a, _b, _c, _d;
4553
- LeadLog('👌 Other submit click');
4554
- document.body.classList.remove('noscroll');
4555
- if (currentLayout.includes('Skin')) {
4556
- const $head = document.querySelector('#masthead');
4557
- if ($head) {
4558
- $head.style.top = 0 + 'px !important;';
4559
- }
4560
- }
4561
- const expiresDay = Number((_b = (_a = campaign.rules.find((r) => r.rule == 'days_to_show_again')) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 7);
4562
- const showAgain = Number((_d = (_c = campaign.rules.find((r) => r.rule == 'show_again_after_submit')) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : 0);
4563
- if (showAgain === 0) {
4564
- LeadLog('⛔ Popup never show again!');
4565
- setCookie(`lead_submited_${code}`, `target_${extra_fields.popupVersion}`, { domain: '.' + siteDomain, path: '/' });
4566
- }
4567
- if (showAgain == 1) {
4568
- LeadLog(`⌛ Popup will show again after ${expiresDay} days!`);
4569
- setCookie(`lead_submited_${code}`, `target_${extra_fields.popupVersion}`, { domain: '.' + siteDomain, days: expiresDay, path: '/' });
4570
- }
4571
- const gaCookie = getCookie('_ga') || null;
4572
- const data = {
4573
- url: location.href.toLowerCase(),
4574
- title_article: document.title,
4575
- meta: [],
4576
- cookie_id: getCookie('hhg-id'),
4577
- ga_client_id: gaCookie,
4578
- };
4579
- if (categoryLevel) {
4580
- data['category'] = categoryData[categoryLevel].value_en;
4581
- }
4582
- withLeadgenRecaptcha('leadgen_submit', data)
4583
- .then((payload) => fetch(`${apiUrl}api/campaign/${code}/lead`, {
4584
- method: 'POST',
4585
- body: JSON.stringify(payload),
4586
- headers: {
4587
- 'Content-Type': 'application/json',
4588
- 'X-Requested-With': 'XMLHttpRequest',
4589
- },
4590
- }))
4591
- .then((response) => response.json())
4592
- .then((data) => {
4593
- if (data.status === 'error') {
4594
- LeadLog(data);
4595
- }
4596
- })
4597
- .catch((error) => {
4598
- LeadLog('Error:', error);
4599
- });
4600
- onClose === null || onClose === void 0 ? void 0 : onClose(params);
4601
- };
4602
- if (currentLayout === 'CenterTab') {
4603
- return (React__default.createElement(CenterTabLayout, { popupId: popupIdRef.current, url: imageBlocks.imageMobile.data.url, newTab: imageBlocks.imageMobile.data.newtab, imageMobile: image, imageDestkop: image_desktop, onClose: onClose, onOtherSubmit: onOtherSubmit, doImpression: doImpression }));
4604
- }
4605
- else if (currentLayout === 'Tab') {
4606
- return (React__default.createElement(TabLayout, { popupId: popupIdRef.current, url: imageBlocks.imageMobile.data.url, newTab: imageBlocks.imageMobile.data.newtab, image: image, onClose: onClose, onOtherSubmit: onOtherSubmit }));
4607
- }
4608
- else if (currentLayout === 'Floating') {
4609
- return (React__default.createElement(FloatingLayout, { popupId: popupIdRef.current, title: titleText, titleAlign: textBlocks.titleBlock.data.align, subtitle: textBlocks.subtitleBlock.data.value, subtitleAlign: textBlocks.subtitleBlock.data.align, url: actionBlocks.linkButtonBlock.data.url, urlText: actionBlocks.linkButtonBlock.data.value, newTab: actionBlocks.linkButtonBlock.data.newtab, imageMobile: image, imageDesktop: image_desktop, onClose: onClose, onOtherSubmit: onOtherSubmit }));
4610
- }
4611
- else if (currentLayout.includes('LightBox') ||
4612
- currentLayout.includes('Inline') ||
4613
- currentLayout.includes('Freebie') ||
4614
- currentLayout == 'Fullscreen' ||
4615
- currentLayout == 'Sidebar' ||
4616
- currentLayout == 'Slider') {
4617
- return (React__default.createElement(LightboxLayout, { popupId: popupIdRef.current, extraFields: extra_fields, onClose: onClose, onOtherSubmit: onOtherSubmit, onUnmount: onUnmount, doImpression: doImpression, imageMobile: image, imageDesktop: image_desktop, imageBackground: image_background, currentLayout: currentLayout, campaign: campaign, title: titleText, onSubmit: (params) => onSubmit(params, categoryLevel, categoryData), key: currentLayout, imageOverlayDesktop: image_overlay_desktop, imageOverlayMobile: image_overlay_mobile, showThankyou: showThankyou, campaignId: campaign.id, campaignCode: campaign.code, campaign_subot_id: campaign.bot_id || [], locale: locale, showEmpty: showEmpty, setShowEmpty: setShowEmpty, userInfo: userInfo, action: action }));
4618
- }
4619
- else if (currentLayout.includes('Skin')) {
4620
- return (React__default.createElement(SkinLayout, { popupId: popupIdRef.current, link: actionBlocks.linkButtonBlock.data.url, linkNewTab: !!actionBlocks.linkButtonBlock.data.newtab, linkText: actionBlocks.linkButtonBlock.data.value, onClose: onClose, onOtherSubmit: onOtherSubmit, imageMobile: image, imageDesktop: image_desktop, currentLayout: currentLayout }));
4621
- }
4622
- return null;
4623
- };
4624
-
4625
- const numberFormatType = 2; // i18n.phonenumbers.PhoneNumberFormat.NATIONAL
4626
- const formatFormData = (currentForm, formData = []) => {
4627
- return Object.keys(formData)
4628
- .filter((key) => !!formData[key])
4629
- .map((name) => {
4630
- var _a, _b, _c, _d, _e, _f;
4631
- const value = String(formData[name]);
4632
- const control = ((_a = currentForm
4633
- .querySelector(`*[name="${name}"][data-control]`)) === null || _a === void 0 ? void 0 : _a.getAttribute('data-control')) ||
4634
- ((_b = currentForm
4635
- .querySelector(`*[data-extra][data-name="${name}"]`)) === null || _b === void 0 ? void 0 : _b.getAttribute('data-control')) ||
4636
- 'text';
4637
- const leadControl = ((_c = currentForm
4638
- .querySelector(`*[name="${name}"][data-lead-control]`)) === null || _c === void 0 ? void 0 : _c.getAttribute('data-lead-control')) ||
4639
- ((_d = currentForm
4640
- .querySelector(`*[data-extra][data-name="${name}"]`)) === null || _d === void 0 ? void 0 : _d.getAttribute('data-lead-control')) ||
4641
- 'text';
4642
- const isRequired = Boolean(((_e = currentForm
4643
- .querySelector(`*[name="${name}"][data-is-required]`)) === null || _e === void 0 ? void 0 : _e.getAttribute('data-is-required')) ||
4644
- ((_f = currentForm
4645
- .querySelector(`*[data-extra][data-name="${name}"]`)) === null || _f === void 0 ? void 0 : _f.getAttribute('data-is-required')) ||
4646
- 'text');
4647
- const formatedValue = control === 'tel'
4648
- ? window.intlTelInputUtils
4649
- .formatNumber(String(value), LEAD_LOCALE === null || LEAD_LOCALE === void 0 ? void 0 : LEAD_LOCALE.countryCodeNumber, numberFormatType)
4650
- .replace(/\s+/g, '')
4651
- : control === 'date'
4652
- ? dayjs(value).format('YYYY-MM-DD')
4653
- : value;
4654
- return {
4655
- key: name,
4656
- value: formatedValue,
4657
- control,
4658
- leadControl,
4659
- isRequired,
4660
- // is_sent_mailchimp: currentForm.querySelector(
4661
- // `div[data-name="${i.name}-mailchimp"]`,
4662
- // )
4663
- // ? 'true'
4664
- // : 'false',
4665
- };
4666
- });
4667
- };
4668
-
4669
- const formatTrackingData = (params) => {
4670
- const { formParams = {}, currentLayout, commonData } = params;
4671
- const { formValues, formActiveTime, listBlockAdded } = formParams;
4672
- const listFieldHasValue = [];
4673
- const data = Object.assign(Object.assign({ template_type: currentLayout, time_on_form: [LEADGEN_LAYOUT.LightBoxA, LEADGEN_LAYOUT.LightBoxB].includes(currentLayout)
4674
- ? formActiveTime
4675
- : 0 }, commonData), { data_input: formValues
4676
- .map((control) => {
4677
- const findIndex = listBlockAdded.findIndex((i) => {
4678
- const compareVal = control.key.startsWith('TNC-')
4679
- ? `TNC-${i.id}`
4680
- : i.data.value;
4681
- return compareVal == control.key;
4682
- });
4683
- if (findIndex > -1) {
4684
- const curInfo = listBlockAdded[findIndex];
4685
- listFieldHasValue.push(curInfo.data.value);
4686
- return {
4687
- field_name: control.key,
4688
- component_type: curInfo.name,
4689
- value: control.value,
4690
- is_required: curInfo.data.required,
4691
- };
4692
- }
4693
- })
4694
- .filter(Boolean), data_not_input: listBlockAdded
4695
- .map((item) => {
4696
- if (!listFieldHasValue.includes(item.data.value)) {
4697
- return {
4698
- field_name: item.data.value,
4699
- component_type: item.name,
4700
- is_required: item.data.required,
4701
- };
4702
- }
4703
- })
4704
- .filter(Boolean) });
4705
- return data;
4706
- };
4707
-
4708
- export { Component as C, Description as D, Form as F, Heading as H, ImpressionTrackingWrapper as I, LeadLog as L, NewLeadPopup as N, OtpBlock$1 as O, Service as S, Thankyou as T, LeadGenForm as a, useLeadFormConfig as b, leadGenFieldNamePhone as c, LeadGenTranslationProvider as d, checkShowPopup as e, formatCampaignDetail as f, formatTrackingData as g, TEMPLATE_ALLOW_NEWTRACKING as h, LeadGenContext as i, formatFormData as j, clearPassiveEvent as k, leadStore as l, useLeadGenTranslations as u, withLeadTranslations as w };