@contentstack/studio-client 1.4.0 → 1.5.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 (97) hide show
  1. package/dist/breakpoints/BreakpointManager.js +17 -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 +101 -0
  6. package/dist/composable-studio/build-scoped-data.js.map +1 -0
  7. package/dist/composable-studio/collect-data-needs.js +226 -0
  8. package/dist/composable-studio/collect-data-needs.js.map +1 -0
  9. package/dist/composable-studio/composition-placement.types.js +7 -0
  10. package/dist/composable-studio/composition-placement.types.js.map +1 -0
  11. package/dist/composable-studio/initializer-sdk.js +1 -9
  12. package/dist/composable-studio/initializer-sdk.js.map +1 -1
  13. package/dist/composable-studio/sdk.js +1551 -195
  14. package/dist/composable-studio/sdk.js.map +1 -1
  15. package/dist/composable-studio/studio-intelligence.manager.js +124 -0
  16. package/dist/composable-studio/studio-intelligence.manager.js.map +1 -0
  17. package/dist/config/config.schema.js +10 -0
  18. package/dist/config/config.schema.js.map +1 -1
  19. package/dist/config/default-config.js +1 -0
  20. package/dist/config/default-config.js.map +1 -1
  21. package/dist/config/process-user-config.js +6 -0
  22. package/dist/config/process-user-config.js.map +1 -1
  23. package/dist/config/stack-sdk-wrapper.js +87 -2
  24. package/dist/config/stack-sdk-wrapper.js.map +1 -1
  25. package/dist/design/handle-active-style-change.js +0 -3
  26. package/dist/design/handle-active-style-change.js.map +1 -1
  27. package/dist/dnd/dnd-manager.js +25 -7
  28. package/dist/dnd/dnd-manager.js.map +1 -1
  29. package/dist/dnd/{utils.js → scroll-utils.js} +2 -27
  30. package/dist/dnd/scroll-utils.js.map +1 -0
  31. package/dist/hidden-element-notification/hidden-element-notification-event.js +7 -0
  32. package/dist/hidden-element-notification/hidden-element-notification-event.js.map +1 -1
  33. package/dist/highlight-node/highlight-node-manager.js +7 -1
  34. package/dist/highlight-node/highlight-node-manager.js.map +1 -1
  35. package/dist/highlight-node/highlight-node.js +38 -18
  36. package/dist/highlight-node/highlight-node.js.map +1 -1
  37. package/dist/index.d.ts +618 -31
  38. package/dist/index.js +16 -5
  39. package/dist/index.js.map +1 -1
  40. package/dist/node_modules/fflate/esm/browser.js +384 -0
  41. package/dist/node_modules/fflate/esm/browser.js.map +1 -0
  42. package/dist/packages/studio-internal/dist/utils/spec-compression.js +43 -0
  43. package/dist/packages/studio-internal/dist/utils/spec-compression.js.map +1 -0
  44. package/dist/query/expression-resolver.js +124 -0
  45. package/dist/query/expression-resolver.js.map +1 -0
  46. package/dist/query/query-executor.js +482 -0
  47. package/dist/query/query-executor.js.map +1 -0
  48. package/dist/shared/dnd-events.js +39 -0
  49. package/dist/shared/dnd-events.js.map +1 -0
  50. package/dist/url-change/url-change.js +65 -0
  51. package/dist/url-change/url-change.js.map +1 -0
  52. package/dist/url-metadata/build-template-query.js +124 -0
  53. package/dist/url-metadata/build-template-query.js.map +1 -0
  54. package/dist/url-metadata/parse-url-metadata.js +75 -0
  55. package/dist/url-metadata/parse-url-metadata.js.map +1 -0
  56. package/dist/url-metadata/rank-url-matches.js +100 -0
  57. package/dist/url-metadata/rank-url-matches.js.map +1 -0
  58. package/dist/url-metadata/select-url-winner.js +45 -0
  59. package/dist/url-metadata/select-url-winner.js.map +1 -0
  60. package/dist/url-metadata/shouldUseUrlMetadataPath.js +22 -0
  61. package/dist/url-metadata/shouldUseUrlMetadataPath.js.map +1 -0
  62. package/dist/url-metadata/types.js +50 -0
  63. package/dist/url-metadata/types.js.map +1 -0
  64. package/dist/url-metadata/url-pattern-matcher.js +311 -0
  65. package/dist/url-metadata/url-pattern-matcher.js.map +1 -0
  66. package/dist/utils/build-composition-fetch-query.js +19 -0
  67. package/dist/utils/build-composition-fetch-query.js.map +1 -0
  68. package/dist/utils/composable-studio-error.js +1 -0
  69. package/dist/utils/composable-studio-error.js.map +1 -1
  70. package/dist/utils/conditionBlock.js +17 -5
  71. package/dist/utils/conditionBlock.js.map +1 -1
  72. package/dist/utils/constants.js +22 -2
  73. package/dist/utils/constants.js.map +1 -1
  74. package/dist/utils/convertCompositionQueryInputToCompositionQuery.js +11 -1
  75. package/dist/utils/convertCompositionQueryInputToCompositionQuery.js.map +1 -1
  76. package/dist/utils/editor-utils.js +9 -0
  77. package/dist/utils/editor-utils.js.map +1 -1
  78. package/dist/utils/error-messages.default.js +1 -1
  79. package/dist/utils/error-messages.default.js.map +1 -1
  80. package/dist/utils/http-error.constants.js +11 -2
  81. package/dist/utils/http-error.constants.js.map +1 -1
  82. package/dist/utils/is-inside-iframe.js +16 -0
  83. package/dist/utils/is-inside-iframe.js.map +1 -0
  84. package/dist/utils/query-param.js +1 -1
  85. package/dist/utils/query-param.js.map +1 -1
  86. package/dist/utils/reference_fetcher.js +125 -14
  87. package/dist/utils/reference_fetcher.js.map +1 -1
  88. package/dist/utils/sdk.js +6 -1
  89. package/dist/utils/sdk.js.map +1 -1
  90. package/dist/utils/spec-analyzer.js +112 -0
  91. package/dist/utils/spec-analyzer.js.map +1 -0
  92. package/package.json +11 -10
  93. package/dist/dnd/utils.js.map +0 -1
  94. package/dist/get-composition-from-slug/get-composition-from-slug.js +0 -59
  95. package/dist/get-composition-from-slug/get-composition-from-slug.js.map +0 -1
  96. package/dist/utils/get-url-patterns.js +0 -40
  97. package/dist/utils/get-url-patterns.js.map +0 -1
