ggez-banking-sdk 0.0.43 → 0.0.54

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 (52) hide show
  1. package/dist/bank-system/helper/dataStructure.js +465 -177
  2. package/dist/bank-system/helper/index.d.ts +1 -1
  3. package/dist/bank-system/helper/index.js +53 -45
  4. package/dist/bank-system/interfaces/accountInterface.d.ts +3 -3
  5. package/dist/bank-system/interfaces/bankingSystemInterface.d.ts +44 -44
  6. package/dist/bank-system/interfaces/deviceInterface.d.ts +6 -6
  7. package/dist/bank-system/interfaces/interface.d.ts +1 -1
  8. package/dist/bank-system/interfaces/organizationInterface.d.ts +4 -4
  9. package/dist/bank-system/interfaces/signInterface.d.ts +6 -6
  10. package/dist/bank-system/interfaces/transactionInterface.d.ts +1 -1
  11. package/dist/bank-system/restApi/index.js +3 -12
  12. package/dist/bank-system/services/account.d.ts +2 -2
  13. package/dist/bank-system/services/account.js +27 -35
  14. package/dist/bank-system/services/addresses.d.ts +1 -1
  15. package/dist/bank-system/services/addresses.js +27 -33
  16. package/dist/bank-system/services/auth.d.ts +1 -1
  17. package/dist/bank-system/services/auth.js +40 -48
  18. package/dist/bank-system/services/bankAccount.d.ts +1 -1
  19. package/dist/bank-system/services/bankAccount.js +24 -33
  20. package/dist/bank-system/services/device.d.ts +1 -1
  21. package/dist/bank-system/services/device.js +48 -57
  22. package/dist/bank-system/services/document.d.ts +1 -1
  23. package/dist/bank-system/services/document.js +7 -16
  24. package/dist/bank-system/services/email.d.ts +1 -1
  25. package/dist/bank-system/services/email.js +34 -43
  26. package/dist/bank-system/services/history.js +5 -14
  27. package/dist/bank-system/services/identification.d.ts +1 -1
  28. package/dist/bank-system/services/identification.js +27 -27
  29. package/dist/bank-system/services/organization.d.ts +1 -1
  30. package/dist/bank-system/services/organization.js +30 -36
  31. package/dist/bank-system/services/personalInfo.d.ts +1 -1
  32. package/dist/bank-system/services/personalInfo.js +19 -22
  33. package/dist/bank-system/services/phone.d.ts +1 -1
  34. package/dist/bank-system/services/phone.js +37 -43
  35. package/dist/bank-system/services/security.d.ts +1 -1
  36. package/dist/bank-system/services/security.js +76 -67
  37. package/dist/bank-system/services/token.d.ts +1 -1
  38. package/dist/bank-system/services/token.js +12 -22
  39. package/dist/bank-system/services/transaction.js +6 -15
  40. package/dist/bank-system/services/verifyAndConfirm.d.ts +1 -1
  41. package/dist/bank-system/services/verifyAndConfirm.js +68 -72
  42. package/dist/bank-system/utils/chainAddressMasking.js +1 -1
  43. package/dist/bank-system/utils/copyText.js +3 -12
  44. package/dist/bank-system/utils/generateSourceId.js +1 -2
  45. package/dist/bank-system/utils/getCountryName.js +2 -4
  46. package/dist/bank-system/utils/getEnumName.js +2 -3
  47. package/dist/bank-system/utils/getStateByCountryCode.js +1 -1
  48. package/dist/bank-system/utils/handleEncryption/decryptData.js +23 -34
  49. package/dist/bank-system/utils/info.js +18 -24
  50. package/dist/bank-system/utils/sortUserInfo.js +6 -6
  51. package/dist/tsconfig.tsbuildinfo +1 -1
  52. package/package.json +3 -2
@@ -19,7 +19,7 @@ export interface SignUpInterface {
19
19
  securityCode: number;
20
20
  referralCode: string;
21
21
  referralCodeType: string;
22
- geoCoordinates?: IGeoCoordinates;
22
+ geoCoordinates?: IGeoCoordinates | null;
23
23
  mobileNumberCountry: string;
24
24
  preferredLanguageCode: string;
25
25
  }
