@contentful/experiences-core 3.8.2-dev-20251008T0828-a06681d.0 → 3.8.3-beta.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.
Files changed (62) hide show
  1. package/dist/{constants.cjs → cjs/constants.cjs} +2 -0
  2. package/dist/cjs/constants.cjs.map +1 -0
  3. package/dist/{index.cjs → cjs/index.cjs} +129 -127
  4. package/dist/cjs/index.cjs.map +1 -0
  5. package/dist/esm/constants.js.map +1 -0
  6. package/dist/esm/index.js.map +1 -0
  7. package/dist/types/index.d.ts +1675 -0
  8. package/package.json +17 -21
  9. package/dist/communication/sendMessage.d.ts +0 -5
  10. package/dist/constants.cjs.map +0 -1
  11. package/dist/constants.js.map +0 -1
  12. package/dist/deep-binding/DeepReference.d.ts +0 -44
  13. package/dist/definitions/styles.d.ts +0 -11
  14. package/dist/entity/EditorEntityStore.d.ts +0 -34
  15. package/dist/entity/EditorModeEntityStore.d.ts +0 -28
  16. package/dist/entity/EntityStore.d.ts +0 -99
  17. package/dist/entity/EntityStoreBase.d.ts +0 -53
  18. package/dist/entity/InMemoryEntitiesPublicApi.d.ts +0 -41
  19. package/dist/entity/InMemoryEntitiesStore.d.ts +0 -17
  20. package/dist/enums.d.ts +0 -6
  21. package/dist/exports.d.ts +0 -3
  22. package/dist/fetchers/createExperience.d.ts +0 -25
  23. package/dist/fetchers/fetchAllEntities.d.ts +0 -30
  24. package/dist/fetchers/fetchById.d.ts +0 -24
  25. package/dist/fetchers/fetchBySlug.d.ts +0 -24
  26. package/dist/fetchers/fetchExperienceEntry.d.ts +0 -30
  27. package/dist/fetchers/fetchReferencedEntities.d.ts +0 -28
  28. package/dist/fetchers/gatherAutoFetchedReferentsFromIncludes.d.ts +0 -11
  29. package/dist/index.cjs.map +0 -1
  30. package/dist/index.d.ts +0 -42
  31. package/dist/index.js.map +0 -1
  32. package/dist/registries/breakpointsRegistry.d.ts +0 -43
  33. package/dist/registries/designTokenRegistry.d.ts +0 -13
  34. package/dist/registries/sdkOptionsRegistry.d.ts +0 -11
  35. package/dist/types.d.ts +0 -630
  36. package/dist/utils/breakpoints.d.ts +0 -26
  37. package/dist/utils/components.d.ts +0 -17
  38. package/dist/utils/debugLogger.d.ts +0 -36
  39. package/dist/utils/domValues.d.ts +0 -16
  40. package/dist/utils/extractPrebindingData.d.ts +0 -46
  41. package/dist/utils/isLink.d.ts +0 -7
  42. package/dist/utils/isLinkToAsset.d.ts +0 -5
  43. package/dist/utils/isLinkToEntry.d.ts +0 -5
  44. package/dist/utils/localizeEntity.d.ts +0 -24
  45. package/dist/utils/pathSchema.d.ts +0 -43
  46. package/dist/utils/resolveHyperlinkPattern.d.ts +0 -17
  47. package/dist/utils/sanitizeNodeProps.d.ts +0 -7
  48. package/dist/utils/schema/experienceSchema.d.ts +0 -23
  49. package/dist/utils/schema/references.d.ts +0 -18
  50. package/dist/utils/splitDirectAndSlotChildren.d.ts +0 -12
  51. package/dist/utils/styleUtils/ssrStyles.d.ts +0 -75
  52. package/dist/utils/styleUtils/styleTransformers.d.ts +0 -6
  53. package/dist/utils/styleUtils/stylesUtils.d.ts +0 -64
  54. package/dist/utils/styleUtils/toMediaQuery.d.ts +0 -15
  55. package/dist/utils/transformers/transformBoundContentValue.d.ts +0 -8
  56. package/dist/utils/treeTraversal.d.ts +0 -17
  57. package/dist/utils/typeguards.d.ts +0 -15
  58. package/dist/utils/utils.d.ts +0 -32
  59. package/dist/utils/validations.d.ts +0 -11
  60. package/dist/{constants.js → esm/constants.js} +0 -0
  61. package/dist/{index.js → esm/index.js} +127 -127
  62. /package/dist/{constants.d.ts → types/constants.d.ts} +0 -0
