@pantheon-systems/create-p1-starter-kit 0.4.2 → 0.4.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pantheon-systems/create-p1-starter-kit",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "Scaffold a new P1 starter project",
5
5
  "type": "module",
6
6
  "bin": {
@@ -2,9 +2,11 @@ PCC_SITE_ID=your-site-id
2
2
  PCC_TOKEN=your-token
3
3
 
4
4
  # --- P1 backend ---
5
- NEXT_PUBLIC_CSS_BASE_URL=https://css.example.com
5
+ # NEXT_PUBLIC_CSS_BASE_URL defaults to https://ccr.p1.pantheon for production.
6
+ # Override for staging, local, or sandbox deployments:
7
+ # NEXT_PUBLIC_CSS_BASE_URL=https://staging.example.com
6
8
  NEXT_PUBLIC_CSS_SITE_ID=site-123
7
- P1_CSS_API_KEY=your-api-key
9
+ CSS_API_KEY=your-api-key
8
10
 
9
11
  # --- P1 Admin Dashboard (optional) ---
10
12
  # Override the default dashboard URL (https://content.pantheon.io)
@@ -1,5 +1,14 @@
1
1
  # @pantheon-systems/p1-starter
2
2
 
3
+ ## 1.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @pantheon-systems/puck-css@0.4.3
9
+ - @pantheon-systems/p1-next-sdk@0.4.3
10
+ - @pantheon-systems/css-client@0.4.3
11
+
3
12
  ## 1.0.1
4
13
 
5
14
  ### Patch Changes
@@ -18,7 +18,7 @@ import { REMOTE_DATASOURCE_FETCHERS } from "../../lib/remote-datasource-fetchers
18
18
 
19
19
  const initPromise = ensureInitialized({
20
20
  p1BaseUrl: process.env.NEXT_PUBLIC_CSS_BASE_URL,
21
- p1ApiKey: process.env.P1_CSS_API_KEY,
21
+ p1ApiKey: process.env.CSS_API_KEY,
22
22
  p1SiteId: process.env.NEXT_PUBLIC_CSS_SITE_ID,
23
23
  p1BranchId: process.env.NEXT_PUBLIC_CSS_BRANCH_ID,
24
24
  });
@@ -34,6 +34,10 @@ export async function generateMetadata({
34
34
  const { puckPath = [] } = await params;
35
35
  const path = pagePathFromCatchAllSegments(puckPath);
36
36
 
37
+ if (path.startsWith("/_registry/") || path === "/_registry") {
38
+ return { title: "Not Found" };
39
+ }
40
+
37
41
  const [pageData, sp, routeTemplateKeys] = await Promise.all([
38
42
  getPage(path),
39
43
  searchParams,
@@ -70,6 +74,11 @@ export default async function Page({
70
74
  const { puckPath = [] } = await params;
71
75
  const path = pagePathFromCatchAllSegments(puckPath);
72
76
 
77
+ if (path.startsWith("/_registry/") || path === "/_registry") {
78
+ const { notFound } = await import("next/navigation");
79
+ notFound();
80
+ }
81
+
73
82
  const [data, searchParamData, routeTemplateKeys] = await Promise.all([
74
83
  getPage(path),
75
84
  searchParams,
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- import React, { useCallback } from "react";
3
+ import React, { useCallback, useState } from "react";
4
4
  import { useRouter } from "next/navigation";
5
5
  import { Puck } from "@puckeditor/core";
6
6
  import {
@@ -13,6 +13,7 @@ import {
13
13
  } from "@pantheon-systems/puck-css";
14
14
  import { P1NextRouterProvider } from "@pantheon-systems/p1-next-sdk";
15
15
  import type { Checkpoint } from "@pantheon-systems/puck-css";
16
+ import type { ContentRole } from "@pantheon-systems/puck-css";
16
17
 
17
18
  import "@pantheon-systems/puck-css/styles.css";
18
19
  import "@pantheon-systems/puck-css/pds/styles.css";
@@ -30,8 +31,10 @@ try {
30
31
 
31
32
  const editorConfig = wrapConfigForEditorPreview(config);
32
33
 
34
+ const ROLES: ContentRole[] = ['admin', 'editor', 'junior-editor'];
35
+
33
36
  export function EditorClientWrapper({ path }: { path: string }) {
34
- // Keep ref at this level - EditorClientWrapper doesn't unmount on branch switch
37
+ const [userRole, setUserRole] = useState<ContentRole>('editor');
35
38
  const lastGoodStateRef = React.useRef<{ puckKey: string; puckProps: any } | null>(null);
36
39
 
37
40
  if (!p1Config) {
@@ -53,16 +56,67 @@ export function EditorClientWrapper({ path }: { path: string }) {
53
56
  <P1QueryProvider>
54
57
  <P1NextRouterProvider>
55
58
  <P1App
56
- config={p1Config}
59
+ config={{ ...p1Config, userRole }}
57
60
  loginPageProps={{ title: "P1 Starter", subtitle: "Sign in to edit" }}
58
61
  >
59
62
  <EditorContent path={path} lastGoodStateRef={lastGoodStateRef} />
60
63
  </P1App>
64
+ <RoleSwitcher currentRole={userRole} onRoleChange={setUserRole} />
61
65
  </P1NextRouterProvider>
62
66
  </P1QueryProvider>
63
67
  );
64
68
  }
65
69
 
70
+ function RoleSwitcher({
71
+ currentRole,
72
+ onRoleChange,
73
+ }: {
74
+ currentRole: ContentRole;
75
+ onRoleChange: (role: ContentRole) => void;
76
+ }) {
77
+ return (
78
+ <div
79
+ style={{
80
+ position: "fixed",
81
+ bottom: 16,
82
+ right: 16,
83
+ zIndex: 99999,
84
+ background: "rgba(0,0,0,0.85)",
85
+ color: "#fff",
86
+ borderRadius: 8,
87
+ padding: "8px 12px",
88
+ fontFamily: "system-ui",
89
+ fontSize: 12,
90
+ display: "flex",
91
+ alignItems: "center",
92
+ gap: 8,
93
+ boxShadow: "0 2px 8px rgba(0,0,0,0.3)",
94
+ }}
95
+ >
96
+ <span style={{ opacity: 0.7 }}>Role:</span>
97
+ <select
98
+ value={currentRole}
99
+ onChange={(e) => onRoleChange(e.target.value as ContentRole)}
100
+ style={{
101
+ background: "rgba(255,255,255,0.15)",
102
+ color: "#fff",
103
+ border: "1px solid rgba(255,255,255,0.3)",
104
+ borderRadius: 4,
105
+ padding: "2px 6px",
106
+ fontSize: 12,
107
+ cursor: "pointer",
108
+ }}
109
+ >
110
+ {ROLES.map((role) => (
111
+ <option key={role} value={role}>
112
+ {role}
113
+ </option>
114
+ ))}
115
+ </select>
116
+ </div>
117
+ );
118
+ }
119
+
66
120
  function EditorContent({
67
121
  path,
68
122
  lastGoodStateRef,
@@ -7,7 +7,7 @@ import { RenderClientWrapper } from "./render-client";
7
7
  const pages = createP1Pages({
8
8
  config,
9
9
  p1BaseUrl: process.env.NEXT_PUBLIC_CSS_BASE_URL,
10
- p1ApiKey: process.env.P1_CSS_API_KEY,
10
+ p1ApiKey: process.env.CSS_API_KEY,
11
11
  p1SiteId: process.env.NEXT_PUBLIC_CSS_SITE_ID,
12
12
  p1BranchId: process.env.NEXT_PUBLIC_CSS_BRANCH_ID,
13
13
  EditorClient: EditorClientWrapper,
@@ -6,7 +6,7 @@ import { REMOTE_DATASOURCE_REGISTRY } from "../../../../lib/remote-datasources";
6
6
  const handler = createP1Handler({
7
7
  config,
8
8
  p1BaseUrl: process.env.NEXT_PUBLIC_CSS_BASE_URL,
9
- p1ApiKey: process.env.P1_CSS_API_KEY,
9
+ p1ApiKey: process.env.CSS_API_KEY,
10
10
  p1SiteId: process.env.NEXT_PUBLIC_CSS_SITE_ID,
11
11
  p1BranchId: process.env.NEXT_PUBLIC_CSS_BRANCH_ID,
12
12
  builtinFetchers: REMOTE_DATASOURCE_FETCHERS,
@@ -1,7 +1,7 @@
1
1
  import { createP1AuthHandler } from "@pantheon-systems/p1-next-sdk/server";
2
2
 
3
3
  const handler = createP1AuthHandler({
4
- p1ApiKey: process.env.P1_CSS_API_KEY,
4
+ p1ApiKey: process.env.CSS_API_KEY,
5
5
  p1BaseUrl: process.env.NEXT_PUBLIC_CSS_BASE_URL,
6
6
  prompt: 'login',
7
7
  });
@@ -16,7 +16,7 @@ import { CollectionNav } from "./collection-nav";
16
16
 
17
17
  const initPromise = ensureInitialized({
18
18
  p1BaseUrl: process.env.NEXT_PUBLIC_CSS_BASE_URL,
19
- p1ApiKey: process.env.P1_CSS_API_KEY,
19
+ p1ApiKey: process.env.CSS_API_KEY,
20
20
  p1SiteId: process.env.NEXT_PUBLIC_CSS_SITE_ID,
21
21
  p1BranchId: process.env.NEXT_PUBLIC_CSS_BRANCH_ID,
22
22
  });
@@ -11,9 +11,9 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "@pantheon-systems/cpub-react-sdk": "^5.2.1",
14
- "@pantheon-systems/css-client": "^0.4.2",
15
- "@pantheon-systems/p1-next-sdk": "^0.4.2",
16
- "@pantheon-systems/puck-css": "^0.4.2",
14
+ "@pantheon-systems/css-client": "^0.4.3",
15
+ "@pantheon-systems/p1-next-sdk": "^0.4.3",
16
+ "@pantheon-systems/puck-css": "^0.4.3",
17
17
  "@puckeditor/core": "^0.21.1",
18
18
  "@tailwindcss/postcss": "^4.2.2",
19
19
  "classnames": "^2.5.1",
Binary file