@wix/headless-stores 0.0.2 → 0.0.4

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.
@@ -1,36 +1,34 @@
1
+ export type RedirectToCheckout = () => void;
1
2
  /**
2
3
  * Props passed to the render function of the BuyNow component
3
4
  */
4
- export type BuyNowRenderProps = {
5
+ export interface BuyNowRenderProps {
5
6
  /** Whether the buy now operation is currently loading */
6
7
  isLoading: boolean;
7
8
  /** The name of the product being purchased */
8
9
  productName: string;
9
10
  /** Function to redirect the user to the checkout page */
10
- redirectToCheckout: () => void;
11
+ redirectToCheckout: RedirectToCheckout;
11
12
  /** The error message if the buy now operation fails */
12
13
  error: string | null;
13
14
  /** The price of the product being purchased */
14
15
  price: string;
15
16
  /** The currency of the product being purchased */
16
17
  currency: string;
17
- };
18
+ }
19
+ export type BuyNowChildren = (props: BuyNowRenderProps) => React.ReactNode;
18
20
  /**
19
21
  * Props for the BuyNow component
20
22
  */
21
- export type BuyNowProps = {
23
+ export interface BuyNowProps {
22
24
  /** Render function that receives buy now state and actions */
23
- children: (props: BuyNowRenderProps) => React.ReactNode;
24
- };
25
+ children: BuyNowChildren;
26
+ }
25
27
  /**
26
28
  * A headless component that provides buy now functionality using the render props pattern.
27
29
  *
28
30
  * This component manages the state and actions for a "buy now" flow, allowing consumers
29
31
  * to render their own UI while accessing the underlying buy now functionality.
30
- *
31
- * @param props - The component props
32
- * @returns The rendered children with buy now state and actions
33
- *
34
32
  * @example
35
33
  * ```tsx
36
34
  * <BuyNow>
@@ -1,14 +1,12 @@
1
1
  import { useService } from "@wix/services-manager-react";
2
2
  import { BuyNowServiceDefinition } from "../services/buy-now-service";
3
+ ;
4
+ ;
3
5
  /**
4
6
  * A headless component that provides buy now functionality using the render props pattern.
5
7
  *
6
8
  * This component manages the state and actions for a "buy now" flow, allowing consumers
7
9
  * to render their own UI while accessing the underlying buy now functionality.
8
- *
9
- * @param props - The component props
10
- * @returns The rendered children with buy now state and actions
11
- *
12
10
  * @example
13
11
  * ```tsx
14
12
  * <BuyNow>
@@ -1 +1 @@
1
- export { BuyNow } from "./BuyNow";
1
+ export * from "./BuyNow";
@@ -1 +1 @@
1
- export { BuyNow } from "./BuyNow";
1
+ export * from "./BuyNow";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/headless-stores",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "scripts": {
5
5
  "build": "tsc",
6
6
  "test": "vitest"