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
@@ -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,19 @@ const useIdentification = (token, userInfo, userId, baseUrl, geoCoordinates, lan
32
23
  let headers = headerConfig(headersData);
33
24
  return headers;
34
25
  };
35
- const CreateIdentification = (values) => __awaiter(void 0, void 0, void 0, function* () {
36
- var _a, _b, _c;
37
- let data = createDataIdentification(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
26
+ const CreateIdentification = async (values) => {
27
+ let data = createDataIdentification({
28
+ ...values,
29
+ geoCoordinates: geoCoordinates,
30
+ });
38
31
  try {
39
- const response = yield restApi_1.default.restApi(baseUrl, "POST", endPointIdentification, headerConfigIdentification(), data);
32
+ const response = await restApi_1.default.restApi(baseUrl, "POST", endPointIdentification, headerConfigIdentification(), data);
40
33
  let { newUserInfo } = checkGlobalResponse("identification", response, "CreateIdentification", "create");
41
34
  return {
42
35
  response: response,
43
36
  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 : "Identification Created Successfully",
37
+ message: response?.data?.result?.friendly_message ??
38
+ "Identification Created Successfully",
45
39
  status: "success",
46
40
  };
47
41
  }
@@ -53,17 +47,20 @@ const useIdentification = (token, userInfo, userId, baseUrl, geoCoordinates, lan
53
47
  status: "failed",
54
48
  };
55
49
  }
56
- });
57
- const UpdateIdentification = (values) => __awaiter(void 0, void 0, void 0, function* () {
58
- var _a, _b, _c;
59
- let data = updateDataIdentification(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
50
+ };
51
+ const UpdateIdentification = async (values) => {
52
+ let data = updateDataIdentification({
53
+ ...values,
54
+ geoCoordinates: geoCoordinates,
55
+ });
60
56
  try {
61
- const response = yield restApi_1.default.restApi(baseUrl, "PUT", endPointIdentification, headerConfigIdentification(), data);
57
+ const response = await restApi_1.default.restApi(baseUrl, "PUT", endPointIdentification, headerConfigIdentification(), data);
62
58
  let { newUserInfo } = checkGlobalResponse("identification", response, "UpdateIdentification", "update");
63
59
  return {
64
60
  response: response,
65
61
  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 : "Identification Updated Successfully",
62
+ message: response?.data?.result?.friendly_message ??
63
+ "Identification Updated Successfully",
67
64
  status: "success",
68
65
  };
69
66
  }
@@ -75,17 +72,20 @@ const useIdentification = (token, userInfo, userId, baseUrl, geoCoordinates, lan
75
72
  status: "failed",
76
73
  };
77
74
  }
78
- });
79
- const DeleteIdentification = (values) => __awaiter(void 0, void 0, void 0, function* () {
80
- var _a, _b, _c;
81
- let data = deleteDataIdentification(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
75
+ };
76
+ const DeleteIdentification = async (values) => {
77
+ let data = deleteDataIdentification({
78
+ ...values,
79
+ geoCoordinates: geoCoordinates,
80
+ });
82
81
  try {
83
- const response = yield restApi_1.default.restApi(baseUrl, "DELETE", endPointIdentification, headerConfigIdentification(), data);
82
+ const response = await restApi_1.default.restApi(baseUrl, "DELETE", endPointIdentification, headerConfigIdentification(), data);
84
83
  let { newUserInfo } = checkGlobalResponse("identification", response, "DeleteIdentification", "delete");
85
84
  return {
86
85
  response: response,
87
86
  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 : "Identification Deleted Successfully",
87
+ message: response?.data?.result?.friendly_message ??
88
+ "Identification Deleted Successfully",
89
89
  status: "success",
90
90
  };
91
91
  }
@@ -97,7 +97,7 @@ const useIdentification = (token, userInfo, userId, baseUrl, geoCoordinates, lan
97
97
  status: "failed",
98
98
  };
99
99
  }
100
- });
100
+ };
101
101
  return {
102
102
  CreateIdentification,
103
103
  UpdateIdentification,
@@ -1,6 +1,6 @@
1
1
  import { CreateDocumentOrganizationInterface, CreateOrganizationInterface, UpdateOrganizationInterface } from "../interfaces/organizationInterface";
2
2
  import { IGeoCoordinates, UserInfo } from "../interfaces/interface";
3
- export declare const useOrganization: (token: string, userInfo: UserInfo, userId: string, baseUrl: string, geoCoordinates?: IGeoCoordinates, lang?: string) => {
3
+ export declare const useOrganization: (token: string, userInfo: UserInfo, userId: string, baseUrl: string, geoCoordinates?: IGeoCoordinates | null, lang?: string) => {
4
4
  CreateOrganization: (values: CreateOrganizationInterface) => Promise<{
5
5
  response: 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 useOrganization = (token, userInfo, userId, baseUrl, geoCoordinates, lang)
32
23
  let headers = headerConfig(headersData);
33
24
  return headers;
34
25
  };
35
- const CreateOrganization = (values) => __awaiter(void 0, void 0, void 0, function* () {
36
- var _a, _b, _c;
37
- let data = dataCreateOrganization(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }), userId);
26
+ const CreateOrganization = async (values) => {
27
+ let data = dataCreateOrganization({ ...values, geoCoordinates: geoCoordinates }, userId);
38
28
  try {
39
- const response = yield restApi_1.default.restApi(baseUrl, "POST", endPoint, headerConfigDevice(), data);
29
+ const response = await restApi_1.default.restApi(baseUrl, "POST", endPoint, headerConfigDevice(), data);
40
30
  let { newUserInfo } = checkGlobalResponse("organization", response, "CreateOrganization", "createOrganization");
41
31
  return {
42
- response: response === null || response === void 0 ? void 0 : response.data,
32
+ response: response?.data,
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 : "Create Organization Successfully",
34
+ message: response?.data?.result?.friendly_message ??
35
+ "Create Organization Successfully",
45
36
  status: "success",
46
37
  };
47
38
  }
@@ -53,17 +44,17 @@ const useOrganization = (token, userInfo, userId, baseUrl, geoCoordinates, lang)
53
44
  status: "failed",
54
45
  };
55
46
  }
56
- });
57
- const UpdateOrganization = (values, organizationId) => __awaiter(void 0, void 0, void 0, function* () {
58
- var _a, _b, _c;
59
- let data = dataUpdateOrganization(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }), userId);
47
+ };
48
+ const UpdateOrganization = async (values, organizationId) => {
49
+ let data = dataUpdateOrganization({ ...values, geoCoordinates: geoCoordinates }, userId);
60
50
  try {
61
- const response = yield restApi_1.default.restApi(baseUrl, "PUT", `${endPoint}/${organizationId}`, headerConfigDevice(), data);
51
+ const response = await restApi_1.default.restApi(baseUrl, "PUT", `${endPoint}/${organizationId}`, headerConfigDevice(), data);
62
52
  let { newUserInfo } = checkGlobalResponse("organization", response, "UpdateOrganization", "updateOrganization");
63
53
  return {
64
- response: response === null || response === void 0 ? void 0 : response.data,
54
+ response: response?.data,
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 : "Update Organization Successfully",
56
+ message: response?.data?.result?.friendly_message ??
57
+ "Update Organization Successfully",
67
58
  status: "success",
68
59
  };
69
60
  }
@@ -75,16 +66,16 @@ const useOrganization = (token, userInfo, userId, baseUrl, geoCoordinates, lang)
75
66
  status: "failed",
76
67
  };
