perspectapi-ts-sdk 7.0.1 → 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-MZ22HQBX.mjs → chunk-MMKJ2WBF.mjs} +30 -0
- package/dist/{index-BL9-AZpq.d.mts → index-DuNDHod-.d.mts} +69 -1
- package/dist/{index-BL9-AZpq.d.ts → index-DuNDHod-.d.ts} +69 -1
- package/dist/index.d.mts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +29 -0
- package/dist/index.mjs +1 -1
- package/dist/v2/index.d.mts +1 -1
- package/dist/v2/index.d.ts +1 -1
- package/dist/v2/index.js +31 -0
- package/dist/v2/index.mjs +3 -1
- package/package.json +1 -1
- package/src/client/site-users-client.ts +2 -0
- package/src/v2/client/email-client.ts +23 -0
- package/src/v2/client/orders-client.ts +16 -0
- package/src/v2/index.ts +4 -0
- package/src/v2/types.ts +54 -0
|
@@ -957,6 +957,16 @@ var OrdersV2Client = class extends BaseV2Client {
|
|
|
957
957
|
});
|
|
958
958
|
return result;
|
|
959
959
|
}
|
|
960
|
+
/**
|
|
961
|
+
* Send the customer fulfillment template for an external delivery/packing
|
|
962
|
+
* record without mutating a checkout session.
|
|
963
|
+
*/
|
|
964
|
+
async sendFulfillmentNotification(siteName, data) {
|
|
965
|
+
return this.post(
|
|
966
|
+
this.sitePath(siteName, "orders", "fulfillment-notifications"),
|
|
967
|
+
data
|
|
968
|
+
);
|
|
969
|
+
}
|
|
960
970
|
withOrderTags(siteName, cachePolicy, options = {}) {
|
|
961
971
|
const tags = new Set(cachePolicy?.tags ?? []);
|
|
962
972
|
for (const tag of this.buildOrderTags(siteName, options)) {
|
|
@@ -1367,6 +1377,23 @@ var CreditsV2Client = class extends BaseV2Client {
|
|
|
1367
1377
|
}
|
|
1368
1378
|
};
|
|
1369
1379
|
|
|
1380
|
+
// src/v2/client/email-client.ts
|
|
1381
|
+
var EmailV2Client = class extends BaseV2Client {
|
|
1382
|
+
/**
|
|
1383
|
+
* Send a transactional email using the site's configured email provider.
|
|
1384
|
+
*
|
|
1385
|
+
* Requires a server-side API key — never call this from a browser.
|
|
1386
|
+
* The site must have an email provider configured in its settings.
|
|
1387
|
+
* At least one of `html` or `text` must be provided.
|
|
1388
|
+
*/
|
|
1389
|
+
async send(siteName, params) {
|
|
1390
|
+
return this.post(
|
|
1391
|
+
this.sitePath(siteName, "email", "send"),
|
|
1392
|
+
params
|
|
1393
|
+
);
|
|
1394
|
+
}
|
|
1395
|
+
};
|
|
1396
|
+
|
|
1370
1397
|
// src/v2/index.ts
|
|
1371
1398
|
var PerspectApiV2Client = class {
|
|
1372
1399
|
http;
|
|
@@ -1385,6 +1412,7 @@ var PerspectApiV2Client = class {
|
|
|
1385
1412
|
webhooks;
|
|
1386
1413
|
subscriptions;
|
|
1387
1414
|
credits;
|
|
1415
|
+
email;
|
|
1388
1416
|
constructor(config) {
|
|
1389
1417
|
const baseUrl = config.baseUrl.replace(/\/+$/, "");
|
|
1390
1418
|
const v2BaseUrl = baseUrl.endsWith("/api/v2") ? baseUrl : `${baseUrl}/api/v2`;
|
|
@@ -1406,6 +1434,7 @@ var PerspectApiV2Client = class {
|
|
|
1406
1434
|
this.webhooks = new WebhooksV2Client(this.http, basePath, cache);
|
|
1407
1435
|
this.subscriptions = new SubscriptionsV2Client(this.http, basePath, cache);
|
|
1408
1436
|
this.credits = new CreditsV2Client(this.http, basePath, cache);
|
|
1437
|
+
this.email = new EmailV2Client(this.http, basePath, cache);
|
|
1409
1438
|
}
|
|
1410
1439
|
/** Update the JWT token for authenticated requests. */
|
|
1411
1440
|
setAuth(jwt) {
|
|
@@ -1446,6 +1475,7 @@ export {
|
|
|
1446
1475
|
WebhooksV2Client,
|
|
1447
1476
|
SubscriptionsV2Client,
|
|
1448
1477
|
CreditsV2Client,
|
|
1478
|
+
EmailV2Client,
|
|
1449
1479
|
PerspectApiV2Client,
|
|
1450
1480
|
createPerspectApiV2Client
|
|
1451
1481
|
};
|
|
@@ -1462,9 +1462,40 @@ interface V2OrderFulfillmentUpdate {
|
|
|
1462
1462
|
fulfillment_status: string;
|
|
1463
1463
|
tracking_number?: string;
|
|
1464
1464
|
notes?: string;
|
|
1465
|
+
fulfillment_details_text?: string;
|
|
1466
|
+
fulfillment_details_html?: string;
|
|
1465
1467
|
/** When true, a terminal fulfillment status triggers a customer email. */
|
|
1466
1468
|
notify_customer?: boolean;
|
|
1467
1469
|
}
|
|
1470
|
+
interface V2OrderFulfillmentNotificationLineItem {
|
|
1471
|
+
quantity: number;
|
|
1472
|
+
description: string;
|
|
1473
|
+
amount_total?: number;
|
|
1474
|
+
currency?: string;
|
|
1475
|
+
}
|
|
1476
|
+
interface V2OrderFulfillmentNotificationParams {
|
|
1477
|
+
session_id?: string;
|
|
1478
|
+
order_id?: string;
|
|
1479
|
+
customer_email: string;
|
|
1480
|
+
customer_name?: string;
|
|
1481
|
+
fulfillment_status?: string;
|
|
1482
|
+
fulfillment_details_text?: string;
|
|
1483
|
+
fulfillment_details_html?: string;
|
|
1484
|
+
line_items?: V2OrderFulfillmentNotificationLineItem[];
|
|
1485
|
+
amount_total?: number;
|
|
1486
|
+
currency?: string;
|
|
1487
|
+
shipping_details?: Record<string, unknown>;
|
|
1488
|
+
customer_details?: Record<string, unknown>;
|
|
1489
|
+
metadata?: Record<string, unknown>;
|
|
1490
|
+
created_at?: string;
|
|
1491
|
+
}
|
|
1492
|
+
interface V2OrderFulfillmentNotificationResult extends V2Object {
|
|
1493
|
+
object: "fulfillment_notification";
|
|
1494
|
+
order_id: string;
|
|
1495
|
+
notified: boolean;
|
|
1496
|
+
queued: boolean;
|
|
1497
|
+
reason?: string;
|
|
1498
|
+
}
|
|
1468
1499
|
interface V2OrderCreateResult extends V2Object {
|
|
1469
1500
|
object: "checkout_session";
|
|
1470
1501
|
checkout_url: string | null;
|
|
@@ -1802,6 +1833,22 @@ interface V2GrantCreditResult {
|
|
|
1802
1833
|
object: "grant_credit_result";
|
|
1803
1834
|
new_balance_cents: number;
|
|
1804
1835
|
}
|
|
1836
|
+
interface V2EmailSendParams {
|
|
1837
|
+
to: string | string[];
|
|
1838
|
+
subject: string;
|
|
1839
|
+
html?: string;
|
|
1840
|
+
text?: string;
|
|
1841
|
+
from?: string;
|
|
1842
|
+
reply_to?: string;
|
|
1843
|
+
cc?: string | string[];
|
|
1844
|
+
bcc?: string | string[];
|
|
1845
|
+
}
|
|
1846
|
+
interface V2EmailSendResult {
|
|
1847
|
+
object: "email";
|
|
1848
|
+
id: string | null;
|
|
1849
|
+
status: "sent";
|
|
1850
|
+
to: string | string[];
|
|
1851
|
+
}
|
|
1805
1852
|
|
|
1806
1853
|
/**
|
|
1807
1854
|
* v2 Base Client — cursor pagination, expand support, caching, typed errors.
|
|
@@ -1958,6 +2005,11 @@ declare class OrdersV2Client extends BaseV2Client {
|
|
|
1958
2005
|
* fulfillment state to send the customer fulfillment email.
|
|
1959
2006
|
*/
|
|
1960
2007
|
updateFulfillment(siteName: string, id: string, data: V2OrderFulfillmentUpdate): Promise<V2Order>;
|
|
2008
|
+
/**
|
|
2009
|
+
* Send the customer fulfillment template for an external delivery/packing
|
|
2010
|
+
* record without mutating a checkout session.
|
|
2011
|
+
*/
|
|
2012
|
+
sendFulfillmentNotification(siteName: string, data: V2OrderFulfillmentNotificationParams): Promise<V2OrderFulfillmentNotificationResult>;
|
|
1961
2013
|
private withOrderTags;
|
|
1962
2014
|
private buildOrderTags;
|
|
1963
2015
|
private normalizeTagPart;
|
|
@@ -2182,6 +2234,21 @@ declare class CreditsV2Client extends BaseV2Client {
|
|
|
2182
2234
|
grantCredit(siteName: string, userId: string, data: V2GrantCreditParams): Promise<V2GrantCreditResult>;
|
|
2183
2235
|
}
|
|
2184
2236
|
|
|
2237
|
+
/**
|
|
2238
|
+
* v2 Email Client — send transactional email through a site's configured provider.
|
|
2239
|
+
*/
|
|
2240
|
+
|
|
2241
|
+
declare class EmailV2Client extends BaseV2Client {
|
|
2242
|
+
/**
|
|
2243
|
+
* Send a transactional email using the site's configured email provider.
|
|
2244
|
+
*
|
|
2245
|
+
* Requires a server-side API key — never call this from a browser.
|
|
2246
|
+
* The site must have an email provider configured in its settings.
|
|
2247
|
+
* At least one of `html` or `text` must be provided.
|
|
2248
|
+
*/
|
|
2249
|
+
send(siteName: string, params: V2EmailSendParams): Promise<V2EmailSendResult>;
|
|
2250
|
+
}
|
|
2251
|
+
|
|
2185
2252
|
/**
|
|
2186
2253
|
* PerspectAPI v2 SDK Client
|
|
2187
2254
|
*
|
|
@@ -2214,6 +2281,7 @@ declare class PerspectApiV2Client {
|
|
|
2214
2281
|
readonly webhooks: WebhooksV2Client;
|
|
2215
2282
|
readonly subscriptions: SubscriptionsV2Client;
|
|
2216
2283
|
readonly credits: CreditsV2Client;
|
|
2284
|
+
readonly email: EmailV2Client;
|
|
2217
2285
|
constructor(config: PerspectApiV2Config);
|
|
2218
2286
|
/** Update the JWT token for authenticated requests. */
|
|
2219
2287
|
setAuth(jwt: string): void;
|
|
@@ -2224,4 +2292,4 @@ declare class PerspectApiV2Client {
|
|
|
2224
2292
|
}
|
|
2225
2293
|
declare function createPerspectApiV2Client(config: PerspectApiConfig): PerspectApiV2Client;
|
|
2226
2294
|
|
|
2227
|
-
export { type NewsletterManagementList as $, type ApiResponse as A, type CreateNewsletterSubscriptionRequest as B, CacheManager as C, type NewsletterConfirmResponse as D, type NewsletterUnsubscribeRequest as E, type NewsletterUnsubscribeResponse as F, type NewsletterPreferences as G, HttpClient as H, type NewsletterList as I, type NewsletterCampaignListResponse as J, type NewsletterCampaignDetail as K, type NewsletterStatusResponse as L, type NewsletterManagementSubscriptionsListResponse as M, type NewsletterSubscribeResponse as N, type Organization as O, type PaginatedResponse as P, type NewsletterManagementSubscription as Q, type NewsletterSubscriptionSyncRequest as R, type Site as S, type NewsletterSubscriptionSyncResponse as T, type User as U, type NewsletterSubscriptionsBulkUpdateRequest as V, type Webhook as W, type NewsletterSubscriptionsBulkUpdateResponse as X, type NewsletterSubscriptionMembershipUpdateRequest as Y, type NewsletterSubscriptionsImportRequest as Z, type NewsletterSubscriptionsImportResponse as _, type CachePolicy as a, type V2ContentListParams as a$, type NewsletterManagementSeries as a0, type NewsletterManagementCampaignListResponse as a1, type NewsletterManagementCampaign as a2, type NewsletterCampaignTestSendRequest as a3, type NewsletterCampaignTestSendResponse as a4, type NewsletterManagementStatsResponse as a5, type NewsletterExportCreateRequest as a6, type NewsletterExportCreateResponse as a7, type RequestOtpRequest as a8, type VerifyOtpRequest as a9, PerspectV2Error as aA, createApiError as aB, PerspectApiError as aC, type CacheConfig as aD, type ApiError as aE, type MediaItem as aF, type CategorySummary as aG, type PaymentGateway as aH, type NewsletterSubscription as aI, type NewsletterCampaignSummary as aJ, type NewsletterManagementListMembership as aK, type NewsletterSubscriptionsBulkAction as aL, type NewsletterSubscriptionsBulkOutcome as aM, type NewsletterSubscriptionImportRowRequest as aN, type NewsletterSubscriptionsImportRowResult as aO, type NewsletterManagementPagination as aP, type SetProfileValueRequest as aQ, type V2Object as aR, type V2List as aS, type V2Deleted as aT, type V2Error as aU, type V2ErrorType as aV, type V2PaginationParams as aW, type V2Media as aX, type V2Content as aY, type V2ContentCreateParams as aZ, type V2ContentUpdateParams as a_, type VerifyOtpResponse as aa, type SiteUser as ab, type SiteUserProfile as ac, type UpdateSiteUserRequest as ad, type SiteUserOrder as ae, type SiteUserSubscription as af, type CancelSubscriptionRequest as ag, type CancelSubscriptionResponse as ah, type CreditBalance as ai, type CreditBalanceWithTransactions as aj, type GrantCreditRequest as ak, type ProductBundleGroup as al, type CreateBundleGroupRequest as am, type BundleCollection as an, type BundleCollectionItemWithProduct as ao, type CreateBundleCollectionRequest as ap, type AddCollectionItemRequest as aq, type BundleCollectionItem as ar, type PerspectApiConfig as as, type CacheAdapter as at, type BlogPost as au, type CheckoutMetadata as av, type CheckoutAddress as aw, type CheckoutTaxRequest as ax, PerspectApiV2Client as ay, createPerspectApiV2Client as az, type CacheInvalidateOptions as b, type
|
|
2295
|
+
export { type NewsletterManagementList as $, type ApiResponse as A, type CreateNewsletterSubscriptionRequest as B, CacheManager as C, type NewsletterConfirmResponse as D, type NewsletterUnsubscribeRequest as E, type NewsletterUnsubscribeResponse as F, type NewsletterPreferences as G, HttpClient as H, type NewsletterList as I, type NewsletterCampaignListResponse as J, type NewsletterCampaignDetail as K, type NewsletterStatusResponse as L, type NewsletterManagementSubscriptionsListResponse as M, type NewsletterSubscribeResponse as N, type Organization as O, type PaginatedResponse as P, type NewsletterManagementSubscription as Q, type NewsletterSubscriptionSyncRequest as R, type Site as S, type NewsletterSubscriptionSyncResponse as T, type User as U, type NewsletterSubscriptionsBulkUpdateRequest as V, type Webhook as W, type NewsletterSubscriptionsBulkUpdateResponse as X, type NewsletterSubscriptionMembershipUpdateRequest as Y, type NewsletterSubscriptionsImportRequest as Z, type NewsletterSubscriptionsImportResponse as _, type CachePolicy as a, type V2ContentListParams as a$, type NewsletterManagementSeries as a0, type NewsletterManagementCampaignListResponse as a1, type NewsletterManagementCampaign as a2, type NewsletterCampaignTestSendRequest as a3, type NewsletterCampaignTestSendResponse as a4, type NewsletterManagementStatsResponse as a5, type NewsletterExportCreateRequest as a6, type NewsletterExportCreateResponse as a7, type RequestOtpRequest as a8, type VerifyOtpRequest as a9, PerspectV2Error as aA, createApiError as aB, PerspectApiError as aC, type CacheConfig as aD, type ApiError as aE, type MediaItem as aF, type CategorySummary as aG, type PaymentGateway as aH, type NewsletterSubscription as aI, type NewsletterCampaignSummary as aJ, type NewsletterManagementListMembership as aK, type NewsletterSubscriptionsBulkAction as aL, type NewsletterSubscriptionsBulkOutcome as aM, type NewsletterSubscriptionImportRowRequest as aN, type NewsletterSubscriptionsImportRowResult as aO, type NewsletterManagementPagination as aP, type SetProfileValueRequest as aQ, type V2Object as aR, type V2List as aS, type V2Deleted as aT, type V2Error as aU, type V2ErrorType as aV, type V2PaginationParams as aW, type V2Media as aX, type V2Content as aY, type V2ContentCreateParams as aZ, type V2ContentUpdateParams as a_, type VerifyOtpResponse as aa, type SiteUser as ab, type SiteUserProfile as ac, type UpdateSiteUserRequest as ad, type SiteUserOrder as ae, type SiteUserSubscription as af, type CancelSubscriptionRequest as ag, type CancelSubscriptionResponse as ah, type CreditBalance as ai, type CreditBalanceWithTransactions as aj, type GrantCreditRequest as ak, type ProductBundleGroup as al, type CreateBundleGroupRequest as am, type BundleCollection as an, type BundleCollectionItemWithProduct as ao, type CreateBundleCollectionRequest as ap, type AddCollectionItemRequest as aq, type BundleCollectionItem as ar, type PerspectApiConfig as as, type CacheAdapter as at, type BlogPost as au, type CheckoutMetadata as av, type CheckoutAddress as aw, type CheckoutTaxRequest as ax, PerspectApiV2Client as ay, createPerspectApiV2Client as az, type CacheInvalidateOptions as b, type ContentType as b$, type V2Product as b0, type V2ProductCreateParams as b1, type V2ProductUpdateParams as b2, type V2ProductListParams as b3, type V2Category as b4, type V2CategoryCreateParams as b5, type V2CategoryUpdateParams as b6, type V2Collection as b7, type V2CollectionItem as b8, type V2CollectionCreateParams as b9, type V2NewsletterSyncResult as bA, type V2NewsletterSubscriptionListMembershipUpdate as bB, type V2NewsletterImportRequest as bC, type V2NewsletterImportResult as bD, type V2ContactSubmission as bE, type V2Organization as bF, type V2Site as bG, type V2ApiKey as bH, type V2WebhookEventType as bI, type V2Webhook as bJ, type V2WebhookCreateParams as bK, type V2WebhookUpdateParams as bL, type V2SiteUserSubscription as bM, type V2SubscriptionPauseParams as bN, type V2SubscriptionCancelParams as bO, type V2SubscriptionChangePlanParams as bP, type V2SubscriptionChargeParams as bQ, type V2SubscriptionChargeResult as bR, type V2CancelSubscriptionResult as bS, type V2CreditTransaction as bT, type V2CreditBalance as bU, type V2GrantCreditParams as bV, type V2GrantCreditResult as bW, type V2EmailSendParams as bX, type V2EmailSendResult as bY, type PaginationParams as bZ, type ContentStatus as b_, type V2CollectionUpdateParams as ba, type V2Order as bb, type V2OrderListParams as bc, type V2OrderLineItemPriceData as bd, type V2OrderLineItem as be, type V2OrderAddress as bf, type V2OrderTaxRequest as bg, type V2OrderCreateParams as bh, type V2OrderFulfillmentUpdate as bi, type V2OrderFulfillmentNotificationLineItem as bj, type V2OrderFulfillmentNotificationParams as bk, type V2OrderFulfillmentNotificationResult as bl, type V2OrderCreateResult as bm, type V2SiteUser as bn, type V2SiteUserUpdateParams as bo, type V2SiteUserMeUpdateParams as bp, type V2SiteUserListParams as bq, type V2SiteUserWithProfile as br, type V2SiteUserProfile as bs, type V2NewsletterSubscription as bt, type V2NewsletterList as bu, type V2NewsletterCampaign as bv, type V2NewsletterTrackingResponse as bw, type V2NewsletterListCreateParams as bx, type V2NewsletterListUpdateParams as by, type V2NewsletterSyncInput as bz, type ContentQueryParams as c, type ProductSkuMediaItem as c0, type ProductSkuOption as c1, type CreatePaymentGatewayRequest as c2, type WebhookEventType as c3, type CheckoutMetadataValue as c4, type CheckoutTaxStrategy as c5, type CheckoutTaxExemptionStatus as c6, type CheckoutTaxCustomerExemptionRequest as c7, type CheckoutTaxBreakdownItem as c8, type CheckoutSessionTax as c9, type SubscriptionCancellationMode as ca, type CreditTransaction as cb, type HttpMethod as cc, type RequestOptions as cd, type PerspectApiV2Config as ce, BaseV2Client as cf, ContentV2Client as cg, ProductsV2Client as ch, CategoriesV2Client as ci, CollectionsV2Client as cj, OrdersV2Client as ck, SiteUsersV2Client as cl, NewsletterV2Client as cm, ContactsV2Client as cn, OrganizationsV2Client as co, SitesV2Client as cp, ApiKeysV2Client as cq, WebhooksV2Client as cr, SubscriptionsV2Client as cs, CreditsV2Client as ct, EmailV2Client as cu, type Content as d, type ContentCategoryResponse as e, type CreateContentRequest as f, type UpdateContentRequest as g, type ApiKey as h, type CreateApiKeyRequest as i, type UpdateApiKeyRequest as j, type CreateOrganizationRequest as k, type CreateSiteRequest as l, type ProductQueryParams as m, type Product as n, type CreateProductRequest as o, type ProductSku as p, type CreateProductSkuRequest as q, type Category as r, type CreateCategoryRequest as s, type CreateWebhookRequest as t, type CreateCheckoutSessionRequest as u, type CheckoutSession as v, type CreateContactRequest as w, type ContactSubmitResponse as x, type ContactStatusResponse as y, type ContactSubmission as z };
|
|
@@ -1462,9 +1462,40 @@ interface V2OrderFulfillmentUpdate {
|
|
|
1462
1462
|
fulfillment_status: string;
|
|
1463
1463
|
tracking_number?: string;
|
|
1464
1464
|
notes?: string;
|
|
1465
|
+
fulfillment_details_text?: string;
|
|
1466
|
+
fulfillment_details_html?: string;
|
|
1465
1467
|
/** When true, a terminal fulfillment status triggers a customer email. */
|
|
1466
1468
|
notify_customer?: boolean;
|
|
1467
1469
|
}
|
|
1470
|
+
interface V2OrderFulfillmentNotificationLineItem {
|
|
1471
|
+
quantity: number;
|
|
1472
|
+
description: string;
|
|
1473
|
+
amount_total?: number;
|
|
1474
|
+
currency?: string;
|
|
1475
|
+
}
|
|
1476
|
+
interface V2OrderFulfillmentNotificationParams {
|
|
1477
|
+
session_id?: string;
|
|
1478
|
+
order_id?: string;
|
|
1479
|
+
customer_email: string;
|
|
1480
|
+
customer_name?: string;
|
|
1481
|
+
fulfillment_status?: string;
|
|
1482
|
+
fulfillment_details_text?: string;
|
|
1483
|
+
fulfillment_details_html?: string;
|
|
1484
|
+
line_items?: V2OrderFulfillmentNotificationLineItem[];
|
|
1485
|
+
amount_total?: number;
|
|
1486
|
+
currency?: string;
|
|
1487
|
+
shipping_details?: Record<string, unknown>;
|
|
1488
|
+
customer_details?: Record<string, unknown>;
|
|
1489
|
+
metadata?: Record<string, unknown>;
|
|
1490
|
+
created_at?: string;
|
|
1491
|
+
}
|
|
1492
|
+
interface V2OrderFulfillmentNotificationResult extends V2Object {
|
|
1493
|
+
object: "fulfillment_notification";
|
|
1494
|
+
order_id: string;
|
|
1495
|
+
notified: boolean;
|
|
1496
|
+
queued: boolean;
|
|
1497
|
+
reason?: string;
|
|
1498
|
+
}
|
|
1468
1499
|
interface V2OrderCreateResult extends V2Object {
|
|
1469
1500
|
object: "checkout_session";
|
|
1470
1501
|
checkout_url: string | null;
|
|
@@ -1802,6 +1833,22 @@ interface V2GrantCreditResult {
|
|
|
1802
1833
|
object: "grant_credit_result";
|
|
1803
1834
|
new_balance_cents: number;
|
|
1804
1835
|
}
|
|
1836
|
+
interface V2EmailSendParams {
|
|
1837
|
+
to: string | string[];
|
|
1838
|
+
subject: string;
|
|
1839
|
+
html?: string;
|
|
1840
|
+
text?: string;
|
|
1841
|
+
from?: string;
|
|
1842
|
+
reply_to?: string;
|
|
1843
|
+
cc?: string | string[];
|
|
1844
|
+
bcc?: string | string[];
|
|
1845
|
+
}
|
|
1846
|
+
interface V2EmailSendResult {
|
|
1847
|
+
object: "email";
|
|
1848
|
+
id: string | null;
|
|
1849
|
+
status: "sent";
|
|
1850
|
+
to: string | string[];
|
|
1851
|
+
}
|
|
1805
1852
|
|
|
1806
1853
|
/**
|
|
1807
1854
|
* v2 Base Client — cursor pagination, expand support, caching, typed errors.
|
|
@@ -1958,6 +2005,11 @@ declare class OrdersV2Client extends BaseV2Client {
|
|
|
1958
2005
|
* fulfillment state to send the customer fulfillment email.
|
|
1959
2006
|
*/
|
|
1960
2007
|
updateFulfillment(siteName: string, id: string, data: V2OrderFulfillmentUpdate): Promise<V2Order>;
|
|
2008
|
+
/**
|
|
2009
|
+
* Send the customer fulfillment template for an external delivery/packing
|
|
2010
|
+
* record without mutating a checkout session.
|
|
2011
|
+
*/
|
|
2012
|
+
sendFulfillmentNotification(siteName: string, data: V2OrderFulfillmentNotificationParams): Promise<V2OrderFulfillmentNotificationResult>;
|
|
1961
2013
|
private withOrderTags;
|
|
1962
2014
|
private buildOrderTags;
|
|
1963
2015
|
private normalizeTagPart;
|
|
@@ -2182,6 +2234,21 @@ declare class CreditsV2Client extends BaseV2Client {
|
|
|
2182
2234
|
grantCredit(siteName: string, userId: string, data: V2GrantCreditParams): Promise<V2GrantCreditResult>;
|
|
2183
2235
|
}
|
|
2184
2236
|
|
|
2237
|
+
/**
|
|
2238
|
+
* v2 Email Client — send transactional email through a site's configured provider.
|
|
2239
|
+
*/
|
|
2240
|
+
|
|
2241
|
+
declare class EmailV2Client extends BaseV2Client {
|
|
2242
|
+
/**
|
|
2243
|
+
* Send a transactional email using the site's configured email provider.
|
|
2244
|
+
*
|
|
2245
|
+
* Requires a server-side API key — never call this from a browser.
|
|
2246
|
+
* The site must have an email provider configured in its settings.
|
|
2247
|
+
* At least one of `html` or `text` must be provided.
|
|
2248
|
+
*/
|
|
2249
|
+
send(siteName: string, params: V2EmailSendParams): Promise<V2EmailSendResult>;
|
|
2250
|
+
}
|
|
2251
|
+
|
|
2185
2252
|
/**
|
|
2186
2253
|
* PerspectAPI v2 SDK Client
|
|
2187
2254
|
*
|
|
@@ -2214,6 +2281,7 @@ declare class PerspectApiV2Client {
|
|
|
2214
2281
|
readonly webhooks: WebhooksV2Client;
|
|
2215
2282
|
readonly subscriptions: SubscriptionsV2Client;
|
|
2216
2283
|
readonly credits: CreditsV2Client;
|
|
2284
|
+
readonly email: EmailV2Client;
|
|
2217
2285
|
constructor(config: PerspectApiV2Config);
|
|
2218
2286
|
/** Update the JWT token for authenticated requests. */
|
|
2219
2287
|
setAuth(jwt: string): void;
|
|
@@ -2224,4 +2292,4 @@ declare class PerspectApiV2Client {
|
|
|
2224
2292
|
}
|
|
2225
2293
|
declare function createPerspectApiV2Client(config: PerspectApiConfig): PerspectApiV2Client;
|
|
2226
2294
|
|
|
2227
|
-
export { type NewsletterManagementList as $, type ApiResponse as A, type CreateNewsletterSubscriptionRequest as B, CacheManager as C, type NewsletterConfirmResponse as D, type NewsletterUnsubscribeRequest as E, type NewsletterUnsubscribeResponse as F, type NewsletterPreferences as G, HttpClient as H, type NewsletterList as I, type NewsletterCampaignListResponse as J, type NewsletterCampaignDetail as K, type NewsletterStatusResponse as L, type NewsletterManagementSubscriptionsListResponse as M, type NewsletterSubscribeResponse as N, type Organization as O, type PaginatedResponse as P, type NewsletterManagementSubscription as Q, type NewsletterSubscriptionSyncRequest as R, type Site as S, type NewsletterSubscriptionSyncResponse as T, type User as U, type NewsletterSubscriptionsBulkUpdateRequest as V, type Webhook as W, type NewsletterSubscriptionsBulkUpdateResponse as X, type NewsletterSubscriptionMembershipUpdateRequest as Y, type NewsletterSubscriptionsImportRequest as Z, type NewsletterSubscriptionsImportResponse as _, type CachePolicy as a, type V2ContentListParams as a$, type NewsletterManagementSeries as a0, type NewsletterManagementCampaignListResponse as a1, type NewsletterManagementCampaign as a2, type NewsletterCampaignTestSendRequest as a3, type NewsletterCampaignTestSendResponse as a4, type NewsletterManagementStatsResponse as a5, type NewsletterExportCreateRequest as a6, type NewsletterExportCreateResponse as a7, type RequestOtpRequest as a8, type VerifyOtpRequest as a9, PerspectV2Error as aA, createApiError as aB, PerspectApiError as aC, type CacheConfig as aD, type ApiError as aE, type MediaItem as aF, type CategorySummary as aG, type PaymentGateway as aH, type NewsletterSubscription as aI, type NewsletterCampaignSummary as aJ, type NewsletterManagementListMembership as aK, type NewsletterSubscriptionsBulkAction as aL, type NewsletterSubscriptionsBulkOutcome as aM, type NewsletterSubscriptionImportRowRequest as aN, type NewsletterSubscriptionsImportRowResult as aO, type NewsletterManagementPagination as aP, type SetProfileValueRequest as aQ, type V2Object as aR, type V2List as aS, type V2Deleted as aT, type V2Error as aU, type V2ErrorType as aV, type V2PaginationParams as aW, type V2Media as aX, type V2Content as aY, type V2ContentCreateParams as aZ, type V2ContentUpdateParams as a_, type VerifyOtpResponse as aa, type SiteUser as ab, type SiteUserProfile as ac, type UpdateSiteUserRequest as ad, type SiteUserOrder as ae, type SiteUserSubscription as af, type CancelSubscriptionRequest as ag, type CancelSubscriptionResponse as ah, type CreditBalance as ai, type CreditBalanceWithTransactions as aj, type GrantCreditRequest as ak, type ProductBundleGroup as al, type CreateBundleGroupRequest as am, type BundleCollection as an, type BundleCollectionItemWithProduct as ao, type CreateBundleCollectionRequest as ap, type AddCollectionItemRequest as aq, type BundleCollectionItem as ar, type PerspectApiConfig as as, type CacheAdapter as at, type BlogPost as au, type CheckoutMetadata as av, type CheckoutAddress as aw, type CheckoutTaxRequest as ax, PerspectApiV2Client as ay, createPerspectApiV2Client as az, type CacheInvalidateOptions as b, type
|
|
2295
|
+
export { type NewsletterManagementList as $, type ApiResponse as A, type CreateNewsletterSubscriptionRequest as B, CacheManager as C, type NewsletterConfirmResponse as D, type NewsletterUnsubscribeRequest as E, type NewsletterUnsubscribeResponse as F, type NewsletterPreferences as G, HttpClient as H, type NewsletterList as I, type NewsletterCampaignListResponse as J, type NewsletterCampaignDetail as K, type NewsletterStatusResponse as L, type NewsletterManagementSubscriptionsListResponse as M, type NewsletterSubscribeResponse as N, type Organization as O, type PaginatedResponse as P, type NewsletterManagementSubscription as Q, type NewsletterSubscriptionSyncRequest as R, type Site as S, type NewsletterSubscriptionSyncResponse as T, type User as U, type NewsletterSubscriptionsBulkUpdateRequest as V, type Webhook as W, type NewsletterSubscriptionsBulkUpdateResponse as X, type NewsletterSubscriptionMembershipUpdateRequest as Y, type NewsletterSubscriptionsImportRequest as Z, type NewsletterSubscriptionsImportResponse as _, type CachePolicy as a, type V2ContentListParams as a$, type NewsletterManagementSeries as a0, type NewsletterManagementCampaignListResponse as a1, type NewsletterManagementCampaign as a2, type NewsletterCampaignTestSendRequest as a3, type NewsletterCampaignTestSendResponse as a4, type NewsletterManagementStatsResponse as a5, type NewsletterExportCreateRequest as a6, type NewsletterExportCreateResponse as a7, type RequestOtpRequest as a8, type VerifyOtpRequest as a9, PerspectV2Error as aA, createApiError as aB, PerspectApiError as aC, type CacheConfig as aD, type ApiError as aE, type MediaItem as aF, type CategorySummary as aG, type PaymentGateway as aH, type NewsletterSubscription as aI, type NewsletterCampaignSummary as aJ, type NewsletterManagementListMembership as aK, type NewsletterSubscriptionsBulkAction as aL, type NewsletterSubscriptionsBulkOutcome as aM, type NewsletterSubscriptionImportRowRequest as aN, type NewsletterSubscriptionsImportRowResult as aO, type NewsletterManagementPagination as aP, type SetProfileValueRequest as aQ, type V2Object as aR, type V2List as aS, type V2Deleted as aT, type V2Error as aU, type V2ErrorType as aV, type V2PaginationParams as aW, type V2Media as aX, type V2Content as aY, type V2ContentCreateParams as aZ, type V2ContentUpdateParams as a_, type VerifyOtpResponse as aa, type SiteUser as ab, type SiteUserProfile as ac, type UpdateSiteUserRequest as ad, type SiteUserOrder as ae, type SiteUserSubscription as af, type CancelSubscriptionRequest as ag, type CancelSubscriptionResponse as ah, type CreditBalance as ai, type CreditBalanceWithTransactions as aj, type GrantCreditRequest as ak, type ProductBundleGroup as al, type CreateBundleGroupRequest as am, type BundleCollection as an, type BundleCollectionItemWithProduct as ao, type CreateBundleCollectionRequest as ap, type AddCollectionItemRequest as aq, type BundleCollectionItem as ar, type PerspectApiConfig as as, type CacheAdapter as at, type BlogPost as au, type CheckoutMetadata as av, type CheckoutAddress as aw, type CheckoutTaxRequest as ax, PerspectApiV2Client as ay, createPerspectApiV2Client as az, type CacheInvalidateOptions as b, type ContentType as b$, type V2Product as b0, type V2ProductCreateParams as b1, type V2ProductUpdateParams as b2, type V2ProductListParams as b3, type V2Category as b4, type V2CategoryCreateParams as b5, type V2CategoryUpdateParams as b6, type V2Collection as b7, type V2CollectionItem as b8, type V2CollectionCreateParams as b9, type V2NewsletterSyncResult as bA, type V2NewsletterSubscriptionListMembershipUpdate as bB, type V2NewsletterImportRequest as bC, type V2NewsletterImportResult as bD, type V2ContactSubmission as bE, type V2Organization as bF, type V2Site as bG, type V2ApiKey as bH, type V2WebhookEventType as bI, type V2Webhook as bJ, type V2WebhookCreateParams as bK, type V2WebhookUpdateParams as bL, type V2SiteUserSubscription as bM, type V2SubscriptionPauseParams as bN, type V2SubscriptionCancelParams as bO, type V2SubscriptionChangePlanParams as bP, type V2SubscriptionChargeParams as bQ, type V2SubscriptionChargeResult as bR, type V2CancelSubscriptionResult as bS, type V2CreditTransaction as bT, type V2CreditBalance as bU, type V2GrantCreditParams as bV, type V2GrantCreditResult as bW, type V2EmailSendParams as bX, type V2EmailSendResult as bY, type PaginationParams as bZ, type ContentStatus as b_, type V2CollectionUpdateParams as ba, type V2Order as bb, type V2OrderListParams as bc, type V2OrderLineItemPriceData as bd, type V2OrderLineItem as be, type V2OrderAddress as bf, type V2OrderTaxRequest as bg, type V2OrderCreateParams as bh, type V2OrderFulfillmentUpdate as bi, type V2OrderFulfillmentNotificationLineItem as bj, type V2OrderFulfillmentNotificationParams as bk, type V2OrderFulfillmentNotificationResult as bl, type V2OrderCreateResult as bm, type V2SiteUser as bn, type V2SiteUserUpdateParams as bo, type V2SiteUserMeUpdateParams as bp, type V2SiteUserListParams as bq, type V2SiteUserWithProfile as br, type V2SiteUserProfile as bs, type V2NewsletterSubscription as bt, type V2NewsletterList as bu, type V2NewsletterCampaign as bv, type V2NewsletterTrackingResponse as bw, type V2NewsletterListCreateParams as bx, type V2NewsletterListUpdateParams as by, type V2NewsletterSyncInput as bz, type ContentQueryParams as c, type ProductSkuMediaItem as c0, type ProductSkuOption as c1, type CreatePaymentGatewayRequest as c2, type WebhookEventType as c3, type CheckoutMetadataValue as c4, type CheckoutTaxStrategy as c5, type CheckoutTaxExemptionStatus as c6, type CheckoutTaxCustomerExemptionRequest as c7, type CheckoutTaxBreakdownItem as c8, type CheckoutSessionTax as c9, type SubscriptionCancellationMode as ca, type CreditTransaction as cb, type HttpMethod as cc, type RequestOptions as cd, type PerspectApiV2Config as ce, BaseV2Client as cf, ContentV2Client as cg, ProductsV2Client as ch, CategoriesV2Client as ci, CollectionsV2Client as cj, OrdersV2Client as ck, SiteUsersV2Client as cl, NewsletterV2Client as cm, ContactsV2Client as cn, OrganizationsV2Client as co, SitesV2Client as cp, ApiKeysV2Client as cq, WebhooksV2Client as cr, SubscriptionsV2Client as cs, CreditsV2Client as ct, EmailV2Client as cu, type Content as d, type ContentCategoryResponse as e, type CreateContentRequest as f, type UpdateContentRequest as g, type ApiKey as h, type CreateApiKeyRequest as i, type UpdateApiKeyRequest as j, type CreateOrganizationRequest as k, type CreateSiteRequest as l, type ProductQueryParams as m, type Product as n, type CreateProductRequest as o, type ProductSku as p, type CreateProductSkuRequest as q, type Category as r, type CreateCategoryRequest as s, type CreateWebhookRequest as t, type CreateCheckoutSessionRequest as u, type CheckoutSession as v, type CreateContactRequest as w, type ContactSubmitResponse as x, type ContactStatusResponse as y, type ContactSubmission as z };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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-
|
|
2
|
-
export { aE as ApiError, aD as CacheConfig, aG as CategorySummary,
|
|
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-DuNDHod-.mjs';
|
|
2
|
+
export { aE as ApiError, aD as CacheConfig, aG as CategorySummary, c4 as CheckoutMetadataValue, c9 as CheckoutSessionTax, c8 as CheckoutTaxBreakdownItem, c7 as CheckoutTaxCustomerExemptionRequest, c6 as CheckoutTaxExemptionStatus, c5 as CheckoutTaxStrategy, b_ as ContentStatus, b$ as ContentType, c2 as CreatePaymentGatewayRequest, cb as CreditTransaction, cc 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, bZ as PaginationParams, aH as PaymentGateway, aC as PerspectApiError, ay as PerspectApiV2Client, aA as PerspectV2Error, c0 as ProductSkuMediaItem, c1 as ProductSkuOption, cd as RequestOptions, aQ as SetProfileValueRequest, ca as SubscriptionCancellationMode, bH as V2ApiKey, bS as V2CancelSubscriptionResult, b4 as V2Category, b5 as V2CategoryCreateParams, b6 as V2CategoryUpdateParams, b7 as V2Collection, b9 as V2CollectionCreateParams, b8 as V2CollectionItem, ba as V2CollectionUpdateParams, bE as V2ContactSubmission, aY as V2Content, aZ as V2ContentCreateParams, a$ as V2ContentListParams, a_ as V2ContentUpdateParams, bU as V2CreditBalance, bT as V2CreditTransaction, aT as V2Deleted, bX as V2EmailSendParams, bY as V2EmailSendResult, aU as V2Error, aV as V2ErrorType, bV as V2GrantCreditParams, bW as V2GrantCreditResult, aS as V2List, aX as V2Media, bv as V2NewsletterCampaign, bC as V2NewsletterImportRequest, bD as V2NewsletterImportResult, bu as V2NewsletterList, bx as V2NewsletterListCreateParams, by as V2NewsletterListUpdateParams, bt as V2NewsletterSubscription, bB as V2NewsletterSubscriptionListMembershipUpdate, bz as V2NewsletterSyncInput, bA as V2NewsletterSyncResult, bw as V2NewsletterTrackingResponse, aR as V2Object, bb as V2Order, bf as V2OrderAddress, bh as V2OrderCreateParams, bm as V2OrderCreateResult, bj as V2OrderFulfillmentNotificationLineItem, bk as V2OrderFulfillmentNotificationParams, bl as V2OrderFulfillmentNotificationResult, bi as V2OrderFulfillmentUpdate, be as V2OrderLineItem, bd as V2OrderLineItemPriceData, bc as V2OrderListParams, bg as V2OrderTaxRequest, bF as V2Organization, aW as V2PaginationParams, b0 as V2Product, b1 as V2ProductCreateParams, b3 as V2ProductListParams, b2 as V2ProductUpdateParams, bG as V2Site, bn as V2SiteUser, bq as V2SiteUserListParams, bp as V2SiteUserMeUpdateParams, bs as V2SiteUserProfile, bM as V2SiteUserSubscription, bo as V2SiteUserUpdateParams, br as V2SiteUserWithProfile, bO as V2SubscriptionCancelParams, bP as V2SubscriptionChangePlanParams, bQ as V2SubscriptionChargeParams, bR as V2SubscriptionChargeResult, bN as V2SubscriptionPauseParams, bJ as V2Webhook, bK as V2WebhookCreateParams, bI as V2WebhookEventType, bL as V2WebhookUpdateParams, c3 as WebhookEventType, aB as createApiError, az as createPerspectApiV2Client } from './index-DuNDHod-.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* v1 deprecation constants — kept in sync with the backend's
|
|
@@ -1775,6 +1775,8 @@ declare class SiteUsersClient extends BaseClient {
|
|
|
1775
1775
|
fulfillment_status: string;
|
|
1776
1776
|
tracking_number?: string;
|
|
1777
1777
|
notes?: string;
|
|
1778
|
+
fulfillment_details_text?: string;
|
|
1779
|
+
fulfillment_details_html?: string;
|
|
1778
1780
|
notify_customer?: boolean;
|
|
1779
1781
|
}): Promise<ApiResponse<{
|
|
1780
1782
|
success: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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-
|
|
2
|
-
export { aE as ApiError, aD as CacheConfig, aG as CategorySummary,
|
|
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-DuNDHod-.js';
|
|
2
|
+
export { aE as ApiError, aD as CacheConfig, aG as CategorySummary, c4 as CheckoutMetadataValue, c9 as CheckoutSessionTax, c8 as CheckoutTaxBreakdownItem, c7 as CheckoutTaxCustomerExemptionRequest, c6 as CheckoutTaxExemptionStatus, c5 as CheckoutTaxStrategy, b_ as ContentStatus, b$ as ContentType, c2 as CreatePaymentGatewayRequest, cb as CreditTransaction, cc 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, bZ as PaginationParams, aH as PaymentGateway, aC as PerspectApiError, ay as PerspectApiV2Client, aA as PerspectV2Error, c0 as ProductSkuMediaItem, c1 as ProductSkuOption, cd as RequestOptions, aQ as SetProfileValueRequest, ca as SubscriptionCancellationMode, bH as V2ApiKey, bS as V2CancelSubscriptionResult, b4 as V2Category, b5 as V2CategoryCreateParams, b6 as V2CategoryUpdateParams, b7 as V2Collection, b9 as V2CollectionCreateParams, b8 as V2CollectionItem, ba as V2CollectionUpdateParams, bE as V2ContactSubmission, aY as V2Content, aZ as V2ContentCreateParams, a$ as V2ContentListParams, a_ as V2ContentUpdateParams, bU as V2CreditBalance, bT as V2CreditTransaction, aT as V2Deleted, bX as V2EmailSendParams, bY as V2EmailSendResult, aU as V2Error, aV as V2ErrorType, bV as V2GrantCreditParams, bW as V2GrantCreditResult, aS as V2List, aX as V2Media, bv as V2NewsletterCampaign, bC as V2NewsletterImportRequest, bD as V2NewsletterImportResult, bu as V2NewsletterList, bx as V2NewsletterListCreateParams, by as V2NewsletterListUpdateParams, bt as V2NewsletterSubscription, bB as V2NewsletterSubscriptionListMembershipUpdate, bz as V2NewsletterSyncInput, bA as V2NewsletterSyncResult, bw as V2NewsletterTrackingResponse, aR as V2Object, bb as V2Order, bf as V2OrderAddress, bh as V2OrderCreateParams, bm as V2OrderCreateResult, bj as V2OrderFulfillmentNotificationLineItem, bk as V2OrderFulfillmentNotificationParams, bl as V2OrderFulfillmentNotificationResult, bi as V2OrderFulfillmentUpdate, be as V2OrderLineItem, bd as V2OrderLineItemPriceData, bc as V2OrderListParams, bg as V2OrderTaxRequest, bF as V2Organization, aW as V2PaginationParams, b0 as V2Product, b1 as V2ProductCreateParams, b3 as V2ProductListParams, b2 as V2ProductUpdateParams, bG as V2Site, bn as V2SiteUser, bq as V2SiteUserListParams, bp as V2SiteUserMeUpdateParams, bs as V2SiteUserProfile, bM as V2SiteUserSubscription, bo as V2SiteUserUpdateParams, br as V2SiteUserWithProfile, bO as V2SubscriptionCancelParams, bP as V2SubscriptionChangePlanParams, bQ as V2SubscriptionChargeParams, bR as V2SubscriptionChargeResult, bN as V2SubscriptionPauseParams, bJ as V2Webhook, bK as V2WebhookCreateParams, bI as V2WebhookEventType, bL as V2WebhookUpdateParams, c3 as WebhookEventType, aB as createApiError, az as createPerspectApiV2Client } from './index-DuNDHod-.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* v1 deprecation constants — kept in sync with the backend's
|
|
@@ -1775,6 +1775,8 @@ declare class SiteUsersClient extends BaseClient {
|
|
|
1775
1775
|
fulfillment_status: string;
|
|
1776
1776
|
tracking_number?: string;
|
|
1777
1777
|
notes?: string;
|
|
1778
|
+
fulfillment_details_text?: string;
|
|
1779
|
+
fulfillment_details_html?: string;
|
|
1778
1780
|
notify_customer?: boolean;
|
|
1779
1781
|
}): Promise<ApiResponse<{
|
|
1780
1782
|
success: boolean;
|
package/dist/index.js
CHANGED
|
@@ -1043,6 +1043,16 @@ var OrdersV2Client = class extends BaseV2Client {
|
|
|
1043
1043
|
});
|
|
1044
1044
|
return result;
|
|
1045
1045
|
}
|
|
1046
|
+
/**
|
|
1047
|
+
* Send the customer fulfillment template for an external delivery/packing
|
|
1048
|
+
* record without mutating a checkout session.
|
|
1049
|
+
*/
|
|
1050
|
+
async sendFulfillmentNotification(siteName, data) {
|
|
1051
|
+
return this.post(
|
|
1052
|
+
this.sitePath(siteName, "orders", "fulfillment-notifications"),
|
|
1053
|
+
data
|
|
1054
|
+
);
|
|
1055
|
+
}
|
|
1046
1056
|
withOrderTags(siteName, cachePolicy, options = {}) {
|
|
1047
1057
|
const tags = new Set(cachePolicy?.tags ?? []);
|
|
1048
1058
|
for (const tag of this.buildOrderTags(siteName, options)) {
|
|
@@ -1453,6 +1463,23 @@ var CreditsV2Client = class extends BaseV2Client {
|
|
|
1453
1463
|
}
|
|
1454
1464
|
};
|
|
1455
1465
|
|
|
1466
|
+
// src/v2/client/email-client.ts
|
|
1467
|
+
var EmailV2Client = class extends BaseV2Client {
|
|
1468
|
+
/**
|
|
1469
|
+
* Send a transactional email using the site's configured email provider.
|
|
1470
|
+
*
|
|
1471
|
+
* Requires a server-side API key — never call this from a browser.
|
|
1472
|
+
* The site must have an email provider configured in its settings.
|
|
1473
|
+
* At least one of `html` or `text` must be provided.
|
|
1474
|
+
*/
|
|
1475
|
+
async send(siteName, params) {
|
|
1476
|
+
return this.post(
|
|
1477
|
+
this.sitePath(siteName, "email", "send"),
|
|
1478
|
+
params
|
|
1479
|
+
);
|
|
1480
|
+
}
|
|
1481
|
+
};
|
|
1482
|
+
|
|
1456
1483
|
// src/v2/index.ts
|
|
1457
1484
|
var PerspectApiV2Client = class {
|
|
1458
1485
|
http;
|
|
@@ -1471,6 +1498,7 @@ var PerspectApiV2Client = class {
|
|
|
1471
1498
|
webhooks;
|
|
1472
1499
|
subscriptions;
|
|
1473
1500
|
credits;
|
|
1501
|
+
email;
|
|
1474
1502
|
constructor(config) {
|
|
1475
1503
|
const baseUrl = config.baseUrl.replace(/\/+$/, "");
|
|
1476
1504
|
const v2BaseUrl = baseUrl.endsWith("/api/v2") ? baseUrl : `${baseUrl}/api/v2`;
|
|
@@ -1492,6 +1520,7 @@ var PerspectApiV2Client = class {
|
|
|
1492
1520
|
this.webhooks = new WebhooksV2Client(this.http, basePath, cache);
|
|
1493
1521
|
this.subscriptions = new SubscriptionsV2Client(this.http, basePath, cache);
|
|
1494
1522
|
this.credits = new CreditsV2Client(this.http, basePath, cache);
|
|
1523
|
+
this.email = new EmailV2Client(this.http, basePath, cache);
|
|
1495
1524
|
}
|
|
1496
1525
|
/** Update the JWT token for authenticated requests. */
|
|
1497
1526
|
setAuth(jwt) {
|
package/dist/index.mjs
CHANGED
package/dist/v2/index.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { cq as ApiKeysV2Client, cf as BaseV2Client, ci as CategoriesV2Client, cj as CollectionsV2Client, cn as ContactsV2Client, cg as ContentV2Client, ct as CreditsV2Client, cu as EmailV2Client, cm as NewsletterV2Client, ck as OrdersV2Client, co as OrganizationsV2Client, ay as PerspectApiV2Client, ce as PerspectApiV2Config, aA as PerspectV2Error, ch as ProductsV2Client, cl as SiteUsersV2Client, cp as SitesV2Client, cs as SubscriptionsV2Client, bH as V2ApiKey, bS as V2CancelSubscriptionResult, b4 as V2Category, b5 as V2CategoryCreateParams, b6 as V2CategoryUpdateParams, b7 as V2Collection, b9 as V2CollectionCreateParams, b8 as V2CollectionItem, ba as V2CollectionUpdateParams, bE as V2ContactSubmission, aY as V2Content, aZ as V2ContentCreateParams, a$ as V2ContentListParams, a_ as V2ContentUpdateParams, bU as V2CreditBalance, bT as V2CreditTransaction, aT as V2Deleted, bX as V2EmailSendParams, bY as V2EmailSendResult, aU as V2Error, aV as V2ErrorType, bV as V2GrantCreditParams, bW as V2GrantCreditResult, aS as V2List, aX as V2Media, bv as V2NewsletterCampaign, bC as V2NewsletterImportRequest, bD as V2NewsletterImportResult, bu as V2NewsletterList, bx as V2NewsletterListCreateParams, by as V2NewsletterListUpdateParams, bt as V2NewsletterSubscription, bB as V2NewsletterSubscriptionListMembershipUpdate, bz as V2NewsletterSyncInput, bA as V2NewsletterSyncResult, bw as V2NewsletterTrackingResponse, aR as V2Object, bb as V2Order, bf as V2OrderAddress, bh as V2OrderCreateParams, bm as V2OrderCreateResult, bj as V2OrderFulfillmentNotificationLineItem, bk as V2OrderFulfillmentNotificationParams, bl as V2OrderFulfillmentNotificationResult, bi as V2OrderFulfillmentUpdate, be as V2OrderLineItem, bd as V2OrderLineItemPriceData, bc as V2OrderListParams, bg as V2OrderTaxRequest, bF as V2Organization, aW as V2PaginationParams, b0 as V2Product, b1 as V2ProductCreateParams, b3 as V2ProductListParams, b2 as V2ProductUpdateParams, bG as V2Site, bn as V2SiteUser, bq as V2SiteUserListParams, bp as V2SiteUserMeUpdateParams, bs as V2SiteUserProfile, bM as V2SiteUserSubscription, bo as V2SiteUserUpdateParams, br as V2SiteUserWithProfile, bO as V2SubscriptionCancelParams, bP as V2SubscriptionChangePlanParams, bQ as V2SubscriptionChargeParams, bR as V2SubscriptionChargeResult, bN as V2SubscriptionPauseParams, bJ as V2Webhook, bK as V2WebhookCreateParams, bI as V2WebhookEventType, bL as V2WebhookUpdateParams, cr as WebhooksV2Client, az as createPerspectApiV2Client } from '../index-DuNDHod-.mjs';
|
package/dist/v2/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { cq as ApiKeysV2Client, cf as BaseV2Client, ci as CategoriesV2Client, cj as CollectionsV2Client, cn as ContactsV2Client, cg as ContentV2Client, ct as CreditsV2Client, cu as EmailV2Client, cm as NewsletterV2Client, ck as OrdersV2Client, co as OrganizationsV2Client, ay as PerspectApiV2Client, ce as PerspectApiV2Config, aA as PerspectV2Error, ch as ProductsV2Client, cl as SiteUsersV2Client, cp as SitesV2Client, cs as SubscriptionsV2Client, bH as V2ApiKey, bS as V2CancelSubscriptionResult, b4 as V2Category, b5 as V2CategoryCreateParams, b6 as V2CategoryUpdateParams, b7 as V2Collection, b9 as V2CollectionCreateParams, b8 as V2CollectionItem, ba as V2CollectionUpdateParams, bE as V2ContactSubmission, aY as V2Content, aZ as V2ContentCreateParams, a$ as V2ContentListParams, a_ as V2ContentUpdateParams, bU as V2CreditBalance, bT as V2CreditTransaction, aT as V2Deleted, bX as V2EmailSendParams, bY as V2EmailSendResult, aU as V2Error, aV as V2ErrorType, bV as V2GrantCreditParams, bW as V2GrantCreditResult, aS as V2List, aX as V2Media, bv as V2NewsletterCampaign, bC as V2NewsletterImportRequest, bD as V2NewsletterImportResult, bu as V2NewsletterList, bx as V2NewsletterListCreateParams, by as V2NewsletterListUpdateParams, bt as V2NewsletterSubscription, bB as V2NewsletterSubscriptionListMembershipUpdate, bz as V2NewsletterSyncInput, bA as V2NewsletterSyncResult, bw as V2NewsletterTrackingResponse, aR as V2Object, bb as V2Order, bf as V2OrderAddress, bh as V2OrderCreateParams, bm as V2OrderCreateResult, bj as V2OrderFulfillmentNotificationLineItem, bk as V2OrderFulfillmentNotificationParams, bl as V2OrderFulfillmentNotificationResult, bi as V2OrderFulfillmentUpdate, be as V2OrderLineItem, bd as V2OrderLineItemPriceData, bc as V2OrderListParams, bg as V2OrderTaxRequest, bF as V2Organization, aW as V2PaginationParams, b0 as V2Product, b1 as V2ProductCreateParams, b3 as V2ProductListParams, b2 as V2ProductUpdateParams, bG as V2Site, bn as V2SiteUser, bq as V2SiteUserListParams, bp as V2SiteUserMeUpdateParams, bs as V2SiteUserProfile, bM as V2SiteUserSubscription, bo as V2SiteUserUpdateParams, br as V2SiteUserWithProfile, bO as V2SubscriptionCancelParams, bP as V2SubscriptionChangePlanParams, bQ as V2SubscriptionChargeParams, bR as V2SubscriptionChargeResult, bN as V2SubscriptionPauseParams, bJ as V2Webhook, bK as V2WebhookCreateParams, bI as V2WebhookEventType, bL as V2WebhookUpdateParams, cr as WebhooksV2Client, az as createPerspectApiV2Client } from '../index-DuNDHod-.js';
|
package/dist/v2/index.js
CHANGED
|
@@ -27,6 +27,7 @@ __export(v2_exports, {
|
|
|
27
27
|
ContactsV2Client: () => ContactsV2Client,
|
|
28
28
|
ContentV2Client: () => ContentV2Client,
|
|
29
29
|
CreditsV2Client: () => CreditsV2Client,
|
|
30
|
+
EmailV2Client: () => EmailV2Client,
|
|
30
31
|
NewsletterV2Client: () => NewsletterV2Client,
|
|
31
32
|
OrdersV2Client: () => OrdersV2Client,
|
|
32
33
|
OrganizationsV2Client: () => OrganizationsV2Client,
|
|
@@ -988,6 +989,16 @@ var OrdersV2Client = class extends BaseV2Client {
|
|
|
988
989
|
});
|
|
989
990
|
return result;
|
|
990
991
|
}
|
|
992
|
+
/**
|
|
993
|
+
* Send the customer fulfillment template for an external delivery/packing
|
|
994
|
+
* record without mutating a checkout session.
|
|
995
|
+
*/
|
|
996
|
+
async sendFulfillmentNotification(siteName, data) {
|
|
997
|
+
return this.post(
|
|
998
|
+
this.sitePath(siteName, "orders", "fulfillment-notifications"),
|
|
999
|
+
data
|
|
1000
|
+
);
|
|
1001
|
+
}
|
|
991
1002
|
withOrderTags(siteName, cachePolicy, options = {}) {
|
|
992
1003
|
const tags = new Set(cachePolicy?.tags ?? []);
|
|
993
1004
|
for (const tag of this.buildOrderTags(siteName, options)) {
|
|
@@ -1398,6 +1409,23 @@ var CreditsV2Client = class extends BaseV2Client {
|
|
|
1398
1409
|
}
|
|
1399
1410
|
};
|
|
1400
1411
|
|
|
1412
|
+
// src/v2/client/email-client.ts
|
|
1413
|
+
var EmailV2Client = class extends BaseV2Client {
|
|
1414
|
+
/**
|
|
1415
|
+
* Send a transactional email using the site's configured email provider.
|
|
1416
|
+
*
|
|
1417
|
+
* Requires a server-side API key — never call this from a browser.
|
|
1418
|
+
* The site must have an email provider configured in its settings.
|
|
1419
|
+
* At least one of `html` or `text` must be provided.
|
|
1420
|
+
*/
|
|
1421
|
+
async send(siteName, params) {
|
|
1422
|
+
return this.post(
|
|
1423
|
+
this.sitePath(siteName, "email", "send"),
|
|
1424
|
+
params
|
|
1425
|
+
);
|
|
1426
|
+
}
|
|
1427
|
+
};
|
|
1428
|
+
|
|
1401
1429
|
// src/v2/index.ts
|
|
1402
1430
|
var PerspectApiV2Client = class {
|
|
1403
1431
|
http;
|
|
@@ -1416,6 +1444,7 @@ var PerspectApiV2Client = class {
|
|
|
1416
1444
|
webhooks;
|
|
1417
1445
|
subscriptions;
|
|
1418
1446
|
credits;
|
|
1447
|
+
email;
|
|
1419
1448
|
constructor(config) {
|
|
1420
1449
|
const baseUrl = config.baseUrl.replace(/\/+$/, "");
|
|
1421
1450
|
const v2BaseUrl = baseUrl.endsWith("/api/v2") ? baseUrl : `${baseUrl}/api/v2`;
|
|
@@ -1437,6 +1466,7 @@ var PerspectApiV2Client = class {
|
|
|
1437
1466
|
this.webhooks = new WebhooksV2Client(this.http, basePath, cache);
|
|
1438
1467
|
this.subscriptions = new SubscriptionsV2Client(this.http, basePath, cache);
|
|
1439
1468
|
this.credits = new CreditsV2Client(this.http, basePath, cache);
|
|
1469
|
+
this.email = new EmailV2Client(this.http, basePath, cache);
|
|
1440
1470
|
}
|
|
1441
1471
|
/** Update the JWT token for authenticated requests. */
|
|
1442
1472
|
setAuth(jwt) {
|
|
@@ -1463,6 +1493,7 @@ function createPerspectApiV2Client(config) {
|
|
|
1463
1493
|
ContactsV2Client,
|
|
1464
1494
|
ContentV2Client,
|
|
1465
1495
|
CreditsV2Client,
|
|
1496
|
+
EmailV2Client,
|
|
1466
1497
|
NewsletterV2Client,
|
|
1467
1498
|
OrdersV2Client,
|
|
1468
1499
|
OrganizationsV2Client,
|
package/dist/v2/index.mjs
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
ContactsV2Client,
|
|
7
7
|
ContentV2Client,
|
|
8
8
|
CreditsV2Client,
|
|
9
|
+
EmailV2Client,
|
|
9
10
|
NewsletterV2Client,
|
|
10
11
|
OrdersV2Client,
|
|
11
12
|
OrganizationsV2Client,
|
|
@@ -17,7 +18,7 @@ import {
|
|
|
17
18
|
SubscriptionsV2Client,
|
|
18
19
|
WebhooksV2Client,
|
|
19
20
|
createPerspectApiV2Client
|
|
20
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-MMKJ2WBF.mjs";
|
|
21
22
|
export {
|
|
22
23
|
ApiKeysV2Client,
|
|
23
24
|
BaseV2Client,
|
|
@@ -26,6 +27,7 @@ export {
|
|
|
26
27
|
ContactsV2Client,
|
|
27
28
|
ContentV2Client,
|
|
28
29
|
CreditsV2Client,
|
|
30
|
+
EmailV2Client,
|
|
29
31
|
NewsletterV2Client,
|
|
30
32
|
OrdersV2Client,
|
|
31
33
|
OrganizationsV2Client,
|
package/package.json
CHANGED
|
@@ -519,6 +519,8 @@ export class SiteUsersClient extends BaseClient {
|
|
|
519
519
|
fulfillment_status: string;
|
|
520
520
|
tracking_number?: string;
|
|
521
521
|
notes?: string;
|
|
522
|
+
fulfillment_details_text?: string;
|
|
523
|
+
fulfillment_details_html?: string;
|
|
522
524
|
notify_customer?: boolean;
|
|
523
525
|
}
|
|
524
526
|
): Promise<ApiResponse<{ success: boolean }>> {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v2 Email Client — send transactional email through a site's configured provider.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { BaseV2Client } from './base-v2-client';
|
|
6
|
+
import type { V2EmailSendParams, V2EmailSendResult } from '../types';
|
|
7
|
+
|
|
8
|
+
export class EmailV2Client extends BaseV2Client {
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Send a transactional email using the site's configured email provider.
|
|
12
|
+
*
|
|
13
|
+
* Requires a server-side API key — never call this from a browser.
|
|
14
|
+
* The site must have an email provider configured in its settings.
|
|
15
|
+
* At least one of `html` or `text` must be provided.
|
|
16
|
+
*/
|
|
17
|
+
async send(siteName: string, params: V2EmailSendParams): Promise<V2EmailSendResult> {
|
|
18
|
+
return this.post<V2EmailSendResult>(
|
|
19
|
+
this.sitePath(siteName, 'email', 'send'),
|
|
20
|
+
params,
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -13,6 +13,8 @@ import type {
|
|
|
13
13
|
V2OrderCreateParams,
|
|
14
14
|
V2OrderCreateResult,
|
|
15
15
|
V2OrderFulfillmentUpdate,
|
|
16
|
+
V2OrderFulfillmentNotificationParams,
|
|
17
|
+
V2OrderFulfillmentNotificationResult,
|
|
16
18
|
V2List,
|
|
17
19
|
} from '../types';
|
|
18
20
|
|
|
@@ -103,6 +105,20 @@ export class OrdersV2Client extends BaseV2Client {
|
|
|
103
105
|
return result;
|
|
104
106
|
}
|
|
105
107
|
|
|
108
|
+
/**
|
|
109
|
+
* Send the customer fulfillment template for an external delivery/packing
|
|
110
|
+
* record without mutating a checkout session.
|
|
111
|
+
*/
|
|
112
|
+
async sendFulfillmentNotification(
|
|
113
|
+
siteName: string,
|
|
114
|
+
data: V2OrderFulfillmentNotificationParams,
|
|
115
|
+
): Promise<V2OrderFulfillmentNotificationResult> {
|
|
116
|
+
return this.post<V2OrderFulfillmentNotificationResult>(
|
|
117
|
+
this.sitePath(siteName, 'orders', 'fulfillment-notifications'),
|
|
118
|
+
data,
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
106
122
|
private withOrderTags(
|
|
107
123
|
siteName: string,
|
|
108
124
|
cachePolicy: CachePolicy | undefined,
|
package/src/v2/index.ts
CHANGED
|
@@ -29,6 +29,7 @@ import { ApiKeysV2Client } from './client/api-keys-client';
|
|
|
29
29
|
import { WebhooksV2Client } from './client/webhooks-client';
|
|
30
30
|
import { SubscriptionsV2Client } from './client/subscriptions-client';
|
|
31
31
|
import { CreditsV2Client } from './client/credits-client';
|
|
32
|
+
import { EmailV2Client } from './client/email-client';
|
|
32
33
|
|
|
33
34
|
export interface PerspectApiV2Config extends PerspectApiConfig {
|
|
34
35
|
cache?: CacheConfig;
|
|
@@ -52,6 +53,7 @@ export class PerspectApiV2Client {
|
|
|
52
53
|
readonly webhooks: WebhooksV2Client;
|
|
53
54
|
readonly subscriptions: SubscriptionsV2Client;
|
|
54
55
|
readonly credits: CreditsV2Client;
|
|
56
|
+
readonly email: EmailV2Client;
|
|
55
57
|
|
|
56
58
|
constructor(config: PerspectApiV2Config) {
|
|
57
59
|
// Ensure base URL points to /api/v2
|
|
@@ -79,6 +81,7 @@ export class PerspectApiV2Client {
|
|
|
79
81
|
this.webhooks = new WebhooksV2Client(this.http, basePath, cache);
|
|
80
82
|
this.subscriptions = new SubscriptionsV2Client(this.http, basePath, cache);
|
|
81
83
|
this.credits = new CreditsV2Client(this.http, basePath, cache);
|
|
84
|
+
this.email = new EmailV2Client(this.http, basePath, cache);
|
|
82
85
|
}
|
|
83
86
|
|
|
84
87
|
/** Update the JWT token for authenticated requests. */
|
|
@@ -120,3 +123,4 @@ export { ApiKeysV2Client } from './client/api-keys-client';
|
|
|
120
123
|
export { WebhooksV2Client } from './client/webhooks-client';
|
|
121
124
|
export { SubscriptionsV2Client } from './client/subscriptions-client';
|
|
122
125
|
export { CreditsV2Client } from './client/credits-client';
|
|
126
|
+
export { EmailV2Client } from './client/email-client';
|
package/src/v2/types.ts
CHANGED
|
@@ -328,10 +328,44 @@ export interface V2OrderFulfillmentUpdate {
|
|
|
328
328
|
fulfillment_status: string;
|
|
329
329
|
tracking_number?: string;
|
|
330
330
|
notes?: string;
|
|
331
|
+
fulfillment_details_text?: string;
|
|
332
|
+
fulfillment_details_html?: string;
|
|
331
333
|
/** When true, a terminal fulfillment status triggers a customer email. */
|
|
332
334
|
notify_customer?: boolean;
|
|
333
335
|
}
|
|
334
336
|
|
|
337
|
+
export interface V2OrderFulfillmentNotificationLineItem {
|
|
338
|
+
quantity: number;
|
|
339
|
+
description: string;
|
|
340
|
+
amount_total?: number;
|
|
341
|
+
currency?: string;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
export interface V2OrderFulfillmentNotificationParams {
|
|
345
|
+
session_id?: string;
|
|
346
|
+
order_id?: string;
|
|
347
|
+
customer_email: string;
|
|
348
|
+
customer_name?: string;
|
|
349
|
+
fulfillment_status?: string;
|
|
350
|
+
fulfillment_details_text?: string;
|
|
351
|
+
fulfillment_details_html?: string;
|
|
352
|
+
line_items?: V2OrderFulfillmentNotificationLineItem[];
|
|
353
|
+
amount_total?: number;
|
|
354
|
+
currency?: string;
|
|
355
|
+
shipping_details?: Record<string, unknown>;
|
|
356
|
+
customer_details?: Record<string, unknown>;
|
|
357
|
+
metadata?: Record<string, unknown>;
|
|
358
|
+
created_at?: string;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
export interface V2OrderFulfillmentNotificationResult extends V2Object {
|
|
362
|
+
object: "fulfillment_notification";
|
|
363
|
+
order_id: string;
|
|
364
|
+
notified: boolean;
|
|
365
|
+
queued: boolean;
|
|
366
|
+
reason?: string;
|
|
367
|
+
}
|
|
368
|
+
|
|
335
369
|
export interface V2OrderCreateResult extends V2Object {
|
|
336
370
|
object: "checkout_session";
|
|
337
371
|
checkout_url: string | null;
|
|
@@ -751,3 +785,23 @@ export interface V2GrantCreditResult {
|
|
|
751
785
|
object: "grant_credit_result";
|
|
752
786
|
new_balance_cents: number;
|
|
753
787
|
}
|
|
788
|
+
|
|
789
|
+
// --- Email ---
|
|
790
|
+
|
|
791
|
+
export interface V2EmailSendParams {
|
|
792
|
+
to: string | string[];
|
|
793
|
+
subject: string;
|
|
794
|
+
html?: string;
|
|
795
|
+
text?: string;
|
|
796
|
+
from?: string;
|
|
797
|
+
reply_to?: string;
|
|
798
|
+
cc?: string | string[];
|
|
799
|
+
bcc?: string | string[];
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
export interface V2EmailSendResult {
|
|
803
|
+
object: "email";
|
|
804
|
+
id: string | null;
|
|
805
|
+
status: "sent";
|
|
806
|
+
to: string | string[];
|
|
807
|
+
}
|