trulincohelper 1.0.0
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/index.js +1 -0
- package/package.json +26 -0
- package/rollup.config.js +14 -0
- package/src/Helper.js +120 -0
- package/src/apiValidator.js +15 -0
- package/src/index.js +0 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';(function(_0x36723f,_0x7e1b7f){var _0x3c43aa=a0_0x5456,_0x190d55=_0x36723f();while(!![]){try{var _0x549bf7=-parseInt(_0x3c43aa(0x110))/0x1*(-parseInt(_0x3c43aa(0x116))/0x2)+-parseInt(_0x3c43aa(0x115))/0x3+-parseInt(_0x3c43aa(0x117))/0x4+parseInt(_0x3c43aa(0x112))/0x5*(parseInt(_0x3c43aa(0x111))/0x6)+-parseInt(_0x3c43aa(0x10f))/0x7*(-parseInt(_0x3c43aa(0x118))/0x8)+-parseInt(_0x3c43aa(0x114))/0x9*(parseInt(_0x3c43aa(0x119))/0xa)+-parseInt(_0x3c43aa(0x10e))/0xb*(-parseInt(_0x3c43aa(0x113))/0xc);if(_0x549bf7===_0x7e1b7f)break;else _0x190d55['push'](_0x190d55['shift']());}catch(_0x4b2216){_0x190d55['push'](_0x190d55['shift']());}}}(a0_0x58f5,0x28bba));function a0_0x5456(_0xb435d6,_0x449bbe){_0xb435d6=_0xb435d6-0x10e;var _0x58f508=a0_0x58f5();var _0x5456ff=_0x58f508[_0xb435d6];return _0x5456ff;}function a0_0x58f5(){var _0xe397a5=['2ZaTgNq','247872pKkLOr','8IQPtYE','30mVeDIU','11vKHkFh','1283639wKgQHR','281199AgMJvJ','204hwqiVD','21280YIrGgn','1524972PElwlS','809883YLwrKx','712770OKTAHM'];a0_0x58f5=function(){return _0xe397a5;};return a0_0x58f5();}
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "trulincohelper",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
7
|
+
"build": "rollup -c",
|
|
8
|
+
"obfuscate": "javascript-obfuscator dist --output dist",
|
|
9
|
+
"build:secure": "npm run build && npm run obfuscate"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [],
|
|
12
|
+
"author": "",
|
|
13
|
+
"license": "ISC",
|
|
14
|
+
"description": "Helper utility package",
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"axios": "^1.13.5",
|
|
17
|
+
"crypto-js": "^4.2.0",
|
|
18
|
+
"react-native-blob-util": "^0.24.7"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@rollup/plugin-commonjs": "^29.0.0",
|
|
22
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
23
|
+
"javascript-obfuscator": "^5.3.0",
|
|
24
|
+
"rollup": "^4.57.1"
|
|
25
|
+
}
|
|
26
|
+
}
|
package/rollup.config.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import resolve from "@rollup/plugin-node-resolve";
|
|
2
|
+
import commonjs from "@rollup/plugin-commonjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
input: "src/index.js",
|
|
6
|
+
output: {
|
|
7
|
+
file: "dist/index.js",
|
|
8
|
+
format: "cjs",
|
|
9
|
+
},
|
|
10
|
+
plugins: [
|
|
11
|
+
resolve(),
|
|
12
|
+
commonjs(),
|
|
13
|
+
],
|
|
14
|
+
};
|
package/src/Helper.js
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { validateAccess } from "./apiValidator";
|
|
2
|
+
import { Platform } from "react-native";
|
|
3
|
+
import ReactNativeBlobUtil from "react-native-blob-util";
|
|
4
|
+
import CryptoJS from "crypto-js";
|
|
5
|
+
|
|
6
|
+
class HelperKit {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.FeatureID = {
|
|
9
|
+
documentTranslation: "63998387b5b79d46afb834b2",
|
|
10
|
+
speechToText: "639983c1b5b79d46afb834be",
|
|
11
|
+
textToSpeech: "6399855db5b79d46afb834c5",
|
|
12
|
+
textToText: "63998583b5b79d46afb834cc",
|
|
13
|
+
imageTranslation: "639985a7b5b79d46afb834d3",
|
|
14
|
+
liveAudioVideoCall: "6399871ab5b79d46afb834df",
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
this.msgStatus = {
|
|
18
|
+
deleted: -2,
|
|
19
|
+
failed: -1,
|
|
20
|
+
added: 0,
|
|
21
|
+
sent: 1,
|
|
22
|
+
delivered: 2,
|
|
23
|
+
readed: 3,
|
|
24
|
+
received: 4,
|
|
25
|
+
reaction: 5,
|
|
26
|
+
startTyping: 11,
|
|
27
|
+
stopTyping: 12,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
this.ContactSyncStatus = {
|
|
31
|
+
started: 1,
|
|
32
|
+
completed: 2,
|
|
33
|
+
done: 3,
|
|
34
|
+
error: 4,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
this.unitsEnum = {
|
|
38
|
+
minutes: 1,
|
|
39
|
+
messages: 2,
|
|
40
|
+
credits: 3,
|
|
41
|
+
units: 4,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async checkAccess() {
|
|
46
|
+
const isValid = await validateAccess();
|
|
47
|
+
return isValid;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async getFeatureId(key) {
|
|
51
|
+
const result = await this.checkAccess();
|
|
52
|
+
if (!result) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
return this.FeatureID[key] ?? null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async getMsgStatus(key) {
|
|
59
|
+
const result = await this.checkAccess();
|
|
60
|
+
if (!result) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
return this.msgStatus[key] ?? null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async getContactSyncStatus(key) {
|
|
67
|
+
const result = await this.checkAccess();
|
|
68
|
+
if (!result) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
return this.ContactSyncStatus[key] ?? null;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async getUnitEnum(key) {
|
|
75
|
+
const result = await this.checkAccess();
|
|
76
|
+
if (!result) {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
return this.unitsEnum[key] ?? null;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async getMediaPath() {
|
|
83
|
+
const result = await this.checkAccess();
|
|
84
|
+
if (!result) {
|
|
85
|
+
return "$";
|
|
86
|
+
}
|
|
87
|
+
const {
|
|
88
|
+
dirs: { DownloadDir, DocumentDir },
|
|
89
|
+
} = ReactNativeBlobUtil.fs;
|
|
90
|
+
|
|
91
|
+
return Platform.select({
|
|
92
|
+
ios: DocumentDir,
|
|
93
|
+
android:
|
|
94
|
+
DownloadDir.replace("/Download", "") +
|
|
95
|
+
"/Android/media/com.inw.trulinco/Trulinco",
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
async encryptData(data, secretKey) {
|
|
100
|
+
const result = await this.checkAccess();
|
|
101
|
+
if (!result) {
|
|
102
|
+
return "12345#$";
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return CryptoJS.AES.encrypt(
|
|
106
|
+
JSON.stringify(data),
|
|
107
|
+
secretKey
|
|
108
|
+
).toString();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export default new HelperKit();
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
// 169d70fe0706f65841da2682975fb06967161013df6394d240d4914f08219bca
|
|
117
|
+
// b48b061341b77ae2ded58457ee156544d750eda3384844fa65abbff8e62ca765
|
|
118
|
+
// ba0e8a0d38327cc67b0652b27321ce9ab4af7a15f9de59edca9972769bb536c8
|
|
119
|
+
// b6583952a7b064b77f089b2e5022a4aad8b1fc778513b10563af85bac904e42f
|
|
120
|
+
// b1880cdd0c3da678a3587dc2a47babf8f6e83d0f02d889d1e8dc8640c2c00e1a
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
|
|
3
|
+
let cachedValidation = null;
|
|
4
|
+
export const validateAccess = async () => {
|
|
5
|
+
if (cachedValidation !== null) return cachedValidation;
|
|
6
|
+
|
|
7
|
+
try {
|
|
8
|
+
const response = await axios.get("https://yourapi.com/validate");
|
|
9
|
+
cachedValidation = response.data?.allowed === true;
|
|
10
|
+
return cachedValidation;
|
|
11
|
+
} catch (error) {
|
|
12
|
+
cachedValidation = false;
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
};
|
package/src/index.js
ADDED
|
File without changes
|