@escape-game-over/atlas 0.1.103 → 0.1.105

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@escape-game-over/atlas",
3
- "version": "0.1.103",
3
+ "version": "0.1.105",
4
4
  "type": "module",
5
5
  "description": "Typed, data-driven machinery for static multi-locale, multi-deployment Astro sites.",
6
6
  "private": false,
@@ -18,6 +18,7 @@
18
18
  "./client": "./src/astro/client.ts",
19
19
  "./astro/auto-dialog": "./src/astro/AutoDialog.astro",
20
20
  "./astro/background-video": "./src/astro/BackgroundVideo.astro",
21
+ "./astro/booking-widget": "./src/astro/BookingWidget.astro",
21
22
  "./astro/consent-banner": "./src/astro/ConsentBanner.astro",
22
23
  "./astro/document": "./src/astro/Document.astro",
23
24
  "./astro/element": "./src/astro/AtlasElement.astro",
@@ -1,3 +1,4 @@
1
+ import type { BookingVendor } from "../booking/widget.ts";
1
2
  import {
2
3
  CONSENT_KEY,
3
4
  CONSENT_MONTHS,
@@ -35,13 +36,6 @@ export type StorageVendor =
35
36
  | "drip"
36
37
  | "clarity";
37
38
 
38
- /**
39
- * A booking widget a site embeds, which keeps its own storage on the site's
40
- * domain: rows the analytics settings cannot know about, so the site names
41
- * the widgets it embeds.
42
- */
43
- export type BookingWidget = "4escape";
44
-
45
39
  /**
46
40
  * Each vendor's product as it calls itself, for a table's "set by" column.
47
41
  * Names, not copy: the same in every language, so a project translates only
@@ -58,7 +52,7 @@ export const STORAGE_VENDOR_NAMES = {
58
52
  drip: "Drip",
59
53
  clarity: "Microsoft Clarity",
60
54
  "4escape": "4escape",
61
- } as const satisfies Record<StorageVendor | BookingWidget, string>;
55
+ } as const satisfies Record<StorageVendor | BookingVendor, string>;
62
56
 
63
57
  /** A span `Intl.NumberFormat` can word in any locale: `{ 2, "year" }`. */
64
58
  export interface Lifetime {
@@ -73,7 +67,7 @@ type OwnRow = `${VendorWithOwn}-own`;
73
67
  export type AtlasStoredId = "atlas-locale" | "atlas-campaign" | "atlas-consent";
74
68
 
75
69
  /** A booking widget's rows: what it keeps, and what it keeps for the tab. */
76
- type BookingRow = BookingWidget | `${BookingWidget}-tab`;
70
+ type BookingRow = BookingVendor | `${BookingVendor}-tab`;
77
71
 
78
72
  /** One row's id: what a project keys the row's wording by. */
79
73
  export type StoredId = AtlasStoredId | StorageVendor | OwnRow | BookingRow;
@@ -83,7 +77,7 @@ export interface StoredItem {
83
77
  /** As the browser shows them; a pattern like `_ga_<id>` where the vendor appends one. */
84
78
  readonly names: readonly string[];
85
79
  /** Who sets it: this site, or the vendor. */
86
- readonly provider: "site" | StorageVendor | BookingWidget;
80
+ readonly provider: "site" | StorageVendor | BookingVendor;
87
81
  /** Set on the vendor's own domains rather than the site's; absent for the site's. */
88
82
  readonly domains?: readonly string[];
89
83
  /** A span; `tab` for session storage; `kept` until the visitor clears it. */
@@ -97,8 +91,12 @@ export interface StoredItemsOptions {
97
91
  readonly rememberLocale?: boolean;
98
92
  /** As passed to `Document`, and with its default: `false`. */
99
93
  readonly rememberCampaign?: boolean;
100
- /** The booking widgets the site embeds anywhere. */
101
- readonly booking?: readonly BookingWidget[];
94
+ /**
95
+ * The vendors of the booking widgets the site embeds anywhere: their
96
+ * storage is on the site's domain, where the analytics settings cannot
97
+ * see it.
98
+ */
99
+ readonly booking?: readonly BookingVendor[];
102
100
  /**
103
101
  * Rows the site sets first, then by what has to be granted — nothing,
104
102
  * analytics, marketing — and otherwise in catalog order. Off, the rows
@@ -283,7 +281,7 @@ const BOOKING = {
283
281
  tab: ["forescape"],
284
282
  },
285
283
  } as const satisfies Record<
286
- BookingWidget,
284
+ BookingVendor,
287
285
  { readonly kept: readonly string[]; readonly tab: readonly string[] }
288
286
  >;
289
287
 
@@ -0,0 +1,31 @@
1
+ ---
2
+ /**
3
+ * A booking widget, whatever its vendor: the one place that picks the
4
+ * vendor's component, so a site passes what its config holds and nothing
5
+ * else. Attributes go to that component's element.
6
+ *
7
+ * ```astro
8
+ * <BookingWidget widget={settings.booking} locale={locale} class="my-8" />
9
+ * ```
10
+ */
11
+ import type { HTMLAttributes } from "astro/types";
12
+ import type { BookingWidget } from "../booking/widget.ts";
13
+ import FourEscape from "./FourEscape.astro";
14
+
15
+ type Props = HTMLAttributes<"div"> & {
16
+ readonly widget: BookingWidget;
17
+ /** The page's: the widget speaks it when its vendor has it. */
18
+ readonly locale: string;
19
+ };
20
+
21
+ const { widget, locale, ...attrs } = Astro.props;
22
+ ---
23
+
24
+ {widget.vendor === "4escape" && (
25
+ <FourEscape
26
+ {...attrs}
27
+ widgetId={widget.widgetId}
28
+ domain={widget.domain}
29
+ locale={locale}
30
+ />
31
+ )}
@@ -0,0 +1,10 @@
1
+ import type { FourEscapeWidget } from "./four-escape.ts";
2
+
3
+ /**
4
+ * A booking widget a site embeds, by its vendor: what a site's config names,
5
+ * and what picks the component that draws it.
6
+ */
7
+ export type BookingWidget = { readonly vendor: "4escape" } & FourEscapeWidget;
8
+
9
+ /** Who makes a booking widget: what `storedItems` takes for their rows. */
10
+ export type BookingVendor = BookingWidget["vendor"];
package/src/index.ts CHANGED
@@ -45,7 +45,6 @@ export {
45
45
  } from "./analytics/index.ts";
46
46
  export {
47
47
  type AtlasStoredId,
48
- type BookingWidget,
49
48
  compareStoredItems,
50
49
  type Lifetime,
51
50
  STORAGE_VENDOR_NAMES,
@@ -66,6 +65,7 @@ export {
66
65
  fourEscapeLanguage,
67
66
  fourEscapeSettings,
68
67
  } from "./booking/four-escape.ts";
68
+ export type { BookingVendor, BookingWidget } from "./booking/widget.ts";
69
69
  export type {
70
70
  LanguageTag,
71
71
  LocaleMeta,