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

dipendra-nc-web-sdk

v1.0.10

Published

The **Nuvei WebSDK** allows third-party applications to easily embed Micro Frontends into their applications.

Downloads

94

Readme

🧩 WebSDK

The Nuvei WebSDK allows third-party applications to easily embed Micro Frontends into their applications.

📦 Installation

Install the SDK from npm:

npm install @nuvei-connect/nc-websdk

🚀 Usage

Import and mount the SDK. The container must be mounted in the DOM before calling NuveiSDK.mount():

import NuveiSDK from "@nuvei-connect/nc-websdk";

const instance = await NuveiSDK.mount({
  componentName: moduleName,
  container: containerRef.current,

  config: {
    environment: "preprod",
  },
});

The mount() call returns an SDK instance. Keep the instance and call destroy() when the host component is unmounted or the integration is no longer needed.

⚛️ React example

Keep the SDK container rendered independently from the loading state. If a loader conditionally replaces the container, containerRef.current will be null when the SDK is initialized.

"use client";

import { useEffect, useRef, useState } from "react";
import NuveiSDK from "@nuvei-connect/nc-websdk";

async function fetchClientSession() {
  const response = await fetch("/api/sdk/session", { method: "POST" });
  return response.json();
}

async function refreshClientSession(payload: {
  accessToken: string;
  refreshToken: string;
}) {
  const response = await fetch("/api/sdk/session/refresh", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify(payload),
  });
  return response.json();
}

async function destroySession() {
  const response = await fetch("/api/sdk/session", { method: "POST" });
  return response.ok;
}

export function MicroFrontend({ componentName }: { componentName: string }) {
  const containerRef = useRef<HTMLDivElement>(null);
  const instanceRef = useRef<any>(null);
  const [isLoading, setIsLoading] = useState(true);

  useEffect(() => {
    let isMounted = true;

    async function initialize() {
      if (!containerRef.current) return;

      const instance = await NuveiSDK.mount({
        componentName,
        container: containerRef.current,
        fetchClientSession,
        refreshClientSession,
        destroySession,
        config: { environment: "preprod" },
      });

      if (!isMounted) {
        instance.destroy();
        return;
      }

      instanceRef.current = instance;
      setIsLoading(false);
    }

    void initialize();

    return () => {
      isMounted = false;
      instanceRef.current?.destroy();
      instanceRef.current = null;
    };
  }, [componentName]);

  return (
    <>
      {isLoading && <div>Loading…</div>}
      <div ref={containerRef} />
    </>
  );
}

🔐 Authentication

By default, the SDK handles authentication automatically. No authentication configuration is required from the consuming application.

If the consuming application wants to manage authentication itself, it can provide authentication callbacks. These callbacks override the SDK's default authentication behavior.

const instance = await NuveiSDK.mount({
  componentName: moduleName,
  container: containerRef.current,

  config: {
    environment: "preprod",
  },

  fetchClientSession: getSessionId,
  refreshClientSession: refreshSessionId,
  destroySession: handleSessionDestroy,
});

⚙️ Configuration

| Property | Required | Description | | ---------------------- | -------- | --------------------------------------------------- | | componentName | Yes | Micro Frontend component to load | | container | Yes | DOM element where the component will be mounted | | config.environment | Yes | SDK environment (local, dev, preprod, prod) | | fetchClientSession | No | Custom authentication/session callback | | refreshClientSession | No | Custom session refresh callback | | destroySession | No | Custom session destroy/logout callback | | config.requestId | No | Onboarding request ID; falls back to the host URL | | config.documentRequestId | No | Document Utility request ID; falls back to the host URL |

Note: Authentication callbacks are optional. If they are not provided, the SDK uses its built-in authentication flow.