@rownd/react-native 2.5.0 → 2.7.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.
Files changed (53) hide show
  1. package/README.md +1 -1
  2. package/android/.gradle/7.4/checksums/checksums.lock +0 -0
  3. package/android/.gradle/7.4/checksums/md5-checksums.bin +0 -0
  4. package/android/.gradle/7.4/checksums/sha1-checksums.bin +0 -0
  5. package/android/.gradle/7.4/dependencies-accessors/dependencies-accessors.lock +0 -0
  6. package/android/.gradle/7.4/dependencies-accessors/gc.properties +0 -0
  7. package/android/.gradle/7.4/executionHistory/executionHistory.bin +0 -0
  8. package/android/.gradle/7.4/executionHistory/executionHistory.lock +0 -0
  9. package/android/.gradle/7.4/fileChanges/last-build.bin +0 -0
  10. package/android/.gradle/7.4/fileHashes/fileHashes.bin +0 -0
  11. package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
  12. package/android/.gradle/7.4/fileHashes/resourceHashesCache.bin +0 -0
  13. package/android/.gradle/7.4/gc.properties +0 -0
  14. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  15. package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
  16. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  17. package/android/.gradle/file-system.probe +0 -0
  18. package/android/.gradle/vcs-1/gc.properties +0 -0
  19. package/android/.idea/compiler.xml +6 -0
  20. package/android/.idea/gradle.xml +18 -0
  21. package/android/.idea/jarRepositories.xml +30 -0
  22. package/android/.idea/misc.xml +10 -0
  23. package/android/.idea/vcs.xml +6 -0
  24. package/android/build.gradle +1 -1
  25. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  26. package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
  27. package/android/gradlew +234 -0
  28. package/android/gradlew.bat +89 -0
  29. package/android/local.properties +8 -0
  30. package/android/src/main/java/com/reactnativerowndplugin/RowndPluginModule.kt +41 -17
  31. package/ios/RowndPlugin.m +2 -2
  32. package/ios/RowndPlugin.swift +34 -21
  33. package/lib/commonjs/components/GlobalContext.js +3 -1
  34. package/lib/commonjs/components/GlobalContext.js.map +1 -1
  35. package/lib/commonjs/hooks/rownd.js.map +1 -1
  36. package/lib/commonjs/utils/config.js.map +1 -1
  37. package/lib/commonjs/utils/nativeModule.js +13 -12
  38. package/lib/commonjs/utils/nativeModule.js.map +1 -1
  39. package/lib/module/components/GlobalContext.js +3 -1
  40. package/lib/module/components/GlobalContext.js.map +1 -1
  41. package/lib/module/hooks/rownd.js.map +1 -1
  42. package/lib/module/utils/config.js.map +1 -1
  43. package/lib/module/utils/nativeModule.js +13 -13
  44. package/lib/module/utils/nativeModule.js.map +1 -1
  45. package/lib/typescript/hooks/rownd.d.ts +5 -3
  46. package/lib/typescript/utils/config.d.ts +0 -7
  47. package/lib/typescript/utils/nativeModule.d.ts +4 -3
  48. package/package.json +1 -1
  49. package/rownd-react-native.podspec +1 -1
  50. package/src/components/GlobalContext.tsx +1 -1
  51. package/src/hooks/rownd.ts +3 -4
  52. package/src/utils/config.ts +0 -6
  53. package/src/utils/nativeModule.ts +9 -12
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
  }
File without changes
@@ -0,0 +1,2 @@
1
+ #Tue Nov 01 11:51:54 EDT 2022
2
+ gradle.version=7.4
File without changes
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="CompilerConfiguration">
4
+ <bytecodeTargetLevel target="11" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="GradleMigrationSettings" migrationVersion="1" />
4
+ <component name="GradleSettings">
5
+ <option name="linkedExternalProjectsSettings">
6
+ <GradleProjectSettings>
7
+ <option name="testRunner" value="GRADLE" />
8
+ <option name="distributionType" value="DEFAULT_WRAPPED" />
9
+ <option name="externalProjectPath" value="$PROJECT_DIR$" />
10
+ <option name="modules">
11
+ <set>
12
+ <option value="$PROJECT_DIR$" />
13
+ </set>
14
+ </option>
15
+ </GradleProjectSettings>
16
+ </option>
17
+ </component>
18
+ </project>
@@ -0,0 +1,30 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="RemoteRepositoriesConfiguration">
4
+ <remote-repository>
5
+ <option name="id" value="central" />
6
+ <option name="name" value="Maven Central repository" />
7
+ <option name="url" value="https://repo1.maven.org/maven2" />
8
+ </remote-repository>
9
+ <remote-repository>
10
+ <option name="id" value="jboss.community" />
11
+ <option name="name" value="JBoss Community repository" />
12
+ <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
13
+ </remote-repository>
14
+ <remote-repository>
15
+ <option name="id" value="React Native sources" />
16
+ <option name="name" value="React Native sources" />
17
+ <option name="url" value="file:$PROJECT_DIR$/../node_modules/react-native/android/" />
18
+ </remote-repository>
19
+ <remote-repository>
20
+ <option name="id" value="MavenRepo" />
21
+ <option name="name" value="MavenRepo" />
22
+ <option name="url" value="https://repo.maven.apache.org/maven2/" />
23
+ </remote-repository>
24
+ <remote-repository>
25
+ <option name="id" value="Google" />
26
+ <option name="name" value="Google" />
27
+ <option name="url" value="https://dl.google.com/dl/android/maven2/" />
28
+ </remote-repository>
29
+ </component>
30
+ </project>
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ExternalStorageConfigurationManager" enabled="true" />
4
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
5
+ <output url="file://$PROJECT_DIR$/build/classes" />
6
+ </component>
7
+ <component name="ProjectType">
8
+ <option name="id" value="Android" />
9
+ </component>
10
+ </project>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$/.." vcs="Git" />
5
+ </component>
6
+ </project>
@@ -135,7 +135,7 @@ 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.3.3'
138
+ implementation 'io.rownd:android:2.0.1'
139
139
  implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2"
140
140
  // From node_modules
141
141
  }
