sa2kit 3.0.0 → 3.1.0

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 (198) hide show
  1. package/dist/ai/llm/ui/miniapp/index.d.mts +2 -2
  2. package/dist/ai/llm/ui/miniapp/index.d.ts +2 -2
  3. package/dist/ai/llm/ui/rn/index.d.mts +2 -2
  4. package/dist/ai/llm/ui/rn/index.d.ts +2 -2
  5. package/dist/ai/llm/ui/web/index.d.mts +3 -3
  6. package/dist/ai/llm/ui/web/index.d.ts +3 -3
  7. package/dist/analytics/index.d.mts +1 -1
  8. package/dist/analytics/index.d.ts +1 -1
  9. package/dist/{chunk-QP5N3ER6.js → chunk-3CSCIRQY.js} +5 -6
  10. package/dist/chunk-3CSCIRQY.js.map +1 -0
  11. package/dist/{chunk-RJP2BRJD.mjs → chunk-4OOANEJV.mjs} +2 -2
  12. package/dist/{chunk-RJP2BRJD.mjs.map → chunk-4OOANEJV.mjs.map} +1 -1
  13. package/dist/chunk-5FUAQLGC.mjs +14 -0
  14. package/dist/chunk-5FUAQLGC.mjs.map +1 -0
  15. package/dist/{chunk-S732H246.js → chunk-6PMXAK7F.js} +2 -2
  16. package/dist/{chunk-S732H246.js.map → chunk-6PMXAK7F.js.map} +1 -1
  17. package/dist/chunk-6YLCRWKM.mjs +8 -0
  18. package/dist/chunk-6YLCRWKM.mjs.map +1 -0
  19. package/dist/{chunk-IBWDBBX5.mjs → chunk-7B5SI4OF.mjs} +3 -4
  20. package/dist/chunk-7B5SI4OF.mjs.map +1 -0
  21. package/dist/chunk-EQXPL7TN.mjs +78 -0
  22. package/dist/chunk-EQXPL7TN.mjs.map +1 -0
  23. package/dist/{chunk-GQZHGSRR.js → chunk-GSNGCENJ.js} +39 -2
  24. package/dist/chunk-GSNGCENJ.js.map +1 -0
  25. package/dist/chunk-HQLKOXG7.js +16 -0
  26. package/dist/chunk-HQLKOXG7.js.map +1 -0
  27. package/dist/{chunk-S3PUP7N4.js → chunk-PA4ELVGI.js} +2 -2
  28. package/dist/{chunk-S3PUP7N4.js.map → chunk-PA4ELVGI.js.map} +1 -1
  29. package/dist/{chunk-WZDTNDYR.js → chunk-QSKLQX6H.js} +11 -11
  30. package/dist/{chunk-WZDTNDYR.js.map → chunk-QSKLQX6H.js.map} +1 -1
  31. package/dist/{chunk-LHJKLUM7.mjs → chunk-TNJ6LYX7.mjs} +2 -2
  32. package/dist/{chunk-LHJKLUM7.mjs.map → chunk-TNJ6LYX7.mjs.map} +1 -1
  33. package/dist/{chunk-J77KR2EV.mjs → chunk-WJ7IMUEJ.mjs} +3 -3
  34. package/dist/{chunk-J77KR2EV.mjs.map → chunk-WJ7IMUEJ.mjs.map} +1 -1
  35. package/dist/chunk-YTGUIRRH.js +10 -0
  36. package/dist/chunk-YTGUIRRH.js.map +1 -0
  37. package/dist/common/auth/client/index.d.mts +1 -31
  38. package/dist/common/auth/client/index.d.ts +1 -31
  39. package/dist/common/auth/client/index.js +2 -15
  40. package/dist/common/auth/client/index.mjs +1 -2
  41. package/dist/common/auth/components/index.d.mts +14 -248
  42. package/dist/common/auth/components/index.d.ts +14 -248
  43. package/dist/common/auth/components/index.js +878 -49
  44. package/dist/common/auth/components/index.js.map +1 -1
  45. package/dist/common/auth/components/index.mjs +871 -5
  46. package/dist/common/auth/components/index.mjs.map +1 -1
  47. package/dist/common/auth/hooks/index.d.mts +2 -29
  48. package/dist/common/auth/hooks/index.d.ts +2 -29
  49. package/dist/common/auth/hooks/index.js +2 -11
  50. package/dist/common/auth/hooks/index.mjs +1 -2
  51. package/dist/common/auth/index.d.mts +5 -9
  52. package/dist/common/auth/index.d.ts +5 -9
  53. package/dist/common/auth/index.js +7 -28
  54. package/dist/common/auth/index.mjs +3 -4
  55. package/dist/common/auth/react/index.d.mts +3 -3
  56. package/dist/common/auth/react/index.d.ts +3 -3
  57. package/dist/common/auth/rn/index.d.mts +3 -19
  58. package/dist/common/auth/rn/index.d.ts +3 -19
  59. package/dist/common/auth/rn/index.js +0 -32
  60. package/dist/common/auth/rn/index.js.map +1 -1
  61. package/dist/common/auth/rn/index.mjs +1 -30
  62. package/dist/common/auth/rn/index.mjs.map +1 -1
  63. package/dist/common/auth/server/index.d.mts +81 -2
  64. package/dist/common/auth/server/index.d.ts +81 -2
  65. package/dist/common/auth/server/index.js +128 -37
  66. package/dist/common/auth/server/index.js.map +1 -1
  67. package/dist/common/auth/server/index.mjs +124 -1
  68. package/dist/common/auth/server/index.mjs.map +1 -1
  69. package/dist/common/auth/services/index.js +12 -9
  70. package/dist/common/auth/services/index.js.map +1 -1
  71. package/dist/common/auth/services/index.mjs +10 -1
  72. package/dist/common/auth/services/index.mjs.map +1 -1
  73. package/dist/common/file/server/index.js +32 -32
  74. package/dist/common/file/server/index.mjs +3 -3
  75. package/dist/common/index.d.mts +5 -8
  76. package/dist/common/index.d.ts +5 -8
  77. package/dist/common/index.js +12 -14
  78. package/dist/common/index.mjs +6 -8
  79. package/dist/common/request/index.js +4 -5
  80. package/dist/common/request/index.mjs +2 -3
  81. package/dist/i18n/index.d.mts +1 -1
  82. package/dist/i18n/index.d.ts +1 -1
  83. package/dist/imageCrop/index.d.mts +3 -3
  84. package/dist/imageCrop/index.d.ts +3 -3
  85. package/dist/index-Bd7cKF1j.d.mts +50 -0
  86. package/dist/{index-CLB80GCP.d.ts → index-D0cqaQEH.d.mts} +5 -5
  87. package/dist/{index-CLB80GCP.d.mts → index-D0cqaQEH.d.ts} +5 -5
  88. package/dist/index-DRQxtCDw.d.ts +50 -0
  89. package/dist/{index-BxZauNN_.d.mts → index-DoUo8IrU.d.mts} +8 -8
  90. package/dist/{index-BxZauNN_.d.ts → index-DoUo8IrU.d.ts} +8 -8
  91. package/dist/index.d.mts +152 -131
  92. package/dist/index.d.ts +152 -131
  93. package/dist/index.js +105 -554
  94. package/dist/index.js.map +1 -1
  95. package/dist/index.mjs +106 -555
  96. package/dist/index.mjs.map +1 -1
  97. package/dist/ossFile/server/index.js +32 -32
  98. package/dist/ossFile/server/index.mjs +3 -3
  99. package/dist/request/index.js +3 -4
  100. package/dist/request/index.mjs +1 -2
  101. package/dist/universalExport/index.d.mts +3 -3
  102. package/dist/universalExport/index.d.ts +3 -3
  103. package/dist/universalFile/index.d.mts +5 -5
  104. package/dist/universalFile/index.d.ts +5 -5
  105. package/dist/universalFile/server/index.js +62 -62
  106. package/dist/universalFile/server/index.mjs +2 -2
  107. package/package.json +1 -36
  108. package/dist/auth/client/index.d.mts +0 -13
  109. package/dist/auth/client/index.d.ts +0 -13
  110. package/dist/auth/client/index.js +0 -26
  111. package/dist/auth/client/index.js.map +0 -1
  112. package/dist/auth/client/index.mjs +0 -5
  113. package/dist/auth/client/index.mjs.map +0 -1
  114. package/dist/auth/components/index.d.mts +0 -10
  115. package/dist/auth/components/index.d.ts +0 -10
  116. package/dist/auth/components/index.js +0 -70
  117. package/dist/auth/components/index.js.map +0 -1
  118. package/dist/auth/components/index.mjs +0 -9
  119. package/dist/auth/components/index.mjs.map +0 -1
  120. package/dist/auth/hooks/index.d.mts +0 -13
  121. package/dist/auth/hooks/index.d.ts +0 -13
  122. package/dist/auth/hooks/index.js +0 -28
  123. package/dist/auth/hooks/index.js.map +0 -1
  124. package/dist/auth/hooks/index.mjs +0 -7
  125. package/dist/auth/hooks/index.mjs.map +0 -1
  126. package/dist/auth/index.d.mts +0 -21
  127. package/dist/auth/index.d.ts +0 -21
  128. package/dist/auth/index.js +0 -112
  129. package/dist/auth/index.js.map +0 -1
  130. package/dist/auth/index.mjs +0 -11
  131. package/dist/auth/index.mjs.map +0 -1
  132. package/dist/auth/rn/index.d.mts +0 -3133
  133. package/dist/auth/rn/index.d.ts +0 -3133
  134. package/dist/auth/rn/index.js +0 -684
  135. package/dist/auth/rn/index.js.map +0 -1
  136. package/dist/auth/rn/index.mjs +0 -663
  137. package/dist/auth/rn/index.mjs.map +0 -1
  138. package/dist/auth/schema/index.d.mts +0 -4
  139. package/dist/auth/schema/index.d.ts +0 -4
  140. package/dist/auth/schema/index.js +0 -49
  141. package/dist/auth/schema/index.js.map +0 -1
  142. package/dist/auth/schema/index.mjs +0 -4
  143. package/dist/auth/schema/index.mjs.map +0 -1
  144. package/dist/auth/services/index.d.mts +0 -1
  145. package/dist/auth/services/index.d.ts +0 -1
  146. package/dist/auth/services/index.js +0 -17
  147. package/dist/auth/services/index.js.map +0 -1
  148. package/dist/auth/services/index.mjs +0 -4
  149. package/dist/auth/services/index.mjs.map +0 -1
  150. package/dist/base-api-client-BpmcQt4Q.d.ts +0 -103
  151. package/dist/base-api-client-CFIhZK4C.d.mts +0 -277
  152. package/dist/base-api-client-CFIhZK4C.d.ts +0 -277
  153. package/dist/base-api-client-DXLsq2yz.d.mts +0 -103
  154. package/dist/chunk-7E3J7VAD.mjs +0 -3
  155. package/dist/chunk-7E3J7VAD.mjs.map +0 -1
  156. package/dist/chunk-B3CZ3HXJ.mjs +0 -126
  157. package/dist/chunk-B3CZ3HXJ.mjs.map +0 -1
  158. package/dist/chunk-FOQEQWX5.js +0 -4
  159. package/dist/chunk-FOQEQWX5.js.map +0 -1
  160. package/dist/chunk-G4NFB2QA.mjs +0 -212
  161. package/dist/chunk-G4NFB2QA.mjs.map +0 -1
  162. package/dist/chunk-G5HJGXGC.mjs +0 -39
  163. package/dist/chunk-G5HJGXGC.mjs.map +0 -1
  164. package/dist/chunk-GQZHGSRR.js.map +0 -1
  165. package/dist/chunk-GS7XLKET.js +0 -41
  166. package/dist/chunk-GS7XLKET.js.map +0 -1
  167. package/dist/chunk-IBWDBBX5.mjs.map +0 -1
  168. package/dist/chunk-MWSAH7ZG.mjs +0 -42
  169. package/dist/chunk-MWSAH7ZG.mjs.map +0 -1
  170. package/dist/chunk-MZOGYD4N.mjs +0 -186
  171. package/dist/chunk-MZOGYD4N.mjs.map +0 -1
  172. package/dist/chunk-QDUBO567.js +0 -1148
  173. package/dist/chunk-QDUBO567.js.map +0 -1
  174. package/dist/chunk-QP5N3ER6.js.map +0 -1
  175. package/dist/chunk-RWCD2CAD.mjs +0 -1132
  176. package/dist/chunk-RWCD2CAD.mjs.map +0 -1
  177. package/dist/chunk-S37OK2QG.js +0 -216
  178. package/dist/chunk-S37OK2QG.js.map +0 -1
  179. package/dist/chunk-SFDJNKWC.js +0 -22
  180. package/dist/chunk-SFDJNKWC.js.map +0 -1
  181. package/dist/chunk-TXMX6PZR.js +0 -190
  182. package/dist/chunk-TXMX6PZR.js.map +0 -1
  183. package/dist/chunk-VHN7PF5I.js +0 -20
  184. package/dist/chunk-VHN7PF5I.js.map +0 -1
  185. package/dist/chunk-XBZIS3MV.mjs +0 -13
  186. package/dist/chunk-XBZIS3MV.mjs.map +0 -1
  187. package/dist/chunk-XFOZ56FB.mjs +0 -20
  188. package/dist/chunk-XFOZ56FB.mjs.map +0 -1
  189. package/dist/chunk-Z23HAXHL.js +0 -136
  190. package/dist/chunk-Z23HAXHL.js.map +0 -1
  191. package/dist/index-BcjDRcKp.d.mts +0 -40
  192. package/dist/index-BlpXrrTy.d.ts +0 -40
  193. package/dist/session-BCXvGCnm.d.mts +0 -81
  194. package/dist/session-BCXvGCnm.d.ts +0 -81
  195. package/dist/types-C_W_CoUD.d.ts +0 -99
  196. package/dist/types-DCRvasyH.d.mts +0 -99
  197. package/dist/types.legacy-J-j-_ig_.d.mts +0 -25
  198. package/dist/types.legacy-J-j-_ig_.d.ts +0 -25
