@betterstore/react 0.2.4 → 0.2.5

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @betterstore/sdk
2
2
 
3
+ ## 0.2.5
4
+
5
+ ### Patch Changes
6
+
7
+ - high-level overview checkout form
8
+
3
9
  ## 0.2.4
4
10
 
5
11
  ### Patch Changes
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema.json",
3
+ "style": "new-york",
4
+ "rsc": false,
5
+ "tsx": true,
6
+ "tailwind": {
7
+ "config": "",
8
+ "css": "src/globals.css",
9
+ "baseColor": "neutral",
10
+ "cssVariables": true,
11
+ "prefix": ""
12
+ },
13
+ "aliases": {
14
+ "components": "@/components",
15
+ "utils": "@/lib/utils",
16
+ "ui": "@/components/ui",
17
+ "lib": "@/lib",
18
+ "hooks": "@/hooks"
19
+ },
20
+ "iconLibrary": "lucide"
21
+ }
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import type { CheckoutFormData } from "./checkout-schema";
3
+ interface CheckoutFormProps {
4
+ checkoutId: string;
5
+ onComplete?: (data: CheckoutFormData) => void;
6
+ }
7
+ export default function CheckoutForm({ checkoutId, onComplete, }: CheckoutFormProps): React.JSX.Element;
8
+ export {};
@@ -0,0 +1,173 @@
1
+ import { z } from "zod";
2
+ export declare const customerSchema: z.ZodObject<{
3
+ email: z.ZodString;
4
+ marketingConsent: z.ZodOptional<z.ZodBoolean>;
5
+ firstName: z.ZodOptional<z.ZodString>;
6
+ lastName: z.ZodString;
7
+ address: z.ZodString;
8
+ apartment: z.ZodOptional<z.ZodString>;
9
+ city: z.ZodString;
10
+ state: z.ZodString;
11
+ zipCode: z.ZodString;
12
+ country: z.ZodString;
13
+ saveInfo: z.ZodOptional<z.ZodBoolean>;
14
+ }, "strip", z.ZodTypeAny, {
15
+ email: string;
16
+ lastName: string;
17
+ address: string;
18
+ city: string;
19
+ state: string;
20
+ zipCode: string;
21
+ country: string;
22
+ marketingConsent?: boolean | undefined;
23
+ firstName?: string | undefined;
24
+ apartment?: string | undefined;
25
+ saveInfo?: boolean | undefined;
26
+ }, {
27
+ email: string;
28
+ lastName: string;
29
+ address: string;
30
+ city: string;
31
+ state: string;
32
+ zipCode: string;
33
+ country: string;
34
+ marketingConsent?: boolean | undefined;
35
+ firstName?: string | undefined;
36
+ apartment?: string | undefined;
37
+ saveInfo?: boolean | undefined;
38
+ }>;
39
+ export declare const shippingMethodSchema: z.ZodObject<{
40
+ method: z.ZodEnum<["economy", "standard"]>;
41
+ }, "strip", z.ZodTypeAny, {
42
+ method: "economy" | "standard";
43
+ }, {
44
+ method: "economy" | "standard";
45
+ }>;
46
+ export declare const paymentMethodSchema: z.ZodObject<{
47
+ cardNumber: z.ZodString;
48
+ expiryDate: z.ZodString;
49
+ cvv: z.ZodString;
50
+ nameOnCard: z.ZodString;
51
+ }, "strip", z.ZodTypeAny, {
52
+ cardNumber: string;
53
+ expiryDate: string;
54
+ cvv: string;
55
+ nameOnCard: string;
56
+ }, {
57
+ cardNumber: string;
58
+ expiryDate: string;
59
+ cvv: string;
60
+ nameOnCard: string;
61
+ }>;
62
+ export declare const checkoutSchema: z.ZodObject<{
63
+ customer: z.ZodObject<{
64
+ email: z.ZodString;
65
+ marketingConsent: z.ZodOptional<z.ZodBoolean>;
66
+ firstName: z.ZodOptional<z.ZodString>;
67
+ lastName: z.ZodString;
68
+ address: z.ZodString;
69
+ apartment: z.ZodOptional<z.ZodString>;
70
+ city: z.ZodString;
71
+ state: z.ZodString;
72
+ zipCode: z.ZodString;
73
+ country: z.ZodString;
74
+ saveInfo: z.ZodOptional<z.ZodBoolean>;
75
+ }, "strip", z.ZodTypeAny, {
76
+ email: string;
77
+ lastName: string;
78
+ address: string;
79
+ city: string;
80
+ state: string;
81
+ zipCode: string;
82
+ country: string;
83
+ marketingConsent?: boolean | undefined;
84
+ firstName?: string | undefined;
85
+ apartment?: string | undefined;
86
+ saveInfo?: boolean | undefined;
87
+ }, {
88
+ email: string;
89
+ lastName: string;
90
+ address: string;
91
+ city: string;
92
+ state: string;
93
+ zipCode: string;
94
+ country: string;
95
+ marketingConsent?: boolean | undefined;
96
+ firstName?: string | undefined;
97
+ apartment?: string | undefined;
98
+ saveInfo?: boolean | undefined;
99
+ }>;
100
+ shipping: z.ZodObject<{
101
+ method: z.ZodEnum<["economy", "standard"]>;
102
+ }, "strip", z.ZodTypeAny, {
103
+ method: "economy" | "standard";
104
+ }, {
105
+ method: "economy" | "standard";
106
+ }>;
107
+ payment: z.ZodObject<{
108
+ cardNumber: z.ZodString;
109
+ expiryDate: z.ZodString;
110
+ cvv: z.ZodString;
111
+ nameOnCard: z.ZodString;
112
+ }, "strip", z.ZodTypeAny, {
113
+ cardNumber: string;
114
+ expiryDate: string;
115
+ cvv: string;
116
+ nameOnCard: string;
117
+ }, {
118
+ cardNumber: string;
119
+ expiryDate: string;
120
+ cvv: string;
121
+ nameOnCard: string;
122
+ }>;
123
+ }, "strip", z.ZodTypeAny, {
124
+ customer: {
125
+ email: string;
126
+ lastName: string;
127
+ address: string;
128
+ city: string;
129
+ state: string;
130
+ zipCode: string;
131
+ country: string;
132
+ marketingConsent?: boolean | undefined;
133
+ firstName?: string | undefined;
134
+ apartment?: string | undefined;
135
+ saveInfo?: boolean | undefined;
136
+ };
137
+ shipping: {
138
+ method: "economy" | "standard";
139
+ };
140
+ payment: {
141
+ cardNumber: string;
142
+ expiryDate: string;
143
+ cvv: string;
144
+ nameOnCard: string;
145
+ };
146
+ }, {
147
+ customer: {
148
+ email: string;
149
+ lastName: string;
150
+ address: string;
151
+ city: string;
152
+ state: string;
153
+ zipCode: string;
154
+ country: string;
155
+ marketingConsent?: boolean | undefined;
156
+ firstName?: string | undefined;
157
+ apartment?: string | undefined;
158
+ saveInfo?: boolean | undefined;
159
+ };
160
+ shipping: {
161
+ method: "economy" | "standard";
162
+ };
163
+ payment: {
164
+ cardNumber: string;
165
+ expiryDate: string;
166
+ cvv: string;
167
+ nameOnCard: string;
168
+ };
169
+ }>;
170
+ export type CheckoutFormData = z.infer<typeof checkoutSchema>;
171
+ export type CustomerFormData = z.infer<typeof customerSchema>;
172
+ export type ShippingMethodFormData = z.infer<typeof shippingMethodSchema>;
173
+ export type PaymentMethodFormData = z.infer<typeof paymentMethodSchema>;
@@ -0,0 +1,9 @@
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 {};
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ import { type PaymentMethodFormData } from "../checkout-schema";
3
+ interface PaymentFormProps {
4
+ initialData?: PaymentMethodFormData;
5
+ onSubmit: (data: PaymentMethodFormData) => void;
6
+ onBack: () => void;
7
+ contactEmail: string;
8
+ shippingAddress: string;
9
+ shippingMethod: string;
10
+ shippingPrice: string;
11
+ }
12
+ export default function PaymentForm({ initialData, onSubmit, onBack, contactEmail, shippingAddress, shippingMethod, shippingPrice, }: PaymentFormProps): React.JSX.Element;
13
+ export {};
@@ -0,0 +1,11 @@
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 {};
@@ -0,0 +1 @@
1
+ export declare function useLocalStorage<T>(key: string, initialValue: T): [T, (value: T) => void];
@@ -0,0 +1,10 @@
1
+ import { type VariantProps } from "class-variance-authority";
2
+ import * as React from "react";
3
+ declare const buttonVariants: (props?: ({
4
+ variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
5
+ size?: "default" | "sm" | "lg" | "icon" | null | undefined;
6
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
7
+ declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
8
+ asChild?: boolean;
9
+ }): React.JSX.Element;
10
+ export { Button, buttonVariants };
@@ -0,0 +1,4 @@
1
+ import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
2
+ import * as React from "react";
3
+ declare function Checkbox({ className, ...props }: React.ComponentProps<typeof CheckboxPrimitive.Root>): React.JSX.Element;
4
+ export { Checkbox };
@@ -0,0 +1,24 @@
1
+ import * as LabelPrimitive from "@radix-ui/react-label";
2
+ import { Slot } from "@radix-ui/react-slot";
3
+ import * as React from "react";
4
+ import { type ControllerProps, type FieldPath, type FieldValues } from "react-hook-form";
5
+ declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues extends FieldValues | undefined = undefined>(props: import("react-hook-form").FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
6
+ declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => React.JSX.Element;
7
+ declare const useFormField: () => {
8
+ invalid: boolean;
9
+ isDirty: boolean;
10
+ isTouched: boolean;
11
+ isValidating: boolean;
12
+ error?: import("react-hook-form").FieldError;
13
+ id: string;
14
+ name: string;
15
+ formItemId: string;
16
+ formDescriptionId: string;
17
+ formMessageId: string;
18
+ };
19
+ declare function FormItem({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
20
+ declare function FormLabel({ className, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>): React.JSX.Element;
21
+ declare function FormControl({ ...props }: React.ComponentProps<typeof Slot>): React.JSX.Element;
22
+ declare function FormDescription({ className, ...props }: React.ComponentProps<"p">): React.JSX.Element;
23
+ declare function FormMessage({ className, ...props }: React.ComponentProps<"p">): React.JSX.Element | null;
24
+ export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField, };
@@ -0,0 +1,3 @@
1
+ import * as React from "react";
2
+ declare function Input({ className, type, ...props }: React.ComponentProps<"input">): React.JSX.Element;
3
+ export { Input };
@@ -0,0 +1,4 @@
1
+ import * as LabelPrimitive from "@radix-ui/react-label";
2
+ import * as React from "react";
3
+ declare function Label({ className, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>): React.JSX.Element;
4
+ export { Label };
@@ -0,0 +1,5 @@
1
+ import * as React from "react";
2
+ import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
3
+ declare function RadioGroup({ className, ...props }: React.ComponentProps<typeof RadioGroupPrimitive.Root>): React.JSX.Element;
4
+ declare function RadioGroupItem({ className, ...props }: React.ComponentProps<typeof RadioGroupPrimitive.Item>): React.JSX.Element;
5
+ export { RadioGroup, RadioGroupItem };
@@ -0,0 +1,13 @@
1
+ import * as SelectPrimitive from "@radix-ui/react-select";
2
+ import * as React from "react";
3
+ declare function Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>): React.JSX.Element;
4
+ declare function SelectGroup({ ...props }: React.ComponentProps<typeof SelectPrimitive.Group>): React.JSX.Element;
5
+ declare function SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>): React.JSX.Element;
6
+ declare function SelectTrigger({ className, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Trigger>): React.JSX.Element;
7
+ declare function SelectContent({ className, children, position, ...props }: React.ComponentProps<typeof SelectPrimitive.Content>): React.JSX.Element;
8
+ declare function SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>): React.JSX.Element;
9
+ declare function SelectItem({ className, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Item>): React.JSX.Element;
10
+ declare function SelectSeparator({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Separator>): React.JSX.Element;
11
+ declare function SelectScrollUpButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>): React.JSX.Element;
12
+ declare function SelectScrollDownButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>): React.JSX.Element;
13
+ export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, };