@equinor/mad-core 0.0.4 → 0.2.0

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.
Files changed (117) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/chunk-3XUVY5MJ.js +16 -0
  3. package/dist/chunk-6GFARWDK.js +30 -0
  4. package/dist/chunk-AEGDSD6N.js +10 -0
  5. package/dist/chunk-AFYA4V5E.js +23 -0
  6. package/dist/{chunk-PEFOX6JA.js → chunk-AM5E5CYS.js} +7 -19
  7. package/dist/chunk-BIMOM43W.js +9 -0
  8. package/dist/chunk-BZZTCMAD.js +23 -0
  9. package/dist/{chunk-KXAIAYE4.js → chunk-CMKIUYX7.js} +17 -11
  10. package/dist/chunk-DCUF7ZWX.js +15 -0
  11. package/dist/chunk-DL54DMGO.js +19 -0
  12. package/dist/{chunk-E36MLVBD.js → chunk-DWAJZVKH.js} +1 -1
  13. package/dist/{chunk-5QALP2TZ.js → chunk-FCPT6WB6.js} +31 -17
  14. package/dist/{chunk-FQWPBBPB.js → chunk-GSC3O7TW.js} +1 -1
  15. package/dist/chunk-HGT5ZUYL.js +25 -0
  16. package/dist/{chunk-TLJLKQRN.js → chunk-LNJRCADN.js} +42 -41
  17. package/dist/{chunk-3LDWV3SJ.js → chunk-P636GRYJ.js} +18 -18
  18. package/dist/chunk-PBCPR4ZO.js +8 -0
  19. package/dist/chunk-QDRLODML.js +61 -0
  20. package/dist/chunk-RJEUW53E.js +50 -0
  21. package/dist/chunk-SQXXB44S.js +43 -0
  22. package/dist/chunk-UJAEFWFH.js +44 -0
  23. package/dist/chunk-UOMVB65Y.js +53 -0
  24. package/dist/{chunk-FIFUL4JE.js → chunk-V4QL2TIA.js} +20 -4
  25. package/dist/{chunk-FUGJZRIR.js → chunk-VXUERD3Z.js} +5 -5
  26. package/dist/{chunk-HOPDSUAE.js → chunk-XHOURLLU.js} +5 -3
  27. package/dist/chunk-YY3XXUD6.js +23 -0
  28. package/dist/chunk-ZGFKUVSZ.js +360 -0
  29. package/dist/{chunk-AGAXO3NW.js → chunk-ZXZ2FEIU.js} +5 -1
  30. package/dist/components/AnnouncementsProvider.js +2 -2
  31. package/dist/components/ErrorBoundary.d.ts +3 -0
  32. package/dist/components/ErrorBoundary.js +7 -0
  33. package/dist/components/NavigationContainer.d.ts +3 -0
  34. package/dist/components/NavigationContainer.js +7 -0
  35. package/dist/components/createCoreStackNavigator.d.ts +1 -1
  36. package/dist/components/createCoreStackNavigator.js +29 -17
  37. package/dist/components/index.d.ts +3 -0
  38. package/dist/components/index.js +47 -24
  39. package/dist/components/navigation/MadCoreSubHeader.d.ts +2 -0
  40. package/dist/components/navigation/MadCoreSubHeader.js +7 -0
  41. package/dist/components/navigation/index.d.ts +1 -0
  42. package/dist/components/navigation/index.js +11 -0
  43. package/dist/components/navigation/navigation-creators.d.ts +30 -0
  44. package/dist/components/navigation/navigation-creators.js +10 -0
  45. package/dist/components/screens/AboutScreen.js +8 -2
  46. package/dist/components/screens/CreateIncidentScreen.js +1 -1
  47. package/dist/components/screens/LoginScreen.js +10 -9
  48. package/dist/components/screens/language/SelectLanguageScreen.d.ts +2 -0
  49. package/dist/components/screens/language/SelectLanguageScreen.js +20 -0
  50. package/dist/components/screens/language/components/SelectLanguageCellGroup.d.ts +7 -0
  51. package/dist/components/screens/language/components/SelectLanguageCellGroup.js +12 -0
  52. package/dist/components/screens/release-notes/ChangeLog.js +2 -3
  53. package/dist/components/screens/release-notes/ReleaseNotesScreen.js +17 -2
  54. package/dist/components/screens/release-notes/WhatsNewScreen.js +14 -10
  55. package/dist/components/screens/release-notes/fetchReleaseNotes.d.ts +1 -0
  56. package/dist/components/screens/release-notes/fetchReleaseNotes.js +4 -2
  57. package/dist/components/screens/settings/Section.js +3 -3
  58. package/dist/components/screens/settings/SettingsScreen.js +11 -9
  59. package/dist/components/screens/settings/index.js +12 -10
  60. package/dist/components/screens/settings/renderCell.js +1 -1
  61. package/dist/components/screens/settings/useSignOut.js +3 -3
  62. package/dist/hooks/UseReleaseNotes.d.ts +6 -0
  63. package/dist/hooks/UseReleaseNotes.js +17 -0
  64. package/dist/hooks/index.js +7 -5
  65. package/dist/hooks/useAccountOrDemoAccount.js +1 -1
  66. package/dist/hooks/useCoreStackNavigation.d.ts +2 -1
  67. package/dist/hooks/useCoreStackNavigation.js +6 -4
  68. package/dist/hooks/useScreenTitleFromDictionary.d.ts +2 -0
  69. package/dist/hooks/useScreenTitleFromDictionary.js +13 -0
  70. package/dist/index.d.ts +2 -0
  71. package/dist/index.js +58 -26
  72. package/dist/language/types.d.ts +2 -0
  73. package/dist/language/types.js +0 -0
  74. package/dist/language/useDictionary.d.ts +2 -0
  75. package/dist/language/useDictionary.js +11 -0
  76. package/dist/store/demo-mode/demo-mode.js +1 -1
  77. package/dist/store/demo-mode/index.js +1 -1
  78. package/dist/store/language/index.d.ts +0 -1
  79. package/dist/store/language/index.js +6 -9
  80. package/dist/store/language/language.d.ts +3 -2
  81. package/dist/store/language/language.js +6 -5
  82. package/dist/store/mad-config/hooks.d.ts +13 -3
  83. package/dist/store/mad-config/hooks.js +7 -3
  84. package/dist/store/mad-config/index.js +7 -4
  85. package/dist/store/mad-config/mad-config.js +1 -1
  86. package/dist/store/release-notes/index.js +1 -1
  87. package/dist/store/release-notes/release-notes.js +1 -1
  88. package/dist/store/storage.js +1 -1
  89. package/dist/types.d.ts +19 -1
  90. package/dist/utils/createMadCoreNavigator.d.ts +2 -2
  91. package/dist/utils/createMadCoreNavigator.js +25 -16
  92. package/dist/utils/dateUtils.js +1 -1
  93. package/dist/utils/getFinalSettingsConfig.js +1 -1
  94. package/dist/utils/getNavigationRouteForLoginScreen.d.ts +2 -1
  95. package/dist/utils/getNavigationRouteForLoginScreen.js +8 -2
  96. package/dist/utils/getNavigationRouteForSelectLanguageScreen.d.ts +2 -0
  97. package/dist/utils/getNavigationRouteForSelectLanguageScreen.js +7 -0
  98. package/dist/utils/getNavigationRouteForWhatsNewScreen.d.ts +2 -0
  99. package/dist/utils/getNavigationRouteForWhatsNewScreen.js +12 -0
  100. package/dist/utils/getPremadeSettings.d.ts +2 -1
  101. package/dist/utils/getPremadeSettings.js +2 -2
  102. package/dist/utils/getRedirectUriFromAuthConfig.d.ts +2 -0
  103. package/dist/utils/getRedirectUriFromAuthConfig.js +7 -0
  104. package/dist/utils/madCommonUtils.js +1 -1
  105. package/package.json +13 -12
  106. package/dist/chunk-35THIGVH.js +0 -42
  107. package/dist/chunk-4VKFRNU7.js +0 -10
  108. package/dist/chunk-CXOQFGMM.js +0 -50
  109. package/dist/chunk-J53YLHKZ.js +0 -15
  110. package/dist/chunk-K2H37TUR.js +0 -7
  111. package/dist/chunk-VBEIVB4R.js +0 -10
  112. package/dist/chunk-XYNA7G2L.js +0 -62
  113. package/dist/store/language/supported-languages.d.ts +0 -11
  114. package/dist/store/language/supported-languages.js +0 -7
  115. /package/dist/{chunk-635YONGY.js → chunk-2GCLIPZP.js} +0 -0
  116. /package/dist/{chunk-USETLDR7.js → chunk-5LTGZQUP.js} +0 -0
  117. /package/dist/{chunk-UTXWRAEE.js → chunk-BZK6J33D.js} +0 -0