@@ -0,0 +1,16 @@
1
+ import { IS_BROWSER } from '@contentstack/studio-messenger';
2
+
3
+ /**
4
+ * Checks if the current context is inside an iframe.
5
+ *
6
+ * @returns {boolean} True if inside an iframe, false otherwise.
7
+ */
8
+ const isInsideIframe = () => {
9
+ if (!IS_BROWSER) {
10
+ return false;
11
+ }
12
+ return window.self !== window.top;
13
+ };
14
+
15
+ export { isInsideIframe };
16
+ //# sourceMappingURL=is-inside-iframe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-inside-iframe.js","sources":["../../src/utils/is-inside-iframe.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA;;;;AAIG;AACI,MAAM,cAAc,GAAG,MAAc;IAC1C,IAAI,CAAC,UAAU,EAAE;AACf,QAAA,OAAO,KAAK;IACd;AACA,IAAA,OAAO,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,GAAG;AACnC;;;;"}
@@ -24,7 +24,7 @@ const onlyParmasGenerator = (only) => {
24
24
  });
25
25
  const onlyParams = {};
26
26
  referenceFields.forEach((fields, reference) => {
27
- onlyParams[`only[${reference}][]`] = fields;
27
+ onlyParams[`only[${reference}]`] = fields;
28
28
  });
29
29
  return onlyParams;
30
30
  };
