@contentstack/studio-client 1.5.1 → 1.7.0

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/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _contentstack_studio_internal from '@contentstack/studio-internal';
2
- import { Node, PathNode, Path, Operation, Descendant, BindingType, Condition, NodeStyles } from '@contentstack/studio-internal';
2
+ import { Node, BindingType, PathNode, Path, Operation, Descendant, Condition, NodeStyles } from '@contentstack/studio-internal';
3
3
  import * as _contentstack_studio_registry from '@contentstack/studio-registry';
4
4
  import { RawStaticValue, ICSEntryReference, StudioSpecData, StaticValue, BreakpointInput, Breakpoint } from '@contentstack/studio-registry';
5
5
  export { Breakpoint } from '@contentstack/studio-registry';
@@ -617,6 +617,9 @@ interface SeoMetadata {
617
617
  pageTitle: string;
618
618
  pageDescription: string;
619
619
  openGraphImage: string;
620
+ pageTitleBinding?: BindingType;
621
+ pageDescriptionBinding?: BindingType;
622
+ openGraphImageBinding?: BindingType;
620
623
  metaProps: MetaProp[];
621
624
  }
622
625
  interface MetaProp {
@@ -625,6 +628,7 @@ interface MetaProp {
625
628
  type: "text" | "number";
626
629
  defaultValue: string;
627
630
  previewValue: string;
631
+ binding?: BindingType;
628
632
  }
629
633
 
630
634
  declare const studioSdk: {
@@ -632,17 +636,19 @@ declare const studioSdk: {
632
636
  internal: {
633
637
  getConfig(): Config;
634
638
  isInsideStudioFrame: () => boolean;
635
- fetchSpec: (queryOptions: _contentstack_studio_messenger.CompositionQuery, options?: CompositionQueryOptions, skipComponentLoading?: boolean) => Promise<StudioSpec>;
639
+ fetchSpec: (queryOptions: _contentstack_studio_messenger.CompositionQuery, options?: CompositionQueryOptions, skipComponentLoading?: boolean, searchParams?: URLSearchParams) => Promise<StudioSpec>;
636
640
  fetchMultipleSpecs: (queries: _contentstack_studio_messenger.CompositionQuery[], options?: CompositionQueryOptions) => Promise<StudioSpec[]>;
637
- fetchData: (compositionEntry: CompositionEntry, queryOptions: _contentstack_studio_messenger.CompositionQuery, options?: CompositionQueryOptions, sectionEntries?: SectionCompositionEntry[]) => Promise<_contentstack_studio_registry.StudioSpecData>;
641
+ fetchData: (compositionEntry: CompositionEntry, queryOptions: _contentstack_studio_messenger.CompositionQuery, options?: CompositionQueryOptions, sectionEntries?: SectionCompositionEntry[], searchParams?: URLSearchParams) => Promise<_contentstack_studio_registry.StudioSpecData>;
638
642
  fetchTemplateEntry: (fetchOptions: {
639
643
  connected_content_type: string;
640
644
  compositionQuery: _contentstack_studio_messenger.CompositionQuery;
641
645
  includeQueries: string[];
642
646
  onlyQueries: [string, string][];
643
647
  composableUid: string;
644
- }, data: _contentstack_studio_registry.StudioSpecData, compositionEntry: CompositionEntry, compositionQueryOptions?: CompositionQueryOptions) => Promise<void>;
645
- getSeoMetadata: (ui: _contentstack_studio_internal.Node) => SeoMetadata;
648
+ }, data: _contentstack_studio_registry.StudioSpecData, compositionEntry: CompositionEntry, compositionQueryOptions?: CompositionQueryOptions, urlPatternContext?: {
649
+ matchResult: ReturnType<typeof matchCompositionUrl> | undefined;
650
+ }, searchParams?: URLSearchParams) => Promise<void>;
651
+ getSeoMetadata: (ui: _contentstack_studio_internal.Node, specData?: _contentstack_studio_registry.StudioSpecData) => SeoMetadata | null;
646
652
  };
647
653
  public: {
648
654
  fetchCompositionData: (queryOptions: CompositionQueryForSSRInput, options?: CompositionQueryOptions) => Promise<StudioComponentSpecOptions>;
@@ -907,6 +913,14 @@ declare const SECTION_COMPOSITIONS_KEY = "section_compositions";
907
913
  declare const TEMPLATE_FULL_ENTRY_KEY = "template_full_entry";
908
914
  declare const setTemplateEntryInDS: (dataSources: Record<string, any>, entry: unknown) => void;
909
915
  declare const setStaticEntryInDS: (dataSources: Record<string, any>, ct_uid: string, _entries: unknown) => void;
916
+ /**
917
+ * Counterpart to setStaticEntryInDS: drop a single resolved additional entry
918
+ * from the contentstack data source bucket. Called when the author removes an
919
+ * entry so the pruned bucket replaces the stale one on the next UPDATE_SPEC_DATA
920
+ * push (which merges at the dataSources level); without it the removed entry's
921
+ * data lingers and keeps rendering.
922
+ */
923
+ declare const removeStaticEntryFromDS: (dataSources: Record<string, any>, ct_uid: string, uid: string) => void;
910
924
  declare const batchFetchEntries: (sdk: StackSDK, entries: ICSEntryReference[]) => Promise<[string, CompositionEntry[]][]>;
911
925
  declare const getBindingStringForCS: (binding: BindingType) => string;
912
926
  type EntriesResponse<T> = {
@@ -1024,6 +1038,20 @@ declare class RendererModeUtil {
1024
1038
  */
1025
1039
  getMode(compositionUid: string): "preview" | "edit" | "show_edit_button";
1026
1040
  }
1041
+ /**
1042
+ * Module-level mode util backed by `window.location.search` (the browser URL).
1043
+ *
1044
+ * SSR CAUTION: this reads `window`, which does not exist on the server, so on the server
1045
+ * every method returns its production default (e.g. `isInsideStudioFrame()` -> false) for
1046
+ * ALL requests. It is correct ONLY in browser-only code (the editor render, hooks,
1047
+ * INIT_STUDIO). In server-reachable fetch code (studio-client's spec-fetch path) do NOT use
1048
+ * this: the answer is wrong on the server, and a single shared singleton cannot represent
1049
+ * per-request state across concurrent SSR requests anyway. There, use the request-scoped
1050
+ * helpers in `sdk.ts` (`isInStudio` / `isEditorFetch` / `readStudioParam`, built on
1051
+ * `getRequestSearchParams`), which read the forwarded request query on the server and fall
1052
+ * back to `window` on the client. See COMS-1554 for the AsyncLocalStorage proposal that would
1053
+ * remove this split and make this util correct everywhere.
1054
+ */
1027
1055
  declare const clientRendererModeUtil: RendererModeUtil;
1028
1056
  declare const serializeComputedStyles: (computedStyle: CSSStyleDeclaration) => Record<string, string>;
1029
1057
 
@@ -1104,40 +1132,201 @@ interface EmittedEvents {
1104
1132
 
1105
1133
  declare const composableStudioEventEmitter: EventEmitter<EmittedEvents, any>;
1106
1134
 
1135
+ interface EmbeddedEntryRenderArgs {
1136
+ entryUid: string;
1137
+ contentTypeUid: string;
1138
+ displayType: string;
1139
+ title: string;
1140
+ /** Full resolved entry object — every field the delivery API returned. */
1141
+ entry: ResolvedEmbeddedEntry;
1142
+ }
1107
1143
  /**
1108
- * Registers a config for JSON RTE
1109
- * @param config - The config to register. This should have the following format:
1110
- * {
1111
- * customElementTypes: {
1112
- * [elementName]: {
1113
- * parse: (node: any) => any,
1114
- * render: (node: any) => any,
1115
- * },
1116
- * },
1117
- * }
1118
- * For more details, check the docs here: https://github.com/contentstack/json-rte-serializer/blob/main/README.md#custom-element-types
1119
- * @throws If the config is not provided
1144
+ * Args passed to the user-registered `embeddedAsset` renderer.
1145
+ *
1146
+ * Asset metadata travels inline in the RTE markup — no fetch needed:
1147
+ * HTML RTE: `<figure class="embedded-asset" data-sys-asset-uid="…"
1148
+ * data-sys-asset-filelink="…" data-sys-asset-contenttype="…"
1149
+ * data-sys-asset-filename="…" data-sys-asset-alt="…"
1150
+ * sys-style-type="display"></figure>`
1151
+ * JSON RTE: `{ type:"reference", attrs:{ type:"asset", "asset-uid":"…",
1152
+ * "asset-link":"…", "asset-type":"image/png", "asset-name":"…",
1153
+ * alt:"…", "display-type":"display" } }`
1154
+ */
1155
+ interface EmbeddedAssetRenderArgs {
1156
+ assetUid: string;
1157
+ /** Direct CDN URL — use as `<img src>` / `<video src>` etc. */
1158
+ url: string;
1159
+ /** MIME type, e.g. `image/png`, `video/mp4`. Drives default renderer's tag choice. */
1160
+ contentType: string;
1161
+ /** Original filename, useful for download links. */
1162
+ filename: string;
1163
+ /** Alt text from the RTE editor — empty string when unset. */
1164
+ alt: string;
1165
+ /** Layout hint from the editor: `display` (block), `inline`, `link`, etc. */
1166
+ displayType: string;
1167
+ }
1168
+ /**
1169
+ * Default asset renderer used when the user hasn't registered an
1170
+ * `embeddedAsset` callback via `registerRTERenderer`. Branches on MIME type:
1171
+ * image/* → `<img src>` (with alt + class for styling hooks)
1172
+ * video/* → `<video src controls>`
1173
+ * audio/* → `<audio src controls>`
1174
+ * other → `<a href download>` fallback link
1175
+ *
1176
+ * Unsafe URL schemes (`javascript:`, `vbscript:`, non-image `data:` etc.) are
1177
+ * blocked and render as plain text placeholder to prevent XSS.
1178
+ */
1179
+ declare function defaultAssetRender({ assetUid, url, contentType, filename, alt, }: EmbeddedAssetRenderArgs): string;
1180
+ interface EmbeddedEntryConversionOptions {
1181
+ /**
1182
+ * Pre-resolved entry map. Keys are entry UIDs. Each value is the full entry
1183
+ * object (any fields). The `title` field is used as the display label unless
1184
+ * your `render` function overrides it.
1185
+ *
1186
+ * When omitted the SDK fetches entries automatically via `fetchEmbeddedEntries`.
1187
+ */
1188
+ entries?: Record<string, ResolvedEmbeddedEntry>;
1189
+ render?: (args: EmbeddedEntryRenderArgs) => string;
1190
+ /**
1191
+ * Custom element type renderers for JSON RTE plugins (e.g. table, social-embed,
1192
+ * code-block). Merged with the built-in `reference` handler. Keyed by the
1193
+ * node `type` value produced by the RTE plugin.
1194
+ *
1195
+ * @example
1196
+ * createEmbeddedEntryConversion({
1197
+ * customElementTypes: {
1198
+ * table: (attrs, child) => `<table>${child}</table>`,
1199
+ * "social-embed": (attrs, child, block) =>
1200
+ * `<div class="embed" data-url="${block?.attrs?.url ?? ""}">${child}</div>`,
1201
+ * },
1202
+ * });
1203
+ */
1204
+ customElementTypes?: IJsonToHtmlOptions["customElementTypes"];
1205
+ }
1206
+ interface ResolvedEmbeddedEntry {
1207
+ uid: string;
1208
+ title?: string;
1209
+ _content_type_uid?: string;
1210
+ [key: string]: any;
1211
+ }
1212
+ /** Walk a JSON RTE doc and collect all entry-reference {entryUid, contentTypeUid} pairs. */
1213
+ declare function extractJsonRteRefs(node: any): Array<{
1214
+ entryUid: string;
1215
+ contentTypeUid: string;
1216
+ }>;
1217
+ /** Extract {entryUid, contentTypeUid} pairs from an HTML RTE string via regex. */
1218
+ declare function extractHtmlRteRefs(html: string): Array<{
1219
+ entryUid: string;
1220
+ contentTypeUid: string;
1221
+ }>;
1222
+ /**
1223
+ * Fetch embedded entries from the registered stack SDK.
1224
+ * Groups refs by content type and issues one query per group in parallel.
1225
+ * Returns a uid→entry map.
1226
+ */
1227
+ declare function fetchEmbeddedEntries(refs: Array<{
1228
+ entryUid: string;
1229
+ contentTypeUid: string;
1230
+ }>): Promise<Record<string, ResolvedEmbeddedEntry>>;
1231
+ declare function createEmbeddedEntryConversion(options?: EmbeddedEntryConversionOptions & {
1232
+ /** Asset renderer — defaults to `defaultAssetRender` (img/video/audio/link by MIME). */
1233
+ renderAsset?: (args: EmbeddedAssetRenderArgs) => string;
1234
+ }): IJsonToHtmlOptions;
1235
+
1236
+ /**
1237
+ * Unified RTE configuration. Extends the JSON RTE serializer options with
1238
+ * an `embeddedEntry` renderer so users configure everything in one call.
1239
+ *
1120
1240
  * @example
1121
- * registerJSONRTE({
1241
+ * registerRTERenderer({
1242
+ * // Embedded entry rendering
1243
+ * embeddedEntry: ({ entry, contentTypeUid, displayType }) => {
1244
+ * if (displayType === "block") return `<h1>${entry.title}</h1>`;
1245
+ * return `<span>${entry.title}</span>`;
1246
+ * },
1247
+ * // Custom JSON RTE node types
1248
+ * customElementTypes: {
1249
+ * "code-block": (attrs, child) => `<pre><code>${child}</code></pre>`,
1250
+ * },
1251
+ * allowNonStandardTypes: true,
1252
+ * });
1253
+ */
1254
+ interface RTEConfig extends IJsonToHtmlOptions {
1255
+ embeddedEntry?: (args: EmbeddedEntryRenderArgs) => string;
1256
+ /**
1257
+ * Renderer for embedded ASSETS in RTE fields (images / videos / audio /
1258
+ * file links inserted via the editor's "Insert Asset" button). Both JSON
1259
+ * RTE (`{ attrs.type: "asset" }`) and HTML RTE (`<figure
1260
+ * class="embedded-asset" data-sys-asset-uid="…">`) paths invoke this.
1261
+ *
1262
+ * Omit to use the built-in default (img for image/*, video/audio with
1263
+ * controls for those MIMEs, `<a download>` fallback otherwise).
1264
+ */
1265
+ embeddedAsset?: (args: EmbeddedAssetRenderArgs) => string;
1266
+ }
1267
+ /**
1268
+ * Unified RTE registration. Covers both embedded entry rendering and custom
1269
+ * JSON RTE node types in a single call. Replaces the full config on each call.
1270
+ *
1271
+ * @example — embedded entries only
1272
+ * registerRTERenderer({
1273
+ * embeddedEntry: ({ entry, contentTypeUid, displayType }) => {
1274
+ * if (displayType === "block") return `<div><h3>${entry.full_name ?? entry.title}</h3></div>`;
1275
+ * if (displayType === "link") return `<a href="${entry.url}">${entry.title}</a>`;
1276
+ * return `<span>${entry.title}</span>`;
1277
+ * },
1278
+ * });
1279
+ *
1280
+ * @example — JSON RTE custom node types only
1281
+ * registerRTERenderer({
1282
+ * customElementTypes: {
1283
+ * "code-block": (attrs, child) => `<pre><code>${child}</code></pre>`,
1284
+ * "my-table": (attrs, child) => `<table>${child}</table>`,
1285
+ * },
1286
+ * allowNonStandardTypes: true,
1287
+ * });
1288
+ *
1289
+ * @example — both together
1290
+ * registerRTERenderer({
1291
+ * embeddedEntry: ({ entry, contentTypeUid, displayType }) => {
1292
+ * const label = entry.full_name ?? entry.title ?? entry.uid;
1293
+ * if (displayType === "block") return `<div><h1>${label}</h1><p>${entry.short_bio ?? ""}</p></div>`;
1294
+ * if (displayType === "link") return `<a href="${entry.url ?? "#"}">${label}</a>`;
1295
+ * return `<span>${label}</span>`;
1296
+ * },
1122
1297
  * customElementTypes: {
1123
- * myComponent: {
1124
- * parse: (node) => node,
1125
- * render: (node) => (
1126
- * <div>
1127
- * <h3>My Component</h3>
1128
- * <p>{node.children[0].text}</p>
1129
- * </div>
1130
- * ),
1131
- * },
1298
+ * "code-block": (attrs, child) => `<pre><code>${child}</code></pre>`,
1132
1299
  * },
1133
1300
  * });
1134
1301
  */
1302
+ declare function registerRTERenderer(config: RTEConfig): void;
1303
+ /**
1304
+ * @deprecated Use `registerRTERenderer` instead. Preserves any previously
1305
+ * registered `embeddedEntry` / `embeddedAsset` renderers; only replaces the
1306
+ * JSON RTE serializer options.
1307
+ */
1135
1308
  declare function registerJSONRTE(config: IJsonToHtmlOptions): void;
1136
1309
  /**
1137
- * Gets the current config for JSON RTE
1138
- * @returns The current config for JSON RTE
1310
+ * @deprecated Use `registerRTERenderer` instead. Registers embedded entry
1311
+ * renderer only — does not clear existing `customElementTypes` or `embeddedAsset`.
1312
+ */
1313
+ declare function registerEmbeddedEntryRenderer(render: (args: EmbeddedEntryRenderArgs) => string): void;
1314
+ /**
1315
+ * Returns the current JSON RTE serializer options (without embeddedEntry / embeddedAsset).
1316
+ * Used internally by the RichText / CollapsibleText hooks.
1139
1317
  */
1140
1318
  declare function getJSONRTE(): IJsonToHtmlOptions;
1319
+ /**
1320
+ * Returns the registered embedded entry renderer, or null if none registered.
1321
+ * Used internally by the RichText / CollapsibleText hooks.
1322
+ */
1323
+ declare function getEmbeddedEntryRenderer(): ((args: EmbeddedEntryRenderArgs) => string) | null;
1324
+ /**
1325
+ * Returns the registered embedded asset renderer, or null if none registered.
1326
+ * Used internally by the RichText / CollapsibleText hooks. When null, the
1327
+ * hook falls back to `defaultAssetRender` so canvas never shows blank assets.
1328
+ */
1329
+ declare function getEmbeddedAssetRenderer(): ((args: EmbeddedAssetRenderArgs) => string) | null;
1141
1330
 
1142
1331
  declare const compositionSaveEventListener: () => {
1143
1332
  unregister: () => void;
@@ -1348,5 +1537,5 @@ interface MatchCompositionOptions {
1348
1537
  */
1349
1538
  declare function matchCompositionUrl(requestUrl: string, compositionUrl: string, composable_uid: string, options?: MatchCompositionOptions): PatternMatchResult;
1350
1539
 
1351
- export { BreakpointManager, COMPOSABLE_DATA_ATTRIBUTES, COMPOSABLE_STUDIO_EMITTED_EVENTS, COMPOSITION_PLACEMENT_OPTIONS, COMPOSITION_PREVIEW_URL_SOURCES, COMPOSITION_PREVIEW_URL_SOURCES_VALUES, ComposableStudioError, ComposableStudioErrors, DEFAULT_BREAKPOINTS, DEFAULT_COMPOSITION_PREVIEW_URL_SOURCE, EDGE_PADDING, ELEMENT_TO_NODE, ExpressionResolver, GOOGLE_FONT_API, INCLUDE_DEPTH_COUNT, MAX_SCROLL_SPEED, NODE_TO_ELEMENT, NODE_TO_PARENT, NODE_TO_PATH_NODE, QueryExecutor, RendererMode, RendererModeUtil, SCHEMA_VERSION, SCROLL_INTERVAL, SDK_VERSION, SECTION_COMPOSITIONS_KEY, TEMPLATE_FULL_ENTRY_KEY, URL_PATTERN_DATE_VARIABLES, URL_PATTERN_METADATA_FIELDS, URL_PATTERN_METADATA_FIELDS_VALUES, URL_PATTERN_VARIABLE_TYPES, addBreakpointEventListeners, addContextMenuEventListeners, addHighlightNodeEventListeners, addHighlightSpacingEventListeners, addUrlChangeListeners, analyzeMultipleSpecs, analyzeUsedComponents, applyOperation, batchFetchEntries, buildTemplateQuery, buildUrlMetadataQueryObject, calculateDynamicSpeed, clientRendererModeUtil, closeHiddenElementNotification, compileUrlPattern, composableStudioEventEmitter, compositionSaveEventListener, computePatternSpecificity, createClassNameUid, studioSdk as default, dndEventListener, dndManager, entriesFromResponse, evaluateCondition, findNearestBuilderNode, findNearestSlotNode, findPath, findPathForElement, getBindingStringForCS, getComponentUsageStats, getComposableElement, getComputedStyles, getDefaultConfig, getHitboxDetails, getHitboxDirection, getJSONRTE, getNodeScreenshotEvent, getScrollableParent, handleOnScroll, handleResize, hasSlotDropzone, hiddenElementNotificationEventEmitter, highlightNodeManager, isBrowser, isCompositionBeingEdited, isInsideIframe, isInsideVisualBuilderFrame, isModKey, loadGoogleFont, matchCompositionUrl, matchUrlPattern, onlyParmasGenerator, openHiddenElementNotification, parseStringValue, parseUrlMetadata, preProcessStaticValues, queryParam, rankUrlMatches, registerJSONRTE, resolveByUrlSource, serializeComputedStyles, serializeEvent, setStaticEntryInDS, setTemplateEntryInDS, shouldExtractTaxonomies, shouldUseUrlMetadataPath, specUsesComponent, studioSdk, toggleNodeVisible, updateStyleOnStyleNodeChange };
1352
- export type { ClientEditableNodeInternalAttributes, ClientPreviewNodeInternalAttributes, ComposableStudioErrorDetails, ComposableStudioLightSdk, CompositionEntry, CompositionEntryIncompleteUi, CompositionFetcher, CompositionPlacement, CompositionPreviewUrlSource, CompositionPreviewUrlSourceValues, CompositionQueryForSSR, CompositionQueryForSSRInput, CompositionQueryOptions, CompositionUrlMetadata, CompositionUrlMetadataSerialized, CompositionUrlQueries, Config, ConnectedEntryResult, DateVariableKey, EmittedEvents, ExtractedUrlPatternVariables, ExtractedUrlVariables, FetchCompositionContext, FetchTemplateEntryContext, FieldValue, FontVariants, GoogleFont, HiddenElementNotificationHandler, LightConfig, LightweightCompositionEntry, MetaProp, ParsedStringResult, PatternMatchResult, QueryExecutionOptions, QueryResult, QuerySpec, QueryState, RankingResult, ReferenceFieldValue, RenderableCompositionEntry, ResolvedQueryOptions, RuntimeContext, SearchQueryInput, SectionCompositionEntry, SeoMetadata, StudioComponentFetchOptions, StudioComponentSpecOptions, StudioSdk, StudioSpec, SymbolEntry, TemplateEntryFetcher, TemplateQueryContext, TroubleshootingInfo, URLSearchParamsString, UrlMatchDiagnostic, UrlMetadataQueryMode, UrlPatternMetadataField, UrlPatternMetadataFieldValue, UserConfig };
1540
+ export { BreakpointManager, COMPOSABLE_DATA_ATTRIBUTES, COMPOSABLE_STUDIO_EMITTED_EVENTS, COMPOSITION_PLACEMENT_OPTIONS, COMPOSITION_PREVIEW_URL_SOURCES, COMPOSITION_PREVIEW_URL_SOURCES_VALUES, ComposableStudioError, ComposableStudioErrors, DEFAULT_BREAKPOINTS, DEFAULT_COMPOSITION_PREVIEW_URL_SOURCE, EDGE_PADDING, ELEMENT_TO_NODE, ExpressionResolver, GOOGLE_FONT_API, INCLUDE_DEPTH_COUNT, MAX_SCROLL_SPEED, NODE_TO_ELEMENT, NODE_TO_PARENT, NODE_TO_PATH_NODE, QueryExecutor, RendererMode, RendererModeUtil, SCHEMA_VERSION, SCROLL_INTERVAL, SDK_VERSION, SECTION_COMPOSITIONS_KEY, TEMPLATE_FULL_ENTRY_KEY, URL_PATTERN_DATE_VARIABLES, URL_PATTERN_METADATA_FIELDS, URL_PATTERN_METADATA_FIELDS_VALUES, URL_PATTERN_VARIABLE_TYPES, addBreakpointEventListeners, addContextMenuEventListeners, addHighlightNodeEventListeners, addHighlightSpacingEventListeners, addUrlChangeListeners, analyzeMultipleSpecs, analyzeUsedComponents, applyOperation, batchFetchEntries, buildTemplateQuery, buildUrlMetadataQueryObject, calculateDynamicSpeed, clientRendererModeUtil, closeHiddenElementNotification, compileUrlPattern, composableStudioEventEmitter, compositionSaveEventListener, computePatternSpecificity, createClassNameUid, createEmbeddedEntryConversion, studioSdk as default, defaultAssetRender, dndEventListener, dndManager, entriesFromResponse, evaluateCondition, extractHtmlRteRefs, extractJsonRteRefs, fetchEmbeddedEntries, findNearestBuilderNode, findNearestSlotNode, findPath, findPathForElement, getBindingStringForCS, getComponentUsageStats, getComposableElement, getComputedStyles, getDefaultConfig, getEmbeddedAssetRenderer, getEmbeddedEntryRenderer, getHitboxDetails, getHitboxDirection, getJSONRTE, getNodeScreenshotEvent, getScrollableParent, handleOnScroll, handleResize, hasSlotDropzone, hiddenElementNotificationEventEmitter, highlightNodeManager, isBrowser, isCompositionBeingEdited, isInsideIframe, isInsideVisualBuilderFrame, isModKey, loadGoogleFont, matchCompositionUrl, matchUrlPattern, onlyParmasGenerator, openHiddenElementNotification, parseStringValue, parseUrlMetadata, preProcessStaticValues, queryParam, rankUrlMatches, registerEmbeddedEntryRenderer, registerJSONRTE, registerRTERenderer, removeStaticEntryFromDS, resolveByUrlSource, serializeComputedStyles, serializeEvent, setStaticEntryInDS, setTemplateEntryInDS, shouldExtractTaxonomies, shouldUseUrlMetadataPath, specUsesComponent, studioSdk, toggleNodeVisible, updateStyleOnStyleNodeChange };
1541
+ export type { ClientEditableNodeInternalAttributes, ClientPreviewNodeInternalAttributes, ComposableStudioErrorDetails, ComposableStudioLightSdk, CompositionEntry, CompositionEntryIncompleteUi, CompositionFetcher, CompositionPlacement, CompositionPreviewUrlSource, CompositionPreviewUrlSourceValues, CompositionQueryForSSR, CompositionQueryForSSRInput, CompositionQueryOptions, CompositionUrlMetadata, CompositionUrlMetadataSerialized, CompositionUrlQueries, Config, ConnectedEntryResult, DateVariableKey, EmbeddedAssetRenderArgs, EmbeddedEntryConversionOptions, EmbeddedEntryRenderArgs, EmittedEvents, ExtractedUrlPatternVariables, ExtractedUrlVariables, FetchCompositionContext, FetchTemplateEntryContext, FieldValue, FontVariants, GoogleFont, HiddenElementNotificationHandler, LightConfig, LightweightCompositionEntry, MetaProp, ParsedStringResult, PatternMatchResult, QueryExecutionOptions, QueryResult, QuerySpec, QueryState, RTEConfig, RankingResult, ReferenceFieldValue, RenderableCompositionEntry, ResolvedEmbeddedEntry, ResolvedQueryOptions, RuntimeContext, SearchQueryInput, SectionCompositionEntry, SeoMetadata, StudioComponentFetchOptions, StudioComponentSpecOptions, StudioSdk, StudioSpec, SymbolEntry, TemplateEntryFetcher, TemplateQueryContext, TroubleshootingInfo, URLSearchParamsString, UrlMatchDiagnostic, UrlMetadataQueryMode, UrlPatternMetadataField, UrlPatternMetadataFieldValue, UserConfig };
package/dist/index.js CHANGED
@@ -21,7 +21,7 @@ export { COMPOSABLE_DATA_ATTRIBUTES, INCLUDE_DEPTH_COUNT, SCHEMA_VERSION, SDK_VE
21
21
  export { applyOperation, findPath, findPathForElement } from './utils/editor-utils.js';
22
22
  export { isCompositionBeingEdited } from './utils/is-composition-being-edited.js';
23
23
  export { onlyParmasGenerator, queryParam } from './utils/query-param.js';
24
- export { SECTION_COMPOSITIONS_KEY, TEMPLATE_FULL_ENTRY_KEY, batchFetchEntries, entriesFromResponse, getBindingStringForCS, setStaticEntryInDS, setTemplateEntryInDS } from './utils/sdk.js';
24
+ export { SECTION_COMPOSITIONS_KEY, TEMPLATE_FULL_ENTRY_KEY, batchFetchEntries, entriesFromResponse, getBindingStringForCS, removeStaticEntryFromDS, setStaticEntryInDS, setTemplateEntryInDS } from './utils/sdk.js';
25
25
  export { isInsideVisualBuilderFrame } from './utils/is-inside-visual-builder-frame.js';
26
26
  export { isInsideIframe } from './utils/is-inside-iframe.js';
27
27
  export { ComposableStudioError, ComposableStudioErrors } from './utils/composable-studio-error.js';
@@ -34,7 +34,7 @@ export { createClassNameUid } from './design/create-class-name-uid.js';
34
34
  export { updateStyleOnStyleNodeChange } from './design/handle-active-style-change.js';
35
35
  export { composableStudioEventEmitter } from './emitted-events/event-emitter.js';
36
36
  export { COMPOSABLE_STUDIO_EMITTED_EVENTS } from './emitted-events/events.constant.js';
37
- export { getJSONRTE, registerJSONRTE } from './json-rte-registry/index.js';
37
+ export { getEmbeddedAssetRenderer, getEmbeddedEntryRenderer, getJSONRTE, registerEmbeddedEntryRenderer, registerJSONRTE, registerRTERenderer } from './json-rte-registry/index.js';
38
38
  export { compositionSaveEventListener } from './visual-builder/composition-save-event.js';
39
39
  export { closeHiddenElementNotification, hiddenElementNotificationEventEmitter, openHiddenElementNotification } from './hidden-element-notification/hidden-element-notification-event.js';
40
40
  export { getNodeScreenshotEvent } from './get-active-node-screenshot/get-node-screenshot-event.js';
@@ -47,6 +47,7 @@ export { shouldUseUrlMetadataPath } from './url-metadata/shouldUseUrlMetadataPat
47
47
  export { COMPOSITION_PREVIEW_URL_SOURCES, COMPOSITION_PREVIEW_URL_SOURCES_VALUES, DEFAULT_COMPOSITION_PREVIEW_URL_SOURCE, URL_PATTERN_DATE_VARIABLES, URL_PATTERN_METADATA_FIELDS, URL_PATTERN_METADATA_FIELDS_VALUES, URL_PATTERN_VARIABLE_TYPES } from './url-metadata/types.js';
48
48
  export { compileUrlPattern, computePatternSpecificity, matchCompositionUrl, matchUrlPattern } from './url-metadata/url-pattern-matcher.js';
49
49
  export { IS_BROWSER } from '@contentstack/studio-messenger';
50
+ export { createEmbeddedEntryConversion, defaultAssetRender, extractHtmlRteRefs, extractJsonRteRefs, fetchEmbeddedEntries } from './json-rte-registry/embedded-entry-conversion.js';
50
51
 
51
52
  // STUDIO SDK
52
53
 
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;"}
@@ -0,0 +1,186 @@
1
+ import { getStackSdkInstance } from './stack-sdk-store.js';
2
+
3
+ /**
4
+ * Whitelist URL schemes for asset rendering. Blocks `javascript:`, `data:` (except
5
+ * `data:image/*` for inline images), `vbscript:`, etc. Allows http(s)/protocol-relative.
6
+ */
7
+ function isSafeAssetUrl(url) {
8
+ if (!url)
9
+ return false;
10
+ const trimmed = url.trim().toLowerCase();
11
+ if (trimmed.startsWith("http://") || trimmed.startsWith("https://"))
12
+ return true;
13
+ if (trimmed.startsWith("//") || trimmed.startsWith("/"))
14
+ return true;
15
+ if (trimmed.startsWith("data:image/"))
16
+ return true;
17
+ return false;
18
+ }
19
+ /**
20
+ * Default asset renderer used when the user hasn't registered an
21
+ * `embeddedAsset` callback via `registerRTERenderer`. Branches on MIME type:
22
+ * image/* → `<img src>` (with alt + class for styling hooks)
23
+ * video/* → `<video src controls>`
24
+ * audio/* → `<audio src controls>`
25
+ * other → `<a href download>` fallback link
26
+ *
27
+ * Unsafe URL schemes (`javascript:`, `vbscript:`, non-image `data:` etc.) are
28
+ * blocked and render as plain text placeholder to prevent XSS.
29
+ */
30
+ function defaultAssetRender({ assetUid, url, contentType, filename, alt, }) {
31
+ const safeAlt = escapeHtml(alt || filename || "");
32
+ if (!isSafeAssetUrl(url)) {
33
+ return `<span class="cs-embedded-asset-blocked" data-asset-uid="${escapeHtml(assetUid)}">${safeAlt || escapeHtml(filename) || escapeHtml(assetUid)}</span>`;
34
+ }
35
+ const safeUrl = escapeHtml(url);
36
+ const dataAttrs = `class="cs-embedded-asset" data-asset-uid="${escapeHtml(assetUid)}" data-content-type="${escapeHtml(contentType)}"`;
37
+ if (contentType.startsWith("image/")) {
38
+ return `<img src="${safeUrl}" alt="${safeAlt}" ${dataAttrs} />`;
39
+ }
40
+ if (contentType.startsWith("video/")) {
41
+ return `<video src="${safeUrl}" controls ${dataAttrs}></video>`;
42
+ }
43
+ if (contentType.startsWith("audio/")) {
44
+ return `<audio src="${safeUrl}" controls ${dataAttrs}></audio>`;
45
+ }
46
+ return `<a href="${safeUrl}" download="${escapeHtml(filename)}" ${dataAttrs}>${safeAlt || escapeHtml(filename) || escapeHtml(assetUid)}</a>`;
47
+ }
48
+ function escapeHtml(str) {
49
+ return str
50
+ .replace(/&/g, "&amp;")
51
+ .replace(/</g, "&lt;")
52
+ .replace(/>/g, "&gt;")
53
+ .replace(/"/g, "&quot;")
54
+ .replace(/'/g, "&#39;");
55
+ }
56
+ function defaultRender({ entryUid, contentTypeUid, displayType, title, }) {
57
+ return `<span class="cs-embedded-entry" data-entry-uid="${entryUid}" data-content-type-uid="${contentTypeUid}" data-display-type="${displayType}">${escapeHtml(title)}</span>`;
58
+ }
59
+ /** Walk a JSON RTE doc and collect all entry-reference {entryUid, contentTypeUid} pairs. */
60
+ function extractJsonRteRefs(node) {
61
+ const refs = [];
62
+ if (!node || typeof node !== "object")
63
+ return refs;
64
+ if (node.type === "reference" && node.attrs?.type === "entry") {
65
+ const entryUid = node.attrs?.["entry-uid"] ?? "";
66
+ const contentTypeUid = node.attrs?.["content-type-uid"] ?? "";
67
+ if (entryUid && contentTypeUid)
68
+ refs.push({ entryUid, contentTypeUid });
69
+ }
70
+ if (Array.isArray(node.children)) {
71
+ for (const child of node.children)
72
+ refs.push(...extractJsonRteRefs(child));
73
+ }
74
+ return refs;
75
+ }
76
+ /** Extract {entryUid, contentTypeUid} pairs from an HTML RTE string via regex. */
77
+ function extractHtmlRteRefs(html) {
78
+ const refs = [];
79
+ const seen = new Set();
80
+ // Match opening tag (any case) that has data-sys-entry-uid attribute.
81
+ // [^>]* is sufficient — HTML5 forbids unescaped '>' in attribute values.
82
+ const re = /<[a-zA-Z]+[^>]*data-sys-entry-uid="([^"]+)"[^>]*>/g;
83
+ let m;
84
+ while ((m = re.exec(html)) !== null) {
85
+ const tag = m[0];
86
+ const entryUid = m[1];
87
+ const ctMatch = /data-sys-content-type-uid="([^"]+)"/.exec(tag);
88
+ const contentTypeUid = ctMatch ? ctMatch[1] : "";
89
+ // Key dedup on entryUid+contentTypeUid pair so the same UID across different
90
+ // CTs (rare but possible) doesn't collapse to a single fetch group.
91
+ const key = `${entryUid}::${contentTypeUid}`;
92
+ if (entryUid && contentTypeUid && !seen.has(key)) {
93
+ seen.add(key);
94
+ refs.push({ entryUid, contentTypeUid });
95
+ }
96
+ }
97
+ return refs;
98
+ }
99
+ /**
100
+ * Fetch embedded entries from the registered stack SDK.
101
+ * Groups refs by content type and issues one query per group in parallel.
102
+ * Returns a uid→entry map.
103
+ */
104
+ async function fetchEmbeddedEntries(refs) {
105
+ const sdk = getStackSdkInstance();
106
+ if (!sdk || refs.length === 0)
107
+ return {};
108
+ // Group by content type
109
+ const byCtUid = new Map();
110
+ for (const { entryUid, contentTypeUid } of refs) {
111
+ if (!byCtUid.has(contentTypeUid))
112
+ byCtUid.set(contentTypeUid, []);
113
+ byCtUid.get(contentTypeUid).push(entryUid);
114
+ }
115
+ const map = {};
116
+ await Promise.all(Array.from(byCtUid.entries()).map(async ([ctUid, uids]) => {
117
+ try {
118
+ const query = sdk.ctQuery(ctUid).containedIn("uid", uids);
119
+ const result = await query.find();
120
+ // JS SDK: [[entry, ...], count] TS SDK: { entries: [...], count: n }
121
+ const entries = Array.isArray(result)
122
+ ? (result[0] ?? [])
123
+ : (result?.entries ?? []);
124
+ for (const entry of entries) {
125
+ if (entry?.uid)
126
+ map[entry.uid] = entry;
127
+ }
128
+ }
129
+ catch (err) {
130
+ console.warn(`[studio-sdk] fetchEmbeddedEntries: failed to fetch entries for "${ctUid}"`, err);
131
+ }
132
+ }));
133
+ return map;
134
+ }
135
+ function createEmbeddedEntryConversion(options = {}) {
136
+ const { entries = {}, render = defaultRender, renderAsset = defaultAssetRender, customElementTypes = {}, } = options;
137
+ return {
138
+ customElementTypes: {
139
+ ...customElementTypes,
140
+ reference: (_attrs, child, jsonBlock) => {
141
+ const refType = jsonBlock?.attrs?.type;
142
+ if (refType === "entry") {
143
+ const entryUid = jsonBlock?.attrs?.["entry-uid"] ?? "";
144
+ const contentTypeUid = jsonBlock?.attrs?.["content-type-uid"] ?? "";
145
+ const displayType = jsonBlock?.attrs?.["display-type"] ?? "inline";
146
+ const storedText = Array.isArray(jsonBlock?.children)
147
+ ? (jsonBlock.children[0]?.text ?? "")
148
+ : "";
149
+ const resolvedEntry = entries[entryUid] ?? {
150
+ uid: entryUid,
151
+ };
152
+ const title = (resolvedEntry.title ?? storedText) || entryUid;
153
+ return render({
154
+ entryUid,
155
+ contentTypeUid,
156
+ displayType,
157
+ title,
158
+ entry: resolvedEntry,
159
+ });
160
+ }
161
+ if (refType === "asset") {
162
+ const assetUid = jsonBlock?.attrs?.["asset-uid"] ?? "";
163
+ const url = jsonBlock?.attrs?.["asset-link"] ?? "";
164
+ const contentType = jsonBlock?.attrs?.["asset-type"] ?? "";
165
+ const filename = jsonBlock?.attrs?.["asset-name"] ?? "";
166
+ const alt = jsonBlock?.attrs?.alt ?? jsonBlock?.attrs?.["asset-alt"] ?? "";
167
+ const displayType = jsonBlock?.attrs?.["display-type"] ?? "display";
168
+ if (!url && !assetUid)
169
+ return child;
170
+ return renderAsset({
171
+ assetUid,
172
+ url,
173
+ contentType,
174
+ filename,
175
+ alt,
176
+ displayType,
177
+ });
178
+ }
179
+ return child;
180
+ },
181
+ },
182
+ };
183
+ }
184
+
185
+ export { createEmbeddedEntryConversion, defaultAssetRender, extractHtmlRteRefs, extractJsonRteRefs, fetchEmbeddedEntries };
186
+ //# sourceMappingURL=embedded-entry-conversion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embedded-entry-conversion.js","sources":["../../src/json-rte-registry/embedded-entry-conversion.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAsCA;;;AAGG;AACH,SAAS,cAAc,CAAC,GAAW,EAAA;AACjC,IAAA,IAAI,CAAC,GAAG;AAA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