@betterstore/react 0.1.0 → 0.1.2

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.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - architecture redone
8
+
9
+ ## 0.1.1
10
+
11
+ ### Patch Changes
12
+
13
+ - cicd
14
+
3
15
  ## 0.1.0
4
16
 
5
17
  ### Minor Changes
@@ -0,0 +1,8 @@
1
+ import BetterStore from "@betterstore/sdk";
2
+ import React from "react";
3
+ declare function CheckoutEmbed({ betterStore, checkoutId, }: {
4
+ betterStore: InstanceType<typeof BetterStore>;
5
+ checkoutId: string;
6
+ }): React.JSX.Element;
7
+ declare const _default: React.MemoExoticComponent<typeof CheckoutEmbed>;
8
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import BetterStore from "@betterstore/sdk";
2
+ import React from "react";
3
+ export default function CheckoutSummary({ lineItems, shipping, tax, currency, }: {
4
+ lineItems: Awaited<Awaited<ReturnType<InstanceType<typeof BetterStore>["checkout"]["retrieve"]>>["lineItems"]>;
5
+ shipping?: number;
6
+ tax?: number;
7
+ currency: string;
8
+ }): React.JSX.Element;
@@ -0,0 +1,3 @@
1
+ export { default as CheckoutEmbed } from "./checkout-embed";
2
+ export { default as PaymentElement } from "./payment-element";
3
+ export { useCheckout } from "./payment-element/useCheckout";
package/dist/index.cjs.js CHANGED
@@ -2,6 +2,113 @@
2
2
 
3
3
  var React = require('react');
4
4
 