@@ -1 +1 @@
1
- {"version":3,"file":"query-param.js","sources":["../../src/utils/query-param.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAKO,MAAM,UAAU,GAAG;AACxB,IAAA,GAAG,CAAC,GAAoC,EAAA;QACtC,IAAI,UAAU,EAAE;AACd,YAAA,OAAO,IAAI,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;QAC7D;AAEA,QAAA,OAAO,IAAI;IACb,CAAC;AACD,IAAA,GAAG,CAAC,GAAoC,EAAA;QACtC,IAAI,UAAU,EAAE;AACd,YAAA,OAAO,IAAI,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;QAC7D;AAEA,QAAA,OAAO,KAAK;IACd,CAAC;;AAGI,MAAM,mBAAmB,GAAG,CAAC,IAAwB,KAAI;AAC9D,IAAA,MAAM,eAAe,GAAG,IAAI,GAAG,EAAE;IACjC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,KAAK,CAAC,KAAI;QAClC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;AACnC,YAAA,eAAe,CAAC,GAAG,CAAC,SAAS,EAAE,E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C,CAAC;IACF,MAAM,UAAU,GAA6B,EAAE;IAC/C,eAAe,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,SAAS,KAAI;AAC5C,QAAA,UAAU,CAAC,CAAA,KAAA,EAAQ,SAAS,GAAG,CAAC,GAAG,MAAM;AAC3C,IAAA,CAAC,CAAC;AACF,IAAA,OAAO,UAAU;AACnB;;;;"}
@@ -1,7 +1,24 @@
1
1
  import { DATA_SOURCES } from '@contentstack/studio-registry';
2
2
  import { uniq, merge } from 'lodash-es';
3
3
  import { getBindingStringForCS } from './sdk.js';
4
+ import { decompressSpec } from '../packages/studio-internal/dist/utils/spec-compression.js';
4
5
 
6
+ // Strip numeric array indexes and "entries" array-wrapper segments so that
7
+ // binding-traversal paths like "entries.0.cross_links" or "entries.cross_links"
8
+ // become "cross_links". "entries" is never a valid Contentstack include[] field name.
9
+ function sanitizeIncludePath(p) {
10
+ const parts = p.split(".");
11
+ const result = [];
12
+ for (const seg of parts) {
13
+ if (/^\d+$/.test(seg) || seg === "entries")
14
+ continue;
15
+ result.push(seg);
16
+ }
17
+ return result.join(".");
18
+ }
19
+ function sanitizeIncludePaths(paths) {
20
+ return paths.map(sanitizeIncludePath).filter(Boolean);
21
+ }
5
22
  /**
6
23
  * Helper function to process binding logic for template, contentstack, and repeater bindings
7
24
  */
@@ -89,7 +106,7 @@ const getExtendedParams = (ct_uid, options) => {
89
106
  const getEntriesQueries = (compositionEntry, connectedContentTypeUid, options) => {
90
107
  const { ui: uiString } = compositionEntry;
91
108
  // TODO: error handling
92
- const ui = JSON.parse(uiString);
109
+ const ui = decompressSpec(uiString);
93
110
  const templateBindings = {
94
111
  path: {},
95
112
  };
@@ -99,6 +116,23 @@ const getEntriesQueries = (compositionEntry, connectedContentTypeUid, options) =
99
116
  // const repeaterBindings: string[] = [];
100
117
  // { ct_uid: { entry_uid: { path: {} } }}
101
118
  const staticBindings = {};
119
+ // Collects reference paths for static (contentstack) entries directly during
120
+ // traversal. When a REPEATER-type repeater is found inside a CONTENTSTACK
121
+ // context, runningPath gives the full path from entry root (e.g.
122
+ // "modular_blocks.experience.spa_service") — that's the reference path.
123
+ // This avoids building a nested tree in staticBindings which would include
124
+ // non-reference intermediate levels that the CMA API rejects (422).
125
+ const staticEntryRefPaths = {};
126
+ // Tracks which contentstack entry context we're currently inside
127
+ let currentStaticEntryKey = null;
128
+ // Collects template repeater reference paths directly during traversal.
129
+ // generateQueryDetails infers references from tree structure (nodes with
130
+ // children = references), but the reference condition handler creates
131
+ // intermediate nodes (e.g. "modular_blocks.test") that aren't references.
132
+ // This produces wrong include[] paths. Instead, we collect the actual
133
+ // reference paths here — the full schema path at each REPEATER-type
134
+ // repeater inside a reference condition.
135
+ const templateRepeaterRefPaths = [];
102
136
  // collects all templateBindings and static Bindings
103
137
  const traveller = (node, runningPath = [], runningRepeaterNode = templateRepeaterBindings.path) => {
104
138
  // HANDLE REPEATER REFERENCE BINDINGS
@@ -107,11 +141,43 @@ const getEntriesQueries = (compositionEntry, connectedContentTypeUid, options) =
107
141
  runningPath.push(node.metadata.condition.value);
108
142
  }
109
143
  if (node.metadata?.condition?.type === "reference") {
110
- const path = getSchemaPath(runningPath).join(".");
111
- if (!runningRepeaterNode[path]) {
112
- runningRepeaterNode[path] = {};
144
+ // The reference condition appears AFTER the repeater that iterates
145
+ // the reference field. So runningPath already includes the reference
146
+ // field name (e.g. ["modular_blocks","test","reference"]).
147
+ // Record this as the include[] path right here — the REPEATERs
148
+ // inside the reference condition are for fields INSIDE the referenced
149
+ // entry (not reference fields themselves).
150
+ const refPath = getSchemaPath(runningPath).join(".");
151
+ if (refPath) {
152
+ if (currentStaticEntryKey) {
153
+ const { ct_uid, entry_uid } = currentStaticEntryKey;
154
+ if (!staticEntryRefPaths[ct_uid]) {
155
+ staticEntryRefPaths[ct_uid] = {};
156
+ }
157
+ if (!staticEntryRefPaths[ct_uid][entry_uid]) {
158
+ staticEntryRefPaths[ct_uid][entry_uid] = [];
159
+ }
160
+ staticEntryRefPaths[ct_uid][entry_uid].push(refPath);
161
+ }
162
+ else {
163
+ templateRepeaterRefPaths.push(refPath);
164
+ }
165
+ }
166
+ // Use the absolute reference path at the top level of
167
+ // templateRepeaterBindings so that generateQueryDetails produces
168
+ // the correct onlyParent for fields inside this reference condition
169
+ // (e.g. "sections_of_the_page.experiences_activities.reference").
170
+ // Previously this nested the path inside runningRepeaterNode, which
171
+ // caused the parent to be "reference.sections_of_the_page…" — an
172
+ // invalid Contentstack only[] key that was silently ignored, leaving
173
+ // referenced-entry fields (e.g. image.url) out of the only[] projection
174
+ // and therefore absent from the API response.
175
+ if (refPath) {
176
+ if (!templateRepeaterBindings.path[refPath]) {
177
+ templateRepeaterBindings.path[refPath] = {};
178
+ }
179
+ runningRepeaterNode = templateRepeaterBindings.path[refPath];
113
180
  }
114
- runningRepeaterNode = runningRepeaterNode[path];
115
181
  }
116
182
  }
117
183
  const isRepeaterNode = node.type === "repeater";
@@ -134,13 +200,43 @@ const getEntriesQueries = (compositionEntry, connectedContentTypeUid, options) =
134
200
  staticBindings[_content_type_uid][uid] = { path: {} };
135
201
  }
136
202
  merge(staticBindings[_content_type_uid][uid].path, path);
203
+ // Start tracking which contentstack entry we're inside
204
+ currentStaticEntryKey = { ct_uid: _content_type_uid, entry_uid: uid };
205
+ }
206
+ else if (type === DATA_SOURCES.REPEATER) {
207
+ // Nested repeater inside a repeater — update the tree for
208
+ // onlyPaths tracking.
209
+ const bindingStr = getBindingStringForCS(items.binding);
210
+ if (bindingStr) {
211
+ if (!runningRepeaterNode[bindingStr]) {
212
+ runningRepeaterNode[bindingStr] = {};
213
+ }
214
+ runningRepeaterNode = runningRepeaterNode[bindingStr];
215
+ // Note: reference path recording is handled at the reference
216
+ // condition block (above), NOT here. The reference condition
217
+ // appears AFTER the repeater that iterates the reference field,
218
+ // so its runningPath already has the correct include[] path.
219
+ // Recording here would incorrectly include non-reference fields
220
+ // (like modular_blocks inside a referenced entry).
221
+ }
137
222
  }
138
223
  }
