@betterstore/sdk 0.3.39 → 0.3.41

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @betterstore/sdk
2
2
 
3
+ ## 0.3.41
4
+
5
+ ### Patch Changes
6
+
7
+ - new product items logic update
8
+
9
+ ## 0.3.40
10
+
11
+ ### Patch Changes
12
+
13
+ - bug type fix
14
+
3
15
  ## 0.3.39
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -41,11 +41,12 @@ interface VariantOption {
41
41
  interface ProductVariant {
42
42
  sku: string;
43
43
  images: string[];
44
- stockAvailable: number;
45
- stockCommited: number;
46
- stockUnavailable: number;
44
+ isPhysical: boolean;
45
+ weightInGrams?: number;
46
+ heightInCm?: number;
47
+ widthInCm?: number;
48
+ lengthInCm?: number;
47
49
  priceInCents: number;
48
- productId: string;
49
50
  variantOptions: VariantOption[];
50
51
  }
51
52
  interface ProductOption {
@@ -91,24 +92,17 @@ interface ZasilkovnaRate extends BaseRate {
91
92
  clientSecret: string;
92
93
  }
93
94
 
95
+ type ProductData = Pick<Product, "title" | "description" | "images" | "category" | "tags" | "isPhysical" | "weightInGrams" | "heightInCm" | "widthInCm" | "lengthInCm" | "priceInCents"> & {
96
+ selectedVariant: Pick<ProductVariant, "sku" | "images" | "isPhysical" | "weightInGrams" | "heightInCm" | "widthInCm" | "lengthInCm" | "priceInCents" | "variantOptions">;
97
+ };
94
98
  interface LineItem {
95
99
  quantity: number;
96
- productId: string;
97
100
  variantOptions: {
98
101
  name: string;
99
102
  value: string;
100
103
  }[];
101
104
  discountId?: string;
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
- };
105
+ product: ProductData;
112
106
  metadata?: string;
113
107
  }
114
108
  interface LineItemCreate extends Omit<LineItem, "product" | "metadata"> {
@@ -202,7 +196,10 @@ declare class Client {
202
196
  /**
203
197
  * Generate payment secret for a checkout session
204
198
  */
205
- generateCheckoutsPaymentSecret(clientSecret: string, checkoutId: string): Promise<string>;
199
+ generateCheckoutsPaymentSecret(clientSecret: string, checkoutId: string): Promise<{
200
+ paymentSecret: string;
201
+ publicKey: string;
202
+ }>;
206
203
  /**
207
204
  * Create a new customer
208
205
  */
package/dist/index.d.ts CHANGED
@@ -41,11 +41,12 @@ interface VariantOption {
41
41
  interface ProductVariant {
42
42
  sku: string;
43
43
  images: string[];
44
- stockAvailable: number;
45
- stockCommited: number;
46
- stockUnavailable: number;
44
+ isPhysical: boolean;
45
+ weightInGrams?: number;
46
+ heightInCm?: number;
47
+ widthInCm?: number;
48
+ lengthInCm?: number;
47
49
  priceInCents: number;
48
- productId: string;
49
50
  variantOptions: VariantOption[];
50
51
  }
51
52
  interface ProductOption {
@@ -91,24 +92,17 @@ interface ZasilkovnaRate extends BaseRate {
91
92
  clientSecret: string;
92
93
  }
93
94
 
95
+ type ProductData = Pick<Product, "title" | "description" | "images" | "category" | "tags" | "isPhysical" | "weightInGrams" | "heightInCm" | "widthInCm" | "lengthInCm" | "priceInCents"> & {
96
+ selectedVariant: Pick<ProductVariant, "sku" | "images" | "isPhysical" | "weightInGrams" | "heightInCm" | "widthInCm" | "lengthInCm" | "priceInCents" | "variantOptions">;
97
+ };
94
98
  interface LineItem {
95
99
  quantity: number;
96
- productId: string;
97
100
  variantOptions: {
98
101
  name: string;
99
102
  value: string;
100
103
  }[];
101
104
  discountId?: string;
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
- };
105
+ product: ProductData;
112
106
  metadata?: string;
113
107
  }
114
108
  interface LineItemCreate extends Omit<LineItem, "product" | "metadata"> {
@@ -202,7 +196,10 @@ declare class Client {
202
196
  /**
203
197
  * Generate payment secret for a checkout session
204
198
  */
205
- generateCheckoutsPaymentSecret(clientSecret: string, checkoutId: string): Promise<string>;
199
+ generateCheckoutsPaymentSecret(clientSecret: string, checkoutId: string): Promise<{
200
+ paymentSecret: string;
201
+ publicKey: string;
202
+ }>;
206
203
  /**
207
204
  * Create a new customer
208
205
  */
package/dist/index.js CHANGED
@@ -238,10 +238,11 @@ var Client = class {
238
238
  generateCheckoutsPaymentSecret(clientSecret, checkoutId) {
239
239
  return __async(this, null, function* () {
240
240
  const apiClient = createApiClient(clientSecret, this.proxy);
241
- const data = yield apiClient.post(
242
- `/checkout/payment/${checkoutId}`
243
- );
244
- return data;
241
+ const data = yield apiClient.post(`/checkout/payment/${checkoutId}`);
242
+ return {
243
+ paymentSecret: data.paymentSecret,
244
+ publicKey: data.publicKey
245
+ };
245
246
  });
246
247
  }
247
248
  /**
package/dist/index.mjs CHANGED
@@ -202,10 +202,11 @@ var Client = class {
202
202
  generateCheckoutsPaymentSecret(clientSecret, checkoutId) {
203
203
  return __async(this, null, function* () {
204
204
  const apiClient = createApiClient(clientSecret, this.proxy);
205
- const data = yield apiClient.post(
206
- `/checkout/payment/${checkoutId}`
207
- );
208
- return data;
205
+ const data = yield apiClient.post(`/checkout/payment/${checkoutId}`);
206
+ return {
207
+ paymentSecret: data.paymentSecret,
208
+ publicKey: data.publicKey
209
+ };
209
210
  });
210
211
  }
211
212
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betterstore/sdk",
3
- "version": "0.3.39",
3
+ "version": "0.3.41",
4
4
  "description": "E-commerce for Developers",
5
5
  "private": false,
6
6
  "publishConfig": {