@contentful/experiences-core 3.7.0-beta.0 → 3.7.0-dev-20250917T1357-4fbbff5.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 +0 -2
- package/dist/constants.js +0 -2
- package/dist/constants.js.map +1 -1
- package/dist/entity/EntityStore.d.ts +1 -1
- package/dist/exports.js +2 -0
- package/dist/exports.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +17 -59
- package/dist/index.js.map +1 -1
- package/dist/registries/breakpointsRegistry.d.ts +13 -36
- package/dist/types.d.ts +5 -1
- package/dist/utils/sanitizeNodeProps.d.ts +2 -3
- package/dist/utils/utils.d.ts +1 -6
- package/package.json +8 -21
- package/dist/constants.cjs +0 -198
- package/dist/constants.cjs.map +0 -1
- package/dist/index.cjs +0 -5412
- package/dist/index.cjs.map +0 -1
package/dist/constants.d.ts
CHANGED
|
@@ -48,9 +48,7 @@ declare const INCOMING_EVENTS: {
|
|
|
48
48
|
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
49
49
|
readonly HoverComponent: "hoverComponent";
|
|
50
50
|
readonly UpdatedEntity: "updatedEntity";
|
|
51
|
-
/** @deprecated not needed after `patternResolution` was introduced. Will be removed in the next major version. */
|
|
52
51
|
readonly AssembliesAdded: "assembliesAdded";
|
|
53
|
-
/** @deprecated not needed after `patternResolution` was introduced. Will be removed in the next major version. */
|
|
54
52
|
readonly AssembliesRegistered: "assembliesRegistered";
|
|
55
53
|
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
56
54
|
readonly MouseMove: "mouseMove";
|
package/dist/constants.js
CHANGED
|
@@ -48,9 +48,7 @@ const INCOMING_EVENTS = {
|
|
|
48
48
|
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
49
49
|
HoverComponent: 'hoverComponent',
|
|
50
50
|
UpdatedEntity: 'updatedEntity',
|
|
51
|
-
/** @deprecated not needed after `patternResolution` was introduced. Will be removed in the next major version. */
|
|
52
51
|
AssembliesAdded: 'assembliesAdded',
|
|
53
|
-
/** @deprecated not needed after `patternResolution` was introduced. Will be removed in the next major version. */
|
|
54
52
|
AssembliesRegistered: 'assembliesRegistered',
|
|
55
53
|
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
56
54
|
MouseMove: 'mouseMove',
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sources":["../src/constants.ts"],"sourcesContent":["/** @deprecated will be removed when dropping backward compatibility for old DND */\nexport 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 /** @deprecated will be removed when dropping backward compatibility for old DND */\n MouseMove: 'mouseMove',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentSelected: 'componentSelected',\n RegisteredComponents: 'registeredComponents',\n RequestComponentTreeUpdate: 'requestComponentTreeUpdate',\n CanvasReload: 'canvasReload',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n UpdateSelectedComponentCoordinates: 'updateSelectedComponentCoordinates',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n CanvasScroll: 'canvasScrolling',\n CanvasError: 'canvasError',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n OutsideCanvasClick: 'outsideCanvasClick',\n SDKFeatures: 'sdkFeatures',\n RequestEntities: 'REQUEST_ENTITIES',\n CanvasGeometryUpdated: 'canvasGeometryUpdated',\n CanvasPan: 'canvasPan',\n} as const;\n\nexport const INCOMING_EVENTS = {\n RequestEditorMode: 'requestEditorMode',\n RequestReadOnlyMode: 'requestReadOnlyMode',\n ExperienceUpdated: 'componentTreeUpdated',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentDraggingChanged: 'componentDraggingChanged',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentDragCanceled: 'componentDragCanceled',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentDragStarted: 'componentDragStarted',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentDragEnded: 'componentDragEnded',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentMoveEnded: 'componentMoveEnded',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n CanvasResized: 'canvasResized',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n SelectComponent: 'selectComponent',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n HoverComponent: 'hoverComponent',\n UpdatedEntity: 'updatedEntity',\n
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../src/constants.ts"],"sourcesContent":["/** @deprecated will be removed when dropping backward compatibility for old DND */\nexport 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 /** @deprecated will be removed when dropping backward compatibility for old DND */\n MouseMove: 'mouseMove',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentSelected: 'componentSelected',\n RegisteredComponents: 'registeredComponents',\n RequestComponentTreeUpdate: 'requestComponentTreeUpdate',\n CanvasReload: 'canvasReload',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n UpdateSelectedComponentCoordinates: 'updateSelectedComponentCoordinates',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n CanvasScroll: 'canvasScrolling',\n CanvasError: 'canvasError',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n OutsideCanvasClick: 'outsideCanvasClick',\n SDKFeatures: 'sdkFeatures',\n RequestEntities: 'REQUEST_ENTITIES',\n CanvasGeometryUpdated: 'canvasGeometryUpdated',\n CanvasPan: 'canvasPan',\n} as const;\n\nexport const INCOMING_EVENTS = {\n RequestEditorMode: 'requestEditorMode',\n RequestReadOnlyMode: 'requestReadOnlyMode',\n ExperienceUpdated: 'componentTreeUpdated',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentDraggingChanged: 'componentDraggingChanged',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentDragCanceled: 'componentDragCanceled',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentDragStarted: 'componentDragStarted',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentDragEnded: 'componentDragEnded',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentMoveEnded: 'componentMoveEnded',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n CanvasResized: 'canvasResized',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n SelectComponent: 'selectComponent',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n HoverComponent: 'hoverComponent',\n UpdatedEntity: 'updatedEntity',\n AssembliesAdded: 'assembliesAdded',\n AssembliesRegistered: 'assembliesRegistered',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\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];\n\nexport const EMPTY_CONTAINER_SIZE = '80px';\n\nexport const HYPERLINK_DEFAULT_PATTERN = `/{locale}/{entry.fields.slug}/`;\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\nexport const SIDELOADED_PREFIX = 'sideloaded_';\n"],"names":[],"mappings":"AAAA;AACa,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;;AAE9C,IAAA,SAAS,EAAE,WAAW;;AAEtB,IAAA,iBAAiB,EAAE,mBAAmB;AACtC,IAAA,oBAAoB,EAAE,sBAAsB;AAC5C,IAAA,0BAA0B,EAAE,4BAA4B;AACxD,IAAA,YAAY,EAAE,cAAc;;AAE5B,IAAA,kCAAkC,EAAE,oCAAoC;;AAExE,IAAA,YAAY,EAAE,iBAAiB;AAC/B,IAAA,WAAW,EAAE,aAAa;;AAE1B,IAAA,kBAAkB,EAAE,oBAAoB;AACxC,IAAA,WAAW,EAAE,aAAa;AAC1B,IAAA,eAAe,EAAE,kBAAkB;AACnC,IAAA,qBAAqB,EAAE,uBAAuB;AAC9C,IAAA,SAAS,EAAE,WAAW;EACb;AAEE,MAAA,eAAe,GAAG;AAC7B,IAAA,iBAAiB,EAAE,mBAAmB;AACtC,IAAA,mBAAmB,EAAE,qBAAqB;AAC1C,IAAA,iBAAiB,EAAE,sBAAsB;;AAEzC,IAAA,wBAAwB,EAAE,0BAA0B;;AAEpD,IAAA,qBAAqB,EAAE,uBAAuB;;AAE9C,IAAA,oBAAoB,EAAE,sBAAsB;;AAE5C,IAAA,kBAAkB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Ac;IACd,kBAAkB;IAClB,WAAW;IACX,YAAY;IACZ,cAAc;IACd,cAAc;IACd,iBAAiB;IACjB,aAAa;IACb,aAAa;IACb,iBAAiB;IACjB,YAAY;IACZ,cAAc;IACd,iBAAiB;EACjB;AAEK,MAAM,oBAAoB,GAAG,OAAO;AAEpC,MAAM,yBAAyB,GAAG,iCAAiC;IAE9D,mBAGX;AAHD,CAAA,UAAY,kBAAkB,EAAA;AAC5B,IAAA,kBAAA,CAAA,kBAAA,CAAA,GAAA,kBAAqC,CAAA;AACrC,IAAA,kBAAA,CAAA,oBAAA,CAAA,GAAA,oBAAyC,CAAA;AAC3C,CAAC,EAHW,kBAAkB,KAAlB,kBAAkB,GAG7B,EAAA,CAAA,CAAA,CAAA;AAEM,MAAM,uBAAuB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAW;AAE/E,MAAM,wBAAwB,GAAG,QAAQ;AAEzC,MAAM,iBAAiB,GAAG;;;;"}
|
|
@@ -53,8 +53,8 @@ declare class EntityStore extends EntityStoreBase {
|
|
|
53
53
|
get breakpoints(): {
|
|
54
54
|
id: string;
|
|
55
55
|
query: "*" | `>${number}px` | `<${number}px`;
|
|
56
|
+
previewSize: string;
|
|
56
57
|
displayName: string;
|
|
57
|
-
previewSize?: string | undefined;
|
|
58
58
|
displayIcon?: "desktop" | "tablet" | "mobile" | undefined;
|
|
59
59
|
}[];
|
|
60
60
|
get dataSource(): Record<string, {
|
package/dist/exports.js
ADDED
|
@@ -0,0 +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, EMPTY_CONTAINER_SIZE, HYPERLINK_DEFAULT_PATTERN, INCOMING_EVENTS, INTERNAL_EVENTS, LATEST_SCHEMA_VERSION, OUTGOING_EVENTS, PATTERN_PROPERTY_DIVIDER, PostMessageMethods, SCROLL_STATES, SIDELOADED_PREFIX, SUPPORTED_IMAGE_FORMATS, StudioCanvasMode, VISUAL_EDITOR_CONTAINER_ID, VISUAL_EDITOR_EVENTS } from './constants.js';
|
|
2
|
+
//# sourceMappingURL=exports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exports.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export { transformVisibility } from './utils/styleUtils/styleTransformers.js';
|
|
|
16
16
|
export { transformBoundContentValue } from './utils/transformers/transformBoundContentValue.js';
|
|
17
17
|
export { treeMap, treeVisit } from './utils/treeTraversal.js';
|
|
18
18
|
export { isArrayOfLinks, isAsset, isEntry, isExperienceEntry, isPatternEntry } from './utils/typeguards.js';
|
|
19
|
-
export { checkIsAssemblyDefinition, checkIsAssemblyEntry, checkIsAssemblyNode,
|
|
19
|
+
export { checkIsAssemblyDefinition, checkIsAssemblyEntry, checkIsAssemblyNode, generateRandomId, getDataFromTree, getTargetValueInPixels, parseCSSValue } from './utils/utils.js';
|
|
20
20
|
export { doesMismatchMessageSchema, tryParseMessage, validateExperienceBuilderConfig } from './utils/validations.js';
|
|
21
21
|
export { extractLeafLinksReferencedFromExperience } from './utils/schema/experienceSchema.js';
|
|
22
22
|
export { FnShouldFollowReferencesOfEntryField, extractReferencesFromEntries, extractReferencesFromEntriesAsIds, referencesOf, uniqueById } from './utils/schema/references.js';
|
|
@@ -37,6 +37,6 @@ export { createExperience } from './fetchers/createExperience.js';
|
|
|
37
37
|
export { fetchReferencedEntities } from './fetchers/fetchReferencedEntities.js';
|
|
38
38
|
export { fetchExperienceEntry } from './fetchers/fetchExperienceEntry.js';
|
|
39
39
|
export { defineDesignTokens, designTokensRegistry, getDesignTokenRegistration, resetDesignTokenRegistry } from './registries/designTokenRegistry.js';
|
|
40
|
-
export { breakpointsRegistry, defineBreakpoints, runBreakpointsValidation } from './registries/breakpointsRegistry.js';
|
|
40
|
+
export { breakpointsRegistry, defineBreakpoints, getBreakpointRegistration, resetBreakpointsRegistry, runBreakpointsValidation } from './registries/breakpointsRegistry.js';
|
|
41
41
|
export { defineSdkOptions, getSdkOptions, sdkOptionsRegistry } from './registries/sdkOptionsRegistry.js';
|
|
42
42
|
export { DeepReference, gatherDeepPrebindingReferencesFromExperienceEntry, gatherDeepPrebindingReferencesFromPatternEntry, gatherDeepReferencesFromExperienceEntry, gatherDeepReferencesFromTree } from './deep-binding/DeepReference.js';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z, ZodIssueCode } from 'zod';
|
|
2
|
-
import cloneDeep from 'lodash
|
|
2
|
+
import { cloneDeep, omit, isArray, uniqBy } from 'lodash-es';
|
|
3
3
|
import md5 from 'md5';
|
|
4
4
|
import { BLOCKS } from '@contentful/rich-text-types';
|
|
5
5
|
import { create } from 'zustand';
|
|
@@ -26,9 +26,7 @@ const INCOMING_EVENTS = {
|
|
|
26
26
|
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
27
27
|
HoverComponent: 'hoverComponent',
|
|
28
28
|
UpdatedEntity: 'updatedEntity',
|
|
29
|
-
/** @deprecated not needed after `patternResolution` was introduced. Will be removed in the next major version. */
|
|
30
29
|
AssembliesAdded: 'assembliesAdded',
|
|
31
|
-
/** @deprecated not needed after `patternResolution` was introduced. Will be removed in the next major version. */
|
|
32
30
|
AssembliesRegistered: 'assembliesRegistered',
|
|
33
31
|
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
34
32
|
MouseMove: 'mouseMove',
|
|
@@ -1000,7 +998,7 @@ const BreakpointSchema = z
|
|
|
1000
998
|
id: propertyKeySchema,
|
|
1001
999
|
// Can be replace with z.templateLiteral when upgrading to zod v4
|
|
1002
1000
|
query: z.string().refine((s) => BREAKPOINT_QUERY_REGEX.test(s)),
|
|
1003
|
-
previewSize: z.string()
|
|
1001
|
+
previewSize: z.string(),
|
|
1004
1002
|
displayName: z.string(),
|
|
1005
1003
|
displayIcon: z.enum(['desktop', 'tablet', 'mobile']).optional(),
|
|
1006
1004
|
})
|
|
@@ -1521,42 +1519,11 @@ const validateBreakpointsDefinition = (breakpoints) => {
|
|
|
1521
1519
|
return { success: true };
|
|
1522
1520
|
};
|
|
1523
1521
|
|
|
1524
|
-
|
|
1522
|
+
let breakpointsRegistry = [];
|
|
1525
1523
|
/**
|
|
1526
|
-
*
|
|
1527
|
-
*
|
|
1528
|
-
*
|
|
1529
|
-
* - query: a media query string that defines when this breakpoint is active
|
|
1530
|
-
* - previewSize: an optional fixed preview size to be used in the Studio editor when selecting this breakpoint
|
|
1531
|
-
* - displayName: the name to be displayed in the Studio editor for this breakpoint
|
|
1532
|
-
* - displayIcon: an optional icon to be displayed in the Studio editor for this breakpoint
|
|
1533
|
-
*
|
|
1534
|
-
* The first breakpoint must use a wildcard query (`*`) to match all sizes.
|
|
1535
|
-
*
|
|
1536
|
-
* Every subsequent breakpoint inherits the designs of the previous ones by default.
|
|
1537
|
-
*
|
|
1538
|
-
* The order of breakpoints must be either:
|
|
1539
|
-
* - desktop first: from largest to smallest, using `<` operators
|
|
1540
|
-
* - mobile first: from smallest to largest, using `>` operators
|
|
1541
|
-
*
|
|
1542
|
-
* @note changing breakpoints after you have created experiences may break those experiences
|
|
1543
|
-
* @example
|
|
1544
|
-
* defineBreakpoints([{
|
|
1545
|
-
* id: 'desktop',
|
|
1546
|
-
* query: '*',
|
|
1547
|
-
* displayName: 'Desktop',
|
|
1548
|
-
* displayIcon: 'desktop',
|
|
1549
|
-
* }, {
|
|
1550
|
-
* id: 'tablet',
|
|
1551
|
-
* query: '<992px',
|
|
1552
|
-
* displayName: 'Tablet',
|
|
1553
|
-
* displayIcon: 'tablet',
|
|
1554
|
-
* }, {
|
|
1555
|
-
* id: 'mobile',
|
|
1556
|
-
* query: '<576px',
|
|
1557
|
-
* displayName: 'Mobile',
|
|
1558
|
-
* displayIcon: 'mobile',
|
|
1559
|
-
* }]);
|
|
1524
|
+
* Register custom breakpoints
|
|
1525
|
+
* @param breakpoints - [{[key:string]: string}]
|
|
1526
|
+
* @returns void
|
|
1560
1527
|
*/
|
|
1561
1528
|
const defineBreakpoints = (breakpoints) => {
|
|
1562
1529
|
Object.assign(breakpointsRegistry, breakpoints);
|
|
@@ -1569,6 +1536,12 @@ const runBreakpointsValidation = () => {
|
|
|
1569
1536
|
throw new Error(`Invalid breakpoints definition. Failed with errors: \n${JSON.stringify(validation.errors, null, 2)}`);
|
|
1570
1537
|
}
|
|
1571
1538
|
};
|
|
1539
|
+
// Used in the tests to get a breakpoint registration
|
|
1540
|
+
const getBreakpointRegistration = (id) => breakpointsRegistry.find((breakpoint) => breakpoint.id === id);
|
|
1541
|
+
// Used in the tests to reset the registry
|
|
1542
|
+
const resetBreakpointsRegistry = () => {
|
|
1543
|
+
breakpointsRegistry = [];
|
|
1544
|
+
};
|
|
1572
1545
|
|
|
1573
1546
|
const sdkOptionsRegistry = {};
|
|
1574
1547
|
/**
|
|
@@ -2175,9 +2148,7 @@ const stylesToRemove = CF_STYLE_ATTRIBUTES.filter((style) => !stylesToKeep.inclu
|
|
|
2175
2148
|
// cfWrapColumns & cfWrapColumnsCount are no real style attributes as they are handled on the editor side
|
|
2176
2149
|
const propsToRemove = ['cfSsrClassName', 'cfWrapColumns', 'cfWrapColumnsCount'];
|
|
2177
2150
|
const sanitizeNodeProps = (nodeProps) => {
|
|
2178
|
-
|
|
2179
|
-
const sanitizedProps = Object.fromEntries(Object.entries(nodeProps).filter(([key]) => !keysToRemove.includes(key)));
|
|
2180
|
-
return sanitizedProps;
|
|
2151
|
+
return omit(nodeProps, stylesToRemove, propsToRemove);
|
|
2181
2152
|
};
|
|
2182
2153
|
|
|
2183
2154
|
/** Turn the visibility value into a style object that can be used for inline styles in React */
|
|
@@ -3308,7 +3279,7 @@ function getArrayValue(entryOrAsset, path, entityStore) {
|
|
|
3308
3279
|
}
|
|
3309
3280
|
const fieldName = path.split('/').slice(2, -1);
|
|
3310
3281
|
const arrayValue = get(entryOrAsset, fieldName);
|
|
3311
|
-
if (!
|
|
3282
|
+
if (!isArray(arrayValue)) {
|
|
3312
3283
|
debug.warn(`[experiences-core::getArrayValue] A field '${fieldName}' of an entity was bound to an Array variable. Expected value of that field to be an array, but got: ${JSON.stringify(arrayValue)}`, { entity: entryOrAsset });
|
|
3313
3284
|
return;
|
|
3314
3285
|
}
|
|
@@ -3465,19 +3436,6 @@ function getTargetValueInPixels(targetWidthObject) {
|
|
|
3465
3436
|
return targetWidthObject.value;
|
|
3466
3437
|
}
|
|
3467
3438
|
}
|
|
3468
|
-
/**
|
|
3469
|
-
* Creates a component definition for an assembly. As all assemblies use the same definition in the SDK,
|
|
3470
|
-
* all should be registered via this function.
|
|
3471
|
-
*/
|
|
3472
|
-
const createAssemblyDefinition = (definitionId) => {
|
|
3473
|
-
return {
|
|
3474
|
-
id: definitionId,
|
|
3475
|
-
name: 'Component',
|
|
3476
|
-
variables: {},
|
|
3477
|
-
children: true,
|
|
3478
|
-
category: ASSEMBLY_DEFAULT_CATEGORY,
|
|
3479
|
-
};
|
|
3480
|
-
};
|
|
3481
3439
|
|
|
3482
3440
|
class ParseError extends Error {
|
|
3483
3441
|
constructor(message) {
|
|
@@ -4848,8 +4806,8 @@ const fetchAllEntries = async ({ client, ids, locale, skip = 0, limit = 100, res
|
|
|
4848
4806
|
responseIncludes,
|
|
4849
4807
|
});
|
|
4850
4808
|
}
|
|
4851
|
-
const dedupedEntries =
|
|
4852
|
-
const dedupedAssets =
|
|
4809
|
+
const dedupedEntries = uniqBy(responseIncludes?.Entry, (entry) => entry.sys.id);
|
|
4810
|
+
const dedupedAssets = uniqBy(responseIncludes?.Asset, (asset) => asset.sys.id);
|
|
4853
4811
|
return {
|
|
4854
4812
|
items: responseItems,
|
|
4855
4813
|
includes: {
|
|
@@ -5290,5 +5248,5 @@ async function fetchById({ client, experienceTypeId, id, localeCode, isEditorMod
|
|
|
5290
5248
|
}
|
|
5291
5249
|
}
|
|
5292
5250
|
|
|
5293
|
-
export { BREAKPOINTS_STRATEGY_DESKTOP_FIRST, BREAKPOINTS_STRATEGY_MOBILE_FIRST, DebugLogger, DeepReference, EditorModeEntityStore, EntityStore, EntityStoreBase, MEDIA_QUERY_REGEXP, VisualEditorMode, addLocale, addMinHeightForEmptyStructures, breakpointsRegistry, buildCfStyles, buildStyleTag, buildTemplate, builtInStyles, calculateNodeDefaultHeight, checkIsAssemblyDefinition, checkIsAssemblyEntry, checkIsAssemblyNode, columnsBuiltInStyles, containerBuiltInStyles,
|
|
5251
|
+
export { BREAKPOINTS_STRATEGY_DESKTOP_FIRST, BREAKPOINTS_STRATEGY_MOBILE_FIRST, DebugLogger, DeepReference, EditorModeEntityStore, EntityStore, EntityStoreBase, MEDIA_QUERY_REGEXP, VisualEditorMode, addLocale, addMinHeightForEmptyStructures, breakpointsRegistry, buildCfStyles, buildStyleTag, buildTemplate, builtInStyles, calculateNodeDefaultHeight, checkIsAssemblyDefinition, checkIsAssemblyEntry, checkIsAssemblyNode, columnsBuiltInStyles, containerBuiltInStyles, createExperience, debug, defineBreakpoints, defineDesignTokens, defineSdkOptions, designTokensRegistry, detachExperienceStyles, detectBreakpointsStrategy, disableDebug, dividerBuiltInStyles, doesMismatchMessageSchema, enableDebug, extractLeafLinksReferencedFromExperience, extractPrebindingDataByPatternId, extractReferencesFromEntries, extractReferencesFromEntriesAsIds, fetchAllAssets, fetchAllEntries, fetchById, fetchBySlug, fetchExperienceEntry, fetchReferencedEntities, findOutermostCoordinates, flattenDesignTokenRegistry, flattenNestedPatterns, gatherDeepPrebindingReferencesFromExperienceEntry, gatherDeepPrebindingReferencesFromPatternEntry, gatherDeepReferencesFromExperienceEntry, gatherDeepReferencesFromTree, generateDefaultDataSourceForPrebindingDefinition, generateRandomId, getActiveBreakpointIndex, getBreakpointRegistration, getDataFromTree, getDesignTokenRegistration, getElementCoordinates, getFallbackBreakpointIndex, getPrebindingPathBySourceEntry, getSdkOptions, getTargetPatternMappingsForParameter, getTargetValueInPixels, getTemplateValue, getValueForBreakpoint, inMemoryEntities, inMemoryEntitiesStore, indexByBreakpoint, isArrayOfLinks, isAsset, isCfStyleAttribute, isComponentAllowedOnRoot, isContentfulComponent, isContentfulStructureComponent, isDeepPath, isDeepPrebinding, isElementHidden, isEntry, isExperienceEntry, isLink, isLinkToAsset, isLinkToEntry, isPatternComponent, isPatternEntry, isPreboundProp, isStructureWithRelativeHeight, isValidBreakpointValue, lastPathNamedSegmentEq, localizeEntity, maybePopulateDesignTokenValue, mediaQueryMatcher, mergeDesignValuesByBreakpoint, optionalBuiltInStyles, parseCSSValue, parseDataSourcePathIntoFieldset, parseDataSourcePathWithL1DeepBindings, referencesOf, resetBreakpointsRegistry, resetDesignTokenRegistry, resolveBackgroundImageBinding, resolveHyperlinkPattern, runBreakpointsValidation, sanitizeNodeProps, sdkOptionsRegistry, sectionBuiltInStyles, sendMessage, setDebugLevel, singleColumnBuiltInStyles, splitDirectAndSlotChildren, stringifyCssProperties, toCSSAttribute, toMediaQuery, transformBoundContentValue, transformVisibility, treeMap, treeVisit, tryParseMessage, uniqueById, useInMemoryEntities, validateExperienceBuilderConfig };
|
|
5294
5252
|
//# sourceMappingURL=index.js.map
|