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