@equinor/mad-core 0.0.4 → 0.1.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 (115) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/chunk-3XUVY5MJ.js +16 -0
  3. package/dist/chunk-4RNGXNYB.js +61 -0
  4. package/dist/chunk-5IIGFQQJ.js +44 -0
  5. package/dist/chunk-6GFARWDK.js +30 -0
  6. package/dist/chunk-6SBQOSWK.js +355 -0
  7. package/dist/chunk-AEGDSD6N.js +10 -0
  8. package/dist/{chunk-PEFOX6JA.js → chunk-AM5E5CYS.js} +7 -19
  9. package/dist/chunk-BIMOM43W.js +9 -0
  10. package/dist/chunk-DCUF7ZWX.js +15 -0
  11. package/dist/chunk-DQ6CWJSW.js +53 -0
  12. package/dist/{chunk-HOPDSUAE.js → chunk-DTXV5LS2.js} +5 -3
  13. package/dist/{chunk-E36MLVBD.js → chunk-DWAJZVKH.js} +1 -1
  14. package/dist/{chunk-FQWPBBPB.js → chunk-GSC3O7TW.js} +1 -1
  15. package/dist/chunk-HGT5ZUYL.js +25 -0
  16. package/dist/chunk-JPK5SCA5.js +19 -0
  17. package/dist/{chunk-KXAIAYE4.js → chunk-LSEPBTCQ.js} +17 -11
  18. package/dist/chunk-MDOJ2W2G.js +23 -0
  19. package/dist/chunk-N4V52CSH.js +43 -0
  20. package/dist/{chunk-TLJLKQRN.js → chunk-NLLLEXHT.js} +42 -41
  21. package/dist/{chunk-3LDWV3SJ.js → chunk-P636GRYJ.js} +18 -18
  22. package/dist/chunk-PBCPR4ZO.js +8 -0
  23. package/dist/{chunk-AGAXO3NW.js → chunk-QXK5OE27.js} +5 -1
  24. package/dist/chunk-T3WC3PE2.js +23 -0
  25. package/dist/{chunk-FIFUL4JE.js → chunk-V4QL2TIA.js} +20 -4
  26. package/dist/{chunk-FUGJZRIR.js → chunk-VXUERD3Z.js} +5 -5
  27. package/dist/{chunk-5QALP2TZ.js → chunk-XR6K2TU2.js} +31 -17
  28. package/dist/chunk-YY3XXUD6.js +23 -0
  29. package/dist/components/AnnouncementsProvider.js +2 -2
  30. package/dist/components/ErrorBoundary.d.ts +3 -0
  31. package/dist/components/ErrorBoundary.js +7 -0
  32. package/dist/components/NavigationContainer.d.ts +3 -0
  33. package/dist/components/NavigationContainer.js +7 -0
  34. package/dist/components/createCoreStackNavigator.d.ts +1 -1
  35. package/dist/components/createCoreStackNavigator.js +28 -16
  36. package/dist/components/index.d.ts +3 -0
  37. package/dist/components/index.js +46 -23
  38. package/dist/components/navigation/MadCoreSubHeader.d.ts +2 -0
  39. package/dist/components/navigation/MadCoreSubHeader.js +7 -0
  40. package/dist/components/navigation/index.d.ts +1 -0
  41. package/dist/components/navigation/index.js +11 -0
  42. package/dist/components/navigation/navigation-creators.d.ts +30 -0
  43. package/dist/components/navigation/navigation-creators.js +10 -0
  44. package/dist/components/screens/AboutScreen.js +1 -1
  45. package/dist/components/screens/CreateIncidentScreen.js +1 -1
  46. package/dist/components/screens/LoginScreen.js +10 -9
  47. package/dist/components/screens/language/SelectLanguageScreen.d.ts +2 -0
  48. package/dist/components/screens/language/SelectLanguageScreen.js +20 -0
  49. package/dist/components/screens/language/components/SelectLanguageCellGroup.d.ts +7 -0
  50. package/dist/components/screens/language/components/SelectLanguageCellGroup.js +12 -0
  51. package/dist/components/screens/release-notes/ChangeLog.js +2 -3
  52. package/dist/components/screens/release-notes/ReleaseNotesScreen.js +17 -2
  53. package/dist/components/screens/release-notes/WhatsNewScreen.js +14 -10
  54. package/dist/components/screens/release-notes/fetchReleaseNotes.d.ts +1 -0
  55. package/dist/components/screens/release-notes/fetchReleaseNotes.js +4 -2
  56. package/dist/components/screens/settings/Section.js +3 -3
  57. package/dist/components/screens/settings/SettingsScreen.js +11 -9
  58. package/dist/components/screens/settings/index.js +12 -10
  59. package/dist/components/screens/settings/renderCell.js +1 -1
  60. package/dist/components/screens/settings/useSignOut.js +3 -3
  61. package/dist/hooks/UseReleaseNotes.d.ts +6 -0
  62. package/dist/hooks/UseReleaseNotes.js +17 -0
  63. package/dist/hooks/index.js +7 -5
  64. package/dist/hooks/useAccountOrDemoAccount.js +1 -1
  65. package/dist/hooks/useCoreStackNavigation.d.ts +2 -1
  66. package/dist/hooks/useCoreStackNavigation.js +6 -4
  67. package/dist/hooks/useScreenTitleFromDictionary.d.ts +2 -0
  68. package/dist/hooks/useScreenTitleFromDictionary.js +13 -0
  69. package/dist/index.d.ts +1 -0
  70. package/dist/index.js +55 -25
  71. package/dist/language/types.d.ts +2 -0
  72. package/dist/language/types.js +0 -0
  73. package/dist/language/useDictionary.d.ts +2 -0
  74. package/dist/language/useDictionary.js +11 -0
  75. package/dist/store/demo-mode/demo-mode.js +1 -1
  76. package/dist/store/demo-mode/index.js +1 -1
  77. package/dist/store/language/index.d.ts +0 -1
  78. package/dist/store/language/index.js +6 -9
  79. package/dist/store/language/language.d.ts +3 -2
  80. package/dist/store/language/language.js +6 -5
  81. package/dist/store/mad-config/hooks.d.ts +9 -3
  82. package/dist/store/mad-config/hooks.js +5 -3
  83. package/dist/store/mad-config/index.js +5 -4
  84. package/dist/store/mad-config/mad-config.js +1 -1
  85. package/dist/store/release-notes/index.js +1 -1
  86. package/dist/store/release-notes/release-notes.js +1 -1
  87. package/dist/store/storage.js +1 -1
  88. package/dist/types.d.ts +19 -1
  89. package/dist/utils/createMadCoreNavigator.d.ts +2 -2
  90. package/dist/utils/createMadCoreNavigator.js +24 -15
  91. package/dist/utils/dateUtils.js +1 -1
  92. package/dist/utils/getFinalSettingsConfig.js +1 -1
  93. package/dist/utils/getNavigationRouteForLoginScreen.d.ts +2 -1
  94. package/dist/utils/getNavigationRouteForLoginScreen.js +8 -2
  95. package/dist/utils/getNavigationRouteForSelectLanguageScreen.d.ts +2 -0
  96. package/dist/utils/getNavigationRouteForSelectLanguageScreen.js +7 -0
  97. package/dist/utils/getNavigationRouteForWhatsNewScreen.d.ts +2 -0
  98. package/dist/utils/getNavigationRouteForWhatsNewScreen.js +12 -0
  99. package/dist/utils/getPremadeSettings.d.ts +2 -1
  100. package/dist/utils/getPremadeSettings.js +2 -2
  101. package/dist/utils/getRedirectUriFromAuthConfig.d.ts +2 -0
  102. package/dist/utils/getRedirectUriFromAuthConfig.js +7 -0
  103. package/dist/utils/madCommonUtils.js +1 -1
  104. package/package.json +13 -12
  105. package/dist/chunk-35THIGVH.js +0 -42
  106. package/dist/chunk-4VKFRNU7.js +0 -10
  107. package/dist/chunk-CXOQFGMM.js +0 -50
  108. package/dist/chunk-J53YLHKZ.js +0 -15
  109. package/dist/chunk-K2H37TUR.js +0 -7
  110. package/dist/chunk-XYNA7G2L.js +0 -62
  111. package/dist/store/language/supported-languages.d.ts +0 -11
  112. package/dist/store/language/supported-languages.js +0 -7
  113. /package/dist/{chunk-635YONGY.js → chunk-2GCLIPZP.js} +0 -0
  114. /package/dist/{chunk-USETLDR7.js → chunk-5LTGZQUP.js} +0 -0
  115. /package/dist/{chunk-UTXWRAEE.js → chunk-BZK6J33D.js} +0 -0
