@betterstore/react 0.1.10 → 0.2.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 +18 -0
- package/dist/components/checkout-embed/index.d.ts +1 -3
- package/dist/index.cjs.js +4 -3
- package/dist/index.mjs +4 -3
- package/package.json +3 -4
- package/rollup.config.mjs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @betterstore/sdk
|
|
2
2
|
|
|
3
|
+
## 0.2.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- next.js route handler removed
|
|
8
|
+
|
|
9
|
+
## 0.2.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- types fix
|
|
14
|
+
|
|
15
|
+
## 0.2.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- route handler for next.js
|
|
20
|
+
|
|
3
21
|
## 0.1.10
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import BetterStore from "@betterstore/sdk";
|
|
2
1
|
import React from "react";
|
|
3
|
-
declare function CheckoutEmbed({
|
|
4
|
-
betterStore: InstanceType<typeof BetterStore>;
|
|
2
|
+
declare function CheckoutEmbed({ checkoutId }: {
|
|
5
3
|
checkoutId: string;
|
|
6
4
|
}): React.JSX.Element;
|
|
7
5
|
declare const _default: React.MemoExoticComponent<typeof CheckoutEmbed>;
|
package/dist/index.cjs.js
CHANGED
|
@@ -315,14 +315,15 @@ function CheckoutSummary({ lineItems, shipping, tax, currency, }) {
|
|
|
315
315
|
React.createElement("span", { className: "text-2xl font-bold" }, formatPrice(total)))))));
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
-
function CheckoutEmbed({
|
|
318
|
+
function CheckoutEmbed({ checkoutId }) {
|
|
319
319
|
const [checkout, setCheckout] = React.useState(null);
|
|
320
320
|
const [loading, setLoading] = React.useState(true);
|
|
321
321
|
React.useEffect(() => {
|
|
322
322
|
function fetchCheckout() {
|
|
323
323
|
return __awaiter(this, void 0, void 0, function* () {
|
|
324
324
|
try {
|
|
325
|
-
const
|
|
325
|
+
const response = yield fetch(`/api/betterstore/checkout?checkoutId=${checkoutId}`);
|
|
326
|
+
const data = yield response.json();
|
|
326
327
|
setCheckout(data);
|
|
327
328
|
}
|
|
328
329
|
catch (error) {
|
|
@@ -334,7 +335,7 @@ function CheckoutEmbed({ betterStore, checkoutId, }) {
|
|
|
334
335
|
});
|
|
335
336
|
}
|
|
336
337
|
fetchCheckout();
|
|
337
|
-
}, [
|
|
338
|
+
}, [checkoutId]);
|
|
338
339
|
if (loading) {
|
|
339
340
|
return React.createElement("div", null, "Loading...");
|
|
340
341
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -313,14 +313,15 @@ function CheckoutSummary({ lineItems, shipping, tax, currency, }) {
|
|
|
313
313
|
React.createElement("span", { className: "text-2xl font-bold" }, formatPrice(total)))))));
|
|
314
314
|
}
|
|
315
315
|
|
|
316
|
-
function CheckoutEmbed({
|
|
316
|
+
function CheckoutEmbed({ checkoutId }) {
|
|
317
317
|
const [checkout, setCheckout] = useState(null);
|
|
318
318
|
const [loading, setLoading] = useState(true);
|
|
319
319
|
useEffect(() => {
|
|
320
320
|
function fetchCheckout() {
|
|
321
321
|
return __awaiter(this, void 0, void 0, function* () {
|
|
322
322
|
try {
|
|
323
|
-
const
|
|
323
|
+
const response = yield fetch(`/api/betterstore/checkout?checkoutId=${checkoutId}`);
|
|
324
|
+
const data = yield response.json();
|
|
324
325
|
setCheckout(data);
|
|
325
326
|
}
|
|
326
327
|
catch (error) {
|
|
@@ -332,7 +333,7 @@ function CheckoutEmbed({ betterStore, checkoutId, }) {
|
|
|
332
333
|
});
|
|
333
334
|
}
|
|
334
335
|
fetchCheckout();
|
|
335
|
-
}, [
|
|
336
|
+
}, [checkoutId]);
|
|
336
337
|
if (loading) {
|
|
337
338
|
return React.createElement("div", null, "Loading...");
|
|
338
339
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@betterstore/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "E-commerce for Developers",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"author": "Better Store",
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"devDependencies": {
|
|
22
|
+
"@betterstore/sdk": "^0.2.1",
|
|
22
23
|
"@changesets/cli": "^2.28.1",
|
|
23
|
-
"@rollup/plugin-babel": "^6.0.4",
|
|
24
24
|
"@rollup/plugin-commonjs": "^28.0.2",
|
|
25
25
|
"@rollup/plugin-node-resolve": "^16.0.0",
|
|
26
26
|
"@rollup/plugin-typescript": "^12.1.2",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@types/react": "^18.0.0",
|
|
29
29
|
"@types/react-dom": "^18.2.0",
|
|
30
30
|
"autoprefixer": "^10.4.20",
|
|
31
|
-
"
|
|
31
|
+
"next": "^15.2.1",
|
|
32
32
|
"postcss": "^8.4.31",
|
|
33
33
|
"prettier": "^3.5.3",
|
|
34
34
|
"rollup": "^4.34.9",
|
|
@@ -42,7 +42,6 @@
|
|
|
42
42
|
"react-dom": "^18.0.0"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@betterstore/sdk": "^0.2.0",
|
|
46
45
|
"@stripe/react-stripe-js": "^3.3.0",
|
|
47
46
|
"@stripe/stripe-js": "^5.10.0",
|
|
48
47
|
"rollup-plugin-postcss": "^4.0.2",
|