@coras-io/embed 0.6.12 → 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.
Files changed (54) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/components/alert/alert.styles.js +4 -4
  3. package/dist/components/attraction-card/long/attraction-long-card.styles.js +1 -1
  4. package/dist/components/basket/basket.styles.js +2 -2
  5. package/dist/components/basket-item/basket-item.styles.js +2 -2
  6. package/dist/components/better-carousel/better-carousel.component.js +11 -7
  7. package/dist/components/better-carousel/better-carousel.styles.js +15 -5
  8. package/dist/components/breadcrumbs/breadcrumb-item/breadcrumb-item.styles.js +4 -0
  9. package/dist/components/button/button.styles.js +1 -1
  10. package/dist/components/calendar/base/calendar.mixin.js +7 -5
  11. package/dist/components/calendar/month/month.component.js +1 -1
  12. package/dist/components/calendar/multi/multi.component.js +3 -1
  13. package/dist/components/carousel/carousel.component.js +6 -2
  14. package/dist/components/carousel/carousel.styles.js +12 -2
  15. package/dist/components/checkbox-group/checkbox-group.styles.js +2 -2
  16. package/dist/components/dialog/dialog.styles.js +4 -0
  17. package/dist/components/drawer/drawer.styles.js +14 -6
  18. package/dist/components/filters-drawer/filters-drawer.styles.js +6 -4
  19. package/dist/components/icon/icon.styles.js +4 -0
  20. package/dist/components/image-viewer/image-viewer.styles.js +2 -2
  21. package/dist/components/input-field/input-field.styles.js +18 -17
  22. package/dist/components/locations-results/locations-results.styles.js +2 -1
  23. package/dist/components/mobile-menu-item/mobile-menu-item.styles.js +1 -1
  24. package/dist/components/seats-io/seats-io.component.js +4 -0
  25. package/dist/components/sport-options/sport-option/sport-option.styles.js +6 -6
  26. package/dist/components/tabs/tabs.component.js +4 -2
  27. package/dist/components/text-section/text-section.styles.js +2 -2
  28. package/dist/core/currency/constants.js +1 -1
  29. package/dist/core/currency/index.d.ts +7 -1
  30. package/dist/core/currency/index.js +11 -3
  31. package/dist/core/currency/saudi-riyal-font.d.ts +5 -0
  32. package/dist/core/currency/saudi-riyal-font.js +24 -0
  33. package/dist/core/i18n/date.d.ts +1 -1
  34. package/dist/core/i18n/date.js +3 -1
  35. package/dist/core/utils/direction.d.ts +6 -0
  36. package/dist/core/utils/direction.js +8 -0
  37. package/dist/core/utils/locale.d.ts +7 -0
  38. package/dist/core/utils/locale.js +12 -0
  39. package/dist/helpers/helpers.d.ts +1 -0
  40. package/dist/helpers/helpers.js +1 -0
  41. package/dist/mixins/base.mixin.js +12 -1
  42. package/dist/mixins/location-search/location-search.styles.js +3 -3
  43. package/dist/styles/tokens.d.ts +1 -1
  44. package/dist/styles/tokens.generated.d.ts +1 -1
  45. package/dist/styles/tokens.generated.js +1 -1
  46. package/dist/views/details-page/details-page.styles.js +8 -7
  47. package/dist/views/details-page/partials/location-highlights/location-highlights.styles.js +1 -1
  48. package/dist/views/help-page/help-page.styles.js +4 -4
  49. package/dist/views/payment-page/partials/confirmation/confirmation.styles.js +1 -1
  50. package/dist/views/payment-page/partials/stripe/stripe.utils.d.ts +3 -1
  51. package/dist/views/payment-page/partials/stripe/stripe.utils.js +4 -1
  52. package/dist/views/payment-page/payment-page.component.d.ts +4 -0
  53. package/dist/views/payment-page/payment-page.component.js +19 -6
  54. package/package.json +3 -3
@@ -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;
@@ -251,13 +251,13 @@ export default css `
251
251
 
252
252
  .divider {
253
253
  align-self: stretch;
254
- border-left: 1px solid var(--coras-color-neutral-100);
254
+ border-inline-start: 1px solid var(--coras-color-neutral-100);
255
255
  margin: 0 1rem;
256
256
  }
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
  }
@@ -351,7 +351,7 @@ export default css `
351
351
  flex-direction: column;
352
352
  gap: 0.75rem;
353
353
 
354
- padding-left: 1rem;
354
+ padding-inline-start: 1rem;
355
355
 
