@rownd/react-native 0.2.5 → 2.1.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 +15 -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/Rownd.xcodeproj/project.xcworkspace/contents.xcworkspacedata +4 -0
- 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 +30 -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 +29 -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 +44 -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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["GlobalContext.types.ts"],"sourcesContent":["import type { TAction } from '../constants/action';\nimport type { IConfig } from '../utils/config';\n\nexport type ContextProps = {\n config: IConfig;\n};\n\nexport type Dispatch = (action: TAction) => void;\n\nexport type GlobalState = {\n // is_initializing: boolean;\n // is_container_visible: boolean;\n // use_modal: boolean;\n // nav: {\n // current_route: string;\n // route_trigger: string;\n // event_id: string;\n // section: string;\n // options?: any;\n // };\n user: {\n data: {\n id?: string;\n email?: string | null;\n [key: string]: any;\n };\n // needs_refresh?: boolean;\n // redacted: string[];\n };\n auth: {\n access_token: string | null;\n refresh_token: string | null;\n app_id: string | null;\n init_data?: Record<string, any>;\n is_verified_user?: boolean;\n };\n app: {\n id?: string;\n icon?: string;\n icon_content_type?: string;\n config: AppConfig | null;\n schema: AppSchema | null;\n user_verification_field?: string;\n user_verification_fields?: string[];\n };\n // local_acls: Record<string, { shared: boolean }> | null;\n // is_saving_user_data: boolean;\n config?: IConfig;\n};\n\ntype AppSchema = Record<string, SchemaField>;\n\nexport interface SchemaField {\n display_name: string;\n type: string;\n data_category: string;\n required: boolean;\n owned_by: string;\n user_visible: boolean;\n revoke_after: string;\n required_retention: string;\n collection_justification: string;\n opt_out_warning: string;\n}\n\nexport interface AppConfig {\n customizations: {\n primary_color: string;\n };\n default_user_id_format?: string;\n hub: {\n auth: {\n allow_unverified_users?: boolean;\n additional_fields: [\n {\n name: string;\n type: string;\n label: string;\n placeholder?: string;\n options: [\n {\n value: string;\n label: string;\n }\n ];\n }\n ];\n email: {\n from_address: string;\n image: string;\n };\n show_app_icon: boolean;\n };\n customizations: HubCustomizations;\n };\n}\n\nexport interface HubCustomizations {\n rounded_corners: boolean;\n primary_color: string;\n placement: 'bottom-left' | 'hidden';\n offset_x: number;\n offset_y: number;\n property_overrides: Record<string, string>;\n}\n"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ActionType"],"sources":["action.ts"],"sourcesContent":["export enum ActionType {\n UPDATE_STATE = 'UPDATE_STATE',\n}\n\nexport type TAction = {\n type: ActionType;\n payload?: any;\n};\n"],"mappings":"AAAA,WAAYA,UAAZ;;WAAYA,U;EAAAA,U;GAAAA,U,KAAAA,U"}
|
|
@@ -1,148 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import useApi from './api';
|
|
4
|
-
import { events, EventType } from '../utils/events';
|
|
5
|
-
// const RowndContext = createContext<TRowndContext | null>(null);
|
|
1
|
+
import { requestSignIn, signOut, manageAccount, getAccessToken, setUserDataValue, setUserData } from '../utils/nativeModule';
|
|
2
|
+
import { useRowndContext } from '../components/GlobalContext';
|
|
6
3
|
export function useRownd() {
|
|
7
|
-
var _state$auth, _state$user, _state$user2;
|
|
8
|
-
|
|
9
4
|
const {
|
|
10
|
-
state
|
|
11
|
-
|
|
12
|
-
} = useGlobalContext();
|
|
13
|
-
const {
|
|
14
|
-
isNewAccessTokenNeeded,
|
|
15
|
-
newAccessTokenFromRefreshToken
|
|
16
|
-
} = useApi();
|
|
17
|
-
const stateCopy = JSON.parse(JSON.stringify(state));
|
|
18
|
-
|
|
19
|
-
const requestSignIn = opts => {
|
|
20
|
-
dispatch({
|
|
21
|
-
type: ActionType.CHANGE_ROUTE,
|
|
22
|
-
payload: {
|
|
23
|
-
route: '/account/login',
|
|
24
|
-
options: opts
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const signOut = () => {
|
|
30
|
-
dispatch({
|
|
31
|
-
type: ActionType.SIGN_OUT
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const getAccessToken = async opts => {
|
|
36
|
-
const {
|
|
37
|
-
waitForToken
|
|
38
|
-
} = opts || {};
|
|
39
|
-
let accessToken = state === null || state === void 0 ? void 0 : state.auth.access_token; // Wait for an access token to be available if none exists yet
|
|
40
|
-
|
|
41
|
-
if (!accessToken && waitForToken) {
|
|
42
|
-
return new Promise((resolve, _reject) => {
|
|
43
|
-
console.debug('auth_wait: waiting for access token');
|
|
44
|
-
|
|
45
|
-
const listener = evt => {
|
|
46
|
-
console.debug('auth_wait: received access token');
|
|
47
|
-
const data = evt.detail;
|
|
48
|
-
resolve(data.access_token);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
events.addEventListener(EventType.AUTH, listener, {
|
|
52
|
-
once: true
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (isNewAccessTokenNeeded(undefined)) {
|
|
58
|
-
const resp = await newAccessTokenFromRefreshToken(stateCopy);
|
|
59
|
-
accessToken = resp.access_token;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return accessToken;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const setUserData = data => {
|
|
66
|
-
return new Promise((resolve, reject) => {
|
|
67
|
-
console.debug('user_data_save_wait: waiting for data to be saved');
|
|
68
|
-
|
|
69
|
-
const listener = evt => {
|
|
70
|
-
console.debug('user_data_save_wait: received data saved event');
|
|
71
|
-
|
|
72
|
-
if (evt.error) {
|
|
73
|
-
return reject(evt.error);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
resolve(evt.data);
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
events.addEventListener(EventType.USER_DATA_SAVED, listener, {
|
|
80
|
-
once: true
|
|
81
|
-
});
|
|
82
|
-
dispatch({
|
|
83
|
-
type: ActionType.SET_USER_DATA,
|
|
84
|
-
payload: {
|
|
85
|
-
data
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
const setUserDataValue = (key, value) => {
|
|
92
|
-
return new Promise((resolve, reject) => {
|
|
93
|
-
console.debug('user_data_save_wait: waiting for data to be saved');
|
|
94
|
-
|
|
95
|
-
const listener = evt => {
|
|
96
|
-
console.debug('user_data_save_wait: received data saved event');
|
|
97
|
-
|
|
98
|
-
if (evt.error) {
|
|
99
|
-
return reject(evt.error);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
resolve(evt.data);
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
events.addEventListener(EventType.USER_DATA_SAVED, listener, {
|
|
106
|
-
once: true
|
|
107
|
-
});
|
|
108
|
-
dispatch({
|
|
109
|
-
type: ActionType.SET_USER_DATA_FIELD,
|
|
110
|
-
payload: {
|
|
111
|
-
field: key,
|
|
112
|
-
value
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
if (value) {
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
const valueAcl = {
|
|
121
|
-
[key]: {
|
|
122
|
-
shared: true
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
dispatch({
|
|
126
|
-
type: ActionType.UPDATE_LOCAL_ACLS,
|
|
127
|
-
payload: valueAcl
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
};
|
|
131
|
-
|
|
5
|
+
state
|
|
6
|
+
} = useRowndContext();
|
|
132
7
|
return {
|
|
133
8
|
requestSignIn,
|
|
134
9
|
signOut,
|
|
10
|
+
manageAccount,
|
|
135
11
|
getAccessToken,
|
|
12
|
+
user: {
|
|
13
|
+
data: state.user.data,
|
|
14
|
+
setValue: setUserDataValue,
|
|
15
|
+
set: setUserData
|
|
16
|
+
},
|
|
136
17
|
is_authenticated: !!state.auth.access_token,
|
|
137
|
-
is_initializing: !!state.
|
|
138
|
-
access_token: (_state$auth = state.auth) === null || _state$auth === void 0 ? void 0 : _state$auth.access_token,
|
|
18
|
+
is_initializing: !!state.auth.app_id,
|
|
139
19
|
auth: state.auth,
|
|
140
|
-
|
|
141
|
-
data: (_state$user = state.user) === null || _state$user === void 0 ? void 0 : _state$user.data,
|
|
142
|
-
redacted_fields: (_state$user2 = state.user) === null || _state$user2 === void 0 ? void 0 : _state$user2.redacted,
|
|
143
|
-
set: setUserData,
|
|
144
|
-
setValue: setUserDataValue
|
|
145
|
-
}
|
|
20
|
+
access_token: state.auth.access_token
|
|
146
21
|
};
|
|
147
22
|
}
|
|
148
23
|
//# sourceMappingURL=rownd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["requestSignIn","signOut","manageAccount","getAccessToken","setUserDataValue","setUserData","useRowndContext","useRownd","state","user","data","setValue","set","is_authenticated","auth","access_token","is_initializing","app_id"],"sources":["rownd.ts"],"sourcesContent":["import {\n requestSignIn,\n signOut,\n manageAccount,\n getAccessToken,\n setUserDataValue,\n setUserData,\n} from '../utils/nativeModule';\nimport { useRowndContext } from '../components/GlobalContext';\n\nexport type TRowndContext = {\n requestSignIn: (opts?: RequestSignInOpts) => void;\n signOut: () => void;\n manageAccount: () => void;\n getAccessToken: () => Promise<string>;\n user: UserContext;\n is_authenticated: boolean;\n is_initializing: boolean;\n access_token: string | null;\n auth: AuthContext;\n};\n\ntype UserContext = {\n data: {\n id?: string;\n email?: string | null;\n phone?: string | null;\n [key: string]: any;\n };\n set: (data: Record<string, any>) => void;\n setValue: (key: string, value: any) => void;\n //set: (data: any) => void;\n};\n\ntype AuthContext = {\n access_token: string | null;\n app_id: string | null;\n is_verified_user?: boolean;\n};\n\ntype RequestSignInOpts = {\n identifier?: string;\n auto_sign_in?: boolean;\n init_data?: Record<string, any>;\n post_login_redirect?: string;\n};\n\nexport function useRownd(): TRowndContext {\n const { state } = useRowndContext();\n\n return {\n requestSignIn,\n signOut,\n manageAccount,\n getAccessToken,\n user: {\n data: state.user.data,\n setValue: setUserDataValue,\n set: setUserData,\n },\n is_authenticated: !!state.auth.access_token,\n is_initializing: !!state.auth.app_id,\n auth: state.auth,\n access_token: state.auth.access_token,\n };\n}\n"],"mappings":"AAAA,SACEA,aADF,EAEEC,OAFF,EAGEC,aAHF,EAIEC,cAJF,EAKEC,gBALF,EAMEC,WANF,QAOO,uBAPP;AAQA,SAASC,eAAT,QAAgC,6BAAhC;AAuCA,OAAO,SAASC,QAAT,GAAmC;EACxC,MAAM;IAAEC;EAAF,IAAYF,eAAe,EAAjC;EAEA,OAAO;IACLN,aADK;IAELC,OAFK;IAGLC,aAHK;IAILC,cAJK;IAKLM,IAAI,EAAE;MACJC,IAAI,EAAEF,KAAK,CAACC,IAAN,CAAWC,IADb;MAEJC,QAAQ,EAAEP,gBAFN;MAGJQ,GAAG,EAAEP;IAHD,CALD;IAULQ,gBAAgB,EAAE,CAAC,CAACL,KAAK,CAACM,IAAN,CAAWC,YAV1B;IAWLC,eAAe,EAAE,CAAC,CAACR,KAAK,CAACM,IAAN,CAAWG,MAXzB;IAYLH,IAAI,EAAEN,KAAK,CAACM,IAZP;IAaLC,YAAY,EAAEP,KAAK,CAACM,IAAN,CAAWC;EAbpB,CAAP;AAeD"}
|
package/lib/module/index.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { RowndProvider } from './components/RowndProvider';
|
|
1
|
+
import { RowndProvider } from './components/GlobalContext';
|
|
3
2
|
import { useRownd } from './hooks/rownd';
|
|
4
|
-
|
|
5
|
-
export { RowndProvider, useRownd, AuthenticatedComponent };
|
|
3
|
+
export { RowndProvider, useRownd };
|
|
6
4
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RowndProvider","useRownd"
|
|
1
|
+
{"version":3,"names":["RowndProvider","useRownd"],"sources":["index.tsx"],"sourcesContent":["import { RowndProvider } from './components/GlobalContext';\nimport { useRownd } from './hooks/rownd';\n\nexport { RowndProvider, useRownd };\n"],"mappings":"AAAA,SAASA,aAAT,QAA8B,4BAA9B;AACA,SAASC,QAAT,QAAyB,eAAzB;AAEA,SAASD,aAAT,EAAwBC,QAAxB"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { ActionType } from '../constants/action';
|
|
2
|
+
export const initialRowndState = {
|
|
3
|
+
// is_initializing: false,
|
|
4
|
+
// is_container_visible: false,
|
|
5
|
+
// use_modal: false,
|
|
6
|
+
// nav: {
|
|
7
|
+
// current_route: '/',
|
|
8
|
+
// route_trigger: '',
|
|
9
|
+
// event_id: '',
|
|
10
|
+
// section: '',
|
|
11
|
+
// options: {},
|
|
12
|
+
// },
|
|
13
|
+
user: {
|
|
14
|
+
data: {
|
|
15
|
+
email: null
|
|
16
|
+
} // needs_refresh: false,
|
|
17
|
+
// redacted: [],
|
|
18
|
+
|
|
19
|
+
},
|
|
20
|
+
auth: {
|
|
21
|
+
access_token: null,
|
|
22
|
+
refresh_token: null,
|
|
23
|
+
app_id: null
|
|
24
|
+
},
|
|
25
|
+
app: {
|
|
26
|
+
schema: null,
|
|
27
|
+
config: null
|
|
28
|
+
} // local_acls: null,
|
|
29
|
+
// is_saving_user_data: false,
|
|
30
|
+
// config,
|
|
31
|
+
|
|
32
|
+
};
|
|
33
|
+
export function rowndReducer(state, action) {
|
|
34
|
+
var _action$payload, _action$payload$user, _action$payload2, _action$payload2$user, _action$payload2$user2, _action$payload3, _action$payload3$auth, _action$payload4, _action$payload4$auth, _action$payload$appCo;
|
|
35
|
+
|
|
36
|
+
let newState;
|
|
37
|
+
|
|
38
|
+
switch (action.type) {
|
|
39
|
+
case ActionType.UPDATE_STATE:
|
|
40
|
+
newState = {
|
|
41
|
+
// is_initializing: false,
|
|
42
|
+
// is_container_visible: false,
|
|
43
|
+
// use_modal: false,
|
|
44
|
+
// nav: {
|
|
45
|
+
// current_route: '/',
|
|
46
|
+
// route_trigger: '',
|
|
47
|
+
// event_id: '',
|
|
48
|
+
// section: '',
|
|
49
|
+
// options: {},
|
|
50
|
+
// },
|
|
51
|
+
user: {
|
|
52
|
+
data: { ...((_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : (_action$payload$user = _action$payload.user) === null || _action$payload$user === void 0 ? void 0 : _action$payload$user.data),
|
|
53
|
+
email: (_action$payload2 = action.payload) === null || _action$payload2 === void 0 ? void 0 : (_action$payload2$user = _action$payload2.user) === null || _action$payload2$user === void 0 ? void 0 : (_action$payload2$user2 = _action$payload2$user.data) === null || _action$payload2$user2 === void 0 ? void 0 : _action$payload2$user2.email
|
|
54
|
+
} // needs_refresh: false,
|
|
55
|
+
// redacted: [],
|
|
56
|
+
|
|
57
|
+
},
|
|
58
|
+
auth: {
|
|
59
|
+
access_token: (_action$payload3 = action.payload) === null || _action$payload3 === void 0 ? void 0 : (_action$payload3$auth = _action$payload3.auth) === null || _action$payload3$auth === void 0 ? void 0 : _action$payload3$auth.access_token,
|
|
60
|
+
refresh_token: (_action$payload4 = action.payload) === null || _action$payload4 === void 0 ? void 0 : (_action$payload4$auth = _action$payload4.auth) === null || _action$payload4$auth === void 0 ? void 0 : _action$payload4$auth.refresh_token,
|
|
61
|
+
app_id: null
|
|
62
|
+
},
|
|
63
|
+
app: {
|
|
64
|
+
schema: (_action$payload$appCo = action.payload.appConfig) === null || _action$payload$appCo === void 0 ? void 0 : _action$payload$appCo.schema,
|
|
65
|
+
config: null
|
|
66
|
+
} // local_acls: null,
|
|
67
|
+
// is_saving_user_data: false,
|
|
68
|
+
// config
|
|
69
|
+
|
|
70
|
+
};
|
|
71
|
+
return newState;
|
|
72
|
+
|
|
73
|
+
default:
|
|
74
|
+
newState = state;
|
|
75
|
+
return newState;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=rowndReducer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ActionType","initialRowndState","user","data","email","auth","access_token","refresh_token","app_id","app","schema","config","rowndReducer","state","action","newState","type","UPDATE_STATE","payload","appConfig"],"sources":["rowndReducer.ts"],"sourcesContent":["import type { GlobalState } from '../components/GlobalContext.types';\nimport { ActionType, TAction } from '../constants/action';\n\nexport const initialRowndState: GlobalState = {\n // is_initializing: false,\n // is_container_visible: false,\n // use_modal: false,\n // nav: {\n // current_route: '/',\n // route_trigger: '',\n // event_id: '',\n // section: '',\n // options: {},\n // },\n user: {\n data: {\n email: null,\n },\n // needs_refresh: false,\n // redacted: [],\n },\n auth: {\n access_token: null,\n refresh_token: null,\n app_id: null,\n },\n app: {\n schema: null,\n config: null,\n },\n // local_acls: null,\n // is_saving_user_data: false,\n // config,\n};\n\nexport function rowndReducer(state: GlobalState, action: TAction): GlobalState {\n let newState: GlobalState;\n\n switch (action.type) {\n case ActionType.UPDATE_STATE:\n newState = {\n // is_initializing: false,\n // is_container_visible: false,\n // use_modal: false,\n // nav: {\n // current_route: '/',\n // route_trigger: '',\n // event_id: '',\n // section: '',\n // options: {},\n // },\n user: {\n data: {\n ...action.payload?.user?.data,\n email: action.payload?.user?.data?.email,\n },\n // needs_refresh: false,\n // redacted: [],\n },\n auth: {\n access_token: action.payload?.auth?.access_token,\n refresh_token: action.payload?.auth?.refresh_token,\n app_id: null,\n },\n app: {\n schema: action.payload.appConfig?.schema,\n config: null,\n },\n // local_acls: null,\n // is_saving_user_data: false,\n // config\n };\n return newState;\n default:\n newState = state;\n return newState;\n }\n}\n"],"mappings":"AACA,SAASA,UAAT,QAAoC,qBAApC;AAEA,OAAO,MAAMC,iBAA8B,GAAG;EAC5C;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACAC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJC,KAAK,EAAE;IADH,CADF,CAIJ;IACA;;EALI,CAXsC;EAkB5CC,IAAI,EAAE;IACJC,YAAY,EAAE,IADV;IAEJC,aAAa,EAAE,IAFX;IAGJC,MAAM,EAAE;EAHJ,CAlBsC;EAuB5CC,GAAG,EAAE;IACHC,MAAM,EAAE,IADL;IAEHC,MAAM,EAAE;EAFL,CAvBuC,CA2B5C;EACA;EACA;;AA7B4C,CAAvC;AAgCP,OAAO,SAASC,YAAT,CAAsBC,KAAtB,EAA0CC,MAA1C,EAAwE;EAAA;;EAC7E,IAAIC,QAAJ;;EAEA,QAAQD,MAAM,CAACE,IAAf;IACE,KAAKhB,UAAU,CAACiB,YAAhB;MACEF,QAAQ,GAAG;QACT;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACAb,IAAI,EAAE;UACJC,IAAI,EAAE,EACJ,uBAAGW,MAAM,CAACI,OAAV,4EAAG,gBAAgBhB,IAAnB,yDAAG,qBAAsBC,IAAzB,CADI;YAEJC,KAAK,sBAAEU,MAAM,CAACI,OAAT,8EAAE,iBAAgBhB,IAAlB,oFAAE,sBAAsBC,IAAxB,2DAAE,uBAA4BC;UAF/B,CADF,CAKJ;UACA;;QANI,CAXG;QAmBTC,IAAI,EAAE;UACJC,YAAY,sBAAEQ,MAAM,CAACI,OAAT,8EAAE,iBAAgBb,IAAlB,0DAAE,sBAAsBC,YADhC;UAEJC,aAAa,sBAAEO,MAAM,CAACI,OAAT,8EAAE,iBAAgBb,IAAlB,0DAAE,sBAAsBE,aAFjC;UAGJC,MAAM,EAAE;QAHJ,CAnBG;QAwBTC,GAAG,EAAE;UACHC,MAAM,2BAAEI,MAAM,CAACI,OAAP,CAAeC,SAAjB,0DAAE,sBAA0BT,MAD/B;UAEHC,MAAM,EAAE;QAFL,CAxBI,CA4BT;QACA;QACA;;MA9BS,CAAX;MAgCA,OAAOI,QAAP;;IACF;MACEA,QAAQ,GAAGF,KAAX;MACA,OAAOE,QAAP;EArCJ;AAuCD"}
|
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
const config = {
|
|
3
|
-
baseUrl: 'https://hub.rownd.io',
|
|
4
|
-
apiUrl: 'https://api.rownd.io',
|
|
5
|
-
pdcBaseUrl: 'https://mydata.rownd.io',
|
|
6
|
-
appKey: '',
|
|
7
|
-
postLoginUrl: null,
|
|
8
|
-
postRegistrationUrl: null,
|
|
9
|
-
locationHash: null,
|
|
10
|
-
postAuthenticationApi: null
|
|
11
|
-
};
|
|
12
|
-
export function createConfig(opts) {
|
|
13
|
-
return { ...config,
|
|
14
|
-
...pickBy(opts)
|
|
15
|
-
};
|
|
16
|
-
}
|
|
1
|
+
|
|
17
2
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[
|
|
1
|
+
{"version":3,"names":[],"sources":["config.ts"],"sourcesContent":["export interface IConfig {\n appKey: string;\n}\n\nexport type PostAuthApiSpec = {\n method: 'post' | 'put';\n url: string;\n extra_headers: { [key: string]: string };\n};\n"],"mappings":""}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { NativeModules, Platform } from 'react-native';
|
|
2
|
+
export const LINKING_ERROR = `The package '@rownd/react-native' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
|
3
|
+
ios: "- You have run 'pod install'\n",
|
|
4
|
+
default: ''
|
|
5
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo managed workflow\n';
|
|
6
|
+
export const Rownd = NativeModules.RowndPlugin ? NativeModules.RowndPlugin : new Proxy({}, {
|
|
7
|
+
get() {
|
|
8
|
+
throw new Error(LINKING_ERROR);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
});
|
|
12
|
+
export const IOSRowndEventEmitter = Platform.OS != 'ios' ? null : NativeModules.RowndPluginEventEmitter ? NativeModules.RowndPluginEventEmitter : new Proxy({}, {
|
|
13
|
+
get() {
|
|
14
|
+
throw new Error(LINKING_ERROR);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const isNotAvailableInAndroidYet = () => {
|
|
20
|
+
console.log('ROWND: NOT AVAILABLE IN ANDROID YET');
|
|
21
|
+
return true;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export function configure(appKey) {
|
|
25
|
+
return Rownd.configure(appKey);
|
|
26
|
+
}
|
|
27
|
+
export function requestSignIn() {
|
|
28
|
+
return Rownd.requestSignIn();
|
|
29
|
+
}
|
|
30
|
+
export function signOut() {
|
|
31
|
+
return Rownd.signOut();
|
|
32
|
+
}
|
|
33
|
+
export function manageAccount() {
|
|
34
|
+
return Rownd.manageAccount();
|
|
35
|
+
}
|
|
36
|
+
export function getAccessToken() {
|
|
37
|
+
if (isNotAvailableInAndroidYet()) return Promise.resolve('');
|
|
38
|
+
return Rownd.getAccessToken();
|
|
39
|
+
}
|
|
40
|
+
export function setUserDataValue(key, value) {
|
|
41
|
+
return Rownd.setUserDataValue(key, Platform.OS === 'android' ? {
|
|
42
|
+
value
|
|
43
|
+
} : value);
|
|
44
|
+
}
|
|
45
|
+
export function setUserData(data) {
|
|
46
|
+
return Rownd.setUserData(data);
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=nativeModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","Rownd","RowndPlugin","Proxy","get","Error","IOSRowndEventEmitter","OS","RowndPluginEventEmitter","isNotAvailableInAndroidYet","console","log","configure","appKey","requestSignIn","signOut","manageAccount","getAccessToken","Promise","resolve","setUserDataValue","key","value","setUserData","data"],"sources":["nativeModule.ts"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\n\nexport const LINKING_ERROR =\n `The package '@rownd/react-native' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nexport const Rownd = NativeModules.RowndPlugin\n ? NativeModules.RowndPlugin\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nexport const IOSRowndEventEmitter =\n Platform.OS != 'ios'\n ? null\n : NativeModules.RowndPluginEventEmitter\n ? NativeModules.RowndPluginEventEmitter\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nconst isNotAvailableInAndroidYet = () => {\n console.log('ROWND: NOT AVAILABLE IN ANDROID YET');\n return true;\n};\n\nexport function configure(appKey: string): Promise<string> {\n return Rownd.configure(appKey);\n}\n\nexport function requestSignIn() {\n return Rownd.requestSignIn();\n}\n\nexport function signOut() {\n return Rownd.signOut();\n}\n\nexport function manageAccount() {\n return Rownd.manageAccount();\n}\n\nexport function getAccessToken(): Promise<string> {\n if (isNotAvailableInAndroidYet()) return Promise.resolve('');\n return Rownd.getAccessToken();\n}\n\nexport function setUserDataValue(key: string, value: any) {\n return Rownd.setUserDataValue(\n key,\n Platform.OS === 'android' ? { value } : value\n );\n}\n\nexport function setUserData(data: Record<string, any>) {\n return Rownd.setUserData(data);\n}\n"],"mappings":"AAAA,SAASA,aAAT,EAAwBC,QAAxB,QAAwC,cAAxC;AAEA,OAAO,MAAMC,aAAa,GACvB,8EAAD,GACAD,QAAQ,CAACE,MAAT,CAAgB;EAAEC,GAAG,EAAE,gCAAP;EAAyCC,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJK;AAMP,OAAO,MAAMC,KAAK,GAAGN,aAAa,CAACO,WAAd,GACjBP,aAAa,CAACO,WADG,GAEjB,IAAIC,KAAJ,CACE,EADF,EAEE;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAJ,CAAUR,aAAV,CAAN;EACD;;AAHH,CAFF,CAFG;AAWP,OAAO,MAAMS,oBAAoB,GAC/BV,QAAQ,CAACW,EAAT,IAAe,KAAf,GACI,IADJ,GAEIZ,aAAa,CAACa,uBAAd,GACAb,aAAa,CAACa,uBADd,GAEA,IAAIL,KAAJ,CACE,EADF,EAEE;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAJ,CAAUR,aAAV,CAAN;EACD;;AAHH,CAFF,CALC;;AAcP,MAAMY,0BAA0B,GAAG,MAAM;EACvCC,OAAO,CAACC,GAAR,CAAY,qCAAZ;EACA,OAAO,IAAP;AACD,CAHD;;AAKA,OAAO,SAASC,SAAT,CAAmBC,MAAnB,EAAoD;EACzD,OAAOZ,KAAK,CAACW,SAAN,CAAgBC,MAAhB,CAAP;AACD;AAED,OAAO,SAASC,aAAT,GAAyB;EAC9B,OAAOb,KAAK,CAACa,aAAN,EAAP;AACD;AAED,OAAO,SAASC,OAAT,GAAmB;EACxB,OAAOd,KAAK,CAACc,OAAN,EAAP;AACD;AAED,OAAO,SAASC,aAAT,GAAyB;EAC9B,OAAOf,KAAK,CAACe,aAAN,EAAP;AACD;AAED,OAAO,SAASC,cAAT,GAA2C;EAChD,IAAIR,0BAA0B,EAA9B,EAAkC,OAAOS,OAAO,CAACC,OAAR,CAAgB,EAAhB,CAAP;EAClC,OAAOlB,KAAK,CAACgB,cAAN,EAAP;AACD;AAED,OAAO,SAASG,gBAAT,CAA0BC,GAA1B,EAAuCC,KAAvC,EAAmD;EACxD,OAAOrB,KAAK,CAACmB,gBAAN,CACLC,GADK,EAELzB,QAAQ,CAACW,EAAT,KAAgB,SAAhB,GAA4B;IAAEe;EAAF,CAA5B,GAAwCA,KAFnC,CAAP;AAID;AAED,OAAO,SAASC,WAAT,CAAqBC,IAArB,EAAgD;EACrD,OAAOvB,KAAK,CAACsB,WAAN,CAAkBC,IAAlB,CAAP;AACD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React, { FunctionComponent } from 'react';
|
|
2
|
+
import type { ContextProps, GlobalState } from './GlobalContext.types';
|
|
3
|
+
import type { TAction } from '../constants/action';
|
|
4
|
+
export declare const GlobalContext: React.Context<{
|
|
5
|
+
state: GlobalState;
|
|
6
|
+
dispatch: React.Dispatch<TAction>;
|
|
7
|
+
} | undefined>;
|
|
8
|
+
declare const RowndProvider: FunctionComponent<ContextProps>;
|
|
9
|
+
declare function useRowndContext(): {
|
|
10
|
+
state: GlobalState;
|
|
11
|
+
dispatch: React.Dispatch<TAction>;
|
|
12
|
+
};
|
|
13
|
+
export { RowndProvider, useRowndContext };
|
package/lib/typescript/{src/components/GlobalContext.d.ts → components/GlobalContext.types.d.ts}
RENAMED
|
@@ -1,26 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { IConfig } from '../utils/config';
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type { TAction } from '../constants/action';
|
|
2
|
+
import type { IConfig } from '../utils/config';
|
|
3
|
+
export declare type ContextProps = {
|
|
4
|
+
config: IConfig;
|
|
5
|
+
};
|
|
6
|
+
export declare type Dispatch = (action: TAction) => void;
|
|
5
7
|
export declare type GlobalState = {
|
|
6
|
-
is_initializing: boolean;
|
|
7
|
-
is_container_visible: boolean;
|
|
8
|
-
use_modal: boolean;
|
|
9
|
-
nav: {
|
|
10
|
-
current_route: string;
|
|
11
|
-
route_trigger: string;
|
|
12
|
-
event_id: string;
|
|
13
|
-
section: string;
|
|
14
|
-
options?: any;
|
|
15
|
-
};
|
|
16
8
|
user: {
|
|
17
9
|
data: {
|
|
18
10
|
id?: string;
|
|
19
|
-
email
|
|
11
|
+
email?: string | null;
|
|
20
12
|
[key: string]: any;
|
|
21
13
|
};
|
|
22
|
-
needs_refresh?: boolean;
|
|
23
|
-
redacted: string[];
|
|
24
14
|
};
|
|
25
15
|
auth: {
|
|
26
16
|
access_token: string | null;
|
|
@@ -38,10 +28,6 @@ export declare type GlobalState = {
|
|
|
38
28
|
user_verification_field?: string;
|
|
39
29
|
user_verification_fields?: string[];
|
|
40
30
|
};
|
|
41
|
-
local_acls: Record<string, {
|
|
42
|
-
shared: boolean;
|
|
43
|
-
}> | null;
|
|
44
|
-
is_saving_user_data: boolean;
|
|
45
31
|
config?: IConfig;
|
|
46
32
|
};
|
|
47
33
|
declare type AppSchema = Record<string, SchemaField>;
|
|
@@ -57,7 +43,7 @@ export interface SchemaField {
|
|
|
57
43
|
collection_justification: string;
|
|
58
44
|
opt_out_warning: string;
|
|
59
45
|
}
|
|
60
|
-
interface AppConfig {
|
|
46
|
+
export interface AppConfig {
|
|
61
47
|
customizations: {
|
|
62
48
|
primary_color: string;
|
|
63
49
|
};
|
|
@@ -96,16 +82,4 @@ export interface HubCustomizations {
|
|
|
96
82
|
offset_y: number;
|
|
97
83
|
property_overrides: Record<string, string>;
|
|
98
84
|
}
|
|
99
|
-
|
|
100
|
-
config: IConfig;
|
|
101
|
-
};
|
|
102
|
-
export declare const GlobalContext: React.Context<{
|
|
103
|
-
state: GlobalState;
|
|
104
|
-
dispatch: Dispatch;
|
|
105
|
-
} | undefined>;
|
|
106
|
-
declare const GlobalContextProvider: FunctionComponent<ContextProps>;
|
|
107
|
-
declare function useGlobalContext(): {
|
|
108
|
-
state: GlobalState;
|
|
109
|
-
dispatch: Dispatch;
|
|
110
|
-
};
|
|
111
|
-
export { GlobalContextProvider, useGlobalContext };
|
|
85
|
+
export {};
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
export declare type TRowndContext = {
|
|
2
2
|
requestSignIn: (opts?: RequestSignInOpts) => void;
|
|
3
3
|
signOut: () => void;
|
|
4
|
-
|
|
4
|
+
manageAccount: () => void;
|
|
5
|
+
getAccessToken: () => Promise<string>;
|
|
6
|
+
user: UserContext;
|
|
5
7
|
is_authenticated: boolean;
|
|
6
8
|
is_initializing: boolean;
|
|
7
9
|
access_token: string | null;
|
|
8
10
|
auth: AuthContext;
|
|
9
|
-
user: UserContext;
|
|
10
|
-
};
|
|
11
|
-
declare type AuthContext = {
|
|
12
|
-
access_token: string | null;
|
|
13
|
-
app_id: string | null;
|
|
14
|
-
is_verified_user?: boolean;
|
|
15
11
|
};
|
|
16
12
|
declare type UserContext = {
|
|
17
13
|
data: {
|
|
@@ -20,9 +16,13 @@ declare type UserContext = {
|
|
|
20
16
|
phone?: string | null;
|
|
21
17
|
[key: string]: any;
|
|
22
18
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
set: (data: Record<string, any>) => void;
|
|
20
|
+
setValue: (key: string, value: any) => void;
|
|
21
|
+
};
|
|
22
|
+
declare type AuthContext = {
|
|
23
|
+
access_token: string | null;
|
|
24
|
+
app_id: string | null;
|
|
25
|
+
is_verified_user?: boolean;
|
|
26
26
|
};
|
|
27
27
|
declare type RequestSignInOpts = {
|
|
28
28
|
identifier?: string;
|
|
@@ -30,8 +30,5 @@ declare type RequestSignInOpts = {
|
|
|
30
30
|
init_data?: Record<string, any>;
|
|
31
31
|
post_login_redirect?: string;
|
|
32
32
|
};
|
|
33
|
-
declare type GetAccessTokenOpts = {
|
|
34
|
-
waitForToken?: boolean;
|
|
35
|
-
};
|
|
36
33
|
export declare function useRownd(): TRowndContext;
|
|
37
34
|
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const LINKING_ERROR: string;
|
|
2
|
+
export declare const Rownd: any;
|
|
3
|
+
export declare const IOSRowndEventEmitter: any;
|
|
4
|
+
export declare function configure(appKey: string): Promise<string>;
|
|
5
|
+
export declare function requestSignIn(): any;
|
|
6
|
+
export declare function signOut(): any;
|
|
7
|
+
export declare function manageAccount(): any;
|
|
8
|
+
export declare function getAccessToken(): Promise<string>;
|
|
9
|
+
export declare function setUserDataValue(key: string, value: any): any;
|
|
10
|
+
export declare function setUserData(data: Record<string, any>): any;
|