@voyant-travel/bookings-react 0.138.1 → 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;
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
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/bookings": "^0.138.
|
|
149
|
-
"@voyant-travel/distribution-react": "^0.128.2",
|
|
150
|
-
"@voyant-travel/relationships-react": "^0.138.0",
|
|
148
|
+
"@voyant-travel/bookings": "^0.138.2",
|
|
151
149
|
"@voyant-travel/catalog-react": "^0.136.0",
|
|
150
|
+
"@voyant-travel/distribution-react": "^0.128.2",
|
|
151
|
+
"@voyant-travel/finance-react": "^0.138.2",
|
|
152
152
|
"@voyant-travel/identity-react": "^0.138.0",
|
|
153
153
|
"@voyant-travel/legal-react": "^0.138.0",
|
|
154
|
-
"@voyant-travel/admin": "^0.115.3",
|
|
155
154
|
"@voyant-travel/commerce-react": "^0.20.0",
|
|
156
|
-
"@voyant-travel/
|
|
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/
|
|
159
|
+
"@voyant-travel/admin": "^0.115.3"
|
|
160
160
|
},
|
|
161
161
|
"peerDependenciesMeta": {
|
|
162
162
|
"@tanstack/react-table": {
|
|
@@ -204,10 +204,10 @@
|
|
|
204
204
|
},
|
|
205
205
|
"dependencies": {
|
|
206
206
|
"sonner": "^2.0.7",
|
|
207
|
+
"@voyant-travel/catalog-contracts": "^0.108.0",
|
|
207
208
|
"@voyant-travel/i18n": "^0.109.6",
|
|
208
209
|
"@voyant-travel/react": "^0.104.1",
|
|
209
|
-
"@voyant-travel/types": "^0.106.1"
|
|
210
|
-
"@voyant-travel/catalog-contracts": "^0.108.0"
|
|
210
|
+
"@voyant-travel/types": "^0.106.1"
|
|
211
211
|
},
|
|
212
212
|
"devDependencies": {
|
|
213
213
|
"@tanstack/react-query": "^5.101.2",
|
|
@@ -222,15 +222,15 @@
|
|
|
222
222
|
"typescript": "^6.0.3",
|
|
223
223
|
"vitest": "^4.1.9",
|
|
224
224
|
"zod": "^4.4.3",
|
|
225
|
-
"@voyant-travel/bookings": "^0.138.1",
|
|
226
225
|
"@voyant-travel/admin": "^0.115.3",
|
|
226
|
+
"@voyant-travel/bookings": "^0.138.2",
|
|
227
227
|
"@voyant-travel/catalog-react": "^0.136.0",
|
|
228
|
+
"@voyant-travel/relationships-react": "^0.138.0",
|
|
228
229
|
"@voyant-travel/distribution-react": "^0.128.2",
|
|
229
|
-
"@voyant-travel/finance-react": "^0.138.
|
|
230
|
+
"@voyant-travel/finance-react": "^0.138.2",
|
|
230
231
|
"@voyant-travel/identity-react": "^0.138.0",
|
|
231
|
-
"@voyant-travel/relationships-react": "^0.138.0",
|
|
232
|
-
"@voyant-travel/commerce-react": "^0.20.0",
|
|
233
232
|
"@voyant-travel/legal-react": "^0.138.0",
|
|
233
|
+
"@voyant-travel/commerce-react": "^0.20.0",
|
|
234
234
|
"@voyant-travel/inventory-react": "^0.20.0",
|
|
235
235
|
"@voyant-travel/react": "^0.104.1",
|
|
236
236
|
"@voyant-travel/ui": "^0.108.9",
|