@betterstore/react 0.7.1 → 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.
Files changed (123) hide show
  1. package/dist/components/checkout-embed/appearance.d.ts +1 -2
  2. package/dist/components/checkout-embed/checkout-form-loading.d.ts +0 -1
  3. package/dist/components/checkout-embed/checkout-form.d.ts +6 -6
  4. package/dist/components/checkout-embed/checkout-schema.d.ts +41 -34
  5. package/dist/components/checkout-embed/color-utils.d.ts +0 -1
  6. package/dist/components/checkout-embed/index.d.ts +4 -5
  7. package/dist/components/checkout-embed/steps/customer/address-utils.d.ts +1 -2
  8. package/dist/components/checkout-embed/steps/customer/form.d.ts +15 -10
  9. package/dist/components/checkout-embed/steps/payment/form.d.ts +29 -20
  10. package/dist/components/checkout-embed/steps/payment/icons.d.ts +0 -1
  11. package/dist/components/checkout-embed/steps/shipping/form.d.ts +29 -17
  12. package/dist/components/checkout-embed/steps/shipping/providers/zasilkovna.d.ts +1 -2
  13. package/dist/components/checkout-embed/steps/shipping/shipping-option-wrapper.d.ts +2 -3
  14. package/dist/components/checkout-embed/steps/summary/discount-code.d.ts +0 -1
  15. package/dist/components/checkout-embed/steps/summary/index.d.ts +1 -2
  16. package/dist/components/checkout-embed/steps/summary/loading.d.ts +0 -1
  17. package/dist/components/checkout-embed/useFormStore.d.ts +4 -5
  18. package/dist/components/{compounds/form → form}/address-input/country-data.d.ts +1 -1
  19. package/dist/components/form/address-input/index.d.ts +11 -0
  20. package/dist/components/{compounds/form → form}/address-input/province-data.d.ts +0 -1
  21. package/dist/components/form/compobox-controller/index.d.ts +17 -0
  22. package/dist/components/form/country-input/index.d.ts +10 -0
  23. package/dist/components/{compounds/form → form}/floating-label.d.ts +0 -1
  24. package/dist/components/{compounds/form → form}/form-messages.d.ts +0 -1
  25. package/dist/components/form/input-controller.d.ts +10 -0
  26. package/dist/components/form/phone-input/component.d.ts +8 -0
  27. package/dist/components/form/phone-input/index.d.ts +12 -0
  28. package/dist/components/form/phone-input/schema.d.ts +3 -0
  29. package/dist/components/{compounds/form → form}/submit-button.d.ts +1 -2
  30. package/dist/components/index.d.ts +3 -4
  31. package/dist/components/payment-element/checkout-form.d.ts +1 -2
  32. package/dist/components/payment-element/index.d.ts +3 -4
  33. package/dist/components/payment-element/useCheckout.d.ts +1 -2
  34. package/dist/components/ui/button.d.ts +3 -4
  35. package/dist/components/ui/checkbox.d.ts +1 -2
  36. package/dist/components/ui/command.d.ts +6 -5
  37. package/dist/components/ui/dialog.d.ts +3 -2
  38. package/dist/components/ui/dropdown-menu.d.ts +2 -3
  39. package/dist/components/ui/form.d.ts +6 -7
  40. package/dist/components/ui/input.d.ts +0 -1
  41. package/dist/components/ui/label.d.ts +1 -2
  42. package/dist/components/ui/popover.d.ts +2 -3
  43. package/dist/components/ui/radio-group.d.ts +1 -2
  44. package/dist/components/ui/scroll-area.d.ts +5 -0
  45. package/dist/components/ui/skeleton.d.ts +0 -2
  46. package/dist/components/ui/sonner.d.ts +1 -2
  47. package/dist/dev/dev.d.ts +0 -2
  48. package/dist/dev/generate-test-checkout.d.ts +1 -0
  49. package/dist/hooks/index.d.ts +1 -0
  50. package/dist/{components/cart/useCart.d.ts → hooks/use-cart.d.ts} +19 -2
  51. package/dist/i18n/index.d.ts +2 -4
  52. package/dist/index.cjs.js +67 -38483
  53. package/dist/index.d.ts +3 -3
  54. package/dist/index.es.js +31500 -0
  55. package/dist/lib/error-message-utils.d.ts +1 -2
  56. package/dist/lib/utils.d.ts +1 -2
  57. package/dist/stores/checkout-form-store.d.ts +24 -0
  58. package/dist/stores/index.d.ts +2 -0
  59. package/dist/stores/payment-checkout-store.d.ts +9 -0
  60. package/dist/types/checkout.d.ts +1 -0
  61. package/dist/types/index.d.ts +2 -0
  62. package/dist/types/locale.d.ts +2 -0
  63. package/dist/types.d.ts +1 -2
  64. package/dist/utils/address.d.ts +2 -0
  65. package/dist/utils/checkout.d.ts +4 -0
  66. package/dist/utils/error-message.d.ts +4 -0
  67. package/dist/utils/index.d.ts +4 -0
  68. package/dist/utils/payment.d.ts +7 -0
  69. package/package.json +25 -27
  70. package/dist/components/cart/useCart.d.ts.map +0 -1
  71. package/dist/components/checkout-embed/appearance.d.ts.map +0 -1
  72. package/dist/components/checkout-embed/checkout-form-loading.d.ts.map +0 -1
  73. package/dist/components/checkout-embed/checkout-form.d.ts.map +0 -1
  74. package/dist/components/checkout-embed/checkout-schema.d.ts.map +0 -1
  75. package/dist/components/checkout-embed/color-utils.d.ts.map +0 -1
  76. package/dist/components/checkout-embed/index.d.ts.map +0 -1
  77. package/dist/components/checkout-embed/steps/customer/address-utils.d.ts.map +0 -1
  78. package/dist/components/checkout-embed/steps/customer/form.d.ts.map +0 -1
  79. package/dist/components/checkout-embed/steps/payment/form.d.ts.map +0 -1
  80. package/dist/components/checkout-embed/steps/payment/icons.d.ts.map +0 -1
  81. package/dist/components/checkout-embed/steps/shipping/form.d.ts.map +0 -1
  82. package/dist/components/checkout-embed/steps/shipping/providers/zasilkovna.d.ts.map +0 -1
  83. package/dist/components/checkout-embed/steps/shipping/shipping-option-wrapper.d.ts.map +0 -1
  84. package/dist/components/checkout-embed/steps/summary/discount-code.d.ts.map +0 -1
  85. package/dist/components/checkout-embed/steps/summary/index.d.ts.map +0 -1
  86. package/dist/components/checkout-embed/steps/summary/loading.d.ts.map +0 -1
  87. package/dist/components/checkout-embed/useFormStore.d.ts.map +0 -1
  88. package/dist/components/compounds/form/address-input/country-data.d.ts.map +0 -1
  89. package/dist/components/compounds/form/address-input/index.d.ts +0 -12
  90. package/dist/components/compounds/form/address-input/index.d.ts.map +0 -1
  91. package/dist/components/compounds/form/address-input/province-data.d.ts.map +0 -1
  92. package/dist/components/compounds/form/compobox-group/index.d.ts +0 -18
  93. package/dist/components/compounds/form/compobox-group/index.d.ts.map +0 -1
  94. package/dist/components/compounds/form/country-input/index.d.ts +0 -11
  95. package/dist/components/compounds/form/country-input/index.d.ts.map +0 -1
  96. package/dist/components/compounds/form/floating-label.d.ts.map +0 -1
  97. package/dist/components/compounds/form/form-messages.d.ts.map +0 -1
  98. package/dist/components/compounds/form/input-group.d.ts +0 -11
  99. package/dist/components/compounds/form/input-group.d.ts.map +0 -1
  100. package/dist/components/compounds/form/submit-button.d.ts.map +0 -1
  101. package/dist/components/index.d.ts.map +0 -1
  102. package/dist/components/payment-element/checkout-form.d.ts.map +0 -1
  103. package/dist/components/payment-element/index.d.ts.map +0 -1
  104. package/dist/components/payment-element/useCheckout.d.ts.map +0 -1
  105. package/dist/components/ui/button.d.ts.map +0 -1
  106. package/dist/components/ui/checkbox.d.ts.map +0 -1
  107. package/dist/components/ui/command.d.ts.map +0 -1
  108. package/dist/components/ui/dialog.d.ts.map +0 -1
  109. package/dist/components/ui/dropdown-menu.d.ts.map +0 -1
  110. package/dist/components/ui/form.d.ts.map +0 -1
  111. package/dist/components/ui/input.d.ts.map +0 -1
  112. package/dist/components/ui/label.d.ts.map +0 -1
  113. package/dist/components/ui/popover.d.ts.map +0 -1
  114. package/dist/components/ui/radio-group.d.ts.map +0 -1
  115. package/dist/components/ui/skeleton.d.ts.map +0 -1
  116. package/dist/components/ui/sonner.d.ts.map +0 -1
  117. package/dist/dev/dev.d.ts.map +0 -1
  118. package/dist/i18n/index.d.ts.map +0 -1
  119. package/dist/index.d.ts.map +0 -1
  120. package/dist/index.mjs +0 -38461
  121. package/dist/lib/error-message-utils.d.ts.map +0 -1
  122. package/dist/lib/utils.d.ts.map +0 -1
  123. package/dist/types.d.ts.map +0 -1
