@magmamath/frontend-config 1.0.16-rc.21 → 1.0.16-rc.3
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 +85 -168
- package/dist/index.d.ts +85 -168
- package/dist/index.js +3305 -388
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3307 -389
- 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",
|
|
@@ -99,10 +98,6 @@ declare enum SSO {
|
|
|
99
98
|
CANVAS = "CANVAS",
|
|
100
99
|
QR_CODE = "QR_CODE"
|
|
101
100
|
}
|
|
102
|
-
declare enum ApiRegion {
|
|
103
|
-
MAIN = "MAIN",
|
|
104
|
-
CANADA = "CANADA"
|
|
105
|
-
}
|
|
106
101
|
|
|
107
102
|
declare enum MatrixMode {
|
|
108
103
|
SKILL = "SKILL",
|
|
@@ -137,14 +132,6 @@ type SSO_DE = {
|
|
|
137
132
|
MICROSOFT_AUTH: string;
|
|
138
133
|
};
|
|
139
134
|
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
135
|
|
|
149
136
|
type Prettify<T> = T extends Function ? T : {
|
|
150
137
|
[K in keyof T]: T[K];
|
|
@@ -161,43 +148,6 @@ type RegionSpecificVars = {
|
|
|
161
148
|
STUDENTS_WEB_URL: string;
|
|
162
149
|
TEACHERS_WEB_URL: string;
|
|
163
150
|
};
|
|
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
151
|
type StudentsWebCommon = {
|
|
202
152
|
GOOGLE_API_KEY: string;
|
|
203
153
|
DESMOS_API_KEY: string;
|
|
@@ -209,13 +159,6 @@ type StudentsWebCommon = {
|
|
|
209
159
|
MYSCRIPT_REST_APP_KEY: string;
|
|
210
160
|
MYSCRIPT_REST_HMAC_KEY: string;
|
|
211
161
|
};
|
|
212
|
-
type StudentsWebVars = RegionSpecificVars & StudentsWebCommon;
|
|
213
|
-
type StudentsWebVarsPreset = {
|
|
214
|
-
[key in Locale]: {
|
|
215
|
-
[key in Environment]: StudentsWebVars;
|
|
216
|
-
};
|
|
217
|
-
};
|
|
218
|
-
|
|
219
162
|
type TeachersWebCommon = {
|
|
220
163
|
MYSCRIPT_HOST: string;
|
|
221
164
|
MYSCRIPT_REST_APP_KEY: string;
|
|
@@ -225,65 +168,11 @@ type TeachersWebCommon = {
|
|
|
225
168
|
CLARITY_PROJECT_ID: string;
|
|
226
169
|
LOGGLY_CUSTOMER_TOKEN: string;
|
|
227
170
|
};
|
|
228
|
-
type TeachersWebVars = RegionSpecificVars & TeachersWebCommon;
|
|
229
|
-
type TeachersWebVarsPreset = {
|
|
230
|
-
[key in Locale]: {
|
|
231
|
-
[key in Environment]: TeachersWebVars;
|
|
232
|
-
};
|
|
233
|
-
};
|
|
234
|
-
|
|
235
171
|
type DistrictCommon = {
|
|
236
172
|
INTERCOM_APP_ID: string;
|
|
237
173
|
CLARITY_PROJECT_ID: string;
|
|
238
174
|
PROBLEM_IMAGE_SIZE_LIMIT: number;
|
|
239
175
|
};
|
|
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
176
|
type RegionSpecificWebAdminVars = {
|
|
288
177
|
API_URL: string;
|
|
289
178
|
CDN_HOST: string;
|
|
@@ -295,23 +184,69 @@ type WebAdminCommon = {
|
|
|
295
184
|
MARS_URL: string;
|
|
296
185
|
PROD_URL: string;
|
|
297
186
|
};
|
|
187
|
+
type StudentsWebVars = RegionSpecificVars & StudentsWebCommon;
|
|
188
|
+
type TeachersWebVars = RegionSpecificVars & TeachersWebCommon;
|
|
189
|
+
type DistrictDashboardVars = Omit<RegionSpecificVars, 'SOCKET_URL'> & DistrictCommon;
|
|
298
190
|
type WebAdminVars = RegionSpecificWebAdminVars & WebAdminCommon;
|
|
299
|
-
type
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
191
|
+
type AuthWebBaseVars = Omit<RegionSpecificVars, 'CDN_HOST' | 'LOGGLY_TAG' | 'SOCKET_URL'> & {
|
|
192
|
+
TOS_URL: string;
|
|
193
|
+
CLARITY_PROJECT_ID: string;
|
|
194
|
+
INTERCOM_APP_ID: string;
|
|
303
195
|
};
|
|
304
|
-
|
|
196
|
+
type AuthWebVars<T extends SSOVariant> = Prettify<AuthWebBaseVars & T>;
|
|
305
197
|
type EnvPreset = Readonly<{
|
|
306
|
-
[Platform.STUDENTS_WEB]:
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
[Platform.
|
|
198
|
+
[Platform.STUDENTS_WEB]: {
|
|
199
|
+
[key in Locale]: {
|
|
200
|
+
[key in Environment]: StudentsWebVars;
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
[Platform.TEACHERS_WEB]: {
|
|
204
|
+
[key in Locale]: {
|
|
205
|
+
[key in Environment]: TeachersWebVars;
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
[Platform.DISTRICT_DASHBOARD]: {
|
|
209
|
+
[key in Locale]: {
|
|
210
|
+
[key in Environment]: DistrictDashboardVars;
|
|
211
|
+
};
|
|
212
|
+
};
|
|
213
|
+
[Platform.AUTH_WEB]: {
|
|
214
|
+
[Locale.CA]: {
|
|
215
|
+
[key in Environment]: AuthWebVars<SSO_US>;
|
|
216
|
+
};
|
|
217
|
+
[Locale.DE]: {
|
|
218
|
+
[key in Environment]: AuthWebVars<SSO_DE>;
|
|
219
|
+
};
|
|
220
|
+
[Locale.GB]: {
|
|
221
|
+
[key in Environment]: AuthWebVars<SSO_UK>;
|
|
222
|
+
};
|
|
223
|
+
[Locale.SCT]: {
|
|
224
|
+
[key in Environment]: AuthWebVars<SSO_UK>;
|
|
225
|
+
};
|
|
226
|
+
[Locale.SE]: {
|
|
227
|
+
[key in Environment]: AuthWebVars<SSO_SE>;
|
|
228
|
+
};
|
|
229
|
+
[Locale.US]: {
|
|
230
|
+
[key in Environment]: AuthWebVars<SSO_US>;
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
[Platform.WEB_ADMIN]: {
|
|
234
|
+
[key in Locale]: {
|
|
235
|
+
[key in Environment]: WebAdminVars;
|
|
236
|
+
};
|
|
237
|
+
};
|
|
312
238
|
}>;
|
|
313
239
|
type EnvironmentVars<P extends Platform> = EnvPreset[P][Locale][Environment];
|
|
314
240
|
|
|
241
|
+
type SSOConfig<T extends SSOVariant> = Readonly<{
|
|
242
|
+
name: string;
|
|
243
|
+
icon: ComponentType<IconProps>;
|
|
244
|
+
type: SSO;
|
|
245
|
+
loginSource: LoginSource;
|
|
246
|
+
getUrl: (envs: AuthWebVars<T>) => string;
|
|
247
|
+
ownUrl?: boolean;
|
|
248
|
+
}>;
|
|
249
|
+
|
|
315
250
|
declare function buildTargetToEnvironment(buildTarget: PlatformBuildTarget): Environment;
|
|
316
251
|
|
|
317
252
|
type StudentsLocaleConfig = CommonLocaleConfig & {
|
|
@@ -428,33 +363,12 @@ type DistrictLocaleConfig = CommonLocaleConfig & {
|
|
|
428
363
|
};
|
|
429
364
|
};
|
|
430
365
|
|
|
431
|
-
type AuthWebLocaleConfig<T extends SSOVariant> = {
|
|
432
|
-
path: string;
|
|
433
|
-
shortCode: string;
|
|
434
|
-
icon: ComponentType<IconProps>;
|
|
435
|
-
sources: {
|
|
436
|
-
signUp: {
|
|
437
|
-
list: SSOConfig<T>[];
|
|
438
|
-
};
|
|
439
|
-
signIn: {
|
|
440
|
-
withOnboarding: boolean;
|
|
441
|
-
largeQRCode: boolean;
|
|
442
|
-
list: SSOConfig<T>[];
|
|
443
|
-
};
|
|
444
|
-
};
|
|
445
|
-
isPrimaryRegion: boolean;
|
|
446
|
-
regionGroup: string;
|
|
447
|
-
navigatorLanguages: string[];
|
|
448
|
-
locale: Locale;
|
|
449
|
-
};
|
|
450
|
-
|
|
451
366
|
type WebAdminLocaleConfig = {
|
|
452
367
|
name: string;
|
|
453
368
|
icon: ComponentType<IconProps>;
|
|
454
369
|
locale: Locale;
|
|
455
370
|
isPrimaryRegion: boolean;
|
|
456
371
|
regionGroup: string;
|
|
457
|
-
apiRegion: ApiRegion;
|
|
458
372
|
};
|
|
459
373
|
|
|
460
374
|
type CommonLocaleConfig = Readonly<{
|
|
@@ -474,17 +388,14 @@ type LocalePreset = {
|
|
|
474
388
|
[Platform.DISTRICT_DASHBOARD]: {
|
|
475
389
|
[key in Locale]: DistrictLocaleConfig;
|
|
476
390
|
};
|
|
477
|
-
[Platform.AUTH_WEB]: {
|
|
478
|
-
[key in Locale]: AuthWebLocaleConfig<SSOByLocale[key]>;
|
|
479
|
-
};
|
|
480
391
|
[Platform.WEB_ADMIN]: {
|
|
481
392
|
[key in Locale]: WebAdminLocaleConfig;
|
|
482
393
|
};
|
|
483
|
-
[Platform.
|
|
484
|
-
[key in Locale]:
|
|
394
|
+
[Platform.AUTH_WEB]: {
|
|
395
|
+
[key in Locale]: AuthWebVars<SSOVariant>;
|
|
485
396
|
};
|
|
486
397
|
};
|
|
487
|
-
type LocaleConfig<P extends Platform
|
|
398
|
+
type LocaleConfig<P extends Platform> = LocalePreset[P][Locale];
|
|
488
399
|
|
|
489
400
|
type DevOverrides<P extends Platform> = {
|
|
490
401
|
[K in Locale]?: Partial<EnvironmentVars<P>>;
|
|
@@ -494,41 +405,47 @@ type ConfigOptions<P extends Platform> = {
|
|
|
494
405
|
environment: Environment;
|
|
495
406
|
_DEV_OVERRIDES_?: DevOverrides<P>;
|
|
496
407
|
};
|
|
497
|
-
type SetProps
|
|
498
|
-
locale?:
|
|
499
|
-
envsRegion?:
|
|
408
|
+
type SetProps = {
|
|
409
|
+
locale?: Locale;
|
|
410
|
+
envsRegion?: Locale;
|
|
500
411
|
environment?: Environment;
|
|
501
412
|
};
|
|
502
|
-
declare class AppConfigManager<P extends Platform
|
|
413
|
+
declare class AppConfigManager<P extends Platform> {
|
|
503
414
|
private readonly _DEV_OVERRIDES_?;
|
|
504
415
|
private readonly platform;
|
|
505
416
|
environment: Environment;
|
|
506
|
-
locale:
|
|
507
|
-
envsRegion:
|
|
417
|
+
locale: Locale;
|
|
418
|
+
envsRegion: Locale;
|
|
508
419
|
private readonly setEnvs;
|
|
509
420
|
private readonly setLocaleConfig;
|
|
510
421
|
readonly $envs: effector.StoreWritable<EnvironmentVars<P>>;
|
|
511
|
-
readonly $localeConfig: effector.StoreWritable<LocaleConfig<P
|
|
422
|
+
readonly $localeConfig: effector.StoreWritable<LocaleConfig<P>>;
|
|
512
423
|
constructor(opts: ConfigOptions<P>);
|
|
513
424
|
private readonly syncConfigsStores;
|
|
514
|
-
readonly set: (props: SetProps
|
|
425
|
+
readonly set: (props: SetProps) => void;
|
|
515
426
|
getEnvs: () => EnvironmentVars<P>;
|
|
516
|
-
getLocaleConfig: () => LocaleConfig<P
|
|
517
|
-
locale:
|
|
427
|
+
getLocaleConfig: () => LocaleConfig<P> & {
|
|
428
|
+
locale: Locale;
|
|
518
429
|
};
|
|
519
430
|
readonly onEnvsChange: (cb: (cfg: EnvironmentVars<P>) => void) => effector.Subscription;
|
|
520
|
-
readonly onLocaleChange: (cb: (cfg: LocaleConfig<P
|
|
431
|
+
readonly onLocaleChange: (cb: (cfg: LocaleConfig<P>) => void) => effector.Subscription;
|
|
521
432
|
readonly getPresets: () => {
|
|
522
433
|
envPreset: Readonly<{
|
|
523
|
-
STUDENTS:
|
|
524
|
-
TEACHERS:
|
|
525
|
-
DISTRICT:
|
|
526
|
-
AUTH_WEB:
|
|
527
|
-
|
|
528
|
-
|
|
434
|
+
STUDENTS: { [key in Locale]: { [key_1 in Environment]: StudentsWebVars; }; };
|
|
435
|
+
TEACHERS: { [key in Locale]: { [key_1 in Environment]: TeachersWebVars; }; };
|
|
436
|
+
DISTRICT: { [key in Locale]: { [key_1 in Environment]: DistrictDashboardVars; }; };
|
|
437
|
+
AUTH_WEB: {
|
|
438
|
+
[Locale.CA]: { [key in Environment]: AuthWebVars<SSO_US>; };
|
|
439
|
+
[Locale.DE]: { [key in Environment]: AuthWebVars<SSO_DE>; };
|
|
440
|
+
[Locale.GB]: { [key in Environment]: AuthWebVars<SSO_UK>; };
|
|
441
|
+
[Locale.SCT]: { [key in Environment]: AuthWebVars<SSO_UK>; };
|
|
442
|
+
[Locale.SE]: { [key in Environment]: AuthWebVars<SSO_SE>; };
|
|
443
|
+
[Locale.US]: { [key in Environment]: AuthWebVars<SSO_US>; };
|
|
444
|
+
};
|
|
445
|
+
WEB_ADMIN: { [key in Locale]: { [key_1 in Environment]: WebAdminVars; }; };
|
|
529
446
|
}>;
|
|
530
447
|
localePreset: LocalePreset;
|
|
531
448
|
};
|
|
532
449
|
}
|
|
533
450
|
|
|
534
|
-
export {
|
|
451
|
+
export { AppConfigManager, type AuthWebVars, DateFormat, DateLocale, type DistrictCommon, type DistrictDashboardVars, type EnvPreset, Environment, type EnvironmentVars, Locale, 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 };
|