banking_dcb_sdk_react_native 0.1.9
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/LICENSE +20 -0
- package/PartnerReactNativeSdk.podspec +31 -0
- package/README.md +14 -0
- package/android/build.gradle +100 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/partnerreactnativesdk/PartnerReactNativeSdkModule.kt +23 -0
- package/android/src/main/java/com/partnerreactnativesdk/PartnerReactNativeSdkPackage.kt +33 -0
- package/ios/PartnerReactNativeSdk.h +6 -0
- package/ios/PartnerReactNativeSdk.mm +29 -0
- package/lib/module/helpers/ServiceNames.js +135 -0
- package/lib/module/helpers/ServiceNames.js.map +1 -0
- package/lib/module/helpers/analytics/analytics_event_model.js +37 -0
- package/lib/module/helpers/analytics/analytics_event_model.js.map +1 -0
- package/lib/module/helpers/analytics/analytics_logger.js +73 -0
- package/lib/module/helpers/analytics/analytics_logger.js.map +1 -0
- package/lib/module/helpers/analytics/event_storage.js +35 -0
- package/lib/module/helpers/analytics/event_storage.js.map +1 -0
- package/lib/module/helpers/banking_dcb_react_native.js +297 -0
- package/lib/module/helpers/banking_dcb_react_native.js.map +1 -0
- package/lib/module/helpers/helper.js +4 -0
- package/lib/module/helpers/helper.js.map +1 -0
- package/lib/module/helpers/network/APICall.js +111 -0
- package/lib/module/helpers/network/APICall.js.map +1 -0
- package/lib/module/helpers/network/Encryption.js +148 -0
- package/lib/module/helpers/network/Encryption.js.map +1 -0
- package/lib/module/helpers/network/network_manager.js +112 -0
- package/lib/module/helpers/network/network_manager.js.map +1 -0
- package/lib/module/helpers/utils/Constants.js +12 -0
- package/lib/module/helpers/utils/Constants.js.map +1 -0
- package/lib/module/helpers/utils/LibraryConstants.js +115 -0
- package/lib/module/helpers/utils/LibraryConstants.js.map +1 -0
- package/lib/module/helpers/utils/deviceInfoManager.js +39 -0
- package/lib/module/helpers/utils/deviceInfoManager.js.map +1 -0
- package/lib/module/helpers/utils/headerManager.js +21 -0
- package/lib/module/helpers/utils/headerManager.js.map +1 -0
- package/lib/module/helpers/utils/themeManager.js +40 -0
- package/lib/module/helpers/utils/themeManager.js.map +1 -0
- package/lib/module/helpers/utils/webviewCallback.js +20 -0
- package/lib/module/helpers/utils/webviewCallback.js.map +1 -0
- package/lib/module/helpers/webview.js +314 -0
- package/lib/module/helpers/webview.js.map +1 -0
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/helpers/ServiceNames.d.ts +51 -0
- package/lib/typescript/src/helpers/ServiceNames.d.ts.map +1 -0
- package/lib/typescript/src/helpers/analytics/analytics_event_model.d.ts +16 -0
- package/lib/typescript/src/helpers/analytics/analytics_event_model.d.ts.map +1 -0
- package/lib/typescript/src/helpers/analytics/analytics_logger.d.ts +17 -0
- package/lib/typescript/src/helpers/analytics/analytics_logger.d.ts.map +1 -0
- package/lib/typescript/src/helpers/analytics/event_storage.d.ts +8 -0
- package/lib/typescript/src/helpers/analytics/event_storage.d.ts.map +1 -0
- package/lib/typescript/src/helpers/banking_dcb_react_native.d.ts +33 -0
- package/lib/typescript/src/helpers/banking_dcb_react_native.d.ts.map +1 -0
- package/lib/typescript/src/helpers/helper.d.ts +1 -0
- package/lib/typescript/src/helpers/helper.d.ts.map +1 -0
- package/lib/typescript/src/helpers/network/APICall.d.ts +13 -0
- package/lib/typescript/src/helpers/network/APICall.d.ts.map +1 -0
- package/lib/typescript/src/helpers/network/Encryption.d.ts +24 -0
- package/lib/typescript/src/helpers/network/Encryption.d.ts.map +1 -0
- package/lib/typescript/src/helpers/network/network_manager.d.ts +21 -0
- package/lib/typescript/src/helpers/network/network_manager.d.ts.map +1 -0
- package/lib/typescript/src/helpers/utils/Constants.d.ts +10 -0
- package/lib/typescript/src/helpers/utils/Constants.d.ts.map +1 -0
- package/lib/typescript/src/helpers/utils/LibraryConstants.d.ts +24 -0
- package/lib/typescript/src/helpers/utils/LibraryConstants.d.ts.map +1 -0
- package/lib/typescript/src/helpers/utils/deviceInfoManager.d.ts +4 -0
- package/lib/typescript/src/helpers/utils/deviceInfoManager.d.ts.map +1 -0
- package/lib/typescript/src/helpers/utils/headerManager.d.ts +5 -0
- package/lib/typescript/src/helpers/utils/headerManager.d.ts.map +1 -0
- package/lib/typescript/src/helpers/utils/themeManager.d.ts +12 -0
- package/lib/typescript/src/helpers/utils/themeManager.d.ts.map +1 -0
- package/lib/typescript/src/helpers/utils/webviewCallback.d.ts +13 -0
- package/lib/typescript/src/helpers/utils/webviewCallback.d.ts.map +1 -0
- package/lib/typescript/src/helpers/webview.d.ts +21 -0
- package/lib/typescript/src/helpers/webview.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +5 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +170 -0
- package/react-native.config.js +12 -0
- package/src/helpers/ServiceNames.tsx +170 -0
- package/src/helpers/analytics/analytics_event_model.tsx +47 -0
- package/src/helpers/analytics/analytics_logger.tsx +91 -0
- package/src/helpers/analytics/event_storage.tsx +44 -0
- package/src/helpers/banking_dcb_react_native.tsx +413 -0
- package/src/helpers/helper.tsx +1 -0
- package/src/helpers/network/APICall.tsx +154 -0
- package/src/helpers/network/Encryption.tsx +179 -0
- package/src/helpers/network/network_manager.tsx +122 -0
- package/src/helpers/utils/Constants.tsx +10 -0
- package/src/helpers/utils/LibraryConstants.tsx +133 -0
- package/src/helpers/utils/deviceInfoManager.tsx +37 -0
- package/src/helpers/utils/headerManager.tsx +22 -0
- package/src/helpers/utils/themeManager.tsx +51 -0
- package/src/helpers/utils/webviewCallback.tsx +25 -0
- package/src/helpers/webview.tsx +410 -0
- package/src/index.tsx +5 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deviceInfoManager.d.ts","sourceRoot":"","sources":["../../../../../src/helpers/utils/deviceInfoManager.tsx"],"names":[],"mappings":"AAIA,qBAAa,iBAAiB;WACb,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CA+BhE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"headerManager.d.ts","sourceRoot":"","sources":["../../../../../src/helpers/utils/headerManager.tsx"],"names":[],"mappings":"AAIA,qBAAa,aAAa;IAEtB,OAAO,CAAC,iBAAiB,CAAqB;IAExC,eAAe,CAAC,WAAW,GAAE,OAAc,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAatF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface Theme {
|
|
2
|
+
primaryColor: string;
|
|
3
|
+
}
|
|
4
|
+
export declare class ThemeManager {
|
|
5
|
+
constructor();
|
|
6
|
+
static savePrimaryColor(color: string): Promise<void>;
|
|
7
|
+
static loadPrimaryColor(): Promise<string | null>;
|
|
8
|
+
static getAppTheme(): Theme;
|
|
9
|
+
static configureStatusBar(): void;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=themeManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themeManager.d.ts","sourceRoot":"","sources":["../../../../../src/helpers/utils/themeManager.tsx"],"names":[],"mappings":"AAKA,UAAU,KAAK;IACX,YAAY,EAAE,MAAM,CAAC;CACxB;AAED,qBAAa,YAAY;;WAOR,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;WAS9C,gBAAgB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IASvD,MAAM,CAAC,WAAW,IAAI,KAAK;IAM3B,MAAM,CAAC,kBAAkB,IAAI,IAAI;CAUpC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare enum WebViewCallbackType {
|
|
2
|
+
Logout = "logout",
|
|
3
|
+
Redirect = "redirect"
|
|
4
|
+
}
|
|
5
|
+
export declare class WebViewCallback {
|
|
6
|
+
type: WebViewCallbackType;
|
|
7
|
+
status?: string | null;
|
|
8
|
+
private constructor();
|
|
9
|
+
static logout(): WebViewCallback;
|
|
10
|
+
static redirect(status?: string | null): WebViewCallback;
|
|
11
|
+
}
|
|
12
|
+
export type WebViewCallbackFunction = (callback: WebViewCallback) => void;
|
|
13
|
+
//# sourceMappingURL=webviewCallback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webviewCallback.d.ts","sourceRoot":"","sources":["../../../../../src/helpers/utils/webviewCallback.tsx"],"names":[],"mappings":"AAAA,oBAAY,mBAAmB;IAE3B,MAAM,WAAW;IACjB,QAAQ,aAAa;CACxB;AAED,qBAAa,eAAe;IACxB,IAAI,EAAE,mBAAmB,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEvB,OAAO;IAKP,MAAM,CAAC,MAAM,IAAI,eAAe;IAIhC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,eAAe;CAG3D;AAED,MAAM,MAAM,uBAAuB,GAAG,CAAC,QAAQ,EAAE,eAAe,KAAK,IAAI,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type WebViewProps } from 'react-native-webview';
|
|
2
|
+
import { type WebViewCallbackFunction } from './utils/webviewCallback';
|
|
3
|
+
interface ExtendedWebViewProps extends WebViewProps {
|
|
4
|
+
onPermissionRequest?: (event: any) => void;
|
|
5
|
+
androidPermissions?: {
|
|
6
|
+
camera?: boolean;
|
|
7
|
+
microphone?: boolean;
|
|
8
|
+
geolocation?: boolean;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
interface WebViewCustomProps {
|
|
12
|
+
url: string;
|
|
13
|
+
options?: Partial<ExtendedWebViewProps>;
|
|
14
|
+
onCallback?: WebViewCallbackFunction;
|
|
15
|
+
hostName?: string;
|
|
16
|
+
whitelistedUrls?: string[];
|
|
17
|
+
onPageFinished?: () => void;
|
|
18
|
+
}
|
|
19
|
+
export declare const WebView: ({ url, options, onCallback, hostName, whitelistedUrls, onPageFinished, }: WebViewCustomProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=webview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webview.d.ts","sourceRoot":"","sources":["../../../../src/helpers/webview.tsx"],"names":[],"mappings":"AAaA,OAAO,EACL,KAAK,YAAY,EAElB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,yBAAyB,CAAC;AAajC,UAAU,oBAAqB,SAAQ,YAAY;IACjD,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IAC3C,kBAAkB,CAAC,EAAE;QACnB,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,CAAC;CACH;AACD,UAAU,kBAAkB;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACxC,UAAU,CAAC,EAAE,uBAAuB,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;CAC7B;AAUD,eAAO,MAAM,OAAO,GAAI,0EAOrB,kBAAkB,4CAwVpB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { BankingDcbReactNative } from './helpers/banking_dcb_react_native';
|
|
2
|
+
export { WebView } from './helpers/webview';
|
|
3
|
+
import type { WebViewCallbackFunction } from './helpers/utils/webviewCallback';
|
|
4
|
+
export type { WebViewCallbackFunction };
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAE3E,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC/E,YAAY,EAAE,uBAAuB,EAAE,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "banking_dcb_sdk_react_native",
|
|
3
|
+
"version": "0.1.9",
|
|
4
|
+
"description": "React Native package for partner integrating with DCB",
|
|
5
|
+
"source": "./src/index.tsx",
|
|
6
|
+
"main": "./lib/module/index.js",
|
|
7
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
11
|
+
"default": "./lib/module/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./package.json": "./package.json"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"src",
|
|
17
|
+
"lib",
|
|
18
|
+
"android",
|
|
19
|
+
"ios",
|
|
20
|
+
"cpp",
|
|
21
|
+
"*.podspec",
|
|
22
|
+
"react-native.config.js",
|
|
23
|
+
"!ios/build",
|
|
24
|
+
"!android/build",
|
|
25
|
+
"!android/gradle",
|
|
26
|
+
"!android/gradlew",
|
|
27
|
+
"!android/gradlew.bat",
|
|
28
|
+
"!android/local.properties",
|
|
29
|
+
"!**/__tests__",
|
|
30
|
+
"!**/__fixtures__",
|
|
31
|
+
"!**/__mocks__",
|
|
32
|
+
"!**/.*",
|
|
33
|
+
"!ios/generated/**",
|
|
34
|
+
"!android/generated/**"
|
|
35
|
+
],
|
|
36
|
+
"scripts": {
|
|
37
|
+
"example": "yarn workspace partner_react_native_sdk-example",
|
|
38
|
+
"test": "jest",
|
|
39
|
+
"typecheck": "tsc",
|
|
40
|
+
"lint": "eslint \"**/*.{js}\"",
|
|
41
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
42
|
+
"prepare": "bob build",
|
|
43
|
+
"release": "release-it"
|
|
44
|
+
},
|
|
45
|
+
"keywords": [
|
|
46
|
+
"react-native",
|
|
47
|
+
"ios",
|
|
48
|
+
"android"
|
|
49
|
+
],
|
|
50
|
+
"repository": {
|
|
51
|
+
"type": "git",
|
|
52
|
+
"url": "git+https://github.com/spense-fintech/banking-dcb-sdk-react-native.git.git"
|
|
53
|
+
},
|
|
54
|
+
"author": "Rohit <rohit.kumar@spense.money> (https://github.com/RohitSpense)",
|
|
55
|
+
"license": "MIT",
|
|
56
|
+
"bugs": {
|
|
57
|
+
"url": "https://github.com/spense-fintech/banking-dcb-sdk-react-native.git/issues"
|
|
58
|
+
},
|
|
59
|
+
"homepage": "https://github.com/spense-fintech/banking-dcb-sdk-react-native.git#readme",
|
|
60
|
+
"publishConfig": {
|
|
61
|
+
"registry": "https://registry.npmjs.org/"
|
|
62
|
+
},
|
|
63
|
+
"devDependencies": {
|
|
64
|
+
"@commitlint/config-conventional": "^19.6.0",
|
|
65
|
+
"@eslint/compat": "^1.2.7",
|
|
66
|
+
"@eslint/eslintrc": "^3.3.0",
|
|
67
|
+
"@eslint/js": "^9.22.0",
|
|
68
|
+
"@evilmartians/lefthook": "^1.5.0",
|
|
69
|
+
"@react-native-community/cli": "15.0.1",
|
|
70
|
+
"@react-native/eslint-config": "^0.78.0",
|
|
71
|
+
"@release-it/conventional-changelog": "^9.0.2",
|
|
72
|
+
"@types/jest": "^29.5.5",
|
|
73
|
+
"@types/react": "^19.0.0",
|
|
74
|
+
"@types/uuid": "^10.0.0",
|
|
75
|
+
"@typescript-eslint/eslint-plugin": "^8.31.0",
|
|
76
|
+
"@typescript-eslint/parser": "^8.31.0",
|
|
77
|
+
"commitlint": "^19.6.1",
|
|
78
|
+
"del-cli": "^5.1.0",
|
|
79
|
+
"jest": "^29.7.0",
|
|
80
|
+
"prettier": "^3.0.3",
|
|
81
|
+
"react": "19.0.0",
|
|
82
|
+
"react-native": "0.78.2",
|
|
83
|
+
"react-native-builder-bob": "0.39.0",
|
|
84
|
+
"release-it": "^17.10.0",
|
|
85
|
+
"turbo": "^1.10.7",
|
|
86
|
+
"typescript": "^5.2.2"
|
|
87
|
+
},
|
|
88
|
+
"peerDependencies": {
|
|
89
|
+
"react": "*",
|
|
90
|
+
"react-native": "*",
|
|
91
|
+
"@react-native-cookies/cookies": "*",
|
|
92
|
+
"axios": "*",
|
|
93
|
+
"react-native-device-info": "*",
|
|
94
|
+
"react-native-file-viewer": "*",
|
|
95
|
+
"react-native-fs": "*",
|
|
96
|
+
"react-native-permissions": "*",
|
|
97
|
+
"react-native-safe-area-context": "*",
|
|
98
|
+
"react-native-screens": "*",
|
|
99
|
+
"react-native-webview": "*",
|
|
100
|
+
"@react-native-async-storage/async-storage": "*",
|
|
101
|
+
"async-storage": "*",
|
|
102
|
+
"react-native-blob-util": "*",
|
|
103
|
+
"react-native-quick-crypto": "*",
|
|
104
|
+
"base64-js": "*",
|
|
105
|
+
"uuid": "*"
|
|
106
|
+
},
|
|
107
|
+
"workspaces": [
|
|
108
|
+
"example"
|
|
109
|
+
],
|
|
110
|
+
"packageManager": "yarn@3.6.1",
|
|
111
|
+
"jest": {
|
|
112
|
+
"preset": "react-native",
|
|
113
|
+
"modulePathIgnorePatterns": [
|
|
114
|
+
"<rootDir>/example/node_modules",
|
|
115
|
+
"<rootDir>/lib/"
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
"commitlint": {
|
|
119
|
+
"extends": [
|
|
120
|
+
"@commitlint/config-conventional"
|
|
121
|
+
]
|
|
122
|
+
},
|
|
123
|
+
"release-it": {
|
|
124
|
+
"git": {
|
|
125
|
+
"commitMessage": "chore: release ${version}",
|
|
126
|
+
"tagName": "v${version}"
|
|
127
|
+
},
|
|
128
|
+
"npm": {
|
|
129
|
+
"publish": true
|
|
130
|
+
},
|
|
131
|
+
"github": {
|
|
132
|
+
"release": true
|
|
133
|
+
},
|
|
134
|
+
"plugins": {
|
|
135
|
+
"@release-it/conventional-changelog": {
|
|
136
|
+
"preset": {
|
|
137
|
+
"name": "angular"
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
"prettier": {
|
|
143
|
+
"quoteProps": "consistent",
|
|
144
|
+
"singleQuote": true,
|
|
145
|
+
"tabWidth": 2,
|
|
146
|
+
"trailingComma": "es5",
|
|
147
|
+
"useTabs": false
|
|
148
|
+
},
|
|
149
|
+
"react-native-builder-bob": {
|
|
150
|
+
"source": "src",
|
|
151
|
+
"output": "lib",
|
|
152
|
+
"targets": [
|
|
153
|
+
[
|
|
154
|
+
"module",
|
|
155
|
+
{
|
|
156
|
+
"esm": true
|
|
157
|
+
}
|
|
158
|
+
],
|
|
159
|
+
[
|
|
160
|
+
"typescript",
|
|
161
|
+
{
|
|
162
|
+
"project": "tsconfig.build.json"
|
|
163
|
+
}
|
|
164
|
+
]
|
|
165
|
+
]
|
|
166
|
+
},
|
|
167
|
+
"dependencies": {
|
|
168
|
+
"react-native-get-random-values": "^1.11.0"
|
|
169
|
+
}
|
|
170
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { LibraryConstants } from './utils/LibraryConstants';
|
|
2
|
+
|
|
3
|
+
function injectParams(url: string, params: Record<string, string>): string {
|
|
4
|
+
let result = url;
|
|
5
|
+
Object.keys(params).forEach(key => {
|
|
6
|
+
result = result.replace(`{${key}}`, params[key] ? params[key] : '');
|
|
7
|
+
});
|
|
8
|
+
return result;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export class ServiceNames {
|
|
12
|
+
private static get HOST_URL(): string {
|
|
13
|
+
return `${LibraryConstants.hostName}/api`;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
static get LOGGED_IN_URL(): string {
|
|
17
|
+
return `${this.HOST_URL}/user/session`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static get LOGIN_URL(): string {
|
|
21
|
+
return `${this.HOST_URL}/user/token`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
static get THEME_URL(): string {
|
|
25
|
+
return `${this.HOST_URL}/themes`;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
static get WEBSITE_KEYS(): string {
|
|
29
|
+
return `${this.HOST_URL}/network/keys`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
static get ANALYTICS_URL(): string {
|
|
33
|
+
return `${this.HOST_URL}/utils/event/SDK_EVENT`;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
static readonly USER_SLUG = "/user";
|
|
37
|
+
static readonly GLOBAL_SLUG = "/global";
|
|
38
|
+
static readonly BANKING_SLUG = "/banking/{bank}";
|
|
39
|
+
static readonly BANKING_ONBOARDING_SLUG = `${this.BANKING_SLUG}/onboarding`;
|
|
40
|
+
static readonly BANKING_SAVING_SLUG = `${this.BANKING_SLUG}/saving`;
|
|
41
|
+
static readonly BANKING_SAVING_BENEFICIARY_SLUG = `${this.BANKING_SAVING_SLUG}/beneficiary`;
|
|
42
|
+
static readonly BANKING_FIXED_SLUG = `${this.BANKING_SLUG}/fixed`;
|
|
43
|
+
static readonly PPI_SLUG = "/ppi";
|
|
44
|
+
static readonly DEVICE_SLUG = "/device/{partner}";
|
|
45
|
+
|
|
46
|
+
static get BANKING_APP_CONSENT(): string {
|
|
47
|
+
return `${this.HOST_URL}${this.BANKING_SLUG}/mobile/consent`;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
static get BANKING_CUSTOMER_CHECK(): string {
|
|
51
|
+
return `${this.HOST_URL}${this.BANKING_SLUG}/customer/check`;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
static get BANKING_FIXED(): string {
|
|
55
|
+
return `${this.HOST_URL}${this.BANKING_FIXED_SLUG}`;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
static get BANKING_FIXED_BALANCE(): string {
|
|
59
|
+
return `${this.HOST_URL}${this.BANKING_FIXED_SLUG}/balance`;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
static get BANKING_FIXED_ACCOUNT_ID(): string {
|
|
63
|
+
return `${this.HOST_URL}${this.BANKING_FIXED_SLUG}/{account_id}`;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
static get BANKING_ONBOARDING_NEXT(): string {
|
|
67
|
+
return `${this.HOST_URL}${this.BANKING_ONBOARDING_SLUG}/next`;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
static get BANKING_ONBOARDING_JOURNEY(): string {
|
|
71
|
+
return `${this.HOST_URL}${this.BANKING_ONBOARDING_SLUG}/journey`;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
static get BANKING_ONBOARDING_PHONE_INPUT(): string {
|
|
75
|
+
return `${this.HOST_URL}${this.BANKING_ONBOARDING_SLUG}/phone/input`;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
static get BANKING_ONBOARDING_PHONE_OTP_VERIFY(): string {
|
|
79
|
+
return `${this.HOST_URL}${this.BANKING_ONBOARDING_SLUG}/phone/otp_verify`;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
static get BANKING_ONBOARDING_EMAIL_INPUT(): string {
|
|
83
|
+
return `${this.HOST_URL}${this.BANKING_ONBOARDING_SLUG}/email/input`;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
static get BANKING_ONBOARDING_EMAIL_OTP_VERIFY(): string {
|
|
87
|
+
return `${this.HOST_URL}${this.BANKING_ONBOARDING_SLUG}/email/otp_verify`;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
static get BANKING_ONBOARDING_PAN(): string {
|
|
91
|
+
return `${this.HOST_URL}${this.BANKING_ONBOARDING_SLUG}/pan`;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
static get BANKING_ONBOARDING_AADHAAR(): string {
|
|
95
|
+
return `${this.HOST_URL}${this.BANKING_ONBOARDING_SLUG}/aadhaar`;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
static get BANKING_ONBOARDING_APPLICATION(): string {
|
|
99
|
+
return `${this.HOST_URL}${this.BANKING_ONBOARDING_SLUG}/application`;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
static get BANKING_ONBOARDING_APPLICATION_VIEW(): string {
|
|
103
|
+
return `${this.HOST_URL}${this.BANKING_ONBOARDING_SLUG}/application/view`;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
static get BANKING_ONBOARDING_TERMS(): string {
|
|
107
|
+
return `${this.HOST_URL}${this.BANKING_ONBOARDING_SLUG}/terms`;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
static get BANKING_ONBOARDING_VKYC_SETUP(): string {
|
|
111
|
+
return `${this.HOST_URL}${this.BANKING_ONBOARDING_SLUG}/vkyc/setup`;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
static get BANKING_ONBOARDING_VKYC_WEBLINK(): string {
|
|
115
|
+
return `${this.HOST_URL}${this.BANKING_ONBOARDING_SLUG}/vkyc/weblink`;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
static get BANKING_ONBOARDING_VKYC_SLOT(): string {
|
|
119
|
+
return `${this.HOST_URL}${this.BANKING_ONBOARDING_SLUG}/vkyc/slot`;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
static get BANKING_PRODUCTS(): string {
|
|
123
|
+
return `${this.HOST_URL}${this.BANKING_SLUG}/accounts/count`;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
static get BANKING_SAVING(): string {
|
|
127
|
+
return `${this.HOST_URL}${this.BANKING_SAVING_SLUG}`;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
static get BANKING_SAVING_BALANCE(): string {
|
|
131
|
+
return `${this.HOST_URL}${this.BANKING_SAVING_SLUG}/balance`;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
static get BANKING_SAVING_BENEFICIARY(): string {
|
|
135
|
+
return `${this.HOST_URL}${this.BANKING_SAVING_BENEFICIARY_SLUG}`;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
static get BANKING_SAVING_BENEFICIARY_ID(): string {
|
|
139
|
+
return `${this.HOST_URL}${this.BANKING_SAVING_BENEFICIARY_SLUG}/{beneficiary_id}`;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
static get BANKING_SAVING_TRANSACTIONS(): string {
|
|
143
|
+
return `${this.HOST_URL}${this.BANKING_SAVING_SLUG}/transactions`;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
static get DEVICE_BIND(): string {
|
|
147
|
+
return `${this.HOST_URL}${this.DEVICE_SLUG}/bind`;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
static get DEVICE_SESSION() {
|
|
151
|
+
return {
|
|
152
|
+
url: `${this.HOST_URL}${this.DEVICE_SLUG}/session`,
|
|
153
|
+
params(params: Record<string, string>) {
|
|
154
|
+
return injectParams(this.url, params);
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
static get LOGOUT(): string {
|
|
160
|
+
return `${this.HOST_URL}${this.USER_SLUG}/logout`;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
static get PPI_PARTNER_VERIFY(): string {
|
|
164
|
+
return `${this.HOST_URL}${this.PPI_SLUG}/partner/verify/`;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
static get TIME(): string {
|
|
168
|
+
return `${this.HOST_URL}${this.GLOBAL_SLUG}/time`;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export interface AnalyticsEventProps {
|
|
2
|
+
|
|
3
|
+
time: string;
|
|
4
|
+
info: Record<string, any>;
|
|
5
|
+
device: Record<string, any>;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export class AnalyticsEvent {
|
|
10
|
+
time: string;
|
|
11
|
+
info: Record<string, any>;
|
|
12
|
+
device: Record<string, any>;
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
constructor({ time, info, device }: AnalyticsEventProps) {
|
|
16
|
+
this.time = time;
|
|
17
|
+
this.info = info;
|
|
18
|
+
this.device = device;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
toJson(): Record<string, any> {
|
|
22
|
+
return {
|
|
23
|
+
time: this.time,
|
|
24
|
+
event: {
|
|
25
|
+
info: this.info,
|
|
26
|
+
device: this.device,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
static fromJson(json: Record<string, any>): AnalyticsEvent {
|
|
32
|
+
return new AnalyticsEvent({
|
|
33
|
+
time: json['time'],
|
|
34
|
+
info: json['event']['info'],
|
|
35
|
+
device: json['event']['device'],
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
static listFromJson(jsonString: string): AnalyticsEvent[] {
|
|
40
|
+
const decodedJson = JSON.parse(jsonString);
|
|
41
|
+
return decodedJson.map((json: any) => AnalyticsEvent.fromJson(json));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
static listToJson(events: AnalyticsEvent[]): string {
|
|
45
|
+
return JSON.stringify(events.map((event) => event.toJson()));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { APICall } from '../network/APICall';
|
|
2
|
+
import { ServiceNames } from '../ServiceNames';
|
|
3
|
+
import { DeviceInfoManager } from '../utils/deviceInfoManager';
|
|
4
|
+
import { AnalyticsEvent } from './analytics_event_model';
|
|
5
|
+
import { EventStorage } from './event_storage';
|
|
6
|
+
|
|
7
|
+
export class AnalyticsLogger {
|
|
8
|
+
private static instance: AnalyticsLogger;
|
|
9
|
+
|
|
10
|
+
private apiCall = new APICall();
|
|
11
|
+
|
|
12
|
+
private events: AnalyticsEvent[] = [];
|
|
13
|
+
private debouncerTimer: ReturnType<typeof setTimeout> | null = null;
|
|
14
|
+
private _lastPost = 0;
|
|
15
|
+
private readonly maxBatchSize = 100;
|
|
16
|
+
private readonly maxInterval = 10 * 60 * 1000;
|
|
17
|
+
private readonly analyticsUrl = ServiceNames.ANALYTICS_URL;
|
|
18
|
+
private readonly eventStorage = new EventStorage();
|
|
19
|
+
|
|
20
|
+
constructor() {}
|
|
21
|
+
|
|
22
|
+
public static getInstance(): AnalyticsLogger {
|
|
23
|
+
if (!AnalyticsLogger.instance) {
|
|
24
|
+
AnalyticsLogger.instance = new AnalyticsLogger();
|
|
25
|
+
}
|
|
26
|
+
return AnalyticsLogger.instance;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public async logEvent(info: Record<string, any>): Promise<void> {
|
|
30
|
+
const device = await DeviceInfoManager.getDeviceInfo();
|
|
31
|
+
const now = new Date()
|
|
32
|
+
.toLocaleString('sv-SE')
|
|
33
|
+
.replace('T', ' ')
|
|
34
|
+
.slice(0, 19);
|
|
35
|
+
// console.log('Logging event:', info);
|
|
36
|
+
|
|
37
|
+
const event = new AnalyticsEvent({ time: now, info, device });
|
|
38
|
+
|
|
39
|
+
this.events = await this.eventStorage.loadEvents();
|
|
40
|
+
this.events.push(event);
|
|
41
|
+
|
|
42
|
+
await this.eventStorage.saveEvents(this.events);
|
|
43
|
+
|
|
44
|
+
const nowMillis = Date.now();
|
|
45
|
+
|
|
46
|
+
if (
|
|
47
|
+
this.events.length >= this.maxBatchSize ||
|
|
48
|
+
nowMillis - this._lastPost > this.maxInterval
|
|
49
|
+
) {
|
|
50
|
+
await this.post();
|
|
51
|
+
} else {
|
|
52
|
+
this.debouncePost();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
private debouncePost(): void {
|
|
57
|
+
if (this.debouncerTimer) {
|
|
58
|
+
clearTimeout(this.debouncerTimer);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
this.debouncerTimer = setTimeout(() => {
|
|
62
|
+
this.post(); // call post() after delay
|
|
63
|
+
}, 10000); // 10 seconds in milliseconds
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
private async post(): Promise<void> {
|
|
67
|
+
if (this.events.length == 0) return;
|
|
68
|
+
|
|
69
|
+
const eventsToSend = [...this.events];
|
|
70
|
+
this.events = [];
|
|
71
|
+
|
|
72
|
+
this._lastPost = Date.now();
|
|
73
|
+
|
|
74
|
+
try {
|
|
75
|
+
// console.log("ANALYTICS_URL ", this.analyticsUrl);
|
|
76
|
+
// console.log('Posting events:', eventsToSend);
|
|
77
|
+
const payload = {
|
|
78
|
+
body: { data: eventsToSend.map((event) => event.toJson()) },
|
|
79
|
+
};
|
|
80
|
+
const response = await this.apiCall.callAPI(
|
|
81
|
+
'POST',
|
|
82
|
+
this.analyticsUrl,
|
|
83
|
+
payload
|
|
84
|
+
);
|
|
85
|
+
await this.eventStorage.clearEvents();
|
|
86
|
+
} catch (error) {
|
|
87
|
+
console.error('Error posting events:', error);
|
|
88
|
+
this.events = eventsToSend;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
2
|
+
import { AnalyticsEvent } from "./analytics_event_model";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export class EventStorage {
|
|
6
|
+
|
|
7
|
+
private static readonly key = "analytics_events_spense";
|
|
8
|
+
|
|
9
|
+
async loadEvents(): Promise<AnalyticsEvent[]> {
|
|
10
|
+
|
|
11
|
+
try {
|
|
12
|
+
const jsonString = await AsyncStorage.getItem(EventStorage.key);
|
|
13
|
+
if (!jsonString) {
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return AnalyticsEvent.listFromJson(jsonString);
|
|
18
|
+
|
|
19
|
+
} catch (error) {
|
|
20
|
+
console.error("Error loading events from storage: ", error);
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async saveEvents(events: AnalyticsEvent[]): Promise<void> {
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
const jsonSting = AnalyticsEvent.listToJson(events);
|
|
30
|
+
await AsyncStorage.setItem(EventStorage.key, jsonSting);
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
console.error("Error saving events to storage: ", error);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async clearEvents(): Promise<void> {
|
|
38
|
+
try {
|
|
39
|
+
await AsyncStorage.removeItem(EventStorage.key);
|
|
40
|
+
} catch (error) {
|
|
41
|
+
console.error('Failed to clear analytics events:', error);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|