@magmamath/frontend-config 0.0.1-rc.19 → 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 +70 -252
- package/dist/index.d.ts +70 -252
- package/dist/index.js +376 -4257
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +377 -4252
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -2
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,31 +13,28 @@ 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
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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",
|
|
36
33
|
TEACHERS_WEB = "TEACHERS",
|
|
37
34
|
DISTRICT_DASHBOARD = "DISTRICT",
|
|
38
|
-
AUTH_WEB = "AUTH_WEB"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
MARS = "MARS",
|
|
42
|
-
PROD = "PROD"
|
|
35
|
+
AUTH_WEB = "AUTH_WEB",
|
|
36
|
+
STUDENTS_APP = "STUDENTS_RN_APP",
|
|
37
|
+
TEACHERS_APP = "TEACHERS_RN_APP"
|
|
43
38
|
}
|
|
44
39
|
declare enum Locale {
|
|
45
40
|
US = "en-SE",
|
|
@@ -49,168 +44,33 @@ declare enum Locale {
|
|
|
49
44
|
SCT = "en-SCT",
|
|
50
45
|
DE = "de-DE"
|
|
51
46
|
}
|
|
52
|
-
declare enum
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
SKOLFEDERATION = 2,
|
|
56
|
-
GOOGLE = 3,
|
|
57
|
-
MICROSOFT = 4,
|
|
58
|
-
CLEVER = 5,
|
|
59
|
-
APPLE = 6,
|
|
60
|
-
MATHSYNC = 7,
|
|
61
|
-
CLASSLINK = 8,
|
|
62
|
-
EDUCLOUD = 9,
|
|
63
|
-
EGIL = 10,
|
|
64
|
-
WONDE = 12,
|
|
65
|
-
SCHOOLOGY = 13,
|
|
66
|
-
SEEMIS = 14,
|
|
67
|
-
IMPORT = 15,
|
|
68
|
-
CANVAS = 16
|
|
69
|
-
}
|
|
70
|
-
declare enum LoginSource {
|
|
71
|
-
MAGMA = 0,
|
|
72
|
-
CLEVER = 1,
|
|
73
|
-
CLASS_LINK = 2,
|
|
74
|
-
SKOLON = 3,
|
|
75
|
-
SKOLFEDERATION = 4,
|
|
76
|
-
GOOGLE = 5,
|
|
77
|
-
MICROSOFT = 6,
|
|
78
|
-
APPLE = 7,
|
|
79
|
-
SCHOOLOGY = 8,
|
|
80
|
-
MY_LOGIN = 9
|
|
81
|
-
}
|
|
82
|
-
declare enum SSO {
|
|
83
|
-
GOOGLE = "GOOGLE",
|
|
84
|
-
MICROSOFT = "MICROSOFT",
|
|
85
|
-
CLEVER = "CLEVER",
|
|
86
|
-
SCHOOLOGY = "SCHOOLOGY",
|
|
87
|
-
CLASS_LINK = "CLASS_LINK",
|
|
88
|
-
SKOLFEDERATION = "SKOLFEDERATION",
|
|
89
|
-
SKOLON = "SKOLON",
|
|
90
|
-
WONDE = "WONDE"
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
declare enum MatrixMode {
|
|
94
|
-
SKILL = "SKILL",
|
|
95
|
-
STANDARD = "STANDARD"
|
|
47
|
+
declare enum Environment {
|
|
48
|
+
MARS = "MARS",
|
|
49
|
+
PROD = "PROD"
|
|
96
50
|
}
|
|
97
51
|
|
|
98
|
-
type
|
|
99
|
-
size?: number;
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
type SSO_UK = {
|
|
103
|
-
GOOGLE_AUTH: string;
|
|
104
|
-
MICROSOFT_AUTH: string;
|
|
105
|
-
WONDE_AUTH: string;
|
|
106
|
-
SKOLON_AUTH: string;
|
|
107
|
-
CLEVER_AUTH: never;
|
|
108
|
-
CLASS_LINK_AUTH: never;
|
|
109
|
-
SKOLFEDERATION_AUTH: never;
|
|
110
|
-
SCHOOLOGY_AUTH: never;
|
|
111
|
-
};
|
|
112
|
-
type SSO_US = {
|
|
113
|
-
GOOGLE_AUTH: string;
|
|
114
|
-
MICROSOFT_AUTH: string;
|
|
115
|
-
CLASS_LINK_AUTH: string;
|
|
116
|
-
SCHOOLOGY_AUTH: string;
|
|
117
|
-
CLEVER_AUTH: string;
|
|
118
|
-
};
|
|
119
|
-
type SSO_SE = {
|
|
120
|
-
GOOGLE_AUTH: string;
|
|
121
|
-
MICROSOFT_AUTH: string;
|
|
122
|
-
SKOLFEDERATION_AUTH: string;
|
|
123
|
-
SKOLON_AUTH: string;
|
|
124
|
-
};
|
|
125
|
-
type SSO_DE = {
|
|
126
|
-
GOOGLE_AUTH: string;
|
|
127
|
-
MICROSOFT_AUTH: string;
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
type RegionSpecificVars = {
|
|
52
|
+
type RegionEnv = Readonly<{
|
|
131
53
|
API_URL: string;
|
|
132
54
|
AUTH_WEB_URL: string;
|
|
133
|
-
|
|
134
|
-
DISTRICT_WEB_URL: string;
|
|
55
|
+
MYSCRIPT_HOST: string;
|
|
135
56
|
LOGGLY_TAG: string;
|
|
136
|
-
|
|
57
|
+
SKOLFED_AUTH: string;
|
|
137
58
|
SOCKET_URL: string;
|
|
138
59
|
STUDENTS_WEB_URL: string;
|
|
139
60
|
TEACHERS_WEB_URL: string;
|
|
140
|
-
|
|
141
|
-
|
|
61
|
+
CDN_HOST: string;
|
|
62
|
+
}>;
|
|
63
|
+
type CommonEnv = Readonly<{
|
|
142
64
|
GOOGLE_API_KEY: string;
|
|
143
65
|
DESMOS_API_KEY: string;
|
|
144
66
|
MYSCRIPT_APPLICATION_KEY: string;
|
|
145
67
|
MYSCRIPT_HMAC_KEY: string;
|
|
146
|
-
MYSCRIPT_HOST: string;
|
|
147
68
|
MYSCRIPT_SOCKET_KEY: string;
|
|
148
69
|
MYSCRIPT_REST_APP_KEY: string;
|
|
149
70
|
MYSCRIPT_REST_HMAC_KEY: string;
|
|
150
|
-
|
|
151
|
-
type StudentsWebVars = RegionSpecificVars & StudentsWebCommon;
|
|
152
|
-
type TeachersWebVars = RegionSpecificVars & {};
|
|
153
|
-
type DistrictDashboardVars = RegionSpecificVars & {};
|
|
154
|
-
type AuthWebBaseVars = Omit<RegionSpecificVars, 'CDN_HOST' | 'LOGGLY_TAG' | 'SOCKET_URL'> & {
|
|
155
|
-
TOS_URL: string;
|
|
156
|
-
CLARITY_PROJECT_ID: string;
|
|
157
|
-
INTERCOM_APP_ID: string;
|
|
158
|
-
};
|
|
159
|
-
type AuthWebCAVars = AuthWebBaseVars & SSO_US;
|
|
160
|
-
type AuthWebDEVars = AuthWebBaseVars & SSO_DE;
|
|
161
|
-
type AuthWebUKVars = AuthWebBaseVars & SSO_UK;
|
|
162
|
-
type AuthWebSEVars = AuthWebBaseVars & SSO_SE;
|
|
163
|
-
type AuthWebUSVars = AuthWebBaseVars & SSO_US;
|
|
164
|
-
type EnvPreset = Readonly<{
|
|
165
|
-
[Platform.STUDENTS_WEB]: {
|
|
166
|
-
[key in Locale]: {
|
|
167
|
-
[key in Environment]: StudentsWebVars;
|
|
168
|
-
};
|
|
169
|
-
};
|
|
170
|
-
[Platform.TEACHERS_WEB]: {
|
|
171
|
-
[key in Locale]: {
|
|
172
|
-
[key in Environment]: TeachersWebVars;
|
|
173
|
-
};
|
|
174
|
-
};
|
|
175
|
-
[Platform.DISTRICT_DASHBOARD]: {
|
|
176
|
-
[key in Locale]: {
|
|
177
|
-
[key in Environment]: DistrictDashboardVars;
|
|
178
|
-
};
|
|
179
|
-
};
|
|
180
|
-
[Platform.AUTH_WEB]: {
|
|
181
|
-
[Locale.CA]: {
|
|
182
|
-
[key in Environment]: AuthWebCAVars;
|
|
183
|
-
};
|
|
184
|
-
[Locale.DE]: {
|
|
185
|
-
[key in Environment]: AuthWebDEVars;
|
|
186
|
-
};
|
|
187
|
-
[Locale.GB]: {
|
|
188
|
-
[key in Environment]: AuthWebUKVars;
|
|
189
|
-
};
|
|
190
|
-
[Locale.SCT]: {
|
|
191
|
-
[key in Environment]: AuthWebUKVars;
|
|
192
|
-
};
|
|
193
|
-
[Locale.SE]: {
|
|
194
|
-
[key in Environment]: AuthWebSEVars;
|
|
195
|
-
};
|
|
196
|
-
[Locale.US]: {
|
|
197
|
-
[key in Environment]: AuthWebUSVars;
|
|
198
|
-
};
|
|
199
|
-
};
|
|
200
|
-
}>;
|
|
201
|
-
type EnvironmentVars<P extends Platform> = EnvPreset[P][Locale][Environment];
|
|
202
|
-
|
|
203
|
-
type SSOConfig = Readonly<{
|
|
204
|
-
name: string;
|
|
205
|
-
icon: ComponentType<IconProps>;
|
|
206
|
-
type: SSO;
|
|
207
|
-
loginSource: LoginSource;
|
|
208
|
-
getUrl: (envs: EnvironmentVars<Platform.AUTH_WEB>) => string;
|
|
209
|
-
ownUrl?: boolean;
|
|
71
|
+
LOGGLY_CUSTOMER_TOKEN: string;
|
|
210
72
|
}>;
|
|
211
|
-
|
|
212
|
-
declare const SSO_CONFIG_MAP: Record<SSO, SSOConfig>;
|
|
213
|
-
declare const SSO_CONFIG_LIST: SSOConfig[];
|
|
73
|
+
type EnvironmentVariables = RegionEnv & CommonEnv;
|
|
214
74
|
|
|
215
75
|
type StudentsLocaleConfig = CommonLocaleConfig & {
|
|
216
76
|
textFormatting: {
|
|
@@ -253,13 +113,28 @@ type StudentsLocaleConfig = CommonLocaleConfig & {
|
|
|
253
113
|
statsTab: {
|
|
254
114
|
buttonWithMinWidth: boolean;
|
|
255
115
|
};
|
|
256
|
-
|
|
257
|
-
|
|
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
|
+
};
|
|
258
129
|
};
|
|
259
130
|
};
|
|
260
131
|
|
|
132
|
+
declare enum MatrixMode {
|
|
133
|
+
SKILL = "SKILL",
|
|
134
|
+
STANDARD = "STANDARD"
|
|
135
|
+
}
|
|
136
|
+
|
|
261
137
|
type TeachersLocaleConfig = CommonLocaleConfig & {
|
|
262
|
-
country: string;
|
|
263
138
|
emails: {
|
|
264
139
|
studentsList: string;
|
|
265
140
|
};
|
|
@@ -303,45 +178,12 @@ type TeachersLocaleConfig = CommonLocaleConfig & {
|
|
|
303
178
|
getStarted: {
|
|
304
179
|
showSentEmailInfo: boolean;
|
|
305
180
|
};
|
|
306
|
-
firstLoginBooks: {
|
|
307
|
-
isLargeGrade: ((grade: number) => boolean) | null;
|
|
308
|
-
};
|
|
309
181
|
grades: {
|
|
310
182
|
showPrefix: boolean;
|
|
311
183
|
showOtherGrade: boolean;
|
|
312
184
|
};
|
|
313
185
|
};
|
|
314
186
|
|
|
315
|
-
type DistrictLocaleConfig = CommonLocaleConfig & {
|
|
316
|
-
date: {
|
|
317
|
-
use24HourFormat: boolean;
|
|
318
|
-
locale: DateLocale;
|
|
319
|
-
formats: {
|
|
320
|
-
full: DateFormat;
|
|
321
|
-
dayMonthYear: DateFormat;
|
|
322
|
-
dayMonth: DateFormat;
|
|
323
|
-
hoursMinutes: DateFormat;
|
|
324
|
-
fullWithSeconds: DateFormat;
|
|
325
|
-
};
|
|
326
|
-
};
|
|
327
|
-
};
|
|
328
|
-
|
|
329
|
-
type AuthWebLocaleConfig = {
|
|
330
|
-
path: string;
|
|
331
|
-
shortCode: string;
|
|
332
|
-
icon: ComponentType<IconProps>;
|
|
333
|
-
sources: {
|
|
334
|
-
signUp: {
|
|
335
|
-
list: SSOConfig[];
|
|
336
|
-
};
|
|
337
|
-
signIn: {
|
|
338
|
-
withOnboarding: boolean;
|
|
339
|
-
largeQRCode: boolean;
|
|
340
|
-
list: SSOConfig[];
|
|
341
|
-
};
|
|
342
|
-
};
|
|
343
|
-
};
|
|
344
|
-
|
|
345
187
|
type CommonLocaleConfig = Readonly<{
|
|
346
188
|
name: string;
|
|
347
189
|
languageName: string;
|
|
@@ -360,68 +202,44 @@ type LocalePreset = {
|
|
|
360
202
|
[key in Locale]: DistrictLocaleConfig;
|
|
361
203
|
};
|
|
362
204
|
[Platform.AUTH_WEB]: {
|
|
363
|
-
[key in Locale]:
|
|
205
|
+
[key in Locale]: DistrictLocaleConfig;
|
|
206
|
+
};
|
|
207
|
+
[Platform.STUDENTS_APP]: {
|
|
208
|
+
[key in Locale]: StudentsLocaleConfig;
|
|
209
|
+
};
|
|
210
|
+
[Platform.TEACHERS_APP]: {
|
|
211
|
+
[key in Locale]: TeachersLocaleConfig;
|
|
364
212
|
};
|
|
365
213
|
};
|
|
366
|
-
type LocaleConfig<P extends Platform> = LocalePreset[P][Locale];
|
|
367
214
|
|
|
368
|
-
type
|
|
215
|
+
type Locales<P extends Platform, L extends Locale> = LocalePreset[P][L];
|
|
216
|
+
type ConfigOptions<P extends Platform, L extends Locale> = {
|
|
369
217
|
platform: P;
|
|
218
|
+
locale: L;
|
|
370
219
|
environment: Environment;
|
|
371
220
|
};
|
|
372
221
|
type SetProps = {
|
|
373
222
|
locale?: Locale;
|
|
374
223
|
environment?: Environment;
|
|
375
224
|
};
|
|
376
|
-
declare class AppConfigManager<P extends Platform> {
|
|
225
|
+
declare class AppConfigManager<P extends Platform, L extends Locale> {
|
|
377
226
|
private readonly platform;
|
|
378
|
-
|
|
379
|
-
|
|
227
|
+
private readonly locale;
|
|
228
|
+
private readonly environment;
|
|
380
229
|
private readonly setEnvs;
|
|
381
230
|
private readonly setLocaleConfig;
|
|
382
|
-
readonly $envs: effector.StoreWritable<
|
|
383
|
-
readonly $localeConfig: effector.StoreWritable<
|
|
384
|
-
constructor(opts: ConfigOptions<P>);
|
|
385
|
-
|
|
386
|
-
readonly
|
|
387
|
-
readonly
|
|
388
|
-
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;
|
|
389
237
|
readonly getConfig: () => {
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
name: string;
|
|
395
|
-
icon: react.ComponentType<IconProps>;
|
|
396
|
-
type: SSO;
|
|
397
|
-
loginSource: LoginSource;
|
|
398
|
-
getUrl: (envs: EnvironmentVars<Platform.AUTH_WEB>) => string;
|
|
399
|
-
ownUrl?: boolean;
|
|
400
|
-
}>[];
|
|
401
|
-
readonly getSSO: (key: SSO) => Readonly<{
|
|
402
|
-
name: string;
|
|
403
|
-
icon: react.ComponentType<IconProps>;
|
|
404
|
-
type: SSO;
|
|
405
|
-
loginSource: LoginSource;
|
|
406
|
-
getUrl: (envs: EnvironmentVars<Platform.AUTH_WEB>) => string;
|
|
407
|
-
ownUrl?: boolean;
|
|
408
|
-
}>;
|
|
409
|
-
readonly getPresets: () => {
|
|
410
|
-
envPreset: Readonly<{
|
|
411
|
-
STUDENTS: { [key in Locale]: { [key_1 in Environment]: StudentsWebVars; }; };
|
|
412
|
-
TEACHERS: { [key in Locale]: { [key_1 in Environment]: TeachersWebVars; }; };
|
|
413
|
-
DISTRICT: { [key in Locale]: { [key_1 in Environment]: DistrictDashboardVars; }; };
|
|
414
|
-
AUTH_WEB: {
|
|
415
|
-
[Locale.CA]: { [key in Environment]: AuthWebCAVars; };
|
|
416
|
-
[Locale.DE]: { [key in Environment]: AuthWebDEVars; };
|
|
417
|
-
[Locale.GB]: { [key in Environment]: AuthWebUKVars; };
|
|
418
|
-
[Locale.SCT]: { [key in Environment]: AuthWebUKVars; };
|
|
419
|
-
[Locale.SE]: { [key in Environment]: AuthWebSEVars; };
|
|
420
|
-
[Locale.US]: { [key in Environment]: AuthWebUSVars; };
|
|
421
|
-
};
|
|
422
|
-
}>;
|
|
423
|
-
localePreset: LocalePreset;
|
|
238
|
+
platform: P;
|
|
239
|
+
currentLocale: L;
|
|
240
|
+
envs: EnvironmentVariables;
|
|
241
|
+
locales: Locales<P, L>;
|
|
424
242
|
};
|
|
425
243
|
}
|
|
426
244
|
|
|
427
|
-
export { AppConfigManager,
|
|
245
|
+
export { AppConfigManager, DateFormat, DateLocale, Environment, Locale, Platform };
|