@@ -0,0 +1,5 @@
1
+ distributionBase=GRADLE_USER_HOME
2
+ distributionPath=wrapper/dists
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
4
+ zipStoreBase=GRADLE_USER_HOME
5
+ zipStorePath=wrapper/dists
@@ -0,0 +1,234 @@
1
+ #!/bin/sh
2
+
3
+ #
4
+ # Copyright © 2015-2021 the original authors.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # https://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ ##############################################################################
20
+ #
21
+ # Gradle start up script for POSIX generated by Gradle.
22
+ #
23
+ # Important for running:
24
+ #
25
+ # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
26
+ # noncompliant, but you have some other compliant shell such as ksh or
27
+ # bash, then to run this script, type that shell name before the whole
28
+ # command line, like:
29
+ #
30
+ # ksh Gradle
31
+ #
32
+ # Busybox and similar reduced shells will NOT work, because this script
33
+ # requires all of these POSIX shell features:
34
+ # * functions;
35
+ # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36
+ # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37
+ # * compound commands having a testable exit status, especially «case»;
38
+ # * various built-in commands including «command», «set», and «ulimit».
39
+ #
40
+ # Important for patching:
41
+ #
42
+ # (2) This script targets any POSIX shell, so it avoids extensions provided
43
+ # by Bash, Ksh, etc; in particular arrays are avoided.
44
+ #
45
+ # The "traditional" practice of packing multiple parameters into a
46
+ # space-separated string is a well documented source of bugs and security
47
+ # problems, so this is (mostly) avoided, by progressively accumulating
48
+ # options in "$@", and eventually passing that to Java.
49
+ #
50
+ # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
51
+ # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
52
+ # see the in-line comments for details.
53
+ #
54
+ # There are tweaks for specific operating systems such as AIX, CygWin,
55
+ # Darwin, MinGW, and NonStop.
56
+ #
57
+ # (3) This script is generated from the Groovy template
58
+ # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59
+ # within the Gradle project.
60
+ #
61
+ # You can find Gradle at https://github.com/gradle/gradle/.
62
+ #
63
+ ##############################################################################
64
+
65
+ # Attempt to set APP_HOME
66
+
67
+ # Resolve links: $0 may be a link
68
+ app_path=$0
69
+
70
+ # Need this for daisy-chained symlinks.
71
+ while
72
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
73
+ [ -h "$app_path" ]
74
+ do
75
+ ls=$( ls -ld "$app_path" )
76
+ link=${ls#*' -> '}
77
+ case $link in #(
78
+ /*) app_path=$link ;; #(
79
+ *) app_path=$APP_HOME$link ;;
80
+ esac
81
+ done
82
+
83
+ APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
84
+
85
+ APP_NAME="Gradle"
86
+ APP_BASE_NAME=${0##*/}
87
+
88
+ # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89
+ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
90
+
91
+ # Use the maximum available, or set MAX_FD != -1 to use that value.
92
+ MAX_FD=maximum
93
+
94
+ warn () {
95
+ echo "$*"
96
+ } >&2
97
+
98
+ die () {
99
+ echo
100
+ echo "$*"
101
+ echo
102
+ exit 1
103
+ } >&2
104
+
105
+ # OS specific support (must be 'true' or 'false').
106
+ cygwin=false
107
+ msys=false
108
+ darwin=false
109
+ nonstop=false
110
+ case "$( uname )" in #(
111
+ CYGWIN* ) cygwin=true ;; #(
112
+ Darwin* ) darwin=true ;; #(
113
+ MSYS* | MINGW* ) msys=true ;; #(
114
+ NONSTOP* ) nonstop=true ;;
115
+ esac
116
+
117
+ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
118
+
119
+
120
+ # Determine the Java command to use to start the JVM.
121
+ if [ -n "$JAVA_HOME" ] ; then
122
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
123
+ # IBM's JDK on AIX uses strange locations for the executables
124
+ JAVACMD=$JAVA_HOME/jre/sh/java
125
+ else
126
+ JAVACMD=$JAVA_HOME/bin/java
127
+ fi
128
+ if [ ! -x "$JAVACMD" ] ; then
129
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
130
+
131
+ Please set the JAVA_HOME variable in your environment to match the
132
+ location of your Java installation."
133
+ fi
134
+ else
135
+ JAVACMD=java
136
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137
+
138
+ Please set the JAVA_HOME variable in your environment to match the
139
+ location of your Java installation."
140
+ fi
141
+
142
+ # Increase the maximum file descriptors if we can.
143
+ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144
+ case $MAX_FD in #(
145
+ max*)
146
+ MAX_FD=$( ulimit -H -n ) ||
147
+ warn "Could not query maximum file descriptor limit"
148
+ esac
149
+ case $MAX_FD in #(
150
+ '' | soft) :;; #(
151
+ *)
152
+ ulimit -n "$MAX_FD" ||
153
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
154
+ esac
155
+ fi
156
+
157
+ # Collect all arguments for the java command, stacking in reverse order:
158
+ # * args from the command line
159
+ # * the main class name
160
+ # * -classpath
161
+ # * -D...appname settings
162
+ # * --module-path (only if needed)
163
+ # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
164
+
165
+ # For Cygwin or MSYS, switch paths to Windows format before running java
166
+ if "$cygwin" || "$msys" ; then
167
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
168
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
169
+
170
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
171
+
172
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
173
+ for arg do
174
+ if
175
+ case $arg in #(
176
+ -*) false ;; # don't mess with options #(
177
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
178
+ [ -e "$t" ] ;; #(
179
+ *) false ;;
180
+ esac
181
+ then
182
+ arg=$( cygpath --path --ignore --mixed "$arg" )
183
+ fi
184
+ # Roll the args list around exactly as many times as the number of
185
+ # args, so each arg winds up back in the position where it started, but
186
+ # possibly modified.
187
+ #
188
+ # NB: a `for` loop captures its iteration list before it begins, so
189
+ # changing the positional parameters here affects neither the number of
190
+ # iterations, nor the values presented in `arg`.
191
+ shift # remove old arg
192
+ set -- "$@" "$arg" # push replacement arg
193
+ done
194
+ fi
195
+
196
+ # Collect all arguments for the java command;
197
+ # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
198
+ # shell script including quotes and variable substitutions, so put them in
199
+ # double quotes to make sure that they get re-expanded; and
200
+ # * put everything else in single quotes, so that it's not re-expanded.
201
+
202
+ set -- \
203
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
204
+ -classpath "$CLASSPATH" \
205
+ org.gradle.wrapper.GradleWrapperMain \
206
+ "$@"
207
+
208
+ # Use "xargs" to parse quoted args.
209
+ #
210
+ # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
211
+ #
212
+ # In Bash we could simply go:
213
+ #
214
+ # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
215
+ # set -- "${ARGS[@]}" "$@"
216
+ #
217
+ # but POSIX shell has neither arrays nor command substitution, so instead we
218
+ # post-process each arg (as a line of input to sed) to backslash-escape any
219
+ # character that might be a shell metacharacter, then use eval to reverse
220
+ # that process (while maintaining the separation between arguments), and wrap
221
+ # the whole thing up as a single "set" statement.
222
+ #
223
+ # This will of course break if any of these variables contains a newline or
224
+ # an unmatched quote.
225
+ #
226
+
227
+ eval "set -- $(
228
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
229
+ xargs -n1 |
230
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
231
+ tr '\n' ' '
232
+ )" '"$@"'
233
+
234
+ exec "$JAVACMD" "$@"
@@ -0,0 +1,89 @@
1
+ @rem
2
+ @rem Copyright 2015 the original author or authors.
3
+ @rem
4
+ @rem Licensed under the Apache License, Version 2.0 (the "License");
5
+ @rem you may not use this file except in compliance with the License.
6
+ @rem You may obtain a copy of the License at
7
+ @rem
8
+ @rem https://www.apache.org/licenses/LICENSE-2.0
9
+ @rem
10
+ @rem Unless required by applicable law or agreed to in writing, software
11
+ @rem distributed under the License is distributed on an "AS IS" BASIS,
12
+ @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ @rem See the License for the specific language governing permissions and
14
+ @rem limitations under the License.
15
+ @rem
16
+
17
+ @if "%DEBUG%" == "" @echo off
18
+ @rem ##########################################################################
19
+ @rem
20
+ @rem Gradle startup script for Windows
21
+ @rem
22
+ @rem ##########################################################################
23
+
24
+ @rem Set local scope for the variables with windows NT shell
25
+ if "%OS%"=="Windows_NT" setlocal
26
+
27
+ set DIRNAME=%~dp0
28
+ if "%DIRNAME%" == "" set DIRNAME=.
29
+ set APP_BASE_NAME=%~n0
30
+ set APP_HOME=%DIRNAME%
31
+
32
+ @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33
+ for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34
+
35
+ @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36
+ set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37
+
38
+ @rem Find java.exe
39
+ if defined JAVA_HOME goto findJavaFromJavaHome
40
+
41
+ set JAVA_EXE=java.exe
42
+ %JAVA_EXE% -version >NUL 2>&1
43
+ if "%ERRORLEVEL%" == "0" goto execute
44
+
45
+ echo.
46
+ echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47
+ echo.
48
+ echo Please set the JAVA_HOME variable in your environment to match the
49
+ echo location of your Java installation.
50
+
51
+ goto fail
52
+
53
+ :findJavaFromJavaHome
54
+ set JAVA_HOME=%JAVA_HOME:"=%
55
+ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56
+
57
+ if exist "%JAVA_EXE%" goto execute
58
+
59
+ echo.
60
+ echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61
+ echo.
62
+ echo Please set the JAVA_HOME variable in your environment to match the
63
+ echo location of your Java installation.
64
+
65
+ goto fail
66
+
67
+ :execute
68
+ @rem Setup the command line
69
+
70
+ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71
+
72
+
73
+ @rem Execute Gradle
74
+ "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75
+
76
+ :end
77
+ @rem End local scope for the variables with windows NT shell
78
+ if "%ERRORLEVEL%"=="0" goto mainEnd
79
+
80
+ :fail
81
+ rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82
+ rem the _cmd.exe /c_ return code!
83
+ if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84
+ exit /b 1
85
+
86
+ :mainEnd
87
+ if "%OS%"=="Windows_NT" endlocal
88
+
89
+ :omega
@@ -0,0 +1,8 @@
1
+ ## This file must *NOT* be checked into Version Control Systems,
2
+ # as it contains information specific to your local configuration.
3
+ #
4
+ # Location of the SDK. This is only used by Gradle.
5
+ # For customization when using a Version Control System, please read the
6
+ # header note.
7
+ #Tue Nov 01 11:51:46 EDT 2022
8
+ sdk.dir=/Users/michaelmurray/Library/Android/sdk
@@ -5,9 +5,9 @@ import android.os.Looper
5
5
  import androidx.fragment.app.FragmentActivity
