@rownd/react-native 2.11.2 → 2.11.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/android/.gradle/7.4/checksums/checksums.lock +0 -0
  2. package/lib/commonjs/components/GlobalContext.js +8 -27
  3. package/lib/commonjs/components/GlobalContext.js.map +1 -1
  4. package/lib/commonjs/components/GlobalContext.web.js +21 -0
  5. package/lib/commonjs/components/GlobalContext.web.js.map +1 -0
  6. package/lib/commonjs/components/RequireSignIn.js +12 -16
  7. package/lib/commonjs/components/RequireSignIn.js.map +1 -1
  8. package/lib/commonjs/components/SignedIn.js +1 -9
  9. package/lib/commonjs/components/SignedIn.js.map +1 -1
  10. package/lib/commonjs/components/SignedOut.js +1 -9
  11. package/lib/commonjs/components/SignedOut.js.map +1 -1
  12. package/lib/commonjs/constants/action.js +1 -3
  13. package/lib/commonjs/constants/action.js.map +1 -1
  14. package/lib/commonjs/hooks/rownd.js +1 -4
  15. package/lib/commonjs/hooks/rownd.js.map +1 -1
  16. package/lib/commonjs/hooks/rownd.web.js +46 -0
  17. package/lib/commonjs/hooks/rownd.web.js.map +1 -0
  18. package/lib/commonjs/index.js +0 -6
  19. package/lib/commonjs/index.js.map +1 -1
  20. package/lib/commonjs/reducer/rowndReducer.js +19 -21
  21. package/lib/commonjs/reducer/rowndReducer.js.map +1 -1
  22. package/lib/commonjs/utils/nativeModule.js +3 -21
  23. package/lib/commonjs/utils/nativeModule.js.map +1 -1
  24. package/lib/module/components/GlobalContext.js +2 -11
  25. package/lib/module/components/GlobalContext.js.map +1 -1
  26. package/lib/module/components/GlobalContext.web.js +14 -0
  27. package/lib/module/components/GlobalContext.web.js.map +1 -0
  28. package/lib/module/components/RequireSignIn.js +8 -7
  29. package/lib/module/components/RequireSignIn.js.map +1 -1
  30. package/lib/module/components/SignedIn.js +0 -4
  31. package/lib/module/components/SignedIn.js.map +1 -1
  32. package/lib/module/components/SignedOut.js +0 -4
  33. package/lib/module/components/SignedOut.js.map +1 -1
  34. package/lib/module/constants/action.js +0 -1
  35. package/lib/module/constants/action.js.map +1 -1
  36. package/lib/module/hooks/rownd.js +1 -1
  37. package/lib/module/hooks/rownd.js.map +1 -1
  38. package/lib/module/hooks/rownd.web.js +40 -0
  39. package/lib/module/hooks/rownd.web.js.map +1 -0
  40. package/lib/module/index.js.map +1 -1
  41. package/lib/module/reducer/rowndReducer.js +19 -17
  42. package/lib/module/reducer/rowndReducer.js.map +1 -1
  43. package/lib/module/utils/nativeModule.js +0 -3
  44. package/lib/module/utils/nativeModule.js.map +1 -1
  45. package/lib/typescript/components/GlobalContext.web.d.ts +4 -0
  46. package/lib/typescript/components/RequireSignIn.d.ts +3 -3
  47. package/lib/typescript/hooks/rownd.web.d.ts +2 -0
  48. package/package.json +4 -1
  49. package/src/components/GlobalContext.web.tsx +16 -0
  50. package/src/components/RequireSignIn.tsx +10 -9
  51. package/src/hooks/rownd.ts +1 -1
  52. package/src/hooks/rownd.web.ts +40 -0
  53. package/src/reducer/rowndReducer.ts +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rownd/react-native",
3
- "version": "2.11.2",
3
+ "version": "2.11.4",
4
4
  "description": "test",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -149,5 +149,8 @@
149
149
  }
150
150
  ]
151
151
  ]
152
+ },
153
+ "dependencies": {
154
+ "@rownd/react": "1.5.3"
152
155
  }
