@equinor/mad-core 0.3.2 → 0.3.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.
Files changed (79) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/{chunk-A3ND5QVK.js → chunk-2BXHQTFH.js} +1 -1
  3. package/dist/chunk-5IS2WJYY.js +25 -0
  4. package/dist/{chunk-7OT26KNA.js → chunk-5XZ4EIWK.js} +5 -5
  5. package/dist/{chunk-UAKBRWHM.js → chunk-6ZEGA36S.js} +1 -1
  6. package/dist/{chunk-6UN2PRPB.js → chunk-7IV7JAIC.js} +1 -1
  7. package/dist/{chunk-ZX726IIW.js → chunk-7PHV3YNH.js} +146 -67
  8. package/dist/{chunk-PEPYP4GH.js → chunk-ATHPQPDV.js} +2 -2
  9. package/dist/{chunk-KBY2EXL7.js → chunk-C5H36AGQ.js} +1 -1
  10. package/dist/chunk-CAOQCE6W.js +31 -0
  11. package/dist/{chunk-MPPFRLAL.js → chunk-EFVAFRZ4.js} +3 -3
  12. package/dist/{chunk-FOAO6U65.js → chunk-F4CPVOUK.js} +7 -7
  13. package/dist/{chunk-SGPMP2PN.js → chunk-F4WSVD6D.js} +1 -1
  14. package/dist/{chunk-2DFV2HBY.js → chunk-GLFZI3WS.js} +1 -1
  15. package/dist/chunk-HGYVJZAF.js +77 -0
  16. package/dist/{chunk-FXJGDKLB.js → chunk-ILRFXZQ6.js} +4 -4
  17. package/dist/{chunk-PX7SPACG.js → chunk-IUZOOXOV.js} +2 -4
  18. package/dist/{chunk-T6J6HWJK.js → chunk-KGULNU2L.js} +3 -3
  19. package/dist/{chunk-BBDX2JPC.js → chunk-LFCWKD5B.js} +1 -1
  20. package/dist/chunk-MCVFE22N.js +15 -0
  21. package/dist/{chunk-ANFSTFWV.js → chunk-STRJ5XYK.js} +4 -4
  22. package/dist/{chunk-DCUF7ZWX.js → chunk-VJD2P6SF.js} +1 -2
  23. package/dist/{chunk-O2G2ZKO7.js → chunk-WJKN64CT.js} +4 -4
  24. package/dist/{chunk-5RW7M3DD.js → chunk-WV6VNU2T.js} +1 -1
  25. package/dist/chunk-Z2N6DISW.js +144 -0
  26. package/dist/components/EnvironmentProvider.d.ts +2 -0
  27. package/dist/components/EnvironmentProvider.js +11 -0
  28. package/dist/components/createCoreStackNavigator.d.ts +1 -1
  29. package/dist/components/createCoreStackNavigator.js +30 -27
  30. package/dist/components/index.js +33 -30
  31. package/dist/components/navigation/MadCoreSubHeader.js +7 -8
  32. package/dist/components/navigation/index.js +8 -9
  33. package/dist/components/navigation/navigation-creators.js +8 -9
  34. package/dist/components/screens/AboutScreen.js +3 -4
  35. package/dist/components/screens/LoginScreen.js +5 -6
  36. package/dist/components/screens/create-incident/CreateIncidentScreen.js +19 -0
  37. package/dist/components/screens/create-incident/UserInfo.d.ts +7 -0
  38. package/dist/components/screens/create-incident/UserInfo.js +7 -0
  39. package/dist/components/screens/create-incident/createIncident.d.ts +16 -0
  40. package/dist/components/screens/create-incident/createIncident.js +8 -0
  41. package/dist/components/screens/language/SelectLanguageScreen.js +5 -6
  42. package/dist/components/screens/language/components/SelectLanguageCellGroup.js +3 -4
  43. package/dist/components/screens/release-notes/ReleaseNotesScreen.js +6 -7
  44. package/dist/components/screens/release-notes/WhatsNewScreen.js +8 -9
  45. package/dist/components/screens/settings/SettingsScreen.js +5 -6
  46. package/dist/components/screens/settings/index.js +6 -7
  47. package/dist/components/service-message/ServiceMessageBanner.js +6 -7
  48. package/dist/components/service-message/ServiceMessageProvider.js +4 -5
  49. package/dist/components/service-message/hooks/useFetchServiceMessage.js +3 -4
  50. package/dist/hooks/UseReleaseNotes.js +3 -4
  51. package/dist/hooks/useScreenTitleFromDictionary.js +3 -4
  52. package/dist/index.js +41 -33
  53. package/dist/language/useDictionary.js +2 -3
  54. package/dist/store/index.d.ts +1 -0
  55. package/dist/store/index.js +11 -6
  56. package/dist/store/language/index.js +2 -3
  57. package/dist/store/language/language.js +2 -3
  58. package/dist/store/mad-config/hooks.d.ts +4 -4
  59. package/dist/store/mad-config/hooks.js +4 -3
  60. package/dist/store/mad-config/index.js +11 -7
  61. package/dist/store/mad-config/mad-config.d.ts +5 -3
  62. package/dist/store/mad-config/mad-config.js +8 -1
  63. package/dist/types.d.ts +24 -17
  64. package/dist/utils/createEnvironmentProxy.d.ts +9 -0
  65. package/dist/utils/createEnvironmentProxy.js +10 -0
  66. package/dist/utils/createMadCoreNavigator.d.ts +3 -3
  67. package/dist/utils/createMadCoreNavigator.js +25 -22
  68. package/dist/utils/getNavigationRouteForLoginScreen.js +4 -5
  69. package/dist/utils/getNavigationRouteForWhatsNewScreen.js +3 -4
  70. package/dist/utils/getPremadeSettings.d.ts +3 -3
  71. package/dist/utils/getRedirectUriFromAuthConfig.d.ts +1 -2
  72. package/dist/utils/getRedirectUriFromAuthConfig.js +1 -1
  73. package/package.json +9 -7
  74. package/dist/chunk-6O3V4Z6G.js +0 -56
  75. package/dist/chunk-GCBWBANV.js +0 -10
  76. package/dist/chunk-ZSTTHIEF.js +0 -34
  77. package/dist/components/screens/CreateIncidentScreen.js +0 -7
  78. /package/dist/{chunk-G5W3HK4A.js → chunk-RVKZULYD.js} +0 -0
  79. /package/dist/components/screens/{CreateIncidentScreen.d.ts → create-incident/CreateIncidentScreen.d.ts} +0 -0
