@voyantjs/storefront-react 0.41.2 → 0.43.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.
@@ -2,6 +2,8 @@ export { type UseStorefrontDepartureOptions, useStorefrontDeparture, } from "./u
2
2
  export { type UseStorefrontDepartureItineraryOptions, useStorefrontDepartureItinerary, } from "./use-storefront-departure-itinerary.js";
3
3
  export { useStorefrontDeparturePricePreviewMutation } from "./use-storefront-departure-price-preview-mutation.js";
4
4
  export { type UseStorefrontOfferOptions, useStorefrontOffer } from "./use-storefront-offer.js";
5
+ export { useStorefrontOfferApplyMutation } from "./use-storefront-offer-apply-mutation.js";
6
+ export { useStorefrontOfferRedeemMutation } from "./use-storefront-offer-redeem-mutation.js";
5
7
  export { type UseStorefrontProductDeparturesOptions, useStorefrontProductDepartures, } from "./use-storefront-product-departures.js";
6
8
  export { type UseStorefrontProductExtensionsOptions, useStorefrontProductExtensions, } from "./use-storefront-product-extensions.js";
7
9
  export { type UseStorefrontProductOffersOptions, useStorefrontProductOffers, } from "./use-storefront-product-offers.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,6BAA6B,EAClC,sBAAsB,GACvB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EACL,KAAK,sCAAsC,EAC3C,+BAA+B,GAChC,MAAM,yCAAyC,CAAA;AAChD,OAAO,EAAE,0CAA0C,EAAE,MAAM,sDAAsD,CAAA;AACjH,OAAO,EAAE,KAAK,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAC9F,OAAO,EACL,KAAK,qCAAqC,EAC1C,8BAA8B,GAC/B,MAAM,wCAAwC,CAAA;AAC/C,OAAO,EACL,KAAK,qCAAqC,EAC1C,8BAA8B,GAC/B,MAAM,wCAAwC,CAAA;AAC/C,OAAO,EACL,KAAK,iCAAiC,EACtC,0BAA0B,GAC3B,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EACL,KAAK,4BAA4B,EACjC,qBAAqB,GACtB,MAAM,8BAA8B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,6BAA6B,EAClC,sBAAsB,GACvB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EACL,KAAK,sCAAsC,EAC3C,+BAA+B,GAChC,MAAM,yCAAyC,CAAA;AAChD,OAAO,EAAE,0CAA0C,EAAE,MAAM,sDAAsD,CAAA;AACjH,OAAO,EAAE,KAAK,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAC9F,OAAO,EAAE,+BAA+B,EAAE,MAAM,0CAA0C,CAAA;AAC1F,OAAO,EAAE,gCAAgC,EAAE,MAAM,2CAA2C,CAAA;AAC5F,OAAO,EACL,KAAK,qCAAqC,EAC1C,8BAA8B,GAC/B,MAAM,wCAAwC,CAAA;AAC/C,OAAO,EACL,KAAK,qCAAqC,EAC1C,8BAA8B,GAC/B,MAAM,wCAAwC,CAAA;AAC/C,OAAO,EACL,KAAK,iCAAiC,EACtC,0BAA0B,GAC3B,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EACL,KAAK,4BAA4B,EACjC,qBAAqB,GACtB,MAAM,8BAA8B,CAAA"}
@@ -2,6 +2,8 @@ export { useStorefrontDeparture, } from "./use-storefront-departure.js";
2
2
  export { useStorefrontDepartureItinerary, } from "./use-storefront-departure-itinerary.js";
3
3
  export { useStorefrontDeparturePricePreviewMutation } from "./use-storefront-departure-price-preview-mutation.js";
4
4
  export { useStorefrontOffer } from "./use-storefront-offer.js";
5
+ export { useStorefrontOfferApplyMutation } from "./use-storefront-offer-apply-mutation.js";
6
+ export { useStorefrontOfferRedeemMutation } from "./use-storefront-offer-redeem-mutation.js";
5
7
  export { useStorefrontProductDepartures, } from "./use-storefront-product-departures.js";
6
8
  export { useStorefrontProductExtensions, } from "./use-storefront-product-extensions.js";
