@coras-io/embed 0.7.1 → 0.8.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @coras-io/embed
2
2
 
3
+ ## 0.8.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 3cc8fef: Line the seat selection summary bar up with the seat map column on wide screens instead of centring it in the viewport
8
+ - e48044e: Scroll smoothly to the basket after adding tickets on wider screens instead of jumping to the top of the page
9
+ - 06267c9: Show the selected city's hero image and breadcrumbs on the landing page when the city was chosen from the navbar search or opened from a link without its country
10
+ - ef34b68: Remove the drop shadow from the ticket selector on the details page so it reads as a field, not a button
11
+ - 24a5a4c: List grouped section options from the lowest price to the highest
12
+
13
+ ## 0.8.0
14
+
15
+ ### Minor Changes
16
+
17
+ - 0fd91b9: Group event section options by price, with a section dropdown per price, when more than eight sections are available
18
+
19
+ ### Patch Changes
20
+
21
+ - 85df217: Remove the drop shadow from the date field on the details page so it reads as a field, not a button
22
+
3
23
  ## 0.7.1
4
24
 
5
25
  ### Patch Changes
@@ -21,6 +21,11 @@ export declare class CorasSeatedSelector extends LitElement {
21
21
  private violations;
22
22
  private reserved;
23
23
  private sheetExpanded;
24
+ private columnBounds;
25
+ private readonly columnObserver;
26
+ private measureColumn;
27
+ connectedCallback(): void;
28
+ disconnectedCallback(): void;
24
29
  private fallbackFired;
25
30
  private seatsTask;
26
31
  private chartDataCache;
@@ -13,6 +13,7 @@ import { apiGet } from "../../core/api/queries.js";
13
13
  import { clientContext } from "../../contexts/client.context.js";
14
14
  import { currencyContext, distributorIdContext, localeContext, } from "../../contexts/properties.context.js";
15
15
  import { map } from "lit/directives/map.js";
16
+ import { styleMap } from "lit/directives/style-map.js";
16
17
  import { fireInternalEvent } from "../../core/events.js";
17
18
  import { convertToLocaleCurrency } from "../../core/currency/index.js";
18
19
  import { buildChartData, buildSelectionSummary, buildTickets, } from "../seats-io/seats-io.transform.js";
@@ -53,6 +54,17 @@ let CorasSeatedSelector = class CorasSeatedSelector extends LitElement {
53
54
  // seat-count-and-total handle, expanded to the full breakdown on tap. Ignored
54
55
  // on wider screens, where the breakdown always shows.
55
56
  this.sheetExpanded = false;
57
+ // The summary bar is fixed to the viewport, so CSS alone cannot line it up
58
+ // with this element's column on wide pages. Its viewport offset and width are
59
+ // measured here and handed to the bar as custom properties.
60
+ this.columnBounds = null;
61
+ this.columnObserver = new ResizeObserver(() => this.measureColumn());
62
+ this.measureColumn = () => {
63
+ const { left, width } = this.getBoundingClientRect();
64
+ if (this.columnBounds?.left !== left || this.columnBounds.width !== width) {
65
+ this.columnBounds = { left, width };
66
+ }
67
+ };
56
68
  this.fallbackFired = false;
57
69
  this.seatsTask = new Task(this, {
58
70
  task: async ([client, attractionId, instanceId, locale, distributorID, currency,]) => {
@@ -139,6 +151,16 @@ let CorasSeatedSelector = class CorasSeatedSelector extends LitElement {
139
151
  };
140
152
  }
141
153
  static { this.styles = styles; }
154
+ connectedCallback() {
155
+ super.connectedCallback();
156
+ this.columnObserver.observe(this);
157
+ window.addEventListener("resize", this.measureColumn);
158
+ }
159
+ disconnectedCallback() {
160
+ super.disconnectedCallback();
161
+ this.columnObserver.disconnect();
162
+ window.removeEventListener("resize", this.measureColumn);
163
+ }
142
164
  get chartData() {
143
165
  const data = this.seatsTask.value;
144
166
  if (!data) {
@@ -222,8 +244,19 @@ let CorasSeatedSelector = class CorasSeatedSelector extends LitElement {
222
244
  }
223
245
  const { groups, fees, total } = buildSelectionSummary(this.selectedSeats, data.availableSeats, data.flatPriceBands, data.categories);
224
246
  const seatCount = this.selectedSeats.length;
247
+ const columnStyle = this.columnBounds
248
+ ? {
249
+ "--seated-drawer-left": `${this.columnBounds.left}px`,
250
+ "--seated-drawer-width": `${this.columnBounds.width}px`,
251
+ }
252
+ : {};
225
253
  return html `
226
- <div class="drawer" part="drawer" data-expanded=${this.sheetExpanded}>
254
+ <div
255
+ class="drawer"
256
+ part="drawer"
257
+ data-expanded=${this.sheetExpanded}
258
+ style=${styleMap(columnStyle)}
259
+ >
227
260
  <div class="drawer-inner">
228
261
  <button
229
262
  type="button"
@@ -369,6 +402,9 @@ __decorate([
369
402
  __decorate([
370
403
  state()
371
404
  ], CorasSeatedSelector.prototype, "sheetExpanded", void 0);
405
+ __decorate([
406
+ state()
407
+ ], CorasSeatedSelector.prototype, "columnBounds", void 0);
372
408
  CorasSeatedSelector = __decorate([
373
409
  localized()
374
410
  ], CorasSeatedSelector);
@@ -35,10 +35,8 @@ export default css `
35
35
  inset-inline: 0;
36
36
  bottom: 0;
37
37
  z-index: 20;
38
- display: flex;
39
- justify-content: center;
40
38
  box-sizing: border-box;
41
- padding: 24px clamp(16px, 4vw, 48px);
39
+ padding: 24px 0;
42
40
  background: var(--coras-color-background);
43
41
  border-top: 1px solid var(--coras-color-divider);
44
42
  box-shadow: var(--coras-shadow-top);
@@ -49,8 +47,9 @@ export default css `
49
47
  align-items: center;
50
48
  justify-content: space-between;
51
49
  gap: 24px;
52
- width: 100%;
53
- max-width: var(--coras-seated-max-width);
50
+ width: var(--seated-drawer-width, 100%);
51
+ margin-left: var(--seated-drawer-left, auto);
52
+ margin-right: auto;
54
53
  }
55
54
 
56
55
  .drawer-summary {
@@ -104,6 +103,8 @@ export default css `
104
103
  flex-direction: column;
105
104
  align-items: stretch;
106
105
  gap: 12px;
106
+ width: 100%;
107
+ margin: 0;
107
108
  }
108
109
 
109
110
  .sheet-handle {
@@ -1,10 +1,30 @@
1
- import { type CSSResultGroup, LitElement } from "lit";
1
+ import { type CSSResultGroup, LitElement, type PropertyValues } from "lit";
2
2
  import "../../button/button.js";
3
+ import "../../dropdown/dropdown.js";
3
4
  import "../../icon/icon.js";
5
+ import "../../select-list/select-list.js";
6
+ import "../../select-list/select-option/select-option.js";
7
+ export interface SportOptionSection {
8
+ id: string;
9
+ name: string;
10
+ }
4
11
  export declare class CorasSportOption extends LitElement {
5
12
  static styles: CSSResultGroup;
6
13
  assetsURL: string;
7
14
  section: string;
8
15
  price: string;
16
+ /**
17
+ * Sections sharing this price. With more than one, the section becomes a
18
+ * dropdown and `value` holds the chosen section id.
19
+ */
20
+ sections: SportOptionSection[];
21
+ value: string;
22
+ protected willUpdate(changed: PropertyValues<this>): void;
23
+ private dropdownOpen;
24
+ private toggleDropdown;
25
+ private closeDropdown;
26
+ private selectSection;
27
+ private stopPropagation;
28
+ private renderSection;
9
29
  render(): import("lit").TemplateResult<1>;
10
30
  }
@@ -4,11 +4,15 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { LitElement, html } from "lit";
8
- import { property } from "lit/decorators.js";
7
+ import { LitElement, html, } from "lit";
8
+ import { property, state } from "lit/decorators.js";
9
+ import { map } from "lit/directives/map.js";
9
10
  import { localized, msg } from "@lit/localize";
10
11
  import "../../button/button.js";
12
+ import "../../dropdown/dropdown.js";
11
13
  import "../../icon/icon.js";
14
+ import "../../select-list/select-list.js";
15
+ import "../../select-list/select-option/select-option.js";
12
16
  import styles from "./sport-option.styles.js";
13
17
  let CorasSportOption = class CorasSportOption extends LitElement {
14
18
  constructor() {
@@ -16,16 +20,85 @@ let CorasSportOption = class CorasSportOption extends LitElement {
16
20
  this.assetsURL = "";
17
21
  this.section = "";
18
22
  this.price = "";
23
+ /**
24
+ * Sections sharing this price. With more than one, the section becomes a
25
+ * dropdown and `value` holds the chosen section id.
26
+ */
27
+ this.sections = [];
28
+ this.value = "";
29
+ this.dropdownOpen = false;
30
+ this.toggleDropdown = () => {
31
+ this.dropdownOpen = !this.dropdownOpen;
32
+ };
33
+ this.closeDropdown = (event) => {
34
+ event.stopPropagation();
35
+ this.dropdownOpen = false;
36
+ };
37
+ this.stopPropagation = (event) => {
38
+ event.stopPropagation();
39
+ };
19
40
  }
20
41
  static { this.styles = styles; }
42
+ willUpdate(changed) {
43
+ if (changed.has("sections") &&
44
+ !this.sections.some((section) => section.id === this.value)) {
45
+ this.value = this.sections[0]?.id ?? "";
46
+ }
47
+ }
48
+ selectSection(id) {
49
+ this.value = id;
50
+ this.dropdownOpen = false;
51
+ }
52
+ renderSection() {
53
+ if (this.sections.length > 1) {
54
+ const selected = this.sections.find(({ id }) => id === this.value);
55
+ return html `<div class="text" @click=${this.stopPropagation}>
56
+ <div class="label" id="section-label">${msg("Section")}</div>
57
+ <coras-dropdown
58
+ ?open=${this.dropdownOpen}
59
+ @dropdown-close-request=${this.closeDropdown}
60
+ auto-focus
61
+ >
62
+ <coras-button
63
+ slot="trigger"
64
+ variant="outlined"
65
+ radius="field"
66
+ height="md"
67
+ border-color="light"
68
+ expanded
69
+ .shadow=${false}
70
+ ?rotate-suffix=${this.dropdownOpen}
71
+ @click=${this.toggleDropdown}
72
+ >
73
+ <coras-icon
74
+ assets-url="${this.assetsURL}"
75
+ slot="suffix"
76
+ icon="keyboard-arrow-down"
77
+ ></coras-icon>
78
+ <span class="selected-section">${selected?.name}</span>
79
+ </coras-button>
80
+
81
+ <coras-select-list spacious aria-labelledby="section-label">
82
+ ${map(this.sections, ({ id, name }) => html `
83
+ <coras-select-option
84
+ key=${id}
85
+ ?selected=${id === this.value}
86
+ @click=${() => this.selectSection(id)}
87
+ >${name}</coras-select-option
88
+ >
89
+ `)}
90
+ </coras-select-list>
91
+ </coras-dropdown>
92
+ </div>`;
93
+ }
94
+ return html `<div class="text">
95
+ <div class="label">${msg("Section")}</div>
96
+ <div class="value">${this.sections[0]?.name ?? this.section}</div>
97
+ </div>`;
98
+ }
21
99
  render() {
22
100
  return html `<div class="sport-option">
23
- <div class="section">
24
- <div class="text">
25
- <div class="label">${msg("Section")}</div>
26
- <div class="value">${this.section}</div>
27
- </div>
28
- </div>
101
+ <div class="section">${this.renderSection()}</div>
29
102
  <div class="price">
30
103
  <div class="text">
31
104
  <div class="label">${msg("Price")}</div>
@@ -51,6 +124,15 @@ __decorate([
51
124
  __decorate([
52
125
  property({ type: String })
53
126
  ], CorasSportOption.prototype, "price", void 0);
127
+ __decorate([
128
+ property({ attribute: false })
129
+ ], CorasSportOption.prototype, "sections", void 0);
130
+ __decorate([
131
+ property({ type: String })
132
+ ], CorasSportOption.prototype, "value", void 0);
133
+ __decorate([
134
+ state()
135
+ ], CorasSportOption.prototype, "dropdownOpen", void 0);
54
136
  CorasSportOption = __decorate([
55
137
  localized()
56
138
  ], CorasSportOption);
@@ -103,6 +103,27 @@ export default css `
103
103
  }
104
104
  }
105
105
  }
106
+
107
+ .section {
108
+ min-width: 0;
109
+
110
+ .text {
111
+ flex: 1;
112
+ min-width: 0;
113
+ }
114
+ }
115
+
116
+ coras-dropdown {
117
+ display: block;
118
+ width: 100%;
119
+ }
120
+
121
+ .selected-section {
122
+ min-width: 0;
123
+ overflow: hidden;
124
+ text-overflow: ellipsis;
125
+ white-space: nowrap;
126
+ }
106
127
  }
107
128
 
108
129
  @container (max-width: 400px) {
@@ -35,7 +35,7 @@ export class CorasTourTicketTypeSelector extends LitElement {
35
35
  height="md"
36
36
  border-color="light"
37
37
  expanded
38
- ?shadow=${false}
38
+ .shadow=${false}
39
39
  ?error=${this.error}
40
40
  @click=${this.dropdownToggle}
41
41
  >
@@ -123,6 +123,7 @@ export declare class CorasDetailsPage extends CorasDetailsPage_base {
123
123
  private findSeatedPerformance;
124
124
  private renderSeatedSelector;
125
125
  private renderSectionOptions;
126
+ private renderSectionsByPrice;
126
127
  private handleSeatsConfirmed;
127
128
  private renderAvailabilityOptions;
128
129
  private openNavbarBasket;
@@ -56,7 +56,7 @@ import { BaseMixin } from "../../mixins/base.mixin.js";
56
56
  import { ErrorModalMixin } from "../../mixins/error-modal.mixin.js";
57
57
  import { currentPageContext } from "../../contexts/current-page.context.js";
58
58
  import { convertToLocaleCurrency } from "../../core/currency/index.js";
59
- import { calculateTotalPrice, formatDateWithTimezone, formatTicketDetails, getAvailabilityDays, getAvailabilityRequestKey, getAvailabilitySummary, getBookingSessionExpiry, getCurrentMonth, getMinBookingSize, getTicketsAmount, getTicketSelectorLabel, getTotalTicketsCount, groupAvailabilityByTime, isBelowMinimumBookingSize, isSingleDayAvailability, resolveAttractionLocation, scrollToTop, sumPricesAndFormat, } from "./details-page.utilts.js";
59
+ import { calculateTotalPrice, formatDateWithTimezone, formatTicketDetails, getAvailabilityDays, getAvailabilityRequestKey, getAvailabilitySummary, getBookingSessionExpiry, getCurrentMonth, getMinBookingSize, getTicketsAmount, getTicketSelectorLabel, getTotalTicketsCount, groupAvailabilityByTime, groupSectionsByPrice, isBelowMinimumBookingSize, isSingleDayAvailability, resolveAttractionLocation, scrollToTop, SECTION_GROUPING_THRESHOLD, sumPricesAndFormat, } from "./details-page.utilts.js";
60
60
  import { formatDateTimeForDisplay } from "../../core/utils/datetime.js";
61
61
  import { APIError } from "../../core/api/api-error.js";
62
62
  import { getBookingSession, storeBookingSession, } from "../../core/api/middlewares/booking-session/booking-session.utils.js";
@@ -640,6 +640,7 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
640
640
  height="md"
641
641
  border-color="light"
642
642
  expanded
643
+ .shadow=${false}
643
644
  @click=${this.toggleCalendarDropdown}
644
645
  ?error=${this.hasAvailabilityError}
645
646
  >
@@ -839,7 +840,7 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
839
840
  }
840
841
  else {
841
842
  this.openNavbarBasket();
842
- scrollToTop();
843
+ scrollToTop("smooth");
843
844
  }
844
845
  this.shouldRenderOptions = false;
845
846
  this.selectedPriceTypes = {};
@@ -1034,7 +1035,8 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
1034
1035
  @click="${async () => {
1035
1036
  await this.handleBasketModalToggle(this.selectedSectionId);
1036
1037
  this.isReservationPreviewModalOpened = false;
1037
- setTimeout(() => scrollToTop(), 0);
1038
+ const isMobile = window.matchMedia("(max-width: 800px)").matches;
1039
+ setTimeout(() => scrollToTop(isMobile ? "instant" : "smooth"), 0);
1038
1040
  }}"
1039
1041
  >
1040
1042
  ${msg("Add to basket")}
@@ -1291,7 +1293,7 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
1291
1293
  }
1292
1294
  else {
1293
1295
  this.openNavbarBasket();
1294
- scrollToTop();
1296
+ scrollToTop("smooth");
1295
1297
  }
1296
1298
  return true;
1297
1299
  }
@@ -1489,24 +1491,46 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
1489
1491
  <coras-sport-options
1490
1492
  label="${msg(str `We have ${filteredOptions.length} available options`)}"
1491
1493
  >
1492
- ${map(filteredOptions, ({ name, selection_id, prices }) => html `
1493
- <coras-sport-option
1494
- assets-url="${this.assetsURL}"
1495
- section="${name || ""}"
1496
- price="${sumPricesAndFormat({
1497
- prices,
1494
+ ${filteredOptions.length > SECTION_GROUPING_THRESHOLD
1495
+ ? this.renderSectionsByPrice(filteredOptions)
1496
+ : map(filteredOptions, ({ name, selection_id, prices }) => html `
1497
+ <coras-sport-option
1498
+ assets-url="${this.assetsURL}"
1499
+ section="${name || ""}"
1500
+ price="${sumPricesAndFormat({
1501
+ prices,
1502
+ locale: this.locale,
1503
+ currency: this.currency,
1504
+ })}"
1505
+ @click=${() => {
1506
+ this.isReservationPreviewModalOpened = true;
1507
+ this.selectedSectionId = selection_id;
1508
+ }}
1509
+ ></coras-sport-option>
1510
+ `)}
1511
+ </coras-sport-options>
1512
+ </div>
1513
+ `;
1514
+ }
1515
+ renderSectionsByPrice(options) {
1516
+ return map(groupSectionsByPrice({
1517
+ options,
1498
1518
  locale: this.locale,
1499
1519
  currency: this.currency,
1500
- })}"
1501
- @click=${() => {
1520
+ }), ({ price, sections }) => html `
1521
+ <coras-sport-option
1522
+ assets-url="${this.assetsURL}"
1523
+ price="${price}"
1524
+ .sections=${sections.map(({ selection_id, name }) => ({
1525
+ id: selection_id,
1526
+ name: name || "",
1527
+ }))}
1528
+ @click=${(event) => {
1502
1529
  this.isReservationPreviewModalOpened = true;
1503
- this.selectedSectionId = selection_id;
1530
+ this.selectedSectionId = event.currentTarget.value;
1504
1531
  }}
1505
- ></coras-sport-option>
1506
- `)}
1507
- </coras-sport-options>
1508
- </div>
1509
- `;
1532
+ ></coras-sport-option>
1533
+ `);
1510
1534
  }
