@equinor/mad-core 0.0.2
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 +14 -0
- package/CODE_OF_CONDUCT.md +49 -0
- package/LICENSE +21 -0
- package/README.md +3 -0
- package/dist/chunk-2OMVVDBU.js +8 -0
- package/dist/chunk-3DI7YERU.js +80 -0
- package/dist/chunk-5BVQKJQB.js +31 -0
- package/dist/chunk-6F4PWJZI.js +0 -0
- package/dist/chunk-AGAXO3NW.js +18 -0
- package/dist/chunk-CCVKLLIO.js +0 -0
- package/dist/chunk-FIFUL4JE.js +29 -0
- package/dist/chunk-FQWPBBPB.js +21 -0
- package/dist/chunk-HAB34YS7.js +0 -0
- package/dist/chunk-ICIPJG6P.js +34 -0
- package/dist/chunk-J53YLHKZ.js +15 -0
- package/dist/chunk-JPVO5SH5.js +33 -0
- package/dist/chunk-JRIQBUIT.js +95 -0
- package/dist/chunk-K2H37TUR.js +7 -0
- package/dist/chunk-OCWASWDK.js +11 -0
- package/dist/chunk-QU6EUUQS.js +79 -0
- package/dist/chunk-RFYZGBU4.js +14 -0
- package/dist/chunk-SDIKBCFE.js +23 -0
- package/dist/chunk-USETLDR7.js +0 -0
- package/dist/chunk-UTXWRAEE.js +50 -0
- package/dist/chunk-UZ6YMQV2.js +25 -0
- package/dist/chunk-XYNA7G2L.js +62 -0
- package/dist/chunk-ZSTTHIEF.js +34 -0
- package/dist/components/AnnouncementsProvider.d.ts +2 -0
- package/dist/components/AnnouncementsProvider.js +7 -0
- package/dist/components/createCoreStackNavigator.d.ts +57 -0
- package/dist/components/createCoreStackNavigator.js +24 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +25 -0
- package/dist/components/screens/LoginScreen.d.ts +2 -0
- package/dist/components/screens/LoginScreen.js +16 -0
- package/dist/components/screens/release-notes/ChangeLog.d.ts +14 -0
- package/dist/components/screens/release-notes/ChangeLog.js +8 -0
- package/dist/components/screens/release-notes/WhatsNewScreen.d.ts +5 -0
- package/dist/components/screens/release-notes/WhatsNewScreen.js +19 -0
- package/dist/components/screens/release-notes/fetchReleaseNotes.d.ts +3 -0
- package/dist/components/screens/release-notes/fetchReleaseNotes.js +8 -0
- package/dist/hooks/useCoreStackNavigation.d.ts +3 -0
- package/dist/hooks/useCoreStackNavigation.js +7 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +26 -0
- package/dist/store/demo-mode/demo-mode.d.ts +9 -0
- package/dist/store/demo-mode/demo-mode.js +13 -0
- package/dist/store/demo-mode/index.d.ts +1 -0
- package/dist/store/demo-mode/index.js +14 -0
- package/dist/store/language/index.d.ts +2 -0
- package/dist/store/language/index.js +19 -0
- package/dist/store/language/language.d.ts +39 -0
- package/dist/store/language/language.js +15 -0
- package/dist/store/language/supported-languages.d.ts +11 -0
- package/dist/store/language/supported-languages.js +7 -0
- package/dist/store/mad-config/hooks.d.ts +12 -0
- package/dist/store/mad-config/hooks.js +16 -0
- package/dist/store/mad-config/index.d.ts +2 -0
- package/dist/store/mad-config/index.js +24 -0
- package/dist/store/mad-config/mad-config.d.ts +4 -0
- package/dist/store/mad-config/mad-config.js +11 -0
- package/dist/store/release-notes/index.d.ts +1 -0
- package/dist/store/release-notes/index.js +8 -0
- package/dist/store/release-notes/release-notes.d.ts +8 -0
- package/dist/store/release-notes/release-notes.js +12 -0
- package/dist/store/storage.d.ts +1 -0
- package/dist/store/storage.js +7 -0
- package/dist/store/types.d.ts +10 -0
- package/dist/store/types.js +0 -0
- package/dist/types.d.ts +72 -0
- package/dist/types.js +1 -0
- package/dist/utils/createMadCoreNavigator.d.ts +10 -0
- package/dist/utils/createMadCoreNavigator.js +23 -0
- package/dist/utils/dateUtils.d.ts +1 -0
- package/dist/utils/dateUtils.js +7 -0
- package/dist/utils/getNavigationRouteForLoginScreen.d.ts +8 -0
- package/dist/utils/getNavigationRouteForLoginScreen.js +9 -0
- package/dist/utils/madCommonUtils.d.ts +3 -0
- package/dist/utils/madCommonUtils.js +9 -0
- package/package.json +61 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# @equinor/mad-core
|
|
2
|
+
|
|
3
|
+
## 0.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 81f95ba: An initial template for mad-core
|
|
8
|
+
- Updated dependencies [c2f7949]
|
|
9
|
+
- Updated dependencies [b8b7a72]
|
|
10
|
+
- Updated dependencies [5a071fb]
|
|
11
|
+
- Updated dependencies [c2f7949]
|
|
12
|
+
- @equinor/mad-components@0.7.0
|
|
13
|
+
- @equinor/mad-auth@0.0.12
|
|
14
|
+
- @equinor/mad-navigation@0.1.15
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# How we work
|
|
2
|
+
|
|
3
|
+
In Equinor, [how we deliver is as important as what we
|
|
4
|
+
deliver](https://www.equinor.com/en/careers/our-culture.html).
|
|
5
|
+
|
|
6
|
+
This set the expectations for how we collaborate in our open source projects,
|
|
7
|
+
and applies to all community members and participants in any Equinor maintained
|
|
8
|
+
project.
|
|
9
|
+
|
|
10
|
+
## Handling issues within the communities
|
|
11
|
+
|
|
12
|
+
We expect all to have a low threshold for raising issues, or in general discuss
|
|
13
|
+
how we live up to our
|
|
14
|
+
[values](https://www.equinor.com/en/about-us.html#our-values). Equally, we also
|
|
15
|
+
encourage all community members to appreciate when concerns are raised, and make
|
|
16
|
+
its best effort in solving them.
|
|
17
|
+
|
|
18
|
+
As well as responsibility for what is delivered the project maintainers are also
|
|
19
|
+
responsible creating an environment for proper handling of issues raised within
|
|
20
|
+
the communities.
|
|
21
|
+
|
|
22
|
+
## Call out for assistance
|
|
23
|
+
|
|
24
|
+
For any problem not directly resolvable within the community, we encourage you
|
|
25
|
+
to call out for assistance. Getting an outsiders perspective on the topic might
|
|
26
|
+
be just what is needed for you to proceed.
|
|
27
|
+
|
|
28
|
+
Send an e-mail to opensource_at_equinor.com and invite for a discussion. The
|
|
29
|
+
email will be handled by a team within the Equinor organization.
|
|
30
|
+
|
|
31
|
+
Your request will be kept confidential from the team or community in question,
|
|
32
|
+
unless you chose to disclose it yourself.
|
|
33
|
+
|
|
34
|
+
## Ethics helpline
|
|
35
|
+
|
|
36
|
+
In Equinor, we want you to speak up whenever you see unethical behaviour that
|
|
37
|
+
conflicts with our values or threatens our reputation.
|
|
38
|
+
|
|
39
|
+
To underline this, we continuously encourage and remind our employees and any
|
|
40
|
+
external third parties interacting with us to raise concerns or report any
|
|
41
|
+
suspected or potential breaches of law or company policies.
|
|
42
|
+
|
|
43
|
+
For any questions or issues that one suspect falls outside the scope of
|
|
44
|
+
behaviour regulated, and handled within the open source code of conduct, or you
|
|
45
|
+
wish to place an anonymous, confidential report we encourage to use the [Equinor
|
|
46
|
+
Ethics
|
|
47
|
+
helpline](https://secure.ethicspoint.eu/domain/media/en/gui/102166/index.html).
|
|
48
|
+
|
|
49
|
+
This helpline is hosted by a third party helpline provider.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Equinor ASA
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getShortDate
|
|
3
|
+
} from "./chunk-OCWASWDK.js";
|
|
4
|
+
|
|
5
|
+
// src/components/screens/release-notes/ChangeLog.tsx
|
|
6
|
+
import React, { useState } from "react";
|
|
7
|
+
import { View, ScrollView, StyleSheet } from "react-native";
|
|
8
|
+
import RenderHtml, { defaultSystemFonts } from "react-native-render-html";
|
|
9
|
+
import * as showdown from "showdown";
|
|
10
|
+
import { Typography, Button } from "@equinor/mad-components";
|
|
11
|
+
var featureTitle = "What's new";
|
|
12
|
+
var affirmText = "OK";
|
|
13
|
+
var converter = new showdown.Converter();
|
|
14
|
+
var systemFonts = [...defaultSystemFonts, "Equinor-Regular", "Equinor-Medium"];
|
|
15
|
+
var ChangeLog = ({ release, onPressAffirm }) => {
|
|
16
|
+
const [width, setWidth] = useState(0);
|
|
17
|
+
const html = { html: converter.makeHtml(release.releaseNote) };
|
|
18
|
+
const date = new Date(release.releaseDate);
|
|
19
|
+
const shortDate = getShortDate(date);
|
|
20
|
+
return /* @__PURE__ */ React.createElement(View, { style: styles.container }, /* @__PURE__ */ React.createElement(Typography, { style: styles.titleHeader, variant: "h4" }, featureTitle), /* @__PURE__ */ React.createElement(ScrollView, { style: styles.changelogItem }, /* @__PURE__ */ React.createElement(Typography, { style: styles.versionHeader }, release.version), /* @__PURE__ */ React.createElement(Typography, { style: styles.subtitleHeader }, shortDate), /* @__PURE__ */ React.createElement(
|
|
21
|
+
View,
|
|
22
|
+
{
|
|
23
|
+
onLayout: (event) => {
|
|
24
|
+
const { width: width2 } = event.nativeEvent.layout;
|
|
25
|
+
setWidth(width2);
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
/* @__PURE__ */ React.createElement(
|
|
29
|
+
RenderHtml,
|
|
30
|
+
{
|
|
31
|
+
contentWidth: width,
|
|
32
|
+
source: html,
|
|
33
|
+
systemFonts,
|
|
34
|
+
tagsStyles: {
|
|
35
|
+
li: {
|
|
36
|
+
marginBottom: 10,
|
|
37
|
+
fontFamily: "Equinor-Medium",
|
|
38
|
+
fontSize: 18,
|
|
39
|
+
color: "#333333"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
)), /* @__PURE__ */ React.createElement(View, { style: styles.footer }, /* @__PURE__ */ React.createElement(Button, { title: affirmText, onPress: onPressAffirm })));
|
|
45
|
+
};
|
|
46
|
+
var styles = StyleSheet.create({
|
|
47
|
+
container: {
|
|
48
|
+
flex: 1,
|
|
49
|
+
paddingTop: 50,
|
|
50
|
+
justifyContent: "center"
|
|
51
|
+
},
|
|
52
|
+
titleHeader: {
|
|
53
|
+
marginVertical: 15
|
|
54
|
+
},
|
|
55
|
+
changelogItem: {
|
|
56
|
+
marginBottom: 15,
|
|
57
|
+
marginTop: 20,
|
|
58
|
+
paddingHorizontal: 20
|
|
59
|
+
},
|
|
60
|
+
versionHeader: {
|
|
61
|
+
marginVertical: 15
|
|
62
|
+
},
|
|
63
|
+
subtitleHeader: {
|
|
64
|
+
fontSize: 18,
|
|
65
|
+
marginVertical: 5,
|
|
66
|
+
color: "#333333"
|
|
67
|
+
},
|
|
68
|
+
footer: {
|
|
69
|
+
height: 80,
|
|
70
|
+
flexDirection: "row",
|
|
71
|
+
alignItems: "center",
|
|
72
|
+
justifyContent: "center",
|
|
73
|
+
borderColor: "#808080",
|
|
74
|
+
borderTopWidth: 0.5
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
export {
|
|
79
|
+
ChangeLog
|
|
80
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createStorage
|
|
3
|
+
} from "./chunk-2OMVVDBU.js";
|
|
4
|
+
|
|
5
|
+
// src/store/release-notes/release-notes.ts
|
|
6
|
+
import { create } from "zustand";
|
|
7
|
+
import { devtools, persist } from "zustand/middleware";
|
|
8
|
+
var useReleaseNotesStore = create()(
|
|
9
|
+
devtools(
|
|
10
|
+
persist(
|
|
11
|
+
(set) => ({
|
|
12
|
+
lastDisplayedReleaseNotesVersion: null,
|
|
13
|
+
setLastDisplayedReleaseNotesVersion: (ver) => set(() => ({ lastDisplayedReleaseNotesVersion: ver }))
|
|
14
|
+
}),
|
|
15
|
+
{
|
|
16
|
+
name: "release-notes",
|
|
17
|
+
storage: createStorage()
|
|
18
|
+
}
|
|
19
|
+
),
|
|
20
|
+
{ name: "core/release-notes" }
|
|
21
|
+
)
|
|
22
|
+
);
|
|
23
|
+
var useReleaseNotesVersion = () => useReleaseNotesStore();
|
|
24
|
+
var getLastDisplayedReleaseNotesVersion = () => useReleaseNotesStore.getState().lastDisplayedReleaseNotesVersion;
|
|
25
|
+
var { setLastDisplayedReleaseNotesVersion } = useReleaseNotesStore.getState();
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
useReleaseNotesVersion,
|
|
29
|
+
getLastDisplayedReleaseNotesVersion,
|
|
30
|
+
setLastDisplayedReleaseNotesVersion
|
|
31
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// src/utils/getNavigationRouteForLoginScreen.ts
|
|
2
|
+
var getNavigationRouteForLoginScreen = ({
|
|
3
|
+
appVersion,
|
|
4
|
+
lastDisplayedReleaseNotesVersion,
|
|
5
|
+
isDemoMode
|
|
6
|
+
}) => {
|
|
7
|
+
if (isDemoMode)
|
|
8
|
+
return "WhatsNew";
|
|
9
|
+
if (!lastDisplayedReleaseNotesVersion || lastDisplayedReleaseNotesVersion < appVersion)
|
|
10
|
+
return "WhatsNew";
|
|
11
|
+
return "Root";
|
|
12
|
+
};
|
|
13
|
+
var _getNavigationRouteForLoginScreenPure = {};
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
getNavigationRouteForLoginScreen,
|
|
17
|
+
_getNavigationRouteForLoginScreenPure
|
|
18
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getMadCommonBaseUrl,
|
|
3
|
+
getMadCommonScopes
|
|
4
|
+
} from "./chunk-RFYZGBU4.js";
|
|
5
|
+
import {
|
|
6
|
+
__async
|
|
7
|
+
} from "./chunk-UTXWRAEE.js";
|
|
8
|
+
|
|
9
|
+
// src/components/screens/release-notes/fetchReleaseNotes.ts
|
|
10
|
+
import { authenticateSilently } from "@equinor/mad-auth";
|
|
11
|
+
var fetchReleaseNotes = (env, servicePortalName, appVersion) => __async(void 0, null, function* () {
|
|
12
|
+
const scopes = getMadCommonScopes(env);
|
|
13
|
+
const baseUrl = getMadCommonBaseUrl(env);
|
|
14
|
+
const authenticationResponse = yield authenticateSilently(scopes);
|
|
15
|
+
if (!authenticationResponse)
|
|
16
|
+
throw new Error("Unable to authenticate silently");
|
|
17
|
+
const fetchResponse = yield fetch(`${baseUrl}/ReleaseNote/${servicePortalName}/${appVersion}`, {
|
|
18
|
+
method: "GET",
|
|
19
|
+
headers: new Headers({
|
|
20
|
+
Authorization: `Bearer ${authenticationResponse.accessToken}`
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
const json = yield fetchResponse.json();
|
|
24
|
+
return json;
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
fetchReleaseNotes
|
|
29
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__spreadProps,
|
|
3
|
+
__spreadValues
|
|
4
|
+
} from "./chunk-UTXWRAEE.js";
|
|
5
|
+
|
|
6
|
+
// src/components/AnnouncementsProvider.tsx
|
|
7
|
+
import React from "react";
|
|
8
|
+
import { LayoutAnimation, SafeAreaView, View } from "react-native";
|
|
9
|
+
import { HeaderHeightProvider, useHeaderHeight } from "@equinor/mad-navigation";
|
|
10
|
+
var AnnouncementsProvider = ({ children }) => {
|
|
11
|
+
return /* @__PURE__ */ React.createElement(HeaderHeightProvider, null, children, /* @__PURE__ */ React.createElement(Announcements, null));
|
|
12
|
+
};
|
|
13
|
+
var Announcements = () => {
|
|
14
|
+
const headerHeight = useHeaderHeight();
|
|
15
|
+
LayoutAnimation.configureNext(__spreadProps(__spreadValues({}, LayoutAnimation.Presets.linear), { duration: 200 }));
|
|
16
|
+
return /* @__PURE__ */ React.createElement(View, { style: { position: "absolute", top: headerHeight, left: 0, right: 0 } }, /* @__PURE__ */ React.createElement(SafeAreaView, null));
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
AnnouncementsProvider
|
|
21
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
WhatsNewScreen
|
|
3
|
+
} from "./chunk-JRIQBUIT.js";
|
|
4
|
+
import {
|
|
5
|
+
LoginScreen
|
|
6
|
+
} from "./chunk-QU6EUUQS.js";
|
|
7
|
+
import {
|
|
8
|
+
AnnouncementsProvider
|
|
9
|
+
} from "./chunk-FQWPBBPB.js";
|
|
10
|
+
import {
|
|
11
|
+
__spreadProps,
|
|
12
|
+
__spreadValues
|
|
13
|
+
} from "./chunk-UTXWRAEE.js";
|
|
14
|
+
|
|
15
|
+
// src/utils/createMadCoreNavigator.tsx
|
|
16
|
+
import React from "react";
|
|
17
|
+
import { EnvironmentProvider } from "@equinor/mad-navigation";
|
|
18
|
+
var createMadCoreNavigator = (Stack, config) => {
|
|
19
|
+
const MadCoreNavigator = (props) => {
|
|
20
|
+
return /* @__PURE__ */ React.createElement(EnvironmentProvider, { environment: config.environment }, /* @__PURE__ */ React.createElement(AnnouncementsProvider, null, /* @__PURE__ */ React.createElement(Stack.Navigator, __spreadProps(__spreadValues({}, props), { initialRouteName: "Login" }), /* @__PURE__ */ React.createElement(
|
|
21
|
+
Stack.Screen,
|
|
22
|
+
{
|
|
23
|
+
name: "Login",
|
|
24
|
+
component: LoginScreen,
|
|
25
|
+
options: { headerShown: false, environmentBannerShown: true }
|
|
26
|
+
}
|
|
27
|
+
), /* @__PURE__ */ React.createElement(Stack.Screen, { name: "WhatsNew", component: WhatsNewScreen }), props.children)));
|
|
28
|
+
};
|
|
29
|
+
return MadCoreNavigator;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export {
|
|
33
|
+
createMadCoreNavigator
|
|
34
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useMadConfig
|
|
3
|
+
} from "./chunk-ZSTTHIEF.js";
|
|
4
|
+
|
|
5
|
+
// src/store/mad-config/hooks.ts
|
|
6
|
+
var useAuthConfig = () => {
|
|
7
|
+
const config = useMadConfig();
|
|
8
|
+
return config.authentication;
|
|
9
|
+
};
|
|
10
|
+
var useLoginScreenConfig = () => {
|
|
11
|
+
const config = useMadConfig();
|
|
12
|
+
return config.login;
|
|
13
|
+
};
|
|
14
|
+
var useAppVersion = () => {
|
|
15
|
+
const config = useMadConfig();
|
|
16
|
+
return config.appVersion;
|
|
17
|
+
};
|
|
18
|
+
var useEnvironment = () => {
|
|
19
|
+
const config = useMadConfig();
|
|
20
|
+
return config.environment;
|
|
21
|
+
};
|
|
22
|
+
var useServicePortalName = () => {
|
|
23
|
+
const config = useMadConfig();
|
|
24
|
+
return config.servicePortalName;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
useAuthConfig,
|
|
29
|
+
useLoginScreenConfig,
|
|
30
|
+
useAppVersion,
|
|
31
|
+
useEnvironment,
|
|
32
|
+
useServicePortalName
|
|
33
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import {
|
|
2
|
+
fetchReleaseNotes
|
|
3
|
+
} from "./chunk-FIFUL4JE.js";
|
|
4
|
+
import {
|
|
5
|
+
ChangeLog
|
|
6
|
+
} from "./chunk-3DI7YERU.js";
|
|
7
|
+
import {
|
|
8
|
+
useReleaseNotesVersion
|
|
9
|
+
} from "./chunk-5BVQKJQB.js";
|
|
10
|
+
import {
|
|
11
|
+
useDemoMode
|
|
12
|
+
} from "./chunk-UZ6YMQV2.js";
|
|
13
|
+
import {
|
|
14
|
+
useAppVersion,
|
|
15
|
+
useEnvironment,
|
|
16
|
+
useServicePortalName
|
|
17
|
+
} from "./chunk-JPVO5SH5.js";
|
|
18
|
+
import {
|
|
19
|
+
useCoreStackNavigation
|
|
20
|
+
} from "./chunk-K2H37TUR.js";
|
|
21
|
+
import {
|
|
22
|
+
__export
|
|
23
|
+
} from "./chunk-UTXWRAEE.js";
|
|
24
|
+
|
|
25
|
+
// src/components/screens/release-notes/WhatsNewScreen.tsx
|
|
26
|
+
import React, { useEffect, useState } from "react";
|
|
27
|
+
|
|
28
|
+
// src/static/mock-data/whats-new.json
|
|
29
|
+
var whats_new_exports = {};
|
|
30
|
+
__export(whats_new_exports, {
|
|
31
|
+
app: () => app,
|
|
32
|
+
default: () => whats_new_default,
|
|
33
|
+
modified: () => modified,
|
|
34
|
+
releaseDate: () => releaseDate,
|
|
35
|
+
releaseNote: () => releaseNote,
|
|
36
|
+
version: () => version
|
|
37
|
+
});
|
|
38
|
+
var app = "App name";
|
|
39
|
+
var version = "1.1.0";
|
|
40
|
+
var modified = "2022-12-09T07:04:55+0000";
|
|
41
|
+
var releaseNote = "- Minor bug fixes";
|
|
42
|
+
var releaseDate = "2022-12-09T07:04:55+0000";
|
|
43
|
+
var whats_new_default = {
|
|
44
|
+
app,
|
|
45
|
+
version,
|
|
46
|
+
modified,
|
|
47
|
+
releaseNote,
|
|
48
|
+
releaseDate
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// src/components/screens/release-notes/WhatsNewScreen.tsx
|
|
52
|
+
import { CircularProgress } from "@equinor/mad-components";
|
|
53
|
+
var WhatsNewScreen = () => {
|
|
54
|
+
const environment = useEnvironment();
|
|
55
|
+
const releaseNotesVersion = useReleaseNotesVersion();
|
|
56
|
+
const servicePortalName = useServicePortalName();
|
|
57
|
+
const navigation = useCoreStackNavigation();
|
|
58
|
+
const demoMode = useDemoMode();
|
|
59
|
+
const appVersion = useAppVersion();
|
|
60
|
+
const [release, setRelease] = useState(null);
|
|
61
|
+
const [error, setError] = useState("");
|
|
62
|
+
const [isFetching, setIsFetching] = useState(true);
|
|
63
|
+
const enableIsFetching = () => setIsFetching(true);
|
|
64
|
+
const disableIsFetching = () => setIsFetching(false);
|
|
65
|
+
const navigate = () => navigation.navigate("Root");
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
enableIsFetching();
|
|
68
|
+
if (demoMode.isEnabled) {
|
|
69
|
+
setRelease(whats_new_exports);
|
|
70
|
+
disableIsFetching();
|
|
71
|
+
} else {
|
|
72
|
+
fetchReleaseNotes(environment, servicePortalName, appVersion).then(setRelease).catch(setError).finally(disableIsFetching);
|
|
73
|
+
}
|
|
74
|
+
}, [demoMode.isEnabled, environment, servicePortalName, appVersion]);
|
|
75
|
+
if (error || !isFetching && !release) {
|
|
76
|
+
navigate();
|
|
77
|
+
}
|
|
78
|
+
if (!release) {
|
|
79
|
+
return /* @__PURE__ */ React.createElement(CircularProgress, null);
|
|
80
|
+
}
|
|
81
|
+
return /* @__PURE__ */ React.createElement(
|
|
82
|
+
ChangeLog,
|
|
83
|
+
{
|
|
84
|
+
release,
|
|
85
|
+
onPressAffirm: () => {
|
|
86
|
+
releaseNotesVersion.setLastDisplayedReleaseNotesVersion(appVersion);
|
|
87
|
+
navigate();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export {
|
|
94
|
+
WhatsNewScreen
|
|
95
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// src/utils/dateUtils.ts
|
|
2
|
+
function getShortDate(date) {
|
|
3
|
+
const day = date.toLocaleString(void 0, { day: "2-digit" });
|
|
4
|
+
const month = date.toLocaleString(void 0, { month: "short" });
|
|
5
|
+
const year = date.getFullYear();
|
|
6
|
+
return `${month} ${day}, ${year}`;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
getShortDate
|
|
11
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useReleaseNotesVersion
|
|
3
|
+
} from "./chunk-5BVQKJQB.js";
|
|
4
|
+
import {
|
|
5
|
+
getNavigationRouteForLoginScreen
|
|
6
|
+
} from "./chunk-AGAXO3NW.js";
|
|
7
|
+
import {
|
|
8
|
+
enableDemoMode
|
|
9
|
+
} from "./chunk-UZ6YMQV2.js";
|
|
10
|
+
import {
|
|
11
|
+
useAppVersion,
|
|
12
|
+
useAuthConfig,
|
|
13
|
+
useLoginScreenConfig
|
|
14
|
+
} from "./chunk-JPVO5SH5.js";
|
|
15
|
+
import {
|
|
16
|
+
useCoreStackNavigation
|
|
17
|
+
} from "./chunk-K2H37TUR.js";
|
|
18
|
+
import {
|
|
19
|
+
__spreadProps,
|
|
20
|
+
__spreadValues
|
|
21
|
+
} from "./chunk-UTXWRAEE.js";
|
|
22
|
+
|
|
23
|
+
// src/components/screens/LoginScreen.tsx
|
|
24
|
+
import { Button, EDSStyleSheet, Typography, useStyles } from "@equinor/mad-components";
|
|
25
|
+
import React, { useState } from "react";
|
|
26
|
+
import { Image, Pressable, View } from "react-native";
|
|
27
|
+
import { LoginButton } from "@equinor/mad-auth";
|
|
28
|
+
var LoginScreen = () => {
|
|
29
|
+
const styles = useStyles(theme);
|
|
30
|
+
const authConfig = useAuthConfig();
|
|
31
|
+
const navigation = useCoreStackNavigation();
|
|
32
|
+
const appVersion = useAppVersion();
|
|
33
|
+
const { lastDisplayedReleaseNotesVersion } = useReleaseNotesVersion();
|
|
34
|
+
const { title, logo } = useLoginScreenConfig();
|
|
35
|
+
const [demoPressCount, setDemoPressCount] = useState(0);
|
|
36
|
+
const shouldDisplayDemoButton = demoPressCount >= 5;
|
|
37
|
+
return /* @__PURE__ */ React.createElement(View, { style: styles.container }, /* @__PURE__ */ React.createElement(Typography, { variant: "h1" }, title), /* @__PURE__ */ React.createElement(Pressable, { onPress: () => setDemoPressCount((state) => state + 1) }, /* @__PURE__ */ React.createElement(Image, { source: logo, resizeMode: "contain", style: { height: 200, width: 200 } })), /* @__PURE__ */ React.createElement(View, { style: { gap: 8 } }, /* @__PURE__ */ React.createElement(
|
|
38
|
+
LoginButton,
|
|
39
|
+
__spreadProps(__spreadValues({}, authConfig), {
|
|
40
|
+
onAuthenticationSuccessful: () => navigation.navigate(
|
|
41
|
+
getNavigationRouteForLoginScreen({
|
|
42
|
+
appVersion,
|
|
43
|
+
lastDisplayedReleaseNotesVersion
|
|
44
|
+
})
|
|
45
|
+
),
|
|
46
|
+
enableAutomaticAuthentication: true,
|
|
47
|
+
scopes: authConfig.scopes || []
|
|
48
|
+
})
|
|
49
|
+
), shouldDisplayDemoButton && /* @__PURE__ */ React.createElement(
|
|
50
|
+
Button,
|
|
51
|
+
{
|
|
52
|
+
title: "Demo",
|
|
53
|
+
variant: "outlined",
|
|
54
|
+
onPress: () => {
|
|
55
|
+
enableDemoMode();
|
|
56
|
+
navigation.navigate(
|
|
57
|
+
getNavigationRouteForLoginScreen({
|
|
58
|
+
appVersion,
|
|
59
|
+
lastDisplayedReleaseNotesVersion,
|
|
60
|
+
isDemoMode: true
|
|
61
|
+
})
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
)));
|
|
66
|
+
};
|
|
67
|
+
var theme = EDSStyleSheet.create((theme2) => ({
|
|
68
|
+
container: {
|
|
69
|
+
paddingVertical: theme2.spacing.container.paddingVertical,
|
|
70
|
+
paddingHorizontal: theme2.spacing.container.paddingHorizontal,
|
|
71
|
+
height: "100%",
|
|
72
|
+
alignItems: "center",
|
|
73
|
+
justifyContent: "space-evenly"
|
|
74
|
+
}
|
|
75
|
+
}));
|
|
76
|
+
|
|
77
|
+
export {
|
|
78
|
+
LoginScreen
|
|
79
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// src/utils/madCommonUtils.ts
|
|
2
|
+
var scopesRecord = {
|
|
3
|
+
dev: ["690a86bf-838c-4591-909c-9f45219445ab/user_impersonation"],
|
|
4
|
+
test: ["830a7388-cd89-4e25-a631-bd615bf225a4/user_impersonation"],
|
|
5
|
+
qa: ["29c0f71f-8db5-41b4-b285-dba2b4e765fe/user_impersonation"],
|
|
6
|
+
prod: ["0a429637-3fe1-4452-bd95-c87923ba340b/user_impersonation"]
|
|
7
|
+
};
|
|
8
|
+
var getMadCommonScopes = (env) => scopesRecord[env];
|
|
9
|
+
var getMadCommonBaseUrl = (env) => `https://api.statoil.com/app/mad/${env.toLowerCase() === "prod" ? `` : `${env}/`}api/v1.1/`;
|
|
10
|
+
|
|
11
|
+
export {
|
|
12
|
+
getMadCommonScopes,
|
|
13
|
+
getMadCommonBaseUrl
|
|
14
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createMadCoreNavigator
|
|
3
|
+
} from "./chunk-ICIPJG6P.js";
|
|
4
|
+
import {
|
|
5
|
+
setConfig
|
|
6
|
+
} from "./chunk-ZSTTHIEF.js";
|
|
7
|
+
import {
|
|
8
|
+
__spreadProps,
|
|
9
|
+
__spreadValues
|
|
10
|
+
} from "./chunk-UTXWRAEE.js";
|
|
11
|
+
|
|
12
|
+
// src/components/createCoreStackNavigator.tsx
|
|
13
|
+
import { createNativeStackNavigator } from "@equinor/mad-navigation";
|
|
14
|
+
var createCoreStackNavigator = (config) => {
|
|
15
|
+
setConfig(config);
|
|
16
|
+
const Stack = createNativeStackNavigator();
|
|
17
|
+
const Navigator = createMadCoreNavigator(Stack, config);
|
|
18
|
+
return __spreadProps(__spreadValues({}, Stack), { Navigator });
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
createCoreStackNavigator
|
|
23
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __export = (target, all) => {
|
|
21
|
+
for (var name in all)
|
|
22
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
23
|
+
};
|
|
24
|
+
var __async = (__this, __arguments, generator) => {
|
|
25
|
+
return new Promise((resolve, reject) => {
|
|
26
|
+
var fulfilled = (value) => {
|
|
27
|
+
try {
|
|
28
|
+
step(generator.next(value));
|
|
29
|
+
} catch (e) {
|
|
30
|
+
reject(e);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
var rejected = (value) => {
|
|
34
|
+
try {
|
|
35
|
+
step(generator.throw(value));
|
|
36
|
+
} catch (e) {
|
|
37
|
+
reject(e);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
41
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export {
|
|
46
|
+
__spreadValues,
|
|
47
|
+
__spreadProps,
|
|
48
|
+
__export,
|
|
49
|
+
__async
|
|
50
|
+
};
|