@equinor/mad-core 0.3.11 → 0.4.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 (90) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +18 -17
  3. package/dist/chunk-3JJAYLEH.js +18 -0
  4. package/dist/{chunk-4IS74K75.js → chunk-4YAVVI22.js} +6 -3
  5. package/dist/{chunk-2JICQ6CO.js → chunk-77PTFBIE.js} +3 -3
  6. package/dist/{chunk-2BXHQTFH.js → chunk-7YRNVUJT.js} +1 -1
  7. package/dist/chunk-D26BI76L.js +27 -0
  8. package/dist/{chunk-P636GRYJ.js → chunk-E6ZYHW72.js} +8 -4
  9. package/dist/{chunk-STRJ5XYK.js → chunk-EIUO72M7.js} +2 -2
  10. package/dist/{chunk-UEHEZDOU.js → chunk-EKNEHZIQ.js} +33 -18
  11. package/dist/{chunk-KGULNU2L.js → chunk-FA4G2VZ5.js} +1 -1
  12. package/dist/{chunk-MCVFE22N.js → chunk-JBWTRJUX.js} +1 -1
  13. package/dist/chunk-JUWNN7VL.js +29 -0
  14. package/dist/{chunk-7IV7JAIC.js → chunk-MGYUDNB3.js} +1 -1
  15. package/dist/{chunk-FQKIJOMO.js → chunk-MUSZK2ZB.js} +1 -1
  16. package/dist/{chunk-6ZEGA36S.js → chunk-NPW57FJW.js} +1 -1
  17. package/dist/{chunk-ILRFXZQ6.js → chunk-OTQW4CT3.js} +4 -4
  18. package/dist/chunk-PLI2EEY4.js +33 -0
  19. package/dist/{chunk-ATHPQPDV.js → chunk-QLHWFCL7.js} +9 -27
  20. package/dist/{chunk-7PHV3YNH.js → chunk-QPOHC55P.js} +19 -3
  21. package/dist/{chunk-LFCWKD5B.js → chunk-R36BNAFA.js} +1 -1
  22. package/dist/{chunk-H4EDM663.js → chunk-SALPRFHN.js} +9 -10
  23. package/dist/chunk-UKAZW3CQ.js +16 -0
  24. package/dist/chunk-WR2XIM3H.js +49 -0
  25. package/dist/{chunk-CYXQE32M.js → chunk-XBW37LOB.js} +5 -5
  26. package/dist/{chunk-F4WSVD6D.js → chunk-Z5L7N2J2.js} +1 -1
  27. package/dist/chunk-ZHWM5E7I.js +46 -0
  28. package/dist/{chunk-C5H36AGQ.js → chunk-ZQTKZDN2.js} +1 -1
  29. package/dist/chunk-ZWS33QDE.js +14 -0
  30. package/dist/chunk-ZYGXHZCE.js +30 -0
  31. package/dist/components/EnvironmentProvider.js +4 -3
  32. package/dist/components/createCoreStackNavigator.d.ts +1 -1
  33. package/dist/components/createCoreStackNavigator.js +31 -27
  34. package/dist/components/index.js +34 -30
  35. package/dist/components/navigation/MadCoreSubHeader.js +8 -7
  36. package/dist/components/navigation/coreRoutes.d.ts +11 -0
  37. package/dist/components/navigation/coreRoutes.js +7 -0
  38. package/dist/components/navigation/index.js +9 -8
  39. package/dist/components/navigation/navigation-creators.js +9 -8
  40. package/dist/components/screens/AboutScreen.js +4 -3
  41. package/dist/components/screens/LoginScreen.js +10 -6
  42. package/dist/components/screens/create-incident/CreateIncidentScreen.js +5 -4
  43. package/dist/components/screens/language/SelectLanguageScreen.js +8 -10
  44. package/dist/components/screens/language/components/SelectLanguageCellGroup.d.ts +1 -1
  45. package/dist/components/screens/language/components/SelectLanguageCellGroup.js +4 -3
  46. package/dist/components/screens/release-notes/ReleaseNotesScreen.js +7 -6
  47. package/dist/components/screens/release-notes/WhatsNewScreen.js +11 -9
  48. package/dist/components/screens/settings/Section.js +1 -1
  49. package/dist/components/screens/settings/SettingsScreen.js +7 -6
  50. package/dist/components/screens/settings/index.js +8 -7
  51. package/dist/components/screens/settings/useSignOut.js +3 -2
  52. package/dist/components/service-message/ServiceMessageBanner.js +7 -6
  53. package/dist/components/service-message/ServiceMessageProvider.js +5 -4
  54. package/dist/components/service-message/hooks/useFetchServiceMessage.js +4 -3
  55. package/dist/hooks/UseReleaseNotes.js +4 -3
  56. package/dist/hooks/index.js +2 -2
  57. package/dist/hooks/useNavigateFromLanguageSelectScreen.d.ts +1 -0
  58. package/dist/hooks/useNavigateFromLanguageSelectScreen.js +14 -0
  59. package/dist/hooks/useNavigateFromLoginScreen.d.ts +1 -0
  60. package/dist/hooks/useNavigateFromLoginScreen.js +20 -0
  61. package/dist/hooks/useNavigateFromWhatsNewScreen.d.ts +1 -0
  62. package/dist/hooks/useNavigateFromWhatsNewScreen.js +17 -0
  63. package/dist/hooks/useScreenTitleFromDictionary.js +4 -3
  64. package/dist/index.js +37 -33
  65. package/dist/language/useDictionary.js +3 -2
  66. package/dist/store/index.js +3 -2
  67. package/dist/store/language/index.js +3 -2
  68. package/dist/store/language/language.d.ts +8 -4
  69. package/dist/store/language/language.js +3 -2
  70. package/dist/store/mad-config/hooks.d.ts +1 -0
  71. package/dist/store/mad-config/hooks.js +5 -2
  72. package/dist/store/mad-config/index.js +5 -2
  73. package/dist/store/mad-config/mad-config.js +3 -2
  74. package/dist/types.d.ts +3 -2
  75. package/dist/utils/createEnvironmentProxy.d.ts +1 -1
  76. package/dist/utils/createEnvironmentProxy.js +3 -2
  77. package/dist/utils/createMadCoreNavigator.js +26 -22
  78. package/dist/utils/getNavigationRouteForLoginScreen.d.ts +11 -5
  79. package/dist/utils/getNavigationRouteForLoginScreen.js +3 -8
  80. package/dist/utils/getNavigationRouteForSelectLanguageScreen.d.ts +4 -1
  81. package/dist/utils/getNavigationRouteForSelectLanguageScreen.js +4 -3
  82. package/dist/utils/getNavigationRouteForWhatsNewScreen.d.ts +5 -1
  83. package/dist/utils/getNavigationRouteForWhatsNewScreen.js +2 -5
  84. package/dist/utils/getPremadeSettings.js +2 -1
  85. package/package.json +2 -2
  86. package/dist/chunk-AEGDSD6N.js +0 -10
  87. package/dist/chunk-EFVAFRZ4.js +0 -43
  88. package/dist/chunk-GLFZI3WS.js +0 -19
  89. package/dist/chunk-IUZOOXOV.js +0 -21
  90. package/dist/chunk-WV6VNU2T.js +0 -22
