@rownd/react-native 2.11.1 → 2.11.3

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 (93) hide show
  1. package/android/.gradle/7.4/checksums/checksums.lock +0 -0
  2. package/android/.gradle/7.4/checksums/md5-checksums.bin +0 -0
  3. package/android/.gradle/7.4/checksums/sha1-checksums.bin +0 -0
  4. package/android/.gradle/7.4/dependencies-accessors/dependencies-accessors.lock +0 -0
  5. package/android/.gradle/7.4/executionHistory/executionHistory.lock +0 -0
  6. package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
  7. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  8. package/android/.gradle/buildOutputCleanup/cache.properties +1 -1
  9. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  10. package/android/build.gradle +1 -1
  11. package/android/src/main/java/com/reactnativerowndplugin/RowndPluginModule.kt +17 -0
  12. package/ios/RowndPlugin.m +3 -0
  13. package/ios/RowndPlugin.swift +23 -3
  14. package/lib/commonjs/components/GlobalContext.js +8 -27
  15. package/lib/commonjs/components/GlobalContext.js.map +1 -1
  16. package/lib/commonjs/components/GlobalContext.web.js +21 -0
  17. package/lib/commonjs/components/GlobalContext.web.js.map +1 -0
  18. package/lib/commonjs/components/RequireSignIn.js +39 -0
  19. package/lib/commonjs/components/RequireSignIn.js.map +1 -0
  20. package/lib/commonjs/components/SignedIn.js +23 -0
  21. package/lib/commonjs/components/SignedIn.js.map +1 -0
  22. package/lib/commonjs/components/SignedOut.js +23 -0
  23. package/lib/commonjs/components/SignedOut.js.map +1 -0
  24. package/lib/commonjs/constants/action.js +1 -3
  25. package/lib/commonjs/constants/action.js.map +1 -1
  26. package/lib/commonjs/hooks/rownd.js +10 -10
  27. package/lib/commonjs/hooks/rownd.js.map +1 -1
  28. package/lib/commonjs/hooks/rownd.web.js +46 -0
  29. package/lib/commonjs/hooks/rownd.web.js.map +1 -0
  30. package/lib/commonjs/index.js +22 -2
  31. package/lib/commonjs/index.js.map +1 -1
  32. package/lib/commonjs/reducer/rowndReducer.js +18 -20
  33. package/lib/commonjs/reducer/rowndReducer.js.map +1 -1
  34. package/lib/commonjs/utils/nativeModule.js +7 -20
  35. package/lib/commonjs/utils/nativeModule.js.map +1 -1
  36. package/lib/module/components/GlobalContext.js +2 -11
  37. package/lib/module/components/GlobalContext.js.map +1 -1
  38. package/lib/module/components/GlobalContext.web.js +14 -0
  39. package/lib/module/components/GlobalContext.web.js.map +1 -0
  40. package/lib/module/components/RequireSignIn.js +31 -0
  41. package/lib/module/components/RequireSignIn.js.map +1 -0
  42. package/lib/module/components/SignedIn.js +16 -0
  43. package/lib/module/components/SignedIn.js.map +1 -0
  44. package/lib/module/components/SignedOut.js +16 -0
  45. package/lib/module/components/SignedOut.js.map +1 -0
  46. package/lib/module/constants/action.js +0 -1
  47. package/lib/module/constants/action.js.map +1 -1
  48. package/lib/module/hooks/rownd.js +11 -8
  49. package/lib/module/hooks/rownd.js.map +1 -1
  50. package/lib/module/hooks/rownd.web.js +40 -0
  51. package/lib/module/hooks/rownd.web.js.map +1 -0
  52. package/lib/module/index.js +4 -1
  53. package/lib/module/index.js.map +1 -1
  54. package/lib/module/reducer/rowndReducer.js +18 -16
  55. package/lib/module/reducer/rowndReducer.js.map +1 -1
  56. package/lib/module/utils/nativeModule.js +3 -3
  57. package/lib/module/utils/nativeModule.js.map +1 -1
  58. package/lib/typescript/example_expo/src/App.d.ts +1 -0
  59. package/lib/typescript/src/components/GlobalContext.web.d.ts +4 -0
  60. package/lib/typescript/src/components/RequireSignIn.d.ts +9 -0
  61. package/lib/typescript/src/components/SignedIn.d.ts +6 -0
  62. package/lib/typescript/src/components/SignedOut.d.ts +6 -0
  63. package/lib/typescript/{hooks → src/hooks}/rownd.d.ts +9 -6
  64. package/lib/typescript/src/hooks/rownd.web.d.ts +2 -0
  65. package/lib/typescript/src/index.d.ts +6 -0
  66. package/lib/typescript/{utils → src/utils}/nativeModule.d.ts +1 -0
  67. package/package.json +4 -1
  68. package/rownd-react-native.podspec +1 -1
  69. package/src/components/GlobalContext.web.tsx +16 -0
  70. package/src/components/RequireSignIn.tsx +35 -0
  71. package/src/components/SignedIn.tsx +17 -0
  72. package/src/components/SignedOut.tsx +17 -0
  73. package/src/hooks/rownd.ts +20 -13
  74. package/src/hooks/rownd.web.ts +40 -0
  75. package/src/index.tsx +4 -1
  76. package/src/utils/nativeModule.ts +4 -0
  77. package/android/.gradle/7.4/executionHistory/executionHistory.bin +0 -0
  78. package/android/.gradle/7.4/fileHashes/fileHashes.bin +0 -0
  79. package/android/.gradle/7.4/fileHashes/resourceHashesCache.bin +0 -0
  80. package/android/.gradle/file-system.probe +0 -0
  81. package/android/.idea/compiler.xml +0 -6
  82. package/android/.idea/gradle.xml +0 -18
  83. package/android/.idea/jarRepositories.xml +0 -30
  84. package/android/.idea/misc.xml +0 -10
  85. package/android/.idea/vcs.xml +0 -6
  86. package/android/local.properties +0 -8
  87. package/ios/Rownd.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -4
  88. package/lib/typescript/index.d.ts +0 -3
  89. /package/lib/typescript/{components → src/components}/GlobalContext.d.ts +0 -0
  90. /package/lib/typescript/{components → src/components}/GlobalContext.types.d.ts +0 -0
  91. /package/lib/typescript/{constants → src/constants}/action.d.ts +0 -0
  92. /package/lib/typescript/{reducer → src/reducer}/rowndReducer.d.ts +0 -0
  93. /package/lib/typescript/{utils → src/utils}/config.d.ts +0 -0
