@contentful/experiences-core 1.35.0-dev-20250312T0909-245a333.0 → 1.35.0-prerelease-20250414T1325-5725f29.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/fetchers/createExperience.d.ts +10 -3
- package/dist/fetchers/fetchAllEntities.d.ts +2 -2
- package/dist/fetchers/fetchById.d.ts +2 -1
- package/dist/fetchers/fetchBySlug.d.ts +2 -1
- package/dist/fetchers/fetchExperienceEntry.d.ts +30 -0
- package/dist/fetchers/fetchReferencedEntities.d.ts +28 -0
- package/dist/index.d.ts +11 -8
- package/dist/index.js +1148 -1092
- package/dist/index.js.map +1 -1
- package/dist/utils/localizeEntity.d.ts +20 -0
- package/package.json +3 -3
|
@@ -0,0 +1,20 @@
|
|
|
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.
|
|
8
|
+
*
|
|
9
|
+
* If the entity is already localized, it will return the entity as is.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```
|
|
13
|
+
* const multiLocaleEntry = { fields: { title: { 'en-US': 'Hello' } } };
|
|
14
|
+
* const localizedEntry = localizeEntity(multiLocaleEntry, 'en-US');
|
|
15
|
+
* console.log(localizedEntry.fields.title); // 'Hello'
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
declare function localizeEntity<T extends Asset | Entry>(entity: T, locale: string): T;
|
|
19
|
+
|
|
20
|
+
export { localizeEntity };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experiences-core",
|
|
3
|
-
"version": "1.35.0-
|
|
3
|
+
"version": "1.35.0-prerelease-20250414T1325-5725f29.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.35.0-
|
|
73
|
+
"@contentful/experiences-validators": "1.35.0-prerelease-20250414T1325-5725f29.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": "
|
|
79
|
+
"gitHead": "353c5494f903fafb7c01821f002725bdbd119dbc"
|
|
80
80
|
}
|