@equinor/mad-core 0.12.2 → 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 +21 -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-ZAJCJP22.js → chunk-PYTNVR7M.js} +6 -6
  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-4ZX24N67.js +0 -41
  83. package/dist/chunk-JYWP44JR.js +0 -0
  84. package/dist/chunk-NJ5W3O5I.js +0 -30
  85. package/dist/chunk-S2WEOFU7.js +0 -98
  86. package/dist/chunk-WDZF2C5R.js +0 -20
  87. package/dist/chunk-ZIV7DVBA.js +0 -158
@@ -1,8 +1,8 @@
1
1
  import React from "react";
2
2
  import { createNativeStackNavigator, createStackNavigator } from "../components";
3
3
  import { CoreStackParamListBase } from "../types";
4
- export declare const createMadCoreNativeStackNavigator: <T extends CoreStackParamListBase>(Stack: import("@react-navigation/core").TypedNavigator<T, import("@react-navigation/routers").StackNavigationState<import("@react-navigation/routers").ParamListBase>, import("@equinor/mad-navigation").MadNativeStackNavigationOptions, import("@react-navigation/native-stack").NativeStackNavigationEventMap, ({ id, initialRouteName, children, screenListeners, screenOptions, customSubHeader, ...rest }: import("@equinor/mad-navigation").NativeStackNavigatorProps) => React.JSX.Element>) => (props: Omit<Omit<import("@react-navigation/routers").DefaultRouterOptions<string> & {
5
- id?: string | undefined;
4
+ export declare const createMadCoreNativeStackNavigator: <T extends CoreStackParamListBase>(Stack: ReturnType<typeof createNativeStackNavigator<T>>) => (props: Omit<Omit<import("@react-navigation/routers").DefaultRouterOptions<string> & {
5
+ id?: string;
6
6
  children: React.ReactNode;
7
7
  screenListeners?: Partial<{
8
8
  transitionStart: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/native-stack").NativeStackNavigationEventMap & import("@react-navigation/core").EventMapCore<import("@react-navigation/routers").StackNavigationState<import("@react-navigation/routers").ParamListBase>>, "transitionStart">;
@@ -29,7 +29,7 @@ export declare const createMadCoreNativeStackNavigator: <T extends CoreStackPara
29
29
  navigation: any;
30
30
  }) => import("@equinor/mad-navigation").MadNativeStackNavigationOptions) | undefined;
31
31
  } & import("@react-navigation/routers").StackRouterOptions & import("@equinor/mad-navigation/dist/_internal/types").MadCustomFactoryProps, "children" | "id" | "initialRouteName" | "screenListeners" | "screenOptions"> & import("@react-navigation/routers").DefaultRouterOptions<Extract<keyof T, string>> & {
32
- id?: string | undefined;
32
+ id?: string;
33
33
  children: React.ReactNode;
34
34
  screenListeners?: Partial<{
35
35
  transitionStart: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/native-stack").NativeStackNavigationEventMap & import("@react-navigation/core").EventMapCore<import("@react-navigation/routers").StackNavigationState<import("@react-navigation/routers").ParamListBase>>, "transitionStart">;
@@ -56,8 +56,8 @@ export declare const createMadCoreNativeStackNavigator: <T extends CoreStackPara
56
56
  navigation: any;
57
57
  }) => import("@equinor/mad-navigation").MadNativeStackNavigationOptions) | undefined;
58
58
  }, "initialRouteName">) => React.JSX.Element | null;
