@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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-options.d.ts","sourceRoot":"","sources":["../src/query-options.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,KAAK,0BAA0B,EAAuB,MAAM,aAAa,CAAA;AAClF,OAAO,EACL,KAAK,kBAAkB,EAEvB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC3B,MAAM,iBAAiB,CAAA;AA+BxB,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,0BAA0B,EAClC,OAAO,GAAE,kBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWpC"}
@@ -0,0 +1,136 @@
1
+ /**
2
+ * TanStack `queryOptions()` factories for the cruises module.
3
+ *
4
+ * Hooks under `./hooks/` wrap these so they can be used both inside React
5
+ * components and outside (SSR loaders, route preloads, framework adapters).
6
+ * Each factory takes a `FetchWithValidationOptions` instead of reading from
7
+ * context — the hook provides that, but a server loader can pass it in
8
+ * directly.
9
+ */
10
+ import { queryOptions } from "@tanstack/react-query";
11
+ import { fetchWithValidation } from "./client.js";
12
+ import { cruisesQueryKeys, } from "./query-keys.js";
13
+ import { adminCruiseListResponse, cabinCategoryListResponse, cabinListResponse, cruiseSingleResponse, deckListResponse, effectiveItineraryResponse, enrichmentListResponse, priceListResponse, sailingListResponse, sailingSingleResponse, searchIndexListResponse, shipListResponse, shipSingleResponse, } from "./schemas.js";
14
+ // ---------- helpers ----------
15
+ function buildQueryString(params) {
16
+ const search = new URLSearchParams();
17
+ for (const [k, v] of Object.entries(params)) {
18
+ if (v === undefined || v === null || v === "")
19
+ continue;
20
+ search.set(k, String(v));
21
+ }
22
+ const qs = search.toString();
23
+ return qs ? `?${qs}` : "";
24
+ }
25
+ // ---------- cruises ----------
26
+ export function getCruisesQueryOptions(client, filters = {}) {
27
+ return queryOptions({
28
+ queryKey: cruisesQueryKeys.cruisesList(filters),
29
+ queryFn: () => fetchWithValidation(`/v1/admin/cruises${buildQueryString(filters)}`, adminCruiseListResponse, client),
30
+ });
31
+ }
32
+ export function getCruiseQueryOptions(client, key, options = {}) {
33
+ const include = options.include ?? [];
34
+ const qs = include.length > 0 ? `?include=${include.join(",")}` : "";
35
+ return queryOptions({
36
+ queryKey: cruisesQueryKeys.cruise(key, include),
37
+ queryFn: async () => {
38
+ const result = await fetchWithValidation(`/v1/admin/cruises/${encodeURIComponent(key)}${qs}`, cruiseSingleResponse, client);
39
+ return result.data;
40
+ },
41
+ });
42
+ }
43
+ // ---------- sailings ----------
44
+ export function getSailingsQueryOptions(client, filters = {}) {
45
+ return queryOptions({
46
+ queryKey: cruisesQueryKeys.sailingsList(filters),
47
+ queryFn: () => fetchWithValidation(`/v1/admin/cruises/sailings${buildQueryString(filters)}`, sailingListResponse, client),
48
+ });
49
+ }
50
+ export function getSailingQueryOptions(client, key, options = {}) {
51
+ const include = options.include ?? [];
52
+ const qs = include.length > 0 ? `?include=${include.join(",")}` : "";
53
+ return queryOptions({
54
+ queryKey: cruisesQueryKeys.sailing(key, include),
55
+ queryFn: async () => {
56
+ const result = await fetchWithValidation(`/v1/admin/cruises/sailings/${encodeURIComponent(key)}${qs}`, sailingSingleResponse, client);
57
+ return result.data;
58
+ },
59
+ });
60
+ }
61
+ export function getEffectiveItineraryQueryOptions(client, sailingKey) {
62
+ return queryOptions({
63
+ queryKey: cruisesQueryKeys.sailingItinerary(sailingKey),
64
+ queryFn: async () => {
65
+ const result = await fetchWithValidation(`/v1/admin/cruises/sailings/${encodeURIComponent(sailingKey)}/itinerary`, effectiveItineraryResponse, client);
66
+ return result.data;
67
+ },
68
+ });
69
+ }
70
+ // ---------- ships ----------
71
+ export function getShipsQueryOptions(client, filters = {}) {
72
+ return queryOptions({
73
+ queryKey: cruisesQueryKeys.shipsList(filters),
74
+ queryFn: () => fetchWithValidation(`/v1/admin/cruises/ships${buildQueryString(filters)}`, shipListResponse, client),
75
+ });
76
+ }
77
+ export function getShipQueryOptions(client, key) {
78
+ return queryOptions({
79
+ queryKey: cruisesQueryKeys.ship(key),
80
+ queryFn: async () => {
81
+ const result = await fetchWithValidation(`/v1/admin/cruises/ships/${encodeURIComponent(key)}`, shipSingleResponse, client);
82
+ return result.data;
83
+ },
84
+ });
85
+ }
86
+ export function getShipDecksQueryOptions(client, key) {
87
+ return queryOptions({
88
+ queryKey: cruisesQueryKeys.shipDecks(key),
89
+ queryFn: async () => {
90
+ const result = await fetchWithValidation(`/v1/admin/cruises/ships/${encodeURIComponent(key)}/decks`, deckListResponse, client);
91
+ return result.data;
92
+ },
93
+ });
94
+ }
95
+ export function getShipCategoriesQueryOptions(client, key) {
96
+ return queryOptions({
97
+ queryKey: cruisesQueryKeys.shipCategories(key),
98
+ queryFn: async () => {
99
+ const result = await fetchWithValidation(`/v1/admin/cruises/ships/${encodeURIComponent(key)}/categories`, cabinCategoryListResponse, client);
100
+ return result.data;
101
+ },
102
+ });
103
+ }
104
+ export function getCategoryCabinsQueryOptions(client, categoryId) {
105
+ return queryOptions({
106
+ queryKey: cruisesQueryKeys.categoryCabins(categoryId),
107
+ queryFn: async () => {
108
+ const result = await fetchWithValidation(`/v1/admin/cruises/categories/${encodeURIComponent(categoryId)}/cabins`, cabinListResponse, client);
109
+ return result.data;
110
+ },
111
+ });
112
+ }
113
+ // ---------- pricing ----------
114
+ export function getPricesQueryOptions(client, filters = {}) {
115
+ return queryOptions({
116
+ queryKey: cruisesQueryKeys.pricesList(filters),
117
+ queryFn: () => fetchWithValidation(`/v1/admin/cruises/prices${buildQueryString(filters)}`, priceListResponse, client),
118
+ });
119
+ }
120
+ // ---------- enrichment programs ----------
121
+ export function getEnrichmentProgramsQueryOptions(client, cruiseKey) {
122
+ return queryOptions({
123
+ queryKey: cruisesQueryKeys.enrichment(cruiseKey),
124
+ queryFn: async () => {
125
+ const result = await fetchWithValidation(`/v1/admin/cruises/${encodeURIComponent(cruiseKey)}/enrichment`, enrichmentListResponse, client);
126
+ return result.data;
127
+ },
128
+ });
129
+ }
130
+ // ---------- storefront (public) ----------
131
+ export function getStorefrontCruisesQueryOptions(client, filters = {}) {
132
+ return queryOptions({
133
+ queryKey: cruisesQueryKeys.storefrontList(filters),
134
+ queryFn: () => fetchWithValidation(`/v1/public/cruises${buildQueryString(filters)}`, searchIndexListResponse, client),
135
+ });
136
+ }