![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@phntms/ft-react-components
Advanced tools
A collection of UI/utility React/NextJS components for Phantom FT sites
A collection of React/NextJS UI and utility components for Phantom FT sites.
Currently implemented:
Install this package with npm
.
npm i @phntms/ft-react-components
Add the provider to _app.tsx, pass the site's page content to PageViewData
import { FTTrackerProvider } from "@phntms/ft-react-components";
.
.
.
return (
<FTTrackerProvider>
<PageViewData pageProps={pageProps} />
<Component {...pageProps} />;
</FTTrackerProvider>
)
Construct the pageViewData object from the site content data. use setPageViewData and setTrackingOptions to update the tracker provider. See the Phantom FT partner tracking implementation guide for the full config object schema. TODO - consider moving to this lib with empty/default values and adding Yup validation to console error/eslint when incomplete.
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]);
Video event tracking is handled by the videoTracker instance available from the useFTTracker
hook. It is currently only compatible with react-player
implementations which is the current standard player implementation for Phantom NextJS sites.
import { useFTTracker } from "@phntms/ft-react-components";
import ReactPlayer from "react-player";
.
.
const { videoTracker } = useFTTracker();
.
.
<ReactPlayer
controls
height="100%"
style={{ position: "absolute", top: 0, left: 0 }}
onDuration={videoTracker?.setDuration}
onEnded={videoTracker?.trackEnded}
onPause={videoTracker?.trackPause}
onPlay={videoTracker?.trackPlay}
onProgress={videoTracker?.trackProgress}
width="100%"
url={fileToURL(article.video)}
light={fileToURL(article.image)}
playIcon={<PlayIconCircle />}
onClick={handlePlayButtonClick}
/>
Loads the external permutive scripts, requires Permutive project specific IDs (environment variables) - add to the sites' _document.tsx
import { PermutiveSetup } from "@phntms/ft-react-components";
.
.
// Permutive tracking
const PERMUTIVE_PROJECT_ID = process.env.PERMUTIVE_PROJECT_ID || "";
const PERMUTIVE_PUBLIC_API_KEY = process.env.PERMUTIVE_PUBLIC_API_KEY || "";
.
.
render() {
return (
<Html lang="en">
<Head>
<FontPreloadEmbed />
<FaviconEmbed />
<TrackingHeadScript id={GA_TRACKING_ID} />
<PermutiveSetup
projectID={PERMUTIVE_PROJECT_ID}
publicAPIKey={PERMUTIVE_PUBLIC_API_KEY}
/>
.
.
Render in an appropriate page level component. FTPartnerContent requires 3 props as below to display the site's required partner links
import {
CookieMessage,
FTHeader,
FTFooter,
FTPartnerContent,
} from "@phntms/ft-react-components";
.
.
<Container>
<FTHeader />
<FTPartnerContent
siteUrl={globals.sitewide.url}
siteTitle={globals.sitewide.title}
partner={{
title: "Zurich",
url: "https://www.zurich.com/",
}}
/>
{showHero && <CategoryHero />}
<Navbar categories={globals.categories} selected={category} />
<div id="o_tracker_scroll">{children}</div>
<CookieMessage />
<FTFooter />
</Container>
NOTE: all 4 components rely on a single global .scss styles file, which needs to be loaded in _app.tsx as a global import:
//load combined FT components styles as global
import "@phntms/ft-react-components/src/components/ft/styles/app.scss";
FAQs
A collection of UI/utility React/NextJS components for Phantom FT sites
The npm package @phntms/ft-react-components receives a total of 7 weekly downloads. As such, @phntms/ft-react-components popularity was classified as not popular.
We found that @phntms/ft-react-components demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.