@equinor/mad-core 0.6.1 → 0.7.1

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 (78) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +33 -0
  3. package/dist/{chunk-VYI4KBQO.js → chunk-2MPM3JZD.js} +2 -2
  4. package/dist/{chunk-6WQG7OGA.js → chunk-2MSTFOYV.js} +1 -1
  5. package/dist/{chunk-AXEUL63W.js → chunk-2OQBD2JH.js} +4 -4
  6. package/dist/{chunk-GOYAFKM3.js → chunk-3BM4S2GG.js} +1 -1
  7. package/dist/{chunk-Y4F6JPUK.js → chunk-4RTYLHRV.js} +2 -2
  8. package/dist/{chunk-R4TBMU5D.js → chunk-5SOBPLNO.js} +1 -1
  9. package/dist/{chunk-LSA52JU5.js → chunk-C3VF3WPU.js} +4 -4
  10. package/dist/{chunk-W3LMT7N4.js → chunk-FW4GVJC7.js} +5 -1
  11. package/dist/{chunk-LTQGTI3K.js → chunk-GZ3KABVU.js} +1 -1
  12. package/dist/{chunk-EQYL7INQ.js → chunk-H5ZG24IA.js} +7 -2
  13. package/dist/{chunk-U3K3DQC5.js → chunk-J6NKU4OS.js} +5 -2
  14. package/dist/{chunk-TOCPQ2JB.js → chunk-JD2JILBG.js} +1 -1
  15. package/dist/{chunk-BVFOO2RO.js → chunk-JYYVDGBI.js} +2 -2
  16. package/dist/{chunk-7NTWLQ7J.js → chunk-K77ZZUJO.js} +1 -1
  17. package/dist/{chunk-RMME4MJU.js → chunk-LOV6KYOY.js} +1 -1
  18. package/dist/{chunk-5J3FTNVE.js → chunk-LSCWXRAR.js} +9 -9
  19. package/dist/{chunk-ZADB3VIP.js → chunk-LYU7NQBB.js} +4 -4
  20. package/dist/{chunk-KBEPONRV.js → chunk-MGETTUQA.js} +7 -5
  21. package/dist/{chunk-U6GW6ZHM.js → chunk-N443DTFE.js} +29 -27
  22. package/dist/{chunk-UD3DA4FR.js → chunk-QCUUIP5W.js} +6 -3
  23. package/dist/{chunk-CEFUB5I4.js → chunk-RIWMGRXW.js} +2 -2
  24. package/dist/{chunk-OXXEF5WL.js → chunk-SSSTWTHP.js} +1 -1
  25. package/dist/{chunk-2CVBYJXN.js → chunk-TIFYSLGL.js} +1 -1
  26. package/dist/{chunk-MSOJFY3S.js → chunk-TXG7T62C.js} +1 -1
  27. package/dist/{chunk-5TJVZFPL.js → chunk-VFLAXR3V.js} +4 -4
  28. package/dist/{chunk-ZTNMWI3H.js → chunk-XHIBLTJB.js} +10 -5
  29. package/dist/{chunk-N2HQZLB2.js → chunk-XMRWZHBV.js} +1 -1
  30. package/dist/{chunk-N4EOPAYE.js → chunk-YH46KAXB.js} +1 -1
  31. package/dist/components/EnvironmentBanner.js +2 -2
  32. package/dist/components/EnvironmentProvider.js +2 -2
  33. package/dist/components/NavigationContainer.d.ts +14 -2
  34. package/dist/components/NavigationContainer.js +1 -1
  35. package/dist/components/createCoreStackNavigator.d.ts +24 -24
  36. package/dist/components/createCoreStackNavigator.js +25 -25
  37. package/dist/components/index.js +28 -28
  38. package/dist/components/navigation/MadCoreSubHeader.js +6 -6
  39. package/dist/components/navigation/index.js +7 -7
  40. package/dist/components/navigation/navigation-creators.d.ts +12 -12
  41. package/dist/components/navigation/navigation-creators.js +7 -7
  42. package/dist/components/screens/AboutScreen.js +2 -2
  43. package/dist/components/screens/LoginScreen.js +3 -3
  44. package/dist/components/screens/create-incident/CreateIncidentScreen.js +4 -3
  45. package/dist/components/screens/language/SelectLanguageScreen.js +5 -5
  46. package/dist/components/screens/language/components/SelectLanguageCellGroup.js +2 -2
  47. package/dist/components/screens/release-notes/ReleaseNotesScreen.js +6 -5
  48. package/dist/components/screens/release-notes/WhatsNewScreen.js +5 -5
  49. package/dist/components/screens/release-notes/fetchReleaseNotes.js +9 -1
  50. package/dist/components/screens/settings/Section.js +7 -1
  51. package/dist/components/screens/settings/SettingsScreen.js +6 -5
  52. package/dist/components/screens/settings/index.js +6 -5
  53. package/dist/components/screens/settings/useSignOut.js +6 -1
  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.js +2 -2
  57. package/dist/hooks/UseReleaseNotes.js +4 -3
  58. package/dist/hooks/index.js +7 -1
  59. package/dist/hooks/useAccountOrDemoAccount.js +7 -1
  60. package/dist/hooks/useNavigateFromLanguageSelectScreen.js +2 -2
  61. package/dist/hooks/useNavigateFromLoginScreen.js +2 -2
  62. package/dist/hooks/useNavigateFromWhatsNewScreen.js +2 -2
  63. package/dist/hooks/useScreenTitleFromDictionary.js +2 -2
  64. package/dist/index.d.ts +22 -1
  65. package/dist/index.js +48 -37
  66. package/dist/language/useDictionary.js +1 -1
  67. package/dist/store/index.js +1 -1
  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 -0
  71. package/dist/store/mad-config/hooks.js +3 -1
  72. package/dist/store/mad-config/index.js +3 -1
  73. package/dist/store/mad-config/mad-config.js +1 -1
  74. package/dist/types.d.ts +6 -0
  75. package/dist/utils/createEnvironmentProxy.js +1 -1
  76. package/dist/utils/createMadCoreNavigator.js +19 -19
  77. package/dist/utils/initiateAuthenticationClient.js +2 -2
  78. package/package.json +4 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @equinor/mad-core
