ggez-banking-sdk 0.0.4 → 0.0.6

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.
Files changed (116) hide show
  1. package/README.md +0 -0
  2. package/dist/bank-system/constants/enum.d.ts +1061 -0
  3. package/dist/bank-system/constants/enum.js +1115 -0
  4. package/dist/bank-system/constants/index.d.ts +1 -0
  5. package/dist/bank-system/constants/index.js +17 -0
  6. package/dist/bank-system/content/accountCurrencies.d.ts +12 -0
  7. package/dist/bank-system/content/accountCurrencies.js +37 -0
  8. package/dist/bank-system/content/countries.d.ts +24 -0
  9. package/dist/bank-system/content/countries.js +6472 -0
  10. package/dist/bank-system/content/currencies.d.ts +32 -0
  11. package/dist/bank-system/content/currencies.js +5836 -0
  12. package/dist/bank-system/content/index.d.ts +4 -0
  13. package/dist/bank-system/content/index.js +12 -0
  14. package/dist/bank-system/content/state.d.ts +6 -0
  15. package/dist/bank-system/content/state.js +350 -0
  16. package/dist/bank-system/helper/data.d.ts +46 -0
  17. package/dist/bank-system/helper/data.js +57 -0
  18. package/dist/bank-system/helper/dataStructure.d.ts +3220 -0
  19. package/dist/bank-system/helper/dataStructure.js +1055 -0
  20. package/dist/bank-system/helper/index.d.ts +28 -0
  21. package/dist/bank-system/helper/index.js +394 -0
  22. package/dist/bank-system/interfaces/accountInterface.d.ts +26 -0
  23. package/dist/bank-system/interfaces/accountInterface.js +2 -0
  24. package/dist/bank-system/interfaces/bankingSystemInterface.d.ts +306 -0
  25. package/dist/bank-system/interfaces/bankingSystemInterface.js +2 -0
  26. package/dist/bank-system/interfaces/deviceInterface.d.ts +34 -0
  27. package/dist/bank-system/interfaces/deviceInterface.js +2 -0
  28. package/dist/bank-system/interfaces/index.d.ts +4 -0
  29. package/dist/bank-system/interfaces/index.js +20 -0
  30. package/dist/bank-system/interfaces/interface.d.ts +460 -0
  31. package/dist/bank-system/interfaces/interface.js +2 -0
  32. package/dist/bank-system/interfaces/organizationInterface.d.ts +118 -0
  33. package/dist/bank-system/interfaces/organizationInterface.js +2 -0
  34. package/dist/bank-system/interfaces/signInterface.d.ts +91 -0
  35. package/dist/bank-system/interfaces/signInterface.js +2 -0
  36. package/dist/bank-system/interfaces/transactionInterface.d.ts +17 -0
  37. package/dist/bank-system/interfaces/transactionInterface.js +2 -0
  38. package/dist/bank-system/restApi/index.d.ts +8 -0
  39. package/dist/bank-system/restApi/index.js +41 -0
  40. package/dist/bank-system/services/account.d.ts +33 -0
  41. package/dist/bank-system/services/account.js +129 -0
  42. package/dist/bank-system/services/addresses.d.ts +48 -0
  43. package/dist/bank-system/services/addresses.js +130 -0
  44. package/dist/bank-system/services/auth.d.ts +71 -0
  45. package/dist/bank-system/services/auth.js +250 -0
  46. package/dist/bank-system/services/bankAccount.d.ts +48 -0
  47. package/dist/bank-system/services/bankAccount.js +131 -0
  48. package/dist/bank-system/services/device.d.ts +46 -0
  49. package/dist/bank-system/services/device.js +212 -0
  50. package/dist/bank-system/services/document.d.ts +15 -0
  51. package/dist/bank-system/services/document.js +58 -0
  52. package/dist/bank-system/services/email.d.ts +70 -0
  53. package/dist/bank-system/services/email.js +175 -0
  54. package/dist/bank-system/services/history.d.ts +14 -0
  55. package/dist/bank-system/services/history.js +55 -0
  56. package/dist/bank-system/services/identification.d.ts +37 -0
  57. package/dist/bank-system/services/identification.js +107 -0
  58. package/dist/bank-system/services/index.d.ts +17 -0
  59. package/dist/bank-system/services/index.js +35 -0
  60. package/dist/bank-system/services/organization.d.ts +28 -0
  61. package/dist/bank-system/services/organization.js +129 -0
  62. package/dist/bank-system/services/personalInfo.d.ts +26 -0
  63. package/dist/bank-system/services/personalInfo.js +91 -0
  64. package/dist/bank-system/services/phone.d.ts +70 -0
  65. package/dist/bank-system/services/phone.js +175 -0
  66. package/dist/bank-system/services/security.d.ts +114 -0
  67. package/dist/bank-system/services/security.js +267 -0
  68. package/dist/bank-system/services/token.d.ts +11 -0
  69. package/dist/bank-system/services/token.js +83 -0
  70. package/dist/bank-system/services/transaction.d.ts +9 -0
  71. package/dist/bank-system/services/transaction.js +62 -0
  72. package/dist/bank-system/services/verifyAndConfirm.d.ts +116 -0
  73. package/dist/bank-system/services/verifyAndConfirm.js +308 -0
  74. package/dist/bank-system/utils/chainAddressMasking.d.ts +2 -0
  75. package/dist/bank-system/utils/chainAddressMasking.js +12 -0
  76. package/dist/bank-system/utils/copyText.d.ts +5 -0
  77. package/dist/bank-system/utils/copyText.js +22 -0
  78. package/dist/bank-system/utils/countryAndCurrencyData.d.ts +11 -0
  79. package/dist/bank-system/utils/countryAndCurrencyData.js +22 -0
  80. package/dist/bank-system/utils/enumToOption.d.ts +4 -0
  81. package/dist/bank-system/utils/enumToOption.js +18 -0
  82. package/dist/bank-system/utils/fillDeviceDetails.d.ts +23 -0
  83. package/dist/bank-system/utils/fillDeviceDetails.js +44 -0
  84. package/dist/bank-system/utils/generateOneLiner.d.ts +1 -0
  85. package/dist/bank-system/utils/generateOneLiner.js +16 -0
  86. package/dist/bank-system/utils/generateSourceId.d.ts +1 -0
  87. package/dist/bank-system/utils/generateSourceId.js +12 -0
  88. package/dist/bank-system/utils/getCountryName.d.ts +2 -0
  89. package/dist/bank-system/utils/getCountryName.js +29 -0
  90. package/dist/bank-system/utils/getEnumName.d.ts +1 -0
  91. package/dist/bank-system/utils/getEnumName.js +10 -0
  92. package/dist/bank-system/utils/getStateByCountryCode.d.ts +1 -0
  93. package/dist/bank-system/utils/getStateByCountryCode.js +14 -0
  94. package/dist/bank-system/utils/handleEncryption/decryptData.d.ts +15 -0
  95. package/dist/bank-system/utils/handleEncryption/decryptData.js +77 -0
  96. package/dist/bank-system/utils/handleEncryption/encryptData.d.ts +2 -0
  97. package/dist/bank-system/utils/handleEncryption/encryptData.js +36 -0
  98. package/dist/bank-system/utils/handleEncryption/index.d.ts +4 -0
  99. package/dist/bank-system/utils/handleEncryption/index.js +12 -0
  100. package/dist/bank-system/utils/handleEncryption/key.d.ts +13 -0
  101. package/dist/bank-system/utils/handleEncryption/key.js +40 -0
  102. package/dist/bank-system/utils/index.d.ts +15 -0
  103. package/dist/bank-system/utils/index.js +42 -0
  104. package/dist/bank-system/utils/info.d.ts +8 -0
  105. package/dist/bank-system/utils/info.js +79 -0
  106. package/dist/bank-system/utils/maskingFunction.d.ts +1 -0
  107. package/dist/bank-system/utils/maskingFunction.js +27 -0
  108. package/dist/bank-system/utils/regex.d.ts +106 -0
  109. package/dist/bank-system/utils/regex.js +110 -0
  110. package/dist/bank-system/utils/sortUserInfo.d.ts +1 -0
  111. package/dist/bank-system/utils/sortUserInfo.js +42 -0
  112. package/dist/index.d.ts +8 -0
  113. package/dist/index.js +54 -0
  114. package/dist/keplr-config/chainInfo.d.ts +8 -0
  115. package/dist/keplr-config/chainInfo.js +111 -0
  116. package/package.json +1 -1
