airport-one-widgets 0.2.8 → 0.2.11

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/README.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # Airport One Widgets
2
2
 
3
+ **Integration guide (v2 embed, domains, telemetry, troubleshooting):** [`docs/widget-embed-integration.md`](../../docs/widget-embed-integration.md) (repository root).
4
+
5
+ ## Airfare Search (v2)
6
+
7
+ The v2 airfare-search widget is an explicit opt-in contract and does not alias from
8
+ the v1 `flight-search-form` tag.
9
+
10
+ ### Installation
11
+
12
+ ```html
13
+ <script src="https://widgets.flymyairport.com"></script>
14
+ ```
15
+
16
+ ### Usage
17
+
18
+ ```html
19
+ <fma-airfare-search
20
+ data-widget-instance-id="YOUR_INSTANCE_UUID"
21
+ ></fma-airfare-search>
22
+ ```
23
+
24
+ Required for managed instances:
25
+
26
+ - `data-widget-instance-id`
27
+
3
28
  ## Airfare Content
4
29
 
5
30
  Core Purpose:
@@ -24,20 +49,43 @@ To use the `fma-airfare-content` custom element, simply add the following HTML t
24
49
  <fma-airfare-content></fma-airfare-content>
25
50
  ```
26
51
 
52
+ ### Portal-managed instance (v2)
53
+
54
+ For embeds copied from the Airport One portal, bind the host element to a saved widget instance. At build time, set **`VITE_WIDGET_PUBLIC_CONFIG_API_BASE_URL`** to the public widget config API origin (no trailing slash), e.g. the Cloud Run **widget-api** service that serves `GET /v1/widget-instances/{id}/config`. The runtime then loads portal-managed defaults from that endpoint.
55
+
56
+ **Instance id on the element (in order):**
57
+
58
+ 1. **`data-widget-instance-id`** — preferred; matches portal snippets.
59
+ 2. **HTML `id`** — if the data attribute is missing or whitespace-only, the trimmed `id` property is used (ensure it is unique on the page).
60
+
61
+ Changing either value triggers a new fetch and re-render. **Explicit attributes on the element always override** values from the public config API and from `window.__A1_WIDGET_CONFIG__`.
62
+
63
+ Example:
64
+
65
+ ```html
66
+ <fma-airfare-content
67
+ data-widget-instance-id="YOUR_INSTANCE_UUID"
68
+ ></fma-airfare-content>
69
+ ```
70
+
71
+ The embedding origin must be allowlisted for that instance (see widget-api CORS / embed allowlists). If the API base env var is unset, the script skips the fetch and behaves like a legacy attribute-only embed.
72
+
27
73
  You can customize the behavior and appearance of the element by setting its attributes. The available attributes are listed in the table below:
28
74
 
29
- | Attribute | Type | Default | Description |
30
- | --------------------- | ------ | ------- | ------------------------------------------------------------------------------------- |
31
- | origin | string | null | The origin airport code |
32
- | primary-color | string | #0B89FF | The primary color of the form |
33
- | secondary-color | string | #0B89FF | The secondary color of the form |
34
- | primary-hover-color | string | — | Primary color on hover (hex). When unset, falls back to primary. |
35
- | secondary-hover-color | string | — | Secondary color on hover, e.g. price text (hex). When unset, falls back to secondary. |
36
- | destinations | string | null | A comma-separated list of destination codes |
37
- | theme | string | light | The theme of the widget - "light" or "dark" |
38
- | consent-advertising | string | true | Dynamically turn off/on consent for Advertising - pass "true" or "false" |
39
- | consent-analytics | string | true | Dynamically turn off/on consent for Analytics - pass "true" or "false" |
40
- | consent-functional | string | true | Dynamically turn off/on consent for Functional - pass "true" or "false" |
75
+ | Attribute | Type | Default | Description |
76
+ | ----------------------- | ------ | ------- | -------------------------------------------------------------------------------------------------------------------------------------- |
77
+ | origin | string | null | The origin airport code |
78
+ | primary-color | string | #0B89FF | The primary color of the form |
79
+ | secondary-color | string | #0B89FF | The secondary color of the form |
80
+ | primary-hover-color | string | — | Primary color on hover (hex). When unset, falls back to primary. |
81
+ | secondary-hover-color | string | — | Secondary color on hover, e.g. price text (hex). When unset, falls back to secondary. |
82
+ | destinations | string | null | A comma-separated list of destination codes |
83
+ | theme | string | light | The theme of the widget - "light" or "dark" |
84
+ | consent-advertising | string | true | Dynamically turn off/on consent for Advertising - pass "true" or "false" |
85
+ | consent-analytics | string | true | Dynamically turn off/on consent for Analytics - pass "true" or "false" |
86
+ | consent-functional | string | true | Dynamically turn off/on consent for Functional - pass "true" or "false" |
87
+ | data-widget-instance-id | string | — | Portal instance UUID; loads public config when `VITE_WIDGET_PUBLIC_CONFIG_API_BASE_URL` is set (preferred over `id` for this purpose). |
88
+ | id | string | — | Fallback instance id when `data-widget-instance-id` is absent/empty; must be unique in the document. |
41
89
 
42
90
  ### Examples
43
91
 
@@ -133,7 +181,7 @@ Use the same script loader as other widgets:
133
181
 
134
182
  ### Usage
135
183
 
136
- Add the `fma-carfare-search` custom element to your page. If you don't pass an `origin`, it will default to `window.__A1_WIDGET_CONFIG__.iata` when present.
184
+ Add the `fma-carfare-search` custom element to your page. If you don't pass an `origin`, it will default to `window.__A1_WIDGET_CONFIG__.iata` when present, or to the instance **iata** from the public config API when `data-widget-instance-id` / `id` is set and **`VITE_WIDGET_PUBLIC_CONFIG_API_BASE_URL`** is configured (same contract as airfare).
137
185
 
138
186
  ```html
