@c1m-public/channel-client 0.6.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 +40 -6
- package/dist/index.d.ts +88 -4
- package/dist/index.js +148 -7
- package/dist/next-cart.d.ts +3 -1
- package/dist/next-cart.js +6 -4
- package/dist/next-session.js +5 -24
- package/dist/next-webhooks.d.ts +6 -0
- package/dist/next-webhooks.js +32 -12
- package/dist/next.d.ts +67 -0
- package/dist/types.d.ts +526 -0
- package/dist/webhooks.d.ts +42 -2
- package/dist/webhooks.js +61 -2
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -82,6 +82,12 @@ export interface Product {
|
|
|
82
82
|
price_cents: number;
|
|
83
83
|
currency: string;
|
|
84
84
|
inventory_qty: number;
|
|
85
|
+
/**
|
|
86
|
+
* Stripe product tax code (e.g. `txcd_99999999`). Drives how Stripe Automatic Tax
|
|
87
|
+
* categorises the product at checkout — a book, a hot meal and a t-shirt are taxed
|
|
88
|
+
* differently in most places. Empty means the merchant's Stripe account default.
|
|
89
|
+
*/
|
|
90
|
+
tax_code?: string;
|
|
85
91
|
status: "draft" | "published" | "archived";
|
|
86
92
|
primary_image_url?: string;
|
|
87
93
|
options?: unknown[];
|
|
@@ -110,6 +116,60 @@ export interface ProductAsset {
|
|
|
110
116
|
};
|
|
111
117
|
created_at: string;
|
|
112
118
|
}
|
|
119
|
+
export interface CatalogCategory {
|
|
120
|
+
id: string;
|
|
121
|
+
workspace_id: string;
|
|
122
|
+
name: string;
|
|
123
|
+
slug: string;
|
|
124
|
+
description?: string;
|
|
125
|
+
is_active: boolean;
|
|
126
|
+
sort_order: number;
|
|
127
|
+
product_count: number;
|
|
128
|
+
metadata: unknown;
|
|
129
|
+
created_at: string;
|
|
130
|
+
updated_at: string;
|
|
131
|
+
}
|
|
132
|
+
export interface CatalogCollection {
|
|
133
|
+
id: string;
|
|
134
|
+
workspace_id: string;
|
|
135
|
+
title: string;
|
|
136
|
+
slug: string;
|
|
137
|
+
description?: string;
|
|
138
|
+
created_at: string;
|
|
139
|
+
updated_at: string;
|
|
140
|
+
}
|
|
141
|
+
export interface CatalogBrand {
|
|
142
|
+
id: string;
|
|
143
|
+
workspace_id: string;
|
|
144
|
+
name: string;
|
|
145
|
+
slug: string;
|
|
146
|
+
description?: string;
|
|
147
|
+
website_url?: string;
|
|
148
|
+
is_active: boolean;
|
|
149
|
+
sort_order: number;
|
|
150
|
+
metadata: unknown;
|
|
151
|
+
created_at: string;
|
|
152
|
+
updated_at: string;
|
|
153
|
+
}
|
|
154
|
+
export interface CatalogProduct {
|
|
155
|
+
id: string;
|
|
156
|
+
slug: string;
|
|
157
|
+
title: string;
|
|
158
|
+
price_cents: number;
|
|
159
|
+
currency: string;
|
|
160
|
+
base_price_cents?: number;
|
|
161
|
+
base_currency?: string;
|
|
162
|
+
price_source?: string;
|
|
163
|
+
fx_rate?: number;
|
|
164
|
+
fx_provider?: string;
|
|
165
|
+
fx_quoted_at?: string;
|
|
166
|
+
primary_image_url?: string;
|
|
167
|
+
status: string;
|
|
168
|
+
}
|
|
169
|
+
export interface CatalogProductsResponse {
|
|
170
|
+
products: CatalogProduct[];
|
|
171
|
+
count: number;
|
|
172
|
+
}
|
|
113
173
|
export interface Review {
|
|
114
174
|
id: string;
|
|
115
175
|
rating: number;
|
|
@@ -232,6 +292,470 @@ export interface BlogPost {
|
|
|
232
292
|
export interface BlogPostResponse {
|
|
233
293
|
post: BlogPost;
|
|
234
294
|
}
|
|
295
|
+
export interface GivingEntry {
|
|
296
|
+
id: string;
|
|
297
|
+
workspace_id: string;
|
|
298
|
+
slug: string;
|
|
299
|
+
title: string;
|
|
300
|
+
subtitle?: string;
|
|
301
|
+
variant: string;
|
|
302
|
+
default_amount_cents: number;
|
|
303
|
+
suggested_amounts_cents?: number[];
|
|
304
|
+
allow_custom_amount: boolean;
|
|
305
|
+
cta_label?: string;
|
|
306
|
+
is_active: boolean;
|
|
307
|
+
created_at: string;
|
|
308
|
+
updated_at: string;
|
|
309
|
+
}
|
|
310
|
+
export interface GivingIntent {
|
|
311
|
+
id: string;
|
|
312
|
+
workspace_id: string;
|
|
313
|
+
status: string;
|
|
314
|
+
variant: string;
|
|
315
|
+
title: string;
|
|
316
|
+
description?: string;
|
|
317
|
+
currency: string;
|
|
318
|
+
amount_cents: number;
|
|
319
|
+
is_recurring: boolean;
|
|
320
|
+
is_anonymous: boolean;
|
|
321
|
+
display_name?: string;
|
|
322
|
+
email?: string;
|
|
323
|
+
message?: string;
|
|
324
|
+
session_id?: string;
|
|
325
|
+
recurring_agreement_id?: string;
|
|
326
|
+
source_invoice_id?: string;
|
|
327
|
+
created_at: string;
|
|
328
|
+
updated_at: string;
|
|
329
|
+
refunded_at?: string;
|
|
330
|
+
}
|
|
331
|
+
export interface GivingIntentListResponse {
|
|
332
|
+
items: GivingIntent[];
|
|
333
|
+
}
|
|
334
|
+
export interface SavedAddress {
|
|
335
|
+
id: string;
|
|
336
|
+
end_user_id: string;
|
|
337
|
+
label: string;
|
|
338
|
+
name: string;
|
|
339
|
+
phone: string;
|
|
340
|
+
line1: string;
|
|
341
|
+
line2: string;
|
|
342
|
+
city: string;
|
|
343
|
+
region: string;
|
|
344
|
+
postal_code: string;
|
|
345
|
+
country_code: string;
|
|
346
|
+
is_default_shipping: boolean;
|
|
347
|
+
is_default_billing: boolean;
|
|
348
|
+
created_at: string;
|
|
349
|
+
updated_at: string;
|
|
350
|
+
}
|
|
351
|
+
export interface SavedAddressInput {
|
|
352
|
+
line1: string;
|
|
353
|
+
city: string;
|
|
354
|
+
country_code: string;
|
|
355
|
+
label?: string;
|
|
356
|
+
name?: string;
|
|
357
|
+
phone?: string;
|
|
358
|
+
line2?: string;
|
|
359
|
+
region?: string;
|
|
360
|
+
postal_code?: string;
|
|
361
|
+
is_default_shipping?: boolean;
|
|
362
|
+
is_default_billing?: boolean;
|
|
363
|
+
}
|
|
364
|
+
export type SavedAddressUpdateInput = SavedAddressInput;
|
|
365
|
+
export type SavedAddressDefaultKind = "shipping" | "billing";
|
|
366
|
+
export interface SavedAddressResponse {
|
|
367
|
+
address: SavedAddress;
|
|
368
|
+
}
|
|
369
|
+
export interface SavedPaymentMethod {
|
|
370
|
+
id: string;
|
|
371
|
+
workspace_id: string;
|
|
372
|
+
end_user_ref?: string;
|
|
373
|
+
provider: string;
|
|
374
|
+
provider_customer_id?: string;
|
|
375
|
+
provider_payment_method_id: string;
|
|
376
|
+
status: string;
|
|
377
|
+
is_default: boolean;
|
|
378
|
+
display_brand?: string;
|
|
379
|
+
display_last4?: string;
|
|
380
|
+
exp_month?: number;
|
|
381
|
+
exp_year?: number;
|
|
382
|
+
created_at: string;
|
|
383
|
+
updated_at: string;
|
|
384
|
+
}
|
|
385
|
+
export interface PaymentMethodSetupInput {
|
|
386
|
+
provider: string;
|
|
387
|
+
}
|
|
388
|
+
export interface PaymentMethodSetupResult {
|
|
389
|
+
type: string;
|
|
390
|
+
client_secret?: string;
|
|
391
|
+
publishable_key?: string;
|
|
392
|
+
}
|
|
393
|
+
export interface PaymentMethodConfirmInput {
|
|
394
|
+
provider: string;
|
|
395
|
+
setup_intent_id?: string;
|
|
396
|
+
payment_method_id?: string;
|
|
397
|
+
}
|
|
398
|
+
export interface PaymentMethodMutationResponse {
|
|
399
|
+
success: boolean;
|
|
400
|
+
}
|
|
401
|
+
export interface SubscriptionAgreement {
|
|
402
|
+
id: string;
|
|
403
|
+
workspace_id: string;
|
|
404
|
+
source_kind: string;
|
|
405
|
+
source_id: string;
|
|
406
|
+
end_user_ref?: string;
|
|
407
|
+
status: string;
|
|
408
|
+
provider: string;
|
|
409
|
+
provider_ref?: string;
|
|
410
|
+
provider_customer_ref?: string;
|
|
411
|
+
plan_id?: string;
|
|
412
|
+
initial_invoice_id?: string;
|
|
413
|
+
currency: string;
|
|
414
|
+
amount_cents: number;
|
|
415
|
+
interval: string;
|
|
416
|
+
current_period_start?: string;
|
|
417
|
+
current_period_end?: string;
|
|
418
|
+
trial_ends_at?: string;
|
|
419
|
+
cancel_at_period_end: boolean;
|
|
420
|
+
canceled_at?: string;
|
|
421
|
+
meta?: Record<string, unknown>;
|
|
422
|
+
created_at: string;
|
|
423
|
+
updated_at: string;
|
|
424
|
+
}
|
|
425
|
+
export interface SubscriptionAgreementResponse {
|
|
426
|
+
agreement: SubscriptionAgreement;
|
|
427
|
+
}
|
|
428
|
+
export interface SubscriptionListResponse {
|
|
429
|
+
items: SubscriptionAgreement[];
|
|
430
|
+
has_more: boolean;
|
|
431
|
+
next_cursor?: string;
|
|
432
|
+
}
|
|
433
|
+
export interface SubscriptionInvoice {
|
|
434
|
+
id: string;
|
|
435
|
+
workspace_id: string;
|
|
436
|
+
agreement_id: string;
|
|
437
|
+
source_kind: string;
|
|
438
|
+
source_id: string;
|
|
439
|
+
invoice_number: string;
|
|
440
|
+
status: string;
|
|
441
|
+
currency: string;
|
|
442
|
+
subtotal_cents: number;
|
|
443
|
+
tax_cents: number;
|
|
444
|
+
total_cents: number;
|
|
445
|
+
paid_cents: number;
|
|
446
|
+
period_start?: string;
|
|
447
|
+
period_end?: string;
|
|
448
|
+
due_at?: string;
|
|
449
|
+
paid_at?: string;
|
|
450
|
+
payment_id?: string;
|
|
451
|
+
attempt_count: number;
|
|
452
|
+
failure_code?: string;
|
|
453
|
+
failure_message?: string;
|
|
454
|
+
meta?: Record<string, unknown>;
|
|
455
|
+
created_at: string;
|
|
456
|
+
updated_at: string;
|
|
457
|
+
}
|
|
458
|
+
export interface SubscriptionInvoiceResponse {
|
|
459
|
+
invoice: SubscriptionInvoice;
|
|
460
|
+
}
|
|
461
|
+
export interface SubscriptionInvoiceListResponse {
|
|
462
|
+
items: SubscriptionInvoice[];
|
|
463
|
+
has_more: boolean;
|
|
464
|
+
next_cursor?: string;
|
|
465
|
+
}
|
|
466
|
+
export interface SubscriptionSourceDisplay {
|
|
467
|
+
source_app: string;
|
|
468
|
+
source_kind: string;
|
|
469
|
+
source_id: string;
|
|
470
|
+
app_label: string;
|
|
471
|
+
object_label: string;
|
|
472
|
+
subtitle?: string;
|
|
473
|
+
variant?: string;
|
|
474
|
+
admin_href?: string;
|
|
475
|
+
customer_href?: string;
|
|
476
|
+
status?: string;
|
|
477
|
+
}
|
|
478
|
+
export interface SubscriptionSourceResponse {
|
|
479
|
+
source_display: SubscriptionSourceDisplay;
|
|
480
|
+
}
|
|
481
|
+
export interface StartGivingInput {
|
|
482
|
+
variant?: string;
|
|
483
|
+
title?: string;
|
|
484
|
+
description?: string;
|
|
485
|
+
amount_cents: number;
|
|
486
|
+
currency?: string;
|
|
487
|
+
is_recurring?: boolean;
|
|
488
|
+
is_anonymous?: boolean;
|
|
489
|
+
display_name?: string;
|
|
490
|
+
email?: string;
|
|
491
|
+
message?: string;
|
|
492
|
+
success_url?: string;
|
|
493
|
+
cancel_url?: string;
|
|
494
|
+
}
|
|
495
|
+
export interface StartGivingResponse {
|
|
496
|
+
giving: GivingIntent;
|
|
497
|
+
session: {
|
|
498
|
+
session_id: string;
|
|
499
|
+
url: string;
|
|
500
|
+
payment_intent_id?: string;
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
export interface PrintPerPagePricing {
|
|
504
|
+
bw_cents: number;
|
|
505
|
+
colour_cents: number;
|
|
506
|
+
}
|
|
507
|
+
export interface PrintPaperSize {
|
|
508
|
+
key: string;
|
|
509
|
+
label: string;
|
|
510
|
+
surcharge_cents: number;
|
|
511
|
+
enabled: boolean;
|
|
512
|
+
}
|
|
513
|
+
export interface PrintPricingOption {
|
|
514
|
+
key: string;
|
|
515
|
+
label: string;
|
|
516
|
+
type: string;
|
|
517
|
+
surcharge_cents: number;
|
|
518
|
+
}
|
|
519
|
+
export interface PrintPricing {
|
|
520
|
+
base_fee_cents: number;
|
|
521
|
+
per_page: PrintPerPagePricing;
|
|
522
|
+
paper_sizes: PrintPaperSize[];
|
|
523
|
+
options: PrintPricingOption[];
|
|
524
|
+
min_total_cents: number;
|
|
525
|
+
}
|
|
526
|
+
export interface PrintBranding {
|
|
527
|
+
display_name?: string;
|
|
528
|
+
logo_url?: string;
|
|
529
|
+
accent?: string;
|
|
530
|
+
instructions?: string;
|
|
531
|
+
}
|
|
532
|
+
export interface PrintIntakeLimits {
|
|
533
|
+
max_files: number;
|
|
534
|
+
max_file_bytes: number;
|
|
535
|
+
max_total_bytes: number;
|
|
536
|
+
allowed_extensions: string[];
|
|
537
|
+
}
|
|
538
|
+
export interface PrintSettingsResponse {
|
|
539
|
+
accepting: boolean;
|
|
540
|
+
currency: string;
|
|
541
|
+
retention_days: number;
|
|
542
|
+
pricing: PrintPricing;
|
|
543
|
+
branding: PrintBranding;
|
|
544
|
+
intake_limits: PrintIntakeLimits;
|
|
545
|
+
}
|
|
546
|
+
export interface PrintOptionsSelection {
|
|
547
|
+
paper_size: string;
|
|
548
|
+
colour: boolean;
|
|
549
|
+
pages: number;
|
|
550
|
+
copies: number;
|
|
551
|
+
extras?: Record<string, boolean>;
|
|
552
|
+
}
|
|
553
|
+
export interface PrintPriceLine {
|
|
554
|
+
label: string;
|
|
555
|
+
amount_cents: number;
|
|
556
|
+
}
|
|
557
|
+
export interface PrintPriceBreakdown {
|
|
558
|
+
lines: PrintPriceLine[];
|
|
559
|
+
total_cents: number;
|
|
560
|
+
currency: string;
|
|
561
|
+
}
|
|
562
|
+
export interface PrintQuoteResponse {
|
|
563
|
+
price_cents: number;
|
|
564
|
+
currency: string;
|
|
565
|
+
breakdown: PrintPriceBreakdown;
|
|
566
|
+
}
|
|
567
|
+
export interface PrintIntakeInput {
|
|
568
|
+
name: string;
|
|
569
|
+
email?: string;
|
|
570
|
+
phone?: string;
|
|
571
|
+
notes?: string;
|
|
572
|
+
options: PrintOptionsSelection;
|
|
573
|
+
files: Array<{
|
|
574
|
+
blob: Blob;
|
|
575
|
+
filename: string;
|
|
576
|
+
}>;
|
|
577
|
+
}
|
|
578
|
+
export interface PrintJobFile {
|
|
579
|
+
id: string;
|
|
580
|
+
job_id: string;
|
|
581
|
+
file_name: string;
|
|
582
|
+
mime_type: string;
|
|
583
|
+
size_bytes: number;
|
|
584
|
+
page_count?: number;
|
|
585
|
+
sort_order: number;
|
|
586
|
+
created_at: string;
|
|
587
|
+
}
|
|
588
|
+
export interface PrintJob {
|
|
589
|
+
id: string;
|
|
590
|
+
workspace_id: string;
|
|
591
|
+
reference: string;
|
|
592
|
+
customer_name: string;
|
|
593
|
+
customer_email?: string;
|
|
594
|
+
customer_phone?: string;
|
|
595
|
+
status: string;
|
|
596
|
+
payment_status: string;
|
|
597
|
+
payment_method: string;
|
|
598
|
+
options: PrintOptionsSelection;
|
|
599
|
+
price_cents: number;
|
|
600
|
+
currency: string;
|
|
601
|
+
price_breakdown: PrintPriceBreakdown;
|
|
602
|
+
notes?: string;
|
|
603
|
+
file_count?: number;
|
|
604
|
+
version: number;
|
|
605
|
+
files?: PrintJobFile[];
|
|
606
|
+
created_at: string;
|
|
607
|
+
updated_at: string;
|
|
608
|
+
}
|
|
609
|
+
export interface DiningAvailabilityRule {
|
|
610
|
+
days?: string[];
|
|
611
|
+
start?: string;
|
|
612
|
+
end?: string;
|
|
613
|
+
starts_on?: string;
|
|
614
|
+
ends_on?: string;
|
|
615
|
+
}
|
|
616
|
+
export interface DiningAvailability {
|
|
617
|
+
timezone?: string;
|
|
618
|
+
rules?: DiningAvailabilityRule[];
|
|
619
|
+
is_available_now: boolean;
|
|
620
|
+
next_change_at?: string;
|
|
621
|
+
}
|
|
622
|
+
export interface DiningItemSize {
|
|
623
|
+
id: string;
|
|
624
|
+
name: string;
|
|
625
|
+
price_cents: number;
|
|
626
|
+
is_default: boolean;
|
|
627
|
+
sort_order: number;
|
|
628
|
+
is_active: boolean;
|
|
629
|
+
}
|
|
630
|
+
export interface DiningModifier {
|
|
631
|
+
id: string;
|
|
632
|
+
name: string;
|
|
633
|
+
description?: string;
|
|
634
|
+
price_delta_cents: number;
|
|
635
|
+
is_default: boolean;
|
|
636
|
+
sort_order: number;
|
|
637
|
+
is_active: boolean;
|
|
638
|
+
}
|
|
639
|
+
export interface DiningModifierGroup {
|
|
640
|
+
id: string;
|
|
641
|
+
name: string;
|
|
642
|
+
description?: string;
|
|
643
|
+
selection_type: string;
|
|
644
|
+
is_required: boolean;
|
|
645
|
+
min_selections: number;
|
|
646
|
+
max_selections?: number;
|
|
647
|
+
sort_order: number;
|
|
648
|
+
is_active: boolean;
|
|
649
|
+
modifiers: DiningModifier[];
|
|
650
|
+
}
|
|
651
|
+
export interface DiningOfferBadge {
|
|
652
|
+
offer_id: string;
|
|
653
|
+
label: string;
|
|
654
|
+
type: string;
|
|
655
|
+
is_featured: boolean;
|
|
656
|
+
display_priority: number;
|
|
657
|
+
}
|
|
658
|
+
export interface DiningComboChoice {
|
|
659
|
+
id: string;
|
|
660
|
+
item: {
|
|
661
|
+
id: string;
|
|
662
|
+
slug: string;
|
|
663
|
+
name: string;
|
|
664
|
+
description?: string;
|
|
665
|
+
base_price_cents: number;
|
|
666
|
+
image_url?: string;
|
|
667
|
+
image_alt: string;
|
|
668
|
+
badges: string[];
|
|
669
|
+
status: string;
|
|
670
|
+
dietary_flags: string[];
|
|
671
|
+
allergens: string[];
|
|
672
|
+
calories?: number;
|
|
673
|
+
prep_time_mins?: number;
|
|
674
|
+
spice_level?: number;
|
|
675
|
+
kitchen_station?: string;
|
|
676
|
+
sizes: DiningItemSize[];
|
|
677
|
+
modifier_groups: DiningModifierGroup[];
|
|
678
|
+
};
|
|
679
|
+
label_override?: string;
|
|
680
|
+
description_override?: string;
|
|
681
|
+
price_delta_cents: number;
|
|
682
|
+
is_default: boolean;
|
|
683
|
+
sort_order: number;
|
|
684
|
+
is_active: boolean;
|
|
685
|
+
is_available: boolean;
|
|
686
|
+
}
|
|
687
|
+
export interface DiningComboGroup {
|
|
688
|
+
id: string;
|
|
689
|
+
name: string;
|
|
690
|
+
description?: string;
|
|
691
|
+
min_selections: number;
|
|
692
|
+
max_selections?: number;
|
|
693
|
+
allow_repeats: boolean;
|
|
694
|
+
sort_order: number;
|
|
695
|
+
is_active: boolean;
|
|
696
|
+
choices: DiningComboChoice[];
|
|
697
|
+
}
|
|
698
|
+
export interface DiningOffer {
|
|
699
|
+
id: string;
|
|
700
|
+
name: string;
|
|
701
|
+
badge_label?: string;
|
|
702
|
+
type: string;
|
|
703
|
+
code?: string;
|
|
704
|
+
is_featured: boolean;
|
|
705
|
+
display_priority: number;
|
|
706
|
+
image_url?: string;
|
|
707
|
+
availability?: DiningAvailability;
|
|
708
|
+
is_active: boolean;
|
|
709
|
+
}
|
|
710
|
+
export interface DiningMenuItem {
|
|
711
|
+
id: string;
|
|
712
|
+
slug: string;
|
|
713
|
+
name: string;
|
|
714
|
+
description?: string;
|
|
715
|
+
item_kind: string;
|
|
716
|
+
price_cents: number;
|
|
717
|
+
price_from_cents: number;
|
|
718
|
+
image_url?: string;
|
|
719
|
+
image_alt: string;
|
|
720
|
+
badges: string[];
|
|
721
|
+
is_featured: boolean;
|
|
722
|
+
is_available: boolean;
|
|
723
|
+
status: string;
|
|
724
|
+
dietary_flags: string[];
|
|
725
|
+
allergens: string[];
|
|
726
|
+
calories?: number;
|
|
727
|
+
prep_time_mins?: number;
|
|
728
|
+
spice_level?: number;
|
|
729
|
+
sizes: DiningItemSize[];
|
|
730
|
+
modifier_groups: DiningModifierGroup[];
|
|
731
|
+
offer_badges: DiningOfferBadge[];
|
|
732
|
+
combo_groups?: DiningComboGroup[];
|
|
733
|
+
}
|
|
734
|
+
export interface DiningMenu {
|
|
735
|
+
saas_app: string;
|
|
736
|
+
workspace_id: string;
|
|
737
|
+
board: {
|
|
738
|
+
id: string;
|
|
739
|
+
slug: string;
|
|
740
|
+
name: string;
|
|
741
|
+
description?: string;
|
|
742
|
+
currency: string;
|
|
743
|
+
applicable_order_types: string[];
|
|
744
|
+
availability?: DiningAvailability;
|
|
745
|
+
is_active: boolean;
|
|
746
|
+
};
|
|
747
|
+
sections: Array<{
|
|
748
|
+
id: string;
|
|
749
|
+
name: string;
|
|
750
|
+
description?: string;
|
|
751
|
+
sort_order: number;
|
|
752
|
+
availability?: DiningAvailability;
|
|
753
|
+
is_active: boolean;
|
|
754
|
+
items: DiningMenuItem[];
|
|
755
|
+
}>;
|
|
756
|
+
offers: DiningOffer[];
|
|
757
|
+
generated_at: string;
|
|
758
|
+
}
|
|
235
759
|
/** The published theme, as served to a channel that owns its own routing and
|
|
236
760
|
* therefore never calls `site.resolve` (which otherwise bundles it). */
|
|
237
761
|
export interface ThemeResponse {
|
|
@@ -299,6 +823,8 @@ export interface OrderItem {
|
|
|
299
823
|
quantity: number;
|
|
300
824
|
unit_price_cents: number;
|
|
301
825
|
line_total_cents: number;
|
|
826
|
+
/** Stripe product tax code, snapshotted from the product at order time. */
|
|
827
|
+
tax_code?: string;
|
|
302
828
|
[key: string]: unknown;
|
|
303
829
|
}
|
|
304
830
|
export interface CartResponse {
|
package/dist/webhooks.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* PII-free fields; fetch the detail back through the channel client. Data POSTed
|
|
10
10
|
* to your server can never be reached by a GDPR erasure on ours.
|
|
11
11
|
*/
|
|
12
|
-
export declare const CHANNEL_WEBHOOK_EVENT_TYPES: readonly ["order.created", "order.paid", "lead.created", "review.submitted", "page.published"];
|
|
12
|
+
export declare const CHANNEL_WEBHOOK_EVENT_TYPES: readonly ["order.created", "order.paid", "order.updated", "order.cancelled", "order.refunded", "lead.created", "review.submitted", "review.published", "page.published", "product.created", "product.updated", "product.deleted"];
|
|
13
13
|
export type ChannelWebhookEventType = (typeof CHANNEL_WEBHOOK_EVENT_TYPES)[number];
|
|
14
14
|
export interface OrderEventData {
|
|
15
15
|
order_id: string;
|
|
@@ -35,18 +35,46 @@ export interface ReviewSubmittedEventData {
|
|
|
35
35
|
source: string;
|
|
36
36
|
submitted_at: string;
|
|
37
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Fired when a review clears moderation. Unlike `review.submitted` this one
|
|
40
|
+
* carries the review id — it is the event a reviews page revalidates on.
|
|
41
|
+
*/
|
|
42
|
+
export interface ReviewPublishedEventData {
|
|
43
|
+
review_id: string;
|
|
44
|
+
rating: number;
|
|
45
|
+
source: string;
|
|
46
|
+
published_at?: string;
|
|
47
|
+
}
|
|
38
48
|
export interface PagePublishedEventData {
|
|
39
49
|
page_id: string;
|
|
40
50
|
route_pattern: string;
|
|
41
51
|
title: string;
|
|
42
52
|
published_at?: string;
|
|
43
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* The catalog-change signal. Thin by design: `slug` locates the cached product
|
|
56
|
+
* page, `status` says whether it is still publicly visible. Fetch price and
|
|
57
|
+
* stock back through the channel client — a webhook body is a cache-busting
|
|
58
|
+
* signal, not a data feed.
|
|
59
|
+
*/
|
|
60
|
+
export interface ProductEventData {
|
|
61
|
+
product_id: string;
|
|
62
|
+
slug?: string;
|
|
63
|
+
status?: string;
|
|
64
|
+
}
|
|
44
65
|
export interface ChannelWebhookEventDataMap {
|
|
45
66
|
"order.created": OrderEventData;
|
|
46
67
|
"order.paid": OrderEventData;
|
|
68
|
+
"order.updated": OrderEventData;
|
|
69
|
+
"order.cancelled": OrderEventData;
|
|
70
|
+
"order.refunded": OrderEventData;
|
|
47
71
|
"lead.created": LeadCreatedEventData;
|
|
48
72
|
"review.submitted": ReviewSubmittedEventData;
|
|
73
|
+
"review.published": ReviewPublishedEventData;
|
|
49
74
|
"page.published": PagePublishedEventData;
|
|
75
|
+
"product.created": ProductEventData;
|
|
76
|
+
"product.updated": ProductEventData;
|
|
77
|
+
"product.deleted": ProductEventData;
|
|
50
78
|
}
|
|
51
79
|
export interface ChannelWebhookEvent<T extends ChannelWebhookEventType = ChannelWebhookEventType> {
|
|
52
80
|
/** The originating event id. Delivery is AT-LEAST-ONCE — use this to dedupe. */
|
|
@@ -62,7 +90,19 @@ export interface ChannelWebhookEvent<T extends ChannelWebhookEventType = Channel
|
|
|
62
90
|
export type AnyChannelWebhookEvent = {
|
|
63
91
|
[T in ChannelWebhookEventType]: ChannelWebhookEvent<T>;
|
|
64
92
|
}[ChannelWebhookEventType];
|
|
93
|
+
/** A valid signed envelope for an event introduced by a newer API version. */
|
|
94
|
+
export interface UnknownChannelWebhookEvent {
|
|
95
|
+
id: string;
|
|
96
|
+
type: string;
|
|
97
|
+
api_version: string;
|
|
98
|
+
occurred_at: string;
|
|
99
|
+
workspace_id: string;
|
|
100
|
+
channel_id?: string;
|
|
101
|
+
data: unknown;
|
|
102
|
+
}
|
|
103
|
+
export type ParsedChannelWebhookEvent = AnyChannelWebhookEvent | UnknownChannelWebhookEvent;
|
|
65
104
|
export declare function isChannelWebhookEventType(value: string): value is ChannelWebhookEventType;
|
|
105
|
+
export declare function isKnownChannelWebhookEvent(event: ParsedChannelWebhookEvent): event is AnyChannelWebhookEvent;
|
|
66
106
|
export type ChannelWebhookVerificationCode = "missing_signature" | "missing_timestamp" | "invalid_timestamp" | "timestamp_out_of_tolerance" | "invalid_signature" | "invalid_payload";
|
|
67
107
|
export declare class ChannelWebhookVerificationError extends Error {
|
|
68
108
|
readonly code: ChannelWebhookVerificationCode;
|
|
@@ -126,4 +166,4 @@ export interface ParseChannelWebhookEventOptions {
|
|
|
126
166
|
*
|
|
127
167
|
* @throws {ChannelWebhookVerificationError} if the request is not authentic.
|
|
128
168
|
*/
|
|
129
|
-
export declare function parseChannelWebhookEvent(request: Request, options: ParseChannelWebhookEventOptions): Promise<
|
|
169
|
+
export declare function parseChannelWebhookEvent(request: Request, options: ParseChannelWebhookEventOptions): Promise<ParsedChannelWebhookEvent>;
|