@@ -0,0 +1,9 @@
1
+ import { Environment, MadConfig } from "../types";
2
+ /**
3
+ * Given the currently selected environment (dev, test, qa, prod),
4
+ * this method creates proxies for the "mad config" so that it resolves to the correct environment values.
5
+ * This handles all configuration possibilities, from 0 to 4 different environments.
6
+ * @param scheme The environment scheme of the application.
7
+ * @returns A proxied config with all values resolved to the provided schemes.
8
+ */
9
+ export declare function createEnvironmentProxy(scheme: Environment): import("../types").WithoutEnvironmentOptionValues<MadConfig>;
@@ -0,0 +1,10 @@
1
+ import {
2
+ createEnvironmentProxy
3
+ } from "../chunk-7PHV3YNH.js";
4
+ import "../chunk-P636GRYJ.js";
5
+ import "../chunk-VJD2P6SF.js";
6
+ import "../chunk-2OMVVDBU.js";
7
+ import "../chunk-WEAGW6MQ.js";
8
+ export {
9
+ createEnvironmentProxy
10
+ };
@@ -1,10 +1,10 @@
1
1
  import React from "react";
2
2
  import { ParamListBase } from "@react-navigation/native";
3
- import { CoreStackParamListBase, MadConfig } from "../types";
4
- import { createNativeStackNavigator } from "../components/navigation";
3
+ import { CoreStackParamListBase } from "../types";
4
+ import { createNativeStackNavigator } from "../components";
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/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;
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>) => (props: Omit<NavigatorProps, "initialRouteName">) => React.JSX.Element | null;
10
10
  export {};
@@ -1,37 +1,40 @@
1
1
  import {
2
2
  createMadCoreNavigator
3
- } from "../chunk-6O3V4Z6G.js";
4
- import "../chunk-MPPFRLAL.js";
5
- import "../chunk-2DFV2HBY.js";
6
- import "../chunk-ANFSTFWV.js";
7
- import "../chunk-FOAO6U65.js";
8
- import "../chunk-UVQ3Z5PG.js";
3
+ } from "../chunk-HGYVJZAF.js";
4
+ import "../chunk-EFVAFRZ4.js";
5
+ import "../chunk-GLFZI3WS.js";
6
+ import "../chunk-STRJ5XYK.js";
7
+ import "../chunk-F4CPVOUK.js";
9
8
  import "../chunk-CIMA2GQQ.js";
