@teamdigipay/dgepay-customer-transaction-package 0.0.26 → 0.0.27
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/.yarn/install-state.gz +0 -0
- package/.yarnrc.yml +1 -0
- package/dist/network/APICall.d.ts +1 -0
- package/dist/network/APIService.d.ts +1 -0
- package/dist/network/APIService.js +375 -416
- package/dist/network/Helpers/ShowQRCodeApiHelper.d.ts +4 -0
- package/dist/network/Helpers/ShowQRCodeApiHelper.js +45 -0
- package/dist/utils/CommonConfig.d.ts +1 -0
- package/dist/utils/DatadogTxn.js +29 -8
- package/package.json +2 -5
- package/src/network/APICall.ts +1 -0
- package/src/network/APIService.ts +46 -86
- package/src/types/datadog-mobile-react-native.d.ts +2 -0
- package/src/utils/CommonConfig.ts +2 -0
- package/src/utils/DatadogTxn.ts +43 -8
- package/teamdigipay-dgepay-customer-transaction-package-0.0.27.tgz +0 -0
- package/tsconfig.json +1 -1
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { BasicAPIConfig } from "../../utils/common_models";
|
|
2
|
+
export declare function saveCashInOutQRCode(config: BasicAPIConfig, payload: any, onData: (data: any) => void, onError: (error: any) => void): Promise<void>;
|
|
3
|
+
export declare function getCashInOutQRCodeDetails(config: BasicAPIConfig, payload: any, onData: (data: any) => void, onError: (error: any) => void): Promise<void>;
|
|
4
|
+
export declare function deleteCashInOutQRCodeDetails(config: BasicAPIConfig, payload: any, onData: (data: any) => void, onError: (error: any) => void): Promise<void>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.deleteCashInOutQRCodeDetails = exports.getCashInOutQRCodeDetails = exports.saveCashInOutQRCode = void 0;
|
|
13
|
+
const APICall_1 = require("../APICall");
|
|
14
|
+
const APIEndpoints_1 = require("../APIEndpoints");
|
|
15
|
+
function saveCashInOutQRCode(config, payload, onData, onError) {
|
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
yield (0, APICall_1.POST)(Object.assign(Object.assign({}, config), { endPoint: APIEndpoints_1.API_ENDPOINTS.USER_DOCKER.TRANSACTION_QR_CODE }), payload, (data) => __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
onData(data === null || data === void 0 ? void 0 : data.data);
|
|
19
|
+
}), (error) => {
|
|
20
|
+
onError(error.errorMessage);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
exports.saveCashInOutQRCode = saveCashInOutQRCode;
|
|
25
|
+
function getCashInOutQRCodeDetails(config, payload, onData, onError) {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
yield (0, APICall_1.GET)(Object.assign(Object.assign({}, config), { endPoint: APIEndpoints_1.API_ENDPOINTS.USER_DOCKER.TRANSACTION_QR_CODE }), payload, (data) => __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
onData(data);
|
|
29
|
+
}), (error) => __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
onError(error.errorMessage);
|
|
31
|
+
}));
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
exports.getCashInOutQRCodeDetails = getCashInOutQRCodeDetails;
|
|
35
|
+
function deleteCashInOutQRCodeDetails(config, payload, onData, onError) {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
yield (0, APICall_1.DELETE)(Object.assign(Object.assign({}, config), { endPoint: APIEndpoints_1.API_ENDPOINTS.USER_DOCKER.TRANSACTION_QR_CODE + "/" + payload.id }), payload, (data) => __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
var _a;
|
|
39
|
+
onData((_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.message);
|
|
40
|
+
}), (error) => __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
onError(error.errorMessage);
|
|
42
|
+
}));
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
exports.deleteCashInOutQRCodeDetails = deleteCashInOutQRCodeDetails;
|
|
@@ -10,6 +10,7 @@ export interface CommonConfig {
|
|
|
10
10
|
showDangerToast?: any;
|
|
11
11
|
SESSION_EXPIRE_VALUE: string;
|
|
12
12
|
message: string;
|
|
13
|
+
callBack?: (type: string) => void;
|
|
13
14
|
}
|
|
14
15
|
export declare const initializeTxnCommonConfig: (config: CommonConfig) => void;
|
|
15
16
|
export declare const getCommonConfig: () => CommonConfig;
|
package/dist/utils/DatadogTxn.js
CHANGED
|
@@ -9,26 +9,45 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
|
|
12
|
+
function getDatadog() {
|
|
13
|
+
try {
|
|
14
|
+
// Optional dependency: consumers may not ship Datadog.
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
16
|
+
return require('@datadog/mobile-react-native');
|
|
17
|
+
}
|
|
18
|
+
catch (_a) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
13
22
|
exports.default = {
|
|
14
23
|
info(message, params) {
|
|
15
|
-
|
|
24
|
+
var _a, _b;
|
|
25
|
+
const dd = getDatadog();
|
|
26
|
+
(_b = (_a = dd === null || dd === void 0 ? void 0 : dd.DdLogs) === null || _a === void 0 ? void 0 : _a.info) === null || _b === void 0 ? void 0 : _b.call(_a, message, params);
|
|
16
27
|
},
|
|
17
28
|
warn(message, params) {
|
|
18
|
-
|
|
29
|
+
var _a, _b;
|
|
30
|
+
const dd = getDatadog();
|
|
31
|
+
(_b = (_a = dd === null || dd === void 0 ? void 0 : dd.DdLogs) === null || _a === void 0 ? void 0 : _a.warn) === null || _b === void 0 ? void 0 : _b.call(_a, message, params);
|
|
19
32
|
},
|
|
20
33
|
error(message, params) {
|
|
21
|
-
|
|
34
|
+
var _a, _b;
|
|
35
|
+
const dd = getDatadog();
|
|
36
|
+
(_b = (_a = dd === null || dd === void 0 ? void 0 : dd.DdLogs) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, message, params);
|
|
22
37
|
},
|
|
23
38
|
setDataDogLogger(clientToken, DEV, applicationId, serviceName) {
|
|
39
|
+
var _a;
|
|
24
40
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
|
|
41
|
+
const dd = getDatadog();
|
|
42
|
+
if (!(dd === null || dd === void 0 ? void 0 : dd.DdSdkReactNativeConfiguration) || !((_a = dd === null || dd === void 0 ? void 0 : dd.DdSdkReactNative) === null || _a === void 0 ? void 0 : _a.initialize))
|
|
43
|
+
return;
|
|
44
|
+
let config = new dd.DdSdkReactNativeConfiguration(clientToken, DEV, applicationId, false, false, false);
|
|
26
45
|
config["site"] = 'US1';
|
|
27
46
|
config["nativeCrashReportEnabled"] = true;
|
|
28
47
|
config["sessionSamplingRate"] = 100;
|
|
29
48
|
config["resourceTracingSamplingRate"] = 100;
|
|
30
49
|
config["serviceName"] = serviceName;
|
|
31
|
-
|
|
50
|
+
dd.DdSdkReactNative.initialize(config).then((_dataDogRes) => {
|
|
32
51
|
console.info("-----DATA DOG CUSTOMER TXN INIT SUCCESS-----");
|
|
33
52
|
}).catch((error) => {
|
|
34
53
|
console.error("-----DATA DOG CUSTOMER TXN INIT ERROR-----", error);
|
|
@@ -36,9 +55,11 @@ exports.default = {
|
|
|
36
55
|
});
|
|
37
56
|
},
|
|
38
57
|
setUser(user) {
|
|
39
|
-
|
|
58
|
+
var _a, _b;
|
|
59
|
+
const dd = getDatadog();
|
|
60
|
+
(_b = (_a = dd === null || dd === void 0 ? void 0 : dd.DdSdkReactNative) === null || _a === void 0 ? void 0 : _a.setUserInfo) === null || _b === void 0 ? void 0 : _b.call(_a, user);
|
|
40
61
|
},
|
|
41
62
|
setDefaultAttribute(key, params) {
|
|
42
|
-
|
|
63
|
+
// DdSdkReactNative.setAttributes(params);
|
|
43
64
|
},
|
|
44
65
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamdigipay/dgepay-customer-transaction-package",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.27",
|
|
4
4
|
"author": "RM (peerbits)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -11,18 +11,15 @@
|
|
|
11
11
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@datadog/mobile-react-native": "^1.2.1",
|
|
15
|
-
"@react-native-community/netinfo": "^7.1.9",
|
|
16
14
|
"@types/crypto-js": "^4.1.1",
|
|
17
15
|
"@types/lodash": "^4.14.191",
|
|
18
16
|
"axios": "^1.2.1",
|
|
19
17
|
"crypto-js": "^4.1.1",
|
|
20
18
|
"lodash": "^4.17.21",
|
|
21
|
-
"react-native": "0.
|
|
19
|
+
"react-native": "0.84.1",
|
|
22
20
|
"typescript": "^4.9.4"
|
|
23
21
|
},
|
|
24
22
|
"description": "> This package contains all the necessary Transaction controllers, helpers and constants for DGePay Customer Application.",
|
|
25
|
-
"devDependencies": {},
|
|
26
23
|
"repository": {
|
|
27
24
|
"type": "git",
|
|
28
25
|
"url": "git+https://meenor@bitbucket.org/dev_digipay/digipay-package-customer-transaction-rn-v3.git"
|
package/src/network/APICall.ts
CHANGED
|
@@ -3,9 +3,7 @@ import {consoleHelper, createDigitalSignature, generateUUID, getCurrentTimeStamp
|
|
|
3
3
|
import { ERROR_CODE, METHOD } from "../utils/constants";
|
|
4
4
|
import { getBackendResponseMessage } from "./APIResponses";
|
|
5
5
|
import DatadogTxn from "../utils/DatadogTxn";
|
|
6
|
-
import NetInfo, { NetInfoState } from "@react-native-community/netinfo";
|
|
7
|
-
import Strings from "../utils/Strings";
|
|
8
|
-
import {Alert} from "react-native";
|
|
6
|
+
// import NetInfo, { NetInfoState } from "@react-native-community/netinfo";
|
|
9
7
|
import {getCommonConfig} from "../utils/CommonConfig";
|
|
10
8
|
import {txnNavigationConstants} from "../index";
|
|
11
9
|
|
|
@@ -19,6 +17,7 @@ export interface API_CONFIG {
|
|
|
19
17
|
headers?: any;
|
|
20
18
|
token?: TOKEN_OBJ_TYPE;
|
|
21
19
|
companyId: string;
|
|
20
|
+
userOriginalToken?: boolean;
|
|
22
21
|
|
|
23
22
|
forceLive?: boolean;
|
|
24
23
|
timeout?: number;
|
|
@@ -55,21 +54,24 @@ export default async (
|
|
|
55
54
|
onSuccess: (res: SuccessResponseModel) => void,
|
|
56
55
|
onFailure: (error: any) => void
|
|
57
56
|
) => {
|
|
58
|
-
const isConnected: NetInfoState = await NetInfo.fetch()
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
57
|
+
// const isConnected: NetInfoState = await NetInfo.fetch()
|
|
58
|
+
// console.log('Internet connection', isConnected);
|
|
59
|
+
// if (!isConnected.isConnected) {
|
|
60
|
+
// onFailure({
|
|
61
|
+
// errorMessage: Strings.PACKAGE_INTERNET_CONNECTION_ERROR_TEXT,
|
|
62
|
+
// errorCode: ERROR_CODE.INTERNET_NOT_AVAILABLE,
|
|
63
|
+
// success: false
|
|
64
|
+
// })
|
|
65
|
+
// console.log('Please, Check your Internet Connection..!!!!!!!!!!!!!!!')
|
|
66
|
+
// }
|
|
67
|
+
// else{
|
|
69
68
|
const method: METHOD = apiConfig.method || "get";
|
|
70
69
|
|
|
71
70
|
const companyId: string = apiConfig.companyId;
|
|
72
|
-
const
|
|
71
|
+
const userOriginalToken:boolean = apiConfig?.userOriginalToken==false?false:true;
|
|
72
|
+
const token = typeof apiConfig?.token === "string"
|
|
73
|
+
? apiConfig.token
|
|
74
|
+
: apiConfig?.token?.token;
|
|
73
75
|
const secret_key = apiConfig?.token?.secret_key;
|
|
74
76
|
const Language = apiConfig?.token?.language;
|
|
75
77
|
const requestId = generateUUID(32);
|
|
@@ -98,8 +100,10 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
98
100
|
Language:langugaeCode
|
|
99
101
|
};
|
|
100
102
|
|
|
101
|
-
if (
|
|
102
|
-
headers[
|
|
103
|
+
if (!userOriginalToken) {
|
|
104
|
+
headers["Authorization"] = `Basic ${token}`;
|
|
105
|
+
} else {
|
|
106
|
+
headers["Authorization"] = `Token ${token}`;
|
|
103
107
|
}
|
|
104
108
|
|
|
105
109
|
if (apiConfig.headers) {
|
|
@@ -197,8 +201,7 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
197
201
|
RequestID:requestId,
|
|
198
202
|
status:status,
|
|
199
203
|
params: params,
|
|
200
|
-
api_status:status
|
|
201
|
-
apiPayload:apiPayload
|
|
204
|
+
api_status:status
|
|
202
205
|
});
|
|
203
206
|
|
|
204
207
|
onSuccess({ data: responseData.data, message: successMessage, success: true });
|
|
@@ -220,8 +223,7 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
220
223
|
RequestID:requestId,
|
|
221
224
|
status:status,
|
|
222
225
|
params: params,
|
|
223
|
-
api_status:status
|
|
224
|
-
apiPayload:apiPayload
|
|
226
|
+
api_status:status
|
|
225
227
|
});
|
|
226
228
|
|
|
227
229
|
onFailure({
|
|
@@ -248,9 +250,7 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
248
250
|
errorCode: "",
|
|
249
251
|
success: false
|
|
250
252
|
});
|
|
251
|
-
|
|
252
|
-
{text: langugaeCode && langugaeCode == "bn" ? "ঠিক আছে" : 'OK',},
|
|
253
|
-
]);
|
|
253
|
+
commonConfig.callBack?.('system_under_maintenance');
|
|
254
254
|
break;
|
|
255
255
|
|
|
256
256
|
default:
|
|
@@ -268,17 +268,14 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
268
268
|
RequestID:requestId,
|
|
269
269
|
status:status,
|
|
270
270
|
params: params,
|
|
271
|
-
api_status:status
|
|
272
|
-
apiPayload:apiPayload
|
|
271
|
+
api_status:status
|
|
273
272
|
});
|
|
274
273
|
onFailure({
|
|
275
274
|
errorMessage: "",
|
|
276
275
|
errorCode: "",
|
|
277
276
|
success: false
|
|
278
277
|
});
|
|
279
|
-
|
|
280
|
-
{text: langugaeCode && langugaeCode == "bn" ? "ঠিক আছে" : 'OK',},
|
|
281
|
-
]);
|
|
278
|
+
commonConfig.callBack?.('system_under_maintenance');
|
|
282
279
|
|
|
283
280
|
|
|
284
281
|
}
|
|
@@ -297,17 +294,14 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
297
294
|
RequestID:requestId,
|
|
298
295
|
status:status,
|
|
299
296
|
params: params,
|
|
300
|
-
api_status:response?.status
|
|
301
|
-
apiPayload:apiPayload
|
|
297
|
+
api_status:response?.status
|
|
302
298
|
});
|
|
303
299
|
onFailure({
|
|
304
300
|
errorMessage: "",
|
|
305
301
|
errorCode: "",
|
|
306
302
|
success: false
|
|
307
303
|
});
|
|
308
|
-
|
|
309
|
-
{text: langugaeCode && langugaeCode == "bn" ? "ঠিক আছে" : 'OK',},
|
|
310
|
-
]);
|
|
304
|
+
commonConfig.callBack?.('system_under_maintenance');
|
|
311
305
|
|
|
312
306
|
}
|
|
313
307
|
})
|
|
@@ -319,8 +313,7 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
319
313
|
config: {config},
|
|
320
314
|
params: params,
|
|
321
315
|
RequestID:requestId,
|
|
322
|
-
api_status:`${error}
|
|
323
|
-
apiPayload:apiPayload
|
|
316
|
+
api_status:`${error}`
|
|
324
317
|
})
|
|
325
318
|
consoleHelper('\n___________error__________________', error)
|
|
326
319
|
if (error) {
|
|
@@ -346,9 +339,7 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
346
339
|
errorCode: 0,
|
|
347
340
|
success: false
|
|
348
341
|
});
|
|
349
|
-
|
|
350
|
-
{text: langugaeCode && langugaeCode == "bn" ? "ঠিক আছে" :'OK', },
|
|
351
|
-
]);
|
|
342
|
+
commonConfig.callBack?.('system_under_maintenance');
|
|
352
343
|
break;
|
|
353
344
|
case 500:
|
|
354
345
|
onFailure({
|
|
@@ -356,9 +347,7 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
356
347
|
errorCode: 0,
|
|
357
348
|
success: false
|
|
358
349
|
});
|
|
359
|
-
|
|
360
|
-
{text: langugaeCode && langugaeCode == "bn" ? "ঠিক আছে" :'OK', },
|
|
361
|
-
]);
|
|
350
|
+
commonConfig.callBack?.('system_under_maintenance');
|
|
362
351
|
break;
|
|
363
352
|
case 503:
|
|
364
353
|
onFailure({
|
|
@@ -366,9 +355,7 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
366
355
|
errorCode: 0,
|
|
367
356
|
success: false
|
|
368
357
|
});
|
|
369
|
-
|
|
370
|
-
{text: langugaeCode && langugaeCode == "bn" ? "ঠিক আছে" :'OK', },
|
|
371
|
-
]);
|
|
358
|
+
commonConfig.callBack?.('system_under_maintenance');
|
|
372
359
|
break;
|
|
373
360
|
case 404:
|
|
374
361
|
onFailure({
|
|
@@ -376,9 +363,7 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
376
363
|
errorCode: 0,
|
|
377
364
|
success: false
|
|
378
365
|
});
|
|
379
|
-
|
|
380
|
-
{text: langugaeCode && langugaeCode == "bn" ? "ঠিক আছে" :'OK', },
|
|
381
|
-
]);
|
|
366
|
+
commonConfig.callBack?.('system_under_maintenance');
|
|
382
367
|
break;
|
|
383
368
|
case 403:
|
|
384
369
|
onFailure({
|
|
@@ -386,9 +371,7 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
386
371
|
errorCode: 0,
|
|
387
372
|
success: false
|
|
388
373
|
});
|
|
389
|
-
|
|
390
|
-
{text: langugaeCode && langugaeCode == "bn" ? "ঠিক আছে" :'OK', },
|
|
391
|
-
]);
|
|
374
|
+
commonConfig.callBack?.('system_under_maintenance');
|
|
392
375
|
break;
|
|
393
376
|
case 504:
|
|
394
377
|
onFailure({
|
|
@@ -396,9 +379,7 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
396
379
|
errorCode: 0,
|
|
397
380
|
success: false
|
|
398
381
|
});
|
|
399
|
-
|
|
400
|
-
{text: langugaeCode && langugaeCode == "bn" ? "ঠিক আছে" :'OK', },
|
|
401
|
-
]);
|
|
382
|
+
commonConfig.callBack?.('system_under_maintenance');
|
|
402
383
|
break;
|
|
403
384
|
|
|
404
385
|
default:
|
|
@@ -412,16 +393,13 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
412
393
|
RequestID:requestId,
|
|
413
394
|
status:status,
|
|
414
395
|
params: params,
|
|
415
|
-
apiPayload:apiPayload
|
|
416
396
|
});
|
|
417
397
|
onFailure({
|
|
418
398
|
errorMessage: "",
|
|
419
399
|
errorCode: "",
|
|
420
400
|
success: false
|
|
421
401
|
});
|
|
422
|
-
|
|
423
|
-
{text: langugaeCode && langugaeCode == "bn" ? "ঠিক আছে" :'OK', },
|
|
424
|
-
]);
|
|
402
|
+
commonConfig.callBack?.('system_under_maintenance');
|
|
425
403
|
|
|
426
404
|
|
|
427
405
|
break;
|
|
@@ -435,9 +413,7 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
435
413
|
errorCode: 0,
|
|
436
414
|
success: false
|
|
437
415
|
});
|
|
438
|
-
|
|
439
|
-
{text: langugaeCode && langugaeCode == "bn" ? "ঠিক আছে" :'OK', },
|
|
440
|
-
]);
|
|
416
|
+
commonConfig.callBack?.('system_under_maintenance');
|
|
441
417
|
break;
|
|
442
418
|
case 500:
|
|
443
419
|
onFailure({
|
|
@@ -445,9 +421,7 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
445
421
|
errorCode: 0,
|
|
446
422
|
success: false
|
|
447
423
|
});
|
|
448
|
-
|
|
449
|
-
{text: langugaeCode && langugaeCode == "bn" ? "ঠিক আছে" :'OK', },
|
|
450
|
-
]);
|
|
424
|
+
commonConfig.callBack?.('system_under_maintenance');
|
|
451
425
|
break;
|
|
452
426
|
case 503:
|
|
453
427
|
onFailure({
|
|
@@ -455,9 +429,7 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
455
429
|
errorCode: 0,
|
|
456
430
|
success: false
|
|
457
431
|
});
|
|
458
|
-
|
|
459
|
-
{text: langugaeCode && langugaeCode == "bn" ? "ঠিক আছে" :'OK', },
|
|
460
|
-
]);
|
|
432
|
+
commonConfig.callBack?.('system_under_maintenance');
|
|
461
433
|
break;
|
|
462
434
|
case 404:
|
|
463
435
|
onFailure({
|
|
@@ -465,9 +437,7 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
465
437
|
errorCode: 0,
|
|
466
438
|
success: false
|
|
467
439
|
});
|
|
468
|
-
|
|
469
|
-
{text: langugaeCode && langugaeCode == "bn" ? "ঠিক আছে" :'OK', },
|
|
470
|
-
]);
|
|
440
|
+
commonConfig.callBack?.('system_under_maintenance');
|
|
471
441
|
break;
|
|
472
442
|
case 403:
|
|
473
443
|
onFailure({
|
|
@@ -475,9 +445,7 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
475
445
|
errorCode: 0,
|
|
476
446
|
success: false
|
|
477
447
|
});
|
|
478
|
-
|
|
479
|
-
{text: langugaeCode && langugaeCode == "bn" ? "ঠিক আছে" :'OK', },
|
|
480
|
-
]);
|
|
448
|
+
commonConfig.callBack?.('system_under_maintenance');
|
|
481
449
|
break;
|
|
482
450
|
case 504:
|
|
483
451
|
onFailure({
|
|
@@ -485,9 +453,7 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
485
453
|
errorCode: 0,
|
|
486
454
|
success: false
|
|
487
455
|
});
|
|
488
|
-
|
|
489
|
-
{text: langugaeCode && langugaeCode == "bn" ? "ঠিক আছে" :'OK', },
|
|
490
|
-
]);
|
|
456
|
+
commonConfig.callBack?.('system_under_maintenance');
|
|
491
457
|
break;
|
|
492
458
|
|
|
493
459
|
default:
|
|
@@ -501,16 +467,13 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
501
467
|
RequestID:requestId,
|
|
502
468
|
status:status,
|
|
503
469
|
params: params,
|
|
504
|
-
apiPayload:apiPayload
|
|
505
470
|
});
|
|
506
471
|
onFailure({
|
|
507
472
|
errorMessage: "",
|
|
508
473
|
errorCode: "",
|
|
509
474
|
success: false
|
|
510
475
|
});
|
|
511
|
-
|
|
512
|
-
{text: langugaeCode && langugaeCode == "bn" ? "ঠিক আছে" :'OK', },
|
|
513
|
-
]);
|
|
476
|
+
commonConfig.callBack?.('system_under_maintenance');
|
|
514
477
|
|
|
515
478
|
|
|
516
479
|
break;
|
|
@@ -524,9 +487,7 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
524
487
|
errorCode: "",
|
|
525
488
|
success: false
|
|
526
489
|
});
|
|
527
|
-
|
|
528
|
-
{text: langugaeCode && langugaeCode == "bn" ? "ঠিক আছে" :'OK', },
|
|
529
|
-
]);
|
|
490
|
+
commonConfig.callBack?.('no_internet_connection');
|
|
530
491
|
return;
|
|
531
492
|
}
|
|
532
493
|
|
|
@@ -539,7 +500,6 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
539
500
|
RequestID:requestId,
|
|
540
501
|
status:status,
|
|
541
502
|
params: params,
|
|
542
|
-
apiPayload:apiPayload
|
|
543
503
|
});
|
|
544
504
|
|
|
545
505
|
onFailure({
|
|
@@ -558,7 +518,6 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
558
518
|
RequestID:requestId,
|
|
559
519
|
status:status,
|
|
560
520
|
params: params,
|
|
561
|
-
apiPayload:apiPayload
|
|
562
521
|
});
|
|
563
522
|
|
|
564
523
|
onFailure({
|
|
@@ -567,4 +526,5 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
567
526
|
});
|
|
568
527
|
}
|
|
569
528
|
});
|
|
570
|
-
}
|
|
529
|
+
// }
|
|
530
|
+
};
|
package/src/utils/DatadogTxn.ts
CHANGED
|
@@ -1,21 +1,55 @@
|
|
|
1
|
-
|
|
1
|
+
type DatadogModule = {
|
|
2
|
+
DdLogs?: {
|
|
3
|
+
info?: (message: string, context?: any) => void;
|
|
4
|
+
warn?: (message: string, context?: any) => void;
|
|
5
|
+
error?: (message: string, context?: any) => void;
|
|
6
|
+
};
|
|
7
|
+
DdSdkReactNative?: {
|
|
8
|
+
initialize?: (config: any) => Promise<any>;
|
|
9
|
+
setUserInfo?: (user: any) => void;
|
|
10
|
+
};
|
|
11
|
+
DdSdkReactNativeConfiguration?: new (
|
|
12
|
+
clientToken: string,
|
|
13
|
+
env: string,
|
|
14
|
+
applicationId: string,
|
|
15
|
+
trackInteractions: boolean,
|
|
16
|
+
trackResources: boolean,
|
|
17
|
+
trackErrors: boolean
|
|
18
|
+
) => any;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
function getDatadog(): DatadogModule | null {
|
|
22
|
+
try {
|
|
23
|
+
// Optional dependency: consumers may not ship Datadog.
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
25
|
+
return require('@datadog/mobile-react-native') as DatadogModule;
|
|
26
|
+
} catch {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
2
30
|
|
|
3
31
|
export default {
|
|
4
32
|
|
|
5
33
|
info(message: string, params: any) {
|
|
6
|
-
|
|
34
|
+
const dd = getDatadog();
|
|
35
|
+
dd?.DdLogs?.info?.(message, params);
|
|
7
36
|
},
|
|
8
37
|
|
|
9
38
|
warn(message: string, params: any) {
|
|
10
|
-
|
|
39
|
+
const dd = getDatadog();
|
|
40
|
+
dd?.DdLogs?.warn?.(message, params);
|
|
11
41
|
},
|
|
12
42
|
|
|
13
43
|
error(message: string, params: any) {
|
|
14
|
-
|
|
44
|
+
const dd = getDatadog();
|
|
45
|
+
dd?.DdLogs?.error?.(message, params);
|
|
15
46
|
},
|
|
16
47
|
|
|
17
48
|
async setDataDogLogger(clientToken: string, DEV: string, applicationId: string, serviceName: string) {
|
|
18
|
-
|
|
49
|
+
const dd = getDatadog();
|
|
50
|
+
if (!dd?.DdSdkReactNativeConfiguration || !dd?.DdSdkReactNative?.initialize) return;
|
|
51
|
+
|
|
52
|
+
let config = new dd.DdSdkReactNativeConfiguration(
|
|
19
53
|
clientToken,
|
|
20
54
|
DEV,
|
|
21
55
|
applicationId,
|
|
@@ -30,7 +64,7 @@ export default {
|
|
|
30
64
|
config["resourceTracingSamplingRate"] = 100;
|
|
31
65
|
config["serviceName"] = serviceName;
|
|
32
66
|
|
|
33
|
-
DdSdkReactNative.initialize(config).then((
|
|
67
|
+
dd.DdSdkReactNative.initialize(config).then((_dataDogRes: any) => {
|
|
34
68
|
console.info("-----DATA DOG CUSTOMER TXN INIT SUCCESS-----");
|
|
35
69
|
}).catch((error: any) => {
|
|
36
70
|
console.error("-----DATA DOG CUSTOMER TXN INIT ERROR-----", error);
|
|
@@ -38,10 +72,11 @@ export default {
|
|
|
38
72
|
},
|
|
39
73
|
|
|
40
74
|
setUser(user: any) {
|
|
41
|
-
|
|
75
|
+
const dd = getDatadog();
|
|
76
|
+
dd?.DdSdkReactNative?.setUserInfo?.(user);
|
|
42
77
|
},
|
|
43
78
|
|
|
44
79
|
setDefaultAttribute(key: string, params: any) {
|
|
45
|
-
DdSdkReactNative.setAttributes(params);
|
|
80
|
+
// DdSdkReactNative.setAttributes(params);
|
|
46
81
|
},
|
|
47
82
|
}
|
|
Binary file
|