npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-freshdesk-widget

v0.0.1

Published

A React component library for integrating Freshdesk widgets

Readme

React Freshdesk Widget

A React component library for integrating Freshdesk widgets into your applications with full TypeScript support.

Features

  • 🚀 Easy Integration - Drop-in React component for Freshdesk widgets
  • 📝 TypeScript Support - Fully typed with comprehensive interfaces
  • 🎣 React Hook - Custom hook for programmatic widget control
  • 🌍 Internationalization - Support for multiple locales and custom labels
  • 🎨 Customizable - Style and configure the widget to match your app
  • 📦 Tree Shakeable - Optimized bundle size with ES modules

Installation

npm install react-freshdesk-widget

Quick Start

import React from 'react';
import { FreshdeskWidget } from 'react-freshdesk-widget';

function App() {
  return (
    <div>
      <h1>My App</h1>
      <FreshdeskWidget 
        widgetId={12345} 
        locale="en"
        autoLoad={true}
      />
    </div>
  );
}

export default App;

Component API

FreshdeskWidget Props

| Prop | Type | Required | Description | |------|------|----------|-------------| | widgetId | number | ✅ | Your Freshdesk widget ID | | locale | string | ❌ | Language locale (default: "en") | | customerInfo | CustomerInfo | ❌ | Pre-fill customer information | | prefillData | PrefillData | ❌ | Pre-fill ticket form data | | formOptions | FormOptions | ❌ | Form configuration options | | labels | Labels | ❌ | Custom labels for internationalization | | autoLoad | boolean | ❌ | Auto-load widget on mount (default: true) | | className | string | ❌ | CSS class name | | style | React.CSSProperties | ❌ | Inline styles |

Example with Customer Info

import { FreshdeskWidget } from 'react-freshdesk-widget';

function SupportPage() {
  return (
    <FreshdeskWidget
      widgetId={12345}
      locale="en"
      customerInfo={{
        name: "John Doe",
        email: "[email protected]"
      }}
      prefillData={{
        subject: "Need help with my account",
        description: "I'm having trouble accessing my dashboard",
        priority: 2
      }}
    />
  );
}

Hook API

Use the useFreshdeskWidget hook for programmatic control:

import React from 'react';
import { useFreshdeskWidget } from 'react-freshdesk-widget';

function CustomSupportButton() {
  const {
    isLoaded,
    error,
    openWidget,
    closeWidget,
    showLauncher,
    hideLauncher,
    setCustomerInfo,
    prefillForm,
    authenticate
  } = useFreshdeskWidget(12345, {
    locale: 'en',
    customerInfo: {
      name: 'John Doe',
      email: '[email protected]'
    }
  });

  if (error) {
    return <div>Error loading widget: {error}</div>;
  }

  return (
    <div>
      <button onClick={openWidget} disabled={!isLoaded}>
        Open Support Widget
      </button>
      <button onClick={hideLauncher}>
        Hide Launcher
      </button>
    </div>
  );
}

TypeScript Interfaces

The library exports comprehensive TypeScript interfaces:

import type {
  FreshdeskWidgetProps,
  CustomerInfo,
  PrefillData,
  FormOptions,
  Labels
} from 'react-freshdesk-widget';

Advanced Usage

Custom Labels and Internationalization

const customLabels = {
  en: {
    banner: "Need help?",
    launcher: "Support",
    contact_form: {
      title: "Contact Support",
      submit: "Send Message",
      confirmation: "Thank you for contacting us!"
    }
  },
  es: {
    banner: "¿Necesitas ayuda?",
    launcher: "Soporte",
    contact_form: {
      title: "Contactar Soporte",
      submit: "Enviar Mensaje",
      confirmation: "¡Gracias por contactarnos!"
    }
  }
};

<FreshdeskWidget
  widgetId={12345}
  locale="es"
  labels={customLabels}
/>

Authentication

const { authenticate } = useFreshdeskWidget(12345);

// Authenticate user with JWT token
authenticate({
  token: "your-jwt-token",
  callback: () => {
    console.log("User authenticated successfully");
  }
});

Development

To run the demo locally:

npm install
npm run dev

To build the library:

npm run build

License

MIT