@voyantjs/bookings-react 0.5.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.
@@ -14,6 +14,7 @@ export { type UseBookingItemsOptions, useBookingItems } from "./use-booking-item
14
14
  export { type CreateBookingInput, type UpdateBookingInput, useBookingMutation, } from "./use-booking-mutation.js";
15
15
  export { type CreateBookingNoteInput, useBookingNoteMutation, } from "./use-booking-note-mutation.js";
16
16
  export { type UseBookingNotesOptions, useBookingNotes } from "./use-booking-notes.js";
17
+ export { type UseBookingPrimaryProductOptions, type UseBookingPrimaryProductResult, useBookingPrimaryProduct, } from "./use-booking-primary-product.js";
17
18
  export { type UpdateBookingStatusInput, useBookingStatusMutation, } from "./use-booking-status-mutation.js";
18
19
  export { type UseBookingsOptions, useBookings } from "./use-bookings.js";
19
20
  export { type CreatePassengerInput, type UpdatePassengerInput, usePassengerMutation, } from "./use-passenger-mutation.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACrE,OAAO,EAAE,KAAK,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAC9F,OAAO,EACL,KAAK,kBAAkB,EACvB,wBAAwB,GACzB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EACL,KAAK,4BAA4B,EACjC,yBAAyB,GAC1B,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,EAC/B,0BAA0B,EAC1B,mBAAmB,GACpB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,KAAK,sBAAsB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACrF,OAAO,EACL,KAAK,gCAAgC,EACrC,yBAAyB,GAC1B,MAAM,oCAAoC,CAAA;AA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,EACjC,0BAA0B,GAC3B,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EAAE,KAAK,sBAAsB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACrF,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,kBAAkB,GACnB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACL,KAAK,sBAAsB,EAC3B,sBAAsB,GACvB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAAE,KAAK,sBAAsB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACrF,OAAO,EACL,KAAK,+BAA+B,EACpC,KAAK,8BAA8B,EACnC,wBAAwB,GACzB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EACL,KAAK,wBAAwB,EAC7B,wBAAwB,GACzB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,KAAK,kBAAkB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACxE,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,oBAAoB,GACrB,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,KAAK,oBAAoB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAC9E,OAAO,EACL,KAAK,8BAA8B,EACnC,uBAAuB,GACxB,MAAM,iCAAiC,CAAA;AACxC,OAAO,EAAE,mCAAmC,EAAE,MAAM,+CAA+C,CAAA;AACnG,OAAO,EACL,KAAK,mCAAmC,EACxC,4BAA4B,GAC7B,MAAM,uCAAuC,CAAA;AAC9C,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,yBAAyB,GAC1B,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EAAE,KAAK,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA"}
@@ -14,6 +14,7 @@ export { useBookingItems } from "./use-booking-items.js";
14
14
  export { useBookingMutation, } from "./use-booking-mutation.js";
15
15
  export { useBookingNoteMutation, } from "./use-booking-note-mutation.js";
16
16
  export { useBookingNotes } from "./use-booking-notes.js";
17
+ export { useBookingPrimaryProduct, } from "./use-booking-primary-product.js";
17
18
  export { useBookingStatusMutation, } from "./use-booking-status-mutation.js";
18
19
  export { useBookings } from "./use-bookings.js";
19
20
  export { usePassengerMutation, } from "./use-passenger-mutation.js";
