@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
package/.prettierignore
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
node_modules
|
|
2
|
-
dist
|
|
1
|
+
node_modules
|
|
2
|
+
dist
|
|
3
3
|
pnpm-lock.yaml
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @betterstore/sdk
|
|
2
2
|
|
|
3
|
+
## 0.2.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- bug fixes
|
|
8
|
+
|
|
9
|
+
## 0.2.12
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- types fix, loading skeleton added
|
|
14
|
+
|
|
15
|
+
## 0.2.11
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- base functionality
|
|
20
|
+
|
|
21
|
+
## 0.2.10
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- prep commit
|
|
26
|
+
|
|
27
|
+
## 0.2.9
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- cicd test
|
|
32
|
+
|
|
3
33
|
## 0.2.8
|
|
4
34
|
|
|
5
35
|
### Patch Changes
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Better Store
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Better Store
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type Themes = "dark" | "light";
|
|
2
|
+
export type AppearanceConfig = {
|
|
3
|
+
theme?: Themes;
|
|
4
|
+
borderRadius?: number;
|
|
5
|
+
font?: string;
|
|
6
|
+
colors?: {
|
|
7
|
+
background?: string;
|
|
8
|
+
foreground?: string;
|
|
9
|
+
primary?: string;
|
|
10
|
+
primaryForeground?: string;
|
|
11
|
+
secondary?: string;
|
|
12
|
+
secondaryForeground?: string;
|
|
13
|
+
muted?: string;
|
|
14
|
+
mutedForeground?: string;
|
|
15
|
+
accent?: string;
|
|
16
|
+
accentForeground?: string;
|
|
17
|
+
destructive?: string;
|
|
18
|
+
border?: string;
|
|
19
|
+
ring?: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export default function Appearance({ appearance, }: {
|
|
23
|
+
appearance?: AppearanceConfig;
|
|
24
|
+
}): null;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import { CheckoutSession } from "@betterstore/sdk";
|
|
1
2
|
import React from "react";
|
|
2
|
-
import type { CheckoutFormData } from "./checkout-schema";
|
|
3
3
|
interface CheckoutFormProps {
|
|
4
4
|
checkoutId: string;
|
|
5
|
-
|
|
5
|
+
onSuccess: () => void;
|
|
6
|
+
onError: () => void;
|
|
6
7
|
cancelUrl: string;
|
|
8
|
+
clientSecret: string;
|
|
9
|
+
customer?: CheckoutSession["customer"];
|
|
10
|
+
currency: string;
|
|
7
11
|
}
|
|
8
|
-
export default function CheckoutForm({ checkoutId,
|
|
12
|
+
export default function CheckoutForm({ checkoutId, onSuccess, onError, cancelUrl, clientSecret, customer, currency, }: CheckoutFormProps): React.JSX.Element;
|
|
9
13
|
export {};
|
|
@@ -1,127 +1,198 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const customerSchema: z.ZodObject<{
|
|
3
3
|
email: z.ZodString;
|
|
4
|
-
|
|
5
|
-
firstName: z.ZodOptional<z.ZodString>;
|
|
4
|
+
firstName: z.ZodString;
|
|
6
5
|
lastName: z.ZodString;
|
|
7
|
-
address: z.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
address: z.ZodObject<{
|
|
7
|
+
line1: z.ZodString;
|
|
8
|
+
line2: z.ZodOptional<z.ZodString>;
|
|
9
|
+
city: z.ZodString;
|
|
10
|
+
state: z.ZodOptional<z.ZodString>;
|
|
11
|
+
zipCode: z.ZodString;
|
|
12
|
+
country: z.ZodString;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
line1: string;
|
|
15
|
+
city: string;
|
|
16
|
+
zipCode: string;
|
|
17
|
+
country: string;
|
|
18
|
+
line2?: string | undefined;
|
|
19
|
+
state?: string | undefined;
|
|
20
|
+
}, {
|
|
21
|
+
line1: string;
|
|
22
|
+
city: string;
|
|
23
|
+
zipCode: string;
|
|
24
|
+
country: string;
|
|
25
|
+
line2?: string | undefined;
|
|
26
|
+
state?: string | undefined;
|
|
27
|
+
}>;
|
|
13
28
|
saveInfo: z.ZodOptional<z.ZodBoolean>;
|
|
29
|
+
phone: z.ZodString;
|
|
14
30
|
}, "strip", z.ZodTypeAny, {
|
|
15
31
|
email: string;
|
|
32
|
+
firstName: string;
|
|
16
33
|
lastName: string;
|
|
17
|
-
address:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
34
|
+
address: {
|
|
35
|
+
line1: string;
|
|
36
|
+
city: string;
|
|
37
|
+
zipCode: string;
|
|
38
|
+
country: string;
|
|
39
|
+
line2?: string | undefined;
|
|
40
|
+
state?: string | undefined;
|
|
41
|
+
};
|
|
42
|
+
phone: string;
|
|
25
43
|
saveInfo?: boolean | undefined;
|
|
26
44
|
}, {
|
|
27
45
|
email: string;
|
|
46
|
+
firstName: string;
|
|
28
47
|
lastName: string;
|
|
29
|
-
address:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
48
|
+
address: {
|
|
49
|
+
line1: string;
|
|
50
|
+
city: string;
|
|
51
|
+
zipCode: string;
|
|
52
|
+
country: string;
|
|
53
|
+
line2?: string | undefined;
|
|
54
|
+
state?: string | undefined;
|
|
55
|
+
};
|
|
56
|
+
phone: string;
|
|
37
57
|
saveInfo?: boolean | undefined;
|
|
38
58
|
}>;
|
|
39
59
|
export declare const shippingMethodSchema: z.ZodObject<{
|
|
40
|
-
|
|
60
|
+
rateId: z.ZodString;
|
|
61
|
+
name: z.ZodString;
|
|
62
|
+
provider: z.ZodString;
|
|
63
|
+
amount: z.ZodNumber;
|
|
41
64
|
}, "strip", z.ZodTypeAny, {
|
|
42
|
-
|
|
65
|
+
rateId: string;
|
|
66
|
+
name: string;
|
|
67
|
+
provider: string;
|
|
68
|
+
amount: number;
|
|
43
69
|
}, {
|
|
44
|
-
|
|
70
|
+
rateId: string;
|
|
71
|
+
name: string;
|
|
72
|
+
provider: string;
|
|
73
|
+
amount: number;
|
|
45
74
|
}>;
|
|
46
75
|
export declare const checkoutSchema: z.ZodObject<{
|
|
47
76
|
customer: z.ZodObject<{
|
|
48
77
|
email: z.ZodString;
|
|
49
|
-
|
|
50
|
-
firstName: z.ZodOptional<z.ZodString>;
|
|
78
|
+
firstName: z.ZodString;
|
|
51
79
|
lastName: z.ZodString;
|
|
52
|
-
address: z.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
80
|
+
address: z.ZodObject<{
|
|
81
|
+
line1: z.ZodString;
|
|
82
|
+
line2: z.ZodOptional<z.ZodString>;
|
|
83
|
+
city: z.ZodString;
|
|
84
|
+
state: z.ZodOptional<z.ZodString>;
|
|
85
|
+
zipCode: z.ZodString;
|
|
86
|
+
country: z.ZodString;
|
|
87
|
+
}, "strip", z.ZodTypeAny, {
|
|
88
|
+
line1: string;
|
|
89
|
+
city: string;
|
|
90
|
+
zipCode: string;
|
|
91
|
+
country: string;
|
|
92
|
+
line2?: string | undefined;
|
|
93
|
+
state?: string | undefined;
|
|
94
|
+
}, {
|
|
95
|
+
line1: string;
|
|
96
|
+
city: string;
|
|
97
|
+
zipCode: string;
|
|
98
|
+
country: string;
|
|
99
|
+
line2?: string | undefined;
|
|
100
|
+
state?: string | undefined;
|
|
101
|
+
}>;
|
|
58
102
|
saveInfo: z.ZodOptional<z.ZodBoolean>;
|
|
103
|
+
phone: z.ZodString;
|
|
59
104
|
}, "strip", z.ZodTypeAny, {
|
|
60
105
|
email: string;
|
|
106
|
+
firstName: string;
|
|
61
107
|
lastName: string;
|
|
62
|
-
address:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
108
|
+
address: {
|
|
109
|
+
line1: string;
|
|
110
|
+
city: string;
|
|
111
|
+
zipCode: string;
|
|
112
|
+
country: string;
|
|
113
|
+
line2?: string | undefined;
|
|
114
|
+
state?: string | undefined;
|
|
115
|
+
};
|
|
116
|
+
phone: string;
|
|
70
117
|
saveInfo?: boolean | undefined;
|
|
71
118
|
}, {
|
|
72
119
|
email: string;
|
|
120
|
+
firstName: string;
|
|
73
121
|
lastName: string;
|
|
74
|
-
address:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
122
|
+
address: {
|
|
123
|
+
line1: string;
|
|
124
|
+
city: string;
|
|
125
|
+
zipCode: string;
|
|
126
|
+
country: string;
|
|
127
|
+
line2?: string | undefined;
|
|
128
|
+
state?: string | undefined;
|
|
129
|
+
};
|
|
130
|
+
phone: string;
|
|
82
131
|
saveInfo?: boolean | undefined;
|
|
83
132
|
}>;
|
|
84
133
|
shipping: z.ZodObject<{
|
|
85
|
-
|
|
134
|
+
rateId: z.ZodString;
|
|
135
|
+
name: z.ZodString;
|
|
136
|
+
provider: z.ZodString;
|
|
137
|
+
amount: z.ZodNumber;
|
|
86
138
|
}, "strip", z.ZodTypeAny, {
|
|
87
|
-
|
|
139
|
+
rateId: string;
|
|
140
|
+
name: string;
|
|
141
|
+
provider: string;
|
|
142
|
+
amount: number;
|
|
88
143
|
}, {
|
|
89
|
-
|
|
144
|
+
rateId: string;
|
|
145
|
+
name: string;
|
|
146
|
+
provider: string;
|
|
147
|
+
amount: number;
|
|
90
148
|
}>;
|
|
149
|
+
customerId: z.ZodOptional<z.ZodString>;
|
|
91
150
|
}, "strip", z.ZodTypeAny, {
|
|
92
151
|
customer: {
|
|
93
152
|
email: string;
|
|
153
|
+
firstName: string;
|
|
94
154
|
lastName: string;
|
|
95
|
-
address:
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
155
|
+
address: {
|
|
156
|
+
line1: string;
|
|
157
|
+
city: string;
|
|
158
|
+
zipCode: string;
|
|
159
|
+
country: string;
|
|
160
|
+
line2?: string | undefined;
|
|
161
|
+
state?: string | undefined;
|
|
162
|
+
};
|
|
163
|
+
phone: string;
|
|
103
164
|
saveInfo?: boolean | undefined;
|
|
104
165
|
};
|
|
105
166
|
shipping: {
|
|
106
|
-
|
|
167
|
+
rateId: string;
|
|
168
|
+
name: string;
|
|
169
|
+
provider: string;
|
|
170
|
+
amount: number;
|
|
107
171
|
};
|
|
172
|
+
customerId?: string | undefined;
|
|
108
173
|
}, {
|
|
109
174
|
customer: {
|
|
110
175
|
email: string;
|
|
176
|
+
firstName: string;
|
|
111
177
|
lastName: string;
|
|
112
|
-
address:
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
178
|
+
address: {
|
|
179
|
+
line1: string;
|
|
180
|
+
city: string;
|
|
181
|
+
zipCode: string;
|
|
182
|
+
country: string;
|
|
183
|
+
line2?: string | undefined;
|
|
184
|
+
state?: string | undefined;
|
|
185
|
+
};
|
|
186
|
+
phone: string;
|
|
120
187
|
saveInfo?: boolean | undefined;
|
|
121
188
|
};
|
|
122
189
|
shipping: {
|
|
123
|
-
|
|
190
|
+
rateId: string;
|
|
191
|
+
name: string;
|
|
192
|
+
provider: string;
|
|
193
|
+
amount: number;
|
|
124
194
|
};
|
|
195
|
+
customerId?: string | undefined;
|
|
125
196
|
}>;
|
|
126
197
|
export type CheckoutFormData = z.infer<typeof checkoutSchema>;
|
|
127
198
|
export type CustomerFormData = z.infer<typeof customerSchema>;
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
+
import { Locale } from "@/i18n";
|
|
1
2
|
import React from "react";
|
|
2
|
-
|
|
3
|
+
import { AppearanceConfig } from "./appearance";
|
|
4
|
+
interface CheckoutEmbedProps {
|
|
3
5
|
checkoutId: string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
config: {
|
|
7
|
+
clientSecret: string;
|
|
8
|
+
cancelUrl: string;
|
|
9
|
+
successUrl: string;
|
|
10
|
+
appearance?: AppearanceConfig;
|
|
11
|
+
locale?: Locale;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
declare function CheckoutEmbed({ checkoutId, config }: CheckoutEmbedProps): React.JSX.Element;
|
|
7
15
|
declare const _default: React.MemoExoticComponent<typeof CheckoutEmbed>;
|
|
8
16
|
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type CustomerFormData } from "../../checkout-schema";
|
|
3
|
+
interface CustomerFormProps {
|
|
4
|
+
initialData?: CustomerFormData;
|
|
5
|
+
onSubmit: (data: CustomerFormData) => void;
|
|
6
|
+
}
|
|
7
|
+
export default function CustomerForm({ initialData, onSubmit, }: CustomerFormProps): React.JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface PaymentFormProps {
|
|
3
|
+
paymentSecret: string | null;
|
|
4
|
+
onSuccess: () => void;
|
|
5
|
+
onError: () => void;
|
|
6
|
+
onBack: () => void;
|
|
7
|
+
onDoubleBack: () => void;
|
|
8
|
+
contactEmail: string;
|
|
9
|
+
shippingAddress: string;
|
|
10
|
+
shippingProvider: string;
|
|
11
|
+
shippingPrice: string;
|
|
12
|
+
}
|
|
13
|
+
export default function PaymentForm({ paymentSecret, onSuccess, onError, onBack, onDoubleBack, contactEmail, shippingAddress, shippingProvider, shippingPrice, }: PaymentFormProps): React.JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ShippingRate } from "@betterstore/sdk";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { type ShippingMethodFormData } from "../../checkout-schema";
|
|
4
|
+
interface ShippingMethodFormProps {
|
|
5
|
+
shippingRates: ShippingRate[];
|
|
6
|
+
initialData?: ShippingMethodFormData;
|
|
7
|
+
onSubmit: (data: ShippingMethodFormData) => void;
|
|
8
|
+
onBack: () => void;
|
|
9
|
+
contactEmail: string;
|
|
10
|
+
shippingAddress: string;
|
|
11
|
+
}
|
|
12
|
+
export default function ShippingMethodForm({ shippingRates, initialData, onSubmit, onBack, contactEmail, shippingAddress, }: ShippingMethodFormProps): React.JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CheckoutSession } from "@betterstore/sdk";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export default function CheckoutSummary({ lineItems, shipping, tax, currency, cancelUrl, }: {
|
|
4
|
+
lineItems: CheckoutSession["lineItems"];
|
|
5
|
+
shipping?: number;
|
|
6
|
+
tax?: number;
|
|
7
|
+
currency: string;
|
|
8
|
+
cancelUrl: string;
|
|
9
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CheckoutFormData } from "./checkout-schema";
|
|
2
|
+
export type CheckoutStep = "customer" | "shipping" | "payment";
|
|
3
|
+
interface FormStore {
|
|
4
|
+
formData: Partial<CheckoutFormData>;
|
|
5
|
+
setFormData: (formData: Partial<CheckoutFormData>) => void;
|
|
6
|
+
step: CheckoutStep;
|
|
7
|
+
setStep: (step: CheckoutStep) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const useFormStore: (checkoutId: string) => import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<FormStore>, "persist"> & {
|
|
10
|
+
persist: {
|
|
11
|
+
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<FormStore, FormStore>>) => void;
|
|
12
|
+
clearStorage: () => void;
|
|
13
|
+
rehydrate: () => Promise<void> | void;
|
|
14
|
+
hasHydrated: () => boolean;
|
|
15
|
+
onHydrate: (fn: (state: FormStore) => void) => () => void;
|
|
16
|
+
onFinishHydration: (fn: (state: FormStore) => void) => () => void;
|
|
17
|
+
getOptions: () => Partial<import("zustand/middleware").PersistOptions<FormStore, FormStore>>;
|
|
18
|
+
};
|
|
19
|
+
}>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface Country {
|
|
3
|
+
alpha2: string;
|
|
4
|
+
alpha3: string;
|
|
5
|
+
countryCallingCodes: string[];
|
|
6
|
+
currencies: string[];
|
|
7
|
+
emoji?: string;
|
|
8
|
+
ioc: string;
|
|
9
|
+
languages: string[];
|
|
10
|
+
name: string;
|
|
11
|
+
status: string;
|
|
12
|
+
}
|
|
13
|
+
interface CountryDropdownProps {
|
|
14
|
+
options?: Country[];
|
|
15
|
+
onChange?: (country: Country) => void;
|
|
16
|
+
defaultValue?: string;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
slim?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare const CountryDropdown: React.ForwardRefExoticComponent<CountryDropdownProps & React.RefAttributes<HTMLButtonElement>>;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
interface FormMessagesProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
messages?: string[] | string | React.ReactNode;
|
|
4
|
+
type?: "error" | "success";
|
|
5
|
+
}
|
|
6
|
+
export declare function FormMessages({ messages, type, className, ...props }: FormMessagesProps): React.JSX.Element | null;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Input } from "@/components/ui/input";
|
|
2
|
+
import React from "react";
|
|
3
|
+
type InputGroupProps = {
|
|
4
|
+
name: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
} & React.ComponentProps<typeof Input>;
|
|
7
|
+
export default function InputGroup({ name, label, className, ...props }: InputGroupProps): React.JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Button } from "@/components/ui/button";
|
|
2
|
+
import React from "react";
|
|
3
|
+
type SubmitButtonProps = Parameters<typeof Button>[0] & {
|
|
4
|
+
isSubmitting: boolean;
|
|
5
|
+
isValid: boolean;
|
|
6
|
+
};
|
|
7
|
+
export default function SubmitButton({ isSubmitting, isValid, className, variant, children, size, ...props }: SubmitButtonProps): React.JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Command as CommandPrimitive } from "cmdk";
|
|
3
|
+
import { Dialog } from "@/components/ui/dialog";
|
|
4
|
+
declare function Command({ className, ...props }: React.ComponentProps<typeof CommandPrimitive>): React.JSX.Element;
|
|
5
|
+
declare function CommandDialog({ title, description, children, ...props }: React.ComponentProps<typeof Dialog> & {
|
|
6
|
+
title?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
}): React.JSX.Element;
|
|
9
|
+
declare function CommandInput({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Input>): React.JSX.Element;
|
|
10
|
+
declare function CommandList({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.List>): React.JSX.Element;
|
|
11
|
+
declare function CommandEmpty({ ...props }: React.ComponentProps<typeof CommandPrimitive.Empty>): React.JSX.Element;
|
|
12
|
+
declare function CommandGroup({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Group>): React.JSX.Element;
|
|
13
|
+
declare function CommandSeparator({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Separator>): React.JSX.Element;
|
|
14
|
+
declare function CommandItem({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Item>): React.JSX.Element;
|
|
15
|
+
declare function CommandShortcut({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
16
|
+
export { Command, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandShortcut, CommandSeparator, };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
declare function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>): React.JSX.Element;
|
|
4
|
+
declare function DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>): React.JSX.Element;
|
|
5
|
+
declare function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>): React.JSX.Element;
|
|
6
|
+
declare function DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>): React.JSX.Element;
|
|
7
|
+
declare function DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>): React.JSX.Element;
|
|
8
|
+
declare function DialogContent({ className, children, ...props }: React.ComponentProps<typeof DialogPrimitive.Content>): React.JSX.Element;
|
|
9
|
+
declare function DialogHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
10
|
+
declare function DialogFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
11
|
+
declare function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>): React.JSX.Element;
|
|
12
|
+
declare function DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>): React.JSX.Element;
|
|
13
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
3
|
+
declare function DropdownMenu({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Root>): React.JSX.Element;
|
|
4
|
+
declare function DropdownMenuPortal({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>): React.JSX.Element;
|
|
5
|
+
declare function DropdownMenuTrigger({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>): React.JSX.Element;
|
|
6
|
+
declare function DropdownMenuContent({ className, sideOffset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Content>): React.JSX.Element;
|
|
7
|
+
declare function DropdownMenuGroup({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Group>): React.JSX.Element;
|
|
8
|
+
declare function DropdownMenuItem({ className, inset, variant, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
|
|
9
|
+
inset?: boolean;
|
|
10
|
+
variant?: "default" | "destructive";
|
|
11
|
+
}): React.JSX.Element;
|
|
12
|
+
declare function DropdownMenuCheckboxItem({ className, children, checked, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>): React.JSX.Element;
|
|
13
|
+
declare function DropdownMenuRadioGroup({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>): React.JSX.Element;
|
|
14
|
+
declare function DropdownMenuRadioItem({ className, children, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>): React.JSX.Element;
|
|
15
|
+
declare function DropdownMenuLabel({ className, inset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
|
|
16
|
+
inset?: boolean;
|
|
17
|
+
}): React.JSX.Element;
|
|
18
|
+
declare function DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>): React.JSX.Element;
|
|
19
|
+
declare function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
20
|
+
declare function DropdownMenuSub({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>): React.JSX.Element;
|
|
21
|
+
declare function DropdownMenuSubTrigger({ className, inset, children, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
22
|
+
inset?: boolean;
|
|
23
|
+
}): React.JSX.Element;
|
|
24
|
+
declare function DropdownMenuSubContent({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>): React.JSX.Element;
|
|
25
|
+
export { DropdownMenu, DropdownMenuPortal, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, };
|
|
@@ -2,7 +2,7 @@ import * as LabelPrimitive from "@radix-ui/react-label";
|
|
|
2
2
|
import { Slot } from "@radix-ui/react-slot";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { type ControllerProps, type FieldPath, type FieldValues } from "react-hook-form";
|
|
5
|
-
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues
|
|
5
|
+
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>(props: import("react-hook-form").FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
|
|
6
6
|
declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => React.JSX.Element;
|
|
7
7
|
declare const useFormField: () => {
|
|
8
8
|
invalid: boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
3
|
+
declare function Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>): React.JSX.Element;
|
|
4
|
+
declare function PopoverTrigger({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Trigger>): React.JSX.Element;
|
|
5
|
+
declare function PopoverContent({ className, align, sideOffset, ...props }: React.ComponentProps<typeof PopoverPrimitive.Content>): React.JSX.Element;
|
|
6
|
+
declare function PopoverAnchor({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Anchor>): React.JSX.Element;
|
|
7
|
+
export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };
|