@@ -1 +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 user: {\n data: {\n email: null,\n },\n // meta: {}\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 // 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 user: {\n data: {\n ...action.payload?.user?.data,\n email: action.payload?.user?.data?.email,\n },\n // meta: {}\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 // 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;EACAC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJC,KAAK,EAAE;IADH,CADF,CAIJ;;EAJI,CAFsC;EAQ5CC,IAAI,EAAE;IACJC,YAAY,EAAE,IADV;IAEJC,aAAa,EAAE,IAFX;IAGJC,MAAM,EAAE;EAHJ,CARsC;EAa5CC,GAAG,EAAE;IACHC,MAAM,EAAE,IADL;IAEHC,MAAM,EAAE;EAFL,CAbuC,CAiB5C;EACA;;AAlB4C,CAAvC;AAqBP,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;QACTb,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;;QALI,CADG;QAQTC,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,CARG;QAaTC,GAAG,EAAE;UACHC,MAAM,2BAAEI,MAAM,CAACI,OAAP,CAAeC,SAAjB,0DAAE,sBAA0BT,MAD/B;UAEHC,MAAM,EAAE;QAFL,CAbI,CAiBT;QACA;;MAlBS,CAAX;MAoBA,OAAOI,QAAP;;IACF;MACEA,QAAQ,GAAGF,KAAX;MACA,OAAOE,QAAP;EAzBJ;AA2BD"}
1
+ {"version":3,"names":["ActionType","initialRowndState","user","data","email","auth","access_token","refresh_token","app_id","app","schema","config","rowndReducer","state","action","_action$payload","_action$payload2","_action$payload3","_action$payload4","_action$payload$appCo","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 user: {\n data: {\n email: null,\n },\n // meta: {}\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 // 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 user: {\n data: {\n ...action.payload?.user?.data,\n email: action.payload?.user?.data?.email,\n },\n // meta: {}\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 // 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,UAAU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AAA,GAAdA,gBAAA,CAAgBb,IAAI,cAAAa,gBAAA,uBAApBA,gBAAA,CAAsBX,aAAa;UAClDC,MAAM,EAAE;QACV,CAAC;QACDC,GAAG,EAAE;UACHC,MAAM,GAAAS,qBAAA,GAAEL,MAAM,CAACS,OAAO,CAACC,SAAS,cAAAL,qBAAA,uBAAxBA,qBAAA,CAA0BT,MAAM;UACxCC,MAAM,EAAE;QACV;QACA;QACA;MACF,CAAC;;MACD,OAAOS,QAAQ;IACjB;MACEA,QAAQ,GAAGP,KAAK;MAChB,OAAOO,QAAQ;EACnB;AACF"}
@@ -7,13 +7,11 @@ export const Rownd = NativeModules.RowndPlugin ? NativeModules.RowndPlugin : new
7
7
  get() {
8
8
  throw new Error(LINKING_ERROR);
9
9
  }
10
-
11
10
  });