139
224
  }
140
225
  if (isConditionBlockNode) {
141
226
  if (node.metadata?.condition) {
142
227
  const { conditionBinding } = node.metadata.condition;
143
- processBinding(conditionBinding, templateBindings, staticBindings, runningRepeaterNode);
228
+ // Inside a contentstack repeater context, condition bindings that
229
+ // point back to the same static entry would add deep paths (e.g.
230
+ // modular_blocks.test.reference.modular_blocks) to staticBindings.
231
+ // generateQueryDetails treats intermediate nodes as references,
232
+ // producing invalid include[] paths. Skip CONTENTSTACK condition
233
+ // bindings when inside a repeater — the entry's include paths are
234
+ // already handled by staticEntryRefPaths.
235
+ const skipForStaticEntry = currentStaticEntryKey &&
236
+ conditionBinding?.type === DATA_SOURCES.CONTENTSTACK;
237
+ if (!skipForStaticEntry) {
238
+ processBinding(conditionBinding, templateBindings, staticBindings, runningRepeaterNode);
239
+ }
144
240
  }
145
241
  }
146
242
  for (const propKey in node.props) {
@@ -170,21 +266,31 @@ const getEntriesQueries = (compositionEntry, connectedContentTypeUid, options) =
170
266
  };
171
267
  traveller(ui);
172
268
  // generate query for templateBinding and each static binding
173
- const { referencePaths: templateReferencesPath, onlyPaths: templateOnlyKeys, } = generateQueryDetails(templateBindings);
269
+ const { onlyPaths: templateOnlyKeys } = generateQueryDetails(templateBindings);
174
270
  const { includeReferences: extendedReferencesPath, onlyPaths: extendedOnlyKeys, } = getExtendedParams(connectedContentTypeUid, options);
175
- const { referencePaths: repeaterReferencesPath, onlyPaths: repeaterOnlyKeys, } = generateQueryDetails(templateRepeaterBindings);
271
+ const { onlyPaths: repeaterOnlyKeys } = generateQueryDetails(templateRepeaterBindings);
176
272
  const contentstackEntriesReferencesPath = {};
177
273
  const contentstackEntriesOnlyKeys = {};
