@contentful/experiences-core 1.25.1 → 1.26.0-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.
- package/dist/fetchers/fetchById.d.ts +13 -8
- package/dist/fetchers/fetchBySlug.d.ts +13 -8
- package/dist/index.js +12 -11
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -2,17 +2,22 @@ import { Experience } from '../types.js';
|
|
|
2
2
|
import { ContentfulClientApi } from 'contentful';
|
|
3
3
|
import { EntityStore } from '../entity/EntityStore.js';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* @param {string} experienceTypeId - id of the content type associated with the experience
|
|
8
|
-
* @param {string} slug - slug of the experience (defined in entry settings)
|
|
9
|
-
* @param {string} localeCode - locale code to fetch the experience. Falls back to the currently active locale in the state
|
|
10
|
-
*/
|
|
11
|
-
declare function fetchById({ client, experienceTypeId, id, localeCode, }: {
|
|
5
|
+
type FetchByIdParams = {
|
|
6
|
+
/** instantiated client from the Contentful SDK */
|
|
12
7
|
client: ContentfulClientApi<undefined>;
|
|
8
|
+
/** id of the content type associated with the experience */
|
|
13
9
|
experienceTypeId: string;
|
|
10
|
+
/** id of the experience (defined in entry settings) */
|
|
14
11
|
id: string;
|
|
12
|
+
/** locale code to fetch the experience */
|
|
15
13
|
localeCode: string;
|
|
16
|
-
|
|
14
|
+
/** if the experience is being loaded in the Contentful Studio editor or not. If true, this function is a noop. */
|
|
15
|
+
isEditorMode?: boolean;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Fetches an experience object by its id
|
|
19
|
+
* @param {FetchByIdParams} options - options to fetch the experience
|
|
20
|
+
*/
|
|
21
|
+
declare function fetchById({ client, experienceTypeId, id, localeCode, isEditorMode, }: FetchByIdParams): Promise<Experience<EntityStore> | undefined>;
|
|
17
22
|
|
|
18
23
|
export { fetchById };
|
|
@@ -2,17 +2,22 @@ import { Experience } from '../types.js';
|
|
|
2
2
|
import { ContentfulClientApi } from 'contentful';
|
|
3
3
|
import { EntityStore } from '../entity/EntityStore.js';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* @param {string} experienceTypeId - id of the content type associated with the experience
|
|
8
|
-
* @param {string} slug - slug of the experience (defined in entry settings)
|
|
9
|
-
* @param {string} localeCode - locale code to fetch the experience. Falls back to the currently active locale in the state
|
|
10
|
-
*/
|
|
11
|
-
declare function fetchBySlug({ client, experienceTypeId, slug, localeCode, }: {
|
|
5
|
+
type FetchBySlugParams = {
|
|
6
|
+
/** instantiated client from the Contentful SDK */
|
|
12
7
|
client: ContentfulClientApi<undefined>;
|
|
8
|
+
/** id of the content type associated with the experience */
|
|
13
9
|
experienceTypeId: string;
|
|
10
|
+
/** slug of the experience (defined in entry settings) */
|
|
14
11
|
slug: string;
|
|
12
|
+
/** locale code to fetch the experience */
|
|
15
13
|
localeCode: string;
|
|
16
|
-
|
|
14
|
+
/** if the experience is being loaded in the Contentful Studio editor or not. If true, this function is a noop. */
|
|
15
|
+
isEditorMode?: boolean;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Fetches an experience object by its slug
|
|
19
|
+
* @param {FetchBySlugParams} options - options to fetch the experience
|
|
20
|
+
*/
|
|
21
|
+
declare function fetchBySlug({ client, experienceTypeId, slug, localeCode, isEditorMode, }: FetchBySlugParams): Promise<Experience<EntityStore> | undefined>;
|
|
17
22
|
|
|
18
23
|
export { fetchBySlug };
|
package/dist/index.js
CHANGED
|
@@ -3554,13 +3554,13 @@ const handleError$1 = (generalMessage, error) => {
|
|
|
3554
3554
|
throw Error(message);
|
|
3555
3555
|
};
|
|
3556
3556
|
/**
|
|
3557
|
-
*
|
|
3558
|
-
* @param {
|
|
3559
|
-
* @param {string} slug - slug of the experience (defined in entry settings)
|
|
3560
|
-
* @param {string} localeCode - locale code to fetch the experience. Falls back to the currently active locale in the state
|
|
3557
|
+
* Fetches an experience object by its slug
|
|
3558
|
+
* @param {FetchBySlugParams} options - options to fetch the experience
|
|
3561
3559
|
*/
|
|
3562
|
-
|
|
3563
|
-
|
|
3560
|
+
async function fetchBySlug({ client, experienceTypeId, slug, localeCode, isEditorMode, }) {
|
|
3561
|
+
//Be a no-op if in editor mode
|
|
3562
|
+
if (isEditorMode)
|
|
3563
|
+
return;
|
|
3564
3564
|
let experienceEntry = undefined;
|
|
3565
3565
|
try {
|
|
3566
3566
|
experienceEntry = await fetchExperienceEntry({
|
|
@@ -3606,12 +3606,13 @@ const handleError = (generalMessage, error) => {
|
|
|
3606
3606
|
throw Error(message);
|
|
3607
3607
|
};
|
|
3608
3608
|
/**
|
|
3609
|
-
*
|
|
3610
|
-
* @param {
|
|
3611
|
-
* @param {string} slug - slug of the experience (defined in entry settings)
|
|
3612
|
-
* @param {string} localeCode - locale code to fetch the experience. Falls back to the currently active locale in the state
|
|
3609
|
+
* Fetches an experience object by its id
|
|
3610
|
+
* @param {FetchByIdParams} options - options to fetch the experience
|
|
3613
3611
|
*/
|
|
3614
|
-
async function fetchById({ client, experienceTypeId, id, localeCode, }) {
|
|
3612
|
+
async function fetchById({ client, experienceTypeId, id, localeCode, isEditorMode, }) {
|
|
3613
|
+
//Be a no-op if in editor mode
|
|
3614
|
+
if (isEditorMode)
|
|
3615
|
+
return;
|
|
3615
3616
|
let experienceEntry = undefined;
|
|
3616
3617
|
try {
|
|
3617
3618
|
experienceEntry = await fetchExperienceEntry({
|