@@ -1,6 +1,6 @@
1
- import { Appearance, StripeElementLocale } from "@stripe/stripe-js";
2
- import React from "react";
3
- import { Fonts } from "../checkout-embed/appearance";
1
+ import { Appearance, StripeElementLocale } from '@stripe/stripe-js';
2
+ import { default as React } from 'react';
3
+ import { Fonts } from '../checkout-embed/appearance';
4
4
  declare function PaymentElement({ paymentSecret, publicKey, checkoutAppearance, locale, fonts, onSuccess, onError, children, setSubmitting, }: {
5
5
  paymentSecret: string;
6
6
  publicKey: string | null;
@@ -14,4 +14,3 @@ declare function PaymentElement({ paymentSecret, publicKey, checkoutAppearance,
14
14
  }): import("react/jsx-runtime").JSX.Element;
15
15
  declare const _default: React.MemoExoticComponent<typeof PaymentElement>;
16
16
  export default _default;
17
- //# sourceMappingURL=index.d.ts.map
@@ -5,6 +5,5 @@ interface CheckoutStore {
5
5
  paymentMethod: PaymentMethodType;
6
6
  setPaymentMethod: (paymentMethod: PaymentMethodType) => void;
7
7
  }
8
- export declare const useCheckout: import("zustand").UseBoundStore<import("zustand").StoreApi<CheckoutStore>>;
8
+ export declare const useCheckout: import('zustand').UseBoundStore<import('zustand').StoreApi<CheckoutStore>>;
9
9
  export {};
10
- //# sourceMappingURL=useCheckout.d.ts.map
@@ -1,11 +1,10 @@
1
- import { type VariantProps } from "class-variance-authority";
1
+ import { VariantProps } from 'class-variance-authority';
2
2
  import * as React from "react";
3
3
  declare const buttonVariants: (props?: ({
4
4
  variant?: "link" | "outline" | "default" | "destructive" | "secondary" | "ghost" | null | undefined;
5
- size?: "link" | "default" | "sm" | "lg" | "icon" | null | undefined;
6
- } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
5
+ size?: "link" | "default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg" | null | undefined;
6
+ } & import('class-variance-authority/dist/types').ClassProp) | undefined) => string;
7
7
  declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
8
8
  asChild?: boolean;
9
9
  }): import("react/jsx-runtime").JSX.Element;
