order3000 0.15.0 → 0.17.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/client.cjs +365 -1
- package/dist/client.d.cts +857 -13
- package/dist/client.d.mts +857 -13
- package/dist/client.mjs +362 -2
- package/package.json +2 -2
package/dist/client.d.cts
CHANGED
|
@@ -14,6 +14,16 @@ declare class TokenManager {
|
|
|
14
14
|
initialize(): Promise<void>;
|
|
15
15
|
getToken(): Promise<string>;
|
|
16
16
|
getVenueId(): string;
|
|
17
|
+
/**
|
|
18
|
+
* Async counterpart to {@link getVenueId}. Fetches the token if it
|
|
19
|
+
* hasn't been loaded yet (which is what populates `defaultVenueId` via
|
|
20
|
+
* `setDefaultVenueId`), then returns the venue id.
|
|
21
|
+
*
|
|
22
|
+
* Prefer this over `getVenueId()` from request paths — a cold SDK
|
|
23
|
+
* instance will otherwise synchronously throw "No venue ID available"
|
|
24
|
+
* before the token has had a chance to load.
|
|
25
|
+
*/
|
|
26
|
+
getVenueIdAsync(): Promise<string>;
|
|
17
27
|
private refreshToken;
|
|
18
28
|
private setDefaultVenueId;
|
|
19
29
|
}
|
|
@@ -118,18 +128,20 @@ interface components {
|
|
|
118
128
|
/** @enum {string|null} */
|
|
119
129
|
paymentMethod?: "card" | "cash" | "voucher" | null;
|
|
120
130
|
/** @enum {string} */
|
|
121
|
-
paymentStatus?: "unpaid" | "paid" | "refunded";
|
|
131
|
+
paymentStatus?: "unpaid" | "paid" | "refunded" | "authorized" | "cash_pending";
|
|
122
132
|
taxAmount: number;
|
|
123
133
|
totalAmount: number;
|
|
124
134
|
/** @enum {string} */
|
|
125
135
|
currency?: "EUR" | "CHF";
|
|
126
136
|
/** @enum {string|null} */
|
|
127
137
|
fulfillmentType?: "pickup" | "delivery" | null;
|
|
128
|
-
fulfillmentAt
|
|
138
|
+
fulfillmentAt?: unknown;
|
|
129
139
|
orderedAt?: unknown;
|
|
130
140
|
orderedBy: string;
|
|
131
141
|
updatedAt?: unknown;
|
|
132
142
|
updatedBy?: string | null;
|
|
143
|
+
teamOrderId?: string | null;
|
|
144
|
+
participantDisplayName?: string | null;
|
|
133
145
|
};
|
|
134
146
|
/** PlaceOrderResponse */
|
|
135
147
|
PlaceOrderResponse: {
|
|
@@ -144,7 +156,7 @@ interface components {
|
|
|
144
156
|
/** @enum {string|null} */
|
|
145
157
|
paymentMethod: "card" | "cash" | "voucher" | null;
|
|
146
158
|
/** @enum {string} */
|
|
147
|
-
paymentStatus: "unpaid" | "paid" | "refunded";
|
|
159
|
+
paymentStatus: "unpaid" | "paid" | "refunded" | "authorized" | "cash_pending";
|
|
148
160
|
taxAmount: number;
|
|
149
161
|
totalAmount: number;
|
|
150
162
|
/** @enum {string} */
|
|
@@ -156,6 +168,8 @@ interface components {
|
|
|
156
168
|
orderedBy: string;
|
|
157
169
|
updatedAt: unknown;
|
|
158
170
|
updatedBy: string | null;
|
|
171
|
+
teamOrderId: string | null;
|
|
172
|
+
participantDisplayName: string | null;
|
|
159
173
|
};
|
|
160
174
|
/**
|
|
161
175
|
* MakeReservationRequest
|
|
@@ -167,6 +181,7 @@ interface components {
|
|
|
167
181
|
* @description UUID of the event this reservation is for
|
|
168
182
|
*/
|
|
169
183
|
eventId: string;
|
|
184
|
+
quickReferenceNumber?: number | null;
|
|
170
185
|
/** @description Date of the reservation in YYYY-MM-DD format */
|
|
171
186
|
reservationDate: string;
|
|
172
187
|
/** @description Time of the reservation in HH:MM:SS format */
|
|
@@ -227,6 +242,7 @@ interface components {
|
|
|
227
242
|
* @description Event identifier for this reservation
|
|
228
243
|
*/
|
|
229
244
|
eventId: string;
|
|
245
|
+
quickReferenceNumber: number | null;
|
|
230
246
|
/** @description Date of the reservation in YYYY-MM-DD format */
|
|
231
247
|
reservationDate: string;
|
|
232
248
|
/** @description Time of the reservation in HH:MM:SS format */
|
|
@@ -314,8 +330,13 @@ type OrderFulfillmentType = 'pickup' | 'delivery';
|
|
|
314
330
|
type PlaceOrderRequest = Omit<schemas['PlaceOrderRequest'], 'taxAmount' | 'totalAmount' | 'fulfillmentAt'> & {
|
|
315
331
|
/** Fulfillment type for the order (pickup or delivery) */
|
|
316
332
|
fulfillmentType?: OrderFulfillmentType;
|
|
317
|
-
/**
|
|
318
|
-
|
|
333
|
+
/**
|
|
334
|
+
* When the order should be fulfilled (ISO 8601 datetime or Date).
|
|
335
|
+
* Null / omitted in team-order mode — the Lead's pickup-time decision
|
|
336
|
+
* is attached to the team row and backfilled onto each child order at
|
|
337
|
+
* submit time.
|
|
338
|
+
*/
|
|
339
|
+
fulfillmentAt?: Date | string | null;
|
|
319
340
|
/** Guest session identifier for customer lookup */
|
|
320
341
|
sessionId?: string;
|
|
321
342
|
/** Customer first name (for cash orders) */
|
|
@@ -324,8 +345,12 @@ type PlaceOrderRequest = Omit<schemas['PlaceOrderRequest'], 'taxAmount' | 'total
|
|
|
324
345
|
customerLastName?: string;
|
|
325
346
|
/** Customer email address (for cash orders) */
|
|
326
347
|
customerEmail?: string;
|
|
327
|
-
/**
|
|
328
|
-
|
|
348
|
+
/**
|
|
349
|
+
* Deposit containers the customer declares they will return at pickup.
|
|
350
|
+
* Per-template references only — order3000 refuses any inbound deposit
|
|
351
|
+
* money amount.
|
|
352
|
+
*/
|
|
353
|
+
declaredReturns?: DeclaredReturn[];
|
|
329
354
|
};
|
|
330
355
|
type PlaceOrderResponse = schemas['PlaceOrderResponse'];
|
|
331
356
|
type MakeReservationRequest = schemas['MakeReservationRequest'];
|
|
@@ -517,13 +542,38 @@ interface Menu {
|
|
|
517
542
|
name: Record<string, string>;
|
|
518
543
|
description: Record<string, string> | null;
|
|
519
544
|
items?: MenuItem[];
|
|
545
|
+
/**
|
|
546
|
+
* Menu-level assets surfaced via the `menu_assets` junction. Populated
|
|
547
|
+
* when the caller passes `expand: ['assets']` (or `['items', 'assets']`)
|
|
548
|
+
* to `menus.getByAccessor` / `menus.get`. These are distinct from the
|
|
549
|
+
* per-item `dish.assets` / `beverage.assets` arrays — menu-level assets
|
|
550
|
+
* are curated for the menu as a whole (e.g. blog carousel imagery).
|
|
551
|
+
*/
|
|
552
|
+
assets?: MenuAsset[];
|
|
520
553
|
}
|
|
521
554
|
interface GetMenuOptions {
|
|
522
555
|
/** Expand related resources (items, assets) */
|
|
523
556
|
expand?: ('items' | 'assets')[];
|
|
524
557
|
}
|
|
525
558
|
interface MenuBundleDeposit {
|
|
559
|
+
/**
|
|
560
|
+
* Primary reference. Clients declare returns against this id +
|
|
561
|
+
* a count; they never specify a deposit money amount. order3000
|
|
562
|
+
* refuses to accept a deposit amount on any inbound payload.
|
|
563
|
+
*/
|
|
564
|
+
depositwareTemplateId: string;
|
|
565
|
+
/**
|
|
566
|
+
* Stable, human-readable handle for the underlying depositware
|
|
567
|
+
* template (e.g. `tiffinbox-3-1ee95d`). Lets app code target a
|
|
568
|
+
* canonical template by a code-level constant without hardcoding
|
|
569
|
+
* an environment-specific UUID.
|
|
570
|
+
*/
|
|
571
|
+
accessor: string;
|
|
526
572
|
name: Record<string, string>;
|
|
573
|
+
/**
|
|
574
|
+
* Display-only. Derived from `depositware_templates.deposit_base`.
|
|
575
|
+
* Never round-trip this value back to the server.
|
|
576
|
+
*/
|
|
527
577
|
amount: number;
|
|
528
578
|
currency: CurrencyCode;
|
|
529
579
|
}
|
|
@@ -590,6 +640,102 @@ interface GetEventOptions {
|
|
|
590
640
|
/** Expand related resources (schedule, timeSlots, menus, posters) */
|
|
591
641
|
expand?: ('schedule' | 'timeSlots' | 'menus' | 'posters')[];
|
|
592
642
|
}
|
|
643
|
+
type AreaBookingMode = 'slot' | 'day';
|
|
644
|
+
type AreaBookingRequestStatus = 'pending' | 'approved' | 'rejected' | 'cancelled';
|
|
645
|
+
type AreaBookingRequestSource = 'website' | 'phone' | 'walk_in';
|
|
646
|
+
type AreaBookingStatus = 'confirmed' | 'arrived' | 'completed' | 'cancelled' | 'no_show';
|
|
647
|
+
interface AreaAsset {
|
|
648
|
+
id: string;
|
|
649
|
+
type: 'image' | 'video' | 'document';
|
|
650
|
+
tags: string[] | null;
|
|
651
|
+
filename: string;
|
|
652
|
+
contentType: string;
|
|
653
|
+
metadata: {
|
|
654
|
+
width?: number;
|
|
655
|
+
height?: number;
|
|
656
|
+
duration?: number;
|
|
657
|
+
} | null;
|
|
658
|
+
cropArea: CropArea | null;
|
|
659
|
+
publicUrl: string;
|
|
660
|
+
}
|
|
661
|
+
interface AreaFeature {
|
|
662
|
+
icon: string;
|
|
663
|
+
label: Record<string, string>;
|
|
664
|
+
description?: Record<string, string>;
|
|
665
|
+
}
|
|
666
|
+
interface Area {
|
|
667
|
+
id: string;
|
|
668
|
+
venueId: string;
|
|
669
|
+
accessor: string;
|
|
670
|
+
name: Record<string, string>;
|
|
671
|
+
description: Record<string, string> | null;
|
|
672
|
+
longDescription: Record<string, string> | null;
|
|
673
|
+
minCapacity: number | null;
|
|
674
|
+
maxCapacity: number;
|
|
675
|
+
currency: Currency;
|
|
676
|
+
/** Base price in cents (flat price per booking). Null when pricing is per-person only. */
|
|
677
|
+
basePrice: number | null;
|
|
678
|
+
/** Per-guest price in cents. Null when pricing is base-only. */
|
|
679
|
+
perPersonPrice: number | null;
|
|
680
|
+
features: AreaFeature[] | null;
|
|
681
|
+
bookingMode: AreaBookingMode;
|
|
682
|
+
assets?: AreaAsset[];
|
|
683
|
+
}
|
|
684
|
+
interface GetAreaOptions {
|
|
685
|
+
expand?: 'assets'[];
|
|
686
|
+
}
|
|
687
|
+
interface AreaAvailabilityWindow {
|
|
688
|
+
/** YYYY-MM-DD */
|
|
689
|
+
date: string;
|
|
690
|
+
/** HH:MM:SS, null for day-mode bookings */
|
|
691
|
+
startTime: string | null;
|
|
692
|
+
endTime: string | null;
|
|
693
|
+
}
|
|
694
|
+
interface AreaAvailabilityResponse {
|
|
695
|
+
from: string;
|
|
696
|
+
to: string;
|
|
697
|
+
bookingMode: AreaBookingMode;
|
|
698
|
+
occupied: AreaAvailabilityWindow[];
|
|
699
|
+
}
|
|
700
|
+
interface GetAreaAvailabilityOptions {
|
|
701
|
+
/** YYYY-MM-DD — defaults to today */
|
|
702
|
+
from?: string;
|
|
703
|
+
/** YYYY-MM-DD — defaults to today + 90d */
|
|
704
|
+
to?: string;
|
|
705
|
+
}
|
|
706
|
+
interface SubmitAreaBookingRequestPayload {
|
|
707
|
+
/** YYYY-MM-DD */
|
|
708
|
+
requestedDate: string;
|
|
709
|
+
/** HH:MM:SS — omit for day-mode bookings */
|
|
710
|
+
requestedStartTime?: string;
|
|
711
|
+
requestedEndTime?: string;
|
|
712
|
+
partySize: number;
|
|
713
|
+
customerFirstName: string;
|
|
714
|
+
customerLastName: string;
|
|
715
|
+
customerEmail: string;
|
|
716
|
+
customerPhone?: string;
|
|
717
|
+
message?: string;
|
|
718
|
+
source?: AreaBookingRequestSource;
|
|
719
|
+
}
|
|
720
|
+
interface AreaBookingRequestResponse {
|
|
721
|
+
id: string;
|
|
722
|
+
venueId: string;
|
|
723
|
+
areaId: string;
|
|
724
|
+
requestedDate: string;
|
|
725
|
+
requestedStartTime: string | null;
|
|
726
|
+
requestedEndTime: string | null;
|
|
727
|
+
partySize: number;
|
|
728
|
+
customerFirstName: string;
|
|
729
|
+
customerLastName: string;
|
|
730
|
+
customerEmail: string;
|
|
731
|
+
customerPhone: string | null;
|
|
732
|
+
message: string | null;
|
|
733
|
+
source: AreaBookingRequestSource;
|
|
734
|
+
status: AreaBookingRequestStatus;
|
|
735
|
+
areaBookingId: string | null;
|
|
736
|
+
createdAt: string | null;
|
|
737
|
+
updatedAt: string | null;
|
|
738
|
+
}
|
|
593
739
|
type BasketStatus = 'active' | 'abandoned' | 'converted';
|
|
594
740
|
type Currency = 'EUR' | 'CHF';
|
|
595
741
|
/**
|
|
@@ -618,6 +764,17 @@ interface BasketItemMetadata {
|
|
|
618
764
|
price?: number;
|
|
619
765
|
[key: string]: unknown;
|
|
620
766
|
}
|
|
767
|
+
/**
|
|
768
|
+
* Deposit info on a basket item — **always server-derived** from the row's
|
|
769
|
+
* `depositware_template_id` column. order3000 refuses any inbound deposit
|
|
770
|
+
* money amount; this object is outbound-only, for UI display.
|
|
771
|
+
*/
|
|
772
|
+
interface BasketItemDeposit {
|
|
773
|
+
depositwareTemplateId: string;
|
|
774
|
+
name: Record<string, string>;
|
|
775
|
+
amount: number;
|
|
776
|
+
currency: Currency;
|
|
777
|
+
}
|
|
621
778
|
/**
|
|
622
779
|
* A basket item represents a single physical product in the basket.
|
|
623
780
|
*
|
|
@@ -628,6 +785,7 @@ interface BasketItemMetadata {
|
|
|
628
785
|
interface BasketItem {
|
|
629
786
|
id: string;
|
|
630
787
|
metadata: BasketItemMetadata | null;
|
|
788
|
+
deposit: BasketItemDeposit | null;
|
|
631
789
|
menuItems: BasketItemMenuItemRef[];
|
|
632
790
|
}
|
|
633
791
|
interface Basket {
|
|
@@ -637,10 +795,99 @@ interface Basket {
|
|
|
637
795
|
currency: Currency;
|
|
638
796
|
items: BasketItem[];
|
|
639
797
|
itemCount: number;
|
|
798
|
+
/**
|
|
799
|
+
* Canonical totals computed server-side and shipped inline with the
|
|
800
|
+
* basket. Computed using `declaredReturns` below, so the deposit
|
|
801
|
+
* credit is already baked into `effectiveTotal` — clients render the
|
|
802
|
+
* final value on first paint without a follow-up chip-hydration round
|
|
803
|
+
* trip. Use `POST /baskets/:id/totals` only when the user interacts
|
|
804
|
+
* with the stepper to recompute with new counts.
|
|
805
|
+
*/
|
|
806
|
+
totals: BasketTotals;
|
|
807
|
+
/**
|
|
808
|
+
* Server-persisted declared-return counts (from `baskets.declared_returns`).
|
|
809
|
+
* Reflects the participant's last chip click. Clients seed their
|
|
810
|
+
* local `declaredReturns` store from this at hydration time so the
|
|
811
|
+
* chip count + Gesamt are consistent on first paint. Only positive
|
|
812
|
+
* counts are present; zero entries are stripped.
|
|
813
|
+
*/
|
|
814
|
+
declaredReturns: DeclaredReturn[];
|
|
640
815
|
expiresAt: string;
|
|
641
816
|
createdAt: string | null;
|
|
642
817
|
updatedAt: string | null;
|
|
643
818
|
}
|
|
819
|
+
/**
|
|
820
|
+
* Order workflow status (matches `order_status` enum in order3000).
|
|
821
|
+
*/
|
|
822
|
+
type OrderStatus = 'pending' | 'in_progress' | 'ready' | 'completed' | 'cancelled';
|
|
823
|
+
/**
|
|
824
|
+
* Payment workflow status (matches `payment_status` enum in order3000).
|
|
825
|
+
*/
|
|
826
|
+
type PaymentStatus = 'unpaid' | 'authorized' | 'cash_pending' | 'paid' | 'refunded' | 'failed';
|
|
827
|
+
/**
|
|
828
|
+
* The most recent non-team order for a guest session, with the captured
|
|
829
|
+
* basket items + totals + declared returns inlined. Returned by
|
|
830
|
+
* `orders.getLatest(sessionId)`. Used by thamarai to drive the
|
|
831
|
+
* post-placement read-only view of the ThermoBox stepper.
|
|
832
|
+
*
|
|
833
|
+
* `null` when the session has no qualifying order — fresh sessionIds
|
|
834
|
+
* and team-only sessions both fall through to `null`.
|
|
835
|
+
*/
|
|
836
|
+
interface LatestOrder {
|
|
837
|
+
id: string;
|
|
838
|
+
/** URL-safe non-guessable id (e.g. `ORD-A3B7K2`). Nullable until backfill. */
|
|
839
|
+
publicId: string | null;
|
|
840
|
+
/** Cycling 100→999 per venue. Nullable until PaymentIntent assigns. */
|
|
841
|
+
quickReferenceNumber: number | null;
|
|
842
|
+
status: OrderStatus;
|
|
843
|
+
paymentStatus: PaymentStatus;
|
|
844
|
+
fulfillmentType: OrderFulfillmentType | null;
|
|
845
|
+
/** ISO timestamp of pickup / delivery. */
|
|
846
|
+
fulfillmentAt: string | null;
|
|
847
|
+
orderedAt: string;
|
|
848
|
+
totalAmount: number;
|
|
849
|
+
currency: Currency;
|
|
850
|
+
/** Captured basket items — same shape `Basket.items` uses. */
|
|
851
|
+
items: BasketItem[];
|
|
852
|
+
itemCount: number;
|
|
853
|
+
/** Captured basket totals; `effectiveTotal` already reflects the credit. */
|
|
854
|
+
totals: BasketTotals;
|
|
855
|
+
/** Declared-return counts the customer locked in at submit time. */
|
|
856
|
+
declaredReturns: DeclaredReturn[];
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
* One "I'll return N of this template" declaration. Canonical deposit
|
|
860
|
+
* input across every order3000 endpoint — clients never specify a
|
|
861
|
+
* deposit money amount.
|
|
862
|
+
*/
|
|
863
|
+
interface DeclaredReturn {
|
|
864
|
+
depositwareTemplateId: string;
|
|
865
|
+
count: number;
|
|
866
|
+
}
|
|
867
|
+
/**
|
|
868
|
+
* Canonical basket totals (all cents). The single figure clients read
|
|
869
|
+
* for every displayed monetary value; replaces every local amount-times-
|
|
870
|
+
* count multiplication.
|
|
871
|
+
*/
|
|
872
|
+
interface BasketTotals {
|
|
873
|
+
currency: Currency;
|
|
874
|
+
/** Food prices summed across basket items (tax-inclusive, no deposits). */
|
|
875
|
+
itemsTotal: number;
|
|
876
|
+
/** Tax portion extracted from `itemsTotal`. */
|
|
877
|
+
taxAmount: number;
|
|
878
|
+
/** Sum of deposits currently in the basket (one per returnable item). */
|
|
879
|
+
depositCharge: number;
|
|
880
|
+
/** `itemsTotal + depositCharge` — what an un-declared customer pays. */
|
|
881
|
+
grossTotal: number;
|
|
882
|
+
/** Credit owed for declared returns (bounded per-template by `returnable`). */
|
|
883
|
+
depositCredit: number;
|
|
884
|
+
/** `grossTotal − depositCredit`, clamped to zero. */
|
|
885
|
+
effectiveTotal: number;
|
|
886
|
+
/** When `depositCredit > grossTotal`, the excess is a cash refund due. */
|
|
887
|
+
cashRefund: number;
|
|
888
|
+
/** How many units of each depositware template the basket currently holds. */
|
|
889
|
+
returnable: DeclaredReturn[];
|
|
890
|
+
}
|
|
644
891
|
/**
|
|
645
892
|
* Request to add an item to the basket.
|
|
646
893
|
*
|
|
@@ -660,31 +907,121 @@ interface AddToBasketRequest {
|
|
|
660
907
|
interface AddToBasketResponse {
|
|
661
908
|
basketItemId: string;
|
|
662
909
|
itemCount: number;
|
|
910
|
+
deposit: BasketItemDeposit | null;
|
|
911
|
+
/**
|
|
912
|
+
* Fresh canonical totals for the mutated basket (declaredReturns=[]).
|
|
913
|
+
* Clients apply this directly to their store — no extra round trip.
|
|
914
|
+
*/
|
|
915
|
+
totals: BasketTotals;
|
|
663
916
|
}
|
|
664
917
|
interface RemoveFromBasketResponse {
|
|
665
918
|
success: boolean;
|
|
666
919
|
basketItemId: string;
|
|
667
920
|
itemCount: number;
|
|
921
|
+
/**
|
|
922
|
+
* Fresh canonical totals for the mutated basket (declaredReturns=[]).
|
|
923
|
+
* `null` when the basket has no items left after the removal.
|
|
924
|
+
*/
|
|
925
|
+
totals: BasketTotals | null;
|
|
668
926
|
}
|
|
669
927
|
interface CreatePaymentIntentRequest {
|
|
670
928
|
basketId: string;
|
|
671
929
|
currency: Currency;
|
|
672
930
|
sessionId: string;
|
|
673
931
|
fulfillmentType?: OrderFulfillmentType;
|
|
674
|
-
/**
|
|
675
|
-
|
|
932
|
+
/**
|
|
933
|
+
* Optional — null / omitted in team-order mode. The Lead's pickup-time
|
|
934
|
+
* decision is stored on the team row and backfilled onto each child
|
|
935
|
+
* order at submit time.
|
|
936
|
+
*/
|
|
937
|
+
fulfillmentAt?: Date | string | null;
|
|
676
938
|
/** Customer first name (for Stripe metadata and customer record) */
|
|
677
939
|
customerFirstName?: string;
|
|
678
940
|
/** Customer last name (for Stripe metadata and customer record) */
|
|
679
941
|
customerLastName?: string;
|
|
680
|
-
/**
|
|
681
|
-
|
|
942
|
+
/**
|
|
943
|
+
* Deposit containers the customer declares they will return at pickup.
|
|
944
|
+
* Per-template references only — order3000 refuses any inbound deposit
|
|
945
|
+
* money amount.
|
|
946
|
+
*/
|
|
947
|
+
declaredReturns?: DeclaredReturn[];
|
|
948
|
+
/**
|
|
949
|
+
* The team order's public identifier (URL `?publicId=…`) when the
|
|
950
|
+
* caller is checking out as a team participant. Omitted for individual
|
|
951
|
+
* checkout. The server enters team-participant mode (manual-capture PI
|
|
952
|
+
* awaiting the Lead's submit) only when this is present AND matches the
|
|
953
|
+
* basket's attached team. Stale `basket.teamOrderId` without a matching
|
|
954
|
+
* `teamOrderPublicId` is treated as individual — the basket simply
|
|
955
|
+
* carries a dead pointer from an abandoned prior session.
|
|
956
|
+
*/
|
|
957
|
+
teamOrderPublicId?: string;
|
|
682
958
|
}
|
|
683
959
|
interface CreatePaymentIntentResponse {
|
|
684
960
|
clientSecret: string;
|
|
685
961
|
paymentIntentId: string;
|
|
686
962
|
orderId: string;
|
|
687
963
|
}
|
|
964
|
+
interface CreateDeltaPaymentIntentRequest {
|
|
965
|
+
basketId: string;
|
|
966
|
+
sessionId: string;
|
|
967
|
+
currency: Currency;
|
|
968
|
+
/**
|
|
969
|
+
* Deposit containers the participant declares they will return at
|
|
970
|
+
* pickup. Used to apply deposit credit against the delta amount so the
|
|
971
|
+
* server's `currentTotal` matches the client's displayed effective
|
|
972
|
+
* total. Per-template references only.
|
|
973
|
+
*/
|
|
974
|
+
declaredReturns?: DeclaredReturn[];
|
|
975
|
+
}
|
|
976
|
+
interface CreateDeltaPaymentIntentResponse {
|
|
977
|
+
/** null when Stripe confirmed the off-session PI without further action. */
|
|
978
|
+
clientSecret: string | null;
|
|
979
|
+
paymentIntentId: string;
|
|
980
|
+
orderId: string;
|
|
981
|
+
/** Delta amount actually charged (cents). */
|
|
982
|
+
amount: number;
|
|
983
|
+
/**
|
|
984
|
+
* Stripe PaymentIntent status after confirm. Typically:
|
|
985
|
+
* - 'requires_capture' → one-tap succeeded; capture happens at submit
|
|
986
|
+
* - 'requires_action' → 3DS prompt required; client completes via clientSecret
|
|
987
|
+
* - 'succeeded' (rare here, auto-capture would have to be set)
|
|
988
|
+
*/
|
|
989
|
+
status: string;
|
|
990
|
+
}
|
|
991
|
+
interface ReduceDeltaPaymentIntentRequest {
|
|
992
|
+
basketId: string;
|
|
993
|
+
sessionId: string;
|
|
994
|
+
currency: Currency;
|
|
995
|
+
/**
|
|
996
|
+
* Deposit containers the participant declares they will return at pickup.
|
|
997
|
+
* Per-template references only; order3000 refuses any deposit money
|
|
998
|
+
* amount on input.
|
|
999
|
+
*/
|
|
1000
|
+
declaredReturns?: DeclaredReturn[];
|
|
1001
|
+
}
|
|
1002
|
+
interface ReduceDeltaPaymentIntentResponse {
|
|
1003
|
+
orderId: string;
|
|
1004
|
+
/** New authorised total (cents) after the reduction. */
|
|
1005
|
+
paidTotal: number;
|
|
1006
|
+
/** Amount actually released (cents). */
|
|
1007
|
+
released: number;
|
|
1008
|
+
}
|
|
1009
|
+
interface AddCashDeltaRequest {
|
|
1010
|
+
basketId: string;
|
|
1011
|
+
sessionId: string;
|
|
1012
|
+
/**
|
|
1013
|
+
* Deposit containers the participant declares they will return at pickup.
|
|
1014
|
+
* Per-template references only.
|
|
1015
|
+
*/
|
|
1016
|
+
declaredReturns?: DeclaredReturn[];
|
|
1017
|
+
}
|
|
1018
|
+
interface AddCashDeltaResponse {
|
|
1019
|
+
orderId: string;
|
|
1020
|
+
/** Delta amount (cents) recorded in this call. */
|
|
1021
|
+
amount: number;
|
|
1022
|
+
/** Sum of all active cash payments on this order after the delta row was inserted. */
|
|
1023
|
+
paidTotal: number;
|
|
1024
|
+
}
|
|
688
1025
|
interface ConfirmOrderRequest {
|
|
689
1026
|
paymentIntentId: string;
|
|
690
1027
|
}
|
|
@@ -692,6 +1029,8 @@ interface ConfirmOrderResponse {
|
|
|
692
1029
|
id: string;
|
|
693
1030
|
status: string;
|
|
694
1031
|
publicId: string | null;
|
|
1032
|
+
/** Cycling 100→999 short reference printed on receipts and shown to staff. */
|
|
1033
|
+
quickReferenceNumber: number | null;
|
|
695
1034
|
/** Customer ID for the order (for client-side tracking) */
|
|
696
1035
|
customerId?: string;
|
|
697
1036
|
}
|
|
@@ -754,6 +1093,27 @@ interface SubscriptionCredit {
|
|
|
754
1093
|
createdAt: string | null;
|
|
755
1094
|
}
|
|
756
1095
|
|
|
1096
|
+
declare class AreasResource extends BaseResource {
|
|
1097
|
+
constructor(tokenManager: TokenManager, baseUrl: string);
|
|
1098
|
+
/**
|
|
1099
|
+
* List bookable + public areas for the venue.
|
|
1100
|
+
*/
|
|
1101
|
+
list(options?: GetAreaOptions): Promise<Area[]>;
|
|
1102
|
+
/**
|
|
1103
|
+
* Fetch a single area by id or accessor.
|
|
1104
|
+
*/
|
|
1105
|
+
getByAccessor(accessor: string, options?: GetAreaOptions): Promise<Area>;
|
|
1106
|
+
/**
|
|
1107
|
+
* List occupied date/time windows for an area between `from` and `to`.
|
|
1108
|
+
*/
|
|
1109
|
+
getAvailability(accessor: string, options?: GetAreaAvailabilityOptions): Promise<AreaAvailabilityResponse>;
|
|
1110
|
+
/**
|
|
1111
|
+
* Submit a public booking request for an area.
|
|
1112
|
+
*/
|
|
1113
|
+
submitBookingRequest(accessor: string, payload: SubmitAreaBookingRequestPayload): Promise<AreaBookingRequestResponse>;
|
|
1114
|
+
private buildExpandQuery;
|
|
1115
|
+
}
|
|
1116
|
+
|
|
757
1117
|
declare class BasketsResource extends BaseResource {
|
|
758
1118
|
constructor(tokenManager: TokenManager, baseUrl: string);
|
|
759
1119
|
/**
|
|
@@ -780,6 +1140,49 @@ declare class BasketsResource extends BaseResource {
|
|
|
780
1140
|
* @returns The response with item count
|
|
781
1141
|
*/
|
|
782
1142
|
remove(sessionId: string, basketItemId: string): Promise<RemoveFromBasketResponse>;
|
|
1143
|
+
/**
|
|
1144
|
+
* Canonical totals for a basket. Clients read every displayed monetary
|
|
1145
|
+
* figure (effective total, deposit credit, cash refund) from this
|
|
1146
|
+
* endpoint — they never multiply deposit counts by amounts locally.
|
|
1147
|
+
*
|
|
1148
|
+
* Pass `declaredReturns` as references to depositware templates plus a
|
|
1149
|
+
* count. order3000 refuses deposit money amounts on input.
|
|
1150
|
+
*/
|
|
1151
|
+
getTotals(basketId: string, body?: {
|
|
1152
|
+
declaredReturns?: DeclaredReturn[];
|
|
1153
|
+
}): Promise<BasketTotals>;
|
|
1154
|
+
/**
|
|
1155
|
+
* Mark every active basket for the session as `abandoned`.
|
|
1156
|
+
*
|
|
1157
|
+
* Used by thamarai's "Neu starten" flow: after a non-team order
|
|
1158
|
+
* has been placed (its basket converted), the user might want to
|
|
1159
|
+
* start a fresh order. A subsequent `add()` call would otherwise
|
|
1160
|
+
* reuse any leftover active basket on the same session — which
|
|
1161
|
+
* can happen if a prior compose flow left an active row behind.
|
|
1162
|
+
* Calling `abandon()` first guarantees the next `add()` inserts a
|
|
1163
|
+
* brand-new active basket with exactly one item.
|
|
1164
|
+
*/
|
|
1165
|
+
abandon(sessionId: string): Promise<{
|
|
1166
|
+
abandonedCount: number;
|
|
1167
|
+
}>;
|
|
1168
|
+
/**
|
|
1169
|
+
* Persist per-template declared-return counts onto the basket.
|
|
1170
|
+
*
|
|
1171
|
+
* Used by team-order participants so the Lead's breakdown popover
|
|
1172
|
+
* sees every member's intent in real time (the standard
|
|
1173
|
+
* `useTeamOrderRealtime` postgres-changes subscription on
|
|
1174
|
+
* `baskets` then propagates the change to the team).
|
|
1175
|
+
*
|
|
1176
|
+
* Server validates `sessionId === basket.session_id` — only the
|
|
1177
|
+
* basket's owner can write to its declared returns.
|
|
1178
|
+
*/
|
|
1179
|
+
setDeclaredReturns(basketId: string, body: {
|
|
1180
|
+
sessionId: string;
|
|
1181
|
+
declaredReturns: DeclaredReturn[];
|
|
1182
|
+
}): Promise<{
|
|
1183
|
+
basketId: string;
|
|
1184
|
+
declaredReturns: DeclaredReturn[];
|
|
1185
|
+
}>;
|
|
783
1186
|
}
|
|
784
1187
|
|
|
785
1188
|
declare class EventsResource extends BaseResource {
|
|
@@ -845,6 +1248,13 @@ declare class MenusResource extends BaseResource {
|
|
|
845
1248
|
|
|
846
1249
|
declare class OrdersResource extends BaseResource {
|
|
847
1250
|
constructor(tokenManager: TokenManager, baseUrl: string);
|
|
1251
|
+
/**
|
|
1252
|
+
* Most recent non-team order for the guest session, with captured
|
|
1253
|
+
* basket items + totals + declared returns inlined. `null` when the
|
|
1254
|
+
* session has no qualifying order yet (fresh session, or only team
|
|
1255
|
+
* orders which go through `teamOrders` instead).
|
|
1256
|
+
*/
|
|
1257
|
+
getLatest(sessionId: string): Promise<LatestOrder | null>;
|
|
848
1258
|
/**
|
|
849
1259
|
* Place a new order.
|
|
850
1260
|
*
|
|
@@ -863,6 +1273,12 @@ declare class OrdersResource extends BaseResource {
|
|
|
863
1273
|
* the order to 'paid' status.
|
|
864
1274
|
*/
|
|
865
1275
|
confirm(orderId: string, request: ConfirmOrderRequest): Promise<ConfirmOrderResponse>;
|
|
1276
|
+
/**
|
|
1277
|
+
* Record an additional cash handover amount for a team-order participant
|
|
1278
|
+
* who has added items after their initial cash payment. No Stripe
|
|
1279
|
+
* interaction — this updates the handover total the Lead will collect.
|
|
1280
|
+
*/
|
|
1281
|
+
addCashDelta(request: AddCashDeltaRequest): Promise<AddCashDeltaResponse>;
|
|
866
1282
|
}
|
|
867
1283
|
|
|
868
1284
|
declare class PaymentIntentsResource extends BaseResource {
|
|
@@ -874,6 +1290,20 @@ declare class PaymentIntentsResource extends BaseResource {
|
|
|
874
1290
|
* for the draft order that was created.
|
|
875
1291
|
*/
|
|
876
1292
|
create(request: CreatePaymentIntentRequest): Promise<CreatePaymentIntentResponse>;
|
|
1293
|
+
/**
|
|
1294
|
+
* Create a delta PaymentIntent for a team-order participant who added
|
|
1295
|
+
* items after paying. Reuses the saved card from the initial auth so the
|
|
1296
|
+
* client only needs one tap (unless Stripe triggers 3DS).
|
|
1297
|
+
*/
|
|
1298
|
+
createDelta(request: CreateDeltaPaymentIntentRequest): Promise<CreateDeltaPaymentIntentResponse>;
|
|
1299
|
+
/**
|
|
1300
|
+
* Release part of a team-order participant's existing Stripe authorisation
|
|
1301
|
+
* when they remove items from their basket. Walks payments newest-first,
|
|
1302
|
+
* cancelling fully-consumed PIs and `update({ amount })`-ing the last
|
|
1303
|
+
* partially-trimmed one. No client-side confirmation — lowering a
|
|
1304
|
+
* `requires_capture` PI's amount is a single server round-trip.
|
|
1305
|
+
*/
|
|
1306
|
+
reduceDelta(request: ReduceDeltaPaymentIntentRequest): Promise<ReduceDeltaPaymentIntentResponse>;
|
|
877
1307
|
}
|
|
878
1308
|
|
|
879
1309
|
declare class ReservationsResource extends BaseResource {
|
|
@@ -929,6 +1359,418 @@ declare class SubscriptionsResource extends BaseResource {
|
|
|
929
1359
|
getCredits(subscriptionIdOrAccessor: string, subscriberId: string, status?: SubscriptionCreditStatus): Promise<SubscriptionCredit[]>;
|
|
930
1360
|
}
|
|
931
1361
|
|
|
1362
|
+
/**
|
|
1363
|
+
* Runtime enum objects that mirror order3000's Drizzle `pgEnum` shape —
|
|
1364
|
+
* they carry an `enumValues` tuple. This lets SDK consumers write the exact
|
|
1365
|
+
* same `z.enum(paymentMethodEnum.enumValues)` expression they would write
|
|
1366
|
+
* against a real pgEnum, keeping one consistent pattern across the
|
|
1367
|
+
* codebase (order3000's server imports the actual pgEnum from
|
|
1368
|
+
* `@/drizzle/enums`; thamarai and other SDK consumers import these
|
|
1369
|
+
* shape-compatible objects from 'order3000').
|
|
1370
|
+
*
|
|
1371
|
+
* The tuples themselves must stay in sync with the matching pgEnum in
|
|
1372
|
+
* `apps/order3000/src/drizzle/enums.ts`. That's a manual mirror — the SDK
|
|
1373
|
+
* is a standalone package and can't import from the app's Drizzle schema.
|
|
1374
|
+
*/
|
|
1375
|
+
declare const paymentMethodEnum: {
|
|
1376
|
+
enumValues: readonly ["card", "cash", "voucher"];
|
|
1377
|
+
};
|
|
1378
|
+
declare const fulfillmentTypeEnum: {
|
|
1379
|
+
enumValues: readonly ["pickup", "delivery"];
|
|
1380
|
+
};
|
|
1381
|
+
declare const teamOrderStatusEnum: {
|
|
1382
|
+
enumValues: readonly ["draft", "collecting", "locked", "placed", "ready", "completed", "cancelled"];
|
|
1383
|
+
};
|
|
1384
|
+
declare const participantStatusEnum: {
|
|
1385
|
+
enumValues: readonly ["browsing", "authorized", "cash_pending", "placed", "completed", "cancelled"];
|
|
1386
|
+
};
|
|
1387
|
+
type PaymentMethod = (typeof paymentMethodEnum.enumValues)[number];
|
|
1388
|
+
type FulfillmentType = (typeof fulfillmentTypeEnum.enumValues)[number];
|
|
1389
|
+
type TeamOrderStatus = (typeof teamOrderStatusEnum.enumValues)[number];
|
|
1390
|
+
type ParticipantStatus = (typeof participantStatusEnum.enumValues)[number];
|
|
1391
|
+
interface TeamDeliveryAddress {
|
|
1392
|
+
street: string;
|
|
1393
|
+
city: string;
|
|
1394
|
+
state: string;
|
|
1395
|
+
postalCode: string;
|
|
1396
|
+
country: string;
|
|
1397
|
+
}
|
|
1398
|
+
interface CreateTeamOrderRequest {
|
|
1399
|
+
sessionId: string;
|
|
1400
|
+
menuId: string;
|
|
1401
|
+
leadDisplayName: string;
|
|
1402
|
+
teamName?: string;
|
|
1403
|
+
logoUrl?: string;
|
|
1404
|
+
/**
|
|
1405
|
+
* Optional ISO 8601 datetime. The Lead's "close the window" decision —
|
|
1406
|
+
* unset on FAST-share creation. When null, the team never auto-locks;
|
|
1407
|
+
* the Lead explicitly submits when ready.
|
|
1408
|
+
*/
|
|
1409
|
+
deadlineAt?: string | null;
|
|
1410
|
+
fulfillmentType: FulfillmentType;
|
|
1411
|
+
/**
|
|
1412
|
+
* Optional ISO 8601 datetime. The Lead's pickup-time decision — unset
|
|
1413
|
+
* at team creation, set later on the Lead's Fulfilment step. Backfilled
|
|
1414
|
+
* onto each child `orders.fulfillmentAt` when `submitTeamOrder` fires.
|
|
1415
|
+
*/
|
|
1416
|
+
fulfillmentAt?: string | null;
|
|
1417
|
+
deliveryAddress?: TeamDeliveryAddress;
|
|
1418
|
+
allowedPaymentMethods: PaymentMethod[];
|
|
1419
|
+
eventId?: string;
|
|
1420
|
+
}
|
|
1421
|
+
interface CreateTeamOrderResponse {
|
|
1422
|
+
publicId: string;
|
|
1423
|
+
teamOrderId: string;
|
|
1424
|
+
}
|
|
1425
|
+
interface TeamOrderBasketItemMenuItemRef {
|
|
1426
|
+
menuItemId: string;
|
|
1427
|
+
role: string | null;
|
|
1428
|
+
quantity: number;
|
|
1429
|
+
unit: 'grams' | 'kilograms' | 'liters' | 'milliliters' | 'pieces';
|
|
1430
|
+
}
|
|
1431
|
+
interface TeamOrderBasketItem {
|
|
1432
|
+
id: string;
|
|
1433
|
+
metadata: BasketItemMetadata | null;
|
|
1434
|
+
menuItems: TeamOrderBasketItemMenuItemRef[];
|
|
1435
|
+
/**
|
|
1436
|
+
* `true` when the item's cumulative price (folded across the
|
|
1437
|
+
* participant's basket items in `basket_items.created_at` order)
|
|
1438
|
+
* is fully covered by the participant's `paidTotal`. `false`
|
|
1439
|
+
* when the item is part of an outstanding delta — typically an
|
|
1440
|
+
* item the participant added after their last authorisation but
|
|
1441
|
+
* hasn't run a delta payment for yet. Drives the per-item
|
|
1442
|
+
* "Confirmed" vs "Pending" badge in the team-mode BasketReview;
|
|
1443
|
+
* the Lead therefore can't be tricked into submitting while a
|
|
1444
|
+
* teammate has unpaid items in their cart.
|
|
1445
|
+
*/
|
|
1446
|
+
isPaid: boolean;
|
|
1447
|
+
}
|
|
1448
|
+
/**
|
|
1449
|
+
* Active payment row surfaced for a participant. "Active" excludes voided
|
|
1450
|
+
* and failed rows — those never reach the client.
|
|
1451
|
+
*/
|
|
1452
|
+
type TeamOrderParticipantPaymentStatus = 'authorized' | 'captured' | 'cash_pending' | 'cash_received';
|
|
1453
|
+
interface TeamOrderParticipantPayment {
|
|
1454
|
+
amount: number;
|
|
1455
|
+
method: PaymentMethod;
|
|
1456
|
+
status: TeamOrderParticipantPaymentStatus;
|
|
1457
|
+
createdAt: string;
|
|
1458
|
+
/**
|
|
1459
|
+
* Last 4 digits of the card used for this card payment. Populated
|
|
1460
|
+
* lazily by `fetchTeamOrder` for the *current viewer's* card rows
|
|
1461
|
+
* only (one Stripe round-trip per render, then cached on the
|
|
1462
|
+
* `team_order_payments` row), so the delta-payment UI can render
|
|
1463
|
+
* `Card **** 4242` and tell the user which card will be charged
|
|
1464
|
+
* or refunded. `null` for cash rows or while the lookup hasn't
|
|
1465
|
+
* landed yet.
|
|
1466
|
+
*/
|
|
1467
|
+
cardLast4: string | null;
|
|
1468
|
+
}
|
|
1469
|
+
interface TeamOrderParticipant {
|
|
1470
|
+
customerId: string;
|
|
1471
|
+
basketId: string | null;
|
|
1472
|
+
orderId: string | null;
|
|
1473
|
+
/**
|
|
1474
|
+
* Consecutive, never-reused join-order number. 1 for the lead; 2, 3, ...
|
|
1475
|
+
* for joiners in arrival order. Clients fall back to `Person {n}` when
|
|
1476
|
+
* `displayName` is null. Stays stable even if an earlier participant is
|
|
1477
|
+
* later dropped — numbers are not recycled.
|
|
1478
|
+
*/
|
|
1479
|
+
participantNumber: number | null;
|
|
1480
|
+
displayName: string | null;
|
|
1481
|
+
status: ParticipantStatus;
|
|
1482
|
+
bundleCount: number;
|
|
1483
|
+
amount: number;
|
|
1484
|
+
paymentMethod: PaymentMethod | null;
|
|
1485
|
+
isLead: boolean;
|
|
1486
|
+
/** True when this participant is the current caller (session match). */
|
|
1487
|
+
isMe: boolean;
|
|
1488
|
+
joinedAt: string;
|
|
1489
|
+
/**
|
|
1490
|
+
* Participant's current basket contents in SDK format (identical to what
|
|
1491
|
+
* `baskets.get` returns). The thamarai client feeds these straight into
|
|
1492
|
+
* its existing `hydrateBasket` → `transformBasketItem` transform.
|
|
1493
|
+
*/
|
|
1494
|
+
items: TeamOrderBasketItem[];
|
|
1495
|
+
/**
|
|
1496
|
+
* Per-participant payment trail — one row per auth (initial + each delta
|
|
1497
|
+
* round). Empty until the participant has checked out.
|
|
1498
|
+
*/
|
|
1499
|
+
payments: TeamOrderParticipantPayment[];
|
|
1500
|
+
/** Sum of `payments[].amount` (authorised/collected total). */
|
|
1501
|
+
paidTotal: number;
|
|
1502
|
+
/** `amount` − `paidTotal`, floored at 0. Positive = delta owed. */
|
|
1503
|
+
amountDue: number;
|
|
1504
|
+
/**
|
|
1505
|
+
* Server-persisted declared-return counts per depositware template,
|
|
1506
|
+
* captured the last time the participant authorised payment (or
|
|
1507
|
+
* resubmitted via a delta). Empty until they've checked out — and
|
|
1508
|
+
* always reflects what the server actually has on file (i.e.
|
|
1509
|
+
* `orderDeposits.declaredReturningCount`).
|
|
1510
|
+
*
|
|
1511
|
+
* Clients use this to hydrate the local "I'm returning N empties"
|
|
1512
|
+
* UI on refresh: without it, the local Zustand store starts empty,
|
|
1513
|
+
* so `useBasketTotals` recomputes `effectiveTotal` *without* the
|
|
1514
|
+
* deposit credit that was actually applied at auth time, causing
|
|
1515
|
+
* the delta-payment view to incorrectly demand or refund money.
|
|
1516
|
+
*/
|
|
1517
|
+
declaredReturns: Array<{
|
|
1518
|
+
depositwareTemplateId: string;
|
|
1519
|
+
count: number;
|
|
1520
|
+
}>;
|
|
1521
|
+
}
|
|
1522
|
+
interface ThresholdCheck {
|
|
1523
|
+
meets: boolean;
|
|
1524
|
+
failedConstraints: Array<'quantity' | 'amount'>;
|
|
1525
|
+
requiredQuantity: number | null;
|
|
1526
|
+
currentQuantity: number;
|
|
1527
|
+
requiredAmount: number | null;
|
|
1528
|
+
currentAmount: number;
|
|
1529
|
+
}
|
|
1530
|
+
interface FetchTeamOrderResponse {
|
|
1531
|
+
teamOrder: {
|
|
1532
|
+
id: string;
|
|
1533
|
+
publicId: string;
|
|
1534
|
+
venueId: string;
|
|
1535
|
+
menuId: string;
|
|
1536
|
+
eventId: string | null;
|
|
1537
|
+
teamName: string | null;
|
|
1538
|
+
logoUrl: string | null;
|
|
1539
|
+
leadDisplayName: string;
|
|
1540
|
+
status: TeamOrderStatus;
|
|
1541
|
+
allowedPaymentMethods: PaymentMethod[];
|
|
1542
|
+
fulfillmentType: FulfillmentType;
|
|
1543
|
+
fulfillmentAt: string | null;
|
|
1544
|
+
deadlineAt: string | null;
|
|
1545
|
+
lockedAt: string | null;
|
|
1546
|
+
placedAt: string | null;
|
|
1547
|
+
cancelledAt: string | null;
|
|
1548
|
+
/**
|
|
1549
|
+
* Free-text reason the Lead provided when dissolving the team order.
|
|
1550
|
+
* Surfaced to non-Lead participants via the `cancelledByLeadToast`
|
|
1551
|
+
* broadcast so they see context alongside the cancellation event.
|
|
1552
|
+
*/
|
|
1553
|
+
cancelReason: string | null;
|
|
1554
|
+
deliveryAddressId: string | null;
|
|
1555
|
+
/**
|
|
1556
|
+
* Free-form text the Lead types on the Fulfilment step describing
|
|
1557
|
+
* where the team will sit down to eat (e.g. "Kitchen K3, Building X").
|
|
1558
|
+
* `null` until the Lead enters a value.
|
|
1559
|
+
*/
|
|
1560
|
+
diningLocation: string | null;
|
|
1561
|
+
/**
|
|
1562
|
+
* HH:MM time (venue timezone) at which the team starts eating.
|
|
1563
|
+
* Derived server-side from `fulfillmentAt + effectiveOffset` where
|
|
1564
|
+
* `effectiveOffset = dining_offset_minutes ?? 15`. `null` only when
|
|
1565
|
+
* `fulfillmentAt` hasn't been set yet.
|
|
1566
|
+
*/
|
|
1567
|
+
diningTime: string | null;
|
|
1568
|
+
/**
|
|
1569
|
+
* Whether the team's menu is configured for delivery fulfillment.
|
|
1570
|
+
* Snapshotted from `menus.metadata.isDeliveryEnabled` at fetch time.
|
|
1571
|
+
* Clients use this to gate the Lead's "Switch to delivery" control.
|
|
1572
|
+
*/
|
|
1573
|
+
isDeliveryEnabled: boolean;
|
|
1574
|
+
/**
|
|
1575
|
+
* Cycling 100→999 short reference, repurposed from the Lead's own
|
|
1576
|
+
* `orders.quickReferenceNumber` so the team has exactly one number
|
|
1577
|
+
* — the same number printed on the consolidated kitchen receipt
|
|
1578
|
+
* and surfaced in the customer's Abwicklung view. `null` until the
|
|
1579
|
+
* Lead has authorised payment (the Lead's order row is created at
|
|
1580
|
+
* PaymentIntent time, which is when the quickRef is assigned).
|
|
1581
|
+
*/
|
|
1582
|
+
quickReferenceNumber: number | null;
|
|
1583
|
+
};
|
|
1584
|
+
deliveryThreshold: {
|
|
1585
|
+
amount: number | null;
|
|
1586
|
+
quantity: number | null;
|
|
1587
|
+
};
|
|
1588
|
+
participants: TeamOrderParticipant[];
|
|
1589
|
+
aggregatedTotals: {
|
|
1590
|
+
confirmedBundleCount: number;
|
|
1591
|
+
confirmedAmount: number;
|
|
1592
|
+
totalBundleCount: number;
|
|
1593
|
+
};
|
|
1594
|
+
thresholdCheck: ThresholdCheck;
|
|
1595
|
+
isLead: boolean;
|
|
1596
|
+
}
|
|
1597
|
+
interface JoinTeamOrderRequest {
|
|
1598
|
+
sessionId: string;
|
|
1599
|
+
displayName?: string;
|
|
1600
|
+
}
|
|
1601
|
+
interface JoinTeamOrderResponse {
|
|
1602
|
+
teamOrderId: string;
|
|
1603
|
+
basketId: string;
|
|
1604
|
+
customerId: string;
|
|
1605
|
+
status: TeamOrderStatus;
|
|
1606
|
+
isLead: boolean;
|
|
1607
|
+
alreadyJoined: boolean;
|
|
1608
|
+
}
|
|
1609
|
+
interface SubmitTeamOrderResponse {
|
|
1610
|
+
teamOrderId: string;
|
|
1611
|
+
status: TeamOrderStatus;
|
|
1612
|
+
capturedOrderIds: string[];
|
|
1613
|
+
cashPendingOrderIds: string[];
|
|
1614
|
+
droppedBasketIds: string[];
|
|
1615
|
+
placedAt: string;
|
|
1616
|
+
}
|
|
1617
|
+
interface CancelTeamOrderResponse {
|
|
1618
|
+
teamOrderId: string;
|
|
1619
|
+
status: TeamOrderStatus;
|
|
1620
|
+
voidedPaymentIntentIds: string[];
|
|
1621
|
+
cancelledAt: string;
|
|
1622
|
+
}
|
|
1623
|
+
interface ExtendDeadlineResponse {
|
|
1624
|
+
teamOrderId: string;
|
|
1625
|
+
status: TeamOrderStatus;
|
|
1626
|
+
deadlineAt: string | null;
|
|
1627
|
+
}
|
|
1628
|
+
interface SwitchFulfillmentResponse {
|
|
1629
|
+
teamOrderId: string;
|
|
1630
|
+
status: TeamOrderStatus;
|
|
1631
|
+
fulfillmentType: FulfillmentType;
|
|
1632
|
+
deliveryAddressId: string | null;
|
|
1633
|
+
}
|
|
1634
|
+
interface UpdateDeliveryAddressResponse {
|
|
1635
|
+
teamOrderId: string;
|
|
1636
|
+
deliveryAddressId: string;
|
|
1637
|
+
}
|
|
1638
|
+
/**
|
|
1639
|
+
* Team Orders SDK resource.
|
|
1640
|
+
*
|
|
1641
|
+
* Mixes venue-scoped and publicId-scoped endpoints, so it doesn't inherit
|
|
1642
|
+
* from BaseResource (which hard-codes /venues/{venueId}). Create goes to
|
|
1643
|
+
* `/venues/{venueId}/team-orders`; everything else targets
|
|
1644
|
+
* `/team-orders/{publicId}/...` because publicId is globally unique and the
|
|
1645
|
+
* venue is resolved server-side via a helper.
|
|
1646
|
+
*/
|
|
1647
|
+
declare class TeamOrdersResource {
|
|
1648
|
+
private readonly tokenManager;
|
|
1649
|
+
private readonly baseUrl;
|
|
1650
|
+
constructor(tokenManager: TokenManager, baseUrl: string);
|
|
1651
|
+
private request;
|
|
1652
|
+
/**
|
|
1653
|
+
* Lead creates a team order from their active basket.
|
|
1654
|
+
* Returns the unguessable `publicId` the lead shares with coworkers.
|
|
1655
|
+
*/
|
|
1656
|
+
create(request: CreateTeamOrderRequest): Promise<CreateTeamOrderResponse>;
|
|
1657
|
+
/**
|
|
1658
|
+
* Public read by publicId. Pass the caller's sessionId so the response
|
|
1659
|
+
* can set `isLead` correctly for UI gating.
|
|
1660
|
+
*/
|
|
1661
|
+
get(publicId: string, sessionId?: string): Promise<FetchTeamOrderResponse>;
|
|
1662
|
+
/**
|
|
1663
|
+
* Participant joins a team order. Idempotent: safe to call on every page
|
|
1664
|
+
* mount of the shared URL.
|
|
1665
|
+
*/
|
|
1666
|
+
join(publicId: string, request: JoinTeamOrderRequest): Promise<JoinTeamOrderResponse>;
|
|
1667
|
+
/**
|
|
1668
|
+
* Lead submits the team order. Drops basket-only participants, captures
|
|
1669
|
+
* every authorised Stripe PaymentIntent atomically, flips child orders to
|
|
1670
|
+
* `pending`. The "Submit anyways" UX is a client-side confirmation dialog
|
|
1671
|
+
* that calls the same endpoint — no server variant exists.
|
|
1672
|
+
*/
|
|
1673
|
+
submit(publicId: string, request: {
|
|
1674
|
+
sessionId: string;
|
|
1675
|
+
}): Promise<SubmitTeamOrderResponse>;
|
|
1676
|
+
/**
|
|
1677
|
+
* Lead cancels pre-placement. Voids every authorised Stripe
|
|
1678
|
+
* PaymentIntent (no refunds needed — nothing was captured).
|
|
1679
|
+
*/
|
|
1680
|
+
cancel(publicId: string, request: {
|
|
1681
|
+
sessionId: string;
|
|
1682
|
+
reason?: string;
|
|
1683
|
+
}): Promise<CancelTeamOrderResponse>;
|
|
1684
|
+
/**
|
|
1685
|
+
* Lead pushes the deadline. A `locked` team flips back to `collecting`
|
|
1686
|
+
* when the new deadline is in the future.
|
|
1687
|
+
*/
|
|
1688
|
+
extendDeadline(publicId: string, request: {
|
|
1689
|
+
sessionId: string;
|
|
1690
|
+
newDeadlineAt: string;
|
|
1691
|
+
}): Promise<ExtendDeadlineResponse>;
|
|
1692
|
+
/**
|
|
1693
|
+
* Lead commits (or changes) the shared pickup/delivery time. Required
|
|
1694
|
+
* before `submit` — which backfills each child order's `fulfillmentAt`
|
|
1695
|
+
* from this value at capture time.
|
|
1696
|
+
*/
|
|
1697
|
+
setFulfillmentAt(publicId: string, request: {
|
|
1698
|
+
sessionId: string;
|
|
1699
|
+
fulfillmentAt: string;
|
|
1700
|
+
}): Promise<{
|
|
1701
|
+
teamOrderId: string;
|
|
1702
|
+
status: TeamOrderStatus;
|
|
1703
|
+
fulfillmentAt: string;
|
|
1704
|
+
/**
|
|
1705
|
+
* Returned so callers can re-sync the deadline wheel — the server
|
|
1706
|
+
* clamps `deadlineAt` down to the new `fulfillmentAt` whenever the
|
|
1707
|
+
* old deadline would have sat past it.
|
|
1708
|
+
*/
|
|
1709
|
+
deadlineAt: string | null;
|
|
1710
|
+
}>;
|
|
1711
|
+
/**
|
|
1712
|
+
* Lead sets the free-form "where we'll eat" text on the team order.
|
|
1713
|
+
* Broadcast to participants via the standard realtime refetch path.
|
|
1714
|
+
*/
|
|
1715
|
+
setDiningLocation(publicId: string, request: {
|
|
1716
|
+
sessionId: string;
|
|
1717
|
+
diningLocation: string;
|
|
1718
|
+
}): Promise<{
|
|
1719
|
+
teamOrderId: string;
|
|
1720
|
+
status: TeamOrderStatus;
|
|
1721
|
+
diningLocation: string | null;
|
|
1722
|
+
}>;
|
|
1723
|
+
/**
|
|
1724
|
+
* Lead sets when the team will start eating. Client sends HH:MM; server
|
|
1725
|
+
* computes the delta against `fulfillmentAt` and stores it as
|
|
1726
|
+
* `dining_offset_minutes` so the intent survives any later pickup change.
|
|
1727
|
+
*/
|
|
1728
|
+
setDiningTime(publicId: string, request: {
|
|
1729
|
+
sessionId: string;
|
|
1730
|
+
diningTime: string;
|
|
1731
|
+
}): Promise<{
|
|
1732
|
+
teamOrderId: string;
|
|
1733
|
+
status: TeamOrderStatus;
|
|
1734
|
+
diningTime: string;
|
|
1735
|
+
diningOffsetMinutes: number;
|
|
1736
|
+
}>;
|
|
1737
|
+
/**
|
|
1738
|
+
* Any participant proposes an auto-extend when their local clock sees
|
|
1739
|
+
* that `fulfillmentAt` has passed while the team order is still
|
|
1740
|
+
* collecting. Idempotent on the server side: concurrent callers race
|
|
1741
|
+
* but only one write lands.
|
|
1742
|
+
*/
|
|
1743
|
+
autoExtendFulfillmentIfExpired(publicId: string, request: {
|
|
1744
|
+
sessionId: string;
|
|
1745
|
+
proposedFulfillmentAt: string;
|
|
1746
|
+
}): Promise<{
|
|
1747
|
+
extended: boolean;
|
|
1748
|
+
teamOrderId: string;
|
|
1749
|
+
status: TeamOrderStatus;
|
|
1750
|
+
fulfillmentAt: string;
|
|
1751
|
+
deadlineAt: string | null;
|
|
1752
|
+
previousFulfillmentAt: string;
|
|
1753
|
+
waitingCount: number;
|
|
1754
|
+
}>;
|
|
1755
|
+
/**
|
|
1756
|
+
* Lead flips pickup ↔ delivery. Pass `deliveryAddress` when switching
|
|
1757
|
+
* TO delivery if no address is already set on the team order.
|
|
1758
|
+
*/
|
|
1759
|
+
switchFulfillment(publicId: string, request: {
|
|
1760
|
+
sessionId: string;
|
|
1761
|
+
fulfillmentType: FulfillmentType;
|
|
1762
|
+
deliveryAddress?: TeamDeliveryAddress;
|
|
1763
|
+
}): Promise<SwitchFulfillmentResponse>;
|
|
1764
|
+
/**
|
|
1765
|
+
* Lead replaces the delivery address (inserts a new row in the shared
|
|
1766
|
+
* addresses table with type='PHYSICAL' and links it to the team order).
|
|
1767
|
+
*/
|
|
1768
|
+
updateDeliveryAddress(publicId: string, request: {
|
|
1769
|
+
sessionId: string;
|
|
1770
|
+
deliveryAddress: TeamDeliveryAddress;
|
|
1771
|
+
}): Promise<UpdateDeliveryAddressResponse>;
|
|
1772
|
+
}
|
|
1773
|
+
|
|
932
1774
|
type RealtimeEvent = 'INSERT' | 'UPDATE' | 'DELETE' | '*';
|
|
933
1775
|
type RealtimeRow = {
|
|
934
1776
|
[key: string]: any;
|
|
@@ -1087,6 +1929,7 @@ interface Order3000ClientConfig {
|
|
|
1087
1929
|
tokenUrl?: string;
|
|
1088
1930
|
}
|
|
1089
1931
|
declare class Order3000Client {
|
|
1932
|
+
areas: AreasResource;
|
|
1090
1933
|
baskets: BasketsResource;
|
|
1091
1934
|
events: EventsResource;
|
|
1092
1935
|
menus: MenusResource;
|
|
@@ -1094,11 +1937,12 @@ declare class Order3000Client {
|
|
|
1094
1937
|
paymentIntents: PaymentIntentsResource;
|
|
1095
1938
|
reservations: ReservationsResource;
|
|
1096
1939
|
subscriptions: SubscriptionsResource;
|
|
1940
|
+
teamOrders: TeamOrdersResource;
|
|
1097
1941
|
realtime: RealtimeManager;
|
|
1098
1942
|
private readonly baseUrl;
|
|
1099
1943
|
private readonly tokenManager;
|
|
1100
1944
|
constructor(config: Order3000ClientConfig);
|
|
1101
1945
|
}
|
|
1102
1946
|
|
|
1103
|
-
export { Order3000Client, getScheduleInfo };
|
|
1104
|
-
export type { AddToBasketRequest, AddToBasketResponse, Basket, BasketItem, BasketItemMenuItemRef, BasketItemMetadata, BasketStatus, ConfirmOrderRequest, ConfirmOrderResponse, CreatePaymentIntentRequest, CreatePaymentIntentResponse, CropArea, Currency, DayOfWeek, Event, EventByAccessor, EventMenu, EventPoster, EventRow, GetEventOptions, GetMenuOptions, ListEventsOptions, ListEventsResponse, Menu, MenuAsset, MenuBeverage, MenuBundle, MenuBundleDeposit, MenuDish, MenuItem, MenuItemRow, MenuItemType, MenuSubscription, MenuSubscriptionPoster, Order3000ClientConfig, OrderFulfillmentType, PlaceOrderRequest, Promotion, RealtimeConfig, RealtimeEvent, RealtimeSubscription, RemoveFromBasketResponse, Schedule, ScheduleInfo, ScheduleOverride, ScheduleOverrideRow, ScheduleRow, ScheduleTimeSlot, ScheduleWithTimeSlots, SubscribeRequest, SubscribeResponse, SubscriberStatus, SubscriptionCredit, SubscriptionCreditStatus, SubscriptionOptions, SubscriptionPeriod, TimeSlot, Unit };
|
|
1947
|
+
export { Order3000Client, fulfillmentTypeEnum, getScheduleInfo, participantStatusEnum, paymentMethodEnum, teamOrderStatusEnum };
|
|
1948
|
+
export type { AddCashDeltaRequest, AddCashDeltaResponse, AddToBasketRequest, AddToBasketResponse, Area, AreaAsset, AreaAvailabilityResponse, AreaAvailabilityWindow, AreaBookingMode, AreaBookingRequestResponse, AreaBookingRequestSource, AreaBookingRequestStatus, AreaBookingStatus, AreaFeature, Basket, BasketItem, BasketItemDeposit, BasketItemMenuItemRef, BasketItemMetadata, BasketStatus, BasketTotals, CancelTeamOrderResponse, ConfirmOrderRequest, ConfirmOrderResponse, CreateDeltaPaymentIntentRequest, CreateDeltaPaymentIntentResponse, CreatePaymentIntentRequest, CreatePaymentIntentResponse, CreateTeamOrderRequest, CreateTeamOrderResponse, CropArea, Currency, DayOfWeek, DeclaredReturn, Event, EventByAccessor, EventMenu, EventPoster, EventRow, ExtendDeadlineResponse as ExtendTeamOrderDeadlineResponse, FetchTeamOrderResponse, GetAreaAvailabilityOptions, GetAreaOptions, GetEventOptions, GetMenuOptions, JoinTeamOrderRequest, JoinTeamOrderResponse, LatestOrder, ListEventsOptions, ListEventsResponse, Menu, MenuAsset, MenuBeverage, MenuBundle, MenuBundleDeposit, MenuDish, MenuItem, MenuItemRow, MenuItemType, MenuSubscription, MenuSubscriptionPoster, Order3000ClientConfig, OrderFulfillmentType, OrderStatus, PaymentStatus, PlaceOrderRequest, Promotion, RealtimeConfig, RealtimeEvent, RealtimeSubscription, RemoveFromBasketResponse, Schedule, ScheduleInfo, ScheduleOverride, ScheduleOverrideRow, ScheduleRow, ScheduleTimeSlot, ScheduleWithTimeSlots, SubmitAreaBookingRequestPayload, SubmitTeamOrderResponse, SubscribeRequest, SubscribeResponse, SubscriberStatus, SubscriptionCredit, SubscriptionCreditStatus, SubscriptionOptions, SubscriptionPeriod, SwitchFulfillmentResponse as SwitchTeamOrderFulfillmentResponse, TeamDeliveryAddress, TeamOrderBasketItem, TeamOrderBasketItemMenuItemRef, FulfillmentType as TeamOrderFulfillmentType, TeamOrderParticipant, ParticipantStatus as TeamOrderParticipantStatus, PaymentMethod as TeamOrderPaymentMethod, TeamOrderStatus, ThresholdCheck as TeamOrderThresholdCheck, TimeSlot, Unit, UpdateDeliveryAddressResponse as UpdateTeamOrderDeliveryAddressResponse };
|