@pmate/account-sdk 0.5.0 → 0.5.2

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
@@ -3,12 +3,15 @@ import { WritableAtom } from 'jotai';
3
3
  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
- import * as _pchip_utils from '@pchip/utils';
7
- import { Emitter, Maybe } from '@pchip/utils';
6
+ import * as _pmate_utils from '@pmate/utils';
7
+ import { Emitter, 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';
11
+ import * as i18next from 'i18next';
12
+ import * as node_modules_i18next from 'node_modules/i18next';
11
13
  export { getLangFull, isNicknameValid, legacyLangMap, normalizeLang } from '@pmate/lang';
14
+ export { I18nextProvider } from 'react-i18next';
12
15
 
13
16
  type UploadAvatarParams = {
14
17
  file: File;
@@ -73,7 +76,7 @@ declare const profileDraftAtom: jotai.PrimitiveAtom<ProfileDraft> & {
73
76
  type ProfileByIdAtomFamily = AtomFamily<string, WritableAtom<Promise<Profile | null>, [], void>>;
74
77
  declare const profileByIdAtom: ProfileByIdAtomFamily;
75
78
 
76
- declare const profilesAtom: jotai.Atom<_pchip_utils.Loadable<Profile[]>>;
79
+ declare const profilesAtom: jotai.Atom<_pmate_utils.Loadable<Profile[]>>;
77
80
 
78
81
  declare const updateProfileAtom: jotai.WritableAtom<null, [profileId: string, updates: Record<string, any>], Promise<void>> & {
79
82
  init: null;
@@ -121,9 +124,13 @@ type AuthProviderV2Props = PropsWithChildren<{
121
124
  }>;
122
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;
123
126
 
127
+ declare const i18n: node_modules_i18next.i18n;
128
+
129
+ declare const useTranslation: () => i18next.TFunction<"translation", undefined>;
130
+
124
131
  declare const DEFAULT_APP_ID = "@pmate/chat";
125
132
  interface ProfileStep$1 {
126
- type: "nickname" | "learning-language" | "mother-tongue" | "gender" | "is-adult" | "age";
133
+ type: "nickname" | "learning-language" | "mother-tongue" | "gender" | "is-adult" | "age" | "Identity";
127
134
  title: string;
128
135
  required: boolean;
129
136
  }
@@ -132,12 +139,14 @@ interface AppConfig {
132
139
  name: string;
133
140
  icon: string;
134
141
  background: string;
142
+ themeColor?: string;
135
143
  welcomeText: string;
136
144
  profiles: ProfileStep$1[];
137
145
  }
138
146
  declare const getAppConfig: (appId: string | null) => AppConfig;
139
147
 
140
148
  type ProfileStepType = "nickname" | "learning-language" | "mother-tongue" | "gender" | "is-adult" | "age";
149
+ declare const isProfileStepType: (value: string) => value is ProfileStepType;
141
150
  interface ProfileStep {
142
151
  type: ProfileStepType;
143
152
  title: string;
@@ -148,8 +157,8 @@ type UseProfileStepFlowParams = {
148
157
  params: URLSearchParams;
149
158
  };
150
159
  declare const useProfileStepFlow: ({ params, }: UseProfileStepFlowParams) => {
151
- activeStep: "gender" | "nickname" | "learning-language" | "mother-tongue" | "is-adult" | "age";
152
- appProfileSteps: ("gender" | "nickname" | "learning-language" | "mother-tongue" | "is-adult" | "age")[];
160
+ activeStep: ProfileStepType;
161
+ appProfileSteps: ProfileStepType[];
153
162
  buildStepUrl: (next: ProfileStepType) => string;
154
163
  createSteps: ProfileStepType[];
155
164
  isCreateFlowStep: boolean;
@@ -245,10 +254,10 @@ declare class AccountService {
245
254
  private static sessionCached;
246
255
  static vcode(payload: VCodeIssueRequest): Promise<VCodeIssueResult>;
247
256
  static login(request: AuthRequest): Promise<AuthLoginResponse>;
248
- static logout(token?: string): Promise<{
257
+ static logout(token?: string, app?: string): Promise<{
249
258
  success: boolean;
250
259
  }>;
251
- static session(token?: string): Promise<AuthSession | null>;
260
+ static session(token?: string, app?: string): Promise<AuthSession | null>;
252
261
  private static authRequest;
253
262
  }
254
263
 
@@ -289,5 +298,5 @@ declare class EntityService {
289
298
  }>(ids: string[]): Promise<Record<string, T>>;
290
299
  }
291
300
 
292
- export { AccountManagerEvent, AccountManagerV2, AccountService, Api, AuthProviderV2, DEFAULT_APP_ID, EntityService, LSKEYS, NotAuthenticatedError, ProfileService, Redirect, accountAtom, accountStateAtom, createProfileAtom, getAppConfig, learningLangAtom, localStorageJsonAtom, loginAtom, motherTongueAtom, profileAtom, profileByIdAtom, profileDraftAtom, profilesAtom, resolveAppId, sessionCheckAtom, switchProfileAtom, updateProfileAtom, uploadAvatarAtom, useAppBackgroundStyle, useAuthApp, useProfileStepFlow, userLogoutAtom, userSettingsAtom };
301
+ 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 };
293
302
  export type { AccountSnapshot, AppConfig, AuthRoute, ProfileDraft, ProfileStep, ProfileStepType };