perspectapi-ts-sdk 6.5.9 → 7.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/README.md +46 -1011
- package/dist/chunk-MZ22HQBX.mjs +1451 -0
- package/dist/index-BL9-AZpq.d.mts +2227 -0
- package/dist/index-BL9-AZpq.d.ts +2227 -0
- package/dist/index.d.mts +130 -2221
- package/dist/index.d.ts +130 -2221
- package/dist/index.js +71 -7
- package/dist/index.mjs +13 -1364
- package/dist/v2/index.d.mts +1 -0
- package/dist/v2/index.d.ts +1 -0
- package/dist/v2/index.js +1477 -0
- package/dist/v2/index.mjs +40 -0
- package/docs/README.md +15 -0
- package/docs/v1-deprecated/README.md +9 -0
- package/docs/v1-deprecated/examples/README.md +324 -0
- package/docs/v1-deprecated/examples/basic-usage.ts +258 -0
- package/docs/v1-deprecated/examples/cloudflare-worker.ts +274 -0
- package/docs/v1-deprecated/examples/content-query-with-slug-prefix.ts +237 -0
- package/docs/v1-deprecated/examples/image-transforms.ts +200 -0
- package/docs/v1-deprecated/examples/site-user-checkout.ts +186 -0
- package/docs/v1-deprecated/examples/slug-prefix-examples.ts +491 -0
- package/docs/v1-deprecated/legacy-docs/caching.md +667 -0
- package/docs/v1-deprecated/legacy-docs/contact.md +1396 -0
- package/docs/v1-deprecated/legacy-docs/csrf-protection.md +664 -0
- package/docs/v1-deprecated/legacy-docs/image-transforms.md +523 -0
- package/docs/v1-deprecated/legacy-docs/loaders.md +304 -0
- package/docs/v1-deprecated/legacy-docs/newsletter.md +811 -0
- package/docs/v1-deprecated/legacy-docs/site-users.md +817 -0
- package/docs/v1-deprecated/legacy-notes/CHANGELOG-CHECKOUT.md +143 -0
- package/docs/v1-deprecated/legacy-notes/CSRF-CHECKOUT.md +271 -0
- package/docs/v1-deprecated/legacy-notes/IMAGE_TRANSFORMS_PORT.md +298 -0
- package/docs/v1-deprecated/sdk-readme.md +1076 -0
- package/examples/README.md +19 -0
- package/examples/basic-v2.ts +37 -0
- package/llms.txt +25 -0
- package/package.json +18 -7
- package/src/client/api-keys-client.ts +4 -0
- package/src/client/auth-client.ts +4 -0
- package/src/client/base-client.ts +7 -0
- package/src/client/bundles-client.ts +4 -0
- package/src/client/categories-client.ts +4 -0
- package/src/client/checkout-client.ts +4 -0
- package/src/client/contact-client.ts +4 -0
- package/src/client/content-client.ts +4 -0
- package/src/client/newsletter-client.ts +4 -0
- package/src/client/newsletter-management-client.ts +4 -0
- package/src/client/organizations-client.ts +4 -0
- package/src/client/products-client.ts +4 -0
- package/src/client/site-users-client.ts +10 -1
- package/src/client/sites-client.ts +4 -0
- package/src/client/webhooks-client.ts +4 -0
- package/src/deprecation.ts +2 -1
- package/src/index.ts +2 -1
- package/src/loaders.ts +59 -0
- package/src/perspect-api-client.ts +2 -2
- package/src/v2/client/orders-client.ts +89 -6
- package/src/v2/types.ts +3 -0
|
@@ -0,0 +1,2227 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cache-related types for the PerspectAPI SDK.
|
|
3
|
+
*/
|
|
4
|
+
type CacheKeyPart = string | number | boolean | null | undefined | Record<string, unknown> | Array<Record<string, unknown> | string | number | boolean | null | undefined>;
|
|
5
|
+
interface CacheSetOptions {
|
|
6
|
+
ttlSeconds?: number;
|
|
7
|
+
tags?: string[];
|
|
8
|
+
metadata?: Record<string, unknown>;
|
|
9
|
+
}
|
|
10
|
+
interface CachePolicy extends CacheSetOptions {
|
|
11
|
+
skipCache?: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface CacheAdapter {
|
|
14
|
+
/**
|
|
15
|
+
* Retrieve a raw cache payload for the given key. Implementations should return
|
|
16
|
+
* undefined (or null) when the key does not exist or has expired.
|
|
17
|
+
*/
|
|
18
|
+
get(key: string): Promise<string | undefined | null>;
|
|
19
|
+
/**
|
|
20
|
+
* Store a raw payload for the given key. Implementations MAY honour ttlSeconds
|
|
21
|
+
* natively; the cache manager will also persist expiry timestamps in the payload
|
|
22
|
+
* for adapters that do not have native TTL support.
|
|
23
|
+
*/
|
|
24
|
+
set(key: string, value: string, options?: {
|
|
25
|
+
ttlSeconds?: number;
|
|
26
|
+
}): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Remove a cached entry.
|
|
29
|
+
*/
|
|
30
|
+
delete(key: string): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Optional bulk delete implementation.
|
|
33
|
+
*/
|
|
34
|
+
deleteMany?(keys: string[]): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Optional clear method to wipe all entries for adapters that manage isolated namespaces.
|
|
37
|
+
*/
|
|
38
|
+
clear?(): Promise<void>;
|
|
39
|
+
}
|
|
40
|
+
interface CacheManagerOptions {
|
|
41
|
+
defaultTtlSeconds?: number;
|
|
42
|
+
keyPrefix?: string;
|
|
43
|
+
}
|
|
44
|
+
interface CacheConfig extends CacheManagerOptions {
|
|
45
|
+
/**
|
|
46
|
+
* Explicit flag to disable caching. Defaults to false when a cache configuration
|
|
47
|
+
* is supplied, so caching is considered enabled unless explicitly disabled.
|
|
48
|
+
*/
|
|
49
|
+
enabled?: boolean;
|
|
50
|
+
adapter?: CacheAdapter;
|
|
51
|
+
}
|
|
52
|
+
interface CacheInvalidateOptions {
|
|
53
|
+
keys?: string[];
|
|
54
|
+
tags?: string[];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* CacheManager orchestrates cache get/set/invalidate behaviour using a pluggable adapter.
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
declare class CacheManager {
|
|
62
|
+
private adapter;
|
|
63
|
+
private readonly defaultTtlSeconds;
|
|
64
|
+
private readonly keyPrefix;
|
|
65
|
+
private readonly enabled;
|
|
66
|
+
constructor(config?: CacheConfig);
|
|
67
|
+
isEnabled(): boolean;
|
|
68
|
+
getKeyPrefix(): string;
|
|
69
|
+
buildKey(parts: CacheKeyPart[]): string;
|
|
70
|
+
getOrSet<T>(key: string, resolveValue: () => Promise<T>, policy?: CachePolicy): Promise<T>;
|
|
71
|
+
set<T>(key: string, value: T, options?: CacheSetOptions): Promise<void>;
|
|
72
|
+
delete(key: string): Promise<void>;
|
|
73
|
+
invalidate(options: CacheInvalidateOptions): Promise<void>;
|
|
74
|
+
private namespacedKey;
|
|
75
|
+
private tagKey;
|
|
76
|
+
private serialize;
|
|
77
|
+
private deserialize;
|
|
78
|
+
private deserializeTagSet;
|
|
79
|
+
private registerKeyTags;
|
|
80
|
+
private removeKeyFromTags;
|
|
81
|
+
private normalizeKeyPart;
|
|
82
|
+
private normalizeObject;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Core types and interfaces for PerspectAPI SDK
|
|
87
|
+
*/
|
|
88
|
+
|
|
89
|
+
interface ApiResponse<T = any> {
|
|
90
|
+
data?: T;
|
|
91
|
+
message?: string;
|
|
92
|
+
error?: string;
|
|
93
|
+
success: boolean;
|
|
94
|
+
code?: string;
|
|
95
|
+
}
|
|
96
|
+
interface PaginationParams {
|
|
97
|
+
page?: number;
|
|
98
|
+
limit?: number;
|
|
99
|
+
offset?: number;
|
|
100
|
+
}
|
|
101
|
+
interface PaginatedResponse<T> extends ApiResponse<T[]> {
|
|
102
|
+
pagination?: {
|
|
103
|
+
page: number;
|
|
104
|
+
limit: number;
|
|
105
|
+
total: number;
|
|
106
|
+
totalPages: number;
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
interface User {
|
|
110
|
+
id: string;
|
|
111
|
+
email: string;
|
|
112
|
+
firstName?: string;
|
|
113
|
+
lastName?: string;
|
|
114
|
+
createdAt?: string;
|
|
115
|
+
isActive?: boolean;
|
|
116
|
+
}
|
|
117
|
+
interface ApiKey {
|
|
118
|
+
id: string;
|
|
119
|
+
name: string;
|
|
120
|
+
description?: string;
|
|
121
|
+
permissions: string[];
|
|
122
|
+
organizationId?: number;
|
|
123
|
+
siteName?: string;
|
|
124
|
+
isActive: boolean;
|
|
125
|
+
createdAt: string;
|
|
126
|
+
expiresAt?: string;
|
|
127
|
+
lastUsedAt?: string;
|
|
128
|
+
}
|
|
129
|
+
interface CreateApiKeyRequest {
|
|
130
|
+
name: string;
|
|
131
|
+
description?: string;
|
|
132
|
+
permissions: string[];
|
|
133
|
+
organizationId?: number;
|
|
134
|
+
siteName?: string;
|
|
135
|
+
expiresAt?: string;
|
|
136
|
+
}
|
|
137
|
+
interface UpdateApiKeyRequest {
|
|
138
|
+
name?: string;
|
|
139
|
+
description?: string;
|
|
140
|
+
permissions?: string[];
|
|
141
|
+
isActive?: boolean;
|
|
142
|
+
}
|
|
143
|
+
interface Organization {
|
|
144
|
+
id: number;
|
|
145
|
+
name: string;
|
|
146
|
+
description?: string;
|
|
147
|
+
createdAt: string;
|
|
148
|
+
updatedAt: string;
|
|
149
|
+
}
|
|
150
|
+
interface CreateOrganizationRequest {
|
|
151
|
+
name: string;
|
|
152
|
+
description?: string;
|
|
153
|
+
}
|
|
154
|
+
interface Site {
|
|
155
|
+
id: number;
|
|
156
|
+
name: string;
|
|
157
|
+
domain?: string;
|
|
158
|
+
managementDomain?: string;
|
|
159
|
+
description?: string;
|
|
160
|
+
organizationId: number;
|
|
161
|
+
isActive: boolean;
|
|
162
|
+
createdAt: string;
|
|
163
|
+
updatedAt: string;
|
|
164
|
+
}
|
|
165
|
+
interface CreateSiteRequest {
|
|
166
|
+
name: string;
|
|
167
|
+
domain?: string;
|
|
168
|
+
managementDomain?: string;
|
|
169
|
+
description?: string;
|
|
170
|
+
organizationId: number;
|
|
171
|
+
}
|
|
172
|
+
interface NewsletterSubscription {
|
|
173
|
+
id: string;
|
|
174
|
+
email: string;
|
|
175
|
+
name?: string;
|
|
176
|
+
status: 'pending' | 'confirmed' | 'unsubscribed' | 'bounced' | 'complained';
|
|
177
|
+
frequency: 'instant' | 'daily' | 'weekly' | 'monthly';
|
|
178
|
+
topics?: string[];
|
|
179
|
+
language: string;
|
|
180
|
+
confirmedAt?: string;
|
|
181
|
+
unsubscribedAt?: string;
|
|
182
|
+
createdAt: string;
|
|
183
|
+
updatedAt: string;
|
|
184
|
+
}
|
|
185
|
+
interface CreateNewsletterSubscriptionRequest {
|
|
186
|
+
email: string;
|
|
187
|
+
name?: string;
|
|
188
|
+
list_ids?: string[];
|
|
189
|
+
frequency?: 'instant' | 'daily' | 'weekly' | 'monthly';
|
|
190
|
+
topics?: string[];
|
|
191
|
+
language?: string;
|
|
192
|
+
source?: string;
|
|
193
|
+
source_url?: string;
|
|
194
|
+
metadata?: Record<string, any>;
|
|
195
|
+
}
|
|
196
|
+
interface NewsletterList {
|
|
197
|
+
id: string;
|
|
198
|
+
list_name: string;
|
|
199
|
+
slug: string;
|
|
200
|
+
description?: string;
|
|
201
|
+
is_default: boolean;
|
|
202
|
+
subscriber_count?: number;
|
|
203
|
+
}
|
|
204
|
+
interface NewsletterCampaignSummary {
|
|
205
|
+
id: string;
|
|
206
|
+
campaign_name: string;
|
|
207
|
+
slug: string;
|
|
208
|
+
slug_prefix?: string | null;
|
|
209
|
+
subject: string;
|
|
210
|
+
preview_text?: string | null;
|
|
211
|
+
status: string;
|
|
212
|
+
sent_at?: string | null;
|
|
213
|
+
completed_at?: string | null;
|
|
214
|
+
created_at: string;
|
|
215
|
+
updated_at: string;
|
|
216
|
+
}
|
|
217
|
+
interface NewsletterCampaignDetail extends NewsletterCampaignSummary {
|
|
218
|
+
markdown_content?: string | null;
|
|
219
|
+
html_content?: string | null;
|
|
220
|
+
text_content?: string | null;
|
|
221
|
+
excerpt?: string | null;
|
|
222
|
+
}
|
|
223
|
+
interface NewsletterCampaignListResponse {
|
|
224
|
+
items: NewsletterCampaignSummary[];
|
|
225
|
+
pagination: {
|
|
226
|
+
page: number;
|
|
227
|
+
limit: number;
|
|
228
|
+
total: number;
|
|
229
|
+
pages: number;
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
interface NewsletterPreferences {
|
|
233
|
+
frequency?: 'instant' | 'daily' | 'weekly' | 'monthly';
|
|
234
|
+
topics?: string[];
|
|
235
|
+
language?: string;
|
|
236
|
+
email_format?: 'html' | 'text' | 'both';
|
|
237
|
+
timezone?: string;
|
|
238
|
+
track_opens?: boolean;
|
|
239
|
+
track_clicks?: boolean;
|
|
240
|
+
}
|
|
241
|
+
interface NewsletterStatusResponse {
|
|
242
|
+
success: boolean;
|
|
243
|
+
code?: string;
|
|
244
|
+
subscribed: boolean;
|
|
245
|
+
status: string;
|
|
246
|
+
frequency?: string;
|
|
247
|
+
created_at?: string;
|
|
248
|
+
confirmed_at?: string;
|
|
249
|
+
}
|
|
250
|
+
interface NewsletterSubscribeResponse {
|
|
251
|
+
success: boolean;
|
|
252
|
+
code: string;
|
|
253
|
+
message: string;
|
|
254
|
+
status: string;
|
|
255
|
+
subscription_id?: string;
|
|
256
|
+
}
|
|
257
|
+
interface NewsletterConfirmResponse {
|
|
258
|
+
success: boolean;
|
|
259
|
+
code: string;
|
|
260
|
+
message: string;
|
|
261
|
+
status?: string;
|
|
262
|
+
subscription?: {
|
|
263
|
+
email: string;
|
|
264
|
+
name?: string;
|
|
265
|
+
frequency: string;
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
interface NewsletterUnsubscribeRequest {
|
|
269
|
+
token?: string;
|
|
270
|
+
email?: string;
|
|
271
|
+
reason?: string;
|
|
272
|
+
}
|
|
273
|
+
interface NewsletterUnsubscribeResponse {
|
|
274
|
+
success: boolean;
|
|
275
|
+
code: string;
|
|
276
|
+
message: string;
|
|
277
|
+
status?: string;
|
|
278
|
+
}
|
|
279
|
+
interface NewsletterManagementListMembership {
|
|
280
|
+
id: string;
|
|
281
|
+
list_name: string;
|
|
282
|
+
slug: string;
|
|
283
|
+
}
|
|
284
|
+
interface NewsletterManagementSubscription {
|
|
285
|
+
id: string;
|
|
286
|
+
site_id: string;
|
|
287
|
+
site_name: string;
|
|
288
|
+
email: string;
|
|
289
|
+
name?: string | null;
|
|
290
|
+
status: 'pending' | 'confirmed' | 'unsubscribed' | 'bounced' | 'complained';
|
|
291
|
+
confirmation_token?: string | null;
|
|
292
|
+
unsubscribe_token: string;
|
|
293
|
+
double_opt_in: boolean;
|
|
294
|
+
confirmed_at?: string | null;
|
|
295
|
+
source?: string | null;
|
|
296
|
+
source_url?: string | null;
|
|
297
|
+
frequency: 'instant' | 'daily' | 'weekly' | 'monthly';
|
|
298
|
+
topics?: string[] | string | null;
|
|
299
|
+
language: string;
|
|
300
|
+
tags?: string[] | string | null;
|
|
301
|
+
custom_fields?: Record<string, any> | string | null;
|
|
302
|
+
notes?: string | null;
|
|
303
|
+
unsubscribed_at?: string | null;
|
|
304
|
+
unsubscribe_reason?: string | null;
|
|
305
|
+
created_at: string;
|
|
306
|
+
updated_at: string;
|
|
307
|
+
lists: NewsletterManagementListMembership[];
|
|
308
|
+
}
|
|
309
|
+
interface NewsletterSubscriptionSyncRequest {
|
|
310
|
+
email: string;
|
|
311
|
+
name?: string | null;
|
|
312
|
+
status?: 'pending' | 'confirmed' | 'unsubscribed' | 'bounced' | 'complained';
|
|
313
|
+
list_ids?: string[];
|
|
314
|
+
frequency?: 'instant' | 'daily' | 'weekly' | 'monthly';
|
|
315
|
+
topics?: string[];
|
|
316
|
+
language?: string | null;
|
|
317
|
+
source?: string | null;
|
|
318
|
+
source_url?: string | null;
|
|
319
|
+
notes?: string | null;
|
|
320
|
+
tags?: string[];
|
|
321
|
+
metadata?: Record<string, any>;
|
|
322
|
+
resubscribe_override?: boolean;
|
|
323
|
+
}
|
|
324
|
+
interface NewsletterSubscriptionSyncResponse {
|
|
325
|
+
applied: boolean;
|
|
326
|
+
code: 'CREATED' | 'UPDATED' | 'RESUBSCRIBED' | 'ALREADY_UNSUBSCRIBED';
|
|
327
|
+
skipped_unsubscribed: boolean;
|
|
328
|
+
resubscribed: boolean;
|
|
329
|
+
created: boolean;
|
|
330
|
+
updated: boolean;
|
|
331
|
+
subscription_id: string;
|
|
332
|
+
subscription: NewsletterManagementSubscription;
|
|
333
|
+
}
|
|
334
|
+
type NewsletterSubscriptionsBulkAction = 'confirm' | 'unsubscribe' | 'delete' | 'add_to_list' | 'remove_from_list';
|
|
335
|
+
interface NewsletterSubscriptionsBulkUpdateRequest {
|
|
336
|
+
ids: string[];
|
|
337
|
+
action: NewsletterSubscriptionsBulkAction;
|
|
338
|
+
list_id?: string;
|
|
339
|
+
resubscribe_override?: boolean;
|
|
340
|
+
}
|
|
341
|
+
interface NewsletterSubscriptionsBulkOutcome {
|
|
342
|
+
id: string;
|
|
343
|
+
applied: boolean;
|
|
344
|
+
code: string;
|
|
345
|
+
error?: string;
|
|
346
|
+
skipped_unsubscribed?: boolean;
|
|
347
|
+
}
|
|
348
|
+
interface NewsletterSubscriptionsBulkUpdateResponse {
|
|
349
|
+
succeeded: number;
|
|
350
|
+
failed: number;
|
|
351
|
+
skipped_unsubscribed: number;
|
|
352
|
+
outcomes: NewsletterSubscriptionsBulkOutcome[];
|
|
353
|
+
}
|
|
354
|
+
interface NewsletterSubscriptionMembershipUpdateRequest {
|
|
355
|
+
mode: 'add' | 'remove' | 'replace';
|
|
356
|
+
list_ids: string[];
|
|
357
|
+
}
|
|
358
|
+
interface NewsletterSubscriptionImportRowRequest {
|
|
359
|
+
email: string;
|
|
360
|
+
name?: string | null;
|
|
361
|
+
status?: 'pending' | 'confirmed' | 'unsubscribed' | 'bounced' | 'complained';
|
|
362
|
+
list_ids?: string[];
|
|
363
|
+
frequency?: 'instant' | 'daily' | 'weekly' | 'monthly';
|
|
364
|
+
topics?: string[];
|
|
365
|
+
language?: string | null;
|
|
366
|
+
source?: string | null;
|
|
367
|
+
source_url?: string | null;
|
|
368
|
+
notes?: string | null;
|
|
369
|
+
tags?: string[];
|
|
370
|
+
metadata?: Record<string, any>;
|
|
371
|
+
resubscribe_override?: boolean;
|
|
372
|
+
}
|
|
373
|
+
interface NewsletterSubscriptionsImportRequest {
|
|
374
|
+
rows: NewsletterSubscriptionImportRowRequest[];
|
|
375
|
+
resubscribe_override?: boolean;
|
|
376
|
+
}
|
|
377
|
+
interface NewsletterSubscriptionsImportRowResult {
|
|
378
|
+
index: number;
|
|
379
|
+
email: string;
|
|
380
|
+
applied: boolean;
|
|
381
|
+
code: string;
|
|
382
|
+
skipped_unsubscribed: boolean;
|
|
383
|
+
resubscribed: boolean;
|
|
384
|
+
subscription_id: string;
|
|
385
|
+
}
|
|
386
|
+
interface NewsletterSubscriptionsImportResponse {
|
|
387
|
+
total: number;
|
|
388
|
+
processed: number;
|
|
389
|
+
applied: number;
|
|
390
|
+
created: number;
|
|
391
|
+
updated: number;
|
|
392
|
+
resubscribed: number;
|
|
393
|
+
skipped_unsubscribed: number;
|
|
394
|
+
rows: NewsletterSubscriptionsImportRowResult[];
|
|
395
|
+
}
|
|
396
|
+
interface NewsletterManagementPagination {
|
|
397
|
+
page: number;
|
|
398
|
+
limit: number;
|
|
399
|
+
total: number;
|
|
400
|
+
pages: number;
|
|
401
|
+
}
|
|
402
|
+
interface NewsletterManagementSubscriptionsListResponse {
|
|
403
|
+
items: NewsletterManagementSubscription[];
|
|
404
|
+
pagination: NewsletterManagementPagination;
|
|
405
|
+
}
|
|
406
|
+
interface NewsletterManagementList extends NewsletterList {
|
|
407
|
+
site_id: string;
|
|
408
|
+
site_name: string;
|
|
409
|
+
description?: string;
|
|
410
|
+
is_public: boolean;
|
|
411
|
+
is_default: boolean;
|
|
412
|
+
double_opt_in: boolean;
|
|
413
|
+
welcome_email_enabled: boolean;
|
|
414
|
+
subscriber_count: number;
|
|
415
|
+
status: 'active' | 'archived';
|
|
416
|
+
created_at: string;
|
|
417
|
+
updated_at: string;
|
|
418
|
+
}
|
|
419
|
+
interface NewsletterManagementSeries {
|
|
420
|
+
id: string;
|
|
421
|
+
site_id: string;
|
|
422
|
+
site_name: string;
|
|
423
|
+
series_name: string;
|
|
424
|
+
description?: string | null;
|
|
425
|
+
list_ids?: string | null;
|
|
426
|
+
from_name?: string | null;
|
|
427
|
+
from_email?: string | null;
|
|
428
|
+
reply_to_email?: string | null;
|
|
429
|
+
subject_prefix?: string | null;
|
|
430
|
+
cadence: 'manual' | 'daily' | 'weekly' | 'monthly';
|
|
431
|
+
timezone?: string | null;
|
|
432
|
+
send_time?: string | null;
|
|
433
|
+
day_of_week?: number | null;
|
|
434
|
+
day_of_month?: number | null;
|
|
435
|
+
status: 'active' | 'paused' | 'archived';
|
|
436
|
+
last_sent_at?: string | null;
|
|
437
|
+
next_send_at?: string | null;
|
|
438
|
+
tags?: string | null;
|
|
439
|
+
notes?: string | null;
|
|
440
|
+
created_at: string;
|
|
441
|
+
updated_at: string;
|
|
442
|
+
created_by?: string | null;
|
|
443
|
+
}
|
|
444
|
+
interface NewsletterManagementCampaign {
|
|
445
|
+
id: string;
|
|
446
|
+
site_id: string;
|
|
447
|
+
site_name: string;
|
|
448
|
+
series_id?: string | null;
|
|
449
|
+
series_name?: string | null;
|
|
450
|
+
campaign_name: string;
|
|
451
|
+
slug?: string | null;
|
|
452
|
+
slug_prefix?: string | null;
|
|
453
|
+
subject: string;
|
|
454
|
+
markdown_content?: string | null;
|
|
455
|
+
template_id?: string | null;
|
|
456
|
+
list_ids?: string | null;
|
|
457
|
+
tags?: string | null;
|
|
458
|
+
notes?: string | null;
|
|
459
|
+
preview_text?: string | null;
|
|
460
|
+
from_name?: string | null;
|
|
461
|
+
from_email?: string | null;
|
|
462
|
+
reply_to_email?: string | null;
|
|
463
|
+
status: 'draft' | 'scheduled' | 'sending' | 'sent' | 'cancelled';
|
|
464
|
+
scheduled_at?: string | null;
|
|
465
|
+
sent_at?: string | null;
|
|
466
|
+
completed_at?: string | null;
|
|
467
|
+
total_recipients?: number | null;
|
|
468
|
+
sent_count?: number | null;
|
|
469
|
+
delivered_count?: number | null;
|
|
470
|
+
opened_count?: number | null;
|
|
471
|
+
clicked_count?: number | null;
|
|
472
|
+
unsubscribed_count?: number | null;
|
|
473
|
+
bounced_count?: number | null;
|
|
474
|
+
complained_count?: number | null;
|
|
475
|
+
created_at: string;
|
|
476
|
+
updated_at: string;
|
|
477
|
+
}
|
|
478
|
+
interface NewsletterManagementCampaignListResponse {
|
|
479
|
+
items: NewsletterManagementCampaign[];
|
|
480
|
+
pagination: NewsletterManagementPagination;
|
|
481
|
+
}
|
|
482
|
+
interface NewsletterCampaignTestSendRequest {
|
|
483
|
+
to: string | string[];
|
|
484
|
+
subject?: string | null;
|
|
485
|
+
}
|
|
486
|
+
interface NewsletterCampaignTestSendResponse {
|
|
487
|
+
sent: number;
|
|
488
|
+
recipients: string[];
|
|
489
|
+
campaign_id: string;
|
|
490
|
+
}
|
|
491
|
+
interface NewsletterManagementStatsResponse {
|
|
492
|
+
total: number;
|
|
493
|
+
byStatus: Record<string, number>;
|
|
494
|
+
recentActivity: Array<{
|
|
495
|
+
date: string;
|
|
496
|
+
count: number;
|
|
497
|
+
}>;
|
|
498
|
+
}
|
|
499
|
+
interface NewsletterExportCreateRequest {
|
|
500
|
+
format?: 'csv' | 'json' | 'xlsx';
|
|
501
|
+
status?: 'pending' | 'confirmed' | 'unsubscribed' | 'bounced' | 'complained';
|
|
502
|
+
list_id?: string;
|
|
503
|
+
search?: string | null;
|
|
504
|
+
}
|
|
505
|
+
interface NewsletterExportCreateResponse {
|
|
506
|
+
exportId: string;
|
|
507
|
+
downloadUrl: string;
|
|
508
|
+
expiresAt: string;
|
|
509
|
+
format: 'csv' | 'json';
|
|
510
|
+
rowCount: number;
|
|
511
|
+
}
|
|
512
|
+
type ContentStatus = 'draft' | 'publish' | 'private' | 'trash';
|
|
513
|
+
type ContentType = 'post' | 'page' | 'block';
|
|
514
|
+
interface Content {
|
|
515
|
+
id: number;
|
|
516
|
+
pageTitle: string;
|
|
517
|
+
pageContent: string;
|
|
518
|
+
contentMarkdown?: string;
|
|
519
|
+
custom?: Record<string, any>;
|
|
520
|
+
slug?: string;
|
|
521
|
+
slug_prefix?: string;
|
|
522
|
+
pageStatus: ContentStatus;
|
|
523
|
+
pageType: ContentType;
|
|
524
|
+
media?: MediaItem[] | MediaItem[][];
|
|
525
|
+
image?: string;
|
|
526
|
+
userId?: number;
|
|
527
|
+
organizationId?: number;
|
|
528
|
+
createdAt: string;
|
|
529
|
+
updatedAt: string;
|
|
530
|
+
}
|
|
531
|
+
interface CreateContentRequest {
|
|
532
|
+
page_title: string;
|
|
533
|
+
page_content: string;
|
|
534
|
+
content_markdown?: string;
|
|
535
|
+
custom?: Record<string, any>;
|
|
536
|
+
slug?: string;
|
|
537
|
+
page_status?: ContentStatus;
|
|
538
|
+
page_type?: ContentType;
|
|
539
|
+
}
|
|
540
|
+
interface UpdateContentRequest extends Partial<CreateContentRequest> {
|
|
541
|
+
}
|
|
542
|
+
interface ContentQueryParams extends PaginationParams {
|
|
543
|
+
page_status?: ContentStatus;
|
|
544
|
+
page_type?: ContentType;
|
|
545
|
+
search?: string;
|
|
546
|
+
user_id?: number;
|
|
547
|
+
slug_prefix?: string;
|
|
548
|
+
recent?: number;
|
|
549
|
+
}
|
|
550
|
+
interface Category {
|
|
551
|
+
id: number;
|
|
552
|
+
name: string;
|
|
553
|
+
slug: string;
|
|
554
|
+
description?: string;
|
|
555
|
+
parentId?: number;
|
|
556
|
+
organizationId?: number;
|
|
557
|
+
createdAt: string;
|
|
558
|
+
updatedAt: string;
|
|
559
|
+
}
|
|
560
|
+
interface CategorySummary {
|
|
561
|
+
id: number;
|
|
562
|
+
name: string;
|
|
563
|
+
slug: string;
|
|
564
|
+
description?: string;
|
|
565
|
+
}
|
|
566
|
+
interface ContentCategoryResponse {
|
|
567
|
+
category: CategorySummary;
|
|
568
|
+
items: Content[];
|
|
569
|
+
pagination: {
|
|
570
|
+
page: number;
|
|
571
|
+
limit: number;
|
|
572
|
+
total: number;
|
|
573
|
+
pages: number;
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
interface CreateCategoryRequest {
|
|
577
|
+
name: string;
|
|
578
|
+
slug?: string;
|
|
579
|
+
description?: string;
|
|
580
|
+
parentId?: number;
|
|
581
|
+
}
|
|
582
|
+
interface MediaItem {
|
|
583
|
+
media_id: string;
|
|
584
|
+
attachment_id: number;
|
|
585
|
+
file_name: string;
|
|
586
|
+
link: string;
|
|
587
|
+
content_type: string;
|
|
588
|
+
width: number;
|
|
589
|
+
height: number;
|
|
590
|
+
filesize: number;
|
|
591
|
+
r2_key: string;
|
|
592
|
+
site_name: string;
|
|
593
|
+
}
|
|
594
|
+
interface ProductSkuMediaItem {
|
|
595
|
+
id?: string;
|
|
596
|
+
media_id: string;
|
|
597
|
+
file_name?: string;
|
|
598
|
+
fileName?: string;
|
|
599
|
+
link?: string;
|
|
600
|
+
url?: string;
|
|
601
|
+
content_type?: string;
|
|
602
|
+
contentType?: string;
|
|
603
|
+
width?: number;
|
|
604
|
+
height?: number;
|
|
605
|
+
filesize?: number;
|
|
606
|
+
r2_key?: string;
|
|
607
|
+
site_name?: string;
|
|
608
|
+
}
|
|
609
|
+
interface ProductSkuOption {
|
|
610
|
+
name: string;
|
|
611
|
+
key: string;
|
|
612
|
+
value: string;
|
|
613
|
+
label: string;
|
|
614
|
+
value_id: number;
|
|
615
|
+
}
|
|
616
|
+
interface ProductSku {
|
|
617
|
+
sku_id: number;
|
|
618
|
+
sku?: string | null;
|
|
619
|
+
combination_key: string;
|
|
620
|
+
media_id?: string | null;
|
|
621
|
+
media?: ProductSkuMediaItem | null;
|
|
622
|
+
options?: ProductSkuOption[];
|
|
623
|
+
unit_amount?: number;
|
|
624
|
+
currency?: string;
|
|
625
|
+
quantity_available?: number | null;
|
|
626
|
+
price?: number;
|
|
627
|
+
sale_price?: number;
|
|
628
|
+
stock_quantity?: number;
|
|
629
|
+
value_ids: number[];
|
|
630
|
+
created_at?: string;
|
|
631
|
+
updated_at?: string;
|
|
632
|
+
[key: string]: any;
|
|
633
|
+
}
|
|
634
|
+
interface Product {
|
|
635
|
+
id: number | string;
|
|
636
|
+
name?: string;
|
|
637
|
+
product?: string;
|
|
638
|
+
description?: string;
|
|
639
|
+
description_markdown?: string;
|
|
640
|
+
price?: number;
|
|
641
|
+
currency?: string;
|
|
642
|
+
sku?: string;
|
|
643
|
+
slug?: string;
|
|
644
|
+
slug_prefix?: string;
|
|
645
|
+
image?: string;
|
|
646
|
+
media?: MediaItem[] | MediaItem[][];
|
|
647
|
+
skus?: ProductSku[];
|
|
648
|
+
isActive?: boolean;
|
|
649
|
+
organizationId?: number;
|
|
650
|
+
createdAt?: string;
|
|
651
|
+
updatedAt?: string;
|
|
652
|
+
gateway_product_id_live?: string;
|
|
653
|
+
gateway_product_id_test?: string;
|
|
654
|
+
stripe_product_id_live?: string;
|
|
655
|
+
stripe_product_id_test?: string;
|
|
656
|
+
[key: string]: any;
|
|
657
|
+
}
|
|
658
|
+
interface CreateProductRequest {
|
|
659
|
+
product: string;
|
|
660
|
+
name?: string;
|
|
661
|
+
description?: string;
|
|
662
|
+
excerpt?: string;
|
|
663
|
+
price: number;
|
|
664
|
+
unit_amount: number;
|
|
665
|
+
currency?: string;
|
|
666
|
+
sku?: string;
|
|
667
|
+
slug?: string;
|
|
668
|
+
slug_prefix?: string;
|
|
669
|
+
published?: boolean;
|
|
670
|
+
custom?: Record<string, any>;
|
|
671
|
+
recurring?: {
|
|
672
|
+
interval: "day" | "week" | "month" | "year";
|
|
673
|
+
interval_count?: number;
|
|
674
|
+
};
|
|
675
|
+
stock_quantity?: number | null;
|
|
676
|
+
isActive?: boolean;
|
|
677
|
+
}
|
|
678
|
+
interface CreateProductSkuRequest {
|
|
679
|
+
sku?: string | null;
|
|
680
|
+
media_id?: string | null;
|
|
681
|
+
unit_amount?: number;
|
|
682
|
+
currency?: string;
|
|
683
|
+
quantity_available?: number | null;
|
|
684
|
+
price?: number | null;
|
|
685
|
+
stock_quantity?: number | null;
|
|
686
|
+
sale_price?: number | null;
|
|
687
|
+
published?: boolean;
|
|
688
|
+
gateway_price_id_test?: string | null;
|
|
689
|
+
gateway_price_id_live?: string | null;
|
|
690
|
+
value_ids: number[];
|
|
691
|
+
}
|
|
692
|
+
interface ProductQueryParams extends PaginationParams {
|
|
693
|
+
organizationId?: number;
|
|
694
|
+
isActive?: boolean;
|
|
695
|
+
search?: string;
|
|
696
|
+
category?: string | string[];
|
|
697
|
+
category_id?: number | string | Array<number | string>;
|
|
698
|
+
slug_prefix?: string;
|
|
699
|
+
}
|
|
700
|
+
interface BlogPost {
|
|
701
|
+
id: string | number;
|
|
702
|
+
slug: string;
|
|
703
|
+
slug_prefix?: string;
|
|
704
|
+
page_type?: string;
|
|
705
|
+
title: string;
|
|
706
|
+
content?: string;
|
|
707
|
+
excerpt?: string;
|
|
708
|
+
image?: string;
|
|
709
|
+
media?: MediaItem[] | MediaItem[][];
|
|
710
|
+
published?: boolean;
|
|
711
|
+
created_at?: string;
|
|
712
|
+
updated_at?: string;
|
|
713
|
+
description?: string;
|
|
714
|
+
published_date?: string;
|
|
715
|
+
author?: string;
|
|
716
|
+
tags?: string[];
|
|
717
|
+
[key: string]: any;
|
|
718
|
+
}
|
|
719
|
+
interface PaymentGateway {
|
|
720
|
+
id: number;
|
|
721
|
+
name: string;
|
|
722
|
+
provider: string;
|
|
723
|
+
isActive: boolean;
|
|
724
|
+
configuration: Record<string, any>;
|
|
725
|
+
organizationId?: number;
|
|
726
|
+
createdAt: string;
|
|
727
|
+
updatedAt: string;
|
|
728
|
+
}
|
|
729
|
+
interface CreatePaymentGatewayRequest {
|
|
730
|
+
name: string;
|
|
731
|
+
provider: string;
|
|
732
|
+
configuration: Record<string, any>;
|
|
733
|
+
isActive?: boolean;
|
|
734
|
+
}
|
|
735
|
+
type WebhookEventType = "content.created" | "content.updated" | "content.published" | "content.unpublished" | "content.deleted" | "newsletter.created" | "newsletter.updated" | "newsletter.published" | "newsletter.sent" | "newsletter.deleted" | "product.created" | "product.updated" | "product.deleted" | "product.stock_changed" | "order.paid" | "category.created" | "category.updated" | "category.deleted" | "site.updated" | "site.settings_changed" | "ab.flag_started" | "ab.flag_paused" | "ab.flag_resumed" | "ab.flag_stopped" | "ab.flag_updated" | "ab.config_warmup" | (string & Record<never, never>);
|
|
736
|
+
interface Webhook {
|
|
737
|
+
id: string;
|
|
738
|
+
name: string;
|
|
739
|
+
url: string;
|
|
740
|
+
provider: string;
|
|
741
|
+
events: WebhookEventType[];
|
|
742
|
+
isActive: boolean;
|
|
743
|
+
secret?: string;
|
|
744
|
+
organizationId?: number;
|
|
745
|
+
createdAt: string;
|
|
746
|
+
updatedAt: string;
|
|
747
|
+
}
|
|
748
|
+
interface CreateWebhookRequest {
|
|
749
|
+
name: string;
|
|
750
|
+
url: string;
|
|
751
|
+
provider: string;
|
|
752
|
+
events: WebhookEventType[];
|
|
753
|
+
isActive?: boolean;
|
|
754
|
+
secret?: string;
|
|
755
|
+
}
|
|
756
|
+
type CheckoutMetadataValue = string | number | boolean | null | CheckoutMetadataValue[] | {
|
|
757
|
+
[key: string]: CheckoutMetadataValue;
|
|
758
|
+
};
|
|
759
|
+
type CheckoutMetadata = Record<string, CheckoutMetadataValue>;
|
|
760
|
+
type CheckoutTaxStrategy = 'disabled' | 'gateway_auto' | 'manual_rates' | 'external_service';
|
|
761
|
+
type CheckoutTaxExemptionStatus = 'none' | 'exempt' | 'reverse_charge';
|
|
762
|
+
interface CheckoutAddress {
|
|
763
|
+
line1?: string;
|
|
764
|
+
line2?: string;
|
|
765
|
+
city?: string;
|
|
766
|
+
state?: string;
|
|
767
|
+
postal_code?: string;
|
|
768
|
+
country?: string;
|
|
769
|
+
}
|
|
770
|
+
interface CheckoutTaxCustomerExemptionRequest {
|
|
771
|
+
status?: CheckoutTaxExemptionStatus;
|
|
772
|
+
reason?: string;
|
|
773
|
+
tax_id?: string;
|
|
774
|
+
tax_id_type?: string;
|
|
775
|
+
certificate_url?: string;
|
|
776
|
+
metadata?: Record<string, any>;
|
|
777
|
+
expires_at?: string;
|
|
778
|
+
}
|
|
779
|
+
interface CheckoutTaxRequest {
|
|
780
|
+
strategy?: CheckoutTaxStrategy;
|
|
781
|
+
customer_identifier?: string;
|
|
782
|
+
customer_profile_id?: string;
|
|
783
|
+
customer_display_name?: string;
|
|
784
|
+
allow_exemption?: boolean;
|
|
785
|
+
require_tax_id?: boolean;
|
|
786
|
+
save_profile?: boolean;
|
|
787
|
+
customer_exemption?: CheckoutTaxCustomerExemptionRequest;
|
|
788
|
+
manual_rate_percent?: number;
|
|
789
|
+
manual_rate_map?: Record<string, number>;
|
|
790
|
+
external_service?: {
|
|
791
|
+
provider: string;
|
|
792
|
+
config?: Record<string, any>;
|
|
793
|
+
};
|
|
794
|
+
metadata?: Record<string, any>;
|
|
795
|
+
}
|
|
796
|
+
interface CreateCheckoutSessionRequest {
|
|
797
|
+
priceId?: string;
|
|
798
|
+
quantity?: number;
|
|
799
|
+
line_items?: Array<{
|
|
800
|
+
price?: string;
|
|
801
|
+
quantity: number;
|
|
802
|
+
sku_id?: number;
|
|
803
|
+
product_id?: number;
|
|
804
|
+
price_data?: {
|
|
805
|
+
currency: string;
|
|
806
|
+
product_data: {
|
|
807
|
+
name: string;
|
|
808
|
+
description?: string;
|
|
809
|
+
images?: string[];
|
|
810
|
+
};
|
|
811
|
+
unit_amount: number;
|
|
812
|
+
};
|
|
813
|
+
}>;
|
|
814
|
+
success_url: string;
|
|
815
|
+
cancel_url: string;
|
|
816
|
+
successUrl?: string;
|
|
817
|
+
cancelUrl?: string;
|
|
818
|
+
customer_email?: string;
|
|
819
|
+
customerEmail?: string;
|
|
820
|
+
site_user_id?: string;
|
|
821
|
+
referral_code?: string;
|
|
822
|
+
referrer_site_user_id?: string;
|
|
823
|
+
currency?: string;
|
|
824
|
+
metadata?: CheckoutMetadata;
|
|
825
|
+
mode?: 'payment' | 'subscription' | 'setup';
|
|
826
|
+
automatic_tax?: {
|
|
827
|
+
enabled: boolean;
|
|
828
|
+
};
|
|
829
|
+
shipping_address_collection?: {
|
|
830
|
+
allowed_countries: string[];
|
|
831
|
+
};
|
|
832
|
+
billing_address_collection?: 'auto' | 'required';
|
|
833
|
+
shipping_amount?: number;
|
|
834
|
+
shippingAmount?: number;
|
|
835
|
+
shipping_address?: CheckoutAddress;
|
|
836
|
+
shippingAddress?: CheckoutAddress;
|
|
837
|
+
billing_address?: CheckoutAddress;
|
|
838
|
+
billingAddress?: CheckoutAddress;
|
|
839
|
+
tax?: CheckoutTaxRequest;
|
|
840
|
+
}
|
|
841
|
+
interface CheckoutTaxBreakdownItem {
|
|
842
|
+
jurisdiction: string;
|
|
843
|
+
rate_percent: number;
|
|
844
|
+
tax_amount: number;
|
|
845
|
+
taxable_amount: number;
|
|
846
|
+
source: 'manual_map' | 'manual_percent' | 'gateway' | 'external';
|
|
847
|
+
}
|
|
848
|
+
interface CheckoutSessionTax {
|
|
849
|
+
amount: number;
|
|
850
|
+
currency: string;
|
|
851
|
+
strategy: CheckoutTaxStrategy;
|
|
852
|
+
exemption_applied: boolean;
|
|
853
|
+
exemption_status: CheckoutTaxExemptionStatus;
|
|
854
|
+
breakdown?: CheckoutTaxBreakdownItem[] | null;
|
|
855
|
+
}
|
|
856
|
+
interface CheckoutSession {
|
|
857
|
+
id: string;
|
|
858
|
+
url: string;
|
|
859
|
+
status: string;
|
|
860
|
+
payment_status?: string;
|
|
861
|
+
tax?: CheckoutSessionTax | null;
|
|
862
|
+
}
|
|
863
|
+
interface ContactSubmission {
|
|
864
|
+
id: string;
|
|
865
|
+
name: string;
|
|
866
|
+
email: string;
|
|
867
|
+
subject?: string;
|
|
868
|
+
message: string;
|
|
869
|
+
status: string;
|
|
870
|
+
createdAt: string;
|
|
871
|
+
}
|
|
872
|
+
interface CreateContactRequest {
|
|
873
|
+
name: string;
|
|
874
|
+
email: string;
|
|
875
|
+
subject?: string;
|
|
876
|
+
message: string;
|
|
877
|
+
}
|
|
878
|
+
interface ContactSubmitResponse {
|
|
879
|
+
success: boolean;
|
|
880
|
+
code: string;
|
|
881
|
+
contact_id: string;
|
|
882
|
+
message: string;
|
|
883
|
+
status: string;
|
|
884
|
+
}
|
|
885
|
+
interface ContactStatusResponse {
|
|
886
|
+
success: boolean;
|
|
887
|
+
code: string;
|
|
888
|
+
contact_id: string;
|
|
889
|
+
status: string;
|
|
890
|
+
submitted_at: string;
|
|
891
|
+
processed_at?: string;
|
|
892
|
+
metadata?: Record<string, any>;
|
|
893
|
+
}
|
|
894
|
+
interface SiteUser {
|
|
895
|
+
id: string;
|
|
896
|
+
email: string;
|
|
897
|
+
first_name?: string;
|
|
898
|
+
last_name?: string;
|
|
899
|
+
avatar_url?: string;
|
|
900
|
+
status: 'active' | 'suspended' | 'pending_verification';
|
|
901
|
+
email_verified: boolean;
|
|
902
|
+
waitlist: boolean;
|
|
903
|
+
metadata?: Record<string, any>;
|
|
904
|
+
created_at: string;
|
|
905
|
+
last_login_at?: string;
|
|
906
|
+
}
|
|
907
|
+
interface SiteUserProfile {
|
|
908
|
+
[key: string]: {
|
|
909
|
+
value: any;
|
|
910
|
+
updated_at: string;
|
|
911
|
+
};
|
|
912
|
+
}
|
|
913
|
+
interface SiteUserSubscription {
|
|
914
|
+
id: string;
|
|
915
|
+
provider: string;
|
|
916
|
+
provider_subscription_id?: string;
|
|
917
|
+
plan_name?: string;
|
|
918
|
+
plan_id?: string;
|
|
919
|
+
status: 'active' | 'past_due' | 'canceled' | 'paused' | 'trialing' | 'expired' | 'incomplete';
|
|
920
|
+
amount?: number;
|
|
921
|
+
currency?: string;
|
|
922
|
+
billing_interval?: string;
|
|
923
|
+
billing_interval_count?: number;
|
|
924
|
+
current_period_start?: string;
|
|
925
|
+
current_period_end?: string;
|
|
926
|
+
trial_start?: string;
|
|
927
|
+
trial_end?: string;
|
|
928
|
+
canceled_at?: string;
|
|
929
|
+
cancel_at_period_end: boolean;
|
|
930
|
+
created_at: string;
|
|
931
|
+
updated_at: string;
|
|
932
|
+
}
|
|
933
|
+
interface SiteUserOrder {
|
|
934
|
+
session_id: string;
|
|
935
|
+
order_id?: string;
|
|
936
|
+
customer_email?: string;
|
|
937
|
+
amount_total: number;
|
|
938
|
+
currency: string;
|
|
939
|
+
status: string;
|
|
940
|
+
payment_status?: string;
|
|
941
|
+
fulfillment_status?: string;
|
|
942
|
+
line_items: any[];
|
|
943
|
+
created_at: string;
|
|
944
|
+
completed_at?: string;
|
|
945
|
+
}
|
|
946
|
+
type SubscriptionCancellationMode = 'immediate' | 'period_end' | 'scheduled';
|
|
947
|
+
interface CancelSubscriptionRequest {
|
|
948
|
+
mode?: SubscriptionCancellationMode;
|
|
949
|
+
cancel_at?: string;
|
|
950
|
+
delay_days?: number;
|
|
951
|
+
delay_hours?: number;
|
|
952
|
+
delay_minutes?: number;
|
|
953
|
+
}
|
|
954
|
+
interface CancelSubscriptionResponse {
|
|
955
|
+
success: boolean;
|
|
956
|
+
message: string;
|
|
957
|
+
cancellation?: {
|
|
958
|
+
mode: SubscriptionCancellationMode;
|
|
959
|
+
status: string;
|
|
960
|
+
cancel_at_period_end: boolean;
|
|
961
|
+
effective_at: string | null;
|
|
962
|
+
scheduled_cancel_at: string | null;
|
|
963
|
+
};
|
|
964
|
+
}
|
|
965
|
+
interface CreditTransaction {
|
|
966
|
+
id: number;
|
|
967
|
+
amount_cents: number;
|
|
968
|
+
balance_after_cents: number;
|
|
969
|
+
type: string;
|
|
970
|
+
description: string | null;
|
|
971
|
+
created_at: string;
|
|
972
|
+
}
|
|
973
|
+
interface CreditBalance {
|
|
974
|
+
balance_cents: number;
|
|
975
|
+
}
|
|
976
|
+
interface CreditBalanceWithTransactions extends CreditBalance {
|
|
977
|
+
transactions: CreditTransaction[];
|
|
978
|
+
}
|
|
979
|
+
interface GrantCreditRequest {
|
|
980
|
+
amount_cents: number;
|
|
981
|
+
description: string;
|
|
982
|
+
}
|
|
983
|
+
interface RequestOtpRequest {
|
|
984
|
+
email: string;
|
|
985
|
+
waitlist?: boolean;
|
|
986
|
+
metadata?: Record<string, any>;
|
|
987
|
+
}
|
|
988
|
+
interface VerifyOtpRequest {
|
|
989
|
+
email: string;
|
|
990
|
+
code: string;
|
|
991
|
+
}
|
|
992
|
+
interface VerifyOtpResponse {
|
|
993
|
+
success: boolean;
|
|
994
|
+
token: string;
|
|
995
|
+
user: {
|
|
996
|
+
id: string;
|
|
997
|
+
email: string;
|
|
998
|
+
first_name?: string;
|
|
999
|
+
last_name?: string;
|
|
1000
|
+
avatar_url?: string;
|
|
1001
|
+
};
|
|
1002
|
+
}
|
|
1003
|
+
interface UpdateSiteUserRequest {
|
|
1004
|
+
first_name?: string;
|
|
1005
|
+
last_name?: string;
|
|
1006
|
+
avatar_url?: string;
|
|
1007
|
+
metadata?: Record<string, any>;
|
|
1008
|
+
}
|
|
1009
|
+
interface SetProfileValueRequest {
|
|
1010
|
+
value: string;
|
|
1011
|
+
}
|
|
1012
|
+
interface ProductBundleGroup {
|
|
1013
|
+
bundle_group_id: number;
|
|
1014
|
+
product_id: number;
|
|
1015
|
+
name: string;
|
|
1016
|
+
description?: string;
|
|
1017
|
+
quantity: number;
|
|
1018
|
+
position: number;
|
|
1019
|
+
created_at: string;
|
|
1020
|
+
updated_at: string;
|
|
1021
|
+
}
|
|
1022
|
+
interface CreateBundleGroupRequest {
|
|
1023
|
+
name: string;
|
|
1024
|
+
description?: string;
|
|
1025
|
+
quantity: number;
|
|
1026
|
+
position?: number;
|
|
1027
|
+
}
|
|
1028
|
+
interface BundleCollection {
|
|
1029
|
+
collection_id: number;
|
|
1030
|
+
site_id: string;
|
|
1031
|
+
site_name: string;
|
|
1032
|
+
name: string;
|
|
1033
|
+
description?: string;
|
|
1034
|
+
available_from?: string;
|
|
1035
|
+
available_until?: string;
|
|
1036
|
+
custom?: Record<string, any> | string | null;
|
|
1037
|
+
published: number;
|
|
1038
|
+
created_at: string;
|
|
1039
|
+
updated_at: string;
|
|
1040
|
+
}
|
|
1041
|
+
interface CreateBundleCollectionRequest {
|
|
1042
|
+
name: string;
|
|
1043
|
+
description?: string;
|
|
1044
|
+
available_from?: string;
|
|
1045
|
+
available_until?: string;
|
|
1046
|
+
custom?: Record<string, any> | null;
|
|
1047
|
+
published?: number;
|
|
1048
|
+
}
|
|
1049
|
+
interface BundleCollectionItem {
|
|
1050
|
+
id: number;
|
|
1051
|
+
collection_id: number;
|
|
1052
|
+
product_id: number;
|
|
1053
|
+
max_quantity?: number;
|
|
1054
|
+
position: number;
|
|
1055
|
+
created_at: string;
|
|
1056
|
+
updated_at: string;
|
|
1057
|
+
}
|
|
1058
|
+
interface BundleCollectionItemWithProduct extends BundleCollectionItem {
|
|
1059
|
+
product_name: string;
|
|
1060
|
+
slug: string;
|
|
1061
|
+
unit_amount: number;
|
|
1062
|
+
currency: string;
|
|
1063
|
+
image_url?: string;
|
|
1064
|
+
}
|
|
1065
|
+
interface AddCollectionItemRequest {
|
|
1066
|
+
product_id: number;
|
|
1067
|
+
max_quantity?: number;
|
|
1068
|
+
position?: number;
|
|
1069
|
+
}
|
|
1070
|
+
interface ApiError {
|
|
1071
|
+
message: string;
|
|
1072
|
+
code?: string;
|
|
1073
|
+
status?: number;
|
|
1074
|
+
details?: any;
|
|
1075
|
+
}
|
|
1076
|
+
declare class PerspectApiError extends Error implements ApiError {
|
|
1077
|
+
code?: string;
|
|
1078
|
+
status?: number;
|
|
1079
|
+
details?: any;
|
|
1080
|
+
constructor({ message, code, status, details }: ApiError);
|
|
1081
|
+
}
|
|
1082
|
+
interface PerspectApiConfig {
|
|
1083
|
+
baseUrl: string;
|
|
1084
|
+
apiKey?: string;
|
|
1085
|
+
jwt?: string;
|
|
1086
|
+
timeout?: number;
|
|
1087
|
+
retries?: number;
|
|
1088
|
+
headers?: Record<string, string>;
|
|
1089
|
+
cache?: CacheConfig;
|
|
1090
|
+
}
|
|
1091
|
+
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
1092
|
+
interface RequestOptions {
|
|
1093
|
+
method?: HttpMethod;
|
|
1094
|
+
headers?: Record<string, string>;
|
|
1095
|
+
body?: any;
|
|
1096
|
+
params?: Record<string, string | number | boolean>;
|
|
1097
|
+
timeout?: number;
|
|
1098
|
+
csrfToken?: string;
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
/**
|
|
1102
|
+
* HTTP Client for PerspectAPI SDK
|
|
1103
|
+
* Cloudflare Workers compatible - uses native fetch API
|
|
1104
|
+
*/
|
|
1105
|
+
|
|
1106
|
+
declare class HttpClient {
|
|
1107
|
+
private baseUrl;
|
|
1108
|
+
private defaultHeaders;
|
|
1109
|
+
private timeout;
|
|
1110
|
+
private retries;
|
|
1111
|
+
constructor(config: PerspectApiConfig);
|
|
1112
|
+
/**
|
|
1113
|
+
* Update authentication token
|
|
1114
|
+
*/
|
|
1115
|
+
setAuth(jwt: string): void;
|
|
1116
|
+
/**
|
|
1117
|
+
* Update API key
|
|
1118
|
+
*/
|
|
1119
|
+
setApiKey(apiKey: string): void;
|
|
1120
|
+
/**
|
|
1121
|
+
* Whether this client currently has a site-user/admin bearer token attached.
|
|
1122
|
+
* Bearer-scoped GETs must not share cache entries across callers.
|
|
1123
|
+
*/
|
|
1124
|
+
hasBearerAuth(): boolean;
|
|
1125
|
+
/**
|
|
1126
|
+
* Remove authentication
|
|
1127
|
+
*/
|
|
1128
|
+
clearAuth(): void;
|
|
1129
|
+
/**
|
|
1130
|
+
* Make HTTP request with retry logic
|
|
1131
|
+
*/
|
|
1132
|
+
request<T = any>(endpoint: string, options?: RequestOptions): Promise<ApiResponse<T>>;
|
|
1133
|
+
/**
|
|
1134
|
+
* GET request
|
|
1135
|
+
*/
|
|
1136
|
+
get<T = any>(endpoint: string, params?: Record<string, any>): Promise<ApiResponse<T>>;
|
|
1137
|
+
/**
|
|
1138
|
+
* POST request
|
|
1139
|
+
*/
|
|
1140
|
+
post<T = any>(endpoint: string, body?: any, options?: Partial<RequestOptions>): Promise<ApiResponse<T>>;
|
|
1141
|
+
/**
|
|
1142
|
+
* PUT request
|
|
1143
|
+
*/
|
|
1144
|
+
put<T = any>(endpoint: string, body?: any, options?: Partial<RequestOptions>): Promise<ApiResponse<T>>;
|
|
1145
|
+
/**
|
|
1146
|
+
* DELETE request
|
|
1147
|
+
*/
|
|
1148
|
+
delete<T = any>(endpoint: string, options?: Partial<RequestOptions>): Promise<ApiResponse<T>>;
|
|
1149
|
+
/**
|
|
1150
|
+
* PATCH request
|
|
1151
|
+
*/
|
|
1152
|
+
patch<T = any>(endpoint: string, body?: any, options?: Partial<RequestOptions>): Promise<ApiResponse<T>>;
|
|
1153
|
+
/**
|
|
1154
|
+
* Build full URL with query parameters
|
|
1155
|
+
*/
|
|
1156
|
+
private buildUrl;
|
|
1157
|
+
/**
|
|
1158
|
+
* Build request options
|
|
1159
|
+
*/
|
|
1160
|
+
private buildRequestOptions;
|
|
1161
|
+
/**
|
|
1162
|
+
* Fetch with timeout support
|
|
1163
|
+
*/
|
|
1164
|
+
private fetchWithTimeout;
|
|
1165
|
+
/**
|
|
1166
|
+
* Handle response and errors
|
|
1167
|
+
*/
|
|
1168
|
+
private handleResponse;
|
|
1169
|
+
/**
|
|
1170
|
+
* Delay utility for retries
|
|
1171
|
+
*/
|
|
1172
|
+
private delay;
|
|
1173
|
+
}
|
|
1174
|
+
/**
|
|
1175
|
+
* Create API Error from unknown error
|
|
1176
|
+
*/
|
|
1177
|
+
declare function createApiError(error: unknown): ApiError;
|
|
1178
|
+
|
|
1179
|
+
/**
|
|
1180
|
+
* v2 SDK Types — matches the API wire format exactly (snake_case).
|
|
1181
|
+
*
|
|
1182
|
+
* These types reflect the actual JSON returned by /api/v2/ endpoints.
|
|
1183
|
+
* No transformation layer is needed in the SDK.
|
|
1184
|
+
*/
|
|
1185
|
+
interface V2Object {
|
|
1186
|
+
object: string;
|
|
1187
|
+
id: string;
|
|
1188
|
+
}
|
|
1189
|
+
interface V2List<T> {
|
|
1190
|
+
object: "list";
|
|
1191
|
+
data: T[];
|
|
1192
|
+
has_more: boolean;
|
|
1193
|
+
url: string;
|
|
1194
|
+
}
|
|
1195
|
+
interface V2Deleted {
|
|
1196
|
+
object: string;
|
|
1197
|
+
id: string;
|
|
1198
|
+
deleted: true;
|
|
1199
|
+
}
|
|
1200
|
+
interface V2Error {
|
|
1201
|
+
error: {
|
|
1202
|
+
type: V2ErrorType;
|
|
1203
|
+
code: string;
|
|
1204
|
+
message: string;
|
|
1205
|
+
param?: string;
|
|
1206
|
+
};
|
|
1207
|
+
}
|
|
1208
|
+
type V2ErrorType = "invalid_request_error" | "authentication_error" | "permission_error" | "not_found_error" | "rate_limit_error" | "api_error";
|
|
1209
|
+
interface V2PaginationParams {
|
|
1210
|
+
limit?: number;
|
|
1211
|
+
starting_after?: string;
|
|
1212
|
+
ending_before?: string;
|
|
1213
|
+
}
|
|
1214
|
+
interface V2Media extends V2Object {
|
|
1215
|
+
object: "media";
|
|
1216
|
+
file_name: string;
|
|
1217
|
+
url: string;
|
|
1218
|
+
content_type: string | null;
|
|
1219
|
+
width: number | null;
|
|
1220
|
+
height: number | null;
|
|
1221
|
+
filesize: number | null;
|
|
1222
|
+
caption: string | null;
|
|
1223
|
+
alt_text: string | null;
|
|
1224
|
+
}
|
|
1225
|
+
interface V2Content extends V2Object {
|
|
1226
|
+
object: "content";
|
|
1227
|
+
title: string;
|
|
1228
|
+
content: string;
|
|
1229
|
+
markdown: string | null;
|
|
1230
|
+
excerpt: string | null;
|
|
1231
|
+
slug: string;
|
|
1232
|
+
slug_prefix: string | null;
|
|
1233
|
+
type: "post" | "page" | "block";
|
|
1234
|
+
status: "draft" | "publish" | "private" | "trash" | "scheduled";
|
|
1235
|
+
author: string | null;
|
|
1236
|
+
custom: Record<string, unknown> | null;
|
|
1237
|
+
featured_image: string | null;
|
|
1238
|
+
media: V2Media[];
|
|
1239
|
+
scheduled_at: string | null;
|
|
1240
|
+
published_at: string;
|
|
1241
|
+
updated_at: string;
|
|
1242
|
+
}
|
|
1243
|
+
interface V2ContentCreateParams {
|
|
1244
|
+
title: string;
|
|
1245
|
+
content: string;
|
|
1246
|
+
markdown?: string;
|
|
1247
|
+
excerpt?: string;
|
|
1248
|
+
custom?: Record<string, unknown>;
|
|
1249
|
+
slug?: string;
|
|
1250
|
+
slug_prefix?: string;
|
|
1251
|
+
published_at?: string;
|
|
1252
|
+
scheduled_at?: string | null;
|
|
1253
|
+
status?: "draft" | "publish" | "private" | "trash" | "scheduled";
|
|
1254
|
+
type?: "post" | "page" | "block";
|
|
1255
|
+
}
|
|
1256
|
+
interface V2ContentUpdateParams extends Partial<V2ContentCreateParams> {
|
|
1257
|
+
}
|
|
1258
|
+
interface V2ContentListParams extends V2PaginationParams {
|
|
1259
|
+
status?: "draft" | "publish" | "private" | "trash" | "scheduled";
|
|
1260
|
+
type?: "post" | "page" | "block";
|
|
1261
|
+
search?: string;
|
|
1262
|
+
slug_prefix?: string;
|
|
1263
|
+
category?: string;
|
|
1264
|
+
}
|
|
1265
|
+
interface V2Product extends V2Object {
|
|
1266
|
+
object: "product";
|
|
1267
|
+
name: string;
|
|
1268
|
+
description: string | null;
|
|
1269
|
+
excerpt: string | null;
|
|
1270
|
+
meta_description: string | null;
|
|
1271
|
+
price: number;
|
|
1272
|
+
unit_amount: number;
|
|
1273
|
+
currency: string;
|
|
1274
|
+
sku: string | null;
|
|
1275
|
+
slug: string | null;
|
|
1276
|
+
slug_prefix: string | null;
|
|
1277
|
+
published: boolean;
|
|
1278
|
+
stock_quantity: number | null;
|
|
1279
|
+
custom: Record<string, unknown> | null;
|
|
1280
|
+
recurring: {
|
|
1281
|
+
interval: string;
|
|
1282
|
+
interval_count?: number;
|
|
1283
|
+
} | null;
|
|
1284
|
+
tax_behavior: "inclusive" | "exclusive" | "unspecified" | null;
|
|
1285
|
+
category_id: string | null;
|
|
1286
|
+
gateway_product_id_test: string | null;
|
|
1287
|
+
gateway_product_id_live: string | null;
|
|
1288
|
+
gateway_price_id_test: string | null;
|
|
1289
|
+
gateway_price_id_live: string | null;
|
|
1290
|
+
media: V2Media[];
|
|
1291
|
+
created_at: string | null;
|
|
1292
|
+
updated_at: string | null;
|
|
1293
|
+
}
|
|
1294
|
+
interface V2ProductCreateParams {
|
|
1295
|
+
name: string;
|
|
1296
|
+
description?: string;
|
|
1297
|
+
excerpt?: string;
|
|
1298
|
+
meta_description?: string;
|
|
1299
|
+
category_id?: string;
|
|
1300
|
+
price: number;
|
|
1301
|
+
unit_amount: number;
|
|
1302
|
+
currency?: string;
|
|
1303
|
+
sku?: string;
|
|
1304
|
+
custom?: Record<string, unknown>;
|
|
1305
|
+
slug?: string;
|
|
1306
|
+
slug_prefix?: string;
|
|
1307
|
+
published?: boolean;
|
|
1308
|
+
stock_quantity?: number | null;
|
|
1309
|
+
recurring?: {
|
|
1310
|
+
interval: "day" | "week" | "month" | "year";
|
|
1311
|
+
interval_count?: number;
|
|
1312
|
+
};
|
|
1313
|
+
tax_behavior?: "inclusive" | "exclusive" | "unspecified";
|
|
1314
|
+
attachment_ids?: number[];
|
|
1315
|
+
}
|
|
1316
|
+
interface V2ProductUpdateParams extends Partial<V2ProductCreateParams> {
|
|
1317
|
+
}
|
|
1318
|
+
interface V2ProductListParams extends V2PaginationParams {
|
|
1319
|
+
published?: boolean;
|
|
1320
|
+
category_id?: string;
|
|
1321
|
+
search?: string;
|
|
1322
|
+
slug_prefix?: string;
|
|
1323
|
+
}
|
|
1324
|
+
interface V2Category extends V2Object {
|
|
1325
|
+
object: "category";
|
|
1326
|
+
name: string;
|
|
1327
|
+
description: string | null;
|
|
1328
|
+
slug: string | null;
|
|
1329
|
+
slug_prefix: string | null;
|
|
1330
|
+
parent_id: string | null;
|
|
1331
|
+
type: "post" | "product" | null;
|
|
1332
|
+
created_at: string | null;
|
|
1333
|
+
updated_at: string | null;
|
|
1334
|
+
}
|
|
1335
|
+
interface V2CategoryCreateParams {
|
|
1336
|
+
name: string;
|
|
1337
|
+
description?: string;
|
|
1338
|
+
slug?: string;
|
|
1339
|
+
slug_prefix?: string;
|
|
1340
|
+
parent_id?: string;
|
|
1341
|
+
type?: "post" | "product";
|
|
1342
|
+
}
|
|
1343
|
+
interface V2CategoryUpdateParams extends Partial<V2CategoryCreateParams> {
|
|
1344
|
+
}
|
|
1345
|
+
interface V2Collection extends V2Object {
|
|
1346
|
+
object: "collection";
|
|
1347
|
+
name: string;
|
|
1348
|
+
description: string | null;
|
|
1349
|
+
available_from: string | null;
|
|
1350
|
+
available_until: string | null;
|
|
1351
|
+
custom: Record<string, unknown> | null;
|
|
1352
|
+
published: boolean;
|
|
1353
|
+
created_at: string | null;
|
|
1354
|
+
updated_at: string | null;
|
|
1355
|
+
}
|
|
1356
|
+
interface V2CollectionItem extends V2Object {
|
|
1357
|
+
object: "collection_item";
|
|
1358
|
+
collection_id: string;
|
|
1359
|
+
product_id: string;
|
|
1360
|
+
max_quantity: number | null;
|
|
1361
|
+
position: number;
|
|
1362
|
+
}
|
|
1363
|
+
interface V2CollectionCreateParams {
|
|
1364
|
+
name: string;
|
|
1365
|
+
description?: string | null;
|
|
1366
|
+
available_from?: string | null;
|
|
1367
|
+
available_until?: string | null;
|
|
1368
|
+
custom?: Record<string, unknown> | null;
|
|
1369
|
+
published?: boolean;
|
|
1370
|
+
}
|
|
1371
|
+
interface V2CollectionUpdateParams extends Partial<V2CollectionCreateParams> {
|
|
1372
|
+
}
|
|
1373
|
+
interface V2Order extends V2Object {
|
|
1374
|
+
object: "checkout_session";
|
|
1375
|
+
customer_email: string;
|
|
1376
|
+
customer_name: string | null;
|
|
1377
|
+
customer_phone: string | null;
|
|
1378
|
+
customer_details: Record<string, unknown> | null;
|
|
1379
|
+
shipping_details: Record<string, unknown> | null;
|
|
1380
|
+
order_id: string | null;
|
|
1381
|
+
line_items: unknown[] | null;
|
|
1382
|
+
amount_total: number;
|
|
1383
|
+
currency: string;
|
|
1384
|
+
tax_summary: Record<string, unknown> | null;
|
|
1385
|
+
status: string;
|
|
1386
|
+
payment_status: string | null;
|
|
1387
|
+
fulfillment_status: string | null;
|
|
1388
|
+
tracking_number: string | null;
|
|
1389
|
+
notes: string | null;
|
|
1390
|
+
live_mode: boolean;
|
|
1391
|
+
metadata: Record<string, unknown> | null;
|
|
1392
|
+
created_at: string;
|
|
1393
|
+
completed_at: string | null;
|
|
1394
|
+
expires_at: string | null;
|
|
1395
|
+
}
|
|
1396
|
+
interface V2OrderListParams extends V2PaginationParams {
|
|
1397
|
+
status?: string;
|
|
1398
|
+
fulfillment_status?: string;
|
|
1399
|
+
customer_email?: string;
|
|
1400
|
+
date_from?: string;
|
|
1401
|
+
date_to?: string;
|
|
1402
|
+
}
|
|
1403
|
+
interface V2OrderLineItemPriceData {
|
|
1404
|
+
currency: string;
|
|
1405
|
+
product_data: {
|
|
1406
|
+
name: string;
|
|
1407
|
+
description?: string;
|
|
1408
|
+
images?: string[];
|
|
1409
|
+
};
|
|
1410
|
+
unit_amount: number;
|
|
1411
|
+
}
|
|
1412
|
+
interface V2OrderLineItem {
|
|
1413
|
+
sku_id?: number;
|
|
1414
|
+
product_id?: string | number;
|
|
1415
|
+
price_data?: V2OrderLineItemPriceData;
|
|
1416
|
+
price?: string;
|
|
1417
|
+
quantity: number;
|
|
1418
|
+
}
|
|
1419
|
+
interface V2OrderAddress {
|
|
1420
|
+
line1?: string;
|
|
1421
|
+
line2?: string;
|
|
1422
|
+
city?: string;
|
|
1423
|
+
state?: string;
|
|
1424
|
+
postal_code?: string;
|
|
1425
|
+
country?: string;
|
|
1426
|
+
}
|
|
1427
|
+
interface V2OrderTaxRequest {
|
|
1428
|
+
strategy?: string;
|
|
1429
|
+
customer_identifier?: string;
|
|
1430
|
+
customer_profile_id?: string;
|
|
1431
|
+
customer_display_name?: string;
|
|
1432
|
+
allow_exemption?: boolean;
|
|
1433
|
+
save_profile?: boolean;
|
|
1434
|
+
customer_exemption?: {
|
|
1435
|
+
status?: "none" | "exempt" | "reverse_charge";
|
|
1436
|
+
reason?: string;
|
|
1437
|
+
tax_id?: string;
|
|
1438
|
+
tax_id_type?: string;
|
|
1439
|
+
certificate_url?: string;
|
|
1440
|
+
metadata?: Record<string, unknown>;
|
|
1441
|
+
expires_at?: string;
|
|
1442
|
+
};
|
|
1443
|
+
}
|
|
1444
|
+
interface V2OrderCreateParams {
|
|
1445
|
+
line_items: V2OrderLineItem[];
|
|
1446
|
+
success_url: string;
|
|
1447
|
+
cancel_url: string;
|
|
1448
|
+
customer_email?: string;
|
|
1449
|
+
site_user_id?: string;
|
|
1450
|
+
mode?: "payment" | "subscription";
|
|
1451
|
+
deferred_subscription_product_id?: string | number;
|
|
1452
|
+
metadata?: Record<string, string | number | boolean>;
|
|
1453
|
+
tax?: V2OrderTaxRequest;
|
|
1454
|
+
shipping_amount?: number;
|
|
1455
|
+
shipping_address?: V2OrderAddress;
|
|
1456
|
+
billing_address?: V2OrderAddress;
|
|
1457
|
+
currency?: string;
|
|
1458
|
+
referral_code?: string;
|
|
1459
|
+
referrer_site_user_id?: string;
|
|
1460
|
+
}
|
|
1461
|
+
interface V2OrderFulfillmentUpdate {
|
|
1462
|
+
fulfillment_status: string;
|
|
1463
|
+
tracking_number?: string;
|
|
1464
|
+
notes?: string;
|
|
1465
|
+
/** When true, a terminal fulfillment status triggers a customer email. */
|
|
1466
|
+
notify_customer?: boolean;
|
|
1467
|
+
}
|
|
1468
|
+
interface V2OrderCreateResult extends V2Object {
|
|
1469
|
+
object: "checkout_session";
|
|
1470
|
+
checkout_url: string | null;
|
|
1471
|
+
payment_status: string | null;
|
|
1472
|
+
tax: {
|
|
1473
|
+
amount: number;
|
|
1474
|
+
currency: string;
|
|
1475
|
+
strategy: string;
|
|
1476
|
+
exemption_applied: boolean;
|
|
1477
|
+
exemption_status: string;
|
|
1478
|
+
breakdown: Array<{
|
|
1479
|
+
jurisdiction?: string;
|
|
1480
|
+
rate_percent: number;
|
|
1481
|
+
tax_amount: number;
|
|
1482
|
+
taxable_amount: number;
|
|
1483
|
+
source: string;
|
|
1484
|
+
}>;
|
|
1485
|
+
};
|
|
1486
|
+
}
|
|
1487
|
+
interface V2SiteUser extends V2Object {
|
|
1488
|
+
object: "site_user";
|
|
1489
|
+
email: string;
|
|
1490
|
+
email_verified: boolean;
|
|
1491
|
+
first_name: string | null;
|
|
1492
|
+
last_name: string | null;
|
|
1493
|
+
avatar_url: string | null;
|
|
1494
|
+
status: string;
|
|
1495
|
+
waitlist: boolean;
|
|
1496
|
+
metadata: Record<string, unknown> | null;
|
|
1497
|
+
created_at: string | null;
|
|
1498
|
+
updated_at: string | null;
|
|
1499
|
+
last_login_at: string | null;
|
|
1500
|
+
}
|
|
1501
|
+
interface V2SiteUserUpdateParams {
|
|
1502
|
+
first_name?: string;
|
|
1503
|
+
last_name?: string;
|
|
1504
|
+
avatar_url?: string;
|
|
1505
|
+
status?: "active" | "suspended" | "pending_verification";
|
|
1506
|
+
metadata?: Record<string, unknown>;
|
|
1507
|
+
}
|
|
1508
|
+
/**
|
|
1509
|
+
* Patch shape for the authenticated `/me` endpoint. Unlike the admin update,
|
|
1510
|
+
* end users cannot change their own `status`.
|
|
1511
|
+
*/
|
|
1512
|
+
interface V2SiteUserMeUpdateParams {
|
|
1513
|
+
first_name?: string;
|
|
1514
|
+
last_name?: string;
|
|
1515
|
+
avatar_url?: string;
|
|
1516
|
+
metadata?: Record<string, unknown>;
|
|
1517
|
+
}
|
|
1518
|
+
interface V2SiteUserListParams extends V2PaginationParams {
|
|
1519
|
+
status?: "active" | "suspended" | "pending_verification";
|
|
1520
|
+
email?: string;
|
|
1521
|
+
}
|
|
1522
|
+
/**
|
|
1523
|
+
* Response shape of `GET /sites/{siteName}/users/me`. Extends V2SiteUser with
|
|
1524
|
+
* a `profile` side-channel populated from the `site_user_profiles` KV table.
|
|
1525
|
+
*/
|
|
1526
|
+
interface V2SiteUserWithProfile extends V2SiteUser {
|
|
1527
|
+
profile: Record<string, unknown>;
|
|
1528
|
+
}
|
|
1529
|
+
/**
|
|
1530
|
+
* Standalone profile envelope returned by
|
|
1531
|
+
* `GET|PUT /sites/{siteName}/users/me/profile[/:key]`. Each `data` entry is a
|
|
1532
|
+
* parsed value (arbitrary JSON).
|
|
1533
|
+
*/
|
|
1534
|
+
interface V2SiteUserProfile {
|
|
1535
|
+
object: "site_user_profile";
|
|
1536
|
+
site_user_id: string;
|
|
1537
|
+
data: Record<string, unknown>;
|
|
1538
|
+
}
|
|
1539
|
+
interface V2NewsletterSubscription extends V2Object {
|
|
1540
|
+
object: "newsletter_subscription";
|
|
1541
|
+
email: string;
|
|
1542
|
+
name: string | null;
|
|
1543
|
+
status: string;
|
|
1544
|
+
double_opt_in: boolean;
|
|
1545
|
+
confirmed_at: string | null;
|
|
1546
|
+
source: string | null;
|
|
1547
|
+
frequency: string | null;
|
|
1548
|
+
topics: string[] | null;
|
|
1549
|
+
language: string | null;
|
|
1550
|
+
tags: string[] | null;
|
|
1551
|
+
custom_fields: Record<string, unknown> | null;
|
|
1552
|
+
unsubscribed_at: string | null;
|
|
1553
|
+
created_at: string | null;
|
|
1554
|
+
updated_at: string | null;
|
|
1555
|
+
}
|
|
1556
|
+
interface V2NewsletterList extends V2Object {
|
|
1557
|
+
object: "newsletter_list";
|
|
1558
|
+
name: string;
|
|
1559
|
+
slug: string;
|
|
1560
|
+
description: string | null;
|
|
1561
|
+
is_default: boolean;
|
|
1562
|
+
subscriber_count: number;
|
|
1563
|
+
created_at: string | null;
|
|
1564
|
+
updated_at: string | null;
|
|
1565
|
+
}
|
|
1566
|
+
interface V2NewsletterCampaign extends V2Object {
|
|
1567
|
+
object: "newsletter_campaign";
|
|
1568
|
+
name: string;
|
|
1569
|
+
slug: string | null;
|
|
1570
|
+
subject: string;
|
|
1571
|
+
preview_text: string | null;
|
|
1572
|
+
status: string;
|
|
1573
|
+
sent_at: string | null;
|
|
1574
|
+
completed_at: string | null;
|
|
1575
|
+
total_recipients: number;
|
|
1576
|
+
sent_count: number;
|
|
1577
|
+
opened_count: number;
|
|
1578
|
+
clicked_count: number;
|
|
1579
|
+
created_at: string | null;
|
|
1580
|
+
updated_at: string | null;
|
|
1581
|
+
}
|
|
1582
|
+
interface V2NewsletterTrackingResponse {
|
|
1583
|
+
success: boolean;
|
|
1584
|
+
}
|
|
1585
|
+
interface V2NewsletterListCreateParams {
|
|
1586
|
+
list_name: string;
|
|
1587
|
+
slug: string;
|
|
1588
|
+
description?: string | null;
|
|
1589
|
+
is_public?: boolean;
|
|
1590
|
+
is_default?: boolean;
|
|
1591
|
+
welcome_email_enabled?: boolean;
|
|
1592
|
+
}
|
|
1593
|
+
interface V2NewsletterListUpdateParams {
|
|
1594
|
+
list_name?: string;
|
|
1595
|
+
slug?: string;
|
|
1596
|
+
description?: string | null;
|
|
1597
|
+
is_public?: boolean;
|
|
1598
|
+
is_default?: boolean;
|
|
1599
|
+
welcome_email_enabled?: boolean;
|
|
1600
|
+
status?: "active" | "archived";
|
|
1601
|
+
}
|
|
1602
|
+
interface V2NewsletterSyncInput {
|
|
1603
|
+
email: string;
|
|
1604
|
+
name?: string | null;
|
|
1605
|
+
status?: "pending" | "confirmed" | "unsubscribed" | "bounced" | "complained";
|
|
1606
|
+
list_ids?: string[];
|
|
1607
|
+
frequency?: "instant" | "daily" | "weekly" | "monthly";
|
|
1608
|
+
topics?: string[];
|
|
1609
|
+
language?: string | null;
|
|
1610
|
+
source?: string | null;
|
|
1611
|
+
source_url?: string | null;
|
|
1612
|
+
notes?: string | null;
|
|
1613
|
+
tags?: string[];
|
|
1614
|
+
metadata?: Record<string, unknown>;
|
|
1615
|
+
resubscribe_override?: boolean;
|
|
1616
|
+
}
|
|
1617
|
+
interface V2NewsletterSyncResult {
|
|
1618
|
+
object: "newsletter_sync_result";
|
|
1619
|
+
applied: boolean;
|
|
1620
|
+
code: "CREATED" | "UPDATED" | "RESUBSCRIBED" | "ALREADY_UNSUBSCRIBED";
|
|
1621
|
+
skipped_unsubscribed: boolean;
|
|
1622
|
+
resubscribed: boolean;
|
|
1623
|
+
created: boolean;
|
|
1624
|
+
updated: boolean;
|
|
1625
|
+
subscription: Record<string, unknown>;
|
|
1626
|
+
}
|
|
1627
|
+
interface V2NewsletterSubscriptionListMembershipUpdate {
|
|
1628
|
+
mode: "add" | "remove" | "replace";
|
|
1629
|
+
list_ids: string[];
|
|
1630
|
+
}
|
|
1631
|
+
interface V2NewsletterImportRequest {
|
|
1632
|
+
rows: V2NewsletterSyncInput[];
|
|
1633
|
+
resubscribe_override?: boolean;
|
|
1634
|
+
}
|
|
1635
|
+
interface V2NewsletterImportResult {
|
|
1636
|
+
object: "newsletter_import_result";
|
|
1637
|
+
total: number;
|
|
1638
|
+
processed: number;
|
|
1639
|
+
applied: number;
|
|
1640
|
+
created: number;
|
|
1641
|
+
updated: number;
|
|
1642
|
+
resubscribed: number;
|
|
1643
|
+
skipped_unsubscribed: number;
|
|
1644
|
+
rows: Array<{
|
|
1645
|
+
index: number;
|
|
1646
|
+
email: string;
|
|
1647
|
+
applied: boolean;
|
|
1648
|
+
code: V2NewsletterSyncResult["code"];
|
|
1649
|
+
skipped_unsubscribed: boolean;
|
|
1650
|
+
resubscribed: boolean;
|
|
1651
|
+
subscription_id: string;
|
|
1652
|
+
}>;
|
|
1653
|
+
}
|
|
1654
|
+
interface V2ContactSubmission extends V2Object {
|
|
1655
|
+
object: "contact_submission";
|
|
1656
|
+
name: string | null;
|
|
1657
|
+
first_name: string | null;
|
|
1658
|
+
last_name: string | null;
|
|
1659
|
+
email: string;
|
|
1660
|
+
subject: string | null;
|
|
1661
|
+
message: string;
|
|
1662
|
+
phone: string | null;
|
|
1663
|
+
company: string | null;
|
|
1664
|
+
status: string;
|
|
1665
|
+
metadata: Record<string, unknown> | null;
|
|
1666
|
+
created_at: string | null;
|
|
1667
|
+
processed_at: string | null;
|
|
1668
|
+
}
|
|
1669
|
+
interface V2Organization extends V2Object {
|
|
1670
|
+
object: "organization";
|
|
1671
|
+
name: string;
|
|
1672
|
+
slug: string | null;
|
|
1673
|
+
endpoint_status: string | null;
|
|
1674
|
+
endpoint_url: string | null;
|
|
1675
|
+
created_at: string | null;
|
|
1676
|
+
updated_at: string | null;
|
|
1677
|
+
}
|
|
1678
|
+
interface V2Site extends V2Object {
|
|
1679
|
+
object: "site";
|
|
1680
|
+
name: string;
|
|
1681
|
+
title: string | null;
|
|
1682
|
+
description: string | null;
|
|
1683
|
+
domain: string | null;
|
|
1684
|
+
custom_domain: string | null;
|
|
1685
|
+
organization_id: string | null;
|
|
1686
|
+
tax_enabled: boolean;
|
|
1687
|
+
lifecycle_status: string | null;
|
|
1688
|
+
created_at: string | null;
|
|
1689
|
+
updated_at: string | null;
|
|
1690
|
+
}
|
|
1691
|
+
interface V2ApiKey extends V2Object {
|
|
1692
|
+
object: "api_key";
|
|
1693
|
+
name: string;
|
|
1694
|
+
description: string | null;
|
|
1695
|
+
organization_id: string | null;
|
|
1696
|
+
site_name: string | null;
|
|
1697
|
+
permissions: string[] | null;
|
|
1698
|
+
is_active: boolean;
|
|
1699
|
+
expires_at: string | null;
|
|
1700
|
+
last_used_at: string | null;
|
|
1701
|
+
created_at: string | null;
|
|
1702
|
+
updated_at: string | null;
|
|
1703
|
+
}
|
|
1704
|
+
type V2WebhookEventType = "content.created" | "content.updated" | "content.published" | "content.unpublished" | "content.deleted" | "newsletter.created" | "newsletter.updated" | "newsletter.published" | "newsletter.sent" | "newsletter.deleted" | "product.created" | "product.updated" | "product.deleted" | "product.stock_changed" | "order.paid" | "category.created" | "category.updated" | "category.deleted" | "site.updated" | "site.settings_changed" | "ab.flag_started" | "ab.flag_paused" | "ab.flag_resumed" | "ab.flag_stopped" | "ab.flag_updated" | "ab.config_warmup" | (string & Record<never, never>);
|
|
1705
|
+
interface V2Webhook extends V2Object {
|
|
1706
|
+
object: "webhook";
|
|
1707
|
+
url: string;
|
|
1708
|
+
description: string | null;
|
|
1709
|
+
events: V2WebhookEventType[] | null;
|
|
1710
|
+
is_active: boolean;
|
|
1711
|
+
created_at: string | null;
|
|
1712
|
+
updated_at: string | null;
|
|
1713
|
+
}
|
|
1714
|
+
interface V2WebhookCreateParams {
|
|
1715
|
+
url: string;
|
|
1716
|
+
description?: string;
|
|
1717
|
+
events?: V2WebhookEventType[];
|
|
1718
|
+
is_active?: boolean;
|
|
1719
|
+
}
|
|
1720
|
+
interface V2WebhookUpdateParams extends Partial<V2WebhookCreateParams> {
|
|
1721
|
+
}
|
|
1722
|
+
interface V2SiteUserSubscription extends V2Object {
|
|
1723
|
+
object: "site_user_subscription";
|
|
1724
|
+
site_user_id: string;
|
|
1725
|
+
provider: string | null;
|
|
1726
|
+
provider_subscription_id: string | null;
|
|
1727
|
+
plan_name: string | null;
|
|
1728
|
+
plan_id: string | null;
|
|
1729
|
+
status: string;
|
|
1730
|
+
amount: number | null;
|
|
1731
|
+
currency: string | null;
|
|
1732
|
+
billing_interval: string | null;
|
|
1733
|
+
billing_interval_count: number | null;
|
|
1734
|
+
current_period_start: string | null;
|
|
1735
|
+
current_period_end: string | null;
|
|
1736
|
+
trial_start: string | null;
|
|
1737
|
+
trial_end: string | null;
|
|
1738
|
+
canceled_at: string | null;
|
|
1739
|
+
cancel_at_period_end: boolean;
|
|
1740
|
+
metadata: Record<string, unknown> | null;
|
|
1741
|
+
created_at: string | null;
|
|
1742
|
+
updated_at: string | null;
|
|
1743
|
+
}
|
|
1744
|
+
interface V2SubscriptionPauseParams {
|
|
1745
|
+
resumes_at?: number;
|
|
1746
|
+
}
|
|
1747
|
+
interface V2SubscriptionCancelParams {
|
|
1748
|
+
mode?: "immediate" | "period_end" | "scheduled";
|
|
1749
|
+
cancel_at?: string;
|
|
1750
|
+
}
|
|
1751
|
+
interface V2SubscriptionChangePlanParams {
|
|
1752
|
+
product_id: string;
|
|
1753
|
+
}
|
|
1754
|
+
interface V2SubscriptionChargeParams {
|
|
1755
|
+
amount_cents: number;
|
|
1756
|
+
currency?: string;
|
|
1757
|
+
description?: string;
|
|
1758
|
+
idempotency_key: string;
|
|
1759
|
+
metadata?: Record<string, string>;
|
|
1760
|
+
}
|
|
1761
|
+
interface V2SubscriptionChargeResult {
|
|
1762
|
+
object: "subscription_charge";
|
|
1763
|
+
provider_invoice_id: string | null;
|
|
1764
|
+
provider_invoice_item_id: string | null;
|
|
1765
|
+
provider_payment_intent_id: string | null;
|
|
1766
|
+
status: string | null;
|
|
1767
|
+
paid: boolean;
|
|
1768
|
+
amount_due: number | null;
|
|
1769
|
+
amount_paid: number | null;
|
|
1770
|
+
currency: string;
|
|
1771
|
+
}
|
|
1772
|
+
interface V2CancelSubscriptionResult {
|
|
1773
|
+
object: "subscription_cancel_result";
|
|
1774
|
+
mode: string;
|
|
1775
|
+
status: string;
|
|
1776
|
+
cancel_at_period_end: boolean;
|
|
1777
|
+
effective_at: string | null;
|
|
1778
|
+
scheduled_cancel_at: string | null;
|
|
1779
|
+
message: string;
|
|
1780
|
+
}
|
|
1781
|
+
interface V2CreditTransaction extends V2Object {
|
|
1782
|
+
object: "credit_transaction";
|
|
1783
|
+
site_user_id: string;
|
|
1784
|
+
amount_cents: number;
|
|
1785
|
+
balance_after_cents: number;
|
|
1786
|
+
type: string;
|
|
1787
|
+
description: string | null;
|
|
1788
|
+
reference_id: string | null;
|
|
1789
|
+
reference_type: string | null;
|
|
1790
|
+
created_at: string | null;
|
|
1791
|
+
}
|
|
1792
|
+
interface V2CreditBalance {
|
|
1793
|
+
object: "credit_balance";
|
|
1794
|
+
balance_cents: number;
|
|
1795
|
+
transactions?: V2CreditTransaction[];
|
|
1796
|
+
}
|
|
1797
|
+
interface V2GrantCreditParams {
|
|
1798
|
+
amount_cents: number;
|
|
1799
|
+
description: string;
|
|
1800
|
+
}
|
|
1801
|
+
interface V2GrantCreditResult {
|
|
1802
|
+
object: "grant_credit_result";
|
|
1803
|
+
new_balance_cents: number;
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
/**
|
|
1807
|
+
* v2 Base Client — cursor pagination, expand support, caching, typed errors.
|
|
1808
|
+
*/
|
|
1809
|
+
|
|
1810
|
+
declare class PerspectV2Error extends Error {
|
|
1811
|
+
readonly type: string;
|
|
1812
|
+
readonly code: string;
|
|
1813
|
+
readonly param?: string;
|
|
1814
|
+
readonly status: number;
|
|
1815
|
+
constructor(error: V2Error['error'], status: number);
|
|
1816
|
+
}
|
|
1817
|
+
declare abstract class BaseV2Client {
|
|
1818
|
+
protected http: HttpClient;
|
|
1819
|
+
protected basePath: string;
|
|
1820
|
+
protected cache?: CacheManager;
|
|
1821
|
+
constructor(http: HttpClient, basePath: string, cache?: CacheManager);
|
|
1822
|
+
protected buildPath(endpoint: string): string;
|
|
1823
|
+
protected sitePath(siteName: string, resource: string, suffix?: string): string;
|
|
1824
|
+
private toParams;
|
|
1825
|
+
/**
|
|
1826
|
+
* Extract v2 payload from HttpClient response.
|
|
1827
|
+
*
|
|
1828
|
+
* The shared HttpClient wraps responses in a v1-style { success, data } envelope.
|
|
1829
|
+
* v2 API responses don't have a `success` field — the HttpClient already throws
|
|
1830
|
+
* on HTTP errors, so if we reach this point the request succeeded.
|
|
1831
|
+
*
|
|
1832
|
+
* The HttpClient may return the v2 payload nested under `data` (when the response
|
|
1833
|
+
* JSON contains a `data` key, which v2 list responses do) or as a direct wrap.
|
|
1834
|
+
* We unwrap accordingly.
|
|
1835
|
+
*/
|
|
1836
|
+
private extractData;
|
|
1837
|
+
/** GET a single resource, with optional caching. */
|
|
1838
|
+
protected getOne<T>(path: string, params?: object, cachePolicy?: CachePolicy): Promise<T>;
|
|
1839
|
+
/** GET a list of resources with cursor pagination, with optional caching. */
|
|
1840
|
+
protected getList<T>(path: string, params?: object, cachePolicy?: CachePolicy): Promise<V2List<T>>;
|
|
1841
|
+
/** POST to create a resource. */
|
|
1842
|
+
protected post<T>(path: string, body?: unknown): Promise<T>;
|
|
1843
|
+
/** PATCH to update a resource. */
|
|
1844
|
+
protected patchOne<T>(path: string, body?: unknown): Promise<T>;
|
|
1845
|
+
/** PUT to upsert a resource. */
|
|
1846
|
+
protected putOne<T>(path: string, body?: unknown): Promise<T>;
|
|
1847
|
+
/** DELETE a resource. */
|
|
1848
|
+
protected deleteOne(path: string): Promise<V2Deleted>;
|
|
1849
|
+
/** Fetch with optional cache. Bypasses cache for writes or when no cache is configured. */
|
|
1850
|
+
private fetchWithCache;
|
|
1851
|
+
/** Invalidate cache entries by keys or tags. */
|
|
1852
|
+
protected invalidateCache(options: CacheInvalidateOptions): Promise<void>;
|
|
1853
|
+
private buildCacheKey;
|
|
1854
|
+
/**
|
|
1855
|
+
* Auto-paginating async generator.
|
|
1856
|
+
* Yields every item across all pages.
|
|
1857
|
+
*
|
|
1858
|
+
* Usage:
|
|
1859
|
+
* for await (const item of client.listAutoPaginate(path, params)) { ... }
|
|
1860
|
+
*/
|
|
1861
|
+
protected listAutoPaginate<T extends {
|
|
1862
|
+
id: string;
|
|
1863
|
+
}>(path: string, params?: object): AsyncGenerator<T, void, unknown>;
|
|
1864
|
+
private toError;
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1867
|
+
/**
|
|
1868
|
+
* v2 Content Client
|
|
1869
|
+
*/
|
|
1870
|
+
|
|
1871
|
+
declare class ContentV2Client extends BaseV2Client {
|
|
1872
|
+
list(siteName: string, params?: V2ContentListParams, cachePolicy?: CachePolicy): Promise<V2List<V2Content>>;
|
|
1873
|
+
listAutoPaginated(siteName: string, params?: Omit<V2ContentListParams, 'starting_after' | 'ending_before'>, cachePolicy?: CachePolicy): AsyncGenerator<V2Content, void, unknown>;
|
|
1874
|
+
get(siteName: string, idOrSlug: string, cachePolicy?: CachePolicy): Promise<V2Content>;
|
|
1875
|
+
create(siteName: string, data: V2ContentCreateParams): Promise<V2Content>;
|
|
1876
|
+
update(siteName: string, id: string, data: V2ContentUpdateParams): Promise<V2Content>;
|
|
1877
|
+
del(siteName: string, id: string): Promise<V2Deleted>;
|
|
1878
|
+
publish(siteName: string, id: string): Promise<V2Content>;
|
|
1879
|
+
unpublish(siteName: string, id: string): Promise<V2Content>;
|
|
1880
|
+
private withContentTags;
|
|
1881
|
+
private buildContentTags;
|
|
1882
|
+
private normalizeTagPart;
|
|
1883
|
+
private extractSlugPrefix;
|
|
1884
|
+
private isContentId;
|
|
1885
|
+
}
|
|
1886
|
+
|
|
1887
|
+
/**
|
|
1888
|
+
* v2 Products Client
|
|
1889
|
+
*/
|
|
1890
|
+
|
|
1891
|
+
declare class ProductsV2Client extends BaseV2Client {
|
|
1892
|
+
list(siteName: string, params?: V2ProductListParams, cachePolicy?: CachePolicy): Promise<V2List<V2Product>>;
|
|
1893
|
+
listAutoPaginated(siteName: string, params?: Omit<V2ProductListParams, 'starting_after' | 'ending_before'>): AsyncGenerator<V2Product, void, unknown>;
|
|
1894
|
+
get(siteName: string, idOrSlug: string, cachePolicy?: CachePolicy): Promise<V2Product>;
|
|
1895
|
+
create(siteName: string, data: V2ProductCreateParams): Promise<V2Product>;
|
|
1896
|
+
update(siteName: string, id: string, data: V2ProductUpdateParams): Promise<V2Product>;
|
|
1897
|
+
del(siteName: string, id: string): Promise<V2Deleted>;
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
/**
|
|
1901
|
+
* v2 Categories Client
|
|
1902
|
+
*/
|
|
1903
|
+
|
|
1904
|
+
declare class CategoriesV2Client extends BaseV2Client {
|
|
1905
|
+
list(siteName: string, params?: V2PaginationParams & {
|
|
1906
|
+
type?: string;
|
|
1907
|
+
}, cachePolicy?: CachePolicy): Promise<V2List<V2Category>>;
|
|
1908
|
+
get(siteName: string, id: string, cachePolicy?: CachePolicy): Promise<V2Category>;
|
|
1909
|
+
create(siteName: string, data: V2CategoryCreateParams): Promise<V2Category>;
|
|
1910
|
+
update(siteName: string, id: string, data: V2CategoryUpdateParams): Promise<V2Category>;
|
|
1911
|
+
del(siteName: string, id: string): Promise<V2Deleted>;
|
|
1912
|
+
}
|
|
1913
|
+
|
|
1914
|
+
/**
|
|
1915
|
+
* v2 Collections Client
|
|
1916
|
+
*/
|
|
1917
|
+
|
|
1918
|
+
declare class CollectionsV2Client extends BaseV2Client {
|
|
1919
|
+
list(siteName: string, params?: V2PaginationParams): Promise<V2List<V2Collection>>;
|
|
1920
|
+
listAutoPaginated(siteName: string, params?: Omit<V2PaginationParams, 'starting_after' | 'ending_before'>): AsyncGenerator<V2Collection, void, unknown>;
|
|
1921
|
+
getCurrent(siteName: string): Promise<V2Collection | null>;
|
|
1922
|
+
get(siteName: string, id: string): Promise<V2Collection>;
|
|
1923
|
+
create(siteName: string, data: V2CollectionCreateParams): Promise<V2Collection>;
|
|
1924
|
+
update(siteName: string, id: string, data: V2CollectionUpdateParams): Promise<V2Collection>;
|
|
1925
|
+
del(siteName: string, id: string): Promise<V2Deleted>;
|
|
1926
|
+
listItems(siteName: string, collectionId: string): Promise<V2List<V2CollectionItem>>;
|
|
1927
|
+
addItem(siteName: string, collectionId: string, data: {
|
|
1928
|
+
product_id: string;
|
|
1929
|
+
max_quantity?: number | null;
|
|
1930
|
+
position?: number;
|
|
1931
|
+
}): Promise<V2CollectionItem>;
|
|
1932
|
+
removeItem(siteName: string, collectionId: string, itemId: string): Promise<V2Deleted>;
|
|
1933
|
+
}
|
|
1934
|
+
|
|
1935
|
+
/**
|
|
1936
|
+
* v2 Orders Client (checkout sessions)
|
|
1937
|
+
*
|
|
1938
|
+
* `create()` initiates a Stripe checkout session and returns the checkout URL.
|
|
1939
|
+
* No CSRF token is needed — v2 uses API-key auth only.
|
|
1940
|
+
*/
|
|
1941
|
+
|
|
1942
|
+
declare class OrdersV2Client extends BaseV2Client {
|
|
1943
|
+
list(siteName: string, params?: V2OrderListParams, cachePolicy?: CachePolicy): Promise<V2List<V2Order>>;
|
|
1944
|
+
listAutoPaginated(siteName: string, params?: Omit<V2OrderListParams, 'starting_after' | 'ending_before'>, cachePolicy?: CachePolicy): AsyncGenerator<V2Order, void, unknown>;
|
|
1945
|
+
get(siteName: string, id: string, cachePolicy?: CachePolicy): Promise<V2Order>;
|
|
1946
|
+
/**
|
|
1947
|
+
* Create a checkout session via Stripe. Returns the session ID and a
|
|
1948
|
+
* `checkout_url` that the client should redirect to (or open in a new tab).
|
|
1949
|
+
*
|
|
1950
|
+
* This replaces the v1 `checkout.createCheckoutSession()` + `getCsrfToken()`
|
|
1951
|
+
* dance — v2 is API-key-only and requires no CSRF token.
|
|
1952
|
+
*/
|
|
1953
|
+
create(siteName: string, data: V2OrderCreateParams): Promise<V2OrderCreateResult>;
|
|
1954
|
+
/**
|
|
1955
|
+
* Update fulfillment status, tracking number, and/or notes on an order.
|
|
1956
|
+
*
|
|
1957
|
+
* Set `notify_customer: true` when moving the order into a terminal
|
|
1958
|
+
* fulfillment state to send the customer fulfillment email.
|
|
1959
|
+
*/
|
|
1960
|
+
updateFulfillment(siteName: string, id: string, data: V2OrderFulfillmentUpdate): Promise<V2Order>;
|
|
1961
|
+
private withOrderTags;
|
|
1962
|
+
private buildOrderTags;
|
|
1963
|
+
private normalizeTagPart;
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1966
|
+
/**
|
|
1967
|
+
* v2 Site Users Client
|
|
1968
|
+
*
|
|
1969
|
+
* Two classes of endpoints:
|
|
1970
|
+
* - Admin paths (list/get/update/OTP flows) require an API key. Use the
|
|
1971
|
+
* usual `setApiKey(...)` on the main `PerspectApiV2Client` before calling.
|
|
1972
|
+
* - `/me*` paths require a site-user JWT (minted by `verifyOtp`). Call
|
|
1973
|
+
* `setAuth(jwt)` on the main client before calling these.
|
|
1974
|
+
*/
|
|
1975
|
+
|
|
1976
|
+
interface V2OtpRequestResponse {
|
|
1977
|
+
object: 'otp_request';
|
|
1978
|
+
email: string;
|
|
1979
|
+
expires_in: number;
|
|
1980
|
+
}
|
|
1981
|
+
interface V2OtpVerifyResponse extends V2SiteUser {
|
|
1982
|
+
token: string;
|
|
1983
|
+
}
|
|
1984
|
+
declare class SiteUsersV2Client extends BaseV2Client {
|
|
1985
|
+
requestOtp(siteName: string, data: {
|
|
1986
|
+
email: string;
|
|
1987
|
+
waitlist?: boolean;
|
|
1988
|
+
metadata?: Record<string, unknown>;
|
|
1989
|
+
}): Promise<V2OtpRequestResponse>;
|
|
1990
|
+
verifyOtp(siteName: string, data: {
|
|
1991
|
+
email: string;
|
|
1992
|
+
code: string;
|
|
1993
|
+
}): Promise<V2OtpVerifyResponse>;
|
|
1994
|
+
list(siteName: string, params?: V2SiteUserListParams): Promise<V2List<V2SiteUser>>;
|
|
1995
|
+
listAutoPaginated(siteName: string, params?: Omit<V2SiteUserListParams, 'starting_after' | 'ending_before'>): AsyncGenerator<V2SiteUser, void, unknown>;
|
|
1996
|
+
get(siteName: string, id: string): Promise<V2SiteUser>;
|
|
1997
|
+
getProfileForUser(siteName: string, id: string, cachePolicy?: CachePolicy): Promise<V2SiteUserProfile>;
|
|
1998
|
+
update(siteName: string, id: string, data: V2SiteUserUpdateParams): Promise<V2SiteUser>;
|
|
1999
|
+
/**
|
|
2000
|
+
* Load the currently-authenticated site user's canonical record plus their
|
|
2001
|
+
* profile KV map. Requires `client.setAuth(jwt)` to have been called with
|
|
2002
|
+
* the token returned from `verifyOtp`.
|
|
2003
|
+
*/
|
|
2004
|
+
getMe(siteName: string, cachePolicy?: CachePolicy): Promise<V2SiteUserWithProfile>;
|
|
2005
|
+
/** Update the authenticated user's own fields. */
|
|
2006
|
+
updateMe(siteName: string, data: V2SiteUserMeUpdateParams): Promise<V2SiteUser>;
|
|
2007
|
+
/** Fetch the profile KV map as a dedicated `site_user_profile` envelope. */
|
|
2008
|
+
getProfile(siteName: string, cachePolicy?: CachePolicy): Promise<V2SiteUserProfile>;
|
|
2009
|
+
/**
|
|
2010
|
+
* Set a single profile key. The value is persisted verbatim — callers wanting
|
|
2011
|
+
* structured data should JSON-stringify their value first.
|
|
2012
|
+
*/
|
|
2013
|
+
setProfileValue(siteName: string, key: string, value: string): Promise<V2SiteUserProfile>;
|
|
2014
|
+
/** Delete a single profile key. */
|
|
2015
|
+
deleteProfileValue(siteName: string, key: string): Promise<V2Deleted>;
|
|
2016
|
+
}
|
|
2017
|
+
|
|
2018
|
+
/**
|
|
2019
|
+
* v2 Newsletter Client
|
|
2020
|
+
*/
|
|
2021
|
+
|
|
2022
|
+
declare class NewsletterV2Client extends BaseV2Client {
|
|
2023
|
+
subscribe(siteName: string, data: {
|
|
2024
|
+
email: string;
|
|
2025
|
+
name?: string;
|
|
2026
|
+
list_ids?: string[];
|
|
2027
|
+
source?: string;
|
|
2028
|
+
source_url?: string;
|
|
2029
|
+
frequency?: 'instant' | 'daily' | 'weekly' | 'monthly';
|
|
2030
|
+
topics?: string[];
|
|
2031
|
+
language?: string;
|
|
2032
|
+
metadata?: Record<string, unknown>;
|
|
2033
|
+
}): Promise<V2NewsletterSubscription>;
|
|
2034
|
+
confirm(siteName: string, token: string): Promise<V2NewsletterSubscription>;
|
|
2035
|
+
unsubscribe(siteName: string, data: {
|
|
2036
|
+
token?: string;
|
|
2037
|
+
email?: string;
|
|
2038
|
+
reason?: string;
|
|
2039
|
+
}): Promise<V2NewsletterSubscription>;
|
|
2040
|
+
trackOpen(siteName: string, token: string): Promise<V2NewsletterTrackingResponse>;
|
|
2041
|
+
trackClick(siteName: string, token: string, url: string): Promise<V2NewsletterTrackingResponse>;
|
|
2042
|
+
listSubscriptions(siteName: string, params?: V2PaginationParams & {
|
|
2043
|
+
status?: string;
|
|
2044
|
+
}, cachePolicy?: CachePolicy): Promise<V2List<V2NewsletterSubscription>>;
|
|
2045
|
+
getSubscription(siteName: string, id: string, cachePolicy?: CachePolicy): Promise<V2NewsletterSubscription>;
|
|
2046
|
+
listLists(siteName: string, cachePolicy?: CachePolicy): Promise<V2List<V2NewsletterList>>;
|
|
2047
|
+
listCampaigns(siteName: string, params?: V2PaginationParams & {
|
|
2048
|
+
status?: string;
|
|
2049
|
+
}, cachePolicy?: CachePolicy): Promise<V2List<V2NewsletterCampaign>>;
|
|
2050
|
+
getCampaign(siteName: string, idOrSlug: string, cachePolicy?: CachePolicy): Promise<V2NewsletterCampaign>;
|
|
2051
|
+
createList(siteName: string, data: V2NewsletterListCreateParams): Promise<V2NewsletterList>;
|
|
2052
|
+
updateList(siteName: string, id: string, data: V2NewsletterListUpdateParams): Promise<V2NewsletterList>;
|
|
2053
|
+
deleteList(siteName: string, id: string): Promise<V2Deleted>;
|
|
2054
|
+
/**
|
|
2055
|
+
* Upsert a subscription by email and (optionally) replace its list
|
|
2056
|
+
* memberships. Returns a `newsletter_sync_result` envelope with the
|
|
2057
|
+
* outcome (created / updated / resubscribed / already-unsubscribed).
|
|
2058
|
+
*/
|
|
2059
|
+
syncSubscription(siteName: string, data: V2NewsletterSyncInput): Promise<V2NewsletterSyncResult>;
|
|
2060
|
+
/**
|
|
2061
|
+
* Add/remove/replace the list memberships for an existing subscription.
|
|
2062
|
+
* Returns the refreshed subscription record.
|
|
2063
|
+
*/
|
|
2064
|
+
updateSubscriptionListMembership(siteName: string, subscriptionId: string, data: V2NewsletterSubscriptionListMembershipUpdate): Promise<V2NewsletterSubscription>;
|
|
2065
|
+
/**
|
|
2066
|
+
* Bulk import subscriptions. Each row is upserted via the same sync
|
|
2067
|
+
* path; `refreshListCounts` is deferred until after all rows are
|
|
2068
|
+
* processed on the server.
|
|
2069
|
+
*/
|
|
2070
|
+
importSubscriptions(siteName: string, data: V2NewsletterImportRequest): Promise<V2NewsletterImportResult>;
|
|
2071
|
+
}
|
|
2072
|
+
|
|
2073
|
+
/**
|
|
2074
|
+
* v2 Contacts Client
|
|
2075
|
+
*/
|
|
2076
|
+
|
|
2077
|
+
declare class ContactsV2Client extends BaseV2Client {
|
|
2078
|
+
submit(siteName: string, data: {
|
|
2079
|
+
email: string;
|
|
2080
|
+
message: string;
|
|
2081
|
+
name?: string;
|
|
2082
|
+
first_name?: string;
|
|
2083
|
+
last_name?: string;
|
|
2084
|
+
subject?: string;
|
|
2085
|
+
phone?: string;
|
|
2086
|
+
company?: string;
|
|
2087
|
+
metadata?: Record<string, unknown>;
|
|
2088
|
+
}): Promise<V2ContactSubmission>;
|
|
2089
|
+
list(siteName: string, params?: V2PaginationParams & {
|
|
2090
|
+
status?: string;
|
|
2091
|
+
}): Promise<V2List<V2ContactSubmission>>;
|
|
2092
|
+
get(siteName: string, id: string): Promise<V2ContactSubmission>;
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2095
|
+
/**
|
|
2096
|
+
* v2 Organizations Client
|
|
2097
|
+
*/
|
|
2098
|
+
|
|
2099
|
+
declare class OrganizationsV2Client extends BaseV2Client {
|
|
2100
|
+
list(): Promise<V2List<V2Organization>>;
|
|
2101
|
+
get(id: string): Promise<V2Organization>;
|
|
2102
|
+
}
|
|
2103
|
+
|
|
2104
|
+
/**
|
|
2105
|
+
* v2 Sites Client
|
|
2106
|
+
*/
|
|
2107
|
+
|
|
2108
|
+
declare class SitesV2Client extends BaseV2Client {
|
|
2109
|
+
list(params?: V2PaginationParams): Promise<V2List<V2Site>>;
|
|
2110
|
+
get(name: string): Promise<V2Site>;
|
|
2111
|
+
}
|
|
2112
|
+
|
|
2113
|
+
/**
|
|
2114
|
+
* v2 API Keys Client
|
|
2115
|
+
*/
|
|
2116
|
+
|
|
2117
|
+
declare class ApiKeysV2Client extends BaseV2Client {
|
|
2118
|
+
list(params?: V2PaginationParams): Promise<V2List<V2ApiKey>>;
|
|
2119
|
+
get(id: string): Promise<V2ApiKey>;
|
|
2120
|
+
del(id: string): Promise<V2Deleted>;
|
|
2121
|
+
}
|
|
2122
|
+
|
|
2123
|
+
/**
|
|
2124
|
+
* v2 Webhooks Client
|
|
2125
|
+
*/
|
|
2126
|
+
|
|
2127
|
+
declare class WebhooksV2Client extends BaseV2Client {
|
|
2128
|
+
list(siteName: string, params?: V2PaginationParams): Promise<V2List<V2Webhook>>;
|
|
2129
|
+
get(siteName: string, id: string): Promise<V2Webhook>;
|
|
2130
|
+
create(siteName: string, data: V2WebhookCreateParams): Promise<V2Webhook>;
|
|
2131
|
+
update(siteName: string, id: string, data: V2WebhookUpdateParams): Promise<V2Webhook>;
|
|
2132
|
+
del(siteName: string, id: string): Promise<V2Deleted>;
|
|
2133
|
+
}
|
|
2134
|
+
|
|
2135
|
+
/**
|
|
2136
|
+
* v2 Subscriptions Client — lifecycle operations for site user subscriptions.
|
|
2137
|
+
*
|
|
2138
|
+
* Two classes of endpoints:
|
|
2139
|
+
* - /me paths require a site-user JWT (call `setAuth(jwt)` first)
|
|
2140
|
+
* - Admin paths require an API key (call `setApiKey(key)` first)
|
|
2141
|
+
*/
|
|
2142
|
+
|
|
2143
|
+
declare class SubscriptionsV2Client extends BaseV2Client {
|
|
2144
|
+
/** List all subscriptions for the authenticated user. */
|
|
2145
|
+
listMySubscriptions(siteName: string, cachePolicy?: CachePolicy): Promise<V2List<V2SiteUserSubscription>>;
|
|
2146
|
+
/** Pause a subscription. */
|
|
2147
|
+
pauseSubscription(siteName: string, subId: string, params?: V2SubscriptionPauseParams): Promise<V2SiteUserSubscription>;
|
|
2148
|
+
/** Resume a paused subscription. */
|
|
2149
|
+
resumeSubscription(siteName: string, subId: string): Promise<V2SiteUserSubscription>;
|
|
2150
|
+
/** Cancel a subscription. */
|
|
2151
|
+
cancelSubscription(siteName: string, subId: string, params?: V2SubscriptionCancelParams): Promise<V2CancelSubscriptionResult>;
|
|
2152
|
+
/** Change the plan (price) of a subscription. */
|
|
2153
|
+
changeSubscriptionPlan(siteName: string, subId: string, params: V2SubscriptionChangePlanParams): Promise<V2SiteUserSubscription>;
|
|
2154
|
+
/** List subscriptions for a specific user (admin). */
|
|
2155
|
+
listUserSubscriptions(siteName: string, userId: string, cachePolicy?: CachePolicy): Promise<V2List<V2SiteUserSubscription>>;
|
|
2156
|
+
/** Pause a user's subscription (admin). */
|
|
2157
|
+
pauseUserSubscription(siteName: string, userId: string, subId: string, params?: V2SubscriptionPauseParams): Promise<V2SiteUserSubscription>;
|
|
2158
|
+
/** Resume a user's paused subscription (admin). */
|
|
2159
|
+
resumeUserSubscription(siteName: string, userId: string, subId: string): Promise<V2SiteUserSubscription>;
|
|
2160
|
+
/** Cancel a user's subscription (admin). */
|
|
2161
|
+
cancelUserSubscription(siteName: string, userId: string, subId: string, params?: V2SubscriptionCancelParams): Promise<V2CancelSubscriptionResult>;
|
|
2162
|
+
/** Charge a user's subscription once (admin). */
|
|
2163
|
+
chargeUserSubscription(siteName: string, userId: string, subId: string, params: V2SubscriptionChargeParams): Promise<V2SubscriptionChargeResult>;
|
|
2164
|
+
}
|
|
2165
|
+
|
|
2166
|
+
/**
|
|
2167
|
+
* v2 Credits Client — balance queries and admin grant operations.
|
|
2168
|
+
*
|
|
2169
|
+
* Two classes of endpoints:
|
|
2170
|
+
* - /me paths require a site-user JWT (call `setAuth(jwt)` first)
|
|
2171
|
+
* - Admin paths require an API key (call `setApiKey(key)` first)
|
|
2172
|
+
*/
|
|
2173
|
+
|
|
2174
|
+
declare class CreditsV2Client extends BaseV2Client {
|
|
2175
|
+
/** Get the current credit balance for the authenticated user. */
|
|
2176
|
+
getMyBalance(siteName: string, cachePolicy?: CachePolicy): Promise<V2CreditBalance>;
|
|
2177
|
+
/** Get credit balance and transaction history for the authenticated user. */
|
|
2178
|
+
getMyCredits(siteName: string, cachePolicy?: CachePolicy): Promise<V2CreditBalance>;
|
|
2179
|
+
/** Get the credit balance for a specific user (admin). */
|
|
2180
|
+
getUserBalance(siteName: string, userId: string): Promise<V2CreditBalance>;
|
|
2181
|
+
/** Grant credit to a specific user (admin). */
|
|
2182
|
+
grantCredit(siteName: string, userId: string, data: V2GrantCreditParams): Promise<V2GrantCreditResult>;
|
|
2183
|
+
}
|
|
2184
|
+
|
|
2185
|
+
/**
|
|
2186
|
+
* PerspectAPI v2 SDK Client
|
|
2187
|
+
*
|
|
2188
|
+
* Stripe-style API with consistent envelopes, prefixed IDs,
|
|
2189
|
+
* cursor pagination, and snake_case responses.
|
|
2190
|
+
*
|
|
2191
|
+
* Usage:
|
|
2192
|
+
* import { PerspectApiV2Client } from 'perspectapi-ts-sdk/v2';
|
|
2193
|
+
* const client = new PerspectApiV2Client({ baseUrl: '...', apiKey: '...' });
|
|
2194
|
+
* const posts = await client.content.list('mysite', { type: 'post', limit: 10 });
|
|
2195
|
+
*/
|
|
2196
|
+
|
|
2197
|
+
interface PerspectApiV2Config extends PerspectApiConfig {
|
|
2198
|
+
cache?: CacheConfig;
|
|
2199
|
+
}
|
|
2200
|
+
declare class PerspectApiV2Client {
|
|
2201
|
+
private http;
|
|
2202
|
+
readonly cache: CacheManager;
|
|
2203
|
+
readonly content: ContentV2Client;
|
|
2204
|
+
readonly products: ProductsV2Client;
|
|
2205
|
+
readonly categories: CategoriesV2Client;
|
|
2206
|
+
readonly collections: CollectionsV2Client;
|
|
2207
|
+
readonly orders: OrdersV2Client;
|
|
2208
|
+
readonly siteUsers: SiteUsersV2Client;
|
|
2209
|
+
readonly newsletter: NewsletterV2Client;
|
|
2210
|
+
readonly contacts: ContactsV2Client;
|
|
2211
|
+
readonly organizations: OrganizationsV2Client;
|
|
2212
|
+
readonly sites: SitesV2Client;
|
|
2213
|
+
readonly apiKeys: ApiKeysV2Client;
|
|
2214
|
+
readonly webhooks: WebhooksV2Client;
|
|
2215
|
+
readonly subscriptions: SubscriptionsV2Client;
|
|
2216
|
+
readonly credits: CreditsV2Client;
|
|
2217
|
+
constructor(config: PerspectApiV2Config);
|
|
2218
|
+
/** Update the JWT token for authenticated requests. */
|
|
2219
|
+
setAuth(jwt: string): void;
|
|
2220
|
+
/** Update the API key. */
|
|
2221
|
+
setApiKey(apiKey: string): void;
|
|
2222
|
+
/** Clear authentication. */
|
|
2223
|
+
clearAuth(): void;
|
|
2224
|
+
}
|
|
2225
|
+
declare function createPerspectApiV2Client(config: PerspectApiConfig): PerspectApiV2Client;
|
|
2226
|
+
|
|
2227
|
+
export { type NewsletterManagementList as $, type ApiResponse as A, type CreateNewsletterSubscriptionRequest as B, CacheManager as C, type NewsletterConfirmResponse as D, type NewsletterUnsubscribeRequest as E, type NewsletterUnsubscribeResponse as F, type NewsletterPreferences as G, HttpClient as H, type NewsletterList as I, type NewsletterCampaignListResponse as J, type NewsletterCampaignDetail as K, type NewsletterStatusResponse as L, type NewsletterManagementSubscriptionsListResponse as M, type NewsletterSubscribeResponse as N, type Organization as O, type PaginatedResponse as P, type NewsletterManagementSubscription as Q, type NewsletterSubscriptionSyncRequest as R, type Site as S, type NewsletterSubscriptionSyncResponse as T, type User as U, type NewsletterSubscriptionsBulkUpdateRequest as V, type Webhook as W, type NewsletterSubscriptionsBulkUpdateResponse as X, type NewsletterSubscriptionMembershipUpdateRequest as Y, type NewsletterSubscriptionsImportRequest as Z, type NewsletterSubscriptionsImportResponse as _, type CachePolicy as a, type V2ContentListParams as a$, type NewsletterManagementSeries as a0, type NewsletterManagementCampaignListResponse as a1, type NewsletterManagementCampaign as a2, type NewsletterCampaignTestSendRequest as a3, type NewsletterCampaignTestSendResponse as a4, type NewsletterManagementStatsResponse as a5, type NewsletterExportCreateRequest as a6, type NewsletterExportCreateResponse as a7, type RequestOtpRequest as a8, type VerifyOtpRequest as a9, PerspectV2Error as aA, createApiError as aB, PerspectApiError as aC, type CacheConfig as aD, type ApiError as aE, type MediaItem as aF, type CategorySummary as aG, type PaymentGateway as aH, type NewsletterSubscription as aI, type NewsletterCampaignSummary as aJ, type NewsletterManagementListMembership as aK, type NewsletterSubscriptionsBulkAction as aL, type NewsletterSubscriptionsBulkOutcome as aM, type NewsletterSubscriptionImportRowRequest as aN, type NewsletterSubscriptionsImportRowResult as aO, type NewsletterManagementPagination as aP, type SetProfileValueRequest as aQ, type V2Object as aR, type V2List as aS, type V2Deleted as aT, type V2Error as aU, type V2ErrorType as aV, type V2PaginationParams as aW, type V2Media as aX, type V2Content as aY, type V2ContentCreateParams as aZ, type V2ContentUpdateParams as a_, type VerifyOtpResponse as aa, type SiteUser as ab, type SiteUserProfile as ac, type UpdateSiteUserRequest as ad, type SiteUserOrder as ae, type SiteUserSubscription as af, type CancelSubscriptionRequest as ag, type CancelSubscriptionResponse as ah, type CreditBalance as ai, type CreditBalanceWithTransactions as aj, type GrantCreditRequest as ak, type ProductBundleGroup as al, type CreateBundleGroupRequest as am, type BundleCollection as an, type BundleCollectionItemWithProduct as ao, type CreateBundleCollectionRequest as ap, type AddCollectionItemRequest as aq, type BundleCollectionItem as ar, type PerspectApiConfig as as, type CacheAdapter as at, type BlogPost as au, type CheckoutMetadata as av, type CheckoutAddress as aw, type CheckoutTaxRequest as ax, PerspectApiV2Client as ay, createPerspectApiV2Client as az, type CacheInvalidateOptions as b, type CheckoutMetadataValue as b$, type V2Product as b0, type V2ProductCreateParams as b1, type V2ProductUpdateParams as b2, type V2ProductListParams as b3, type V2Category as b4, type V2CategoryCreateParams as b5, type V2CategoryUpdateParams as b6, type V2Collection as b7, type V2CollectionItem as b8, type V2CollectionCreateParams as b9, type V2NewsletterImportResult as bA, type V2ContactSubmission as bB, type V2Organization as bC, type V2Site as bD, type V2ApiKey as bE, type V2WebhookEventType as bF, type V2Webhook as bG, type V2WebhookCreateParams as bH, type V2WebhookUpdateParams as bI, type V2SiteUserSubscription as bJ, type V2SubscriptionPauseParams as bK, type V2SubscriptionCancelParams as bL, type V2SubscriptionChangePlanParams as bM, type V2SubscriptionChargeParams as bN, type V2SubscriptionChargeResult as bO, type V2CancelSubscriptionResult as bP, type V2CreditTransaction as bQ, type V2CreditBalance as bR, type V2GrantCreditParams as bS, type V2GrantCreditResult as bT, type PaginationParams as bU, type ContentStatus as bV, type ContentType as bW, type ProductSkuMediaItem as bX, type ProductSkuOption as bY, type CreatePaymentGatewayRequest as bZ, type WebhookEventType as b_, type V2CollectionUpdateParams as ba, type V2Order as bb, type V2OrderListParams as bc, type V2OrderLineItemPriceData as bd, type V2OrderLineItem as be, type V2OrderAddress as bf, type V2OrderTaxRequest as bg, type V2OrderCreateParams as bh, type V2OrderFulfillmentUpdate as bi, type V2OrderCreateResult as bj, type V2SiteUser as bk, type V2SiteUserUpdateParams as bl, type V2SiteUserMeUpdateParams as bm, type V2SiteUserListParams as bn, type V2SiteUserWithProfile as bo, type V2SiteUserProfile as bp, type V2NewsletterSubscription as bq, type V2NewsletterList as br, type V2NewsletterCampaign as bs, type V2NewsletterTrackingResponse as bt, type V2NewsletterListCreateParams as bu, type V2NewsletterListUpdateParams as bv, type V2NewsletterSyncInput as bw, type V2NewsletterSyncResult as bx, type V2NewsletterSubscriptionListMembershipUpdate as by, type V2NewsletterImportRequest as bz, type ContentQueryParams as c, type CheckoutTaxStrategy as c0, type CheckoutTaxExemptionStatus as c1, type CheckoutTaxCustomerExemptionRequest as c2, type CheckoutTaxBreakdownItem as c3, type CheckoutSessionTax as c4, type SubscriptionCancellationMode as c5, type CreditTransaction as c6, type HttpMethod as c7, type RequestOptions as c8, type PerspectApiV2Config as c9, BaseV2Client as ca, ContentV2Client as cb, ProductsV2Client as cc, CategoriesV2Client as cd, CollectionsV2Client as ce, OrdersV2Client as cf, SiteUsersV2Client as cg, NewsletterV2Client as ch, ContactsV2Client as ci, OrganizationsV2Client as cj, SitesV2Client as ck, ApiKeysV2Client as cl, WebhooksV2Client as cm, SubscriptionsV2Client as cn, CreditsV2Client as co, type Content as d, type ContentCategoryResponse as e, type CreateContentRequest as f, type UpdateContentRequest as g, type ApiKey as h, type CreateApiKeyRequest as i, type UpdateApiKeyRequest as j, type CreateOrganizationRequest as k, type CreateSiteRequest as l, type ProductQueryParams as m, type Product as n, type CreateProductRequest as o, type ProductSku as p, type CreateProductSkuRequest as q, type Category as r, type CreateCategoryRequest as s, type CreateWebhookRequest as t, type CreateCheckoutSessionRequest as u, type CheckoutSession as v, type CreateContactRequest as w, type ContactSubmitResponse as x, type ContactStatusResponse as y, type ContactSubmission as z };
|