@pisell/private-materials 6.3.30 → 6.3.32

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 (287) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +9 -1
  6. package/build/lowcode/preview.js +146 -146
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +9 -9
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +9 -9
  11. package/es/components/appointmentBooking/components/Cart/Item/index.d.ts +1 -1
  12. package/es/components/appointmentBooking/components/Cart/Item/index.js +3 -2
  13. package/es/components/appointmentBooking/components/ConfirmInformation/index.js +267 -76
  14. package/es/components/appointmentBooking/components/ConfirmInformation/index.less +15 -0
  15. package/es/components/appointmentBooking/hooks.d.ts +1 -0
  16. package/es/components/appointmentBooking/hooks.js +30 -30
  17. package/es/components/appointmentBooking/locales.d.ts +3 -0
  18. package/es/components/appointmentBooking/locales.js +9 -6
  19. package/es/components/booking/addons/model.d.ts +10 -1
  20. package/es/components/booking/components/footer/index.js +4 -1
  21. package/es/components/booking/components/footer/utils.js +62 -46
  22. package/es/components/booking/forms/model.d.ts +10 -1
  23. package/es/components/booking/info/clientVariant/hooks/useClientFn.js +2 -2
  24. package/es/components/booking/info/clientVariant/vertical/index.js +1 -1
  25. package/es/components/booking/info/main.js +3 -2
  26. package/es/components/booking/info/model.d.ts +10 -1
  27. package/es/components/booking/info/model.js +5 -0
  28. package/es/components/booking/info/service/addService/utils.d.ts +1 -1
  29. package/es/components/booking/info2/index.js +3 -2
  30. package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
  31. package/es/components/booking/info2/service/contactInfoMode/index.d.ts +2 -0
  32. package/es/components/booking/info2/service/contactInfoMode/index.js +94 -0
  33. package/es/components/booking/locales.d.ts +3 -0
  34. package/es/components/booking/locales.js +9 -3
  35. package/es/components/booking/model.d.ts +13 -1
  36. package/es/components/booking/model.js +3 -0
  37. package/es/components/booking/notes/model.d.ts +10 -1
  38. package/es/components/booking/payments/model.d.ts +10 -1
  39. package/es/components/eftposPay/amount.d.ts +1 -1
  40. package/es/components/eftposPay/device.d.ts +1 -1
  41. package/es/components/eftposPay/store/index.d.ts +2 -2
  42. package/es/components/pay/toC/model.d.ts +9 -1
  43. package/es/components/schedules/model.d.ts +9 -1
  44. package/es/components/ticketBooking/components/ticketBooking/index.less +2 -1
  45. package/es/components/wallet/Detail/model.d.ts +13 -1
  46. package/es/components/wallet/DiscountCard/model.d.ts +14 -1
  47. package/es/components/wallet/PointCard/model.d.ts +13 -1
  48. package/es/components/wallet/RechargeableCard/model.d.ts +29 -1
  49. package/es/components/wallet/Voucher/model.d.ts +13 -1
  50. package/es/components/wallet/model.d.ts +9 -1
  51. package/es/index.d.ts +3 -0
  52. package/es/index.js +4 -1
  53. package/es/plus/clientName/index.d.ts +4 -0
  54. package/es/plus/clientName/index.js +18 -0
  55. package/es/plus/clientName/index.less +10 -0
  56. package/es/plus/clientName/type.d.ts +13 -0
  57. package/es/plus/clientName/type.js +1 -0
  58. package/es/plus/clientName/utils.d.ts +2 -0
  59. package/es/plus/clientName/utils.js +18 -0
  60. package/es/plus/contactInfo/components/Avatar/index.d.ts +10 -0
  61. package/es/plus/contactInfo/components/Avatar/index.js +30 -0
  62. package/es/plus/contactInfo/components/SwipeAction/index.d.ts +46 -0
  63. package/es/plus/contactInfo/components/SwipeAction/index.js +360 -0
  64. package/es/plus/contactInfo/components/SwipeAction/index.less +74 -0
  65. package/es/plus/contactInfo/index.d.ts +6 -0
  66. package/es/plus/contactInfo/index.js +198 -0
  67. package/es/plus/contactInfo/index.less +621 -0
  68. package/es/plus/contactInfo/locales.d.ts +15 -0
  69. package/es/plus/contactInfo/locales.js +14 -0
  70. package/es/plus/contactInfo/types.d.ts +91 -0
  71. package/es/plus/contactInfo/types.js +1 -0
  72. package/es/plus/contactInfo/utils.d.ts +7 -0
  73. package/es/plus/contactInfo/utils.js +50 -0
  74. package/es/plus/contactInfoModal/ContactInfoContent.d.ts +3 -0
  75. package/es/plus/contactInfoModal/ContactInfoContent.js +74 -0
  76. package/es/plus/contactInfoModal/index.d.ts +40 -0
  77. package/es/plus/contactInfoModal/index.js +154 -0
  78. package/es/plus/contactInfoModal/index.less +19 -0
  79. package/es/plus/contactInfoModal/locales.d.ts +66 -0
  80. package/es/plus/contactInfoModal/locales.js +65 -0
  81. package/es/pro/Login2.0/AuthModal.d.ts +143 -0
  82. package/es/pro/Login2.0/AuthModal.js +624 -0
  83. package/es/pro/Login2.0/Login2.d.ts +61 -0
  84. package/es/pro/Login2.0/Login2.js +2157 -0
  85. package/es/pro/Login2.0/Register2.d.ts +65 -0
  86. package/es/pro/Login2.0/Register2.js +1501 -0
  87. package/es/pro/Login2.0/components/ForgotPasswordFlow.d.ts +31 -0
  88. package/es/pro/Login2.0/components/ForgotPasswordFlow.js +330 -0
  89. package/es/pro/Login2.0/components/LegalTerms.d.ts +8 -0
  90. package/es/pro/Login2.0/components/LegalTerms.js +51 -0
  91. package/es/pro/Login2.0/components/LegalTerms.less +74 -0
  92. package/es/pro/Login2.0/components/LoginCodeInput.d.ts +27 -0
  93. package/es/pro/Login2.0/components/LoginCodeInput.js +207 -0
  94. package/es/pro/Login2.0/components/OAuthButtonGroup.d.ts +22 -0
  95. package/es/pro/Login2.0/components/OAuthButtonGroup.js +55 -0
  96. package/es/pro/Login2.0/components/PhoneInput.d.ts +53 -0
  97. package/es/pro/Login2.0/components/PhoneInput.js +414 -0
  98. package/es/pro/Login2.0/components/PhoneInput.less +148 -0
  99. package/es/pro/Login2.0/components/phoneValidation.d.ts +17 -0
  100. package/es/pro/Login2.0/components/phoneValidation.js +228 -0
  101. package/es/pro/Login2.0/hooks/index.d.ts +2 -0
  102. package/es/pro/Login2.0/hooks/index.js +1 -0
  103. package/es/pro/Login2.0/hooks/usePasswordValidationRules.d.ts +24 -0
  104. package/es/pro/Login2.0/hooks/usePasswordValidationRules.js +87 -0
  105. package/es/pro/Login2.0/hooks/useRegisterFlow.d.ts +39 -0
  106. package/es/pro/Login2.0/hooks/useRegisterFlow.js +158 -0
  107. package/es/pro/Login2.0/hooks/useRegistrationMethods.d.ts +9 -0
  108. package/es/pro/Login2.0/hooks/useRegistrationMethods.js +31 -0
  109. package/es/pro/Login2.0/index.js +8 -0
  110. package/es/pro/Login2.0/index.less +993 -0
  111. package/es/pro/Login2.0/locales.d.ts +543 -0
  112. package/es/pro/Login2.0/locales.js +622 -0
  113. package/es/pro/Login2.0/shared/Header.d.ts +11 -0
  114. package/es/pro/Login2.0/shared/Header.js +42 -0
  115. package/es/pro/Login2.0/shared/OAuthButtons.d.ts +11 -0
  116. package/es/pro/Login2.0/shared/OAuthButtons.js +59 -0
  117. package/es/pro/Login2.0/shared/registerFlow.d.ts +116 -0
  118. package/es/pro/Login2.0/shared/registerFlow.js +171 -0
  119. package/es/pro/Login2.0/shared/types.d.ts +232 -0
  120. package/es/pro/Login2.0/shared/types.js +1 -0
  121. package/es/pro/Login2.0/steps/CodeInput.d.ts +24 -0
  122. package/es/pro/Login2.0/steps/CodeInput.js +209 -0
  123. package/es/pro/Login2.0/steps/EmailAlreadyRegistered.d.ts +12 -0
  124. package/es/pro/Login2.0/steps/EmailAlreadyRegistered.js +35 -0
  125. package/es/pro/Login2.0/steps/EmailLinkAlreadyUsed.d.ts +7 -0
  126. package/es/pro/Login2.0/steps/EmailLinkAlreadyUsed.js +25 -0
  127. package/es/pro/Login2.0/steps/EmailLinkExpired.d.ts +9 -0
  128. package/es/pro/Login2.0/steps/EmailLinkExpired.js +33 -0
  129. package/es/pro/Login2.0/steps/SetPassword.d.ts +19 -0
  130. package/es/pro/Login2.0/steps/SetPassword.js +148 -0
  131. package/es/pro/Login2.0/steps/VerificationSuccess.d.ts +8 -0
  132. package/es/pro/Login2.0/steps/VerificationSuccess.js +35 -0
  133. package/es/pro/Login2.0/steps/VerifyingEmailLink.d.ts +7 -0
  134. package/es/pro/Login2.0/steps/VerifyingEmailLink.js +17 -0
  135. package/es/pro/Login2.0/steps/WaitEmailLink.d.ts +18 -0
  136. package/es/pro/Login2.0/steps/WaitEmailLink.js +54 -0
  137. package/es/pro/Login2.0/steps/index.d.ts +19 -0
  138. package/es/pro/Login2.0/steps/index.js +11 -0
  139. package/es/pro/Login2.0/steps/steps.less +423 -0
  140. package/es/pro/Login2.0/types.d.ts +167 -0
  141. package/es/pro/Login2.0/types.js +1 -0
  142. package/lib/components/appointmentBooking/components/Cart/Item/index.d.ts +1 -1
  143. package/lib/components/appointmentBooking/components/Cart/Item/index.js +5 -3
  144. package/lib/components/appointmentBooking/components/ConfirmInformation/index.js +151 -13
  145. package/lib/components/appointmentBooking/components/ConfirmInformation/index.less +15 -0
  146. package/lib/components/appointmentBooking/hooks.d.ts +1 -0
  147. package/lib/components/appointmentBooking/hooks.js +73 -35
  148. package/lib/components/appointmentBooking/locales.d.ts +3 -0
  149. package/lib/components/appointmentBooking/locales.js +6 -3
  150. package/lib/components/booking/addons/model.d.ts +10 -1
  151. package/lib/components/booking/components/footer/index.js +4 -1
  152. package/lib/components/booking/components/footer/utils.js +70 -38
  153. package/lib/components/booking/forms/model.d.ts +10 -1
  154. package/lib/components/booking/info/clientVariant/hooks/useClientFn.js +1 -1
  155. package/lib/components/booking/info/clientVariant/vertical/index.js +34 -17
  156. package/lib/components/booking/info/main.js +5 -4
  157. package/lib/components/booking/info/model.d.ts +10 -1
  158. package/lib/components/booking/info/model.js +5 -0
  159. package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
  160. package/lib/components/booking/info2/index.js +5 -4
  161. package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
  162. package/lib/components/booking/info2/service/contactInfoMode/index.d.ts +2 -0
  163. package/lib/components/booking/info2/service/contactInfoMode/index.js +111 -0
  164. package/lib/components/booking/locales.d.ts +3 -0
  165. package/lib/components/booking/locales.js +9 -3
  166. package/lib/components/booking/model.d.ts +13 -1
  167. package/lib/components/booking/model.js +3 -0
  168. package/lib/components/booking/notes/model.d.ts +10 -1
  169. package/lib/components/booking/payments/model.d.ts +10 -1
  170. package/lib/components/eftposPay/amount.d.ts +1 -1
  171. package/lib/components/eftposPay/device.d.ts +1 -1
  172. package/lib/components/eftposPay/store/index.d.ts +2 -2
  173. package/lib/components/pay/toC/model.d.ts +9 -1
  174. package/lib/components/schedules/model.d.ts +9 -1
  175. package/lib/components/ticketBooking/components/ticketBooking/index.less +2 -1
  176. package/lib/components/wallet/Detail/model.d.ts +13 -1
  177. package/lib/components/wallet/DiscountCard/model.d.ts +14 -1
  178. package/lib/components/wallet/PointCard/model.d.ts +13 -1
  179. package/lib/components/wallet/RechargeableCard/model.d.ts +29 -1
  180. package/lib/components/wallet/Voucher/model.d.ts +13 -1
  181. package/lib/components/wallet/model.d.ts +9 -1
  182. package/lib/index.d.ts +3 -0
  183. package/lib/index.js +13 -0
  184. package/lib/plus/clientName/index.d.ts +4 -0
  185. package/lib/plus/clientName/index.js +53 -0
  186. package/lib/plus/clientName/index.less +10 -0
  187. package/lib/plus/clientName/type.d.ts +13 -0
  188. package/lib/plus/clientName/type.js +17 -0
  189. package/lib/plus/clientName/utils.d.ts +2 -0
  190. package/lib/plus/clientName/utils.js +43 -0
  191. package/lib/plus/contactInfo/components/Avatar/index.d.ts +10 -0
  192. package/lib/plus/contactInfo/components/Avatar/index.js +56 -0
  193. package/lib/plus/contactInfo/components/SwipeAction/index.d.ts +46 -0
  194. package/lib/plus/contactInfo/components/SwipeAction/index.js +373 -0
  195. package/lib/plus/contactInfo/components/SwipeAction/index.less +74 -0
  196. package/lib/plus/contactInfo/index.d.ts +6 -0
  197. package/lib/plus/contactInfo/index.js +226 -0
  198. package/lib/plus/contactInfo/index.less +621 -0
  199. package/lib/plus/contactInfo/locales.d.ts +15 -0
  200. package/lib/plus/contactInfo/locales.js +38 -0
  201. package/lib/plus/contactInfo/types.d.ts +91 -0
  202. package/lib/plus/contactInfo/types.js +17 -0
  203. package/lib/plus/contactInfo/utils.d.ts +7 -0
  204. package/lib/plus/contactInfo/utils.js +64 -0
  205. package/lib/plus/contactInfoModal/ContactInfoContent.d.ts +3 -0
  206. package/lib/plus/contactInfoModal/ContactInfoContent.js +129 -0
  207. package/lib/plus/contactInfoModal/index.d.ts +40 -0
  208. package/lib/plus/contactInfoModal/index.js +138 -0
  209. package/lib/plus/contactInfoModal/index.less +19 -0
  210. package/lib/plus/contactInfoModal/locales.d.ts +66 -0
  211. package/lib/plus/contactInfoModal/locales.js +89 -0
  212. package/lib/pro/Login2.0/AuthModal.d.ts +143 -0
  213. package/lib/pro/Login2.0/AuthModal.js +498 -0
  214. package/lib/pro/Login2.0/Login2.d.ts +61 -0
  215. package/lib/pro/Login2.0/Login2.js +1468 -0
  216. package/lib/pro/Login2.0/Register2.d.ts +65 -0
  217. package/lib/pro/Login2.0/Register2.js +1062 -0
  218. package/lib/pro/Login2.0/components/ForgotPasswordFlow.d.ts +31 -0
  219. package/lib/pro/Login2.0/components/ForgotPasswordFlow.js +213 -0
  220. package/lib/pro/Login2.0/components/LegalTerms.d.ts +8 -0
  221. package/lib/pro/Login2.0/components/LegalTerms.js +76 -0
  222. package/lib/pro/Login2.0/components/LegalTerms.less +74 -0
  223. package/lib/pro/Login2.0/components/LoginCodeInput.d.ts +27 -0
  224. package/lib/pro/Login2.0/components/LoginCodeInput.js +161 -0
  225. package/lib/pro/Login2.0/components/OAuthButtonGroup.d.ts +22 -0
  226. package/lib/pro/Login2.0/components/OAuthButtonGroup.js +87 -0
  227. package/lib/pro/Login2.0/components/PhoneInput.d.ts +53 -0
  228. package/lib/pro/Login2.0/components/PhoneInput.js +263 -0
  229. package/lib/pro/Login2.0/components/PhoneInput.less +148 -0
  230. package/lib/pro/Login2.0/components/phoneValidation.d.ts +17 -0
  231. package/lib/pro/Login2.0/components/phoneValidation.js +153 -0
  232. package/lib/pro/Login2.0/hooks/index.d.ts +2 -0
  233. package/lib/pro/Login2.0/hooks/index.js +29 -0
  234. package/lib/pro/Login2.0/hooks/usePasswordValidationRules.d.ts +24 -0
  235. package/lib/pro/Login2.0/hooks/usePasswordValidationRules.js +140 -0
  236. package/lib/pro/Login2.0/hooks/useRegisterFlow.d.ts +39 -0
  237. package/lib/pro/Login2.0/hooks/useRegisterFlow.js +149 -0
  238. package/lib/pro/Login2.0/hooks/useRegistrationMethods.d.ts +9 -0
  239. package/lib/pro/Login2.0/hooks/useRegistrationMethods.js +51 -0
  240. package/lib/pro/Login2.0/index.js +45 -0
  241. package/lib/pro/Login2.0/index.less +993 -0
  242. package/lib/pro/Login2.0/locales.d.ts +543 -0
  243. package/lib/pro/Login2.0/locales.js +646 -0
  244. package/lib/pro/Login2.0/shared/Header.d.ts +11 -0
  245. package/lib/pro/Login2.0/shared/Header.js +81 -0
  246. package/lib/pro/Login2.0/shared/OAuthButtons.d.ts +11 -0
  247. package/lib/pro/Login2.0/shared/OAuthButtons.js +78 -0
  248. package/lib/pro/Login2.0/shared/registerFlow.d.ts +116 -0
  249. package/lib/pro/Login2.0/shared/registerFlow.js +235 -0
  250. package/lib/pro/Login2.0/shared/types.d.ts +232 -0
  251. package/lib/pro/Login2.0/shared/types.js +17 -0
  252. package/lib/pro/Login2.0/steps/CodeInput.d.ts +24 -0
  253. package/lib/pro/Login2.0/steps/CodeInput.js +160 -0
  254. package/lib/pro/Login2.0/steps/EmailAlreadyRegistered.d.ts +12 -0
  255. package/lib/pro/Login2.0/steps/EmailAlreadyRegistered.js +46 -0
  256. package/lib/pro/Login2.0/steps/EmailLinkAlreadyUsed.d.ts +7 -0
  257. package/lib/pro/Login2.0/steps/EmailLinkAlreadyUsed.js +51 -0
  258. package/lib/pro/Login2.0/steps/EmailLinkExpired.d.ts +9 -0
  259. package/lib/pro/Login2.0/steps/EmailLinkExpired.js +51 -0
  260. package/lib/pro/Login2.0/steps/SetPassword.d.ts +19 -0
  261. package/lib/pro/Login2.0/steps/SetPassword.js +131 -0
  262. package/lib/pro/Login2.0/steps/VerificationSuccess.d.ts +8 -0
  263. package/lib/pro/Login2.0/steps/VerificationSuccess.js +49 -0
  264. package/lib/pro/Login2.0/steps/VerifyingEmailLink.d.ts +7 -0
  265. package/lib/pro/Login2.0/steps/VerifyingEmailLink.js +41 -0
  266. package/lib/pro/Login2.0/steps/WaitEmailLink.d.ts +18 -0
  267. package/lib/pro/Login2.0/steps/WaitEmailLink.js +67 -0
  268. package/lib/pro/Login2.0/steps/index.d.ts +19 -0
  269. package/lib/pro/Login2.0/steps/index.js +60 -0
  270. package/lib/pro/Login2.0/steps/steps.less +423 -0
  271. package/lib/pro/Login2.0/types.d.ts +167 -0
  272. package/lib/pro/Login2.0/types.js +17 -0
  273. package/lowcode/authmodal/meta.ts +395 -0
  274. package/lowcode/contact-info/fragments/cardStyle.ts +68 -0
  275. package/lowcode/contact-info/fragments/nameStyle.ts +33 -0
  276. package/lowcode/contact-info/fragments/pisellAvatar.ts +103 -0
  277. package/lowcode/contact-info/fragments/textStyle.ts +33 -0
  278. package/lowcode/contact-info/meta.ts +199 -0
  279. package/lowcode/contact-info-modal/meta.ts +98 -0
  280. package/lowcode/login2/CONFIG.md +447 -0
  281. package/lowcode/login2/TEST_CONFIG.md +324 -0
  282. package/lowcode/login2/VERIFICATION_METHODS.md +364 -0
  283. package/lowcode/login2/meta.ts +560 -0
  284. package/lowcode/login2/snippets.ts +124 -0
  285. package/lowcode/register2/meta.ts +562 -0
  286. package/lowcode/register2/snippets.ts +257 -0
  287. package/package.json +7 -5
