@coras-io/embed 0.6.0 → 0.6.2

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.
Files changed (62) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/components/better-carousel/better-carousel.component.d.ts +2 -1
  3. package/dist/components/better-carousel/better-carousel.component.js +2 -13
  4. package/dist/components/calendar/base/calendar.styles.js +3 -3
  5. package/dist/components/calendar/dual/dual.styles.js +1 -1
  6. package/dist/components/calendar/month/month.component.d.ts +1 -1
  7. package/dist/components/calendar/month/month.component.js +2 -1
  8. package/dist/components/calendar/multi/multi.component.d.ts +6 -0
  9. package/dist/components/calendar/multi/multi.component.js +10 -0
  10. package/dist/components/calendar/multi/multi.styles.js +19 -0
  11. package/dist/components/location-image/location-image.component.d.ts +4 -4
  12. package/dist/components/location-image/location-image.component.js +6 -6
  13. package/dist/components/star-rating/star-rating.styles.js +2 -2
  14. package/dist/core/images/srcset.js +2 -2
  15. package/dist/locales/ar-SA.d.ts +3 -0
  16. package/dist/locales/ar-SA.js +3 -0
  17. package/dist/locales/da-DK.d.ts +3 -0
  18. package/dist/locales/da-DK.js +3 -0
  19. package/dist/locales/de-DE.d.ts +3 -0
  20. package/dist/locales/de-DE.js +3 -0
  21. package/dist/locales/en-IE.d.ts +3 -0
  22. package/dist/locales/en-IE.js +3 -0
  23. package/dist/locales/en-US.d.ts +3 -0
  24. package/dist/locales/en-US.js +3 -0
  25. package/dist/locales/es-ES.d.ts +3 -0
  26. package/dist/locales/es-ES.js +3 -0
  27. package/dist/locales/fr-FR.d.ts +3 -0
  28. package/dist/locales/fr-FR.js +3 -0
  29. package/dist/locales/fr-MA.d.ts +3 -0
  30. package/dist/locales/fr-MA.js +3 -0
  31. package/dist/locales/is-IS.d.ts +3 -0
  32. package/dist/locales/is-IS.js +3 -0
  33. package/dist/locales/it-IT.d.ts +3 -0
  34. package/dist/locales/it-IT.js +3 -0
  35. package/dist/locales/ms-MY.d.ts +3 -0
  36. package/dist/locales/ms-MY.js +3 -0
  37. package/dist/locales/nb-NO.d.ts +3 -0
  38. package/dist/locales/nb-NO.js +3 -0
  39. package/dist/locales/pl-PL.d.ts +3 -0
  40. package/dist/locales/pl-PL.js +3 -0
  41. package/dist/locales/pt-PT.d.ts +3 -0
  42. package/dist/locales/pt-PT.js +3 -0
  43. package/dist/locales/sv-SE.d.ts +3 -0
  44. package/dist/locales/sv-SE.js +3 -0
  45. package/dist/locales/th-TH.d.ts +3 -0
  46. package/dist/locales/th-TH.js +3 -0
  47. package/dist/locales/tr-TR.d.ts +3 -0
  48. package/dist/locales/tr-TR.js +3 -0
  49. package/dist/locales/zh-CN.d.ts +3 -0
  50. package/dist/locales/zh-CN.js +3 -0
  51. package/dist/locales/zh-HK.d.ts +3 -0
  52. package/dist/locales/zh-HK.js +3 -0
  53. package/dist/mixins/overlay/overlay-mixin.js +5 -7
  54. package/dist/views/details-page/details-page.component.d.ts +2 -0
  55. package/dist/views/details-page/details-page.component.js +49 -17
  56. package/dist/views/details-page/details-page.styles.js +15 -0
  57. package/dist/views/details-page/details-page.utilts.d.ts +15 -0
  58. package/dist/views/details-page/details-page.utilts.js +21 -0
  59. package/dist/views/landing-page/landing-page.component.d.ts +4 -0
  60. package/dist/views/landing-page/landing-page.component.js +48 -25
  61. package/dist/views/landing-page/landing-page.styles.js +12 -2
  62. package/package.json +1 -1
