@dream-api/sdk 0.1.0 → 0.1.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/dist/index.d.mts +19 -3
- package/dist/index.d.ts +19 -3
- package/dist/index.js +19 -1
- package/dist/index.mjs +19 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -53,13 +53,18 @@ interface Tier {
|
|
|
53
53
|
popular?: boolean;
|
|
54
54
|
}
|
|
55
55
|
interface Product {
|
|
56
|
+
id?: string;
|
|
56
57
|
name: string;
|
|
58
|
+
displayName?: string;
|
|
59
|
+
description?: string;
|
|
57
60
|
price: number;
|
|
61
|
+
currency?: string;
|
|
58
62
|
priceId: string;
|
|
59
63
|
productId: string;
|
|
60
|
-
description?: string;
|
|
61
64
|
imageUrl?: string;
|
|
62
|
-
inventory?: number;
|
|
65
|
+
inventory?: number | null;
|
|
66
|
+
soldOut?: boolean;
|
|
67
|
+
features?: string[];
|
|
63
68
|
}
|
|
64
69
|
interface CheckoutResult {
|
|
65
70
|
url: string;
|
|
@@ -481,13 +486,24 @@ declare class ProductAPI {
|
|
|
481
486
|
}>;
|
|
482
487
|
/**
|
|
483
488
|
* Create a cart checkout (guest checkout for store)
|
|
489
|
+
*
|
|
490
|
+
* @example
|
|
491
|
+
* ```typescript
|
|
492
|
+
* const { url } = await api.products.cartCheckout({
|
|
493
|
+
* items: [{ priceId: 'price_xxx', quantity: 1 }],
|
|
494
|
+
* customerEmail: 'customer@example.com',
|
|
495
|
+
* successUrl: '/success',
|
|
496
|
+
* cancelUrl: '/cart',
|
|
497
|
+
* });
|
|
498
|
+
* window.location.href = url;
|
|
499
|
+
* ```
|
|
484
500
|
*/
|
|
485
501
|
cartCheckout(params: {
|
|
486
502
|
items: Array<{
|
|
487
503
|
priceId: string;
|
|
488
504
|
quantity: number;
|
|
489
505
|
}>;
|
|
490
|
-
customerEmail
|
|
506
|
+
customerEmail?: string;
|
|
491
507
|
customerName?: string;
|
|
492
508
|
successUrl?: string;
|
|
493
509
|
cancelUrl?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -53,13 +53,18 @@ interface Tier {
|
|
|
53
53
|
popular?: boolean;
|
|
54
54
|
}
|
|
55
55
|
interface Product {
|
|
56
|
+
id?: string;
|
|
56
57
|
name: string;
|
|
58
|
+
displayName?: string;
|
|
59
|
+
description?: string;
|
|
57
60
|
price: number;
|
|
61
|
+
currency?: string;
|
|
58
62
|
priceId: string;
|
|
59
63
|
productId: string;
|
|
60
|
-
description?: string;
|
|
61
64
|
imageUrl?: string;
|
|
62
|
-
inventory?: number;
|
|
65
|
+
inventory?: number | null;
|
|
66
|
+
soldOut?: boolean;
|
|
67
|
+
features?: string[];
|
|
63
68
|
}
|
|
64
69
|
interface CheckoutResult {
|
|
65
70
|
url: string;
|
|
@@ -481,13 +486,24 @@ declare class ProductAPI {
|
|
|
481
486
|
}>;
|
|
482
487
|
/**
|
|
483
488
|
* Create a cart checkout (guest checkout for store)
|
|
489
|
+
*
|
|
490
|
+
* @example
|
|
491
|
+
* ```typescript
|
|
492
|
+
* const { url } = await api.products.cartCheckout({
|
|
493
|
+
* items: [{ priceId: 'price_xxx', quantity: 1 }],
|
|
494
|
+
* customerEmail: 'customer@example.com',
|
|
495
|
+
* successUrl: '/success',
|
|
496
|
+
* cancelUrl: '/cart',
|
|
497
|
+
* });
|
|
498
|
+
* window.location.href = url;
|
|
499
|
+
* ```
|
|
484
500
|
*/
|
|
485
501
|
cartCheckout(params: {
|
|
486
502
|
items: Array<{
|
|
487
503
|
priceId: string;
|
|
488
504
|
quantity: number;
|
|
489
505
|
}>;
|
|
490
|
-
customerEmail
|
|
506
|
+
customerEmail?: string;
|
|
491
507
|
customerName?: string;
|
|
492
508
|
successUrl?: string;
|
|
493
509
|
cancelUrl?: string;
|
package/dist/index.js
CHANGED
|
@@ -562,9 +562,27 @@ var ProductAPI = class {
|
|
|
562
562
|
}
|
|
563
563
|
/**
|
|
564
564
|
* Create a cart checkout (guest checkout for store)
|
|
565
|
+
*
|
|
566
|
+
* @example
|
|
567
|
+
* ```typescript
|
|
568
|
+
* const { url } = await api.products.cartCheckout({
|
|
569
|
+
* items: [{ priceId: 'price_xxx', quantity: 1 }],
|
|
570
|
+
* customerEmail: 'customer@example.com',
|
|
571
|
+
* successUrl: '/success',
|
|
572
|
+
* cancelUrl: '/cart',
|
|
573
|
+
* });
|
|
574
|
+
* window.location.href = url;
|
|
575
|
+
* ```
|
|
565
576
|
*/
|
|
566
577
|
async cartCheckout(params) {
|
|
567
|
-
|
|
578
|
+
const apiParams = {
|
|
579
|
+
items: params.items,
|
|
580
|
+
email: params.customerEmail,
|
|
581
|
+
name: params.customerName,
|
|
582
|
+
successUrl: params.successUrl,
|
|
583
|
+
cancelUrl: params.cancelUrl
|
|
584
|
+
};
|
|
585
|
+
return this.client.post("/api/cart/checkout", apiParams);
|
|
568
586
|
}
|
|
569
587
|
};
|
|
570
588
|
var DashboardAPI = class {
|
package/dist/index.mjs
CHANGED
|
@@ -534,9 +534,27 @@ var ProductAPI = class {
|
|
|
534
534
|
}
|
|
535
535
|
/**
|
|
536
536
|
* Create a cart checkout (guest checkout for store)
|
|
537
|
+
*
|
|
538
|
+
* @example
|
|
539
|
+
* ```typescript
|
|
540
|
+
* const { url } = await api.products.cartCheckout({
|
|
541
|
+
* items: [{ priceId: 'price_xxx', quantity: 1 }],
|
|
542
|
+
* customerEmail: 'customer@example.com',
|
|
543
|
+
* successUrl: '/success',
|
|
544
|
+
* cancelUrl: '/cart',
|
|
545
|
+
* });
|
|
546
|
+
* window.location.href = url;
|
|
547
|
+
* ```
|
|
537
548
|
*/
|
|
538
549
|
async cartCheckout(params) {
|
|
539
|
-
|
|
550
|
+
const apiParams = {
|
|
551
|
+
items: params.items,
|
|
552
|
+
email: params.customerEmail,
|
|
553
|
+
name: params.customerName,
|
|
554
|
+
successUrl: params.successUrl,
|
|
555
|
+
cancelUrl: params.cancelUrl
|
|
556
|
+
};
|
|
557
|
+
return this.client.post("/api/cart/checkout", apiParams);
|
|
540
558
|
}
|
|
541
559
|
};
|
|
542
560
|
var DashboardAPI = class {
|