@intunix/react
v0.1.14
Published
React binding for the [Intunix](https://intunix.com) experience platform — in-app surveys, NPS, CSAT, and feedback forms with triggers, targeting, and analytics.
Readme
@intunix/react
React binding for the Intunix experience platform — in-app surveys, NPS, CSAT, and feedback forms with triggers, targeting, and analytics.
Install
npm install @intunix/react @intunix/coreUsage
Wrap your app once. <IntunixProvider> creates the client and mounts the
experience host.
import { IntunixProvider } from '@intunix/react';
export function Root() {
return (
// Register globally (optional) — these go live as soon as the SDK loads.
<IntunixProvider apiKey="pk_live_xxx" config={{ register: ['welcome'] }}>
<App />
</IntunixProvider>
);
}A form shows in one of two ways. Register it to auto-show when its trigger
(URL, event, time…) matches — useRegisterForm makes it live while the
component is mounted, so it only fires on the right screen:
import { useRegisterForm } from '@intunix/react';
function PricingPage() {
useRegisterForm('pricing_survey'); // opens automatically when its trigger matches
return <Pricing />;
}Or open one manually from a click:
import { useTrack, useExperience } from '@intunix/react';
function Checkout() {
const track = useTrack();
const nps = useExperience('nps_q4');
return (
<button onClick={() => { track('checkout_done'); nps.show(); }}>
Pay
</button>
);
}Only one form is on screen at a time — if several match at once they queue and show in sequence. URL-triggered forms wait
urlTriggerDelayMs(default 600).
Inline forms
Render a feedback form in normal document flow (hosted pages, builder previews):
import { FeedbackForm } from '@intunix/react';
<FeedbackForm content={formContent} onComplete={(r) => console.log(r)} />API
<IntunixProvider apiKey config? components? renderExperience?>— setup + host.useIntunix()— theIntunixClient.useTrack()/useIdentify()— event + identity helpers.useRegisterForm(idOrSlug)— register on mount / unregister on unmount.useExperience(idOrSlug)—{ show }to open a form by id or slug.useActiveExperiences()— currently-shown experiences.<FeedbackForm>,<ExperienceHost>, and step/Header/Footer/Thanksoverrides.
License
Proprietary © Intunix.
