diff --git a/src/pages/Home/EmbedCodeDialog.tsx b/src/pages/Home/EmbedCodeDialog.tsx index 9ca8f6102..ef7365a2d 100644 --- a/src/pages/Home/EmbedCodeDialog.tsx +++ b/src/pages/Home/EmbedCodeDialog.tsx @@ -29,12 +29,29 @@ export const EmbedCodeDialog = ({ const needsRootUrlAttribute = window.location.origin !== homepageUrl.origin + const chatRoomAttributes: { + room: string + ['root-url']?: string + width: string + height: string + } = { + room: roomName, + width: '800', + height: '800', + } + + if (needsRootUrlAttribute) { + chatRoomAttributes['root-url'] = `${window.location.origin}/` + } + + const attributesString = Object.entries(chatRoomAttributes) + .map(([key, value]) => `${key}=${value}`) + .join(' ') + // NOTE: The script src is inaccurate in the local development environment. const sdkEmbedCode = ` -` +` return (