@magmamath/frontend-config 1.0.16-rc.19 → 1.0.16-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 +107 -166
- package/dist/index.d.ts +107 -166
- package/dist/index.js +3324 -452
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3324 -452
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -5
package/dist/index.d.mts
CHANGED
|
@@ -35,8 +35,7 @@ declare enum Platform {
|
|
|
35
35
|
TEACHERS_WEB = "TEACHERS",
|
|
36
36
|
DISTRICT_DASHBOARD = "DISTRICT",
|
|
37
37
|
AUTH_WEB = "AUTH_WEB",
|
|
38
|
-
WEB_ADMIN = "WEB_ADMIN"
|
|
39
|
-
MOBILE = "MOBILE"
|
|
38
|
+
WEB_ADMIN = "WEB_ADMIN"
|
|
40
39
|
}
|
|
41
40
|
declare enum Environment {
|
|
42
41
|
MARS = "MARS",
|
|
@@ -49,7 +48,7 @@ declare enum PlatformBuildTarget {
|
|
|
49
48
|
VENUS = "pre-release",
|
|
50
49
|
PROD = "production"
|
|
51
50
|
}
|
|
52
|
-
declare enum
|
|
51
|
+
declare enum AppLocale {
|
|
53
52
|
US = "en-SE",
|
|
54
53
|
SE = "sv-SE",
|
|
55
54
|
GB = "en-GB",
|
|
@@ -57,6 +56,13 @@ declare enum Locale {
|
|
|
57
56
|
SCT = "en-SCT",
|
|
58
57
|
DE = "de-DE"
|
|
59
58
|
}
|
|
59
|
+
declare enum ContentLocale {
|
|
60
|
+
US = "en-SE",
|
|
61
|
+
SE = "sv-SE",
|
|
62
|
+
GB = "en-GB",
|
|
63
|
+
CA = "en-CA",
|
|
64
|
+
DE = "de-DE"
|
|
65
|
+
}
|
|
60
66
|
declare enum Source {
|
|
61
67
|
MATTEAPPEN = 0,
|
|
62
68
|
SKOLON = 1,
|
|
@@ -99,10 +105,6 @@ declare enum SSO {
|
|
|
99
105
|
CANVAS = "CANVAS",
|
|
100
106
|
QR_CODE = "QR_CODE"
|
|
101
107
|
}
|
|
102
|
-
declare enum ApiRegion {
|
|
103
|
-
MAIN = "MAIN",
|
|
104
|
-
CANADA = "MAIN"
|
|
105
|
-
}
|
|
106
108
|
|
|
107
109
|
declare enum MatrixMode {
|
|
108
110
|
SKILL = "SKILL",
|
|
@@ -137,14 +139,6 @@ type SSO_DE = {
|
|
|
137
139
|
MICROSOFT_AUTH: string;
|
|
138
140
|
};
|
|
139
141
|
type SSOVariant = SSO_US | SSO_DE | SSO_UK | SSO_SE;
|
|
140
|
-
type SSOByLocale = {
|
|
141
|
-
[Locale.US]: SSO_US;
|
|
142
|
-
[Locale.CA]: SSO_US;
|
|
143
|
-
[Locale.GB]: SSO_UK;
|
|
144
|
-
[Locale.SCT]: SSO_UK;
|
|
145
|
-
[Locale.SE]: SSO_SE;
|
|
146
|
-
[Locale.DE]: SSO_DE;
|
|
147
|
-
};
|
|
148
142
|
|
|
149
143
|
type Prettify<T> = T extends Function ? T : {
|
|
150
144
|
[K in keyof T]: T[K];
|
|
@@ -161,43 +155,6 @@ type RegionSpecificVars = {
|
|
|
161
155
|
STUDENTS_WEB_URL: string;
|
|
162
156
|
TEACHERS_WEB_URL: string;
|
|
163
157
|
};
|
|
164
|
-
|
|
165
|
-
type AuthWebVars<T extends SSOVariant> = Prettify<AuthWebBaseVars & T>;
|
|
166
|
-
type AuthWebBaseVars = Omit<RegionSpecificVars, 'CDN_HOST' | 'LOGGLY_TAG' | 'SOCKET_URL'> & {
|
|
167
|
-
TOS_URL: string;
|
|
168
|
-
CLARITY_PROJECT_ID: string;
|
|
169
|
-
INTERCOM_APP_ID: string;
|
|
170
|
-
};
|
|
171
|
-
type AuthWebVarsPreset = {
|
|
172
|
-
[Locale.CA]: {
|
|
173
|
-
[key in Environment]: AuthWebVars<SSO_US>;
|
|
174
|
-
};
|
|
175
|
-
[Locale.DE]: {
|
|
176
|
-
[key in Environment]: AuthWebVars<SSO_DE>;
|
|
177
|
-
};
|
|
178
|
-
[Locale.GB]: {
|
|
179
|
-
[key in Environment]: AuthWebVars<SSO_UK>;
|
|
180
|
-
};
|
|
181
|
-
[Locale.SCT]: {
|
|
182
|
-
[key in Environment]: AuthWebVars<SSO_UK>;
|
|
183
|
-
};
|
|
184
|
-
[Locale.SE]: {
|
|
185
|
-
[key in Environment]: AuthWebVars<SSO_SE>;
|
|
186
|
-
};
|
|
187
|
-
[Locale.US]: {
|
|
188
|
-
[key in Environment]: AuthWebVars<SSO_US>;
|
|
189
|
-
};
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
type SSOConfig<T extends SSOVariant> = Readonly<{
|
|
193
|
-
name: string;
|
|
194
|
-
icon: ComponentType<IconProps>;
|
|
195
|
-
type: SSO;
|
|
196
|
-
loginSource: LoginSource;
|
|
197
|
-
getUrl: (envs: AuthWebVars<T>) => string;
|
|
198
|
-
ownUrl?: boolean;
|
|
199
|
-
}>;
|
|
200
|
-
|
|
201
158
|
type StudentsWebCommon = {
|
|
202
159
|
GOOGLE_API_KEY: string;
|
|
203
160
|
DESMOS_API_KEY: string;
|
|
@@ -209,13 +166,6 @@ type StudentsWebCommon = {
|
|
|
209
166
|
MYSCRIPT_REST_APP_KEY: string;
|
|
210
167
|
MYSCRIPT_REST_HMAC_KEY: string;
|
|
211
168
|
};
|
|
212
|
-
type StudentsWebVars = RegionSpecificVars & StudentsWebCommon;
|
|
213
|
-
type StudentsWebVarsPreset = {
|
|
214
|
-
[key in Locale]: {
|
|
215
|
-
[key in Environment]: StudentsWebVars;
|
|
216
|
-
};
|
|
217
|
-
};
|
|
218
|
-
|
|
219
169
|
type TeachersWebCommon = {
|
|
220
170
|
MYSCRIPT_HOST: string;
|
|
221
171
|
MYSCRIPT_REST_APP_KEY: string;
|
|
@@ -225,65 +175,11 @@ type TeachersWebCommon = {
|
|
|
225
175
|
CLARITY_PROJECT_ID: string;
|
|
226
176
|
LOGGLY_CUSTOMER_TOKEN: string;
|
|
227
177
|
};
|
|
228
|
-
type TeachersWebVars = RegionSpecificVars & TeachersWebCommon;
|
|
229
|
-
type TeachersWebVarsPreset = {
|
|
230
|
-
[key in Locale]: {
|
|
231
|
-
[key in Environment]: TeachersWebVars;
|
|
232
|
-
};
|
|
233
|
-
};
|
|
234
|
-
|
|
235
178
|
type DistrictCommon = {
|
|
236
179
|
INTERCOM_APP_ID: string;
|
|
237
180
|
CLARITY_PROJECT_ID: string;
|
|
238
181
|
PROBLEM_IMAGE_SIZE_LIMIT: number;
|
|
239
182
|
};
|
|
240
|
-
type DistrictDashboardVars = Omit<RegionSpecificVars, 'SOCKET_URL'> & DistrictCommon;
|
|
241
|
-
type DistrictWebVarsPreset = {
|
|
242
|
-
[key in Locale]: {
|
|
243
|
-
[key in Environment]: DistrictDashboardVars;
|
|
244
|
-
};
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
type MobileCommon = {
|
|
248
|
-
DESMOS_API_KEY: string;
|
|
249
|
-
USER_AGENT: string;
|
|
250
|
-
LOGGLY_CUSTOMER_TOKEN: string;
|
|
251
|
-
MYSCRIPT_HOST: string;
|
|
252
|
-
MYSCRIPT_APPLICATION_KEY: string;
|
|
253
|
-
MYSCRIPT_HMAC_KEY: string;
|
|
254
|
-
MYSCRIPT_SOCKET_KEY: string;
|
|
255
|
-
MYSCRIPT_REST_APP_KEY: string;
|
|
256
|
-
MYSCRIPT_REST_HMAC_KEY: string;
|
|
257
|
-
};
|
|
258
|
-
type MobileBaseVars = {
|
|
259
|
-
TEACHERS_WEB_URL: string;
|
|
260
|
-
API_URL: string;
|
|
261
|
-
CDN_HOST: string;
|
|
262
|
-
SOCKET_URL: string;
|
|
263
|
-
LOGGLY_TAG: string;
|
|
264
|
-
} & MobileCommon;
|
|
265
|
-
type MobileVars<T extends SSOVariant> = Prettify<MobileBaseVars & T>;
|
|
266
|
-
type MobileVarsPreset = {
|
|
267
|
-
[Locale.CA]: {
|
|
268
|
-
[key in Environment]: MobileVars<SSO_US>;
|
|
269
|
-
};
|
|
270
|
-
[Locale.DE]: {
|
|
271
|
-
[key in Environment]: MobileVars<SSO_DE>;
|
|
272
|
-
};
|
|
273
|
-
[Locale.GB]: {
|
|
274
|
-
[key in Environment]: MobileVars<SSO_UK>;
|
|
275
|
-
};
|
|
276
|
-
[Locale.SCT]: {
|
|
277
|
-
[key in Environment]: MobileVars<SSO_UK>;
|
|
278
|
-
};
|
|
279
|
-
[Locale.SE]: {
|
|
280
|
-
[key in Environment]: MobileVars<SSO_SE>;
|
|
281
|
-
};
|
|
282
|
-
[Locale.US]: {
|
|
283
|
-
[key in Environment]: MobileVars<SSO_US>;
|
|
284
|
-
};
|
|
285
|
-
};
|
|
286
|
-
|
|
287
183
|
type RegionSpecificWebAdminVars = {
|
|
288
184
|
API_URL: string;
|
|
289
185
|
CDN_HOST: string;
|
|
@@ -295,22 +191,68 @@ type WebAdminCommon = {
|
|
|
295
191
|
MARS_URL: string;
|
|
296
192
|
PROD_URL: string;
|
|
297
193
|
};
|
|
194
|
+
type StudentsWebVars = RegionSpecificVars & StudentsWebCommon;
|
|
195
|
+
type TeachersWebVars = RegionSpecificVars & TeachersWebCommon;
|
|
196
|
+
type DistrictDashboardVars = Omit<RegionSpecificVars, 'SOCKET_URL'> & DistrictCommon;
|
|
298
197
|
type WebAdminVars = RegionSpecificWebAdminVars & WebAdminCommon;
|
|
299
|
-
type
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
198
|
+
type AuthWebBaseVars = Omit<RegionSpecificVars, 'CDN_HOST' | 'LOGGLY_TAG' | 'SOCKET_URL'> & {
|
|
199
|
+
TOS_URL: string;
|
|
200
|
+
CLARITY_PROJECT_ID: string;
|
|
201
|
+
INTERCOM_APP_ID: string;
|
|
303
202
|
};
|
|
304
|
-
|
|
203
|
+
type AuthWebVars<T extends SSOVariant> = Prettify<AuthWebBaseVars & T>;
|
|
305
204
|
type EnvPreset = Readonly<{
|
|
306
|
-
[Platform.STUDENTS_WEB]:
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
[Platform.
|
|
205
|
+
[Platform.STUDENTS_WEB]: {
|
|
206
|
+
[key in AppLocale]: {
|
|
207
|
+
[key in Environment]: StudentsWebVars;
|
|
208
|
+
};
|
|
209
|
+
};
|
|
210
|
+
[Platform.TEACHERS_WEB]: {
|
|
211
|
+
[key in AppLocale]: {
|
|
212
|
+
[key in Environment]: TeachersWebVars;
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
[Platform.DISTRICT_DASHBOARD]: {
|
|
216
|
+
[key in AppLocale]: {
|
|
217
|
+
[key in Environment]: DistrictDashboardVars;
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
[Platform.AUTH_WEB]: {
|
|
221
|
+
[AppLocale.CA]: {
|
|
222
|
+
[key in Environment]: AuthWebVars<SSO_US>;
|
|
223
|
+
};
|
|
224
|
+
[AppLocale.DE]: {
|
|
225
|
+
[key in Environment]: AuthWebVars<SSO_DE>;
|
|
226
|
+
};
|
|
227
|
+
[AppLocale.GB]: {
|
|
228
|
+
[key in Environment]: AuthWebVars<SSO_UK>;
|
|
229
|
+
};
|
|
230
|
+
[AppLocale.SCT]: {
|
|
231
|
+
[key in Environment]: AuthWebVars<SSO_UK>;
|
|
232
|
+
};
|
|
233
|
+
[AppLocale.SE]: {
|
|
234
|
+
[key in Environment]: AuthWebVars<SSO_SE>;
|
|
235
|
+
};
|
|
236
|
+
[AppLocale.US]: {
|
|
237
|
+
[key in Environment]: AuthWebVars<SSO_US>;
|
|
238
|
+
};
|
|
239
|
+
};
|
|
240
|
+
[Platform.WEB_ADMIN]: {
|
|
241
|
+
[key in AppLocale]: {
|
|
242
|
+
[key in Environment]: WebAdminVars;
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
}>;
|
|
246
|
+
type EnvironmentVars<P extends Platform> = EnvPreset[P][AppLocale][Environment];
|
|
247
|
+
|
|
248
|
+
type SSOConfig<T extends SSOVariant> = Readonly<{
|
|
249
|
+
name: string;
|
|
250
|
+
icon: ComponentType<IconProps>;
|
|
251
|
+
type: SSO;
|
|
252
|
+
loginSource: LoginSource;
|
|
253
|
+
getUrl: (envs: AuthWebVars<T>) => string;
|
|
254
|
+
ownUrl?: boolean;
|
|
312
255
|
}>;
|
|
313
|
-
type EnvironmentVars<P extends Platform> = EnvPreset[P][Locale][Environment];
|
|
314
256
|
|
|
315
257
|
declare function buildTargetToEnvironment(buildTarget: PlatformBuildTarget): Environment;
|
|
316
258
|
|
|
@@ -322,7 +264,7 @@ type StudentsLocaleConfig = CommonLocaleConfig & {
|
|
|
322
264
|
numberDecimalSeparator: string;
|
|
323
265
|
};
|
|
324
266
|
practiceMode: {
|
|
325
|
-
languageCode:
|
|
267
|
+
languageCode: AppLocale;
|
|
326
268
|
defaultPracticeTreeId: string;
|
|
327
269
|
};
|
|
328
270
|
chatbot: {
|
|
@@ -445,90 +387,89 @@ type AuthWebLocaleConfig<T extends SSOVariant> = {
|
|
|
445
387
|
isPrimaryRegion: boolean;
|
|
446
388
|
regionGroup: string;
|
|
447
389
|
navigatorLanguages: string[];
|
|
448
|
-
locale:
|
|
449
|
-
};
|
|
450
|
-
|
|
451
|
-
type WebAdminLocaleConfig = {
|
|
452
|
-
name: string;
|
|
453
|
-
icon: ComponentType<IconProps>;
|
|
454
|
-
locale: Locale;
|
|
455
|
-
isPrimaryRegion: boolean;
|
|
456
|
-
regionGroup: string;
|
|
457
|
-
apiRegion: ApiRegion;
|
|
390
|
+
locale: AppLocale;
|
|
458
391
|
};
|
|
459
392
|
|
|
460
393
|
type CommonLocaleConfig = Readonly<{
|
|
461
394
|
name: string;
|
|
462
395
|
languageName: string;
|
|
463
396
|
languageHeader: string;
|
|
464
|
-
contentLocale:
|
|
397
|
+
contentLocale: ContentLocale;
|
|
465
398
|
shortCode: string;
|
|
466
399
|
}>;
|
|
467
400
|
type LocalePreset = {
|
|
468
401
|
[Platform.STUDENTS_WEB]: {
|
|
469
|
-
[key in
|
|
402
|
+
[key in AppLocale]: StudentsLocaleConfig;
|
|
470
403
|
};
|
|
471
404
|
[Platform.TEACHERS_WEB]: {
|
|
472
|
-
[key in
|
|
405
|
+
[key in AppLocale]: TeachersLocaleConfig;
|
|
473
406
|
};
|
|
474
407
|
[Platform.DISTRICT_DASHBOARD]: {
|
|
475
|
-
[key in
|
|
476
|
-
};
|
|
477
|
-
[Platform.AUTH_WEB]: {
|
|
478
|
-
[key in Locale]: AuthWebLocaleConfig<SSOByLocale[key]>;
|
|
408
|
+
[key in AppLocale]: DistrictLocaleConfig;
|
|
479
409
|
};
|
|
480
410
|
[Platform.WEB_ADMIN]: {
|
|
481
|
-
[key in
|
|
411
|
+
[key in AppLocale]: {};
|
|
482
412
|
};
|
|
483
|
-
[Platform.
|
|
484
|
-
[
|
|
413
|
+
[Platform.AUTH_WEB]: {
|
|
414
|
+
[AppLocale.CA]: AuthWebLocaleConfig<SSO_US>;
|
|
415
|
+
[AppLocale.DE]: AuthWebLocaleConfig<SSO_DE>;
|
|
416
|
+
[AppLocale.GB]: AuthWebLocaleConfig<SSO_UK>;
|
|
417
|
+
[AppLocale.SCT]: AuthWebLocaleConfig<SSO_UK>;
|
|
418
|
+
[AppLocale.SE]: AuthWebLocaleConfig<SSO_SE>;
|
|
419
|
+
[AppLocale.US]: AuthWebLocaleConfig<SSO_US>;
|
|
485
420
|
};
|
|
486
421
|
};
|
|
487
|
-
type LocaleConfig<P extends Platform
|
|
422
|
+
type LocaleConfig<P extends Platform> = LocalePreset[P][AppLocale];
|
|
488
423
|
|
|
489
424
|
type DevOverrides<P extends Platform> = {
|
|
490
|
-
[K in
|
|
425
|
+
[K in AppLocale]?: Partial<EnvironmentVars<P>>;
|
|
491
426
|
};
|
|
492
427
|
type ConfigOptions<P extends Platform> = {
|
|
493
428
|
platform: P;
|
|
494
429
|
environment: Environment;
|
|
495
430
|
_DEV_OVERRIDES_?: DevOverrides<P>;
|
|
496
431
|
};
|
|
497
|
-
type SetProps
|
|
498
|
-
locale?:
|
|
499
|
-
envsRegion?:
|
|
432
|
+
type SetProps = {
|
|
433
|
+
locale?: AppLocale;
|
|
434
|
+
envsRegion?: AppLocale;
|
|
500
435
|
environment?: Environment;
|
|
501
436
|
};
|
|
502
|
-
declare class AppConfigManager<P extends Platform
|
|
437
|
+
declare class AppConfigManager<P extends Platform> {
|
|
503
438
|
private readonly _DEV_OVERRIDES_?;
|
|
504
439
|
private readonly platform;
|
|
505
440
|
environment: Environment;
|
|
506
|
-
locale:
|
|
507
|
-
envsRegion:
|
|
441
|
+
locale: AppLocale;
|
|
442
|
+
envsRegion: AppLocale;
|
|
508
443
|
private readonly setEnvs;
|
|
509
444
|
private readonly setLocaleConfig;
|
|
510
445
|
readonly $envs: effector.StoreWritable<EnvironmentVars<P>>;
|
|
511
|
-
readonly $localeConfig: effector.StoreWritable<LocaleConfig<P
|
|
446
|
+
readonly $localeConfig: effector.StoreWritable<LocaleConfig<P>>;
|
|
512
447
|
constructor(opts: ConfigOptions<P>);
|
|
513
448
|
private readonly syncConfigsStores;
|
|
514
|
-
readonly set: (props: SetProps
|
|
449
|
+
readonly set: (props: SetProps) => void;
|
|
515
450
|
getEnvs: () => EnvironmentVars<P>;
|
|
516
|
-
getLocaleConfig: () => LocaleConfig<P
|
|
517
|
-
locale:
|
|
451
|
+
getLocaleConfig: () => LocaleConfig<P> & {
|
|
452
|
+
locale: AppLocale;
|
|
518
453
|
};
|
|
519
454
|
readonly onEnvsChange: (cb: (cfg: EnvironmentVars<P>) => void) => effector.Subscription;
|
|
520
|
-
readonly onLocaleChange: (cb: (cfg: LocaleConfig<P
|
|
455
|
+
readonly onLocaleChange: (cb: (cfg: LocaleConfig<P>) => void) => effector.Subscription;
|
|
521
456
|
readonly getPresets: () => {
|
|
522
457
|
envPreset: Readonly<{
|
|
523
|
-
STUDENTS:
|
|
524
|
-
TEACHERS:
|
|
525
|
-
DISTRICT:
|
|
526
|
-
AUTH_WEB:
|
|
527
|
-
|
|
528
|
-
|
|
458
|
+
STUDENTS: { [key in AppLocale]: { [key_1 in Environment]: StudentsWebVars; }; };
|
|
459
|
+
TEACHERS: { [key in AppLocale]: { [key_1 in Environment]: TeachersWebVars; }; };
|
|
460
|
+
DISTRICT: { [key in AppLocale]: { [key_1 in Environment]: DistrictDashboardVars; }; };
|
|
461
|
+
AUTH_WEB: {
|
|
462
|
+
[AppLocale.CA]: { [key in Environment]: AuthWebVars<SSO_US>; };
|
|
463
|
+
[AppLocale.DE]: { [key in Environment]: AuthWebVars<SSO_DE>; };
|
|
464
|
+
[AppLocale.GB]: { [key in Environment]: AuthWebVars<SSO_UK>; };
|
|
465
|
+
[AppLocale.SCT]: { [key in Environment]: AuthWebVars<SSO_UK>; };
|
|
466
|
+
[AppLocale.SE]: { [key in Environment]: AuthWebVars<SSO_SE>; };
|
|
467
|
+
[AppLocale.US]: { [key in Environment]: AuthWebVars<SSO_US>; };
|
|
468
|
+
};
|
|
469
|
+
WEB_ADMIN: { [key in AppLocale]: { [key_1 in Environment]: WebAdminVars; }; };
|
|
529
470
|
}>;
|
|
530
471
|
localePreset: LocalePreset;
|
|
531
472
|
};
|
|
532
473
|
}
|
|
533
474
|
|
|
534
|
-
export {
|
|
475
|
+
export { AppConfigManager, AppLocale, type AuthWebVars, ContentLocale, DateFormat, DateLocale, type DistrictCommon, type DistrictDashboardVars, type EnvPreset, Environment, type EnvironmentVars, LoginSource, MatrixMode, Platform, PlatformBuildTarget, type RegionSpecificVars, type RegionSpecificWebAdminVars, SSO, type SSOConfig, Source, type StudentsWebCommon, type StudentsWebVars, type TeachersWebCommon, type TeachersWebVars, type WebAdminCommon, type WebAdminVars, buildTargetToEnvironment };
|