@prezly/theme-kit-nextjs 1.8.0 → 1.9.2-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 (64) hide show
  1. package/build/adapter-nextjs/index.d.ts +1 -0
  2. package/build/adapter-nextjs/index.js +1 -0
  3. package/build/adapter-nextjs/index.js.map +1 -1
  4. package/build/adapter-nextjs/page-props/category.d.ts +14 -0
  5. package/build/adapter-nextjs/page-props/category.js +107 -0
  6. package/build/adapter-nextjs/page-props/category.js.map +1 -0
  7. package/build/adapter-nextjs/page-props/gallery.d.ts +13 -0
  8. package/build/adapter-nextjs/page-props/gallery.js +101 -0
  9. package/build/adapter-nextjs/page-props/gallery.js.map +1 -0
  10. package/build/adapter-nextjs/page-props/galleryAlbum.d.ts +7 -0
  11. package/build/adapter-nextjs/page-props/galleryAlbum.js +87 -0
  12. package/build/adapter-nextjs/page-props/galleryAlbum.js.map +1 -0
  13. package/build/adapter-nextjs/page-props/home.d.ts +14 -0
  14. package/build/adapter-nextjs/page-props/home.js +101 -0
  15. package/build/adapter-nextjs/page-props/home.js.map +1 -0
  16. package/build/adapter-nextjs/page-props/index.d.ts +6 -0
  17. package/build/adapter-nextjs/page-props/index.js +16 -0
  18. package/build/adapter-nextjs/page-props/index.js.map +1 -0
  19. package/build/adapter-nextjs/page-props/lib/types.d.ts +3 -0
  20. package/build/adapter-nextjs/page-props/lib/types.js +3 -0
  21. package/build/adapter-nextjs/page-props/lib/types.js.map +1 -0
  22. package/build/adapter-nextjs/page-props/story.d.ts +3 -0
  23. package/build/adapter-nextjs/page-props/story.js +107 -0
  24. package/build/adapter-nextjs/page-props/story.js.map +1 -0
  25. package/build/adapter-nextjs/page-props/storyPreview.d.ts +3 -0
  26. package/build/adapter-nextjs/page-props/storyPreview.js +90 -0
  27. package/build/adapter-nextjs/page-props/storyPreview.js.map +1 -0
  28. package/build/data-fetching/api/PrezlyApi.d.ts +3 -8
  29. package/build/data-fetching/api/PrezlyApi.js +0 -40
  30. package/build/data-fetching/api/PrezlyApi.js.map +1 -1
  31. package/build/data-fetching/api/languages.js +1 -1
  32. package/build/data-fetching/api/languages.js.map +1 -1
  33. package/build/data-fetching/api/queries.d.ts +0 -23
  34. package/build/data-fetching/api/queries.js +1 -10
  35. package/build/data-fetching/api/queries.js.map +1 -1
  36. package/build/data-fetching/constants.d.ts +1 -0
  37. package/build/data-fetching/constants.js +2 -1
  38. package/build/data-fetching/constants.js.map +1 -1
  39. package/build/newsroom-context/context.d.ts +2 -6
  40. package/build/newsroom-context/context.js +1 -2
  41. package/build/newsroom-context/context.js.map +1 -1
  42. package/build/newsroom-context/hooks/index.d.ts +0 -1
  43. package/build/newsroom-context/hooks/index.js +0 -1
  44. package/build/newsroom-context/hooks/index.js.map +1 -1
  45. package/package.json +4 -5
  46. package/src/adapter-nextjs/index.ts +1 -0
  47. package/src/adapter-nextjs/page-props/category.ts +74 -0
  48. package/src/adapter-nextjs/page-props/gallery.ts +64 -0
  49. package/src/adapter-nextjs/page-props/galleryAlbum.ts +40 -0
  50. package/src/adapter-nextjs/page-props/home.ts +64 -0
  51. package/src/adapter-nextjs/page-props/index.ts +6 -0
  52. package/src/adapter-nextjs/page-props/lib/types.ts +8 -0
  53. package/src/adapter-nextjs/page-props/story.ts +47 -0
  54. package/src/adapter-nextjs/page-props/storyPreview.ts +35 -0
  55. package/src/data-fetching/api/PrezlyApi.ts +0 -26
  56. package/src/data-fetching/api/languages.ts +1 -1
  57. package/src/data-fetching/api/queries.ts +0 -10
  58. package/src/data-fetching/constants.ts +1 -0
  59. package/src/newsroom-context/context.tsx +0 -7
  60. package/src/newsroom-context/hooks/index.ts +0 -1
  61. package/build/newsroom-context/hooks/useEmbedStory.d.ts +0 -2
  62. package/build/newsroom-context/hooks/useEmbedStory.js +0 -13
  63. package/build/newsroom-context/hooks/useEmbedStory.js.map +0 -1
  64. package/src/newsroom-context/hooks/useEmbedStory.ts +0 -13