@@ -275,7 +275,10 @@ export const templates = {
275
275
  's1515b0f2c5188380': str `Other ${0} highlights`,
276
276
  'sdc71496dfa9818bc': `Explore`,
277
277
  'sfc405bfeccadb01f': str `See what ${0} has to offer`,
278
+ 'sc46dc0eaf4635393': str `Minimum order of ${0} tickets`,
278
279
  's61d8ba5db13903be': str `${0} Tickets (${1} each)`,
280
+ 's0f0b8862bc3fc946': `This booking has a minimum number of tickets`,
281
+ 'se3dcb988c9854410': `Please add more tickets and try again`,
279
282
  'h12f3bd3a64c46efe': html `Good news! You’ve collected ${0} on this
280
283
  purchase.`,
281
284
  'h82c989f2494613fa': html `A verification code has been sent to ${0}. Enter the
@@ -269,7 +269,10 @@ export declare const templates: {
269
269
  s1515b0f2c5188380: import("@lit/localize").StrResult;
270
270
  sdc71496dfa9818bc: string;
271
271
  sfc405bfeccadb01f: import("@lit/localize").StrResult;
272
+ sc46dc0eaf4635393: import("@lit/localize").StrResult;
272
273
  s61d8ba5db13903be: import("@lit/localize").StrResult;
274
+ s0f0b8862bc3fc946: string;
275
+ se3dcb988c9854410: string;
273
276
  h12f3bd3a64c46efe: import("lit").TemplateResult<1>;
274
277
  h82c989f2494613fa: import("lit").TemplateResult<1>;
275
278
  hb3090d5e6b53fe7c: import("lit").TemplateResult<1>;
@@ -275,7 +275,10 @@ export const templates = {
275
275
  's1515b0f2c5188380': str `Other ${0} highlights`,
276
276
  'sdc71496dfa9818bc': `Explore`,
277
277
  'sfc405bfeccadb01f': str `See what ${0} has to offer`,
278
+ 'sc46dc0eaf4635393': str `Minimum order of ${0} tickets`,
278
279
  's61d8ba5db13903be': str `${0} Tickets (${1} each)`,
280
+ 's0f0b8862bc3fc946': `This booking has a minimum number of tickets`,
281
+ 'se3dcb988c9854410': `Please add more tickets and try again`,
279
282
  'h12f3bd3a64c46efe': html `Good news! You’ve collected ${0} on this
280
283
  purchase.`,
281
284
  'h82c989f2494613fa': html `A verification code has been sent to ${0}. Enter the
@@ -269,7 +269,10 @@ export declare const templates: {
269
269
  s1515b0f2c5188380: import("@lit/localize").StrResult;
270
270
  sdc71496dfa9818bc: string;
271
271
  sfc405bfeccadb01f: import("@lit/localize").StrResult;
272
+ sc46dc0eaf4635393: import("@lit/localize").StrResult;
272
273
  s61d8ba5db13903be: import("@lit/localize").StrResult;
274
+ s0f0b8862bc3fc946: string;
275
+ se3dcb988c9854410: string;
273
276
  h12f3bd3a64c46efe: import("lit").TemplateResult<1>;
274
277
  h82c989f2494613fa: import("lit").TemplateResult<1>;
275
278
  hb3090d5e6b53fe7c: import("lit").TemplateResult<1>;
@@ -275,7 +275,10 @@ export const templates = {
275
275
  's1515b0f2c5188380': str `Other ${0} highlights`,
276
276
  'sdc71496dfa9818bc': `Explore`,
277
277
  'sfc405bfeccadb01f': str `See what ${0} has to offer`,
278
+ 'sc46dc0eaf4635393': str `Minimum order of ${0} tickets`,
278
279
  's61d8ba5db13903be': str `${0} Tickets (${1} each)`,
280
+ 's0f0b8862bc3fc946': `This booking has a minimum number of tickets`,
281
+ 'se3dcb988c9854410': `Please add more tickets and try again`,
279
282
  'h12f3bd3a64c46efe': html `Good news! You’ve collected ${0} on this
280
283
  purchase.`,
281
284
  'h82c989f2494613fa': html `A verification code has been sent to ${0}. Enter the
@@ -269,7 +269,10 @@ export declare const templates: {
269
269
  s1515b0f2c5188380: import("@lit/localize").StrResult;
270
270
  sdc71496dfa9818bc: string;
271
271
  sfc405bfeccadb01f: import("@lit/localize").StrResult;
272
+ sc46dc0eaf4635393: import("@lit/localize").StrResult;
272
273
  s61d8ba5db13903be: import("@lit/localize").StrResult;
274
+ s0f0b8862bc3fc946: string;
275
+ se3dcb988c9854410: string;
273
276
  h12f3bd3a64c46efe: import("lit").TemplateResult<1>;
274
277
  h82c989f2494613fa: import("lit").TemplateResult<1>;
275
278
  hb3090d5e6b53fe7c: import("lit").TemplateResult<1>;
@@ -275,7 +275,10 @@ export const templates = {
275
275
  's1515b0f2c5188380': str `Other ${0} highlights`,
276
276
  'sdc71496dfa9818bc': `Explore`,
277
277
  'sfc405bfeccadb01f': str `See what ${0} has to offer`,
278
+ 'sc46dc0eaf4635393': str `Minimum order of ${0} tickets`,
278
279
  's61d8ba5db13903be': str `${0} Tickets (${1} each)`,
280
+ 's0f0b8862bc3fc946': `This booking has a minimum number of tickets`,
281
+ 'se3dcb988c9854410': `Please add more tickets and try again`,
279
282
  'h12f3bd3a64c46efe': html `Good news! You’ve collected ${0} on this
280
283
  purchase.`,
281
284
  'h82c989f2494613fa': html `A verification code has been sent to ${0}. Enter the
@@ -269,7 +269,10 @@ export declare const templates: {
269
269
  s1515b0f2c5188380: import("@lit/localize").StrResult;
270
270
  sdc71496dfa9818bc: string;
271
271
  sfc405bfeccadb01f: import("@lit/localize").StrResult;
272
+ sc46dc0eaf4635393: import("@lit/localize").StrResult;
272
273
  s61d8ba5db13903be: import("@lit/localize").StrResult;
274
+ s0f0b8862bc3fc946: string;
275
+ se3dcb988c9854410: string;
273
276
  h12f3bd3a64c46efe: import("lit").TemplateResult<1>;
274
277
  h82c989f2494613fa: import("lit").TemplateResult<1>;
275
278
  hb3090d5e6b53fe7c: import("lit").TemplateResult<1>;
@@ -275,7 +275,10 @@ export const templates = {
275
275
  's1515b0f2c5188380': str `Other ${0} highlights`,
276
276
  'sdc71496dfa9818bc': `Explore`,
277
277
  'sfc405bfeccadb01f': str `See what ${0} has to offer`,
278
+ 'sc46dc0eaf4635393': str `Minimum order of ${0} tickets`,
278
279
  's61d8ba5db13903be': str `${0} Tickets (${1} each)`,
280
+ 's0f0b8862bc3fc946': `This booking has a minimum number of tickets`,
281
+ 'se3dcb988c9854410': `Please add more tickets and try again`,
279
282
  'h12f3bd3a64c46efe': html `Good news! You’ve collected ${0} on this
280
283
  purchase.`,
281
284
  'h82c989f2494613fa': html `A verification code has been sent to ${0}. Enter the
@@ -30,12 +30,6 @@ export const OverlayMixin = (superClass) => {
30
30
  this._ownsScrollLock = true;
31
31
  }
32
32
  }
33
- handleAnimationStarted(event) {
34
- event.stopPropagation();
35
- if (this.open) {
36
- this.isVisible = true;
37
- }
38
- }
39
33
  handleAnimationEnded(event) {
40
34
  event.stopPropagation();
41
35
  if (!this.open) {
@@ -55,6 +49,11 @@ export const OverlayMixin = (superClass) => {
55
49
  if (changedProperties.has("open") && this.open) {
56
50
  this._previouslyFocused = (this.getRootNode()
57
51
  .activeElement ?? document.activeElement);
52
+ // The opening animation starts with this same render, so the overlay has
53
+ // to be visible for it. Waiting for the animation to report that it had
54
+ // started cost however long the page took to get there, and the viewer
55
+ // saw only the tail of the slide.
56
+ this.isVisible = true;
58
57
  }
59
58
  }
60
59
  updated(changedProperties) {
@@ -107,7 +106,6 @@ export const OverlayMixin = (superClass) => {
107
106
  return html `<coras-overlay
108
107
  ?open=${this.open}
109
108
  @click=${this.handleModalClosed}
110
- @overlay-animation-started=${this.handleAnimationStarted}
111
109
  @overlay-animation-ended=${this.handleAnimationEnded}
112
110
  ></coras-overlay>`;
113
111
  }
@@ -91,6 +91,7 @@ export declare class CorasDetailsPage extends CorasDetailsPage_base {
91
91
  private get resolvedDate();
92
92
  verifyDate: (firstInstanceDate: string, lastInstanceDate: string, timezone: string) => void;
93
93
  private checkDateAvailability;
94
+ private loadedAttractionId;
94
95
  private attractionTask;
95
96
  bookingSessionTask: Task<[], string | undefined>;
96
97
  private availabilityTask;
@@ -129,6 +130,7 @@ export declare class CorasDetailsPage extends CorasDetailsPage_base {
129
130
  private renderReservationPreviewModal;
130
131
  private renderDescription;
131
132
  private renderBasketModal;
133
+ private get availabilityErrorCode();
132
134
  private renderAvailabilityAlert;
133
135
  private renderSkeleton;
134
136
  render(): import("lit").TemplateResult<1>;
@@ -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, getTicketsAmount, getTicketSelectorLabel, getTotalTicketsCount, groupAvailabilityByTime, isSingleDayAvailability, resolveAttractionLocation, scrollToTop, sumPricesAndFormat, } from "./details-page.utilts.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";
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";
@@ -71,6 +71,9 @@ import { getApiLanguageCode } from "../../core/utils/locale.js";
71
71
  import { safeUrl } from "@coras-io/brand-tokens";
72
72
  const IMAGE_CAROUSEL_WIDTH = 480;
73
73
  const IMAGE_CAROUSEL_HEIGHT = 320;
74
+ // An availability check rejected for a supplier minimum the selection does not
75
+ // meet. The API reports the same refusal under two codes, by supplier.
76
+ const MINIMUM_TICKETS_ERROR_CODES = new Set([38, 39]);
74
77
  /**
75
78
  * @fires coras:navigate
76
79
  * @fires coras:state-change
@@ -186,6 +189,7 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
186
189
  if (signal.aborted) {
187
190
  return data;
188
191
  }
192
+ this.loadedAttractionId = attractionId;
189
193
  this.verifyDate(data.first_instance_date, data.last_instance_date, data.attraction.timezone);
190
194
  this.checkDateAvailability(data);
191
195
  try {
@@ -377,6 +381,10 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
377
381
  if (maxAmount !== null && count > 0 && totalTickets + count > maxAmount) {
378
382
  return;
379
383
  }
384
+ if (count < 0 &&
385
+ isBelowMinimumBookingSize(totalTickets + count, getMinBookingSize(this.attractionTask.value))) {
386
+ return;
387
+ }
380
388
  const newValue = currentValue + count;
381
389
  this.selectedPriceTypes = Object.fromEntries(Object.entries({
382
390
  ...this.selectedPriceTypes,
@@ -493,8 +501,9 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
493
501
  }
494
502
  if (apiResponse.attraction_type === "TOUR") {
495
503
  const response = apiResponse;
504
+ const minAmount = getMinBookingSize(response);
496
505
  return html `${map(items, ({ name, description, price_type_id }) => {
497
- const maxAmount = response?.attraction.max_booking_size || 5;
506
+ const maxAmount = response?.attraction.max_booking_size;
498
507
  const ticketAmount = this.selectedPriceTypes[price_type_id] || 0;
499
508
  const totalTickets = getTotalTicketsCount(this.selectedPriceTypes);
500
509
  return html `
@@ -507,7 +516,8 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
507
516
  slot="minus-button"
508
517
  assets-url="${this.assetsURL}"
509
518
  variant="minus"
510
- ?disabled=${ticketAmount <= 0}
519
+ ?disabled=${ticketAmount <= 0 ||
520
+ isBelowMinimumBookingSize(totalTickets - 1, minAmount)}
511
521
  @click=${() => this.changeTicketNumberBy(price_type_id, -1, maxAmount)}
512
522
  ></coras-tour-ticket-counter-button>
513
523
  <coras-tour-ticket-counter-button
@@ -559,6 +569,7 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
559
569
  }
560
570
  if (apiResponse.attraction_type === "TOUR") {
561
571
  const response = apiResponse;
572
+ const minAmount = getMinBookingSize(response);
562
573
  return html `
563
574
  <coras-tour-ticket-type-selector
564
575
  assets-url="${this.assetsURL}"
@@ -566,6 +577,11 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
566
577
  ?error=${this.hasAvailabilityError}
567
578
  >
568
579
  ${this.renderTicketSelectorItems(response.price_types ?? [], response)}
580
+ ${minAmount > 1
581
+ ? html `<p class="min-booking-hint" data-testid="min-booking-hint">
582
+ ${msg(str `Minimum order of ${minAmount} tickets`)}
583
+ </p>`
584
+ : nothing}
569
585
  </coras-tour-ticket-type-selector>
570
586
  `;
571
587
  }
@@ -893,11 +909,8 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
893
909
  `;
894
910
  }
895
911
  },
896
- error: (error) => {
897
- const body = error instanceof APIError
898
- ? error.response
899
- : undefined;
900
- if (body?.code === 37) {
912
+ error: () => {
913
+ if (this.availabilityErrorCode === 37) {
901
914
  return html `${msg("Please select the number of tickets.")}`;
902
915
  }
903
916
  // The availability alert already explains the failure.
@@ -1148,8 +1161,14 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
1148
1161
  if (!this.hasAvailabilityError) {
1149
1162
  return nothing;
1150
1163
  }
1151
- const title = msg("We're sorry, there are not enough tickets available for this event");
1152
- const description = msg("Please try a different date or number of tickets");
1164
+ const errorCode = this.availabilityErrorCode;
1165
+ const isBelowSupplierMinimum = errorCode !== undefined && MINIMUM_TICKETS_ERROR_CODES.has(errorCode);
1166
+ const title = isBelowSupplierMinimum
1167
+ ? msg("This booking has a minimum number of tickets")
1168
+ : msg("We're sorry, there are not enough tickets available for this event");
1169
+ const description = isBelowSupplierMinimum
1170
+ ? msg("Please add more tickets and try again")
1171
+ : msg("Please try a different date or number of tickets");
1153
1172
  return html `
1154
1173
  <coras-alert
1155
1174
  assets-url=${this.assetsURL}
@@ -1176,6 +1195,9 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
1176
1195
  }
1177
1196
  willUpdate(changedProperties) {
1178
1197
  super.willUpdate(changedProperties);
1198
+ if (changedProperties.has("attractionId")) {
1199
+ this.resetAvailabilityState();
1200
+ }
1179
1201
  const attraction = this.attractionTask.value;
1180
1202
  this.isSingleDayAvailability = attraction
1181
1203
  ? isSingleDayAvailability(attraction.attraction.sale_periods ?? null)
@@ -1189,11 +1211,17 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
1189
1211
  : [];
1190
1212
  this.selectDefaultTicket(attraction);
1191
1213
  }
1192
- // One ticket of the first price type is preselected whenever nothing is
1193
- // selected, so the availability check can run straight away.
1214
+ // The smallest bookable number of tickets of the first price type is
1215
+ // preselected whenever nothing is selected, so the availability check can
1216
+ // run straight away against a selection the supplier will accept. Lit runs
1217
+ // willUpdate before the task controller sees the new id, so the task still
1218
+ // holds the previous attraction here: seeding from that would block the
1219
+ // incoming attraction's own default.
1194
1220
  selectDefaultTicket(attraction) {
1195
1221
  const firstPriceType = attraction?.price_types?.[0];
1196
- if (!firstPriceType || Object.keys(this.selectedPriceTypes).length > 0) {
1222
+ if (!firstPriceType ||
1223
+ this.loadedAttractionId !== this.attractionId ||
1224
+ Object.keys(this.selectedPriceTypes).length > 0) {
1197
1225
  return;
1198
1226
  }
1199
1227
  const maxAmount = attraction.attraction_type === "TOUR"
@@ -1201,7 +1229,7 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
1201
1229
  .max_booking_size
1202
1230
  : attraction.attraction
1203
1231
  .max_tickets_per_order;
1204
- this.changeTicketNumberBy(firstPriceType.price_type_id, 1, maxAmount);
1232
+ this.changeTicketNumberBy(firstPriceType.price_type_id, getMinBookingSize(attraction), maxAmount);
1205
1233
  }
1206
1234
  updated(changedProperties) {
1207
1235
  super.updated(changedProperties);
@@ -1216,9 +1244,6 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
1216
1244
  void this.availabilityTask.run();
1217
1245
  }
1218
1246
  }
1219
- if (changedProperties.has("attractionId")) {
1220
- this.resetAvailabilityState();
1221
- }
1222
1247
  }
1223
1248
  resetAvailabilityState() {
1224
1249
  this.currentMonth = undefined;
@@ -1500,6 +1525,13 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
1500
1525
  scrollToTop();
1501
1526
  }
1502
1527
  }
1528
+ get availabilityErrorCode() {
1529
+ const error = this.availabilityTask.error;
1530
+ if (!(error instanceof APIError)) {
1531
+ return undefined;
1532
+ }
1533
+ return error.response?.code;
1534
+ }
1503
1535
  renderSkeleton() {
1504
1536
  return html `
1505
1537
  <div class="details-skeleton" aria-hidden="true">
@@ -75,6 +75,12 @@ export default css `
75
75
  );
76
76
  --details-page-ticket-availability-caption-color: var(--coras-color-text);
77
77
 
78
+ --details-page-min-booking-hint-font-size: var(--coras-font-size-sm);
79
+ --details-page-min-booking-hint-font-weight: var(
80
+ --coras-font-weight-normal
81
+ );
82
+ --details-page-min-booking-hint-color: var(--coras-color-text-muted);
83
+
78
84
  --details-page-date-field-open-chevron-color: var(--coras-color-primary);
79
85
  --details-page-ticket-availability-caption-font-size-mobile: var(
80
86
  --coras-font-size-sm
@@ -192,6 +198,15 @@ export default css `
192
198
 
193
199
  coras-tour-ticket-type-selector {
194
200
  margin-bottom: 1.5rem;
201
+
202
+ .min-booking-hint {
203
+ margin: 0;
204
+ padding: 0 1rem 0.5rem;
205
+ text-align: left;
206
+ font-size: var(--details-page-min-booking-hint-font-size);
207
+ font-weight: var(--details-page-min-booking-hint-font-weight);
208
+ color: var(--details-page-min-booking-hint-color);
209
+ }
195
210
  }
196
211
 
197
212
  #calendar-dropdown {
@@ -98,3 +98,18 @@ export type AttractionLocationSummary = {
98
98
  * code, so both are resolved here.
99
99
  */
100
100
  export declare const resolveAttractionLocation: (location: components["schemas"]["AttractionLocation"] | null | undefined) => AttractionLocationSummary | null;
101
+ /**
102
+ * The smallest bookable ticket total for an attraction.
103
+ *
104
+ * Only a tour carries a supplier minimum (`min_booking_size`). Everything
105
+ * else, and a tour whose minimum is absent or meaningless, returns 1, so a
106
+ * caller can apply the floor unconditionally.
107
+ */
108
+ export declare const getMinBookingSize: (apiResponse: components["schemas"]["AttractionEvent"] | components["schemas"]["AttractionTour"] | undefined) => number;
109
+ /**
110
+ * Whether a ticket total is short of the minimum without being empty.
111
+ *
112
+ * An empty selection stays valid: the floor blocks the totals between one
113
+ * ticket and the minimum, not the visitor clearing the selector.
114
+ */
115
+ export declare const isBelowMinimumBookingSize: (totalTickets: number, minBookingSize: number) => boolean;
@@ -234,3 +234,24 @@ export const resolveAttractionLocation = (location) => {
234
234
  countryCode: country?.code ?? "",
235
235
  };
236
236
  };
237
+ /**
238
+ * The smallest bookable ticket total for an attraction.
239
+ *
240
+ * Only a tour carries a supplier minimum (`min_booking_size`). Everything
241
+ * else, and a tour whose minimum is absent or meaningless, returns 1, so a
242
+ * caller can apply the floor unconditionally.
243
+ */
244
+ export const getMinBookingSize = (apiResponse) => {
245
+ if (apiResponse?.attraction_type !== "TOUR") {
246
+ return 1;
247
+ }
248
+ const minBookingSize = apiResponse.attraction.min_booking_size;
249
+ return minBookingSize > 1 ? minBookingSize : 1;
250
+ };
251
+ /**
252
+ * Whether a ticket total is short of the minimum without being empty.
253
+ *
254
+ * An empty selection stays valid: the floor blocks the totals between one
255
+ * ticket and the minimum, not the visitor clearing the selector.
256
+ */
257
+ export const isBelowMinimumBookingSize = (totalTickets, minBookingSize) => totalTickets > 0 && totalTickets < minBookingSize;
@@ -65,15 +65,19 @@ export declare class CorasLandingPage extends CorasLandingPage_base {
65
65
  private selectedPriceOptions;
66
66
  private selectedDurationOptions;
67
67
  private _selectedCategories;
68
+ private drawerCalendar?;
68
69
  private resizeObserver;
69
70
  private lastSavedRecentValue;
70
71
  protected firstUpdated(changed: PropertyValues): void;
71
72
  private locateAndObserveResize;
72
73
  disconnectedCallback(): void;
74
+ protected willUpdate(changedProperties: PropertyValues<this>): void;
73
75
  protected updated(changedProperties: PropertyValues<this>): void;
74
76
  private get appliedDurationOptions();
75
77
  private get appliedCategorySlugs();
76
78
  private toggleDateFilter;
79
+ private seedPickerFromApplied;
80
+ private syncSelectedDatesToApplied;
77
81
  handleCalendarMonthChange(event: CustomEvent): void;
78
82
  setSelectedDates(event: CustomEvent): void;
79
83
  private geolocationTask;
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  import { html, LitElement, nothing, } from "lit";
8
8
  import { when } from "lit/directives/when.js";
9
- import { property, state } from "lit/decorators.js";
9
+ import { property, query, state } from "lit/decorators.js";
10
10
  import { msg, localized } from "@lit/localize";
11
11
  import { Task } from "@lit/task";
12
12
  import { consume } from "@lit/context";
@@ -68,10 +68,7 @@ let CorasLandingPage = class CorasLandingPage extends ErrorModalMixin(PointsMixi
68
68
  this.isSortingSelectorOpen = false;
69
69
  this.isFiltersDrawerOpened = false;
70
70
  this.selectedMonth = format(new Date(), "yyyy-MM");
71
- this.selectedDates = [
72
- this.startDate,
73
- this.endDate,
74
- ];
71
+ this.selectedDates = ["", ""];
75
72
  // The filters drawer's working selection, reactive so clearing or re-syncing
76
73
  // it from the applied params repaints the checkboxes.
77
74
  this.selectedPriceOptions = [];
@@ -197,6 +194,25 @@ let CorasLandingPage = class CorasLandingPage extends ErrorModalMixin(PointsMixi
197
194
  super.disconnectedCallback();
198
195
  this.resizeObserver?.disconnect();
199
196
  }
197
+ willUpdate(changedProperties) {
198
+ super.willUpdate(changedProperties);
199
+ if (changedProperties.has("startDate") ||
200
+ changedProperties.has("endDate")) {
201
+ this.syncSelectedDatesToApplied();
202
+ if (this.startDate !== "") {
203
+ this.selectedMonth = format(parseISO(this.startDate), "yyyy-MM");
204
+ }
205
+ }
206
+ if (changedProperties.has("duration")) {
207
+ this.selectedDurationOptions = this.appliedDurationOptions;
208
+ }
209
+ if (changedProperties.has("price")) {
210
+ this.selectedPriceOptions = this.price ? [this.price] : [];
211
+ }
212
+ if (changedProperties.has("categories")) {
213
+ this._selectedCategories = this.categories;
214
+ }
215
+ }
200
216
  updated(changedProperties) {
201
217
  super.updated(changedProperties);
202
218
  if (getLocale() !== this.locale) {
@@ -226,22 +242,6 @@ let CorasLandingPage = class CorasLandingPage extends ErrorModalMixin(PointsMixi
226
242
  catch { }
227
243
  }
228
244
  }
229
- if (changedProperties.has("startDate") ||
230
- changedProperties.has("endDate")) {
231
- this.selectedDates = [this.startDate, this.endDate];
232
- if (this.startDate !== "") {
233
- this.selectedMonth = format(parseISO(this.startDate), "yyyy-MM");
234
- }
235
- }
236
- if (changedProperties.has("duration")) {
237
- this.selectedDurationOptions = this.appliedDurationOptions;
238
- }
239
- if (changedProperties.has("price")) {
240
- this.selectedPriceOptions = this.price ? [this.price] : [];
241
- }
242
- if (changedProperties.has("categories")) {
243
- this._selectedCategories = this.categories;
244
- }
245
245
  }
246
246
  get appliedDurationOptions() {
247
247
  return this.duration ? this.duration.split(",").filter(Boolean) : [];
@@ -251,6 +251,25 @@ let CorasLandingPage = class CorasLandingPage extends ErrorModalMixin(PointsMixi
251
251
  }
252
252
  toggleDateFilter() {
253
253
  this.isDateFilterOpen = !this.isDateFilterOpen;
254
+ if (this.isDateFilterOpen) {
255
+ this.seedPickerFromApplied();
256
+ // The drawer owns the scroll container, so the month can only be brought
257
+ // into view once this update has put the picker on screen.
258
+ void this.updateComplete.then(() => this.drawerCalendar?.scrollToSelectedMonth());
259
+ }
260
+ }
261
+ // A picker selection only reaches the page on Done, so re-seeding on open is
262
+ // what stops an abandoned one, and the month it was browsed in, from coming back.
263
+ seedPickerFromApplied() {
264
+ this.syncSelectedDatesToApplied();
265
+ const [appliedStart] = this.selectedDates;
266
+ this.selectedMonth = format(appliedStart ? parseISO(appliedStart) : new Date(), "yyyy-MM");
267
+ }
268
+ syncSelectedDatesToApplied() {
269
+ this.selectedDates = [
270
+ this.startDate || this.endDate,
271
+ this.endDate || this.startDate,
272
+ ];
254
273
  }
255
274
  handleCalendarMonthChange(event) {
256
275
  this.selectedMonth = event.detail.date;
@@ -263,7 +282,6 @@ let CorasLandingPage = class CorasLandingPage extends ErrorModalMixin(PointsMixi
263
282
  else {
264
283
  this.selectedDates = [event.detail.date];
265
284
  }
266
- this.requestUpdate();
267
285
  }
268
286
  renderDateRangeLabel() {
269
287
  const label = getDateRangeLabel(this.startDate, this.endDate, this.locale) ||
@@ -341,15 +359,14 @@ let CorasLandingPage = class CorasLandingPage extends ErrorModalMixin(PointsMixi
341
359
  }
342
360
  handleDatesClearIconClicked(event) {
343
361
  event.stopPropagation();
344
- this.selectedDates = [""];
362
+ this.selectedDates = ["", ""];
345
363
  this.dispatchPageUpdate({
346
364
  startDate: "",
347
365
  endDate: "",
348
366
  });
349
367
  }
350
368
  handleDatesResetBtnClicked() {
351
- this.selectedDates = [""];
352
- this.isDateFilterOpen = false;
369
+ this.selectedDates = ["", ""];
353
370
  this.dispatchPageUpdate({
354
371
  startDate: "",
355
372
  endDate: "",
@@ -973,6 +990,9 @@ __decorate([
973
990
  __decorate([
974
991
  state()
975
992
  ], CorasLandingPage.prototype, "isFiltersDrawerOpened", void 0);
993
+ __decorate([
994
+ state()
995
+ ], CorasLandingPage.prototype, "selectedDates", void 0);
976
996
  __decorate([
977
997
  state()
978
998
  ], CorasLandingPage.prototype, "selectedPriceOptions", void 0);
@@ -982,6 +1002,9 @@ __decorate([
982
1002
  __decorate([
983
1003
  state()
984
1004
  ], CorasLandingPage.prototype, "_selectedCategories", void 0);
1005
+ __decorate([
1006
+ query("coras-multi-month-calendar")
1007
+ ], CorasLandingPage.prototype, "drawerCalendar", void 0);
985
1008
  CorasLandingPage = __decorate([
986
1009
  localized()
987
1010
  ], CorasLandingPage);
@@ -14,7 +14,7 @@ export default css `
14
14
  .sk-section {
15
15
  display: flex;
16
16
  flex-direction: column;
17
- gap: 1.25rem;
17
+ gap: 1rem;
18
18
  }
19
19
 
20
20
  .sk-title {
@@ -105,20 +105,30 @@ export default css `
105
105
  }
106
106
 
107
107
  section {
108
+ &:not(:first-of-type) {
109
+ margin-block-start: 2.5rem;
110
+ }
111
+
108
112
  .section-header {
109
113
  display: flex;
110
114
  align-items: center;
111
115
  gap: 1rem;
116
+ margin-block-end: 1rem;
112
117
  font-weight: 600;
113
118
  font-size: calc(22px * var(--coras-brand-heading-scale));
114
119
  line-height: 30px;
115
120
  letter-spacing: 0.2px;
121
+
122
+ h3 {
123
+ margin-block: 0;
124
+ }
116
125
  }
117
126
 
118
127
  .cards {
119
128
  display: grid;
120
129
  grid-template-columns: repeat(4, 1fr);
121
- gap: 1rem;
130
+ column-gap: 1.25rem;
131
+ row-gap: 1.5rem;
122
132
 
123
133
  .show-more-button {
124
134
  visibility: hidden;
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "engines": {
21
21
  "node": ">=22"
22
22
  },
23
- "version": "0.6.0",
23
+ "version": "0.6.2",
24
24
  "private": false,
25
25
  "homepage": "https://docs.coras.io",
26
26
  "bugs": {