@voyant-travel/bookings-react 0.138.0 → 0.138.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.
@@ -1 +1 @@
1
- {"version":3,"file":"use-booking-item-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-booking-item-mutation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,oCAAoC,CAAA;AAC3C,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAW5B,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAC5E,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAE5E,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAuBZ,MAAM;eAAS,sBAAsB;;;;;EAgChF"}
1
+ {"version":3,"file":"use-booking-item-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-booking-item-mutation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,oCAAoC,CAAA;AAC3C,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAW5B,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAC5E,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAgB5E,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAsBZ,MAAM;eAAS,sBAAsB;;;;;EA8BhF"}
@@ -4,6 +4,16 @@ import { fetchWithValidation } from "../client.js";
4
4
  import { useVoyantBookingsContext } from "../provider.js";
5
5
  import { bookingsQueryKeys } from "../query-keys.js";
6
6
  import { bookingItemsResponse, bookingSingleResponse, successEnvelope } from "../schemas.js";
7
+ function invalidateBookingItemMutationQueries(queryClient, bookingId) {
8
+ void queryClient.invalidateQueries({
9
+ queryKey: bookingsQueryKeys.booking(bookingId),
10
+ exact: true,
11
+ });
12
+ void queryClient.invalidateQueries({ queryKey: bookingsQueryKeys.bookings() });
13
+ void queryClient.invalidateQueries({ queryKey: bookingsQueryKeys.items(bookingId) });
14
+ void queryClient.invalidateQueries({ queryKey: bookingsQueryKeys.activity(bookingId) });
15
+ void queryClient.invalidateQueries({ queryKey: bookingsQueryKeys.actionLedger(bookingId) });
16
+ }
7
17
  export function useBookingItemMutation(bookingId) {
8
18
  const { baseUrl, fetcher } = useVoyantBookingsContext();
9
19
  const queryClient = useQueryClient();
@@ -15,8 +25,7 @@ export function useBookingItemMutation(bookingId) {
15
25
  return data;
16
26
  },
17
27
  onSuccess: () => {
18
- void queryClient.invalidateQueries({ queryKey: bookingsQueryKeys.items(bookingId) });
19
- void queryClient.invalidateQueries({ queryKey: bookingsQueryKeys.activity(bookingId) });
28
+ invalidateBookingItemMutationQueries(queryClient, bookingId);
20
29
  },
21
30
  });
22
31
  const update = useMutation({
@@ -27,15 +36,13 @@ export function useBookingItemMutation(bookingId) {
27
36
  return data;
28
37
  },
29
38
  onSuccess: () => {
30
- void queryClient.invalidateQueries({ queryKey: bookingsQueryKeys.items(bookingId) });
31
- void queryClient.invalidateQueries({ queryKey: bookingsQueryKeys.activity(bookingId) });
39
+ invalidateBookingItemMutationQueries(queryClient, bookingId);
32
40
  },
33
41
  });
34
42
  const remove = useMutation({
35
43
  mutationFn: async (itemId) => fetchWithValidation(`/v1/admin/bookings/${bookingId}/items/${itemId}`, successEnvelope, { baseUrl, fetcher }, { method: "DELETE" }),
36
44
  onSuccess: () => {
37
- void queryClient.invalidateQueries({ queryKey: bookingsQueryKeys.items(bookingId) });
38
- void queryClient.invalidateQueries({ queryKey: bookingsQueryKeys.activity(bookingId) });
45
+ invalidateBookingItemMutationQueries(queryClient, bookingId);
39
46
  },
40
47
  });
41
48
  return { create, update, remove };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voyant-travel/bookings-react",
3
- "version": "0.138.0",
3
+ "version": "0.138.2",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -145,18 +145,18 @@
145
145
  "react-dom": "^19.0.0",
146
146
  "react-hook-form": "^7.80.0",
147
147
  "zod": "^4.0.0",
148
- "@voyant-travel/admin": "^0.115.3",
149
- "@voyant-travel/bookings": "^0.138.0",
148
+ "@voyant-travel/bookings": "^0.138.2",
150
149
  "@voyant-travel/catalog-react": "^0.136.0",
151
- "@voyant-travel/distribution-react": "^0.128.0",
152
- "@voyant-travel/relationships-react": "^0.138.0",
153
- "@voyant-travel/finance-react": "^0.138.0",
150
+ "@voyant-travel/distribution-react": "^0.128.2",
151
+ "@voyant-travel/finance-react": "^0.138.2",
154
152
  "@voyant-travel/identity-react": "^0.138.0",
155
153
  "@voyant-travel/legal-react": "^0.138.0",
156
154
  "@voyant-travel/commerce-react": "^0.20.0",
155
+ "@voyant-travel/relationships-react": "^0.138.0",
157
156
  "@voyant-travel/inventory-react": "^0.20.0",
157
+ "@voyant-travel/operations-react": "^0.19.0",
158
158
  "@voyant-travel/ui": "^0.108.9",
159
- "@voyant-travel/operations-react": "^0.19.0"
159
+ "@voyant-travel/admin": "^0.115.3"
160
160
  },
161
161
  "peerDependenciesMeta": {
162
162
  "@tanstack/react-table": {
@@ -223,11 +223,11 @@
223
223
  "vitest": "^4.1.9",
224
224
  "zod": "^4.4.3",
225
225
  "@voyant-travel/admin": "^0.115.3",
226
- "@voyant-travel/bookings": "^0.138.0",
226
+ "@voyant-travel/bookings": "^0.138.2",
227
227
  "@voyant-travel/catalog-react": "^0.136.0",
228
- "@voyant-travel/distribution-react": "^0.128.0",
229
228
  "@voyant-travel/relationships-react": "^0.138.0",
230
- "@voyant-travel/finance-react": "^0.138.0",
229
+ "@voyant-travel/distribution-react": "^0.128.2",
230
+ "@voyant-travel/finance-react": "^0.138.2",
231
231
  "@voyant-travel/identity-react": "^0.138.0",
232
232
  "@voyant-travel/legal-react": "^0.138.0",
233
233
  "@voyant-travel/commerce-react": "^0.20.0",