@voyantjs/booking-requirements-react 0.3.0 → 0.3.1

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.
@@ -2,4 +2,5 @@ export * from "./use-booking-questions.js";
2
2
  export * from "./use-contact-requirements.js";
3
3
  export * from "./use-products.js";
4
4
  export * from "./use-question-options.js";
5
+ export * from "./use-transport-requirements.js";
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAEA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,mBAAmB,CAAA;AACjC,cAAc,2BAA2B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAEA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,mBAAmB,CAAA;AACjC,cAAc,2BAA2B,CAAA;AACzC,cAAc,iCAAiC,CAAA"}
@@ -3,3 +3,4 @@ export * from "./use-booking-questions.js";
3
3
  export * from "./use-contact-requirements.js";
4
4
  export * from "./use-products.js";
5
5
  export * from "./use-question-options.js";
6
+ export * from "./use-transport-requirements.js";
@@ -0,0 +1,30 @@
1
+ import type { TransportRequirementsFilters } from "../query-keys.js";
2
+ export interface UseTransportRequirementsOptions extends TransportRequirementsFilters {
3
+ enabled?: boolean;
4
+ }
5
+ export declare function useTransportRequirements(options: UseTransportRequirementsOptions): import("@tanstack/react-query").UseQueryResult<{
6
+ data: {
7
+ productId: string;
8
+ optionId: string | null;
9
+ hasTransport: boolean;
10
+ requiresPassengerDocuments: boolean;
11
+ requiresPassport: boolean;
12
+ requiresNationality: boolean;
13
+ requiresDateOfBirth: boolean;
14
+ requiredFields: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
15
+ fieldsByScope: {
16
+ booking: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
17
+ lead_traveler: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
18
+ participant: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
19
+ booker: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
20
+ };
21
+ requirements: {
22
+ fieldKey: "date_of_birth" | "nationality" | "passport_number" | "passport_expiry";
23
+ scope: "booking" | "participant" | "lead_traveler" | "booker";
24
+ isRequired: boolean;
25
+ perParticipant: boolean;
26
+ notes: string | null;
27
+ }[];
28
+ };
29
+ }, Error>;
30
+ //# sourceMappingURL=use-transport-requirements.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-transport-requirements.d.ts","sourceRoot":"","sources":["../../src/hooks/use-transport-requirements.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAA;AAGpE,MAAM,WAAW,+BAAgC,SAAQ,4BAA4B;IACnF,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;UAIhF"}
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ import { useQuery } from "@tanstack/react-query";
3
+ import { useVoyantBookingRequirementsContext } from "../provider.js";
4
+ import { getTransportRequirementsQueryOptions } from "../query-options.js";
5
+ export function useTransportRequirements(options) {
6
+ const client = useVoyantBookingRequirementsContext();
7
+ const { enabled = true } = options;
8
+ return useQuery({ ...getTransportRequirementsQueryOptions(client, options), enabled });
9
+ }
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ export * from "./constants.js";
3
3
  export * from "./hooks/index.js";
4
4
  export { useVoyantBookingRequirementsContext, type VoyantBookingRequirementsContextValue, VoyantBookingRequirementsProvider, type VoyantBookingRequirementsProviderProps, } from "./provider.js";
5
5
  export { bookingRequirementsQueryKeys } from "./query-keys.js";
6
- export { getBookingQuestionsQueryOptions, getContactRequirementsQueryOptions, getProductsQueryOptions, getQuestionOptionsQueryOptions, } from "./query-options.js";
6
+ export { getBookingQuestionsQueryOptions, getContactRequirementsQueryOptions, getProductsQueryOptions, getQuestionOptionsQueryOptions, getTransportRequirementsQueryOptions, } from "./query-options.js";
7
7
  export * from "./schemas.js";
8
8
  export * from "./utils.js";
