@magmamath/frontend-config 0.0.1-rc.18 → 0.0.1-rc.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.mts CHANGED
@@ -1,5 +1,3 @@
1
- import * as react from 'react';
2
- import { ComponentType } from 'react';
3
1
  import * as effector from 'effector';
4
2
 
5
3
  declare enum DateFormat {
@@ -15,21 +13,20 @@ declare enum DateFormat {
15
13
  FULL_WITH_SECONDS = "DD MMM YYYY HH:mm:ss",
16
14
  FULL_WITH_SECONDS_US = "DD MMM YYYY hh:mm:ss A"
17
15
  }
18
- declare const DateLocale: {
19
- readonly US: "en";
20
- readonly SV: "sv";
21
- readonly 'en-SE': "en";
22
- readonly 'sv-SE': "sv";
23
- readonly GB: "en";
24
- readonly 'en-GB': "en";
25
- readonly CA: "en";
26
- readonly 'en-CA': "en";
27
- readonly SCT: "en";
28
- readonly 'en-SCT': "en";
29
- readonly DE: "de";
30
- readonly 'de-DE': "de";
31
- };
32
- type DateLocale = (typeof DateLocale)[keyof typeof DateLocale];
16
+ declare enum DateLocale {
17
+ US = "en",
18
+ SV = "sv",
19
+ 'en-SE' = "en",
20
+ 'sv-SE' = "sv",
21
+ GB = "en",
22
+ 'en-GB' = "en",
23
+ CA = "en",
24
+ 'en-CA' = "en",
25
+ SCT = "en",
26
+ 'en-SCT' = "en",
27
+ DE = "de",
28
+ 'de-DE' = "de"
29
+ }
33
30
 
34
31
  declare enum Platform {
35
32
  STUDENTS_WEB = "STUDENTS",
@@ -39,10 +36,6 @@ declare enum Platform {
39
36
  STUDENTS_APP = "STUDENTS_RN_APP",
40
37
  TEACHERS_APP = "TEACHERS_RN_APP"
41
38
  }
42
- declare enum Environment {
43
- MARS = "MARS",
44
- PROD = "PROD"
45
- }
46
39
  declare enum Locale {
47
40
  US = "en-SE",
48
41
  SE = "sv-SE",
@@ -51,50 +44,9 @@ declare enum Locale {
51
44
  SCT = "en-SCT",
52
45
  DE = "de-DE"
53
46
  }
54
- declare enum Source {
55
- MATTEAPPEN = 0,
56
- SKOLON = 1,
57
- SKOLFEDERATION = 2,
58
- GOOGLE = 3,
59
- MICROSOFT = 4,
60
- CLEVER = 5,
61
- APPLE = 6,
62
- MATHSYNC = 7,
63
- CLASSLINK = 8,
64
- EDUCLOUD = 9,
65
- EGIL = 10,
66
- WONDE = 12,
67
- SCHOOLOGY = 13,
68
- SEEMIS = 14,
69
- IMPORT = 15,
70
- CANVAS = 16
71
- }
72
- declare enum LoginSource {
73
- MAGMA = 0,
74
- CLEVER = 1,
75
- CLASS_LINK = 2,
76
- SKOLON = 3,
77
- SKOLFEDERATION = 4,
78
- GOOGLE = 5,
79
- MICROSOFT = 6,
80
- APPLE = 7,
81
- SCHOOLOGY = 8,
82
- MY_LOGIN = 9
83
- }
84
- declare enum SSO {
85
- GOOGLE = "GOOGLE",
86
- MICROSOFT = "MICROSOFT",
87
- CLEVER = "CLEVER",
88
- SCHOOLOGY = "SCHOOLOGY",
89
- CLASS_LINK = "CLASS_LINK",
90
- SKOLFEDERATION = "SKOLFEDERATION",
91
- SKOLON = "SKOLON",
92
- WONDE = "WONDE"
93
- }
94
-
95
- declare enum MatrixMode {
96
- SKILL = "SKILL",
97
- STANDARD = "STANDARD"
47
+ declare enum Environment {
48
+ MARS = "MARS",
49
+ PROD = "PROD"
98
50
  }
99
51
 
100
52
  type RegionEnv = Readonly<{
@@ -106,10 +58,7 @@ type RegionEnv = Readonly<{
106
58
  SOCKET_URL: string;
107
59
  STUDENTS_WEB_URL: string;
108
60
  TEACHERS_WEB_URL: string;
109
- DISTRICT_WEB_URL: string;
110
61
  CDN_HOST: string;
111
- TOS_URL: string;
112
- MAGMAMATH_URL: string;
113
62
  }>;
114
63
  type CommonEnv = Readonly<{
115
64
  GOOGLE_API_KEY: string;
@@ -121,71 +70,7 @@ type CommonEnv = Readonly<{
121
70
  MYSCRIPT_REST_HMAC_KEY: string;
122
71
  LOGGLY_CUSTOMER_TOKEN: string;
123
72
  }>;
124
- type SharedEnvs = RegionEnv & CommonEnv;
125
- type SSOEnvs = Readonly<{
126
- GOOGLE_AUTH: string;
127
- MICROSOFT_AUTH: string;
128
- CLEVER_AUTH: string;
129
- CLASS_LINK_AUTH: string;
130
- SKOLFEDERATION_AUTH: string;
131
- SKOLON_AUTH: string;
132
- SCHOOLOGY_AUTH: string;
133
- WONDE_AUTH: string;
134
- }>;
135
- type IntercomEnvs = Readonly<{
136
- CLARITY_PROJECT_ID: string;
137
- INTERCOM_APP_ID: string;
138
- }>;
139
- type EnvPreset = {
140
- [Platform.STUDENTS_WEB]: {
141
- [key in Locale]: {
142
- [key in Environment]: SharedEnvs;
143
- };
144
- };
145
- [Platform.TEACHERS_WEB]: {
146
- [key in Locale]: {
147
- [key in Environment]: SharedEnvs;
148
- };
149
- };
150
- [Platform.DISTRICT_DASHBOARD]: {
151
- [key in Locale]: {
152
- [key in Environment]: SharedEnvs;
153
- };
154
- };
155
- [Platform.AUTH_WEB]: {
156
- [key in Locale]: {
157
- [key in Environment]: AuthWebVariables;
158
- };
159
- };
160
- [Platform.STUDENTS_APP]: {
161
- [key in Locale]: {
162
- [key in Environment]: unknown;
163
- };
164
- };
165
- [Platform.TEACHERS_APP]: {
166
- [key in Locale]: {
167
- [key in Environment]: unknown;
168
- };
169
- };
170
- };
171
- type EnvironmentalVariables<P extends Platform> = EnvPreset[P][Locale][Environment];
172
- type AuthWebVariables = Omit<RegionEnv & SSOEnvs & IntercomEnvs, 'CDN_HOST' | 'LOGGLY_TAG' | 'MYSCRIPT_HOST' | 'SOCKET_URL'>;
173
-
174
- type IconProps = {
175
- size?: number;
176
- };
177
-
178
- type SSOConfig = Readonly<{
179
- name: string;
180
- icon: ComponentType<IconProps>;
181
- type: SSO;
182
- loginSource: LoginSource;
183
- getUrl: (envs: SSOEnvs & SharedEnvs) => string;
184
- ownUrl?: boolean;
185
- }>;
186
-
187
- declare const SSO_CONFIG_MAP: Record<SSO, SSOConfig>;
188
- declare const SSO_CONFIG_LIST: SSOConfig[];
73
+ type EnvironmentVariables = RegionEnv & CommonEnv;
189
74
 
190
75
  type StudentsLocaleConfig = CommonLocaleConfig & {
191
76
  textFormatting: {
@@ -228,13 +113,28 @@ type StudentsLocaleConfig = CommonLocaleConfig & {
228
113
  statsTab: {
229
114
  buttonWithMinWidth: boolean;
230
115
  };
231
- smartEval: {
232
- language: string;
116
+ };
117
+
118
+ type DistrictLocaleConfig = CommonLocaleConfig & {
119
+ date: {
120
+ use24HourFormat: boolean;
121
+ locale: DateLocale;
122
+ formats: {
123
+ full: DateFormat;
124
+ dayMonthYear: DateFormat;
125
+ dayMonth: DateFormat;
126
+ hoursMinutes: DateFormat;
127
+ fullWithSeconds: DateFormat;
128
+ };
233
129
  };
234
130
  };
235
131
 
132
+ declare enum MatrixMode {
133
+ SKILL = "SKILL",
134
+ STANDARD = "STANDARD"
135
+ }
136
+
236
137
  type TeachersLocaleConfig = CommonLocaleConfig & {
237
- country: string;
238
138
  emails: {
239
139
  studentsList: string;
240
140
  };
@@ -278,45 +178,12 @@ type TeachersLocaleConfig = CommonLocaleConfig & {
278
178
  getStarted: {
279
179
  showSentEmailInfo: boolean;
280
180
  };
281
- firstLoginBooks: {
282
- isLargeGrade: ((grade: number) => boolean) | null;
283
- };
284
181
  grades: {
285
182
  showPrefix: boolean;
286
183
  showOtherGrade: boolean;
287
184
  };
288
185
  };
289
186
 
290
- type DistrictLocaleConfig = CommonLocaleConfig & {
291
- date: {
292
- use24HourFormat: boolean;
293
- locale: DateLocale;
294
- formats: {
295
- full: DateFormat;
296
- dayMonthYear: DateFormat;
297
- dayMonth: DateFormat;
298
- hoursMinutes: DateFormat;
299
- fullWithSeconds: DateFormat;
300
- };
301
- };
302
- };
303
-
304
- type AuthWebLocaleConfig = {
305
- path: string;
306
- shortCode: string;
307
- icon: ComponentType<IconProps>;
308
- sources: {
309
- signUp: {
310
- list: SSOConfig[];
311
- };
312
- signIn: {
313
- withOnboarding: boolean;
314
- largeQRCode: boolean;
315
- list: SSOConfig[];
316
- };
317
- };
318
- };
319
-
320
187
  type CommonLocaleConfig = Readonly<{
321
188
  name: string;
322
189
  languageName: string;
@@ -335,62 +202,44 @@ type LocalePreset = {
335
202
  [key in Locale]: DistrictLocaleConfig;
336
203
  };
337
204
  [Platform.AUTH_WEB]: {
338
- [key in Locale]: AuthWebLocaleConfig;
205
+ [key in Locale]: DistrictLocaleConfig;
339
206
  };
340
207
  [Platform.STUDENTS_APP]: {
341
- [key in Locale]: unknown;
208
+ [key in Locale]: StudentsLocaleConfig;
342
209
  };
343
210
  [Platform.TEACHERS_APP]: {
344
- [key in Locale]: unknown;
211
+ [key in Locale]: TeachersLocaleConfig;
345
212
  };
346
213
  };
347
- type LocaleConfig<P extends Platform> = LocalePreset[P][Locale];
348
214
 
349
- type ConfigOptions<P extends Platform> = {
215
+ type Locales<P extends Platform, L extends Locale> = LocalePreset[P][L];
216
+ type ConfigOptions<P extends Platform, L extends Locale> = {
350
217
  platform: P;
218
+ locale: L;
351
219
  environment: Environment;
352
220
  };
353
221
  type SetProps = {
354
222
  locale?: Locale;
355
223
  environment?: Environment;
356
224
  };
357
- declare class AppConfigManager<P extends Platform> {
225
+ declare class AppConfigManager<P extends Platform, L extends Locale> {
358
226
  private readonly platform;
359
- environment: Environment;
360
- locale: Locale;
227
+ private readonly locale;
228
+ private readonly environment;
361
229
  private readonly setEnvs;
362
230
  private readonly setLocaleConfig;
363
- readonly $envs: effector.StoreWritable<EnvironmentalVariables<P>>;
364
- readonly $localeConfig: effector.StoreWritable<LocaleConfig<P>>;
365
- constructor(opts: ConfigOptions<P>);
366
- private readonly syncConfigsStores;
367
- readonly set: (props: SetProps) => void;
368
- readonly onEnvsChange: (cb: (cfg: EnvironmentalVariables<P>) => void) => this;
369
- readonly onLocaleChange: (cb: (cfg: LocaleConfig<P>) => void) => this;
231
+ readonly $envs: effector.StoreWritable<EnvironmentVariables>;
232
+ readonly $localeConfig: effector.StoreWritable<Locales<P, L>>;
233
+ constructor(opts: ConfigOptions<P, L>);
234
+ readonly set: (props?: SetProps) => void;
235
+ readonly onEnvsChange: (cb: () => void) => effector.Subscription;
236
+ readonly onLocaleChange: (cb: () => void) => effector.Subscription;
370
237
  readonly getConfig: () => {
371
- envs: EnvironmentalVariables<P>;
372
- localeConfig: LocaleConfig<P>;
373
- };
374
- readonly getSSOList: () => Readonly<{
375
- name: string;
376
- icon: react.ComponentType<IconProps>;
377
- type: SSO;
378
- loginSource: LoginSource;
379
- getUrl: (envs: SSOEnvs & SharedEnvs) => string;
380
- ownUrl?: boolean;
381
- }>[];
382
- readonly getSSO: (key: SSO) => Readonly<{
383
- name: string;
384
- icon: react.ComponentType<IconProps>;
385
- type: SSO;
386
- loginSource: LoginSource;
387
- getUrl: (envs: SSOEnvs & SharedEnvs) => string;
388
- ownUrl?: boolean;
389
- }>;
390
- readonly getPresets: () => {
391
- envPreset: EnvPreset;
392
- localePreset: LocalePreset;
238
+ platform: P;
239
+ currentLocale: L;
240
+ envs: EnvironmentVariables;
241
+ locales: Locales<P, L>;
393
242
  };
394
243
  }
395
244
 
396
- export { AppConfigManager, type AuthWebVariables, type CommonEnv, DateFormat, DateLocale, type EnvPreset, Environment, type EnvironmentalVariables, type IntercomEnvs, Locale, LoginSource, MatrixMode, Platform, type RegionEnv, SSO, type SSOConfig, type SSOEnvs, SSO_CONFIG_LIST, SSO_CONFIG_MAP, type SharedEnvs, Source };
245
+ export { AppConfigManager, DateFormat, DateLocale, Environment, Locale, Platform };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- import * as react from 'react';
2
- import { ComponentType } from 'react';
3
1
  import * as effector from 'effector';
4
2
 
5
3
  declare enum DateFormat {
@@ -15,21 +13,20 @@ declare enum DateFormat {
15
13
  FULL_WITH_SECONDS = "DD MMM YYYY HH:mm:ss",
16
14
  FULL_WITH_SECONDS_US = "DD MMM YYYY hh:mm:ss A"
17
15
  }
18
- declare const DateLocale: {
19
- readonly US: "en";
20
- readonly SV: "sv";
21
- readonly 'en-SE': "en";
22
- readonly 'sv-SE': "sv";
23
- readonly GB: "en";
24
- readonly 'en-GB': "en";
25
- readonly CA: "en";
26
- readonly 'en-CA': "en";
27
- readonly SCT: "en";
28
- readonly 'en-SCT': "en";
29
- readonly DE: "de";
30
- readonly 'de-DE': "de";
31
- };
32
- type DateLocale = (typeof DateLocale)[keyof typeof DateLocale];
16
+ declare enum DateLocale {
17
+ US = "en",
18
+ SV = "sv",
19
+ 'en-SE' = "en",
20
+ 'sv-SE' = "sv",
21
+ GB = "en",
22
+ 'en-GB' = "en",
23
+ CA = "en",
24
+ 'en-CA' = "en",
25
+ SCT = "en",
26
+ 'en-SCT' = "en",
27
+ DE = "de",
28
+ 'de-DE' = "de"
29
+ }
33
30
 
34
31
  declare enum Platform {
35
32
  STUDENTS_WEB = "STUDENTS",
@@ -39,10 +36,6 @@ declare enum Platform {
39
36
  STUDENTS_APP = "STUDENTS_RN_APP",
40
37
  TEACHERS_APP = "TEACHERS_RN_APP"
41
38
  }
42
- declare enum Environment {
43
- MARS = "MARS",
44
- PROD = "PROD"
45
- }
46
39
  declare enum Locale {
47
40
  US = "en-SE",
48
41
  SE = "sv-SE",
@@ -51,50 +44,9 @@ declare enum Locale {
51
44
  SCT = "en-SCT",
52
45
  DE = "de-DE"
53
46
  }
54
- declare enum Source {
55
- MATTEAPPEN = 0,
56
- SKOLON = 1,
57
- SKOLFEDERATION = 2,
58
- GOOGLE = 3,
59
- MICROSOFT = 4,
60
- CLEVER = 5,
61
- APPLE = 6,
62
- MATHSYNC = 7,
63
- CLASSLINK = 8,
64
- EDUCLOUD = 9,
65
- EGIL = 10,
66
- WONDE = 12,
67
- SCHOOLOGY = 13,
68
- SEEMIS = 14,
69
- IMPORT = 15,
70
- CANVAS = 16
71
- }
72
- declare enum LoginSource {
73
- MAGMA = 0,
74
- CLEVER = 1,
75
- CLASS_LINK = 2,
76
- SKOLON = 3,
77
- SKOLFEDERATION = 4,
78
- GOOGLE = 5,
79
- MICROSOFT = 6,
80
- APPLE = 7,
81
- SCHOOLOGY = 8,
82
- MY_LOGIN = 9
83
- }
84
- declare enum SSO {
85
- GOOGLE = "GOOGLE",
86
- MICROSOFT = "MICROSOFT",
87
- CLEVER = "CLEVER",
88
- SCHOOLOGY = "SCHOOLOGY",
89
- CLASS_LINK = "CLASS_LINK",
90
- SKOLFEDERATION = "SKOLFEDERATION",
91
- SKOLON = "SKOLON",
92
- WONDE = "WONDE"
93
- }
94
-
95
- declare enum MatrixMode {
96
- SKILL = "SKILL",
97
- STANDARD = "STANDARD"
47
+ declare enum Environment {
48
+ MARS = "MARS",
49
+ PROD = "PROD"
98
50
  }
99
51
 
100
52
  type RegionEnv = Readonly<{
@@ -106,10 +58,7 @@ type RegionEnv = Readonly<{
106
58
  SOCKET_URL: string;
107
59
  STUDENTS_WEB_URL: string;
108
60
  TEACHERS_WEB_URL: string;
109
- DISTRICT_WEB_URL: string;
110
61
  CDN_HOST: string;
111
- TOS_URL: string;
112
- MAGMAMATH_URL: string;
113
62
  }>;
114
63
  type CommonEnv = Readonly<{
115
64
  GOOGLE_API_KEY: string;
@@ -121,71 +70,7 @@ type CommonEnv = Readonly<{
121
70
  MYSCRIPT_REST_HMAC_KEY: string;
122
71
  LOGGLY_CUSTOMER_TOKEN: string;
123
72
  }>;
124
- type SharedEnvs = RegionEnv & CommonEnv;
125
- type SSOEnvs = Readonly<{
126
- GOOGLE_AUTH: string;
127
- MICROSOFT_AUTH: string;
128
- CLEVER_AUTH: string;
129
- CLASS_LINK_AUTH: string;
130
- SKOLFEDERATION_AUTH: string;
131
- SKOLON_AUTH: string;
132
- SCHOOLOGY_AUTH: string;
133
- WONDE_AUTH: string;
134
- }>;
135
- type IntercomEnvs = Readonly<{
136
- CLARITY_PROJECT_ID: string;
137
- INTERCOM_APP_ID: string;
138
- }>;
139
- type EnvPreset = {
140
- [Platform.STUDENTS_WEB]: {
141
- [key in Locale]: {
142
- [key in Environment]: SharedEnvs;
143
- };
144
- };
145
- [Platform.TEACHERS_WEB]: {
146
- [key in Locale]: {
147
- [key in Environment]: SharedEnvs;
148
- };
149
- };
150
- [Platform.DISTRICT_DASHBOARD]: {
151
- [key in Locale]: {
152
- [key in Environment]: SharedEnvs;
153
- };
154
- };
155
- [Platform.AUTH_WEB]: {
156
- [key in Locale]: {
157
- [key in Environment]: AuthWebVariables;
158
- };
159
- };
160
- [Platform.STUDENTS_APP]: {
161
- [key in Locale]: {
162
- [key in Environment]: unknown;
163
- };
164
- };
165
- [Platform.TEACHERS_APP]: {
166
- [key in Locale]: {
167
- [key in Environment]: unknown;
168
- };
169
- };
170
- };
171
- type EnvironmentalVariables<P extends Platform> = EnvPreset[P][Locale][Environment];
172
- type AuthWebVariables = Omit<RegionEnv & SSOEnvs & IntercomEnvs, 'CDN_HOST' | 'LOGGLY_TAG' | 'MYSCRIPT_HOST' | 'SOCKET_URL'>;
173
-
174
- type IconProps = {
175
- size?: number;
176
- };
177
-
178
- type SSOConfig = Readonly<{
179
- name: string;
180
- icon: ComponentType<IconProps>;
181
- type: SSO;
182
- loginSource: LoginSource;
183
- getUrl: (envs: SSOEnvs & SharedEnvs) => string;
184
- ownUrl?: boolean;
185
- }>;
186
-
187
- declare const SSO_CONFIG_MAP: Record<SSO, SSOConfig>;
188
- declare const SSO_CONFIG_LIST: SSOConfig[];
73
+ type EnvironmentVariables = RegionEnv & CommonEnv;
189
74
 
190
75
  type StudentsLocaleConfig = CommonLocaleConfig & {
191
76
  textFormatting: {
@@ -228,13 +113,28 @@ type StudentsLocaleConfig = CommonLocaleConfig & {
228
113
  statsTab: {
229
114
  buttonWithMinWidth: boolean;
230
115
  };
231
- smartEval: {
232
- language: string;
116
+ };
117
+
118
+ type DistrictLocaleConfig = CommonLocaleConfig & {
119
+ date: {
120
+ use24HourFormat: boolean;
121
+ locale: DateLocale;
122
+ formats: {
123
+ full: DateFormat;
124
+ dayMonthYear: DateFormat;
125
+ dayMonth: DateFormat;
126
+ hoursMinutes: DateFormat;
127
+ fullWithSeconds: DateFormat;
128
+ };
233
129
  };
234
130
  };
235
131
 
132
+ declare enum MatrixMode {
133
+ SKILL = "SKILL",
134
+ STANDARD = "STANDARD"
135
+ }
136
+
236
137
  type TeachersLocaleConfig = CommonLocaleConfig & {
237
- country: string;
238
138
  emails: {
239
139
  studentsList: string;
240
140
  };
@@ -278,45 +178,12 @@ type TeachersLocaleConfig = CommonLocaleConfig & {
278
178
  getStarted: {
279
179
  showSentEmailInfo: boolean;
280
180
  };
281
- firstLoginBooks: {
282
- isLargeGrade: ((grade: number) => boolean) | null;
283
- };
284
181
  grades: {
285
182
  showPrefix: boolean;
286
183
  showOtherGrade: boolean;
287
184
  };
288
185
  };
289
186
 
290
- type DistrictLocaleConfig = CommonLocaleConfig & {
291
- date: {
292
- use24HourFormat: boolean;
293
- locale: DateLocale;
294
- formats: {
295
- full: DateFormat;
296
- dayMonthYear: DateFormat;
297
- dayMonth: DateFormat;
298
- hoursMinutes: DateFormat;
299
- fullWithSeconds: DateFormat;
300
- };
301
- };
302
- };
303
-
304
- type AuthWebLocaleConfig = {
305
- path: string;
306
- shortCode: string;
307
- icon: ComponentType<IconProps>;
308
- sources: {
309
- signUp: {
310
- list: SSOConfig[];
311
- };
312
- signIn: {
313
- withOnboarding: boolean;
314
- largeQRCode: boolean;
315
- list: SSOConfig[];
316
- };
317
- };
318
- };
319
-
320
187
  type CommonLocaleConfig = Readonly<{
321
188
  name: string;
322
189
  languageName: string;
@@ -335,62 +202,44 @@ type LocalePreset = {
335
202
  [key in Locale]: DistrictLocaleConfig;
336
203
  };
337
204
  [Platform.AUTH_WEB]: {
338
- [key in Locale]: AuthWebLocaleConfig;
205
+ [key in Locale]: DistrictLocaleConfig;
339
206
  };
340
207
  [Platform.STUDENTS_APP]: {
341
- [key in Locale]: unknown;
208
+ [key in Locale]: StudentsLocaleConfig;
342
209
  };
343
210
  [Platform.TEACHERS_APP]: {
344
- [key in Locale]: unknown;
211
+ [key in Locale]: TeachersLocaleConfig;
345
212
  };
346
213
  };
347
- type LocaleConfig<P extends Platform> = LocalePreset[P][Locale];
348
214
 
349
- type ConfigOptions<P extends Platform> = {
215
+ type Locales<P extends Platform, L extends Locale> = LocalePreset[P][L];
216
+ type ConfigOptions<P extends Platform, L extends Locale> = {
350
217
  platform: P;
218
+ locale: L;
351
219
  environment: Environment;
352
220
  };
353
221
  type SetProps = {
354
222
  locale?: Locale;
355
223
  environment?: Environment;
356
224
  };
357
- declare class AppConfigManager<P extends Platform> {
225
+ declare class AppConfigManager<P extends Platform, L extends Locale> {
358
226
  private readonly platform;
359
- environment: Environment;
360
- locale: Locale;
227
+ private readonly locale;
228
+ private readonly environment;
361
229
  private readonly setEnvs;
362
230
  private readonly setLocaleConfig;
363
- readonly $envs: effector.StoreWritable<EnvironmentalVariables<P>>;
364
- readonly $localeConfig: effector.StoreWritable<LocaleConfig<P>>;
365
- constructor(opts: ConfigOptions<P>);
366
- private readonly syncConfigsStores;
367
- readonly set: (props: SetProps) => void;
368
- readonly onEnvsChange: (cb: (cfg: EnvironmentalVariables<P>) => void) => this;
369
- readonly onLocaleChange: (cb: (cfg: LocaleConfig<P>) => void) => this;
231
+ readonly $envs: effector.StoreWritable<EnvironmentVariables>;
232
+ readonly $localeConfig: effector.StoreWritable<Locales<P, L>>;
233
+ constructor(opts: ConfigOptions<P, L>);
234
+ readonly set: (props?: SetProps) => void;
235
+ readonly onEnvsChange: (cb: () => void) => effector.Subscription;
236
+ readonly onLocaleChange: (cb: () => void) => effector.Subscription;
370
237
  readonly getConfig: () => {
371
- envs: EnvironmentalVariables<P>;
372
- localeConfig: LocaleConfig<P>;
373
- };
374
- readonly getSSOList: () => Readonly<{
375
- name: string;
376
- icon: react.ComponentType<IconProps>;
377
- type: SSO;
378
- loginSource: LoginSource;
379
- getUrl: (envs: SSOEnvs & SharedEnvs) => string;
380
- ownUrl?: boolean;
381
- }>[];
382
- readonly getSSO: (key: SSO) => Readonly<{
383
- name: string;
384
- icon: react.ComponentType<IconProps>;
385
- type: SSO;
386
- loginSource: LoginSource;
387
- getUrl: (envs: SSOEnvs & SharedEnvs) => string;
388
- ownUrl?: boolean;
389
- }>;
390
- readonly getPresets: () => {
391
- envPreset: EnvPreset;
392
- localePreset: LocalePreset;
238
+ platform: P;
239
+ currentLocale: L;
240
+ envs: EnvironmentVariables;
241
+ locales: Locales<P, L>;
393
242
  };
394
243
  }
395
244
 
396
- export { AppConfigManager, type AuthWebVariables, type CommonEnv, DateFormat, DateLocale, type EnvPreset, Environment, type EnvironmentalVariables, type IntercomEnvs, Locale, LoginSource, MatrixMode, Platform, type RegionEnv, SSO, type SSOConfig, type SSOEnvs, SSO_CONFIG_LIST, SSO_CONFIG_MAP, type SharedEnvs, Source };
245
+ export { AppConfigManager, DateFormat, DateLocale, Environment, Locale, Platform };