@@ -1,16 +1,18 @@
1
+ import {
2
+ createNativeStackNavigator
3
+ } from "./chunk-3XUVY5MJ.js";
1
4
  import {
2
5
  createMadCoreNavigator
3
- } from "./chunk-CXOQFGMM.js";
6
+ } from "./chunk-DQ6CWJSW.js";
4
7
  import {
5
8
  setConfig
6
9
  } from "./chunk-ZSTTHIEF.js";
7
10
  import {
8
11
  __spreadProps,
9
12
  __spreadValues
10
- } from "./chunk-UTXWRAEE.js";
13
+ } from "./chunk-BZK6J33D.js";
11
14
 
12
15
  // src/components/createCoreStackNavigator.tsx
13
- import { createNativeStackNavigator } from "@equinor/mad-navigation";
14
16
  var createCoreStackNavigator = (config) => {
15
17
  setConfig(config);
16
18
  const Stack = createNativeStackNavigator();
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-DOHQX5XC.js";
4
4
  import {
5
5
  useCoreStackNavigation
6
- } from "./chunk-K2H37TUR.js";
6
+ } from "./chunk-BIMOM43W.js";
7
7
 
8
8
  // src/components/screens/settings/Section.tsx
9
9
  import React from "react";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  __spreadProps,
3
3
  __spreadValues