7
9
  export { useStorefrontProductOffers, } from "./use-storefront-product-offers.js";
@@ -0,0 +1,68 @@
1
+ export declare function useStorefrontOfferApplyMutation(slug: string | null | undefined): import("@tanstack/react-query").UseMutationResult<{
2
+ data: {
3
+ status: "not_applicable" | "applied" | "invalid" | "conflict";
4
+ reason: "scope" | "currency" | "min_pax" | "conflict" | "offer_not_found" | "offer_expired" | "offer_not_yet_valid" | "code_not_found" | "code_required" | "code_expired" | "code_not_yet_valid" | "no_discount" | "booking_mismatch" | "session_mismatch" | null;
5
+ offer: {
6
+ id: string;
7
+ name: string;
8
+ slug: string | null;
9
+ description: string | null;
10
+ discountType: "percentage" | "fixed_amount";
11
+ discountValue: string;
12
+ currency: string | null;
13
+ applicableProductIds: string[];
14
+ applicableDepartureIds: string[];
15
+ validFrom: string | null;
16
+ validTo: string | null;
17
+ minTravelers: number | null;
18
+ imageMobileUrl: string | null;
19
+ imageDesktopUrl: string | null;
20
+ stackable: boolean;
21
+ createdAt: string;
22
+ updatedAt: string;
23
+ } | null;
24
+ target: {
25
+ bookingId: string | null;
26
+ sessionId: string | null;
27
+ productId: string;
28
+ departureId: string | null;
29
+ };
30
+ pricing: {
31
+ basePriceCents: number;
32
+ currency: string;
33
+ discountAppliedCents: number;
34
+ discountedPriceCents: number;
35
+ };
36
+ appliedOffers: {
37
+ offerId: string;
38
+ offerName: string;
39
+ discountAppliedCents: number;
40
+ discountedPriceCents: number;
41
+ currency: string;
42
+ discountKind: "percentage" | "fixed_amount";
43
+ discountPercent: number | null;
44
+ discountAmountCents: number | null;
45
+ appliedCode: string | null;
46
+ stackable: boolean;
47
+ }[];
48
+ conflict: {
49
+ policy: "best_discount_wins" | "stackable_compose";
50
+ autoAppliedOfferIds: string[];
51
+ manualOfferId: string | null;
52
+ selectedOfferIds: string[];
53
+ message: string;
54
+ } | null;
55
+ };
56
+ }, Error, {
57
+ productId: string;
58
+ pax: unknown;
59
+ basePriceCents: unknown;
60
+ currency: string;
61
+ departureId?: string | null | undefined;
62
+ bookingId?: string | null | undefined;
63
+ sessionId?: string | null | undefined;
64
+ locale?: string | undefined;
65
+ audience?: "staff" | "customer" | "partner" | "supplier" | undefined;
66
+ market?: string | undefined;
67
+ }, unknown>;
68
+ //# sourceMappingURL=use-storefront-offer-apply-mutation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-storefront-offer-apply-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-storefront-offer-apply-mutation.ts"],"names":[],"mappings":"AAQA,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAY9E"}
@@ -0,0 +1,15 @@
1
+ "use client";
2
+ import { useMutation } from "@tanstack/react-query";
3
+ import { applyStorefrontOffer } from "../operations.js";
4
+ import { useVoyantStorefrontContext } from "../provider.js";
5
+ export function useStorefrontOfferApplyMutation(slug) {
6
+ const { baseUrl, fetcher } = useVoyantStorefrontContext();
7
+ return useMutation({
8
+ mutationFn: async (input) => {
9
+ if (!slug) {
10
+ throw new Error("useStorefrontOfferApplyMutation requires a slug");
11
+ }
12
+ return applyStorefrontOffer({ baseUrl, fetcher }, slug, input);
13
+ },
14
+ });
15
+ }
@@ -0,0 +1,69 @@
1
+ export declare function useStorefrontOfferRedeemMutation(): import("@tanstack/react-query").UseMutationResult<{
2
+ data: {
3
+ status: "not_applicable" | "applied" | "invalid" | "conflict";
4
+ reason: "scope" | "currency" | "min_pax" | "conflict" | "offer_not_found" | "offer_expired" | "offer_not_yet_valid" | "code_not_found" | "code_required" | "code_expired" | "code_not_yet_valid" | "no_discount" | "booking_mismatch" | "session_mismatch" | null;
5
+ offer: {
6
+ id: string;
7
+ name: string;
8
+ slug: string | null;
9
+ description: string | null;
10
+ discountType: "percentage" | "fixed_amount";
11
+ discountValue: string;
12
+ currency: string | null;
13
+ applicableProductIds: string[];
14
+ applicableDepartureIds: string[];
15
+ validFrom: string | null;
16
+ validTo: string | null;
17
+ minTravelers: number | null;
18
+ imageMobileUrl: string | null;
19
+ imageDesktopUrl: string | null;
20
+ stackable: boolean;
21
+ createdAt: string;
22
+ updatedAt: string;
23
+ } | null;
24
+ target: {
25
+ bookingId: string | null;
26
+ sessionId: string | null;
27
+ productId: string;
28
+ departureId: string | null;
29
+ };
30
+ pricing: {
31
+ basePriceCents: number;
32
+ currency: string;
33
+ discountAppliedCents: number;
34
+ discountedPriceCents: number;
35
+ };
36
+ appliedOffers: {
37
+ offerId: string;
38
+ offerName: string;
39
+ discountAppliedCents: number;
40
+ discountedPriceCents: number;
41
+ currency: string;
42
+ discountKind: "percentage" | "fixed_amount";
43
+ discountPercent: number | null;
44
+ discountAmountCents: number | null;
45
+ appliedCode: string | null;
46
+ stackable: boolean;
47
+ }[];
48
+ conflict: {
49
+ policy: "best_discount_wins" | "stackable_compose";
50
+ autoAppliedOfferIds: string[];
51
+ manualOfferId: string | null;
52
+ selectedOfferIds: string[];
53
+ message: string;
54
+ } | null;
55
+ };
56
+ }, Error, {
57
+ productId: string;
58
+ pax: unknown;
59
+ basePriceCents: unknown;
60
+ currency: string;
61
+ code: string;
62
+ departureId?: string | null | undefined;
63
+ bookingId?: string | null | undefined;
64
+ sessionId?: string | null | undefined;
65
+ locale?: string | undefined;
66
+ audience?: "staff" | "customer" | "partner" | "supplier" | undefined;
67
+ market?: string | undefined;
68
+ }, unknown>;
69
+ //# sourceMappingURL=use-storefront-offer-redeem-mutation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-storefront-offer-redeem-mutation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-storefront-offer-redeem-mutation.ts"],"names":[],"mappings":"AAQA,wBAAgB,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAQ/C"}
@@ -0,0 +1,12 @@
1
+ "use client";
2
+ import { useMutation } from "@tanstack/react-query";
3
+ import { redeemStorefrontOffer } from "../operations.js";
4
+ import { useVoyantStorefrontContext } from "../provider.js";
5
+ export function useStorefrontOfferRedeemMutation() {
6
+ const { baseUrl, fetcher } = useVoyantStorefrontContext();
7
+ return useMutation({
8
+ mutationFn: async (input) => {
9
+ return redeemStorefrontOffer({ baseUrl, fetcher }, input);
10
+ },
11
+ });
12
+ }
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { defaultFetcher, fetchWithValidation, VoyantApiError, type VoyantFetcher, withQueryParams, } from "./client.js";
2
2
  export * from "./hooks/index.js";
