Skip to content

Commit a38b4e4

Browse files
committed
Hardcode integration ID
1 parent d3578d8 commit a38b4e4

File tree

3 files changed

+8
-21
lines changed

3 files changed

+8
-21
lines changed

packages/playground/website/src/components/site-error-modal/site-error-modal.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export function SiteErrorModal({
3939
isSubmittingReport,
4040
handleSubmitReport,
4141
} = useErrorReporting(site);
42-
const { isConfigured: isKapaAIConfigured, openWithQuery } = useKapaAI();
42+
const { openWithQuery } = useKapaAI();
4343

4444
const helpers: PresentationHelpers = {
4545
deleteSite: () => {
@@ -147,7 +147,7 @@ export function SiteErrorModal({
147147
</div>
148148
{view.actions.length || !view.isDeveloperError || detailText ? (
149149
<div className={css.errorModalFooter}>
150-
{isKapaAIConfigured && !isReporting && detailText && (
150+
{!isReporting && detailText && (
151151
<Button
152152
variant="secondary"
153153
onClick={() => openWithQuery(detailText)}

packages/playground/website/src/components/site-error-modal/use-kapa-ai.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useEffect, useCallback, useState, useRef } from 'react';
2-
// @ts-ignore - Virtual module injected by Vite
3-
import { kapaWebsiteId } from 'virtual:kapa-ai-config';
2+
3+
const KAPA_WEBSITE_ID = 'a8b85529-1773-4710-b35f-c9ebc70ffcb6';
44

55
declare global {
66
interface Window {
@@ -21,14 +21,9 @@ const KAPA_SCRIPT_ID = 'kapa-widget-script';
2121

2222
export function useKapaAI() {
2323
const [isLoaded, setIsLoaded] = useState(false);
24-
const isConfigured = Boolean(kapaWebsiteId);
2524
const hasSubmittedQuery = useRef(false);
2625

2726
useEffect(() => {
28-
if (!isConfigured) {
29-
return;
30-
}
31-
3227
// Check if script already exists
3328
if (document.getElementById(KAPA_SCRIPT_ID)) {
3429
if (window.Kapa) {
@@ -41,7 +36,7 @@ export function useKapaAI() {
4136
script.id = KAPA_SCRIPT_ID;
4237
script.src = 'https://widget.kapa.ai/kapa-widget.bundle.js';
4338
script.async = true;
44-
script.setAttribute('data-website-id', kapaWebsiteId);
39+
script.setAttribute('data-website-id', KAPA_WEBSITE_ID);
4540
script.setAttribute(
4641
'data-project-name',
4742
'WordPress Playground AI Assistant'
@@ -67,7 +62,7 @@ export function useKapaAI() {
6762
};
6863

6964
document.body.appendChild(script);
70-
}, [isConfigured]);
65+
}, []);
7166

7267
const openWithQuery = useCallback((query: string) => {
7368
if (window.Kapa) {
@@ -85,7 +80,6 @@ export function useKapaAI() {
8580
}, []);
8681

8782
return {
88-
isConfigured,
8983
isLoaded,
9084
openWithQuery,
9185
};

packages/playground/website/vite.config.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ export default defineConfig(({ command, mode }) => {
4343
'CORS_PROXY_URL' in process.env
4444
? process.env.CORS_PROXY_URL
4545
: mode === 'production'
46-
? 'https://wordpress-playground-cors-proxy.net/?'
47-
: '/cors-proxy/?';
46+
? 'https://wordpress-playground-cors-proxy.net/?'
47+
: '/cors-proxy/?';
4848

4949
return {
5050
// Split traffic from this server on dev so that the iframe content and
@@ -115,13 +115,6 @@ export default defineConfig(({ command, mode }) => {
115115
content: `
116116
export const corsProxyUrl = ${JSON.stringify(corsProxyUrl || undefined)};`,
117117
}),
118-
virtualModule({
119-
name: 'kapa-ai-config',
120-
content: `
121-
export const kapaWebsiteId = ${JSON.stringify(
122-
process.env.KAPA_WEBSITE_ID || ''
123-
)};`,
124-
}),
125118
// GitHub OAuth flow
126119
{
127120
name: 'configure-server',

0 commit comments

Comments
 (0)