@pisell/private-materials 6.3.30 → 6.3.31

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 (347) 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/Sales/Summary/utils.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.js +30 -30
  16. package/es/components/appointmentBooking/locales.js +9 -6
  17. package/es/components/booking/addons/model.d.ts +10 -1
  18. package/es/components/booking/components/TabProduct/index.d.ts +1 -0
  19. package/es/components/booking/components/footer/index.d.ts +1 -0
  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/components/formItemChildrenWrap/index.d.ts +1 -0
  23. package/es/components/booking/forms/model.d.ts +10 -1
  24. package/es/components/booking/forms/table/index.d.ts +1 -0
  25. package/es/components/booking/info/clientVariant/hooks/useClientFn.js +2 -2
  26. package/es/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +1 -0
  27. package/es/components/booking/info/clientVariant/vertical/index.js +1 -1
  28. package/es/components/booking/info/main.js +3 -2
  29. package/es/components/booking/info/model.js +5 -0
  30. package/es/components/booking/info/service/addService/utils.d.ts +1 -1
  31. package/es/components/booking/info/service/like/index.d.ts +1 -0
  32. package/es/components/booking/info/service2/utils.d.ts +1 -1
  33. package/es/components/booking/info2/index.js +3 -2
  34. package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
  35. package/es/components/booking/info2/service/contactInfoMode/index.js +93 -0
  36. package/es/components/booking/locales.js +9 -3
  37. package/es/components/booking/model.js +3 -0
  38. package/es/components/booking/notes/model.d.ts +10 -1
  39. package/es/components/booking/payments/model.d.ts +10 -1
  40. package/es/components/booking/utils.d.ts +2 -2
  41. package/es/components/eftpos/deviceList/index.d.ts +1 -0
  42. package/es/components/eftpos/form/index.d.ts +1 -0
  43. package/es/components/eftpos/group/index.d.ts +1 -0
  44. package/es/components/eftpos/hooks.d.ts +1 -0
  45. package/es/components/eftpos/icon/apiKey.d.ts +1 -0
  46. package/es/components/eftpos/icon/device.d.ts +1 -0
  47. package/es/components/eftpos/receipt/index.d.ts +1 -0
  48. package/es/components/eftposPay/amount.d.ts +1 -1
  49. package/es/components/eftposPay/component/alert/warn.d.ts +1 -0
  50. package/es/components/eftposPay/component/header/titlebar.d.ts +1 -0
  51. package/es/components/eftposPay/component/step/index.d.ts +1 -0
  52. package/es/components/eftposPay/component/step/step.d.ts +1 -0
  53. package/es/components/eftposPay/device.d.ts +1 -1
  54. package/es/components/eftposPay/hooks.d.ts +2 -2
  55. package/es/components/eftposPay/store/index.d.ts +4 -4
  56. package/es/components/eftposPay/tyro/hooks.d.ts +1 -0
  57. package/es/components/eventBooking/components/Provider/Cart/Deposit/index.d.ts +1 -0
  58. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateStatus/index.d.ts +1 -0
  59. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +1 -0
  60. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +1 -0
  61. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Status/index.d.ts +1 -0
  62. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +1 -0
  63. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/index.d.ts +1 -0
  64. package/es/components/pay/toC/model.d.ts +9 -1
  65. package/es/components/productExtension/fields/Actor/index.d.ts +1 -0
  66. package/es/components/productExtension/fields/Forms/index.d.ts +1 -0
  67. package/es/components/schedules/calendar/calendarItem.d.ts +1 -0
  68. package/es/components/schedules/model.d.ts +9 -1
  69. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/index.d.ts +1 -0
  70. package/es/components/schedules/products/ProductDetailDrawer/ProductDetailByDate/index.d.ts +1 -0
  71. package/es/components/schedules/resources/relationProduct/index.d.ts +1 -0
  72. package/es/components/shoppingCart/components/Empty/index.d.ts +1 -0
  73. package/es/components/shoppingCart/components/Render/index.d.ts +1 -0
  74. package/es/components/wallet/Detail/model.d.ts +13 -1
  75. package/es/components/wallet/DiscountCard/model.d.ts +14 -1
  76. package/es/components/wallet/PointCard/model.d.ts +13 -1
  77. package/es/components/wallet/RechargeableCard/model.d.ts +29 -1
  78. package/es/components/wallet/Voucher/model.d.ts +13 -1
  79. package/es/components/wallet/model.d.ts +9 -1
  80. package/es/index.d.ts +3 -0
  81. package/es/index.js +4 -1
  82. package/es/plus/clientName/index.js +18 -0
  83. package/es/plus/clientName/index.less +10 -0
  84. package/es/plus/clientName/type.js +1 -0
  85. package/es/plus/clientName/utils.js +18 -0
  86. package/es/plus/contactInfo/components/Avatar/index.js +30 -0
  87. package/es/plus/contactInfo/components/SwipeAction/index.js +360 -0
  88. package/es/plus/contactInfo/components/SwipeAction/index.less +74 -0
  89. package/es/plus/contactInfo/index.js +198 -0
  90. package/es/plus/contactInfo/index.less +621 -0
  91. package/es/plus/contactInfo/locales.js +14 -0
  92. package/es/plus/contactInfo/types.js +1 -0
  93. package/es/plus/contactInfo/utils.js +50 -0
  94. package/es/plus/contactInfoModal/ContactInfoContent.js +74 -0
  95. package/es/plus/contactInfoModal/index.js +154 -0
  96. package/es/plus/contactInfoModal/index.less +19 -0
  97. package/es/plus/contactInfoModal/locales.js +65 -0
  98. package/es/pro/Login2.0/AuthModal.d.ts +143 -0
  99. package/es/pro/Login2.0/AuthModal.js +624 -0
  100. package/es/pro/Login2.0/Login2.d.ts +61 -0
  101. package/es/pro/Login2.0/Login2.js +2157 -0
  102. package/es/pro/Login2.0/Register2.d.ts +65 -0
  103. package/es/pro/Login2.0/Register2.js +1501 -0
  104. package/es/pro/Login2.0/components/ForgotPasswordFlow.js +330 -0
  105. package/es/pro/Login2.0/components/LegalTerms.d.ts +8 -0
  106. package/es/pro/Login2.0/components/LegalTerms.js +51 -0
  107. package/es/pro/Login2.0/components/LegalTerms.less +74 -0
  108. package/es/pro/Login2.0/components/LoginCodeInput.js +207 -0
  109. package/es/pro/Login2.0/components/OAuthButtonGroup.js +55 -0
  110. package/es/pro/Login2.0/components/PhoneInput.js +414 -0
  111. package/es/pro/Login2.0/components/PhoneInput.less +148 -0
  112. package/es/pro/Login2.0/components/phoneValidation.js +228 -0
  113. package/es/pro/Login2.0/hooks/index.d.ts +2 -0
  114. package/es/pro/Login2.0/hooks/index.js +1 -0
  115. package/es/pro/Login2.0/hooks/usePasswordValidationRules.js +87 -0
  116. package/es/pro/Login2.0/hooks/useRegisterFlow.d.ts +39 -0
  117. package/es/pro/Login2.0/hooks/useRegisterFlow.js +158 -0
  118. package/es/pro/Login2.0/hooks/useRegistrationMethods.d.ts +9 -0
  119. package/es/pro/Login2.0/hooks/useRegistrationMethods.js +31 -0
  120. package/es/pro/Login2.0/index.js +8 -0
  121. package/es/pro/Login2.0/index.less +993 -0
  122. package/es/pro/Login2.0/locales.js +622 -0
  123. package/es/pro/Login2.0/shared/Header.d.ts +11 -0
  124. package/es/pro/Login2.0/shared/Header.js +42 -0
  125. package/es/pro/Login2.0/shared/OAuthButtons.d.ts +11 -0
  126. package/es/pro/Login2.0/shared/OAuthButtons.js +59 -0
  127. package/es/pro/Login2.0/shared/registerFlow.js +171 -0
  128. package/es/pro/Login2.0/shared/types.d.ts +232 -0
  129. package/es/pro/Login2.0/shared/types.js +1 -0
  130. package/es/pro/Login2.0/steps/CodeInput.js +209 -0
  131. package/es/pro/Login2.0/steps/EmailAlreadyRegistered.js +35 -0
  132. package/es/pro/Login2.0/steps/EmailLinkAlreadyUsed.js +25 -0
  133. package/es/pro/Login2.0/steps/EmailLinkExpired.js +33 -0
  134. package/es/pro/Login2.0/steps/SetPassword.js +148 -0
  135. package/es/pro/Login2.0/steps/VerificationSuccess.js +35 -0
  136. package/es/pro/Login2.0/steps/VerifyingEmailLink.js +17 -0
  137. package/es/pro/Login2.0/steps/WaitEmailLink.js +54 -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.js +1 -0
  141. package/lib/components/Sales/Summary/utils.d.ts +1 -1
  142. package/lib/components/appointmentBooking/components/Cart/Item/index.js +5 -3
  143. package/lib/components/appointmentBooking/components/ConfirmInformation/index.js +151 -13
  144. package/lib/components/appointmentBooking/components/ConfirmInformation/index.less +15 -0
  145. package/lib/components/appointmentBooking/hooks.js +73 -35
  146. package/lib/components/appointmentBooking/locales.js +6 -3
  147. package/lib/components/booking/addons/model.d.ts +10 -1
  148. package/lib/components/booking/components/TabProduct/index.d.ts +1 -0
  149. package/lib/components/booking/components/footer/index.d.ts +1 -0
  150. package/lib/components/booking/components/footer/index.js +4 -1
  151. package/lib/components/booking/components/footer/utils.js +70 -38
  152. package/lib/components/booking/components/formItemChildrenWrap/index.d.ts +1 -0
  153. package/lib/components/booking/forms/model.d.ts +10 -1
  154. package/lib/components/booking/forms/table/index.d.ts +1 -0
  155. package/lib/components/booking/info/clientVariant/hooks/useClientFn.js +1 -1
  156. package/lib/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +1 -0
  157. package/lib/components/booking/info/clientVariant/vertical/index.js +34 -17
  158. package/lib/components/booking/info/main.js +5 -4
  159. package/lib/components/booking/info/model.js +5 -0
  160. package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
  161. package/lib/components/booking/info/service/like/index.d.ts +1 -0
  162. package/lib/components/booking/info/service2/utils.d.ts +1 -1
  163. package/lib/components/booking/info2/index.js +5 -4
  164. package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
  165. package/lib/components/booking/info2/service/contactInfoMode/index.js +104 -0
  166. package/lib/components/booking/locales.js +9 -3
  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/booking/utils.d.ts +2 -2
  171. package/lib/components/eftpos/deviceList/index.d.ts +1 -0
  172. package/lib/components/eftpos/form/index.d.ts +1 -0
  173. package/lib/components/eftpos/group/index.d.ts +1 -0
  174. package/lib/components/eftpos/hooks.d.ts +1 -0
  175. package/lib/components/eftpos/icon/apiKey.d.ts +1 -0
  176. package/lib/components/eftpos/icon/device.d.ts +1 -0
  177. package/lib/components/eftpos/receipt/index.d.ts +1 -0
  178. package/lib/components/eftposPay/amount.d.ts +1 -1
  179. package/lib/components/eftposPay/component/alert/warn.d.ts +1 -0
  180. package/lib/components/eftposPay/component/header/titlebar.d.ts +1 -0
  181. package/lib/components/eftposPay/component/step/index.d.ts +1 -0
  182. package/lib/components/eftposPay/component/step/step.d.ts +1 -0
  183. package/lib/components/eftposPay/device.d.ts +1 -1
  184. package/lib/components/eftposPay/hooks.d.ts +2 -2
  185. package/lib/components/eftposPay/store/index.d.ts +4 -4
  186. package/lib/components/eftposPay/tyro/hooks.d.ts +1 -0
  187. package/lib/components/eventBooking/components/Provider/Cart/Deposit/index.d.ts +1 -0
  188. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateStatus/index.d.ts +1 -0
  189. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +1 -0
  190. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +1 -0
  191. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Status/index.d.ts +1 -0
  192. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +1 -0
  193. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/index.d.ts +1 -0
  194. package/lib/components/pay/toC/model.d.ts +9 -1
  195. package/lib/components/productExtension/fields/Actor/index.d.ts +1 -0
  196. package/lib/components/productExtension/fields/Forms/index.d.ts +1 -0
  197. package/lib/components/schedules/calendar/calendarItem.d.ts +1 -0
  198. package/lib/components/schedules/model.d.ts +9 -1
  199. package/lib/components/schedules/products/ProductDetailDrawer/ProductDetail/index.d.ts +1 -0
  200. package/lib/components/schedules/products/ProductDetailDrawer/ProductDetailByDate/index.d.ts +1 -0
  201. package/lib/components/schedules/resources/relationProduct/index.d.ts +1 -0
  202. package/lib/components/shoppingCart/components/Empty/index.d.ts +1 -0
  203. package/lib/components/shoppingCart/components/Render/index.d.ts +1 -0
  204. package/lib/components/wallet/Detail/model.d.ts +13 -1
  205. package/lib/components/wallet/DiscountCard/model.d.ts +14 -1
  206. package/lib/components/wallet/PointCard/model.d.ts +13 -1
  207. package/lib/components/wallet/RechargeableCard/model.d.ts +29 -1
  208. package/lib/components/wallet/Voucher/model.d.ts +13 -1
  209. package/lib/components/wallet/model.d.ts +9 -1
  210. package/lib/index.d.ts +3 -0
  211. package/lib/index.js +13 -0
  212. package/lib/plus/clientName/index.js +53 -0
  213. package/lib/plus/clientName/index.less +10 -0
  214. package/lib/plus/clientName/type.js +17 -0
  215. package/lib/plus/clientName/utils.js +43 -0
  216. package/lib/plus/contactInfo/components/Avatar/index.js +56 -0
  217. package/lib/plus/contactInfo/components/SwipeAction/index.js +373 -0
  218. package/lib/plus/contactInfo/components/SwipeAction/index.less +74 -0
  219. package/lib/plus/contactInfo/index.js +226 -0
  220. package/lib/plus/contactInfo/index.less +621 -0
  221. package/lib/plus/contactInfo/locales.js +38 -0
  222. package/lib/plus/contactInfo/types.js +17 -0
  223. package/lib/plus/contactInfo/utils.js +64 -0
  224. package/lib/plus/contactInfoModal/ContactInfoContent.js +129 -0
  225. package/lib/plus/contactInfoModal/index.js +138 -0
  226. package/lib/plus/contactInfoModal/index.less +19 -0
  227. package/lib/plus/contactInfoModal/locales.js +89 -0
  228. package/lib/pro/Login2.0/AuthModal.d.ts +143 -0
  229. package/lib/pro/Login2.0/AuthModal.js +498 -0
  230. package/lib/pro/Login2.0/Login2.d.ts +61 -0
  231. package/lib/pro/Login2.0/Login2.js +1468 -0
  232. package/lib/pro/Login2.0/Register2.d.ts +65 -0
  233. package/lib/pro/Login2.0/Register2.js +1062 -0
  234. package/lib/pro/Login2.0/components/ForgotPasswordFlow.js +213 -0
  235. package/lib/pro/Login2.0/components/LegalTerms.d.ts +8 -0
  236. package/lib/pro/Login2.0/components/LegalTerms.js +76 -0
  237. package/lib/pro/Login2.0/components/LegalTerms.less +74 -0
  238. package/lib/pro/Login2.0/components/LoginCodeInput.js +161 -0
  239. package/lib/pro/Login2.0/components/OAuthButtonGroup.js +87 -0
  240. package/lib/pro/Login2.0/components/PhoneInput.js +263 -0
  241. package/lib/pro/Login2.0/components/PhoneInput.less +148 -0
  242. package/lib/pro/Login2.0/components/phoneValidation.js +153 -0
  243. package/lib/pro/Login2.0/hooks/index.d.ts +2 -0
  244. package/lib/pro/Login2.0/hooks/index.js +29 -0
  245. package/lib/pro/Login2.0/hooks/usePasswordValidationRules.js +140 -0
  246. package/lib/pro/Login2.0/hooks/useRegisterFlow.d.ts +39 -0
  247. package/lib/pro/Login2.0/hooks/useRegisterFlow.js +149 -0
  248. package/lib/pro/Login2.0/hooks/useRegistrationMethods.d.ts +9 -0
  249. package/lib/pro/Login2.0/hooks/useRegistrationMethods.js +51 -0
  250. package/lib/pro/Login2.0/index.js +45 -0
  251. package/lib/pro/Login2.0/index.less +993 -0
  252. package/lib/pro/Login2.0/locales.js +646 -0
  253. package/lib/pro/Login2.0/shared/Header.d.ts +11 -0
  254. package/lib/pro/Login2.0/shared/Header.js +81 -0
  255. package/lib/pro/Login2.0/shared/OAuthButtons.d.ts +11 -0
  256. package/lib/pro/Login2.0/shared/OAuthButtons.js +78 -0
  257. package/lib/pro/Login2.0/shared/registerFlow.js +235 -0
  258. package/lib/pro/Login2.0/shared/types.d.ts +232 -0
  259. package/lib/pro/Login2.0/shared/types.js +17 -0
  260. package/lib/pro/Login2.0/steps/CodeInput.js +160 -0
  261. package/lib/pro/Login2.0/steps/EmailAlreadyRegistered.js +46 -0
  262. package/lib/pro/Login2.0/steps/EmailLinkAlreadyUsed.js +51 -0
  263. package/lib/pro/Login2.0/steps/EmailLinkExpired.js +51 -0
  264. package/lib/pro/Login2.0/steps/SetPassword.js +131 -0
  265. package/lib/pro/Login2.0/steps/VerificationSuccess.js +49 -0
  266. package/lib/pro/Login2.0/steps/VerifyingEmailLink.js +41 -0
  267. package/lib/pro/Login2.0/steps/WaitEmailLink.js +67 -0
  268. package/lib/pro/Login2.0/steps/index.js +60 -0
  269. package/lib/pro/Login2.0/steps/steps.less +423 -0
  270. package/lib/pro/Login2.0/types.js +17 -0
  271. package/lowcode/authmodal/meta.ts +395 -0
  272. package/lowcode/contact-info/fragments/cardStyle.ts +68 -0
  273. package/lowcode/contact-info/fragments/nameStyle.ts +33 -0
  274. package/lowcode/contact-info/fragments/pisellAvatar.ts +103 -0
  275. package/lowcode/contact-info/fragments/textStyle.ts +33 -0
  276. package/lowcode/contact-info/meta.ts +199 -0
  277. package/lowcode/contact-info-modal/meta.ts +98 -0
  278. package/lowcode/login2/CONFIG.md +447 -0
  279. package/lowcode/login2/TEST_CONFIG.md +324 -0
  280. package/lowcode/login2/VERIFICATION_METHODS.md +364 -0
  281. package/lowcode/login2/meta.ts +560 -0
  282. package/lowcode/login2/snippets.ts +124 -0
  283. package/lowcode/register2/meta.ts +562 -0
  284. package/lowcode/register2/snippets.ts +257 -0
  285. package/package.json +5 -3
  286. package/es/components/appointmentBooking/components/Cart/Item/index.d.ts +0 -3
  287. package/es/components/appointmentBooking/components/ConfirmInformation/index.d.ts +0 -4
  288. package/es/components/appointmentBooking/components/Services/index.d.ts +0 -4
  289. package/es/components/appointmentBooking/deposit/components/PolicyModal/index.d.ts +0 -3
  290. package/es/components/appointmentBooking/hooks.d.ts +0 -106
  291. package/es/components/appointmentBooking/locales.d.ts +0 -360
  292. package/es/components/booking/components/footer/utils.d.ts +0 -41
  293. package/es/components/booking/components/reloadResourceModal/index.d.ts +0 -8
  294. package/es/components/booking/components/voucher/index.d.ts +0 -3
  295. package/es/components/booking/info/clientVariant/hooks/useClientFn.d.ts +0 -43
  296. package/es/components/booking/info/clientVariant/vertical/index.d.ts +0 -8
  297. package/es/components/booking/info/main.d.ts +0 -12
  298. package/es/components/booking/info/model.d.ts +0 -5
  299. package/es/components/booking/info/service/editService/constants.d.ts +0 -1
  300. package/es/components/booking/info/service/editService/index.d.ts +0 -7
  301. package/es/components/booking/info2/index.d.ts +0 -12
  302. package/es/components/booking/info2/service/addService/index.d.ts +0 -11
  303. package/es/components/booking/locales.d.ts +0 -837
  304. package/es/components/booking/model.d.ts +0 -108
  305. package/es/components/eftposPay/component/fail/index.d.ts +0 -3
  306. package/es/components/index.d.ts +0 -22
  307. package/es/components/pay/toC/PaymentMethods/ApplePay/index.d.ts +0 -10
  308. package/es/components/pay/toC/PaymentMethods/GooglePay/index.d.ts +0 -9
  309. package/es/components/pay/toC/PaymentMethods/index.d.ts +0 -9
  310. package/es/components/ruleSetting/locales.d.ts +0 -48
  311. package/es/components/ticketBooking/components/addServiceVariant/addService.d.ts +0 -9
  312. package/es/components/ticketBooking/components/ticketBooking/index.d.ts +0 -4
  313. package/es/components/ticketBooking/components/timeBar/index.d.ts +0 -12
  314. package/es/components/ticketBooking/index.d.ts +0 -7
  315. package/es/plus/productSelect/ProductCard/index.d.ts +0 -47
  316. package/es/plus/productSelect/index.d.ts +0 -32
  317. package/lib/components/appointmentBooking/components/Cart/Item/index.d.ts +0 -3
  318. package/lib/components/appointmentBooking/components/ConfirmInformation/index.d.ts +0 -4
  319. package/lib/components/appointmentBooking/components/Services/index.d.ts +0 -4
  320. package/lib/components/appointmentBooking/deposit/components/PolicyModal/index.d.ts +0 -3
  321. package/lib/components/appointmentBooking/hooks.d.ts +0 -106
  322. package/lib/components/appointmentBooking/locales.d.ts +0 -360
  323. package/lib/components/booking/components/footer/utils.d.ts +0 -41
  324. package/lib/components/booking/components/reloadResourceModal/index.d.ts +0 -8
  325. package/lib/components/booking/components/voucher/index.d.ts +0 -3
  326. package/lib/components/booking/info/clientVariant/hooks/useClientFn.d.ts +0 -43
  327. package/lib/components/booking/info/clientVariant/vertical/index.d.ts +0 -8
  328. package/lib/components/booking/info/main.d.ts +0 -12
  329. package/lib/components/booking/info/model.d.ts +0 -5
  330. package/lib/components/booking/info/service/editService/constants.d.ts +0 -1
  331. package/lib/components/booking/info/service/editService/index.d.ts +0 -7
  332. package/lib/components/booking/info2/index.d.ts +0 -12
  333. package/lib/components/booking/info2/service/addService/index.d.ts +0 -11
  334. package/lib/components/booking/locales.d.ts +0 -837
  335. package/lib/components/booking/model.d.ts +0 -108
  336. package/lib/components/eftposPay/component/fail/index.d.ts +0 -3
  337. package/lib/components/index.d.ts +0 -22
  338. package/lib/components/pay/toC/PaymentMethods/ApplePay/index.d.ts +0 -10
  339. package/lib/components/pay/toC/PaymentMethods/GooglePay/index.d.ts +0 -9
  340. package/lib/components/pay/toC/PaymentMethods/index.d.ts +0 -9
  341. package/lib/components/ruleSetting/locales.d.ts +0 -48
  342. package/lib/components/ticketBooking/components/addServiceVariant/addService.d.ts +0 -9
  343. package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +0 -4
  344. package/lib/components/ticketBooking/components/timeBar/index.d.ts +0 -12
  345. package/lib/components/ticketBooking/index.d.ts +0 -7
  346. package/lib/plus/productSelect/ProductCard/index.d.ts +0 -47
  347. package/lib/plus/productSelect/index.d.ts +0 -32
