> For the complete documentation index, see [llms.txt](https://thecontentforge.gitbook.io/thecontentforge-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://thecontentforge.gitbook.io/thecontentforge-docs/feature-guides/resorts.md).

# Resorts & Hospitality

One operator can plan overnight stays, local visits/event sales, and groups/celebrations together. The vertical reuses Content Forge, Brand Voice, Asset Library, Link Manager, Calendar, social publishing and Experiments.

## Present a signed-in workspace

The former public Auburndale showcase has been withdrawn. Its URL returns 404 and it is not listed in the public demo chooser.

Signed-in workspaces never install example data, so a customer's library only holds its own sources and campaigns. For a live team rehearsal, use a dedicated test workspace: save a profile, add and approve a source, then create a campaign with **New campaign**.

A member can open a specific production team with `/resorts/open/<workspace UUID>`. Add `?view=plan` (optionally with `&week=YYYY-MM-DD` and `&tab=automation` or `&tab=recent`) or `?view=campaigns` to land on that page; the older `?view=today` and `?view=week` still work. Sign in, then choose **Open campaign workspace** if another team is active. **My Account → My Teams → Switch** also opens the team.

In any signed-in resort workspace, **New campaign** walks through the brief and approved source, dates and channel plan, then a review before saving. If the chosen source already has active campaigns, the wizard lists them with links so you can extend one instead of starting a parallel campaign. The four starter pieces are planned one property day apart at the same local time, including across clock changes. The FAQ goes to the website. When preparation preferences list channels, the plan uses those channels. A suggestion from the editorial planner can prefill the source, family, start, end and the number of pieces.

## Today and Plan

The workspace has eight tabs: Today, Plan, Campaigns, Ads, Performance, Reviews, Connections, and Profile & facts.

* **Today** (`/resorts`) is the first page. In order: the daily brief with **Refresh** and a button that opens Plan on the day to review; **Waiting for you** (source changes to review, then one card per active campaign, then **Wrap up**); **Going out today** (today's pieces only, with **See the week**); a side column with **Campaign watch**, today's advice, the latest post result, and links to Ads and Performance; one **Tomorrow** line that links to Plan → Automation; and, at the foot, when the brief was prepared and the last successful source checks. On a phone the side column sits under the main column.
* **Today does not refresh by itself.** It loads once. It reloads after an action you take on it, when you choose **Refresh**, and when the resort's calendar day changes. Refresh re-reads the brief and what is waiting; it does not ask for new advice.
* **Plan** (`/resorts/plan`) has three tabs, kept in the address: **Week** (the default; `?week=YYYY-MM-DD` chooses the week and `?day=YYYY-MM-DD` brings one day into view), **Automation** (`?tab=automation`) and **Recent work** (`?tab=recent`). Week shows one editorial plan: a seven-day strip with a count per day, then all seven days with their pieces. Automation shows tomorrow's status with **Prepare tomorrow now**, tomorrow's outlook, the last three preparation runs, repeating posts and the preparation settings; it is the only resort view that reloads by itself, and only while a preparation run is queued or in progress. Recent work lists the newest newsletters, posts, image projects and media.
* Older addresses forward: `/resorts/today` opens `/resorts` (keeping any `#source-review-…` anchor), `/resorts/week` opens `/resorts/plan` (keeping `?week=`), and `/resorts/week#resort-history` opens `/resorts/plan?tab=recent`.

## Approved sources

Choose **Resorts & Hospitality** during setup when enabled. In **Profile & facts**, save the resort identity, time zone and brand guidance. Add accommodations, offers, experiences, events and venues with verified facts, access rules, destinations and validity dates. Approve facts separately from creative copy.

Only owners and admins approve source facts. An editor can add sources and edit facts; editing an approved source's facts sends it back for approval. While a detected public-page change is waiting, the source cannot be approved; **Profile & facts** links to the comparison in **Today** (`/resorts#source-review-<source id>`). Save buttons stay disabled until something changes. Before a change to brief fields (resort name, location, time zone or brand guidance; a source's facts, links, dates or approval; a campaign's brief, source, dates or status), a confirmation lists how many approved drafts, approved ad briefs and queued posts return to review. The street address is display-only.

Owners and admins can retire a source (it leaves the library, new campaigns and preparation, and **Show retired sources** brings it back into view), restore it, or delete it. Deleting is refused for sources, campaigns, pieces and ad briefs with publishing or reporting history; retire or archive those instead.

Automatic preparation defaults stays to overnight marketing, venues to groups, and other source types to local marketing. Override **Family for automatic preparation** for cases such as an accommodation offer. Manual campaigns can use any family. All three remain available concurrently.

Owners/admins control automation and approve copy or ad plans. Editors prepare content and import evidence. Data stays in the current organization. Inactive/deleted workspaces, expired entitlement and a disabled vertical cannot continue automated distribution.

### Questions and answers

**Profile & facts → Questions and answers** holds answers to common questions about the property as a whole (pets, check-in, quiet hours). They live in `resort_facts`, apart from sources: a question is never a campaign source, so it never appears in the campaign wizard, the planner, booking availability mapping, offers, or anywhere a source is chosen.

* Add one by hand, or **Import questions and answers** from a CSV with the columns Question, Answer and Category (optional). The import is the one the storage and garage workspaces use (template, row-by-row preview, then a summary of what was added, updated and skipped). A question already on the list, worded the same, is updated when its answer or category differs. The file name is kept as the question's source note.
* Every question arrives not verified and not approved. Editors add, edit and mark questions verified; only an owner or admin approves one, and only once it is verified. Changing the question, answer or category withdraws approval (a new question or answer also withdraws verification), whoever makes the change. Only owners and admins retire and restore; retiring withdraws approval.
* Drafting (`resort_deliverable` in Content Forge, which the morning preparation's polishing also uses, and the resort studio formats) adds approved, unretired answers as **Other approved facts about the property**, after the campaign's own source, with the rule that they are used only where relevant, never override the source's verified facts and are never stretched beyond what they say. At most 400 answers are sent, in the order they were added, each cut at 1,500 characters; the page says so when an answer is longer. With no approved answers the brief is exactly what it was before. The morning preparation's recipe drafts are built from the source alone, as before.
* Approving, changing or retiring an answer does not send pieces back for review: nothing records which answer a piece used, so that cannot be done reliably. The page says "Pieces already approved are not changed. Check any that use this answer."

## The morning operating loop

**Home** shows the daily brief for the property's local day. It refreshes itself when it is older than 15 minutes; **Refresh** fetches it immediately.

Open **Plan → Automation → Preparation settings**. Choose the resort-local ready time, preparation lead time, review days, channels and daily draft limit. Enter the audience/priorities, enable paid briefs and optional polishing of prepared drafts, then save. Until settings are saved, **Today** shows a **Choose when your mornings are prepared** link that opens them. Enable automatic preparation or choose **Prepare tomorrow now** for an immediate trial.

Campaign watch compares the property’s approved sources, dated inventory of planned pieces, operator priorities, active campaigns and linked performance records. The AI selects an existing draft to review, a campaign to assess or extend, a new campaign, or a hold. Each recommendation links to the underlying record and cites workspace facts. A separate grounding check reviews the model-written explanation and editorial question. With insufficient evidence or an unavailable model, the card labels its rules-based advice.

**Plan → Automation** also shows tomorrow's outlook for the next local morning. Opening the outlook never queues a preparation run. While the planner works, the previous advice stays visible with an "Updating advice" note. After three minutes without a result, the card says the planner is taking longer than usual and offers **Retry**. Editors and above can choose **Refresh advice**; advice refreshes at most every 10 minutes. Actual preparation reads fresh evidence before adding work, attaches an extension to its existing campaign, and can finish with review actions and zero new drafts. The **Content Forge refined** count tracks copy generation only.

The existing Railway worker processes a durable resort queue. Database cron and the worker both enqueue due mornings safely; a workspace/date identity prevents duplicates. Preparation works with the page closed. Factual recipe drafts remain available if optional AI refinement fails. Missing/expired sources produce coverage gaps, never invented facts. AI refinement covers organic pieces and paid creative. Today shows pending/running progress, completed/failed counts, interrupted work and recipe fallbacks. Provider work that loses its worker heartbeat is marked interrupted. Late responses cannot overwrite newer edits, approvals, changed sources or changed preparation preferences. Production notes are saved separately from publishable copy and included in exports.

Today's headline and the **Drafts that need you, by campaign type** line at the top of **Waiting for you** use one rule (`resortAttention` in `src/lib/resortToday.js`), so the family counts always add up to the headline. A draft needs you when it is unapproved, was sent back by a source or offer change, has a source problem, or passed its planned time before it was scheduled or published. Each is counted once: past its planned time, or else to review. Approved drafts waiting to be scheduled are not counted. The line under the headline, **Next to review**, is about one day only: the drafts planned for the next day that has any.

Drafts past their planned time are said once, with a count and a list that opens on request ("10 drafts are past their planned time"); each row in the cards carries only a short **Past its planned time** mark. Campaigns that passed their end date leave the decision cards and appear in a collapsed **Wrap up** list. Campaigns marks the same pieces **Overdue**: choose a new date or delete the draft.

**Approving never sends anything.** Each piece under **Going out today** says what happens to it next (`resortPieceNext`):

* A social post on a channel this build can post to (X by default; Facebook, Instagram, LinkedIn, Threads and TikTok only where their publish switch is on) goes out by itself only after someone schedules it with **Publish or schedule** on the piece or on the campaign's **Distribution** tab. Until then it reads "Approved, not scheduled".
* A scheduled post reads "Scheduled" and is published by the publishing queue at its planned time.
* Every other piece (email, website copy, scripts, and social channels whose switch is off) is copy for the member: export it, publish it, then record it. A Google Business Profile post is published with **Publish to Google** on the piece; an email section becomes a draft in the email platform.
* An approved piece whose planned time passed unscheduled reads "Approved, not sent".

The same rule gives the one line under an **Approve** button that says what approving does next.

**Plan → Week** opens on today: days of the current week that have passed are folded into one **Earlier this week** line above it.

Daily limits bound new content. Mornings cover available campaign families, rotate channels and optionally prepare ad briefs without inventing a budget or launching them. Today shows what is waiting (source changes first, then one card per campaign, then **Wrap up**), what goes out today, and one line on whether tomorrow is prepared. **Plan → Automation** holds **Prepare tomorrow now**, the recent preparation runs, **Repeating posts** and the preparation settings. **Pause all resort automation** stops preparation/recurrence and cancels pending resort deliveries; work already publishing may finish.

Optional daily source checks use the shared safe-fetch service. The first readable page becomes a monitored baseline. A later content change pauses its source and affected future work and creates a comparison for review. Page-navigation changes may be irrelevant. Review the snapshot and replacement facts, then explicitly reapprove the source. No external page can approve itself.

## Review and distribute

Create a manual campaign from **Campaigns → New campaign**, or review a prepared campaign. Selection survives refresh and browser navigation.

An open campaign has four tabs. It opens on **Pieces**.

* **Brief**: the objective, audience, source, start, end, status and offer in plain text. **Edit brief** turns the same lines, plus the title, into a form with **Save brief** and **Cancel**. Owners and admins also see **Campaign lifecycle** here: **Archive campaign** or **Restore campaign**, and **More → Delete campaign**.
* **Pieces**: a count line with **Approve N reviewed drafts** and **Add piece**, then one row per piece. A closed row shows the title, channel, format, planned date, the first line of the saved copy and the status in words. When the next step needs no editing (**Approve**, **Publish or schedule**, **View post** or **Export approved copy**) and you are allowed to take it, the row offers it directly; **Save** and **Draft** need the piece open. An open piece has two parts: **Copy and media** (fields, copy, media, the one main button and **More**) and **Sending** (Publish to Google, the tracked link, the publish panel, the publication receipt, scheduled and sent posts, email platform drafts, and **Make a version for another channel**).
* **Distribution**: **Schedule approved posts together** and **Repeat an approved post**, both open. With nothing to schedule, the tab says so and links to Connections.
* **Results**: the results form, the bookings that carried the campaign offer's promo code, and a link to Performance for email and post numbers.

Switching tabs saves nothing and loses nothing: unsaved typing in a piece, the brief or the results stays until you save or leave the campaign. The address keeps the tab (`?campaign=<id>&tab=brief`, `pieces`, `distribution` or `results`), so a reload returns to it. A link to one piece (`?campaign=<id>#item-<id>`) always opens Pieces, scrolls to that piece and focuses it.

**Draft in Content Forge** opens a concise channel-specific editor inside the piece, alongside approved facts. The Content Forge studio's resort writing modes (stay spotlight, pre-arrival email and others) are separate: they draft from a chosen approved source for copying or publishing, and are not saved into a campaign piece. Email, LinkedIn, website copy, social posts and scripts retain their intended format. The server reloads authoritative sources and reuses the existing model/usage, brand policy and injection screening.

Save the generated version, review it and select real approved media, then approve. The media list only offers assets marked Safe for content, not marked do not use and inside their rights window; a note counts the workspace images and videos left out and links to Asset Library to review them. An Instagram social post without media shows "Instagram needs approved media before it can be scheduled." Approval applies to the exact version on screen: if the draft changed after the page loaded, nothing is approved and you are asked to reload. Brief changes invalidate approvals and cancel affected pending deliveries. Copy/date/media changes require approval again. Saving a generation after its source changes is rejected. Media ownership, safety and recorded rights expiry are checked again for distribution. A script is not a rendered video; use Video Forge and attach the reviewed result.

* **Approve reviewed drafts** approves, atomically, only the drafts shown with current facts, saved content and an upcoming date. Drafts with unsaved edits, a changed source or a passed date are left out and counted.
* **Schedule approved posts together** (Distribution tab) queues selected approved social posts to selected connected accounts through the existing publishing queue; duplicate delivery identities are prevented.
* **Publish or schedule** uses the approved channel, with the approved copy and media locked. Choose **Make a version for another channel** to draft and approve a separate piece for another channel.
* **Export approved copy** supports existing email/website/distribution tools.
* **Record published externally** is the single manual path for pieces. It requires a URL/time and records operator-reported evidence in campaign history and the Calendar. The publishing panel's general "Posted manually" log is not offered for pieces. Actual provider status comes from the existing publishing pipeline. Export is not provider confirmation.
* Calendar includes planned work before scheduling, scheduled posts and externally recorded receipts, with family filters. It reads only the visible date range, pages large workspaces and never shows a piece as planned once it is scheduled or published elsewhere.

For **Repeat an approved post** (Distribution tab), explicitly choose an approved social post, connected account, recurrence and end date (within 90 days). It repeats the approved copy/media. Changed approval/source/media, disconnected accounts, overdue dates and expiry stop the recipe. New AI copy and ad budgets are never automatically approved by a recipe.

Campaign, source, ad and publication date forms use the property time zone and name it beside each field. Times shown in Today, Performance and source checks carry the zone label. Preparation, wizard spacing and recurring calendar arithmetic use resort time, including daylight-saving transitions. A campaign is marked completed automatically after its end date; archiving stays manual. Corrections to already exported/external content remain the operator's responsibility.

## Carousels and Story frames

A **carousel** piece holds 2 to 10 images for Instagram, Facebook or LinkedIn. A **Story frames** piece holds 1 to 10 images or videos for Instagram Stories, or photos for Facebook Page Stories. In the piece, choose media in order from the same rights-filtered list as single posts, then use the move up, move down and remove buttons (keyboard accessible) to set the order people see. The first item is the cover. The editor shows the count, what is missing (too few items, a video in a carousel, a PNG for Instagram, a shape Instagram rejects, rights ending before the planned date) and, for each frame, the matching line of the frame plan and the production notes ("Frame 2 · ..."). Adding, removing or reordering media returns the draft to review, cancels its queued delivery and stops evergreen recipes, like a change of cover. Approval checks every item: in this workspace, Safe for content, not do not use, rights lasting past the planned date. Deleting media from the Asset Library removes it from every sequence and returns those drafts to review. **Export approved copy** lists every media reference in order with its frame notes.

Schedule carousels and Story frames from **Distribution → Schedule approved posts together** (single-post **Publish or schedule** is not offered for them). The batch queues the cover then the rest, in order, and marks the post with its format; the delivery guard refuses any post whose media, order or format differs from the approved piece, and rechecks every item's rights when it is claimed. Instagram carousels and Stories, Facebook multi-photo posts and photo Stories, and LinkedIn multi-image posts publish natively. Stories carry no caption or link sticker. Facebook video Stories and Story frames on other channels are not supported: export the kit and publish them yourself, then record the publication. Story frames publish one at a time; progress is saved after each, so a retry continues after the last published frame instead of repeating it, and a partial failure names the frames that went live.

Carousels and Stories are no longer resort-only: every workspace can publish them from the standard Publish Panel (see [Publishing](https://thecontentforge.gitbook.io/thecontentforge-docs/feature-guides/publishing.md#carousels-and-stories)). Resort pieces keep this flow and their format flag (`platform_options.resort_format`); the publisher accepts it beside the neutral `media_format` the panel writes, and resort rows keep their own delivery guard and `resort_progress`.

One switch, on by default, read from the database (no function secret, no build variable): the `media_runtime_config` row `multi_media_publish_enabled` (1 on, 0 off; a missing row reads as on), added by `20261119150000_multi_media_all_workspaces.sql`. Distribution offers carousels and Story frames whenever the switch is on and the channel can be posted to from this build (the same per-channel switches as single posts). To switch carousels and Stories off for every workspace, in the SQL editor:

```sql
update public.media_runtime_config set value = 0, note = 'why', updated_at = now()
 where key = 'multi_media_publish_enabled';
```

Set `value = 1` to switch them back on. The publisher and the app read it within a minute. While it is off, Distribution says "Carousel and Story publishing is switched off right now", and a carousel or Story post that comes due fails with "Carousels and Stories are switched off right now, so nothing was published" instead of publishing one image. `RESORT_MULTI_MEDIA_PUBLISH_ENABLED` and `VITE_RESORT_MULTI_MEDIA_PUBLISH_ENABLED` are no longer needed; an environment value of `false` (in `MULTI_MEDIA_PUBLISH_ENABLED` or `RESORT_MULTI_MEDIA_PUBLISH_ENABLED`) still forces it off for that runtime. Posts without a format keep the existing single-media behaviour.

Automated checks: `npx vitest run src/lib/__tests__/resortMediaSequence.test.js src/lib/__tests__/resortMediaSequencePicker.test.jsx src/lib/__tests__/resortCampaignSequence.test.jsx src/lib/__tests__/publishPanelFormats.test.jsx src/lib/__tests__/calendarSequences.test.jsx`, `node scripts/test-multi-media-all-workspaces.mjs`, `deno test --allow-env --allow-read --allow-net --no-lock supabase/functions/_shared/resort-multi-media.test.ts supabase/functions/publish-social-post/resort-multi-media.test.ts`, and `supabase/tests/resort_carousels_behavior.sql` in `scripts/test-resorts-db.ps1`.

### Manual test plan for carousels and Stories

Live publishing has not been tested; run this in a test workspace once Facebook and Instagram are connected.

1. Deploy `publish-social-post` and the worker, apply `20261119150000_multi_media_all_workspaces.sql`, then release the frontend. Instagram and Facebook publishing must be open for the workspace (`INSTAGRAM_PUBLISH_ENABLED` and `META_PAGES_PUBLISH_ENABLED`, or the per-workspace canary in `platform_feature_org_access`, plus the matching `VITE_` flags). No other switch is needed.
2. In Asset Library, mark four JPEG images (square or 4:5), one PNG, one 9:16 JPEG and one MP4 under 60 seconds Safe for content.
3. **Instagram carousel.** Create a carousel piece on Instagram with three square JPEGs, reorder them, save, approve, and batch schedule it about 15 minutes ahead. Expect one carousel post with the images in the chosen order and the approved caption. In SQL, `select status, published_external_id, publish_notes from scheduled_posts where resort_item_id = '<item id>'` shows `posted`.
4. **Instagram Story.** Story frames on Instagram with the 9:16 JPEG then the MP4. Expect two Story frames in that order, no caption; `platform_options->'resort_progress'` lists both media ids.
5. **Facebook multi-photo.** A Facebook carousel with two JPEGs and the PNG. Expect one Page post with three photos in order and the caption.
6. **Facebook photo Story.** Story frames on Facebook with two JPEGs. Expect two Page Story frames. Adding the MP4 is refused in the editor and by batch scheduling.
7. **LinkedIn carousel** (if LinkedIn is connected): two JPEGs publish as one multi-image post.
8. **Guards.** Schedule a carousel, then mark one of its images do not use: at its time the post fails with "Choose approved, current media from this workspace" and nothing is published. Set `multi_media_publish_enabled` to 0 and let another carousel come due: it fails with "Carousels and Stories are switched off right now" and nothing is published; set it back to 1. Publish an ordinary single-image Instagram social post to confirm it behaves as before.
9. Check the `publish-social-post` logs for any Graph error, and remember Instagram's limit of 50 API posts per account per 24 hours (each Story frame is a post; a carousel is one).

## Ads

**Ads** prepares Meta, Google/YouTube, Reddit, X, LinkedIn, TikTok, Microsoft, Pinterest, Snapchat and Amazon briefs covering objective, audience/geography, exclusions, budget cap, dates, copy, headline/description, tracked destination, optional approved media and conversion definition. Content Forge can refine an angle against the same approved sources.

Approval requires current facts, budget, dates, geography, creative and the operator's verified tracking check. Export a draft brief for review or an approved plan for external launch. **This release does not purchase or launch ads.** Complete account/placement-specific creative and conversion checks in the ad platform. Google output is a creative brief, not a validated RSA package. Record external campaign/ad IDs to reconcile results. Owners and admins can archive a brief (hidden unless **Show archived briefs** is ticked; archiving here does not pause anything running in an ad platform), restore it, or delete one without reported results. A link from Today opens and scrolls to its brief.

## Tracking and evidence

Each piece has its own `utm_content` identity. Existing booking parameters are preserved; ads use paid media tags. Download its QR locally. When Link Manager is enabled, create a managed link using the shared safety, entitlements and analytics. Insert the CTA in editable copy and save/reapprove. Changing a managed destination invalidates affected approval. Instagram/TikTok need an actual bio/Story link placement; a caption URL is not equivalent.

**Performance** supports mapped CSV imports and automated daily-report ingestion for booking, ticketing, CRM, social and ad data. The read-only paid sender supports four native APIs and scheduled daily files for all listed platforms. Customer provider access and reconciliation require qualification. An unrelated social-publishing grant is not advertising-data access.

Every daily series records campaign/ad, stable external identity, source, date, currency, conversion definition, attribution rule/time zone, evidence, observation time and revision. Re-importing the same source/identity/day replaces its snapshot and retains an audit copy; it does not add totals again. Unknowns stay blank. Use corrected/net daily values for refunds. Raw guest/payment data is unnecessary.

Owners/admins create a **scoped reporting connection** for a selected series. Copy the credential once and configure an approved reporting service to POST to `/functions/v1/resort-performance-ingest`. Only its hash is stored. It expires in 90 days, supports revocation and cannot write another campaign/source. Requests are bounded and rate limited; `RATE_LIMIT_SALT` is required. CSV works without a connector. Use the file picker or **Paste CSV instead**, preview the mapped daily rows and import the reviewed records. See [the reporting contract](https://thecontentforge.gitbook.io/thecontentforge-docs/feature-guides/resorts/resort-reporting-api.md).

Connected post metrics reuse `posts_normalized` and existing publishing identities. Paid reports show spend, impressions, clicks, conversions, revenue, CTR, CPC, CPA and ROAS, separated by source/definition/currency/attribution. Different provider series are not summed into a fabricated total. Stays, purchases and qualified group inquiries remain distinct.

Today pages through outstanding decisions and checks budget pacing over the entire ad flight. From Performance, a supported organic channel with measured clicks can open a CTA experiment. Source names are matched to platforms case-insensitively, including common short forms such as FB, IG and Twitter. Changing the reporting dates keeps the page and any open import form in place while new results load. Paid, unrecognized and unsupported sources offer a downloadable external test brief using their own evidence.

Baseline comparison requires 7–28 complete daily business observations, at least 10 outcomes in each period, matching definitions and a 28-day shift to align weekdays. These are minimum display thresholds, not statistical significance. Sparse data and zero baselines do not produce percentage claims. Observed change is not causal uplift. Revenue is not profit; platform attribution may overlap. Download an evidence report with seasonality/capacity/offer/spend context and hand an evidence-linked CTA test to the existing Experiments builder.

The older campaign totals form remains a manual snapshot and is not mixed into dated reports. Keep original media in your archive; temporary processing sessions are not permanent archives.

## Event calendars and weather

**Connections → Event calendars** follows a public events page or an ICS calendar file. Owners and admins add or remove a feed address (webcal and http become https; the format is guessed from the address and confirmed by the first read), pause it, or choose **Check now** (owners, admins and editors, once per half hour per feed). The Railway worker reads each enabled feed at most once a day through the shared SSRF-safe fetch as `TheContentForgeEvents/1.0`, and only where the site's robots.txt (RFC 9309) allows it. A disallowed or unreadable robots.txt skips the read and records why. Calendar files use the VEVENT UID, start and end (time zones, all-day dates, durations), title, description, URL and location, with simple daily and weekly repeats expanded 60 days ahead. Web pages use schema.org Event data, or the NextGuest layout that Margaritaville properties publish. A listing date that cannot be read confidently (no date, conflicting weekday, unclear lists or ranges) is skipped and counted, never guessed. A date without a year means its next occurrence in resort time; a date up to 60 days past counts as an ended listing.

Each new event becomes an **unapproved** event source in the local family: date, time and the listing's own description as facts, the event page (or the feed) as source and destination, and the event end (or start plus three hours) as its expiry. An event typed in by hand for the same day and title is matched instead of duplicated. **Imported events awaiting review** lists them with the source link; owners and admins approve them through the normal source approval or dismiss them (a dismissed event is not imported again). Editors see the list read-only. Until someone approves or edits an import, later listing changes update it in place. A change to an approved or edited event never edits its facts: it returns to the source change review in **Today**, and so does an approved future event that disappears from its feed. An empty read, or more than three and more than half of the upcoming events vanishing at once, marks nothing missing and records an error instead. Removing a feed removes only the imports nobody reviewed. Every read is recorded in the sync history (`event_feed`) with new, updated, unchanged, skipped and blocked counts.

**Connections → Weather** uses the free National Weather Service API (US locations only). It stays off until an owner or admin confirms coordinates and switches it on; settings are kept apart from the profile, so changing them never invalidates sources or drafts. When the profile has an address, the worker looks it up once with the US Census geocoder and shows the result as a suggestion with a map link to check. The worker caches the forecast grid for 30 days and reads the forecast at most every three hours, retrying once after a server error. Each daytime period for the next seven local days becomes a dated property signal such as "Sunny, high 81°F, 10% chance of rain", expiring at the end of that day, which the planner cites for local sources. Its outlook is favourable (rain chance at most 20%, high 68 to 92°F, no storm wording), a risk (rain chance 60% or more, storm or thunder wording, or a high of 95°F or more) or neutral. Switching weather off or moving the pin removes the old forecast. When Saturday or Sunday looks favourable and an approved local day-pass source has nothing planned that weekend, the panel offers **Good pool weather Saturday: plan a day-pass post**, which opens the campaign wizard starting at 09:00 resort time two days before Saturday. The forecast informs timing; it never claims demand.

When three or more forecast days in a row have a rain chance of 60% or more, the panel (and Today) offers **Rain from Friday to Sunday: plan a rain special**, with an approved source whose wording fits a rainy day (indoor, spa, special, discount), else an approved offer or stay, that has nothing planned on those days. The campaign starts at 09:00 resort time the day before the rain. A fine weekend with an approved cabana source (and no day-pass source) reads **Good pool weather Saturday: plan a cabana post**.

Set `RESORT_EVENT_FEEDS_ENABLED=false` or `RESORT_WEATHER_ENABLED=false` on the worker to stop either pass. Tests: `deno test --no-lock --allow-read --config worker/deno.json worker/src/resort-event-parse.test.ts worker/src/resort-event-feeds.test.ts worker/src/resort-weather.test.ts` and `npx vitest run src/lib/__tests__/resortWeather.test.js src/lib/__tests__/resortEventWeatherPanels.test.jsx`.

### Local gas prices

**Connections → Local gas prices** turns rising pump prices into a local special ("live within 10 miles? come stay") and falling prices into a road-trip post. It stays off until an owner or admin switches it on, and it uses the property pin confirmed in Weather (it never geocodes again; weather itself may stay off). Settings: on or off, a distance of 1 to 30 miles (10 by default), and the state for the average (read from the property address unless chosen). Changing the distance starts the price history again, because readings for another pin or distance are never compared.

Once a day after 06:00 resort time the Railway worker makes one Google Places API (New) Nearby Search for gas stations in that circle (`includedTypes: ["gas_station"]`, at most 20 results, field mask `places.id,places.fuelOptions`). Prices older than three days, not in US dollars, or outside $0.50 to $20 are skipped; each station counts once per fuel type, with its newest price. Only our own figures are stored in `resort_gas_observations`: the median regular and diesel price, how many stations reported one, the station total and the oldest and newest update time. No station name, address, position or id is kept, and readings are deleted after 35 days. A day with fewer than five stations reporting a recent regular price is stored but never used.

Reference prices come from the U.S. Energy Information Administration API v2 through its `seriesid` route, at most once a day per series, into the shared `gas_price_reference` table: weekly retail regular gasoline for California, Colorado, Florida, Massachusetts, Minnesota, New York, Ohio, Texas or Washington (`EMM_EPMR_PTE_S<state>_DPG`), otherwise the state's PADD region (`R1X`, `R1Y`, `R1Z`, `R20`, `R30`, `R40`, or `R5XCA` for West Coast states other than California), otherwise the U.S.; and the daily U.S. Gulf Coast conventional regular spot price (`EER_EPMRU_PF4_RGC_DPG`) as an early indicator.

The rules are deterministic (`shared/localGasPrices.js`): today's median against the median of the past 7 days (at least 4 trusted days; a move of 15 cents or more), the past 30 days (at least 14 trusted days; a 30-day low at least 5 cents under the median, or a high at least 10 cents over), the state or regional weekly figure (no older than 14 days; 10 cents or more below, or 20 cents or more above, which is a fact without a suggestion) and the wholesale price's change over about a week (15 cents or more). A rise points to a local special, a fall to a road-trip push; a weekly move outranks a 30-day extreme, wholesale and the state gap. A trusted reading becomes one property signal (kind `gas_price`, key `gas:latest`), dated the day it was read and kept to the end of the next day, which the planner cites for stay and local sources; morning preparation for tomorrow also sees yesterday's reading. The panel and **Local signals** on Today offer **Gas prices are up: plan a local special** or **Gas prices are down: plan a road-trip post**, with an approved stay source that has nothing planned in the coming week, starting the next local morning. Switching off or changing the distance removes the signal.

Keys are not edge-function secrets (the project is at its limit). The worker reads `google_places` and `eia` from the Super Admin key store, or `GOOGLE_PLACES_API_KEY` and `EIA_API_KEY` from its own environment. Without a station key nothing is read and the panel says gas prices are not set up yet; without the EIA key the comparisons run without the state average and wholesale price. Fuel prices bill as Nearby Search Enterprise + Atmosphere (1,000 free calls a month at the time of writing). The worker counts calls in `resort_integration_runs` (provider `google_places`) and stops at 30 a UTC day and 900 a UTC month across all workspaces; `RESORT_GAS_DAILY_CALL_CAP` (at most 200) and `RESORT_GAS_MONTHLY_CALL_CAP` (at most 5000) change that. `RESORT_GAS_PRICES_ENABLED=false` stops the pass. A failed read retries once after about 5 seconds, then waits two hours; at most three attempts a day.

Other verticals: the rules take a point, a radius and a state, and the summary's place word is a parameter. Storage and garage sites in `vertical_sites` have an address (`region`, `postal_code`) but no coordinates; they would need confirmed coordinates per site, a settings table keyed by site, and readings keyed by site instead of workspace. Nothing in `shared/localGasPrices.js` assumes a resort.

Live calls to Google and EIA have not been made; the tests use fixtures written from the documented response shapes. Tests: `deno test --no-lock --allow-read --allow-env --config worker/deno.json worker/src/resort-gas-prices.test.ts`, `npx vitest run src/lib/__tests__/localGasPrices.test.js src/lib/__tests__/resortGasPricesPanel.test.jsx` and `supabase/tests/resort_gas_prices_behavior.sql` in `scripts/test-resorts-db.ps1`.

## Guest photos

**Resorts → Connections → Guest photos** collects recent guest photos with recorded permission. An owner or admin creates a share link with a name guests see (for example "Paradise Market, Nov 15"), an optional event or source, an expiry within 90 days, an upload limit (200 by default), an optional withdrawal contact and a short welcome note. The link and its QR are shown once; only a fingerprint of the token is stored. Disable a lost or finished link and create another; a disabled link never comes back.

Guests open `/guest-photos/<token>` on a phone, choose photos (JPEG, PNG, HEIC or WebP, up to 15 MB, at least 600 pixels on the shorter side), give their name, an optional email and a credit choice (full name, first name or no credit), read the permission terms and tick the box. The terms have a fixed core (own marketing including paid ads, light edits, 24 months, non-exclusive, review first, location details removed, a promise about the people shown, how to withdraw, what is kept as a record) and fill in only the resort name, link name and contact. Each submission stores the terms version, the exact text and its SHA-256, the time, the name and the credit choice. Changing the core wording requires a new version in `shared/resortGuestPhotos.js`; guests on an older page are asked to reload.

The public `resort-guest-photos` function (`verify_jwt=false`) checks the token itself, rate limits per network and per link (`RATE_LIMIT_SALT` required; without it the public path refuses work), and gives every dead, disabled or expired link the same answer. Each photo gets a signed upload for one private object in the `resort-guest-photos` bucket. The function then reads the stored bytes: format by magic bytes, size, dimensions and a duplicate check across the workspace. Location and camera metadata are removed straight away without re-encoding (JPEG keeps only its orientation; PNG text and eXIf, WebP EXIF and XMP chunks are dropped; HEIC Exif and XMP items are blanked in place), so GPS never waits in storage.

Submissions wait under **Waiting for review**. Editors see the queue read-only. **Approve to Asset Library** (owner or admin) cleans the file again, verifies nothing is left to remove, copies it to `<org>/guest-photos/` in the assets bucket and runs the approval as the signed-in person. Approval is the only way a guest photo becomes `safe_for_content`: it creates the asset with rights status `guest_granted`, the guest's credit, a rights expiry 24 months after consent and the permission record in `metadata.guest_photo`. Afterwards the rights can only narrow. **Reject** needs a reason. **Guest withdrew permission** marks the asset do not use everywhere; it cannot be switched back on. For a link tied to an event, an approved photo can be attached to that event's recap draft, which then needs approval again.

Retention: photos still unreviewed after 30 days are closed as not used, and files of photos that were not approved are deleted 30 days after they were sent (daily pg\_cron job plus an hourly storage purge through the same function). Approved originals are deleted once the Asset Library copy exists. HEIC files whose metadata cannot be located exactly are kept for review but cannot be approved; ask the guest for a JPEG. Image Forge exports of an approved photo do not inherit its credit or expiry yet.

## Reviews and Google Business Profile

An owner or admin connects **Connections → Google Business Profile**, signs in with the Google account that manages the listing and chooses one location. Reviews for that location sync every 6 hours; **Check for new reviews** runs a sync on demand, at most every 10 minutes. Google keeps every Business Profile API at zero requests until it approves Basic API Access for the Cloud project, which needs a verified profile active for 60 days or more. Until then the connection is saved, and Connections and **Reviews** say "Google API access not approved yet" instead of a generic failure.

Campendium and RV LIFE have no APIs. Editors paste those reviews in **Reviews** (text, rating, date, reviewer, review link); a repeat paste is reported, not duplicated. RV LIFE owners claim the listing with "Own This Campground?" (verified in 24 to 48 hours) and reply in the owner dashboard. Campendium documents no owner reply; ask <info@campendium.com>.

**Draft with Content Forge** writes a reply grounded only in the profile's brand notes and approved, current sources. Review text and reviewer names are screened and passed to the model as data, never as instructions. A draft that offers refunds, credits, compensation, prices or availability, or carries a link, email or phone number that is not in the approved grounding, is never saved. Editors write and edit drafts; any edit needs a fresh approval. Only an owner or admin approves. **Post reply to Google** shows the exact text first; that click is the express consent, and only the person who approved the text can post it (enforced by a trigger as well as the page). For manual sites, use **Copy reply**, open the review, then **Mark as posted**.

Google review text, reviewer names, ratings and reply copies are cleared 29 days after first fetch by the hourly `resort-review-purge` job and every sync, and immediately on disconnect, so nothing is kept past 30 days. Our reply drafts and approvals stay. Pasted reviews from other sites stay; pasted Google reviews follow the Google limit. Each sync writes one factual planner signal (kind `reviews`, for example "3 new Google reviews in the last 7 days, average 4.3 of 5; 1 without a reply.").

`google_business` is a piece and preparation channel. After approval, **Publish to Google** (owner or admin) posts the copy (1,500 characters at most) as a standard Google post, or as an event with resort-local dates when the source is an event with both dates. The call to action is **Book** for stays and **Learn more** otherwise, to the piece's tracked destination. A photo goes only if it is reviewed, rights-cleared, JPEG or PNG and at most 5 MB, through a one-hour signed URL. Each post records a `provider_confirmed` receipt with the Google post name. Recording it is bookkeeping: the approval and its revision stamps stay as they were, and the receipt is kept even if the approval changed while Google was answering. A piece with any recorded publication, including one recorded by hand, is not posted again and cannot be deleted.

Deploy `resort-gbp-oauth` (`verify_jwt=false`, the redirect carries no session), `resort-gbp-actions` and `resort-review-reply` (`verify_jwt=true`). Set `GOOGLE_BUSINESS_CLIENT_ID` and `GOOGLE_BUSINESS_CLIENT_SECRET` (or the Super Admin key store names `google_business_client_id` and `google_business_client_secret`) on the edge functions and the worker, and `SOCIAL_TOKEN_ENCRYPTION_KEY` on the worker. Register `https://<project-ref>.supabase.co/functions/v1/resort-gbp-oauth` as the OAuth redirect URI. `RESORT_REVIEWS_SYNC_ENABLED=false` pauses the scheduled sync; the purge keeps running in the database.

## Deployment and qualification

Apply the Resorts migrations, including the campaign wizard migration, against a staging copy of the complete schema. Deploy Content Forge, `resort-performance-ingest`, the Railway worker and frontend. The ingest function verifies its own scoped credential (`verify_jwt=false`). Configure the existing rate-limit service/salt. Migrations leave the vertical off; enable it through normal platform controls only for qualified workspaces. Ensure cron exists or retain the worker enqueue fallback.

The isolated local demo uses real Auth/PostgREST, the real resort queue and live Content Forge generation. The loopback gateway in `worker/src/resort-local.ts` serves the actual Content Forge and reporting handlers and forwards database/auth requests to local Supabase. Start it with `scripts/start-resorts-local.ps1`; server credentials belong outside the repository/Vite root. Point `VITE_SUPABASE_URL` at its gateway (default port 55425). The model key is server-only. Native paid buying, connected publishing receipts and customer-specific booking conversions still require external accounts and staging qualification.

Storage and garage businesses use separate organizations. Customer media, inputs, reports and credentials stay organization-scoped.

## Validation

* `scripts/test-resort-showcase.mjs` is a historical rehearsal for the withdrawn showcase; it is no longer a live-site acceptance check.
* `npx vitest run src/lib/__tests__/resorts.test.js src/lib/__tests__/resortWorkspace.test.jsx src/lib/__tests__/resortOperations.test.js src/lib/__tests__/resortTodayPlan.test.jsx src/lib/__tests__/resortTodayReview.test.jsx src/lib/__tests__/resortAutomation.test.jsx src/lib/__tests__/resortPerformance.test.jsx src/lib/__tests__/calendarMediaRender.test.jsx src/lib/__tests__/verticalsAuth.test.js`
* `powershell -NoProfile -File scripts/test-resorts-db.ps1` runs the real resort migrations and behavior suites in a disposable PostgreSQL 17 container.
* `node scripts/test-resorts-live.mjs` checks the configured local account, completed live morning, real ingestion HTTP, scoped corrections and revocation (requires the local public `SUPABASE_ANON_KEY`).
* `deno test --allow-env --no-lock supabase/functions/resort-performance-ingest/index.test.ts`
* `deno test --allow-env --no-lock supabase/functions/_shared/resort-reviews.test.ts supabase/functions/resort-gbp-oauth/index.test.ts supabase/functions/resort-gbp-actions/index.test.ts supabase/functions/resort-review-reply/index.test.ts` and `deno test --allow-env --no-lock --config worker/deno.json worker/src/resort-reviews.test.ts`
* `deno check --no-lock supabase/functions/content-studio/index.ts`
* `deno check --no-lock --config worker/deno.json worker/src/index.ts`
* `npm run build` with normal public Vite settings.

## Operating the resort pilot

In **Plan → Automation → Preparation settings**, set the family to prioritize and the last resort-local date it applies. With a small daily limit, the planner fills other slots from the least recently prepared eligible families. The run lists prepared, deferred and missing families. Choose the platform for morning paid briefs separately. Source checks handle six due URLs per morning, checking new and oldest-due URLs first. **Last successful source checks** at the foot of Today shows when each page was last read; source review flags wording changes around access, dates or prices.

Each decision card groups the campaign drafts, reviewed media, paid briefs and exceptions. Expand a card to review the copy and approve the campaign batch. **Hold this source** asks for a reason and a recheck time. The hold invalidates pending TCF work for every campaign using those facts. At the recheck, review and approve the source in **Profile & facts**. External ad platforms remain the operator’s responsibility. **Hold and prepare replacement** can draft against a different approved campaign in the same family, including a replacement paid brief when enabled.

For an event, select **Prepare advance post, shot list and recap**, a next approved campaign and two planned dates. The advance post carries the private shot list. The recap belongs to the next campaign and carries its tracked CTA. Replace the observed-highlight placeholder and attach rights-cleared media before approving. Open the event brief in Video Forge to carry the private instructions into an editing session. Save the clip to Asset Library and use the return link to attach it to the original draft. Both drafts appear on the shared Calendar for review. Source holds and event actions execute atomically.

In **Performance → Reconcile a provider export**, paste de-identified CSV, map its columns and explicitly map provider statuses. Newbook matches stays, RealTime Reservation matches pass/order sales, and Jotform plus the sales CRM match group inquiries and wins via the same opaque inquiry ID. Choose **Preview matches** to check opaque IDs against this workspace and provider, including outcomes outside the selected reporting period. Untagged corrections retain the first attribution. Conflicting tags and unknown untagged IDs stay available for review. Download the reconciliation report after import. Use ISO dates, a source update timestamp with offset and, for the first attribution, the actual captured `utm_campaign=resort_<campaign UUID>`. The template is an import contract, not an assertion about a vendor’s export headers. Unmatched tags are counted before import. Only the selected columns are stored. Newer corrections update the same provider record. Replay and older records leave it intact. A group can qualify in one reporting period and close in another.

Paid results, attributed business results, operator time and evidence of incremental lift stay separate. Use **Matched source evidence** to reach the underlying campaign. Download the owner report after entering measured minutes for comparable work. Before enabling a real resort, confirm one tracked booking, ticket purchase and qualified inquiry, a correction, and one real platform ad against the source reports.

## Email platform drafts (Mailchimp and Klaviyo)

An approved email section can become a **draft campaign** in the resort's own Mailchimp or Klaviyo account, aimed at a saved audience such as past guests, seasonal or monthly-site guests, or RV rally clubs. **This workspace never sends or schedules email.** The operator reviews, tests and sends each draft in the email platform. The shared client (`shared/resortEmail.js`) refuses every send, schedule and test-send endpoint before a request leaves the server.

**Connect.** In **Resorts → Connections → Email platforms**, an owner or admin pastes an API key. Mailchimp: Profile → Extras → API keys (the key ends in its data center, such as `-us21`). Klaviyo: Settings → API keys → Create Private API Key with `campaigns:write`, `campaigns:read`, `templates:write`, `lists:read`, `segments:read` and `metrics:read`. Klaviyo report calls require a metric, so without `metrics:read` drafts work but reports cannot be fetched. The key is checked against the provider, encrypted with `social_encrypt_token` and stored with a four-character hint; it is never returned to the browser. Optional settings: default sender name, reply-to address, report currency and, for Klaviyo, the conversion metric (default **Placed Order**; without one, reports carry opens and clicks only).

**Audience presets.** Map each preset to a Mailchimp audience (optionally one saved segment or one tag) or to one Klaviyo list or segment. The function verifies the target in the provider. Members can read presets; owners and admins maintain them. Removing a preset keeps the draft history, which stores a copy of the audience.

**Create a draft.** On an approved, current email section in **Campaigns**, open **Email platform drafts**, choose the platform and preset, review the subject and preview text, and confirm. The database re-checks owner/admin role, approval and every profile, source and campaign revision stamp (`resort_email_push_begin`), and reserves the version so a double click cannot create two drafts. One draft is allowed per approved version, platform and audience; edit and re-approve the email to push a new version. The email uses the approved copy (escaped, with provider merge syntax neutralized), the brand colors adjusted for readable contrast, the profile name, a button to the tracked destination with `utm_content`, and the provider's required footer (`*|UNSUB|*` and the audience address in Mailchimp, `{% unsubscribe %}` and the organization address in Klaviyo). Images are not inserted; add approved media in the platform. Mailchimp drafts open from a direct link. Klaviyo creates a template, the draft campaign (2026-10-15 omnichannel model, its own UTM tagging off), assigns a non-reusable copy of the template and deletes the reusable original to stay under Klaviyo's 1,000 API template cap.

**Reports.** Every 12 hours for drafts from the last 30 days, the Railway worker (`worker/src/resort-email-metrics.ts`) asks whether each draft was sent and imports sent reports. Editors and above can **Refresh report** once every 15 minutes. Each sent email becomes one `resort_performance` row with `source_kind` **email**, dated by the resort-local send day. The cumulative report replaces that row on each import (revision history is kept) and never adds totals. Delivered emails fill **impressions** and unique clickers fill **clicks**, so CTR matches the provider's click rate. Opens stay in the evidence text and the draft history because privacy proxies open mail automatically. Conversions and revenue come only from a Klaviyo conversion metric; otherwise they stay blank. Klaviyo allows 225 report calls a day per account: this workspace batches up to 50 drafts per call and uses at most 150 calls a rolling day (10 held for the scheduled sync), 31 seconds apart. When the budget is spent the run is recorded as skipped with the reason and resumes later. Runs appear in `resort_integration_runs` and on the Connections panel.

**Deploy.** Apply `20261109134000_resort_email.sql` (adds `email` to the reporting kinds, preserving any others). Deploy `resort-email-sync` with `verify_jwt = true`; it needs `SOCIAL_TOKEN_ENCRYPTION_KEY`. The Railway worker also needs `SOCIAL_TOKEN_ENCRYPTION_KEY` to read stored keys; without it, email reports pause and the worker logs one warning. Mailchimp OAuth is a planned follow-up: register an app (`MAILCHIMP_CLIENT_ID`, `MAILCHIMP_CLIENT_SECRET`), store the access token in the same encrypted credential with `config.auth = 'oauth'` and the account's data center, and keep API keys as a fallback.

**Validate.** `npx vitest run src/lib/__tests__/resortEmail.test.js src/lib/__tests__/resortEmailUi.test.jsx`, `deno test --allow-env --allow-read --no-lock supabase/functions/resort-email-sync/index.test.ts`, `deno test --allow-env --allow-read --no-lock --config worker/deno.json worker/src/resort-email-metrics.test.ts`, and `powershell -NoProfile -File scripts/test-resorts-db.ps1` (includes `supabase/tests/resort_email_behavior.sql`).

## Rivals

**Rivals** (`/resorts/rivals`) keeps what nearby RV resorts and campgrounds charge, offer and advertise. Everything is typed in by the team; there is no paid data feed and nothing is scraped.

* **Rivals.** Name, city, distance, website, Facebook Page (name or address, plus the numeric Page id when known), Google Maps address, amenities and how they position themselves. **Stop tracking** keeps a rival's history but leaves it out of the comparison; deleting (owners and admins) removes its history too.
* **Log a rate.** Rival, stay type (back-in, pull-through, premium or waterfront RV site, cabin, day pass, other), weeknight or weekend night, nightly rate in US dollars, availability (open, limited, sold out, not known), the day it was seen and where. Optional: the night it was for (a Friday or Saturday sets weekend night), minimum stay and a note. A rate is required unless the rival was sold out. After saving, the rival, days and source stay filled in and the cursor returns to the rate.
* **Rates compared.** For weeknights or weekend nights, each stay type shows our rate beside the lowest, median and highest of the tracked rivals' most recent rates from the last 60 days, how ours sits against the median, and how many of those rivals were sold out with the days the checks were made. Each rival also says how often it was sold out across every check with known availability.
* **Our rates** are entered on this page (no other resort table records a nightly price). Editors can set them; clearing one needs an owner or admin.
* **Ads they are running** opens the public Meta Ad Library in a new tab: active ads shown in the US, searched by the rival's Page name (or its name when the Page was saved as an address), or that Page's ads alone when the Page id is stored. The Ad Library API does not return ordinary US commercial ads, so what the team sees there is logged by hand with **Log an ad** (what the ad offered, format, date, link, note).

Rival names and prices stay on this page. They are not read by the editorial planner, morning preparation or Content Forge.

Data: `20261118120000_resort_rivals.sql` (`resort_rivals`, `resort_rival_rates`, `resort_rival_ads`, `resort_rival_own_rates`). Members read; owners, admins and editors write; owners and admins delete. Tests: `npx vitest run src/lib/__tests__/resortRivals.test.js src/lib/__tests__/resortRivalsUi.test.jsx` and `supabase/tests/resort_rivals_behavior.sql` in `scripts/test-resorts-db.ps1`.

## Booking availability and occupancy

**Connections → Booking system** brings daily availability into planning. Choose **Newbook (API)** or **CSV import** for Campspot and every other system (Campspot has no public occupancy API).

* **Newbook.** Ask Newbook Support for REST API credentials (a username and password) and your property's API key, and confirm the region (US for properties on `bookingsus.newbook.cloud`). An owner or admin enters them. `resort-booking-connect` runs `auth_test` and reads `accommodation_category_list` first; a rejection saves nothing. It encrypts `{username,password,api_key}` with `social_encrypt_token` and keeps only the region, instance name, optional revenue currency and the last four characters of the API key readable. Every six hours the Railway worker reads `reports_occupancy` for today through 45 days ahead in resort time, paced under Newbook's 100 requests a minute (one call, split into 16-day periods only if Newbook cannot answer it), stores every category and records the run. Rejected credentials mark the connection **Needs attention** and retry after six hours.
* **CSV.** Editors, admins and owners upload or paste one row per date and category: `date` (ISO), `category`, `available`, `occupied`, and optionally `blocked`, `revenue_net`, `currency`. Map the columns, preview, and import up to 5,000 rows; the server validates every row again. Re-importing a category and date replaces it, and changed counts keep their previous values in `resort_occupancy_history` (pruned after 120 days).
* **Mapping.** Owners and admins map each category to a stay source in the same workspace; several categories add together. Free units are available minus occupied minus blocked (Newbook maintenance plus allotted), never negative. The panel shows the next 14 days per source in words, including **Sold out**, **Partly reported** and **Not reported**.
* **Planner signals.** One database derivation, `resort_private.derive_booking_signals`, runs after every sync, import, mapping or settings change, so Newbook and CSV data give identical signals. For the next 14 resort-local days it writes `occupancy` signals for weekend days, days with 10% or fewer units free and days at or below the low-occupancy threshold (default 50% booked), and an `availability` risk signal for each sold-out day, such as "Cabana Cabins: 3 of 12 free on Sat 14 Nov (75% booked)". They are counts, never demand. A day with a missing category, or reports older than 72 hours, produces nothing.
* **Sold-out hold** is off by default. When an owner or admin turns it on, a stay source that is sold out on every day of the hold window (default 14 days, every mapped category reported within 24 hours) is held the same way as **Hold this source**: the source becomes unapproved with a new revision, approvals are withdrawn and waiting posts (queued or approved) are canceled. The recheck is the end of the window and the reason names the dates, for example "Newbook reports no availability Mon 9 Nov–Sun 22 Nov 2026". Nothing removes a hold. An owner or admin reapproves the source, which clears the hold, and it is not held again for the rest of that window. When the hold is on, an editor's CSV import can also trigger it; the reason then names the imported report.

To go live with Newbook, apply `20261109133000_resort_booking.sql`, deploy `resort-booking-connect` (`verify_jwt = true`), and set `SOCIAL_TOKEN_ENCRYPTION_KEY` on the Railway worker to the same value the Edge functions use. Tests: `npx vitest run src/lib/__tests__/resortBooking.test.jsx`, `deno test --no-lock supabase/functions/_shared/newbook-client.test.ts supabase/functions/resort-booking-connect/index.test.ts`, `deno test --no-lock --config worker/deno.json worker/src/resort-booking.test.ts`, and `scripts/test-resorts-db.ps1` (runs `supabase/tests/resort_booking_behavior.sql`).
