@bigbinary/neeto-commons-rn 2.0.3 → 2.2.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/align-deps-preset.js +84 -0
- package/lib/typescript/api/app_version.d.ts.map +1 -1
- package/lib/typescript/components/AppVersion.d.ts.map +1 -1
- package/lib/typescript/components/DevToolsBridge.d.ts +8 -0
- package/lib/typescript/components/DevToolsBridge.d.ts.map +1 -0
- package/lib/typescript/components/Header.d.ts.map +1 -1
- package/lib/typescript/components/ToggleSwitch.d.ts.map +1 -1
- package/lib/typescript/components/constants.d.ts +1 -0
- package/lib/typescript/components/constants.d.ts.map +1 -1
- package/lib/typescript/config/axios/constants.d.ts +1 -0
- package/lib/typescript/config/axios/constants.d.ts.map +1 -1
- package/lib/typescript/config/axios/groupingKey.d.ts +12 -0
- package/lib/typescript/config/axios/groupingKey.d.ts.map +1 -0
- package/lib/typescript/config/axios/index.d.ts.map +1 -1
- package/lib/typescript/config/bugsnag.d.ts +1 -1
- package/lib/typescript/config/bugsnag.d.ts.map +1 -1
- package/lib/typescript/constants/index.d.ts +10 -0
- package/lib/typescript/constants/index.d.ts.map +1 -1
- package/lib/typescript/helpers/notifications/firebaseMessaging.android.d.ts +10 -0
- package/lib/typescript/helpers/notifications/firebaseMessaging.android.d.ts.map +1 -0
- package/lib/typescript/helpers/notifications/firebaseMessaging.d.ts +24 -0
- package/lib/typescript/helpers/notifications/firebaseMessaging.d.ts.map +1 -0
- package/lib/typescript/helpers/notifications/getDeviceToken.d.ts.map +1 -1
- package/lib/typescript/helpers/notifications/index.d.ts +1 -0
- package/lib/typescript/helpers/notifications/index.d.ts.map +1 -1
- package/lib/typescript/helpers/scale.d.ts +10 -0
- package/lib/typescript/helpers/scale.d.ts.map +1 -1
- package/lib/typescript/helpers/utils.d.ts.map +1 -1
- package/lib/typescript/hooks/query/useAppVersionApi.d.ts.map +1 -1
- package/lib/typescript/hooks/query/useRolesApi.d.ts.map +1 -1
- package/lib/typescript/initializers/constants.d.ts +4 -0
- package/lib/typescript/initializers/constants.d.ts.map +1 -0
- package/lib/typescript/initializers/index.d.ts +2 -2
- package/lib/typescript/initializers/index.d.ts.map +1 -1
- package/lib/typescript/initializers/logRocket.d.ts +11 -1
- package/lib/typescript/initializers/logRocket.d.ts.map +1 -1
- package/lib/typescript/providers/NeetoCommonsRNProvider.d.ts +8 -1
- package/lib/typescript/providers/NeetoCommonsRNProvider.d.ts.map +1 -1
- package/lib/typescript/screens/authentication/LoginScreen.d.ts.map +1 -1
- package/lib/typescript/screens/authentication/OTPVerificationScreen.d.ts.map +1 -1
- package/lib/typescript/screens/authentication/Organization.d.ts.map +1 -1
- package/lib/typescript/screens/authentication/SubDomainScreen.d.ts.map +1 -1
- package/lib/typescript/screens/profile/ProfileScreen.d.ts.map +1 -1
- package/lib/typescript/screens/team_members/ProductSelect.d.ts.map +1 -1
- package/lib/typescript/screens/team_members/index.d.ts.map +1 -1
- package/lib/typescript/screens/team_members/utils.d.ts.map +1 -1
- package/lib/typescript/store/index.d.ts +3 -2
- package/lib/typescript/store/index.d.ts.map +1 -1
- package/lib/typescript/utils/apiHelpers.d.ts.map +1 -1
- package/metro-devtools.js +48 -0
- package/package.json +485 -16
- package/src/api/app_version.ts +42 -2
- package/src/components/AppVersion.ts +46 -30
- package/src/components/DevToolsBridge.ts +40 -0
- package/src/components/Header.tsx +3 -1
- package/src/components/NotificationIcon.tsx +1 -1
- package/src/components/ToggleSwitch.tsx +2 -1
- package/src/components/WorkspaceSwitcherPane.tsx +1 -1
- package/src/components/constants.ts +4 -0
- package/src/config/axios/constants.ts +3 -0
- package/src/config/axios/groupingKey.ts +25 -0
- package/src/config/axios/index.ts +7 -4
- package/src/config/bugsnag.ts +17 -1
- package/src/constants/index.ts +13 -0
- package/src/contexts/localization.tsx +1 -1
- package/src/helpers/notifications/firebaseMessaging.android.ts +21 -0
- package/src/helpers/notifications/firebaseMessaging.ts +37 -0
- package/src/helpers/notifications/getDeviceToken.ts +1 -2
- package/src/helpers/notifications/index.ts +1 -0
- package/src/helpers/notifications/registerBackgroundHandlers.ts +1 -1
- package/src/helpers/notifications/usePushNotification.ts +1 -1
- package/src/helpers/scale.ts +21 -3
- package/src/helpers/utils.ts +2 -1
- package/src/hooks/query/useAppVersionApi.ts +9 -0
- package/src/hooks/query/useRolesApi.ts +3 -1
- package/src/initializers/constants.ts +3 -0
- package/src/initializers/index.ts +12 -2
- package/src/initializers/logRocket.ts +111 -20
- package/src/providers/NeetoCommonsRNProvider.tsx +23 -0
- package/src/screens/authentication/IncompleteOnboardingInfo.tsx +2 -2
- package/src/screens/authentication/LoginScreen.tsx +50 -39
- package/src/screens/authentication/OTPVerificationScreen.tsx +17 -41
- package/src/screens/authentication/Organization.tsx +2 -6
- package/src/screens/authentication/SubDomainScreen.tsx +38 -70
- package/src/screens/profile/ProfileScreen.tsx +2 -1
- package/src/screens/team_members/Card.tsx +1 -1
- package/src/screens/team_members/ProductSelect.tsx +6 -7
- package/src/screens/team_members/index.tsx +2 -1
- package/src/screens/team_members/utils.ts +3 -1
- package/src/store/index.ts +68 -1
- package/src/utils/apiHelpers.ts +4 -1
|
@@ -2,7 +2,7 @@ import React, { useState, type ComponentType } from "react";
|
|
|
2
2
|
import { Pressable, StyleSheet } from "react-native";
|
|
3
3
|
|
|
4
4
|
import { findIndexBy } from "@bigbinary/neeto-cist";
|
|
5
|
-
import
|
|
5
|
+
import Down from "@bigbinary/neeto-icons-rn/icons/Down";
|
|
6
6
|
import {
|
|
7
7
|
BottomSheet as UIBottomSheet,
|
|
8
8
|
Container,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
type BottomSheetProps,
|
|
14
14
|
} from "@bigbinary/neetoui-rn";
|
|
15
15
|
import { type FormikProps } from "formik";
|
|
16
|
-
import
|
|
16
|
+
import mergeRight from "ramda/src/mergeRight";
|
|
17
17
|
|
|
18
18
|
import Checkbox from "./Checkbox";
|
|
19
19
|
import { APP_NAME } from "./constants";
|
|
@@ -32,11 +32,10 @@ interface RoleSheetItem {
|
|
|
32
32
|
value: string;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
// `
|
|
35
|
+
// Pins the sheet's row type — `data` can be undefined mid-close, which
|
|
36
|
+
// blocks inference at the call site.
|
|
36
37
|
const BottomSheet = UIBottomSheet as ComponentType<
|
|
37
|
-
|
|
38
|
-
isVisible: boolean | null;
|
|
39
|
-
}
|
|
38
|
+
BottomSheetProps<RoleSheetItem>
|
|
40
39
|
>;
|
|
41
40
|
|
|
42
41
|
interface ProductSelectProps {
|
|
@@ -52,7 +51,7 @@ const ProductSelect = ({
|
|
|
52
51
|
setFieldValue,
|
|
53
52
|
}: ProductSelectProps) => {
|
|
54
53
|
const otherProducts = values?.otherProducts ?? true;
|
|
55
|
-
const [openDropdown, setOpenDropdown] = useState
|
|
54
|
+
const [openDropdown, setOpenDropdown] = useState(false);
|
|
56
55
|
const [selectedAppName, setSelectedAppName] = useState<string | null>(null);
|
|
57
56
|
|
|
58
57
|
const updateProduct = (appName: string, object: Partial<ProductRole>) => {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React, { useCallback, useState } from "react";
|
|
2
2
|
import { StyleSheet } from "react-native";
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import Delete from "@bigbinary/neeto-icons-rn/icons/Delete";
|
|
5
|
+
import Edit from "@bigbinary/neeto-icons-rn/icons/Edit";
|
|
5
6
|
import {
|
|
6
7
|
Container,
|
|
7
8
|
Divider,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { _findBy, notEquals } from "@bigbinary/neeto-cist";
|
|
2
|
-
import
|
|
2
|
+
import equals from "ramda/src/equals";
|
|
3
|
+
import includes from "ramda/src/includes";
|
|
4
|
+
import move from "ramda/src/move";
|
|
3
5
|
|
|
4
6
|
import { ADMIN_ROLE_NAME, ADMIN_ROLES, APP_NAME } from "./constants";
|
|
5
7
|
|
package/src/store/index.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
configureStore,
|
|
4
|
+
type StoreEnhancer,
|
|
5
|
+
type UnknownAction,
|
|
6
|
+
} from "@reduxjs/toolkit";
|
|
3
7
|
import {
|
|
4
8
|
persistStore,
|
|
5
9
|
persistReducer,
|
|
@@ -27,6 +31,67 @@ const persistConfig: PersistConfig<CommonsState> = {
|
|
|
27
31
|
|
|
28
32
|
const persistedReducer = persistReducer(persistConfig, rootReducer);
|
|
29
33
|
|
|
34
|
+
// The enhancer must exist when configureStore runs — at module-import time —
|
|
35
|
+
// so the store wires it itself; host apps could never inject it early enough.
|
|
36
|
+
// The guarded require keeps hosts without the plugin working (it is a dev
|
|
37
|
+
// tool the host may not install), and metro strips the whole branch from
|
|
38
|
+
// release bundles because __DEV__ is inlined before dependency collection.
|
|
39
|
+
const devToolsEnhancers = () => {
|
|
40
|
+
if (__DEV__) {
|
|
41
|
+
try {
|
|
42
|
+
// The require is untyped on purpose (consistent-type-imports forbids
|
|
43
|
+
// import() annotations); cast just the surface used here.
|
|
44
|
+
const { rozeniteDevToolsEnhancer } =
|
|
45
|
+
require("@rozenite/redux-devtools-plugin") as {
|
|
46
|
+
rozeniteDevToolsEnhancer: (options: {
|
|
47
|
+
name?: string;
|
|
48
|
+
maxAge?: number;
|
|
49
|
+
actionSanitizer?: (action: UnknownAction, id: number) => unknown;
|
|
50
|
+
stateSanitizer?: (state: unknown, index: number) => unknown;
|
|
51
|
+
}) => StoreEnhancer;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// The workspace switcher keeps a per-organization auth token in the
|
|
55
|
+
// store (every other credential lives in the keychain). The DevTools
|
|
56
|
+
// bridge rides metro's websocket, so those tokens must not cross it.
|
|
57
|
+
const redactOrganizationTokens = (state: unknown) => {
|
|
58
|
+
const snapshot = state as CommonsState | undefined;
|
|
59
|
+
if (!snapshot?.auth?.organizations?.length) return state;
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
...snapshot,
|
|
63
|
+
auth: {
|
|
64
|
+
...snapshot.auth,
|
|
65
|
+
organizations: snapshot.auth.organizations.map(organization => ({
|
|
66
|
+
...organization,
|
|
67
|
+
auth_token: "<<redacted>>",
|
|
68
|
+
})),
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
return [
|
|
74
|
+
rozeniteDevToolsEnhancer({
|
|
75
|
+
name: "neeto-commons-rn store",
|
|
76
|
+
// The whole persisted tree rides through REHYDRATE; big snapshots
|
|
77
|
+
// can OOM the Android DevTools panel, so cap history and elide the
|
|
78
|
+
// payload.
|
|
79
|
+
maxAge: 25,
|
|
80
|
+
actionSanitizer: action =>
|
|
81
|
+
action.type === REHYDRATE
|
|
82
|
+
? { ...action, payload: "<<elided: persisted state>>" }
|
|
83
|
+
: action,
|
|
84
|
+
stateSanitizer: redactOrganizationTokens,
|
|
85
|
+
}),
|
|
86
|
+
];
|
|
87
|
+
} catch {
|
|
88
|
+
return [];
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return [];
|
|
93
|
+
};
|
|
94
|
+
|
|
30
95
|
const baseStore = configureStore({
|
|
31
96
|
reducer: persistedReducer,
|
|
32
97
|
middleware: getDefaultMiddleware =>
|
|
@@ -35,6 +100,8 @@ const baseStore = configureStore({
|
|
|
35
100
|
ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER],
|
|
36
101
|
},
|
|
37
102
|
}),
|
|
103
|
+
enhancers: getDefaultEnhancers =>
|
|
104
|
+
getDefaultEnhancers().concat(devToolsEnhancers()),
|
|
38
105
|
});
|
|
39
106
|
const Persistor = persistStore(baseStore);
|
|
40
107
|
|
package/src/utils/apiHelpers.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
// `appName` doubles as user-facing copy ("Update neetoDesk"), so it keeps its
|
|
2
|
+
// camel case. Hosts are case-insensitive, but the mixed-case spelling shows up
|
|
3
|
+
// verbatim in request logs and Bugsnag error groups, so lowercase it here.
|
|
1
4
|
export const appVersionsUrl = ({
|
|
2
5
|
appName,
|
|
3
6
|
environment,
|
|
4
7
|
}: {
|
|
5
8
|
appName: string;
|
|
6
9
|
environment: string;
|
|
7
|
-
}) => `https://api.${appName}.${environment}/app_versions`;
|
|
10
|
+
}) => `https://api.${appName.toLowerCase()}.${environment}/app_versions`;
|