@rownd/react-native 2.11.4 → 2.11.6

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 (47) hide show
  1. package/README.md +93 -15
  2. package/app.plugin.js +3 -0
  3. package/expo/plugin.js +61 -0
  4. package/lib/commonjs/components/GlobalContext.js +27 -8
  5. package/lib/commonjs/components/GlobalContext.js.map +1 -1
  6. package/lib/commonjs/components/GlobalContext.web.js +5 -0
  7. package/lib/commonjs/components/GlobalContext.web.js.map +1 -1
  8. package/lib/commonjs/components/RequireSignIn.js +14 -5
  9. package/lib/commonjs/components/RequireSignIn.js.map +1 -1
  10. package/lib/commonjs/components/SignedIn.js +9 -1
  11. package/lib/commonjs/components/SignedIn.js.map +1 -1
  12. package/lib/commonjs/components/SignedOut.js +9 -1
  13. package/lib/commonjs/components/SignedOut.js.map +1 -1
  14. package/lib/commonjs/constants/action.js +3 -1
  15. package/lib/commonjs/constants/action.js.map +1 -1
  16. package/lib/commonjs/hooks/rownd.js +3 -0
  17. package/lib/commonjs/hooks/rownd.js.map +1 -1
  18. package/lib/commonjs/hooks/rownd.web.js +3 -2
  19. package/lib/commonjs/hooks/rownd.web.js.map +1 -1
  20. package/lib/commonjs/index.js +6 -0
  21. package/lib/commonjs/index.js.map +1 -1
  22. package/lib/commonjs/reducer/rowndReducer.js +21 -19
  23. package/lib/commonjs/reducer/rowndReducer.js.map +1 -1
  24. package/lib/commonjs/utils/nativeModule.js +21 -3
  25. package/lib/commonjs/utils/nativeModule.js.map +1 -1
  26. package/lib/module/components/GlobalContext.js +11 -2
  27. package/lib/module/components/GlobalContext.js.map +1 -1
  28. package/lib/module/components/GlobalContext.web.js +2 -0
  29. package/lib/module/components/GlobalContext.web.js.map +1 -1
  30. package/lib/module/components/RequireSignIn.js +5 -2
  31. package/lib/module/components/RequireSignIn.js.map +1 -1
  32. package/lib/module/components/SignedIn.js +4 -0
  33. package/lib/module/components/SignedIn.js.map +1 -1
  34. package/lib/module/components/SignedOut.js +4 -0
  35. package/lib/module/components/SignedOut.js.map +1 -1
  36. package/lib/module/constants/action.js +1 -0
  37. package/lib/module/constants/action.js.map +1 -1
  38. package/lib/module/hooks/rownd.js.map +1 -1
  39. package/lib/module/hooks/rownd.web.js +1 -2
  40. package/lib/module/hooks/rownd.web.js.map +1 -1
  41. package/lib/module/index.js.map +1 -1
  42. package/lib/module/reducer/rowndReducer.js +17 -19
  43. package/lib/module/reducer/rowndReducer.js.map +1 -1
  44. package/lib/module/utils/nativeModule.js +3 -0
  45. package/lib/module/utils/nativeModule.js.map +1 -1
  46. package/package.json +3 -1
  47. package/rownd-react-native.podspec +1 -1
package/README.md CHANGED
@@ -3,6 +3,7 @@
3
3
  Rownd bindings for React Native
4
4
 
5
5
  ## Prerequisites
6
+
6
7
  You must be using React Native v0.61 or higher.
7
8
 
8
9
  ## Installation
@@ -13,9 +14,78 @@ First, install the Rownd SDK for React Native.
13
14
  npm install @rownd/react-native
14
15
  ```
15
16
 
17
+ ### Expo development
18
+
19
+ 1. Add `@rownd/react-native` as a plugin to your `app.json` file.
20
+
21
+ ```json
22
+ {
23
+ "expo": {
24
+ "plugins": ["@rownd/react-native"]
25
+ }
26
+ }
27
+ ```
28
+
29
+ 2. Install [Expo BuildProperties](https://docs.expo.dev/versions/latest/sdk/build-properties/) to set iOS/Android versions
30
+
31
+ ```sh
32
+ npx expo install expo-build-properties
33
+ ```
34
+
35
+ 3. Add `expo-build-properties` as a plugin to your `app.json` file. Ensure the Sdk versions match or are above provided iOS/Android versions.
36
+
37
+ ```json
38
+ {
39
+ "expo": {
40
+ "plugins": [
41
+ [
42
+ "expo-build-properties",
43
+ {
44
+ "android": {
45
+ "minSdkVersion": 26
46
+ },
47
+ "ios": {
48
+ "deploymentTarget": "14.0"
49
+ }
50
+ }
51
+ ]
52
+ ]
53
+ }
54
+ }
55
+ ```
56
+
57
+ 4. Install Sodium (iOS Framework). [Step 2 for iOS](#ios)
58
+
59
+ 5. (optional) Enable Apple sign-in for iOS in your `app.json` file.
60
+
61
+ ```json
62
+ {
63
+ "ios": {
64
+ "usesAppleSignIn": true
65
+ }
66
+ }
67
+ ```
68
+
69
+ 6. (optional) Enable Google sign-in for iOS. Add your Google IOS Client ID client as a URL Scheme in your `app.json` file.
70
+
71
+ ```json
72
+ {
73
+ "infoPlist": {
74
+ "CFBundleURLTypes": [
75
+ {
76
+ "CFBundleURLSchemes": [
77
+ "com.googleusercontent.apps.xxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxx"
78
+ ]
79
+ }
80
+ ]
81
+ }
82
+ }
83
+ ```
84
+
16
85
  ### Android
17
86
 
18
- 1. Ensure the Sdk versions match or are above provided versions. File: *android/build.gradle*
87
+ 1. Ensure the Sdk versions match or are above provided versions. File: _android/build.gradle_
88
+
19
89
  ```