5
+ /******************************************************************************
6
+ Copyright (c) Microsoft Corporation.
7
+
8
+ Permission to use, copy, modify, and/or distribute this software for any
9
+ purpose with or without fee is hereby granted.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
12
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
14
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
16
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17
+ PERFORMANCE OF THIS SOFTWARE.
18
+ ***************************************************************************** */
19
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
20
+
21
+
22
+ function __awaiter(thisArg, _arguments, P, generator) {
23
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
24
+ return new (P || (P = Promise))(function (resolve, reject) {
25
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
26
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
27
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
28
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
29
+ });
30
+ }
31
+
32
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
33
+ var e = new Error(message);
34
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
35
+ };
36
+
37
+ function CheckoutSummary({ lineItems, shipping, tax, currency, }) {
38
+ const subtotal = lineItems.reduce((acc, item) => {
39
+ var _a, _b;
40
+ return acc + ((_b = (_a = item.product) === null || _a === void 0 ? void 0 : _a.priceInCents) !== null && _b !== void 0 ? _b : 0) * item.quantity;
41
+ }, 0);
42
+ const total = subtotal + (tax !== null && tax !== void 0 ? tax : 0) + (shipping !== null && shipping !== void 0 ? shipping : 0);
43
+ const formatPrice = (cents) => {
44
+ return `${(cents / 100).toFixed(2)} ${currency}`;
45
+ };
46
+ return (React.createElement("div", { className: "bg-black text-white p-6 rounded-lg" },
47
+ lineItems.map((item, index) => {
48
+ var _a, _b, _c, _d, _e;
49
+ return (React.createElement("div", { key: index, className: "flex items-center mb-6" },
50
+ React.createElement("div", { className: "relative" },
51
+ React.createElement("div", { className: "w-16 h-16 bg-zinc-900 rounded-lg overflow-hidden relative" }, ((_a = item.product) === null || _a === void 0 ? void 0 : _a.images[0]) ? (React.createElement("img", { src: item.product.images[0] || "/placeholder.svg", alt: ((_b = item.product) === null || _b === void 0 ? void 0 : _b.title) || "Product image", className: "object-cover" })) : (React.createElement("div", { className: "w-full h-full flex items-center justify-center bg-zinc-800" },
52
+ React.createElement("span", { className: "text-zinc-500" }, "No image")))),
53
+ React.createElement("div", { className: "absolute -top-2 -right-2 w-6 h-6 bg-zinc-700 rounded-full flex items-center justify-center text-sm" }, item.quantity)),
54
+ React.createElement("div", { className: "ml-4 flex-1" },
55
+ React.createElement("h3", { className: "text-lg font-medium" }, ((_c = item.product) === null || _c === void 0 ? void 0 : _c.title) || "Product"),
56
+ React.createElement("p", { className: "text-zinc-400 text-sm" }, item.variantOptions.map((option) => option.name).join(" / "))),
57
+ React.createElement("div", { className: "text-right" },
58
+ React.createElement("p", { className: "text-lg font-medium" }, formatPrice((_e = (_d = item.product) === null || _d === void 0 ? void 0 : _d.priceInCents) !== null && _e !== void 0 ? _e : 0)))));
59
+ }),
60
+ React.createElement("div", { className: "border-t border-zinc-800 pt-4 mt-2" },
61
+ React.createElement("div", { className: "flex justify-between py-2" },
62
+ React.createElement("span", { className: "text-lg" }, "Subtotal"),
63
+ React.createElement("span", { className: "text-lg" }, formatPrice(subtotal))),
64
+ React.createElement("div", { className: "flex justify-between py-2" },
65
+ React.createElement("span", { className: "text-lg" }, "Shipping"),
66
+ React.createElement("span", { className: "text-zinc-400" }, shipping !== undefined
67
+ ? formatPrice(shipping)
68
+ : "Calculated at next step")),
69
+ tax !== undefined && (React.createElement("div", { className: "flex justify-between py-2" },
70
+ React.createElement("span", { className: "text-lg" }, "Tax"),
71
+ React.createElement("span", { className: "text-lg" }, formatPrice(tax)))),
72
+ React.createElement("div", { className: "flex justify-between py-4 mt-2 border-t border-zinc-800 items-center" },
73
+ React.createElement("span", { className: "text-2xl font-bold" }, "Total"),
74
+ React.createElement("div", { className: "text-right" },
75
+ React.createElement("span", { className: "text-zinc-400 text-sm mr-2" }, currency),
76
+ React.createElement("span", { className: "text-2xl font-bold" }, formatPrice(total)))))));
77
+ }
78
+
79
+ function CheckoutEmbed({ betterStore, checkoutId, }) {
80
+ const [checkout, setCheckout] = React.useState(null);
81
+ const [loading, setLoading] = React.useState(true);
82
+ React.useEffect(() => {
83
+ function fetchCheckout() {
84
+ return __awaiter(this, void 0, void 0, function* () {
85
+ try {
86
+ const data = yield betterStore.checkout.retrieve(checkoutId);
87
+ setCheckout(data);
88
+ }
89
+ catch (error) {
90
+ console.error("Failed to fetch checkout:", error);
91
+ }
92
+ finally {
93
+ setLoading(false);
94
+ }
95
+ });
96
+ }
97
+ fetchCheckout();
98
+ }, [betterStore, checkoutId]);
99
+ if (loading) {
100
+ return React.createElement("div", null, "Loading...");
101
+ }
102
+ if (!checkout) {
103
+ return React.createElement("div", null, "Checkout not found");
104
+ }
105
+ return (React.createElement("div", { className: "grid md:grid-cols-2 gap-4" },
106
+ React.createElement("div", null, "forms here"),
107
+ React.createElement("div", null,
108
+ React.createElement(CheckoutSummary, { currency: checkout.currency, lineItems: checkout.lineItems, shipping: checkout === null || checkout === void 0 ? void 0 : checkout.shipping, tax: checkout === null || checkout === void 0 ? void 0 : checkout.tax }))));
109
+ }
110
+ var index$1 = React.memo(CheckoutEmbed);
111
+
5
112
  function getDefaultExportFromCjs (x) {
6
113
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
7
114
  }
@@ -2109,38 +2216,6 @@ var loadStripe = function loadStripe() {
2109
2216
  });
2110
2217
  };
2111
2218
 
