@contentful/experiences-core 1.42.3-beta.0 → 1.42.3-dev-20250630T1524-5545f29.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/constants.d.ts +1 -2
- package/dist/constants.js +1 -2
- package/dist/constants.js.map +1 -1
- package/dist/entity/EntityStore.d.ts +0 -36
- package/dist/exports.d.ts +1 -1
- package/dist/exports.js +1 -1
- package/dist/index.js +28 -168
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/constants.d.ts
CHANGED
|
@@ -124,6 +124,5 @@ declare enum PostMessageMethods {
|
|
|
124
124
|
}
|
|
125
125
|
declare const SUPPORTED_IMAGE_FORMATS: readonly ["jpg", "png", "webp", "gif", "avif"];
|
|
126
126
|
declare const PATTERN_PROPERTY_DIVIDER = "-----";
|
|
127
|
-
declare const SIDELOADED_PREFIX = "sideloaded_";
|
|
128
127
|
|
|
129
|
-
export { ASSEMBLY_BLOCK_NODE_TYPE, ASSEMBLY_DEFAULT_CATEGORY, ASSEMBLY_NODE_TYPE, ASSEMBLY_NODE_TYPES, CF_STYLE_ATTRIBUTES, CONTENTFUL_COMPONENTS, CONTENTFUL_COMPONENT_CATEGORY, CONTENTFUL_DEFAULT_CATEGORY, DEFAULT_IMAGE_WIDTH, EMPTY_CONTAINER_HEIGHT, HYPERLINK_DEFAULT_PATTERN, INCOMING_EVENTS, INTERNAL_EVENTS, LATEST_SCHEMA_VERSION, OUTGOING_EVENTS, PATTERN_PROPERTY_DIVIDER, PostMessageMethods, SCROLL_STATES,
|
|
128
|
+
export { ASSEMBLY_BLOCK_NODE_TYPE, ASSEMBLY_DEFAULT_CATEGORY, ASSEMBLY_NODE_TYPE, ASSEMBLY_NODE_TYPES, CF_STYLE_ATTRIBUTES, CONTENTFUL_COMPONENTS, CONTENTFUL_COMPONENT_CATEGORY, CONTENTFUL_DEFAULT_CATEGORY, DEFAULT_IMAGE_WIDTH, EMPTY_CONTAINER_HEIGHT, HYPERLINK_DEFAULT_PATTERN, INCOMING_EVENTS, INTERNAL_EVENTS, LATEST_SCHEMA_VERSION, OUTGOING_EVENTS, PATTERN_PROPERTY_DIVIDER, PostMessageMethods, SCROLL_STATES, SUPPORTED_IMAGE_FORMATS, StudioCanvasMode, VISUAL_EDITOR_CONTAINER_ID, VISUAL_EDITOR_EVENTS };
|
package/dist/constants.js
CHANGED
|
@@ -167,7 +167,6 @@ var PostMessageMethods;
|
|
|
167
167
|
})(PostMessageMethods || (PostMessageMethods = {}));
|
|
168
168
|
const SUPPORTED_IMAGE_FORMATS = ['jpg', 'png', 'webp', 'gif', 'avif'];
|
|
169
169
|
const PATTERN_PROPERTY_DIVIDER = '-----';
|
|
170
|
-
const SIDELOADED_PREFIX = 'sideloaded_';
|
|
171
170
|
|
|
172
|
-
export { ASSEMBLY_BLOCK_NODE_TYPE, ASSEMBLY_DEFAULT_CATEGORY, ASSEMBLY_NODE_TYPE, ASSEMBLY_NODE_TYPES, CF_STYLE_ATTRIBUTES, CONTENTFUL_COMPONENTS, CONTENTFUL_COMPONENT_CATEGORY, CONTENTFUL_DEFAULT_CATEGORY, DEFAULT_IMAGE_WIDTH, EMPTY_CONTAINER_HEIGHT, HYPERLINK_DEFAULT_PATTERN, INCOMING_EVENTS, INTERNAL_EVENTS, LATEST_SCHEMA_VERSION, OUTGOING_EVENTS, PATTERN_PROPERTY_DIVIDER, PostMessageMethods, SCROLL_STATES,
|
|
171
|
+
export { ASSEMBLY_BLOCK_NODE_TYPE, ASSEMBLY_DEFAULT_CATEGORY, ASSEMBLY_NODE_TYPE, ASSEMBLY_NODE_TYPES, CF_STYLE_ATTRIBUTES, CONTENTFUL_COMPONENTS, CONTENTFUL_COMPONENT_CATEGORY, CONTENTFUL_DEFAULT_CATEGORY, DEFAULT_IMAGE_WIDTH, EMPTY_CONTAINER_HEIGHT, HYPERLINK_DEFAULT_PATTERN, INCOMING_EVENTS, INTERNAL_EVENTS, LATEST_SCHEMA_VERSION, OUTGOING_EVENTS, PATTERN_PROPERTY_DIVIDER, PostMessageMethods, SCROLL_STATES, SUPPORTED_IMAGE_FORMATS, StudioCanvasMode, VISUAL_EDITOR_CONTAINER_ID, VISUAL_EDITOR_EVENTS };
|
|
173
172
|
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sources":["../src/constants.ts"],"sourcesContent":["export const SCROLL_STATES = {\n Start: 'scrollStart',\n IsScrolling: 'isScrolling',\n End: 'scrollEnd',\n} as const;\n\nexport const OUTGOING_EVENTS = {\n Connected: 'connected',\n DesignTokens: 'registerDesignTokens',\n RegisteredBreakpoints: 'registeredBreakpoints',\n MouseMove: 'mouseMove',\n NewHoveredElement: 'newHoveredElement',\n ComponentSelected: 'componentSelected',\n RegisteredComponents: 'registeredComponents',\n RequestComponentTreeUpdate: 'requestComponentTreeUpdate',\n ComponentDragCanceled: 'componentDragCanceled',\n ComponentDropped: 'componentDropped',\n ComponentMoved: 'componentMoved',\n CanvasReload: 'canvasReload',\n UpdateSelectedComponentCoordinates: 'updateSelectedComponentCoordinates',\n CanvasScroll: 'canvasScrolling',\n CanvasError: 'canvasError',\n ComponentMoveStarted: 'componentMoveStarted',\n ComponentMoveEnded: 'componentMoveEnded',\n OutsideCanvasClick: 'outsideCanvasClick',\n SDKFeatures: 'sdkFeatures',\n RequestEntities: 'REQUEST_ENTITIES',\n} as const;\n\nexport const INCOMING_EVENTS = {\n RequestEditorMode: 'requestEditorMode',\n RequestReadOnlyMode: 'requestReadOnlyMode',\n ExperienceUpdated: 'componentTreeUpdated',\n ComponentDraggingChanged: 'componentDraggingChanged',\n ComponentDragCanceled: 'componentDragCanceled',\n ComponentDragStarted: 'componentDragStarted',\n ComponentDragEnded: 'componentDragEnded',\n ComponentMoveEnded: 'componentMoveEnded',\n CanvasResized: 'canvasResized',\n SelectComponent: 'selectComponent',\n HoverComponent: 'hoverComponent',\n UpdatedEntity: 'updatedEntity',\n AssembliesAdded: 'assembliesAdded',\n AssembliesRegistered: 'assembliesRegistered',\n MouseMove: 'mouseMove',\n RequestedEntities: 'REQUESTED_ENTITIES',\n} as const;\n\nexport const INTERNAL_EVENTS = {\n ComponentsRegistered: 'cfComponentsRegistered',\n VisualEditorInitialize: 'cfVisualEditorInitialize',\n} as const;\n\nexport const VISUAL_EDITOR_EVENTS = {\n Ready: 'cfVisualEditorReady',\n};\n\n/**\n * These modes are ONLY intended to be internally used within the context of\n * editing an experience inside of Contentful Studio. i.e. these modes\n * intentionally do not include preview/delivery modes.\n */\nexport enum StudioCanvasMode {\n READ_ONLY = 'readOnlyMode',\n EDITOR = 'editorMode',\n NONE = 'none',\n}\n\nexport const VISUAL_EDITOR_CONTAINER_ID = 'cf-visual-editor';\nexport const CONTENTFUL_COMPONENT_CATEGORY = 'contentful-component';\nexport const CONTENTFUL_DEFAULT_CATEGORY = 'Contentful';\n\nexport const CONTENTFUL_COMPONENTS = {\n section: {\n id: 'contentful-section',\n name: 'Section',\n },\n container: {\n id: 'contentful-container',\n name: 'Container',\n },\n columns: {\n id: 'contentful-columns',\n name: 'Columns',\n },\n singleColumn: {\n id: 'contentful-single-column',\n name: 'Column',\n },\n button: {\n id: 'contentful-button',\n name: 'Button',\n },\n heading: {\n id: 'contentful-heading',\n name: 'Heading',\n },\n image: {\n id: 'contentful-image',\n name: 'Image',\n },\n richText: {\n id: 'contentful-richText',\n name: 'Rich Text',\n },\n text: {\n id: 'contentful-text',\n name: 'Text',\n },\n divider: {\n id: 'contentful-divider',\n name: 'Divider',\n },\n carousel: {\n id: 'contentful-carousel',\n name: 'Carousel',\n },\n} as const;\n\nexport const ASSEMBLY_NODE_TYPE = 'assembly';\nexport const ASSEMBLY_DEFAULT_CATEGORY = 'Assemblies';\nexport const ASSEMBLY_BLOCK_NODE_TYPE = 'assemblyBlock';\nexport const ASSEMBLY_NODE_TYPES = [ASSEMBLY_NODE_TYPE, ASSEMBLY_BLOCK_NODE_TYPE];\nexport const LATEST_SCHEMA_VERSION = '2023-09-28';\nexport const CF_STYLE_ATTRIBUTES = [\n 'cfVisibility',\n 'cfHorizontalAlignment',\n 'cfVerticalAlignment',\n 'cfMargin',\n 'cfPadding',\n 'cfBackgroundColor',\n 'cfWidth',\n 'cfMaxWidth',\n 'cfHeight',\n 'cfImageAsset',\n 'cfImageOptions',\n 'cfBackgroundImageUrl',\n 'cfBackgroundImageOptions',\n 'cfFlexDirection',\n 'cfFlexWrap',\n 'cfFlexReverse',\n 'cfBorder',\n 'cfBorderRadius',\n 'cfGap',\n 'cfColumnSpan',\n 'cfColumnSpanLock',\n 'cfColumns',\n 'cfFontSize',\n 'cfFontWeight',\n 'cfLineHeight',\n 'cfLetterSpacing',\n 'cfTextColor',\n 'cfTextAlign',\n 'cfTextTransform',\n 'cfTextBold',\n 'cfTextItalic',\n 'cfTextUnderline',\n // For backwards compatibility\n // we need to keep those in this constant array\n // so that omit() in <VisualEditorBlock> and <CompositionBlock>\n // can filter them out and not pass as props\n 'cfBackgroundImageScaling',\n 'cfBackgroundImageAlignment',\n 'cfBackgroundImageAlignmentVertical',\n 'cfBackgroundImageAlignmentHorizontal',\n];\n\nexport const EMPTY_CONTAINER_HEIGHT = '80px';\n\nexport const HYPERLINK_DEFAULT_PATTERN = `/{locale}/{entry.fields.slug}/`;\n\nexport const DEFAULT_IMAGE_WIDTH = '500px';\n\nexport enum PostMessageMethods {\n REQUEST_ENTITIES = 'REQUEST_ENTITIES',\n REQUESTED_ENTITIES = 'REQUESTED_ENTITIES',\n}\n\nexport const SUPPORTED_IMAGE_FORMATS = ['jpg', 'png', 'webp', 'gif', 'avif'] as const;\n\nexport const PATTERN_PROPERTY_DIVIDER = '-----';\n
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../src/constants.ts"],"sourcesContent":["export const SCROLL_STATES = {\n Start: 'scrollStart',\n IsScrolling: 'isScrolling',\n End: 'scrollEnd',\n} as const;\n\nexport const OUTGOING_EVENTS = {\n Connected: 'connected',\n DesignTokens: 'registerDesignTokens',\n RegisteredBreakpoints: 'registeredBreakpoints',\n MouseMove: 'mouseMove',\n NewHoveredElement: 'newHoveredElement',\n ComponentSelected: 'componentSelected',\n RegisteredComponents: 'registeredComponents',\n RequestComponentTreeUpdate: 'requestComponentTreeUpdate',\n ComponentDragCanceled: 'componentDragCanceled',\n ComponentDropped: 'componentDropped',\n ComponentMoved: 'componentMoved',\n CanvasReload: 'canvasReload',\n UpdateSelectedComponentCoordinates: 'updateSelectedComponentCoordinates',\n CanvasScroll: 'canvasScrolling',\n CanvasError: 'canvasError',\n ComponentMoveStarted: 'componentMoveStarted',\n ComponentMoveEnded: 'componentMoveEnded',\n OutsideCanvasClick: 'outsideCanvasClick',\n SDKFeatures: 'sdkFeatures',\n RequestEntities: 'REQUEST_ENTITIES',\n} as const;\n\nexport const INCOMING_EVENTS = {\n RequestEditorMode: 'requestEditorMode',\n RequestReadOnlyMode: 'requestReadOnlyMode',\n ExperienceUpdated: 'componentTreeUpdated',\n ComponentDraggingChanged: 'componentDraggingChanged',\n ComponentDragCanceled: 'componentDragCanceled',\n ComponentDragStarted: 'componentDragStarted',\n ComponentDragEnded: 'componentDragEnded',\n ComponentMoveEnded: 'componentMoveEnded',\n CanvasResized: 'canvasResized',\n SelectComponent: 'selectComponent',\n HoverComponent: 'hoverComponent',\n UpdatedEntity: 'updatedEntity',\n AssembliesAdded: 'assembliesAdded',\n AssembliesRegistered: 'assembliesRegistered',\n MouseMove: 'mouseMove',\n RequestedEntities: 'REQUESTED_ENTITIES',\n} as const;\n\nexport const INTERNAL_EVENTS = {\n ComponentsRegistered: 'cfComponentsRegistered',\n VisualEditorInitialize: 'cfVisualEditorInitialize',\n} as const;\n\nexport const VISUAL_EDITOR_EVENTS = {\n Ready: 'cfVisualEditorReady',\n};\n\n/**\n * These modes are ONLY intended to be internally used within the context of\n * editing an experience inside of Contentful Studio. i.e. these modes\n * intentionally do not include preview/delivery modes.\n */\nexport enum StudioCanvasMode {\n READ_ONLY = 'readOnlyMode',\n EDITOR = 'editorMode',\n NONE = 'none',\n}\n\nexport const VISUAL_EDITOR_CONTAINER_ID = 'cf-visual-editor';\nexport const CONTENTFUL_COMPONENT_CATEGORY = 'contentful-component';\nexport const CONTENTFUL_DEFAULT_CATEGORY = 'Contentful';\n\nexport const CONTENTFUL_COMPONENTS = {\n section: {\n id: 'contentful-section',\n name: 'Section',\n },\n container: {\n id: 'contentful-container',\n name: 'Container',\n },\n columns: {\n id: 'contentful-columns',\n name: 'Columns',\n },\n singleColumn: {\n id: 'contentful-single-column',\n name: 'Column',\n },\n button: {\n id: 'contentful-button',\n name: 'Button',\n },\n heading: {\n id: 'contentful-heading',\n name: 'Heading',\n },\n image: {\n id: 'contentful-image',\n name: 'Image',\n },\n richText: {\n id: 'contentful-richText',\n name: 'Rich Text',\n },\n text: {\n id: 'contentful-text',\n name: 'Text',\n },\n divider: {\n id: 'contentful-divider',\n name: 'Divider',\n },\n carousel: {\n id: 'contentful-carousel',\n name: 'Carousel',\n },\n} as const;\n\nexport const ASSEMBLY_NODE_TYPE = 'assembly';\nexport const ASSEMBLY_DEFAULT_CATEGORY = 'Assemblies';\nexport const ASSEMBLY_BLOCK_NODE_TYPE = 'assemblyBlock';\nexport const ASSEMBLY_NODE_TYPES = [ASSEMBLY_NODE_TYPE, ASSEMBLY_BLOCK_NODE_TYPE];\nexport const LATEST_SCHEMA_VERSION = '2023-09-28';\nexport const CF_STYLE_ATTRIBUTES = [\n 'cfVisibility',\n 'cfHorizontalAlignment',\n 'cfVerticalAlignment',\n 'cfMargin',\n 'cfPadding',\n 'cfBackgroundColor',\n 'cfWidth',\n 'cfMaxWidth',\n 'cfHeight',\n 'cfImageAsset',\n 'cfImageOptions',\n 'cfBackgroundImageUrl',\n 'cfBackgroundImageOptions',\n 'cfFlexDirection',\n 'cfFlexWrap',\n 'cfFlexReverse',\n 'cfBorder',\n 'cfBorderRadius',\n 'cfGap',\n 'cfColumnSpan',\n 'cfColumnSpanLock',\n 'cfColumns',\n 'cfFontSize',\n 'cfFontWeight',\n 'cfLineHeight',\n 'cfLetterSpacing',\n 'cfTextColor',\n 'cfTextAlign',\n 'cfTextTransform',\n 'cfTextBold',\n 'cfTextItalic',\n 'cfTextUnderline',\n // For backwards compatibility\n // we need to keep those in this constant array\n // so that omit() in <VisualEditorBlock> and <CompositionBlock>\n // can filter them out and not pass as props\n 'cfBackgroundImageScaling',\n 'cfBackgroundImageAlignment',\n 'cfBackgroundImageAlignmentVertical',\n 'cfBackgroundImageAlignmentHorizontal',\n];\n\nexport const EMPTY_CONTAINER_HEIGHT = '80px';\n\nexport const HYPERLINK_DEFAULT_PATTERN = `/{locale}/{entry.fields.slug}/`;\n\nexport const DEFAULT_IMAGE_WIDTH = '500px';\n\nexport enum PostMessageMethods {\n REQUEST_ENTITIES = 'REQUEST_ENTITIES',\n REQUESTED_ENTITIES = 'REQUESTED_ENTITIES',\n}\n\nexport const SUPPORTED_IMAGE_FORMATS = ['jpg', 'png', 'webp', 'gif', 'avif'] as const;\n\nexport const PATTERN_PROPERTY_DIVIDER = '-----';\n"],"names":[],"mappings":"AAAa,MAAA,aAAa,GAAG;AAC3B,IAAA,KAAK,EAAE,aAAa;AACpB,IAAA,WAAW,EAAE,aAAa;AAC1B,IAAA,GAAG,EAAE,WAAW;EACP;AAEE,MAAA,eAAe,GAAG;AAC7B,IAAA,SAAS,EAAE,WAAW;AACtB,IAAA,YAAY,EAAE,sBAAsB;AACpC,IAAA,qBAAqB,EAAE,uBAAuB;AAC9C,IAAA,SAAS,EAAE,WAAW;AACtB,IAAA,iBAAiB,EAAE,mBAAmB;AACtC,IAAA,iBAAiB,EAAE,mBAAmB;AACtC,IAAA,oBAAoB,EAAE,sBAAsB;AAC5C,IAAA,0BAA0B,EAAE,4BAA4B;AACxD,IAAA,qBAAqB,EAAE,uBAAuB;AAC9C,IAAA,gBAAgB,EAAE,kBAAkB;AACpC,IAAA,cAAc,EAAE,gBAAgB;AAChC,IAAA,YAAY,E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
|
|
@@ -14,45 +14,9 @@ declare class EntityStore extends EntityStoreBase {
|
|
|
14
14
|
private _experienceEntryId;
|
|
15
15
|
private _unboundValues;
|
|
16
16
|
private _usedComponentsWithDeepReferences;
|
|
17
|
-
private _hoistedParameterDefinitions;
|
|
18
|
-
private _hoistedVariableMappings;
|
|
19
17
|
constructor(json: string);
|
|
20
18
|
constructor({ experienceEntry, entities, locale }: EntityStoreArgs);
|
|
21
|
-
private static calculateHoistedParameterDefinitions;
|
|
22
|
-
private static calculateHoistedVariableMappings;
|
|
23
19
|
getCurrentLocale(): string;
|
|
24
|
-
get hoistedVariableMappings(): Record<string, {
|
|
25
|
-
type: "ContentTypeMapping";
|
|
26
|
-
parameterId: string;
|
|
27
|
-
pathsByContentType: Record<string, {
|
|
28
|
-
path: string;
|
|
29
|
-
}>;
|
|
30
|
-
}>;
|
|
31
|
-
get hoistedParameterDefinitions(): Record<string, {
|
|
32
|
-
contentTypes: Record<string, {
|
|
33
|
-
sys: {
|
|
34
|
-
type: "Link";
|
|
35
|
-
id: string;
|
|
36
|
-
linkType: "ContentType";
|
|
37
|
-
};
|
|
38
|
-
}>;
|
|
39
|
-
defaultSource?: {
|
|
40
|
-
type: "Entry";
|
|
41
|
-
contentTypeId: string;
|
|
42
|
-
link: {
|
|
43
|
-
sys: {
|
|
44
|
-
type: "Link";
|
|
45
|
-
id: string;
|
|
46
|
-
linkType: "Entry";
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
} | undefined;
|
|
50
|
-
passToNodes?: {
|
|
51
|
-
parameterId: string;
|
|
52
|
-
nodeId: string;
|
|
53
|
-
prebindingId: string;
|
|
54
|
-
}[] | undefined;
|
|
55
|
-
}>;
|
|
56
20
|
get experienceEntryFields(): ExperienceFields | undefined;
|
|
57
21
|
get experienceEntryId(): string | undefined;
|
|
58
22
|
get schemaVersion(): "2023-09-28" | undefined;
|
package/dist/exports.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { ASSEMBLY_BLOCK_NODE_TYPE, ASSEMBLY_DEFAULT_CATEGORY, ASSEMBLY_NODE_TYPE, ASSEMBLY_NODE_TYPES, CF_STYLE_ATTRIBUTES, CONTENTFUL_COMPONENTS, CONTENTFUL_COMPONENT_CATEGORY, CONTENTFUL_DEFAULT_CATEGORY, DEFAULT_IMAGE_WIDTH, EMPTY_CONTAINER_HEIGHT, HYPERLINK_DEFAULT_PATTERN, INCOMING_EVENTS, INTERNAL_EVENTS, LATEST_SCHEMA_VERSION, OUTGOING_EVENTS, PATTERN_PROPERTY_DIVIDER, PostMessageMethods, SCROLL_STATES,
|
|
1
|
+
export { ASSEMBLY_BLOCK_NODE_TYPE, ASSEMBLY_DEFAULT_CATEGORY, ASSEMBLY_NODE_TYPE, ASSEMBLY_NODE_TYPES, CF_STYLE_ATTRIBUTES, CONTENTFUL_COMPONENTS, CONTENTFUL_COMPONENT_CATEGORY, CONTENTFUL_DEFAULT_CATEGORY, DEFAULT_IMAGE_WIDTH, EMPTY_CONTAINER_HEIGHT, HYPERLINK_DEFAULT_PATTERN, INCOMING_EVENTS, INTERNAL_EVENTS, LATEST_SCHEMA_VERSION, OUTGOING_EVENTS, PATTERN_PROPERTY_DIVIDER, PostMessageMethods, SCROLL_STATES, SUPPORTED_IMAGE_FORMATS, StudioCanvasMode, VISUAL_EDITOR_CONTAINER_ID, VISUAL_EDITOR_EVENTS } from './constants.js';
|
|
2
2
|
export { AssembliesAddedPayload, AssembliesRegisteredPayload, BackgroundImageAlignmentOption, BackgroundImageOptions, BackgroundImageScalingOption, Binding, BindingMap, BindingMapByBlockId, BoundComponentPropertyTypes, CSSProperties, CanvasErrorPayload, CanvasReloadPayload, CanvasResizedPayload, CanvasScrollPayload, ComponentBinding, ComponentDefinition, ComponentDefinitionVariable, ComponentDefinitionVariableBase, ComponentDefinitionVariableTypeMap, ComponentDefinitionVariableValidation, ComponentDragCanceledPayload, ComponentDragEndedPayload, ComponentDragStartedPayload, ComponentDraggingChangedPayload, ComponentDroppedPayload, ComponentMoveEndedPayload, ComponentMoveStartedPayload, ComponentMovedPayload, ComponentRegistration, ComponentRegistrationOptions, ComponentSelectedPayload, ConnectedPayload, ContainerStyleVariableName, Coordinates, DataSourceEntryValueType, DesignTokensDefinition, DesignTokensPayload, DesignVariableMap, DesignVariableTypes, DragWrapperProps, Experience, ExperienceEntry, ExperienceFields, ExperienceTree, ExperienceTreeNode, ExperienceUpdatedPayload, HoverComponentPayload, HoveredElement, ImageLoadingOption, ImageObjectFitOption, ImageObjectPositionOption, ImageOptions, IncomingComponentDragCanceledPayload, IncomingComponentMoveEndedPayload, IncomingEvent, IncomingMessage, IncomingMouseMovePayload, InternalEvent, Link, ManagementEntity, MouseMovePayload, NewHoveredElementPayload, OptimizedBackgroundImageAsset, OptimizedImageAsset, OutgoingEvent, OutgoingMessage, OutsideCanvasClickPayload, RawCoordinates, RecursiveDesignTokenDefinition, RegisteredBreakpointsPayload, RegisteredComponentsPayload, RequestComponentTreeUpdatePayload, RequestEditorModePayload, RequestEntitiesMessage, RequestEntitiesPayload, RequestReadOnlyModePayload, RequestedEntitiesMessage, RequestedEntitiesPayload, ResolveDesignValueType, SDKFeaturesPayload, ScrollState, SelectComponentPayload, SendMessageParams, StyleProps, UpdateSelectedComponentCoordinatesPayload, UpdatedEntityPayload, ValidationOption, VariableFormats, WrapperTags } from './types.js';
|
|
3
3
|
export { BoundValue, Breakpoint, ComponentDefinitionPropertyType as ComponentDefinitionVariableType, ComponentPropertyValue, ComponentTreeNode, ComponentValue, DesignValue, ExperienceComponentSettings, ExperienceDataSource, ExperienceUnboundValues, NoValue, Parameter, ParameterDefinition, PrimitiveValue, SchemaVersions, UnboundValue, ValuesByBreakpoint, VariableMapping } from '@contentful/experiences-validators';
|
package/dist/exports.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { ASSEMBLY_BLOCK_NODE_TYPE, ASSEMBLY_DEFAULT_CATEGORY, ASSEMBLY_NODE_TYPE, ASSEMBLY_NODE_TYPES, CF_STYLE_ATTRIBUTES, CONTENTFUL_COMPONENTS, CONTENTFUL_COMPONENT_CATEGORY, CONTENTFUL_DEFAULT_CATEGORY, DEFAULT_IMAGE_WIDTH, EMPTY_CONTAINER_HEIGHT, HYPERLINK_DEFAULT_PATTERN, INCOMING_EVENTS, INTERNAL_EVENTS, LATEST_SCHEMA_VERSION, OUTGOING_EVENTS, PATTERN_PROPERTY_DIVIDER, PostMessageMethods, SCROLL_STATES,
|
|
1
|
+
export { ASSEMBLY_BLOCK_NODE_TYPE, ASSEMBLY_DEFAULT_CATEGORY, ASSEMBLY_NODE_TYPE, ASSEMBLY_NODE_TYPES, CF_STYLE_ATTRIBUTES, CONTENTFUL_COMPONENTS, CONTENTFUL_COMPONENT_CATEGORY, CONTENTFUL_DEFAULT_CATEGORY, DEFAULT_IMAGE_WIDTH, EMPTY_CONTAINER_HEIGHT, HYPERLINK_DEFAULT_PATTERN, INCOMING_EVENTS, INTERNAL_EVENTS, LATEST_SCHEMA_VERSION, OUTGOING_EVENTS, PATTERN_PROPERTY_DIVIDER, PostMessageMethods, SCROLL_STATES, SUPPORTED_IMAGE_FORMATS, StudioCanvasMode, VISUAL_EDITOR_CONTAINER_ID, VISUAL_EDITOR_EVENTS } from './constants.js';
|
|
2
2
|
//# sourceMappingURL=exports.js.map
|
package/dist/index.js
CHANGED
|
@@ -131,7 +131,6 @@ var PostMessageMethods;
|
|
|
131
131
|
PostMessageMethods["REQUESTED_ENTITIES"] = "REQUESTED_ENTITIES";
|
|
132
132
|
})(PostMessageMethods || (PostMessageMethods = {}));
|
|
133
133
|
const SUPPORTED_IMAGE_FORMATS = ['jpg', 'png', 'webp', 'gif', 'avif'];
|
|
134
|
-
const SIDELOADED_PREFIX = 'sideloaded_';
|
|
135
134
|
|
|
136
135
|
const structureComponentIds = new Set([
|
|
137
136
|
CONTENTFUL_COMPONENTS.section.id,
|
|
@@ -3249,8 +3248,8 @@ const sendMessage = (eventType, data) => {
|
|
|
3249
3248
|
*/
|
|
3250
3249
|
class EntityStoreBase {
|
|
3251
3250
|
constructor({ entities, locale }) {
|
|
3252
|
-
|
|
3253
|
-
|
|
3251
|
+
this.entryMap = new Map();
|
|
3252
|
+
this.assetMap = new Map();
|
|
3254
3253
|
this.locale = locale;
|
|
3255
3254
|
for (const entity of entities) {
|
|
3256
3255
|
this.addEntity(entity);
|
|
@@ -3667,11 +3666,9 @@ class EntityStore extends EntityStoreBase {
|
|
|
3667
3666
|
],
|
|
3668
3667
|
locale: serializedAttributes.locale,
|
|
3669
3668
|
});
|
|
3670
|
-
this.
|
|
3671
|
-
this.
|
|
3672
|
-
this.
|
|
3673
|
-
this._experienceEntryId = serializedAttributes._experienceEntryId; // // non-broken deserialization always should result in valid experienceEntryId
|
|
3674
|
-
this._unboundValues = serializedAttributes._unboundValues; // non-broken deserialization always should result in valid unboundValues
|
|
3669
|
+
this._experienceEntryFields = serializedAttributes._experienceEntryFields;
|
|
3670
|
+
this._experienceEntryId = serializedAttributes._experienceEntryId;
|
|
3671
|
+
this._unboundValues = serializedAttributes._unboundValues;
|
|
3675
3672
|
}
|
|
3676
3673
|
else {
|
|
3677
3674
|
const { experienceEntry, entities, locale } = options;
|
|
@@ -3679,101 +3676,18 @@ class EntityStore extends EntityStoreBase {
|
|
|
3679
3676
|
throw new Error('Provided entry is not an experience entry');
|
|
3680
3677
|
}
|
|
3681
3678
|
super({ entities, locale });
|
|
3682
|
-
this._hoistedParameterDefinitions = {};
|
|
3683
|
-
this._hoistedVariableMappings = {};
|
|
3684
3679
|
this._experienceEntryFields = experienceEntry.fields;
|
|
3685
3680
|
this._experienceEntryId = experienceEntry.sys.id;
|
|
3686
3681
|
this._unboundValues = experienceEntry.fields.unboundValues;
|
|
3687
3682
|
}
|
|
3688
|
-
// DERIVE ENTITY STORE INSTANCE VARIBLES
|
|
3689
|
-
// Register prebindings
|
|
3690
|
-
{
|
|
3691
|
-
const usedComponentLinks = this._experienceEntryFields.usedComponents ?? [];
|
|
3692
|
-
const usedComponents = usedComponentLinks
|
|
3693
|
-
.map((component) => (isLink(component) ? this.getEntityFromLink(component) : component))
|
|
3694
|
-
.filter((component) => component !== undefined);
|
|
3695
|
-
this._hoistedParameterDefinitions = EntityStore.calculateHoistedParameterDefinitions(this._experienceEntryFields, usedComponents);
|
|
3696
|
-
this._hoistedVariableMappings = EntityStore.calculateHoistedVariableMappings(this._experienceEntryFields, usedComponents);
|
|
3697
|
-
}
|
|
3698
|
-
// Register deep references
|
|
3699
3683
|
this._usedComponentsWithDeepReferences = resolveDeepUsedComponents({
|
|
3700
3684
|
experienceEntryFields: this._experienceEntryFields,
|
|
3701
3685
|
parentComponents: new Set([this._experienceEntryId]),
|
|
3702
3686
|
});
|
|
3703
3687
|
}
|
|
3704
|
-
static calculateHoistedParameterDefinitions(parentEntryFields, usedComponents) {
|
|
3705
|
-
let hoistedDefinitions = {};
|
|
3706
|
-
// --------------------
|
|
3707
|
-
// Hoist prebinding for the L1 parent pattern aka `pA`
|
|
3708
|
-
// --------------------
|
|
3709
|
-
hoistedDefinitions = Object.assign(hoistedDefinitions, parentEntryFields.componentSettings?.prebindingDefinitions?.[0].parameterDefinitions || {});
|
|
3710
|
-
// --------------------
|
|
3711
|
-
// Hoist prebinding for the L2 nested patterns, patterns aka`pB`
|
|
3712
|
-
// --------------------
|
|
3713
|
-
usedComponents.forEach((patternEntryLevel2) => {
|
|
3714
|
-
hoistedDefinitions = {
|
|
3715
|
-
...hoistedDefinitions,
|
|
3716
|
-
...patternEntryLevel2.fields.componentSettings?.prebindingDefinitions?.[0]
|
|
3717
|
-
.parameterDefinitions,
|
|
3718
|
-
};
|
|
3719
|
-
});
|
|
3720
|
-
// --------------------
|
|
3721
|
-
// Hoist prebinding for L3 nested patterns, patterns aka `pC`
|
|
3722
|
-
// --------------------
|
|
3723
|
-
const usedComponentsLevel3 = usedComponents.flatMap((patternEntryLevel2) => {
|
|
3724
|
-
const usedComponents = patternEntryLevel2.fields.usedComponents || [];
|
|
3725
|
-
const filteredUsedComponents = usedComponents.filter((component) => component !== undefined && isExperienceEntry(component));
|
|
3726
|
-
return filteredUsedComponents;
|
|
3727
|
-
});
|
|
3728
|
-
usedComponentsLevel3.forEach((patternEntryLevel3) => {
|
|
3729
|
-
hoistedDefinitions = {
|
|
3730
|
-
...hoistedDefinitions,
|
|
3731
|
-
...patternEntryLevel3.fields.componentSettings?.prebindingDefinitions?.[0]
|
|
3732
|
-
.parameterDefinitions,
|
|
3733
|
-
};
|
|
3734
|
-
});
|
|
3735
|
-
return hoistedDefinitions;
|
|
3736
|
-
}
|
|
3737
|
-
static calculateHoistedVariableMappings(parentEntryFields, usedComponents) {
|
|
3738
|
-
let hoistedMappings = {};
|
|
3739
|
-
// --------------------
|
|
3740
|
-
// Hoist prebinding for the L1 parent pattern aka `pA`
|
|
3741
|
-
// --------------------
|
|
3742
|
-
hoistedMappings = Object.assign(hoistedMappings, parentEntryFields.componentSettings?.prebindingDefinitions?.[0].variableMappings || {});
|
|
3743
|
-
// --------------------
|
|
3744
|
-
// Hoist prebinding for the L2 nested patterns, patterns aka`pB`
|
|
3745
|
-
// --------------------
|
|
3746
|
-
usedComponents.forEach((patternEntryLevel2) => {
|
|
3747
|
-
hoistedMappings = {
|
|
3748
|
-
...hoistedMappings,
|
|
3749
|
-
...patternEntryLevel2.fields.componentSettings?.prebindingDefinitions?.[0].variableMappings,
|
|
3750
|
-
};
|
|
3751
|
-
});
|
|
3752
|
-
// --------------------
|
|
3753
|
-
// Hoist prebinding for L3 nested patterns, patterns aka `pC`
|
|
3754
|
-
// --------------------
|
|
3755
|
-
const usedComponentsLevel3 = usedComponents.flatMap((patternEntryLevel2) => {
|
|
3756
|
-
const usedComponents = patternEntryLevel2.fields.usedComponents || [];
|
|
3757
|
-
const filteredUsedComponents = usedComponents.filter((component) => component !== undefined && isExperienceEntry(component));
|
|
3758
|
-
return filteredUsedComponents;
|
|
3759
|
-
});
|
|
3760
|
-
usedComponentsLevel3.forEach((patternEntryLevel3) => {
|
|
3761
|
-
hoistedMappings = {
|
|
3762
|
-
...hoistedMappings,
|
|
3763
|
-
...patternEntryLevel3.fields.componentSettings?.prebindingDefinitions?.[0].variableMappings,
|
|
3764
|
-
};
|
|
3765
|
-
});
|
|
3766
|
-
return hoistedMappings;
|
|
3767
|
-
}
|
|
3768
3688
|
getCurrentLocale() {
|
|
3769
3689
|
return this.locale;
|
|
3770
3690
|
}
|
|
3771
|
-
get hoistedVariableMappings() {
|
|
3772
|
-
return this._hoistedVariableMappings;
|
|
3773
|
-
}
|
|
3774
|
-
get hoistedParameterDefinitions() {
|
|
3775
|
-
return this._hoistedParameterDefinitions;
|
|
3776
|
-
}
|
|
3777
3691
|
get experienceEntryFields() {
|
|
3778
3692
|
return this._experienceEntryFields;
|
|
3779
3693
|
}
|
|
@@ -4251,84 +4165,30 @@ const removeSelfReferencingDataSource = (experienceEntry) => {
|
|
|
4251
4165
|
* This ensures that any default values defined in pattern property definitions are included
|
|
4252
4166
|
* in the dataSource, so that linked entities can be fetched and resolved correctly.
|
|
4253
4167
|
* Without this, defaults may be omitted, resulting in unresolved references during binding.
|
|
4254
|
-
*
|
|
4255
|
-
* @returns The number of sideloaded default values, or false if the entry is not a pattern.
|
|
4256
4168
|
*/
|
|
4257
|
-
const
|
|
4258
|
-
|
|
4259
|
-
const addDefaultValueToDataSource = (_definitionId, definition) => {
|
|
4260
|
-
if (!definition.defaultSource) {
|
|
4261
|
-
// prebinding preset doesn't have default value, which is perfectly fine
|
|
4262
|
-
return;
|
|
4263
|
-
}
|
|
4264
|
-
const { contentTypeId, link, type, // At the time of writing, it means that defaultSource is a link to a Contentful Entry, but in the future it could be a link to third party resource or smth.
|
|
4265
|
-
// this .type enumeration will not have the same meaning as `Link#sys#linkType`.
|
|
4266
|
-
} = definition.defaultSource;
|
|
4267
|
-
if (!isLink(link)) {
|
|
4268
|
-
// default value is not a link, maybe due to a bug
|
|
4269
|
-
return;
|
|
4270
|
-
}
|
|
4271
|
-
if (!type || !contentTypeId) {
|
|
4272
|
-
// broken data structure, unlikely to happen, only due to a bug
|
|
4273
|
-
return;
|
|
4274
|
-
}
|
|
4275
|
-
// Throw in the link to the default-entry into the dataSource, this way
|
|
4276
|
-
// we rely on the mechanism of fetchReferencedEntities() to "sideload" them.
|
|
4277
|
-
// Keep in mind that dataSource will be available as EntityStore.dataSource
|
|
4278
|
-
// and now will contain also key for `sideloaded_uuid` entry.
|
|
4279
|
-
// When "sideloading" entries into the entityStore, we must ensure that
|
|
4280
|
-
// there's corresponding entry in the dataSource, because all bound variables
|
|
4281
|
-
// are resolved, via path that is indirectly referencing the dataSource,
|
|
4282
|
-
// eg. { type: 'BoundValue', path: '/sideloaded_uuid/fields/title' }
|
|
4283
|
-
patternEntry.fields.dataSource = {
|
|
4284
|
-
...patternEntry.fields.dataSource,
|
|
4285
|
-
[`${SIDELOADED_PREFIX}${link.sys.id}`]: {
|
|
4286
|
-
// to highlight that this is a sideloaded entry, we prefix it
|
|
4287
|
-
sys: {
|
|
4288
|
-
type: 'Link',
|
|
4289
|
-
linkType: link.sys.linkType,
|
|
4290
|
-
id: link.sys.id,
|
|
4291
|
-
},
|
|
4292
|
-
},
|
|
4293
|
-
};
|
|
4294
|
-
sideloadedCount++;
|
|
4295
|
-
};
|
|
4296
|
-
if (!checkIsAssemblyEntry(patternEntry)) {
|
|
4169
|
+
const attachPrebindingDefaultValueAsDataSource = (experienceEntry) => {
|
|
4170
|
+
if (!checkIsAssemblyEntry(experienceEntry)) {
|
|
4297
4171
|
// Only supported for pattern entries since experience entries don't define pattern properties.
|
|
4298
|
-
return
|
|
4172
|
+
return;
|
|
4299
4173
|
}
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
// Sideload all default values for the L3 nested patterns, patterns aka `pC`
|
|
4319
|
-
// --------------------
|
|
4320
|
-
const nestedPatternEntriesLevel3 = nestedPatternEntriesLevel2.flatMap((patternEntryLevel2) => {
|
|
4321
|
-
const usedComponents = patternEntryLevel2.fields.usedComponents || [];
|
|
4322
|
-
const filteredUsedComponents = usedComponents.filter((component) => component !== undefined && checkIsAssemblyEntry(component));
|
|
4323
|
-
return filteredUsedComponents;
|
|
4324
|
-
});
|
|
4325
|
-
nestedPatternEntriesLevel3.forEach((patternEntry) => {
|
|
4326
|
-
const parameterDefinitions = patternEntry.fields.componentSettings?.prebindingDefinitions?.[0].parameterDefinitions ?? {};
|
|
4327
|
-
Object.entries(parameterDefinitions).forEach(([id, definition]) => {
|
|
4328
|
-
addDefaultValueToDataSource(id, definition);
|
|
4329
|
-
});
|
|
4330
|
-
});
|
|
4331
|
-
return sideloadedCount;
|
|
4174
|
+
const patternDefs = experienceEntry.fields.componentSettings?.prebindingDefinitions?.[0].parameterDefinitions ?? {};
|
|
4175
|
+
const defaultPrebinding = Object.values(patternDefs).find((def) => def.defaultSource)?.defaultSource;
|
|
4176
|
+
const { link, type } = defaultPrebinding ?? {};
|
|
4177
|
+
if (!link || !type)
|
|
4178
|
+
return;
|
|
4179
|
+
const id = link.sys?.id;
|
|
4180
|
+
if (!id)
|
|
4181
|
+
return;
|
|
4182
|
+
experienceEntry.fields.dataSource = {
|
|
4183
|
+
...experienceEntry.fields.dataSource,
|
|
4184
|
+
[id]: {
|
|
4185
|
+
sys: {
|
|
4186
|
+
type: 'Link',
|
|
4187
|
+
linkType: type,
|
|
4188
|
+
id,
|
|
4189
|
+
},
|
|
4190
|
+
},
|
|
4191
|
+
};
|
|
4332
4192
|
};
|
|
4333
4193
|
|
|
4334
4194
|
const errorMessagesWhileFetching$1 = {
|
|
@@ -4366,7 +4226,7 @@ async function fetchBySlug({ client, experienceTypeId, slug, localeCode, isEdito
|
|
|
4366
4226
|
}
|
|
4367
4227
|
removeCircularPatternReferences(experienceEntry);
|
|
4368
4228
|
removeSelfReferencingDataSource(experienceEntry);
|
|
4369
|
-
|
|
4229
|
+
attachPrebindingDefaultValueAsDataSource(experienceEntry);
|
|
4370
4230
|
try {
|
|
4371
4231
|
const { entries, assets } = await fetchReferencedEntities({
|
|
4372
4232
|
client,
|
|
@@ -4425,7 +4285,7 @@ async function fetchById({ client, experienceTypeId, id, localeCode, isEditorMod
|
|
|
4425
4285
|
}
|
|
4426
4286
|
removeCircularPatternReferences(experienceEntry);
|
|
4427
4287
|
removeSelfReferencingDataSource(experienceEntry);
|
|
4428
|
-
|
|
4288
|
+
attachPrebindingDefaultValueAsDataSource(experienceEntry);
|
|
4429
4289
|
try {
|
|
4430
4290
|
const { entries, assets } = await fetchReferencedEntities({
|
|
4431
4291
|
client,
|