Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions webapp/src/component/HelpMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,20 @@ export const HelpMenu = () => {
name: user!.name,
url: window.location,
});

// Set custom attributes for paying customers
if (preferredOrganization) {
const subscription = preferredOrganization.activeCloudSubscription;
// @ts-ignore
window.$chatwoot.setCustomAttributes({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this looks like potential issue when the $chatwoot is not defined. I wouldn't use @ts-ignore ignore here.

Also I would move this to separate hook usePrepareChatwootAttributes. This component us already long enough.

plan: subscription?.plan?.name || 'free',
subscriptionStatus: subscription?.status || 'inactive',
organizationId: preferredOrganization.id,
organizationName: preferredOrganization.name,
enabledFeatures: preferredOrganization.enabledFeatures.join(', '),
});
}

// @ts-ignore
window.$chatwoot.toggle();
});
Expand Down
Loading