2
2
 
3
+ ## 0.7.1
4
+
5
+ ### Patch Changes
6
+
7
+ - d329bc9: Display authentication method in about screen
8
+
9
+ ## 0.7.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 14d79cb: Implemented Expo-Auth-Session as authentication alternative from mad-auth
14
+
15
+ ### Patch Changes
16
+
17
+ - 1fe26dc: Added msal-browser client implementation
18
+ - abb6d1a: Fixed issue with exporting mad-auth package
19
+ - c2404af: `NavigationContainer`: ref can now be attached and forwarded to the underlying
20
+ `NavigationContainer` from `react-navigation`
21
+ - Updated dependencies [1fe26dc]
22
+ - Updated dependencies [14d79cb]
23
+ - Updated dependencies [c2404af]
24
+ - @equinor/mad-auth@0.2.0
25
+ - @equinor/mad-navigation@0.3.1
26
+
3
27
  ## 0.6.1
4
28
 
5
29
  ### Patch Changes
package/README.md CHANGED
@@ -455,3 +455,36 @@ instead. If you want to replace components, you should look for equivalent compo
455
455
  application insights related items like `track`, `metricStatus`, `metricKeys`,
456
456
  `addTelemetryInitializer`, etc in `@equinor/mad-core`. If anything is missing, and you think it
457
457
  should be there, create an issue!
458
+
459
+ #### Step 10: using experimental features (optional)
460
+
461
+ Some functionalities that are implemented but not mature enough for widespread use will be made
462
+ available as an experimental option for developers to test out.
463
+
464
+ Currently the only experimental feature is switching from react-native-msal to expo-auth-session for
465
+ authentication handling.
466
+
467
+ To use this experimental feature, you have to install `expo-auth-session` and `expo-crypto` in your
468
+ project.
469
+
470
+ ```
471
+ npm i expo-auth-session expo-crypto
472
+ ```
473
+
474
+ ```
475
+ yarn add expo-auth-session expo-crypto
476
+ ```
477
+
478
+ Next, add this to your `mad.config.ts` file:
479
+
480
+ ```ts
481
+ experimental: {
482
+ useExpoAuthSession: true;
483
+ }
484
+ ```
485
+
486
+ The `mad-core` package should handle most of the authentication logic for you. If there are certain
487
+ usages in your app that use any ``mad-auth`` functions directly, you can import these functions directly
488
+ as normal, as long as you have the `useExpoAuthSession` flag in your `mad.config.ts` file. If you
489
+ want to learn more about this feature please check out the `README.md` in
490
+ `mad-auth/Expo-AuthSession`
@@ -3,14 +3,14 @@ import {
3
3
  } from "./chunk-GHWLQBHQ.js";
4
4
  import {
5
5
  fetchAllReleaseNotes
6
- } from "./chunk-KBEPONRV.js";
6
+ } from "./chunk-MGETTUQA.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-ZTNMWI3H.js";
13
+ } from "./chunk-XHIBLTJB.js";
14
14
 