@@ -0,0 +1,175 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.usePhone = void 0;
16
+ const dataStructure_1 = __importDefault(require("../helper/dataStructure"));
17
+ const helper_1 = __importDefault(require("../helper"));
18
+ const restApi_1 = __importDefault(require("../restApi"));
19
+ const usePhone = (token, userInfo, userId, baseUrl, geoCoordinates, lang) => {
20
+ const { checkResponse, headerConfig } = (0, helper_1.default)(userInfo);
21
+ const { checkGlobalResponse, errorHandler } = checkResponse();
22
+ const { dataPhone } = (0, dataStructure_1.default)();
23
+ const { confirmDataPhone, createDataPhone, deleteDataPhone, makePrimaryDataPhone, updateDataPhone, verifyDataPhone, } = dataPhone();
24
+ let endPointPhone = `v1/user/phone/${userId}`;
25
+ const headerConfigPhone = () => {
26
+ let headersData = {
27
+ header: true,
28
+ isUrlEncoded: false,
29
+ token: token,
30
+ lang: lang,
31
+ };
32
+ let headers = headerConfig(headersData);
33
+ return headers;
34
+ };
35
+ const CreateUserPhone = (values) => __awaiter(void 0, void 0, void 0, function* () {
36
+ var _a, _b, _c;
37
+ let data = createDataPhone(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
38
+ try {
39
+ const response = yield restApi_1.default.restApi(baseUrl, "POST", endPointPhone, headerConfigPhone(), data);
40
+ let { newUserInfo } = checkGlobalResponse("phone", response, "CreateUserPhone", "create");
41
+ return {
42
+ response: response,
43
+ newUser: newUserInfo,
44
+ message: (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.result) === null || _b === void 0 ? void 0 : _b.friendly_message) !== null && _c !== void 0 ? _c : "Phone Created Successfully",
45
+ status: "success",
46
+ };
47
+ }
48
+ catch (error) {
49
+ return {
50
+ response: error.response,
51
+ newUser: null,
52
+ message: error.message,
53
+ status: "failed",
54
+ };
55
+ }
56
+ });
57
+ const DeleteUserPhone = (values) => __awaiter(void 0, void 0, void 0, function* () {
58
+ var _a, _b, _c;
59
+ let data = deleteDataPhone(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
60
+ try {
61
+ const response = yield restApi_1.default.restApi(baseUrl, "DELETE", endPointPhone, headerConfigPhone(), data);
62
+ let { newUserInfo } = checkGlobalResponse("phone", response, "DeleteUserPhone", "delete");
63
+ return {
64
+ response: response,
65
+ newUser: newUserInfo,
66
+ message: (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.result) === null || _b === void 0 ? void 0 : _b.friendly_message) !== null && _c !== void 0 ? _c : "Phone Deleted Successfully",
67
+ status: "success",
68
+ };
69
+ }
70
+ catch (error) {
71
+ return {
72
+ response: error.response,
73
+ newUser: null,
74
+ message: error.message,
75
+ status: "failed",
76
+ };
77
+ }
78
+ });
79
+ const VerifyUserPhone = (values) => __awaiter(void 0, void 0, void 0, function* () {
80
+ let data = verifyDataPhone(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
81
+ try {
82
+ const response = yield restApi_1.default.restApi(baseUrl, "POST", `v1/user/security/verify/${userId}`, headerConfigPhone(), data);
83
+ let { newUserInfo } = checkGlobalResponse("phone", response, "VerifyUserPhone");
84
+ return {
85
+ response: response,
86
+ newUser: newUserInfo,
87
+ message: "Verification Code Message Sent Successfully",
88
+ status: "success",
89
+ };
90
+ }
91
+ catch (error) {
92
+ return {
93
+ response: error.response,
94
+ newUser: null,
95
+ message: error.message,
96
+ status: "failed",
97
+ };
98
+ }
99
+ });
100
+ const ConfirmUserPhone = (values) => __awaiter(void 0, void 0, void 0, function* () {
101
+ var _a, _b, _c;
102
+ let data = confirmDataPhone(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
103
+ try {
104
+ const response = yield restApi_1.default.restApi(baseUrl, "POST", `v1/user/security/confirm/${userId}`, headerConfigPhone(), data);
105
+ let { newUserInfo } = checkGlobalResponse("phone", response, "ConfirmUserPhone", "confirm");
106
+ return {
107
+ response: response,
108
+ newUser: newUserInfo,
109
+ message: (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.result) === null || _b === void 0 ? void 0 : _b.friendly_message) !== null && _c !== void 0 ? _c : "Phone Confirmed Successfully",
110
+ status: "success",
111
+ };
112
+ }
113
+ catch (error) {
114
+ return {
115
+ response: error.response,
116
+ newUser: null,
117
+ message: error.message,
118
+ status: "failed",
119
+ };
120
+ }
121
+ });
122
+ const UpdateUserPhone = (values) => __awaiter(void 0, void 0, void 0, function* () {
123
+ var _a, _b, _c;
124
+ let data = updateDataPhone(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
125
+ try {
126
+ const response = yield restApi_1.default.restApi(baseUrl, "PUT", endPointPhone, headerConfigPhone(), data);
127
+ let { newUserInfo } = checkGlobalResponse("phone", response, "UpdateUserPhone", "update");
128
+ return {
129
+ response: response,
130
+ newUser: newUserInfo,
131
+ message: (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.result) === null || _b === void 0 ? void 0 : _b.friendly_message) !== null && _c !== void 0 ? _c : "Phone Updated Successfully",
132
+ status: "success",
133
+ };
134
+ }
135
+ catch (error) {
136
+ return {
137
+ response: error.response,
138
+ newUser: null,
139
+ message: error.message,
140
+ status: "failed",
141
+ };
142
+ }
143
+ });
144
+ const MakeUserPhonePrimary = (values) => __awaiter(void 0, void 0, void 0, function* () {
145
+ var _a, _b, _c;
146
+ let data = makePrimaryDataPhone(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
147
+ try {
148
+ const response = yield restApi_1.default.restApi(baseUrl, "PUT", endPointPhone, headerConfigPhone(), data);
149
+ let { newUserInfo } = checkGlobalResponse("phone", response, "MakeUserPhonePrimary", "updatePrimary");
150
+ return {
151
+ response: response,
152
+ newUser: newUserInfo,
153
+ message: (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.result) === null || _b === void 0 ? void 0 : _b.friendly_message) !== null && _c !== void 0 ? _c : `${values.number} Now Is Primary`,
154
+ status: "success",
155
+ };
156
+ }
157
+ catch (error) {
158
+ return {
159
+ response: error.response,
160
+ newUser: null,
161
+ message: error.message,
162
+ status: "failed",
163
+ };
164
+ }
165
+ });
166
+ return {
167
+ CreateUserPhone,
168
+ DeleteUserPhone,
169
+ VerifyUserPhone,
170
+ ConfirmUserPhone,
171
+ UpdateUserPhone,
172
+ MakeUserPhonePrimary,
173
+ };
174
+ };
175
+ exports.usePhone = usePhone;
@@ -0,0 +1,114 @@
1
+ import { ChangeUserSecurityCodeInterface, ResetPasswordInterface, ResetSecurityQuestionsInterface, UpdateUserPreferencesInterface, ValidateSecurityCodeInterface, ActivateGoogleAuthInterface, DeleteGoogleAuthInterface } from "../interfaces/bankingSystemInterface";
2
+ import { IGeoCoordinates, UserInfo } from "../interfaces/interface";
3
+ export declare const useSecurity: (token: string, userInfo: UserInfo, userId: string, baseUrl: string, geoCoordinates: IGeoCoordinates, lang?: string) => {
4
+ ResetPassword: (values: ResetPasswordInterface) => Promise<{
5
+ response: import("axios").AxiosResponse<any, any>;
6
+ newUser: any;
7
+ message: any;
8
+ status: string;
9
+ } | {
10
+ response: any;
11
+ newUser: any;
12
+ message: any;
13
+ status: string;
14
+ }>;
15
+ ResetSecurityQuestions: (values: ResetSecurityQuestionsInterface) => Promise<{
16
+ response: import("axios").AxiosResponse<any, any>;
17
+ newUser: any;
18
+ message: any;
19
+ status: string;
20
+ } | {
21
+ response: any;
22
+ newUser: any;
23
+ message: any;
24
+ status: string;
25
+ }>;
26
+ ChangeUserSecurityCode: (values: ChangeUserSecurityCodeInterface) => Promise<{
27
+ response: import("axios").AxiosResponse<any, any>;
28
+ newUser: any;
29
+ message: any;
30
+ status: string;
31
+ } | {
32
+ response: any;
33
+ newUser: any;
34
+ message: any;
35
+ status: string;
36
+ }>;
37
+ UpdateUserPreferences: (values: UpdateUserPreferencesInterface) => Promise<{
38
+ response: import("axios").AxiosResponse<any, any>;
39
+ newUser: any;
40
+ message: any;
41
+ status: string;
42
+ } | {
43
+ response: any;
44
+ newUser: any;
45
+ message: any;
46
+ status: string;
47
+ }>;
48
+ ValidateSecurityCode: (values: ValidateSecurityCodeInterface) => Promise<{
49
+ response: import("axios").AxiosResponse<any, any>;
50
+ newUser: any;
51
+ message: any;
52
+ status: string;
53
+ } | {
54
+ response: any;
55
+ newUser: any;
56
+ message: any;
57
+ status: string;
58
+ }>;
59
+ EnrollGoogleAuth: () => Promise<{
60
+ response: import("axios").AxiosResponse<any, any>;
61
+ newUser: any;
62
+ message: any;
63
+ status: string;
64
+ } | {
65
+ response: any;
66
+ newUser: any;
67
+ message: any;
68
+ status: string;
69
+ }>;
70
+ ActivateGoogleAuth: (values: ActivateGoogleAuthInterface) => Promise<{
71
+ response: import("axios").AxiosResponse<any, any>;
72
+ newUser: any;
73
+ message: any;
74
+ status: string;
75
+ } | {
76
+ response: any;
77
+ newUser: any;
78
+ message: any;
79
+ status: string;
80
+ }>;
81
+ deActivateGoogleAuth: (values: ActivateGoogleAuthInterface) => Promise<{
82
+ response: import("axios").AxiosResponse<any, any>;
83
+ newUser: any;
84
+ message: any;
85
+ status: string;
86
+ } | {
87
+ response: any;
88
+ newUser: any;
89
+ message: any;
90
+ status: string;
91
+ }>;
92
+ deleteGoogleAuth: (values: DeleteGoogleAuthInterface) => Promise<{
93
+ response: import("axios").AxiosResponse<any, any>;
94
+ newUser: any;
95
+ message: any;
96
+ status: string;
97
+ } | {
98
+ response: any;
99
+ newUser: any;
100
+ message: any;
101
+ status: string;
102
+ }>;
103
+ GetSecurityOperation: () => Promise<{
104
+ response: import("axios").AxiosResponse<any, any>;
105
+ newUser: any;
106
+ message: any;
107
+ status: string;
108
+ } | {
109
+ response: any;
110
+ newUser: any;
111
+ message: any;
112
+ status: string;
113
+ }>;
114
+ };
@@ -0,0 +1,267 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.useSecurity = void 0;
16
+ const dataStructure_1 = __importDefault(require("../helper/dataStructure"));
17
+ const restApi_1 = __importDefault(require("../restApi"));
18
+ const helper_1 = __importDefault(require("../helper"));
19
+ const useSecurity = (token, userInfo, userId, baseUrl, geoCoordinates, lang) => {
20
+ const { dataSecurity } = (0, dataStructure_1.default)();
21
+ const { checkResponse, headerConfig } = (0, helper_1.default)(userInfo);
22
+ const { checkGlobalResponse } = checkResponse();
23
+ const { changeDataSecurityCode, resetDataPassword, resetDataQuestion, updateDataUserPreferences, dataValidateSecurityCode, dataEnrollGoogleAuth, dataActivateGoogleAuth, dataDeleteGoogleAuth, } = dataSecurity();
24
+ const headerConfigSecurity = () => {
25
+ let headersData = {
26
+ header: true,
27
+ isUrlEncoded: false,
28
+ token: token,
29
+ lang: lang,
30
+ };
31
+ let headers = headerConfig(headersData);
32
+ return headers;
33
+ };
34
+ const ResetPassword = (values) => __awaiter(void 0, void 0, void 0, function* () {
35
+ var _a, _b, _c;
36
+ let data = resetDataPassword(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
37
+ try {
38
+ const response = yield restApi_1.default.restApi(baseUrl, "POST", `v1/user/security/reset/${userId}`, headerConfigSecurity(), data);
39
+ let { newUserInfo } = checkGlobalResponse("password", response, "ResetPassword", "reset");
40
+ return {
41
+ response: response,
42
+ newUser: newUserInfo,
43
+ message: (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.result) === null || _b === void 0 ? void 0 : _b.friendly_message) !== null && _c !== void 0 ? _c : "Password Changed Successfully",
44
+ status: "success",
45
+ };
46
+ }
47
+ catch (error) {
48
+ return {
49
+ response: error.response,
50
+ newUser: null,
51
+ message: error.message,
52
+ status: "failed",
53
+ };
54
+ }
55
+ });
56
+ const ResetSecurityQuestions = (values) => __awaiter(void 0, void 0, void 0, function* () {
57
+ var _a, _b, _c;
58
+ let data = resetDataQuestion(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
59
+ try {
60
+ const response = yield restApi_1.default.restApi(baseUrl, "POST", `v1/user/security/reset/${userId}`, headerConfigSecurity(), data);
61
+ let { newUserInfo } = checkGlobalResponse("security", response, "ResetSecurityQuestions", "resetQuestions");
62
+ return {
63
+ response: response,
64
+ newUser: newUserInfo,
65
+ message: (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.result) === null || _b === void 0 ? void 0 : _b.friendly_message) !== null && _c !== void 0 ? _c : "Questions Changed Successfully",
66
+ status: "success",
67
+ };
68
+ }
69
+ catch (error) {
70
+ return {
71
+ response: error.response,
72
+ newUser: null,
73
+ message: error.message,
74
+ status: "failed",
75
+ };
76
+ }
77
+ });
78
+ const ChangeUserSecurityCode = (values) => __awaiter(void 0, void 0, void 0, function* () {
79
+ var _a, _b, _c;
80
+ let data = changeDataSecurityCode(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
81
+ try {
82
+ const response = yield restApi_1.default.restApi(baseUrl, "POST", `v1/user/security/reset/${userId}`, headerConfigSecurity(), data);
83
+ let { newUserInfo } = checkGlobalResponse("security", response, "ChangeUserSecurityCode", "resetSecurityCode");
84
+ return {
85
+ response: response,
86
+ newUser: newUserInfo,
87
+ message: (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.result) === null || _b === void 0 ? void 0 : _b.friendly_message) !== null && _c !== void 0 ? _c : "User Security Code Changed Successfully",
88
+ status: "success",
89
+ };
90
+ }
91
+ catch (error) {
92
+ return {
93
+ response: error.response,
94
+ newUser: null,
95
+ message: error.message,
96
+ status: "failed",
97
+ };
98
+ }
99
+ });
100
+ const UpdateUserPreferences = (values) => __awaiter(void 0, void 0, void 0, function* () {
101
+ var _a, _b, _c;
102
+ let data = updateDataUserPreferences(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
103
+ try {
104
+ const response = yield restApi_1.default.restApi(baseUrl, "PUT", `v1/user/preferences/${userId}`, Object.assign(Object.assign({}, headerConfigSecurity()), { language: values.preferredLanguageCode }), data);
105
+ let { newUserInfo } = checkGlobalResponse("preferences", response, "UpdateUserPreferences", "updateObjectInfo");
106
+ return {
107
+ response: response,
108
+ newUser: newUserInfo,
109
+ message: (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.result) === null || _b === void 0 ? void 0 : _b.friendly_message) !== null && _c !== void 0 ? _c : "Preference Updated Successfully",
110
+ status: "success",
111
+ };
112
+ }
113
+ catch (error) {
114
+ return {
115
+ response: error.response,
116
+ newUser: null,
117
+ message: error.message,
118
+ status: "failed",
119
+ };
120
+ }
121
+ });
122
+ const ValidateSecurityCode = (values) => __awaiter(void 0, void 0, void 0, function* () {
123
+ var _a, _b, _c;
124
+ let data = dataValidateSecurityCode(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
125
+ try {
126
+ const response = yield restApi_1.default.restApi(baseUrl, "POST", `v1/user/security/validate/${userId}`, headerConfigSecurity(), data);
127
+ let { newUserInfo } = checkGlobalResponse("securityCode", response, "ValidateSecurityCode");
128
+ return {
129
+ response: response,
130
+ newUser: newUserInfo,
131
+ message: (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.result) === null || _b === void 0 ? void 0 : _b.friendly_message) !== null && _c !== void 0 ? _c : "Message send successfully",
132
+ status: "success",
133
+ };
134
+ }
135
+ catch (error) {
136
+ return {
137
+ response: error.response,
138
+ newUser: null,
139
+ message: error.message,
140
+ status: "failed",
141
+ };
142
+ }
143
+ });
144
+ /** Authentication Google */
145
+ const EnrollGoogleAuth = () => __awaiter(void 0, void 0, void 0, function* () {
146
+ var _a, _b, _c;
147
+ let data = dataEnrollGoogleAuth();
148
+ try {
149
+ const response = yield restApi_1.default.restApi(baseUrl, "POST", `v1/user/auth/enroll/${userId}`, headerConfigSecurity(), data);
150
+ let { newUserInfo } = checkGlobalResponse("authentication_data", response, "EnrollGoogleAuth", "update");
151
+ return {
152
+ response: response,
153
+ newUser: newUserInfo,
154
+ message: (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.result) === null || _b === void 0 ? void 0 : _b.friendly_message) !== null && _c !== void 0 ? _c : "User Enrolled successfully",
155
+ status: "success",
156
+ };
157
+ }
158
+ catch (error) {
159
+ return {
160
+ response: error.response,
161
+ newUser: null,
162
+ message: error.message,
163
+ status: "failed",
164
+ };
165
+ }
166
+ });
167
+ const ActivateGoogleAuth = (values) => __awaiter(void 0, void 0, void 0, function* () {
168
+ var _a, _b, _c;
169
+ let data = dataActivateGoogleAuth(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
170
+ try {
171
+ const response = yield restApi_1.default.restApi(baseUrl, "POST", `v1/user/auth/activate/${userId}`, headerConfigSecurity(), data);
172
+ let { newUserInfo } = checkGlobalResponse("authentication_data", response, "ActivateGoogleAuth", "create");
173
+ return {
174
+ response: response,
175
+ newUser: newUserInfo,
176
+ message: (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.result) === null || _b === void 0 ? void 0 : _b.friendly_message) !== null && _c !== void 0 ? _c : "Account Authentication Activated successfully",
177
+ status: "success",
178
+ };
179
+ }
180
+ catch (error) {
181
+ return {
182
+ response: error.response,
183
+ newUser: null,
184
+ message: error.message,
185
+ status: "failed",
186
+ };
187
+ }
188
+ });
189
+ const deActivateGoogleAuth = (values) => __awaiter(void 0, void 0, void 0, function* () {
190
+ var _a, _b, _c;
191
+ let data = dataActivateGoogleAuth(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
192
+ try {
193
+ const response = yield restApi_1.default.restApi(baseUrl, "POST", `v1/user/auth/deactivate/${userId}`, headerConfigSecurity(), data);
194
+ let { newUserInfo } = checkGlobalResponse("authentication_data", response, "deActivateGoogleAuth", "update");
195
+ return {
196
+ response: response,
197
+ newUser: newUserInfo,
198
+ message: (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.result) === null || _b === void 0 ? void 0 : _b.friendly_message) !== null && _c !== void 0 ? _c : "Account Authentication deactivated successfully",
199
+ status: "success",
200
+ };
201
+ }
202
+ catch (error) {
203
+ return {
204
+ response: error.response,
205
+ newUser: null,
206
+ message: error.message,
207
+ status: "failed",
208
+ };
209
+ }
210
+ });
211
+ const deleteGoogleAuth = (values) => __awaiter(void 0, void 0, void 0, function* () {
212
+ var _a, _b, _c;
213
+ let data = dataDeleteGoogleAuth(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
214
+ try {
215
+ const response = yield restApi_1.default.restApi(baseUrl, "POST", `v1/user/auth/delete/${userId}`, headerConfigSecurity(), data);
216
+ let { newUserInfo } = checkGlobalResponse("authentication_data", response, "deleteGoogleAuth", "delete");
217
+ return {
218
+ response: response,
219
+ newUser: newUserInfo,
220
+ message: (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.result) === null || _b === void 0 ? void 0 : _b.friendly_message) !== null && _c !== void 0 ? _c : "Account authentication deleted successfully",
221
+ status: "success",
222
+ };
223
+ }
224
+ catch (error) {
225
+ return {
226
+ response: error.response,
227
+ newUser: null,
228
+ message: error.message,
229
+ status: "failed",
230
+ };
231
+ }
232
+ });
233
+ const GetSecurityOperation = () => __awaiter(void 0, void 0, void 0, function* () {
234
+ var _a, _b, _c;
235
+ try {
236
+ const response = yield restApi_1.default.restApi(baseUrl, "GET", `v1/user/activity/${userId}`, headerConfigSecurity());
237
+ let { newUserInfo } = checkGlobalResponse("activity", response, "GetSecurityOperation", "get");
238
+ return {
239
+ response: response,
240
+ newUser: newUserInfo,
241
+ message: (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.result) === null || _b === void 0 ? void 0 : _b.friendly_message) !== null && _c !== void 0 ? _c : "Get Security Operation Successfully",
242
+ status: "success",
243
+ };
244
+ }
245
+ catch (error) {
246
+ return {
247
+ response: error.response,
248
+ newUser: null,
249
+ message: error.message,
250
+ status: "failed",
251
+ };
252
+ }
253
+ });
254
+ return {
255
+ ResetPassword,
256
+ ResetSecurityQuestions,
257
+ ChangeUserSecurityCode,
258
+ UpdateUserPreferences,
259
+ ValidateSecurityCode,
260
+ EnrollGoogleAuth,
261
+ ActivateGoogleAuth,
262
+ deActivateGoogleAuth,
263
+ deleteGoogleAuth,
264
+ GetSecurityOperation,
265
+ };
266
+ };
267
+ exports.useSecurity = useSecurity;
@@ -0,0 +1,11 @@
1
+ import { LimitedTokenInterface } from "../interfaces/signInterface";
2
+ import { IGeoCoordinates, UserInfo } from "../interfaces/interface";
3
+ export declare const useToken: (userInfo: UserInfo, nodeUrl: string, programId: string, lang?: string, geoCoordinates?: IGeoCoordinates) => {
4
+ CreateLimitedToken: (values: LimitedTokenInterface) => Promise<{
5
+ response: any;
6
+ newUser: any;
7
+ message: any;
8
+ status: string;
9
+ }>;
10
+ CreateProgramToken: (values: LimitedTokenInterface) => Promise<any>;
11
+ };
@@ -0,0 +1,83 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.useToken = void 0;
16
+ const helper_1 = __importDefault(require("../helper"));
17
+ const restApi_1 = __importDefault(require("../restApi"));
18
+ const useToken = (userInfo, nodeUrl, programId, lang, geoCoordinates) => {
19
+ const { headerConfig, convertDataToUrlEncoded, checkResponse } = (0, helper_1.default)(userInfo);
20
+ const { checkGlobalResponse } = checkResponse();
21
+ const { dataTokenUrlEncoded } = convertDataToUrlEncoded();
22
+ const headerConfigToken = () => {
23
+ let headersData = {
24
+ header: true,
25
+ isUrlEncoded: true,
26
+ token: null,
27
+ lang: lang,
28
+ };
29
+ let headers = headerConfig(headersData);
30
+ return headers;
31
+ };
32
+ const CreateLimitedToken = (values) => __awaiter(void 0, void 0, void 0, function* () {
33
+ var _a, _b, _c, _d;
34
+ let data = dataTokenUrlEncoded(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
35
+ try {
36
+ const response = yield restApi_1.default.restApi(nodeUrl, "POST", "v1/limited-token", headerConfigToken(), data);
37
+ if ((_a = response.data) === null || _a === void 0 ? void 0 : _a.access_token) {
38
+ return {
39
+ response: response,
40
+ newUser: null,
41
+ message: (_d = (_c = (_b = response === null || response === void 0 ? void 0 : response.data) === null || _b === void 0 ? void 0 : _b.result) === null || _c === void 0 ? void 0 : _c.friendly_message) !== null && _d !== void 0 ? _d : "Create Limited Token Successfully",
42
+ status: "success",
43
+ };
44
+ }
45
+ return {
46
+ response: response,
47
+ newUser: null,
48
+ message: "Create Limited Token Failed",
49
+ status: "failed",
50
+ };
51
+ }
52
+ catch (error) {
53
+ return {
54
+ response: error.response,
55
+ newUser: null,
56
+ message: error.response.data.error,
57
+ status: "failed",
58
+ };
59
+ }
60
+ });
61
+ const CreateProgramToken = (values) => __awaiter(void 0, void 0, void 0, function* () {
62
+ var _a;
63
+ let data = dataTokenUrlEncoded(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
64
+ try {
65
+ const response = yield restApi_1.default.restApi(nodeUrl, "POST", "oauth/token", headerConfigToken(), data);
66
+ checkGlobalResponse("token", response, "CreateProgramToken");
67
+ return (_a = response.data) === null || _a === void 0 ? void 0 : _a.access_token;
68
+ }
69
+ catch (error) {
70
+ return {
71
+ response: error.response,
72
+ newUser: null,
73
+ message: error.message,
74
+ status: "failed",
75
+ };
76
+ }
77
+ });
78
+ return {
79
+ CreateLimitedToken,
80
+ CreateProgramToken,
81
+ };
82
+ };
83
+ exports.useToken = useToken;
@@ -0,0 +1,9 @@
1
+ import { UserInfo } from "../interfaces/interface";
2
+ export declare const useTransaction: (token: string, userInfo: UserInfo, userId: string, baseUrl: string, lang?: string) => {
3
+ OrderRequest: (values: any) => Promise<{
4
+ response: any;
5
+ newUser: any;
6
+ message: any;
7
+ status: string;
8
+ }>;
9
+ };