@fire-spark/types 0.0.1
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 +527 -0
- package/dist/index.js +0 -0
- package/package.json +58 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,527 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/common.d.ts
|
|
3
|
+
type MultiLanguageText = Record<string, string>;
|
|
4
|
+
type Metadata = Record<string, unknown>;
|
|
5
|
+
type ModifierControlType = "RADIO" | "CHECKBOX" | "QUANTITY";
|
|
6
|
+
type GroupDisplayType = "GRID" | "LIST";
|
|
7
|
+
type DayOfWeek = "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday" | "sunday";
|
|
8
|
+
interface SchedulePeriod {
|
|
9
|
+
closed?: boolean;
|
|
10
|
+
start_time?: string;
|
|
11
|
+
end_time?: string;
|
|
12
|
+
start_date?: string | null;
|
|
13
|
+
end_date?: string | null;
|
|
14
|
+
}
|
|
15
|
+
interface ScheduleDay {
|
|
16
|
+
day_of_week: DayOfWeek;
|
|
17
|
+
periods: SchedulePeriod[];
|
|
18
|
+
}
|
|
19
|
+
type Schedule = ScheduleDay[];
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/category.d.ts
|
|
22
|
+
interface CategoryItem {
|
|
23
|
+
type: "CATEGORY" | "PRODUCT";
|
|
24
|
+
id: string;
|
|
25
|
+
}
|
|
26
|
+
interface CategoryAvailability {
|
|
27
|
+
status: "ACTIVE" | "INACTIVE" | "HIDDEN";
|
|
28
|
+
schedules?: Schedule | null;
|
|
29
|
+
inactive_until?: string | null;
|
|
30
|
+
}
|
|
31
|
+
interface Category {
|
|
32
|
+
id: string;
|
|
33
|
+
name: MultiLanguageText;
|
|
34
|
+
description?: MultiLanguageText | null;
|
|
35
|
+
image_url: string | null;
|
|
36
|
+
items: CategoryItem[];
|
|
37
|
+
availability: CategoryAvailability;
|
|
38
|
+
metadata?: Metadata;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/customer.d.ts
|
|
42
|
+
type Storefront$4 = (typeof import("@repo/validations").vCustomers)["storefront"];
|
|
43
|
+
type Customers = typeof import("@repo/validations").vCustomers;
|
|
44
|
+
/** Storefront customer (`GET` / `POST` / identify response `data`). */
|
|
45
|
+
type Customer = z.infer<ReturnType<Storefront$4["dto"]>>;
|
|
46
|
+
/** Saved delivery address on the customer profile. */
|
|
47
|
+
type DeliveryAddress = z.infer<ReturnType<Customers["deliveryAddress"]>>;
|
|
48
|
+
/** Saved billing profile on the customer profile. */
|
|
49
|
+
type BillingProfile = z.infer<ReturnType<Customers["billingProfile"]>>;
|
|
50
|
+
/** Saved payment method on the customer profile (vaulted metadata only). */
|
|
51
|
+
type Payment = z.infer<ReturnType<Customers["payment"]>>;
|
|
52
|
+
/** `POST /storefront/v1/customers` body (pre-defaults). */
|
|
53
|
+
type CustomerRegisterInput = z.input<ReturnType<Storefront$4["insert"]>>;
|
|
54
|
+
/** `PATCH /storefront/v1/customers/{id}/identify/anonymous` body. */
|
|
55
|
+
type CustomerIdentifyInput = z.input<ReturnType<Storefront$4["identify"]>>;
|
|
56
|
+
/** `PATCH /storefront/v1/customers/{id}` body. */
|
|
57
|
+
type CustomerUpdateInput = z.input<ReturnType<Storefront$4["update"]>>;
|
|
58
|
+
type CustomerGender = NonNullable<Customer["gender"]>;
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region src/cms.d.ts
|
|
61
|
+
type VCmsBlocks = typeof import("@repo/validations").vCmsBlocks;
|
|
62
|
+
type StorefrontDto$2 = ReturnType<VCmsBlocks["storefront"]["dto"]>;
|
|
63
|
+
/** Storefront CMS block (`GET /storefront/v1/cms/blocks/:name` `data`). */
|
|
64
|
+
type CmsBlock = z.infer<StorefrontDto$2>;
|
|
65
|
+
/** Top-level item on a storefront CMS block. */
|
|
66
|
+
type CmsBlockItem = CmsBlock["items"][number];
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/fulfillment.d.ts
|
|
69
|
+
type VFulfillment = typeof import("@repo/validations").vFulfillment;
|
|
70
|
+
type StorefrontDto$1 = ReturnType<VFulfillment["storefront"]["dto"]>;
|
|
71
|
+
/** Storefront fulfillment (`GET /storefront/v1/fulfillment` `data[]`). */
|
|
72
|
+
type Fulfillment = z.infer<StorefrontDto$1>;
|
|
73
|
+
/** Query filters for storefront fulfillment list/get. */
|
|
74
|
+
interface FulfillmentListInput {
|
|
75
|
+
channel_id?: string;
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/store.d.ts
|
|
79
|
+
type VStores = typeof import("@repo/validations").vStores;
|
|
80
|
+
type StorefrontDto = ReturnType<VStores["storefront"]["dto"]>;
|
|
81
|
+
/** Storefront store (`GET /storefront/v1/stores` `data[]`). */
|
|
82
|
+
type Store = z.infer<StorefrontDto>;
|
|
83
|
+
/** Query filters for `GET /storefront/v1/stores`. */
|
|
84
|
+
interface StoreListInput {
|
|
85
|
+
limit?: number;
|
|
86
|
+
cursor?: string;
|
|
87
|
+
brand_id?: string;
|
|
88
|
+
}
|
|
89
|
+
/** Query for `GET /storefront/v1/stores/nearby` (closest first). */
|
|
90
|
+
interface StoreNearbyInput {
|
|
91
|
+
latitude: number;
|
|
92
|
+
longitude: number;
|
|
93
|
+
limit?: number;
|
|
94
|
+
brand_id?: string;
|
|
95
|
+
}
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region src/order-fulfillment.d.ts
|
|
98
|
+
type OrderFulfillments = typeof import("@repo/validations").vOrderFulfillments;
|
|
99
|
+
/** Storefront order fulfillment (`GET /orders/{id}/fulfillment` or list `data`). */
|
|
100
|
+
type OrderFulfillment = z.infer<ReturnType<OrderFulfillments["storefront"]["dto"]>>;
|
|
101
|
+
/** `POST /orders/{id}/place` success `data`. */
|
|
102
|
+
type PlaceOrderResult = z.infer<ReturnType<OrderFulfillments["storefront"]["place"]["output"]>>["data"];
|
|
103
|
+
//#endregion
|
|
104
|
+
//#region src/payments.d.ts
|
|
105
|
+
type Payments = typeof import("@repo/validations").vPayments;
|
|
106
|
+
/** Merchant payment method (`GET /storefront/v1/payments` `data[]`). */
|
|
107
|
+
type MerchantPayment = z.infer<ReturnType<Payments["storefront"]["listDto"]>>;
|
|
108
|
+
type StorefrontPaymentsListInput = z.input<ReturnType<Payments["storefront"]["list"]["input"]>>;
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region src/modifier-group.d.ts
|
|
111
|
+
interface ModifierGroup {
|
|
112
|
+
id: string;
|
|
113
|
+
title: MultiLanguageText;
|
|
114
|
+
description?: MultiLanguageText | null;
|
|
115
|
+
display_type?: GroupDisplayType | null;
|
|
116
|
+
modifier_ids: string[];
|
|
117
|
+
minimum_quantity: number;
|
|
118
|
+
maximum_quantity: number;
|
|
119
|
+
charge_above_quantity?: number | null;
|
|
120
|
+
metadata?: Metadata;
|
|
121
|
+
}
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region src/product.d.ts
|
|
124
|
+
interface BundledItem {
|
|
125
|
+
id: string;
|
|
126
|
+
refund_price: number;
|
|
127
|
+
included_quantity: number;
|
|
128
|
+
}
|
|
129
|
+
interface ProductAvailability {
|
|
130
|
+
status: "AVAILABLE" | "HIDDEN" | "OUT_OF_STOCK";
|
|
131
|
+
schedules?: Schedule | null;
|
|
132
|
+
out_of_stock_until?: string | null;
|
|
133
|
+
}
|
|
134
|
+
interface PricingModifier {
|
|
135
|
+
modifier_group_id: string;
|
|
136
|
+
minimum_quantity: number;
|
|
137
|
+
maximum_quantity?: number;
|
|
138
|
+
default_quantity: number;
|
|
139
|
+
price: number;
|
|
140
|
+
is_tax_inclusive: boolean;
|
|
141
|
+
tax_rate: number;
|
|
142
|
+
anchor_price?: number;
|
|
143
|
+
anchor_price_percentage?: number;
|
|
144
|
+
charge_above_quantity?: number | null;
|
|
145
|
+
display_type?: ModifierControlType | null;
|
|
146
|
+
}
|
|
147
|
+
interface ProductRecommendationLink {
|
|
148
|
+
recommendation_id: string;
|
|
149
|
+
default_quantity?: number;
|
|
150
|
+
}
|
|
151
|
+
interface ProductPricing {
|
|
152
|
+
minimum_quantity: number;
|
|
153
|
+
maximum_quantity: number;
|
|
154
|
+
is_tax_inclusive: boolean;
|
|
155
|
+
tax_rate: number;
|
|
156
|
+
price: number;
|
|
157
|
+
anchor_price?: number;
|
|
158
|
+
anchor_price_percentage?: number;
|
|
159
|
+
modifier_group_ids: string[];
|
|
160
|
+
modifiers: PricingModifier[];
|
|
161
|
+
recommendations?: ProductRecommendationLink[];
|
|
162
|
+
recommendations_ids?: string[];
|
|
163
|
+
}
|
|
164
|
+
interface Product {
|
|
165
|
+
id: string;
|
|
166
|
+
name: MultiLanguageText;
|
|
167
|
+
description?: MultiLanguageText | null;
|
|
168
|
+
image_url?: string | null;
|
|
169
|
+
status: "ACTIVE" | "INACTIVE";
|
|
170
|
+
bundled_items: BundledItem[];
|
|
171
|
+
pricing: ProductPricing;
|
|
172
|
+
availability: ProductAvailability;
|
|
173
|
+
metadata?: Metadata;
|
|
174
|
+
}
|
|
175
|
+
//#endregion
|
|
176
|
+
//#region src/recommendation.d.ts
|
|
177
|
+
type Recommendation = {
|
|
178
|
+
id: string;
|
|
179
|
+
title: MultiLanguageText;
|
|
180
|
+
description?: MultiLanguageText | null;
|
|
181
|
+
metadata?: Metadata;
|
|
182
|
+
target_product_id: string;
|
|
183
|
+
type: "UPSELL" | "CROSS_SELL" | "DOWNSELL";
|
|
184
|
+
};
|
|
185
|
+
//#endregion
|
|
186
|
+
//#region src/menu.d.ts
|
|
187
|
+
interface Menu {
|
|
188
|
+
id: string;
|
|
189
|
+
name: MultiLanguageText;
|
|
190
|
+
description?: MultiLanguageText | null;
|
|
191
|
+
products: Product[];
|
|
192
|
+
categories: Category[];
|
|
193
|
+
modifier_groups: ModifierGroup[];
|
|
194
|
+
recommendations?: Recommendation[];
|
|
195
|
+
schedules?: Schedule | null;
|
|
196
|
+
metadata?: Metadata;
|
|
197
|
+
}
|
|
198
|
+
interface MenuLookup {
|
|
199
|
+
productsById: Record<string, Product>;
|
|
200
|
+
modifierGroupsById: Record<string, ModifierGroup>;
|
|
201
|
+
categoriesById?: Record<string, Category>;
|
|
202
|
+
recommendationsById: Record<string, Recommendation>;
|
|
203
|
+
}
|
|
204
|
+
//#endregion
|
|
205
|
+
//#region src/storefront-availability.d.ts
|
|
206
|
+
type Storefront$3 = typeof import("@repo/validations").vStorefront;
|
|
207
|
+
/** Query scope accepted by resolved preference endpoints. */
|
|
208
|
+
type StorefrontAvailabilityInput = z.input<ReturnType<Storefront$3["preferences"]["input"]>>;
|
|
209
|
+
/** Availability slice of `GET /storefront/v1/preferences`. */
|
|
210
|
+
type StorefrontAvailability = z.infer<ReturnType<Storefront$3["availability"]["output"]>>;
|
|
211
|
+
type StorefrontAvailabilityRule = Extract<StorefrontAvailability, {
|
|
212
|
+
status: "UNAVAILABLE";
|
|
213
|
+
}>["rule"];
|
|
214
|
+
//#endregion
|
|
215
|
+
//#region src/storefront-preferences.d.ts
|
|
216
|
+
type Storefront$2 = typeof import("@repo/validations").vStorefront;
|
|
217
|
+
/** Query scope accepted by `GET /storefront/v1/preferences`. */
|
|
218
|
+
type StorefrontPreferencesInput = z.input<ReturnType<Storefront$2["preferences"]["input"]>>;
|
|
219
|
+
/** Resolved merchant preferences (`GET /storefront/v1/preferences` `data`). */
|
|
220
|
+
type StorefrontPreferences = z.infer<ReturnType<Storefront$2["preferences"]["output"]>>;
|
|
221
|
+
//#endregion
|
|
222
|
+
//#region src/storefront-menu.d.ts
|
|
223
|
+
type Menus = typeof import("@repo/validations").vMenus;
|
|
224
|
+
/** Storefront menu list item (`GET /storefront/v1/menus` `data[]`). */
|
|
225
|
+
type StorefrontMenu = z.infer<ReturnType<Menus["storefront"]["dto"]>>;
|
|
226
|
+
/** Query scope for storefront menu list. */
|
|
227
|
+
type StorefrontMenuScope = z.input<ReturnType<Menus["storefront"]["get"]["input"]>>;
|
|
228
|
+
/** Optional fold limits for `GET /storefront/v1/menus?streaming=true`. */
|
|
229
|
+
type StorefrontMenuStreamOptions = Omit<z.input<ReturnType<Menus["storefront"]["get"]["stream"]>>, "streaming">;
|
|
230
|
+
//#endregion
|
|
231
|
+
//#region src/storefront-realtime.d.ts
|
|
232
|
+
type Storefront$1 = typeof import("@repo/validations").vStorefront;
|
|
233
|
+
/** Query scope accepted by `POST /storefront/v1/realtime/token`. */
|
|
234
|
+
type StorefrontRealtimeTokenInput = z.input<ReturnType<Storefront$1["realtime"]["token"]["input"]>>;
|
|
235
|
+
/** Token payload (`POST /storefront/v1/realtime/token` `data`). */
|
|
236
|
+
type StorefrontRealtimeToken = z.infer<ReturnType<Storefront$1["realtime"]["token"]["output"]>>;
|
|
237
|
+
/** Broadcast payload for `menu.changed`. */
|
|
238
|
+
interface StorefrontMenuChangedPayload {
|
|
239
|
+
fulfillment_id?: string;
|
|
240
|
+
store_id?: string;
|
|
241
|
+
channel_id?: string;
|
|
242
|
+
brand_id?: string;
|
|
243
|
+
}
|
|
244
|
+
/** Broadcast payload for `availability.changed`. */
|
|
245
|
+
interface StorefrontAvailabilityChangedPayload {
|
|
246
|
+
merchant_id?: string;
|
|
247
|
+
}
|
|
248
|
+
/** Broadcast payload for `payments.changed` and `fulfillments.changed`. */
|
|
249
|
+
interface StorefrontWorkspaceChangedPayload {
|
|
250
|
+
merchant_id?: string;
|
|
251
|
+
}
|
|
252
|
+
/** Broadcast payload for `cms.changed` (per-block topic). */
|
|
253
|
+
interface StorefrontCmsChangedPayload {
|
|
254
|
+
name: string;
|
|
255
|
+
}
|
|
256
|
+
type OrderChangedCheckoutState = "pending" | "released" | "failed";
|
|
257
|
+
type OrderChangedRunStatus = "PROCESSING" | "WAITING" | "SUCCESS" | "FAILED";
|
|
258
|
+
interface OrderChangedCallbackError {
|
|
259
|
+
attempt: number;
|
|
260
|
+
at: string;
|
|
261
|
+
message: string;
|
|
262
|
+
status?: number;
|
|
263
|
+
body?: unknown;
|
|
264
|
+
}
|
|
265
|
+
interface OrderChangedCallback {
|
|
266
|
+
node_id: string;
|
|
267
|
+
status: string;
|
|
268
|
+
ok: boolean;
|
|
269
|
+
attempt: number;
|
|
270
|
+
response?: unknown;
|
|
271
|
+
errors: OrderChangedCallbackError[];
|
|
272
|
+
started_at?: string;
|
|
273
|
+
finished_at?: string;
|
|
274
|
+
duration_ms?: number;
|
|
275
|
+
}
|
|
276
|
+
interface OrderChangedError {
|
|
277
|
+
node_id?: string;
|
|
278
|
+
status?: string;
|
|
279
|
+
message: string;
|
|
280
|
+
}
|
|
281
|
+
/** Broadcast payload for `order.changed` (and snapshot mapped to this shape). */
|
|
282
|
+
interface OrderChangedPayload {
|
|
283
|
+
order_id: string;
|
|
284
|
+
order_fulfillment_id: string;
|
|
285
|
+
customer_id: string;
|
|
286
|
+
status: string;
|
|
287
|
+
payment_status: string;
|
|
288
|
+
current_states: string[];
|
|
289
|
+
run_status: OrderChangedRunStatus;
|
|
290
|
+
checkout_state: OrderChangedCheckoutState;
|
|
291
|
+
entered_node_ids: string[];
|
|
292
|
+
callbacks: OrderChangedCallback[];
|
|
293
|
+
error: OrderChangedError | null;
|
|
294
|
+
emitted_at: string;
|
|
295
|
+
}
|
|
296
|
+
//#endregion
|
|
297
|
+
//#region src/kiosk.d.ts
|
|
298
|
+
type KioskPagerSide = "LEFT" | "RIGHT";
|
|
299
|
+
interface KioskPagersSettings {
|
|
300
|
+
enabled: boolean;
|
|
301
|
+
/** When false, customers can skip taking a pager. */
|
|
302
|
+
required: boolean;
|
|
303
|
+
side: KioskPagerSide;
|
|
304
|
+
/** Payment ids that use pagers; null means every payment. */
|
|
305
|
+
payment_ids: string[] | null;
|
|
306
|
+
range_start: number;
|
|
307
|
+
range_end: number;
|
|
308
|
+
}
|
|
309
|
+
/** Missing keys inherit the channel value. */
|
|
310
|
+
type KioskPagersOverrides = Partial<KioskPagersSettings>;
|
|
311
|
+
interface KioskOrderPager {
|
|
312
|
+
number: string;
|
|
313
|
+
side: KioskPagerSide;
|
|
314
|
+
}
|
|
315
|
+
interface KioskDeviceOverrides {
|
|
316
|
+
disabled_payment_ids: string[];
|
|
317
|
+
pagers?: KioskPagersOverrides;
|
|
318
|
+
}
|
|
319
|
+
interface KioskDeviceConfigDevice {
|
|
320
|
+
uid: string;
|
|
321
|
+
id: string;
|
|
322
|
+
alias: string;
|
|
323
|
+
}
|
|
324
|
+
interface KioskDeviceConfigScope {
|
|
325
|
+
store_id: string | null;
|
|
326
|
+
channel_id: string;
|
|
327
|
+
}
|
|
328
|
+
type KioskAdminGesture = "TAP_3_ONE_FINGER" | "TAP_3_TWO_FINGERS" | "TAP_2_THREE_FINGERS";
|
|
329
|
+
interface KioskDeviceConfigSettings {
|
|
330
|
+
idle_timeout_seconds: number;
|
|
331
|
+
idle_warning_seconds: number;
|
|
332
|
+
offline_after_minutes: number;
|
|
333
|
+
/** Missing on servers older than the admin screen. */
|
|
334
|
+
admin_gesture?: KioskAdminGesture;
|
|
335
|
+
/** Channel pager settings; missing on servers without pagers. */
|
|
336
|
+
pagers?: KioskPagersSettings;
|
|
337
|
+
}
|
|
338
|
+
interface KioskDeviceConfigPayment {
|
|
339
|
+
id: string;
|
|
340
|
+
name?: string;
|
|
341
|
+
method?: {
|
|
342
|
+
id: string;
|
|
343
|
+
name: string;
|
|
344
|
+
method: string;
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
interface KioskDeviceConfig {
|
|
348
|
+
device: KioskDeviceConfigDevice;
|
|
349
|
+
scope: KioskDeviceConfigScope;
|
|
350
|
+
settings: KioskDeviceConfigSettings;
|
|
351
|
+
overrides: KioskDeviceOverrides;
|
|
352
|
+
payments: KioskDeviceConfigPayment[];
|
|
353
|
+
}
|
|
354
|
+
interface KioskConfigChangedPayload {
|
|
355
|
+
device_uid: string;
|
|
356
|
+
}
|
|
357
|
+
type KioskCommandType = "refresh_cache" | "unlink" | "reload" | "check_ota";
|
|
358
|
+
interface KioskCommandPayload {
|
|
359
|
+
type: KioskCommandType;
|
|
360
|
+
device_uid?: string;
|
|
361
|
+
}
|
|
362
|
+
interface KioskRealtimeToken {
|
|
363
|
+
access_token: string;
|
|
364
|
+
expires_in: number;
|
|
365
|
+
url: string;
|
|
366
|
+
key: string;
|
|
367
|
+
topic: string;
|
|
368
|
+
workspace_topic: string;
|
|
369
|
+
}
|
|
370
|
+
type KioskAppState = "active" | "background";
|
|
371
|
+
interface KioskHeartbeatHealth {
|
|
372
|
+
battery_pct?: number | null;
|
|
373
|
+
charging?: boolean | null;
|
|
374
|
+
storage_free_bytes?: number | null;
|
|
375
|
+
storage_total_bytes?: number | null;
|
|
376
|
+
network?: Record<string, unknown> | null;
|
|
377
|
+
app_state?: KioskAppState | null;
|
|
378
|
+
}
|
|
379
|
+
interface KioskHeartbeatInput {
|
|
380
|
+
device_uid: string;
|
|
381
|
+
device_secret: string;
|
|
382
|
+
app_version_code: number;
|
|
383
|
+
app_version_name: string;
|
|
384
|
+
expo_update_id?: string | null;
|
|
385
|
+
ota_pending?: boolean;
|
|
386
|
+
health?: KioskHeartbeatHealth;
|
|
387
|
+
}
|
|
388
|
+
interface KioskHeartbeatResult {
|
|
389
|
+
ok: boolean;
|
|
390
|
+
idle_timeout_seconds: number;
|
|
391
|
+
idle_warning_seconds: number;
|
|
392
|
+
offline_after_minutes: number;
|
|
393
|
+
admin_gesture?: KioskAdminGesture;
|
|
394
|
+
}
|
|
395
|
+
interface KioskHealthSample {
|
|
396
|
+
id: string;
|
|
397
|
+
reported_at: string;
|
|
398
|
+
health: KioskHeartbeatHealth;
|
|
399
|
+
}
|
|
400
|
+
interface KioskHealthBatchInput {
|
|
401
|
+
device_uid: string;
|
|
402
|
+
device_secret: string;
|
|
403
|
+
sent_at: string;
|
|
404
|
+
samples: KioskHealthSample[];
|
|
405
|
+
}
|
|
406
|
+
interface KioskHealthBatchResult {
|
|
407
|
+
ok: boolean;
|
|
408
|
+
accepted: number;
|
|
409
|
+
skipped: number;
|
|
410
|
+
}
|
|
411
|
+
//#endregion
|
|
412
|
+
//#region src/order.d.ts
|
|
413
|
+
type Orders = typeof import("@repo/validations").vOrders;
|
|
414
|
+
/** Persisted order line money + identity shape. */
|
|
415
|
+
type OrderLine = z.infer<ReturnType<Orders["orderLine"]>>;
|
|
416
|
+
/** Order money totals. */
|
|
417
|
+
type OrderTotals = z.infer<ReturnType<Orders["orderTotals"]>>;
|
|
418
|
+
type Storefront = Orders["storefront"];
|
|
419
|
+
/** Storefront order (`GET` / `POST` / `PATCH` response `data`). */
|
|
420
|
+
type Order = z.infer<ReturnType<Storefront["dto"]>>;
|
|
421
|
+
/** Customer delivery address without alias/preferred. */
|
|
422
|
+
type AddressInfo = z.infer<ReturnType<Orders["addressInfo"]>>;
|
|
423
|
+
/** Customer billing profile without alias/preferred. */
|
|
424
|
+
type BillingInfo = z.infer<ReturnType<Orders["billingInfo"]>>;
|
|
425
|
+
/** Payment method enum on order payment intents. */
|
|
426
|
+
type PaymentMethod = z.infer<ReturnType<Orders["paymentMethod"]>>;
|
|
427
|
+
/** Payment provider enum on order payment intents. */
|
|
428
|
+
type PaymentProvider = z.infer<ReturnType<Orders["paymentProvider"]>>;
|
|
429
|
+
/** A recorded payment intent on an order. */
|
|
430
|
+
type PaymentIntent = z.infer<ReturnType<Orders["paymentIntent"]>>;
|
|
431
|
+
/** Input shape for `placeOrder` `payment.intents` (`metadata` optional). */
|
|
432
|
+
type PaymentIntentInput = z.input<ReturnType<Orders["paymentIntent"]>>;
|
|
433
|
+
/** `POST /storefront/v1/orders` body. */
|
|
434
|
+
type OrderInsertInput = z.input<ReturnType<Storefront["insert"]>>;
|
|
435
|
+
/** `PATCH /storefront/v1/orders/{id}` body. */
|
|
436
|
+
type OrderUpdateInput = z.input<ReturnType<Storefront["update"]>>;
|
|
437
|
+
/** `GET /storefront/v1/orders` query. */
|
|
438
|
+
type OrderListInput = z.input<ReturnType<Storefront["list"]["input"]>>;
|
|
439
|
+
/** `POST /storefront/v1/orders/validate` body. */
|
|
440
|
+
type OrderValidateInput = z.input<ReturnType<Storefront["validate"]["input"]>>;
|
|
441
|
+
/** `POST /storefront/v1/orders/validate` success `data`. */
|
|
442
|
+
type OrderValidateOutput = z.infer<ReturnType<Storefront["validate"]["output"]>>["data"];
|
|
443
|
+
/** `POST /storefront/v1/orders/{id}/reorder` body. */
|
|
444
|
+
type OrderReorderInput = z.input<ReturnType<Storefront["reorder"]["input"]>>;
|
|
445
|
+
//#endregion
|
|
446
|
+
//#region src/rules.d.ts
|
|
447
|
+
type Validations = typeof import("@repo/validations");
|
|
448
|
+
type Common = Validations["vCommon"];
|
|
449
|
+
type Condition = z.infer<ReturnType<Validations["vCondition"]["single"]>>;
|
|
450
|
+
type AndConditions = z.infer<ReturnType<Validations["vCondition"]["and"]>>;
|
|
451
|
+
type OrConditions = z.infer<ReturnType<Validations["vCondition"]["or"]>>;
|
|
452
|
+
type RuleInterpretation = "client" | "server" | "both";
|
|
453
|
+
type RulesEngineRuntime = "client" | "server";
|
|
454
|
+
interface StringMatchCaseOptions {
|
|
455
|
+
caseInsensitive?: boolean;
|
|
456
|
+
}
|
|
457
|
+
interface RulesEngineOrderLine {
|
|
458
|
+
id: string;
|
|
459
|
+
quantity: number;
|
|
460
|
+
parent_uid?: string | null;
|
|
461
|
+
type?: string;
|
|
462
|
+
tags?: Record<string, boolean | string | number>;
|
|
463
|
+
}
|
|
464
|
+
interface MatchableRule {
|
|
465
|
+
conditions?: OrConditions | null;
|
|
466
|
+
interpretation?: RuleInterpretation;
|
|
467
|
+
}
|
|
468
|
+
interface RulesEngineOrder {
|
|
469
|
+
total: number;
|
|
470
|
+
is_anonymous: boolean;
|
|
471
|
+
fulfillment_id?: string;
|
|
472
|
+
store_id?: string;
|
|
473
|
+
channel_id?: string;
|
|
474
|
+
brand_id?: string;
|
|
475
|
+
lines?: RulesEngineOrderLine[];
|
|
476
|
+
}
|
|
477
|
+
interface RulesEngineMonitoring {
|
|
478
|
+
event_type: string;
|
|
479
|
+
http_status?: number;
|
|
480
|
+
path?: string;
|
|
481
|
+
method?: string;
|
|
482
|
+
source?: string;
|
|
483
|
+
message?: string;
|
|
484
|
+
event_counts: Record<number, number>;
|
|
485
|
+
error_rates: Record<number, number>;
|
|
486
|
+
}
|
|
487
|
+
interface RulesEngineParams {
|
|
488
|
+
order?: RulesEngineOrder;
|
|
489
|
+
customer?: {
|
|
490
|
+
is_anonymous?: boolean;
|
|
491
|
+
};
|
|
492
|
+
payment?: {
|
|
493
|
+
collect_at?: string;
|
|
494
|
+
method?: string;
|
|
495
|
+
status?: string;
|
|
496
|
+
};
|
|
497
|
+
monitoring?: RulesEngineMonitoring;
|
|
498
|
+
referenceDate?: string;
|
|
499
|
+
runtime?: RulesEngineRuntime;
|
|
500
|
+
}
|
|
501
|
+
type MatchResult<T> = {
|
|
502
|
+
match: T;
|
|
503
|
+
error: null;
|
|
504
|
+
} | {
|
|
505
|
+
match: null;
|
|
506
|
+
error: string;
|
|
507
|
+
};
|
|
508
|
+
type RecurringDateCronRepeat = z.infer<ReturnType<Common["recurringDateCron"]["repeat"]>>;
|
|
509
|
+
interface RecurringDateCronValues {
|
|
510
|
+
startDate: Date;
|
|
511
|
+
endDate: Date;
|
|
512
|
+
repeat: RecurringDateCronRepeat;
|
|
513
|
+
}
|
|
514
|
+
type RecurringDateCronExpression = `${string} ${string}`;
|
|
515
|
+
interface RecurringDateCronResult extends RecurringDateCronValues {
|
|
516
|
+
expression: RecurringDateCronExpression;
|
|
517
|
+
description: string;
|
|
518
|
+
}
|
|
519
|
+
type CheckoutMode = "required" | "optional" | "hidden";
|
|
520
|
+
interface CheckoutResolved {
|
|
521
|
+
shipping: CheckoutMode;
|
|
522
|
+
billing: CheckoutMode;
|
|
523
|
+
shippingFields: Record<string, CheckoutMode>;
|
|
524
|
+
billingFields: Record<string, CheckoutMode>;
|
|
525
|
+
}
|
|
526
|
+
//#endregion
|
|
527
|
+
export type { AddressInfo, AndConditions, BillingInfo, BillingProfile, BundledItem, Category, CategoryAvailability, CategoryItem, CheckoutMode, CheckoutResolved, CmsBlock, CmsBlockItem, Condition, Customer, CustomerGender, CustomerIdentifyInput, CustomerRegisterInput, CustomerUpdateInput, DayOfWeek, DeliveryAddress, Fulfillment, FulfillmentListInput, GroupDisplayType, KioskAdminGesture, KioskAppState, KioskCommandPayload, KioskCommandType, KioskConfigChangedPayload, KioskDeviceConfig, KioskDeviceConfigDevice, KioskDeviceConfigPayment, KioskDeviceConfigScope, KioskDeviceConfigSettings, KioskDeviceOverrides, KioskHealthBatchInput, KioskHealthBatchResult, KioskHealthSample, KioskHeartbeatHealth, KioskHeartbeatInput, KioskHeartbeatResult, KioskOrderPager, KioskPagerSide, KioskPagersOverrides, KioskPagersSettings, KioskRealtimeToken, MatchResult, MatchableRule, Menu, MenuLookup, MerchantPayment, Metadata, ModifierControlType, ModifierGroup, MultiLanguageText, OrConditions, Order, OrderChangedCallback, OrderChangedCallbackError, OrderChangedCheckoutState, OrderChangedError, OrderChangedPayload, OrderChangedRunStatus, OrderFulfillment, OrderInsertInput, OrderLine, OrderListInput, OrderReorderInput, OrderTotals, OrderUpdateInput, OrderValidateInput, OrderValidateOutput, Payment, PaymentIntent, PaymentIntentInput, PaymentMethod, PaymentProvider, PlaceOrderResult, PricingModifier, Product, ProductAvailability, ProductPricing, ProductRecommendationLink, Recommendation, RecurringDateCronExpression, RecurringDateCronRepeat, RecurringDateCronResult, RecurringDateCronValues, RuleInterpretation, RulesEngineMonitoring, RulesEngineOrder, RulesEngineOrderLine, RulesEngineParams, RulesEngineRuntime, Schedule, ScheduleDay, SchedulePeriod, Store, StoreListInput, StoreNearbyInput, StorefrontAvailability, StorefrontAvailabilityChangedPayload, StorefrontAvailabilityInput, StorefrontAvailabilityRule, StorefrontCmsChangedPayload, StorefrontMenu, StorefrontMenuChangedPayload, StorefrontMenuScope, StorefrontMenuStreamOptions, StorefrontPaymentsListInput, StorefrontPreferences, StorefrontPreferencesInput, StorefrontRealtimeToken, StorefrontRealtimeTokenInput, StorefrontWorkspaceChangedPayload, StringMatchCaseOptions };
|
package/dist/index.js
ADDED
|
File without changes
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fire-spark/types",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Fire Spark public TypeScript types",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"main": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"development": "./src/index.ts",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js",
|
|
17
|
+
"default": "./dist/index.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"zod": "^4.5.4"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"tsdown": "^0.22.14",
|
|
25
|
+
"typescript": "^7.0.2",
|
|
26
|
+
"@repo/validations": "0.0.0"
|
|
27
|
+
},
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
},
|
|
31
|
+
"tsdown": {
|
|
32
|
+
"entry": [
|
|
33
|
+
"src/index.ts"
|
|
34
|
+
],
|
|
35
|
+
"format": [
|
|
36
|
+
"esm"
|
|
37
|
+
],
|
|
38
|
+
"platform": "neutral",
|
|
39
|
+
"dts": {
|
|
40
|
+
"eager": true
|
|
41
|
+
},
|
|
42
|
+
"deps": {
|
|
43
|
+
"neverBundle": [
|
|
44
|
+
"@repo/validations",
|
|
45
|
+
"zod"
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
"clean": true
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "tsdown",
|
|
52
|
+
"dev": "tsdown --watch",
|
|
53
|
+
"check-types": "tsc --noEmit",
|
|
54
|
+
"lint": "oxlint ./src --max-warnings=0",
|
|
55
|
+
"format": "oxfmt ./src",
|
|
56
|
+
"check-format": "oxfmt --check ./src"
|
|
57
|
+
}
|
|
58
|
+
}
|