@betterstore/sdk 0.3.0 → 0.3.2
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/CHANGELOG.md +12 -0
- package/dist/index.d.mts +80 -91
- package/dist/index.d.ts +80 -91
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,82 @@
|
|
|
1
|
+
type Address = {
|
|
2
|
+
name: string;
|
|
3
|
+
company?: string;
|
|
4
|
+
line1: string;
|
|
5
|
+
line2?: string;
|
|
6
|
+
city: string;
|
|
7
|
+
state?: string;
|
|
8
|
+
country: string;
|
|
9
|
+
zipCode: string;
|
|
10
|
+
phone: string;
|
|
11
|
+
};
|
|
12
|
+
interface CustomerCreateParams {
|
|
13
|
+
firstName: string;
|
|
14
|
+
lastName: string;
|
|
15
|
+
email: string;
|
|
16
|
+
phone?: string;
|
|
17
|
+
address?: Address;
|
|
18
|
+
isSubscribedEmail?: boolean;
|
|
19
|
+
isSubscribedSMS?: boolean;
|
|
20
|
+
}
|
|
21
|
+
interface CustomerUpdateParams {
|
|
22
|
+
firstName?: string;
|
|
23
|
+
lastName?: string;
|
|
24
|
+
email?: string;
|
|
25
|
+
phone?: string;
|
|
26
|
+
address?: Address;
|
|
27
|
+
isSubscribedEmail?: boolean;
|
|
28
|
+
isSubscribedSMS?: boolean;
|
|
29
|
+
}
|
|
30
|
+
interface Customer$1 extends CustomerCreateParams {
|
|
31
|
+
id: string;
|
|
32
|
+
createdAt: string;
|
|
33
|
+
updatedAt: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface VariantOption {
|
|
37
|
+
name: string;
|
|
38
|
+
value: string;
|
|
39
|
+
}
|
|
40
|
+
interface ProductVariant {
|
|
41
|
+
sku: string;
|
|
42
|
+
images: string[];
|
|
43
|
+
stockAvailable: number;
|
|
44
|
+
stockCommited: number;
|
|
45
|
+
stockUnavailable: number;
|
|
46
|
+
priceInCents: number;
|
|
47
|
+
productId: string;
|
|
48
|
+
variantOptions: VariantOption[];
|
|
49
|
+
}
|
|
50
|
+
interface ProductOption {
|
|
51
|
+
name: string;
|
|
52
|
+
values: string[];
|
|
53
|
+
}
|
|
54
|
+
declare enum ProductStatus {
|
|
55
|
+
DRAFT = "DRAFT",
|
|
56
|
+
ACTIVE = "ACTIVE",
|
|
57
|
+
ARCHIVED = "ARCHIVED"
|
|
58
|
+
}
|
|
59
|
+
interface Product {
|
|
60
|
+
id: string;
|
|
61
|
+
title: string;
|
|
62
|
+
description?: string;
|
|
63
|
+
images: string[];
|
|
64
|
+
category: string;
|
|
65
|
+
tags: string[];
|
|
66
|
+
isPhysical: boolean;
|
|
67
|
+
weightInGrams?: number;
|
|
68
|
+
heightInCm?: number;
|
|
69
|
+
widthInCm?: number;
|
|
70
|
+
lengthInCm?: number;
|
|
71
|
+
priceInCents: number;
|
|
72
|
+
stockAvailable: number;
|
|
73
|
+
stockCommited: number;
|
|
74
|
+
stockUnavailable: number;
|
|
75
|
+
status: ProductStatus;
|
|
76
|
+
options: ProductOption[];
|
|
77
|
+
productVariants: ProductVariant[];
|
|
78
|
+
}
|
|
79
|
+
|
|
1
80
|
interface LineItem {
|
|
2
81
|
quantity: number;
|
|
3
82
|
productId?: string;
|
|
@@ -25,17 +104,6 @@ interface ShippingRate {
|
|
|
25
104
|
service: string;
|
|
26
105
|
estimatedDays: number;
|
|
27
106
|
}
|
|
28
|
-
interface Address {
|
|
29
|
-
name: string;
|
|
30
|
-
company?: string;
|
|
31
|
-
address: string;
|
|
32
|
-
city: string;
|
|
33
|
-
state: string;
|
|
34
|
-
country: string;
|
|
35
|
-
apartment?: string;
|
|
36
|
-
postalCode: string;
|
|
37
|
-
phone: string;
|
|
38
|
-
}
|
|
39
107
|
interface CheckoutSession {
|
|
40
108
|
id: string;
|
|
41
109
|
createdAt: Date;
|
|
@@ -97,41 +165,6 @@ declare class Checkout {
|
|
|
97
165
|
generatePaymentSecret(checkoutId: string): Promise<string>;
|
|
98
166
|
}
|
|
99
167
|
|
|
100
|
-
interface CustomerAddress {
|
|
101
|
-
name: string;
|
|
102
|
-
company?: string;
|
|
103
|
-
address: string;
|
|
104
|
-
city: string;
|
|
105
|
-
state: string;
|
|
106
|
-
country: string;
|
|
107
|
-
apartment?: string;
|
|
108
|
-
postalCode: string;
|
|
109
|
-
phone: string;
|
|
110
|
-
}
|
|
111
|
-
interface CustomerCreateParams {
|
|
112
|
-
firstName: string;
|
|
113
|
-
lastName: string;
|
|
114
|
-
email: string;
|
|
115
|
-
phone?: string;
|
|
116
|
-
address?: CustomerAddress;
|
|
117
|
-
isSubscribedEmail?: boolean;
|
|
118
|
-
isSubscribedSMS?: boolean;
|
|
119
|
-
}
|
|
120
|
-
interface CustomerUpdateParams {
|
|
121
|
-
firstName?: string;
|
|
122
|
-
lastName?: string;
|
|
123
|
-
email?: string;
|
|
124
|
-
phone?: string;
|
|
125
|
-
address?: CustomerAddress;
|
|
126
|
-
isSubscribedEmail?: boolean;
|
|
127
|
-
isSubscribedSMS?: boolean;
|
|
128
|
-
}
|
|
129
|
-
interface Customer$1 extends CustomerCreateParams {
|
|
130
|
-
id: string;
|
|
131
|
-
createdAt: string;
|
|
132
|
-
updatedAt: string;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
168
|
declare class Client {
|
|
136
169
|
/**
|
|
137
170
|
* Retrieve a checkout session by ID
|
|
@@ -184,50 +217,6 @@ declare class Customer {
|
|
|
184
217
|
delete(customerId: string): Promise<void>;
|
|
185
218
|
}
|
|
186
219
|
|
|
187
|
-
interface VariantOption {
|
|
188
|
-
name: string;
|
|
189
|
-
value: string;
|
|
190
|
-
}
|
|
191
|
-
interface ProductVariant {
|
|
192
|
-
sku: string;
|
|
193
|
-
images: string[];
|
|
194
|
-
stockAvailable: number;
|
|
195
|
-
stockCommited: number;
|
|
196
|
-
stockUnavailable: number;
|
|
197
|
-
priceInCents: number;
|
|
198
|
-
productId: string;
|
|
199
|
-
variantOptions: VariantOption[];
|
|
200
|
-
}
|
|
201
|
-
interface ProductOption {
|
|
202
|
-
name: string;
|
|
203
|
-
values: string[];
|
|
204
|
-
}
|
|
205
|
-
declare enum ProductStatus {
|
|
206
|
-
DRAFT = "DRAFT",
|
|
207
|
-
ACTIVE = "ACTIVE",
|
|
208
|
-
ARCHIVED = "ARCHIVED"
|
|
209
|
-
}
|
|
210
|
-
interface Product {
|
|
211
|
-
id: string;
|
|
212
|
-
title: string;
|
|
213
|
-
description?: string;
|
|
214
|
-
images: string[];
|
|
215
|
-
category: string;
|
|
216
|
-
tags: string[];
|
|
217
|
-
isPhysical: boolean;
|
|
218
|
-
weightInGrams?: number;
|
|
219
|
-
heightInCm?: number;
|
|
220
|
-
widthInCm?: number;
|
|
221
|
-
lengthInCm?: number;
|
|
222
|
-
priceInCents: number;
|
|
223
|
-
stockAvailable: number;
|
|
224
|
-
stockCommited: number;
|
|
225
|
-
stockUnavailable: number;
|
|
226
|
-
status: ProductStatus;
|
|
227
|
-
options: ProductOption[];
|
|
228
|
-
productVariants: ProductVariant[];
|
|
229
|
-
}
|
|
230
|
-
|
|
231
220
|
declare class Products {
|
|
232
221
|
private apiClient;
|
|
233
222
|
constructor(apiKey: string);
|
|
@@ -244,4 +233,4 @@ declare function betterStore(config: {
|
|
|
244
233
|
};
|
|
245
234
|
declare function createStoreClient(): Client;
|
|
246
235
|
|
|
247
|
-
export { type Address, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Customer$1 as Customer, type
|
|
236
|
+
export { type Address, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Customer$1 as Customer, type CustomerCreateParams, type CustomerUpdateParams, type LineItem, type Product, type ProductOption, ProductStatus, type ProductVariant, type ShippingRate, type VariantOption, createStoreClient, betterStore as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,82 @@
|
|
|
1
|
+
type Address = {
|
|
2
|
+
name: string;
|
|
3
|
+
company?: string;
|
|
4
|
+
line1: string;
|
|
5
|
+
line2?: string;
|
|
6
|
+
city: string;
|
|
7
|
+
state?: string;
|
|
8
|
+
country: string;
|
|
9
|
+
zipCode: string;
|
|
10
|
+
phone: string;
|
|
11
|
+
};
|
|
12
|
+
interface CustomerCreateParams {
|
|
13
|
+
firstName: string;
|
|
14
|
+
lastName: string;
|
|
15
|
+
email: string;
|
|
16
|
+
phone?: string;
|
|
17
|
+
address?: Address;
|
|
18
|
+
isSubscribedEmail?: boolean;
|
|
19
|
+
isSubscribedSMS?: boolean;
|
|
20
|
+
}
|
|
21
|
+
interface CustomerUpdateParams {
|
|
22
|
+
firstName?: string;
|
|
23
|
+
lastName?: string;
|
|
24
|
+
email?: string;
|
|
25
|
+
phone?: string;
|
|
26
|
+
address?: Address;
|
|
27
|
+
isSubscribedEmail?: boolean;
|
|
28
|
+
isSubscribedSMS?: boolean;
|
|
29
|
+
}
|
|
30
|
+
interface Customer$1 extends CustomerCreateParams {
|
|
31
|
+
id: string;
|
|
32
|
+
createdAt: string;
|
|
33
|
+
updatedAt: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface VariantOption {
|
|
37
|
+
name: string;
|
|
38
|
+
value: string;
|
|
39
|
+
}
|
|
40
|
+
interface ProductVariant {
|
|
41
|
+
sku: string;
|
|
42
|
+
images: string[];
|
|
43
|
+
stockAvailable: number;
|
|
44
|
+
stockCommited: number;
|
|
45
|
+
stockUnavailable: number;
|
|
46
|
+
priceInCents: number;
|
|
47
|
+
productId: string;
|
|
48
|
+
variantOptions: VariantOption[];
|
|
49
|
+
}
|
|
50
|
+
interface ProductOption {
|
|
51
|
+
name: string;
|
|
52
|
+
values: string[];
|
|
53
|
+
}
|
|
54
|
+
declare enum ProductStatus {
|
|
55
|
+
DRAFT = "DRAFT",
|
|
56
|
+
ACTIVE = "ACTIVE",
|
|
57
|
+
ARCHIVED = "ARCHIVED"
|
|
58
|
+
}
|
|
59
|
+
interface Product {
|
|
60
|
+
id: string;
|
|
61
|
+
title: string;
|
|
62
|
+
description?: string;
|
|
63
|
+
images: string[];
|
|
64
|
+
category: string;
|
|
65
|
+
tags: string[];
|
|
66
|
+
isPhysical: boolean;
|
|
67
|
+
weightInGrams?: number;
|
|
68
|
+
heightInCm?: number;
|
|
69
|
+
widthInCm?: number;
|
|
70
|
+
lengthInCm?: number;
|
|
71
|
+
priceInCents: number;
|
|
72
|
+
stockAvailable: number;
|
|
73
|
+
stockCommited: number;
|
|
74
|
+
stockUnavailable: number;
|
|
75
|
+
status: ProductStatus;
|
|
76
|
+
options: ProductOption[];
|
|
77
|
+
productVariants: ProductVariant[];
|
|
78
|
+
}
|
|
79
|
+
|
|
1
80
|
interface LineItem {
|
|
2
81
|
quantity: number;
|
|
3
82
|
productId?: string;
|
|
@@ -25,17 +104,6 @@ interface ShippingRate {
|
|
|
25
104
|
service: string;
|
|
26
105
|
estimatedDays: number;
|
|
27
106
|
}
|
|
28
|
-
interface Address {
|
|
29
|
-
name: string;
|
|
30
|
-
company?: string;
|
|
31
|
-
address: string;
|
|
32
|
-
city: string;
|
|
33
|
-
state: string;
|
|
34
|
-
country: string;
|
|
35
|
-
apartment?: string;
|
|
36
|
-
postalCode: string;
|
|
37
|
-
phone: string;
|
|
38
|
-
}
|
|
39
107
|
interface CheckoutSession {
|
|
40
108
|
id: string;
|
|
41
109
|
createdAt: Date;
|
|
@@ -97,41 +165,6 @@ declare class Checkout {
|
|
|
97
165
|
generatePaymentSecret(checkoutId: string): Promise<string>;
|
|
98
166
|
}
|
|
99
167
|
|
|
100
|
-
interface CustomerAddress {
|
|
101
|
-
name: string;
|
|
102
|
-
company?: string;
|
|
103
|
-
address: string;
|
|
104
|
-
city: string;
|
|
105
|
-
state: string;
|
|
106
|
-
country: string;
|
|
107
|
-
apartment?: string;
|
|
108
|
-
postalCode: string;
|
|
109
|
-
phone: string;
|
|
110
|
-
}
|
|
111
|
-
interface CustomerCreateParams {
|
|
112
|
-
firstName: string;
|
|
113
|
-
lastName: string;
|
|
114
|
-
email: string;
|
|
115
|
-
phone?: string;
|
|
116
|
-
address?: CustomerAddress;
|
|
117
|
-
isSubscribedEmail?: boolean;
|
|
118
|
-
isSubscribedSMS?: boolean;
|
|
119
|
-
}
|
|
120
|
-
interface CustomerUpdateParams {
|
|
121
|
-
firstName?: string;
|
|
122
|
-
lastName?: string;
|
|
123
|
-
email?: string;
|
|
124
|
-
phone?: string;
|
|
125
|
-
address?: CustomerAddress;
|
|
126
|
-
isSubscribedEmail?: boolean;
|
|
127
|
-
isSubscribedSMS?: boolean;
|
|
128
|
-
}
|
|
129
|
-
interface Customer$1 extends CustomerCreateParams {
|
|
130
|
-
id: string;
|
|
131
|
-
createdAt: string;
|
|
132
|
-
updatedAt: string;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
168
|
declare class Client {
|
|
136
169
|
/**
|
|
137
170
|
* Retrieve a checkout session by ID
|
|
@@ -184,50 +217,6 @@ declare class Customer {
|
|
|
184
217
|
delete(customerId: string): Promise<void>;
|
|
185
218
|
}
|
|
186
219
|
|
|
187
|
-
interface VariantOption {
|
|
188
|
-
name: string;
|
|
189
|
-
value: string;
|
|
190
|
-
}
|
|
191
|
-
interface ProductVariant {
|
|
192
|
-
sku: string;
|
|
193
|
-
images: string[];
|
|
194
|
-
stockAvailable: number;
|
|
195
|
-
stockCommited: number;
|
|
196
|
-
stockUnavailable: number;
|
|
197
|
-
priceInCents: number;
|
|
198
|
-
productId: string;
|
|
199
|
-
variantOptions: VariantOption[];
|
|
200
|
-
}
|
|
201
|
-
interface ProductOption {
|
|
202
|
-
name: string;
|
|
203
|
-
values: string[];
|
|
204
|
-
}
|
|
205
|
-
declare enum ProductStatus {
|
|
206
|
-
DRAFT = "DRAFT",
|
|
207
|
-
ACTIVE = "ACTIVE",
|
|
208
|
-
ARCHIVED = "ARCHIVED"
|
|
209
|
-
}
|
|
210
|
-
interface Product {
|
|
211
|
-
id: string;
|
|
212
|
-
title: string;
|
|
213
|
-
description?: string;
|
|
214
|
-
images: string[];
|
|
215
|
-
category: string;
|
|
216
|
-
tags: string[];
|
|
217
|
-
isPhysical: boolean;
|
|
218
|
-
weightInGrams?: number;
|
|
219
|
-
heightInCm?: number;
|
|
220
|
-
widthInCm?: number;
|
|
221
|
-
lengthInCm?: number;
|
|
222
|
-
priceInCents: number;
|
|
223
|
-
stockAvailable: number;
|
|
224
|
-
stockCommited: number;
|
|
225
|
-
stockUnavailable: number;
|
|
226
|
-
status: ProductStatus;
|
|
227
|
-
options: ProductOption[];
|
|
228
|
-
productVariants: ProductVariant[];
|
|
229
|
-
}
|
|
230
|
-
|
|
231
220
|
declare class Products {
|
|
232
221
|
private apiClient;
|
|
233
222
|
constructor(apiKey: string);
|
|
@@ -244,4 +233,4 @@ declare function betterStore(config: {
|
|
|
244
233
|
};
|
|
245
234
|
declare function createStoreClient(): Client;
|
|
246
235
|
|
|
247
|
-
export { type Address, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Customer$1 as Customer, type
|
|
236
|
+
export { type Address, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Customer$1 as Customer, type CustomerCreateParams, type CustomerUpdateParams, type LineItem, type Product, type ProductOption, ProductStatus, type ProductVariant, type ShippingRate, type VariantOption, createStoreClient, betterStore as default };
|
package/dist/index.js
CHANGED
|
@@ -172,7 +172,7 @@ var Client = class {
|
|
|
172
172
|
*/
|
|
173
173
|
retrieveCheckout(clientSecret, checkoutId) {
|
|
174
174
|
return __async(this, null, function* () {
|
|
175
|
-
const apiClient = createApiClient(
|
|
175
|
+
const apiClient = createApiClient("");
|
|
176
176
|
const data = yield apiClient.get(
|
|
177
177
|
`/checkout/${checkoutId}`
|
|
178
178
|
);
|
package/dist/index.mjs
CHANGED
|
@@ -135,7 +135,7 @@ var Client = class {
|
|
|
135
135
|
*/
|
|
136
136
|
retrieveCheckout(clientSecret, checkoutId) {
|
|
137
137
|
return __async(this, null, function* () {
|
|
138
|
-
const apiClient = createApiClient(
|
|
138
|
+
const apiClient = createApiClient("");
|
|
139
139
|
const data = yield apiClient.get(
|
|
140
140
|
`/checkout/${checkoutId}`
|
|
141
141
|
);
|