10
- import "../chunk-6UN2PRPB.js";
11
- import "../chunk-T6J6HWJK.js";
12
- import "../chunk-SGPMP2PN.js";
13
- import "../chunk-GCBWBANV.js";
14
- import "../chunk-PEPYP4GH.js";
9
+ import "../chunk-UVQ3Z5PG.js";
10
+ import "../chunk-Z2N6DISW.js";
11
+ import "../chunk-5IS2WJYY.js";
12
+ import "../chunk-CAOQCE6W.js";
13
+ import "../chunk-ATHPQPDV.js";
15
14
  import "../chunk-5BVQKJQB.js";
15
+ import "../chunk-7IV7JAIC.js";
16
+ import "../chunk-KGULNU2L.js";
17
+ import "../chunk-F4WSVD6D.js";
16
18
  import "../chunk-OCWASWDK.js";
17
- import "../chunk-5RW7M3DD.js";
19
+ import "../chunk-WV6VNU2T.js";
20
+ import "../chunk-IUZOOXOV.js";
18
21
  import "../chunk-AEGDSD6N.js";
19
- import "../chunk-PX7SPACG.js";
20
- import "../chunk-GUKC6UGZ.js";
21
- import "../chunk-EQYL7INQ.js";
22
- import "../chunk-UAKBRWHM.js";
23
- import "../chunk-BIMOM43W.js";
24
- import "../chunk-GSOAYETS.js";
25
- import "../chunk-A3ND5QVK.js";
22
+ import "../chunk-2BXHQTFH.js";
26
23
  import "../chunk-GHWLQBHQ.js";
27
24
  import "../chunk-KBEPONRV.js";
28
25
  import "../chunk-RFYZGBU4.js";
26
+ import "../chunk-GUKC6UGZ.js";
27
+ import "../chunk-EQYL7INQ.js";
28
+ import "../chunk-6ZEGA36S.js";
29
+ import "../chunk-BIMOM43W.js";
30
+ import "../chunk-RVKZULYD.js";
29
31
  import "../chunk-CCVKLLIO.js";
30
32
  import "../chunk-UZ6YMQV2.js";
31
- import "../chunk-ZX726IIW.js";
32
- import "../chunk-ZSTTHIEF.js";
33
- import "../chunk-DCUF7ZWX.js";
33
+ import "../chunk-GSOAYETS.js";
34
+ import "../chunk-MCVFE22N.js";
35
+ import "../chunk-7PHV3YNH.js";
34
36
  import "../chunk-P636GRYJ.js";
37
+ import "../chunk-VJD2P6SF.js";
35
38
  import "../chunk-2OMVVDBU.js";
36
39
  import "../chunk-WEAGW6MQ.js";
37
40
  export {
@@ -1,12 +1,11 @@
1
1
  import {
2
2
  _getNavigationRouteForLoginScreenPure,
3
3
  getNavigationRouteForLoginScreen
4
- } from "../chunk-5RW7M3DD.js";
5
- import "../chunk-PX7SPACG.js";
6
- import "../chunk-ZX726IIW.js";
7
- import "../chunk-ZSTTHIEF.js";
8
- import "../chunk-DCUF7ZWX.js";
4
+ } from "../chunk-WV6VNU2T.js";
5
+ import "../chunk-IUZOOXOV.js";
6
+ import "../chunk-7PHV3YNH.js";
9
7
  import "../chunk-P636GRYJ.js";
8
+ import "../chunk-VJD2P6SF.js";
10
9
  import "../chunk-2OMVVDBU.js";
11
10
  import "../chunk-WEAGW6MQ.js";
12
11
  export {
@@ -1,10 +1,9 @@
1
1
  import {
2
2
  getNavigationRouteForWhatsNewScreen
3
- } from "../chunk-PX7SPACG.js";
4
- import "../chunk-ZX726IIW.js";
5
- import "../chunk-ZSTTHIEF.js";
6
- import "../chunk-DCUF7ZWX.js";
3
+ } from "../chunk-IUZOOXOV.js";
4
+ import "../chunk-7PHV3YNH.js";
7
5
  import "../chunk-P636GRYJ.js";
