@agentpost-tools/resourceshark-react
v0.1.2
Published
React bindings for resourceshark's hold and booking workflows, for the web and native apps.
Readme
ResourceShark React
React hooks for ResourceShark's hold and booking workflows. The hooks render nothing and work in React 19, React Native, and Expo.
npm i @agentpost-tools/resourceshark-react @agentpost-tools/resourceshark-sdk reactYou need an Agentpost workspace and a project key for a project that uses ResourceShark. The page places a hold through an endpoint on your own server, which holds the project's secret key:
import { useHoldWorkflow } from '@agentpost-tools/resourceshark-react';
import { endpointTransport } from '@agentpost-tools/resourceshark-sdk/workflows';
interface Booking {
courtId: string;
start: string;
}
const transport = endpointTransport<Booking>({ url: '/api/booking' });
export function HoldButton({ booking }: { booking: Booking }) {
const hold = useHoldWorkflow(transport);
if (hold.step === 'held') return <p>Held for {hold.secondsLeft} seconds</p>;
return (
<button disabled={hold.pending} onClick={() => void hold.place(booking)}>
Hold
</button>
);
}ResourceShark SDK docs cover the hooks and workflows.
On 0.x, changes that break existing exports, types, or hook behavior bump the minor version; other changes bump the patch.
Proprietary: use with Agentpost's hosted services under LICENSE.md.