4
- } from "./chunk-UTXWRAEE.js";
4
+ } from "./chunk-BZK6J33D.js";
5
5
 
6
6
  // src/components/AnnouncementsProvider.tsx
7
7
  import React from "react";
@@ -0,0 +1,25 @@
1
+ import {
2
+ __spreadProps,
3
+ __spreadValues
4
+ } from "./chunk-BZK6J33D.js";
5
+
6
+ // src/components/NavigationContainer.tsx
7
+ import React from "react";
8
+ import {
9
+ NavigationContainer as MadNavigationContainer
10
+ } from "@equinor/mad-navigation";
11
+ import { trackNavigation } from "@equinor/mad-insights";
12
+ var NavigationContainer = (props) => /* @__PURE__ */ React.createElement(
13
+ MadNavigationContainer,
14
+ __spreadProps(__spreadValues({}, props), {
15
+ onRouteChange: (current, prevRoute) => {
16
+ var _a;
17
+ trackNavigation(current);
18
+ (_a = props.onRouteChange) == null ? void 0 : _a.call(props, current, prevRoute);
19
+ }
20
+ })
21
+ );
22
+
23
+ export {
24
+ NavigationContainer
25
+ };
@@ -0,0 +1,19 @@
1
+ import {
2
+ useLanguage
3
+ } from "./chunk-6SBQOSWK.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,36 +1,42 @@
1
- import {
2
- SettingsSection
3
- } from "./chunk-E36MLVBD.js";
4
1
  import {
5
2
  useSignOut
6
- } from "./chunk-FUGJZRIR.js";
3
+ } from "./chunk-VXUERD3Z.js";
4
+ import {
5
+ SettingsSection
6
+ } from "./chunk-DWAJZVKH.js";
7
7
  import {
8
8
  getFinalSettingsConfig
9
9
  } from "./chunk-7SJM4NDH.js";
10
- import {
11
- useSettingsScreenPremadeConfig
12
- } from "./chunk-35THIGVH.js";
13
10
  import {
14
11
  useAccountOrDemoAccount
15
12
  } from "./chunk-EQYL7INQ.js";
13
+ import {
14
+ useScreenTitleFromDictionary
15
+ } from "./chunk-MDOJ2W2G.js";
16
+ import {
17
+ useDictionary,
18
+ useSettingsScreenPremadeConfig
19
+ } from "./chunk-6SBQOSWK.js";
16
20
  import {
17
21
  __spreadValues
18
- } from "./chunk-UTXWRAEE.js";
22
+ } from "./chunk-BZK6J33D.js";
19
23
 
20
24
  // src/components/screens/settings/SettingsScreen.tsx
21
25
  import React from "react";
22
26
  import { Button, Spacer, Typography } from "@equinor/mad-components";
23
27
  import { View, ScrollView } from "react-native";