6
+ import "../chunk-VJD2P6SF.js";
8
7
  import "../chunk-2OMVVDBU.js";
9
8
  import "../chunk-WEAGW6MQ.js";
10
9
  export {
@@ -1,8 +1,8 @@
1
- import { SettingsScreenSectionProps } from "../components/screens/settings/types";
1
+ import { SettingsScreenSectionProps } from "../components";
2
2
  import { CoreDictionary } from "../language/types";
3
- import { MadConfig } from "../types";
3
+ import { EnvironmentContextualConfig } from "../types";
4
4
  export type PremadeSettings = ReturnType<typeof getPremadeSettings>;
5
- export declare const getPremadeSettings: (config: MadConfig, dictionary: CoreDictionary) => {
5
+ export declare const getPremadeSettings: (config: EnvironmentContextualConfig, dictionary: CoreDictionary) => {
6
6
  language: SettingsScreenSectionProps | undefined;
7
7
  common: SettingsScreenSectionProps;
8
8
  };
@@ -1,2 +1 @@
1
- import { MadConfig } from "../types";
2
- export declare const getRedirectUriFromAuthConfig: (authConfig: MadConfig["authentication"]) => string;
1
+ export declare const getRedirectUriFromAuthConfig: (clientId: string, redirectUri: string, redirectUriWeb?: string) => string;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getRedirectUriFromAuthConfig
3
- } from "../chunk-DCUF7ZWX.js";
3
+ } from "../chunk-VJD2P6SF.js";
4
4
  import "../chunk-WEAGW6MQ.js";
