@coras-io/embed 0.7.0 → 0.7.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,14 @@
1
1
  # @coras-io/embed
2
2
 
3
+ ## 0.7.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 745ccef: Show the details page highlights in the landing page's card layout on smaller screens, with wide images instead of oversized squares
8
+ - 60c850d: Send the customer back to the event when they try again after a failed card payment, instead of re-submitting to a cancelled payment
9
+ - 681bb0c: Stop the seat map letting shoppers select seats that are sold or unavailable
10
+ - ef018d1: Keep the navbar basket count and currency selector in step with the basket; the count stayed at zero after the page mounted however many items were reserved
11
+
3
12
  ## 0.7.0
4
13
 
5
14
  ### Minor Changes
@@ -106,6 +106,9 @@ export class CorasSeatsIO extends LitElement {
106
106
  objectCategories,
107
107
  pricing,
108
108
  selectableObjects,
109
+ // Seats Coras has no availability for get no category, so no price, and
110
+ // seats.io keeps unpriced seats selectable despite selectableObjects.
111
+ objectWithoutPricingSelectable: false,
109
112
  selectedObjects: this.selectedObjects,
110
113
  ...(this.maxSelectedObjects
111
114
  ? { maxSelectedObjects: this.maxSelectedObjects }
@@ -11,7 +11,7 @@ import { supportedCurrencies } from "../core/currency/constants.js";
11
11
  import { registerSaudiRiyalFont } from "../core/currency/saudi-riyal-font.js";
12
12
  import { allLocales } from "../core/i18n/locale-codes.js";
13
13
  import { getTextDirection } from "../core/utils/locale.js";
14
- import { provide } from "@lit/context";
14
+ import { ContextRoot, provide } from "@lit/context";
15
15
  import { clientContext } from "../contexts/client.context.js";
16
16
  import { pageDispatchContext, } from "../contexts/events.context.js";
17
17
  import { fireEvent } from "../core/events.js";
@@ -36,6 +36,9 @@ export const BaseMixin = (superClass) => {
36
36
  // through markup, so the default stays silent until `mount` wires one.
37
37
  this.logger = NOOP_LOGGER;
38
38
  this._pageDispatch = this.dispatchPageUpdate.bind(this);
39
+ // Replays context requests that arrive before their provider renders
40
+ // inside this page's shadow DOM. See docs/ARCHITECTURE.md.
41
+ new ContextRoot().attach(this);
39
42
  }
40
43
  getPageProperties() {
41
44
  return {};
@@ -29,7 +29,7 @@ export default css `
29
29
  gap: 2.5rem;
30
30
  width: 100%;
31
31
 
32
- @container --coras-layout (max-width: 800px) {
32
+ @container coras-layout (max-width: 800px) {
33
33
  grid-template-columns: 1fr;
34
34
  }
35
35
  }
@@ -133,7 +133,7 @@ export default css `
133
133
 
134
134
  coras-layout {
135
135
  container-type: inline-size;
136
- container-name: --coras-layout;
136
+ container-name: coras-layout;
137
137
 
138
138
  coras-breadcrumbs {
139
139
  display: block;
@@ -257,7 +257,7 @@ export default css `
257
257
  }
258
258
  }
259
259
 
260
- @container --coras-layout (max-width: 800px) {
260
+ @container coras-layout (max-width: 800px) {
261
261
  .attraction-header {
262
262
  grid-template-columns: 1fr;
263
263
  }
@@ -553,7 +553,7 @@ export default css `
553
553
  }
554
554
  }
555
555
 
556
- @container --coras-layout (max-width: 800px) {
556
+ @container coras-layout (max-width: 800px) {
557
557
  coras-layout {
558
558
  .attraction-header {
559
559
  height: auto;
@@ -28,7 +28,7 @@ export default css `
28
28
  }
29
29
  }
30
30
 
31
- @container (max-width: 800px) {
31
+ @container (max-width: 1000px) {
32
32
  :host .cards {
33
33
  grid-template-columns: repeat(2, 1fr);
34
34
  }
@@ -214,6 +214,10 @@ export declare class CorasPaymentPage extends CorasPaymentPage_base {
214
214
  * Handles API errors by mapping them to form fields
215
215
  */
216
216
  private handleApiErrors;
217
+ /**
218
+ * The failed transaction consumed both the booking session and the
219
+ * PaymentIntent, so a retry has to start a new booking from the event.
220
+ */
217
221
  private handleTryAgain;
218
222
  /**
219
223
  * Dispatches the coras:payment-status event with a failed status.
@@ -32,6 +32,7 @@ import styles from "./payment-page.styles.js";
32
32
  import "../../components/bottom-drawer/bottom-drawer.js";
33
33
  import "../../components/expiration-timer/expiration-timer.js";
34
34
  import { Task, TaskStatus } from "@lit/task";
35
+ import { formatISO, parseISO } from "date-fns";
35
36
  import { FIELDS } from "./payment-page.fields.js";
36
37
  import "./partials/stripe/stripe.js";
37
38
  import "./partials/country-field/country-field.js";
@@ -1277,6 +1278,8 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
1277
1278
  this.redirectToConfirmation(true);
1278
1279
  }
1279
1280
  else if (isFinalStatus(status)) {
1281
+ // The API cancels the PaymentIntent with the transaction, so it cannot be confirmed again
1282
+ this.pendingClientSecret = null;
1280
1283
  this.logger.error("Transaction failed with status:", status);
1281
1284
  this.flowController.transition("failed");
1282
1285
  this.redirectToConfirmation(false);
@@ -1316,13 +1319,23 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
1316
1319
  }
1317
1320
  void this.updateComplete.then(() => this.scrollToFirstError());
1318
1321
  }
1322
+ /**
1323
+ * The failed transaction consumed both the booking session and the
1324
+ * PaymentIntent, so a retry has to start a new booking from the event.
1325
+ */
1319
1326
  handleTryAgain() {
1320
- // Reset submit state so the user can re-submit
1321
- this.flowController.retry();
1322
- this.paymentFailed = false;
1323
- this.formController.formErrors = {};
1324
- this.stripeController.clearAllErrors();
1325
- this.requestUpdate();
1327
+ const [reservation] = this.reservationsTask.value?.reservations ?? [];
1328
+ if (!reservation) {
1329
+ this.dispatchPageUpdate({ page: "landing" });
1330
+ return;
1331
+ }
1332
+ this.dispatchPageUpdate({
1333
+ page: "details",
1334
+ id: reservation.attraction_id,
1335
+ date: formatISO(parseISO(reservation.start_datetime), {
1336
+ representation: "date",
1337
+ }),
1338
+ });
1326
1339
  }
1327
1340
  /**
1328
1341
  * Dispatches the coras:payment-status event with a failed status.
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "engines": {
21
21
  "node": ">=22"
22
22
  },
23
- "version": "0.7.0",
23
+ "version": "0.7.1",
24
24
  "private": false,
25
25
  "homepage": "https://docs.coras.io",
26
26
  "bugs": {