@contentful/experiences-core 1.36.0-dev-20250417T1301-b6204ec.0 → 1.36.0-dev-20250422T1327-c14ac85.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.
@@ -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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experiences-core",
3
- "version": "1.36.0-dev-20250417T1301-b6204ec.0",
3
+ "version": "1.36.0-dev-20250422T1327-c14ac85.0",
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-dev-20250417T1301-b6204ec.0",
73
+ "@contentful/experiences-validators": "1.36.0-dev-20250422T1327-c14ac85.0",
74
74
  "@contentful/rich-text-types": "^17.0.0"
75
75
  },
76
76
  "peerDependencies": {
77
77
  "contentful": ">=10.6.0"
78
78
  },
79
- "gitHead": "cd80087cb920ddf6ba06e65f98a6fd8d7316149e"
79
+ "gitHead": "e913c210c14d417e3d2a45b8c672d6d1e66b46ee"
80
80
  }