Skip to content
ContractSpec
Start here

Package manual · domains

·Company, work and service operations

opa-booking-react

Hosted and headless React integration for OPA booking links.

domainslibraryv4.0.5stableservernode
@lssm-tech/opa-booking-react
bun add @lssm-tech/opa-booking-react
Package source ↗Manifest ↗

Manifest declarations describe the current workspace; they do not verify registry publication or runtime execution.

Package guide

React 18/19 integration for CompanyOS OPA booking. The hosted widget validates versioned messages against the configured CompanyOS origin; the headless hook loads only the public-safe availability projection.

tsx
import { OpaBookingWidget } from "@lssm-tech/opa-booking-react";

<OpaBookingWidget token="PUBLIC_BOOKING_TOKEN" locale="fr" />;

For a custom booking experience, use the headless hook. Its requests carry the embedding app's exact origin and expose no private calendar identifiers.

tsx
import { useOpaBooking } from "@lssm-tech/opa-booking-react";

function AvailabilityButton() {
  const booking = useOpaBooking({
    token: "PUBLIC_BOOKING_TOKEN",
    onEvent: (event) => console.info(event.type),
  });

  return (
    <button
      onClick={() =>
        booking.loadAvailability(
          new Date("2026-08-10T00:00:00Z"),
          new Date("2026-08-17T00:00:00Z"),
          "Europe/Paris",
        )
      }
    >
      {booking.state.status === "loading" ? "Loading…" : "Load availability"}
    </button>
  );
}

The hook's availability and intent responses stay unknown for compatibility; @lssm-tech/opa-booking-react/availability parses them into typed public projections: parseOpaBookingAvailability (availability quote, host display name, event type, host timezone and valid slots) and parseOpaPublicBooking (redacted booking ref and state), plus isOpaBookingScheduled and isOpaBookingUnsuccessful for the v2 booking states. Both parsers return null when required fields are missing.

Embedding remains disabled until the booking link contains the parent origin in its allowlist. Never place private calendar identifiers or credentials in widget props.

Production canaries

Two no-index canary hosts on the canonical CompanyOS origin exercise the exact customer integrations with a public booking token:

  • /embed/production-canary.html?token=PUBLIC_BOOKING_TOKEN runs the versioned JavaScript loader.
  • /embed/react/PUBLIC_BOOKING_TOKEN renders OpaBookingWidget from this package.

The booking link must explicitly allow https://www.companyos.run. A canary is accepted only after live availability renders; a successful page load alone is not evidence of origin authorization or provider readiness.

The widget's accessible frame title follows locale (en, fr, or es), matching the hosted booking surface; English remains the default.

Relationships

THIS PACKAGEopa-booking-react6 import paths

Arrows point from a package to its direct dependency. Counts are derived from captured workspace manifests.

0 declarations

No Runtime dependencies are declared here.

Declared capabilities

Opa Booking React

Hosted and headless React integration for OPA booking links.

Scripts

  • buildcontractspec-bun-build build
  • build:bundlecontractspec-bun-build transpile
  • build:typescontractspec-bun-build types
  • prebuildcontractspec-bun-build prebuild
  • typechecktsgo --noEmit -p tsconfig.json
  • testbun test
  • lint:checknode ../../../../scripts/biome.cjs check .