@equinor/mad-core 0.13.0 → 0.14.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 (87) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/{chunk-DJMBVNB6.js → chunk-4MZFJLIZ.js} +2 -2
  3. package/dist/{chunk-U5IJVQDO.js → chunk-5JFNRREO.js} +1 -1
  4. package/dist/chunk-5O4PAUNU.js +13 -0
  5. package/dist/{chunk-7HGZLLNX.js → chunk-6HDRI6TU.js} +1 -1
  6. package/dist/{chunk-6RPJUHBL.js → chunk-BFY7M5I2.js} +1 -1
  7. package/dist/{chunk-STKI44UB.js → chunk-COSM7WGR.js} +4 -4
  8. package/dist/{chunk-TWUGCMPQ.js → chunk-D4SVYUGC.js} +2 -2
  9. package/dist/{chunk-KEH6NBFE.js → chunk-G4GPSIHD.js} +1 -1
  10. package/dist/{chunk-HVZWOPNE.js → chunk-HPDK6AZ3.js} +4 -11
  11. package/dist/{chunk-EOM477VC.js → chunk-IPJ2CVM4.js} +1 -1
  12. package/dist/{chunk-ETY3HZNI.js → chunk-IXKJM7VZ.js} +1 -1
  13. package/dist/{chunk-WWF7QKDX.js → chunk-LEWQGDM7.js} +2 -7
  14. package/dist/{chunk-SVBUWW4H.js → chunk-N7YMTR7Q.js} +2 -2
  15. package/dist/{chunk-O2GHT2UV.js → chunk-NVAF6GOY.js} +2 -2
  16. package/dist/{chunk-CKOB6JKU.js → chunk-OAVRCDCP.js} +4 -4
  17. package/dist/{chunk-HUG4RNGS.js → chunk-PYTNVR7M.js} +3 -5
  18. package/dist/{chunk-7FO6SNUK.js → chunk-QGFTS65Y.js} +5 -10
  19. package/dist/{chunk-GEEFQMRN.js → chunk-RBFR3YMY.js} +5 -5
  20. package/dist/{chunk-PB3TI2RT.js → chunk-RPD2KUSY.js} +1 -1
  21. package/dist/{chunk-IHCNAGT7.js → chunk-SRQFW6D5.js} +1 -1
  22. package/dist/chunk-TJBYNCID.js +353 -0
  23. package/dist/{chunk-DIITQCRW.js → chunk-TO775HMH.js} +1 -1
  24. package/dist/{chunk-6LMMRQYQ.js → chunk-UOOFD7CI.js} +2 -2
  25. package/dist/{chunk-RJDKNHBE.js → chunk-XMQYRBUW.js} +1 -1
  26. package/dist/{chunk-4JWXJOGM.js → chunk-YTQLIYLS.js} +4 -4
  27. package/dist/{chunk-GNJZV3PL.js → chunk-ZAEB6ZS3.js} +5 -9
  28. package/dist/components/EnvironmentBanner.js +2 -2
  29. package/dist/components/EnvironmentProvider.js +2 -2
  30. package/dist/components/NavigationContainer.d.ts +2 -15
  31. package/dist/components/OfflineBanner.js +2 -2
  32. package/dist/components/createCoreStackNavigator.d.ts +18 -37
  33. package/dist/components/createCoreStackNavigator.js +37 -30
  34. package/dist/components/index.js +35 -38
  35. package/dist/components/navigation/MadCoreSubHeader.js +7 -7
  36. package/dist/components/navigation/index.js +8 -8
  37. package/dist/components/navigation/navigation-creators.d.ts +6 -7
  38. package/dist/components/navigation/navigation-creators.js +8 -8
  39. package/dist/components/screens/AboutScreen.js +2 -2
  40. package/dist/components/screens/LoginScreen.d.ts +2 -2
  41. package/dist/components/screens/LoginScreen.js +4 -4
  42. package/dist/components/screens/create-incident/CreateIncidentScreen.js +51 -5
  43. package/dist/components/screens/create-incident/createIncident.js +62 -1
  44. package/dist/components/screens/language/SelectLanguageScreen.js +5 -5
  45. package/dist/components/screens/language/components/SelectLanguageCellGroup.js +2 -2
  46. package/dist/components/screens/release-notes/ReleaseNotesScreen.js +5 -8
  47. package/dist/components/screens/release-notes/WhatsNewScreen.js +6 -6
  48. package/dist/components/screens/release-notes/fetchReleaseNotes.js +1 -11
  49. package/dist/components/screens/settings/Section.js +1 -9
  50. package/dist/components/screens/settings/SettingsScreen.js +6 -6
  51. package/dist/components/screens/settings/index.js +6 -6
  52. package/dist/components/screens/settings/useSignOut.d.ts +1 -1
  53. package/dist/components/screens/settings/useSignOut.js +4 -4
  54. package/dist/components/service-message/ServiceMessageBanner.js +4 -4
  55. package/dist/components/service-message/ServiceMessageProvider.js +3 -3
  56. package/dist/components/service-message/hooks/useFetchServiceMessage.d.ts +0 -1
  57. package/dist/components/service-message/hooks/useFetchServiceMessage.js +2 -2
  58. package/dist/hooks/UseReleaseNotes.js +3 -6
  59. package/dist/hooks/index.js +1 -9
  60. package/dist/hooks/useAccountOrDemoAccount.js +1 -9
  61. package/dist/hooks/useNavigateFromLanguageSelectScreen.js +2 -2
  62. package/dist/hooks/useNavigateFromLoginScreen.js +3 -3
  63. package/dist/hooks/useNavigateFromWhatsNewScreen.js +3 -3
  64. package/dist/hooks/useScreenTitleFromDictionary.js +2 -2
  65. package/dist/index.js +53 -75
  66. package/dist/language/useDictionary.js +1 -1
  67. package/dist/store/index.js +2 -2
  68. package/dist/store/language/index.js +1 -1
  69. package/dist/store/language/language.js +1 -1
  70. package/dist/store/mad-config/hooks.d.ts +3 -3
  71. package/dist/store/mad-config/hooks.js +1 -1
  72. package/dist/store/mad-config/index.js +1 -1
  73. package/dist/store/mad-config/mad-config.js +1 -1
  74. package/dist/utils/MadCoreProviders.d.ts +1 -1
  75. package/dist/utils/MadCoreProviders.js +5 -5
  76. package/dist/utils/createEnvironmentProxy.d.ts +2 -2
  77. package/dist/utils/createEnvironmentProxy.js +1 -1
  78. package/dist/utils/createMadCoreNavigator.d.ts +6 -6
  79. package/dist/utils/createMadCoreNavigator.js +41 -22
  80. package/dist/utils/initiateAuthenticationClient.js +1 -11
  81. package/package.json +10 -11
  82. package/dist/chunk-3YVGPC4G.js +0 -41
  83. package/dist/chunk-GE4JC2VP.js +0 -98
  84. package/dist/chunk-JYWP44JR.js +0 -0
  85. package/dist/chunk-NJ5W3O5I.js +0 -30
  86. package/dist/chunk-WDZF2C5R.js +0 -20
  87. package/dist/chunk-ZIV7DVBA.js +0 -158
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @equinor/mad-core
2
2
 
