No announcement is active. The bar renders nothing above this text.
),
],
}
/**
* Client-only mode (no SSR), the react-embedding-example structure: the
* embedder mounts an EndpointsRuntime provider (announcementsUrl is a fixed
* suffix under its one content base) and drops in a PROP-LESS bar. No
* platform knob anywhere on the client: the proxied server resolves its own
* platform via currentPlatform(). The decorator mocks the fetch.
*/
const embedEndpoints: EndpointsRuntime = {
announcementsUrl: '/content/api/announcements/active',
accessCode: { validateUrl: '/content/api/validate-access-code', consumeUrl: '/content/api/consume-access-code' },
contactUrl: '/content/api/contact',
}
export const ClientOnlyEmbed: Story = {
args: {},
decorators: [
(Story) => {
const originalFetch = window.fetch
window.fetch = (async (input: RequestInfo | URL, init?: RequestInit) => {
const requestUrl = typeof input === 'string' ? input : input.toString()
if (requestUrl.includes('/content/api/announcements/active')) {
return new Response(
JSON.stringify({
announcement: {
...baseAnnouncement,
id: 'story-embed',
title: 'Client-only embed',
description: 'Fetched on mount through the EndpointsRuntime provider, no SSR.',
},
}),
{ status: 200, headers: { 'Content-Type': 'application/json' } },
)
}
return originalFetch(input, init)
}) as typeof window.fetch
return (