15
15
  // src/hooks/UseReleaseNotes.tsx
16
16
  import { useEffect, useMemo, useState } from "react";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useEnvironment
3
- } from "./chunk-ZTNMWI3H.js";
3
+ } from "./chunk-XHIBLTJB.js";
4
4
 
5
5
  // src/components/EnvironmentBanner.tsx
6
6
  import React from "react";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useSignOut
3
- } from "./chunk-U3K3DQC5.js";
3
+ } from "./chunk-J6NKU4OS.js";
4
4
  import {
5
5
  SettingsSection
6
6
  } from "./chunk-YKLMUKP4.js";
@@ -9,14 +9,14 @@ import {
9
9
  } from "./chunk-7SJM4NDH.js";
10
10
  import {
11
11
  useAccountOrDemoAccount
12
- } from "./chunk-EQYL7INQ.js";
12
+ } from "./chunk-H5ZG24IA.js";
13
13
  import {
14
14
  useScreenTitleFromDictionary
15
- } from "./chunk-N2HQZLB2.js";
15
+ } from "./chunk-XMRWZHBV.js";
16
16
  import {
17
17
  useDictionary,
18
18
  useSettingsScreenPremadeConfig
19
- } from "./chunk-ZTNMWI3H.js";
19
+ } from "./chunk-XHIBLTJB.js";
20
20
  import {
21
21
  __spreadValues
22
22
  } from "./chunk-WEAGW6MQ.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getConfig
3
- } from "./chunk-ZTNMWI3H.js";
3
+ } from "./chunk-XHIBLTJB.js";
4
4
  import {
5
5
  getRedirectUriFromAuthConfig
6
6
  } from "./chunk-MODG2KVN.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  ServiceMessageBanner
3
- } from "./chunk-RMME4MJU.js";
3
+ } from "./chunk-LOV6KYOY.js";
4
4
  import {
5
5
  EnvironmentBanner
6
- } from "./chunk-6WQG7OGA.js";
6
+ } from "./chunk-2MSTFOYV.js";
7
7
 
8
8
  // src/components/navigation/MadCoreSubHeader.tsx
9
9
  import React from "react";
@@ -8,7 +8,7 @@ import {
8
8
  useLanguage,
9
9
  useMadConfig,
10
10
  useNavigateToMainRoute
11
- } from "./chunk-ZTNMWI3H.js";
11
+ } from "./chunk-XHIBLTJB.js";
12
12
 
13
13
  // src/hooks/useNavigateFromWhatsNewScreen.ts
14
14
  var useNavigateFromWhatsNewScreen = () => {
@@ -9,24 +9,24 @@ import {
9
9
  } from "./chunk-GHWLQBHQ.js";
10
10
  import {
11
11
  fetchReleaseNotes
12
- } from "./chunk-KBEPONRV.js";
12
+ } from "./chunk-MGETTUQA.js";
13
13
  import {
14
14
  useReleaseNotesVersion
15
15
  } from "./chunk-5BVQKJQB.js";
16
16
  import {
17
17
  useNavigateFromWhatsNewScreen
18
- } from "./chunk-R4TBMU5D.js";
18
+ } from "./chunk-5SOBPLNO.js";
19
19
  import {
20
20
  useDemoMode
21
21
  } from "./chunk-UZ6YMQV2.js";