153
156
  }
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import type { ContextProps } from './GlobalContext.types';
3
+ import {
4
+ RowndProvider as RowndReactProvider,
5
+ } from '@rownd/react';
6
+
7
+ const RowndProvider: React.FC<ContextProps> = ({ children, config }) => {
8
+ return (
9
+ <RowndReactProvider appKey={config.appKey} apiUrl={config.apiUrl}>
10
+ {children}
11
+ </RowndReactProvider>
12
+ );
13
+ };
14
+
15
+
16
+ export { RowndProvider };
@@ -1,9 +1,7 @@
1
- import React, {
2
- FunctionComponent,
3
- useEffect,
4
- } from 'react';
5
- import { useRownd } from '..';
6
- import type { RequestSignIn } from 'src/hooks/rownd';
1
+ import React, { useEffect } from 'react';
2
+ import { useRownd } from '../hooks/rownd';
3
+ import type { RequestSignIn } from '../hooks/rownd';
4
+ import { Platform } from 'react-native';
7
5
 
8
6
  export type ContextProps = {
9
7
  children?: React.ReactNode;
@@ -11,7 +9,7 @@ export type ContextProps = {
11
9
  signInProps?: RequestSignIn;
12
10
  };
13
11
 
14
- const RequireSignIn: FunctionComponent<ContextProps> = ({
12
+ const RequireSignIn: React.FC<ContextProps> = ({
15
13
  children,
16
14
  initializing,
17
15
  signInProps,
@@ -20,9 +18,12 @@ const RequireSignIn: FunctionComponent<ContextProps> = ({
20
18
 
21
19
  useEffect(() => {
22
20
  if (!is_authenticated && !is_initializing) {
23
- requestSignIn({ ...signInProps });
21
+ requestSignIn({
22
+ ...(Platform.OS === 'web' ? { prevent_closing: true } : undefined),
23
+ ...signInProps,
24
+ });
24
25
  }
25
- }, [is_authenticated, is_initializing, requestSignIn]);
26
+ }, [is_authenticated, is_initializing, signInProps]);
26
27
 
27
28
  if (is_initializing && initializing) {
28
29
  return <>{initializing}</>;
@@ -56,7 +56,7 @@ export function useRownd(): TRowndContext {
56
56
  getIdToken: getFirebaseIdToken,
57
57
  },
58
58
  is_authenticated: !!state.auth.access_token,
59
- is_initializing: !!state.auth.app_id,
59
+ is_initializing: !state.auth.app_id,
60
60
  manageAccount,
61
61
  requestSignIn,
62
62
  signOut,
@@ -0,0 +1,40 @@
1
+ import { useRownd as useReactRownd } from '@rownd/react';
2
+ import type { TRowndContext } from './rownd';
3
+
4
+ export function useRownd(): TRowndContext {
5
+ const {
6
+ requestSignIn,
7
+ signOut,
8
+ getAccessToken,
9
+ is_authenticated,
10
+ is_initializing,
11
+ auth,
12
+ access_token,
13
+ user,
14
+ manageAccount,
15
+ setUser,
16
+ setUserValue
17
+ } = useReactRownd();
18
+
19
+ return {
20
+ access_token,
21
+ auth: {
22
+ access_token,
23
+ app_id: auth.app_id || null,
24
+ is_verified_user: auth.is_verified_user,
25
+ },
26
+ // @ts-ignore
27
+ getAccessToken,
28
+ is_authenticated,
29
+ is_initializing,
30
+ manageAccount,
31
+ requestSignIn: (opts) =>
32
+ requestSignIn({ ...opts, post_login_redirect: opts?.postSignInRedirect }),
33
+ signOut,
34
+ user: {
35
+ data: user.data,
36
+ setValue: setUserValue,
37
+ set: setUser,
38
+ },
39
+ };
40
+ }
@@ -38,7 +38,7 @@ export function rowndReducer(state: GlobalState, action: TAction): GlobalState {
38
38
  auth: {
39
39
  access_token: action.payload?.auth?.access_token,
40
40
  refresh_token: action.payload?.auth?.refresh_token,
41
- app_id: null,
41
+ app_id: action.payload?.appConfig?.id || null,
42
42
  },
43
43
  app: {
44
44
  schema: action.payload.appConfig?.schema,