@uxf/core 11.68.2 → 11.70.0
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.
- package/cookie/index.d.ts +4 -1
- package/cookie/index.js +10 -0
- package/package.json +1 -1
package/cookie/index.d.ts
CHANGED
package/cookie/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Cookie = void 0;
|
|
4
4
|
const is_not_empty_1 = require("../utils/is-not-empty");
|
|
5
|
+
const is_not_nil_1 = require("../utils/is-not-nil");
|
|
5
6
|
class Cookie {
|
|
6
7
|
constructor(ctx = null) {
|
|
7
8
|
this.ctx = ctx;
|
|
@@ -16,6 +17,15 @@ class Cookie {
|
|
|
16
17
|
const date = new Date();
|
|
17
18
|
date.setTime(date.getTime() + ttl * 1000);
|
|
18
19
|
const cookieParts = [`${name}=${encodeURIComponent(value)}`, `expires=${date.toUTCString()}`];
|
|
20
|
+
if ((0, is_not_nil_1.isNotNil)(options.domain) && (0, is_not_empty_1.isNotEmpty)(options.domain)) {
|
|
21
|
+
cookieParts.push(`domain=${options.domain}`);
|
|
22
|
+
}
|
|
23
|
+
if ((0, is_not_nil_1.isNotNil)(options.domain)) {
|
|
24
|
+
cookieParts.push(`samesite=${options.sameSite}`);
|
|
25
|
+
}
|
|
26
|
+
if (options.partitioned) {
|
|
27
|
+
cookieParts.push("partitioned");
|
|
28
|
+
}
|
|
19
29
|
if (options.httpOnly) {
|
|
20
30
|
cookieParts.push("httponly");
|
|
21
31
|
}
|