# Holidoit Browser JS Library

Booking embed and widgets for partner websites. See [widget installation](WIDGETS_INSTALLATION.md) and [embed integration](EMBED_INTEGRATION.md).

## Local development

Configure `.env`, then run `yarn install` and `yarn dev`.
Playground: http://localhost:3001. `yarn build` creates a local production build.

## Deploy and rollback

**Actions → Deploy embed and widgets → Run workflow**:

- `operation=deploy`: build and publish a new versioned release.
- `operation=rollback`: restore an existing release without rebuilding. Set `rollback_run_id` to the number in the previous successful deployment's `/actions/runs/ID` URL, using the same environment. Its artifact must still be available (30 days).

Pushes to `develop` automatically deploy to development. Production deploys and rollbacks are manual and restricted to the default branch. Both operations share the same deployment lock.

Partner snippets stay unchanged. Release files are kept under `holidoit-js-releases/<id>/`; do not delete old releases. Rollback updates public URLs and invalidates their CDN cache without overwriting release files.

### GitHub configuration

Use repository **Settings → Secrets and variables → Actions**, with `DEV_` and `PROD_` prefixes; no GitHub Environments are needed.

| Location | Names (add the environment prefix) |
| --- | --- |
| Variables | `AWS_S3_BUCKET`, `CDN_DOMAIN`, `AWS_CLOUDFRONT_DISTRIBUTION_ID` |
| Variables (optional) | `AWS_REGION` (default: `eu-south-1`) |
| Secrets | `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `BASE_API_URL`, `NEXT_PUBLIC_STRIPE_CLIENT_ID` |
| Secrets (optional) | `NEXT_PUBLIC_PAYPAL_CLIENT_ID` |

`CDN_DOMAIN` is a hostname, without `https://`. AWS credentials need S3 upload and CloudFront invalidation permissions; CloudFront must be allowed to read release files. Public URLs must allow revalidation (CloudFront minimum TTL: 0).