3
- export { getStorefrontDeparture, getStorefrontDepartureItinerary, getStorefrontOfferBySlug, getStorefrontSettings, listStorefrontProductDepartures, listStorefrontProductExtensions, listStorefrontProductOffers, previewStorefrontDeparturePrice, } from "./operations.js";
3
+ export { applyStorefrontOffer, getStorefrontDeparture, getStorefrontDepartureItinerary, getStorefrontOfferBySlug, getStorefrontSettings, listStorefrontProductDepartures, listStorefrontProductExtensions, listStorefrontProductOffers, previewStorefrontDeparturePrice, redeemStorefrontOffer, } from "./operations.js";
4
4
  export { useVoyantStorefrontContext, type VoyantStorefrontContextValue, VoyantStorefrontProvider, type VoyantStorefrontProviderProps, } from "./provider.js";
5
5
  export { storefrontQueryKeys } from "./query-keys.js";
6
6
  export { getStorefrontDepartureItineraryQueryOptions, getStorefrontDepartureQueryOptions, getStorefrontOfferQueryOptions, getStorefrontProductDeparturesQueryOptions, getStorefrontProductExtensionsQueryOptions, getStorefrontProductOffersQueryOptions, getStorefrontSettingsQueryOptions, } from "./query-options.js";
@@ -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,EAClB,eAAe,GAChB,MAAM,aAAa,CAAA;AACpB,cAAc,kBAAkB,CAAA;AAChC,OAAO,EACL,sBAAsB,EACtB,+BAA+B,EAC/B,wBAAwB,EACxB,qBAAqB,EACrB,+BAA+B,EAC/B,+BAA+B,EAC/B,2BAA2B,EAC3B,+BAA+B,GAChC,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,0BAA0B,EAC1B,KAAK,4BAA4B,EACjC,wBAAwB,EACxB,KAAK,6BAA6B,GACnC,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,EACL,2CAA2C,EAC3C,kCAAkC,EAClC,8BAA8B,EAC9B,0CAA0C,EAC1C,0CAA0C,EAC1C,sCAAsC,EACtC,iCAAiC,GAClC,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,EAClB,eAAe,GAChB,MAAM,aAAa,CAAA;AACpB,cAAc,kBAAkB,CAAA;AAChC,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,+BAA+B,EAC/B,wBAAwB,EACxB,qBAAqB,EACrB,+BAA+B,EAC/B,+BAA+B,EAC/B,2BAA2B,EAC3B,+BAA+B,EAC/B,qBAAqB,GACtB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,0BAA0B,EAC1B,KAAK,4BAA4B,EACjC,wBAAwB,EACxB,KAAK,6BAA6B,GACnC,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,EACL,2CAA2C,EAC3C,kCAAkC,EAClC,8BAA8B,EAC9B,0CAA0C,EAC1C,0CAA0C,EAC1C,sCAAsC,EACtC,iCAAiC,GAClC,MAAM,oBAAoB,CAAA;AAC3B,cAAc,cAAc,CAAA"}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export { defaultFetcher, fetchWithValidation, VoyantApiError, withQueryParams, } from "./client.js";
2
2
  export * from "./hooks/index.js";
