Skip to content

Boxes widgets

Boxes widgets use the separate @wodira/browser/ui/boxes entry point. Event checkout’s defineWodiraElements() does not register them.

import { defineWodiraBoxElements } from '@wodira/browser/ui/boxes';
defineWodiraBoxElements();
<wodira-box-widget
publishable-key="wpk_live_..."
installation-id="installation_..."
locale="en"
></wodira-box-widget>

Components: <wodira-box-calendar>, <wodira-box-trial>, <wodira-box-plans>, and the composite <wodira-box-widget>. Create an installation in box management and authorize your website origin first. Its ID must match the box, organization and key; it is not a box slug.

import { createWodiraBoxWidgetClient } from '@wodira/browser/ui/boxes';
const box = createWodiraBoxWidgetClient({
publishableKey: 'wpk_live_...',
installationId: 'installation_...',
});
const context = await box.getContext();
const calendar = await box.getCalendar(new Date(), 1);
const plans = await box.getPlans();
const trials = await box.getTrialClasses();

Calendar availability is AVAILABLE, LAST_SPOTS, WAITLIST, or FULL; use the returned timezone and availability before offering an action. Selecting a class does not reserve capacity.

Prefix: /external/v1/browser/box-widgets/:installationId, using x-publishable-key and an allowed Origin.

Method Suffix Client
GET /context getContext()
GET /calendar getCalendar(from, weeks)
GET /plans getPlans()
GET /trial-classes getTrialClasses()
POST /flows createFlow(input)
POST /telemetry recordTelemetry(events)
GET /results/:resultToken verifyResult(resultToken)

createFlow accepts intent (RESERVE_CLASS, START_TRIAL, BUY_DROP_IN, BUY_PLAN), targetId, idempotencyKey, and applicable identification/privacy fields. It returns continuationUrl and expiresAt. Identification, confirmation and payment continue in the hosted Boxes flow. This is not an event Stripe Checkout Session.

verifyResult returns { verified: true, completedAt } for a valid token. Do not trust browser return parameters alone. Keep result and continuation tokens private.

Reuse applyWodiraTheme and theme variables. Composite slots: header, footer, calendar-intro, trial-intro, plans-intro; individual widgets: header, intro, footer. Installation locale supports auto, es, en, pt, separately from event checkout’s es/en dictionary.