@@ -1,8 +1,14 @@
1
- export declare const useAuthConfig: () => {
2
- clientId: string;
1
+ import { MadConfig } from "../../types";
2
+ export type AuthConfig = {
3
+ clientId: MadConfig["authentication"]["clientId"];
4
+ scopes: MadConfig["authentication"]["scopes"];
5
+ /**
6
+ * resolved redirectUri. This can either be `redirectUri` or `redirectUriWeb` from the mad config, depending on which platform
7
+ * you're running on.
8
+ */
3
9
  redirectUri: string;
4
- scopes?: string[] | undefined;
5
10
  };
11
+ export declare const useAuthConfig: () => AuthConfig;
6
12
  export declare const useLoginScreenConfig: () => {
7
13
  title: string;
8
14
  logo: import("react-native").ImageSourcePropType;
@@ -10,6 +16,10 @@ export declare const useLoginScreenConfig: () => {
10
16
  export declare const useAppVersion: () => string;
11
17
  export declare const useEnvironment: () => import("@equinor/mad-components/dist/components/Environment/types").EnvironmentName;
12
18
  export declare const useServicePortalName: () => string;
19
+ export declare const useAbout: () => {
20
+ endpoints: string[];
21
+ buildNumber: string;
22
+ } | undefined;
13
23
  export declare const useSettingsScreenPremadeConfig: () => {
14
24
  language: import("../..").SettingsScreenSectionProps | undefined;
15
25
  common: import("../..").SettingsScreenSectionProps;
@@ -1,15 +1,19 @@
1
1
  import {
2
+ useAbout,
2
3
  useAppVersion,
3
4
  useAuthConfig,
4
5
  useEnvironment,
5
6
  useLoginScreenConfig,
6
7
  useServicePortalName,
7
8
  useSettingsScreenPremadeConfig
8
- } from "../../chunk-35THIGVH.js";
9
+ } from "../../chunk-ZGFKUVSZ.js";
9
10
  import "../../chunk-ZSTTHIEF.js";
10
- import "../../chunk-3LDWV3SJ.js";
11
- import "../../chunk-UTXWRAEE.js";
11
+ import "../../chunk-P636GRYJ.js";
12
+ import "../../chunk-DCUF7ZWX.js";
13
+ import "../../chunk-2OMVVDBU.js";
14
+ import "../../chunk-BZK6J33D.js";
12
15
  export {
16
+ useAbout,
13
17
  useAppVersion,
14
18
  useAuthConfig,
15
19
  useEnvironment,
@@ -1,22 +1,25 @@
1
- import "../../chunk-USETLDR7.js";
2
1
  import {
2
+ useAbout,
3
3
  useAppVersion,
4
4
  useAuthConfig,
5
5
  useEnvironment,
6
6
  useLoginScreenConfig,
7
7
  useServicePortalName,
8
8
  useSettingsScreenPremadeConfig
9
- } from "../../chunk-35THIGVH.js";
9
+ } from "../../chunk-ZGFKUVSZ.js";
10
10
  import {
11
11
  getConfig,
12
12
  setConfig,
13
13
  useMadConfig
14
14
  } from "../../chunk-ZSTTHIEF.js";
15
- import "../../chunk-3LDWV3SJ.js";
16
- import "../../chunk-UTXWRAEE.js";
15
+ import "../../chunk-P636GRYJ.js";
16
+ import "../../chunk-DCUF7ZWX.js";
17
+ import "../../chunk-2OMVVDBU.js";
18
+ import "../../chunk-BZK6J33D.js";
17
19
  export {
18
20
  getConfig,
19
21
  setConfig,
22
+ useAbout,
20
23
  useAppVersion,
21
24
  useAuthConfig,
22
25
  useEnvironment,
@@ -3,7 +3,7 @@ import {
3
3
  setConfig,
4
4
  useMadConfig
5
5
  } from "../../chunk-ZSTTHIEF.js";
6
- import "../../chunk-UTXWRAEE.js";
6
+ import "../../chunk-BZK6J33D.js";
7
7
  export {
8
8
  getConfig,
9
9
  setConfig,
@@ -3,7 +3,7 @@ import {
3
3
  useReleaseNotesVersion
4
4
  } from "../../chunk-5BVQKJQB.js";
5
5
  import "../../chunk-2OMVVDBU.js";
6
- import "../../chunk-UTXWRAEE.js";
6
+ import "../../chunk-BZK6J33D.js";
7
7
  export {
8
8
  useReleaseNotesVersion
9
9
  };
@@ -4,7 +4,7 @@ import {
4
4
  useReleaseNotesVersion
5
5
  } from "../../chunk-5BVQKJQB.js";
6
6
  import "../../chunk-2OMVVDBU.js";
7
- import "../../chunk-UTXWRAEE.js";
7
+ import "../../chunk-BZK6J33D.js";
8
8
  export {
9
9
  getLastDisplayedReleaseNotesVersion,
10
10
  setLastDisplayedReleaseNotesVersion,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createStorage
3
3
  } from "../chunk-2OMVVDBU.js";
4
- import "../chunk-UTXWRAEE.js";
4
+ import "../chunk-BZK6J33D.js";
5
5
  export {
6
6
  createStorage
7
7
  };
package/dist/types.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { EnvironmentContextProps } from "@equinor/mad-components";
2
2
  import { ImageSourcePropType } from "react-native";
3
3
  import { Language } from "./store/types";
4
+ import { AppInsightsInitConfig } from "@equinor/mad-insights";
4
5
  export type MadConfig = {
5
6
  /**
6
7
  * Version of the app. Will be displayed in the about screen, and will be used for release notes
@@ -25,6 +26,10 @@ export type MadConfig = {
25
26
  * If `defaultLanguageCode` is not provided, the first language in `supportedLanguages` will be considered default.
26
27
  */
27
28
  defaultLanguageCode?: string;
29
+ /**
30
+ * Core navigates to a language selection screen by default if needed. Set this to true if you want to override this behaviour
31
+ */
32
+ skipOnboarding?: boolean;
28
33
  };
29
34
  authentication: {
30
35
  /**
@@ -36,11 +41,18 @@ export type MadConfig = {
36
41
  clientId: string;
37
42
  /**
38
43
  * Redirect uri of your application.
39
- * You can find and modify your application's client Id in your application's
44
+ * You can find and modify your application's registered redirect URIs in your application's
40
45
  * App registration in Azure.
41
46
  * @see https://portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade
42
47
  */
43
48
  redirectUri: string;
49
+ /**
50
+ * Redirect uri for the web wersion of your application
51
+ * You can find and modify your application's registered redirect URIs in your application's
52
+ * App registration in Azure.
53
+ * @see https://portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade
54
+ */
55
+ redirectUriWeb?: string;
44
56
  /**
45
57
  * Scope to use for interactive login. You can find information about your application's
46
58
  * available scopes in your application's App registration in Azure.
@@ -58,6 +70,10 @@ export type MadConfig = {
58
70
  */
59
71
  logo: ImageSourcePropType;
60
72
  };
73
+ /**
74
+ * App insights config used for initializing application insights service(s)
75
+ */
76
+ applicationInsights: AppInsightsInitConfig;
61
77
  about?: {
62
78
  /**
63
79
  * Endpoints used by the app
@@ -75,6 +91,8 @@ export type MadConfig = {
75
91
  export type CoreStackParamListBase = {
76
92
  Login: undefined;
77
93
  WhatsNew: undefined;
94
+ SelectLanguage: undefined;
95
+ SelectLanguageOnboarding: undefined;
78
96
  ReleaseNotes: undefined;
79
97
  Settings: undefined;
80
98
  About: undefined;
@@ -1,10 +1,10 @@
1
1
  import React from "react";
2
- import { createNativeStackNavigator } from "@equinor/mad-navigation";
3
2
  import { ParamListBase } from "@react-navigation/native";
4
3
  import { CoreStackParamListBase, MadConfig } from "../types";
4
+ import { createNativeStackNavigator } from "../components/navigation";
5
5
  type GeneralFunction = (...args: any) => any;
6
6
  type PropsOf<T extends GeneralFunction> = Parameters<T>[0];
7
7
  type StackType = ReturnType<typeof createNativeStackNavigator>;
8
8
  type NavigatorProps = PropsOf<StackType["Navigator"]>;
9
- export declare const createMadCoreNavigator: <T extends ParamListBase>(Stack: import("@react-navigation/core").TypedNavigator<T & CoreStackParamListBase, import("@react-navigation/native").StackNavigationState<ParamListBase>, import("@equinor/mad-navigation").MadNativeStackNavigationOptions, import("@react-navigation/native-stack").NativeStackNavigationEventMap, ({ id, initialRouteName, children, screenListeners, screenOptions, ...rest }: import("@equinor/mad-navigation").NativeStackNavigatorProps) => React.JSX.Element>, config: MadConfig) => (props: Omit<NavigatorProps, "initialRouteName">) => React.JSX.Element;
9
+ export declare const createMadCoreNavigator: <T extends ParamListBase>(Stack: import("@react-navigation/native").TypedNavigator<T & CoreStackParamListBase, import("@react-navigation/native").StackNavigationState<ParamListBase>, import("@equinor/mad-navigation").MadNativeStackNavigationOptions, import("@react-navigation/native-stack").NativeStackNavigationEventMap, ({ id, initialRouteName, children, screenListeners, screenOptions, customSubHeader, ...rest }: import("@equinor/mad-navigation").NativeStackNavigatorProps) => React.JSX.Element>, config: MadConfig) => (props: Omit<NavigatorProps, "initialRouteName">) => React.JSX.Element;
10
10
  export {};
@@ -1,28 +1,37 @@
1
1
  import {
2
2
  createMadCoreNavigator
3
- } from "../chunk-CXOQFGMM.js";
4
- import "../chunk-4VKFRNU7.js";
5
- import "../chunk-TLJLKQRN.js";
6
- import "../chunk-FIFUL4JE.js";
3
+ } from "../chunk-UOMVB65Y.js";
4
+ import "../chunk-SQXXB44S.js";
5
+ import "../chunk-DL54DMGO.js";
6
+ import "../chunk-QDRLODML.js";
7
+ import "../chunk-LNJRCADN.js";
8
+ import "../chunk-AM5E5CYS.js";
7
9
  import "../chunk-UVQ3Z5PG.js";
8
- import "../chunk-PEFOX6JA.js";
9
- import "../chunk-VBEIVB4R.js";
10
+ import "../chunk-RJEUW53E.js";
10
11
  import "../chunk-GCBWBANV.js";
11
- import "../chunk-5QALP2TZ.js";
12
+ import "../chunk-FCPT6WB6.js";
12
13
  import "../chunk-5BVQKJQB.js";
13
- import "../chunk-USETLDR7.js";
14
- import "../chunk-35THIGVH.js";
15
- import "../chunk-ZSTTHIEF.js";
16
- import "../chunk-2OMVVDBU.js";
17
14
  import "../chunk-OCWASWDK.js";
18
- import "../chunk-AGAXO3NW.js";
19
- import "../chunk-3LDWV3SJ.js";
15
+ import "../chunk-ZXZ2FEIU.js";
16
+ import "../chunk-AEGDSD6N.js";
17
+ import "../chunk-BZZTCMAD.js";
18
+ import "../chunk-GUKC6UGZ.js";
19
+ import "../chunk-EQYL7INQ.js";
20
+ import "../chunk-AFYA4V5E.js";
21
+ import "../chunk-BIMOM43W.js";
22
+ import "../chunk-GSC3O7TW.js";
23
+ import "../chunk-UJAEFWFH.js";
24
+ import "../chunk-6GFARWDK.js";
25
+ import "../chunk-V4QL2TIA.js";
20
26
  import "../chunk-RFYZGBU4.js";
21
- import "../chunk-FQWPBBPB.js";
22
27
  import "../chunk-CCVKLLIO.js";
23
28
  import "../chunk-UZ6YMQV2.js";
24
- import "../chunk-K2H37TUR.js";
25
- import "../chunk-UTXWRAEE.js";
29
+ import "../chunk-ZGFKUVSZ.js";
30
+ import "../chunk-ZSTTHIEF.js";
31
+ import "../chunk-P636GRYJ.js";
32
+ import "../chunk-DCUF7ZWX.js";
33
+ import "../chunk-2OMVVDBU.js";
34
+ import "../chunk-BZK6J33D.js";
26
35
  export {
27
36
  createMadCoreNavigator
28
37
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getShortDate
3
3
  } from "../chunk-OCWASWDK.js";
4
- import "../chunk-UTXWRAEE.js";
4
+ import "../chunk-BZK6J33D.js";
5
5
  export {
6
6
  getShortDate
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getFinalSettingsConfig
3
3
  } from "../chunk-7SJM4NDH.js";
4
- import "../chunk-UTXWRAEE.js";
4
+ import "../chunk-BZK6J33D.js";
5
5
  export {
6
6
  getFinalSettingsConfig
7
7
  };
@@ -1,8 +1,9 @@
1
+ import { CoreStackParamListBase } from "../types";
1
2
  export type GetNavigationRouteForLoginScreenOptions = {
2
3
  appVersion: string;
3
4
  lastDisplayedReleaseNotesVersion: string | null;
4
5
  isDemoMode?: boolean;
5
6
  };
6
- export type GetNavigationRouteForLoginScreenReturnType = "WhatsNew" | "Root";
7
+ export type GetNavigationRouteForLoginScreenReturnType = keyof CoreStackParamListBase;
7
8
  export declare const getNavigationRouteForLoginScreen: ({ appVersion, lastDisplayedReleaseNotesVersion, isDemoMode, }: GetNavigationRouteForLoginScreenOptions) => GetNavigationRouteForLoginScreenReturnType;
8
9
  export declare const _getNavigationRouteForLoginScreenPure: {};
@@ -1,8 +1,14 @@
1
1
  import {
2
2
  _getNavigationRouteForLoginScreenPure,
3
3
  getNavigationRouteForLoginScreen
4
- } from "../chunk-AGAXO3NW.js";
5
- import "../chunk-UTXWRAEE.js";
4
+ } from "../chunk-ZXZ2FEIU.js";
5
+ import "../chunk-BZZTCMAD.js";
6
+ import "../chunk-ZGFKUVSZ.js";
7
+ import "../chunk-ZSTTHIEF.js";
8
+ import "../chunk-P636GRYJ.js";
9
+ import "../chunk-DCUF7ZWX.js";
10
+ import "../chunk-2OMVVDBU.js";
11
+ import "../chunk-BZK6J33D.js";
6
12
  export {
7
13
  _getNavigationRouteForLoginScreenPure,
8
14
  getNavigationRouteForLoginScreen
@@ -0,0 +1,2 @@
1
+ import { CoreStackParamListBase } from "../types";
2
+ export declare const getNavigationRouteForLanguageSelectScreen: (isOnboarding: boolean) => keyof CoreStackParamListBase;
@@ -0,0 +1,7 @@
1
+ import {
2
+ getNavigationRouteForLanguageSelectScreen
3
+ } from "../chunk-AEGDSD6N.js";
4
+ import "../chunk-BZK6J33D.js";
5
+ export {
6
+ getNavigationRouteForLanguageSelectScreen
7
+ };
@@ -0,0 +1,2 @@
1
+ import { CoreStackParamListBase } from "../types";
2
+ export declare const getNavigationRouteForWhatsNewScreen: () => keyof CoreStackParamListBase;
@@ -0,0 +1,12 @@
1
+ import {
2
+ getNavigationRouteForWhatsNewScreen
3
+ } from "../chunk-BZZTCMAD.js";
4
+ import "../chunk-ZGFKUVSZ.js";
5
+ import "../chunk-ZSTTHIEF.js";
6
+ import "../chunk-P636GRYJ.js";
7
+ import "../chunk-DCUF7ZWX.js";
8
+ import "../chunk-2OMVVDBU.js";
9
+ import "../chunk-BZK6J33D.js";
10
+ export {
11
+ getNavigationRouteForWhatsNewScreen
12
+ };
@@ -1,7 +1,8 @@
1
1
  import { SettingsScreenSectionProps } from "../components/screens/settings/types";
2
+ import { CoreDictionary } from "../language/types";
2
3
  import { MadConfig } from "../types";
3
4
  export type PremadeSettings = ReturnType<typeof getPremadeSettings>;
4
- export declare const getPremadeSettings: (config: MadConfig) => {
5
+ export declare const getPremadeSettings: (config: MadConfig, dictionary: CoreDictionary) => {
5
6
  language: SettingsScreenSectionProps | undefined;
6
7
  common: SettingsScreenSectionProps;
7
8
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getPremadeSettings
3
- } from "../chunk-3LDWV3SJ.js";
4
- import "../chunk-UTXWRAEE.js";
3
+ } from "../chunk-P636GRYJ.js";
4
+ import "../chunk-BZK6J33D.js";
5
5
  export {
6
6
  getPremadeSettings
7
7
  };
@@ -0,0 +1,2 @@
1
+ import { MadConfig } from "../types";
2
+ export declare const getRedirectUriFromAuthConfig: (authConfig: MadConfig["authentication"]) => string;
@@ -0,0 +1,7 @@
1
+ import {
2
+ getRedirectUriFromAuthConfig
3
+ } from "../chunk-DCUF7ZWX.js";
4
+ import "../chunk-BZK6J33D.js";
5
+ export {
6
+ getRedirectUriFromAuthConfig
7
+ };
@@ -2,7 +2,7 @@ import {
2
2
  getMadCommonBaseUrl,
3
3
  getMadCommonScopes
4
4
  } from "../chunk-RFYZGBU4.js";
5
- import "../chunk-UTXWRAEE.js";
5
+ import "../chunk-BZK6J33D.js";
6
6
  export {
7
7
  getMadCommonBaseUrl,
8
8
  getMadCommonScopes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/mad-core",
3
- "version": "0.0.4",
3
+ "version": "0.2.0",
4
4
  "description": "Core library for the Mobile App Delivery team",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -22,20 +22,20 @@
22
22
  "peerDependencies": {
23
23
  "@react-native-async-storage/async-storage": "*",
24
24
  "@react-navigation/native": "^6.1.8",
25
- "react": ">=16.8",
26
- "react-dom": ">=16.8",
27
- "react-native": ">=0.68",
28
- "react-native-msal": ">=4.0.4"
25
+ "react": ">=18.0",
26
+ "react-dom": ">=18.0",
27
+ "react-native": ">=0.70",
28
+ "react-native-msal": "*"
29
29
  },
30
30
  "dependencies": {
31
- "@react-navigation/elements": "1.3.19",
31
+ "@react-navigation/elements": "1.3.21",
32
32
  "react-native-render-html": "6.3.4",
33
33
  "showdown": "2.1.0",
34
34
  "zustand": "^4.4.1",
35
- "@equinor/mad-auth": "0.0.14",
36
- "@equinor/mad-components": "0.8.1",
37
- "@equinor/mad-insights": "0.0.2",
38
- "@equinor/mad-navigation": "0.1.17"
35
+ "@equinor/mad-auth": "0.1.1",
36
+ "@equinor/mad-components": "0.8.3",
37
+ "@equinor/mad-insights": "0.1.0",
38
+ "@equinor/mad-navigation": "0.2.0"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@babel/core": "^7.21.4",
@@ -44,7 +44,7 @@
44
44
  "@testing-library/react-native": "^12.3.0",
45
45
  "@types/showdown": "^2.0.0",
46
46
  "react-test-renderer": "18.1.0",
47
- "@equinor/eslint-config-mad": "0.2.1"
47
+ "@equinor/eslint-config-mad": "0.3.0"
48
48
  },
49
49
  "files": [
50
50
  "CODE_OF_CONDUCT.md",
@@ -56,6 +56,7 @@
56
56
  "build": "tsup-node && echo '\n ⚙️ Generating typescript declarations..' && tsc --project tsconfig.json --emitDeclarationOnly --declaration",
57
57
  "test": "jest",
58
58
  "dev": "tsup-node --watch --clean=false",
59
- "lint": "eslint src/"
59
+ "lint": "eslint src/",
60
+ "clean": "rm -rf node_modules/ && rm -rf dist/"
60
61
  }
61
62
  }
@@ -1,42 +0,0 @@
1
- import {
2
- useMadConfig
3
- } from "./chunk-ZSTTHIEF.js";
4
- import {
5
- getPremadeSettings
6
- } from "./chunk-3LDWV3SJ.js";
7
-
8
- // src/store/mad-config/hooks.ts
9
- var useAuthConfig = () => {
10
- const config = useMadConfig();
11
- return config.authentication;
12
- };
13
- var useLoginScreenConfig = () => {
14
- const config = useMadConfig();
15
- return config.login;
16
- };
17
- var useAppVersion = () => {
18
- const config = useMadConfig();
19
- return config.appVersion;
20
- };
21
- var useEnvironment = () => {
22
- const config = useMadConfig();
23
- return config.environment;
24
- };
25
- var useServicePortalName = () => {
26
- const config = useMadConfig();
27
- return config.servicePortalName;
28
- };
29
- var useSettingsScreenPremadeConfig = () => {
30
- const config = useMadConfig();
31
- const premadeSettings = getPremadeSettings(config);
32
- return premadeSettings;
33
- };
34
-
35
- export {
36
- useAuthConfig,
37
- useLoginScreenConfig,
38
- useAppVersion,
39
- useEnvironment,
40
- useServicePortalName,
41
- useSettingsScreenPremadeConfig
42
- };
@@ -1,10 +0,0 @@
1
- // src/components/screens/release-notes/ReleaseNotesScreen.tsx
2
- import React from "react";
3
- import { Typography } from "@equinor/mad-components";
4
- var ReleaseNotesScreen = () => {
5
- return /* @__PURE__ */ React.createElement(Typography, null, "Not implemented yet");
6
- };
7
-
8
- export {
9
- ReleaseNotesScreen
10
- };
@@ -1,50 +0,0 @@
1
- import {
2
- ReleaseNotesScreen
3
- } from "./chunk-4VKFRNU7.js";
4
- import {
5
- WhatsNewScreen
6
- } from "./chunk-TLJLKQRN.js";
7
- import {
8
- AboutScreen
9
- } from "./chunk-VBEIVB4R.js";
10
- import {
11
- CreateIncidentScreen
12
- } from "./chunk-GCBWBANV.js";
13
- import {
14
- LoginScreen
15
- } from "./chunk-5QALP2TZ.js";
16
- import {
17
- AnnouncementsProvider
18
- } from "./chunk-FQWPBBPB.js";
19
- import {
20
- __spreadProps,
21
- __spreadValues
22
- } from "./chunk-UTXWRAEE.js";
23
-
24
- // src/utils/createMadCoreNavigator.tsx
25
- import React from "react";
26
- import { EnvironmentProvider } from "@equinor/mad-navigation";
27
- var createMadCoreNavigator = (Stack, config) => {
28
- function MadCoreNavigator(props) {
29
- return /* @__PURE__ */ React.createElement(EnvironmentProvider, { environment: config.environment }, /* @__PURE__ */ React.createElement(AnnouncementsProvider, null, /* @__PURE__ */ React.createElement(Stack.Navigator, __spreadProps(__spreadValues({}, props), { initialRouteName: "Login" }), /* @__PURE__ */ React.createElement(
30
- Stack.Screen,
31
- {
32
- name: "Login",
33
- component: LoginScreen,
34
- options: { headerShown: false, environmentBannerShown: true }
35
- }
36
- ), /* @__PURE__ */ React.createElement(Stack.Screen, { name: "ReleaseNotes", component: ReleaseNotesScreen }), /* @__PURE__ */ React.createElement(
37
- Stack.Screen,
38
- {
39
- name: "WhatsNew",
40
- component: WhatsNewScreen,
41
- options: { headerTitle: "What's New" }
42
- }
43
- ), config.about && /* @__PURE__ */ React.createElement(Stack.Screen, { name: "About", component: AboutScreen }), config.serviceNow && /* @__PURE__ */ React.createElement(Stack.Screen, { name: "Feedback", component: CreateIncidentScreen }), props.children)));
44
- }
45
- return MadCoreNavigator;
46
- };
47
-
48
- export {
49
- createMadCoreNavigator
50
- };
@@ -1,15 +0,0 @@
1
- // src/store/language/supported-languages.ts
2
- var CORE_SUPPORTED_LANGUAGES = [
3
- {
4
- code: "en",
5
- name: "English"
6
- },
7
- {
8
- code: "nb",
9
- name: "Norwegian"
10
- }
11
- ];
12
-
13
- export {
14
- CORE_SUPPORTED_LANGUAGES
15
- };
@@ -1,7 +0,0 @@
1
- // src/hooks/useCoreStackNavigation.ts
2
- import { useNavigation } from "@react-navigation/native";
3
- var useCoreStackNavigation = () => useNavigation();
4
-
5
- export {
6
- useCoreStackNavigation
7
- };
@@ -1,10 +0,0 @@
1
- // src/components/screens/AboutScreen.tsx
2
- import React from "react";
3
- import { Typography } from "@equinor/mad-components";
4
- var AboutScreen = () => {
5
- return /* @__PURE__ */ React.createElement(Typography, null, "Not implemented yet");
6
- };
7
-
8
- export {
9
- AboutScreen
10
- };
@@ -1,62 +0,0 @@
1
- import {
2
- getConfig
3
- } from "./chunk-ZSTTHIEF.js";
4
- import {
5
- createStorage
6
- } from "./chunk-2OMVVDBU.js";
7
-
8
- // src/store/language/language.ts
9
- import { create } from "zustand";
10
- import { devtools, persist } from "zustand/middleware";
11
- var getSupportedLanguages = () => getConfig().language.supportedLanguages;
12
- var getDefaultLanguage = () => {
13
- const supportedLanguages = getSupportedLanguages();
14
- const defaultLanguageCode = getConfig().language.defaultLanguageCode;
15
- if (supportedLanguages.length === 0)
16
- throw new Error("There are no supported languages");
17
- if (!defaultLanguageCode)
18
- return supportedLanguages[0];
19
- const defaultLanguage = supportedLanguages.find(
20
- (language) => language.code === defaultLanguageCode
21
- );
22
- if (!defaultLanguage)
23
- throw new Error("defaultLanguageCode was not found within supported languages");
24
- return defaultLanguage;
25
- };
26
- var useLanguageStore = create()(
27
- devtools(
28
- persist(
29
- (set, get) => ({
30
- selectedLanguage: null,
31
- setSelectedLanguage: (code) => {
32
- const supportedLanguages = getSupportedLanguages();
33
- set(() => ({
34
- selectedLanguage: supportedLanguages.find((language) => language.code === code) || null
35
- }));
36
- },
37
- getLanguage: () => {
38
- const { selectedLanguage } = get();
39
- return selectedLanguage || getDefaultLanguage();
40
- }
41
- }),
42
- {
43
- name: "language",
44
- storage: createStorage()
45
- }
46
- ),
47
- { name: "core/language" }
48
- )
49
- );
50
- var useLanguage = () => {
51
- const store = useLanguageStore();
52
- const language = store.getLanguage();
53
- const { setSelectedLanguage: setSelectedLanguage2 } = store;
54
- return { language, getDefaultLanguage, setSelectedLanguage: setSelectedLanguage2, getSupportedLanguages };
55
- };
56
- var { getLanguage, setSelectedLanguage } = useLanguageStore.getState();
57
-
58
- export {
59
- useLanguage,
60
- getLanguage,
61
- setSelectedLanguage
62
- };
@@ -1,11 +0,0 @@
1
- /**
2
- * Supported languages for the core package
3
- */
4
- export declare const CORE_SUPPORTED_LANGUAGES: readonly [{
5
- readonly code: "en";
6
- readonly name: "English";
7
- }, {
8
- readonly code: "nb";
9
- readonly name: "Norwegian";
10
- }];
11
- export type SupportedLanguageCode = (typeof CORE_SUPPORTED_LANGUAGES)[number]["code"];