airport-one-widgets 0.2.77 → 0.2.78
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 +48 -0
- package/dist/airport-one-widgets.iife.js +25 -25
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -178,6 +178,54 @@ fma-airfare-content::part(airfare-content-item-disclaimer) {
|
|
|
178
178
|
}
|
|
179
179
|
```
|
|
180
180
|
|
|
181
|
+
## Route Map (Where We Fly)
|
|
182
|
+
|
|
183
|
+
`fma-route-map` shows every destination reachable from an airport (nonstop and one-stop) on a map with a searchable destination list, plus filters for stops, airline, travel month, and connecting hub. Data comes from `GET /v1/widget-instances/{id}/route-map` on the widget API (`VITE_WIDGET_PUBLIC_CONFIG_API_BASE_URL`).
|
|
184
|
+
|
|
185
|
+
The widget renders only for an instance registered in the portal: `data-widget-instance-id` is required and must resolve to an active `route-map` instance whose airport allowlists the embedding site. Without one, the element stays empty and logs the reason to the console. The origin airport always comes from the instance.
|
|
186
|
+
|
|
187
|
+
MapLibre is loaded from unpkg (jsDelivr fallback) on first mount rather than bundled, so pages that embed other widgets do not pay for it. Pages with a strict CSP must allow `unpkg.com` / `cdn.jsdelivr.net` (script, style) and `tiles.openfreemap.org` (connect, img).
|
|
188
|
+
|
|
189
|
+
```html
|
|
190
|
+
<fma-route-map data-widget-instance-id="YOUR-INSTANCE-ID"></fma-route-map>
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Attributes (each overrides the saved instance, which overrides `window.__A1_WIDGET_CONFIG__` brand colors):
|
|
194
|
+
|
|
195
|
+
| Attribute | Default | Purpose |
|
|
196
|
+
| ------------------------------------ | ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
197
|
+
| `primary-color` | `#0b3d91` | One-stop routes, tabs, controls |
|
|
198
|
+
| `secondary-color` | `#f26430` | Nonstop routes, badges, origin |
|
|
199
|
+
| `heading` / `kicker` / `description` | `Where We Fly` / `Interactive route map` / generated | Header copy (`kicker=""` hides the kicker) |
|
|
200
|
+
| `hide-header` | off | Omit the header block |
|
|
201
|
+
| `map-only` | off | Hide the destination list; tapping a pin opens the FlyMyAirport destination page |
|
|
202
|
+
| `hide-filters` | off | Hide the filter bar (stops, airline, months, hub, full screen), so the `default-*` starting view is fixed |
|
|
203
|
+
| `default-region` | `north-america` | `north-america` or `world` |
|
|
204
|
+
| `default-stops` | `all` | Starting tab: `all`, `nonstop`, or `one-stop` |
|
|
205
|
+
| `default-airline` | all airlines | Starting airline, by code (`UA`) or name (`United`) |
|
|
206
|
+
| `default-months` | any time | Starting travel months, comma-separated: names (`dec,jan`), numbers (`12`), or `YYYY-MM`. Names and numbers mean their next occurrence, so `dec` keeps meaning "this coming December" |
|
|
207
|
+
| `default-hub` | all hubs | Starting connecting hub (`ORD`) |
|
|
208
|
+
| `default-sort` | `recommended` | `recommended`, `nearest`, `farthest`, or `name` |
|
|
209
|
+
| `theme` | `light` | `dark` switches to a dark basemap |
|
|
210
|
+
| `map-style` | OpenFreeMap Liberty | MapLibre style URL |
|
|
211
|
+
|
|
212
|
+
The `default-*` controls only set the starting view; travelers can still change every filter (unless `hide-filters` is on), and a **Reset** button (shown once anything changes) returns to that starting view. Each filter panel (Airline, Traveling, Connect via) also has its own Reset that restores just that filter. Values the airport's routes don't support (an airline or hub with no service) are ignored. Example, United nonstops for December and January:
|
|
213
|
+
|
|
214
|
+
```html
|
|
215
|
+
<fma-route-map
|
|
216
|
+
data-widget-instance-id="YOUR-INSTANCE-ID"
|
|
217
|
+
default-stops="nonstop"
|
|
218
|
+
default-airline="UA"
|
|
219
|
+
default-months="dec,jan"
|
|
220
|
+
></fma-route-map>
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
CSS parts: `route-map-header`, `route-map-panel`, `route-map-toolbar`, `route-map-filter-button`, `route-map-filter-panel`, `route-map-filter-drawer`, `route-map-filter-reset`, `route-map-reset`, `route-map-canvas`, `route-map-legend`, `route-map-destination-list`.
|
|
224
|
+
|
|
225
|
+
On phones (viewport under 640px) the Airline, Traveling, and Hub menus open as a bottom drawer instead of a popover, and the toolbar stacks: full-width tabs, three equal filter buttons, then the map view row.
|
|
226
|
+
|
|
227
|
+
Demo: `/demo/route-map.html` (`npm run dev`).
|
|
228
|
+
|
|
181
229
|
## Carfare Search
|
|
182
230
|
|
|
183
231
|
Core Purpose:
|