@pantheon-systems/p1-next-sdk 0.25.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,6 +5,7 @@ import { createAIChatPlugin } from "@pantheon-systems/p1-ai-chat";
5
5
  import { useP1ExperimentalFeatures } from "../experimental-features";
6
6
  import { useBusinessAccountId } from "../editor-client/use-business-account-id";
7
7
  import { p1UserFlagKey } from "../launchdarkly/user-key";
8
+ import { planAndUsageUrl } from "./plan-and-usage-url";
8
9
  export function useChatbotEnabled() {
9
10
  const { user } = useP1Auth();
10
11
  const businessAccountId = useBusinessAccountId();
@@ -18,6 +19,7 @@ export function useChatbotEnabled() {
18
19
  export function createGatedChatPlugin(options) {
19
20
  const inner = createAIChatPlugin({
20
21
  agentUrl: process.env.NEXT_PUBLIC_AGENT_URL,
22
+ usageUrl: planAndUsageUrl(process.env.NEXT_PUBLIC_P1_ADMIN_DASHBOARD_URL),
21
23
  draftRequests: options.draftRequests,
22
24
  onPageCreated: options.onPageCreated,
23
25
  });
@@ -0,0 +1,2 @@
1
+ /** The dashboard's Plan and usage page, where "See usage" in the used-up tokens notice goes. */
2
+ export declare function planAndUsageUrl(dashboardUrl: string | undefined): string;
@@ -0,0 +1,4 @@
1
+ export function planAndUsageUrl(dashboardUrl) {
2
+ const base = (dashboardUrl || "https://content.pantheon.io").replace(/\/$/, "");
3
+ return `${base}/dashboard/p1/plan-and-usage`;
4
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pantheon-systems/p1-next-sdk",
3
- "version": "0.25.0",
3
+ "version": "0.26.0",
4
4
  "license": "UNLICENSED",
5
5
  "description": "Next.js SDK for P1 editor integration",
6
6
  "publishConfig": {
@@ -47,9 +47,9 @@
47
47
  "!dist/**/*.map"
48
48
  ],
49
49
  "dependencies": {
50
- "@pantheon-systems/css-client": "0.25.0",
51
- "@pantheon-systems/p1-ai-chat": "0.10.0",
52
- "@pantheon-systems/puck-css": "0.25.0",
50
+ "@pantheon-systems/css-client": "0.26.0",
51
+ "@pantheon-systems/p1-ai-chat": "0.11.0",
52
+ "@pantheon-systems/puck-css": "0.26.0",
53
53
  "cookie": "^1.1.1",
54
54
  "launchdarkly-js-client-sdk": "^3.9.3",
55
55
  "server-only": "^0.0.1"