@dunbackmeadow/commerce-sdk 0.7.0 → 0.9.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/README.md +256 -256
- package/dist/index.d.ts +34 -5
- package/dist/index.js +49 -4
- package/dist/{luma-D0rL0u8I.d.ts → luma-D2AucdDY.d.ts} +243 -8
- package/dist/react/index.d.ts +27 -4
- package/dist/react/index.js +108 -9
- package/docs/API_REFERENCE.md +72 -9
- package/docs/LUMA_INTEGRATION_GUIDE.md +45 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -107,6 +107,29 @@ var DunbackClient = class {
|
|
|
107
107
|
async listCuisines(venue, query = {}) {
|
|
108
108
|
return (await this.cuisineCatalog(venue, query)).data;
|
|
109
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Restaurants a host can name (`restaurantName` on a catering request)
|
|
112
|
+
* instead of choosing a cuisine. With a venue, only restaurants in its metro
|
|
113
|
+
* area; `q` filters by name (for a search box).
|
|
114
|
+
*/
|
|
115
|
+
async listRestaurants(venue, q = "") {
|
|
116
|
+
const p = new URLSearchParams();
|
|
117
|
+
for (const k of ["city", "state", "zip"]) {
|
|
118
|
+
const v = String(venue?.[k] ?? "").trim();
|
|
119
|
+
if (v) p.set(k, v);
|
|
120
|
+
}
|
|
121
|
+
if (q.trim()) p.set("q", q.trim());
|
|
122
|
+
const qs = p.toString();
|
|
123
|
+
return (await this.request("GET", `/catalog/restaurants${qs ? `?${qs}` : ""}`)).data;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Drink types a host can ask for (`drinkTypes` on a catering request), for
|
|
127
|
+
* drinks-only catering or the drinks with food. Any other short word works
|
|
128
|
+
* too and is matched against the restaurants' drink names.
|
|
129
|
+
*/
|
|
130
|
+
async listDrinkTypes() {
|
|
131
|
+
return (await this.request("GET", "/catalog/drink-types")).data;
|
|
132
|
+
}
|
|
110
133
|
/** listCuisines() plus which metro area the counts are for (`metro` is null when Dunback doesn't serve the venue's area). */
|
|
111
134
|
async cuisineCatalog(venue, query = {}) {
|
|
112
135
|
const q = new URLSearchParams();
|
|
@@ -167,8 +190,28 @@ var DunbackClient = class {
|
|
|
167
190
|
* (create a new catering request instead). Sends `order.delivery_updated`.
|
|
168
191
|
*/
|
|
169
192
|
updateDelivery: (orderId, input) => this.request("POST", `/orders/${encodeURIComponent(orderId)}/delivery`, input),
|
|
170
|
-
/**
|
|
171
|
-
|
|
193
|
+
/**
|
|
194
|
+
* Unpaid orders: cancels the payment links. Confirmed orders: cancels at
|
|
195
|
+
* the restaurant. Before the commitment deadline the restaurant's full
|
|
196
|
+
* refund is sent; after it (until delivery) pass
|
|
197
|
+
* `{ acceptPostCommitment: true }` once the host has seen
|
|
198
|
+
* `order.cancellation.notice`, and Dunback decides the refund with the
|
|
199
|
+
* restaurant (webhook `order.refund_decided`). Without it, that call fails
|
|
200
|
+
* with 409 `post_commitment_confirmation_required`.
|
|
201
|
+
*/
|
|
202
|
+
cancel: (orderId, reason, options = {}) => this.request("POST", `/orders/${encodeURIComponent(orderId)}/cancel`, {
|
|
203
|
+
reason,
|
|
204
|
+
...options.acceptPostCommitment ? { acceptPostCommitment: true } : {}
|
|
205
|
+
}),
|
|
206
|
+
/**
|
|
207
|
+
* Asks for a refund of a catering delivery made at or after the catering
|
|
208
|
+
* late-delivery threshold (webhook `order.delivered_late`). The host
|
|
209
|
+
* gives the reason and how the delay affected the event; Dunback decides
|
|
210
|
+
* the refund (0 up to the restaurant's part; Dunback's fees aren't
|
|
211
|
+
* refunded) and sends `order.refund_decided`. Errors: 409 `not_late`,
|
|
212
|
+
* `already_requested`, `request_window_closed`.
|
|
213
|
+
*/
|
|
214
|
+
requestRefund: (orderId, input) => this.request("POST", `/orders/${encodeURIComponent(orderId)}/refund-requests`, input),
|
|
172
215
|
/** Polls until the order leaves AWAITING_PAYMENT/PAID/FULFILLING. */
|
|
173
216
|
waitForSettlement: async (orderId, { timeoutMs = 15 * 6e4, intervalMs = 5e3 } = {}) => {
|
|
174
217
|
const until = Date.now() + timeoutMs;
|
|
@@ -273,6 +316,7 @@ function toVenueLocation(geo) {
|
|
|
273
316
|
function buildCateringRequest(args) {
|
|
274
317
|
const { event, guests, settings, host } = args;
|
|
275
318
|
if (!settings?.enabled) throw new Error("Dunback catering is not enabled for this event.");
|
|
319
|
+
if (!settings.drinksOnly && !settings.restaurantName && !settings.cuisine) throw new Error("Choose a restaurant or a cuisine for the catering.");
|
|
276
320
|
const onsite = args.onsiteContact || settings.onsiteContact || (host.phone ? { name: host.name, phone: host.phone, email: host.email } : null);
|
|
277
321
|
if (!onsite) throw new Error("An on-site contact with a phone number is required for delivery.");
|
|
278
322
|
const attendees = [...toDunbackAttendees(guests), ...args.extraAttendees || []];
|
|
@@ -281,9 +325,10 @@ function buildCateringRequest(args) {
|
|
|
281
325
|
partnerReference: `luma:${event.api_id || event.id}`,
|
|
282
326
|
event: { name: event.name, startsAt: event.start_at, timeZone: event.timezone, ...event.url ? { url: event.url } : {} },
|
|
283
327
|
...settings.deliveryDeadlineLocal ? { deliveryDeadlineLocal: settings.deliveryDeadlineLocal } : {},
|
|
284
|
-
cuisine: settings.cuisine,
|
|
328
|
+
...settings.restaurantName ? { restaurantName: settings.restaurantName } : settings.drinksOnly ? {} : { cuisine: settings.cuisine },
|
|
285
329
|
serviceStyle: settings.serviceStyle ?? "meal_boxes",
|
|
286
|
-
includeDrinks: settings.includeDrinks ?? true,
|
|
330
|
+
...settings.drinksOnly ? { drinksOnly: true } : { includeDrinks: settings.includeDrinks ?? true },
|
|
331
|
+
...settings.drinkTypes?.length ? { drinkTypes: settings.drinkTypes } : {},
|
|
287
332
|
...settings.budgetPerGuest ? { budgetPerGuest: settings.budgetPerGuest } : {},
|
|
288
333
|
deliveryAddress: args.deliveryAddress || toDunbackAddress(event.geo_address_json),
|
|
289
334
|
onsiteContact: onsite,
|
|
@@ -58,6 +58,18 @@ interface CuisineCatalog {
|
|
|
58
58
|
/** The service style the counts are for; null when none was given. */
|
|
59
59
|
serviceStyle: CateringServiceStyle | null;
|
|
60
60
|
}
|
|
61
|
+
/** GET /catalog/restaurants: restaurants a host can name instead of choosing a cuisine. */
|
|
62
|
+
interface RestaurantSummary {
|
|
63
|
+
name: string;
|
|
64
|
+
cuisine: {
|
|
65
|
+
id: CuisineId;
|
|
66
|
+
label: string;
|
|
67
|
+
} | null;
|
|
68
|
+
secondaryCuisine: {
|
|
69
|
+
id: CuisineId;
|
|
70
|
+
label: string;
|
|
71
|
+
} | null;
|
|
72
|
+
}
|
|
61
73
|
/** Options for listCuisines() / cuisineCatalog(). */
|
|
62
74
|
interface CuisineQuery {
|
|
63
75
|
/** Count only restaurants that serve catering this way. */
|
|
@@ -128,11 +140,43 @@ interface CateringRequestInput {
|
|
|
128
140
|
};
|
|
129
141
|
/** Venue-local "YYYY-MM-DDTHH:mm". Default: 30 minutes before the event starts. */
|
|
130
142
|
deliveryDeadlineLocal?: string;
|
|
131
|
-
|
|
143
|
+
/**
|
|
144
|
+
* A restaurant the host prefers (see listRestaurants()). All options then
|
|
145
|
+
* come from it, and no cuisine is chosen: send restaurantName OR cuisine,
|
|
146
|
+
* never both. If it can't cater the event, the request says why
|
|
147
|
+
* (`restaurant.available: false`, `restaurant.reason`) and the options are
|
|
148
|
+
* from other restaurants.
|
|
149
|
+
*/
|
|
150
|
+
restaurantName?: string;
|
|
151
|
+
/**
|
|
152
|
+
* Required when no restaurantName is given. Restaurants whose primary
|
|
153
|
+
* cuisine this is are matched first; restaurants listing it as their
|
|
154
|
+
* secondary cuisine only when none of those can cater.
|
|
155
|
+
*/
|
|
156
|
+
cuisine?: CuisineId;
|
|
157
|
+
/**
|
|
158
|
+
* A combination style: cuisine "chinese" + secondaryCuisine "american" asks
|
|
159
|
+
* for Chinese-American, matched only by restaurants that declared both, in that order.
|
|
160
|
+
*/
|
|
161
|
+
secondaryCuisine?: CuisineId;
|
|
132
162
|
/** Buffet (trays to share) or individual meal boxes. Default "meal_boxes". */
|
|
133
163
|
serviceStyle?: CateringServiceStyle;
|
|
134
|
-
/**
|
|
164
|
+
/** Food catering: also non-alcoholic drinks, one per guest. Default true. */
|
|
135
165
|
includeDrinks?: boolean;
|
|
166
|
+
/**
|
|
167
|
+
* Drinks only, no food, one drink per guest: from `restaurantName` (a cafe,
|
|
168
|
+
* a boba shop...) or any restaurant serving `drinkTypes`. Don't send a
|
|
169
|
+
* cuisine with it. `serviceStyle` "meal_boxes" = individual cups, "buffet" =
|
|
170
|
+
* shared containers (carafes, gallons). Default false.
|
|
171
|
+
*/
|
|
172
|
+
drinksOnly?: boolean;
|
|
173
|
+
/**
|
|
174
|
+
* Which drinks: ids from `listDrinkTypes()` ("coffee", "boba", "milk_tea"...)
|
|
175
|
+
* or a short word for any other ("horchata"). Up to 8. With `drinksOnly`,
|
|
176
|
+
* only restaurants serving them are matched and guests are shared among the
|
|
177
|
+
* types; with food, the drinks come from these types when the restaurant has them.
|
|
178
|
+
*/
|
|
179
|
+
drinkTypes?: DrinkTypeId[];
|
|
136
180
|
/** Options above this card price per guest are flagged `withinBudget: false`. */
|
|
137
181
|
budgetPerGuest?: number;
|
|
138
182
|
deliveryAddress: Address;
|
|
@@ -150,6 +194,12 @@ interface CateringRequestInput {
|
|
|
150
194
|
};
|
|
151
195
|
attendees: Attendee[];
|
|
152
196
|
}
|
|
197
|
+
/** A drink type from `listDrinkTypes()`, or any short word ("horchata"). */
|
|
198
|
+
type DrinkTypeId = "coffee" | "tea" | "milk_tea" | "boba" | "fruit_tea" | "smoothie" | "juice" | "soda" | "hot_chocolate" | "water" | (string & {});
|
|
199
|
+
interface DrinkType {
|
|
200
|
+
id: DrinkTypeId;
|
|
201
|
+
label: string;
|
|
202
|
+
}
|
|
153
203
|
interface PriceLine {
|
|
154
204
|
code: "food" | "delivery" | "restaurant_fee" | "tax" | "platform_fee" | "service_fee";
|
|
155
205
|
/** "Free delivery" (amount 0) when the restaurant waived the delivery fee. */
|
|
@@ -161,7 +211,7 @@ interface PriceLine {
|
|
|
161
211
|
interface Price {
|
|
162
212
|
currency: "USD";
|
|
163
213
|
lines: PriceLine[];
|
|
164
|
-
/** The host's service fee: serviceFeeRate x food and drinks (the `service_fee` line). */
|
|
214
|
+
/** The host's service fee: serviceFeeRate x (food and drinks + the restaurant's service charge) (the `service_fee` line). */
|
|
165
215
|
dunbackServiceFee: number;
|
|
166
216
|
/** Dunback's service fee rate on catering orders (0.05 = 5%). */
|
|
167
217
|
serviceFeeRate: number;
|
|
@@ -197,6 +247,12 @@ interface CateringItem {
|
|
|
197
247
|
dietaryTags: string[];
|
|
198
248
|
/** true for a shared dish added so the order reaches the restaurant's minimum. */
|
|
199
249
|
addedForMinimum?: boolean;
|
|
250
|
+
/**
|
|
251
|
+
* A drink's choices, from the restaurant's own options: ["Sweetness: 50%",
|
|
252
|
+
* "Toppings: Boba"]. Each option mixes them differently (favorites: the
|
|
253
|
+
* restaurant's defaults; value: no paid add-ons; variety: several versions).
|
|
254
|
+
*/
|
|
255
|
+
modifiers?: string[];
|
|
200
256
|
}
|
|
201
257
|
interface AllergyCoverage {
|
|
202
258
|
/** "no peanut, shellfish", "vegetarian", "no restrictions", ... */
|
|
@@ -231,8 +287,18 @@ interface CateringOption {
|
|
|
231
287
|
unfedGuests: UnfedGuests[];
|
|
232
288
|
price: Price;
|
|
233
289
|
withinBudget?: boolean;
|
|
290
|
+
/**
|
|
291
|
+
* false when this restaurant hasn't set up card payments on Dunback (its
|
|
292
|
+
* Stripe account): the option can then only be paid in USDC, and selecting
|
|
293
|
+
* it with paymentMethods ["stripe"] fails with card_payments_unavailable.
|
|
294
|
+
*/
|
|
295
|
+
acceptsCard: boolean;
|
|
296
|
+
/** How this option can be paid: ["stripe", "usdc"], or ["usdc"] when acceptsCard is false. */
|
|
297
|
+
paymentMethods: Array<"stripe" | "usdc">;
|
|
234
298
|
/** Pay before this instant (ISO), or the restaurant can't make the event time. */
|
|
235
299
|
orderBy: string | null;
|
|
300
|
+
/** Dunback's catering cancellation and refund policy, in one paragraph. Show it with the option. */
|
|
301
|
+
cancellationPolicy: string;
|
|
236
302
|
}
|
|
237
303
|
type CateringRequestStatus = "COMPOSING" | "OPTIONS_READY" | "NO_OPTIONS" | "SELECTED" | "FAILED";
|
|
238
304
|
interface CateringRequest {
|
|
@@ -243,11 +309,32 @@ interface CateringRequest {
|
|
|
243
309
|
event: CateringRequestInput["event"] & {
|
|
244
310
|
startsAtLocal: string;
|
|
245
311
|
};
|
|
312
|
+
/** null when the host named a restaurant instead. */
|
|
246
313
|
cuisine: {
|
|
247
314
|
id: CuisineId;
|
|
248
315
|
label: string;
|
|
249
|
-
};
|
|
316
|
+
} | null;
|
|
317
|
+
secondaryCuisine?: {
|
|
318
|
+
id: CuisineId;
|
|
319
|
+
label: string;
|
|
320
|
+
} | null;
|
|
321
|
+
/**
|
|
322
|
+
* The restaurant the host named, or null. `available` false: it can't
|
|
323
|
+
* cater this event (`reason`), and the options are from other restaurants.
|
|
324
|
+
* `found` false: no restaurant by that name. null fields: still composing.
|
|
325
|
+
*/
|
|
326
|
+
restaurant: {
|
|
327
|
+
requested: string;
|
|
328
|
+
found: boolean | null;
|
|
329
|
+
name: string | null;
|
|
330
|
+
available: boolean | null;
|
|
331
|
+
reason: string | null;
|
|
332
|
+
} | null;
|
|
250
333
|
serviceStyle: CateringServiceStyle;
|
|
334
|
+
/** Drinks only, no food. */
|
|
335
|
+
drinksOnly: boolean;
|
|
336
|
+
includeDrinks: boolean;
|
|
337
|
+
drinkTypes: DrinkType[];
|
|
251
338
|
guestCount: number;
|
|
252
339
|
deliveryDeadlineLocal: string;
|
|
253
340
|
timeZone: string;
|
|
@@ -341,7 +428,15 @@ interface Order {
|
|
|
341
428
|
timeZone: string;
|
|
342
429
|
guestCount: number;
|
|
343
430
|
delivery: OrderDelivery;
|
|
431
|
+
/** What was priced and paid for. */
|
|
344
432
|
items: CateringItem[];
|
|
433
|
+
/**
|
|
434
|
+
* Set when the restaurant changed the order after calling the host and
|
|
435
|
+
* getting their agreement (webhook `order.revised`). `revision.items` is
|
|
436
|
+
* what it will now prepare. The price never changes with a revision.
|
|
437
|
+
* Show the note and the revised items to the host.
|
|
438
|
+
*/
|
|
439
|
+
revision: OrderRevision | null;
|
|
345
440
|
allergyCoverage: AllergyCoverage[];
|
|
346
441
|
unfedGuests: UnfedGuests[];
|
|
347
442
|
price: Price;
|
|
@@ -372,12 +467,21 @@ interface Order {
|
|
|
372
467
|
};
|
|
373
468
|
fulfillment: {
|
|
374
469
|
restaurantOrderIds: string[];
|
|
470
|
+
/**
|
|
471
|
+
* How Dunback paid the restaurant: in USDC on Polygon for a USDC/x402 order,
|
|
472
|
+
* or through the restaurant's Stripe account for a card order (details
|
|
473
|
+
* of a card payout are not shared).
|
|
474
|
+
*/
|
|
375
475
|
providerPayment: {
|
|
476
|
+
method?: "usdc_x402";
|
|
376
477
|
amount: number;
|
|
377
478
|
payTo: string;
|
|
378
479
|
txHash: string | null;
|
|
379
480
|
verifiedOnChain: boolean;
|
|
380
481
|
network: "polygon";
|
|
482
|
+
} | {
|
|
483
|
+
method: "stripe_connect";
|
|
484
|
+
status: "PAID" | "PENDING";
|
|
381
485
|
};
|
|
382
486
|
confirmedAt: string;
|
|
383
487
|
} | null;
|
|
@@ -403,6 +507,17 @@ interface Order {
|
|
|
403
507
|
at: string;
|
|
404
508
|
restaurantOrderId?: string;
|
|
405
509
|
}>;
|
|
510
|
+
/** Where the order stands for cancelling. Show `policy` with the order. */
|
|
511
|
+
cancellation: OrderCancellation;
|
|
512
|
+
/**
|
|
513
|
+
* Late-delivery refunds: a delivery `afterMinutes` or more past the delivery
|
|
514
|
+
* deadline counts as late. `requestableFrom` is the earliest moment that can
|
|
515
|
+
* be true: offer "request a refund" (`orders.requestRefund`) only from then.
|
|
516
|
+
*/
|
|
517
|
+
lateRefund?: {
|
|
518
|
+
afterMinutes: number;
|
|
519
|
+
requestableFrom: string | null;
|
|
520
|
+
};
|
|
406
521
|
error: {
|
|
407
522
|
code: string;
|
|
408
523
|
message: string;
|
|
@@ -410,7 +525,112 @@ interface Order {
|
|
|
410
525
|
createdAt: string;
|
|
411
526
|
updatedAt: string;
|
|
412
527
|
}
|
|
413
|
-
|
|
528
|
+
/**
|
|
529
|
+
* Dunback's uniform catering cancellation and refund policy, as it applies to
|
|
530
|
+
* an order now:
|
|
531
|
+
* "unpaid" nothing charged; cancelling closes the payment links
|
|
532
|
+
* "before_commitment" cancel for the restaurant's full refund (Dunback's fees kept)
|
|
533
|
+
* "after_commitment" may still cancel until delivery; Dunback decides the
|
|
534
|
+
* refund with the restaurant, 0 up to `refundIfCancelledNow.maximum`
|
|
535
|
+
* "closed" can't be cancelled
|
|
536
|
+
* Before cancelling, show `notice` to the host and get their confirmation.
|
|
537
|
+
* After the commitment deadline, pass `acceptPostCommitment: true` to
|
|
538
|
+
* orders.cancel(); without it the call fails with 409
|
|
539
|
+
* `post_commitment_confirmation_required` (details.cancellation has this object).
|
|
540
|
+
*/
|
|
541
|
+
interface OrderCancellation {
|
|
542
|
+
policy: string;
|
|
543
|
+
phase: "unpaid" | "before_commitment" | "after_commitment" | "closed";
|
|
544
|
+
cancellable: boolean;
|
|
545
|
+
commitmentDeadlineUtc: string | null;
|
|
546
|
+
deliveryDeadlineUtc: string | null;
|
|
547
|
+
notice: string | null;
|
|
548
|
+
refundIfCancelledNow: {
|
|
549
|
+
kind: "restaurant_full_refund";
|
|
550
|
+
amount: number | null;
|
|
551
|
+
} | {
|
|
552
|
+
kind: "decided_by_dunback";
|
|
553
|
+
maximum: number | null;
|
|
554
|
+
} | null;
|
|
555
|
+
requiresAcceptPostCommitment: boolean;
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* orders.requestRefund(): a catering delivery made at or after Dunback's
|
|
559
|
+
* catering late-delivery threshold (60 minutes by default). Both texts are
|
|
560
|
+
* required and go to Dunback's reviewer.
|
|
561
|
+
*/
|
|
562
|
+
interface LateRefundRequestInput {
|
|
563
|
+
/** Which restaurant order (order.fulfillment.restaurantOrderIds); default: the late one. */
|
|
564
|
+
restaurantOrderId?: string;
|
|
565
|
+
/** Why the host is asking for a refund. */
|
|
566
|
+
reason: string;
|
|
567
|
+
/** How the late delivery affected the event. */
|
|
568
|
+
impact: string;
|
|
569
|
+
}
|
|
570
|
+
/** 202 from orders.requestRefund(). Dunback's decision follows as `order.refund_decided`. */
|
|
571
|
+
interface LateRefundRequest {
|
|
572
|
+
object: "refund_request";
|
|
573
|
+
status: "REQUESTED";
|
|
574
|
+
orderId: string;
|
|
575
|
+
restaurantOrderId: string;
|
|
576
|
+
lateMinutes: number;
|
|
577
|
+
/** The most the refund can be: the restaurant's part of that delivery. */
|
|
578
|
+
maximum: number;
|
|
579
|
+
policy: string;
|
|
580
|
+
requestedAt: string;
|
|
581
|
+
}
|
|
582
|
+
/** `data` of `order.delivered_late`: the order, and which deliveries were late. */
|
|
583
|
+
interface DeliveredLateData extends Order {
|
|
584
|
+
lateDeliveries: Array<{
|
|
585
|
+
restaurantOrderId: string;
|
|
586
|
+
lateMinutes: number;
|
|
587
|
+
}>;
|
|
588
|
+
/** Dunback's policy for late catering refunds. Show it with a "Request a refund" action. */
|
|
589
|
+
lateRefundPolicy: string;
|
|
590
|
+
}
|
|
591
|
+
/** Options for orders.cancel(). */
|
|
592
|
+
interface CancelOrderOptions {
|
|
593
|
+
/** The host confirmed cancelling after the commitment deadline (the refund is then decided by Dunback). */
|
|
594
|
+
acceptPostCommitment?: boolean;
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* `data` of `order.refund_decided`: the order, plus Dunback's decision on a
|
|
598
|
+
* restaurant order the host cancelled after its commitment deadline.
|
|
599
|
+
* `refund` is null when nothing is refunded (amount 0).
|
|
600
|
+
*/
|
|
601
|
+
interface RefundDecidedData extends Order {
|
|
602
|
+
refundDecision: {
|
|
603
|
+
restaurantOrderId: string;
|
|
604
|
+
/** Why the refund was decided: a cancellation after the commitment deadline, or a late delivery. */
|
|
605
|
+
basis: "cancelled_after_commitment" | "late_delivery";
|
|
606
|
+
percentage: number;
|
|
607
|
+
amount: number;
|
|
608
|
+
explanation: string;
|
|
609
|
+
refund: {
|
|
610
|
+
status: "SUCCEEDED" | "PENDING";
|
|
611
|
+
method: "stripe" | "usdc";
|
|
612
|
+
amount: number;
|
|
613
|
+
note?: string;
|
|
614
|
+
} | null;
|
|
615
|
+
};
|
|
616
|
+
}
|
|
617
|
+
interface OrderRevision {
|
|
618
|
+
/** "Revised by restaurant with user agreement." */
|
|
619
|
+
note: string;
|
|
620
|
+
revisedAt: string;
|
|
621
|
+
/** The restaurant's reason, as told to the host. */
|
|
622
|
+
reason: string;
|
|
623
|
+
items: Array<{
|
|
624
|
+
name: string;
|
|
625
|
+
quantity: number;
|
|
626
|
+
modifiers: string[];
|
|
627
|
+
}>;
|
|
628
|
+
history: Array<{
|
|
629
|
+
revisedAt: string;
|
|
630
|
+
reason: string;
|
|
631
|
+
}>;
|
|
632
|
+
}
|
|
633
|
+
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.refunded" | "order.refund_decided" | "order.delivered_late" | "order.delivery_updated" | "order.revised" | "ping";
|
|
414
634
|
/** `data` of a `ping` event, sent by "Send test event" in the Developer Dashboard. */
|
|
415
635
|
interface PingData {
|
|
416
636
|
object: "ping";
|
|
@@ -440,7 +660,8 @@ interface AppInfo {
|
|
|
440
660
|
* Helpers for the Luma integration:
|
|
441
661
|
*
|
|
442
662
|
* 1. Event creation: the host turns on "Food & drinks by Dunback Meadow" and
|
|
443
|
-
* picks a cuisine
|
|
663
|
+
* names a preferred restaurant OR picks a cuisine -> store a
|
|
664
|
+
* DunbackEventSettings with the event.
|
|
444
665
|
* 2. Registration: add DUNBACK_REGISTRATION_QUESTION to the event's form, so
|
|
445
666
|
* guests can note allergies.
|
|
446
667
|
* 3. After the guest list is final: "Order Food via Dunback Meadow" ->
|
|
@@ -454,13 +675,27 @@ interface AppInfo {
|
|
|
454
675
|
/** Stored with a Luma event when the host enables Dunback catering. */
|
|
455
676
|
interface DunbackEventSettings {
|
|
456
677
|
enabled: boolean;
|
|
457
|
-
|
|
678
|
+
/**
|
|
679
|
+
* A restaurant the host prefers (listRestaurants()). When set, don't offer
|
|
680
|
+
* a cuisine picker: the restaurant settles it, and all options come from it.
|
|
681
|
+
*/
|
|
682
|
+
restaurantName?: string;
|
|
683
|
+
/** Required when no restaurantName is set, unless drinksOnly. */
|
|
684
|
+
cuisine?: CuisineId;
|
|
685
|
+
/**
|
|
686
|
+
* Drinks only, no food (coffee for a morning meetup, boba for a study
|
|
687
|
+
* group): from restaurantName, or any restaurant serving drinkTypes. No cuisine.
|
|
688
|
+
*/
|
|
689
|
+
drinksOnly?: boolean;
|
|
690
|
+
/** Which drinks ("coffee", "boba"...; listDrinkTypes()). With food, the drinks come from these types. */
|
|
691
|
+
drinkTypes?: DrinkTypeId[];
|
|
458
692
|
/**
|
|
459
693
|
* Buffet (trays to share) or individual meal boxes. Pass it to
|
|
460
694
|
* listCuisines(venue, { serviceStyle }) too: fewer restaurants offer buffets.
|
|
461
695
|
* Default "meal_boxes".
|
|
462
696
|
*/
|
|
463
697
|
serviceStyle?: CateringServiceStyle;
|
|
698
|
+
/** Food catering: also one drink per guest. Default true. */
|
|
464
699
|
includeDrinks?: boolean;
|
|
465
700
|
budgetPerGuest?: number;
|
|
466
701
|
/**
|
|
@@ -594,4 +829,4 @@ declare function canOrderFood(settings: DunbackEventSettings | null | undefined,
|
|
|
594
829
|
reason?: string;
|
|
595
830
|
};
|
|
596
831
|
|
|
597
|
-
export { type AppInfo as A, type BuildCateringRequestArgs as B, type CuisineQuery as C,
|
|
832
|
+
export { toVenueLocation as $, type AppInfo as A, type BuildCateringRequestArgs as B, type CuisineQuery as C, type DrinkType as D, type OrderStatus as E, type Price as F, type PriceLine as G, type RefundDecidedData as H, type StandardCuisineId as I, type UnavailableReason as J, type UnavailableReasonCode as K, type LateRefundRequestInput as L, type UnfedGuests as M, type UsdcPaymentInstructions as N, type Order as O, type PingData as P, type WebhookEventType as Q, type RestaurantSummary as R, type SelectOptionInput as S, buildCateringRequest as T, type UpdateDeliveryInput as U, type VenueLocation as V, type WebhookEvent as W, canOrderFood as X, guestsWithUnsharedAllergies as Y, toDunbackAddress as Z, toDunbackAttendees as _, type Cuisine as a, type CuisineCatalog as b, type CateringRequestInput as c, type CateringRequest as d, type CancelOrderOptions as e, type LateRefundRequest as f, ATTENDING_STATUSES as g, type Address as h, type AllergyCoverage as i, type Attendee as j, type CateringItem as k, type CateringOption as l, type CateringPolicies as m, type CateringRequestStatus as n, type CateringServiceStyle as o, type CuisineId as p, type CustomCuisineId as q, DUNBACK_REGISTRATION_QUESTION as r, type DeliveredLateData as s, type DrinkTypeId as t, type DunbackEventSettings as u, type LumaEventLike as v, type LumaGuestLike as w, type OrderCancellation as x, type OrderDelivery as y, type OrderRevision as z };
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { l as CateringOption, a as Cuisine, u as DunbackEventSettings, R as RestaurantSummary, D as DrinkType, O as Order, F as Price } from '../luma-D2AucdDY.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Optional, unstyled-by-default React building blocks for the three Luma
|
|
@@ -37,9 +37,21 @@ interface DunbackCateringSettingsProps {
|
|
|
37
37
|
* that many, in that style. Default true.
|
|
38
38
|
*/
|
|
39
39
|
askExpectedGuests?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* From your backend: dunback.listRestaurants(venue). Offered as suggestions
|
|
42
|
+
* in the optional "Preferred restaurant" field. When the host names a
|
|
43
|
+
* restaurant, the cuisine picker is hidden: the restaurant settles it.
|
|
44
|
+
*/
|
|
45
|
+
restaurants?: RestaurantSummary[];
|
|
46
|
+
/**
|
|
47
|
+
* From your backend: dunback.listDrinkTypes(). Offered as "Which drinks?"
|
|
48
|
+
* for a drinks-only order and for the drinks with food. Defaults to the
|
|
49
|
+
* standard types.
|
|
50
|
+
*/
|
|
51
|
+
drinkTypes?: DrinkType[];
|
|
40
52
|
className?: string;
|
|
41
53
|
}
|
|
42
|
-
declare function DunbackCateringSettings({ cuisines, value, onChange, venueReady, metroName, askExpectedGuests, className }: DunbackCateringSettingsProps): React.JSX.Element;
|
|
54
|
+
declare function DunbackCateringSettings({ cuisines, value, onChange, venueReady, metroName, askExpectedGuests, restaurants, drinkTypes, className }: DunbackCateringSettingsProps): React.JSX.Element;
|
|
43
55
|
interface PriceBreakdownProps {
|
|
44
56
|
price: Price;
|
|
45
57
|
/**
|
|
@@ -59,9 +71,20 @@ interface CateringOptionsPickerProps {
|
|
|
59
71
|
className?: string;
|
|
60
72
|
}
|
|
61
73
|
declare function CateringOptionsPicker({ options, onSelect, busyOptionId, className }: CateringOptionsPickerProps): React.JSX.Element;
|
|
62
|
-
|
|
74
|
+
/** Which payment link the host chose: Stripe Checkout, or Dunback's page with the other options. */
|
|
75
|
+
type PaymentLinkKind = "card" | "other";
|
|
76
|
+
/**
|
|
77
|
+
* The order's status and, while it awaits payment, its payment links.
|
|
78
|
+
*
|
|
79
|
+
* `onOpenPayment`: open the payment page yourself instead of following the
|
|
80
|
+
* link in the current page. In a mobile app, open it in an in-app browser
|
|
81
|
+
* (SFSafariViewController / Chrome Custom Tabs) so the host can always get back
|
|
82
|
+
* to your app. Without it, the links are plain links.
|
|
83
|
+
*/
|
|
84
|
+
declare function DunbackOrderStatus({ order, className, onOpenPayment }: {
|
|
63
85
|
order: Order;
|
|
64
86
|
className?: string;
|
|
87
|
+
onOpenPayment?: (url: string, kind: PaymentLinkKind) => void;
|
|
65
88
|
}): React.JSX.Element;
|
|
66
89
|
|
|
67
|
-
export { CateringOptionsPicker, type CateringOptionsPickerProps, DunbackCateringSettings, type DunbackCateringSettingsProps, DunbackOrderStatus, PriceBreakdown, type PriceBreakdownProps };
|
|
90
|
+
export { CateringOptionsPicker, type CateringOptionsPickerProps, DunbackCateringSettings, type DunbackCateringSettingsProps, DunbackOrderStatus, type PaymentLinkKind, PriceBreakdown, type PriceBreakdownProps };
|