ggez-banking-sdk 0.1.159 → 0.1.161

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.
@@ -23,10 +23,10 @@ declare class CookiesHelper {
23
23
  GET(key: string): string | undefined;
24
24
  SET(key: string, value: string, expires?: Date): void;
25
25
  REMOVE(key: string): void;
26
- cookieEventHandler(e: CookieChangeEvent, callback: () => void): void;
27
- onChangeHandler(changed: CookieInit[], callback: () => void): void;
28
- onDeleteHandler(deleted: CookieInit[], callback: () => void): void;
29
- addOnChangeEventListener(callback: () => void): void;
30
- removeOnChangeEventListener(callback: () => void): void;
26
+ cookieEventHandler(e: CookieChangeEvent, callback: () => Promise<void>): void;
27
+ onChangeHandler(changed: CookieInit[], callback: () => Promise<void>): Promise<void>;
28
+ onDeleteHandler(deleted: CookieInit[], callback: () => Promise<void>): Promise<void>;
29
+ addOnChangeEventListener(callback: () => Promise<void>): void;
30
+ removeOnChangeEventListener(callback: () => Promise<void>): void;
31
31
  }
32
32
  export { CookiesHelper };
@@ -8,8 +8,8 @@ class CookiesHelper {
8
8
  // #endregion
9
9
  // #region "Constructor"
10
10
  constructor(programId, domain) {
11
- this.programId = programId;
12
11
  this.domain = domain;
12
+ this.programId = programId;
13
13
  }
14
14
  // #endregion
15
15
  // #region "IID"
@@ -278,7 +278,7 @@ class CookiesHelper {
278
278
  this.onDeleteHandler(e.deleted, callback);
279
279
  }
280
280
  }
281
- onChangeHandler(changed, callback) {
281
+ async onChangeHandler(changed, callback) {
282
282
  const changedCookie = changed[0];
283
283
  switch (changedCookie.name) {
284
284
  case "IID":
@@ -318,10 +318,13 @@ class CookiesHelper {
318
318
  break;
319
319
  }
320
320
  }
321
- onDeleteHandler(deleted, callback) {
321
+ async onDeleteHandler(deleted, callback) {
322
322
  const deletedCookie = deleted[0];
323
323
  if (["DEK", "USR", "IID", "access_token", "jwt_token"].includes(deletedCookie.name)) {
324
- callback();
324
+ await callback();
325
+ }
326
+ if (deletedCookie.name == "IID") {
327
+ this.SetIID();
325
328
  }
326
329
  }
327
330
  addOnChangeEventListener(callback) {
@@ -14,7 +14,7 @@ class LocalStorageHelper {
14
14
  try {
15
15
  const IID = this.cookiesHelper.GetIID();
16
16
  const { key, iv } = CipherHelper.GenerateByInstallationID(IID);
17
- const userData = localStorage.getItem("CUD");
17
+ const userData = this.GET("CUD");
18
18
  const decryptedUserData = CipherHelper.Decrypt(userData, key, iv);
19
19
  if (decryptedUserData) {
20
20
  return JSON.parse(decryptedUserData);
@@ -31,7 +31,9 @@ class LocalStorageHelper {
31
31
  const { key, iv } = CipherHelper.GenerateByInstallationID(IID);
32
32
  const data = JSON.stringify(userData);
33
33
  const encryptedUserData = CipherHelper.Encrypt(data, key, iv);
34
- this.SET("CUD", encryptedUserData);
34
+ if (encryptedUserData) {
35
+ this.SET("CUD", encryptedUserData);
36
+ }
35
37
  }
36
38
  catch (error) {
37
39
  console.error(error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ggez-banking-sdk",
3
- "version": "0.1.159",
3
+ "version": "0.1.161",
4
4
  "description": "A Node.js package to handle GGEZ Banking API endpoints, Simplify the process of managing CRUD operations with this efficient and easy-to-use package.",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",