@@ -1,26 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkS3PUP7N4_js = require('../../../chunk-S3PUP7N4.js');
4
- var chunkS37OK2QG_js = require('../../../chunk-S37OK2QG.js');
3
+ var chunkPA4ELVGI_js = require('../../../chunk-PA4ELVGI.js');
5
4
  require('../../../chunk-NSBPE2FW.js');
6
5
 
7
6
 
8
7
 
9
8
  Object.defineProperty(exports, "createSa2kitAuthClient", {
10
9
  enumerable: true,
11
- get: function () { return chunkS3PUP7N4_js.createSa2kitAuthClient; }
12
- });
13
- Object.defineProperty(exports, "API_ROUTES", {
14
- enumerable: true,
15
- get: function () { return chunkS37OK2QG_js.API_ROUTES; }
16
- });
17
- Object.defineProperty(exports, "BaseApiClient", {
18
- enumerable: true,
19
- get: function () { return chunkS37OK2QG_js.BaseApiClient; }
20
- });
21
- Object.defineProperty(exports, "STORAGE_KEYS", {
22
- enumerable: true,
23
- get: function () { return chunkS37OK2QG_js.STORAGE_KEYS; }
10
+ get: function () { return chunkPA4ELVGI_js.createSa2kitAuthClient; }
24
11
  });
