@contentful/experiences-core 1.36.0 → 1.37.0-beta.2

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.
@@ -0,0 +1,24 @@
1
+ import { Asset, Entry } from 'contentful';
2
+
3
+ /**
4
+ * Localizes the provided entry or asset to match the regular format of CDA/CPA entities.
5
+ * Note that this function does not apply a fallback to the default locale nor does it check
6
+ * the content type for the localization setting of each field.
7
+ * It will simply resolve each field to the requested locale. As using single and multiple
8
+ * reference fields is still considered an experimental feature, this function does not handle
9
+ * recursive localization of deeper referenced entities.
10
+ *
11
+ * If the entity is already localized, it will return the entity as is.
12
+ *
13
+ * Note that localization is later on determined by the existence of the `sys.locale` property (matching the API shape).
14
+ *
15
+ * @example
16
+ * ```
17
+ * const multiLocaleEntry = { fields: { title: { 'en-US': 'Hello' } } };
18
+ * const localizedEntry = localizeEntity(multiLocaleEntry, 'en-US');
19
+ * console.log(localizedEntry.fields.title); // 'Hello'
20
+ * ```
21
+ */
22
+ declare function localizeEntity<T extends Asset | Entry>(entity: T, locale: string): T;
23
+
24
+ export { localizeEntity };
@@ -1,6 +1,6 @@
1
1
  import { Entry, Asset } from 'contentful/dist/types/types';
2
2
  import { ComponentPropertyValue, ExperienceUnboundValues, ExperienceDataSource, ExperienceComponentSettings } from '@contentful/experiences-validators';
3
- import { Experience, StyleProps, DesignTokensDefinition } from '../../types.js';
3
+ import { Experience, StyleProps, BackgroundImageOptions, DesignTokensDefinition } from '../../types.js';
4
4
 
5
5
  type FlattenedDesignTokens = Record<string, string | {
6
6
  width?: string;
@@ -10,14 +10,16 @@ type FlattenedDesignTokens = Record<string, string | {
10
10
  declare const detachExperienceStyles: (experience: Experience) => string | undefined;
11
11
  declare const isCfStyleAttribute: (variableName: string) => variableName is keyof StyleProps;
12
12
  declare const maybePopulateDesignTokenValue: (variableName: string, variableValue: unknown, mapOfDesignVariableKeys: FlattenedDesignTokens) => unknown;
13
- declare const resolveBackgroundImageBinding: ({ variableData, getBoundEntityById, dataSource, unboundValues, componentVariablesOverwrites, componentSettings, }: {
13
+ declare const resolveBackgroundImageBinding: ({ variableData, getBoundEntityById, dataSource, unboundValues, componentVariablesOverwrites, componentSettings, options, width, }: {
14
14
  variableData: ComponentPropertyValue;
15
15
  getBoundEntityById: (id: string) => Entry | Asset | undefined;
16
16
  unboundValues?: ExperienceUnboundValues;
17
17
  dataSource?: ExperienceDataSource;
18
18
  componentSettings?: ExperienceComponentSettings;
19
19
  componentVariablesOverwrites?: Record<string, ComponentPropertyValue>;
20
- }) => string | undefined;
20
+ options?: BackgroundImageOptions;
21
+ width?: string;
22
+ }) => any;
21
23
  /**
22
24
  * Takes the initial set of properties, filters only design properties that will be mapped to CSS and
23
25
  * re-organizes them to be indexed by breakpoint ID ("breakpoint > variable > value"). It will
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experiences-core",
3
- "version": "1.36.0",
3
+ "version": "1.37.0-beta.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -70,11 +70,11 @@
70
70
  "vitest": "^2.1.1"
71
71
  },
72
72
  "dependencies": {
73
- "@contentful/experiences-validators": "1.36.0",
73
+ "@contentful/experiences-validators": "1.37.0-beta.2",
74
74
  "@contentful/rich-text-types": "^17.0.0"
75
75
  },
76
76
  "peerDependencies": {
77
77
  "contentful": ">=10.6.0"
78
78
  },
79
- "gitHead": "663c2a4a06fd8f8574830961f01189ad02d2da44"
79
+ "gitHead": "cbcd3d8173ba2b7ea845d18265c7e95bdb43181a"
80
80
  }