@@ -0,0 +1,1468 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/pro/Login2.0/Login2.tsx
30
+ var Login2_exports = {};
31
+ __export(Login2_exports, {
32
+ default: () => Login2_default
33
+ });
34
+ module.exports = __toCommonJS(Login2_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_antd = require("antd");
37
+ var import_materials = require("@pisell/materials");
38
+ var import_classnames = __toESM(require("classnames"));
39
+ var import_utils = require("@pisell/utils");
40
+ var import_ahooks = require("ahooks");
41
+ var import_locales = __toESM(require("./locales"));
42
+ var import_Header = __toESM(require("./shared/Header"));
43
+ var import_LoginCodeInput = __toESM(require("./components/LoginCodeInput"));
44
+ var import_ForgotPasswordFlow = __toESM(require("./components/ForgotPasswordFlow"));
45
+ var import_SetPassword = __toESM(require("./steps/SetPassword"));
46
+ var import_PhoneInput = __toESM(require("./components/PhoneInput"));
47
+ var import_phoneValidation = require("./components/phoneValidation");
48
+ var import_LegalTerms = __toESM(require("./components/LegalTerms"));
49
+ var import_index = require("./index.less");
50
+ var import_useEngineContext = require("../../hooks/useEngineContext");
51
+ var import_useEngineContext2 = __toESM(require("../../hooks/useEngineContext"));
52
+ var import_materials2 = require("@pisell/materials");
53
+ var import_usePasswordValidationRules = __toESM(require("./hooks/usePasswordValidationRules"));
54
+ var import_OAuthButtonGroup = __toESM(require("./components/OAuthButtonGroup"));
55
+ var Login2 = ({
56
+ config,
57
+ visible = true,
58
+ onClose,
59
+ className,
60
+ style,
61
+ onLogin,
62
+ onOAuthLogin,
63
+ onSendVerificationCode,
64
+ onForgotPassword,
65
+ onSwitchToRegister,
66
+ onError
67
+ }) => {
68
+ var _a, _b, _c, _d, _e, _f;
69
+ const [form] = import_antd.Form.useForm();
70
+ const [loading, setLoading] = (0, import_react.useState)(false);
71
+ const [countdown, setCountdown] = (0, import_react.useState)(0);
72
+ const [countries, setCountries] = (0, import_react.useState)([]);
73
+ const pisellOS = (0, import_useEngineContext.usePisellOS)();
74
+ const registerAndLogin = pisellOS == null ? void 0 : pisellOS.getModule("registerAndLogin");
75
+ const context = (0, import_useEngineContext2.default)();
76
+ const storage = (_b = (_a = context == null ? void 0 : context.appHelper) == null ? void 0 : _a.utils) == null ? void 0 : _b.storage;
77
+ (0, import_react.useEffect)(() => {
78
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g;
79
+ import_utils.locales.init(
80
+ import_locales.default,
81
+ ((_e2 = (_d2 = (_c2 = (_b2 = (_a2 = context.appHelper.utils) == null ? void 0 : _a2.getApp) == null ? void 0 : _b2.call(_a2)) == null ? void 0 : _c2.locales) == null ? void 0 : _d2.getLocale) == null ? void 0 : _e2.call(_d2)) || ((_g = (_f2 = context.appHelper.utils) == null ? void 0 : _f2.storage) == null ? void 0 : _g.get("umi_locale")) || "en"
82
+ );
83
+ }, []);
84
+ const loginMethods = config.loginMethods || [];
85
+ const passwordValidationRules = (0, import_usePasswordValidationRules.default)(
86
+ (_c = config.ui) == null ? void 0 : _c.passwordRules,
87
+ {
88
+ translate: import_utils.locales.getText,
89
+ fallbackMinLength: 6,
90
+ messageKeys: {
91
+ required: "pisell-login2-password-required",
92
+ minLength: "pisell-set-password-min-length",
93
+ requireUppercase: "pisell-set-password-require-uppercase",
94
+ requireLowercase: "pisell-set-password-require-lowercase",
95
+ requireNumber: "pisell-set-password-require-number",
96
+ requireSpecialCharacters: "pisell-set-password-require-special",
97
+ summary: "pisell-set-password-must-contain"
98
+ }
99
+ }
100
+ );
101
+ const [currentLoginMethod, setCurrentLoginMethod] = (0, import_react.useState)(null);
102
+ const [currentVerificationMethod, setCurrentVerificationMethod] = (0, import_react.useState)("password");
103
+ (0, import_react.useEffect)(() => {
104
+ var _a2;
105
+ if (loginMethods.length > 0 && !currentLoginMethod) {
106
+ const nonOAuthMethod = loginMethods.find(
107
+ (method) => method.type === "email" || method.type === "phone"
108
+ );
109
+ const first = nonOAuthMethod || loginMethods[0];
110
+ setCurrentLoginMethod(first);
111
+ if (first.type === "email" || first.type === "phone") {
112
+ setCurrentVerificationMethod(
113
+ ((_a2 = first.verificationMethods) == null ? void 0 : _a2[0]) || "password"
114
+ );
115
+ }
116
+ }
117
+ }, [loginMethods, currentLoginMethod]);
118
+ (0, import_react.useEffect)(() => {
119
+ if (((currentLoginMethod == null ? void 0 : currentLoginMethod.type) === "email" || (currentLoginMethod == null ? void 0 : currentLoginMethod.type) === "phone") && currentVerificationMethod === "password") {
120
+ const storedRememberMe = storage.get("login_remember_me") === "true";
121
+ setRememberMe(storedRememberMe);
122
+ let account = storage.get("login_account");
123
+ try {
124
+ account = JSON.parse(account || "{}");
125
+ } catch (e) {
126
+ console.error(e);
127
+ }
128
+ if (account && storedRememberMe) {
129
+ const accountString = typeof account === "string" ? account : account.phone || account.email || "";
130
+ const isEmail = accountString.includes("@");
131
+ const isPhone = /^\d+$/.test(accountString.replace(/\+/g, "").replace(/\s/g, ""));
132
+ const shouldUseStoredAccount = currentLoginMethod.type === "email" && isEmail || currentLoginMethod.type === "phone" && isPhone;
133
+ if (shouldUseStoredAccount) {
134
+ setEnteredAccount(account);
135
+ setHasStoredCredentials(true);
136
+ if (isEmail && !form.getFieldValue("email")) {
137
+ form.setFieldsValue({
138
+ email: account
139
+ });
140
+ }
141
+ if (isPhone && !form.getFieldValue("phone")) {
142
+ form.setFieldsValue({
143
+ phone: account
144
+ });
145
+ }
146
+ if (currentLoginMethod == null ? void 0 : currentLoginMethod.stepByStep) {
147
+ setLoginStep("password");
148
+ }
149
+ } else {
150
+ setHasStoredCredentials(false);
151
+ setEnteredAccount("");
152
+ }
153
+ } else {
154
+ setHasStoredCredentials(false);
155
+ }
156
+ }
157
+ }, [currentLoginMethod, currentVerificationMethod]);
158
+ (0, import_react.useEffect)(() => {
159
+ if (!visible) {
160
+ form.setFieldsValue({ password: "" });
161
+ }
162
+ }, [visible, form]);
163
+ const [loginStep, setLoginStep] = (0, import_react.useState)(
164
+ "account"
165
+ );
166
+ const [enteredAccount, setEnteredAccount] = (0, import_react.useState)("");
167
+ const [codeError, setCodeError] = (0, import_react.useState)("");
168
+ const [rememberMe, setRememberMe] = (0, import_react.useState)(false);
169
+ const [hasStoredCredentials, setHasStoredCredentials] = (0, import_react.useState)(false);
170
+ const [lastLoginMethod, setLastLoginMethod] = (0, import_react.useState)(null);
171
+ const [showForgotPassword, setShowForgotPassword] = (0, import_react.useState)(false);
172
+ const [emailLinkVerifyStatus, setEmailLinkVerifyStatus] = (0, import_react.useState)(null);
173
+ const [emailLinkError, setEmailLinkError] = (0, import_react.useState)("");
174
+ const [resetPasswordUserEmail, setResetPasswordUserEmail] = (0, import_react.useState)("");
175
+ const isEmailLinkVerification = ((_d = config.emailLinkVerification) == null ? void 0 : _d.enabled) && ((_e = config.emailLinkVerification) == null ? void 0 : _e.code);
176
+ (0, import_react.useEffect)(() => {
177
+ var _a2;
178
+ if (isEmailLinkVerification && ((_a2 = config.emailLinkVerification) == null ? void 0 : _a2.code)) {
179
+ setEmailLinkVerifyStatus("verifying");
180
+ const checkCode = async () => {
181
+ var _a3;
182
+ try {
183
+ if (registerAndLogin == null ? void 0 : registerAndLogin.checkResetPasswordCode) {
184
+ const result = await registerAndLogin.checkResetPasswordCode({
185
+ code: config.emailLinkVerification.code
186
+ });
187
+ if (result.status) {
188
+ setEmailLinkVerifyStatus("success");
189
+ if ((_a3 = result.data) == null ? void 0 : _a3.email) {
190
+ setResetPasswordUserEmail(result.data.email);
191
+ }
192
+ } else {
193
+ setEmailLinkVerifyStatus("error");
194
+ setEmailLinkError(result.message || "验证码无效或已过期");
195
+ }
196
+ } else {
197
+ setEmailLinkVerifyStatus("error");
198
+ setEmailLinkError("系统错误,请稍后重试");
199
+ }
200
+ } catch (error) {
201
+ setEmailLinkVerifyStatus("error");
202
+ setEmailLinkError("网络错误,请稍后重试");
203
+ }
204
+ };
205
+ checkCode();
206
+ }
207
+ }, [
208
+ isEmailLinkVerification,
209
+ (_f = config.emailLinkVerification) == null ? void 0 : _f.code,
210
+ registerAndLogin
211
+ ]);
212
+ (0, import_react.useEffect)(() => {
213
+ if (countdown > 0) {
214
+ const timer = setTimeout(() => {
215
+ setCountdown(countdown - 1);
216
+ }, 1e3);
217
+ return () => clearTimeout(timer);
218
+ }
219
+ }, [countdown]);
220
+ (0, import_react.useEffect)(() => {
221
+ const fetchCountries = async () => {
222
+ try {
223
+ if (registerAndLogin == null ? void 0 : registerAndLogin.getCountries) {
224
+ const countriesList = await registerAndLogin.getCountries();
225
+ setCountries(countriesList || []);
226
+ }
227
+ } catch (error) {
228
+ console.error("Failed to fetch countries:", error);
229
+ }
230
+ };
231
+ fetchCountries();
232
+ }, [registerAndLogin]);
233
+ (0, import_react.useEffect)(() => {
234
+ try {
235
+ const storedLoginMethod = storage.get("pisell_last_login_method");
236
+ if (storedLoginMethod) {
237
+ const parsedMethod = JSON.parse(storedLoginMethod);
238
+ setLastLoginMethod(parsedMethod);
239
+ }
240
+ const rememberMe2 = storage.get("login_remember_me") === "true";
241
+ const account = storage.get("login_account");
242
+ const password = storage.get("login_password");
243
+ if (rememberMe2 && account && password) {
244
+ let accountData;
245
+ try {
246
+ accountData = JSON.parse(account || "{}");
247
+ } catch (e) {
248
+ accountData = account;
249
+ }
250
+ const isEmail = typeof accountData === "string" && accountData.includes("@");
251
+ const loginMethod = loginMethods.find((m) => m.type === (isEmail ? "email" : "phone"));
252
+ if (loginMethod) {
253
+ setCurrentLoginMethod(loginMethod);
254
+ setCurrentVerificationMethod("password");
255
+ setEnteredAccount(accountData);
256
+ const accountFieldName = isEmail ? "email" : "phone";
257
+ form.setFieldsValue({ [accountFieldName]: accountData, password, remember_me: true });
258
+ setLoginStep("password");
259
+ setRememberMe(true);
260
+ }
261
+ }
262
+ } catch (error) {
263
+ console.error("Failed to parse last login method:", error);
264
+ }
265
+ }, [loginMethods]);
266
+ const isLastLoginMethod = (0, import_react.useCallback)((methodType) => {
267
+ if (!lastLoginMethod) return false;
268
+ return lastLoginMethod.type === methodType;
269
+ }, [lastLoginMethod]);
270
+ const switchVerificationMethod = (0, import_react.useCallback)(
271
+ (method) => {
272
+ form.resetFields();
273
+ setLoginStep("account");
274
+ setEnteredAccount("");
275
+ setCurrentVerificationMethod(method);
276
+ },
277
+ [form]
278
+ );
279
+ const switchLoginMethod = (0, import_react.useCallback)(
280
+ (method) => {
281
+ form.resetFields();
282
+ setLoginStep("account");
283
+ setEnteredAccount("");
284
+ setHasStoredCredentials(false);
285
+ setCurrentLoginMethod(method);
286
+ if (method.type === "email" || method.type === "phone") {
287
+ setCurrentVerificationMethod(method.verificationMethods[0]);
288
+ }
289
+ },
290
+ [form]
291
+ );
292
+ const handleContinueWithAccountInternal = async () => {
293
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g;
294
+ try {
295
+ setLoading(true);
296
+ const accountFieldName = (currentLoginMethod == null ? void 0 : currentLoginMethod.type) === "email" ? "email" : "phone";
297
+ const accountValues = await form.validateFields([accountFieldName]);
298
+ const account = accountValues[accountFieldName];
299
+ if ((currentLoginMethod == null ? void 0 : currentLoginMethod.type) === "email" && registerAndLogin) {
300
+ const utils = ((_a2 = context == null ? void 0 : context.appHelper) == null ? void 0 : _a2.utils) || {};
301
+ const shopId = ((_g = (_f2 = (_e2 = (_d2 = (_c2 = (_b2 = utils.getStore) == null ? void 0 : _b2.call(utils)) == null ? void 0 : _c2.getState) == null ? void 0 : _d2.call(_c2)) == null ? void 0 : _e2.global) == null ? void 0 : _f2.shop) == null ? void 0 : _g.id) || 9;
302
+ const result = await registerAndLogin.checkEmailExists({
303
+ email: account,
304
+ shop_id: shopId
305
+ });
306
+ if (result.status && result.data) {
307
+ if (result.data.exists) {
308
+ setEnteredAccount(account);
309
+ setLoginStep("password");
310
+ form.setFieldsValue({ [accountFieldName]: account });
311
+ } else {
312
+ import_antd.message.error(
313
+ import_utils.locales.getText("pisell-login2-email-not-registered")
314
+ );
315
+ return;
316
+ }
317
+ } else {
318
+ import_antd.message.error(
319
+ result.message || import_utils.locales.getText("pisell-login2-check-email-failed")
320
+ );
321
+ return;
322
+ }
323
+ } else {
324
+ setEnteredAccount(account);
325
+ setLoginStep("password");
326
+ form.setFieldsValue({ [accountFieldName]: account });
327
+ }
328
+ } catch (error) {
329
+ if (error.errorFields) {
330
+ return;
331
+ }
332
+ console.error("Continue with account error:", error);
333
+ import_antd.message.error(
334
+ (error == null ? void 0 : error.message) || import_utils.locales.getText("pisell-login2-continue-failed")
335
+ );
336
+ } finally {
337
+ setLoading(false);
338
+ }
339
+ };
340
+ const { run: handleContinueWithAccount } = (0, import_ahooks.useDebounceFn)(handleContinueWithAccountInternal, {
341
+ wait: 200,
342
+ leading: true,
343
+ trailing: false
344
+ });
345
+ const handleBackToAccountInternal = () => {
346
+ setLoginStep("account");
347
+ form.resetFields(["password"]);
348
+ };
349
+ const { run: handleBackToAccount } = (0, import_ahooks.useDebounceFn)(handleBackToAccountInternal, {
350
+ wait: 200,
351
+ leading: true,
352
+ trailing: false
353
+ });
354
+ const handleSendCode = async () => {
355
+ var _a2;
356
+ try {
357
+ const accountFieldName = (currentLoginMethod == null ? void 0 : currentLoginMethod.type) === "email" ? "email" : "phone";
358
+ await form.validateFields([accountFieldName]);
359
+ const account = form.getFieldValue(accountFieldName);
360
+ if (!account) {
361
+ import_antd.message.error(import_utils.locales.getText("pisell-login2-account-required"));
362
+ return;
363
+ }
364
+ setLoading(true);
365
+ const type = (currentLoginMethod == null ? void 0 : currentLoginMethod.type) === "email" ? "email" : "phone";
366
+ if (registerAndLogin) {
367
+ let res;
368
+ if (type === "email") {
369
+ res = await registerAndLogin.sendEmailLoginCode({
370
+ type: "email",
371
+ target: account,
372
+ purpose: "login"
373
+ });
374
+ } else {
375
+ let phoneData;
376
+ if (typeof account === "string") {
377
+ phoneData = {
378
+ phone: account,
379
+ country_calling_code: ((_a2 = countries.find((country) => country.value === account)) == null ? void 0 : _a2.calling_code) || ""
380
+ };
381
+ } else {
382
+ phoneData = account;
383
+ }
384
+ res = await registerAndLogin.sendSmsLoginCode(phoneData);
385
+ }
386
+ if ((res == null ? void 0 : res.code) !== 200) {
387
+ throw new Error(
388
+ (res == null ? void 0 : res.message) || import_utils.locales.getText("pisell-login2-code-send-failed")
389
+ );
390
+ }
391
+ }
392
+ await (onSendVerificationCode == null ? void 0 : onSendVerificationCode(account, type, config.channel));
393
+ setEnteredAccount(account);
394
+ setLoginStep("code");
395
+ setCountdown(60);
396
+ import_antd.message.success(import_utils.locales.getText("pisell-login2-code-sent"));
397
+ } catch (error) {
398
+ if (error == null ? void 0 : error.errorFields) return;
399
+ import_antd.message.error(
400
+ (error == null ? void 0 : error.message) || import_utils.locales.getText("pisell-login2-code-send-failed")
401
+ );
402
+ } finally {
403
+ setLoading(false);
404
+ }
405
+ };
406
+ const handleCodeSubmit = async (code) => {
407
+ var _a2;
408
+ try {
409
+ setLoading(true);
410
+ setCodeError("");
411
+ const method = (currentLoginMethod == null ? void 0 : currentLoginMethod.type) || "email";
412
+ let result;
413
+ if (registerAndLogin) {
414
+ if (method === "email") {
415
+ result = await registerAndLogin.emailCodeLogin({
416
+ email: enteredAccount,
417
+ code
418
+ });
419
+ } else if (method === "phone") {
420
+ let phoneData;
421
+ if (typeof enteredAccount === "string") {
422
+ phoneData = {
423
+ phone: enteredAccount,
424
+ country_calling_code: ((_a2 = countries.find((country) => country.value === enteredAccount)) == null ? void 0 : _a2.calling_code) || ""
425
+ };
426
+ } else {
427
+ phoneData = enteredAccount;
428
+ }
429
+ result = await registerAndLogin.phoneCodeLogin({
430
+ phone: phoneData.phone,
431
+ country_calling_code: phoneData.country_calling_code,
432
+ code
433
+ });
434
+ }
435
+ if ((result == null ? void 0 : result.code) !== 200) {
436
+ const errorMessage = (result == null ? void 0 : result.message) || import_utils.locales.getText("pisell-login2-login-failed");
437
+ const error = new Error(errorMessage);
438
+ onError == null ? void 0 : onError(error, method);
439
+ setCodeError(errorMessage);
440
+ return;
441
+ }
442
+ }
443
+ const loginData = {
444
+ account: enteredAccount,
445
+ password: void 0,
446
+ verification_code: code,
447
+ remember_me: false
448
+ };
449
+ await (onLogin == null ? void 0 : onLogin(result.data, method, loginData, config.channel));
450
+ import_antd.message.success(import_utils.locales.getText("pisell-login2-login-success"));
451
+ } catch (error) {
452
+ setCodeError(
453
+ (error == null ? void 0 : error.message) || import_utils.locales.getText("pisell-login2-login-failed")
454
+ );
455
+ } finally {
456
+ setLoading(false);
457
+ }
458
+ };
459
+ const handleBackFromCode = () => {
460
+ setLoginStep("account");
461
+ form.resetFields();
462
+ setCodeError("");
463
+ };
464
+ const handleForgotPasswordClickInternal = () => {
465
+ const accountFieldName = (currentLoginMethod == null ? void 0 : currentLoginMethod.type) === "email" ? "email" : "phone";
466
+ const account = form.getFieldValue(accountFieldName);
467
+ setEnteredAccount(account || "");
468
+ setShowForgotPassword(true);
469
+ };
470
+ const { run: handleForgotPasswordClick } = (0, import_ahooks.useDebounceFn)(handleForgotPasswordClickInternal, {
471
+ wait: 200,
472
+ leading: true,
473
+ trailing: false
474
+ });
475
+ const handleCloseForgotPassword = () => {
476
+ setShowForgotPassword(false);
477
+ setCountdown(0);
478
+ };
479
+ const handleForgotPasswordSendLink = async (account) => {
480
+ try {
481
+ setLoading(true);
482
+ if (registerAndLogin) {
483
+ const res = await registerAndLogin.sendResetPasswordLink({
484
+ email: account
485
+ });
486
+ if (!res.status) {
487
+ throw new Error(res.message || "发送重置密码链接失败");
488
+ }
489
+ }
490
+ import_antd.message.success(import_utils.locales.getText("pisell-forgot-password-link-sent"));
491
+ } catch (error) {
492
+ import_antd.message.error((error == null ? void 0 : error.message) || "发送重置密码链接失败");
493
+ throw error;
494
+ } finally {
495
+ setLoading(false);
496
+ }
497
+ };
498
+ const handleForgotPasswordSendCode = async (account) => {
499
+ try {
500
+ setLoading(true);
501
+ const type = (currentLoginMethod == null ? void 0 : currentLoginMethod.type) === "email" ? "email" : "phone";
502
+ if (registerAndLogin) {
503
+ if (type === "email") {
504
+ const res = await registerAndLogin.sendPasswordResetEmail({
505
+ email: account
506
+ });
507
+ if (!res.status) {
508
+ throw new Error(
509
+ res.message || import_utils.locales.getText("pisell-login2-code-send-failed")
510
+ );
511
+ }
512
+ } else {
513
+ const phoneAccount = account;
514
+ const res = await registerAndLogin.sendPasswordResetSms({
515
+ phone: phoneAccount.phone,
516
+ country_calling_code: phoneAccount.country_calling_code
517
+ });
518
+ if (!res.status) {
519
+ throw new Error(
520
+ res.message || import_utils.locales.getText("pisell-login2-code-send-failed")
521
+ );
522
+ }
523
+ }
524
+ }
525
+ setCountdown(60);
526
+ import_antd.message.success(import_utils.locales.getText("pisell-login2-code-sent"));
527
+ } catch (error) {
528
+ import_antd.message.error(
529
+ (error == null ? void 0 : error.message) || import_utils.locales.getText("pisell-login2-code-send-failed")
530
+ );
531
+ throw error;
532
+ } finally {
533
+ setLoading(false);
534
+ }
535
+ };
536
+ const handleForgotPasswordVerifyCode = async (account, code) => {
537
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g;
538
+ try {
539
+ setLoading(true);
540
+ if (registerAndLogin) {
541
+ const utils = ((_a2 = context == null ? void 0 : context.appHelper) == null ? void 0 : _a2.utils) || {};
542
+ const shopId = ((_g = (_f2 = (_e2 = (_d2 = (_c2 = (_b2 = utils.getStore) == null ? void 0 : _b2.call(utils)) == null ? void 0 : _c2.getState) == null ? void 0 : _d2.call(_c2)) == null ? void 0 : _e2.global) == null ? void 0 : _f2.shop) == null ? void 0 : _g.id) || 9;
543
+ const isPhoneAccount = typeof account === "object" && "phone" in account;
544
+ let res;
545
+ if (!isPhoneAccount) {
546
+ res = await registerAndLogin.checkEmailCode({
547
+ email: account,
548
+ shop_id: shopId,
549
+ code,
550
+ action: "customer_reset_password_code"
551
+ });
552
+ } else {
553
+ const phoneData = account;
554
+ res = await registerAndLogin.checkMobileCode({
555
+ phone: phoneData.phone,
556
+ country_calling_code: phoneData.country_calling_code,
557
+ code
558
+ });
559
+ }
560
+ if (!res.status) {
561
+ throw new Error(res.message || "验证码验证失败");
562
+ }
563
+ if (!res.data.valid) {
564
+ throw new Error(import_utils.locales.getText("pisell-login2-code-verify-failed"));
565
+ }
566
+ }
567
+ } catch (error) {
568
+ import_antd.message.error((error == null ? void 0 : error.message) || "验证码验证失败");
569
+ throw error;
570
+ } finally {
571
+ setLoading(false);
572
+ }
573
+ };
574
+ const handleForgotPasswordReset = async (account, password, code) => {
575
+ try {
576
+ setLoading(true);
577
+ if (registerAndLogin) {
578
+ const isPhoneAccount2 = typeof account === "object" && "phone" in account;
579
+ let resetPasswordParams;
580
+ if (isPhoneAccount2) {
581
+ resetPasswordParams = {
582
+ type: "phone",
583
+ target: {
584
+ phone: account.phone,
585
+ country_calling_code: account.country_calling_code
586
+ },
587
+ password,
588
+ code
589
+ };
590
+ } else {
591
+ resetPasswordParams = {
592
+ type: "email",
593
+ target: {
594
+ email: account
595
+ },
596
+ password,
597
+ code
598
+ };
599
+ }
600
+ const res = await registerAndLogin.resetPassword(resetPasswordParams);
601
+ if ((res == null ? void 0 : res.code) !== 200) {
602
+ throw new Error((res == null ? void 0 : res.message) || "密码重置失败");
603
+ }
604
+ }
605
+ handleCloseForgotPassword();
606
+ const isPhoneAccount = typeof account === "object" && "phone" in account;
607
+ if (isPhoneAccount) {
608
+ const phoneMethod = config.loginMethods.find((method) => method.type === "phone");
609
+ if (phoneMethod) {
610
+ setCurrentLoginMethod(phoneMethod);
611
+ setCurrentVerificationMethod(phoneMethod.verificationMethods[0]);
612
+ }
613
+ form.setFieldsValue({ phone: account });
614
+ setEnteredAccount(account);
615
+ } else {
616
+ const emailMethod = config.loginMethods.find((method) => method.type === "email");
617
+ if (emailMethod) {
618
+ setCurrentLoginMethod(emailMethod);
619
+ setCurrentVerificationMethod(emailMethod.verificationMethods[0]);
620
+ }
621
+ form.setFieldsValue({ email: account });
622
+ setEnteredAccount(account);
623
+ }
624
+ setLoginStep("account");
625
+ } catch (error) {
626
+ import_antd.message.error((error == null ? void 0 : error.message) || "密码重置失败");
627
+ } finally {
628
+ setLoading(false);
629
+ }
630
+ };
631
+ const handleEmailLinkResetPassword = async (account, password, code) => {
632
+ try {
633
+ setLoading(true);
634
+ if (registerAndLogin) {
635
+ const res = await registerAndLogin.resetPasswordByCode({
636
+ code: config.emailLinkVerification.code,
637
+ password
638
+ });
639
+ if ((res == null ? void 0 : res.code) !== 200) {
640
+ throw new Error((res == null ? void 0 : res.message) || "密码重置失败");
641
+ }
642
+ }
643
+ handleCloseForgotPassword();
644
+ setEmailLinkVerifyStatus(null);
645
+ import_antd.message.success("密码重置成功");
646
+ } catch (error) {
647
+ import_antd.message.error((error == null ? void 0 : error.message) || "密码重置失败");
648
+ throw error;
649
+ } finally {
650
+ setLoading(false);
651
+ }
652
+ };
653
+ const handleGuestLoginInternal = async () => {
654
+ try {
655
+ setLoading(true);
656
+ if (registerAndLogin) {
657
+ const result = await registerAndLogin.guestLogin();
658
+ if (result.code === 200) {
659
+ import_antd.message.success(import_utils.locales.getText("pisell-login2-login-success"));
660
+ const loginMethodInfo = {
661
+ type: "guest",
662
+ verificationMethod: null,
663
+ timestamp: Date.now()
664
+ };
665
+ storage.set("pisell_last_login_method", JSON.stringify(loginMethodInfo));
666
+ onLogin == null ? void 0 : onLogin(
667
+ result.data,
668
+ "guest",
669
+ {
670
+ account: "guest",
671
+ password: void 0
672
+ },
673
+ config.channel
674
+ );
675
+ } else {
676
+ import_antd.message.error(
677
+ result.message || import_utils.locales.getText("pisell-login2-login-failed")
678
+ );
679
+ }
680
+ }
681
+ } catch (error) {
682
+ console.error("Guest login error:", error);
683
+ import_antd.message.error(import_utils.locales.getText("pisell-login2-login-failed"));
684
+ } finally {
685
+ setLoading(false);
686
+ }
687
+ };
688
+ const { run: handleGuestLogin } = (0, import_ahooks.useDebounceFn)(handleGuestLoginInternal, {
689
+ wait: 200,
690
+ leading: true,
691
+ trailing: false
692
+ });
693
+ const oauthProviders = (0, import_react.useMemo)(() => {
694
+ return loginMethods.filter(
695
+ (method) => ["google", "facebook", "apple", "guest"].includes(method.type)
696
+ ).map((method) => {
697
+ const isLast = isLastLoginMethod(method.type);
698
+ const commonConfig = {
699
+ className: (0, import_classnames.default)("login2-oauth-button", method.type, {
700
+ "has-last-login-badge": isLast
701
+ }),
702
+ badge: isLast ? import_utils.locales.getText("pisell-login2-last-login-badge") : void 0,
703
+ badgeClassName: "last-login-badge"
704
+ };
705
+ switch (method.type) {
706
+ case "google":
707
+ return {
708
+ key: "google",
709
+ label: /* @__PURE__ */ import_react.default.createElement("span", null, import_utils.locales.getText("pisell-login2-continue-with"), " Google"),
710
+ icon: /* @__PURE__ */ import_react.default.createElement(import_materials2.Iconfont, { type: "pisell2-google" }),
711
+ onClick: () => handleOAuthClick("google"),
712
+ ...commonConfig
713
+ };
714
+ case "facebook":
715
+ return {
716
+ key: "facebook",
717
+ label: /* @__PURE__ */ import_react.default.createElement("span", null, import_utils.locales.getText("pisell-login2-continue-with"), " Facebook"),
718
+ icon: /* @__PURE__ */ import_react.default.createElement(import_materials2.Iconfont, { type: "pisell2-facebook" }),
719
+ onClick: () => handleOAuthClick("facebook"),
720
+ ...commonConfig
721
+ };
722
+ case "apple":
723
+ return {
724
+ key: "apple",
725
+ label: /* @__PURE__ */ import_react.default.createElement("span", null, import_utils.locales.getText("pisell-login2-continue-with"), " Apple"),
726
+ icon: /* @__PURE__ */ import_react.default.createElement(import_materials2.Iconfont, { type: "pisell2-apple" }),
727
+ onClick: () => handleOAuthClick("apple"),
728
+ ...commonConfig
729
+ };
730
+ case "guest":
731
+ return {
732
+ key: "guest",
733
+ label: import_utils.locales.getText("pisell-login2-login-as-guest"),
734
+ icon: /* @__PURE__ */ import_react.default.createElement(import_materials2.Iconfont, { type: "pisell2-user-01" }),
735
+ onClick: handleGuestLogin,
736
+ ...commonConfig
737
+ };
738
+ default:
739
+ return null;
740
+ }
741
+ }).filter(Boolean);
742
+ }, [handleGuestLogin, handleOAuthClick, isLastLoginMethod, loginMethods]);
743
+ const handleLoginInternal = async () => {
744
+ var _a2;
745
+ try {
746
+ setLoading(true);
747
+ const values = await form.validateFields();
748
+ const accountFieldName = (currentLoginMethod == null ? void 0 : currentLoginMethod.type) === "email" ? "email" : "phone";
749
+ const account = values[accountFieldName] || values.account;
750
+ const loginData = {
751
+ account,
752
+ password: currentVerificationMethod === "password" ? values.password : void 0,
753
+ verification_code: currentVerificationMethod === "verification_code" ? values.verification_code : void 0,
754
+ remember_me: values.remember_me
755
+ };
756
+ const method = (currentLoginMethod == null ? void 0 : currentLoginMethod.type) || "email";
757
+ let result;
758
+ if (registerAndLogin) {
759
+ if (method === "email") {
760
+ if (currentVerificationMethod === "password") {
761
+ result = await registerAndLogin.emailPasswordLogin({
762
+ email: account,
763
+ password: values.password
764
+ });
765
+ } else {
766
+ result = await registerAndLogin.emailCodeLogin({
767
+ email: account,
768
+ code: values.verification_code
769
+ });
770
+ }
771
+ } else if (method === "phone") {
772
+ let phoneData;
773
+ if (typeof account === "string") {
774
+ phoneData = {
775
+ phone: account,
776
+ country_calling_code: ((_a2 = countries.find((country) => country.value === account)) == null ? void 0 : _a2.calling_code) || ""
777
+ };
778
+ } else {
779
+ phoneData = account;
780
+ }
781
+ if (currentVerificationMethod === "password") {
782
+ result = await registerAndLogin.phonePasswordLogin({
783
+ phone: phoneData.phone,
784
+ country_calling_code: phoneData.country_calling_code,
785
+ password: values.password
786
+ });
787
+ } else {
788
+ result = await registerAndLogin.phoneCodeLogin({
789
+ phone: phoneData.phone,
790
+ country_calling_code: phoneData.country_calling_code,
791
+ code: values.verification_code
792
+ });
793
+ }
794
+ }
795
+ if ((result == null ? void 0 : result.code) !== 200) {
796
+ throw new Error(
797
+ (result == null ? void 0 : result.message) || import_utils.locales.getText("pisell-login2-login-failed")
798
+ );
799
+ }
800
+ }
801
+ await (onLogin == null ? void 0 : onLogin(result.data, method, loginData, config.channel));
802
+ const loginMethodInfo = {
803
+ type: method,
804
+ verificationMethod: currentVerificationMethod,
805
+ timestamp: Date.now()
806
+ };
807
+ storage.set("pisell_last_login_method", JSON.stringify(loginMethodInfo));
808
+ if (values.remember_me && account) {
809
+ storage.set("login_account", JSON.stringify(account));
810
+ storage.set("login_remember_me", "true");
811
+ if (currentVerificationMethod === "password") {
812
+ storage.set("login_password", values.password);
813
+ }
814
+ setEnteredAccount(account);
815
+ } else {
816
+ storage.remove("login_account");
817
+ storage.remove("login_remember_me");
818
+ storage.remove("login_password");
819
+ }
820
+ import_antd.message.success(import_utils.locales.getText("pisell-login2-login-success"));
821
+ } catch (error) {
822
+ if (error.errorFields) {
823
+ return;
824
+ }
825
+ import_antd.message.error(
826
+ (error == null ? void 0 : error.message) || import_utils.locales.getText("pisell-login2-login-failed")
827
+ );
828
+ } finally {
829
+ setLoading(false);
830
+ }
831
+ };
832
+ const { run: handleLogin } = (0, import_ahooks.useDebounceFn)(handleLoginInternal, {
833
+ wait: 1e3,
834
+ leading: true,
835
+ trailing: false
836
+ });
837
+ const handleOAuthClickInternal = async (provider) => {
838
+ var _a2, _b2;
839
+ try {
840
+ setLoading(true);
841
+ if (provider === "facebook") {
842
+ const fbConfig = (_a2 = config == null ? void 0 : config.loginMethods) == null ? void 0 : _a2.find((n) => n.type === "facebook");
843
+ const token = fbConfig == null ? void 0 : fbConfig.appId;
844
+ if (token) {
845
+ await registerAndLogin.loginWithFacebook(token);
846
+ } else {
847
+ throw new Error("Facebook app_id not configured");
848
+ }
849
+ } else if (provider === "apple") {
850
+ const appleConfig = (_b2 = config == null ? void 0 : config.loginMethods) == null ? void 0 : _b2.find((n) => n.type === "apple");
851
+ const token = appleConfig == null ? void 0 : appleConfig.clientId;
852
+ if (token) {
853
+ await registerAndLogin.loginWithApple(token);
854
+ } else {
855
+ throw new Error("Apple client_id not configured");
856
+ }
857
+ } else {
858
+ await (onOAuthLogin == null ? void 0 : onOAuthLogin(provider, config.channel));
859
+ }
860
+ } catch (error) {
861
+ import_antd.message.error(
862
+ (error == null ? void 0 : error.message) || import_utils.locales.getText("pisell-login2-login-failed")
863
+ );
864
+ } finally {
865
+ setLoading(false);
866
+ }
867
+ };
868
+ const { run: handleOAuthClick } = (0, import_ahooks.useDebounceFn)(handleOAuthClickInternal, {
869
+ wait: 200,
870
+ leading: true,
871
+ trailing: false
872
+ });
873
+ const renderMainLoginForm = () => {
874
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
875
+ if (!currentLoginMethod) return null;
876
+ const { type } = currentLoginMethod;
877
+ if (type === "google" || type === "facebook" || type === "apple" || type === "guest") {
878
+ return null;
879
+ }
880
+ const hasEmailOrPhoneMethod = loginMethods.some(
881
+ (method) => method.type === "email" || method.type === "phone"
882
+ );
883
+ if (!hasEmailOrPhoneMethod) {
884
+ return null;
885
+ }
886
+ const isEmail = type === "email";
887
+ const isPhone = type === "phone";
888
+ const accountFieldName = isEmail ? "email" : "phone";
889
+ const getAccountValue = (values) => {
890
+ if (values) {
891
+ return values[accountFieldName] || values.account;
892
+ }
893
+ return form.getFieldValue(accountFieldName) || form.getFieldValue("account");
894
+ };
895
+ const accountLabel = isEmail ? ((_c2 = (_b2 = (_a2 = config.ui) == null ? void 0 : _a2.formLabels) == null ? void 0 : _b2.email) == null ? void 0 : _c2.show) !== false ? ((_f2 = (_e2 = (_d2 = config.ui) == null ? void 0 : _d2.formLabels) == null ? void 0 : _e2.email) == null ? void 0 : _f2.text) || import_utils.locales.getText("pisell-login2-email-label") : void 0 : ((_i = (_h = (_g = config.ui) == null ? void 0 : _g.formLabels) == null ? void 0 : _h.phone) == null ? void 0 : _i.show) !== false ? ((_l = (_k = (_j = config.ui) == null ? void 0 : _j.formLabels) == null ? void 0 : _k.phone) == null ? void 0 : _l.text) || import_utils.locales.getText("pisell-login2-phone-label") : void 0;
896
+ const accountPlaceholder = isEmail ? import_utils.locales.getText("pisell-login2-email-placeholder") : import_utils.locales.getText("pisell-login2-phone-placeholder");
897
+ const accountRules = isEmail ? [
898
+ {
899
+ required: true,
900
+ message: import_utils.locales.getText("pisell-login2-email-required")
901
+ },
902
+ {
903
+ type: "email",
904
+ message: import_utils.locales.getText("pisell-login2-email-invalid")
905
+ }
906
+ ] : (0, import_phoneValidation.createPhoneValidationRules)(import_utils.locales.getText, true);
907
+ const useStepByStep = (currentLoginMethod == null ? void 0 : currentLoginMethod.stepByStep) && currentVerificationMethod === "password";
908
+ if (useStepByStep) {
909
+ const isPasswordStep = loginStep === "password";
910
+ const showPasswordField = isPasswordStep;
911
+ const handleFormSubmit = (e) => {
912
+ e == null ? void 0 : e.preventDefault();
913
+ if (isPasswordStep) {
914
+ handleLogin();
915
+ } else {
916
+ handleContinueWithAccount();
917
+ }
918
+ };
919
+ return /* @__PURE__ */ import_react.default.createElement(
920
+ import_antd.Form,
921
+ {
922
+ form,
923
+ layout: "vertical",
924
+ className: "login2-form",
925
+ size: "large"
926
+ },
927
+ (isEmail || isPhone) && !showPasswordField && /* @__PURE__ */ import_react.default.createElement("div", { style: { position: "absolute", left: "-9999px", opacity: 0, pointerEvents: "none" } }, /* @__PURE__ */ import_react.default.createElement(
928
+ "input",
929
+ {
930
+ type: "text",
931
+ name: "username",
932
+ autoComplete: "username",
933
+ tabIndex: -1,
934
+ readOnly: true,
935
+ "aria-hidden": "true"
936
+ }
937
+ )),
938
+ showPasswordField && /* @__PURE__ */ import_react.default.createElement("div", { className: "login2-account-show-text-edit" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "login2-account-show-text-edit-text" }, isPhone && `+${(_m = getAccountValue()) == null ? void 0 : _m.country_calling_code}${(_n = getAccountValue()) == null ? void 0 : _n.phone}` || "", isEmail && getAccountValue() || ""), /* @__PURE__ */ import_react.default.createElement("span", { className: "login2-account-show-text-edit-icon", onClick: handleBackToAccount }, /* @__PURE__ */ import_react.default.createElement(import_materials2.Iconfont, { type: "pisell2-edit-05" }))),
939
+ /* @__PURE__ */ import_react.default.createElement(
940
+ import_antd.Form.Item,
941
+ {
942
+ style: { display: showPasswordField ? "none" : "block" },
943
+ label: accountLabel,
944
+ name: isEmail ? "email" : "phone",
945
+ rules: accountRules,
946
+ validateTrigger: ["onBlur", "onSubmit"],
947
+ className: isPhone ? "phone-input-form-item" : ""
948
+ },
949
+ isPhone ? /* @__PURE__ */ import_react.default.createElement(
950
+ import_PhoneInput.default,
951
+ {
952
+ size: "large",
953
+ placeholder: accountPlaceholder,
954
+ className: "login2-phone-input",
955
+ countries,
956
+ valueFormat: "object",
957
+ value: isPasswordStep ? enteredAccount : getAccountValue() || void 0,
958
+ onChange: (value) => {
959
+ if (isPasswordStep) {
960
+ setEnteredAccount(value);
961
+ }
962
+ form.setFieldsValue({ [accountFieldName]: value });
963
+ }
964
+ }
965
+ ) : /* @__PURE__ */ import_react.default.createElement(
966
+ import_materials.Input,
967
+ {
968
+ size: "large",
969
+ placeholder: accountPlaceholder,
970
+ className: "login2-input",
971
+ type: "email",
972
+ autoComplete: "email",
973
+ value: getAccountValue() || enteredAccount || "",
974
+ onChange: (e) => {
975
+ const newValue = e.target.value;
976
+ if (isPasswordStep) {
977
+ setEnteredAccount(newValue);
978
+ }
979
+ form.setFieldsValue({ [accountFieldName]: newValue });
980
+ },
981
+ onKeyDown: (e) => {
982
+ if (e.key === "Enter" && !e.shiftKey && !e.ctrlKey && !e.metaKey) {
983
+ e.preventDefault();
984
+ handleFormSubmit(e);
985
+ }
986
+ }
987
+ }
988
+ )
989
+ ),
990
+ /* @__PURE__ */ import_react.default.createElement(
991
+ import_antd.Form.Item,
992
+ {
993
+ style: { display: showPasswordField ? "block" : "none" },
994
+ label: ((_q = (_p = (_o = config.ui) == null ? void 0 : _o.formLabels) == null ? void 0 : _p.password) == null ? void 0 : _q.show) !== false ? ((_t = (_s = (_r = config.ui) == null ? void 0 : _r.formLabels) == null ? void 0 : _s.password) == null ? void 0 : _t.text) || import_utils.locales.getText("pisell-login2-password-label") : void 0,
995
+ name: "password",
996
+ validateTrigger: ["onBlur", "onSubmit"],
997
+ rules: passwordValidationRules
998
+ },
999
+ /* @__PURE__ */ import_react.default.createElement(
1000
+ import_materials.Input.Password,
1001
+ {
1002
+ size: "large",
1003
+ placeholder: import_utils.locales.getText(
1004
+ "pisell-login2-password-placeholder"
1005
+ ),
1006
+ className: "login2-input",
1007
+ name: "password",
1008
+ autoComplete: "current-password",
1009
+ type: "password",
1010
+ autoFocus: hasStoredCredentials,
1011
+ onKeyDown: (e) => {
1012
+ if (e.key === "Enter" && !e.shiftKey && !e.ctrlKey && !e.metaKey) {
1013
+ e.preventDefault();
1014
+ handleFormSubmit(e);
1015
+ }
1016
+ }
1017
+ }
1018
+ )
1019
+ ),
1020
+ showPasswordField && /* @__PURE__ */ import_react.default.createElement("div", { className: "login2-form-footer" }, /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { name: "remember_me", valuePropName: "checked", noStyle: true }, /* @__PURE__ */ import_react.default.createElement(import_materials.Checkbox, { defaultChecked: rememberMe }, import_utils.locales.getText("pisell-login2-remember-me"))), /* @__PURE__ */ import_react.default.createElement("a", { className: "login2-link", onClick: handleForgotPasswordClick }, import_utils.locales.getText("pisell-login2-forgot-password"))),
1021
+ /* @__PURE__ */ import_react.default.createElement(
1022
+ import_materials.Button,
1023
+ {
1024
+ type: "primary",
1025
+ size: "large",
1026
+ block: true,
1027
+ htmlType: "button",
1028
+ loading,
1029
+ onClick: handleFormSubmit,
1030
+ className: "login2-submit-button"
1031
+ },
1032
+ isPasswordStep ? import_utils.locales.getText("pisell-login2-login-button") : isEmail ? import_utils.locales.getText("pisell-login2-continue-with-email") : import_utils.locales.getText("pisell-login2-continue-with-phone")
1033
+ ),
1034
+ showPasswordField && /* @__PURE__ */ import_react.default.createElement(
1035
+ import_materials.Button,
1036
+ {
1037
+ size: "large",
1038
+ block: true,
1039
+ onClick: handleBackToAccount,
1040
+ className: "login2-back-button"
1041
+ },
1042
+ import_utils.locales.getText("pisell-login2-back")
1043
+ )
1044
+ );
1045
+ }
1046
+ if (currentVerificationMethod === "verification_code" && loginStep === "account") {
1047
+ const handleFormSubmit = (e) => {
1048
+ e == null ? void 0 : e.preventDefault();
1049
+ handleSendCode();
1050
+ };
1051
+ return /* @__PURE__ */ import_react.default.createElement(
1052
+ import_antd.Form,
1053
+ {
1054
+ form,
1055
+ layout: "vertical",
1056
+ className: "login2-form",
1057
+ size: "large"
1058
+ },
1059
+ isEmail && /* @__PURE__ */ import_react.default.createElement("div", { style: { position: "absolute", left: "-9999px", opacity: 0, pointerEvents: "none" } }, /* @__PURE__ */ import_react.default.createElement(
1060
+ "input",
1061
+ {
1062
+ type: "text",
1063
+ name: "username",
1064
+ autoComplete: "username",
1065
+ tabIndex: -1,
1066
+ readOnly: true,
1067
+ "aria-hidden": "true"
1068
+ }
1069
+ )),
1070
+ /* @__PURE__ */ import_react.default.createElement(
1071
+ import_antd.Form.Item,
1072
+ {
1073
+ label: accountLabel,
1074
+ name: accountFieldName,
1075
+ rules: accountRules,
1076
+ className: isPhone ? "phone-input-form-item" : "",
1077
+ validateTrigger: ["onBlur", "onSubmit"]
1078
+ },
1079
+ isPhone ? /* @__PURE__ */ import_react.default.createElement(
1080
+ import_PhoneInput.default,
1081
+ {
1082
+ size: "large",
1083
+ placeholder: accountPlaceholder,
1084
+ className: "login2-phone-input",
1085
+ countries,
1086
+ valueFormat: "object",
1087
+ onKeyDown: (e) => {
1088
+ if (e.key === "Enter" && !e.shiftKey && !e.ctrlKey && !e.metaKey) {
1089
+ e.preventDefault();
1090
+ handleFormSubmit(e);
1091
+ }
1092
+ }
1093
+ }
1094
+ ) : /* @__PURE__ */ import_react.default.createElement(
1095
+ import_materials.Input,
1096
+ {
1097
+ size: "large",
1098
+ placeholder: accountPlaceholder,
1099
+ className: "login2-input",
1100
+ type: "email",
1101
+ autoComplete: "email",
1102
+ onKeyDown: (e) => {
1103
+ if (e.key === "Enter" && !e.shiftKey && !e.ctrlKey && !e.metaKey) {
1104
+ e.preventDefault();
1105
+ handleFormSubmit(e);
1106
+ }
1107
+ }
1108
+ }
1109
+ )
1110
+ ),
1111
+ /* @__PURE__ */ import_react.default.createElement(
1112
+ import_materials.Button,
1113
+ {
1114
+ type: "primary",
1115
+ size: "large",
1116
+ block: true,
1117
+ htmlType: "button",
1118
+ loading,
1119
+ onClick: handleFormSubmit,
1120
+ className: "login2-submit-button"
1121
+ },
1122
+ isEmail ? import_utils.locales.getText("pisell-login2-continue-with-email") : import_utils.locales.getText("pisell-login2-continue-with-phone")
1123
+ )
1124
+ );
1125
+ }
1126
+ return /* @__PURE__ */ import_react.default.createElement(
1127
+ import_antd.Form,
1128
+ {
1129
+ form,
1130
+ layout: "vertical",
1131
+ className: "login2-form",
1132
+ size: "large",
1133
+ onFinish: handleLogin
1134
+ },
1135
+ isEmail && /* @__PURE__ */ import_react.default.createElement("div", { style: { position: "absolute", left: "-9999px", opacity: 0, pointerEvents: "none" } }, /* @__PURE__ */ import_react.default.createElement(
1136
+ "input",
1137
+ {
1138
+ type: "text",
1139
+ name: "username",
1140
+ autoComplete: "username",
1141
+ tabIndex: -1,
1142
+ readOnly: true,
1143
+ "aria-hidden": "true"
1144
+ }
1145
+ )),
1146
+ isEmail ? /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { label: accountLabel, name: accountFieldName, rules: accountRules, validateTrigger: ["onBlur", "onSubmit"] }, /* @__PURE__ */ import_react.default.createElement(
1147
+ import_materials.Input,
1148
+ {
1149
+ size: "large",
1150
+ placeholder: accountPlaceholder,
1151
+ className: "login2-input",
1152
+ type: "email",
1153
+ autoComplete: "email",
1154
+ value: getAccountValue() || enteredAccount || "",
1155
+ onChange: (e) => {
1156
+ const newValue = e.target.value;
1157
+ setEnteredAccount(newValue);
1158
+ form.setFieldsValue({ [accountFieldName]: newValue });
1159
+ }
1160
+ }
1161
+ )) : /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { label: accountLabel, name: accountFieldName, rules: accountRules, validateTrigger: ["onBlur", "onSubmit"] }, /* @__PURE__ */ import_react.default.createElement(
1162
+ import_PhoneInput.default,
1163
+ {
1164
+ size: "large",
1165
+ placeholder: accountPlaceholder,
1166
+ className: "login2-phone-input",
1167
+ countries,
1168
+ valueFormat: "object"
1169
+ }
1170
+ )),
1171
+ /* @__PURE__ */ import_react.default.createElement(
1172
+ import_antd.Form.Item,
1173
+ {
1174
+ label: ((_w = (_v = (_u = config.ui) == null ? void 0 : _u.formLabels) == null ? void 0 : _v.password) == null ? void 0 : _w.show) !== false ? ((_z = (_y = (_x = config.ui) == null ? void 0 : _x.formLabels) == null ? void 0 : _y.password) == null ? void 0 : _z.text) || import_utils.locales.getText("pisell-login2-password-label") : void 0,
1175
+ name: "password",
1176
+ rules: passwordValidationRules,
1177
+ validateTrigger: ["onBlur", "onSubmit"]
1178
+ },
1179
+ /* @__PURE__ */ import_react.default.createElement(
1180
+ import_materials.Input.Password,
1181
+ {
1182
+ size: "large",
1183
+ placeholder: import_utils.locales.getText("pisell-login2-password-placeholder"),
1184
+ className: "login2-input",
1185
+ name: "password",
1186
+ autoComplete: "current-password",
1187
+ type: "password"
1188
+ }
1189
+ )
1190
+ ),
1191
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "login2-form-footer" }, /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { name: "remember_me", valuePropName: "checked", noStyle: true }, /* @__PURE__ */ import_react.default.createElement(import_materials.Checkbox, null, import_utils.locales.getText("pisell-login2-remember-me"))), currentVerificationMethod === "password" && /* @__PURE__ */ import_react.default.createElement("a", { className: "login2-link", onClick: handleForgotPasswordClick }, import_utils.locales.getText("pisell-login2-forgot-password"))),
1192
+ /* @__PURE__ */ import_react.default.createElement(
1193
+ import_materials.Button,
1194
+ {
1195
+ type: "primary",
1196
+ size: "large",
1197
+ block: true,
1198
+ htmlType: "submit",
1199
+ loading,
1200
+ onClick: handleLogin,
1201
+ className: "login2-submit-button"
1202
+ },
1203
+ import_utils.locales.getText("pisell-login2-login-button")
1204
+ )
1205
+ );
1206
+ };
1207
+ const renderSwitchOptions = () => {
1208
+ if (!currentLoginMethod) return null;
1209
+ const nonOauthButtons = [];
1210
+ if (currentLoginMethod.type === "email" || currentLoginMethod.type === "phone") {
1211
+ (currentLoginMethod.verificationMethods || []).filter((method) => method !== currentVerificationMethod).forEach((method) => {
1212
+ if (method === "verification_code") {
1213
+ const text = currentLoginMethod.type === "email" ? import_utils.locales.getText("pisell-login2-switch-to-email-code") : import_utils.locales.getText("pisell-login2-switch-to-sms-code");
1214
+ nonOauthButtons.push(
1215
+ /* @__PURE__ */ import_react.default.createElement(
1216
+ "button",
1217
+ {
1218
+ key: "switch-to-code",
1219
+ className: "login2-switch-option-button",
1220
+ onClick: () => switchVerificationMethod("verification_code")
1221
+ },
1222
+ currentLoginMethod.type === "email" ? /* @__PURE__ */ import_react.default.createElement(import_materials2.Iconfont, { type: "pisell2-mail-01" }) : /* @__PURE__ */ import_react.default.createElement(import_materials2.Iconfont, { type: "pisell2-phone" }),
1223
+ /* @__PURE__ */ import_react.default.createElement("span", { className: "option-text" }, text)
1224
+ )
1225
+ );
1226
+ } else {
1227
+ nonOauthButtons.push(
1228
+ /* @__PURE__ */ import_react.default.createElement(
1229
+ "button",
1230
+ {
1231
+ key: "switch-to-password",
1232
+ className: "login2-switch-option-button",
1233
+ onClick: () => switchVerificationMethod("password")
1234
+ },
1235
+ /* @__PURE__ */ import_react.default.createElement(import_materials2.Iconfont, { type: "pisell2-key-01" }),
1236
+ /* @__PURE__ */ import_react.default.createElement("span", { className: "option-text" }, import_utils.locales.getText("pisell-login2-switch-to-password"))
1237
+ )
1238
+ );
1239
+ }
1240
+ });
1241
+ }
1242
+ loginMethods.forEach((method, index) => {
1243
+ if (method.type === "email" || method.type === "phone") {
1244
+ if (method.type === currentLoginMethod.type) {
1245
+ return;
1246
+ }
1247
+ const isLast = isLastLoginMethod(method.type);
1248
+ const className2 = (0, import_classnames.default)(
1249
+ "login2-switch-option-button",
1250
+ { "has-last-login-badge": isLast }
1251
+ );
1252
+ nonOauthButtons.push(
1253
+ /* @__PURE__ */ import_react.default.createElement(
1254
+ "button",
1255
+ {
1256
+ key: `${method.type}-${index}`,
1257
+ className: className2,
1258
+ onClick: () => switchLoginMethod(method)
1259
+ },
1260
+ isLast && /* @__PURE__ */ import_react.default.createElement("div", { className: "last-login-badge" }, import_utils.locales.getText("pisell-login2-last-login-badge")),
1261
+ /* @__PURE__ */ import_react.default.createElement(
1262
+ import_materials2.Iconfont,
1263
+ {
1264
+ type: method.type === "email" ? "pisell2-mail-01" : "pisell2-phone"
1265
+ }
1266
+ ),
1267
+ /* @__PURE__ */ import_react.default.createElement("span", { className: "option-text" }, method.type === "email" ? import_utils.locales.getText("pisell-login2-switch-to-email") : import_utils.locales.getText("pisell-login2-switch-to-phone"))
1268
+ )
1269
+ );
1270
+ }
1271
+ });
1272
+ const showDivider = nonOauthButtons.length > 0 && oauthProviders.length > 0;
1273
+ const registerPrompt = onSwitchToRegister && /* @__PURE__ */ import_react.default.createElement("div", { className: "login2-register-prompt" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "register-prompt-text" }, import_utils.locales.getText("pisell-login2-no-account")), /* @__PURE__ */ import_react.default.createElement(
1274
+ "button",
1275
+ {
1276
+ className: "register-prompt-link",
1277
+ onClick: onSwitchToRegister
1278
+ },
1279
+ import_utils.locales.getText("pisell-login2-register-link")
1280
+ ));
1281
+ if (!nonOauthButtons.length && !oauthProviders.length) {
1282
+ return registerPrompt;
1283
+ }
1284
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, showDivider && /* @__PURE__ */ import_react.default.createElement("div", { className: "login2-divider" }, import_utils.locales.getText("pisell-login2-or")), nonOauthButtons.length > 0 && /* @__PURE__ */ import_react.default.createElement("div", { className: "login2-switch-options" }, nonOauthButtons), oauthProviders.length > 0 && /* @__PURE__ */ import_react.default.createElement(
1285
+ import_OAuthButtonGroup.default,
1286
+ {
1287
+ providers: oauthProviders,
1288
+ wrapperClassName: "login2-oauth-buttons",
1289
+ buttonClassName: "login2-oauth-button",
1290
+ gap: 12
1291
+ }
1292
+ ), registerPrompt);
1293
+ };
1294
+ if (!visible) {
1295
+ return null;
1296
+ }
1297
+ const { ui } = config;
1298
+ if (isEmailLinkVerification) {
1299
+ if (emailLinkVerifyStatus === "verifying") {
1300
+ return /* @__PURE__ */ import_react.default.createElement(
1301
+ "div",
1302
+ {
1303
+ className: (0, import_classnames.default)("login2-container", className),
1304
+ style: {
1305
+ ...style,
1306
+ "--theme-color": (ui == null ? void 0 : ui.themeColor) || "#7F56D9"
1307
+ }
1308
+ },
1309
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "login2-email-link-verifying" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "verifying-content" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "verifying-icon" }, /* @__PURE__ */ import_react.default.createElement(import_materials2.Iconfont, { type: "icon-loading", spin: true })), /* @__PURE__ */ import_react.default.createElement("h2", { className: "verifying-title" }, "Verifying your email..."), /* @__PURE__ */ import_react.default.createElement("p", { className: "verifying-desc" }, "Please wait while we verify your email link.")))
1310
+ );
1311
+ }
1312
+ if (emailLinkVerifyStatus === "success") {
1313
+ return /* @__PURE__ */ import_react.default.createElement(
1314
+ "div",
1315
+ {
1316
+ className: (0, import_classnames.default)("login2-container", className),
1317
+ style: {
1318
+ ...style,
1319
+ "--theme-color": (ui == null ? void 0 : ui.themeColor) || "#7F56D9"
1320
+ }
1321
+ },
1322
+ /* @__PURE__ */ import_react.default.createElement(
1323
+ import_SetPassword.default,
1324
+ {
1325
+ scenario: "reset",
1326
+ flowData: {
1327
+ account: resetPasswordUserEmail || "",
1328
+ accountType: "email",
1329
+ verificationMethod: "verification_code"
1330
+ },
1331
+ onSubmit: async (password, confirmPassword) => {
1332
+ try {
1333
+ if (registerAndLogin == null ? void 0 : registerAndLogin.resetPasswordByCode) {
1334
+ const result = await registerAndLogin.resetPasswordByCode({
1335
+ code: config.emailLinkVerification.code,
1336
+ password
1337
+ });
1338
+ if (result.status) {
1339
+ import_antd.message.success("密码重置成功");
1340
+ setEmailLinkVerifyStatus(null);
1341
+ setEmailLinkError("");
1342
+ if (resetPasswordUserEmail) {
1343
+ const emailMethod = config.loginMethods.find((method) => method.type === "email");
1344
+ if (emailMethod) {
1345
+ setCurrentLoginMethod(emailMethod);
1346
+ setCurrentVerificationMethod(emailMethod.verificationMethods[0]);
1347
+ }
1348
+ form.setFieldsValue({ email: resetPasswordUserEmail });
1349
+ setEnteredAccount(resetPasswordUserEmail);
1350
+ setLoginStep("account");
1351
+ }
1352
+ } else {
1353
+ import_antd.message.error(result.message || "密码重置失败");
1354
+ }
1355
+ } else {
1356
+ import_antd.message.error("系统错误,请稍后重试");
1357
+ }
1358
+ } catch (error) {
1359
+ import_antd.message.error((error == null ? void 0 : error.message) || "密码重置失败");
1360
+ }
1361
+ },
1362
+ onBack: () => {
1363
+ setEmailLinkVerifyStatus(null);
1364
+ setEmailLinkError("");
1365
+ },
1366
+ loading
1367
+ }
1368
+ )
1369
+ );
1370
+ }
1371
+ if (emailLinkVerifyStatus === "error") {
1372
+ return /* @__PURE__ */ import_react.default.createElement(
1373
+ "div",
1374
+ {
1375
+ className: (0, import_classnames.default)("login2-container", className),
1376
+ style: {
1377
+ ...style,
1378
+ "--theme-color": (ui == null ? void 0 : ui.themeColor) || "#7F56D9"
1379
+ }
1380
+ },
1381
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "login2-email-link-error" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "error-content" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "error-icon" }, /* @__PURE__ */ import_react.default.createElement(import_materials2.Iconfont, { type: "icon-error" })), /* @__PURE__ */ import_react.default.createElement("h2", { className: "error-title" }, import_utils.locales.getText("pisell-login2-verification-failed-title")), /* @__PURE__ */ import_react.default.createElement("p", { className: "error-desc" }, emailLinkError), /* @__PURE__ */ import_react.default.createElement(
1382
+ import_materials.Button,
1383
+ {
1384
+ type: "primary",
1385
+ size: "large",
1386
+ block: true,
1387
+ className: "login2-error-main-button",
1388
+ onClick: () => {
1389
+ setEmailLinkVerifyStatus(null);
1390
+ setEmailLinkError("");
1391
+ }
1392
+ },
1393
+ import_utils.locales.getText("pisell-login2-login-button")
1394
+ )))
1395
+ );
1396
+ }
1397
+ }
1398
+ if (showForgotPassword) {
1399
+ const accountType = (currentLoginMethod == null ? void 0 : currentLoginMethod.type) === "email" ? "email" : "phone";
1400
+ return /* @__PURE__ */ import_react.default.createElement(
1401
+ "div",
1402
+ {
1403
+ className: (0, import_classnames.default)("login2-container", className),
1404
+ style: {
1405
+ ...style,
1406
+ "--theme-color": (ui == null ? void 0 : ui.themeColor) || "#7F56D9"
1407
+ }
1408
+ },
1409
+ /* @__PURE__ */ import_react.default.createElement(
1410
+ import_ForgotPasswordFlow.default,
1411
+ {
1412
+ initialEmail: enteredAccount,
1413
+ accountType,
1414
+ onSendCode: handleForgotPasswordSendCode,
1415
+ onVerifyCode: handleForgotPasswordVerifyCode,
1416
+ onResetPassword: isEmailLinkVerification ? handleEmailLinkResetPassword : handleForgotPasswordReset,
1417
+ onSendResetLink: handleForgotPasswordSendLink,
1418
+ onBack: handleCloseForgotPassword,
1419
+ loading,
1420
+ countdown,
1421
+ countries
1422
+ }
1423
+ )
1424
+ );
1425
+ }
1426
+ if (loginStep === "code") {
1427
+ const accountType = (currentLoginMethod == null ? void 0 : currentLoginMethod.type) === "email" ? "email" : "phone";
1428
+ return /* @__PURE__ */ import_react.default.createElement(
1429
+ "div",
1430
+ {
1431
+ className: (0, import_classnames.default)("login2-container", className),
1432
+ style: {
1433
+ ...style,
1434
+ "--theme-color": (ui == null ? void 0 : ui.themeColor) || "#7F56D9"
1435
+ }
1436
+ },
1437
+ /* @__PURE__ */ import_react.default.createElement(
1438
+ import_LoginCodeInput.default,
1439
+ {
1440
+ account: typeof enteredAccount === "string" ? enteredAccount : enteredAccount.phone,
1441
+ accountType,
1442
+ codeLength: 4,
1443
+ onSubmit: handleCodeSubmit,
1444
+ onResend: handleSendCode,
1445
+ onBack: handleBackFromCode,
1446
+ countdown,
1447
+ loading,
1448
+ error: codeError,
1449
+ onClearError: () => setCodeError("")
1450
+ }
1451
+ )
1452
+ );
1453
+ }
1454
+ return /* @__PURE__ */ import_react.default.createElement(
1455
+ "div",
1456
+ {
1457
+ className: (0, import_classnames.default)("login2-container", "register2-container", className),
1458
+ style: {
1459
+ ...style,
1460
+ "--theme-color": (ui == null ? void 0 : ui.themeColor) || "#7F56D9"
1461
+ }
1462
+ },
1463
+ /* @__PURE__ */ import_react.default.createElement(import_Header.default, { ui }),
1464
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "login2-content" }, renderMainLoginForm(), renderSwitchOptions()),
1465
+ /* @__PURE__ */ import_react.default.createElement(import_LegalTerms.default, { config: { ...config.legalTerms, mode: "login" } })
1466
+ );
1467
+ };
1468
+ var Login2_default = Login2;