6
6
  import com.facebook.react.bridge.*
7
7
  import com.facebook.react.modules.core.DeviceEventManagerModule
8
+ import io.rownd.android.*
8
9
  import io.rownd.android.Rownd
9
10
  import io.rownd.android.models.repos.GlobalState
10
- import io.rownd.android.models.repos.UserRepo
11
11
  import kotlinx.coroutines.*
12
12
  import kotlinx.serialization.json.Json
13
13
 
@@ -51,14 +51,37 @@ class RowndPluginModule(reactContext: ReactApplicationContext) : ReactContextBas
51
51
  }
52
52
 
53
53
  @ReactMethod
54
- fun configure(appKey: String) {
55
- Rownd.configure(reactApplicationContext.currentActivity as FragmentActivity, appKey)
56
- isRowndJSInitialized = true
54
+ fun configure(config: ReadableMap) {
55
+ val appKey = config.getString("appKey")
56
+ if (appKey != null) {
57
+ Rownd.configure(reactApplicationContext.currentActivity as FragmentActivity, appKey)
58
+ isRowndJSInitialized = true
59
+ }
57
60
  }
58
61
 
59
62
  @ReactMethod
60
- fun requestSignIn() {
61
- Rownd.requestSignIn()
63
+ fun requestSignIn(signInConfig: ReadableMap) {
64
+ fun requestSignInHub() {
65
+ val postSignInRedirect = signInConfig.getString("postSignInRedirect")
66
+ if (postSignInRedirect != null) {
67
+ Rownd.requestSignIn(RowndSignInOptions(postSignInRedirect))
68
+ } else {
69
+ Rownd.requestSignIn()
70
+ }
71
+ }
72
+
73
+ val method = signInConfig.getString("method")
74
+ if (method != null) {
75
+ when (method) {
76
+ "google" -> Rownd.requestSignIn(RowndSignInHint.Google)
77
+ "apple" -> println("ROWND: Apple sign in is not setup yet")
78
+ else -> {
79
+ requestSignInHub()
80
+ }
81
+ }
82
+ } else {
83
+ requestSignInHub()
84
+ }
62
85
  }
63
86
 
64
87
  @ReactMethod
@@ -73,26 +96,27 @@ class RowndPluginModule(reactContext: ReactApplicationContext) : ReactContextBas
73
96
 
74
97
  @ReactMethod
75
98
  fun setUserData(data: ReadableMap) {
76
- UserRepo.set(data.toHashMap())
99
+ Rownd.userRepo.set(data.toHashMap())
77
100
  }
78
101
 
79
102
  @ReactMethod
80
103
  fun setUserDataValue(key: String, array: ReadableMap) {
81
104
  val value = array.toHashMap().entries.find { it.key == "value" }?.value
82
105
  if (value != null) {
83
- UserRepo.set(key, value)
106
+ Rownd.userRepo.set(key, value)
84
107
  } else {
85
108
  println("ROWND ANDROID PLUGIN: Missing content for value")
86
109
  }
87
110
  }
88
111
 
89
- // @ReactMethod
90
- // suspend fun getAccessToken(promise: Promise) {
91
- // try {
92
- // val accessToken = Rownd.getAccessToken()
93
- // promise.resolve(accessToken ?: "")
94
- // } catch (e: Throwable) {
95
- // promise.reject("GET_ACCESS_TOKEN_ERROR: ", e)
96
- // }
97
- // }
112
+ @ReactMethod
113
+ fun getAccessToken(promise: Promise) {
114
+ coroutineScope = CoroutineScope(Dispatchers.IO).launch {
115
+ try {
116
+ promise.resolve(Rownd.getAccessToken() ?: "")
117
+ } catch (e: Throwable) {
118
+ promise.reject("ROWND PLUGIN MODULE ERROR: ")
119
+ }
120
+ }
121
+ }
98
122
  }
package/ios/RowndPlugin.m CHANGED
@@ -6,11 +6,11 @@
6
6
  RCT_EXTERN_METHOD(setUserDataValue:(NSString *)key withValue:(id)value)
7
7
  RCT_EXTERN_METHOD(setUserData:(NSDictionary<NSString *, id>)data)
8
8
 
9
- RCT_EXTERN_METHOD(configure:(NSString *)appKey
9
+ RCT_EXTERN_METHOD(configure:(NSDictionary *)config
10
10
  withResolver:(RCTPromiseResolveBlock)resolve
11
11
  withRejecter:(RCTPromiseRejectBlock)reject)
12
12
 
13
- RCT_EXTERN_METHOD(requestSignIn)
13
+ RCT_EXTERN_METHOD(requestSignIn:(NSDictionary *)signInConfig)
14
14
 
15
15
  RCT_EXTERN_METHOD(requestSignInApple)
16
16
 
@@ -23,31 +23,44 @@ class RowndPlugin: NSObject {
23
23
  }
24
24
 
25
25
  @objc(configure:withResolver:withRejecter:)
26
- func configure(appKey: String, resolve:RCTPromiseResolveBlock,reject:RCTPromiseRejectBlock) -> Void {
27
- Task.init {
28
- await Rownd.configure(launchOptions: nil, appKey: appKey)
26
+ func configure(config: NSDictionary, resolve:RCTPromiseResolveBlock,reject:RCTPromiseRejectBlock) -> Void {
27
+ if let appKey = config.value(forKey: "appKey") as? String {
28
+ Task {
29
+ await Rownd.configure(launchOptions: nil, appKey: appKey);
30
+ }
31
+ resolve(appKey)
29
32
  }
30
- resolve(appKey)
31
33
  }
32
34
 
33
- @objc
34
- func requestSignIn() -> Void {
35
- DispatchQueue.main.async {
36
- Rownd.requestSignIn()
37
- }
38
- }
39
-
40
- @objc
41
- func requestSignInApple() -> Void {
42
- DispatchQueue.main.async {
43
- Rownd.requestSignIn(with: RowndSignInHint.appleId)
35
+ @objc(requestSignIn:)
36
+ func requestSignIn(signInConfig: NSDictionary) -> Void {
37
+
38
+ func requestSignInHub() -> Void {
39
+ if let postSignInRedirect = signInConfig.value(forKey: "postSignInRedirect") as? String {
40
+ DispatchQueue.main.async {
41
+ Rownd.requestSignIn(RowndSignInOptions(postSignInRedirect: postSignInRedirect))
42
+ }
43
+ } else {
44
+ DispatchQueue.main.async {
45
+ Rownd.requestSignIn()
46
+ }
47
+ }
44
48
  }
45
- }
46
-
47
- @objc
48
- func requestSignInGoogle() -> Void {
49
- DispatchQueue.main.async {
50
- Rownd.requestSignIn(with: RowndSignInHint.googleId)
49
+ if let method = signInConfig.value(forKey: "method") as? String {
50
+ switch method {
51
+ case "apple":
52
+ DispatchQueue.main.async {
53
+ Rownd.requestSignIn(with: RowndSignInHint.appleId)
54
+ }
55
+ case "google":
56
+ DispatchQueue.main.async {
57
+ Rownd.requestSignIn(with: RowndSignInHint.googleId)
58
+ }
59
+ default:
60
+ requestSignInHub()
61
+ }
62
+ } else {
63
+ requestSignInHub()
51
64
  }
52
65
  }
53
66
 
@@ -39,7 +39,9 @@ const RowndProvider = _ref => {
39
39
  dispatch
40
40
  };
41
41
  (0, _react.useEffect)(() => {
42
- NativeRowndModules.configure(config.appKey);
42
+ NativeRowndModules.configure({
43
+ appKey: config.appKey
44
+ });
43
45
  }, [config.appKey]);
44
46
  (0, _react.useEffect)(() => {
45
47
  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(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;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AC,aAAD,CAAe,QAAf;IAAwB,KAAK,EAAEtB;EAA/B,GAAuCP,QAAvC,CADF;AAGD,CAnDD;;;;AAqDA,SAAS+B,eAAT,GAA2B;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","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;E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BAAA,EAAWzC,aAAX,CAAhB;;EAEA,IAAIwC,OAAO,KAAKtC,SAAhB,EAA2B;IACzB,MAAM,IAAIwC,KAAJ,CACJ,+DADI,CAAN;EAGD;;EAED,OAAOF,OAAP;AACD"}
@@ -1 +1 @@
1
- {"version":3,"names":["useRownd","state","useRowndContext","requestSignIn","signOut","manageAccount","getAccessToken","user","data","setValue","setUserDataValue","set","setUserData","is_authenticated","auth","access_token","is_initializing","app_id"],"sources":["rownd.ts"],"sourcesContent":["import {\n requestSignIn,\n signOut,\n manageAccount,\n getAccessToken,\n setUserDataValue,\n setUserData,\n} from '../utils/nativeModule';\nimport { useRowndContext } from '../components/GlobalContext';\n\nexport type TRowndContext = {\n requestSignIn: (opts?: RequestSignInOpts) => void;\n signOut: () => void;\n manageAccount: () => void;\n getAccessToken: () => Promise<string>;\n user: UserContext;\n is_authenticated: boolean;\n is_initializing: boolean;\n access_token: string | null;\n auth: AuthContext;\n};\n\ntype UserContext = {\n data: {\n id?: string;\n email?: string | null;\n phone?: string | null;\n [key: string]: any;\n };\n set: (data: Record<string, any>) => void;\n setValue: (key: string, value: any) => void;\n //set: (data: any) => void;\n};\n\ntype AuthContext = {\n access_token: string | null;\n app_id: string | null;\n is_verified_user?: boolean;\n};\n\nexport type RequestSignInOpts = {\n type?: 'google' | 'apple';\n};\n\nexport function useRownd(): TRowndContext {\n const { state } = useRowndContext();\n\n return {\n requestSignIn,\n signOut,\n manageAccount,\n getAccessToken,\n user: {\n data: state.user.data,\n setValue: setUserDataValue,\n set: setUserData,\n },\n is_authenticated: !!state.auth.access_token,\n is_initializing: !!state.auth.app_id,\n auth: state.auth,\n access_token: state.auth.access_token,\n };\n}\n"],"mappings":";;;;;;;AAAA;;AAQA;;AAoCO,SAASA,QAAT,GAAmC;EACxC,MAAM;IAAEC;EAAF,IAAY,IAAAC,8BAAA,GAAlB;EAEA,OAAO;IACLC,aAAa,EAAbA,2BADK;IAELC,OAAO,EAAPA,qBAFK;IAGLC,aAAa,EAAbA,2BAHK;IAILC,cAAc,EAAdA,4BAJK;IAKLC,IAAI,EAAE;MACJC,IAAI,EAAEP,KAAK,CAACM,IAAN,CAAWC,IADb;MAEJC,QAAQ,EAAEC,8BAFN;MAGJC,GAAG,EAAEC;IAHD,CALD;IAULC,gBAAgB,EAAE,CAAC,CAACZ,KAAK,CAACa,IAAN,CAAWC,YAV1B;IAWLC,eAAe,EAAE,CAAC,CAACf,KAAK,CAACa,IAAN,CAAWG,MAXzB;IAYLH,IAAI,EAAEb,KAAK,CAACa,IAZP;IAaLC,YAAY,EAAEd,KAAK,CAACa,IAAN,CAAWC;EAbpB,CAAP;AAeD"}
1
+ {"version":3,"names":["useRownd","state","useRowndContext","requestSignIn","signOut","manageAccount","getAccessToken","user","data","setValue","setUserDataValue","set","setUserData","is_authenticated","auth","access_token","is_initializing","app_id"],"sources":["rownd.ts"],"sourcesContent":["import {\n requestSignIn,\n signOut,\n manageAccount,\n getAccessToken,\n setUserDataValue,\n setUserData,\n} from '../utils/nativeModule';\nimport { useRowndContext } from '../components/GlobalContext';\n\nexport type TRowndContext = {\n requestSignIn: (e?: RequestSignIn) => void;\n signOut: () => void;\n manageAccount: () => void;\n getAccessToken: () => Promise<string>;\n user: UserContext;\n is_authenticated: boolean;\n is_initializing: boolean;\n access_token: string | null;\n auth: AuthContext;\n};\n\ntype UserContext = {\n data: {\n id?: string;\n email?: string | null;\n phone?: string | null;\n [key: string]: any;\n };\n set: (data: Record<string, any>) => void;\n setValue: (key: string, value: any) => void;\n //set: (data: any) => void;\n};\n\ntype AuthContext = {\n access_token: string | null;\n app_id: string | null;\n is_verified_user?: boolean;\n};\n\nexport type RequestSignInMethods = 'google' | 'apple' | 'default';\nexport type RequestSignIn = {method?: RequestSignInMethods, postSignInRedirect?: string}\n\nexport function useRownd(): TRowndContext {\n const { state } = useRowndContext();\n\n return {\n requestSignIn,\n signOut,\n manageAccount,\n getAccessToken,\n user: {\n data: state.user.data,\n setValue: setUserDataValue,\n set: setUserData,\n },\n is_authenticated: !!state.auth.access_token,\n is_initializing: !!state.auth.app_id,\n auth: state.auth,\n access_token: state.auth.access_token,\n };\n}\n"],"mappings":";;;;;;;AAAA;;AAQA;;AAmCO,SAASA,QAAT,GAAmC;EACxC,MAAM;IAAEC;EAAF,IAAY,IAAAC,8BAAA,GAAlB;EAEA,OAAO;IACLC,aAAa,EAAbA,2BADK;IAELC,OAAO,EAAPA,qBAFK;IAGLC,aAAa,EAAbA,2BAHK;IAILC,cAAc,EAAdA,4BAJK;IAKLC,IAAI,EAAE;MACJC,IAAI,EAAEP,KAAK,CAACM,IAAN,CAAWC,IADb;MAEJC,QAAQ,EAAEC,8BAFN;MAGJC,GAAG,EAAEC;IAHD,CALD;IAULC,gBAAgB,EAAE,CAAC,CAACZ,KAAK,CAACa,IAAN,CAAWC,YAV1B;IAWLC,eAAe,EAAE,CAAC,CAACf,KAAK,CAACa,IAAN,CAAWG,MAXzB;IAYLH,IAAI,EAAEb,KAAK,CAACa,IAZP;IAaLC,YAAY,EAAEd,KAAK,CAACa,IAAN,CAAWC;EAbpB,CAAP;AAeD"}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["config.ts"],"sourcesContent":["export interface IConfig {\n appKey: string;\n}\n\nexport type PostAuthApiSpec = {\n method: 'post' | 'put';\n url: string;\n extra_headers: { [key: string]: string };\n};\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["config.ts"],"sourcesContent":["export interface IConfig {\n appKey: string;\n}\n"],"mappings":""}
@@ -35,19 +35,21 @@ const IOSRowndEventEmitter = _reactNative.Platform.OS !== 'ios' ? null : _reactN
35
35
  });
36
36
  exports.IOSRowndEventEmitter = IOSRowndEventEmitter;
37
37
 
38
- const isNotAvailableInAndroidYet = () => {
39
- console.log('ROWND: NOT AVAILABLE IN ANDROID YET');
40
- return true;
41
- };
42
-
43
- function configure(appKey) {
44
- return Rownd.configure(appKey);
38
+ function configure(config) {
39
+ return Rownd.configure(config);
45
40
  }
46
41
 
47
- function requestSignIn(method) {
48
- if ((method === null || method === void 0 ? void 0 : method.type) === 'apple') return Rownd.requestSignInApple();
49
- if ((method === null || method === void 0 ? void 0 : method.type) === 'google') return Rownd.requestSignInGoogle();
50
- return Rownd.requestSignIn();
42
+ function requestSignIn(config) {
43
+ if (!config) {
44
+ Rownd.requestSignIn({
45
+ method: "default"
46
+ });
47
+ }
48
+
49
+ return Rownd.requestSignIn({
50
+ method: (config === null || config === void 0 ? void 0 : config.method) || "default",
51
+ postSignInRedirect: (config === null || config === void 0 ? void 0 : config.postSignInRedirect) || undefined
52
+ });
51
53
  }
52
54
 
53
55
  function signOut() {
@@ -59,7 +61,6 @@ function manageAccount() {
59
61
  }
60
62
 
61
63
  function getAccessToken() {
62
- if (isNotAvailableInAndroidYet()) return Promise.resolve('');
63
64
  return Rownd.getAccessToken();
64
65
  }
65
66
 
@@ -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","appKey","requestSignIn","method","type","requestSignInApple","requestSignInGoogle","signOut","manageAccount","getAccessToken","Promise","resolve","setUserDataValue","key","value","setUserData","data","handleSignInLink","url"],"sources":["nativeModule.ts"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\nimport type { RequestSignInOpts } from 'src/hooks/rownd';\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(appKey: string): Promise<string> {\n return Rownd.configure(appKey);\n}\n\nexport function requestSignIn(method?: RequestSignInOpts) {\n if (method?.type === 'apple') return Rownd.requestSignInApple();\n if (method?.type === 'google') return Rownd.requestSignInGoogle();\n return Rownd.requestSignIn();\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;;AAGO,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;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,SAASC,gBAAT,CAA0BC,GAA1B,EAAuC;EAC5C,OAAO9B,KAAK,CAAC6B,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","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,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;;;AAeA,SAASc,SAAT,CAAmBC,MAAnB,EAAqD;EAC1D,OAAOV,KAAK,CAACS,SAAN,CAAgBC,MAAhB,CAAP;AACD;;AAEM,SAASC,aAAT,CAAuBD,MAAvB,EAA+C;EACpD,IAAI,CAACA,MAAL,EAAa;IACXV,KAAK,CAACW,aAAN,CAAoB;MAACC,MAAM,EAAE;IAAT,CAApB;EACD;;EACD,OAAOZ,KAAK,CAACW,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,OAAOf,KAAK,CAACe,OAAN,EAAP;AACD;;AAEM,SAASC,aAAT,GAAyB;EAC9B,OAAOhB,KAAK,CAACgB,aAAN,EAAP;AACD;;AAEM,SAASC,cAAT,GAA2C;EAChD,OAAOjB,KAAK,CAACiB,cAAN,EAAP;AACD;;AAEM,SAASC,gBAAT,CAA0BC,GAA1B,EAAuCC,KAAvC,EAAmD;EACxD,OAAOpB,KAAK,CAACkB,gBAAN,CACLC,GADK,EAELvB,qBAAA,CAASW,EAAT,KAAgB,SAAhB,GAA4B;IAAEa;EAAF,CAA5B,GAAwCA,KAFnC,CAAP;AAID;;AAEM,SAASC,WAAT,CAAqBC,IAArB,EAAgD;EACrD,OAAOtB,KAAK,CAACqB,WAAN,CAAkBC,IAAlB,CAAP;AACD;;AAEM,SAASC,gBAAT,CAA0BC,GAA1B,EAAuC;EAC5C,OAAOxB,KAAK,CAACuB,gBAAN,CAAuBC,GAAvB,CAAP;AACD"}
@@ -20,7 +20,9 @@ const RowndProvider = _ref => {
20
20
  dispatch
21
21
  };
22
22
  useEffect(() => {
23
- NativeRowndModules.configure(config.appKey);
23
+ NativeRowndModules.configure({
24
+ appKey: config.appKey
25
+ });
24
26
  }, [config.appKey]);
25
27
  useEffect(() => {
26
28
  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(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":"AAA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AAY,GAAGjB,YAAY,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","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,CAA6B;MAACC,MAAM,EAAEL,MAAM,CAACK;IAAhB,CAA7B;EACD,CAFQ,EAEN,CAACL,MAAM,CAACK,MAAR,CAFM,CAAT;EAIAvB,SAAS,CAAC,MAAM;IACd,MAAMwB,gBAAgB,GAAIC,KAAD,IAAgB;MACvCL,QAAQ,CAAC;QACPM,IAAI,EAAEf,UAAU,CAACgB,YADV;QAEPC,OAAO,EAAExB,QAAQ,CAACyB,EAAT,KAAgB,SAAhB,GAA4BC,IAAI,CAACC,KAAL,CAAWN,KAAK,CAACN,KAAjB,CAA5B,GAAsDM;MAFxD,CAAD,CAAR;IAID,CALD;;IAMA,MAAMO,YAAY,GAAGjB,YAAY,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 +1 @@
1
- {"version":3,"names":["requestSignIn","signOut","manageAccount","getAccessToken","setUserDataValue","setUserData","useRowndContext","useRownd","state","user","data","setValue","set","is_authenticated","auth","access_token","is_initializing","app_id"],"sources":["rownd.ts"],"sourcesContent":["import {\n requestSignIn,\n signOut,\n manageAccount,\n getAccessToken,\n setUserDataValue,\n setUserData,\n} from '../utils/nativeModule';\nimport { useRowndContext } from '../components/GlobalContext';\n\nexport type TRowndContext = {\n requestSignIn: (opts?: RequestSignInOpts) => void;\n signOut: () => void;\n manageAccount: () => void;\n getAccessToken: () => Promise<string>;\n user: UserContext;\n is_authenticated: boolean;\n is_initializing: boolean;\n access_token: string | null;\n auth: AuthContext;\n};\n\ntype UserContext = {\n data: {\n id?: string;\n email?: string | null;\n phone?: string | null;\n [key: string]: any;\n };\n set: (data: Record<string, any>) => void;\n setValue: (key: string, value: any) => void;\n //set: (data: any) => void;\n};\n\ntype AuthContext = {\n access_token: string | null;\n app_id: string | null;\n is_verified_user?: boolean;\n};\n\nexport type RequestSignInOpts = {\n type?: 'google' | 'apple';\n};\n\nexport function useRownd(): TRowndContext {\n const { state } = useRowndContext();\n\n return {\n requestSignIn,\n signOut,\n manageAccount,\n getAccessToken,\n user: {\n data: state.user.data,\n setValue: setUserDataValue,\n set: setUserData,\n },\n is_authenticated: !!state.auth.access_token,\n is_initializing: !!state.auth.app_id,\n auth: state.auth,\n access_token: state.auth.access_token,\n };\n}\n"],"mappings":"AAAA,SACEA,aADF,EAEEC,OAFF,EAGEC,aAHF,EAIEC,cAJF,EAKEC,gBALF,EAMEC,WANF,QAOO,uBAPP;AAQA,SAASC,eAAT,QAAgC,6BAAhC;AAoCA,OAAO,SAASC,QAAT,GAAmC;EACxC,MAAM;IAAEC;EAAF,IAAYF,eAAe,EAAjC;EAEA,OAAO;IACLN,aADK;IAELC,OAFK;IAGLC,aAHK;IAILC,cAJK;IAKLM,IAAI,EAAE;MACJC,IAAI,EAAEF,KAAK,CAACC,IAAN,CAAWC,IADb;MAEJC,QAAQ,EAAEP,gBAFN;MAGJQ,GAAG,EAAEP;IAHD,CALD;IAULQ,gBAAgB,EAAE,CAAC,CAACL,KAAK,CAACM,IAAN,CAAWC,YAV1B;IAWLC,eAAe,EAAE,CAAC,CAACR,KAAK,CAACM,IAAN,CAAWG,MAXzB;IAYLH,IAAI,EAAEN,KAAK,CAACM,IAZP;IAaLC,YAAY,EAAEP,KAAK,CAACM,IAAN,CAAWC;EAbpB,CAAP;AAeD"}
1
+ {"version":3,"names":["requestSignIn","signOut","manageAccount","getAccessToken","setUserDataValue","setUserData","useRowndContext","useRownd","state","user","data","setValue","set","is_authenticated","auth","access_token","is_initializing","app_id"],"sources":["rownd.ts"],"sourcesContent":["import {\n requestSignIn,\n signOut,\n manageAccount,\n getAccessToken,\n setUserDataValue,\n setUserData,\n} from '../utils/nativeModule';\nimport { useRowndContext } from '../components/GlobalContext';\n\nexport type TRowndContext = {\n requestSignIn: (e?: RequestSignIn) => void;\n signOut: () => void;\n manageAccount: () => void;\n getAccessToken: () => Promise<string>;\n user: UserContext;\n is_authenticated: boolean;\n is_initializing: boolean;\n access_token: string | null;\n auth: AuthContext;\n};\n\ntype UserContext = {\n data: {\n id?: string;\n email?: string | null;\n phone?: string | null;\n [key: string]: any;\n };\n set: (data: Record<string, any>) => void;\n setValue: (key: string, value: any) => void;\n //set: (data: any) => void;\n};\n\ntype AuthContext = {\n access_token: string | null;\n app_id: string | null;\n is_verified_user?: boolean;\n};\n\nexport type RequestSignInMethods = 'google' | 'apple' | 'default';\nexport type RequestSignIn = {method?: RequestSignInMethods, postSignInRedirect?: string}\n\nexport function useRownd(): TRowndContext {\n const { state } = useRowndContext();\n\n return {\n requestSignIn,\n signOut,\n manageAccount,\n getAccessToken,\n user: {\n data: state.user.data,\n setValue: setUserDataValue,\n set: setUserData,\n },\n is_authenticated: !!state.auth.access_token,\n is_initializing: !!state.auth.app_id,\n auth: state.auth,\n access_token: state.auth.access_token,\n };\n}\n"],"mappings":"AAAA,SACEA,aADF,EAEEC,OAFF,EAGEC,aAHF,EAIEC,cAJF,EAKEC,gBALF,EAMEC,WANF,QAOO,uBAPP;AAQA,SAASC,eAAT,QAAgC,6BAAhC;AAmCA,OAAO,SAASC,QAAT,GAAmC;EACxC,MAAM;IAAEC;EAAF,IAAYF,eAAe,EAAjC;EAEA,OAAO;IACLN,aADK;IAELC,OAFK;IAGLC,aAHK;IAILC,cAJK;IAKLM,IAAI,EAAE;MACJC,IAAI,EAAEF,KAAK,CAACC,IAAN,CAAWC,IADb;MAEJC,QAAQ,EAAEP,gBAFN;MAGJQ,GAAG,EAAEP;IAHD,CALD;IAULQ,gBAAgB,EAAE,CAAC,CAACL,KAAK,CAACM,IAAN,CAAWC,YAV1B;IAWLC,eAAe,EAAE,CAAC,CAACR,KAAK,CAACM,IAAN,CAAWG,MAXzB;IAYLH,IAAI,EAAEN,KAAK,CAACM,IAZP;IAaLC,YAAY,EAAEP,KAAK,CAACM,IAAN,CAAWC;EAbpB,CAAP;AAeD"}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["config.ts"],"sourcesContent":["export interface IConfig {\n appKey: string;\n}\n\nexport type PostAuthApiSpec = {\n method: 'post' | 'put';\n url: string;\n extra_headers: { [key: string]: string };\n};\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["config.ts"],"sourcesContent":["export interface IConfig {\n appKey: string;\n}\n"],"mappings":""}
@@ -15,19 +15,20 @@ export const IOSRowndEventEmitter = Platform.OS !== 'ios' ? null : NativeModules
15
15
  }
16
16
 
17
17
  });
18
+ export function configure(config) {
19
+ return Rownd.configure(config);
20
+ }
21
+ export function requestSignIn(config) {
22
+ if (!config) {
23
+ Rownd.requestSignIn({
24
+ method: "default"
25
+ });
26
+ }
18
27
 
19
- const isNotAvailableInAndroidYet = () => {
20
- console.log('ROWND: NOT AVAILABLE IN ANDROID YET');
21
- return true;
22
- };
23
-
24
- export function configure(appKey) {
25
- return Rownd.configure(appKey);
26
- }
27
- export function requestSignIn(method) {
28
- if ((method === null || method === void 0 ? void 0 : method.type) === 'apple') return Rownd.requestSignInApple();
29
- if ((method === null || method === void 0 ? void 0 : method.type) === 'google') return Rownd.requestSignInGoogle();
30
- return Rownd.requestSignIn();
28
+ return Rownd.requestSignIn({
29
+ method: (config === null || config === void 0 ? void 0 : config.method) || "default",
30
+ postSignInRedirect: (config === null || config === void 0 ? void 0 : config.postSignInRedirect) || undefined
31
+ });
31
32
  }
32
33
  export function signOut() {
33
34
  return Rownd.signOut();
@@ -36,7 +37,6 @@ export function manageAccount() {
36
37
  return Rownd.manageAccount();
37
38
  }
38
39
  export function getAccessToken() {
39
- if (isNotAvailableInAndroidYet()) return Promise.resolve('');
40
40
  return Rownd.getAccessToken();
41
41
  }
42
42
  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","appKey","requestSignIn","method","type","requestSignInApple","requestSignInGoogle","signOut","manageAccount","getAccessToken","Promise","resolve","setUserDataValue","key","value","setUserData","data","handleSignInLink","url"],"sources":["nativeModule.ts"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\nimport type { RequestSignInOpts } from 'src/hooks/rownd';\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(appKey: string): Promise<string> {\n return Rownd.configure(appKey);\n}\n\nexport function requestSignIn(method?: RequestSignInOpts) {\n if (method?.type === 'apple') return Rownd.requestSignInApple();\n if (method?.type === 'google') return Rownd.requestSignInGoogle();\n return Rownd.requestSignIn();\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;AAGA,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,MAAMY,0BAA0B,GAAG,MAAM;EACvCC,OAAO,CAACC,GAAR,CAAY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
+ {"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":"A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N,EAAP;AACD;AAED,OAAO,SAASC,aAAT,GAAyB;EAC9B,OAAOf,KAAK,CAACe,aAAN,EAAP;AACD;AAED,OAAO,SAASC,cAAT,GAA2C;EAChD,OAAOhB,KAAK,CAACgB,cAAN,EAAP;AACD;AAED,OAAO,SAASC,gBAAT,CAA0BC,GAA1B,EAAuCC,KAAvC,EAAmD;EACxD,OAAOnB,KAAK,CAACiB,gBAAN,CACLC,GADK,EAELvB,QAAQ,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,5 +1,5 @@
1
1
  export declare type TRowndContext = {
2
- requestSignIn: (opts?: RequestSignInOpts) => void;
2
+ requestSignIn: (e?: RequestSignIn) => void;
3
3
  signOut: () => void;
4
4
  manageAccount: () => void;
5
5
  getAccessToken: () => Promise<string>;
@@ -24,8 +24,10 @@ declare type AuthContext = {
24
24
  app_id: string | null;
25
25
  is_verified_user?: boolean;
26
26
  };
27
- export declare type RequestSignInOpts = {
28
- type?: 'google' | 'apple';
27
+ export declare type RequestSignInMethods = 'google' | 'apple' | 'default';
28
+ export declare type RequestSignIn = {
29
+ method?: RequestSignInMethods;
30
+ postSignInRedirect?: string;
29
31
  };
30
32
  export declare function useRownd(): TRowndContext;
31
33
  export {};
@@ -1,10 +1,3 @@
1
1
  export interface IConfig {
2
2
  appKey: string;
3
3
  }
4
- export declare type PostAuthApiSpec = {
5
- method: 'post' | 'put';
6
- url: string;
7
- extra_headers: {
8
- [key: string]: string;
9
- };
10
- };
@@ -1,9 +1,10 @@
1
- import type { RequestSignInOpts } from 'src/hooks/rownd';
1
+ import type { RequestSignIn } from 'src/hooks/rownd';
2
+ import type { IConfig } from './config';
2
3
  export declare const LINKING_ERROR: string;
3
4
  export declare const Rownd: any;
4
5
  export declare const IOSRowndEventEmitter: any;
5
- export declare function configure(appKey: string): Promise<string>;
6
- export declare function requestSignIn(method?: RequestSignInOpts): any;
6
+ export declare function configure(config: IConfig): Promise<string>;
7
+ export declare function requestSignIn(config?: RequestSignIn): any;
7
8
  export declare function signOut(): any;
8
9
  export declare function manageAccount(): any;
9
10
  export declare function getAccessToken(): Promise<string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rownd/react-native",
3
- "version": "2.5.0",
3
+ "version": "2.7.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.12.0"
20
+ s.dependency "Rownd", "~> 1.13.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
@@ -33,7 +33,7 @@ const RowndProvider: FunctionComponent<ContextProps> = ({
33
33
  const value = { state, dispatch };
34
34
 
35
35
  useEffect(() => {
36
- NativeRowndModules.configure(config.appKey);
36
+ NativeRowndModules.configure({appKey: config.appKey});
37
37
  }, [config.appKey]);
38
38
 
39
39
  useEffect(() => {
@@ -9,7 +9,7 @@ import {
9
9
  import { useRowndContext } from '../components/GlobalContext';
10
10
 
11
11
  export type TRowndContext = {
12
- requestSignIn: (opts?: RequestSignInOpts) => void;
12
+ requestSignIn: (e?: RequestSignIn) => void;
13
13
  signOut: () => void;
14
14
  manageAccount: () => void;
15
15
  getAccessToken: () => Promise<string>;
@@ -38,9 +38,8 @@ type AuthContext = {
38
38
  is_verified_user?: boolean;
39
39
  };
40
40
 
41
- export type RequestSignInOpts = {
42
- type?: 'google' | 'apple';
43
- };
41
+ export type RequestSignInMethods = 'google' | 'apple' | 'default';
42
+ export type RequestSignIn = {method?: RequestSignInMethods, postSignInRedirect?: string}
44
43
 
45
44
  export function useRownd(): TRowndContext {
46
45
  const { state } = useRowndContext();
@@ -1,9 +1,3 @@
1
1
  export interface IConfig {
2
2
  appKey: string;
3
3
  }
4
-
5
- export type PostAuthApiSpec = {
6
- method: 'post' | 'put';
7
- url: string;
8
- extra_headers: { [key: string]: string };
9
- };
@@ -1,5 +1,6 @@
1
1
  import { NativeModules, Platform } from 'react-native';
2
- import type { RequestSignInOpts } from 'src/hooks/rownd';
2
+ import type { RequestSignIn } from 'src/hooks/rownd';
3
+ import type { IConfig } from './config';
3
4
 
4
5
  export const LINKING_ERROR =
5
6
  `The package '@rownd/react-native' doesn't seem to be linked. Make sure: \n\n` +
@@ -32,19 +33,16 @@ export const IOSRowndEventEmitter =
32
33
  }
33
34
  );
34
35
 
35
- const isNotAvailableInAndroidYet = () => {
36
- console.log('ROWND: NOT AVAILABLE IN ANDROID YET');
37
- return true;
38
- };
39
36
 
40
- export function configure(appKey: string): Promise<string> {
41
- return Rownd.configure(appKey);
37
+ export function configure(config: IConfig): Promise<string> {
38
+ return Rownd.configure(config);
42
39
  }
43
40
 
44
- export function requestSignIn(method?: RequestSignInOpts) {
45
- if (method?.type === 'apple') return Rownd.requestSignInApple();
46
- if (method?.type === 'google') return Rownd.requestSignInGoogle();
47
- return Rownd.requestSignIn();
41
+ export function requestSignIn(config?: RequestSignIn) {
42
+ if (!config) {
43
+ Rownd.requestSignIn({method: "default"});
44
+ }
45
+ return Rownd.requestSignIn({ method: config?.method || "default", postSignInRedirect: config?.postSignInRedirect || undefined });
48
46
  }
49
47
 
50
48
  export function signOut() {
@@ -56,7 +54,6 @@ export function manageAccount() {
56
54
  }
57
55
 
58
56
  export function getAccessToken(): Promise<string> {
59
- if (isNotAvailableInAndroidYet()) return Promise.resolve('');
60
57
  return Rownd.getAccessToken();
61
58
  }
62
59