3
+ ## 0.14.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 7bf5e2b: React Native Architecture Upgrade -> Expo sdk upgraded to version 53
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [7bf5e2b]
12
+ - @equinor/mad-components@0.23.0
13
+ - @equinor/mad-navigation@0.6.0
14
+ - @equinor/mad-insights@0.2.0
15
+ - @equinor/mad-toast@0.3.0
16
+ - @equinor/mad-auth@0.3.0
17
+
3
18
  ## 0.13.0
4
19
 
5
20
  ### Minor Changes
@@ -3,14 +3,14 @@ import {
3
3
  } from "./chunk-4DXH3SPN.js";
4
4
  import {
5
5
  fetchAllReleaseNotes
6
- } from "./chunk-7FO6SNUK.js";
6
+ } from "./chunk-QGFTS65Y.js";
7
7
  import {
8
8
  useDemoMode
9
9
  } from "./chunk-UZ6YMQV2.js";
10
10
  import {
11
11
  useEnvironment,
12
12
  useServicePortalName
13
- } from "./chunk-GEEFQMRN.js";
13
+ } from "./chunk-RBFR3YMY.js";
14
14
 
15
15
  // src/hooks/UseReleaseNotes.tsx
16
16
  import { useEffect, useMemo, useState } from "react";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-BIMOM43W.js";