9
9
  //# 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,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,OAAO,EACL,mCAAmC,EACnC,KAAK,qCAAqC,EAC1C,iCAAiC,EACjC,KAAK,sCAAsC,GAC5C,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAA;AAC9D,OAAO,EACL,+BAA+B,EAC/B,kCAAkC,EAClC,uBAAuB,EACvB,8BAA8B,GAC/B,MAAM,oBAAoB,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,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,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,OAAO,EACL,mCAAmC,EACnC,KAAK,qCAAqC,EAC1C,iCAAiC,EACjC,KAAK,sCAAsC,GAC5C,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAA;AAC9D,OAAO,EACL,+BAA+B,EAC/B,kCAAkC,EAClC,uBAAuB,EACvB,8BAA8B,EAC9B,oCAAoC,GACrC,MAAM,oBAAoB,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA"}
package/dist/index.js CHANGED
@@ -3,6 +3,6 @@ export * from "./constants.js";
3
3
  export * from "./hooks/index.js";
4
4
  export { useVoyantBookingRequirementsContext, VoyantBookingRequirementsProvider, } from "./provider.js";
5
5
  export { bookingRequirementsQueryKeys } from "./query-keys.js";
6
- export { getBookingQuestionsQueryOptions, getContactRequirementsQueryOptions, getProductsQueryOptions, getQuestionOptionsQueryOptions, } from "./query-options.js";
6
+ export { getBookingQuestionsQueryOptions, getContactRequirementsQueryOptions, getProductsQueryOptions, getQuestionOptionsQueryOptions, getTransportRequirementsQueryOptions, } from "./query-options.js";
7
7
  export * from "./schemas.js";
8
8
  export * from "./utils.js";