22
22
  import {
23
23
  useScreenTitleFromDictionary
24
- } from "./chunk-N2HQZLB2.js";
24
+ } from "./chunk-XMRWZHBV.js";
25
25
  import {
26
26
  useAppVersion,
27
27
  useEnvironment,
28
28
  useServicePortalName
29
- } from "./chunk-ZTNMWI3H.js";
29
+ } from "./chunk-XHIBLTJB.js";
30
30
  import {
31
31
  __spreadProps,
32
32
  __spreadValues
@@ -9,9 +9,10 @@ import {
9
9
  NavigationContainer as MadNavigationContainer
10
10
  } from "@equinor/mad-navigation";
11
11
  import { trackNavigation } from "@equinor/mad-insights";
12
- var NavigationContainer = (props) => /* @__PURE__ */ React.createElement(
12
+ var NavigationContainerInner = (props, ref) => /* @__PURE__ */ React.createElement(
13
13
  MadNavigationContainer,
14
14
  __spreadProps(__spreadValues({}, props), {
15
+ ref,
15
16
  onRouteChange: (current, prevRoute) => {
16
17
  var _a;
17
18
  trackNavigation(current);
@@ -19,6 +20,9 @@ var NavigationContainer = (props) => /* @__PURE__ */ React.createElement(
19
20
  }
20
21
  })
21
22
  );
23
+ var NavigationContainer = React.forwardRef(
24
+ NavigationContainerInner
25
+ );
22
26
 
23
27
  export {
24
28
  NavigationContainer
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useFetchServiceMessage
3
- } from "./chunk-7NTWLQ7J.js";
3
+ } from "./chunk-K77ZZUJO.js";
4
4
 
5
5
  // src/components/service-message/ServiceMessageProvider.tsx
6
6
  import React, { useContext } from "react";
@@ -1,9 +1,12 @@
1
1
  import {
2
2
  useDemoMode
3
3
  } from "./chunk-UZ6YMQV2.js";
4
+ import {
5
+ getConfig
6
+ } from "./chunk-XHIBLTJB.js";
4
7
 
5
8
  // src/hooks/useAccountOrDemoAccount.ts
6
- import { useAccount } from "@equinor/mad-auth";
9
+ import { ExpoAuthSession, useAccount } from "@equinor/mad-auth";
7
10
  var MAD_DEMO_USER = {
8
11
  name: "Demo user",
9
12
  username: "demo.user@example.com",
@@ -11,7 +14,9 @@ var MAD_DEMO_USER = {
11
14
  };
12
15
  var useAccountOrDemoAccount = () => {
13
16
  const demoMode = useDemoMode();
14
- const account = useAccount();
17
+ const msalAccount = useAccount();
18
+ const expoAccount = ExpoAuthSession.useAccount();
19
+ const account = getConfig().experimental.useExpoAuthSession ? expoAccount : msalAccount;
15
20
  if (demoMode.isEnabled)
16
21
  return MAD_DEMO_USER;
17
22
  return account;
@@ -4,6 +4,9 @@ import {
4
4
  import {
5
5
  useCoreStackNavigation
6
6
  } from "./chunk-BIMOM43W.js";
7
+ import {
8
+ getConfig
9
+ } from "./chunk-XHIBLTJB.js";
7
10
  import {
8
11
  CoreRoutes
9
12
  } from "./chunk-UKAZW3CQ.js";
@@ -13,14 +16,14 @@ import {
13
16
 
14
17
  // src/components/screens/settings/useSignOut.ts
15
18
  import { useCallback } from "react";
16
- import { signOut } from "@equinor/mad-auth";
19
+ import { ExpoAuthSession, signOut } from "@equinor/mad-auth";
17
20
  import { alert } from "@equinor/mad-components";
18
21
  var useSignOut = () => {
19
22
  const navigation = useCoreStackNavigation();
20
23
  const demoMode = useDemoMode();
21
24
  const signOutFn = useCallback(() => __async(void 0, null, function* () {
22
25
  try {
23
- const result = yield signOut();
26
+ const result = getConfig() ? ExpoAuthSession.signOut() : yield signOut();
24
27
  if (!demoMode.isEnabled && !result)
25
28
  throw new Error("Unable to sign out");
26
29
  demoMode.disableDemoMode();
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  MadCoreSubHeader
3
- } from "./chunk-Y4F6JPUK.js";
3
+ } from "./chunk-4RTYLHRV.js";
4
4
 
5
5
  // src/components/navigation/navigation-creators.ts
6
6
  import {
@@ -6,11 +6,11 @@ import {
6
6
  } from "./chunk-CAOQCE6W.js";
7
7
  import {
8
8
  useAccountOrDemoAccount
9
- } from "./chunk-EQYL7INQ.js";
9
+ } from "./chunk-H5ZG24IA.js";
10
10
  import {
11
11
  useEnvironment,
12
12
  useServiceNow
13
- } from "./chunk-ZTNMWI3H.js";
13
+ } from "./chunk-XHIBLTJB.js";
14
14
 
15
15
  // src/components/screens/create-incident/CreateIncidentScreen.tsx
16
16
  import React, { useState } from "react";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-RFYZGBU4.js";
4
4
  import {
5
5
  getConfig
6
- } from "./chunk-ZTNMWI3H.js";
6
+ } from "./chunk-XHIBLTJB.js";
7
7
 
8
8
  // src/components/service-message/hooks/useFetchServiceMessage.ts
9
9
  import { useEffect, useRef, useState } from "react";
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-SHKOH7MA.js";
10
10
  import {
11
11
  useServiceMessageState
12
- } from "./chunk-LTQGTI3K.js";
12
+ } from "./chunk-GZ3KABVU.js";
13
13
  import {
14
14
  __spreadProps,
15
15
  __spreadValues
@@ -1,33 +1,33 @@
1
1
  import {
2
2
  ReleaseNotesScreen
3
- } from "./chunk-CEFUB5I4.js";
3
+ } from "./chunk-RIWMGRXW.js";
4
4
  import {
5
5
  WhatsNewScreen
6
- } from "./chunk-LSA52JU5.js";
6
+ } from "./chunk-C3VF3WPU.js";
7
7
  import {
8
8
  CreateIncidentScreen
9
- } from "./chunk-BVFOO2RO.js";
9
+ } from "./chunk-JYYVDGBI.js";
10
10
  import {
11
11
  SelectLanguageScreen
12
- } from "./chunk-ZADB3VIP.js";
12
+ } from "./chunk-LYU7NQBB.js";
13
13
  import {
14
14
  AboutScreen
15
- } from "./chunk-UD3DA4FR.js";
15
+ } from "./chunk-QCUUIP5W.js";
16
16
  import {
17
17
  LoginScreen
18
- } from "./chunk-U6GW6ZHM.js";
18
+ } from "./chunk-N443DTFE.js";
19
19
  import {
20
20
  ServiceMessageProvider
21
- } from "./chunk-LTQGTI3K.js";
21
+ } from "./chunk-GZ3KABVU.js";
22
22
  import {
23
23
  getDefaultScreenOptionsForLoginScreen
24
24
  } from "./chunk-RGJ4RWVB.js";
