@equinor/mad-core 0.7.2 → 0.8.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.
- package/CHANGELOG.md +11 -0
- package/README.md +3 -456
- package/dist/{chunk-UIH6RSIN.js → chunk-4B6Z33WD.js} +12 -9
- package/dist/{chunk-UATWXG2H.js → chunk-7TSQIIGU.js} +4 -4
- package/dist/chunk-DEVBLCRV.js +17 -0
- package/dist/chunk-NA7ZYOXW.js +9 -0
- package/dist/components/ToastEmitter.d.ts +2 -0
- package/dist/components/ToastEmitter.js +8 -0
- package/dist/components/createCoreStackNavigator.js +13 -11
- package/dist/components/index.js +15 -13
- package/dist/components/screens/language/SelectLanguageScreen.js +2 -2
- package/dist/components/screens/release-notes/ReleaseNotesScreen.js +2 -2
- package/dist/components/screens/release-notes/WhatsNewScreen.js +2 -2
- package/dist/components/screens/settings/SettingsScreen.js +2 -2
- package/dist/components/screens/settings/index.js +3 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +20 -14
- package/dist/utils/createMadCoreNavigator.js +11 -9
- package/dist/utils/getTopOffsetForToast.d.ts +1 -0
- package/dist/utils/getTopOffsetForToast.js +7 -0
- package/package.json +5 -3
- package/dist/{chunk-YTG27LZT.js → chunk-G5FM7D6M.js} +3 -3
- package/dist/{chunk-FBRFCQOV.js → chunk-KOARSQKK.js} +3 -3
- package/dist/{chunk-LYU7NQBB.js → chunk-OACYJHTV.js} +3 -3
- package/dist/{chunk-ARFGD2IL.js → chunk-QKUSNQOJ.js} +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @equinor/mad-core
|
|
2
2
|
|
|
3
|
+
## 0.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 7ce28df: `addToast` is available. `react-native-safe-area-context` is now a peer dependency
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [7ce28df]
|
|
12
|
+
- @equinor/mad-components@0.14.6
|
|
13
|
+
|
|
3
14
|
## 0.7.2
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -31,460 +31,7 @@ that you can focus on your app's core functionality. It provides:
|
|
|
31
31
|
- Probably more, but it's hard to keep track of everything. Do you know of anything that should be
|
|
32
32
|
added here? Create an issue!
|
|
33
33
|
|
|
34
|
-
###
|
|
34
|
+
### Docs
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
your input_
|
|
39
|
-
|
|
40
|
-
#### Step 1: Installation
|
|
41
|
-
|
|
42
|
-
Install `react-native-msal` from [this repository](https://github.com/equinor/react-native-msal/).
|
|
43
|
-
This is a fork maintained by the mad-team. Always install the newest commit. To install it, add this
|
|
44
|
-
to your `package.json`:
|
|
45
|
-
|
|
46
|
-
```json
|
|
47
|
-
"dependencies": {
|
|
48
|
-
"react-native-msal": "github:equinor/react-native-msal#NEWEST_COMMIT_HASH_HERE",
|
|
49
|
-
}
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
And then run `npm install`.
|
|
53
|
-
|
|
54
|
-
Next, install `@equinor/mad-core` and it's peer dependencies
|
|
55
|
-
`@react-native-async-storage/async-storage`, `@react-navigation/native`, and
|
|
56
|
-
`react-native-gesture-handler`. _note: Any issues with installation? Do you suspect some
|
|
57
|
-
peer-dependencies are missing? Create an issue!_
|
|
58
|
-
|
|
59
|
-
#### Step 2: Create a config
|
|
60
|
-
|
|
61
|
-
Create a `mad.config.ts` file (name of the file can be anything, but we have used this naming
|
|
62
|
-
convention when developing this package). Use the `MadConfig` type from `@equinor/mad-core` for type
|
|
63
|
-
safety:
|
|
64
|
-
|
|
65
|
-
```ts
|
|
66
|
-
import { MadConfig } from "@equinor/mad-core";
|
|
67
|
-
import Splash from "./assets/images/splash.png";
|
|
68
|
-
import { getBuildNumber, getAppSpecificEndpoints } from "./settings";
|
|
69
|
-
import { RootStackParamList } from "./types/navigation";
|
|
70
|
-
|
|
71
|
-
export const config: MadConfig<RootStackParamList> = {
|
|
72
|
-
navigateToMainRouteFn: navigation => navigation.navigate("Root"),
|
|
73
|
-
appVersion: "1.0.0",
|
|
74
|
-
servicePortalName: "Chronicles",
|
|
75
|
-
currentEnvironment: "prod",
|
|
76
|
-
language: {
|
|
77
|
-
supportedLanguages: [
|
|
78
|
-
{ code: "en", name: "English" },
|
|
79
|
-
{ code: "nb", name: "Norwegian" },
|
|
80
|
-
{ code: "pt", name: "Portuguese" },
|
|
81
|
-
],
|
|
82
|
-
skipOnboarding: false,
|
|
83
|
-
},
|
|
84
|
-
authentication: {
|
|
85
|
-
redirectUri: "msauth.com.equinor.mad.chronicles://auth",
|
|
86
|
-
redirectUriWeb: "http://localhost:8081",
|
|
87
|
-
clientId: "49222fe1-4e0a-4310-9e81-1a2c3eb9b2ed",
|
|
88
|
-
scopes: ["0a429637-3fe1-4452-bd95-c87923ba340b/user_impersonation"],
|
|
89
|
-
},
|
|
90
|
-
login: {
|
|
91
|
-
splash: Splash,
|
|
92
|
-
},
|
|
93
|
-
applicationInsights: {
|
|
94
|
-
instrumentationKey: "f1859360-4aa2-425f-b494-2d7320de6832",
|
|
95
|
-
longTermLog: { instrumentationKey: "e91835aa-bcc2-41dd-a79d-352f0df23e1b" },
|
|
96
|
-
},
|
|
97
|
-
serviceNow: "SERVICE_NOW_CONFIGURATION_ITEM",
|
|
98
|
-
about: {
|
|
99
|
-
endpoints: getAppSpecificEndpoints(),
|
|
100
|
-
buildNumber: getBuildNumber(),
|
|
101
|
-
},
|
|
102
|
-
};
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
You can also set environment specific values for each field. The config supports `dev`, `test`,
|
|
106
|
-
`qa`, `prod`. The correct values will be picked based on `currentEnvironment`. Example from
|
|
107
|
-
`Chronicles`:
|
|
108
|
-
|
|
109
|
-
```ts
|
|
110
|
-
import { MadConfig } from "@equinor/mad-core";
|
|
111
|
-
import Splash from "./assets/images/splash.png";
|
|
112
|
-
import { getBuildNumber } from "./settings";
|
|
113
|
-
import { RootStackParamList } from "./types/navigation";
|
|
114
|
-
|
|
115
|
-
export const config: MadConfig<RootStackParamList> = {
|
|
116
|
-
navigateToMainRouteFn: navigation => navigation.navigate("Root"),
|
|
117
|
-
appVersion: "1.0.0",
|
|
118
|
-
servicePortalName: "Chronicles",
|
|
119
|
-
currentEnvironment: "prod",
|
|
120
|
-
serviceNow: "MAD",
|
|
121
|
-
language: {
|
|
122
|
-
supportedLanguages: [
|
|
123
|
-
{ code: "en", name: "English" },
|
|
124
|
-
{ code: "nb", name: "Norwegian" },
|
|
125
|
-
{ code: "pt", name: "Portuguese" },
|
|
126
|
-
],
|
|
127
|
-
skipOnboarding: false,
|
|
128
|
-
},
|
|
129
|
-
authentication: {
|
|
130
|
-
prod: {
|
|
131
|
-
redirectUri: "msauth.com.equinor.mad.chronicles://auth",
|
|
132
|
-
redirectUriWeb: "http://localhost:8081",
|
|
133
|
-
clientId: "49222fe1-4e0a-4310-9e81-1a2c3eb9b2ed",
|
|
134
|
-
scopes: ["0a429637-3fe1-4452-bd95-c87923ba340b/user_impersonation"],
|
|
135
|
-
},
|
|
136
|
-
test: {
|
|
137
|
-
redirectUri: "msauth.com.equinor.mad.chronicles://auth",
|
|
138
|
-
redirectUriWeb: "http://localhost:8081",
|
|
139
|
-
clientId: "49222fe1-4e0a-4310-9e81-1a2c3eb9b2ed",
|
|
140
|
-
scopes: ["830a7388-cd89-4e25-a631-bd615bf225a4/user_impersonation"],
|
|
141
|
-
},
|
|
142
|
-
},
|
|
143
|
-
login: {
|
|
144
|
-
splash: Splash,
|
|
145
|
-
},
|
|
146
|
-
applicationInsights: {
|
|
147
|
-
instrumentationKey: "f1859360-4aa2-425f-b494-2d7320de6832",
|
|
148
|
-
longTermLog: { instrumentationKey: "e91835aa-bcc2-41dd-a79d-352f0df23e1b" },
|
|
149
|
-
},
|
|
150
|
-
about: {
|
|
151
|
-
endpoints: [],
|
|
152
|
-
buildNumber: getBuildNumber(),
|
|
153
|
-
},
|
|
154
|
-
};
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
| key | required? | explanation |
|
|
158
|
-
| --------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
159
|
-
| `appVersion` | true | Your app's current version. Used to figure out whether the app should display what's new, and which release notes version to fetch |
|
|
160
|
-
| `navigateToMainFn` | true | a function `@equinor/mad-core` will use when navigating to your app's main route. To make this function type safe, make sure to provide a `ParamList` as a generic argument to the `MadConfig` type |
|
|
161
|
-
| `servicePortalName` | true | The name of the app in the service portal. Used to figure out which release notes and service messages to fetch |
|
|
162
|
-
| `currentEnvironment` | true | The environment of the app. Used to display environment banner, and to select the correct service message and release notes endpoint. Also used to pick correct values from config |
|
|
163
|
-
| `language` | true | language config. See [language](#language-config) |
|
|
164
|
-
| `authentication` | true | authentication config. See [authentication](#authentication-config) |
|
|
165
|
-
| `login` | true | login screen config. See [login](#login-config) |
|
|
166
|
-
| `applicationInsights` | true | application insights config. See [application insights](#application-insights-config) |
|
|
167
|
-
| `serviceNow` | false | Configuration item in Service Now. Used for create incident screen. If not provided, we won't add create incident screen to the stack |
|
|
168
|
-
| `about` | false | about screen config. If not provided, we won't add about screen to the stack. See [about](#about-config) |
|
|
169
|
-
|
|
170
|
-
###### Language config
|
|
171
|
-
|
|
172
|
-
| key | required? | explanation |
|
|
173
|
-
| --------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
174
|
-
| `supportedLanguages` | true | an array of supported languages. The language object should contain `code` and `name`. `mad-core` supports Norwegian (`no`, `nb`), english (`en`) and Portuguese (`pt`). If you use any other languages, the common screens will be in english. If you need more language support, create an issue! |
|
|
175
|
-
| `defaultLanguageCode` | false | The default language of the app. This is the language the app will use if the user has not selected a language. If default language is not provided, the app will use the first language in the `supportedLanguages` array |
|
|
176
|
-
| `skipOnboarding` | false | Set this to true if you don't want to force the user to set their preferred language the first time they start the app |
|
|
177
|
-
|
|
178
|
-
###### Authentication config
|
|
179
|
-
|
|
180
|
-
| key | required? | explanation |
|
|
181
|
-
| ---------------- | --------- | ------------------------------------------------------------------------------------- |
|
|
182
|
-
| `clientId` | true | The application's client id |
|
|
183
|
-
| `redirectUri` | true | The application's redirect uri |
|
|
184
|
-
| `redirectUriWeb` | false | The application's redirect uri for web. This is required if your app has web support. |
|
|
185
|
-
| `scopes` | true | an array of scopes to use when logging in |
|
|
186
|
-
|
|
187
|
-
###### Login config
|
|
188
|
-
|
|
189
|
-
| key | required? | explanation |
|
|
190
|
-
| ------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
191
|
-
| `splash` | true | The splash screen of the application. Will be used as a background for the login screen. For best results, set `resizeMode` to `"cover"`, and `backgroundColor` to your splash screen's background color in `app.json`. `@equinor/mad-core` will use resize mode `cover` on iOS, and `contain` on web. |
|
|
192
|
-
| `backgroundColor` | false | Background color for the login screen. Should be identical to the splash screen's background color. We have a common design for login screens across our apps, with a default background color. If your login screen for some reason uses different colors, use this property to change the background color. |
|
|
193
|
-
| `addScreenManually` | false | Set this to true if you want to add the login screen manually to the stack, just like you do with SettingsScreen. This way you can access LoginScreen's props: `onAuthenticationSuccessful` and `onAuthenticationFailed`. When adding `LoginScreen` to the stack, use `getDefaultScreenOptionsForLoginScreen` to use the same options as we do when adding the screen automatically. |
|
|
194
|
-
|
|
195
|
-
###### Application Insights config
|
|
196
|
-
|
|
197
|
-
| key | required? | explanation |
|
|
198
|
-
| ------------------------------------------ | --------- | ------------------------------------------------------------------------------------------------- |
|
|
199
|
-
| `instrumentationKey` or `connectionString` | true | used to connect to the right resource in Azure |
|
|
200
|
-
| `longTermLog` | false | used to define long term log config. It should contain `instrumentationKey` or `connectionString` |
|
|
201
|
-
|
|
202
|
-
###### About config
|
|
203
|
-
|
|
204
|
-
| key | required? | explanation |
|
|
205
|
-
| ------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------- |
|
|
206
|
-
| `endpoints` | true | The endpoints used by the application. The endpoints used by `mad-core` is added automatically. Will be displayed at the about-screen |
|
|
207
|
-
| `buildNumber` | true | The build number of the application. Will be displayed at the about-screen |
|
|
208
|
-
|
|
209
|
-
#### Step 3: use `createCoreStackNavigator`
|
|
210
|
-
|
|
211
|
-
Next step is replacing your topmost `createStackNavigator`/`createNativeStackNavigator` with
|
|
212
|
-
`createCoreStackNavigator` from `@equinor/mad-core`. It takes one argument: The config you created
|
|
213
|
-
in step 2. You use it the same way you would a normal `Stack`.
|
|
214
|
-
|
|
215
|
-
```tsx
|
|
216
|
-
import { createCoreStackNavigator } from "@equinor/mad-core";
|
|
217
|
-
import { config } from "path/to/mad.config.ts";
|
|
218
|
-
import { RootStackParamList } from "path/to/paramList.ts";
|
|
219
|
-
|
|
220
|
-
const RootStack = createCoreStackNavigator<RootStackParamList>(config);
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
If you have leftover screens from `mad-expo-core` in the stack, they should be removed.
|
|
224
|
-
`createCoreStackNavigator` will add similar screens for you behind the scenes.
|
|
225
|
-
|
|
226
|
-
`SettingsScreen` also has to be added manually. This is because you most likely have app-specific
|
|
227
|
-
settings you want to hook up to the settings screen.
|
|
228
|
-
|
|
229
|
-
If you don't have any app-specific settings, you can just add `SettingsScreen` from
|
|
230
|
-
`@equinor/mad-core` with name `"Settings"`. If you do have app-specific settings you want to add, we
|
|
231
|
-
suggest creating a wrapper component that passes in the props you need to `SettingsScreen`.
|
|
232
|
-
|
|
233
|
-
Example stack:
|
|
234
|
-
|
|
235
|
-
```tsx
|
|
236
|
-
const CoreStack = createCoreStackNavigator<RootStackParamList>(config);
|
|
237
|
-
function RootNavigator() {
|
|
238
|
-
return (
|
|
239
|
-
<CoreStack.Navigator>
|
|
240
|
-
<CoreStack.Screen
|
|
241
|
-
name="Root"
|
|
242
|
-
component={BottomTabNavigator}
|
|
243
|
-
options={{ headerShown: false }}
|
|
244
|
-
/>
|
|
245
|
-
<CoreStack.Screen
|
|
246
|
-
name="NotFound"
|
|
247
|
-
component={NotFoundScreen}
|
|
248
|
-
options={{ title: "Oops!" }}
|
|
249
|
-
/>
|
|
250
|
-
<CoreStack.Screen name="Settings" component={SampleSettingsScreen} />
|
|
251
|
-
</CoreStack.Navigator>
|
|
252
|
-
);
|
|
253
|
-
}
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
SampleSettingsScreen:
|
|
257
|
-
|
|
258
|
-
```tsx
|
|
259
|
-
import React from "react";
|
|
260
|
-
import { SettingsScreen, SettingsScreenConfiguration } from "@equinor/mad-core";
|
|
261
|
-
|
|
262
|
-
export const SampleSettingsScreen = () => {
|
|
263
|
-
const appSpecificSettingsConfig: SettingsScreenConfiguration = [
|
|
264
|
-
{
|
|
265
|
-
items: [
|
|
266
|
-
{
|
|
267
|
-
name: "navigation",
|
|
268
|
-
title: "navigation",
|
|
269
|
-
onPress: () => undefined,
|
|
270
|
-
iconName: "abacus",
|
|
271
|
-
},
|
|
272
|
-
{
|
|
273
|
-
name: "button",
|
|
274
|
-
title: "Button",
|
|
275
|
-
onPress: () => undefined,
|
|
276
|
-
iconName: "abacus",
|
|
277
|
-
color: "primary",
|
|
278
|
-
},
|
|
279
|
-
{
|
|
280
|
-
name: "switch",
|
|
281
|
-
title: "Test",
|
|
282
|
-
onChange: () => undefined,
|
|
283
|
-
isActive: true,
|
|
284
|
-
iconName: "abacus",
|
|
285
|
-
},
|
|
286
|
-
{
|
|
287
|
-
name: "custom",
|
|
288
|
-
key: "Custom",
|
|
289
|
-
component: () => (
|
|
290
|
-
<Cell>
|
|
291
|
-
<Typography>This is a custom setting</Typography>
|
|
292
|
-
</Cell>
|
|
293
|
-
),
|
|
294
|
-
},
|
|
295
|
-
],
|
|
296
|
-
},
|
|
297
|
-
];
|
|
298
|
-
|
|
299
|
-
return <SettingsScreen config={appSpecificSettingsConfig} />;
|
|
300
|
-
};
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
_note: Remember to put your content in a `Cell` when adding custom settings_
|
|
304
|
-
|
|
305
|
-
#### Step 4: replace `createStackNavigator`/`createNativeStackNavigator`/`createBottomTabsNavigator`/`NavigationContainer` imports
|
|
306
|
-
|
|
307
|
-
In order for us to display environment banners and service messages on all screens, you need to
|
|
308
|
-
import `createNativeStackNavigator`/`createBottomTabsNavigator` from `@equinor/mad-core` instead of
|
|
309
|
-
`react-navigation`. Currently we don't support other navigators. Do you need support for other
|
|
310
|
-
navigators? Create an issue!
|
|
311
|
-
|
|
312
|
-
By default environment banners and service messages should display if the screen header is
|
|
313
|
-
displayed. If you need to override this behaviour, you can use the `customSubHeaderShown` option.
|
|
314
|
-
For more information on using `customSubHeaderShown`, refer to `@equinor/mad-navigation`'s
|
|
315
|
-
documentation.
|
|
316
|
-
|
|
317
|
-
Using `@equinor/mad-core`'s `NavigationContainer` is optional, but it adds application insights
|
|
318
|
-
navigation tracking for you automatically, which is a nice feature to have!
|
|
319
|
-
|
|
320
|
-
```tsx
|
|
321
|
-
import {
|
|
322
|
-
createBottomTabNavigator,
|
|
323
|
-
createNativeStackNavigator,
|
|
324
|
-
createCoreStackNavigator,
|
|
325
|
-
NavigationContainer,
|
|
326
|
-
} from "@equinor/mad-core";
|
|
327
|
-
```
|
|
328
|
-
|
|
329
|
-
#### Step 5: Implement a way to access the settings screen
|
|
330
|
-
|
|
331
|
-
How the user navigates to settings, is up to the app itself. One common approach is to add a button
|
|
332
|
-
in your main screen's `headerRight` position.
|
|
333
|
-
|
|
334
|
-
```tsx
|
|
335
|
-
import React from "react";
|
|
336
|
-
import { Button } from "@equinor/mad-components";
|
|
337
|
-
import { useCoreStackNavigation } from "@equinor/mad-core";
|
|
338
|
-
import { View } from "react-native";
|
|
339
|
-
|
|
340
|
-
export type GoToSettingsButtonProps = { marginRight?: number };
|
|
341
|
-
|
|
342
|
-
export function GoToSettingsButton({ marginRight }: GoToSettingsButtonProps) {
|
|
343
|
-
const navigation = useCoreStackNavigation();
|
|
344
|
-
return (
|
|
345
|
-
<View style={{ marginRight }}>
|
|
346
|
-
<Button.Icon
|
|
347
|
-
name="cog-outline"
|
|
348
|
-
variant="ghost"
|
|
349
|
-
onPress={() => navigation.navigate("Settings")}
|
|
350
|
-
/>
|
|
351
|
-
</View>
|
|
352
|
-
);
|
|
353
|
-
}
|
|
354
|
-
```
|
|
355
|
-
|
|
356
|
-
Results:
|
|
357
|
-
|
|
358
|
-
<p align="center">
|
|
359
|
-
<img src="../../assets/settings-button-example.png">
|
|
360
|
-
</p>
|
|
361
|
-
<br />
|
|
362
|
-
|
|
363
|
-
#### Step 6 (optional): Add `ErrorBoundary`
|
|
364
|
-
|
|
365
|
-
`@equinor/mad-core` provides an `ErrorBoundary` component that automatically logs crashes to
|
|
366
|
-
Application Insights. It gives the user a more user-friendly crash behaviour, and gives you
|
|
367
|
-
information about why the app crashes.
|
|
368
|
-
|
|
369
|
-
_note: The error boundary might not catch native code related crashes. It should almost always catch
|
|
370
|
-
javascript-related crashes, though._
|
|
371
|
-
|
|
372
|
-
`ErrorBoundary` should be as far up your stack as possible, in `App.tsx`:
|
|
373
|
-
|
|
374
|
-
```tsx
|
|
375
|
-
export default function App() {
|
|
376
|
-
const isLoadingComplete = useCachedResources();
|
|
377
|
-
const colorScheme = useColorScheme();
|
|
378
|
-
|
|
379
|
-
if (!isLoadingComplete) {
|
|
380
|
-
return null;
|
|
381
|
-
}
|
|
382
|
-
return (
|
|
383
|
-
<ErrorBoundary>
|
|
384
|
-
<QueryClientProvider client={queryClient}>
|
|
385
|
-
<SpeakUpSessionProvider>
|
|
386
|
-
<EDSProvider colorScheme="light" density="tablet">
|
|
387
|
-
<SafeAreaProvider>
|
|
388
|
-
<Navigation colorScheme={colorScheme} />
|
|
389
|
-
<StatusBar style="dark" />
|
|
390
|
-
</SafeAreaProvider>
|
|
391
|
-
</EDSProvider>
|
|
392
|
-
</SpeakUpSessionProvider>
|
|
393
|
-
</QueryClientProvider>
|
|
394
|
-
</ErrorBoundary>
|
|
395
|
-
);
|
|
396
|
-
}
|
|
397
|
-
```
|
|
398
|
-
|
|
399
|
-
#### Step 7: implement `useLanguage`
|
|
400
|
-
|
|
401
|
-
_note: If your app only supports one language, you can skip this step_
|
|
402
|
-
|
|
403
|
-
If you have language related state in your app, we recommend removing it, and use `useLanguage` from
|
|
404
|
-
`@equinor/mad-core` instead.
|
|
405
|
-
|
|
406
|
-
```tsx
|
|
407
|
-
const { language } = useLanguage();
|
|
408
|
-
```
|
|
409
|
-
|
|
410
|
-
This hook will give you information about which language the app is currently using.
|
|
411
|
-
|
|
412
|
-
One way to implement this, is to create a `useDictionary` hook, to select which json file to read
|
|
413
|
-
static text from.
|
|
414
|
-
|
|
415
|
-
```tsx
|
|
416
|
-
import { useLanguage } from "@equinor/mad-core";
|
|
417
|
-
import * as no from "../resources/language/no.json";
|
|
418
|
-
import * as en from "../resources/language/en.json";
|
|
419
|
-
|
|
420
|
-
export const useDictionary = () => {
|
|
421
|
-
const { language } = useLanguage();
|
|
422
|
-
switch (language.code) {
|
|
423
|
-
case "no":
|
|
424
|
-
return no;
|
|
425
|
-
default:
|
|
426
|
-
return en;
|
|
427
|
-
}
|
|
428
|
-
};
|
|
429
|
-
```
|
|
430
|
-
|
|
431
|
-
```tsx
|
|
432
|
-
const Example = () => {
|
|
433
|
-
const dictionary = useDictionary();
|
|
434
|
-
return <Typography>{dictionary.example}</Typography>;
|
|
435
|
-
};
|
|
436
|
-
```
|
|
437
|
-
|
|
438
|
-
While `@equinor/mad-core` should handle language selection for you, you can always add code to
|
|
439
|
-
select language by using `setSelectedLanguage` from `@equinor/mad-core`. You also have access to
|
|
440
|
-
`getLanguage` and `getIsLanguageSelected`, if you need access to those methods in contexts where the
|
|
441
|
-
`useLanguage` hook cannot be used.
|
|
442
|
-
|
|
443
|
-
#### Step 8: Implement demo mode
|
|
444
|
-
|
|
445
|
-
Demo mode is handled for you in `@equinor/mad-core`. You should delete your old demo state, and use
|
|
446
|
-
`getIsDemoModeEnabled` or `useDemoMode` from `@equinor/mad-core` instead. `@equinor/mad-core` should
|
|
447
|
-
handle this state for you. However, if you need access to setting the demo mode state, you can use
|
|
448
|
-
`enableDemoMode` and `disableDemoMode`.
|
|
449
|
-
|
|
450
|
-
#### Step 9: replace imports from `mad-expo-core`
|
|
451
|
-
|
|
452
|
-
The final step is to replace imports from `mad-expo-core`, and import them from `@equinor/mad-core`
|
|
453
|
-
instead. If you want to replace components, you should look for equivalent components in
|
|
454
|
-
`@equinor/mad-components`. Otherwise, you should be able to find `authenticateSilently`, and
|
|
455
|
-
application insights related items like `track`, `metricStatus`, `metricKeys`,
|
|
456
|
-
`addTelemetryInitializer`, etc in `@equinor/mad-core`. If anything is missing, and you think it
|
|
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`
|
|
36
|
+
For more information about how to use this package, head to
|
|
37
|
+
[our documentation](https://equinor.github.io/mad/docs/mad-core/introduction)
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SelectLanguageScreen
|
|
3
|
+
} from "./chunk-OACYJHTV.js";
|
|
1
4
|
import {
|
|
2
5
|
ReleaseNotesScreen
|
|
3
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-QKUSNQOJ.js";
|
|
4
7
|
import {
|
|
5
8
|
WhatsNewScreen
|
|
6
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-G5FM7D6M.js";
|
|
7
10
|
import {
|
|
8
11
|
CreateIncidentScreen
|
|
9
12
|
} from "./chunk-TR4KTTGP.js";
|
|
10
|
-
import {
|
|
11
|
-
SelectLanguageScreen
|
|
12
|
-
} from "./chunk-LYU7NQBB.js";
|
|
13
|
-
import {
|
|
14
|
-
AboutScreen
|
|
15
|
-
} from "./chunk-GBOOMGQT.js";
|
|
16
13
|
import {
|
|
17
14
|
LoginScreen
|
|
18
15
|
} from "./chunk-CRICOQIB.js";
|
|
19
16
|
import {
|
|
20
17
|
ServiceMessageProvider
|
|
21
18
|
} from "./chunk-GZ3KABVU.js";
|
|
19
|
+
import {
|
|
20
|
+
AboutScreen
|
|
21
|
+
} from "./chunk-GBOOMGQT.js";
|
|
22
22
|
import {
|
|
23
23
|
getDefaultScreenOptionsForLoginScreen
|
|
24
24
|
} from "./chunk-RGJ4RWVB.js";
|
|
@@ -31,6 +31,9 @@ import {
|
|
|
31
31
|
import {
|
|
32
32
|
CoreRoutes
|
|
33
33
|
} from "./chunk-UKAZW3CQ.js";
|
|
34
|
+
import {
|
|
35
|
+
ToastEmitter
|
|
36
|
+
} from "./chunk-DEVBLCRV.js";
|
|
34
37
|
import {
|
|
35
38
|
__spreadProps,
|
|
36
39
|
__spreadValues
|
|
@@ -76,7 +79,7 @@ var createMadCoreNavigator = (Stack) => {
|
|
|
76
79
|
component: SelectLanguageScreen,
|
|
77
80
|
options: { headerBackVisible: false }
|
|
78
81
|
}
|
|
79
|
-
)), props.children))));
|
|
82
|
+
)), props.children), /* @__PURE__ */ React.createElement(ToastEmitter, null))));
|
|
80
83
|
}
|
|
81
84
|
return MadCoreNavigator;
|
|
82
85
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createNativeStackNavigator
|
|
3
|
-
} from "./chunk-JD2JILBG.js";
|
|
4
1
|
import {
|
|
5
2
|
initiateAuthenticationClient
|
|
6
3
|
} from "./chunk-3BM4S2GG.js";
|
|
4
|
+
import {
|
|
5
|
+
createNativeStackNavigator
|
|
6
|
+
} from "./chunk-JD2JILBG.js";
|
|
7
7
|
import {
|
|
8
8
|
createMadCoreNavigator
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-4B6Z33WD.js";
|
|
10
10
|
import {
|
|
11
11
|
setConfig
|
|
12
12
|
} from "./chunk-XHIBLTJB.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getTopOffsetForToast
|
|
3
|
+
} from "./chunk-NA7ZYOXW.js";
|
|
4
|
+
|
|
5
|
+
// src/components/ToastEmitter.tsx
|
|
6
|
+
import React from "react";
|
|
7
|
+
import { ToastEmitter as MadToastEmitter } from "@equinor/mad-toast";
|
|
8
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
9
|
+
var ToastEmitter = () => {
|
|
10
|
+
const safeAreaInsets = useSafeAreaInsets();
|
|
11
|
+
const topOffset = getTopOffsetForToast(safeAreaInsets.top);
|
|
12
|
+
return /* @__PURE__ */ React.createElement(MadToastEmitter, { topOffset });
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
ToastEmitter
|
|
17
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// src/utils/getTopOffsetForToast.ts
|
|
2
|
+
import { getDefaultHeaderHeight } from "@react-navigation/elements";
|
|
3
|
+
import { Dimensions } from "react-native";
|
|
4
|
+
var PADDING_FROM_HEADER = 8;
|
|
5
|
+
var getTopOffsetForToast = (safeAreaInsetsTop = 0) => safeAreaInsetsTop + getDefaultHeaderHeight(Dimensions.get("window"), false, 0) + PADDING_FROM_HEADER;
|
|
6
|
+
|
|
7
|
+
export {
|
|
8
|
+
getTopOffsetForToast
|
|
9
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCoreStackNavigator
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-7TSQIIGU.js";
|
|
4
|
+
import "../chunk-3BM4S2GG.js";
|
|
4
5
|
import "../chunk-2GCLIPZP.js";
|
|
5
6
|
import "../chunk-JD2JILBG.js";
|
|
6
7
|
import "../chunk-4RTYLHRV.js";
|
|
@@ -8,22 +9,22 @@ import "../chunk-LOV6KYOY.js";
|
|
|
8
9
|
import "../chunk-ZSUFR7LK.js";
|
|
9
10
|
import "../chunk-YWPELSTX.js";
|
|
10
11
|
import "../chunk-SHKOH7MA.js";
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-
|
|
12
|
+
import "../chunk-4B6Z33WD.js";
|
|
13
|
+
import "../chunk-OACYJHTV.js";
|
|
14
|
+
import "../chunk-SSSTWTHP.js";
|
|
15
|
+
import "../chunk-QKUSNQOJ.js";
|
|
16
|
+
import "../chunk-G5FM7D6M.js";
|
|
17
|
+
import "../chunk-YZEMCMKV.js";
|
|
15
18
|
import "../chunk-TR4KTTGP.js";
|
|
16
19
|
import "../chunk-3WUJAVUO.js";
|
|
17
20
|
import "../chunk-CAOQCE6W.js";
|
|
18
|
-
import "../chunk-LYU7NQBB.js";
|
|
19
|
-
import "../chunk-SSSTWTHP.js";
|
|
20
|
-
import "../chunk-YZEMCMKV.js";
|
|
21
|
-
import "../chunk-GBOOMGQT.js";
|
|
22
21
|
import "../chunk-CRICOQIB.js";
|
|
23
22
|
import "../chunk-GZ3KABVU.js";
|
|
24
23
|
import "../chunk-K77ZZUJO.js";
|
|
25
|
-
import "../chunk-
|
|
24
|
+
import "../chunk-GBOOMGQT.js";
|
|
26
25
|
import "../chunk-OCWASWDK.js";
|
|
26
|
+
import "../chunk-RGJ4RWVB.js";
|
|
27
|
+
import "../chunk-XMRWZHBV.js";
|
|
27
28
|
import "../chunk-GBLKZ47S.js";
|
|
28
29
|
import "../chunk-GHWLQBHQ.js";
|
|
29
30
|
import "../chunk-N5UAX7DA.js";
|
|
@@ -41,7 +42,6 @@ import "../chunk-3JJAYLEH.js";
|
|
|
41
42
|
import "../chunk-RVKZULYD.js";
|
|
42
43
|
import "../chunk-CCVKLLIO.js";
|
|
43
44
|
import "../chunk-UZ6YMQV2.js";
|
|
44
|
-
import "../chunk-XMRWZHBV.js";
|
|
45
45
|
import "../chunk-BIMOM43W.js";
|
|
46
46
|
import "../chunk-2MSTFOYV.js";
|
|
47
47
|
import "../chunk-TIFYSLGL.js";
|
|
@@ -50,6 +50,8 @@ import "../chunk-E6ZYHW72.js";
|
|
|
50
50
|
import "../chunk-UKAZW3CQ.js";
|
|
51
51
|
import "../chunk-MODG2KVN.js";
|
|
52
52
|
import "../chunk-2OMVVDBU.js";
|
|
53
|
+
import "../chunk-DEVBLCRV.js";
|
|
54
|
+
import "../chunk-NA7ZYOXW.js";
|
|
53
55
|
import "../chunk-WEAGW6MQ.js";
|
|
54
56
|
export {
|
|
55
57
|
createCoreStackNavigator
|
package/dist/components/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import "../chunk-JYWP44JR.js";
|
|
2
2
|
import "../chunk-AK7PA4BE.js";
|
|
3
|
+
import "../chunk-5GBNULIT.js";
|
|
3
4
|
import {
|
|
4
5
|
SettingsScreen
|
|
5
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-KOARSQKK.js";
|
|
6
7
|
import "../chunk-J6NKU4OS.js";
|
|
7
8
|
import "../chunk-YKLMUKP4.js";
|
|
8
9
|
import "../chunk-3OKLIPZ5.js";
|
|
9
|
-
import "../chunk-5GBNULIT.js";
|
|
10
10
|
import "../chunk-7SJM4NDH.js";
|
|
11
11
|
import {
|
|
12
12
|
ErrorBoundary
|
|
@@ -16,7 +16,8 @@ import {
|
|
|
16
16
|
} from "../chunk-FW4GVJC7.js";
|
|
17
17
|
import {
|
|
18
18
|
createCoreStackNavigator
|
|
19
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-7TSQIIGU.js";
|
|
20
|
+
import "../chunk-3BM4S2GG.js";
|
|
20
21
|
import "../chunk-2GCLIPZP.js";
|
|
21
22
|
import {
|
|
22
23
|
createBottomTabNavigator,
|
|
@@ -27,24 +28,24 @@ import "../chunk-LOV6KYOY.js";
|
|
|
27
28
|
import "../chunk-ZSUFR7LK.js";
|
|
28
29
|
import "../chunk-YWPELSTX.js";
|
|
29
30
|
import "../chunk-SHKOH7MA.js";
|
|
30
|
-
import "../chunk-
|
|
31
|
-
import "../chunk-
|
|
32
|
-
import "../chunk-
|
|
33
|
-
import "../chunk-
|
|
31
|
+
import "../chunk-4B6Z33WD.js";
|
|
32
|
+
import "../chunk-OACYJHTV.js";
|
|
33
|
+
import "../chunk-SSSTWTHP.js";
|
|
34
|
+
import "../chunk-QKUSNQOJ.js";
|
|
35
|
+
import "../chunk-G5FM7D6M.js";
|
|
36
|
+
import "../chunk-YZEMCMKV.js";
|
|
34
37
|
import "../chunk-TR4KTTGP.js";
|
|
35
38
|
import "../chunk-3WUJAVUO.js";
|
|
36
39
|
import "../chunk-CAOQCE6W.js";
|
|
37
|
-
import "../chunk-LYU7NQBB.js";
|
|
38
|
-
import "../chunk-SSSTWTHP.js";
|
|
39
|
-
import "../chunk-YZEMCMKV.js";
|
|
40
|
-
import "../chunk-GBOOMGQT.js";
|
|
41
40
|
import {
|
|
42
41
|
LoginScreen
|
|
43
42
|
} from "../chunk-CRICOQIB.js";
|
|
44
43
|
import "../chunk-GZ3KABVU.js";
|
|
45
44
|
import "../chunk-K77ZZUJO.js";
|
|
46
|
-
import "../chunk-
|
|
45
|
+
import "../chunk-GBOOMGQT.js";
|
|
47
46
|
import "../chunk-OCWASWDK.js";
|
|
47
|
+
import "../chunk-RGJ4RWVB.js";
|
|
48
|
+
import "../chunk-XMRWZHBV.js";
|
|
48
49
|
import "../chunk-GBLKZ47S.js";
|
|
49
50
|
import "../chunk-GHWLQBHQ.js";
|
|
50
51
|
import "../chunk-N5UAX7DA.js";
|
|
@@ -62,7 +63,6 @@ import "../chunk-3JJAYLEH.js";
|
|
|
62
63
|
import "../chunk-RVKZULYD.js";
|
|
63
64
|
import "../chunk-CCVKLLIO.js";
|
|
64
65
|
import "../chunk-UZ6YMQV2.js";
|
|
65
|
-
import "../chunk-XMRWZHBV.js";
|
|
66
66
|
import "../chunk-BIMOM43W.js";
|
|
67
67
|
import "../chunk-2MSTFOYV.js";
|
|
68
68
|
import "../chunk-TIFYSLGL.js";
|
|
@@ -71,6 +71,8 @@ import "../chunk-E6ZYHW72.js";
|
|
|
71
71
|
import "../chunk-UKAZW3CQ.js";
|
|
72
72
|
import "../chunk-MODG2KVN.js";
|
|
73
73
|
import "../chunk-2OMVVDBU.js";
|
|
74
|
+
import "../chunk-DEVBLCRV.js";
|
|
75
|
+
import "../chunk-NA7ZYOXW.js";
|
|
74
76
|
import "../chunk-WEAGW6MQ.js";
|
|
75
77
|
export {
|
|
76
78
|
ErrorBoundary,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SelectLanguageScreen
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-OACYJHTV.js";
|
|
4
4
|
import "../../../chunk-SSSTWTHP.js";
|
|
5
|
+
import "../../../chunk-XMRWZHBV.js";
|
|
5
6
|
import "../../../chunk-YH46KAXB.js";
|
|
6
7
|
import "../../../chunk-ZWS33QDE.js";
|
|
7
|
-
import "../../../chunk-XMRWZHBV.js";
|
|
8
8
|
import "../../../chunk-BIMOM43W.js";
|
|
9
9
|
import "../../../chunk-XHIBLTJB.js";
|
|
10
10
|
import "../../../chunk-E6ZYHW72.js";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ReleaseNotesScreen
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-QKUSNQOJ.js";
|
|
4
4
|
import "../../../chunk-YZEMCMKV.js";
|
|
5
5
|
import "../../../chunk-OCWASWDK.js";
|
|
6
|
+
import "../../../chunk-XMRWZHBV.js";
|
|
6
7
|
import "../../../chunk-GBLKZ47S.js";
|
|
7
8
|
import "../../../chunk-GHWLQBHQ.js";
|
|
8
9
|
import "../../../chunk-N5UAX7DA.js";
|
|
@@ -10,7 +11,6 @@ import "../../../chunk-RFYZGBU4.js";
|
|
|
10
11
|
import "../../../chunk-RVKZULYD.js";
|
|
11
12
|
import "../../../chunk-CCVKLLIO.js";
|
|
12
13
|
import "../../../chunk-UZ6YMQV2.js";
|
|
13
|
-
import "../../../chunk-XMRWZHBV.js";
|
|
14
14
|
import "../../../chunk-BIMOM43W.js";
|
|
15
15
|
import "../../../chunk-XHIBLTJB.js";
|
|
16
16
|
import "../../../chunk-E6ZYHW72.js";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WhatsNewScreen
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-G5FM7D6M.js";
|
|
4
4
|
import "../../../chunk-YZEMCMKV.js";
|
|
5
5
|
import "../../../chunk-OCWASWDK.js";
|
|
6
|
+
import "../../../chunk-XMRWZHBV.js";
|
|
6
7
|
import "../../../chunk-GHWLQBHQ.js";
|
|
7
8
|
import "../../../chunk-N5UAX7DA.js";
|
|
8
9
|
import "../../../chunk-RFYZGBU4.js";
|
|
@@ -13,7 +14,6 @@ import "../../../chunk-3JJAYLEH.js";
|
|
|
13
14
|
import "../../../chunk-RVKZULYD.js";
|
|
14
15
|
import "../../../chunk-CCVKLLIO.js";
|
|
15
16
|
import "../../../chunk-UZ6YMQV2.js";
|
|
16
|
-
import "../../../chunk-XMRWZHBV.js";
|
|
17
17
|
import "../../../chunk-BIMOM43W.js";
|
|
18
18
|
import "../../../chunk-XHIBLTJB.js";
|
|
19
19
|
import "../../../chunk-E6ZYHW72.js";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SettingsScreen
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-KOARSQKK.js";
|
|
4
4
|
import "../../../chunk-J6NKU4OS.js";
|
|
5
5
|
import "../../../chunk-YKLMUKP4.js";
|
|
6
6
|
import "../../../chunk-3OKLIPZ5.js";
|
|
7
7
|
import "../../../chunk-7SJM4NDH.js";
|
|
8
|
+
import "../../../chunk-XMRWZHBV.js";
|
|
8
9
|
import "../../../chunk-GUKC6UGZ.js";
|
|
9
10
|
import "../../../chunk-GZ724MTU.js";
|
|
10
11
|
import "../../../chunk-RVKZULYD.js";
|
|
11
12
|
import "../../../chunk-CCVKLLIO.js";
|
|
12
13
|
import "../../../chunk-UZ6YMQV2.js";
|
|
13
|
-
import "../../../chunk-XMRWZHBV.js";
|
|
14
14
|
import "../../../chunk-BIMOM43W.js";
|
|
15
15
|
import "../../../chunk-XHIBLTJB.js";
|
|
16
16
|
import "../../../chunk-E6ZYHW72.js";
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import "../../../chunk-AK7PA4BE.js";
|
|
2
|
+
import "../../../chunk-5GBNULIT.js";
|
|
2
3
|
import {
|
|
3
4
|
SettingsScreen
|
|
4
|
-
} from "../../../chunk-
|
|
5
|
+
} from "../../../chunk-KOARSQKK.js";
|
|
5
6
|
import "../../../chunk-J6NKU4OS.js";
|
|
6
7
|
import "../../../chunk-YKLMUKP4.js";
|
|
7
8
|
import "../../../chunk-3OKLIPZ5.js";
|
|
8
|
-
import "../../../chunk-5GBNULIT.js";
|
|
9
9
|
import "../../../chunk-7SJM4NDH.js";
|
|
10
|
+
import "../../../chunk-XMRWZHBV.js";
|
|
10
11
|
import "../../../chunk-GUKC6UGZ.js";
|
|
11
12
|
import "../../../chunk-GZ724MTU.js";
|
|
12
13
|
import "../../../chunk-RVKZULYD.js";
|
|
13
14
|
import "../../../chunk-CCVKLLIO.js";
|
|
14
15
|
import "../../../chunk-UZ6YMQV2.js";
|
|
15
|
-
import "../../../chunk-XMRWZHBV.js";
|
|
16
16
|
import "../../../chunk-BIMOM43W.js";
|
|
17
17
|
import "../../../chunk-XHIBLTJB.js";
|
|
18
18
|
import "../../../chunk-E6ZYHW72.js";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "./types";
|
|
2
2
|
export * from "./components";
|
|
3
3
|
export { appInsightsHasBeenInitialized, addTelemetryInitializer, Envelope, metricKeys, metricStatus, track, trackCustom, trackLongTerm, trackShortTerm, } from "@equinor/mad-insights";
|
|
4
|
+
export { addToast, ToastTypes, ToastType } from "@equinor/mad-toast";
|
|
4
5
|
export * from "./hooks";
|
|
5
6
|
export * from "./store";
|
|
6
7
|
export * from "./utils/getDefaultScreenOptionsForLoginScreen";
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import "./chunk-6F4PWJZI.js";
|
|
2
1
|
import "./chunk-JYWP44JR.js";
|
|
3
2
|
import "./chunk-AK7PA4BE.js";
|
|
3
|
+
import "./chunk-5GBNULIT.js";
|
|
4
4
|
import {
|
|
5
5
|
SettingsScreen
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KOARSQKK.js";
|
|
7
7
|
import "./chunk-J6NKU4OS.js";
|
|
8
8
|
import "./chunk-YKLMUKP4.js";
|
|
9
9
|
import "./chunk-3OKLIPZ5.js";
|
|
10
|
-
import "./chunk-5GBNULIT.js";
|
|
11
10
|
import "./chunk-7SJM4NDH.js";
|
|
11
|
+
import "./chunk-6F4PWJZI.js";
|
|
12
12
|
import {
|
|
13
13
|
ErrorBoundary
|
|
14
14
|
} from "./chunk-6YLWO444.js";
|
|
@@ -17,7 +17,8 @@ import {
|
|
|
17
17
|
} from "./chunk-FW4GVJC7.js";
|
|
18
18
|
import {
|
|
19
19
|
createCoreStackNavigator
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-7TSQIIGU.js";
|
|
21
|
+
import "./chunk-3BM4S2GG.js";
|
|
21
22
|
import "./chunk-2GCLIPZP.js";
|
|
22
23
|
import {
|
|
23
24
|
createBottomTabNavigator,
|
|
@@ -28,26 +29,26 @@ import "./chunk-LOV6KYOY.js";
|
|
|
28
29
|
import "./chunk-ZSUFR7LK.js";
|
|
29
30
|
import "./chunk-YWPELSTX.js";
|
|
30
31
|
import "./chunk-SHKOH7MA.js";
|
|
31
|
-
import "./chunk-
|
|
32
|
-
import "./chunk-
|
|
33
|
-
import "./chunk-
|
|
34
|
-
import "./chunk-
|
|
32
|
+
import "./chunk-4B6Z33WD.js";
|
|
33
|
+
import "./chunk-OACYJHTV.js";
|
|
34
|
+
import "./chunk-SSSTWTHP.js";
|
|
35
|
+
import "./chunk-QKUSNQOJ.js";
|
|
36
|
+
import "./chunk-G5FM7D6M.js";
|
|
37
|
+
import "./chunk-YZEMCMKV.js";
|
|
35
38
|
import "./chunk-TR4KTTGP.js";
|
|
36
39
|
import "./chunk-3WUJAVUO.js";
|
|
37
40
|
import "./chunk-CAOQCE6W.js";
|
|
38
|
-
import "./chunk-LYU7NQBB.js";
|
|
39
|
-
import "./chunk-SSSTWTHP.js";
|
|
40
|
-
import "./chunk-YZEMCMKV.js";
|
|
41
|
-
import "./chunk-GBOOMGQT.js";
|
|
42
41
|
import {
|
|
43
42
|
LoginScreen
|
|
44
43
|
} from "./chunk-CRICOQIB.js";
|
|
45
44
|
import "./chunk-GZ3KABVU.js";
|
|
46
45
|
import "./chunk-K77ZZUJO.js";
|
|
46
|
+
import "./chunk-GBOOMGQT.js";
|
|
47
|
+
import "./chunk-OCWASWDK.js";
|
|
47
48
|
import {
|
|
48
49
|
getDefaultScreenOptionsForLoginScreen
|
|
49
50
|
} from "./chunk-RGJ4RWVB.js";
|
|
50
|
-
import "./chunk-
|
|
51
|
+
import "./chunk-XMRWZHBV.js";
|
|
51
52
|
import "./chunk-GBLKZ47S.js";
|
|
52
53
|
import "./chunk-GHWLQBHQ.js";
|
|
53
54
|
import "./chunk-N5UAX7DA.js";
|
|
@@ -72,7 +73,6 @@ import {
|
|
|
72
73
|
getIsDemoModeEnabled,
|
|
73
74
|
useDemoMode
|
|
74
75
|
} from "./chunk-UZ6YMQV2.js";
|
|
75
|
-
import "./chunk-XMRWZHBV.js";
|
|
76
76
|
import {
|
|
77
77
|
useCoreStackNavigation,
|
|
78
78
|
useCoreStackRoute
|
|
@@ -92,6 +92,8 @@ import "./chunk-E6ZYHW72.js";
|
|
|
92
92
|
import "./chunk-UKAZW3CQ.js";
|
|
93
93
|
import "./chunk-MODG2KVN.js";
|
|
94
94
|
import "./chunk-2OMVVDBU.js";
|
|
95
|
+
import "./chunk-DEVBLCRV.js";
|
|
96
|
+
import "./chunk-NA7ZYOXW.js";
|
|
95
97
|
import {
|
|
96
98
|
__async
|
|
97
99
|
} from "./chunk-WEAGW6MQ.js";
|
|
@@ -108,6 +110,7 @@ import {
|
|
|
108
110
|
trackLongTerm,
|
|
109
111
|
trackShortTerm
|
|
110
112
|
} from "@equinor/mad-insights";
|
|
113
|
+
import { addToast, ToastTypes, ToastType } from "@equinor/mad-toast";
|
|
111
114
|
import { MadAccount, MadAuthenticationResult } from "@equinor/mad-auth";
|
|
112
115
|
import {
|
|
113
116
|
authenticateSilently as msalAuthenticateSilently,
|
|
@@ -136,7 +139,10 @@ export {
|
|
|
136
139
|
MadAuthenticationResult,
|
|
137
140
|
NavigationContainer,
|
|
138
141
|
SettingsScreen,
|
|
142
|
+
ToastType,
|
|
143
|
+
ToastTypes,
|
|
139
144
|
addTelemetryInitializer,
|
|
145
|
+
addToast,
|
|
140
146
|
appInsightsHasBeenInitialized,
|
|
141
147
|
authenticateInteractively,
|
|
142
148
|
authenticateSilently,
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createMadCoreNavigator
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-4B6Z33WD.js";
|
|
4
|
+
import "../chunk-OACYJHTV.js";
|
|
5
|
+
import "../chunk-SSSTWTHP.js";
|
|
6
|
+
import "../chunk-QKUSNQOJ.js";
|
|
7
|
+
import "../chunk-G5FM7D6M.js";
|
|
8
|
+
import "../chunk-YZEMCMKV.js";
|
|
6
9
|
import "../chunk-TR4KTTGP.js";
|
|
7
10
|
import "../chunk-3WUJAVUO.js";
|
|
8
11
|
import "../chunk-CAOQCE6W.js";
|
|
9
|
-
import "../chunk-LYU7NQBB.js";
|
|
10
|
-
import "../chunk-SSSTWTHP.js";
|
|
11
|
-
import "../chunk-YZEMCMKV.js";
|
|
12
|
-
import "../chunk-GBOOMGQT.js";
|
|
13
12
|
import "../chunk-CRICOQIB.js";
|
|
14
13
|
import "../chunk-GZ3KABVU.js";
|
|
15
14
|
import "../chunk-K77ZZUJO.js";
|
|
16
|
-
import "../chunk-
|
|
15
|
+
import "../chunk-GBOOMGQT.js";
|
|
17
16
|
import "../chunk-OCWASWDK.js";
|
|
17
|
+
import "../chunk-RGJ4RWVB.js";
|
|
18
|
+
import "../chunk-XMRWZHBV.js";
|
|
18
19
|
import "../chunk-GBLKZ47S.js";
|
|
19
20
|
import "../chunk-GHWLQBHQ.js";
|
|
20
21
|
import "../chunk-N5UAX7DA.js";
|
|
@@ -32,7 +33,6 @@ import "../chunk-3JJAYLEH.js";
|
|
|
32
33
|
import "../chunk-RVKZULYD.js";
|
|
33
34
|
import "../chunk-CCVKLLIO.js";
|
|
34
35
|
import "../chunk-UZ6YMQV2.js";
|
|
35
|
-
import "../chunk-XMRWZHBV.js";
|
|
36
36
|
import "../chunk-BIMOM43W.js";
|
|
37
37
|
import "../chunk-TIFYSLGL.js";
|
|
38
38
|
import "../chunk-XHIBLTJB.js";
|
|
@@ -40,6 +40,8 @@ import "../chunk-E6ZYHW72.js";
|
|
|
40
40
|
import "../chunk-UKAZW3CQ.js";
|
|
41
41
|
import "../chunk-MODG2KVN.js";
|
|
42
42
|
import "../chunk-2OMVVDBU.js";
|
|
43
|
+
import "../chunk-DEVBLCRV.js";
|
|
44
|
+
import "../chunk-NA7ZYOXW.js";
|
|
43
45
|
import "../chunk-WEAGW6MQ.js";
|
|
44
46
|
export {
|
|
45
47
|
createMadCoreNavigator
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getTopOffsetForToast: (safeAreaInsetsTop?: number) => number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/mad-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Core library for the Mobile App Delivery team",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -35,13 +35,15 @@
|
|
|
35
35
|
"react-dom": ">=18.0",
|
|
36
36
|
"react-native": ">=0.70",
|
|
37
37
|
"react-native-gesture-handler": "^2.14.0",
|
|
38
|
-
"react-native-msal": "*"
|
|
38
|
+
"react-native-msal": "*",
|
|
39
|
+
"react-native-safe-area-context": "^4.10.1"
|
|
39
40
|
},
|
|
40
41
|
"dependencies": {
|
|
41
42
|
"@equinor/mad-auth": "*",
|
|
42
43
|
"@equinor/mad-components": "*",
|
|
43
44
|
"@equinor/mad-insights": "*",
|
|
44
45
|
"@equinor/mad-navigation": "*",
|
|
46
|
+
"@equinor/mad-toast": "*",
|
|
45
47
|
"@react-navigation/elements": "1.3.21",
|
|
46
48
|
"markdown-it": "^14.0.0",
|
|
47
49
|
"react-native-markdown-display": "^7.0.2",
|
|
@@ -62,4 +64,4 @@
|
|
|
62
64
|
"CHANGELOG.md",
|
|
63
65
|
"dist"
|
|
64
66
|
]
|
|
65
|
-
}
|
|
67
|
+
}
|
|
@@ -4,6 +4,9 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
getShortDate
|
|
6
6
|
} from "./chunk-OCWASWDK.js";
|
|
7
|
+
import {
|
|
8
|
+
useScreenTitleFromDictionary
|
|
9
|
+
} from "./chunk-XMRWZHBV.js";
|
|
7
10
|
import {
|
|
8
11
|
whats_new_exports
|
|
9
12
|
} from "./chunk-GHWLQBHQ.js";
|
|
@@ -19,9 +22,6 @@ import {
|
|
|
19
22
|
import {
|
|
20
23
|
useDemoMode
|
|
21
24
|
} from "./chunk-UZ6YMQV2.js";
|
|
22
|
-
import {
|
|
23
|
-
useScreenTitleFromDictionary
|
|
24
|
-
} from "./chunk-XMRWZHBV.js";
|
|
25
25
|
import {
|
|
26
26
|
useAppVersion,
|
|
27
27
|
useEnvironment,
|
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
getFinalSettingsConfig
|
|
9
9
|
} from "./chunk-7SJM4NDH.js";
|
|
10
|
-
import {
|
|
11
|
-
useAccountOrDemoAccount
|
|
12
|
-
} from "./chunk-GZ724MTU.js";
|
|
13
10
|
import {
|
|
14
11
|
useScreenTitleFromDictionary
|
|
15
12
|
} from "./chunk-XMRWZHBV.js";
|
|
13
|
+
import {
|
|
14
|
+
useAccountOrDemoAccount
|
|
15
|
+
} from "./chunk-GZ724MTU.js";
|
|
16
16
|
import {
|
|
17
17
|
useDictionary,
|
|
18
18
|
useSettingsScreenPremadeConfig
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SelectLanguageCellGroup
|
|
3
3
|
} from "./chunk-SSSTWTHP.js";
|
|
4
|
-
import {
|
|
5
|
-
useNavigateFromLanguageSelectScreen
|
|
6
|
-
} from "./chunk-YH46KAXB.js";
|
|
7
4
|
import {
|
|
8
5
|
useScreenTitleFromDictionary
|
|
9
6
|
} from "./chunk-XMRWZHBV.js";
|
|
7
|
+
import {
|
|
8
|
+
useNavigateFromLanguageSelectScreen
|
|
9
|
+
} from "./chunk-YH46KAXB.js";
|
|
10
10
|
import {
|
|
11
11
|
useDictionary,
|
|
12
12
|
useLanguage
|
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
getShortDate
|
|
6
6
|
} from "./chunk-OCWASWDK.js";
|
|
7
|
-
import {
|
|
8
|
-
useReleaseNotes
|
|
9
|
-
} from "./chunk-GBLKZ47S.js";
|
|
10
7
|
import {
|
|
11
8
|
useScreenTitleFromDictionary
|
|
12
9
|
} from "./chunk-XMRWZHBV.js";
|
|
10
|
+
import {
|
|
11
|
+
useReleaseNotes
|
|
12
|
+
} from "./chunk-GBLKZ47S.js";
|
|
13
13
|
|
|
14
14
|
// src/components/screens/release-notes/ReleaseNotesScreen.tsx
|
|
15
15
|
import React from "react";
|