@betterstore/sdk 0.2.3 → 0.2.7

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,29 @@
1
1
  # @betterstore/sdk
2
2
 
3
+ ## 0.2.7
4
+
5
+ ### Patch Changes
6
+
7
+ - cicd test
8
+
9
+ ## 0.2.6
10
+
11
+ ### Patch Changes
12
+
13
+ - adding a changeset
14
+
15
+ ## 0.2.5
16
+
17
+ ### Patch Changes
18
+
19
+ - react helpers
20
+
21
+ ## 0.2.4
22
+
23
+ ### Patch Changes
24
+
25
+ - test cicd
26
+
3
27
  ## 0.2.3
4
28
 
5
29
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -203,6 +203,12 @@ declare class Products {
203
203
  retrieve(productId: string): Promise<Product>;
204
204
  }
205
205
 
206
+ declare function getCheckoutEmbedProps(betterStore: BetterStore): {
207
+ retrieveCheckout: (idOrSecret: string) => Promise<CheckoutSession>;
208
+ updateCheckout: (checkoutId: string, params: CheckoutUpdateParams) => Promise<CheckoutSession>;
209
+ getShippingRates: (checkoutId: string) => Promise<ShippingRate[]>;
210
+ };
211
+
206
212
  type NextjsRouteConfig = {
207
213
  apiKey?: string;
208
214
  productionAllowedOrigins?: string[];
@@ -222,4 +228,4 @@ declare class BetterStore {
222
228
  constructor(apiKey: string);
223
229
  }
224
230
 
225
- export { createNextJSHandler, BetterStore as default };
231
+ export { createNextJSHandler, BetterStore as default, getCheckoutEmbedProps };
package/dist/index.d.ts CHANGED
@@ -203,6 +203,12 @@ declare class Products {
203
203
  retrieve(productId: string): Promise<Product>;
204
204
  }
205
205
 
206
+ declare function getCheckoutEmbedProps(betterStore: BetterStore): {
207
+ retrieveCheckout: (idOrSecret: string) => Promise<CheckoutSession>;
208
+ updateCheckout: (checkoutId: string, params: CheckoutUpdateParams) => Promise<CheckoutSession>;
209
+ getShippingRates: (checkoutId: string) => Promise<ShippingRate[]>;
210
+ };
211
+
206
212
  type NextjsRouteConfig = {
207
213
  apiKey?: string;
208
214
  productionAllowedOrigins?: string[];
@@ -222,4 +228,4 @@ declare class BetterStore {
222
228
  constructor(apiKey: string);
223
229
  }
224
230
 
225
- export { createNextJSHandler, BetterStore as default };
231
+ export { createNextJSHandler, BetterStore as default, getCheckoutEmbedProps };
package/dist/index.js CHANGED
@@ -51,7 +51,8 @@ var __async = (__this, __arguments, generator) => {
51
51
  var index_exports = {};
52
52
  __export(index_exports, {
53
53
  createNextJSHandler: () => createNextJSHandler,
54
- default: () => index_default
54
+ default: () => index_default,
55
+ getCheckoutEmbedProps: () => getCheckoutEmbedProps
55
56
  });
56
57
  module.exports = __toCommonJS(index_exports);
57
58
 
@@ -231,6 +232,15 @@ var Products = class {
231
232
  };
232
233
  var products_default = Products;
233
234
 
235
+ // src/helpers/react.ts
236
+ function getCheckoutEmbedProps(betterStore) {
237
+ return {
238
+ retrieveCheckout: betterStore.checkout.retrieve,
239
+ updateCheckout: betterStore.checkout.update,
240
+ getShippingRates: betterStore.checkout.getShippingRates
241
+ };
242
+ }
243
+
234
244
  // src/route-handelers/next-js.ts
235
245
  var defaultBetterStoreRoutes = {
236
246
  checkout: {
@@ -544,5 +554,6 @@ var BetterStore = class {
544
554
  var index_default = BetterStore;
545
555
  // Annotate the CommonJS export names for ESM import in node:
546
556
  0 && (module.exports = {
547
- createNextJSHandler
557
+ createNextJSHandler,
558
+ getCheckoutEmbedProps
548
559
  });
package/dist/index.mjs CHANGED
@@ -195,6 +195,15 @@ var Products = class {
195
195
  };
196
196
  var products_default = Products;
197
197
 
198
+ // src/helpers/react.ts
199
+ function getCheckoutEmbedProps(betterStore) {
200
+ return {
201
+ retrieveCheckout: betterStore.checkout.retrieve,
202
+ updateCheckout: betterStore.checkout.update,
203
+ getShippingRates: betterStore.checkout.getShippingRates
204
+ };
205
+ }
206
+
198
207
  // src/route-handelers/next-js.ts
199
208
  var defaultBetterStoreRoutes = {
200
209
  checkout: {
@@ -508,5 +517,6 @@ var BetterStore = class {
508
517
  var index_default = BetterStore;
509
518
  export {
510
519
  createNextJSHandler,
511
- index_default as default
520
+ index_default as default,
521
+ getCheckoutEmbedProps
512
522
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betterstore/sdk",
3
- "version": "0.2.3",
3
+ "version": "0.2.7",
4
4
  "description": "E-commerce for Developers",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -9,15 +9,6 @@
9
9
  "main": "dist/index.js",
10
10
  "module": "dist/index.mjs",
11
11
  "types": "dist/index.d.ts",
12
- "scripts": {
13
- "prepublish": "changeset && changeset version && git add .",
14
- "build": "tsup src/index.ts --format cjs,esm --dts",
15
- "lint": "tsc",
16
- "format:check": "prettier --check --ignore-path .prettierignore .",
17
- "format": "prettier --write --ignore-path .prettierignore .",
18
- "ci": "pnpm run lint && pnpm run format:check && pnpm run build",
19
- "release": "pnpm run ci && changeset publish"
20
- },
21
12
  "keywords": [
22
13
  "betterstore",
23
14
  "ecommerce",
@@ -36,5 +27,14 @@
36
27
  },
37
28
  "dependencies": {
38
29
  "axios": "^1.8.2"
30
+ },
31
+ "scripts": {
32
+ "prepublish": "changeset && changeset version && git add .",
33
+ "build": "tsup src/index.ts --format cjs,esm --dts",
34
+ "lint": "tsc",
35
+ "format:check": "prettier --check --ignore-path .prettierignore .",
36
+ "format": "prettier --write --ignore-path .prettierignore .",
37
+ "ci": "pnpm run lint && pnpm run format:check && pnpm run build",
38
+ "release": "pnpm run ci && changeset publish"
39
39
  }
40
- }
40
+ }