@@ -0,0 +1,1501 @@
1
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
5
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
6
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
7
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
8
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
9
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
10
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
11
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
12
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
13
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
14
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
15
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
+ import React, { useState, useEffect, useMemo, useCallback } from 'react';
17
+ import { Form, message } from 'antd';
18
+ import { Input, Button } from '@pisell/materials';
19
+ import { useDebounceFn } from 'ahooks';
20
+ import classNames from 'classnames';
21
+ import { locales } from '@pisell/utils';
22
+ import localeTexts from "./locales";
23
+ import Header from "./shared/Header";
24
+ import PhoneInput from "./components/PhoneInput";
25
+ import { createPhoneValidationRules } from "./components/phoneValidation";
26
+ import LegalTerms from "./components/LegalTerms";
27
+ import "./index.less";
28
+ import { usePisellOS } from "../../hooks/useEngineContext";
29
+ import useEngineContext from "../../hooks/useEngineContext";
30
+ import { useRegisterFlow } from "./hooks/useRegisterFlow";
31
+ import { useRegistrationMethods } from "./hooks/useRegistrationMethods";
32
+ import { RegisterStep, VerificationMethod } from "./shared/registerFlow";
33
+ import { WaitEmailLink, EmailAlreadyRegistered, CodeInput, VerificationSuccess, SetPassword, VerifyingEmailLink, EmailLinkExpired, EmailLinkAlreadyUsed } from "./steps";
34
+ import "./steps/steps.less";
35
+ import { Iconfont } from '@pisell/materials';
36
+ import usePasswordValidationRules from "./hooks/usePasswordValidationRules";
37
+ import OAuthButtonGroup from "./components/OAuthButtonGroup";
38
+
39
+ /** 注册组件配置 */
40
+
41
+ /** 注册组件事件 */
42
+
43
+ /** 注册组件属性 */
44
+
45
+ /**
46
+ * 注册 2.0 组件
47
+ * 支持邮箱、手机、三方注册
48
+ * 组件宽度固定 360px
49
+ */
50
+ var Register2 = function Register2(_ref) {
51
+ var _context$appHelper, _utils$getStore, _utils$getStore$getSt, _config$ui, _config$emailLinkVeri3, _config$ui4, _config$ui5, _config$ui6, _config$ui7, _config$ui8, _config$ui9;
52
+ var config = _ref.config,
53
+ _ref$visible = _ref.visible,
54
+ visible = _ref$visible === void 0 ? true : _ref$visible,
55
+ onClose = _ref.onClose,
56
+ className = _ref.className,
57
+ style = _ref.style,
58
+ onRegister = _ref.onRegister,
59
+ onOAuthLogin = _ref.onOAuthLogin,
60
+ onSendVerificationCode = _ref.onSendVerificationCode,
61
+ onEmailLinkExpired = _ref.onEmailLinkExpired,
62
+ onGoToLogin = _ref.onGoToLogin,
63
+ onError = _ref.onError;
64
+ var _Form$useForm = Form.useForm(),
65
+ _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
66
+ form = _Form$useForm2[0];
67
+ var _useState = useState(false),
68
+ _useState2 = _slicedToArray(_useState, 2),
69
+ loading = _useState2[0],
70
+ setLoading = _useState2[1];
71
+ var _useState3 = useState(0),
72
+ _useState4 = _slicedToArray(_useState3, 2),
73
+ countdown = _useState4[0],
74
+ setCountdown = _useState4[1];
75
+ var _useState5 = useState([]),
76
+ _useState6 = _slicedToArray(_useState5, 2),
77
+ countries = _useState6[0],
78
+ setCountries = _useState6[1];
79
+ var _useState7 = useState(''),
80
+ _useState8 = _slicedToArray(_useState7, 2),
81
+ codeError = _useState8[0],
82
+ setCodeError = _useState8[1];
83
+ var pisellOS = usePisellOS();
84
+ var registerAndLogin = pisellOS === null || pisellOS === void 0 ? void 0 : pisellOS.getModule('registerAndLogin');
85
+
86
+ // 获取 context 和 shopId
87
+ var context = useEngineContext();
88
+ var utils = (context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {};
89
+ var shopId = ((_utils$getStore = utils.getStore) === null || _utils$getStore === void 0 || (_utils$getStore = _utils$getStore.call(utils)) === null || _utils$getStore === void 0 || (_utils$getStore$getSt = _utils$getStore.getState) === null || _utils$getStore$getSt === void 0 || (_utils$getStore$getSt = _utils$getStore$getSt.call(_utils$getStore)) === null || _utils$getStore$getSt === void 0 || (_utils$getStore$getSt = _utils$getStore$getSt.global) === null || _utils$getStore$getSt === void 0 || (_utils$getStore$getSt = _utils$getStore$getSt.shop) === null || _utils$getStore$getSt === void 0 ? void 0 : _utils$getStore$getSt.id) || 9;
90
+
91
+ // 邮件链接验证模式相关状态
92
+ var _useState9 = useState(null),
93
+ _useState10 = _slicedToArray(_useState9, 2),
94
+ emailLinkVerifyStatus = _useState10[0],
95
+ setEmailLinkVerifyStatus = _useState10[1];
96
+ var _useState11 = useState(''),
97
+ _useState12 = _slicedToArray(_useState11, 2),
98
+ verifiedEmail = _useState12[0],
99
+ setVerifiedEmail = _useState12[1];
100
+
101
+ // 规范化注册方式配置
102
+ var normalizedRegistrationMethods = useMemo(function () {
103
+ var _config$email, _config$phone, _config$oauth, _config$oauth2, _config$oauth3, _config$oauth4, _config$oauth5, _config$oauth6;
104
+ if (config.registrationMethods && config.registrationMethods.length > 0) {
105
+ return config.registrationMethods;
106
+ }
107
+
108
+ // 向后兼容:从旧的配置中构建 registrationMethods
109
+ var methods = [];
110
+
111
+ // 添加邮箱注册方式
112
+ if ((_config$email = config.email) !== null && _config$email !== void 0 && _config$email.enable_email) {
113
+ methods.push({
114
+ type: 'email',
115
+ verificationMethod: config.email.registration_verification ? config.email.registration_verification : 'verification_code'
116
+ });
117
+ }
118
+
119
+ // 添加手机注册方式
120
+ if ((_config$phone = config.phone) !== null && _config$phone !== void 0 && _config$phone.enable_phone_number) {
121
+ methods.push({
122
+ type: 'phone',
123
+ verificationMethod: 'verification_code' // 手机号仅支持验证码
124
+ });
125
+ }
126
+
127
+ // 添加三方注册方式
128
+ if ((_config$oauth = config.oauth) !== null && _config$oauth !== void 0 && (_config$oauth = _config$oauth.google) !== null && _config$oauth !== void 0 && _config$oauth.enabled && (_config$oauth2 = config.oauth) !== null && _config$oauth2 !== void 0 && (_config$oauth2 = _config$oauth2.google) !== null && _config$oauth2 !== void 0 && _config$oauth2.client_id) {
129
+ methods.push({
130
+ type: 'google',
131
+ clientId: config.oauth.google.client_id
132
+ });
133
+ }
134
+ if ((_config$oauth3 = config.oauth) !== null && _config$oauth3 !== void 0 && (_config$oauth3 = _config$oauth3.facebook) !== null && _config$oauth3 !== void 0 && _config$oauth3.enabled && (_config$oauth4 = config.oauth) !== null && _config$oauth4 !== void 0 && (_config$oauth4 = _config$oauth4.facebook) !== null && _config$oauth4 !== void 0 && _config$oauth4.app_id) {
135
+ methods.push({
136
+ type: 'facebook',
137
+ appId: config.oauth.facebook.app_id
138
+ });
139
+ }
140
+ if ((_config$oauth5 = config.oauth) !== null && _config$oauth5 !== void 0 && (_config$oauth5 = _config$oauth5.apple) !== null && _config$oauth5 !== void 0 && _config$oauth5.enabled && (_config$oauth6 = config.oauth) !== null && _config$oauth6 !== void 0 && (_config$oauth6 = _config$oauth6.apple) !== null && _config$oauth6 !== void 0 && _config$oauth6.client_id) {
141
+ methods.push({
142
+ type: 'apple',
143
+ clientId: config.oauth.apple.client_id
144
+ });
145
+ }
146
+ return methods;
147
+ }, [config.registrationMethods, config.email, config.phone, config.oauth]);
148
+
149
+ // 智能判断默认认证方式
150
+ var getDefaultAuthMethod = function getDefaultAuthMethod() {
151
+ var _config$phone2, _config$email2, _config$email3, _config$phone3;
152
+ // 1. 优先使用 registrationMethods 配置
153
+ if (normalizedRegistrationMethods.length > 0) {
154
+ // 如果有明确的 defaultAuthMethod 且该方式在 registrationMethods 中存在
155
+ if (config.defaultAuthMethod) {
156
+ var _method = normalizedRegistrationMethods.find(function (m) {
157
+ return m.type === config.defaultAuthMethod;
158
+ });
159
+ if (_method) {
160
+ return config.defaultAuthMethod;
161
+ }
162
+ }
163
+
164
+ // 否则返回第一个注册方式
165
+ return normalizedRegistrationMethods[0].type;
166
+ }
167
+
168
+ // 2. 向后兼容:使用旧的配置逻辑
169
+ if (config.defaultAuthMethod) {
170
+ return config.defaultAuthMethod;
171
+ }
172
+
173
+ // 3. 如果只启用了手机认证,默认使用手机
174
+ if ((_config$phone2 = config.phone) !== null && _config$phone2 !== void 0 && _config$phone2.enable_phone_number && !((_config$email2 = config.email) !== null && _config$email2 !== void 0 && _config$email2.enable_email)) {
175
+ return 'phone';
176
+ }
177
+
178
+ // 4. 如果只启用了邮箱认证,默认使用邮箱
179
+ if ((_config$email3 = config.email) !== null && _config$email3 !== void 0 && _config$email3.enable_email && !((_config$phone3 = config.phone) !== null && _config$phone3 !== void 0 && _config$phone3.enable_phone_number)) {
180
+ return 'email';
181
+ }
182
+
183
+ // 5. 都启用或都未启用,默认邮箱
184
+ return 'email';
185
+ };
186
+ var _useState13 = useState(function () {
187
+ return getDefaultAuthMethod();
188
+ }),
189
+ _useState14 = _slicedToArray(_useState13, 2),
190
+ currentAuthMethod = _useState14[0],
191
+ setCurrentAuthMethod = _useState14[1];
192
+
193
+ // 获取某个注册方式的配置
194
+ var getRegistrationMethodConfig = useCallback(function (type) {
195
+ return normalizedRegistrationMethods.find(function (method) {
196
+ return method.type === type;
197
+ });
198
+ }, [normalizedRegistrationMethods]);
199
+
200
+ // 获取当前认证方式的验证方法
201
+ var getCurrentVerificationMethod = useCallback(function () {
202
+ var methodConfig = getRegistrationMethodConfig(currentAuthMethod);
203
+ if (methodConfig && 'verificationMethod' in methodConfig) {
204
+ return methodConfig.verificationMethod;
205
+ }
206
+
207
+ // 向后兼容:从旧配置中获取
208
+ if (currentAuthMethod === 'email') {
209
+ var _config$email4;
210
+ return ((_config$email4 = config.email) === null || _config$email4 === void 0 ? void 0 : _config$email4.registration_verification) || 'verification_code';
211
+ } else if (currentAuthMethod === 'phone') {
212
+ return 'verification_code'; // 手机号仅支持验证码
213
+ }
214
+ return 'verification_code';
215
+ }, [currentAuthMethod, getRegistrationMethodConfig, config.email, config.phone]);
216
+ var passwordValidationRules = usePasswordValidationRules((_config$ui = config.ui) === null || _config$ui === void 0 ? void 0 : _config$ui.passwordRules, {
217
+ translate: locales.getText,
218
+ fallbackMinLength: 6,
219
+ messageKeys: {
220
+ required: 'pisell-register2-password-required',
221
+ minLength: 'pisell-register2-password-min-length',
222
+ requireUppercase: 'pisell-set-password-require-uppercase',
223
+ requireLowercase: 'pisell-set-password-require-lowercase',
224
+ requireNumber: 'pisell-set-password-require-number',
225
+ requireSpecialCharacters: 'pisell-set-password-require-special',
226
+ summary: 'pisell-set-password-must-contain'
227
+ }
228
+ });
229
+
230
+ // 检查某个注册方式是否启用
231
+ var isRegistrationMethodEnabled = useCallback(function (type) {
232
+ return normalizedRegistrationMethods.some(function (method) {
233
+ return method.type === type;
234
+ });
235
+ }, [normalizedRegistrationMethods]);
236
+
237
+ // 使用注册方式相关的逻辑hook
238
+ var _useRegistrationMetho = useRegistrationMethods(isRegistrationMethodEnabled),
239
+ shouldShowDivider = _useRegistrationMetho.shouldShowDivider,
240
+ hasEmailAndPhone = _useRegistrationMetho.hasEmailAndPhone;
241
+
242
+ // 稳定的回调函数,避免不必要的重新渲染
243
+ var handleStepChange = useCallback(function () {}, []);
244
+ var handleComplete = useCallback(function (data) {
245
+ var _data$extraData;
246
+ // 从 data.extraData 中获取 API 返回的原始数据
247
+ var apiResponse = (_data$extraData = data.extraData) === null || _data$extraData === void 0 ? void 0 : _data$extraData.apiResponse;
248
+ onRegister === null || onRegister === void 0 || onRegister(apiResponse || (data === null || data === void 0 ? void 0 : data.data), data.accountType, {
249
+ account: data.account,
250
+ password: data.password || ''
251
+ }, config.channel);
252
+ }, [onRegister, config.channel]);
253
+
254
+ // 初始化注册流程管理
255
+ var _useRegisterFlow = useRegisterFlow({
256
+ accountType: currentAuthMethod,
257
+ emailConfig: config.email,
258
+ phoneConfig: config.phone,
259
+ initialAccount: '',
260
+ onStepChange: handleStepChange,
261
+ onComplete: handleComplete
262
+ }),
263
+ flowData = _useRegisterFlow.flowData,
264
+ currentStepDef = _useRegisterFlow.currentStepDef,
265
+ goToStep = _useRegisterFlow.goToStep,
266
+ updateFlowData = _useRegisterFlow.updateFlowData,
267
+ resetFlow = _useRegisterFlow.resetFlow,
268
+ handleError = _useRegisterFlow.handleError;
269
+
270
+ // 获取国家列表
271
+ useEffect(function () {
272
+ var fetchCountries = /*#__PURE__*/function () {
273
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
274
+ var countriesList;
275
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
276
+ while (1) switch (_context.prev = _context.next) {
277
+ case 0:
278
+ _context.prev = 0;
279
+ if (!(registerAndLogin !== null && registerAndLogin !== void 0 && registerAndLogin.getCountries)) {
280
+ _context.next = 6;
281
+ break;
282
+ }
283
+ _context.next = 4;
284
+ return registerAndLogin.getCountries();
285
+ case 4:
286
+ countriesList = _context.sent;
287
+ setCountries(countriesList || []);
288
+ case 6:
289
+ _context.next = 11;
290
+ break;
291
+ case 8:
292
+ _context.prev = 8;
293
+ _context.t0 = _context["catch"](0);
294
+ console.error('Failed to fetch countries:', _context.t0);
295
+ // 如果获取失败,保持空数组,PhoneInput 会使用默认列表
296
+ case 11:
297
+ case "end":
298
+ return _context.stop();
299
+ }
300
+ }, _callee, null, [[0, 8]]);
301
+ }));
302
+ return function fetchCountries() {
303
+ return _ref2.apply(this, arguments);
304
+ };
305
+ }();
306
+ fetchCountries();
307
+ }, [registerAndLogin]);
308
+
309
+ // 邮件链接验证模式 - 组件挂载时验证 code
310
+ useEffect(function () {
311
+ var verifyEmailLink = /*#__PURE__*/function () {
312
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
313
+ var _config$emailLinkVeri, _config$emailLinkVeri2;
314
+ var result;
315
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
316
+ while (1) switch (_context2.prev = _context2.next) {
317
+ case 0:
318
+ if (!(!((_config$emailLinkVeri = config.emailLinkVerification) !== null && _config$emailLinkVeri !== void 0 && _config$emailLinkVeri.enabled) || !((_config$emailLinkVeri2 = config.emailLinkVerification) !== null && _config$emailLinkVeri2 !== void 0 && _config$emailLinkVeri2.code))) {
319
+ _context2.next = 2;
320
+ break;
321
+ }
322
+ return _context2.abrupt("return");
323
+ case 2:
324
+ setEmailLinkVerifyStatus('verifying');
325
+ _context2.prev = 3;
326
+ _context2.next = 6;
327
+ return registerAndLogin.checkEmailLinkCode({
328
+ code: config.emailLinkVerification.code
329
+ });
330
+ case 6:
331
+ result = _context2.sent;
332
+ if (result.code === 200 && result.data.valid) {
333
+ // code 有效,保存到 flowData 并跳转到设置密码页面
334
+ updateFlowData({
335
+ emailLinkCode: config.emailLinkVerification.code,
336
+ account: result.data.email || '',
337
+ accountType: 'email',
338
+ verificationMethod: VerificationMethod.EMAIL_LINK
339
+ });
340
+ setVerifiedEmail(result.data.email);
341
+ setEmailLinkVerifyStatus('success');
342
+ goToStep(RegisterStep.SET_PASSWORD);
343
+ } else if (result.code === 50011) {
344
+ setEmailLinkVerifyStatus('expired');
345
+ } else if (!result.data.valid) {
346
+ setEmailLinkVerifyStatus('already_used');
347
+ } else {
348
+ setEmailLinkVerifyStatus(null);
349
+ message.error(result.message || '验证失败,请稍后重试');
350
+ }
351
+ _context2.next = 15;
352
+ break;
353
+ case 10:
354
+ _context2.prev = 10;
355
+ _context2.t0 = _context2["catch"](3);
356
+ console.error('Email link verification failed:', _context2.t0);
357
+ message.error('验证失败,请稍后重试');
358
+ setEmailLinkVerifyStatus(null);
359
+ case 15:
360
+ case "end":
361
+ return _context2.stop();
362
+ }
363
+ }, _callee2, null, [[3, 10]]);
364
+ }));
365
+ return function verifyEmailLink() {
366
+ return _ref3.apply(this, arguments);
367
+ };
368
+ }();
369
+ verifyEmailLink();
370
+ }, [config.emailLinkVerification, registerAndLogin]);
371
+
372
+ // 当组件关闭时,清空密码字段,防止浏览器弹出保存密码提示
373
+ useEffect(function () {
374
+ if (!visible) {
375
+ // 清空密码字段,防止浏览器检测到凭据变化而弹出保存提示
376
+ form.setFieldsValue({
377
+ password: ''
378
+ });
379
+ form.setFieldsValue({
380
+ confirmPassword: ''
381
+ });
382
+
383
+ // 可选:重置整个表单(如果希望更彻底的清理)
384
+ // form.resetFields();
385
+ }
386
+ }, [visible, form]);
387
+
388
+ // 当配置变化时,更新认证方式
389
+ useEffect(function () {
390
+ var newAuthMethod = getDefaultAuthMethod();
391
+ if (newAuthMethod !== currentAuthMethod) {
392
+ setCurrentAuthMethod(newAuthMethod);
393
+ form.resetFields(['account']);
394
+ }
395
+ }, [normalizedRegistrationMethods, config.defaultAuthMethod]);
396
+
397
+ // 初始化国际化
398
+ useEffect(function () {
399
+ var _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _context$appHelper$ut4;
400
+ locales.init(localeTexts, ((_context$appHelper$ut = context.appHelper.utils) === null || _context$appHelper$ut === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut.getApp) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.call(_context$appHelper$ut)) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.locales) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut3 = _context$appHelper$ut2.getLocale) === null || _context$appHelper$ut3 === void 0 ? void 0 : _context$appHelper$ut3.call(_context$appHelper$ut2)) || ((_context$appHelper$ut4 = context.appHelper.utils) === null || _context$appHelper$ut4 === void 0 || (_context$appHelper$ut4 = _context$appHelper$ut4.storage) === null || _context$appHelper$ut4 === void 0 ? void 0 : _context$appHelper$ut4.get('umi_locale')) || 'en');
401
+ }, []);
402
+
403
+ // 验证码倒计时
404
+ useEffect(function () {
405
+ if (countdown > 0) {
406
+ var timer = setTimeout(function () {
407
+ setCountdown(countdown - 1);
408
+ }, 1000);
409
+ return function () {
410
+ return clearTimeout(timer);
411
+ };
412
+ }
413
+ }, [countdown]);
414
+
415
+ // 发送验证码或链接
416
+ var handleSendCode = /*#__PURE__*/function () {
417
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
418
+ var values, _account, _type, res, emailVerificationMethod, accountForCallback, verificationMethod;
419
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
420
+ while (1) switch (_context3.prev = _context3.next) {
421
+ case 0:
422
+ _context3.prev = 0;
423
+ _context3.next = 3;
424
+ return form.validateFields(['account']);
425
+ case 3:
426
+ values = _context3.sent;
427
+ _account = values.account;
428
+ setLoading(true);
429
+ _type = currentAuthMethod === 'email' ? 'email' : 'phone';
430
+ if (!(currentAuthMethod === 'email')) {
431
+ _context3.next = 20;
432
+ break;
433
+ }
434
+ // 邮箱认证:根据验证方式调用不同的 API
435
+ emailVerificationMethod = getCurrentVerificationMethod();
436
+ if (!(emailVerificationMethod === 'verification_link')) {
437
+ _context3.next = 15;
438
+ break;
439
+ }
440
+ _context3.next = 12;
441
+ return registerAndLogin.sendEmailRegisterLink(_account);
442
+ case 12:
443
+ res = _context3.sent;
444
+ _context3.next = 18;
445
+ break;
446
+ case 15:
447
+ _context3.next = 17;
448
+ return registerAndLogin.sendEmailVerificationCode({
449
+ type: 'email',
450
+ target: _account,
451
+ purpose: 'register'
452
+ });
453
+ case 17:
454
+ res = _context3.sent;
455
+ case 18:
456
+ _context3.next = 23;
457
+ break;
458
+ case 20:
459
+ _context3.next = 22;
460
+ return registerAndLogin.sendSmsRegisterCode(_account);
461
+ case 22:
462
+ res = _context3.sent;
463
+ case 23:
464
+ // 调用外部回调(如果是手机号,需要转换为字符串格式)
465
+ accountForCallback = currentAuthMethod === 'phone' && _typeof(_account) === 'object' ? "+".concat(_account.country_calling_code).concat(_account.phone) : _account;
466
+ _context3.next = 26;
467
+ return onSendVerificationCode === null || onSendVerificationCode === void 0 ? void 0 : onSendVerificationCode(accountForCallback, _type, config.channel);
468
+ case 26:
469
+ // 根据响应码决定跳转到哪个步骤
470
+ if (res.code === 200) {
471
+ // 更新流程数据中的账号和账号类型
472
+ updateFlowData({
473
+ account: _account,
474
+ accountType: currentAuthMethod
475
+ });
476
+
477
+ // 判断验证方式
478
+ verificationMethod = getCurrentVerificationMethod();
479
+ if (verificationMethod === 'verification_link') {
480
+ // 邮件链接验证:跳转到等待邮件链接页面(图1)
481
+ // 直接在 goToStep 中更新所有数据,包括验证方式
482
+ goToStep(RegisterStep.WAIT_EMAIL_LINK, {
483
+ account: _account,
484
+ accountType: currentAuthMethod,
485
+ verificationMethod: VerificationMethod.EMAIL_LINK // 同时更新验证方式
486
+ });
487
+ setCountdown(60);
488
+ // message.success('Verification link sent to your email');
489
+ // TODO 到发送成功的页面去
490
+ } else if (verificationMethod === 'verification_code') {
491
+ // 验证码验证(邮箱或手机):跳转到输入验证码页面(图2)
492
+ goToStep(RegisterStep.INPUT_VERIFICATION_CODE, {
493
+ account: _account,
494
+ accountType: currentAuthMethod
495
+ });
496
+ setCountdown(60);
497
+ message.success(locales.getText('pisell-login2-code-sent'));
498
+ }
499
+ } else if (res.code === 5002) {
500
+ // 账号已注册(邮箱或手机号)
501
+ goToStep(RegisterStep.EMAIL_ALREADY_REGISTERED, {
502
+ account: _account,
503
+ accountType: currentAuthMethod
504
+ });
505
+ } else {
506
+ message.error(res.message);
507
+ }
508
+ _context3.next = 35;
509
+ break;
510
+ case 29:
511
+ _context3.prev = 29;
512
+ _context3.t0 = _context3["catch"](0);
513
+ if (!_context3.t0.errorFields) {
514
+ _context3.next = 33;
515
+ break;
516
+ }
517
+ return _context3.abrupt("return");
518
+ case 33:
519
+ handleError('SEND_CODE_FAILED', _context3.t0.message || 'Failed to send verification code');
520
+ message.error(_context3.t0 === null || _context3.t0 === void 0 ? void 0 : _context3.t0.message);
521
+ case 35:
522
+ _context3.prev = 35;
523
+ setLoading(false);
524
+ return _context3.finish(35);
525
+ case 38:
526
+ case "end":
527
+ return _context3.stop();
528
+ }
529
+ }, _callee3, null, [[0, 29, 35, 38]]);
530
+ }));
531
+ return function handleSendCode() {
532
+ return _ref4.apply(this, arguments);
533
+ };
534
+ }();
535
+
536
+ // 处理注册(无需验证模式)
537
+ var handleRegister = /*#__PURE__*/function () {
538
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
539
+ var values, registerData;
540
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
541
+ while (1) switch (_context4.prev = _context4.next) {
542
+ case 0:
543
+ _context4.prev = 0;
544
+ setLoading(true);
545
+ _context4.next = 4;
546
+ return form.validateFields();
547
+ case 4:
548
+ values = _context4.sent;
549
+ registerData = {
550
+ account: values.account,
551
+ password: values.password
552
+ }; // TODO: 调用后端注册接口
553
+ // const res = await registerAndLogin.register({
554
+ // type: currentAuthMethod === 'email' ? 'email' : 'phone',
555
+ // account: registerData.account,
556
+ // password: registerData.password,
557
+ // channel: config.channel
558
+ // });
559
+ // if (res.code === 200) {
560
+ // message.success('Registration successful');
561
+ // await onRegister?.(registerData, currentAuthMethod, config.channel);
562
+ // } else if (res.code === 409) {
563
+ // // 账号已注册
564
+ // goToStep(RegisterStep.EMAIL_ALREADY_REGISTERED, { account: registerData.account });
565
+ // } else {
566
+ // message.error(res.message || 'Registration failed');
567
+ // }
568
+ // 临时:直接调用回调
569
+ _context4.next = 8;
570
+ return onRegister === null || onRegister === void 0 ? void 0 : onRegister(registerData, currentAuthMethod, config.channel);
571
+ case 8:
572
+ message.success(locales.getText('pisell-register2-register-success'));
573
+ _context4.next = 16;
574
+ break;
575
+ case 11:
576
+ _context4.prev = 11;
577
+ _context4.t0 = _context4["catch"](0);
578
+ if (!_context4.t0.errorFields) {
579
+ _context4.next = 15;
580
+ break;
581
+ }
582
+ return _context4.abrupt("return");
583
+ case 15:
584
+ message.error((_context4.t0 === null || _context4.t0 === void 0 ? void 0 : _context4.t0.message) || 'Registration failed');
585
+ case 16:
586
+ _context4.prev = 16;
587
+ setLoading(false);
588
+ return _context4.finish(16);
589
+ case 19:
590
+ case "end":
591
+ return _context4.stop();
592
+ }
593
+ }, _callee4, null, [[0, 11, 16, 19]]);
594
+ }));
595
+ return function handleRegister() {
596
+ return _ref5.apply(this, arguments);
597
+ };
598
+ }();
599
+
600
+ // 处理表单提交(用于 Enter 键提交和按钮点击)
601
+ var handleFormSubmit = function handleFormSubmit(e) {
602
+ e === null || e === void 0 || e.preventDefault();
603
+ if (isEmailNoVerification) {
604
+ handleRegister();
605
+ } else if (needsVerification) {
606
+ handleSendCode();
607
+ } else {
608
+ handleRegister();
609
+ }
610
+ };
611
+
612
+ // 处理三方登录
613
+ var handleOAuthClickInternal = /*#__PURE__*/function () {
614
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(provider) {
615
+ var _config$registrationM, fbConfig, token, res, _config$registrationM2, appleConfig, _token, _res, _config$registrationM3, googleConfig, _token2, _res2;
616
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
617
+ while (1) switch (_context5.prev = _context5.next) {
618
+ case 0:
619
+ _context5.prev = 0;
620
+ setLoading(true);
621
+ if (!(provider === 'facebook')) {
622
+ _context5.next = 15;
623
+ break;
624
+ }
625
+ fbConfig = config === null || config === void 0 || (_config$registrationM = config.registrationMethods) === null || _config$registrationM === void 0 ? void 0 : _config$registrationM.find(function (n) {
626
+ return n.type === 'facebook';
627
+ });
628
+ token = fbConfig === null || fbConfig === void 0 ? void 0 : fbConfig.appId;
629
+ if (token) {
630
+ _context5.next = 7;
631
+ break;
632
+ }
633
+ throw new Error('Facebook app_id not configured');
634
+ case 7:
635
+ _context5.next = 9;
636
+ return registerAndLogin.loginWithFacebook(token);
637
+ case 9:
638
+ res = _context5.sent;
639
+ if (!res.data) {
640
+ _context5.next = 13;
641
+ break;
642
+ }
643
+ _context5.next = 13;
644
+ return onRegister === null || onRegister === void 0 ? void 0 : onRegister(res.data, 'facebook', {
645
+ account: '',
646
+ password: ''
647
+ }, config.channel);
648
+ case 13:
649
+ _context5.next = 43;
650
+ break;
651
+ case 15:
652
+ if (!(provider === 'apple')) {
653
+ _context5.next = 30;
654
+ break;
655
+ }
656
+ appleConfig = config === null || config === void 0 || (_config$registrationM2 = config.registrationMethods) === null || _config$registrationM2 === void 0 ? void 0 : _config$registrationM2.find(function (n) {
657
+ return n.type === 'apple';
658
+ });
659
+ _token = appleConfig === null || appleConfig === void 0 ? void 0 : appleConfig.clientId;
660
+ if (!_token) {
661
+ _context5.next = 27;
662
+ break;
663
+ }
664
+ _context5.next = 21;
665
+ return registerAndLogin.loginWithApple(_token);
666
+ case 21:
667
+ _res = _context5.sent;
668
+ if (!_res.data) {
669
+ _context5.next = 25;
670
+ break;
671
+ }
672
+ _context5.next = 25;
673
+ return onRegister === null || onRegister === void 0 ? void 0 : onRegister(_res.data, 'apple', {
674
+ account: '',
675
+ password: ''
676
+ }, config.channel);
677
+ case 25:
678
+ _context5.next = 28;
679
+ break;
680
+ case 27:
681
+ throw new Error('Apple client_id not configured');
682
+ case 28:
683
+ _context5.next = 43;
684
+ break;
685
+ case 30:
686
+ if (!(provider === 'google')) {
687
+ _context5.next = 43;
688
+ break;
689
+ }
690
+ googleConfig = config === null || config === void 0 || (_config$registrationM3 = config.registrationMethods) === null || _config$registrationM3 === void 0 ? void 0 : _config$registrationM3.find(function (n) {
691
+ return n.type === 'google';
692
+ });
693
+ _token2 = googleConfig === null || googleConfig === void 0 ? void 0 : googleConfig.clientId;
694
+ if (!_token2) {
695
+ _context5.next = 42;
696
+ break;
697
+ }
698
+ _context5.next = 36;
699
+ return registerAndLogin.loginWithGoogle(_token2);
700
+ case 36:
701
+ _res2 = _context5.sent;
702
+ if (!_res2.data) {
703
+ _context5.next = 40;
704
+ break;
705
+ }
706
+ _context5.next = 40;
707
+ return onRegister === null || onRegister === void 0 ? void 0 : onRegister(_res2.data, 'google', {
708
+ account: '',
709
+ password: ''
710
+ }, config.channel);
711
+ case 40:
712
+ _context5.next = 43;
713
+ break;
714
+ case 42:
715
+ throw new Error('Google client_id not configured');
716
+ case 43:
717
+ _context5.next = 45;
718
+ return onOAuthLogin === null || onOAuthLogin === void 0 ? void 0 : onOAuthLogin(provider, config.channel);
719
+ case 45:
720
+ _context5.next = 54;
721
+ break;
722
+ case 47:
723
+ _context5.prev = 47;
724
+ _context5.t0 = _context5["catch"](0);
725
+ if (!(_context5.t0.messager === 'facebook_login_cancel')) {
726
+ _context5.next = 51;
727
+ break;
728
+ }
729
+ return _context5.abrupt("return", message.error(locales.getText('pisell-register2-facebook-login-canceled')));
730
+ case 51:
731
+ console.error("".concat(provider, " login error:"), _context5.t0);
732
+ message.error((_context5.t0 === null || _context5.t0 === void 0 ? void 0 : _context5.t0.message) || "".concat(provider, " login failed"));
733
+ onError === null || onError === void 0 || onError(_context5.t0, provider);
734
+ case 54:
735
+ _context5.prev = 54;
736
+ setLoading(false);
737
+ return _context5.finish(54);
738
+ case 57:
739
+ case "end":
740
+ return _context5.stop();
741
+ }
742
+ }, _callee5, null, [[0, 47, 54, 57]]);
743
+ }));
744
+ return function handleOAuthClickInternal(_x) {
745
+ return _ref6.apply(this, arguments);
746
+ };
747
+ }();
748
+
749
+ // 使用防抖的 OAuth 点击处理函数
750
+ var _useDebounceFn = useDebounceFn(handleOAuthClickInternal, {
751
+ wait: 200,
752
+ leading: true,
753
+ trailing: false
754
+ }),
755
+ handleOAuthClick = _useDebounceFn.run;
756
+ var oauthProviders = useMemo(function () {
757
+ var providers = [];
758
+ if (isRegistrationMethodEnabled('google')) {
759
+ providers.push({
760
+ key: 'google',
761
+ label: locales.getText('pisell-register2-continue-with-google'),
762
+ icon: /*#__PURE__*/React.createElement("span", {
763
+ className: "oauth-icon"
764
+ }, "G"),
765
+ onClick: function onClick() {
766
+ return handleOAuthClick('google');
767
+ },
768
+ className: 'oauth-button google'
769
+ });
770
+ }
771
+ if (isRegistrationMethodEnabled('facebook')) {
772
+ providers.push({
773
+ key: 'facebook',
774
+ label: locales.getText('pisell-register2-continue-with-facebook'),
775
+ icon: /*#__PURE__*/React.createElement(Iconfont, {
776
+ type: "pisell2-facebook",
777
+ className: "oauth-icon"
778
+ }),
779
+ onClick: function onClick() {
780
+ return handleOAuthClick('facebook');
781
+ },
782
+ className: 'oauth-button facebook'
783
+ });
784
+ }
785
+ if (isRegistrationMethodEnabled('apple')) {
786
+ providers.push({
787
+ key: 'apple',
788
+ label: locales.getText('pisell-register2-continue-with-apple'),
789
+ icon: /*#__PURE__*/React.createElement(Iconfont, {
790
+ type: "pisell2-apple",
791
+ className: "oauth-icon"
792
+ }),
793
+ onClick: function onClick() {
794
+ return handleOAuthClick('apple');
795
+ },
796
+ className: 'oauth-button apple'
797
+ });
798
+ }
799
+ return providers;
800
+ }, [handleOAuthClick, isRegistrationMethodEnabled]);
801
+
802
+ // 重新发送验证码/链接
803
+ var handleResendCode = /*#__PURE__*/function () {
804
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
805
+ var _type2, verificationMethod, res, successMessage, errorMessage, _errorMessage, _verificationMethod;
806
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
807
+ while (1) switch (_context6.prev = _context6.next) {
808
+ case 0:
809
+ if (!(countdown > 0)) {
810
+ _context6.next = 2;
811
+ break;
812
+ }
813
+ return _context6.abrupt("return");
814
+ case 2:
815
+ _context6.prev = 2;
816
+ setLoading(true);
817
+ _type2 = currentAuthMethod === 'email' ? 'email' : 'phone';
818
+ verificationMethod = getCurrentVerificationMethod();
819
+ if (!(currentAuthMethod === 'email')) {
820
+ _context6.next = 18;
821
+ break;
822
+ }
823
+ if (!(verificationMethod === 'verification_link')) {
824
+ _context6.next = 13;
825
+ break;
826
+ }
827
+ _context6.next = 10;
828
+ return registerAndLogin.resendEmailRegisterLink();
829
+ case 10:
830
+ res = _context6.sent;
831
+ _context6.next = 16;
832
+ break;
833
+ case 13:
834
+ _context6.next = 15;
835
+ return registerAndLogin.sendEmailVerificationCode({
836
+ type: 'email',
837
+ target: flowData.account,
838
+ purpose: 'register'
839
+ });
840
+ case 15:
841
+ res = _context6.sent;
842
+ case 16:
843
+ _context6.next = 21;
844
+ break;
845
+ case 18:
846
+ _context6.next = 20;
847
+ return registerAndLogin.sendSmsRegisterCode(flowData.account);
848
+ case 20:
849
+ res = _context6.sent;
850
+ case 21:
851
+ if (res.code === 200) {
852
+ setCountdown(60);
853
+
854
+ // 根据认证方式和验证方法显示不同的成功提示
855
+ successMessage = '';
856
+ if (currentAuthMethod === 'email') {
857
+ if (verificationMethod === 'verification_link') {
858
+ successMessage = locales.getText('pisell-register2-email-link-resent');
859
+ } else {
860
+ successMessage = locales.getText('pisell-register2-email-code-resent');
861
+ }
862
+ } else {
863
+ successMessage = locales.getText('pisell-register2-phone-code-resent');
864
+ }
865
+ message.success(successMessage);
866
+ } else {
867
+ // 根据认证方式和验证方法显示不同的失败提示
868
+ errorMessage = '';
869
+ if (currentAuthMethod === 'email') {
870
+ if (verificationMethod === 'verification_link') {
871
+ errorMessage = locales.getText('pisell-register2-email-link-resend-failed');
872
+ } else {
873
+ errorMessage = locales.getText('pisell-register2-email-code-resend-failed');
874
+ }
875
+ } else {
876
+ errorMessage = locales.getText('pisell-register2-phone-code-resend-failed');
877
+ }
878
+ message.error(res.message || errorMessage);
879
+ }
880
+ _context6.next = 30;
881
+ break;
882
+ case 24:
883
+ _context6.prev = 24;
884
+ _context6.t0 = _context6["catch"](2);
885
+ // 根据认证方式和验证方法显示不同的失败提示
886
+ _errorMessage = '';
887
+ _verificationMethod = getCurrentVerificationMethod();
888
+ if (currentAuthMethod === 'email') {
889
+ if (_verificationMethod === 'verification_link') {
890
+ _errorMessage = locales.getText('pisell-register2-email-link-resend-failed');
891
+ } else {
892
+ _errorMessage = locales.getText('pisell-register2-email-code-resend-failed');
893
+ }
894
+ } else {
895
+ _errorMessage = locales.getText('pisell-register2-phone-code-resend-failed');
896
+ }
897
+ message.error(_errorMessage);
898
+ case 30:
899
+ _context6.prev = 30;
900
+ setLoading(false);
901
+ return _context6.finish(30);
902
+ case 33:
903
+ case "end":
904
+ return _context6.stop();
905
+ }
906
+ }, _callee6, null, [[2, 24, 30, 33]]);
907
+ }));
908
+ return function handleResendCode() {
909
+ return _ref7.apply(this, arguments);
910
+ };
911
+ }();
912
+
913
+ // 验证验证码
914
+ var handleVerifyCode = /*#__PURE__*/function () {
915
+ var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(code) {
916
+ var _type3, res, phoneData, _res3, errorMessage;
917
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
918
+ while (1) switch (_context7.prev = _context7.next) {
919
+ case 0:
920
+ _context7.prev = 0;
921
+ setLoading(true);
922
+ setCodeError(''); // 清除之前的错误
923
+ _type3 = currentAuthMethod === 'email' ? 'email' : 'phone';
924
+ if (!(_type3 === 'email')) {
925
+ _context7.next = 10;
926
+ break;
927
+ }
928
+ _context7.next = 7;
929
+ return registerAndLogin.checkEmailCode({
930
+ email: flowData.account,
931
+ shop_id: shopId,
932
+ code: code,
933
+ action: 'customer_registration_code'
934
+ });
935
+ case 7:
936
+ res = _context7.sent;
937
+ _context7.next = 14;
938
+ break;
939
+ case 10:
940
+ // 手机验证码
941
+ phoneData = flowData.account;
942
+ _context7.next = 13;
943
+ return registerAndLogin.checkMobileCode({
944
+ phone: phoneData.phone,
945
+ country_calling_code: phoneData.country_calling_code,
946
+ code: code
947
+ });
948
+ case 13:
949
+ res = _context7.sent;
950
+ case 14:
951
+ if (res.code === 200 && res.data.valid) {
952
+ // 验证成功,更新流程数据
953
+ updateFlowData({
954
+ verificationCode: code
955
+ });
956
+ // 跳转到验证成功页面(会自动跳转到设置密码)
957
+ goToStep(RegisterStep.VERIFICATION_SUCCESS);
958
+ } else {
959
+ // 验证失败,设置错误信息
960
+ errorMessage = ((_res3 = res) === null || _res3 === void 0 ? void 0 : _res3.message) || locales.getText('pisell-register2-invalid-verification-code');
961
+ setCodeError(errorMessage);
962
+ }
963
+ _context7.next = 21;
964
+ break;
965
+ case 17:
966
+ _context7.prev = 17;
967
+ _context7.t0 = _context7["catch"](0);
968
+ console.error(_context7.t0);
969
+ // 设置错误信息,显示在组件下方
970
+ setCodeError((_context7.t0 === null || _context7.t0 === void 0 ? void 0 : _context7.t0.message) || locales.getText('pisell-register2-verification-failed'));
971
+ case 21:
972
+ _context7.prev = 21;
973
+ setLoading(false);
974
+ return _context7.finish(21);
975
+ case 24:
976
+ case "end":
977
+ return _context7.stop();
978
+ }
979
+ }, _callee7, null, [[0, 17, 21, 24]]);
980
+ }));
981
+ return function handleVerifyCode(_x2) {
982
+ return _ref8.apply(this, arguments);
983
+ };
984
+ }();
985
+
986
+ // 设置密码并完成注册
987
+ var handleSetPassword = /*#__PURE__*/function () {
988
+ var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(password, confirmPassword) {
989
+ var res, phoneData, _error;
990
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
991
+ while (1) switch (_context8.prev = _context8.next) {
992
+ case 0:
993
+ _context8.prev = 0;
994
+ setLoading(true);
995
+
996
+ // 调用注册 API
997
+ if (!flowData.emailLinkCode) {
998
+ _context8.next = 8;
999
+ break;
1000
+ }
1001
+ _context8.next = 5;
1002
+ return registerAndLogin.verifyEmailRegistrationLink({
1003
+ code: flowData.emailLinkCode,
1004
+ password: password
1005
+ });
1006
+ case 5:
1007
+ res = _context8.sent;
1008
+ _context8.next = 18;
1009
+ break;
1010
+ case 8:
1011
+ if (!(currentAuthMethod === 'email')) {
1012
+ _context8.next = 14;
1013
+ break;
1014
+ }
1015
+ _context8.next = 11;
1016
+ return registerAndLogin.emailCodeRegister({
1017
+ email: flowData.account,
1018
+ code: flowData.verificationCode,
1019
+ password: password
1020
+ });
1021
+ case 11:
1022
+ res = _context8.sent;
1023
+ _context8.next = 18;
1024
+ break;
1025
+ case 14:
1026
+ // 手机验证码注册
1027
+ phoneData = flowData.account;
1028
+ _context8.next = 17;
1029
+ return registerAndLogin.phoneCodeRegister({
1030
+ phone: phoneData.phone,
1031
+ code: flowData.verificationCode,
1032
+ password: password,
1033
+ country_calling_code: phoneData.country_calling_code
1034
+ });
1035
+ case 17:
1036
+ res = _context8.sent;
1037
+ case 18:
1038
+ if (res.code === 200) {
1039
+ // 更新密码和 API 返回数据到流程数据
1040
+ updateFlowData({
1041
+ password: password,
1042
+ extraData: _objectSpread(_objectSpread({}, flowData.extraData), {}, {
1043
+ apiResponse: res.data
1044
+ })
1045
+ });
1046
+ // 跳转到完成步骤
1047
+ goToStep(RegisterStep.COMPLETE);
1048
+ message.success(locales.getText('pisell-register2-register-success'));
1049
+ } else {
1050
+ _error = new Error(res.message || 'Registration failed'); // 调用错误处理回调
1051
+ onError === null || onError === void 0 || onError(_error, currentAuthMethod);
1052
+ message.error(res.message || locales.getText('pisell-register2-registration-failed'));
1053
+ }
1054
+ _context8.next = 25;
1055
+ break;
1056
+ case 21:
1057
+ _context8.prev = 21;
1058
+ _context8.t0 = _context8["catch"](0);
1059
+ message.error(_context8.t0.message, locales.getText('pisell-register2-failed-to-complete'));
1060
+ console.error(_context8.t0);
1061
+ case 25:
1062
+ _context8.prev = 25;
1063
+ setLoading(false);
1064
+ return _context8.finish(25);
1065
+ case 28:
1066
+ case "end":
1067
+ return _context8.stop();
1068
+ }
1069
+ }, _callee8, null, [[0, 21, 25, 28]]);
1070
+ }));
1071
+ return function handleSetPassword(_x3, _x4) {
1072
+ return _ref9.apply(this, arguments);
1073
+ };
1074
+ }();
1075
+
1076
+ // 返回到初始表单
1077
+ var handleBackToInitialForm = useCallback(function () {
1078
+ // 清除验证码错误
1079
+ setCodeError('');
1080
+ // 使用当前流程数据中的验证方式来确保一致性
1081
+ goToStep(RegisterStep.INITIAL_FORM, {
1082
+ verificationMethod: flowData.verificationMethod
1083
+ });
1084
+ }, [goToStep, flowData]);
1085
+
1086
+ // 编辑邮箱/手机号(返回初始表单并保留当前账号)
1087
+ var handleEditAccount = function handleEditAccount() {
1088
+ // 保留当前账号信息,预填充到表单中
1089
+ if (flowData.account) {
1090
+ form.setFieldsValue({
1091
+ account: flowData.account
1092
+ });
1093
+ }
1094
+ // 返回初始表单步骤
1095
+ handleBackToInitialForm();
1096
+ };
1097
+
1098
+ // 跳转到登录
1099
+ var handleGoToLogin = function handleGoToLogin() {
1100
+ if (onGoToLogin) {
1101
+ onGoToLogin();
1102
+ }
1103
+ };
1104
+
1105
+ // 切换认证方式
1106
+ var handleSwitchAuthMethod = function handleSwitchAuthMethod(method) {
1107
+ setCurrentAuthMethod(method);
1108
+ form.resetFields(['account']);
1109
+ // 重置流程到初始状态
1110
+ resetFlow();
1111
+ };
1112
+
1113
+ // 处理返回注册页面(重置所有状态到初始状态)
1114
+ var handleBackToRegistration = function handleBackToRegistration() {
1115
+ // 重置邮件链接验证状态
1116
+ setEmailLinkVerifyStatus(null);
1117
+ setVerifiedEmail('');
1118
+ // 重置表单
1119
+ form.resetFields();
1120
+ // 重置流程到初始状态
1121
+ resetFlow();
1122
+ // 如果有外部回调,也调用它
1123
+ onEmailLinkExpired === null || onEmailLinkExpired === void 0 || onEmailLinkExpired();
1124
+ };
1125
+
1126
+ // 渲染账号输入框
1127
+ var renderAccountInput = function renderAccountInput() {
1128
+ var _ui$formLabels3, _ui$formLabels4;
1129
+ var placeholder = currentAuthMethod === 'email' ? locales.getText('pisell-login2-email-placeholder') : 'Enter your phone number';
1130
+
1131
+ // 手机号模式:使用新的 PhoneInput 组件
1132
+ if (currentAuthMethod === 'phone') {
1133
+ var _ui$formLabels, _ui$formLabels2;
1134
+ var phoneLabel = (ui === null || ui === void 0 || (_ui$formLabels = ui.formLabels) === null || _ui$formLabels === void 0 || (_ui$formLabels = _ui$formLabels.phone) === null || _ui$formLabels === void 0 ? void 0 : _ui$formLabels.show) !== false ? (ui === null || ui === void 0 || (_ui$formLabels2 = ui.formLabels) === null || _ui$formLabels2 === void 0 || (_ui$formLabels2 = _ui$formLabels2.phone) === null || _ui$formLabels2 === void 0 ? void 0 : _ui$formLabels2.text) || locales.getText('pisell-login2-phone-label') : undefined;
1135
+ var phoneRules = createPhoneValidationRules(locales.getText, true);
1136
+ return /*#__PURE__*/React.createElement(Form.Item, {
1137
+ name: "account",
1138
+ label: phoneLabel,
1139
+ rules: phoneRules,
1140
+ validateTrigger: ['onBlur', 'onSubmit']
1141
+ }, /*#__PURE__*/React.createElement(PhoneInput, {
1142
+ placeholder: placeholder,
1143
+ size: "large",
1144
+ countries: (countries === null || countries === void 0 ? void 0 : countries.length) > 0 ? countries : [],
1145
+ valueFormat: "object"
1146
+ }));
1147
+ }
1148
+
1149
+ // 邮箱模式:需要 Form.Item 包裹
1150
+ var emailRules = [{
1151
+ required: true,
1152
+ message: locales.getText('pisell-register2-email-required')
1153
+ }, {
1154
+ type: 'email',
1155
+ message: locales.getText('pisell-register2-email-invalid')
1156
+ }];
1157
+ var emailLabel = (ui === null || ui === void 0 || (_ui$formLabels3 = ui.formLabels) === null || _ui$formLabels3 === void 0 || (_ui$formLabels3 = _ui$formLabels3.email) === null || _ui$formLabels3 === void 0 ? void 0 : _ui$formLabels3.show) !== false ? (ui === null || ui === void 0 || (_ui$formLabels4 = ui.formLabels) === null || _ui$formLabels4 === void 0 || (_ui$formLabels4 = _ui$formLabels4.email) === null || _ui$formLabels4 === void 0 ? void 0 : _ui$formLabels4.text) || locales.getText('pisell-login2-email-label') : undefined;
1158
+ return /*#__PURE__*/React.createElement(Form.Item, {
1159
+ name: "account",
1160
+ label: emailLabel,
1161
+ rules: emailRules,
1162
+ validateTrigger: ['onBlur', 'onSubmit']
1163
+ }, /*#__PURE__*/React.createElement(Input, {
1164
+ size: "large",
1165
+ placeholder: placeholder,
1166
+ className: "login2-input"
1167
+ }));
1168
+ };
1169
+
1170
+ // 渲染步骤页面
1171
+ var renderStepPage = function renderStepPage() {
1172
+ var _config$ui2;
1173
+ switch (flowData.currentStep) {
1174
+ case RegisterStep.WAIT_EMAIL_LINK:
1175
+ return /*#__PURE__*/React.createElement(WaitEmailLink, {
1176
+ flowData: flowData,
1177
+ onResend: handleResendCode,
1178
+ onBack: handleBackToInitialForm,
1179
+ onEditEmail: handleEditAccount,
1180
+ countdown: countdown,
1181
+ verificationMethod: flowData.verificationMethod
1182
+ });
1183
+ case RegisterStep.EMAIL_ALREADY_REGISTERED:
1184
+ return /*#__PURE__*/React.createElement(EmailAlreadyRegistered, {
1185
+ flowData: flowData,
1186
+ onGoToLogin: handleGoToLogin,
1187
+ onBack: handleBackToInitialForm
1188
+ });
1189
+ case RegisterStep.INPUT_VERIFICATION_CODE:
1190
+ return /*#__PURE__*/React.createElement(CodeInput, {
1191
+ flowData: flowData,
1192
+ codeLength: 4,
1193
+ onSubmit: handleVerifyCode,
1194
+ onResend: handleResendCode,
1195
+ onBack: handleBackToInitialForm,
1196
+ countdown: countdown,
1197
+ loading: loading,
1198
+ error: codeError,
1199
+ onClearError: function onClearError() {
1200
+ return setCodeError('');
1201
+ }
1202
+ });
1203
+ case RegisterStep.VERIFICATION_SUCCESS:
1204
+ return /*#__PURE__*/React.createElement(VerificationSuccess, {
1205
+ flowData: flowData
1206
+ });
1207
+ case RegisterStep.SET_PASSWORD:
1208
+ return /*#__PURE__*/React.createElement(SetPassword, {
1209
+ flowData: flowData,
1210
+ onSubmit: handleSetPassword,
1211
+ onBack: function onBack() {
1212
+ return goToStep(RegisterStep.INPUT_VERIFICATION_CODE);
1213
+ },
1214
+ loading: loading,
1215
+ passwordRules: (_config$ui2 = config.ui) === null || _config$ui2 === void 0 ? void 0 : _config$ui2.passwordRules,
1216
+ scenario: "create"
1217
+ });
1218
+ case RegisterStep.COMPLETE:
1219
+ return /*#__PURE__*/React.createElement("div", {
1220
+ className: "register-step-container"
1221
+ }, /*#__PURE__*/React.createElement("div", {
1222
+ className: "register-step-content"
1223
+ }, /*#__PURE__*/React.createElement("div", {
1224
+ className: "success-icon-wrapper"
1225
+ }, /*#__PURE__*/React.createElement("svg", {
1226
+ width: "64",
1227
+ height: "64",
1228
+ viewBox: "0 0 64 64",
1229
+ fill: "none"
1230
+ }, /*#__PURE__*/React.createElement("circle", {
1231
+ cx: "32",
1232
+ cy: "32",
1233
+ r: "32",
1234
+ fill: "#10B981",
1235
+ fillOpacity: "0.1"
1236
+ }), /*#__PURE__*/React.createElement("path", {
1237
+ d: "M22 32L28 38L42 24",
1238
+ stroke: "#10B981",
1239
+ strokeWidth: "3",
1240
+ strokeLinecap: "round",
1241
+ strokeLinejoin: "round"
1242
+ }))), /*#__PURE__*/React.createElement("h2", {
1243
+ className: "register-step-title"
1244
+ }, locales.getText('pisell-register2-complete-title')), /*#__PURE__*/React.createElement("p", {
1245
+ className: "register-step-desc"
1246
+ }, locales.getText('pisell-register2-redirecting'))));
1247
+ default:
1248
+ return null;
1249
+ }
1250
+ };
1251
+ var handleSetPasswordSubmit = /*#__PURE__*/function () {
1252
+ var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(password, confirmPassword) {
1253
+ var res;
1254
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
1255
+ while (1) switch (_context9.prev = _context9.next) {
1256
+ case 0:
1257
+ _context9.prev = 0;
1258
+ setLoading(true);
1259
+ // 邮件链接注册 - 调用 verifyEmailRegistrationLink
1260
+ _context9.next = 4;
1261
+ return registerAndLogin.verifyEmailRegistrationLink({
1262
+ code: config.emailLinkVerification.code,
1263
+ password: password
1264
+ });
1265
+ case 4:
1266
+ res = _context9.sent;
1267
+ if (!(res.code === 200)) {
1268
+ _context9.next = 11;
1269
+ break;
1270
+ }
1271
+ message.success(locales.getText('pisell-register2-register-success'));
1272
+ // 调用外部注册回调
1273
+ _context9.next = 9;
1274
+ return onRegister === null || onRegister === void 0 ? void 0 : onRegister(res.data, 'email', {
1275
+ account: verifiedEmail,
1276
+ password: password
1277
+ }, config.channel);
1278
+ case 9:
1279
+ _context9.next = 12;
1280
+ break;
1281
+ case 11:
1282
+ message.error(res.message || locales.getText('pisell-register2-registration-failed'));
1283
+ case 12:
1284
+ _context9.next = 17;
1285
+ break;
1286
+ case 14:
1287
+ _context9.prev = 14;
1288
+ _context9.t0 = _context9["catch"](0);
1289
+ message.error((_context9.t0 === null || _context9.t0 === void 0 ? void 0 : _context9.t0.message) || locales.getText('pisell-register2-failed-to-complete'));
1290
+ case 17:
1291
+ _context9.prev = 17;
1292
+ setLoading(false);
1293
+ return _context9.finish(17);
1294
+ case 20:
1295
+ case "end":
1296
+ return _context9.stop();
1297
+ }
1298
+ }, _callee9, null, [[0, 14, 17, 20]]);
1299
+ }));
1300
+ return function handleSetPasswordSubmit(_x5, _x6) {
1301
+ return _ref10.apply(this, arguments);
1302
+ };
1303
+ }();
1304
+ if (!visible) {
1305
+ return null;
1306
+ }
1307
+ var ui = config.ui;
1308
+
1309
+ // 邮件链接验证模式 - 优先渲染
1310
+ if ((_config$emailLinkVeri3 = config.emailLinkVerification) !== null && _config$emailLinkVeri3 !== void 0 && _config$emailLinkVeri3.enabled) {
1311
+ // 图1: 验证中
1312
+ if (emailLinkVerifyStatus === 'verifying') {
1313
+ return /*#__PURE__*/React.createElement("div", {
1314
+ className: classNames('login2-container', 'register-flow-container', className),
1315
+ style: _objectSpread(_objectSpread({}, style), {}, {
1316
+ '--theme-color': (ui === null || ui === void 0 ? void 0 : ui.themeColor) || '#7F56D9'
1317
+ })
1318
+ }, /*#__PURE__*/React.createElement(VerifyingEmailLink, null));
1319
+ }
1320
+
1321
+ // 图2: 链接已过期
1322
+ if (emailLinkVerifyStatus === 'expired') {
1323
+ return /*#__PURE__*/React.createElement("div", {
1324
+ className: classNames('login2-container', 'register-flow-container', className),
1325
+ style: _objectSpread(_objectSpread({}, style), {}, {
1326
+ '--theme-color': (ui === null || ui === void 0 ? void 0 : ui.themeColor) || '#7F56D9'
1327
+ })
1328
+ }, /*#__PURE__*/React.createElement(EmailLinkExpired, {
1329
+ onBackToRegistration: handleBackToRegistration,
1330
+ onGoToLogin: onGoToLogin
1331
+ }));
1332
+ }
1333
+
1334
+ // 图3: 链接已使用(账号已注册)
1335
+ if (emailLinkVerifyStatus === 'already_used') {
1336
+ return /*#__PURE__*/React.createElement("div", {
1337
+ className: classNames('login2-container', 'register-flow-container', className),
1338
+ style: _objectSpread(_objectSpread({}, style), {}, {
1339
+ '--theme-color': (ui === null || ui === void 0 ? void 0 : ui.themeColor) || '#7F56D9'
1340
+ })
1341
+ }, /*#__PURE__*/React.createElement(EmailLinkAlreadyUsed, {
1342
+ onGoToLogin: onGoToLogin
1343
+ }));
1344
+ }
1345
+
1346
+ // 图4: 验证成功,显示设置密码页面
1347
+ if (emailLinkVerifyStatus === 'success') {
1348
+ var _config$ui3;
1349
+ return /*#__PURE__*/React.createElement("div", {
1350
+ className: classNames('login2-container', 'register-flow-container', className),
1351
+ style: _objectSpread(_objectSpread({}, style), {}, {
1352
+ '--theme-color': (ui === null || ui === void 0 ? void 0 : ui.themeColor) || '#7F56D9'
1353
+ })
1354
+ }, /*#__PURE__*/React.createElement(SetPassword, {
1355
+ flowData: _objectSpread(_objectSpread({}, flowData), {}, {
1356
+ account: verifiedEmail
1357
+ }),
1358
+ onSubmit: handleSetPasswordSubmit,
1359
+ loading: loading,
1360
+ passwordRules: (_config$ui3 = config.ui) === null || _config$ui3 === void 0 ? void 0 : _config$ui3.passwordRules,
1361
+ scenario: "create"
1362
+ }));
1363
+ }
1364
+ }
1365
+
1366
+ // 判断是否需要验证(邮件链接或验证码)
1367
+ var isEmailVerificationLink = currentAuthMethod === 'email' && getCurrentVerificationMethod() === 'verification_link';
1368
+ var isEmailVerificationCode = currentAuthMethod === 'email' && getCurrentVerificationMethod() === 'verification_code';
1369
+ var isEmailNoVerification = currentAuthMethod === 'email' && getCurrentVerificationMethod() === 'none';
1370
+ var isPhoneVerificationCode = currentAuthMethod === 'phone' && getCurrentVerificationMethod() === 'verification_code';
1371
+
1372
+ // 是否需要验证(邮件链接、邮箱验证码、手机验证码)
1373
+ // 注意:无需验证模式(none)不需要验证
1374
+ var needsVerification = isEmailVerificationLink || isEmailVerificationCode || isPhoneVerificationCode;
1375
+ if (flowData.currentStep !== RegisterStep.INITIAL_FORM) {
1376
+ // 验证码输入页面和邮箱已注册页面不需要显示 Header
1377
+ var showHeader = flowData.currentStep !== RegisterStep.INPUT_VERIFICATION_CODE && flowData.currentStep !== RegisterStep.WAIT_EMAIL_LINK && flowData.currentStep !== RegisterStep.SET_PASSWORD && flowData.currentStep !== RegisterStep.EMAIL_ALREADY_REGISTERED;
1378
+ return /*#__PURE__*/React.createElement("div", {
1379
+ className: classNames('login2-container', 'register-flow-container', className),
1380
+ style: _objectSpread(_objectSpread({}, style), {}, {
1381
+ '--theme-color': (ui === null || ui === void 0 ? void 0 : ui.themeColor) || '#7F56D9'
1382
+ })
1383
+ }, showHeader && /*#__PURE__*/React.createElement(Header, {
1384
+ ui: ui
1385
+ }), renderStepPage());
1386
+ }
1387
+
1388
+ // 显示初始注册表单
1389
+ return /*#__PURE__*/React.createElement("div", {
1390
+ className: classNames('login2-container', 'register2-container', className),
1391
+ style: _objectSpread(_objectSpread({}, style), {}, {
1392
+ '--theme-color': (ui === null || ui === void 0 ? void 0 : ui.themeColor) || '#7F56D9'
1393
+ })
1394
+ }, /*#__PURE__*/React.createElement(Header, {
1395
+ ui: ui
1396
+ }), /*#__PURE__*/React.createElement("div", {
1397
+ className: "login2-content"
1398
+ }, (isRegistrationMethodEnabled('email') || isRegistrationMethodEnabled('phone')) && /*#__PURE__*/React.createElement(Form, {
1399
+ form: form,
1400
+ layout: "vertical",
1401
+ className: "login2-form",
1402
+ size: "large"
1403
+ }, /*#__PURE__*/React.createElement(Form.Item, {
1404
+ label: currentAuthMethod === 'email' ? ((_config$ui4 = config.ui) === null || _config$ui4 === void 0 || (_config$ui4 = _config$ui4.formLabels) === null || _config$ui4 === void 0 || (_config$ui4 = _config$ui4.email) === null || _config$ui4 === void 0 ? void 0 : _config$ui4.show) !== false ? ((_config$ui5 = config.ui) === null || _config$ui5 === void 0 || (_config$ui5 = _config$ui5.formLabels) === null || _config$ui5 === void 0 || (_config$ui5 = _config$ui5.email) === null || _config$ui5 === void 0 ? void 0 : _config$ui5.text) || locales.getText('pisell-login2-email-label') : undefined : ((_config$ui6 = config.ui) === null || _config$ui6 === void 0 || (_config$ui6 = _config$ui6.formLabels) === null || _config$ui6 === void 0 || (_config$ui6 = _config$ui6.phone) === null || _config$ui6 === void 0 ? void 0 : _config$ui6.show) !== false ? ((_config$ui7 = config.ui) === null || _config$ui7 === void 0 || (_config$ui7 = _config$ui7.formLabels) === null || _config$ui7 === void 0 || (_config$ui7 = _config$ui7.phone) === null || _config$ui7 === void 0 ? void 0 : _config$ui7.text) || locales.getText('pisell-login2-phone-label') : undefined,
1405
+ name: "account",
1406
+ rules: currentAuthMethod === 'email' ? [{
1407
+ required: true,
1408
+ message: locales.getText('pisell-register2-email-required')
1409
+ }, {
1410
+ type: 'email',
1411
+ message: locales.getText('pisell-register2-email-invalid')
1412
+ }] : createPhoneValidationRules(locales.getText, true),
1413
+ validateTrigger: ['onBlur', 'onSubmit'],
1414
+ className: currentAuthMethod === 'phone' ? 'phone-input-form-item' : ''
1415
+ }, currentAuthMethod === 'phone' ? /*#__PURE__*/React.createElement(PhoneInput, {
1416
+ size: "large",
1417
+ placeholder: locales.getText('pisell-register2-phone-placeholder'),
1418
+ className: "login2-phone-input",
1419
+ countries: countries,
1420
+ valueFormat: "object",
1421
+ onKeyDown: function onKeyDown(e) {
1422
+ if (e.key === 'Enter' && !e.shiftKey && !e.ctrlKey && !e.metaKey) {
1423
+ e.preventDefault();
1424
+ handleFormSubmit(e);
1425
+ }
1426
+ }
1427
+ }) : /*#__PURE__*/React.createElement(Input, {
1428
+ size: "large",
1429
+ placeholder: locales.getText('pisell-register2-email-placeholder'),
1430
+ className: "login2-email-input",
1431
+ autoComplete: "email",
1432
+ onKeyDown: function onKeyDown(e) {
1433
+ if (e.key === 'Enter' && !e.shiftKey && !e.ctrlKey && !e.metaKey) {
1434
+ e.preventDefault();
1435
+ handleFormSubmit(e);
1436
+ }
1437
+ }
1438
+ })), (!needsVerification || isEmailNoVerification) && /*#__PURE__*/React.createElement(Form.Item, {
1439
+ label: ((_config$ui8 = config.ui) === null || _config$ui8 === void 0 || (_config$ui8 = _config$ui8.formLabels) === null || _config$ui8 === void 0 || (_config$ui8 = _config$ui8.password) === null || _config$ui8 === void 0 ? void 0 : _config$ui8.show) !== false ? ((_config$ui9 = config.ui) === null || _config$ui9 === void 0 || (_config$ui9 = _config$ui9.formLabels) === null || _config$ui9 === void 0 || (_config$ui9 = _config$ui9.password) === null || _config$ui9 === void 0 ? void 0 : _config$ui9.text) || locales.getText('pisell-register2-password-label') : undefined,
1440
+ name: "password",
1441
+ rules: passwordValidationRules,
1442
+ validateTrigger: ['onBlur', 'onSubmit']
1443
+ }, /*#__PURE__*/React.createElement(Input.Password, {
1444
+ size: "large",
1445
+ placeholder: locales.getText('pisell-register2-password-placeholder'),
1446
+ className: "login2-password-input",
1447
+ autoComplete: "new-password",
1448
+ onKeyDown: function onKeyDown(e) {
1449
+ if (e.key === 'Enter' && !e.shiftKey && !e.ctrlKey && !e.metaKey) {
1450
+ e.preventDefault();
1451
+ handleFormSubmit(e);
1452
+ }
1453
+ }
1454
+ })), /*#__PURE__*/React.createElement(Button, {
1455
+ type: "primary",
1456
+ size: "large",
1457
+ block: true,
1458
+ htmlType: "button",
1459
+ loading: loading,
1460
+ onClick: handleFormSubmit,
1461
+ className: "login2-submit-button"
1462
+ }, isEmailNoVerification ? locales.getText('pisell-common-continue') : needsVerification ? locales.getText('pisell-common-continue') : locales.getText('pisell-common-sign-up'))), shouldShowDivider && /*#__PURE__*/React.createElement("div", {
1463
+ className: "divider"
1464
+ }, /*#__PURE__*/React.createElement("span", null, locales.getText('pisell-common-or'))), /*#__PURE__*/React.createElement("div", {
1465
+ className: "oauth-section"
1466
+ }, hasEmailAndPhone && /*#__PURE__*/React.createElement(Button, {
1467
+ type: "default",
1468
+ size: "large",
1469
+ block: true,
1470
+ onClick: function onClick() {
1471
+ return handleSwitchAuthMethod(currentAuthMethod === 'email' ? 'phone' : 'email');
1472
+ },
1473
+ className: "login2-switch-button",
1474
+ icon: currentAuthMethod === 'email' ? /*#__PURE__*/React.createElement(Iconfont, {
1475
+ type: "pisell2-phone",
1476
+ className: "oauth-icon"
1477
+ }) : /*#__PURE__*/React.createElement(Iconfont, {
1478
+ type: "pisell2-mail-01",
1479
+ className: "oauth-icon"
1480
+ }),
1481
+ style: {
1482
+ marginBottom: oauthProviders.length ? 12 : 0
1483
+ }
1484
+ }, currentAuthMethod === 'email' ? locales.getText('pisell-register2-with-phone') : locales.getText('pisell-register2-with-email')), /*#__PURE__*/React.createElement(OAuthButtonGroup, {
1485
+ providers: oauthProviders,
1486
+ wrapperClassName: "oauth-buttons-container",
1487
+ buttonClassName: "oauth-button",
1488
+ layout: "vertical",
1489
+ gap: 12
1490
+ }))), /*#__PURE__*/React.createElement("div", {
1491
+ className: "login2-footer-text"
1492
+ }, locales.getText('pisell-register2-have-account'), ' ', /*#__PURE__*/React.createElement("a", {
1493
+ className: "login2-link",
1494
+ onClick: onGoToLogin
1495
+ }, locales.getText('pisell-register2-login-link'))), /*#__PURE__*/React.createElement(LegalTerms, {
1496
+ config: _objectSpread(_objectSpread({}, config.legalTerms), {}, {
1497
+ mode: 'register'
1498
+ })
1499
+ }));
1500
+ };
1501
+ export default Register2;