Files
zeekayandHanzo Dev 57f9435929 Keep every package in one directory
The workspace declared pkg/* and pkgs/* both, so one repo had two names
for one concept and a package's home was a coin toss. The shared build
tooling already lived in pkg/ui/scripts and pkgs reached back into it
two levels up; now it is a sibling. hanzo.yml gates on pkg/ui, so the
published library stays where CI already looks and the rest joins it.

The publish glob follows: one root, one pattern, nothing invisible to it.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-08 23:50:28 -07:00

71 lines
1.5 KiB
TypeScript

/**
* @hanzo/checkout
*
* Embeddable checkout widget for Hanzo Commerce
* Similar to Stripe Checkout
*
* Usage:
*
* 1. React Integration:
* ```tsx
* import { CheckoutProvider, CheckoutForm, useCheckout } from '@hanzo/checkout'
*
* function App() {
* return (
* <CheckoutProvider options={{ apiKey: 'pk_live_xxx' }}>
* <CheckoutForm />
* </CheckoutProvider>
* )
* }
* ```
*
* 2. Vanilla JS / Redirect:
* ```ts
* import { createCheckout } from '@hanzo/checkout'
*
* const checkout = createCheckout({ apiKey: 'pk_live_xxx' })
* const session = await checkout.createSession({
* lineItems: [{ name: 'Product', unitPrice: 1999, quantity: 1 }]
* })
* checkout.redirectToCheckout(session.id)
* ```
*
* 3. Embed Script (no build step):
* ```html
* <script src="https://js.hanzo.ai/checkout.js"></script>
* <button data-hanzo-checkout data-hanzo-key="pk_live_xxx" data-hanzo-amount="1999">
* Pay $19.99
* </button>
* <script>
* HanzoCheckout.init('pk_live_xxx')
* </script>
* ```
*/
// Types
export type {
CheckoutOptions,
CheckoutAppearance,
CheckoutSession,
CheckoutLineItem,
CheckoutCustomer,
CheckoutAddress,
CheckoutPaymentMethod,
CheckoutResult,
CheckoutError,
CreateSessionParams,
ElementsOptions,
CheckoutStep,
CheckoutState
} from './types'
// Client
export { HanzoCheckout, createCheckout } from './client'
// Hooks
export { CheckoutProvider, useCheckout } from './hooks'
export type { CheckoutProviderProps } from './hooks'
// Elements
export { CheckoutForm } from './elements'