356
356
  li {
357
357
  color: var(--details-page-section-list-item-color);
@@ -487,7 +487,8 @@ export default css `
487
487
  .basket-modal-description {
488
488
  display: flex;
489
489
  flex-direction: column;
490
- padding: 0.125rem 2.125rem 0 0;
490
+ padding-block: 0.125rem 0;
491
+ padding-inline: 0 2.125rem;
491
492
  }
492
493
 
493
494
  .basket-modal-name {
@@ -552,7 +553,7 @@ export default css `
552
553
  }
553
554
  }
554
555
 
555
- @container --coras-layout (max-width: 800px) {
556
+ @container coras-layout (max-width: 800px) {
556
557
  coras-layout {
557
558
  .attraction-header {
558
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
  }
@@ -114,7 +114,7 @@ export default css `
114
114
 
115
115
  .info-numbered ol {
116
116
  counter-reset: section;
117
- padding-left: 1.25rem;
117
+ padding-inline-start: 1.25rem;
118
118
  margin: 0;
119
119
  }
120
120
 
@@ -122,16 +122,16 @@ export default css `
122
122
  counter-increment: section;
123
123
  list-style: none;
124
124
  position: relative;
125
- padding-left: 1rem;
125
+ padding-inline-start: 1rem;
126
126
  margin: 1rem 0;
127
127
  }
128
128
 
129
129
  .info-numbered ol > li::before {
130
130
  content: counter(section) ". ";
131
131
  position: absolute;
132
- left: -1.25rem;
132
+ inset-inline-start: -1.25rem;
133
133
  width: 1.25rem;
134
- text-align: right;
134
+ text-align: end;
135
135
  font-weight: var(--coras-font-weight-bold);
136
136
  }
137
137
 
@@ -43,7 +43,7 @@ export default css `
43
43
 
44
44
  .success-icon {
45
45
  color: var(--confirmation-success-icon-color);
46
- margin-right: 1rem;
46
+ margin-inline-end: 1rem;
47
47
  }
48
48
 
49
49
  .confirmation-title {
@@ -42,7 +42,9 @@ export declare function createStripeElementStyle(colors: ThemeColors): StripeEle
42
42
  */
43
43
  export declare function createPortalElement(className: string): HTMLElement;
44
44
  /**
45
- * Positions a portal element to match a placeholder's position.
45
+ * Positions a portal element to match a placeholder's position, and gives it
46
+ * the placeholder's text direction: the portal lives on `document.body`,
47
+ * outside the embed, so it would not inherit a right-to-left layout.
46
48
  *
47
49
  * The coordinates are document-relative, so a host page that scrolls the window
48
50
  * moves the portal with the document and every recomputed value is identical.
@@ -165,7 +165,9 @@ export function createPortalElement(className) {
165
165
  return portal;
166
166
  }
167
167
  /**
168
- * Positions a portal element to match a placeholder's position.
168
+ * Positions a portal element to match a placeholder's position, and gives it
169
+ * the placeholder's text direction: the portal lives on `document.body`,
170
+ * outside the embed, so it would not inherit a right-to-left layout.
169
171
  *
170
172
  * The coordinates are document-relative, so a host page that scrolls the window
171
173
  * moves the portal with the document and every recomputed value is identical.
@@ -181,6 +183,7 @@ export function createPortalElement(className) {
181
183
  export function positionPortalElement(placeholder, portal, zIndex, inlinePadding = 1) {
182
184
  if (!placeholder || !portal)
183
185
  return;
186
+ portal.dir = getComputedStyle(placeholder).direction;
184
187
  const rect = placeholder.getBoundingClientRect();
185
188
  // Hide portal if placeholder has no dimensions or is hidden
186
189
  if (rect.width === 0 || rect.height === 0) {
@@ -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.6.12",
23
+ "version": "0.7.1",
24
24
  "private": false,
25
25
  "homepage": "https://docs.coras.io",
26
26
  "bugs": {
@@ -107,7 +107,7 @@
107
107
  "typescript-eslint": "8.67.0",
108
108
  "vite": "8.2.2",
109
109
  "vitest": "4.1.11",
110
- "@coras-io/static": "0.0.6"
110
+ "@coras-io/static": "0.0.7"
111
111
  },
112
112
  "dependencies": {
113
113
  "@coinbase/cdp-core": "0.0.122",
@@ -125,7 +125,7 @@
125
125
  "lit": "^3.3.3",
126
126
  "openapi-fetch": "^0.17.0",
127
127
  "viem": "^2.55.19",
128
- "@coras-io/brand-tokens": "^0.6.0"
128
+ "@coras-io/brand-tokens": "^0.6.1"
129
129
  },
130
130
  "scripts": {
131
131
  "lint": "eslint \"src/**/*.ts*\"",