@wix/headless-stores 0.0.2 → 0.0.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/react/BuyNow.d.ts +8 -10
- package/dist/react/BuyNow.js +2 -4
- package/package.json +1 -1
package/dist/react/BuyNow.d.ts
CHANGED
|
@@ -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
|
|
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:
|
|
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
|
|
23
|
+
export interface BuyNowProps {
|
|
22
24
|
/** Render function that receives buy now state and actions */
|
|
23
|
-
children:
|
|
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>
|
package/dist/react/BuyNow.js
CHANGED
|
@@ -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>
|