20
90
  ext {
21
91
  ...
@@ -25,14 +95,16 @@ ext {
25
95
  ...
26
96
  }
27
97
  ```
98
+
28
99
  2. Install the Rownd library and dependencies.
100
+
29
101
  ```sh
30
102
  cd android && ./gradlew build
31
103
  ```
32
104
 
33
105
  3. Check and update your ProGuard config using [the rules from our Android SDK](https://github.com/rownd/android/blob/main/README.md#proguard-config).
34
106
 
35
- 4. Only required for Google Sign-in: Add a Rownd plugin initializer to your MainActivity file. File: *android/app/src/main/java/.../MainActivity.java
107
+ 4. Only required for Google Sign-in: Add a Rownd plugin initializer to your MainActivity file. File: \*android/app/src/main/java/.../MainActivity.java
36
108
 
37
109
  ```
38
110
  import android.os.Bundle;
@@ -49,13 +121,14 @@ public class MainActivity extends ReactActivity {
49
121
 
50
122
  ### iOS
51
123
 
52
- 1. Ensure iOS version is at least 14. File: *ios/Podfile*
124
+ 1. Ensure iOS version is at least 14. File: _ios/Podfile_
53
125
 
54
126
  ```
55
127
  platform :ios, '14.0'
56
128
  ```
57
129
 
58
- 2. Add the code below to install the Sodium pod dependency correctly. Place inside the target. File: *ios/Podfile*
130
+ 2. Add the code below to install the Sodium pod dependency correctly. Place inside the target. File: _ios/Podfile_
131
+
59
132
  ```
60
133
  dynamic_frameworks = ['Sodium']
61
134
  pre_install do |installer|
@@ -72,6 +145,7 @@ pre_install do |installer|
72
145
  end
73
146
  end
74
147
  ```
148
+
75
149
  3. Install the Rownd pod and it's dependencies
76
150
 
77
151
  ```sh
@@ -81,25 +155,26 @@ cd ios && pod install
81
155
  ## Setup
82
156
 
83
157
  ### Enable deep linking
84
- Rownd supports automatically signing-in users when they initially install your
85
- app or when they click a sign-in link when the app is already installed.
86
158
 
159
+ Rownd supports automatically signing-in users when they initially install your
160
+ app or when they click a sign-in link when the app is already installed.
87
161
 
88
162
  ## Usage
163
+
89
164
  The Rownd SDK includes a context provider that will enable any component of your app to access authentication state and user data.
90
165
 
91
166
  Before you can use the SDK, you'll need to obtain an App Key from the [Rownd Dashboard](https://app.rownd.io).
92
167
 
93
168
  ```tsx
94
- import { RowndProvider } from "@rownd/react-native";
169
+ import { RowndProvider } from '@rownd/react-native';
95
170
 
96
171
  // ...
97
172
 
98
173
  export default function Root() {
99
174
  return (
100
- <RowndProvider config={{appKey:"<your app key>"}}>
101
- <App />
102
- </RowndProvider>
175
+ <RowndProvider config={{ appKey: '<your app key>' }}>
176
+ <App />
177
+ </RowndProvider>
103
178
  );
104
179
  }
105
180
  ```
@@ -126,7 +201,9 @@ export default function MyProtectedComponent(props) {
126
201
  {is_authenticated ? (
127
202
  <>
128
203
  <Text>Welcome {user.data.first_name}</Text>
129
- <Pressable onClick={() => getAccessToken()}><Text>Get access token</Text></Pressable>
204
+ <Pressable onClick={() => getAccessToken()}>
205
+ <Text>Get access token</Text>
206
+ </Pressable>
130
207
  </>
131
208
  ) : (
132
209
  <>
@@ -172,6 +249,7 @@ export default function App() {
172
249
  );
173
250
  }
174
251
  ```
252
+
175
253
  ## API reference
176
254
 
177
255
  Most API methods are made available via the Rownd Provider and its associated `useRownd` React hook. Unless otherwise noted, we're assuming that you're using hooks.
@@ -205,7 +283,7 @@ const { getAccessToken } = useRownd();
205
283
  let accessToken = await getAccessToken();
206
284
  ```
207
285
 
208
- #### is\_authenticated
286
+ #### is_authenticated
209
287
 
210
288
  Indicates whether the current user is signed in or not.
211
289
 
@@ -220,7 +298,7 @@ return (
220
298
  );
221
299
  ```
222
300
 
223
- #### access\_token
301
+ #### access_token
224
302
 
225
303
  Represents the current access token for the user.
226
304
 
@@ -262,8 +340,8 @@ return (
262
340
  ```javascript
263
341
  const { user } = useRownd();
264
342
  user.set({
265
- first_name: 'Alice',
266
- last_name: 'Ranier'
343
+ first_name: 'Alice',
344
+ last_name: 'Ranier',
267
345
  });
268
346
  ```
269
347
 
package/app.plugin.js ADDED
@@ -0,0 +1,3 @@
1
+ const { withRowndSDK } = require('./expo/plugin');
2
+
3
+ module.exports = (config) => withRowndSDK(config);
package/expo/plugin.js ADDED
@@ -0,0 +1,61 @@
1
+ const { withMainActivity, withInfoPlist } = require('expo/config-plugins');
2
+
3
+ const withRowndMainActivity = (config) => {
4
+ return withMainActivity(config, async (config) => {
5
+ let mainActivityString = config.modResults.contents;
6
+
7
+ if (!mainActivityString.includes('RowndPluginPackage.preInit')) {
8
+ const regex = /super.onCreate\(\w+\)\s*\S/;
9
+ mainActivityString = mainActivityString.replace(
10
+ regex,
11
+ `super.onCreate(savedInstanceState);\n RowndPluginPackage.preInit(this);\n`
12
+ );
13
+ }
14
+
15
+ if (
16
+ !mainActivityString.includes(
17
+ 'com.reactnativerowndplugin.RowndPluginPackage'
18
+ )
19
+ ) {
20
+ const regex = /import\s+\S+\;/;
21
+ mainActivityString = mainActivityString.replace(
22
+ regex,
23
+ `import com.reactnativerowndplugin.RowndPluginPackage;\n$&`
24
+ );
25
+ }
26
+
27
+ const newConfig = {
28
+ ...config,
29
+ modResults: {
30
+ ...config.modResults,
31
+ contents: mainActivityString,
32
+ },
33
+ };
34
+
35
+ return newConfig;
36
+ });
37
+ };
38
+
39
+ const withRowndPlist = (config) => {
40
+ return withInfoPlist(config, async (config) => {
41
+ const LSApplicationQueriesSchemes =
42
+ config.modResults?.LSApplicationQueriesSchemes || [];
43
+ const additionalSchemes = ['googlegmail', 'ms-outlook', 'ymail'];
44
+ additionalSchemes.forEach((scheme) => {
45
+ if (!LSApplicationQueriesSchemes.includes(scheme)) {
46
+ LSApplicationQueriesSchemes.push(scheme);
47
+ }
48
+ });
49
+
50
+ return {
51
+ ...config,
52
+ modResults: {
53
+ ...config?.modResults,
54
+ LSApplicationQueriesSchemes,
55
+ },
56
+ };
57
+ });
58
+ };
59
+
60
+ module.exports.withRowndSDK = (config) =>
61
+ withRowndMainActivity(withRowndPlist(config));
@@ -5,18 +5,29 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.RowndProvider = exports.GlobalContext = void 0;
7
7
  exports.useRowndContext = useRowndContext;
8
+
8
9
  var _react = _interopRequireWildcard(require("react"));
10
+
9
11
  var _reactNative = require("react-native");
12
+
10
13
  var _rowndReducer = require("../reducer/rowndReducer");
11
- var _nativeModule = _interopRequireWildcard(require("../utils/nativeModule"));
12
- var NativeRowndModules = _nativeModule;
14
+
15
+ var NativeRowndModules = _interopRequireWildcard(require("../utils/nativeModule"));
16
+
13
17
  var _action = require("../constants/action");
14
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
15
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
18
+
19
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
20
+
21
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
22
+
16
23
  _reactNative.YellowBox.ignoreWarnings(['Sending `update_state` with no listeners registered.']);
24
+
17
25
  _reactNative.YellowBox.ignoreWarnings(['YellowBox has been replaced with LogBox.']);
18
- const GlobalContext = exports.GlobalContext = /*#__PURE__*/(0, _react.createContext)(undefined);
19
- const eventEmitter = new _reactNative.NativeEventEmitter(_nativeModule.IOSRowndEventEmitter || _nativeModule.Rownd);
26
+
27
+ const GlobalContext = /*#__PURE__*/(0, _react.createContext)(undefined);
28
+ exports.GlobalContext = GlobalContext;
29
+ const eventEmitter = new _reactNative.NativeEventEmitter(NativeRowndModules.IOSRowndEventEmitter || NativeRowndModules.Rownd);
30
+
20
31
  const RowndProvider = _ref => {
21
32
  let {
22
33
  children,
@@ -30,6 +41,7 @@ const RowndProvider = _ref => {
30
41
  };
31
42
  (0, _react.useEffect)(() => {
32
43
  NativeRowndModules.configure(config);
44
+
33
45
  if (customizations) {
34
46
  NativeRowndModules.customizations(customizations);
35
47
  }
@@ -41,21 +53,24 @@ const RowndProvider = _ref => {
41
53
  payload: _reactNative.Platform.OS === 'android' ? JSON.parse(event.state) : event
42
54
  });
43
55
  };
56
+
44
57
  const subscription = eventEmitter.addListener('update_state', onSessionConnect);
45
58
  if (!subscription) return;
46
59
  return () => {
47
60
  subscription.remove();
48
61
  };
49
- }, []);
62
+ }, []); // Handle deep linking
50
63
 
51
- // Handle deep linking
52
64
  (0, _react.useEffect)(() => {
53
65
  if (_reactNative.Platform.OS !== 'ios') {
54
66
  return;
55
67
  }
68
+
56
69
  _reactNative.Linking.addEventListener('url', event => NativeRowndModules.handleSignInLink(event.url));
70
+
57
71
  (async () => {
58
72
  const initialUrl = await _reactNative.Linking.getInitialURL();
73
+
59
74
  if (initialUrl) {
60
75
  NativeRowndModules.handleSignInLink(initialUrl);
61
76
  }
@@ -65,12 +80,16 @@ const RowndProvider = _ref => {
65
80
  value: value
66
81
  }, children);
67
82
  };
83
+
68
84
  exports.RowndProvider = RowndProvider;
85
+
69
86
  function useRowndContext() {
70
87
  const context = (0, _react.useContext)(GlobalContext);
88
+
71
89
  if (context === undefined) {
72
90
  throw new Error('useGlobalContext must be used within a GlobalContext Provider');
73
91
  }
92
+
74
93
  return context;
75
94
  }
76
95
  //# sourceMappingURL=GlobalContext.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_rowndReducer","_nativeModule","NativeRowndModules","_action","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","YellowBox","ignoreWarnings","GlobalContext","exports","createContext","undefined","eventEmitter","NativeEventEmitter","IOSRowndEventEmitter","Rownd","RowndProvider","_ref","children","config","customizations","state","dispatch","useReducer","rowndReducer","initialRowndState","value","useEffect","configure","appKey","onSessionConnect","event","type","ActionType","UPDATE_STATE","payload","Platform","OS","JSON","parse","subscription","addListener","remove","Linking","addEventListener","handleSignInLink","url","initialUrl","getInitialURL","createElement","Provider","useRowndContext","context","useContext","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 thro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;IACJ,CAAC;IACD,MAAMS,YAAY,GAAG5B,YAAY,CAAC6B,WAAW,CAC3C,cAAc,EACdX,gBACF,CAAC;IAED,IAAI,CAACU,YAAY,EAAE;IAEnB,OAAO,MAAM;MACXA,YAAY,CAACE,MAAM,CAAC,CAAC;IACvB,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;;EAEN;EACA,IAAAf,gBAAS,EAAC,MAAM;IACd,IAAIS,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE;MACzB;IACF;IAEAM,oBAAO,CAACC,gBAAgB,CAAC,KAAK,EAAGb,KAAK,IACpChD,kBAAkB,CAAC8D,gBAAgB,CAACd,KAAK,CAACe,GAAG,CAC/C,CAAC;IAED,CAAC,YAAY;MACX,MAAMC,UAAU,GAAG,MAAMJ,oBAAO,CAACK,aAAa,CAAC,CAAC;MAChD,IAAID,UAAU,EAAE;QACdhE,kBAAkB,CAAC8D,gBAAgB,CAACE,UAAU,CAAC;MACjD;IACF,CAAC,EAAE,CAAC;EACN,CAAC,EAAE,EAAE,CAAC;EAEN,oBACEtE,MAAA,CAAAc,OAAA,CAAA0D,aAAA,CAACzC,aAAa,CAAC0C,QAAQ;IAACxB,KAAK,EAAEA;EAAM,GAAER,QAAiC,CAAC;AAE7E,CAAC;AAACT,OAAA,CAAAO,aAAA,GAAAA,aAAA;AAEF,SAASmC,eAAeA,CAAA,EAAG;EACzB,MAAMC,OAAO,GAAG,IAAAC,iBAAU,EAAC7C,aAAa,CAAC;EAEzC,IAAI4C,OAAO,KAAKzC,SAAS,EAAE;IACzB,MAAM,IAAI2C,KAAK,CACb,+DACF,CAAC;EACH;EAEA,OAAOF,OAAO;AAChB"}
1
+ {"version":3,"names":["YellowBox","ignoreWarnings","GlobalContext","createContext","undefined","eventEmitter","NativeEventEmitter","IOSRowndEventEmitter","Rownd","RowndProvider","children","config","customizations","state","dispatch","useReducer","rowndReducer","initialRowndState","value","useEffect","NativeRowndModules","configure","appKey","onSessionConnect","event","type","ActionType","UPDATE_STATE","payload","Platform","OS","JSON","parse","subscription","addListener","remove","Linking","addEventListener","handleSignInLink","url","initialUrl","getInitialURL","useRowndContext","context","useContext","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;;AAOA;;AACA;;AAEA;;AAIA;;;;;;AAEAA,sBAAA,CAAUC,cAAV,CAAyB,CACvB,sDADuB,CAAzB;;AAGAD,sBAAA,CAAUC,cAAV,CAAyB,CAAC,0CAAD,CAAzB;;AAEO,MAAMC,aAAa,gBAAG,IAAAC,oBAAA,EAE3BC,SAF2B,CAAtB;;AAIP,MAAMC,YAAY,GAAG,IAAIC,+BAAJ,CAAuBC,uCAAA,IAAwBC,wBAA/C,CAArB;;AAEA,MAAMC,aAA8C,GAAG,QAIjD;EAAA,IAJkD;IACtDC,QADsD;IAEtDC,MAFsD;IAGtDC;EAHsD,CAIlD;EACJ,MAAM,CAACC,KAAD,EAAQC,QAAR,IAAoB,IAAAC,iBAAA,EAAWC,0BAAX,EAAyBC,+BAAzB,CAA1B;EACA,MAAMC,KAAK,GAAG;IAAEL,KAAF;IAASC;EAAT,CAAd;EAEA,IAAAK,gBAAA,EAAU,MAAM;IACdC,kBAAkB,CAACC,SAAnB,CAA6BV,MAA7B;;IACA,IAAIC,cAAJ,EAAoB;MAClBQ,kBAAkB,CAACR,cAAnB,CAAkCA,cAAlC;IACD;EACF,CALD,EAKG,CAACD,MAAM,CAACW,MAAR,CALH;EAOA,IAAAH,gBAAA,EAAU,MAAM;IACd,MAAMI,gBAAgB,GAAIC,KAAD,IAAgB;MACvCV,QAAQ,CAAC;QACPW,IAAI,EAAEC,kBAAA,CAAWC,YADV;QAEPC,OAAO,EAAEC,qBAAA,CAASC,EAAT,KAAgB,SAAhB,GAA4BC,IAAI,CAACC,KAAL,CAAWR,KAAK,CAACX,KAAjB,CAA5B,GAAsDW;MAFxD,CAAD,CAAR;IAID,CALD;;IAMA,MAAMS,YAAY,GAAG5B,YAAY,CAAC6B,WAAb,CACnB,cADmB,EAEnBX,gBAFmB,CAArB;IAKA,IAAI,CAACU,YAAL,EAAmB;IAEnB,OAAO,MAAM;MACXA,YAAY,CAACE,MAAb;IACD,CAFD;EAGD,CAjBD,EAiBG,EAjBH,EAXI,CA8BJ;;EACA,IAAAhB,gBAAA,EAAU,MAAM;IACd,IAAIU,qBAAA,CAASC,EAAT,KAAgB,KAApB,EAA2B;MACzB;IACD;;IAEDM,oBAAA,CAAQC,gBAAR,CAAyB,KAAzB,EAAiCb,KAAD,IAC9BJ,kBAAkB,CAACkB,gBAAnB,CAAoCd,KAAK,CAACe,GAA1C,CADF;;IAIA,CAAC,YAAY;MACX,MAAMC,UAAU,GAAG,MAAMJ,oBAAA,CAAQK,aAAR,EAAzB;;MACA,IAAID,UAAJ,EAAgB;QACdpB,kBAAkB,CAACkB,gBAAnB,CAAoCE,UAApC;MACD;IACF,CALD;EAMD,CAfD,EAeG,EAfH;EAiBA,oBACE,6BAAC,aAAD,CAAe,QAAf;IAAwB,KAAK,EAAEtB;EAA/B,GAAuCR,QAAvC,CADF;AAGD,CAvDD;;;;AAyDA,SAASgC,eAAT,GAA2B;EACzB,MAAMC,OAAO,GAAG,IAAAC,iBAAA,EAAW1C,aAAX,CAAhB;;EAEA,IAAIyC,OAAO,KAAKvC,SAAhB,EAA2B;IACzB,MAAM,IAAIyC,KAAJ,CACJ,+DADI,CAAN;EAGD;;EAED,OAAOF,OAAP;AACD"}
@@ -4,9 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.RowndProvider = void 0;
7
+
7
8
  var _react = _interopRequireDefault(require("react"));
9
+
8
10
  var _react2 = require("@rownd/react");
11
+
9
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
10
14
  const RowndProvider = _ref => {
11
15
  let {
12
16
  children,
@@ -17,5 +21,6 @@ const RowndProvider = _ref => {
17
21
  apiUrl: config.apiUrl
18
22
  }, children);
19
23
  };
24
+
20
25
  exports.RowndProvider = RowndProvider;
21
26
  //# sourceMappingURL=GlobalContext.web.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_react2","obj","__esModule","default","RowndProvider","_ref","children","config","createElement","appKey","apiUrl","exports"],"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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AAEsB,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEtB,MAAMG,aAAqC,GAAGC,IAAA,IAA0B;EAAA,IAAzB;IAAEC,QAAQ;IAAEC;EAAO,CAAC,GAAAF,IAAA;EACjE,oBACER,MAAA,CAAAM,OAAA,CAAAK,aAAA,CAACR,OAAA,CAAAI,aAAkB;IAACK,MAAM,EAAEF,MAAM,CAACE,MAAO;IAACC,MAAM,EAAEH,MAAM,CAACG;EAAO,GAC9DJ,QACiB,CAAC;AAEzB,CAAC;AAACK,OAAA,CAAAP,aAAA,GAAAA,aAAA"}
1
+ {"version":3,"names":["RowndProvider","children","config","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;;AAEA;;;;AAIA,MAAMA,aAAqC,GAAG,QAA0B;EAAA,IAAzB;IAAEC,QAAF;IAAYC;EAAZ,CAAyB;EACtE,oBACE,6BAAC,qBAAD;IAAoB,MAAM,EAAEA,MAAM,CAACC,MAAnC;IAA2C,MAAM,EAAED,MAAM,CAACE;EAA1D,GACGH,QADH,CADF;AAKD,CAND"}
@@ -4,11 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+
7
8
  var _react = _interopRequireWildcard(require("react"));
9
+
8
10
  var _rownd = require("../hooks/rownd");
11
+
9
12
  var _reactNative = require("react-native");
10
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
11
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
13
+
14
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
+
16
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
+
12
18
  const RequireSignIn = _ref => {
13
19
  let {
14
20
  children,
@@ -22,18 +28,21 @@ const RequireSignIn = _ref => {
22
28
  } = (0, _rownd.useRownd)();
23
29
  (0, _react.useEffect)(() => {
24
30
  if (!is_authenticated && !is_initializing) {
25
- requestSignIn({
26
- ...(_reactNative.Platform.OS === 'web' ? {
31
+ requestSignIn({ ...(_reactNative.Platform.OS === 'web' ? {
27
32
  prevent_closing: true
28
33
  } : undefined),
29
34
  ...signInProps
30
35
  });
31
36
  }
32
37
  }, [is_authenticated, is_initializing, signInProps]);
38
+
33
39
  if (is_initializing && initializing) {
34
40
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, initializing);
35
41
  }
42
+
36
43
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children);
37
44
  };
38
- var _default = exports.default = RequireSignIn;
45
+
46
+ var _default = RequireSignIn;
47
+ exports.default = _default;
39
48
  //# sourceMappingURL=RequireSignIn.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_rownd","_reactNative","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","RequireSignIn","_ref","children","initializing","signInProps","is_authenticated","is_initializing","requestSignIn","useRownd","useEffect","Platform","OS","prevent_closing","undefined","createElement","Fragment","_default","exports"],"sources":["RequireSignIn.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { useRownd } from '../hooks/rownd';\nimport type { RequestSignIn } from '../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: React.FC<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,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,YAAA,GAAAF,OAAA;AAAwC,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAL,wBAAAK,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA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MAAA,CAAAW,OAAA,CAAA8B,QAAA,QAAGb,QAAW,CAAC;AACxB,CAAC;AAAC,IAAAc,QAAA,GAAAC,OAAA,CAAAhC,OAAA,GAEae,aAAa"}
1
+ {"version":3,"names":["RequireSignIn","children","initializing","signInProps","is_authenticated","is_initializing","requestSignIn","useRownd","useEffect","Platform","OS","prevent_closing","undefined"],"sources":["RequireSignIn.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { useRownd } from '../hooks/rownd';\nimport type { RequestSignIn } from '../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: React.FC<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;;AACA;;AAEA;;;;;;AAQA,MAAMA,aAAqC,GAAG,QAIxC;EAAA,IAJyC;IAC7CC,QAD6C;IAE7CC,YAF6C;IAG7CC;EAH6C,CAIzC;EACJ,MAAM;IAAEC,gBAAF;IAAoBC,eAApB;IAAqCC;EAArC,IAAuD,IAAAC,eAAA,GAA7D;EAEA,IAAAC,gBAAA,EAAU,MAAM;IACd,IAAI,CAACJ,gBAAD,IAAqB,CAACC,eAA1B,EAA2C;MACzCC,aAAa,CAAC,EACZ,IAAIG,qBAAA,CAASC,EAAT,KAAgB,KAAhB,GAAwB;UAAEC,eAAe,EAAE;QAAnB,CAAxB,GAAoDC,SAAxD,CADY;QAEZ,GAAGT;MAFS,CAAD,CAAb;IAID;EACF,CAPD,EAOG,CAACC,gBAAD,EAAmBC,eAAnB,EAAoCF,WAApC,CAPH;;EASA,IAAIE,eAAe,IAAIH,YAAvB,EAAqC;IACnC,oBAAO,4DAAGA,YAAH,CAAP;EACD;;EAED,oBAAO,4DAAGD,QAAH,CAAP;AACD,CArBD;;eAuBeD,a"}
@@ -4,9 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+
7
8
  var _react = _interopRequireDefault(require("react"));
9
+
8
10
  var _rownd = require("../hooks/rownd");
11
+
9
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
10
14
  const SignedIn = _ref => {
11
15
  let {
12
16
  children
@@ -14,10 +18,14 @@ const SignedIn = _ref => {
14
18
  const {
15
19
  is_authenticated
16
20
  } = (0, _rownd.useRownd)();
21
+
17
22
  if (!is_authenticated) {
18
23
  return null;
19
24
  }
25
+
20
26
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children);
21
27
  };
22
- var _default = exports.default = SignedIn;
28
+
29
+ var _default = SignedIn;
30
+ exports.default = _default;
23
31
  //# sourceMappingURL=SignedIn.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_rownd","obj","__esModule","default","SignedIn","_ref","children","is_authenticated","useRownd","createElement","Fragment","_default","exports"],"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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAA0C,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAM1C,MAAMG,QAAiC,GAAGC,IAAA,IAAkB;EAAA,IAAjB;IAAEC;EAAS,CAAC,GAAAD,IAAA;EACrD,MAAM;IAAEE;EAAiB,CAAC,GAAG,IAAAC,eAAQ,EAAC,CAAC;EAEvC,IAAI,CAACD,gBAAgB,EAAE;IACrB,OAAO,IAAI;EACb;EACA,oBAAOV,MAAA,CAAAM,OAAA,CAAAM,aAAA,CAAAZ,MAAA,CAAAM,OAAA,CAAAO,QAAA,QAAGJ,QAAW,CAAC;AACxB,CAAC;AAAC,IAAAK,QAAA,GAAAC,OAAA,CAAAT,OAAA,GAEaC,QAAQ"}
1
+ {"version":3,"names":["SignedIn","children","is_authenticated","useRownd"],"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;;AACA;;;;AAMA,MAAMA,QAAiC,GAAG,QAAkB;EAAA,IAAjB;IAAEC;EAAF,CAAiB;EAC1D,MAAM;IAAEC;EAAF,IAAuB,IAAAC,eAAA,GAA7B;;EAEA,IAAI,CAACD,gBAAL,EAAuB;IACrB,OAAO,IAAP;EACD;;EACD,oBAAO,4DAAGD,QAAH,CAAP;AACD,CAPD;;eASeD,Q"}
@@ -4,9 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+
7
8
  var _react = _interopRequireDefault(require("react"));
9
+
8
10
  var _rownd = require("../hooks/rownd");
11
+
9
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
10
14
  const SignedOut = _ref => {
11
15
  let {
12
16
  children
@@ -14,10 +18,14 @@ const SignedOut = _ref => {
14
18
  const {
15
19
  is_authenticated
16
20
  } = (0, _rownd.useRownd)();
21
+
17
22
  if (is_authenticated) {
18
23
  return null;
19
24
  }
25
+
20
26
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children);
21
27
  };
22
- var _default = exports.default = SignedOut;
28
+
29
+ var _default = SignedOut;
30
+ exports.default = _default;
23
31
  //# sourceMappingURL=SignedOut.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_rownd","obj","__esModule","default","SignedOut","_ref","children","is_authenticated","useRownd","createElement","Fragment","_default","exports"],"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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAA0C,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAM1C,MAAMG,SAAmC,GAAGC,IAAA,IAAkB;EAAA,IAAjB;IAAEC;EAAS,CAAC,GAAAD,IAAA;EACvD,MAAM;IAAEE;EAAiB,CAAC,GAAG,IAAAC,eAAQ,EAAC,CAAC;EAEvC,IAAID,gBAAgB,EAAE;IACpB,OAAO,IAAI;EACb;EACA,oBAAOV,MAAA,CAAAM,OAAA,CAAAM,aAAA,CAAAZ,MAAA,CAAAM,OAAA,CAAAO,QAAA,QAAGJ,QAAW,CAAC;AACxB,CAAC;AAAC,IAAAK,QAAA,GAAAC,OAAA,CAAAT,OAAA,GAEaC,SAAS"}
1
+ {"version":3,"names":["SignedOut","children","is_authenticated","useRownd"],"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;;AACA;;;;AAMA,MAAMA,SAAmC,GAAG,QAAkB;EAAA,IAAjB;IAAEC;EAAF,CAAiB;EAC5D,MAAM;IAAEC;EAAF,IAAuB,IAAAC,eAAA,GAA7B;;EAEA,IAAID,gBAAJ,EAAsB;IACpB,OAAO,IAAP;EACD;;EACD,oBAAO,4DAAGD,QAAH,CAAP;AACD,CAPD;;eASeD,S"}
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.ActionType = void 0;
7
- let ActionType = exports.ActionType = void 0;
7
+ let ActionType;
8
+ exports.ActionType = ActionType;
9
+
8
10
  (function (ActionType) {
9
11
  ActionType["UPDATE_STATE"] = "UPDATE_STATE";
10
12
  })(ActionType || (exports.ActionType = ActionType = {}));
@@ -1 +1 @@
1
- {"version":3,"names":["ActionType","exports"],"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":";;;;;;IAAYA,UAAU,GAAAC,OAAA,CAAAD,UAAA;AAAA,WAAVA,UAAU;EAAVA,UAAU;AAAA,GAAVA,UAAU,KAAAC,OAAA,CAAAD,UAAA,GAAVA,UAAU"}
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":";;;;;;IAAYA,U;;;WAAAA,U;EAAAA,U;GAAAA,U,0BAAAA,U"}
@@ -4,8 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.useRownd = useRownd;
7
+
7
8
  var _nativeModule = require("../utils/nativeModule");
9
+
8
10
  var _GlobalContext = require("../components/GlobalContext");
11
+
9
12
  function useRownd() {
10
13
  const {
11
14
  state
@@ -1 +1 @@
1
- {"version":3,"names":["_nativeModule","require","_GlobalContext","useRownd","state","useRowndContext","access_token","auth","getAccessToken","firebase","getIdToken","getFirebaseIdToken","is_authenticated","is_initializing","app_id","manageAccount","requestSignIn","signOut","user","data","setValue","setUserDataValue","set","setUserData"],"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,IAAAA,aAAA,GAAAC,OAAA;AASA,IAAAC,cAAA,GAAAD,OAAA;AAsCO,SAASE,QAAQA,CAAA,EAAkB;EACxC,MAAM;IAAEC;EAAM,CAAC,GAAG,IAAAC,8BAAe,EAAC,CAAC;EAEnC,OAAO;IACLC,YAAY,EAAEF,KAAK,CAACG,IAAI,CAACD,YAAY;IACrCC,IAAI,EAAEH,KAAK,CAACG,IAAI;IAChBC,cAAc,EAAdA,4BAAc;IACdC,QAAQ,EAAE;MACRC,UAAU,EAAEC;IACd,CAAC;IACDC,gBAAgB,EAAE,CAAC,CAACR,KAAK,CAACG,IAAI,CAACD,YAAY;IAC3CO,eAAe,EAAE,CAACT,KAAK,CAACG,IAAI,CAACO,MAAM;IACnCC,aAAa,EAAbA,2BAAa;IACbC,aAAa,EAAbA,2BAAa;IACbC,OAAO,EAAPA,qBAAO;IACPC,IAAI,EAAE;MACJC,IAAI,EAAEf,KAAK,CAACc,IAAI,CAACC,IAAI;MACrBC,QAAQ,EAAEC,8BAAgB;MAC1BC,GAAG,EAAEC;IACP;EACF,CAAC;AACH"}
1
+ {"version":3,"names":["useRownd","state","useRowndContext","access_token","auth","getAccessToken","firebase","getIdToken","getFirebaseIdToken","is_authenticated","is_initializing","app_id","manageAccount","requestSignIn","signOut","user","data","setValue","setUserDataValue","set","setUserData"],"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;;AASA;;AAsCO,SAASA,QAAT,GAAmC;EACxC,MAAM;IAAEC;EAAF,IAAY,IAAAC,8BAAA,GAAlB;EAEA,OAAO;IACLC,YAAY,EAAEF,KAAK,CAACG,IAAN,CAAWD,YADpB;IAELC,IAAI,EAAEH,KAAK,CAACG,IAFP;IAGLC,cAAc,EAAdA,4BAHK;IAILC,QAAQ,EAAE;MACRC,UAAU,EAAEC;IADJ,CAJL;IAOLC,gBAAgB,EAAE,CAAC,CAACR,KAAK,CAACG,IAAN,CAAWD,YAP1B;IAQLO,eAAe,EAAE,CAACT,KAAK,CAACG,IAAN,CAAWO,MARxB;IASLC,aAAa,EAAbA,2BATK;IAULC,aAAa,EAAbA,2BAVK;IAWLC,OAAO,EAAPA,qBAXK;IAYLC,IAAI,EAAE;MACJC,IAAI,EAAEf,KAAK,CAACc,IAAN,CAAWC,IADb;MAEJC,QAAQ,EAAEC,8BAFN;MAGJC,GAAG,EAAEC;IAHD;EAZD,CAAP;AAkBD"}
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.useRownd = useRownd;
7
+
7
8
  var _react = require("@rownd/react");
9
+
8
10
  function useRownd() {
9
11
  const {
10
12
  requestSignIn,
@@ -31,8 +33,7 @@ function useRownd() {
31
33
  is_authenticated,
32
34
  is_initializing,
33
35
  manageAccount,
34
- requestSignIn: opts => requestSignIn({
35
- ...opts,
36
+ requestSignIn: opts => requestSignIn({ ...opts,
36
37
  post_login_redirect: opts === null || opts === void 0 ? void 0 : opts.postSignInRedirect
37
38
  }),
38
39
  signOut,