5
5
  export {
6
6
  getRedirectUriFromAuthConfig
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/mad-core",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "Core library for the Mobile App Delivery team",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -22,10 +22,12 @@
22
22
  "peerDependencies": {
23
23
  "@react-native-async-storage/async-storage": "*",
24
24
  "@react-navigation/native": "^6.1.8",
25
- "react-native-gesture-handler": "^2.14.0",
25
+ "expo-device": ">=5.4.0",
26
+ "expo-localization": ">=14.3.0",
26
27
  "react": ">=18.0",
27
28
  "react-dom": ">=18.0",
28
29
  "react-native": ">=0.70",
30
+ "react-native-gesture-handler": "^2.14.0",
29
31
  "react-native-msal": "*"
30
32
  },
31
33
  "dependencies": {
@@ -33,10 +35,10 @@
33
35
  "react-native-render-html": "6.3.4",
34
36
  "showdown": "2.1.0",
35
37
  "zustand": "^4.4.1",
36
- "@equinor/mad-auth": "0.1.2",
37
- "@equinor/mad-components": "0.8.4",
38
- "@equinor/mad-insights": "0.1.0",
39
- "@equinor/mad-navigation": "0.2.0"
38
+ "@equinor/mad-auth": "0.1.4",
39
+ "@equinor/mad-components": "0.8.6",
40
+ "@equinor/mad-insights": "0.1.1",
41
+ "@equinor/mad-navigation": "0.2.1"
40
42
  },
41
43
  "devDependencies": {
42
44
  "@babel/core": "^7.21.4",
@@ -45,7 +47,7 @@
45
47
  "@testing-library/react-native": "^12.3.0",
46
48
  "@types/showdown": "^2.0.0",
47
49
  "react-test-renderer": "18.1.0",
48
- "@equinor/eslint-config-mad": "0.3.0"
50
+ "@equinor/eslint-config-mad": "0.3.1"
49
51
  },
50
52
  "files": [
51
53
  "CODE_OF_CONDUCT.md",
@@ -1,56 +0,0 @@
1
- import {
2
- SelectLanguageScreen
3
- } from "./chunk-MPPFRLAL.js";
4
- import {
5
- ReleaseNotesScreen
6
- } from "./chunk-ANFSTFWV.js";
7
- import {
8
- WhatsNewScreen
9
- } from "./chunk-FOAO6U65.js";
10
- import {
11
- ServiceMessageProvider
12
- } from "./chunk-6UN2PRPB.js";
13
- import {
14
- AboutScreen
15
- } from "./chunk-SGPMP2PN.js";
16
- import {
17
- CreateIncidentScreen
18
- } from "./chunk-GCBWBANV.js";
19
- import {
20
- LoginScreen
21
- } from "./chunk-PEPYP4GH.js";
22
- import {
23
- AnnouncementsProvider
24
- } from "./chunk-GSOAYETS.js";
25
- import {
26
- __spreadProps,
27
- __spreadValues
28
- } from "./chunk-WEAGW6MQ.js";
29
-
30
- // src/utils/createMadCoreNavigator.tsx
31
- import React from "react";
32
- import { EnvironmentProvider } from "@equinor/mad-components";
33
- import { AppInsightsInitializer } from "@equinor/mad-insights";
34
- var createMadCoreNavigator = (Stack, config) => {
35
- function MadCoreNavigator(props) {
36
- return /* @__PURE__ */ React.createElement(AppInsightsInitializer, { config: config.applicationInsights }, /* @__PURE__ */ React.createElement(EnvironmentProvider, { environment: config.environment }, /* @__PURE__ */ React.createElement(ServiceMessageProvider, null, /* @__PURE__ */ React.createElement(AnnouncementsProvider, null, /* @__PURE__ */ React.createElement(Stack.Navigator, __spreadProps(__spreadValues({}, props), { initialRouteName: "Login" }), /* @__PURE__ */ React.createElement(
37
- Stack.Screen,
38
- {
39
- name: "Login",
40
- component: LoginScreen,
41
- options: { headerShown: false, customSubHeaderShown: true }
42
- }
43
- ), /* @__PURE__ */ React.createElement(Stack.Screen, { name: "ReleaseNotes", component: ReleaseNotesScreen }), /* @__PURE__ */ React.createElement(
44
- Stack.Screen,
45
- {
46
- name: "WhatsNew",
47
- component: WhatsNewScreen
48
- }
49
- ), config.about && /* @__PURE__ */ React.createElement(Stack.Screen, { name: "About", component: AboutScreen }), config.serviceNow && /* @__PURE__ */ React.createElement(Stack.Screen, { name: "Feedback", component: CreateIncidentScreen }), config.language.supportedLanguages.length > 1 && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Stack.Screen, { name: "SelectLanguage", component: SelectLanguageScreen }), /* @__PURE__ */ React.createElement(Stack.Screen, { name: "SelectLanguageOnboarding", component: SelectLanguageScreen, options: { headerBackVisible: false } })), props.children)))));
50
- }
51
- return MadCoreNavigator;
52
- };
53
-
54
- export {
55
- createMadCoreNavigator
56
- };
@@ -1,10 +0,0 @@
1
- // src/components/screens/CreateIncidentScreen.tsx
2
- import React from "react";
3
- import { Typography } from "@equinor/mad-components";
4
- var CreateIncidentScreen = () => {
5
- return /* @__PURE__ */ React.createElement(Typography, null, "Not implemented yet");
6
- };
7
-
8
- export {
9
- CreateIncidentScreen
10
- };
@@ -1,34 +0,0 @@
1
- // src/store/mad-config/mad-config.ts
2
- import { create } from "zustand";
3
- import { devtools } from "zustand/middleware";
4
- var useMadConfigStore = create()(
5
- devtools(
6
- (set) => ({
7
- config: null,
8
- setConfig: (config) => set(() => ({ config }))
9
- }),
10
- { name: "core/config" }
11
- )
12
- );
13
- var MAD_CONFIG_NOT_FOUND_ERROR = "Mad config has not been provided! Make sure you use 'createCoreStackNavigator' to provide your config";
14
- var useMadConfig = () => {
15
- const config = useMadConfigStore().config;
16
- if (!config)
17
- throw new Error(MAD_CONFIG_NOT_FOUND_ERROR);
18
- return config;
19
- };
20
- var getConfig = () => {
21
- const config = useMadConfigStore.getState().config;
22
- if (!config)
23
- throw new Error(MAD_CONFIG_NOT_FOUND_ERROR);
24
- return config;
25
- };
26
- var setConfig = (config) => {
27
- useMadConfigStore.getState().setConfig(config);
28
- };
29
-
30
- export {
31
- useMadConfig,
32
- getConfig,
33
- setConfig
34
- };
@@ -1,7 +0,0 @@
1
- import {
2
- CreateIncidentScreen
3
- } from "../../chunk-GCBWBANV.js";
4
- import "../../chunk-WEAGW6MQ.js";
5
- export {
6
- CreateIncidentScreen
7
- };
File without changes