3
- export { getStorefrontDeparture, getStorefrontDepartureItinerary, getStorefrontOfferBySlug, getStorefrontSettings, listStorefrontProductDepartures, listStorefrontProductExtensions, listStorefrontProductOffers, previewStorefrontDeparturePrice, } from "./operations.js";
3
+ export { applyStorefrontOffer, getStorefrontDeparture, getStorefrontDepartureItinerary, getStorefrontOfferBySlug, getStorefrontSettings, listStorefrontProductDepartures, listStorefrontProductExtensions, listStorefrontProductOffers, previewStorefrontDeparturePrice, redeemStorefrontOffer, } from "./operations.js";
4
4
  export { useVoyantStorefrontContext, VoyantStorefrontProvider, } from "./provider.js";
5
5
  export { storefrontQueryKeys } from "./query-keys.js";
6
6
  export { getStorefrontDepartureItineraryQueryOptions, getStorefrontDepartureQueryOptions, getStorefrontOfferQueryOptions, getStorefrontProductDeparturesQueryOptions, getStorefrontProductExtensionsQueryOptions, getStorefrontProductOffersQueryOptions, getStorefrontSettingsQueryOptions, } from "./query-options.js";
@@ -1,5 +1,5 @@
1
1
  import { type FetchWithValidationOptions } from "./client.js";
