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

hclcdp-web-sdk-react

v0.0.5

Published

HCL CDP Web SDK React Wrapper

Readme

HCL CDP Web SDK for React

This repository contains the HCL CDP Web SDK for React, which provides a set of tools and components to integrate with the HCL Customer Data Platform (CDP) in a React application.

Installation

To install the HCL CDP Web SDK for React, you can use npm or yarn:

npm install hclcdp-web-sdk-react

or

yarn add hclcdp-web-sdk-react

Usage

Here's an example of how to use the HCL CDP Web SDK for React in a React component. Components must run client-side and must use the directive "use client" in Next.js (version X.X or above)

Example usage (Next.js) with layout.tsx (or layout.js)

This example will include the HCL CDP Web SDK for React in a Next.js application with the layout component (layout.tsx or layout.js). The *CdpClientWrapper is a client-side implementation of a React Context Provider that should be used to wrap around page content.

import { CdpClientWrapper, HclCdpConfig } from "hclcdp-web-sdk-react"

const config: HclCdpConfig = {
  writeKey: "<writekey>>",
  inactivityTimeout: 1,
  enableSessionLogging: false,
  enableUserLogoutLogging: false,
  cdpEndpoint: "<endpoint>",
  destinations: [
    {
      id: "GA4",
      classRef: GoogleAnalytics,
      config: { measurementId: "<measurementId>" },
    },
    {
      id: "Facebook",
      classRef: Facebook,
      config: { pixelId: ",pixelId>" },
    },
  ],
}

export default function ReactLayout({
  children,
}: Readonly<{
  children: React.ReactNode
}>) {
  return (
    <html lang="en">
      <body>
        <CdpClientWrapper config={config}>{children}</CdpClientWrapper>
      </body>
    </html>
  )
}

Example usage (Next.js) with page.tsx

This example shows how including CdpPageEvent in the page will automatically call the Page event with the supplied pageName and properties. Alternatively, the useCdp hook can be used to manually call the Page event method, much like calling the track or identity methods is performed in the example.

The identifier parameter is the page name for page events, the event name for track events and the userId for identity events.

"use client"

import { CdpPageEvent, useCdp } from "hclcdp-web-sdk-react"

export default function Home() {
  const { track, identify } = useCdp()

  return (
    <div>
      <h1>CDP!</h1>
      <CdpPageEvent pageName={"Home Page"} pageProperties={{ test: "test" }} />
      <button
        onClick={() => {
          track({
            identifier: "Home!",
            properties: { test: "testy test" },
            otherIds: {},
          })
        }}>
        Track
      </button>
      <button
        onClick={() => {
          identify({
            identifier: "johnsmith",
            properties: { test: "test test" },
            otherIds: {},
          })
        }}>
        Identity
      </button>
      {}
    </div>
  )
}