ggez-banking-sdk 0.0.2 → 0.0.4

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/package.json +10 -2
  2. package/README.md +0 -0
  3. package/dist/bank-system/constants/enum.d.ts +0 -1057
  4. package/dist/bank-system/constants/enum.js +0 -1110
  5. package/dist/bank-system/constants/index.d.ts +0 -1
  6. package/dist/bank-system/constants/index.js +0 -17
  7. package/dist/bank-system/content/accountCurrencies.d.ts +0 -12
  8. package/dist/bank-system/content/accountCurrencies.js +0 -37
  9. package/dist/bank-system/content/countries.d.ts +0 -24
  10. package/dist/bank-system/content/countries.js +0 -6472
  11. package/dist/bank-system/content/currencies.d.ts +0 -32
  12. package/dist/bank-system/content/currencies.js +0 -5836
  13. package/dist/bank-system/content/index.d.ts +0 -4
  14. package/dist/bank-system/content/index.js +0 -12
  15. package/dist/bank-system/content/state.d.ts +0 -6
  16. package/dist/bank-system/content/state.js +0 -350
  17. package/dist/bank-system/helper/data.d.ts +0 -46
  18. package/dist/bank-system/helper/data.js +0 -57
  19. package/dist/bank-system/helper/dataStructure.d.ts +0 -3220
  20. package/dist/bank-system/helper/dataStructure.js +0 -1051
  21. package/dist/bank-system/helper/index.d.ts +0 -28
  22. package/dist/bank-system/helper/index.js +0 -394
  23. package/dist/bank-system/interfaces/accountInterface.d.ts +0 -26
  24. package/dist/bank-system/interfaces/accountInterface.js +0 -2
  25. package/dist/bank-system/interfaces/bankingSystemInterface.d.ts +0 -306
  26. package/dist/bank-system/interfaces/bankingSystemInterface.js +0 -2
  27. package/dist/bank-system/interfaces/deviceInterface.d.ts +0 -34
  28. package/dist/bank-system/interfaces/deviceInterface.js +0 -2
  29. package/dist/bank-system/interfaces/index.d.ts +0 -4
  30. package/dist/bank-system/interfaces/index.js +0 -20
  31. package/dist/bank-system/interfaces/interface.d.ts +0 -460
  32. package/dist/bank-system/interfaces/interface.js +0 -2
  33. package/dist/bank-system/interfaces/organizationInterface.d.ts +0 -118
  34. package/dist/bank-system/interfaces/organizationInterface.js +0 -2
  35. package/dist/bank-system/interfaces/signInterface.d.ts +0 -89
  36. package/dist/bank-system/interfaces/signInterface.js +0 -2
  37. package/dist/bank-system/interfaces/transactionInterface.d.ts +0 -17
  38. package/dist/bank-system/interfaces/transactionInterface.js +0 -2
  39. package/dist/bank-system/restApi/index.d.ts +0 -8
  40. package/dist/bank-system/restApi/index.js +0 -41
  41. package/dist/bank-system/services/account.d.ts +0 -33
  42. package/dist/bank-system/services/account.js +0 -129
  43. package/dist/bank-system/services/addresses.d.ts +0 -48
  44. package/dist/bank-system/services/addresses.js +0 -130
  45. package/dist/bank-system/services/auth.d.ts +0 -71
  46. package/dist/bank-system/services/auth.js +0 -250
  47. package/dist/bank-system/services/bankAccount.d.ts +0 -48
  48. package/dist/bank-system/services/bankAccount.js +0 -131
  49. package/dist/bank-system/services/device.d.ts +0 -46
  50. package/dist/bank-system/services/device.js +0 -212
  51. package/dist/bank-system/services/document.d.ts +0 -15
  52. package/dist/bank-system/services/document.js +0 -58
  53. package/dist/bank-system/services/email.d.ts +0 -70
  54. package/dist/bank-system/services/email.js +0 -175
  55. package/dist/bank-system/services/history.d.ts +0 -14
  56. package/dist/bank-system/services/history.js +0 -55
  57. package/dist/bank-system/services/identification.d.ts +0 -37
  58. package/dist/bank-system/services/identification.js +0 -107
  59. package/dist/bank-system/services/index.d.ts +0 -17
  60. package/dist/bank-system/services/index.js +0 -35
  61. package/dist/bank-system/services/organization.d.ts +0 -28
  62. package/dist/bank-system/services/organization.js +0 -129
  63. package/dist/bank-system/services/personalInfo.d.ts +0 -26
  64. package/dist/bank-system/services/personalInfo.js +0 -91
  65. package/dist/bank-system/services/phone.d.ts +0 -70
  66. package/dist/bank-system/services/phone.js +0 -175
  67. package/dist/bank-system/services/security.d.ts +0 -114
  68. package/dist/bank-system/services/security.js +0 -267
  69. package/dist/bank-system/services/token.d.ts +0 -11
  70. package/dist/bank-system/services/token.js +0 -83
  71. package/dist/bank-system/services/transaction.d.ts +0 -9
  72. package/dist/bank-system/services/transaction.js +0 -62
  73. package/dist/bank-system/services/verifyAndConfirm.d.ts +0 -116
  74. package/dist/bank-system/services/verifyAndConfirm.js +0 -308
  75. package/dist/bank-system/utils/chainAddressMasking.d.ts +0 -2
  76. package/dist/bank-system/utils/chainAddressMasking.js +0 -12
  77. package/dist/bank-system/utils/copyText.d.ts +0 -5
  78. package/dist/bank-system/utils/copyText.js +0 -22
  79. package/dist/bank-system/utils/countryAndCurrencyData.d.ts +0 -11
  80. package/dist/bank-system/utils/countryAndCurrencyData.js +0 -22
  81. package/dist/bank-system/utils/enumToOption.d.ts +0 -4
  82. package/dist/bank-system/utils/enumToOption.js +0 -18
  83. package/dist/bank-system/utils/fillDeviceDetails.d.ts +0 -23
  84. package/dist/bank-system/utils/fillDeviceDetails.js +0 -44
  85. package/dist/bank-system/utils/generateOneLiner.d.ts +0 -1
  86. package/dist/bank-system/utils/generateOneLiner.js +0 -17
  87. package/dist/bank-system/utils/generateSourceId.d.ts +0 -1
  88. package/dist/bank-system/utils/generateSourceId.js +0 -13
  89. package/dist/bank-system/utils/getCountryName.d.ts +0 -1
  90. package/dist/bank-system/utils/getCountryName.js +0 -16
  91. package/dist/bank-system/utils/getEnumName.d.ts +0 -1
  92. package/dist/bank-system/utils/getEnumName.js +0 -10
  93. package/dist/bank-system/utils/getStateByCountryCode.d.ts +0 -1
  94. package/dist/bank-system/utils/getStateByCountryCode.js +0 -15
  95. package/dist/bank-system/utils/handleEncryption/decryptData.d.ts +0 -15
  96. package/dist/bank-system/utils/handleEncryption/decryptData.js +0 -78
  97. package/dist/bank-system/utils/handleEncryption/encryptData.d.ts +0 -2
  98. package/dist/bank-system/utils/handleEncryption/encryptData.js +0 -37
  99. package/dist/bank-system/utils/handleEncryption/index.d.ts +0 -4
  100. package/dist/bank-system/utils/handleEncryption/index.js +0 -12
  101. package/dist/bank-system/utils/handleEncryption/key.d.ts +0 -13
  102. package/dist/bank-system/utils/handleEncryption/key.js +0 -40
  103. package/dist/bank-system/utils/index.d.ts +0 -15
  104. package/dist/bank-system/utils/index.js +0 -42
  105. package/dist/bank-system/utils/info.d.ts +0 -8
  106. package/dist/bank-system/utils/info.js +0 -79
  107. package/dist/bank-system/utils/maskingFunction.d.ts +0 -1
  108. package/dist/bank-system/utils/maskingFunction.js +0 -28
  109. package/dist/bank-system/utils/regex.d.ts +0 -106
  110. package/dist/bank-system/utils/regex.js +0 -110
  111. package/dist/bank-system/utils/sortUserInfo.d.ts +0 -1
  112. package/dist/bank-system/utils/sortUserInfo.js +0 -43
  113. package/dist/index.d.ts +0 -8
  114. package/dist/index.js +0 -54
  115. package/dist/keplr-config/chainInfo.d.ts +0 -8
  116. package/dist/keplr-config/chainInfo.js +0 -111