59
- export declare const createMadCoreStackNavigator: <T extends CoreStackParamListBase>(Stack: import("@react-navigation/core").TypedNavigator<T, import("@react-navigation/routers").StackNavigationState<import("@react-navigation/routers").ParamListBase>, import("@equinor/mad-navigation").MadStackNavigationOptions, import("@react-navigation/stack").StackNavigationEventMap, ({ id, initialRouteName, children, screenListeners, screenOptions, customSubHeader, ...rest }: import("@equinor/mad-navigation").StackNavigatorProps) => React.JSX.Element>) => (props: Omit<Omit<import("@react-navigation/routers").DefaultRouterOptions<string> & {
60
- id?: string | undefined;
59
+ export declare const createMadCoreStackNavigator: <T extends CoreStackParamListBase>(Stack: ReturnType<typeof createStackNavigator<T>>) => (props: Omit<Omit<import("@react-navigation/routers").DefaultRouterOptions<string> & {
60
+ id?: string;
61
61
  children: React.ReactNode;
62
62
  screenListeners?: Partial<{
63
63
  transitionStart: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap & import("@react-navigation/core").EventMapCore<import("@react-navigation/routers").StackNavigationState<import("@react-navigation/routers").ParamListBase>>, "transitionStart">;
@@ -88,7 +88,7 @@ export declare const createMadCoreStackNavigator: <T extends CoreStackParamListB
88
88
  navigation: any;
89
89
  }) => import("@equinor/mad-navigation/dist/_internal/types").MadNavigationOptions) | undefined;
90
90
  } & import("@react-navigation/routers").StackRouterOptions & import("@equinor/mad-navigation").StackNavigationConfig & import("@equinor/mad-navigation/dist/_internal/types").MadCustomFactoryProps, "children" | "id" | "initialRouteName" | "screenListeners" | "screenOptions"> & import("@react-navigation/routers").DefaultRouterOptions<Extract<keyof T, string>> & {
91
- id?: string | undefined;
91
+ id?: string;
92
92
  children: React.ReactNode;
93
93
  screenListeners?: Partial<{
94
94
  transitionStart: import("@react-navigation/core").EventListenerCallback<import("@react-navigation/stack").StackNavigationEventMap & import("@react-navigation/core").EventMapCore<import("@react-navigation/routers").StackNavigationState<import("@react-navigation/routers").ParamListBase>>, "transitionStart">;
@@ -1,46 +1,65 @@
1
1
  import {
2
2
  createMadCoreNativeStackNavigator,
3
3
  createMadCoreStackNavigator
4
- } from "../chunk-S2WEOFU7.js";
5
- import "../chunk-CKOB6JKU.js";
6
- import "../chunk-ZIV7DVBA.js";
4
+ } from "../chunk-TJBYNCID.js";
5
+ import "../chunk-OAVRCDCP.js";
6
+ import "../chunk-AK7PA4BE.js";
7
+ import "../chunk-YTQLIYLS.js";
8
+ import "../chunk-YKLMUKP4.js";
9
+ import "../chunk-3OKLIPZ5.js";
10
+ import "../chunk-5GBNULIT.js";
11
+ import "../chunk-HPDK6AZ3.js";
7
12
  import "../chunk-3WUJAVUO.js";
8
- import "../chunk-NJ5W3O5I.js";
9
- import "../chunk-STKI44UB.js";
10
- import "../chunk-KEH6NBFE.js";
11
- import "../chunk-TWUGCMPQ.js";
13
+ import "../chunk-COSM7WGR.js";
14
+ import "../chunk-G4GPSIHD.js";
15
+ import "../chunk-D4SVYUGC.js";
12
16
  import "../chunk-XLQYZR5C.js";
13
- import "../chunk-ZAJCJP22.js";
14
- import "../chunk-GNJZV3PL.js";
15
- import "../chunk-6LMMRQYQ.js";
16
- import "../chunk-DIITQCRW.js";
17
- import "../chunk-SVBUWW4H.js";
17
+ import "../chunk-2GCLIPZP.js";
18
+ import "../chunk-XMQYRBUW.js";
19
+ import "../chunk-NVAF6GOY.js";
20
+ import "../chunk-IXKJM7VZ.js";
21
+ import "../chunk-XJX4HQF2.js";
22
+ import "../chunk-YWPELSTX.js";
23
+ import "../chunk-BDKB5ELS.js";
24
+ import "../chunk-SHKOH7MA.js";
25
+ import "../chunk-5O4PAUNU.js";
26
+ import "../chunk-PYTNVR7M.js";
27
+ import "../chunk-ZAEB6ZS3.js";
28
+ import "../chunk-UOOFD7CI.js";
29
+ import "../chunk-TO775HMH.js";
30
+ import "../chunk-N7YMTR7Q.js";
18
31
  import "../chunk-OCWASWDK.js";
19
32
  import "../chunk-RGJ4RWVB.js";
20
- import "../chunk-6RPJUHBL.js";
33
+ import "../chunk-QLL6LKDN.js";
34
+ import "../chunk-BFY7M5I2.js";
21
35
  import "../chunk-UVQ3Z5PG.js";
22
36
  import "../chunk-5BVQKJQB.js";
23
37
  import "../chunk-A4OAMNA3.js";
24
- import "../chunk-EOM477VC.js";
38
+ import "../chunk-IPJ2CVM4.js";
25
39
  import "../chunk-WEUFP6WW.js";
26
- import "../chunk-U5IJVQDO.js";
27
- import "../chunk-DJMBVNB6.js";
40
+ import "../chunk-5JFNRREO.js";
41
+ import "../chunk-4MZFJLIZ.js";
28
42
  import "../chunk-4DXH3SPN.js";
29
- import "../chunk-7FO6SNUK.js";
43
+ import "../chunk-QGFTS65Y.js";
30
44
  import "../chunk-ZB37EIZB.js";
31
45
  import "../chunk-GUKC6UGZ.js";
32
- import "../chunk-WWF7QKDX.js";
33
- import "../chunk-IHCNAGT7.js";
46
+ import "../chunk-LEWQGDM7.js";
47
+ import "../chunk-SRQFW6D5.js";
34
48
  import "../chunk-TGYT7TUP.js";
35
49
  import "../chunk-BIMOM43W.js";
50
+ import "../chunk-6F4PWJZI.js";
36
51
  import "../chunk-PP74MP4O.js";
37
- import "../chunk-7HGZLLNX.js";
52
+ import "../chunk-RPD2KUSY.js";
53
+ import "../chunk-6HDRI6TU.js";
54
+ import "../chunk-LZVFDNET.js";
55
+ import "../chunk-XCK6ZFYO.js";
56
+ import "../chunk-SQL63BYO.js";
38
57
  import "../chunk-HZWBAKKL.js";
39
- import "../chunk-CCVKLLIO.js";
40
58
  import "../chunk-HI7H4ACL.js";
41
59
  import "../chunk-H73RAAWS.js";
60
+ import "../chunk-CCVKLLIO.js";
42
61
  import "../chunk-UZ6YMQV2.js";
43
- import "../chunk-GEEFQMRN.js";
62
+ import "../chunk-RBFR3YMY.js";
44
63
  import "../chunk-45SUJ4GS.js";
45
64
  import "../chunk-MODG2KVN.js";
46
65
  import "../chunk-UKAZW3CQ.js";
@@ -1,16 +1,6 @@
1
1
  import {
2
2
  initiateAuthenticationClient
3
- } from "../chunk-WDZF2C5R.js";
4
- import "../chunk-HZWBAKKL.js";
5
- import "../chunk-CCVKLLIO.js";
6
- import "../chunk-HI7H4ACL.js";
7
- import "../chunk-H73RAAWS.js";
8
- import "../chunk-UZ6YMQV2.js";
9
- import "../chunk-GEEFQMRN.js";
10
- import "../chunk-45SUJ4GS.js";
11
- import "../chunk-MODG2KVN.js";
12
- import "../chunk-UKAZW3CQ.js";
13
- import "../chunk-2OMVVDBU.js";
3
+ } from "../chunk-5O4PAUNU.js";
14
4
  import "../chunk-CWMXXUWU.js";
15
5
  export {
16
6
  initiateAuthenticationClient
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@equinor/mad-core",
3
3
  "description": "Core library for the Mobile App Delivery team",
4
- "version": "0.12.2",
4
+ "version": "0.14.0",
5
5
  "author": {
6
6
  "name": "Equinor Mobile App Delivery team (MAD)"
7
7
  },
@@ -27,7 +27,7 @@
27
27
  "@types/showdown": "^2.0.0",
28
28
  "eslint": "^8.46.0",
29
29
  "jest": "^29.7.0",
30
- "react-test-renderer": "18.2.0",
30
+ "react-test-renderer": "19.0.0",
31
31
  "ts-jest": "^29.2.5",
32
32
  "tsup": "^8.3.5"
33
33
  },
@@ -47,17 +47,16 @@
47
47
  "license": "MIT",
48
48
  "main": "./dist/index.js",
49
49
  "peerDependencies": {
50
- "@react-native-async-storage/async-storage": "1.23.1",
50
+ "@react-native-async-storage/async-storage": "2.1.2",
51
51
  "@react-native-community/netinfo": "^11.4.1",
52
52
  "@react-navigation/native": "^6.1.17",
53
- "expo-device": "~7.0.1",
54
- "expo-localization": "~16.0.0",
55
- "react": "~18.3.1",
56
- "react-dom": "~18.3.1",
57
- "react-native": "~0.76.3",
58
- "react-native-gesture-handler": "~2.20.2",
59
- "react-native-msal": "*",
60
- "react-native-safe-area-context": "4.12.0"
53
+ "expo-device": "7.1.4",
54
+ "expo-localization": "16.1.6",
55
+ "react": "19.0.0",
56
+ "react-dom": "19.0.0",
57
+ "react-native": "0.79.5",
58
+ "react-native-gesture-handler": "~2.24.0",
59
+ "react-native-safe-area-context": "5.4.0"
61
60
  },
62
61
  "scripts": {
63
62
  "build": "tsup-node && echo '\n ⚙️ Generating typescript declarations..' && tsc --project tsconfig.json --emitDeclarationOnly --declaration",
@@ -1,41 +0,0 @@
1
- import {
2
- createNativeStackNavigator,
3
- createStackNavigator
4
- } from "./chunk-RJDKNHBE.js";
5
- import {
6
- initiateAuthenticationClient
7
- } from "./chunk-WDZF2C5R.js";
8
- import {
9
- createMadCoreNativeStackNavigator,
10
- createMadCoreStackNavigator
11
- } from "./chunk-S2WEOFU7.js";
12
- import {
13
- setConfig
14
- } from "./chunk-GEEFQMRN.js";
15
- import {
16
- __spreadProps,
17
- __spreadValues
18
- } from "./chunk-CWMXXUWU.js";
19
-
20
- // src/components/createCoreStackNavigator.tsx
21
- var createStackCoreNavigator = (config) => {
22
- setConfig(config);
23
- initiateAuthenticationClient();
24
- const Stack = createStackNavigator();
25
- const Navigator = createMadCoreStackNavigator(Stack);
26
- return __spreadProps(__spreadValues({}, Stack), { Navigator });
27
- };
28
- var createNativeStackCoreNavigator = (config) => {
29
- setConfig(config);
30
- initiateAuthenticationClient();
31
- const Stack = createNativeStackNavigator();
32
- const Navigator = createMadCoreNativeStackNavigator(Stack);
33
- return __spreadProps(__spreadValues({}, Stack), { Navigator });
34
- };
35
- var createCoreStackNavigator = (config) => createNativeStackCoreNavigator(config);
36
-
37
- export {
38
- createStackCoreNavigator,
39
- createNativeStackCoreNavigator,
40
- createCoreStackNavigator
41
- };
File without changes
@@ -1,30 +0,0 @@
1
- import {
2
- getMadCommonBaseUrl,
3
- getMadCommonScopes
4
- } from "./chunk-ZB37EIZB.js";
5
- import {
6
- __async
7
- } from "./chunk-CWMXXUWU.js";
8
-
9
- // src/components/screens/create-incident/createIncident.ts
10
- import { authenticateSilently } from "@equinor/mad-auth";
11
- var createIncident = (data, env, serviceNow) => __async(void 0, null, function* () {
12
- const baseUrl = getMadCommonBaseUrl(env);
13
- const scopes = getMadCommonScopes(env);
14
- const authenticationResponse = yield authenticateSilently(scopes);
15
- if (!authenticationResponse) throw new Error("Unable to authenticate silently");
16
- const fetchResponse = yield fetch(`${baseUrl}/ServiceNow/apps/${serviceNow}/incidents`, {
17
- method: "POST",
18
- body: JSON.stringify(data),
19
- headers: new Headers({
20
- Accept: "application/json",
21
- "Content-Type": "application/json",
22
- Authorization: `Bearer ${authenticationResponse.accessToken}`
23
- })
24
- });
25
- return yield fetchResponse.json().then((result) => JSON.parse(result));
26
- });
27
-
28
- export {
29
- createIncident
30
- };
@@ -1,98 +0,0 @@
1
- import {
2
- WhatsNewScreen
3
- } from "./chunk-CKOB6JKU.js";
4
- import {
5
- CreateIncidentScreen
6
- } from "./chunk-ZIV7DVBA.js";
7
- import {
8
- SelectLanguageScreen
9
- } from "./chunk-STKI44UB.js";
10
- import {
11
- ReleaseNotesScreen
12
- } from "./chunk-TWUGCMPQ.js";
13
- import {
14
- AboutScreen
15
- } from "./chunk-ZAJCJP22.js";
16
- import {
17
- LoginScreen
18
- } from "./chunk-GNJZV3PL.js";
19
- import {
20
- MadCoreProviders
21
- } from "./chunk-6LMMRQYQ.js";
22
- import {
23
- getDefaultScreenOptionsForLoginScreen
24
- } from "./chunk-RGJ4RWVB.js";
25
- import {
26
- useMadConfig
27
- } from "./chunk-GEEFQMRN.js";
28
- import {
29
- CoreRoutes
30
- } from "./chunk-UKAZW3CQ.js";
31
- import {
32
- __spreadProps,
33
- __spreadValues
34
- } from "./chunk-CWMXXUWU.js";
35
-
36
- // src/utils/createMadCoreNavigator.tsx
37
- import React from "react";
38
- var createMadCoreNativeStackNavigator = (Stack) => {
39
- function MadCoreNavigator(props) {
40
- const config = useMadConfig();
41
- if (!config) return null;
42
- return /* @__PURE__ */ React.createElement(MadCoreProviders, { config, type: "native-stack" }, /* @__PURE__ */ React.createElement(Stack.Navigator, __spreadProps(__spreadValues({}, props), { initialRouteName: CoreRoutes.LOGIN }), config.login.addScreenManually !== true && /* @__PURE__ */ React.createElement(
43
- Stack.Screen,
44
- {
45
- name: CoreRoutes.LOGIN,
46
- component: LoginScreen,
47
- options: getDefaultScreenOptionsForLoginScreen()
48
- }
49
- ), /* @__PURE__ */ React.createElement(Stack.Screen, { name: CoreRoutes.RELEASE_NOTES, component: ReleaseNotesScreen }), /* @__PURE__ */ React.createElement(Stack.Screen, { name: CoreRoutes.WHATS_NEW, component: WhatsNewScreen }), config.about && /* @__PURE__ */ React.createElement(Stack.Screen, { name: CoreRoutes.ABOUT, component: AboutScreen }), config.serviceNow && /* @__PURE__ */ React.createElement(Stack.Screen, { name: CoreRoutes.FEEDBACK, component: CreateIncidentScreen }), config.language.supportedLanguages.length > 1 && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
50
- Stack.Screen,
51
- {
52
- name: CoreRoutes.SELECT_LANGUAGE,
53
- component: SelectLanguageScreen
54
- }
55
- ), /* @__PURE__ */ React.createElement(
56
- Stack.Screen,
57
- {
58
- name: CoreRoutes.SELECT_LANGUAGE_ONBOARDING,
59
- component: SelectLanguageScreen,
60
- options: { headerBackVisible: false }
61
- }
62
- )), props.children));
63
- }
64
- return MadCoreNavigator;
65
- };
66
- var createMadCoreStackNavigator = (Stack) => {
67
- function MadCoreNavigator(props) {
68
- const config = useMadConfig();
69
- if (!config) return null;
70
- return /* @__PURE__ */ React.createElement(MadCoreProviders, { config, type: "stack" }, /* @__PURE__ */ React.createElement(Stack.Navigator, __spreadProps(__spreadValues({}, props), { initialRouteName: CoreRoutes.LOGIN }), config.login.addScreenManually !== true && /* @__PURE__ */ React.createElement(
71
- Stack.Screen,
72
- {
73
- name: CoreRoutes.LOGIN,
74
- component: LoginScreen,
75
- options: getDefaultScreenOptionsForLoginScreen()
76
- }
77
- ), /* @__PURE__ */ React.createElement(Stack.Screen, { name: CoreRoutes.RELEASE_NOTES, component: ReleaseNotesScreen }), /* @__PURE__ */ React.createElement(Stack.Screen, { name: CoreRoutes.WHATS_NEW, component: WhatsNewScreen }), config.about && /* @__PURE__ */ React.createElement(Stack.Screen, { name: CoreRoutes.ABOUT, component: AboutScreen }), config.serviceNow && /* @__PURE__ */ React.createElement(Stack.Screen, { name: CoreRoutes.FEEDBACK, component: CreateIncidentScreen }), config.language.supportedLanguages.length > 1 && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
78
- Stack.Screen,
79
- {
80
- name: CoreRoutes.SELECT_LANGUAGE,
81
- component: SelectLanguageScreen
82
- }
83
- ), /* @__PURE__ */ React.createElement(
84
- Stack.Screen,
85
- {
86
- name: CoreRoutes.SELECT_LANGUAGE_ONBOARDING,
87
- component: SelectLanguageScreen,
88
- options: { headerLeft: () => null }
89
- }
90
- )), props.children));
91
- }
92
- return MadCoreNavigator;
93
- };
94
-
95
- export {
96
- createMadCoreNativeStackNavigator,
97
- createMadCoreStackNavigator
98
- };
@@ -1,20 +0,0 @@
1
- import {
2
- getConfig
3
- } from "./chunk-GEEFQMRN.js";
4
- import {
5
- getRedirectUriFromAuthConfig
6
- } from "./chunk-MODG2KVN.js";
7
-
8
- // src/utils/initiateAuthenticationClient.ts
9
- import { initiateAuthenticationClient as madAuthInitiateAuthenticationClient } from "@equinor/mad-auth";
10
- var initiateAuthenticationClient = () => {
11
- const {
12
- authentication: { clientId, redirectUri: redirectUriIos, redirectUriWeb }
13
- } = getConfig();
14
- const redirectUri = getRedirectUriFromAuthConfig(redirectUriIos, redirectUriWeb);
15
- void madAuthInitiateAuthenticationClient({ clientId, redirectUri });
16
- };
17
-
18
- export {
19
- initiateAuthenticationClient
20
- };
@@ -1,158 +0,0 @@
1
- import {
2
- UserInfo
3
- } from "./chunk-3WUJAVUO.js";
4
- import {
5
- createIncident
6
- } from "./chunk-NJ5W3O5I.js";
7
- import {
8
- useAccountOrDemoAccount
9
- } from "./chunk-WWF7QKDX.js";
10
- import {
11
- useEnvironment,
12
- useServiceNow
13
- } from "./chunk-GEEFQMRN.js";
14
-
15
- // src/components/screens/create-incident/CreateIncidentScreen.tsx
16
- import {
17
- Button,
18
- Cell,
19
- EDSStyleSheet,
20
- Spacer,
21
- TextField,
22
- Typography,
23
- useStyles
24
- } from "@equinor/mad-components";
25
- import * as Device from "expo-device";
26
- import * as Localization from "expo-localization";
27
- import React, { useState } from "react";
28
- import { KeyboardAvoidingView, LayoutAnimation, Platform, ScrollView, View } from "react-native";
29
- var CreateIncidentScreen = () => {
30
- var _a, _b, _c, _d;
31
- const [error, setError] = useState(null);
32
- const [ticketNumber, setTicketNumber] = useState(void 0);
33
- const [ticketTitle, setTicketTitle] = useState(void 0);
34
- const [ticketDescription, setTicketDescription] = useState(void 0);
35
- const [isSending, setIsSending] = useState(false);
36
- const account = useAccountOrDemoAccount();
37
- const serviceNowConfigurationItem = useServiceNow();
38
- const environment = useEnvironment();
39
- const styles = useStyles(createIncidentStyles);
40
- const timeZone = (_b = (_a = Localization.getCalendars()[0]) == null ? void 0 : _a.timeZone) != null ? _b : "Unknown TimeZone";
41
- const locale = (_d = (_c = Localization.getLocales()[0]) == null ? void 0 : _c.languageTag) != null ? _d : "Unknown Locale";
42
- const onSubmit = () => {
43
- setIsSending(true);
44
- const data = {
45
- callerEmail: account == null ? void 0 : account.username,
46
- title: ticketTitle,
47
- description: createDescription()
48
- };
49
- createIncident(data, environment, serviceNowConfigurationItem).then((response) => {
50
- LayoutAnimation.configureNext({
51
- duration: 500,
52
- update: {
53
- type: LayoutAnimation.Types.easeInEaseOut
54
- },
55
- create: {
56
- type: LayoutAnimation.Types.easeInEaseOut,
57
- property: LayoutAnimation.Properties.opacity
58
- }
59
- });
60
- if (response.result.details.number) {
61
- setTicketNumber(response.result.details.number);
62
- } else {
63
- setError(response);
64
- }
65
- setTicketDescription(void 0);
66
- setTicketTitle(void 0);
67
- setIsSending(false);
68
- }).catch(setError).finally(() => setIsSending(false));
69
- };
70
- const createDescription = () => {
71
- let description = "";
72
- description += `User: ${account == null ? void 0 : account.username}
73
- `;
74
- description += `Device Brand: ${Device.brand}
75
- `;
76
- description += `Device: ${Device.deviceName}
77
- `;
78
- description += `Operating System: ${Device.osVersion}
79
- `;
80
- description += `Time Zone: ${timeZone}
81
- `;
82
- description += `Locale: ${locale}
83
- `;
84
- return `${description}
85
- ${ticketDescription}`;
86
- };
87
- return /* @__PURE__ */ React.createElement(
88
- KeyboardAvoidingView,
89
- {
90
- behavior: "padding",
91
- keyboardVerticalOffset: 115,
92
- style: styles.container
93
- },
94
- /* @__PURE__ */ React.createElement(ScrollView, { contentInsetAdjustmentBehavior: "automatic" }, /* @__PURE__ */ React.createElement(Spacer, null), /* @__PURE__ */ React.createElement(Cell, null, /* @__PURE__ */ React.createElement(View, { style: styles.topTextContainer }, /* @__PURE__ */ React.createElement(Typography, { variant: "h1" }, "Create ticket in ServiceNow"), /* @__PURE__ */ React.createElement(Typography, { group: "paragraph", variant: "body_short" }, "We collect information about your device as part of our feedback process. By submitting, you agree to share the following information:")), /* @__PURE__ */ React.createElement(UserInfo, { infoType: "User", infoValue: account == null ? void 0 : account.username }), Platform.OS !== "web" && /* @__PURE__ */ React.createElement(UserInfo, { infoType: "Device Brand", infoValue: Device.brand }), Platform.OS !== "web" && /* @__PURE__ */ React.createElement(UserInfo, { infoType: "Device", infoValue: Device.deviceName }), /* @__PURE__ */ React.createElement(UserInfo, { infoType: "Operating System", infoValue: Device.osVersion }), /* @__PURE__ */ React.createElement(UserInfo, { infoType: "Time Zone", infoValue: timeZone }), /* @__PURE__ */ React.createElement(UserInfo, { infoType: "Locale", infoValue: locale }), ticketNumber && /* @__PURE__ */ React.createElement(View, { style: [styles.popupBox, styles.popupSuccess] }, /* @__PURE__ */ React.createElement(Typography, null, "Ticket number: "), /* @__PURE__ */ React.createElement(Typography, { selectable: true }, ticketNumber)), error && /* @__PURE__ */ React.createElement(View, { style: [styles.popupBox, styles.popupDanger] }, /* @__PURE__ */ React.createElement(Typography, null, "An error occurred creating your ticket:"), /* @__PURE__ */ React.createElement(Typography, { selectable: true }, error instanceof Error ? error.message : "")), /* @__PURE__ */ React.createElement(View, { style: styles.titleField }, /* @__PURE__ */ React.createElement(
95
- TextField,
96
- {
97
- onChange: setTicketTitle,
98
- value: ticketTitle,
99
- placeholder: "Write a title for the Service Now ticket",
100
- readOnly: isSending
101
- }
102
- )), /* @__PURE__ */ React.createElement(View, { style: styles.titleField }, /* @__PURE__ */ React.createElement(
103
- TextField,
104
- {
105
- multiline: true,
106
- onChange: setTicketDescription,
107
- placeholder: "Write a complete description of your issue. You do not need to provide information about your device.",
108
- value: ticketDescription,
109
- readOnly: isSending
110
- }
111
- )), /* @__PURE__ */ React.createElement(View, { style: styles.buttonContainer }, /* @__PURE__ */ React.createElement(
112
- Button,
113
- {
114
- disabled: !ticketTitle || !ticketDescription || isSending,
115
- onPress: onSubmit,
116
- style: { width: 81 },
117
- title: "Send"
118
- }
119
- ))))
120
- );
121
- };
122
- var createIncidentStyles = EDSStyleSheet.create((theme) => ({
123
- container: {
124
- flex: 1
125
- },
126
- topTextContainer: {
127
- paddingBottom: theme.geometry.dimension.cell.minHeight
128
- },
129
- titleField: {
130
- marginVertical: theme.spacing.textField.paddingVertical * 3
131
- },
132
- multiTextField: {
133
- height: theme.geometry.dimension.dialog.minHeight
134
- },
135
- buttonContainer: {
136
- flexDirection: "row",
137
- justifyContent: "flex-end"
138
- },
139
- popupBox: {
140
- padding: 24,
141
- marginTop: 16,
142
- borderWidth: 2,
143
- borderRadius: 4,
144
- flexDirection: "row",
145
- gap: 8,
146
- flexWrap: "wrap"
147
- },
148
- popupDanger: {
149
- borderColor: theme.colors.feedback.danger
150
- },
151
- popupSuccess: {
152
- borderColor: theme.colors.feedback.success
153
- }
154
- }));
155
-
156
- export {
157
- CreateIncidentScreen
158
- };