25
12
  //# sourceMappingURL=index.js.map
26
13
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,4 @@
1
- export { createSa2kitAuthClient } from '../../../chunk-LHJKLUM7.mjs';
2
- export { API_ROUTES, BaseApiClient, STORAGE_KEYS } from '../../../chunk-G4NFB2QA.mjs';
1
+ export { createSa2kitAuthClient } from '../../../chunk-TNJ6LYX7.mjs';
3
2
  import '../../../chunk-MAI35PU6.mjs';
4
3
  //# sourceMappingURL=index.mjs.map
5
4
  //# sourceMappingURL=index.mjs.map
@@ -1,12 +1,9 @@
1
- import React__default from 'react';
2
- import { L as LoginFormState, R as RegisterFormState } from '../../../types.legacy-J-j-_ig_.mjs';
3
- import { I as IAuthClient, U as User } from '../../../types-DCRvasyH.mjs';
1
+ import React$1 from 'react';
4
2
  import { A as AuthActionsClient } from '../../../useAuthActions-7S5dL7Oh.mjs';
5
- import { B as BaseApiClient } from '../../../base-api-client-DXLsq2yz.mjs';
6
- import '../../../enums-Dume-V5Y.mjs';
7
- import 'drizzle-orm/pg-core';
8
- import '../../../types-BaZccpvk.mjs';
9
- import '../../../types-CbTsi9CZ.mjs';
3
+
4
+ /**
5
+ * Auth UI 类型(Better Auth 3.0)
6
+ */
10
7
 
