@betterstore/sdk 0.1.0 → 0.1.1

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.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - readme changed, checkout types changed
8
+
3
9
  ## 0.1.0
4
10
 
5
11
  ### Minor Changes
package/README.md CHANGED
@@ -1,38 +1,29 @@
1
1
  # Better Store SDK
2
2
 
3
- 🚀 **Better Store SDK** is a modern, developer-friendly eCommerce toolkit designed to help developers build flexible and powerful online stores with ease.
4
-
5
- ## ✨ Features
6
-
7
- - 🛒 **Custom Checkout** – Build checkout flows that suit your business needs.
8
- - 💳 **Payments** – Integrate with Stripe, PayPal, and custom gateways.
9
- - 📦 **Product & Order Management** – API-driven store management.
10
- - 🎨 **Customizable UI** – Prebuilt components and themes.
11
- - 📡 **Webhooks & API Events** – Extend and automate eCommerce operations.
12
- - 🚀 **Optimized for DX** – Built with TypeScript and fully documented.
3
+ 🚀 **Better Store SDK** is a modern, developer-friendly sdk toolkit designed to help developers build flexible and powerful e-commerce stores with ease.
13
4
 
14
5
  ## 📦 Installation
15
6
 
16
7
  ```sh
17
- npm install better-store-sdk
8
+ npm install @betterstore/sdk
18
9
  ```
19
10
 
20
11
  ## 🚀 Quick Start
21
12
 
22
13
  ```javascript
23
- import { BetterStore } from "better-store-sdk";
14
+ import { BetterStore } from "@betterstore/sdk";
24
15
 
25
- const store = new BetterStore({ apiKey: "YOUR_API_KEY" });
16
+ const betterStore = new BetterStore("YOUR_API_KEY");
26
17
 
27
- store.checkout.start({
28
- cart: [{ id: "prod_1", name: "T-Shirt", price: 20 }],
29
- currency: "USD",
18
+ betterStore.checkout.create({
19
+ type: "hosted",
20
+ lineItems: [{ productId: "example_id", quantity: 1 }],
30
21
  });
31
22
  ```
32
23
 
33
24
  ## 📚 Documentation
34
25
 
35
- Full documentation is available at **[betterstore.dev](https://betterstore.dev)**.
26
+ Full documentation is available at **[betterstore.io](https://betterstore.io)**.
36
27
 
37
28
  ## 🤝 Contributing
38
29
 
package/dist/index.d.mts CHANGED
@@ -5,9 +5,9 @@ interface BaseCheckoutParams {
5
5
  name: string;
6
6
  value: string;
7
7
  }[];
8
- quantity: number;
8
+ quantity?: number;
9
9
  }[];
10
- discount: string;
10
+ discount?: string;
11
11
  }
12
12
  interface HostedCheckoutParams extends BaseCheckoutParams {
13
13
  type: "hosted";
package/dist/index.d.ts CHANGED
@@ -5,9 +5,9 @@ interface BaseCheckoutParams {
5
5
  name: string;
6
6
  value: string;
7
7
  }[];
8
- quantity: number;
8
+ quantity?: number;
9
9
  }[];
10
- discount: string;
10
+ discount?: string;
11
11
  }
12
12
  interface HostedCheckoutParams extends BaseCheckoutParams {
13
13
  type: "hosted";
package/dist/index.js CHANGED
@@ -69,9 +69,10 @@ var Checkout = class {
69
69
  create(params) {
70
70
  return __async(this, null, function* () {
71
71
  const lineItems = params.line_items.map((item) => {
72
- var _a;
72
+ var _a, _b;
73
73
  return __spreadProps(__spreadValues({}, item), {
74
- variant_options: (_a = item.variantOptions) != null ? _a : []
74
+ quantity: ((_a = item.quantity) != null ? _a : 1) > 0 ? item.quantity : 1,
75
+ variant_options: (_b = item.variantOptions) != null ? _b : []
75
76
  });
76
77
  });
77
78
  const response = yield fetch("https://betterstore.io/api/checkout", {
package/dist/index.mjs CHANGED
@@ -46,9 +46,10 @@ var Checkout = class {
46
46
  create(params) {
47
47
  return __async(this, null, function* () {
48
48
  const lineItems = params.line_items.map((item) => {
49
- var _a;
49
+ var _a, _b;
50
50
  return __spreadProps(__spreadValues({}, item), {
51
- variant_options: (_a = item.variantOptions) != null ? _a : []
51
+ quantity: ((_a = item.quantity) != null ? _a : 1) > 0 ? item.quantity : 1,
52
+ variant_options: (_b = item.variantOptions) != null ? _b : []
52
53
  });
53
54
  });
54
55
  const response = yield fetch("https://betterstore.io/api/checkout", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betterstore/sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "E-commerce for Developers",
5
5
  "private": false,
6
6
  "publishConfig": {