@soyio/soyio-rn-sdk 0.2.10 → 0.2.12
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 +18 -11
- package/package.json +1 -1
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>
|
|
@@ -120,13 +127,13 @@ npm run build
|
|
|
120
127
|
npm pack
|
|
121
128
|
```
|
|
122
129
|
|
|
123
|
-
This will create a `soyio-soyio-
|
|
130
|
+
This will create a `soyio-soyio-rn-sdk-x.x.x.tgz` file (with the corresponding package version). Now, go to another directory and create a React Native app (using Expo, perhaps). After creating the new application, add the following dependency to its `package.json` file:
|
|
124
131
|
|
|
125
132
|
```json
|
|
126
133
|
{
|
|
127
134
|
"dependencies": {
|
|
128
135
|
...,
|
|
129
|
-
"@soyio/soyio-
|
|
136
|
+
"@soyio/soyio-rn-sdk": "file:./path/to/soyio-soyio-rn-sdk-x.x.x.tgz",
|
|
130
137
|
...
|
|
131
138
|
}
|
|
132
139
|
}
|