@amaster.ai/auth-client 1.1.3 → 1.1.5

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.
@@ -34,13 +34,6 @@
34
34
  * });
35
35
  * ```
36
36
  *
37
- * @example
38
- * With custom base URL:
39
- * ```typescript
40
- * const authClient = createAuthClient({
41
- * baseURL: "https://api.example.com",
42
- * });
43
- * ```
44
37
  */
45
38
  interface AuthClientOptions {
46
39
  /**
@@ -406,7 +399,7 @@ interface ChangePasswordParams {
406
399
  * - google: Google OAuth
407
400
  * - github: GitHub OAuth
408
401
  * - wechat: WeChat Open Platform OAuth (for web/mobile apps)
409
- * - wechat_mini: WeChat Mini Program login
402
+ * - wechat_mini: legacy mini-program provider marker kept for compatibility
410
403
  * - platform: AMaster Platform OAuth
411
404
  */
412
405
  type OAuthProvider = "google" | "github" | "wechat" | "wechat_mini" | "platform";
@@ -418,6 +411,89 @@ interface OAuthBinding {
418
411
  avatarUrl: string | null;
419
412
  createdAt: string;
420
413
  }
414
+ /**
415
+ * Mini Program platform type
416
+ * - wechat: WeChat Mini Program
417
+ * - douyin: Douyin Mini Program
418
+ */
419
+ type MiniProgramPlatform = "wechat" | "douyin";
420
+ /**
421
+ * Unified Mini Program login options
422
+ */
423
+ interface MiniLoginParams {
424
+ /**
425
+ * Optional explicit platform override.
426
+ * When omitted, the SDK auto-detects the current mini-program runtime.
427
+ */
428
+ platform?: MiniProgramPlatform;
429
+ }
430
+ /**
431
+ * Mini Program login parameters
432
+ * @example
433
+ * ```typescript
434
+ * // WeChat
435
+ * await authClient.miniLogin();
436
+ *
437
+ * // Douyin
438
+ * await authClient.miniLogin({
439
+ * platform: "douyin",
440
+ * });
441
+ * ```
442
+ */
443
+ interface MiniProgramLoginParams {
444
+ /** Code from mini-program login API, valid for a short time */
445
+ code: string;
446
+ /**
447
+ * Optional explicit platform override
448
+ * When omitted, the SDK will auto-detect the current mini-program runtime.
449
+ */
450
+ platform?: MiniProgramPlatform;
451
+ }
452
+ /**
453
+ * Mini Program phone number parameters
454
+ * @example
455
+ * ```typescript
456
+ * // WeChat WXML
457
+ * <button open-type="getPhoneNumber" bindgetphonenumber="onGetPhoneNumber">
458
+ * Get Phone Number
459
+ * </button>
460
+ *
461
+ * // JS
462
+ * async onGetPhoneNumber(e) {
463
+ * await authClient.miniGetPhone(e);
464
+ * }
465
+ *
466
+ * // Douyin
467
+ * await authClient.miniGetPhone({
468
+ * code,
469
+ * platform: "douyin",
470
+ * });
471
+ * ```
472
+ */
473
+ interface MiniProgramPhoneParams {
474
+ /** Code from getPhoneNumber button event */
475
+ code: string;
476
+ /**
477
+ * Optional explicit platform override
478
+ * When omitted, the SDK will auto-detect the current mini-program runtime.
479
+ */
480
+ platform?: MiniProgramPlatform;
481
+ }
482
+ /**
483
+ * Mini Program phone event-like payload
484
+ * Compatible with WeChat `wx`, Douyin `tt`, and Taro event objects.
485
+ */
486
+ interface MiniGetPhoneEvent {
487
+ code?: string;
488
+ platform?: MiniProgramPlatform;
489
+ detail?: {
490
+ code?: string;
491
+ } | null;
492
+ }
493
+ /**
494
+ * Unified Mini Program phone input
495
+ */
496
+ type MiniGetPhoneParams = string | MiniProgramPhoneParams | MiniGetPhoneEvent;
421
497
  /**
422
498
  * WeChat Mini Program phone number response
423
499
  */
@@ -499,4 +575,4 @@ interface RevokeAllSessionsResponse {
499
575
  revokedCount: number;
500
576
  }
501
577
 
502
- export type { AuthClientOptions as A, ChangePasswordParams as C, EventHandler as E, LoginParams as L, MiniProgramPhoneResponse as M, OAuthBinding as O, Permission as P, RefreshTokenResponse as R, SendCodeParams as S, UpdateMeParams as U, AuthEvent as a, CaptchaResponse as b, CodeLoginParams as c, CodeLoginType as d, LoginResponse as e, LoginType as f, OAuthProvider as g, PermissionDetail as h, RegisterParams as i, RegisterResponse as j, RevokeAllSessionsResponse as k, Role as l, RoleDetail as m, SendCodeType as n, Session as o, SuccessResponse as p, User as q };
578
+ export type { AuthClientOptions as A, ChangePasswordParams as C, EventHandler as E, LoginParams as L, MiniGetPhoneEvent as M, OAuthBinding as O, Permission as P, RefreshTokenResponse as R, SendCodeParams as S, UpdateMeParams as U, AuthEvent as a, CaptchaResponse as b, CodeLoginParams as c, CodeLoginType as d, LoginResponse as e, LoginType as f, MiniGetPhoneParams as g, MiniLoginParams as h, MiniProgramLoginParams as i, MiniProgramPlatform as j, MiniProgramPhoneParams as k, MiniProgramPhoneResponse as l, OAuthProvider as m, PermissionDetail as n, RegisterParams as o, RegisterResponse as p, RevokeAllSessionsResponse as q, Role as r, RoleDetail as s, SendCodeType as t, Session as u, SuccessResponse as v, User as w };
package/dist/user.d.cts CHANGED
@@ -14,7 +14,7 @@
14
14
  * ============================================================================
15
15
  */
16
16
  import { HttpClient, ClientResult } from '@amaster.ai/http-client';
17
- import { q as User, U as UpdateMeParams, C as ChangePasswordParams, p as SuccessResponse } from './types-Cz0vVJqO.cjs';
17
+ import { w as User, U as UpdateMeParams, C as ChangePasswordParams, v as SuccessResponse } from './types-CsCZTBIx.cjs';
18
18
 
19
19
  /**
20
20
  * User Management Module
package/dist/user.d.ts CHANGED
@@ -14,7 +14,7 @@
14
14
  * ============================================================================
15
15
  */
16
16
  import { HttpClient, ClientResult } from '@amaster.ai/http-client';
17
- import { q as User, U as UpdateMeParams, C as ChangePasswordParams, p as SuccessResponse } from './types-Cz0vVJqO.js';
17
+ import { w as User, U as UpdateMeParams, C as ChangePasswordParams, v as SuccessResponse } from './types-CsCZTBIx.js';
18
18
 
19
19
  /**
20
20
  * User Management Module
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amaster.ai/auth-client",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "Authentication SDK for Amaster platform",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -8,9 +8,9 @@
8
8
  "types": "./dist/index.d.ts",
9
9
  "exports": {
10
10
  ".": {
11
+ "types": "./dist/index.d.ts",
11
12
  "import": "./dist/index.js",
12
- "require": "./dist/index.cjs",
13
- "types": "./dist/index.d.ts"
13
+ "require": "./dist/index.cjs"
14
14
  },
15
15
  "./auth": {
16
16
  "types": "./dist/auth.d.ts"
@@ -47,7 +47,7 @@
47
47
  "registry": "https://registry.npmjs.org/"
48
48
  },
49
49
  "dependencies": {
50
- "@amaster.ai/http-client": "1.1.3"
50
+ "@amaster.ai/http-client": "1.1.5"
51
51
  },
52
52
  "peerDependencies": {
53
53
  "axios": "^1.11.0"