@hhgtech/hhg-components 1.29.110 → 1.29.112

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 (502) hide show
  1. package/build/Google-9b60d4e2.js +38 -0
  2. package/build/{LastPeriod-9964beff.js → LastPeriod-816eec4b.js} +1 -1
  3. package/build/{MobileBottomNavigationIcon-47d13939.js → MobileBottomNavigationIcon-03c58545.js} +3 -3
  4. package/build/{Spinner-3cfb77fb.js → Spinner-351c115e.js} +1 -1
  5. package/build/{WhatsApp-d804a21a.js → WhatsApp-5149a1ae.js} +1 -1
  6. package/build/adapters.js +19 -18
  7. package/build/atoms.js +46 -45
  8. package/build/babyGrowth.js +83 -82
  9. package/build/cache.js +2 -2
  10. package/build/care.js +17 -17
  11. package/build/careBookingSearchBar.js +14 -14
  12. package/build/careBookingSearchBarV2.js +15 -15
  13. package/build/components/mantine/index.d.ts +1 -0
  14. package/build/components/mantine/provider/notifications/icons.d.ts +5 -0
  15. package/build/components/mantine/provider/notifications/index.d.ts +6 -0
  16. package/build/components/organisms/navigationProfileButton/index.d.ts +1 -2
  17. package/build/components.js +91 -88
  18. package/build/{constants-b6a27170.js → constants-0e963367.js} +1 -1
  19. package/build/constants.js +4 -3
  20. package/build/constantsDomainLocales.js +1 -1
  21. package/build/constantsRiskScreener.js +2 -2
  22. package/build/constantsSite.js +2 -2
  23. package/build/{core-f7393a4d.js → core-2150b67c.js} +1 -1
  24. package/build/{dataTransform-a9aa9e94.js → dataTransform-82ee6497.js} +1 -1
  25. package/build/ecom.js +4 -4
  26. package/build/{editor-44ca788c.js → editor-68cc692d.js} +11 -11
  27. package/build/embeddedHeathToolCards_babyGrowth.js +23 -22
  28. package/build/embeddedHeathToolCards_babyPoop.js +19 -18
  29. package/build/embeddedHeathToolCards_babyVaccine.js +22 -21
  30. package/build/embeddedHeathToolCards_bmi_bmi.js +26 -25
  31. package/build/embeddedHeathToolCards_bmrBmr.js +26 -25
  32. package/build/embeddedHeathToolCards_dueDate_dueDate.js +22 -21
  33. package/build/embeddedHeathToolCards_ovulation_ovulation.js +22 -21
  34. package/build/embeddedHeathToolCards_pwg_pwg.js +27 -26
  35. package/build/embeddedHeathToolCards_targetHeartRate.js +28 -27
  36. package/build/esm/Google-664b8b3c.js +15 -0
  37. package/build/esm/{LastPeriod-94d47b13.js → LastPeriod-e82eada8.js} +1 -1
  38. package/build/esm/{MobileBottomNavigationIcon-5a2f9cda.js → MobileBottomNavigationIcon-b5f86e9b.js} +3 -3
  39. package/build/esm/{Spinner-adc15177.js → Spinner-7b409f99.js} +1 -1
  40. package/build/esm/{WhatsApp-72259ef3.js → WhatsApp-06d07850.js} +1 -1
  41. package/build/esm/adapters.js +19 -18
  42. package/build/esm/atoms.js +46 -45
  43. package/build/esm/babyGrowth.js +83 -82
  44. package/build/esm/cache.js +2 -2
  45. package/build/esm/care.js +17 -17
  46. package/build/esm/careBookingSearchBar.js +14 -14
  47. package/build/esm/careBookingSearchBarV2.js +15 -15
  48. package/build/esm/components/mantine/index.d.ts +1 -0
  49. package/build/esm/components/mantine/provider/notifications/icons.d.ts +5 -0
  50. package/build/esm/components/mantine/provider/notifications/index.d.ts +6 -0
  51. package/build/esm/components/organisms/navigationProfileButton/index.d.ts +1 -2
  52. package/build/esm/components.js +91 -88
  53. package/build/esm/{constants-62165820.js → constants-d4b472c9.js} +1 -1
  54. package/build/esm/constants.js +3 -3
  55. package/build/esm/constantsDomainLocales.js +1 -1
  56. package/build/esm/constantsRiskScreener.js +2 -2
  57. package/build/esm/constantsSite.js +2 -2
  58. package/build/esm/{core-d6efb3c7.js → core-6e02a76e.js} +1 -1
  59. package/build/esm/{dataTransform-0a6dc377.js → dataTransform-2eea83ec.js} +1 -1
  60. package/build/esm/ecom.js +4 -4
  61. package/build/esm/{editor-9349fc79.js → editor-19b77c92.js} +11 -11
  62. package/build/esm/embeddedHeathToolCards_babyGrowth.js +23 -22
  63. package/build/esm/embeddedHeathToolCards_babyPoop.js +19 -18
  64. package/build/esm/embeddedHeathToolCards_babyVaccine.js +22 -21
  65. package/build/esm/embeddedHeathToolCards_bmi_bmi.js +26 -25
  66. package/build/esm/embeddedHeathToolCards_bmrBmr.js +26 -25
  67. package/build/esm/embeddedHeathToolCards_dueDate_dueDate.js +22 -21
  68. package/build/esm/embeddedHeathToolCards_ovulation_ovulation.js +22 -21
  69. package/build/esm/embeddedHeathToolCards_pwg_pwg.js +27 -26
  70. package/build/esm/embeddedHeathToolCards_targetHeartRate.js +28 -27
  71. package/build/esm/{fixedBottomAdBlock-f4baa787.js → fixedBottomAdBlock-e1c726fc.js} +22 -22
  72. package/build/esm/footer.js +21 -20
  73. package/build/esm/gAssets.js +2 -2
  74. package/build/esm/healthToolsCardWrapper.js +18 -17
  75. package/build/esm/healthToolsForm.js +34 -33
  76. package/build/esm/hooks.js +14 -14
  77. package/build/esm/i18n.js +2 -2
  78. package/build/esm/i18nV2.js +2 -2
  79. package/build/esm/{index-aa32f4d3.js → index-0c1028f1.js} +23 -23
  80. package/build/esm/{index-235e6ff6.js → index-0f2e26cf.js} +1 -1
  81. package/build/esm/{index-c2025e5d.js → index-105b0aa5.js} +12 -12
  82. package/build/esm/{index-5221ae6b.js → index-11d9840d.js} +13 -20
  83. package/build/esm/{index-a807d223.js → index-1263b1e9.js} +16 -16
  84. package/build/esm/{index-89f80018.js → index-176e331a.js} +14 -14
  85. package/build/esm/{index-0fde3c88.js → index-350f2e56.js} +36 -37
  86. package/build/esm/{index-8064c18c.js → index-3bc01607.js} +6 -6
  87. package/build/esm/{index-e6dcd686.js → index-410e8044.js} +1 -1
  88. package/build/esm/{index-16cca3e0.js → index-413b89ba.js} +3 -3
  89. package/build/esm/{index-50eafe3e.js → index-447f6ab2.js} +12 -12
  90. package/build/esm/{index-5ded1850.js → index-4a684368.js} +15 -15
  91. package/build/esm/{index-8cfb8ffd.js → index-4d3f7a06.js} +2 -2
  92. package/build/esm/{index-d46bc097.js → index-4ed0b5ba.js} +12 -12
  93. package/build/esm/{index-17fce332.js → index-5224166a.js} +17 -17
  94. package/build/esm/{index-d6ba0b97.js → index-556248c8.js} +3 -3
  95. package/build/esm/{index-15fa6e53.js → index-596950eb.js} +1 -1
  96. package/build/esm/{index-2448ba80.js → index-5b81eb40.js} +3 -3
  97. package/build/esm/{index-7f2d389c.js → index-61e80f3d.js} +1 -1
  98. package/build/esm/{index-a47dc117.js → index-62aab537.js} +5 -5
  99. package/build/esm/{index-43b726db.js → index-72829b7d.js} +2 -2
  100. package/build/esm/{index-16c22540.js → index-7603f707.js} +2 -2
  101. package/build/esm/{index-3e3fcf95.js → index-761a9621.js} +2 -2
  102. package/build/esm/{index-58449963.js → index-76b2761c.js} +7 -7
  103. package/build/esm/{index-14d4175c.js → index-7837ba76.js} +1 -1
  104. package/build/esm/{index-f67d0646.js → index-7e318f23.js} +1 -1
  105. package/build/esm/{index-b9208015.js → index-7f356ed0.js} +15 -15
  106. package/build/esm/{index-0653c377.js → index-8109fa9c.js} +6 -6
  107. package/build/esm/{index-cbf33f76.js → index-82bd111e.js} +2 -2
  108. package/build/esm/{index-2af5a80e.js → index-88d2da07.js} +18 -18
  109. package/build/esm/{index-56a79323.js → index-8a1dc672.js} +3 -3
  110. package/build/esm/{index-35c7265c.js → index-8c9150e8.js} +3 -3
  111. package/build/esm/{index-aa9360c8.js → index-8cdbaf17.js} +4 -4
  112. package/build/esm/{index-33bb2e7a.js → index-8db693ba.js} +1 -1
  113. package/build/esm/{index-e0813672.js → index-99d27908.js} +2 -2
  114. package/build/esm/{index-a5d23469.js → index-a4b02ecd.js} +7 -7
  115. package/build/esm/{index-cf2e8195.js → index-a69a171f.js} +5 -3
  116. package/build/esm/{index-b7a5ae7c.js → index-b76d2fbd.js} +6 -6
  117. package/build/esm/{index-3d5d1e1b.js → index-b823caa1.js} +14 -14
  118. package/build/esm/{index-bc9435ba.js → index-b9ffc8c8.js} +21 -21
  119. package/build/esm/{index-ab3252bc.js → index-bc8a6968.js} +2 -2
  120. package/build/esm/{index-8f6f01e4.js → index-c06316f7.js} +19 -19
  121. package/build/esm/{index-32ef64f3.js → index-c1f707db.js} +2 -2
  122. package/build/esm/{index-37d07df3.js → index-cde43c7c.js} +12 -12
  123. package/build/esm/{index-d46a2e09.js → index-d26cefad.js} +1 -1
  124. package/build/esm/{index-d942cc15.js → index-d370d705.js} +5 -5
  125. package/build/esm/{index-53b37308.js → index-d461be76.js} +15 -15
  126. package/build/esm/{index-5154a719.js → index-d5082d3a.js} +14 -14
  127. package/build/esm/{index-0ab47613.js → index-dabe7dae.js} +20 -20
  128. package/build/esm/{index-b7f5af36.js → index-de16bcda.js} +19 -15
  129. package/build/esm/{index-c072844e.js → index-e2276deb.js} +2 -2
  130. package/build/esm/{index-cdff6bde.js → index-e60fe92a.js} +6 -6
  131. package/build/esm/{index-88d1e9fe.js → index-eb1c3a22.js} +1 -1
  132. package/build/esm/{index-6e7ee277.js → index-ee65889e.js} +16 -16
  133. package/build/esm/{index-e52421fc.js → index-f453280c.js} +16 -16
  134. package/build/esm/{index-5c8ec94d.js → index-f628e3ae.js} +2 -2
  135. package/build/esm/index.js +114 -122
  136. package/build/esm/{index.styles-87407526.js → index.styles-fdecf1c6.js} +1 -1
  137. package/build/esm/interfaces/constants/index.d.ts +1 -0
  138. package/build/esm/{labelSorting-f9f43706.js → labelSorting-fa4b1daf.js} +4 -4
  139. package/build/esm/lead.js +23 -22
  140. package/build/esm/{logoIcon-acc01a57.js → logoIcon-d30efc99.js} +2 -2
  141. package/build/esm/mantine.js +28 -25
  142. package/build/esm/misc.js +19 -18
  143. package/build/esm/miscGetDynamicHealthTool.js +5 -5
  144. package/build/esm/miscGetSocialList.js +8 -8
  145. package/build/esm/miscScreenSizeContext.js +1 -1
  146. package/build/esm/mobileBottomNavigation.js +5 -5
  147. package/build/esm/mobileBottomNavigationIcon.js +5 -5
  148. package/build/esm/molecules.js +68 -67
  149. package/build/esm/moleculesArticleCard.js +6 -6
  150. package/build/esm/moleculesArticleCardV2.js +16 -15
  151. package/build/esm/navigation.js +43 -40
  152. package/build/esm/navigationLogoutPopup.js +9 -9
  153. package/build/esm/navigationProfileButton.js +24 -23
  154. package/build/esm/onboardingV2.js +29 -28
  155. package/build/esm/organisms.js +47 -44
  156. package/build/esm/{post-e5559ad6.js → post-b819ab7d.js} +2 -2
  157. package/build/esm/profileNavigation.js +20 -19
  158. package/build/esm/progressBar.js +1 -1
  159. package/build/esm/pwg.js +22 -21
  160. package/build/esm/ssoV2/api/email.d.ts +1 -1
  161. package/build/esm/ssoV2/api/index.d.ts +14 -11
  162. package/build/esm/ssoV2/api/paths.d.ts +4 -0
  163. package/build/esm/ssoV2/api/phone.d.ts +2 -0
  164. package/build/esm/ssoV2/api/zalo.d.ts +2 -0
  165. package/build/esm/ssoV2/index.d.ts +4 -1
  166. package/build/esm/ssoV2/popupWrapper/collectInfoTextPopup/index.d.ts +1 -1
  167. package/build/esm/ssoV2/popupWrapper/collectInfoTextPopup/modal.d.ts +2 -0
  168. package/build/esm/ssoV2/popupWrapper/confirmClosePopup.d.ts +6 -0
  169. package/build/esm/ssoV2/screens/otp.d.ts +3 -1
  170. package/build/esm/ssoV2/screens/passwordForgotEmail.d.ts +5 -0
  171. package/build/esm/ssoV2/screens/passwordForgotSetup/checkIcons.d.ts +4 -0
  172. package/build/esm/ssoV2/screens/setup/genderIcons.d.ts +3 -0
  173. package/build/esm/ssoV2/ssoStateManager/index.d.ts +2 -0
  174. package/build/esm/ssoV2/ssoStateManager/store.d.ts +7 -0
  175. package/build/esm/ssoV2/stepsManager/index.d.ts +8 -1
  176. package/build/esm/ssoV2.js +2164 -0
  177. package/build/esm/store-4b7ab103.js +10 -0
  178. package/build/esm/subot.js +31 -30
  179. package/build/esm/surveyOrPremiumBanner.js +30 -29
  180. package/build/esm/surveyQuestionCard.js +10 -10
  181. package/build/esm/{surveyThankyouCard-bcf08bf0.js → surveyThankyouCard-5bd56fd2.js} +5 -5
  182. package/build/esm/together.js +51 -50
  183. package/build/esm/togetherApiUtils.js +4 -4
  184. package/build/esm/togetherAtoms.js +31 -30
  185. package/build/esm/togetherComponentGlobalContext.js +4 -4
  186. package/build/esm/togetherMolecules.js +41 -40
  187. package/build/esm/togetherMoleculesCardAuthor.js +24 -24
  188. package/build/esm/togetherMoleculesPostImagePreview.js +11 -11
  189. package/build/esm/togetherMoleculesProfileDetail.js +31 -30
  190. package/build/esm/togetherOrganisms.js +46 -45
  191. package/build/esm/togetherRichTextEditor.js +17 -17
  192. package/build/esm/togetherShareBox.js +10 -10
  193. package/build/esm/{treePopoverMenu-fbc40cab.js → treePopoverMenu-861697c9.js} +18 -18
  194. package/build/esm/{types-f7e921ce.js → types-fb490e23.js} +2 -2
  195. package/build/esm/types.js +2 -2
  196. package/build/esm/{useCategory-e9c58e46.js → useCategory-2bd7f24f.js} +5 -5
  197. package/build/esm/{useHealthToolCache-5dcdf1dd.js → useHealthToolCache-9dbc5c31.js} +1 -1
  198. package/build/esm/useMantineLocale-9b4e6ec5.js +142 -0
  199. package/build/esm/{usePlacesAutocomplete-c6b04bb5.js → usePlacesAutocomplete-73987a44.js} +1 -1
  200. package/build/esm/useTogetherAuthRequiredAction.js +4 -4
  201. package/build/esm/{useTranslations-07b27d99.js → useTranslations-307c6ca4.js} +1 -1
  202. package/build/esm/{utils-017de61e.js → utils-0c30d194.js} +2 -2
  203. package/build/esm/{utils-4e13c960.js → utils-2832a25c.js} +2 -2
  204. package/build/esm/{utils-36b96c58.js → utils-e155b983.js} +3 -3
  205. package/build/esm/vaccination.js +21 -20
  206. package/build/{fixedBottomAdBlock-40e013d6.js → fixedBottomAdBlock-8d2a3d35.js} +22 -22
  207. package/build/footer.js +21 -20
  208. package/build/gAssets.js +2 -2
  209. package/build/healthToolsCardWrapper.js +18 -17
  210. package/build/healthToolsForm.js +34 -33
  211. package/build/hooks.js +14 -14
  212. package/build/i18n.js +1 -1
  213. package/build/i18nV2.js +1 -1
  214. package/build/{index-13fbb425.js → index-0acada13.js} +14 -14
  215. package/build/{index-f77a5513.js → index-107daf19.js} +6 -6
  216. package/build/{index-e77fda5d.js → index-1a0e8ba6.js} +5 -2
  217. package/build/{index-40d370cc.js → index-1b830efc.js} +1 -1
  218. package/build/{index-a6b6b993.js → index-1be8e43d.js} +12 -12
  219. package/build/{index-75bae308.js → index-1d0c001d.js} +2 -2
  220. package/build/{index-45fab631.js → index-1da80644.js} +1 -1
  221. package/build/{index-f5bb3a9d.js → index-1e0cfd00.js} +15 -15
  222. package/build/{index-b1794d6c.js → index-297729cd.js} +2 -2
  223. package/build/{index-4e709717.js → index-2d7d138c.js} +19 -14
  224. package/build/{index-27bfcf07.js → index-36ba1155.js} +1 -1
  225. package/build/{index-f24a8689.js → index-3c269800.js} +1 -1
  226. package/build/{index-8adbdb4f.js → index-3fa0ffe1.js} +7 -7
  227. package/build/{index-f5944a20.js → index-43928a1c.js} +4 -4
  228. package/build/{index-de3d8886.js → index-491d8995.js} +36 -37
  229. package/build/{index-5c8dc1a3.js → index-5568c16b.js} +2 -2
  230. package/build/{index-d7e780fe.js → index-56ff656b.js} +15 -15
  231. package/build/{index-049aece7.js → index-5ac4d936.js} +19 -19
  232. package/build/{index-f3afbbb6.js → index-5d024ad1.js} +1 -1
  233. package/build/{index-830cf23b.js → index-639e08e9.js} +12 -12
  234. package/build/{index-9244359b.js → index-6a30f248.js} +12 -12
  235. package/build/{index-d84ef58d.js → index-73056c59.js} +1 -1
  236. package/build/{index-c0d6ff80.js → index-77a05055.js} +6 -6
  237. package/build/{index-99282efe.js → index-77ba5993.js} +14 -14
  238. package/build/{index-2ce37ad2.js → index-794462d8.js} +16 -16
  239. package/build/{index-19e4fddf.js → index-79d65b66.js} +3 -3
  240. package/build/{index-e7e7b68c.js → index-7c75b350.js} +20 -20
  241. package/build/{index-5b08c63c.js → index-7dc11526.js} +7 -7
  242. package/build/{index-583288bc.js → index-7fd4f33b.js} +1 -1
  243. package/build/{index-8da9d74a.js → index-805fdc96.js} +2 -2
  244. package/build/{index-81bf5c98.js → index-81eda4ad.js} +15 -15
  245. package/build/{index-3d5a2af4.js → index-86654c05.js} +18 -18
  246. package/build/{index-95abe4d4.js → index-9500aae0.js} +2 -2
  247. package/build/{index-28e00c63.js → index-a12ee98b.js} +12 -12
  248. package/build/{index-b0472af7.js → index-a305d4c4.js} +17 -17
  249. package/build/{index-03548c34.js → index-a466379a.js} +1 -1
  250. package/build/{index-b77008b4.js → index-b7af866c.js} +23 -23
  251. package/build/{index-7233bd6d.js → index-bcc3f8e4.js} +2 -2
  252. package/build/{index-986d4587.js → index-c016ab8b.js} +2 -2
  253. package/build/{index-61c24e51.js → index-c37fe95f.js} +5 -5
  254. package/build/{index-1ddced1b.js → index-c5167284.js} +12 -19
  255. package/build/{index-529f2cf6.js → index-c6ba4a32.js} +6 -6
  256. package/build/{index-747fed64.js → index-c8096b0f.js} +2 -2
  257. package/build/{index-28722db9.js → index-c842a19d.js} +2 -2
  258. package/build/{index-e3b79653.js → index-cc82b240.js} +3 -3
  259. package/build/{index-9deaf0f8.js → index-cf490630.js} +3 -3
  260. package/build/{index-a812f053.js → index-d3606e94.js} +16 -16
  261. package/build/{index-f6c7b353.js → index-de4668ca.js} +1 -1
  262. package/build/{index-21598eb4.js → index-df65c321.js} +2 -2
  263. package/build/{index-13ad9534.js → index-e0175328.js} +3 -3
  264. package/build/{index-742fa48b.js → index-e0b2d0a5.js} +14 -14
  265. package/build/{index-8ea79133.js → index-f6ca4391.js} +6 -6
  266. package/build/{index-6192f9c2.js → index-fc991bf5.js} +16 -16
  267. package/build/{index-a80275e1.js → index-fe8b4acd.js} +5 -5
  268. package/build/{index-c63ea941.js → index-fead32d5.js} +3 -3
  269. package/build/{index-45a2a666.js → index-febd43f4.js} +21 -21
  270. package/build/index.js +115 -123
  271. package/build/{index.styles-cf5296fa.js → index.styles-510126b2.js} +1 -1
  272. package/build/interfaces/constants/index.d.ts +1 -0
  273. package/build/{labelSorting-1767b217.js → labelSorting-c4e5aa9d.js} +4 -4
  274. package/build/lead.js +23 -22
  275. package/build/{logoIcon-b6e9ebbc.js → logoIcon-90ab6b4d.js} +2 -2
  276. package/build/mantine.js +25 -21
  277. package/build/misc.js +19 -18
  278. package/build/miscGetDynamicHealthTool.js +5 -5
  279. package/build/miscGetSocialList.js +8 -8
  280. package/build/miscScreenSizeContext.js +1 -1
  281. package/build/mobileBottomNavigation.js +5 -5
  282. package/build/mobileBottomNavigationIcon.js +5 -5
  283. package/build/molecules.js +68 -67
  284. package/build/moleculesArticleCard.js +6 -6
  285. package/build/moleculesArticleCardV2.js +16 -15
  286. package/build/navigation.js +43 -40
  287. package/build/navigationLogoutPopup.js +9 -9
  288. package/build/navigationProfileButton.js +24 -23
  289. package/build/onboardingV2.js +28 -27
  290. package/build/organisms.js +47 -44
  291. package/build/{post-563403e1.js → post-f82b1693.js} +2 -2
  292. package/build/profileNavigation.js +20 -19
  293. package/build/progressBar.js +1 -1
  294. package/build/pwg.js +22 -21
  295. package/build/ssoV2/api/email.d.ts +1 -1
  296. package/build/ssoV2/api/index.d.ts +14 -11
  297. package/build/ssoV2/api/paths.d.ts +4 -0
  298. package/build/ssoV2/api/phone.d.ts +2 -0
  299. package/build/ssoV2/api/zalo.d.ts +2 -0
  300. package/build/ssoV2/index.d.ts +4 -1
  301. package/build/ssoV2/popupWrapper/collectInfoTextPopup/index.d.ts +1 -1
  302. package/build/ssoV2/popupWrapper/collectInfoTextPopup/modal.d.ts +2 -0
  303. package/build/ssoV2/popupWrapper/confirmClosePopup.d.ts +6 -0
  304. package/build/ssoV2/screens/otp.d.ts +3 -1
  305. package/build/ssoV2/screens/passwordForgotEmail.d.ts +5 -0
  306. package/build/ssoV2/screens/passwordForgotSetup/checkIcons.d.ts +4 -0
  307. package/build/ssoV2/screens/setup/genderIcons.d.ts +3 -0
  308. package/build/ssoV2/ssoStateManager/index.d.ts +2 -0
  309. package/build/ssoV2/ssoStateManager/store.d.ts +7 -0
  310. package/build/ssoV2/stepsManager/index.d.ts +8 -1
  311. package/build/ssoV2.js +2194 -0
  312. package/build/store-155b3705.js +12 -0
  313. package/build/subot.js +30 -29
  314. package/build/surveyOrPremiumBanner.js +30 -29
  315. package/build/surveyQuestionCard.js +10 -10
  316. package/build/{surveyThankyouCard-40786ef3.js → surveyThankyouCard-a178b281.js} +5 -5
  317. package/build/together.js +51 -50
  318. package/build/togetherApiUtils.js +4 -4
  319. package/build/togetherAtoms.js +31 -30
  320. package/build/togetherComponentGlobalContext.js +4 -4
  321. package/build/togetherMolecules.js +41 -40
  322. package/build/togetherMoleculesCardAuthor.js +24 -24
  323. package/build/togetherMoleculesPostImagePreview.js +11 -11
  324. package/build/togetherMoleculesProfileDetail.js +31 -30
  325. package/build/togetherOrganisms.js +46 -45
  326. package/build/togetherRichTextEditor.js +17 -17
  327. package/build/togetherShareBox.js +10 -10
  328. package/build/{treePopoverMenu-e0f418f8.js → treePopoverMenu-71f80f09.js} +18 -18
  329. package/build/{types-a5ed4acd.js → types-98c6dde4.js} +2 -2
  330. package/build/types.js +2 -2
  331. package/build/{useCategory-7833d8d9.js → useCategory-52c6274a.js} +5 -5
  332. package/build/{useHealthToolCache-7ef0f9cd.js → useHealthToolCache-e0cc98d5.js} +1 -1
  333. package/build/{useMantineLocale-16175b54.js → useMantineLocale-71ddf2d4.js} +68 -5
  334. package/build/{usePlacesAutocomplete-48ea8506.js → usePlacesAutocomplete-cd58de07.js} +1 -1
  335. package/build/useTogetherAuthRequiredAction.js +4 -4
  336. package/build/{useTranslations-783bc413.js → useTranslations-a02358cc.js} +1 -1
  337. package/build/{utils-dfe2edbf.js → utils-87cccfe9.js} +3 -3
  338. package/build/{utils-3aa5b9de.js → utils-cda87ea9.js} +2 -2
  339. package/build/{utils-17e8be52.js → utils-cfebd7e0.js} +2 -2
  340. package/build/vaccination.js +21 -20
  341. package/package.json +4 -2
  342. package/build/esm/useMantineLocale-e24e123a.js +0 -82
  343. /package/build/{BMI_BOYS.percentile.monthly-31834ca0.js → BMI_BOYS.percentile.monthly-b36790b9.js} +0 -0
  344. /package/build/{BMI_BOYS.percentile.weekly-bb6043c1.js → BMI_BOYS.percentile.weekly-46fe55d8.js} +0 -0
  345. /package/build/{BMI_BOYS.percentile.yearly-cc6cba70.js → BMI_BOYS.percentile.yearly-a10bbdbc.js} +0 -0
  346. /package/build/{BMI_BOYS.zscore.monthly-1b73153b.js → BMI_BOYS.zscore.monthly-8f3d4e3c.js} +0 -0
  347. /package/build/{BMI_BOYS.zscore.weekly-0a4888e3.js → BMI_BOYS.zscore.weekly-293cb3d5.js} +0 -0
  348. /package/build/{BMI_BOYS.zscore.yearly-e7a5067a.js → BMI_BOYS.zscore.yearly-882e57bc.js} +0 -0
  349. /package/build/{BMI_GIRLS.percentile.monthly-de7218fe.js → BMI_GIRLS.percentile.monthly-5a23cad1.js} +0 -0
  350. /package/build/{BMI_GIRLS.percentile.weekly-2d05d7fc.js → BMI_GIRLS.percentile.weekly-b5db6e5a.js} +0 -0
  351. /package/build/{BMI_GIRLS.percentile.yearly-6b402892.js → BMI_GIRLS.percentile.yearly-227e1b96.js} +0 -0
  352. /package/build/{BMI_GIRLS.zscore.monthly-43fb7f4b.js → BMI_GIRLS.zscore.monthly-a67d60cb.js} +0 -0
  353. /package/build/{BMI_GIRLS.zscore.weekly-cca85dfc.js → BMI_GIRLS.zscore.weekly-6eec37ad.js} +0 -0
  354. /package/build/{BMI_GIRLS.zscore.yearly-79aa7d6f.js → BMI_GIRLS.zscore.yearly-bed50a9e.js} +0 -0
  355. /package/build/{ChevronDown-0bb6ebf7.js → ChevronDown-36f1533e.js} +0 -0
  356. /package/build/{Close-fc7a4318.js → Close-9ad765e0.js} +0 -0
  357. /package/build/{HEAD CIRCUM_BOYS.percentile.monthly-18fb5aae.js → HEAD CIRCUM_BOYS.percentile.monthly-b3c01059.js} +0 -0
  358. /package/build/{HEAD CIRCUM_BOYS.percentile.weekly-ff6fc30b.js → HEAD CIRCUM_BOYS.percentile.weekly-b33c0fb3.js} +0 -0
  359. /package/build/{HEAD CIRCUM_BOYS.percentile.yearly-7ada75df.js → HEAD CIRCUM_BOYS.percentile.yearly-fcbbcf50.js} +0 -0
  360. /package/build/{HEAD CIRCUM_BOYS.zscore.monthly-a8a584ad.js → HEAD CIRCUM_BOYS.zscore.monthly-5c6e07c9.js} +0 -0
  361. /package/build/{HEAD CIRCUM_BOYS.zscore.weekly-78df99bd.js → HEAD CIRCUM_BOYS.zscore.weekly-e2e75ab5.js} +0 -0
  362. /package/build/{HEAD CIRCUM_BOYS.zscore.yearly-5a089140.js → HEAD CIRCUM_BOYS.zscore.yearly-67f26a8c.js} +0 -0
  363. /package/build/{HEAD CIRCUM_GIRLS.percentile.monthly-71447fa2.js → HEAD CIRCUM_GIRLS.percentile.monthly-aac09934.js} +0 -0
  364. /package/build/{HEAD CIRCUM_GIRLS.percentile.weekly-09041858.js → HEAD CIRCUM_GIRLS.percentile.weekly-2dd51abe.js} +0 -0
  365. /package/build/{HEAD CIRCUM_GIRLS.percentile.yearly-218785e5.js → HEAD CIRCUM_GIRLS.percentile.yearly-56983be9.js} +0 -0
  366. /package/build/{HEAD CIRCUM_GIRLS.zscore.monthly-3c0fdcef.js → HEAD CIRCUM_GIRLS.zscore.monthly-5c0a626f.js} +0 -0
  367. /package/build/{HEAD CIRCUM_GIRLS.zscore.weekly-210cbe5a.js → HEAD CIRCUM_GIRLS.zscore.weekly-710b188b.js} +0 -0
  368. /package/build/{HEAD CIRCUM_GIRLS.zscore.yearly-51bab3b5.js → HEAD CIRCUM_GIRLS.zscore.yearly-c1077c3d.js} +0 -0
  369. /package/build/{HEIGHT_BOYS.percentile.monthly-42cab1f3.js → HEIGHT_BOYS.percentile.monthly-eea9985d.js} +0 -0
  370. /package/build/{HEIGHT_BOYS.percentile.weekly-ea8a4c57.js → HEIGHT_BOYS.percentile.weekly-1f1cd60d.js} +0 -0
  371. /package/build/{HEIGHT_BOYS.percentile.yearly-6b52f3a2.js → HEIGHT_BOYS.percentile.yearly-e35aded9.js} +0 -0
  372. /package/build/{HEIGHT_BOYS.zscore.monthly-1ff1109c.js → HEIGHT_BOYS.zscore.monthly-7f0f2b1d.js} +0 -0
  373. /package/build/{HEIGHT_BOYS.zscore.weekly-91ac3319.js → HEIGHT_BOYS.zscore.weekly-96ddfba5.js} +0 -0
  374. /package/build/{HEIGHT_BOYS.zscore.yearly-08a54dc1.js → HEIGHT_BOYS.zscore.yearly-f905ad3a.js} +0 -0
  375. /package/build/{HEIGHT_GIRLS.percentile.monthly-374799e5.js → HEIGHT_GIRLS.percentile.monthly-3e68815f.js} +0 -0
  376. /package/build/{HEIGHT_GIRLS.percentile.weekly-f4fb53fc.js → HEIGHT_GIRLS.percentile.weekly-1266c518.js} +0 -0
  377. /package/build/{HEIGHT_GIRLS.percentile.yearly-e3687860.js → HEIGHT_GIRLS.percentile.yearly-60dc6434.js} +0 -0
  378. /package/build/{HEIGHT_GIRLS.zscore.monthly-567531c2.js → HEIGHT_GIRLS.zscore.monthly-fd774734.js} +0 -0
  379. /package/build/{HEIGHT_GIRLS.zscore.weekly-ec4377ed.js → HEIGHT_GIRLS.zscore.weekly-4aa3cba5.js} +0 -0
  380. /package/build/{HEIGHT_GIRLS.zscore.yearly-dfea8277.js → HEIGHT_GIRLS.zscore.yearly-04759ec5.js} +0 -0
  381. /package/build/{Locale-da0ee478.js → Locale-f9dad384.js} +0 -0
  382. /package/build/{Visible-b7f98f50.js → Visible-7e77e84d.js} +0 -0
  383. /package/build/{WEIGHT_BOYS.percentile.monthly-7618b9f6.js → WEIGHT_BOYS.percentile.monthly-1b59f236.js} +0 -0
  384. /package/build/{WEIGHT_BOYS.percentile.weekly-ddb5a122.js → WEIGHT_BOYS.percentile.weekly-7cbe2360.js} +0 -0
  385. /package/build/{WEIGHT_BOYS.percentile.yearly-8e3c3567.js → WEIGHT_BOYS.percentile.yearly-a7489780.js} +0 -0
  386. /package/build/{WEIGHT_BOYS.zscore.monthly-b243c952.js → WEIGHT_BOYS.zscore.monthly-06ab0025.js} +0 -0
  387. /package/build/{WEIGHT_BOYS.zscore.weekly-e9328217.js → WEIGHT_BOYS.zscore.weekly-efb1f97a.js} +0 -0
  388. /package/build/{WEIGHT_BOYS.zscore.yearly-6e5652c7.js → WEIGHT_BOYS.zscore.yearly-f693301f.js} +0 -0
  389. /package/build/{WEIGHT_GIRLS.percentile.monthly-fec10910.js → WEIGHT_GIRLS.percentile.monthly-7cefbd5a.js} +0 -0
  390. /package/build/{WEIGHT_GIRLS.percentile.weekly-11d3a59c.js → WEIGHT_GIRLS.percentile.weekly-7851dfb8.js} +0 -0
  391. /package/build/{WEIGHT_GIRLS.percentile.yearly-cf89f368.js → WEIGHT_GIRLS.percentile.yearly-d0cf0e78.js} +0 -0
  392. /package/build/{WEIGHT_GIRLS.zscore.monthly-2fff3f7b.js → WEIGHT_GIRLS.zscore.monthly-18c996ea.js} +0 -0
  393. /package/build/{WEIGHT_GIRLS.zscore.weekly-8c4f6b7f.js → WEIGHT_GIRLS.zscore.weekly-fdf3bc60.js} +0 -0
  394. /package/build/{WEIGHT_GIRLS.zscore.yearly-b151d214.js → WEIGHT_GIRLS.zscore.yearly-cd506e11.js} +0 -0
  395. /package/build/{animation-60d97a74.js → animation-793c0845.js} +0 -0
  396. /package/build/{constants-36dd380b.js → constants-66fef955.js} +0 -0
  397. /package/build/{constants-cdc1139b.js → constants-b6210e84.js} +0 -0
  398. /package/build/{constants-cd64dee8.js → constants-dcddc193.js} +0 -0
  399. /package/build/{dataTransform-ffd966a9.js → dataTransform-fdf490f9.js} +0 -0
  400. /package/build/{doctor-e94198ef.js → doctor-ee2ddc5d.js} +0 -0
  401. /package/build/esm/{BMI_BOYS.percentile.monthly-2a332a3a.js → BMI_BOYS.percentile.monthly-356bef4f.js} +0 -0
  402. /package/build/esm/{BMI_BOYS.percentile.weekly-c3d892ac.js → BMI_BOYS.percentile.weekly-93905a31.js} +0 -0
  403. /package/build/esm/{BMI_BOYS.percentile.yearly-cdc46283.js → BMI_BOYS.percentile.yearly-8eecbfa8.js} +0 -0
  404. /package/build/esm/{BMI_BOYS.zscore.monthly-66652c80.js → BMI_BOYS.zscore.monthly-ea8c2031.js} +0 -0
  405. /package/build/esm/{BMI_BOYS.zscore.weekly-ab18f061.js → BMI_BOYS.zscore.weekly-2bcd04b3.js} +0 -0
  406. /package/build/esm/{BMI_BOYS.zscore.yearly-0c467eb6.js → BMI_BOYS.zscore.yearly-05c30d0a.js} +0 -0
  407. /package/build/esm/{BMI_GIRLS.percentile.monthly-2429b0cf.js → BMI_GIRLS.percentile.monthly-c5e2700d.js} +0 -0
  408. /package/build/esm/{BMI_GIRLS.percentile.weekly-b9b4c395.js → BMI_GIRLS.percentile.weekly-98b8e613.js} +0 -0
  409. /package/build/esm/{BMI_GIRLS.percentile.yearly-6fb9ad13.js → BMI_GIRLS.percentile.yearly-0923d6e4.js} +0 -0
  410. /package/build/esm/{BMI_GIRLS.zscore.monthly-c9bbc776.js → BMI_GIRLS.zscore.monthly-4721e684.js} +0 -0
  411. /package/build/esm/{BMI_GIRLS.zscore.weekly-5dc0474f.js → BMI_GIRLS.zscore.weekly-ea9771ea.js} +0 -0
  412. /package/build/esm/{BMI_GIRLS.zscore.yearly-e2ef86f8.js → BMI_GIRLS.zscore.yearly-35d08573.js} +0 -0
  413. /package/build/esm/{ChevronDown-02044338.js → ChevronDown-12a9cc68.js} +0 -0
  414. /package/build/esm/{Close-61220f73.js → Close-4423dff1.js} +0 -0
  415. /package/build/esm/{HEAD CIRCUM_BOYS.percentile.monthly-fd04fa07.js → HEAD CIRCUM_BOYS.percentile.monthly-b4147260.js} +0 -0
  416. /package/build/esm/{HEAD CIRCUM_BOYS.percentile.weekly-528f1994.js → HEAD CIRCUM_BOYS.percentile.weekly-8f703517.js} +0 -0
  417. /package/build/esm/{HEAD CIRCUM_BOYS.percentile.yearly-83ba6bf3.js → HEAD CIRCUM_BOYS.percentile.yearly-2541f124.js} +0 -0
  418. /package/build/esm/{HEAD CIRCUM_BOYS.zscore.monthly-ed488d96.js → HEAD CIRCUM_BOYS.zscore.monthly-b128eb35.js} +0 -0
  419. /package/build/esm/{HEAD CIRCUM_BOYS.zscore.weekly-17cdff23.js → HEAD CIRCUM_BOYS.zscore.weekly-58ad3a0e.js} +0 -0
  420. /package/build/esm/{HEAD CIRCUM_BOYS.zscore.yearly-d3dc9d78.js → HEAD CIRCUM_BOYS.zscore.yearly-2189c833.js} +0 -0
  421. /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.monthly-f56ed0bf.js → HEAD CIRCUM_GIRLS.percentile.monthly-0fdba54a.js} +0 -0
  422. /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.weekly-942cc7b6.js → HEAD CIRCUM_GIRLS.percentile.weekly-030fa305.js} +0 -0
  423. /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.yearly-211ea40d.js → HEAD CIRCUM_GIRLS.percentile.yearly-1329de79.js} +0 -0
  424. /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.monthly-68b579a0.js → HEAD CIRCUM_GIRLS.zscore.monthly-1782f72f.js} +0 -0
  425. /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.weekly-37cdec10.js → HEAD CIRCUM_GIRLS.zscore.weekly-0efbd6d4.js} +0 -0
  426. /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.yearly-1cb077e9.js → HEAD CIRCUM_GIRLS.zscore.yearly-79a0d447.js} +0 -0
  427. /package/build/esm/{HEIGHT_BOYS.percentile.monthly-0ace7dd5.js → HEIGHT_BOYS.percentile.monthly-90faded6.js} +0 -0
  428. /package/build/esm/{HEIGHT_BOYS.percentile.weekly-64dbe278.js → HEIGHT_BOYS.percentile.weekly-a8dfd216.js} +0 -0
  429. /package/build/esm/{HEIGHT_BOYS.percentile.yearly-fe232854.js → HEIGHT_BOYS.percentile.yearly-ae998ec7.js} +0 -0
  430. /package/build/esm/{HEIGHT_BOYS.zscore.monthly-32f5b99c.js → HEIGHT_BOYS.zscore.monthly-9cb15df5.js} +0 -0
  431. /package/build/esm/{HEIGHT_BOYS.zscore.weekly-f1bad17d.js → HEIGHT_BOYS.zscore.weekly-53b00809.js} +0 -0
  432. /package/build/esm/{HEIGHT_BOYS.zscore.yearly-bebdef69.js → HEIGHT_BOYS.zscore.yearly-db30656d.js} +0 -0
  433. /package/build/esm/{HEIGHT_GIRLS.percentile.monthly-18d1f48d.js → HEIGHT_GIRLS.percentile.monthly-7f5bf7a9.js} +0 -0
  434. /package/build/esm/{HEIGHT_GIRLS.percentile.weekly-ee656308.js → HEIGHT_GIRLS.percentile.weekly-97c8ff77.js} +0 -0
  435. /package/build/esm/{HEIGHT_GIRLS.percentile.yearly-bd0761eb.js → HEIGHT_GIRLS.percentile.yearly-8f2f6316.js} +0 -0
  436. /package/build/esm/{HEIGHT_GIRLS.zscore.monthly-c5680c01.js → HEIGHT_GIRLS.zscore.monthly-76169434.js} +0 -0
  437. /package/build/esm/{HEIGHT_GIRLS.zscore.weekly-e4eb9dfb.js → HEIGHT_GIRLS.zscore.weekly-5b711b18.js} +0 -0
  438. /package/build/esm/{HEIGHT_GIRLS.zscore.yearly-5b368aea.js → HEIGHT_GIRLS.zscore.yearly-f2f7a8d2.js} +0 -0
  439. /package/build/esm/{Locale-c89fbd16.js → Locale-0a28cd1a.js} +0 -0
  440. /package/build/esm/{Visible-b92c39ca.js → Visible-4a25adb6.js} +0 -0
  441. /package/build/esm/{WEIGHT_BOYS.percentile.monthly-e8772fe0.js → WEIGHT_BOYS.percentile.monthly-91dc4240.js} +0 -0
  442. /package/build/esm/{WEIGHT_BOYS.percentile.weekly-943a8f07.js → WEIGHT_BOYS.percentile.weekly-4a1dee2b.js} +0 -0
  443. /package/build/esm/{WEIGHT_BOYS.percentile.yearly-e0d5b2d1.js → WEIGHT_BOYS.percentile.yearly-7ba7678d.js} +0 -0
  444. /package/build/esm/{WEIGHT_BOYS.zscore.monthly-7ec7bb71.js → WEIGHT_BOYS.zscore.monthly-61be31ee.js} +0 -0
  445. /package/build/esm/{WEIGHT_BOYS.zscore.weekly-77029cdb.js → WEIGHT_BOYS.zscore.weekly-b641e490.js} +0 -0
  446. /package/build/esm/{WEIGHT_BOYS.zscore.yearly-fa652850.js → WEIGHT_BOYS.zscore.yearly-75588f48.js} +0 -0
  447. /package/build/esm/{WEIGHT_GIRLS.percentile.monthly-2d420c45.js → WEIGHT_GIRLS.percentile.monthly-946194f0.js} +0 -0
  448. /package/build/esm/{WEIGHT_GIRLS.percentile.weekly-7c95da70.js → WEIGHT_GIRLS.percentile.weekly-b287390e.js} +0 -0
  449. /package/build/esm/{WEIGHT_GIRLS.percentile.yearly-131a0c7e.js → WEIGHT_GIRLS.percentile.yearly-e96fe906.js} +0 -0
  450. /package/build/esm/{WEIGHT_GIRLS.zscore.monthly-bf6a297e.js → WEIGHT_GIRLS.zscore.monthly-60764e0c.js} +0 -0
  451. /package/build/esm/{WEIGHT_GIRLS.zscore.weekly-a45a5b31.js → WEIGHT_GIRLS.zscore.weekly-087ddda5.js} +0 -0
  452. /package/build/esm/{WEIGHT_GIRLS.zscore.yearly-1673c2b4.js → WEIGHT_GIRLS.zscore.yearly-47c3dd0a.js} +0 -0
  453. /package/build/esm/{animation-b441d9e7.js → animation-76013e0b.js} +0 -0
  454. /package/build/esm/{constants-df4d1c0d.js → constants-ac34ed4f.js} +0 -0
  455. /package/build/esm/{constants-568c2ca4.js → constants-b590605c.js} +0 -0
  456. /package/build/esm/{constants-a84552ab.js → constants-f3968f75.js} +0 -0
  457. /package/build/esm/{dataTransform-1801ffc6.js → dataTransform-bf4d81b8.js} +0 -0
  458. /package/build/esm/{doctor-921f53e7.js → doctor-5b97ae3d.js} +0 -0
  459. /package/build/esm/{index-404735f4.js → index-0a237cbd.js} +0 -0
  460. /package/build/esm/{index-f226ee8e.js → index-147e6cf9.js} +0 -0
  461. /package/build/esm/{index-c7b97299.js → index-1911b6f9.js} +0 -0
  462. /package/build/esm/{index-24541ad3.js → index-865c7727.js} +0 -0
  463. /package/build/esm/{index-9f91a24e.js → index-8c5d00a2.js} +0 -0
  464. /package/build/esm/{index-ece91fe7.js → index-b185e518.js} +0 -0
  465. /package/build/esm/{index-18fc11e8.js → index-f7818a44.js} +0 -0
  466. /package/build/esm/{index-58b02c69.js → index-fd01f1c2.js} +0 -0
  467. /package/build/esm/{localizeNumberFormat-af0711db.js → localizeNumberFormat-40112b76.js} +0 -0
  468. /package/build/esm/{normalizeLink-98741f59.js → normalizeLink-523d95b2.js} +0 -0
  469. /package/build/esm/{number-8cf59b73.js → number-77fa37a8.js} +0 -0
  470. /package/build/esm/{other-5355d55f.js → other-51b10c8a.js} +0 -0
  471. /package/build/esm/{paths-59c509e3.js → paths-8ca580bb.js} +0 -0
  472. /package/build/esm/{routing-f4ff38f2.js → routing-d85d723f.js} +0 -0
  473. /package/build/esm/{translationsContext-4bf4000a.js → translationsContext-b263811e.js} +0 -0
  474. /package/build/esm/{tslib.es6-bb49a9db.js → tslib.es6-2cbcde6f.js} +0 -0
  475. /package/build/esm/{types-f588016e.js → types-96174873.js} +0 -0
  476. /package/build/esm/{useIsInit-93c72c57.js → useIsInit-926c41cb.js} +0 -0
  477. /package/build/esm/{useOutsideClick-1f5614e9.js → useOutsideClick-cbc19979.js} +0 -0
  478. /package/build/esm/{useScrollbarSize-09745987.js → useScrollbarSize-b259fdb7.js} +0 -0
  479. /package/build/esm/{useUniqueId-f32a085b.js → useUniqueId-364a86d4.js} +0 -0
  480. /package/build/esm/{utils-393be1f5.js → utils-a97be8ef.js} +0 -0
  481. /package/build/{index-27ca71a1.js → index-208ac2dd.js} +0 -0
  482. /package/build/{index-919c8bcc.js → index-22c63ba8.js} +0 -0
  483. /package/build/{index-c1400cee.js → index-62ac5059.js} +0 -0
  484. /package/build/{index-f5eaaf0a.js → index-c98537e3.js} +0 -0
  485. /package/build/{index-e14e6c07.js → index-ce6ecbf4.js} +0 -0
  486. /package/build/{index-98868c1d.js → index-da4685a9.js} +0 -0
  487. /package/build/{index-9dcca919.js → index-f716ceb1.js} +0 -0
  488. /package/build/{index-670ba3e3.js → index-ffd436d7.js} +0 -0
  489. /package/build/{localizeNumberFormat-5f29804a.js → localizeNumberFormat-fea20ffb.js} +0 -0
  490. /package/build/{normalizeLink-fab7982c.js → normalizeLink-08a6ae1e.js} +0 -0
  491. /package/build/{number-7485b550.js → number-7962219e.js} +0 -0
  492. /package/build/{other-7842a151.js → other-91c6d8eb.js} +0 -0
  493. /package/build/{paths-76a73441.js → paths-d0b584d8.js} +0 -0
  494. /package/build/{routing-ab1ad38d.js → routing-42da019f.js} +0 -0
  495. /package/build/{translationsContext-531de800.js → translationsContext-6bbd75c6.js} +0 -0
  496. /package/build/{tslib.es6-ba3eff7f.js → tslib.es6-4e4fa04c.js} +0 -0
  497. /package/build/{types-88e52088.js → types-0b45377f.js} +0 -0
  498. /package/build/{useIsInit-24caa63d.js → useIsInit-3ed4b648.js} +0 -0
  499. /package/build/{useOutsideClick-d75084aa.js → useOutsideClick-337c0e28.js} +0 -0
  500. /package/build/{useScrollbarSize-ad4b22ea.js → useScrollbarSize-f842ffb9.js} +0 -0
  501. /package/build/{useUniqueId-fafea8ea.js → useUniqueId-568a2176.js} +0 -0
  502. /package/build/{utils-59b38be2.js → utils-8eb77654.js} +0 -0
