Socket
Book a DemoInstallSign in
Socket

nofy-nextjs

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nofy-nextjs

nofy package for NextJS

1.0.1
latest
npmnpm
Version published
Weekly downloads
0
Maintainers
0
Weekly downloads
 
Created
Source

nofy-nextjs

nofy package for NextJS

How to use

Configure the provider

// /src/app/layout.tsx

import { NofyProvider } from "nofy-nextjs";

export default function RootLayout({
    children,
}: {
    children: React.ReactNode;
}) {
    return (
        <html lang="en">
            <body>
                <NofyProvider publicKey="sp_XXXX-X-X-X-XXX">
                    {children}
                </NofyProvider>
            </body>
        </html>
    );
}

Use the useNofy context in server components to log events or pageviews

// /src/app/ClientComponent.tsx

import { useNofy } from "nofy-nextjs";

const CComponent = async () => {
    const { pageView } = useNofy();

    useEffect(() => {
        pageView("/ClientComponent");
    }, []);

    return <div>...</div>;
};

export default CComponent;

Todo

  • [ ]: Upload request with worker as helper (?)
  • [ ]: Refresh logic
  • [x]: Change returns at error
  • [x]: GET request with auth
  • [x]: POST request with auth
  • [x]: Fix issue with getSession serverside and config set at layout (If used at api/_/route.tsx)
  • [x]: Fix issue with api endpoints if no layout has been loaded (if accessing api directly)

Keywords

analytics

FAQs

Package last updated on 30 Aug 2024

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.