@magmamath/frontend-config 1.0.13-rc.3 → 1.0.13-rc.4

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,4 +1,3 @@
1
- import * as react from 'react';
2
1
  import { ComponentType } from 'react';
3
2
  import * as effector from 'effector';
4
3
 
@@ -101,18 +100,6 @@ type IconProps = {
101
100
  size?: number;
102
101
  };
103
102
 
104
- type SSOConfig<Envs> = Readonly<{
105
- name: string;
106
- icon: ComponentType<IconProps>;
107
- type: SSO;
108
- loginSource: LoginSource;
109
- getUrl: (envs: Envs) => string;
110
- ownUrl?: boolean;
111
- }>;
112
-
113
- declare const SSO_CONFIG_MAP: Record<SSO, SSOConfig<any>>;
114
- declare const SSO_CONFIG_LIST: SSOConfig<any>[];
115
-
116
103
  type SSO_UK = {
117
104
  GOOGLE_AUTH: string;
118
105
  MICROSOFT_AUTH: string;
@@ -185,6 +172,7 @@ type AuthWebDEVars = AuthWebBaseVars & SSO_DE;
185
172
  type AuthWebUKVars = AuthWebBaseVars & SSO_UK;
186
173
  type AuthWebSEVars = AuthWebBaseVars & SSO_SE;
187
174
  type AuthWebUSVars = AuthWebBaseVars & SSO_US;
175
+ type AuthWebVars = AuthWebBaseVars & (SSO_US | SSO_DE | SSO_UK | SSO_SE);
188
176
  type EnvPreset = Readonly<{
189
177
  [Platform.STUDENTS_WEB]: {
190
178
  [key in Locale]: {
@@ -224,6 +212,18 @@ type EnvPreset = Readonly<{
224
212
  }>;
225
213
  type EnvironmentVars<P extends Platform> = EnvPreset[P][Locale][Environment];
226
214
 
215
+ type SSOConfig = Readonly<{
216
+ name: string;
217
+ icon: ComponentType<IconProps>;
218
+ type: SSO;
219
+ loginSource: LoginSource;
220
+ getUrl: (envs: AuthWebVars) => string;
221
+ ownUrl?: boolean;
222
+ }>;
223
+
224
+ type UnionKeys<T> = T extends any ? keyof T : never;
225
+ declare function safeEnv<T, K extends UnionKeys<T>>(envs: T, key: K): any;
226
+
227
227
  type StudentsLocaleConfig = CommonLocaleConfig & {
228
228
  textFormatting: {
229
229
  replaceCommaWithSpace: boolean;
@@ -344,12 +344,12 @@ type AuthWebLocaleConfig = {
344
344
  icon: ComponentType<IconProps>;
345
345
  sources: {
346
346
  signUp: {
347
- list: SSOConfig<any>[];
347
+ list: SSOConfig[];
348
348
  };
349
349
  signIn: {
350
350
  withOnboarding: boolean;
351
351
  largeQRCode: boolean;
352
- list: SSOConfig<any>[];
352
+ list: SSOConfig[];
353
353
  };
354
354
  };
355
355
  isPrimaryRegion: boolean;
@@ -411,22 +411,6 @@ declare class AppConfigManager<P extends Platform> {
411
411
  envs: EnvironmentVars<P>;
412
412
  localeConfig: LocaleConfig<P>;
413
413
  };
414
- readonly getSSOList: () => Readonly<{
415
- name: string;
416
- icon: react.ComponentType<IconProps>;
417
- type: SSO;
418
- loginSource: LoginSource;
419
- getUrl: (envs: any) => string;
420
- ownUrl?: boolean;
421
- }>[];
422
- readonly getSSO: (key: SSO) => Readonly<{
423
- name: string;
424
- icon: react.ComponentType<IconProps>;
425
- type: SSO;
426
- loginSource: LoginSource;
427
- getUrl: (envs: any) => string;
428
- ownUrl?: boolean;
429
- }>;
430
414
  readonly getPresets: () => {
431
415
  envPreset: Readonly<{
432
416
  STUDENTS: { [key in Locale]: { [key_1 in Environment]: StudentsWebVars; }; };
@@ -445,4 +429,4 @@ declare class AppConfigManager<P extends Platform> {
445
429
  };
446
430
  }
447
431
 
448
- export { AppConfigManager, type AuthWebCAVars, type AuthWebDEVars, type AuthWebSEVars, type AuthWebUKVars, type AuthWebUSVars, DateFormat, DateLocale, type DistrictCommon, type DistrictDashboardVars, type EnvPreset, Environment, type EnvironmentVars, Locale, LoginSource, MatrixMode, Platform, type RegionSpecificVars, SSO, type SSOConfig, SSO_CONFIG_LIST, SSO_CONFIG_MAP, Source, type StudentsWebCommon, type StudentsWebVars, type TeachersWebCommon, type TeachersWebVars };
432
+ export { AppConfigManager, type AuthWebCAVars, type AuthWebDEVars, type AuthWebSEVars, type AuthWebUKVars, type AuthWebUSVars, type AuthWebVars, DateFormat, DateLocale, type DistrictCommon, type DistrictDashboardVars, type EnvPreset, Environment, type EnvironmentVars, Locale, LoginSource, MatrixMode, Platform, type RegionSpecificVars, SSO, type SSOConfig, Source, type StudentsWebCommon, type StudentsWebVars, type TeachersWebCommon, type TeachersWebVars, safeEnv };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import * as react from 'react';
2
1
  import { ComponentType } from 'react';
3
2
  import * as effector from 'effector';
4
3
 
@@ -101,18 +100,6 @@ type IconProps = {
101
100
  size?: number;
102
101
  };
103
102
 
104
- type SSOConfig<Envs> = Readonly<{
105
- name: string;
106
- icon: ComponentType<IconProps>;
107
- type: SSO;
108
- loginSource: LoginSource;
109
- getUrl: (envs: Envs) => string;
110
- ownUrl?: boolean;
111
- }>;
112
-
113
- declare const SSO_CONFIG_MAP: Record<SSO, SSOConfig<any>>;
114
- declare const SSO_CONFIG_LIST: SSOConfig<any>[];
115
-
116
103
  type SSO_UK = {
117
104
  GOOGLE_AUTH: string;
118
105
  MICROSOFT_AUTH: string;
@@ -185,6 +172,7 @@ type AuthWebDEVars = AuthWebBaseVars & SSO_DE;
185
172
  type AuthWebUKVars = AuthWebBaseVars & SSO_UK;
186
173
  type AuthWebSEVars = AuthWebBaseVars & SSO_SE;
187
174
  type AuthWebUSVars = AuthWebBaseVars & SSO_US;
175
+ type AuthWebVars = AuthWebBaseVars & (SSO_US | SSO_DE | SSO_UK | SSO_SE);
188
176
  type EnvPreset = Readonly<{
189
177
  [Platform.STUDENTS_WEB]: {
190
178
  [key in Locale]: {
@@ -224,6 +212,18 @@ type EnvPreset = Readonly<{
224
212
  }>;
225
213
  type EnvironmentVars<P extends Platform> = EnvPreset[P][Locale][Environment];
226
214
 
215
+ type SSOConfig = Readonly<{
216
+ name: string;
217
+ icon: ComponentType<IconProps>;
218
+ type: SSO;
219
+ loginSource: LoginSource;
220
+ getUrl: (envs: AuthWebVars) => string;
221
+ ownUrl?: boolean;
222
+ }>;
223
+
224
+ type UnionKeys<T> = T extends any ? keyof T : never;
225
+ declare function safeEnv<T, K extends UnionKeys<T>>(envs: T, key: K): any;
226
+
227
227
  type StudentsLocaleConfig = CommonLocaleConfig & {
228
228
  textFormatting: {
229
229
  replaceCommaWithSpace: boolean;
@@ -344,12 +344,12 @@ type AuthWebLocaleConfig = {
344
344
  icon: ComponentType<IconProps>;
345
345
  sources: {
346
346
  signUp: {
347
- list: SSOConfig<any>[];
347
+ list: SSOConfig[];
348
348
  };
349
349
  signIn: {
350
350
  withOnboarding: boolean;
351
351
  largeQRCode: boolean;
352
- list: SSOConfig<any>[];
352
+ list: SSOConfig[];
353
353
  };
354
354
  };
355
355
  isPrimaryRegion: boolean;
@@ -411,22 +411,6 @@ declare class AppConfigManager<P extends Platform> {
411
411
  envs: EnvironmentVars<P>;
412
412
  localeConfig: LocaleConfig<P>;
413
413
  };
414
- readonly getSSOList: () => Readonly<{
415
- name: string;
416
- icon: react.ComponentType<IconProps>;
417
- type: SSO;
418
- loginSource: LoginSource;
419
- getUrl: (envs: any) => string;
420
- ownUrl?: boolean;
421
- }>[];
422
- readonly getSSO: (key: SSO) => Readonly<{
423
- name: string;
424
- icon: react.ComponentType<IconProps>;
425
- type: SSO;
426
- loginSource: LoginSource;
427
- getUrl: (envs: any) => string;
428
- ownUrl?: boolean;
429
- }>;
430
414
  readonly getPresets: () => {
431
415
  envPreset: Readonly<{
432
416
  STUDENTS: { [key in Locale]: { [key_1 in Environment]: StudentsWebVars; }; };
@@ -445,4 +429,4 @@ declare class AppConfigManager<P extends Platform> {
445
429
  };
446
430
  }
447
431
 
448
- export { AppConfigManager, type AuthWebCAVars, type AuthWebDEVars, type AuthWebSEVars, type AuthWebUKVars, type AuthWebUSVars, DateFormat, DateLocale, type DistrictCommon, type DistrictDashboardVars, type EnvPreset, Environment, type EnvironmentVars, Locale, LoginSource, MatrixMode, Platform, type RegionSpecificVars, SSO, type SSOConfig, SSO_CONFIG_LIST, SSO_CONFIG_MAP, Source, type StudentsWebCommon, type StudentsWebVars, type TeachersWebCommon, type TeachersWebVars };
432
+ export { AppConfigManager, type AuthWebCAVars, type AuthWebDEVars, type AuthWebSEVars, type AuthWebUKVars, type AuthWebUSVars, type AuthWebVars, DateFormat, DateLocale, type DistrictCommon, type DistrictDashboardVars, type EnvPreset, Environment, type EnvironmentVars, Locale, LoginSource, MatrixMode, Platform, type RegionSpecificVars, SSO, type SSOConfig, Source, type StudentsWebCommon, type StudentsWebVars, type TeachersWebCommon, type TeachersWebVars, safeEnv };