@soyio/soyio-rn-sdk 0.1.4 → 0.1.7
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 +5 -6
- package/package/src/constants.d.ts +1 -1
- package/package/src/constants.js +1 -1
- package/package/src/core.d.ts +1 -1
- package/package/src/core.jsx +4 -27
- package/package/src/utils.d.ts +1 -1
- package/package.json +17 -5
package/README.md
CHANGED
|
@@ -25,11 +25,10 @@ yarn add @soyio/soyio-rn-sdk
|
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
**IMPORTANT:**
|
|
28
|
-
For developers
|
|
28
|
+
For developers integrating with a **bare React Native** application, it's crucial to prepare your project for Expo modules and ensure it supports deep linking with a custom URL scheme. Please execute the following steps:
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
npx
|
|
32
|
-
```
|
|
30
|
+
1. `npx install-expo-modules`: This command installs Expo modules in your React Native project, allowing you to use Expo's powerful library of APIs and components without needing to eject from the Expo managed workflow.
|
|
31
|
+
2. `npx uri-scheme add soyio`: Adds the `soyio` scheme to your project, enabling deep linking capabilities on Android devices.
|
|
33
32
|
|
|
34
33
|
## Usage
|
|
35
34
|
|
|
@@ -98,8 +97,8 @@ The `onEventChange` function returns an object with the following properties:
|
|
|
98
97
|
|
|
99
98
|
- `url` (optional): URL associated only with the `success` event.
|
|
100
99
|
|
|
101
|
-
- For registration: `"
|
|
102
|
-
- For authentication: `"
|
|
100
|
+
- For registration: `"soyio://registered?userReference=<company user reference>&id=<identity_id>"`
|
|
101
|
+
- For authentication: `"soyio://authenticated?userReference=<company user reference>&id=<identity_id>"`
|
|
103
102
|
|
|
104
103
|
where `<identity_id>` is the unique identifier of the newly registered or authenticated user, respectively.
|
|
105
104
|
|
package/package/src/constants.js
CHANGED
|
@@ -3,5 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SOYIO_REDIRECT_URL = exports.SANDBOX_URL = exports.PRODUCTION_URL = void 0;
|
|
4
4
|
exports.PRODUCTION_URL = 'https://app.soyio.id/widget';
|
|
5
5
|
exports.SANDBOX_URL = 'https://sandbox.soyio.id/widget';
|
|
6
|
-
exports.SOYIO_REDIRECT_URL = '
|
|
6
|
+
exports.SOYIO_REDIRECT_URL = 'soyio://';
|
|
7
7
|
//# sourceMappingURL=constants.js.map
|
package/package/src/core.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AuthenticateParams, RegisterParams, SoyioWidgetViewPropsType } from './types';
|
|
2
2
|
export declare const useSoyioAuth: ({ options, onEventChange }: SoyioWidgetViewPropsType) => {
|
|
3
3
|
register: (registerParams: RegisterParams) => Promise<void>;
|
|
4
4
|
authenticate: (authenticateParams: AuthenticateParams) => Promise<void>;
|
package/package/src/core.jsx
CHANGED
|
@@ -60,11 +60,11 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
60
60
|
};
|
|
61
61
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
62
|
exports.useSoyioAuth = void 0;
|
|
63
|
-
var react_1 = require("react");
|
|
64
63
|
var WebBrowser = __importStar(require("expo-web-browser"));
|
|
65
|
-
var
|
|
66
|
-
var constants_1 = require("./constants");
|
|
64
|
+
var react_1 = require("react");
|
|
67
65
|
var react_native_1 = require("react-native");
|
|
66
|
+
var constants_1 = require("./constants");
|
|
67
|
+
var utils_1 = require("./utils");
|
|
68
68
|
function getBrowserOptions() {
|
|
69
69
|
return __awaiter(this, void 0, void 0, function () {
|
|
70
70
|
var webBrowserOptions, preferredBrowserPackage;
|
|
@@ -77,7 +77,7 @@ function getBrowserOptions() {
|
|
|
77
77
|
enableBarCollapsing: true,
|
|
78
78
|
showTitle: true,
|
|
79
79
|
};
|
|
80
|
-
if (!(react_native_1.Platform.OS ===
|
|
80
|
+
if (!(react_native_1.Platform.OS === 'android')) return [3 /*break*/, 2];
|
|
81
81
|
return [4 /*yield*/, WebBrowser.getCustomTabsSupportingBrowsersAsync()];
|
|
82
82
|
case 1:
|
|
83
83
|
preferredBrowserPackage = (_a.sent()).preferredBrowserPackage;
|
|
@@ -135,27 +135,4 @@ var useSoyioAuth = function (_a) {
|
|
|
135
135
|
return { register: register, authenticate: authenticate };
|
|
136
136
|
};
|
|
137
137
|
exports.useSoyioAuth = useSoyioAuth;
|
|
138
|
-
function openInCustomTab(url) {
|
|
139
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
140
|
-
var preferredBrowserPackage;
|
|
141
|
-
return __generator(this, function (_a) {
|
|
142
|
-
switch (_a.label) {
|
|
143
|
-
case 0:
|
|
144
|
-
if (!(react_native_1.Platform.OS === "android")) return [3 /*break*/, 3];
|
|
145
|
-
return [4 /*yield*/, WebBrowser.getCustomTabsSupportingBrowsersAsync()];
|
|
146
|
-
case 1:
|
|
147
|
-
preferredBrowserPackage = (_a.sent()).preferredBrowserPackage;
|
|
148
|
-
return [4 /*yield*/, WebBrowser.openBrowserAsync(url, { browserPackage: preferredBrowserPackage })];
|
|
149
|
-
case 2:
|
|
150
|
-
_a.sent();
|
|
151
|
-
return [3 /*break*/, 5];
|
|
152
|
-
case 3: return [4 /*yield*/, WebBrowser.openBrowserAsync(url)];
|
|
153
|
-
case 4:
|
|
154
|
-
_a.sent();
|
|
155
|
-
_a.label = 5;
|
|
156
|
-
case 5: return [2 /*return*/];
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
138
|
//# sourceMappingURL=core.jsx.map
|
package/package/src/utils.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AuthenticateParams, RegisterParams, SoyioWidgetParams } from './types';
|
|
2
2
|
export declare function getFlowUrl(options: SoyioWidgetParams, flow: 'authenticate' | 'register'): string;
|
|
3
3
|
export declare function buildUrlParams(widgetParams: SoyioWidgetParams, flowParams: RegisterParams | AuthenticateParams): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soyio/soyio-rn-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"author": "Ignacio Méndez",
|
|
4
6
|
"main": "./package/index.js",
|
|
5
7
|
"types": "./package/index.d.ts",
|
|
6
8
|
"scripts": {
|
|
@@ -11,21 +13,31 @@
|
|
|
11
13
|
"web": "expo start --web",
|
|
12
14
|
"build": "npm run build:esm && npm run build:cjs",
|
|
13
15
|
"build:esm": "tsc",
|
|
14
|
-
"build:cjs": "tsc --module commonjs"
|
|
16
|
+
"build:cjs": "tsc --module commonjs",
|
|
17
|
+
"lint": "eslint . --ext .ts",
|
|
18
|
+
"version:get": "node -p \"require('./package.json').version\""
|
|
15
19
|
},
|
|
16
20
|
"dependencies": {
|
|
17
21
|
"expo-status-bar": "~1.11.1",
|
|
18
22
|
"expo-web-browser": "~12.8.2"
|
|
19
23
|
},
|
|
20
24
|
"peerDependencies": {
|
|
21
|
-
"expo": "*",
|
|
22
25
|
"react": "*",
|
|
23
|
-
"react-native": "*"
|
|
26
|
+
"react-native": "*",
|
|
27
|
+
"expo": "*"
|
|
24
28
|
},
|
|
25
29
|
"devDependencies": {
|
|
26
30
|
"@babel/core": "^7.20.0",
|
|
27
31
|
"@types/react": "~18.2.45",
|
|
32
|
+
"react": "^18.2.0",
|
|
28
33
|
"react-native": "^0.73.6",
|
|
29
|
-
"typescript": "^5.
|
|
34
|
+
"typescript": "^5.4.3",
|
|
35
|
+
"@typescript-eslint/eslint-plugin": "^7.4.0",
|
|
36
|
+
"@typescript-eslint/parser": "^7.4.0",
|
|
37
|
+
"eslint": "^8.57.0",
|
|
38
|
+
"eslint-config-airbnb-base": "^15.0.0",
|
|
39
|
+
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
40
|
+
"eslint-plugin-import": "^2.29.1",
|
|
41
|
+
"eslint-plugin-tsdoc": "^0.2.17"
|
|
30
42
|
}
|
|
31
43
|
}
|