Skip to content

Commit

Permalink
Update kontent packages
Browse files Browse the repository at this point in the history
  • Loading branch information
JiriLojda committed Apr 29, 2024
1 parent a8e3783 commit a332860
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 35 deletions.
64 changes: 37 additions & 27 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"version": "1.0.0",
"license": "MIT",
"dependencies": {
"@kontent-ai/delivery-sdk": "^12.1.0",
"@kontent-ai/webhook-helper": "^2.0.1",
"@kontent-ai/delivery-sdk": "^14.8.0",
"@kontent-ai/webhook-helper": "^2.1.0",
"@netlify/functions": "^2.6.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/RecombeeTypesManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const RecombeeTypesManager: FC = () => {
});
setRegisteredTypesIds(JSON.parse(element.value ?? "[]"));

new DeliveryClient({ projectId: context.projectId })
new DeliveryClient({ environmentId: context.projectId })
.types()
.toPromise()
.then(response => setAllTypes(new Map(response.data.items.map(t => [t.system.id, t]))));
Expand Down
2 changes: 1 addition & 1 deletion src/functions/model/configuration-model.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export type KontentConfiguration = {
projectId: string;
environmentId: string;
language?: string;
contentType: string;
};
Expand Down
2 changes: 1 addition & 1 deletion src/functions/model/kontent-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default class KontentClient {

constructor(config: KontentConfiguration) {
this.client = new DeliveryClient({
projectId: config.projectId,
environmentId: config.environmentId,
globalHeaders: () => [{ header: "X-KC-SOURCE", value: `${packageJson.name};${packageJson.version}` }],
});
this.config = config;
Expand Down
2 changes: 1 addition & 1 deletion src/functions/model/recombee-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default class RecombeeClient {
.map(element => {
const dataType = this.datatypeMap.get(element.type);
return dataType
? new Recombee.requests.AddItemProperty(element.codename, dataType)
? new Recombee.requests.AddItemProperty(element.codename ?? "", dataType)
: null;
})
.filter(notNull),
Expand Down
2 changes: 1 addition & 1 deletion src/functions/recombee-init-function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const getConfiguration = (body: string): RecommendationProjectConfiguration => {
const jsonBody = JSON.parse(body);
return {
kontent: {
projectId: jsonBody.projectId,
environmentId: jsonBody.projectId,
language: jsonBody.language,
contentType: jsonBody.contentType,
},
Expand Down
2 changes: 1 addition & 1 deletion src/functions/recombee-sync-webhook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const handler: Handler = async (event) => {
.filter(item => typesToWatch.includes(item.type) && languagesToWatch.includes(item.language))
.map(async (item) => {
const kontentConfig: KontentConfiguration = {
projectId: webhook.message.project_id,
environmentId: webhook.message.project_id,
contentType: item.type,
language: item.language,
};
Expand Down

0 comments on commit a332860

Please sign in to comment.