chore: Clean booking-flow * Clean booking-flow * Fix type issue Approved-by: Joakim Jäderberg Approved-by: Linus Flood
25 lines
1.6 KiB
Markdown
25 lines
1.6 KiB
Markdown
# @scandic-hotels/booking-flow
|
|
|
|
Shared package containing the hotel booking flow functionality used by `scandic-web` and partner sites.
|
|
|
|
## Configuration
|
|
|
|
To use the booking flow, two main contexts must be set up: `BookingFlowConfig` and `BookingFlowContext`. Both receive injected values from the consuming app.
|
|
|
|
**`BookingFlowConfig`** is static configuration that controls features and behavior (e.g. booking codes enabled), while **`BookingFlowContext`** is dynamic state provided by the consuming site (e.g. user authentication status).
|
|
|
|
The **config** sets up both a server side and client side context provider. You can use `getBookingFlowConfig` server side and `useBookingFlowConfig` client side to access the config values.
|
|
|
|
The **context** is only provided client side, and can be accessed using the `useBookingFlowContext` hook.
|
|
|
|
There's also some setup required for **tRPC** to work with the booking flow. See the [tRPC context](../trpc/lib/context.ts) and how it's used in the consuming apps for details.
|
|
|
|
## Translations
|
|
|
|
Translations for the booking flow components work similarly to other parts of the app, using `react-intl`. See [translations.md](../../docs/translations.md) for more information on how translations are set up in the apps.
|
|
|
|
We currently do not dependency inject any translation messages from the consuming apps, so for now all booking-flow translation messages for the different sites are included in all app bundles. This should be improved in the future.
|
|
|
|
## Other
|
|
|
|
Components that are currently exported but are intended for external use should probably move to design-system or similar in the future. |