4
4
  import {
5
5
  useDictionary
6
- } from "./chunk-GEEFQMRN.js";
6
+ } from "./chunk-RBFR3YMY.js";
7
7
 
8
8
  // src/hooks/useScreenTitleFromDictionary.ts
9
9
  import { useLayoutEffect } from "react";
@@ -0,0 +1,13 @@
1
+ // src/utils/initiateAuthenticationClient.ts
2
+ import { ExpoAuthSession } from "@equinor/mad-auth";
3
+ var initiateAuthenticationClient = () => {
4
+ const discovery = ExpoAuthSession.getDiscovery();
5
+ const config = ExpoAuthSession.getConfig();
6
+ if (!(!discovery || !config)) {
7
+ void ExpoAuthSession.initiateAuthenticationClient(config, discovery);
8
+ }
9
+ };
10
+
11
+ export {
12
+ initiateAuthenticationClient
13
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useEnvironment
3
- } from "./chunk-GEEFQMRN.js";
3
+ } from "./chunk-RBFR3YMY.js";
4
4
 
5
5
  // src/components/EnvironmentProvider.tsx
6
6
  import { EnvironmentProvider as ProvideEnvironment } from "@equinor/mad-components";
@@ -17,7 +17,7 @@ import {
17
17
  useLanguage,
18
18
  useMadConfig,
19
19
  useNavigateToMainRoute
20
- } from "./chunk-GEEFQMRN.js";
20
+ } from "./chunk-RBFR3YMY.js";
21
21
 
22
22
  // src/hooks/useNavigateFromLoginScreen.ts
23
23
  var useNavigateFromLoginScreen = () => {
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  SelectLanguageCellGroup
3
- } from "./chunk-KEH6NBFE.js";
3
+ } from "./chunk-G4GPSIHD.js";
4
4
  import {
5
5
  useScreenTitleFromDictionary
6
- } from "./chunk-U5IJVQDO.js";
6
+ } from "./chunk-5JFNRREO.js";
7
7
  import {
8
8
  useNavigateFromLanguageSelectScreen
9
- } from "./chunk-IHCNAGT7.js";
9
+ } from "./chunk-SRQFW6D5.js";
10
10
  import {
11
11
  useDictionary,
12
12
  useLanguage
13
- } from "./chunk-GEEFQMRN.js";
13
+ } from "./chunk-RBFR3YMY.js";
14
14
 
15
15
  // src/components/screens/language/SelectLanguageScreen.tsx
16
16
  import React, { useState } from "react";
@@ -6,10 +6,10 @@ import {
6
6
  } from "./chunk-OCWASWDK.js";
7
7
  import {
8
8
  useScreenTitleFromDictionary
9
- } from "./chunk-U5IJVQDO.js";
9
+ } from "./chunk-5JFNRREO.js";
10
10
  import {
11
11
  useReleaseNotes
12
- } from "./chunk-DJMBVNB6.js";
12
+ } from "./chunk-4MZFJLIZ.js";
13
13
 
14
14
  // src/components/screens/release-notes/ReleaseNotesScreen.tsx
15
15
  import React from "react";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useLanguage
