@rownd/react-native 2.11.2 → 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.
- package/android/.gradle/7.4/checksums/checksums.lock +0 -0
- package/lib/commonjs/components/GlobalContext.js +8 -27
- package/lib/commonjs/components/GlobalContext.js.map +1 -1
- package/lib/commonjs/components/GlobalContext.web.js +21 -0
- package/lib/commonjs/components/GlobalContext.web.js.map +1 -0
- package/lib/commonjs/components/RequireSignIn.js +10 -14
- package/lib/commonjs/components/RequireSignIn.js.map +1 -1
- package/lib/commonjs/components/SignedIn.js +1 -9
- package/lib/commonjs/components/SignedIn.js.map +1 -1
- package/lib/commonjs/components/SignedOut.js +1 -9
- package/lib/commonjs/components/SignedOut.js.map +1 -1
- package/lib/commonjs/constants/action.js +1 -3
- package/lib/commonjs/constants/action.js.map +1 -1
- package/lib/commonjs/hooks/rownd.js +0 -3
- package/lib/commonjs/hooks/rownd.js.map +1 -1
- package/lib/commonjs/hooks/rownd.web.js +46 -0
- package/lib/commonjs/hooks/rownd.web.js.map +1 -0
- package/lib/commonjs/index.js +0 -6
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/reducer/rowndReducer.js +18 -20
- package/lib/commonjs/reducer/rowndReducer.js.map +1 -1
- package/lib/commonjs/utils/nativeModule.js +3 -21
- package/lib/commonjs/utils/nativeModule.js.map +1 -1
- package/lib/module/components/GlobalContext.js +2 -11
- package/lib/module/components/GlobalContext.js.map +1 -1
- package/lib/module/components/GlobalContext.web.js +14 -0
- package/lib/module/components/GlobalContext.web.js.map +1 -0
- package/lib/module/components/RequireSignIn.js +7 -6
- package/lib/module/components/RequireSignIn.js.map +1 -1
- package/lib/module/components/SignedIn.js +0 -4
- package/lib/module/components/SignedIn.js.map +1 -1
- package/lib/module/components/SignedOut.js +0 -4
- package/lib/module/components/SignedOut.js.map +1 -1
- package/lib/module/constants/action.js +0 -1
- package/lib/module/constants/action.js.map +1 -1
- package/lib/module/hooks/rownd.js.map +1 -1
- package/lib/module/hooks/rownd.web.js +40 -0
- package/lib/module/hooks/rownd.web.js.map +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/reducer/rowndReducer.js +18 -16
- package/lib/module/reducer/rowndReducer.js.map +1 -1
- package/lib/module/utils/nativeModule.js +0 -3
- package/lib/module/utils/nativeModule.js.map +1 -1
- package/lib/typescript/example_expo/src/App.d.ts +1 -0
- package/lib/typescript/src/components/GlobalContext.web.d.ts +4 -0
- package/lib/typescript/src/hooks/rownd.web.d.ts +2 -0
- package/package.json +4 -1
- package/src/components/GlobalContext.web.tsx +16 -0
- package/src/components/RequireSignIn.tsx +7 -6
- package/src/hooks/rownd.web.ts +40 -0
- /package/lib/typescript/{components → src/components}/GlobalContext.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/GlobalContext.types.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/RequireSignIn.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/SignedIn.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/SignedOut.d.ts +0 -0
- /package/lib/typescript/{constants → src/constants}/action.d.ts +0 -0
- /package/lib/typescript/{hooks → src/hooks}/rownd.d.ts +0 -0
- /package/lib/typescript/{index.d.ts → src/index.d.ts} +0 -0
- /package/lib/typescript/{reducer → src/reducer}/rowndReducer.d.ts +0 -0
- /package/lib/typescript/{utils → src/utils}/config.d.ts +0 -0
- /package/lib/typescript/{utils → src/utils}/nativeModule.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["LINKING_ERROR","Platform","select","ios","default","Rownd","NativeModules","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":"
|
|
1
|
+
{"version":3,"names":["_reactNative","require","LINKING_ERROR","exports","Platform","select","ios","default","Rownd","NativeModules","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,IAAAA,YAAA,GAAAC,OAAA;AAIO,MAAMC,aAAa,GAAAC,OAAA,CAAAD,aAAA,GACvB,8EAA6E,GAC9EE,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,6CAA6C;AAExC,MAAMC,KAAK,GAAAL,OAAA,CAAAK,KAAA,GAAGC,0BAAa,CAACC,WAAW,GAC1CD,0BAAa,CAACC,WAAW,GACzB,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACX,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEE,MAAMY,oBAAoB,GAAAX,OAAA,CAAAW,oBAAA,GAC/BV,qBAAQ,CAACW,EAAE,KAAK,KAAK,GACjB,IAAI,GACJN,0BAAa,CAACO,uBAAuB,GACrCP,0BAAa,CAACO,uBAAuB,GACrC,IAAIL,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACX,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEA,SAASe,SAASA,CAACC,MAAe,EAAmB;EAC1D,OAAOV,KAAK,CAACS,SAAS,CAACC,MAAM,CAAC;AAChC;AAEO,SAASC,cAAcA,CAACC,mBAAmC,EAAE;EAClE,OAAOZ,KAAK,CAACW,cAAc,CAACC,mBAAmB,CAAC;AAClD;AAEO,SAASC,aAAaA,CAACH,MAAsB,EAAE;EACpD,IAAI,CAACA,MAAM,EAAE;IACX,OAAOV,KAAK,CAACa,aAAa,CAAC;MAAEC,MAAM,EAAE;IAAU,CAAC,CAAC;EACnD;EACA,OAAOd,KAAK,CAACa,aAAa,CAAC;IACzBC,MAAM,EAAEJ,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEI,MAAM;IACtBC,kBAAkB,EAAEL,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEK,kBAAkB;IAC9CC,MAAM,EAAEN,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEM;EAClB,CAAC,CAAC;AACJ;AAEO,SAASC,OAAOA,CAAA,EAAG;EACxB,OAAOjB,KAAK,CAACiB,OAAO,CAAC,CAAC;AACxB;AAEO,SAASC,aAAaA,CAAA,EAAG;EAC9B,OAAOlB,KAAK,CAACkB,aAAa,CAAC,CAAC;AAC9B;AAEO,SAASC,cAAcA,CAACC,KAAc,EAAmB;EAC9D,OAAOpB,KAAK,CAACmB,cAAc,CAACC,KAAK,IAAI,IAAI,CAAC;AAC5C;AAEO,SAASC,kBAAkBA,CAAA,EAAoB;EACpD,OAAOrB,KAAK,CAACqB,kBAAkB,CAAC,CAAC;AACnC;AAEO,SAASC,gBAAgBA,CAACC,GAAW,EAAEC,KAAU,EAAE;EACxD,OAAOxB,KAAK,CAACsB,gBAAgB,CAC3BC,GAAG,EACH3B,qBAAQ,CAACW,EAAE,KAAK,SAAS,GAAG;IAAEiB;EAAM,CAAC,GAAGA,KAC1C,CAAC;AACH;AAEO,SAASC,WAAWA,CAACC,IAAyB,EAAE;EACrD,OAAO1B,KAAK,CAACyB,WAAW,CAACC,IAAI,CAAC;AAChC;AAEO,SAASC,gBAAgBA,CAACC,GAAW,EAAE;EAC5C,OAAO5B,KAAK,CAAC2B,gBAAgB,CAACC,GAAG,CAAC;AACpC"}
|
|
@@ -8,7 +8,6 @@ YellowBox.ignoreWarnings(['Sending `update_state` with no listeners registered.'
|
|
|
8
8
|
YellowBox.ignoreWarnings(['YellowBox has been replaced with LogBox.']);
|
|
9
9
|
export const GlobalContext = /*#__PURE__*/createContext(undefined);
|
|
10
10
|
const eventEmitter = new NativeEventEmitter(IOSRowndEventEmitter || Rownd);
|
|
11
|
-
|
|
12
11
|
const RowndProvider = _ref => {
|
|
13
12
|
let {
|
|
14
13
|
children,
|
|
@@ -22,7 +21,6 @@ const RowndProvider = _ref => {
|
|
|
22
21
|
};
|
|
23
22
|
useEffect(() => {
|
|
24
23
|
NativeRowndModules.configure(config);
|
|
25
|
-
|
|
26
24
|
if (customizations) {
|
|
27
25
|
NativeRowndModules.customizations(customizations);
|
|
28
26
|
}
|
|
@@ -34,24 +32,21 @@ const RowndProvider = _ref => {
|
|
|
34
32
|
payload: Platform.OS === 'android' ? JSON.parse(event.state) : event
|
|
35
33
|
});
|
|
36
34
|
};
|
|
37
|
-
|
|
38
35
|
const subscription = eventEmitter.addListener('update_state', onSessionConnect);
|
|
39
36
|
if (!subscription) return;
|
|
40
37
|
return () => {
|
|
41
38
|
subscription.remove();
|
|
42
39
|
};
|
|
43
|
-
}, []);
|
|
40
|
+
}, []);
|
|
44
41
|
|
|
42
|
+
// Handle deep linking
|
|
45
43
|
useEffect(() => {
|
|
46
44
|
if (Platform.OS !== 'ios') {
|
|
47
45
|
return;
|
|
48
46
|
}
|
|
49
|
-
|
|
50
47
|
Linking.addEventListener('url', event => NativeRowndModules.handleSignInLink(event.url));
|
|
51
|
-
|
|
52
48
|
(async () => {
|
|
53
49
|
const initialUrl = await Linking.getInitialURL();
|
|
54
|
-
|
|
55
50
|
if (initialUrl) {
|
|
56
51
|
NativeRowndModules.handleSignInLink(initialUrl);
|
|
57
52
|
}
|
|
@@ -61,16 +56,12 @@ const RowndProvider = _ref => {
|
|
|
61
56
|
value: value
|
|
62
57
|
}, children);
|
|
63
58
|
};
|
|
64
|
-
|
|
65
59
|
function useRowndContext() {
|
|
66
60
|
const context = useContext(GlobalContext);
|
|
67
|
-
|
|
68
61
|
if (context === undefined) {
|
|
69
62
|
throw new Error('useGlobalContext must be used within a GlobalContext Provider');
|
|
70
63
|
}
|
|
71
|
-
|
|
72
64
|
return context;
|
|
73
65
|
}
|
|
74
|
-
|
|
75
66
|
export { RowndProvider, useRowndContext };
|
|
76
67
|
//# sourceMappingURL=GlobalContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useReducer","createContext","useEffect","useContext","NativeEventEmitter","YellowBox","Platform","Linking","initialRowndState","rowndReducer","NativeRowndModules","Rownd","IOSRowndEventEmitter","ActionType","ignoreWarnings","GlobalContext","undefined","eventEmitter","RowndProvider","children","config","customizations","state","dispatch","value","configure","appKey","onSessionConnect","event","type","UPDATE_STATE","payload","OS","JSON","parse","subscription","addListener","remove","addEventListener","handleSignInLink","url","initialUrl","getInitialURL","useRowndContext","context","Error"],"sources":["GlobalContext.tsx"],"sourcesContent":["import React, {\n useReducer,\n createContext,\n FunctionComponent,\n useEffect,\n useContext,\n} from 'react';\nimport { NativeEventEmitter, YellowBox, Platform, Linking } from 'react-native';\nimport { initialRowndState, rowndReducer } from '../reducer/rowndReducer';\n\nimport * as NativeRowndModules from '../utils/nativeModule';\nimport { Rownd, IOSRowndEventEmitter } from '../utils/nativeModule';\nimport type { ContextProps, GlobalState } from './GlobalContext.types';\nimport type { TAction } from '../constants/action';\nimport { ActionType } from '../constants/action';\n\nYellowBox.ignoreWarnings([\n 'Sending `update_state` with no listeners registered.',\n]);\nYellowBox.ignoreWarnings(['YellowBox has been replaced with LogBox.']);\n\nexport const GlobalContext = createContext<\n { state: GlobalState; dispatch: React.Dispatch<TAction> } | undefined\n>(undefined);\n\nconst eventEmitter = new NativeEventEmitter(IOSRowndEventEmitter || Rownd);\n\nconst RowndProvider: FunctionComponent<ContextProps> = ({\n children,\n config,\n customizations\n}) => {\n const [state, dispatch] = useReducer(rowndReducer, initialRowndState);\n const value = { state, dispatch };\n\n useEffect(() => {\n NativeRowndModules.configure(config);\n if (customizations) {\n NativeRowndModules.customizations(customizations);\n }\n }, [config.appKey]);\n\n useEffect(() => {\n const onSessionConnect = (event: any) => {\n dispatch({\n type: ActionType.UPDATE_STATE,\n payload: Platform.OS === 'android' ? JSON.parse(event.state) : event,\n });\n };\n const subscription = eventEmitter.addListener(\n 'update_state',\n onSessionConnect\n );\n\n if (!subscription) return;\n\n return () => {\n subscription.remove();\n };\n }, []);\n\n // Handle deep linking\n useEffect(() => {\n if (Platform.OS !== 'ios') {\n return;\n }\n\n Linking.addEventListener('url', (event) =>\n NativeRowndModules.handleSignInLink(event.url)\n );\n\n (async () => {\n const initialUrl = await Linking.getInitialURL();\n if (initialUrl) {\n NativeRowndModules.handleSignInLink(initialUrl);\n }\n })();\n }, []);\n\n return (\n <GlobalContext.Provider value={value}>{children}</GlobalContext.Provider>\n );\n};\n\nfunction useRowndContext() {\n const context = useContext(GlobalContext);\n\n if (context === undefined) {\n throw new Error(\n 'useGlobalContext must be used within a GlobalContext Provider'\n );\n }\n\n return context;\n}\n\nexport { RowndProvider, useRowndContext };\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"names":["React","useReducer","createContext","useEffect","useContext","NativeEventEmitter","YellowBox","Platform","Linking","initialRowndState","rowndReducer","NativeRowndModules","Rownd","IOSRowndEventEmitter","ActionType","ignoreWarnings","GlobalContext","undefined","eventEmitter","RowndProvider","_ref","children","config","customizations","state","dispatch","value","configure","appKey","onSessionConnect","event","type","UPDATE_STATE","payload","OS","JSON","parse","subscription","addListener","remove","addEventListener","handleSignInLink","url","initialUrl","getInitialURL","createElement","Provider","useRowndContext","context","Error"],"sources":["GlobalContext.tsx"],"sourcesContent":["import React, {\n useReducer,\n createContext,\n FunctionComponent,\n useEffect,\n useContext,\n} from 'react';\nimport { NativeEventEmitter, YellowBox, Platform, Linking } from 'react-native';\nimport { initialRowndState, rowndReducer } from '../reducer/rowndReducer';\n\nimport * as NativeRowndModules from '../utils/nativeModule';\nimport { Rownd, IOSRowndEventEmitter } from '../utils/nativeModule';\nimport type { ContextProps, GlobalState } from './GlobalContext.types';\nimport type { TAction } from '../constants/action';\nimport { ActionType } from '../constants/action';\n\nYellowBox.ignoreWarnings([\n 'Sending `update_state` with no listeners registered.',\n]);\nYellowBox.ignoreWarnings(['YellowBox has been replaced with LogBox.']);\n\nexport const GlobalContext = createContext<\n { state: GlobalState; dispatch: React.Dispatch<TAction> } | undefined\n>(undefined);\n\nconst eventEmitter = new NativeEventEmitter(IOSRowndEventEmitter || Rownd);\n\nconst RowndProvider: FunctionComponent<ContextProps> = ({\n children,\n config,\n customizations\n}) => {\n const [state, dispatch] = useReducer(rowndReducer, initialRowndState);\n const value = { state, dispatch };\n\n useEffect(() => {\n NativeRowndModules.configure(config);\n if (customizations) {\n NativeRowndModules.customizations(customizations);\n }\n }, [config.appKey]);\n\n useEffect(() => {\n const onSessionConnect = (event: any) => {\n dispatch({\n type: ActionType.UPDATE_STATE,\n payload: Platform.OS === 'android' ? JSON.parse(event.state) : event,\n });\n };\n const subscription = eventEmitter.addListener(\n 'update_state',\n onSessionConnect\n );\n\n if (!subscription) return;\n\n return () => {\n subscription.remove();\n };\n }, []);\n\n // Handle deep linking\n useEffect(() => {\n if (Platform.OS !== 'ios') {\n return;\n }\n\n Linking.addEventListener('url', (event) =>\n NativeRowndModules.handleSignInLink(event.url)\n );\n\n (async () => {\n const initialUrl = await Linking.getInitialURL();\n if (initialUrl) {\n NativeRowndModules.handleSignInLink(initialUrl);\n }\n })();\n }, []);\n\n return (\n <GlobalContext.Provider value={value}>{children}</GlobalContext.Provider>\n );\n};\n\nfunction useRowndContext() {\n const context = useContext(GlobalContext);\n\n if (context === undefined) {\n throw new Error(\n 'useGlobalContext must be used within a GlobalContext Provider'\n );\n }\n\n return context;\n}\n\nexport { RowndProvider, useRowndContext };\n"],"mappings":"AAAA,OAAOA,KAAK,IACVC,UAAU,EACVC,aAAa,EAEbC,SAAS,EACTC,UAAU,QACL,OAAO;AACd,SAASC,kBAAkB,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,OAAO,QAAQ,cAAc;AAC/E,SAASC,iBAAiB,EAAEC,YAAY,QAAQ,yBAAyB;AAEzE,OAAO,KAAKC,kBAAkB,MAAM,uBAAuB;AAC3D,SAASC,KAAK,EAAEC,oBAAoB,QAAQ,uBAAuB;AAGnE,SAASC,UAAU,QAAQ,qBAAqB;AAEhDR,SAAS,CAACS,cAAc,CAAC,CACvB,sDAAsD,CACvD,CAAC;AACFT,SAAS,CAACS,cAAc,CAAC,CAAC,0CAA0C,CAAC,CAAC;AAEtE,OAAO,MAAMC,aAAa,gBAAGd,aAAa,CAExCe,SAAS,CAAC;AAEZ,MAAMC,YAAY,GAAG,IAAIb,kBAAkB,CAACQ,oBAAoB,IAAID,KAAK,CAAC;AAE1E,MAAMO,aAA8C,GAAGC,IAAA,IAIjD;EAAA,IAJkD;IACtDC,QAAQ;IACRC,MAAM;IACNC;EACF,CAAC,GAAAH,IAAA;EACC,MAAM,CAACI,KAAK,EAAEC,QAAQ,CAAC,GAAGxB,UAAU,CAACS,YAAY,EAAED,iBAAiB,CAAC;EACrE,MAAMiB,KAAK,GAAG;IAAEF,KAAK;IAAEC;EAAS,CAAC;EAEjCtB,SAAS,CAAC,MAAM;IACdQ,kBAAkB,CAACgB,SAAS,CAACL,MAAM,CAAC;IACpC,IAAIC,cAAc,EAAE;MAClBZ,kBAAkB,CAACY,cAAc,CAACA,cAAc,CAAC;IACnD;EACF,CAAC,EAAE,CAACD,MAAM,CAACM,MAAM,CAAC,CAAC;EAEnBzB,SAAS,CAAC,MAAM;IACd,MAAM0B,gBAAgB,GAAIC,KAAU,IAAK;MACvCL,QAAQ,CAAC;QACPM,IAAI,EAAEjB,UAAU,CAACkB,YAAY;QAC7BC,OAAO,EAAE1B,QAAQ,CAAC2B,EAAE,KAAK,SAAS,GAAGC,IAAI,CAACC,KAAK,CAACN,KAAK,CAACN,KAAK,CAAC,GAAGM;MACjE,CAAC,CAAC;IACJ,CAAC;IACD,MAAMO,YAAY,GAAGnB,YAAY,CAACoB,WAAW,CAC3C,cAAc,EACdT,gBACF,CAAC;IAED,IAAI,CAACQ,YAAY,EAAE;IAEnB,OAAO,MAAM;MACXA,YAAY,CAACE,MAAM,CAAC,CAAC;IACvB,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;;EAEN;EACApC,SAAS,CAAC,MAAM;IACd,IAAII,QAAQ,CAAC2B,EAAE,KAAK,KAAK,EAAE;MACzB;IACF;IAEA1B,OAAO,CAACgC,gBAAgB,CAAC,KAAK,EAAGV,KAAK,IACpCnB,kBAAkB,CAAC8B,gBAAgB,CAACX,KAAK,CAACY,GAAG,CAC/C,CAAC;IAED,CAAC,YAAY;MACX,MAAMC,UAAU,GAAG,MAAMnC,OAAO,CAACoC,aAAa,CAAC,CAAC;MAChD,IAAID,UAAU,EAAE;QACdhC,kBAAkB,CAAC8B,gBAAgB,CAACE,UAAU,CAAC;MACjD;IACF,CAAC,EAAE,CAAC;EACN,CAAC,EAAE,EAAE,CAAC;EAEN,oBACE3C,KAAA,CAAA6C,aAAA,CAAC7B,aAAa,CAAC8B,QAAQ;IAACpB,KAAK,EAAEA;EAAM,GAAEL,QAAiC,CAAC;AAE7E,CAAC;AAED,SAAS0B,eAAeA,CAAA,EAAG;EACzB,MAAMC,OAAO,GAAG5C,UAAU,CAACY,aAAa,CAAC;EAEzC,IAAIgC,OAAO,KAAK/B,SAAS,EAAE;IACzB,MAAM,IAAIgC,KAAK,CACb,+DACF,CAAC;EACH;EAEA,OAAOD,OAAO;AAChB;AAEA,SAAS7B,aAAa,EAAE4B,eAAe"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RowndProvider as RowndReactProvider } from '@rownd/react';
|
|
3
|
+
const RowndProvider = _ref => {
|
|
4
|
+
let {
|
|
5
|
+
children,
|
|
6
|
+
config
|
|
7
|
+
} = _ref;
|
|
8
|
+
return /*#__PURE__*/React.createElement(RowndReactProvider, {
|
|
9
|
+
appKey: config.appKey,
|
|
10
|
+
apiUrl: config.apiUrl
|
|
11
|
+
}, children);
|
|
12
|
+
};
|
|
13
|
+
export { RowndProvider };
|
|
14
|
+
//# sourceMappingURL=GlobalContext.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","RowndProvider","RowndReactProvider","_ref","children","config","createElement","appKey","apiUrl"],"sources":["GlobalContext.web.tsx"],"sourcesContent":["import React from 'react';\nimport type { ContextProps } from './GlobalContext.types';\nimport {\n RowndProvider as RowndReactProvider,\n} from '@rownd/react';\n\nconst RowndProvider: React.FC<ContextProps> = ({ children, config }) => {\n return (\n <RowndReactProvider appKey={config.appKey} apiUrl={config.apiUrl}>\n {children}\n </RowndReactProvider>\n );\n};\n\n\nexport { RowndProvider };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SACEC,aAAa,IAAIC,kBAAkB,QAC9B,cAAc;AAErB,MAAMD,aAAqC,GAAGE,IAAA,IAA0B;EAAA,IAAzB;IAAEC,QAAQ;IAAEC;EAAO,CAAC,GAAAF,IAAA;EACjE,oBACEH,KAAA,CAAAM,aAAA,CAACJ,kBAAkB;IAACK,MAAM,EAAEF,MAAM,CAACE,MAAO;IAACC,MAAM,EAAEH,MAAM,CAACG;EAAO,GAC9DJ,QACiB,CAAC;AAEzB,CAAC;AAGD,SAASH,aAAa"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
2
|
import { useRownd } from '..';
|
|
3
|
-
|
|
3
|
+
import { Platform } from 'react-native';
|
|
4
4
|
const RequireSignIn = _ref => {
|
|
5
5
|
let {
|
|
6
6
|
children,
|
|
@@ -14,17 +14,18 @@ const RequireSignIn = _ref => {
|
|
|
14
14
|
} = useRownd();
|
|
15
15
|
useEffect(() => {
|
|
16
16
|
if (!is_authenticated && !is_initializing) {
|
|
17
|
-
requestSignIn({
|
|
17
|
+
requestSignIn({
|
|
18
|
+
...(Platform.OS === 'web' ? {
|
|
19
|
+
prevent_closing: true
|
|
20
|
+
} : undefined),
|
|
21
|
+
...signInProps
|
|
18
22
|
});
|
|
19
23
|
}
|
|
20
|
-
}, [is_authenticated, is_initializing,
|
|
21
|
-
|
|
24
|
+
}, [is_authenticated, is_initializing, signInProps]);
|
|
22
25
|
if (is_initializing && initializing) {
|
|
23
26
|
return /*#__PURE__*/React.createElement(React.Fragment, null, initializing);
|
|
24
27
|
}
|
|
25
|
-
|
|
26
28
|
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
27
29
|
};
|
|
28
|
-
|
|
29
30
|
export default RequireSignIn;
|
|
30
31
|
//# sourceMappingURL=RequireSignIn.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","useRownd","RequireSignIn","children","initializing","signInProps","is_authenticated","is_initializing","requestSignIn"],"sources":["RequireSignIn.tsx"],"sourcesContent":["import React, {
|
|
1
|
+
{"version":3,"names":["React","useEffect","useRownd","Platform","RequireSignIn","_ref","children","initializing","signInProps","is_authenticated","is_initializing","requestSignIn","OS","prevent_closing","undefined","createElement","Fragment"],"sources":["RequireSignIn.tsx"],"sourcesContent":["import React, { FunctionComponent, useEffect } from 'react';\nimport { useRownd } from '..';\nimport type { RequestSignIn } from 'src/hooks/rownd';\nimport { Platform } from 'react-native';\n\nexport type ContextProps = {\n children?: React.ReactNode;\n initializing?: React.ReactNode;\n signInProps?: RequestSignIn;\n};\n\nconst RequireSignIn: FunctionComponent<ContextProps> = ({\n children,\n initializing,\n signInProps,\n}) => {\n const { is_authenticated, is_initializing, requestSignIn } = useRownd();\n\n useEffect(() => {\n if (!is_authenticated && !is_initializing) {\n requestSignIn({\n ...(Platform.OS === 'web' ? { prevent_closing: true } : undefined),\n ...signInProps,\n });\n }\n }, [is_authenticated, is_initializing, signInProps]);\n\n if (is_initializing && initializing) {\n return <>{initializing}</>;\n }\n\n return <>{children}</>;\n};\n\nexport default RequireSignIn;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAuBC,SAAS,QAAQ,OAAO;AAC3D,SAASC,QAAQ,QAAQ,IAAI;AAE7B,SAASC,QAAQ,QAAQ,cAAc;AAQvC,MAAMC,aAA8C,GAAGC,IAAA,IAIjD;EAAA,IAJkD;IACtDC,QAAQ;IACRC,YAAY;IACZC;EACF,CAAC,GAAAH,IAAA;EACC,MAAM;IAAEI,gBAAgB;IAAEC,eAAe;IAAEC;EAAc,CAAC,GAAGT,QAAQ,CAAC,CAAC;EAEvED,SAAS,CAAC,MAAM;IACd,IAAI,CAACQ,gBAAgB,IAAI,CAACC,eAAe,EAAE;MACzCC,aAAa,CAAC;QACZ,IAAIR,QAAQ,CAACS,EAAE,KAAK,KAAK,GAAG;UAAEC,eAAe,EAAE;QAAK,CAAC,GAAGC,SAAS,CAAC;QAClE,GAAGN;MACL,CAAC,CAAC;IACJ;EACF,CAAC,EAAE,CAACC,gBAAgB,EAAEC,eAAe,EAAEF,WAAW,CAAC,CAAC;EAEpD,IAAIE,eAAe,IAAIH,YAAY,EAAE;IACnC,oBAAOP,KAAA,CAAAe,aAAA,CAAAf,KAAA,CAAAgB,QAAA,QAAGT,YAAe,CAAC;EAC5B;EAEA,oBAAOP,KAAA,CAAAe,aAAA,CAAAf,KAAA,CAAAgB,QAAA,QAAGV,QAAW,CAAC;AACxB,CAAC;AAED,eAAeF,aAAa"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useRownd } from '../hooks/rownd';
|
|
3
|
-
|
|
4
3
|
const SignedIn = _ref => {
|
|
5
4
|
let {
|
|
6
5
|
children
|
|
@@ -8,13 +7,10 @@ const SignedIn = _ref => {
|
|
|
8
7
|
const {
|
|
9
8
|
is_authenticated
|
|
10
9
|
} = useRownd();
|
|
11
|
-
|
|
12
10
|
if (!is_authenticated) {
|
|
13
11
|
return null;
|
|
14
12
|
}
|
|
15
|
-
|
|
16
13
|
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
17
14
|
};
|
|
18
|
-
|
|
19
15
|
export default SignedIn;
|
|
20
16
|
//# sourceMappingURL=SignedIn.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useRownd","SignedIn","children","is_authenticated"],"sources":["SignedIn.tsx"],"sourcesContent":["import React from 'react';\nimport { useRownd } from '../hooks/rownd';\n\ninterface SignedInProps {\n children: React.ReactNode;\n}\n\nconst SignedIn: React.FC<SignedInProps> = ({ children }) => {\n const { is_authenticated } = useRownd();\n\n if (!is_authenticated) {\n return null;\n }\n return <>{children}</>;\n};\n\nexport default SignedIn;"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"names":["React","useRownd","SignedIn","_ref","children","is_authenticated","createElement","Fragment"],"sources":["SignedIn.tsx"],"sourcesContent":["import React from 'react';\nimport { useRownd } from '../hooks/rownd';\n\ninterface SignedInProps {\n children: React.ReactNode;\n}\n\nconst SignedIn: React.FC<SignedInProps> = ({ children }) => {\n const { is_authenticated } = useRownd();\n\n if (!is_authenticated) {\n return null;\n }\n return <>{children}</>;\n};\n\nexport default SignedIn;"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,QAAQ,gBAAgB;AAMzC,MAAMC,QAAiC,GAAGC,IAAA,IAAkB;EAAA,IAAjB;IAAEC;EAAS,CAAC,GAAAD,IAAA;EACrD,MAAM;IAAEE;EAAiB,CAAC,GAAGJ,QAAQ,CAAC,CAAC;EAEvC,IAAI,CAACI,gBAAgB,EAAE;IACrB,OAAO,IAAI;EACb;EACA,oBAAOL,KAAA,CAAAM,aAAA,CAAAN,KAAA,CAAAO,QAAA,QAAGH,QAAW,CAAC;AACxB,CAAC;AAED,eAAeF,QAAQ"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useRownd } from '../hooks/rownd';
|
|
3
|
-
|
|
4
3
|
const SignedOut = _ref => {
|
|
5
4
|
let {
|
|
6
5
|
children
|
|
@@ -8,13 +7,10 @@ const SignedOut = _ref => {
|
|
|
8
7
|
const {
|
|
9
8
|
is_authenticated
|
|
10
9
|
} = useRownd();
|
|
11
|
-
|
|
12
10
|
if (is_authenticated) {
|
|
13
11
|
return null;
|
|
14
12
|
}
|
|
15
|
-
|
|
16
13
|
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
17
14
|
};
|
|
18
|
-
|
|
19
15
|
export default SignedOut;
|
|
20
16
|
//# sourceMappingURL=SignedOut.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useRownd","SignedOut","children","is_authenticated"],"sources":["SignedOut.tsx"],"sourcesContent":["import React from 'react'\nimport { useRownd } from '../hooks/rownd';\n\ninterface SignedOutProps {\n children: React.ReactNode;\n}\n\nconst SignedOut: React.FC<SignedOutProps> = ({ children }) => {\n const { is_authenticated } = useRownd();\n\n if (is_authenticated) {\n return null;\n }\n return <>{children}</>;\n};\n\nexport default SignedOut"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"names":["React","useRownd","SignedOut","_ref","children","is_authenticated","createElement","Fragment"],"sources":["SignedOut.tsx"],"sourcesContent":["import React from 'react'\nimport { useRownd } from '../hooks/rownd';\n\ninterface SignedOutProps {\n children: React.ReactNode;\n}\n\nconst SignedOut: React.FC<SignedOutProps> = ({ children }) => {\n const { is_authenticated } = useRownd();\n\n if (is_authenticated) {\n return null;\n }\n return <>{children}</>;\n};\n\nexport default SignedOut"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,QAAQ,gBAAgB;AAMzC,MAAMC,SAAmC,GAAGC,IAAA,IAAkB;EAAA,IAAjB;IAAEC;EAAS,CAAC,GAAAD,IAAA;EACvD,MAAM;IAAEE;EAAiB,CAAC,GAAGJ,QAAQ,CAAC,CAAC;EAEvC,IAAII,gBAAgB,EAAE;IACpB,OAAO,IAAI;EACb;EACA,oBAAOL,KAAA,CAAAM,aAAA,CAAAN,KAAA,CAAAO,QAAA,QAAGH,QAAW,CAAC;AACxB,CAAC;AAED,eAAeF,SAAS"}
|
|
@@ -1 +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,
|
|
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,UAAU;AAErB,WAFWA,UAAU;EAAVA,UAAU;AAAA,GAAVA,UAAU,KAAVA,UAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["requestSignIn","signOut","manageAccount","getAccessToken","getFirebaseIdToken","setUserDataValue","setUserData","useRowndContext","useRownd","state","access_token","auth","firebase","getIdToken","is_authenticated","is_initializing","app_id","user","data","setValue","set"],"sources":["rownd.ts"],"sourcesContent":["import {\n requestSignIn,\n signOut,\n manageAccount,\n getAccessToken,\n getFirebaseIdToken,\n setUserDataValue,\n setUserData,\n} from '../utils/nativeModule';\nimport { useRowndContext } from '../components/GlobalContext';\n\nexport type TRowndContext = {\n access_token: string | null;\n auth: AuthContext;\n is_authenticated: boolean;\n is_initializing: boolean;\n firebase: {\n getIdToken: () => Promise<string>;\n }\n getAccessToken: (token?: string) => Promise<string>;\n manageAccount: () => void;\n requestSignIn: (e?: RequestSignIn) => void;\n signOut: () => void;\n user: UserContext;\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};\n\ntype AuthContext = {\n access_token: string | null;\n app_id: string | null;\n is_verified_user?: boolean;\n};\n\nexport type RequestSignInMethods = 'google' | 'apple' | 'default' | 'guest' | 'passkey';\nexport type RequestSignInIntent = 'sign_in' | 'sign_up';\nexport type RequestSignIn = {method?: RequestSignInMethods, postSignInRedirect?: string, intent?: RequestSignInIntent}\n\nexport function useRownd(): TRowndContext {\n const { state } = useRowndContext();\n\n return {\n access_token: state.auth.access_token,\n auth: state.auth,\n getAccessToken,\n firebase: {\n getIdToken: getFirebaseIdToken,\n },\n is_authenticated: !!state.auth.access_token,\n is_initializing: !!state.auth.app_id,\n manageAccount,\n requestSignIn,\n signOut,\n user: {\n data: state.user.data,\n setValue: setUserDataValue,\n set: setUserData,\n }, \n };\n}\n"],"mappings":"AAAA,SACEA,
|
|
1
|
+
{"version":3,"names":["requestSignIn","signOut","manageAccount","getAccessToken","getFirebaseIdToken","setUserDataValue","setUserData","useRowndContext","useRownd","state","access_token","auth","firebase","getIdToken","is_authenticated","is_initializing","app_id","user","data","setValue","set"],"sources":["rownd.ts"],"sourcesContent":["import {\n requestSignIn,\n signOut,\n manageAccount,\n getAccessToken,\n getFirebaseIdToken,\n setUserDataValue,\n setUserData,\n} from '../utils/nativeModule';\nimport { useRowndContext } from '../components/GlobalContext';\n\nexport type TRowndContext = {\n access_token: string | null;\n auth: AuthContext;\n is_authenticated: boolean;\n is_initializing: boolean;\n firebase: {\n getIdToken: () => Promise<string>;\n }\n getAccessToken: (token?: string) => Promise<string>;\n manageAccount: () => void;\n requestSignIn: (e?: RequestSignIn) => void;\n signOut: () => void;\n user: UserContext;\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};\n\ntype AuthContext = {\n access_token: string | null;\n app_id: string | null;\n is_verified_user?: boolean;\n};\n\nexport type RequestSignInMethods = 'google' | 'apple' | 'default' | 'guest' | 'passkey';\nexport type RequestSignInIntent = 'sign_in' | 'sign_up';\nexport type RequestSignIn = {method?: RequestSignInMethods, postSignInRedirect?: string, intent?: RequestSignInIntent}\n\nexport function useRownd(): TRowndContext {\n const { state } = useRowndContext();\n\n return {\n access_token: state.auth.access_token,\n auth: state.auth,\n getAccessToken,\n firebase: {\n getIdToken: getFirebaseIdToken,\n },\n is_authenticated: !!state.auth.access_token,\n is_initializing: !!state.auth.app_id,\n manageAccount,\n requestSignIn,\n signOut,\n user: {\n data: state.user.data,\n setValue: setUserDataValue,\n set: setUserData,\n }, \n };\n}\n"],"mappings":"AAAA,SACEA,aAAa,EACbC,OAAO,EACPC,aAAa,EACbC,cAAc,EACdC,kBAAkB,EAClBC,gBAAgB,EAChBC,WAAW,QACN,uBAAuB;AAC9B,SAASC,eAAe,QAAQ,6BAA6B;AAsC7D,OAAO,SAASC,QAAQA,CAAA,EAAkB;EACxC,MAAM;IAAEC;EAAM,CAAC,GAAGF,eAAe,CAAC,CAAC;EAEnC,OAAO;IACLG,YAAY,EAAED,KAAK,CAACE,IAAI,CAACD,YAAY;IACrCC,IAAI,EAAEF,KAAK,CAACE,IAAI;IAChBR,cAAc;IACdS,QAAQ,EAAE;MACRC,UAAU,EAAET;IACd,CAAC;IACDU,gBAAgB,EAAE,CAAC,CAACL,KAAK,CAACE,IAAI,CAACD,YAAY;IAC3CK,eAAe,EAAE,CAAC,CAACN,KAAK,CAACE,IAAI,CAACK,MAAM;IACpCd,aAAa;IACbF,aAAa;IACbC,OAAO;IACPgB,IAAI,EAAE;MACJC,IAAI,EAAET,KAAK,CAACQ,IAAI,CAACC,IAAI;MACrBC,QAAQ,EAAEd,gBAAgB;MAC1Be,GAAG,EAAEd;IACP;EACF,CAAC;AACH"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useRownd as useReactRownd } from '@rownd/react';
|
|
2
|
+
export function useRownd() {
|
|
3
|
+
const {
|
|
4
|
+
requestSignIn,
|
|
5
|
+
signOut,
|
|
6
|
+
getAccessToken,
|
|
7
|
+
is_authenticated,
|
|
8
|
+
is_initializing,
|
|
9
|
+
auth,
|
|
10
|
+
access_token,
|
|
11
|
+
user,
|
|
12
|
+
manageAccount,
|
|
13
|
+
setUser,
|
|
14
|
+
setUserValue
|
|
15
|
+
} = useReactRownd();
|
|
16
|
+
return {
|
|
17
|
+
access_token,
|
|
18
|
+
auth: {
|
|
19
|
+
access_token,
|
|
20
|
+
app_id: auth.app_id || null,
|
|
21
|
+
is_verified_user: auth.is_verified_user
|
|
22
|
+
},
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
getAccessToken,
|
|
25
|
+
is_authenticated,
|
|
26
|
+
is_initializing,
|
|
27
|
+
manageAccount,
|
|
28
|
+
requestSignIn: opts => requestSignIn({
|
|
29
|
+
...opts,
|
|
30
|
+
post_login_redirect: opts === null || opts === void 0 ? void 0 : opts.postSignInRedirect
|
|
31
|
+
}),
|
|
32
|
+
signOut,
|
|
33
|
+
user: {
|
|
34
|
+
data: user.data,
|
|
35
|
+
setValue: setUserValue,
|
|
36
|
+
set: setUser
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=rownd.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useRownd","useReactRownd","requestSignIn","signOut","getAccessToken","is_authenticated","is_initializing","auth","access_token","user","manageAccount","setUser","setUserValue","app_id","is_verified_user","opts","post_login_redirect","postSignInRedirect","data","setValue","set"],"sources":["rownd.web.ts"],"sourcesContent":["import { useRownd as useReactRownd } from '@rownd/react';\nimport type { TRowndContext } from './rownd';\n\nexport function useRownd(): TRowndContext {\n const {\n requestSignIn,\n signOut,\n getAccessToken,\n is_authenticated,\n is_initializing,\n auth,\n access_token,\n user,\n manageAccount,\n setUser,\n setUserValue\n } = useReactRownd();\n\n return {\n access_token,\n auth: {\n access_token,\n app_id: auth.app_id || null,\n is_verified_user: auth.is_verified_user,\n },\n // @ts-ignore\n getAccessToken,\n is_authenticated,\n is_initializing,\n manageAccount,\n requestSignIn: (opts) =>\n requestSignIn({ ...opts, post_login_redirect: opts?.postSignInRedirect }),\n signOut,\n user: {\n data: user.data,\n setValue: setUserValue,\n set: setUser,\n },\n };\n}\n"],"mappings":"AAAA,SAASA,QAAQ,IAAIC,aAAa,QAAQ,cAAc;AAGxD,OAAO,SAASD,QAAQA,CAAA,EAAkB;EACxC,MAAM;IACJE,aAAa;IACbC,OAAO;IACPC,cAAc;IACdC,gBAAgB;IAChBC,eAAe;IACfC,IAAI;IACJC,YAAY;IACZC,IAAI;IACJC,aAAa;IACbC,OAAO;IACPC;EACF,CAAC,GAAGX,aAAa,CAAC,CAAC;EAEnB,OAAO;IACLO,YAAY;IACZD,IAAI,EAAE;MACJC,YAAY;MACZK,MAAM,EAAEN,IAAI,CAACM,MAAM,IAAI,IAAI;MAC3BC,gBAAgB,EAAEP,IAAI,CAACO;IACzB,CAAC;IACD;IACAV,cAAc;IACdC,gBAAgB;IAChBC,eAAe;IACfI,aAAa;IACbR,aAAa,EAAGa,IAAI,IAClBb,aAAa,CAAC;MAAE,GAAGa,IAAI;MAAEC,mBAAmB,EAAED,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEE;IAAmB,CAAC,CAAC;IAC3Ed,OAAO;IACPM,IAAI,EAAE;MACJS,IAAI,EAAET,IAAI,CAACS,IAAI;MACfC,QAAQ,EAAEP,YAAY;MACtBQ,GAAG,EAAET;IACP;EACF,CAAC;AACH"}
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RowndProvider","useRownd","RequireSignIn","SignedIn","SignedOut"],"sources":["index.tsx"],"sourcesContent":["import { RowndProvider } from './components/GlobalContext';\nimport { useRownd } from './hooks/rownd';\nimport RequireSignIn from './components/RequireSignIn';\nimport SignedIn from './components/SignedIn';\nimport SignedOut from './components/SignedOut';\n\nexport { RowndProvider, useRownd, RequireSignIn, SignedIn, SignedOut };\n"],"mappings":"AAAA,SAASA,
|
|
1
|
+
{"version":3,"names":["RowndProvider","useRownd","RequireSignIn","SignedIn","SignedOut"],"sources":["index.tsx"],"sourcesContent":["import { RowndProvider } from './components/GlobalContext';\nimport { useRownd } from './hooks/rownd';\nimport RequireSignIn from './components/RequireSignIn';\nimport SignedIn from './components/SignedIn';\nimport SignedOut from './components/SignedOut';\n\nexport { RowndProvider, useRownd, RequireSignIn, SignedIn, SignedOut };\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,QAAQ,QAAQ,eAAe;AACxC,OAAOC,aAAa,MAAM,4BAA4B;AACtD,OAAOC,QAAQ,MAAM,uBAAuB;AAC5C,OAAOC,SAAS,MAAM,wBAAwB;AAE9C,SAASJ,aAAa,EAAEC,QAAQ,EAAEC,aAAa,EAAEC,QAAQ,EAAEC,SAAS"}
|
|
@@ -4,9 +4,10 @@ export const initialRowndState = {
|
|
|
4
4
|
user: {
|
|
5
5
|
data: {
|
|
6
6
|
email: null
|
|
7
|
-
}
|
|
8
|
-
|
|
7
|
+
}
|
|
8
|
+
// meta: {}
|
|
9
9
|
},
|
|
10
|
+
|
|
10
11
|
auth: {
|
|
11
12
|
access_token: null,
|
|
12
13
|
refresh_token: null,
|
|
@@ -15,38 +16,39 @@ export const initialRowndState = {
|
|
|
15
16
|
app: {
|
|
16
17
|
schema: null,
|
|
17
18
|
config: null
|
|
18
|
-
}
|
|
19
|
+
}
|
|
20
|
+
// is_saving_user_data: false,
|
|
19
21
|
// config,
|
|
20
|
-
|
|
21
22
|
};
|
|
22
|
-
export function rowndReducer(state, action) {
|
|
23
|
-
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;
|
|
24
23
|
|
|
24
|
+
export function rowndReducer(state, action) {
|
|
25
|
+
var _action$payload, _action$payload2, _action$payload3, _action$payload4, _action$payload$appCo;
|
|
25
26
|
let newState;
|
|
26
|
-
|
|
27
27
|
switch (action.type) {
|
|
28
28
|
case ActionType.UPDATE_STATE:
|
|
29
29
|
newState = {
|
|
30
30
|
user: {
|
|
31
|
-
data: {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
data: {
|
|
32
|
+
...((_action$payload = action.payload) === null || _action$payload === void 0 || (_action$payload = _action$payload.user) === null || _action$payload === void 0 ? void 0 : _action$payload.data),
|
|
33
|
+
email: (_action$payload2 = action.payload) === null || _action$payload2 === void 0 || (_action$payload2 = _action$payload2.user) === null || _action$payload2 === void 0 || (_action$payload2 = _action$payload2.data) === null || _action$payload2 === void 0 ? void 0 : _action$payload2.email
|
|
34
|
+
}
|
|
35
|
+
// meta: {}
|
|
35
36
|
},
|
|
37
|
+
|
|
36
38
|
auth: {
|
|
37
|
-
access_token: (_action$payload3 = action.payload) === null || _action$payload3 === void 0
|
|
38
|
-
refresh_token: (_action$payload4 = action.payload) === null || _action$payload4 === void 0
|
|
39
|
+
access_token: (_action$payload3 = action.payload) === null || _action$payload3 === void 0 || (_action$payload3 = _action$payload3.auth) === null || _action$payload3 === void 0 ? void 0 : _action$payload3.access_token,
|
|
40
|
+
refresh_token: (_action$payload4 = action.payload) === null || _action$payload4 === void 0 || (_action$payload4 = _action$payload4.auth) === null || _action$payload4 === void 0 ? void 0 : _action$payload4.refresh_token,
|
|
39
41
|
app_id: null
|
|
40
42
|
},
|
|
41
43
|
app: {
|
|
42
44
|
schema: (_action$payload$appCo = action.payload.appConfig) === null || _action$payload$appCo === void 0 ? void 0 : _action$payload$appCo.schema,
|
|
43
45
|
config: null
|
|
44
|
-
}
|
|
46
|
+
}
|
|
47
|
+
// is_saving_user_data: false,
|
|
45
48
|
// config
|
|
46
|
-
|
|
47
49
|
};
|
|
48
|
-
return newState;
|
|
49
50
|
|
|
51
|
+
return newState;
|
|
50
52
|
default:
|
|
51
53
|
newState = state;
|
|
52
54
|
return newState;
|
|
@@ -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,
|
|
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,QAAiB,qBAAqB;AAEzD,OAAO,MAAMC,iBAA8B,GAAG;EAC5C;EACAC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJC,KAAK,EAAE;IACT;IACA;EACF,CAAC;;EACDC,IAAI,EAAE;IACJC,YAAY,EAAE,IAAI;IAClBC,aAAa,EAAE,IAAI;IACnBC,MAAM,EAAE;EACV,CAAC;EACDC,GAAG,EAAE;IACHC,MAAM,EAAE,IAAI;IACZC,MAAM,EAAE;EACV;EACA;EACA;AACF,CAAC;;AAED,OAAO,SAASC,YAAYA,CAACC,KAAkB,EAAEC,MAAe,EAAe;EAAA,IAAAC,eAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,qBAAA;EAC7E,IAAIC,QAAqB;EAEzB,QAAQN,MAAM,CAACO,IAAI;IACjB,KAAKrB,UAAU,CAACsB,YAAY;MAC1BF,QAAQ,GAAG;QACTlB,IAAI,EAAE;UACJC,IAAI,EAAE;YACJ,KAAAY,eAAA,GAAGD,MAAM,CAACS,OAAO,cAAAR,eAAA,gBAAAA,eAAA,GAAdA,eAAA,CAAgBb,IAAI,cAAAa,eAAA,uBAApBA,eAAA,CAAsBZ,IAAI;YAC7BC,KAAK,GAAAY,gBAAA,GAAEF,MAAM,CAACS,OAAO,cAAAP,gBAAA,gBAAAA,gBAAA,GAAdA,gBAAA,CAAgBd,IAAI,cAAAc,gBAAA,gBAAAA,gBAAA,GAApBA,gBAAA,CAAsBb,IAAI,cAAAa,gBAAA,uBAA1BA,gBAAA,CAA4BZ;UACrC;UACA;QACF,CAAC;;QACDC,IAAI,EAAE;UACJC,YAAY,GAAAW,gBAAA,GAAEH,MAAM,CAACS,OAAO,cAAAN,gBAAA,gBAAAA,gBAAA,GAAdA,gBAAA,CAAgBZ,IAAI,cAAAY,gBAAA,uBAApBA,gBAAA,CAAsBX,YAAY;UAChDC,aAAa,GAAAW,gBAAA,GAAEJ,MAAM,CAACS,OAAO,cAAAL,gBAAA,gBAAAA,gBAAA,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,
|
|
@@ -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","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,
|
|
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,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACR,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEL,OAAO,MAAMS,oBAAoB,GAC/BV,QAAQ,CAACW,EAAE,KAAK,KAAK,GACjB,IAAI,GACJZ,aAAa,CAACa,uBAAuB,GACrCb,aAAa,CAACa,uBAAuB,GACrC,IAAIL,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACR,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEP,OAAO,SAASY,SAASA,CAACC,MAAe,EAAmB;EAC1D,OAAOT,KAAK,CAACQ,SAAS,CAACC,MAAM,CAAC;AAChC;AAEA,OAAO,SAASC,cAAcA,CAACC,mBAAmC,EAAE;EAClE,OAAOX,KAAK,CAACU,cAAc,CAACC,mBAAmB,CAAC;AAClD;AAEA,OAAO,SAASC,aAAaA,CAACH,MAAsB,EAAE;EACpD,IAAI,CAACA,MAAM,EAAE;IACX,OAAOT,KAAK,CAACY,aAAa,CAAC;MAAEC,MAAM,EAAE;IAAU,CAAC,CAAC;EACnD;EACA,OAAOb,KAAK,CAACY,aAAa,CAAC;IACzBC,MAAM,EAAEJ,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEI,MAAM;IACtBC,kBAAkB,EAAEL,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEK,kBAAkB;IAC9CC,MAAM,EAAEN,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEM;EAClB,CAAC,CAAC;AACJ;AAEA,OAAO,SAASC,OAAOA,CAAA,EAAG;EACxB,OAAOhB,KAAK,CAACgB,OAAO,CAAC,CAAC;AACxB;AAEA,OAAO,SAASC,aAAaA,CAAA,EAAG;EAC9B,OAAOjB,KAAK,CAACiB,aAAa,CAAC,CAAC;AAC9B;AAEA,OAAO,SAASC,cAAcA,CAACC,KAAc,EAAmB;EAC9D,OAAOnB,KAAK,CAACkB,cAAc,CAACC,KAAK,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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rownd/react-native",
|
|
3
|
-
"version": "2.11.
|
|
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
|
}
|
|
@@ -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';
|
|
1
|
+
import React, { FunctionComponent, useEffect } from 'react';
|
|
5
2
|
import { useRownd } from '..';
|
|
6
3
|
import type { RequestSignIn } from 'src/hooks/rownd';
|
|
4
|
+
import { Platform } from 'react-native';
|
|
7
5
|
|
|
8
6
|
export type ContextProps = {
|
|
9
7
|
children?: React.ReactNode;
|
|
@@ -20,9 +18,12 @@ const RequireSignIn: FunctionComponent<ContextProps> = ({
|
|
|
20
18
|
|
|
21
19
|
useEffect(() => {
|
|
22
20
|
if (!is_authenticated && !is_initializing) {
|
|
23
|
-
requestSignIn({
|
|
21
|
+
requestSignIn({
|
|
22
|
+
...(Platform.OS === 'web' ? { prevent_closing: true } : undefined),
|
|
23
|
+
...signInProps,
|
|
24
|
+
});
|
|
24
25
|
}
|
|
25
|
-
}, [is_authenticated, is_initializing,
|
|
26
|
+
}, [is_authenticated, is_initializing, signInProps]);
|
|
26
27
|
|
|
27
28
|
if (is_initializing && initializing) {
|
|
28
29
|
return <>{initializing}</>;
|
|
@@ -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
|
+
}
|
|
File without changes
|
|
File without changes
|