@@ -0,0 +1,2164 @@
1
+ import React__default, { createContext, useState, useRef, useMemo, useEffect } from 'react';
2
+ import { createPortal } from 'react-dom';
3
+ import { ChevronLeft } from '@hhgtech/icons/arrow';
4
+ import { Close } from '@hhgtech/icons/core';
5
+ import { L as LogoIcon } from './logoIcon-d30efc99.js';
6
+ import { B as Button } from './index-eb1c3a22.js';
7
+ import { M as Modal } from './index-82bd111e.js';
8
+ import { Box, Stack, Group } from '@mantine/core';
9
+ import throttle from 'lodash/throttle';
10
+ import { f as Accordion, I as Input, P as Phone, O as OTP, g as PasswordInput, R as Radio } from './index-de16bcda.js';
11
+ import '@mantine/dates';
12
+ import { L as LOCALE_SPECS, f as BEARER_REFRESH_TOKEN_COOKIE } from './index-a69a171f.js';
13
+ import './index-d26cefad.js';
14
+ import './index-865c7727.js';
15
+ import { s as showNotification } from './useMantineLocale-9b4e6ec5.js';
16
+ import { T as Text } from './index-bc8a6968.js';
17
+ import { u as useTranslations } from './useTranslations-307c6ca4.js';
18
+ import '@mantine/hooks';
19
+ import { a as getPopupWrapperDom } from './utils-a97be8ef.js';
20
+ import './other-51b10c8a.js';
21
+ import { L as LOCALE } from './Locale-0a28cd1a.js';
22
+ import './translationsContext-b263811e.js';
23
+ import 'string-format';
24
+ import { a as __awaiter, _ as __rest } from './tslib.es6-2cbcde6f.js';
25
+ import { isProduction } from './constantsIsProduction.js';
26
+ import { a as getCurrentSsoUrl } from './routing-d85d723f.js';
27
+ import { setCookie } from './miscCookieHelper.js';
28
+ import { domainLocales } from './constantsDomainLocales.js';
29
+ import { G as Google, F as Facebook } from './Google-664b8b3c.js';
30
+ import { Info } from '@hhgtech/icons/other';
31
+ import './index.styles-fdecf1c6.js';
32
+ import styled from '@emotion/styled';
33
+ import { M as MAPPED_LOCALE } from './utils-2832a25c.js';
34
+ import { useForm, yupResolver } from '@mantine/form';
35
+ import * as yup from 'yup';
36
+ import dayjs from 'dayjs';
37
+ import { D as DatePicker } from './index-3bc01607.js';
38
+ import { u as useSSOV2Store } from './store-4b7ab103.js';
39
+ export { u as useSSOV2Store } from './store-4b7ab103.js';
40
+ import './index-61e80f3d.js';
41
+ import '@mantine/carousel';
42
+ import './miscTheme.js';
43
+ import 'classnames';
44
+ import './useUniqueId-364a86d4.js';
45
+ import './constantsSite.js';
46
+ import 'date-fns/locale';
47
+ import './constantsRiskScreener.js';
48
+ import '@mantine/notifications';
49
+ import 'zustand';
50
+
51
+ const SSOStateContext = createContext({
52
+ locale: LOCALE.Vietnam,
53
+ onClose: () => false,
54
+ source: 'default',
55
+ });
56
+ const SSOStateProvider = ({ children, locale = LOCALE.Vietnam, onClose, source = 'default', }) => {
57
+ const [openCollectInfoPopup, setOpenCollectInfoPopup] = React__default.useState(false);
58
+ return (React__default.createElement(SSOStateContext.Provider, { value: {
59
+ locale,
60
+ onClose,
61
+ source,
62
+ openCollectInfoPopup,
63
+ setOpenCollectInfoPopup,
64
+ } }, children));
65
+ };
66
+ const useSSOState = () => {
67
+ return React__default.useContext(SSOStateContext);
68
+ };
69
+
70
+ const BackgroundHeader$1 = () => (React__default.createElement("svg", { width: "292", height: "255", viewBox: "0 0 292 255", fill: "none", xmlns: "http://www.w3.org/2000/svg", style: {
71
+ position: 'absolute',
72
+ top: 0,
73
+ left: '50%',
74
+ zIndex: 0,
75
+ transform: 'translateX(-50%)',
76
+ pointerEvents: 'none',
77
+ } },
78
+ React__default.createElement("circle", { opacity: ".2", cx: "146", cy: "109", r: "146", fill: "url(#paint0_linear_908_34610)" }),
79
+ React__default.createElement("circle", { opacity: ".3", cx: "146", cy: "109", r: "85", fill: "url(#paint1_linear_908_34610)" }),
80
+ React__default.createElement("circle", { cx: "146.5", cy: "108.5", r: "47.5", fill: "url(#paint2_linear_908_34610)" }),
81
+ React__default.createElement("circle", { cx: "146.5", cy: "108.5", r: "47", stroke: "url(#paint3_linear_908_34610)" }),
82
+ React__default.createElement("path", { d: "M163.327 94.716c-.522-3.187-7.981-5.714-17.11-5.714s-16.589 2.527-17.111 5.714h-.032v26.428h.032c.522 3.186 7.982 5.714 17.111 5.714 9.128 0 16.588-2.528 17.11-5.714h.032V94.716z", fill: "#545E73" }),
83
+ React__default.createElement("path", { d: "M146.217 118.286c-9.468 0-17.143-2.718-17.143-6.071v8.928h.032c.522 3.187 7.982 5.714 17.111 5.714 9.128 0 16.588-2.527 17.11-5.714h.032v-8.928c0 3.353-7.675 6.071-17.142 6.071", fill: "#2B62CD" }),
84
+ React__default.createElement("path", { d: "M129.074 111.859v.358q.002-.18.032-.358zm34.25 0q.031.178.032.358v-.358z", fill: "#38454F" }),
85
+ React__default.createElement("path", { d: "M146.217 109.714c-9.468 0-17.143-2.719-17.143-6.071v8.928h.032c.522 3.186 7.982 5.714 17.111 5.714 9.128 0 16.588-2.528 17.11-5.714h.032v-8.928c0 3.352-7.675 6.071-17.142 6.071", fill: "#2D87F3" }),
86
+ React__default.createElement("path", { d: "M129.074 103.287v.357q.002-.18.032-.357zm34.25 0q.031.178.032.357v-.357z", fill: "#556080" }),
87
+ React__default.createElement("path", { d: "M146.217 101.145c9.467 0 17.142-2.719 17.142-6.072s-7.675-6.071-17.142-6.071c-9.468 0-17.143 2.718-17.143 6.071s7.675 6.072 17.143 6.072", fill: "#91CAFF" }),
88
+ React__default.createElement("path", { d: "M146.217 101.144c-9.468 0-17.143-2.719-17.143-6.072v8.929h.032c.522 3.186 7.982 5.714 17.111 5.714 9.128 0 16.588-2.528 17.11-5.714h.032v-8.929c0 3.353-7.675 6.072-17.142 6.072", fill: "#45A4FF" }),
89
+ React__default.createElement("path", { d: "M129.074 94.717v.357q.002-.18.032-.357zm34.25 0q.031.177.032.357v-.357z", fill: "#8697CB" }),
90
+ React__default.createElement("path", { d: "M156.36 129.002a8.57 8.57 0 0 0 8.571-8.571 8.571 8.571 0 1 0-8.571 8.571", fill: "#00B16A" }),
91
+ React__default.createElement("path", { d: "M161.054 116.273a.714.714 0 0 0-.995.178l-3.997 5.743-2.82-2.316a.714.714 0 0 0-.906 1.105l3.418 2.806a.72.72 0 0 0 1.04-.144l4.438-6.377a.716.716 0 0 0-.178-.995", fill: "#fff" }),
92
+ React__default.createElement("defs", null,
93
+ React__default.createElement("linearGradient", { id: "paint0_linear_908_34610", x1: "147.5", y1: "141", x2: "36.5", y2: "30", gradientUnits: "userSpaceOnUse" },
94
+ React__default.createElement("stop", { stopColor: "#fff", stopOpacity: "0" }),
95
+ React__default.createElement("stop", { offset: "1", stopColor: "#fff" })),
96
+ React__default.createElement("linearGradient", { id: "paint1_linear_908_34610", x1: "218.376", y1: "63.134", x2: "61", y2: "109", gradientUnits: "userSpaceOnUse" },
97
+ React__default.createElement("stop", { stopColor: "#fff" }),
98
+ React__default.createElement("stop", { offset: "1", stopColor: "#fff", stopOpacity: "0" })),
99
+ React__default.createElement("linearGradient", { id: "paint2_linear_908_34610", x1: "146.5", y1: "61", x2: "146.5", y2: "156", gradientUnits: "userSpaceOnUse" },
100
+ React__default.createElement("stop", { stopColor: "#fff", stopOpacity: ".6" }),
101
+ React__default.createElement("stop", { offset: "1", stopColor: "#fff", stopOpacity: "0" })),
102
+ React__default.createElement("linearGradient", { id: "paint3_linear_908_34610", x1: "178.979", y1: "98.35", x2: "108.338", y2: "98.35", gradientUnits: "userSpaceOnUse" },
103
+ React__default.createElement("stop", { stopColor: "#fff", stopOpacity: "0" }),
104
+ React__default.createElement("stop", { offset: "1", stopColor: "#fff" })))));
105
+
106
+ const CustomerSupportIcon = () => {
107
+ return (React__default.createElement("svg", { width: "32", height: "32", viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
108
+ React__default.createElement("g", { clipPath: "url(#clip0_911_24123)" },
109
+ React__default.createElement("path", { d: "M23.3 16.625c-.042-1.1.166-4.401.166-4.401.073-.27.15-.594.205-.854C25.33 3.783 20.246.75 16 .75c-1.133 0-2.488.413-3.13 1.203a.82.82 0 0 1-.503.307c-2.862.46-4.742 4.183-4.062 8.77q.087.586.23 1.19v.002c.183 1.009.231 3.303.165 4.403-.271 4.482-5.173 8.453-1.985 11.608 8.41 1.974 10.202 2.142 18.57 0 3.187-3.155-1.81-7.122-1.985-11.608", fill: "#9B4E4E" }),
110
+ React__default.createElement("path", { d: "M24.675 14.972a3.2 3.2 0 0 0-.64-.718.25.25 0 1 0-.302.399q.308.261.53.6a1.41 1.41 0 0 1 .177 1.562c-.465.892-1.84 1.63-3.614 2.043q.139.221.264.451c1.85-.457 3.275-1.267 3.794-2.263a1.89 1.89 0 0 0-.21-2.074", fill: "#473049" }),
111
+ React__default.createElement("path", { d: "M18.545 22.798c-.35.41-2.09 4.555-2.535 5.29-.448-.735-2.198-4.89-2.545-5.3.351-.358.597-.808.707-1.297q.096-.405.115-.82c.365.137 3.063.134 3.428-.003v.003q.018.4.11.79c.107.505.357.969.72 1.337", fill: "#FF977B" }),
112
+ React__default.createElement("path", { d: "M17.824 21.46a3.39 3.39 0 0 1-3.652.03q.095-.404.115-.82c.365.138 3.062.135 3.427-.002v.003q.018.4.11.79", fill: "#FF7364" }),
113
+ React__default.createElement("path", { d: "M25.284 28.233c.153.66-.362 1.082-1.08 1.472-.917.5-3.717 1.55-8.205 1.55s-7.287-1.05-8.205-1.55c-.717-.39-1.232-.812-1.08-1.472.048-.187.126-.365.233-.525.535-.84 1.567-2.198 4.2-3.598q.335-.174.692-.33c.075 1.013 2.985.21 2.985.21a.96.96 0 0 1 .57.835c.038.888.168 2.528.615 3.263.445-.735.575-2.375.613-3.263a.96.96 0 0 1 .57-.835s2.907.81 2.985-.202q.347.151.675.322c2.632 1.4 3.665 2.758 4.2 3.598.107.16.185.338.232.525", fill: "#F9E0B4" }),
114
+ React__default.createElement("path", { d: "M22.317 12.023c.359-.006.715.05 1.055.165.785.282 1.33.962 1.2 2.3-.105 1.1-.647 1.752-1.317 2.03-.461.188-.97.217-1.45.085.277-.97.555-3.88.512-4.58m-12.124 4.579a2.26 2.26 0 0 1-1.448-.082c-.672-.28-1.215-.93-1.322-2.033-.123-1.287.375-1.965 1.112-2.265a3 3 0 0 1 1.145-.2c-.042.7.235 3.61.513 4.58", fill: "#4B3956" }),
115
+ React__default.createElement("path", { d: "M22.319 12.021c.04.7-.235 3.61-.513 4.581-.285.996-1.532 3.582-5.285 4.418a2.4 2.4 0 0 1-1.044 0c-3.752-.836-5-3.422-5.284-4.418-.278-.97-.554-3.88-.513-4.58 1.219-.669.668-2.955 1.56-5.057.556-1.307 1.305-1.644 1.722-1.727a.9.9 0 0 0 .533-.338c1.6-2.056 4.794-.95 5.966 1.225 1.066 1.977 1.225 4.918 2.858 5.896", fill: "#FFB497" }),
116
+ React__default.createElement("path", { d: "M20.13 23.118c.067.217.083.446.048.67-.077 1.012-.52 2.735-1.227 2.542-1.018-.277-1.758-2.34-1.758-2.34.518-.23 1.003-.782 1.353-1.192q.068-.086.132-.16a.463.463 0 0 1 .625-.103c.295.153.683.345.828.583m-5.306.872s-.74 2.063-1.758 2.34c-.71.193-1.152-1.537-1.227-2.55a1.5 1.5 0 0 1 .047-.662c.145-.238.533-.43.828-.583a.463.463 0 0 1 .625.103l.125.15c.347.41.837.972 1.36 1.202", fill: "#F7F0DF" }),
117
+ React__default.createElement("path", { d: "M14.94 16.018a.306.306 0 0 0-.3.385 1.414 1.414 0 0 0 2.72 0 .307.307 0 0 0-.3-.385z", fill: "#fff" }),
118
+ React__default.createElement("path", { d: "M12.776 11.492h-.05a.676.676 0 0 0-.675.676v.541c0 .374.302.676.676.676h.049a.676.676 0 0 0 .676-.676v-.54a.676.676 0 0 0-.676-.677m6.448 1.893h.05a.676.676 0 0 0 .675-.676v-.541a.676.676 0 0 0-.676-.676h-.049a.676.676 0 0 0-.676.675v.542c0 .373.303.676.676.676", fill: "#9B4E4E" }),
119
+ React__default.createElement("path", { d: "M16.017 29.117h-.034a.47.47 0 0 0-.471.472v.034c0 .26.21.471.471.471h.034c.26 0 .472-.21.472-.471v-.034a.47.47 0 0 0-.472-.472", fill: "#fff" }),
120
+ React__default.createElement("path", { d: "M16.003 15.2c-.008 0-.69-.01-.69-.402a.25.25 0 0 1 .455-.142 1 1 0 0 0 .235.044.8.8 0 0 0 .229-.044.25.25 0 0 1 .456.142c0 .391-.679.402-.685.402", fill: "#FF7364" }),
121
+ React__default.createElement("path", { d: "M11.532 12.095a.25.25 0 0 1-.225-.36 1.62 1.62 0 0 1 1.338-.752c.396-.017.782.124 1.075.39a.25.25 0 1 1-.333.374 1 1 0 0 0-.742-.264 1.14 1.14 0 0 0-.888.473.25.25 0 0 1-.225.14m-.451-1.716a.25.25 0 0 1-.175-.43c.606-.587 2.632-.888 3.235-.48a.25.25 0 0 1-.281.415c-.37-.253-2.149-.02-2.606.425a.25.25 0 0 1-.173.07m9.387 1.715a.25.25 0 0 1-.226-.14 1.14 1.14 0 0 0-.887-.472 1 1 0 0 0-.742.264.25.25 0 1 1-.332-.373c.293-.267.68-.408 1.075-.391a1.62 1.62 0 0 1 1.337.752.25.25 0 0 1-.225.36m.452-1.715a.25.25 0 0 1-.174-.07c-.457-.444-2.235-.677-2.605-.426a.25.25 0 0 1-.281-.414c.603-.408 2.628-.108 3.234.48a.25.25 0 0 1-.175.43zm2.71 1.175c-.135-.78-.492-2.643-2.005-5.64-.06-.125-.092-.258.005-.355a.254.254 0 0 1 .355.005c.795.817 1.67 2.882 1.9 4.565zM10.163 6.313c-.015.025-1.525 2.925-1.83 4.89l-.028-.173q-.1-.658-.127-1.322C8.54 7.94 9.673 6.16 9.73 6.063a.25.25 0 0 1 .34-.093.25.25 0 0 1 .093.343", fill: "#844040" }),
122
+ React__default.createElement("path", { d: "M23.29 17.917c-1.345.813-3.559 1.331-5.908 1.3a.254.254 0 0 0-.253.247.25.25 0 0 0 .246.253l.23.002c2.522 0 4.831-.603 6.2-1.543a23 23 0 0 1-.516-.259", fill: "#473049" }),
123
+ React__default.createElement("path", { d: "M16.138 20.42c.686 0 1.241-.426 1.241-.952s-.555-.952-1.241-.952-1.242.426-1.242.952.556.952 1.242.952", fill: "#4B3956" })),
124
+ React__default.createElement("defs", null,
125
+ React__default.createElement("clipPath", { id: "clip0_911_24123" },
126
+ React__default.createElement("path", { fill: "#fff", d: "M0 0h32v32H0z" })))));
127
+ };
128
+
129
+ const HealthUpdateIcon = () => {
130
+ return (React__default.createElement("svg", { width: "32", height: "32", viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
131
+ React__default.createElement("path", { d: "M20.69 3.066 4.714 5.456a1.714 1.714 0 0 0-1.442 1.95l3.01 20.106a1.714 1.714 0 0 0 1.948 1.442l15.975-2.39a1.714 1.714 0 0 0 1.441-1.95L22.638 4.507a1.714 1.714 0 0 0-1.949-1.441", fill: "#1B89E5" }),
132
+ React__default.createElement("path", { d: "m4.488 5.49 16.427-2.458 3.13 20.914-16.427 2.458z", fill: "#fff" }),
133
+ React__default.createElement("path", { d: "m13.559 8.067-.567.084a.83.83 0 0 0-.696.942l.02.141a.18.18 0 0 1-.15.203l-.14.021a.83.83 0 0 0-.697.942l.085.568a.83.83 0 0 0 .942.696l.141-.021a.18.18 0 0 1 .203.15l.022.14a.83.83 0 0 0 .942.697l.566-.085a.83.83 0 0 0 .697-.941l-.021-.142a.18.18 0 0 1 .15-.203l.141-.021a.83.83 0 0 0 .697-.943l-.085-.565a.83.83 0 0 0-.942-.697l-.142.022a.18.18 0 0 1-.203-.15l-.02-.142a.83.83 0 0 0-.943-.696m6.553 5.392-9.31 1.393a.32.32 0 0 0 .094.634l9.31-1.393a.32.32 0 1 0-.095-.634m.299 2.303L8.74 17.508a.32.32 0 0 0 .096.634l11.67-1.746a.32.32 0 0 0-.096-.634m-.591 2.436L9.039 19.81a.32.32 0 1 0 .095.634l10.78-1.613a.32.32 0 0 0-.095-.634m-1.084 2.51-9.397 1.406a.32.32 0 0 0 .095.634l9.397-1.407a.32.32 0 1 0-.095-.633m2.318-.347-.828.124a.32.32 0 0 0 .095.634l.828-.124a.32.32 0 0 0-.095-.634", fill: "#78C5EF" }),
134
+ React__default.createElement("path", { d: "m27.358 4.303-.805-.273a1.26 1.26 0 0 0-1.596.789l-4.406 13.013.494 2.544a.442.442 0 0 0 .728.246l1.937-1.72 2.61-7.71.224.075a.583.583 0 0 0 .739-.365l1.357-4.007a2.045 2.045 0 0 0-1.282-2.592", fill: "#36B1F2" }),
135
+ React__default.createElement("path", { d: "M26.32 11.443a.25.25 0 0 1-.236-.33l1.614-4.768a.25.25 0 1 1 .474.16l-1.615 4.768a.25.25 0 0 1-.237.17", fill: "#1B89E5" }),
136
+ React__default.createElement("path", { d: "M17.67 5.535 8.324 6.934a1.15 1.15 0 0 1-1.307-.967l-.098-.654a.44.44 0 0 1 .368-.497l10.754-1.61a.437.437 0 0 1 .498.368l.097.654a1.15 1.15 0 0 1-.967 1.307z", fill: "#3C3854" })));
137
+ };
138
+
139
+ const PersonalizeIcon = () => {
140
+ return (React__default.createElement("svg", { width: "32", height: "32", viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
141
+ React__default.createElement("path", { d: "M31.364 22.343a5 5 0 0 0-1.713-1.477c-.847-.488-1.52-.816-1.638-1.931h-1.761c-.12 1.115-.797 1.443-1.644 1.931a5 5 0 0 0-1.712 1.477c-.33.438-.095.709.331.936.723.386 2.4.827 3.903.827 1.502 0 3.18-.441 3.902-.827.426-.227.662-.498.332-.936", fill: "#F78181" }),
142
+ React__default.createElement("path", { d: "M21.765 14c-.006-3.907-4.11-7.388-7.666-4.77a.4.4 0 0 1-.129.065c-.958.303-1.65 1.213-2.108 2.305-1.408 3.347.2 7.77-.291 11.538h9.938c-.185-2.536.26-6.777.256-9.138", fill: "#FF6671" }),
143
+ React__default.createElement("path", { d: "M5.354 9.745c-3.033 0-5.268 3.012-4.76 6.07.424 2.568 3.008 2.747 3.008 2.747l3.5-.003s2.586-.175 3.012-2.743c.507-3.06-1.728-6.07-4.76-6.07", fill: "#3A417C" }),
144
+ React__default.createElement("path", { d: "M9.073 22.755c-.688.367-2.288.79-3.72.79s-3.03-.423-3.72-.79c-.408-.218-.63-.475-.318-.893.43-.588.99-1.07 1.635-1.407.205-.118.393-.203.563-.283h.002c.503-.235.843-.415.928-1.207h1.822c.085.797.428.975.935 1.21.17.08.355.165.558.28.644.339 1.202.82 1.632 1.407.315.418.09.675-.317.893", fill: "#BF6666" }),
145
+ React__default.createElement("path", { d: "M31.332 22.342a5.04 5.04 0 0 0-1.712-1.477 9 9 0 0 1-.815-.498 3.43 3.43 0 0 1-3.373-.005c-.245.178-.547.325-.855.503a5 5 0 0 0-1.712 1.477c-.33.44-.095.71.33.938.722.385 2.4.827 3.902.827s3.18-.442 3.903-.827c.427-.228.662-.498.332-.938", fill: "#3A417C" }),
146
+ React__default.createElement("path", { d: "M28.232 9.496c-1.05-.28-3.25-.14-3.708 1.205a.46.46 0 0 1-.18.24c-1.035.682-1.353 1.643-.862 3.845h7.298c.738-4.148-1.278-4.95-2.548-5.29", fill: "#FFB45A" }),
147
+ React__default.createElement("path", { d: "M8.402 14.623a.51.51 0 0 1 .229.432 5.9 5.9 0 0 1-.278 1.793c-.262.697-.942 1.882-2.245 2.152a4 4 0 0 1-.757.09 4 4 0 0 1-.76-.09c-1.303-.27-1.98-1.455-2.243-2.152a5.9 5.9 0 0 1-.278-1.793.51.51 0 0 1 .229-.432c.99-.668 2.339-.862 3.052-.86.71-.002 2.06.192 3.051.86", fill: "#CE7A7A" }),
148
+ React__default.createElement("path", { d: "M30.781 14.786a1.2 1.2 0 0 0-.469-.053.45.45 0 0 1-.225-.04c-.956-.438-.852-1.208-.955-1.723-.407-2.036-2.745-1.94-3.408-1.24a.36.36 0 0 1-.19.11c-.87.175-1.371 1.948-1.469 2.68a.24.24 0 0 1-.232.209q-.18 0-.35.057c-.448.157-.572.675-.392 1.157a1.03 1.03 0 0 0 .948.725.255.255 0 0 1 .267.175 3.31 3.31 0 0 0 1.945 2.092 2.13 2.13 0 0 0 1.762 0 3.3 3.3 0 0 0 1.945-2.092.254.254 0 0 1 .267-.175 1.03 1.03 0 0 0 .947-.725c.181-.482.056-1-.391-1.157m-9.271 8.351a5.9 5.9 0 0 0-2.012-1.734c-.995-.573-1.723-.494-1.863-1.803l-2.213-.01c-.14 1.31-.844 1.24-1.839 1.814a5.9 5.9 0 0 0-2.011 1.734c-.388.515-.112.833.389 1.1.849.453 2.82.972 4.584.972s3.726-.519 4.575-.972c.5-.268.777-.586.39-1.1", fill: "#FF9797" }),
149
+ React__default.createElement("path", { d: "M21.51 23.137a5.9 5.9 0 0 0-2.012-1.734c-.995-.573-1.723-.494-1.863-1.803l-2.213-.01c-.14 1.31-.844 1.24-1.839 1.814a5.9 5.9 0 0 0-2.011 1.734c-.388.515-.112.833.389 1.1.849.453 2.82.972 4.584.972s3.726-.519 4.575-.972c.5-.268.777-.586.39-1.1", fill: "#FF9797" }),
150
+ React__default.createElement("path", { d: "M18.682 13.703a3.32 3.32 0 0 1 1.206 3.398 3.63 3.63 0 0 1-2.229 2.489 3.5 3.5 0 0 1-1.118.213 3.5 3.5 0 0 1-1.12-.213 3.63 3.63 0 0 1-2.228-2.49 8.5 8.5 0 0 1-.284-2.55c.137-2.045.975-3.52 2.095-3.245a.25.25 0 0 0 .182-.023c1.377-.755 1.672 1.03 3.496 2.421", fill: "#FFAEAE" }),
151
+ React__default.createElement("path", { d: "M21.12 24.238c-.85.452-2.81.972-4.575.972s-3.735-.52-4.585-.972c-.5-.268-.777-.585-.387-1.1a5.65 5.65 0 0 1 1.735-1.573 6.03 6.03 0 0 0 3.232.788 6.1 6.1 0 0 0 3.253-.775 5.7 5.7 0 0 1 1.717 1.56c.388.515.11.832-.39 1.1", fill: "#5C8EFF" }),
152
+ React__default.createElement("path", { d: "M9.073 22.755c-.688.368-2.288.79-3.72.79s-3.03-.422-3.72-.79c-.408-.217-.63-.475-.318-.892.43-.588.99-1.07 1.635-1.408.205-.117.393-.202.563-.282h.002c.557.318 1.192.47 1.833.44a3.47 3.47 0 0 0 1.852-.438c.17.08.355.165.558.28a4.8 4.8 0 0 1 1.632 1.408c.315.417.09.675-.317.892", fill: "#4856B5" })));
153
+ };
154
+
155
+ const SecurityIcon = () => {
156
+ return (React__default.createElement("svg", { width: "32", height: "32", viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
157
+ React__default.createElement("path", { d: "M16 29.625c1.196 0 2.348-.639 3.327-1.31 5.423-3.715 6.606-5.558 6.995-6.163.436-.68 1.533-2.23 2.73-12.356.33-2.804-1.143-5.19-3.893-6.066a31.65 31.65 0 0 0-18.319 0c-2.75.874-4.222 3.262-3.892 6.067 1.196 10.125 2.293 11.674 2.73 12.355.388.605 1.572 2.448 6.994 6.163.98.671 2.13 1.31 3.328 1.31", fill: "#9DBA22" }),
158
+ React__default.createElement("path", { d: "M25.142 7.18c-2.902-1.307-6.095-1.645-9.143-1.645s-6.241.338-9.143 1.645c-.7.316-1.115.77-1.04 1.365.382 3.052 1.583 11.235 2.192 12.128 1.21 1.777 5.533 4.67 7.267 5.788a1.37 1.37 0 0 0 1.448 0c1.733-1.119 6.056-4.011 7.267-5.788.609-.893 1.81-9.075 2.193-12.128.074-.595-.34-1.049-1.041-1.365", fill: "#BFDF46" }),
159
+ React__default.createElement("path", { d: "M15.798 19.264c-1.522-.418-2.486-1.494-2.992-3.333a9.2 9.2 0 0 1-.177-4.156c.109-.644.715-1.192 1.434-.802q1.159.616 2.377 1.102c2.909 1.205 3.817 4.07 2.732 5.783-.578.912-1.922 1.806-3.375 1.406", fill: "#fff" }),
160
+ React__default.createElement("path", { d: "M20.667 20.13a.3.3 0 0 1-.095-.015c-2.152-.684-4.24-2.662-4.838-4.08a.313.313 0 0 1 .508-.35q.045.045.067.106c.461 1.092 2.311 3.048 4.451 3.728a.313.313 0 0 1-.094.61", fill: "#9DBA22" })));
161
+ };
162
+
163
+ const ServiceIcon = () => {
164
+ return (React__default.createElement("svg", { width: "32", height: "32", viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
165
+ React__default.createElement("g", { clipPath: "url(#clip0_911_3434)" },
166
+ React__default.createElement("path", { d: "M30.466 17.553c.714-.548.988-1.39.611-1.881s-1.261-.444-1.975.104c-.714.549-.988 1.391-.611 1.882s1.261.444 1.975-.105", fill: "#563960" }),
167
+ React__default.createElement("path", { d: "M30.122 7.72a2.2 2.2 0 0 1-.438.37 2.355 2.355 0 0 1-2.787-3.79l.022-.017a2.356 2.356 0 0 1 3.203 3.437", fill: "#E8E2E2" }),
168
+ React__default.createElement("path", { d: "M16.474 3.996c-.544-.568-1.058-1.45-1.082-2.29l-1.395.7a1.394 1.394 0 1 0 1.247 2.491l1.159-.583.259-.14a3 3 0 0 1-.188-.178", fill: "#E5395E" }),
169
+ React__default.createElement("path", { d: "M18.934 2.175a1.39 1.39 0 0 1-.77 1.246l-1.472.738-.256.138a2.52 2.52 0 0 1-1.189-1.331 2 2 0 0 1-.042-1.165l.353-.191 1.358-.68a1.392 1.392 0 0 1 2.018 1.245", fill: "#F9AF2B" }),
170
+ React__default.createElement("path", { d: "M5.507 6.695c-.407.705-1.475.86-2.425.362L2.975 7a3 3 0 0 1-.358-.248c.005-.012 1.05-.635 1.355-1.157.258-.44.25-1.335.268-1.38q.136.058.265.132.132.078.257.168c.795.585 1.128 1.515.745 2.18", fill: "#F44A52" }),
171
+ React__default.createElement("path", { d: "M4.343 5.848a2.9 2.9 0 0 1-1.285 1.197L2.976 7a2.6 2.6 0 0 1-.398-.28c-.692-.587-.965-1.442-.605-2.067.378-.655 1.323-.833 2.215-.463a3 3 0 0 1 .51.28c.029.485-.095.967-.355 1.378", fill: "#E8E2E2" }),
172
+ React__default.createElement("path", { d: "M1.87 17.24a1.12 1.12 0 1 0 0-2.24 1.12 1.12 0 0 0 0 2.24", fill: "#F9AF2B" }),
173
+ React__default.createElement("path", { d: "M30.123 7.72a2.2 2.2 0 0 1-.437.37c0-1.013-1.5-3.058-3.153-3.418q.162-.206.365-.372l.023-.018c1.65.45 3.052 2.16 3.202 3.438", fill: "#C3C7C9" }),
174
+ React__default.createElement("path", { d: "M25.295 17.4v9.637c0 2.13-1.745 3.225-3.855 3.518-2.707.375-8.128.375-10.835 0-2.11-.29-3.855-1.387-3.855-3.517v-9.637a3.86 3.86 0 0 1 1.354-2.93c.229-.194.412-.436.537-.71h14.767c.12.275.303.518.534.71q.16.135.303.29a3.85 3.85 0 0 1 1.05 2.64", fill: "#1B89E5" }),
175
+ React__default.createElement("path", { d: "M16.568 17.151h-1.093a1.58 1.58 0 0 0-1.58 1.58v.272a.34.34 0 0 1-.34.34h-.272a1.58 1.58 0 0 0-1.58 1.58v1.095a1.58 1.58 0 0 0 1.58 1.58h.272a.34.34 0 0 1 .34.34v.272a1.58 1.58 0 0 0 1.58 1.58h1.093a1.58 1.58 0 0 0 1.58-1.58v-.273a.34.34 0 0 1 .34-.34h.274a1.58 1.58 0 0 0 1.58-1.58v-1.092a1.58 1.58 0 0 0-1.58-1.58h-.273a.34.34 0 0 1-.341-.34v-.274a1.58 1.58 0 0 0-1.58-1.58", fill: "#fff" }),
176
+ React__default.createElement("path", { d: "M24.137 13.762H7.907a.47.47 0 0 1-.471-.47v-2.7a2.583 2.583 0 0 1 2.552-2.554c3.017-.1 9.05-.1 12.067 0a2.583 2.583 0 0 1 2.553 2.552v2.7a.473.473 0 0 1-.471.472", fill: "#E8E2E2" })),
177
+ React__default.createElement("defs", null,
178
+ React__default.createElement("clipPath", { id: "clip0_911_3434" },
179
+ React__default.createElement("path", { fill: "#fff", d: "M0 0h32v32H0z" })))));
180
+ };
181
+
182
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
183
+ const getContents = (t) => {
184
+ return [
185
+ {
186
+ label: 'Personalized Experience',
187
+ description: 'Your name, gender, and date of birth help us provide tailored health advice and personalized care plans that fit your unique needs.',
188
+ icon: React__default.createElement(PersonalizeIcon, null),
189
+ },
190
+ {
191
+ label: 'Timely Health Updates',
192
+ description: 'We use your phone number and email to send important notifications, health reminders, and updates on new content to keep you informed.',
193
+ icon: React__default.createElement(HealthUpdateIcon, null),
194
+ },
195
+ {
196
+ label: 'Enhanced Security',
197
+ description: 'We use your phone number and email to send important notifications, health reminders, and updates on new content to keep you informed.',
198
+ icon: React__default.createElement(SecurityIcon, null),
199
+ },
200
+ {
201
+ label: 'Quick Customer Support',
202
+ description: 'We use your phone number and email to send important notifications, health reminders, and updates on new content to keep you informed.',
203
+ icon: React__default.createElement(CustomerSupportIcon, null),
204
+ },
205
+ {
206
+ label: 'Service Improvement',
207
+ description: 'We use your phone number and email to send important notifications, health reminders, and updates on new content to keep you informed.',
208
+ icon: React__default.createElement(ServiceIcon, null),
209
+ },
210
+ ];
211
+ };
212
+ const CollectInfoTextPopup = () => {
213
+ const { openCollectInfoPopup, setOpenCollectInfoPopup } = useSSOState();
214
+ useTranslations();
215
+ const contents = getContents();
216
+ const [mobileDragOffset, setMobileDragOffset] = useState(0);
217
+ const dragStartYRef = useRef(0);
218
+ const mobileDragOffsetRef = useRef(mobileDragOffset);
219
+ mobileDragOffsetRef.current = mobileDragOffset;
220
+ const throttleSetMobileDragOffset = useMemo(() => {
221
+ return throttle(setMobileDragOffset, 70);
222
+ }, []);
223
+ useEffect(() => {
224
+ if (openCollectInfoPopup) {
225
+ setMobileDragOffset(0);
226
+ }
227
+ }, [openCollectInfoPopup]);
228
+ return (React__default.createElement(React__default.Fragment, null,
229
+ React__default.createElement("style", { key: mobileDragOffset }, `
230
+ .collect-info-text-popup .mantine-Modal-inner {
231
+ transform: translateY(${Math.round(mobileDragOffset)}px);
232
+ }
233
+ `),
234
+ React__default.createElement(Modal, { opened: openCollectInfoPopup, onClose: () => setOpenCollectInfoPopup(false), withCloseButton: false, styles: (theme) => ({
235
+ body: {
236
+ padding: '32px 24px',
237
+ position: 'relative',
238
+ background: 'linear-gradient(180deg, #91CAFF 0%, #CFE8FF 100px, #FFFFFF 200px)',
239
+ [theme.fn.smallerThan('sm')]: {
240
+ height: '100%',
241
+ },
242
+ },
243
+ content: {
244
+ [theme.fn.smallerThan('sm')]: {
245
+ width: '100%',
246
+ height: '100%',
247
+ borderBottomLeftRadius: 0,
248
+ borderBottomRightRadius: 0,
249
+ maxWidth: '100%',
250
+ maxHeight: '100%',
251
+ },
252
+ },
253
+ inner: {
254
+ [theme.fn.smallerThan('sm')]: {
255
+ padding: 0,
256
+ left: 0,
257
+ right: 0,
258
+ top: 120,
259
+ // transform: `translateY(${Math.round(mobileDragOffset)}px)`,
260
+ display: 'block',
261
+ transition: 'transform 70ms',
262
+ },
263
+ },
264
+ }), className: "collect-info-text-popup" },
265
+ React__default.createElement(Box, { sx: (theme) => ({
266
+ [theme.fn.largerThan('sm')]: {
267
+ display: 'none',
268
+ },
269
+ padding: 8,
270
+ width: '100%',
271
+ cursor: 'grab',
272
+ display: 'flex',
273
+ justifyContent: 'center',
274
+ position: 'absolute',
275
+ top: 0,
276
+ left: 0,
277
+ }), draggable: true, onDrag: (e) => {
278
+ if (e.clientY <= 5)
279
+ return;
280
+ throttleSetMobileDragOffset(e.clientY - dragStartYRef.current);
281
+ }, onDragStart: (e) => {
282
+ dragStartYRef.current = e.clientY;
283
+ }, onDragEnd: (e) => {
284
+ if (e.clientY - dragStartYRef.current > 100) {
285
+ setMobileDragOffset(window.innerHeight);
286
+ setTimeout(() => {
287
+ setOpenCollectInfoPopup(false);
288
+ }, 100);
289
+ }
290
+ else {
291
+ throttleSetMobileDragOffset(0);
292
+ }
293
+ }, onTouchStart: (e) => {
294
+ dragStartYRef.current = e.touches[0].clientY;
295
+ }, onTouchMove: (e) => {
296
+ if (e.touches[0].clientY < 0)
297
+ return;
298
+ throttleSetMobileDragOffset(e.touches[0].clientY - dragStartYRef.current);
299
+ }, onTouchEnd: (e) => {
300
+ if (e.changedTouches[0].clientY - dragStartYRef.current > 100) {
301
+ setMobileDragOffset(window.innerHeight);
302
+ setTimeout(() => {
303
+ setOpenCollectInfoPopup(false);
304
+ }, 100);
305
+ }
306
+ else {
307
+ throttleSetMobileDragOffset(0);
308
+ }
309
+ } },
310
+ React__default.createElement(Box, { sx: {
311
+ border: '1.5px solid #ADB3BC',
312
+ background: 'gray',
313
+ borderRadius: 3,
314
+ width: 44,
315
+ } })),
316
+ React__default.createElement("div", { style: {
317
+ height: 40,
318
+ } },
319
+ React__default.createElement(Button, { variant: "white", sx: (theme) => ({
320
+ width: 40,
321
+ height: 40,
322
+ padding: 8,
323
+ background: 'white',
324
+ borderRadius: '100%',
325
+ [theme.fn.smallerThan('sm')]: {
326
+ display: 'none',
327
+ },
328
+ }), onClick: () => setOpenCollectInfoPopup(false) },
329
+ React__default.createElement(ChevronLeft, null))),
330
+ React__default.createElement(BackgroundHeader$1, null),
331
+ React__default.createElement(Stack, { pos: "relative", mt: 100, spacing: 8, style: {
332
+ zIndex: 1,
333
+ } },
334
+ React__default.createElement(Text, { size: "h4" }, "Why We Need Your Information"),
335
+ React__default.createElement(Accordion, { styles: {
336
+ item: {
337
+ borderBottomColor: '#E4E8EC',
338
+ paddingBottom: 16,
339
+ marginTop: 16,
340
+ },
341
+ control: {
342
+ padding: 0,
343
+ },
344
+ content: {
345
+ padding: 0,
346
+ marginTop: 8,
347
+ },
348
+ } }, contents.map((item, index) => (React__default.createElement(Accordion.Item, { key: index, value: item.label },
349
+ React__default.createElement(Accordion.Control, { icon: item.icon },
350
+ React__default.createElement(Text, { size: "s3", weight: "semiBold" }, item.label)),
351
+ React__default.createElement(Accordion.Panel, null,
352
+ React__default.createElement(Text, { size: "p3" }, item.description))))))))));
353
+ };
354
+
355
+ const ConfirmClosePopup = ({ opened, onCancel, onClose, }) => {
356
+ return (React__default.createElement(Modal, { opened: opened, onClose: () => onCancel(), withCloseButton: false, styles: (theme) => ({
357
+ body: {
358
+ padding: '32px 24px',
359
+ position: 'relative',
360
+ background: 'linear-gradient(180deg, #91CAFF 0%, #CFE8FF 100px, #FFFFFF 200px)',
361
+ [theme.fn.smallerThan('sm')]: {
362
+ height: '100%',
363
+ },
364
+ },
365
+ content: {
366
+ [theme.fn.smallerThan('sm')]: {
367
+ width: '100%',
368
+ height: '100%',
369
+ borderBottomLeftRadius: 0,
370
+ borderBottomRightRadius: 0,
371
+ maxWidth: '100%',
372
+ maxHeight: '100%',
373
+ },
374
+ },
375
+ inner: {
376
+ [theme.fn.smallerThan('sm')]: {
377
+ padding: 0,
378
+ left: 0,
379
+ right: 0,
380
+ top: 'unset',
381
+ // transform: `translateY(${Math.round(mobileDragOffset)}px)`,
382
+ display: 'block',
383
+ transition: 'transform 70ms',
384
+ },
385
+ },
386
+ }) },
387
+ React__default.createElement(BackgroundHeader, null),
388
+ React__default.createElement(Stack, { pos: "relative", mt: 150, spacing: 8, style: {
389
+ zIndex: 1,
390
+ textAlign: 'center',
391
+ } },
392
+ React__default.createElement(Text, { size: "h4" }, "Are you sure you want to exit?"),
393
+ React__default.createElement(Text, { size: "p3" }, "You\u2019re just a step away from completing your account setup. Do you really want to leave?")),
394
+ React__default.createElement(Stack, { mt: 32, spacing: 8, align: "center" },
395
+ React__default.createElement(Button, { variant: "primary", size: "lg", onClick: onCancel, w: "50%", radius: 40 },
396
+ React__default.createElement(Text, { size: "s2", weight: "regular", color: "inherit" }, "Cancel")),
397
+ React__default.createElement(Button, { variant: "white", size: "lg", onClick: onClose, fullWidth: true },
398
+ React__default.createElement(Text, { size: "p2", weight: "regular", color: "gray.6" }, "I want to exit now")))));
399
+ };
400
+ const BackgroundHeader = () => (React__default.createElement("svg", { width: "292", height: "255", viewBox: "0 0 292 255", fill: "none", xmlns: "http://www.w3.org/2000/svg", style: {
401
+ position: 'absolute',
402
+ top: 0,
403
+ left: '50%',
404
+ zIndex: 0,
405
+ transform: 'translateX(-50%)',
406
+ pointerEvents: 'none',
407
+ } },
408
+ React__default.createElement("circle", { opacity: ".2", cx: "146", cy: "109", r: "146", fill: "url(#paint0_linear_908_35161)" }),
409
+ React__default.createElement("circle", { opacity: ".3", cx: "146", cy: "109", r: "85", fill: "url(#paint1_linear_908_35161)" }),
410
+ React__default.createElement("circle", { cx: "146.5", cy: "108.5", r: "47.5", fill: "url(#paint2_linear_908_35161)" }),
411
+ React__default.createElement("circle", { cx: "146.5", cy: "108.5", r: "47", stroke: "url(#paint3_linear_908_35161)" }),
412
+ React__default.createElement("path", { d: "m148.68 89.129-13.51-2.087a4.552 4.552 0 0 0-5.17 4.454v35.009a4.55 4.55 0 0 0 1.586 3.395 4.56 4.56 0 0 0 3.594 1.059l13.5-2.087a4.474 4.474 0 0 0 3.82-4.452V93.58a4.48 4.48 0 0 0-3.82-4.451", fill: "#2D87F3" }),
413
+ React__default.createElement("path", { d: "M164.342 108.002a1.43 1.43 0 0 1-.557 1.132l-4.714 3.643a1.07 1.07 0 0 1-1.563-.281 1.1 1.1 0 0 1-.161-.566v-1.224l-5.085-.025a.54.54 0 0 1-.535-.539v-4.322a.54.54 0 0 1 .538-.538l5.088.004-.009-1.214a1.08 1.08 0 0 1 .598-.962 1.07 1.07 0 0 1 1.127.113l4.716 3.648a1.42 1.42 0 0 1 .557 1.131", fill: "#FF6F4D" }),
414
+ React__default.createElement("path", { d: "M164.342 108.002a1.43 1.43 0 0 1-.557 1.132l-4.714 3.643a1.07 1.07 0 0 1-1.563-.281 1.1 1.1 0 0 1-.161-.566v-1.224l-5.085-.025a.54.54 0 0 1-.535-.539v-4.322a.54.54 0 0 1 .538-.538l5.088.004-.009-1.214a1.08 1.08 0 0 1 .598-.962 1.07 1.07 0 0 1 1.127.113l4.716 3.648a1.42 1.42 0 0 1 .557 1.131m-18.248-2.179v4.324a.54.54 0 0 0 .539.539h3.017a.54.54 0 0 0 .538-.539v-4.324a.54.54 0 0 0-.538-.539h-3.017a.54.54 0 0 0-.539.539m-1.616 4.341a.54.54 0 0 1-.539.539h-.977a1.463 1.463 0 0 1-1.462-1.462v-2.478a1.463 1.463 0 0 1 1.462-1.463h.977a.54.54 0 0 1 .539.539z", fill: "#FF6F4D" }),
415
+ React__default.createElement("defs", null,
416
+ React__default.createElement("linearGradient", { id: "paint0_linear_908_35161", x1: "147.5", y1: "141", x2: "36.5", y2: "30", gradientUnits: "userSpaceOnUse" },
417
+ React__default.createElement("stop", { stopColor: "#fff", stopOpacity: "0" }),
418
+ React__default.createElement("stop", { offset: "1", stopColor: "#fff" })),
419
+ React__default.createElement("linearGradient", { id: "paint1_linear_908_35161", x1: "218.376", y1: "63.134", x2: "61", y2: "109", gradientUnits: "userSpaceOnUse" },
420
+ React__default.createElement("stop", { stopColor: "#fff" }),
421
+ React__default.createElement("stop", { offset: "1", stopColor: "#fff", stopOpacity: "0" })),
422
+ React__default.createElement("linearGradient", { id: "paint2_linear_908_35161", x1: "146.5", y1: "61", x2: "146.5", y2: "156", gradientUnits: "userSpaceOnUse" },
423
+ React__default.createElement("stop", { stopColor: "#fff", stopOpacity: ".6" }),
424
+ React__default.createElement("stop", { offset: "1", stopColor: "#fff", stopOpacity: "0" })),
425
+ React__default.createElement("linearGradient", { id: "paint3_linear_908_35161", x1: "178.979", y1: "98.35", x2: "108.338", y2: "98.35", gradientUnits: "userSpaceOnUse" },
426
+ React__default.createElement("stop", { stopColor: "#fff", stopOpacity: "0" }),
427
+ React__default.createElement("stop", { offset: "1", stopColor: "#fff" })))));
428
+
429
+ var SSOStepTypeType;
430
+ (function (SSOStepTypeType) {
431
+ SSOStepTypeType["FIRST"] = "first";
432
+ SSOStepTypeType["EMAIL"] = "email";
433
+ SSOStepTypeType["VERIFY_PHONE"] = "verify_phone";
434
+ SSOStepTypeType["PASSWORD"] = "password";
435
+ SSOStepTypeType["UPDATE_EMAIL"] = "update_email";
436
+ SSOStepTypeType["FORGOT_PASSWORD_PHONE"] = "forgot_password_phone";
437
+ SSOStepTypeType["FORGOT_PASSWORD_SETUP"] = "forgot_password_setup";
438
+ SSOStepTypeType["OTP"] = "otp";
439
+ SSOStepTypeType["SETUP_FULL"] = "setup_full";
440
+ })(SSOStepTypeType || (SSOStepTypeType = {}));
441
+ const SSOStepsContext = createContext({
442
+ currentStepIndex: 0,
443
+ steps: [
444
+ {
445
+ type: SSOStepTypeType.FIRST,
446
+ },
447
+ ],
448
+ setSteps: () => false,
449
+ goNext: () => false,
450
+ goBack: () => false,
451
+ addStep: () => false,
452
+ });
453
+ const SSOStepsProvider = ({ children, defaultSteps, }) => {
454
+ const [steps, setSteps] = useState(defaultSteps || [
455
+ {
456
+ type: SSOStepTypeType.FIRST,
457
+ },
458
+ ]);
459
+ const [currentStepIndex, setCurrentStepIndex] = useState(0);
460
+ const [shareData, setShareData] = useState({});
461
+ return (React__default.createElement(SSOStepsContext.Provider, { value: {
462
+ currentStepIndex,
463
+ steps,
464
+ setSteps,
465
+ addStep: (step) => {
466
+ setSteps((s) => [...s, step]);
467
+ },
468
+ goNext: () => {
469
+ setCurrentStepIndex((index) => index + 1);
470
+ },
471
+ goBack: () => {
472
+ setCurrentStepIndex((index) => index - 1);
473
+ // remove step when go back
474
+ setSteps((steps) => steps.slice(0, steps.length - 1));
475
+ },
476
+ shareData,
477
+ setShareData,
478
+ } }, children));
479
+ };
480
+ const useSSOSteps = () => {
481
+ return React__default.useContext(SSOStepsContext);
482
+ };
483
+
484
+ const SSOPopupWrapper = ({ children, opened, onClose, }) => {
485
+ var _a;
486
+ const { steps, goBack } = useSSOSteps();
487
+ const { locale } = useSSOState();
488
+ const showBack = steps.length > 1;
489
+ const showClose = steps.length === 1;
490
+ const showLogo = steps.length === 1;
491
+ const logoType = (_a = LOCALE_SPECS[locale]) === null || _a === void 0 ? void 0 : _a.LOGO_TYPE;
492
+ const [closeConfirmOpen, setCloseConfirmOpen] = React__default.useState(false);
493
+ const onCloseClick = () => {
494
+ setCloseConfirmOpen(true);
495
+ };
496
+ return (React__default.createElement(React__default.Fragment, null,
497
+ React__default.createElement(Modal, { opened: opened, onClose: onCloseClick, styles: (theme) => ({
498
+ body: {
499
+ display: 'flex',
500
+ flexDirection: 'column',
501
+ gap: 24,
502
+ padding: '36px 24px',
503
+ position: 'relative',
504
+ background: 'linear-gradient(180deg, #A5D4FF 0%, #FFFFFF 150px)',
505
+ overflow: 'auto',
506
+ [theme.fn.smallerThan('sm')]: {
507
+ height: '100%',
508
+ },
509
+ },
510
+ content: {
511
+ [theme.fn.smallerThan('sm')]: {
512
+ width: '100%',
513
+ height: '100%',
514
+ borderRadius: 0,
515
+ maxWidth: '100%',
516
+ maxHeight: '100%',
517
+ },
518
+ },
519
+ inner: {
520
+ [theme.fn.smallerThan('sm')]: {
521
+ padding: 0,
522
+ left: 0,
523
+ right: 0,
524
+ display: 'block',
525
+ },
526
+ },
527
+ }), withCloseButton: false },
528
+ React__default.createElement("div", { style: {
529
+ height: 40,
530
+ display: 'flex',
531
+ alignItems: 'center',
532
+ justifyContent: 'space-between',
533
+ } },
534
+ showBack && (React__default.createElement(Button, { variant: "white", style: {
535
+ width: 40,
536
+ height: 40,
537
+ padding: 8,
538
+ background: 'white',
539
+ borderRadius: '100%',
540
+ }, onClick: goBack },
541
+ React__default.createElement(ChevronLeft, null))),
542
+ showLogo && (React__default.createElement(LogoIcon, { type: logoType, height: 32, width: 'unset' })),
543
+ showClose && (React__default.createElement(Button, { variant: "white", style: {
544
+ width: 40,
545
+ height: 40,
546
+ padding: 8,
547
+ background: 'white',
548
+ borderRadius: '100%',
549
+ }, onClick: onCloseClick },
550
+ React__default.createElement(Close, null)))),
551
+ React__default.createElement("div", { style: {
552
+ flex: 1,
553
+ } }, children)),
554
+ React__default.createElement(ConfirmClosePopup, { opened: closeConfirmOpen, onCancel: () => setCloseConfirmOpen(false), onClose: () => {
555
+ setCloseConfirmOpen(false);
556
+ onClose === null || onClose === void 0 ? void 0 : onClose();
557
+ } }),
558
+ React__default.createElement(CollectInfoTextPopup, null)));
559
+ };
560
+
561
+ const SSO_V2_PATHS = {
562
+ LOGIN_BY_SOCIAL: 'member/social-login',
563
+ EMAIL: {
564
+ REGISTER_BY_SEND_OTP: 'login/login-with-email',
565
+ LOGIN_BY_PASSWORD: 'member/login',
566
+ VERIFY_BY_OTP: 'login/email-verify-code',
567
+ SEND_OTP: 'login/email-resend-otp-code', // FOR RESEND OTP IN CASE FAIL
568
+ },
569
+ PHONE: {
570
+ REGISTER_BY_SEND_OTP: 'login/login-with-sms',
571
+ SEND_OTP: 'login/sms/sent-otp',
572
+ VERIFY_BY_OTP: 'login/phone-verify-code',
573
+ LOGIN_BY_PASSWORD: 'member/login-by-phone',
574
+ UPDATE_PHONE_SEND_OTP: 'sms-social/sent-otp',
575
+ UPDATE_PHONE_VERIFY_OTP: 'sms-social/phone-verify-code',
576
+ },
577
+ ZALO: {
578
+ REGISTER_BY_SEND_OTP: 'login/login-with-zalo',
579
+ SEND_OTP: 'login/zalo/sent-otp',
580
+ VERIFY_BY_OTP: 'login/zalo-verify-code',
581
+ UPDATE_PHONE_SEND_OTP: 'sms-social/zalo/sent-otp',
582
+ UPDATE_PHONE_VERIFY_OTP: 'sms-social/zalo-verify-code',
583
+ },
584
+ RESET_PASSWORD: 'login/reset-password',
585
+ CHECK_USER_EXIST: 'member/check-user-exist',
586
+ UPDATE_USER_INFO: 'login/update-first-info',
587
+ };
588
+
589
+ const locale = process.env.UNIFY_LOCALE || 'vi-VN';
590
+ const websiteId = LOCALE_SPECS[locale].SITE_ID;
591
+ LOCALE_SPECS[locale].PHONE;
592
+ const allAvailableAreaCodes = Object.keys(LOCALE_SPECS).map((locale) => LOCALE_SPECS[locale].PHONE);
593
+ const getSSOV2ApiUrl = (path) => {
594
+ return `${getCurrentSsoUrl(locale)}/api/v2/${path}`;
595
+ };
596
+ const getSSOApiUrl = (path) => {
597
+ return `${getCurrentSsoUrl(locale)}/api/${path}`;
598
+ };
599
+ const BEARER_TOKEN_COOKIE = 'hhg_user_token';
600
+ // NOTICE: RUN ONLY CLIENT SIDE
601
+ const fetchSSOV2Api = (path, options = {}, noAuth) => __awaiter(void 0, void 0, void 0, function* () {
602
+ var _a;
603
+ let response;
604
+ const authToken = noAuth
605
+ ? ''
606
+ : (_a = document.cookie
607
+ .split('; ')
608
+ .find((row) => row.startsWith(BEARER_TOKEN_COOKIE))) === null || _a === void 0 ? void 0 : _a.split('=')[1];
609
+ try {
610
+ response = yield fetch(getSSOV2ApiUrl(path), authToken
611
+ ? Object.assign(Object.assign({}, options), { headers: Object.assign({ Authorization: `Bearer ${authToken}` }, options === null || options === void 0 ? void 0 : options.headers) }) : options);
612
+ }
613
+ catch (error) {
614
+ console.error(error);
615
+ return null;
616
+ }
617
+ return response === null || response === void 0 ? void 0 : response.json();
618
+ });
619
+ const fetchSSOApi = (path, options = {}, noAuth) => __awaiter(void 0, void 0, void 0, function* () {
620
+ var _b;
621
+ let response;
622
+ const authToken = noAuth
623
+ ? ''
624
+ : (_b = document.cookie
625
+ .split('; ')
626
+ .find((row) => row.startsWith(BEARER_TOKEN_COOKIE))) === null || _b === void 0 ? void 0 : _b.split('=')[1];
627
+ try {
628
+ response = yield fetch(getSSOApiUrl(path), authToken
629
+ ? Object.assign(Object.assign({}, options), { headers: Object.assign({ Authorization: `Bearer ${authToken}` }, options === null || options === void 0 ? void 0 : options.headers) }) : options);
630
+ }
631
+ catch (error) {
632
+ console.error(error);
633
+ return null;
634
+ }
635
+ return response === null || response === void 0 ? void 0 : response.json();
636
+ });
637
+ const resetPassword = (password, confirmPassword) => __awaiter(void 0, void 0, void 0, function* () {
638
+ const formData = new FormData();
639
+ formData.append('password', password);
640
+ formData.append('confirm-password', confirmPassword);
641
+ return fetchSSOV2Api(SSO_V2_PATHS.RESET_PASSWORD, {
642
+ method: 'POST',
643
+ body: formData,
644
+ });
645
+ });
646
+ // "email":"kenny_test2201_11@mailinator.com"
647
+ // "phone_number":"906911910"
648
+ const checkUserExist = ({ email, phone, // no +
649
+ }) => __awaiter(void 0, void 0, void 0, function* () {
650
+ // "provider": "email",
651
+ // "is_pass": true,
652
+ // "is_status": "Active"
653
+ const formData = new FormData();
654
+ if (email) {
655
+ formData.append('email', email);
656
+ }
657
+ else {
658
+ formData.append('phone_number', phone);
659
+ }
660
+ return fetchSSOV2Api(SSO_V2_PATHS.CHECK_USER_EXIST, {
661
+ method: 'POST',
662
+ body: formData,
663
+ });
664
+ });
665
+ // "name": "Huy Tran 888",
666
+ // "birthday": "1989-04-26",
667
+ // "email":"kenny_test2201_02@mailinator.com", // optional chỉ require khi source là care | ecom
668
+ // "password": "Kenny2103",
669
+ // "confirm_password":"Kenny2103",
670
+ // "phone_number":"906911912", // require khi user register bằng email hoặc social
671
+ // "area_code":"+84", // require khi có phone number
672
+ // "gender": 1,
673
+ // "validate": false, // true validate sau khi validate xong truyền false để update
674
+ // "source": "care" | "ecom" // default sẽ ko require email. nếu source là care sẽ require email. ==> support cho business care
675
+ const updateUserInfo = (data) => __awaiter(void 0, void 0, void 0, function* () {
676
+ const formData = new FormData();
677
+ Object.keys(data).forEach((key) => {
678
+ if (typeof data[key] !== 'undefined' && data[key] !== null) {
679
+ formData.append(key, data[key]);
680
+ }
681
+ });
682
+ return fetchSSOV2Api(SSO_V2_PATHS.UPDATE_USER_INFO, {
683
+ method: 'POST',
684
+ body: formData,
685
+ });
686
+ });
687
+ const GoogleAuthClientId = isProduction
688
+ ? '289442006438-040a42cbidr6v5d178f3iqi9q95821r3.apps.googleusercontent.com'
689
+ : '289442006438-cihobuq1h3r4426pur7u0e43fqdnep59.apps.googleusercontent.com';
690
+ const FacebookAppId = '2759888574045636';
691
+ const getUserInfo = () => __awaiter(void 0, void 0, void 0, function* () {
692
+ return fetchSSOApi('user/profile', {
693
+ method: 'POST',
694
+ });
695
+ });
696
+ const handleAuthSuccess = (res) => {
697
+ (res === null || res === void 0 ? void 0 : res.token) &&
698
+ setCookie(BEARER_TOKEN_COOKIE, res.token, {
699
+ domain: window.location.hostname === 'localhost'
700
+ ? 'localhost'
701
+ : `.${domainLocales[process.env.UNIFY_LOCALE || 'vi-VN']}`,
702
+ expires: new Date(res.expire_in * 1000).toUTCString(),
703
+ });
704
+ (res === null || res === void 0 ? void 0 : res.refresh_token) &&
705
+ setCookie(BEARER_REFRESH_TOKEN_COOKIE, res.refresh_token, {
706
+ domain: window.location.hostname === 'localhost'
707
+ ? 'localhost'
708
+ : `.${domainLocales[process.env.UNIFY_LOCALE || 'vi-VN']}`,
709
+ });
710
+ };
711
+
712
+ const loginByEmailPassword = (email, password) => __awaiter(void 0, void 0, void 0, function* () {
713
+ const formData = new FormData();
714
+ formData.append('email', email);
715
+ formData.append('password', password);
716
+ return fetchSSOV2Api(SSO_V2_PATHS.EMAIL.LOGIN_BY_PASSWORD, {
717
+ method: 'POST',
718
+ body: formData,
719
+ headers: {
720
+ Authorization: `Basic aGhnOjEyMzQ1Njc4OUBAIyQhQCQjJSRe`,
721
+ },
722
+ });
723
+ });
724
+ const registerBySendEmailOTP = (email) => __awaiter(void 0, void 0, void 0, function* () {
725
+ const formData = new FormData();
726
+ formData.append('email', email);
727
+ formData.append('website_id', websiteId);
728
+ return fetchSSOV2Api(SSO_V2_PATHS.EMAIL.REGISTER_BY_SEND_OTP, {
729
+ method: 'POST',
730
+ body: formData,
731
+ });
732
+ });
733
+ const resendEmailOTP = (email) => __awaiter(void 0, void 0, void 0, function* () {
734
+ const formData = new FormData();
735
+ formData.append('email', email);
736
+ return fetchSSOV2Api(SSO_V2_PATHS.EMAIL.SEND_OTP, {
737
+ method: 'POST',
738
+ body: formData,
739
+ });
740
+ });
741
+ const verifyByEmailOTP = (email, otpCode) => __awaiter(void 0, void 0, void 0, function* () {
742
+ const formData = new FormData();
743
+ formData.append('email', email);
744
+ formData.append('code', otpCode);
745
+ return fetchSSOV2Api(SSO_V2_PATHS.EMAIL.VERIFY_BY_OTP, {
746
+ method: 'POST',
747
+ body: formData,
748
+ });
749
+ });
750
+
751
+ const SSOEmailScreen = ({ hidden, }) => {
752
+ const [errMsg, setErrMsg] = React__default.useState('');
753
+ const { addStep, goNext } = useSSOSteps();
754
+ return (React__default.createElement("form", { style: {
755
+ display: hidden ? 'none' : 'block',
756
+ }, onSubmit: (e) => __awaiter(void 0, void 0, void 0, function* () {
757
+ var _a, _b, _c, _d;
758
+ e.preventDefault();
759
+ const email = e.currentTarget.email.value;
760
+ const existRes = yield checkUserExist({ email });
761
+ if ((existRes === null || existRes === void 0 ? void 0 : existRes._status) === 1) {
762
+ if ((_a = existRes._data) === null || _a === void 0 ? void 0 : _a.is_pass) {
763
+ // go to password screen
764
+ addStep({
765
+ type: SSOStepTypeType.PASSWORD,
766
+ config: {
767
+ email,
768
+ },
769
+ });
770
+ goNext();
771
+ }
772
+ else {
773
+ let res;
774
+ if (!((_b = existRes._data) === null || _b === void 0 ? void 0 : _b.provider)) {
775
+ res = yield registerBySendEmailOTP(email);
776
+ }
777
+ else {
778
+ res = yield resendEmailOTP(email);
779
+ }
780
+ if ((res === null || res === void 0 ? void 0 : res._status) !== 1) {
781
+ setErrMsg(((_c = res._messages) === null || _c === void 0 ? void 0 : _c[0]) || 'API error');
782
+ return;
783
+ }
784
+ // go to register screen
785
+ addStep({
786
+ type: SSOStepTypeType.OTP,
787
+ config: {
788
+ email,
789
+ otpType: 'email',
790
+ afterAction: 'setup',
791
+ },
792
+ });
793
+ goNext();
794
+ }
795
+ }
796
+ else {
797
+ setErrMsg(((_d = existRes._messages) === null || _d === void 0 ? void 0 : _d[0]) || 'api error');
798
+ }
799
+ }) },
800
+ React__default.createElement(Stack, { spacing: 8 },
801
+ React__default.createElement(Text, { size: "s1", weight: "semiBold" }, "Continue with email"),
802
+ React__default.createElement(Text, { size: "p4" }, "S\u1EED d\u1EE5ng email c\u1EE7a b\u1EA1n \u0111\u1EC3 ti\u1EBFp t\u1EE5c \u0111\u0103ng nh\u1EADp ho\u1EB7c \u0111\u0103ng k\u00FD")),
803
+ React__default.createElement(Input, { name: "email", placeholder: "Email c\u1EE7a b\u1EA1n", error: errMsg || undefined, type: "email", required: true, mt: 24 }),
804
+ React__default.createElement(Button, { type: "submit", size: "lg", variant: "primary", fullWidth: true, mt: 16 }, "Verify Your Email")));
805
+ };
806
+
807
+ const splitPhone = (phone) => {
808
+ var _a, _b;
809
+ if (!phone)
810
+ return { areaCode: undefined, phoneNumber: undefined };
811
+ let areaCode = '';
812
+ let phoneNumber = phone;
813
+ if (phone.startsWith('+')) {
814
+ areaCode =
815
+ ((_a = phone.match(new RegExp(`^\\+(${allAvailableAreaCodes
816
+ .map((c) => c.replace('+', ''))
817
+ .join('|')})`))) === null || _a === void 0 ? void 0 : _a[0]) || '';
818
+ phoneNumber = phone.slice(areaCode.length);
819
+ }
820
+ else {
821
+ areaCode =
822
+ ((_b = phone.match(new RegExp(`^(${allAvailableAreaCodes
823
+ .map((c) => c.replace('+', ''))
824
+ .join('|')})`))) === null || _b === void 0 ? void 0 : _b[0]) || '';
825
+ phoneNumber = phone.slice(areaCode.length);
826
+ if (areaCode) {
827
+ areaCode = `+${areaCode}`;
828
+ }
829
+ }
830
+ return { areaCode, phoneNumber };
831
+ };
832
+
833
+ // "phone_number":"906911910",
834
+ // "password":"Kenny2103!"
835
+ const loginByPhonePassword = (phone, password) => __awaiter(void 0, void 0, void 0, function* () {
836
+ const formData = new FormData();
837
+ let { phoneNumber } = splitPhone(phone);
838
+ phoneNumber = phoneNumber.startsWith('0')
839
+ ? phoneNumber.substring(1)
840
+ : phoneNumber;
841
+ formData.append('phone_number', phoneNumber);
842
+ formData.append('password', password);
843
+ return fetchSSOV2Api(SSO_V2_PATHS.PHONE.LOGIN_BY_PASSWORD, {
844
+ method: 'POST',
845
+ body: formData,
846
+ headers: {
847
+ Authorization: 'Basic aGhnOjEyMzQ1Njc4OUBAIyQhQCQjJSRe',
848
+ },
849
+ }, true);
850
+ });
851
+ // "phone_number": "906911910",
852
+ // "area_code":"+84",
853
+ const registerBySendPhoneOTP = (phone, areaCode) => __awaiter(void 0, void 0, void 0, function* () {
854
+ const formData = new FormData();
855
+ formData.append('phone_number', phone);
856
+ formData.append('area_code', areaCode);
857
+ formData.append('website_id', websiteId);
858
+ return fetchSSOV2Api(SSO_V2_PATHS.PHONE.REGISTER_BY_SEND_OTP, {
859
+ method: 'POST',
860
+ body: formData,
861
+ });
862
+ });
863
+ // "phone_number": "906911910",
864
+ // "area_code":"+84",
865
+ const resendPhoneOTP = (phone, areaCode) => __awaiter(void 0, void 0, void 0, function* () {
866
+ const formData = new FormData();
867
+ formData.append('phone_number', phone);
868
+ formData.append('area_code', areaCode);
869
+ return fetchSSOV2Api(SSO_V2_PATHS.PHONE.SEND_OTP, {
870
+ method: 'POST',
871
+ body: formData,
872
+ });
873
+ });
874
+ // "otp_code":"212616",
875
+ // "phone_number": "906911910",
876
+ // "area_code":"+84"
877
+ const verifyByPhoneOTP = (phone, areaCode, otpCode) => __awaiter(void 0, void 0, void 0, function* () {
878
+ const formData = new FormData();
879
+ formData.append('phone_number', phone);
880
+ formData.append('area_code', areaCode);
881
+ formData.append('otp_code', otpCode);
882
+ return fetchSSOV2Api(SSO_V2_PATHS.PHONE.VERIFY_BY_OTP, {
883
+ method: 'POST',
884
+ body: formData,
885
+ });
886
+ });
887
+ const resendUpdatePhoneOTP = (phone, areaCode) => __awaiter(void 0, void 0, void 0, function* () {
888
+ const formData = new FormData();
889
+ formData.append('phone_number', phone);
890
+ formData.append('area_code', areaCode);
891
+ return fetchSSOV2Api(SSO_V2_PATHS.PHONE.UPDATE_PHONE_SEND_OTP, {
892
+ method: 'POST',
893
+ body: formData,
894
+ });
895
+ });
896
+ const verifyUpdatePhoneOTP = (areaCode, otpCode) => __awaiter(void 0, void 0, void 0, function* () {
897
+ const formData = new FormData();
898
+ formData.append('otp_code', otpCode);
899
+ formData.append('area_code', areaCode);
900
+ return fetchSSOV2Api(SSO_V2_PATHS.PHONE.UPDATE_PHONE_VERIFY_OTP, {
901
+ method: 'POST',
902
+ body: formData,
903
+ });
904
+ });
905
+
906
+ const loginBySocial = (token, social) => __awaiter(void 0, void 0, void 0, function* () {
907
+ const formData = new FormData();
908
+ formData.append('token', token);
909
+ formData.append('social', social);
910
+ formData.append('website_id', websiteId);
911
+ return fetchSSOV2Api(SSO_V2_PATHS.LOGIN_BY_SOCIAL, {
912
+ method: 'POST',
913
+ body: formData,
914
+ headers: {
915
+ Authorization: `Basic aGhnOjEyMzQ1Njc4OUBAIyQhQCQjJSRe`,
916
+ },
917
+ });
918
+ });
919
+
920
+ // "phone_number": "906911910",
921
+ // "area_code":"+84",
922
+ const registerBySendZaloOTP = (phone, areaCode) => __awaiter(void 0, void 0, void 0, function* () {
923
+ const formData = new FormData();
924
+ formData.append('phone_number', phone);
925
+ formData.append('area_code', areaCode);
926
+ formData.append('website_id', websiteId);
927
+ return fetchSSOV2Api(SSO_V2_PATHS.ZALO.REGISTER_BY_SEND_OTP, {
928
+ method: 'POST',
929
+ body: formData,
930
+ });
931
+ });
932
+ // "phone_number": "906911910",
933
+ // "area_code":"+84",
934
+ const resendZaloOTP = (phone, areaCode) => __awaiter(void 0, void 0, void 0, function* () {
935
+ const formData = new FormData();
936
+ formData.append('phone_number', phone);
937
+ formData.append('area_code', areaCode);
938
+ return fetchSSOV2Api(SSO_V2_PATHS.ZALO.SEND_OTP, {
939
+ method: 'POST',
940
+ body: formData,
941
+ });
942
+ });
943
+ // "otp_code":"212616",
944
+ // "phone_number": "906911910",
945
+ // "area_code":"+84"
946
+ const verifyByZaloOTP = (phone, areaCode, otpCode) => __awaiter(void 0, void 0, void 0, function* () {
947
+ const formData = new FormData();
948
+ formData.append('otp_code', otpCode);
949
+ formData.append('phone_number', phone);
950
+ formData.append('area_code', areaCode);
951
+ return fetchSSOV2Api(SSO_V2_PATHS.ZALO.VERIFY_BY_OTP, {
952
+ method: 'POST',
953
+ body: formData,
954
+ });
955
+ });
956
+ const resendUpdatePhoneZaloOTP = (phone, areaCode) => __awaiter(void 0, void 0, void 0, function* () {
957
+ const formData = new FormData();
958
+ formData.append('phone_number', phone);
959
+ formData.append('area_code', areaCode);
960
+ return fetchSSOV2Api(SSO_V2_PATHS.ZALO.UPDATE_PHONE_SEND_OTP, {
961
+ method: 'POST',
962
+ body: formData,
963
+ });
964
+ });
965
+ const verifyUpdatePhoneZaloOTP = (phone, areaCode, otpCode) => __awaiter(void 0, void 0, void 0, function* () {
966
+ const formData = new FormData();
967
+ formData.append('phone_number', phone);
968
+ formData.append('otp_code', otpCode);
969
+ formData.append('area_code', areaCode);
970
+ return fetchSSOV2Api(SSO_V2_PATHS.ZALO.UPDATE_PHONE_VERIFY_OTP, {
971
+ method: 'POST',
972
+ body: formData,
973
+ });
974
+ });
975
+
976
+ const CollectInfoText = () => {
977
+ const { setOpenCollectInfoPopup } = useSSOState();
978
+ return (React__default.createElement(Text, { size: "p4", onClick: () => {
979
+ setOpenCollectInfoPopup(true);
980
+ }, color: "blue.6", style: {
981
+ cursor: 'pointer',
982
+ } },
983
+ React__default.createElement(Info, { size: 16, color: '#2D87F3', style: {
984
+ verticalAlign: 'sub',
985
+ } }),
986
+ ' ',
987
+ "Why We Need Your Information?"));
988
+ };
989
+
990
+ const MailIcon = (props) => (React__default.createElement("svg", Object.assign({ width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
991
+ React__default.createElement("g", { clipPath: "url(#clip0_869_25628)" },
992
+ React__default.createElement("rect", { width: "24", height: "24", rx: "12", fill: "#00B16A" }),
993
+ React__default.createElement("path", { d: "M15.75 5.625h-7.5C6 5.625 4.5 6.75 4.5 9.375v5.25c0 2.625 1.5 3.75 3.75 3.75h7.5c2.25 0 3.75-1.125 3.75-3.75v-5.25c0-2.625-1.5-3.75-3.75-3.75m.352 4.568-2.347 1.875c-.495.397-1.125.592-1.755.592s-1.267-.195-1.755-.592l-2.347-1.875a.577.577 0 0 1-.09-.795.56.56 0 0 1 .787-.09l2.348 1.874c.57.458 1.537.458 2.107 0l2.348-1.875c.24-.194.6-.157.787.09a.57.57 0 0 1-.082.796", fill: "#fff" })),
994
+ React__default.createElement("defs", null,
995
+ React__default.createElement("clipPath", { id: "clip0_869_25628" },
996
+ React__default.createElement("path", { fill: "#fff", d: "M0 0h24v24H0z" })))));
997
+
998
+ const StyledPhone = styled(Phone) `
999
+ position: relative;
1000
+ .PhoneInputCountry {
1001
+ background: unset;
1002
+ border: none;
1003
+ position: absolute;
1004
+ left: 0;
1005
+ top: 0;
1006
+ height: 100%;
1007
+ padding-right: 0;
1008
+ min-width: 100px;
1009
+ .PhoneInputCountryIcon {
1010
+ min-width: 70px;
1011
+ .PhoneInputCountryIconImg {
1012
+ margin: auto;
1013
+ }
1014
+ }
1015
+ }
1016
+ .PhoneInputInput {
1017
+ border-radius: 8px;
1018
+ border-left-width: 1px;
1019
+ line-height: 46px;
1020
+ padding-left: 105px;
1021
+ }
1022
+ `;
1023
+
1024
+ const SSOFirstScreen = ({ hidden }) => {
1025
+ const [phone, setPhone] = React__default.useState('');
1026
+ const [errMsg, setErrMsg] = React__default.useState('');
1027
+ const { locale, onClose } = useSSOState();
1028
+ const { addStep, goNext, setShareData } = useSSOSteps();
1029
+ const handleLoginBySocial = (credential, provider) => __awaiter(void 0, void 0, void 0, function* () {
1030
+ var _a, _b, _c, _d;
1031
+ const res = yield loginBySocial(credential, provider);
1032
+ if ((res === null || res === void 0 ? void 0 : res._status) === 1) {
1033
+ handleAuthSuccess(res === null || res === void 0 ? void 0 : res._data);
1034
+ const userInfo = yield getUserInfo();
1035
+ if ((userInfo === null || userInfo === void 0 ? void 0 : userInfo._status) === 1) {
1036
+ setShareData({
1037
+ authMethod: provider,
1038
+ });
1039
+ if ((_a = userInfo._data) === null || _a === void 0 ? void 0 : _a.is_new) {
1040
+ setShareData((a) => (Object.assign(Object.assign({}, a), { authFlow: 'register' })));
1041
+ addStep({
1042
+ type: SSOStepTypeType.SETUP_FULL,
1043
+ config: {
1044
+ userInfo: userInfo._data,
1045
+ disabledEmail: true,
1046
+ },
1047
+ });
1048
+ goNext();
1049
+ }
1050
+ else if (!((_b = userInfo._data) === null || _b === void 0 ? void 0 : _b.phone_verified)) {
1051
+ setShareData((a) => (Object.assign(Object.assign({}, a), { authFlow: 'verify-phone' })));
1052
+ addStep({
1053
+ type: SSOStepTypeType.VERIFY_PHONE,
1054
+ });
1055
+ goNext();
1056
+ }
1057
+ else {
1058
+ onClose();
1059
+ }
1060
+ }
1061
+ else {
1062
+ setErrMsg(((_c = userInfo === null || userInfo === void 0 ? void 0 : userInfo._messages) === null || _c === void 0 ? void 0 : _c[0]) || 'API error');
1063
+ }
1064
+ }
1065
+ else {
1066
+ setErrMsg(((_d = res === null || res === void 0 ? void 0 : res._messages) === null || _d === void 0 ? void 0 : _d[0]) || 'API error');
1067
+ }
1068
+ });
1069
+ useEffect(() => {
1070
+ const script = document.createElement('script');
1071
+ script.src = 'https://accounts.google.com/gsi/client';
1072
+ script.async = true;
1073
+ document.body.appendChild(script);
1074
+ window.googleAuthCallback = (authData) => __awaiter(void 0, void 0, void 0, function* () {
1075
+ if (authData === null || authData === void 0 ? void 0 : authData.credential) {
1076
+ handleLoginBySocial(authData.credential, 'google');
1077
+ }
1078
+ else {
1079
+ setErrMsg('Google login failed');
1080
+ }
1081
+ });
1082
+ const fbScript = document.createElement('script');
1083
+ fbScript.src = 'https://connect.facebook.net/en_US/sdk.js';
1084
+ fbScript.async = true;
1085
+ document.body.appendChild(fbScript);
1086
+ window.fbAsyncInit = function () {
1087
+ window.FB.init({
1088
+ appId: FacebookAppId,
1089
+ cookie: true,
1090
+ xfbml: true,
1091
+ version: 'v20.0', // Use this Graph API version for this call.
1092
+ });
1093
+ };
1094
+ return () => {
1095
+ document.body.removeChild(script);
1096
+ document.body.removeChild(fbScript);
1097
+ };
1098
+ }, []);
1099
+ const onClickContinueZalo = () => __awaiter(void 0, void 0, void 0, function* () {
1100
+ var _e, _f, _g, _h;
1101
+ const { areaCode, phoneNumber } = splitPhone(phone);
1102
+ const userExist = yield checkUserExist({ phone: phoneNumber });
1103
+ if ((userExist === null || userExist === void 0 ? void 0 : userExist._status) === 1) {
1104
+ setShareData({
1105
+ authMethod: 'phone',
1106
+ });
1107
+ if ((_e = userExist._data) === null || _e === void 0 ? void 0 : _e.is_pass) {
1108
+ setShareData((a) => (Object.assign(Object.assign({}, a), { authFlow: 'login' })));
1109
+ addStep({
1110
+ type: SSOStepTypeType.PASSWORD,
1111
+ config: {
1112
+ phone,
1113
+ },
1114
+ });
1115
+ goNext();
1116
+ }
1117
+ else {
1118
+ let res;
1119
+ if (!((_f = userExist._data) === null || _f === void 0 ? void 0 : _f.provider)) {
1120
+ res = yield registerBySendZaloOTP(phoneNumber, areaCode);
1121
+ }
1122
+ else {
1123
+ res = yield resendZaloOTP(phoneNumber, areaCode);
1124
+ }
1125
+ if ((res === null || res === void 0 ? void 0 : res._status) !== 1) {
1126
+ setErrMsg(((_g = res._messages) === null || _g === void 0 ? void 0 : _g[0]) || 'API error');
1127
+ return;
1128
+ }
1129
+ setShareData((a) => (Object.assign(Object.assign({}, a), { authFlow: 'register' })));
1130
+ addStep({
1131
+ type: SSOStepTypeType.OTP,
1132
+ config: {
1133
+ phone,
1134
+ otpType: 'phone-zalo',
1135
+ afterAction: 'setup',
1136
+ },
1137
+ });
1138
+ goNext();
1139
+ }
1140
+ }
1141
+ else {
1142
+ setErrMsg(((_h = userExist === null || userExist === void 0 ? void 0 : userExist._messages) === null || _h === void 0 ? void 0 : _h[0]) || 'API error');
1143
+ }
1144
+ });
1145
+ const onClickContinuePhone = () => __awaiter(void 0, void 0, void 0, function* () {
1146
+ var _j, _k, _l, _m;
1147
+ const { areaCode, phoneNumber } = splitPhone(phone);
1148
+ const userExist = yield checkUserExist({ phone: phoneNumber });
1149
+ if ((userExist === null || userExist === void 0 ? void 0 : userExist._status) === 1) {
1150
+ setShareData({
1151
+ authMethod: 'phone',
1152
+ });
1153
+ if ((_j = userExist._data) === null || _j === void 0 ? void 0 : _j.is_pass) {
1154
+ setShareData((a) => (Object.assign(Object.assign({}, a), { authFlow: 'login' })));
1155
+ addStep({
1156
+ type: SSOStepTypeType.PASSWORD,
1157
+ config: {
1158
+ phone,
1159
+ },
1160
+ });
1161
+ goNext();
1162
+ }
1163
+ else {
1164
+ let res;
1165
+ if (!((_k = userExist._data) === null || _k === void 0 ? void 0 : _k.provider)) {
1166
+ res = yield registerBySendPhoneOTP(phoneNumber, areaCode);
1167
+ }
1168
+ else {
1169
+ res = yield resendPhoneOTP(phoneNumber, areaCode);
1170
+ }
1171
+ if ((res === null || res === void 0 ? void 0 : res._status) !== 1) {
1172
+ setErrMsg(((_l = res._messages) === null || _l === void 0 ? void 0 : _l[0]) || 'API error');
1173
+ return;
1174
+ }
1175
+ setShareData((a) => (Object.assign(Object.assign({}, a), { authFlow: 'register' })));
1176
+ addStep({
1177
+ type: SSOStepTypeType.OTP,
1178
+ config: {
1179
+ phone,
1180
+ otpType: 'phone-sms',
1181
+ afterAction: 'setup',
1182
+ },
1183
+ });
1184
+ goNext();
1185
+ }
1186
+ }
1187
+ else {
1188
+ setErrMsg(((_m = userExist === null || userExist === void 0 ? void 0 : userExist._messages) === null || _m === void 0 ? void 0 : _m[0]) || 'API error');
1189
+ }
1190
+ });
1191
+ const onClickEmail = () => {
1192
+ setShareData({
1193
+ authMethod: 'mail',
1194
+ });
1195
+ addStep({
1196
+ type: SSOStepTypeType.EMAIL,
1197
+ });
1198
+ goNext();
1199
+ };
1200
+ return (React__default.createElement("div", { style: {
1201
+ display: hidden ? 'none' : 'flex',
1202
+ flexDirection: 'column',
1203
+ height: '100%',
1204
+ } },
1205
+ React__default.createElement(Stack, { spacing: 8 },
1206
+ React__default.createElement(Text, { size: "s1", weight: "semiBold" }, "Sign in or Sign up"),
1207
+ React__default.createElement(Text, { size: "p4" }, "Continue with your phone number, email or your socials to log in or sign up.")),
1208
+ React__default.createElement(Stack, { mt: 24, spacing: 24 },
1209
+ React__default.createElement(Stack, { spacing: 16 },
1210
+ React__default.createElement(Input.Wrapper, { error: errMsg },
1211
+ React__default.createElement(StyledPhone, { defaultCountry: (locale ? MAPPED_LOCALE[locale] || 'VN' : 'VN'), value: phone, onChange: (value) => setPhone(value), isError: !!errMsg, required: true, name: "phone" })),
1212
+ React__default.createElement(Button, { size: "lg", variant: "primary", onClick: onClickContinueZalo }, "Continue with Zalo"),
1213
+ React__default.createElement(Button, { size: "lg", variant: "secondary", onClick: onClickContinuePhone }, "Continue with SMS")),
1214
+ React__default.createElement(Stack, { spacing: 16, align: "center" },
1215
+ React__default.createElement(Text, { size: "p4" }, "Or continue with"),
1216
+ React__default.createElement(Group, { spacing: 24 },
1217
+ React__default.createElement("div", { style: {
1218
+ position: 'relative',
1219
+ width: 48,
1220
+ height: 48,
1221
+ } },
1222
+ React__default.createElement("div", { id: "g_id_onload", "data-client_id": GoogleAuthClientId, "data-context": "signin", "data-ux_mode": "popup", "data-callback": "googleAuthCallback", "data-auto_prompt": "false" }),
1223
+ React__default.createElement("div", { className: "g_id_signin", "data-type": "icon", "data-shape": "circle", "data-theme": "outline", "data-text": "signin_with", "data-size": "large", style: {
1224
+ transform: 'translate(4px,4px) scale(1.1)',
1225
+ } }),
1226
+ React__default.createElement(Button, { variant: "white", style: {
1227
+ width: 48,
1228
+ height: 48,
1229
+ padding: 12,
1230
+ background: '#F7F9FC',
1231
+ borderRadius: '100%',
1232
+ position: 'absolute',
1233
+ pointerEvents: 'none',
1234
+ top: 0,
1235
+ left: 0,
1236
+ }, onClick: () => {
1237
+ const googleButton = document.querySelector('.g_id_signin');
1238
+ googleButton === null || googleButton === void 0 ? void 0 : googleButton.dispatchEvent(new Event('click'));
1239
+ } },
1240
+ React__default.createElement(Google, { style: { width: 24, height: 24 } }))),
1241
+ React__default.createElement(Button, { variant: "white", style: {
1242
+ width: 48,
1243
+ height: 48,
1244
+ padding: 12,
1245
+ background: '#F7F9FC',
1246
+ borderRadius: '100%',
1247
+ }, onClick: () => {
1248
+ window.FB.login(function (response) {
1249
+ var _a;
1250
+ return __awaiter(this, void 0, void 0, function* () {
1251
+ if ((_a = response === null || response === void 0 ? void 0 : response.authResponse) === null || _a === void 0 ? void 0 : _a.accessToken) {
1252
+ handleLoginBySocial(response.authResponse.accessToken, 'facebook');
1253
+ }
1254
+ else {
1255
+ setErrMsg('Facebook login failed');
1256
+ }
1257
+ });
1258
+ }, { scope: 'public_profile,email' });
1259
+ } },
1260
+ React__default.createElement(Facebook, { style: { width: 24, height: 24 } })),
1261
+ React__default.createElement(Button, { variant: "white", style: {
1262
+ width: 48,
1263
+ height: 48,
1264
+ padding: 12,
1265
+ background: '#F7F9FC',
1266
+ borderRadius: '100%',
1267
+ }, onClick: onClickEmail },
1268
+ React__default.createElement(MailIcon, null))))),
1269
+ React__default.createElement(Stack, { spacing: 24, sx: (theme) => ({
1270
+ marginTop: 56,
1271
+ [theme.fn.smallerThan('sm')]: {
1272
+ marginTop: 'auto',
1273
+ },
1274
+ }) },
1275
+ React__default.createElement(CollectInfoText, null),
1276
+ React__default.createElement(Text, { size: "p5", color: "gray.6" },
1277
+ "By tapping continue, I confirm that I have read, understand and agree to the",
1278
+ ' ',
1279
+ React__default.createElement("a", { href: "#privacy", target: "_blank", style: {
1280
+ color: '#262626',
1281
+ textDecoration: 'underline',
1282
+ } }, "Privacy Policy"),
1283
+ ' ',
1284
+ "and the",
1285
+ ' ',
1286
+ React__default.createElement("a", { href: "#tos", target: "_blank", style: {
1287
+ color: '#262626',
1288
+ textDecoration: 'underline',
1289
+ } }, "Terms of Service"),
1290
+ ' ',
1291
+ "of Hello Health Group."))));
1292
+ };
1293
+
1294
+ const SSOOTPScreen = ({ hidden, index, }) => {
1295
+ const { onClose } = useSSOState();
1296
+ const { steps, setSteps, addStep, goNext } = useSSOSteps();
1297
+ const [otp, setOtp] = React__default.useState('');
1298
+ const [error, setError] = React__default.useState('');
1299
+ const currentStepIndex = index;
1300
+ const currentStep = steps[currentStepIndex];
1301
+ const { phone, email, otpType, isUpdatePhone, afterAction, setupData } = currentStep.config;
1302
+ const isEmail = otpType === 'email';
1303
+ const sendOTPCode = (checkResend) => {
1304
+ if (checkResend && resendTime > 0)
1305
+ return;
1306
+ // send otp code logic here
1307
+ const { areaCode, phoneNumber } = splitPhone(phone);
1308
+ if (isUpdatePhone) {
1309
+ if (otpType === 'phone-sms') {
1310
+ resendUpdatePhoneOTP(phoneNumber, areaCode);
1311
+ }
1312
+ else if (otpType === 'phone-zalo') {
1313
+ resendUpdatePhoneZaloOTP(phoneNumber, areaCode);
1314
+ }
1315
+ }
1316
+ else {
1317
+ if (otpType === 'phone-sms') {
1318
+ resendPhoneOTP(phoneNumber, areaCode);
1319
+ }
1320
+ else if (otpType === 'phone-zalo') {
1321
+ resendZaloOTP(phoneNumber, areaCode);
1322
+ }
1323
+ else if (otpType === 'email') {
1324
+ resendEmailOTP(email);
1325
+ }
1326
+ }
1327
+ setupResendTimer();
1328
+ };
1329
+ const submitOtp = () => __awaiter(void 0, void 0, void 0, function* () {
1330
+ var _a, _b, _c, _d, _e;
1331
+ const { areaCode, phoneNumber } = splitPhone(phone);
1332
+ // submit otp code logic here
1333
+ if (isUpdatePhone) {
1334
+ let res;
1335
+ if (otpType === 'phone-sms') {
1336
+ res = yield verifyUpdatePhoneOTP(areaCode, otp);
1337
+ }
1338
+ else if (otpType === 'phone-zalo') {
1339
+ res = yield verifyUpdatePhoneZaloOTP(phoneNumber, areaCode, otp);
1340
+ }
1341
+ if ((res === null || res === void 0 ? void 0 : res._status) === 1) {
1342
+ if (afterAction === 'setup') {
1343
+ const userInfo = yield getUserInfo();
1344
+ if ((userInfo === null || userInfo === void 0 ? void 0 : userInfo._status) !== 1) {
1345
+ // log error
1346
+ setError(((_a = userInfo._messages) === null || _a === void 0 ? void 0 : _a[0]) || 'API error');
1347
+ return;
1348
+ }
1349
+ addStep({
1350
+ type: SSOStepTypeType.SETUP_FULL,
1351
+ config: {
1352
+ phone,
1353
+ userInfo: userInfo === null || userInfo === void 0 ? void 0 : userInfo._data,
1354
+ },
1355
+ });
1356
+ goNext();
1357
+ }
1358
+ else if (afterAction === 'submitSetup') {
1359
+ const res = yield updateUserInfo(Object.assign(Object.assign({}, setupData), { validate: '' }));
1360
+ if ((res === null || res === void 0 ? void 0 : res._status) === 1) {
1361
+ handleAuthSuccess(res === null || res === void 0 ? void 0 : res._data);
1362
+ onClose === null || onClose === void 0 ? void 0 : onClose();
1363
+ }
1364
+ else {
1365
+ // log error
1366
+ setError(((_b = res._messages) === null || _b === void 0 ? void 0 : _b[0]) || 'API error');
1367
+ }
1368
+ }
1369
+ else {
1370
+ onClose === null || onClose === void 0 ? void 0 : onClose();
1371
+ }
1372
+ }
1373
+ else {
1374
+ // log error
1375
+ setError(((_c = res._messages) === null || _c === void 0 ? void 0 : _c[0]) || 'API error');
1376
+ }
1377
+ return;
1378
+ }
1379
+ let res;
1380
+ if (otpType === 'phone-sms') {
1381
+ res = yield verifyByPhoneOTP(phoneNumber, areaCode, otp);
1382
+ }
1383
+ else if (otpType === 'phone-zalo') {
1384
+ res = yield verifyByZaloOTP(phoneNumber, areaCode, otp);
1385
+ }
1386
+ else if (otpType === 'email') {
1387
+ res = yield verifyByEmailOTP(email, otp);
1388
+ }
1389
+ if ((res === null || res === void 0 ? void 0 : res._status) !== 1) {
1390
+ setOtp('');
1391
+ // log error
1392
+ setError(((_d = res._messages) === null || _d === void 0 ? void 0 : _d[0]) || 'API error');
1393
+ return;
1394
+ }
1395
+ handleAuthSuccess(res === null || res === void 0 ? void 0 : res._data);
1396
+ if (afterAction === 'forgot') {
1397
+ addStep({
1398
+ type: SSOStepTypeType.FORGOT_PASSWORD_SETUP,
1399
+ });
1400
+ goNext();
1401
+ }
1402
+ else if (afterAction === 'setup') {
1403
+ const userInfo = yield getUserInfo();
1404
+ if ((userInfo === null || userInfo === void 0 ? void 0 : userInfo._status) !== 1) {
1405
+ // log error
1406
+ setError(((_e = userInfo._messages) === null || _e === void 0 ? void 0 : _e[0]) || 'API error');
1407
+ return;
1408
+ }
1409
+ addStep({
1410
+ type: SSOStepTypeType.SETUP_FULL,
1411
+ config: {
1412
+ phone,
1413
+ userInfo: userInfo === null || userInfo === void 0 ? void 0 : userInfo._data,
1414
+ disabledEmail: isEmail,
1415
+ },
1416
+ });
1417
+ goNext();
1418
+ }
1419
+ else {
1420
+ onClose === null || onClose === void 0 ? void 0 : onClose();
1421
+ }
1422
+ });
1423
+ const swapZaloSms = () => {
1424
+ if (isEmail)
1425
+ return;
1426
+ const { areaCode, phoneNumber } = splitPhone(phone);
1427
+ const newType = otpType === 'phone-sms' ? 'phone-zalo' : 'phone-sms';
1428
+ if (newType === 'phone-sms') {
1429
+ resendPhoneOTP(phoneNumber, areaCode);
1430
+ }
1431
+ else {
1432
+ resendZaloOTP(phoneNumber, areaCode);
1433
+ }
1434
+ setSteps((s) => s.splice(currentStepIndex, 1, Object.assign(Object.assign({}, currentStep), { config: Object.assign(Object.assign({}, currentStep === null || currentStep === void 0 ? void 0 : currentStep.config), { otpType: newType }) })));
1435
+ };
1436
+ const [resendTime, setResendTime] = React__default.useState(30);
1437
+ const setupResendTimer = () => {
1438
+ setResendTime(30);
1439
+ const countdown = () => {
1440
+ setResendTime((t) => {
1441
+ if (t - 1 > 0) {
1442
+ setTimeout(() => countdown(), 1000);
1443
+ }
1444
+ return t - 1;
1445
+ });
1446
+ };
1447
+ countdown();
1448
+ };
1449
+ useEffect(() => {
1450
+ setupResendTimer();
1451
+ }, []);
1452
+ return (React__default.createElement("form", { style: {
1453
+ display: hidden ? 'none' : 'block',
1454
+ }, onSubmit: (e) => {
1455
+ e.preventDefault();
1456
+ submitOtp();
1457
+ } },
1458
+ React__default.createElement(Stack, { spacing: 8 },
1459
+ React__default.createElement(Text, { size: "s1", weight: "semiBold" }, isEmail ? 'Verify Email' : 'Verify Phone Number'),
1460
+ React__default.createElement(Text, { size: "p4" }, isEmail ? (React__default.createElement(React__default.Fragment, null,
1461
+ "Enter the 6-digit OTP sent to your email ",
1462
+ React__default.createElement("b", null, email),
1463
+ ".")) : (React__default.createElement(React__default.Fragment, null,
1464
+ "Enter the 6-digit OTP sent to the phone number ",
1465
+ React__default.createElement("b", null, phone),
1466
+ " via",
1467
+ ' ',
1468
+ React__default.createElement("b", null, otpType === 'phone-sms' ? 'SMS' : 'Zalo App'),
1469
+ ". OTP code will expire in ",
1470
+ React__default.createElement("b", null, "10 mins"))))),
1471
+ React__default.createElement(Stack, { mt: 24, spacing: 8 },
1472
+ React__default.createElement(Input.Wrapper, { error: error },
1473
+ React__default.createElement(OTP, { value: otp, onChange: (otp) => setOtp(String(otp)) })),
1474
+ React__default.createElement(Group, { spacing: 8, align: "center", style: {
1475
+ height: 40,
1476
+ } },
1477
+ React__default.createElement(Text, { size: "p4" }, "Didn\u2019t receive the code?"),
1478
+ React__default.createElement(Text, { style: {
1479
+ pointerEvents: resendTime > 0 ? 'none' : 'auto',
1480
+ cursor: resendTime > 0 ? 'not-allowed' : 'pointer',
1481
+ }, size: "s4", color: "blue.6", onClick: () => sendOTPCode(true) },
1482
+ "Resend (",
1483
+ resendTime,
1484
+ ")"))),
1485
+ React__default.createElement(Button, { type: "submit", size: "lg", variant: "primary", mt: 12, fullWidth: true }, "Continue"),
1486
+ !isEmail && (React__default.createElement(Button, { size: "lg", variant: "tertiary", mt: 12, onClick: swapZaloSms, fullWidth: true },
1487
+ "Send OTP Code via ",
1488
+ otpType === 'phone-sms' ? 'Zalo App' : 'SMS'))));
1489
+ };
1490
+
1491
+ const SSOPasswordScreen = ({ hidden, index, }) => {
1492
+ var _a, _b;
1493
+ const { onClose } = useSSOState();
1494
+ const [errMsg, setErrMsg] = React__default.useState('');
1495
+ const { steps, addStep, goNext } = useSSOSteps();
1496
+ const thisStep = steps[index];
1497
+ const phone = (_a = thisStep === null || thisStep === void 0 ? void 0 : thisStep.config) === null || _a === void 0 ? void 0 : _a.phone;
1498
+ const email = (_b = thisStep === null || thisStep === void 0 ? void 0 : thisStep.config) === null || _b === void 0 ? void 0 : _b.email;
1499
+ const resetPassword = () => __awaiter(void 0, void 0, void 0, function* () {
1500
+ var _c, _d;
1501
+ if (phone) {
1502
+ addStep({
1503
+ type: SSOStepTypeType.FORGOT_PASSWORD_PHONE,
1504
+ });
1505
+ }
1506
+ else {
1507
+ const existRes = yield checkUserExist({ email });
1508
+ if ((existRes === null || existRes === void 0 ? void 0 : existRes._status) === 1) {
1509
+ let res;
1510
+ if (!((_c = existRes._data) === null || _c === void 0 ? void 0 : _c.provider)) {
1511
+ res = yield registerBySendEmailOTP(email);
1512
+ }
1513
+ else {
1514
+ res = yield resendEmailOTP(email);
1515
+ }
1516
+ if ((res === null || res === void 0 ? void 0 : res._status) !== 1) {
1517
+ setErrMsg(((_d = res._messages) === null || _d === void 0 ? void 0 : _d[0]) || 'API error');
1518
+ return;
1519
+ }
1520
+ addStep({
1521
+ type: SSOStepTypeType.OTP,
1522
+ config: {
1523
+ email,
1524
+ otpType: 'email',
1525
+ afterAction: 'forgot',
1526
+ },
1527
+ });
1528
+ }
1529
+ }
1530
+ goNext();
1531
+ });
1532
+ return (React__default.createElement("form", { style: {
1533
+ display: hidden ? 'none' : 'block',
1534
+ }, onSubmit: (e) => {
1535
+ e.preventDefault();
1536
+ const password = e.currentTarget.password.value;
1537
+ // call api to login with email and password, if fail then show error
1538
+ if (phone) {
1539
+ loginByPhonePassword(phone, password)
1540
+ .then((res) => {
1541
+ var _a;
1542
+ if ((res === null || res === void 0 ? void 0 : res._status) === 1) {
1543
+ handleAuthSuccess(res === null || res === void 0 ? void 0 : res._data);
1544
+ onClose === null || onClose === void 0 ? void 0 : onClose();
1545
+ }
1546
+ else {
1547
+ setErrMsg(((_a = res === null || res === void 0 ? void 0 : res._messages) === null || _a === void 0 ? void 0 : _a[0]) || 'API error');
1548
+ }
1549
+ })
1550
+ .catch(() => {
1551
+ setErrMsg('api error');
1552
+ });
1553
+ }
1554
+ else {
1555
+ loginByEmailPassword(email, password)
1556
+ .then((res) => {
1557
+ var _a;
1558
+ if ((res === null || res === void 0 ? void 0 : res._status) === 1) {
1559
+ handleAuthSuccess(res === null || res === void 0 ? void 0 : res._data);
1560
+ onClose === null || onClose === void 0 ? void 0 : onClose();
1561
+ }
1562
+ else {
1563
+ setErrMsg(((_a = res === null || res === void 0 ? void 0 : res._messages) === null || _a === void 0 ? void 0 : _a[0]) || 'API error');
1564
+ }
1565
+ })
1566
+ .catch(() => {
1567
+ setErrMsg('api error');
1568
+ });
1569
+ }
1570
+ } },
1571
+ React__default.createElement(Stack, { spacing: 8 },
1572
+ React__default.createElement(Text, { size: "s1", weight: "semiBold" },
1573
+ "Welcome back!",
1574
+ React__default.createElement("br", null),
1575
+ "Enter your password"),
1576
+ React__default.createElement(Text, { size: "p4" }, "\u0110\u0103ng nh\u1EADp b\u1EB1ng m\u1EADt kh\u1EA9u c\u1EE7a b\u1EA1n.")),
1577
+ React__default.createElement(Stack, { mt: 24, spacing: 8 },
1578
+ React__default.createElement(PasswordInput, { name: "password", placeholder: "Nh\u1EADp m\u1EADt kh\u1EA9u", error: errMsg || undefined }),
1579
+ React__default.createElement(Group, { spacing: 8, align: "center", style: {
1580
+ height: 40,
1581
+ } },
1582
+ React__default.createElement(Text, { size: "p4" }, "Forgot Password?"),
1583
+ React__default.createElement(Text, { size: "s4", color: "blue.6", style: {
1584
+ cursor: 'pointer',
1585
+ }, onClick: resetPassword }, "Reset"))),
1586
+ React__default.createElement(Button, { type: "submit", size: "lg", variant: "primary", mt: 12, fullWidth: true }, "Sign In")));
1587
+ };
1588
+
1589
+ const SSOPasswordForgotPhone = ({ hidden, }) => {
1590
+ const [phone, setPhone] = React__default.useState('');
1591
+ const [errMsg, setErrMsg] = React__default.useState('');
1592
+ const { locale } = useSSOState();
1593
+ const { addStep, goNext, setShareData } = useSSOSteps();
1594
+ const onClickContinueZalo = () => __awaiter(void 0, void 0, void 0, function* () {
1595
+ var _a, _b, _c;
1596
+ const { areaCode, phoneNumber } = splitPhone(phone);
1597
+ const userExist = yield checkUserExist({ phone: phoneNumber });
1598
+ if ((userExist === null || userExist === void 0 ? void 0 : userExist._status) === 1) {
1599
+ setShareData({
1600
+ authMethod: 'phone',
1601
+ });
1602
+ let res;
1603
+ if (!((_a = userExist._data) === null || _a === void 0 ? void 0 : _a.provider)) {
1604
+ res = yield registerBySendZaloOTP(phoneNumber, areaCode);
1605
+ }
1606
+ else {
1607
+ res = yield resendZaloOTP(phoneNumber, areaCode);
1608
+ }
1609
+ if ((res === null || res === void 0 ? void 0 : res._status) !== 1) {
1610
+ setErrMsg(((_b = res._messages) === null || _b === void 0 ? void 0 : _b[0]) || 'API error');
1611
+ return;
1612
+ }
1613
+ setShareData((a) => (Object.assign(Object.assign({}, a), { authFlow: 'register' })));
1614
+ addStep({
1615
+ type: SSOStepTypeType.OTP,
1616
+ config: {
1617
+ phone,
1618
+ otpType: 'phone-zalo',
1619
+ afterAction: 'forgot',
1620
+ },
1621
+ });
1622
+ goNext();
1623
+ }
1624
+ else {
1625
+ setErrMsg(((_c = userExist === null || userExist === void 0 ? void 0 : userExist._messages) === null || _c === void 0 ? void 0 : _c[0]) || 'API error');
1626
+ }
1627
+ });
1628
+ const onClickContinuePhone = () => __awaiter(void 0, void 0, void 0, function* () {
1629
+ var _d, _e, _f;
1630
+ const { areaCode, phoneNumber } = splitPhone(phone);
1631
+ const userExist = yield checkUserExist({ phone: phoneNumber });
1632
+ if ((userExist === null || userExist === void 0 ? void 0 : userExist._status) === 1) {
1633
+ setShareData({
1634
+ authMethod: 'phone',
1635
+ });
1636
+ let res;
1637
+ if (!((_d = userExist._data) === null || _d === void 0 ? void 0 : _d.provider)) {
1638
+ res = yield registerBySendPhoneOTP(phoneNumber, areaCode);
1639
+ }
1640
+ else {
1641
+ res = yield resendPhoneOTP(phoneNumber, areaCode);
1642
+ }
1643
+ if ((res === null || res === void 0 ? void 0 : res._status) !== 1) {
1644
+ setErrMsg(((_e = res._messages) === null || _e === void 0 ? void 0 : _e[0]) || 'API error');
1645
+ return;
1646
+ }
1647
+ setShareData((a) => (Object.assign(Object.assign({}, a), { authFlow: 'register' })));
1648
+ addStep({
1649
+ type: SSOStepTypeType.OTP,
1650
+ config: {
1651
+ phone,
1652
+ otpType: 'phone-sms',
1653
+ afterAction: 'forgot',
1654
+ },
1655
+ });
1656
+ goNext();
1657
+ }
1658
+ else {
1659
+ setErrMsg(((_f = userExist === null || userExist === void 0 ? void 0 : userExist._messages) === null || _f === void 0 ? void 0 : _f[0]) || 'API error');
1660
+ }
1661
+ });
1662
+ return (React__default.createElement("div", { style: {
1663
+ display: hidden ? 'none' : 'block',
1664
+ } },
1665
+ React__default.createElement(Stack, { spacing: 8 },
1666
+ React__default.createElement(Text, { size: "s1", weight: "semiBold" }, "Reset password"),
1667
+ React__default.createElement(Text, { size: "p4" }, "Please provide the phone number you used to create your account.")),
1668
+ React__default.createElement(Stack, { mt: 24, spacing: 16 },
1669
+ React__default.createElement(StyledPhone, { defaultCountry: (locale ? MAPPED_LOCALE[locale] || 'VN' : 'VN'), value: phone, onChange: (value) => setPhone(value), isError: !!errMsg, required: true }),
1670
+ errMsg && (React__default.createElement(Text, { size: "label2", color: "red.6", mt: -12 }, errMsg)),
1671
+ React__default.createElement(Button, { size: "lg", variant: "primary", onClick: onClickContinueZalo }, "Continue with Zalo"),
1672
+ React__default.createElement(Button, { size: "lg", variant: "secondary", onClick: onClickContinuePhone }, "Continue with SMS"))));
1673
+ };
1674
+
1675
+ const CheckGrayIcon = () => (React__default.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
1676
+ React__default.createElement("path", { d: "M7.053 9.43 5.505 7.883a.48.48 0 0 0-.349-.142.47.47 0 0 0-.354.142.48.48 0 0 0-.145.351q0 .207.145.352l1.83 1.83q.18.18.421.18.24 0 .422-.18l3.709-3.71a.48.48 0 0 0 .142-.348.47.47 0 0 0-.142-.354.48.48 0 0 0-.351-.145.48.48 0 0 0-.352.145zm.948 4.903a6.2 6.2 0 0 1-2.47-.498 6.4 6.4 0 0 1-2.012-1.354 6.4 6.4 0 0 1-1.354-2.01A6.2 6.2 0 0 1 1.666 8q0-1.315.499-2.47a6.4 6.4 0 0 1 1.353-2.01 6.4 6.4 0 0 1 2.01-1.354 6.2 6.2 0 0 1 2.47-.5q1.314 0 2.47.5 1.157.498 2.012 1.353t1.354 2.01q.498 1.156.499 2.47 0 1.314-.499 2.47a6.4 6.4 0 0 1-1.354 2.011 6.4 6.4 0 0 1-2.01 1.355 6.2 6.2 0 0 1-2.47.498m-.002-1q2.234 0 3.784-1.55T13.333 8t-1.55-3.783-3.784-1.55-3.783 1.55T2.666 8t1.55 3.783 3.783 1.55", fill: "#8C8C8C" })));
1677
+ const CheckGreenIcon = () => (React__default.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
1678
+ React__default.createElement("path", { d: "M7.053 9.43 5.505 7.883a.48.48 0 0 0-.349-.142.47.47 0 0 0-.354.142.48.48 0 0 0-.145.351q0 .207.145.352l1.83 1.83q.18.18.421.18.24 0 .422-.18l3.709-3.71a.48.48 0 0 0 .142-.348.47.47 0 0 0-.142-.354.48.48 0 0 0-.351-.145.48.48 0 0 0-.352.145zm.948 4.903a6.2 6.2 0 0 1-2.47-.498 6.4 6.4 0 0 1-2.012-1.354 6.4 6.4 0 0 1-1.354-2.01A6.2 6.2 0 0 1 1.666 8q0-1.315.499-2.47a6.4 6.4 0 0 1 1.353-2.01 6.4 6.4 0 0 1 2.01-1.354 6.2 6.2 0 0 1 2.47-.5q1.314 0 2.47.5 1.157.498 2.012 1.353t1.354 2.01q.498 1.156.499 2.47 0 1.314-.499 2.47a6.4 6.4 0 0 1-1.354 2.011 6.4 6.4 0 0 1-2.01 1.355 6.2 6.2 0 0 1-2.47.498", fill: "#00B16A" })));
1679
+ const CheckRedIcon = () => (React__default.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
1680
+ React__default.createElement("path", { d: "m8.001 8.703 2.049 2.048q.138.14.348.142a.47.47 0 0 0 .355-.142.48.48 0 0 0 .145-.35.48.48 0 0 0-.145-.352L8.703 8l2.05-2.049a.48.48 0 0 0 .141-.348.47.47 0 0 0-.141-.354.48.48 0 0 0-.352-.145.48.48 0 0 0-.351.145L8.001 7.298l-2.048-2.05a.48.48 0 0 0-.349-.14.47.47 0 0 0-.354.14.48.48 0 0 0-.145.352q0 .207.145.351l2.049 2.05-2.049 2.048a.48.48 0 0 0-.142.348.47.47 0 0 0 .142.354.48.48 0 0 0 .351.145.48.48 0 0 0 .352-.145zm.001 5.63a6.2 6.2 0 0 1-2.47-.498 6.4 6.4 0 0 1-2.011-1.354 6.4 6.4 0 0 1-1.354-2.01A6.2 6.2 0 0 1 1.668 8q0-1.315.499-2.47A6.4 6.4 0 0 1 3.52 3.52a6.4 6.4 0 0 1 2.01-1.354 6.2 6.2 0 0 1 2.47-.5q1.314 0 2.47.5 1.156.498 2.012 1.353.855.855 1.354 2.01.499 1.156.499 2.47t-.499 2.47a6.4 6.4 0 0 1-1.354 2.011 6.4 6.4 0 0 1-2.01 1.355 6.2 6.2 0 0 1-2.47.498", fill: "#F44D2C" })));
1681
+
1682
+ const SSOPasswordWithConfirm = (_a) => {
1683
+ var { form } = _a, props = __rest(_a, ["form"]);
1684
+ const [atLeast8Chars, setAtLeast8Chars] = React__default.useState(undefined);
1685
+ const [atLeastOneUpper, setAtLeastOneUpper] = React__default.useState(undefined);
1686
+ const password = form.values.password;
1687
+ useEffect(() => {
1688
+ if (typeof password === 'undefined')
1689
+ return;
1690
+ setAtLeast8Chars(password.length >= 8);
1691
+ setAtLeastOneUpper(!!password.match(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)/));
1692
+ }, [password]);
1693
+ return (React__default.createElement(Stack, Object.assign({ spacing: 12 }, props),
1694
+ React__default.createElement(PasswordInput, Object.assign({ name: "password", placeholder: "Nh\u1EADp m\u1EADt kh\u1EA9u", label: "Password", required: true, withAsterisk: true }, form.getInputProps('password'))),
1695
+ React__default.createElement(Stack, { spacing: 8 },
1696
+ React__default.createElement(Text, { size: "n1" },
1697
+ atLeast8Chars ? (React__default.createElement(CheckGreenIcon, null)) : typeof atLeast8Chars === 'undefined' ? (React__default.createElement(CheckGrayIcon, null)) : (React__default.createElement(CheckRedIcon, null)),
1698
+ ' ',
1699
+ "At least 8 characters."),
1700
+ React__default.createElement(Text, { size: "n1" },
1701
+ atLeastOneUpper ? (React__default.createElement(CheckGreenIcon, null)) : typeof atLeastOneUpper === 'undefined' ? (React__default.createElement(CheckGrayIcon, null)) : (React__default.createElement(CheckRedIcon, null)),
1702
+ ' ',
1703
+ "At least one uppercase letter, one lowercase letter, and one number.")),
1704
+ React__default.createElement(PasswordInput, Object.assign({ name: "confirm-password", placeholder: "X\u00E1c nh\u1EADn m\u1EADt kh\u1EA9u", label: "Confirm Password", required: true, withAsterisk: true }, form.getInputProps('confirmPassword')))));
1705
+ };
1706
+
1707
+ const SSOPasswordForgotSetup = ({ hidden }) => {
1708
+ const { steps, goBack, currentStepIndex, addStep, goNext } = useSSOSteps();
1709
+ const form = useForm({
1710
+ validate: yupResolver(yup.object().shape({
1711
+ password: yup
1712
+ .string()
1713
+ .required('Password is required')
1714
+ .min(8, ' ')
1715
+ .max(50, ' ')
1716
+ .matches(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)/, ' '),
1717
+ confirmPassword: yup
1718
+ .string()
1719
+ .required('Confirm password is required')
1720
+ .test('passwords-match', 'Passwords must match', function (value) {
1721
+ return this.parent.password === value;
1722
+ }),
1723
+ })),
1724
+ });
1725
+ const onSubmit = (values) => __awaiter(void 0, void 0, void 0, function* () {
1726
+ var _a;
1727
+ const { password, confirmPassword } = values;
1728
+ if (password.length >= 8 &&
1729
+ password.length <= 50 &&
1730
+ password.match(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)/) &&
1731
+ password === confirmPassword) {
1732
+ const res = yield resetPassword(password, confirmPassword);
1733
+ if ((res === null || res === void 0 ? void 0 : res._status) === 1) {
1734
+ showNotification({
1735
+ type: 'success',
1736
+ message: 'Password has been reset successfully',
1737
+ });
1738
+ // back to login step
1739
+ const foundPasswordIndex = steps.findIndex((step) => step.type === SSOStepTypeType.PASSWORD);
1740
+ const foundPasswordStep = steps.find((step) => step.type === SSOStepTypeType.PASSWORD);
1741
+ const diffIndex = currentStepIndex - foundPasswordIndex;
1742
+ for (let i = 0; i < diffIndex; i++) {
1743
+ goBack();
1744
+ }
1745
+ goBack();
1746
+ addStep(foundPasswordStep);
1747
+ goNext();
1748
+ // onClose?.()
1749
+ }
1750
+ else {
1751
+ // toast error message
1752
+ showNotification({
1753
+ type: 'danger',
1754
+ message: ((_a = res === null || res === void 0 ? void 0 : res._messages) === null || _a === void 0 ? void 0 : _a[0]) || 'API error',
1755
+ });
1756
+ }
1757
+ }
1758
+ });
1759
+ return (React__default.createElement("form", { style: {
1760
+ display: hidden ? 'none' : 'block',
1761
+ }, onSubmit: form.onSubmit(onSubmit) },
1762
+ React__default.createElement(Stack, { spacing: 24 },
1763
+ React__default.createElement(Stack, { spacing: 8 },
1764
+ React__default.createElement(Text, { size: "s1", weight: "semiBold" }, "Setup your password"),
1765
+ React__default.createElement(Text, { size: "p4" }, "Set up your login password and other details to complete the registration process.")),
1766
+ React__default.createElement(SSOPasswordWithConfirm, { form: form }),
1767
+ React__default.createElement(CollectInfoText, null),
1768
+ React__default.createElement(Button, { type: "submit", size: "lg", variant: "primary", fullWidth: true }, "Save"))));
1769
+ };
1770
+
1771
+ const SSOPhoneVerify = ({ hidden, }) => {
1772
+ const [phone, setPhone] = React__default.useState('');
1773
+ const [errMsg, setErrMsg] = React__default.useState('');
1774
+ const { locale } = useSSOState();
1775
+ const { addStep, goNext } = useSSOSteps();
1776
+ const onClickContinueZalo = () => __awaiter(void 0, void 0, void 0, function* () {
1777
+ var _a, _b, _c;
1778
+ const { areaCode, phoneNumber } = splitPhone(phone);
1779
+ const userExist = yield checkUserExist({ phone: phoneNumber });
1780
+ if ((userExist === null || userExist === void 0 ? void 0 : userExist._status) === 1) {
1781
+ if (((_a = userExist._data) === null || _a === void 0 ? void 0 : _a.is_pass) && ((_b = userExist._data) === null || _b === void 0 ? void 0 : _b.is_status) === 'Active') {
1782
+ addStep({
1783
+ type: SSOStepTypeType.PASSWORD,
1784
+ config: {
1785
+ phone,
1786
+ },
1787
+ });
1788
+ goNext();
1789
+ }
1790
+ else {
1791
+ resendUpdatePhoneZaloOTP(phoneNumber, areaCode);
1792
+ addStep({
1793
+ type: SSOStepTypeType.OTP,
1794
+ config: {
1795
+ phone,
1796
+ otpType: 'phone-zalo',
1797
+ isUpdatePhone: true,
1798
+ afterAction: 'setup',
1799
+ },
1800
+ });
1801
+ goNext();
1802
+ }
1803
+ }
1804
+ else {
1805
+ setErrMsg(((_c = userExist === null || userExist === void 0 ? void 0 : userExist._messages) === null || _c === void 0 ? void 0 : _c[0]) || 'API error');
1806
+ }
1807
+ });
1808
+ const onClickContinuePhone = () => __awaiter(void 0, void 0, void 0, function* () {
1809
+ var _d, _e, _f;
1810
+ const { areaCode, phoneNumber } = splitPhone(phone);
1811
+ const userExist = yield checkUserExist({ phone: phoneNumber });
1812
+ if ((userExist === null || userExist === void 0 ? void 0 : userExist._status) === 1) {
1813
+ if ((_d = userExist._data) === null || _d === void 0 ? void 0 : _d.is_pass) {
1814
+ addStep({
1815
+ type: SSOStepTypeType.PASSWORD,
1816
+ config: {
1817
+ phone,
1818
+ },
1819
+ });
1820
+ goNext();
1821
+ }
1822
+ else {
1823
+ const res = yield resendUpdatePhoneOTP(phoneNumber, areaCode);
1824
+ if ((res === null || res === void 0 ? void 0 : res._status) !== 1) {
1825
+ setErrMsg(((_e = res === null || res === void 0 ? void 0 : res._messages) === null || _e === void 0 ? void 0 : _e[0]) || 'API error');
1826
+ return;
1827
+ }
1828
+ addStep({
1829
+ type: SSOStepTypeType.OTP,
1830
+ config: {
1831
+ phone,
1832
+ otpType: 'phone-sms',
1833
+ isUpdatePhone: true,
1834
+ afterAction: 'setup',
1835
+ },
1836
+ });
1837
+ goNext();
1838
+ }
1839
+ }
1840
+ else {
1841
+ setErrMsg(((_f = userExist === null || userExist === void 0 ? void 0 : userExist._messages) === null || _f === void 0 ? void 0 : _f[0]) || 'API error');
1842
+ }
1843
+ });
1844
+ return (React__default.createElement("div", { style: {
1845
+ display: hidden ? 'none' : 'block',
1846
+ } },
1847
+ React__default.createElement(Stack, { spacing: 24 },
1848
+ React__default.createElement(Stack, { spacing: 8 },
1849
+ React__default.createElement(Text, { size: "s1", weight: "semiBold" }, "Verify Phone Number"),
1850
+ React__default.createElement(Text, { size: "p4" }, "Please provide additional information to complete the account registration process.")),
1851
+ React__default.createElement(Stack, { spacing: 16 },
1852
+ React__default.createElement(Input.Wrapper, { error: errMsg },
1853
+ React__default.createElement(StyledPhone, { defaultCountry: (locale ? MAPPED_LOCALE[locale] || 'VN' : 'VN'), value: phone, onChange: (value) => setPhone(value), isError: !!errMsg, required: true, name: "phone" })),
1854
+ React__default.createElement(Button, { size: "lg", variant: "primary", onClick: onClickContinueZalo }, "Continue with Zalo"),
1855
+ React__default.createElement(Button, { size: "lg", variant: "secondary", onClick: onClickContinuePhone }, "Continue with SMS")),
1856
+ React__default.createElement(CollectInfoText, null))));
1857
+ };
1858
+
1859
+ const FemaleIcon = () => (React__default.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
1860
+ React__default.createElement("path", { d: "M9.907.476C7.828.428 5.535 2.36 4.817 4.593c-1.192 3.7.154 9.554-1.391 13.089l10.542-.056c.649-3.603.786-7.28.41-10.922-.159-1.46-.4-3.184-1.33-4.294C12.02 1.184 11.02.624 10.514.514a2.4 2.4 0 0 0-.607-.038", fill: "#262626" }),
1861
+ React__default.createElement("path", { d: "M14.224 18.144H5.532c-1.44 0-2.196-.447-1.206-1.493a7 7 0 0 1 .531-.502c.537-.457 1.743-1.437 2.57-1.921.513-.3.894-.78 1.068-1.348q.108-.418.143-.847h2.48q.035.43.143.847a2.36 2.36 0 0 0 1.066 1.348c.83.484 2.034 1.464 2.572 1.921q.28.238.532.502c.99 1.046.233 1.493-1.207 1.493", fill: "#FFB497" }),
1862
+ React__default.createElement("path", { d: "M15.841 17.15c.41.686.031 1.06-.556 1.401-.604.35-2.454 1.086-5.407 1.086S5.076 18.9 4.471 18.55c-.587-.34-.965-.715-.555-1.4q.327-.538.76-.985a9.3 9.3 0 0 1 2.64-1.846l2.59 2.726 2.573-2.707a9.3 9.3 0 0 1 2.6 1.827h.003c.287.297.542.628.759.985", fill: "#FC488D" }),
1863
+ React__default.createElement("path", { d: "M6.037 7.275a.95.95 0 0 0-.763-.012c-.442.225-.502.809-.353 1.227.19.538.782 1.076 1.414.871z", fill: "#FFB497" }),
1864
+ React__default.createElement("path", { d: "M6.334 8.688a.23.23 0 0 1-.192-.104.66.66 0 0 0-.514-.249.23.23 0 0 1-.003-.46c.023 0 .6-.005.902.457a.23.23 0 0 1-.193.356m4.929 4.192c-.519.285-1.054.501-1.384.501s-.865-.216-1.383-.501q.108-.418.143-.847h2.481q.034.43.143.847", fill: "#FF977B" }),
1865
+ React__default.createElement("path", { d: "M13.564 6.966c-.181-1.907-1.68-4.121-2.63-3.686a.18.18 0 0 1-.194-.028C9.154 1.846 9.156 6.759 6.035 7.274c.071 2.186.776 3.652 1.512 4.224.667.52 1.781 1.116 2.33 1.116s1.664-.596 2.332-1.116c.77-.6 1.577-2.186 1.355-4.532", fill: "#FCCAAF" }),
1866
+ React__default.createElement("path", { d: "M11.786 7.978a.387.387 0 1 0 0-.775.387.387 0 0 0 0 .775", fill: "#404040" }),
1867
+ React__default.createElement("path", { d: "M11.098 7.092a.85.85 0 0 1 .417-.26c.15-.04.307-.048.46-.022q.218.034.413.136.069.03.143.03l.045-.001a.157.157 0 0 1 .163.153.2.2 0 0 1-.012.065.34.34 0 0 1-.207.188.45.45 0 0 1-.323-.02 1.1 1.1 0 0 0-.287-.072.8.8 0 0 0-.268.014.5.5 0 0 0-.207.104l-.018.015a.23.23 0 0 1-.319-.33m-.157-1.074c.35-.09.711-.116 1.07-.076a2.5 2.5 0 0 1 1.012.349.179.179 0 0 1-.177.31 2.2 2.2 0 0 0-.875-.253 2.5 2.5 0 0 0-.908.113.23.23 0 0 1-.134-.44z", fill: "#262626" }),
1868
+ React__default.createElement("path", { d: "M7.971 7.978a.387.387 0 1 0 0-.775.387.387 0 0 0 0 .775", fill: "#404040" }),
1869
+ React__default.createElement("path", { d: "M8.324 7.409a.5.5 0 0 0-.207-.105.8.8 0 0 0-.268-.014 1.1 1.1 0 0 0-.288.073.45.45 0 0 1-.322.019.34.34 0 0 1-.208-.188.158.158 0 0 1 .15-.217l.047.001q.075 0 .143-.03.195-.102.412-.136c.153-.026.31-.018.46.022a.85.85 0 0 1 .416.26.23.23 0 0 1-.317.33zm.37-.948a2.5 2.5 0 0 0-.907-.113 2.2 2.2 0 0 0-.876.253.179.179 0 0 1-.176-.31h.001a2.5 2.5 0 0 1 1.013-.35c.358-.039.72-.013 1.069.077a.23.23 0 0 1-.11.447l-.01-.003z", fill: "#262626" }),
1870
+ React__default.createElement("path", { d: "M10.887 9.971a.15.15 0 0 0-.19-.094l-.012.005a.2.2 0 0 1-.118.004c-.046-.01-.108-.032-.193-.05a.6.6 0 0 0-.397.053.6.6 0 0 0-.397-.053c-.084.019-.145.041-.192.05a.2.2 0 0 1-.118-.004l-.012-.004a.15.15 0 0 0-.132.265.5.5 0 0 0 .283.082c.092 0 .165-.013.217-.012.053.001.152.115.188.145a.28.28 0 0 0 .36-.033c.02-.024.101-.111.155-.112.054 0 .126.012.218.012a.5.5 0 0 0 .282-.082.15.15 0 0 0 .058-.172", fill: "#F44D2C" }),
1871
+ React__default.createElement("path", { d: "M10.142 8.676a.23.23 0 0 0-.173.078.4.4 0 0 1-.092.015.4.4 0 0 1-.093-.015.23.23 0 0 0-.403.152c0 .32.49.324.496.324.005 0 .494-.004.494-.324a.23.23 0 0 0-.23-.23", fill: "#FF977B" }),
1872
+ React__default.createElement("path", { d: "M10.026 10.691h-.294a.23.23 0 1 0 0 .46h.294a.23.23 0 0 0 0-.46", fill: "#F44D2C" }),
1873
+ React__default.createElement("path", { d: "M11.796 18.906a.45.45 0 0 1-.402-.628c.7-1.683-.73-4.184-.36-6.07a9 9 0 0 0 1.09-.687c.771-.6 1.578-2.186 1.356-4.532-.178-1.869-1.621-4.033-2.574-3.71l-.008.001-.007-.005a.013.013 0 0 1 .001-.016c.267-.299.343-1.113-.318-1.782-.498-.505-.665-.992-.418-.979 1.971.11 4.022 2.014 4.7 4.117.79 2.454.252 5.67.611 8.706.23 1.94 1.62 5.74-3.671 5.585", fill: "#262626" })));
1874
+ const MaleIcon = () => (React__default.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
1875
+ React__default.createElement("path", { d: "M10.334 16.266c-3.177 0-3.932-2.198-3.444-2.426.155-.073.312-.14.465-.21.487-.136.801-.72.966-1.133s.213-.762.219-.997l.19.37q.102.06.21.107a3.27 3.27 0 0 0 2.789 0c.072-.031.532-.437.599-.477l-.1.498c.005.226.063.286.14.499.222.59.41.89.955 1.138q.226.1.456.205c.153.071.017 2.426-3.445 2.426", fill: "#FF977B" }),
1876
+ React__default.createElement("path", { d: "M17.623 17.018c.503.8.038 1.233-.68 1.63-.74.407-2.994 1.263-6.609 1.263s-5.869-.856-6.61-1.264c-.717-.396-1.182-.83-.68-1.63.43-.685 1.662-2.158 3.845-3.177.155-.073.312-.14.466-.21.695 1.15 2.091 1.4 2.985 1.4s2.286-.25 2.983-1.395q.225.1.456.205c2.183 1.019 3.415 2.492 3.844 3.178", fill: "#2D87F3" }),
1877
+ React__default.createElement("path", { d: "M12.852 12.533c-.72.35-1.573.539-2.447.543a5.8 5.8 0 0 1-2.458-.517c.117-.22.18-.453.188-.688l.003-.002q.143.06.296.107c.617.205 1.29.312 1.972.312a6.3 6.3 0 0 0 2.269-.419l.002.002c.007.226.066.45.175.662", fill: "#FF6F4D" }),
1878
+ React__default.createElement("path", { d: "M14.755 7.579H5.61c-.213-2.439.17-4.883 1.27-5.997a.97.97 0 0 1 .98-.242c.205.066.731.01.906-.234.14-.197.714-.443 1.08-.104a.5.5 0 0 0 .334.127h.003a.52.52 0 0 0 .335-.127c.365-.339.939-.093 1.078.104.176.245.703.3.908.234a.97.97 0 0 1 .98.242c1.1 1.114 1.482 3.558 1.27 5.997", fill: "#404040" }),
1879
+ React__default.createElement("path", { d: "M14.02 6.912a1 1 0 0 1 .728-.007c.5.203.641.795.438 1.417-.2.617-.906 1.045-1.517.826-.179-.587-.062-1.716.351-2.236M6.607 9.147c-.611.219-1.317-.208-1.517-.825-.203-.622-.063-1.214.437-1.417a1 1 0 0 1 .728.007c.612.412.71 1.838.352 2.235", fill: "#FF977B" }),
1880
+ React__default.createElement("path", { d: "M13.887 8.263a.156.156 0 0 1-.125-.25 1.05 1.05 0 0 1 .804-.417.156.156 0 1 1-.003.312h-.001a.73.73 0 0 0-.55.292.16.16 0 0 1-.125.063m-7.498-.008a.16.16 0 0 1-.125-.063.7.7 0 0 0-.545-.282.16.16 0 0 1-.16-.151.156.156 0 0 1 .15-.161 1.02 1.02 0 0 1 .805.408.156.156 0 0 1-.125.25z", fill: "#FF6F4D" }),
1881
+ React__default.createElement("path", { d: "M12.353 3.765c-.545.131-.883.448-2.2.448s-1.656-.317-2.201-.448c-1.02-.247-1.649 2.672-1.647 3.883.001.18.028.696.054 1.2l.029.493q.03.34.152.66c1.108 3.11 6.118 3.096 7.347-.04.002-.085.015-.324.032-.62l.028-.493c.026-.504.053-1.02.053-1.2.002-1.211-.625-4.13-1.647-3.883", fill: "#FFB497" }),
1882
+ React__default.createElement("path", { d: "M12.348 6.946a.359.359 0 1 0-.717 0v.14a.359.359 0 1 0 .717 0zm-4.421.141a.359.359 0 0 0 .718 0v-.14a.359.359 0 1 0-.718 0z", fill: "#595959" }),
1883
+ React__default.createElement("path", { d: "M11.344 6.96a.2.2 0 0 1-.061-.013.15.15 0 0 1-.082-.198c.081-.196.348-.278.557-.312.381-.062.889-.017 1.102.228a.156.156 0 1 1-.236.206c-.1-.116-.446-.174-.772-.132-.24.032-.35.102-.363.13a.16.16 0 0 1-.145.091", fill: "#404040" }),
1884
+ React__default.createElement("path", { d: "M10.137 8.963c-.008 0-.772-.033-.772-.373a.156.156 0 0 1 .305-.048c.147.068.306.105.467.11.163-.005.324-.042.472-.11a.156.156 0 0 1 .305.048c0 .34-.77.373-.777.373", fill: "#FF6F4D" }),
1885
+ React__default.createElement("path", { d: "M11.122 6.393a.157.157 0 0 1-.051-.304c.687-.234 1.688-.344 2.26-.03a.156.156 0 0 1-.15.274c-.463-.254-1.38-.163-2.009.052a.2.2 0 0 1-.05.008m-2.19.572a.16.16 0 0 1-.144-.097c-.013-.027-.123-.097-.363-.129-.325-.043-.672.016-.772.131a.156.156 0 1 1-.236-.205c.214-.245.721-.29 1.103-.228.209.034.475.116.556.311a.156.156 0 0 1-.144.217m.222-.571a.2.2 0 0 1-.05-.009c-.629-.215-1.546-.306-2.009-.051a.156.156 0 1 1-.15-.274c.572-.315 1.572-.206 2.26.03a.156.156 0 0 1-.05.304", fill: "#404040" }),
1886
+ React__default.createElement("path", { d: "m11.12 9.547-.019.001a8 8 0 0 1-1.928 0 .156.156 0 1 0-.037.31c.665.08 1.337.08 2.003 0a.156.156 0 0 0-.019-.31", fill: "#D84023" })));
1887
+
1888
+ // always has name, gender dob
1889
+ const OtherSetup = ({ form, needPhone, needEmail, isEmailDisable, }) => {
1890
+ const { locale = 'vi-VN' } = useSSOState();
1891
+ return (React__default.createElement(Stack, { spacing: 12 },
1892
+ needPhone && (React__default.createElement(React__default.Fragment, null,
1893
+ React__default.createElement(Input.Wrapper, Object.assign({ label: "S\u1ED1 \u0111i\u1EC7n tho\u1EA1i", withAsterisk: true }, form.getInputProps('phone')),
1894
+ React__default.createElement(StyledPhone, { defaultCountry: (locale ? MAPPED_LOCALE[locale] || 'VN' : 'VN'), value: form.getInputProps('phone').value, onChange: (value) => {
1895
+ form.setFieldValue('phone', value);
1896
+ }, isError: !!form.getInputProps('phone').error, required: true, name: "phone" })),
1897
+ React__default.createElement(Group, { spacing: 24 },
1898
+ React__default.createElement(Text, { size: "p4" }, "Nh\u1EADn OTP qua"),
1899
+ React__default.createElement(Radio.Group, Object.assign({ name: "otpMethod", styles: {
1900
+ root: {
1901
+ display: 'flex',
1902
+ flexDirection: 'row',
1903
+ flexWrap: 'wrap',
1904
+ gap: 24,
1905
+ },
1906
+ } }, form.getInputProps('otpMethod')),
1907
+ React__default.createElement(Radio, { value: "zalo", label: "Zalo", styles: {
1908
+ label: {
1909
+ paddingLeft: 8,
1910
+ },
1911
+ } }),
1912
+ React__default.createElement(Radio, { value: "sms", label: "SMS", styles: {
1913
+ label: {
1914
+ paddingLeft: 8,
1915
+ },
1916
+ } }))))),
1917
+ needEmail && (React__default.createElement(Input, Object.assign({ name: "email", type: "email", label: "Email", disabled: isEmailDisable }, form.getInputProps('email')))),
1918
+ React__default.createElement(Input, Object.assign({ name: "name", label: "Name", withAsterisk: true, required: true, placeholder: "Enter your name" }, form.getInputProps('name'))),
1919
+ React__default.createElement(Input.Wrapper, Object.assign({ label: "Gender", withAsterisk: true }, form.getInputProps('gender')),
1920
+ React__default.createElement(Group, null,
1921
+ React__default.createElement(Button, { type: "button", styles: {
1922
+ root: {
1923
+ flex: 1,
1924
+ },
1925
+ leftIcon: {
1926
+ marginRight: 8,
1927
+ },
1928
+ inner: {
1929
+ justifyContent: 'start',
1930
+ },
1931
+ }, variant: form.getInputProps('gender').value === 'female'
1932
+ ? 'secondary'
1933
+ : 'tertiary', onClick: () => {
1934
+ form.setFieldValue('gender', 'female');
1935
+ }, leftIcon: React__default.createElement(FemaleIcon, null) }, "Female"),
1936
+ React__default.createElement(Button, { type: "button", styles: {
1937
+ root: {
1938
+ flex: 1,
1939
+ },
1940
+ leftIcon: {
1941
+ marginRight: 8,
1942
+ },
1943
+ inner: {
1944
+ justifyContent: 'start',
1945
+ },
1946
+ }, variant: form.getInputProps('gender').value === 'male'
1947
+ ? 'secondary'
1948
+ : 'tertiary', onClick: () => {
1949
+ form.setFieldValue('gender', 'male');
1950
+ }, leftIcon: React__default.createElement(MaleIcon, null) }, "Male"))),
1951
+ React__default.createElement(DatePicker, Object.assign({ name: "dob", label: "Birthday", withAsterisk: true, required: true, placeholder: "Enter your birthday" }, form.getInputProps('dob')))));
1952
+ };
1953
+
1954
+ const SSOSetupScreen = ({ hidden, index, }) => {
1955
+ const { onClose, source } = useSSOState();
1956
+ const { goNext, steps, addStep, shareData } = useSSOSteps();
1957
+ const [errMsg, setErrMsg] = React__default.useState('');
1958
+ const currentStep = steps[index];
1959
+ const config = currentStep === null || currentStep === void 0 ? void 0 : currentStep.config;
1960
+ const userInfo = config === null || config === void 0 ? void 0 : config.userInfo;
1961
+ const needPass = !(userInfo === null || userInfo === void 0 ? void 0 : userInfo.is_pass);
1962
+ const needPhone = !(userInfo === null || userInfo === void 0 ? void 0 : userInfo.phone_verified_at);
1963
+ // const isNew = !!userInfo?.is_new
1964
+ const authMethod = shareData === null || shareData === void 0 ? void 0 : shareData.authMethod;
1965
+ const authFlow = shareData === null || shareData === void 0 ? void 0 : shareData.authFlow;
1966
+ const isEmailDisable = authMethod === 'google' || authMethod === 'mail';
1967
+ const needEmail = authFlow !== 'verify-phone';
1968
+ const form = useForm({
1969
+ initialValues: Object.assign(Object.assign({}, (needPhone
1970
+ ? {
1971
+ otpMethod: 'zalo',
1972
+ }
1973
+ : {})), { dob: (userInfo === null || userInfo === void 0 ? void 0 : userInfo.birthday) ? new Date(userInfo.birthday) : undefined, name: (userInfo === null || userInfo === void 0 ? void 0 : userInfo.name) || undefined, email: isEmailDisable ? (userInfo === null || userInfo === void 0 ? void 0 : userInfo.email) || undefined : undefined }),
1974
+ validateInputOnBlur: true,
1975
+ validate: yupResolver(yup.object().shape(Object.assign(Object.assign(Object.assign(Object.assign({}, (needPass
1976
+ ? {
1977
+ password: yup
1978
+ .string()
1979
+ .required('Password is required')
1980
+ .min(8, ' ')
1981
+ .max(50, ' ')
1982
+ .matches(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)/, ' '),
1983
+ confirmPassword: yup
1984
+ .string()
1985
+ .required('Confirm password is required')
1986
+ .test('passwords-match', 'Passwords must match', function (value) {
1987
+ return this.parent.password === value;
1988
+ }),
1989
+ }
1990
+ : {})), (needPhone
1991
+ ? {
1992
+ phone: yup.string().required('Phone number is required'),
1993
+ otpMethod: yup
1994
+ .string()
1995
+ .required('OTP method is required')
1996
+ .oneOf(['zalo', 'sms']),
1997
+ }
1998
+ : {})), (needEmail
1999
+ ? {
2000
+ email: yup.string().email('Invalid email'),
2001
+ }
2002
+ : {})), { gender: yup
2003
+ .string()
2004
+ .required('Gender is required')
2005
+ .oneOf(['male', 'female']), dob: yup.date().required('Date of birth is required'), name: yup.string().required('Name is required') }))),
2006
+ });
2007
+ const onSubmit = (values) => __awaiter(void 0, void 0, void 0, function* () {
2008
+ var _a, _b, _c, _d;
2009
+ const { password, confirmPassword, phone, gender, name, dob, otpMethod } = values;
2010
+ const { phoneNumber, areaCode } = splitPhone(phone || '');
2011
+ // validate only, delay set data to after otp
2012
+ const res = yield updateUserInfo({
2013
+ name,
2014
+ birthday: dayjs(dob).format('YYYY-MM-DD'),
2015
+ email: values.email,
2016
+ password,
2017
+ confirm_password: confirmPassword,
2018
+ phone_number: phoneNumber,
2019
+ area_code: areaCode,
2020
+ gender: gender === 'male' ? 1 : 0,
2021
+ source,
2022
+ validate: 'true',
2023
+ });
2024
+ if ((res === null || res === void 0 ? void 0 : res._status) === 1) {
2025
+ // if need phone and has phone then start phone verify step, close after done
2026
+ if (needPhone && phone) {
2027
+ const setupData = {
2028
+ name,
2029
+ birthday: dayjs(dob).format('YYYY-MM-DD'),
2030
+ email: values.email,
2031
+ password,
2032
+ confirm_password: confirmPassword,
2033
+ phone_number: phoneNumber,
2034
+ area_code: areaCode,
2035
+ gender: gender === 'male' ? 1 : 0,
2036
+ source,
2037
+ };
2038
+ if (otpMethod === 'zalo') {
2039
+ const res = yield resendUpdatePhoneZaloOTP(phoneNumber, areaCode);
2040
+ if ((res === null || res === void 0 ? void 0 : res._status) !== 1) {
2041
+ setErrMsg(((_a = res === null || res === void 0 ? void 0 : res._messages) === null || _a === void 0 ? void 0 : _a[0]) || 'API error');
2042
+ return;
2043
+ }
2044
+ addStep({
2045
+ type: SSOStepTypeType.OTP,
2046
+ config: {
2047
+ phone,
2048
+ otpType: 'phone-zalo',
2049
+ isUpdatePhone: true,
2050
+ afterAction: 'submitSetup',
2051
+ setupData,
2052
+ },
2053
+ });
2054
+ goNext();
2055
+ }
2056
+ else {
2057
+ const res = yield resendUpdatePhoneOTP(phoneNumber, areaCode);
2058
+ if ((res === null || res === void 0 ? void 0 : res._status) !== 1) {
2059
+ setErrMsg(((_b = res === null || res === void 0 ? void 0 : res._messages) === null || _b === void 0 ? void 0 : _b[0]) || 'API error');
2060
+ return;
2061
+ }
2062
+ addStep({
2063
+ type: SSOStepTypeType.OTP,
2064
+ config: {
2065
+ phone,
2066
+ otpType: 'phone-sms',
2067
+ isUpdatePhone: true,
2068
+ afterAction: 'submitSetup',
2069
+ setupData,
2070
+ },
2071
+ });
2072
+ goNext();
2073
+ }
2074
+ }
2075
+ else {
2076
+ // close?
2077
+ const res = yield updateUserInfo({
2078
+ name,
2079
+ birthday: dayjs(dob).format('YYYY-MM-DD'),
2080
+ email: values.email,
2081
+ password,
2082
+ confirm_password: confirmPassword,
2083
+ phone_number: phoneNumber,
2084
+ area_code: areaCode,
2085
+ gender: gender === 'male' ? 1 : 0,
2086
+ source,
2087
+ validate: '',
2088
+ });
2089
+ if ((res === null || res === void 0 ? void 0 : res._status) === 1) {
2090
+ handleAuthSuccess(res === null || res === void 0 ? void 0 : res._data);
2091
+ onClose === null || onClose === void 0 ? void 0 : onClose();
2092
+ }
2093
+ else {
2094
+ setErrMsg(((_c = res._messages) === null || _c === void 0 ? void 0 : _c[0]) || 'API error');
2095
+ return;
2096
+ }
2097
+ }
2098
+ }
2099
+ else {
2100
+ // toast error message
2101
+ setErrMsg(((_d = res._messages) === null || _d === void 0 ? void 0 : _d[0]) || 'API error');
2102
+ }
2103
+ });
2104
+ return (React__default.createElement("form", { style: {
2105
+ display: hidden ? 'none' : 'block',
2106
+ }, onSubmit: form.onSubmit(onSubmit) },
2107
+ React__default.createElement(Stack, { spacing: 24 },
2108
+ React__default.createElement(Stack, { spacing: 8 },
2109
+ React__default.createElement(Text, { size: "s1", weight: "semiBold" }, "Almost done!"),
2110
+ React__default.createElement(Text, { size: "p4" }, "Please provide additional information to complete the account registration process.")),
2111
+ needPass && React__default.createElement(SSOPasswordWithConfirm, { form: form }),
2112
+ React__default.createElement(OtherSetup, { needPhone: needPhone, needEmail: needEmail, isEmailDisable: isEmailDisable, form: form }),
2113
+ React__default.createElement(CollectInfoText, null),
2114
+ errMsg && (React__default.createElement(Text, { color: "red.6", size: "p4" }, errMsg)),
2115
+ React__default.createElement(Button, { type: "submit", variant: "primary", fullWidth: true }, needPhone ? 'Verify Phone Number' : 'Save'))));
2116
+ };
2117
+
2118
+ const SSOScreenRenderer = () => {
2119
+ const { steps, currentStepIndex } = useSSOSteps();
2120
+ return (React__default.createElement(React__default.Fragment, null, steps.map((step, index) => {
2121
+ const isCurrentStep = index === currentStepIndex;
2122
+ switch (step.type) {
2123
+ case SSOStepTypeType.FIRST:
2124
+ return React__default.createElement(SSOFirstScreen, { key: index, hidden: !isCurrentStep });
2125
+ case SSOStepTypeType.PASSWORD:
2126
+ return (React__default.createElement(SSOPasswordScreen, { key: index, hidden: !isCurrentStep, index: index }));
2127
+ case SSOStepTypeType.FORGOT_PASSWORD_PHONE:
2128
+ return (React__default.createElement(SSOPasswordForgotPhone, { key: index, hidden: !isCurrentStep, index: index }));
2129
+ case SSOStepTypeType.FORGOT_PASSWORD_SETUP:
2130
+ return (React__default.createElement(SSOPasswordForgotSetup, { key: index, hidden: !isCurrentStep }));
2131
+ case SSOStepTypeType.OTP:
2132
+ return (React__default.createElement(SSOOTPScreen, { key: index, hidden: !isCurrentStep, index: index }));
2133
+ case SSOStepTypeType.EMAIL:
2134
+ return (React__default.createElement(SSOEmailScreen, { key: index, hidden: !isCurrentStep, index: index }));
2135
+ case SSOStepTypeType.SETUP_FULL:
2136
+ return (React__default.createElement(SSOSetupScreen, { key: index, hidden: !isCurrentStep, index: index }));
2137
+ case SSOStepTypeType.VERIFY_PHONE:
2138
+ return (React__default.createElement(SSOPhoneVerify, { key: index, hidden: !isCurrentStep, index: index }));
2139
+ default:
2140
+ return React__default.createElement("div", { key: index }, "Not found");
2141
+ }
2142
+ })));
2143
+ };
2144
+
2145
+ const SSOV2 = ({ onClose: onCloseProps, locale, source = 'default', defaultSteps, }) => {
2146
+ const { isOpen, setOpen, returnUrl } = useSSOV2Store();
2147
+ if (!isOpen) {
2148
+ return null;
2149
+ }
2150
+ const onClose = (success) => {
2151
+ if (success && returnUrl) {
2152
+ window.location.href = returnUrl;
2153
+ return;
2154
+ }
2155
+ setOpen(false);
2156
+ onCloseProps === null || onCloseProps === void 0 ? void 0 : onCloseProps();
2157
+ };
2158
+ return createPortal(React__default.createElement(SSOStateProvider, { onClose: onClose, locale: locale, source: source },
2159
+ React__default.createElement(SSOStepsProvider, { defaultSteps: defaultSteps },
2160
+ React__default.createElement(SSOPopupWrapper, { opened: true, onClose: onClose },
2161
+ React__default.createElement(SSOScreenRenderer, null)))), getPopupWrapperDom());
2162
+ };
2163
+
2164
+ export { SSOV2 };