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

coming-soon-wl

v1.0.0

Published

This widget allows users to sign up for notifications when a specific product variant is available soon. The widget can be integrated into a Shopify store or any other e-commerce platform. Users can provide their email, mobile number, and name to register

Downloads

1

Readme

Coming Soon Widget

This widget allows users to sign up for notifications when a specific product variant is available soon. The widget can be integrated into a Shopify store or any other e-commerce platform. Users can provide their email, mobile number, and name to register their interest.

Features

  • Dynamic form fields based on data attributes
  • Customizable styling
  • Integration with an external Wishlist API to handle form submissions

Installation

Include the widget script in your HTML file:

<script src="https://cdn.jsdelivr.net/npm/coming-soon-wl/index.js"></script>

Usage

  1. Add a button to your HTML where the widget will be initialized. The button should have an ID of popup-open and a data-fields attribute that specifies the fields to be included in the form:
<div id="coming-soon">
    <button id="popup-open" class="coming-soon-btn" type="button" data-fields='["email", "mobile", "firstName", "lastName"]'>NOTIFY ME - JOIN WAITLIST</button>
</div>
  1. The script will automatically create a popup form with the specified fields when the button is clicked.

Customization

Fields

The data-fields attribute on the button determines which fields will be included in the form. Possible values include:

  • email
  • mobile
  • firstName
  • lastName

Example:

<button id="popup-open" class="coming-soon-btn" type="button" data-fields='["email", "mobile"]'>COMING SOON - JOIN WAITLIST</button>

Styles

The widget includes default styles for the button and popup form. You can customize these styles by modifying the styles variable in the JavaScript file or by overriding the styles in your own CSS.

API Integration

The widget sends the form data to the specified API endpoint:

https://api.au-sandbox.thewishlist.io/services/wsservice/api/wishlist/items/customerInterest/{email}

Example Payload

{
  "productRef": 6786188247105,
  "variantRef": 1,
  "email": "[email protected]",
  "mobile": "1234567890",
  "firstName": "John",
  "lastName": "Doe",
  "isMobile": true
}

Complete HTML Example

Here is a complete example of an HTML file that includes the Notify Me Widget:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Coming Soon Widget</title>
    <style>
        /* Custom styles for the button and popup form */
        .coming-soon-btn {
            background-color: #fff;
            border: 1px solid black;
            color: black;
            padding: 12px 24px;
            text-align: center;
            width: 100%;
            cursor: pointer;
            text-transform: uppercase;
        }
        #popup-body.overlay {
            position: fixed;
            top: 0;
            bottom: 0;
            left: 0;
            right: 0;
            background: rgba(0, 0, 0, 0.7);
            transition: opacity 200ms;
            visibility: hidden;
            opacity: 0;
        }
        #popup-wrapper {
            margin: 70px auto;
            padding: 15px;
            background: #fff;
            border-radius: 5px;
            max-width: 360px;
            position: relative;
        }
        #popup-close {
            position: absolute;
            top: 5px;
            right: 15px;
            transition: all 200ms;
            font-size: 30px;
            font-weight: bold;
            text-decoration: none;
            color: #333;
            cursor: pointer;
        }
        #popup-close:hover {
            color: #d80606;
        }
        #popup-title {
            margin: 0;
            font-size: 20px;
            max-width: 350px;
            text-transform: uppercase;
        }
        #popup-text {
            margin: 10px 0;
            font-size: 14px;
        }
        #popup-form {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }
        #popup-form input {
            padding: 0.475em 1em;
            border: 1px solid #caced1;
            border-radius: 0.25rem;
            font-size: 1.15rem;
            max-width: 100%;
        }
        #popup-form input::placeholder {
            font-size: 1rem;
        }
        #popup-form button {
            font-size: 0.85rem;
            padding: 0.975em 1em;
            font-weight: 600;
            border: none;
            text-transform: uppercase;
            background: #aca475;
            color: #fff;
            cursor: pointer;
        }
        .custom-select {
            position: relative;
        }
        .custom-select select {
            appearance: none;
            width: 100%;
            font-size: 1.15rem;
            padding: 0.475em 1em;
            background-color: #fff;
            border: 1px solid #caced1;
            border-radius: 0.25rem;
            color: #000;
            cursor: pointer;
        }
        .custom-select::before,
        .custom-select::after {
            --size: 0.3rem;
            content: "";
            position: absolute;
            right: 1rem;
            pointer-events: none;
        }
        .custom-select::before {
            border-left: var(--size) solid transparent;
            border-right: var(--size) solid transparent;
            border-bottom: var(--size) solid black;
            top: 40%;
        }
        .custom-select::after {
            border-left: var(--size) solid transparent;
            border-right: var(--size) solid transparent;
            border-top: var(--size) solid black;
            top: 55%;
        }
    </style>
</head>
<body>
    <div id="coming-soon">
        <button id="popup-open" class="coming-soon-btn" type="button" data-fields='["email", "mobile", "first-name", "last-name"]'>COMING SOON - JOIN WAITLIST</button>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/coming-soon-wl/index.js"></script>
</body>
</html>