2112
- /******************************************************************************
2113
- Copyright (c) Microsoft Corporation.
2114
-
2115
- Permission to use, copy, modify, and/or distribute this software for any
2116
- purpose with or without fee is hereby granted.
2117
-
2118
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
2119
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
2120
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
2121
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
2122
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
2123
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
2124
- PERFORMANCE OF THIS SOFTWARE.
2125
- ***************************************************************************** */
2126
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
2127
-
2128
-
2129
- function __awaiter(thisArg, _arguments, P, generator) {
2130
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
2131
- return new (P || (P = Promise))(function (resolve, reject) {
2132
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
2133
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
2134
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
2135
- step((generator = generator.apply(thisArg, _arguments || [])).next());
2136
- });
2137
- }
2138
-
2139
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
2140
- var e = new Error(message);
2141
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
2142
- };
2143
-
2144
2219
  const createStoreImpl = (createState) => {
2145
2220
  let state;
2146
2221
  const listeners = /* @__PURE__ */ new Set();
@@ -2230,7 +2305,8 @@ function PaymentElement({ paymentSecret, checkoutAppearance, onSuccess, onError,
2230
2305
  return (React.createElement(Elements, { stripe: stripePromise, options: options },
2231
2306
  React.createElement(CheckoutForm$1, { onSuccess: onSuccess, onError: onError, children: children })));
2232
2307
  }
2233
- var paymentElement = React.memo(PaymentElement);
2308
+ var index = React.memo(PaymentElement);
2234
2309
 
2235
- exports.PaymentElement = paymentElement;
2310
+ exports.CheckoutEmbed = index$1;
2311
+ exports.PaymentElement = index;
2236
2312
  exports.useCheckout = useCheckout;
package/dist/index.d.ts CHANGED
@@ -1,2 +1 @@
1
- export { default as PaymentElement } from "./checkout/payment-element";
2
- export { useCheckout } from "./checkout/useCheckout";
1
+ export * from "./components";
package/dist/index.esm.js CHANGED
@@ -1,4 +1,111 @@
1
- import React, { memo, useState } from 'react';
1
+ import React, { memo, useState, useEffect } from 'react';
2
+
3
+ /******************************************************************************
4
+ Copyright (c) Microsoft Corporation.
5
+
6
+ Permission to use, copy, modify, and/or distribute this software for any
7
+ purpose with or without fee is hereby granted.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
+ PERFORMANCE OF THIS SOFTWARE.
16
+ ***************************************************************************** */
17
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
18
+
19
+
20
+ function __awaiter(thisArg, _arguments, P, generator) {
21
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
22
+ return new (P || (P = Promise))(function (resolve, reject) {
23
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
24
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
25
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
26
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
27
+ });
28
+ }
29
+
30
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
31
+ var e = new Error(message);
32
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
33
+ };
34
+
35
+ function CheckoutSummary({ lineItems, shipping, tax, currency, }) {
36
+ const subtotal = lineItems.reduce((acc, item) => {
37
+ var _a, _b;
38
+ return acc + ((_b = (_a = item.product) === null || _a === void 0 ? void 0 : _a.priceInCents) !== null && _b !== void 0 ? _b : 0) * item.quantity;
39
+ }, 0);
40
+ const total = subtotal + (tax !== null && tax !== void 0 ? tax : 0) + (shipping !== null && shipping !== void 0 ? shipping : 0);
41
+ const formatPrice = (cents) => {
42
+ return `${(cents / 100).toFixed(2)} ${currency}`;
43
+ };
44
+ return (React.createElement("div", { className: "bg-black text-white p-6 rounded-lg" },
45
+ lineItems.map((item, index) => {
46
+ var _a, _b, _c, _d, _e;
47
+ return (React.createElement("div", { key: index, className: "flex items-center mb-6" },
48
+ React.createElement("div", { className: "relative" },
49
+ React.createElement("div", { className: "w-16 h-16 bg-zinc-900 rounded-lg overflow-hidden relative" }, ((_a = item.product) === null || _a === void 0 ? void 0 : _a.images[0]) ? (React.createElement("img", { src: item.product.images[0] || "/placeholder.svg", alt: ((_b = item.product) === null || _b === void 0 ? void 0 : _b.title) || "Product image", className: "object-cover" })) : (React.createElement("div", { className: "w-full h-full flex items-center justify-center bg-zinc-800" },
50
+ React.createElement("span", { className: "text-zinc-500" }, "No image")))),
51
+ React.createElement("div", { className: "absolute -top-2 -right-2 w-6 h-6 bg-zinc-700 rounded-full flex items-center justify-center text-sm" }, item.quantity)),
52
+ React.createElement("div", { className: "ml-4 flex-1" },
53
+ React.createElement("h3", { className: "text-lg font-medium" }, ((_c = item.product) === null || _c === void 0 ? void 0 : _c.title) || "Product"),
54
+ React.createElement("p", { className: "text-zinc-400 text-sm" }, item.variantOptions.map((option) => option.name).join(" / "))),
55
+ React.createElement("div", { className: "text-right" },
56
+ React.createElement("p", { className: "text-lg font-medium" }, formatPrice((_e = (_d = item.product) === null || _d === void 0 ? void 0 : _d.priceInCents) !== null && _e !== void 0 ? _e : 0)))));
57
+ }),
58
+ React.createElement("div", { className: "border-t border-zinc-800 pt-4 mt-2" },
59
+ React.createElement("div", { className: "flex justify-between py-2" },
60
+ React.createElement("span", { className: "text-lg" }, "Subtotal"),
61
+ React.createElement("span", { className: "text-lg" }, formatPrice(subtotal))),
62
+ React.createElement("div", { className: "flex justify-between py-2" },
63
+ React.createElement("span", { className: "text-lg" }, "Shipping"),
64
+ React.createElement("span", { className: "text-zinc-400" }, shipping !== undefined
65
+ ? formatPrice(shipping)
66
+ : "Calculated at next step")),
67
+ tax !== undefined && (React.createElement("div", { className: "flex justify-between py-2" },
68
+ React.createElement("span", { className: "text-lg" }, "Tax"),
69
+ React.createElement("span", { className: "text-lg" }, formatPrice(tax)))),
70
+ React.createElement("div", { className: "flex justify-between py-4 mt-2 border-t border-zinc-800 items-center" },
71
+ React.createElement("span", { className: "text-2xl font-bold" }, "Total"),
72
+ React.createElement("div", { className: "text-right" },
73
+ React.createElement("span", { className: "text-zinc-400 text-sm mr-2" }, currency),
74
+ React.createElement("span", { className: "text-2xl font-bold" }, formatPrice(total)))))));
75
+ }
76
+
77
+ function CheckoutEmbed({ betterStore, checkoutId, }) {
78
+ const [checkout, setCheckout] = useState(null);
79
+ const [loading, setLoading] = useState(true);
80
+ useEffect(() => {
81
+ function fetchCheckout() {
82
+ return __awaiter(this, void 0, void 0, function* () {
83
+ try {
84
+ const data = yield betterStore.checkout.retrieve(checkoutId);
85
+ setCheckout(data);
86
+ }
87
+ catch (error) {
88
+ console.error("Failed to fetch checkout:", error);
89
+ }
90
+ finally {
91
+ setLoading(false);
92
+ }
93
+ });
94
+ }
95
+ fetchCheckout();
96
+ }, [betterStore, checkoutId]);
97
+ if (loading) {
98
+ return React.createElement("div", null, "Loading...");
99
+ }
100
+ if (!checkout) {
101
+ return React.createElement("div", null, "Checkout not found");
102
+ }
103
+ return (React.createElement("div", { className: "grid md:grid-cols-2 gap-4" },
104
+ React.createElement("div", null, "forms here"),
105
+ React.createElement("div", null,
106
+ React.createElement(CheckoutSummary, { currency: checkout.currency, lineItems: checkout.lineItems, shipping: checkout === null || checkout === void 0 ? void 0 : checkout.shipping, tax: checkout === null || checkout === void 0 ? void 0 : checkout.tax }))));
107
+ }
108
+ var index$1 = memo(CheckoutEmbed);
2
109
 
3
110
  function getDefaultExportFromCjs (x) {
4
111
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
@@ -2107,38 +2214,6 @@ var loadStripe = function loadStripe() {
2107
2214
  });
2108
2215
  };
