@voyantjs/storefront 0.41.3 → 0.44.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.
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/routes-public.d.ts +151 -1
- package/dist/routes-public.d.ts.map +1 -1
- package/dist/routes-public.js +20 -1
- package/dist/service.d.ts +17 -1
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +8 -0
- package/dist/validation.d.ts +260 -0
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +86 -0
- package/package.json +9 -9
package/dist/index.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ export type { StorefrontPublicRoutes } from "./routes-public.js";
|
|
|
5
5
|
export { createStorefrontPublicRoutes } from "./routes-public.js";
|
|
6
6
|
export type { StorefrontOfferResolvers, StorefrontRequestContext, StorefrontServiceOptions, } from "./service.js";
|
|
7
7
|
export { createStorefrontService, resolveStorefrontSettings } from "./service.js";
|
|
8
|
-
export type { StorefrontDepartureListQuery, StorefrontFormField, StorefrontFormFieldInput, StorefrontPaymentMethod, StorefrontPaymentMethodCode, StorefrontPaymentMethodInput, StorefrontProductAvailabilitySummaryQuery, StorefrontPromotionalOffer, StorefrontSettings, StorefrontSettingsInput, } from "./validation.js";
|
|
9
|
-
export { storefrontDepartureItinerarySchema, storefrontDepartureListQuerySchema, storefrontDepartureListResponseSchema, storefrontDeparturePricePreviewInputSchema, storefrontDeparturePricePreviewSchema, storefrontDepartureSchema, storefrontFormFieldInputSchema, storefrontFormFieldOptionSchema, storefrontFormFieldSchema, storefrontFormFieldTypeSchema, storefrontPaymentMethodCodeSchema, storefrontPaymentMethodInputSchema, storefrontPaymentMethodSchema, storefrontProductAvailabilitySlotSchema, storefrontProductAvailabilityStateSchema, storefrontProductAvailabilitySummaryQuerySchema, storefrontProductAvailabilitySummaryResponseSchema, storefrontProductAvailabilitySummarySchema, storefrontProductExtensionsQuerySchema, storefrontProductExtensionsResponseSchema, storefrontPromotionalOfferListQuerySchema, storefrontPromotionalOfferListResponseSchema, storefrontPromotionalOfferResponseSchema, storefrontPromotionalOfferSchema, storefrontSettingsInputSchema, storefrontSettingsSchema, } from "./validation.js";
|
|
8
|
+
export type { StorefrontAppliedOffer, StorefrontDepartureListQuery, StorefrontFormField, StorefrontFormFieldInput, StorefrontOfferApplyInput, StorefrontOfferMutationResult, StorefrontOfferRedeemInput, StorefrontPaymentMethod, StorefrontPaymentMethodCode, StorefrontPaymentMethodInput, StorefrontProductAvailabilitySummaryQuery, StorefrontPromotionalOffer, StorefrontSettings, StorefrontSettingsInput, } from "./validation.js";
|
|
9
|
+
export { storefrontAppliedOfferSchema, storefrontDepartureItinerarySchema, storefrontDepartureListQuerySchema, storefrontDepartureListResponseSchema, storefrontDeparturePricePreviewInputSchema, storefrontDeparturePricePreviewSchema, storefrontDepartureSchema, storefrontFormFieldInputSchema, storefrontFormFieldOptionSchema, storefrontFormFieldSchema, storefrontFormFieldTypeSchema, storefrontOfferApplyInputSchema, storefrontOfferAudienceSchema, storefrontOfferConflictSchema, storefrontOfferMutationReasonSchema, storefrontOfferMutationResponseSchema, storefrontOfferMutationResultSchema, storefrontOfferMutationStatusSchema, storefrontOfferRedeemInputSchema, storefrontPaymentMethodCodeSchema, storefrontPaymentMethodInputSchema, storefrontPaymentMethodSchema, storefrontProductAvailabilitySlotSchema, storefrontProductAvailabilityStateSchema, storefrontProductAvailabilitySummaryQuerySchema, storefrontProductAvailabilitySummaryResponseSchema, storefrontProductAvailabilitySummarySchema, storefrontProductExtensionsQuerySchema, storefrontProductExtensionsResponseSchema, storefrontPromotionalOfferListQuerySchema, storefrontPromotionalOfferListResponseSchema, storefrontPromotionalOfferResponseSchema, storefrontPromotionalOfferSchema, storefrontSettingsInputSchema, storefrontSettingsSchema, } from "./validation.js";
|
|
10
10
|
export declare const storefrontModule: Module;
|
|
11
11
|
export declare function createStorefrontHonoModule(options?: Parameters<typeof createStorefrontPublicRoutes>[0]): HonoModule;
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAEvD,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAA;AAEjE,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAChE,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAA;AACjE,YAAY,EACV,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAA;AACjF,YAAY,EACV,4BAA4B,EAC5B,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,EACvB,2BAA2B,EAC3B,4BAA4B,EAC5B,yCAAyC,EACzC,0BAA0B,EAC1B,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,kCAAkC,EAClC,kCAAkC,EAClC,qCAAqC,EACrC,0CAA0C,EAC1C,qCAAqC,EACrC,yBAAyB,EACzB,8BAA8B,EAC9B,+BAA+B,EAC/B,yBAAyB,EACzB,6BAA6B,EAC7B,iCAAiC,EACjC,kCAAkC,EAClC,6BAA6B,EAC7B,uCAAuC,EACvC,wCAAwC,EACxC,+CAA+C,EAC/C,kDAAkD,EAClD,0CAA0C,EAC1C,sCAAsC,EACtC,yCAAyC,EACzC,yCAAyC,EACzC,4CAA4C,EAC5C,wCAAwC,EACxC,gCAAgC,EAChC,6BAA6B,EAC7B,wBAAwB,GACzB,MAAM,iBAAiB,CAAA;AAExB,eAAO,MAAM,gBA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C,EACvC,wCAAwC,EACxC,+CAA+C,EAC/C,kDAAkD,EAClD,0CAA0C,EAC1C,sCAAsC,EACtC,yCAAyC,EACzC,yCAAyC,EACzC,4CAA4C,EAC5C,wCAAwC,EACxC,gCAAgC,EAChC,6BAA6B,EAC7B,wBAAwB,GACzB,MAAM,iBAAiB,CAAA;AAExB,eAAO,MAAM,gBAAgB,EAAE,MAE9B,CAAA;AAED,wBAAgB,0BAA0B,CACxC,OAAO,CAAC,EAAE,UAAU,CAAC,OAAO,4BAA4B,CAAC,CAAC,CAAC,CAAC,GAC3D,UAAU,CAMZ"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createStorefrontPublicRoutes } from "./routes-public.js";
|
|
2
2
|
export { createStorefrontPublicRoutes } from "./routes-public.js";
|
|
3
3
|
export { createStorefrontService, resolveStorefrontSettings } from "./service.js";
|
|
4
|
-
export { storefrontDepartureItinerarySchema, storefrontDepartureListQuerySchema, storefrontDepartureListResponseSchema, storefrontDeparturePricePreviewInputSchema, storefrontDeparturePricePreviewSchema, storefrontDepartureSchema, storefrontFormFieldInputSchema, storefrontFormFieldOptionSchema, storefrontFormFieldSchema, storefrontFormFieldTypeSchema, storefrontPaymentMethodCodeSchema, storefrontPaymentMethodInputSchema, storefrontPaymentMethodSchema, storefrontProductAvailabilitySlotSchema, storefrontProductAvailabilityStateSchema, storefrontProductAvailabilitySummaryQuerySchema, storefrontProductAvailabilitySummaryResponseSchema, storefrontProductAvailabilitySummarySchema, storefrontProductExtensionsQuerySchema, storefrontProductExtensionsResponseSchema, storefrontPromotionalOfferListQuerySchema, storefrontPromotionalOfferListResponseSchema, storefrontPromotionalOfferResponseSchema, storefrontPromotionalOfferSchema, storefrontSettingsInputSchema, storefrontSettingsSchema, } from "./validation.js";
|
|
4
|
+
export { storefrontAppliedOfferSchema, storefrontDepartureItinerarySchema, storefrontDepartureListQuerySchema, storefrontDepartureListResponseSchema, storefrontDeparturePricePreviewInputSchema, storefrontDeparturePricePreviewSchema, storefrontDepartureSchema, storefrontFormFieldInputSchema, storefrontFormFieldOptionSchema, storefrontFormFieldSchema, storefrontFormFieldTypeSchema, storefrontOfferApplyInputSchema, storefrontOfferAudienceSchema, storefrontOfferConflictSchema, storefrontOfferMutationReasonSchema, storefrontOfferMutationResponseSchema, storefrontOfferMutationResultSchema, storefrontOfferMutationStatusSchema, storefrontOfferRedeemInputSchema, storefrontPaymentMethodCodeSchema, storefrontPaymentMethodInputSchema, storefrontPaymentMethodSchema, storefrontProductAvailabilitySlotSchema, storefrontProductAvailabilityStateSchema, storefrontProductAvailabilitySummaryQuerySchema, storefrontProductAvailabilitySummaryResponseSchema, storefrontProductAvailabilitySummarySchema, storefrontProductExtensionsQuerySchema, storefrontProductExtensionsResponseSchema, storefrontPromotionalOfferListQuerySchema, storefrontPromotionalOfferListResponseSchema, storefrontPromotionalOfferResponseSchema, storefrontPromotionalOfferSchema, storefrontSettingsInputSchema, storefrontSettingsSchema, } from "./validation.js";
|
|
5
5
|
export const storefrontModule = {
|
|
6
6
|
name: "storefront",
|
|
7
7
|
};
|
package/dist/routes-public.d.ts
CHANGED
|
@@ -471,7 +471,157 @@ export declare function createStorefrontPublicRoutes(options?: StorefrontService
|
|
|
471
471
|
status: 404;
|
|
472
472
|
};
|
|
473
473
|
};
|
|
474
|
-
}
|
|
474
|
+
} & {
|
|
475
|
+
"/offers/:slug/apply": {
|
|
476
|
+
$post: {
|
|
477
|
+
input: {
|
|
478
|
+
param: {
|
|
479
|
+
slug: string;
|
|
480
|
+
};
|
|
481
|
+
};
|
|
482
|
+
output: {
|
|
483
|
+
data: {
|
|
484
|
+
status: "not_applicable" | "applied" | "invalid" | "conflict";
|
|
485
|
+
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;
|
|
486
|
+
offer: {
|
|
487
|
+
id: string;
|
|
488
|
+
name: string;
|
|
489
|
+
slug: string | null;
|
|
490
|
+
description: string | null;
|
|
491
|
+
discountType: "percentage" | "fixed_amount";
|
|
492
|
+
discountValue: string;
|
|
493
|
+
currency: string | null;
|
|
494
|
+
applicableProductIds: string[];
|
|
495
|
+
applicableDepartureIds: string[];
|
|
496
|
+
validFrom: string | null;
|
|
497
|
+
validTo: string | null;
|
|
498
|
+
minTravelers: number | null;
|
|
499
|
+
imageMobileUrl: string | null;
|
|
500
|
+
imageDesktopUrl: string | null;
|
|
501
|
+
stackable: boolean;
|
|
502
|
+
createdAt: string;
|
|
503
|
+
updatedAt: string;
|
|
504
|
+
} | null;
|
|
505
|
+
target: {
|
|
506
|
+
bookingId: string | null;
|
|
507
|
+
sessionId: string | null;
|
|
508
|
+
productId: string;
|
|
509
|
+
departureId: string | null;
|
|
510
|
+
};
|
|
511
|
+
pricing: {
|
|
512
|
+
basePriceCents: number;
|
|
513
|
+
currency: string;
|
|
514
|
+
discountAppliedCents: number;
|
|
515
|
+
discountedPriceCents: number;
|
|
516
|
+
};
|
|
517
|
+
appliedOffers: {
|
|
518
|
+
offerId: string;
|
|
519
|
+
offerName: string;
|
|
520
|
+
discountAppliedCents: number;
|
|
521
|
+
discountedPriceCents: number;
|
|
522
|
+
currency: string;
|
|
523
|
+
discountKind: "percentage" | "fixed_amount";
|
|
524
|
+
discountPercent: number | null;
|
|
525
|
+
discountAmountCents: number | null;
|
|
526
|
+
appliedCode: string | null;
|
|
527
|
+
stackable: boolean;
|
|
528
|
+
}[];
|
|
529
|
+
conflict: {
|
|
530
|
+
policy: "best_discount_wins" | "stackable_compose";
|
|
531
|
+
autoAppliedOfferIds: string[];
|
|
532
|
+
manualOfferId: string | null;
|
|
533
|
+
selectedOfferIds: string[];
|
|
534
|
+
message: string;
|
|
535
|
+
} | null;
|
|
536
|
+
};
|
|
537
|
+
};
|
|
538
|
+
outputFormat: "json";
|
|
539
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
540
|
+
} | {
|
|
541
|
+
input: {
|
|
542
|
+
param: {
|
|
543
|
+
slug: string;
|
|
544
|
+
};
|
|
545
|
+
};
|
|
546
|
+
output: {
|
|
547
|
+
error: string;
|
|
548
|
+
};
|
|
549
|
+
outputFormat: "json";
|
|
550
|
+
status: 501;
|
|
551
|
+
};
|
|
552
|
+
};
|
|
553
|
+
} & {
|
|
554
|
+
"/offers/redeem": {
|
|
555
|
+
$post: {
|
|
556
|
+
input: {};
|
|
557
|
+
output: {
|
|
558
|
+
data: {
|
|
559
|
+
status: "not_applicable" | "applied" | "invalid" | "conflict";
|
|
560
|
+
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;
|
|
561
|
+
offer: {
|
|
562
|
+
id: string;
|
|
563
|
+
name: string;
|
|
564
|
+
slug: string | null;
|
|
565
|
+
description: string | null;
|
|
566
|
+
discountType: "percentage" | "fixed_amount";
|
|
567
|
+
discountValue: string;
|
|
568
|
+
currency: string | null;
|
|
569
|
+
applicableProductIds: string[];
|
|
570
|
+
applicableDepartureIds: string[];
|
|
571
|
+
validFrom: string | null;
|
|
572
|
+
validTo: string | null;
|
|
573
|
+
minTravelers: number | null;
|
|
574
|
+
imageMobileUrl: string | null;
|
|
575
|
+
imageDesktopUrl: string | null;
|
|
576
|
+
stackable: boolean;
|
|
577
|
+
createdAt: string;
|
|
578
|
+
updatedAt: string;
|
|
579
|
+
} | null;
|
|
580
|
+
target: {
|
|
581
|
+
bookingId: string | null;
|
|
582
|
+
sessionId: string | null;
|
|
583
|
+
productId: string;
|
|
584
|
+
departureId: string | null;
|
|
585
|
+
};
|
|
586
|
+
pricing: {
|
|
587
|
+
basePriceCents: number;
|
|
588
|
+
currency: string;
|
|
589
|
+
discountAppliedCents: number;
|
|
590
|
+
discountedPriceCents: number;
|
|
591
|
+
};
|
|
592
|
+
appliedOffers: {
|
|
593
|
+
offerId: string;
|
|
594
|
+
offerName: string;
|
|
595
|
+
discountAppliedCents: number;
|
|
596
|
+
discountedPriceCents: number;
|
|
597
|
+
currency: string;
|
|
598
|
+
discountKind: "percentage" | "fixed_amount";
|
|
599
|
+
discountPercent: number | null;
|
|
600
|
+
discountAmountCents: number | null;
|
|
601
|
+
appliedCode: string | null;
|
|
602
|
+
stackable: boolean;
|
|
603
|
+
}[];
|
|
604
|
+
conflict: {
|
|
605
|
+
policy: "best_discount_wins" | "stackable_compose";
|
|
606
|
+
autoAppliedOfferIds: string[];
|
|
607
|
+
manualOfferId: string | null;
|
|
608
|
+
selectedOfferIds: string[];
|
|
609
|
+
message: string;
|
|
610
|
+
} | null;
|
|
611
|
+
};
|
|
612
|
+
};
|
|
613
|
+
outputFormat: "json";
|
|
614
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
615
|
+
} | {
|
|
616
|
+
input: {};
|
|
617
|
+
output: {
|
|
618
|
+
error: string;
|
|
619
|
+
};
|
|
620
|
+
outputFormat: "json";
|
|
621
|
+
status: 501;
|
|
622
|
+
};
|
|
623
|
+
};
|
|
624
|
+
}, "/", "/offers/redeem">;
|
|
475
625
|
export type StorefrontPublicRoutes = ReturnType<typeof createStorefrontPublicRoutes>;
|
|
476
626
|
export {};
|
|
477
627
|
//# sourceMappingURL=routes-public.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes-public.d.ts","sourceRoot":"","sources":["../src/routes-public.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,wBAAwB,EAC9B,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"routes-public.d.ts","sourceRoot":"","sources":["../src/routes-public.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,wBAAwB,EAC9B,MAAM,cAAc,CAAA;AAWrB,KAAK,GAAG,GAAG;IACT,SAAS,EAAE;QACT,EAAE,EAAE,OAAO,CAAA;KACZ,CAAA;CACF,CAAA;AAED,wBAAgB,4BAA4B,CAAC,OAAO,CAAC,EAAE,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAsH9E;AAED,MAAM,MAAM,sBAAsB,GAAG,UAAU,CAAC,OAAO,4BAA4B,CAAC,CAAA"}
|
package/dist/routes-public.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { parseJsonBody, parseQuery } from "@voyantjs/hono";
|
|
2
2
|
import { Hono } from "hono";
|
|
3
3
|
import { createStorefrontService, } from "./service.js";
|
|
4
|
-
import { storefrontDepartureListQuerySchema, storefrontDeparturePricePreviewInputSchema, storefrontProductAvailabilitySummaryQuerySchema, storefrontProductExtensionsQuerySchema, storefrontPromotionalOfferListQuerySchema, } from "./validation.js";
|
|
4
|
+
import { storefrontDepartureListQuerySchema, storefrontDeparturePricePreviewInputSchema, storefrontOfferApplyInputSchema, storefrontOfferRedeemInputSchema, storefrontProductAvailabilitySummaryQuerySchema, storefrontProductExtensionsQuerySchema, storefrontPromotionalOfferListQuerySchema, } from "./validation.js";
|
|
5
5
|
export function createStorefrontPublicRoutes(options) {
|
|
6
6
|
const storefrontService = createStorefrontService(options);
|
|
7
7
|
function getRequestContext(c) {
|
|
@@ -69,5 +69,24 @@ export function createStorefrontPublicRoutes(options) {
|
|
|
69
69
|
context: getRequestContext(c),
|
|
70
70
|
});
|
|
71
71
|
return offer ? c.json({ data: offer }) : c.json({ error: "Storefront offer not found" }, 404);
|
|
72
|
+
})
|
|
73
|
+
.post("/offers/:slug/apply", async (c) => {
|
|
74
|
+
const result = await storefrontService.applyOffer({
|
|
75
|
+
slug: c.req.param("slug"),
|
|
76
|
+
body: await parseJsonBody(c, storefrontOfferApplyInputSchema),
|
|
77
|
+
context: getRequestContext(c),
|
|
78
|
+
});
|
|
79
|
+
return result
|
|
80
|
+
? c.json({ data: result })
|
|
81
|
+
: c.json({ error: "Storefront offer application is not configured" }, 501);
|
|
82
|
+
})
|
|
83
|
+
.post("/offers/redeem", async (c) => {
|
|
84
|
+
const result = await storefrontService.redeemOffer({
|
|
85
|
+
body: await parseJsonBody(c, storefrontOfferRedeemInputSchema),
|
|
86
|
+
context: getRequestContext(c),
|
|
87
|
+
});
|
|
88
|
+
return result
|
|
89
|
+
? c.json({ data: result })
|
|
90
|
+
: c.json({ error: "Storefront offer redemption is not configured" }, 501);
|
|
72
91
|
});
|
|
73
92
|
}
|
package/dist/service.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
|
|
2
|
-
import { type StorefrontDepartureListQuery, type StorefrontDeparturePricePreviewInput, type StorefrontProductAvailabilitySummaryQuery, type StorefrontPromotionalOffer, type StorefrontSettings, type StorefrontSettingsInput } from "./validation.js";
|
|
2
|
+
import { type StorefrontDepartureListQuery, type StorefrontDeparturePricePreviewInput, type StorefrontOfferApplyInput, type StorefrontOfferMutationResult, type StorefrontOfferRedeemInput, type StorefrontProductAvailabilitySummaryQuery, type StorefrontPromotionalOffer, type StorefrontSettings, type StorefrontSettingsInput } from "./validation.js";
|
|
3
3
|
export interface StorefrontServiceOptions {
|
|
4
4
|
settings?: StorefrontSettingsInput;
|
|
5
5
|
resolveSettings?: (context: StorefrontRequestContext) => Promise<StorefrontSettingsInput> | StorefrontSettingsInput;
|
|
@@ -21,6 +21,13 @@ export interface StorefrontOfferResolvers {
|
|
|
21
21
|
slug: string;
|
|
22
22
|
locale?: string;
|
|
23
23
|
} & StorefrontRequestContext) => Promise<StorefrontPromotionalOffer | null> | StorefrontPromotionalOffer | null;
|
|
24
|
+
applyOffer?: (input: {
|
|
25
|
+
slug: string;
|
|
26
|
+
body: StorefrontOfferApplyInput;
|
|
27
|
+
} & StorefrontRequestContext) => Promise<StorefrontOfferMutationResult> | StorefrontOfferMutationResult;
|
|
28
|
+
redeemOffer?: (input: {
|
|
29
|
+
body: StorefrontOfferRedeemInput;
|
|
30
|
+
} & StorefrontRequestContext) => Promise<StorefrontOfferMutationResult> | StorefrontOfferMutationResult;
|
|
24
31
|
}
|
|
25
32
|
export declare function resolveStorefrontSettings(input?: StorefrontSettingsInput): StorefrontSettings;
|
|
26
33
|
export declare function createStorefrontService(options?: StorefrontServiceOptions): {
|
|
@@ -300,5 +307,14 @@ export declare function createStorefrontService(options?: StorefrontServiceOptio
|
|
|
300
307
|
locale?: string;
|
|
301
308
|
context?: StorefrontRequestContext;
|
|
302
309
|
}): Promise<StorefrontPromotionalOffer | null>;
|
|
310
|
+
applyOffer(input: {
|
|
311
|
+
slug: string;
|
|
312
|
+
body: StorefrontOfferApplyInput;
|
|
313
|
+
context?: StorefrontRequestContext;
|
|
314
|
+
}): Promise<StorefrontOfferMutationResult | null>;
|
|
315
|
+
redeemOffer(input: {
|
|
316
|
+
body: StorefrontOfferRedeemInput;
|
|
317
|
+
context?: StorefrontRequestContext;
|
|
318
|
+
}): Promise<StorefrontOfferMutationResult | null>;
|
|
303
319
|
};
|
|
304
320
|
//# sourceMappingURL=service.d.ts.map
|
package/dist/service.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAUjE,OAAO,EACL,KAAK,4BAA4B,EACjC,KAAK,oCAAoC,
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAUjE,OAAO,EACL,KAAK,4BAA4B,EACjC,KAAK,oCAAoC,EAGzC,KAAK,yBAAyB,EAC9B,KAAK,6BAA6B,EAClC,KAAK,0BAA0B,EAI/B,KAAK,yCAAyC,EAC9C,KAAK,0BAA0B,EAC/B,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAG7B,MAAM,iBAAiB,CAAA;AAExB,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,EAAE,uBAAuB,CAAA;IAClC,eAAe,CAAC,EAAE,CAChB,OAAO,EAAE,wBAAwB,KAC9B,OAAO,CAAC,uBAAuB,CAAC,GAAG,uBAAuB,CAAA;IAC/D,MAAM,CAAC,EAAE,wBAAwB,CAAA;IACjC,aAAa,CAAC,EAAE,CACd,OAAO,EAAE,wBAAwB,KAE/B,OAAO,CAAC,wBAAwB,GAAG,IAAI,GAAG,SAAS,CAAC,GACpD,wBAAwB,GACxB,IAAI,GACJ,SAAS,CAAA;CACd;AAED,MAAM,WAAW,wBAAwB;IACvC,EAAE,CAAC,EAAE,kBAAkB,CAAA;IACvB,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;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M,SACZ,oCAAoC;;;;;;;;;;;;;;;;6BAIpB,kBAAkB,aAAa,MAAM,aAAa,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sCAI3E,kBAAkB,aACX,MAAM,SACV,yCAAyC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAK5C,kBAAkB,SACf;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;;;;;;;;gCAIjB;QAChC,SAAS,EAAE,MAAM,CAAA;QACjB,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,OAAO,CAAC,EAAE,wBAAwB,CAAA;KACnC,GAAG,OAAO,CAAC,0BAA0B,EAAE,CAAC;0BAOb;QAC1B,IAAI,EAAE,MAAM,CAAA;QACZ,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,OAAO,CAAC,EAAE,wBAAwB,CAAA;KACnC,GAAG,OAAO,CAAC,0BAA0B,GAAG,IAAI,CAAC;sBAQtB;QACtB,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,EAAE,yBAAyB,CAAA;QAC/B,OAAO,CAAC,EAAE,wBAAwB,CAAA;KACnC,GAAG,OAAO,CAAC,6BAA6B,GAAG,IAAI,CAAC;uBAQxB;QACvB,IAAI,EAAE,0BAA0B,CAAA;QAChC,OAAO,CAAC,EAAE,wBAAwB,CAAA;KACnC,GAAG,OAAO,CAAC,6BAA6B,GAAG,IAAI,CAAC;EASpD"}
|
package/dist/service.js
CHANGED
|
@@ -100,5 +100,13 @@ export function createStorefrontService(options) {
|
|
|
100
100
|
const { context, ...offerInput } = input;
|
|
101
101
|
return ((await resolveOffers(context)?.then((resolvers) => resolvers?.getOfferBySlug?.({ ...offerInput, ...(context ?? {}) }))) ?? null);
|
|
102
102
|
},
|
|
103
|
+
async applyOffer(input) {
|
|
104
|
+
const { context, ...offerInput } = input;
|
|
105
|
+
return ((await resolveOffers(context)?.then((resolvers) => resolvers?.applyOffer?.({ ...offerInput, ...(context ?? {}) }))) ?? null);
|
|
106
|
+
},
|
|
107
|
+
async redeemOffer(input) {
|
|
108
|
+
const { context, ...offerInput } = input;
|
|
109
|
+
return ((await resolveOffers(context)?.then((resolvers) => resolvers?.redeemOffer?.({ ...offerInput, ...(context ?? {}) }))) ?? null);
|
|
110
|
+
},
|
|
103
111
|
};
|
|
104
112
|
}
|
package/dist/validation.d.ts
CHANGED
|
@@ -846,6 +846,262 @@ export declare const storefrontPromotionalOfferResponseSchema: z.ZodObject<{
|
|
|
846
846
|
updatedAt: z.ZodString;
|
|
847
847
|
}, z.core.$strip>;
|
|
848
848
|
}, z.core.$strip>;
|
|
849
|
+
export declare const storefrontOfferAudienceSchema: z.ZodEnum<{
|
|
850
|
+
staff: "staff";
|
|
851
|
+
customer: "customer";
|
|
852
|
+
partner: "partner";
|
|
853
|
+
supplier: "supplier";
|
|
854
|
+
}>;
|
|
855
|
+
export declare const storefrontOfferApplyInputSchema: z.ZodObject<{
|
|
856
|
+
productId: z.ZodString;
|
|
857
|
+
departureId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
858
|
+
bookingId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
859
|
+
sessionId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
860
|
+
locale: z.ZodOptional<z.ZodString>;
|
|
861
|
+
pax: z.ZodCoercedNumber<unknown>;
|
|
862
|
+
audience: z.ZodDefault<z.ZodEnum<{
|
|
863
|
+
staff: "staff";
|
|
864
|
+
customer: "customer";
|
|
865
|
+
partner: "partner";
|
|
866
|
+
supplier: "supplier";
|
|
867
|
+
}>>;
|
|
868
|
+
market: z.ZodDefault<z.ZodString>;
|
|
869
|
+
basePriceCents: z.ZodCoercedNumber<unknown>;
|
|
870
|
+
currency: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
871
|
+
}, z.core.$strip>;
|
|
872
|
+
export declare const storefrontOfferRedeemInputSchema: z.ZodObject<{
|
|
873
|
+
productId: z.ZodString;
|
|
874
|
+
departureId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
875
|
+
bookingId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
876
|
+
sessionId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
877
|
+
locale: z.ZodOptional<z.ZodString>;
|
|
878
|
+
pax: z.ZodCoercedNumber<unknown>;
|
|
879
|
+
audience: z.ZodDefault<z.ZodEnum<{
|
|
880
|
+
staff: "staff";
|
|
881
|
+
customer: "customer";
|
|
882
|
+
partner: "partner";
|
|
883
|
+
supplier: "supplier";
|
|
884
|
+
}>>;
|
|
885
|
+
market: z.ZodDefault<z.ZodString>;
|
|
886
|
+
basePriceCents: z.ZodCoercedNumber<unknown>;
|
|
887
|
+
currency: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
888
|
+
code: z.ZodString;
|
|
889
|
+
}, z.core.$strip>;
|
|
890
|
+
export declare const storefrontAppliedOfferSchema: z.ZodObject<{
|
|
891
|
+
offerId: z.ZodString;
|
|
892
|
+
offerName: z.ZodString;
|
|
893
|
+
discountAppliedCents: z.ZodNumber;
|
|
894
|
+
discountedPriceCents: z.ZodNumber;
|
|
895
|
+
currency: z.ZodString;
|
|
896
|
+
discountKind: z.ZodEnum<{
|
|
897
|
+
percentage: "percentage";
|
|
898
|
+
fixed_amount: "fixed_amount";
|
|
899
|
+
}>;
|
|
900
|
+
discountPercent: z.ZodNullable<z.ZodNumber>;
|
|
901
|
+
discountAmountCents: z.ZodNullable<z.ZodNumber>;
|
|
902
|
+
appliedCode: z.ZodNullable<z.ZodString>;
|
|
903
|
+
stackable: z.ZodBoolean;
|
|
904
|
+
}, z.core.$strip>;
|
|
905
|
+
export declare const storefrontOfferMutationStatusSchema: z.ZodEnum<{
|
|
906
|
+
not_applicable: "not_applicable";
|
|
907
|
+
applied: "applied";
|
|
908
|
+
invalid: "invalid";
|
|
909
|
+
conflict: "conflict";
|
|
910
|
+
}>;
|
|
911
|
+
export declare const storefrontOfferMutationReasonSchema: z.ZodNullable<z.ZodEnum<{
|
|
912
|
+
scope: "scope";
|
|
913
|
+
currency: "currency";
|
|
914
|
+
min_pax: "min_pax";
|
|
915
|
+
conflict: "conflict";
|
|
916
|
+
offer_not_found: "offer_not_found";
|
|
917
|
+
offer_expired: "offer_expired";
|
|
918
|
+
offer_not_yet_valid: "offer_not_yet_valid";
|
|
919
|
+
code_not_found: "code_not_found";
|
|
920
|
+
code_required: "code_required";
|
|
921
|
+
code_expired: "code_expired";
|
|
922
|
+
code_not_yet_valid: "code_not_yet_valid";
|
|
923
|
+
no_discount: "no_discount";
|
|
924
|
+
booking_mismatch: "booking_mismatch";
|
|
925
|
+
session_mismatch: "session_mismatch";
|
|
926
|
+
}>>;
|
|
927
|
+
export declare const storefrontOfferConflictSchema: z.ZodObject<{
|
|
928
|
+
policy: z.ZodEnum<{
|
|
929
|
+
best_discount_wins: "best_discount_wins";
|
|
930
|
+
stackable_compose: "stackable_compose";
|
|
931
|
+
}>;
|
|
932
|
+
autoAppliedOfferIds: z.ZodArray<z.ZodString>;
|
|
933
|
+
manualOfferId: z.ZodNullable<z.ZodString>;
|
|
934
|
+
selectedOfferIds: z.ZodArray<z.ZodString>;
|
|
935
|
+
message: z.ZodString;
|
|
936
|
+
}, z.core.$strip>;
|
|
937
|
+
export declare const storefrontOfferMutationResultSchema: z.ZodObject<{
|
|
938
|
+
status: z.ZodEnum<{
|
|
939
|
+
not_applicable: "not_applicable";
|
|
940
|
+
applied: "applied";
|
|
941
|
+
invalid: "invalid";
|
|
942
|
+
conflict: "conflict";
|
|
943
|
+
}>;
|
|
944
|
+
reason: z.ZodNullable<z.ZodEnum<{
|
|
945
|
+
scope: "scope";
|
|
946
|
+
currency: "currency";
|
|
947
|
+
min_pax: "min_pax";
|
|
948
|
+
conflict: "conflict";
|
|
949
|
+
offer_not_found: "offer_not_found";
|
|
950
|
+
offer_expired: "offer_expired";
|
|
951
|
+
offer_not_yet_valid: "offer_not_yet_valid";
|
|
952
|
+
code_not_found: "code_not_found";
|
|
953
|
+
code_required: "code_required";
|
|
954
|
+
code_expired: "code_expired";
|
|
955
|
+
code_not_yet_valid: "code_not_yet_valid";
|
|
956
|
+
no_discount: "no_discount";
|
|
957
|
+
booking_mismatch: "booking_mismatch";
|
|
958
|
+
session_mismatch: "session_mismatch";
|
|
959
|
+
}>>;
|
|
960
|
+
offer: z.ZodNullable<z.ZodObject<{
|
|
961
|
+
id: z.ZodString;
|
|
962
|
+
name: z.ZodString;
|
|
963
|
+
slug: z.ZodNullable<z.ZodString>;
|
|
964
|
+
description: z.ZodNullable<z.ZodString>;
|
|
965
|
+
discountType: z.ZodEnum<{
|
|
966
|
+
percentage: "percentage";
|
|
967
|
+
fixed_amount: "fixed_amount";
|
|
968
|
+
}>;
|
|
969
|
+
discountValue: z.ZodString;
|
|
970
|
+
currency: z.ZodNullable<z.ZodString>;
|
|
971
|
+
applicableProductIds: z.ZodArray<z.ZodString>;
|
|
972
|
+
applicableDepartureIds: z.ZodArray<z.ZodString>;
|
|
973
|
+
validFrom: z.ZodNullable<z.ZodString>;
|
|
974
|
+
validTo: z.ZodNullable<z.ZodString>;
|
|
975
|
+
minTravelers: z.ZodNullable<z.ZodNumber>;
|
|
976
|
+
imageMobileUrl: z.ZodNullable<z.ZodString>;
|
|
977
|
+
imageDesktopUrl: z.ZodNullable<z.ZodString>;
|
|
978
|
+
stackable: z.ZodBoolean;
|
|
979
|
+
createdAt: z.ZodString;
|
|
980
|
+
updatedAt: z.ZodString;
|
|
981
|
+
}, z.core.$strip>>;
|
|
982
|
+
target: z.ZodObject<{
|
|
983
|
+
bookingId: z.ZodNullable<z.ZodString>;
|
|
984
|
+
sessionId: z.ZodNullable<z.ZodString>;
|
|
985
|
+
productId: z.ZodString;
|
|
986
|
+
departureId: z.ZodNullable<z.ZodString>;
|
|
987
|
+
}, z.core.$strip>;
|
|
988
|
+
pricing: z.ZodObject<{
|
|
989
|
+
basePriceCents: z.ZodNumber;
|
|
990
|
+
currency: z.ZodString;
|
|
991
|
+
discountAppliedCents: z.ZodNumber;
|
|
992
|
+
discountedPriceCents: z.ZodNumber;
|
|
993
|
+
}, z.core.$strip>;
|
|
994
|
+
appliedOffers: z.ZodArray<z.ZodObject<{
|
|
995
|
+
offerId: z.ZodString;
|
|
996
|
+
offerName: z.ZodString;
|
|
997
|
+
discountAppliedCents: z.ZodNumber;
|
|
998
|
+
discountedPriceCents: z.ZodNumber;
|
|
999
|
+
currency: z.ZodString;
|
|
1000
|
+
discountKind: z.ZodEnum<{
|
|
1001
|
+
percentage: "percentage";
|
|
1002
|
+
fixed_amount: "fixed_amount";
|
|
1003
|
+
}>;
|
|
1004
|
+
discountPercent: z.ZodNullable<z.ZodNumber>;
|
|
1005
|
+
discountAmountCents: z.ZodNullable<z.ZodNumber>;
|
|
1006
|
+
appliedCode: z.ZodNullable<z.ZodString>;
|
|
1007
|
+
stackable: z.ZodBoolean;
|
|
1008
|
+
}, z.core.$strip>>;
|
|
1009
|
+
conflict: z.ZodNullable<z.ZodObject<{
|
|
1010
|
+
policy: z.ZodEnum<{
|
|
1011
|
+
best_discount_wins: "best_discount_wins";
|
|
1012
|
+
stackable_compose: "stackable_compose";
|
|
1013
|
+
}>;
|
|
1014
|
+
autoAppliedOfferIds: z.ZodArray<z.ZodString>;
|
|
1015
|
+
manualOfferId: z.ZodNullable<z.ZodString>;
|
|
1016
|
+
selectedOfferIds: z.ZodArray<z.ZodString>;
|
|
1017
|
+
message: z.ZodString;
|
|
1018
|
+
}, z.core.$strip>>;
|
|
1019
|
+
}, z.core.$strip>;
|
|
1020
|
+
export declare const storefrontOfferMutationResponseSchema: z.ZodObject<{
|
|
1021
|
+
data: z.ZodObject<{
|
|
1022
|
+
status: z.ZodEnum<{
|
|
1023
|
+
not_applicable: "not_applicable";
|
|
1024
|
+
applied: "applied";
|
|
1025
|
+
invalid: "invalid";
|
|
1026
|
+
conflict: "conflict";
|
|
1027
|
+
}>;
|
|
1028
|
+
reason: z.ZodNullable<z.ZodEnum<{
|
|
1029
|
+
scope: "scope";
|
|
1030
|
+
currency: "currency";
|
|
1031
|
+
min_pax: "min_pax";
|
|
1032
|
+
conflict: "conflict";
|
|
1033
|
+
offer_not_found: "offer_not_found";
|
|
1034
|
+
offer_expired: "offer_expired";
|
|
1035
|
+
offer_not_yet_valid: "offer_not_yet_valid";
|
|
1036
|
+
code_not_found: "code_not_found";
|
|
1037
|
+
code_required: "code_required";
|
|
1038
|
+
code_expired: "code_expired";
|
|
1039
|
+
code_not_yet_valid: "code_not_yet_valid";
|
|
1040
|
+
no_discount: "no_discount";
|
|
1041
|
+
booking_mismatch: "booking_mismatch";
|
|
1042
|
+
session_mismatch: "session_mismatch";
|
|
1043
|
+
}>>;
|
|
1044
|
+
offer: z.ZodNullable<z.ZodObject<{
|
|
1045
|
+
id: z.ZodString;
|
|
1046
|
+
name: z.ZodString;
|
|
1047
|
+
slug: z.ZodNullable<z.ZodString>;
|
|
1048
|
+
description: z.ZodNullable<z.ZodString>;
|
|
1049
|
+
discountType: z.ZodEnum<{
|
|
1050
|
+
percentage: "percentage";
|
|
1051
|
+
fixed_amount: "fixed_amount";
|
|
1052
|
+
}>;
|
|
1053
|
+
discountValue: z.ZodString;
|
|
1054
|
+
currency: z.ZodNullable<z.ZodString>;
|
|
1055
|
+
applicableProductIds: z.ZodArray<z.ZodString>;
|
|
1056
|
+
applicableDepartureIds: z.ZodArray<z.ZodString>;
|
|
1057
|
+
validFrom: z.ZodNullable<z.ZodString>;
|
|
1058
|
+
validTo: z.ZodNullable<z.ZodString>;
|
|
1059
|
+
minTravelers: z.ZodNullable<z.ZodNumber>;
|
|
1060
|
+
imageMobileUrl: z.ZodNullable<z.ZodString>;
|
|
1061
|
+
imageDesktopUrl: z.ZodNullable<z.ZodString>;
|
|
1062
|
+
stackable: z.ZodBoolean;
|
|
1063
|
+
createdAt: z.ZodString;
|
|
1064
|
+
updatedAt: z.ZodString;
|
|
1065
|
+
}, z.core.$strip>>;
|
|
1066
|
+
target: z.ZodObject<{
|
|
1067
|
+
bookingId: z.ZodNullable<z.ZodString>;
|
|
1068
|
+
sessionId: z.ZodNullable<z.ZodString>;
|
|
1069
|
+
productId: z.ZodString;
|
|
1070
|
+
departureId: z.ZodNullable<z.ZodString>;
|
|
1071
|
+
}, z.core.$strip>;
|
|
1072
|
+
pricing: z.ZodObject<{
|
|
1073
|
+
basePriceCents: z.ZodNumber;
|
|
1074
|
+
currency: z.ZodString;
|
|
1075
|
+
discountAppliedCents: z.ZodNumber;
|
|
1076
|
+
discountedPriceCents: z.ZodNumber;
|
|
1077
|
+
}, z.core.$strip>;
|
|
1078
|
+
appliedOffers: z.ZodArray<z.ZodObject<{
|
|
1079
|
+
offerId: z.ZodString;
|
|
1080
|
+
offerName: z.ZodString;
|
|
1081
|
+
discountAppliedCents: z.ZodNumber;
|
|
1082
|
+
discountedPriceCents: z.ZodNumber;
|
|
1083
|
+
currency: z.ZodString;
|
|
1084
|
+
discountKind: z.ZodEnum<{
|
|
1085
|
+
percentage: "percentage";
|
|
1086
|
+
fixed_amount: "fixed_amount";
|
|
1087
|
+
}>;
|
|
1088
|
+
discountPercent: z.ZodNullable<z.ZodNumber>;
|
|
1089
|
+
discountAmountCents: z.ZodNullable<z.ZodNumber>;
|
|
1090
|
+
appliedCode: z.ZodNullable<z.ZodString>;
|
|
1091
|
+
stackable: z.ZodBoolean;
|
|
1092
|
+
}, z.core.$strip>>;
|
|
1093
|
+
conflict: z.ZodNullable<z.ZodObject<{
|
|
1094
|
+
policy: z.ZodEnum<{
|
|
1095
|
+
best_discount_wins: "best_discount_wins";
|
|
1096
|
+
stackable_compose: "stackable_compose";
|
|
1097
|
+
}>;
|
|
1098
|
+
autoAppliedOfferIds: z.ZodArray<z.ZodString>;
|
|
1099
|
+
manualOfferId: z.ZodNullable<z.ZodString>;
|
|
1100
|
+
selectedOfferIds: z.ZodArray<z.ZodString>;
|
|
1101
|
+
message: z.ZodString;
|
|
1102
|
+
}, z.core.$strip>>;
|
|
1103
|
+
}, z.core.$strip>;
|
|
1104
|
+
}, z.core.$strip>;
|
|
849
1105
|
export type StorefrontFormFieldInput = z.infer<typeof storefrontFormFieldInputSchema>;
|
|
850
1106
|
export type StorefrontFormField = z.infer<typeof storefrontFormFieldSchema>;
|
|
851
1107
|
export type StorefrontPaymentMethodInput = z.infer<typeof storefrontPaymentMethodInputSchema>;
|
|
@@ -857,4 +1113,8 @@ export type StorefrontDepartureListQuery = z.infer<typeof storefrontDepartureLis
|
|
|
857
1113
|
export type StorefrontProductAvailabilitySummaryQuery = z.infer<typeof storefrontProductAvailabilitySummaryQuerySchema>;
|
|
858
1114
|
export type StorefrontDeparturePricePreviewInput = z.infer<typeof storefrontDeparturePricePreviewInputSchema>;
|
|
859
1115
|
export type StorefrontPromotionalOffer = z.infer<typeof storefrontPromotionalOfferSchema>;
|
|
1116
|
+
export type StorefrontOfferApplyInput = z.infer<typeof storefrontOfferApplyInputSchema>;
|
|
1117
|
+
export type StorefrontOfferRedeemInput = z.infer<typeof storefrontOfferRedeemInputSchema>;
|
|
1118
|
+
export type StorefrontAppliedOffer = z.infer<typeof storefrontAppliedOfferSchema>;
|
|
1119
|
+
export type StorefrontOfferMutationResult = z.infer<typeof storefrontOfferMutationResultSchema>;
|
|
860
1120
|
//# sourceMappingURL=validation.d.ts.map
|
package/dist/validation.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAQvB,eAAO,MAAM,iCAAiC;;;;;;EAM5C,CAAA;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;;EASxC,CAAA;AAEF,eAAO,MAAM,+BAA+B;;;iBAG1C,CAAA;AAEF,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;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CAAC,CAAA;AACvF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAA;AACzF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAA;AACjF,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mCAAmC,CAAC,CAAA"}
|
package/dist/validation.js
CHANGED
|
@@ -378,3 +378,89 @@ export const storefrontPromotionalOfferListResponseSchema = z.object({
|
|
|
378
378
|
export const storefrontPromotionalOfferResponseSchema = z.object({
|
|
379
379
|
data: storefrontPromotionalOfferSchema,
|
|
380
380
|
});
|
|
381
|
+
export const storefrontOfferAudienceSchema = z.enum(["staff", "customer", "partner", "supplier"]);
|
|
382
|
+
const storefrontOfferTargetInputSchema = z.object({
|
|
383
|
+
productId: z.string().trim().min(1),
|
|
384
|
+
departureId: z.string().trim().min(1).optional().nullable(),
|
|
385
|
+
bookingId: z.string().trim().min(1).optional().nullable(),
|
|
386
|
+
sessionId: z.string().trim().min(1).optional().nullable(),
|
|
387
|
+
locale: z.string().trim().min(2).optional(),
|
|
388
|
+
pax: z.coerce.number().int().min(1),
|
|
389
|
+
audience: storefrontOfferAudienceSchema.default("customer"),
|
|
390
|
+
market: z.string().trim().min(1).default("default"),
|
|
391
|
+
basePriceCents: z.coerce.number().int().min(0),
|
|
392
|
+
currency: z
|
|
393
|
+
.string()
|
|
394
|
+
.trim()
|
|
395
|
+
.length(3)
|
|
396
|
+
.transform((value) => value.toUpperCase()),
|
|
397
|
+
});
|
|
398
|
+
export const storefrontOfferApplyInputSchema = storefrontOfferTargetInputSchema;
|
|
399
|
+
export const storefrontOfferRedeemInputSchema = storefrontOfferTargetInputSchema.extend({
|
|
400
|
+
code: z.string().trim().min(1).max(80),
|
|
401
|
+
});
|
|
402
|
+
export const storefrontAppliedOfferSchema = z.object({
|
|
403
|
+
offerId: z.string(),
|
|
404
|
+
offerName: z.string(),
|
|
405
|
+
discountAppliedCents: z.number().int(),
|
|
406
|
+
discountedPriceCents: z.number().int(),
|
|
407
|
+
currency: z.string(),
|
|
408
|
+
discountKind: z.enum(["percentage", "fixed_amount"]),
|
|
409
|
+
discountPercent: z.number().nullable(),
|
|
410
|
+
discountAmountCents: z.number().int().nullable(),
|
|
411
|
+
appliedCode: z.string().nullable(),
|
|
412
|
+
stackable: z.boolean(),
|
|
413
|
+
});
|
|
414
|
+
export const storefrontOfferMutationStatusSchema = z.enum([
|
|
415
|
+
"applied",
|
|
416
|
+
"not_applicable",
|
|
417
|
+
"invalid",
|
|
418
|
+
"conflict",
|
|
419
|
+
]);
|
|
420
|
+
export const storefrontOfferMutationReasonSchema = z
|
|
421
|
+
.enum([
|
|
422
|
+
"offer_not_found",
|
|
423
|
+
"offer_expired",
|
|
424
|
+
"offer_not_yet_valid",
|
|
425
|
+
"code_not_found",
|
|
426
|
+
"code_required",
|
|
427
|
+
"code_expired",
|
|
428
|
+
"code_not_yet_valid",
|
|
429
|
+
"scope",
|
|
430
|
+
"min_pax",
|
|
431
|
+
"currency",
|
|
432
|
+
"no_discount",
|
|
433
|
+
"booking_mismatch",
|
|
434
|
+
"session_mismatch",
|
|
435
|
+
"conflict",
|
|
436
|
+
])
|
|
437
|
+
.nullable();
|
|
438
|
+
export const storefrontOfferConflictSchema = z.object({
|
|
439
|
+
policy: z.enum(["best_discount_wins", "stackable_compose"]),
|
|
440
|
+
autoAppliedOfferIds: z.array(z.string()),
|
|
441
|
+
manualOfferId: z.string().nullable(),
|
|
442
|
+
selectedOfferIds: z.array(z.string()),
|
|
443
|
+
message: z.string(),
|
|
444
|
+
});
|
|
445
|
+
export const storefrontOfferMutationResultSchema = z.object({
|
|
446
|
+
status: storefrontOfferMutationStatusSchema,
|
|
447
|
+
reason: storefrontOfferMutationReasonSchema,
|
|
448
|
+
offer: storefrontPromotionalOfferSchema.nullable(),
|
|
449
|
+
target: z.object({
|
|
450
|
+
bookingId: z.string().nullable(),
|
|
451
|
+
sessionId: z.string().nullable(),
|
|
452
|
+
productId: z.string(),
|
|
453
|
+
departureId: z.string().nullable(),
|
|
454
|
+
}),
|
|
455
|
+
pricing: z.object({
|
|
456
|
+
basePriceCents: z.number().int(),
|
|
457
|
+
currency: z.string(),
|
|
458
|
+
discountAppliedCents: z.number().int(),
|
|
459
|
+
discountedPriceCents: z.number().int(),
|
|
460
|
+
}),
|
|
461
|
+
appliedOffers: z.array(storefrontAppliedOfferSchema),
|
|
462
|
+
conflict: storefrontOfferConflictSchema.nullable(),
|
|
463
|
+
});
|
|
464
|
+
export const storefrontOfferMutationResponseSchema = z.object({
|
|
465
|
+
data: storefrontOfferMutationResultSchema,
|
|
466
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voyantjs/storefront",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.44.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -29,18 +29,18 @@
|
|
|
29
29
|
"drizzle-orm": "^0.45.2",
|
|
30
30
|
"hono": "^4.12.10",
|
|
31
31
|
"zod": "^4.3.6",
|
|
32
|
-
"@voyantjs/availability": "0.
|
|
33
|
-
"@voyantjs/core": "0.
|
|
34
|
-
"@voyantjs/extras": "0.
|
|
35
|
-
"@voyantjs/hono": "0.
|
|
36
|
-
"@voyantjs/pricing": "0.
|
|
37
|
-
"@voyantjs/products": "0.
|
|
38
|
-
"@voyantjs/sellability": "0.
|
|
32
|
+
"@voyantjs/availability": "0.44.0",
|
|
33
|
+
"@voyantjs/core": "0.44.0",
|
|
34
|
+
"@voyantjs/extras": "0.44.0",
|
|
35
|
+
"@voyantjs/hono": "0.44.0",
|
|
36
|
+
"@voyantjs/pricing": "0.44.0",
|
|
37
|
+
"@voyantjs/products": "0.44.0",
|
|
38
|
+
"@voyantjs/sellability": "0.44.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"typescript": "^6.0.2",
|
|
42
42
|
"vitest": "^4.1.2",
|
|
43
|
-
"@voyantjs/db": "0.
|
|
43
|
+
"@voyantjs/db": "0.44.0",
|
|
44
44
|
"@voyantjs/voyant-typescript-config": "0.1.0"
|
|
45
45
|
},
|
|
46
46
|
"files": [
|