10
10
  export { Button, buttonVariants };
11
- //# sourceMappingURL=button.d.ts.map
@@ -1,5 +1,4 @@
1
- import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
2
1
  import * as React from "react";
2
+ import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
3
3
  declare function Checkbox({ className, ...props }: React.ComponentProps<typeof CheckboxPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
4
4
  export { Checkbox };
5
- //# sourceMappingURL=checkbox.d.ts.map
@@ -1,10 +1,12 @@
1
- import { Command as CommandPrimitive } from "cmdk";
1
+ import { Command as CommandPrimitive } from 'cmdk';
2
+ import { Dialog } from './dialog';
2
3
  import * as React from "react";
3
- import { Dialog } from "@/react/components/ui/dialog";
4
4
  declare function Command({ className, ...props }: React.ComponentProps<typeof CommandPrimitive>): import("react/jsx-runtime").JSX.Element;
5
- declare function CommandDialog({ title, description, children, ...props }: React.ComponentProps<typeof Dialog> & {
5
+ declare function CommandDialog({ title, description, children, className, showCloseButton, ...props }: React.ComponentProps<typeof Dialog> & {
6
6
  title?: string;
7
7
  description?: string;
8
+ className?: string;
9
+ showCloseButton?: boolean;
8
10
  }): import("react/jsx-runtime").JSX.Element;
9
11
  declare function CommandInput({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Input>): import("react/jsx-runtime").JSX.Element;
10
12
  declare function CommandList({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.List>): import("react/jsx-runtime").JSX.Element;
@@ -13,5 +15,4 @@ declare function CommandGroup({ className, ...props }: React.ComponentProps<type
13
15
  declare function CommandSeparator({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Separator>): import("react/jsx-runtime").JSX.Element;
14
16
  declare function CommandItem({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Item>): import("react/jsx-runtime").JSX.Element;
15
17
  declare function CommandShortcut({ className, ...props }: React.ComponentProps<"span">): import("react/jsx-runtime").JSX.Element;
16
- export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, };
17
- //# sourceMappingURL=command.d.ts.map
18
+ export { Command, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandShortcut, CommandSeparator, };
@@ -5,10 +5,11 @@ declare function DialogTrigger({ ...props }: React.ComponentProps<typeof DialogP
5
5
  declare function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
6
6
  declare function DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>): import("react/jsx-runtime").JSX.Element;
7
7
  declare function DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>): import("react/jsx-runtime").JSX.Element;
8
- declare function DialogContent({ className, children, ...props }: React.ComponentProps<typeof DialogPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
8
+ declare function DialogContent({ className, children, showCloseButton, ...props }: React.ComponentProps<typeof DialogPrimitive.Content> & {
9
+ showCloseButton?: boolean;
10
+ }): import("react/jsx-runtime").JSX.Element;
9
11
  declare function DialogHeader({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
10
12
  declare function DialogFooter({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
11
13
  declare function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>): import("react/jsx-runtime").JSX.Element;
12
14
  declare function DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>): import("react/jsx-runtime").JSX.Element;
13
15
  export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
14
- //# sourceMappingURL=dialog.d.ts.map
@@ -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, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, };
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 * as LabelPrimitive from "@radix-ui/react-label";
2
- import { Slot } from "@radix-ui/react-slot";
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 { type ControllerProps, type FieldPath, type FieldValues } from "react-hook-form";
5
- declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>(props: import("react-hook-form").FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
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("react-hook-form").FieldError;
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 { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField, };
25
- //# sourceMappingURL=form.d.ts.map
24
+ export { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField, };
@@ -1,4 +1,3 @@
1
1
  import * as React from "react";
2
2
  declare function Input({ className, type, ...props }: React.ComponentProps<"input">): import("react/jsx-runtime").JSX.Element;
3
3
  export { Input };
4
- //# sourceMappingURL=input.d.ts.map
@@ -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, PopoverAnchor, PopoverContent, PopoverTrigger };
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 };
@@ -1,4 +1,2 @@
1
- import * as React from "react";
2
1
  declare function Skeleton({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
3
2
  export { Skeleton };
4
- //# sourceMappingURL=skeleton.d.ts.map
@@ -1,4 +1,3 @@
1
- import { ToasterProps } from "sonner";
1
+ import { ToasterProps } from 'sonner';
2
2
  declare const Toaster: ({ ...props }: ToasterProps) => import("react/jsx-runtime").JSX.Element;
3
3
  export { Toaster };
4
- //# sourceMappingURL=sonner.d.ts.map
package/dist/dev/dev.d.ts CHANGED
@@ -1,2 +0,0 @@
1
- import "../globals.css";
2
- //# sourceMappingURL=dev.d.ts.map
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export * from './use-cart';
@@ -1,10 +1,16 @@
1
- import { CreateCheckoutParams, InferProduct } from "@betterstore/sdk";
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
@@ -1,5 +1,3 @@
1
- import { CheckoutLocale } from "@stripe/stripe-js";
2
- export type Locale = CheckoutLocale;
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