@@ -27,13 +27,13 @@ export interface LoginRequestInterface {
27
27
  email: string;
28
28
  password: string;
29
29
  installationId: string;
30
- geoCoordinates?: IGeoCoordinates;
30
+ geoCoordinates?: IGeoCoordinates | null;
31
31
  }
32
32
  export interface LoginDeviceCredentialInterface {
33
33
  user_id: string;
34
34
  device_security_code: string;
35
35
  device_id: string;
36
- geoCoordinates?: IGeoCoordinates;
36
+ geoCoordinates?: IGeoCoordinates | null;
37
37
  }
38
38
  export interface SignUpWithGoogleInterface {
39
39
  firstName: string;
@@ -56,7 +56,7 @@ export interface SignUpWithGoogleInterface {
56
56
  securityCode: number;
57
57
  referralCode: string;
58
58
  referralCodeType: string;
59
- geoCoordinates?: IGeoCoordinates;
59
+ geoCoordinates?: IGeoCoordinates | null;
60
60
  mobileNumberCountry: string;
61
61
  preferredLanguageCode: string;
62
62
  }
@@ -64,7 +64,7 @@ export interface LoginWithGoogleInterface {
64
64
  token: string;
65
65
  token_id?: string;
66
66
  installationId: string;
67
- geoCoordinates?: IGeoCoordinates;
67
+ geoCoordinates?: IGeoCoordinates | null;
68
68
  }
69
69
  export interface FormFieldInterface {
70
70
  name?: any;
@@ -89,5 +89,5 @@ export type SignUpType = {
89
89
  };
90
90
  export interface LimitedTokenInterface {
91
91
  installationId: string;
92
- geoCoordinates?: IGeoCoordinates;
92
+ geoCoordinates?: IGeoCoordinates | null;
93
93
  }
@@ -7,5 +7,5 @@ export interface IOrderInterface {
7
7
  accountId: number | null;
8
8
  paymentMethod: PaymentMethodType | null;
9
9
  validate: ValidateType;
10
- geoCoordinates?: IGeoCoordinates;
10
+ geoCoordinates?: IGeoCoordinates | null;
11
11
  }
@@ -1,13 +1,4 @@
1
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
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
4
  };
@@ -18,7 +9,7 @@ class ApiService {
18
9
  this.bearer = (token) => {
19
10
  return `bearer ${token}`;
20
11
  };
21
- this.restApi = (baseURL, method, endpoint, headers, data, params) => __awaiter(this, void 0, void 0, function* () {
12
+ this.restApi = async (baseURL, method, endpoint, headers, data, params) => {
22
13
  const config = {
23
14
  method: method,
24
15
  url: `${baseURL}/${endpoint}`,
@@ -27,14 +18,14 @@ class ApiService {
27
18
  data: data,
28
19
  };
29
20
  try {
30
- let response = yield (0, axios_1.default)(config);
21
+ let response = await (0, axios_1.default)(config);
31
22
  return response;
32
23
  }
33
24
  catch (error) {
34
25
  console.error("Error making GET request:", error);
35
26
  throw error;
36
27
  }
37
- });
28
+ };
38
29
  }
39
30
  }
40
31
  const RestApiService = new ApiService();
@@ -1,6 +1,6 @@
1
1
  import { DoTransactionInterface, GetTransactionInterface, GetAccountLimit } from "../interfaces/accountInterface";
2
2
  import { IGeoCoordinates, UserInfo } from "../interfaces/interface";
3
- export declare const useAccount: (token: string, userInfo: UserInfo, userId: string, baseUrl: string, geoCoordinates?: IGeoCoordinates, lang?: string) => {
3
+ export declare const useAccount: (token: string, userInfo: UserInfo, userId: string, baseUrl: string, geoCoordinates?: IGeoCoordinates | null, lang?: string) => {
4
4
  GetTransactionByUserId: (values: GetTransactionInterface) => Promise<{
5
5
  response: import("axios").AxiosResponse<any, any>;
6
6
  newUser: any;
@@ -12,7 +12,7 @@ export declare const useAccount: (token: string, userInfo: UserInfo, userId: str
12
12
  message: any;
13
13
  status: string;
14
14
  }>;
15
- GetAccount: () => Promise<{
15
+ GetAccount: (installationId?: string) => Promise<{
16
16
  response: any;
17
17
  newUser: any;
18
18
  message: any;
@@ -1,13 +1,4 @@
1
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
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
4
  };
@@ -23,26 +14,27 @@ const useAccount = (token, userInfo, userId, baseUrl, geoCoordinates, lang) => {
23
14
  const { dataDoTransaction, paramGetTransaction } = dataAccount();
24
15
  let endPointTransaction = `v1/transaction`;
25
16
  let endPointAccount = `v1/user/account/${userId}`;
26
- const headerConfigAccount = () => {
17
+ const headerConfigAccount = (installationId) => {
27
18
  let headersData = {
28
19
  header: true,
29
20
  isUrlEncoded: false,
30
21
  token: token,
31
22
  lang: lang,
23
+ installationId: installationId,
32
24
  };
33
25
  let headers = headerConfig(headersData);
34
26
  return headers;
35
27
  };
36
- const GetTransactionByUserId = (values) => __awaiter(void 0, void 0, void 0, function* () {
37
- var _a, _b, _c;
38
- let params = paramGetTransaction(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }), userId);
28
+ const GetTransactionByUserId = async (values) => {
29
+ let params = paramGetTransaction({ ...values, geoCoordinates: geoCoordinates }, userId);
39
30
  try {
40
- const response = yield restApi_1.default.restApi(baseUrl, "GET", `${endPointTransaction}/inquiry`, headerConfigAccount(), null, params);
31
+ const response = await restApi_1.default.restApi(baseUrl, "GET", `${endPointTransaction}/inquiry`, headerConfigAccount(), null, params);
41
32
  let { newUserInfo } = checkGlobalResponse("account", response, "getTransaction", "get");
42
33
  return {
43
34
  response: response,
44
35
  newUser: newUserInfo,
45
- 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 Transaction Successfully",
36
+ message: response?.data?.result?.friendly_message ??
37
+ "Get Transaction Successfully",
46
38
  status: "success",
47
39
  };
48
40
  }
@@ -54,16 +46,16 @@ const useAccount = (token, userInfo, userId, baseUrl, geoCoordinates, lang) => {
54
46
  status: "failed",
55
47
  };
56
48
  }
57
- });
58
- const GetAccount = () => __awaiter(void 0, void 0, void 0, function* () {
59
- var _a, _b, _c, _d;
49
+ };
50
+ const GetAccount = async (installationId) => {
60
51
  try {
61
- const response = yield restApi_1.default.restApi(baseUrl, "GET", endPointAccount, headerConfigAccount());
52
+ const response = await restApi_1.default.restApi(baseUrl, "GET", endPointAccount, headerConfigAccount(installationId));
62
53
  let { newUserInfo } = checkGlobalResponse("account", response, "getAccount", "getAccount");
63
54
  return {
64
- response: (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.account,
55
+ response: response?.data?.account,
65
56
  newUser: newUserInfo,
66
- 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 : "Get Account Successfully",
57
+ message: response?.data?.result?.friendly_message ??
58
+ "Get Account Successfully",
67
59
  status: "success",
68
60
  };
69
61
  }
@@ -75,17 +67,17 @@ const useAccount = (token, userInfo, userId, baseUrl, geoCoordinates, lang) => {
75
67
  status: "failed",
76
68
  };
77
69
  }
78
- });
79
- const DoTransaction = (values) => __awaiter(void 0, void 0, void 0, function* () {
80
- var _a, _b, _c;
81
- let data = dataDoTransaction(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
70
+ };
71
+ const DoTransaction = async (values) => {
72
+ let data = dataDoTransaction({ ...values, geoCoordinates: geoCoordinates });
82
73
  try {
83
- const response = yield restApi_1.default.restApi(baseUrl, "POST", `${endPointTransaction}`, headerConfigAccount(), data);
74
+ const response = await restApi_1.default.restApi(baseUrl, "POST", `${endPointTransaction}`, headerConfigAccount(), data);
84
75
  let { newUserInfo } = checkGlobalResponse("account", response, "doTransaction", "doTransaction");
85
76
  return {
86
- response: response === null || response === void 0 ? void 0 : response.data,
77
+ response: response?.data,
87
78
  newUser: newUserInfo,
88
- 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 : "Transaction Successfully",
79
+ message: response?.data?.result?.friendly_message ??
80
+ "Transaction Successfully",
89
81
  status: "success",
90
82
  };
91
83
  }
@@ -97,16 +89,16 @@ const useAccount = (token, userInfo, userId, baseUrl, geoCoordinates, lang) => {
97
89
  status: "failed",
98
90
  };
99
91
  }
100
- });
101
- const GetAccountLimit = (values) => __awaiter(void 0, void 0, void 0, function* () {
102
- var _a, _b, _c;
92
+ };
93
+ const GetAccountLimit = async (values) => {
103
94
  try {
104
- const response = yield restApi_1.default.restApi(baseUrl, "GET", `v1/account/${values.account_id}`, headerConfigAccount());
95
+ const response = await restApi_1.default.restApi(baseUrl, "GET", `v1/account/${values.account_id}`, headerConfigAccount());
105
96
  let { newUserInfo } = checkGlobalResponse("account", response, "getAccountLimit", "getAccountLimit");
106
97
  return {
107
- response: response === null || response === void 0 ? void 0 : response.data,
98
+ response: response?.data,
108
99
  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 : "Get Account Limit Successfully",
100
+ message: response?.data?.result?.friendly_message ??
101
+ "Get Account Limit Successfully",
110
102
  status: "success",
111
103
  };
112
104
  }
@@ -118,7 +110,7 @@ const useAccount = (token, userInfo, userId, baseUrl, geoCoordinates, lang) => {
118
110
  status: "failed",
119
111
  };
120
112
  }
121
- });
113
+ };
122
114
  return {
123
115
  GetTransactionByUserId,
124
116
  GetAccount,
@@ -1,6 +1,6 @@
1
1
  import { CreateAddressInterface, DeleteUserAddressInterface, MakeAddressPrimaryInterface, UpdateAddressInterface } from "../interfaces/bankingSystemInterface";
2
2
  import { IGeoCoordinates, UserInfo } from "../interfaces/interface";
3
- export declare const useAddresses: (token: string, userInfo: UserInfo, userId: string, baseUrl: string, geoCoordinates?: IGeoCoordinates, lang?: string) => {
3
+ export declare const useAddresses: (token: string, userInfo: UserInfo, userId: string, baseUrl: string, geoCoordinates?: IGeoCoordinates | null, lang?: string) => {
4
4
  CreateAddress: (values: CreateAddressInterface) => Promise<{
5
5
  response: import("axios").AxiosResponse<any, any>;
6
6
  newUser: any;
@@ -1,13 +1,4 @@
1
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
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
4
  };
@@ -32,16 +23,16 @@ const useAddresses = (token, userInfo, userId, baseUrl, geoCoordinates, lang) =>
32
23
  let headers = headerConfig(headersData);
33
24
  return headers;
34
25
  };
35
- const CreateAddress = (values) => __awaiter(void 0, void 0, void 0, function* () {
36
- var _a, _b, _c;
37
- let data = createDataAddress(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
26
+ const CreateAddress = async (values) => {
27
+ let data = createDataAddress({ ...values, geoCoordinates: geoCoordinates });
38
28
  try {
39
- const response = yield restApi_1.default.restApi(baseUrl, "POST", endPointAddress, headerConfigAddresses(), data);
29
+ const response = await restApi_1.default.restApi(baseUrl, "POST", endPointAddress, headerConfigAddresses(), data);
40
30
  let { newUserInfo } = checkGlobalResponse("addresses", response, "CreateAddress", "create");
41
31
  return {
42
32
  response: response,
43
33
  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 : "Address Created Successfully",
34
+ message: response?.data?.result?.friendly_message ??
35
+ "Address Created Successfully",
45
36
  status: "success",
46
37
  };
47
38
  }
@@ -53,17 +44,17 @@ const useAddresses = (token, userInfo, userId, baseUrl, geoCoordinates, lang) =>
53
44
  status: "failed",
54
45
  };
55
46
  }
56
- });
57
- const UpdateUserAddress = (values) => __awaiter(void 0, void 0, void 0, function* () {
58
- var _a, _b, _c;
59
- let data = updateDataAddress(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
47
+ };
48
+ const UpdateUserAddress = async (values) => {
49
+ let data = updateDataAddress({ ...values, geoCoordinates: geoCoordinates });
60
50
  try {
61
- const response = yield restApi_1.default.restApi(baseUrl, "PUT", endPointAddress, headerConfigAddresses(), data);
51
+ const response = await restApi_1.default.restApi(baseUrl, "PUT", endPointAddress, headerConfigAddresses(), data);
62
52
  let { newUserInfo } = checkGlobalResponse("addresses", response, "UpdateUserAddress", "update");
63
53
  return {
64
54
  response: response,
65
55
  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 : "Address Updated Successfully",
56
+ message: response?.data?.result?.friendly_message ??
57
+ "Address Updated Successfully",
67
58
  status: "success",
68
59
  };
69
60
  }
@@ -75,17 +66,17 @@ const useAddresses = (token, userInfo, userId, baseUrl, geoCoordinates, lang) =>
75
66
  status: "failed",
76
67
  };
77
68
  }
78
- });
79
- const DeleteUserAddress = (values) => __awaiter(void 0, void 0, void 0, function* () {
80
- var _a, _b, _c;
81
- let data = deleteDataAddress(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
69
+ };
70
+ const DeleteUserAddress = async (values) => {
71
+ let data = deleteDataAddress({ ...values, geoCoordinates: geoCoordinates });
82
72
  try {
83
- const response = yield restApi_1.default.restApi(baseUrl, "DELETE", endPointAddress, headerConfigAddresses(), data);
73
+ const response = await restApi_1.default.restApi(baseUrl, "DELETE", endPointAddress, headerConfigAddresses(), data);
84
74
  let { newUserInfo } = checkGlobalResponse("addresses", response, "DeleteUserAddress", "delete");
85
75
  return {
86
76
  response: response,
87
77
  newUser: newUserInfo,
88
- 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 : "Address Deleted Successfully",
78
+ message: response?.data?.result?.friendly_message ??
79
+ "Address Deleted Successfully",
89
80
  status: "success",
90
81
  };
91
82
  }
@@ -97,17 +88,20 @@ const useAddresses = (token, userInfo, userId, baseUrl, geoCoordinates, lang) =>
97
88
  status: "failed",
98
89
  };
99
90
  }
100
- });
101
- const MakeUserAddressPrimary = (values) => __awaiter(void 0, void 0, void 0, function* () {
102
- var _a, _b, _c;
103
- let data = primaryDataAddress(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
91
+ };
92
+ const MakeUserAddressPrimary = async (values) => {
93
+ let data = primaryDataAddress({
94
+ ...values,
95
+ geoCoordinates: geoCoordinates,
96
+ });
104
97
  try {
105
- const response = yield restApi_1.default.restApi(baseUrl, "PUT", endPointAddress, headerConfigAddresses(), data);
98
+ const response = await restApi_1.default.restApi(baseUrl, "PUT", endPointAddress, headerConfigAddresses(), data);
106
99
  let { newUserInfo } = checkGlobalResponse("addresses", response, "MakeUserAddressPrimary", "updatePrimary");
107
100
  return {
108
101
  response: response,
109
102
  newUser: newUserInfo,
110
- 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 : "Primary Address Updated Successfully",
103
+ message: response?.data?.result?.friendly_message ??
104
+ "Primary Address Updated Successfully",
111
105
  status: "success",
112
106
  };
113
107
  }
@@ -119,7 +113,7 @@ const useAddresses = (token, userInfo, userId, baseUrl, geoCoordinates, lang) =>
119
113
  status: "failed",
120
114
  };
121
115
  }
122
- });
116
+ };
123
117
  return {
124
118
  CreateAddress,
125
119
  UpdateUserAddress,
@@ -1,7 +1,7 @@
1
1
  import { LoginWithGoogleInterface, SignUpInterface, SignUpWithGoogleInterface, LoginRequestInterface, LoginDeviceCredentialInterface } from "../interfaces/signInterface";
2
2
  import { IGeoCoordinates, UserInfo } from "../interfaces/interface";
3
3
  import { LimitedTokenInterface } from "../interfaces/signInterface";
4
- export declare const useAuth: (baseUrl: string, nodeUrl: string, userInfo: UserInfo, tokenData: LimitedTokenInterface, programId: string, geoCoordinates?: IGeoCoordinates, lang?: string) => {
4
+ export declare const useAuth: (baseUrl: string, nodeUrl: string, userInfo: UserInfo, tokenData: LimitedTokenInterface, programId: string, geoCoordinates?: IGeoCoordinates | null, lang?: string) => {
5
5
  GetUser: (installationId: string, token?: string, userId?: string) => Promise<{
6
6
  response: import("axios").AxiosResponse<any, any>;
7
7
  newUser: {};
@@ -1,13 +1,4 @@
1
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
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
4
  };
@@ -24,8 +15,7 @@ const useAuth = (baseUrl, nodeUrl, userInfo, tokenData, programId, geoCoordinate
24
15
  const { checkUserResponseAuth, errorHandler } = checkResponse();
25
16
  const { dataSignUpApi, dataSignUpWithGoogle } = (0, dataStructure_1.default)();
26
17
  const { CreateLimitedToken } = (0, token_1.useToken)(userInfo, nodeUrl, programId, "", geoCoordinates);
27
- const GetUser = (installationId, token, userId) => __awaiter(void 0, void 0, void 0, function* () {
28
- var _a, _b, _c;
18
+ const GetUser = async (installationId, token, userId) => {
29
19
  try {
30
20
  let endPoint = `${endPointUser}/${userId}`;
31
21
  let headersData = {
@@ -36,12 +26,12 @@ const useAuth = (baseUrl, nodeUrl, userInfo, tokenData, programId, geoCoordinate
36
26
  installationId: installationId,
37
27
  };
38
28
  let headers = headerConfig(headersData);
39
- const response = yield restApi_1.default.restApi(baseUrl, "GET", endPoint, headers);
29
+ const response = await restApi_1.default.restApi(baseUrl, "GET", endPoint, headers);
40
30
  checkUserResponseAuth(response, false, "GetUser");
41
31
  return {
42
32
  response: response,
43
33
  newUser: {},
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 : "Get User Successfully",
34
+ message: response?.data?.result?.friendly_message ?? "Get User Successfully",
45
35
  status: "success",
46
36
  };
47
37
  }
@@ -53,14 +43,13 @@ const useAuth = (baseUrl, nodeUrl, userInfo, tokenData, programId, geoCoordinate
53
43
  status: "failed",
54
44
  };
55
45
  }
56
- });
57
- const SignUpApi = (values) => __awaiter(void 0, void 0, void 0, function* () {
58
- var _a, _b, _c, _d;
59
- let data = dataSignUpApi(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
46
+ };
47
+ const SignUpApi = async (values) => {
48
+ let data = dataSignUpApi({ ...values, geoCoordinates: geoCoordinates });
60
49
  let token;
61
- let { message, response, status } = yield CreateLimitedToken(tokenData);
50
+ let { message, response, status } = await CreateLimitedToken(tokenData);
62
51
  if (status == "success") {
63
- token = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.access_token;
52
+ token = response?.data?.access_token;
64
53
  }
65
54
  else {
66
55
  errorHandler(message, "SignUpApi", response);
@@ -74,12 +63,12 @@ const useAuth = (baseUrl, nodeUrl, userInfo, tokenData, programId, geoCoordinate
74
63
  };
75
64
  let headers = headerConfig(headersData);
76
65
  try {
77
- const response = yield restApi_1.default.restApi(baseUrl, "POST", endPointUser, headers, data);
66
+ const response = await restApi_1.default.restApi(baseUrl, "POST", endPointUser, headers, data);
78
67
  checkUserResponseAuth(response, true, "SignUpApi");
79
68
  return {
80
69
  response: response,
81
70
  newUser: {},
82
- 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 : "SignUp Api Successfully",
71
+ message: response?.data?.result?.friendly_message ?? "SignUp Api Successfully",
83
72
  status: "success",
84
73
  };
85
74
  }
@@ -91,10 +80,9 @@ const useAuth = (baseUrl, nodeUrl, userInfo, tokenData, programId, geoCoordinate
91
80
  status: "failed",
92
81
  };
93
82
  }
94
- });
95
- const LoginRequest = (values) => __awaiter(void 0, void 0, void 0, function* () {
96
- var _a, _b, _c;
97
- let data = dataSignInUrlEncoded(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }), programId);
83
+ };
84
+ const LoginRequest = async (values) => {
85
+ let data = dataSignInUrlEncoded({ ...values, geoCoordinates: geoCoordinates }, programId);
98
86
  let headersData = {
99
87
  header: true,
100
88
  isUrlEncoded: true,
@@ -103,12 +91,13 @@ const useAuth = (baseUrl, nodeUrl, userInfo, tokenData, programId, geoCoordinate
103
91
  };
104
92
  let headers = headerConfig(headersData);
105
93
  try {
106
- const response = yield restApi_1.default.restApi(baseUrl, "POST", "oauth/token", headers, data);
94
+ const response = await restApi_1.default.restApi(baseUrl, "POST", "oauth/token", headers, data);
107
95
  if (response.data.access_token) {
108
96
  return {
109
97
  response: response,
110
98
  newUser: {},
111
- 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 : "Login Request Successfully",
99
+ message: response?.data?.result?.friendly_message ??
100
+ "Login Request Successfully",
112
101
  status: "success",
113
102
  };
114
103
  }
@@ -127,10 +116,9 @@ const useAuth = (baseUrl, nodeUrl, userInfo, tokenData, programId, geoCoordinate
127
116
  status: "failed",
128
117
  };
129
118
  }
130
- });
131
- const LoginDeviceCredential = (values) => __awaiter(void 0, void 0, void 0, function* () {
132
- var _a, _b, _c;
133
- let data = dataSignInDeviceEncoded(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }), programId);
119
+ };
120
+ const LoginDeviceCredential = async (values) => {
121
+ let data = dataSignInDeviceEncoded({ ...values, geoCoordinates: geoCoordinates }, programId);
134
122
  let headersData = {
135
123
  header: true,
136
124
  isUrlEncoded: true,
@@ -139,12 +127,13 @@ const useAuth = (baseUrl, nodeUrl, userInfo, tokenData, programId, geoCoordinate
139
127
  };
140
128
  let headers = headerConfig(headersData);
141
129
  try {
142
- const response = yield restApi_1.default.restApi(baseUrl, "POST", "oauth/token", headers, data);
130
+ const response = await restApi_1.default.restApi(baseUrl, "POST", "oauth/token", headers, data);
143
131
  if (response.data.access_token) {
144
132
  return {
145
133
  response: response,
146
134
  newUser: {},
147
- 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 : "Login Device Credential Successfully",
135
+ message: response?.data?.result?.friendly_message ??
136
+ "Login Device Credential Successfully",
148
137
  status: "success",
149
138
  };
150
139
  }
@@ -163,14 +152,16 @@ const useAuth = (baseUrl, nodeUrl, userInfo, tokenData, programId, geoCoordinate
163
152
  status: "failed",
164
153
  };
165
154
  }
166
- });
167
- const SignUpWithGoogle = (values) => __awaiter(void 0, void 0, void 0, function* () {
168
- var _a, _b, _c, _d;
169
- let data = dataSignUpWithGoogle(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
155
+ };
156
+ const SignUpWithGoogle = async (values) => {
157
+ let data = dataSignUpWithGoogle({
158
+ ...values,
159
+ geoCoordinates: geoCoordinates,
160
+ });
170
161
  let token;
171
- let { message, response, status } = yield CreateLimitedToken(tokenData);
162
+ let { message, response, status } = await CreateLimitedToken(tokenData);
172
163
  if (status == "success") {
173
- token = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.access_token;
164
+ token = response?.data?.access_token;
174
165
  }
175
166
  else {
176
167
  errorHandler(message, "SignUpApi", response);
@@ -183,12 +174,13 @@ const useAuth = (baseUrl, nodeUrl, userInfo, tokenData, programId, geoCoordinate
183
174
  };
184
175
  let headers = headerConfig(headersData);
185
176
  try {
186
- const response = yield restApi_1.default.restApi(baseUrl, "POST", endPointUser, headers, data);
177
+ const response = await restApi_1.default.restApi(baseUrl, "POST", endPointUser, headers, data);
187
178
  checkUserResponseAuth(response, true, "SignUpWithGoogle");
188
179
  return {
189
180
  response: response,
190
181
  newUser: {},
191
- 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 : "SignUp With Google Successfully",
182
+ message: response?.data?.result?.friendly_message ??
183
+ "SignUp With Google Successfully",
192
184
  status: "success",
193
185
  };
194
186
  }
@@ -200,10 +192,9 @@ const useAuth = (baseUrl, nodeUrl, userInfo, tokenData, programId, geoCoordinate
200
192
  status: "failed",
201
193
  };
202
194
  }
203
- });
204
- const LoginWithGoogle = (values) => __awaiter(void 0, void 0, void 0, function* () {
205
- var _a, _b, _c;
206
- let data = dataSignInUrlEncodedWithGoogle(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }), programId);
195
+ };
196
+ const LoginWithGoogle = async (values) => {
197
+ let data = dataSignInUrlEncodedWithGoogle({ ...values, geoCoordinates: geoCoordinates }, programId);
207
198
  let headersData = {
208
199
  header: true,
209
200
  isUrlEncoded: true,
@@ -212,12 +203,13 @@ const useAuth = (baseUrl, nodeUrl, userInfo, tokenData, programId, geoCoordinate
212
203
  };
213
204
  let headers = headerConfig(headersData);
214
205
  try {
215
- const response = yield restApi_1.default.restApi(baseUrl, "POST", "oauth/token", headers, data);
206
+ const response = await restApi_1.default.restApi(baseUrl, "POST", "oauth/token", headers, data);
216
207
  if (response.data.access_token) {
217
208
  return {
218
209
  response: response,
219
210
  newUser: {},
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 : "Login Request Successfully",
211
+ message: response?.data?.result?.friendly_message ??
212
+ "Login Request Successfully",
221
213
  status: "success",
222
214
  };
223
215
  }
@@ -236,7 +228,7 @@ const useAuth = (baseUrl, nodeUrl, userInfo, tokenData, programId, geoCoordinate
236
228
  status: "failed",
237
229
  };
238
230
  }
239
- });
231
+ };
240
232
  return {
241
233
  GetUser,
242
234
  SignUpApi,
@@ -1,6 +1,6 @@
1
1
  import { CreateBankAccountInterFace, UpdateBankAccountInterFace, DeleteBankAccountInterFace, MakeBankAccountPrimaryInterFace } from "../interfaces/bankingSystemInterface";
2
2
  import { IGeoCoordinates, UserInfo } from "../interfaces/interface";
3
- export declare const useBankAccount: (token: string, userInfo: UserInfo, userId: string, baseUrl: string, geoCoordinates?: IGeoCoordinates, lang?: string) => {
3
+ export declare const useBankAccount: (token: string, userInfo: UserInfo, userId: string, baseUrl: string, geoCoordinates?: IGeoCoordinates | null, lang?: string) => {
4
4
  CreateBankAccount: (values: CreateBankAccountInterFace) => Promise<{
5
5
  response: import("axios").AxiosResponse<any, any>;
6
6
  newUser: any;