@@ -13,6 +13,10 @@ export interface BookingQuestionsListFilters extends PaginationFilters {
13
13
  export interface BookingQuestionOptionsListFilters extends PaginationFilters {
14
14
  productBookingQuestionId?: string | undefined;
15
15
  }
16
+ export interface TransportRequirementsFilters {
17
+ productId: string;
18
+ optionId?: string | undefined;
19
+ }
16
20
  export declare const bookingRequirementsQueryKeys: {
17
21
  readonly all: readonly ["voyant", "booking-requirements"];
18
22
  readonly products: () => readonly ["voyant", "booking-requirements", "products"];
@@ -23,5 +27,7 @@ export declare const bookingRequirementsQueryKeys: {
23
27
  readonly questionsList: (filters: BookingQuestionsListFilters) => readonly ["voyant", "booking-requirements", "questions", "list", BookingQuestionsListFilters];
24
28
  readonly questionOptions: () => readonly ["voyant", "booking-requirements", "question-options"];
25
29
  readonly questionOptionsList: (filters: BookingQuestionOptionsListFilters) => readonly ["voyant", "booking-requirements", "question-options", "list", BookingQuestionOptionsListFilters];
30
+ readonly transportRequirements: () => readonly ["voyant", "booking-requirements", "transport-requirements"];
31
+ readonly transportRequirementsDetail: (filters: TransportRequirementsFilters) => readonly ["voyant", "booking-requirements", "transport-requirements", "detail", TransportRequirementsFilters];
26
32
  };
27
33
  //# sourceMappingURL=query-keys.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"query-keys.d.ts","sourceRoot":"","sources":["../src/query-keys.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC5B;AAED,MAAM,WAAW,mBAAoB,SAAQ,iBAAiB;CAAG;AAEjE,MAAM,WAAW,8BAA+B,SAAQ,iBAAiB;IACvE,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC/B;AAED,MAAM,WAAW,2BAA4B,SAAQ,iBAAiB;IACpE,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC/B;AAED,MAAM,WAAW,iCAAkC,SAAQ,iBAAiB;IAC1E,wBAAwB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC9C;AAED,eAAO,MAAM,4BAA4B;;;qCAIf,mBAAmB;;gDAIR,8BAA8B;;sCAIxC,2BAA2B;;4CAIrB,iCAAiC;CAExD,CAAA"}
1
+ {"version":3,"file":"query-keys.d.ts","sourceRoot":"","sources":["../src/query-keys.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC5B;AAED,MAAM,WAAW,mBAAoB,SAAQ,iBAAiB;CAAG;AAEjE,MAAM,WAAW,8BAA+B,SAAQ,iBAAiB;IACvE,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC/B;AAED,MAAM,WAAW,2BAA4B,SAAQ,iBAAiB;IACpE,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC/B;AAED,MAAM,WAAW,iCAAkC,SAAQ,iBAAiB;IAC1E,wBAAwB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC9C;AAED,MAAM,WAAW,4BAA4B;IAC3C,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC9B;AAED,eAAO,MAAM,4BAA4B;;;qCAIf,mBAAmB;;gDAIR,8BAA8B;;sCAIxC,2BAA2B;;4CAIrB,iCAAiC;;oDAKzB,4BAA4B;CAE3D,CAAA"}
@@ -8,4 +8,6 @@ export const bookingRequirementsQueryKeys = {
8
8
  questionsList: (filters) => [...bookingRequirementsQueryKeys.questions(), "list", filters],
9
9
  questionOptions: () => [...bookingRequirementsQueryKeys.all, "question-options"],
10
10
  questionOptionsList: (filters) => [...bookingRequirementsQueryKeys.questionOptions(), "list", filters],
11
+ transportRequirements: () => [...bookingRequirementsQueryKeys.all, "transport-requirements"],
12
+ transportRequirementsDetail: (filters) => [...bookingRequirementsQueryKeys.transportRequirements(), "detail", filters],
11
13
  };
@@ -3,6 +3,7 @@ import type { UseBookingQuestionsOptions } from "./hooks/use-booking-questions.j
3
3
  import type { UseContactRequirementsOptions } from "./hooks/use-contact-requirements.js";
4
4
  import type { UseProductsOptions } from "./hooks/use-products.js";
5
5
  import type { UseQuestionOptionsOptions } from "./hooks/use-question-options.js";
6
+ import type { UseTransportRequirementsOptions } from "./hooks/use-transport-requirements.js";
6
7
  export declare function getProductsQueryOptions(client: FetchWithValidationOptions, options?: UseProductsOptions): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<{
7
8
  data: {
8
9
  id: string;
@@ -263,4 +264,108 @@ export declare function getQuestionOptionsQueryOptions(client: FetchWithValidati
263
264
  [dataTagErrorSymbol]: Error;
264
265
  };
265
266
  };
267
+ export declare function getTransportRequirementsQueryOptions(client: FetchWithValidationOptions, options: UseTransportRequirementsOptions): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<{
268
+ data: {
269
+ productId: string;
270
+ optionId: string | null;
271
+ hasTransport: boolean;
272
+ requiresPassengerDocuments: boolean;
273
+ requiresPassport: boolean;
274
+ requiresNationality: boolean;
275
+ requiresDateOfBirth: boolean;
276
+ requiredFields: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
277
+ fieldsByScope: {
278
+ booking: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
279
+ lead_traveler: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
280
+ participant: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
281
+ booker: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
282
+ };
283
+ requirements: {
284
+ fieldKey: "date_of_birth" | "nationality" | "passport_number" | "passport_expiry";
285
+ scope: "booking" | "participant" | "lead_traveler" | "booker";
286
+ isRequired: boolean;
287
+ perParticipant: boolean;
288
+ notes: string | null;
289
+ }[];
290
+ };
291
+ }, Error, {
292
+ data: {
293
+ productId: string;
294
+ optionId: string | null;
295
+ hasTransport: boolean;
296
+ requiresPassengerDocuments: boolean;
297
+ requiresPassport: boolean;
298
+ requiresNationality: boolean;
299
+ requiresDateOfBirth: boolean;
300
+ requiredFields: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
301
+ fieldsByScope: {
302
+ booking: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
303
+ lead_traveler: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
304
+ participant: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
305
+ booker: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
306
+ };
307
+ requirements: {
308
+ fieldKey: "date_of_birth" | "nationality" | "passport_number" | "passport_expiry";
309
+ scope: "booking" | "participant" | "lead_traveler" | "booker";
310
+ isRequired: boolean;
311
+ perParticipant: boolean;
312
+ notes: string | null;
313
+ }[];
314
+ };
315
+ }, readonly ["voyant", "booking-requirements", "transport-requirements", "detail", import("./query-keys.js").TransportRequirementsFilters]>, "queryFn"> & {
316
+ queryFn?: import("@tanstack/react-query").QueryFunction<{
317
+ data: {
318
+ productId: string;
319
+ optionId: string | null;
320
+ hasTransport: boolean;
321
+ requiresPassengerDocuments: boolean;
322
+ requiresPassport: boolean;
323
+ requiresNationality: boolean;
324
+ requiresDateOfBirth: boolean;
325
+ requiredFields: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
326
+ fieldsByScope: {
327
+ booking: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
328
+ lead_traveler: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
329
+ participant: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
330
+ booker: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
331
+ };
332
+ requirements: {
333
+ fieldKey: "date_of_birth" | "nationality" | "passport_number" | "passport_expiry";
334
+ scope: "booking" | "participant" | "lead_traveler" | "booker";
335
+ isRequired: boolean;
336
+ perParticipant: boolean;
337
+ notes: string | null;
338
+ }[];
339
+ };
340
+ }, readonly ["voyant", "booking-requirements", "transport-requirements", "detail", import("./query-keys.js").TransportRequirementsFilters], never> | undefined;
341
+ } & {
342
+ queryKey: readonly ["voyant", "booking-requirements", "transport-requirements", "detail", import("./query-keys.js").TransportRequirementsFilters] & {
343
+ [dataTagSymbol]: {
344
+ data: {
345
+ productId: string;
346
+ optionId: string | null;
347
+ hasTransport: boolean;
348
+ requiresPassengerDocuments: boolean;
349
+ requiresPassport: boolean;
350
+ requiresNationality: boolean;
351
+ requiresDateOfBirth: boolean;
352
+ requiredFields: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
353
+ fieldsByScope: {
354
+ booking: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
355
+ lead_traveler: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
356
+ participant: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
357
+ booker: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
358
+ };
359
+ requirements: {
360
+ fieldKey: "date_of_birth" | "nationality" | "passport_number" | "passport_expiry";
361
+ scope: "booking" | "participant" | "lead_traveler" | "booker";
362
+ isRequired: boolean;
363
+ perParticipant: boolean;
364
+ notes: string | null;
365
+ }[];
366
+ };
367
+ };
368
+ [dataTagErrorSymbol]: Error;
369
+ };
370
+ };
266
371
  //# sourceMappingURL=query-options.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"query-options.d.ts","sourceRoot":"","sources":["../src/query-options.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,0BAA0B,EAAuB,MAAM,aAAa,CAAA;AAClF,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAA;AAClF,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,qCAAqC,CAAA;AACxF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAA;AAchF,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,0BAA0B,EAClC,OAAO,GAAE,kBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBjC;AAED,wBAAgB,kCAAkC,CAChD,MAAM,EAAE,0BAA0B,EAClC,OAAO,GAAE,6BAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiB5C;AAED,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,0BAA0B,EAClC,OAAO,GAAE,0BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBzC;AAED,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,0BAA0B,EAClC,OAAO,GAAE,yBAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmBxC"}
1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;;;;;;;;;;;;;;;;;;;;;;EAgBzC"}
@@ -1,8 +1,9 @@
1
1
  "use client";
2
2
  import { queryOptions } from "@tanstack/react-query";
3
+ import { z } from "zod";
3
4
  import { fetchWithValidation } from "./client.js";
4
5
  import { bookingRequirementsQueryKeys } from "./query-keys.js";
5
- import { bookingQuestionListResponse, bookingQuestionOptionListResponse, contactRequirementListResponse, productLiteListResponse, } from "./schemas.js";
6
+ import { bookingQuestionListResponse, bookingQuestionOptionListResponse, contactRequirementListResponse, productLiteListResponse, publicTransportRequirementsSchema, } from "./schemas.js";
6
7
  function appendPagination(params, filters) {
7
8
  if (filters.limit !== undefined)
8
9
  params.set("limit", String(filters.limit));
@@ -64,3 +65,16 @@ export function getQuestionOptionsQueryOptions(client, options = {}) {
64
65
  },
65
66
  });
66
67
  }
68
+ export function getTransportRequirementsQueryOptions(client, options) {
69
+ const { enabled: _enabled = true, productId, optionId } = options;
70
+ return queryOptions({
71
+ queryKey: bookingRequirementsQueryKeys.transportRequirementsDetail({ productId, optionId }),
72
+ queryFn: () => {
73
+ const params = new URLSearchParams();
74
+ if (optionId)
75
+ params.set("optionId", optionId);
76
+ const qs = params.toString();
77
+ return fetchWithValidation(`/v1/public/booking-requirements/products/${productId}/transport-requirements${qs ? `?${qs}` : ""}`, z.object({ data: publicTransportRequirementsSchema }), client);
78
+ },
79
+ });
80
+ }
package/dist/schemas.d.ts CHANGED
@@ -235,4 +235,86 @@ export declare const contactRequirementListResponse: z.ZodObject<{
235
235
  limit: z.ZodNumber;
236
236
  offset: z.ZodNumber;
237
237
  }, z.core.$strip>;
238
+ export declare const transportRequirementFieldSchema: z.ZodEnum<{
239
+ date_of_birth: "date_of_birth";
240
+ nationality: "nationality";
241
+ passport_number: "passport_number";
242
+ passport_expiry: "passport_expiry";
243
+ }>;
244
+ export declare const publicTransportRequirementSummarySchema: z.ZodObject<{
245
+ fieldKey: z.ZodEnum<{
246
+ date_of_birth: "date_of_birth";
247
+ nationality: "nationality";
248
+ passport_number: "passport_number";
249
+ passport_expiry: "passport_expiry";
250
+ }>;
251
+ scope: z.ZodEnum<{
252
+ booking: "booking";
253
+ participant: "participant";
254
+ lead_traveler: "lead_traveler";
255
+ booker: "booker";
256
+ }>;
257
+ isRequired: z.ZodBoolean;
258
+ perParticipant: z.ZodBoolean;
259
+ notes: z.ZodNullable<z.ZodString>;
260
+ }, z.core.$strip>;
261
+ export declare const publicTransportRequirementsSchema: z.ZodObject<{
262
+ productId: z.ZodString;
263
+ optionId: z.ZodNullable<z.ZodString>;
264
+ hasTransport: z.ZodBoolean;
265
+ requiresPassengerDocuments: z.ZodBoolean;
266
+ requiresPassport: z.ZodBoolean;
267
+ requiresNationality: z.ZodBoolean;
268
+ requiresDateOfBirth: z.ZodBoolean;
269
+ requiredFields: z.ZodArray<z.ZodEnum<{
270
+ date_of_birth: "date_of_birth";
271
+ nationality: "nationality";
272
+ passport_number: "passport_number";
273
+ passport_expiry: "passport_expiry";
274
+ }>>;
275
+ fieldsByScope: z.ZodObject<{
276
+ booking: z.ZodArray<z.ZodEnum<{
277
+ date_of_birth: "date_of_birth";
278
+ nationality: "nationality";
279
+ passport_number: "passport_number";
280
+ passport_expiry: "passport_expiry";
281
+ }>>;
282
+ lead_traveler: z.ZodArray<z.ZodEnum<{
283
+ date_of_birth: "date_of_birth";
284
+ nationality: "nationality";
285
+ passport_number: "passport_number";
286
+ passport_expiry: "passport_expiry";
287
+ }>>;
288
+ participant: z.ZodArray<z.ZodEnum<{
289
+ date_of_birth: "date_of_birth";
290
+ nationality: "nationality";
291
+ passport_number: "passport_number";
292
+ passport_expiry: "passport_expiry";
293
+ }>>;
294
+ booker: z.ZodArray<z.ZodEnum<{
295
+ date_of_birth: "date_of_birth";
296
+ nationality: "nationality";
297
+ passport_number: "passport_number";
298
+ passport_expiry: "passport_expiry";
299
+ }>>;
300
+ }, z.core.$strip>;
301
+ requirements: z.ZodArray<z.ZodObject<{
302
+ fieldKey: z.ZodEnum<{
303
+ date_of_birth: "date_of_birth";
304
+ nationality: "nationality";
305
+ passport_number: "passport_number";
306
+ passport_expiry: "passport_expiry";
307
+ }>;
308
+ scope: z.ZodEnum<{
309
+ booking: "booking";
310
+ participant: "participant";
311
+ lead_traveler: "lead_traveler";
312
+ booker: "booker";
313
+ }>;
314
+ isRequired: z.ZodBoolean;
315
+ perParticipant: z.ZodBoolean;
316
+ notes: z.ZodNullable<z.ZodString>;
317
+ }, z.core.$strip>>;
318
+ }, z.core.$strip>;
319
+ export type PublicTransportRequirements = z.infer<typeof publicTransportRequirementsSchema>;
238
320
  //# sourceMappingURL=schemas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,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,iBAAiB;;;;;iBAK5B,CAAA;AAEF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAE3D,eAAO,MAAM,oBAAoB;;;;;;;EAO/B,CAAA;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;EAclC,CAAA;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAahC,CAAA;AAEF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEnE,eAAO,MAAM,2BAA2B;;;;;;;;iBAQtC,CAAA;AAEF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAA;AAE/E,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;EAchC,CAAA;AAEF,eAAO,MAAM,kBAAkB;;;;;EAAgE,CAAA;A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CAAA;AAEF,eAAO,MAAM,kBAAkB;;;;;EAAgE,CAAA;AAE/F,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAWnC,CAAA;AAEF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAEzE,eAAO,MAAM,uBAAuB;;;;;;;;;;iBAAuC,CAAA;AAC3E,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAA2C,CAAA;AACnF,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;iBAAiD,CAAA;AAC/F,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAA8C,CAAA;AAEzF,eAAO,MAAM,+BAA+B;;;;;EAK1C,CAAA;AAEF,eAAO,MAAM,uCAAuC;;;;;;;;;;;;;;;;iBAMlD,CAAA;AAEF,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAgB5C,CAAA;AAEF,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAA"}
package/dist/schemas.js CHANGED
@@ -89,3 +89,33 @@ export const productLiteListResponse = paginatedEnvelope(productLiteSchema);
89
89
  export const bookingQuestionListResponse = paginatedEnvelope(bookingQuestionSchema);
90
90
  export const bookingQuestionOptionListResponse = paginatedEnvelope(bookingQuestionOptionSchema);
91
91
  export const contactRequirementListResponse = paginatedEnvelope(contactRequirementSchema);
92
+ export const transportRequirementFieldSchema = z.enum([
93
+ "date_of_birth",
94
+ "nationality",
95
+ "passport_number",
96
+ "passport_expiry",
97
+ ]);
98
+ export const publicTransportRequirementSummarySchema = z.object({
99
+ fieldKey: transportRequirementFieldSchema,
100
+ scope: contactScopeSchema,
101
+ isRequired: z.boolean(),
102
+ perParticipant: z.boolean(),
103
+ notes: z.string().nullable(),
104
+ });
105
+ export const publicTransportRequirementsSchema = z.object({
106
+ productId: z.string(),
107
+ optionId: z.string().nullable(),
108
+ hasTransport: z.boolean(),
109
+ requiresPassengerDocuments: z.boolean(),
110
+ requiresPassport: z.boolean(),
111
+ requiresNationality: z.boolean(),
112
+ requiresDateOfBirth: z.boolean(),
113
+ requiredFields: z.array(transportRequirementFieldSchema),
114
+ fieldsByScope: z.object({
115
+ booking: z.array(transportRequirementFieldSchema),
116
+ lead_traveler: z.array(transportRequirementFieldSchema),
117
+ participant: z.array(transportRequirementFieldSchema),
118
+ booker: z.array(transportRequirementFieldSchema),
119
+ }),
120
+ requirements: z.array(publicTransportRequirementSummarySchema),
121
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voyantjs/booking-requirements-react",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
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/booking-requirements": "0.3.0"
38
+ "@voyantjs/booking-requirements": "0.3.1"
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/booking-requirements": "0.3.0",
50
- "@voyantjs/react": "0.3.0",
49
+ "@voyantjs/booking-requirements": "0.3.1",
50
+ "@voyantjs/react": "0.3.1",
51
51
  "@voyantjs/voyant-typescript-config": "0.1.0"
52
52
  },
53
53
  "dependencies": {
54
- "@voyantjs/react": "0.3.0"
54
+ "@voyantjs/react": "0.3.1"
55
55
  },
56
56
  "files": [
57
57
  "dist"