@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/rownd.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
requestSignIn,
|
|
3
|
+
signOut,
|
|
4
|
+
manageAccount,
|
|
5
|
+
getAccessToken,
|
|
6
|
+
setUserDataValue,
|
|
7
|
+
setUserData,
|
|
8
|
+
} from '../utils/nativeModule';
|
|
9
|
+
import { useRowndContext } from '../components/GlobalContext';
|
|
5
10
|
|
|
6
11
|
export type TRowndContext = {
|
|
7
12
|
requestSignIn: (opts?: RequestSignInOpts) => void;
|
|
8
13
|
signOut: () => void;
|
|
9
|
-
|
|
14
|
+
manageAccount: () => void;
|
|
15
|
+
getAccessToken: () => Promise<string>;
|
|
16
|
+
user: UserContext;
|
|
10
17
|
is_authenticated: boolean;
|
|
11
18
|
is_initializing: boolean;
|
|
12
19
|
access_token: string | null;
|
|
13
20
|
auth: AuthContext;
|
|
14
|
-
user: UserContext;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
type AuthContext = {
|
|
18
|
-
access_token: string | null;
|
|
19
|
-
app_id: string | null;
|
|
20
|
-
is_verified_user?: boolean;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
type UserContext = {
|
|
@@ -27,9 +27,15 @@ type UserContext = {
|
|
|
27
27
|
phone?: string | null;
|
|
28
28
|
[key: string]: any;
|
|
29
29
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
set: (data: Record<string, any>) => void;
|
|
31
|
+
setValue: (key: string, value: any) => void;
|
|
32
|
+
//set: (data: any) => void;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
type AuthContext = {
|
|
36
|
+
access_token: string | null;
|
|
37
|
+
app_id: string | null;
|
|
38
|
+
is_verified_user?: boolean;
|
|
33
39
|
};
|
|
34
40
|
|
|
35
41
|
type RequestSignInOpts = {
|
|
@@ -39,146 +45,22 @@ type RequestSignInOpts = {
|
|
|
39
45
|
post_login_redirect?: string;
|
|
40
46
|
};
|
|
41
47
|
|
|
42
|
-
type GetAccessTokenOpts = {
|
|
43
|
-
waitForToken?: boolean;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
// const RowndContext = createContext<TRowndContext | null>(null);
|
|
47
|
-
|
|
48
48
|
export function useRownd(): TRowndContext {
|
|
49
|
-
const { state
|
|
50
|
-
const { isNewAccessTokenNeeded, newAccessTokenFromRefreshToken } = useApi();
|
|
51
|
-
|
|
52
|
-
const stateCopy = JSON.parse(JSON.stringify(state));
|
|
53
|
-
|
|
54
|
-
const requestSignIn = (opts?: RequestSignInOpts): void => {
|
|
55
|
-
dispatch({
|
|
56
|
-
type: ActionType.CHANGE_ROUTE,
|
|
57
|
-
payload: {
|
|
58
|
-
route: '/account/login',
|
|
59
|
-
options: opts,
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const signOut = () => {
|
|
65
|
-
dispatch({
|
|
66
|
-
type: ActionType.SIGN_OUT,
|
|
67
|
-
});
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
const getAccessToken = async (
|
|
71
|
-
opts?: GetAccessTokenOpts
|
|
72
|
-
): Promise<string | null> => {
|
|
73
|
-
const { waitForToken } = opts || {};
|
|
74
|
-
let accessToken = state?.auth.access_token;
|
|
75
|
-
|
|
76
|
-
// Wait for an access token to be available if none exists yet
|
|
77
|
-
if (!accessToken && waitForToken) {
|
|
78
|
-
return new Promise((resolve, _reject) => {
|
|
79
|
-
console.debug('auth_wait: waiting for access token');
|
|
80
|
-
const listener = (evt: any) => {
|
|
81
|
-
console.debug('auth_wait: received access token');
|
|
82
|
-
const data = evt.detail;
|
|
83
|
-
resolve(data.access_token);
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
events.addEventListener(EventType.AUTH, listener, { once: true });
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (isNewAccessTokenNeeded(undefined)) {
|
|
91
|
-
const resp = await newAccessTokenFromRefreshToken(stateCopy);
|
|
92
|
-
accessToken = resp.access_token;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return accessToken;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
const setUserData = (
|
|
99
|
-
data: Record<string, any>
|
|
100
|
-
): Promise<Record<string, any>> => {
|
|
101
|
-
return new Promise((resolve, reject) => {
|
|
102
|
-
console.debug('user_data_save_wait: waiting for data to be saved');
|
|
103
|
-
const listener = (evt: any) => {
|
|
104
|
-
console.debug('user_data_save_wait: received data saved event');
|
|
105
|
-
if (evt.error) {
|
|
106
|
-
return reject(evt.error);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
resolve(evt.data);
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
events.addEventListener(EventType.USER_DATA_SAVED, listener, {
|
|
113
|
-
once: true,
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
dispatch({
|
|
117
|
-
type: ActionType.SET_USER_DATA,
|
|
118
|
-
payload: {
|
|
119
|
-
data,
|
|
120
|
-
},
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
const setUserDataValue = (
|
|
126
|
-
key: string,
|
|
127
|
-
value: any
|
|
128
|
-
): Promise<Record<string, any>> => {
|
|
129
|
-
return new Promise((resolve, reject) => {
|
|
130
|
-
console.debug('user_data_save_wait: waiting for data to be saved');
|
|
131
|
-
const listener = (evt: any) => {
|
|
132
|
-
console.debug('user_data_save_wait: received data saved event');
|
|
133
|
-
if (evt.error) {
|
|
134
|
-
return reject(evt.error);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
resolve(evt.data);
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
events.addEventListener(EventType.USER_DATA_SAVED, listener, {
|
|
141
|
-
once: true,
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
dispatch({
|
|
145
|
-
type: ActionType.SET_USER_DATA_FIELD,
|
|
146
|
-
payload: {
|
|
147
|
-
field: key,
|
|
148
|
-
value,
|
|
149
|
-
},
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
if (value) {
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
const valueAcl = {
|
|
157
|
-
[key]: {
|
|
158
|
-
shared: true,
|
|
159
|
-
},
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
dispatch({
|
|
163
|
-
type: ActionType.UPDATE_LOCAL_ACLS,
|
|
164
|
-
payload: valueAcl,
|
|
165
|
-
});
|
|
166
|
-
});
|
|
167
|
-
};
|
|
49
|
+
const { state } = useRowndContext();
|
|
168
50
|
|
|
169
51
|
return {
|
|
170
52
|
requestSignIn,
|
|
171
53
|
signOut,
|
|
54
|
+
manageAccount,
|
|
172
55
|
getAccessToken,
|
|
173
|
-
is_authenticated: !!state.auth.access_token,
|
|
174
|
-
is_initializing: !!state.app.id,
|
|
175
|
-
access_token: state.auth?.access_token,
|
|
176
|
-
auth: state.auth,
|
|
177
56
|
user: {
|
|
178
|
-
data: state.user
|
|
179
|
-
redacted_fields: state.user?.redacted,
|
|
180
|
-
set: setUserData,
|
|
57
|
+
data: state.user.data,
|
|
181
58
|
setValue: setUserDataValue,
|
|
59
|
+
set: setUserData,
|
|
182
60
|
},
|
|
61
|
+
is_authenticated: !!state.auth.access_token,
|
|
62
|
+
is_initializing: !!state.auth.app_id,
|
|
63
|
+
auth: state.auth,
|
|
64
|
+
access_token: state.auth.access_token,
|
|
183
65
|
};
|
|
184
66
|
}
|
package/src/index.tsx
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
|
-
import AuthenticatedComponent from './components/AuthenticatedComponent';
|
|
5
3
|
|
|
6
|
-
export { RowndProvider, useRownd
|
|
4
|
+
export { RowndProvider, useRownd };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { GlobalState } from '../components/GlobalContext.types';
|
|
2
|
+
import { ActionType, TAction } from '../constants/action';
|
|
3
|
+
|
|
4
|
+
export const initialRowndState: GlobalState = {
|
|
5
|
+
// is_initializing: false,
|
|
6
|
+
// is_container_visible: false,
|
|
7
|
+
// use_modal: false,
|
|
8
|
+
// nav: {
|
|
9
|
+
// current_route: '/',
|
|
10
|
+
// route_trigger: '',
|
|
11
|
+
// event_id: '',
|
|
12
|
+
// section: '',
|
|
13
|
+
// options: {},
|
|
14
|
+
// },
|
|
15
|
+
user: {
|
|
16
|
+
data: {
|
|
17
|
+
email: null,
|
|
18
|
+
},
|
|
19
|
+
// needs_refresh: false,
|
|
20
|
+
// redacted: [],
|
|
21
|
+
},
|
|
22
|
+
auth: {
|
|
23
|
+
access_token: null,
|
|
24
|
+
refresh_token: null,
|
|
25
|
+
app_id: null,
|
|
26
|
+
},
|
|
27
|
+
app: {
|
|
28
|
+
schema: null,
|
|
29
|
+
config: null,
|
|
30
|
+
},
|
|
31
|
+
// local_acls: null,
|
|
32
|
+
// is_saving_user_data: false,
|
|
33
|
+
// config,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export function rowndReducer(state: GlobalState, action: TAction): GlobalState {
|
|
37
|
+
let newState: GlobalState;
|
|
38
|
+
|
|
39
|
+
switch (action.type) {
|
|
40
|
+
case ActionType.UPDATE_STATE:
|
|
41
|
+
newState = {
|
|
42
|
+
// is_initializing: false,
|
|
43
|
+
// is_container_visible: false,
|
|
44
|
+
// use_modal: false,
|
|
45
|
+
// nav: {
|
|
46
|
+
// current_route: '/',
|
|
47
|
+
// route_trigger: '',
|
|
48
|
+
// event_id: '',
|
|
49
|
+
// section: '',
|
|
50
|
+
// options: {},
|
|
51
|
+
// },
|
|
52
|
+
user: {
|
|
53
|
+
data: {
|
|
54
|
+
...action.payload?.user?.data,
|
|
55
|
+
email: action.payload?.user?.data?.email,
|
|
56
|
+
},
|
|
57
|
+
// needs_refresh: false,
|
|
58
|
+
// redacted: [],
|
|
59
|
+
},
|
|
60
|
+
auth: {
|
|
61
|
+
access_token: action.payload?.auth?.access_token,
|
|
62
|
+
refresh_token: action.payload?.auth?.refresh_token,
|
|
63
|
+
app_id: null,
|
|
64
|
+
},
|
|
65
|
+
app: {
|
|
66
|
+
schema: action.payload.appConfig?.schema,
|
|
67
|
+
config: null,
|
|
68
|
+
},
|
|
69
|
+
// local_acls: null,
|
|
70
|
+
// is_saving_user_data: false,
|
|
71
|
+
// config
|
|
72
|
+
};
|
|
73
|
+
return newState;
|
|
74
|
+
default:
|
|
75
|
+
newState = state;
|
|
76
|
+
return newState;
|
|
77
|
+
}
|
|
78
|
+
}
|
package/src/utils/config.ts
CHANGED
|
@@ -1,36 +1,9 @@
|
|
|
1
|
-
import pickBy from 'lodash-es/pickBy';
|
|
2
|
-
|
|
3
1
|
export interface IConfig {
|
|
4
|
-
baseUrl: string;
|
|
5
|
-
apiUrl: string;
|
|
6
|
-
pdcBaseUrl: string;
|
|
7
2
|
appKey: string;
|
|
8
|
-
postLoginUrl: null | string;
|
|
9
|
-
postRegistrationUrl: null | string;
|
|
10
|
-
locationHash: null | string;
|
|
11
|
-
postAuthenticationApi: null | PostAuthApiSpec;
|
|
12
3
|
}
|
|
13
4
|
|
|
14
|
-
const config: IConfig = {
|
|
15
|
-
baseUrl: 'https://hub.rownd.io',
|
|
16
|
-
apiUrl: 'https://api.rownd.io',
|
|
17
|
-
pdcBaseUrl: 'https://mydata.rownd.io',
|
|
18
|
-
appKey: '',
|
|
19
|
-
postLoginUrl: null,
|
|
20
|
-
postRegistrationUrl: null,
|
|
21
|
-
locationHash: null,
|
|
22
|
-
postAuthenticationApi: null,
|
|
23
|
-
};
|
|
24
|
-
|
|
25
5
|
export type PostAuthApiSpec = {
|
|
26
6
|
method: 'post' | 'put';
|
|
27
7
|
url: string;
|
|
28
8
|
extra_headers: { [key: string]: string };
|
|
29
9
|
};
|
|
30
|
-
|
|
31
|
-
export function createConfig(opts: Partial<IConfig>): IConfig {
|
|
32
|
-
return {
|
|
33
|
-
...config,
|
|
34
|
-
...pickBy(opts),
|
|
35
|
-
};
|
|
36
|
-
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { NativeModules, Platform } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export const LINKING_ERROR =
|
|
4
|
+
`The package '@rownd/react-native' doesn't seem to be linked. Make sure: \n\n` +
|
|
5
|
+
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
6
|
+
'- You rebuilt the app after installing the package\n' +
|
|
7
|
+
'- You are not using Expo managed workflow\n';
|
|
8
|
+
|
|
9
|
+
export const Rownd = NativeModules.RowndPlugin
|
|
10
|
+
? NativeModules.RowndPlugin
|
|
11
|
+
: new Proxy(
|
|
12
|
+
{},
|
|
13
|
+
{
|
|
14
|
+
get() {
|
|
15
|
+
throw new Error(LINKING_ERROR);
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export const IOSRowndEventEmitter =
|
|
21
|
+
Platform.OS != 'ios'
|
|
22
|
+
? null
|
|
23
|
+
: NativeModules.RowndPluginEventEmitter
|
|
24
|
+
? NativeModules.RowndPluginEventEmitter
|
|
25
|
+
: new Proxy(
|
|
26
|
+
{},
|
|
27
|
+
{
|
|
28
|
+
get() {
|
|
29
|
+
throw new Error(LINKING_ERROR);
|
|
30
|
+
},
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
const isNotAvailableInAndroidYet = () => {
|
|
35
|
+
console.log('ROWND: NOT AVAILABLE IN ANDROID YET');
|
|
36
|
+
return true;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export function configure(appKey: string): Promise<string> {
|
|
40
|
+
return Rownd.configure(appKey);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function requestSignIn() {
|
|
44
|
+
return Rownd.requestSignIn();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function signOut() {
|
|
48
|
+
return Rownd.signOut();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function manageAccount() {
|
|
52
|
+
return Rownd.manageAccount();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function getAccessToken(): Promise<string> {
|
|
56
|
+
if (isNotAvailableInAndroidYet()) return Promise.resolve('');
|
|
57
|
+
return Rownd.getAccessToken();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function setUserDataValue(key: string, value: any) {
|
|
61
|
+
return Rownd.setUserDataValue(
|
|
62
|
+
key,
|
|
63
|
+
Platform.OS === 'android' ? { value } : value
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function setUserData(data: Record<string, any>) {
|
|
68
|
+
return Rownd.setUserData(data);
|
|
69
|
+
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
package com.reactnative;
|
|
2
|
-
|
|
3
|
-
import com.facebook.react.ReactPackage;
|
|
4
|
-
import com.facebook.react.bridge.NativeModule;
|
|
5
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
6
|
-
import com.facebook.react.uimanager.ViewManager;
|
|
7
|
-
|
|
8
|
-
import java.util.Arrays;
|
|
9
|
-
import java.util.Collections;
|
|
10
|
-
import java.util.List;
|
|
11
|
-
|
|
12
|
-
public class ReactNativePackage implements ReactPackage {
|
|
13
|
-
@Override
|
|
14
|
-
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
|
|
15
|
-
return Collections.emptyList();
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
@Override
|
|
19
|
-
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
|
|
20
|
-
return Arrays.<ViewManager>asList(new ReactNativeViewManager());
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
package com.reactnative;
|
|
2
|
-
|
|
3
|
-
import android.graphics.Color;
|
|
4
|
-
import android.view.View;
|
|
5
|
-
|
|
6
|
-
import androidx.annotation.NonNull;
|
|
7
|
-
|
|
8
|
-
import com.facebook.react.uimanager.SimpleViewManager;
|
|
9
|
-
import com.facebook.react.uimanager.ThemedReactContext;
|
|
10
|
-
import com.facebook.react.uimanager.annotations.ReactProp;
|
|
11
|
-
|
|
12
|
-
public class ReactNativeViewManager extends SimpleViewManager<View> {
|
|
13
|
-
public static final String REACT_CLASS = "ReactNativeView";
|
|
14
|
-
|
|
15
|
-
@Override
|
|
16
|
-
@NonNull
|
|
17
|
-
public String getName() {
|
|
18
|
-
return REACT_CLASS;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
@Override
|
|
22
|
-
@NonNull
|
|
23
|
-
public View createViewInstance(ThemedReactContext reactContext) {
|
|
24
|
-
return new View(reactContext);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
@ReactProp(name = "color")
|
|
28
|
-
public void setColor(View view, String color) {
|
|
29
|
-
view.setBackgroundColor(Color.parseColor(color));
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
#import <React/RCTViewManager.h>
|
|
2
|
-
|
|
3
|
-
@interface ReactNativeViewManager : RCTViewManager
|
|
4
|
-
@end
|
|
5
|
-
|
|
6
|
-
@implementation ReactNativeViewManager
|
|
7
|
-
|
|
8
|
-
RCT_EXPORT_MODULE(ReactNativeView)
|
|
9
|
-
|
|
10
|
-
- (UIView *)view
|
|
11
|
-
{
|
|
12
|
-
return [[UIView alloc] init];
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
RCT_CUSTOM_VIEW_PROPERTY(color, NSString, UIView)
|
|
16
|
-
{
|
|
17
|
-
[view setBackgroundColor:[self hexStringToColor:json]];
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
- hexStringToColor:(NSString *)stringToConvert
|
|
21
|
-
{
|
|
22
|
-
NSString *noHashString = [stringToConvert stringByReplacingOccurrencesOfString:@"#" withString:@""];
|
|
23
|
-
NSScanner *stringScanner = [NSScanner scannerWithString:noHashString];
|
|
24
|
-
|
|
25
|
-
unsigned hex;
|
|
26
|
-
if (![stringScanner scanHexInt:&hex]) return nil;
|
|
27
|
-
int r = (hex >> 16) & 0xFF;
|
|
28
|
-
int g = (hex >> 8) & 0xFF;
|
|
29
|
-
int b = (hex) & 0xFF;
|
|
30
|
-
|
|
31
|
-
return [UIColor colorWithRed:r / 255.0f green:g / 255.0f blue:b / 255.0f alpha:1.0f];
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
@end
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<svg id="icon" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
|
2
|
-
<defs>
|
|
3
|
-
<style>
|
|
4
|
-
.cls-1 {
|
|
5
|
-
fill: none;
|
|
6
|
-
}
|
|
7
|
-
</style>
|
|
8
|
-
</defs>
|
|
9
|
-
<path d="M16,2A14,14,0,1,0,30,16,14,14,0,0,0,16,2ZM14,21.5908l-5-5L10.5906,15,14,18.4092,21.41,11l1.5957,1.5859Z"/>
|
|
10
|
-
<polygon id="inner-path" class="cls-1" points="14 21.591 9 16.591 10.591 15 14 18.409 21.41 11 23.005 12.585 14 21.591"/>
|
|
11
|
-
<rect id="_Transparent_Rectangle_" data-name="<Transparent Rectangle>" class="cls-1" width="32" height="32"/>
|
|
12
|
-
</svg>
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<svg width="79px" height="68px" viewBox="0 0 79 68" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
-
<title>Group</title>
|
|
4
|
-
<defs>
|
|
5
|
-
<rect id="path-1" x="9.69736842" y="6.17105263" width="53.7763158" height="45.8421053" rx="8"></rect>
|
|
6
|
-
<filter x="-27.0%" y="-20.7%" width="153.9%" height="163.3%" filterUnits="objectBoundingBox" id="filter-2">
|
|
7
|
-
<feOffset dx="0" dy="5" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset>
|
|
8
|
-
<feGaussianBlur stdDeviation="4" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
|
|
9
|
-
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix>
|
|
10
|
-
</filter>
|
|
11
|
-
<path d="M1.49198314,22.8826009 L27.3602885,37.5009111 C33.5004408,40.9707422 41.014234,40.9500831 47.1352131,37.4465401 L72.5558685,22.8961951 C73.0351888,22.6218404 73.6461631,22.7879979 73.9205178,23.2673182 C74.007089,23.4185653 74.0526316,23.5898106 74.0526316,23.7640813 L74.0526316,63 C74.0526316,65.209139 72.2617706,67 70.0526316,67 L4,67 C1.790861,67 2.705415e-16,65.209139 0,63 L0,23.7532056 C8.43762138e-16,23.2009209 0.44771525,22.7532056 1,22.7532056 C1.17240673,22.7532056 1.34188502,22.7977797 1.49198314,22.8826009 Z" id="path-3"></path>
|
|
12
|
-
<filter x="-4.7%" y="-8.4%" width="109.5%" height="114.0%" filterUnits="objectBoundingBox" id="filter-4">
|
|
13
|
-
<feOffset dx="0" dy="-1" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset>
|
|
14
|
-
<feGaussianBlur stdDeviation="1" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
|
|
15
|
-
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix>
|
|
16
|
-
</filter>
|
|
17
|
-
</defs>
|
|
18
|
-
<g id="V2-post--feedback" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
19
|
-
<g id="xlg-1312px-16-column-copy-96" transform="translate(-616.000000, -265.000000)">
|
|
20
|
-
<g id="Group" transform="translate(618.000000, 265.000000)">
|
|
21
|
-
<path d="M1.1333848,21.7417845 L33.0948714,2.49908682 C35.6464021,0.96291506 38.8400625,0.97130271 41.383489,2.52085558 L72.9358668,21.743773 C73.4075139,22.0311185 73.5569199,22.6464036 73.2695744,23.1180507 C73.2235298,23.1936281 73.1676563,23.2627588 73.1034181,23.3236315 L37.2457723,57.3026316 L37.2457723,57.3026316 L0.965647178,23.3284209 C0.562522036,22.9509179 0.54175124,22.3180937 0.919254307,21.9149685 C0.982302388,21.8476412 1.0543624,21.7893607 1.1333848,21.7417845 Z" id="Path-28" fill="#545454"></path>
|
|
22
|
-
<g id="Rectangle">
|
|
23
|
-
<use fill="black" fill-opacity="1" filter="url(#filter-2)" xlink:href="#path-1"></use>
|
|
24
|
-
<use fill="#FFFFFF" fill-rule="evenodd" xlink:href="#path-1"></use>
|
|
25
|
-
</g>
|
|
26
|
-
<rect id="Rectangle" fill-opacity="0.4" fill="#D8D8D8" x="18.5131579" y="19.3947368" width="36.1447368" height="3.52631579"></rect>
|
|
27
|
-
<rect id="Rectangle-Copy" fill-opacity="0.4" fill="#D8D8D8" x="18.5131579" y="27.3289474" width="36.1447368" height="26.4473684"></rect>
|
|
28
|
-
<g id="Rectangle">
|
|
29
|
-
<use fill="black" fill-opacity="1" filter="url(#filter-4)" xlink:href="#path-3"></use>
|
|
30
|
-
<use fill="#646464" fill-rule="evenodd" xlink:href="#path-3"></use>
|
|
31
|
-
</g>
|
|
32
|
-
<path d="M23.2845382,51.744338 L1.76315789,67 L1.76315789,67 L71.4078947,67 L49.8865144,51.744338 C41.9186006,46.0961966 31.252452,46.0961966 23.2845382,51.744338 Z" id="Path-29" fill="#545454"></path>
|
|
33
|
-
</g>
|
|
34
|
-
</g>
|
|
35
|
-
</g>
|
|
36
|
-
</svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" height="48" width="48"><path d="M24 34q.7 0 1.175-.475.475-.475.475-1.175 0-.7-.475-1.175Q24.7 30.7 24 30.7q-.7 0-1.175.475-.475.475-.475 1.175 0 .7.475 1.175Q23.3 34 24 34Zm-1.35-7.65h3V13.7h-3ZM24 44q-4.1 0-7.75-1.575-3.65-1.575-6.375-4.3-2.725-2.725-4.3-6.375Q4 28.1 4 23.95q0-4.1 1.575-7.75 1.575-3.65 4.3-6.35 2.725-2.7 6.375-4.275Q19.9 4 24.05 4q4.1 0 7.75 1.575 3.65 1.575 6.35 4.275 2.7 2.7 4.275 6.35Q44 19.85 44 24q0 4.1-1.575 7.75-1.575 3.65-4.275 6.375t-6.35 4.3Q28.15 44 24 44Zm.05-3q7.05 0 12-4.975T41 23.95q0-7.05-4.95-12T24 7q-7.05 0-12.025 4.95Q7 16.9 7 24q0 7.05 4.975 12.025Q16.95 41 24.05 41ZM24 24Z"/></svg>
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<svg width="62px" height="100px" viewBox="0 0 62 100" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
-
<title>unverified-phone</title>
|
|
4
|
-
<defs>
|
|
5
|
-
<rect id="path-1" x="0" y="0" width="58" height="96" rx="8"></rect>
|
|
6
|
-
<filter x="-5.2%" y="-3.1%" width="110.3%" height="106.2%" filterUnits="objectBoundingBox" id="filter-2">
|
|
7
|
-
<feOffset dx="0" dy="0" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset>
|
|
8
|
-
<feGaussianBlur stdDeviation="1" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
|
|
9
|
-
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix>
|
|
10
|
-
</filter>
|
|
11
|
-
</defs>
|
|
12
|
-
<g id="SMS-verify-from-web-stay-on-web-(BR)" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
13
|
-
<g id="xlg-1312px-16-column-copy-51" transform="translate(-625.000000, -259.000000)">
|
|
14
|
-
<g id="unverified-phone" transform="translate(627.000000, 261.000000)">
|
|
15
|
-
<g id="Rectangle">
|
|
16
|
-
<use fill="black" fill-opacity="1" filter="url(#filter-2)" xlink:href="#path-1"></use>
|
|
17
|
-
<use fill="#444444" fill-rule="evenodd" xlink:href="#path-1"></use>
|
|
18
|
-
</g>
|
|
19
|
-
<circle id="Oval" fill="#000000" cx="29" cy="89" r="5"></circle>
|
|
20
|
-
<rect id="Rectangle" fill="#FFFFFF" x="5" y="11" width="48" height="71" rx="2"></rect>
|
|
21
|
-
<rect id="Rectangle" fill-opacity="0.4" fill="#D8D8D8" x="10" y="20" width="38" height="5"></rect>
|
|
22
|
-
<rect id="Rectangle-Copy" fill-opacity="0.4" fill="#D8D8D8" x="10" y="31" width="38" height="36"></rect>
|
|
23
|
-
</g>
|
|
24
|
-
</g>
|
|
25
|
-
</g>
|
|
26
|
-
</svg>
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = _default;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
|
-
|
|
12
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
|
-
|
|
14
|
-
const {
|
|
15
|
-
useRownd
|
|
16
|
-
} = require('../hooks/rownd');
|
|
17
|
-
|
|
18
|
-
function _default(_ref) {
|
|
19
|
-
let {
|
|
20
|
-
shouldRequestSignIn,
|
|
21
|
-
renderContentWhenUnauthenticated,
|
|
22
|
-
children
|
|
23
|
-
} = _ref;
|
|
24
|
-
const {
|
|
25
|
-
is_authenticated,
|
|
26
|
-
requestSignIn
|
|
27
|
-
} = useRownd();
|
|
28
|
-
(0, _react.useEffect)(() => {
|
|
29
|
-
if (shouldRequestSignIn && !is_authenticated) {
|
|
30
|
-
requestSignIn();
|
|
31
|
-
}
|
|
32
|
-
}, [is_authenticated, requestSignIn, shouldRequestSignIn]);
|
|
33
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (is_authenticated || renderContentWhenUnauthenticated) && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children));
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=AuthenticatedComponent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useRownd","require","shouldRequestSignIn","renderContentWhenUnauthenticated","children","is_authenticated","requestSignIn","useEffect"],"sources":["AuthenticatedComponent.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\n\nconst { useRownd } = require('../hooks/rownd');\n\ninterface IAuthenticatedComponentProps {\n shouldRequestSignIn?: boolean;\n renderContentWhenUnauthenticated?: boolean;\n}\n\nexport default function ({\n shouldRequestSignIn,\n renderContentWhenUnauthenticated,\n children,\n}: React.PropsWithChildren<IAuthenticatedComponentProps>) {\n const { is_authenticated, requestSignIn } = useRownd();\n\n useEffect(() => {\n if (shouldRequestSignIn && !is_authenticated) {\n requestSignIn();\n }\n }, [is_authenticated, requestSignIn, shouldRequestSignIn]);\n\n return (\n <>\n {(is_authenticated || renderContentWhenUnauthenticated) && (\n <>{children}</>\n )}\n </>\n );\n}\n"],"mappings":";;;;;;;AAAA;;;;;;AAEA,MAAM;EAAEA;AAAF,IAAeC,OAAO,CAAC,gBAAD,CAA5B;;AAOe,wBAI2C;EAAA,IAJjC;IACvBC,mBADuB;IAEvBC,gCAFuB;IAGvBC;EAHuB,CAIiC;EACxD,MAAM;IAAEC,gBAAF;IAAoBC;EAApB,IAAsCN,QAAQ,EAApD;EAEA,IAAAO,gBAAA,EAAU,MAAM;IACd,IAAIL,mBAAmB,IAAI,CAACG,gBAA5B,EAA8C;MAC5CC,aAAa;IACd;EACF,CAJD,EAIG,CAACD,gBAAD,EAAmBC,aAAnB,EAAkCJ,mBAAlC,CAJH;EAMA,oBACE,4DACG,CAACG,gBAAgB,IAAIF,gCAArB,kBACC,4DAAGC,QAAH,CAFJ,CADF;AAOD"}
|