139
187
  <!-- Minimal -->
@@ -145,15 +193,17 @@ Add the `fma-carfare-search` custom element to your page. If you don't pass an `
145
193
 
146
194
  Available attributes:
147
195
 
148
- | Attribute | Type | Default | Description |
149
- | ------------------- | ------- | ---------------- | -------------------------------------------------------------------------- |
150
- | origin | string | from global | Origin IATA (3 letters). Falls back to `window.__A1_WIDGET_CONFIG__.iata`. |
151
- | primary-color | string | `#0B89FF` or cfg | Primary theme color (CSS color). |
152
- | secondary-color | string | `#0B89FF` or cfg | Secondary theme color (CSS color). |
153
- | theme | string | `light` | `light` or `dark`. |
154
- | consent-advertising | boolean | `true` | Enable/disable Advertising consent within the widget. |
155
- | consent-analytics | boolean | `true` | Enable/disable Analytics consent within the widget. |
156
- | consent-functional | boolean | `true` | Enable/disable Functional consent within the widget. |
196
+ | Attribute | Type | Default | Description |
197
+ | ----------------------- | ------- | ---------------- | ------------------------------------------------------------------------------ |
198
+ | origin | string | from global | Origin IATA (3 letters). Falls back to `window.__A1_WIDGET_CONFIG__.iata`. |
199
+ | primary-color | string | `#0B89FF` or cfg | Primary theme color (CSS color). |
200
+ | secondary-color | string | `#0B89FF` or cfg | Secondary theme color (CSS color). |
201
+ | theme | string | `light` | `light` or `dark`. |
202
+ | consent-advertising | boolean | `true` | Enable/disable Advertising consent within the widget. |
203
+ | consent-analytics | boolean | `true` | Enable/disable Analytics consent within the widget. |
204
+ | consent-functional | boolean | `true` | Enable/disable Functional consent within the widget. |
205
+ | data-widget-instance-id | string | — | Portal instance UUID; loads public config when the widget-api base env is set. |
206
+ | id | string | — | Fallback instance id when the data attribute is absent/empty. |
157
207
 
158
208
  ### Examples
159
209