@@ -0,0 +1,74 @@
1
+ import type { ExtraStoryFields, Story } from '@prezly/sdk';
2
+ import type { GetServerSidePropsContext, GetServerSidePropsResult } from 'next';
3
+
4
+ import { DEFAULT_PAGE_SIZE } from '../../data-fetching';
5
+ import type { PaginationProps } from '../../infinite-loading/types';
6
+ import { getNewsroomServerSideProps } from '../getNewsroomServerSideProps';
7
+ import { processRequest } from '../processRequest';
8
+
9
+ import type { PropsFunction } from './lib/types';
10
+
11
+ export interface CategoryPageProps<StoryType extends Story = Story> {
12
+ stories: StoryType[];
13
+ pagination: PaginationProps;
14
+ }
15
+
16
+ interface Options {
17
+ storiesIncludeFields?: (keyof ExtraStoryFields)[];
18
+ pageSize?: number;
19
+ }
20
+
21
+ export function getCategoryPageServerSideProps<
22
+ CustomProps extends Record<string, any>,
23
+ StoryType extends Story = Story,
24
+ >(customProps: CustomProps | PropsFunction<CustomProps>, options?: Options) {
25
+ const { pageSize = DEFAULT_PAGE_SIZE, storiesIncludeFields } = options || {};
26
+
27
+ return async function getServerSideProps(
28
+ context: GetServerSidePropsContext,
29
+ ): Promise<GetServerSidePropsResult<CategoryPageProps<StoryType> & CustomProps>> {
30
+ const { api, serverSideProps } = await getNewsroomServerSideProps(context);
31
+
32
+ const { slug } = context.params as { slug: string };
33
+ const category = await api.getCategoryBySlug(slug);
34
+
35
+ if (!category) {
36
+ return {
37
+ notFound: true,
38
+ };
39
+ }
40
+
41
+ const { query } = context;
42
+ const page = query.page && typeof query.page === 'string' ? Number(query.page) : undefined;
43
+
44
+ const { localeCode } = serverSideProps.newsroomContextProps;
45
+
46
+ const { stories, storiesTotal } = await api.getStoriesFromCategory(category, {
47
+ page,
48
+ include: storiesIncludeFields,
49
+ localeCode,
50
+ });
51
+
52
+ return processRequest(
53
+ context,
54
+ {
55
+ ...serverSideProps,
56
+ newsroomContextProps: {
57
+ ...serverSideProps.newsroomContextProps,
58
+ currentCategory: category,
59
+ },
60
+ // TODO: This is temporary until return types from API are figured out
61
+ stories: stories as StoryType[],
62
+ pagination: {
63
+ itemsTotal: storiesTotal,
64
+ currentPage: page ?? 1,
65
+ pageSize,
66
+ },
67
+ ...(typeof customProps === 'function'
68
+ ? await (customProps as PropsFunction<CustomProps>)(context, serverSideProps)
69
+ : customProps),
70
+ },
71
+ `/category/${slug}`,
72
+ );
73
+ };
74
+ }
@@ -0,0 +1,64 @@
1
+ import type { NewsroomGallery } from '@prezly/sdk';
2
+ import type { GetServerSidePropsContext, GetServerSidePropsResult } from 'next';
3
+
4
+ import { DEFAULT_GALLERY_PAGE_SIZE } from '../../data-fetching';
5
+ import type { PaginationProps } from '../../infinite-loading/types';
6
+ import { getNewsroomServerSideProps } from '../getNewsroomServerSideProps';
7
+ import { processRequest } from '../processRequest';
8
+
9
+ import type { PropsFunction } from './lib/types';
10
+
11
+ export interface GalleryPageProps {
12
+ galleries: NewsroomGallery[];
13
+ pagination: PaginationProps;
14
+ }
15
+
16
+ interface Options {
17
+ pageSize?: number;
18
+ }
19
+
20
+ export function getGalleryPageServerSideProps<CustomProps extends Record<string, any>>(
21
+ customProps: CustomProps | PropsFunction<CustomProps>,
22
+ options?: Options,
23
+ ) {
24
+ const { pageSize = DEFAULT_GALLERY_PAGE_SIZE } = options || {};
25
+
26
+ return async function getServerSideProps(
27
+ context: GetServerSidePropsContext,
28
+ ): Promise<GetServerSidePropsResult<GalleryPageProps & CustomProps>> {
29
+ const { api, serverSideProps } = await getNewsroomServerSideProps(context);
30
+ const { query } = context;
31
+
32
+ const page = query.page && typeof query.page === 'string' ? Number(query.page) : undefined;
33
+ const { galleries, pagination } = await api.getGalleries({ page, pageSize });
34
+
35
+ // If there's only one gallery, redirect to it immediately
36
+ if (galleries.length === 1) {
37
+ const { uuid } = galleries[0];
38
+
39
+ return {
40
+ redirect: {
41
+ destination: `/media/album/${uuid}`,
42
+ permanent: false,
43
+ },
44
+ };
45
+ }
46
+
47
+ return processRequest(
48
+ context,
49
+ {
50
+ ...serverSideProps,
51
+ galleries,
52
+ pagination: {
53
+ itemsTotal: pagination.matched_records_number,
54
+ currentPage: page ?? 1,
55
+ pageSize,
56
+ },
57
+ ...(typeof customProps === 'function'
58
+ ? await (customProps as PropsFunction<CustomProps>)(context, serverSideProps)
59
+ : customProps),
60
+ },
61
+ '/media',
62
+ );
63
+ };
64
+ }
@@ -0,0 +1,40 @@
1
+ import type { NewsroomGallery } from '@prezly/sdk';
2
+ import type { GetServerSidePropsContext, GetServerSidePropsResult } from 'next';
3
+
4
+ import { getNewsroomServerSideProps } from '../getNewsroomServerSideProps';
5
+ import { processRequest } from '../processRequest';
6
+
7
+ import type { PropsFunction } from './lib/types';
8
+
9
+ export interface GalleryAlbumPageProps {
10
+ gallery: NewsroomGallery;
11
+ }
12
+
13
+ export function getGalleryAlbumPageServerSideProps<CustomProps extends Record<string, any>>(
14
+ customProps: CustomProps | PropsFunction<CustomProps>,
15
+ ) {
16
+ return async function getServerSideProps(
17
+ context: GetServerSidePropsContext,
18
+ ): Promise<GetServerSidePropsResult<GalleryAlbumPageProps & CustomProps>> {
19
+ const { api, serverSideProps } = await getNewsroomServerSideProps(context);
20
+
21
+ const { uuid } = context.params as { uuid: string };
22
+ const gallery = await api.getGallery(uuid);
23
+
24
+ if (!gallery || !gallery.images_number) {
25
+ return { notFound: true };
26
+ }
27
+
28
+ return processRequest(
29
+ context,
30
+ {
31
+ ...serverSideProps,
32
+ gallery,
33
+ ...(typeof customProps === 'function'
34
+ ? await (customProps as PropsFunction<CustomProps>)(context, serverSideProps)
35
+ : customProps),
36
+ },
37
+ `/media/album/${uuid}`,
38
+ );
39
+ };
40
+ }
@@ -0,0 +1,64 @@
1
+ import type { ExtraStoryFields, Story } from '@prezly/sdk';
2
+ import type { GetServerSidePropsContext, GetServerSidePropsResult } from 'next';
3
+
4
+ import { DEFAULT_PAGE_SIZE } from '../../data-fetching';
5
+ import type { PaginationProps } from '../../infinite-loading/types';
6
+ import { getNewsroomServerSideProps } from '../getNewsroomServerSideProps';
7
+ import { processRequest } from '../processRequest';
8
+
9
+ import type { PropsFunction } from './lib/types';
10
+
11
+ export interface HomePageProps<StoryType extends Story = Story> {
12
+ stories: StoryType[];
13
+ pagination: PaginationProps;
14
+ }
15
+
16
+ interface Options {
17
+ storiesIncludeFields?: (keyof ExtraStoryFields)[];
18
+ pageSize?: number;
19
+ }
20
+
21
+ export function getHomepageServerSideProps<
22
+ CustomProps extends Record<string, any>,
23
+ StoryType extends Story = Story,
24
+ >(customProps: CustomProps | PropsFunction<CustomProps>, options?: Options) {
25
+ const { pageSize = DEFAULT_PAGE_SIZE, storiesIncludeFields } = options || {};
26
+
27
+ return async function getServerSideProps(
28
+ context: GetServerSidePropsContext,
29
+ ): Promise<GetServerSidePropsResult<HomePageProps<StoryType> & CustomProps>> {
30
+ const { api, serverSideProps } = await getNewsroomServerSideProps(context, {
31
+ loadHomepageContacts: true,
32
+ });
33
+
34
+ const { query } = context;
35
+ const page = query.page && typeof query.page === 'string' ? Number(query.page) : undefined;
36
+
37
+ const { localeCode } = serverSideProps.newsroomContextProps;
38
+
39
+ const storiesPaginated = await api.getStories({
40
+ page,
41
+ include: storiesIncludeFields,
42
+ localeCode,
43
+ });
44
+ const { stories, storiesTotal } = storiesPaginated;
45
+
46
+ return processRequest(
47
+ context,
48
+ {
49
+ ...serverSideProps,
50
+ // TODO: This is temporary until return types from API are figured out
51
+ stories: stories as StoryType[],
52
+ pagination: {
53
+ itemsTotal: storiesTotal,
54
+ currentPage: page ?? 1,
55
+ pageSize,
56
+ },
57
+ ...(typeof customProps === 'function'
58
+ ? await (customProps as PropsFunction<CustomProps>)(context, serverSideProps)
59
+ : customProps),
60
+ },
61
+ '/',
62
+ );
63
+ };
64
+ }
@@ -0,0 +1,6 @@
1
+ export { getCategoryPageServerSideProps, type CategoryPageProps } from './category';
2
+ export { getGalleryPageServerSideProps, type GalleryPageProps } from './gallery';
3
+ export { getGalleryAlbumPageServerSideProps, type GalleryAlbumPageProps } from './galleryAlbum';
4
+ export { getHomepageServerSideProps, type HomePageProps } from './home';
5
+ export { getStoryPageServerSideProps } from './story';
6
+ export { getStoryPreviewPageServerSideProps } from './storyPreview';
@@ -0,0 +1,8 @@
1
+ import type { GetServerSidePropsContext } from 'next';
2
+
3
+ import type { PageProps } from '../../../types';
4
+
5
+ export type PropsFunction<CustomProps> = (
6
+ context: GetServerSidePropsContext,
7
+ props: PageProps,
8
+ ) => CustomProps | Promise<CustomProps>;
@@ -0,0 +1,47 @@
1
+ import type { GetServerSidePropsContext, GetServerSidePropsResult } from 'next';
2
+
3
+ import { getPrezlyApi } from '../../data-fetching';
4
+ import { DUMMY_DEFAULT_LOCALE } from '../../intl';
5
+ import { getNewsroomServerSideProps } from '../getNewsroomServerSideProps';
6
+ import { processRequest } from '../processRequest';
7
+
8
+ import type { PropsFunction } from './lib/types';
9
+
10
+ export function getStoryPageServerSideProps<CustomProps extends Record<string, any>>(
11
+ customProps: CustomProps | PropsFunction<CustomProps>,
12
+ ) {
13
+ return async function getServerSideProps(
14
+ context: GetServerSidePropsContext,
15
+ ): Promise<GetServerSidePropsResult<CustomProps>> {
16
+ const api = getPrezlyApi(context.req);
17
+
18
+ const { slug } = context.params as { slug?: string };
19
+ const story = slug ? await api.getStoryBySlug(slug) : null;
20
+ if (!story) {
21
+ return { notFound: true };
22
+ }
23
+
24
+ const { serverSideProps } = await getNewsroomServerSideProps(context, { story });
25
+
26
+ const { locale } = context;
27
+ if (locale && locale !== DUMMY_DEFAULT_LOCALE) {
28
+ return {
29
+ redirect: {
30
+ destination: `/${slug}`,
31
+ permanent: true,
32
+ },
33
+ };
34
+ }
35
+
36
+ return processRequest(context, {
37
+ ...serverSideProps,
38
+ newsroomContextProps: {
39
+ ...serverSideProps.newsroomContextProps,
40
+ currentStory: story,
41
+ },
42
+ ...(typeof customProps === 'function'
43
+ ? await (customProps as PropsFunction<CustomProps>)(context, serverSideProps)
44
+ : customProps),
45
+ });
46
+ };
47
+ }
@@ -0,0 +1,35 @@
1
+ import type { GetServerSidePropsContext, GetServerSidePropsResult } from 'next';
2
+
3
+ import { getPrezlyApi } from '../../data-fetching';
4
+ import { getNewsroomServerSideProps } from '../getNewsroomServerSideProps';
5
+ import { processRequest } from '../processRequest';
6
+
7
+ import type { PropsFunction } from './lib/types';
8
+
9
+ export function getStoryPreviewPageServerSideProps<CustomProps extends Record<string, any>>(
10
+ customProps: CustomProps | PropsFunction<CustomProps>,
11
+ ) {
12
+ return async function getServerSideProps(
13
+ context: GetServerSidePropsContext,
14
+ ): Promise<GetServerSidePropsResult<CustomProps>> {
15
+ const api = getPrezlyApi(context.req);
16
+ const { uuid } = context.params as { uuid: string };
17
+ const story = await api.getStory(uuid);
18
+ if (!story) {
19
+ return { notFound: true };
20
+ }
21
+
22
+ const { serverSideProps } = await getNewsroomServerSideProps(context, { story });
23
+
24
+ return processRequest(context, {
25
+ ...serverSideProps,
26
+ newsroomContextProps: {
27
+ ...serverSideProps.newsroomContextProps,
28
+ currentStory: story,
29
+ },
30
+ ...(typeof customProps === 'function'
31
+ ? await (customProps as PropsFunction<CustomProps>)(context, serverSideProps)
32
+ : customProps),
33
+ });
34
+ };
35
+ }
@@ -1,14 +1,11 @@
1
1
  import type {
2
2
  Category,
3
- ExtendedStory,
4
3
  ExtraStoryFields,
5
4
  Newsroom,
6
5
  NewsroomLanguageSettings,
7
6
  Story,
8
7
  } from '@prezly/sdk';
