perspectapi-ts-sdk 6.5.9 → 7.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -1011
- package/dist/chunk-MZ22HQBX.mjs +1451 -0
- package/dist/index-BL9-AZpq.d.mts +2227 -0
- package/dist/index-BL9-AZpq.d.ts +2227 -0
- package/dist/index.d.mts +130 -2221
- package/dist/index.d.ts +130 -2221
- package/dist/index.js +71 -7
- package/dist/index.mjs +13 -1364
- package/dist/v2/index.d.mts +1 -0
- package/dist/v2/index.d.ts +1 -0
- package/dist/v2/index.js +1477 -0
- package/dist/v2/index.mjs +40 -0
- package/docs/README.md +15 -0
- package/docs/v1-deprecated/README.md +9 -0
- package/docs/v1-deprecated/examples/README.md +324 -0
- package/docs/v1-deprecated/examples/basic-usage.ts +258 -0
- package/docs/v1-deprecated/examples/cloudflare-worker.ts +274 -0
- package/docs/v1-deprecated/examples/content-query-with-slug-prefix.ts +237 -0
- package/docs/v1-deprecated/examples/image-transforms.ts +200 -0
- package/docs/v1-deprecated/examples/site-user-checkout.ts +186 -0
- package/docs/v1-deprecated/examples/slug-prefix-examples.ts +491 -0
- package/docs/v1-deprecated/legacy-docs/caching.md +667 -0
- package/docs/v1-deprecated/legacy-docs/contact.md +1396 -0
- package/docs/v1-deprecated/legacy-docs/csrf-protection.md +664 -0
- package/docs/v1-deprecated/legacy-docs/image-transforms.md +523 -0
- package/docs/v1-deprecated/legacy-docs/loaders.md +304 -0
- package/docs/v1-deprecated/legacy-docs/newsletter.md +811 -0
- package/docs/v1-deprecated/legacy-docs/site-users.md +817 -0
- package/docs/v1-deprecated/legacy-notes/CHANGELOG-CHECKOUT.md +143 -0
- package/docs/v1-deprecated/legacy-notes/CSRF-CHECKOUT.md +271 -0
- package/docs/v1-deprecated/legacy-notes/IMAGE_TRANSFORMS_PORT.md +298 -0
- package/docs/v1-deprecated/sdk-readme.md +1076 -0
- package/examples/README.md +19 -0
- package/examples/basic-v2.ts +37 -0
- package/llms.txt +25 -0
- package/package.json +18 -7
- package/src/client/api-keys-client.ts +4 -0
- package/src/client/auth-client.ts +4 -0
- package/src/client/base-client.ts +7 -0
- package/src/client/bundles-client.ts +4 -0
- package/src/client/categories-client.ts +4 -0
- package/src/client/checkout-client.ts +4 -0
- package/src/client/contact-client.ts +4 -0
- package/src/client/content-client.ts +4 -0
- package/src/client/newsletter-client.ts +4 -0
- package/src/client/newsletter-management-client.ts +4 -0
- package/src/client/organizations-client.ts +4 -0
- package/src/client/products-client.ts +4 -0
- package/src/client/site-users-client.ts +10 -1
- package/src/client/sites-client.ts +4 -0
- package/src/client/webhooks-client.ts +4 -0
- package/src/deprecation.ts +2 -1
- package/src/index.ts +2 -1
- package/src/loaders.ts +59 -0
- package/src/perspect-api-client.ts +2 -2
- package/src/v2/client/orders-client.ts +89 -6
- package/src/v2/types.ts +3 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,2231 +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 V2SubscriptionChargeParams {
|
|
1761
|
-
amount_cents: number;
|
|
1762
|
-
currency?: string;
|
|
1763
|
-
description?: string;
|
|
1764
|
-
idempotency_key: string;
|
|
1765
|
-
metadata?: Record<string, string>;
|
|
1766
|
-
}
|
|
1767
|
-
interface V2SubscriptionChargeResult {
|
|
1768
|
-
object: "subscription_charge";
|
|
1769
|
-
provider_invoice_id: string | null;
|
|
1770
|
-
provider_invoice_item_id: string | null;
|
|
1771
|
-
provider_payment_intent_id: string | null;
|
|
1772
|
-
status: string | null;
|
|
1773
|
-
paid: boolean;
|
|
1774
|
-
amount_due: number | null;
|
|
1775
|
-
amount_paid: number | null;
|
|
1776
|
-
currency: string;
|
|
1777
|
-
}
|
|
1778
|
-
interface V2CancelSubscriptionResult {
|
|
1779
|
-
object: "subscription_cancel_result";
|
|
1780
|
-
mode: string;
|
|
1781
|
-
status: string;
|
|
1782
|
-
cancel_at_period_end: boolean;
|
|
1783
|
-
effective_at: string | null;
|
|
1784
|
-
scheduled_cancel_at: string | null;
|
|
1785
|
-
message: string;
|
|
1786
|
-
}
|
|
1787
|
-
interface V2CreditTransaction extends V2Object {
|
|
1788
|
-
object: "credit_transaction";
|
|
1789
|
-
site_user_id: string;
|
|
1790
|
-
amount_cents: number;
|
|
1791
|
-
balance_after_cents: number;
|
|
1792
|
-
type: string;
|
|
1793
|
-
description: string | null;
|
|
1794
|
-
reference_id: string | null;
|
|
1795
|
-
reference_type: string | null;
|
|
1796
|
-
created_at: string | null;
|
|
1797
|
-
}
|
|
1798
|
-
interface V2CreditBalance {
|
|
1799
|
-
object: "credit_balance";
|
|
1800
|
-
balance_cents: number;
|
|
1801
|
-
transactions?: V2CreditTransaction[];
|
|
1802
|
-
}
|
|
1803
|
-
interface V2GrantCreditParams {
|
|
1804
|
-
amount_cents: number;
|
|
1805
|
-
description: string;
|
|
1806
|
-
}
|
|
1807
|
-
interface V2GrantCreditResult {
|
|
1808
|
-
object: "grant_credit_result";
|
|
1809
|
-
new_balance_cents: number;
|
|
1810
|
-
}
|
|
1811
|
-
|
|
1812
|
-
/**
|
|
1813
|
-
* v2 Base Client — cursor pagination, expand support, caching, typed errors.
|
|
1814
|
-
*/
|
|
1815
|
-
|
|
1816
|
-
declare class PerspectV2Error extends Error {
|
|
1817
|
-
readonly type: string;
|
|
1818
|
-
readonly code: string;
|
|
1819
|
-
readonly param?: string;
|
|
1820
|
-
readonly status: number;
|
|
1821
|
-
constructor(error: V2Error['error'], status: number);
|
|
1822
|
-
}
|
|
1823
|
-
declare abstract class BaseV2Client {
|
|
1824
|
-
protected http: HttpClient;
|
|
1825
|
-
protected basePath: string;
|
|
1826
|
-
protected cache?: CacheManager;
|
|
1827
|
-
constructor(http: HttpClient, basePath: string, cache?: CacheManager);
|
|
1828
|
-
protected buildPath(endpoint: string): string;
|
|
1829
|
-
protected sitePath(siteName: string, resource: string, suffix?: string): string;
|
|
1830
|
-
private toParams;
|
|
1831
|
-
/**
|
|
1832
|
-
* Extract v2 payload from HttpClient response.
|
|
1833
|
-
*
|
|
1834
|
-
* The shared HttpClient wraps responses in a v1-style { success, data } envelope.
|
|
1835
|
-
* v2 API responses don't have a `success` field — the HttpClient already throws
|
|
1836
|
-
* on HTTP errors, so if we reach this point the request succeeded.
|
|
1837
|
-
*
|
|
1838
|
-
* The HttpClient may return the v2 payload nested under `data` (when the response
|
|
1839
|
-
* JSON contains a `data` key, which v2 list responses do) or as a direct wrap.
|
|
1840
|
-
* We unwrap accordingly.
|
|
1841
|
-
*/
|
|
1842
|
-
private extractData;
|
|
1843
|
-
/** GET a single resource, with optional caching. */
|
|
1844
|
-
protected getOne<T>(path: string, params?: object, cachePolicy?: CachePolicy): Promise<T>;
|
|
1845
|
-
/** GET a list of resources with cursor pagination, with optional caching. */
|
|
1846
|
-
protected getList<T>(path: string, params?: object, cachePolicy?: CachePolicy): Promise<V2List<T>>;
|
|
1847
|
-
/** POST to create a resource. */
|
|
1848
|
-
protected post<T>(path: string, body?: unknown): Promise<T>;
|
|
1849
|
-
/** PATCH to update a resource. */
|
|
1850
|
-
protected patchOne<T>(path: string, body?: unknown): Promise<T>;
|
|
1851
|
-
/** PUT to upsert a resource. */
|
|
1852
|
-
protected putOne<T>(path: string, body?: unknown): Promise<T>;
|
|
1853
|
-
/** DELETE a resource. */
|
|
1854
|
-
protected deleteOne(path: string): Promise<V2Deleted>;
|
|
1855
|
-
/** Fetch with optional cache. Bypasses cache for writes or when no cache is configured. */
|
|
1856
|
-
private fetchWithCache;
|
|
1857
|
-
/** Invalidate cache entries by keys or tags. */
|
|
1858
|
-
protected invalidateCache(options: CacheInvalidateOptions): Promise<void>;
|
|
1859
|
-
private buildCacheKey;
|
|
1860
|
-
/**
|
|
1861
|
-
* Auto-paginating async generator.
|
|
1862
|
-
* Yields every item across all pages.
|
|
1863
|
-
*
|
|
1864
|
-
* Usage:
|
|
1865
|
-
* for await (const item of client.listAutoPaginate(path, params)) { ... }
|
|
1866
|
-
*/
|
|
1867
|
-
protected listAutoPaginate<T extends {
|
|
1868
|
-
id: string;
|
|
1869
|
-
}>(path: string, params?: object): AsyncGenerator<T, void, unknown>;
|
|
1870
|
-
private toError;
|
|
1871
|
-
}
|
|
1872
|
-
|
|
1873
|
-
/**
|
|
1874
|
-
* v2 Content Client
|
|
1875
|
-
*/
|
|
1876
|
-
|
|
1877
|
-
declare class ContentV2Client extends BaseV2Client {
|
|
1878
|
-
list(siteName: string, params?: V2ContentListParams, cachePolicy?: CachePolicy): Promise<V2List<V2Content>>;
|
|
1879
|
-
listAutoPaginated(siteName: string, params?: Omit<V2ContentListParams, 'starting_after' | 'ending_before'>, cachePolicy?: CachePolicy): AsyncGenerator<V2Content, void, unknown>;
|
|
1880
|
-
get(siteName: string, idOrSlug: string, cachePolicy?: CachePolicy): Promise<V2Content>;
|
|
1881
|
-
create(siteName: string, data: V2ContentCreateParams): Promise<V2Content>;
|
|
1882
|
-
update(siteName: string, id: string, data: V2ContentUpdateParams): Promise<V2Content>;
|
|
1883
|
-
del(siteName: string, id: string): Promise<V2Deleted>;
|
|
1884
|
-
publish(siteName: string, id: string): Promise<V2Content>;
|
|
1885
|
-
unpublish(siteName: string, id: string): Promise<V2Content>;
|
|
1886
|
-
private withContentTags;
|
|
1887
|
-
private buildContentTags;
|
|
1888
|
-
private normalizeTagPart;
|
|
1889
|
-
private extractSlugPrefix;
|
|
1890
|
-
private isContentId;
|
|
1891
|
-
}
|
|
1892
|
-
|
|
1893
|
-
/**
|
|
1894
|
-
* v2 Products Client
|
|
1895
|
-
*/
|
|
1896
|
-
|
|
1897
|
-
declare class ProductsV2Client extends BaseV2Client {
|
|
1898
|
-
list(siteName: string, params?: V2ProductListParams, cachePolicy?: CachePolicy): Promise<V2List<V2Product>>;
|
|
1899
|
-
listAutoPaginated(siteName: string, params?: Omit<V2ProductListParams, 'starting_after' | 'ending_before'>): AsyncGenerator<V2Product, void, unknown>;
|
|
1900
|
-
get(siteName: string, idOrSlug: string, cachePolicy?: CachePolicy): Promise<V2Product>;
|
|
1901
|
-
create(siteName: string, data: V2ProductCreateParams): Promise<V2Product>;
|
|
1902
|
-
update(siteName: string, id: string, data: V2ProductUpdateParams): Promise<V2Product>;
|
|
1903
|
-
del(siteName: string, id: string): Promise<V2Deleted>;
|
|
1904
|
-
}
|
|
1905
|
-
|
|
1906
|
-
/**
|
|
1907
|
-
* v2 Categories Client
|
|
1908
|
-
*/
|
|
1909
|
-
|
|
1910
|
-
declare class CategoriesV2Client extends BaseV2Client {
|
|
1911
|
-
list(siteName: string, params?: V2PaginationParams & {
|
|
1912
|
-
type?: string;
|
|
1913
|
-
}, cachePolicy?: CachePolicy): Promise<V2List<V2Category>>;
|
|
1914
|
-
get(siteName: string, id: string, cachePolicy?: CachePolicy): Promise<V2Category>;
|
|
1915
|
-
create(siteName: string, data: V2CategoryCreateParams): Promise<V2Category>;
|
|
1916
|
-
update(siteName: string, id: string, data: V2CategoryUpdateParams): Promise<V2Category>;
|
|
1917
|
-
del(siteName: string, id: string): Promise<V2Deleted>;
|
|
1918
|
-
}
|
|
1919
|
-
|
|
1920
|
-
/**
|
|
1921
|
-
* v2 Collections Client
|
|
1922
|
-
*/
|
|
1923
|
-
|
|
1924
|
-
declare class CollectionsV2Client extends BaseV2Client {
|
|
1925
|
-
list(siteName: string, params?: V2PaginationParams): Promise<V2List<V2Collection>>;
|
|
1926
|
-
listAutoPaginated(siteName: string, params?: Omit<V2PaginationParams, 'starting_after' | 'ending_before'>): AsyncGenerator<V2Collection, void, unknown>;
|
|
1927
|
-
getCurrent(siteName: string): Promise<V2Collection | null>;
|
|
1928
|
-
get(siteName: string, id: string): Promise<V2Collection>;
|
|
1929
|
-
create(siteName: string, data: V2CollectionCreateParams): Promise<V2Collection>;
|
|
1930
|
-
update(siteName: string, id: string, data: V2CollectionUpdateParams): Promise<V2Collection>;
|
|
1931
|
-
del(siteName: string, id: string): Promise<V2Deleted>;
|
|
1932
|
-
listItems(siteName: string, collectionId: string): Promise<V2List<V2CollectionItem>>;
|
|
1933
|
-
addItem(siteName: string, collectionId: string, data: {
|
|
1934
|
-
product_id: string;
|
|
1935
|
-
max_quantity?: number | null;
|
|
1936
|
-
position?: number;
|
|
1937
|
-
}): Promise<V2CollectionItem>;
|
|
1938
|
-
removeItem(siteName: string, collectionId: string, itemId: string): Promise<V2Deleted>;
|
|
1939
|
-
}
|
|
1940
|
-
|
|
1941
|
-
/**
|
|
1942
|
-
* v2 Orders Client (checkout sessions)
|
|
1943
|
-
*
|
|
1944
|
-
* `create()` initiates a Stripe checkout session and returns the checkout URL.
|
|
1945
|
-
* No CSRF token is needed — v2 uses API-key auth only.
|
|
1946
|
-
*/
|
|
1947
|
-
|
|
1948
|
-
declare class OrdersV2Client extends BaseV2Client {
|
|
1949
|
-
list(siteName: string, params?: V2OrderListParams, cachePolicy?: CachePolicy): Promise<V2List<V2Order>>;
|
|
1950
|
-
listAutoPaginated(siteName: string, params?: Omit<V2OrderListParams, 'starting_after' | 'ending_before'>): AsyncGenerator<V2Order, void, unknown>;
|
|
1951
|
-
get(siteName: string, id: string, cachePolicy?: CachePolicy): Promise<V2Order>;
|
|
1952
|
-
/**
|
|
1953
|
-
* Create a checkout session via Stripe. Returns the session ID and a
|
|
1954
|
-
* `checkout_url` that the client should redirect to (or open in a new tab).
|
|
1955
|
-
*
|
|
1956
|
-
* This replaces the v1 `checkout.createCheckoutSession()` + `getCsrfToken()`
|
|
1957
|
-
* dance — v2 is API-key-only and requires no CSRF token.
|
|
1958
|
-
*/
|
|
1959
|
-
create(siteName: string, data: V2OrderCreateParams): Promise<V2OrderCreateResult>;
|
|
1960
|
-
/** Update fulfillment status, tracking number, and/or notes on an order. */
|
|
1961
|
-
updateFulfillment(siteName: string, id: string, data: V2OrderFulfillmentUpdate): Promise<V2Order>;
|
|
1962
|
-
}
|
|
1963
|
-
|
|
1964
|
-
/**
|
|
1965
|
-
* v2 Site Users Client
|
|
1966
|
-
*
|
|
1967
|
-
* Two classes of endpoints:
|
|
1968
|
-
* - Admin paths (list/get/update/OTP flows) require an API key. Use the
|
|
1969
|
-
* usual `setApiKey(...)` on the main `PerspectApiV2Client` before calling.
|
|
1970
|
-
* - `/me*` paths require a site-user JWT (minted by `verifyOtp`). Call
|
|
1971
|
-
* `setAuth(jwt)` on the main client before calling these.
|
|
1972
|
-
*/
|
|
1973
|
-
|
|
1974
|
-
interface V2OtpRequestResponse {
|
|
1975
|
-
object: 'otp_request';
|
|
1976
|
-
email: string;
|
|
1977
|
-
expires_in: number;
|
|
1978
|
-
}
|
|
1979
|
-
interface V2OtpVerifyResponse extends V2SiteUser {
|
|
1980
|
-
token: string;
|
|
1981
|
-
}
|
|
1982
|
-
declare class SiteUsersV2Client extends BaseV2Client {
|
|
1983
|
-
requestOtp(siteName: string, data: {
|
|
1984
|
-
email: string;
|
|
1985
|
-
waitlist?: boolean;
|
|
1986
|
-
metadata?: Record<string, unknown>;
|
|
1987
|
-
}): Promise<V2OtpRequestResponse>;
|
|
1988
|
-
verifyOtp(siteName: string, data: {
|
|
1989
|
-
email: string;
|
|
1990
|
-
code: string;
|
|
1991
|
-
}): Promise<V2OtpVerifyResponse>;
|
|
1992
|
-
list(siteName: string, params?: V2SiteUserListParams): Promise<V2List<V2SiteUser>>;
|
|
1993
|
-
listAutoPaginated(siteName: string, params?: Omit<V2SiteUserListParams, 'starting_after' | 'ending_before'>): AsyncGenerator<V2SiteUser, void, unknown>;
|
|
1994
|
-
get(siteName: string, id: string): Promise<V2SiteUser>;
|
|
1995
|
-
getProfileForUser(siteName: string, id: string, cachePolicy?: CachePolicy): Promise<V2SiteUserProfile>;
|
|
1996
|
-
update(siteName: string, id: string, data: V2SiteUserUpdateParams): Promise<V2SiteUser>;
|
|
1997
|
-
/**
|
|
1998
|
-
* Load the currently-authenticated site user's canonical record plus their
|
|
1999
|
-
* profile KV map. Requires `client.setAuth(jwt)` to have been called with
|
|
2000
|
-
* the token returned from `verifyOtp`.
|
|
2001
|
-
*/
|
|
2002
|
-
getMe(siteName: string, cachePolicy?: CachePolicy): Promise<V2SiteUserWithProfile>;
|
|
2003
|
-
/** Update the authenticated user's own fields. */
|
|
2004
|
-
updateMe(siteName: string, data: V2SiteUserMeUpdateParams): Promise<V2SiteUser>;
|
|
2005
|
-
/** Fetch the profile KV map as a dedicated `site_user_profile` envelope. */
|
|
2006
|
-
getProfile(siteName: string, cachePolicy?: CachePolicy): Promise<V2SiteUserProfile>;
|
|
2007
|
-
/**
|
|
2008
|
-
* Set a single profile key. The value is persisted verbatim — callers wanting
|
|
2009
|
-
* structured data should JSON-stringify their value first.
|
|
2010
|
-
*/
|
|
2011
|
-
setProfileValue(siteName: string, key: string, value: string): Promise<V2SiteUserProfile>;
|
|
2012
|
-
/** Delete a single profile key. */
|
|
2013
|
-
deleteProfileValue(siteName: string, key: string): Promise<V2Deleted>;
|
|
2014
|
-
}
|
|
2015
|
-
|
|
2016
|
-
/**
|
|
2017
|
-
* v2 Newsletter Client
|
|
2018
|
-
*/
|
|
2019
|
-
|
|
2020
|
-
declare class NewsletterV2Client extends BaseV2Client {
|
|
2021
|
-
subscribe(siteName: string, data: {
|
|
2022
|
-
email: string;
|
|
2023
|
-
name?: string;
|
|
2024
|
-
list_ids?: string[];
|
|
2025
|
-
source?: string;
|
|
2026
|
-
source_url?: string;
|
|
2027
|
-
frequency?: 'instant' | 'daily' | 'weekly' | 'monthly';
|
|
2028
|
-
topics?: string[];
|
|
2029
|
-
language?: string;
|
|
2030
|
-
metadata?: Record<string, unknown>;
|
|
2031
|
-
}): Promise<V2NewsletterSubscription>;
|
|
2032
|
-
confirm(siteName: string, token: string): Promise<V2NewsletterSubscription>;
|
|
2033
|
-
unsubscribe(siteName: string, data: {
|
|
2034
|
-
token?: string;
|
|
2035
|
-
email?: string;
|
|
2036
|
-
reason?: string;
|
|
2037
|
-
}): Promise<V2NewsletterSubscription>;
|
|
2038
|
-
trackOpen(siteName: string, token: string): Promise<V2NewsletterTrackingResponse>;
|
|
2039
|
-
trackClick(siteName: string, token: string, url: string): Promise<V2NewsletterTrackingResponse>;
|
|
2040
|
-
listSubscriptions(siteName: string, params?: V2PaginationParams & {
|
|
2041
|
-
status?: string;
|
|
2042
|
-
}, cachePolicy?: CachePolicy): Promise<V2List<V2NewsletterSubscription>>;
|
|
2043
|
-
getSubscription(siteName: string, id: string, cachePolicy?: CachePolicy): Promise<V2NewsletterSubscription>;
|
|
2044
|
-
listLists(siteName: string, cachePolicy?: CachePolicy): Promise<V2List<V2NewsletterList>>;
|
|
2045
|
-
listCampaigns(siteName: string, params?: V2PaginationParams & {
|
|
2046
|
-
status?: string;
|
|
2047
|
-
}, cachePolicy?: CachePolicy): Promise<V2List<V2NewsletterCampaign>>;
|
|
2048
|
-
getCampaign(siteName: string, idOrSlug: string, cachePolicy?: CachePolicy): Promise<V2NewsletterCampaign>;
|
|
2049
|
-
createList(siteName: string, data: V2NewsletterListCreateParams): Promise<V2NewsletterList>;
|
|
2050
|
-
updateList(siteName: string, id: string, data: V2NewsletterListUpdateParams): Promise<V2NewsletterList>;
|
|
2051
|
-
deleteList(siteName: string, id: string): Promise<V2Deleted>;
|
|
2052
|
-
/**
|
|
2053
|
-
* Upsert a subscription by email and (optionally) replace its list
|
|
2054
|
-
* memberships. Returns a `newsletter_sync_result` envelope with the
|
|
2055
|
-
* outcome (created / updated / resubscribed / already-unsubscribed).
|
|
2056
|
-
*/
|
|
2057
|
-
syncSubscription(siteName: string, data: V2NewsletterSyncInput): Promise<V2NewsletterSyncResult>;
|
|
2058
|
-
/**
|
|
2059
|
-
* Add/remove/replace the list memberships for an existing subscription.
|
|
2060
|
-
* Returns the refreshed subscription record.
|
|
2061
|
-
*/
|
|
2062
|
-
updateSubscriptionListMembership(siteName: string, subscriptionId: string, data: V2NewsletterSubscriptionListMembershipUpdate): Promise<V2NewsletterSubscription>;
|
|
2063
|
-
/**
|
|
2064
|
-
* Bulk import subscriptions. Each row is upserted via the same sync
|
|
2065
|
-
* path; `refreshListCounts` is deferred until after all rows are
|
|
2066
|
-
* processed on the server.
|
|
2067
|
-
*/
|
|
2068
|
-
importSubscriptions(siteName: string, data: V2NewsletterImportRequest): Promise<V2NewsletterImportResult>;
|
|
2069
|
-
}
|
|
2070
|
-
|
|
2071
|
-
/**
|
|
2072
|
-
* v2 Contacts Client
|
|
2073
|
-
*/
|
|
2074
|
-
|
|
2075
|
-
declare class ContactsV2Client extends BaseV2Client {
|
|
2076
|
-
submit(siteName: string, data: {
|
|
2077
|
-
email: string;
|
|
2078
|
-
message: string;
|
|
2079
|
-
name?: string;
|
|
2080
|
-
first_name?: string;
|
|
2081
|
-
last_name?: string;
|
|
2082
|
-
subject?: string;
|
|
2083
|
-
phone?: string;
|
|
2084
|
-
company?: string;
|
|
2085
|
-
metadata?: Record<string, unknown>;
|
|
2086
|
-
}): Promise<V2ContactSubmission>;
|
|
2087
|
-
list(siteName: string, params?: V2PaginationParams & {
|
|
2088
|
-
status?: string;
|
|
2089
|
-
}): Promise<V2List<V2ContactSubmission>>;
|
|
2090
|
-
get(siteName: string, id: string): Promise<V2ContactSubmission>;
|
|
2091
|
-
}
|
|
2092
|
-
|
|
2093
|
-
/**
|
|
2094
|
-
* v2 Organizations Client
|
|
2095
|
-
*/
|
|
2096
|
-
|
|
2097
|
-
declare class OrganizationsV2Client extends BaseV2Client {
|
|
2098
|
-
list(): Promise<V2List<V2Organization>>;
|
|
2099
|
-
get(id: string): Promise<V2Organization>;
|
|
2100
|
-
}
|
|
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-BL9-AZpq.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-BL9-AZpq.js';
|
|
2101
3
|
|
|
2102
4
|
/**
|
|
2103
|
-
*
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
declare class SitesV2Client extends BaseV2Client {
|
|
2107
|
-
list(params?: V2PaginationParams): Promise<V2List<V2Site>>;
|
|
2108
|
-
get(name: string): Promise<V2Site>;
|
|
2109
|
-
}
|
|
2110
|
-
|
|
2111
|
-
/**
|
|
2112
|
-
* v2 API Keys Client
|
|
2113
|
-
*/
|
|
2114
|
-
|
|
2115
|
-
declare class ApiKeysV2Client extends BaseV2Client {
|
|
2116
|
-
list(params?: V2PaginationParams): Promise<V2List<V2ApiKey>>;
|
|
2117
|
-
get(id: string): Promise<V2ApiKey>;
|
|
2118
|
-
del(id: string): Promise<V2Deleted>;
|
|
2119
|
-
}
|
|
2120
|
-
|
|
2121
|
-
/**
|
|
2122
|
-
* v2 Webhooks Client
|
|
2123
|
-
*/
|
|
2124
|
-
|
|
2125
|
-
declare class WebhooksV2Client extends BaseV2Client {
|
|
2126
|
-
list(siteName: string, params?: V2PaginationParams): Promise<V2List<V2Webhook>>;
|
|
2127
|
-
get(siteName: string, id: string): Promise<V2Webhook>;
|
|
2128
|
-
create(siteName: string, data: V2WebhookCreateParams): Promise<V2Webhook>;
|
|
2129
|
-
update(siteName: string, id: string, data: V2WebhookUpdateParams): Promise<V2Webhook>;
|
|
2130
|
-
del(siteName: string, id: string): Promise<V2Deleted>;
|
|
2131
|
-
}
|
|
2132
|
-
|
|
2133
|
-
/**
|
|
2134
|
-
* v2 Subscriptions Client — lifecycle operations for site user subscriptions.
|
|
2135
|
-
*
|
|
2136
|
-
* Two classes of endpoints:
|
|
2137
|
-
* - /me paths require a site-user JWT (call `setAuth(jwt)` first)
|
|
2138
|
-
* - Admin paths require an API key (call `setApiKey(key)` first)
|
|
2139
|
-
*/
|
|
2140
|
-
|
|
2141
|
-
declare class SubscriptionsV2Client extends BaseV2Client {
|
|
2142
|
-
/** List all subscriptions for the authenticated user. */
|
|
2143
|
-
listMySubscriptions(siteName: string, cachePolicy?: CachePolicy): Promise<V2List<V2SiteUserSubscription>>;
|
|
2144
|
-
/** Pause a subscription. */
|
|
2145
|
-
pauseSubscription(siteName: string, subId: string, params?: V2SubscriptionPauseParams): Promise<V2SiteUserSubscription>;
|
|
2146
|
-
/** Resume a paused subscription. */
|
|
2147
|
-
resumeSubscription(siteName: string, subId: string): Promise<V2SiteUserSubscription>;
|
|
2148
|
-
/** Cancel a subscription. */
|
|
2149
|
-
cancelSubscription(siteName: string, subId: string, params?: V2SubscriptionCancelParams): Promise<V2CancelSubscriptionResult>;
|
|
2150
|
-
/** Change the plan (price) of a subscription. */
|
|
2151
|
-
changeSubscriptionPlan(siteName: string, subId: string, params: V2SubscriptionChangePlanParams): Promise<V2SiteUserSubscription>;
|
|
2152
|
-
/** List subscriptions for a specific user (admin). */
|
|
2153
|
-
listUserSubscriptions(siteName: string, userId: string, cachePolicy?: CachePolicy): Promise<V2List<V2SiteUserSubscription>>;
|
|
2154
|
-
/** Pause a user's subscription (admin). */
|
|
2155
|
-
pauseUserSubscription(siteName: string, userId: string, subId: string, params?: V2SubscriptionPauseParams): Promise<V2SiteUserSubscription>;
|
|
2156
|
-
/** Resume a user's paused subscription (admin). */
|
|
2157
|
-
resumeUserSubscription(siteName: string, userId: string, subId: string): Promise<V2SiteUserSubscription>;
|
|
2158
|
-
/** Cancel a user's subscription (admin). */
|
|
2159
|
-
cancelUserSubscription(siteName: string, userId: string, subId: string, params?: V2SubscriptionCancelParams): Promise<V2CancelSubscriptionResult>;
|
|
2160
|
-
/** Charge a user's subscription once (admin). */
|
|
2161
|
-
chargeUserSubscription(siteName: string, userId: string, subId: string, params: V2SubscriptionChargeParams): Promise<V2SubscriptionChargeResult>;
|
|
2162
|
-
}
|
|
2163
|
-
|
|
2164
|
-
/**
|
|
2165
|
-
* 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`.
|
|
2166
7
|
*
|
|
2167
|
-
*
|
|
2168
|
-
* - /me paths require a site-user JWT (call `setAuth(jwt)` first)
|
|
2169
|
-
* - Admin paths require an API key (call `setApiKey(key)` first)
|
|
8
|
+
* v1 sunsets 2026-06-01. All new integrations must use the v2 client.
|
|
2170
9
|
*/
|
|
2171
|
-
|
|
2172
|
-
declare
|
|
2173
|
-
/** Get the current credit balance for the authenticated user. */
|
|
2174
|
-
getMyBalance(siteName: string, cachePolicy?: CachePolicy): Promise<V2CreditBalance>;
|
|
2175
|
-
/** Get credit balance and transaction history for the authenticated user. */
|
|
2176
|
-
getMyCredits(siteName: string, cachePolicy?: CachePolicy): Promise<V2CreditBalance>;
|
|
2177
|
-
/** Get the credit balance for a specific user (admin). */
|
|
2178
|
-
getUserBalance(siteName: string, userId: string): Promise<V2CreditBalance>;
|
|
2179
|
-
/** Grant credit to a specific user (admin). */
|
|
2180
|
-
grantCredit(siteName: string, userId: string, data: V2GrantCreditParams): Promise<V2GrantCreditResult>;
|
|
2181
|
-
}
|
|
10
|
+
declare const V1_SUNSET_DATE = "2026-06-01";
|
|
11
|
+
declare const V1_DEPRECATION_NOTICE: string;
|
|
2182
12
|
|
|
2183
13
|
/**
|
|
2184
|
-
* PerspectAPI
|
|
2185
|
-
*
|
|
2186
|
-
* Stripe-style API with consistent envelopes, prefixed IDs,
|
|
2187
|
-
* cursor pagination, and snake_case responses.
|
|
2188
|
-
*
|
|
2189
|
-
* Usage:
|
|
2190
|
-
* import { PerspectApiV2Client } from 'perspectapi-ts-sdk/v2';
|
|
2191
|
-
* const client = new PerspectApiV2Client({ baseUrl: '...', apiKey: '...' });
|
|
2192
|
-
* const posts = await client.content.list('mysite', { type: 'post', limit: 10 });
|
|
14
|
+
* Base client class for PerspectAPI SDK
|
|
2193
15
|
*/
|
|
2194
16
|
|
|
2195
|
-
interface PerspectApiV2Config extends PerspectApiConfig {
|
|
2196
|
-
cache?: CacheConfig;
|
|
2197
|
-
}
|
|
2198
|
-
declare class PerspectApiV2Client {
|
|
2199
|
-
private http;
|
|
2200
|
-
readonly cache: CacheManager;
|
|
2201
|
-
readonly content: ContentV2Client;
|
|
2202
|
-
readonly products: ProductsV2Client;
|
|
2203
|
-
readonly categories: CategoriesV2Client;
|
|
2204
|
-
readonly collections: CollectionsV2Client;
|
|
2205
|
-
readonly orders: OrdersV2Client;
|
|
2206
|
-
readonly siteUsers: SiteUsersV2Client;
|
|
2207
|
-
readonly newsletter: NewsletterV2Client;
|
|
2208
|
-
readonly contacts: ContactsV2Client;
|
|
2209
|
-
readonly organizations: OrganizationsV2Client;
|
|
2210
|
-
readonly sites: SitesV2Client;
|
|
2211
|
-
readonly apiKeys: ApiKeysV2Client;
|
|
2212
|
-
readonly webhooks: WebhooksV2Client;
|
|
2213
|
-
readonly subscriptions: SubscriptionsV2Client;
|
|
2214
|
-
readonly credits: CreditsV2Client;
|
|
2215
|
-
constructor(config: PerspectApiV2Config);
|
|
2216
|
-
/** Update the JWT token for authenticated requests. */
|
|
2217
|
-
setAuth(jwt: string): void;
|
|
2218
|
-
/** Update the API key. */
|
|
2219
|
-
setApiKey(apiKey: string): void;
|
|
2220
|
-
/** Clear authentication. */
|
|
2221
|
-
clearAuth(): void;
|
|
2222
|
-
}
|
|
2223
|
-
declare function createPerspectApiV2Client(config: PerspectApiConfig): PerspectApiV2Client;
|
|
2224
|
-
|
|
2225
17
|
/**
|
|
2226
|
-
*
|
|
18
|
+
* @deprecated v1 base client. v1 sunsets on 2026-06-01. Use
|
|
19
|
+
* `PerspectApiV2Client` / `createPerspectApiV2Client` from
|
|
20
|
+
* `perspectapi-ts-sdk/v2` for new integrations.
|
|
2227
21
|
*/
|
|
2228
|
-
|
|
2229
22
|
declare abstract class BaseClient {
|
|
2230
23
|
protected http: HttpClient;
|
|
2231
24
|
protected basePath: string;
|
|
@@ -2288,6 +81,10 @@ declare abstract class BaseClient {
|
|
|
2288
81
|
* Site user OTP methods are on SiteUsersClient.
|
|
2289
82
|
*/
|
|
2290
83
|
|
|
84
|
+
/**
|
|
85
|
+
* @deprecated v1 client. v1 sunsets on 2026-06-01. Use
|
|
86
|
+
* `PerspectApiV2Client` / `createPerspectApiV2Client` for new integrations.
|
|
87
|
+
*/
|
|
2291
88
|
declare class AuthClient extends BaseClient {
|
|
2292
89
|
constructor(http: any, cache?: CacheManager);
|
|
2293
90
|
/**
|
|
@@ -2312,6 +109,10 @@ declare class AuthClient extends BaseClient {
|
|
|
2312
109
|
* Content Management client for PerspectAPI SDK
|
|
2313
110
|
*/
|
|
2314
111
|
|
|
112
|
+
/**
|
|
113
|
+
* @deprecated v1 client. v1 sunsets on 2026-06-01. Use `client.content`
|
|
114
|
+
* from `PerspectApiV2Client` / `createPerspectApiV2Client`.
|
|
115
|
+
*/
|
|
2315
116
|
declare class ContentClient extends BaseClient {
|
|
2316
117
|
constructor(http: any, cache?: CacheManager);
|
|
2317
118
|
/**
|
|
@@ -2384,6 +185,10 @@ declare class ContentClient extends BaseClient {
|
|
|
2384
185
|
* API Keys Management client for PerspectAPI SDK
|
|
2385
186
|
*/
|
|
2386
187
|
|
|
188
|
+
/**
|
|
189
|
+
* @deprecated v1 client. v1 sunsets on 2026-06-01. Use `client.apiKeys` from
|
|
190
|
+
* `PerspectApiV2Client` / `createPerspectApiV2Client`.
|
|
191
|
+
*/
|
|
2387
192
|
declare class ApiKeysClient extends BaseClient {
|
|
2388
193
|
constructor(http: any, cache?: CacheManager);
|
|
2389
194
|
/**
|
|
@@ -2451,6 +256,10 @@ declare class ApiKeysClient extends BaseClient {
|
|
|
2451
256
|
* Organizations Management client for PerspectAPI SDK
|
|
2452
257
|
*/
|
|
2453
258
|
|
|
259
|
+
/**
|
|
260
|
+
* @deprecated v1 client. v1 sunsets on 2026-06-01. Use
|
|
261
|
+
* `client.organizations` from `PerspectApiV2Client`.
|
|
262
|
+
*/
|
|
2454
263
|
declare class OrganizationsClient extends BaseClient {
|
|
2455
264
|
constructor(http: any, cache?: CacheManager);
|
|
2456
265
|
/**
|
|
@@ -2526,6 +335,10 @@ declare class OrganizationsClient extends BaseClient {
|
|
|
2526
335
|
* Sites Management client for PerspectAPI SDK
|
|
2527
336
|
*/
|
|
2528
337
|
|
|
338
|
+
/**
|
|
339
|
+
* @deprecated v1 client. v1 sunsets on 2026-06-01. Use `client.sites`
|
|
340
|
+
* from `PerspectApiV2Client` / `createPerspectApiV2Client`.
|
|
341
|
+
*/
|
|
2529
342
|
declare class SitesClient extends BaseClient {
|
|
2530
343
|
constructor(http: any, cache?: CacheManager);
|
|
2531
344
|
/**
|
|
@@ -2629,6 +442,10 @@ declare class SitesClient extends BaseClient {
|
|
|
2629
442
|
* Products Management client for PerspectAPI SDK
|
|
2630
443
|
*/
|
|
2631
444
|
|
|
445
|
+
/**
|
|
446
|
+
* @deprecated v1 client. v1 sunsets on 2026-06-01. Use `client.products`
|
|
447
|
+
* from `PerspectApiV2Client` / `createPerspectApiV2Client`.
|
|
448
|
+
*/
|
|
2632
449
|
declare class ProductsClient extends BaseClient {
|
|
2633
450
|
constructor(http: any, cache?: CacheManager);
|
|
2634
451
|
/**
|
|
@@ -2837,6 +654,10 @@ declare class ProductsClient extends BaseClient {
|
|
|
2837
654
|
* Categories Management client for PerspectAPI SDK
|
|
2838
655
|
*/
|
|
2839
656
|
|
|
657
|
+
/**
|
|
658
|
+
* @deprecated v1 client. v1 sunsets on 2026-06-01. Use `client.categories`
|
|
659
|
+
* from `PerspectApiV2Client` / `createPerspectApiV2Client`.
|
|
660
|
+
*/
|
|
2840
661
|
declare class CategoriesClient extends BaseClient {
|
|
2841
662
|
constructor(http: any, cache?: CacheManager);
|
|
2842
663
|
/**
|
|
@@ -2907,6 +728,10 @@ declare class CategoriesClient extends BaseClient {
|
|
|
2907
728
|
* Webhooks Management client for PerspectAPI SDK
|
|
2908
729
|
*/
|
|
2909
730
|
|
|
731
|
+
/**
|
|
732
|
+
* @deprecated v1 client. v1 sunsets on 2026-06-01. Use `client.webhooks`
|
|
733
|
+
* from `PerspectApiV2Client` / `createPerspectApiV2Client`.
|
|
734
|
+
*/
|
|
2910
735
|
declare class WebhooksClient extends BaseClient {
|
|
2911
736
|
constructor(http: any, cache?: CacheManager);
|
|
2912
737
|
/**
|
|
@@ -3053,6 +878,10 @@ declare class WebhooksClient extends BaseClient {
|
|
|
3053
878
|
* Checkout/Stripe client for PerspectAPI SDK
|
|
3054
879
|
*/
|
|
3055
880
|
|
|
881
|
+
/**
|
|
882
|
+
* @deprecated v1 client. v1 sunsets on 2026-06-01. Use v2 checkout/orders
|
|
883
|
+
* surfaces from `PerspectApiV2Client`.
|
|
884
|
+
*/
|
|
3056
885
|
declare class CheckoutClient extends BaseClient {
|
|
3057
886
|
constructor(http: any, cache?: CacheManager);
|
|
3058
887
|
/**
|
|
@@ -3226,6 +1055,10 @@ declare class CheckoutClient extends BaseClient {
|
|
|
3226
1055
|
* Contact Forms client for PerspectAPI SDK
|
|
3227
1056
|
*/
|
|
3228
1057
|
|
|
1058
|
+
/**
|
|
1059
|
+
* @deprecated v1 client. v1 sunsets on 2026-06-01. Use `client.contacts`
|
|
1060
|
+
* from `PerspectApiV2Client` / `createPerspectApiV2Client`.
|
|
1061
|
+
*/
|
|
3229
1062
|
declare class ContactClient extends BaseClient {
|
|
3230
1063
|
constructor(http: any, cache?: CacheManager);
|
|
3231
1064
|
/**
|
|
@@ -3373,6 +1206,10 @@ declare class ContactClient extends BaseClient {
|
|
|
3373
1206
|
* Newsletter subscription client for PerspectAPI SDK
|
|
3374
1207
|
*/
|
|
3375
1208
|
|
|
1209
|
+
/**
|
|
1210
|
+
* @deprecated v1 client. v1 sunsets on 2026-06-01. Use `client.newsletter`
|
|
1211
|
+
* from `PerspectApiV2Client` / `createPerspectApiV2Client`.
|
|
1212
|
+
*/
|
|
3376
1213
|
declare class NewsletterClient extends BaseClient {
|
|
3377
1214
|
constructor(http: any, cache?: CacheManager);
|
|
3378
1215
|
/**
|
|
@@ -3485,6 +1322,10 @@ declare class NewsletterClient extends BaseClient {
|
|
|
3485
1322
|
* Strict management surface under /newsletter/management/*
|
|
3486
1323
|
*/
|
|
3487
1324
|
|
|
1325
|
+
/**
|
|
1326
|
+
* @deprecated v1 client. v1 sunsets on 2026-06-01. Use `client.newsletter`
|
|
1327
|
+
* from `PerspectApiV2Client` / `createPerspectApiV2Client`.
|
|
1328
|
+
*/
|
|
3488
1329
|
declare class NewsletterManagementClient extends BaseClient {
|
|
3489
1330
|
constructor(http: any, cache?: CacheManager);
|
|
3490
1331
|
private managementEndpoint;
|
|
@@ -3648,6 +1489,10 @@ declare class NewsletterManagementClient extends BaseClient {
|
|
|
3648
1489
|
* Handles per-site customer accounts (OTP-based auth, profiles, orders, subscriptions)
|
|
3649
1490
|
*/
|
|
3650
1491
|
|
|
1492
|
+
/**
|
|
1493
|
+
* @deprecated v1 client. v1 sunsets on 2026-06-01. Use `client.siteUsers`
|
|
1494
|
+
* from `PerspectApiV2Client` / `createPerspectApiV2Client`.
|
|
1495
|
+
*/
|
|
3651
1496
|
declare class SiteUsersClient extends BaseClient {
|
|
3652
1497
|
constructor(http: any, cache?: CacheManager);
|
|
3653
1498
|
/**
|
|
@@ -3930,6 +1775,7 @@ declare class SiteUsersClient extends BaseClient {
|
|
|
3930
1775
|
fulfillment_status: string;
|
|
3931
1776
|
tracking_number?: string;
|
|
3932
1777
|
notes?: string;
|
|
1778
|
+
notify_customer?: boolean;
|
|
3933
1779
|
}): Promise<ApiResponse<{
|
|
3934
1780
|
success: boolean;
|
|
3935
1781
|
}>>;
|
|
@@ -3992,6 +1838,10 @@ declare class SiteUsersClient extends BaseClient {
|
|
|
3992
1838
|
* Bundles & Collections client for PerspectAPI SDK
|
|
3993
1839
|
*/
|
|
3994
1840
|
|
|
1841
|
+
/**
|
|
1842
|
+
* @deprecated v1 client. v1 sunsets on 2026-06-01. Use v2 collections and
|
|
1843
|
+
* products clients from `PerspectApiV2Client`.
|
|
1844
|
+
*/
|
|
3995
1845
|
declare class BundlesClient extends BaseClient {
|
|
3996
1846
|
constructor(http: any, cache?: CacheManager);
|
|
3997
1847
|
getBundleGroups(siteName: string, productId: number, cachePolicy?: CachePolicy): Promise<ApiResponse<ProductBundleGroup[]>>;
|
|
@@ -4029,7 +1879,7 @@ declare class BundlesClient extends BaseClient {
|
|
|
4029
1879
|
/**
|
|
4030
1880
|
* @deprecated v1 client is deprecated and sunsets 2026-06-01. New
|
|
4031
1881
|
* integrations must use `PerspectApiV2Client` / `createPerspectApiV2Client`
|
|
4032
|
-
* from `perspectapi-ts-sdk` (see the `v2-client` reference page).
|
|
1882
|
+
* from `perspectapi-ts-sdk/v2` (see the `v2-client` reference page).
|
|
4033
1883
|
*/
|
|
4034
1884
|
declare class PerspectApiClient {
|
|
4035
1885
|
private http;
|
|
@@ -4133,7 +1983,7 @@ declare class PerspectApiClient {
|
|
|
4133
1983
|
* Create a new PerspectAPI client instance.
|
|
4134
1984
|
*
|
|
4135
1985
|
* @deprecated v1 factory is deprecated and sunsets 2026-06-01. Use
|
|
4136
|
-
* `createPerspectApiV2Client` for new integrations.
|
|
1986
|
+
* `createPerspectApiV2Client` from `perspectapi-ts-sdk/v2` for new integrations.
|
|
4137
1987
|
*/
|
|
4138
1988
|
declare function createPerspectApiClient(config: PerspectApiConfig): PerspectApiClient;
|
|
4139
1989
|
|
|
@@ -4403,6 +2253,11 @@ declare function transformMediaItem(baseUrl: string, media: {
|
|
|
4403
2253
|
* High-level data loading helpers that wrap the PerspectAPI SDK clients.
|
|
4404
2254
|
* These helpers provide convenient product and content loading utilities with
|
|
4405
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.
|
|
4406
2261
|
*/
|
|
4407
2262
|
|
|
4408
2263
|
/**
|
|
@@ -4416,12 +2271,21 @@ interface LoaderLogger {
|
|
|
4416
2271
|
}
|
|
4417
2272
|
/**
|
|
4418
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`.
|
|
4419
2277
|
*/
|
|
4420
2278
|
declare const transformProduct: (perspectProduct: any, logger?: LoaderLogger) => Product;
|
|
4421
2279
|
/**
|
|
4422
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`.
|
|
4423
2284
|
*/
|
|
4424
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
|
+
*/
|
|
4425
2289
|
interface LoaderOptions {
|
|
4426
2290
|
/**
|
|
4427
2291
|
* Pre-configured PerspectAPI client. Pass null/undefined to force fallback behaviour.
|
|
@@ -4445,6 +2309,9 @@ interface LoaderOptions {
|
|
|
4445
2309
|
*/
|
|
4446
2310
|
limit?: number;
|
|
4447
2311
|
}
|
|
2312
|
+
/**
|
|
2313
|
+
* @deprecated v1 loader options. Use `client.products` from v2 directly.
|
|
2314
|
+
*/
|
|
4448
2315
|
interface LoadProductsOptions extends LoaderOptions {
|
|
4449
2316
|
/**
|
|
4450
2317
|
* Optional search term applied server-side.
|
|
@@ -4465,15 +2332,27 @@ interface LoadProductsOptions extends LoaderOptions {
|
|
|
4465
2332
|
}
|
|
4466
2333
|
/**
|
|
4467
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.
|
|
4468
2338
|
*/
|
|
4469
2339
|
declare function loadProducts(options: LoadProductsOptions): Promise<Product[]>;
|
|
2340
|
+
/**
|
|
2341
|
+
* @deprecated v1 loader options. Use `client.products` from v2 directly.
|
|
2342
|
+
*/
|
|
4470
2343
|
interface LoadProductBySlugOptions extends LoaderOptions {
|
|
4471
2344
|
slug: string;
|
|
4472
2345
|
}
|
|
4473
2346
|
/**
|
|
4474
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.
|
|
4475
2351
|
*/
|
|
4476
2352
|
declare function loadProductBySlug(options: LoadProductBySlugOptions): Promise<Product | null>;
|
|
2353
|
+
/**
|
|
2354
|
+
* @deprecated v1 loader options. Use `client.content` from v2 directly.
|
|
2355
|
+
*/
|
|
4477
2356
|
interface LoadContentOptions extends LoaderOptions {
|
|
4478
2357
|
/**
|
|
4479
2358
|
* Additional query parameters for content filtering.
|
|
@@ -4487,34 +2366,61 @@ interface LoadContentOptions extends LoaderOptions {
|
|
|
4487
2366
|
}
|
|
4488
2367
|
/**
|
|
4489
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.
|
|
4490
2372
|
*/
|
|
4491
2373
|
declare function loadPages(options: LoadContentOptions): Promise<BlogPost[]>;
|
|
4492
2374
|
/**
|
|
4493
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.
|
|
4494
2379
|
*/
|
|
4495
2380
|
declare function loadPosts(options: LoadContentOptions): Promise<BlogPost[]>;
|
|
2381
|
+
/**
|
|
2382
|
+
* @deprecated v1 loader options. Use `client.content` from v2 directly.
|
|
2383
|
+
*/
|
|
4496
2384
|
interface LoadContentBySlugOptions extends LoaderOptions {
|
|
4497
2385
|
slug: string;
|
|
4498
2386
|
}
|
|
4499
2387
|
/**
|
|
4500
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.
|
|
4501
2392
|
*/
|
|
4502
2393
|
declare function loadContentBySlug(options: LoadContentBySlugOptions): Promise<BlogPost | null>;
|
|
2394
|
+
/**
|
|
2395
|
+
* @deprecated v1 loader options. Use `client.content` from v2 directly.
|
|
2396
|
+
*/
|
|
4503
2397
|
interface LoadBlockBySlugOptions extends LoaderOptions {
|
|
4504
2398
|
slug: string;
|
|
4505
2399
|
}
|
|
4506
2400
|
/**
|
|
4507
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.
|
|
4508
2405
|
*/
|
|
4509
2406
|
declare function loadBlocks(options: LoadContentOptions): Promise<BlogPost[]>;
|
|
4510
2407
|
/**
|
|
4511
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.
|
|
4512
2412
|
*/
|
|
4513
2413
|
declare function loadBlockBySlug(options: LoadBlockBySlugOptions): Promise<BlogPost | null>;
|
|
4514
2414
|
/**
|
|
4515
2415
|
* Load all published content (pages + posts).
|
|
2416
|
+
*
|
|
2417
|
+
* @deprecated Uses the v1 client. Use v2 `client.content` reads directly for
|
|
2418
|
+
* new integrations.
|
|
4516
2419
|
*/
|
|
4517
2420
|
declare function loadAllContent(options: LoaderOptions): Promise<BlogPost[]>;
|
|
2421
|
+
/**
|
|
2422
|
+
* @deprecated v1 checkout helper options. Use v2 checkout/orders surfaces.
|
|
2423
|
+
*/
|
|
4518
2424
|
interface CheckoutSessionOptions {
|
|
4519
2425
|
client?: PerspectApiClient | null;
|
|
4520
2426
|
siteName: string;
|
|
@@ -4557,9 +2463,12 @@ interface CheckoutSessionOptions {
|
|
|
4557
2463
|
/**
|
|
4558
2464
|
* Convenience helper that creates a checkout session by looking up Stripe price IDs
|
|
4559
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.
|
|
4560
2469
|
*/
|
|
4561
2470
|
declare function createCheckoutSession(options: CheckoutSessionOptions): Promise<ApiResponse<CheckoutSession> | {
|
|
4562
2471
|
error: string;
|
|
4563
2472
|
}>;
|
|
4564
2473
|
|
|
4565
|
-
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 };
|