25
25
  import {
26
26
  EnvironmentProvider
27
- } from "./chunk-2CVBYJXN.js";
27
+ } from "./chunk-TIFYSLGL.js";
28
28
  import {
29
29
  useMadConfig
30
- } from "./chunk-ZTNMWI3H.js";
30
+ } from "./chunk-XHIBLTJB.js";
31
31
  import {
32
32
  CoreRoutes
33
33
  } from "./chunk-UKAZW3CQ.js";
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  SelectLanguageCellGroup
3
- } from "./chunk-OXXEF5WL.js";
3
+ } from "./chunk-SSSTWTHP.js";
4
4
  import {
5
5
  useNavigateFromLanguageSelectScreen
6
- } from "./chunk-N4EOPAYE.js";
6
+ } from "./chunk-YH46KAXB.js";
7
7
  import {
8
8
  useScreenTitleFromDictionary
9
- } from "./chunk-N2HQZLB2.js";
9
+ } from "./chunk-XMRWZHBV.js";
10
10
  import {
11
11
  useDictionary,
12
12
  useLanguage
13
- } from "./chunk-ZTNMWI3H.js";
13
+ } from "./chunk-XHIBLTJB.js";
14
14
 
15
15
  // src/components/screens/language/SelectLanguageScreen.tsx
16
16
  import React, { useState } from "react";
@@ -2,16 +2,19 @@ import {
2
2
  getMadCommonBaseUrl,
3
3
  getMadCommonScopes
4
4
  } from "./chunk-RFYZGBU4.js";
5
+ import {
6
+ getConfig
7
+ } from "./chunk-XHIBLTJB.js";
5
8
  import {
6
9
  __async
7
10
  } from "./chunk-WEAGW6MQ.js";
8
11
 
9
12
  // src/components/screens/release-notes/fetchReleaseNotes.ts
10
- import { authenticateSilently } from "@equinor/mad-auth";
13
+ import { authenticateSilently, ExpoAuthSession } from "@equinor/mad-auth";
11
14
  var fetchReleaseNotes = (env, servicePortalName, appVersion) => __async(void 0, null, function* () {
12
15
  const scopes = getMadCommonScopes(env);
13
16
  const baseUrl = getMadCommonBaseUrl(env);
14
- const authenticationResponse = yield authenticateSilently(scopes);
17
+ const authenticationResponse = getConfig().experimental.useExpoAuthSession ? yield ExpoAuthSession.authenticateSilently(scopes) : yield authenticateSilently(scopes);
15
18
  if (!authenticationResponse)
16
19
  throw new Error("Unable to authenticate silently");
17
20
  const fetchResponse = yield fetch(`${baseUrl}/ReleaseNote/${servicePortalName}/${appVersion}`, {
@@ -20,13 +23,12 @@ var fetchReleaseNotes = (env, servicePortalName, appVersion) => __async(void 0,
20
23
  Authorization: `Bearer ${authenticationResponse.accessToken}`
21
24
  })
22
25
  });
23
- const result = yield fetchResponse.json();
24
- return result;
26
+ return yield fetchResponse.json();
25
27
  });