24
28
  var SettingsScreen = ({ config = [], clean = false }) => {
29
+ useScreenTitleFromDictionary((dic) => dic.settings.title);
30
+ const dictionary = useDictionary();
25
31
  const signOut = useSignOut();
26
32
  const premadeConfig = useSettingsScreenPremadeConfig();
27
33
  const account = useAccountOrDemoAccount();
28
34
  const finalSettingsConfig = getFinalSettingsConfig(config, premadeConfig, clean);
29
- return /* @__PURE__ */ React.createElement(ScrollView, { contentInsetAdjustmentBehavior: "automatic" }, /* @__PURE__ */ React.createElement(Spacer, null), finalSettingsConfig.map((section, index) => /* @__PURE__ */ React.createElement(SettingsSection, __spreadValues({ key: index }, section))), /* @__PURE__ */ React.createElement(View, { style: { padding: 30 } }, /* @__PURE__ */ React.createElement(Typography, { bold: true }, "Logged in as"), /* @__PURE__ */ React.createElement(Typography, null, account == null ? void 0 : account.username)), /* @__PURE__ */ React.createElement(View, { style: { flexDirection: "row-reverse" } }, /* @__PURE__ */ React.createElement(
35
+ return /* @__PURE__ */ React.createElement(ScrollView, { contentInsetAdjustmentBehavior: "automatic" }, /* @__PURE__ */ React.createElement(Spacer, null), finalSettingsConfig.map((section, index) => /* @__PURE__ */ React.createElement(SettingsSection, __spreadValues({ key: index }, section))), /* @__PURE__ */ React.createElement(View, { style: { padding: 30 } }, /* @__PURE__ */ React.createElement(Typography, { bold: true }, dictionary.settings.loggedInAs), /* @__PURE__ */ React.createElement(Typography, null, account == null ? void 0 : account.username)), /* @__PURE__ */ React.createElement(View, { style: { flexDirection: "row-reverse" } }, /* @__PURE__ */ React.createElement(
30
36
  Button,
31
37
  {
32
- title: "Log out",
33
- onPress: signOut,
38
+ title: dictionary.settings.logOut,
39
+ onPress: () => void signOut(),
34
40
  style: {
35
41
  marginHorizontal: 30,
36
42
  width: 100
@@ -0,0 +1,23 @@
1
+ import {
2
+ useCoreStackNavigation
3
+ } from "./chunk-BIMOM43W.js";
4
+ import {
5
+ useDictionary
6
+ } from "./chunk-6SBQOSWK.js";
7
+
8
+ // src/hooks/useScreenTitleFromDictionary.ts
9
+ import { useLayoutEffect } from "react";
10
+ var useScreenTitleFromDictionary = (pickFn) => {
11
+ const dictionary = useDictionary();
12
+ useScreenTitle(pickFn(dictionary));
13
+ };
14
+ var useScreenTitle = (title) => {
15
+ const navigation = useCoreStackNavigation();
16
+ useLayoutEffect(() => {
17
+ navigation.setOptions({ title });
18
+ }, [title, navigation]);
19
+ };
20
+
21
+ export {
22
+ useScreenTitleFromDictionary
23
+ };
@@ -0,0 +1,43 @@
1
+ import {
2
+ SelectLanguageCellGroup
3
+ } from "./chunk-JPK5SCA5.js";
4
+ import {
5
+ getNavigationRouteForLanguageSelectScreen
6
+ } from "./chunk-AEGDSD6N.js";
7
+ import {
8
+ useScreenTitleFromDictionary
9
+ } from "./chunk-MDOJ2W2G.js";
10
+ import {
11
+ useCoreStackNavigation,
12
+ useCoreStackRoute
13
+ } from "./chunk-BIMOM43W.js";
14
+ import {
15
+ useDictionary,
16
+ useLanguage
17
+ } from "./chunk-6SBQOSWK.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,57 +1,50 @@
1
- import {
2
- fetchReleaseNotes
3
- } from "./chunk-FIFUL4JE.js";
4
1
  import {
5
2
  ChangeLog
6
- } from "./chunk-PEFOX6JA.js";
3
+ } from "./chunk-AM5E5CYS.js";
7
4
  import {
8
5
  useReleaseNotesVersion
9
6
  } from "./chunk-5BVQKJQB.js";
10
7
  import {
11
- useAppVersion,
12
- useEnvironment,
13
- useServicePortalName
14
- } from "./chunk-35THIGVH.js";
8
+ getShortDate
9
+ } from "./chunk-OCWASWDK.js";
10
+ import {
11
+ useScreenTitleFromDictionary
12
+ } from "./chunk-MDOJ2W2G.js";
13
+ import {
14
+ useCoreStackNavigation
15
+ } from "./chunk-BIMOM43W.js";
16
+ import {
17
+ whats_new_exports
18
+ } from "./chunk-6GFARWDK.js";
19
+ import {
20
+ fetchReleaseNotes
21
+ } from "./chunk-V4QL2TIA.js";
15
22
  import {
16
23
  useDemoMode
17
24
  } from "./chunk-UZ6YMQV2.js";
18
25
  import {
19
- useCoreStackNavigation
20
- } from "./chunk-K2H37TUR.js";
26
+ useAppVersion,
27
+ useEnvironment,
28
+ useServicePortalName
29
+ } from "./chunk-6SBQOSWK.js";
21
30
  import {
22
- __export
23
- } from "./chunk-UTXWRAEE.js";
31
+ __spreadProps,
32
+ __spreadValues
33
+ } from "./chunk-BZK6J33D.js";
24
34
 
25
35
  // src/components/screens/release-notes/WhatsNewScreen.tsx
26
36
  import React, { useEffect, useState } from "react";
27
-
28
- // src/static/mock-data/whats-new.json
29
- var whats_new_exports = {};
30
- __export(whats_new_exports, {
31
- app: () => app,
32
- default: () => whats_new_default,
33
- modified: () => modified,
34
- releaseDate: () => releaseDate,
35
- releaseNote: () => releaseNote,
36
- version: () => version
37
- });
38
- var app = "App name";
39
- var version = "1.1.0";
40
- var modified = "2022-12-09T07:04:55+0000";
41
- var releaseNote = "- This is a list\n- This is the second part of the list\n- Something\n - something else\n- This is a list\n- This is the second part of the list\n- Something\n - something else\n- This is a list\n- This is the second part of the list\n- Something\n - something else\n- This is a list\n- This is the second part of the list\n- Something\n - something else\n- This is a list\n- This is the second part of the list\n- Something\n - something else\n- This is a list\n- This is the second part of the list\n- Something\n - something else\n- This is a list\n- This is the second part of the list\n- Something\n - something else\n- This is a list\n- This is the second part of the list\n- Something\n - something else\n";
42
- var releaseDate = "2022-12-09T07:04:55+0000";
43
- var whats_new_default = {
44
- app,
45
- version,
46
- modified,
47
- releaseNote,
48
- releaseDate
49
- };
50
-
51
- // src/components/screens/release-notes/WhatsNewScreen.tsx
52
- import { Button, CircularProgress, EDSStyleSheet, useStyles } from "@equinor/mad-components";
53
- import { View } from "react-native";
37
+ import {
38
+ Button,
39
+ Cell,
40
+ CircularProgress,
41
+ EDSStyleSheet,
42
+ Typography,
43
+ useStyles
44
+ } from "@equinor/mad-components";
45
+ import { ScrollView, View } from "react-native";
54
46
  var WhatsNewScreen = () => {
47
+ useScreenTitleFromDictionary((dic) => dic.releaseNotes.whatsNew);
55
48
  const styles = useStyles(whatsNewStyles);
56
49
  const environment = useEnvironment();
57
50
  const releaseNotesVersion = useReleaseNotesVersion();
@@ -80,7 +73,7 @@ var WhatsNewScreen = () => {
80
73
  if (!release) {
81
74
  return /* @__PURE__ */ React.createElement(View, { style: styles.spinnerContainer }, /* @__PURE__ */ React.createElement(CircularProgress, null));
82
75
  }
83
- return /* @__PURE__ */ React.createElement(View, { style: styles.container }, /* @__PURE__ */ React.createElement(ChangeLog, { release }), /* @__PURE__ */ React.createElement(View, { style: styles.footer }, /* @__PURE__ */ React.createElement(
76
+ return /* @__PURE__ */ React.createElement(View, { style: styles.container }, /* @__PURE__ */ React.createElement(ScrollView, null, /* @__PURE__ */ React.createElement(Cell, { style: styles.scrollContainer }, /* @__PURE__ */ React.createElement(Typography, { style: styles.versionHeader }, release.version), /* @__PURE__ */ React.createElement(Typography, { style: styles.subtitleHeader }, getShortDate(new Date(release.releaseDate))), /* @__PURE__ */ React.createElement(ChangeLog, { release }))), /* @__PURE__ */ React.createElement(View, { style: styles.footer }, /* @__PURE__ */ React.createElement(
84
77
  Button,
85
78
  {
86
79
  title: "OK",
@@ -102,9 +95,17 @@ var whatsNewStyles = EDSStyleSheet.create((theme) => ({
102
95
  container: {
103
96
  display: "flex",
104
97
  paddingTop: theme.geometry.dimension.cell.minHeight,
105
- height: "100%",
106
98
  justifyContent: "space-between"
107
99
  },
100
+ scrollContainer: {
101
+ justifyContent: "center",
102
+ borderTopWidth: 0,
103
+ borderBottomWidth: 0
104
+ },
105
+ versionHeader: theme.typography.basic.h1,
106
+ subtitleHeader: __spreadProps(__spreadValues({}, theme.typography.basic.h4), {
107
+ marginVertical: theme.spacing.container.paddingVertical
108
+ }),
108
109
  footer: {
109
110
  alignItems: "flex-end",
110
111
  marginHorizontal: theme.spacing.container.paddingHorizontal,
@@ -1,35 +1,35 @@
1
1
  // src/utils/getPremadeSettings.ts
2
- var releaseNotes = {
2
+ var getReleaseNotesConfig = (dictionary) => ({
3
3
  name: "navigation",
4
4
  iconName: "format-list-bulleted",
5
- title: "Release notes",
5
+ title: dictionary.releaseNotes.releaseNotes,
6
6
  onPress: (navigation) => navigation.navigate("ReleaseNotes")
7
- };
8
- var about = {
7
+ });
8
+ var getAboutConfig = (dictionary) => ({
9
9
  name: "navigation",
10
10
  iconName: "information-outline",
11
- title: "About",
11
+ title: dictionary.settings.aboutApp,
12
12
  onPress: (navigation) => navigation.navigate("About")
13
- };
14
- var serviceNow = {
13
+ });
14
+ var getServiceNowConfig = (dictionary) => ({
15
15
  name: "navigation",
16
16
  iconName: "chat-alert-outline",
17
- title: "Feedback",
17
+ title: dictionary.settings.feedback,
18
18
  onPress: (navigation) => navigation.navigate("Feedback")
19
- };
20
- var language = {
19
+ });
20
+ var getLanguageConfig = (dictionary) => ({
21
21
  name: "navigation",
22
22
  iconName: "chat-processing-outline",
23
- title: "Language",
24
- onPress: (navigation) => navigation.navigate("NotFound")
25
- };
26
- var getPremadeSettings = (config) => {
27
- const premadeCommonNavigationItems = [releaseNotes];
23
+ title: dictionary.settings.language,
24
+ onPress: (navigation) => navigation.navigate("SelectLanguage")
25
+ });
26
+ var getPremadeSettings = (config, dictionary) => {
27
+ const premadeCommonNavigationItems = [getReleaseNotesConfig(dictionary)];
28
28
  if (config.about)
29
- premadeCommonNavigationItems.push(about);
29
+ premadeCommonNavigationItems.push(getAboutConfig(dictionary));
30
30
  if (config.serviceNow)
31
- premadeCommonNavigationItems.push(serviceNow);
32
- const premadeLanguageSection = config.language.supportedLanguages.length >= 2 ? { items: [language] } : void 0;
31
+ premadeCommonNavigationItems.push(getServiceNowConfig(dictionary));
32
+ const premadeLanguageSection = config.language.supportedLanguages.length >= 2 ? { items: [getLanguageConfig(dictionary)] } : void 0;
33
33
  const premadeCommonNavigationSection = {
34
34
  items: premadeCommonNavigationItems
35
35
  };
@@ -0,0 +1,8 @@
1
+ // src/components/navigation/MadCoreSubHeader.tsx
2
+ import React from "react";
3
+ import { EnvironmentBanner } from "@equinor/mad-components";
4
+ var MadCoreSubHeader = () => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(EnvironmentBanner, null));
5
+
6
+ export {
7
+ MadCoreSubHeader
8
+ };
@@ -1,3 +1,7 @@
1
+ import {
2
+ getNavigationRouteForWhatsNewScreen
3
+ } from "./chunk-T3WC3PE2.js";
4
+
1
5
  // src/utils/getNavigationRouteForLoginScreen.ts
2
6
  var getNavigationRouteForLoginScreen = ({
3
7
  appVersion,
@@ -8,7 +12,7 @@ var getNavigationRouteForLoginScreen = ({
8
12
  return "WhatsNew";
9
13
  if (!lastDisplayedReleaseNotesVersion || lastDisplayedReleaseNotesVersion < appVersion)
10
14
  return "WhatsNew";
11
- return "Root";
15
+ return getNavigationRouteForWhatsNewScreen();
12
16
  };
13
17
  var _getNavigationRouteForLoginScreenPure = {};
14
18
 
@@ -0,0 +1,23 @@
1
+ import {
2
+ getIsLanguageSelected
3
+ } from "./chunk-6SBQOSWK.js";
4
+ import {
5
+ getConfig
6
+ } from "./chunk-ZSTTHIEF.js";
7
+
8
+ // src/utils/getNavigationRouteForWhatsNewScreen.ts
9
+ var getNavigationRouteForWhatsNewScreen = () => {
10
+ const isLanguageSelected = getIsLanguageSelected();
11
+ const config = getConfig();
12
+ if (config.language.supportedLanguages.length < 2)
13
+ return "Root";
14
+ if (config.language.skipOnboarding)
15
+ return "Root";
16
+ if (isLanguageSelected)
17
+ return "Root";
18
+ return "SelectLanguageOnboarding";
19
+ };
20
+
21
+ export {
22
+ getNavigationRouteForWhatsNewScreen
23
+ };
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-RFYZGBU4.js";
5
5
  import {
6
6
  __async
7
- } from "./chunk-UTXWRAEE.js";
7
+ } from "./chunk-BZK6J33D.js";
8
8
 
9
9
  // src/components/screens/release-notes/fetchReleaseNotes.ts
10
10
  import { authenticateSilently } from "@equinor/mad-auth";
@@ -20,10 +20,26 @@ var fetchReleaseNotes = (env, servicePortalName, appVersion) => __async(void 0,
20
20
  Authorization: `Bearer ${authenticationResponse.accessToken}`
21
21
  })
22
22
  });
23
- const json = yield fetchResponse.json();
24
- return json;
23
+ const result = yield fetchResponse.json();
24
+ return result;
25
+ });
26
+ var fetchAllReleaseNotes = (env, servicePortalName) => __async(void 0, null, function* () {
27
+ const scopes = getMadCommonScopes(env);
28
+ const baseUrl = getMadCommonBaseUrl(env);
29
+ const authenticationResponse = yield authenticateSilently(scopes);
30
+ if (!authenticationResponse)
31
+ throw new Error("Unable to authenticate silently");
32
+ const fetchResponse = yield fetch(`${baseUrl}/ReleaseNote/${servicePortalName}/`, {
33
+ method: "GET",
34
+ headers: new Headers({
35
+ Authorization: `Bearer ${authenticationResponse.accessToken}`
36
+ })
37
+ });
38
+ const result = yield fetchResponse.json();
39
+ return result;
25
40
  });
26
41
 
27
42
  export {
28
- fetchReleaseNotes
43
+ fetchReleaseNotes,
44
+ fetchAllReleaseNotes
29
45
  };
@@ -1,12 +1,12 @@
1
+ import {
2
+ useCoreStackNavigation
3
+ } from "./chunk-BIMOM43W.js";
1
4
  import {
2
5
  useDemoMode
3
6
  } from "./chunk-UZ6YMQV2.js";
4
- import {
5
- useCoreStackNavigation
6
- } from "./chunk-K2H37TUR.js";
7
7
  import {
8
8
  __async
9
- } from "./chunk-UTXWRAEE.js";
9
+ } from "./chunk-BZK6J33D.js";
10
10
 
11
11
  // src/components/screens/settings/useSignOut.ts
12
12
  import { useCallback } from "react";
@@ -23,7 +23,7 @@ var useSignOut = () => {
23
23
  navigation.navigate("Login");
24
24
  } catch (_) {
25
25
  alert("Error", "Unable to sign out", [
26
- { text: "Try again", isPreferred: true, onPress: signOutFn },
26
+ { text: "Try again", isPreferred: true, onPress: () => void signOutFn() },
27
27
  { text: "Cancel", onPress: () => void 0 }
28
28
  ]);
29
29
  }
@@ -1,32 +1,36 @@
1
1
  import {
2
2
  useReleaseNotesVersion
3
3
  } from "./chunk-5BVQKJQB.js";
4
- import {
5
- useAppVersion,
6
- useAuthConfig,
7
- useLoginScreenConfig
8
- } from "./chunk-35THIGVH.js";
9
4
  import {
10
5
  getNavigationRouteForLoginScreen
11
- } from "./chunk-AGAXO3NW.js";
6
+ } from "./chunk-QXK5OE27.js";
7
+ import {
8
+ useCoreStackNavigation
9
+ } from "./chunk-BIMOM43W.js";
12
10
  import {
13
11
  enableDemoMode
14
12
  } from "./chunk-UZ6YMQV2.js";
15
13
  import {
16
- useCoreStackNavigation
17
- } from "./chunk-K2H37TUR.js";
14
+ useAppVersion,
15
+ useAuthConfig,
16
+ useDictionary,
17
+ useLoginScreenConfig
18
+ } from "./chunk-6SBQOSWK.js";
18
19
  import {
19
20
  __spreadProps,
20
21
  __spreadValues
21
- } from "./chunk-UTXWRAEE.js";
22
+ } from "./chunk-BZK6J33D.js";
22
23
 
23
24
  // src/components/screens/LoginScreen.tsx
24
25
  import { Button, EDSStyleSheet, Typography, useStyles } from "@equinor/mad-components";
25
26
  import React, { useState } from "react";
26
27
  import { Image, Pressable, View } from "react-native";
27
28
  import { LoginButton } from "@equinor/mad-auth";
29
+ import { metricKeys, metricStatus, track } from "@equinor/mad-insights";
28
30
  var LoginScreen = () => {
31
+ var _a;
29
32
  const styles = useStyles(theme);
33
+ const dictionary = useDictionary();
30
34
  const authConfig = useAuthConfig();
31
35
  const navigation = useCoreStackNavigation();
32
36
  const appVersion = useAppVersion();
@@ -37,21 +41,31 @@ var LoginScreen = () => {
37
41
  return /* @__PURE__ */ React.createElement(View, { style: styles.container }, /* @__PURE__ */ React.createElement(Typography, { variant: "h1" }, title), /* @__PURE__ */ React.createElement(Pressable, { onPress: () => setDemoPressCount((state) => state + 1) }, /* @__PURE__ */ React.createElement(Image, { source: logo, resizeMode: "contain", style: { height: 200, width: 200 } })), /* @__PURE__ */ React.createElement(View, { style: { gap: 8 } }, /* @__PURE__ */ React.createElement(
38
42
  LoginButton,
39
43
  __spreadProps(__spreadValues({}, authConfig), {
40
- onAuthenticationSuccessful: () => navigation.navigate(
41
- getNavigationRouteForLoginScreen({
42
- appVersion,
43
- lastDisplayedReleaseNotesVersion
44
- })
45
- ),
44
+ onAuthenticationSuccessful: (_, type) => {
45
+ if (type === "AUTOMATIC") {
46
+ void track(metricKeys.AUTHENTICATION_AUTOMATIC);
47
+ } else {
48
+ void track(metricKeys.AUTHENTICATION, metricStatus.SUCCESS);
49
+ }
50
+ navigation.navigate(
51
+ getNavigationRouteForLoginScreen({
52
+ appVersion,
53
+ lastDisplayedReleaseNotesVersion
54
+ })
55
+ );
56
+ },
57
+ onAuthenticationFailed: (error) => void track(metricKeys.AUTHENTICATION, metricStatus.FAILED, void 0, { error }),
58
+ title: dictionary.login.logIn,
46
59
  enableAutomaticAuthentication: true,
47
- scopes: authConfig.scopes || []
60
+ scopes: (_a = authConfig.scopes) != null ? _a : []
48
61
  })
49
62
  ), shouldDisplayDemoButton && /* @__PURE__ */ React.createElement(
50
63
  Button,
51
64
  {
52
- title: "Demo",
65
+ title: dictionary.login.demo,
53
66
  variant: "outlined",
54
67
  onPress: () => {
68
+ void track(metricKeys.AUTHENTICATION_DEMO);
55
69
  enableDemoMode();
56
70
  navigation.navigate(
57
71
  getNavigationRouteForLoginScreen({
@@ -0,0 +1,23 @@
1
+ import {
2
+ __spreadProps,
3
+ __spreadValues
4
+ } from "./chunk-BZK6J33D.js";
5
+
6
+ // src/components/ErrorBoundary.tsx
7
+ import React from "react";
8
+ import { ErrorBoundary as MadErrorBoundary } from "@equinor/mad-components";
9
+ import { trackCustom } from "@equinor/mad-insights";
10
+ var ErrorBoundary = (props) => /* @__PURE__ */ React.createElement(
11
+ MadErrorBoundary,
12
+ __spreadProps(__spreadValues({}, props), {
13
+ onError: (error, info) => {
14
+ var _a;
15
+ trackCustom(`${error.name} - ${error.message}`, { error, info });
16
+ (_a = props.onError) == null ? void 0 : _a.call(props, error, info);
17
+ }
18
+ })
19
+ );
20
+
21
+ export {
22
+ ErrorBoundary
23
+ };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  AnnouncementsProvider
3
- } from "../chunk-FQWPBBPB.js";
4
- import "../chunk-UTXWRAEE.js";
3
+ } from "../chunk-GSC3O7TW.js";
4
+ import "../chunk-BZK6J33D.js";
5
5
  export {
6
6
  AnnouncementsProvider
7
7
  };
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import { ErrorBoundaryProps } from "@equinor/mad-components";
3
+ export declare const ErrorBoundary: (props: ErrorBoundaryProps) => React.JSX.Element;
@@ -0,0 +1,7 @@
1
+ import {
2
+ ErrorBoundary
3
+ } from "../chunk-YY3XXUD6.js";
4
+ import "../chunk-BZK6J33D.js";
5
+ export {
6
+ ErrorBoundary
7
+ };
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import { NavigationContainerProps } from "@equinor/mad-navigation";
3
+ export declare const NavigationContainer: <T extends object>(props: NavigationContainerProps<T>) => React.JSX.Element;
@@ -0,0 +1,7 @@
1
+ import {
2
+ NavigationContainer
3
+ } from "../chunk-HGT5ZUYL.js";
4
+ import "../chunk-BZK6J33D.js";
5
+ export {
6
+ NavigationContainer
7
+ };