@pmate/account-sdk 0.5.3 → 0.5.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.
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ import * as _pmate_meta from '@pmate/meta';
4
4
  import { AccountState, Profile, UserSettings, LocalProfileState, RoomPeerInfo, LangShort, VCodeIssueRequest, VCodeIssueResult, AuthRequest, AuthLoginResponse, AuthSession, CreateProfileRequest, UpdateProfileRequest, ProfileScope, GroupInfo } from '@pmate/meta';
5
5
  import { AtomFamily } from 'jotai-family';
6
6
  import * as _pmate_utils from '@pmate/utils';
7
- import { Emitter, Maybe } from '@pmate/utils';
7
+ import { EmitterV2, Maybe } from '@pmate/utils';
8
8
  import * as react_jsx_runtime from 'react/jsx-runtime';
9
9
  import * as react from 'react';
10
10
  import { PropsWithChildren } from 'react';
@@ -122,7 +122,7 @@ type AuthProviderV2Props = PropsWithChildren<{
122
122
  replace?: boolean;
123
123
  }) => void;
124
124
  }>;
125
- declare const AuthProviderV2: ({ app, authRoutes, rtcProvider: RtcProvider, pathname: pathnameProp, navigate: navigateProp, children, }: AuthProviderV2Props) => string | number | bigint | boolean | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
125
+ declare const AuthProviderV2: ({ app, authRoutes, rtcProvider: RtcProvider, pathname: pathnameProp, navigate: navigateProp, children, }: AuthProviderV2Props) => string | number | boolean | Iterable<react.ReactNode> | react_jsx_runtime.JSX.Element | null | undefined;
126
126
 
127
127
  declare const i18n: node_modules_i18next.i18n;
128
128
 
@@ -146,6 +146,7 @@ interface AppConfig {
146
146
  declare const getAppConfig: (appId: string | null) => AppConfig;
147
147
 
148
148
  type ProfileStepType = "nickname" | "learning-language" | "mother-tongue" | "gender" | "is-adult" | "age";
149
+ declare const isProfileStepType: (value: string) => value is ProfileStepType;
149
150
  interface ProfileStep {
150
151
  type: ProfileStepType;
151
152
  title: string;
@@ -156,8 +157,8 @@ type UseProfileStepFlowParams = {
156
157
  params: URLSearchParams;
157
158
  };
158
159
  declare const useProfileStepFlow: ({ params, }: UseProfileStepFlowParams) => {
159
- activeStep: "nickname" | "learning-language" | "mother-tongue" | "gender" | "is-adult" | "age" | "Identity";
160
- appProfileSteps: ("nickname" | "learning-language" | "mother-tongue" | "gender" | "is-adult" | "age" | "Identity")[];
160
+ activeStep: ProfileStepType;
161
+ appProfileSteps: ProfileStepType[];
161
162
  buildStepUrl: (next: ProfileStepType) => string;
162
163
  createSteps: ProfileStepType[];
163
164
  isCreateFlowStep: boolean;
@@ -191,7 +192,10 @@ declare const useAppBackgroundStyle: () => {
191
192
  declare enum AccountManagerEvent {
192
193
  StateChange = "stateChange"
193
194
  }
194
- declare class AccountManagerV2 extends Emitter<AccountManagerEvent> {
195
+ type AccountManagerEventMap = {
196
+ [AccountManagerEvent.StateChange]: void;
197
+ };
198
+ declare class AccountManagerV2 extends EmitterV2<AccountManagerEventMap> {
195
199
  private readonly app;
196
200
  private static instances;
197
201
  constructor(app: string);
@@ -253,10 +257,10 @@ declare class AccountService {
253
257
  private static sessionCached;
254
258
  static vcode(payload: VCodeIssueRequest): Promise<VCodeIssueResult>;
255
259
  static login(request: AuthRequest): Promise<AuthLoginResponse>;
256
- static logout(token?: string): Promise<{
260
+ static logout(token?: string, app?: string): Promise<{
257
261
  success: boolean;
258
262
  }>;
259
- static session(token?: string): Promise<AuthSession | null>;
263
+ static session(token?: string, app?: string): Promise<AuthSession | null>;
260
264
  private static authRequest;
261
265
  }
262
266
 
@@ -297,5 +301,5 @@ declare class EntityService {
297
301
  }>(ids: string[]): Promise<Record<string, T>>;
298
302
  }
299
303
 
300
- export { AccountManagerEvent, AccountManagerV2, AccountService, Api, AuthProviderV2, DEFAULT_APP_ID, EntityService, LSKEYS, NotAuthenticatedError, ProfileService, Redirect, accountAtom, accountStateAtom, createProfileAtom, getAppConfig, i18n, learningLangAtom, localStorageJsonAtom, loginAtom, motherTongueAtom, profileAtom, profileByIdAtom, profileDraftAtom, profilesAtom, resolveAppId, sessionCheckAtom, switchProfileAtom, updateProfileAtom, uploadAvatarAtom, useAppBackgroundStyle, useAuthApp, useProfileStepFlow, useTranslation, userLogoutAtom, userSettingsAtom };
301
- export type { AccountSnapshot, AppConfig, AuthRoute, ProfileDraft, ProfileStep, ProfileStepType };
304
+ export { AccountManagerEvent, AccountManagerV2, AccountService, Api, AuthProviderV2, DEFAULT_APP_ID, EntityService, LSKEYS, NotAuthenticatedError, ProfileService, Redirect, accountAtom, accountStateAtom, createProfileAtom, getAppConfig, i18n, isProfileStepType, learningLangAtom, localStorageJsonAtom, loginAtom, motherTongueAtom, profileAtom, profileByIdAtom, profileDraftAtom, profilesAtom, resolveAppId, sessionCheckAtom, switchProfileAtom, updateProfileAtom, uploadAvatarAtom, useAppBackgroundStyle, useAuthApp, useProfileStepFlow, useTranslation, userLogoutAtom, userSettingsAtom };
305
+ export type { AccountManagerEventMap, AccountSnapshot, AppConfig, AuthRoute, ProfileDraft, ProfileStep, ProfileStepType };