ggez-banking-sdk 0.1.177 → 0.1.179

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 (62) hide show
  1. package/dist/api/clients/account.d.ts +4 -4
  2. package/dist/api/clients/account.js +10 -11
  3. package/dist/api/clients/auth.d.ts +4 -4
  4. package/dist/api/clients/auth.js +13 -14
  5. package/dist/api/clients/base.d.ts +8 -0
  6. package/dist/api/clients/base.js +12 -0
  7. package/dist/api/clients/blockchain.d.ts +8 -8
  8. package/dist/api/clients/blockchain.js +14 -15
  9. package/dist/api/clients/ipAddressAndLocation.d.ts +17 -7
  10. package/dist/api/clients/ipAddressAndLocation.js +26 -14
  11. package/dist/api/clients/limited.d.ts +4 -4
  12. package/dist/api/clients/limited.js +21 -22
  13. package/dist/api/clients/order.d.ts +4 -4
  14. package/dist/api/clients/order.js +7 -8
  15. package/dist/api/clients/organization.d.ts +4 -4
  16. package/dist/api/clients/organization.js +13 -14
  17. package/dist/api/clients/promotion.d.ts +4 -4
  18. package/dist/api/clients/promotion.js +11 -12
  19. package/dist/api/clients/transaction.d.ts +4 -4
  20. package/dist/api/clients/transaction.js +10 -10
  21. package/dist/api/clients/user.d.ts +4 -4
  22. package/dist/api/clients/user.js +159 -159
  23. package/dist/api/data/result.js +3 -3
  24. package/dist/api/services/account.d.ts +1 -1
  25. package/dist/api/services/account.js +7 -9
  26. package/dist/api/services/auth.d.ts +1 -1
  27. package/dist/api/services/auth.js +4 -4
  28. package/dist/api/services/base.d.ts +2 -1
  29. package/dist/api/services/base.js +15 -17
  30. package/dist/api/services/blockchain.d.ts +2 -2
  31. package/dist/api/services/blockchain.js +6 -6
  32. package/dist/api/services/ipAddressAndLocation.d.ts +1 -1
  33. package/dist/api/services/ipAddressAndLocation.js +3 -3
  34. package/dist/api/services/limited.d.ts +1 -1
  35. package/dist/api/services/limited.js +13 -13
  36. package/dist/api/services/order.d.ts +2 -2
  37. package/dist/api/services/order.js +4 -4
  38. package/dist/api/services/organization.d.ts +2 -2
  39. package/dist/api/services/organization.js +7 -7
  40. package/dist/api/services/promotion.d.ts +2 -2
  41. package/dist/api/services/promotion.js +5 -5
  42. package/dist/api/services/transaction.d.ts +2 -2
  43. package/dist/api/services/transaction.js +5 -5
  44. package/dist/api/services/user.d.ts +2 -2
  45. package/dist/api/services/user.js +66 -66
  46. package/dist/helper/api/responseHelper.d.ts +6 -4
  47. package/dist/helper/api/responseHelper.js +8 -4
  48. package/dist/helper/storage/cookiesHelper.d.ts +3 -10
  49. package/dist/helper/storage/cookiesHelper.js +25 -21
  50. package/dist/helper/storage/localStorageHelper.d.ts +5 -5
  51. package/dist/helper/storage/localStorageHelper.js +31 -13
  52. package/dist/helper/storage/storageHelper.d.ts +3 -2
  53. package/dist/helper/storage/storageHelper.js +10 -4
  54. package/dist/tsconfig.tsbuildinfo +1 -1
  55. package/dist/types/api/service/base.d.ts +2 -1
  56. package/dist/types/api/service/index.d.ts +1 -0
  57. package/dist/types/helper/index.d.ts +1 -0
  58. package/dist/types/helper/storageHelper/cookiesHelper.d.ts +9 -0
  59. package/dist/types/helper/storageHelper/cookiesHelper.js +1 -0
  60. package/dist/types/helper/storageHelper/index.d.ts +1 -0
  61. package/dist/types/helper/storageHelper/index.js +1 -0
  62. package/package.json +1 -1