12
11
  export const IOSRowndEventEmitter = Platform.OS !== 'ios' ? null : NativeModules.RowndPluginEventEmitter ? NativeModules.RowndPluginEventEmitter : new Proxy({}, {
13
12
  get() {
14
13
  throw new Error(LINKING_ERROR);
15
14
  }
16
-
17
15
  });
18
16
  export function configure(config) {
19
17
  return Rownd.configure(config);
@@ -27,7 +25,6 @@ export function requestSignIn(config) {
27
25
  method: 'default'
28
26
  });
29
27
  }
30
-
31
28
  return Rownd.requestSignIn({
32
29
  method: config === null || config === void 0 ? void 0 : config.method,
33
30
  postSignInRedirect: config === null || config === void 0 ? void 0 : config.postSignInRedirect,
@@ -43,6 +40,9 @@ export function manageAccount() {
43
40
  export function getAccessToken(token) {
44
41
  return Rownd.getAccessToken(token || null);
45
42
  }
43
+ export function getFirebaseIdToken() {
44
+ return Rownd.getFirebaseIdToken();
45
+ }
46
46
  export function setUserDataValue(key, value) {
47
47
  return Rownd.setUserDataValue(key, Platform.OS === 'android' ? {
48
48
  value
@@ -1 +1 @@
1
- {"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","Rownd","RowndPlugin","Proxy","get","Error","IOSRowndEventEmitter","OS","RowndPluginEventEmitter","configure","config","customizations","customizationConfig","requestSignIn","method","postSignInRedirect","intent","signOut","manageAccount","getAccessToken","token","setUserDataValue","key","value","setUserData","data","handleSignInLink","url"],"sources":["nativeModule.ts"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\nimport type { RequestSignIn } from 'src/hooks/rownd';\nimport type { Customizations, IConfig } from './config';\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\nexport function configure(config: IConfig): Promise<string> {\n return Rownd.configure(config);\n}\n\nexport function customizations(customizationConfig: Customizations) {\n return Rownd.customizations(customizationConfig);\n}\n\nexport function requestSignIn(config?: RequestSignIn) {\n if (!config) {\n return Rownd.requestSignIn({ method: 'default' });\n }\n return Rownd.requestSignIn({\n method: config?.method,\n postSignInRedirect: config?.postSignInRedirect,\n intent: config?.intent\n });\n}\n\nexport function signOut() {\n return Rownd.signOut();\n}\n\nexport function manageAccount() {\n return Rownd.manageAccount();\n}\n\nexport function getAccessToken(token?: string): Promise<string> {\n return Rownd.getAccessToken(token || null);\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\nexport function handleSignInLink(url: string) {\n return Rownd.handleSignInLink(url);\n}\n"],"mappings":"AAAA,SAASA,aAAT,EAAwBC,QAAxB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M,CAAEM;EAHS,CAApB,CAAP;AAKD;AAED,OAAO,SAASC,OAAT,GAAmB;EACxB,OAAOhB,KAAK,CAACgB,OAAN,EAAP;AACD;AAED,OAAO,SAASC,aAAT,GAAyB;EAC9B,OAAOjB,KAAK,CAACiB,aAAN,EAAP;AACD;AAED,OAAO,SAASC,cAAT,CAAwBC,KAAxB,EAAyD;EAC9D,OAAOnB,KAAK,CAACkB,cAAN,CAAqBC,KAAK,IAAI,IAA9B,CAAP;AACD;AAED,OAAO,SAASC,gBAAT,CAA0BC,GAA1B,EAAuCC,KAAvC,EAAmD;EACxD,OAAOtB,KAAK,CAACoB,gBAAN,CACLC,GADK,EAEL1B,QAAQ,CAACW,EAAT,KAAgB,SAAhB,GAA4B;IAAEgB;EAAF,CAA5B,GAAwCA,KAFnC,CAAP;AAID;AAED,OAAO,SAASC,WAAT,CAAqBC,IAArB,EAAgD;EACrD,OAAOxB,KAAK,CAACuB,WAAN,CAAkBC,IAAlB,CAAP;AACD;AAED,OAAO,SAASC,gBAAT,CAA0BC,GAA1B,EAAuC;EAC5C,OAAO1B,KAAK,CAACyB,gBAAN,CAAuBC,GAAvB,CAAP;AACD"}
1
+ {"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","Rownd","RowndPlugin","Proxy","get","Error","IOSRowndEventEmitter","OS","RowndPluginEventEmitter","configure","config","customizations","customizationConfig","requestSignIn","method","postSignInRedirect","intent","signOut","manageAccount","getAccessToken","token","getFirebaseIdToken","setUserDataValue","key","value","setUserData","data","handleSignInLink","url"],"sources":["nativeModule.ts"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\nimport type { RequestSignIn } from 'src/hooks/rownd';\nimport type { Customizations, IConfig } from './config';\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\nexport function configure(config: IConfig): Promise<string> {\n return Rownd.configure(config);\n}\n\nexport function customizations(customizationConfig: Customizations) {\n return Rownd.customizations(customizationConfig);\n}\n\nexport function requestSignIn(config?: RequestSignIn) {\n if (!config) {\n return Rownd.requestSignIn({ method: 'default' });\n }\n return Rownd.requestSignIn({\n method: config?.method,\n postSignInRedirect: config?.postSignInRedirect,\n intent: config?.intent\n });\n}\n\nexport function signOut() {\n return Rownd.signOut();\n}\n\nexport function manageAccount() {\n return Rownd.manageAccount();\n}\n\nexport function getAccessToken(token?: string): Promise<string> {\n return Rownd.getAccessToken(token || null);\n}\n\nexport function getFirebaseIdToken(): Promise<string> {\n return Rownd.getFirebaseIdToken();\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\nexport function handleSignInLink(url: string) {\n return Rownd.handleSignInLink(url);\n}\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAItD,OAAO,MAAMC,aAAa,GACvB,8EAA6E,GAC9ED,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,6CAA6C;AAE/C,OAAO,MAAMC,KAAK,GAAGN,aAAa,CAACO,WAAW,GAC1CP,aAAa,CAACO,WAAW,GACzB,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAG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IAAI,IAAI,CAAC;AAC5C;AAEA,OAAO,SAASC,kBAAkBA,CAAA,EAAoB;EACpD,OAAOpB,KAAK,CAACoB,kBAAkB,CAAC,CAAC;AACnC;AAEA,OAAO,SAASC,gBAAgBA,CAACC,GAAW,EAAEC,KAAU,EAAE;EACxD,OAAOvB,KAAK,CAACqB,gBAAgB,CAC3BC,GAAG,EACH3B,QAAQ,CAACW,EAAE,KAAK,SAAS,GAAG;IAAEiB;EAAM,CAAC,GAAGA,KAC1C,CAAC;AACH;AAEA,OAAO,SAASC,WAAWA,CAACC,IAAyB,EAAE;EACrD,OAAOzB,KAAK,CAACwB,WAAW,CAACC,IAAI,CAAC;AAChC;AAEA,OAAO,SAASC,gBAAgBA,CAACC,GAAW,EAAE;EAC5C,OAAO3B,KAAK,CAAC0B,gBAAgB,CAACC,GAAG,CAAC;AACpC"}
@@ -0,0 +1 @@
1
+ export default function App(): JSX.Element;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type { ContextProps } from './GlobalContext.types';
3
+ declare const RowndProvider: React.FC<ContextProps>;
4
+ export { RowndProvider };
@@ -0,0 +1,9 @@
1
+ import React, { FunctionComponent } from 'react';
2
+ import type { RequestSignIn } from 'src/hooks/rownd';
3
+ export declare type ContextProps = {
4
+ children?: React.ReactNode;
5
+ initializing?: React.ReactNode;
6
+ signInProps?: RequestSignIn;
7
+ };
8
+ declare const RequireSignIn: FunctionComponent<ContextProps>;
9
+ export default RequireSignIn;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ interface SignedInProps {
3
+ children: React.ReactNode;
4
+ }
5
+ declare const SignedIn: React.FC<SignedInProps>;
6
+ export default SignedIn;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ interface SignedOutProps {
3
+ children: React.ReactNode;
4
+ }
5
+ declare const SignedOut: React.FC<SignedOutProps>;
6
+ export default SignedOut;
@@ -1,13 +1,16 @@
1
1
  export declare type TRowndContext = {
2
+ access_token: string | null;
3
+ auth: AuthContext;
4
+ is_authenticated: boolean;
5
+ is_initializing: boolean;
6
+ firebase: {
7
+ getIdToken: () => Promise<string>;
8
+ };
9
+ getAccessToken: (token?: string) => Promise<string>;
10
+ manageAccount: () => void;
2
11
  requestSignIn: (e?: RequestSignIn) => void;
3
12
  signOut: () => void;
4
- manageAccount: () => void;
5
- getAccessToken: (token?: string) => Promise<string>;
6
13
  user: UserContext;
7
- is_authenticated: boolean;
8
- is_initializing: boolean;
9
- access_token: string | null;
10
- auth: AuthContext;
11
14
  };
12
15
  declare type UserContext = {
13
16
  data: {
@@ -0,0 +1,2 @@
1
+ import type { TRowndContext } from './rownd';
2
+ export declare function useRownd(): TRowndContext;
@@ -0,0 +1,6 @@
1
+ import { RowndProvider } from './components/GlobalContext';
2
+ import { useRownd } from './hooks/rownd';
3
+ import RequireSignIn from './components/RequireSignIn';
4
+ import SignedIn from './components/SignedIn';
5
+ import SignedOut from './components/SignedOut';
6
+ export { RowndProvider, useRownd, RequireSignIn, SignedIn, SignedOut };
@@ -9,6 +9,7 @@ export declare function requestSignIn(config?: RequestSignIn): any;
9
9
  export declare function signOut(): any;
10
10
  export declare function manageAccount(): any;
11
11
  export declare function getAccessToken(token?: string): Promise<string>;
12
+ export declare function getFirebaseIdToken(): Promise<string>;
12
13
  export declare function setUserDataValue(key: string, value: any): any;
13
14
  export declare function setUserData(data: Record<string, any>): any;
14
15
  export declare function handleSignInLink(url: string): any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rownd/react-native",
3
- "version": "2.11.1",
3
+ "version": "2.11.3",
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
  }
@@ -17,7 +17,7 @@ Pod::Spec.new do |s|
17
17
  s.source_files = "ios/**/*.{h,m,mm,swift}"
18
18
 
19
19
  s.dependency "React-Core"
20
- s.dependency "Rownd", "~> 2.7.0"
20
+ s.dependency "Rownd", "~> 2.8.1"
21
21
 
22
22
  # Don't install the dependencies when we run `pod install` in the old architecture.
23
23
  if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
@@ -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 };
@@ -0,0 +1,35 @@
1
+ import React, { FunctionComponent, useEffect } from 'react';
2
+ import { useRownd } from '..';
3
+ import type { RequestSignIn } from 'src/hooks/rownd';
4
+ import { Platform } from 'react-native';
5
+
6
+ export type ContextProps = {
7
+ children?: React.ReactNode;
8
+ initializing?: React.ReactNode;
9
+ signInProps?: RequestSignIn;
10
+ };
11
+
12
+ const RequireSignIn: FunctionComponent<ContextProps> = ({
13
+ children,
14
+ initializing,
15
+ signInProps,
16
+ }) => {
17
+ const { is_authenticated, is_initializing, requestSignIn } = useRownd();
18
+
19
+ useEffect(() => {
20
+ if (!is_authenticated && !is_initializing) {
21
+ requestSignIn({
22
+ ...(Platform.OS === 'web' ? { prevent_closing: true } : undefined),
23
+ ...signInProps,
24
+ });
25
+ }
26
+ }, [is_authenticated, is_initializing, signInProps]);
27
+
28
+ if (is_initializing && initializing) {
29
+ return <>{initializing}</>;
30
+ }
31
+
32
+ return <>{children}</>;
33
+ };
34
+
35
+ export default RequireSignIn;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { useRownd } from '../hooks/rownd';
3
+
4
+ interface SignedInProps {
5
+ children: React.ReactNode;
6
+ }
7
+
8
+ const SignedIn: React.FC<SignedInProps> = ({ children }) => {
9
+ const { is_authenticated } = useRownd();
10
+
11
+ if (!is_authenticated) {
12
+ return null;
13
+ }
14
+ return <>{children}</>;
15
+ };
16
+
17
+ export default SignedIn;
@@ -0,0 +1,17 @@
1
+ import React from 'react'
2
+ import { useRownd } from '../hooks/rownd';
3
+
4
+ interface SignedOutProps {
5
+ children: React.ReactNode;
6
+ }
7
+
8
+ const SignedOut: React.FC<SignedOutProps> = ({ children }) => {
9
+ const { is_authenticated } = useRownd();
10
+
11
+ if (is_authenticated) {
12
+ return null;
13
+ }
14
+ return <>{children}</>;
15
+ };
16
+
17
+ export default SignedOut
@@ -3,21 +3,25 @@ import {
3
3
  signOut,
4
4
  manageAccount,
5
5
  getAccessToken,
6
+ getFirebaseIdToken,
6
7
  setUserDataValue,
7
8
  setUserData,
8
9
  } from '../utils/nativeModule';
9
10
  import { useRowndContext } from '../components/GlobalContext';
10
11
 
11
12
  export type TRowndContext = {
13
+ access_token: string | null;
14
+ auth: AuthContext;
15
+ is_authenticated: boolean;
16
+ is_initializing: boolean;
17
+ firebase: {
18
+ getIdToken: () => Promise<string>;
19
+ }
20
+ getAccessToken: (token?: string) => Promise<string>;
21
+ manageAccount: () => void;
12
22
  requestSignIn: (e?: RequestSignIn) => void;
13
23
  signOut: () => void;
14
- manageAccount: () => void;
15
- getAccessToken: (token?: string) => Promise<string>;
16
24
  user: UserContext;
17
- is_authenticated: boolean;
18
- is_initializing: boolean;
19
- access_token: string | null;
20
- auth: AuthContext;
21
25
  };
22
26
 
23
27
  type UserContext = {
@@ -45,18 +49,21 @@ export function useRownd(): TRowndContext {
45
49
  const { state } = useRowndContext();
46
50
 
47
51
  return {
52
+ access_token: state.auth.access_token,
53
+ auth: state.auth,
54
+ getAccessToken,
55
+ firebase: {
56
+ getIdToken: getFirebaseIdToken,
57
+ },
58
+ is_authenticated: !!state.auth.access_token,
59
+ is_initializing: !!state.auth.app_id,
60
+ manageAccount,
48
61
  requestSignIn,
49
62
  signOut,
50
- manageAccount,
51
- getAccessToken,
52
63
  user: {
53
64
  data: state.user.data,
54
65
  setValue: setUserDataValue,
55
66
  set: setUserData,
56
- },
57
- is_authenticated: !!state.auth.access_token,
58
- is_initializing: !!state.auth.app_id,
59
- auth: state.auth,
60
- access_token: state.auth.access_token,
67
+ },
61
68
  };
62
69
  }
@@ -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
+ }
package/src/index.tsx CHANGED
@@ -1,4 +1,7 @@
1
1
  import { RowndProvider } from './components/GlobalContext';
2
2
  import { useRownd } from './hooks/rownd';
3
+ import RequireSignIn from './components/RequireSignIn';
4
+ import SignedIn from './components/SignedIn';
5
+ import SignedOut from './components/SignedOut';
3
6
 
4
- export { RowndProvider, useRownd };
7
+ export { RowndProvider, useRownd, RequireSignIn, SignedIn, SignedOut };
@@ -64,6 +64,10 @@ export function getAccessToken(token?: string): Promise<string> {
64
64
  return Rownd.getAccessToken(token || null);
65
65
  }
66
66
 
67
+ export function getFirebaseIdToken(): Promise<string> {
68
+ return Rownd.getFirebaseIdToken();
69
+ }
70
+
67
71
  export function setUserDataValue(key: string, value: any) {
68
72
  return Rownd.setUserDataValue(
69
73
  key,
Binary file
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="CompilerConfiguration">
4
- <bytecodeTargetLevel target="11" />
5
- </component>
6
- </project>
@@ -1,18 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="GradleMigrationSettings" migrationVersion="1" />
4
- <component name="GradleSettings">
5
- <option name="linkedExternalProjectsSettings">
6
- <GradleProjectSettings>
7
- <option name="testRunner" value="GRADLE" />
8
- <option name="distributionType" value="DEFAULT_WRAPPED" />
9
- <option name="externalProjectPath" value="$PROJECT_DIR$" />
10
- <option name="modules">
11
- <set>
12
- <option value="$PROJECT_DIR$" />
13
- </set>
14
- </option>
15
- </GradleProjectSettings>
16
- </option>
17
- </component>
18
- </project>
@@ -1,30 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="RemoteRepositoriesConfiguration">
4
- <remote-repository>
5
- <option name="id" value="central" />
6
- <option name="name" value="Maven Central repository" />
7
- <option name="url" value="https://repo1.maven.org/maven2" />
8
- </remote-repository>
9
- <remote-repository>
10
- <option name="id" value="jboss.community" />
11
- <option name="name" value="JBoss Community repository" />
12
- <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
13
- </remote-repository>
14
- <remote-repository>
15
- <option name="id" value="React Native sources" />
16
- <option name="name" value="React Native sources" />
17
- <option name="url" value="file:$PROJECT_DIR$/../node_modules/react-native/android/" />
18
- </remote-repository>
19
- <remote-repository>
20
- <option name="id" value="MavenRepo" />
21
- <option name="name" value="MavenRepo" />
22
- <option name="url" value="https://repo.maven.apache.org/maven2/" />
23
- </remote-repository>
24
- <remote-repository>
25
- <option name="id" value="Google" />
26
- <option name="name" value="Google" />
27
- <option name="url" value="https://dl.google.com/dl/android/maven2/" />
28
- </remote-repository>
29
- </component>
30
- </project>
@@ -1,10 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ExternalStorageConfigurationManager" enabled="true" />
4
- <component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
5
- <output url="file://$PROJECT_DIR$/build/classes" />
6
- </component>
7
- <component name="ProjectType">
8
- <option name="id" value="Android" />
9
- </component>
10
- </project>
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$/.." vcs="Git" />
5
- </component>
6
- </project>
@@ -1,8 +0,0 @@
1
- ## This file must *NOT* be checked into Version Control Systems,
2
- # as it contains information specific to your local configuration.
3
- #
4
- # Location of the SDK. This is only used by Gradle.
5
- # For customization when using a Version Control System, please read the
6
- # header note.
7
- #Tue Nov 01 11:51:46 EDT 2022
8
- sdk.dir=/Users/michaelmurray/Library/Android/sdk
@@ -1,4 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <Workspace
3
- version = "1.0">
4
- </Workspace>
@@ -1,3 +0,0 @@
1
- import { RowndProvider } from './components/GlobalContext';
2
- import { useRownd } from './hooks/rownd';
3
- export { RowndProvider, useRownd };
File without changes