77
68
  }
78
- });
79
- const DeleteOrganization = (organizationId) => __awaiter(void 0, void 0, void 0, function* () {
80
- var _a, _b, _c;
69
+ };
70
+ const DeleteOrganization = async (organizationId) => {
81
71
  try {
82
- const response = yield restApi_1.default.restApi(baseUrl, "DELETE", `${endPoint}/${organizationId}`, headerConfigDevice());
72
+ const response = await restApi_1.default.restApi(baseUrl, "DELETE", `${endPoint}/${organizationId}`, headerConfigDevice());
83
73
  let { newUserInfo } = checkGlobalResponse("organization", response, "DeleteOrganization", "deleteOrganization");
84
74
  return {
85
- response: response === null || response === void 0 ? void 0 : response.data,
75
+ response: response?.data,
86
76
  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 : "Delete Organization Successfully",
77
+ message: response?.data?.result?.friendly_message ??
78
+ "Delete Organization Successfully",
88
79
  status: "success",
89
80
  };
90
81
  }
@@ -96,17 +87,20 @@ const useOrganization = (token, userInfo, userId, baseUrl, geoCoordinates, lang)
96
87
  status: "failed",
97
88
  };
98
89
  }
99
- });
100
- const CreateDocumentOrganization = (values, organizationId) => __awaiter(void 0, void 0, void 0, function* () {
101
- var _a, _b, _c;
102
- let data = dataCreateDocumentOrganization(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
90
+ };
91
+ const CreateDocumentOrganization = async (values, organizationId) => {
92
+ let data = dataCreateDocumentOrganization({
93
+ ...values,
94
+ geoCoordinates: geoCoordinates,
95
+ });
103
96
  try {
104
- const response = yield restApi_1.default.restApi(baseUrl, "POST", `${endPoint}/document/${organizationId}`, headerConfigDevice(), data);
97
+ const response = await restApi_1.default.restApi(baseUrl, "POST", `${endPoint}/document/${organizationId}`, headerConfigDevice(), data);
105
98
  let { newUserInfo } = checkGlobalResponse("organization", response, "CreateDocumentOrganization", "createDocumentOrganization");
106
99
  return {
107
- response: response === null || response === void 0 ? void 0 : response.data,
100
+ response: response?.data,
108
101
  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 : "Create Document Organization Successfully",
102
+ message: response?.data?.result?.friendly_message ??
103
+ "Create Document Organization Successfully",
110
104
  status: "success",
111
105
  };
112
106
  }
@@ -118,7 +112,7 @@ const useOrganization = (token, userInfo, userId, baseUrl, geoCoordinates, lang)
118
112
  status: "failed",
119
113
  };
120
114
  }
121
- });
115
+ };
122
116
  return {
123
117
  CreateOrganization,
124
118
  UpdateOrganization,
@@ -1,6 +1,6 @@
1
1
  import { UpdatePersonalInfoInterface, UpdateProfilePictureInterface } from "../interfaces/bankingSystemInterface";
2
2
  import { IGeoCoordinates, UserInfo } from "../interfaces/interface";
3
- export declare const usePersonalInfo: (token: string, userInfo: UserInfo, userId: string, baseUrl: string, geoCoordinates?: IGeoCoordinates, lang?: string) => {
3
+ export declare const usePersonalInfo: (token: string, userInfo: UserInfo, userId: string, baseUrl: string, geoCoordinates?: IGeoCoordinates | null, lang?: string) => {
4
4
  UpdatePersonalInfo: (values: UpdatePersonalInfoInterface) => 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,19 @@ const usePersonalInfo = (token, userInfo, userId, baseUrl, geoCoordinates, lang)
32
23
  let headers = headerConfig(headersData);
33
24
  return headers;
34
25
  };
35
- const UpdatePersonalInfo = (values) => __awaiter(void 0, void 0, void 0, function* () {
36
- var _a, _b, _c;
37
- const data = updateDataPersonalInfo(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
26
+ const UpdatePersonalInfo = async (values) => {
27
+ const data = updateDataPersonalInfo({
28
+ ...values,
29
+ geoCoordinates: geoCoordinates,
30
+ });
38
31
  try {
39
- const response = yield restApi_1.default.restApi(baseUrl, "PUT", endPoint, headerConfigPersonalInfo(), data);
32
+ const response = await restApi_1.default.restApi(baseUrl, "PUT", endPoint, headerConfigPersonalInfo(), data);
40
33
  let { newUserInfo } = checkGlobalResponse("personal_info", response, "UpdatePersonalInfo", "updateObjectInfo");
41
34
  return {
42
35
  response: response,
43
36
  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 : "User Info updated Successfully",
37
+ message: response?.data?.result?.friendly_message ??
38
+ "User Info updated Successfully",
45
39
  status: "success",
46
40
  };
47
41
  }
@@ -53,24 +47,27 @@ const usePersonalInfo = (token, userInfo, userId, baseUrl, geoCoordinates, lang)
53
47
  status: "failed",
54
48
  };
55
49
  }
56
- });
57
- const UpdateProfilePicture = (values) => __awaiter(void 0, void 0, void 0, function* () {
58
- var _a, _b, _c, _d, _e;
59
- const data = updateProfilePicture(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
50
+ };
51
+ const UpdateProfilePicture = async (values) => {
52
+ const data = updateProfilePicture({
53
+ ...values,
54
+ geoCoordinates: geoCoordinates,
55
+ });
60
56
  let headersData = {
61
57
  header: true,
62
58
  isUrlEncoded: false,
63
- token: (_a = values.token) !== null && _a !== void 0 ? _a : token,
59
+ token: values.token ?? token,
64
60
  lang: lang,
65
61
  };
66
62
  let headers = headerConfig(headersData);
67
63
  try {
68
- const response = yield restApi_1.default.restApi(baseUrl, "POST", `V1/User/document/${(_b = values.userId) !== null && _b !== void 0 ? _b : userId}`, headers, data);
64
+ const response = await restApi_1.default.restApi(baseUrl, "POST", `V1/User/document/${values.userId ?? userId}`, headers, data);
69
65
  let { newUserInfo } = checkGlobalResponse("personal_info", response, "UpdateProfilePicture", "updateProfilePicture");
70
66
  return {
71
67
  response: response,
72
68
  newUser: newUserInfo,
73
- message: (_e = (_d = (_c = response === null || response === void 0 ? void 0 : response.data) === null || _c === void 0 ? void 0 : _c.result) === null || _d === void 0 ? void 0 : _d.friendly_message) !== null && _e !== void 0 ? _e : "Picture Updated Successfully",
69
+ message: response?.data?.result?.friendly_message ??
70
+ "Picture Updated Successfully",
74
71
  status: "success",
75
72
  };
76
73
  }
@@ -82,7 +79,7 @@ const usePersonalInfo = (token, userInfo, userId, baseUrl, geoCoordinates, lang)
82
79
  status: "failed",
83
80
  };
84
81
  }
85
- });
82
+ };
86
83
  return {
87
84
  UpdatePersonalInfo,
88
85
  UpdateProfilePicture,
@@ -1,6 +1,6 @@
1
1
  import { IGeoCoordinates, UserInfo } from "../interfaces/interface";
2
2
  import { ConfirmLimitedPhoneInterface, CreateUserPhoneInterface, DeleteUserPhoneInterface, MakeUserPhonePrimaryInterface, UpdateUserPhoneInterface, VerifyLimitedPhoneInterface } from "../interfaces/bankingSystemInterface";
3
- export declare const usePhone: (token: string, userInfo: UserInfo, userId: string, baseUrl: string, geoCoordinates?: IGeoCoordinates, lang?: string) => {
3
+ export declare const usePhone: (token: string, userInfo: UserInfo, userId: string, baseUrl: string, geoCoordinates?: IGeoCoordinates | null, lang?: string) => {
4
4
  CreateUserPhone: (values: CreateUserPhoneInterface) => 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 usePhone = (token, userInfo, userId, baseUrl, geoCoordinates, lang) => {
32
23
  let headers = headerConfig(headersData);
33
24
  return headers;
34
25
  };
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 }));
26
+ const CreateUserPhone = async (values) => {
27
+ let data = createDataPhone({ ...values, geoCoordinates: geoCoordinates });
38
28
  try {
39
- const response = yield restApi_1.default.restApi(baseUrl, "POST", endPointPhone, headerConfigPhone(), data);
29
+ const response = await restApi_1.default.restApi(baseUrl, "POST", endPointPhone, headerConfigPhone(), data);
40
30
  let { newUserInfo } = checkGlobalResponse("phone", response, "CreateUserPhone", "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 : "Phone Created Successfully",
34
+ message: response?.data?.result?.friendly_message ??
35
+ "Phone Created Successfully",
45
36
  status: "success",
46
37
  };
47
38
  }
@@ -53,17 +44,17 @@ const usePhone = (token, userInfo, userId, baseUrl, geoCoordinates, lang) => {
53
44
  status: "failed",
54
45
  };
55
46
  }
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 }));
47
+ };
48
+ const DeleteUserPhone = async (values) => {
49
+ let data = deleteDataPhone({ ...values, geoCoordinates: geoCoordinates });
60
50
  try {
61
- const response = yield restApi_1.default.restApi(baseUrl, "DELETE", endPointPhone, headerConfigPhone(), data);
51
+ const response = await restApi_1.default.restApi(baseUrl, "DELETE", endPointPhone, headerConfigPhone(), data);
62
52
  let { newUserInfo } = checkGlobalResponse("phone", response, "DeleteUserPhone", "delete");
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 : "Phone Deleted Successfully",
56
+ message: response?.data?.result?.friendly_message ??
57
+ "Phone Deleted Successfully",
67
58
  status: "success",
68
59
  };
69
60
  }