@@ -1,39 +1,43 @@
1
1
  import {
2
2
  createMadCoreNavigator
3
- } from "../chunk-UEHEZDOU.js";
4
- import "../chunk-EFVAFRZ4.js";
5
- import "../chunk-GLFZI3WS.js";
6
- import "../chunk-STRJ5XYK.js";
7
- import "../chunk-H4EDM663.js";
8
- import "../chunk-CIMA2GQQ.js";
9
- import "../chunk-UVQ3Z5PG.js";
10
- import "../chunk-FQKIJOMO.js";
3
+ } from "../chunk-EKNEHZIQ.js";
4
+ import "../chunk-MUSZK2ZB.js";
11
5
  import "../chunk-5IS2WJYY.js";
12
6
  import "../chunk-CAOQCE6W.js";
13
- import "../chunk-ATHPQPDV.js";
14
- import "../chunk-5BVQKJQB.js";
15
- import "../chunk-7IV7JAIC.js";
16
- import "../chunk-KGULNU2L.js";
17
- import "../chunk-F4WSVD6D.js";
7
+ import "../chunk-WR2XIM3H.js";
8
+ import "../chunk-D26BI76L.js";
9
+ import "../chunk-EIUO72M7.js";
10
+ import "../chunk-SALPRFHN.js";
11
+ import "../chunk-CIMA2GQQ.js";
12
+ import "../chunk-Z5L7N2J2.js";
13
+ import "../chunk-QLHWFCL7.js";
14
+ import "../chunk-MGYUDNB3.js";
15
+ import "../chunk-FA4G2VZ5.js";
18
16
  import "../chunk-OCWASWDK.js";
