@dunbackmeadow/commerce-sdk 0.0.0-stage → 0.5.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/LICENSE +21 -0
- package/README.md +256 -3
- package/dist/index.d.ts +186 -0
- package/dist/index.js +378 -0
- package/dist/luma-Cza_vuOB.d.ts +581 -0
- package/dist/react/index.d.ts +67 -0
- package/dist/react/index.js +288 -0
- package/docs/API_REFERENCE.md +345 -0
- package/docs/LUMA_INTEGRATION_GUIDE.md +282 -0
- package/package.json +70 -4
|
@@ -0,0 +1,581 @@
|
|
|
1
|
+
/** Cuisines every catalog lists. */
|
|
2
|
+
type StandardCuisineId = "american" | "chinese" | "mexican" | "italian" | "japanese" | "indian" | "thai" | "mediterranean" | "korean" | "vietnamese";
|
|
3
|
+
/** A cuisine a restaurant named itself ("custom:peruvian"); take these from listCuisines(). */
|
|
4
|
+
type CustomCuisineId = `custom:${string}`;
|
|
5
|
+
type CuisineId = StandardCuisineId | CustomCuisineId;
|
|
6
|
+
/**
|
|
7
|
+
* How the catering is served; the host chooses.
|
|
8
|
+
* "buffet" trays and platters guests share. Only restaurants with
|
|
9
|
+
* catering dishes (trays) for mains.
|
|
10
|
+
* "meal_boxes" one individually packed meal per guest, from restaurants'
|
|
11
|
+
* regular dishes: more dishes and usually more restaurants.
|
|
12
|
+
*/
|
|
13
|
+
type CateringServiceStyle = "buffet" | "meal_boxes";
|
|
14
|
+
interface Cuisine {
|
|
15
|
+
id: CuisineId;
|
|
16
|
+
/** For a custom cuisine, the restaurant's own name for it ("Peruvian"). */
|
|
17
|
+
label: string;
|
|
18
|
+
/**
|
|
19
|
+
* Restaurants serving this cuisine: in the venue's metro area when you pass
|
|
20
|
+
* a venue to listCuisines(), else on the whole platform. With `guests`,
|
|
21
|
+
* only restaurants whose catering policies allow that many guests (most
|
|
22
|
+
* guests per order, and a minimum order that many guests are likely to
|
|
23
|
+
* reach). 0 = none.
|
|
24
|
+
*/
|
|
25
|
+
restaurants: number;
|
|
26
|
+
/**
|
|
27
|
+
* true for a cuisine a restaurant declared that isn't a standard one. These
|
|
28
|
+
* are listed only where at least one restaurant serves them, after the
|
|
29
|
+
* standard cuisines.
|
|
30
|
+
*/
|
|
31
|
+
custom?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Only when you passed `guests`: the least advance notice (hours before
|
|
34
|
+
* delivery) one of these restaurants needs for that many guests. 0: no notice
|
|
35
|
+
* needed beyond the usual order cutoff; null: no restaurant. Make sure the
|
|
36
|
+
* host's guest list closes, and catering is ordered, at least this early.
|
|
37
|
+
*/
|
|
38
|
+
noticeHours?: number | null;
|
|
39
|
+
}
|
|
40
|
+
/** Where an event is, for `listCuisines(venue)`: ZIP alone, or city + state, is enough. */
|
|
41
|
+
interface VenueLocation {
|
|
42
|
+
city?: string;
|
|
43
|
+
state?: string;
|
|
44
|
+
zip?: string;
|
|
45
|
+
}
|
|
46
|
+
/** GET /catalog/cuisines. */
|
|
47
|
+
interface CuisineCatalog {
|
|
48
|
+
data: Cuisine[];
|
|
49
|
+
/** "metro": counts restaurants in the venue's metro area only. "platform": all restaurants (no venue given). */
|
|
50
|
+
scope: "metro" | "platform";
|
|
51
|
+
/** The venue's metro area; null without a venue, or when Dunback doesn't serve that area (all counts 0). */
|
|
52
|
+
metro: {
|
|
53
|
+
id: string;
|
|
54
|
+
name: string;
|
|
55
|
+
} | null;
|
|
56
|
+
/** The expected guest count the counts are for; null when none was given. */
|
|
57
|
+
guests: number | null;
|
|
58
|
+
/** The service style the counts are for; null when none was given. */
|
|
59
|
+
serviceStyle: CateringServiceStyle | null;
|
|
60
|
+
}
|
|
61
|
+
/** Options for listCuisines() / cuisineCatalog(). */
|
|
62
|
+
interface CuisineQuery {
|
|
63
|
+
/** Count only restaurants that serve catering this way. */
|
|
64
|
+
serviceStyle?: CateringServiceStyle;
|
|
65
|
+
/**
|
|
66
|
+
* Expected guests (e.g. the event's capacity, or the host's estimate): count
|
|
67
|
+
* only restaurants able to cater that many. Whole number, 1 or more.
|
|
68
|
+
*/
|
|
69
|
+
guests?: number;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* A restaurant's own catering policies. Each is null when the restaurant has
|
|
73
|
+
* no such policy. Dunback only offers options that meet them.
|
|
74
|
+
*/
|
|
75
|
+
interface CateringPolicies {
|
|
76
|
+
/** Food subtotal (USD, before delivery, fees and tax) a catering order must reach. */
|
|
77
|
+
minimumOrder: number | null;
|
|
78
|
+
/** Most guests it caters for in one order. */
|
|
79
|
+
maxGuests: number | null;
|
|
80
|
+
/** No delivery fee when the food subtotal reaches this (USD). */
|
|
81
|
+
freeDeliveryOver: number | null;
|
|
82
|
+
/**
|
|
83
|
+
* Advance notice by party size: more than `overGuests` guests need at least
|
|
84
|
+
* `hours` before delivery. [] when none. `orderBy` already reflects it.
|
|
85
|
+
*/
|
|
86
|
+
noticeTiers: Array<{
|
|
87
|
+
overGuests: number;
|
|
88
|
+
hours: number;
|
|
89
|
+
}>;
|
|
90
|
+
}
|
|
91
|
+
interface Address {
|
|
92
|
+
address1: string;
|
|
93
|
+
address2?: string;
|
|
94
|
+
city: string;
|
|
95
|
+
state?: string;
|
|
96
|
+
zip: string;
|
|
97
|
+
/** ISO 3166-1 alpha-2, default "US". */
|
|
98
|
+
country?: string;
|
|
99
|
+
}
|
|
100
|
+
interface Attendee {
|
|
101
|
+
/** Your id for the guest (e.g. Luma guest id). */
|
|
102
|
+
externalId?: string;
|
|
103
|
+
name: string;
|
|
104
|
+
email?: string;
|
|
105
|
+
phone?: string;
|
|
106
|
+
/** Free text, as the guest wrote it: "peanuts, shellfish", "celiac", "none". */
|
|
107
|
+
allergies?: string;
|
|
108
|
+
/** Free text: "vegetarian", "halal", ... */
|
|
109
|
+
dietaryPreferences?: string;
|
|
110
|
+
/**
|
|
111
|
+
* The guest agreed to share their allergy/diet notes with Dunback Meadow and
|
|
112
|
+
* the restaurant. Required (true) whenever `allergies` or
|
|
113
|
+
* `dietaryPreferences` says more than "none"; otherwise the request fails
|
|
114
|
+
* with `allergy_consent_required`.
|
|
115
|
+
*/
|
|
116
|
+
allergyConsent?: boolean;
|
|
117
|
+
}
|
|
118
|
+
interface CateringRequestInput {
|
|
119
|
+
/** Your stable reference, e.g. `luma:evt-AbC123`. Used to look requests up later. */
|
|
120
|
+
partnerReference: string;
|
|
121
|
+
event: {
|
|
122
|
+
name: string;
|
|
123
|
+
/** ISO 8601 with offset, e.g. "2026-11-14T02:00:00Z". */
|
|
124
|
+
startsAt: string;
|
|
125
|
+
/** IANA time zone of the venue, e.g. "America/Los_Angeles". */
|
|
126
|
+
timeZone: string;
|
|
127
|
+
url?: string;
|
|
128
|
+
};
|
|
129
|
+
/** Venue-local "YYYY-MM-DDTHH:mm". Default: 30 minutes before the event starts. */
|
|
130
|
+
deliveryDeadlineLocal?: string;
|
|
131
|
+
cuisine: CuisineId;
|
|
132
|
+
/** Buffet (trays to share) or individual meal boxes. Default "meal_boxes". */
|
|
133
|
+
serviceStyle?: CateringServiceStyle;
|
|
134
|
+
/** Non-alcoholic drinks, one per guest. Default true. */
|
|
135
|
+
includeDrinks?: boolean;
|
|
136
|
+
/** Options above this card price per guest are flagged `withinBudget: false`. */
|
|
137
|
+
budgetPerGuest?: number;
|
|
138
|
+
deliveryAddress: Address;
|
|
139
|
+
/** Who receives the delivery at the venue. */
|
|
140
|
+
onsiteContact: {
|
|
141
|
+
name: string;
|
|
142
|
+
phone: string;
|
|
143
|
+
email?: string;
|
|
144
|
+
};
|
|
145
|
+
deliveryNotes?: string;
|
|
146
|
+
host: {
|
|
147
|
+
name: string;
|
|
148
|
+
email: string;
|
|
149
|
+
phone?: string;
|
|
150
|
+
};
|
|
151
|
+
attendees: Attendee[];
|
|
152
|
+
}
|
|
153
|
+
interface PriceLine {
|
|
154
|
+
code: "food" | "delivery" | "restaurant_fee" | "tax" | "platform_fee" | "service_fee";
|
|
155
|
+
/** "Free delivery" (amount 0) when the restaurant waived the delivery fee. */
|
|
156
|
+
label: string;
|
|
157
|
+
amount: number;
|
|
158
|
+
/** Why, for a waived delivery fee ("Free delivery on catering orders of $300.00 or more."). */
|
|
159
|
+
note?: string;
|
|
160
|
+
}
|
|
161
|
+
interface Price {
|
|
162
|
+
currency: "USD";
|
|
163
|
+
lines: PriceLine[];
|
|
164
|
+
restaurantAmount: number;
|
|
165
|
+
dunbackCommission: number;
|
|
166
|
+
dunbackServiceFee: number;
|
|
167
|
+
totals: {
|
|
168
|
+
/** What a USDC payment must be. */
|
|
169
|
+
usdc: number;
|
|
170
|
+
/** What a card payment is (USDC total + card processing). */
|
|
171
|
+
card: number;
|
|
172
|
+
cardProcessingFee: number;
|
|
173
|
+
};
|
|
174
|
+
perGuest: {
|
|
175
|
+
usdc: number;
|
|
176
|
+
card: number;
|
|
177
|
+
};
|
|
178
|
+
commissionRate: number;
|
|
179
|
+
}
|
|
180
|
+
interface CateringItem {
|
|
181
|
+
name: string;
|
|
182
|
+
description: string;
|
|
183
|
+
imageUrl: string | null;
|
|
184
|
+
/** "main" (one serving per guest), "drink" (one per guest) or "extra" (shared). */
|
|
185
|
+
role: "main" | "drink" | "extra";
|
|
186
|
+
/** Units ordered: portions, or trays for a catering dish (see `serves`). */
|
|
187
|
+
quantity: number;
|
|
188
|
+
/** Price of one unit (a whole tray for a catering dish). */
|
|
189
|
+
unitPrice: number;
|
|
190
|
+
/**
|
|
191
|
+
* A restaurant's catering dish (tray, platter): people one unit serves, e.g.
|
|
192
|
+
* 2 trays serving 8 each feed 16 guests. Absent for single portions.
|
|
193
|
+
* Dunback uses a restaurant's catering dishes first.
|
|
194
|
+
*/
|
|
195
|
+
serves?: number;
|
|
196
|
+
allergens: string[];
|
|
197
|
+
dietaryTags: string[];
|
|
198
|
+
/** true for a shared dish added so the order reaches the restaurant's minimum. */
|
|
199
|
+
addedForMinimum?: boolean;
|
|
200
|
+
}
|
|
201
|
+
interface AllergyCoverage {
|
|
202
|
+
/** "no peanut, shellfish", "vegetarian", "no restrictions", ... */
|
|
203
|
+
constraint: string;
|
|
204
|
+
guests: number;
|
|
205
|
+
dishes: string[];
|
|
206
|
+
}
|
|
207
|
+
interface UnfedGuests {
|
|
208
|
+
constraint: string;
|
|
209
|
+
guests: string[];
|
|
210
|
+
what?: "drink";
|
|
211
|
+
}
|
|
212
|
+
interface CateringOption {
|
|
213
|
+
id: string;
|
|
214
|
+
title: string;
|
|
215
|
+
strategy: "favorites" | "value" | "variety";
|
|
216
|
+
serviceStyle: CateringServiceStyle;
|
|
217
|
+
restaurant: {
|
|
218
|
+
name: string;
|
|
219
|
+
distanceMiles: number | null;
|
|
220
|
+
imageUrl: string | null;
|
|
221
|
+
policies: CateringPolicies;
|
|
222
|
+
};
|
|
223
|
+
items: CateringItem[];
|
|
224
|
+
/**
|
|
225
|
+
* Food (USD) to add for the restaurant's free delivery; null when delivery
|
|
226
|
+
* is already free or the restaurant has no such policy.
|
|
227
|
+
*/
|
|
228
|
+
freeDeliveryShortfall: number | null;
|
|
229
|
+
allergyCoverage: AllergyCoverage[];
|
|
230
|
+
/** Guests no dish on this menu is known to be safe for. Show this to the host. */
|
|
231
|
+
unfedGuests: UnfedGuests[];
|
|
232
|
+
price: Price;
|
|
233
|
+
withinBudget?: boolean;
|
|
234
|
+
/** Pay before this instant (ISO), or the restaurant can't make the event time. */
|
|
235
|
+
orderBy: string | null;
|
|
236
|
+
}
|
|
237
|
+
type CateringRequestStatus = "COMPOSING" | "OPTIONS_READY" | "NO_OPTIONS" | "SELECTED" | "FAILED";
|
|
238
|
+
interface CateringRequest {
|
|
239
|
+
id: string;
|
|
240
|
+
object: "catering_request";
|
|
241
|
+
status: CateringRequestStatus;
|
|
242
|
+
partnerReference: string;
|
|
243
|
+
event: CateringRequestInput["event"] & {
|
|
244
|
+
startsAtLocal: string;
|
|
245
|
+
};
|
|
246
|
+
cuisine: {
|
|
247
|
+
id: CuisineId;
|
|
248
|
+
label: string;
|
|
249
|
+
};
|
|
250
|
+
serviceStyle: CateringServiceStyle;
|
|
251
|
+
guestCount: number;
|
|
252
|
+
deliveryDeadlineLocal: string;
|
|
253
|
+
timeZone: string;
|
|
254
|
+
daypart: string;
|
|
255
|
+
allergySummary: Array<{
|
|
256
|
+
constraint: string;
|
|
257
|
+
guests: string[];
|
|
258
|
+
}>;
|
|
259
|
+
options: CateringOption[];
|
|
260
|
+
/** Why restaurants were left out, when status is NO_OPTIONS. */
|
|
261
|
+
unavailableReasons?: UnavailableReason[];
|
|
262
|
+
orderId: string | null;
|
|
263
|
+
error: {
|
|
264
|
+
code: string;
|
|
265
|
+
message: string;
|
|
266
|
+
} | null;
|
|
267
|
+
createdAt: string;
|
|
268
|
+
updatedAt: string;
|
|
269
|
+
}
|
|
270
|
+
/** Why a restaurant can't cater an event. Unknown codes may be added: treat them as "other". */
|
|
271
|
+
type UnavailableReasonCode = "party_too_large" | "below_minimum_order" | "notice_too_short" | "no_buffet_dishes" | "style_not_offered" | "outside_delivery_area" | "not_serving_then" | "different_cuisine" | "restaurant_declined";
|
|
272
|
+
interface UnavailableReason {
|
|
273
|
+
/** Restaurant name. */
|
|
274
|
+
name: string;
|
|
275
|
+
code?: UnavailableReasonCode | (string & {});
|
|
276
|
+
/** Human-readable, e.g. "can't cater 120 guests (caters for at most 60 guests)". */
|
|
277
|
+
reason: string;
|
|
278
|
+
}
|
|
279
|
+
interface SelectOptionInput {
|
|
280
|
+
optionId: string;
|
|
281
|
+
payer?: {
|
|
282
|
+
name?: string;
|
|
283
|
+
email?: string;
|
|
284
|
+
};
|
|
285
|
+
/** Default both. */
|
|
286
|
+
paymentMethods?: Array<"stripe" | "usdc">;
|
|
287
|
+
/** Where Stripe Checkout returns to (https, on your registered domains). Default: Dunback's payment page. */
|
|
288
|
+
successUrl?: string;
|
|
289
|
+
cancelUrl?: string;
|
|
290
|
+
}
|
|
291
|
+
type OrderStatus = "AWAITING_PAYMENT" | "PAID" | "FULFILLING" | "CONFIRMED" | "EXPIRED" | "CANCELLED" | "REFUNDED" | "REFUND_PENDING" | "NEEDS_ATTENTION";
|
|
292
|
+
interface UsdcPaymentInstructions {
|
|
293
|
+
network: "polygon";
|
|
294
|
+
chainId: 137;
|
|
295
|
+
/** USDC contract on Polygon. */
|
|
296
|
+
asset: string;
|
|
297
|
+
receiver: string;
|
|
298
|
+
/** Exact amount to send, e.g. "412.380317" (the last digits identify the order). */
|
|
299
|
+
amount: string;
|
|
300
|
+
amountAtomic: string;
|
|
301
|
+
/** EIP-681 link most wallets can open. */
|
|
302
|
+
paymentUri: string;
|
|
303
|
+
note: string;
|
|
304
|
+
/** For agents: POST here to pay with x402 (see payOrderWithX402). */
|
|
305
|
+
x402Url?: string;
|
|
306
|
+
}
|
|
307
|
+
/** Where an order is delivered. `deliveryNotes` is your note only, without the catering and allergy text Dunback adds for the restaurant. */
|
|
308
|
+
interface OrderDelivery {
|
|
309
|
+
address: Required<Address>;
|
|
310
|
+
onsiteContact: {
|
|
311
|
+
name: string;
|
|
312
|
+
phone: string;
|
|
313
|
+
};
|
|
314
|
+
deliveryNotes: string;
|
|
315
|
+
/** True while the order is AWAITING_PAYMENT: the details can still be corrected (orders.updateDelivery). */
|
|
316
|
+
editable: boolean;
|
|
317
|
+
}
|
|
318
|
+
/** POST /orders/:id/delivery: correct the delivery details before payment. */
|
|
319
|
+
interface UpdateDeliveryInput {
|
|
320
|
+
deliveryAddress: Address;
|
|
321
|
+
/** Leave out to keep the current on-site contact. */
|
|
322
|
+
onsiteContact?: {
|
|
323
|
+
name: string;
|
|
324
|
+
phone: string;
|
|
325
|
+
};
|
|
326
|
+
/** Replaces the current note. Default "" (no note). */
|
|
327
|
+
deliveryNotes?: string;
|
|
328
|
+
}
|
|
329
|
+
interface Order {
|
|
330
|
+
id: string;
|
|
331
|
+
object: "order";
|
|
332
|
+
status: OrderStatus;
|
|
333
|
+
partnerReference: string;
|
|
334
|
+
cateringRequestId: string;
|
|
335
|
+
title: string;
|
|
336
|
+
summary: string;
|
|
337
|
+
restaurant: {
|
|
338
|
+
name: string;
|
|
339
|
+
};
|
|
340
|
+
deliveryDeadlineLocal: string;
|
|
341
|
+
timeZone: string;
|
|
342
|
+
guestCount: number;
|
|
343
|
+
delivery: OrderDelivery;
|
|
344
|
+
items: CateringItem[];
|
|
345
|
+
allergyCoverage: AllergyCoverage[];
|
|
346
|
+
unfedGuests: UnfedGuests[];
|
|
347
|
+
price: Price;
|
|
348
|
+
payment: {
|
|
349
|
+
expiresAt?: string;
|
|
350
|
+
/** Dunback-hosted page offering every payment method. Safe to show to the payer. */
|
|
351
|
+
hostedPaymentUrl?: string;
|
|
352
|
+
stripe?: {
|
|
353
|
+
checkoutUrl: string;
|
|
354
|
+
amount: number;
|
|
355
|
+
currency: "usd";
|
|
356
|
+
} | null;
|
|
357
|
+
usdc?: UsdcPaymentInstructions | null;
|
|
358
|
+
received: {
|
|
359
|
+
method: "stripe" | "usdc" | "x402";
|
|
360
|
+
amount: number;
|
|
361
|
+
currency: string;
|
|
362
|
+
reference: string;
|
|
363
|
+
payer?: string;
|
|
364
|
+
at: string;
|
|
365
|
+
} | null;
|
|
366
|
+
lastError: {
|
|
367
|
+
method: string;
|
|
368
|
+
code: string;
|
|
369
|
+
message: string;
|
|
370
|
+
at: string;
|
|
371
|
+
} | null;
|
|
372
|
+
};
|
|
373
|
+
fulfillment: {
|
|
374
|
+
restaurantOrderIds: string[];
|
|
375
|
+
providerPayment: {
|
|
376
|
+
amount: number;
|
|
377
|
+
payTo: string;
|
|
378
|
+
txHash: string | null;
|
|
379
|
+
verifiedOnChain: boolean;
|
|
380
|
+
network: "polygon";
|
|
381
|
+
};
|
|
382
|
+
confirmedAt: string;
|
|
383
|
+
} | null;
|
|
384
|
+
refund: {
|
|
385
|
+
status: "SUCCEEDED" | "PENDING";
|
|
386
|
+
method: "stripe" | "usdc";
|
|
387
|
+
amount: number;
|
|
388
|
+
note?: string;
|
|
389
|
+
} | null;
|
|
390
|
+
error: {
|
|
391
|
+
code: string;
|
|
392
|
+
message: string;
|
|
393
|
+
} | null;
|
|
394
|
+
createdAt: string;
|
|
395
|
+
updatedAt: string;
|
|
396
|
+
}
|
|
397
|
+
type WebhookEventType = "catering.options_ready" | "catering.no_options" | "catering.failed" | "order.created" | "order.confirmed" | "order.payment_failed" | "order.expired" | "order.failed" | "order.needs_attention" | "order.cancelled" | "order.delivery_updated" | "ping";
|
|
398
|
+
/** `data` of a `ping` event, sent by "Send test event" in the Developer Dashboard. */
|
|
399
|
+
interface PingData {
|
|
400
|
+
object: "ping";
|
|
401
|
+
appId: string;
|
|
402
|
+
message: string;
|
|
403
|
+
}
|
|
404
|
+
interface WebhookEvent<T = CateringRequest | Order | PingData> {
|
|
405
|
+
id: string;
|
|
406
|
+
type: WebhookEventType;
|
|
407
|
+
/** Unix seconds. */
|
|
408
|
+
created: number;
|
|
409
|
+
/** Present on `ping`: true for a production endpoint. */
|
|
410
|
+
livemode?: boolean;
|
|
411
|
+
data: T;
|
|
412
|
+
}
|
|
413
|
+
/** GET /me: the app and environment an API key belongs to. */
|
|
414
|
+
interface AppInfo {
|
|
415
|
+
object: "app";
|
|
416
|
+
id: string;
|
|
417
|
+
name: string;
|
|
418
|
+
mode: "live" | "test";
|
|
419
|
+
webhookUrl: string | null;
|
|
420
|
+
allowedReturnHosts: string[];
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* Helpers for the Luma integration:
|
|
425
|
+
*
|
|
426
|
+
* 1. Event creation: the host turns on "Food & drinks by Dunback Meadow" and
|
|
427
|
+
* picks a cuisine -> store a DunbackEventSettings with the event.
|
|
428
|
+
* 2. Registration: add DUNBACK_REGISTRATION_QUESTION to the event's form, so
|
|
429
|
+
* guests can note allergies.
|
|
430
|
+
* 3. After the guest list is final: "Order Food via Dunback Meadow" ->
|
|
431
|
+
* buildCateringRequest(event, guests, settings) -> dunback.catering.create().
|
|
432
|
+
*
|
|
433
|
+
* The Luma shapes below follow Luma's public API (event + get-guests). The
|
|
434
|
+
* mapper also accepts flat objects, so it works with internal models too:
|
|
435
|
+
* pass whatever has the same field names, or map to `Attendee` yourself.
|
|
436
|
+
*/
|
|
437
|
+
|
|
438
|
+
/** Stored with a Luma event when the host enables Dunback catering. */
|
|
439
|
+
interface DunbackEventSettings {
|
|
440
|
+
enabled: boolean;
|
|
441
|
+
cuisine: CuisineId;
|
|
442
|
+
/**
|
|
443
|
+
* Buffet (trays to share) or individual meal boxes. Pass it to
|
|
444
|
+
* listCuisines(venue, { serviceStyle }) too: fewer restaurants offer buffets.
|
|
445
|
+
* Default "meal_boxes".
|
|
446
|
+
*/
|
|
447
|
+
serviceStyle?: CateringServiceStyle;
|
|
448
|
+
includeDrinks?: boolean;
|
|
449
|
+
budgetPerGuest?: number;
|
|
450
|
+
/**
|
|
451
|
+
* The host's estimate of how many guests will attend (or the event's
|
|
452
|
+
* capacity). Pass it to listCuisines(venue, { guests }) so only cuisines
|
|
453
|
+
* with restaurants able to cater that many are offered. The order itself
|
|
454
|
+
* uses the real guest list.
|
|
455
|
+
*/
|
|
456
|
+
expectedGuests?: number;
|
|
457
|
+
/** When the host's guest list is final; "Order Food" is offered from then on. ISO 8601. */
|
|
458
|
+
guestListDeadline?: string;
|
|
459
|
+
/** Override the default (30 min before start). Venue-local "YYYY-MM-DDTHH:mm". */
|
|
460
|
+
deliveryDeadlineLocal?: string;
|
|
461
|
+
deliveryNotes?: string;
|
|
462
|
+
onsiteContact?: {
|
|
463
|
+
name: string;
|
|
464
|
+
phone: string;
|
|
465
|
+
email?: string;
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* The registration question to add to events with Dunback catering enabled.
|
|
470
|
+
* Its description is the guest's consent: answering it agrees to share the
|
|
471
|
+
* answer with Dunback and the restaurant, so keep that wording.
|
|
472
|
+
*/
|
|
473
|
+
declare const DUNBACK_REGISTRATION_QUESTION: {
|
|
474
|
+
id: string;
|
|
475
|
+
label: string;
|
|
476
|
+
description: string;
|
|
477
|
+
type: "long_text";
|
|
478
|
+
required: boolean;
|
|
479
|
+
placeholder: string;
|
|
480
|
+
};
|
|
481
|
+
interface LumaEventLike {
|
|
482
|
+
api_id?: string;
|
|
483
|
+
id?: string;
|
|
484
|
+
name: string;
|
|
485
|
+
start_at: string;
|
|
486
|
+
timezone: string;
|
|
487
|
+
url?: string;
|
|
488
|
+
geo_address_json?: {
|
|
489
|
+
address?: string;
|
|
490
|
+
full_address?: string;
|
|
491
|
+
city?: string;
|
|
492
|
+
region?: string;
|
|
493
|
+
postal_code?: string;
|
|
494
|
+
country?: string;
|
|
495
|
+
country_code?: string;
|
|
496
|
+
} | null;
|
|
497
|
+
}
|
|
498
|
+
interface LumaGuestLike {
|
|
499
|
+
api_id?: string;
|
|
500
|
+
id?: string;
|
|
501
|
+
user_name?: string | null;
|
|
502
|
+
name?: string | null;
|
|
503
|
+
user_email?: string | null;
|
|
504
|
+
email?: string | null;
|
|
505
|
+
phone_number?: string | null;
|
|
506
|
+
approval_status?: string | null;
|
|
507
|
+
checked_in_at?: string | null;
|
|
508
|
+
registration_answers?: Array<{
|
|
509
|
+
question_id?: string;
|
|
510
|
+
label?: string;
|
|
511
|
+
answer?: unknown;
|
|
512
|
+
value?: unknown;
|
|
513
|
+
}> | null;
|
|
514
|
+
}
|
|
515
|
+
/** Guest statuses that count as attending. */
|
|
516
|
+
declare const ATTENDING_STATUSES: Set<string>;
|
|
517
|
+
interface AttendeeOptions {
|
|
518
|
+
questionId?: string;
|
|
519
|
+
includeStatuses?: Set<string>;
|
|
520
|
+
/**
|
|
521
|
+
* Treat answers to the host's own allergy/diet questions (matched by label)
|
|
522
|
+
* as consent too. Only set this when that question also tells guests their
|
|
523
|
+
* answer is shared with Dunback Meadow and the restaurant. Default false.
|
|
524
|
+
*/
|
|
525
|
+
otherQuestionsHaveConsent?: boolean;
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* Luma guests (raw get-guests entries or flat) -> Dunback attendees, attending
|
|
529
|
+
* guests only. Allergy answers are sent only with the guest's consent: an
|
|
530
|
+
* answer to DUNBACK_REGISTRATION_QUESTION. See guestsWithUnsharedAllergies().
|
|
531
|
+
*/
|
|
532
|
+
declare function toDunbackAttendees(guests: Array<LumaGuestLike | {
|
|
533
|
+
guest: LumaGuestLike;
|
|
534
|
+
}>, options?: AttendeeOptions): Attendee[];
|
|
535
|
+
/**
|
|
536
|
+
* Attending guests who noted allergies in a question without Dunback's consent
|
|
537
|
+
* wording, so toDunbackAttendees() left their notes out. Show these names to
|
|
538
|
+
* the host before ordering: their meals aren't checked against those allergies.
|
|
539
|
+
*/
|
|
540
|
+
declare function guestsWithUnsharedAllergies(guests: Array<LumaGuestLike | {
|
|
541
|
+
guest: LumaGuestLike;
|
|
542
|
+
}>, options?: AttendeeOptions): string[];
|
|
543
|
+
/** Luma's geo_address_json -> Dunback address. Throws if the venue has no street address. */
|
|
544
|
+
declare function toDunbackAddress(geo: LumaEventLike["geo_address_json"]): Address;
|
|
545
|
+
/**
|
|
546
|
+
* The venue for listCuisines(venue), or null while the host hasn't entered a
|
|
547
|
+
* street address, city and ZIP yet (or for an online event). With null, show
|
|
548
|
+
* <DunbackCateringSettings venueReady={false}>, which asks for the address.
|
|
549
|
+
*/
|
|
550
|
+
declare function toVenueLocation(geo: LumaEventLike["geo_address_json"]): VenueLocation | null;
|
|
551
|
+
interface BuildCateringRequestArgs {
|
|
552
|
+
event: LumaEventLike;
|
|
553
|
+
guests: Array<LumaGuestLike | {
|
|
554
|
+
guest: LumaGuestLike;
|
|
555
|
+
}>;
|
|
556
|
+
settings: DunbackEventSettings;
|
|
557
|
+
host: {
|
|
558
|
+
name: string;
|
|
559
|
+
email: string;
|
|
560
|
+
phone?: string;
|
|
561
|
+
};
|
|
562
|
+
/** Defaults to settings.onsiteContact, else the host (needs a phone). */
|
|
563
|
+
onsiteContact?: {
|
|
564
|
+
name: string;
|
|
565
|
+
phone: string;
|
|
566
|
+
email?: string;
|
|
567
|
+
};
|
|
568
|
+
/** Overrides toDunbackAddress(event.geo_address_json). */
|
|
569
|
+
deliveryAddress?: Address;
|
|
570
|
+
/** Hosts and co-hosts eat too: add them as attendees. */
|
|
571
|
+
extraAttendees?: Attendee[];
|
|
572
|
+
}
|
|
573
|
+
/** Everything Dunback needs for a Luma event's catering request. */
|
|
574
|
+
declare function buildCateringRequest(args: BuildCateringRequestArgs): CateringRequestInput;
|
|
575
|
+
/** Whether to show "Order Food via Dunback Meadow" on the host's event page. */
|
|
576
|
+
declare function canOrderFood(settings: DunbackEventSettings | null | undefined, event: Pick<LumaEventLike, "start_at">, now?: Date): {
|
|
577
|
+
ok: boolean;
|
|
578
|
+
reason?: string;
|
|
579
|
+
};
|
|
580
|
+
|
|
581
|
+
export { type AppInfo as A, type BuildCateringRequestArgs as B, type CuisineQuery as C, DUNBACK_REGISTRATION_QUESTION as D, type WebhookEventType as E, buildCateringRequest as F, canOrderFood as G, guestsWithUnsharedAllergies as H, toDunbackAddress as I, toDunbackAttendees as J, toVenueLocation as K, type LumaEventLike as L, type Order as O, type PingData as P, type SelectOptionInput as S, type UpdateDeliveryInput as U, type VenueLocation as V, type WebhookEvent as W, type Cuisine as a, type CuisineCatalog as b, type CateringRequestInput as c, type CateringRequest as d, ATTENDING_STATUSES as e, type Address as f, type AllergyCoverage as g, type Attendee as h, type CateringItem as i, type CateringOption as j, type CateringPolicies as k, type CateringRequestStatus as l, type CateringServiceStyle as m, type CuisineId as n, type CustomCuisineId as o, type DunbackEventSettings as p, type LumaGuestLike as q, type OrderDelivery as r, type OrderStatus as s, type Price as t, type PriceLine as u, type StandardCuisineId as v, type UnavailableReason as w, type UnavailableReasonCode as x, type UnfedGuests as y, type UsdcPaymentInstructions as z };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { j as CateringOption, a as Cuisine, p as DunbackEventSettings, O as Order, t as Price } from '../luma-Cza_vuOB.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Optional, unstyled-by-default React building blocks for the three Luma
|
|
6
|
+
* touchpoints. They only render data: every call to Dunback goes through YOUR
|
|
7
|
+
* backend (the API key must never reach a browser).
|
|
8
|
+
*
|
|
9
|
+
* <DunbackCateringSettings> event creation: enable + choose a cuisine
|
|
10
|
+
* <CateringOptionsPicker> host picks one of the 3 options
|
|
11
|
+
* <DunbackOrderStatus> payment links and order progress
|
|
12
|
+
*
|
|
13
|
+
* Style with `className` / `classNames`, or wrap them in your own components.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
interface DunbackCateringSettingsProps {
|
|
17
|
+
/**
|
|
18
|
+
* From your backend: dunback.listCuisines(venue) with the event's venue
|
|
19
|
+
* (toVenueLocation), so counts cover restaurants in its metro area.
|
|
20
|
+
* Cuisines with 0 restaurants are shown disabled.
|
|
21
|
+
*/
|
|
22
|
+
cuisines: Cuisine[];
|
|
23
|
+
value: DunbackEventSettings | null;
|
|
24
|
+
onChange: (next: DunbackEventSettings | null) => void;
|
|
25
|
+
/**
|
|
26
|
+
* false while the host hasn't entered the venue address: availability isn't
|
|
27
|
+
* shown, every cuisine can be picked, and the host is asked for the address.
|
|
28
|
+
* Leave undefined if you call listCuisines() without a venue (platform-wide counts).
|
|
29
|
+
*/
|
|
30
|
+
venueReady?: boolean;
|
|
31
|
+
/** cuisineCatalog(venue).metro?.name: the area the counts are for. */
|
|
32
|
+
metroName?: string | null;
|
|
33
|
+
/**
|
|
34
|
+
* Shows an "Expected guests" field (value.expectedGuests). Re-fetch
|
|
35
|
+
* listCuisines(venue, { guests: value.expectedGuests, serviceStyle: value.serviceStyle })
|
|
36
|
+
* when either changes, so the counts only include restaurants that cater
|
|
37
|
+
* that many, in that style. Default true.
|
|
38
|
+
*/
|
|
39
|
+
askExpectedGuests?: boolean;
|
|
40
|
+
className?: string;
|
|
41
|
+
}
|
|
42
|
+
declare function DunbackCateringSettings({ cuisines, value, onChange, venueReady, metroName, askExpectedGuests, className }: DunbackCateringSettingsProps): React.JSX.Element;
|
|
43
|
+
interface PriceBreakdownProps {
|
|
44
|
+
price: Price;
|
|
45
|
+
/**
|
|
46
|
+
* The payment method the totals are for. "card" (default): dollar amounts,
|
|
47
|
+
* with card processing as its own line. "usdc": only for a host who chose
|
|
48
|
+
* to pay in USDC; the total is then shown in USDC.
|
|
49
|
+
*/
|
|
50
|
+
paymentMethod?: "card" | "usdc";
|
|
51
|
+
/** @deprecated Use paymentMethod. `showCard={false}` is the same as paymentMethod="usdc". */
|
|
52
|
+
showCard?: boolean;
|
|
53
|
+
}
|
|
54
|
+
declare function PriceBreakdown({ price, paymentMethod, showCard }: PriceBreakdownProps): React.JSX.Element;
|
|
55
|
+
interface CateringOptionsPickerProps {
|
|
56
|
+
options: CateringOption[];
|
|
57
|
+
onSelect: (optionId: string) => void | Promise<void>;
|
|
58
|
+
busyOptionId?: string | null;
|
|
59
|
+
className?: string;
|
|
60
|
+
}
|
|
61
|
+
declare function CateringOptionsPicker({ options, onSelect, busyOptionId, className }: CateringOptionsPickerProps): React.JSX.Element;
|
|
62
|
+
declare function DunbackOrderStatus({ order, className }: {
|
|
63
|
+
order: Order;
|
|
64
|
+
className?: string;
|
|
65
|
+
}): React.JSX.Element;
|
|
66
|
+
|
|
67
|
+
export { CateringOptionsPicker, type CateringOptionsPickerProps, DunbackCateringSettings, type DunbackCateringSettingsProps, DunbackOrderStatus, PriceBreakdown, type PriceBreakdownProps };
|