@prezly/theme-kit-nextjs 7.5.0 → 7.6.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/build/data-fetching/client.js +2 -2
- package/build/data-fetching/client.js.map +1 -1
- package/build/newsroom-context/context.d.ts +4 -4
- package/build/newsroom-context/context.js +2 -2
- package/build/newsroom-context/context.js.map +1 -1
- package/build/newsroom-context/hooks/index.d.ts +2 -1
- package/build/newsroom-context/hooks/index.js +2 -1
- package/build/newsroom-context/hooks/index.js.map +1 -1
- package/build/newsroom-context/hooks/useSearchClient.d.ts +2 -0
- package/build/newsroom-context/hooks/useSearchClient.js +15 -0
- package/build/newsroom-context/hooks/useSearchClient.js.map +1 -0
- package/build/newsroom-context/hooks/useSearchSettings.d.ts +1 -0
- package/build/newsroom-context/hooks/useSearchSettings.js +10 -0
- package/build/newsroom-context/hooks/useSearchSettings.js.map +1 -0
- package/package.json +5 -3
- package/build/newsroom-context/hooks/useAlgoliaSettings.d.ts +0 -1
- package/build/newsroom-context/hooks/useAlgoliaSettings.js +0 -10
- package/build/newsroom-context/hooks/useAlgoliaSettings.js.map +0 -1
|
@@ -24,7 +24,7 @@ function createClient(contentDelivery, request) {
|
|
|
24
24
|
const locale = theme_kit_core_1.LocaleObject.fromAnyCode(localeCode);
|
|
25
25
|
const companyInformation = (0, theme_kit_core_1.getCompanyInformation)(languages, locale);
|
|
26
26
|
const notifications = (0, theme_kit_core_1.getNotifications)(languages, locale);
|
|
27
|
-
const
|
|
27
|
+
const searchSettings = (0, server_1.getSearchSettings)(request);
|
|
28
28
|
return {
|
|
29
29
|
newsroomContextProps: (0, omit_undefined_1.omitUndefined)({
|
|
30
30
|
newsroom,
|
|
@@ -34,7 +34,7 @@ function createClient(contentDelivery, request) {
|
|
|
34
34
|
localeCode,
|
|
35
35
|
notifications,
|
|
36
36
|
themePreset: themePreset ?? null,
|
|
37
|
-
|
|
37
|
+
searchSettings,
|
|
38
38
|
contacts,
|
|
39
39
|
}),
|
|
40
40
|
localeResolved: Boolean(currentLanguage),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/data-fetching/client.ts"],"names":[],"mappings":";;;AACA,2DAMgC;AAEhC,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/data-fetching/client.ts"],"names":[],"mappings":";;;AACA,2DAMgC;AAEhC,0DAA6F;AAC7F,gEAA4D;AAG5D,kCAA2D;AAW3D,SAAgB,YAAY,CACxB,eAAuC,EACvC,OAAyB;IAEzB,OAAO;QACH,GAAG,eAAe;QAClB,KAAK,CAAC,0BAA0B,CAAC,iBAAiB,EAAE,KAAK,EAAE,oBAAoB,GAAG,KAAK;YACnF,MAAM,CAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;gBAC/E,eAAe,CAAC,QAAQ,EAAE;gBAC1B,eAAe,CAAC,SAAS,EAAE;gBAC3B,eAAe,CAAC,UAAU,EAAE;gBAC5B,eAAe,CAAC,KAAK,EAAE;gBACvB,oBAAoB,CAAC,CAAC,CAAC,eAAe,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,SAAS;aACxE,CAAC,CAAC;YAEH,MAAM,eAAe,GAAG,KAAK;gBACzB,CAAC,CAAC,IAAA,qCAAoB,EAAC,SAAS,EAAE,KAAK,CAAC;gBACxC,CAAC,CAAC,IAAA,uCAAgC,EAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;YACrE,MAAM,eAAe,GAAG,IAAA,mCAAkB,EAAC,SAAS,CAAC,CAAC;YAEtD,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,eAAe,IAAI,eAAe,CAAC;YAChE,MAAM,MAAM,GAAG,6BAAY,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;YAEpD,MAAM,kBAAkB,GAAG,IAAA,sCAAqB,EAAC,SAAS,EAAE,MAAM,CAAC,CAAC;YAEpE,MAAM,aAAa,GAAG,IAAA,iCAAgB,EAAC,SAAS,EAAE,MAAM,CAAC,CAAC;YAC1D,MAAM,cAAc,GAAG,IAAA,0BAAiB,EAAC,OAAO,CAAC,CAAC;YAElD,OAAO;gBACH,oBAAoB,EAAE,IAAA,8BAAa,EAAC;oBAChC,QAAQ;oBACR,kBAAkB;oBAClB,UAAU;oBACV,SAAS;oBACT,UAAU;oBACV,aAAa;oBACb,WAAW,EAAE,WAAW,IAAI,IAAI;oBAChC,cAAc;oBACd,QAAQ;iBACX,CAAC;gBACF,cAAc,EAAE,OAAO,CAAC,eAAe,CAAC;aAC3C,CAAC;QACN,CAAC;KACJ,CAAC;AACN,CAAC;AA5CD,oCA4CC;AAED,SAAgB,UAAU,CAAC,OAAyB,EAAE,OAAiC;IACnF,MAAM,eAAe,GAAG,IAAA,kCAAyB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACpE,OAAO,YAAY,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;AAClD,CAAC;AAHD,gCAGC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Category, Culture, ExtendedStory, Newsroom, NewsroomCompanyInformation, NewsroomContact, NewsroomGallery, NewsroomLanguageSettings, NewsroomThemePreset, Notification } from '@prezly/sdk';
|
|
2
2
|
import { LocaleObject } from '@prezly/theme-kit-core';
|
|
3
|
-
import type {
|
|
3
|
+
import type { SearchSettings } from '@prezly/theme-kit-core/server';
|
|
4
4
|
import type { PropsWithChildren } from 'react';
|
|
5
5
|
export interface NewsroomContextType {
|
|
6
6
|
/**
|
|
@@ -51,9 +51,9 @@ export interface NewsroomContextType {
|
|
|
51
51
|
*/
|
|
52
52
|
themePreset: NewsroomThemePreset | null;
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
54
|
+
* Config for Algolia/MeiliSearch
|
|
55
55
|
*/
|
|
56
|
-
|
|
56
|
+
searchSettings?: SearchSettings;
|
|
57
57
|
}
|
|
58
58
|
export interface NewsroomContextProps extends Omit<NewsroomContextType, 'locale'> {
|
|
59
59
|
localeCode: Culture.Code;
|
|
@@ -63,4 +63,4 @@ export declare const NewsroomContext: import("react").Context<NewsroomContextTyp
|
|
|
63
63
|
* This context provides common Newsroom information retrieved by `getNewsroomServerSideProps` helper.
|
|
64
64
|
* Please refer to the `NewsroomContextType` definition for more info on what's exposed from the context.
|
|
65
65
|
*/
|
|
66
|
-
export declare function NewsroomContextProvider({ categories, contacts, newsroom, currentCategory, currentGallery, currentStory, companyInformation, languages, localeCode, notifications, themePreset,
|
|
66
|
+
export declare function NewsroomContextProvider({ categories, contacts, newsroom, currentCategory, currentGallery, currentStory, companyInformation, languages, localeCode, notifications, themePreset, searchSettings, children, }: PropsWithChildren<NewsroomContextProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -9,7 +9,7 @@ exports.NewsroomContext = (0, react_1.createContext)(undefined);
|
|
|
9
9
|
* This context provides common Newsroom information retrieved by `getNewsroomServerSideProps` helper.
|
|
10
10
|
* Please refer to the `NewsroomContextType` definition for more info on what's exposed from the context.
|
|
11
11
|
*/
|
|
12
|
-
function NewsroomContextProvider({ categories, contacts, newsroom, currentCategory, currentGallery, currentStory, companyInformation, languages, localeCode, notifications, themePreset,
|
|
12
|
+
function NewsroomContextProvider({ categories, contacts, newsroom, currentCategory, currentGallery, currentStory, companyInformation, languages, localeCode, notifications, themePreset, searchSettings, children, }) {
|
|
13
13
|
const locale = (0, react_1.useMemo)(() => theme_kit_core_1.LocaleObject.fromAnyCode(localeCode || theme_kit_core_1.DEFAULT_LOCALE), [localeCode]);
|
|
14
14
|
return ((0, jsx_runtime_1.jsx)(exports.NewsroomContext.Provider, { value: {
|
|
15
15
|
categories,
|
|
@@ -23,7 +23,7 @@ function NewsroomContextProvider({ categories, contacts, newsroom, currentCatego
|
|
|
23
23
|
locale,
|
|
24
24
|
notifications,
|
|
25
25
|
themePreset,
|
|
26
|
-
|
|
26
|
+
searchSettings,
|
|
27
27
|
}, children: children }));
|
|
28
28
|
}
|
|
29
29
|
exports.NewsroomContextProvider = NewsroomContextProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/newsroom-context/context.tsx"],"names":[],"mappings":";;;;AAYA,2DAAsE;AAGtE,iCAA+C;AA4DlC,QAAA,eAAe,GAAG,IAAA,qBAAa,EAAkC,SAAS,CAAC,CAAC;AAEzF;;;GAGG;AACH,SAAgB,uBAAuB,CAAC,EACpC,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,eAAe,EACf,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,SAAS,EACT,UAAU,EACV,aAAa,EACb,WAAW,EACX,
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/newsroom-context/context.tsx"],"names":[],"mappings":";;;;AAYA,2DAAsE;AAGtE,iCAA+C;AA4DlC,QAAA,eAAe,GAAG,IAAA,qBAAa,EAAkC,SAAS,CAAC,CAAC;AAEzF;;;GAGG;AACH,SAAgB,uBAAuB,CAAC,EACpC,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,eAAe,EACf,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,SAAS,EACT,UAAU,EACV,aAAa,EACb,WAAW,EACX,cAAc,EACd,QAAQ,GAC8B;IACtC,MAAM,MAAM,GAAG,IAAA,eAAO,EAClB,GAAG,EAAE,CAAC,6BAAY,CAAC,WAAW,CAAC,UAAU,IAAI,+BAAc,CAAC,EAC5D,CAAC,UAAU,CAAC,CACf,CAAC;IAEF,OAAO,CACH,uBAAC,uBAAe,CAAC,QAAQ,IACrB,KAAK,EAAE;YACH,UAAU;YACV,QAAQ;YACR,QAAQ;YACR,eAAe;YACf,cAAc;YACd,YAAY;YACZ,kBAAkB;YAClB,SAAS;YACT,MAAM;YACN,aAAa;YACb,WAAW;YACX,cAAc;SACjB,YAEA,QAAQ,GACc,CAC9B,CAAC;AACN,CAAC;AAxCD,0DAwCC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export * from './useAlgoliaSettings';
|
|
2
1
|
export * from './useCategories';
|
|
3
2
|
export * from './useCompanyInformation';
|
|
4
3
|
export * from './useCurrentCategory';
|
|
@@ -9,3 +8,5 @@ export * from './useGetTranslationUrl';
|
|
|
9
8
|
export * from './useLanguages';
|
|
10
9
|
export * from './useNewsroom';
|
|
11
10
|
export * from './useNewsroomContext';
|
|
11
|
+
export * from './useSearchClient';
|
|
12
|
+
export * from './useSearchSettings';
|
|
@@ -14,7 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./useAlgoliaSettings"), exports);
|
|
18
17
|
__exportStar(require("./useCategories"), exports);
|
|
19
18
|
__exportStar(require("./useCompanyInformation"), exports);
|
|
20
19
|
__exportStar(require("./useCurrentCategory"), exports);
|
|
@@ -25,4 +24,6 @@ __exportStar(require("./useGetTranslationUrl"), exports);
|
|
|
25
24
|
__exportStar(require("./useLanguages"), exports);
|
|
26
25
|
__exportStar(require("./useNewsroom"), exports);
|
|
27
26
|
__exportStar(require("./useNewsroomContext"), exports);
|
|
27
|
+
__exportStar(require("./useSearchClient"), exports);
|
|
28
|
+
__exportStar(require("./useSearchSettings"), exports);
|
|
28
29
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,0DAAwC;AACxC,uDAAqC;AACrC,qDAAmC;AACnC,oDAAkC;AAClC,yDAAuC;AACvC,yDAAuC;AACvC,iDAA+B;AAC/B,gDAA8B;AAC9B,uDAAqC;AACrC,oDAAkC;AAClC,sDAAoC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useSearchClient = void 0;
|
|
7
|
+
const instant_meilisearch_1 = require("@meilisearch/instant-meilisearch");
|
|
8
|
+
const lite_1 = __importDefault(require("algoliasearch/lite"));
|
|
9
|
+
function useSearchClient(settings) {
|
|
10
|
+
return settings.searchBackend === 'algolia'
|
|
11
|
+
? (0, lite_1.default)(settings.appId, settings.apiKey)
|
|
12
|
+
: (0, instant_meilisearch_1.instantMeiliSearch)(settings.host, settings.apiKey).searchClient;
|
|
13
|
+
}
|
|
14
|
+
exports.useSearchClient = useSearchClient;
|
|
15
|
+
//# sourceMappingURL=useSearchClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSearchClient.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useSearchClient.ts"],"names":[],"mappings":";;;;;;AAAA,0EAAsE;AAEtE,8DAA+C;AAE/C,SAAgB,eAAe,CAAC,QAAwB;IACpD,OAAO,QAAQ,CAAC,aAAa,KAAK,SAAS;QACvC,CAAC,CAAC,IAAA,cAAa,EAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC;QAChD,CAAC,CAAC,IAAA,wCAAkB,EAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC;AAC1E,CAAC;AAJD,0CAIC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useSearchSettings(): import("@prezly/theme-kit-core/server").SearchSettings | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSearchSettings = void 0;
|
|
4
|
+
const useNewsroomContext_1 = require("./useNewsroomContext");
|
|
5
|
+
function useSearchSettings() {
|
|
6
|
+
const { searchSettings } = (0, useNewsroomContext_1.useNewsroomContext)();
|
|
7
|
+
return searchSettings;
|
|
8
|
+
}
|
|
9
|
+
exports.useSearchSettings = useSearchSettings;
|
|
10
|
+
//# sourceMappingURL=useSearchSettings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSearchSettings.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useSearchSettings.ts"],"names":[],"mappings":";;;AAAA,6DAA0D;AAE1D,SAAgB,iBAAiB;IAC7B,MAAM,EAAE,cAAc,EAAE,GAAG,IAAA,uCAAkB,GAAE,CAAC;IAChD,OAAO,cAAc,CAAC;AAC1B,CAAC;AAHD,8CAGC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prezly/theme-kit-nextjs",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.6.0",
|
|
4
4
|
"description": "Data layer and utility library for developing Prezly themes with NextJS",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -71,8 +71,10 @@
|
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
|
-
"@
|
|
74
|
+
"@meilisearch/instant-meilisearch": "^0.19.0",
|
|
75
|
+
"@prezly/theme-kit-core": "^7.6.0",
|
|
75
76
|
"@technically/omit-undefined": "^1.0.2",
|
|
77
|
+
"algoliasearch": "^4.24.0",
|
|
76
78
|
"next-seo": "^5.4.0"
|
|
77
79
|
},
|
|
78
80
|
"devDependencies": {
|
|
@@ -82,5 +84,5 @@
|
|
|
82
84
|
"access": "public"
|
|
83
85
|
},
|
|
84
86
|
"sideEffects": false,
|
|
85
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "d8ae2e0584be4554f182555e0fc0670912f210f3"
|
|
86
88
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function useAlgoliaSettings(): import("@prezly/theme-kit-core/server").AlgoliaSettings;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useAlgoliaSettings = void 0;
|
|
4
|
-
const useNewsroomContext_1 = require("./useNewsroomContext");
|
|
5
|
-
function useAlgoliaSettings() {
|
|
6
|
-
const context = (0, useNewsroomContext_1.useNewsroomContext)();
|
|
7
|
-
return context.algoliaSettings;
|
|
8
|
-
}
|
|
9
|
-
exports.useAlgoliaSettings = useAlgoliaSettings;
|
|
10
|
-
//# sourceMappingURL=useAlgoliaSettings.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAlgoliaSettings.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useAlgoliaSettings.ts"],"names":[],"mappings":";;;AAAA,6DAA0D;AAE1D,SAAgB,kBAAkB;IAC9B,MAAM,OAAO,GAAG,IAAA,uCAAkB,GAAE,CAAC;IAErC,OAAO,OAAO,CAAC,eAAe,CAAC;AACnC,CAAC;AAJD,gDAIC"}
|