@pantheon-systems/create-p1-starter-kit 0.4.1 → 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/lib/messages.js +2 -1
- package/lib/messages.test.js +29 -0
- package/package.json +10 -7
- package/template/.env.example +8 -2
- package/template/CHANGELOG.md +20 -0
- package/template/app/[...puckPath]/client.tsx +33 -2
- package/template/app/[...puckPath]/page.tsx +20 -2
- package/template/app/layout.tsx +1 -1
- package/template/app/p1/[[...p1]]/editor-client.tsx +127 -8
- package/template/app/p1/[[...p1]]/page.tsx +1 -1
- package/template/app/p1/api/[...p1]/route.ts +1 -1
- package/template/app/p1/auth/[...action]/route.ts +1 -1
- package/template/app/page.tsx +11 -2
- package/template/components/puck/root.tsx +1 -2
- package/template/package.json +3 -3
- package/template/public/favicon.ico +0 -0
package/lib/messages.js
CHANGED
|
@@ -13,8 +13,9 @@ export function showSuccess(projectName, projectPath, packageManager) {
|
|
|
13
13
|
console.log(` ${pc.dim('# Copy .env.example to .env and fill in your credentials:')}`);
|
|
14
14
|
console.log(` ${pc.cyan('cp')} .env.example .env`);
|
|
15
15
|
console.log(` ${pc.dim('# Edit .env with your PCC_SITE_ID and PCC_TOKEN')}\n`);
|
|
16
|
+
const devCmd = packageManager === 'npm' ? 'npm run dev' : `${packageManager} dev`;
|
|
16
17
|
console.log(` ${pc.dim('# Start the dev server:')}`);
|
|
17
|
-
console.log(` ${pc.cyan(
|
|
18
|
+
console.log(` ${pc.cyan(devCmd)}\n`);
|
|
18
19
|
console.log(pc.bold('Happy building! 🚀\n'));
|
|
19
20
|
}
|
|
20
21
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
+
import { showSuccess } from './messages.js';
|
|
3
|
+
|
|
4
|
+
describe('showSuccess', () => {
|
|
5
|
+
let output;
|
|
6
|
+
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
output = [];
|
|
9
|
+
vi.spyOn(console, 'log').mockImplementation((...args) => output.push(args.join(' ')));
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('shows "npm run dev" for npm users', () => {
|
|
13
|
+
showSuccess('my-app', '/tmp/my-app', 'npm');
|
|
14
|
+
const allOutput = output.join('\n');
|
|
15
|
+
expect(allOutput).toContain('npm run dev');
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('shows "pnpm dev" for pnpm users', () => {
|
|
19
|
+
showSuccess('my-app', '/tmp/my-app', 'pnpm');
|
|
20
|
+
const allOutput = output.join('\n');
|
|
21
|
+
expect(allOutput).toContain('pnpm dev');
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('shows "yarn dev" for yarn users', () => {
|
|
25
|
+
showSuccess('my-app', '/tmp/my-app', 'yarn');
|
|
26
|
+
const allOutput = output.join('\n');
|
|
27
|
+
expect(allOutput).toContain('yarn dev');
|
|
28
|
+
});
|
|
29
|
+
});
|
package/package.json
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pantheon-systems/create-p1-starter-kit",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "Scaffold a new P1 starter project",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"create-p1-starter-kit": "./index.js"
|
|
8
8
|
},
|
|
9
|
-
"scripts": {
|
|
10
|
-
"build": "node scripts/build-template.js",
|
|
11
|
-
"prepublishOnly": "npm run build"
|
|
12
|
-
},
|
|
13
9
|
"files": [
|
|
14
10
|
"index.js",
|
|
15
11
|
"lib/",
|
|
@@ -36,9 +32,16 @@
|
|
|
36
32
|
"engines": {
|
|
37
33
|
"node": ">=20.12.0"
|
|
38
34
|
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"vitest": "^4.1.5"
|
|
37
|
+
},
|
|
39
38
|
"dependencies": {
|
|
40
39
|
"@clack/prompts": "^1.5.1",
|
|
41
40
|
"picocolors": "^1.1.1"
|
|
42
41
|
},
|
|
43
|
-
"license": "MIT"
|
|
44
|
-
|
|
42
|
+
"license": "MIT",
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "node scripts/build-template.js",
|
|
45
|
+
"test": "vitest run"
|
|
46
|
+
}
|
|
47
|
+
}
|
package/template/.env.example
CHANGED
|
@@ -2,9 +2,15 @@ PCC_SITE_ID=your-site-id
|
|
|
2
2
|
PCC_TOKEN=your-token
|
|
3
3
|
|
|
4
4
|
# --- P1 backend ---
|
|
5
|
-
NEXT_PUBLIC_CSS_BASE_URL
|
|
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
|
-
|
|
9
|
+
CSS_API_KEY=your-api-key
|
|
10
|
+
|
|
11
|
+
# --- P1 Admin Dashboard (optional) ---
|
|
12
|
+
# Override the default dashboard URL (https://content.pantheon.io)
|
|
13
|
+
# NEXT_PUBLIC_P1_ADMIN_DASHBOARD_URL=https://staging.content.pantheon.io
|
|
8
14
|
|
|
9
15
|
# Branch is auto-detected (defaults to main) unless specified:
|
|
10
16
|
# NEXT_PUBLIC_CSS_BRANCH_ID=branch-456
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# @pantheon-systems/p1-starter
|
|
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
|
+
|
|
12
|
+
## 1.0.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [6650602]
|
|
17
|
+
- Updated dependencies [dc7cfd7]
|
|
18
|
+
- @pantheon-systems/puck-css@0.4.2
|
|
19
|
+
- @pantheon-systems/css-client@0.4.2
|
|
20
|
+
- @pantheon-systems/p1-next-sdk@0.4.2
|
|
@@ -4,6 +4,37 @@ import type { Data } from "@puckeditor/core";
|
|
|
4
4
|
import { RenderClient } from "@pantheon-systems/puck-css";
|
|
5
5
|
import config from "../../puck.config";
|
|
6
6
|
|
|
7
|
-
export function Client({
|
|
8
|
-
|
|
7
|
+
export function Client({
|
|
8
|
+
data,
|
|
9
|
+
pageMetadata,
|
|
10
|
+
}: {
|
|
11
|
+
data: Data;
|
|
12
|
+
pageMetadata?: {
|
|
13
|
+
route: string;
|
|
14
|
+
documentName?: string;
|
|
15
|
+
pageType?: "page" | "template" | "override";
|
|
16
|
+
};
|
|
17
|
+
}) {
|
|
18
|
+
return (
|
|
19
|
+
<>
|
|
20
|
+
<RenderClient config={config} data={data} />
|
|
21
|
+
{pageMetadata && (
|
|
22
|
+
<footer className="mt-16 border-t border-gray-200 py-4 text-center text-sm text-gray-500">
|
|
23
|
+
Rendered with{" "}
|
|
24
|
+
<span className="font-medium">
|
|
25
|
+
{pageMetadata.documentName || pageMetadata.route}
|
|
26
|
+
</span>{" "}
|
|
27
|
+
from{" "}
|
|
28
|
+
<span className="font-medium">
|
|
29
|
+
{pageMetadata.pageType === "page" && "page"}
|
|
30
|
+
{pageMetadata.pageType === "template" && "page template"}
|
|
31
|
+
{pageMetadata.pageType === "override" && "page template override"}
|
|
32
|
+
{!pageMetadata.pageType && "page"}
|
|
33
|
+
</span>{" "}
|
|
34
|
+
at route{" "}
|
|
35
|
+
<span className="font-mono text-xs">{pageMetadata.route}</span>
|
|
36
|
+
</footer>
|
|
37
|
+
)}
|
|
38
|
+
</>
|
|
39
|
+
);
|
|
9
40
|
}
|
|
@@ -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.
|
|
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,
|
|
@@ -125,7 +134,16 @@ export default async function Page({
|
|
|
125
134
|
});
|
|
126
135
|
const resolvedData = await resolveDataTemplates(data, context);
|
|
127
136
|
|
|
128
|
-
return
|
|
137
|
+
return (
|
|
138
|
+
<Client
|
|
139
|
+
data={resolvedData}
|
|
140
|
+
pageMetadata={{
|
|
141
|
+
route: path,
|
|
142
|
+
documentName: data.root.props?.title as string | undefined,
|
|
143
|
+
pageType: "page",
|
|
144
|
+
}}
|
|
145
|
+
/>
|
|
146
|
+
);
|
|
129
147
|
}
|
|
130
148
|
|
|
131
149
|
export const dynamic = "force-dynamic";
|
package/template/app/layout.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { 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,7 +31,12 @@ 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 }) {
|
|
37
|
+
const [userRole, setUserRole] = useState<ContentRole>('editor');
|
|
38
|
+
const lastGoodStateRef = React.useRef<{ puckKey: string; puckProps: any } | null>(null);
|
|
39
|
+
|
|
34
40
|
if (!p1Config) {
|
|
35
41
|
return (
|
|
36
42
|
<div style={{ textAlign: "center", padding: "4rem", fontFamily: "system-ui" }}>
|
|
@@ -50,17 +56,74 @@ export function EditorClientWrapper({ path }: { path: string }) {
|
|
|
50
56
|
<P1QueryProvider>
|
|
51
57
|
<P1NextRouterProvider>
|
|
52
58
|
<P1App
|
|
53
|
-
config={p1Config}
|
|
59
|
+
config={{ ...p1Config, userRole }}
|
|
54
60
|
loginPageProps={{ title: "P1 Starter", subtitle: "Sign in to edit" }}
|
|
55
61
|
>
|
|
56
|
-
<EditorContent path={path} />
|
|
62
|
+
<EditorContent path={path} lastGoodStateRef={lastGoodStateRef} />
|
|
57
63
|
</P1App>
|
|
64
|
+
<RoleSwitcher currentRole={userRole} onRoleChange={setUserRole} />
|
|
58
65
|
</P1NextRouterProvider>
|
|
59
66
|
</P1QueryProvider>
|
|
60
67
|
);
|
|
61
68
|
}
|
|
62
69
|
|
|
63
|
-
function
|
|
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
|
+
|
|
120
|
+
function EditorContent({
|
|
121
|
+
path,
|
|
122
|
+
lastGoodStateRef,
|
|
123
|
+
}: {
|
|
124
|
+
path: string;
|
|
125
|
+
lastGoodStateRef: React.MutableRefObject<{ puckKey: string; puckProps: any } | null>;
|
|
126
|
+
}) {
|
|
64
127
|
const router = useRouter();
|
|
65
128
|
const p1Plugins = useP1Plugins(path, config);
|
|
66
129
|
|
|
@@ -78,6 +141,8 @@ function EditorContent({ path }: { path: string }) {
|
|
|
78
141
|
pluginOptions: {
|
|
79
142
|
onDocumentSelect: handleDocumentSelect,
|
|
80
143
|
selectedDocumentPath: path,
|
|
144
|
+
siteId: process.env.NEXT_PUBLIC_CSS_SITE_ID,
|
|
145
|
+
dashboardUrl: process.env.NEXT_PUBLIC_P1_ADMIN_DASHBOARD_URL,
|
|
81
146
|
},
|
|
82
147
|
overrideOptions: {
|
|
83
148
|
showDefaultPublish: false,
|
|
@@ -90,7 +155,15 @@ function EditorContent({ path }: { path: string }) {
|
|
|
90
155
|
},
|
|
91
156
|
});
|
|
92
157
|
|
|
93
|
-
|
|
158
|
+
// Update last good state when loading completes successfully (ref passed from parent)
|
|
159
|
+
React.useEffect(() => {
|
|
160
|
+
if (!loading && !error) {
|
|
161
|
+
lastGoodStateRef.current = { puckKey, puckProps };
|
|
162
|
+
}
|
|
163
|
+
}, [loading, error, puckKey, puckProps]);
|
|
164
|
+
|
|
165
|
+
// Show full loading screen only on first load (no previous state)
|
|
166
|
+
if (loading && !lastGoodStateRef.current) {
|
|
94
167
|
return (
|
|
95
168
|
<div style={{ textAlign: "center", padding: "4rem", fontFamily: "system-ui" }}>
|
|
96
169
|
Loading editor...
|
|
@@ -98,7 +171,8 @@ function EditorContent({ path }: { path: string }) {
|
|
|
98
171
|
);
|
|
99
172
|
}
|
|
100
173
|
|
|
101
|
-
|
|
174
|
+
// Show error only if we have no previous state to fall back to
|
|
175
|
+
if (error && !lastGoodStateRef.current) {
|
|
102
176
|
return (
|
|
103
177
|
<div style={{ textAlign: "center", padding: "4rem", fontFamily: "system-ui" }}>
|
|
104
178
|
<h3>Error loading document</h3>
|
|
@@ -107,10 +181,55 @@ function EditorContent({ path }: { path: string }) {
|
|
|
107
181
|
);
|
|
108
182
|
}
|
|
109
183
|
|
|
184
|
+
// Use current state if loaded, otherwise keep showing last good state
|
|
185
|
+
const displayState = (!loading && !error)
|
|
186
|
+
? { puckKey, puckProps }
|
|
187
|
+
: lastGoodStateRef.current ?? { puckKey, puckProps };
|
|
188
|
+
|
|
110
189
|
return (
|
|
111
|
-
<div className="puck-editor-theme">
|
|
190
|
+
<div className="puck-editor-theme" style={{ position: "relative" }}>
|
|
191
|
+
{/* Loading overlay - shown during branch switch */}
|
|
192
|
+
{loading && lastGoodStateRef.current && (
|
|
193
|
+
<div
|
|
194
|
+
style={{
|
|
195
|
+
position: "fixed",
|
|
196
|
+
top: "50%",
|
|
197
|
+
left: "50%",
|
|
198
|
+
transform: "translate(-50%, -50%)",
|
|
199
|
+
zIndex: 9999,
|
|
200
|
+
background: "rgba(255, 255, 255, 0.95)",
|
|
201
|
+
padding: "1rem 2rem",
|
|
202
|
+
borderRadius: "8px",
|
|
203
|
+
boxShadow: "0 4px 12px rgba(0, 0, 0, 0.15)",
|
|
204
|
+
fontFamily: "system-ui",
|
|
205
|
+
fontSize: "14px",
|
|
206
|
+
color: "#333",
|
|
207
|
+
fontWeight: 500,
|
|
208
|
+
display: "flex",
|
|
209
|
+
alignItems: "center",
|
|
210
|
+
gap: "0.75rem",
|
|
211
|
+
}}
|
|
212
|
+
>
|
|
213
|
+
<div
|
|
214
|
+
style={{
|
|
215
|
+
width: "16px",
|
|
216
|
+
height: "16px",
|
|
217
|
+
border: "2px solid #e0e0e0",
|
|
218
|
+
borderTopColor: "#2563eb",
|
|
219
|
+
borderRadius: "50%",
|
|
220
|
+
animation: "spin 0.6s linear infinite",
|
|
221
|
+
}}
|
|
222
|
+
/>
|
|
223
|
+
Switching workstream...
|
|
224
|
+
<style>{`
|
|
225
|
+
@keyframes spin {
|
|
226
|
+
to { transform: rotate(360deg); }
|
|
227
|
+
}
|
|
228
|
+
`}</style>
|
|
229
|
+
</div>
|
|
230
|
+
)}
|
|
112
231
|
{/* eslint-disable-next-line @typescript-eslint/no-explicit-any */}
|
|
113
|
-
<Puck key={puckKey} {...puckProps as any} _experimentalFullScreenCanvas={true} />
|
|
232
|
+
<Puck key={displayState.puckKey} {...displayState.puckProps as any} _experimentalFullScreenCanvas={true} />
|
|
114
233
|
</div>
|
|
115
234
|
);
|
|
116
235
|
}
|
|
@@ -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.
|
|
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.
|
|
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.
|
|
4
|
+
p1ApiKey: process.env.CSS_API_KEY,
|
|
5
5
|
p1BaseUrl: process.env.NEXT_PUBLIC_CSS_BASE_URL,
|
|
6
6
|
prompt: 'login',
|
|
7
7
|
});
|
package/template/app/page.tsx
CHANGED
|
@@ -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.
|
|
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
|
});
|
|
@@ -64,7 +64,16 @@ export default async function HomePage() {
|
|
|
64
64
|
referencedDatasourceIds,
|
|
65
65
|
});
|
|
66
66
|
const resolvedData = await resolveDataTemplates(data, context);
|
|
67
|
-
return
|
|
67
|
+
return (
|
|
68
|
+
<Client
|
|
69
|
+
data={resolvedData}
|
|
70
|
+
pageMetadata={{
|
|
71
|
+
route: "/",
|
|
72
|
+
documentName: data.root.props?.title as string | undefined,
|
|
73
|
+
pageType: "page",
|
|
74
|
+
}}
|
|
75
|
+
/>
|
|
76
|
+
);
|
|
68
77
|
}
|
|
69
78
|
|
|
70
79
|
const routes = await listRoutes();
|
|
@@ -9,10 +9,9 @@ export const puckRoot = {
|
|
|
9
9
|
title: "My Puck Editor",
|
|
10
10
|
},
|
|
11
11
|
render: (props: { children?: ReactNode; title?: string }) => {
|
|
12
|
-
const { children
|
|
12
|
+
const { children } = props;
|
|
13
13
|
return (
|
|
14
14
|
<div className="font-sans antialiased">
|
|
15
|
-
<h1>{title}</h1>
|
|
16
15
|
{children}
|
|
17
16
|
</div>
|
|
18
17
|
);
|
package/template/package.json
CHANGED
|
@@ -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.
|
|
15
|
-
"@pantheon-systems/p1-next-sdk": "^0.4.
|
|
16
|
-
"@pantheon-systems/puck-css": "^0.4.
|
|
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
|