@rownd/react-native 2.6.0 → 2.7.1

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
@@ -20,7 +20,7 @@ npm install @rownd/react-native
20
20
  ext {
21
21
  ...
22
22
  minSdkVersion = 26
23
- compileSdkVersion = 32
23
+ compileSdkVersion = 33
24
24
  targetSdkVersion = 31
25
25
  ...
26
26
  }
@@ -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:1.7.0'
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,19 +1,47 @@
1
1
  package com.reactnativerowndplugin
2
2
 
3
- import android.app.Application
3
+ import android.content.res.Configuration
4
4
  import android.os.Handler
5
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
6
9
  import androidx.fragment.app.FragmentActivity
7
10
  import com.facebook.react.bridge.*
8
11
  import com.facebook.react.modules.core.DeviceEventManagerModule
12
+ import io.rownd.android.*
9
13
  import io.rownd.android.Rownd
10
14
  import io.rownd.android.RowndSignInHint
11
15
  import io.rownd.android.RowndSignInOptions
16
+ import io.rownd.android.models.RowndCustomizations
12
17
  import io.rownd.android.models.repos.GlobalState
13
- import io.rownd.android.models.repos.UserRepo
14
18
  import kotlinx.coroutines.*
15
19
  import kotlinx.serialization.json.Json
16
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
+
17
45
 
18
46
  class RowndPluginModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
19
47
  private var uiThreadHandler = Handler(Looper.getMainLooper())
