@contentstack/studio-client 1.6.0 → 1.7.1

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.
Files changed (86) hide show
  1. package/dist/breakpoints/BreakpointManager.js +18 -5
  2. package/dist/breakpoints/BreakpointManager.js.map +1 -1
  3. package/dist/canvas/canvas.utils.js +1 -1
  4. package/dist/canvas/canvas.utils.js.map +1 -1
  5. package/dist/composable-studio/build-scoped-data.js +170 -0
  6. package/dist/composable-studio/build-scoped-data.js.map +1 -0
  7. package/dist/composable-studio/collect-data-needs.js +344 -0
  8. package/dist/composable-studio/collect-data-needs.js.map +1 -0
  9. package/dist/composable-studio/composition-metadata.js +75 -0
  10. package/dist/composable-studio/composition-metadata.js.map +1 -0
  11. package/dist/composable-studio/composition-placement.types.js +7 -0
  12. package/dist/composable-studio/composition-placement.types.js.map +1 -0
  13. package/dist/composable-studio/sdk.js +2169 -192
  14. package/dist/composable-studio/sdk.js.map +1 -1
  15. package/dist/composable-studio/studio-intelligence.manager.js +2 -12
  16. package/dist/composable-studio/studio-intelligence.manager.js.map +1 -1
  17. package/dist/config/default-config.js +1 -0
  18. package/dist/config/default-config.js.map +1 -1
  19. package/dist/config/stack-sdk-wrapper.js +86 -0
  20. package/dist/config/stack-sdk-wrapper.js.map +1 -1
  21. package/dist/context-menu/context-menu.js +1 -0
  22. package/dist/context-menu/context-menu.js.map +1 -1
  23. package/dist/dnd/dnd-manager.js +1 -0
  24. package/dist/dnd/dnd-manager.js.map +1 -1
  25. package/dist/highlight-node/highlight-node-manager.js +1 -0
  26. package/dist/highlight-node/highlight-node-manager.js.map +1 -1
  27. package/dist/highlight-node/highlight-node.js +5 -1
  28. package/dist/highlight-node/highlight-node.js.map +1 -1
  29. package/dist/index.d.ts +1033 -294
  30. package/dist/index.js +13 -2
  31. package/dist/index.js.map +1 -1
  32. package/dist/json-rte-registry/embedded-entry-conversion.js +186 -0
  33. package/dist/json-rte-registry/embedded-entry-conversion.js.map +1 -0
  34. package/dist/json-rte-registry/index.js +73 -33
  35. package/dist/json-rte-registry/index.js.map +1 -1
  36. package/dist/json-rte-registry/stack-sdk-store.js +10 -0
  37. package/dist/json-rte-registry/stack-sdk-store.js.map +1 -0
  38. package/dist/query/query-executor.js +182 -27
  39. package/dist/query/query-executor.js.map +1 -1
  40. package/dist/studio-internal/dist/utils/section-slot-walker.js +63 -0
  41. package/dist/studio-internal/dist/utils/section-slot-walker.js.map +1 -0
  42. package/dist/{packages/studio-internal → studio-internal}/dist/utils/spec-compression.js +1 -1
  43. package/dist/studio-internal/dist/utils/spec-compression.js.map +1 -0
  44. package/dist/url-metadata/build-template-query.js +124 -0
  45. package/dist/url-metadata/build-template-query.js.map +1 -0
  46. package/dist/url-metadata/parse-url-metadata.js +75 -0
  47. package/dist/url-metadata/parse-url-metadata.js.map +1 -0
  48. package/dist/url-metadata/rank-url-matches.js +100 -0
  49. package/dist/url-metadata/rank-url-matches.js.map +1 -0
  50. package/dist/url-metadata/select-url-winner.js +45 -0
  51. package/dist/url-metadata/select-url-winner.js.map +1 -0
  52. package/dist/url-metadata/shouldUseUrlMetadataPath.js +22 -0
  53. package/dist/url-metadata/shouldUseUrlMetadataPath.js.map +1 -0
  54. package/dist/url-metadata/types.js +50 -0
  55. package/dist/url-metadata/types.js.map +1 -0
  56. package/dist/url-metadata/url-pattern-matcher.js +311 -0
  57. package/dist/url-metadata/url-pattern-matcher.js.map +1 -0
  58. package/dist/utils/build-composition-fetch-query.js +19 -0
  59. package/dist/utils/build-composition-fetch-query.js.map +1 -0
  60. package/dist/utils/canvas.js +14 -0
  61. package/dist/utils/canvas.js.map +1 -1
  62. package/dist/utils/constants.js +19 -2
  63. package/dist/utils/constants.js.map +1 -1
  64. package/dist/utils/convertCompositionQueryInputToCompositionQuery.js +11 -1
  65. package/dist/utils/convertCompositionQueryInputToCompositionQuery.js.map +1 -1
  66. package/dist/utils/editor-mode.js +142 -0
  67. package/dist/utils/editor-mode.js.map +1 -0
  68. package/dist/utils/editor-utils.js +9 -0
  69. package/dist/utils/editor-utils.js.map +1 -1
  70. package/dist/utils/is-composition-being-edited.js.map +1 -1
  71. package/dist/utils/query-param.js +1 -1
  72. package/dist/utils/query-param.js.map +1 -1
  73. package/dist/utils/reference_fetcher.js +61 -6
  74. package/dist/utils/reference_fetcher.js.map +1 -1
  75. package/dist/utils/sdk.js +16 -1
  76. package/dist/utils/sdk.js.map +1 -1
  77. package/dist/utils/spec-analyzer.js +21 -4
  78. package/dist/utils/spec-analyzer.js.map +1 -1
  79. package/package.json +8 -10
  80. package/dist/get-composition-from-slug/get-composition-from-slug.js +0 -59
  81. package/dist/get-composition-from-slug/get-composition-from-slug.js.map +0 -1
  82. package/dist/node_modules/fflate/esm/browser.js +0 -384
  83. package/dist/node_modules/fflate/esm/browser.js.map +0 -1
  84. package/dist/packages/studio-internal/dist/utils/spec-compression.js.map +0 -1
  85. package/dist/utils/get-url-patterns.js +0 -40
  86. package/dist/utils/get-url-patterns.js.map +0 -1
