@voyant-travel/quotes-react 0.121.0 → 0.123.0

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 (71) hide show
  1. package/dist/admin/index.d.ts +51 -0
  2. package/dist/admin/index.d.ts.map +1 -0
  3. package/dist/admin/index.js +85 -0
  4. package/dist/admin/pages/quote-detail-page.d.ts +13 -0
  5. package/dist/admin/pages/quote-detail-page.d.ts.map +1 -0
  6. package/dist/admin/pages/quote-detail-page.js +397 -0
  7. package/dist/admin/pipeline-dialogs.d.ts +16 -0
  8. package/dist/admin/pipeline-dialogs.d.ts.map +1 -0
  9. package/dist/admin/pipeline-dialogs.js +105 -0
  10. package/dist/admin/quote-content-sections.d.ts +57 -0
  11. package/dist/admin/quote-content-sections.d.ts.map +1 -0
  12. package/dist/admin/quote-content-sections.js +181 -0
  13. package/dist/admin/quote-detail-sections.d.ts +34 -0
  14. package/dist/admin/quote-detail-sections.d.ts.map +1 -0
  15. package/dist/admin/quote-detail-sections.js +52 -0
  16. package/dist/admin/quotes-board-host.d.ts +10 -0
  17. package/dist/admin/quotes-board-host.d.ts.map +1 -0
  18. package/dist/admin/quotes-board-host.js +72 -0
  19. package/dist/hooks/use-quote-media-mutation.d.ts +51 -0
  20. package/dist/hooks/use-quote-media-mutation.d.ts.map +1 -0
  21. package/dist/hooks/use-quote-media-mutation.js +63 -0
  22. package/dist/hooks/use-quote-media.d.ts +21 -0
  23. package/dist/hooks/use-quote-media.d.ts.map +1 -0
  24. package/dist/hooks/use-quote-media.js +19 -0
  25. package/dist/hooks/use-quote-mutation.d.ts +8 -0
  26. package/dist/hooks/use-quote-mutation.d.ts.map +1 -1
  27. package/dist/hooks/use-quote-participant-mutation.d.ts +24 -0
  28. package/dist/hooks/use-quote-participant-mutation.d.ts.map +1 -0
  29. package/dist/hooks/use-quote-participant-mutation.js +28 -0
  30. package/dist/hooks/use-quote-participants.d.ts +15 -0
  31. package/dist/hooks/use-quote-participants.d.ts.map +1 -0
  32. package/dist/hooks/use-quote-participants.js +16 -0
  33. package/dist/hooks/use-quote-product-mutation.d.ts +57 -0
  34. package/dist/hooks/use-quote-product-mutation.d.ts.map +1 -0
  35. package/dist/hooks/use-quote-product-mutation.js +36 -0
  36. package/dist/hooks/use-quote-products.d.ts +22 -0
  37. package/dist/hooks/use-quote-products.d.ts.map +1 -0
  38. package/dist/hooks/use-quote-products.js +19 -0
  39. package/dist/hooks/use-quote-version-mutation.d.ts +79 -0
  40. package/dist/hooks/use-quote-version-mutation.d.ts.map +1 -1
  41. package/dist/hooks/use-quote-version-mutation.js +58 -0
  42. package/dist/hooks/use-quote.d.ts +4 -0
  43. package/dist/hooks/use-quote.d.ts.map +1 -1
  44. package/dist/hooks/use-quotes.d.ts +4 -0
  45. package/dist/hooks/use-quotes.d.ts.map +1 -1
  46. package/dist/i18n/en/commerce.d.ts +145 -0
  47. package/dist/i18n/en/commerce.d.ts.map +1 -1
  48. package/dist/i18n/en/commerce.js +145 -0
  49. package/dist/i18n/en.d.ts +145 -0
  50. package/dist/i18n/en.d.ts.map +1 -1
  51. package/dist/i18n/messages.d.ts +145 -0
  52. package/dist/i18n/messages.d.ts.map +1 -1
  53. package/dist/i18n/provider.d.ts +290 -0
  54. package/dist/i18n/provider.d.ts.map +1 -1
  55. package/dist/i18n/ro/commerce.d.ts +145 -0
  56. package/dist/i18n/ro/commerce.d.ts.map +1 -1
  57. package/dist/i18n/ro/commerce.js +145 -0
  58. package/dist/i18n/ro.d.ts +145 -0
  59. package/dist/i18n/ro.d.ts.map +1 -1
  60. package/dist/index.d.ts +7 -1
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.js +7 -1
  63. package/dist/query-keys.d.ts +3 -0
  64. package/dist/query-keys.d.ts.map +1 -1
  65. package/dist/query-keys.js +3 -0
  66. package/dist/query-options.d.ts +32 -0
  67. package/dist/query-options.d.ts.map +1 -1
  68. package/dist/schemas.d.ts +142 -0
  69. package/dist/schemas.d.ts.map +1 -1
  70. package/dist/schemas.js +47 -0
  71. package/package.json +27 -7
