@seaverse/auth-sdk 0.2.6 → 0.3.1

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.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AxiosRequestConfig, AxiosResponse } from 'axios';
1
+ import { AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios';
2
2
 
3
3
  type AuthType = 'apiKey' | 'oauth2' | 'jwt' | 'basic' | 'custom';
4
4
  interface BaseCredentials {
@@ -129,7 +129,7 @@ interface HookManagerOptions {
129
129
  metrics?: boolean;
130
130
  };
131
131
  loggerOptions?: LoggerOptions;
132
- retryOptions?: RetryOptions;
132
+ retryOptions?: RetryOptions$1;
133
133
  rateLimitOptions?: RateLimitOptions;
134
134
  cacheOptions?: CacheOptions;
135
135
  metricsOptions?: MetricsOptions;
@@ -140,7 +140,7 @@ interface LoggerOptions {
140
140
  logResponseBody?: boolean;
141
141
  logHeaders?: boolean;
142
142
  }
143
- interface RetryOptions {
143
+ interface RetryOptions$1 {
144
144
  maxRetries?: number;
145
145
  retryDelay?: number;
146
146
  retryStatusCodes?: number[];
@@ -199,6 +199,13 @@ declare class BuiltInHooks {
199
199
  static createRetryHook(maxRetries?: number, retryDelay?: number): Hook;
200
200
  }
201
201
 
202
+ interface RetryOptions {
203
+ maxRetries?: number;
204
+ retryDelay?: number;
205
+ retryStatusCodes?: number[];
206
+ shouldRetry?: (error: AxiosError) => boolean;
207
+ }
208
+
202
209
  /**
203
210
  * Type definitions for SeaVerse Dispatcher API
204
211
  * Generated from auth.yaml OpenAPI specification
@@ -233,6 +240,7 @@ interface User {
233
240
  interface LoginRequest {
234
241
  email: string;
235
242
  password: string;
243
+ frontend_url?: string;
236
244
  }
237
245
  /**
238
246
  * Login response
@@ -255,12 +263,17 @@ interface RegisterRequest {
255
263
  fromShareAppId?: string;
256
264
  }
257
265
  /**
258
- * Register response
266
+ * Register response (active user)
259
267
  */
260
268
  interface RegisterResponse {
261
269
  success: boolean;
262
270
  message?: string;
263
271
  userId?: string;
272
+ requiresEmailVerification?: boolean;
273
+ requiresInvitationCode?: boolean;
274
+ tempUserId?: string;
275
+ provider?: string;
276
+ email?: string;
264
277
  error?: string;
265
278
  code?: string;
266
279
  details?: Record<string, any>;
@@ -628,10 +641,136 @@ interface SuccessResponse {
628
641
  success: boolean;
629
642
  message?: string;
630
643
  }
644
+ /**
645
+ * Email verification response (with auto-login tokens)
646
+ */
647
+ interface EmailVerificationResponse {
648
+ success: boolean;
649
+ data: {
650
+ message: string;
651
+ user: User;
652
+ token: string;
653
+ refreshToken: string;
654
+ };
655
+ }
656
+ /**
657
+ * Invite code model
658
+ */
659
+ interface InviteCode {
660
+ id: string;
661
+ code: string;
662
+ creator_id: string;
663
+ max_uses: number;
664
+ used_count: number;
665
+ status: 'active' | 'expired' | 'disabled';
666
+ expires_at?: number | null;
667
+ description?: string | null;
668
+ metadata?: Record<string, any> | null;
669
+ created_at: number;
670
+ updated_at: number;
671
+ }
672
+ /**
673
+ * Invite code usage record
674
+ */
675
+ interface InviteUsage {
676
+ id: string;
677
+ code_id: string;
678
+ code: string;
679
+ user_id: string;
680
+ used_at: number;
681
+ ip_address?: string | null;
682
+ user_agent?: string | null;
683
+ metadata?: Record<string, any> | null;
684
+ }
685
+ /**
686
+ * Invite code statistics
687
+ */
688
+ interface InviteStats {
689
+ total_codes: number;
690
+ active_codes: number;
691
+ expired_codes: number;
692
+ disabled_codes: number;
693
+ total_uses: number;
694
+ available_uses: number;
695
+ }
696
+ /**
697
+ * List invites request parameters
698
+ */
699
+ interface ListInvitesRequest {
700
+ page?: number;
701
+ page_size?: number;
702
+ status?: 'active' | 'expired' | 'disabled';
703
+ }
704
+ /**
705
+ * List invites response
706
+ */
707
+ interface ListInvitesResponse {
708
+ success: boolean;
709
+ data: {
710
+ invites: InviteCode[];
711
+ total: number;
712
+ page: number;
713
+ page_size: number;
714
+ };
715
+ }
716
+ /**
717
+ * Invite stats response
718
+ */
719
+ interface InviteStatsResponse {
720
+ success: boolean;
721
+ data: InviteStats;
722
+ }
723
+ /**
724
+ * Invite code detail response
725
+ */
726
+ interface InviteCodeDetailResponse {
727
+ success: boolean;
728
+ data: InviteCode;
729
+ }
730
+ /**
731
+ * List invite usages request parameters
732
+ */
733
+ interface ListInviteUsagesRequest {
734
+ page?: number;
735
+ page_size?: number;
736
+ }
737
+ /**
738
+ * List invite usages response
739
+ */
740
+ interface ListInviteUsagesResponse {
741
+ success: boolean;
742
+ data: {
743
+ usages: InviteUsage[];
744
+ total: number;
745
+ page: number;
746
+ page_size: number;
747
+ };
748
+ }
749
+ /**
750
+ * Bind invite code request
751
+ */
752
+ interface BindInviteCodeRequest {
753
+ user_id: string;
754
+ invite_code: string;
755
+ }
756
+ /**
757
+ * Bind invite code response (activation successful)
758
+ */
759
+ interface BindInviteCodeResponse {
760
+ success: boolean;
761
+ data: {
762
+ token: string;
763
+ refreshToken: string;
764
+ user: User;
765
+ message: string;
766
+ };
767
+ }
631
768
 
632
769
  type models_AccountExistsErrorDetails = AccountExistsErrorDetails;
633
770
  type models_ApiError = ApiError;
634
771
  type models_ApiServiceTokenResponse = ApiServiceTokenResponse;
772
+ type models_BindInviteCodeRequest = BindInviteCodeRequest;
773
+ type models_BindInviteCodeResponse = BindInviteCodeResponse;
635
774
  type models_Container = Container;
636
775
  type models_ContainerDetailResponse = ContainerDetailResponse;
637
776
  type models_ContainerListResponse = ContainerListResponse;
@@ -640,6 +779,7 @@ type models_ConversationStatus = ConversationStatus;
640
779
  type models_CreateMarketplaceSkillRequest = CreateMarketplaceSkillRequest;
641
780
  type models_CreateVideoShareRequest = CreateVideoShareRequest;
642
781
  type models_CreateVideoShareResponse = CreateVideoShareResponse;
782
+ type models_EmailVerificationResponse = EmailVerificationResponse;
643
783
  type models_ErrorCode = ErrorCode;
644
784
  declare const models_ErrorCode: typeof ErrorCode;
645
785
  type models_ForgotPasswordRequest = ForgotPasswordRequest;
@@ -650,9 +790,18 @@ type models_HubProject = HubProject;
650
790
  type models_HubProjectsListResponse = HubProjectsListResponse;
651
791
  type models_InviteApplication = InviteApplication;
652
792
  type models_InviteApplicationListResponse = InviteApplicationListResponse;
793
+ type models_InviteCode = InviteCode;
653
794
  type models_InviteCodeBindRequest = InviteCodeBindRequest;
795
+ type models_InviteCodeDetailResponse = InviteCodeDetailResponse;
654
796
  type models_InviteCodeGenerateResponse = InviteCodeGenerateResponse;
655
797
  type models_InviteCodeVerifyResponse = InviteCodeVerifyResponse;
798
+ type models_InviteStats = InviteStats;
799
+ type models_InviteStatsResponse = InviteStatsResponse;
800
+ type models_InviteUsage = InviteUsage;
801
+ type models_ListInviteUsagesRequest = ListInviteUsagesRequest;
802
+ type models_ListInviteUsagesResponse = ListInviteUsagesResponse;
803
+ type models_ListInvitesRequest = ListInvitesRequest;
804
+ type models_ListInvitesResponse = ListInvitesResponse;
656
805
  type models_LoginRequest = LoginRequest;
657
806
  type models_LoginResponse = LoginResponse;
658
807
  type models_MarketplaceSkill = MarketplaceSkill;
@@ -678,7 +827,7 @@ type models_UserInstalledSkillsListResponse = UserInstalledSkillsListResponse;
678
827
  type models_VideoDetails = VideoDetails;
679
828
  declare namespace models {
680
829
  export { models_ErrorCode as ErrorCode };
681
- export type { models_AccountExistsErrorDetails as AccountExistsErrorDetails, models_ApiError as ApiError, models_ApiServiceTokenResponse as ApiServiceTokenResponse, models_Container as Container, models_ContainerDetailResponse as ContainerDetailResponse, models_ContainerListResponse as ContainerListResponse, models_ContainerStatsResponse as ContainerStatsResponse, models_ConversationStatus as ConversationStatus, models_CreateMarketplaceSkillRequest as CreateMarketplaceSkillRequest, models_CreateVideoShareRequest as CreateVideoShareRequest, models_CreateVideoShareResponse as CreateVideoShareResponse, models_ForgotPasswordRequest as ForgotPasswordRequest, models_ForkProjectRequest as ForkProjectRequest, models_ForkProjectResponse as ForkProjectResponse, models_HealthResponse as HealthResponse, models_HubProject as HubProject, models_HubProjectsListResponse as HubProjectsListResponse, models_InviteApplication as InviteApplication, models_InviteApplicationListResponse as InviteApplicationListResponse, models_InviteCodeBindRequest as InviteCodeBindRequest, models_InviteCodeGenerateResponse as InviteCodeGenerateResponse, models_InviteCodeVerifyResponse as InviteCodeVerifyResponse, models_LoginRequest as LoginRequest, models_LoginResponse as LoginResponse, models_MarketplaceSkill as MarketplaceSkill, models_MarketplaceSkillsListResponse as MarketplaceSkillsListResponse, models_OAuthAuthorizeRequest as OAuthAuthorizeRequest, models_OAuthAuthorizeResponse as OAuthAuthorizeResponse, models_PublishProjectRequest as PublishProjectRequest, models_PublishSkillRequest as PublishSkillRequest, models_RegisterContainerRequest as RegisterContainerRequest, models_RegisterContainerResponse as RegisterContainerResponse, models_RegisterRequest as RegisterRequest, models_RegisterResponse as RegisterResponse, models_ResetPasswordRequest as ResetPasswordRequest, models_SocialMediaLink as SocialMediaLink, models_SocialMediaLinksResponse as SocialMediaLinksResponse, models_SpeechTokenResponse as SpeechTokenResponse, models_SubmitInviteApplicationRequest as SubmitInviteApplicationRequest, models_SuccessResponse as SuccessResponse, models_TrackAppTypeRequest as TrackAppTypeRequest, models_User as User, models_UserInstalledSkill as UserInstalledSkill, models_UserInstalledSkillsListResponse as UserInstalledSkillsListResponse, models_VideoDetails as VideoDetails };
830
+ export type { models_AccountExistsErrorDetails as AccountExistsErrorDetails, models_ApiError as ApiError, models_ApiServiceTokenResponse as ApiServiceTokenResponse, models_BindInviteCodeRequest as BindInviteCodeRequest, models_BindInviteCodeResponse as BindInviteCodeResponse, models_Container as Container, models_ContainerDetailResponse as ContainerDetailResponse, models_ContainerListResponse as ContainerListResponse, models_ContainerStatsResponse as ContainerStatsResponse, models_ConversationStatus as ConversationStatus, models_CreateMarketplaceSkillRequest as CreateMarketplaceSkillRequest, models_CreateVideoShareRequest as CreateVideoShareRequest, models_CreateVideoShareResponse as CreateVideoShareResponse, models_EmailVerificationResponse as EmailVerificationResponse, models_ForgotPasswordRequest as ForgotPasswordRequest, models_ForkProjectRequest as ForkProjectRequest, models_ForkProjectResponse as ForkProjectResponse, models_HealthResponse as HealthResponse, models_HubProject as HubProject, models_HubProjectsListResponse as HubProjectsListResponse, models_InviteApplication as InviteApplication, models_InviteApplicationListResponse as InviteApplicationListResponse, models_InviteCode as InviteCode, models_InviteCodeBindRequest as InviteCodeBindRequest, models_InviteCodeDetailResponse as InviteCodeDetailResponse, models_InviteCodeGenerateResponse as InviteCodeGenerateResponse, models_InviteCodeVerifyResponse as InviteCodeVerifyResponse, models_InviteStats as InviteStats, models_InviteStatsResponse as InviteStatsResponse, models_InviteUsage as InviteUsage, models_ListInviteUsagesRequest as ListInviteUsagesRequest, models_ListInviteUsagesResponse as ListInviteUsagesResponse, models_ListInvitesRequest as ListInvitesRequest, models_ListInvitesResponse as ListInvitesResponse, models_LoginRequest as LoginRequest, models_LoginResponse as LoginResponse, models_MarketplaceSkill as MarketplaceSkill, models_MarketplaceSkillsListResponse as MarketplaceSkillsListResponse, models_OAuthAuthorizeRequest as OAuthAuthorizeRequest, models_OAuthAuthorizeResponse as OAuthAuthorizeResponse, models_PublishProjectRequest as PublishProjectRequest, models_PublishSkillRequest as PublishSkillRequest, models_RegisterContainerRequest as RegisterContainerRequest, models_RegisterContainerResponse as RegisterContainerResponse, models_RegisterRequest as RegisterRequest, models_RegisterResponse as RegisterResponse, models_ResetPasswordRequest as ResetPasswordRequest, models_SocialMediaLink as SocialMediaLink, models_SocialMediaLinksResponse as SocialMediaLinksResponse, models_SpeechTokenResponse as SpeechTokenResponse, models_SubmitInviteApplicationRequest as SubmitInviteApplicationRequest, models_SuccessResponse as SuccessResponse, models_TrackAppTypeRequest as TrackAppTypeRequest, models_User as User, models_UserInstalledSkill as UserInstalledSkill, models_UserInstalledSkillsListResponse as UserInstalledSkillsListResponse, models_VideoDetails as VideoDetails };
682
831
  }
683
832
 
684
833
  /**
@@ -773,6 +922,29 @@ interface SeaVerseBackendAPIClientOptions {
773
922
  * Hook 配置
774
923
  */
775
924
  hooks?: HookManagerOptions;
925
+ /**
926
+ * HTTP 请求重试配置
927
+ * 默认禁用重试(maxRetries: 0)
928
+ *
929
+ * @example
930
+ * // 启用重试,最多重试 3 次
931
+ * retryOptions: {
932
+ * maxRetries: 3,
933
+ * retryDelay: 1000,
934
+ * retryStatusCodes: [408, 429, 500, 502, 503, 504]
935
+ * }
936
+ *
937
+ * @example
938
+ * // 自定义重试逻辑
939
+ * retryOptions: {
940
+ * maxRetries: 5,
941
+ * retryDelay: 2000,
942
+ * shouldRetry: (error) => {
943
+ * return error.response?.status === 503;
944
+ * }
945
+ * }
946
+ */
947
+ retryOptions?: RetryOptions;
776
948
  }
777
949
  /**
778
950
  * SeaVerse Backend API Client
@@ -862,16 +1034,114 @@ declare class SeaVerseBackendAPIClient {
862
1034
  * Reset password with token from email
863
1035
  */
864
1036
  resetPassword(data: ResetPasswordRequest, options?: AxiosRequestConfig): Promise<SuccessResponse>;
1037
+ /**
1038
+ * Verify email with token
1039
+ * Verify user email and return JWT tokens for auto-login
1040
+ *
1041
+ * @param verifyToken - Email verification token from email link
1042
+ * @param options - Additional axios request options
1043
+ * @returns Email verification response with user data and JWT tokens
1044
+ *
1045
+ * @example
1046
+ * const { data } = await client.verifyEmail('abc123def456...');
1047
+ * localStorage.setItem('token', data.token);
1048
+ * localStorage.setItem('refreshToken', data.refreshToken);
1049
+ * console.log('User:', data.user);
1050
+ */
1051
+ verifyEmail(verifyToken: string, options?: AxiosRequestConfig): Promise<EmailVerificationResponse>;
865
1052
  /**
866
1053
  * Get api-service token
867
1054
  * Generate token for accessing api-service from sandbox
868
1055
  */
869
1056
  getApiServiceToken(options?: AxiosRequestConfig): Promise<ApiServiceTokenResponse>;
1057
+ /**
1058
+ * List my invite codes
1059
+ * Get all invite codes created by the current user
1060
+ *
1061
+ * @param params - Optional pagination and filtering parameters
1062
+ * @param options - Additional axios request options
1063
+ * @returns List of invite codes with pagination info
1064
+ *
1065
+ * @example
1066
+ * // List all active invite codes
1067
+ * const result = await client.listInvites({
1068
+ * status: 'active',
1069
+ * page: 1,
1070
+ * page_size: 20
1071
+ * });
1072
+ * console.log('Invites:', result.data.invites);
1073
+ */
1074
+ listInvites(params?: ListInvitesRequest, options?: AxiosRequestConfig): Promise<ListInvitesResponse>;
1075
+ /**
1076
+ * Get invite code statistics
1077
+ * Get statistics for invite codes created by the current user
1078
+ *
1079
+ * @param options - Additional axios request options
1080
+ * @returns Invite code statistics
1081
+ *
1082
+ * @example
1083
+ * const result = await client.getInviteStats();
1084
+ * console.log('Total codes:', result.data.total_codes);
1085
+ * console.log('Total uses:', result.data.total_uses);
1086
+ */
1087
+ getInviteStats(options?: AxiosRequestConfig): Promise<InviteStatsResponse>;
1088
+ /**
1089
+ * Get invite code details
1090
+ * Get detailed information for a specific invite code
1091
+ *
1092
+ * @param inviteId - Invite code ID
1093
+ * @param options - Additional axios request options
1094
+ * @returns Invite code details
1095
+ *
1096
+ * @example
1097
+ * const result = await client.getInvite('inv_abc123');
1098
+ * console.log('Code:', result.data.code);
1099
+ * console.log('Used:', result.data.used_count);
1100
+ */
1101
+ getInvite(inviteId: string, options?: AxiosRequestConfig): Promise<InviteCodeDetailResponse>;
1102
+ /**
1103
+ * Get invite code usage records
1104
+ * Get all usage records for a specific invite code
1105
+ *
1106
+ * @param inviteId - Invite code ID
1107
+ * @param params - Optional pagination parameters
1108
+ * @param options - Additional axios request options
1109
+ * @returns List of usage records with pagination info
1110
+ *
1111
+ * @example
1112
+ * const result = await client.getInviteUsages('inv_abc123', {
1113
+ * page: 1,
1114
+ * page_size: 20
1115
+ * });
1116
+ * console.log('Usages:', result.data.usages);
1117
+ */
1118
+ getInviteUsages(inviteId: string, params?: ListInviteUsagesRequest, options?: AxiosRequestConfig): Promise<ListInviteUsagesResponse>;
1119
+ /**
1120
+ * Bind invitation code to temporary account
1121
+ * Activate a temporary account by binding an invitation code
1122
+ *
1123
+ * @param data - Bind invite code request
1124
+ * @param options - Additional axios request options
1125
+ * @returns Activation response with JWT tokens and user info
1126
+ *
1127
+ * @example
1128
+ * // Bind invitation code to activate temporary account
1129
+ * const result = await client.bindInviteCode({
1130
+ * user_id: 'user_temp_xyz789',
1131
+ * invite_code: 'ABCD1234'
1132
+ * });
1133
+ *
1134
+ * // Auto-login with returned tokens
1135
+ * localStorage.setItem('token', result.data.token);
1136
+ * localStorage.setItem('refreshToken', result.data.refreshToken);
1137
+ * console.log('Account activated:', result.data.user);
1138
+ */
1139
+ bindInviteCode(data: BindInviteCodeRequest, options?: AxiosRequestConfig): Promise<BindInviteCodeResponse>;
870
1140
  /**
871
1141
  * Google OAuth authorization (Backend Proxy Mode)
872
1142
  * Generate OAuth authorization URL for Google login
873
1143
  *
874
- * @param data - OAuth authorize request (return_url is optional, defaults to window.location.origin)
1144
+ * @param data - OAuth authorize request (return_url is optional, defaults to window.location.href)
875
1145
  * @param options - Additional axios request options
876
1146
  *
877
1147
  * @example
@@ -896,7 +1166,7 @@ declare class SeaVerseBackendAPIClient {
896
1166
  * Discord OAuth authorization (Backend Proxy Mode)
897
1167
  * Generate OAuth authorization URL for Discord login
898
1168
  *
899
- * @param data - OAuth authorize request (return_url is optional, defaults to window.location.origin)
1169
+ * @param data - OAuth authorize request (return_url is optional, defaults to window.location.href)
900
1170
  * @param options - Additional axios request options
901
1171
  */
902
1172
  discordAuthorize(data?: OAuthAuthorizeRequest, options?: AxiosRequestConfig): Promise<OAuthAuthorizeResponse>;
@@ -908,7 +1178,7 @@ declare class SeaVerseBackendAPIClient {
908
1178
  * GitHub OAuth authorization (Backend Proxy Mode)
909
1179
  * Generate OAuth authorization URL for GitHub login
910
1180
  *
911
- * @param data - OAuth authorize request (return_url is optional, defaults to window.location.origin)
1181
+ * @param data - OAuth authorize request (return_url is optional, defaults to window.location.href)
912
1182
  * @param options - Additional axios request options
913
1183
  */
914
1184
  githubAuthorize(data?: OAuthAuthorizeRequest, options?: AxiosRequestConfig): Promise<OAuthAuthorizeResponse>;
@@ -1002,6 +1272,7 @@ interface AuthModalOptions {
1002
1272
  client: SeaVerseBackendAPIClient;
1003
1273
  onLoginSuccess?: (token: string, user: any) => void;
1004
1274
  onSignupSuccess?: (token: string, user: any) => void;
1275
+ onInviteCodeRequired?: (userId: string, email: string) => void;
1005
1276
  onError?: (error: Error) => void;
1006
1277
  theme?: 'dark' | 'light';
1007
1278
  returnUrl?: string;
@@ -1023,11 +1294,13 @@ declare class AuthModal {
1023
1294
  private modal;
1024
1295
  private currentView;
1025
1296
  private resetToken;
1297
+ private tempUserId;
1298
+ private tempUserEmail;
1026
1299
  constructor(options: AuthModalOptions);
1027
1300
  /**
1028
1301
  * Show the authentication modal
1029
1302
  */
1030
- show(initialView?: 'login' | 'signup'): void;
1303
+ show(initialView?: 'login' | 'signup' | 'forgot' | 'reset-password' | 'invite-code' | 'message'): void;
1031
1304
  /**
1032
1305
  * Hide the authentication modal
1033
1306
  */
@@ -1043,14 +1316,23 @@ declare class AuthModal {
1043
1316
  private createSignupForm;
1044
1317
  private createForgotPasswordForm;
1045
1318
  private createResetPasswordForm;
1319
+ private createInviteCodeForm;
1046
1320
  private createSuccessMessage;
1047
1321
  private createFormGroup;
1048
1322
  private createPasswordInput;
1049
1323
  private createSocialButton;
1324
+ /**
1325
+ * Check if URL contains email verification token and auto-verify
1326
+ */
1327
+ private checkForEmailVerification;
1050
1328
  /**
1051
1329
  * Check if URL contains reset token and auto-show reset password form
1052
1330
  */
1053
1331
  private checkForResetToken;
1332
+ /**
1333
+ * Check if URL contains invite code required error and auto-show invite code form
1334
+ */
1335
+ private checkForInviteCodeRequired;
1054
1336
  private bindEventListeners;
1055
1337
  /**
1056
1338
  * Bind click events to social login buttons
@@ -1061,8 +1343,15 @@ declare class AuthModal {
1061
1343
  private handleSignup;
1062
1344
  private handleForgotPassword;
1063
1345
  private handleResetPassword;
1064
- private showMessage;
1346
+ private handleBindInviteCode;
1347
+ private showSuccess;
1065
1348
  private showError;
1349
+ private showWarning;
1350
+ private showInfo;
1351
+ /**
1352
+ * @deprecated Use showSuccess, showError, showWarning, or showInfo instead
1353
+ */
1354
+ private showMessage;
1066
1355
  /**
1067
1356
  * Start OAuth flow for a given provider (Backend Proxy Mode)
1068
1357
  *
@@ -1081,11 +1370,102 @@ declare class AuthModal {
1081
1370
  * This static method checks if current URL has a token and processes it.
1082
1371
  */
1083
1372
  static handleOAuthCallback(options: AuthModalOptions): AuthModalResult | null;
1373
+ /**
1374
+ * Handle invite code required scenario (static method for custom UI)
1375
+ *
1376
+ * When backend redirects to return_url?error_code=INVITE_CODE_REQUIRED&user_id=xxx&email=xxx,
1377
+ * call this method to show the invite code form or handle it custom way.
1378
+ *
1379
+ * @param options - Auth modal options
1380
+ * @param customHandler - Optional custom handler for invite code requirement
1381
+ * @returns Object with userId and email if invite code is required, null otherwise
1382
+ *
1383
+ * @example
1384
+ * // Auto-show AuthModal invite code form
1385
+ * const modal = new AuthModal(options);
1386
+ * AuthModal.handleInviteCodeRequired(options);
1387
+ *
1388
+ * @example
1389
+ * // Custom UI handling
1390
+ * const result = AuthModal.handleInviteCodeRequired(options, (userId, email) => {
1391
+ * // Show your custom invite code input UI
1392
+ * const code = prompt('Enter invitation code:');
1393
+ * if (code) {
1394
+ * options.client.bindInviteCode({ user_id: userId, invite_code: code })
1395
+ * .then(res => {
1396
+ * localStorage.setItem('token', res.data.token);
1397
+ * window.location.reload();
1398
+ * });
1399
+ * }
1400
+ * });
1401
+ */
1402
+ static handleInviteCodeRequired(options: AuthModalOptions, customHandler?: (userId: string, email: string) => void): {
1403
+ userId: string;
1404
+ email: string;
1405
+ } | null;
1084
1406
  }
1085
1407
  /**
1086
1408
  * Create and show auth modal
1087
1409
  */
1088
1410
  declare function createAuthModal(options: AuthModalOptions): AuthModal;
1089
1411
 
1090
- export { AuthFactory, AuthModal, AuthProvider, BuiltInHooks, ENVIRONMENT_CONFIGS, ErrorCode, SeaVerseBackendAPIClient, createAuthModal, detectEnvironment, getEnvironmentConfig, models };
1091
- export type { AccountExistsErrorDetails, ApiError, ApiServiceTokenResponse, AuthModalOptions, AuthModalResult, Container, ContainerDetailResponse, ContainerListResponse, ContainerStatsResponse, ConversationStatus, CreateMarketplaceSkillRequest, CreateVideoShareRequest, CreateVideoShareResponse, Environment, EnvironmentConfig, ForgotPasswordRequest, ForkProjectRequest, ForkProjectResponse, HealthResponse, HubProject, HubProjectsListResponse, InviteApplication, InviteApplicationListResponse, InviteCodeBindRequest, InviteCodeGenerateResponse, InviteCodeVerifyResponse, LoginRequest, LoginResponse, MarketplaceSkill, MarketplaceSkillsListResponse, OAuthAuthorizeRequest, OAuthAuthorizeResponse, PublishProjectRequest, PublishSkillRequest, RegisterContainerRequest, RegisterContainerResponse, RegisterRequest, RegisterResponse, ResetPasswordRequest, SeaVerseBackendAPIClientOptions, SocialMediaLink, SocialMediaLinksResponse, SpeechTokenResponse, SubmitInviteApplicationRequest, SuccessResponse, TrackAppTypeRequest, User, UserInstalledSkill, UserInstalledSkillsListResponse, VideoDetails };
1412
+ /**
1413
+ * Toast Notification System
1414
+ * A modern, glass-morphism inspired notification component
1415
+ */
1416
+ type ToastType = 'success' | 'error' | 'warning' | 'info';
1417
+ interface ToastOptions {
1418
+ type: ToastType;
1419
+ title: string;
1420
+ message: string;
1421
+ duration?: number;
1422
+ onClose?: () => void;
1423
+ }
1424
+ declare class Toast {
1425
+ private static container;
1426
+ private static toasts;
1427
+ private static nextId;
1428
+ private static cssInjected;
1429
+ /**
1430
+ * Show a toast notification
1431
+ */
1432
+ static show(options: ToastOptions): void;
1433
+ /**
1434
+ * Convenience methods for different types
1435
+ */
1436
+ static success(title: string, message: string, duration?: number): void;
1437
+ static error(title: string, message: string, duration?: number): void;
1438
+ static warning(title: string, message: string, duration?: number): void;
1439
+ static info(title: string, message: string, duration?: number): void;
1440
+ /**
1441
+ * Create the toast container
1442
+ */
1443
+ private static createContainer;
1444
+ /**
1445
+ * Create a toast element using safe DOM methods
1446
+ */
1447
+ private static createToast;
1448
+ /**
1449
+ * Create icon SVG element for each type
1450
+ */
1451
+ private static createIconSVG;
1452
+ /**
1453
+ * Create close button SVG
1454
+ */
1455
+ private static createCloseSVG;
1456
+ /**
1457
+ * Dismiss a toast
1458
+ */
1459
+ private static dismiss;
1460
+ /**
1461
+ * Dismiss all toasts
1462
+ */
1463
+ static dismissAll(): void;
1464
+ /**
1465
+ * Inject Toast CSS into the page
1466
+ */
1467
+ private static injectCSS;
1468
+ }
1469
+
1470
+ export { AuthFactory, AuthModal, AuthProvider, BuiltInHooks, ENVIRONMENT_CONFIGS, ErrorCode, SeaVerseBackendAPIClient, Toast, createAuthModal, detectEnvironment, getEnvironmentConfig, models };
1471
+ export type { AccountExistsErrorDetails, ApiError, ApiServiceTokenResponse, AuthModalOptions, AuthModalResult, BindInviteCodeRequest, BindInviteCodeResponse, Container, ContainerDetailResponse, ContainerListResponse, ContainerStatsResponse, ConversationStatus, CreateMarketplaceSkillRequest, CreateVideoShareRequest, CreateVideoShareResponse, EmailVerificationResponse, Environment, EnvironmentConfig, ForgotPasswordRequest, ForkProjectRequest, ForkProjectResponse, HealthResponse, HubProject, HubProjectsListResponse, InviteApplication, InviteApplicationListResponse, InviteCode, InviteCodeBindRequest, InviteCodeDetailResponse, InviteCodeGenerateResponse, InviteCodeVerifyResponse, InviteStats, InviteStatsResponse, InviteUsage, ListInviteUsagesRequest, ListInviteUsagesResponse, ListInvitesRequest, ListInvitesResponse, LoginRequest, LoginResponse, MarketplaceSkill, MarketplaceSkillsListResponse, OAuthAuthorizeRequest, OAuthAuthorizeResponse, PublishProjectRequest, PublishSkillRequest, RegisterContainerRequest, RegisterContainerResponse, RegisterRequest, RegisterResponse, ResetPasswordRequest, RetryOptions, SeaVerseBackendAPIClientOptions, SocialMediaLink, SocialMediaLinksResponse, SpeechTokenResponse, SubmitInviteApplicationRequest, SuccessResponse, ToastOptions, ToastType, TrackAppTypeRequest, User, UserInstalledSkill, UserInstalledSkillsListResponse, VideoDetails };