178
274
  for (const _content_type_uid in staticBindings) {
179
- for (const entry_uid in staticBindings[_content_type_uid]) {
180
- const path = staticBindings[_content_type_uid][entry_uid];
275
+ // Initialize the per-content-type buckets ONCE per content type. These were
276
+ // previously reset inside the entry loop below, which clobbered every entry
277
+ // except the last when a composition referenced multiple entries of the same
278
+ // content type (e.g. several `product` entries on one page) — so only the
279
+ // last entry was ever fetched and the rest resolved to defaults/blanks.
280
+ if (!contentstackEntriesReferencesPath[_content_type_uid]) {
181
281
  contentstackEntriesReferencesPath[_content_type_uid] = {};
282
+ }
283
+ if (!contentstackEntriesOnlyKeys[_content_type_uid]) {
182
284
  contentstackEntriesOnlyKeys[_content_type_uid] = {};
183
- const { referencePaths, onlyPaths } = generateQueryDetails(path);
285
+ }
286
+ for (const entry_uid in staticBindings[_content_type_uid]) {
287
+ const path = staticBindings[_content_type_uid][entry_uid];
288
+ const { onlyPaths } = generateQueryDetails(path);
184
289
  const { includeReferences, onlyPaths: extendedOnlyPaths } = getExtendedParams(_content_type_uid, options);
290
+ const entryRefPaths = staticEntryRefPaths[_content_type_uid]?.[entry_uid] ?? [];
185
291
  contentstackEntriesReferencesPath[_content_type_uid][entry_uid] = uniq([
186
- ...referencePaths,
187
292
  ...includeReferences,
293
+ ...sanitizeIncludePaths(entryRefPaths),
188
294
  ]);
189
295
  contentstackEntriesOnlyKeys[_content_type_uid][entry_uid] = uniq([
190
296
  ...onlyPaths,
@@ -193,9 +299,14 @@ const getEntriesQueries = (compositionEntry, connectedContentTypeUid, options) =
193
299
  }
194
300
  }
195
301
  const result = {
302
+ // Only use directly-collected reference paths. generateQueryDetails
303
+ // infers references from tree structure (nodes with children), but
304
+ // non-reference fields like groups, file, link, and global fields
305
+ // also have children — causing invalid include[] paths and 422 errors.
306
+ // templateRepeaterRefPaths collects paths only at condition.type ===
307
+ // "reference" nodes, which is the single authoritative signal.
196
308
  templateReferencesPath: uniq([
197
- ...templateReferencesPath,
198
- ...repeaterReferencesPath,
309
+ ...sanitizeIncludePaths(templateRepeaterRefPaths),
199
310
  ...extendedReferencesPath,
200
311
  ]),
201
312
  templateOnlyKeys: removeRedundantPathsForTemplates(uniq([...templateOnlyKeys, ...repeaterOnlyKeys, ...extendedOnlyKeys])),
@@ -1 +1 @@
1
- {"version":3,"file":"reference_fetcher.js","sources":["../../src/utils/reference_fetc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M,QAAQ,GACZ,2BAA2B,CAAC,iBAAiB,CAAC,CAAC,SAAS,CAAC;;AAE3D,YAAA,MAAM,CAAC,iBAAiB,CAAC,CAAC,SAAS,CAAC;gBAClC,gCAAgC,CAAC,QAAQ,CAAC;QAC9C;IACF;AACA,IAAA,OAAO,MAAM;AACf;;;;"}
package/dist/utils/sdk.js CHANGED
@@ -1,5 +1,7 @@
1
1
  import { DATA_SOURCES } from '@contentstack/studio-registry';
2
2
 
3
+ const SECTION_COMPOSITIONS_KEY = "section_compositions";
4
+ const TEMPLATE_FULL_ENTRY_KEY = "template_full_entry";
3
5
  const setTemplateEntryInDS = (dataSources, entry) => {
4
6
  if (!entry || Array.isArray(entry))
5
7
  return;
@@ -48,6 +50,9 @@ const getBindingStringForCS = (binding) => {
48
50
  if (!path)
49
51
  return "";
50
52
  const flattenPath = (path) => {
53
+ // Handle null/undefined path from dev11 server responses
54
+ if (!path || typeof path !== "object")
55
+ return "";
51
56
  if (Object.keys(path).length === 0)
52
57
  return "";
53
58
  const key = Object.keys(path)[0];
@@ -64,5 +69,5 @@ function entriesFromResponse(response) {
64
69
  return response.entries;
65
70
  }
66
71
 
67
- export { batchFetchEntries, entriesFromResponse, getBindingStringForCS, setStaticEntryInDS, setTemplateEntryInDS };
72
+ export { SECTION_COMPOSITIONS_KEY, TEMPLATE_FULL_ENTRY_KEY, batchFetchEntries, entriesFromResponse, getBindingStringForCS, setStaticEntryInDS, setTemplateEntryInDS };
68
73
  //# sourceMappingURL=sdk.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.js","sources":["../../src/utils/sdk.ts"],"sourcesContent":[null],"names":[],"mappings":";;MAWa,oBAAoB,GAAG,CAClC,WAAgC,EAChC,KAAc,KACN;IACR,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE;IACpC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE;AACvC,QAAA,WAAW,CAAC,YA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,CAAC,IAAI;AACN,IAAA,IAAI,CAAC,IAAI;AAAE,QAAA,OAAO,EAAE;AACpB,IAAA,MAAM,WAAW,GAAG,CAAC,IAAmB,KAAY;;AAElD,QAAA,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;AAAE,YAAA,OAAO,EAAE;QAChD,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC;AAAE,YAAA,OAAO,EAAE;QAC7C,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAChC,QAAA,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC;AACvB,QAAA,MAAM,YAAY,GAAG,WAAW,CAAC,KAAK,CAAC;AACvC,QAAA,OAAO,YAAY,GAAG,CAAA,EAAG,GAAG,CAAA,CAAA,EAAI,YAAY,CAAA,CAAE,GAAG,GAAG;AACtD,IAAA,CAAC;AACD,IAAA,OAAO,WAAW,CAAC,IAAI,CAAC;AAC1B;AAOM,SAAU,mBAAmB,CAAI,QAA4B,EAAA;AACjE,IAAA,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;AAC3B,QAAA,OAAO,QAAQ,CAAC,CAAC,CAAQ;IAC3B;IACA,OAAO,QAAQ,CAAC,OAAc;AAChC;;;;"}
@@ -0,0 +1,112 @@
1
+ import { getSectionUIDFromNode } from '@contentstack/studio-registry';
2
+
3
+ /**
4
+ * Normalizes component type names, especially for section compositions.
5
+ * Converts section-composition nodes to their actual composition UIDs.
6
+ *
7
+ * @param node - The UI node to get the component type from
8
+ * @returns Normalized component type string or null
9
+ */
10
+ function getNormalizedComponentType(node) {
11
+ if (node.type === "section-composition") {
12
+ return getSectionUIDFromNode(node) || node.type;
13
+ }
14
+ return node.type || null;
15
+ }
16
+ /**
17
+ * Analyzes a UI spec (Node tree) and extracts all component types used.
18
+ * Recursively traverses the spec to find all components.
19
+ *
20
+ * @param spec - The root node of the UI spec
21
+ * @returns Set of component types used in the spec
22
+ */
23
+ function analyzeUsedComponents(spec) {
24
+ const usedComponents = new Set();
25
+ function traverse(node) {
26
+ if (!node)
27
+ return;
28
+ // Add the component type
29
+ const normalizedType = getNormalizedComponentType(node);
30
+ if (normalizedType) {
31
+ usedComponents.add(normalizedType);
32
+ }
33
+ // Traverse slots (children)
34
+ if (node.slots && typeof node.slots === "object") {
35
+ Object.values(node.slots).forEach((slotContent) => {
36
+ if (Array.isArray(slotContent)) {
37
+ slotContent.forEach((child) => traverse(child));
38
+ }
39
+ else if (slotContent && typeof slotContent === "object") {
40
+ traverse(slotContent);
41
+ }
42
+ });
43
+ }
44
+ // Handle children array if present (alternative structure)
45
+ if (Array.isArray(node.children)) {
46
+ node.children.forEach((child) => traverse(child));
47
+ }
48
+ }
49
+ traverse(spec);
50
+ return usedComponents;
51
+ }
52
+ /**
53
+ * Analyzes multiple UI specs and returns the union of all component types used.
54
+ * Useful for optimizing multi-composition loading.
55
+ *
56
+ * @param specs - Array of UI spec root nodes
57
+ * @returns Set of all unique component types used across all specs
58
+ */
59
+ function analyzeMultipleSpecs(specs) {
60
+ const allComponents = new Set();
61
+ specs.forEach((spec) => {
62
+ const components = analyzeUsedComponents(spec);
63
+ components.forEach((component) => allComponents.add(component));
64
+ });
65
+ return allComponents;
66
+ }
67
+ /**
68
+ * Checks if a spec uses a specific component type.
69
+ *
70
+ * @param spec - The UI spec to check
71
+ * @param componentType - The component type to look for
72
+ * @returns true if the component is used in the spec
73
+ */
74
+ function specUsesComponent(spec, componentType) {
75
+ const components = analyzeUsedComponents(spec);
76
+ return components.has(componentType);
77
+ }
78
+ /**
79
+ * Gets component usage statistics for a spec.
80
+ *
81
+ * @param spec - The UI spec to analyze
82
+ * @returns Map of component types to their usage count
83
+ */
84
+ function getComponentUsageStats(spec) {
85
+ const stats = new Map();
86
+ function traverse(node) {
87
+ if (!node)
88
+ return;
89
+ const normalizedType = getNormalizedComponentType(node);
90
+ if (normalizedType) {
91
+ stats.set(normalizedType, (stats.get(normalizedType) || 0) + 1);
92
+ }
93
+ if (node.slots && typeof node.slots === "object") {
94
+ Object.values(node.slots).forEach((slotContent) => {
95
+ if (Array.isArray(slotContent)) {
96
+ slotContent.forEach((child) => traverse(child));
97
+ }
98
+ else if (slotContent && typeof slotContent === "object") {
99
+ traverse(slotContent);
100
+ }
101
+ });
102
+ }
103
+ if (Array.isArray(node.children)) {
104
+ node.children.forEach((child) => traverse(child));
105
+ }
106
+ }
107
+ traverse(spec);
108
+ return stats;
109
+ }
110
+
111
+ export { analyzeMultipleSpecs, analyzeUsedComponents, getComponentUsageStats, specUsesComponent };
112
+ //# sourceMappingURL=spec-analyzer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spec-analyzer.js","sources":["../../src/utils/spec-analyzer.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAGA;;;;;;AAMG;AACH,SAAS,0BAA0B,CAAC,IAAU,EAAA;AAC5C,IAAA,IAAI,IAAI,CAAC,IAAI,KAAK,qBAAqB,EAAE;QACvC,OAAO,qBAAqB,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI;IACjD;AACA,IAAA,OAAO,IAAI,CAAC,IAAI,IAAI,IAAI;AAC1B;AAEA;;;;;;AAMG;AACG,SAAU,qBAAqB,CACnC,IAA6B,EAAA;AAE7B,IAAA,MAAM,cAAc,GAAG,IAAI,GAAG,EAAU;IAExC,SAAS,QAAQ,CAAC,IAA6B,EAAA;AAC7C,QAAA,IAAI,CAAC,IAAI;YAAE;;AAGX,QAAA,MAAM,cAAc,GAAG,0BAA0B,CAAC,IAAI,CAAC;QACvD,IAAI,cAAc,EAAE;AAClB,YAAA,cAAc,CAAC,GAAG,CAAC,cAAc,CAAC;QACpC;;QAGA,IAAI,IAAI,CAAC,KAAK,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,EAAE;AAChD,YAAA,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CA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AEvC,SAAS,QAAQ,CAAC,IAA6B,EAAA;AAC7C,QAAA,IAAI,CAAC,IAAI;YAAE;AAEX,QAAA,MAAM,cAAc,GAAG,0BAA0B,CAAC,IAAI,CAAC;QACvD,IAAI,cAAc,EAAE;AAClB,YAAA,KAAK,CAAC,GAAG,CAAC,cAAc,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjE;QAEA,IAAI,IAAI,CAAC,KAAK,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,EAAE;AAChD,YAAA,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,WAAgB,KAAI;AACrD,gBAAA,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;AAC9B,oBAAA,WAAW,CAAC,OAAO,CAAC,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC,CAAC;gBACjD;AAAO,qBAAA,IAAI,WAAW,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE;oBACzD,QAAQ,CAAC,WAAW,CAAC;gBACvB;AACF,YAAA,CAAC,CAAC;QACJ;QAEA,IAAI,KAAK,CAAC,OAAO,CAAE,IAAY,CAAC,QAAQ,CAAC,EAAE;AACxC,YAAA,IAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAU,KAAK,QAAQ,CAAC,KAAK,CAAC,CAAC;QACjE;IACF;IAEA,QAAQ,CAAC,IAAI,CAAC;AACd,IAAA,OAAO,KAAK;AACd;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentstack/studio-client",
3
- "version": "1.4.0",
3
+ "version": "1.5.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "module": "dist/index.js",
@@ -30,15 +30,16 @@
30
30
  "url": "https://github.com/contentstack/composable-studio-sdk/issues"
31
31
  },
32
32
  "devDependencies": {
33
- "@contentstack/common-config": "^1.1.5",
33
+ "@contentstack/common-config": "^1.1.7",
34
34
  "@contentstack/delivery-sdk": "^4.5.0",
35
- "@contentstack/studio-internal": "^1.1.5",
35
+ "@contentstack/studio-internal": "^1.2.1",
36
36
  "@rollup/plugin-commonjs": "^28.0.6",
37
37
  "@rollup/plugin-node-resolve": "^16.0.1",
38
- "@rollup/plugin-terser": "^0.4.4",
38
+ "@rollup/plugin-replace": "^6.0.3",
39
+ "@rollup/plugin-terser": "^1.0.0",
39
40
  "@rollup/plugin-typescript": "^12.1.4",
40
41
  "contentstack": "^3.20.3",
41
- "happy-dom": "^20.0.1",
42
+ "happy-dom": "^20.8.9",
42
43
  "msw": "^2.12.9",
43
44
  "rollup": "^4.46.2",
44
45
  "rollup-plugin-dts": "^6.2.1",
@@ -47,13 +48,13 @@
47
48
  "typescript": "^5.5.4"
48
49
  },
49
50
  "dependencies": {
50
- "@contentstack/studio-message-types": "^1.1.5",
51
- "@contentstack/studio-messenger": "^1.2.0",
52
- "@contentstack/studio-registry": "^1.3.0",
51
+ "@contentstack/studio-message-types": "^1.2.1",
52
+ "@contentstack/studio-messenger": "^1.3.1",
53
+ "@contentstack/studio-registry": "^1.4.1",
53
54
  "eventemitter3": "^5.0.1",
54
55
  "html2canvas": "^1.4.1",
55
- "lodash-es": "^4.17.23",
56
+ "lodash-es": "^4.18.1",
56
57
  "zod": "^3.23.8"
57
58
  },
58
- "gitHead": "6739518a282ff9788218b0acd2e46e0be2a6fb68"
59
+ "gitHead": "d4e0a1d80b39a2bfa9ac12baa5d4d4a852f4b326"
59
60
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sources":["../../src/dnd/utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAEO,MAAM,mBAAmB,GAAG,CAAC,EAAe,KAAI;AACrD,IAAA,IAAI,MAAM,GAAG,EAAE,CAAC,aAAa;IAE7B,OAAO,MAAM,EAAE;QACb,MAAM,KAAK,GAAG,MAA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AAe;AACxB;AAEO,MAAM,qBAAqB,GAAG,CACnC,QAAgB,EAChB,OAAe,EACf,QAAgB,KACd;IACF,MAAM,UAAU,GAAG,CAAC,OAAO,GAAG,QAAQ,IAAI,OAAO;IACjD,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,GAAG,UAAU,CAAC;AAClD;;;;"}
@@ -1,59 +0,0 @@
1
- function getCompositionFromSlug(url, entries) {
2
- // FIRST: Process the slugs to make them suitable for regex matching
3
- const slugToEntryMap = new Map();
4
- entries.forEach((entry) => {
5
- if (entry.url) {
6
- const normalizedSlug = normalizeSlug(entry.url);
7
- const slugRegex = slugToRegex(normalizedSlug);
8
- slugToEntryMap.set(slugRegex, {
9
- entry,
10
- normalizedSlug,
11
- });
12
- }
13
- });
14
- // SECOND: Find the closest matching slug for the given URL
15
- const normalizedPathname = normalizeSlug(url);
16
- let bestMatchedComposition = null;
17
- let bestMatchSpecificity = -Infinity;
18
- slugToEntryMap.forEach(({ entry, normalizedSlug }, slugRegex) => {
19
- if (slugRegex.test(normalizedPathname)) {
20
- const numberOfSegments = normalizedSlug.split("/").length;
21
- const numberOfWildcards = normalizedSlug.split("*").length - 1;
22
- const hasDoubleWildcard = normalizedSlug.includes("**");
23
- // Prioritize more segments, fewer wildcards, and presence of **
24
- let specificity = numberOfSegments * 100 - numberOfWildcards * 10; // More segments = higher, more wildcards = lower.
25
- if (hasDoubleWildcard) {
26
- specificity += 5; // Give `**` a small boost over single `*`
27
- }
28
- specificity += normalizedSlug.length * 0.1;
29
- if (specificity > bestMatchSpecificity) {
30
- bestMatchedComposition = entry;
31
- bestMatchSpecificity = specificity;
32
- }
33
- }
34
- });
35
- return bestMatchedComposition;
36
- }
37
- /**
38
- * Normalizes a URL slug by removing leading/trailing slashes.
39
- * @param {string} slug The slug to normalize.
40
- * @returns {string} The normalized slug.
41
- */
42
- function normalizeSlug(slug) {
43
- return slug.replace(/^\/+|\/+$/g, "");
44
- }
45
- /**
46
- * Converts a slug to a regular expression, handling wildcards.
47
- * @param {string} slug The slug to convert.
48
- * @returns {RegExp} The corresponding regular expression.
49
- */
50
- function slugToRegex(slug) {
51
- const escapedSlug = slug.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
52
- const regexStr = escapedSlug
53
- .replace(/\\\*\\\*/g, ".+") // Double star (**) becomes .+
54
- .replace(/\\\*/g, "[^/]+"); // Single star (*) becomes [^/]+
55
- return new RegExp(`^${regexStr}$`);
56
- }
57
-
58
- export { getCompositionFromSlug };
59
- //# sourceMappingURL=get-composition-from-slug.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-composition-from-slug.js","sources":["../../src/get-composition-from-slug/get-composition-from-slug.ts"],"sourcesContent":[null],"names":[],"mappings":"AAEM,SAAU,sBAAsB,CACpC,GAAW,EACX,OAA2B,EAAA;;AAG3B,IAAA,MAAM,cAAc,GAMhB,IAAI,GAAG,EAAE;AAEb,IAAA,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,KAAI;AACxB,QAAA,IAAI,KAAK,CAAC,GAAG,EAAE;YACb,MAAM,cAAc,GAAG,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC;AAC/C,YAAA,MAAM,SAAS,GAAG,WAAW,CAAC,cAAc,CAAC;AAC7C,YAAA,cAAc,CAAC,GAAG,CAAC,SAAS,EAAE;gBAC5B,KAAK;gBACL,cAAc;AACf,aAAA,CAAC;QACJ;AACF,IAAA,CAAC,CAAC;;AAGF,IAAA,MAAM,kBAAkB,GAAG,aAAa,CAAC,GAAG,CAAC;IAE7C,IAAI,sBAAsB,GAA4B,IAAI;AAC1D,IAAA,IAAI,oBAAoB,GAAG,CAAC,QAAQ;AAEpC,IAAA,cAAc,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,EAAE,EAAE,SAAS,KAAI;AAC9D,QAAA,IAAI,SAAS,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE;YACtC,MAAM,gBAAgB,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM;AACzD,YAAA,MAAM,iBAAiB,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC;YAC9D,MAAM,iBAAiB,GAAG,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC;;YAGvD,IAAI,WAAW,GAAG,gBAAgB,GAAG,GAAG,GAAG,iBAAiB,GAAG,EAAE,CAAC;YAClE,IAAI,iBAAiB,EAAE;AACrB,gBAAA,WAAW,IAAI,CAAC,CAAC;YACnB;AACA,YAAA,WAAW,IAAI,cAAc,CAAC,MAAM,GAAG,GAAG;AAE1C,YAAA,IAAI,WAAW,GAAG,oBAAoB,EAAE;gBACtC,sBAAsB,GAAG,KAAK;gBAC9B,oBAAoB,GAAG,WAAW;YACpC;QACF;AACF,IAAA,CAAC,CAAC;AAEF,IAAA,OAAO,sBAAsB;AAC/B;AAEA;;;;AAIG;AACH,SAAS,aAAa,CAAC,IAAY,EAAA;IACjC,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC;AACvC;AAEA;;;;AAIG;AACH,SAAS,WAAW,CAAC,IAAY,EAAA;IAC/B,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC;IAC/D,MAAM,QAAQ,GAAG;AACd,SAAA,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC;AAC1B,SAAA,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAE7B,IAAA,OAAO,IAAI,MAAM,CAAC,IAAI,QAAQ,CAAA,CAAA,CAAG,CAAC;AACpC;;;;"}
@@ -1,40 +0,0 @@
1
- /**
2
- * Get all possible url patterns for a given pathname.
3
- * This is used to fetch the composition by url.
4
- * @param pathname - The pathname to get the url patterns for.
5
- * @returns An array of url patterns.
6
- */
7
- function getUrlPatterns(pathname) {
8
- const hasLeadingSlash = pathname.startsWith("/");
9
- const path = new URL(pathname, "http://www.example.com").pathname;
10
- const segments = path.split("/").filter(Boolean);
11
- const patterns = new Set();
12
- const prefix = hasLeadingSlash ? "/" : "";
13
- // Handle empty path
14
- if (segments.length === 0) {
15
- return [hasLeadingSlash ? "/" : ""];
16
- }
17
- // If path ends with "/" (and is not just "/"), include root pattern
18
- if (path.endsWith("/") && path !== "/") {
19
- patterns.add(hasLeadingSlash ? "/" : "");
20
- }
21
- // Always include exact path
22
- patterns.add(prefix + segments.join("/"));
23
- // Replace segments from the end progressively with wildcards
24
- // For "/user/123/profile":
25
- // - Replace last 1: "/user/123/*"
26
- // - Replace last 2: "/user/*/*"
27
- // - Replace all: "/*/*/*"
28
- for (let i = 1; i <= segments.length; i++) {
29
- const temp = [...segments];
30
- // Replace last i segments with "*"
31
- for (let j = segments.length - i; j < segments.length; j++) {
32
- temp[j] = "*";
33
- }
34
- patterns.add(prefix + temp.join("/"));
35
- }
36
- return Array.from(patterns);
37
- }
38
-
39
- export { getUrlPatterns };
40
- //# sourceMappingURL=get-url-patterns.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-url-patterns.js","sources":["../../src/utils/get-url-patterns.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;AAKG;AACG,SAAU,cAAc,CAAC,QAAgB,EAAA;IAC7C,MAAM,eAAe,GAAG,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC;IAChD,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,QAAQ,EAAE,wBAAwB,CAAC,CAAC,QAAQ;AACjE,IAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;AAChD,IAAA,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAE;IAC1B,MAAM,MAAM,GAAG,eAAe,GAAG,GAAG,GAAG,EAAE;;AAGzC,IAAA,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;QACzB,OAAO,CAAC,eAAe,GAAG,GAAG,GAAG,EA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