@@ -0,0 +1,63 @@
1
+ "use client";
2
+ import { useMutation, useQueryClient } from "@tanstack/react-query";
3
+ import { fetchWithValidation } from "../client.js";
4
+ import { useVoyantContext } from "../provider.js";
5
+ import { quotesQueryKeys } from "../query-keys.js";
6
+ import { quoteMediaSingleResponse, successEnvelope } from "../schemas.js";
7
+ /** Attach / remove quote media (the upload itself goes through `/v1/uploads`). */
8
+ export function useQuoteMediaMutation() {
9
+ const { baseUrl, fetcher } = useVoyantContext();
10
+ const queryClient = useQueryClient();
11
+ const invalidate = (quoteId) => {
12
+ void queryClient.invalidateQueries({ queryKey: quotesQueryKeys.quoteMedia(quoteId) });
13
+ };
14
+ const create = useMutation({
15
+ mutationFn: async ({ quoteId, input }) => {
16
+ const { data } = await fetchWithValidation(`/v1/quotes/quotes/${quoteId}/media`, quoteMediaSingleResponse, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
17
+ return data;
18
+ },
19
+ onSuccess: (_data, vars) => invalidate(vars.quoteId),
20
+ });
21
+ // Upload a file to the deployment's media store (`/v1/uploads`), then attach
22
+ // the resulting object to the quote. Multipart upload uses a raw cookie-auth
23
+ // fetch (the shared JSON fetcher can't carry FormData).
24
+ const upload = useMutation({
25
+ mutationFn: async ({ quoteId, file }) => {
26
+ const form = new FormData();
27
+ form.append("file", file);
28
+ const res = await fetch(`${baseUrl}/v1/uploads`, {
29
+ method: "POST",
30
+ body: form,
31
+ credentials: "include",
32
+ });
33
+ if (!res.ok)
34
+ throw new Error(`Upload failed (${res.status})`);
35
+ const uploaded = (await res.json());
36
+ const mediaType = uploaded.mimeType.startsWith("video/")
37
+ ? "video"
38
+ : uploaded.mimeType.startsWith("image/")
39
+ ? "image"
40
+ : "document";
41
+ const { data } = await fetchWithValidation(`/v1/quotes/quotes/${quoteId}/media`, quoteMediaSingleResponse, { baseUrl, fetcher }, {
42
+ method: "POST",
43
+ body: JSON.stringify({
44
+ mediaType,
45
+ name: file.name,
46
+ url: uploaded.url,
47
+ storageKey: uploaded.key,
48
+ mimeType: uploaded.mimeType,
49
+ fileSize: uploaded.size,
50
+ }),
51
+ });
52
+ return data;
53
+ },
54
+ onSuccess: (_data, vars) => invalidate(vars.quoteId),
55
+ });
56
+ const remove = useMutation({
57
+ mutationFn: async ({ id }) => {
58
+ await fetchWithValidation(`/v1/quotes/quote-media/${id}`, successEnvelope, { baseUrl, fetcher }, { method: "DELETE" });
59
+ },
60
+ onSuccess: (_data, vars) => invalidate(vars.quoteId),
61
+ });
62
+ return { create, upload, remove };
63
+ }
@@ -0,0 +1,21 @@
1
+ export interface UseQuoteMediaOptions {
2
+ enabled?: boolean;
3
+ }
4
+ /** Lists a quote's media (images / videos / documents shown on the proposal). */
5
+ export declare function useQuoteMedia(quoteId: string | undefined, options?: UseQuoteMediaOptions): import("@tanstack/react-query").UseQueryResult<{
6
+ data: {
7
+ id: string;
8
+ quoteId: string;
9
+ mediaType: string;
10
+ name: string;
11
+ url: string;
12
+ storageKey: string | null;
13
+ mimeType: string | null;
14
+ fileSize: number | null;
15
+ altText: string | null;
16
+ sortOrder: number;
17
+ createdAt: string;
18
+ updatedAt: string;
19
+ }[];
20
+ }, Error>;
21
+ //# sourceMappingURL=use-quote-media.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-quote-media.d.ts","sourceRoot":"","sources":["../../src/hooks/use-quote-media.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,iFAAiF;AACjF,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,GAAE,oBAAyB;;;;;;;;;;;;;;;UAa5F"}
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ import { useQuery } from "@tanstack/react-query";
3
+ import { fetchWithValidation } from "../client.js";
4
+ import { useVoyantContext } from "../provider.js";
5
+ import { quotesQueryKeys } from "../query-keys.js";
6
+ import { quoteMediaListResponse } from "../schemas.js";
7
+ /** Lists a quote's media (images / videos / documents shown on the proposal). */
8
+ export function useQuoteMedia(quoteId, options = {}) {
9
+ const { baseUrl, fetcher } = useVoyantContext();
10
+ const { enabled = true } = options;
11
+ return useQuery({
12
+ queryKey: quotesQueryKeys.quoteMedia(quoteId ?? ""),
13
+ queryFn: () => fetchWithValidation(`/v1/quotes/quotes/${quoteId}/media`, quoteMediaListResponse, {
14
+ baseUrl,
15
+ fetcher,
16
+ }),
17
+ enabled: enabled && Boolean(quoteId),
18
+ });
19
+ }
@@ -30,11 +30,15 @@ export declare function useQuoteMutation(): {
30
30
  acceptedVersionId: string | null;
31
31
  valueAmountCents: number | null;
32
32
  valueCurrency: string | null;
33
+ paxCount: number | null;
34
+ description: string | null;
33
35
  expectedCloseDate: string | null;
34
36
  source: string | null;
35
37
  sourceRef: string | null;
36
38
  lostReason: string | null;
37
39
  tags: string[];
40
+ createdBy: string | null;
41
+ updatedBy: string | null;
38
42
  createdAt: string;
39
43
  updatedAt: string;
40
44
  stageChangedAt: string;
@@ -52,11 +56,15 @@ export declare function useQuoteMutation(): {
52
56
  acceptedVersionId: string | null;
53
57
  valueAmountCents: number | null;
54
58
  valueCurrency: string | null;
59
+ paxCount: number | null;
60
+ description: string | null;
55
61
  expectedCloseDate: string | null;
56
62
  source: string | null;
57
63
  sourceRef: string | null;
58
64
  lostReason: string | null;
59
65
  tags: string[];
66
+ createdBy: string | null;
67
+ updatedBy: string | null;
60
68
  createdAt: string;
61
69
  updatedAt: string;
62
70
  stageChangedAt: string;
@@ -1 +1 @@
1
- {"version":3,"file":"use-quote-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-quote-mutation.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,GAAG,I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AAM,GAAG,IAAI,CAAA;IAChC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;AAIxD,wBAAgB,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAuBY,MAAM;eAAS,gBAAgB;;;;;EAqC1E"}
@@ -0,0 +1,24 @@
1
+ export interface CreateQuoteParticipantInput {
2
+ personId: string;
3
+ role?: "traveler" | "booker" | "decision_maker" | "finance" | "other";
4
+ isPrimary?: boolean;
5
+ }
6
+ /** Add / remove travelers (participants / PAX) on a quote. */
7
+ export declare function useQuoteParticipantMutation(): {
8
+ create: import("@tanstack/react-query").UseMutationResult<{
9
+ id: string;
10
+ quoteId: string;
11
+ personId: string;
12
+ role: string;
13
+ isPrimary: boolean;
14
+ createdAt: string;
15
+ }, Error, {
16
+ quoteId: string;
17
+ input: CreateQuoteParticipantInput;
18
+ }, unknown>;
19
+ remove: import("@tanstack/react-query").UseMutationResult<void, Error, {
20
+ id: string;
21
+ quoteId: string;
22
+ }, unknown>;
23
+ };
24
+ //# sourceMappingURL=use-quote-participant-mutation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-quote-participant-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-quote-participant-mutation.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,UAAU,GAAG,QAAQ,GAAG,gBAAgB,GAAG,SAAS,GAAG,OAAO,CAAA;IACrE,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED,8DAA8D;AAC9D,wBAAgB,2BAA2B;;;;;;;;;iBAa5B,MAAM;eACR,2BAA2B;;;YAcH,MAAM;iBAAW,MAAM;;EAY3D"}
@@ -0,0 +1,28 @@
1
+ "use client";
2
+ import { useMutation, useQueryClient } from "@tanstack/react-query";
3
+ import { fetchWithValidation } from "../client.js";
4
+ import { useVoyantContext } from "../provider.js";
5
+ import { quotesQueryKeys } from "../query-keys.js";
6
+ import { quoteParticipantSingleResponse, successEnvelope } from "../schemas.js";
7
+ /** Add / remove travelers (participants / PAX) on a quote. */
8
+ export function useQuoteParticipantMutation() {
9
+ const { baseUrl, fetcher } = useVoyantContext();
10
+ const queryClient = useQueryClient();
11
+ const invalidate = (quoteId) => {
12
+ void queryClient.invalidateQueries({ queryKey: quotesQueryKeys.quoteParticipants(quoteId) });
13
+ };
14
+ const create = useMutation({
15
+ mutationFn: async ({ quoteId, input, }) => {
16
+ const { data } = await fetchWithValidation(`/v1/quotes/quotes/${quoteId}/participants`, quoteParticipantSingleResponse, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
17
+ return data;
18
+ },
19
+ onSuccess: (_data, vars) => invalidate(vars.quoteId),
20
+ });
21
+ const remove = useMutation({
22
+ mutationFn: async ({ id }) => {
23
+ await fetchWithValidation(`/v1/quotes/quote-participants/${id}`, successEnvelope, { baseUrl, fetcher }, { method: "DELETE" });
24
+ },
25
+ onSuccess: (_data, vars) => invalidate(vars.quoteId),
26
+ });
27
+ return { create, remove };
28
+ }
@@ -0,0 +1,15 @@
1
+ export interface UseQuoteParticipantsOptions {
2
+ enabled?: boolean;
3
+ }
4
+ /** Lists a quote's participants (the travelers / PAX). */
5
+ export declare function useQuoteParticipants(quoteId: string | undefined, options?: UseQuoteParticipantsOptions): import("@tanstack/react-query").UseQueryResult<{
6
+ data: {
7
+ id: string;
8
+ quoteId: string;
9
+ personId: string;
10
+ role: string;
11
+ isPrimary: boolean;
12
+ createdAt: string;
13
+ }[];
14
+ }, Error>;
15
+ //# sourceMappingURL=use-quote-participants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-quote-participants.d.ts","sourceRoot":"","sources":["../../src/hooks/use-quote-participants.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,2BAA2B;IAC1C,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,0DAA0D;AAC1D,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,OAAO,GAAE,2BAAgC;;;;;;;;;UAe1C"}
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ import { useQuery } from "@tanstack/react-query";
3
+ import { fetchWithValidation } from "../client.js";
4
+ import { useVoyantContext } from "../provider.js";
5
+ import { quotesQueryKeys } from "../query-keys.js";
6
+ import { quoteParticipantListResponse } from "../schemas.js";
7
+ /** Lists a quote's participants (the travelers / PAX). */
8
+ export function useQuoteParticipants(quoteId, options = {}) {
9
+ const { baseUrl, fetcher } = useVoyantContext();
10
+ const { enabled = true } = options;
11
+ return useQuery({
12
+ queryKey: quotesQueryKeys.quoteParticipants(quoteId ?? ""),
13
+ queryFn: () => fetchWithValidation(`/v1/quotes/quotes/${quoteId}/participants`, quoteParticipantListResponse, { baseUrl, fetcher }),
14
+ enabled: enabled && Boolean(quoteId),
15
+ });
16
+ }
@@ -0,0 +1,57 @@
1
+ export interface CreateQuoteProductInput {
2
+ nameSnapshot: string;
3
+ quantity?: number;
4
+ unitPriceAmountCents?: number | null;
5
+ currency?: string | null;
6
+ description?: string | null;
7
+ productId?: string | null;
8
+ supplierServiceId?: string | null;
9
+ costAmountCents?: number | null;
10
+ discountAmountCents?: number | null;
11
+ }
12
+ export type UpdateQuoteProductInput = Partial<CreateQuoteProductInput>;
13
+ /** Create / update / remove a quote's line-item products. */
14
+ export declare function useQuoteProductMutation(): {
15
+ create: import("@tanstack/react-query").UseMutationResult<{
16
+ id: string;
17
+ quoteId: string;
18
+ productId: string | null;
19
+ supplierServiceId: string | null;
20
+ nameSnapshot: string;
21
+ description: string | null;
22
+ quantity: number;
23
+ unitPriceAmountCents: number | null;
24
+ costAmountCents: number | null;
25
+ currency: string | null;
26
+ discountAmountCents: number | null;
27
+ createdAt: string;
28
+ updatedAt: string;
29
+ }, Error, {
30
+ quoteId: string;
31
+ input: CreateQuoteProductInput;
32
+ }, unknown>;
33
+ update: import("@tanstack/react-query").UseMutationResult<{
34
+ id: string;
35
+ quoteId: string;
36
+ productId: string | null;
37
+ supplierServiceId: string | null;
38
+ nameSnapshot: string;
39
+ description: string | null;
40
+ quantity: number;
41
+ unitPriceAmountCents: number | null;
42
+ costAmountCents: number | null;
43
+ currency: string | null;
44
+ discountAmountCents: number | null;
45
+ createdAt: string;
46
+ updatedAt: string;
47
+ }, Error, {
48
+ id: string;
49
+ quoteId: string;
50
+ input: UpdateQuoteProductInput;
51
+ }, unknown>;
52
+ remove: import("@tanstack/react-query").UseMutationResult<void, Error, {
53
+ id: string;
54
+ quoteId: string;
55
+ }, unknown>;
56
+ };
57
+ //# sourceMappingURL=use-quote-product-mutation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-quote-product-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-quote-product-mutation.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,uBAAuB;IACtC,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACpC;AAED,MAAM,MAAM,uBAAuB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAA;AAEtE,6DAA6D;AAC7D,wBAAgB,uBAAuB;;;;;;;;;;;;;;;;iBAUe,MAAM;eAAS,uBAAuB;;;;;;;;;;;;;;;;;YAiBlF,MAAM;iBACD,MAAM;eACR,uBAAuB;;;YAcC,MAAM;iBAAW,MAAM;;EAY3D"}
@@ -0,0 +1,36 @@
1
+ "use client";
2
+ import { useMutation, useQueryClient } from "@tanstack/react-query";
3
+ import { fetchWithValidation } from "../client.js";
4
+ import { useVoyantContext } from "../provider.js";
5
+ import { quotesQueryKeys } from "../query-keys.js";
6
+ import { quoteProductSingleResponse, successEnvelope } from "../schemas.js";
7
+ /** Create / update / remove a quote's line-item products. */
8
+ export function useQuoteProductMutation() {
9
+ const { baseUrl, fetcher } = useVoyantContext();
10
+ const queryClient = useQueryClient();
11
+ const invalidate = (quoteId) => {
12
+ void queryClient.invalidateQueries({ queryKey: quotesQueryKeys.quoteProducts(quoteId) });
13
+ void queryClient.invalidateQueries({ queryKey: quotesQueryKeys.quote(quoteId) });
14
+ };
15
+ const create = useMutation({
16
+ mutationFn: async ({ quoteId, input }) => {
17
+ const { data } = await fetchWithValidation(`/v1/quotes/quotes/${quoteId}/products`, quoteProductSingleResponse, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
18
+ return data;
19
+ },
20
+ onSuccess: (_data, vars) => invalidate(vars.quoteId),
21
+ });
22
+ const update = useMutation({
23
+ mutationFn: async ({ id, input, }) => {
24
+ const { data } = await fetchWithValidation(`/v1/quotes/quote-products/${id}`, quoteProductSingleResponse, { baseUrl, fetcher }, { method: "PATCH", body: JSON.stringify(input) });
25
+ return data;
26
+ },
27
+ onSuccess: (_data, vars) => invalidate(vars.quoteId),
28
+ });
29
+ const remove = useMutation({
30
+ mutationFn: async ({ id }) => {
31
+ await fetchWithValidation(`/v1/quotes/quote-products/${id}`, successEnvelope, { baseUrl, fetcher }, { method: "DELETE" });
32
+ },
33
+ onSuccess: (_data, vars) => invalidate(vars.quoteId),
34
+ });
35
+ return { create, update, remove };
36
+ }
@@ -0,0 +1,22 @@
1
+ export interface UseQuoteProductsOptions {
2
+ enabled?: boolean;
3
+ }
4
+ /** Lists a quote's products — the line items (flights, stays, experiences, …). */
5
+ export declare function useQuoteProducts(quoteId: string | undefined, options?: UseQuoteProductsOptions): import("@tanstack/react-query").UseQueryResult<{
6
+ data: {
7
+ id: string;
8
+ quoteId: string;
9
+ productId: string | null;
10
+ supplierServiceId: string | null;
11
+ nameSnapshot: string;
12
+ description: string | null;
13
+ quantity: number;
14
+ unitPriceAmountCents: number | null;
15
+ costAmountCents: number | null;
16
+ currency: string | null;
17
+ discountAmountCents: number | null;
18
+ createdAt: string;
19
+ updatedAt: string;
20
+ }[];
21
+ }, Error>;
22
+ //# sourceMappingURL=use-quote-products.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-quote-products.d.ts","sourceRoot":"","sources":["../../src/hooks/use-quote-products.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,kFAAkF;AAClF,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,OAAO,GAAE,uBAA4B;;;;;;;;;;;;;;;;UActC"}
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ import { useQuery } from "@tanstack/react-query";
3
+ import { fetchWithValidation } from "../client.js";
4
+ import { useVoyantContext } from "../provider.js";
5
+ import { quotesQueryKeys } from "../query-keys.js";
6
+ import { quoteProductListResponse } from "../schemas.js";
7
+ /** Lists a quote's products — the line items (flights, stays, experiences, …). */
8
+ export function useQuoteProducts(quoteId, options = {}) {
9
+ const { baseUrl, fetcher } = useVoyantContext();
10
+ const { enabled = true } = options;
11
+ return useQuery({
12
+ queryKey: quotesQueryKeys.quoteProducts(quoteId ?? ""),
13
+ queryFn: () => fetchWithValidation(`/v1/quotes/quotes/${quoteId}/products`, quoteProductListResponse, {
14
+ baseUrl,
15
+ fetcher,
16
+ }),
17
+ enabled: enabled && Boolean(quoteId),
18
+ });
19
+ }
@@ -56,6 +56,81 @@ export declare function useQuoteVersionMutation(): {
56
56
  quoteId: string;
57
57
  input: CreateQuoteVersionInput;
58
58
  }, unknown>;
59
+ snapshot: import("@tanstack/react-query").UseMutationResult<{
60
+ id: string;
61
+ quoteId: string;
62
+ label: string | null;
63
+ status: string;
64
+ supersedesId: string | null;
65
+ tripSnapshotId: string | null;
66
+ validUntil: string | null;
67
+ currency: string;
68
+ subtotalAmountCents: number;
69
+ taxAmountCents: number;
70
+ totalAmountCents: number;
71
+ notes: string | null;
72
+ sentAt: string | null;
73
+ viewedAt: string | null;
74
+ decidedAt: string | null;
75
+ createdAt: string;
76
+ updatedAt: string;
77
+ archivedAt: string | null;
78
+ }, Error, {
79
+ quoteId: string;
80
+ }, unknown>;
81
+ sendProposal: import("@tanstack/react-query").UseMutationResult<{
82
+ quoteVersion: {
83
+ id: string;
84
+ quoteId: string;
85
+ label: string | null;
86
+ status: string;
87
+ supersedesId: string | null;
88
+ tripSnapshotId: string | null;
89
+ validUntil: string | null;
90
+ currency: string;
91
+ subtotalAmountCents: number;
92
+ taxAmountCents: number;
93
+ totalAmountCents: number;
94
+ notes: string | null;
95
+ sentAt: string | null;
96
+ viewedAt: string | null;
97
+ decidedAt: string | null;
98
+ createdAt: string;
99
+ updatedAt: string;
100
+ archivedAt: string | null;
101
+ };
102
+ proposalUrl: string;
103
+ }, Error, {
104
+ id: string;
105
+ }, unknown>;
106
+ fetchProposalLink: import("@tanstack/react-query").UseMutationResult<{
107
+ proposalUrl: string;
108
+ }, Error, {
109
+ id: string;
110
+ }, unknown>;
111
+ setValidUntil: import("@tanstack/react-query").UseMutationResult<{
112
+ id: string;
113
+ quoteId: string;
114
+ label: string | null;
115
+ status: string;
116
+ supersedesId: string | null;
117
+ tripSnapshotId: string | null;
118
+ validUntil: string | null;
119
+ currency: string;
120
+ subtotalAmountCents: number;
121
+ taxAmountCents: number;
122
+ totalAmountCents: number;
123
+ notes: string | null;
124
+ sentAt: string | null;
125
+ viewedAt: string | null;
126
+ decidedAt: string | null;
127
+ createdAt: string;
128
+ updatedAt: string;
129
+ archivedAt: string | null;
130
+ }, Error, {
131
+ id: string;
132
+ validUntil: string | null;
133
+ }, unknown>;
59
134
  update: import("@tanstack/react-query").UseMutationResult<{
60
135
  id: string;
61
136
  quoteId: string;
@@ -158,11 +233,15 @@ export declare function useQuoteVersionMutation(): {
158
233
  acceptedVersionId: string | null;
159
234
  valueAmountCents: number | null;
160
235
  valueCurrency: string | null;
236
+ paxCount: number | null;
237
+ description: string | null;
161
238
  expectedCloseDate: string | null;
162
239
  source: string | null;
163
240
  sourceRef: string | null;
164
241
  lostReason: string | null;
165
242
  tags: string[];
243
+ createdBy: string | null;
244
+ updatedBy: string | null;
166
245
  createdAt: string;
167
246
  updatedAt: string;
168
247
  stageChangedAt: string;
@@ -1 +1 @@
1
- {"version":3,"file":"use-quote-version-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-quote-version-mutation.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,K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EAAE,MAAM,CAAA;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED,MAAM,MAAM,2BAA2B,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAA;AAK9E,wBAAgB,uBAAuB;;;;;;;;;;;;;;;;;;;;;iBAKe,MAAM;eAAS,uBAAuB;;;;;;;;;;;;;;;;;;;;;;iBAsB7C,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;YAuChB,MAAM;;;;;YAwBN,MAAM;;;;;;;;;;;;;;;;;;;;;;YA1CM,MAAM;oBAAc,MAAM,GAAG,IAAI;;;;;;;;;;;;;;;;;;;;;;YAsDtC,MAAM;eAAS,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;YAgCtC,MAAM;gBAAU,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAqG3D,MAAM;eACf,2BAA2B;;;;;;;;;;;;;;;wBA0BlB,MAAM;gBACd,MAAM;eACP,2BAA2B;;;;;wBAyBlB,MAAM;gBACd,MAAM;;EAoCnB"}
@@ -23,6 +23,60 @@ export function useQuoteVersionMutation() {
23
23
  void queryClient.invalidateQueries({ queryKey: quotesQueryKeys.quote(vars.quoteId) });
24
24
  },
25
25
  });
26
+ // Snapshot the quote's current line items into a new version (the "Save"
27
+ // action). The server copies products → version lines, computes the total,
28
+ // and supersedes the prior current version.
29
+ const snapshot = useMutation({
30
+ mutationFn: async ({ quoteId }) => {
31
+ const { data } = await fetchWithValidation(`/v1/quotes/quotes/${quoteId}/versions/snapshot`, quoteVersionSingleResponse, { baseUrl, fetcher }, { method: "POST" });
32
+ return data;
33
+ },
34
+ onSuccess: (_data, vars) => {
35
+ void queryClient.invalidateQueries({ queryKey: quotesQueryKeys.quoteVersions() });
36
+ void queryClient.invalidateQueries({
37
+ queryKey: quotesQueryKeys.quoteVersionsList({ quoteId: vars.quoteId }),
38
+ });
39
+ void queryClient.invalidateQueries({ queryKey: quotesQueryKeys.quote(vars.quoteId) });
40
+ },
41
+ });
42
+ // Narrow validity-date update (the generic update schema carries insert
43
+ // defaults that would clobber status/totals — see the service note).
44
+ const setValidUntil = useMutation({
45
+ mutationFn: async ({ id, validUntil }) => {
46
+ const { data } = await fetchWithValidation(`/v1/quotes/quote-versions/${id}/validity`, quoteVersionSingleResponse, { baseUrl, fetcher }, { method: "PATCH", body: JSON.stringify({ validUntil }) });
47
+ return data;
48
+ },
49
+ onSuccess: (data) => {
50
+ void queryClient.invalidateQueries({ queryKey: quotesQueryKeys.quoteVersions() });
51
+ void queryClient.invalidateQueries({ queryKey: quotesQueryKeys.quote(data.quoteId) });
52
+ },
53
+ });
54
+ // Send a version to the client for review (proposal admin route). Marks it
55
+ // "sent" and returns the shareable proposal URL.
56
+ const sendProposal = useMutation({
57
+ mutationFn: async ({ id }) => {
58
+ const { data } = await fetchWithValidation(`/v1/admin/quote-versions/${id}/send`, z.object({
59
+ data: z.object({ quoteVersion: quoteVersionRecordSchema, proposalUrl: z.string() }),
60
+ }), { baseUrl, fetcher }, { method: "POST", body: JSON.stringify({}) });
61
+ return data;
62
+ },
63
+ onSuccess: (data) => {
64
+ void queryClient.invalidateQueries({ queryKey: quotesQueryKeys.quoteVersions() });
65
+ void queryClient.invalidateQueries({
66
+ queryKey: quotesQueryKeys.quote(data.quoteVersion.quoteId),
67
+ });
68
+ },
69
+ });
70
+ // Resolve the deployment's shareable proposal URL for an already-sent
71
+ // version without side effects (no re-send, no view tracking) — used when
72
+ // re-copying the review link. Returns the same deployment-resolved URL the
73
+ // initial send produced.
74
+ const fetchProposalLink = useMutation({
75
+ mutationFn: async ({ id }) => {
76
+ const { data } = await fetchWithValidation(`/v1/admin/quote-versions/${id}/proposal-link`, z.object({ data: z.object({ proposalUrl: z.string() }) }), { baseUrl, fetcher }, { method: "GET" });
77
+ return data;
78
+ },
79
+ });
26
80
  const update = useMutation({
27
81
  mutationFn: async ({ id, input }) => {
28
82
  const { data } = await fetchWithValidation(`/v1/quotes/quote-versions/${id}`, quoteVersionSingleResponse, { baseUrl, fetcher }, { method: "PATCH", body: JSON.stringify(input) });
@@ -150,6 +204,10 @@ export function useQuoteVersionMutation() {
150
204
  });
151
205
  return {
152
206
  create,
207
+ snapshot,
208
+ sendProposal,
209
+ fetchProposalLink,
210
+ setValidUntil,
153
211
  update,
154
212
  remove,
155
213
  send,
@@ -13,11 +13,15 @@ export declare function useQuote(id: string | undefined, options?: UseQuoteOptio
13
13
  acceptedVersionId: string | null;
14
14
  valueAmountCents: number | null;
15
15
  valueCurrency: string | null;
16
+ paxCount: number | null;
17
+ description: string | null;
16
18
  expectedCloseDate: string | null;
17
19
  source: string | null;
18
20
  sourceRef: string | null;
19
21
  lostReason: string | null;
20
22
  tags: string[];
23
+ createdBy: string | null;
24
+ updatedBy: string | null;
21
25
  createdAt: string;
22
26
  updatedAt: string;
23
27
  stageChangedAt: string;
@@ -1 +1 @@
1
- {"version":3,"file":"use-quote.d.ts","sourceRoot":"","sources":["../../src/hooks/use-quote.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,GAAE,eAAoB;;;;;;;;;;;;;;;;;;;;;UAgB7E"}
1
+ {"version":3,"file":"use-quote.d.ts","sourceRoot":"","sources":["../../src/hooks/use-quote.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,GAAE,eAAoB;;;;;;;;;;;;;;;;;;;;;;;;;UAgB7E"}
@@ -19,11 +19,15 @@ export declare function useQuotes(options?: UseQuotesOptions): import("@tanstack
19
19
  acceptedVersionId: string | null;
20
20
  valueAmountCents: number | null;
21
21
  valueCurrency: string | null;
22
+ paxCount: number | null;
23
+ description: string | null;
22
24
  expectedCloseDate: string | null;
23
25
  source: string | null;
24
26
  sourceRef: string | null;
25
27
  lostReason: string | null;
26
28
  tags: string[];
29
+ createdBy: string | null;
30
+ updatedBy: string | null;
27
31
  createdAt: string;
28
32
  updatedAt: string;
29
33
  stageChangedAt: string;
@@ -1 +1 @@
1
- {"version":3,"file":"use-quotes.d.ts","sourceRoot":"","sources":["../../src/hooks/use-quotes.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,iBAAiB,EAAmB,MAAM,kBAAkB,CAAA;AAG1E,MAAM,WAAW,gBAAiB,SAAQ,iBAAiB;IACzD,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,OAAO,GAAE,gBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;UAyBvD"}
1
+ {"version":3,"file":"use-quotes.d.ts","sourceRoot":"","sources":["../../src/hooks/use-quotes.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,iBAAiB,EAAmB,MAAM,kBAAkB,CAAA;AAG1E,MAAM,WAAW,gBAAiB,SAAQ,iBAAiB;IACzD,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,OAAO,GAAE,gBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAyBvD"}