From 572fb9720bd5511386300af4d7ec4736853e534f Mon Sep 17 00:00:00 2001 From: Kevin Stubbs Date: Tue, 8 Oct 2024 18:06:18 +0200 Subject: [PATCH 01/14] Initial implementation of metadata groups in SDK + starter kit (1/3rd of them). --- .changeset/sixty-moose-act.md | 5 +++ packages/core/src/core/pantheon-api.ts | 44 ++++++++++++++++++- packages/core/src/types/index.ts | 18 ++++++++ starters/nextjs-starter-ts/lib/utils.ts | 8 ++-- starters/nextjs-starter-ts/next-env.d.ts | 2 +- .../pages/api/pantheoncloud/[...command].ts | 26 +++++++++++ 6 files changed, 97 insertions(+), 6 deletions(-) create mode 100644 .changeset/sixty-moose-act.md diff --git a/.changeset/sixty-moose-act.md b/.changeset/sixty-moose-act.md new file mode 100644 index 00000000..7008d743 --- /dev/null +++ b/.changeset/sixty-moose-act.md @@ -0,0 +1,5 @@ +--- +"@pantheon-systems/pcc-sdk-core": minor +--- + +Add support for metadata groups (like authors). diff --git a/packages/core/src/core/pantheon-api.ts b/packages/core/src/core/pantheon-api.ts index 6cb64cd5..94824ebf 100644 --- a/packages/core/src/core/pantheon-api.ts +++ b/packages/core/src/core/pantheon-api.ts @@ -1,7 +1,7 @@ import queryString from "query-string"; import { getArticleBySlugOrId, PCCConvenienceFunctions } from "../helpers"; import { parseJwt } from "../lib/jwt"; -import { Article, SmartComponentMap } from "../types"; +import { Article, MetadataGroup, SmartComponentMap } from "../types"; import { PantheonClient, PantheonClientConfig } from "./pantheon-client"; export interface ApiRequest { @@ -85,6 +85,11 @@ export interface PantheonAPIOptions { * Map of smart component names to their schemas. */ smartComponentMap?: SmartComponentMap; + + /** + * Metadata groups, schemas, and how to retrieve their data. + */ + metadataGroups?: MetadataGroup[]; } const defaultOptions = { @@ -238,6 +243,43 @@ export const PantheonAPI = (givenOptions?: PantheonAPIOptions) => { return await res.redirect(302, options.notFoundPath); } + case "metadata_group": { + const groupIdentifier = command[1]; + const objectId = command[2]; + + if (options.metadataGroups == null) { + return res.json({ + error: "This collection has no metadata groups defined.", + }); + } + + if (groupIdentifier == null) { + return res.json({ + error: "Group identifier is required.", + }); + } + + const group = await options.metadataGroups.find( + (x) => x.groupIdentifier === groupIdentifier, + ); + + if (!group) { + return res.json({ + error: "Could not find matching group by given identifier.", + }); + } + + if (!objectId) { + return res.json({ + rows: await group.list(), + }); + } + + return res.json({ + row: await group.get(objectId), + }); + } + default: { return await res.redirect(302, options.notFoundPath); } diff --git a/packages/core/src/types/index.ts b/packages/core/src/types/index.ts index b2727df0..b5c965f9 100644 --- a/packages/core/src/types/index.ts +++ b/packages/core/src/types/index.ts @@ -108,11 +108,29 @@ export interface PantheonTreeNode { id?: string; type?: string; } + export interface PantheonTree { version: string; children: PantheonTreeNode[]; } +export interface MetadataGroup { + label: string; + groupIdentifier: string; + schema?: Record< + string, + "string" | "textarea" | "number" | "boolean" | "date" | "file" + >; + get: ( + id: string, + ) => Promise | unknown | null | undefined; + list: () => + | Promise + | unknown[] + | null + | undefined; +} + const fieldTypes = z.enum([ "string", "textarea", diff --git a/starters/nextjs-starter-ts/lib/utils.ts b/starters/nextjs-starter-ts/lib/utils.ts index 66ed1afc..ed3c5d8b 100644 --- a/starters/nextjs-starter-ts/lib/utils.ts +++ b/starters/nextjs-starter-ts/lib/utils.ts @@ -25,13 +25,11 @@ function isDateInputObject(v: DateInputObject | unknown): v is DateInputObject { export function getSeoMetadata(article: ArticleWithoutContent) { const tags = article.tags && article.tags.length > 0 ? article.tags : []; - let authors = []; let publishedTime = null; // Collecting data from metadata fields Object.entries(article.metadata || {}).forEach(([key, val]) => { - if (key.toLowerCase().trim() === "author" && val) authors = [val]; - else if (key.toLowerCase().trim() === "date" && isDateInputObject(val)) + if (key.toLowerCase().trim() === "date" && isDateInputObject(val)) publishedTime = new Date(val.msSinceEpoch).toISOString(); }); @@ -42,11 +40,13 @@ export function getSeoMetadata(article: ArticleWithoutContent) { .filter((url): url is string => typeof url === "string") .map((url) => ({ url })); + const authorName = article.metadata.author?.name; + return { title: article.title, description: "Article hosted using Pantheon Content Cloud", tags, - authors, + authors: authorName ? [authorName] : undefined, publishedTime, images: imageProperties, }; diff --git a/starters/nextjs-starter-ts/next-env.d.ts b/starters/nextjs-starter-ts/next-env.d.ts index 40c3d680..4f11a03d 100644 --- a/starters/nextjs-starter-ts/next-env.d.ts +++ b/starters/nextjs-starter-ts/next-env.d.ts @@ -2,4 +2,4 @@ /// // NOTE: This file should not be edited -// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information. +// see https://nextjs.org/docs/basic-features/typescript for more information. diff --git a/starters/nextjs-starter-ts/pages/api/pantheoncloud/[...command].ts b/starters/nextjs-starter-ts/pages/api/pantheoncloud/[...command].ts index 328a185b..cc690c03 100644 --- a/starters/nextjs-starter-ts/pages/api/pantheoncloud/[...command].ts +++ b/starters/nextjs-starter-ts/pages/api/pantheoncloud/[...command].ts @@ -4,11 +4,37 @@ import { } from "@pantheon-systems/pcc-react-sdk"; import { serverSmartComponentMap } from "../../../components/smart-components"; +const authors = [ + { + id: 1, + name: "James T. Kirk", + image: "https://en.wikipedia.org/wiki/File:William_Shatner_Star_Trek.JPG", + }, + { + id: 2, + name: "Spock", + image: + "https://upload.wikimedia.org/wikipedia/commons/thumb/f/fa/Leonard_Nimoy_as_Spock_1967.jpg/440px-Leonard_Nimoy_as_Spock_1967.jpg", + }, +]; + export const pantheonAPIOptions: PantheonAPIOptions = { resolvePath: (article) => `/articles/${article.slug || article.id}`, smartComponentMap: serverSmartComponentMap, componentPreviewPath: (componentName) => `/component-preview/${componentName}`, + metadataGroups: [ + { + label: "Author", + groupIdentifier: "AUTHOR", + schema: { + name: "string", + image: "image", + }, + get: (id: string) => authors.find((x) => x.id?.toString() === id), + list: () => authors, + }, + ], }; export default PantheonAPI(pantheonAPIOptions); From 35f2547c040c227a720660388361f799c2a24725 Mon Sep 17 00:00:00 2001 From: Kevin Stubbs Date: Mon, 14 Oct 2024 16:33:20 +0200 Subject: [PATCH 02/14] Fix typing for metadata field. --- .../nextjs-starter-ts/pages/api/pantheoncloud/[...command].ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/starters/nextjs-starter-ts/pages/api/pantheoncloud/[...command].ts b/starters/nextjs-starter-ts/pages/api/pantheoncloud/[...command].ts index cc690c03..28527e6f 100644 --- a/starters/nextjs-starter-ts/pages/api/pantheoncloud/[...command].ts +++ b/starters/nextjs-starter-ts/pages/api/pantheoncloud/[...command].ts @@ -29,7 +29,7 @@ export const pantheonAPIOptions: PantheonAPIOptions = { groupIdentifier: "AUTHOR", schema: { name: "string", - image: "image", + image: "file", }, get: (id: string) => authors.find((x) => x.id?.toString() === id), list: () => authors, From 347b2a4768f2fee0a0637e3263c80358ebac974e Mon Sep 17 00:00:00 2001 From: Kevin Stubbs Date: Mon, 14 Oct 2024 16:40:21 +0200 Subject: [PATCH 03/14] Version beta as 3.10.0-beta.0 --- .changeset/pre.json | 24 +++++++++++++++++++ packages/browser/CHANGELOG.md | 7 ++++++ packages/browser/package.json | 2 +- packages/cli/CHANGELOG.md | 7 ++++++ packages/cli/package.json | 2 +- packages/core/CHANGELOG.md | 6 +++++ packages/core/package.json | 2 +- packages/react-sample-library/CHANGELOG.md | 8 +++++++ packages/react-sample-library/package.json | 2 +- packages/react-sdk/CHANGELOG.md | 7 ++++++ packages/react-sdk/package.json | 2 +- packages/vue-sdk/CHANGELOG.md | 7 ++++++ packages/vue-sdk/package.json | 2 +- starters/gatsby-starter-ts/package.json | 2 +- starters/gatsby-starter/package.json | 2 +- .../nextjs-starter-approuter-ts/CHANGELOG.md | 6 +++++ .../nextjs-starter-approuter-ts/package.json | 4 ++-- starters/nextjs-starter-ts/package.json | 2 +- starters/nextjs-starter/package.json | 2 +- starters/vue-starter-ts/CHANGELOG.md | 6 +++++ starters/vue-starter-ts/package.json | 4 ++-- starters/vue-starter/CHANGELOG.md | 6 +++++ starters/vue-starter/package.json | 4 ++-- 23 files changed, 100 insertions(+), 16 deletions(-) create mode 100644 .changeset/pre.json diff --git a/.changeset/pre.json b/.changeset/pre.json new file mode 100644 index 00000000..7f47794b --- /dev/null +++ b/.changeset/pre.json @@ -0,0 +1,24 @@ +{ + "mode": "pre", + "tag": "beta", + "initialVersions": { + "eslint-config-pcc-custom": "1.0.0", + "testpages": "0.1.0", + "@pantheon-systems/pcc-browser-sdk": "3.9.0", + "@pantheon-systems/pcc-cli": "3.9.0", + "@pantheon-systems/pcc-sdk-core": "3.9.0", + "@pantheon-systems/pcc-react-sample-library": "3.9.0", + "@pantheon-systems/pcc-react-sdk": "3.9.0", + "@pantheon-systems/pcc-vue-sdk": "3.9.0", + "gatsby-pcc-starter": "1.0.0", + "gatsby-pcc-starter-ts": "1.0.0", + "@pantheon-systems/next-pcc-starter": "1.0.0", + "@pantheon-systems/next-approuter-pcc-starter-ts": "1.1.8", + "@pantheon-systems/next-pcc-starter-ts": "1.0.0", + "@pantheon-systems/vue-pcc-starter": "1.1.3", + "@pantheon-systems/vue-pcc-starter-ts": "1.1.3" + }, + "changesets": [ + "sixty-moose-act" + ] +} diff --git a/packages/browser/CHANGELOG.md b/packages/browser/CHANGELOG.md index 8e9ece3f..8b57e907 100644 --- a/packages/browser/CHANGELOG.md +++ b/packages/browser/CHANGELOG.md @@ -1,5 +1,12 @@ # @pantheon-systems/pcc-browser-sdk +## 3.10.0-beta.0 + +### Patch Changes + +- Updated dependencies [572fb97] + - @pantheon-systems/pcc-sdk-core@3.10.0-beta.0 + ## 3.9.0 ### Patch Changes diff --git a/packages/browser/package.json b/packages/browser/package.json index 09dfa1f2..8b951353 100644 --- a/packages/browser/package.json +++ b/packages/browser/package.json @@ -2,7 +2,7 @@ "name": "@pantheon-systems/pcc-browser-sdk", "author": "@pantheon-systems", "description": "Pantheon Content Cloud Browser SDK", - "version": "3.9.0", + "version": "3.10.0-beta.0", "main": "dist/index.js", "files": [ "dist", diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index 589afdb8..55802864 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -1,5 +1,12 @@ # @pantheon-systems/pcc-cli +## 3.10.0-beta.0 + +### Patch Changes + +- Updated dependencies [572fb97] + - @pantheon-systems/pcc-sdk-core@3.10.0-beta.0 + ## 3.9.0 ### Patch Changes diff --git a/packages/cli/package.json b/packages/cli/package.json index 261eeb2e..82946ced 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -2,7 +2,7 @@ "name": "@pantheon-systems/pcc-cli", "author": "@pantheon-systems", "description": "Pantheon Content Cloud CLI", - "version": "3.9.0", + "version": "3.10.0-beta.0", "type": "module", "license": "MIT", "keywords": [ diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index 2ade679d..b30e4d2b 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -1,5 +1,11 @@ # @pantheon-systems/pcc-sdk-core +## 3.10.0-beta.0 + +### Minor Changes + +- 572fb97: Add support for metadata groups (like authors). + ## 3.9.0 ### Minor Changes diff --git a/packages/core/package.json b/packages/core/package.json index 055a1a51..e3d06f81 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -2,7 +2,7 @@ "name": "@pantheon-systems/pcc-sdk-core", "author": "@pantheon-systems", "description": "Pantheon Content Cloud SDK Core", - "version": "3.9.0", + "version": "3.10.0-beta.0", "license": "MIT", "main": "./dist/index.js", "module": "./dist/index.mjs", diff --git a/packages/react-sample-library/CHANGELOG.md b/packages/react-sample-library/CHANGELOG.md index 69895f72..89f53ddc 100644 --- a/packages/react-sample-library/CHANGELOG.md +++ b/packages/react-sample-library/CHANGELOG.md @@ -1,5 +1,13 @@ # @pantheon-systems/pcc-vue-sdk +## 3.10.0-beta.0 + +### Patch Changes + +- Updated dependencies [572fb97] + - @pantheon-systems/pcc-sdk-core@3.10.0-beta.0 + - @pantheon-systems/pcc-react-sdk@3.10.0-beta.0 + ## 3.9.0 ### Patch Changes diff --git a/packages/react-sample-library/package.json b/packages/react-sample-library/package.json index fa4c6da1..09067808 100644 --- a/packages/react-sample-library/package.json +++ b/packages/react-sample-library/package.json @@ -2,7 +2,7 @@ "name": "@pantheon-systems/pcc-react-sample-library", "author": "@pantheon-systems", "description": "Pantheon Content Cloud Sample Component Library for React", - "version": "3.9.0", + "version": "3.10.0-beta.0", "main": "./dist/index.js", "module": "./dist/index.mjs", "types": "./dist/index.d.ts", diff --git a/packages/react-sdk/CHANGELOG.md b/packages/react-sdk/CHANGELOG.md index 3e94fcc3..b3a31504 100644 --- a/packages/react-sdk/CHANGELOG.md +++ b/packages/react-sdk/CHANGELOG.md @@ -1,5 +1,12 @@ # @pantheon-systems/pcc-react-sdk +## 3.10.0-beta.0 + +### Patch Changes + +- Updated dependencies [572fb97] + - @pantheon-systems/pcc-sdk-core@3.10.0-beta.0 + ## 3.9.0 ### Minor Changes diff --git a/packages/react-sdk/package.json b/packages/react-sdk/package.json index 4030a628..0737f550 100644 --- a/packages/react-sdk/package.json +++ b/packages/react-sdk/package.json @@ -2,7 +2,7 @@ "name": "@pantheon-systems/pcc-react-sdk", "author": "@pantheon-systems", "description": "Pantheon Content Cloud React SDK", - "version": "3.9.0", + "version": "3.10.0-beta.0", "license": "MIT", "keywords": [ "pcc", diff --git a/packages/vue-sdk/CHANGELOG.md b/packages/vue-sdk/CHANGELOG.md index 56c0c93e..643ef116 100644 --- a/packages/vue-sdk/CHANGELOG.md +++ b/packages/vue-sdk/CHANGELOG.md @@ -1,5 +1,12 @@ # @pantheon-systems/pcc-vue-sdk +## 3.10.0-beta.0 + +### Patch Changes + +- Updated dependencies [572fb97] + - @pantheon-systems/pcc-sdk-core@3.10.0-beta.0 + ## 3.9.0 ### Patch Changes diff --git a/packages/vue-sdk/package.json b/packages/vue-sdk/package.json index 89ededa7..d1483490 100644 --- a/packages/vue-sdk/package.json +++ b/packages/vue-sdk/package.json @@ -2,7 +2,7 @@ "name": "@pantheon-systems/pcc-vue-sdk", "author": "@pantheon-systems", "description": "Pantheon Content Cloud Vue SDK", - "version": "3.9.0", + "version": "3.10.0-beta.0", "main": "./dist/index.cjs", "module": "./dist/index.mjs", "types": "./dist/index.d.ts", diff --git a/starters/gatsby-starter-ts/package.json b/starters/gatsby-starter-ts/package.json index 11fe6def..6a870c57 100644 --- a/starters/gatsby-starter-ts/package.json +++ b/starters/gatsby-starter-ts/package.json @@ -15,7 +15,7 @@ }, "dependencies": { "@mdx-js/react": "2.3.0", - "@pantheon-systems/pcc-react-sdk": "~3.9.0", + "@pantheon-systems/pcc-react-sdk": "~3.10.0-beta.0", "@pantheon-systems/pds-toolkit-react": "1.0.0-dev.55", "autoprefixer": "^10.4.17", "gatsby": "5.13.5", diff --git a/starters/gatsby-starter/package.json b/starters/gatsby-starter/package.json index 3d198cca..910c5d0d 100644 --- a/starters/gatsby-starter/package.json +++ b/starters/gatsby-starter/package.json @@ -15,7 +15,7 @@ }, "dependencies": { "@mdx-js/react": "2.3.0", - "@pantheon-systems/pcc-react-sdk": "3.9.0", + "@pantheon-systems/pcc-react-sdk": "3.10.0-beta.0", "@pantheon-systems/pds-toolkit-react": "1.0.0-dev.55", "autoprefixer": "^10.4.17", "gatsby": "5.13.5", diff --git a/starters/nextjs-starter-approuter-ts/CHANGELOG.md b/starters/nextjs-starter-approuter-ts/CHANGELOG.md index 0839f857..d68ca457 100644 --- a/starters/nextjs-starter-approuter-ts/CHANGELOG.md +++ b/starters/nextjs-starter-approuter-ts/CHANGELOG.md @@ -1,5 +1,11 @@ # @pantheon-systems/next-pcc-starter +## 1.1.9-beta.0 + +### Patch Changes + +- @pantheon-systems/pcc-react-sdk@3.10.0-beta.0 + ## 1.1.8 ### Patch Changes diff --git a/starters/nextjs-starter-approuter-ts/package.json b/starters/nextjs-starter-approuter-ts/package.json index 31a714c6..5f5f1b56 100644 --- a/starters/nextjs-starter-approuter-ts/package.json +++ b/starters/nextjs-starter-approuter-ts/package.json @@ -1,6 +1,6 @@ { "name": "@pantheon-systems/next-approuter-pcc-starter-ts", - "version": "1.1.8", + "version": "1.1.9-beta.0", "private": true, "license": "GPL-3.0-or-later", "description": "A starter for building a Pantheon Content Cloud (PCC) powered site with Next.js App Router and TypeScript", @@ -26,7 +26,7 @@ "node": ">=18.0.0" }, "dependencies": { - "@pantheon-systems/pcc-react-sdk": "~3.9.0", + "@pantheon-systems/pcc-react-sdk": "~3.10.0-beta.0", "@radix-ui/react-popover": "^1.1.1", "@radix-ui/react-slot": "^1.1.0", "@tailwindcss/typography": "0.5.10", diff --git a/starters/nextjs-starter-ts/package.json b/starters/nextjs-starter-ts/package.json index 6ce9fadd..0c864898 100644 --- a/starters/nextjs-starter-ts/package.json +++ b/starters/nextjs-starter-ts/package.json @@ -26,7 +26,7 @@ "node": ">=18.0.0" }, "dependencies": { - "@pantheon-systems/pcc-react-sdk": "~3.9.0", + "@pantheon-systems/pcc-react-sdk": "~3.10.0-beta.0", "@radix-ui/react-popover": "^1.1.1", "@radix-ui/react-slot": "^1.1.0", "@tailwindcss/typography": "0.5.10", diff --git a/starters/nextjs-starter/package.json b/starters/nextjs-starter/package.json index c7da1e17..ee2922f9 100644 --- a/starters/nextjs-starter/package.json +++ b/starters/nextjs-starter/package.json @@ -26,7 +26,7 @@ "node": ">=18.0.0" }, "dependencies": { - "@pantheon-systems/pcc-react-sdk": "~3.9.0", + "@pantheon-systems/pcc-react-sdk": "~3.10.0-beta.0", "@radix-ui/react-popover": "^1.1.1", "@radix-ui/react-slot": "^1.1.0", "@tailwindcss/typography": "0.5.10", diff --git a/starters/vue-starter-ts/CHANGELOG.md b/starters/vue-starter-ts/CHANGELOG.md index ec98d62f..d0a5846c 100644 --- a/starters/vue-starter-ts/CHANGELOG.md +++ b/starters/vue-starter-ts/CHANGELOG.md @@ -1,5 +1,11 @@ # @pantheon-systems/vue-pcc-starter-ts +## 1.1.4-beta.0 + +### Patch Changes + +- @pantheon-systems/pcc-vue-sdk@3.10.0-beta.0 + ## 1.1.3 ### Patch Changes diff --git a/starters/vue-starter-ts/package.json b/starters/vue-starter-ts/package.json index f697a7cb..876a193a 100644 --- a/starters/vue-starter-ts/package.json +++ b/starters/vue-starter-ts/package.json @@ -21,7 +21,7 @@ "vue-router": "4.3.0" }, "dependencies": { - "@pantheon-systems/pcc-vue-sdk": "~3.9.0" + "@pantheon-systems/pcc-vue-sdk": "~3.10.0-beta.0" }, - "version": "1.1.3" + "version": "1.1.4-beta.0" } diff --git a/starters/vue-starter/CHANGELOG.md b/starters/vue-starter/CHANGELOG.md index e4824aef..8aa437bd 100644 --- a/starters/vue-starter/CHANGELOG.md +++ b/starters/vue-starter/CHANGELOG.md @@ -1,5 +1,11 @@ # @pantheon-systems/vue-pcc-starter +## 1.1.4-beta.0 + +### Patch Changes + +- @pantheon-systems/pcc-vue-sdk@3.10.0-beta.0 + ## 1.1.3 ### Patch Changes diff --git a/starters/vue-starter/package.json b/starters/vue-starter/package.json index 5a40d144..beda6a2c 100644 --- a/starters/vue-starter/package.json +++ b/starters/vue-starter/package.json @@ -21,7 +21,7 @@ "vue-router": "4.3.0" }, "dependencies": { - "@pantheon-systems/pcc-vue-sdk": "~3.9.0" + "@pantheon-systems/pcc-vue-sdk": "~3.10.0-beta.0" }, - "version": "1.1.3" + "version": "1.1.4-beta.0" } From 30ede718917dc33c595358a3ec298f33e103442f Mon Sep 17 00:00:00 2001 From: Kevin Stubbs Date: Mon, 14 Oct 2024 20:06:26 +0200 Subject: [PATCH 04/14] Allow caller to retrieve all groups and possible values in a single call. --- packages/core/src/core/pantheon-api.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/core/src/core/pantheon-api.ts b/packages/core/src/core/pantheon-api.ts index 94824ebf..ac991990 100644 --- a/packages/core/src/core/pantheon-api.ts +++ b/packages/core/src/core/pantheon-api.ts @@ -255,7 +255,17 @@ export const PantheonAPI = (givenOptions?: PantheonAPIOptions) => { if (groupIdentifier == null) { return res.json({ - error: "Group identifier is required.", + rows: await Promise.all( + options.metadataGroups.map( + async ({ label, groupIdentifier, schema, list }) => ({ + label, + groupIdentifier, + schema, + values: + restOfQuery.hydrate === "true" ? await list() : undefined, + }), + ), + ), }); } From 400fc48387178004db1d9f05a1b9603e7643cb31 Mon Sep 17 00:00:00 2001 From: Kevin Stubbs Date: Mon, 14 Oct 2024 20:07:40 +0200 Subject: [PATCH 05/14] Add changeset --- .changeset/seven-owls-poke.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/seven-owls-poke.md diff --git a/.changeset/seven-owls-poke.md b/.changeset/seven-owls-poke.md new file mode 100644 index 00000000..5dc1891a --- /dev/null +++ b/.changeset/seven-owls-poke.md @@ -0,0 +1,5 @@ +--- +"@pantheon-systems/pcc-sdk-core": patch +--- + +Allow caller to retrieve all metadata groups, optionally hydrated. From 477792d49832a859a994b749399908d43c4c0e22 Mon Sep 17 00:00:00 2001 From: Kevin Stubbs Date: Mon, 14 Oct 2024 20:08:24 +0200 Subject: [PATCH 06/14] Pre-release update for retrieving hydrated metadata groups. --- .changeset/pre.json | 1 + packages/browser/CHANGELOG.md | 7 +++++++ packages/browser/package.json | 2 +- packages/cli/CHANGELOG.md | 7 +++++++ packages/cli/package.json | 2 +- packages/core/CHANGELOG.md | 6 ++++++ packages/core/package.json | 2 +- packages/react-sample-library/CHANGELOG.md | 8 ++++++++ packages/react-sample-library/package.json | 2 +- packages/react-sdk/CHANGELOG.md | 7 +++++++ packages/react-sdk/package.json | 2 +- packages/vue-sdk/CHANGELOG.md | 7 +++++++ packages/vue-sdk/package.json | 2 +- starters/gatsby-starter-ts/package.json | 2 +- starters/gatsby-starter/package.json | 2 +- starters/nextjs-starter-ts/package.json | 2 +- starters/nextjs-starter/package.json | 2 +- 17 files changed, 53 insertions(+), 10 deletions(-) diff --git a/.changeset/pre.json b/.changeset/pre.json index 7f47794b..7c0a0c25 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -19,6 +19,7 @@ "@pantheon-systems/vue-pcc-starter-ts": "1.1.3" }, "changesets": [ + "seven-owls-poke", "sixty-moose-act" ] } diff --git a/packages/browser/CHANGELOG.md b/packages/browser/CHANGELOG.md index 8b57e907..80f59cd7 100644 --- a/packages/browser/CHANGELOG.md +++ b/packages/browser/CHANGELOG.md @@ -1,5 +1,12 @@ # @pantheon-systems/pcc-browser-sdk +## 3.10.0-beta.1 + +### Patch Changes + +- Updated dependencies [400fc48] + - @pantheon-systems/pcc-sdk-core@3.10.0-beta.1 + ## 3.10.0-beta.0 ### Patch Changes diff --git a/packages/browser/package.json b/packages/browser/package.json index 8b951353..0df0a95a 100644 --- a/packages/browser/package.json +++ b/packages/browser/package.json @@ -2,7 +2,7 @@ "name": "@pantheon-systems/pcc-browser-sdk", "author": "@pantheon-systems", "description": "Pantheon Content Cloud Browser SDK", - "version": "3.10.0-beta.0", + "version": "3.10.0-beta.1", "main": "dist/index.js", "files": [ "dist", diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index 55802864..a20a98df 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -1,5 +1,12 @@ # @pantheon-systems/pcc-cli +## 3.10.0-beta.1 + +### Patch Changes + +- Updated dependencies [400fc48] + - @pantheon-systems/pcc-sdk-core@3.10.0-beta.1 + ## 3.10.0-beta.0 ### Patch Changes diff --git a/packages/cli/package.json b/packages/cli/package.json index 82946ced..8808c014 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -2,7 +2,7 @@ "name": "@pantheon-systems/pcc-cli", "author": "@pantheon-systems", "description": "Pantheon Content Cloud CLI", - "version": "3.10.0-beta.0", + "version": "3.10.0-beta.1", "type": "module", "license": "MIT", "keywords": [ diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index b30e4d2b..c1f394f8 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -1,5 +1,11 @@ # @pantheon-systems/pcc-sdk-core +## 3.10.0-beta.1 + +### Patch Changes + +- 400fc48: Allow caller to retrieve all metadata groups, optionally hydrated. + ## 3.10.0-beta.0 ### Minor Changes diff --git a/packages/core/package.json b/packages/core/package.json index e3d06f81..65dedb54 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -2,7 +2,7 @@ "name": "@pantheon-systems/pcc-sdk-core", "author": "@pantheon-systems", "description": "Pantheon Content Cloud SDK Core", - "version": "3.10.0-beta.0", + "version": "3.10.0-beta.1", "license": "MIT", "main": "./dist/index.js", "module": "./dist/index.mjs", diff --git a/packages/react-sample-library/CHANGELOG.md b/packages/react-sample-library/CHANGELOG.md index 89f53ddc..226046f9 100644 --- a/packages/react-sample-library/CHANGELOG.md +++ b/packages/react-sample-library/CHANGELOG.md @@ -1,5 +1,13 @@ # @pantheon-systems/pcc-vue-sdk +## 3.10.0-beta.1 + +### Patch Changes + +- Updated dependencies [400fc48] + - @pantheon-systems/pcc-sdk-core@3.10.0-beta.1 + - @pantheon-systems/pcc-react-sdk@3.10.0-beta.1 + ## 3.10.0-beta.0 ### Patch Changes diff --git a/packages/react-sample-library/package.json b/packages/react-sample-library/package.json index 09067808..ff5f2809 100644 --- a/packages/react-sample-library/package.json +++ b/packages/react-sample-library/package.json @@ -2,7 +2,7 @@ "name": "@pantheon-systems/pcc-react-sample-library", "author": "@pantheon-systems", "description": "Pantheon Content Cloud Sample Component Library for React", - "version": "3.10.0-beta.0", + "version": "3.10.0-beta.1", "main": "./dist/index.js", "module": "./dist/index.mjs", "types": "./dist/index.d.ts", diff --git a/packages/react-sdk/CHANGELOG.md b/packages/react-sdk/CHANGELOG.md index b3a31504..35ad3798 100644 --- a/packages/react-sdk/CHANGELOG.md +++ b/packages/react-sdk/CHANGELOG.md @@ -1,5 +1,12 @@ # @pantheon-systems/pcc-react-sdk +## 3.10.0-beta.1 + +### Patch Changes + +- Updated dependencies [400fc48] + - @pantheon-systems/pcc-sdk-core@3.10.0-beta.1 + ## 3.10.0-beta.0 ### Patch Changes diff --git a/packages/react-sdk/package.json b/packages/react-sdk/package.json index 0737f550..d5ede931 100644 --- a/packages/react-sdk/package.json +++ b/packages/react-sdk/package.json @@ -2,7 +2,7 @@ "name": "@pantheon-systems/pcc-react-sdk", "author": "@pantheon-systems", "description": "Pantheon Content Cloud React SDK", - "version": "3.10.0-beta.0", + "version": "3.10.0-beta.1", "license": "MIT", "keywords": [ "pcc", diff --git a/packages/vue-sdk/CHANGELOG.md b/packages/vue-sdk/CHANGELOG.md index 643ef116..3631b9a6 100644 --- a/packages/vue-sdk/CHANGELOG.md +++ b/packages/vue-sdk/CHANGELOG.md @@ -1,5 +1,12 @@ # @pantheon-systems/pcc-vue-sdk +## 3.10.0-beta.1 + +### Patch Changes + +- Updated dependencies [400fc48] + - @pantheon-systems/pcc-sdk-core@3.10.0-beta.1 + ## 3.10.0-beta.0 ### Patch Changes diff --git a/packages/vue-sdk/package.json b/packages/vue-sdk/package.json index d1483490..0f13c8ae 100644 --- a/packages/vue-sdk/package.json +++ b/packages/vue-sdk/package.json @@ -2,7 +2,7 @@ "name": "@pantheon-systems/pcc-vue-sdk", "author": "@pantheon-systems", "description": "Pantheon Content Cloud Vue SDK", - "version": "3.10.0-beta.0", + "version": "3.10.0-beta.1", "main": "./dist/index.cjs", "module": "./dist/index.mjs", "types": "./dist/index.d.ts", diff --git a/starters/gatsby-starter-ts/package.json b/starters/gatsby-starter-ts/package.json index 6a870c57..3e9cad7d 100644 --- a/starters/gatsby-starter-ts/package.json +++ b/starters/gatsby-starter-ts/package.json @@ -15,7 +15,7 @@ }, "dependencies": { "@mdx-js/react": "2.3.0", - "@pantheon-systems/pcc-react-sdk": "~3.10.0-beta.0", + "@pantheon-systems/pcc-react-sdk": "~3.10.0-beta.1", "@pantheon-systems/pds-toolkit-react": "1.0.0-dev.55", "autoprefixer": "^10.4.17", "gatsby": "5.13.5", diff --git a/starters/gatsby-starter/package.json b/starters/gatsby-starter/package.json index 910c5d0d..96658c7d 100644 --- a/starters/gatsby-starter/package.json +++ b/starters/gatsby-starter/package.json @@ -15,7 +15,7 @@ }, "dependencies": { "@mdx-js/react": "2.3.0", - "@pantheon-systems/pcc-react-sdk": "3.10.0-beta.0", + "@pantheon-systems/pcc-react-sdk": "3.10.0-beta.1", "@pantheon-systems/pds-toolkit-react": "1.0.0-dev.55", "autoprefixer": "^10.4.17", "gatsby": "5.13.5", diff --git a/starters/nextjs-starter-ts/package.json b/starters/nextjs-starter-ts/package.json index 0c864898..e6b8fe59 100644 --- a/starters/nextjs-starter-ts/package.json +++ b/starters/nextjs-starter-ts/package.json @@ -26,7 +26,7 @@ "node": ">=18.0.0" }, "dependencies": { - "@pantheon-systems/pcc-react-sdk": "~3.10.0-beta.0", + "@pantheon-systems/pcc-react-sdk": "~3.10.0-beta.1", "@radix-ui/react-popover": "^1.1.1", "@radix-ui/react-slot": "^1.1.0", "@tailwindcss/typography": "0.5.10", diff --git a/starters/nextjs-starter/package.json b/starters/nextjs-starter/package.json index ee2922f9..dfb3ebe5 100644 --- a/starters/nextjs-starter/package.json +++ b/starters/nextjs-starter/package.json @@ -26,7 +26,7 @@ "node": ">=18.0.0" }, "dependencies": { - "@pantheon-systems/pcc-react-sdk": "~3.10.0-beta.0", + "@pantheon-systems/pcc-react-sdk": "~3.10.0-beta.1", "@radix-ui/react-popover": "^1.1.1", "@radix-ui/react-slot": "^1.1.0", "@tailwindcss/typography": "0.5.10", From 6edc5cf0dd2ad657faa931077704135dca6cd0e3 Mon Sep 17 00:00:00 2001 From: Kevin Stubbs Date: Thu, 17 Oct 2024 17:18:45 +0200 Subject: [PATCH 07/14] Starter kits all support custom metadata groups. --- .../pantheoncloud/[...command]/api-options.ts | 16 ++++++++++ .../lib/pcc-metadata-groups.ts | 27 +++++++++++++++++ .../nextjs-starter-approuter-ts/lib/utils.ts | 18 ++++++++---- .../lib/pcc-metadata-groups.ts | 27 +++++++++++++++++ starters/nextjs-starter-ts/lib/utils.ts | 25 ++++++++++++---- .../pages/api/pantheoncloud/[...command].ts | 19 ++---------- .../pages/articles/[...uri].tsx | 4 +-- .../pages/examples/ssg-isr/[uri].tsx | 2 +- .../nextjs-starter/lib/pcc-metadata-groups.js | 21 ++++++++++++++ starters/nextjs-starter/lib/utils.js | 29 ++++++++++++++----- .../pages/api/pantheoncloud/[...command].js | 13 +++++++++ .../pages/articles/[...uri].jsx | 2 +- .../pages/examples/ssg-isr/[uri].jsx | 2 +- 13 files changed, 167 insertions(+), 38 deletions(-) create mode 100644 starters/nextjs-starter-approuter-ts/lib/pcc-metadata-groups.ts create mode 100644 starters/nextjs-starter-ts/lib/pcc-metadata-groups.ts create mode 100644 starters/nextjs-starter/lib/pcc-metadata-groups.js diff --git a/starters/nextjs-starter-approuter-ts/app/api/pantheoncloud/[...command]/api-options.ts b/starters/nextjs-starter-approuter-ts/app/api/pantheoncloud/[...command]/api-options.ts index 6950f77a..a6bd67a4 100644 --- a/starters/nextjs-starter-approuter-ts/app/api/pantheoncloud/[...command]/api-options.ts +++ b/starters/nextjs-starter-approuter-ts/app/api/pantheoncloud/[...command]/api-options.ts @@ -1,5 +1,9 @@ import { PantheonAPIOptions } from "@pantheon-systems/pcc-react-sdk/server"; import { serverSmartComponentMap } from "../../../../components/smart-components/server-components"; +import { + getAuthorById, + listAuthors, +} from "../../../../lib/pcc-metadata-groups"; export const pantheonAPIOptions: PantheonAPIOptions = { resolvePath: (article) => `/articles/${article.slug || article.id}`, @@ -7,4 +11,16 @@ export const pantheonAPIOptions: PantheonAPIOptions = { smartComponentMap: serverSmartComponentMap, componentPreviewPath: (componentName) => `/component-preview/${componentName}`, + metadataGroups: [ + { + label: "Author", + groupIdentifier: "AUTHOR", + schema: { + name: "string", + image: "file", + }, + get: getAuthorById, + list: listAuthors, + }, + ], }; diff --git a/starters/nextjs-starter-approuter-ts/lib/pcc-metadata-groups.ts b/starters/nextjs-starter-approuter-ts/lib/pcc-metadata-groups.ts new file mode 100644 index 00000000..5090f246 --- /dev/null +++ b/starters/nextjs-starter-approuter-ts/lib/pcc-metadata-groups.ts @@ -0,0 +1,27 @@ +export interface Author { + id: string | number; + name: string; + image: string; +} + +const authors = [ + { + id: 1, + name: "James T. Kirk", + image: "https://en.wikipedia.org/wiki/File:William_Shatner_Star_Trek.JPG", + }, + { + id: 2, + name: "Spock", + image: + "https://upload.wikimedia.org/wikipedia/commons/thumb/f/fa/Leonard_Nimoy_as_Spock_1967.jpg/440px-Leonard_Nimoy_as_Spock_1967.jpg", + }, +]; + +export function getAuthorById(id: string) { + return authors.find((x) => x.id?.toString() === id); +} + +export function listAuthors() { + return authors; +} diff --git a/starters/nextjs-starter-approuter-ts/lib/utils.ts b/starters/nextjs-starter-approuter-ts/lib/utils.ts index 382a9661..cfd93fca 100644 --- a/starters/nextjs-starter-approuter-ts/lib/utils.ts +++ b/starters/nextjs-starter-approuter-ts/lib/utils.ts @@ -1,6 +1,7 @@ import { ArticleWithoutContent } from "@pantheon-systems/pcc-react-sdk"; import { clsx, type ClassValue } from "clsx"; import { twMerge } from "tailwind-merge"; +import { getAuthorById } from "./pcc-metadata-groups"; export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); @@ -25,16 +26,17 @@ function isDateInputObject(v: DateInputObject | unknown): v is DateInputObject { export function getSeoMetadata(article: ArticleWithoutContent) { const tags = article.tags && article.tags.length > 0 ? article.tags : []; - let authors = []; let publishedTime = null; - // Collecting data from metadata fields + // Collecting data from metadata fields. Identifies the key in a case in-sensitive way. Object.entries(article.metadata || {}).forEach(([key, val]) => { - if (key.toLowerCase().trim() === "author" && val) authors = [val]; - else if (key.toLowerCase().trim() === "date" && isDateInputObject(val)) + if (key.toLowerCase().trim() === "date" && isDateInputObject(val)) publishedTime = new Date(val.msSinceEpoch).toISOString(); }); + const authorId = article.metadata.author as string | undefined; + const authorName = authorId ? getAuthorById(authorId)?.name : undefined; + const imageProperties = [ article.metadata?.["Hero Image"], // Extend as needed @@ -48,7 +50,13 @@ export function getSeoMetadata(article: ArticleWithoutContent) { title: article.title, description, tags, - authors, + authors: authorName + ? [ + { + name: authorName, + }, + ] + : null, publishedTime, openGraph: { type: "website", diff --git a/starters/nextjs-starter-ts/lib/pcc-metadata-groups.ts b/starters/nextjs-starter-ts/lib/pcc-metadata-groups.ts new file mode 100644 index 00000000..5090f246 --- /dev/null +++ b/starters/nextjs-starter-ts/lib/pcc-metadata-groups.ts @@ -0,0 +1,27 @@ +export interface Author { + id: string | number; + name: string; + image: string; +} + +const authors = [ + { + id: 1, + name: "James T. Kirk", + image: "https://en.wikipedia.org/wiki/File:William_Shatner_Star_Trek.JPG", + }, + { + id: 2, + name: "Spock", + image: + "https://upload.wikimedia.org/wikipedia/commons/thumb/f/fa/Leonard_Nimoy_as_Spock_1967.jpg/440px-Leonard_Nimoy_as_Spock_1967.jpg", + }, +]; + +export function getAuthorById(id: string) { + return authors.find((x) => x.id?.toString() === id); +} + +export function listAuthors() { + return authors; +} diff --git a/starters/nextjs-starter-ts/lib/utils.ts b/starters/nextjs-starter-ts/lib/utils.ts index ed3c5d8b..cfd93fca 100644 --- a/starters/nextjs-starter-ts/lib/utils.ts +++ b/starters/nextjs-starter-ts/lib/utils.ts @@ -1,6 +1,7 @@ import { ArticleWithoutContent } from "@pantheon-systems/pcc-react-sdk"; import { clsx, type ClassValue } from "clsx"; import { twMerge } from "tailwind-merge"; +import { getAuthorById } from "./pcc-metadata-groups"; export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); @@ -27,12 +28,15 @@ export function getSeoMetadata(article: ArticleWithoutContent) { const tags = article.tags && article.tags.length > 0 ? article.tags : []; let publishedTime = null; - // Collecting data from metadata fields + // Collecting data from metadata fields. Identifies the key in a case in-sensitive way. Object.entries(article.metadata || {}).forEach(([key, val]) => { if (key.toLowerCase().trim() === "date" && isDateInputObject(val)) publishedTime = new Date(val.msSinceEpoch).toISOString(); }); + const authorId = article.metadata.author as string | undefined; + const authorName = authorId ? getAuthorById(authorId)?.name : undefined; + const imageProperties = [ article.metadata?.["Hero Image"], // Extend as needed @@ -40,14 +44,25 @@ export function getSeoMetadata(article: ArticleWithoutContent) { .filter((url): url is string => typeof url === "string") .map((url) => ({ url })); - const authorName = article.metadata.author?.name; + const description = "Article hosted using Pantheon Content Publisher"; return { title: article.title, - description: "Article hosted using Pantheon Content Cloud", + description, tags, - authors: authorName ? [authorName] : undefined, + authors: authorName + ? [ + { + name: authorName, + }, + ] + : null, publishedTime, - images: imageProperties, + openGraph: { + type: "website", + title: article.title, + description, + images: imageProperties, + }, }; } diff --git a/starters/nextjs-starter-ts/pages/api/pantheoncloud/[...command].ts b/starters/nextjs-starter-ts/pages/api/pantheoncloud/[...command].ts index 28527e6f..a2e22c56 100644 --- a/starters/nextjs-starter-ts/pages/api/pantheoncloud/[...command].ts +++ b/starters/nextjs-starter-ts/pages/api/pantheoncloud/[...command].ts @@ -3,20 +3,7 @@ import { PantheonAPIOptions, } from "@pantheon-systems/pcc-react-sdk"; import { serverSmartComponentMap } from "../../../components/smart-components"; - -const authors = [ - { - id: 1, - name: "James T. Kirk", - image: "https://en.wikipedia.org/wiki/File:William_Shatner_Star_Trek.JPG", - }, - { - id: 2, - name: "Spock", - image: - "https://upload.wikimedia.org/wikipedia/commons/thumb/f/fa/Leonard_Nimoy_as_Spock_1967.jpg/440px-Leonard_Nimoy_as_Spock_1967.jpg", - }, -]; +import { getAuthorById, listAuthors } from "../../../lib/pcc-metadata-groups"; export const pantheonAPIOptions: PantheonAPIOptions = { resolvePath: (article) => `/articles/${article.slug || article.id}`, @@ -31,8 +18,8 @@ export const pantheonAPIOptions: PantheonAPIOptions = { name: "string", image: "file", }, - get: (id: string) => authors.find((x) => x.id?.toString() === id), - list: () => authors, + get: getAuthorById, + list: listAuthors, }, ], }; diff --git a/starters/nextjs-starter-ts/pages/articles/[...uri].tsx b/starters/nextjs-starter-ts/pages/articles/[...uri].tsx index ea038d46..48577051 100644 --- a/starters/nextjs-starter-ts/pages/articles/[...uri].tsx +++ b/starters/nextjs-starter-ts/pages/articles/[...uri].tsx @@ -33,9 +33,9 @@ export default function ArticlePage({ article, grant }: ArticlePageProps) { type: "website", title: seoMetadata.title, description: seoMetadata.description, - images: seoMetadata.images, + images: seoMetadata.openGraph.images, article: { - authors: seoMetadata.authors, + authors: seoMetadata.authors?.map((x) => x.name), tags: seoMetadata.tags, ...(seoMetadata.publishedTime && { publishedTime: seoMetadata.publishedTime, diff --git a/starters/nextjs-starter-ts/pages/examples/ssg-isr/[uri].tsx b/starters/nextjs-starter-ts/pages/examples/ssg-isr/[uri].tsx index d1e681c6..ee69c879 100644 --- a/starters/nextjs-starter-ts/pages/examples/ssg-isr/[uri].tsx +++ b/starters/nextjs-starter-ts/pages/examples/ssg-isr/[uri].tsx @@ -30,7 +30,7 @@ export default function ArticlePage({ title: seoMetadata.title, description: seoMetadata.description, article: { - authors: seoMetadata.authors, + authors: seoMetadata.authors?.map((x) => x.name), tags: seoMetadata.tags, ...(seoMetadata.publishedTime && { publishedTime: seoMetadata.publishedTime, diff --git a/starters/nextjs-starter/lib/pcc-metadata-groups.js b/starters/nextjs-starter/lib/pcc-metadata-groups.js new file mode 100644 index 00000000..0d50339b --- /dev/null +++ b/starters/nextjs-starter/lib/pcc-metadata-groups.js @@ -0,0 +1,21 @@ +const authors = [ + { + id: 1, + name: "James T. Kirk", + image: "https://en.wikipedia.org/wiki/File:William_Shatner_Star_Trek.JPG", + }, + { + id: 2, + name: "Spock", + image: + "https://upload.wikimedia.org/wikipedia/commons/thumb/f/fa/Leonard_Nimoy_as_Spock_1967.jpg/440px-Leonard_Nimoy_as_Spock_1967.jpg", + }, +]; + +export function getAuthorById(id) { + return authors.find((x) => x.id?.toString() === id); +} + +export function listAuthors() { + return authors; +} diff --git a/starters/nextjs-starter/lib/utils.js b/starters/nextjs-starter/lib/utils.js index ad627ff5..999388b6 100644 --- a/starters/nextjs-starter/lib/utils.js +++ b/starters/nextjs-starter/lib/utils.js @@ -1,5 +1,6 @@ import { clsx } from "clsx"; import { twMerge } from "tailwind-merge"; +import { getAuthorById } from "./pcc-metadata-groups"; export function cn(...inputs) { return twMerge(clsx(inputs)); @@ -20,16 +21,17 @@ function isDateInputObject(v) { export function getSeoMetadata(article) { const tags = article.tags && article.tags.length > 0 ? article.tags : []; - let authors = []; let publishedTime = null; - // Collecting data from metadata fields + // Collecting data from metadata fields. Identifies the key in a case in-sensitive way. Object.entries(article.metadata || {}).forEach(([key, val]) => { - if (key.toLowerCase().trim() === "author" && val) authors = [val]; - else if (key.toLowerCase().trim() === "date" && isDateInputObject(val)) + if (key.toLowerCase().trim() === "date" && isDateInputObject(val)) publishedTime = new Date(val.msSinceEpoch).toISOString(); }); + const authorId = article.metadata.author; + const authorName = authorId ? getAuthorById(authorId)?.name : undefined; + const imageProperties = [ article.metadata?.["Hero Image"], // Extend as needed @@ -37,12 +39,25 @@ export function getSeoMetadata(article) { .filter((url) => typeof url === "string") .map((url) => ({ url })); + const description = "Article hosted using Pantheon Content Publisher"; + return { title: article.title, - description: "Article hosted using Pantheon Content Cloud", + description, tags, - authors, + authors: authorName + ? [ + { + name: authorName, + }, + ] + : null, publishedTime, - images: imageProperties, + openGraph: { + type: "website", + title: article.title, + description, + images: imageProperties, + }, }; } diff --git a/starters/nextjs-starter/pages/api/pantheoncloud/[...command].js b/starters/nextjs-starter/pages/api/pantheoncloud/[...command].js index e8e90f73..d472a97d 100644 --- a/starters/nextjs-starter/pages/api/pantheoncloud/[...command].js +++ b/starters/nextjs-starter/pages/api/pantheoncloud/[...command].js @@ -1,11 +1,24 @@ import { PantheonAPI } from "@pantheon-systems/pcc-react-sdk"; import { serverSmartComponentMap } from "../../../components/smart-components"; +import { getAuthorById, listAuthors } from "../../../lib/pcc-metadata-groups"; export const pantheonAPIOptions = { resolvePath: (article) => `/articles/${article.slug || article.id}`, smartComponentMap: serverSmartComponentMap, componentPreviewPath: (componentName) => `/component-preview/${componentName}`, + metadataGroups: [ + { + label: "Author", + groupIdentifier: "AUTHOR", + schema: { + name: "string", + image: "file", + }, + get: getAuthorById, + list: listAuthors, + }, + ], }; export default PantheonAPI(pantheonAPIOptions); diff --git a/starters/nextjs-starter/pages/articles/[...uri].jsx b/starters/nextjs-starter/pages/articles/[...uri].jsx index 12cb57bf..1c9184d1 100644 --- a/starters/nextjs-starter/pages/articles/[...uri].jsx +++ b/starters/nextjs-starter/pages/articles/[...uri].jsx @@ -29,7 +29,7 @@ export default function ArticlePage({ article, grant }) { description: seoMetadata.description, images: seoMetadata.images, article: { - authors: seoMetadata.authors, + authors: seoMetadata.authors?.map((x) => x.name), tags: seoMetadata.tags, ...(seoMetadata.publishedTime && { publishedTime: seoMetadata.publishedTime, diff --git a/starters/nextjs-starter/pages/examples/ssg-isr/[uri].jsx b/starters/nextjs-starter/pages/examples/ssg-isr/[uri].jsx index 7ed1dac5..0a7f952f 100644 --- a/starters/nextjs-starter/pages/examples/ssg-isr/[uri].jsx +++ b/starters/nextjs-starter/pages/examples/ssg-isr/[uri].jsx @@ -18,7 +18,7 @@ export default function ArticlePage({ article, recommendedArticles }) { title: seoMetadata.title, description: seoMetadata.description, article: { - authors: seoMetadata.authors, + authors: seoMetadata.authors?.map((x) => x.name), tags: seoMetadata.tags, ...(seoMetadata.publishedTime && { publishedTime: seoMetadata.publishedTime, From 9c864b541407986aea9b26274da33759305aec00 Mon Sep 17 00:00:00 2001 From: Kevin Stubbs Date: Thu, 17 Oct 2024 17:28:11 +0200 Subject: [PATCH 08/14] Fix starters build. --- starters/nextjs-starter/lib/utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/starters/nextjs-starter/lib/utils.js b/starters/nextjs-starter/lib/utils.js index 2408de08..a3c570c1 100644 --- a/starters/nextjs-starter/lib/utils.js +++ b/starters/nextjs-starter/lib/utils.js @@ -42,7 +42,7 @@ export function getSeoMetadata(article) { switch (key) { case "author": { if (typeof v === "string") { - authors = [v]; + authors.push(v); } break; } @@ -58,7 +58,7 @@ export function getSeoMetadata(article) { const authorName = getAuthorById(v)?.name; if (authorName) { - authors.push({ name: v }); + authors.push(v); } } break; From c136c8fe20f91c0a6327c49d4036966acec5253c Mon Sep 17 00:00:00 2001 From: Kevin Stubbs Date: Tue, 17 Dec 2024 13:24:43 +0100 Subject: [PATCH 09/14] Use 'label' as the primary identifier for both group and its records. --- packages/core/src/types/index.ts | 14 +++++++++++--- .../lib/pcc-metadata-groups.ts | 6 +++--- starters/nextjs-starter-approuter-ts/lib/utils.ts | 2 +- .../nextjs-starter-ts/lib/pcc-metadata-groups.ts | 6 +++--- starters/nextjs-starter-ts/lib/utils.ts | 2 +- starters/nextjs-starter/lib/pcc-metadata-groups.js | 4 ++-- starters/nextjs-starter/lib/utils.js | 2 +- 7 files changed, 22 insertions(+), 14 deletions(-) diff --git a/packages/core/src/types/index.ts b/packages/core/src/types/index.ts index 6308555f..faa74766 100644 --- a/packages/core/src/types/index.ts +++ b/packages/core/src/types/index.ts @@ -114,6 +114,10 @@ export interface PantheonTree { children: PantheonTreeNode[]; } +interface MetadataGroupRowEssentials { + label: string; +} + export interface MetadataGroup { label: string; groupIdentifier: string; @@ -123,10 +127,14 @@ export interface MetadataGroup { >; get: ( id: string, - ) => Promise | unknown | null | undefined; + ) => + | Promise<(unknown & MetadataGroupRowEssentials) | null | undefined> + | (unknown & MetadataGroupRowEssentials) + | null + | undefined; list: () => - | Promise - | unknown[] + | Promise<(unknown & MetadataGroupRowEssentials)[] | null | undefined> + | (unknown & MetadataGroupRowEssentials)[] | null | undefined; } diff --git a/starters/nextjs-starter-approuter-ts/lib/pcc-metadata-groups.ts b/starters/nextjs-starter-approuter-ts/lib/pcc-metadata-groups.ts index 5090f246..764b6ed8 100644 --- a/starters/nextjs-starter-approuter-ts/lib/pcc-metadata-groups.ts +++ b/starters/nextjs-starter-approuter-ts/lib/pcc-metadata-groups.ts @@ -1,18 +1,18 @@ export interface Author { id: string | number; - name: string; + label: string; image: string; } const authors = [ { id: 1, - name: "James T. Kirk", + label: "James T. Kirk", image: "https://en.wikipedia.org/wiki/File:William_Shatner_Star_Trek.JPG", }, { id: 2, - name: "Spock", + label: "Spock", image: "https://upload.wikimedia.org/wikipedia/commons/thumb/f/fa/Leonard_Nimoy_as_Spock_1967.jpg/440px-Leonard_Nimoy_as_Spock_1967.jpg", }, diff --git a/starters/nextjs-starter-approuter-ts/lib/utils.ts b/starters/nextjs-starter-approuter-ts/lib/utils.ts index f2551388..26a59063 100644 --- a/starters/nextjs-starter-approuter-ts/lib/utils.ts +++ b/starters/nextjs-starter-approuter-ts/lib/utils.ts @@ -46,7 +46,7 @@ export function getSeoMetadata(article: ArticleWithoutContent): Metadata { } case "complex-author": { if (typeof v === "string") { - const authorName = getAuthorById(v)?.name; + const authorName = getAuthorById(v)?.label; if (authorName) { authors.push({ name: v }); diff --git a/starters/nextjs-starter-ts/lib/pcc-metadata-groups.ts b/starters/nextjs-starter-ts/lib/pcc-metadata-groups.ts index 5090f246..764b6ed8 100644 --- a/starters/nextjs-starter-ts/lib/pcc-metadata-groups.ts +++ b/starters/nextjs-starter-ts/lib/pcc-metadata-groups.ts @@ -1,18 +1,18 @@ export interface Author { id: string | number; - name: string; + label: string; image: string; } const authors = [ { id: 1, - name: "James T. Kirk", + label: "James T. Kirk", image: "https://en.wikipedia.org/wiki/File:William_Shatner_Star_Trek.JPG", }, { id: 2, - name: "Spock", + label: "Spock", image: "https://upload.wikimedia.org/wikipedia/commons/thumb/f/fa/Leonard_Nimoy_as_Spock_1967.jpg/440px-Leonard_Nimoy_as_Spock_1967.jpg", }, diff --git a/starters/nextjs-starter-ts/lib/utils.ts b/starters/nextjs-starter-ts/lib/utils.ts index 7bca9ed3..6b6b9a27 100644 --- a/starters/nextjs-starter-ts/lib/utils.ts +++ b/starters/nextjs-starter-ts/lib/utils.ts @@ -55,7 +55,7 @@ export function getSeoMetadata(article: ArticleWithoutContent) { } case "complex-author": { if (typeof v === "string") { - const authorName = getAuthorById(v)?.name; + const authorName = getAuthorById(v)?.label; if (authorName) { authors.push(v); diff --git a/starters/nextjs-starter/lib/pcc-metadata-groups.js b/starters/nextjs-starter/lib/pcc-metadata-groups.js index 0d50339b..cfd11f0d 100644 --- a/starters/nextjs-starter/lib/pcc-metadata-groups.js +++ b/starters/nextjs-starter/lib/pcc-metadata-groups.js @@ -1,12 +1,12 @@ const authors = [ { id: 1, - name: "James T. Kirk", + label: "James T. Kirk", image: "https://en.wikipedia.org/wiki/File:William_Shatner_Star_Trek.JPG", }, { id: 2, - name: "Spock", + label: "Spock", image: "https://upload.wikimedia.org/wikipedia/commons/thumb/f/fa/Leonard_Nimoy_as_Spock_1967.jpg/440px-Leonard_Nimoy_as_Spock_1967.jpg", }, diff --git a/starters/nextjs-starter/lib/utils.js b/starters/nextjs-starter/lib/utils.js index a3c570c1..d0e124cd 100644 --- a/starters/nextjs-starter/lib/utils.js +++ b/starters/nextjs-starter/lib/utils.js @@ -55,7 +55,7 @@ export function getSeoMetadata(article) { } case "complex-author": { if (typeof v === "string") { - const authorName = getAuthorById(v)?.name; + const authorName = getAuthorById(v)?.label; if (authorName) { authors.push(v); From 67bc79bd2bd05f184466d3b5861ab12a286ecbdf Mon Sep 17 00:00:00 2001 From: Kevin Stubbs Date: Tue, 17 Dec 2024 13:27:48 +0100 Subject: [PATCH 10/14] Update changeset for name => label change. --- .changeset/good-weeks-agree.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .changeset/good-weeks-agree.md diff --git a/.changeset/good-weeks-agree.md b/.changeset/good-weeks-agree.md new file mode 100644 index 00000000..f53eb976 --- /dev/null +++ b/.changeset/good-weeks-agree.md @@ -0,0 +1,13 @@ +--- +"@pantheon-systems/next-approuter-pcc-starter-ts": patch +"@pantheon-systems/pcc-react-sample-library": patch +"@pantheon-systems/vue-pcc-starter-ts": patch +"@pantheon-systems/vue-pcc-starter": patch +"@pantheon-systems/pcc-react-sdk": patch +"@pantheon-systems/pcc-browser-sdk": patch +"@pantheon-systems/pcc-vue-sdk": patch +"@pantheon-systems/pcc-sdk-core": patch +"@pantheon-systems/pcc-cli": patch +--- + +Use 'label' for metadata group record identifiers instead of 'name' From 2b9005115ad7f9137cdf11be661b5da13d51fc34 Mon Sep 17 00:00:00 2001 From: Kevin Stubbs Date: Tue, 17 Dec 2024 13:28:40 +0100 Subject: [PATCH 11/14] Bump beta version. --- .changeset/pre.json | 6 +++++- packages/browser/CHANGELOG.md | 8 ++++++++ packages/browser/package.json | 2 +- packages/cli/CHANGELOG.md | 15 +++++++++++++++ packages/cli/package.json | 2 +- packages/core/CHANGELOG.md | 6 ++++++ packages/core/package.json | 2 +- packages/react-sample-library/CHANGELOG.md | 10 ++++++++++ packages/react-sample-library/package.json | 2 +- packages/react-sdk/CHANGELOG.md | 13 +++++++++++++ packages/react-sdk/package.json | 2 +- packages/vue-sdk/CHANGELOG.md | 8 ++++++++ packages/vue-sdk/package.json | 2 +- starters/gatsby-starter-ts/package.json | 2 +- starters/gatsby-starter/package.json | 2 +- starters/nextjs-starter-approuter-ts/CHANGELOG.md | 9 +++++++++ starters/nextjs-starter-approuter-ts/package.json | 4 ++-- starters/nextjs-starter-ts/package.json | 2 +- starters/nextjs-starter/package.json | 2 +- starters/vue-starter-ts/CHANGELOG.md | 8 ++++++++ starters/vue-starter-ts/package.json | 4 ++-- starters/vue-starter/CHANGELOG.md | 8 ++++++++ starters/vue-starter/package.json | 4 ++-- 23 files changed, 106 insertions(+), 17 deletions(-) diff --git a/.changeset/pre.json b/.changeset/pre.json index 7c0a0c25..05b4eb7b 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -19,7 +19,11 @@ "@pantheon-systems/vue-pcc-starter-ts": "1.1.3" }, "changesets": [ + "good-weeks-agree", + "plenty-rice-cheer", + "proud-socks-cry", "seven-owls-poke", - "sixty-moose-act" + "sixty-moose-act", + "ten-cats-swim" ] } diff --git a/packages/browser/CHANGELOG.md b/packages/browser/CHANGELOG.md index 80f59cd7..915e6e77 100644 --- a/packages/browser/CHANGELOG.md +++ b/packages/browser/CHANGELOG.md @@ -1,5 +1,13 @@ # @pantheon-systems/pcc-browser-sdk +## 3.10.0-beta.2 + +### Patch Changes + +- 67bc79b: Use 'label' for metadata group record identifiers instead of 'name' +- Updated dependencies [67bc79b] + - @pantheon-systems/pcc-sdk-core@3.10.0-beta.2 + ## 3.10.0-beta.1 ### Patch Changes diff --git a/packages/browser/package.json b/packages/browser/package.json index 0df0a95a..ab5f73ff 100644 --- a/packages/browser/package.json +++ b/packages/browser/package.json @@ -2,7 +2,7 @@ "name": "@pantheon-systems/pcc-browser-sdk", "author": "@pantheon-systems", "description": "Pantheon Content Cloud Browser SDK", - "version": "3.10.0-beta.1", + "version": "3.10.0-beta.2", "main": "dist/index.js", "files": [ "dist", diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index a20a98df..757e6415 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -1,5 +1,20 @@ # @pantheon-systems/pcc-cli +## 3.10.0-beta.2 + +### Minor Changes + +- 0b3ee7b: No longer download turbo.json when initializing a new project from the starter + kit. + +### Patch Changes + +- 67bc79b: Use 'label' for metadata group record identifiers instead of 'name' +- 39b7604: Added a warning message when CLI build is pointing to non-production + environment. +- Updated dependencies [67bc79b] + - @pantheon-systems/pcc-sdk-core@3.10.0-beta.2 + ## 3.10.0-beta.1 ### Patch Changes diff --git a/packages/cli/package.json b/packages/cli/package.json index d052ad8e..94f1d16c 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -2,7 +2,7 @@ "name": "@pantheon-systems/pcc-cli", "author": "@pantheon-systems", "description": "Pantheon Content Cloud CLI", - "version": "3.10.0-beta.1", + "version": "3.10.0-beta.2", "type": "module", "license": "MIT", "keywords": [ diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index c1f394f8..b7446bf3 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -1,5 +1,11 @@ # @pantheon-systems/pcc-sdk-core +## 3.10.0-beta.2 + +### Patch Changes + +- 67bc79b: Use 'label' for metadata group record identifiers instead of 'name' + ## 3.10.0-beta.1 ### Patch Changes diff --git a/packages/core/package.json b/packages/core/package.json index 65dedb54..acceb14e 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -2,7 +2,7 @@ "name": "@pantheon-systems/pcc-sdk-core", "author": "@pantheon-systems", "description": "Pantheon Content Cloud SDK Core", - "version": "3.10.0-beta.1", + "version": "3.10.0-beta.2", "license": "MIT", "main": "./dist/index.js", "module": "./dist/index.mjs", diff --git a/packages/react-sample-library/CHANGELOG.md b/packages/react-sample-library/CHANGELOG.md index 226046f9..2e7f7b03 100644 --- a/packages/react-sample-library/CHANGELOG.md +++ b/packages/react-sample-library/CHANGELOG.md @@ -1,5 +1,15 @@ # @pantheon-systems/pcc-vue-sdk +## 3.10.0-beta.2 + +### Patch Changes + +- 67bc79b: Use 'label' for metadata group record identifiers instead of 'name' +- Updated dependencies [67bc79b] +- Updated dependencies [b89c5ee] + - @pantheon-systems/pcc-react-sdk@3.10.0-beta.2 + - @pantheon-systems/pcc-sdk-core@3.10.0-beta.2 + ## 3.10.0-beta.1 ### Patch Changes diff --git a/packages/react-sample-library/package.json b/packages/react-sample-library/package.json index ff5f2809..0a8e430c 100644 --- a/packages/react-sample-library/package.json +++ b/packages/react-sample-library/package.json @@ -2,7 +2,7 @@ "name": "@pantheon-systems/pcc-react-sample-library", "author": "@pantheon-systems", "description": "Pantheon Content Cloud Sample Component Library for React", - "version": "3.10.0-beta.1", + "version": "3.10.0-beta.2", "main": "./dist/index.js", "module": "./dist/index.mjs", "types": "./dist/index.d.ts", diff --git a/packages/react-sdk/CHANGELOG.md b/packages/react-sdk/CHANGELOG.md index 35ad3798..520c0a26 100644 --- a/packages/react-sdk/CHANGELOG.md +++ b/packages/react-sdk/CHANGELOG.md @@ -1,5 +1,18 @@ # @pantheon-systems/pcc-react-sdk +## 3.10.0-beta.2 + +### Minor Changes + +- b89c5ee: The injected preview bar is deprecated in favor of the integrated preview bar in + the dashboard preview interface + +### Patch Changes + +- 67bc79b: Use 'label' for metadata group record identifiers instead of 'name' +- Updated dependencies [67bc79b] + - @pantheon-systems/pcc-sdk-core@3.10.0-beta.2 + ## 3.10.0-beta.1 ### Patch Changes diff --git a/packages/react-sdk/package.json b/packages/react-sdk/package.json index e627cadc..99eb318d 100644 --- a/packages/react-sdk/package.json +++ b/packages/react-sdk/package.json @@ -2,7 +2,7 @@ "name": "@pantheon-systems/pcc-react-sdk", "author": "@pantheon-systems", "description": "Pantheon Content Cloud React SDK", - "version": "3.10.0-beta.1", + "version": "3.10.0-beta.2", "license": "MIT", "keywords": [ "pcc", diff --git a/packages/vue-sdk/CHANGELOG.md b/packages/vue-sdk/CHANGELOG.md index 3631b9a6..a7b57173 100644 --- a/packages/vue-sdk/CHANGELOG.md +++ b/packages/vue-sdk/CHANGELOG.md @@ -1,5 +1,13 @@ # @pantheon-systems/pcc-vue-sdk +## 3.10.0-beta.2 + +### Patch Changes + +- 67bc79b: Use 'label' for metadata group record identifiers instead of 'name' +- Updated dependencies [67bc79b] + - @pantheon-systems/pcc-sdk-core@3.10.0-beta.2 + ## 3.10.0-beta.1 ### Patch Changes diff --git a/packages/vue-sdk/package.json b/packages/vue-sdk/package.json index 0f13c8ae..46c90a14 100644 --- a/packages/vue-sdk/package.json +++ b/packages/vue-sdk/package.json @@ -2,7 +2,7 @@ "name": "@pantheon-systems/pcc-vue-sdk", "author": "@pantheon-systems", "description": "Pantheon Content Cloud Vue SDK", - "version": "3.10.0-beta.1", + "version": "3.10.0-beta.2", "main": "./dist/index.cjs", "module": "./dist/index.mjs", "types": "./dist/index.d.ts", diff --git a/starters/gatsby-starter-ts/package.json b/starters/gatsby-starter-ts/package.json index 3e9cad7d..5f91d7da 100644 --- a/starters/gatsby-starter-ts/package.json +++ b/starters/gatsby-starter-ts/package.json @@ -15,7 +15,7 @@ }, "dependencies": { "@mdx-js/react": "2.3.0", - "@pantheon-systems/pcc-react-sdk": "~3.10.0-beta.1", + "@pantheon-systems/pcc-react-sdk": "~3.10.0-beta.2", "@pantheon-systems/pds-toolkit-react": "1.0.0-dev.55", "autoprefixer": "^10.4.17", "gatsby": "5.13.5", diff --git a/starters/gatsby-starter/package.json b/starters/gatsby-starter/package.json index 96658c7d..590cbba0 100644 --- a/starters/gatsby-starter/package.json +++ b/starters/gatsby-starter/package.json @@ -15,7 +15,7 @@ }, "dependencies": { "@mdx-js/react": "2.3.0", - "@pantheon-systems/pcc-react-sdk": "3.10.0-beta.1", + "@pantheon-systems/pcc-react-sdk": "3.10.0-beta.2", "@pantheon-systems/pds-toolkit-react": "1.0.0-dev.55", "autoprefixer": "^10.4.17", "gatsby": "5.13.5", diff --git a/starters/nextjs-starter-approuter-ts/CHANGELOG.md b/starters/nextjs-starter-approuter-ts/CHANGELOG.md index d68ca457..8d91bdfc 100644 --- a/starters/nextjs-starter-approuter-ts/CHANGELOG.md +++ b/starters/nextjs-starter-approuter-ts/CHANGELOG.md @@ -1,5 +1,14 @@ # @pantheon-systems/next-pcc-starter +## 1.1.9-beta.1 + +### Patch Changes + +- 67bc79b: Use 'label' for metadata group record identifiers instead of 'name' +- Updated dependencies [67bc79b] +- Updated dependencies [b89c5ee] + - @pantheon-systems/pcc-react-sdk@3.10.0-beta.2 + ## 1.1.9-beta.0 ### Patch Changes diff --git a/starters/nextjs-starter-approuter-ts/package.json b/starters/nextjs-starter-approuter-ts/package.json index 5f5f1b56..3f61b8ac 100644 --- a/starters/nextjs-starter-approuter-ts/package.json +++ b/starters/nextjs-starter-approuter-ts/package.json @@ -1,6 +1,6 @@ { "name": "@pantheon-systems/next-approuter-pcc-starter-ts", - "version": "1.1.9-beta.0", + "version": "1.1.9-beta.1", "private": true, "license": "GPL-3.0-or-later", "description": "A starter for building a Pantheon Content Cloud (PCC) powered site with Next.js App Router and TypeScript", @@ -26,7 +26,7 @@ "node": ">=18.0.0" }, "dependencies": { - "@pantheon-systems/pcc-react-sdk": "~3.10.0-beta.0", + "@pantheon-systems/pcc-react-sdk": "~3.10.0-beta.2", "@radix-ui/react-popover": "^1.1.1", "@radix-ui/react-slot": "^1.1.0", "@tailwindcss/typography": "0.5.10", diff --git a/starters/nextjs-starter-ts/package.json b/starters/nextjs-starter-ts/package.json index e6b8fe59..c30a7de1 100644 --- a/starters/nextjs-starter-ts/package.json +++ b/starters/nextjs-starter-ts/package.json @@ -26,7 +26,7 @@ "node": ">=18.0.0" }, "dependencies": { - "@pantheon-systems/pcc-react-sdk": "~3.10.0-beta.1", + "@pantheon-systems/pcc-react-sdk": "~3.10.0-beta.2", "@radix-ui/react-popover": "^1.1.1", "@radix-ui/react-slot": "^1.1.0", "@tailwindcss/typography": "0.5.10", diff --git a/starters/nextjs-starter/package.json b/starters/nextjs-starter/package.json index dfb3ebe5..2735916a 100644 --- a/starters/nextjs-starter/package.json +++ b/starters/nextjs-starter/package.json @@ -26,7 +26,7 @@ "node": ">=18.0.0" }, "dependencies": { - "@pantheon-systems/pcc-react-sdk": "~3.10.0-beta.1", + "@pantheon-systems/pcc-react-sdk": "~3.10.0-beta.2", "@radix-ui/react-popover": "^1.1.1", "@radix-ui/react-slot": "^1.1.0", "@tailwindcss/typography": "0.5.10", diff --git a/starters/vue-starter-ts/CHANGELOG.md b/starters/vue-starter-ts/CHANGELOG.md index d0a5846c..01b217af 100644 --- a/starters/vue-starter-ts/CHANGELOG.md +++ b/starters/vue-starter-ts/CHANGELOG.md @@ -1,5 +1,13 @@ # @pantheon-systems/vue-pcc-starter-ts +## 1.1.4-beta.1 + +### Patch Changes + +- 67bc79b: Use 'label' for metadata group record identifiers instead of 'name' +- Updated dependencies [67bc79b] + - @pantheon-systems/pcc-vue-sdk@3.10.0-beta.2 + ## 1.1.4-beta.0 ### Patch Changes diff --git a/starters/vue-starter-ts/package.json b/starters/vue-starter-ts/package.json index 876a193a..70883a43 100644 --- a/starters/vue-starter-ts/package.json +++ b/starters/vue-starter-ts/package.json @@ -21,7 +21,7 @@ "vue-router": "4.3.0" }, "dependencies": { - "@pantheon-systems/pcc-vue-sdk": "~3.10.0-beta.0" + "@pantheon-systems/pcc-vue-sdk": "~3.10.0-beta.2" }, - "version": "1.1.4-beta.0" + "version": "1.1.4-beta.1" } diff --git a/starters/vue-starter/CHANGELOG.md b/starters/vue-starter/CHANGELOG.md index 8aa437bd..ff0fa98f 100644 --- a/starters/vue-starter/CHANGELOG.md +++ b/starters/vue-starter/CHANGELOG.md @@ -1,5 +1,13 @@ # @pantheon-systems/vue-pcc-starter +## 1.1.4-beta.1 + +### Patch Changes + +- 67bc79b: Use 'label' for metadata group record identifiers instead of 'name' +- Updated dependencies [67bc79b] + - @pantheon-systems/pcc-vue-sdk@3.10.0-beta.2 + ## 1.1.4-beta.0 ### Patch Changes diff --git a/starters/vue-starter/package.json b/starters/vue-starter/package.json index beda6a2c..e8c4615c 100644 --- a/starters/vue-starter/package.json +++ b/starters/vue-starter/package.json @@ -21,7 +21,7 @@ "vue-router": "4.3.0" }, "dependencies": { - "@pantheon-systems/pcc-vue-sdk": "~3.10.0-beta.0" + "@pantheon-systems/pcc-vue-sdk": "~3.10.0-beta.2" }, - "version": "1.1.4-beta.0" + "version": "1.1.4-beta.1" } From a5639f805698512c867ee407c299095914c53c01 Mon Sep 17 00:00:00 2001 From: Kevin Stubbs Date: Tue, 17 Dec 2024 13:44:46 +0100 Subject: [PATCH 12/14] Undo changes to vue package & starter kits. --- .changeset/good-weeks-agree.md | 3 --- packages/vue-sdk/CHANGELOG.md | 22 ---------------------- packages/vue-sdk/package.json | 2 +- starters/vue-starter-ts/CHANGELOG.md | 14 -------------- starters/vue-starter-ts/package.json | 4 ++-- starters/vue-starter/CHANGELOG.md | 14 -------------- starters/vue-starter/package.json | 4 ++-- 7 files changed, 5 insertions(+), 58 deletions(-) diff --git a/.changeset/good-weeks-agree.md b/.changeset/good-weeks-agree.md index f53eb976..c71306bc 100644 --- a/.changeset/good-weeks-agree.md +++ b/.changeset/good-weeks-agree.md @@ -1,11 +1,8 @@ --- "@pantheon-systems/next-approuter-pcc-starter-ts": patch "@pantheon-systems/pcc-react-sample-library": patch -"@pantheon-systems/vue-pcc-starter-ts": patch -"@pantheon-systems/vue-pcc-starter": patch "@pantheon-systems/pcc-react-sdk": patch "@pantheon-systems/pcc-browser-sdk": patch -"@pantheon-systems/pcc-vue-sdk": patch "@pantheon-systems/pcc-sdk-core": patch "@pantheon-systems/pcc-cli": patch --- diff --git a/packages/vue-sdk/CHANGELOG.md b/packages/vue-sdk/CHANGELOG.md index a7b57173..56c0c93e 100644 --- a/packages/vue-sdk/CHANGELOG.md +++ b/packages/vue-sdk/CHANGELOG.md @@ -1,27 +1,5 @@ # @pantheon-systems/pcc-vue-sdk -## 3.10.0-beta.2 - -### Patch Changes - -- 67bc79b: Use 'label' for metadata group record identifiers instead of 'name' -- Updated dependencies [67bc79b] - - @pantheon-systems/pcc-sdk-core@3.10.0-beta.2 - -## 3.10.0-beta.1 - -### Patch Changes - -- Updated dependencies [400fc48] - - @pantheon-systems/pcc-sdk-core@3.10.0-beta.1 - -## 3.10.0-beta.0 - -### Patch Changes - -- Updated dependencies [572fb97] - - @pantheon-systems/pcc-sdk-core@3.10.0-beta.0 - ## 3.9.0 ### Patch Changes diff --git a/packages/vue-sdk/package.json b/packages/vue-sdk/package.json index 46c90a14..89ededa7 100644 --- a/packages/vue-sdk/package.json +++ b/packages/vue-sdk/package.json @@ -2,7 +2,7 @@ "name": "@pantheon-systems/pcc-vue-sdk", "author": "@pantheon-systems", "description": "Pantheon Content Cloud Vue SDK", - "version": "3.10.0-beta.2", + "version": "3.9.0", "main": "./dist/index.cjs", "module": "./dist/index.mjs", "types": "./dist/index.d.ts", diff --git a/starters/vue-starter-ts/CHANGELOG.md b/starters/vue-starter-ts/CHANGELOG.md index 01b217af..ec98d62f 100644 --- a/starters/vue-starter-ts/CHANGELOG.md +++ b/starters/vue-starter-ts/CHANGELOG.md @@ -1,19 +1,5 @@ # @pantheon-systems/vue-pcc-starter-ts -## 1.1.4-beta.1 - -### Patch Changes - -- 67bc79b: Use 'label' for metadata group record identifiers instead of 'name' -- Updated dependencies [67bc79b] - - @pantheon-systems/pcc-vue-sdk@3.10.0-beta.2 - -## 1.1.4-beta.0 - -### Patch Changes - -- @pantheon-systems/pcc-vue-sdk@3.10.0-beta.0 - ## 1.1.3 ### Patch Changes diff --git a/starters/vue-starter-ts/package.json b/starters/vue-starter-ts/package.json index 70883a43..f697a7cb 100644 --- a/starters/vue-starter-ts/package.json +++ b/starters/vue-starter-ts/package.json @@ -21,7 +21,7 @@ "vue-router": "4.3.0" }, "dependencies": { - "@pantheon-systems/pcc-vue-sdk": "~3.10.0-beta.2" + "@pantheon-systems/pcc-vue-sdk": "~3.9.0" }, - "version": "1.1.4-beta.1" + "version": "1.1.3" } diff --git a/starters/vue-starter/CHANGELOG.md b/starters/vue-starter/CHANGELOG.md index ff0fa98f..e4824aef 100644 --- a/starters/vue-starter/CHANGELOG.md +++ b/starters/vue-starter/CHANGELOG.md @@ -1,19 +1,5 @@ # @pantheon-systems/vue-pcc-starter -## 1.1.4-beta.1 - -### Patch Changes - -- 67bc79b: Use 'label' for metadata group record identifiers instead of 'name' -- Updated dependencies [67bc79b] - - @pantheon-systems/pcc-vue-sdk@3.10.0-beta.2 - -## 1.1.4-beta.0 - -### Patch Changes - -- @pantheon-systems/pcc-vue-sdk@3.10.0-beta.0 - ## 1.1.3 ### Patch Changes diff --git a/starters/vue-starter/package.json b/starters/vue-starter/package.json index e8c4615c..5a40d144 100644 --- a/starters/vue-starter/package.json +++ b/starters/vue-starter/package.json @@ -21,7 +21,7 @@ "vue-router": "4.3.0" }, "dependencies": { - "@pantheon-systems/pcc-vue-sdk": "~3.10.0-beta.2" + "@pantheon-systems/pcc-vue-sdk": "~3.9.0" }, - "version": "1.1.4-beta.1" + "version": "1.1.3" } From 9ffdc92116f010b311cd79f087d35abde54681cd Mon Sep 17 00:00:00 2001 From: Kevin Stubbs Date: Tue, 17 Dec 2024 14:36:20 +0100 Subject: [PATCH 13/14] Automated markdown changes. --- packages/cli/CHANGELOG.md | 4 ++-- packages/react-sdk/CHANGELOG.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index 757e6415..8ef84384 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -4,8 +4,8 @@ ### Minor Changes -- 0b3ee7b: No longer download turbo.json when initializing a new project from the starter - kit. +- 0b3ee7b: No longer download turbo.json when initializing a new project from + the starter kit. ### Patch Changes diff --git a/packages/react-sdk/CHANGELOG.md b/packages/react-sdk/CHANGELOG.md index 520c0a26..bbabf955 100644 --- a/packages/react-sdk/CHANGELOG.md +++ b/packages/react-sdk/CHANGELOG.md @@ -4,8 +4,8 @@ ### Minor Changes -- b89c5ee: The injected preview bar is deprecated in favor of the integrated preview bar in - the dashboard preview interface +- b89c5ee: The injected preview bar is deprecated in favor of the integrated + preview bar in the dashboard preview interface ### Patch Changes From 22815819056832bf3367b3628feb008c0a3d509e Mon Sep 17 00:00:00 2001 From: Kevin Stubbs Date: Tue, 24 Dec 2024 18:24:27 +0200 Subject: [PATCH 14/14] Fix unnecessary block codacy error. --- starters/nextjs-starter/lib/utils.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/starters/nextjs-starter/lib/utils.js b/starters/nextjs-starter/lib/utils.js index d0e124cd..627bae9a 100644 --- a/starters/nextjs-starter/lib/utils.js +++ b/starters/nextjs-starter/lib/utils.js @@ -53,7 +53,7 @@ export function getSeoMetadata(article) { } break; } - case "complex-author": { + case "complex-author": if (typeof v === "string") { const authorName = getAuthorById(v)?.label; @@ -62,7 +62,6 @@ export function getSeoMetadata(article) { } } break; - } } });