@@ -6,275 +6,275 @@ class UserService extends BaseService {
6
6
  url;
7
7
  userId;
8
8
  endpoint = Endpoints.User;
9
- constructor(data) {
10
- super(data);
9
+ constructor(data, errorHandler) {
10
+ super(data, errorHandler);
11
11
  this.userId = data.userId;
12
12
  this.axiosInstance.interceptors.request.use(async (req) => {
13
13
  const locationService = new IPAddressAndLocationService({
14
14
  config: data.config,
15
15
  userId: this.userId,
16
- });
16
+ }, this.errorHandler);
17
17
  const geoCoordinates = await GeoHelper.GetGeoCoordinates(locationService);
18
18
  AxiosHelper.InjectGeoCoordinates(req, geoCoordinates);
19
19
  return req;
20
20
  });
21
21
  }
22
22
  // #region "GET"
23
- async getUser(userId) {
23
+ getUser(userId) {
24
24
  const url = this.resolveURL(`/${userId}`);
25
25
  return this.GET(url);
26
26
  }
27
- async getTermsAndConditions(userId) {
27
+ getTermsAndConditions(userId) {
28
28
  const url = this.resolveURL(`${UserEndpoints.TermsAndConditions}/${userId}`);
29
29
  return this.GET(url);
30
30
  }
31
- async getSecurity(userId) {
31
+ getSecurity(userId) {
32
32
  const url = this.resolveURL(`${UserEndpoints.Security}/${userId}`);
33
33
  return this.GET(url);
34
34
  }
35
- async getPhone(userId) {
35
+ getPhone(userId) {
36
36
  const url = this.resolveURL(`${UserEndpoints.Phone}/${userId}`);
37
37
  return this.GET(url);
38
38
  }
39
- async getPreferences(userId) {
39
+ getPreferences(userId) {
40
40
  const url = this.resolveURL(`${UserEndpoints.Preferences}/${userId}`);
41
41
  return this.GET(url);
42
42
  }
43
- async getPersonalInfo(userId) {
43
+ getPersonalInfo(userId) {
44
44
  const url = this.resolveURL(`${UserEndpoints.PersonalInfo}/${userId}`);
45
45
  return this.GET(url);
46
46
  }
47
- async getLatestHistory(userId) {
47
+ getLatestHistory(userId) {
48
48
  const url = this.resolveURL(`${UserEndpoints.HistoryLatest}/${userId}`);
49
49
  return this.GET(url);
50
50
  }
51
- async getIdentification(userId) {
51
+ getIdentification(userId) {
52
52
  const url = this.resolveURL(`${UserEndpoints.Identification}/${userId}`);
53
53
  return this.GET(url);
54
54
  }
55
- async getHistory(userId) {
55
+ getHistory(userId) {
56
56
  const url = this.resolveURL(`${UserEndpoints.HistoryLatest}/${userId}`);
57
57
  return this.GET(url);
58
58
  }
59
- async getGroup(userId) {
59
+ getGroup(userId) {
60
60
  const url = this.resolveURL(`${UserEndpoints.Group}/${userId}`);
61
61
  return this.GET(url);
62
62
  }
63
- async getExternalAuth(userId) {
63
+ getExternalAuth(userId) {
64
64
  const url = this.resolveURL(`${UserEndpoints.ExternalAuth}/${userId}`);
65
65
  return this.GET(url);
66
66
  }
67
- async getEmail(userId) {
67
+ getEmail(userId) {
68
68
  const url = this.resolveURL(`${UserEndpoints.Email}/${userId}`);
69
69
  return this.GET(url);
70
70
  }
71
- async getDocuments(userId) {
71
+ getDocuments(userId) {
72
72
  const url = this.resolveURL(`${UserEndpoints.Documents}/${userId}`);
73
73
  return this.GET(url);
74
74
  }
75
- async getCurrency(userId) {
75
+ getCurrency(userId) {
76
76
  const url = this.resolveURL(`${UserEndpoints.Currency}/${userId}`);
77
77
  return this.GET(url);
78
78
  }
79
- async getCreditCard(userId) {
79
+ getCreditCard(userId) {
80
80
  const url = this.resolveURL(`${UserEndpoints.CreditCard}/${userId}`);
81
81
  return this.GET(url);
82
82
  }
83
- async getBankAccount(userId) {
83
+ getBankAccount(userId) {
84
84
  const url = this.resolveURL(`${UserEndpoints.BankAccount}/${userId}`);
85
85
  return this.GET(url);
86
86
  }
87
- async getAddress(userId) {
87
+ getAddress(userId) {
88
88
  const url = this.resolveURL(`${UserEndpoints.Address}/${userId}`);
89
89
  return this.GET(url);
90
90
  }
91
- async getAccount(userId) {
91
+ getAccount(userId) {
92
92
  const url = this.resolveURL(`${UserEndpoints.Account}/${userId}`);
93
93
  return this.GET(url);
94
94
  }
95
- async getDeviceHistory(userId) {
95
+ getDeviceHistory(userId) {
96
96
  const url = this.resolveURL(`${UserEndpoints.DeviceHistory}/${userId}`);
97
97
  return this.GET(url);
98
98
  }
99
- async getActivity(userId) {
99
+ getActivity(userId) {
100
100
  const url = this.resolveURL(`${UserEndpoints.Activity}/${userId}`);
101
101
  return this.GET(url);
102
102
  }
103
103
  // #endregion
104
104
  // #region "POST"
105
- async createUser(payload, config) {
105
+ createUser(payload, config) {
106
106
  const url = this.resolveURL();
107
107
  return this.POST(url, payload, config);
108
108
  }
109
- async createPhone(userId, payload) {
109
+ createPhone(userId, payload) {
110
110
  const url = this.resolveURL(`${UserEndpoints.Phone}/${userId}`);
111
111
  return this.POST(url, payload);
112
112
  }
113
- async createDevice(userId, payload) {
113
+ createDevice(userId, payload) {
114
114
  const url = this.resolveURL(`${UserEndpoints.Device}/${userId}`);
115
115
  return this.POST(url, payload);
116
116
  }
117
- async createIdentification(userId, payload) {
117
+ createIdentification(userId, payload) {
118
118
  const url = this.resolveURL(`${UserEndpoints.Identification}/${userId}`);
119
119
  return this.POST(url, payload);
120
120
  }
121
- async createExternalAuth(userId, payload) {
121
+ createExternalAuth(userId, payload) {
122
122
  const url = this.resolveURL(`${UserEndpoints.ExternalAuth}/${userId}`);
123
123
  return this.POST(url, payload);
124
124
  }
125
- async createEmail(userId, payload) {
125
+ createEmail(userId, payload) {
126
126
  const url = this.resolveURL(`${UserEndpoints.Email}/${userId}`);
127
127
  return this.POST(url, payload);
128
128
  }
129
- async createCurrency(userId, payload) {
129
+ createCurrency(userId, payload) {
130
130
  const url = this.resolveURL(`${UserEndpoints.Currency}/${userId}`);
131
131
  return this.POST(url, payload);
132
132
  }
133
- async createCreditCard(userId, payload) {
133
+ createCreditCard(userId, payload) {
134
134
  const url = this.resolveURL(`${UserEndpoints.CreditCard}/${userId}`);
135
135
  return this.POST(url, payload);
136
136
  }
137
- async createBankAccount(userId, payload) {
137
+ createBankAccount(userId, payload) {
138
138
  const url = this.resolveURL(`${UserEndpoints.BankAccount}/${userId}`);
139
139
  return this.POST(url, payload);
140
140
  }
141
- async createAddress(userId, payload) {
141
+ createAddress(userId, payload) {
142
142
  const url = this.resolveURL(`${UserEndpoints.Address}/${userId}`);
143
143
  return this.POST(url, payload);
144
144
  }
145
- async createTicket(userId, payload) {
145
+ createTicket(userId, payload) {
146
146
  const url = this.resolveURL(`${UserEndpoints.Ticket}/${userId}`);
147
147
  return this.POST(url, payload);
148
148
  }
149
- async securityAccess(userId, payload) {
149
+ securityAccess(userId, payload) {
150
150
  const url = this.resolveURL(`${UserEndpoints.SecurityAccess}/${userId}`);
151
151
  return this.POST(url, payload);
152
152
  }
153
- async uploadDocument(userId, payload) {
153
+ uploadDocument(userId, payload) {
154
154
  const url = this.resolveURL(`${UserEndpoints.Document}/${userId}`);
155
155
  return this.POST(url, payload);
156
156
  }
157
- async confirmSecurityData(userId, payload) {
157
+ confirmSecurityData(userId, payload) {
158
158
  const url = this.resolveURL(`${UserEndpoints.SecurityConfirm}/${userId}`);
159
159
  return this.POST(url, payload);
160
160
  }
161
- async validateSecurityData(userId, payload) {
161
+ validateSecurityData(userId, payload) {
162
162
  const url = this.resolveURL(`${UserEndpoints.SecurityValidate}/${userId}`);
163
163
  return this.POST(url, payload);
164
164
  }
165
- async verifySecurityData(userId, payload) {
165
+ verifySecurityData(userId, payload) {
166
166
  const url = this.resolveURL(`${UserEndpoints.SecurityVerify}/${userId}`);
167
167
  return this.POST(url, payload);
168
168
  }
169
- async resetSecurityData(userId, payload) {
169
+ resetSecurityData(userId, payload) {
170
170
  const url = this.resolveURL(`${UserEndpoints.SecurityReset}/${userId}`);
171
171
  return this.POST(url, payload);
172
172
  }
173
- async enrollGoogleAuth(userId, payload) {
173
+ enrollGoogleAuth(userId, payload) {
174
174
  const url = this.resolveURL(`${UserEndpoints.AuthEnroll}/${userId}`);
175
175
  return this.POST(url, payload);
176
176
  }
177
- async activateGoogleAuth(userId, payload) {
177
+ activateGoogleAuth(userId, payload) {
178
178
  const url = this.resolveURL(`${UserEndpoints.AuthActivate}/${userId}`);
179
179
  return this.POST(url, payload);
180
180
  }
181
- async deactivateGoogleAuth(userId, payload) {
181
+ deactivateGoogleAuth(userId, payload) {
182
182
  const url = this.resolveURL(`${UserEndpoints.AuthDeactivate}/${userId}`);
183
183
  return this.POST(url, payload);
184
184
  }
185
- async deleteGoogleAuth(userId, payload) {
185
+ deleteGoogleAuth(userId, payload) {
186
186
  const url = this.resolveURL(`${UserEndpoints.AuthDelete}/${userId}`);
187
187
  return this.POST(url, payload);
188
188
  }
189
189
  // #endregion
190
190
  // #region "PUT"
191
- async updateUser(userId, payload) {
191
+ updateUser(userId, payload) {
192
192
  const url = this.resolveURL(`/${userId}`);
193
193
  return this.PUT(url, payload);
194
194
  }
195
- async updateSecurity(userId, payload) {
195
+ updateSecurity(userId, payload) {
196
196
  const url = this.resolveURL(`${UserEndpoints.Security}/${userId}`);
197
197
  return this.PUT(url, payload);
198
198
  }
199
- async updatePreferences(userId, payload) {
199
+ updatePreferences(userId, payload) {
200
200
  const url = this.resolveURL(`${UserEndpoints.Preferences}/${userId}`);
201
201
  return this.PUT(url, payload);
202
202
  }
203
- async updateDevice(userId, payload) {
203
+ updateDevice(userId, payload) {
204
204
  const url = this.resolveURL(`${UserEndpoints.Device}/${userId}`);
205
205
  return this.PUT(url, payload);
206
206
  }
207
- async logoutDevice(userId, payload) {
207
+ logoutDevice(userId, payload) {
208
208
  const url = this.resolveURL(`${UserEndpoints.DeviceLogout}/${userId}`);
209
209
  return this.PUT(url, payload);
210
210
  }
211
- async updatePhone(userId, payload) {
211
+ updatePhone(userId, payload) {
212
212
  const url = this.resolveURL(`${UserEndpoints.Phone}/${userId}`);
213
213
  return this.PUT(url, payload);
214
214
  }
215
- async updatePersonalInfo(userId, payload) {
215
+ updatePersonalInfo(userId, payload) {
216
216
  const url = this.resolveURL(`${UserEndpoints.PersonalInfo}/${userId}`);
217
217
  return this.PUT(url, payload);
218
218
  }
219
- async updateIdentification(userId, payload) {
219
+ updateIdentification(userId, payload) {
220
220
  const url = this.resolveURL(`${UserEndpoints.Identification}/${userId}`);
221
221
  return this.PUT(url, payload);
222
222
  }
223
- async updateExternalAuth(userId, payload) {
223
+ updateExternalAuth(userId, payload) {
224
224
  const url = this.resolveURL(`${UserEndpoints.ExternalAuth}/${userId}`);
225
225
  return this.PUT(url, payload);
226
226
  }
227
- async updateEmail(userId, payload) {
227
+ updateEmail(userId, payload) {
228
228
  const url = this.resolveURL(`${UserEndpoints.Email}/${userId}`);
229
229
  return this.PUT(url, payload);
230
230
  }
231
- async updateCreditCard(userId, payload) {
231
+ updateCreditCard(userId, payload) {
232
232
  const url = this.resolveURL(`${UserEndpoints.CreditCard}/${userId}`);
233
233
  return this.PUT(url, payload);
234
234
  }
235
- async updateBankAccount(userId, payload) {
235
+ updateBankAccount(userId, payload) {
236
236
  const url = this.resolveURL(`${UserEndpoints.BankAccount}/${userId}`);
237
237
  return this.PUT(url, payload);
238
238
  }
239
- async updateAddress(userId, payload) {
239
+ updateAddress(userId, payload) {
240
240
  const url = this.resolveURL(`${UserEndpoints.Address}/${userId}`);
241
241
  return this.PUT(url, payload);
242
242
  }
243
243
  // #endregion
244
244
  // #region "DELETE"
245
- async deleteUser(userId) {
245
+ deleteUser(userId) {
246
246
  const url = this.resolveURL(`/${userId}`);
247
247
  return this.DELETE(url);
248
248
  }
249
- async deleteCreditCard(userId) {
249
+ deleteCreditCard(userId) {
250
250
  const url = this.resolveURL(`${UserEndpoints.CreditCard}/${userId}`);
251
251
  return this.DELETE(url);
252
252
  }
253
- async deleteAddress(userId, payload) {
253
+ deleteAddress(userId, payload) {
254
254
  const url = this.resolveURL(`${UserEndpoints.Address}/${userId}`);
255
255
  return this.DELETE(url, payload);
256
256
  }
257
- async deleteDevice(userId, payload) {
257
+ deleteDevice(userId, payload) {
258
258
  const url = this.resolveURL(`${UserEndpoints.Device}/${userId}`);
259
259
  return this.DELETE(url, payload);
260
260
  }
261
- async deleteBankAccount(userId, payload) {
261
+ deleteBankAccount(userId, payload) {
262
262
  const url = this.resolveURL(`${UserEndpoints.BankAccount}/${userId}`);
263
263
  return this.DELETE(url, payload);
264
264
  }
265
- async deleteIdentification(userId, payload) {
265
+ deleteIdentification(userId, payload) {
266
266
  const url = this.resolveURL(`${UserEndpoints.Identification}/${userId}`);
267
267
  return this.DELETE(url, payload);
268
268
  }
269
- async deleteEmail(userId, payload) {
269
+ deleteEmail(userId, payload) {
270
270
  const url = this.resolveURL(`${UserEndpoints.Email}/${userId}`);
271
271
  return this.DELETE(url, payload);
272
272
  }
273
- async deletePhone(userId, payload) {
273
+ deletePhone(userId, payload) {
274
274
  const url = this.resolveURL(`${UserEndpoints.Phone}/${userId}`);
275
275
  return this.DELETE(url, payload);
276
276
  }
277
- async deleteExternalAuth(userId) {
277
+ deleteExternalAuth(userId) {
278
278
  const url = this.resolveURL(`${UserEndpoints.ExternalAuth}/${userId}`);
279
279
  return this.DELETE(url);
280
280
  }
@@ -1,17 +1,19 @@
1
- import { BaseResult, Result } from "../../types";
1
+ import { BaseResult, ErrorHandler } from "../../types";
2
2
  declare class ResponseHelper {
3
- static GetResponse: <T extends BaseResult>(data: T) => {
3
+ errorHandler: ErrorHandler;
4
+ constructor(errorHandler: ErrorHandler);
5
+ GetResponse: <T extends BaseResult>(data: T) => {
4
6
  data: T;
5
7
  success: boolean;
6
8
  message: string;
7
9
  error: any;
8
10
  };
9
- static GetErrorResponse: <T extends BaseResult>(data: T, functionName: string) => {
11
+ GetErrorResponse: <T extends BaseResult>(data: T, functionName: string) => {
10
12
  data: T;
11
13
  success: boolean;
12
14
  message: string;
13
15
  error: string;
14
16
  };
15
- static IsApproved: (result: Result) => boolean;
17
+ private IsApproved;
16
18
  }
17
19
  export { ResponseHelper };
@@ -1,6 +1,10 @@
1
1
  import { SystemResponses } from "../../constants";
2
2
  class ResponseHelper {
3
- static GetResponse = (data) => {
3
+ errorHandler;
4
+ constructor(errorHandler) {
5
+ this.errorHandler = errorHandler;
6
+ }
7
+ GetResponse = (data) => {
4
8
  return {
5
9
  data: data,
6
10
  success: this.IsApproved(data.result),
@@ -8,8 +12,8 @@ class ResponseHelper {
8
12
  error: null,
9
13
  };
10
14
  };
11
- static GetErrorResponse = (data, functionName) => {
12
- // should log to sentry
15
+ GetErrorResponse = (data, functionName) => {
16
+ this.errorHandler(`${data.result.message}, ${functionName}`);
13
17
  return {
14
18
  data: data,
15
19
  success: false,
@@ -17,7 +21,7 @@ class ResponseHelper {
17
21
  error: data.result.message,
18
22
  };
19
23
  };
20
- static IsApproved = (result) => {
24
+ IsApproved = (result) => {
21
25
  const { code } = result;
22
26
  if (code == SystemResponses.Approved ||
23
27
  code == SystemResponses.Create_User_Completed_Partially) {
@@ -1,11 +1,12 @@
1
- import { CredentialsCookies, USR } from "../../types";
1
+ import { ChangeEventParameters, CredentialsCookies, USR } from "../../types";
2
2
  declare class CookiesHelper {
3
3
  private key;
4
4
  private eventHandlers;
5
5
  private domain;
6
6
  private programId;
7
7
  private Cookies;
8
- constructor(programId: string);
8
+ private errorHandler;
9
+ constructor(programId: string, errorHandler: (error: any) => void);
9
10
  GetIID(): Promise<string>;
10
11
  SetIID(): Promise<string>;
11
12
  ValidateIID(installationId: string): Promise<boolean>;
@@ -33,12 +34,4 @@ declare class CookiesHelper {
33
34
  IsAuthenticated(): Promise<boolean>;
34
35
  GetCredentialsCookies(): Promise<CredentialsCookies>;
35
36
  }
36
- type ChangeEventParameters = {
37
- IID: EventCallback;
38
- USR: EventCallback;
39
- DEK: EventCallback;
40
- accessToken: EventCallback;
41
- jwtToken: EventCallback;
42
- };
43
- type EventCallback = (eventType: "change" | "delete") => void;
44
37
  export { CookiesHelper };
@@ -7,13 +7,15 @@ class CookiesHelper {
7
7
  domain = "";
8
8
  programId = "0";
9
9
  Cookies = window.cookieStore;
10
+ errorHandler;
10
11
  // #endregion
11
12
  // #region "Constructor"
12
- constructor(programId) {
13
- this.domain = window.location.hostname;
13
+ constructor(programId, errorHandler) {
14
+ this.key = v4();
14
15
  this.programId = programId;
16
+ this.errorHandler = errorHandler;
15
17
  this.Cookies = window.cookieStore;
16
- this.key = v4();
18
+ this.domain = window.location.hostname;
17
19
  }
18
20
  // #endregion
19
21
  // #region "IID"
@@ -28,7 +30,7 @@ class CookiesHelper {
28
30
  return IID;
29
31
  }
30
32
  catch (error) {
31
- console.error(error);
33
+ this.errorHandler(error);
32
34
  return "";
33
35
  }
34
36
  }
@@ -41,7 +43,7 @@ class CookiesHelper {
41
43
  return IID;
42
44
  }
43
45
  catch (error) {
44
- console.error(error);
46
+ this.errorHandler(error);
45
47
  return "";
46
48
  }
47
49
  }
@@ -52,7 +54,7 @@ class CookiesHelper {
52
54
  return !!IID;
53
55
  }
54
56
  catch (error) {
55
- console.error(error);
57
+ this.errorHandler(error);
56
58
  return false;
57
59
  }
58
60
  }
@@ -72,7 +74,7 @@ class CookiesHelper {
72
74
  return encryptionKey;
73
75
  }
74
76
  catch (error) {
75
- console.error(error);
77
+ this.errorHandler(error);
76
78
  }
77
79
  }
78
80
  async SetDEK(deviceEncryptionKey, USR) {
@@ -90,7 +92,7 @@ class CookiesHelper {
90
92
  }
91
93
  }
92
94
  catch (error) {
93
- console.error(error);
95
+ this.errorHandler(error);
94
96
  }
95
97
  }
96
98
  async ValidateDEK(DEK) {
@@ -104,7 +106,7 @@ class CookiesHelper {
104
106
  return !!decryptedDEK;
105
107
  }
106
108
  catch (error) {
107
- console.error(error);
109
+ this.errorHandler(error);
108
110
  return false;
109
111
  }
110
112
  }
@@ -121,7 +123,7 @@ class CookiesHelper {
121
123
  return JSON.parse(decryptedUSR);
122
124
  }
123
125
  catch (error) {
124
- console.error(error);
126
+ this.errorHandler(error);
125
127
  return null;
126
128
  }
127
129
  }
@@ -139,7 +141,7 @@ class CookiesHelper {
139
141
  await this.SET("USR", encryptedUSR);
140
142
  }
141
143
  catch (error) {
142
- console.error(error);
144
+ this.errorHandler(error);
143
145
  }
144
146
  }
145
147
  async ValidateUSR(USR) {
@@ -152,7 +154,7 @@ class CookiesHelper {
152
154
  return !!decryptedUSR;
153
155
  }
154
156
  catch (error) {
155
- console.error(error);
157
+ this.errorHandler(error);
156
158
  return null;
157
159
  }
158
160
  }
@@ -173,7 +175,7 @@ class CookiesHelper {
173
175
  return device_security_code;
174
176
  }
175
177
  catch (error) {
176
- console.error(error);
178
+ this.errorHandler(error);
177
179
  return "";
178
180
  }
179
181
  }
@@ -190,7 +192,7 @@ class CookiesHelper {
190
192
  return access_token;
191
193
  }
192
194
  catch (error) {
193
- console.error(error);
195
+ this.errorHandler(error);
194
196
  }
195
197
  }
196
198
  async SetAccessToken(accessToken, expires) {
@@ -203,7 +205,7 @@ class CookiesHelper {
203
205
  await this.SET("access_token", encryptedAccessToken, expires);
204
206
  }
205
207
  catch (error) {
206
- console.error(error);
208
+ this.errorHandler(error);
207
209
  }
208
210
  }
209
211
  async ValidateAccessToken(accessToken) {
@@ -216,7 +218,7 @@ class CookiesHelper {
216
218
  return !!access_token;
217
219
  }
218
220
  catch (error) {
219
- console.error(error);
221
+ this.errorHandler(error);
220
222
  return false;
221
223
  }
222
224
  }
@@ -233,7 +235,7 @@ class CookiesHelper {
233
235
  return jwt_token;
234
236
  }
235
237
  catch (error) {
236
- console.error(error);
238
+ this.errorHandler(error);
237
239
  }
238
240
  }
239
241
  async SetJWTToken(jwtToken) {
@@ -246,7 +248,7 @@ class CookiesHelper {
246
248
  this.SET("jwt_token", encryptedJWTToken);
247
249
  }
248
250
  catch (error) {
249
- console.error(error);
251
+ this.errorHandler(error);
250
252
  }
251
253
  }
252
254
  async ValidateJWTToken(jwtToken) {
@@ -259,7 +261,7 @@ class CookiesHelper {
259
261
  return !!jwt_token;
260
262
  }
261
263
  catch (error) {
262
- console.error(error);
264
+ this.errorHandler(error);
263
265
  return false;
264
266
  }
265
267
  }
@@ -374,10 +376,12 @@ class CookiesHelper {
374
376
  return !!IID && !!USR && !!DEK && !!accessToken && !!jwtToken;
375
377
  }
376
378
  catch (error) {
377
- console.error(error);
379
+ this.errorHandler(error);
378
380
  return false;
379
381
  }
380
382
  }
383
+ // #endregion
384
+ // #region "Utils"
381
385
  async GetCredentialsCookies() {
382
386
  try {
383
387
  const IID = await this.GetIID();
@@ -395,7 +399,7 @@ class CookiesHelper {
395
399
  return credentials;
396
400
  }
397
401
  catch (error) {
398
- console.error(error);
402
+ this.errorHandler(error);
399
403
  return {
400
404
  IID: "",
401
405
  USR: { user_id: "0", device_id: "0" },
@@ -2,12 +2,12 @@ import { UserData } from "../../types";
2
2
  import { CookiesHelper } from "./cookiesHelper";
3
3
  declare class LocalStorageHelper {
4
4
  cookiesHelper: CookiesHelper;
5
- constructor(programId: string);
5
+ private errorHandler;
6
+ constructor(cookiesHelper: CookiesHelper, errorHandler: (error: any) => void);
6
7
  GetUserData(): Promise<UserData>;
7
- SetUserData(userData: UserData): Promise<void>;
8
+ SetUserData(userData: UserData): Promise<any>;
8
9
  GET(key: string): string;
9
- SET(key: string, value: string): void;
10
- REMOVE(key: string): void;
11
- CLEAR(): void;
10
+ SET(key: string, value: string): any;
11
+ REMOVE(key: string): any;
12
12
  }
13
13
  export { LocalStorageHelper };