@@ -0,0 +1,28 @@
1
+ import { type UseBookingItemsOptions } from "./use-booking-items.js";
2
+ export type UseBookingPrimaryProductOptions = UseBookingItemsOptions;
3
+ export interface UseBookingPrimaryProductResult {
4
+ /**
5
+ * The productId of the first booking item that has a non-null productId,
6
+ * or null if no item has one (or items haven't loaded yet).
7
+ */
8
+ productId: string | null;
9
+ /**
10
+ * The optionUnitId from the same item the `productId` was sourced from,
11
+ * or null if that item has none (or no item resolved).
12
+ */
13
+ optionUnitId: string | null;
14
+ /** True while the underlying items query has no data yet. */
15
+ isPending: boolean;
16
+ /** True while the underlying items query is loading for the first time. */
17
+ isLoading: boolean;
18
+ }
19
+ /**
20
+ * Derive the "primary product" of a booking from its items.
21
+ *
22
+ * Tour-operator-style bookings are almost always scoped to a single product,
23
+ * but the product association lives on `bookingItem`, not `booking`. This hook
24
+ * encapsulates the canonical resolution — "first item with a non-null
25
+ * productId" — so consumers don't duplicate it.
26
+ */
27
+ export declare function useBookingPrimaryProduct(bookingId: string | null | undefined, options?: UseBookingPrimaryProductOptions): UseBookingPrimaryProductResult;
28
+ //# sourceMappingURL=use-booking-primary-product.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-booking-primary-product.d.ts","sourceRoot":"","sources":["../../src/hooks/use-booking-primary-product.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,sBAAsB,EAAmB,MAAM,wBAAwB,CAAA;AAErF,MAAM,MAAM,+BAA+B,GAAG,sBAAsB,CAAA;AAEpE,MAAM,WAAW,8BAA8B;IAC7C;;;OAGG;IACH,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB;;;OAGG;IACH,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,6DAA6D;IAC7D,SAAS,EAAE,OAAO,CAAA;IAClB,2EAA2E;IAC3E,SAAS,EAAE,OAAO,CAAA;CACnB;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACpC,OAAO,GAAE,+BAAoC,GAC5C,8BAA8B,CAUhC"}
@@ -0,0 +1,20 @@
1
+ "use client";
2
+ import { useBookingItems } from "./use-booking-items.js";
3
+ /**
4
+ * Derive the "primary product" of a booking from its items.
5
+ *
6
+ * Tour-operator-style bookings are almost always scoped to a single product,
7
+ * but the product association lives on `bookingItem`, not `booking`. This hook
8
+ * encapsulates the canonical resolution — "first item with a non-null
9
+ * productId" — so consumers don't duplicate it.
10
+ */
11
+ export function useBookingPrimaryProduct(bookingId, options = {}) {
12
+ const query = useBookingItems(bookingId, options);
13
+ const primary = query.data?.data.find((i) => i.productId) ?? null;
14
+ return {
15
+ productId: primary?.productId ?? null,
16
+ optionUnitId: primary?.optionUnitId ?? null,
17
+ isPending: query.isPending,
18
+ isLoading: query.isLoading,
19
+ };
20
+ }
package/dist/index.d.ts CHANGED
@@ -4,4 +4,5 @@ export { useVoyantBookingsContext, type VoyantBookingsContextValue, VoyantBookin
4
4
  export { bookingsQueryKeys } from "./query-keys.js";
5
5
  export { getBookingActivityQueryOptions, getBookingDocumentsQueryOptions, getBookingGroupForBookingQueryOptions, getBookingGroupQueryOptions, getBookingGroupsQueryOptions, getBookingItemParticipantsQueryOptions, getBookingItemsQueryOptions, getBookingNotesQueryOptions, getBookingQueryOptions, getBookingsQueryOptions, getPassengersQueryOptions, getPublicBookingSessionQueryOptions, getPublicBookingSessionStateQueryOptions, getSupplierStatusesQueryOptions, } from "./query-options.js";
6
6
  export * from "./schemas.js";
7
+ export { type BookingStatusBadgeVariant, bookingStatusBadgeVariant, bookingStatuses, bookingStatusOptions, formatBookingStatus, } from "./status-presentation.js";
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,KAAK,aAAa,GACnB,MAAM,aAAa,CAAA;AACpB,cAAc,kBAAkB,CAAA;AAChC,OAAO,EACL,wBAAwB,EACxB,KAAK,0BAA0B,EAC/B,sBAAsB,EACtB,KAAK,2BAA2B,GACjC,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EACL,8BAA8B,EAC9B,+BAA+B,EAC/B,qCAAqC,EACrC,2BAA2B,EAC3B,4BAA4B,EAC5B,sCAAsC,EACtC,2BAA2B,EAC3B,2BAA2B,EAC3B,sBAAsB,EACtB,uBAAuB,EACvB,yBAAyB,EACzB,mCAAmC,EACnC,wCAAwC,EACxC,+BAA+B,GAChC,MAAM,oBAAoB,CAAA;AAC3B,cAAc,cAAc,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,KAAK,aAAa,GACnB,MAAM,aAAa,CAAA;AACpB,cAAc,kBAAkB,CAAA;AAChC,OAAO,EACL,wBAAwB,EACxB,KAAK,0BAA0B,EAC/B,sBAAsB,EACtB,KAAK,2BAA2B,GACjC,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EACL,8BAA8B,EAC9B,+BAA+B,EAC/B,qCAAqC,EACrC,2BAA2B,EAC3B,4BAA4B,EAC5B,sCAAsC,EACtC,2BAA2B,EAC3B,2BAA2B,EAC3B,sBAAsB,EACtB,uBAAuB,EACvB,yBAAyB,EACzB,mCAAmC,EACnC,wCAAwC,EACxC,+BAA+B,GAChC,MAAM,oBAAoB,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,OAAO,EACL,KAAK,yBAAyB,EAC9B,yBAAyB,EACzB,eAAe,EACf,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,0BAA0B,CAAA"}
package/dist/index.js CHANGED
@@ -4,3 +4,4 @@ export { useVoyantBookingsContext, VoyantBookingsProvider, } from "./provider.js
4
4
  export { bookingsQueryKeys } from "./query-keys.js";
5
5
  export { getBookingActivityQueryOptions, getBookingDocumentsQueryOptions, getBookingGroupForBookingQueryOptions, getBookingGroupQueryOptions, getBookingGroupsQueryOptions, getBookingItemParticipantsQueryOptions, getBookingItemsQueryOptions, getBookingNotesQueryOptions, getBookingQueryOptions, getBookingsQueryOptions, getPassengersQueryOptions, getPublicBookingSessionQueryOptions, getPublicBookingSessionStateQueryOptions, getSupplierStatusesQueryOptions, } from "./query-options.js";
6
6
  export * from "./schemas.js";
7
+ export { bookingStatusBadgeVariant, bookingStatuses, bookingStatusOptions, formatBookingStatus, } from "./status-presentation.js";
package/dist/schemas.d.ts CHANGED
@@ -23,6 +23,7 @@ export declare const bookingStatusSchema: z.ZodEnum<{
23
23
  expired: "expired";
24
24
  cancelled: "cancelled";
25
25
  }>;
26
+ export type BookingStatus = z.infer<typeof bookingStatusSchema>;
26
27
  export declare const supplierConfirmationStatusSchema: z.ZodEnum<{
27
28
  pending: "pending";
28
29
  confirmed: "confirmed";
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC;;;;;iBAM7D,CAAA;AAEJ,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC;;iBAA6B,CAAA;AAC3F,eAAO,MAAM,aAAa,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BAEvC,CAAA;AACF,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;iBAEzC,CAAA;AACF,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAA;AACvF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;iBAA8C,CAAA;AACpF,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;iBAAmD,CAAA;AAC/F,eAAO,MAAM,uBAAuB;;;;;;;;;;iBAA6C,CAAA;AACjF,eAAO,MAAM,oBAAoB;;;;;;;;iBAAyC,CAAA;AAC1E,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAA6C,CAAA;AACtF,eAAO,MAAM,iCAAiC;;;;;;;;;;;iBAAkD,CAAA;AAChG,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAE/C,CAAA"}
@@ -0,0 +1,34 @@
1
+ import { type BookingStatus } from "./schemas.js";
2
+ /**
3
+ * Badge variant palette used by the shadcn default theme. Exported as a named
4
+ * type so downstream code can keep its local `Badge` component loosely coupled
5
+ * to this package — we don't import shadcn here.
6
+ */
7
+ export type BookingStatusBadgeVariant = "default" | "secondary" | "outline" | "destructive";
8
+ /**
9
+ * Canonical status → badge-variant mapping for bookings.
10
+ *
11
+ * Typed as `Record<BookingStatus, …>` (not `Record<string, …>`) so that adding
12
+ * a new booking status becomes a compile error here, instead of a silent UX
13
+ * fallback in every app that kept its own local copy of this map.
14
+ */
15
+ export declare const bookingStatusBadgeVariant: Record<BookingStatus, BookingStatusBadgeVariant>;
16
+ /**
17
+ * Humanize a booking status for display. `"in_progress"` → `"In Progress"`.
18
+ */
19
+ export declare function formatBookingStatus(status: BookingStatus): string;
20
+ /**
21
+ * All booking status values in their canonical order — derived from the Zod
22
+ * enum so this list can never drift out of sync with the schema.
23
+ */
24
+ export declare const bookingStatuses: ("draft" | "on_hold" | "confirmed" | "in_progress" | "completed" | "expired" | "cancelled")[];
25
+ /**
26
+ * Pre-built `{ value, label }` list for rendering status pickers (e.g. a
27
+ * Select in a status-change dialog). Uses `formatBookingStatus` for labels so
28
+ * there's exactly one place to tweak capitalization or wording.
29
+ */
30
+ export declare const bookingStatusOptions: ReadonlyArray<{
31
+ value: BookingStatus;
32
+ label: string;
33
+ }>;
34
+ //# sourceMappingURL=status-presentation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status-presentation.d.ts","sourceRoot":"","sources":["../src/status-presentation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAuB,MAAM,cAAc,CAAA;AAEtE;;;;GAIG;AACH,MAAM,MAAM,yBAAyB,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,aAAa,CAAA;AAE3F;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,aAAa,EAAE,yBAAyB,CAQtF,CAAA;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CAKjE;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,+FAA8B,CAAA;AAE1D;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,aAAa,CAAC;IAAE,KAAK,EAAE,aAAa,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CACR,CAAA"}
@@ -0,0 +1,37 @@
1
+ import { bookingStatusSchema } from "./schemas.js";
2
+ /**
3
+ * Canonical status → badge-variant mapping for bookings.
4
+ *
5
+ * Typed as `Record<BookingStatus, …>` (not `Record<string, …>`) so that adding
6
+ * a new booking status becomes a compile error here, instead of a silent UX
7
+ * fallback in every app that kept its own local copy of this map.
8
+ */
9
+ export const bookingStatusBadgeVariant = {
10
+ draft: "outline",
11
+ on_hold: "secondary",
12
+ confirmed: "default",
13
+ in_progress: "secondary",
14
+ completed: "default",
15
+ expired: "secondary",
16
+ cancelled: "destructive",
17
+ };
18
+ /**
19
+ * Humanize a booking status for display. `"in_progress"` → `"In Progress"`.
20
+ */
21
+ export function formatBookingStatus(status) {
22
+ return status
23
+ .split("_")
24
+ .map((part) => (part.length > 0 ? `${part[0].toUpperCase()}${part.slice(1)}` : part))
25
+ .join(" ");
26
+ }
27
+ /**
28
+ * All booking status values in their canonical order — derived from the Zod
29
+ * enum so this list can never drift out of sync with the schema.
30
+ */
31
+ export const bookingStatuses = bookingStatusSchema.options;
32
+ /**
33
+ * Pre-built `{ value, label }` list for rendering status pickers (e.g. a
34
+ * Select in a status-change dialog). Uses `formatBookingStatus` for labels so
35
+ * there's exactly one place to tweak capitalization or wording.
36
+ */
37
+ export const bookingStatusOptions = bookingStatuses.map((value) => ({ value, label: formatBookingStatus(value) }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voyantjs/bookings-react",
3
- "version": "0.5.0",
3
+ "version": "0.6.2",
4
4
  "license": "FSL-1.1-Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -35,7 +35,7 @@
35
35
  "react": "^19.0.0",
36
36
  "react-dom": "^19.0.0",
37
37
  "zod": "^4.0.0",
38
- "@voyantjs/bookings": "0.5.0"
38
+ "@voyantjs/bookings": "0.6.2"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@tanstack/react-query": "^5.96.2",
@@ -46,12 +46,12 @@
46
46
  "typescript": "^6.0.2",
47
47
  "vitest": "^4.1.2",
48
48
  "zod": "^4.3.6",
49
- "@voyantjs/bookings": "0.5.0",
50
- "@voyantjs/react": "0.5.0",
49
+ "@voyantjs/bookings": "0.6.2",
50
+ "@voyantjs/react": "0.6.2",
51
51
  "@voyantjs/voyant-typescript-config": "0.1.0"
52
52
  },
53
53
  "dependencies": {
54
- "@voyantjs/react": "0.5.0"
54
+ "@voyantjs/react": "0.6.2"
55
55
  },
56
56
  "files": [
57
57
  "dist"