11
8
  type SignInMode = 'email-password' | 'phone-password' | 'phone-otp' | 'email-otp';
12
9
  type OtpChannel = 'phone' | 'email';
@@ -80,21 +77,6 @@ interface HeadlessVerifyOtpFormProps {
80
77
  onError?: (error: string) => void;
81
78
  children: (state: VerifyOtpFormState) => React.ReactNode;
82
79
  }
83
- /** @deprecated 2.x */
84
- interface BaseFormProps {
85
- apiClient: IAuthClient;
86
- onSuccess?: (user: unknown) => void;
87
- onError?: (error: string) => void;
88
- }
89
- /** @deprecated 使用 HeadlessSignInFormProps */
90
- interface HeadlessLoginFormProps extends BaseFormProps {
91
- children: (state: LoginFormState) => React.ReactNode;
92
- }
93
- /** @deprecated */
94
- interface HeadlessRegisterFormPropsLegacy extends BaseFormProps {
95
- children: (state: RegisterFormState) => React.ReactNode;
96
- }
97
-
98
80
  interface LoginModalProps {
99
81
  isOpen: boolean;
100
82
  onClose: () => void;
@@ -131,237 +113,21 @@ interface UserMenuProps {
131
113
  className?: string;
132
114
  }
133
115
 
134
- declare function SignInForm({ authClient, initialMode, onSuccess, onError, children, }: HeadlessSignInFormProps): React__default.JSX.Element;
116
+ declare function SignInForm({ authClient, initialMode, onSuccess, onError, children, }: HeadlessSignInFormProps): React$1.JSX.Element;
135
117
 
136
- declare function RegisterFormHeadless({ authClient, initialChannel, onSuccess, onError, children, }: HeadlessRegisterFormProps): React__default.JSX.Element;
118
+ declare function RegisterFormHeadless({ authClient, initialChannel, onSuccess, onError, children, }: HeadlessRegisterFormProps): React$1.JSX.Element;
137
119
 
138
- declare function VerifyOtpForm({ authClient, channel, target, onSuccess, onError, children, }: HeadlessVerifyOtpFormProps): React__default.JSX.Element;
120
+ declare function VerifyOtpForm({ authClient, channel, target, onSuccess, onError, children, }: HeadlessVerifyOtpFormProps): React$1.JSX.Element;
139
121
 
140
- declare function LoginModal({ isOpen, onClose, onSuccess, onSwitchToRegister, defaultMode, }: LoginModalProps): React__default.JSX.Element | null;
122
+ declare function LoginModal({ isOpen, onClose, onSuccess, onSwitchToRegister, defaultMode, }: LoginModalProps): React$1.JSX.Element | null;
141
123
 
142
- declare function RegisterModal({ isOpen, onClose, onSuccess, onSwitchToLogin }: RegisterModalProps): React__default.JSX.Element | null;
124
+ declare function RegisterModal({ isOpen, onClose, onSuccess, onSwitchToLogin }: RegisterModalProps): React$1.JSX.Element | null;
143
125
 
144
- declare function ForgotPasswordModal({ isOpen, onClose, onSuccess }: ForgotPasswordModalProps): React__default.JSX.Element | null;
126
+ declare function ForgotPasswordModal({ isOpen, onClose, onSuccess }: ForgotPasswordModalProps): React$1.JSX.Element | null;
145
127
 
146
- declare function AuthGuard({ children, fallback, requireAuth }: AuthGuardProps): React__default.JSX.Element;
147
-
148
- declare function UserMenu({ customMenuItems, className }: UserMenuProps): React__default.JSX.Element;
149
-
150
- /**
151
- * Auth Components - LoginForm (Headless)
152
- * 无样式的登录表单组件
153
- */
154
-
155
- /**
156
- * Headless 登录表单组件
157
- *
158
- * 提供登录逻辑但不包含任何 UI 样式,
159
- * 使用 render props 模式让用户完全控制 UI
160
- *
161
- * @example
162
- * ```tsx
163
- * <LoginForm apiClient={apiClient}>
164
- * {({ email, password, loading, error, handleEmailChange, handlePasswordChange, handleSubmit }) => (
165
- * <form onSubmit={handleSubmit}>
166
- * <input
167
- * value={email}
168
- * onChange={(e) => handleEmailChange(e.target.value)}
169
- * />
170
- * <input
171
- * type="password"
172
- * value={password}
173
- * onChange={(e) => handlePasswordChange(e.target.value)}
174
- * />
175
- * {error && <div>{error}</div>}
176
- * <button disabled={loading}>
177
- * {loading ? '登录中...' : '登录'}
178
- * </button>
179
- * </form>
180
- * )}
181
- * </LoginForm>
182
- * ```
183
- */
184
- declare function LoginForm({ apiClient, onSuccess, onError, children }: HeadlessLoginFormProps): React__default.JSX.Element;
128
+ declare function AuthGuard({ children, fallback, requireAuth }: AuthGuardProps): React$1.JSX.Element;
185
129
 
186
- /**
187
- * Auth Components - RegisterForm (Headless)
188
- * 无样式的注册表单组件
189
- */
190
-
191
- /**
192
- * Headless 注册表单组件
193
- *
194
- * 提供注册逻辑但不包含任何 UI 样式,
195
- * 使用 render props 模式让用户完全控制 UI
196
- *
197
- * @example
198
- * ```tsx
199
- * <RegisterForm apiClient={apiClient}>
200
- * {({ email, password, username, loading, error, handleEmailChange, handlePasswordChange, handleUsernameChange, handleSubmit }) => (
201
- * <form onSubmit={handleSubmit}>
202
- * <input
203
- * value={email}
204
- * onChange={(e) => handleEmailChange(e.target.value)}
205
- * />
206
- * <input
207
- * value={username}
208
- * onChange={(e) => handleUsernameChange(e.target.value)}
209
- * />
210
- * <input
211
- * type="password"
212
- * value={password}
213
- * onChange={(e) => handlePasswordChange(e.target.value)}
214
- * />
215
- * {error && <div>{error}</div>}
216
- * <button disabled={loading}>
217
- * {loading ? '注册中...' : '注册'}
218
- * </button>
219
- * </form>
220
- * )}
221
- * </RegisterForm>
222
- * ```
223
- */
224
- declare function RegisterForm({ apiClient, onSuccess, onError, children, }: HeadlessRegisterFormPropsLegacy): React__default.JSX.Element;
225
-
226
- /**
227
- * Admin Login Page Component
228
- * 完整的管理后台登录页面组件
229
- *
230
- * 功能:
231
- * - 邮箱密码登录
232
- * - 开发环境测试账户自动填充
233
- * - Analytics 埋点集成
234
- * - 角色权限检查
235
- * - 响应式设计
236
- */
237
-
238
- interface AdminLoginPageProps {
239
- /**
240
- * API 客户端实例
241
- */
242
- apiClient: BaseApiClient;
243
- /**
244
- * 登录成功后的回调
245
- */
246
- onLoginSuccess?: (user: User) => void;
247
- /**
248
- * 登录失败的回调
249
- */
250
- onLoginError?: (error: string) => void;
251
- /**
252
- * 权限检查函数(可选)
253
- * 返回 true 表示有权限,false 表示无权限
254
- */
255
- checkPermission?: (user: User) => boolean;
256
- /**
257
- * 权限不足时的错误消息
258
- */
259
- permissionDeniedMessage?: string;
260
- /**
261
- * 开发环境配置
262
- */
263
- devConfig?: {
264
- /**
265
- * 是否启用开发模式功能(自动填充等)
266
- */
267
- enabled?: boolean;
268
- /**
269
- * 测试账户邮箱
270
- */
271
- testEmail?: string;
272
- /**
273
- * 测试账户密码
274
- */
275
- testPassword?: string;
276
- /**
277
- * 自动填充延迟(毫秒)
278
- */
279
- autoFillDelay?: number;
280
- };
281
- /**
282
- * 页面文本配置
283
- */
284
- texts?: {
285
- appName?: string;
286
- appDescription?: string;
287
- pageTitle?: string;
288
- pageSubtitle?: string;
289
- emailLabel?: string;
290
- emailPlaceholder?: string;
291
- passwordLabel?: string;
292
- passwordPlaceholder?: string;
293
- loginButton?: string;
294
- loggingInButton?: string;
295
- fillTestAccount?: string;
296
- copyCredentials?: string;
297
- devModeLabel?: string;
298
- testAccountInfo?: string;
299
- testAccountFilled?: string;
300
- footer?: string;
301
- };
302
- /**
303
- * Analytics 集成(可选)
304
- */
305
- analytics?: {
306
- /**
307
- * 页面访问埋点
308
- */
309
- trackPageView?: (data: Record<string, any>) => void;
310
- /**
311
- * 登录成功埋点
312
- */
313
- trackLoginSuccess?: (user: User) => void;
314
- /**
315
- * 登录失败埋点
316
- */
317
- trackLoginFailed?: (error: string, email: string) => void;
318
- /**
319
- * 权限拒绝埋点
320
- */
321
- trackPermissionDenied?: (user: User) => void;
322
- /**
323
- * 设置用户信息
324
- */
325
- setUser?: (user: {
326
- userId: string;
327
- email: string;
328
- role: string;
329
- }) => void;
330
- };
331
- /**
332
- * UI 组件(可选,用于自定义样式)
333
- */
334
- components?: {
335
- Container?: React__default.ComponentType<{
336
- children: React__default.ReactNode;
337
- }>;
338
- Card?: React__default.ComponentType<{
339
- children: React__default.ReactNode;
340
- }>;
341
- Input?: React__default.ComponentType<any>;
342
- Button?: React__default.ComponentType<any>;
343
- Alert?: React__default.ComponentType<{
344
- children: React__default.ReactNode;
345
- }>;
346
- Badge?: React__default.ComponentType<{
347
- children: React__default.ReactNode;
348
- variant?: string;
349
- }>;
350
- };
351
- /**
352
- * className 配置(用于 Tailwind CSS)
353
- */
354
- classNames?: {
355
- container?: string;
356
- card?: string;
357
- header?: string;
358
- form?: string;
359
- input?: string;
360
- button?: string;
361
- alert?: string;
362
- };
363
- }
364
- declare function AdminLoginPage(props: AdminLoginPageProps): React__default.JSX.Element;
130
+ declare function UserMenu({ customMenuItems, className }: UserMenuProps): React$1.JSX.Element;
365
131
 
366
132
  /** 中国大陆手机号 */
367
133
  declare function validatePhoneNumber(phone: string): boolean;
@@ -371,4 +137,4 @@ declare function validatePassword(password: string): {
371
137
  };
372
138
  declare function validateEmail(email: string): boolean;
373
139
 
374
- export { AdminLoginPage, type AdminLoginPageProps, AuthGuard, type AuthGuardProps, type BaseFormProps, ForgotPasswordModal, type ForgotPasswordModalProps, type HeadlessLoginFormProps, type HeadlessRegisterFormProps, type HeadlessRegisterFormPropsLegacy, type HeadlessSignInFormProps, type HeadlessVerifyOtpFormProps, LoginForm, LoginFormState, LoginModal, type LoginModalProps, type OtpChannel, RegisterForm, RegisterFormHeadless, type RegisterFormHeadlessState, RegisterFormState, RegisterModal, type RegisterModalProps, SignInForm, type SignInFormState, type SignInMode, UserMenu, type UserMenuProps, VerifyOtpForm, type VerifyOtpFormState, validateEmail, validatePassword, validatePhoneNumber };
140
+ export { AuthGuard, type AuthGuardProps, ForgotPasswordModal, type ForgotPasswordModalProps, type HeadlessRegisterFormProps, type HeadlessSignInFormProps, type HeadlessVerifyOtpFormProps, LoginModal, type LoginModalProps, type OtpChannel, RegisterFormHeadless, type RegisterFormHeadlessState, RegisterModal, type RegisterModalProps, SignInForm, type SignInFormState, type SignInMode, UserMenu, type UserMenuProps, VerifyOtpForm, type VerifyOtpFormState, validateEmail, validatePassword, validatePhoneNumber };
@@ -1,12 +1,9 @@
1
- import React__default from 'react';
2
- import { L as LoginFormState, R as RegisterFormState } from '../../../types.legacy-J-j-_ig_.js';
3
- import { I as IAuthClient, U as User } from '../../../types-C_W_CoUD.js';
1
+ import React$1 from 'react';
4
2
  import { A as AuthActionsClient } from '../../../useAuthActions-7S5dL7Oh.js';
5
- import { B as BaseApiClient } from '../../../base-api-client-BpmcQt4Q.js';
6
- import '../../../enums-Dume-V5Y.js';
7
- import 'drizzle-orm/pg-core';
8
- import '../../../types-BaZccpvk.js';
9
- import '../../../types-CbTsi9CZ.js';
3
+
4
+ /**
5
+ * Auth UI 类型(Better Auth 3.0)
6
+ */
10
7
 
11
8
  type SignInMode = 'email-password' | 'phone-password' | 'phone-otp' | 'email-otp';
12
9
  type OtpChannel = 'phone' | 'email';
@@ -80,21 +77,6 @@ interface HeadlessVerifyOtpFormProps {
80
77
  onError?: (error: string) => void;
81
78
  children: (state: VerifyOtpFormState) => React.ReactNode;
82
79
  }
83
- /** @deprecated 2.x */
84
- interface BaseFormProps {
85
- apiClient: IAuthClient;
86
- onSuccess?: (user: unknown) => void;
87
- onError?: (error: string) => void;
88
- }
89
- /** @deprecated 使用 HeadlessSignInFormProps */
90
- interface HeadlessLoginFormProps extends BaseFormProps {
91
- children: (state: LoginFormState) => React.ReactNode;
92
- }
93
- /** @deprecated */
94
- interface HeadlessRegisterFormPropsLegacy extends BaseFormProps {
95
- children: (state: RegisterFormState) => React.ReactNode;
96
- }
97
-
98
80
  interface LoginModalProps {
99
81
  isOpen: boolean;
100
82
  onClose: () => void;
@@ -131,237 +113,21 @@ interface UserMenuProps {
131
113
  className?: string;
132
114
  }
133
115
 
134
- declare function SignInForm({ authClient, initialMode, onSuccess, onError, children, }: HeadlessSignInFormProps): React__default.JSX.Element;
116
+ declare function SignInForm({ authClient, initialMode, onSuccess, onError, children, }: HeadlessSignInFormProps): React$1.JSX.Element;
135
117
 
136
- declare function RegisterFormHeadless({ authClient, initialChannel, onSuccess, onError, children, }: HeadlessRegisterFormProps): React__default.JSX.Element;
118
+ declare function RegisterFormHeadless({ authClient, initialChannel, onSuccess, onError, children, }: HeadlessRegisterFormProps): React$1.JSX.Element;
137
119
 
138
- declare function VerifyOtpForm({ authClient, channel, target, onSuccess, onError, children, }: HeadlessVerifyOtpFormProps): React__default.JSX.Element;
120
+ declare function VerifyOtpForm({ authClient, channel, target, onSuccess, onError, children, }: HeadlessVerifyOtpFormProps): React$1.JSX.Element;
139
121
 
140
- declare function LoginModal({ isOpen, onClose, onSuccess, onSwitchToRegister, defaultMode, }: LoginModalProps): React__default.JSX.Element | null;
122
+ declare function LoginModal({ isOpen, onClose, onSuccess, onSwitchToRegister, defaultMode, }: LoginModalProps): React$1.JSX.Element | null;
141
123
 
142
- declare function RegisterModal({ isOpen, onClose, onSuccess, onSwitchToLogin }: RegisterModalProps): React__default.JSX.Element | null;
124
+ declare function RegisterModal({ isOpen, onClose, onSuccess, onSwitchToLogin }: RegisterModalProps): React$1.JSX.Element | null;
143
125
 
144
- declare function ForgotPasswordModal({ isOpen, onClose, onSuccess }: ForgotPasswordModalProps): React__default.JSX.Element | null;
126
+ declare function ForgotPasswordModal({ isOpen, onClose, onSuccess }: ForgotPasswordModalProps): React$1.JSX.Element | null;
145
127
 
146
- declare function AuthGuard({ children, fallback, requireAuth }: AuthGuardProps): React__default.JSX.Element;
147
-
148
- declare function UserMenu({ customMenuItems, className }: UserMenuProps): React__default.JSX.Element;
149
-
150
- /**
151
- * Auth Components - LoginForm (Headless)
152
- * 无样式的登录表单组件
153
- */
154
-
155
- /**
156
- * Headless 登录表单组件
157
- *
158
- * 提供登录逻辑但不包含任何 UI 样式,
159
- * 使用 render props 模式让用户完全控制 UI
160
- *
161
- * @example
162
- * ```tsx
163
- * <LoginForm apiClient={apiClient}>
164
- * {({ email, password, loading, error, handleEmailChange, handlePasswordChange, handleSubmit }) => (
165
- * <form onSubmit={handleSubmit}>
166
- * <input
167
- * value={email}
168
- * onChange={(e) => handleEmailChange(e.target.value)}
169
- * />
170
- * <input
171
- * type="password"
172
- * value={password}
173
- * onChange={(e) => handlePasswordChange(e.target.value)}
174
- * />
175
- * {error && <div>{error}</div>}
176
- * <button disabled={loading}>
177
- * {loading ? '登录中...' : '登录'}
178
- * </button>
179
- * </form>
180
- * )}
181
- * </LoginForm>
182
- * ```
183
- */
184
- declare function LoginForm({ apiClient, onSuccess, onError, children }: HeadlessLoginFormProps): React__default.JSX.Element;
128
+ declare function AuthGuard({ children, fallback, requireAuth }: AuthGuardProps): React$1.JSX.Element;
185
129
 
186
- /**
187
- * Auth Components - RegisterForm (Headless)
188
- * 无样式的注册表单组件
189
- */
190
-
191
- /**
192
- * Headless 注册表单组件
193
- *
194
- * 提供注册逻辑但不包含任何 UI 样式,
195
- * 使用 render props 模式让用户完全控制 UI
196
- *
197
- * @example
198
- * ```tsx
199
- * <RegisterForm apiClient={apiClient}>
200
- * {({ email, password, username, loading, error, handleEmailChange, handlePasswordChange, handleUsernameChange, handleSubmit }) => (
201
- * <form onSubmit={handleSubmit}>
202
- * <input
203
- * value={email}
204
- * onChange={(e) => handleEmailChange(e.target.value)}
205
- * />
206
- * <input
207
- * value={username}
208
- * onChange={(e) => handleUsernameChange(e.target.value)}
209
- * />
210
- * <input
211
- * type="password"
212
- * value={password}
213
- * onChange={(e) => handlePasswordChange(e.target.value)}
214
- * />
215
- * {error && <div>{error}</div>}
216
- * <button disabled={loading}>
217
- * {loading ? '注册中...' : '注册'}
218
- * </button>
219
- * </form>
220
- * )}
221
- * </RegisterForm>
222
- * ```
223
- */
224
- declare function RegisterForm({ apiClient, onSuccess, onError, children, }: HeadlessRegisterFormPropsLegacy): React__default.JSX.Element;
225
-
226
- /**
227
- * Admin Login Page Component
228
- * 完整的管理后台登录页面组件
229
- *
230
- * 功能:
231
- * - 邮箱密码登录
232
- * - 开发环境测试账户自动填充
233
- * - Analytics 埋点集成
234
- * - 角色权限检查
235
- * - 响应式设计
236
- */
237
-
238
- interface AdminLoginPageProps {
239
- /**
240
- * API 客户端实例
241
- */
242
- apiClient: BaseApiClient;
243
- /**
244
- * 登录成功后的回调
245
- */
246
- onLoginSuccess?: (user: User) => void;
247
- /**
248
- * 登录失败的回调
249
- */
250
- onLoginError?: (error: string) => void;
251
- /**
252
- * 权限检查函数(可选)
253
- * 返回 true 表示有权限,false 表示无权限
254
- */
255
- checkPermission?: (user: User) => boolean;
256
- /**
257
- * 权限不足时的错误消息
258
- */
259
- permissionDeniedMessage?: string;
260
- /**
261
- * 开发环境配置
262
- */
263
- devConfig?: {
264
- /**
265
- * 是否启用开发模式功能(自动填充等)
266
- */
267
- enabled?: boolean;
268
- /**
269
- * 测试账户邮箱
270
- */
271
- testEmail?: string;
272
- /**
273
- * 测试账户密码
274
- */
275
- testPassword?: string;
276
- /**
277
- * 自动填充延迟(毫秒)
278
- */
279
- autoFillDelay?: number;
280
- };
281
- /**
282
- * 页面文本配置
283
- */
284
- texts?: {
285
- appName?: string;
286
- appDescription?: string;
287
- pageTitle?: string;
288
- pageSubtitle?: string;
289
- emailLabel?: string;
290
- emailPlaceholder?: string;
291
- passwordLabel?: string;
292
- passwordPlaceholder?: string;
293
- loginButton?: string;
294
- loggingInButton?: string;
295
- fillTestAccount?: string;
296
- copyCredentials?: string;
297
- devModeLabel?: string;
298
- testAccountInfo?: string;
299
- testAccountFilled?: string;
300
- footer?: string;
301
- };
302
- /**
303
- * Analytics 集成(可选)
304
- */
305
- analytics?: {
306
- /**
307
- * 页面访问埋点
308
- */
309
- trackPageView?: (data: Record<string, any>) => void;
310
- /**
311
- * 登录成功埋点
312
- */
313
- trackLoginSuccess?: (user: User) => void;
314
- /**
315
- * 登录失败埋点
316
- */
317
- trackLoginFailed?: (error: string, email: string) => void;
318
- /**
319
- * 权限拒绝埋点
320
- */
321
- trackPermissionDenied?: (user: User) => void;
322
- /**
323
- * 设置用户信息
324
- */
325
- setUser?: (user: {
326
- userId: string;
327
- email: string;
328
- role: string;
329
- }) => void;
330
- };
331
- /**
332
- * UI 组件(可选,用于自定义样式)
333
- */
334
- components?: {
335
- Container?: React__default.ComponentType<{
336
- children: React__default.ReactNode;
337
- }>;
338
- Card?: React__default.ComponentType<{
339
- children: React__default.ReactNode;
340
- }>;
341
- Input?: React__default.ComponentType<any>;
342
- Button?: React__default.ComponentType<any>;
343
- Alert?: React__default.ComponentType<{
344
- children: React__default.ReactNode;
345
- }>;
346
- Badge?: React__default.ComponentType<{
347
- children: React__default.ReactNode;
348
- variant?: string;
349
- }>;
350
- };
351
- /**
352
- * className 配置(用于 Tailwind CSS)
353
- */
354
- classNames?: {
355
- container?: string;
356
- card?: string;
357
- header?: string;
358
- form?: string;
359
- input?: string;
360
- button?: string;
361
- alert?: string;
362
- };
363
- }
364
- declare function AdminLoginPage(props: AdminLoginPageProps): React__default.JSX.Element;
130
+ declare function UserMenu({ customMenuItems, className }: UserMenuProps): React$1.JSX.Element;
365
131
 
366
132
  /** 中国大陆手机号 */
367
133
  declare function validatePhoneNumber(phone: string): boolean;
@@ -371,4 +137,4 @@ declare function validatePassword(password: string): {
371
137
  };
372
138
  declare function validateEmail(email: string): boolean;
373
139
 
374
- export { AdminLoginPage, type AdminLoginPageProps, AuthGuard, type AuthGuardProps, type BaseFormProps, ForgotPasswordModal, type ForgotPasswordModalProps, type HeadlessLoginFormProps, type HeadlessRegisterFormProps, type HeadlessRegisterFormPropsLegacy, type HeadlessSignInFormProps, type HeadlessVerifyOtpFormProps, LoginForm, LoginFormState, LoginModal, type LoginModalProps, type OtpChannel, RegisterForm, RegisterFormHeadless, type RegisterFormHeadlessState, RegisterFormState, RegisterModal, type RegisterModalProps, SignInForm, type SignInFormState, type SignInMode, UserMenu, type UserMenuProps, VerifyOtpForm, type VerifyOtpFormState, validateEmail, validatePassword, validatePhoneNumber };
140
+ export { AuthGuard, type AuthGuardProps, ForgotPasswordModal, type ForgotPasswordModalProps, type HeadlessRegisterFormProps, type HeadlessSignInFormProps, type HeadlessVerifyOtpFormProps, LoginModal, type LoginModalProps, type OtpChannel, RegisterFormHeadless, type RegisterFormHeadlessState, RegisterModal, type RegisterModalProps, SignInForm, type SignInFormState, type SignInMode, UserMenu, type UserMenuProps, VerifyOtpForm, type VerifyOtpFormState, validateEmail, validatePassword, validatePhoneNumber };