brainerce 1.10.2 → 1.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +9 -6
- package/dist/index.d.ts +9 -6
- package/dist/index.js +14 -13
- package/dist/index.mjs +14 -13
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -5685,18 +5685,21 @@ declare class BrainerceClient {
|
|
|
5685
5685
|
limit?: number;
|
|
5686
5686
|
}): Promise<PaginatedResponse<Order>>;
|
|
5687
5687
|
/**
|
|
5688
|
-
* Get download links for a purchased order
|
|
5689
|
-
*
|
|
5688
|
+
* Get download links for a purchased order.
|
|
5689
|
+
* Auth: customerToken/proxyMode (logged-in) OR checkoutId (guest after payment).
|
|
5690
5690
|
*
|
|
5691
5691
|
* @example
|
|
5692
5692
|
* ```typescript
|
|
5693
|
+
* // Logged-in customer
|
|
5693
5694
|
* const links = await client.getOrderDownloads('order_123');
|
|
5694
|
-
*
|
|
5695
|
-
*
|
|
5696
|
-
* }
|
|
5695
|
+
*
|
|
5696
|
+
* // Guest (right after checkout)
|
|
5697
|
+
* const links = await client.getOrderDownloads('order_123', { checkoutId: 'ckxxx' });
|
|
5697
5698
|
* ```
|
|
5698
5699
|
*/
|
|
5699
|
-
getOrderDownloads(orderId: string
|
|
5700
|
+
getOrderDownloads(orderId: string, options?: {
|
|
5701
|
+
checkoutId?: string;
|
|
5702
|
+
}): Promise<OrderDownloadLink[]>;
|
|
5700
5703
|
/**
|
|
5701
5704
|
* Get download links for a guest order (no login required)
|
|
5702
5705
|
* Validates identity via email + order number
|
package/dist/index.d.ts
CHANGED
|
@@ -5685,18 +5685,21 @@ declare class BrainerceClient {
|
|
|
5685
5685
|
limit?: number;
|
|
5686
5686
|
}): Promise<PaginatedResponse<Order>>;
|
|
5687
5687
|
/**
|
|
5688
|
-
* Get download links for a purchased order
|
|
5689
|
-
*
|
|
5688
|
+
* Get download links for a purchased order.
|
|
5689
|
+
* Auth: customerToken/proxyMode (logged-in) OR checkoutId (guest after payment).
|
|
5690
5690
|
*
|
|
5691
5691
|
* @example
|
|
5692
5692
|
* ```typescript
|
|
5693
|
+
* // Logged-in customer
|
|
5693
5694
|
* const links = await client.getOrderDownloads('order_123');
|
|
5694
|
-
*
|
|
5695
|
-
*
|
|
5696
|
-
* }
|
|
5695
|
+
*
|
|
5696
|
+
* // Guest (right after checkout)
|
|
5697
|
+
* const links = await client.getOrderDownloads('order_123', { checkoutId: 'ckxxx' });
|
|
5697
5698
|
* ```
|
|
5698
5699
|
*/
|
|
5699
|
-
getOrderDownloads(orderId: string
|
|
5700
|
+
getOrderDownloads(orderId: string, options?: {
|
|
5701
|
+
checkoutId?: string;
|
|
5702
|
+
}): Promise<OrderDownloadLink[]>;
|
|
5700
5703
|
/**
|
|
5701
5704
|
* Get download links for a guest order (no login required)
|
|
5702
5705
|
* Validates identity via email + order number
|
package/dist/index.js
CHANGED
|
@@ -4442,34 +4442,35 @@ var BrainerceClient = class {
|
|
|
4442
4442
|
throw new BrainerceError("getMyOrders is only available in vibe-coded or storefront mode", 400);
|
|
4443
4443
|
}
|
|
4444
4444
|
/**
|
|
4445
|
-
* Get download links for a purchased order
|
|
4446
|
-
*
|
|
4445
|
+
* Get download links for a purchased order.
|
|
4446
|
+
* Auth: customerToken/proxyMode (logged-in) OR checkoutId (guest after payment).
|
|
4447
4447
|
*
|
|
4448
4448
|
* @example
|
|
4449
4449
|
* ```typescript
|
|
4450
|
+
* // Logged-in customer
|
|
4450
4451
|
* const links = await client.getOrderDownloads('order_123');
|
|
4451
|
-
*
|
|
4452
|
-
*
|
|
4453
|
-
* }
|
|
4452
|
+
*
|
|
4453
|
+
* // Guest (right after checkout)
|
|
4454
|
+
* const links = await client.getOrderDownloads('order_123', { checkoutId: 'ckxxx' });
|
|
4454
4455
|
* ```
|
|
4455
4456
|
*/
|
|
4456
|
-
async getOrderDownloads(orderId) {
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
);
|
|
4457
|
+
async getOrderDownloads(orderId, options) {
|
|
4458
|
+
const hasAuth = this.customerToken || this.proxyMode;
|
|
4459
|
+
const checkoutId = options?.checkoutId;
|
|
4460
|
+
if (!hasAuth && !checkoutId) {
|
|
4461
|
+
throw new BrainerceError("Customer token or checkoutId required for download access.", 401);
|
|
4462
4462
|
}
|
|
4463
|
+
const qs = checkoutId ? `?checkout_id=${encodeURIComponent(checkoutId)}` : "";
|
|
4463
4464
|
if (this.isVibeCodedMode()) {
|
|
4464
4465
|
return this.vibeCodedRequest(
|
|
4465
4466
|
"GET",
|
|
4466
|
-
`/customers/me/orders/${orderId}/downloads`
|
|
4467
|
+
`/customers/me/orders/${orderId}/downloads${qs}`
|
|
4467
4468
|
);
|
|
4468
4469
|
}
|
|
4469
4470
|
if (this.storeId && !this.apiKey) {
|
|
4470
4471
|
return this.storefrontRequest(
|
|
4471
4472
|
"GET",
|
|
4472
|
-
`/customers/me/orders/${orderId}/downloads`
|
|
4473
|
+
`/customers/me/orders/${orderId}/downloads${qs}`
|
|
4473
4474
|
);
|
|
4474
4475
|
}
|
|
4475
4476
|
throw new BrainerceError(
|
package/dist/index.mjs
CHANGED
|
@@ -4384,34 +4384,35 @@ var BrainerceClient = class {
|
|
|
4384
4384
|
throw new BrainerceError("getMyOrders is only available in vibe-coded or storefront mode", 400);
|
|
4385
4385
|
}
|
|
4386
4386
|
/**
|
|
4387
|
-
* Get download links for a purchased order
|
|
4388
|
-
*
|
|
4387
|
+
* Get download links for a purchased order.
|
|
4388
|
+
* Auth: customerToken/proxyMode (logged-in) OR checkoutId (guest after payment).
|
|
4389
4389
|
*
|
|
4390
4390
|
* @example
|
|
4391
4391
|
* ```typescript
|
|
4392
|
+
* // Logged-in customer
|
|
4392
4393
|
* const links = await client.getOrderDownloads('order_123');
|
|
4393
|
-
*
|
|
4394
|
-
*
|
|
4395
|
-
* }
|
|
4394
|
+
*
|
|
4395
|
+
* // Guest (right after checkout)
|
|
4396
|
+
* const links = await client.getOrderDownloads('order_123', { checkoutId: 'ckxxx' });
|
|
4396
4397
|
* ```
|
|
4397
4398
|
*/
|
|
4398
|
-
async getOrderDownloads(orderId) {
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
);
|
|
4399
|
+
async getOrderDownloads(orderId, options) {
|
|
4400
|
+
const hasAuth = this.customerToken || this.proxyMode;
|
|
4401
|
+
const checkoutId = options?.checkoutId;
|
|
4402
|
+
if (!hasAuth && !checkoutId) {
|
|
4403
|
+
throw new BrainerceError("Customer token or checkoutId required for download access.", 401);
|
|
4404
4404
|
}
|
|
4405
|
+
const qs = checkoutId ? `?checkout_id=${encodeURIComponent(checkoutId)}` : "";
|
|
4405
4406
|
if (this.isVibeCodedMode()) {
|
|
4406
4407
|
return this.vibeCodedRequest(
|
|
4407
4408
|
"GET",
|
|
4408
|
-
`/customers/me/orders/${orderId}/downloads`
|
|
4409
|
+
`/customers/me/orders/${orderId}/downloads${qs}`
|
|
4409
4410
|
);
|
|
4410
4411
|
}
|
|
4411
4412
|
if (this.storeId && !this.apiKey) {
|
|
4412
4413
|
return this.storefrontRequest(
|
|
4413
4414
|
"GET",
|
|
4414
|
-
`/customers/me/orders/${orderId}/downloads`
|
|
4415
|
+
`/customers/me/orders/${orderId}/downloads${qs}`
|
|
4415
4416
|
);
|
|
4416
4417
|
}
|
|
4417
4418
|
throw new BrainerceError(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brainerce",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.3",
|
|
4
4
|
"description": "Official SDK for building e-commerce storefronts with Brainerce Platform. Perfect for vibe-coded sites, AI-built stores (Cursor, Lovable, v0), and custom storefronts.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|