2109
2216
 
2110
- /******************************************************************************
2111
- Copyright (c) Microsoft Corporation.
2112
-
2113
- Permission to use, copy, modify, and/or distribute this software for any
2114
- purpose with or without fee is hereby granted.
2115
-
2116
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
2117
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
2118
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
2119
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
2120
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
2121
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
2122
- PERFORMANCE OF THIS SOFTWARE.
2123
- ***************************************************************************** */
2124
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
2125
-
2126
-
2127
- function __awaiter(thisArg, _arguments, P, generator) {
2128
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
2129
- return new (P || (P = Promise))(function (resolve, reject) {
2130
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
2131
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
2132
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
2133
- step((generator = generator.apply(thisArg, _arguments || [])).next());
2134
- });
2135
- }
2136
-
2137
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
2138
- var e = new Error(message);
2139
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
2140
- };
2141
-
2142
2217
  const createStoreImpl = (createState) => {
2143
2218
  let state;
2144
2219
  const listeners = /* @__PURE__ */ new Set();
@@ -2228,6 +2303,6 @@ function PaymentElement({ paymentSecret, checkoutAppearance, onSuccess, onError,
2228
2303
  return (React.createElement(Elements, { stripe: stripePromise, options: options },
2229
2304
  React.createElement(CheckoutForm$1, { onSuccess: onSuccess, onError: onError, children: children })));
2230
2305
  }
2231
- var paymentElement = memo(PaymentElement);
2306
+ var index = memo(PaymentElement);
2232
2307
 
2233
- export { paymentElement as PaymentElement, useCheckout };
2308
+ export { index$1 as CheckoutEmbed, index as PaymentElement, useCheckout };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betterstore/react",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "E-commerce for Developers",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -9,6 +9,7 @@
9
9
  "main": "dist/index.js",
10
10
  "module": "dist/index.mjs",
11
11
  "types": "dist/index.d.ts",
12
+ "type": "module",
12
13
  "keywords": [
13
14
  "betterstore",
14
15
  "ecommerce",
@@ -23,10 +24,14 @@
23
24
  "@rollup/plugin-commonjs": "^28.0.2",
24
25
  "@rollup/plugin-node-resolve": "^16.0.0",
25
26
  "@rollup/plugin-typescript": "^12.1.2",
27
+ "@tailwindcss/postcss": "^4.0.12",
26
28
  "@types/react": "^19.0.10",
29
+ "autoprefixer": "^10.4.20",
27
30
  "babel-preset-react": "^6.24.1",
31
+ "postcss": "^8.5.3",
28
32
  "prettier": "^3.5.3",
29
33
  "rollup": "^4.34.9",
34
+ "tailwindcss": "^4.0.12",
30
35
  "tslib": "^2.8.1",
31
36
  "tsup": "^8.4.0",
32
37
  "typescript": "^5.8.2"
@@ -36,8 +41,10 @@
36
41
  "react-dom": "^19.0.0"
37
42
  },
38
43
  "dependencies": {
44
+ "@betterstore/sdk": "^0.2.0",
39
45
  "@stripe/react-stripe-js": "^3.3.0",
40
46
  "@stripe/stripe-js": "^5.10.0",
47
+ "rollup-plugin-postcss": "^4.0.2",
41
48
  "zustand": "^5.0.3"
42
49
  },
43
50
  "scripts": {
@@ -0,0 +1,6 @@
1
+ module.exports = {
2
+ plugins: {
3
+ tailwindcss: {},
4
+ autoprefixer: {},
5
+ },
6
+ };
package/rollup.config.mjs CHANGED
@@ -1,6 +1,9 @@
1
1
  import commonjs from "@rollup/plugin-commonjs";
2
2
  import resolve from "@rollup/plugin-node-resolve";
3
3
  import typescript from "@rollup/plugin-typescript";
4
+ import tailwindcss from "@tailwindcss/postcss";
5
+ import autoprefixer from "autoprefixer";
6
+ import postcss from "rollup-plugin-postcss";
4
7
 
5
8
  export default {
6
9
  input: "src/index.ts",
@@ -14,6 +17,14 @@ export default {
14
17
  format: "esm",
15
18
  },
16
19
  ],
17
- plugins: [resolve(), commonjs(), typescript()],
20
+ plugins: [
21
+ resolve(),
22
+ commonjs(),
23
+ typescript(),
24
+ postcss({
25
+ extensions: [".css", ".module.css"],
26
+ plugins: [tailwindcss("./tailwind.config.js"), autoprefixer()],
27
+ }),
28
+ ],
18
29
  external: ["react", "react-dom"],
19
30
  };
@@ -0,0 +1,8 @@
1
+ /** @type {import('tailwindcss').Config} */
2
+ module.exports = {
3
+ content: ["./src/**/*.tsx"],
4
+ theme: {
5
+ extend: {},
6
+ },
7
+ plugins: [],
8
+ };