@prezly/theme-kit-nextjs 1.0.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/LICENSE +21 -0
- package/README.md +28 -0
- package/build/adapter-nextjs/getBasePageProps.d.ts +9 -0
- package/build/adapter-nextjs/getBasePageProps.js +11 -0
- package/build/adapter-nextjs/getBasePageProps.js.map +1 -0
- package/build/adapter-nextjs/index.d.ts +2 -0
- package/build/adapter-nextjs/index.js +3 -0
- package/build/adapter-nextjs/index.js.map +1 -0
- package/build/adapter-nextjs/processRequest.d.ts +3 -0
- package/build/adapter-nextjs/processRequest.js +20 -0
- package/build/adapter-nextjs/processRequest.js.map +1 -0
- package/build/data-fetching/api/PrezlyApi.d.ts +43 -0
- package/build/data-fetching/api/PrezlyApi.js +139 -0
- package/build/data-fetching/api/PrezlyApi.js.map +1 -0
- package/build/data-fetching/api/getPrezlyApi.d.ts +4 -0
- package/build/data-fetching/api/getPrezlyApi.js +17 -0
- package/build/data-fetching/api/getPrezlyApi.js.map +1 -0
- package/build/data-fetching/api/index.d.ts +2 -0
- package/build/data-fetching/api/index.js +3 -0
- package/build/data-fetching/api/index.js.map +1 -0
- package/build/data-fetching/api/languages.d.ts +18 -0
- package/build/data-fetching/api/languages.js +117 -0
- package/build/data-fetching/api/languages.js.map +1 -0
- package/build/data-fetching/api/queries.d.ts +45 -0
- package/build/data-fetching/api/queries.js +35 -0
- package/build/data-fetching/api/queries.js.map +1 -0
- package/build/data-fetching/constants.d.ts +2 -0
- package/build/data-fetching/constants.js +3 -0
- package/build/data-fetching/constants.js.map +1 -0
- package/build/data-fetching/getAssetsUrl.d.ts +1 -0
- package/build/data-fetching/getAssetsUrl.js +5 -0
- package/build/data-fetching/getAssetsUrl.js.map +1 -0
- package/build/data-fetching/getLocalizedCategoryData.d.ts +10 -0
- package/build/data-fetching/getLocalizedCategoryData.js +31 -0
- package/build/data-fetching/getLocalizedCategoryData.js.map +1 -0
- package/build/data-fetching/getNewsroomLogoUrl.d.ts +3 -0
- package/build/data-fetching/getNewsroomLogoUrl.js +14 -0
- package/build/data-fetching/getNewsroomLogoUrl.js.map +1 -0
- package/build/data-fetching/getPrivacyPortalUrl.d.ts +8 -0
- package/build/data-fetching/getPrivacyPortalUrl.js +9 -0
- package/build/data-fetching/getPrivacyPortalUrl.js.map +1 -0
- package/build/data-fetching/getStoryPublicationDate.d.ts +3 -0
- package/build/data-fetching/getStoryPublicationDate.jsx +10 -0
- package/build/data-fetching/getStoryPublicationDate.jsx.map +1 -0
- package/build/data-fetching/getUploadcareGroupUrl.d.ts +1 -0
- package/build/data-fetching/getUploadcareGroupUrl.js +5 -0
- package/build/data-fetching/getUploadcareGroupUrl.js.map +1 -0
- package/build/data-fetching/index.d.ts +9 -0
- package/build/data-fetching/index.js +10 -0
- package/build/data-fetching/index.js.map +1 -0
- package/build/data-fetching/lib/getAlgoliaSettings.d.ts +4 -0
- package/build/data-fetching/lib/getAlgoliaSettings.js +18 -0
- package/build/data-fetching/lib/getAlgoliaSettings.js.map +1 -0
- package/build/data-fetching/lib/getEnvVariables.d.ts +4 -0
- package/build/data-fetching/lib/getEnvVariables.js +37 -0
- package/build/data-fetching/lib/getEnvVariables.js.map +1 -0
- package/build/data-fetching/types.d.ts +11 -0
- package/build/data-fetching/types.js +2 -0
- package/build/data-fetching/types.js.map +1 -0
- package/build/index.d.ts +5 -0
- package/build/index.js +6 -0
- package/build/index.js.map +1 -0
- package/build/intl/index.d.ts +4 -0
- package/build/intl/index.js +5 -0
- package/build/intl/index.js.map +1 -0
- package/build/intl/lang.d.ts +12 -0
- package/build/intl/lang.js +25 -0
- package/build/intl/lang.js.map +1 -0
- package/build/intl/locale.d.ts +10 -0
- package/build/intl/locale.js +93 -0
- package/build/intl/locale.js.map +1 -0
- package/build/intl/localeConfig.d.ts +2 -0
- package/build/intl/localeConfig.js +113 -0
- package/build/intl/localeConfig.js.map +1 -0
- package/build/intl/localeObject.d.ts +22 -0
- package/build/intl/localeObject.js +59 -0
- package/build/intl/localeObject.js.map +1 -0
- package/build/newsroom-context/context.d.ts +26 -0
- package/build/newsroom-context/context.jsx +22 -0
- package/build/newsroom-context/context.jsx.map +1 -0
- package/build/newsroom-context/hooks/index.d.ts +11 -0
- package/build/newsroom-context/hooks/index.js +12 -0
- package/build/newsroom-context/hooks/index.js.map +1 -0
- package/build/newsroom-context/hooks/useAlgoliaSettings.d.ts +1 -0
- package/build/newsroom-context/hooks/useAlgoliaSettings.js +6 -0
- package/build/newsroom-context/hooks/useAlgoliaSettings.js.map +1 -0
- package/build/newsroom-context/hooks/useCategories.d.ts +1 -0
- package/build/newsroom-context/hooks/useCategories.js +6 -0
- package/build/newsroom-context/hooks/useCategories.js.map +1 -0
- package/build/newsroom-context/hooks/useCompanyInformation.d.ts +1 -0
- package/build/newsroom-context/hooks/useCompanyInformation.js +6 -0
- package/build/newsroom-context/hooks/useCompanyInformation.js.map +1 -0
- package/build/newsroom-context/hooks/useCurrentLocale.d.ts +1 -0
- package/build/newsroom-context/hooks/useCurrentLocale.js +6 -0
- package/build/newsroom-context/hooks/useCurrentLocale.js.map +1 -0
- package/build/newsroom-context/hooks/useGetLinkLocaleSlug.d.ts +2 -0
- package/build/newsroom-context/hooks/useGetLinkLocaleSlug.js +21 -0
- package/build/newsroom-context/hooks/useGetLinkLocaleSlug.js.map +1 -0
- package/build/newsroom-context/hooks/useGetTranslationUrl.d.ts +2 -0
- package/build/newsroom-context/hooks/useGetTranslationUrl.js +36 -0
- package/build/newsroom-context/hooks/useGetTranslationUrl.js.map +1 -0
- package/build/newsroom-context/hooks/useLanguages.d.ts +1 -0
- package/build/newsroom-context/hooks/useLanguages.js +6 -0
- package/build/newsroom-context/hooks/useLanguages.js.map +1 -0
- package/build/newsroom-context/hooks/useNewsroom.d.ts +1 -0
- package/build/newsroom-context/hooks/useNewsroom.js +6 -0
- package/build/newsroom-context/hooks/useNewsroom.js.map +1 -0
- package/build/newsroom-context/hooks/useNewsroomContext.d.ts +2 -0
- package/build/newsroom-context/hooks/useNewsroomContext.js +12 -0
- package/build/newsroom-context/hooks/useNewsroomContext.js.map +1 -0
- package/build/newsroom-context/hooks/useSelectedCategory.d.ts +1 -0
- package/build/newsroom-context/hooks/useSelectedCategory.js +6 -0
- package/build/newsroom-context/hooks/useSelectedCategory.js.map +1 -0
- package/build/newsroom-context/hooks/useSelectedStory.d.ts +1 -0
- package/build/newsroom-context/hooks/useSelectedStory.js +6 -0
- package/build/newsroom-context/hooks/useSelectedStory.js.map +1 -0
- package/build/newsroom-context/index.d.ts +2 -0
- package/build/newsroom-context/index.js +3 -0
- package/build/newsroom-context/index.js.map +1 -0
- package/build/types.d.ts +38 -0
- package/build/types.js +2 -0
- package/build/types.js.map +1 -0
- package/package.json +60 -0
- package/src/@types/global.d.ts +7 -0
- package/src/adapter-nextjs/getBasePageProps.ts +23 -0
- package/src/adapter-nextjs/index.ts +2 -0
- package/src/adapter-nextjs/processRequest.ts +31 -0
- package/src/data-fetching/api/PrezlyApi.ts +240 -0
- package/src/data-fetching/api/getPrezlyApi.ts +24 -0
- package/src/data-fetching/api/index.ts +2 -0
- package/src/data-fetching/api/languages.ts +172 -0
- package/src/data-fetching/api/queries.ts +44 -0
- package/src/data-fetching/constants.ts +2 -0
- package/src/data-fetching/getAssetsUrl.ts +5 -0
- package/src/data-fetching/getLocalizedCategoryData.ts +47 -0
- package/src/data-fetching/getNewsroomLogoUrl.ts +21 -0
- package/src/data-fetching/getPrivacyPortalUrl.ts +22 -0
- package/src/data-fetching/getStoryPublicationDate.tsx +15 -0
- package/src/data-fetching/getUploadcareGroupUrl.ts +5 -0
- package/src/data-fetching/index.ts +9 -0
- package/src/data-fetching/lib/getAlgoliaSettings.ts +29 -0
- package/src/data-fetching/lib/getEnvVariables.ts +44 -0
- package/src/data-fetching/types.ts +12 -0
- package/src/index.ts +5 -0
- package/src/intl/index.ts +4 -0
- package/src/intl/lang.ts +36 -0
- package/src/intl/locale.ts +118 -0
- package/src/intl/localeConfig.js +116 -0
- package/src/intl/localeObject.ts +73 -0
- package/src/newsroom-context/context.tsx +73 -0
- package/src/newsroom-context/hooks/index.ts +11 -0
- package/src/newsroom-context/hooks/useAlgoliaSettings.ts +7 -0
- package/src/newsroom-context/hooks/useCategories.ts +7 -0
- package/src/newsroom-context/hooks/useCompanyInformation.ts +7 -0
- package/src/newsroom-context/hooks/useCurrentLocale.ts +7 -0
- package/src/newsroom-context/hooks/useGetLinkLocaleSlug.ts +33 -0
- package/src/newsroom-context/hooks/useGetTranslationUrl.ts +61 -0
- package/src/newsroom-context/hooks/useLanguages.ts +7 -0
- package/src/newsroom-context/hooks/useNewsroom.ts +7 -0
- package/src/newsroom-context/hooks/useNewsroomContext.ts +14 -0
- package/src/newsroom-context/hooks/useSelectedCategory.ts +7 -0
- package/src/newsroom-context/hooks/useSelectedStory.ts +7 -0
- package/src/newsroom-context/index.ts +2 -0
- package/src/types.ts +56 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// TODO: Re-arrange the types to make them isolated to respective libs where possible
|
|
2
|
+
import type { AlgoliaSettings } from './data-fetching';
|
|
3
|
+
import type {
|
|
4
|
+
Category,
|
|
5
|
+
CultureRef,
|
|
6
|
+
ExtraStoryFields,
|
|
7
|
+
Newsroom,
|
|
8
|
+
NewsroomCompanyInformation,
|
|
9
|
+
NewsroomContact,
|
|
10
|
+
NewsroomLanguageSettings,
|
|
11
|
+
NewsroomThemePreset,
|
|
12
|
+
Story,
|
|
13
|
+
} from '@prezly/sdk';
|
|
14
|
+
|
|
15
|
+
export interface BasePageProps {
|
|
16
|
+
newsroom: Newsroom;
|
|
17
|
+
companyInformation: NewsroomCompanyInformation;
|
|
18
|
+
categories: Category[];
|
|
19
|
+
languages: NewsroomLanguageSettings[];
|
|
20
|
+
localeCode: string;
|
|
21
|
+
/**
|
|
22
|
+
* `false` means it's the default locale
|
|
23
|
+
*/
|
|
24
|
+
shortestLocaleCode: string | false;
|
|
25
|
+
localeResolved: boolean;
|
|
26
|
+
themePreset: NewsroomThemePreset;
|
|
27
|
+
algoliaSettings: AlgoliaSettings;
|
|
28
|
+
translations?: Translations;
|
|
29
|
+
contacts?: NewsroomContact[];
|
|
30
|
+
isTrackingEnabled?: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface PaginationProps {
|
|
34
|
+
itemsTotal: number;
|
|
35
|
+
currentPage: number;
|
|
36
|
+
pageSize: number;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type StoryWithImage = Story & Pick<ExtraStoryFields, 'thumbnail_image'>;
|
|
40
|
+
|
|
41
|
+
export interface AlgoliaCategoryRef {
|
|
42
|
+
id: number;
|
|
43
|
+
name: string;
|
|
44
|
+
slug: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export type AlgoliaStory = Pick<Story, 'uuid' | 'slug' | 'title' | 'subtitle'> &
|
|
48
|
+
Pick<ExtraStoryFields, 'thumbnail_image'> & {
|
|
49
|
+
content_text: string;
|
|
50
|
+
updated_at: number;
|
|
51
|
+
published_at: number;
|
|
52
|
+
culture: Pick<CultureRef, 'code' | 'name' | 'native_name' | 'language_code'>;
|
|
53
|
+
categories: AlgoliaCategoryRef[];
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export type Translations = Record<string, string>;
|