2
- import { type StorefrontDepartureListQuery, type StorefrontDeparturePricePreviewInput, type StorefrontProductExtensionsQuery, type StorefrontPromotionalOfferListQuery } from "./schemas.js";
2
+ import { type StorefrontDepartureListQuery, type StorefrontDeparturePricePreviewInput, type StorefrontOfferApplyInput, type StorefrontOfferRedeemInput, type StorefrontProductExtensionsQuery, type StorefrontPromotionalOfferListQuery } from "./schemas.js";
3
3
  export declare function getStorefrontSettings(client: FetchWithValidationOptions): Promise<{
4
4
  data: {
5
5
  branding: {
@@ -276,4 +276,116 @@ export declare function getStorefrontOfferBySlug(client: FetchWithValidationOpti
276
276
  updatedAt: string;
277
277
  };
278
278
  }>;
279
+ export declare function applyStorefrontOffer(client: FetchWithValidationOptions, slug: string, input: StorefrontOfferApplyInput): Promise<{
280
+ data: {
281
+ status: "not_applicable" | "applied" | "invalid" | "conflict";
282
+ reason: "scope" | "currency" | "min_pax" | "conflict" | "offer_not_found" | "offer_expired" | "offer_not_yet_valid" | "code_not_found" | "code_required" | "code_expired" | "code_not_yet_valid" | "no_discount" | "booking_mismatch" | "session_mismatch" | null;
283
+ offer: {
284
+ id: string;
285
+ name: string;
286
+ slug: string | null;
287
+ description: string | null;
288
+ discountType: "percentage" | "fixed_amount";
289
+ discountValue: string;
290
+ currency: string | null;
291
+ applicableProductIds: string[];
292
+ applicableDepartureIds: string[];
293
+ validFrom: string | null;
294
+ validTo: string | null;
295
+ minTravelers: number | null;
296
+ imageMobileUrl: string | null;
297
+ imageDesktopUrl: string | null;
298
+ stackable: boolean;
299
+ createdAt: string;
300
+ updatedAt: string;
301
+ } | null;
302
+ target: {
303
+ bookingId: string | null;
304
+ sessionId: string | null;
305
+ productId: string;
306
+ departureId: string | null;
307
+ };
308
+ pricing: {
309
+ basePriceCents: number;
310
+ currency: string;
311
+ discountAppliedCents: number;
312
+ discountedPriceCents: number;
313
+ };
314
+ appliedOffers: {
315
+ offerId: string;
316
+ offerName: string;
317
+ discountAppliedCents: number;
318
+ discountedPriceCents: number;
319
+ currency: string;
320
+ discountKind: "percentage" | "fixed_amount";
321
+ discountPercent: number | null;
322
+ discountAmountCents: number | null;
323
+ appliedCode: string | null;
324
+ stackable: boolean;
325
+ }[];
326
+ conflict: {
327
+ policy: "best_discount_wins" | "stackable_compose";
328
+ autoAppliedOfferIds: string[];
329
+ manualOfferId: string | null;
330
+ selectedOfferIds: string[];
331
+ message: string;
332
+ } | null;
333
+ };
334
+ }>;
335
+ export declare function redeemStorefrontOffer(client: FetchWithValidationOptions, input: StorefrontOfferRedeemInput): Promise<{
336
+ data: {
337
+ status: "not_applicable" | "applied" | "invalid" | "conflict";
338
+ reason: "scope" | "currency" | "min_pax" | "conflict" | "offer_not_found" | "offer_expired" | "offer_not_yet_valid" | "code_not_found" | "code_required" | "code_expired" | "code_not_yet_valid" | "no_discount" | "booking_mismatch" | "session_mismatch" | null;
339
+ offer: {
340
+ id: string;
341
+ name: string;
342
+ slug: string | null;
343
+ description: string | null;
344
+ discountType: "percentage" | "fixed_amount";
345
+ discountValue: string;
346
+ currency: string | null;
347
+ applicableProductIds: string[];
348
+ applicableDepartureIds: string[];
349
+ validFrom: string | null;
350
+ validTo: string | null;
351
+ minTravelers: number | null;
352
+ imageMobileUrl: string | null;
353
+ imageDesktopUrl: string | null;
354
+ stackable: boolean;
355
+ createdAt: string;
356
+ updatedAt: string;
357
+ } | null;
358
+ target: {
359
+ bookingId: string | null;
360
+ sessionId: string | null;
361
+ productId: string;
362
+ departureId: string | null;
363
+ };
364
+ pricing: {
365
+ basePriceCents: number;
366
+ currency: string;
367
+ discountAppliedCents: number;
368
+ discountedPriceCents: number;
369
+ };
370
+ appliedOffers: {
371
+ offerId: string;
372
+ offerName: string;
373
+ discountAppliedCents: number;
374
+ discountedPriceCents: number;
375
+ currency: string;
376
+ discountKind: "percentage" | "fixed_amount";
377
+ discountPercent: number | null;
378
+ discountAmountCents: number | null;
379
+ appliedCode: string | null;
380
+ stackable: boolean;
381
+ }[];
382
+ conflict: {
383
+ policy: "best_discount_wins" | "stackable_compose";
384
+ autoAppliedOfferIds: string[];
385
+ manualOfferId: string | null;
386
+ selectedOfferIds: string[];
387
+ message: string;
388
+ } | null;
389
+ };
390
+ }>;
279
391
  //# sourceMappingURL=operations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,0BAA0B,EAAwC,MAAM,aAAa,CAAA;AACnG,OAAO,EACL,KAAK,4BAA4B,EACjC,KAAK,oCAAoC,EACzC,KAAK,gCAAgC,EACrC,KAAK,mCAAmC,EAUzC,MAAM,cAAc,CAAA;AAErB,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAgB,oBAAoB,CAClC,MAAM,EAAE,0BAA0B,EAClC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAUjC;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,0BAA0B,EAClC,KAAK,EAAE,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAalC"}
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { fetchWithValidation, withQueryParams } from "./client.js";
3
- import { storefrontDepartureItineraryResponseSchema, storefrontDepartureListResponseSchema, storefrontDeparturePricePreviewInputSchema, storefrontDeparturePricePreviewResponseSchema, storefrontDepartureResponseSchema, storefrontProductExtensionsResponseSchema, storefrontPromotionalOfferListResponseSchema, storefrontPromotionalOfferResponseSchema, storefrontSettingsResponseSchema, } from "./schemas.js";
3
+ import { storefrontDepartureItineraryResponseSchema, storefrontDepartureListResponseSchema, storefrontDeparturePricePreviewInputSchema, storefrontDeparturePricePreviewResponseSchema, storefrontDepartureResponseSchema, storefrontOfferApplyInputSchema, storefrontOfferMutationResponseSchema, storefrontOfferRedeemInputSchema, storefrontProductExtensionsResponseSchema, storefrontPromotionalOfferListResponseSchema, storefrontPromotionalOfferResponseSchema, storefrontSettingsResponseSchema, } from "./schemas.js";
4
4
  export function getStorefrontSettings(client) {
5
5
  return fetchWithValidation("/v1/public/settings", storefrontSettingsResponseSchema, client);
6
6
  }
@@ -26,3 +26,14 @@ export function listStorefrontProductOffers(client, productId, query) {
26
26
  export function getStorefrontOfferBySlug(client, slug, query) {
27
27
  return fetchWithValidation(withQueryParams(`/v1/public/offers/${slug}`, query), storefrontPromotionalOfferResponseSchema, client);
28
28
  }
29
+ export function applyStorefrontOffer(client, slug, input) {
30
+ const parsed = storefrontOfferApplyInputSchema.parse(input);
31
+ return fetchWithValidation(`/v1/public/offers/${slug}/apply`, storefrontOfferMutationResponseSchema, client, { method: "POST", body: JSON.stringify(parsed) });
32
+ }
33
+ export function redeemStorefrontOffer(client, input) {
34
+ const parsed = storefrontOfferRedeemInputSchema.parse(input);
35
+ return fetchWithValidation("/v1/public/offers/redeem", storefrontOfferMutationResponseSchema, client, {
36
+ method: "POST",
37
+ body: JSON.stringify(parsed),
38
+ });
39
+ }
package/dist/schemas.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { storefrontDepartureItinerarySchema, storefrontDepartureListQuerySchema, storefrontDepartureListResponseSchema, storefrontDeparturePricePreviewInputSchema, storefrontDeparturePricePreviewSchema, storefrontDepartureSchema, storefrontProductExtensionsQuerySchema, storefrontProductExtensionsResponseSchema, storefrontPromotionalOfferListQuerySchema, storefrontPromotionalOfferSchema, storefrontSettingsSchema } from "@voyantjs/storefront";
1
+ import { storefrontDepartureItinerarySchema, storefrontDepartureListQuerySchema, storefrontDepartureListResponseSchema, storefrontDeparturePricePreviewInputSchema, storefrontDeparturePricePreviewSchema, storefrontDepartureSchema, storefrontOfferApplyInputSchema, storefrontOfferMutationResponseSchema, storefrontOfferMutationResultSchema, storefrontOfferRedeemInputSchema, storefrontProductExtensionsQuerySchema, storefrontProductExtensionsResponseSchema, storefrontPromotionalOfferListQuerySchema, storefrontPromotionalOfferSchema, storefrontSettingsSchema } from "@voyantjs/storefront";
2
2
  import { z } from "zod";
3
3
  export declare const singleEnvelope: <T extends z.ZodTypeAny>(item: T) => z.ZodObject<{
4
4
  data: T;
@@ -6,7 +6,7 @@ export declare const singleEnvelope: <T extends z.ZodTypeAny>(item: T) => z.ZodO
6
6
  export declare const arrayEnvelope: <T extends z.ZodTypeAny>(item: T) => z.ZodObject<{
7
7
  data: z.ZodArray<T>;
8
8
  }, z.core.$strip>;
9
- export { storefrontDepartureItinerarySchema, storefrontDepartureListQuerySchema, storefrontDepartureListResponseSchema, storefrontDeparturePricePreviewInputSchema, storefrontDeparturePricePreviewSchema, storefrontDepartureSchema, storefrontProductExtensionsQuerySchema, storefrontProductExtensionsResponseSchema, storefrontPromotionalOfferListQuerySchema, storefrontPromotionalOfferSchema, storefrontSettingsSchema, };
9
+ export { storefrontDepartureItinerarySchema, storefrontDepartureListQuerySchema, storefrontDepartureListResponseSchema, storefrontDeparturePricePreviewInputSchema, storefrontDeparturePricePreviewSchema, storefrontDepartureSchema, storefrontOfferApplyInputSchema, storefrontOfferMutationResponseSchema, storefrontOfferMutationResultSchema, storefrontOfferRedeemInputSchema, storefrontProductExtensionsQuerySchema, storefrontProductExtensionsResponseSchema, storefrontPromotionalOfferListQuerySchema, storefrontPromotionalOfferSchema, storefrontSettingsSchema, };
10
10
  export declare const storefrontSettingsResponseSchema: z.ZodObject<{
11
11
  data: z.ZodObject<{
12
12
  branding: z.ZodObject<{
@@ -242,4 +242,7 @@ export type StorefrontDepartureItineraryRecord = z.infer<typeof storefrontDepart
242
242
  export type StorefrontProductExtensionsQuery = z.input<typeof storefrontProductExtensionsQuerySchema>;
243
243
  export type StorefrontPromotionalOfferListQuery = z.input<typeof storefrontPromotionalOfferListQuerySchema>;
244
244
  export type StorefrontPromotionalOfferRecord = z.infer<typeof storefrontPromotionalOfferSchema>;
245
+ export type StorefrontOfferApplyInput = z.input<typeof storefrontOfferApplyInputSchema>;
246
+ export type StorefrontOfferRedeemInput = z.input<typeof storefrontOfferRedeemInputSchema>;
247
+ export type StorefrontOfferMutationRecord = z.infer<typeof storefrontOfferMutationResultSchema>;
245
248
  //# sourceMappingURL=schemas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kCAAkC,EAClC,kCAAkC,EAClC,qCAAqC,EACrC,0CAA0C,EAC1C,qCAAqC,EACrC,yBAAyB,EACzB,sCAAsC,EACtC,yCAAyC,EACzC,yCAAyC,EACzC,gCAAgC,EAChC,wBAAwB,EACzB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,CAA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AA;AAC/F,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAA;AACvF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAA;AACzF,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mCAAmC,CAAC,CAAA"}
package/dist/schemas.js CHANGED
@@ -1,8 +1,8 @@
1
- import { storefrontDepartureItinerarySchema, storefrontDepartureListQuerySchema, storefrontDepartureListResponseSchema, storefrontDeparturePricePreviewInputSchema, storefrontDeparturePricePreviewSchema, storefrontDepartureSchema, storefrontProductExtensionsQuerySchema, storefrontProductExtensionsResponseSchema, storefrontPromotionalOfferListQuerySchema, storefrontPromotionalOfferSchema, storefrontSettingsSchema, } from "@voyantjs/storefront";
1
+ import { storefrontDepartureItinerarySchema, storefrontDepartureListQuerySchema, storefrontDepartureListResponseSchema, storefrontDeparturePricePreviewInputSchema, storefrontDeparturePricePreviewSchema, storefrontDepartureSchema, storefrontOfferApplyInputSchema, storefrontOfferMutationResponseSchema, storefrontOfferMutationResultSchema, storefrontOfferRedeemInputSchema, storefrontProductExtensionsQuerySchema, storefrontProductExtensionsResponseSchema, storefrontPromotionalOfferListQuerySchema, storefrontPromotionalOfferSchema, storefrontSettingsSchema, } from "@voyantjs/storefront";
2
2
  import { z } from "zod";
3
3
  export const singleEnvelope = (item) => z.object({ data: item });
4
4
  export const arrayEnvelope = (item) => z.object({ data: z.array(item) });
5
- export { storefrontDepartureItinerarySchema, storefrontDepartureListQuerySchema, storefrontDepartureListResponseSchema, storefrontDeparturePricePreviewInputSchema, storefrontDeparturePricePreviewSchema, storefrontDepartureSchema, storefrontProductExtensionsQuerySchema, storefrontProductExtensionsResponseSchema, storefrontPromotionalOfferListQuerySchema, storefrontPromotionalOfferSchema, storefrontSettingsSchema, };
5
+ export { storefrontDepartureItinerarySchema, storefrontDepartureListQuerySchema, storefrontDepartureListResponseSchema, storefrontDeparturePricePreviewInputSchema, storefrontDeparturePricePreviewSchema, storefrontDepartureSchema, storefrontOfferApplyInputSchema, storefrontOfferMutationResponseSchema, storefrontOfferMutationResultSchema, storefrontOfferRedeemInputSchema, storefrontProductExtensionsQuerySchema, storefrontProductExtensionsResponseSchema, storefrontPromotionalOfferListQuerySchema, storefrontPromotionalOfferSchema, storefrontSettingsSchema, };
6
6
  export const storefrontSettingsResponseSchema = singleEnvelope(storefrontSettingsSchema);
7
7
  export const storefrontDepartureResponseSchema = singleEnvelope(storefrontDepartureSchema);
8
8
  export const storefrontDeparturePricePreviewResponseSchema = singleEnvelope(storefrontDeparturePricePreviewSchema);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voyantjs/storefront-react",
3
- "version": "0.41.2",
3
+ "version": "0.43.0",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -41,7 +41,7 @@
41
41
  "react": "^19.0.0",
42
42
  "react-dom": "^19.0.0",
43
43
  "zod": "^4.0.0",
44
- "@voyantjs/storefront": "0.41.2"
44
+ "@voyantjs/storefront": "0.43.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@tanstack/react-query": "^5.96.2",
@@ -52,12 +52,12 @@
52
52
  "typescript": "^6.0.2",
53
53
  "vitest": "^4.1.2",
54
54
  "zod": "^4.3.6",
55
- "@voyantjs/react": "0.41.2",
56
- "@voyantjs/storefront": "0.41.2",
55
+ "@voyantjs/react": "0.43.0",
56
+ "@voyantjs/storefront": "0.43.0",
57
57
  "@voyantjs/voyant-typescript-config": "0.1.0"
58
58
  },
59
59
  "dependencies": {
60
- "@voyantjs/react": "0.41.2"
60
+ "@voyantjs/react": "0.43.0"
61
61
  },
62
62
  "files": [
63
63
  "dist"