19
- import "../chunk-WV6VNU2T.js";
20
- import "../chunk-IUZOOXOV.js";
21
- import "../chunk-AEGDSD6N.js";
22
- import "../chunk-2BXHQTFH.js";
17
+ import "../chunk-7YRNVUJT.js";
23
18
  import "../chunk-GHWLQBHQ.js";
24
19
  import "../chunk-KBEPONRV.js";
25
20
  import "../chunk-RFYZGBU4.js";
26
21
  import "../chunk-GUKC6UGZ.js";
27
22
  import "../chunk-EQYL7INQ.js";
28
- import "../chunk-6ZEGA36S.js";
29
- import "../chunk-BIMOM43W.js";
23
+ import "../chunk-JUWNN7VL.js";
24
+ import "../chunk-ZWS33QDE.js";
25
+ import "../chunk-ZHWM5E7I.js";
26
+ import "../chunk-UVQ3Z5PG.js";
27
+ import "../chunk-5BVQKJQB.js";
28
+ import "../chunk-ZYGXHZCE.js";
29
+ import "../chunk-PLI2EEY4.js";
30
+ import "../chunk-3JJAYLEH.js";
30
31
  import "../chunk-RVKZULYD.js";
31
32
  import "../chunk-CCVKLLIO.js";
32
33
  import "../chunk-UZ6YMQV2.js";
34
+ import "../chunk-NPW57FJW.js";
35
+ import "../chunk-BIMOM43W.js";
33
36
  import "../chunk-GSOAYETS.js";
34
- import "../chunk-MCVFE22N.js";
35
- import "../chunk-7PHV3YNH.js";
36
- import "../chunk-P636GRYJ.js";
37
+ import "../chunk-JBWTRJUX.js";
38
+ import "../chunk-QPOHC55P.js";
39
+ import "../chunk-E6ZYHW72.js";
40
+ import "../chunk-UKAZW3CQ.js";
37
41
  import "../chunk-VJD2P6SF.js";
38
42
  import "../chunk-2OMVVDBU.js";
39
43
  import "../chunk-WEAGW6MQ.js";
@@ -1,9 +1,15 @@
1
+ import { Language } from "../store/types";
1
2
  import { CoreStackParamListBase } from "../types";
2
- export type GetNavigationRouteForLoginScreenOptions = {
3
+ type GetNavigationRouteForLoginScreenOptions = {
3
4
  appVersion: string;
4
5
  lastDisplayedReleaseNotesVersion: string | null;
5
- isDemoMode?: boolean;
6
+ isDemoModeEnabled: boolean;
7
+ isLanguageSelected: boolean;
8
+ supportedLanguages: Language[];
9
+ skipOnboarding: boolean | undefined;
6
10
  };
7
- export type GetNavigationRouteForLoginScreenReturnType = keyof CoreStackParamListBase;
8
- export declare const getNavigationRouteForLoginScreen: ({ appVersion, lastDisplayedReleaseNotesVersion, isDemoMode, }: GetNavigationRouteForLoginScreenOptions) => GetNavigationRouteForLoginScreenReturnType;
9
- export declare const _getNavigationRouteForLoginScreenPure: {};
11
+ /**
12
+ * Returns the route Login Screen should navigate to. If it returns `null`, the app should navigate to the main route
13
+ */
14
+ export declare const getNavigationRouteForLoginScreen: ({ appVersion, lastDisplayedReleaseNotesVersion, isDemoModeEnabled, isLanguageSelected, supportedLanguages, skipOnboarding, }: GetNavigationRouteForLoginScreenOptions) => keyof CoreStackParamListBase | null;
15
+ export {};
@@ -1,14 +1,9 @@
1
1
  import {
2
- _getNavigationRouteForLoginScreenPure,
3
2
  getNavigationRouteForLoginScreen
4
- } from "../chunk-WV6VNU2T.js";
5
- import "../chunk-IUZOOXOV.js";
6
- import "../chunk-7PHV3YNH.js";
7
- import "../chunk-P636GRYJ.js";
8
- import "../chunk-VJD2P6SF.js";
9
- import "../chunk-2OMVVDBU.js";
3
+ } from "../chunk-ZYGXHZCE.js";
4
+ import "../chunk-3JJAYLEH.js";
5
+ import "../chunk-UKAZW3CQ.js";
10
6
  import "../chunk-WEAGW6MQ.js";
11
7
  export {
12
- _getNavigationRouteForLoginScreenPure,
13
8
  getNavigationRouteForLoginScreen
14
9
  };
@@ -1,2 +1,5 @@
1
1
  import { CoreStackParamListBase } from "../types";