3
- } from "./chunk-GEEFQMRN.js";
3
+ } from "./chunk-RBFR3YMY.js";
4
4
 
5
5
  // src/components/screens/language/components/SelectLanguageCellGroup.tsx
6
6
  import React from "react";
@@ -4,27 +4,20 @@ import {
4
4
  import {
5
5
  useDemoMode
6
6
  } from "./chunk-UZ6YMQV2.js";
7
- import {
8
- getConfig
9
- } from "./chunk-GEEFQMRN.js";
10
7
  import {
11
8
  CoreRoutes
12
9
  } from "./chunk-UKAZW3CQ.js";
13
- import {
14
- __async
15
- } from "./chunk-CWMXXUWU.js";
16
10
 
17
11
  // src/components/screens/settings/useSignOut.ts
18
12
  import { useCallback } from "react";
19
- import { ExpoAuthSession, signOut } from "@equinor/mad-auth";
13
+ import { ExpoAuthSession } from "@equinor/mad-auth";
20
14
  import { alert } from "@equinor/mad-components";
21
15
  var useSignOut = () => {
22
16
  const navigation = useCoreStackNavigation();
23
17
  const demoMode = useDemoMode();
24
- const signOutFn = useCallback(() => __async(void 0, null, function* () {
25
- var _a;
18
+ const signOutFn = useCallback(() => {
26
19
  try {
27
- const result = ((_a = getConfig().experimental) == null ? void 0 : _a.useExpoAuthSession) ? ExpoAuthSession.signOut() : yield signOut();
20
+ const result = ExpoAuthSession.signOut();
28
21
  if (!demoMode.isEnabled && !result) throw new Error("Unable to sign out");
29
22
  demoMode.disableDemoMode();
30
23
  navigation.navigate(CoreRoutes.LOGIN);
@@ -34,7 +27,7 @@ var useSignOut = () => {
34
27
  { text: "Cancel", onPress: () => void 0 }
35
28
  ]);
36
29
  }
37
- }), [navigation, demoMode]);
30
+ }, [navigation, demoMode]);
38
31
  return signOutFn;
39
32
  };
40
33
 
@@ -8,7 +8,7 @@ import {
8
8
  useLanguage,
9
9
  useMadConfig,
10
10
  useNavigateToMainRoute
11
- } from "./chunk-GEEFQMRN.js";
11
+ } from "./chunk-RBFR3YMY.js";
12
12
 
13
13
  // src/hooks/useNavigateFromWhatsNewScreen.ts
14
14
  var useNavigateFromWhatsNewScreen = () => {
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-SHKOH7MA.js";
13
13
  import {
14
14
  useServiceMessageState
15
- } from "./chunk-DIITQCRW.js";
15
+ } from "./chunk-TO775HMH.js";
16
16
  import {
17
17
  __spreadProps,
18
18
  __spreadValues
@@ -1,23 +1,18 @@
1
1
  import {
2
2
  useDemoMode
3
3
  } from "./chunk-UZ6YMQV2.js";
4
- import {
5
- getConfig
6
- } from "./chunk-GEEFQMRN.js";
7
4
 
8
5
  // src/hooks/useAccountOrDemoAccount.ts
9
- import { ExpoAuthSession, useAccount } from "@equinor/mad-auth";
6
+ import { ExpoAuthSession } from "@equinor/mad-auth";
10
7
  var MAD_DEMO_USER = {
11
8
  name: "Demo user",
12
9
  username: "demo.user@example.com",
13
10
  identifier: "-1"
14
11
  };
15
12
  var useAccountOrDemoAccount = () => {
16
- var _a;
17
13
  const demoMode = useDemoMode();
18
- const msalAccount = useAccount();
19
14
  const expoAccount = ExpoAuthSession.useAccount();
20
- const account = ((_a = getConfig().experimental) == null ? void 0 : _a.useExpoAuthSession) ? expoAccount : msalAccount;
15
+ const account = expoAccount;
21
16
  if (demoMode.isEnabled) return MAD_DEMO_USER;
22
17
  return account;
23
18
  };
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-ZB37EIZB.js";
4
4
  import {
5
5
  getConfig
6
- } from "./chunk-GEEFQMRN.js";
6
+ } from "./chunk-RBFR3YMY.js";
7
7
 
