ggez-banking-sdk 0.2.12 → 0.2.14
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.
|
@@ -7,13 +7,7 @@ declare class CookiesHelper {
|
|
|
7
7
|
private Cookies;
|
|
8
8
|
private useCookieStore;
|
|
9
9
|
private errorHandler;
|
|
10
|
-
private clientHelper;
|
|
11
10
|
constructor(programId: string, domain: string, errorHandler: (error: any) => void);
|
|
12
|
-
/**
|
|
13
|
-
* Format domain to ensure proper cookie setting
|
|
14
|
-
* Adds leading dot if domain doesn't start with one and is not localhost
|
|
15
|
-
*/
|
|
16
|
-
private formatDomain;
|
|
17
11
|
/**
|
|
18
12
|
* Check if CookieStore API is available
|
|
19
13
|
* CookieStore requires secure context (HTTPS or localhost)
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { v4 } from "uuid";
|
|
2
2
|
import { CipherHelper } from "../cipherHelper";
|
|
3
|
-
import { ClientHelper } from "../..";
|
|
4
3
|
class CookiesHelper {
|
|
5
4
|
// #region "Properties"
|
|
6
5
|
key;
|
|
@@ -10,39 +9,20 @@ class CookiesHelper {
|
|
|
10
9
|
Cookies = null;
|
|
11
10
|
useCookieStore = false;
|
|
12
11
|
errorHandler;
|
|
13
|
-
clientHelper;
|
|
14
12
|
// #endregion
|
|
15
13
|
// #region "Constructor"
|
|
16
14
|
constructor(programId, domain, errorHandler) {
|
|
17
15
|
this.key = v4();
|
|
18
16
|
this.programId = programId;
|
|
19
17
|
this.errorHandler = errorHandler;
|
|
20
|
-
this.clientHelper = new ClientHelper();
|
|
21
18
|
// Format domain properly (add leading dot for subdomain sharing if not present)
|
|
22
|
-
this.domain =
|
|
19
|
+
this.domain = domain;
|
|
23
20
|
// Check if cookieStore API is available (requires HTTPS or localhost)
|
|
24
21
|
this.useCookieStore = this.isCookieStoreAvailable();
|
|
25
22
|
if (this.useCookieStore && window.cookieStore) {
|
|
26
23
|
this.Cookies = window.cookieStore;
|
|
27
24
|
}
|
|
28
25
|
}
|
|
29
|
-
/**
|
|
30
|
-
* Format domain to ensure proper cookie setting
|
|
31
|
-
* Adds leading dot if domain doesn't start with one and is not localhost
|
|
32
|
-
*/
|
|
33
|
-
formatDomain(domain) {
|
|
34
|
-
if (!domain)
|
|
35
|
-
return undefined;
|
|
36
|
-
// Don't modify localhost or IP addresses
|
|
37
|
-
if (domain === "localhost" || /^\d+\.\d+\.\d+\.\d+/.test(domain)) {
|
|
38
|
-
return domain;
|
|
39
|
-
}
|
|
40
|
-
// If domain doesn't start with dot, add it for subdomain sharing
|
|
41
|
-
if (!domain.startsWith(".")) {
|
|
42
|
-
return `.${domain}`;
|
|
43
|
-
}
|
|
44
|
-
return domain;
|
|
45
|
-
}
|
|
46
26
|
/**
|
|
47
27
|
* Check if CookieStore API is available
|
|
48
28
|
* CookieStore requires secure context (HTTPS or localhost)
|
|
@@ -59,9 +39,7 @@ class CookiesHelper {
|
|
|
59
39
|
isSecureContext() {
|
|
60
40
|
if (typeof window === "undefined")
|
|
61
41
|
return false;
|
|
62
|
-
return
|
|
63
|
-
window.location.hostname === "localhost" ||
|
|
64
|
-
window.location.hostname === "127.0.0.1");
|
|
42
|
+
return window.location.protocol === "https:";
|
|
65
43
|
}
|
|
66
44
|
/**
|
|
67
45
|
* Fallback method to set cookie using document.cookie
|
|
@@ -390,7 +368,7 @@ class CookiesHelper {
|
|
|
390
368
|
domain: this.domain,
|
|
391
369
|
expires: expireTime,
|
|
392
370
|
path: "/",
|
|
393
|
-
sameSite: "
|
|
371
|
+
sameSite: "none",
|
|
394
372
|
secure: isSecure,
|
|
395
373
|
});
|
|
396
374
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ggez-banking-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.14",
|
|
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",
|