2
- export declare const getNavigationRouteForLanguageSelectScreen: (isOnboarding: boolean) => keyof CoreStackParamListBase;
2
+ /**
3
+ * Returns the route Language Select Screen should navigate to. If it returns `null`, the app should navigate to the main route
4
+ */
5
+ export declare const getNavigationRouteForSelectLanguageScreen: (isOnboarding: boolean) => keyof CoreStackParamListBase | null;
@@ -1,7 +1,8 @@
1
1
  import {
2
- getNavigationRouteForLanguageSelectScreen
3
- } from "../chunk-AEGDSD6N.js";
2
+ getNavigationRouteForSelectLanguageScreen
3
+ } from "../chunk-ZWS33QDE.js";
4
+ import "../chunk-UKAZW3CQ.js";
4
5
  import "../chunk-WEAGW6MQ.js";
5
6
  export {
6
- getNavigationRouteForLanguageSelectScreen
7
+ getNavigationRouteForSelectLanguageScreen
7
8
  };
@@ -1,2 +1,6 @@
1
+ import { Language } from "../store/types";
1
2
  import { CoreStackParamListBase } from "../types";
2
- export declare const getNavigationRouteForWhatsNewScreen: () => keyof CoreStackParamListBase;
3
+ /**
4
+ * Returns the route Whats New Screen should navigate to. If it returns `null`, the app should navigate to the main route
5
+ */
6
+ export declare const getNavigationRouteForWhatsNewScreen: (isLanguageSelected: boolean, supportedLanguages: Language[], skipOnboarding: boolean | undefined) => keyof CoreStackParamListBase | null;
@@ -1,10 +1,7 @@
1
1
  import {
2
2
  getNavigationRouteForWhatsNewScreen
3
- } from "../chunk-IUZOOXOV.js";
4
- import "../chunk-7PHV3YNH.js";
5
- import "../chunk-P636GRYJ.js";
6
- import "../chunk-VJD2P6SF.js";
7
- import "../chunk-2OMVVDBU.js";
3
+ } from "../chunk-3JJAYLEH.js";
4
+ import "../chunk-UKAZW3CQ.js";
8
5
  import "../chunk-WEAGW6MQ.js";
9
6
  export {
10
7
  getNavigationRouteForWhatsNewScreen
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  getPremadeSettings
3
- } from "../chunk-P636GRYJ.js";
3
+ } from "../chunk-E6ZYHW72.js";
4
+ import "../chunk-UKAZW3CQ.js";
4
5
  import "../chunk-WEAGW6MQ.js";
5
6
  export {
6
7
  getPremadeSettings
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/mad-core",
3
- "version": "0.3.11",
3
+ "version": "0.4.0",
4
4
  "description": "Core library for the Mobile App Delivery team",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -36,8 +36,8 @@
36
36
  "showdown": "2.1.0",
37
37
  "zustand": "^4.4.1",
38
38
  "@equinor/mad-auth": "0.1.9",
39
- "@equinor/mad-components": "0.11.2",
40
39
  "@equinor/mad-insights": "0.1.1",
40
+ "@equinor/mad-components": "0.11.2",
41
41
  "@equinor/mad-navigation": "0.2.1"
42
42
  },
