@voyant-travel/cruises-react 0.118.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 (100) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +70 -0
  3. package/dist/client.d.ts +14 -0
  4. package/dist/client.d.ts.map +1 -0
  5. package/dist/client.js +59 -0
  6. package/dist/components/cruise-catalog-card.d.ts +13 -0
  7. package/dist/components/cruise-catalog-card.d.ts.map +1 -0
  8. package/dist/components/cruise-catalog-card.js +58 -0
  9. package/dist/components/enrichment-program-list.d.ts +13 -0
  10. package/dist/components/enrichment-program-list.d.ts.map +1 -0
  11. package/dist/components/enrichment-program-list.js +45 -0
  12. package/dist/components/external-badge.d.ts +14 -0
  13. package/dist/components/external-badge.d.ts.map +1 -0
  14. package/dist/components/external-badge.js +17 -0
  15. package/dist/components/pricing-grid.d.ts +21 -0
  16. package/dist/components/pricing-grid.d.ts.map +1 -0
  17. package/dist/components/pricing-grid.js +81 -0
  18. package/dist/components/quote-display.d.ts +14 -0
  19. package/dist/components/quote-display.d.ts.map +1 -0
  20. package/dist/components/quote-display.js +61 -0
  21. package/dist/hooks/index.d.ts +15 -0
  22. package/dist/hooks/index.d.ts.map +1 -0
  23. package/dist/hooks/index.js +14 -0
  24. package/dist/hooks/use-cruise-booking.d.ts +205 -0
  25. package/dist/hooks/use-cruise-booking.d.ts.map +1 -0
  26. package/dist/hooks/use-cruise-booking.js +56 -0
  27. package/dist/hooks/use-cruise-mutation.d.ts +144 -0
  28. package/dist/hooks/use-cruise-mutation.d.ts.map +1 -0
  29. package/dist/hooks/use-cruise-mutation.js +58 -0
  30. package/dist/hooks/use-cruise.d.ts +38 -0
  31. package/dist/hooks/use-cruise.d.ts.map +1 -0
  32. package/dist/hooks/use-cruise.js +16 -0
  33. package/dist/hooks/use-cruises.d.ts +61 -0
  34. package/dist/hooks/use-cruises.d.ts.map +1 -0
  35. package/dist/hooks/use-cruises.js +16 -0
  36. package/dist/hooks/use-effective-itinerary.d.ts +27 -0
  37. package/dist/hooks/use-effective-itinerary.d.ts.map +1 -0
  38. package/dist/hooks/use-effective-itinerary.js +16 -0
  39. package/dist/hooks/use-enrichment.d.ts +72 -0
  40. package/dist/hooks/use-enrichment.d.ts.map +1 -0
  41. package/dist/hooks/use-enrichment.js +64 -0
  42. package/dist/hooks/use-external-actions.d.ts +43 -0
  43. package/dist/hooks/use-external-actions.d.ts.map +1 -0
  44. package/dist/hooks/use-external-actions.js +45 -0
  45. package/dist/hooks/use-pricing.d.ts +65 -0
  46. package/dist/hooks/use-pricing.d.ts.map +1 -0
  47. package/dist/hooks/use-pricing.js +28 -0
  48. package/dist/hooks/use-sailing-mutation.d.ts +147 -0
  49. package/dist/hooks/use-sailing-mutation.d.ts.map +1 -0
  50. package/dist/hooks/use-sailing-mutation.js +55 -0
  51. package/dist/hooks/use-sailings.d.ts +49 -0
  52. package/dist/hooks/use-sailings.d.ts.map +1 -0
  53. package/dist/hooks/use-sailings.js +20 -0
  54. package/dist/hooks/use-search-index.d.ts +43 -0
  55. package/dist/hooks/use-search-index.d.ts.map +1 -0
  56. package/dist/hooks/use-search-index.js +51 -0
  57. package/dist/hooks/use-ship-mutation.d.ts +186 -0
  58. package/dist/hooks/use-ship-mutation.d.ts.map +1 -0
  59. package/dist/hooks/use-ship-mutation.js +92 -0
  60. package/dist/hooks/use-ships.d.ts +101 -0
  61. package/dist/hooks/use-ships.d.ts.map +1 -0
  62. package/dist/hooks/use-ships.js +43 -0
  63. package/dist/hooks/use-storefront.d.ts +230 -0
  64. package/dist/hooks/use-storefront.d.ts.map +1 -0
  65. package/dist/hooks/use-storefront.js +62 -0
  66. package/dist/i18n/en.d.ts +3 -0
  67. package/dist/i18n/en.d.ts.map +1 -0
  68. package/dist/i18n/en.js +79 -0
  69. package/dist/i18n/index.d.ts +5 -0
  70. package/dist/i18n/index.d.ts.map +1 -0
  71. package/dist/i18n/index.js +3 -0
  72. package/dist/i18n/messages.d.ts +62 -0
  73. package/dist/i18n/messages.d.ts.map +1 -0
  74. package/dist/i18n/messages.js +1 -0
  75. package/dist/i18n/provider.d.ts +26 -0
  76. package/dist/i18n/provider.d.ts.map +1 -0
  77. package/dist/i18n/provider.js +44 -0
  78. package/dist/i18n/ro.d.ts +3 -0
  79. package/dist/i18n/ro.d.ts.map +1 -0
  80. package/dist/i18n/ro.js +79 -0
  81. package/dist/index.d.ts +7 -0
  82. package/dist/index.d.ts.map +1 -0
  83. package/dist/index.js +6 -0
  84. package/dist/provider.d.ts +2 -0
  85. package/dist/provider.d.ts.map +1 -0
  86. package/dist/provider.js +1 -0
  87. package/dist/query-keys.d.ts +82 -0
  88. package/dist/query-keys.d.ts.map +1 -0
  89. package/dist/query-keys.js +39 -0
  90. package/dist/query-options.d.ts +1272 -0
  91. package/dist/query-options.d.ts.map +1 -0
  92. package/dist/query-options.js +136 -0
  93. package/dist/schemas.d.ts +1061 -0
  94. package/dist/schemas.d.ts.map +1 -0
  95. package/dist/schemas.js +339 -0
  96. package/dist/ui.d.ts +6 -0
  97. package/dist/ui.d.ts.map +1 -0
  98. package/dist/ui.js +5 -0
  99. package/package.json +121 -0
  100. package/src/styles.css +11 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may accept and charge a
