@betterstore/react 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 +6 -0
- package/dist/checkout-embed/index.d.ts +6 -0
- package/dist/checkout-embed/summary/index.d.ts +8 -0
- package/dist/index.cjs.js +88 -32
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +88 -33
- package/package.json +8 -1
- package/postcss.config.js +6 -0
- package/rollup.config.mjs +12 -1
- package/tailwind.config.js +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -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;
|
package/dist/index.cjs.js
CHANGED
|
@@ -2,6 +2,93 @@
|
|
|
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(_a) {
|
|
80
|
+
return __awaiter(this, arguments, void 0, function* ({ betterStore, checkoutId, }) {
|
|
81
|
+
const checkout = yield betterStore.checkout.retrieve(checkoutId);
|
|
82
|
+
if (!checkout) {
|
|
83
|
+
return React.createElement("div", null, "Checkout not found");
|
|
84
|
+
}
|
|
85
|
+
return (React.createElement("div", { className: "grid md:grid-cols-2 gap-4" },
|
|
86
|
+
React.createElement("div", null, "forms heres"),
|
|
87
|
+
React.createElement("div", null,
|
|
88
|
+
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 }))));
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
5
92
|
function getDefaultExportFromCjs (x) {
|
|
6
93
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
7
94
|
}
|
|
@@ -2109,38 +2196,6 @@ var loadStripe = function loadStripe() {
|
|
|
2109
2196
|
});
|
|
2110
2197
|
};
|
|
2111
2198
|
|
|
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
2199
|
const createStoreImpl = (createState) => {
|
|
2145
2200
|
let state;
|
|
2146
2201
|
const listeners = /* @__PURE__ */ new Set();
|
|
@@ -2232,5 +2287,6 @@ function PaymentElement({ paymentSecret, checkoutAppearance, onSuccess, onError,
|
|
|
2232
2287
|
}
|
|
2233
2288
|
var paymentElement = React.memo(PaymentElement);
|
|
2234
2289
|
|
|
2290
|
+
exports.CheckoutEmbed = CheckoutEmbed;
|
|
2235
2291
|
exports.PaymentElement = paymentElement;
|
|
2236
2292
|
exports.useCheckout = useCheckout;
|
package/dist/index.d.ts
CHANGED
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,92 @@
|
|
|
1
1
|
import React, { memo, useState } from 'react';
|
|
2
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(_a) {
|
|
78
|
+
return __awaiter(this, arguments, void 0, function* ({ betterStore, checkoutId, }) {
|
|
79
|
+
const checkout = yield betterStore.checkout.retrieve(checkoutId);
|
|
80
|
+
if (!checkout) {
|
|
81
|
+
return React.createElement("div", null, "Checkout not found");
|
|
82
|
+
}
|
|
83
|
+
return (React.createElement("div", { className: "grid md:grid-cols-2 gap-4" },
|
|
84
|
+
React.createElement("div", null, "forms heres"),
|
|
85
|
+
React.createElement("div", null,
|
|
86
|
+
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 }))));
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
3
90
|
function getDefaultExportFromCjs (x) {
|
|
4
91
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
5
92
|
}
|
|
@@ -2107,38 +2194,6 @@ var loadStripe = function loadStripe() {
|
|
|
2107
2194
|
});
|
|
2108
2195
|
};
|
|
2109
2196
|
|
|
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
2197
|
const createStoreImpl = (createState) => {
|
|
2143
2198
|
let state;
|
|
2144
2199
|
const listeners = /* @__PURE__ */ new Set();
|
|
@@ -2230,4 +2285,4 @@ function PaymentElement({ paymentSecret, checkoutAppearance, onSuccess, onError,
|
|
|
2230
2285
|
}
|
|
2231
2286
|
var paymentElement = memo(PaymentElement);
|
|
2232
2287
|
|
|
2233
|
-
export { paymentElement as PaymentElement, useCheckout };
|
|
2288
|
+
export { CheckoutEmbed, paymentElement as PaymentElement, useCheckout };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@betterstore/react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
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": {
|
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: [
|
|
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
|
};
|