@rownd/react-native 0.2.5 → 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/LICENSE +1 -2
- package/README.md +34 -52
- package/android/build.gradle +127 -37
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/com/reactnativerowndplugin/RowndPluginModule.kt +98 -0
- package/android/src/main/java/com/reactnativerowndplugin/RowndPluginPackage.kt +16 -0
- package/ios/{ReactNative.xcodeproj → Rownd.xcodeproj}/project.pbxproj +13 -12
- package/ios/RowndPlugin-Bridging-Header.h +3 -0
- package/ios/RowndPlugin.m +26 -0
- package/ios/RowndPlugin.swift +83 -0
- package/ios/RowndPluginEventEmitter.m +12 -0
- package/ios/RowndPluginEventEmitter.swift +19 -0
- package/lib/commonjs/components/GlobalContext.js +32 -298
- package/lib/commonjs/components/GlobalContext.js.map +1 -1
- package/lib/commonjs/components/{BottomSheetTextInput/types.js → GlobalContext.types.js} +1 -1
- package/lib/commonjs/components/GlobalContext.types.js.map +1 -0
- package/lib/commonjs/constants/action.js +13 -0
- package/lib/commonjs/constants/action.js.map +1 -0
- package/lib/commonjs/hooks/rownd.js +15 -146
- package/lib/commonjs/hooks/rownd.js.map +1 -1
- package/lib/commonjs/index.js +2 -12
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/reducer/rowndReducer.js +89 -0
- package/lib/commonjs/reducer/rowndReducer.js.map +1 -0
- package/lib/commonjs/utils/config.js +0 -26
- package/lib/commonjs/utils/config.js.map +1 -1
- package/lib/commonjs/utils/nativeModule.js +72 -0
- package/lib/commonjs/utils/nativeModule.js.map +1 -0
- package/lib/module/components/GlobalContext.js +30 -293
- package/lib/module/components/GlobalContext.js.map +1 -1
- package/lib/module/components/GlobalContext.types.js +2 -0
- package/lib/module/components/GlobalContext.types.js.map +1 -0
- package/lib/module/constants/action.js +6 -0
- package/lib/module/constants/action.js.map +1 -0
- package/lib/module/hooks/rownd.js +12 -137
- package/lib/module/hooks/rownd.js.map +1 -1
- package/lib/module/index.js +2 -4
- package/lib/module/index.js.map +1 -1
- package/lib/module/reducer/rowndReducer.js +78 -0
- package/lib/module/reducer/rowndReducer.js.map +1 -0
- package/lib/module/utils/config.js +1 -16
- package/lib/module/utils/config.js.map +1 -1
- package/lib/module/utils/nativeModule.js +48 -0
- package/lib/module/utils/nativeModule.js.map +1 -0
- package/lib/typescript/components/GlobalContext.d.ts +13 -0
- package/lib/typescript/{src/components/GlobalContext.d.ts → components/GlobalContext.types.d.ts} +9 -35
- package/lib/typescript/constants/action.d.ts +7 -0
- package/lib/typescript/{src/hooks → hooks}/rownd.d.ts +10 -13
- package/lib/typescript/index.d.ts +3 -0
- package/lib/typescript/reducer/rowndReducer.d.ts +4 -0
- package/lib/typescript/utils/config.d.ts +10 -0
- package/lib/typescript/utils/nativeModule.d.ts +10 -0
- package/package.json +36 -56
- package/rownd-react-native.podspec +36 -0
- package/src/components/GlobalContext.tsx +47 -457
- package/src/components/GlobalContext.types.ts +105 -0
- package/src/constants/action.ts +8 -0
- package/src/hooks/rownd.ts +29 -147
- package/src/index.tsx +2 -4
- package/src/reducer/rowndReducer.ts +78 -0
- package/src/utils/config.ts +0 -27
- package/src/utils/nativeModule.ts +69 -0
- package/android/src/main/java/com/reactnative/ReactNativePackage.java +0 -22
- package/android/src/main/java/com/reactnative/ReactNativeViewManager.java +0 -31
- package/ios/ReactNativeViewManager.m +0 -34
- package/lib/commonjs/assets/images/checkmark--filled.svg +0 -12
- package/lib/commonjs/assets/images/email-verify-waiting.svg +0 -36
- package/lib/commonjs/assets/images/error-icon-material.svg +0 -1
- package/lib/commonjs/assets/images/phone-verify-waiting.svg +0 -26
- package/lib/commonjs/components/AuthenticatedComponent.js +0 -35
- package/lib/commonjs/components/AuthenticatedComponent.js.map +0 -1
- package/lib/commonjs/components/AutoSigninDialog.js +0 -132
- package/lib/commonjs/components/AutoSigninDialog.js.map +0 -1
- package/lib/commonjs/components/BottomSheetTextInput/BottomSheetTextInput.js +0 -65
- package/lib/commonjs/components/BottomSheetTextInput/BottomSheetTextInput.js.map +0 -1
- package/lib/commonjs/components/BottomSheetTextInput/index.js +0 -24
- package/lib/commonjs/components/BottomSheetTextInput/index.js.map +0 -1
- package/lib/commonjs/components/BottomSheetTextInput/types.js.map +0 -1
- package/lib/commonjs/components/DarkText.js +0 -35
- package/lib/commonjs/components/DarkText.js.map +0 -1
- package/lib/commonjs/components/DefaultContext.js +0 -266
- package/lib/commonjs/components/DefaultContext.js.map +0 -1
- package/lib/commonjs/components/RowndComponents.js +0 -25
- package/lib/commonjs/components/RowndComponents.js.map +0 -1
- package/lib/commonjs/components/RowndProvider.js +0 -55
- package/lib/commonjs/components/RowndProvider.js.map +0 -1
- package/lib/commonjs/components/SignIn.js +0 -644
- package/lib/commonjs/components/SignIn.js.map +0 -1
- package/lib/commonjs/components/images/CheckmarkFilled.js +0 -40
- package/lib/commonjs/components/images/CheckmarkFilled.js.map +0 -1
- package/lib/commonjs/components/images/EmailVerifyWaiting.js +0 -100
- package/lib/commonjs/components/images/EmailVerifyWaiting.js.map +0 -1
- package/lib/commonjs/components/images/ErrorIcon.js +0 -31
- package/lib/commonjs/components/images/ErrorIcon.js.map +0 -1
- package/lib/commonjs/components/images/PhoneVerifyWaiting.js +0 -91
- package/lib/commonjs/components/images/PhoneVerifyWaiting.js.map +0 -1
- package/lib/commonjs/data/actions.js +0 -26
- package/lib/commonjs/data/actions.js.map +0 -1
- package/lib/commonjs/hooks/api.js +0 -155
- package/lib/commonjs/hooks/api.js.map +0 -1
- package/lib/commonjs/hooks/debounce.js +0 -38
- package/lib/commonjs/hooks/debounce.js.map +0 -1
- package/lib/commonjs/hooks/fingerprint.js +0 -176
- package/lib/commonjs/hooks/fingerprint.js.map +0 -1
- package/lib/commonjs/hooks/index.js +0 -48
- package/lib/commonjs/hooks/index.js.map +0 -1
- package/lib/commonjs/hooks/interval.js +0 -31
- package/lib/commonjs/hooks/interval.js.map +0 -1
- package/lib/commonjs/hooks/nav.js +0 -39
- package/lib/commonjs/hooks/nav.js.map +0 -1
- package/lib/commonjs/index.tsx.bak +0 -26
- package/lib/commonjs/types.js +0 -2
- package/lib/commonjs/types.js.map +0 -1
- package/lib/commonjs/utils/events.js +0 -57
- package/lib/commonjs/utils/events.js.map +0 -1
- package/lib/commonjs/utils/form.js +0 -46
- package/lib/commonjs/utils/form.js.map +0 -1
- package/lib/commonjs/utils/queue.js +0 -117
- package/lib/commonjs/utils/queue.js.map +0 -1
- package/lib/commonjs/utils/storage.js +0 -15
- package/lib/commonjs/utils/storage.js.map +0 -1
- package/lib/commonjs/utils/tokens.js +0 -35
- package/lib/commonjs/utils/tokens.js.map +0 -1
- package/lib/commonjs/utils/user-data.js +0 -21
- package/lib/commonjs/utils/user-data.js.map +0 -1
- package/lib/module/assets/images/checkmark--filled.svg +0 -12
- package/lib/module/assets/images/email-verify-waiting.svg +0 -36
- package/lib/module/assets/images/error-icon-material.svg +0 -1
- package/lib/module/assets/images/phone-verify-waiting.svg +0 -26
- package/lib/module/components/AuthenticatedComponent.js +0 -24
- package/lib/module/components/AuthenticatedComponent.js.map +0 -1
- package/lib/module/components/AutoSigninDialog.js +0 -110
- package/lib/module/components/AutoSigninDialog.js.map +0 -1
- package/lib/module/components/BottomSheetTextInput/BottomSheetTextInput.js +0 -52
- package/lib/module/components/BottomSheetTextInput/BottomSheetTextInput.js.map +0 -1
- package/lib/module/components/BottomSheetTextInput/index.js +0 -5
- package/lib/module/components/BottomSheetTextInput/index.js.map +0 -1
- package/lib/module/components/BottomSheetTextInput/types.js +0 -2
- package/lib/module/components/BottomSheetTextInput/types.js.map +0 -1
- package/lib/module/components/DarkText.js +0 -24
- package/lib/module/components/DarkText.js.map +0 -1
- package/lib/module/components/DefaultContext.js +0 -244
- package/lib/module/components/DefaultContext.js.map +0 -1
- package/lib/module/components/RowndComponents.js +0 -12
- package/lib/module/components/RowndComponents.js.map +0 -1
- package/lib/module/components/RowndProvider.js +0 -39
- package/lib/module/components/RowndProvider.js.map +0 -1
- package/lib/module/components/SignIn.js +0 -616
- package/lib/module/components/SignIn.js.map +0 -1
- package/lib/module/components/images/CheckmarkFilled.js +0 -27
- package/lib/module/components/images/CheckmarkFilled.js.map +0 -1
- package/lib/module/components/images/EmailVerifyWaiting.js +0 -87
- package/lib/module/components/images/EmailVerifyWaiting.js.map +0 -1
- package/lib/module/components/images/ErrorIcon.js +0 -18
- package/lib/module/components/images/ErrorIcon.js.map +0 -1
- package/lib/module/components/images/PhoneVerifyWaiting.js +0 -78
- package/lib/module/components/images/PhoneVerifyWaiting.js.map +0 -1
- package/lib/module/data/actions.js +0 -19
- package/lib/module/data/actions.js.map +0 -1
- package/lib/module/hooks/api.js +0 -135
- package/lib/module/hooks/api.js.map +0 -1
- package/lib/module/hooks/debounce.js +0 -29
- package/lib/module/hooks/debounce.js.map +0 -1
- package/lib/module/hooks/fingerprint.js +0 -157
- package/lib/module/hooks/fingerprint.js.map +0 -1
- package/lib/module/hooks/index.js +0 -7
- package/lib/module/hooks/index.js.map +0 -1
- package/lib/module/hooks/interval.js +0 -23
- package/lib/module/hooks/interval.js.map +0 -1
- package/lib/module/hooks/nav.js +0 -30
- package/lib/module/hooks/nav.js.map +0 -1
- package/lib/module/index.tsx.bak +0 -26
- package/lib/module/types.js +0 -2
- package/lib/module/types.js.map +0 -1
- package/lib/module/utils/events.js +0 -45
- package/lib/module/utils/events.js.map +0 -1
- package/lib/module/utils/form.js +0 -34
- package/lib/module/utils/form.js.map +0 -1
- package/lib/module/utils/queue.js +0 -109
- package/lib/module/utils/queue.js.map +0 -1
- package/lib/module/utils/storage.js +0 -6
- package/lib/module/utils/storage.js.map +0 -1
- package/lib/module/utils/tokens.js +0 -24
- package/lib/module/utils/tokens.js.map +0 -1
- package/lib/module/utils/user-data.js +0 -14
- package/lib/module/utils/user-data.js.map +0 -1
- package/lib/package.json +0 -173
- package/lib/typescript/src/components/AuthenticatedComponent.d.ts +0 -7
- package/lib/typescript/src/components/AutoSigninDialog.d.ts +0 -2
- package/lib/typescript/src/components/BottomSheetTextInput/BottomSheetTextInput.d.ts +0 -4
- package/lib/typescript/src/components/BottomSheetTextInput/index.d.ts +0 -2
- package/lib/typescript/src/components/BottomSheetTextInput/types.d.ts +0 -3
- package/lib/typescript/src/components/DarkText.d.ts +0 -3
- package/lib/typescript/src/components/DefaultContext.d.ts +0 -12
- package/lib/typescript/src/components/RowndComponents.d.ts +0 -2
- package/lib/typescript/src/components/RowndProvider.d.ts +0 -8
- package/lib/typescript/src/components/SignIn.d.ts +0 -2
- package/lib/typescript/src/components/images/CheckmarkFilled.d.ts +0 -4
- package/lib/typescript/src/components/images/EmailVerifyWaiting.d.ts +0 -4
- package/lib/typescript/src/components/images/ErrorIcon.d.ts +0 -4
- package/lib/typescript/src/components/images/PhoneVerifyWaiting.d.ts +0 -4
- package/lib/typescript/src/data/actions.d.ts +0 -20
- package/lib/typescript/src/hooks/api.d.ts +0 -12
- package/lib/typescript/src/hooks/debounce.d.ts +0 -5
- package/lib/typescript/src/hooks/fingerprint.d.ts +0 -12
- package/lib/typescript/src/hooks/index.d.ts +0 -6
- package/lib/typescript/src/hooks/interval.d.ts +0 -2
- package/lib/typescript/src/hooks/nav.d.ts +0 -6
- package/lib/typescript/src/index.d.ts +0 -4
- package/lib/typescript/src/types.d.ts +0 -26
- package/lib/typescript/src/utils/config.d.ts +0 -18
- package/lib/typescript/src/utils/events.d.ts +0 -22
- package/lib/typescript/src/utils/form.d.ts +0 -18
- package/lib/typescript/src/utils/queue.d.ts +0 -21
- package/lib/typescript/src/utils/storage.d.ts +0 -3
- package/lib/typescript/src/utils/tokens.d.ts +0 -4
- package/lib/typescript/src/utils/user-data.d.ts +0 -3
- package/react-native.podspec +0 -19
- package/src/assets/images/checkmark--filled.svg +0 -12
- package/src/assets/images/email-verify-waiting.svg +0 -36
- package/src/assets/images/error-icon-material.svg +0 -1
- package/src/assets/images/phone-verify-waiting.svg +0 -26
- package/src/components/AuthenticatedComponent.tsx +0 -30
- package/src/components/AutoSigninDialog.tsx +0 -131
- package/src/components/BottomSheetTextInput/BottomSheetTextInput.tsx +0 -57
- package/src/components/BottomSheetTextInput/index.ts +0 -5
- package/src/components/BottomSheetTextInput/types.ts +0 -3
- package/src/components/DarkText.tsx +0 -16
- package/src/components/DefaultContext.tsx +0 -278
- package/src/components/RowndComponents.tsx +0 -18
- package/src/components/RowndProvider.tsx +0 -56
- package/src/components/SignIn.tsx +0 -797
- package/src/components/images/CheckmarkFilled.tsx +0 -30
- package/src/components/images/EmailVerifyWaiting.tsx +0 -95
- package/src/components/images/ErrorIcon.tsx +0 -11
- package/src/components/images/PhoneVerifyWaiting.tsx +0 -74
- package/src/data/actions.ts +0 -21
- package/src/hooks/api.ts +0 -162
- package/src/hooks/debounce.ts +0 -36
- package/src/hooks/fingerprint.ts +0 -217
- package/src/hooks/index.ts +0 -7
- package/src/hooks/interval.ts +0 -25
- package/src/hooks/nav.tsx +0 -29
- package/src/index.tsx.bak +0 -26
- package/src/types.ts +0 -27
- package/src/utils/events.ts +0 -54
- package/src/utils/form.tsx +0 -64
- package/src/utils/queue.ts +0 -75
- package/src/utils/storage.ts +0 -7
- package/src/utils/tokens.ts +0 -26
- package/src/utils/user-data.ts +0 -15
package/src/hooks/nav.tsx
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { useGlobalContext } from '../components/GlobalContext';
|
|
2
|
-
import { ActionType } from '../data/actions';
|
|
3
|
-
|
|
4
|
-
interface INavOpts {
|
|
5
|
-
route?: string;
|
|
6
|
-
hide?: boolean;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export default function useNav() {
|
|
10
|
-
const { dispatch } = useGlobalContext();
|
|
11
|
-
|
|
12
|
-
return ({ route, hide }: INavOpts) => {
|
|
13
|
-
if (hide) {
|
|
14
|
-
dispatch({
|
|
15
|
-
type: ActionType.SET_CONTAINER_VISIBLE,
|
|
16
|
-
payload: {
|
|
17
|
-
isVisible: false,
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
} else if (route) {
|
|
21
|
-
dispatch({
|
|
22
|
-
type: ActionType.CHANGE_ROUTE,
|
|
23
|
-
payload: {
|
|
24
|
-
current_route: route,
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
}
|
package/src/index.tsx.bak
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
requireNativeComponent,
|
|
3
|
-
UIManager,
|
|
4
|
-
Platform,
|
|
5
|
-
ViewStyle,
|
|
6
|
-
} from 'react-native';
|
|
7
|
-
|
|
8
|
-
const LINKING_ERROR =
|
|
9
|
-
`The package '@rownd/react-native' doesn't seem to be linked. Make sure: \n\n` +
|
|
10
|
-
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
11
|
-
'- You rebuilt the app after installing the package\n' +
|
|
12
|
-
'- You are not using Expo managed workflow\n';
|
|
13
|
-
|
|
14
|
-
type ReactNativeProps = {
|
|
15
|
-
color: string;
|
|
16
|
-
style: ViewStyle;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const ComponentName = 'ReactNativeView';
|
|
20
|
-
|
|
21
|
-
export const ReactNativeView =
|
|
22
|
-
UIManager.getViewManagerConfig(ComponentName) != null
|
|
23
|
-
? requireNativeComponent<ReactNativeProps>(ComponentName)
|
|
24
|
-
: () => {
|
|
25
|
-
throw new Error(LINKING_ERROR);
|
|
26
|
-
};
|
package/src/types.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export type TRowndContext = {
|
|
2
|
-
requestSignIn: Function;
|
|
3
|
-
signOut: Function;
|
|
4
|
-
getAccessToken: Function;
|
|
5
|
-
is_authenticated: boolean;
|
|
6
|
-
is_initializing: boolean;
|
|
7
|
-
access_token: string | null;
|
|
8
|
-
auth: AuthContext;
|
|
9
|
-
user: UserContext;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
type AuthContext = {
|
|
13
|
-
access_token: string | null;
|
|
14
|
-
app_id?: string;
|
|
15
|
-
is_authenticated: boolean;
|
|
16
|
-
is_verified_user?: boolean;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
type UserContext = {
|
|
20
|
-
data: {
|
|
21
|
-
id?: string;
|
|
22
|
-
email?: string | null;
|
|
23
|
-
phone?: string | null;
|
|
24
|
-
[key: string]: any;
|
|
25
|
-
};
|
|
26
|
-
redacted_fields: string[];
|
|
27
|
-
};
|
package/src/utils/events.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import EventEmitter from 'eventemitter3';
|
|
2
|
-
const bus = new EventEmitter();
|
|
3
|
-
|
|
4
|
-
export enum EventType {
|
|
5
|
-
AUTH = 'auth',
|
|
6
|
-
SIGN_OUT = 'sign_out',
|
|
7
|
-
USER_DATA = 'user_data',
|
|
8
|
-
USER_DATA_SAVED = 'user_data_saved',
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export type TAuthEvent = {
|
|
12
|
-
access_token: string;
|
|
13
|
-
user_id: string;
|
|
14
|
-
app_id: string;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
type EventListenerOptions = {
|
|
18
|
-
once?: boolean;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const events = {
|
|
22
|
-
addEventListener: (
|
|
23
|
-
type: string,
|
|
24
|
-
callback: (...args: any[]) => void | null,
|
|
25
|
-
options?: boolean | EventListenerOptions | undefined
|
|
26
|
-
): void => {
|
|
27
|
-
if (!Object.values<string>(EventType).includes(type)) {
|
|
28
|
-
console.warn(`Unknown event type: ${type}`);
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
let busFn = bus.on;
|
|
33
|
-
if (options === true || (options as EventListenerOptions)?.once) {
|
|
34
|
-
busFn = bus.once;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
busFn.apply(bus, [type, callback, options]);
|
|
38
|
-
},
|
|
39
|
-
removeEventListener: bus.removeListener,
|
|
40
|
-
dispatchEvent: (event: CustomEvent): boolean => {
|
|
41
|
-
if (!Object.values<string>(EventType).includes(event.type)) {
|
|
42
|
-
throw new Error(`Unknown event type: ${event.type}`);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return bus.emit(event.type, event.detail);
|
|
46
|
-
},
|
|
47
|
-
dispatch(type: EventType, data: any): boolean {
|
|
48
|
-
if (!Object.values<string>(EventType).includes(type)) {
|
|
49
|
-
throw new Error(`Unknown event type: ${type}`);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return bus.emit(type, data);
|
|
53
|
-
},
|
|
54
|
-
};
|
package/src/utils/form.tsx
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { Text, TextInput } from 'react-native';
|
|
2
|
-
import { Picker } from '@react-native-picker/picker';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
|
|
5
|
-
type FormFieldProps = {
|
|
6
|
-
id?: string;
|
|
7
|
-
name: string;
|
|
8
|
-
value?: string;
|
|
9
|
-
type?: string;
|
|
10
|
-
label?: string;
|
|
11
|
-
placeholder?: string;
|
|
12
|
-
options?:
|
|
13
|
-
| [
|
|
14
|
-
{
|
|
15
|
-
value: string;
|
|
16
|
-
label: string;
|
|
17
|
-
}
|
|
18
|
-
]
|
|
19
|
-
| null;
|
|
20
|
-
onChange?: (value: string) => void;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export function renderField({
|
|
24
|
-
id,
|
|
25
|
-
label = '',
|
|
26
|
-
name,
|
|
27
|
-
type = 'input',
|
|
28
|
-
value,
|
|
29
|
-
placeholder,
|
|
30
|
-
options = null,
|
|
31
|
-
onChange,
|
|
32
|
-
}: FormFieldProps) {
|
|
33
|
-
if (!id) {
|
|
34
|
-
id = `rph-input-${name}`;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<>
|
|
39
|
-
{label && <Text>{label}</Text>}
|
|
40
|
-
|
|
41
|
-
{type === 'select' && (
|
|
42
|
-
<Picker
|
|
43
|
-
onValueChange={onChange}
|
|
44
|
-
selectedValue={value || options?.[0]?.value}
|
|
45
|
-
>
|
|
46
|
-
{options?.map((opt) => (
|
|
47
|
-
<Picker.Item value={opt.value} key={opt.value}>
|
|
48
|
-
{' '}
|
|
49
|
-
{opt.label}{' '}
|
|
50
|
-
</Picker.Item>
|
|
51
|
-
))}
|
|
52
|
-
</Picker>
|
|
53
|
-
)}
|
|
54
|
-
|
|
55
|
-
{type === 'input' && (
|
|
56
|
-
<TextInput
|
|
57
|
-
value={value}
|
|
58
|
-
placeholder={placeholder}
|
|
59
|
-
onChangeText={onChange}
|
|
60
|
-
/>
|
|
61
|
-
)}
|
|
62
|
-
</>
|
|
63
|
-
);
|
|
64
|
-
}
|
package/src/utils/queue.ts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
// import { logger } from "./utils/log";
|
|
2
|
-
|
|
3
|
-
let count = 0;
|
|
4
|
-
|
|
5
|
-
type QueueItem = {
|
|
6
|
-
action: () => Promise<any>;
|
|
7
|
-
resolve: (value?: any) => void;
|
|
8
|
-
reject: (reason?: any) => void;
|
|
9
|
-
count: number;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
class Queue {
|
|
13
|
-
#_items: any[];
|
|
14
|
-
constructor() {
|
|
15
|
-
this.#_items = [];
|
|
16
|
-
}
|
|
17
|
-
enqueue(item: QueueItem | (() => Promise<any>)) {
|
|
18
|
-
this.#_items.push(item);
|
|
19
|
-
}
|
|
20
|
-
dequeue(): any {
|
|
21
|
-
return this.#_items.shift();
|
|
22
|
-
}
|
|
23
|
-
get size() {
|
|
24
|
-
return this.#_items.length;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
class AutoQueue<T> extends Queue {
|
|
29
|
-
_cache: Record<string, unknown>;
|
|
30
|
-
#_pendingPromise: boolean;
|
|
31
|
-
constructor() {
|
|
32
|
-
super();
|
|
33
|
-
this.#_pendingPromise = false;
|
|
34
|
-
this._cache = {};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
enqueue(action: () => Promise<any>): Promise<T> {
|
|
38
|
-
return new Promise((resolve, reject) => {
|
|
39
|
-
super.enqueue({ action, resolve, reject, count: count++ });
|
|
40
|
-
// logger.log('queued', count);
|
|
41
|
-
this.dequeue();
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
async dequeue() {
|
|
46
|
-
if (this.#_pendingPromise) return false;
|
|
47
|
-
|
|
48
|
-
const item = super.dequeue();
|
|
49
|
-
|
|
50
|
-
if (!item) {
|
|
51
|
-
this._cache = {};
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// logger.log('dequeued', item.count);
|
|
56
|
-
|
|
57
|
-
try {
|
|
58
|
-
this.#_pendingPromise = true;
|
|
59
|
-
|
|
60
|
-
const payload = await item.action(this);
|
|
61
|
-
|
|
62
|
-
this.#_pendingPromise = false;
|
|
63
|
-
item.resolve(payload);
|
|
64
|
-
} catch (e) {
|
|
65
|
-
this.#_pendingPromise = false;
|
|
66
|
-
item.reject(e);
|
|
67
|
-
} finally {
|
|
68
|
-
this.dequeue();
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return true;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export default AutoQueue;
|
package/src/utils/storage.ts
DELETED
package/src/utils/tokens.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import jwt_decode from 'jwt-decode';
|
|
2
|
-
|
|
3
|
-
type TokenInput = Record<string, any> | string;
|
|
4
|
-
|
|
5
|
-
// Make sure token is always in a decoded form
|
|
6
|
-
function normalizeToken(token: TokenInput): Record<string, any> {
|
|
7
|
-
if (typeof token === 'string') {
|
|
8
|
-
return jwt_decode(token);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return token;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function getAppId(token: TokenInput) {
|
|
15
|
-
token = normalizeToken(token);
|
|
16
|
-
|
|
17
|
-
return token?.aud
|
|
18
|
-
?.find((aud: string) => aud.startsWith('app:'))
|
|
19
|
-
?.substring(4);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function getUserId(token: TokenInput) {
|
|
23
|
-
token = normalizeToken(token);
|
|
24
|
-
|
|
25
|
-
return token?.sub;
|
|
26
|
-
}
|
package/src/utils/user-data.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export function redactUserDataWithAcls(
|
|
2
|
-
userData: Record<string, any> | undefined | null,
|
|
3
|
-
acls: Record<string, { shared: boolean }> | undefined | null
|
|
4
|
-
): Record<string, any> {
|
|
5
|
-
if (!userData) {
|
|
6
|
-
return {};
|
|
7
|
-
}
|
|
8
|
-
return Object.entries(userData).reduce(
|
|
9
|
-
(acc: Record<string, any>, [key, value]) => {
|
|
10
|
-
acc[key] = !acls?.[key] || acls?.[key]?.shared ? value : 'ROWND_REDACTED';
|
|
11
|
-
return acc;
|
|
12
|
-
},
|
|
13
|
-
{}
|
|
14
|
-
);
|
|
15
|
-
}
|