Day use on your hotel's website
The @valinor/booking package puts the day use purchase inside the hotel or inn website. The visitor picks the date, tickets and extras, fills in their details and pays without leaving the page. The sale lands in Valinor like any other booking engine sale: the deal is created in the CRM and the invoice in finance.
This guide is for whoever runs the website. The component is built with React and works on any site that runs React: Astro, Next.js, Vite, Remix. Its text is in Brazilian Portuguese.
Below is the package component, the same one that goes on your site. Only the API is simulated.
Before you start
Section titled “Before you start”- The Hospitalidade (hospitality) module, with the Motor de reservas (booking engine) turned on in Hospitalidade → Configurações.
- At least one day use on sale, set up in Hospitalidade → Day use (in the settings part of the menu).
- The engine’s public id. It is the end of the booking page link shown on the engine card: in
valinorcrm.com/reservar/pousada-serra-azul, the public id ispousada-serra-azul. - Optional: the day use id, to show a single one. It is the number at the end of the day use page address in Valinor.
1. Allow the website domain
Section titled “1. Allow the website domain”- In Valinor, open Hospitalidade → Configurações.
- On the Motor de reservas card, fill in Domínios do site (website domains) with the domain where the component will live, one per line (for example,
pousada.com.br). Subdomains come along:pousada.com.bralso allowsreservas.pousada.com.br. - Click Salvar motor (save engine).
The calendar and prices answer any website. The purchase does not: it is accepted only from the listed domains. From any other address, the API answers 403 with the forbidden_origin code, and the component tells the visitor the site is not yet allowed to sell.
2. Install the package
Section titled “2. Install the package”npm install @valinor/bookingWith pnpm, Yarn or Bun: pnpm add @valinor/booking, yarn add @valinor/booking or bun add @valinor/booking. React (18 or newer) comes from your site.
3. Put the component on the page
Section titled “3. Put the component on the page”Astro runs React components as islands. If the site doesn’t have the React integration yet, add it:
npx astro add reactThen create the day use page:
---import { DayUseCheckout } from '@valinor/booking';import '@valinor/booking/styles.css';---
<html lang="pt-BR"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>Day use</title> </head> <body> <main> <h1>Day use</h1> <DayUseCheckout client:visible publicId="pousada-serra-azul" /> </main> </body></html>client:visible loads the component when it scrolls into view. On a real site the page usually uses the site’s own layout; what matters is the two imports and the <DayUseCheckout> tag with a client: directive.
React (Vite, Next.js and others)
Section titled “React (Vite, Next.js and others)”import { DayUseCheckout } from '@valinor/booking';import '@valinor/booking/styles.css';
export function DayUse() { return <DayUseCheckout publicId="pousada-serra-azul" productId="1234567890" />;}In Next.js (App Router), the component is already marked "use client", so you can use it straight from a server page.
| Prop | Use |
|---|---|
publicId |
Public id of the booking engine (the same as in the /reservar/<public id> link). Required. |
productId |
A single day use. Without it, the visitor picks among the engine’s day uses. |
theme |
Theme variable values, for example { colorPrimary: '#0a4d8c' }. |
className |
Extra class on the root element (.valinor-booking). |
apiBaseUrl |
API origin. Only changes to point at a local environment. |
4. Adjust the theme
Section titled “4. Adjust the theme”The look comes from CSS variables, and the defaults are Valinor’s: Forest green, warm-toned surfaces, headings in Cormorant Garamond and text in Outfit. To change them, override the variables in your site’s CSS. The component rules have zero specificity, so any rule of yours wins:
.valinor-booking { --valinor-color-primary: #0a4d8c; --valinor-radius: 4px;}Or pass the values through the theme prop:
<DayUseCheckout client:visible publicId="pousada-serra-azul" theme={{ colorPrimary: '#0a4d8c', radius: '4px' }} />| Variable | Use |
|---|---|
--valinor-color-primary |
Buttons and selection |
--valinor-color-primary-text |
Text on the primary color |
--valinor-color-text |
Text |
--valinor-color-muted |
Secondary text |
--valinor-color-background |
Background |
--valinor-color-surface |
Card and calendar background |
--valinor-color-border |
Borders |
--valinor-color-error |
Errors |
--valinor-color-success |
Confirmation |
--valinor-color-unavailable |
Background of a sold-out date |
--valinor-font-family |
Text font |
--valinor-font-display |
Heading font |
--valinor-font-size |
Base text size |
--valinor-radius |
Corner radius |
--valinor-spacing |
Base spacing |
--valinor-shadow |
Card shadow |
The package doesn’t download fonts. To use Valinor’s, load them on your site (without them, Georgia and Helvetica apply):
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600&family=Outfit:wght@400;500;600&display=swap" />To use your site’s own font, inherit both: .valinor-booking { --valinor-font-family: inherit; --valinor-font-display: inherit; }.
The layout follows the component’s width, not the screen’s: in a narrow column it takes the phone layout.
Payment and confirmation
Section titled “Payment and confirmation”Payment opens Valinor’s payment page in an overlay, without leaving the site, with Pix, boleto or card. Once the invoice is paid, the component shows the confirmation. If the spot hold runs out first, it says so and lets the visitor pick the date again.
The payment page notifies the site through postMessage. To record the conversion in Google Ads, the Meta pixel or another tool, listen to the same notice:
import { listenForPayment } from '@valinor/booking';
listenForPayment({ payOrigin: 'https://valinorcrm.com', onPayment: (status) => { if (status === 'paid') window.dataLayer?.push({ event: 'day_use_paid' }); },});listenForPayment checks the message origin: only a notice coming from Valinor counts.
The overlay is fixed over the whole page. If your site header shows on top of it, some container above the component creates its own stacking context (transform, filter, isolation or z-index with position). Remove that property from the container or place the component outside it.
Where the sale came from
Section titled “Where the sale came from”The UTMs in the page address (utm_source, utm_medium, utm_campaign, utm_term and utm_content) go along with the purchase. The deal is created in the CRM with the campaign as its origin.
Building with the pieces
Section titled “Building with the pieces”DayUseCheckout is the ready-made assembly. To choose the order and the layout, use the DayUse pieces inside a DayUse.Root. They share the same purchase state and each one shows up only at its own step, so they can stay on the page the whole time:
import { DayUse } from '@valinor/booking';import '@valinor/booking/styles.css';
export function DayUsePage() { return ( <DayUse.Root publicId="pousada-serra-azul" theme={{ colorPrimary: '#0a4d8c' }}> <DayUse.ProductPicker /> <DayUse.Confirmation /> <div className="my-grid"> <aside> <DayUse.Tickets /> <DayUse.BuyerForm /> </aside> <DayUse.Calendar /> </div> <DayUse.Payment /> </DayUse.Root> );}In Astro, put the assembly in a .tsx component like this one and use it on the page with a client: directive, just like DayUseCheckout.
| Piece | What it shows |
|---|---|
DayUse.Root |
Holds the state. Takes the same props as DayUseCheckout and shows the engine’s loading and errors in place of the pieces. |
DayUse.ProductPicker |
The buttons to choose the day use. Hidden when there is only one or when Root gets productId. |
DayUse.Calendar |
The day use name and description and the calendar with the adult price per date. |
DayUse.Tickets |
Tickets, extras and total for the chosen date. Before a date is picked, a hint to choose one in the calendar. |
DayUse.BuyerForm |
Buyer details, policy acceptance and Turnstile. Shows up after the tickets. |
DayUse.Payment |
The payment page overlay. |
DayUse.Confirmation |
The outcome: purchase confirmed or payment deadline passed. |
The pieces are for changing the layout, the order and what goes around them, not for skipping a step. Calendar, tickets, buyer details and payment are required for the sale to go through: in development, Root warns in the console when one of these pieces is missing. A piece outside Root throws an error saying where it needs to be.
Your own screen with useDayUse()
Section titled “Your own screen with useDayUse()”To design the whole screen, call useDayUse() inside Root. It returns the purchase state and actions, with no UI at all:
import { DayUse, useDayUse } from '@valinor/booking';
function MyScreen() { const dayUse = useDayUse(); // dayUse.product, dayUse.calendar, dayUse.day, dayUse.total, dayUse.step, dayUse.payUrl, dayUse.error… return ( <button disabled={!dayUse.canContinue} onClick={dayUse.continueToBuyer}> Continue </button> );}
export function DayUsePage() { return ( <DayUse.Root publicId="pousada-serra-azul"> <MyScreen /> </DayUse.Root> );}| Action | Use |
|---|---|
selectProduct(id) |
Switches the day use; date and quantities start over. |
showMonth('2026-12') |
Shows another month in calendar. |
selectDate('2026-12-12') |
Picks the date; its prices and spots arrive in day. |
setTicketQuantity(id, quantity) and setExtraQuantity(id, quantity) |
Change the order; total and canContinue follow. |
continueToBuyer() and backToOrder() |
Move from step: 'order' to 'buyer' and back. |
checkout(buyer, turnstileToken) |
Holds the spots and returns { ok: true, payUrl } or { ok: false, message }. Refuses without sending when the date, a ticket or valid buyer details are missing. |
openPayment(), closePayment() and reportPayment('paid' | 'expired') |
Drive the payment step. |
restart() |
Starts another purchase. |
With your own screen, payment and Turnstile are also up to the site: open payUrl (or use <DayUse.Payment />, which still works alongside useDayUse()), listen for the notice with listenForPayment and pass the result to reportPayment. When the engine asks for Turnstile (dayUse.engine.turnstileSiteKey), the API only accepts the purchase with the challenge token. Whoever uses useDayUse() builds their own screen, so Root does not warn about missing pieces.
Using the API only
Section titled “Using the API only”To build your own screen, the package also ships a typed client for the public API:
import { createBookingClient } from '@valinor/booking';
const client = createBookingClient();const { data } = await client.GET('/api/public/booking-engines/{publicId}/day-use/{productId}/calendar', { params: { path: { publicId: 'pousada-serra-azul', productId: '1234567890' }, query: { from: '2026-12-01', to: '2026-12-31' }, },});Endpoints, parameters and fields are in the public API reference. If you only use the client and want the theme variables without the component rules, import @valinor/booking/theme.css.
License
Section titled “License”The package is distributed under the PolyForm Shield 1.0.0. You may use, modify and embed it in your business website, commercial sites included. What the license does not allow is using it to offer a product that competes with Valinor.