@soyio/soyio-rn-sdk 0.2.9 → 0.2.11
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 +16 -9
- package/package.json +2 -7
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
## Installation
|
|
16
16
|
|
|
17
|
-
Install using npm! (or your
|
|
17
|
+
Install using npm! (or your favorite package manager)
|
|
18
18
|
|
|
19
19
|
```sh
|
|
20
20
|
# Using npm
|
|
@@ -24,6 +24,13 @@ npm install @soyio/soyio-rn-sdk
|
|
|
24
24
|
yarn add @soyio/soyio-rn-sdk
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
+
**IMPORTANT:**
|
|
28
|
+
For developers working with a bare React Native application, it is essential to include Expo modules to ensure full compatibility and functionality of the Soyio SDK. To install Expo modules, run the following command in your project directory:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npx install-expo-modules
|
|
32
|
+
```
|
|
33
|
+
|
|
27
34
|
## Usage
|
|
28
35
|
|
|
29
36
|
`Soyio React Native` exports a single hook called `useSoyioAuth`. This is a hook that opens a `WebBrowser` using the `openAuthSessionAsync` method by [expo](https://docs.expo.dev/versions/latest/sdk/webbrowser/#webbrowseropenauthsessionasyncurl-redirecturl-options).
|
|
@@ -40,33 +47,33 @@ After retrieving the `useSoyioAuth` hook, you are ready to instantiate the widge
|
|
|
40
47
|
export default function App() {
|
|
41
48
|
const options = {
|
|
42
49
|
userReference: "<company identifier of user>", // OPTIONAL
|
|
43
|
-
companyId: "<company id>",
|
|
50
|
+
companyId: "<company id>", // Starts with 'com_'
|
|
44
51
|
};
|
|
45
52
|
|
|
46
53
|
// For registering a new identity
|
|
47
54
|
const registerParams = {
|
|
48
55
|
flowTemplateId: "<flow template id>", // Starts with 'vft_'
|
|
49
|
-
userEmail: "<user email>",
|
|
56
|
+
userEmail: "<user email>", // OPTIONAL
|
|
50
57
|
};
|
|
51
58
|
|
|
52
59
|
// For authenticate existing identity
|
|
53
60
|
const authenticateParams = {
|
|
54
|
-
identityId: "<identity id>",
|
|
61
|
+
identityId: "<identity id>", // Starts with 'id_'
|
|
55
62
|
};
|
|
56
63
|
|
|
57
|
-
|
|
58
|
-
console.log(
|
|
59
|
-
}
|
|
64
|
+
const onEventChange = (event) => {
|
|
65
|
+
console.log("Event:", event);
|
|
66
|
+
};
|
|
60
67
|
|
|
61
68
|
const { register, authenticate } = useSoyioAuth({ options, onEventChange });
|
|
62
69
|
|
|
63
70
|
const registerNewIdentity = () => {
|
|
64
71
|
register(registerParams);
|
|
65
|
-
}
|
|
72
|
+
};
|
|
66
73
|
|
|
67
74
|
const authenticateIdentity = () => {
|
|
68
75
|
authenticate(authenticateParams);
|
|
69
|
-
}
|
|
76
|
+
};
|
|
70
77
|
|
|
71
78
|
return (
|
|
72
79
|
<View>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soyio/soyio-rn-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/Soyio-id/soyio-webview-rn.git"
|
|
@@ -31,8 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"react": "*",
|
|
34
|
-
"react-native": "*"
|
|
35
|
-
"expo": "*"
|
|
34
|
+
"react-native": "*"
|
|
36
35
|
},
|
|
37
36
|
"devDependencies": {
|
|
38
37
|
"@types/node": "^17.0.23",
|
|
@@ -46,10 +45,6 @@
|
|
|
46
45
|
"eslint-import-resolver-typescript": "^2.7.0",
|
|
47
46
|
"eslint-plugin-import": "^2.25.4",
|
|
48
47
|
"eslint-plugin-react": "^7.29.4",
|
|
49
|
-
"expo": "~50.0.6",
|
|
50
|
-
"expo-auth-session": "~5.4.0",
|
|
51
|
-
"expo-crypto": "~12.8.0",
|
|
52
|
-
"expo-web-browser": "~12.8.2",
|
|
53
48
|
"npm-run-all": "^4.1.5",
|
|
54
49
|
"react": "^18.0.2",
|
|
55
50
|
"react-native": "^0.73.4",
|