@dunbackmeadow/commerce-sdk 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +19 -3
- package/dist/index.js +27 -2
- package/dist/{luma-D2AucdDY.d.ts → luma-BwA6aHtI.d.ts} +181 -21
- package/dist/react/index.d.ts +1 -1
- package/docs/API_REFERENCE.md +467 -421
- package/docs/LUMA_INTEGRATION_GUIDE.md +6 -0
- package/package.json +72 -72
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AppInfo, V as VenueLocation, C as CuisineQuery, a as Cuisine, R as RestaurantSummary, D as DrinkType, b as CuisineCatalog, c as CateringRequestInput, d as CateringRequest, S as SelectOptionInput, O as Order, U as UpdateDeliveryInput, e as CancelOrderOptions, L as LateRefundRequestInput, f as LateRefundRequest, W as WebhookEvent } from './luma-
|
|
2
|
-
export {
|
|
1
|
+
import { A as AppInfo, V as VenueLocation, C as CuisineQuery, a as Cuisine, R as RestaurantSummary, D as DrinkType, b as CuisineCatalog, c as CateringRequestInput, d as CateringRequest, S as SelectOptionInput, O as Order, U as UpdateDeliveryInput, e as CancelOrderOptions, L as LateRefundRequestInput, f as LateRefundRequest, P as ProblemReportInput, g as ProblemReport, W as WebhookEvent } from './luma-BwA6aHtI.js';
|
|
2
|
+
export { h as ATTENDING_STATUSES, i as Address, j as AllergyCoverage, k as Attendee, B as BuildCateringRequestArgs, l as CateringBudgetResult, m as CateringItem, n as CateringMealType, o as CateringOption, p as CateringPolicies, q as CateringRequestStatus, r as CateringServiceStyle, s as CuisineId, t as CustomCuisineId, u as DUNBACK_REGISTRATION_QUESTION, v as DeliveredData, w as DeliveredLateData, x as DeliveryProblemType, y as DrinkTypeId, z as DunbackEventSettings, E as LumaEventLike, F as LumaGuestLike, G as OrderCancellation, H as OrderDelivery, I as OrderRevision, J as OrderStatus, K as PartyDiet, M as PingData, N as Price, Q as PriceLine, T as RefundDecidedData, X as StandardCuisineId, Y as UnavailableReason, Z as UnavailableReasonCode, _ as UnfedGuests, $ as UsdcPaymentInstructions, a0 as WebhookEventType, a1 as buildCateringRequest, a2 as canOrderFood, a3 as guestsWithUnsharedAllergies, a4 as toDunbackAddress, a5 as toDunbackAttendees, a6 as toVenueLocation } from './luma-BwA6aHtI.js';
|
|
3
3
|
|
|
4
4
|
/** Any non-2xx answer from the Partner API. */
|
|
5
5
|
declare class DunbackApiError extends Error {
|
|
@@ -133,6 +133,22 @@ declare class DunbackClient {
|
|
|
133
133
|
* `already_requested`, `request_window_closed`.
|
|
134
134
|
*/
|
|
135
135
|
requestRefund: (orderId: string, input: LateRefundRequestInput) => Promise<LateRefundRequest>;
|
|
136
|
+
/**
|
|
137
|
+
* The host confirms a delivery arrived (within 48 hours of it; see
|
|
138
|
+
* `order.deliveries[].canConfirm`). Without `restaurantOrderId`, every
|
|
139
|
+
* recorded delivery. Errors: 409 `not_delivered`.
|
|
140
|
+
*/
|
|
141
|
+
confirmDelivery: (orderId: string, restaurantOrderId?: string) => Promise<Order>;
|
|
142
|
+
/**
|
|
143
|
+
* Reports a problem with a delivery (missing items, damaged food, no
|
|
144
|
+
* setup, the driver's or courier's conduct...), within 48 hours of it
|
|
145
|
+
* (`order.deliveries[].canReportProblem`), optionally with photos and a
|
|
146
|
+
* refund request. The restaurant is told at once; a refund is decided by
|
|
147
|
+
* Dunback (webhook `order.refund_decided`). Errors: 409 `not_delivered`,
|
|
148
|
+
* `already_reported`, `report_window_closed`; 413 `photo_too_large`;
|
|
149
|
+
* 415 `invalid_photo`.
|
|
150
|
+
*/
|
|
151
|
+
reportProblem: (orderId: string, input: ProblemReportInput) => Promise<ProblemReport>;
|
|
136
152
|
/** Polls until the order leaves AWAITING_PAYMENT/PAID/FULFILLING. */
|
|
137
153
|
waitForSettlement: (orderId: string, { timeoutMs, intervalMs }?: {
|
|
138
154
|
timeoutMs?: number | undefined;
|
|
@@ -212,4 +228,4 @@ declare function payOrderWithX402(order: Pick<Order, "id" | "payment">, signer:
|
|
|
212
228
|
maxAmountUsdc?: number;
|
|
213
229
|
}): Promise<Order>;
|
|
214
230
|
|
|
215
|
-
export { AppInfo, CancelOrderOptions, CateringRequest, CateringRequestInput, Cuisine, CuisineCatalog, CuisineQuery, DEFAULT_BASE_URL, DrinkType, DunbackApiError, DunbackClient, type DunbackClientOptions, LateRefundRequest, LateRefundRequestInput, Order, PAYMENT_ERROR_CODES, RestaurantSummary, SANDBOX_BASE_URL, SelectOptionInput, type TypedDataToSign, UpdateDeliveryInput, VenueLocation, WebhookEvent, type X402Signer, isPaymentError, payOrderWithX402, signWebhookPayload, verifyWebhook };
|
|
231
|
+
export { AppInfo, CancelOrderOptions, CateringRequest, CateringRequestInput, Cuisine, CuisineCatalog, CuisineQuery, DEFAULT_BASE_URL, DrinkType, DunbackApiError, DunbackClient, type DunbackClientOptions, LateRefundRequest, LateRefundRequestInput, Order, PAYMENT_ERROR_CODES, ProblemReport, ProblemReportInput, RestaurantSummary, SANDBOX_BASE_URL, SelectOptionInput, type TypedDataToSign, UpdateDeliveryInput, VenueLocation, WebhookEvent, type X402Signer, isPaymentError, payOrderWithX402, signWebhookPayload, verifyWebhook };
|
package/dist/index.js
CHANGED
|
@@ -212,6 +212,22 @@ var DunbackClient = class {
|
|
|
212
212
|
* `already_requested`, `request_window_closed`.
|
|
213
213
|
*/
|
|
214
214
|
requestRefund: (orderId, input) => this.request("POST", `/orders/${encodeURIComponent(orderId)}/refund-requests`, input),
|
|
215
|
+
/**
|
|
216
|
+
* The host confirms a delivery arrived (within 48 hours of it; see
|
|
217
|
+
* `order.deliveries[].canConfirm`). Without `restaurantOrderId`, every
|
|
218
|
+
* recorded delivery. Errors: 409 `not_delivered`.
|
|
219
|
+
*/
|
|
220
|
+
confirmDelivery: (orderId, restaurantOrderId) => this.request("POST", `/orders/${encodeURIComponent(orderId)}/deliveries/confirm`, restaurantOrderId ? { restaurantOrderId } : {}),
|
|
221
|
+
/**
|
|
222
|
+
* Reports a problem with a delivery (missing items, damaged food, no
|
|
223
|
+
* setup, the driver's or courier's conduct...), within 48 hours of it
|
|
224
|
+
* (`order.deliveries[].canReportProblem`), optionally with photos and a
|
|
225
|
+
* refund request. The restaurant is told at once; a refund is decided by
|
|
226
|
+
* Dunback (webhook `order.refund_decided`). Errors: 409 `not_delivered`,
|
|
227
|
+
* `already_reported`, `report_window_closed`; 413 `photo_too_large`;
|
|
228
|
+
* 415 `invalid_photo`.
|
|
229
|
+
*/
|
|
230
|
+
reportProblem: (orderId, input) => this.request("POST", `/orders/${encodeURIComponent(orderId)}/problem-reports`, input),
|
|
215
231
|
/** Polls until the order leaves AWAITING_PAYMENT/PAID/FULFILLING. */
|
|
216
232
|
waitForSettlement: async (orderId, { timeoutMs = 15 * 6e4, intervalMs = 5e3 } = {}) => {
|
|
217
233
|
const until = Date.now() + timeoutMs;
|
|
@@ -316,7 +332,9 @@ function toVenueLocation(geo) {
|
|
|
316
332
|
function buildCateringRequest(args) {
|
|
317
333
|
const { event, guests, settings, host } = args;
|
|
318
334
|
if (!settings?.enabled) throw new Error("Dunback catering is not enabled for this event.");
|
|
319
|
-
if (!settings.drinksOnly && !settings.restaurantName && !settings.cuisine
|
|
335
|
+
if (!settings.drinksOnly && !settings.restaurantName && !settings.cuisine && !settings.dishPreferences?.length && settings.mealType !== "breakfast") {
|
|
336
|
+
throw new Error("Choose a restaurant, a cuisine or the dishes you'd like for the catering.");
|
|
337
|
+
}
|
|
320
338
|
const onsite = args.onsiteContact || settings.onsiteContact || (host.phone ? { name: host.name, phone: host.phone, email: host.email } : null);
|
|
321
339
|
if (!onsite) throw new Error("An on-site contact with a phone number is required for delivery.");
|
|
322
340
|
const attendees = [...toDunbackAttendees(guests), ...args.extraAttendees || []];
|
|
@@ -325,11 +343,18 @@ function buildCateringRequest(args) {
|
|
|
325
343
|
partnerReference: `luma:${event.api_id || event.id}`,
|
|
326
344
|
event: { name: event.name, startsAt: event.start_at, timeZone: event.timezone, ...event.url ? { url: event.url } : {} },
|
|
327
345
|
...settings.deliveryDeadlineLocal ? { deliveryDeadlineLocal: settings.deliveryDeadlineLocal } : {},
|
|
328
|
-
...settings.restaurantName ? { restaurantName: settings.restaurantName } : settings.drinksOnly ? {} : { cuisine: settings.cuisine },
|
|
346
|
+
...settings.restaurantName ? { restaurantName: settings.restaurantName } : settings.drinksOnly || !settings.cuisine ? {} : { cuisine: settings.cuisine },
|
|
329
347
|
serviceStyle: settings.serviceStyle ?? "meal_boxes",
|
|
330
348
|
...settings.drinksOnly ? { drinksOnly: true } : { includeDrinks: settings.includeDrinks ?? true },
|
|
331
349
|
...settings.drinkTypes?.length ? { drinkTypes: settings.drinkTypes } : {},
|
|
332
350
|
...settings.budgetPerGuest ? { budgetPerGuest: settings.budgetPerGuest } : {},
|
|
351
|
+
...settings.maxTotal ? { maxTotal: settings.maxTotal } : {},
|
|
352
|
+
...settings.maxPerGuest ? { maxPerGuest: settings.maxPerGuest } : {},
|
|
353
|
+
// Dish rules are about food: not for a drinks-only order.
|
|
354
|
+
...!settings.drinksOnly && settings.dishPreferences?.length ? { dishPreferences: settings.dishPreferences } : {},
|
|
355
|
+
...!settings.drinksOnly && settings.mealType ? { mealType: settings.mealType } : {},
|
|
356
|
+
...!settings.drinksOnly && settings.spicyShare != null ? { spicyShare: settings.spicyShare } : {},
|
|
357
|
+
...!settings.drinksOnly && settings.partyDiet?.length ? { partyDiet: settings.partyDiet } : {},
|
|
333
358
|
deliveryAddress: args.deliveryAddress || toDunbackAddress(event.geo_address_json),
|
|
334
359
|
onsiteContact: onsite,
|
|
335
360
|
deliveryNotes: settings.deliveryNotes || "",
|
|
@@ -149,9 +149,10 @@ interface CateringRequestInput {
|
|
|
149
149
|
*/
|
|
150
150
|
restaurantName?: string;
|
|
151
151
|
/**
|
|
152
|
-
* Required
|
|
153
|
-
*
|
|
154
|
-
*
|
|
152
|
+
* Required unless you give restaurantName, dishPreferences or mealType
|
|
153
|
+
* "breakfast" (then any cuisine). Restaurants whose primary cuisine this is
|
|
154
|
+
* are matched first; restaurants listing it as their secondary cuisine only
|
|
155
|
+
* when none of those can cater.
|
|
155
156
|
*/
|
|
156
157
|
cuisine?: CuisineId;
|
|
157
158
|
/**
|
|
@@ -177,8 +178,34 @@ interface CateringRequestInput {
|
|
|
177
178
|
* types; with food, the drinks come from these types when the restaurant has them.
|
|
178
179
|
*/
|
|
179
180
|
drinkTypes?: DrinkTypeId[];
|
|
180
|
-
/**
|
|
181
|
+
/** Soft: options above this card price per guest are only flagged `withinBudget: false`. */
|
|
181
182
|
budgetPerGuest?: number;
|
|
183
|
+
/**
|
|
184
|
+
* Hard budget, USD: options priced above it are not offered. Compared with
|
|
185
|
+
* what the host would pay: the card total, or the USDC total at a restaurant
|
|
186
|
+
* that takes no card. When it leaves fewer than three options,
|
|
187
|
+
* `CateringRequest.budget.message` says how far to raise it for three.
|
|
188
|
+
*/
|
|
189
|
+
maxTotal?: number;
|
|
190
|
+
/** Hard budget per guest, USD (see `maxTotal`). */
|
|
191
|
+
maxPerGuest?: number;
|
|
192
|
+
/**
|
|
193
|
+
* Kinds of dishes the host wants, up to 8: "sushi", "seafood", "pastries",
|
|
194
|
+
* "bagels", "tacos"... The mains come from dishes that match; a guest no
|
|
195
|
+
* matching dish is safe for gets another safe main (its allergyCoverage
|
|
196
|
+
* entry says `outsidePreferences: true`). Any cuisine when none is given.
|
|
197
|
+
*/
|
|
198
|
+
dishPreferences?: string[];
|
|
199
|
+
/**
|
|
200
|
+
* The kind of food, whatever the delivery time: "breakfast" (pastries,
|
|
201
|
+
* bagels, egg dishes, fruit...), "lunch" or "dinner". Without it, a delivery
|
|
202
|
+
* before 10:30 prefers breakfast food without requiring it.
|
|
203
|
+
*/
|
|
204
|
+
mealType?: CateringMealType;
|
|
205
|
+
/** About this share (0..1) of the main servings spicy; 0 = nothing spicy. */
|
|
206
|
+
spicyShare?: number;
|
|
207
|
+
/** Diets every guest's food must fit, e.g. ["vegetarian"] for an all-vegetarian event. */
|
|
208
|
+
partyDiet?: PartyDiet[];
|
|
182
209
|
deliveryAddress: Address;
|
|
183
210
|
/** Who receives the delivery at the venue. */
|
|
184
211
|
onsiteContact: {
|
|
@@ -194,6 +221,28 @@ interface CateringRequestInput {
|
|
|
194
221
|
};
|
|
195
222
|
attendees: Attendee[];
|
|
196
223
|
}
|
|
224
|
+
type CateringMealType = "breakfast" | "lunch" | "dinner";
|
|
225
|
+
type PartyDiet = "vegetarian" | "vegan" | "halal" | "kosher" | "gluten_free" | "dairy_free" | "pescatarian";
|
|
226
|
+
/** What a hard budget (`maxTotal` / `maxPerGuest`) did to the options. */
|
|
227
|
+
interface CateringBudgetResult {
|
|
228
|
+
maxTotal: number | null;
|
|
229
|
+
maxPerGuest: number | null;
|
|
230
|
+
/** The budget for the whole order (the tighter of the two), USD. */
|
|
231
|
+
limit: number;
|
|
232
|
+
/** Options offered (all within the budget). */
|
|
233
|
+
withinBudget: number;
|
|
234
|
+
/** Options left out for being over the budget. */
|
|
235
|
+
overBudget: number;
|
|
236
|
+
/** With fewer than three options: about how far to raise the budget for three (null otherwise). */
|
|
237
|
+
suggestedMaxTotal: number | null;
|
|
238
|
+
suggestedMaxPerGuest: number | null;
|
|
239
|
+
/**
|
|
240
|
+
* Show this to the host when set, e.g. "Only 2 catering offers fit your
|
|
241
|
+
* budget of $1,000. Raising your budget to about $1,150 would give you 3
|
|
242
|
+
* offers to choose from."
|
|
243
|
+
*/
|
|
244
|
+
message: string | null;
|
|
245
|
+
}
|
|
197
246
|
/** A drink type from `listDrinkTypes()`, or any short word ("horchata"). */
|
|
198
247
|
type DrinkTypeId = "coffee" | "tea" | "milk_tea" | "boba" | "fruit_tea" | "smoothie" | "juice" | "soda" | "hot_chocolate" | "water" | (string & {});
|
|
199
248
|
interface DrinkType {
|
|
@@ -247,6 +296,10 @@ interface CateringItem {
|
|
|
247
296
|
dietaryTags: string[];
|
|
248
297
|
/** true for a shared dish added so the order reaches the restaurant's minimum. */
|
|
249
298
|
addedForMinimum?: boolean;
|
|
299
|
+
/** The request's dishPreferences this dish matches ("sushi"). */
|
|
300
|
+
matches?: string[];
|
|
301
|
+
/** true for a spicy main (see spicyShare). */
|
|
302
|
+
spicy?: boolean;
|
|
250
303
|
/**
|
|
251
304
|
* A drink's choices, from the restaurant's own options: ["Sweetness: 50%",
|
|
252
305
|
* "Toppings: Boba"]. Each option mixes them differently (favorites: the
|
|
@@ -259,6 +312,8 @@ interface AllergyCoverage {
|
|
|
259
312
|
constraint: string;
|
|
260
313
|
guests: number;
|
|
261
314
|
dishes: string[];
|
|
315
|
+
/** None of the dishes asked for (dishPreferences / mealType) is safe for these guests: they get other safe dishes. */
|
|
316
|
+
outsidePreferences?: boolean;
|
|
262
317
|
}
|
|
263
318
|
interface UnfedGuests {
|
|
264
319
|
constraint: string;
|
|
@@ -286,7 +341,11 @@ interface CateringOption {
|
|
|
286
341
|
/** Guests no dish on this menu is known to be safe for. Show this to the host. */
|
|
287
342
|
unfedGuests: UnfedGuests[];
|
|
288
343
|
price: Price;
|
|
344
|
+
/** With budgetPerGuest (soft) or maxTotal / maxPerGuest (hard; always true then). */
|
|
289
345
|
withinBudget?: boolean;
|
|
346
|
+
/** With spicyShare only: main servings that are spicy, of all main servings. */
|
|
347
|
+
spicyServings?: number;
|
|
348
|
+
mainServings?: number;
|
|
290
349
|
/**
|
|
291
350
|
* false when this restaurant hasn't set up card payments on Dunback (its
|
|
292
351
|
* Stripe account): the option can then only be paid in USDC, and selecting
|
|
@@ -326,7 +385,10 @@ interface CateringRequest {
|
|
|
326
385
|
restaurant: {
|
|
327
386
|
requested: string;
|
|
328
387
|
found: boolean | null;
|
|
388
|
+
/** The restaurant found: may differ from `requested` (part of a name, or a misspelling). */
|
|
329
389
|
name: string | null;
|
|
390
|
+
/** true: no restaurant has that name; `name` is the closest spelling found (e.g. "Ragoon Ruby" -> "Rangoon Ruby Palo Alto"). Show the host which restaurant it is. */
|
|
391
|
+
closeMatch?: boolean;
|
|
330
392
|
available: boolean | null;
|
|
331
393
|
reason: string | null;
|
|
332
394
|
} | null;
|
|
@@ -335,6 +397,14 @@ interface CateringRequest {
|
|
|
335
397
|
drinksOnly: boolean;
|
|
336
398
|
includeDrinks: boolean;
|
|
337
399
|
drinkTypes: DrinkType[];
|
|
400
|
+
dishPreferences: string[];
|
|
401
|
+
mealType: CateringMealType | null;
|
|
402
|
+
spicyShare: number | null;
|
|
403
|
+
partyDiet: PartyDiet[];
|
|
404
|
+
maxTotal: number | null;
|
|
405
|
+
maxPerGuest: number | null;
|
|
406
|
+
/** With a hard budget only. Show `budget.message` to the host when it is set. */
|
|
407
|
+
budget: CateringBudgetResult | null;
|
|
338
408
|
guestCount: number;
|
|
339
409
|
deliveryDeadlineLocal: string;
|
|
340
410
|
timeZone: string;
|
|
@@ -355,7 +425,7 @@ interface CateringRequest {
|
|
|
355
425
|
updatedAt: string;
|
|
356
426
|
}
|
|
357
427
|
/** Why a restaurant can't cater an event. Unknown codes may be added: treat them as "other". */
|
|
358
|
-
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";
|
|
428
|
+
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" | "no_matching_dishes" | "over_budget" | "restaurant_declined";
|
|
359
429
|
interface UnavailableReason {
|
|
360
430
|
/** Restaurant name. */
|
|
361
431
|
name: string;
|
|
@@ -391,17 +461,6 @@ interface UsdcPaymentInstructions {
|
|
|
391
461
|
/** For agents: POST here to pay with x402 (see payOrderWithX402). */
|
|
392
462
|
x402Url?: string;
|
|
393
463
|
}
|
|
394
|
-
/** Where an order is delivered. `deliveryNotes` is your note only, without the catering and allergy text Dunback adds for the restaurant. */
|
|
395
|
-
interface OrderDelivery {
|
|
396
|
-
address: Required<Address>;
|
|
397
|
-
onsiteContact: {
|
|
398
|
-
name: string;
|
|
399
|
-
phone: string;
|
|
400
|
-
};
|
|
401
|
-
deliveryNotes: string;
|
|
402
|
-
/** True while the order is AWAITING_PAYMENT: the details can still be corrected (orders.updateDelivery). */
|
|
403
|
-
editable: boolean;
|
|
404
|
-
}
|
|
405
464
|
/** POST /orders/:id/delivery: correct the delivery details before payment. */
|
|
406
465
|
interface UpdateDeliveryInput {
|
|
407
466
|
deliveryAddress: Address;
|
|
@@ -518,6 +577,13 @@ interface Order {
|
|
|
518
577
|
afterMinutes: number;
|
|
519
578
|
requestableFrom: string | null;
|
|
520
579
|
};
|
|
580
|
+
/**
|
|
581
|
+
* Each restaurant order's delivery. For 48 hours after a delivery is
|
|
582
|
+
* recorded the host can confirm it (`orders.confirmDelivery`) or report a
|
|
583
|
+
* problem (`orders.reportProblem`): offer those while `canConfirm` /
|
|
584
|
+
* `canReportProblem` are true. Webhook `order.delivered` when one is recorded.
|
|
585
|
+
*/
|
|
586
|
+
deliveries?: OrderDelivery[];
|
|
521
587
|
error: {
|
|
522
588
|
code: string;
|
|
523
589
|
message: string;
|
|
@@ -579,6 +645,88 @@ interface LateRefundRequest {
|
|
|
579
645
|
policy: string;
|
|
580
646
|
requestedAt: string;
|
|
581
647
|
}
|
|
648
|
+
/** Where an order is delivered. `deliveryNotes` is your note only, without the catering and allergy text Dunback adds for the restaurant. */
|
|
649
|
+
interface OrderDelivery {
|
|
650
|
+
address: Required<Address>;
|
|
651
|
+
onsiteContact: {
|
|
652
|
+
name: string;
|
|
653
|
+
phone: string;
|
|
654
|
+
};
|
|
655
|
+
deliveryNotes: string;
|
|
656
|
+
/** True while the order is AWAITING_PAYMENT: the details can still be corrected (orders.updateDelivery). */
|
|
657
|
+
editable: boolean;
|
|
658
|
+
}
|
|
659
|
+
interface OrderDelivery {
|
|
660
|
+
restaurantOrderId: string;
|
|
661
|
+
status: "pending" | "on_the_way" | "delivered" | "not_delivered" | "cancelled";
|
|
662
|
+
deliveredAt: string | null;
|
|
663
|
+
lateMinutes: number;
|
|
664
|
+
/** A Dunback or restaurant staff "driver", or a "courier" company the restaurant booked. */
|
|
665
|
+
deliveredBy: "driver" | "courier" | null;
|
|
666
|
+
courierCompany: string | null;
|
|
667
|
+
/**
|
|
668
|
+
* Who recorded the delivery time: the "driver" or "courier" (Dunback's clock,
|
|
669
|
+
* with a photo and location), or the "restaurant" (from the courier's proof
|
|
670
|
+
* of delivery, when the courier didn't record it). Show it with the time.
|
|
671
|
+
*/
|
|
672
|
+
timeRecordedBy: "driver" | "courier" | "restaurant" | null;
|
|
673
|
+
hostConfirmedAt: string | null;
|
|
674
|
+
problemReport: {
|
|
675
|
+
type: DeliveryProblemType;
|
|
676
|
+
label: string;
|
|
677
|
+
description: string;
|
|
678
|
+
reportedAt: string;
|
|
679
|
+
wantsRefund: boolean;
|
|
680
|
+
photoCount: number;
|
|
681
|
+
} | null;
|
|
682
|
+
/** 48 hours after delivery. */
|
|
683
|
+
problemReportableUntil: string | null;
|
|
684
|
+
canConfirm: boolean;
|
|
685
|
+
canReportProblem: boolean;
|
|
686
|
+
}
|
|
687
|
+
type DeliveryProblemType = "MISSING_ITEMS" | "DAMAGED" | "WRONG_ORDER" | "NO_SETUP" | "CONDUCT" | "LATE" | "NOT_RECEIVED" | "OTHER";
|
|
688
|
+
/**
|
|
689
|
+
* orders.reportProblem(): anything wrong with a delivery, within 48 hours of
|
|
690
|
+
* it. The restaurant is told at once. With `wantsRefund`, Dunback reviews the
|
|
691
|
+
* report against its records of the delivery and decides the refund (0 up to
|
|
692
|
+
* the restaurant's part; Dunback's fees aren't refunded): webhook
|
|
693
|
+
* `order.refund_decided` (basis "delivery_problem", or "late_delivery" for a
|
|
694
|
+
* LATE report of a delivery recorded as late).
|
|
695
|
+
*/
|
|
696
|
+
interface ProblemReportInput {
|
|
697
|
+
/** Which delivery (order.deliveries[].restaurantOrderId); default: every reportable one. */
|
|
698
|
+
restaurantOrderId?: string;
|
|
699
|
+
type: DeliveryProblemType;
|
|
700
|
+
/** What happened, in the host's words (10 to 2000 characters). */
|
|
701
|
+
description: string;
|
|
702
|
+
wantsRefund?: boolean;
|
|
703
|
+
/** Up to 3 photos, 5 MB each, base64 without the data: prefix. */
|
|
704
|
+
photos?: Array<{
|
|
705
|
+
contentType: "image/jpeg" | "image/png" | "image/webp";
|
|
706
|
+
data: string;
|
|
707
|
+
}>;
|
|
708
|
+
}
|
|
709
|
+
/** 202 from orders.reportProblem(). */
|
|
710
|
+
interface ProblemReport {
|
|
711
|
+
object: "problem_report";
|
|
712
|
+
orderId: string;
|
|
713
|
+
reportedAt: string;
|
|
714
|
+
reports: Array<{
|
|
715
|
+
restaurantOrderId: string;
|
|
716
|
+
type: DeliveryProblemType;
|
|
717
|
+
refundRequested: boolean;
|
|
718
|
+
refundBasis: "delivery_problem" | "late_delivery" | null;
|
|
719
|
+
/** The most the refund can be: the restaurant's part of that delivery. */
|
|
720
|
+
maximum: number | null;
|
|
721
|
+
}>;
|
|
722
|
+
order: Order;
|
|
723
|
+
}
|
|
724
|
+
/** `data` of `order.delivered`: the order, and which deliveries were just recorded. */
|
|
725
|
+
interface DeliveredData extends Order {
|
|
726
|
+
deliveredNow: string[];
|
|
727
|
+
/** How long the host can confirm or report a problem (48). */
|
|
728
|
+
problemReportHours: number;
|
|
729
|
+
}
|
|
582
730
|
/** `data` of `order.delivered_late`: the order, and which deliveries were late. */
|
|
583
731
|
interface DeliveredLateData extends Order {
|
|
584
732
|
lateDeliveries: Array<{
|
|
@@ -601,8 +749,8 @@ interface CancelOrderOptions {
|
|
|
601
749
|
interface RefundDecidedData extends Order {
|
|
602
750
|
refundDecision: {
|
|
603
751
|
restaurantOrderId: string;
|
|
604
|
-
/** Why the refund was decided: a cancellation after the commitment deadline, or a
|
|
605
|
-
basis: "cancelled_after_commitment" | "late_delivery";
|
|
752
|
+
/** Why the refund was decided: a cancellation after the commitment deadline, a late delivery, or a reported delivery problem. */
|
|
753
|
+
basis: "cancelled_after_commitment" | "late_delivery" | "delivery_problem";
|
|
606
754
|
percentage: number;
|
|
607
755
|
amount: number;
|
|
608
756
|
explanation: string;
|
|
@@ -630,7 +778,7 @@ interface OrderRevision {
|
|
|
630
778
|
reason: string;
|
|
631
779
|
}>;
|
|
632
780
|
}
|
|
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";
|
|
781
|
+
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" | "order.delivered_late" | "order.delivery_updated" | "order.revised" | "ping";
|
|
634
782
|
/** `data` of a `ping` event, sent by "Send test event" in the Developer Dashboard. */
|
|
635
783
|
interface PingData {
|
|
636
784
|
object: "ping";
|
|
@@ -680,7 +828,7 @@ interface DunbackEventSettings {
|
|
|
680
828
|
* a cuisine picker: the restaurant settles it, and all options come from it.
|
|
681
829
|
*/
|
|
682
830
|
restaurantName?: string;
|
|
683
|
-
/** Required when no restaurantName is set, unless drinksOnly. */
|
|
831
|
+
/** Required when no restaurantName is set, unless drinksOnly, dishPreferences or mealType "breakfast". */
|
|
684
832
|
cuisine?: CuisineId;
|
|
685
833
|
/**
|
|
686
834
|
* Drinks only, no food (coffee for a morning meetup, boba for a study
|
|
@@ -697,7 +845,19 @@ interface DunbackEventSettings {
|
|
|
697
845
|
serviceStyle?: CateringServiceStyle;
|
|
698
846
|
/** Food catering: also one drink per guest. Default true. */
|
|
699
847
|
includeDrinks?: boolean;
|
|
848
|
+
/** Soft: options above it are flagged withinBudget: false. */
|
|
700
849
|
budgetPerGuest?: number;
|
|
850
|
+
/** Hard budget (USD): options above it aren't offered (see CateringRequestInput.maxTotal). */
|
|
851
|
+
maxTotal?: number;
|
|
852
|
+
maxPerGuest?: number;
|
|
853
|
+
/** Dishes the host wants: "sushi", "seafood", "pastries", "bagels"... */
|
|
854
|
+
dishPreferences?: string[];
|
|
855
|
+
/** "breakfast" for breakfast food (pastries, bagels, eggs...) whatever the time. */
|
|
856
|
+
mealType?: CateringMealType;
|
|
857
|
+
/** About this share (0..1) of the main servings spicy; 0 = nothing spicy. */
|
|
858
|
+
spicyShare?: number;
|
|
859
|
+
/** Diets every guest's food must fit, e.g. ["vegetarian"]. */
|
|
860
|
+
partyDiet?: PartyDiet[];
|
|
701
861
|
/**
|
|
702
862
|
* The host's estimate of how many guests will attend (or the event's
|
|
703
863
|
* capacity). Pass it to listCuisines(venue, { guests }) so only cuisines
|
|
@@ -829,4 +989,4 @@ declare function canOrderFood(settings: DunbackEventSettings | null | undefined,
|
|
|
829
989
|
reason?: string;
|
|
830
990
|
};
|
|
831
991
|
|
|
832
|
-
export {
|
|
992
|
+
export { type UsdcPaymentInstructions as $, type AppInfo as A, type BuildCateringRequestArgs as B, type CuisineQuery as C, type DrinkType as D, type LumaEventLike as E, type LumaGuestLike as F, type OrderCancellation as G, type OrderDelivery as H, type OrderRevision as I, type OrderStatus as J, type PartyDiet as K, type LateRefundRequestInput as L, type PingData as M, type Price as N, type Order as O, type ProblemReportInput as P, type PriceLine as Q, type RestaurantSummary as R, type SelectOptionInput as S, type RefundDecidedData as T, type UpdateDeliveryInput as U, type VenueLocation as V, type WebhookEvent as W, type StandardCuisineId as X, type UnavailableReason as Y, type UnavailableReasonCode as Z, type UnfedGuests as _, type Cuisine as a, type WebhookEventType as a0, buildCateringRequest as a1, canOrderFood as a2, guestsWithUnsharedAllergies as a3, toDunbackAddress as a4, toDunbackAttendees as a5, toVenueLocation as a6, type CuisineCatalog as b, type CateringRequestInput as c, type CateringRequest as d, type CancelOrderOptions as e, type LateRefundRequest as f, type ProblemReport as g, ATTENDING_STATUSES as h, type Address as i, type AllergyCoverage as j, type Attendee as k, type CateringBudgetResult as l, type CateringItem as m, type CateringMealType as n, type CateringOption as o, type CateringPolicies as p, type CateringRequestStatus as q, type CateringServiceStyle as r, type CuisineId as s, type CustomCuisineId as t, DUNBACK_REGISTRATION_QUESTION as u, type DeliveredData as v, type DeliveredLateData as w, type DeliveryProblemType as x, type DrinkTypeId as y, type DunbackEventSettings as z };
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { o as CateringOption, a as Cuisine, z as DunbackEventSettings, R as RestaurantSummary, D as DrinkType, O as Order, N as Price } from '../luma-BwA6aHtI.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Optional, unstyled-by-default React building blocks for the three Luma
|