@betterstore/sdk 0.3.36 → 0.3.37

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,11 @@
1
1
  # @betterstore/sdk
2
2
 
3
+ ## 0.3.37
4
+
5
+ ### Patch Changes
6
+
7
+ - metadata as record
8
+
3
9
  ## 0.3.36
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -111,8 +111,9 @@ interface LineItem {
111
111
  };
112
112
  metadata?: string;
113
113
  }
114
- interface LineItemCreate extends Omit<LineItem, "product"> {
114
+ interface LineItemCreate extends Omit<LineItem, "product" | "metadata"> {
115
115
  product?: Pick<Product, "title" | "priceInCents" | "images">;
116
+ metadata?: RecursiveRecord;
116
117
  }
117
118
  type Currency = string;
118
119
  interface CheckoutCreateParams {
@@ -151,6 +152,9 @@ interface CheckoutSession {
151
152
  email?: string;
152
153
  };
153
154
  }
155
+ type RecursiveRecord = {
156
+ [key: string]: string | number | boolean | null | RecursiveRecord | RecursiveRecord[];
157
+ };
154
158
 
155
159
  declare class Checkout {
156
160
  private apiClient;
package/dist/index.d.ts CHANGED
@@ -111,8 +111,9 @@ interface LineItem {
111
111
  };
112
112
  metadata?: string;
113
113
  }
114
- interface LineItemCreate extends Omit<LineItem, "product"> {
114
+ interface LineItemCreate extends Omit<LineItem, "product" | "metadata"> {
115
115
  product?: Pick<Product, "title" | "priceInCents" | "images">;
116
+ metadata?: RecursiveRecord;
116
117
  }
117
118
  type Currency = string;
118
119
  interface CheckoutCreateParams {
@@ -151,6 +152,9 @@ interface CheckoutSession {
151
152
  email?: string;
152
153
  };
153
154
  }
155
+ type RecursiveRecord = {
156
+ [key: string]: string | number | boolean | null | RecursiveRecord | RecursiveRecord[];
157
+ };
154
158
 
155
159
  declare class Checkout {
156
160
  private apiClient;
package/dist/index.js CHANGED
@@ -1,10 +1,27 @@
1
1
  "use strict";
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
+ var __defProps = Object.defineProperties;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
7
  var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
9
  var __getProtoOf = Object.getPrototypeOf;
7
10
  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));
8
25
  var __export = (target, all) => {
9
26
  for (var name in all)
10
27
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -111,9 +128,14 @@ var Checkout = class {
111
128
  */
112
129
  create(params) {
113
130
  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
+ });
114
136
  const data = yield this.apiClient.post(
115
137
  "/checkout",
116
- params
138
+ formattedParams
117
139
  );
118
140
  return data;
119
141
  });
package/dist/index.mjs CHANGED
@@ -1,3 +1,22 @@
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));
1
20
  var __async = (__this, __arguments, generator) => {
2
21
  return new Promise((resolve, reject) => {
3
22
  var fulfilled = (value) => {
@@ -73,9 +92,14 @@ var Checkout = class {
73
92
  */
74
93
  create(params) {
75
94
  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
+ });
76
100
  const data = yield this.apiClient.post(
77
101
  "/checkout",
78
- params
102
+ formattedParams
79
103
  );
80
104
  return data;
81
105
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betterstore/sdk",
3
- "version": "0.3.36",
3
+ "version": "0.3.37",
4
4
  "description": "E-commerce for Developers",
5
5
  "private": false,
6
6
  "publishConfig": {