@betterstore/sdk 0.2.12 → 0.2.13
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 +6 -0
- package/dist/index.d.mts +8 -5
- package/dist/index.d.ts +8 -5
- package/dist/index.js +16 -4
- package/dist/index.mjs +15 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -73,6 +73,7 @@ interface CheckoutSession {
|
|
|
73
73
|
email?: string;
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
|
+
|
|
76
77
|
declare class Checkout {
|
|
77
78
|
private apiClient;
|
|
78
79
|
constructor(apiKey: string);
|
|
@@ -127,26 +128,27 @@ interface CustomerUpdateParams {
|
|
|
127
128
|
isSubscribedEmail?: boolean;
|
|
128
129
|
isSubscribedSMS?: boolean;
|
|
129
130
|
}
|
|
130
|
-
interface Customer extends CustomerCreateParams {
|
|
131
|
+
interface Customer$1 extends CustomerCreateParams {
|
|
131
132
|
id: string;
|
|
132
133
|
createdAt: string;
|
|
133
134
|
updatedAt: string;
|
|
134
135
|
}
|
|
136
|
+
|
|
135
137
|
declare class Customer {
|
|
136
138
|
private apiClient;
|
|
137
139
|
constructor(apiKey: string);
|
|
138
140
|
/**
|
|
139
141
|
* Create a new customer
|
|
140
142
|
*/
|
|
141
|
-
create(params: CustomerCreateParams): Promise<Customer>;
|
|
143
|
+
create(params: CustomerCreateParams): Promise<Customer$1>;
|
|
142
144
|
/**
|
|
143
145
|
* Retrieve a customer by ID or email
|
|
144
146
|
*/
|
|
145
|
-
retrieve(idOrEmail: string): Promise<Customer>;
|
|
147
|
+
retrieve(idOrEmail: string): Promise<Customer$1>;
|
|
146
148
|
/**
|
|
147
149
|
* Update a customer
|
|
148
150
|
*/
|
|
149
|
-
update(customerId: string, params: CustomerUpdateParams): Promise<Customer>;
|
|
151
|
+
update(customerId: string, params: CustomerUpdateParams): Promise<Customer$1>;
|
|
150
152
|
/**
|
|
151
153
|
* Delete a customer
|
|
152
154
|
*/
|
|
@@ -196,6 +198,7 @@ interface Product {
|
|
|
196
198
|
options: ProductOption[];
|
|
197
199
|
productVariants: ProductVariant[];
|
|
198
200
|
}
|
|
201
|
+
|
|
199
202
|
declare class Products {
|
|
200
203
|
private apiClient;
|
|
201
204
|
constructor(apiKey: string);
|
|
@@ -222,4 +225,4 @@ declare class BetterStore {
|
|
|
222
225
|
constructor(apiKey: string);
|
|
223
226
|
}
|
|
224
227
|
|
|
225
|
-
export { createNextJSHandler, BetterStore as default };
|
|
228
|
+
export { type Address, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Customer$1 as Customer, type CustomerAddress, type CustomerCreateParams, type CustomerUpdateParams, type LineItem, type Product, type ProductOption, ProductStatus, type ProductVariant, type ShippingRate, type VariantOption, createNextJSHandler, BetterStore as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -73,6 +73,7 @@ interface CheckoutSession {
|
|
|
73
73
|
email?: string;
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
|
+
|
|
76
77
|
declare class Checkout {
|
|
77
78
|
private apiClient;
|
|
78
79
|
constructor(apiKey: string);
|
|
@@ -127,26 +128,27 @@ interface CustomerUpdateParams {
|
|
|
127
128
|
isSubscribedEmail?: boolean;
|
|
128
129
|
isSubscribedSMS?: boolean;
|
|
129
130
|
}
|
|
130
|
-
interface Customer extends CustomerCreateParams {
|
|
131
|
+
interface Customer$1 extends CustomerCreateParams {
|
|
131
132
|
id: string;
|
|
132
133
|
createdAt: string;
|
|
133
134
|
updatedAt: string;
|
|
134
135
|
}
|
|
136
|
+
|
|
135
137
|
declare class Customer {
|
|
136
138
|
private apiClient;
|
|
137
139
|
constructor(apiKey: string);
|
|
138
140
|
/**
|
|
139
141
|
* Create a new customer
|
|
140
142
|
*/
|
|
141
|
-
create(params: CustomerCreateParams): Promise<Customer>;
|
|
143
|
+
create(params: CustomerCreateParams): Promise<Customer$1>;
|
|
142
144
|
/**
|
|
143
145
|
* Retrieve a customer by ID or email
|
|
144
146
|
*/
|
|
145
|
-
retrieve(idOrEmail: string): Promise<Customer>;
|
|
147
|
+
retrieve(idOrEmail: string): Promise<Customer$1>;
|
|
146
148
|
/**
|
|
147
149
|
* Update a customer
|
|
148
150
|
*/
|
|
149
|
-
update(customerId: string, params: CustomerUpdateParams): Promise<Customer>;
|
|
151
|
+
update(customerId: string, params: CustomerUpdateParams): Promise<Customer$1>;
|
|
150
152
|
/**
|
|
151
153
|
* Delete a customer
|
|
152
154
|
*/
|
|
@@ -196,6 +198,7 @@ interface Product {
|
|
|
196
198
|
options: ProductOption[];
|
|
197
199
|
productVariants: ProductVariant[];
|
|
198
200
|
}
|
|
201
|
+
|
|
199
202
|
declare class Products {
|
|
200
203
|
private apiClient;
|
|
201
204
|
constructor(apiKey: string);
|
|
@@ -222,4 +225,4 @@ declare class BetterStore {
|
|
|
222
225
|
constructor(apiKey: string);
|
|
223
226
|
}
|
|
224
227
|
|
|
225
|
-
export { createNextJSHandler, BetterStore as default };
|
|
228
|
+
export { type Address, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Customer$1 as Customer, type CustomerAddress, type CustomerCreateParams, type CustomerUpdateParams, type LineItem, type Product, type ProductOption, ProductStatus, type ProductVariant, type ShippingRate, type VariantOption, createNextJSHandler, BetterStore as default };
|
package/dist/index.js
CHANGED
|
@@ -50,6 +50,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
50
50
|
// src/index.ts
|
|
51
51
|
var index_exports = {};
|
|
52
52
|
__export(index_exports, {
|
|
53
|
+
ProductStatus: () => ProductStatus,
|
|
53
54
|
createNextJSHandler: () => createNextJSHandler,
|
|
54
55
|
default: () => index_default
|
|
55
56
|
});
|
|
@@ -99,7 +100,7 @@ var createApiClient = (apiKey) => {
|
|
|
99
100
|
return client;
|
|
100
101
|
};
|
|
101
102
|
|
|
102
|
-
// src/checkout.ts
|
|
103
|
+
// src/checkout/index.ts
|
|
103
104
|
var Checkout = class {
|
|
104
105
|
constructor(apiKey) {
|
|
105
106
|
this.apiClient = createApiClient(apiKey);
|
|
@@ -164,7 +165,7 @@ var Checkout = class {
|
|
|
164
165
|
};
|
|
165
166
|
var checkout_default = Checkout;
|
|
166
167
|
|
|
167
|
-
// src/customer.ts
|
|
168
|
+
// src/customer/index.ts
|
|
168
169
|
var Customer = class {
|
|
169
170
|
constructor(apiKey) {
|
|
170
171
|
this.apiClient = createApiClient(apiKey);
|
|
@@ -183,7 +184,9 @@ var Customer = class {
|
|
|
183
184
|
*/
|
|
184
185
|
retrieve(idOrEmail) {
|
|
185
186
|
return __async(this, null, function* () {
|
|
186
|
-
const data = yield this.apiClient.get(
|
|
187
|
+
const data = yield this.apiClient.get(
|
|
188
|
+
`/customers/${idOrEmail}`
|
|
189
|
+
);
|
|
187
190
|
if (!data) {
|
|
188
191
|
throw new Error("Customer not found");
|
|
189
192
|
}
|
|
@@ -213,7 +216,7 @@ var Customer = class {
|
|
|
213
216
|
};
|
|
214
217
|
var customer_default = Customer;
|
|
215
218
|
|
|
216
|
-
// src/products.ts
|
|
219
|
+
// src/products/index.ts
|
|
217
220
|
var Products = class {
|
|
218
221
|
constructor(apiKey) {
|
|
219
222
|
this.apiClient = createApiClient(apiKey);
|
|
@@ -534,6 +537,14 @@ function createNextJSHandler(betterStore, config = {}) {
|
|
|
534
537
|
};
|
|
535
538
|
}
|
|
536
539
|
|
|
540
|
+
// src/products/types.ts
|
|
541
|
+
var ProductStatus = /* @__PURE__ */ ((ProductStatus2) => {
|
|
542
|
+
ProductStatus2["DRAFT"] = "DRAFT";
|
|
543
|
+
ProductStatus2["ACTIVE"] = "ACTIVE";
|
|
544
|
+
ProductStatus2["ARCHIVED"] = "ARCHIVED";
|
|
545
|
+
return ProductStatus2;
|
|
546
|
+
})(ProductStatus || {});
|
|
547
|
+
|
|
537
548
|
// src/index.ts
|
|
538
549
|
var BetterStore = class {
|
|
539
550
|
// private apiKey: string;
|
|
@@ -549,5 +560,6 @@ var BetterStore = class {
|
|
|
549
560
|
var index_default = BetterStore;
|
|
550
561
|
// Annotate the CommonJS export names for ESM import in node:
|
|
551
562
|
0 && (module.exports = {
|
|
563
|
+
ProductStatus,
|
|
552
564
|
createNextJSHandler
|
|
553
565
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -63,7 +63,7 @@ var createApiClient = (apiKey) => {
|
|
|
63
63
|
return client;
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
// src/checkout.ts
|
|
66
|
+
// src/checkout/index.ts
|
|
67
67
|
var Checkout = class {
|
|
68
68
|
constructor(apiKey) {
|
|
69
69
|
this.apiClient = createApiClient(apiKey);
|
|
@@ -128,7 +128,7 @@ var Checkout = class {
|
|
|
128
128
|
};
|
|
129
129
|
var checkout_default = Checkout;
|
|
130
130
|
|
|
131
|
-
// src/customer.ts
|
|
131
|
+
// src/customer/index.ts
|
|
132
132
|
var Customer = class {
|
|
133
133
|
constructor(apiKey) {
|
|
134
134
|
this.apiClient = createApiClient(apiKey);
|
|
@@ -147,7 +147,9 @@ var Customer = class {
|
|
|
147
147
|
*/
|
|
148
148
|
retrieve(idOrEmail) {
|
|
149
149
|
return __async(this, null, function* () {
|
|
150
|
-
const data = yield this.apiClient.get(
|
|
150
|
+
const data = yield this.apiClient.get(
|
|
151
|
+
`/customers/${idOrEmail}`
|
|
152
|
+
);
|
|
151
153
|
if (!data) {
|
|
152
154
|
throw new Error("Customer not found");
|
|
153
155
|
}
|
|
@@ -177,7 +179,7 @@ var Customer = class {
|
|
|
177
179
|
};
|
|
178
180
|
var customer_default = Customer;
|
|
179
181
|
|
|
180
|
-
// src/products.ts
|
|
182
|
+
// src/products/index.ts
|
|
181
183
|
var Products = class {
|
|
182
184
|
constructor(apiKey) {
|
|
183
185
|
this.apiClient = createApiClient(apiKey);
|
|
@@ -498,6 +500,14 @@ function createNextJSHandler(betterStore, config = {}) {
|
|
|
498
500
|
};
|
|
499
501
|
}
|
|
500
502
|
|
|
503
|
+
// src/products/types.ts
|
|
504
|
+
var ProductStatus = /* @__PURE__ */ ((ProductStatus2) => {
|
|
505
|
+
ProductStatus2["DRAFT"] = "DRAFT";
|
|
506
|
+
ProductStatus2["ACTIVE"] = "ACTIVE";
|
|
507
|
+
ProductStatus2["ARCHIVED"] = "ARCHIVED";
|
|
508
|
+
return ProductStatus2;
|
|
509
|
+
})(ProductStatus || {});
|
|
510
|
+
|
|
501
511
|
// src/index.ts
|
|
502
512
|
var BetterStore = class {
|
|
503
513
|
// private apiKey: string;
|
|
@@ -512,6 +522,7 @@ var BetterStore = class {
|
|
|
512
522
|
};
|
|
513
523
|
var index_default = BetterStore;
|
|
514
524
|
export {
|
|
525
|
+
ProductStatus,
|
|
515
526
|
createNextJSHandler,
|
|
516
527
|
index_default as default
|
|
517
528
|
};
|