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

@phntms/ft-react-components

Package Overview
Dependencies
Maintainers
4
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@phntms/ft-react-components

A collection of UI/utility React/NextJS components for Phantom FT sites

  • 0.0.1-rc.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
14
decreased by-73.58%
Maintainers
4
Weekly downloads
 
Created
Source

ft-react-components

NPM version Actions Status PR Welcome

A collection of React/NextJS UI and utility components for Phantom FT sites.

Introduction

Currently implemented:

  • contexts/FTTracker - Provides a context and hook for easier access to the FTTracker and ReactPlayerTracking tracking functions from ft-lib.
  • hooks/PermutiveEvent - A simple hook that fires a permutive page event on NextJS router updates, will likely be merged into FTTracker
  • components/PermutiveSetup - Outputs the Permutive ad tracking scripts for FT partner sites.
  • components/PreviewMessage - a styled component to display a preview mode indicator for sites using Directus CMS.

Installation

Install this package with npm.

npm i @phntms/ft-react-components

Usage

FTTracker

Add the provider to _app.tsx

import { FTTrackerProvider } from "@phntms/ft-react-components";
.
.
.
return (
<FTTrackerProvider>
    <PageViewData pageProps={pageProps} />
    <Component {...pageProps} />;
  </FTTrackerProvider>
)

Use the hook to pass the site's config/article data props and some tracking options

import { useFTTracker, TrackingOptions, ConfigType } from "@phntms/ft-react-components";
.
.
const { setPageViewData, setTrackingOptions } = useFTTracker();

 useEffect(() => {
    const globals = pageProps.globals;
    const article = pageProps.article;
    const category = pageProps.category;

    setTrackingOptions({
      scrollTrackerSelector: "#o_tracker_scroll",
      isCustomGTMEvent: false,
    });

      const errorValue = "404";
    if (!setPageViewData) return;
    setPageViewData({
      advertiserIndustry: (globals && globals.sitewide.industry) || errorValue,
      app:
        (article && article.content_type) ||
        (globals && globals.sitewide.homepage_label) ||
        errorValue,
      articleName:
        (article && article.title) ||
        (globals && globals.sitewide.homepage_label) ||
        errorValue,
      author:
      .
      .
      .
      } as ConfigType);
    }, [pageProps]);

Keywords

FAQs

Package last updated on 07 Mar 2022

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