@@ -1,175 +0,0 @@
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 _d, _e, _f;
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: (_f = (_e = (_d = response === null || response === void 0 ? void 0 : response.data) === null || _d === void 0 ? void 0 : _d.result) === null || _e === void 0 ? void 0 : _e.friendly_message) !== null && _f !== void 0 ? _f : "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 _g, _h, _j;
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: (_j = (_h = (_g = response === null || response === void 0 ? void 0 : response.data) === null || _g === void 0 ? void 0 : _g.result) === null || _h === void 0 ? void 0 : _h.friendly_message) !== null && _j !== void 0 ? _j : "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 _k, _l, _m;
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: (_m = (_l = (_k = response === null || response === void 0 ? void 0 : response.data) === null || _k === void 0 ? void 0 : _k.result) === null || _l === void 0 ? void 0 : _l.friendly_message) !== null && _m !== void 0 ? _m : "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 _o, _p, _q;
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: (_q = (_p = (_o = response === null || response === void 0 ? void 0 : response.data) === null || _o === void 0 ? void 0 : _o.result) === null || _p === void 0 ? void 0 : _p.friendly_message) !== null && _q !== void 0 ? _q : `${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;
@@ -1,114 +0,0 @@
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
- };
@@ -1,267 +0,0 @@
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 _d, _e, _f;
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: (_f = (_e = (_d = response === null || response === void 0 ? void 0 : response.data) === null || _d === void 0 ? void 0 : _d.result) === null || _e === void 0 ? void 0 : _e.friendly_message) !== null && _f !== void 0 ? _f : "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 _g, _h, _j;
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: (_j = (_h = (_g = response === null || response === void 0 ? void 0 : response.data) === null || _g === void 0 ? void 0 : _g.result) === null || _h === void 0 ? void 0 : _h.friendly_message) !== null && _j !== void 0 ? _j : "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 _k, _l, _m;
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: (_m = (_l = (_k = response === null || response === void 0 ? void 0 : response.data) === null || _k === void 0 ? void 0 : _k.result) === null || _l === void 0 ? void 0 : _l.friendly_message) !== null && _m !== void 0 ? _m : "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 _o, _p, _q;
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: (_q = (_p = (_o = response === null || response === void 0 ? void 0 : response.data) === null || _o === void 0 ? void 0 : _o.result) === null || _p === void 0 ? void 0 : _p.friendly_message) !== null && _q !== void 0 ? _q : "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 _r, _s, _t;
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: (_t = (_s = (_r = response === null || response === void 0 ? void 0 : response.data) === null || _r === void 0 ? void 0 : _r.result) === null || _s === void 0 ? void 0 : _s.friendly_message) !== null && _t !== void 0 ? _t : "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 _u, _v, _w;
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: (_w = (_v = (_u = response === null || response === void 0 ? void 0 : response.data) === null || _u === void 0 ? void 0 : _u.result) === null || _v === void 0 ? void 0 : _v.friendly_message) !== null && _w !== void 0 ? _w : "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 _x, _y, _z;
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: (_z = (_y = (_x = response === null || response === void 0 ? void 0 : response.data) === null || _x === void 0 ? void 0 : _x.result) === null || _y === void 0 ? void 0 : _y.friendly_message) !== null && _z !== void 0 ? _z : "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 _0, _1, _2;
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: (_2 = (_1 = (_0 = response === null || response === void 0 ? void 0 : response.data) === null || _0 === void 0 ? void 0 : _0.result) === null || _1 === void 0 ? void 0 : _1.friendly_message) !== null && _2 !== void 0 ? _2 : "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 _3, _4, _5;
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: (_5 = (_4 = (_3 = response === null || response === void 0 ? void 0 : response.data) === null || _3 === void 0 ? void 0 : _3.result) === null || _4 === void 0 ? void 0 : _4.friendly_message) !== null && _5 !== void 0 ? _5 : "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;
@@ -1,11 +0,0 @@
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
- };
@@ -1,83 +0,0 @@
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 _e;
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 (_e = response.data) === null || _e === void 0 ? void 0 : _e.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;
@@ -1,9 +0,0 @@
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
- };