@uxf/core 11.67.0 → 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/utils/resizer.js +5 -4
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
|
}
|
package/package.json
CHANGED
package/utils/resizer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a;
|
|
2
|
+
var _a, _b;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.resizerImageUrl = exports.positionMapper = exports.fitMapper = void 0;
|
|
5
5
|
exports.resizerGetDefaultConfig = resizerGetDefaultConfig;
|
|
@@ -30,7 +30,8 @@ const backgroundMapper = {
|
|
|
30
30
|
const trimMapper = {
|
|
31
31
|
"not-trim": "nt",
|
|
32
32
|
};
|
|
33
|
-
const
|
|
33
|
+
const CDN_URL = (_a = process.env.NEXT_PUBLIC_CDN_URL) !== null && _a !== void 0 ? _a : "";
|
|
34
|
+
const BASE_PATH = (_b = process.env.NEXT_PUBLIC_BASE_PATH) !== null && _b !== void 0 ? _b : "";
|
|
34
35
|
const resizerStaticImageUrl = (src, width = "auto", height = "auto", props = {}, version = 1) => {
|
|
35
36
|
var _a;
|
|
36
37
|
const { fit = "cover", position = "center", toFormat = undefined, trim = "not-trim", background = "FFF" } = props;
|
|
@@ -47,7 +48,7 @@ const resizerStaticImageUrl = (src, width = "auto", height = "auto", props = {},
|
|
|
47
48
|
trim === "not-trim" ? trimMapper[trim] : trim,
|
|
48
49
|
(_a = props.quality) !== null && _a !== void 0 ? _a : "x",
|
|
49
50
|
].join("_");
|
|
50
|
-
return `${BASE_PATH}/generated/static/${directory}/${version}${filename}.${extension}.${toFormat !== null && toFormat !== void 0 ? toFormat : extension}`;
|
|
51
|
+
return `${CDN_URL}${BASE_PATH}/generated/static/${directory}/${version}${filename}.${extension}.${toFormat !== null && toFormat !== void 0 ? toFormat : extension}`;
|
|
51
52
|
};
|
|
52
53
|
const resizerImageUrl = (source, width = "auto", height = "auto", props = {}, version = 1) => {
|
|
53
54
|
var _a, _b;
|
|
@@ -69,7 +70,7 @@ const resizerImageUrl = (source, width = "auto", height = "auto", props = {}, ve
|
|
|
69
70
|
(_b = props.quality) !== null && _b !== void 0 ? _b : "x",
|
|
70
71
|
`${source.extension}.${toFormat}`,
|
|
71
72
|
].join("_");
|
|
72
|
-
return `${BASE_PATH}/generated/${source.namespace}/${source.uuid.charAt(0)}/${source.uuid.charAt(1)}/${filename}`;
|
|
73
|
+
return `${CDN_URL}${BASE_PATH}/generated/${source.namespace}/${source.uuid.charAt(0)}/${source.uuid.charAt(1)}/${filename}`;
|
|
73
74
|
};
|
|
74
75
|
exports.resizerImageUrl = resizerImageUrl;
|
|
75
76
|
function resizerGetDefaultConfig(generatedFilesUrl, staticFilesUrl) {
|