@rownd/react-native 2.7.0 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -90,7 +90,7 @@ export default function Root() {
90
90
  Later on within your app's components, you can use the Rownd hook to access the Rownd browser API:
91
91
 
92
92
  ```tsx
93
- import { View, Text } from 'react-native';
93
+ import { View, Text, Pressable } from 'react-native';
94
94
  import { useRownd } from '@rownd/react-native';
95
95
 
96
96
  export default function MyProtectedComponent(props) {
@@ -108,8 +108,8 @@ export default function MyProtectedComponent(props) {
108
108
  <View>
109
109
  {is_authenticated ? (
110
110
  <>
111
- <h1>Welcome {user.data.first_name}</h1>
112
- <button onClick={() => getAccessToken()}>Get access token</button>
111
+ <Text>Welcome {user.data.first_name}</Text>
112
+ <Pressable onClick={() => getAccessToken()}><Text>Get access token</Text></Pressable>
113
113
  </>
114
114
  ) : (
115
115
  <>
@@ -124,6 +124,37 @@ export default function MyProtectedComponent(props) {
124
124
  }
125
125
  ```
126
126
 
127
+ ### Customizing the UI
128
+
129
+ Customizing the UI
130
+ While most customizations are handled via the [Rownd dashboard](https://app.rownd.io), there are a few things that have to be customized directly in the SDK.
131
+
132
+ The `customization` prop for `RowndProvider` allows specific customizations to be set:
133
+
134
+ - `sheetBackgroundHexColor: string` (Hex color) Allows changing the background color underlaying the bottom sheet that appears when signing in, managing the user account, transferring encryption keys, etc.
135
+ - `loadingAnimation: string` (JSON animation) Replace Rownd's use of the system default loading spinner with a custom animation. Any animation compatible with [Lottie](https://airbnb.design/lottie/) should work, but will be scaled to fit a 1:1 aspect ratio.
136
+ - `sheetCornerBorderRadius: string` (Number) Modifies the curvature radius of the bottom sheet corners.
137
+
138
+ ```tsx
139
+ const loadingAnimation = require('../assets/loading.json');
140
+
141
+ export default function App() {
142
+ return (
143
+ <View style={styles.container}>
144
+ <RowndProvider
145
+ config={{ appKey: '######-####-####-####-#########' }}
146
+ customizations={{
147
+ sheetBackgroundHexColor: '#ffffff',
148
+ sheetCornerBorderRadius: '20',
149
+ loadingAnimation: JSON.stringify(loadingAnimation),
150
+ }}
151
+ >
152
+ <Main />
153
+ </RowndProvider>
154
+ </View>
155
+ );
156
+ }
157
+ ```
127
158
  ## API reference
128
159
 
129
160
  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.
@@ -154,7 +185,7 @@ Retrieves the active, valid access token for the current user.&#x20;
154
185
  ```javascript
155
186
  const { getAccessToken } = useRownd();
156
187
 
157
- let accessToken = await getAccessToken(=);
188
+ let accessToken = await getAccessToken();
158
189
  ```
159
190
 
160
191
  #### is\_authenticated
@@ -135,8 +135,10 @@ dependencies {
135
135
  //noinspection GradleDynamicVersion
136
136
  implementation "com.facebook.react:react-native:+"
137
137
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
138
- implementation 'io.rownd:android:2.0.1'
138
+ implementation 'io.rownd:android:2.1.0'
139
139
  implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2"
140
+ implementation 'androidx.compose.ui:ui-unit:1.3.0'
141
+ implementation 'androidx.compose.ui:ui-graphics:1.3.0'
140
142
  // From node_modules
141
143
  }
142
144
 
@@ -1,16 +1,47 @@
1
1
  package com.reactnativerowndplugin
2
2
 
3
+ import android.content.res.Configuration
3
4
  import android.os.Handler
4
5
  import android.os.Looper
6
+ import androidx.compose.ui.graphics.Color
7
+ import androidx.compose.ui.unit.Dp
8
+ import androidx.compose.ui.unit.dp
5
9
  import androidx.fragment.app.FragmentActivity
6
10
  import com.facebook.react.bridge.*
7
11
  import com.facebook.react.modules.core.DeviceEventManagerModule
8
12
  import io.rownd.android.*
9
13
  import io.rownd.android.Rownd
14
+ import io.rownd.android.RowndSignInHint
15
+ import io.rownd.android.RowndSignInOptions
16
+ import io.rownd.android.models.RowndCustomizations
10
17
  import io.rownd.android.models.repos.GlobalState
11
18
  import kotlinx.coroutines.*
12
19
  import kotlinx.serialization.json.Json
13
20
 
21
+ class AppCustomizations(app: FragmentActivity) : RowndCustomizations() {
22
+ private var app: FragmentActivity
23
+ open var reactNativeSheetBackgroundColor: Color? = null
24
+
25
+ init {
26
+ this.app = app
27
+ }
28
+
29
+ override val dynamicSheetBackgroundColor: Color
30
+ get() {
31
+ if (reactNativeSheetBackgroundColor != null) {
32
+ return reactNativeSheetBackgroundColor as Color
33
+ }
34
+ val uiMode = app.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK
35
+ return if (uiMode == Configuration.UI_MODE_NIGHT_YES) {
36
+ Color(0xff123456)
37
+ } else {
38
+ Color(0xfffedcba)
39
+ }
40
+ }
41
+
42
+ override var sheetCornerBorderRadius: Dp = 25.dp
43
+ }
44
+
14
45
 
15
46
  class RowndPluginModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
16
47
  private var uiThreadHandler = Handler(Looper.getMainLooper())
@@ -29,7 +60,7 @@ class RowndPluginModule(reactContext: ReactApplicationContext) : ReactContextBas
29
60
  init {
30
61
  coroutineScope = CoroutineScope(Dispatchers.IO).launch {
31
62
  Rownd.state.collect {
32
- uiThreadHandler.post{
63
+ uiThreadHandler.post {
33
64
  val params = Arguments.createMap().apply {
34
65
  putString("state", Json.encodeToString(GlobalState.serializer(), it))
35
66
  }
@@ -50,6 +81,28 @@ class RowndPluginModule(reactContext: ReactApplicationContext) : ReactContextBas
50
81
  promise.resolve(a * b * 10)
51
82
  }
52
83
 
84
+ @ReactMethod
85
+ fun customizations(config: ReadableMap) {
86
+ var appCustomizations = AppCustomizations(reactApplicationContext.currentActivity as FragmentActivity)
87
+
88
+ val sheetBackgroundHexColor: String? = config.getString("sheetBackgroundHexColor")
89
+ if (sheetBackgroundHexColor != null) {
90
+ appCustomizations.reactNativeSheetBackgroundColor = Color(android.graphics.Color.parseColor(sheetBackgroundHexColor))
91
+ }
92
+
93
+ val sheetCornerBorderRadius: String? = config.getString("sheetCornerBorderRadius")
94
+ if (sheetCornerBorderRadius != null && sheetCornerBorderRadius.toDoubleOrNull() != null) {
95
+ appCustomizations.sheetCornerBorderRadius = sheetCornerBorderRadius.toDouble().dp
96
+ }
97
+
98
+ val loadingAnimation: String? = config.getString("loadingAnimation")
99
+ if (loadingAnimation != null) {
100
+ appCustomizations.loadingAnimationJsonString = loadingAnimation
101
+ }
102
+
103
+ Rownd.config.customizations = appCustomizations
104
+ }
105
+
53
106
  @ReactMethod
54
107
  fun configure(config: ReadableMap) {
55
108
  val appKey = config.getString("appKey")
@@ -0,0 +1,62 @@
1
+ //
2
+ // RowndHelper.swift
3
+ // rownd-react-native
4
+ //
5
+ // Created by Michael Murray on 11/4/22.
6
+ //
7
+ import Foundation
8
+ import Rownd
9
+ import Lottie
10
+
11
+ extension UIViewController {
12
+ var colorScheme: UIUserInterfaceStyle {
13
+ if #available(iOS 13.0, *) {
14
+ return self.traitCollection.userInterfaceStyle
15
+ }
16
+ else {
17
+ return UIUserInterfaceStyle.unspecified
18
+ }
19
+ }
20
+
21
+ }
22
+
23
+ class AppCustomizations : RowndCustomizations {
24
+ override var sheetBackgroundColor: UIColor {
25
+ if let color = reactNativeSheetBackgroundColor {
26
+ return color
27
+ }
28
+ switch(UIViewController().colorScheme) {
29
+ case .light, .unspecified:
30
+ return .white
31
+ case .dark:
32
+ return .systemGray6
33
+ @unknown default:
34
+ return .white
35
+ }
36
+ }
37
+ open var reactNativeSheetBackgroundColor: UIColor? = nil
38
+ }
39
+
40
+
41
+ func colorWithHexString(hexString: String, alpha:CGFloat = 1.0) -> UIColor {
42
+ // Convert hex string to an integer
43
+ let hexint = Int(intFromHexString(hexStr: hexString))
44
+ let red = CGFloat((hexint & 0xff0000) >> 16) / 255.0
45
+ let green = CGFloat((hexint & 0xff00) >> 8) / 255.0
46
+ let blue = CGFloat((hexint & 0xff) >> 0) / 255.0
47
+
48
+ // Create color object, specifying alpha as well
49
+ let color = UIColor(red: red, green: green, blue: blue, alpha: alpha)
50
+ return color
51
+ }
52
+
53
+ func intFromHexString(hexStr: String) -> UInt32 {
54
+ var hexInt: UInt32 = 0
55
+ // Create scanner
56
+ let scanner: Scanner = Scanner(string: hexStr)
57
+ // Tell scanner to skip the # character
58
+ scanner.charactersToBeSkipped = CharacterSet(charactersIn: "#")
59
+ // Scan hex value
60
+ hexInt = UInt32(bitPattern: scanner.scanInt32(representation: .hexadecimal) ?? 0)
61
+ return hexInt
62
+ }
package/ios/RowndPlugin.m CHANGED
@@ -12,16 +12,14 @@ RCT_EXTERN_METHOD(configure:(NSDictionary *)config
12
12
 
13
13
  RCT_EXTERN_METHOD(requestSignIn:(NSDictionary *)signInConfig)
14
14
 
15
- RCT_EXTERN_METHOD(requestSignInApple)
16
-
17
- RCT_EXTERN_METHOD(requestSignInGoogle)
15
+ RCT_EXTERN_METHOD(customizations:(NSDictionary *)customizations)
18
16
 
19
17
  RCT_EXTERN_METHOD(signOut)
20
18
 
21
19
  RCT_EXTERN_METHOD(manageAccount)
22
20
 
23
- RCT_EXTERN_METHOD(getAccessToken:
24
- withResolver:(RCTPromiseResolveBlock)resolve)
21
+ RCT_EXTERN_METHOD(getAccessToken:(RCTPromiseResolveBlock)resolve
22
+ withRejecter:(RCTPromiseRejectBlock)reject)
25
23
 
26
24
  RCT_EXTERN_METHOD(handleSignInLink:(NSString *)url)
27
25
 
@@ -2,6 +2,7 @@ import Rownd
2
2
  import SwiftUI
3
3
  import Combine
4
4
  import AnyCodable
5
+ import Lottie
5
6
 
6
7
  @objc(RowndPlugin)
7
8
  class RowndPlugin: NSObject {
@@ -31,6 +32,34 @@ class RowndPlugin: NSObject {
31
32
  resolve(appKey)
32
33
  }
33
34
  }
35
+
36
+ @objc(customizations:)
37
+ func customizations(customizations: NSDictionary) -> Void {
38
+ let appCustomizations = AppCustomizations()
39
+
40
+ if let sheetBackgroundColor = customizations.value(forKey: "sheetBackgroundHexColor") as? String {
41
+ appCustomizations.reactNativeSheetBackgroundColor = colorWithHexString(hexString: sheetBackgroundColor)
42
+ }
43
+
44
+ if let sheetCornerBorderRadius = customizations.value(forKey: "sheetCornerBorderRadius") as? String {
45
+ if let doubleValue = Double(sheetCornerBorderRadius) {
46
+ appCustomizations.sheetCornerBorderRadius = CGFloat(doubleValue)
47
+ }
48
+ }
49
+
50
+ if let loadingAnimation = customizations.value(forKey: "loadingAnimation") as? String {
51
+ let json = loadingAnimation.data(using: .utf8)!
52
+ do {
53
+ let decoder = JSONDecoder()
54
+ let animation = try decoder.decode(Animation.self, from: json)
55
+ appCustomizations.loadingAnimation = animation
56
+ } catch {
57
+ print("Failed to encode Loading Animation: \(error)")
58
+ }
59
+ }
60
+
61
+ Rownd.config.customizations = appCustomizations
62
+ }
34
63
 
35
64
  @objc(requestSignIn:)
36
65
  func requestSignIn(signInConfig: NSDictionary) -> Void {
@@ -78,10 +107,17 @@ class RowndPlugin: NSObject {
78
107
  }
79
108
  }
80
109
 
81
- @objc(getAccessToken:withResolver:)
82
- func getAccessToken(resolve: @escaping RCTPromiseResolveBlock) async -> Void {
83
- let accessToken = await Rownd.getAccessToken()
84
- resolve(accessToken)
110
+ @objc(getAccessToken:withRejecter:)
111
+ func getAccessToken(_ resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void {
112
+ Task {
113
+ do {
114
+ let accessToken = try await Rownd.getAccessToken()
115
+ resolve(accessToken ?? "")
116
+ } catch {
117
+ print("Failed to fetch Rownd access token")
118
+ resolve("")
119
+ }
120
+ }
85
121
  }
86
122
 
87
123
  @objc(setUserData:)
@@ -31,7 +31,8 @@ const eventEmitter = new _reactNative.NativeEventEmitter(NativeRowndModules.IOSR
31
31
  const RowndProvider = _ref => {
32
32
  let {
33
33
  children,
34
- config
34
+ config,
35
+ customizations
35
36
  } = _ref;
36
37
  const [state, dispatch] = (0, _react.useReducer)(_rowndReducer.rowndReducer, _rowndReducer.initialRowndState);
37
38
  const value = {
@@ -39,9 +40,11 @@ const RowndProvider = _ref => {
39
40
  dispatch
40
41
  };
41
42
  (0, _react.useEffect)(() => {
42
- NativeRowndModules.configure({
43
- appKey: config.appKey
44
- });
43
+ NativeRowndModules.configure(config);
44
+
45
+ if (customizations) {
46
+ NativeRowndModules.customizations(customizations);
47
+ }
45
48
  }, [config.appKey]);
46
49
  (0, _react.useEffect)(() => {
47
50
  const onSessionConnect = event => {
@@ -1 +1 @@
1
- {"version":3,"names":["YellowBox","ignoreWarnings","GlobalContext","createContext","undefined","eventEmitter","NativeEventEmitter","IOSRowndEventEmitter","Rownd","RowndProvider","children","config","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}) => {\n const [state, dispatch] = useReducer(rowndReducer, initialRowndState);\n const value = { state, dispatch };\n\n useEffect(() => {\n NativeRowndModules.configure({appKey: config.appKey});\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,QAGjD;EAAA,IAHkD;IACtDC,QADsD;IAEtDC;EAFsD,CAGlD;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,CAA6B;MAACC,MAAM,EAAEV,MAAM,CAACU;IAAh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J,+DADI,CAAN;EAGD;;EAED,OAAOF,OAAP;AACD"}
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;E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 @@
1
- {"version":3,"names":[],"sources":["GlobalContext.types.ts"],"sourcesContent":["import type { TAction } from '../constants/action';\nimport type { IConfig } from '../utils/config';\n\nexport type ContextProps = {\n config: IConfig;\n};\n\nexport type Dispatch = (action: TAction) => void;\n\nexport type GlobalState = {\n // is_initializing: boolean;\n // is_container_visible: boolean;\n // use_modal: boolean;\n // nav: {\n // current_route: string;\n // route_trigger: string;\n // event_id: string;\n // section: string;\n // options?: any;\n // };\n user: {\n data: {\n id?: string;\n email?: string | null;\n [key: string]: any;\n };\n // needs_refresh?: boolean;\n // redacted: string[];\n };\n auth: {\n access_token: string | null;\n refresh_token: string | null;\n app_id: string | null;\n init_data?: Record<string, any>;\n is_verified_user?: boolean;\n };\n app: {\n id?: string;\n icon?: string;\n icon_content_type?: string;\n config: AppConfig | null;\n schema: AppSchema | null;\n user_verification_field?: string;\n user_verification_fields?: string[];\n };\n // local_acls: Record<string, { shared: boolean }> | null;\n // is_saving_user_data: boolean;\n config?: IConfig;\n};\n\ntype AppSchema = Record<string, SchemaField>;\n\nexport interface SchemaField {\n display_name: string;\n type: string;\n data_category: string;\n required: boolean;\n owned_by: string;\n user_visible: boolean;\n revoke_after: string;\n required_retention: string;\n collection_justification: string;\n opt_out_warning: string;\n}\n\nexport interface AppConfig {\n customizations: {\n primary_color: string;\n };\n default_user_id_format?: string;\n hub: {\n auth: {\n allow_unverified_users?: boolean;\n additional_fields: [\n {\n name: string;\n type: string;\n label: string;\n placeholder?: string;\n options: [\n {\n value: string;\n label: string;\n }\n ];\n }\n ];\n email: {\n from_address: string;\n image: string;\n };\n show_app_icon: boolean;\n };\n customizations: HubCustomizations;\n };\n}\n\nexport interface HubCustomizations {\n rounded_corners: boolean;\n primary_color: string;\n placement: 'bottom-left' | 'hidden';\n offset_x: number;\n offset_y: number;\n property_overrides: Record<string, string>;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["GlobalContext.types.ts"],"sourcesContent":["import type { TAction } from '../constants/action';\nimport type { Customizations, IConfig } from '../utils/config';\n\nexport type ContextProps = {\n config: IConfig;\n customizations?: Customizations\n};\n\nexport type Dispatch = (action: TAction) => void;\n\nexport type GlobalState = {\n // is_initializing: boolean;\n // is_container_visible: boolean;\n // use_modal: boolean;\n // nav: {\n // current_route: string;\n // route_trigger: string;\n // event_id: string;\n // section: string;\n // options?: any;\n // };\n user: {\n data: {\n id?: string;\n email?: string | null;\n [key: string]: any;\n };\n // needs_refresh?: boolean;\n // redacted: string[];\n };\n auth: {\n access_token: string | null;\n refresh_token: string | null;\n app_id: string | null;\n init_data?: Record<string, any>;\n is_verified_user?: boolean;\n };\n app: {\n id?: string;\n icon?: string;\n icon_content_type?: string;\n config: AppConfig | null;\n schema: AppSchema | null;\n user_verification_field?: string;\n user_verification_fields?: string[];\n };\n // local_acls: Record<string, { shared: boolean }> | null;\n // is_saving_user_data: boolean;\n config?: IConfig;\n};\n\ntype AppSchema = Record<string, SchemaField>;\n\nexport interface SchemaField {\n display_name: string;\n type: string;\n data_category: string;\n required: boolean;\n owned_by: string;\n user_visible: boolean;\n revoke_after: string;\n required_retention: string;\n collection_justification: string;\n opt_out_warning: string;\n}\n\nexport interface AppConfig {\n customizations: {\n primary_color: string;\n };\n default_user_id_format?: string;\n hub: {\n auth: {\n allow_unverified_users?: boolean;\n additional_fields: [\n {\n name: string;\n type: string;\n label: string;\n placeholder?: string;\n options: [\n {\n value: string;\n label: string;\n }\n ];\n }\n ];\n email: {\n from_address: string;\n image: string;\n };\n show_app_icon: boolean;\n };\n customizations: HubCustomizations;\n };\n}\n\nexport interface HubCustomizations {\n rounded_corners: boolean;\n primary_color: string;\n placement: 'bottom-left' | 'hidden';\n offset_x: number;\n offset_y: number;\n property_overrides: Record<string, string>;\n}\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["config.ts"],"sourcesContent":["export interface IConfig {\n appKey: string;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["config.ts"],"sourcesContent":["export interface IConfig {\n appKey: string;\n}\n\nexport interface Customizations {\n sheetBackgroundHexColor?: string;\n sheetCornerBorderRadius?: string;\n loadingAnimation?: string;\n}\n"],"mappings":""}
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.Rownd = exports.LINKING_ERROR = exports.IOSRowndEventEmitter = void 0;
7
7
  exports.configure = configure;
8
+ exports.customizations = customizations;
8
9
  exports.getAccessToken = getAccessToken;
9
10
  exports.handleSignInLink = handleSignInLink;
10
11
  exports.manageAccount = manageAccount;
@@ -39,15 +40,19 @@ function configure(config) {
39
40
  return Rownd.configure(config);
40
41
  }
41
42
 
43
+ function customizations(customizationConfig) {
44
+ return Rownd.customizations(customizationConfig);
45
+ }
46
+
42
47
  function requestSignIn(config) {
43
48
  if (!config) {
44
49
  Rownd.requestSignIn({
45
- method: "default"
50
+ method: 'default'
46
51
  });
47
52
  }
48
53
 
49
54
  return Rownd.requestSignIn({
50
- method: (config === null || config === void 0 ? void 0 : config.method) || "default",
55
+ method: (config === null || config === void 0 ? void 0 : config.method) || 'default',
51
56
  postSignInRedirect: (config === null || config === void 0 ? void 0 : config.postSignInRedirect) || undefined
52
57
  });
53
58
  }
@@ -1 +1 @@
1
- {"version":3,"names":["LINKING_ERROR","Platform","select","ios","default","Rownd","NativeModules","RowndPlugin","Proxy","get","Error","IOSRowndEventEmitter","OS","RowndPluginEventEmitter","configure","config","requestSignIn","method","postSignInRedirect","undefined","signOut","manageAccount","getAccessToken","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 { 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\n\nexport function configure(config: IConfig): Promise<string> {\n return Rownd.configure(config);\n}\n\nexport function requestSignIn(config?: RequestSignIn) {\n if (!config) {\n Rownd.requestSignIn({method: \"default\"});\n }\n return Rownd.requestSignIn({ method: config?.method || \"default\", postSignInRedirect: config?.postSignInRedirect || undefined });\n}\n\nexport function signOut() {\n return Rownd.signOut();\n}\n\nexport function manageAccount() {\n return Rownd.manageAccount();\n}\n\nexport function getAccessToken(): Promise<string> {\n return Rownd.getAccessToken();\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;;AAIO,MAAMA,aAAa,GACvB,8EAAD,GACAC,qBAAA,CAASC,MAAT,CAAgB;EAAEC,GAAG,EAAE,gCAAP;EAAyCC,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJK;;AAMA,MAAMC,KAAK,GAAGC,0BAAA,CAAcC,WAAd,GACjBD,0BAAA,CAAcC,WADG,GAEjB,IAAIC,KAAJ,CACE,EADF,EAEE;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAJ,CAAUV,aAAV,CAAN;EACD;;AAHH,CAFF,CAFG;;AAWA,MAAMW,oBAAoB,GAC/BV,qBAAA,CAASW,EAAT,KAAgB,KAAhB,GACI,IADJ,GAEIN,0BAAA,CAAc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AAK,CAACuB,gBAAN,CAAuBC,GAAvB,CAAP;AACD"}
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","undefined","signOut","manageAccount","getAccessToken","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 Rownd.requestSignIn({ method: 'default' });\n }\n return Rownd.requestSignIn({\n method: config?.method || 'default',\n postSignInRedirect: config?.postSignInRedirect || undefined,\n });\n}\n\nexport function signOut() {\n return Rownd.signOut();\n}\n\nexport function manageAccount() {\n return Rownd.manageAccount();\n}\n\nexport function getAccessToken(): Promise<string> {\n return Rownd.getAccessToken();\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;;AAIO,MAAMA,aAAa,GACvB,8EAAD,GACAC,qBAAA,CAASC,MAAT,CAAgB;EAAEC,GAAG,EAAE,gCAAP;EAAyCC,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJK;;AAMA,MAAMC,KAAK,GAAGC,0BAAA,CAAcC,WAAd,GACjBD,0BAAA,CAAcC,WADG,GAEjB,IAAIC,KAAJ,CACE,EADF,EAEE;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAJ,CAAUV,aAAV,CAAN;EACD;;AAHH,CAFF,CAFG;;AAWA,MAAMW,oBAAoB,GAC/BV,qBAAA,CAASW,EAAT,KAAgB,KAAhB,GACI,IADJ,GAEIN,0BAAA,CAAcO,uBAAd,GACAP,0BAAA,CAAcO,uBADd,GAEA,IAAIL,KAAJ,CACE,EADF,EAEE;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAJ,CAAUV,aAAV,CAAN;EACD;;AAHH,CAFF,CALC;;;AAcA,SAASc,SAAT,CAAmBC,MAAnB,EAAqD;EAC1D,OAAOV,KAAK,CAACS,SAAN,CAAgBC,MAAhB,CAAP;AACD;;AAEM,SAASC,cAAT,CAAwBC,mBAAxB,EAA6D;EAClE,OAAOZ,KAAK,CAACW,cAAN,CAAqBC,mBAArB,CAAP;AACD;;AAEM,SAASC,aAAT,CAAuBH,MAAvB,EAA+C;EACpD,IAAI,CAACA,MAAL,EAAa;IACXV,KAAK,CAACa,aAAN,CAAoB;MAAEC,MAAM,EAAE;IAAV,CAApB;EACD;;EACD,OAAOd,KAAK,CAACa,aAAN,CAAoB;IACzBC,MAAM,EAAE,CAAAJ,MAAM,SAAN,IAAAA,MAAM,WAAN,YAAAA,MAAM,CAAEI,MAAR,KAAkB,SADD;IAEzBC,kBAAkB,EAAE,CAAAL,MAAM,SAAN,IAAAA,MAAM,WAAN,YAAAA,MAAM,CAAEK,kBAAR,KAA8BC;EAFzB,CAApB,CAAP;AAID;;AAEM,SAASC,OAAT,GAAmB;EACxB,OAAOjB,KAAK,CAACiB,OAAN,EAAP;AACD;;AAEM,SAASC,aAAT,GAAyB;EAC9B,OAAOlB,KAAK,CAACkB,aAAN,EAAP;AACD;;AAEM,SAASC,cAAT,GAA2C;EAChD,OAAOnB,KAAK,CAACmB,cAAN,EAAP;AACD;;AAEM,SAASC,gBAAT,CAA0BC,GAA1B,EAAuCC,KAAvC,EAAmD;EACxD,OAAOtB,KAAK,CAACoB,gBAAN,CACLC,GADK,EAELzB,qBAAA,CAASW,EAAT,KAAgB,SAAhB,GAA4B;IAAEe;EAAF,CAA5B,GAAwCA,KAFnC,CAAP;AAID;;AAEM,SAASC,WAAT,CAAqBC,IAArB,EAAgD;EACrD,OAAOxB,KAAK,CAACuB,WAAN,CAAkBC,IAAlB,CAAP;AACD;;AAEM,SAASC,gBAAT,CAA0BC,GAA1B,EAAuC;EAC5C,OAAO1B,KAAK,CAACyB,gBAAN,CAAuBC,GAAvB,CAAP;AACD"}
@@ -12,7 +12,8 @@ const eventEmitter = new NativeEventEmitter(IOSRowndEventEmitter || Rownd);
12
12
  const RowndProvider = _ref => {
13
13
  let {
14
14
  children,
15
- config
15
+ config,
16
+ customizations
16
17
  } = _ref;
17
18
  const [state, dispatch] = useReducer(rowndReducer, initialRowndState);
18
19
  const value = {
@@ -20,9 +21,11 @@ const RowndProvider = _ref => {
20
21
  dispatch
21
22
  };
22
23
  useEffect(() => {
23
- NativeRowndModules.configure({
24
- appKey: config.appKey
25
- });
24
+ NativeRowndModules.configure(config);
25
+
26
+ if (customizations) {
27
+ NativeRowndModules.customizations(customizations);
28
+ }
26
29
  }, [config.appKey]);
27
30
  useEffect(() => {
28
31
  const onSessionConnect = event => {
@@ -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","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}) => {\n const [state, dispatch] = useReducer(rowndReducer, initialRowndState);\n const value = { state, dispatch };\n\n useEffect(() => {\n NativeRowndModules.configure({appKey: config.appKey});\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,KAAP,IACEC,UADF,EAEEC,aAFF,EAIEC,SAJF,EAKEC,UALF,QAMO,OANP;AAOA,SAASC,kBAAT,EAA6BC,SAA7B,EAAwCC,QAAxC,EAAkDC,OAAlD,QAAiE,cAAjE;AACA,SAASC,iBAAT,EAA4BC,YAA5B,QAAgD,yBAAhD;AAEA,OAAO,KAAKC,kBAAZ,MAAoC,uBAApC;AACA,SAASC,KAAT,EAAgBC,oBAAhB,QAA4C,uBAA5C;AAGA,SAASC,UAAT,QAA2B,qBAA3B;AAEAR,SAAS,CAACS,cAAV,CAAyB,CACvB,sDADuB,CAAzB;AAGAT,SAAS,CAACS,cAAV,CAAyB,CAAC,0CAAD,CAAzB;AAEA,OAAO,MAAMC,aAAa,gBAAGd,aAAa,CAExCe,SAFwC,CAAnC;AAIP,MAAMC,YAAY,GAAG,IAAIb,kBAAJ,CAAuBQ,oBAAoB,IAAID,KAA/C,CAArB;;AAEA,MAAMO,aAA8C,GAAG,QAGjD;EAAA,IAHkD;IACtDC,QADsD;IAEtDC;EAFsD,CAGlD;EACJ,MAAM,CAACC,KAAD,EAAQC,QAAR,IAAoBtB,UAAU,CAACS,YAAD,EAAeD,iBAAf,CAApC;EACA,MAAMe,KAAK,GAAG;IAAEF,KAAF;IAASC;EAAT,CAAd;EAEApB,SAAS,CAAC,MAAM;IACdQ,kBAAkB,CAACc,SAAnB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,SAAhB,EAA2B;IACzB,MAAM,IAAI4B,KAAJ,CACJ,+DADI,CAAN;EAGD;;EAED,OAAOD,OAAP;AACD;;AAED,SAASzB,aAAT,EAAwBwB,eAAxB"}
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,KAAP,IACEC,UADF,EAEEC,aAFF,EAIEC,SAJF,EAKEC,UALF,QAMO,OANP;AAOA,SAASC,kBAAT,EAA6BC,SAA7B,EAAwCC,QAAxC,EAAkDC,OAAlD,QAAiE,cAAjE;AACA,SAASC,iBAAT,EAA4BC,YAA5B,QAAgD,yBAAhD;AAEA,OAAO,KAAKC,kBAAZ,MAAoC,uBAApC;AACA,SAASC,KAAT,EAAgBC,oBAAhB,QAA4C,uBAA5C;AAGA,SAASC,UAAT,QAA2B,qBAA3B;AAEAR,SAAS,CAACS,cAAV,CAAyB,CACvB,sDADuB,CAAzB;AAGAT,SAAS,CAACS,cAAV,CAAyB,CAAC,0CAAD,CAAzB;AAEA,OAAO,MAAMC,aAAa,gBAAGd,aAAa,CAExCe,SAFwC,CAAnC;AAIP,MAAMC,YAAY,GAAG,IAAIb,kBAAJ,CAAuBQ,oBAAoB,IAAID,KAA/C,CAArB;;AAEA,MAAMO,aAA8C,GAAG,QAIjD;EAAA,IAJkD;IACtDC,QADsD;IAEtDC,MAFsD;IAGtDC;EAHsD,C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EAMD,CAfQ,EAeN,EAfM,CAAT;EAiBA,oBACE,oBAAC,aAAD,CAAe,QAAf;IAAwB,KAAK,EAAEjB;EAA/B,GAAuCL,QAAvC,CADF;AAGD,CAvDD;;AAyDA,SAASwB,eAAT,GAA2B;EACzB,MAAMC,OAAO,GAAGzC,UAAU,CAACY,aAAD,CAA1B;;EAEA,IAAI6B,OAAO,KAAK5B,SAAhB,EAA2B;IACzB,MAAM,IAAI6B,KAAJ,CACJ,+DADI,CAAN;EAGD;;EAED,OAAOD,OAAP;AACD;;AAED,SAAS1B,aAAT,EAAwByB,eAAxB"}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["GlobalContext.types.ts"],"sourcesContent":["import type { TAction } from '../constants/action';\nimport type { IConfig } from '../utils/config';\n\nexport type ContextProps = {\n config: IConfig;\n};\n\nexport type Dispatch = (action: TAction) => void;\n\nexport type GlobalState = {\n // is_initializing: boolean;\n // is_container_visible: boolean;\n // use_modal: boolean;\n // nav: {\n // current_route: string;\n // route_trigger: string;\n // event_id: string;\n // section: string;\n // options?: any;\n // };\n user: {\n data: {\n id?: string;\n email?: string | null;\n [key: string]: any;\n };\n // needs_refresh?: boolean;\n // redacted: string[];\n };\n auth: {\n access_token: string | null;\n refresh_token: string | null;\n app_id: string | null;\n init_data?: Record<string, any>;\n is_verified_user?: boolean;\n };\n app: {\n id?: string;\n icon?: string;\n icon_content_type?: string;\n config: AppConfig | null;\n schema: AppSchema | null;\n user_verification_field?: string;\n user_verification_fields?: string[];\n };\n // local_acls: Record<string, { shared: boolean }> | null;\n // is_saving_user_data: boolean;\n config?: IConfig;\n};\n\ntype AppSchema = Record<string, SchemaField>;\n\nexport interface SchemaField {\n display_name: string;\n type: string;\n data_category: string;\n required: boolean;\n owned_by: string;\n user_visible: boolean;\n revoke_after: string;\n required_retention: string;\n collection_justification: string;\n opt_out_warning: string;\n}\n\nexport interface AppConfig {\n customizations: {\n primary_color: string;\n };\n default_user_id_format?: string;\n hub: {\n auth: {\n allow_unverified_users?: boolean;\n additional_fields: [\n {\n name: string;\n type: string;\n label: string;\n placeholder?: string;\n options: [\n {\n value: string;\n label: string;\n }\n ];\n }\n ];\n email: {\n from_address: string;\n image: string;\n };\n show_app_icon: boolean;\n };\n customizations: HubCustomizations;\n };\n}\n\nexport interface HubCustomizations {\n rounded_corners: boolean;\n primary_color: string;\n placement: 'bottom-left' | 'hidden';\n offset_x: number;\n offset_y: number;\n property_overrides: Record<string, string>;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["GlobalContext.types.ts"],"sourcesContent":["import type { TAction } from '../constants/action';\nimport type { Customizations, IConfig } from '../utils/config';\n\nexport type ContextProps = {\n config: IConfig;\n customizations?: Customizations\n};\n\nexport type Dispatch = (action: TAction) => void;\n\nexport type GlobalState = {\n // is_initializing: boolean;\n // is_container_visible: boolean;\n // use_modal: boolean;\n // nav: {\n // current_route: string;\n // route_trigger: string;\n // event_id: string;\n // section: string;\n // options?: any;\n // };\n user: {\n data: {\n id?: string;\n email?: string | null;\n [key: string]: any;\n };\n // needs_refresh?: boolean;\n // redacted: string[];\n };\n auth: {\n access_token: string | null;\n refresh_token: string | null;\n app_id: string | null;\n init_data?: Record<string, any>;\n is_verified_user?: boolean;\n };\n app: {\n id?: string;\n icon?: string;\n icon_content_type?: string;\n config: AppConfig | null;\n schema: AppSchema | null;\n user_verification_field?: string;\n user_verification_fields?: string[];\n };\n // local_acls: Record<string, { shared: boolean }> | null;\n // is_saving_user_data: boolean;\n config?: IConfig;\n};\n\ntype AppSchema = Record<string, SchemaField>;\n\nexport interface SchemaField {\n display_name: string;\n type: string;\n data_category: string;\n required: boolean;\n owned_by: string;\n user_visible: boolean;\n revoke_after: string;\n required_retention: string;\n collection_justification: string;\n opt_out_warning: string;\n}\n\nexport interface AppConfig {\n customizations: {\n primary_color: string;\n };\n default_user_id_format?: string;\n hub: {\n auth: {\n allow_unverified_users?: boolean;\n additional_fields: [\n {\n name: string;\n type: string;\n label: string;\n placeholder?: string;\n options: [\n {\n value: string;\n label: string;\n }\n ];\n }\n ];\n email: {\n from_address: string;\n image: string;\n };\n show_app_icon: boolean;\n };\n customizations: HubCustomizations;\n };\n}\n\nexport interface HubCustomizations {\n rounded_corners: boolean;\n primary_color: string;\n placement: 'bottom-left' | 'hidden';\n offset_x: number;\n offset_y: number;\n property_overrides: Record<string, string>;\n}\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["config.ts"],"sourcesContent":["export interface IConfig {\n appKey: string;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["config.ts"],"sourcesContent":["export interface IConfig {\n appKey: string;\n}\n\nexport interface Customizations {\n sheetBackgroundHexColor?: string;\n sheetCornerBorderRadius?: string;\n loadingAnimation?: string;\n}\n"],"mappings":""}
@@ -18,15 +18,18 @@ export const IOSRowndEventEmitter = Platform.OS !== 'ios' ? null : NativeModules
18
18
  export function configure(config) {
19
19
  return Rownd.configure(config);
20
20
  }
21
+ export function customizations(customizationConfig) {
22
+ return Rownd.customizations(customizationConfig);
23
+ }
21
24
  export function requestSignIn(config) {
22
25
  if (!config) {
23
26
  Rownd.requestSignIn({
24
- method: "default"
27
+ method: 'default'
25
28
  });
26
29
  }
27
30
 
28
31
  return Rownd.requestSignIn({
29
- method: (config === null || config === void 0 ? void 0 : config.method) || "default",
32
+ method: (config === null || config === void 0 ? void 0 : config.method) || 'default',
30
33
  postSignInRedirect: (config === null || config === void 0 ? void 0 : config.postSignInRedirect) || undefined
31
34
  });
32
35
  }
@@ -1 +1 @@
1
- {"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","Rownd","RowndPlugin","Proxy","get","Error","IOSRowndEventEmitter","OS","RowndPluginEventEmitter","configure","config","requestSignIn","method","postSignInRedirect","undefined","signOut","manageAccount","getAccessToken","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 { 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\n\nexport function configure(config: IConfig): Promise<string> {\n return Rownd.configure(config);\n}\n\nexport function requestSignIn(config?: RequestSignIn) {\n if (!config) {\n Rownd.requestSignIn({method: \"default\"});\n }\n return Rownd.requestSignIn({ method: config?.method || \"default\", postSignInRedirect: config?.postSignInRedirect || undefined });\n}\n\nexport function signOut() {\n return Rownd.signOut();\n}\n\nexport function manageAccount() {\n return Rownd.manageAccount();\n}\n\nexport function getAccessToken(): Promise<string> {\n return Rownd.getAccessToken();\n}\n\nexport function setUserDataValue(key: string, value: any) {\n return Rownd.setUserDataValue(\n key,\n Platform.OS === 'android' ? { value } : value\n );\n}\n\nexport function setUserData(data: Record<string, any>) {\n return Rownd.setUserData(data);\n}\n\nexport function handleSignInLink(url: string) {\n return Rownd.handleSignInLink(url);\n}\n"],"mappings":"AAAA,SAASA,aAAT,EAAwBC,QAAxB,QAAwC,cAAxC;AAIA,OAAO,MAAMC,aAAa,GACvB,8EAAD,GACAD,QAAQ,CAACE,MAAT,CAAgB;EAAEC,GAAG,EAAE,gCAAP;EAAyCC,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJK;AAMP,OAAO,MAAMC,KAAK,GAAGN,aAAa,CAACO,WAAd,GACjBP,aAAa,CAAC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AAQ,CAACW,EAAT,KAAgB,SAAhB,GAA4B;IAAEa;EAAF,CAA5B,GAAwCA,KAFnC,CAAP;AAID;AAED,OAAO,SAASC,WAAT,CAAqBC,IAArB,EAAgD;EACrD,OAAOrB,KAAK,CAACoB,WAAN,CAAkBC,IAAlB,CAAP;AACD;AAED,OAAO,SAASC,gBAAT,CAA0BC,GAA1B,EAAuC;EAC5C,OAAOvB,KAAK,CAACsB,gBAAN,CAAuBC,GAAvB,CAAP;AACD"}
1
+ {"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","Rownd","RowndPlugin","Proxy","get","Error","IOSRowndEventEmitter","OS","RowndPluginEventEmitter","configure","config","customizations","customizationConfig","requestSignIn","method","postSignInRedirect","undefined","signOut","manageAccount","getAccessToken","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 Rownd.requestSignIn({ method: 'default' });\n }\n return Rownd.requestSignIn({\n method: config?.method || 'default',\n postSignInRedirect: config?.postSignInRedirect || undefined,\n });\n}\n\nexport function signOut() {\n return Rownd.signOut();\n}\n\nexport function manageAccount() {\n return Rownd.manageAccount();\n}\n\nexport function getAccessToken(): Promise<string> {\n return Rownd.getAccessToken();\n}\n\nexport function setUserDataValue(key: string, value: any) {\n return Rownd.setUserDataValue(\n key,\n Platform.OS === 'android' ? { value } : value\n );\n}\n\nexport function setUserData(data: Record<string, any>) {\n return Rownd.setUserData(data);\n}\n\nexport function handleSignInLink(url: string) {\n return Rownd.handleSignInLink(url);\n}\n"],"mappings":"AAAA,SAASA,aAAT,EAAwBC,QAAxB,QAAwC,cAAxC;AAIA,OAAO,MAAMC,aAAa,GACvB,8EAAD,GACAD,QAAQ,CAACE,MAAT,CAAgB;EAAEC,GAAG,EAAE,gCAAP;EAAyCC,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJK;AAMP,OAAO,MAAMC,KAAK,GAAGN,aAAa,CAACO,WAAd,GACjBP,aAAa,CAACO,WADG,GAEjB,IAAIC,KAAJ,CACE,EADF,EAEE;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAJ,CAAUR,aAAV,CAAN;EACD;;AAHH,CAFF,CAFG;AAWP,OAAO,MAAMS,oBAAoB,GAC/BV,QAAQ,CAACW,EAAT,KAAgB,KAAhB,GACI,IADJ,GAEIZ,aAAa,CAACa,uBAAd,GACAb,aAAa,CAACa,uBADd,GAEA,IAAIL,KAAJ,CACE,EADF,EAEE;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAJ,CAAUR,aAAV,CAAN;EACD;;AAHH,CAFF,CALC;AAcP,OAAO,SAASY,SAAT,CAAmBC,MAAnB,EAAqD;EAC1D,OAAOT,KAAK,CAACQ,SAAN,CAAgBC,MAAhB,CAAP;AACD;AAED,OAAO,SAASC,cAAT,CAAwBC,mBAAxB,EAA6D;EAClE,OAAOX,KAAK,CAACU,cAAN,CAAqBC,mBAArB,CAAP;AACD;AAED,OAAO,SAASC,aAAT,CAAuBH,MAAvB,EAA+C;EACpD,IAAI,CAACA,MAAL,EAAa;IACXT,KAAK,CAACY,aAAN,CAAoB;MAAEC,MAAM,EAAE;IAAV,CAApB;EACD;;EACD,OAAOb,KAAK,CAACY,aAAN,CAAoB;IACzBC,MAAM,EAAE,CAAAJ,MAAM,SAAN,IAAAA,MAAM,WAAN,YAAAA,MAAM,CAAEI,MAAR,KAAkB,SADD;IAEzBC,kBAAkB,EAAE,CAAAL,MAAM,SAAN,IAAAA,MAAM,WAAN,YAAAA,MAAM,CAAEK,kBAAR,KAA8BC;EAFzB,CAApB,CAAP;AAID;AAED,OAAO,SAASC,OAAT,GAAmB;EACxB,OAAOhB,KAAK,CAACgB,OAAN,EAAP;AACD;AAED,OAAO,SAASC,aAAT,GAAyB;EAC9B,OAAOjB,KAAK,CAACiB,aAAN,EAAP;AACD;AAED,OAAO,SAASC,cAAT,GAA2C;EAChD,OAAOlB,KAAK,CAACkB,cAAN,EAAP;AACD;AAED,OAAO,SAASC,gBAAT,CAA0BC,GAA1B,EAAuCC,KAAvC,EAAmD;EACxD,OAAOrB,KAAK,CAACmB,gBAAN,CACLC,GADK,EAELzB,QAAQ,CAACW,EAAT,KAAgB,SAAhB,GAA4B;IAAEe;EAAF,CAA5B,GAAwCA,KAFnC,CAAP;AAID;AAED,OAAO,SAASC,WAAT,CAAqBC,IAArB,EAAgD;EACrD,OAAOvB,KAAK,CAACsB,WAAN,CAAkBC,IAAlB,CAAP;AACD;AAED,OAAO,SAASC,gBAAT,CAA0BC,GAA1B,EAAuC;EAC5C,OAAOzB,KAAK,CAACwB,gBAAN,CAAuBC,GAAvB,CAAP;AACD"}
@@ -1,7 +1,8 @@
1
1
  import type { TAction } from '../constants/action';
2
- import type { IConfig } from '../utils/config';
2
+ import type { Customizations, IConfig } from '../utils/config';
3
3
  export declare type ContextProps = {
4
4
  config: IConfig;
5
+ customizations?: Customizations;
5
6
  };
6
7
  export declare type Dispatch = (action: TAction) => void;
7
8
  export declare type GlobalState = {
@@ -1,3 +1,8 @@
1
1
  export interface IConfig {
2
2
  appKey: string;
3
3
  }
4
+ export interface Customizations {
5
+ sheetBackgroundHexColor?: string;
6
+ sheetCornerBorderRadius?: string;
7
+ loadingAnimation?: string;
8
+ }
@@ -1,9 +1,10 @@
1
1
  import type { RequestSignIn } from 'src/hooks/rownd';
2
- import type { IConfig } from './config';
2
+ import type { Customizations, IConfig } from './config';
3
3
  export declare const LINKING_ERROR: string;
4
4
  export declare const Rownd: any;
5
5
  export declare const IOSRowndEventEmitter: any;
6
6
  export declare function configure(config: IConfig): Promise<string>;
7
+ export declare function customizations(customizationConfig: Customizations): any;
7
8
  export declare function requestSignIn(config?: RequestSignIn): any;
8
9
  export declare function signOut(): any;
9
10
  export declare function manageAccount(): any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rownd/react-native",
3
- "version": "2.7.0",
3
+ "version": "2.8.0",
4
4
  "description": "test",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -17,7 +17,7 @@ Pod::Spec.new do |s|
17
17
  s.source_files = "ios/**/*.{h,m,mm,swift}"
18
18
 
19
19
  s.dependency "React-Core"
20
- s.dependency "Rownd", "~> 1.13.0"
20
+ s.dependency "Rownd", "~> 2.2.2"
21
21
 
22
22
  # Don't install the dependencies when we run `pod install` in the old architecture.
23
23
  if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
@@ -28,12 +28,16 @@ const eventEmitter = new NativeEventEmitter(IOSRowndEventEmitter || Rownd);
28
28
  const RowndProvider: FunctionComponent<ContextProps> = ({
29
29
  children,
30
30
  config,
31
+ customizations
31
32
  }) => {
32
33
  const [state, dispatch] = useReducer(rowndReducer, initialRowndState);
33
34
  const value = { state, dispatch };
34
35
 
35
36
  useEffect(() => {
36
- NativeRowndModules.configure({appKey: config.appKey});
37
+ NativeRowndModules.configure(config);
38
+ if (customizations) {
39
+ NativeRowndModules.customizations(customizations);
40
+ }
37
41
  }, [config.appKey]);
38
42
 
39
43
  useEffect(() => {
@@ -1,8 +1,9 @@
1
1
  import type { TAction } from '../constants/action';
2
- import type { IConfig } from '../utils/config';
2
+ import type { Customizations, IConfig } from '../utils/config';
3
3
 
4
4
  export type ContextProps = {
5
5
  config: IConfig;
6
+ customizations?: Customizations
6
7
  };
7
8
 
8
9
  export type Dispatch = (action: TAction) => void;
@@ -1,3 +1,9 @@
1
1
  export interface IConfig {
2
2
  appKey: string;
3
3
  }
4
+
5
+ export interface Customizations {
6
+ sheetBackgroundHexColor?: string;
7
+ sheetCornerBorderRadius?: string;
8
+ loadingAnimation?: string;
9
+ }
@@ -1,6 +1,6 @@
1
1
  import { NativeModules, Platform } from 'react-native';
2
2
  import type { RequestSignIn } from 'src/hooks/rownd';
3
- import type { IConfig } from './config';
3
+ import type { Customizations, IConfig } from './config';
4
4
 
5
5
  export const LINKING_ERROR =
6
6
  `The package '@rownd/react-native' doesn't seem to be linked. Make sure: \n\n` +
@@ -33,16 +33,22 @@ export const IOSRowndEventEmitter =
33
33
  }
34
34
  );
35
35
 
36
-
37
36
  export function configure(config: IConfig): Promise<string> {
38
37
  return Rownd.configure(config);
39
38
  }
40
39
 
40
+ export function customizations(customizationConfig: Customizations) {
41
+ return Rownd.customizations(customizationConfig);
42
+ }
43
+
41
44
  export function requestSignIn(config?: RequestSignIn) {
42
45
  if (!config) {
43
- Rownd.requestSignIn({method: "default"});
46
+ Rownd.requestSignIn({ method: 'default' });
44
47
  }
45
- return Rownd.requestSignIn({ method: config?.method || "default", postSignInRedirect: config?.postSignInRedirect || undefined });
48
+ return Rownd.requestSignIn({
49
+ method: config?.method || 'default',
50
+ postSignInRedirect: config?.postSignInRedirect || undefined,
51
+ });
46
52
  }
47
53
 
48
54
  export function signOut() {