New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@trycourier/react-inbox

Package Overview
Dependencies
Maintainers
2
Versions
642
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@trycourier/react-inbox

# Table of Contents

  • 0.1.10-alpha.18
  • npm
  • Socket score

Version published
Weekly downloads
19K
decreased by-2.78%
Maintainers
2
Weekly downloads
 
Created
Source

Courier React Inbox

Table of Contents

  1. Overview
  2. Client Install
  3. Courier Provider
  4. Using Transport
  5. Props
  6. Inbox Config

Overview

What is Courier React Inbox?

Courier React Inbox is a react component that you can add to your application show your users a list of recent messages they have received over a push channel.

Upcoming Features:

  • Mark as read/unread
  • View all unread

How does @trycourier/react-inbox work?

The react inbox requires a backend to pull messages. This is all done magically through the CourierProvider and requires an account at Courier.

As of right now, we will fetch all messages sent to any push channel and display them in the inbox.


Client Install

yarn add @trycourier/react-inbox

Courier Provider

In order for the Toast component to be placed in the dom you will need to use the ToastProvider. This will handle context and give us access to the show function.

The component you want to listen to toasts from must be a child of the ToastProvider. Check here for more information on this concept.

//App.js
import { Inbox, CourierProvider } from "@trycourier/react-inbox";
/*
alternatively you can access from its own package
import { CourierProvider } from "@trycourier/react-provider";
*/

function App() {
  return (
    <CourierProvider clientKey="my-client-key">
      <Inbox />
    </CourierProvider>
  );
}

You can access your client key here

Using Transport

To let your inbox listen for new messages, you will need to add a transport. Using the courier transport will automatically handle the listening, and invocation through web sockets

Using the Courier Transport

import {
  CourierProvider,
  CourierTransport,
  Inbox,
} from "@trycourier/react-inbox";

const courierTransport = new CourierTransport();

function MyComponent() {
  useEffect(() => {
    courierTransport.subscribe("YOUR_CHANNEL", "YOUR_EVENT");
    // It is good practice to unsubscribe on component unmount
    return () => courierTransport.unsubscribe("YOUR_CHANNEL", "YOUR_EVENT");
  }, []);

  return (
    <CourierProvider transport={courierTransport} clientKey="my-client-key">
      <Inbox />
    </CourierProvider>
  );
}

Props

KeyTypeDescription
configInboxConfigSee Inbox Config
titlestringTitle of the Inbox
themeThemeTheme object used to override base styles
renderIconFunctionComponentOverride Indicator Icon Component
renderHeaderFunctionComponentOverride Header Component
renderMessageFunctionComponentOverride Message Component
renderFooterFunctionComponentOverride Footer Component

Inbox Config

KeyTypeDescription
defaultIcon`stringfalse`

Theme

interface ITheme {
  footer?: React.CSSProperties;
  header?: React.CSSProperties;
  icon?: React.CSSProperties;
  messageList?: {
    container?: React.CSSProperties;
    message?: {
      actions?: {
        container?: React.CSSProperties;
        details?: React.CSSProperties;
        dismiss?: React.CSSProperties;
      }
      body?: React.CSSProperties;
      container?: React.CSSProperties;
      icon?: React.CSSProperties;
      title?: React.CSSProperties;
      unreadIndicator?: React.CSSProperties;
    }
  };
  tabList?: {
    container?: React.CSSProperties;
    tab?: React.CSSProperties;
  };
  root?: React.CSSProperties;
}

FAQs

Package last updated on 13 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc