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

feednotch-widget

v1.1.0

Published

FeedNotch Widget loader for applications using javascript frameworks and libraries

Downloads

20

Readme

feednotch-widget

A library to help developers integrate feednotch.com's widget in applications powered by javascript frameworks (React, Vue.js, Next.js, Angular, and Svelte)

💻 Developer Guide Docs

🔧 Install

feednotch-widget is available on npm. It can be installed with the following command:

npm install feednotch-widget --save

feednotch-widget is available on yarn as well. It can be installed with the following command:

yarn add feednotch-widget

NOTE: Please use the Latest version 1.1.0 (2024-04-03)

🔰 Widget Params

🔧 Param Types

Widget loader parameter types

interface WidgetLoaderOptions {
    apiKey: string;
    style: 'BUBBLE' | 'TEXTED' | 'INLINE_EMBED' | 'DIRECT_FORM_EMBED';
    position?: 'LEFT' | 'RIGHT';
    triggerOrContainerId?: string;
}

❗ Important to Know

You are not allowed to use all the optional options (position & triggerOrContainerId) in one widget loader apiKey (data-apiKey) and style (data-style) are required.

When using styles BUBBLE and TEXTED. These are the options:

// Don't include the triggerOrContainerId (data-triggerOrContainerId)

loadWidget({
    apiKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
    style: 'BUBBLE',
    position: 'LEFT',
})

When using styles INLINE_EMBED and DIRECT_FORM_EMBED. These are the options:

// Don't include the position (data-position)

loadWidget({
    apiKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
    style: 'INLINE_EMBED',
    triggerOrContainerId: 'unique-identification-string',
})

💡 Usage

// React Sample

import React, { useEffect } from 'react';
import loadWidget from 'feednotch-widget';

const YourComponent = () => {
    useEffect(() => {
        loadWidget({
            apiKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
            style: 'BUBBLE',
            position: 'LEFT',
        })
            .then(() => {
                console.log('Widget script loaded successfully');
            })
            .catch((error) => {
                console.error('Error loading widget script:', error);
            });
    }, []);

    return (
        <div>
            {/* Render your component UI here */}
        </div>
    );
};

export default YourComponent;
<!--Vue Sample-->

<template>
    <!-- Your Vue component's template -->
</template>

<script>
import loadWidget from 'feednotch-widget';

export default {
    mounted() {
        loadWidget({
            apiKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
            style: 'BUBBLE',
            position: 'LEFT',
        })
            .then(() => {
                console.log('Widget script loaded successfully');
            })
            .catch((error) => {
                console.error('Error loading widget script:', error);
            });
    }
};
</script>
<!-- Svelte Sample -->

<script>
    import loadWidget from 'feednotch-widget';

    loadWidget({
        apiKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
        style: 'BUBBLE',
        position: 'LEFT',
    })
        .then(() => {
            console.log('Widget script loaded successfully');
        })
        .catch((error) => {
            console.error('Error loading widget script:', error);
        });
</script>
// Angular Sample

import { Component, OnInit } from '@angular/core';
import loadWidget from 'feednotch-widget';

@Component({
    selector: 'app-widget',
    templateUrl: './widget.component.html',
    styleUrls: ['./widget.component.css']
})
export class WidgetComponent implements OnInit {

    constructor() { }

    ngOnInit(): void {
        loadWidget({
            apiKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
            style: 'BUBBLE',
            position: 'LEFT',
        })
            .then(() => {
                console.log('Widget script loaded successfully');
            })
            .catch((error) => {
                console.error('Error loading widget script:', error);
            });
    }
}

📜 Changelog

Latest version 1.1.0 (2024-04-03):

Detailed changes for each release are documented in the Docs.

❗ Issues

If you think anything about the feednotch-widget package can be improved, please do head to the docs page and file a new issue or suggestion on the feednotch widget available on the page.

⚖️ License

The MIT License License: MIT