@cohostvip/cohost-node 0.0.9 → 0.0.10
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.mts +280 -182
- package/dist/index.d.ts +280 -182
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,46 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Supported HTTP methods.
|
|
3
|
-
*/
|
|
4
|
-
type RequestMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
5
|
-
/**
|
|
6
|
-
* A function that performs a request to the Cohost API.
|
|
7
|
-
* The generic <T> allows you to specify the expected response type.
|
|
8
|
-
*/
|
|
9
|
-
type RequestFn = <T = any>(path: string, options?: {
|
|
10
|
-
method?: RequestMethod;
|
|
11
|
-
data?: any;
|
|
12
|
-
query?: Record<string, string | number | boolean | undefined>;
|
|
13
|
-
headers?: Record<string, string>;
|
|
14
|
-
}) => Promise<T>;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Optional settings for customizing the behavior of the CohostClient.
|
|
18
|
-
*/
|
|
19
|
-
interface CohostClientSettings {
|
|
20
|
-
/** Enable verbose debug output for all API requests. */
|
|
21
|
-
debug?: boolean;
|
|
22
|
-
/** Override the default API base URL (defaults to apiBaseUrl). */
|
|
23
|
-
apiUrl?: string;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Base class for all API endpoint groups within the Cohost SDK.
|
|
28
|
-
* Provides shared access to the configured request function and settings.
|
|
29
|
-
*/
|
|
30
|
-
declare class CohostEndpoint {
|
|
31
|
-
/** Shared request function injected from the client */
|
|
32
|
-
protected request: RequestFn;
|
|
33
|
-
/** Client settings passed during instantiation */
|
|
34
|
-
protected settings: CohostClientSettings;
|
|
35
|
-
/**
|
|
36
|
-
* Constructs a new endpoint group.
|
|
37
|
-
*
|
|
38
|
-
* @param request - The shared request function for performing API calls
|
|
39
|
-
* @param settings - The client-wide settings passed from the parent client
|
|
40
|
-
*/
|
|
41
|
-
constructor(request: RequestFn, settings: CohostClientSettings);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
1
|
/**
|
|
45
2
|
* A namespaced identifier representing the entity an order is associated with.
|
|
46
3
|
*
|
|
@@ -110,6 +67,27 @@ interface Schedule {
|
|
|
110
67
|
/** Specific dates to include in "YYYY-MM-DD" format. */
|
|
111
68
|
includeDates?: string[];
|
|
112
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Pagination parameters for a paginated API request.
|
|
72
|
+
*/
|
|
73
|
+
interface Pagination$1 {
|
|
74
|
+
/** Number of results per page. */
|
|
75
|
+
size: number;
|
|
76
|
+
/** Page number (starting from 1). */
|
|
77
|
+
page: number;
|
|
78
|
+
/** Continuation */
|
|
79
|
+
continuation?: string;
|
|
80
|
+
}
|
|
81
|
+
interface PaginationResponse extends Pagination$1 {
|
|
82
|
+
/** Total number of results available. */
|
|
83
|
+
total: number;
|
|
84
|
+
}
|
|
85
|
+
type PaginatedResponse<T> = {
|
|
86
|
+
/** Array of results. */
|
|
87
|
+
results: T[];
|
|
88
|
+
/** Pagination metadata. */
|
|
89
|
+
pagination: PaginationResponse;
|
|
90
|
+
};
|
|
113
91
|
/**
|
|
114
92
|
* Base metadata for any record stored in the system.
|
|
115
93
|
* Includes an ID and timestamps for creation and optional updates.
|
|
@@ -173,6 +151,15 @@ type TimeOrOffset = {
|
|
|
173
151
|
secondsBefore: number;
|
|
174
152
|
date?: never;
|
|
175
153
|
};
|
|
154
|
+
/**
|
|
155
|
+
* A request structure that includes both query parameters and pagination.
|
|
156
|
+
*
|
|
157
|
+
* @ignore
|
|
158
|
+
*/
|
|
159
|
+
type PaginatedRequest<T> = T & {
|
|
160
|
+
/** Pagination settings. */
|
|
161
|
+
pagination: Pagination$1;
|
|
162
|
+
};
|
|
176
163
|
/**
|
|
177
164
|
* @description A string representing a currency amount in the format `"USD,1000"` where:
|
|
178
165
|
* - `"USD"` is the 3-letter ISO currency code.
|
|
@@ -443,6 +430,44 @@ interface Ticket extends Omit<Offering, "hidden" | "constraints" | "type"> {
|
|
|
443
430
|
parentId?: string;
|
|
444
431
|
refId?: string;
|
|
445
432
|
}
|
|
433
|
+
/**
|
|
434
|
+
* Person interface
|
|
435
|
+
*/
|
|
436
|
+
interface Person {
|
|
437
|
+
name: string;
|
|
438
|
+
photoURL?: string | null;
|
|
439
|
+
displayName: string;
|
|
440
|
+
first: string;
|
|
441
|
+
last: string;
|
|
442
|
+
gender: null | string | "male" | "female" | "other";
|
|
443
|
+
birthdate?: string | null;
|
|
444
|
+
age?: number;
|
|
445
|
+
}
|
|
446
|
+
interface PersonContact {
|
|
447
|
+
email: string | null;
|
|
448
|
+
phone: string | null;
|
|
449
|
+
}
|
|
450
|
+
type Customer = Person & PersonContact & {
|
|
451
|
+
uid: string | null;
|
|
452
|
+
};
|
|
453
|
+
type AttendeeStatus = "attending" | "checkedIn" | "cancelled" | "refunded" | "noShow" | "unknown" | string;
|
|
454
|
+
interface Attendee3 extends DataRecord {
|
|
455
|
+
/**
|
|
456
|
+
* Order ID, from /orders/:orderId
|
|
457
|
+
*/
|
|
458
|
+
orderId: string;
|
|
459
|
+
/**
|
|
460
|
+
* For event it will be the ticket's id
|
|
461
|
+
*/
|
|
462
|
+
offeringId: string;
|
|
463
|
+
offeringSnapshot: Partial<Offering>;
|
|
464
|
+
profile: Customer | null;
|
|
465
|
+
checkedIn: boolean;
|
|
466
|
+
barcodes: string[];
|
|
467
|
+
version: ApiVersion;
|
|
468
|
+
status: AttendeeStatus | string;
|
|
469
|
+
index: number;
|
|
470
|
+
}
|
|
446
471
|
interface BuzzBuilder {
|
|
447
472
|
countLabel: string;
|
|
448
473
|
profiles: {
|
|
@@ -589,6 +614,21 @@ interface VenueBase {
|
|
|
589
614
|
address: Address | null;
|
|
590
615
|
slug: string | null;
|
|
591
616
|
}
|
|
617
|
+
interface Venue extends VenueBase {
|
|
618
|
+
claimed: boolean;
|
|
619
|
+
refId?: string;
|
|
620
|
+
description?: MultipartText;
|
|
621
|
+
capacity?: number | null;
|
|
622
|
+
types: string[];
|
|
623
|
+
photos?: Photo[];
|
|
624
|
+
hoursOfOperation: string[];
|
|
625
|
+
phoneNumber?: string | null;
|
|
626
|
+
priceLevel: number | null;
|
|
627
|
+
rating: {
|
|
628
|
+
google: number | null;
|
|
629
|
+
};
|
|
630
|
+
[key: string]: any;
|
|
631
|
+
}
|
|
592
632
|
/**
|
|
593
633
|
* @description Status of the event lifecycle.
|
|
594
634
|
*
|
|
@@ -601,8 +641,7 @@ interface VenueBase {
|
|
|
601
641
|
* - `canceled`: The event was canceled and is no longer active.
|
|
602
642
|
*/
|
|
603
643
|
type EventStatus = "archived" | "draft" | "live" | "started" | "ended" | "completed" | "canceled";
|
|
604
|
-
interface EventBase {
|
|
605
|
-
id: string;
|
|
644
|
+
interface EventBase extends DataRecord {
|
|
606
645
|
/**
|
|
607
646
|
* @example "Spring Concert"
|
|
608
647
|
* @faker name.firstName
|
|
@@ -652,6 +691,7 @@ interface EventBase {
|
|
|
652
691
|
*/
|
|
653
692
|
public: boolean;
|
|
654
693
|
location?: Location;
|
|
694
|
+
organizerId: string;
|
|
655
695
|
}
|
|
656
696
|
/**
|
|
657
697
|
* @openapi
|
|
@@ -775,60 +815,6 @@ interface Coupon extends VersionedDataRecord {
|
|
|
775
815
|
*/
|
|
776
816
|
version: ApiVersion;
|
|
777
817
|
}
|
|
778
|
-
/**
|
|
779
|
-
* Captures metadata and request/session context at the time the cart is created.
|
|
780
|
-
* Supports fraud detection, attribution, analytics, and partner session tracking.
|
|
781
|
-
*
|
|
782
|
-
* This interface is extensible — additional custom fields may be included as needed.
|
|
783
|
-
*
|
|
784
|
-
* @export
|
|
785
|
-
*/
|
|
786
|
-
interface OrderContext {
|
|
787
|
-
/**
|
|
788
|
-
* IP addresses associated with the user request.
|
|
789
|
-
* Typically includes forwarded IPs and direct client IP.
|
|
790
|
-
* @example ["203.0.113.1", "10.0.0.1"]
|
|
791
|
-
*/
|
|
792
|
-
ipAddresses: string[];
|
|
793
|
-
/**
|
|
794
|
-
* Raw User-Agent header from the client request.
|
|
795
|
-
* @example "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)..."
|
|
796
|
-
*/
|
|
797
|
-
userAgent: string;
|
|
798
|
-
/**
|
|
799
|
-
* The referring URL from which the cart or checkout was initiated.
|
|
800
|
-
* May be a partner site, marketing page, or event listing.
|
|
801
|
-
* @example "https://partner.example.com/tickets/event123"
|
|
802
|
-
*/
|
|
803
|
-
referrer: string;
|
|
804
|
-
/**
|
|
805
|
-
* Authenticated user ID, or null for anonymous guests.
|
|
806
|
-
* @example "uid_456def"
|
|
807
|
-
*/
|
|
808
|
-
uid: string | null;
|
|
809
|
-
/**
|
|
810
|
-
* The unique cart session ID assigned at the time the cart was created.
|
|
811
|
-
* Helps track cart attribution across systems.
|
|
812
|
-
* @example "cart_sess_abc123"
|
|
813
|
-
*/
|
|
814
|
-
cartSessionId: string;
|
|
815
|
-
/**
|
|
816
|
-
* (Optional) Origin domain name if embedded or white-labeled.
|
|
817
|
-
* Can help identify partner portals or iframe referrers.
|
|
818
|
-
* @example "examplepartner.com"
|
|
819
|
-
*/
|
|
820
|
-
originDomain?: string;
|
|
821
|
-
/**
|
|
822
|
-
* (Optional) Campaign ID, UTM source, or tracking label.
|
|
823
|
-
* Useful for affiliate and analytics systems.
|
|
824
|
-
* @example "utm_campaign=spring_launch"
|
|
825
|
-
*/
|
|
826
|
-
trackingId?: string;
|
|
827
|
-
/**
|
|
828
|
-
* Allows custom fields for analytics, partners, or experiment data.
|
|
829
|
-
*/
|
|
830
|
-
[custom: string]: unknown;
|
|
831
|
-
}
|
|
832
818
|
/**
|
|
833
819
|
* Cost breakdown for a specific item in the order.
|
|
834
820
|
* Extends the standard `OfferingCosts` with totals calculated for quantity and discounts.
|
|
@@ -910,25 +896,64 @@ interface OrderItemOffering extends Pick<Offering, "name" | "costs" | "type"> {
|
|
|
910
896
|
docPath: string;
|
|
911
897
|
}
|
|
912
898
|
/**
|
|
913
|
-
*
|
|
899
|
+
* Represents the resolved context associated with a cart session.
|
|
900
|
+
* This may be an event, venue, or organizer, and is used to enrich the cart with metadata
|
|
901
|
+
* needed for UI rendering and pricing logic without requiring repeated DB lookups.
|
|
902
|
+
*
|
|
903
|
+
* Typically stored in `cart.meta.resolvedContext`.
|
|
904
|
+
*
|
|
905
|
+
* @export
|
|
914
906
|
*/
|
|
915
|
-
interface
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
907
|
+
interface ResolvedCartContext {
|
|
908
|
+
/**
|
|
909
|
+
* Unique identifier of the context entity.
|
|
910
|
+
* Typically matches the cart's `contextId` (e.g., "evt_abc123").
|
|
911
|
+
* @example "evt_abc123"
|
|
912
|
+
*/
|
|
913
|
+
id: string;
|
|
914
|
+
/**
|
|
915
|
+
* Human-readable title or name of the context entity.
|
|
916
|
+
* Used for display in headers, summaries, and confirmations.
|
|
917
|
+
* @example "Downtown Comedy Night"
|
|
918
|
+
*/
|
|
919
|
+
title: string;
|
|
920
|
+
/**
|
|
921
|
+
* Optional physical or virtual location of the event or venue.
|
|
922
|
+
* Can include address, coordinates, or virtual link.
|
|
923
|
+
*/
|
|
924
|
+
location?: Location;
|
|
925
|
+
/**
|
|
926
|
+
* Optional logo, banner, or primary image representing the context.
|
|
927
|
+
* Used in UI to visually identify the entity during checkout.
|
|
928
|
+
*/
|
|
929
|
+
logo?: Photo;
|
|
930
|
+
/**
|
|
931
|
+
* Optional description or summary of the context entity.
|
|
932
|
+
* Provides additional information to the customer during checkout.
|
|
933
|
+
* @example "Join us for a night of laughter with top comedians!"
|
|
934
|
+
*/
|
|
935
|
+
start: string;
|
|
936
|
+
/**
|
|
937
|
+
* Optional end date or time of the event or context entity.
|
|
938
|
+
* Useful for events with a specific duration or schedule.
|
|
939
|
+
* @example "2023-10-15T22:00:00Z"
|
|
940
|
+
*/
|
|
941
|
+
end?: string;
|
|
942
|
+
/**
|
|
943
|
+
* A map of offerings relevant to this context (e.g., ticket types, merch).
|
|
944
|
+
* Stored as a record keyed by offering ID to allow fast lookup.
|
|
945
|
+
* Each value is a partial offering object, intended for display, validation, or pricing.
|
|
946
|
+
* @example {
|
|
947
|
+
* "off_123abc": { path: "events/ev_1234/tickets/tkt_567", offering: { name: "VIP Ticket", price: 3000 }),
|
|
948
|
+
* "off_456def": { path: "events/ev_1234/tickets/tkt_567", offering: { name: "T-Shirt", price: 2000 }}
|
|
949
|
+
* }
|
|
950
|
+
*/
|
|
951
|
+
offerings?: Record<string, ResolvedCartContextOffering>;
|
|
924
952
|
}
|
|
925
|
-
interface
|
|
926
|
-
|
|
927
|
-
|
|
953
|
+
interface ResolvedCartContextOffering {
|
|
954
|
+
path: string;
|
|
955
|
+
offering: Offering;
|
|
928
956
|
}
|
|
929
|
-
type Customer = Person & PersonContact & {
|
|
930
|
-
uid: string | null;
|
|
931
|
-
};
|
|
932
957
|
type CouponSummary = Pick<Coupon, "id" | "code" | "amountOff" | "percentOff" | "offeringIds">;
|
|
933
958
|
type OrderStatus = "placed" | "completed" | "attending" | "cancelled" | "refunded" | "started" | "pending" | "abandoned";
|
|
934
959
|
interface OrderCosts {
|
|
@@ -965,6 +990,7 @@ interface Order extends VCDataRecord {
|
|
|
965
990
|
* Supports multiple entries based on organizer preferences.
|
|
966
991
|
*/
|
|
967
992
|
coupons?: CouponSummary[];
|
|
993
|
+
organizerId: string;
|
|
968
994
|
/**
|
|
969
995
|
* Namespaced identifier indicating what the order is associated with.
|
|
970
996
|
* Format: "{type}_{id}", where type is "evt", "ven", or "org".
|
|
@@ -1032,7 +1058,31 @@ interface Order extends VCDataRecord {
|
|
|
1032
1058
|
* May include fulfillment flags, debugging info, or derived calculations.
|
|
1033
1059
|
* @example { preview: true, manuallyAdjusted: true }
|
|
1034
1060
|
*/
|
|
1035
|
-
meta:
|
|
1061
|
+
meta: {
|
|
1062
|
+
/**
|
|
1063
|
+
* Display context (event, venue, organizer) for rendering and logic.
|
|
1064
|
+
*/
|
|
1065
|
+
resolvedContext?: ResolvedCartContext;
|
|
1066
|
+
/**
|
|
1067
|
+
* Cost components to calculate the cart costs.
|
|
1068
|
+
*
|
|
1069
|
+
* @ignore
|
|
1070
|
+
*/
|
|
1071
|
+
costComponents?: CostComponent[];
|
|
1072
|
+
/**
|
|
1073
|
+
* Snapshot of when pricing was calculated and locked.
|
|
1074
|
+
* Useful for honoring totals during a grace window.
|
|
1075
|
+
*/
|
|
1076
|
+
priceLock?: {
|
|
1077
|
+
lockedAt: string;
|
|
1078
|
+
ttl?: number;
|
|
1079
|
+
};
|
|
1080
|
+
/**
|
|
1081
|
+
* Any additional internal system flags, A/B test conditions, or
|
|
1082
|
+
* non-critical partner payloads.
|
|
1083
|
+
*/
|
|
1084
|
+
[key: string]: any;
|
|
1085
|
+
};
|
|
1036
1086
|
/**
|
|
1037
1087
|
* Session and request context captured at the time of order creation.
|
|
1038
1088
|
* Includes IPs, referrer, user agent, cart session ID, and tracking info.
|
|
@@ -1040,52 +1090,60 @@ interface Order extends VCDataRecord {
|
|
|
1040
1090
|
context: OrderContext;
|
|
1041
1091
|
version: ApiVersion;
|
|
1042
1092
|
}
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
interface
|
|
1093
|
+
type OrderContext = {
|
|
1094
|
+
type: "event";
|
|
1095
|
+
event: EventProfile;
|
|
1096
|
+
venue?: Venue;
|
|
1097
|
+
} | {
|
|
1098
|
+
type: "venue";
|
|
1099
|
+
event?: EventProfile;
|
|
1100
|
+
venue: Venue;
|
|
1101
|
+
};
|
|
1102
|
+
interface OrderContext$1 {
|
|
1053
1103
|
/**
|
|
1054
|
-
*
|
|
1055
|
-
* Typically
|
|
1056
|
-
* @example "
|
|
1104
|
+
* IP addresses associated with the user request.
|
|
1105
|
+
* Typically includes forwarded IPs and direct client IP.
|
|
1106
|
+
* @example ["203.0.113.1", "10.0.0.1"]
|
|
1057
1107
|
*/
|
|
1058
|
-
|
|
1108
|
+
ipAddresses: string[];
|
|
1059
1109
|
/**
|
|
1060
|
-
*
|
|
1061
|
-
*
|
|
1062
|
-
* @example "Downtown Comedy Night"
|
|
1110
|
+
* Raw User-Agent header from the client request.
|
|
1111
|
+
* @example "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)..."
|
|
1063
1112
|
*/
|
|
1064
|
-
|
|
1113
|
+
userAgent: string;
|
|
1065
1114
|
/**
|
|
1066
|
-
*
|
|
1067
|
-
*
|
|
1115
|
+
* The referring URL from which the cart or checkout was initiated.
|
|
1116
|
+
* May be a partner site, marketing page, or event listing.
|
|
1117
|
+
* @example "https://partner.example.com/tickets/event123"
|
|
1068
1118
|
*/
|
|
1069
|
-
|
|
1119
|
+
referrer: string;
|
|
1070
1120
|
/**
|
|
1071
|
-
*
|
|
1072
|
-
*
|
|
1121
|
+
* Authenticated user ID, or null for anonymous guests.
|
|
1122
|
+
* @example "uid_456def"
|
|
1073
1123
|
*/
|
|
1074
|
-
|
|
1124
|
+
uid: string | null;
|
|
1075
1125
|
/**
|
|
1076
|
-
*
|
|
1077
|
-
*
|
|
1078
|
-
*
|
|
1079
|
-
* @example {
|
|
1080
|
-
* "off_123abc": { path: "events/ev_1234/tickets/tkt_567", offering: { name: "VIP Ticket", price: 3000 }),
|
|
1081
|
-
* "off_456def": { path: "events/ev_1234/tickets/tkt_567", offering: { name: "T-Shirt", price: 2000 }}
|
|
1082
|
-
* }
|
|
1126
|
+
* The unique cart session ID assigned at the time the cart was created.
|
|
1127
|
+
* Helps track cart attribution across systems.
|
|
1128
|
+
* @example "cart_sess_abc123"
|
|
1083
1129
|
*/
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1130
|
+
cartSessionId: string;
|
|
1131
|
+
/**
|
|
1132
|
+
* (Optional) Origin domain name if embedded or white-labeled.
|
|
1133
|
+
* Can help identify partner portals or iframe referrers.
|
|
1134
|
+
* @example "examplepartner.com"
|
|
1135
|
+
*/
|
|
1136
|
+
originDomain?: string;
|
|
1137
|
+
/**
|
|
1138
|
+
* (Optional) Campaign ID, UTM source, or tracking label.
|
|
1139
|
+
* Useful for affiliate and analytics systems.
|
|
1140
|
+
* @example "utm_campaign=spring_launch"
|
|
1141
|
+
*/
|
|
1142
|
+
trackingId?: string;
|
|
1143
|
+
/**
|
|
1144
|
+
* Allows custom fields for analytics, partners, or experiment data.
|
|
1145
|
+
*/
|
|
1146
|
+
[custom: string]: unknown;
|
|
1089
1147
|
}
|
|
1090
1148
|
/**
|
|
1091
1149
|
* Represents a temporary or persisted cart before order placement.
|
|
@@ -1093,7 +1151,8 @@ interface ResolvedCartContextOffering {
|
|
|
1093
1151
|
*
|
|
1094
1152
|
* @export
|
|
1095
1153
|
*/
|
|
1096
|
-
interface CartSession extends DataRecord, Pick<Order, "currency" | "contextId" | "version" | "coupons"> {
|
|
1154
|
+
interface CartSession extends DataRecord, Pick<Order, "currency" | "contextId" | "version" | "coupons" | "companyId" | "organizerId" | "meta"> {
|
|
1155
|
+
orderId?: string;
|
|
1097
1156
|
/**
|
|
1098
1157
|
* Authenticated user ID, if available.
|
|
1099
1158
|
* @example "uid_123abc"
|
|
@@ -1109,7 +1168,7 @@ interface CartSession extends DataRecord, Pick<Order, "currency" | "contextId" |
|
|
|
1109
1168
|
/**
|
|
1110
1169
|
* @schema lazy(() => orderContextSchema).optional()
|
|
1111
1170
|
*/
|
|
1112
|
-
context: Partial<OrderContext>;
|
|
1171
|
+
context: Partial<OrderContext$1>;
|
|
1113
1172
|
/**
|
|
1114
1173
|
* Items the user has added to their cart.
|
|
1115
1174
|
*/
|
|
@@ -1126,6 +1185,7 @@ interface CartSession extends DataRecord, Pick<Order, "currency" | "contextId" |
|
|
|
1126
1185
|
delivery: CurrencyAmount;
|
|
1127
1186
|
total: CurrencyAmount;
|
|
1128
1187
|
};
|
|
1188
|
+
paymentStatus: "pending" | "confirmed" | "failed" | "refunded";
|
|
1129
1189
|
/**
|
|
1130
1190
|
* Stripe PaymentIntent ID linked to this cart, if created.
|
|
1131
1191
|
* Used for confirming payment on the backend.
|
|
@@ -1142,38 +1202,67 @@ interface CartSession extends DataRecord, Pick<Order, "currency" | "contextId" |
|
|
|
1142
1202
|
* Partner-forwarded data (e.g. utm, session metadata).
|
|
1143
1203
|
*/
|
|
1144
1204
|
forwarded?: any;
|
|
1145
|
-
/**
|
|
1146
|
-
* Internal metadata, flags, debug hints, or experimental context.
|
|
1147
|
-
*/
|
|
1148
|
-
meta: {
|
|
1149
|
-
/**
|
|
1150
|
-
* Display context (event, venue, organizer) for rendering and logic.
|
|
1151
|
-
*/
|
|
1152
|
-
resolvedContext?: ResolvedCartContext;
|
|
1153
|
-
/**
|
|
1154
|
-
* Cost components to calculate the cart costs.
|
|
1155
|
-
*
|
|
1156
|
-
* @ignore
|
|
1157
|
-
*/
|
|
1158
|
-
costComponents?: CostComponent[];
|
|
1159
|
-
/**
|
|
1160
|
-
* Snapshot of when pricing was calculated and locked.
|
|
1161
|
-
* Useful for honoring totals during a grace window.
|
|
1162
|
-
*/
|
|
1163
|
-
priceLock?: {
|
|
1164
|
-
lockedAt: string;
|
|
1165
|
-
ttl?: number;
|
|
1166
|
-
};
|
|
1167
|
-
/**
|
|
1168
|
-
* Any additional internal system flags, A/B test conditions, or
|
|
1169
|
-
* non-critical partner payloads.
|
|
1170
|
-
*/
|
|
1171
|
-
[key: string]: any;
|
|
1172
|
-
};
|
|
1173
1205
|
status: "started" | "completed" | "abandoned" | "cancelled";
|
|
1174
1206
|
}
|
|
1175
1207
|
type UpdatableCartSession = Pick<CartSession, "customer" | "items">;
|
|
1176
1208
|
|
|
1209
|
+
/**
|
|
1210
|
+
* Pagination parameters for a paginated API request.
|
|
1211
|
+
*/
|
|
1212
|
+
interface Pagination {
|
|
1213
|
+
/** Number of results per page. */
|
|
1214
|
+
size: number;
|
|
1215
|
+
/** Page number (starting from 1). */
|
|
1216
|
+
page: number;
|
|
1217
|
+
/** Continuation */
|
|
1218
|
+
continuation?: string;
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
/**
|
|
1222
|
+
* Supported HTTP methods.
|
|
1223
|
+
*/
|
|
1224
|
+
type RequestMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
1225
|
+
type RequestOptions = {
|
|
1226
|
+
method?: RequestMethod;
|
|
1227
|
+
data?: any;
|
|
1228
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
1229
|
+
headers?: Record<string, string>;
|
|
1230
|
+
pagination?: Pagination;
|
|
1231
|
+
};
|
|
1232
|
+
/**
|
|
1233
|
+
* A function that performs a request to the Cohost API.
|
|
1234
|
+
* The generic <T> allows you to specify the expected response type.
|
|
1235
|
+
*/
|
|
1236
|
+
type RequestFn = <T = any>(path: string, options?: RequestOptions) => Promise<T>;
|
|
1237
|
+
|
|
1238
|
+
/**
|
|
1239
|
+
* Optional settings for customizing the behavior of the CohostClient.
|
|
1240
|
+
*/
|
|
1241
|
+
interface CohostClientSettings {
|
|
1242
|
+
/** Enable verbose debug output for all API requests. */
|
|
1243
|
+
debug?: boolean;
|
|
1244
|
+
/** Override the default API base URL (defaults to apiBaseUrl). */
|
|
1245
|
+
apiUrl?: string;
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
/**
|
|
1249
|
+
* Base class for all API endpoint groups within the Cohost SDK.
|
|
1250
|
+
* Provides shared access to the configured request function and settings.
|
|
1251
|
+
*/
|
|
1252
|
+
declare class CohostEndpoint {
|
|
1253
|
+
/** Shared request function injected from the client */
|
|
1254
|
+
protected request: RequestFn;
|
|
1255
|
+
/** Client settings passed during instantiation */
|
|
1256
|
+
protected settings: CohostClientSettings;
|
|
1257
|
+
/**
|
|
1258
|
+
* Constructs a new endpoint group.
|
|
1259
|
+
*
|
|
1260
|
+
* @param request - The shared request function for performing API calls
|
|
1261
|
+
* @param settings - The client-wide settings passed from the parent client
|
|
1262
|
+
*/
|
|
1263
|
+
constructor(request: RequestFn, settings: CohostClientSettings);
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1177
1266
|
/**
|
|
1178
1267
|
* Provides methods to interact with the Cohost Events API.
|
|
1179
1268
|
*
|
|
@@ -1211,6 +1300,15 @@ declare class EventsAPI extends CohostEndpoint {
|
|
|
1211
1300
|
* @throws Will throw an error if the request fails or the event does not exist
|
|
1212
1301
|
*/
|
|
1213
1302
|
tickets(id: string): Promise<Ticket[]>;
|
|
1303
|
+
/**
|
|
1304
|
+
* List attendees in the event.
|
|
1305
|
+
*
|
|
1306
|
+
* Requires: valid authentication token. This endpoint is not public.
|
|
1307
|
+
*
|
|
1308
|
+
* @param id - The ID of the event.
|
|
1309
|
+
* @returns List of tickets (attendees) for the event.
|
|
1310
|
+
*/
|
|
1311
|
+
attendees(id: string, filters?: PaginatedRequest<any>): Promise<PaginatedResponse<Attendee3>>;
|
|
1214
1312
|
}
|
|
1215
1313
|
|
|
1216
1314
|
/**
|