@coraltravelcenter/b2c-landing-builder 2.14.1 → 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/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/src/deploy/page.mjs +7 -3
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,
|