
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@viral-loops/widgets
Advanced tools
> This repo is in beta, if you find any bugs please contact our support!
This repo is in beta, if you find any bugs please contact our support!
npm install @viral-loops/widgets
// App.jsx
import { useState, useEffect } from 'react';
import logo from './assets/react.svg';
import './App.css';
import { ViralLoopsWidget, getCampaign } from '@viral-loops/widgets/dist/react';
function App() {
const [vlUser, setVlUser] = useState();
const VIRAL_LOOPS_CAMPAIGN_ID = 'iev8dcEBHtsNToNqaCGnXGGCmsc'; // replace with your campaign ID
async function logout() {
const campaign = await getCampaign(VIRAL_LOOPS_CAMPAIGN_ID);
campaign?.logout();
window.location.reload();
}
async function bindViralLoopsUser() {
if (vlUser) return;
const campaign = await getCampaign(VIRAL_LOOPS_CAMPAIGN_ID);
const loggedInUser = campaign.getUser();
if (loggedInUser) {
console.log('[Viral Loops] user logged in to viral loops is:', loggedInUser);
setVlUser(loggedInUser);
} else {
campaign.on('participation', (vlUser) => {
console.log('[Viral Loops] user participated to viral loops!', vlUser);
setVlUser(vlUser);
});
}
}
useEffect(() => {
bindViralLoopsUser();
});
return (
<>
<div className="App">
<img src={logo} alt="" />
<h1> The Company Name </h1>
<div className="card">
<ViralLoopsWidget ucid={VIRAL_LOOPS_CAMPAIGN_ID} />
{vlUser && (
<div>
<h2>
{' '}
You're logged in as
<span> {vlUser.email} </span>
</h2>
<p> Invite your friends! (You currently have {vlUser.referralCount} referrals) </p>
<button onClick={() => logout()}> Logout </button>
</div>
)}
</div>
</div>
</>
);
}
FAQs
> This repo is in beta, if you find any bugs please contact our support!
The npm package @viral-loops/widgets receives a total of 915 weekly downloads. As such, @viral-loops/widgets popularity was classified as not popular.
We found that @viral-loops/widgets demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.