@@ -1,11 +1,11 @@
1
1
  import { composableStudioEventManager, POST_MESSAGE_EVENTS } from '@contentstack/studio-messenger';
2
- import { BreakpointRegistry } from '@contentstack/studio-registry';
2
+ import { BreakpointRegistry, getGlobalStudioStore } from '@contentstack/studio-registry';
3
3
  import { DEFAULT_BREAKPOINTS } from './breakpoint.constant.js';
4
4
  import 'lodash-es';
5
+ import '../utils/editor-mode.js';
5
6
  import { clientRendererModeUtil } from '../utils/canvas.js';
6
7
 
7
8
  class BreakpointManager {
8
- static instance = null;
9
9
  activeBreakpoint = null;
10
10
  breakpointRegistry;
11
11
  constructor() {
@@ -13,11 +13,24 @@ class BreakpointManager {
13
13
  this.activeBreakpoint = this.findMatchingBreakpoint();
14
14
  this.registerBreakpoints(DEFAULT_BREAKPOINTS);
15
15
  }
16
+ /**
17
+ * Returns the singleton `BreakpointManager` instance from the SDK's
18
+ * versioned `globalThis` slot. See
19
+ * `@contentstack/studio-registry/common/global-store.ts` for why singletons
20
+ * live on globalThis instead of a class-static field.
21
+ */
16
22
  static getInstance() {
17
- if (!BreakpointManager.instance) {
18
- BreakpointManager.instance = new BreakpointManager();
23
+ const store = getGlobalStudioStore();
24
+ if (!store.breakpointManager) {
25
+ store.breakpointManager = new BreakpointManager();
19
26
  }
20
- return BreakpointManager.instance;
27
+ return store.breakpointManager;
28
+ }
29
+ /**
30
+ * Resets the singleton. For tests only.
31
+ */
32
+ static resetInstance() {
33
+ getGlobalStudioStore().breakpointManager = null;
21
34
  }
22
35
  setActiveBreakpoint(breakpoint) {
23
36
  this.activeBreakpoint = breakpoint;
@@ -1 +1 @@
1
- {"version":3,"file":"BreakpointManager.js","sources":["../../src/breakpoints/BreakpointManager.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;MAYa,iBAAiB,CAAA;AACpB,IAAA,OAAO,QAAQ,GAA6B,IAAI;IAChD,gBAAgB,GAAsB,IAAI;AAC1C,IAAA,kBAAkB;AAE1B,IAAA,WAAA,GAAA;AACE,QAAA,IAAI,CAAC,kBAAkB,GAAG,IAAI,kBAAkB,EAAE;AAClD,QAAA,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,sBAAsB,EAAE;AACrD,QAAA,IAAI,CAAC,mBAAmB,CAAC,mBAAmB,CAAC;IAC/C;AAEO,IAAA,OAAO,WAAW,GAAA;AACvB,QAAA,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE;AAC/B,YAAA,iBAAiB,CAAC,QAAQ,GAAG,IAAI,iBAAiB,EAAE;QACtD;QACA,OAAO,iBAAiB,CAAC,QAAQ;IACnC;AAEA,IAAA,mBAAmB,CAAC,UAAsB,EAAA;AACxC,QAAA,IAAI,CAAC,gBAAgB,GAAG,UAAU;IACpC;IAEA,mBAAmB,GAAA;QACjB,OAAO,IAAI,CAAC,gBAAgB;IAC9B;IAEA,sBAAsB,GAAA;QACpB,MAAM,WAAW,GAAiB,IAAI,CAAC,kBAAkB,CAAC,cAAc,EAAE;AAC1E,QAAA,IAAI,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;AAC9C,QAAA,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE;AAC5B,YAAA,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC;QAC5C;AAEA,QAAA,IAAI,CAAC,kBAAkB,EAAE,mBAAmB,CAAC,WAAW,CAAC;QACzD,MAAM,mBAAmB,GAAG,IAAI,CAAC,kBAAkB,CAAC,cAAc,EAAE;AACpE,QAAA,IAAI,CAAC,yBAAyB,CAAC,mBAAmB,CAAC;IACrD;IAEA,cAAc,GAAA;AACZ,QAAA,OAAO,IAAI,CAAC,kBAAkB,EAAE,cAAc,EAAE;IAClD;AAEQ,IAAA,yBAAyB,CAAC,WAAyB,EAAA;AACzD,QAAA,IAAI,CAAC,sBAAsB,CAAC,mBAAmB,EAAE;YAAE;QACnD;AACE,cAAE,IAAI,CAAC,mBAAmB,CAAC,oBAAoB,EAAE;AAC/C,YAAA,WAAW,EAAE,WAAW;SACzB;AACA,aAAA,KAAK,CAAC,CAAC,KAAK,KAAI;AACf,YAAA,OAAO,CAAC,KAAK,CAAC,wCAAwC,EAAE,KAAK,CAAC;AAChE,QAAA,CAAC,CAAC;IACN;AACD;;;;"}
@@ -47,7 +47,7 @@ const getHitboxDirection = (event, nodeBoundingBox) => {
47
47
  const toggleNodeVisible = (node, visible) => {
48
48
  if (!(node instanceof HTMLElement))
49
49
  return;
50
- if (visible && node.style.display === "contents") {
50
+ if (visible && window.getComputedStyle(node).display === "contents") {
51
51
  node.setAttribute("data-display", "contents");
52
52
  node.style.display = "block";
53
53
  }
@@ -1 +1 @@
1
- {"version":3,"file":"canvas.utils.js","sources":["../../src/canvas/canvas.utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAOA,MAAM,yBAAyB,GAAG,EAAE;AAE7B,MAAM,sBAAsB,GAAG,CAAC,GAAgB,KAAI;IACzD,IAAI,CAAC,GAAG,EAAE,OAAO;AAAE,QAAA,OAAO,IAAI;AAC9B,IAAA,MAAM,qBAAqB,GAAG,GAAG,CAAC,O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AAG,CAAC,KAAiB,KAAqB;IACnE,OAAO;QACL,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,OAAO,EAAE,KAAK,CAAC,OAAO;KACvB;AACH;;;;"}
@@ -0,0 +1,170 @@
1
+ /**
2
+ * A reference stub is the inline reference object Contentstack returns at a
3
+ * reference field: `{uid, _content_type_uid}` (CDA sometimes inlines the full
4
+ * entry, sometimes only the stub depending on `include[]`). We detect a stub
5
+ * by its shape: object with both keys and a missing/empty payload beyond the
6
+ * `_content_type_uid`/`uid`/locale/system fields.
7
+ */
8
+ function isReferenceStub(v) {
9
+ return (!!v &&
10
+ typeof v === "object" &&
11
+ !Array.isArray(v) &&
12
+ typeof v.uid === "string" &&
13
+ typeof v._content_type_uid === "string");
14
+ }
15
+ /**
16
+ * If `v` is a reference stub and a resolved entry exists in the pool, return
17
+ * the resolved entry; otherwise return `v` unchanged. Logs a dev-only warning
18
+ * when a stub cannot be resolved so authors can spot misconfigured includes.
19
+ */
20
+ function followReference(v, entriesByKey) {
21
+ if (!entriesByKey || !isReferenceStub(v))
22
+ return v;
23
+ // CDA may have already inlined the full entry into the stub object. If we
24
+ // can see fields beyond the meta keys we treat it as resolved already.
25
+ const META_KEYS = new Set([
26
+ "uid",
27
+ "_content_type_uid",
28
+ "_version",
29
+ "locale",
30
+ "ACL",
31
+ "_metadata",
32
+ ]);
33
+ const hasPayload = Object.keys(v).some((k) => !META_KEYS.has(k));
34
+ if (hasPayload)
35
+ return v;
36
+ const key = `${v._content_type_uid}:${v.uid}`;
37
+ const resolved = entriesByKey.get(key);
38
+ if (resolved !== undefined)
39
+ return resolved;
40
+ if (process.env.NODE_ENV === "development") {
41
+ console.warn(`buildScopedDataSources: unresolved reference ${key} encountered during section scoping`);
42
+ }
43
+ return v;
44
+ }
45
+ function getScopedData(obj, selectedField, entriesByKey) {
46
+ if (!selectedField) {
47
+ // Even with no path, if we land on an array of stubs (e.g. a section bound
48
+ // to scope-root where the scope IS a reference list) replace each stub
49
+ // with its resolved entry so downstream iteration sees real entries.
50
+ if (Array.isArray(obj)) {
51
+ return obj.map((item) => followReference(item, entriesByKey));
52
+ }
53
+ return followReference(obj, entriesByKey);
54
+ }
55
+ const traversed = selectedField.split(".").reduce((val, seg) => {
56
+ if (val == null)
57
+ return val;
58
+ // Swap a reference stub for its resolved entry before drilling further.
59
+ val = followReference(val, entriesByKey);
60
+ const arrayMatch = seg.match(/^(.*?)\[(\d+)\]$/);
61
+ if (arrayMatch) {
62
+ const [, name, idxStr] = arrayMatch;
63
+ const next = name ? val[name] : val;
64
+ if (next == null)
65
+ return next;
66
+ const item = next[Number(idxStr)];
67
+ return followReference(item, entriesByKey);
68
+ }
69
+ // Non-indexed field access landing on an ARRAY → default to the first
70
+ // element so an un-indexed array-ancestor path (e.g.
71
+ // "navigation_menu_3.menu_subitems") resolves instead of array[field] →
72
+ // undefined. Indexed pushes (`…[n]…`) override with the picked instance.
73
+ if (Array.isArray(val)) {
74
+ const first = followReference(val[0], entriesByKey);
75
+ return first == null ? null : followReference(first[seg], entriesByKey);
76
+ }
77
+ const next = val[seg];
78
+ return followReference(next, entriesByKey);
79
+ }, obj);
80
+ if (Array.isArray(traversed)) {
81
+ return traversed.map((item) => followReference(item, entriesByKey));
82
+ }
83
+ return traversed ?? null;
84
+ }
85
+ function applyUidRemapping(scoped, uidRemapping = {}) {
86
+ if (!scoped ||
87
+ typeof scoped !== "object" ||
88
+ Object.keys(uidRemapping).length === 0) {
89
+ return scoped;
90
+ }
91
+ if (Array.isArray(scoped)) {
92
+ return scoped.map((item) => applyUidRemapping(item, uidRemapping));
93
+ }
94
+ const remapped = {};
95
+ for (const [sectionKey, pageKey] of Object.entries(uidRemapping)) {
96
+ remapped[sectionKey] = applyUidRemapping(scoped[pageKey], uidRemapping);
97
+ }
98
+ // Include unmapped keys, but don't recurse on pageKey entries (they're already processed above)
99
+ const pageKeyValues = new Set(Object.values(uidRemapping));
100
+ for (const key of Object.keys(scoped)) {
101
+ if (!pageKeyValues.has(key) && !(key in uidRemapping)) {
102
+ remapped[key] = applyUidRemapping(scoped[key], uidRemapping);
103
+ }
104
+ }
105
+ return remapped;
106
+ }
107
+ function buildScopedDataSources(pool, needsBySection, pageDataSources) {
108
+ const out = {};
109
+ for (const [instanceUid, needs] of needsBySection.entries()) {
110
+ // Key scoped contentstack by poolKey (`${ct_uid}:${entry_uid}`) — matches
111
+ // the resolver in studio-registry's contentstack strategy, which builds
112
+ // lookup keys as `${_content_type_uid}:${uid}` from the binding. Keying
113
+ // by bare `dsUid` (entry uid only) here produced a silent miss in the
114
+ // section subtree: bindings resolved to undefined and rendered as the
115
+ // default placeholder text.
116
+ const contentstack = {};
117
+ const dsToKey = pool.sectionEntryDsToPoolKey.get(instanceUid);
118
+ if (dsToKey) {
119
+ for (const [, poolKey] of dsToKey.entries()) {
120
+ const entry = pool.entriesByKey.get(poolKey);
121
+ if (entry === undefined) {
122
+ if (process.env.NODE_ENV === "development") {
123
+ console.warn(`buildScopedDataSources: missing entry for ${poolKey} in instance ${instanceUid}`);
124
+ }
125
+ }
126
+ contentstack[poolKey] = entry;
127
+ }
128
+ }
129
+ const contentstack_queries = {};
130
+ const qDsToKey = pool.sectionQueryDsToPoolKey.get(instanceUid);
131
+ if (qDsToKey) {
132
+ for (const [dsUid, poolKey] of qDsToKey.entries()) {
133
+ const q = pool.queriesByKey.get(poolKey);
134
+ if (q === undefined && process.env.NODE_ENV === "development") {
135
+ console.warn(`buildScopedDataSources: missing query for ${poolKey} in instance ${instanceUid}`);
136
+ }
137
+ contentstack_queries[dsUid] = q;
138
+ }
139
+ }
140
+ const pageTemplate = pageDataSources.template;
141
+ const scopedTemplate = applyUidRemapping(getScopedData(pageTemplate, needs.selectedField, pool.entriesByKey), needs.uidRemapping);
142
+ let repeater;
143
+ if (needs.parentRepeaterUID) {
144
+ const ctx = pageDataSources.repeater?.[needs.parentRepeaterUID];
145
+ if (ctx !== undefined) {
146
+ repeater = { [needs.parentRepeaterUID]: ctx };
147
+ }
148
+ }
149
+ const staticValue = pool.sectionStaticValueByInstance?.get(instanceUid);
150
+ out[instanceUid] = {
151
+ template: scopedTemplate,
152
+ contentstack,
153
+ contentstack_queries,
154
+ ...(staticValue ? { static_value: staticValue } : {}),
155
+ page: pageDataSources,
156
+ repeater,
157
+ // Carry the binding metadata so the provider can re-scope `template` from
158
+ // the LIVE per-iteration repeater item — the baked `template` above is
159
+ // page-root-scoped and shared across all iterations of this instance.
160
+ parentRepeaterUID: needs.parentRepeaterUID ?? null,
161
+ selectedField: needs.selectedField,
162
+ uidRemapping: needs.uidRemapping,
163
+ componentPropsFallback: needs.componentPropsFallback,
164
+ };
165
+ }
166
+ return out;
167
+ }
168
+
169
+ export { buildScopedDataSources };
170
+ //# sourceMappingURL=build-scoped-data.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-scoped-data.js","sources":["../../src/composable-studio/build-scoped-data.ts"],"sourcesContent":[null],"names":[],"mappings":"AAMA;;;;;;AAMG;AACH,SAAS,eAAe,CACtB,CAAM,EAAA;IAEN,QACE,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,KAAK,QAAQ;AACrB,QAAA,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;AACjB,QAAA,OAAO,CAAC,CAAC,GAAG,KAAK,QAAQ;AACzB,QAAA,OAAO,CAAC,CAAC,iBAAiB,KAAK,QAAQ;AAE3C;AAEA;;;;AAIG;AACH,SAAS,eAAe,CACtB,CAAM,EACN,YAA0C,EAAA;AAE1C,IAAA,IAAI,CAAC,YAAY,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC;AAAE,QAAA,OAAO,CAAC;;;AAGlD,IAAA,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC;QACxB,KAAK;QACL,mBAAmB;QACnB,UAAU;QACV,QAAQ;QACR,KAAK;QACL,WAAW;AACZ,KAAA,CAAC;IACF,MAAM,U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G,GAAG,EAAE;YAC/C;QACF;QAEA,MAAM,WAAW,GAAG,IAAI,CAAC,4BAA4B,EAAE,GAAG,CAAC,WAAW,CAAC;QAEvE,GAAG,CAAC,WAAW,CAAC,GAAG;AACjB,YAAA,QAAQ,EAAE,cAAc;YACxB,YAAY;YACZ,oBAAoB;AACpB,YAAA,IAAI,WAAW,GAAG,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC;AACrD,YAAA,IAAI,EAAE,eAAe;YACrB,QAAQ;;;;AAIR,YAAA,iBAAiB,EAAE,KAAK,CAAC,iBAAiB,IAAI,IAAI;YAClD,aAAa,EAAE,KAAK,CAAC,aAAa;YAClC,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,sBAAsB,EAAE,KAAK,CAAC,sBAAsB;SACrD;IACH;AAEA,IAAA,OAAO,GAAG;AACZ;;;;"}
@@ -0,0 +1,344 @@
1
+ import { indexSectionSlotContexts } from '../studio-internal/dist/utils/section-slot-walker.js';
2
+
3
+ const SECTION_COMPOSITION_NODE_TYPE = "section-composition";
4
+ /**
5
+ * For a wrapper section's authored UI, map each `section-slot` uid to the uid
6
+ * of its nearest ancestor Repeater (or null). A section dropped into that slot
7
+ * on the page inherits this INTERNAL repeater as its `parentRepeaterUID` — the
8
+ * page-UI-only walk can't see it because the repeater lives inside the wrapper
9
+ * section's own composition, not the page tree. Mirrors the render-side
10
+ * `indexSectionInternalSlotRepeaters` in studio-react-components so the
11
+ * fetch/scope pipeline and the renderer agree on per-iteration scoping.
12
+ */
13
+ function indexSectionInternalSlotRepeaters(sectionUI) {
14
+ const ctx = indexSectionSlotContexts(sectionUI);
15
+ const out = {};
16
+ for (const [slotUid, slotCtx] of Object.entries(ctx)) {
17
+ const repeaterAncestors = slotCtx.ancestorNodes.filter((n) => n.type === "repeater");
18
+ const nearest = repeaterAncestors.at(-1);
19
+ out[slotUid] = nearest?.uid ?? null;
20
+ }
21
+ return out;
22
+ }
23
+ function entryKey(ctUid, entryUid) {
24
+ return `${ctUid}:${entryUid}`;
25
+ }
26
+ /**
27
+ * Stable, order-independent hash for a query spec. Two query specs that
28
+ * produce the same Contentstack request must yield the same hash.
29
+ */
30
+ function stableHashQuery(querySpec) {
31
+ return stableStringify(querySpec);
32
+ }
33
+ function stableStringify(value) {
34
+ if (value === null || typeof value !== "object") {
35
+ return JSON.stringify(value);
36
+ }
37
+ if (Array.isArray(value)) {
38
+ return `[${value.map(stableStringify).join(",")}]`;
39
+ }
40
+ const keys = Object.keys(value).sort();
41
+ return `{${keys
42
+ .map((k) => `${JSON.stringify(k)}:${stableStringify(value[k])}`)
43
+ .join(",")}}`;
44
+ }
45
+ function parseDataSources(json) {
46
+ if (!json)
47
+ return [];
48
+ try {
49
+ const parsed = JSON.parse(json);
50
+ return Array.isArray(parsed) ? parsed : Object.values(parsed);
51
+ }
52
+ catch (err) {
53
+ if (process.env.NODE_ENV === "development") {
54
+ console.warn("collectAllDataNeeds: failed to parse data_sources JSON", err);
55
+ }
56
+ return [];
57
+ }
58
+ }
59
+ function mergeEntryIntoPool(pool, entry, requester) {
60
+ const ctUid = entry.content_type_uid ?? entry._content_type_uid;
61
+ if (!ctUid || !entry.uid)
62
+ return null;
63
+ const key = entryKey(ctUid, entry.uid);
64
+ const existing = pool.entries.get(key);
65
+ if (existing) {
66
+ const merged = new Set([
67
+ ...existing.includePaths,
68
+ ...(entry.references ?? []),
69
+ ]);
70
+ existing.includePaths = Array.from(merged);
71
+ if (!existing.requestedBy.includes(requester)) {
72
+ existing.requestedBy.push(requester);
73
+ }
74
+ }
75
+ else {
76
+ pool.entries.set(key, {
77
+ contentTypeUid: ctUid,
78
+ entryUid: entry.uid,
79
+ includePaths: [...(entry.references ?? [])],
80
+ requestedBy: [requester],
81
+ });
82
+ }
83
+ return key;
84
+ }
85
+ function mergeQueryIntoPool(pool, item, requester) {
86
+ if (!item.spec || !item.uid)
87
+ return null;
88
+ const key = stableHashQuery(item.spec);
89
+ const existing = pool.queries.get(key);
90
+ if (existing) {
91
+ if (!existing.requestedBy.includes(requester)) {
92
+ existing.requestedBy.push(requester);
93
+ }
94
+ }
95
+ else {
96
+ pool.queries.set(key, { querySpec: item.spec, requestedBy: [requester] });
97
+ }
98
+ return key;
99
+ }
100
+ function extractExternalData(dataSources) {
101
+ const entry = dataSources.find((ds) => ds?.uid === "external_data");
102
+ const data = entry?.data;
103
+ if (!data || typeof data !== "object" || Array.isArray(data))
104
+ return undefined;
105
+ return data;
106
+ }
107
+ /**
108
+ * Parses the page composition's serialized `data_sources` JSON and returns
109
+ * the `external_data` payload (a plain object) — or `undefined` when no
110
+ * external data has been authored. Used by `fetchSpec()` to surface the
111
+ * payload as `spec.data.component_props`.
112
+ */
113
+ function parseExternalDataForComponentProps(dataSourcesJson) {
114
+ if (!dataSourcesJson)
115
+ return undefined;
116
+ let list;
117
+ try {
118
+ const parsed = JSON.parse(dataSourcesJson);
119
+ list = Array.isArray(parsed) ? parsed : Object.values(parsed);
120
+ }
121
+ catch {
122
+ return undefined;
123
+ }
124
+ return extractExternalData(list);
125
+ }
126
+ function collectFromComposition(pool, dataSourcesJson, requester) {
127
+ const dataSources = parseDataSources(dataSourcesJson);
128
+ const entryKeys = [];
129
+ const queryKeys = [];
130
+ for (const ds of dataSources) {
131
+ if (ds.uid === "contentstack") {
132
+ // Support two data_sources formats:
133
+ // 1. New format: { uid: "contentstack", data: { entries: [...] } }
134
+ // 2. Legacy format: { uid: "contentstack", data: [...] } (entries directly as array)
135
+ const rawEntries = Array.isArray(ds.data?.entries)
136
+ ? ds.data.entries
137
+ : Array.isArray(ds.data)
138
+ ? ds.data
139
+ : null;
140
+ if (rawEntries) {
141
+ for (const e of rawEntries) {
142
+ const key = mergeEntryIntoPool(pool, e, requester);
143
+ if (key)
144
+ entryKeys.push(key);
145
+ }
146
+ }
147
+ }
148
+ if (ds.uid === "queries" || ds.uid === "contentstack_queries") {
149
+ const items = Array.isArray(ds.data)
150
+ ? ds.data
151
+ : Array.isArray(ds.data?.queries)
152
+ ? ds.data.queries
153
+ : [];
154
+ for (const q of items) {
155
+ const key = mergeQueryIntoPool(pool, q, requester);
156
+ if (key)
157
+ queryKeys.push(key);
158
+ }
159
+ }
160
+ }
161
+ return {
162
+ entryKeys,
163
+ queryKeys,
164
+ externalData: extractExternalData(dataSources),
165
+ };
166
+ }
167
+ const REPEATER_NODE_TYPES = new Set([
168
+ "REPEATER",
169
+ "repeater",
170
+ "TEMPLATE_REPEATER",
171
+ ]);
172
+ function walkUiForSectionInstances(ui, visit, sectionsByUid, parentRepeaterUID,
173
+ // compositionUIDs already expanded as slot defaults on THIS path (COMS-1659
174
+ // cycle guard). A circular default chain (A→B→A) would otherwise recurse
175
+ // forever here and hang; expanding a default already on the path is cut.
176
+ defaultAncestors = new Set()) {
177
+ if (!ui)
178
+ return;
179
+ const node = ui;
180
+ const nextRepeater = REPEATER_NODE_TYPES.has(node.type) && node.uid
181
+ ? node.uid
182
+ : parentRepeaterUID;
183
+ const isSectionComposition = node.type === SECTION_COMPOSITION_NODE_TYPE &&
184
+ !!node.metadata?.compositionUID;
185
+ if (isSectionComposition && node.uid) {
186
+ // The page-composer's per-instance Linked Field binding is persisted on the
187
+ // slate node as `metadata.sectionBindingOverride` (see Studio's
188
+ // SectionFieldBinding + the render-side seedSectionInstanceBindings). Honour
189
+ // it here so standalone cold loads scope the section against the SAME field
190
+ // the editor/render uses; otherwise we fall through to the legacy
191
+ // `metadata.selectedField` and the linked_schemas default, which can point
192
+ // at a field that doesn't exist on the page CT for cross-CT ref-target binds.
193
+ const override = node.metadata?.sectionBindingOverride;
194
+ visit(node.uid, node.metadata.compositionUID, {
195
+ parentRepeaterUID,
196
+ selectedField: typeof override?.selectedField === "string"
197
+ ? override.selectedField
198
+ : node.metadata.selectedField,
199
+ uidRemapping: override?.uidRemapping ?? node.metadata.uidRemapping,
200
+ });
201
+ }
202
+ // When this node is a wrapper section, sections dropped into its slots
203
+ // inherit the slot's nearest INTERNAL repeater (authored inside the wrapper)
204
+ // as their parentRepeaterUID. Without this, a nested section iterating a
205
+ // wrapper's per-iteration scope is scoped to the page root and renders the
206
+ // same (or no) value for every iteration.
207
+ const slotRepeaterMap = isSectionComposition && sectionsByUid.get(node.metadata.compositionUID)?.ui
208
+ ? indexSectionInternalSlotRepeaters(sectionsByUid.get(node.metadata.compositionUID).ui)
209
+ : null;
210
+ if (node.slots && typeof node.slots === "object") {
211
+ for (const slotId of Object.keys(node.slots)) {
212
+ const slotInternalRepeater = slotRepeaterMap
213
+ ? (slotRepeaterMap[slotId] ?? null)
214
+ : null;
215
+ const childRepeater = slotInternalRepeater ?? nextRepeater;
216
+ const slotNodes = node.slots[slotId];
217
+ const arr = Array.isArray(slotNodes) ? slotNodes : [slotNodes];
218
+ for (const child of arr)
219
+ walkUiForSectionInstances(child, visit, sectionsByUid, childRepeater, defaultAncestors);
220
+ }
221
+ }
222
+ if (Array.isArray(node.children)) {
223
+ for (const child of node.children)
224
+ walkUiForSectionInstances(child, visit, sectionsByUid, nextRepeater, defaultAncestors);
225
+ }
226
+ // Empty slots fall back to their authored default section (COMS-1659). The
227
+ // default isn't a real child in the page UI, so synthesize the same node the
228
+ // renderer makes and walk it — otherwise the default's data needs (e.g. an
229
+ // internal Repeater's array) are never collected and it renders unscoped
230
+ // ("items.map is not a function"). Recurses into the default's own slots.
231
+ if (isSectionComposition) {
232
+ const sectionUi = sectionsByUid.get(node.metadata.compositionUID)?.ui;
233
+ const slotDefaults = sectionUi ? collectSlotDefaultUids(sectionUi) : {};
234
+ const placementSlots = (node.slots || {});
235
+ // This section's compositionUID joins the default-expansion path; a default
236
+ // whose uid is already on the path would close a cycle — skip it.
237
+ const chain = new Set(defaultAncestors).add(node.metadata.compositionUID);
238
+ for (const [slotId, defaultUid] of Object.entries(slotDefaults)) {
239
+ const existing = placementSlots[slotId];
240
+ const filled = Array.isArray(existing)
241
+ ? existing
242
+ : existing
243
+ ? [existing]
244
+ : [];
245
+ if (filled.length > 0)
246
+ continue; // placement filled it → no default
247
+ if (chain.has(defaultUid))
248
+ continue; // circular default chain → cut
249
+ const slotInternalRepeater = slotRepeaterMap
250
+ ? (slotRepeaterMap[slotId] ?? null)
251
+ : null;
252
+ const synth = {
253
+ type: SECTION_COMPOSITION_NODE_TYPE,
254
+ // Key by the enclosing placement instance too, byte-for-byte matching the
255
+ // render-side synth uid (makeDefaultSectionNode / synthesizeDefaultSectionNode:
256
+ // `${instanceUid}-${slotUid}-default-${defaultUid}`). Without the instance
257
+ // prefix the scoped-data key (needsBySection → section_scoped_data) and the
258
+ // render lookup (section_scoped_data[node.uid]) diverge, so a data-bound
259
+ // default section renders with NO scoped data (its template repeater yields
260
+ // zero rows and the section appears blank). COMS-1659 / 4a.
261
+ uid: `${node.uid ? `${node.uid}-` : ""}${slotId}-default-${defaultUid}`,
262
+ metadata: { compositionUID: defaultUid },
263
+ slots: {},
264
+ };
265
+ walkUiForSectionInstances(synth, visit, sectionsByUid, slotInternalRepeater ?? nextRepeater, chain);
266
+ }
267
+ }
268
+ }
269
+ /**
270
+ * Map of `section-slot` uid → its authored `defaultSection` uid for a section's
271
+ * UI (COMS-1659). Local mirror of the sdk.ts helper.
272
+ */
273
+ function collectSlotDefaultUids(ui, out = {}) {
274
+ const node = ui;
275
+ if (!node || typeof node !== "object")
276
+ return out;
277
+ const defaultUid = node.metadata?.defaultSection?.uid;
278
+ if (node.type === "section-slot" &&
279
+ typeof defaultUid === "string" &&
280
+ defaultUid &&
281
+ node.uid) {
282
+ out[node.uid] = defaultUid;
283
+ }
284
+ if (node.slots && typeof node.slots === "object") {
285
+ for (const slotNodes of Object.values(node.slots)) {
286
+ const arr = Array.isArray(slotNodes) ? slotNodes : [slotNodes];
287
+ for (const c of arr)
288
+ collectSlotDefaultUids(c, out);
289
+ }
290
+ }
291
+ if (Array.isArray(node.children)) {
292
+ for (const c of node.children)
293
+ collectSlotDefaultUids(c, out);
294
+ }
295
+ return out;
296
+ }
297
+ /**
298
+ * Walks the page composition + all section compositions, collects every
299
+ * declared entry and query data source, dedupes them into a single pool,
300
+ * and records per-section ownership for later scope assembly.
301
+ */
302
+ function collectAllDataNeeds(pageComposition, pageUiTree, sectionCompositions) {
303
+ const pool = { entries: new Map(), queries: new Map() };
304
+ const needsBySection = new Map();
305
+ const pageNeeds = collectFromComposition(pool, pageComposition.data_sources, "page");
306
+ // Page CT for matching the section's linked_schemas fallback below. The
307
+ // page composition is always placed as a page, so its bound content type
308
+ // lives in `connected_content_type` (see getTemplateContentTypeForComposition
309
+ // in sdk.ts).
310
+ const pageContentTypeUid = pageComposition.connected_content_type ?? "";
311
+ walkUiForSectionInstances(pageUiTree, (instanceUid, compositionUid, ctx) => {
312
+ const section = sectionCompositions.get(compositionUid);
313
+ const baseNeeds = section
314
+ ? collectFromComposition(pool, section.data_sources, instanceUid)
315
+ : { entryKeys: [], queryKeys: [], externalData: undefined };
316
+ // Studio never persists `selectedField` onto the saved page UI node — the
317
+ // binding lives only in transient `data.dataSources.section_compositions`
318
+ // (editor) and is reconciled via `UPDATE_SECTION_CONTEXTS` postmessages.
319
+ // Standalone/runtime cold loads have no such reconciliation, so on cold
320
+ // load fall back to the section composition's declared `selected_field`
321
+ // (matching the page CT). Mirrors `resolveSectionContext` in sdk.ts and
322
+ // the editor's legacy `section_compositions` fallback.
323
+ const linked = section?.linked_schemas || [];
324
+ const declaredField = linked.find((s) => s.content_type_uid === pageContentTypeUid)
325
+ ?.selected_field ?? linked[0]?.selected_field;
326
+ needsBySection.set(instanceUid, {
327
+ entryKeys: baseNeeds.entryKeys,
328
+ queryKeys: baseNeeds.queryKeys,
329
+ parentRepeaterUID: ctx.parentRepeaterUID,
330
+ selectedField: ctx.selectedField ?? declaredField,
331
+ uidRemapping: ctx.uidRemapping,
332
+ componentPropsFallback: baseNeeds.externalData,
333
+ });
334
+ }, sectionCompositions);
335
+ return {
336
+ pool,
337
+ needsBySection,
338
+ pageEntryKeys: pageNeeds.entryKeys,
339
+ pageQueryKeys: pageNeeds.queryKeys,
340
+ };
341
+ }
342
+
343
+ export { collectAllDataNeeds, entryKey, parseExternalDataForComponentProps, stableHashQuery };
344
+ //# sourceMappingURL=collect-data-needs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collect-data-needs.js","sources":["../../src/composable-studio/collect-data-needs.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAUA,MAAM,6BAA6B,GAAG,qBAAqB;AAE3D;;;;;;;;AAQG;AACH,SAAS,iCAAiC,CACxC,SAAc,EAAA;AAEd,IAAA,MAAM,GAAG,GAAG,wBAAwB,CAAC,SAAS,CAAC;IAC/C,MAAM,GAAG,GAAkC,EAAE;AAC7C,IAAA,KAAK,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAElD,EAAE;AACD,QAAA,MAAM,iBAAiB,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CACpD,CAAC,CAAM,KAAK,CAAC,CAAC,IAAI,KAAK,UAAU,CAClC;QACD,MAAM,OAAO,GAAG,iBAAiB,CAAC,EAAE,CAAC,EAAE,CAAC;QACxC,GAAG,CAAC,OAAO,CAAC,GAAI,OAAO,EAAE,GAAc,IAAI,IAAI;IACjD;AACA,IAAA,OAAO,GAAG;AACZ;AAwCM,SAAU,QAAQ,CAAC,KAAa,EAAE,QAAgB,EAAA;AACtD,IAAA,OAAO,CAAA,EAAG,KAAK,CAAA,CAAA,EAAI,QAAQ,EAAE;AAC/B;AAEA;;;AAGG;AACG,SAAU,eAAe,CAAC,SAAkB,EAAA;AAChD,IAAA,OAAO,eAAe,CAAC,SAAS,CAAC;AACnC;AAEA,SAAS,eAAe,CAAC,KAAc,EAAA;IACrC,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AAC/C,QAAA,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;IAC9B;AACA,IAAA,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;AACxB,QAAA,OAAO,CAAA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