8
8
  // src/components/service-message/hooks/useFetchServiceMessage.ts
9
9
  import { useEffect, useRef, useState } from "react";
@@ -13,7 +13,7 @@ var useFetchServiceMessage = () => {
13
13
  const [expansionEnabled, setExpansionEnabled] = useState(false);
14
14
  const [isExpanded, setIsExpanded] = useState(false);
15
15
  const [isError, setIsError] = useState(false);
16
- const lastInterval = useRef();
16
+ const lastInterval = useRef(void 0);
17
17
  useEffect(() => {
18
18
  function fetchServiceMessage() {
19
19
  const { currentEnvironment, servicePortalName } = getConfig();
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  ServiceMessageBanner
3
- } from "./chunk-ETY3HZNI.js";
3
+ } from "./chunk-IXKJM7VZ.js";
4
4
  import {
5
5
  EnvironmentBanner
6
- } from "./chunk-PB3TI2RT.js";
6
+ } from "./chunk-RPD2KUSY.js";
7
7
  import {
8
8
  OfflineBanner
9
9
  } from "./chunk-SQL63BYO.js";
@@ -9,16 +9,16 @@ import {
9
9
  } from "./chunk-5BVQKJQB.js";
10
10
  import {
11
11
  useNavigateFromWhatsNewScreen
12
- } from "./chunk-EOM477VC.js";
12
+ } from "./chunk-IPJ2CVM4.js";
13
13
  import {
14
14
  useScreenTitleFromDictionary
15
- } from "./chunk-U5IJVQDO.js";
15
+ } from "./chunk-5JFNRREO.js";
16
16
  import {
17
17
  whats_new_exports
18
18
  } from "./chunk-4DXH3SPN.js";
19
19
  import {
20
20
  fetchReleaseNotes
21
- } from "./chunk-7FO6SNUK.js";
21
+ } from "./chunk-QGFTS65Y.js";
22
22
  import {
23
23
  useDemoMode
24
24
  } from "./chunk-UZ6YMQV2.js";
