@betterstore/sdk 0.3.34 → 0.3.36
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 +16 -4
- package/dist/index.d.ts +16 -4
- package/dist/index.js +2 -1
- package/dist/index.mjs +2 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -99,14 +99,26 @@ interface LineItem {
|
|
|
99
99
|
value: string;
|
|
100
100
|
}[];
|
|
101
101
|
discountId?: string;
|
|
102
|
-
product?: Pick<Product, "title" | "priceInCents" | "images"
|
|
102
|
+
product?: Pick<Product, "title" | "priceInCents" | "images" | "id" | "description" | "category" | "tags"> & {
|
|
103
|
+
productVariants: {
|
|
104
|
+
variantOptions: {
|
|
105
|
+
name: string;
|
|
106
|
+
value: string;
|
|
107
|
+
}[];
|
|
108
|
+
priceInCents: number;
|
|
109
|
+
images: string[];
|
|
110
|
+
}[];
|
|
111
|
+
};
|
|
103
112
|
metadata?: string;
|
|
104
113
|
}
|
|
114
|
+
interface LineItemCreate extends Omit<LineItem, "product"> {
|
|
115
|
+
product?: Pick<Product, "title" | "priceInCents" | "images">;
|
|
116
|
+
}
|
|
105
117
|
type Currency = string;
|
|
106
118
|
interface CheckoutCreateParams {
|
|
107
119
|
type: "hosted" | "embed";
|
|
108
120
|
customerId?: string;
|
|
109
|
-
lineItems:
|
|
121
|
+
lineItems: LineItemCreate[];
|
|
110
122
|
currency?: Currency;
|
|
111
123
|
}
|
|
112
124
|
interface CheckoutUpdateParams {
|
|
@@ -230,7 +242,7 @@ declare class Products {
|
|
|
230
242
|
private apiClient;
|
|
231
243
|
constructor(apiKey: string, proxy?: string);
|
|
232
244
|
list(): Promise<ProductWithoutVariants[]>;
|
|
233
|
-
retrieve(productId: string): Promise<Product>;
|
|
245
|
+
retrieve(productId: string): Promise<Product | null>;
|
|
234
246
|
}
|
|
235
247
|
|
|
236
248
|
declare function createBetterStore(config: {
|
|
@@ -248,4 +260,4 @@ declare function createStoreHelpers(config?: {
|
|
|
248
260
|
proxy?: string;
|
|
249
261
|
}): Helpers;
|
|
250
262
|
|
|
251
|
-
export { type Address, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Currency, type Customer$1 as Customer, type CustomerCreateParams, type CustomerUpdateParams, type LineItem, type Product, type ProductOption, ProductStatus, type ProductVariant, type ProductWithoutVariants, type ShippingRate, type VariantOption, createStoreClient, createStoreHelpers, createBetterStore as default };
|
|
263
|
+
export { type Address, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Currency, type Customer$1 as Customer, type CustomerCreateParams, type CustomerUpdateParams, type LineItem, type LineItemCreate, type Product, type ProductOption, ProductStatus, type ProductVariant, type ProductWithoutVariants, type ShippingRate, type VariantOption, createStoreClient, createStoreHelpers, createBetterStore as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -99,14 +99,26 @@ interface LineItem {
|
|
|
99
99
|
value: string;
|
|
100
100
|
}[];
|
|
101
101
|
discountId?: string;
|
|
102
|
-
product?: Pick<Product, "title" | "priceInCents" | "images"
|
|
102
|
+
product?: Pick<Product, "title" | "priceInCents" | "images" | "id" | "description" | "category" | "tags"> & {
|
|
103
|
+
productVariants: {
|
|
104
|
+
variantOptions: {
|
|
105
|
+
name: string;
|
|
106
|
+
value: string;
|
|
107
|
+
}[];
|
|
108
|
+
priceInCents: number;
|
|
109
|
+
images: string[];
|
|
110
|
+
}[];
|
|
111
|
+
};
|
|
103
112
|
metadata?: string;
|
|
104
113
|
}
|
|
114
|
+
interface LineItemCreate extends Omit<LineItem, "product"> {
|
|
115
|
+
product?: Pick<Product, "title" | "priceInCents" | "images">;
|
|
116
|
+
}
|
|
105
117
|
type Currency = string;
|
|
106
118
|
interface CheckoutCreateParams {
|
|
107
119
|
type: "hosted" | "embed";
|
|
108
120
|
customerId?: string;
|
|
109
|
-
lineItems:
|
|
121
|
+
lineItems: LineItemCreate[];
|
|
110
122
|
currency?: Currency;
|
|
111
123
|
}
|
|
112
124
|
interface CheckoutUpdateParams {
|
|
@@ -230,7 +242,7 @@ declare class Products {
|
|
|
230
242
|
private apiClient;
|
|
231
243
|
constructor(apiKey: string, proxy?: string);
|
|
232
244
|
list(): Promise<ProductWithoutVariants[]>;
|
|
233
|
-
retrieve(productId: string): Promise<Product>;
|
|
245
|
+
retrieve(productId: string): Promise<Product | null>;
|
|
234
246
|
}
|
|
235
247
|
|
|
236
248
|
declare function createBetterStore(config: {
|
|
@@ -248,4 +260,4 @@ declare function createStoreHelpers(config?: {
|
|
|
248
260
|
proxy?: string;
|
|
249
261
|
}): Helpers;
|
|
250
262
|
|
|
251
|
-
export { type Address, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Currency, type Customer$1 as Customer, type CustomerCreateParams, type CustomerUpdateParams, type LineItem, type Product, type ProductOption, ProductStatus, type ProductVariant, type ProductWithoutVariants, type ShippingRate, type VariantOption, createStoreClient, createStoreHelpers, createBetterStore as default };
|
|
263
|
+
export { type Address, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Currency, type Customer$1 as Customer, type CustomerCreateParams, type CustomerUpdateParams, type LineItem, type LineItemCreate, type Product, type ProductOption, ProductStatus, type ProductVariant, type ProductWithoutVariants, type ShippingRate, type VariantOption, createStoreClient, createStoreHelpers, createBetterStore as default };
|
package/dist/index.js
CHANGED
|
@@ -422,7 +422,8 @@ var Products = class {
|
|
|
422
422
|
return __async(this, null, function* () {
|
|
423
423
|
const data = yield this.apiClient.get(`/products/${productId}`);
|
|
424
424
|
if (!data) {
|
|
425
|
-
|
|
425
|
+
console.error(`Product with id ${productId} not found`);
|
|
426
|
+
return null;
|
|
426
427
|
}
|
|
427
428
|
return data;
|
|
428
429
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -384,7 +384,8 @@ var Products = class {
|
|
|
384
384
|
return __async(this, null, function* () {
|
|
385
385
|
const data = yield this.apiClient.get(`/products/${productId}`);
|
|
386
386
|
if (!data) {
|
|
387
|
-
|
|
387
|
+
console.error(`Product with id ${productId} not found`);
|
|
388
|
+
return null;
|
|
388
389
|
}
|
|
389
390
|
return data;
|
|
390
391
|
});
|