43
43
  "devDependencies": {
@@ -1,10 +0,0 @@
1
- // src/utils/getNavigationRouteForSelectLanguageScreen.ts
2
- var getNavigationRouteForLanguageSelectScreen = (isOnboarding) => {
3
- if (isOnboarding)
4
- return "Root";
5
- return "Settings";
6
- };
7
-
8
- export {
9
- getNavigationRouteForLanguageSelectScreen
10
- };
@@ -1,43 +0,0 @@
1
- import {
2
- SelectLanguageCellGroup
3
- } from "./chunk-GLFZI3WS.js";
4
- import {
5
- getNavigationRouteForLanguageSelectScreen
6
- } from "./chunk-AEGDSD6N.js";
7
- import {
8
- useScreenTitleFromDictionary
9
- } from "./chunk-6ZEGA36S.js";
10
- import {
11
- useCoreStackNavigation,
12
- useCoreStackRoute
13
- } from "./chunk-BIMOM43W.js";
14
- import {
15
- useDictionary,
16
- useLanguage
17
- } from "./chunk-7PHV3YNH.js";
18
-
19
- // src/components/screens/language/SelectLanguageScreen.tsx
20
- import React, { useState } from "react";
21
- import { ScrollView, View } from "react-native";
22
- import { Button, EDSStyleSheet, Spacer, useStyles } from "@equinor/mad-components";
23
- var SelectLanguageScreen = () => {
24
- useScreenTitleFromDictionary((dic) => dic.language.language);
25
- const styles = useStyles(themeStyles);
26
- const dictionary = useDictionary();
27
- const language = useLanguage();
28
- const navigation = useCoreStackNavigation();
29
- const route = useCoreStackRoute();
30
- const [selectedLanguageCodeDraft, setSelectedLanguageCodeDraft] = useState(language.language.code);
31
- const isOnboarding = route.name === "SelectLanguageOnboarding";
32
- const onPressSubmit = () => {
33
- language.setSelectedLanguage(selectedLanguageCodeDraft);
34
- const route2 = getNavigationRouteForLanguageSelectScreen(isOnboarding);
35
- navigation.navigate(route2);
36
- };
37
- return /* @__PURE__ */ React.createElement(ScrollView, { contentInsetAdjustmentBehavior: "automatic" }, /* @__PURE__ */ React.createElement(Spacer, null), /* @__PURE__ */ React.createElement(SelectLanguageCellGroup, { selectedLanguageCodeDraft, setSelectedLanguageCodeDraft }), /* @__PURE__ */ React.createElement(View, { style: styles.submitButtonContainer }, /* @__PURE__ */ React.createElement(Button, { title: dictionary.common.save, onPress: onPressSubmit })));
38
- };
39
- var themeStyles = EDSStyleSheet.create((theme) => ({ submitButtonContainer: { flexDirection: "column", alignItems: "flex-end", paddingVertical: theme.spacing.container.paddingVertical, paddingHorizontal: theme.spacing.container.paddingHorizontal } }));
40
-
41
- export {
42
- SelectLanguageScreen
43
- };
@@ -1,19 +0,0 @@
1
- import {
2
- useLanguage
3
- } from "./chunk-7PHV3YNH.js";
4
-
5
- // src/components/screens/language/components/SelectLanguageCellGroup.tsx
6
- import React from "react";
7
- import { Cell, Typography, Radio } from "@equinor/mad-components";
8
- var SelectLanguageCellGroup = ({ selectedLanguageCodeDraft, setSelectedLanguageCodeDraft }) => {
9
- const language = useLanguage();
10
- const supportedLanguages = language.getSupportedLanguages();
11
- const onPress = (code) => () => setSelectedLanguageCodeDraft(code);
12
- return /* @__PURE__ */ React.createElement(Cell.Group, null, supportedLanguages.map(
13
- (language2) => /* @__PURE__ */ React.createElement(Cell, { key: language2.code, rightAdornment: /* @__PURE__ */ React.createElement(Radio, { checked: language2.code === selectedLanguageCodeDraft }), onPress: onPress(language2.code) }, /* @__PURE__ */ React.createElement(Typography, null, language2.name))
14
- ));
15
- };
16
-
17
- export {
18
- SelectLanguageCellGroup
19
- };
@@ -1,21 +0,0 @@
1
- import {
2
- getConfig,
3
- getIsLanguageSelected
4
- } from "./chunk-7PHV3YNH.js";
5
-
6
- // src/utils/getNavigationRouteForWhatsNewScreen.ts
7
- var getNavigationRouteForWhatsNewScreen = () => {
8
- const isLanguageSelected = getIsLanguageSelected();
9
- const config = getConfig();
10
- if (config.language.supportedLanguages.length < 2)
11
- return "Root";
12
- if (config.language.skipOnboarding)
13
- return "Root";
14
- if (isLanguageSelected)
15
- return "Root";
16
- return "SelectLanguageOnboarding";
17
- };
18
-
19
- export {
20
- getNavigationRouteForWhatsNewScreen
21
- };
@@ -1,22 +0,0 @@
1
- import {
2
- getNavigationRouteForWhatsNewScreen
3
- } from "./chunk-IUZOOXOV.js";
4
-
5
- // src/utils/getNavigationRouteForLoginScreen.ts
6
- var getNavigationRouteForLoginScreen = ({
7
- appVersion,
8
- lastDisplayedReleaseNotesVersion,
9
- isDemoMode
10
- }) => {
11
- if (isDemoMode)
12
- return "WhatsNew";
13
- if (!lastDisplayedReleaseNotesVersion || lastDisplayedReleaseNotesVersion < appVersion)
14
- return "WhatsNew";
15
- return getNavigationRouteForWhatsNewScreen();
16
- };
17
- var _getNavigationRouteForLoginScreenPure = {};
18
-
19
- export {
20
- getNavigationRouteForLoginScreen,
21
- _getNavigationRouteForLoginScreenPure
22
- };