@@ -26,7 +26,7 @@ import {
26
26
  useAppVersion,
27
27
  useEnvironment,
28
28
  useServicePortalName
29
- } from "./chunk-GEEFQMRN.js";
29
+ } from "./chunk-RBFR3YMY.js";
30
30
  import {
31
31
  __spreadProps,
32
32
  __spreadValues
@@ -7,9 +7,8 @@ import {
7
7
  import {
8
8
  useAbout,
9
9
  useAppVersion,
10
- useEnvironment,
11
- useExperimentalFeatures
12
- } from "./chunk-GEEFQMRN.js";
10
+ useEnvironment
11
+ } from "./chunk-RBFR3YMY.js";
13
12
 
14
13
  // src/components/screens/AboutScreen.tsx
15
14
  import React from "react";
@@ -23,8 +22,7 @@ var AboutScreen = () => {
23
22
  const appVersion = useAppVersion();
24
23
  const about = useAbout();
25
24
  const coreNavigatorType = useCoreNavigatorType();
26
- const experimentalFeatures = useExperimentalFeatures();
27
- const authenticationMethod = (experimentalFeatures == null ? void 0 : experimentalFeatures.useExpoAuthSession) ? "Expo" : "MSAL";
25
+ const authenticationMethod = "Expo";
28
26
  const endpoints = Array.from(
29
27
  new Set([getMadCommonBaseUrl(environment)].concat((_a = about == null ? void 0 : about.endpoints) != null ? _a : []))
30
28
  );
@@ -2,20 +2,16 @@ import {
2
2
  getMadCommonBaseUrl,
3
3
  getMadCommonScopes
4
4
  } from "./chunk-ZB37EIZB.js";
5
- import {
6
- getConfig
7
- } from "./chunk-GEEFQMRN.js";
8
5
  import {
9
6
  __async
10
7
  } from "./chunk-CWMXXUWU.js";
11
8
 
12
9
  // src/components/screens/release-notes/fetchReleaseNotes.ts
13
- import { authenticateSilently, ExpoAuthSession } from "@equinor/mad-auth";
14
- var fetchReleaseNotes = (env, servicePortalName, appVersion) => __async(void 0, null, function* () {
15
- var _a;
10
+ import { ExpoAuthSession } from "@equinor/mad-auth";
11
+ var fetchReleaseNotes = (env, servicePortalName, appVersion) => __async(null, null, function* () {
16
12
  const scopes = getMadCommonScopes(env);
17
13
  const baseUrl = getMadCommonBaseUrl(env);
18
- const authenticationResponse = ((_a = getConfig().experimental) == null ? void 0 : _a.useExpoAuthSession) ? yield ExpoAuthSession.authenticateSilently(scopes) : yield authenticateSilently(scopes);
14
+ const authenticationResponse = yield ExpoAuthSession.authenticateSilently(scopes);
19
15
  if (!authenticationResponse) throw new Error("Unable to authenticate silently");
20
16
  const fetchResponse = yield fetch(`${baseUrl}/ReleaseNote/${servicePortalName}/${appVersion}`, {
21
17
  method: "GET",
@@ -25,11 +21,10 @@ var fetchReleaseNotes = (env, servicePortalName, appVersion) => __async(void 0,
25
21
  });
26
22
  return yield fetchResponse.json();
27
23
  });
28
- var fetchAllReleaseNotes = (env, servicePortalName) => __async(void 0, null, function* () {
29
- var _a;
24
+ var fetchAllReleaseNotes = (env, servicePortalName) => __async(null, null, function* () {
30
25
  const scopes = getMadCommonScopes(env);
31
26
  const baseUrl = getMadCommonBaseUrl(env);
32
- const authenticationResponse = ((_a = getConfig().experimental) == null ? void 0 : _a.useExpoAuthSession) ? yield ExpoAuthSession.authenticateSilently(scopes) : yield authenticateSilently(scopes);
27
+ const authenticationResponse = yield ExpoAuthSession.authenticateSilently(scopes);
33
28
  if (!authenticationResponse) throw new Error("Unable to authenticate silently");
34
29
  const fetchResponse = yield fetch(`${baseUrl}/ReleaseNote/${servicePortalName}/`, {
35
30
  method: "GET",
@@ -436,6 +436,10 @@ export {
436
436
  getPureConfig,
437
437
  setConfig,
438
438
  setEnvironment,
439
+ useLanguage,
440
+ getLanguage,
441
+ setSelectedLanguage,
442
+ getIsLanguageSelected,
439
443
  useDictionary,
440
444
  useAuthConfig,
441
445
  useLoginScreenConfig,
@@ -446,9 +450,5 @@ export {
446
450
  useExperimentalFeatures,
447
451
  useServiceNow,
448
452
  useNavigateToMainRoute,
449
- useSettingsScreenPremadeConfig,
450
- useLanguage,
451
- getLanguage,
452
- setSelectedLanguage,
453
- getIsLanguageSelected
453
+ useSettingsScreenPremadeConfig
454
454
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useEnvironment
3
- } from "./chunk-GEEFQMRN.js";
3
+ } from "./chunk-RBFR3YMY.js";
4
4
 
5
5
  // src/components/EnvironmentBanner.tsx
6
6
  import React from "react";
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-BIMOM43W.js";
8
8
  import {
9
9
  useNavigateToMainRoute
10
- } from "./chunk-GEEFQMRN.js";
10
+ } from "./chunk-RBFR3YMY.js";
11
11
  import {
12
12
  CoreRoutes
13
13
  } from "./chunk-UKAZW3CQ.js";