@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.
Files changed (80) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/CODE_OF_CONDUCT.md +49 -0
  3. package/LICENSE +21 -0
  4. package/README.md +3 -0
  5. package/dist/chunk-2OMVVDBU.js +8 -0
  6. package/dist/chunk-3DI7YERU.js +80 -0
  7. package/dist/chunk-5BVQKJQB.js +31 -0
  8. package/dist/chunk-6F4PWJZI.js +0 -0
  9. package/dist/chunk-AGAXO3NW.js +18 -0
  10. package/dist/chunk-CCVKLLIO.js +0 -0
  11. package/dist/chunk-FIFUL4JE.js +29 -0
  12. package/dist/chunk-FQWPBBPB.js +21 -0
  13. package/dist/chunk-HAB34YS7.js +0 -0
  14. package/dist/chunk-ICIPJG6P.js +34 -0
  15. package/dist/chunk-J53YLHKZ.js +15 -0
  16. package/dist/chunk-JPVO5SH5.js +33 -0
  17. package/dist/chunk-JRIQBUIT.js +95 -0
  18. package/dist/chunk-K2H37TUR.js +7 -0
  19. package/dist/chunk-OCWASWDK.js +11 -0
  20. package/dist/chunk-QU6EUUQS.js +79 -0
  21. package/dist/chunk-RFYZGBU4.js +14 -0
  22. package/dist/chunk-SDIKBCFE.js +23 -0
  23. package/dist/chunk-USETLDR7.js +0 -0
  24. package/dist/chunk-UTXWRAEE.js +50 -0
  25. package/dist/chunk-UZ6YMQV2.js +25 -0
  26. package/dist/chunk-XYNA7G2L.js +62 -0
  27. package/dist/chunk-ZSTTHIEF.js +34 -0
  28. package/dist/components/AnnouncementsProvider.d.ts +2 -0
  29. package/dist/components/AnnouncementsProvider.js +7 -0
  30. package/dist/components/createCoreStackNavigator.d.ts +57 -0
  31. package/dist/components/createCoreStackNavigator.js +24 -0
  32. package/dist/components/index.d.ts +1 -0
  33. package/dist/components/index.js +25 -0
  34. package/dist/components/screens/LoginScreen.d.ts +2 -0
  35. package/dist/components/screens/LoginScreen.js +16 -0
  36. package/dist/components/screens/release-notes/ChangeLog.d.ts +14 -0
  37. package/dist/components/screens/release-notes/ChangeLog.js +8 -0
  38. package/dist/components/screens/release-notes/WhatsNewScreen.d.ts +5 -0
  39. package/dist/components/screens/release-notes/WhatsNewScreen.js +19 -0
  40. package/dist/components/screens/release-notes/fetchReleaseNotes.d.ts +3 -0
  41. package/dist/components/screens/release-notes/fetchReleaseNotes.js +8 -0
  42. package/dist/hooks/useCoreStackNavigation.d.ts +3 -0
  43. package/dist/hooks/useCoreStackNavigation.js +7 -0
  44. package/dist/index.d.ts +2 -0
  45. package/dist/index.js +26 -0
  46. package/dist/store/demo-mode/demo-mode.d.ts +9 -0
  47. package/dist/store/demo-mode/demo-mode.js +13 -0
  48. package/dist/store/demo-mode/index.d.ts +1 -0
  49. package/dist/store/demo-mode/index.js +14 -0
  50. package/dist/store/language/index.d.ts +2 -0
  51. package/dist/store/language/index.js +19 -0
  52. package/dist/store/language/language.d.ts +39 -0
  53. package/dist/store/language/language.js +15 -0
  54. package/dist/store/language/supported-languages.d.ts +11 -0
  55. package/dist/store/language/supported-languages.js +7 -0
  56. package/dist/store/mad-config/hooks.d.ts +12 -0
  57. package/dist/store/mad-config/hooks.js +16 -0
  58. package/dist/store/mad-config/index.d.ts +2 -0
  59. package/dist/store/mad-config/index.js +24 -0
  60. package/dist/store/mad-config/mad-config.d.ts +4 -0
  61. package/dist/store/mad-config/mad-config.js +11 -0
  62. package/dist/store/release-notes/index.d.ts +1 -0
  63. package/dist/store/release-notes/index.js +8 -0
  64. package/dist/store/release-notes/release-notes.d.ts +8 -0
  65. package/dist/store/release-notes/release-notes.js +12 -0
  66. package/dist/store/storage.d.ts +1 -0
  67. package/dist/store/storage.js +7 -0
  68. package/dist/store/types.d.ts +10 -0
  69. package/dist/store/types.js +0 -0
  70. package/dist/types.d.ts +72 -0
  71. package/dist/types.js +1 -0
  72. package/dist/utils/createMadCoreNavigator.d.ts +10 -0
  73. package/dist/utils/createMadCoreNavigator.js +23 -0
  74. package/dist/utils/dateUtils.d.ts +1 -0
  75. package/dist/utils/dateUtils.js +7 -0
  76. package/dist/utils/getNavigationRouteForLoginScreen.d.ts +8 -0
  77. package/dist/utils/getNavigationRouteForLoginScreen.js +9 -0
  78. package/dist/utils/madCommonUtils.d.ts +3 -0
  79. package/dist/utils/madCommonUtils.js +9 -0
  80. package/package.json +61 -0
