@bytexbyte/berifyme-react-sdk 1.0.12 → 1.0.14
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/dist/api/api.js
CHANGED
|
@@ -737,21 +737,35 @@ function generateAppleWalletPass(_a) {
|
|
|
737
737
|
}
|
|
738
738
|
function createSessionToken(_a) {
|
|
739
739
|
return __awaiter(this, arguments, void 0, function (_b) {
|
|
740
|
-
var url, res;
|
|
740
|
+
var url, res, error_1;
|
|
741
|
+
var _c;
|
|
741
742
|
var apiKeyId = _b.apiKeyId, secretKey = _b.secretKey, redirectUrl = _b.redirectUrl;
|
|
742
|
-
return __generator(this, function (
|
|
743
|
-
switch (
|
|
743
|
+
return __generator(this, function (_d) {
|
|
744
|
+
switch (_d.label) {
|
|
744
745
|
case 0:
|
|
745
746
|
url = "".concat(config.backendDomain, "/api/thirdParty/createToken");
|
|
746
747
|
console.log('UrlString: ', url);
|
|
747
|
-
|
|
748
|
-
apiKeyId: apiKeyId,
|
|
749
|
-
secretKey: secretKey,
|
|
750
|
-
redirectUrl: redirectUrl,
|
|
751
|
-
})];
|
|
748
|
+
_d.label = 1;
|
|
752
749
|
case 1:
|
|
753
|
-
|
|
754
|
-
return [
|
|
750
|
+
_d.trys.push([1, 3, , 4]);
|
|
751
|
+
return [4 /*yield*/, axios.post(url, { apiKeyId: apiKeyId, secretKey: secretKey, redirectUrl: redirectUrl })];
|
|
752
|
+
case 2:
|
|
753
|
+
res = _d.sent();
|
|
754
|
+
return [2 /*return*/, res.data]; // 預期 response 為 { sessionToken, companyLogo }
|
|
755
|
+
case 3:
|
|
756
|
+
error_1 = _d.sent();
|
|
757
|
+
console.error('Error creating session token:', error_1);
|
|
758
|
+
if (error_1.response) {
|
|
759
|
+
return [2 /*return*/, { error: ((_c = error_1.response.data) === null || _c === void 0 ? void 0 : _c.error) || 'An error occurred. Please try again.' }];
|
|
760
|
+
}
|
|
761
|
+
else if (error_1.request) {
|
|
762
|
+
return [2 /*return*/, { error: 'No response from server. Please check your network and try again.' }];
|
|
763
|
+
}
|
|
764
|
+
else {
|
|
765
|
+
return [2 /*return*/, { error: 'Unexpected error. Please try again later.' }];
|
|
766
|
+
}
|
|
767
|
+
return [3 /*break*/, 4];
|
|
768
|
+
case 4: return [2 /*return*/];
|
|
755
769
|
}
|
|
756
770
|
});
|
|
757
771
|
});
|
|
@@ -810,7 +824,7 @@ function updateAuthenticationLogs(_a) {
|
|
|
810
824
|
}
|
|
811
825
|
function createDeveloperLog(_a) {
|
|
812
826
|
return __awaiter(this, arguments, void 0, function (_b) {
|
|
813
|
-
var url, res,
|
|
827
|
+
var url, res, error_2;
|
|
814
828
|
var userId = _b.userId, sessionToken = _b.sessionToken, action = _b.action, firstDetail = _b.firstDetail, secondDetail = _b.secondDetail, userDataJson = _b.userDataJson, source = _b.source, browser = _b.browser;
|
|
815
829
|
return __generator(this, function (_c) {
|
|
816
830
|
switch (_c.label) {
|
|
@@ -838,9 +852,9 @@ function createDeveloperLog(_a) {
|
|
|
838
852
|
res = _c.sent();
|
|
839
853
|
return [2 /*return*/, res.data];
|
|
840
854
|
case 3:
|
|
841
|
-
|
|
842
|
-
console.error('Error creating developer log:',
|
|
843
|
-
throw
|
|
855
|
+
error_2 = _c.sent();
|
|
856
|
+
console.error('Error creating developer log:', error_2);
|
|
857
|
+
throw error_2;
|
|
844
858
|
case 4: return [2 /*return*/];
|
|
845
859
|
}
|
|
846
860
|
});
|
|
@@ -134,22 +134,22 @@ var AuthID = function (_a) {
|
|
|
134
134
|
});
|
|
135
135
|
goRedirect();
|
|
136
136
|
}
|
|
137
|
-
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}));
|
|
137
|
+
// WebSDK不需要這段, 不會被WebView使用 (window as any).ReactNativeWebView.postMessage(JSON.stringify({
|
|
138
|
+
// event: 'onSuccess', user: {
|
|
139
|
+
// id: result.userId,
|
|
140
|
+
// isActive: null,
|
|
141
|
+
// email: null,
|
|
142
|
+
// phoneNumber: phone,
|
|
143
|
+
// authIDAccountNumber: null,
|
|
144
|
+
// incodeId: null,
|
|
145
|
+
// clearId: null,
|
|
146
|
+
// idmeId: null,
|
|
147
|
+
// fullName,
|
|
148
|
+
// age: null,
|
|
149
|
+
// birthDate: birthDateFromAuthId?.replaceAll('-', '/'),
|
|
150
|
+
// transactionId,
|
|
151
|
+
// }
|
|
152
|
+
// }));
|
|
153
153
|
return [2 /*return*/];
|
|
154
154
|
case 3:
|
|
155
155
|
setError(result.error);
|
|
@@ -210,12 +210,12 @@ var AuthID = function (_a) {
|
|
|
210
210
|
setUrl('');
|
|
211
211
|
setTimeout(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
212
212
|
var document, documentType;
|
|
213
|
-
var _a, _b, _c, _d, _e, _f
|
|
214
|
-
return __generator(this, function (
|
|
215
|
-
switch (
|
|
213
|
+
var _a, _b, _c, _d, _e, _f;
|
|
214
|
+
return __generator(this, function (_g) {
|
|
215
|
+
switch (_g.label) {
|
|
216
216
|
case 0: return [4 /*yield*/, berifymeApi.authID.getDocumentDetails({ token: localStorage.getItem('authID_token') || '', operationId: operationId, userId: userId, sessionToken: token })];
|
|
217
217
|
case 1:
|
|
218
|
-
document =
|
|
218
|
+
document = _g.sent();
|
|
219
219
|
createDeveloperLog({
|
|
220
220
|
userId: userId,
|
|
221
221
|
source: 'FRONTEND',
|
|
@@ -246,7 +246,7 @@ var AuthID = function (_a) {
|
|
|
246
246
|
documentType: (documentType === null || documentType === void 0 ? void 0 : documentType.includes('Passport')) ? 'Passport' : 'ID'
|
|
247
247
|
})];
|
|
248
248
|
case 2:
|
|
249
|
-
|
|
249
|
+
_g.sent();
|
|
250
250
|
createDeveloperLog({
|
|
251
251
|
userId: userId,
|
|
252
252
|
source: 'FRONTEND',
|
|
@@ -262,23 +262,7 @@ var AuthID = function (_a) {
|
|
|
262
262
|
updateAuthenticationLog({ isPass: true, transactionId: operationId, token: token });
|
|
263
263
|
goToAllSet();
|
|
264
264
|
}
|
|
265
|
-
|
|
266
|
-
event: 'onSuccess', user: {
|
|
267
|
-
id: userId,
|
|
268
|
-
fullName: (_g = document.details.find(function (item) { return item.Key === 'NameOfHolder'; })) === null || _g === void 0 ? void 0 : _g.Value,
|
|
269
|
-
phoneNumber: document.phone,
|
|
270
|
-
isActive: null,
|
|
271
|
-
email: null,
|
|
272
|
-
authIDAccountNumber: null,
|
|
273
|
-
incodeId: null,
|
|
274
|
-
clearId: null,
|
|
275
|
-
idmeId: null,
|
|
276
|
-
age: null,
|
|
277
|
-
birthDate: null,
|
|
278
|
-
transactionId: operationId,
|
|
279
|
-
},
|
|
280
|
-
}));
|
|
281
|
-
_h.label = 3;
|
|
265
|
+
_g.label = 3;
|
|
282
266
|
case 3: return [2 /*return*/];
|
|
283
267
|
}
|
|
284
268
|
});
|
package/dist/types/api/api.d.ts
CHANGED
|
@@ -343,11 +343,16 @@ declare function generateAppleWalletPass({ id, fullName, birthDate }: {
|
|
|
343
343
|
}): Promise<{
|
|
344
344
|
serialNumber: string;
|
|
345
345
|
}>;
|
|
346
|
-
|
|
346
|
+
interface CreateSessionTokenResponse {
|
|
347
|
+
sessionToken?: string;
|
|
348
|
+
companyLogo?: string;
|
|
349
|
+
error?: string;
|
|
350
|
+
}
|
|
351
|
+
declare function createSessionToken({ apiKeyId, secretKey, redirectUrl, }: {
|
|
347
352
|
apiKeyId: string;
|
|
348
353
|
secretKey: string;
|
|
349
354
|
redirectUrl: string;
|
|
350
|
-
}): Promise<
|
|
355
|
+
}): Promise<CreateSessionTokenResponse>;
|
|
351
356
|
declare function createAuthenticationLogs({ actionType, token, userId, vender, os, browser, device, transactionId, incodeSessionId, clearSessionId, isPass, }: {
|
|
352
357
|
actionType: ActionType;
|
|
353
358
|
token: string;
|