package/dist/types.d.ts DELETED
@@ -1,630 +0,0 @@
1
- import { Entry, Asset, AssetFile, ChainModifiers } from 'contentful';
2
- import { SCROLL_STATES, OUTGOING_EVENTS, INCOMING_EVENTS, INTERNAL_EVENTS } from './constants.js';
3
- import { Document } from '@contentful/rich-text-types';
4
- import { ComponentDefinitionPropertyType, BindingSourceTypeEnum, ComponentPropertyValue, ExperienceDataSource, ExperienceUnboundValues, Breakpoint, Parameter, ExperienceComponentTree, ExperienceUsedComponents, ExperienceComponentSettings, ValuesByBreakpoint, PrimitiveValue } from '@contentful/experiences-validators';
5
- 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';
6
- import { EntityStore } from './entity/EntityStore.js';
7
-
8
- type ComponentDefinitionVariableTypeMap = {
9
- Array: unknown[];
10
- Boolean: boolean;
11
- Date: string;
12
- Hyperlink: string;
13
- Link: Record<string, unknown>;
14
- Location: {
15
- lon: number;
16
- lat: number;
17
- };
18
- Media: Record<string, unknown> | string;
19
- Number: number;
20
- Object: Record<string, unknown>;
21
- RichText: string;
22
- Text: string;
23
- };
24
- type ScrollStateKey = keyof typeof SCROLL_STATES;
25
- /** @deprecated will be removed when dropping backward compatibility for old DND */
26
- type ScrollState = (typeof SCROLL_STATES)[ScrollStateKey];
27
- type OutgoingEventKey = keyof typeof OUTGOING_EVENTS;
28
- type OutgoingEvent = (typeof OUTGOING_EVENTS)[OutgoingEventKey];
29
- type IncomingEventKey = keyof typeof INCOMING_EVENTS;
30
- type IncomingEvent = (typeof INCOMING_EVENTS)[IncomingEventKey];
31
- type InternalEventKey = keyof typeof INTERNAL_EVENTS;
32
- type InternalEvent = (typeof INTERNAL_EVENTS)[InternalEventKey];
33
- interface Link<T extends string> {
34
- sys: {
35
- type: 'Link';
36
- linkType: T;
37
- id: string;
38
- };
39
- }
40
- type VariableFormats = 'URL';
41
- type ValidationOption<T extends ComponentDefinitionPropertyType> = {
42
- value: T extends 'Text' ? string : T extends 'Number' ? number : never;
43
- displayName?: string;
44
- };
45
- type ComponentDefinitionVariableValidation<T extends ComponentDefinitionPropertyType> = {
46
- required?: boolean;
47
- in?: ValidationOption<T>[];
48
- format?: VariableFormats;
49
- /** Define the type of entity that can be bound to this variable. The provided list order defines
50
- * the order of select options in the editor UI, i.e. the first item will be pre-selected by default. */
51
- bindingSourceType?: BindingSourceTypeEnum;
52
- };
53
- interface ComponentDefinitionVariableBase<T extends ComponentDefinitionPropertyType> {
54
- type: T;
55
- validations?: ComponentDefinitionVariableValidation<T>;
56
- group?: 'style' | 'content';
57
- description?: string;
58
- displayName?: string;
59
- defaultValue?: ComponentDefinitionVariableTypeMap[T];
60
- }
61
- type ComponentDefinitionVariable<T extends ComponentDefinitionPropertyType = ComponentDefinitionPropertyType> = ComponentDefinitionVariableBase<T>;
62
- type ComponentDefinition<T extends ComponentDefinitionPropertyType = ComponentDefinitionPropertyType> = {
63
- id: string;
64
- name: string;
65
- category?: string;
66
- thumbnailUrl?: string;
67
- thumbnailId?: string;
68
- hyperlinkPattern?: string;
69
- variables: Partial<DesignVariableMap> & Record<string, ComponentDefinitionVariable<T>>;
70
- /** Render child components in specified slots. This is an advanced version of the `children`
71
- * configuration. We don't recommend using both together, as it can lead to unexpected behavior. */
72
- slots?: Record<string, {
73
- displayName: string;
74
- }>;
75
- /**
76
- * List of built-in styles that can be applied to the component.
77
- *
78
- * Note that the property 'cfVisibility' is enforced on every component to control its visibility.
79
- * @example ['cfWidth', 'cfPadding']
80
- * @default ['cfMargin']
81
- */
82
- builtInStyles?: Array<keyof Omit<StyleProps, 'cfHyperlink' | 'cfOpenInNewTab'>>;
83
- /** Component allows passing child components inside it.
84
- * @default false
85
- */
86
- children?: boolean;
87
- tooltip?: {
88
- imageUrl?: string;
89
- description: string;
90
- };
91
- };
92
- type ComponentRegistration = {
93
- component: React.ElementType;
94
- definition: ComponentDefinition;
95
- options?: {
96
- /**
97
- * If true, the component receives the optional boolean property `isInExpEditorMode` to
98
- * render different content between editor and delivery mode.
99
- *
100
- * @deprecated this will be replaced by enableEditorProperties in the next major version
101
- */
102
- enableCustomEditorView?: boolean;
103
- /**
104
- * If set, the specified properties are passed to the component when rendered in the editor.
105
- */
106
- enableEditorProperties?: {
107
- /**
108
- * Enable the property `isEditorMode` which will be `true` if being rendered inside the Studio editor.
109
- */
110
- isEditorMode?: boolean;
111
- /**
112
- * Enable the property `isEmpty` which will be `true` if the component has no children.
113
- * This can be used to render a placeholder or label in the editor when the component is empty.
114
- *
115
- * @note This will be false if there are no direct children nor slot children.
116
- */
117
- isEmpty?: boolean;
118
- /**
119
- * Enable the string property `nodeBlockId` which is equal to the component ID
120
- * passed during registration, i.e. `ComponentDefinition['id']`.
121
- */
122
- nodeBlockId?: boolean;
123
- };
124
- wrapComponent?: boolean;
125
- wrapContainer?: keyof JSX.IntrinsicElements;
126
- /**
127
- * @deprecated This option is not supported anymore and will be fully removed in the
128
- * next major release v4. */
129
- wrapContainerWidth?: React.CSSProperties['width'];
130
- };
131
- };
132
- /**
133
- * Use this for type-safe access to editor properties in your custom components
134
- * @example
135
- * type MyCustomProps = { myValue: string }
136
- * type MyComponentProps = EditorProperties<'isEmpty'> & MyCustomProps
137
- */
138
- type EditorProperties<T extends EditorPropertyNames = EditorPropertyNames> = Pick<BaseEditorProperties, T>;
139
- type EditorPropertyNames = keyof BaseEditorProperties;
140
- type BaseEditorProperties = {
141
- isEditorMode?: boolean;
142
- isEmpty?: boolean;
143
- nodeBlockId?: string;
144
- /** @deprecated will be replaced by `isEditorMode` with the next major version of the SDK */
145
- isInExpEditorMode?: boolean;
146
- };
147
- type ComponentRegistrationOptions = {
148
- /**
149
- * Restrict the list of built-in components to a defined set of IDs.
150
- * @example ['contentful-container', 'contentful-button']
151
- */
152
- enabledBuiltInComponents?: string[];
153
- experimentalComponents?: {
154
- carousel?: boolean;
155
- };
156
- /**
157
- * Originally, the persisted values for `cfTextAlign` were plainly rendered
158
- * when generating the CSS code for a components styles. To enable right-to-left
159
- * directions natively, the alignment values were recently switched from
160
- * `left`/`right` to `start`/`end`. To save customers from manually replacing old
161
- * with new alignment values in every experience, we're translating them automatically
162
- * in the rendering logic as well. If this new behaviour introduces any issues,
163
- * customers can opt-out by setting this flag.
164
- * @deprecated This is a temporary solution and will be removed in a future major version.
165
- */
166
- __disableTextAlignmentTransform?: boolean;
167
- /**
168
- * If you need to adjust the built-in structural components (e.g. `container`),
169
- * enable this flag. It is marked as *unsafe* since the logic of those components
170
- * might evolve in future versions. By overwriting their implementation, you accept
171
- * the risk of potential breaking changes and running out of sync with the original
172
- * implementation.
173
- */
174
- __unsafe__enableBuiltInStructureOverwrites?: boolean;
175
- };
176
- type Binding = {
177
- spaceId: string;
178
- environmentId: string;
179
- entityId: string;
180
- entityType: 'Entry' | 'Asset' | 'ContentType';
181
- path: string[];
182
- };
183
- type ComponentBinding = Record<string, Binding>;
184
- type BindingMap = Record<string, ComponentBinding>;
185
- type BindingMapByBlockId = Record<string, BindingMap>;
186
- type DataSourceEntryValueType = Link<'Entry' | 'Asset'>;
187
- /** Type of a single node of the experience tree exchanged via postMessage between the SDK and Contentful Web app */
188
- type ExperienceTreeNode = {
189
- type: 'block' | 'root' | 'assembly' | 'assemblyBlock';
190
- data: {
191
- id: string;
192
- blockId?: string;
193
- slotId?: string;
194
- displayName?: string;
195
- props: Record<string, ComponentPropertyValue>;
196
- dataSource: ExperienceDataSource;
197
- unboundValues: ExperienceUnboundValues;
198
- breakpoints: Breakpoint[];
199
- parameters?: Record<string, Parameter>;
200
- prebindingId?: string;
201
- pattern?: {
202
- id: string;
203
- nodeId: string;
204
- nodeLocation: string;
205
- nodeIdOnPattern: string;
206
- isVisibilityPropertyExposed: boolean;
207
- variableNameToComponentValueKeyMap: Record<string, string>;
208
- };
209
- };
210
- children: ExperienceTreeNode[];
211
- parentId?: string;
212
- };
213
- /** Type of the tree data structure exchanged via postMessage between the SDK and Contentful Web app */
214
- type ExperienceTree = {
215
- root: ExperienceTreeNode;
216
- };
217
- /**
218
- * Internally defined style variables are prefix with `cf` to avoid
219
- * collisions with user defined variables.
220
- */
221
- type StyleProps = {
222
- cfVisibility: boolean;
223
- cfHorizontalAlignment: 'start' | 'end' | 'center' | 'stretch';
224
- cfVerticalAlignment: 'start' | 'end' | 'center' | 'stretch';
225
- cfMargin: string;
226
- cfPadding: string;
227
- cfBackgroundColor: string;
228
- cfWidth: string;
229
- cfMaxWidth: string;
230
- cfHeight: string;
231
- cfFlexDirection: 'row' | 'column';
232
- cfFlexWrap: 'nowrap' | 'wrap';
233
- cfFlexReverse: boolean;
234
- cfBorder: string;
235
- cfBorderRadius: string;
236
- cfGap: string;
237
- cfHyperlink: string;
238
- cfImageAsset: OptimizedImageAsset | string;
239
- cfImageOptions: ImageOptions;
240
- cfBackgroundImageUrl: OptimizedBackgroundImageAsset | string;
241
- cfBackgroundImageOptions: BackgroundImageOptions;
242
- cfOpenInNewTab: boolean;
243
- cfFontSize: string;
244
- cfFontWeight: string;
245
- cfLineHeight: string;
246
- cfLetterSpacing: string;
247
- cfTextColor: string;
248
- cfTextAlign: 'start' | 'center' | 'end';
249
- cfTextTransform: 'none' | 'capitalize' | 'uppercase' | 'lowercase';
250
- cfTextBold: boolean;
251
- cfTextItalic: boolean;
252
- cfTextUnderline: boolean;
253
- cfColumns: string;
254
- cfColumnSpan: string;
255
- cfColumnSpanLock: boolean;
256
- cfWrapColumns: boolean;
257
- cfWrapColumnsCount: string;
258
- };
259
- /**
260
- * Internally defined style variables mapped to each variable type
261
- */
262
- type DesignVariableTypes = {
263
- cfVisibility: 'Boolean';
264
- cfHorizontalAlignment: 'Text';
265
- cfVerticalAlignment: 'Text';
266
- cfMargin: 'Text';
267
- cfPadding: 'Text';
268
- cfBackgroundColor: 'Text';
269
- cfWidth: 'Text';
270
- cfMaxWidth: 'Text';
271
- cfHeight: 'Text';
272
- cfFlexDirection: 'Text';
273
- cfFlexWrap: 'Text';
274
- cfFlexReverse: 'Boolean';
275
- cfBorder: 'Text';
276
- cfBorderRadius: 'Text';
277
- cfGap: 'Text';
278
- cfHyperlink: 'Hyperlink';
279
- cfImageAsset: 'Media';
280
- cfImageOptions: 'Object';
281
- cfBackgroundImageUrl: 'Media';
282
- cfBackgroundImageOptions: 'Object';
283
- cfOpenInNewTab: 'Boolean';
284
- cfFontSize: 'Text';
285
- cfFontWeight: 'Text';
286
- cfLineHeight: 'Text';
287
- cfLetterSpacing: 'Text';
288
- cfTextColor: 'Text';
289
- cfTextAlign: 'Text';
290
- cfTextTransform: 'Text';
291
- cfTextBold: 'Boolean';
292
- cfTextItalic: 'Boolean';
293
- cfTextUnderline: 'Boolean';
294
- cfColumns: 'Text';
295
- cfColumnSpan: 'Text';
296
- cfColumnSpanLock: 'Boolean';
297
- cfWrapColumns: 'Boolean';
298
- cfWrapColumnsCount: 'Text';
299
- };
300
- type DesignVariableMap = {
301
- [K in keyof DesignVariableTypes]: ComponentDefinitionVariable<DesignVariableTypes[K]>;
302
- };
303
- type CSSProperties = React.CSSProperties;
304
- type ContainerStyleVariableName = keyof StyleProps;
305
- type ExperienceFields = {
306
- title: string;
307
- slug: string;
308
- componentTree: ExperienceComponentTree;
309
- dataSource: ExperienceDataSource;
310
- unboundValues: ExperienceUnboundValues;
311
- usedComponents?: ExperienceUsedComponents | Array<ExperienceEntry>;
312
- componentSettings?: ExperienceComponentSettings;
313
- };
314
- type RecursiveDesignTokenDefinition = {
315
- [key: string]: string | RecursiveDesignTokenDefinition;
316
- };
317
- type DesignBorderTokenStyle = 'solid' | 'dashed' | 'dotted';
318
- /** We are currently in the process of implementing this feature. Do not use this field in your designTokenDefinition. **/
319
- type DesignTextTokenEmphasis = 'bold' | 'italic' | 'underline' | 'bold italic' | 'bold underline' | 'italic underline' | 'bold italic underline' | 'none';
320
- /** We are currently in the process of implementing this feature. Do not use this field in your designTokenDefinition. **/
321
- type DesignTextTokenCase = 'capitalize' | 'uppercase' | 'lowercase' | 'normal';
322
- type DesignTokensDefinition = {
323
- spacing?: Record<string, string>;
324
- sizing?: Record<string, string>;
325
- color?: Record<string, string>;
326
- border?: Record<string, {
327
- width?: string;
328
- style?: DesignBorderTokenStyle;
329
- color?: string;
330
- }>;
331
- borderRadius?: Record<string, string>;
332
- fontSize?: Record<string, string>;
333
- lineHeight?: Record<string, string>;
334
- letterSpacing?: Record<string, string>;
335
- textColor?: Record<string, string>;
336
- /** We are currently in the process of implementing this feature. Do not use this field in your designTokenDefinition. **/
337
- text?: Record<string, {
338
- emphasis?: DesignTextTokenEmphasis;
339
- fontSize?: string;
340
- case?: DesignTextTokenCase;
341
- fontWeight?: string;
342
- lineHeight?: string;
343
- letterSpacing?: string;
344
- color?: string;
345
- }>;
346
- } & RecursiveDesignTokenDefinition;
347
- type SdkOptions = {
348
- __disableTextAlignmentTransform?: ComponentRegistrationOptions['__disableTextAlignmentTransform'];
349
- __unsafe__enableBuiltInStructureOverwrites?: ComponentRegistrationOptions['__unsafe__enableBuiltInStructureOverwrites'];
350
- };
351
- /** Type of experience entry JSON data structure as returned by CPA/CDA */
352
- type ExperienceEntry = {
353
- sys: Entry['sys'];
354
- fields: ExperienceFields;
355
- metadata: Entry['metadata'];
356
- };
357
- interface RawCoordinates {
358
- left: number;
359
- top: number;
360
- width: number;
361
- height: number;
362
- }
363
- interface Coordinates extends RawCoordinates {
364
- childrenCoordinates: RawCoordinates[];
365
- }
366
- interface HoveredElement {
367
- blockType: string | undefined;
368
- nodeId: string | undefined;
369
- blockId: string | undefined;
370
- }
371
- interface Experience<T extends EntityStore = EntityStore> {
372
- hyperlinkPattern?: string;
373
- entityStore?: T;
374
- }
375
- type ResolveDesignValueType = (valuesByBreakpoint: ValuesByBreakpoint | undefined, propertyName?: string) => PrimitiveValue;
376
- type ManagementEntity = (Entry | Asset) & {
377
- sys: {
378
- version: number;
379
- };
380
- };
381
- type RequestEntitiesMessage = {
382
- entityIds: string[];
383
- entityType: 'Asset' | 'Entry';
384
- locale: string;
385
- };
386
- type RequestedEntitiesMessage = {
387
- entities: Array<Entry | Asset>;
388
- missingEntityIds?: string[];
389
- };
390
- type BoundComponentPropertyTypes = string | number | boolean | AssetFile | Record<string, AssetFile | undefined> | Document | OptimizedBackgroundImageAsset | OptimizedImageAsset | Link<'Asset'> | Link<'Entry'> | Array<Link<'Asset' | 'Entry'>> | Entry | Asset | (string | Entry | Asset<ChainModifiers, string> | undefined)[] | undefined;
391
- type OptimizedImageAsset = {
392
- url: string;
393
- srcSet?: string[];
394
- sizes?: string;
395
- quality?: number;
396
- format?: string;
397
- file: AssetFile;
398
- loading?: ImageLoadingOption;
399
- };
400
- type OptimizedBackgroundImageAsset = {
401
- url: string;
402
- srcSet?: string[];
403
- file: AssetFile;
404
- };
405
- type ImageObjectFitOption = 'contain' | 'cover' | 'none';
406
- type ImageObjectPositionOption = 'left top' | 'left center' | 'left bottom' | 'right top' | 'right center' | 'right bottom' | 'center top' | 'center center' | 'center bottom';
407
- type ImageLoadingOption = 'lazy' | 'eager';
408
- type ImageOptions = {
409
- format?: string;
410
- width: string;
411
- height: string;
412
- loading?: ImageLoadingOption;
413
- objectFit?: ImageObjectFitOption;
414
- objectPosition?: ImageObjectPositionOption;
415
- quality?: string;
416
- targetSize: string;
417
- };
418
- type BackgroundImageScalingOption = 'fit' | 'fill' | 'tile';
419
- type BackgroundImageAlignmentOption = 'left top' | 'left center' | 'left bottom' | 'right top' | 'right center' | 'right bottom' | 'center top' | 'center center' | 'center bottom';
420
- type BackgroundImageOptions = {
421
- format?: string;
422
- scaling: BackgroundImageScalingOption;
423
- alignment: BackgroundImageAlignmentOption;
424
- quality?: string;
425
- targetSize: string;
426
- };
427
- type ConnectedPayload = undefined | {
428
- sdkVersion: string;
429
- definitions: ComponentDefinition[];
430
- };
431
- type DesignTokensPayload = {
432
- designTokens: DesignTokensDefinition;
433
- resolvedCssVariables: Record<string, string>;
434
- };
435
- type RegisteredBreakpointsPayload = {
436
- breakpoints: Breakpoint[];
437
- };
438
- type MouseMovePayload = {
439
- clientX: number;
440
- clientY: number;
441
- };
442
- type NewHoveredElementPayload = {
443
- nodeId?: string;
444
- };
445
- type ComponentSelectedPayload = {
446
- nodeId: string;
447
- assembly?: {
448
- id: string;
449
- componentId: string;
450
- nodeLocation: string | null;
451
- };
452
- };
453
- type RegisteredComponentsPayload = {
454
- definitions: ComponentDefinition[];
455
- };
456
- type RequestComponentTreeUpdatePayload = undefined;
457
- type ComponentDragCanceledPayload = undefined;
458
- type ComponentDroppedPayload = {
459
- node: ExperienceTreeNode;
460
- index: number;
461
- parentNode: {
462
- type?: ExperienceTreeNode['type'] | 'root';
463
- data: {
464
- blockId?: string;
465
- id?: string;
466
- };
467
- };
468
- };
469
- type ComponentMovedPayload = {
470
- nodeId: string;
471
- sourceParentId: string;
472
- destinationParentId: string;
473
- sourceIndex: number;
474
- destinationIndex: number;
475
- };
476
- type CanvasReloadPayload = undefined;
477
- type CanvasErrorPayload = Error;
478
- type UpdateSelectedComponentCoordinatesPayload = {
479
- selectedNodeCoordinates: DOMRect;
480
- selectedAssemblyChildCoordinates?: DOMRect;
481
- parentCoordinates?: DOMRect;
482
- };
483
- type CanvasScrollPayload = (typeof SCROLL_STATES)[keyof typeof SCROLL_STATES];
484
- type ComponentMoveStartedPayload = undefined;
485
- type ComponentMoveEndedPayload = undefined;
486
- type OutsideCanvasClickPayload = {
487
- outsideCanvasClick: boolean;
488
- };
489
- type SDKFeaturesPayload = Record<string, unknown>;
490
- type RequestEntitiesPayload = {
491
- entityIds: string[];
492
- entityType: 'Entry' | 'Asset';
493
- locale: string;
494
- };
495
- type OUTGOING_EVENT_PAYLOADS = {
496
- connected: ConnectedPayload;
497
- registerDesignTokens: DesignTokensPayload;
498
- registeredBreakpoints: RegisteredBreakpointsPayload;
499
- mouseMove: MouseMovePayload;
500
- newHoveredElement: NewHoveredElementPayload;
501
- componentSelected: ComponentSelectedPayload;
502
- registeredComponents: RegisteredComponentsPayload;
503
- requestComponentTreeUpdate: RequestComponentTreeUpdatePayload;
504
- componentDragCanceled: ComponentDragCanceledPayload;
505
- componentDropped: ComponentDroppedPayload;
506
- componentMoved: ComponentMovedPayload;
507
- canvasReload: CanvasReloadPayload;
508
- canvasError: CanvasErrorPayload;
509
- updateSelectedComponentCoordinates: UpdateSelectedComponentCoordinatesPayload;
510
- canvasScrolling: CanvasScrollPayload;
511
- componentMoveStarted: ComponentMoveStartedPayload;
512
- componentMoveEnded: ComponentMoveEndedPayload;
513
- outsideCanvasClick: OutsideCanvasClickPayload;
514
- sdkFeatures: SDKFeaturesPayload;
515
- REQUEST_ENTITIES: RequestEntitiesPayload;
516
- canvasGeometryUpdated: {
517
- size: {
518
- width: number;
519
- height: number;
520
- };
521
- nodes: Record<string, {
522
- coordinates: Pick<DOMRect, 'x' | 'y' | 'width' | 'height'>;
523
- }>;
524
- sourceEvent: CanvasGeometryUpdateSourceEvent;
525
- };
526
- canvasPan: {
527
- ctrlKey: boolean;
528
- metaKey: boolean;
529
- clientX: number;
530
- clientY: number;
531
- deltaX: number;
532
- deltaY: number;
533
- };
534
- };
535
- type CanvasGeometryUpdateSourceEvent = 'resize' | 'mutation' | 'mediaResize';
536
- type SendMessageParams = <T extends OutgoingEvent>(eventType: T, data: OUTGOING_EVENT_PAYLOADS[T]) => void;
537
- type OutgoingMessage = {
538
- [K in keyof OUTGOING_EVENT_PAYLOADS]: {
539
- source: 'customer-app';
540
- eventType: K;
541
- payload: OUTGOING_EVENT_PAYLOADS[K];
542
- };
543
- }[keyof OUTGOING_EVENT_PAYLOADS];
544
- type Filter<T, U> = T extends U ? T : never;
545
- type SelectedValueTypes = Filter<ComponentPropertyValue['type'], 'UnboundValue' | 'BoundValue'>;
546
- type RequestReadOnlyModePayload = undefined;
547
- type RequestEditorModePayload = undefined;
548
- type ExperienceUpdatedPayload = {
549
- tree: ExperienceTree;
550
- /** @deprecated not needed after `patternResolution` was introduced. Will be removed in the next major version. */
551
- assemblies?: ExperienceUsedComponents;
552
- locale: string;
553
- changedNode?: ExperienceTreeNode;
554
- changedValueType?: SelectedValueTypes;
555
- };
556
- /** @deprecated will be removed when dropping backward compatibility for old DND */
557
- type ComponentDraggingChangedPayload = {
558
- isDragging: boolean;
559
- };
560
- /** @deprecated will be removed when dropping backward compatibility for old DND */
561
- type IncomingComponentDragCanceledPayload = undefined;
562
- /** @deprecated will be removed when dropping backward compatibility for old DND */
563
- type ComponentDragStartedPayload = {
564
- id: string;
565
- isAssembly: boolean;
566
- };
567
- /** @deprecated will be removed when dropping backward compatibility for old DND */
568
- type ComponentDragEndedPayload = undefined;
569
- /** @deprecated will be removed when dropping backward compatibility for old DND */
570
- type IncomingComponentMoveEndedPayload = {
571
- mouseX: number;
572
- mouseY: number;
573
- };
574
- /** @deprecated will be removed when dropping backward compatibility for old DND */
575
- type CanvasResizedPayload = {
576
- selectedNodeId: string;
577
- };
578
- /** @deprecated will be removed when dropping backward compatibility for old DND */
579
- type SelectComponentPayload = {
580
- selectedNodeId: string;
581
- };
582
- /** @deprecated will be removed when dropping backward compatibility for old DND */
583
- type HoverComponentPayload = {
584
- hoveredNodeId: string;
585
- };
586
- type UpdatedEntityPayload = {
587
- entity: ManagementEntity;
588
- shouldRerender?: boolean;
589
- };
590
- type AssembliesAddedPayload = {
591
- assembly: ManagementEntity;
592
- assemblyDefinition: ComponentDefinition;
593
- };
594
- type AssembliesRegisteredPayload = {
595
- assemblies: ComponentDefinition[];
596
- };
597
- /** @deprecated will be removed when dropping backward compatibility for old DND */
598
- type IncomingMouseMovePayload = {
599
- mouseX: number;
600
- mouseY: number;
601
- };
602
- type RequestedEntitiesPayload = {
603
- entities: ManagementEntity[];
604
- };
605
- type INCOMING_EVENT_PAYLOADS = {
606
- requestEditorMode: RequestEditorModePayload;
607
- requestReadOnlyMode: RequestReadOnlyModePayload;
608
- componentTreeUpdated: ExperienceUpdatedPayload;
609
- componentDraggingChanged: ComponentDraggingChangedPayload;
610
- componentDragCanceled: IncomingComponentDragCanceledPayload;
611
- componentDragStarted: ComponentDragStartedPayload;
612
- componentDragEnded: ComponentDragEndedPayload;
613
- componentMoveEnded: IncomingComponentMoveEndedPayload;
614
- canvasResized: CanvasResizedPayload;
615
- selectComponent: SelectComponentPayload;
616
- hoverComponent: HoverComponentPayload;
617
- updatedEntity: UpdatedEntityPayload;
618
- assembliesAdded: AssembliesAddedPayload;
619
- assembliesRegistered: AssembliesRegisteredPayload;
620
- mouseMove: IncomingMouseMovePayload;
621
- REQUESTED_ENTITIES: RequestedEntitiesPayload;
622
- };
623
- type IncomingMessage = {
624
- [K in keyof INCOMING_EVENT_PAYLOADS]: {
625
- eventType: K;
626
- payload: INCOMING_EVENT_PAYLOADS[K];
627
- };
628
- }[keyof INCOMING_EVENT_PAYLOADS];
629
-
630
- export type { AssembliesAddedPayload, AssembliesRegisteredPayload, BackgroundImageAlignmentOption, BackgroundImageOptions, BackgroundImageScalingOption, Binding, BindingMap, BindingMapByBlockId, BoundComponentPropertyTypes, CSSProperties, CanvasErrorPayload, CanvasGeometryUpdateSourceEvent, 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, EditorProperties, EditorPropertyNames, 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, SdkOptions, SelectComponentPayload, SendMessageParams, StyleProps, UpdateSelectedComponentCoordinatesPayload, UpdatedEntityPayload, ValidationOption, VariableFormats };
@@ -1,26 +0,0 @@
1
- import { Breakpoint, PrimitiveValue, ValuesByBreakpoint, DesignValue } from '@contentful/experiences-validators';
2
-
3
- declare const MEDIA_QUERY_REGEXP: RegExp;
4
- declare const mediaQueryMatcher: (breakpoints: Breakpoint[]) => [{
5
- id: string;
6
- signal: MediaQueryList;
7
- }[], Record<string, boolean>];
8
- declare const getActiveBreakpointIndex: (breakpoints: Breakpoint[], mediaQueryMatches: Record<string, boolean>, fallbackBreakpointIndex: number) => number;
9
- declare const getFallbackBreakpointIndex: (breakpoints: Breakpoint[]) => number;
10
- declare const isValidBreakpointValue: (value: PrimitiveValue) => value is Exclude<PrimitiveValue, undefined>;
11
- declare const getValueForBreakpoint: (valuesByBreakpoint: ValuesByBreakpoint | undefined, breakpoints: Breakpoint[], activeBreakpointIndex: number, fallbackBreakpointIndex: number, propertyName?: string, resolveDesignTokens?: boolean) => string | number | boolean | Record<any, any> | undefined;
12
- declare function mergeDesignValuesByBreakpoint(defaultValue: DesignValue, overwriteValue: DesignValue | undefined): DesignValue;
13
- declare function mergeDesignValuesByBreakpoint(defaultValue: DesignValue | undefined, overwriteValue: DesignValue): DesignValue;
14
- declare function mergeDesignValuesByBreakpoint(defaultValue: DesignValue | undefined, overwriteValue: DesignValue | undefined): DesignValue | undefined;
15
- declare const BREAKPOINTS_STRATEGY_DESKTOP_FIRST = "desktop-first";
16
- declare const BREAKPOINTS_STRATEGY_MOBILE_FIRST = "mobile-first";
17
- type BreakpointsStrategy = typeof BREAKPOINTS_STRATEGY_DESKTOP_FIRST | typeof BREAKPOINTS_STRATEGY_MOBILE_FIRST | undefined;
18
- /**
19
- * Detects the breakpoint strategy based on the provided breakpoints.
20
- *
21
- * @param breakpoints The array of breakpoints to analyze.
22
- * @returns The detected breakpoint strategy or undefined if not determinable.
23
- */
24
- declare const detectBreakpointsStrategy: (breakpoints: Breakpoint[]) => BreakpointsStrategy;
25
-
26
- export { BREAKPOINTS_STRATEGY_DESKTOP_FIRST, BREAKPOINTS_STRATEGY_MOBILE_FIRST, type BreakpointsStrategy, MEDIA_QUERY_REGEXP, detectBreakpointsStrategy, getActiveBreakpointIndex, getFallbackBreakpointIndex, getValueForBreakpoint, isValidBreakpointValue, mediaQueryMatcher, mergeDesignValuesByBreakpoint };
@@ -1,17 +0,0 @@
1
- declare const structureComponentIds: Set<"contentful-section" | "contentful-container" | "contentful-columns" | "contentful-single-column">;
2
- type ComponentAllowOnRoot = {
3
- type?: string;
4
- category?: string;
5
- componentId?: string;
6
- };
7
- declare const allContentfulComponentIds: Set<"contentful-section" | "contentful-container" | "contentful-columns" | "contentful-single-column" | "contentful-button" | "contentful-heading" | "contentful-image" | "contentful-richText" | "contentful-text" | "contentful-divider" | "contentful-carousel">;
8
- type SetElement<ElementType> = ElementType extends Set<infer E> ? E : never;
9
- type StructureComponentId = SetElement<typeof structureComponentIds>;
10
- type AllContentfulComponentId = SetElement<typeof allContentfulComponentIds>;
11
- declare const isPatternComponent: (type?: string) => boolean;
12
- declare const isContentfulStructureComponent: (componentId?: string) => componentId is StructureComponentId;
13
- declare const isContentfulComponent: (componentId?: string) => componentId is AllContentfulComponentId;
14
- declare const isComponentAllowedOnRoot: ({ type, category, componentId }: ComponentAllowOnRoot) => boolean;
15
- declare const isStructureWithRelativeHeight: (componentId?: string, height?: string | number) => componentId is StructureComponentId;
16
-
17
- export { isComponentAllowedOnRoot, isContentfulComponent, isContentfulStructureComponent, isPatternComponent, isStructureWithRelativeHeight };