@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.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@coraltravelcenter/b2c-landing-builder",
3
- "version": "2.14.1",
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.1",
9
+ "version": "2.14.2",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@babel/parser": "7.28.6",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coraltravelcenter/b2c-landing-builder",
3
- "version": "2.14.1",
3
+ "version": "2.14.2",
4
4
  "description": "CLI and build toolkit for B2C landing projects",
5
5
  "type": "module",
6
6
  "bin": {
@@ -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 pageId = created.pageId || pageContent.pageId;
220
- if (!pageId) throw new Error("Backoffice did not return pageId for the new page");
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,