@betterstore/react 0.2.10 → 0.2.14
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 +24 -0
- package/dist/components/checkout-embed/appearance.d.ts +26 -0
- package/dist/components/checkout-embed/checkout-form-loading.d.ts +2 -0
- package/dist/components/checkout-embed/checkout-form.d.ts +9 -3
- package/dist/components/checkout-embed/checkout-schema.d.ts +143 -72
- package/dist/components/checkout-embed/index.d.ts +10 -10
- 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 +16 -0
- package/dist/components/checkout-embed/steps/shipping/form.d.ts +13 -0
- package/dist/components/checkout-embed/steps/summary/index.d.ts +10 -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/payment-element/index.d.ts +2 -2
- package/dist/components/ui/button.d.ts +1 -1
- 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 +31655 -609
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +31655 -608
- 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 +15 -2
- 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.14",
|
|
4
4
|
"description": "E-commerce for Developers",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -19,9 +19,10 @@
|
|
|
19
19
|
"author": "Better Store",
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@betterstore/sdk": "^0.
|
|
22
|
+
"@betterstore/sdk": "^0.3.16",
|
|
23
23
|
"@changesets/cli": "^2.28.1",
|
|
24
24
|
"@rollup/plugin-commonjs": "^28.0.3",
|
|
25
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
25
26
|
"@rollup/plugin-node-resolve": "^16.0.0",
|
|
26
27
|
"@rollup/plugin-typescript": "^12.1.2",
|
|
27
28
|
"@tailwindcss/postcss": "^4.0.12",
|
|
@@ -47,17 +48,29 @@
|
|
|
47
48
|
"dependencies": {
|
|
48
49
|
"@hookform/resolvers": "^4.1.3",
|
|
49
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",
|
|
50
53
|
"@radix-ui/react-label": "^2.1.2",
|
|
54
|
+
"@radix-ui/react-popover": "^1.1.6",
|
|
51
55
|
"@radix-ui/react-radio-group": "^1.2.3",
|
|
52
56
|
"@radix-ui/react-select": "^2.1.6",
|
|
57
|
+
"@radix-ui/react-separator": "^1.1.2",
|
|
53
58
|
"@radix-ui/react-slot": "^1.1.2",
|
|
54
59
|
"@stripe/react-stripe-js": "^3.3.0",
|
|
55
60
|
"@stripe/stripe-js": "^5.10.0",
|
|
56
61
|
"axios": "^1.8.2",
|
|
57
62
|
"class-variance-authority": "^0.7.1",
|
|
58
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",
|
|
59
69
|
"lucide-react": "^0.479.0",
|
|
70
|
+
"motion": "^12.5.0",
|
|
71
|
+
"react-circle-flags": "^0.0.23",
|
|
60
72
|
"react-hook-form": "^7.54.2",
|
|
73
|
+
"react-i18next": "^15.4.1",
|
|
61
74
|
"rollup-plugin-postcss": "^4.0.2",
|
|
62
75
|
"tailwind": "^4.0.0",
|
|
63
76
|
"tailwind-merge": "^3.0.2",
|
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];
|