1.1.3 • Published 5 months ago
resubscribe-react-sdk v1.1.3
Resubscribe React SDK
The official React SDK for Resubscribe.
Setup
Install
npm install resubscribe-react-sdk
Usage
Mount the component and then trigger the Resubscribe modal with the openWithConsent
method. Replace the placeholders with your own values.
import Resubscribe from 'resubscribe-react-sdk';
export default function Home() {
const onTrigger = () => {
Resubscribe.openWithConsent({
slug: '{organization-slug}',
apiKey: '{api-key}',
aiType: '{ai-type}',
userId: '{uid}',
userEmail: '{optionalEmail}',
colors: {
primary: 'blue',
background: '#eee',
text: '#333',
},
onClose: (via) => {
//
},
});
};
return (
<main>
...
<Resubscribe.Component />
</main>
)
}
Headless
You can alternatively use the headless version of the SDK.
import Resubscribe, { ResubscribeOptions } from 'resubscribe-react-sdk';
export default function Home() {
const onOpenConsent = async () => {
Resubscribe.headless.setOptions({
slug: '{organization-slug}',
apiKey: '{api-key}',
aiType: '{ai-type}',
userId: '{uid}',
userEmail: '{optionalEmail}',
});
Resubscribe.headless.registerConsentRequest();
// Open your own consent modal here 👇
const confirmed = await confirm(...);
if (confirmed) {
Resubscribe.headless.openChat({
onClose: (via: any) => {
console.log('onClose', via);
},
classNames: {
overlay: styles.overlay,
},
});
}
};
return (
<main>
...
<Resubscribe.Component />
</main>
)
}
1.1.3
5 months ago
1.1.2
11 months ago
1.1.1
11 months ago
1.1.0
11 months ago
1.0.7
12 months ago
1.0.7-beta.1
12 months ago
1.0.6
1 year ago
1.0.5
1 year ago
1.0.5-beta.1
1 year ago
1.0.4
1 year ago
1.0.4-beta.1
1 year ago
1.0.3
1 year ago
1.0.3-beta.1
1 year ago
1.0.2-beta.0
1 year ago
1.0.2
1 year ago
1.0.1
1 year ago
1.0.0
1 year ago