9
8
  import PrezlySDK from '@prezly/sdk';
10
- import type { StoryBookmarkNode } from '@prezly/slate-types';
11
- import { isStoryBookmarkNode } from '@prezly/slate-types';
12
9
  import type { IncomingMessage } from 'http';
13
10
 
14
11
  import { LocaleObject } from '../../intl';
@@ -25,7 +22,6 @@ import {
25
22
  } from './languages';
26
23
  import {
27
24
  getContactsQuery,
28
- getEmbedStoriesQuery,
29
25
  getGalleriesQuery,
30
26
  getSlugQuery,
31
27
  getSortByPublishedDate,
@@ -232,28 +228,6 @@ export class PrezlyApi {
232
228
  return null;
233
229
  }
234
230
 
235
- /**
236
- * Returns summaries for stories embed in the current story (like in Bookmark Blocks)
237
- * @returns a map of `Story` object with their UUID as keys
238
- */
239
- async getEmbedStories(story: ExtendedStory) {
240
- const nodes = JSON.parse(story.content);
241
-
242
- const embedUuids: Array<string> = await Promise.all(
243
- nodes.children.filter(isStoryBookmarkNode).map((c: StoryBookmarkNode) => c.story.uuid),
244
- );
245
-
246
- const jsonQuery = JSON.stringify(getEmbedStoriesQuery(this.newsroomUuid, embedUuids));
247
- const { stories } = await this.searchStories({
248
- jsonQuery,
249
- });
250
-
251
- return stories.reduce<Record<Story['uuid'], Story>>(
252
- (result, embedStory) => ({ ...result, [embedStory.uuid]: embedStory }),
253
- {},
254
- );
255
- }
256
-
257
231
  async getNewsroomServerSideProps(
258
232
  request: IncomingMessage | undefined,
259
233
  nextLocaleIsoCode?: string,
@@ -101,7 +101,7 @@ export function getLanguageFromNextLocaleIsoCode(
101
101
  const locale = LocaleObject.fromAnyCode(nextLocaleIsoCode);
102
102
  let targetLanguage: NewsroomLanguageSettings | undefined;
103
103
 
104
- if (nextLocaleIsoCode.length === 2) {
104
+ if (nextLocaleIsoCode.length >= 2 && nextLocaleIsoCode.length <= 4) {
105
105
  targetLanguage =
106
106
  getLanguageByExactLocaleCode(languages, locale) ||
107
107
  getLanguageByNeutralLocaleCode(languages, locale) ||
@@ -18,16 +18,6 @@ export function getSlugQuery(newsroomUuid: string, slug: string) {
18
18
  };
19
19
  }
20
20
 
21
- export function getEmbedStoriesQuery(newsroomUuid: string, uuids: string[]) {
22
- return {
23
- $and: [
24
- { 'newsroom.uuid': { $in: [newsroomUuid] } },
25
- { uuid: { $in: uuids } },
26
- ...publishedAndAccessible,
27
- ],
28
- };
29
- }
30
-
31
21
  export function getStoriesQuery(newsroomUuid: string, categoryId?: number, localeCode?: string) {
32
22
  const query: any = {
33
23
  $and: [...publishedAndPublic, { 'newsroom.uuid': { $in: [newsroomUuid] } }],
@@ -1,2 +1,3 @@
1
1
  export const ASSETS_URL = 'https://cdn.uc.assets.prezly.com';
2
2
  export const DEFAULT_PAGE_SIZE = 12;
3
+ export const DEFAULT_GALLERY_PAGE_SIZE = 6;
@@ -6,7 +6,6 @@ import type {
6
6
  NewsroomContact,
7
7
  NewsroomLanguageSettings,
8
8
  NewsroomThemePreset,
9
- Story,
10
9
  } from '@prezly/sdk';
11
10
  import type { PropsWithChildren } from 'react';
12
11
  import { createContext, useMemo } from 'react';
@@ -40,10 +39,6 @@ export interface NewsroomContextType {
40
39
  * Optional: Refers to a currently selected story when navigated to `/[slug]` page.
41
40
  */
42
41
  currentStory?: ExtendedStory;
43
- /**
44
- * Optional: Embed stories data referenced from the current story content (currently used by Story Bookmark blocks)
45
- */
46
- embedStories?: Record<Story['uuid'], Story>;
47
42
  /**
48
43
  * List of currently enabled newsroom languages, as well as company information translated for each language
49
44
  */
@@ -80,7 +75,6 @@ export function NewsroomContextProvider({
80
75
  newsroom,
81
76
  currentCategory,
82
77
  currentStory,
83
- embedStories,
84
78
  companyInformation,
85
79
  languages,
86
80
  localeCode,
@@ -101,7 +95,6 @@ export function NewsroomContextProvider({
101
95
  newsroom,
102
96
  currentCategory,
103
97
  currentStory,
104
- embedStories,
105
98
  companyInformation,
106
99
  languages,
107
100
  locale,
@@ -4,7 +4,6 @@ export * from './useCompanyInformation';
4
4
  export * from './useCurrentCategory';
5
5
  export * from './useCurrentLocale';
6
6
  export * from './useCurrentStory';
7
- export * from './useEmbedStory';
8
7
  export * from './useGetLinkLocaleSlug';
9
8
  export * from './useGetTranslationUrl';
10
9
  export * from './useLanguages';
@@ -1,2 +0,0 @@
1
- import type { Story } from '@prezly/sdk';
2
- export declare function useEmbedStory(uuid: Story['uuid']): Story | undefined;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useEmbedStory = void 0;
4
- var useNewsroomContext_1 = require("./useNewsroomContext");
5
- function useEmbedStory(uuid) {
6
- var context = (0, useNewsroomContext_1.useNewsroomContext)();
7
- if (!context.embedStories) {
8
- return undefined;
9
- }
10
- return context.embedStories[uuid];
11
- }
12
- exports.useEmbedStory = useEmbedStory;
13
- //# sourceMappingURL=useEmbedStory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useEmbedStory.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useEmbedStory.ts"],"names":[],"mappings":";;;AAEA,2DAA0D;AAE1D,SAAgB,aAAa,CAAC,IAAmB;IAC7C,IAAM,OAAO,GAAG,IAAA,uCAAkB,GAAE,CAAC;IAErC,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE;QACvB,OAAO,SAAS,CAAC;KACpB;IAED,OAAO,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;AACtC,CAAC;AARD,sCAQC"}
@@ -1,13 +0,0 @@
1
- import type { Story } from '@prezly/sdk';
2
-
3
- import { useNewsroomContext } from './useNewsroomContext';
4
-
5
- export function useEmbedStory(uuid: Story['uuid']) {
6
- const context = useNewsroomContext();
7
-
8
- if (!context.embedStories) {
9
- return undefined;
10
- }
11
-
12
- return context.embedStories[uuid];
13
- }