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 🙏

© 2024 – Pkg Stats / Ryan Hefner

aud-fe-mod

v1.1.9

Published

#### Intro

Downloads

7

Readme

aud-fe-mod

Intro

A utility module written in node that accepts an event from a page, generates a GUID, and saves a snapshot for the page link passed in.

Installation

npm i aud-fe-mod

Import the the module in your project

import audFEMod from 'aud-fe-mod'

Documentation

To get a new GUID:

const id = AuditFEModule.getNewGUID()

To send an event to the module:

AudFEMod.processEvent(objectPassedIn)

Note that processEvent() requires an object to be passed in with specific properties:

const objectPassedIn = {
  audCategory: 'User Activity', // a string with category information
  product: 'Abc', // a string with product information
  audFunction: 'Lookup', // a string with function information
  dataType: 'Person', // a string with data type
  audEvent: 'View Record', // a string with the event
  componentString: undefined, // a string html snapshot of page user is on
  formData: {name: "test name", address: "test address", id: "test id"} ||undefined // if form fields present, a string with data entered otherwise undefined 
}

In the background processEvent will link the page snapshot with the other info supplied in objectPassedIn and the GUID it generated. This will be saved internally in AudFEMod.eventStore. The data can then be accessed and sent to an API endpoint.

import audFEMod from 'aud-fe-mod';
import { renderToString } from 'react-dom/server'

componentDidMount = () => {
  // id can be sent with API call
  AudFEMod.getNewGUID(); 

  // get snapshot of current component and save to `state`
  const componentString = this.renderToString().toString();
  this.setState({componentString})
}

// renderToString function can be used to generate a HTML string of component
renderToString = () => {
  return renderToString(<Component />)
}

const objectPassedIn = {
  audCategory: 'User Activity',
  product: 'Abc', 
  audFunction: 'Lookup', 
  dataType: 'Person', 
  audEvent: 'View Record', 
  componentString: `"<div class="grid-row"><div class="column-two-thirds"><h2 class="heading-large">Search profile</h2><div class="form-group"><label class="form-label" for="full-name-f1">Name</label><input type="text" class="form-control" id="full-name-f1" name="full-name-f1"/></div><div class="form-group"><label class="form-label" for="profile-address">Address</label><input type="text" class="form-control" id="profile-addres" name="profile-addres"/></div><div class="form-group"><label class="form-label" for="profile-id">ID</label><input type="text" class="form-control" id="profile-id" name="profile-id"/></div><input type="submit" class="button" value="Search"/></div></div>"`, 
  formData: {name: "test name", address: "test address", id: "test id"}
}

console.log(AudFEMod.processEvent(objectPassedIn));

// TODO - write function to send data to API
})

Tests

To run the tests, clone project from github. Then install the dev dependencies and navigate to the project directory.

npm test