@betterstore/react 0.2.8 → 0.2.13
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/.prettierignore +2 -2
- package/CHANGELOG.md +30 -0
- package/LICENSE +21 -21
- package/dist/components/checkout-embed/appearance.d.ts +24 -0
- package/dist/components/checkout-embed/checkout-form-loading.d.ts +2 -0
- package/dist/components/checkout-embed/checkout-form.d.ts +7 -3
- package/dist/components/checkout-embed/checkout-schema.d.ts +143 -72
- package/dist/components/checkout-embed/index.d.ts +12 -4
- package/dist/components/checkout-embed/steps/customer/address-input.d.ts +2 -0
- package/dist/components/checkout-embed/steps/customer/address-utils.d.ts +2 -0
- package/dist/components/checkout-embed/steps/customer/form.d.ts +8 -0
- package/dist/components/checkout-embed/steps/payment/form.d.ts +14 -0
- package/dist/components/checkout-embed/steps/shipping/form.d.ts +13 -0
- package/dist/components/checkout-embed/steps/summary/index.d.ts +9 -0
- package/dist/components/checkout-embed/steps/summary/loading.d.ts +2 -0
- package/dist/components/checkout-embed/useFormStore.d.ts +20 -0
- package/dist/components/compounds/form/country-dropdown.d.ts +22 -0
- package/dist/components/compounds/form/form-messages.d.ts +7 -0
- package/dist/components/compounds/form/input-group.d.ts +8 -0
- package/dist/components/compounds/form/submit-button.d.ts +8 -0
- package/dist/components/ui/command.d.ts +16 -0
- package/dist/components/ui/dialog.d.ts +13 -0
- package/dist/components/ui/dropdown-menu.d.ts +25 -0
- package/dist/components/ui/form.d.ts +1 -1
- package/dist/components/ui/popover.d.ts +7 -0
- package/dist/components/ui/skeleton.d.ts +3 -0
- package/dist/i18n/index.d.ts +4 -0
- package/dist/index.cjs.js +31588 -609
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +31586 -606
- package/dist/lib/betterstore.d.ts +10 -0
- package/dist/lib/error-message-utils.d.ts +4 -0
- package/dist/types.d.ts +1 -0
- package/package.json +28 -13
- package/rollup.config.mjs +39 -1
- package/dist/components/checkout-embed/customer/form.d.ts +0 -9
- package/dist/components/checkout-embed/payment/form.d.ts +0 -12
- package/dist/components/checkout-embed/shipping/form.d.ts +0 -11
- package/dist/components/checkout-embed/summary/index.d.ts +0 -8
- package/dist/components/checkout-embed/useLocalStorage.d.ts +0 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const storeClient: {
|
|
2
|
+
proxy?: string;
|
|
3
|
+
retrieveCheckout(clientSecret: string, checkoutId: string): Promise<import("@betterstore/sdk").CheckoutSession>;
|
|
4
|
+
updateCheckout(clientSecret: string, checkoutId: string, params: import("@betterstore/sdk").CheckoutUpdateParams): Promise<import("@betterstore/sdk").CheckoutSession>;
|
|
5
|
+
getCheckoutShippingRates(clientSecret: string, checkoutId: string): Promise<import("@betterstore/sdk").ShippingRate[]>;
|
|
6
|
+
generateCheckoutsPaymentSecret(clientSecret: string, checkoutId: string): Promise<string>;
|
|
7
|
+
createCustomer(clientSecret: string, params: import("@betterstore/sdk").CustomerCreateParams): Promise<import("@betterstore/sdk").Customer>;
|
|
8
|
+
retrieveCustomer(clientSecret: string, idOrEmail: string): Promise<import("@betterstore/sdk").Customer>;
|
|
9
|
+
updateCustomer(clientSecret: string, customerId: string, params: import("@betterstore/sdk").CustomerUpdateParams): Promise<import("@betterstore/sdk").Customer>;
|
|
10
|
+
};
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { type Locale } from "@/i18n";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@betterstore/react",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.13",
|
|
4
4
|
"description": "E-commerce for Developers",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -10,16 +10,6 @@
|
|
|
10
10
|
"module": "dist/index.mjs",
|
|
11
11
|
"types": "dist/index.d.ts",
|
|
12
12
|
"type": "module",
|
|
13
|
-
"scripts": {
|
|
14
|
-
"dev": "vite",
|
|
15
|
-
"prepublish": "changeset && changeset version && git add .",
|
|
16
|
-
"build": "rollup -c",
|
|
17
|
-
"lint": "tsc",
|
|
18
|
-
"format:check": "prettier --check --ignore-path .prettierignore .",
|
|
19
|
-
"format": "prettier --write --ignore-path .prettierignore .",
|
|
20
|
-
"ci": "pnpm run lint && pnpm run format:check && pnpm run build",
|
|
21
|
-
"release": "pnpm run ci && changeset publish"
|
|
22
|
-
},
|
|
23
13
|
"keywords": [
|
|
24
14
|
"betterstore",
|
|
25
15
|
"ecommerce",
|
|
@@ -29,12 +19,14 @@
|
|
|
29
19
|
"author": "Better Store",
|
|
30
20
|
"license": "MIT",
|
|
31
21
|
"devDependencies": {
|
|
32
|
-
"@betterstore/sdk": "^0.
|
|
22
|
+
"@betterstore/sdk": "^0.3.15",
|
|
33
23
|
"@changesets/cli": "^2.28.1",
|
|
34
24
|
"@rollup/plugin-commonjs": "^28.0.3",
|
|
25
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
35
26
|
"@rollup/plugin-node-resolve": "^16.0.0",
|
|
36
27
|
"@rollup/plugin-typescript": "^12.1.2",
|
|
37
28
|
"@tailwindcss/postcss": "^4.0.12",
|
|
29
|
+
"@types/node": "^22.13.10",
|
|
38
30
|
"@types/react": "^18.3.18",
|
|
39
31
|
"@types/react-dom": "^18.3.5",
|
|
40
32
|
"@vitejs/plugin-react": "^4.3.4",
|
|
@@ -56,21 +48,44 @@
|
|
|
56
48
|
"dependencies": {
|
|
57
49
|
"@hookform/resolvers": "^4.1.3",
|
|
58
50
|
"@radix-ui/react-checkbox": "^1.1.4",
|
|
51
|
+
"@radix-ui/react-dialog": "^1.1.6",
|
|
52
|
+
"@radix-ui/react-dropdown-menu": "^2.1.6",
|
|
59
53
|
"@radix-ui/react-label": "^2.1.2",
|
|
54
|
+
"@radix-ui/react-popover": "^1.1.6",
|
|
60
55
|
"@radix-ui/react-radio-group": "^1.2.3",
|
|
61
56
|
"@radix-ui/react-select": "^2.1.6",
|
|
57
|
+
"@radix-ui/react-separator": "^1.1.2",
|
|
62
58
|
"@radix-ui/react-slot": "^1.1.2",
|
|
63
59
|
"@stripe/react-stripe-js": "^3.3.0",
|
|
64
60
|
"@stripe/stripe-js": "^5.10.0",
|
|
61
|
+
"axios": "^1.8.2",
|
|
65
62
|
"class-variance-authority": "^0.7.1",
|
|
66
63
|
"clsx": "^2.1.1",
|
|
64
|
+
"cmdk": "1.0.0",
|
|
65
|
+
"country-data-list": "^1.4.0",
|
|
66
|
+
"i18next": "^24.2.3",
|
|
67
|
+
"i18next-browser-languagedetector": "^8.0.4",
|
|
68
|
+
"i18next-http-backend": "^3.0.2",
|
|
67
69
|
"lucide-react": "^0.479.0",
|
|
70
|
+
"motion": "^12.5.0",
|
|
71
|
+
"react-circle-flags": "^0.0.23",
|
|
68
72
|
"react-hook-form": "^7.54.2",
|
|
73
|
+
"react-i18next": "^15.4.1",
|
|
69
74
|
"rollup-plugin-postcss": "^4.0.2",
|
|
70
75
|
"tailwind": "^4.0.0",
|
|
71
76
|
"tailwind-merge": "^3.0.2",
|
|
72
77
|
"tailwindcss-animate": "^1.0.7",
|
|
73
78
|
"zod": "^3.24.2",
|
|
74
79
|
"zustand": "^5.0.3"
|
|
80
|
+
},
|
|
81
|
+
"scripts": {
|
|
82
|
+
"dev": "vite",
|
|
83
|
+
"prep": "changeset && changeset version && git add .",
|
|
84
|
+
"build": "rollup -c",
|
|
85
|
+
"lint": "tsc",
|
|
86
|
+
"format:check": "prettier --check --ignore-path .prettierignore .",
|
|
87
|
+
"format": "prettier --write --ignore-path .prettierignore .",
|
|
88
|
+
"ci": "pnpm run lint && pnpm run format:check && pnpm run build",
|
|
89
|
+
"release": "pnpm run ci && pnpm publish -r --no-git-checks"
|
|
75
90
|
}
|
|
76
|
-
}
|
|
91
|
+
}
|
package/rollup.config.mjs
CHANGED
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
import commonjs from "@rollup/plugin-commonjs";
|
|
2
|
+
import json from "@rollup/plugin-json";
|
|
2
3
|
import resolve from "@rollup/plugin-node-resolve";
|
|
3
4
|
import typescript from "@rollup/plugin-typescript";
|
|
5
|
+
import { dirname, resolve as pathResolve } from "path";
|
|
4
6
|
import postcss from "rollup-plugin-postcss";
|
|
7
|
+
import { fileURLToPath } from "url";
|
|
8
|
+
|
|
9
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
|
|
11
|
+
// Custom plugin to handle "use client" directives
|
|
12
|
+
const removeUseClientDirective = {
|
|
13
|
+
name: "remove-use-client-directive",
|
|
14
|
+
transform(code) {
|
|
15
|
+
return {
|
|
16
|
+
code: code.replace(/^"use client";\n?/gm, ""),
|
|
17
|
+
map: null,
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
};
|
|
5
21
|
|
|
6
22
|
export default {
|
|
7
23
|
input: "src/index.ts",
|
|
@@ -16,9 +32,19 @@ export default {
|
|
|
16
32
|
},
|
|
17
33
|
],
|
|
18
34
|
plugins: [
|
|
19
|
-
|
|
35
|
+
removeUseClientDirective,
|
|
36
|
+
resolve({
|
|
37
|
+
extensions: [".js", ".jsx", ".ts", ".tsx", ".json"],
|
|
38
|
+
alias: {
|
|
39
|
+
"@": pathResolve(__dirname, "src"),
|
|
40
|
+
},
|
|
41
|
+
}),
|
|
20
42
|
commonjs(),
|
|
21
43
|
typescript(),
|
|
44
|
+
json({
|
|
45
|
+
include: "**/*.json",
|
|
46
|
+
preferConst: true,
|
|
47
|
+
}),
|
|
22
48
|
postcss({
|
|
23
49
|
config: {
|
|
24
50
|
path: "./postcss.config.cjs",
|
|
@@ -42,6 +68,11 @@ export default {
|
|
|
42
68
|
"@radix-ui/react-popper",
|
|
43
69
|
"@radix-ui/react-portal",
|
|
44
70
|
"@radix-ui/react-focus-scope",
|
|
71
|
+
"@radix-ui/react-dialog",
|
|
72
|
+
"@radix-ui/react-dropdown-menu",
|
|
73
|
+
"@radix-ui/react-popover",
|
|
74
|
+
"@radix-ui/react-separator",
|
|
75
|
+
"@radix-ui/react-slot",
|
|
45
76
|
|
|
46
77
|
"react",
|
|
47
78
|
"react-dom",
|
|
@@ -57,5 +88,12 @@ export default {
|
|
|
57
88
|
"lucide-react",
|
|
58
89
|
"react-hook-form",
|
|
59
90
|
"@hookform/resolvers",
|
|
91
|
+
"motion",
|
|
92
|
+
"country-data-list",
|
|
93
|
+
"cmdk",
|
|
94
|
+
|
|
95
|
+
"i18next",
|
|
96
|
+
"i18next-browser-languagedetector",
|
|
97
|
+
"react-i18next",
|
|
60
98
|
],
|
|
61
99
|
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { type CustomerFormData } from "../checkout-schema";
|
|
3
|
-
interface CustomerFormProps {
|
|
4
|
-
initialData?: CustomerFormData;
|
|
5
|
-
onSubmit: (data: CustomerFormData) => void;
|
|
6
|
-
onBack: () => void;
|
|
7
|
-
}
|
|
8
|
-
export default function CustomerForm({ initialData, onSubmit, onBack, }: CustomerFormProps): React.JSX.Element;
|
|
9
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
interface PaymentFormProps {
|
|
3
|
-
paymentSecret: string | null;
|
|
4
|
-
onSubmit: (data: any) => void;
|
|
5
|
-
onBack: () => void;
|
|
6
|
-
contactEmail: string;
|
|
7
|
-
shippingAddress: string;
|
|
8
|
-
shippingMethod: string;
|
|
9
|
-
shippingPrice: string;
|
|
10
|
-
}
|
|
11
|
-
export default function PaymentForm({ paymentSecret, onSubmit, onBack, contactEmail, shippingAddress, shippingMethod, shippingPrice, }: PaymentFormProps): React.JSX.Element;
|
|
12
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { type ShippingMethodFormData } from "../checkout-schema";
|
|
3
|
-
interface ShippingMethodFormProps {
|
|
4
|
-
initialData?: ShippingMethodFormData;
|
|
5
|
-
onSubmit: (data: ShippingMethodFormData) => void;
|
|
6
|
-
onBack: () => void;
|
|
7
|
-
contactEmail: string;
|
|
8
|
-
shippingAddress: string;
|
|
9
|
-
}
|
|
10
|
-
export default function ShippingMethodForm({ initialData, onSubmit, onBack, contactEmail, shippingAddress, }: ShippingMethodFormProps): React.JSX.Element;
|
|
11
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
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;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function useLocalStorage<T>(key: string, initialValue: T): [T, (value: T) => void];
|