1511
1535
  // The navbar is a light-DOM child the SDK slots into the page (sdk/chrome.ts)
1512
1536
  // and picks the modal or dropdown for its own layout.
@@ -1522,7 +1546,7 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
1522
1546
  }
1523
1547
  else {
1524
1548
  this.openNavbarBasket();
1525
- scrollToTop();
1549
+ scrollToTop("smooth");
1526
1550
  }
1527
1551
  }
1528
1552
  get availabilityErrorCode() {
@@ -113,3 +113,19 @@ export declare const getMinBookingSize: (apiResponse: components["schemas"]["Att
113
113
  * ticket and the minimum, not the visitor clearing the selector.
114
114
  */
115
115
  export declare const isBelowMinimumBookingSize: (totalTickets: number, minBookingSize: number) => boolean;
116
+ /**
117
+ * Above this many sections the options list groups them by price band.
118
+ */
119
+ export declare const SECTION_GROUPING_THRESHOLD = 8;
120
+ /**
121
+ * Groups section options by their formatted ticket price, ordered from the
122
+ * lowest price to the highest.
123
+ */
124
+ export declare const groupSectionsByPrice: ({ options, locale, currency, }: {
125
+ options: components["schemas"]["AvailabilityItemModel"][];
126
+ locale: SupportedLocales;
127
+ currency: SupportedCurrencies;
128
+ }) => {
129
+ price: string;
130
+ sections: components["schemas"]["AvailabilityItemModel"][];
131
+ }[];
@@ -96,27 +96,21 @@ export const calculateTotalPrice = (tickets) => {
96
96
  return sum + (ticket.full_price || 0);
97
97
  }, 0);
98
98
  };
99
- export const sumPricesAndFormat = ({ prices, locale, currency, }) => {
100
- if (!prices || prices.length === 0) {
101
- return convertToLocaleCurrency({
102
- value: 0,
103
- locale,
104
- currency,
105
- });
106
- }
99
+ const sumPrices = (prices, currency) => {
107
100
  let sum = 0;
108
- for (const priceItem of prices) {
101
+ for (const priceItem of prices ?? []) {
109
102
  if (priceItem.min_full_price &&
110
103
  typeof priceItem.min_full_price[currency] === "number") {
111
104
  sum += priceItem.min_full_price[currency];
112
105
  }
113
106
  }
114
- return convertToLocaleCurrency({
115
- value: sum,
116
- locale,
117
- currency,
118
- });
107
+ return sum;
119
108
  };
109
+ export const sumPricesAndFormat = ({ prices, locale, currency, }) => convertToLocaleCurrency({
110
+ value: sumPrices(prices, currency),
111
+ locale,
112
+ currency,
113
+ });
120
114
  export const isSingleDayAvailability = (salePeriods) => {
121
115
  if (!salePeriods || salePeriods.length === 0) {
122
116
  return false;
@@ -190,7 +184,11 @@ export const groupAvailabilityByTime = (items, locale) => {
190
184
  return groupItemsByTime(items, locale);
191
185
  };
192
186
  export const scrollToTop = (behavior = "instant") => {
193
- window.scrollTo({ top: 0, behavior });
187
+ const prefersReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
188
+ window.scrollTo({
189
+ top: 0,
190
+ behavior: prefersReducedMotion ? "instant" : behavior,
191
+ });
194
192
  };
195
193
  export const getAvailabilitySummary = (item, currency) => {
196
194
  const totalPrice = item.min_full_price[currency] ?? 0;
@@ -255,3 +253,28 @@ export const getMinBookingSize = (apiResponse) => {
255
253
  * ticket and the minimum, not the visitor clearing the selector.
256
254
  */
257
255
  export const isBelowMinimumBookingSize = (totalTickets, minBookingSize) => totalTickets > 0 && totalTickets < minBookingSize;
256
+ /**
257
+ * Above this many sections the options list groups them by price band.
258
+ */
259
+ export const SECTION_GROUPING_THRESHOLD = 8;
260
+ /**
261
+ * Groups section options by their formatted ticket price, ordered from the
262
+ * lowest price to the highest.
263
+ */
264
+ export const groupSectionsByPrice = ({ options, locale, currency, }) => {
265
+ const groups = new Map();
266
+ for (const option of options) {
267
+ const amount = sumPrices(option.prices, currency);
268
+ const price = convertToLocaleCurrency({ value: amount, locale, currency });
269
+ const group = groups.get(price) ?? { amount, sections: [] };
270
+ group.sections.push(option);
271
+ groups.set(price, group);
272
+ }
273
+ return Array.from(groups, ([price, { amount, sections }]) => ({
274
+ price,
275
+ amount,
276
+ sections,
277
+ }))
278
+ .sort((first, second) => first.amount - second.amount)
279
+ .map(({ price, sections }) => ({ price, sections }));
280
+ };
@@ -119,6 +119,8 @@ export declare class CorasLandingPage extends CorasLandingPage_base {
119
119
  private renderShowMoreButton;
120
120
  private renderPoints;
121
121
  private renderAttractionCards;
122
+ private get resolvedCountry();
123
+ private renderLocationImage;
122
124
  private renderBreadcrumbs;
123
125
  private renderAttractionsSkeleton;
124
126
  private renderFiltersSkeleton;
@@ -223,7 +223,7 @@ let CorasLandingPage = class CorasLandingPage extends ErrorModalMixin(PointsMixi
223
223
  if (this.locationsData && (this.country || this.city)) {
224
224
  const matchingCountry = this.locationsData
225
225
  .flatMap((continent) => continent.countries ?? [])
226
- .find((country) => country?.slug === this.country);
226
+ .find((country) => country?.slug === this.resolvedCountry);
227
227
  const matchingCity = matchingCountry?.cities?.find((city) => city?.slug === this.city);
228
228
  const item = this.city && matchingCity
229
229
  ? { type: "city", value: this.city, name: matchingCity.name }
@@ -838,13 +838,34 @@ let CorasLandingPage = class CorasLandingPage extends ErrorModalMixin(PointsMixi
838
838
  </section>
839
839
  `;
840
840
  }
841
+ // The navbar search and a deep link give a city without its country; the
842
+ // locations response wraps the city in its country, so the slug comes from there.
843
+ get resolvedCountry() {
844
+ if (this.country || !this.city) {
845
+ return this.country;
846
+ }
847
+ return (this.locationsData
848
+ ?.flatMap((continent) => continent.countries ?? [])
849
+ .find((country) => country?.cities?.some((city) => city?.slug === this.city))?.slug ?? "");
850
+ }
851
+ renderLocationImage() {
852
+ if (this.city && !this.resolvedCountry) {
853
+ return nothing;
854
+ }
855
+ return html `
856
+ <coras-location-image
857
+ country=${this.resolvedCountry}
858
+ city=${this.city}
859
+ ></coras-location-image>
860
+ `;
861
+ }
841
862
  renderBreadcrumbs() {
842
863
  if (!this.city || !this.locationsData) {
843
864
  return nothing;
844
865
  }
845
866
  const matchingCountry = this.locationsData
846
867
  .flatMap((continent) => continent.countries ?? [])
847
- .find((country) => country?.slug === this.country);
868
+ .find((country) => country?.slug === this.resolvedCountry);
848
869
  if (!matchingCountry) {
849
870
  return nothing;
850
871
  }
@@ -855,7 +876,7 @@ let CorasLandingPage = class CorasLandingPage extends ErrorModalMixin(PointsMixi
855
876
  const handleCountryClick = () => {
856
877
  this.dispatchPageUpdate({
857
878
  page: "landing",
858
- country: this.country,
879
+ country: this.resolvedCountry,
859
880
  city: "",
860
881
  });
861
882
  };
@@ -917,11 +938,7 @@ let CorasLandingPage = class CorasLandingPage extends ErrorModalMixin(PointsMixi
917
938
  <coras-layout with-basket>
918
939
  <slot name="navbar" slot="navbar"></slot>
919
940
  <header class="hero-section">
920
- ${this.renderLocationSearchSelector()}
921
- <coras-location-image
922
- country=${this.country}
923
- city=${this.city}
924
- ></coras-location-image>
941
+ ${this.renderLocationSearchSelector()} ${this.renderLocationImage()}
925
942
  <div class="filters">
926
943
  ${this.renderDateSelector()} ${this.renderSortingSelectorDefault()}
927
944
  ${this.renderFiltersChip()}
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "engines": {
21
21
  "node": ">=22"
22
22
  },
23
- "version": "0.7.1",
23
+ "version": "0.8.1",
24
24
  "private": false,
25
25
  "homepage": "https://docs.coras.io",
26
26
  "bugs": {