@betterstore/react 0.7.2 → 0.7.3
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/dist/components/checkout-embed/appearance.d.ts +1 -2
- package/dist/components/checkout-embed/checkout-form-loading.d.ts +0 -1
- package/dist/components/checkout-embed/checkout-form.d.ts +3 -4
- package/dist/components/checkout-embed/checkout-schema.d.ts +13 -14
- package/dist/components/checkout-embed/color-utils.d.ts +0 -1
- package/dist/components/checkout-embed/index.d.ts +3 -4
- package/dist/components/checkout-embed/steps/customer/address-utils.d.ts +1 -2
- package/dist/components/checkout-embed/steps/customer/form.d.ts +15 -10
- package/dist/components/checkout-embed/steps/payment/form.d.ts +29 -20
- package/dist/components/checkout-embed/steps/payment/icons.d.ts +0 -1
- package/dist/components/checkout-embed/steps/shipping/form.d.ts +29 -17
- package/dist/components/checkout-embed/steps/shipping/providers/zasilkovna.d.ts +1 -2
- package/dist/components/checkout-embed/steps/shipping/shipping-option-wrapper.d.ts +2 -3
- package/dist/components/checkout-embed/steps/summary/discount-code.d.ts +0 -1
- package/dist/components/checkout-embed/steps/summary/index.d.ts +1 -2
- package/dist/components/checkout-embed/steps/summary/loading.d.ts +0 -1
- package/dist/components/checkout-embed/useFormStore.d.ts +4 -5
- package/dist/components/{compounds/form → form}/address-input/country-data.d.ts +1 -1
- package/dist/components/{compounds/form → form}/address-input/index.d.ts +0 -1
- package/dist/components/{compounds/form → form}/address-input/province-data.d.ts +0 -1
- package/dist/components/form/compobox-controller/index.d.ts +17 -0
- package/dist/components/form/country-input/index.d.ts +10 -0
- package/dist/components/{compounds/form → form}/floating-label.d.ts +0 -1
- package/dist/components/{compounds/form → form}/form-messages.d.ts +0 -1
- package/dist/components/form/input-controller.d.ts +10 -0
- package/dist/components/form/phone-input/component.d.ts +8 -0
- package/dist/components/form/phone-input/index.d.ts +12 -0
- package/dist/components/form/phone-input/schema.d.ts +3 -0
- package/dist/components/{compounds/form → form}/submit-button.d.ts +1 -2
- package/dist/components/index.d.ts +3 -4
- package/dist/components/payment-element/checkout-form.d.ts +1 -2
- package/dist/components/payment-element/index.d.ts +3 -4
- package/dist/components/payment-element/useCheckout.d.ts +1 -2
- package/dist/components/ui/button.d.ts +3 -4
- package/dist/components/ui/checkbox.d.ts +1 -2
- package/dist/components/ui/command.d.ts +6 -5
- package/dist/components/ui/dialog.d.ts +3 -2
- package/dist/components/ui/dropdown-menu.d.ts +2 -3
- package/dist/components/ui/form.d.ts +6 -7
- package/dist/components/ui/input.d.ts +0 -1
- package/dist/components/ui/label.d.ts +1 -2
- package/dist/components/ui/popover.d.ts +2 -3
- package/dist/components/ui/radio-group.d.ts +1 -2
- package/dist/components/ui/scroll-area.d.ts +5 -0
- package/dist/components/ui/skeleton.d.ts +0 -2
- package/dist/components/ui/sonner.d.ts +1 -2
- package/dist/dev/dev.d.ts +0 -2
- package/dist/dev/generate-test-checkout.d.ts +0 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/{components/cart/useCart.d.ts → hooks/use-cart.d.ts} +19 -2
- package/dist/i18n/index.d.ts +2 -4
- package/dist/index.cjs.js +67 -38497
- package/dist/index.d.ts +3 -3
- package/dist/index.es.js +31500 -0
- package/dist/lib/error-message-utils.d.ts +1 -2
- package/dist/lib/utils.d.ts +1 -2
- package/dist/stores/checkout-form-store.d.ts +24 -0
- package/dist/stores/index.d.ts +2 -0
- package/dist/stores/payment-checkout-store.d.ts +9 -0
- package/dist/types/checkout.d.ts +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/locale.d.ts +2 -0
- package/dist/types.d.ts +1 -2
- package/dist/utils/address.d.ts +2 -0
- package/dist/utils/checkout.d.ts +4 -0
- package/dist/utils/error-message.d.ts +4 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/payment.d.ts +7 -0
- package/package.json +22 -27
- package/dist/components/cart/useCart.d.ts.map +0 -1
- package/dist/components/checkout-embed/appearance.d.ts.map +0 -1
- package/dist/components/checkout-embed/checkout-form-loading.d.ts.map +0 -1
- package/dist/components/checkout-embed/checkout-form.d.ts.map +0 -1
- package/dist/components/checkout-embed/checkout-schema.d.ts.map +0 -1
- package/dist/components/checkout-embed/color-utils.d.ts.map +0 -1
- package/dist/components/checkout-embed/index.d.ts.map +0 -1
- package/dist/components/checkout-embed/steps/customer/address-utils.d.ts.map +0 -1
- package/dist/components/checkout-embed/steps/customer/form.d.ts.map +0 -1
- package/dist/components/checkout-embed/steps/payment/form.d.ts.map +0 -1
- package/dist/components/checkout-embed/steps/payment/icons.d.ts.map +0 -1
- package/dist/components/checkout-embed/steps/shipping/form.d.ts.map +0 -1
- package/dist/components/checkout-embed/steps/shipping/providers/zasilkovna.d.ts.map +0 -1
- package/dist/components/checkout-embed/steps/shipping/shipping-option-wrapper.d.ts.map +0 -1
- package/dist/components/checkout-embed/steps/summary/discount-code.d.ts.map +0 -1
- package/dist/components/checkout-embed/steps/summary/index.d.ts.map +0 -1
- package/dist/components/checkout-embed/steps/summary/loading.d.ts.map +0 -1
- package/dist/components/checkout-embed/useFormStore.d.ts.map +0 -1
- package/dist/components/compounds/form/address-input/country-data.d.ts.map +0 -1
- package/dist/components/compounds/form/address-input/index.d.ts.map +0 -1
- package/dist/components/compounds/form/address-input/province-data.d.ts.map +0 -1
- package/dist/components/compounds/form/compobox-group/index.d.ts +0 -18
- package/dist/components/compounds/form/compobox-group/index.d.ts.map +0 -1
- package/dist/components/compounds/form/country-input/index.d.ts +0 -11
- package/dist/components/compounds/form/country-input/index.d.ts.map +0 -1
- package/dist/components/compounds/form/floating-label.d.ts.map +0 -1
- package/dist/components/compounds/form/form-messages.d.ts.map +0 -1
- package/dist/components/compounds/form/input-group.d.ts +0 -11
- package/dist/components/compounds/form/input-group.d.ts.map +0 -1
- package/dist/components/compounds/form/submit-button.d.ts.map +0 -1
- package/dist/components/index.d.ts.map +0 -1
- package/dist/components/payment-element/checkout-form.d.ts.map +0 -1
- package/dist/components/payment-element/index.d.ts.map +0 -1
- package/dist/components/payment-element/useCheckout.d.ts.map +0 -1
- package/dist/components/ui/button.d.ts.map +0 -1
- package/dist/components/ui/checkbox.d.ts.map +0 -1
- package/dist/components/ui/command.d.ts.map +0 -1
- package/dist/components/ui/dialog.d.ts.map +0 -1
- package/dist/components/ui/dropdown-menu.d.ts.map +0 -1
- package/dist/components/ui/form.d.ts.map +0 -1
- package/dist/components/ui/input.d.ts.map +0 -1
- package/dist/components/ui/label.d.ts.map +0 -1
- package/dist/components/ui/popover.d.ts.map +0 -1
- package/dist/components/ui/radio-group.d.ts.map +0 -1
- package/dist/components/ui/skeleton.d.ts.map +0 -1
- package/dist/components/ui/sonner.d.ts.map +0 -1
- package/dist/dev/dev-data.d.ts +0 -5
- package/dist/dev/dev-data.d.ts.map +0 -1
- package/dist/dev/dev.d.ts.map +0 -1
- package/dist/dev/generate-test-checkout.d.ts.map +0 -1
- package/dist/i18n/index.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.mjs +0 -38475
- package/dist/lib/error-message-utils.d.ts.map +0 -1
- package/dist/lib/utils.d.ts.map +0 -1
- package/dist/types.d.ts.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
2
1
|
import * as React from "react";
|
|
2
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
3
3
|
declare function DropdownMenu({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
declare function DropdownMenuPortal({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
declare function DropdownMenuTrigger({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -22,5 +22,4 @@ declare function DropdownMenuSubTrigger({ className, inset, children, ...props }
|
|
|
22
22
|
inset?: boolean;
|
|
23
23
|
}): import("react/jsx-runtime").JSX.Element;
|
|
24
24
|
declare function DropdownMenuSubContent({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>): import("react/jsx-runtime").JSX.Element;
|
|
25
|
-
export { DropdownMenu,
|
|
26
|
-
//# sourceMappingURL=dropdown-menu.d.ts.map
|
|
25
|
+
export { DropdownMenu, DropdownMenuPortal, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
2
|
+
import { ControllerProps, FieldPath, FieldValues } from 'react-hook-form';
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import
|
|
5
|
-
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>(props: import(
|
|
4
|
+
import type * as LabelPrimitive from "@radix-ui/react-label";
|
|
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>) => import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
declare const useFormField: () => {
|
|
8
8
|
invalid: boolean;
|
|
9
9
|
isDirty: boolean;
|
|
10
10
|
isTouched: boolean;
|
|
11
11
|
isValidating: boolean;
|
|
12
|
-
error?: import(
|
|
12
|
+
error?: import('react-hook-form').FieldError;
|
|
13
13
|
id: string;
|
|
14
14
|
name: string;
|
|
15
15
|
formItemId: string;
|
|
@@ -21,5 +21,4 @@ declare function FormLabel({ className, ...props }: React.ComponentProps<typeof
|
|
|
21
21
|
declare function FormControl({ ...props }: React.ComponentProps<typeof Slot>): import("react/jsx-runtime").JSX.Element;
|
|
22
22
|
declare function FormDescription({ className, ...props }: React.ComponentProps<"p">): import("react/jsx-runtime").JSX.Element;
|
|
23
23
|
declare function FormMessage({ className, ...props }: React.ComponentProps<"p">): import("react/jsx-runtime").JSX.Element | null;
|
|
24
|
-
export {
|
|
25
|
-
//# sourceMappingURL=form.d.ts.map
|
|
24
|
+
export { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField, };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
2
1
|
import * as React from "react";
|
|
2
|
+
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
3
3
|
declare function Label({ className, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export { Label };
|
|
5
|
-
//# sourceMappingURL=label.d.ts.map
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
2
1
|
import * as React from "react";
|
|
2
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
3
3
|
declare function Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
declare function PopoverTrigger({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
declare function PopoverContent({ className, align, sideOffset, ...props }: React.ComponentProps<typeof PopoverPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
declare function PopoverAnchor({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Anchor>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export { Popover,
|
|
8
|
-
//# sourceMappingURL=popover.d.ts.map
|
|
7
|
+
export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
|
2
1
|
import * as React from "react";
|
|
2
|
+
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
|
3
3
|
declare function RadioGroup({ className, ...props }: React.ComponentProps<typeof RadioGroupPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
declare function RadioGroupItem({ className, ...props }: React.ComponentProps<typeof RadioGroupPrimitive.Item>): import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
export { RadioGroup, RadioGroupItem };
|
|
6
|
-
//# sourceMappingURL=radio-group.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
3
|
+
declare function ScrollArea({ className, children, ...props }: React.ComponentProps<typeof ScrollAreaPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function ScrollBar({ className, orientation, ...props }: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export { ScrollArea, ScrollBar };
|
package/dist/dev/dev.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './use-cart';
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import { CreateCheckoutParams, InferProduct } from
|
|
1
|
+
import { CreateCheckoutParams, InferProduct } from '@betterstore/sdk';
|
|
2
2
|
type SDKLineItemCreate = CreateCheckoutParams["lineItems"][number];
|
|
3
|
+
/**
|
|
4
|
+
* Utility type to pick required arguments from a type while making others optional
|
|
5
|
+
*/
|
|
3
6
|
type PickRequiredArguments<RequiredArgumentKeys extends string[], T extends object> = {
|
|
4
7
|
[K in keyof T as K extends RequiredArgumentKeys[number] ? K : never]: T[K];
|
|
5
8
|
} & {
|
|
6
9
|
[K in keyof T as K extends RequiredArgumentKeys[number] ? never : K]?: T[K];
|
|
7
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* Default product type for line items - requires id, makes productVariants optional
|
|
13
|
+
*/
|
|
8
14
|
type DefaultLineItemCreateProductType = PickRequiredArguments<[
|
|
9
15
|
"id"
|
|
10
16
|
], InferProduct> & {
|
|
@@ -16,6 +22,9 @@ type DefaultLineItemCreateProductType = PickRequiredArguments<[
|
|
|
16
22
|
};
|
|
17
23
|
}>["productVariants"][number]>[];
|
|
18
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* Optional parameters that can be passed when adding an item to the cart
|
|
27
|
+
*/
|
|
19
28
|
type LineItemOptionalParams = {
|
|
20
29
|
quantity?: number;
|
|
21
30
|
variantOptions?: {
|
|
@@ -24,12 +33,18 @@ type LineItemOptionalParams = {
|
|
|
24
33
|
}[];
|
|
25
34
|
metadata?: Record<string, any>;
|
|
26
35
|
};
|
|
36
|
+
/**
|
|
37
|
+
* Represents a single line item in the cart
|
|
38
|
+
*/
|
|
27
39
|
export interface CartLineItem<ProductType extends DefaultLineItemCreateProductType = DefaultLineItemCreateProductType> extends Pick<SDKLineItemCreate & {
|
|
28
40
|
productData: ProductType;
|
|
29
41
|
}, "metadata" | "quantity" | "variantOptions" | "productId" | "productData"> {
|
|
30
42
|
id: string;
|
|
31
43
|
selectedVariant: NonNullable<NonNullable<ProductType["productVariants"]>[number]> | null;
|
|
32
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Cart interface with all cart operations
|
|
47
|
+
*/
|
|
33
48
|
export interface Cart<ProductType extends DefaultLineItemCreateProductType = DefaultLineItemCreateProductType> {
|
|
34
49
|
lineItems: CartLineItem<ProductType>[];
|
|
35
50
|
addItem: (product: ProductType, additionalParams?: LineItemOptionalParams) => void;
|
|
@@ -38,6 +53,8 @@ export interface Cart<ProductType extends DefaultLineItemCreateProductType = Def
|
|
|
38
53
|
getProductQuantity: (productId: string) => number;
|
|
39
54
|
clearCart: () => void;
|
|
40
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Hook to access the cart store
|
|
58
|
+
*/
|
|
41
59
|
export declare const useCart: <ProductType extends DefaultLineItemCreateProductType = DefaultLineItemCreateProductType>() => Cart<ProductType>;
|
|
42
60
|
export {};
|
|
43
|
-
//# sourceMappingURL=useCart.d.ts.map
|
package/dist/i18n/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
declare const createI18nInstance: (locale?: Locale) => Promise<import("i18next").i18n>;
|
|
1
|
+
import { Locale } from '../types';
|
|
2
|
+
declare const createI18nInstance: (locale?: Locale) => Promise<import('i18next').i18n>;
|
|
4
3
|
export default createI18nInstance;
|
|
5
|
-
//# sourceMappingURL=index.d.ts.map
|