business. session. details. block
A block of your UI on the staff-facing page for one session, where a business manages who is coming and how the session runs.
- Subject
- The Session the page is for.
- Viewer
- Always a member of the business’s staff — the host refuses an extension API request for this target from anyone else.
- API type
BusinessSessionDetailsBlockApi<Query>
Where it renders
At the foot of the staff session page, after the built-in sections.
At the foot of the activity overview for a single-date activity, which stands in for its one session.
Sessions’ default apps render first, then installed apps in install order — each extension in its own card, headed by the app’s icon, the extension’s name and “From <app>”.
The card’s “…” menu opens the app’s page in the business’s settings (/settings/apps/<handle>); for admins it can also hide the extension for the business, or uninstall the app. A hidden extension stops rendering on the next page load.
The api object
What this target’s module receives as its second argument. The target members come first; every target also has the standard members below them.
api.session{readonly id: string}id is a Session global id — the same session the session root of the extension API resolves to.api.mutate(operation, options?)<Data>(operation: string, options?: {variables?}) => Promise<{data: Data | null; errors?}>api.query re-resolves afterwards on its own.api.targetUIExtensionTargetapi.version'2026-09'api.app{id: string; handle: string; name: string}api.extension{id: string; handle: string; name: string}api.localization.localeReadonlySignal<string>en, fr-CA). A signal: it changes when the viewer switches language without a reload, so read .value or .subscribe to it.api.localization.translate(key, replacements?)(key: string, replacements?: Record<string, string | number>) => stringtranslations/<locale>.json files pushed with the extension, in the viewer’s locale. key is a dot path; {{name}} placeholders are filled from replacements; a plural object is chosen by replacements.count. Falls back to the language, then en, then the key itself.api.localization.formatNumber / formatDate / formatCurrency(value, options?) => stringIntl formatting in the viewer’s locale: formatNumber(value, options?), formatDate(value, options?) (a Date, an ISO string or epoch milliseconds; pass timeZone for the business’s wall-clock time), and formatCurrency(amount, currency) with amount in major units.api.queryReadonlySignal<Query>api.mutate, and whenever the host page refreshes its own data). A signal: read .value while rendering to re-render with it. {} when the target declares no query.api.ui.toast(message, options?)(message: string, options?: {tone?: 'critical'}) => voidExtension GraphQL API
What this target’s live query and mutations can use.
extensionbusinesssessionviewersetMetadatadeleteMetadataGuidance
Lead with the state the staff member came to see, then the controls to change it.
Write under your app’s metadata namespace, app.<your handle>.…; a buyer-facing target of the same extension can read it back.
Report the outcome of a mutation with api.ui.toast — the block is not a page and has no room for a success banner.
import {
extension,
useApi,
useQuery,
useSignal,
useTranslate,
Button,
Stack,
TextField,
} from '@sessions/apps/preact';
import saveNote from './SaveNoteMutation.graphql';
import type {SessionNoteQueryData} from './SessionNoteQuery.graphql';
export default extension('business.session.details.block', () => <NoteEditor />);
function NoteEditor() {
const api = useApi<'business.session.details.block'>();
const {session} = useQuery<SessionNoteQueryData>();
const translate = useTranslate();
// Signals: reading `.value` while rendering re-renders on change.
const draft = useSignal(session?.note?.value ?? '');
const saving = useSignal(false);
async function save() {
saving.value = true;
// Typed by the .graphql.d.ts: variables are checked, data is typed.
const result = await api.mutate(saveNote, {
variables: {owner: {id: api.session.id}, value: draft.value},
});
saving.value = false;
const failed = result.errors != null || !!result.data?.setMetadata.errors.length;
api.ui.toast(translate(failed ? 'saveFailed' : 'saved'), {
tone: failed ? 'critical' : undefined,
});
}
return (
<Stack gap="small">
<TextField
label={translate('label', {activity: session?.activity.name ?? ''})}
value={draft.value}
multiline
onInput={(value) => (draft.value = value)}
/>
<Button emphasis="strong" loading={saving.value} onClick={save}>
{translate('save')}
</Button>
</Stack>
);
}