26
28
  var fetchAllReleaseNotes = (env, servicePortalName) => __async(void 0, null, function* () {
27
29
  const scopes = getMadCommonScopes(env);
28
30
  const baseUrl = getMadCommonBaseUrl(env);
29
- const authenticationResponse = yield authenticateSilently(scopes);
31
+ const authenticationResponse = getConfig().experimental.useExpoAuthSession ? yield ExpoAuthSession.authenticateSilently(scopes) : yield authenticateSilently(scopes);
30
32
  if (!authenticationResponse)
31
33
  throw new Error("Unable to authenticate silently");
32
34
  const fetchResponse = yield fetch(`${baseUrl}/ReleaseNote/${servicePortalName}/`, {
@@ -1,11 +1,12 @@
1
1
  import {
2
2
  useNavigateFromLoginScreen
3
- } from "./chunk-MSOJFY3S.js";
3
+ } from "./chunk-TXG7T62C.js";
4
4
  import {
5
+ getConfig,
5
6
  useAuthConfig,
6
7
  useDictionary,
7
8
  useLoginScreenConfig
8
- } from "./chunk-ZTNMWI3H.js";
9
+ } from "./chunk-XHIBLTJB.js";
9
10
  import {
10
11
  __spreadProps,
11
12
  __spreadValues
@@ -15,7 +16,10 @@ import {
15
16
  import { Button, EDSProvider, EDSStyleSheet, useStyles } from "@equinor/mad-components";
16
17
  import React, { useState } from "react";
17
18
  import { Image, Platform, Pressable, View } from "react-native";
18
- import { LoginButton } from "@equinor/mad-auth";
19
+ import {
20
+ ExpoAuthSession,
21
+ LoginButton
22
+ } from "@equinor/mad-auth";
19
23
  import { metricKeys, metricStatus, setUsername, track } from "@equinor/mad-insights";
20
24
  var LoginScreen = ({
21
25
  onAuthenticationSuccessful,
@@ -30,6 +34,27 @@ var LoginScreen = ({
30
34
  const [demoPressCount, setDemoPressCount] = useState(0);
31
35
  const shouldDisplayDemoButton = demoPressCount >= 5;
32
36
  const resizeMode = Platform.OS === "web" ? "contain" : "cover";
37
+ const loginButtonProps = __spreadProps(__spreadValues({}, authConfig), {
38
+ onAuthenticationSuccessful: (result, type) => {
39
+ setUsername(result.account.username, result.account.identifier);
40
+ if (type === "AUTOMATIC") {
41
+ void track(metricKeys.AUTHENTICATION_AUTOMATIC);
42
+ } else {
43
+ void track(metricKeys.AUTHENTICATION, metricStatus.SUCCESS);
44
+ }
45
+ onAuthenticationSuccessful == null ? void 0 : onAuthenticationSuccessful(result, type);
46
+ navigate({ demoMode: false });
47
+ },
48
+ onAuthenticationFailed: (error) => {
49
+ void track(metricKeys.AUTHENTICATION, metricStatus.FAILED, void 0, {
50
+ error
51
+ });
52
+ onAuthenticationFailed == null ? void 0 : onAuthenticationFailed(error);
53
+ },
54
+ title: dictionary.login.logIn,
55
+ enableAutomaticAuthentication: true,
56
+ scopes: (_a = authConfig.scopes) != null ? _a : []
57
+ });
33
58
  return /* @__PURE__ */ React.createElement(EDSProvider, { colorScheme: "light", density: "tablet" }, /* @__PURE__ */ React.createElement(View, { style: styles.container }, /* @__PURE__ */ React.createElement(Image, { source: splash, resizeMode, style: styles.fill }), /* @__PURE__ */ React.createElement(View, { style: styles.secretHitboxContainer }, /* @__PURE__ */ React.createElement(
34
59
  Pressable,
35
60
  {
@@ -37,30 +62,7 @@ var LoginScreen = ({
37
62
  style: styles.fill,
38
63
  onPress: () => setDemoPressCount((count) => count + 1)
39
64
  }
40
- )), /* @__PURE__ */ React.createElement(View, { style: styles.buttonContainer }, /* @__PURE__ */ React.createElement(
41
- LoginButton,
42
- __spreadProps(__spreadValues({}, authConfig), {
43
- onAuthenticationSuccessful: (result, type) => {
44
- setUsername(result.account.username, result.account.identifier);
45
- if (type === "AUTOMATIC") {
46
- void track(metricKeys.AUTHENTICATION_AUTOMATIC);
47
- } else {
48
- void track(metricKeys.AUTHENTICATION, metricStatus.SUCCESS);
49
- }
50
- onAuthenticationSuccessful == null ? void 0 : onAuthenticationSuccessful(result, type);
51
- navigate({ demoMode: false });
52
- },
53
- onAuthenticationFailed: (error) => {
54
- void track(metricKeys.AUTHENTICATION, metricStatus.FAILED, void 0, {
55
- error
56
- });
57
- onAuthenticationFailed == null ? void 0 : onAuthenticationFailed(error);
58
- },
59
- title: dictionary.login.logIn,
60
- enableAutomaticAuthentication: true,
61
- scopes: (_a = authConfig.scopes) != null ? _a : []
62
- })
63
- ), shouldDisplayDemoButton && /* @__PURE__ */ React.createElement(
65
+ )), /* @__PURE__ */ React.createElement(View, { style: styles.buttonContainer }, getConfig().experimental.useExpoAuthSession ? /* @__PURE__ */ React.createElement(ExpoAuthSession.LoginButton, __spreadValues({}, loginButtonProps)) : /* @__PURE__ */ React.createElement(LoginButton, __spreadValues({}, loginButtonProps)), shouldDisplayDemoButton && /* @__PURE__ */ React.createElement(
64
66
  Button,
65
67
  {
66
68
  testID: "demo-button",
@@ -4,8 +4,9 @@ import {
4
4
  import {
5
5
  useAbout,
6
6
  useAppVersion,
7
- useEnvironment
8
- } from "./chunk-ZTNMWI3H.js";
7
+ useEnvironment,
8
+ useExperimentalFeatures
9
+ } from "./chunk-XHIBLTJB.js";
9
10
 
10
11
  // src/components/screens/AboutScreen.tsx
11
12
  import React from "react";
@@ -18,6 +19,8 @@ var AboutScreen = () => {
18
19
  const environmentName = environment.charAt(0).toUpperCase() + environment.slice(1);
19
20
  const appVersion = useAppVersion();
20
21
  const about = useAbout();
22
+ const experimentalFeatures = useExperimentalFeatures();
23
+ const authenticationMethod = experimentalFeatures.useExpoAuthSession ? "Expo" : "MSAL";
21
24
  const endpoints = [getMadCommonBaseUrl(environment)].concat((_a = about == null ? void 0 : about.endpoints) != null ? _a : []);
22
25
  return /* @__PURE__ */ React.createElement(
23
26
  ScrollView,
@@ -25,7 +28,7 @@ var AboutScreen = () => {
25
28
  contentInsetAdjustmentBehavior: "automatic",
26
29
  contentContainerStyle: styles.contentContainer
27
30
  },
28
- /* @__PURE__ */ React.createElement(Cell, null, /* @__PURE__ */ React.createElement(View, { style: styles.cellContainer }, /* @__PURE__ */ React.createElement(Typography, { variant: "h2" }, "Client"), /* @__PURE__ */ React.createElement(View, { style: styles.rowContainer }, /* @__PURE__ */ React.createElement(View, { style: styles.columnContainer }, /* @__PURE__ */ React.createElement(Typography, null, "Configuration"), /* @__PURE__ */ React.createElement(Typography, null, "BuildNr"), /* @__PURE__ */ React.createElement(Typography, null, "App version")), /* @__PURE__ */ React.createElement(View, { style: styles.columnContainer }, /* @__PURE__ */ React.createElement(Typography, null, environmentName), /* @__PURE__ */ React.createElement(Typography, null, about == null ? void 0 : about.buildNumber), /* @__PURE__ */ React.createElement(Typography, null, appVersion))))),
31
+ /* @__PURE__ */ React.createElement(Cell, null, /* @__PURE__ */ React.createElement(View, { style: styles.cellContainer }, /* @__PURE__ */ React.createElement(Typography, { variant: "h2" }, "Client"), /* @__PURE__ */ React.createElement(View, { style: styles.rowContainer }, /* @__PURE__ */ React.createElement(View, { style: styles.columnContainer }, /* @__PURE__ */ React.createElement(Typography, null, "Configuration"), /* @__PURE__ */ React.createElement(Typography, null, "BuildNr"), /* @__PURE__ */ React.createElement(Typography, null, "App version"), /* @__PURE__ */ React.createElement(Typography, null, "Authentication")), /* @__PURE__ */ React.createElement(View, { style: styles.columnContainer }, /* @__PURE__ */ React.createElement(Typography, null, environmentName), /* @__PURE__ */ React.createElement(Typography, null, about == null ? void 0 : about.buildNumber), /* @__PURE__ */ React.createElement(Typography, null, appVersion), /* @__PURE__ */ React.createElement(Typography, null, authenticationMethod))))),
29
32
  /* @__PURE__ */ React.createElement(Cell, null, /* @__PURE__ */ React.createElement(View, { style: styles.cellContainer }, /* @__PURE__ */ React.createElement(Typography, { variant: "h2" }, "Api"), /* @__PURE__ */ React.createElement(View, { style: styles.columnContainer }, /* @__PURE__ */ React.createElement(Typography, null, "Endpoints"), /* @__PURE__ */ React.createElement(View, null, endpoints.map((endpoint) => /* @__PURE__ */ React.createElement(Typography, { key: endpoint }, endpoint))))))
30
33
  );
31
34
  };
@@ -6,10 +6,10 @@ import {
6
6
  } from "./chunk-OCWASWDK.js";
7
7
  import {
8
8
  useReleaseNotes
9
- } from "./chunk-VYI4KBQO.js";
9
+ } from "./chunk-2MPM3JZD.js";
10
10
  import {
11
11
  useScreenTitleFromDictionary
12
- } from "./chunk-N2HQZLB2.js";
12
+ } from "./chunk-XMRWZHBV.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-ZTNMWI3H.js";
3
+ } from "./chunk-XHIBLTJB.js";
4
4
 
5
5
  // src/components/screens/language/components/SelectLanguageCellGroup.tsx
6
6
  import React from "react";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useEnvironment
3
- } from "./chunk-ZTNMWI3H.js";
3
+ } from "./chunk-XHIBLTJB.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-ZTNMWI3H.js";
20
+ } from "./chunk-XHIBLTJB.js";
21
21
 
22
22
  // src/hooks/useNavigateFromLoginScreen.ts
23
23
  var useNavigateFromLoginScreen = () => {
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  createNativeStackNavigator
3
- } from "./chunk-TOCPQ2JB.js";
3
+ } from "./chunk-JD2JILBG.js";
4
4
  import {
5
5
  initiateAuthenticationClient
6
- } from "./chunk-GOYAFKM3.js";
6
+ } from "./chunk-3BM4S2GG.js";
7
7
  import {
8
8
  createMadCoreNavigator
9
- } from "./chunk-5J3FTNVE.js";
9
+ } from "./chunk-LSCWXRAR.js";
10
10
  import {
11
11
  setConfig
12
- } from "./chunk-ZTNMWI3H.js";
12
+ } from "./chunk-XHIBLTJB.js";
13
13
  import {
14
14
  __spreadProps,
15
15
  __spreadValues
@@ -392,6 +392,10 @@ var useAbout = () => {
392
392
  const config = useMadConfig();
393
393
  return config.about;
394
394
  };
395
+ var useExperimentalFeatures = () => {
396
+ const config = useMadConfig();
397
+ return config.experimental;
398
+ };
395
399
  var useServiceNow = () => {
396
400
  const config = useMadConfig();
397
401
  return config.serviceNow;
@@ -438,10 +442,6 @@ export {
438
442
  getPureConfig,
439
443
  setConfig,
440
444
  setEnvironment,
441
- useLanguage,
442
- getLanguage,
443
- setSelectedLanguage,
444
- getIsLanguageSelected,
445
445
  useDictionary,
446
446
  useAuthConfig,
447
447
  useLoginScreenConfig,
@@ -449,7 +449,12 @@ export {
449
449
  useEnvironment,
450
450
  useServicePortalName,
451
451
  useAbout,
452
+ useExperimentalFeatures,
452
453
  useServiceNow,
453
454
  useNavigateToMainRoute,
454
- useSettingsScreenPremadeConfig
455
+ useSettingsScreenPremadeConfig,
456
+ useLanguage,
457
+ getLanguage,
458
+ setSelectedLanguage,
459
+ getIsLanguageSelected
455
460
  };
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-BIMOM43W.js";
4
4
  import {
5
5
  useDictionary
6
- } from "./chunk-ZTNMWI3H.js";
6
+ } from "./chunk-XHIBLTJB.js";
7
7
 
8
8
  // src/hooks/useScreenTitleFromDictionary.ts
9
9
  import { useLayoutEffect } from "react";
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-BIMOM43W.js";
8
8
  import {
9
9
  useNavigateToMainRoute
10
- } from "./chunk-ZTNMWI3H.js";
10
+ } from "./chunk-XHIBLTJB.js";
11
11
  import {
12
12
  CoreRoutes
13
13
  } from "./chunk-UKAZW3CQ.js";