@betterstore/sdk 0.3.62 → 0.3.64
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 +11 -8
- package/dist/index.d.ts +11 -8
- package/dist/index.js +1 -33
- package/dist/index.mjs +1 -34
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -53,17 +53,17 @@ interface ProductVariant {
|
|
|
53
53
|
widthInCm?: number;
|
|
54
54
|
lengthInCm?: number;
|
|
55
55
|
priceInCents: number;
|
|
56
|
+
billingType: ProductBillingType;
|
|
57
|
+
billingInterval?: string | null;
|
|
58
|
+
stripeProductId?: string | null;
|
|
56
59
|
variantOptions: VariantOption[];
|
|
57
60
|
}
|
|
58
61
|
interface ProductOption {
|
|
59
62
|
name: string;
|
|
60
63
|
values: string[];
|
|
61
64
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
ACTIVE = "ACTIVE",
|
|
65
|
-
ARCHIVED = "ARCHIVED"
|
|
66
|
-
}
|
|
65
|
+
type ProductStatus = "DRAFT" | "ACTIVE" | "ARCHIVED";
|
|
66
|
+
type ProductBillingType = "ONE_TIME" | "SUBSCRIPTION";
|
|
67
67
|
interface Product {
|
|
68
68
|
id: string;
|
|
69
69
|
title: string;
|
|
@@ -77,6 +77,9 @@ interface Product {
|
|
|
77
77
|
widthInCm?: number;
|
|
78
78
|
lengthInCm?: number;
|
|
79
79
|
priceInCents: number;
|
|
80
|
+
billingType: ProductBillingType;
|
|
81
|
+
billingInterval?: string | null;
|
|
82
|
+
stripeProductId?: string | null;
|
|
80
83
|
trackInventory: boolean;
|
|
81
84
|
sku?: string;
|
|
82
85
|
barcode?: string;
|
|
@@ -117,9 +120,9 @@ interface ZasilkovnaRate extends BaseRate {
|
|
|
117
120
|
clientSecret: string;
|
|
118
121
|
}
|
|
119
122
|
|
|
120
|
-
type ProductData = Pick<Product, "title" | "description" | "images" | "category" | "tags" | "sku" | "barcode" | "vendor" | "isPhysical" | "weightInGrams" | "heightInCm" | "widthInCm" | "lengthInCm" | "priceInCents"> & {
|
|
123
|
+
type ProductData = Pick<Product, "title" | "description" | "images" | "category" | "tags" | "sku" | "barcode" | "vendor" | "isPhysical" | "weightInGrams" | "heightInCm" | "widthInCm" | "lengthInCm" | "priceInCents" | "billingType" | "billingInterval" | "stripeProductId"> & {
|
|
121
124
|
productId: string;
|
|
122
|
-
selectedVariant: Pick<ProductVariant, "title" | "sku" | "barcode" | "images" | "isPhysical" | "weightInGrams" | "heightInCm" | "widthInCm" | "lengthInCm" | "priceInCents" | "variantOptions">;
|
|
125
|
+
selectedVariant: Pick<ProductVariant, "title" | "sku" | "barcode" | "images" | "isPhysical" | "weightInGrams" | "heightInCm" | "widthInCm" | "lengthInCm" | "priceInCents" | "billingType" | "billingInterval" | "stripeProductId" | "variantOptions">;
|
|
123
126
|
};
|
|
124
127
|
interface LineItem {
|
|
125
128
|
quantity: number;
|
|
@@ -363,4 +366,4 @@ declare function createStoreHelpers(config?: {
|
|
|
363
366
|
proxy?: string;
|
|
364
367
|
}): Helpers;
|
|
365
368
|
|
|
366
|
-
export { type Address, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Collection, type CollectionWithProducts, 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 };
|
|
369
|
+
export { type Address, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Collection, type CollectionWithProducts, type Currency, type Customer$1 as Customer, type CustomerCreateParams, type CustomerUpdateParams, type LineItem, type LineItemCreate, type Product, type ProductBillingType, type ProductOption, type ProductStatus, type ProductVariant, type ProductWithoutVariants, type ShippingRate, type VariantOption, createStoreClient, createStoreHelpers, createBetterStore as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -53,17 +53,17 @@ interface ProductVariant {
|
|
|
53
53
|
widthInCm?: number;
|
|
54
54
|
lengthInCm?: number;
|
|
55
55
|
priceInCents: number;
|
|
56
|
+
billingType: ProductBillingType;
|
|
57
|
+
billingInterval?: string | null;
|
|
58
|
+
stripeProductId?: string | null;
|
|
56
59
|
variantOptions: VariantOption[];
|
|
57
60
|
}
|
|
58
61
|
interface ProductOption {
|
|
59
62
|
name: string;
|
|
60
63
|
values: string[];
|
|
61
64
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
ACTIVE = "ACTIVE",
|
|
65
|
-
ARCHIVED = "ARCHIVED"
|
|
66
|
-
}
|
|
65
|
+
type ProductStatus = "DRAFT" | "ACTIVE" | "ARCHIVED";
|
|
66
|
+
type ProductBillingType = "ONE_TIME" | "SUBSCRIPTION";
|
|
67
67
|
interface Product {
|
|
68
68
|
id: string;
|
|
69
69
|
title: string;
|
|
@@ -77,6 +77,9 @@ interface Product {
|
|
|
77
77
|
widthInCm?: number;
|
|
78
78
|
lengthInCm?: number;
|
|
79
79
|
priceInCents: number;
|
|
80
|
+
billingType: ProductBillingType;
|
|
81
|
+
billingInterval?: string | null;
|
|
82
|
+
stripeProductId?: string | null;
|
|
80
83
|
trackInventory: boolean;
|
|
81
84
|
sku?: string;
|
|
82
85
|
barcode?: string;
|
|
@@ -117,9 +120,9 @@ interface ZasilkovnaRate extends BaseRate {
|
|
|
117
120
|
clientSecret: string;
|
|
118
121
|
}
|
|
119
122
|
|
|
120
|
-
type ProductData = Pick<Product, "title" | "description" | "images" | "category" | "tags" | "sku" | "barcode" | "vendor" | "isPhysical" | "weightInGrams" | "heightInCm" | "widthInCm" | "lengthInCm" | "priceInCents"> & {
|
|
123
|
+
type ProductData = Pick<Product, "title" | "description" | "images" | "category" | "tags" | "sku" | "barcode" | "vendor" | "isPhysical" | "weightInGrams" | "heightInCm" | "widthInCm" | "lengthInCm" | "priceInCents" | "billingType" | "billingInterval" | "stripeProductId"> & {
|
|
121
124
|
productId: string;
|
|
122
|
-
selectedVariant: Pick<ProductVariant, "title" | "sku" | "barcode" | "images" | "isPhysical" | "weightInGrams" | "heightInCm" | "widthInCm" | "lengthInCm" | "priceInCents" | "variantOptions">;
|
|
125
|
+
selectedVariant: Pick<ProductVariant, "title" | "sku" | "barcode" | "images" | "isPhysical" | "weightInGrams" | "heightInCm" | "widthInCm" | "lengthInCm" | "priceInCents" | "billingType" | "billingInterval" | "stripeProductId" | "variantOptions">;
|
|
123
126
|
};
|
|
124
127
|
interface LineItem {
|
|
125
128
|
quantity: number;
|
|
@@ -363,4 +366,4 @@ declare function createStoreHelpers(config?: {
|
|
|
363
366
|
proxy?: string;
|
|
364
367
|
}): Helpers;
|
|
365
368
|
|
|
366
|
-
export { type Address, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Collection, type CollectionWithProducts, 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 };
|
|
369
|
+
export { type Address, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Collection, type CollectionWithProducts, type Currency, type Customer$1 as Customer, type CustomerCreateParams, type CustomerUpdateParams, type LineItem, type LineItemCreate, type Product, type ProductBillingType, type ProductOption, type ProductStatus, type ProductVariant, type ProductWithoutVariants, type ShippingRate, type VariantOption, createStoreClient, createStoreHelpers, createBetterStore as default };
|
package/dist/index.js
CHANGED
|
@@ -1,27 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
10
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
8
|
var __export = (target, all) => {
|
|
26
9
|
for (var name in all)
|
|
27
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -67,7 +50,6 @@ var __async = (__this, __arguments, generator) => {
|
|
|
67
50
|
// src/index.ts
|
|
68
51
|
var index_exports = {};
|
|
69
52
|
__export(index_exports, {
|
|
70
|
-
ProductStatus: () => ProductStatus,
|
|
71
53
|
createStoreClient: () => createStoreClient,
|
|
72
54
|
createStoreHelpers: () => createStoreHelpers,
|
|
73
55
|
default: () => createBetterStore
|
|
@@ -128,14 +110,9 @@ var Checkout = class {
|
|
|
128
110
|
*/
|
|
129
111
|
create(params) {
|
|
130
112
|
return __async(this, null, function* () {
|
|
131
|
-
const formattedParams = __spreadProps(__spreadValues({}, params), {
|
|
132
|
-
lineItems: params.lineItems.map((item) => __spreadProps(__spreadValues({}, item), {
|
|
133
|
-
metadata: JSON.stringify(item.metadata)
|
|
134
|
-
}))
|
|
135
|
-
});
|
|
136
113
|
const data = yield this.apiClient.post(
|
|
137
114
|
"/checkout",
|
|
138
|
-
|
|
115
|
+
params
|
|
139
116
|
);
|
|
140
117
|
return data;
|
|
141
118
|
});
|
|
@@ -561,14 +538,6 @@ var Products = class {
|
|
|
561
538
|
};
|
|
562
539
|
var products_default = Products;
|
|
563
540
|
|
|
564
|
-
// src/products/types.ts
|
|
565
|
-
var ProductStatus = /* @__PURE__ */ ((ProductStatus2) => {
|
|
566
|
-
ProductStatus2["DRAFT"] = "DRAFT";
|
|
567
|
-
ProductStatus2["ACTIVE"] = "ACTIVE";
|
|
568
|
-
ProductStatus2["ARCHIVED"] = "ARCHIVED";
|
|
569
|
-
return ProductStatus2;
|
|
570
|
-
})(ProductStatus || {});
|
|
571
|
-
|
|
572
541
|
// src/index.ts
|
|
573
542
|
function createBetterStore(config) {
|
|
574
543
|
if (!config.apiKey) {
|
|
@@ -588,7 +557,6 @@ function createStoreHelpers(config) {
|
|
|
588
557
|
}
|
|
589
558
|
// Annotate the CommonJS export names for ESM import in node:
|
|
590
559
|
0 && (module.exports = {
|
|
591
|
-
ProductStatus,
|
|
592
560
|
createStoreClient,
|
|
593
561
|
createStoreHelpers
|
|
594
562
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
1
|
var __async = (__this, __arguments, generator) => {
|
|
21
2
|
return new Promise((resolve, reject) => {
|
|
22
3
|
var fulfilled = (value) => {
|
|
@@ -92,14 +73,9 @@ var Checkout = class {
|
|
|
92
73
|
*/
|
|
93
74
|
create(params) {
|
|
94
75
|
return __async(this, null, function* () {
|
|
95
|
-
const formattedParams = __spreadProps(__spreadValues({}, params), {
|
|
96
|
-
lineItems: params.lineItems.map((item) => __spreadProps(__spreadValues({}, item), {
|
|
97
|
-
metadata: JSON.stringify(item.metadata)
|
|
98
|
-
}))
|
|
99
|
-
});
|
|
100
76
|
const data = yield this.apiClient.post(
|
|
101
77
|
"/checkout",
|
|
102
|
-
|
|
78
|
+
params
|
|
103
79
|
);
|
|
104
80
|
return data;
|
|
105
81
|
});
|
|
@@ -525,14 +501,6 @@ var Products = class {
|
|
|
525
501
|
};
|
|
526
502
|
var products_default = Products;
|
|
527
503
|
|
|
528
|
-
// src/products/types.ts
|
|
529
|
-
var ProductStatus = /* @__PURE__ */ ((ProductStatus2) => {
|
|
530
|
-
ProductStatus2["DRAFT"] = "DRAFT";
|
|
531
|
-
ProductStatus2["ACTIVE"] = "ACTIVE";
|
|
532
|
-
ProductStatus2["ARCHIVED"] = "ARCHIVED";
|
|
533
|
-
return ProductStatus2;
|
|
534
|
-
})(ProductStatus || {});
|
|
535
|
-
|
|
536
504
|
// src/index.ts
|
|
537
505
|
function createBetterStore(config) {
|
|
538
506
|
if (!config.apiKey) {
|
|
@@ -551,7 +519,6 @@ function createStoreHelpers(config) {
|
|
|
551
519
|
return new helpers_default(config == null ? void 0 : config.proxy);
|
|
552
520
|
}
|
|
553
521
|
export {
|
|
554
|
-
ProductStatus,
|
|
555
522
|
createStoreClient,
|
|
556
523
|
createStoreHelpers,
|
|
557
524
|
createBetterStore as default
|