@@ -75,11 +66,11 @@ const usePhone = (token, userInfo, userId, baseUrl, geoCoordinates, lang) => {
75
66
  status: "failed",
76
67
  };
77
68
  }
78
- });
79
- const VerifyUserPhone = (values) => __awaiter(void 0, void 0, void 0, function* () {
80
- let data = verifyDataPhone(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
69
+ };
70
+ const VerifyUserPhone = async (values) => {
71
+ let data = verifyDataPhone({ ...values, geoCoordinates: geoCoordinates });
81
72
  try {
82
- const response = yield restApi_1.default.restApi(baseUrl, "POST", `v1/user/security/verify/${userId}`, headerConfigPhone(), data);
73
+ const response = await restApi_1.default.restApi(baseUrl, "POST", `v1/user/security/verify/${userId}`, headerConfigPhone(), data);
83
74
  let { newUserInfo } = checkGlobalResponse("phone", response, "VerifyUserPhone");
84
75
  return {
85
76
  response: response,
@@ -96,17 +87,17 @@ const usePhone = (token, userInfo, userId, baseUrl, geoCoordinates, lang) => {
96
87
  status: "failed",
97
88
  };
98
89
  }
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 }));
90
+ };
91
+ const ConfirmUserPhone = async (values) => {
92
+ let data = confirmDataPhone({ ...values, geoCoordinates: geoCoordinates });
103
93
  try {
104
- const response = yield restApi_1.default.restApi(baseUrl, "POST", `v1/user/security/confirm/${userId}`, headerConfigPhone(), data);
94
+ const response = await restApi_1.default.restApi(baseUrl, "POST", `v1/user/security/confirm/${userId}`, headerConfigPhone(), data);
105
95
  let { newUserInfo } = checkGlobalResponse("phone", response, "ConfirmUserPhone", "confirm");
106
96
  return {
107
97
  response: response,
108
98
  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",
99
+ message: response?.data?.result?.friendly_message ??
100
+ "Phone Confirmed Successfully",
110
101
  status: "success",
111
102
  };
112
103
  }
@@ -118,17 +109,17 @@ const usePhone = (token, userInfo, userId, baseUrl, geoCoordinates, lang) => {
118
109
  status: "failed",
119
110
  };
120
111
  }
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 }));
112
+ };
113
+ const UpdateUserPhone = async (values) => {
114
+ let data = updateDataPhone({ ...values, geoCoordinates: geoCoordinates });
125
115
  try {
126
- const response = yield restApi_1.default.restApi(baseUrl, "PUT", endPointPhone, headerConfigPhone(), data);
116
+ const response = await restApi_1.default.restApi(baseUrl, "PUT", endPointPhone, headerConfigPhone(), data);
127
117
  let { newUserInfo } = checkGlobalResponse("phone", response, "UpdateUserPhone", "update");
128
118
  return {
129
119
  response: response,
130
120
  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",
121
+ message: response?.data?.result?.friendly_message ??
122
+ "Phone Updated Successfully",
132
123
  status: "success",
133
124
  };
134
125
  }
@@ -140,17 +131,20 @@ const usePhone = (token, userInfo, userId, baseUrl, geoCoordinates, lang) => {
140
131
  status: "failed",
141
132
  };
142
133
  }
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 }));
134
+ };
135
+ const MakeUserPhonePrimary = async (values) => {
136
+ let data = makePrimaryDataPhone({
137
+ ...values,
138
+ geoCoordinates: geoCoordinates,
139
+ });
147
140
  try {
148
- const response = yield restApi_1.default.restApi(baseUrl, "PUT", endPointPhone, headerConfigPhone(), data);
141
+ const response = await restApi_1.default.restApi(baseUrl, "PUT", endPointPhone, headerConfigPhone(), data);
149
142
  let { newUserInfo } = checkGlobalResponse("phone", response, "MakeUserPhonePrimary", "updatePrimary");
150
143
  return {
151
144
  response: response,
152
145
  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`,
146
+ message: response?.data?.result?.friendly_message ??
147
+ `${values.number} Now Is Primary`,
154
148
  status: "success",
155
149
  };
156
150
  }
@@ -162,7 +156,7 @@ const usePhone = (token, userInfo, userId, baseUrl, geoCoordinates, lang) => {
162
156
  status: "failed",
163
157
  };
164
158
  }
165
- });
159
+ };
166
160
  return {
167
161
  CreateUserPhone,
168
162
  DeleteUserPhone,
@@ -1,6 +1,6 @@
1
1
  import { ChangeUserSecurityCodeInterface, ResetPasswordInterface, ResetSecurityQuestionsInterface, UpdateUserPreferencesInterface, ValidateSecurityCodeInterface, ActivateGoogleAuthInterface, DeleteGoogleAuthInterface } from "../interfaces/bankingSystemInterface";
2
2
  import { IGeoCoordinates, UserInfo } from "../interfaces/interface";
3
- export declare const useSecurity: (token: string, userInfo: UserInfo, userId: string, baseUrl: string, geoCoordinates?: IGeoCoordinates, lang?: string) => {
3
+ export declare const useSecurity: (token: string, userInfo: UserInfo, userId: string, baseUrl: string, geoCoordinates?: IGeoCoordinates | null, lang?: string) => {
4
4
  ResetPassword: (values: ResetPasswordInterface) => Promise<{
5
5
  response: import("axios").AxiosResponse<any, any>;
6
6
  newUser: any;