@@ -32,7 +60,7 @@ class RowndPluginModule(reactContext: ReactApplicationContext) : ReactContextBas
32
60
  init {
33
61
  coroutineScope = CoroutineScope(Dispatchers.IO).launch {
34
62
  Rownd.state.collect {
35
- uiThreadHandler.post{
63
+ uiThreadHandler.post {
36
64
  val params = Arguments.createMap().apply {
37
65
  putString("state", Json.encodeToString(GlobalState.serializer(), it))
38
66
  }
@@ -53,6 +81,28 @@ class RowndPluginModule(reactContext: ReactApplicationContext) : ReactContextBas
53
81
  promise.resolve(a * b * 10)
54
82
  }
55
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
+
56
106
  @ReactMethod
57
107
  fun configure(config: ReadableMap) {
58
108
  val appKey = config.getString("appKey")
@@ -99,26 +149,27 @@ class RowndPluginModule(reactContext: ReactApplicationContext) : ReactContextBas
99
149
 
100
150
  @ReactMethod
101
151
  fun setUserData(data: ReadableMap) {
102
- UserRepo.set(data.toHashMap())
152
+ Rownd.userRepo.set(data.toHashMap())
103
153
  }
104
154
 
105
155
  @ReactMethod
106
156
  fun setUserDataValue(key: String, array: ReadableMap) {
107
157
  val value = array.toHashMap().entries.find { it.key == "value" }?.value
108
158
  if (value != null) {
109
- UserRepo.set(key, value)
159
+ Rownd.userRepo.set(key, value)
110
160
  } else {
111
161
  println("ROWND ANDROID PLUGIN: Missing content for value")
112
162
  }
113
163
  }
114
164
 
115
- // @ReactMethod
116
- // suspend fun getAccessToken(promise: Promise) {
117
- // try {
118
- // val accessToken = Rownd.getAccessToken()
119
- // promise.resolve(accessToken ?: "")
120
- // } catch (e: Throwable) {
121
- // promise.reject("GET_ACCESS_TOKEN_ERROR: ", e)
122
- // }
123
- // }
165
+ @ReactMethod
166
+ fun getAccessToken(promise: Promise) {
167
+ coroutineScope = CoroutineScope(Dispatchers.IO).launch {
168
+ try {
169
+ promise.resolve(Rownd.getAccessToken() ?: "")
170
+ } catch (e: Throwable) {
171
+ promise.reject("ROWND PLUGIN MODULE ERROR: ")
172
+ }
173
+ }
174
+ }
124
175
  }
@@ -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,9 +12,7 @@ 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
 
@@ -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 {
@@ -80,8 +109,13 @@ class RowndPlugin: NSObject {
80
109
 
81
110
  @objc(getAccessToken:withResolver:)
82
111
  func getAccessToken(resolve: @escaping RCTPromiseResolveBlock) async -> Void {
83
- let accessToken = await Rownd.getAccessToken()
84
- resolve(accessToken)
112
+ do {
113
+ let accessToken = try await Rownd.getAccessToken()
114
+ resolve(accessToken)
115
+ } catch {
116
+ print("Failed to fetch Rownd access token")
117
+ resolve("")
118
+ }
85
119
  }
86
120
 
87
121
  @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,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A2B;EACzB,MAAMC,OAAO,GAAG,IAAAC,iBAAA,EAAWzC,aAAX,CAAhB;;EAEA,IAAIwC,OAAO,KAAKtC,SAAhB,EAA2B;IACzB,MAAM,IAAIwC,KAAJ,CACJ,+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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,CAAhB;;EAEA,IAAIyC,OAAO,KAAKvC,SAAhB,EAA2B;IACzB,MAAM,IAAIyC,KAAJ,CACJ,+DADI,CAAN;EAGD;;EAED,OAAOF,OAAP;AACD"}
@@ -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":""}
@@ -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;
@@ -35,24 +36,23 @@ const IOSRowndEventEmitter = _reactNative.Platform.OS !== 'ios' ? null : _reactN
35
36
  });
36
37
  exports.IOSRowndEventEmitter = IOSRowndEventEmitter;
37
38
 
38
- const isNotAvailableInAndroidYet = () => {
39
- console.log('ROWND: NOT AVAILABLE IN ANDROID YET');
40
- return true;
41
- };
42
-
43
39
  function configure(config) {
44
40
  return Rownd.configure(config);
45
41
  }
46
42
 
43
+ function customizations(customizationConfig) {
44
+ return Rownd.customizations(customizationConfig);
45
+ }
46
+
47
47
  function requestSignIn(config) {
48
48
  if (!config) {
49
49
  Rownd.requestSignIn({
50
- method: "default"
50
+ method: 'default'
51
51
  });
52
52
  }
53
53
 
54
54
  return Rownd.requestSignIn({
55
- method: (config === null || config === void 0 ? void 0 : config.method) || "default",
55
+ method: (config === null || config === void 0 ? void 0 : config.method) || 'default',
56
56
  postSignInRedirect: (config === null || config === void 0 ? void 0 : config.postSignInRedirect) || undefined
57
57
  });
58
58
  }
@@ -66,7 +66,6 @@ function manageAccount() {
66
66
  }
67
67
 
68
68
  function getAccessToken() {
69
- if (isNotAvailableInAndroidYet()) return Promise.resolve('');
70
69
  return Rownd.getAccessToken();
71
70
  }
72
71
 
@@ -1 +1 @@
1
- {"version":3,"names":["LINKING_ERROR","Platform","select","ios","default","Rownd","NativeModules","RowndPlugin","Proxy","get","Error","IOSRowndEventEmitter","OS","RowndPluginEventEmitter","isNotAvailableInAndroidYet","console","log","configure","config","requestSignIn","method","postSignInRedirect","undefined","signOut","manageAccount","getAccessToken","Promise","resolve","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\nconst isNotAvailableInAndroidYet = () => {\n console.log('ROWND: NOT AVAILABLE IN ANDROID YET');\n return true;\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 if (isNotAvailableInAndroidYet()) return Promise.resolve('');\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;;;AAcP,MAAMc,0BAA0B,GAAG,MAAM;EACvCC,OAAO,CAACC,GAAR,CAAY,qCAAZ;EACA,OAAO,IAAP;AACD,CAHD;;AAKO,SAASC,SAAT,CAAmBC,MAAnB,EAAqD;EAC1D,OAAOb,KAAK,CAACY,SAAN,CAAgBC,MAAhB,CAAP;AACD;;AAEM,SAASC,aAAT,CAAuBD,MAAvB,EAA+C;EACpD,IAAI,CAACA,MAAL,EAAa;IACXb,KAAK,CAACc,aAAN,CAAoB;MAACC,MAAM,EAAE;IAAT,CAApB;EACD;;EACD,OAAOf,KAAK,CAACc,aAAN,CAAoB;IAAEC,MAAM,EAAE,CAAAF,MAAM,SAAN,IAAAA,MAAM,WAAN,YAAAA,MAAM,CAAEE,MAAR,KAAkB,SAA5B;IAAuCC,kBAAkB,EAAE,CAAAH,MAAM,SAAN,IAAAA,MAAM,WAAN,YAAAA,MAAM,CAAEG,kBAAR,KAA8BC;EAAzF,CAApB,CAAP;AACD;;AAEM,SAASC,OAAT,GAAmB;EACxB,OAAOlB,KAAK,CAACkB,OAAN,EAAP;AACD;;AAEM,SAASC,aAAT,GAAyB;EAC9B,OAAOnB,KAAK,CAACmB,aAAN,EAAP;AACD;;AAEM,SAASC,cAAT,GAA2C;EAChD,IAAIX,0BAA0B,EAA9B,EAAkC,OAAOY,OAAO,CAACC,OAAR,CAAgB,EAAhB,CAAP;EAClC,OAAOtB,KAAK,CAACoB,cAAN,EAAP;AACD;;AAEM,SAASG,gBAAT,CAA0BC,GAA1B,EAAuCC,KAAvC,EAAmD;EACxD,OAAOzB,KAAK,CAACuB,gBAAN,CACLC,GADK,EAEL5B,qBAAA,CAASW,EAAT,KAAgB,SAAhB,GAA4B;IAAEkB;EAAF,CAA5B,GAAwCA,KAFnC,CAAP;AAID;;AAEM,SAASC,WAAT,CAAqBC,IAArB,EAAgD;EACrD,OAAO3B,KAAK,CAAC0B,WAAN,CAAkBC,IAAlB,CAAP;AACD;;AAEM,SAASC,gBAAT,CAA0BC,GAA1B,EAAuC;EAC5C,OAAO7B,KAAK,CAAC4B,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,EA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B,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,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AAY,CAACkB,WAAb,CACnB,cADmB,EAEnBT,gBAFmB,CAArB;IAKA,IAAI,CAACQ,YAAL,EAAmB;IAEnB,OAAO,MAAM;MACXA,YAAY,CAACE,MAAb;IACD,CAFD;EAGD,CAjBQ,EAiBN,EAjBM,CAAT,CARI,CA2BJ;;EACAlC,SAAS,CAAC,MAAM;IACd,IAAII,QAAQ,CAACyB,EAAT,KAAgB,KAApB,EAA2B;MACzB;IACD;;IAEDxB,OAAO,CAAC8B,gBAAR,CAAyB,KAAzB,EAAiCV,KAAD,IAC9BjB,kBAAkB,CAAC4B,gBAAnB,CAAoCX,KAAK,CAACY,GAA1C,CADF;;IAIA,CAAC,YAAY;MACX,MAAMC,UAAU,GAAG,MAAMjC,OAAO,CAACkC,aAAR,EAAzB;;MACA,IAAID,UAAJ,EAAgB;QACd9B,kBAAkB,CAAC4B,gBAAnB,CAAoCE,UAApC;MACD;IACF,CALD;EAMD,CAfQ,EAeN,EAfM,CAAT;EAiBA,oBACE,oBAAC,aAAD,CAAe,QAAf;IAAwB,KAAK,EAAEjB;EAA/B,GAAuCJ,QAAvC,CADF;AAGD,CAnDD;;AAqDA,SAASuB,eAAT,GAA2B;EACzB,MAAMC,OAAO,GAAGxC,UAAU,CAACY,aAAD,CAA1B;;EAEA,IAAI4B,OAAO,KAAK3B,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,CAIlD;EACJ,MAAM,CAACC,KAAD,EAAQC,QAAR,IAAoBvB,UAAU,CAACS,YAAD,EAAeD,iBAAf,CAApC;EACA,MAAMgB,KAAK,GAAG;IAAEF,KAAF;IAASC;EAAT,CAAd;EAEArB,SAAS,CAAC,MAAM;IACdQ,kBAAkB,CAACe,SAAnB,CAA6BL,MAA7B;;IACA,IAAIC,cAAJ,EAAoB;MAClBX,kBAAkB,CAACW,cAAnB,CAAkCA,cAAlC;IACD;EACF,CALQ,EAKN,CAACD,MAAM,CAACM,MAAR,CALM,CAAT;EAOAxB,SAAS,CAAC,MAAM;IACd,MAAMyB,gBAAgB,GAAIC,KAAD,IAAgB;MAC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.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":""}
@@ -15,24 +15,21 @@ export const IOSRowndEventEmitter = Platform.OS !== 'ios' ? null : NativeModules
15
15
  }
16
16
 
17
17
  });
18
-
19
- const isNotAvailableInAndroidYet = () => {
20
- console.log('ROWND: NOT AVAILABLE IN ANDROID YET');
21
- return true;
22
- };
23
-
24
18
  export function configure(config) {
25
19
  return Rownd.configure(config);
26
20
  }
21
+ export function customizations(customizationConfig) {
22
+ return Rownd.customizations(customizationConfig);
23
+ }
27
24
  export function requestSignIn(config) {
28
25
  if (!config) {
29
26
  Rownd.requestSignIn({
30
- method: "default"
27
+ method: 'default'
31
28
  });
32
29
  }
33
30
 
34
31
  return Rownd.requestSignIn({
35
- method: (config === null || config === void 0 ? void 0 : config.method) || "default",
32
+ method: (config === null || config === void 0 ? void 0 : config.method) || 'default',
36
33
  postSignInRedirect: (config === null || config === void 0 ? void 0 : config.postSignInRedirect) || undefined
37
34
  });
38
35
  }
@@ -43,7 +40,6 @@ export function manageAccount() {
43
40
  return Rownd.manageAccount();
44
41
  }
45
42
  export function getAccessToken() {
46
- if (isNotAvailableInAndroidYet()) return Promise.resolve('');
47
43
  return Rownd.getAccessToken();
48
44
  }
49
45
  export function setUserDataValue(key, value) {
@@ -1 +1 @@
1
- {"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","Rownd","RowndPlugin","Proxy","get","Error","IOSRowndEventEmitter","OS","RowndPluginEventEmitter","isNotAvailableInAndroidYet","console","log","configure","config","requestSignIn","method","postSignInRedirect","undefined","signOut","manageAccount","getAccessToken","Promise","resolve","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\nconst isNotAvailableInAndroidYet = () => {\n console.log('ROWND: NOT AVAILABLE IN ANDROID YET');\n return true;\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 if (isNotAvailableInAndroidYet()) return Promise.resolve('');\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,G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OAAOY,OAAO,CAACC,OAAR,CAAgB,EAAhB,CAAP;EAClC,OAAOrB,KAAK,CAACmB,cAAN,EAAP;AACD;AAED,OAAO,SAASG,gBAAT,CAA0BC,GAA1B,EAAuCC,KAAvC,EAAmD;EACxD,OAAOxB,KAAK,CAACsB,gBAAN,CACLC,GADK,EAEL5B,QAAQ,CAACW,EAAT,KAAgB,SAAhB,GAA4B;IAAEkB;EAAF,CAA5B,GAAwCA,KAFnC,CAAP;AAID;AAED,OAAO,SAASC,WAAT,CAAqBC,IAArB,EAAgD;EACrD,OAAO1B,KAAK,CAACyB,WAAN,CAAkBC,IAAlB,CAAP;AACD;AAED,OAAO,SAASC,gBAAT,CAA0BC,GAA1B,EAAuC;EAC5C,OAAO5B,KAAK,CAAC2B,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,CA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B,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.6.0",
3
+ "version": "2.7.1",
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.1.0"
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,20 +33,22 @@ export const IOSRowndEventEmitter =
33
33
  }
34
34
  );
35
35
 
36
- const isNotAvailableInAndroidYet = () => {
37
- console.log('ROWND: NOT AVAILABLE IN ANDROID YET');
38
- return true;
39
- };
40
-
41
36
  export function configure(config: IConfig): Promise<string> {
42
37
  return Rownd.configure(config);
43
38
  }
44
39
 
40
+ export function customizations(customizationConfig: Customizations) {
41
+ return Rownd.customizations(customizationConfig);
42
+ }
43
+
45
44
  export function requestSignIn(config?: RequestSignIn) {
46
45
  if (!config) {
47
- Rownd.requestSignIn({method: "default"});
46
+ Rownd.requestSignIn({ method: 'default' });
48
47
  }
49
- 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
+ });
50
52
  }
51
53
 
52
54
  export function signOut() {
@@ -58,7 +60,6 @@ export function manageAccount() {
58
60
  }
59
61
 
60
62
  export function getAccessToken(): Promise<string> {
61
- if (isNotAvailableInAndroidYet()) return Promise.resolve('');
62
63
  return Rownd.getAccessToken();
63
64
  }
64
65