@voyantjs/sellability 0.1.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.
@@ -0,0 +1,758 @@
1
+ import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
2
+ import type { z } from "zod";
3
+ import type { insertOfferExpirationEventSchema, insertOfferRefreshRunSchema, insertSellabilityExplanationSchema, insertSellabilityPolicyResultSchema, insertSellabilityPolicySchema, offerExpirationEventListQuerySchema, offerRefreshRunListQuerySchema, SellabilityConstructOfferInput, SellabilityPersistSnapshotInput, SellabilityResolveQuery, sellabilityExplanationListQuerySchema, sellabilityPolicyListQuerySchema, sellabilityPolicyResultListQuerySchema, updateOfferExpirationEventSchema, updateOfferRefreshRunSchema, updateSellabilityExplanationSchema, updateSellabilityPolicyResultSchema, updateSellabilityPolicySchema } from "./validation.js";
4
+ type SellabilitySnapshotListQuery = {
5
+ limit: number;
6
+ offset: number;
7
+ offerId?: string;
8
+ marketId?: string;
9
+ channelId?: string;
10
+ productId?: string;
11
+ optionId?: string;
12
+ slotId?: string;
13
+ status?: "resolved" | "offer_constructed" | "expired";
14
+ };
15
+ type SellabilitySnapshotItemListQuery = {
16
+ limit: number;
17
+ offset: number;
18
+ snapshotId?: string;
19
+ productId?: string;
20
+ optionId?: string;
21
+ slotId?: string;
22
+ unitId?: string;
23
+ };
24
+ type SellabilityPolicyListQuery = z.infer<typeof sellabilityPolicyListQuerySchema>;
25
+ type CreateSellabilityPolicyInput = z.infer<typeof insertSellabilityPolicySchema>;
26
+ type UpdateSellabilityPolicyInput = z.infer<typeof updateSellabilityPolicySchema>;
27
+ type SellabilityPolicyResultListQuery = z.infer<typeof sellabilityPolicyResultListQuerySchema>;
28
+ type CreateSellabilityPolicyResultInput = z.infer<typeof insertSellabilityPolicyResultSchema>;
29
+ type UpdateSellabilityPolicyResultInput = z.infer<typeof updateSellabilityPolicyResultSchema>;
30
+ type OfferRefreshRunListQuery = z.infer<typeof offerRefreshRunListQuerySchema>;
31
+ type CreateOfferRefreshRunInput = z.infer<typeof insertOfferRefreshRunSchema>;
32
+ type UpdateOfferRefreshRunInput = z.infer<typeof updateOfferRefreshRunSchema>;
33
+ type OfferExpirationEventListQuery = z.infer<typeof offerExpirationEventListQuerySchema>;
34
+ type CreateOfferExpirationEventInput = z.infer<typeof insertOfferExpirationEventSchema>;
35
+ type UpdateOfferExpirationEventInput = z.infer<typeof updateOfferExpirationEventSchema>;
36
+ type SellabilityExplanationListQuery = z.infer<typeof sellabilityExplanationListQuerySchema>;
37
+ type CreateSellabilityExplanationInput = z.infer<typeof insertSellabilityExplanationSchema>;
38
+ type UpdateSellabilityExplanationInput = z.infer<typeof updateSellabilityExplanationSchema>;
39
+ type ResolvedPriceBreakdown = {
40
+ requestRef: string | null;
41
+ unitId: string | null;
42
+ unitName: string | null;
43
+ unitType: string | null;
44
+ pricingCategoryId: string | null;
45
+ pricingCategoryName: string | null;
46
+ quantity: number;
47
+ pricingMode: string;
48
+ sellAmountCents: number;
49
+ costAmountCents: number;
50
+ sourceRuleId: string | null;
51
+ tierId: string | null;
52
+ };
53
+ type ResolvedPriceComponent = {
54
+ kind: "base" | "unit" | "pickup" | "start_time_adjustment";
55
+ title: string;
56
+ quantity: number;
57
+ pricingMode: string;
58
+ sellAmountCents: number;
59
+ costAmountCents: number;
60
+ unitId: string | null;
61
+ unitName: string | null;
62
+ unitType: string | null;
63
+ pricingCategoryId: string | null;
64
+ pricingCategoryName: string | null;
65
+ requestRef: string | null;
66
+ sourceRuleId: string | null;
67
+ tierId: string | null;
68
+ };
69
+ export declare const sellabilityService: {
70
+ constructOffer(db: PostgresJsDatabase, input: SellabilityConstructOfferInput): Promise<{
71
+ resolution: {
72
+ product: {
73
+ id: string;
74
+ name: string;
75
+ };
76
+ option: {
77
+ id: string;
78
+ name: string;
79
+ code: string | null;
80
+ };
81
+ slot: {
82
+ id: string;
83
+ productId: string;
84
+ optionId: string | null;
85
+ startTimeId: string | null;
86
+ dateLocal: string;
87
+ startsAt: Date;
88
+ timezone: string;
89
+ unlimited: boolean;
90
+ remainingPax: number | null;
91
+ remainingPickups: number | null;
92
+ pastCutoff: boolean;
93
+ tooEarly: boolean;
94
+ };
95
+ market: {
96
+ id: string;
97
+ code: string;
98
+ name: string;
99
+ } | null;
100
+ channel: {
101
+ id: string;
102
+ kind: "direct" | "affiliate" | "ota" | "reseller" | "marketplace" | "api_partner";
103
+ } | null;
104
+ sellability: {
105
+ mode: "on_request" | "sellable" | "unavailable";
106
+ onRequest: boolean;
107
+ allotmentStatus: "sellable" | "not_applicable";
108
+ };
109
+ pricing: {
110
+ currencyCode: string;
111
+ sellAmountCents: number;
112
+ costAmountCents: number;
113
+ marginAmountCents: number;
114
+ breakdown: ResolvedPriceBreakdown[];
115
+ components: ResolvedPriceComponent[];
116
+ fx: {
117
+ fxRateSetId: string;
118
+ baseCurrency: string;
119
+ quoteCurrency: string;
120
+ rateDecimal: number;
121
+ } | null;
122
+ };
123
+ sources: {
124
+ marketProductRuleId: string | null;
125
+ marketChannelRuleId: string | null;
126
+ marketPriceCatalogId: string | null;
127
+ optionPriceRuleId: string;
128
+ optionStartTimeRuleId: string | null;
129
+ channelInventoryAllotmentIds: string[];
130
+ channelInventoryReleaseRuleId: string | null;
131
+ };
132
+ };
133
+ snapshot: {
134
+ id: string;
135
+ productId: string | null;
136
+ optionId: string | null;
137
+ createdAt: Date;
138
+ updatedAt: Date;
139
+ status: "expired" | "resolved" | "offer_constructed";
140
+ slotId: string | null;
141
+ channelId: string | null;
142
+ marketId: string | null;
143
+ fxRateSetId: string | null;
144
+ offerId: string | null;
145
+ expiresAt: Date | null;
146
+ requestedCurrencyCode: string | null;
147
+ sourceCurrencyCode: string | null;
148
+ queryPayload: Record<string, unknown>;
149
+ pricingSummary: Record<string, unknown>;
150
+ };
151
+ offer: {
152
+ id: string;
153
+ createdAt: Date;
154
+ updatedAt: Date;
155
+ status: "draft" | "expired" | "published" | "sent" | "accepted" | "withdrawn" | "converted";
156
+ notes: string | null;
157
+ costAmountCents: number;
158
+ title: string;
159
+ metadata: unknown;
160
+ validFrom: string | null;
161
+ currency: string;
162
+ marketId: string | null;
163
+ baseCurrency: string | null;
164
+ fxRateSetId: string | null;
165
+ offerNumber: string;
166
+ personId: string | null;
167
+ organizationId: string | null;
168
+ opportunityId: string | null;
169
+ quoteId: string | null;
170
+ sourceChannelId: string | null;
171
+ subtotalAmountCents: number;
172
+ taxAmountCents: number;
173
+ feeAmountCents: number;
174
+ totalAmountCents: number;
175
+ validUntil: string | null;
176
+ sentAt: Date | null;
177
+ acceptedAt: Date | null;
178
+ convertedAt: Date | null;
179
+ };
180
+ participants: {
181
+ id: string;
182
+ offerId: string;
183
+ personId: string | null;
184
+ participantType: "staff" | "other" | "traveler" | "booker" | "contact" | "occupant";
185
+ travelerCategory: "other" | "adult" | "child" | "infant" | "senior" | null;
186
+ firstName: string;
187
+ lastName: string;
188
+ email: string | null;
189
+ phone: string | null;
190
+ preferredLanguage: string | null;
191
+ isPrimary: boolean;
192
+ notes: string | null;
193
+ hasTravelIdentity: boolean;
194
+ createdAt: Date;
195
+ updatedAt: Date;
196
+ }[];
197
+ items: {
198
+ id: string;
199
+ productId: string | null;
200
+ optionId: string | null;
201
+ createdAt: Date;
202
+ updatedAt: Date;
203
+ startsAt: Date | null;
204
+ endsAt: Date | null;
205
+ status: "cancelled" | "draft" | "confirmed" | "fulfilled" | "priced";
206
+ notes: string | null;
207
+ slotId: string | null;
208
+ description: string | null;
209
+ sellCurrency: string;
210
+ title: string;
211
+ unitId: string | null;
212
+ costCurrency: string | null;
213
+ quantity: number;
214
+ metadata: unknown;
215
+ taxAmountCents: number | null;
216
+ feeAmountCents: number | null;
217
+ offerId: string;
218
+ itemType: "service" | "other" | "accommodation" | "transport" | "unit" | "adjustment" | "extra" | "fee" | "tax" | "discount";
219
+ serviceDate: string | null;
220
+ unitSellAmountCents: number | null;
221
+ totalSellAmountCents: number | null;
222
+ unitCostAmountCents: number | null;
223
+ totalCostAmountCents: number | null;
224
+ }[];
225
+ itemParticipants: {
226
+ id: string;
227
+ createdAt: Date;
228
+ isPrimary: boolean;
229
+ role: "other" | "traveler" | "occupant" | "primary_contact" | "beneficiary" | "service_assignee";
230
+ offerItemId: string;
231
+ participantId: string;
232
+ }[];
233
+ } | null>;
234
+ persistSnapshot(db: PostgresJsDatabase, input: SellabilityPersistSnapshotInput): Promise<{
235
+ snapshot: {
236
+ id: string;
237
+ productId: string | null;
238
+ optionId: string | null;
239
+ createdAt: Date;
240
+ updatedAt: Date;
241
+ status: "expired" | "resolved" | "offer_constructed";
242
+ slotId: string | null;
243
+ channelId: string | null;
244
+ marketId: string | null;
245
+ fxRateSetId: string | null;
246
+ offerId: string | null;
247
+ expiresAt: Date | null;
248
+ requestedCurrencyCode: string | null;
249
+ sourceCurrencyCode: string | null;
250
+ queryPayload: Record<string, unknown>;
251
+ pricingSummary: Record<string, unknown>;
252
+ };
253
+ resolved: {
254
+ data: {
255
+ product: {
256
+ id: string;
257
+ name: string;
258
+ };
259
+ option: {
260
+ id: string;
261
+ name: string;
262
+ code: string | null;
263
+ };
264
+ slot: {
265
+ id: string;
266
+ productId: string;
267
+ optionId: string | null;
268
+ startTimeId: string | null;
269
+ dateLocal: string;
270
+ startsAt: Date;
271
+ timezone: string;
272
+ unlimited: boolean;
273
+ remainingPax: number | null;
274
+ remainingPickups: number | null;
275
+ pastCutoff: boolean;
276
+ tooEarly: boolean;
277
+ };
278
+ market: {
279
+ id: string;
280
+ code: string;
281
+ name: string;
282
+ } | null;
283
+ channel: {
284
+ id: string;
285
+ kind: "direct" | "affiliate" | "ota" | "reseller" | "marketplace" | "api_partner";
286
+ } | null;
287
+ sellability: {
288
+ mode: "on_request" | "sellable" | "unavailable";
289
+ onRequest: boolean;
290
+ allotmentStatus: "sellable" | "not_applicable";
291
+ };
292
+ pricing: {
293
+ currencyCode: string;
294
+ sellAmountCents: number;
295
+ costAmountCents: number;
296
+ marginAmountCents: number;
297
+ breakdown: ResolvedPriceBreakdown[];
298
+ components: ResolvedPriceComponent[];
299
+ fx: {
300
+ fxRateSetId: string;
301
+ baseCurrency: string;
302
+ quoteCurrency: string;
303
+ rateDecimal: number;
304
+ } | null;
305
+ };
306
+ sources: {
307
+ marketProductRuleId: string | null;
308
+ marketChannelRuleId: string | null;
309
+ marketPriceCatalogId: string | null;
310
+ optionPriceRuleId: string;
311
+ optionStartTimeRuleId: string | null;
312
+ channelInventoryAllotmentIds: string[];
313
+ channelInventoryReleaseRuleId: string | null;
314
+ };
315
+ }[];
316
+ meta: {
317
+ total: number;
318
+ };
319
+ };
320
+ }>;
321
+ listSnapshots(db: PostgresJsDatabase, query: SellabilitySnapshotListQuery): Promise<{
322
+ data: {
323
+ id: string;
324
+ offerId: string | null;
325
+ marketId: string | null;
326
+ channelId: string | null;
327
+ productId: string | null;
328
+ optionId: string | null;
329
+ slotId: string | null;
330
+ requestedCurrencyCode: string | null;
331
+ sourceCurrencyCode: string | null;
332
+ fxRateSetId: string | null;
333
+ status: "expired" | "resolved" | "offer_constructed";
334
+ queryPayload: Record<string, unknown>;
335
+ pricingSummary: Record<string, unknown>;
336
+ expiresAt: Date | null;
337
+ createdAt: Date;
338
+ updatedAt: Date;
339
+ }[];
340
+ total: number;
341
+ limit: number;
342
+ offset: number;
343
+ }>;
344
+ getSnapshotById(db: PostgresJsDatabase, id: string): Promise<{
345
+ id: string;
346
+ offerId: string | null;
347
+ marketId: string | null;
348
+ channelId: string | null;
349
+ productId: string | null;
350
+ optionId: string | null;
351
+ slotId: string | null;
352
+ requestedCurrencyCode: string | null;
353
+ sourceCurrencyCode: string | null;
354
+ fxRateSetId: string | null;
355
+ status: "expired" | "resolved" | "offer_constructed";
356
+ queryPayload: Record<string, unknown>;
357
+ pricingSummary: Record<string, unknown>;
358
+ expiresAt: Date | null;
359
+ createdAt: Date;
360
+ updatedAt: Date;
361
+ } | null>;
362
+ listSnapshotItems(db: PostgresJsDatabase, query: SellabilitySnapshotItemListQuery): Promise<{
363
+ data: {
364
+ id: string;
365
+ snapshotId: string;
366
+ candidateIndex: number;
367
+ componentIndex: number;
368
+ productId: string | null;
369
+ optionId: string | null;
370
+ slotId: string | null;
371
+ unitId: string | null;
372
+ requestRef: string | null;
373
+ componentKind: "pickup" | "unit" | "base" | "start_time_adjustment";
374
+ title: string;
375
+ quantity: number;
376
+ pricingMode: string;
377
+ pricingCategoryId: string | null;
378
+ pricingCategoryName: string | null;
379
+ unitName: string | null;
380
+ unitType: string | null;
381
+ currencyCode: string;
382
+ sellAmountCents: number;
383
+ costAmountCents: number;
384
+ sourceRuleId: string | null;
385
+ tierId: string | null;
386
+ isSelected: boolean;
387
+ createdAt: Date;
388
+ }[];
389
+ total: number;
390
+ limit: number;
391
+ offset: number;
392
+ }>;
393
+ listPolicies(db: PostgresJsDatabase, query: SellabilityPolicyListQuery): Promise<{
394
+ data: {
395
+ id: string;
396
+ name: string;
397
+ scope: "product" | "option" | "channel" | "market" | "global";
398
+ policyType: "pickup" | "custom" | "capability" | "question" | "currency" | "allotment" | "occupancy" | "availability_window";
399
+ productId: string | null;
400
+ optionId: string | null;
401
+ marketId: string | null;
402
+ channelId: string | null;
403
+ priority: number;
404
+ active: boolean;
405
+ conditions: Record<string, unknown>;
406
+ effects: Record<string, unknown>;
407
+ notes: string | null;
408
+ metadata: Record<string, unknown> | null;
409
+ createdAt: Date;
410
+ updatedAt: Date;
411
+ }[];
412
+ total: number;
413
+ limit: number;
414
+ offset: number;
415
+ }>;
416
+ getPolicyById(db: PostgresJsDatabase, id: string): Promise<{
417
+ id: string;
418
+ name: string;
419
+ scope: "product" | "option" | "channel" | "market" | "global";
420
+ policyType: "pickup" | "custom" | "capability" | "question" | "currency" | "allotment" | "occupancy" | "availability_window";
421
+ productId: string | null;
422
+ optionId: string | null;
423
+ marketId: string | null;
424
+ channelId: string | null;
425
+ priority: number;
426
+ active: boolean;
427
+ conditions: Record<string, unknown>;
428
+ effects: Record<string, unknown>;
429
+ notes: string | null;
430
+ metadata: Record<string, unknown> | null;
431
+ createdAt: Date;
432
+ updatedAt: Date;
433
+ } | null>;
434
+ createPolicy(db: PostgresJsDatabase, data: CreateSellabilityPolicyInput): Promise<{
435
+ id: string;
436
+ name: string;
437
+ productId: string | null;
438
+ optionId: string | null;
439
+ active: boolean;
440
+ createdAt: Date;
441
+ updatedAt: Date;
442
+ notes: string | null;
443
+ metadata: Record<string, unknown> | null;
444
+ channelId: string | null;
445
+ scope: "product" | "option" | "channel" | "market" | "global";
446
+ marketId: string | null;
447
+ priority: number;
448
+ policyType: "pickup" | "custom" | "capability" | "question" | "currency" | "allotment" | "occupancy" | "availability_window";
449
+ conditions: Record<string, unknown>;
450
+ effects: Record<string, unknown>;
451
+ } | null>;
452
+ updatePolicy(db: PostgresJsDatabase, id: string, data: UpdateSellabilityPolicyInput): Promise<{
453
+ id: string;
454
+ name: string;
455
+ scope: "product" | "option" | "channel" | "market" | "global";
456
+ policyType: "pickup" | "custom" | "capability" | "question" | "currency" | "allotment" | "occupancy" | "availability_window";
457
+ productId: string | null;
458
+ optionId: string | null;
459
+ marketId: string | null;
460
+ channelId: string | null;
461
+ priority: number;
462
+ active: boolean;
463
+ conditions: Record<string, unknown>;
464
+ effects: Record<string, unknown>;
465
+ notes: string | null;
466
+ metadata: Record<string, unknown> | null;
467
+ createdAt: Date;
468
+ updatedAt: Date;
469
+ } | null>;
470
+ deletePolicy(db: PostgresJsDatabase, id: string): Promise<{
471
+ id: string;
472
+ } | null>;
473
+ listPolicyResults(db: PostgresJsDatabase, query: SellabilityPolicyResultListQuery): Promise<{
474
+ data: {
475
+ id: string;
476
+ snapshotId: string;
477
+ snapshotItemId: string | null;
478
+ policyId: string | null;
479
+ candidateIndex: number;
480
+ status: "warning" | "passed" | "blocked" | "adjusted";
481
+ message: string | null;
482
+ details: Record<string, unknown> | null;
483
+ createdAt: Date;
484
+ }[];
485
+ total: number;
486
+ limit: number;
487
+ offset: number;
488
+ }>;
489
+ getPolicyResultById(db: PostgresJsDatabase, id: string): Promise<{
490
+ id: string;
491
+ snapshotId: string;
492
+ snapshotItemId: string | null;
493
+ policyId: string | null;
494
+ candidateIndex: number;
495
+ status: "warning" | "passed" | "blocked" | "adjusted";
496
+ message: string | null;
497
+ details: Record<string, unknown> | null;
498
+ createdAt: Date;
499
+ } | null>;
500
+ createPolicyResult(db: PostgresJsDatabase, data: CreateSellabilityPolicyResultInput): Promise<{
501
+ message: string | null;
502
+ id: string;
503
+ createdAt: Date;
504
+ status: "warning" | "passed" | "blocked" | "adjusted";
505
+ snapshotId: string;
506
+ candidateIndex: number;
507
+ snapshotItemId: string | null;
508
+ policyId: string | null;
509
+ details: Record<string, unknown> | null;
510
+ } | null>;
511
+ updatePolicyResult(db: PostgresJsDatabase, id: string, data: UpdateSellabilityPolicyResultInput): Promise<{
512
+ id: string;
513
+ snapshotId: string;
514
+ snapshotItemId: string | null;
515
+ policyId: string | null;
516
+ candidateIndex: number;
517
+ status: "warning" | "passed" | "blocked" | "adjusted";
518
+ message: string | null;
519
+ details: Record<string, unknown> | null;
520
+ createdAt: Date;
521
+ } | null>;
522
+ deletePolicyResult(db: PostgresJsDatabase, id: string): Promise<{
523
+ id: string;
524
+ } | null>;
525
+ listOfferRefreshRuns(db: PostgresJsDatabase, query: OfferRefreshRunListQuery): Promise<{
526
+ data: {
527
+ id: string;
528
+ offerId: string;
529
+ snapshotId: string | null;
530
+ status: "pending" | "expired" | "failed" | "running" | "completed";
531
+ startedAt: Date;
532
+ completedAt: Date | null;
533
+ notes: string | null;
534
+ metadata: Record<string, unknown> | null;
535
+ createdAt: Date;
536
+ updatedAt: Date;
537
+ }[];
538
+ total: number;
539
+ limit: number;
540
+ offset: number;
541
+ }>;
542
+ getOfferRefreshRunById(db: PostgresJsDatabase, id: string): Promise<{
543
+ id: string;
544
+ offerId: string;
545
+ snapshotId: string | null;
546
+ status: "pending" | "expired" | "failed" | "running" | "completed";
547
+ startedAt: Date;
548
+ completedAt: Date | null;
549
+ notes: string | null;
550
+ metadata: Record<string, unknown> | null;
551
+ createdAt: Date;
552
+ updatedAt: Date;
553
+ } | null>;
554
+ createOfferRefreshRun(db: PostgresJsDatabase, data: CreateOfferRefreshRunInput): Promise<{
555
+ id: string;
556
+ createdAt: Date;
557
+ updatedAt: Date;
558
+ status: "pending" | "expired" | "failed" | "running" | "completed";
559
+ notes: string | null;
560
+ metadata: Record<string, unknown> | null;
561
+ startedAt: Date;
562
+ completedAt: Date | null;
563
+ offerId: string;
564
+ snapshotId: string | null;
565
+ } | null>;
566
+ updateOfferRefreshRun(db: PostgresJsDatabase, id: string, data: UpdateOfferRefreshRunInput): Promise<{
567
+ id: string;
568
+ offerId: string;
569
+ snapshotId: string | null;
570
+ status: "pending" | "expired" | "failed" | "running" | "completed";
571
+ startedAt: Date;
572
+ completedAt: Date | null;
573
+ notes: string | null;
574
+ metadata: Record<string, unknown> | null;
575
+ createdAt: Date;
576
+ updatedAt: Date;
577
+ } | null>;
578
+ deleteOfferRefreshRun(db: PostgresJsDatabase, id: string): Promise<{
579
+ id: string;
580
+ } | null>;
581
+ listOfferExpirationEvents(db: PostgresJsDatabase, query: OfferExpirationEventListQuery): Promise<{
582
+ data: {
583
+ id: string;
584
+ offerId: string;
585
+ snapshotId: string | null;
586
+ expiresAt: Date;
587
+ expiredAt: Date | null;
588
+ status: "cancelled" | "scheduled" | "expired" | "superseded";
589
+ reason: string | null;
590
+ metadata: Record<string, unknown> | null;
591
+ createdAt: Date;
592
+ updatedAt: Date;
593
+ }[];
594
+ total: number;
595
+ limit: number;
596
+ offset: number;
597
+ }>;
598
+ getOfferExpirationEventById(db: PostgresJsDatabase, id: string): Promise<{
599
+ id: string;
600
+ offerId: string;
601
+ snapshotId: string | null;
602
+ expiresAt: Date;
603
+ expiredAt: Date | null;
604
+ status: "cancelled" | "scheduled" | "expired" | "superseded";
605
+ reason: string | null;
606
+ metadata: Record<string, unknown> | null;
607
+ createdAt: Date;
608
+ updatedAt: Date;
609
+ } | null>;
610
+ createOfferExpirationEvent(db: PostgresJsDatabase, data: CreateOfferExpirationEventInput): Promise<{
611
+ id: string;
612
+ createdAt: Date;
613
+ updatedAt: Date;
614
+ status: "cancelled" | "scheduled" | "expired" | "superseded";
615
+ reason: string | null;
616
+ metadata: Record<string, unknown> | null;
617
+ offerId: string;
618
+ expiresAt: Date;
619
+ snapshotId: string | null;
620
+ expiredAt: Date | null;
621
+ } | null>;
622
+ updateOfferExpirationEvent(db: PostgresJsDatabase, id: string, data: UpdateOfferExpirationEventInput): Promise<{
623
+ id: string;
624
+ offerId: string;
625
+ snapshotId: string | null;
626
+ expiresAt: Date;
627
+ expiredAt: Date | null;
628
+ status: "cancelled" | "scheduled" | "expired" | "superseded";
629
+ reason: string | null;
630
+ metadata: Record<string, unknown> | null;
631
+ createdAt: Date;
632
+ updatedAt: Date;
633
+ } | null>;
634
+ deleteOfferExpirationEvent(db: PostgresJsDatabase, id: string): Promise<{
635
+ id: string;
636
+ } | null>;
637
+ listExplanations(db: PostgresJsDatabase, query: SellabilityExplanationListQuery): Promise<{
638
+ data: {
639
+ id: string;
640
+ snapshotId: string;
641
+ snapshotItemId: string | null;
642
+ candidateIndex: number;
643
+ explanationType: "pickup" | "policy" | "warning" | "allotment" | "sellable" | "pricing" | "blocked";
644
+ code: string | null;
645
+ message: string;
646
+ details: Record<string, unknown> | null;
647
+ createdAt: Date;
648
+ }[];
649
+ total: number;
650
+ limit: number;
651
+ offset: number;
652
+ }>;
653
+ getExplanationById(db: PostgresJsDatabase, id: string): Promise<{
654
+ id: string;
655
+ snapshotId: string;
656
+ snapshotItemId: string | null;
657
+ candidateIndex: number;
658
+ explanationType: "pickup" | "policy" | "warning" | "allotment" | "sellable" | "pricing" | "blocked";
659
+ code: string | null;
660
+ message: string;
661
+ details: Record<string, unknown> | null;
662
+ createdAt: Date;
663
+ } | null>;
664
+ createExplanation(db: PostgresJsDatabase, data: CreateSellabilityExplanationInput): Promise<{
665
+ message: string;
666
+ id: string;
667
+ createdAt: Date;
668
+ code: string | null;
669
+ snapshotId: string;
670
+ candidateIndex: number;
671
+ snapshotItemId: string | null;
672
+ details: Record<string, unknown> | null;
673
+ explanationType: "pickup" | "policy" | "warning" | "allotment" | "sellable" | "pricing" | "blocked";
674
+ } | null>;
675
+ updateExplanation(db: PostgresJsDatabase, id: string, data: UpdateSellabilityExplanationInput): Promise<{
676
+ id: string;
677
+ snapshotId: string;
678
+ snapshotItemId: string | null;
679
+ candidateIndex: number;
680
+ explanationType: "pickup" | "policy" | "warning" | "allotment" | "sellable" | "pricing" | "blocked";
681
+ code: string | null;
682
+ message: string;
683
+ details: Record<string, unknown> | null;
684
+ createdAt: Date;
685
+ } | null>;
686
+ deleteExplanation(db: PostgresJsDatabase, id: string): Promise<{
687
+ id: string;
688
+ } | null>;
689
+ resolve(db: PostgresJsDatabase, query: SellabilityResolveQuery): Promise<{
690
+ data: {
691
+ product: {
692
+ id: string;
693
+ name: string;
694
+ };
695
+ option: {
696
+ id: string;
697
+ name: string;
698
+ code: string | null;
699
+ };
700
+ slot: {
701
+ id: string;
702
+ productId: string;
703
+ optionId: string | null;
704
+ startTimeId: string | null;
705
+ dateLocal: string;
706
+ startsAt: Date;
707
+ timezone: string;
708
+ unlimited: boolean;
709
+ remainingPax: number | null;
710
+ remainingPickups: number | null;
711
+ pastCutoff: boolean;
712
+ tooEarly: boolean;
713
+ };
714
+ market: {
715
+ id: string;
716
+ code: string;
717
+ name: string;
718
+ } | null;
719
+ channel: {
720
+ id: string;
721
+ kind: "direct" | "affiliate" | "ota" | "reseller" | "marketplace" | "api_partner";
722
+ } | null;
723
+ sellability: {
724
+ mode: "on_request" | "sellable" | "unavailable";
725
+ onRequest: boolean;
726
+ allotmentStatus: "sellable" | "not_applicable";
727
+ };
728
+ pricing: {
729
+ currencyCode: string;
730
+ sellAmountCents: number;
731
+ costAmountCents: number;
732
+ marginAmountCents: number;
733
+ breakdown: ResolvedPriceBreakdown[];
734
+ components: ResolvedPriceComponent[];
735
+ fx: {
736
+ fxRateSetId: string;
737
+ baseCurrency: string;
738
+ quoteCurrency: string;
739
+ rateDecimal: number;
740
+ } | null;
741
+ };
742
+ sources: {
743
+ marketProductRuleId: string | null;
744
+ marketChannelRuleId: string | null;
745
+ marketPriceCatalogId: string | null;
746
+ optionPriceRuleId: string;
747
+ optionStartTimeRuleId: string | null;
748
+ channelInventoryAllotmentIds: string[];
749
+ channelInventoryReleaseRuleId: string | null;
750
+ };
751
+ }[];
752
+ meta: {
753
+ total: number;
754
+ };
755
+ }>;
756
+ };
757
+ export {};
758
+ //# sourceMappingURL=service.d.ts.map