@coraltravelcenter/b2c-landing-builder 2.14.0 → 2.14.2
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/README.md +2 -2
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/src/deploy/page.mjs +7 -3
- package/src/lib/rewriteImageAssets.mjs +2 -2
package/README.md
CHANGED
|
@@ -250,8 +250,8 @@ build; дополнительные контейнеры builder не созда
|
|
|
250
250
|
В dev пути направляются на фактический origin текущего Vite-сервера. При
|
|
251
251
|
production build они
|
|
252
252
|
преобразуются в `<assetsBase>/landing-pages/<folder>/...`. Builder
|
|
253
|
-
переписывает
|
|
254
|
-
`
|
|
253
|
+
переписывает изображения `jpg`, `jpeg`, `png`, `webp`, `avif`, `gif`, `svg` и
|
|
254
|
+
видео `mov`, `webm`, `mp4`; остальные root-relative ресурсы не изменяются.
|
|
255
255
|
|
|
256
256
|
### Deploy assets
|
|
257
257
|
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coraltravelcenter/b2c-landing-builder",
|
|
3
|
-
"version": "2.14.
|
|
3
|
+
"version": "2.14.2",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@coraltravelcenter/b2c-landing-builder",
|
|
9
|
-
"version": "2.14.
|
|
9
|
+
"version": "2.14.2",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@babel/parser": "7.28.6",
|
package/package.json
CHANGED
package/src/deploy/page.mjs
CHANGED
|
@@ -57,6 +57,10 @@ function contentId(content) {
|
|
|
57
57
|
return content.pageContentId || content.contentId || content._id;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
function pageIdFromContentId(pageContentId) {
|
|
61
|
+
return String(pageContentId).match(/^(Pages_\d+)_PageContents_\d+_V_\d+$/)?.[1];
|
|
62
|
+
}
|
|
63
|
+
|
|
60
64
|
function isPublishedVersion(content) {
|
|
61
65
|
return Number(content.statusId ?? content.status) === STATUS.published ||
|
|
62
66
|
String(content.statusName || "").toLowerCase() === "published";
|
|
@@ -216,13 +220,13 @@ export async function createPagePlacement(options) {
|
|
|
216
220
|
});
|
|
217
221
|
if (!created?.pageContentId) throw new Error("Backoffice did not return pageContentId for the new page");
|
|
218
222
|
const pageContent = await client.getContent(created.pageContentId);
|
|
219
|
-
const
|
|
220
|
-
if (!
|
|
223
|
+
const resolvedPageId = created.pageId || pageContent.pageId || pageIdFromContentId(created.pageContentId);
|
|
224
|
+
if (!resolvedPageId) throw new Error("Backoffice did not return pageId for the new page");
|
|
221
225
|
return {
|
|
222
226
|
pageContent,
|
|
223
227
|
placement: {...selected.placement, pageContentId: created.pageContentId},
|
|
224
228
|
binding: {
|
|
225
|
-
pageId,
|
|
229
|
+
pageId: resolvedPageId,
|
|
226
230
|
applicationId: selected.draft.applicationId,
|
|
227
231
|
layoutAreaId: selected.placement.layoutAreaId,
|
|
228
232
|
orderIndex: selected.placement.orderIndex,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const IMAGE_EXTENSION_RE = /\.(?:avif|gif|jpe?g|png|svg|webp)(?:[?#][^\s]*)?$/i;
|
|
1
|
+
const IMAGE_EXTENSION_RE = /\.(?:avif|gif|jpe?g|mov|mp4|png|svg|webm|webp)(?:[?#][^\s]*)?$/i;
|
|
2
2
|
|
|
3
3
|
function normalizeBase(value) {
|
|
4
4
|
return String(value || "").trim().replace(/\/+$/, "");
|
|
@@ -55,7 +55,7 @@ export function rewriteJsImageUrls(jsText, options) {
|
|
|
55
55
|
if (!jsText || typeof jsText !== "string") return jsText;
|
|
56
56
|
|
|
57
57
|
return jsText.replace(
|
|
58
|
-
/(['"`])(\/(?!\/)[^'"`\s]+\.(?:avif|gif|jpe?g|png|svg|webp)(?:[?#][^'"`\s]*)?)\1/gi,
|
|
58
|
+
/(['"`])(\/(?!\/)[^'"`\s]+\.(?:avif|gif|jpe?g|mov|mp4|png|svg|webm|webp)(?:[?#][^'"`\s]*)?)\1/gi,
|
|
59
59
|
(match, quote, url) => {
|
|
60
60
|
const nextUrl = rewriteImageAssetUrl(url, options);
|
|
61
61
|
return nextUrl === url ? match : `${quote}${nextUrl}${quote}`;
|