@@ -0,0 +1 @@
1
+ export declare const createStorage: <T>() => import("zustand/middleware").PersistStorage<T> | undefined;
@@ -0,0 +1,7 @@
1
+ import {
2
+ createStorage
3
+ } from "../chunk-2OMVVDBU.js";
4
+ import "../chunk-UTXWRAEE.js";
5
+ export {
6
+ createStorage
7
+ };
@@ -0,0 +1,10 @@
1
+ export type Language = {
2
+ /**
3
+ * code in ISO 639-1 format
4
+ */
5
+ code: string;
6
+ /**
7
+ * name of the language
8
+ */
9
+ name: string;
10
+ };
File without changes
@@ -0,0 +1,72 @@
1
+ import { EnvironmentContextProps } from "@equinor/mad-components";
2
+ import { ImageSourcePropType } from "react-native";
3
+ import { Language } from "./store/types";
4
+ export type MadConfig = {
5
+ /**
6
+ * Version of the app. Will be displayed in the about screen, and will be used for release notes
7
+ */
8
+ appVersion: string;
9
+ /**
10
+ * service portal name of the app. Will be used to find the correct resource for service messages and release notes.
11
+ * @see https://web-mad-service-portal-web-prod.radix.equinor.com/
12
+ */
13
+ servicePortalName: string;
14
+ /**
15
+ * Current environment. Will be used for environment banner, as well as getting the correct resource for service messages and release notes
16
+ */
17
+ environment: EnvironmentContextProps["environment"];
18
+ language: {
19
+ /**
20
+ * Supported languages of the app.
21
+ */
22
+ supportedLanguages: Language[];
23
+ /**
24
+ * Default language of the app. This language will be returned by useLanguage hook and getLanguage function if user has not selected a language.
25
+ * If `defaultLanguageCode` is not provided, the first language in `supportedLanguages` will be considered default.
26
+ */
27
+ defaultLanguageCode?: string;
28
+ };
29
+ authentication: {
30
+ /**
31
+ * Client Id of the application. Used for login.
32
+ * You can find your application's client Id in your application's
33
+ * App registration in Azure.
34
+ * @see https://portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade
35
+ */
36
+ clientId: string;
37
+ /**
38
+ * Redirect uri of your application.
39
+ * You can find and modify your application's client Id in your application's
40
+ * App registration in Azure.
41
+ * @see https://portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade
42
+ */
43
+ redirectUri: string;
44
+ /**
45
+ * Scope to use for interactive login. You can find information about your application's
46
+ * available scopes in your application's App registration in Azure.
47
+ * @see https://portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade
48
+ */
49
+ scopes?: string[];
50
+ };
51
+ login: {
52
+ /**
53
+ * Title of the app. Used in login screen
54
+ */
55
+ title: string;
56
+ /**
57
+ * App logo. Used in login screen
58
+ */
59
+ logo: ImageSourcePropType;
60
+ };
61
+ };
62
+ export type CoreStackParamListBase = {
63
+ Login: undefined;
64
+ WhatsNew: undefined;
65
+ ReleaseNotes: undefined;
66
+ Settings: undefined;
67
+ About: undefined;
68
+ Feedback: undefined;
69
+ Root: undefined;
70
+ NotFound: undefined;
71
+ };
72
+ export type Environment = "dev" | "test" | "qa" | "prod";
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ import "./chunk-6F4PWJZI.js";
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { createNativeStackNavigator } from "@equinor/mad-navigation";
3
+ import { ParamListBase } from "@react-navigation/native";
4
+ import { CoreStackParamListBase, MadConfig } from "../types";
5
+ type GeneralFunction = (...args: any) => any;
6
+ type PropsOf<T extends GeneralFunction> = Parameters<T>[0];
7
+ type StackType = ReturnType<typeof createNativeStackNavigator>;
8
+ type NavigatorProps = PropsOf<StackType["Navigator"]>;
9
+ export declare const createMadCoreNavigator: <T extends ParamListBase>(Stack: import("@react-navigation/core").TypedNavigator<T & CoreStackParamListBase, import("@react-navigation/native").StackNavigationState<ParamListBase>, import("@equinor/mad-navigation").MadNativeStackNavigationOptions, import("@react-navigation/native-stack").NativeStackNavigationEventMap, ({ id, initialRouteName, children, screenListeners, screenOptions, ...rest }: import("@equinor/mad-navigation").NativeStackNavigatorProps) => React.JSX.Element>, config: MadConfig) => (props: Omit<NavigatorProps, "initialRouteName">) => React.JSX.Element;
10
+ export {};
@@ -0,0 +1,23 @@
1
+ import {
2
+ createMadCoreNavigator
3
+ } from "../chunk-ICIPJG6P.js";
4
+ import "../chunk-JRIQBUIT.js";
5
+ import "../chunk-FIFUL4JE.js";
6
+ import "../chunk-3DI7YERU.js";
7
+ import "../chunk-OCWASWDK.js";
8
+ import "../chunk-RFYZGBU4.js";
9
+ import "../chunk-QU6EUUQS.js";
10
+ import "../chunk-5BVQKJQB.js";
11
+ import "../chunk-AGAXO3NW.js";
12
+ import "../chunk-CCVKLLIO.js";
13
+ import "../chunk-UZ6YMQV2.js";
14
+ import "../chunk-USETLDR7.js";
15
+ import "../chunk-JPVO5SH5.js";
16
+ import "../chunk-ZSTTHIEF.js";
17
+ import "../chunk-FQWPBBPB.js";
18
+ import "../chunk-K2H37TUR.js";
19
+ import "../chunk-2OMVVDBU.js";
20
+ import "../chunk-UTXWRAEE.js";
21
+ export {
22
+ createMadCoreNavigator
23
+ };
@@ -0,0 +1 @@
1
+ export declare function getShortDate(date: Date): string;
@@ -0,0 +1,7 @@
1
+ import {
2
+ getShortDate
3
+ } from "../chunk-OCWASWDK.js";
4
+ import "../chunk-UTXWRAEE.js";
5
+ export {
6
+ getShortDate
7
+ };
@@ -0,0 +1,8 @@
1
+ export type GetNavigationRouteForLoginScreenOptions = {
2
+ appVersion: string;
3
+ lastDisplayedReleaseNotesVersion: string | null;
4
+ isDemoMode?: boolean;
5
+ };
6
+ export type GetNavigationRouteForLoginScreenReturnType = "WhatsNew" | "Root";
7
+ export declare const getNavigationRouteForLoginScreen: ({ appVersion, lastDisplayedReleaseNotesVersion, isDemoMode, }: GetNavigationRouteForLoginScreenOptions) => GetNavigationRouteForLoginScreenReturnType;
8
+ export declare const _getNavigationRouteForLoginScreenPure: {};
@@ -0,0 +1,9 @@
1
+ import {
2
+ _getNavigationRouteForLoginScreenPure,
3
+ getNavigationRouteForLoginScreen
4
+ } from "../chunk-AGAXO3NW.js";
5
+ import "../chunk-UTXWRAEE.js";
6
+ export {
7
+ _getNavigationRouteForLoginScreenPure,
8
+ getNavigationRouteForLoginScreen
9
+ };
@@ -0,0 +1,3 @@
1
+ import { Environment } from "../types";
2
+ export declare const getMadCommonScopes: (env: Environment) => string[];
3
+ export declare const getMadCommonBaseUrl: (env: Environment) => string;
@@ -0,0 +1,9 @@
1
+ import {
2
+ getMadCommonBaseUrl,
3
+ getMadCommonScopes
4
+ } from "../chunk-RFYZGBU4.js";
5
+ import "../chunk-UTXWRAEE.js";
6
+ export {
7
+ getMadCommonBaseUrl,
8
+ getMadCommonScopes
9
+ };
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@equinor/mad-core",
3
+ "version": "0.0.2",
4
+ "description": "Core library for the Mobile App Delivery team",
5
+ "type": "module",
6
+ "keywords": [
7
+ "react native",
8
+ "mad",
9
+ "expo",
10
+ "equinor"
11
+ ],
12
+ "author": {
13
+ "name": "Equinor Mobile App Delivery team (MAD)"
14
+ },
15
+ "license": "MIT",
16
+ "bugs": {
17
+ "url": "https://github.com/equinor/mad/issues"
18
+ },
19
+ "homepage": "https://github.com/equinor/mad/",
20
+ "main": "./dist/index.js",
21
+ "types": "./dist/index.d.ts",
22
+ "peerDependencies": {
23
+ "@react-native-async-storage/async-storage": "*",
24
+ "@react-navigation/native": "^6.1.8",
25
+ "react": ">=16.8",
26
+ "react-dom": ">=16.8",
27
+ "react-native": ">=0.68",
28
+ "react-native-msal": ">=4.0.4"
29
+ },
30
+ "dependencies": {
31
+ "@react-navigation/elements": "1.3.19",
32
+ "react-native-render-html": "6.3.4",
33
+ "showdown": "2.1.0",
34
+ "zustand": "^4.4.1",
35
+ "@equinor/mad-auth": "0.0.12",
36
+ "@equinor/mad-components": "0.7.0",
37
+ "@equinor/mad-insights": "0.0.2",
38
+ "@equinor/mad-navigation": "0.1.15"
39
+ },
40
+ "devDependencies": {
41
+ "@babel/core": "^7.21.4",
42
+ "@testing-library/jest-native": "^5.4.3",
43
+ "@testing-library/react": "^14.0.0",
44
+ "@testing-library/react-native": "^12.3.0",
45
+ "@types/showdown": "^2.0.0",
46
+ "react-test-renderer": "18.1.0",
47
+ "@equinor/eslint-config-mad": "0.2.1"
48
+ },
49
+ "files": [
50
+ "CODE_OF_CONDUCT.md",
51
+ "LICENSE",
52
+ "CHANGELOG.md",
53
+ "dist"
54
+ ],
55
+ "scripts": {
56
+ "build": "tsup-node && echo '\n ⚙️ Generating typescript declarations..' && tsc --project tsconfig.json --emitDeclarationOnly --declaration",
57
+ "test": "jest",
58
+ "dev": "tsup-node --watch --clean=false",
59
+ "lint": "eslint src/"
60
+ }
61
+ }