167
+ fee for, the acceptance of support, warranty, indemnity, or
168
+ other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 PixelMakers Studio SRL
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,70 @@
1
+ # @voyant-travel/cruises-react
2
+
3
+ The cruises client tier: headless data hooks/clients plus the styled UI
4
+ components (formerly `@voyant-travel/cruises-ui`).
5
+
6
+ Headless consumers (storefronts, portals) import from the root, `./hooks`,
7
+ `./client`, or `./query-keys` — these pull no styling peers. Styled surfaces
8
+ live under `./ui`, `./components/*`, `./i18n`, and `./styles.css`, whose
9
+ heavier peers (`@voyant-travel/ui`, `@voyant-travel/catalog-react`) are optional and
10
+ only needed when you import those subpaths.
11
+
12
+ React Query hooks + Zod-validated fetch client for the Voyant cruises module.
13
+
14
+ Mirrors the convention used by `@voyant-travel/relationships-react` and `@voyant-travel/inventory-react`.
15
+
16
+ ## Quickstart
17
+
18
+ ```tsx
19
+ import { VoyantCruisesProvider } from "@voyant-travel/cruises-react/provider"
20
+ import { useStorefrontCruises } from "@voyant-travel/cruises-react"
21
+
22
+ function App() {
23
+ return (
24
+ <VoyantCruisesProvider baseUrl="/api">
25
+ <CruiseGrid />
26
+ </VoyantCruisesProvider>
27
+ )
28
+ }
29
+
30
+ function CruiseGrid() {
31
+ const { data, isLoading } = useStorefrontCruises({ cruiseType: "expedition" })
32
+ if (isLoading) return <p>Loading…</p>
33
+ return (
34
+ <ul>
35
+ {data?.data.map((c) => <li key={c.id}>{c.name}</li>)}
36
+ </ul>
37
+ )
38
+ }
39
+ ```
40
+
41
+ See `docs/architecture/cruises-module.md` in the monorepo root for the full module design.
42
+
43
+ ## UI components
44
+
45
+ Importable React UI components for Voyant cruises. Bundler-consumed (Vite, Next.js, webpack, etc.).
46
+
47
+ ### Install
48
+
49
+ ```bash
50
+ pnpm add @voyant-travel/cruises-react @voyant-travel/ui @tanstack/react-query react react-dom
51
+ ```
52
+
53
+ `@voyant-travel/ui` provides the design-system primitives and is required when you
54
+ import the styled subpaths (`./ui`, `./components/*`).
55
+
56
+ All components accept a `className` prop and merge it with `cn()`. Wrap or compose to extend; use the registry copy-paste path (`npx shadcn add @voyant/...`) for components you want to fork outright.
57
+
58
+ ### I18n
59
+
60
+ Components render English by default. To localize them, wrap your UI in
61
+ `CruisesUiMessagesProvider` and import only the locales your app supports.
62
+
63
+ ```tsx
64
+ import { CruisesUiMessagesProvider } from "@voyant-travel/cruises-react/ui"
65
+ import { cruisesUiEn } from "@voyant-travel/cruises-react/i18n/en"
66
+ import { cruisesUiRo } from "@voyant-travel/cruises-react/i18n/ro"
67
+ ```
68
+
69
+ English-only apps should import only `./i18n/en`. Bilingual apps can import
70
+ `./i18n/en` and `./i18n/ro`.
@@ -0,0 +1,14 @@
1
+ import type { z } from "zod";
2
+ export type VoyantFetcher = (url: string, init?: RequestInit) => Promise<Response>;
3
+ export declare const defaultFetcher: VoyantFetcher;
4
+ export declare class VoyantApiError extends Error {
5
+ readonly status: number;
6
+ readonly body: unknown;
7
+ constructor(message: string, status: number, body: unknown);
8
+ }
9
+ export interface FetchWithValidationOptions {
10
+ baseUrl: string;
11
+ fetcher: VoyantFetcher;
12
+ }
13
+ export declare function fetchWithValidation<TOut>(path: string, schema: z.ZodType<TOut>, options: FetchWithValidationOptions, init?: RequestInit): Promise<TOut>;
14
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAE5B,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;AAElF,eAAO,MAAM,cAAc,EAAE,aACoB,CAAA;AAEjD,qBAAa,cAAe,SAAQ,KAAK;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;gBAEV,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO;CAM3D;AAaD,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,aAAa,CAAA;CACvB;AAED,wBAAsB,mBAAmB,CAAC,IAAI,EAC5C,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EACvB,OAAO,EAAE,0BAA0B,EACnC,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CAAC,IAAI,CAAC,CAgCf"}
package/dist/client.js ADDED
@@ -0,0 +1,59 @@
1
+ export const defaultFetcher = (url, init) => fetch(url, { credentials: "include", ...init });
2
+ export class VoyantApiError extends Error {
3
+ status;
4
+ body;
5
+ constructor(message, status, body) {
6
+ super(message);
7
+ this.name = "VoyantApiError";
8
+ this.status = status;
9
+ this.body = body;
10
+ }
11
+ }
12
+ function extractErrorMessage(status, statusText, body) {
13
+ if (typeof body === "object" && body !== null && "error" in body) {
14
+ const err = body.error;
15
+ if (typeof err === "string")
16
+ return err;
17
+ if (typeof err === "object" && err !== null && "message" in err) {
18
+ return String(err.message);
19
+ }
20
+ }
21
+ return `Voyant API error: ${status} ${statusText}`;
22
+ }
23
+ export async function fetchWithValidation(path, schema, options, init) {
24
+ const url = joinUrl(options.baseUrl, path);
25
+ const headers = new Headers(init?.headers);
26
+ if (init?.body !== undefined && !headers.has("Content-Type")) {
27
+ headers.set("Content-Type", "application/json");
28
+ }
29
+ const response = await options.fetcher(url, { ...init, headers });
30
+ if (!response.ok) {
31
+ const body = await safeJson(response);
32
+ throw new VoyantApiError(extractErrorMessage(response.status, response.statusText, body), response.status, body);
33
+ }
34
+ if (response.status === 204) {
35
+ return schema.parse(undefined);
36
+ }
37
+ const body = await safeJson(response);
38
+ const parsed = schema.safeParse(body);
39
+ if (!parsed.success) {
40
+ throw new VoyantApiError(`Voyant API response failed validation: ${parsed.error.message}`, response.status, body);
41
+ }
42
+ return parsed.data;
43
+ }
44
+ async function safeJson(response) {
45
+ const text = await response.text();
46
+ if (!text)
47
+ return undefined;
48
+ try {
49
+ return JSON.parse(text);
50
+ }
51
+ catch {
52
+ return text;
53
+ }
54
+ }
55
+ function joinUrl(baseUrl, path) {
56
+ const trimmedBase = baseUrl.endsWith("/") ? baseUrl.slice(0, -1) : baseUrl;
57
+ const trimmedPath = path.startsWith("/") ? path : `/${path}`;
58
+ return `${trimmedBase}${trimmedPath}`;
59
+ }
@@ -0,0 +1,13 @@
1
+ import type { CatalogSearchHit } from "@voyant-travel/catalog-react";
2
+ export interface CruiseCatalogCardProps {
3
+ hit: CatalogSearchHit;
4
+ onClick?: (hit: CatalogSearchHit) => void;
5
+ className?: string;
6
+ }
7
+ /**
8
+ * Search-result card for a cruise hit. Reads sailing-shaped fields:
9
+ * `name`, `shipName`, `departureDate`, `nights`, `status`, `priceFromCents`,
10
+ * `currency`, `embarkationPort`, `tags`.
11
+ */
12
+ export declare function CruiseCatalogCard({ hit, onClick, className }: CruiseCatalogCardProps): import("react/jsx-runtime").JSX.Element;
13
+ //# sourceMappingURL=cruise-catalog-card.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cruise-catalog-card.d.ts","sourceRoot":"","sources":["../../src/components/cruise-catalog-card.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAMpE,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,gBAAgB,CAAA;IACrB,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,IAAI,CAAA;IACzC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,sBAAsB,2CAoEpF"}
@@ -0,0 +1,58 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Badge } from "@voyant-travel/ui/components/badge";
4
+ import { Card, CardContent } from "@voyant-travel/ui/components/card";
5
+ import { cn } from "@voyant-travel/ui/lib/utils";
6
+ import { useCruisesUiI18nOrDefault } from "../i18n/index.js";
7
+ /**
8
+ * Search-result card for a cruise hit. Reads sailing-shaped fields:
9
+ * `name`, `shipName`, `departureDate`, `nights`, `status`, `priceFromCents`,
10
+ * `currency`, `embarkationPort`, `tags`.
11
+ */
12
+ export function CruiseCatalogCard({ hit, onClick, className }) {
13
+ const i18n = useCruisesUiI18nOrDefault();
14
+ const messages = i18n.messages.catalogCard;
15
+ const f = hit.document.fields;
16
+ const name = stringOr(f.name, messages.untitled);
17
+ const shipName = stringOr(f.shipName, null);
18
+ const status = stringOr(f.status, null);
19
+ const departureDate = stringOr(f.departureDate, null);
20
+ const nights = numberOr(f.nights, null);
21
+ const embarkationPort = stringOr(f.embarkationPort, null);
22
+ const tags = stringArray(f.tags);
23
+ const priceFrom = numberOr(f.priceFromCents, null);
24
+ const currency = stringOr(f.currency ?? f.sellCurrency, null);
25
+ const priceLabel = priceFrom != null && currency
26
+ ? formatTemplate(messages.priceFrom, {
27
+ amount: i18n.formatCurrency(priceFrom / 100, currency, {
28
+ maximumFractionDigits: 0,
29
+ }),
30
+ })
31
+ : null;
32
+ return (_jsx(Card, { className: cn("h-full cursor-pointer transition-colors hover:border-primary/40", onClick == null && "cursor-default", className), onClick: onClick ? () => onClick(hit) : undefined, children: _jsxs(CardContent, { className: "flex h-full flex-col gap-2 p-4", children: [_jsxs("div", { className: "flex items-start justify-between gap-2", children: [_jsxs("div", { className: "min-w-0", children: [_jsx("h3", { className: "line-clamp-2 font-medium text-sm", children: name }), shipName && _jsx("p", { className: "text-muted-foreground text-xs", children: shipName })] }), status && (_jsx(Badge, { variant: status === "active" ? "default" : "secondary", className: "shrink-0", children: status }))] }), _jsxs("div", { className: "flex flex-wrap items-center gap-2 text-muted-foreground text-xs", children: [departureDate && _jsx("span", { children: departureDate }), nights != null && (_jsx("span", { children: formatTemplate(nights === 1 ? messages.nightsSingular : messages.nightsPlural, {
33
+ count: nights,
34
+ }) })), embarkationPort && _jsxs("span", { children: ["\u00B7 ", embarkationPort] }), priceLabel && _jsx("span", { className: "ml-auto font-medium text-foreground", children: priceLabel })] }), tags.length > 0 && (_jsx("div", { className: "mt-auto flex flex-wrap gap-1", children: tags.slice(0, 4).map((tag) => (_jsx(Badge, { variant: "outline", className: "text-[10px]", children: tag }, tag))) }))] }) }));
35
+ }
36
+ function formatTemplate(template, values) {
37
+ return template.replace(/\{(\w+)\}/g, (_, key) => {
38
+ const value = values[key];
39
+ return value === undefined ? "" : String(value);
40
+ });
41
+ }
42
+ function stringOr(value, fallback) {
43
+ return typeof value === "string" && value.length > 0 ? value : fallback;
44
+ }
45
+ function numberOr(value, fallback) {
46
+ if (typeof value === "number")
47
+ return value;
48
+ if (typeof value === "string") {
49
+ const n = Number(value);
50
+ return Number.isFinite(n) ? n : fallback;
51
+ }
52
+ return fallback;
53
+ }
54
+ function stringArray(value) {
55
+ if (!Array.isArray(value))
56
+ return [];
57
+ return value.filter((v) => typeof v === "string" && v.length > 0);
58
+ }
@@ -0,0 +1,13 @@
1
+ import type * as React from "react";
2
+ export interface EnrichmentProgramListProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ cruiseKey: string;
4
+ emptyState?: React.ReactNode;
5
+ }
6
+ /**
7
+ * Connected list of expedition enrichment staff (naturalists, historians,
8
+ * photographers, lecturers, experts) for a given cruise. Pure read-only
9
+ * display — for editing, pair with a separate enrichment-form component
10
+ * driven by `useEnrichmentMutation`.
11
+ */
12
+ export declare function EnrichmentProgramList({ cruiseKey, emptyState, className, ...props }: EnrichmentProgramListProps): import("react/jsx-runtime").JSX.Element;
13
+ //# sourceMappingURL=enrichment-program-list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enrichment-program-list.d.ts","sourceRoot":"","sources":["../../src/components/enrichment-program-list.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAA;AAgBnC,MAAM,WAAW,0BAA2B,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IACtF,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC7B;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,SAAS,EACT,UAAU,EACV,SAAS,EACT,GAAG,KAAK,EACT,EAAE,0BAA0B,2CAkE5B"}
@@ -0,0 +1,45 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Avatar, AvatarFallback, AvatarImage } from "@voyant-travel/ui/components/avatar";
4
+ import { Badge } from "@voyant-travel/ui/components/badge";
5
+ import { Card, CardContent } from "@voyant-travel/ui/components/card";
6
+ import { cn } from "@voyant-travel/ui/lib/utils";
7
+ import { Camera, Compass, GraduationCap, Mic, ScrollText, Sparkles } from "lucide-react";
8
+ import { useCruisesUiI18nOrDefault } from "../i18n/index.js";
9
+ import { useEnrichmentPrograms } from "../index.js";
10
+ const KIND_ICON = {
11
+ naturalist: Compass,
12
+ historian: ScrollText,
13
+ photographer: Camera,
14
+ lecturer: Mic,
15
+ expert: GraduationCap,
16
+ other: Sparkles,
17
+ };
18
+ /**
19
+ * Connected list of expedition enrichment staff (naturalists, historians,
20
+ * photographers, lecturers, experts) for a given cruise. Pure read-only
21
+ * display — for editing, pair with a separate enrichment-form component
22
+ * driven by `useEnrichmentMutation`.
23
+ */
24
+ export function EnrichmentProgramList({ cruiseKey, emptyState, className, ...props }) {
25
+ const { messages } = useCruisesUiI18nOrDefault();
26
+ const m = messages.enrichmentProgramList;
27
+ const { data, isLoading } = useEnrichmentPrograms(cruiseKey);
28
+ if (isLoading) {
29
+ return (_jsx("div", { "data-slot": "enrichment-loading", className: cn("py-8 text-center", className), ...props, children: _jsx("p", { className: "text-muted-foreground", children: m.loading }) }));
30
+ }
31
+ if (!data || data.length === 0) {
32
+ return (_jsx("div", { "data-slot": "enrichment-empty", className: cn("py-8 text-center", className), ...props, children: emptyState ?? _jsx("p", { className: "text-muted-foreground", children: m.empty }) }));
33
+ }
34
+ return (_jsx("div", { "data-slot": "enrichment-list", className: cn("grid gap-4 sm:grid-cols-2", className), ...props, children: data.map((program) => {
35
+ const Icon = KIND_ICON[program.kind];
36
+ const initials = program.name
37
+ .split(/\s+/)
38
+ .map((part) => part[0])
39
+ .filter(Boolean)
40
+ .slice(0, 2)
41
+ .join("")
42
+ .toUpperCase();
43
+ return (_jsx(Card, { "data-slot": "enrichment-card", className: "overflow-hidden", children: _jsxs(CardContent, { className: "flex gap-4 p-4", children: [_jsxs(Avatar, { className: "size-14 shrink-0", children: [program.bioImageUrl ? (_jsx(AvatarImage, { src: program.bioImageUrl, alt: program.name })) : null, _jsx(AvatarFallback, { children: initials || m.avatarFallback })] }), _jsxs("div", { className: "min-w-0 flex-1 space-y-1", children: [_jsx("div", { className: "flex items-center gap-2", children: _jsxs(Badge, { variant: "secondary", className: "font-normal", children: [_jsx(Icon, { "aria-hidden": true, className: "mr-1 size-3" }), m.kindLabels[program.kind]] }) }), _jsx("div", { className: "font-semibold truncate", children: program.name }), program.title ? (_jsx("div", { className: "text-sm text-muted-foreground truncate", children: program.title })) : null, program.description ? (_jsx("p", { className: "text-sm text-muted-foreground line-clamp-3", children: program.description })) : null] })] }) }, program.id));
44
+ }) }));
45
+ }
@@ -0,0 +1,14 @@
1
+ import { Badge } from "@voyant-travel/ui/components/badge";
2
+ import type * as React from "react";
3
+ export interface ExternalCruiseBadgeProps extends React.ComponentPropsWithoutRef<typeof Badge> {
4
+ /** The adapter that sourced the cruise (e.g. "voyant-connect", "custom"). */
5
+ sourceProvider: string;
6
+ }
7
+ /**
8
+ * Small inline badge that surfaces cruise provenance to admin/storefront UIs.
9
+ * Renders as a subtle "External · <provider>" pill so operators (and shoppers,
10
+ * if the storefront opts in) can see at a glance which inventory comes from
11
+ * upstream and which is the operator's own.
12
+ */
13
+ export declare function ExternalCruiseBadge({ sourceProvider, className, ...props }: ExternalCruiseBadgeProps): import("react/jsx-runtime").JSX.Element;
14
+ //# sourceMappingURL=external-badge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"external-badge.d.ts","sourceRoot":"","sources":["../../src/components/external-badge.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,oCAAoC,CAAA;AAE1D,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAA;AAInC,MAAM,WAAW,wBAAyB,SAAQ,KAAK,CAAC,wBAAwB,CAAC,OAAO,KAAK,CAAC;IAC5F,6EAA6E;IAC7E,cAAc,EAAE,MAAM,CAAA;CACvB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,cAAc,EACd,SAAS,EACT,GAAG,KAAK,EACT,EAAE,wBAAwB,2CAkB1B"}
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { formatMessage } from "@voyant-travel/i18n";
4
+ import { Badge } from "@voyant-travel/ui/components/badge";
5
+ import { cn } from "@voyant-travel/ui/lib/utils";
6
+ import { useCruisesUiI18nOrDefault } from "../i18n/index.js";
7
+ /**
8
+ * Small inline badge that surfaces cruise provenance to admin/storefront UIs.
9
+ * Renders as a subtle "External · <provider>" pill so operators (and shoppers,
10
+ * if the storefront opts in) can see at a glance which inventory comes from
11
+ * upstream and which is the operator's own.
12
+ */
13
+ export function ExternalCruiseBadge({ sourceProvider, className, ...props }) {
14
+ const { messages } = useCruisesUiI18nOrDefault();
15
+ const m = messages.externalCruiseBadge;
16
+ return (_jsxs(Badge, { "data-slot": "external-cruise-badge", variant: "outline", className: cn("font-normal", className), title: formatMessage(m.title, { sourceProvider }), ...props, children: [_jsx("span", { "aria-hidden": "true", className: "mr-1", children: "\u2197" }), formatMessage(m.label, { sourceProvider })] }));
17
+ }
@@ -0,0 +1,21 @@
1
+ import type * as React from "react";
2
+ import type { PriceRecord } from "../index.js";
3
+ export interface PricingGridProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ /** Flat list of prices for a single sailing (typically from useSailing(...,{include:["pricing"]})). */
5
+ prices: PriceRecord[];
6
+ /** Optional cabin-category id → display name resolver for nicer row labels. */
7
+ categoryLabel?: (categoryId: string) => string;
8
+ /** Currency formatter; defaults to `${currency} ${amount}`. */
9
+ formatPrice?: (amount: string, currency: string) => string;
10
+ /** Click handler for a (category, occupancy, fareCode) cell — typically opens the booking flow. */
11
+ onCellSelect?: (price: PriceRecord) => void;
12
+ }
13
+ /**
14
+ * The cabin × occupancy pricing matrix that's the heart of any cruise booking
15
+ * flow. Rows = cabin categories; columns = occupancy variants present in the
16
+ * data; cells = lowest available fare per (category, occupancy). Cells render
17
+ * an availability badge and the price; clicking surfaces the underlying row
18
+ * for the booking flow to consume.
19
+ */
20
+ export declare function PricingGrid({ prices, categoryLabel, formatPrice, onCellSelect, className, ...props }: PricingGridProps): import("react/jsx-runtime").JSX.Element;
21
+ //# sourceMappingURL=pricing-grid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pricing-grid.d.ts","sourceRoot":"","sources":["../../src/components/pricing-grid.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAA;AAEnC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,MAAM,WAAW,gBAAiB,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC5E,uGAAuG;IACvG,MAAM,EAAE,WAAW,EAAE,CAAA;IACrB,+EAA+E;IAC/E,aAAa,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,CAAA;IAC9C,+DAA+D;IAC/D,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAA;IAC1D,mGAAmG;IACnG,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAA;CAC5C;AAaD;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EACN,aAAa,EACb,WAAW,EACX,YAAY,EACZ,SAAS,EACT,GAAG,KAAK,EACT,EAAE,gBAAgB,2CAsGlB"}
@@ -0,0 +1,81 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { formatMessage } from "@voyant-travel/i18n";
4
+ import { Badge } from "@voyant-travel/ui/components/badge";
5
+ import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "@voyant-travel/ui/components/table";
6
+ import { cn } from "@voyant-travel/ui/lib/utils";
7
+ import { useCruisesUiI18nOrDefault } from "../i18n/index.js";
8
+ const AVAILABILITY_VARIANT = {
9
+ available: "default",
10
+ limited: "secondary",
11
+ on_request: "outline",
12
+ wait_list: "outline",
13
+ sold_out: "destructive",
14
+ };
15
+ /**
16
+ * The cabin × occupancy pricing matrix that's the heart of any cruise booking
17
+ * flow. Rows = cabin categories; columns = occupancy variants present in the
18
+ * data; cells = lowest available fare per (category, occupancy). Cells render
19
+ * an availability badge and the price; clicking surfaces the underlying row
20
+ * for the booking flow to consume.
21
+ */
22
+ export function PricingGrid({ prices, categoryLabel, formatPrice, onCellSelect, className, ...props }) {
23
+ const i18n = useCruisesUiI18nOrDefault();
24
+ const m = i18n.messages.pricingGrid;
25
+ const formatResolvedPrice = formatPrice ??
26
+ ((amount, currency) => formatCruiseMoney(amount, currency, {
27
+ fallbackCurrencyAmount: i18n.messages.common.fallbackCurrencyAmount,
28
+ formatCurrency: i18n.formatCurrency,
29
+ }, { maximumFractionDigits: 0 }));
30
+ if (prices.length === 0) {
31
+ return (_jsx("div", { "data-slot": "pricing-grid-empty", className: cn("py-8 text-center", className), ...props, children: _jsx("p", { className: "text-muted-foreground", children: m.empty }) }));
32
+ }
33
+ // Pivot the flat list into a (categoryId × occupancy) → cheapest price row.
34
+ const occupancies = Array.from(new Set(prices.map((p) => p.occupancy))).sort((a, b) => a - b);
35
+ const grouped = new Map();
36
+ for (const p of prices) {
37
+ let row = grouped.get(p.cabinCategoryId);
38
+ if (!row) {
39
+ row = new Map();
40
+ grouped.set(p.cabinCategoryId, row);
41
+ }
42
+ const existing = row.get(p.occupancy);
43
+ if (!existing || Number(p.pricePerPerson) < Number(existing.pricePerPerson)) {
44
+ row.set(p.occupancy, p);
45
+ }
46
+ }
47
+ return (_jsx("div", { "data-slot": "pricing-grid", className: cn("overflow-x-auto", className), ...props, children: _jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { className: "w-[220px]", children: m.cabinCategory }), occupancies.map((occ) => (_jsx(TableHead, { className: "text-center", children: occupancyLabel(occ, i18n.messages.common.occupancyTableLabels) }, occ)))] }) }), _jsx(TableBody, { children: Array.from(grouped.entries()).map(([categoryId, row]) => (_jsxs(TableRow, { children: [_jsx(TableCell, { className: "font-medium", children: categoryLabel?.(categoryId) ?? categoryId }), occupancies.map((occ) => {
48
+ const price = row.get(occ);
49
+ if (!price) {
50
+ return (_jsx(TableCell, { className: "text-center text-muted-foreground", children: "\u2014" }, occ));
51
+ }
52
+ return (_jsxs(TableCell, { className: cn("text-center align-top", onCellSelect &&
53
+ price.availability !== "sold_out" &&
54
+ "cursor-pointer hover:bg-accent"), onClick: onCellSelect && price.availability !== "sold_out"
55
+ ? () => onCellSelect(price)
56
+ : undefined, "data-slot": "pricing-grid-cell", children: [_jsx("div", { className: "font-semibold", children: formatResolvedPrice(price.pricePerPerson, price.currency) }), _jsx("div", { className: "text-xs text-muted-foreground", children: m.perPerson }), _jsx(Badge, { variant: AVAILABILITY_VARIANT[price.availability], className: "mt-2 font-normal", children: m.availabilityLabels[price.availability] })] }, occ));
57
+ })] }, categoryId))) })] }) }));
58
+ }
59
+ function occupancyLabel(occupancy, labels) {
60
+ if (occupancy === 1)
61
+ return labels.single;
62
+ if (occupancy === 2)
63
+ return labels.double;
64
+ if (occupancy === 3)
65
+ return labels.triple;
66
+ if (occupancy === 4)
67
+ return labels.quad;
68
+ return formatMessage(labels.fallback, { count: occupancy });
69
+ }
70
+ function formatCruiseMoney(amount, currency, i18n, options) {
71
+ const n = Number(amount);
72
+ if (!Number.isFinite(n)) {
73
+ return formatMessage(i18n.fallbackCurrencyAmount, { currency, amount });
74
+ }
75
+ try {
76
+ return i18n.formatCurrency(n, currency, options);
77
+ }
78
+ catch {
79
+ return formatMessage(i18n.fallbackCurrencyAmount, { currency, amount });
80
+ }
81
+ }