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

@storedotapp/pwa-install-dialog

v1.1.2

Published

Web component for PWA managing installation modal with store.app metadata included.

Downloads

188

Readme

pwa-install-dialog

Web component for PWA managing installation modal with store.app metadata included.

Features

  • Show/hide modal with installation instructions according to OS/Browser
  • Includes Rating and Verified status from store.app with link to the listing
  • Light/Dark theme
  • Responsive: center modal on desktop, bottom drawer on mobile
  • [>=1.1.0] Tracking events
  • [>=1.1.0] Auto-open modal when coming from store.app listing (can be disabled)

Requirements

Your PWA needs to be listed on https://store.app. List your app for free:

  1. Sign up on store.app
  2. Request a Dev Account
  3. Claim your App
  4. Publish your listing

How to use

  1. Install
npm i @storedotapp/pwa-install-dialog
  1. Import in your main.ts or main.js or any top level file
import "@storedotapp/pwa-install-dialog";
  1. Use the web component in your html or template file. See attribute list below for more details.
<!-- Examples-->
<pwa-install-dialog id="install-dialog" app="fitness-app" theme="dark"></pwa-install-dialog>
<pwa-install-dialog id="install-dialog" app="fitness-app" open></pwa-install-dialog>
  1. Define your opening trigger on the event you want (usually a click on an button). Call the show() method on the component
<!-- Example-->
<button onclick="document.getElementById('install-dialog').show()">Install</button>

Attributes

| Attribute | Required | Type | Default | Description | |:----------|:--------:|----------|:------------------------------|--------------------------------------------------------------------------------------------------------------| | app | Required | string | n/a | Your app id from your listing page (eg. fitness-app if the listing page is https://store.app/fitness-app | | theme | Optional | string | User's prefers-color-scheme | Color theme for the modal. Supports light and dark | | open | Optional | bool | n/a | Whether the modal is visible or not. Can be omitted and controlled via show()/hide() methods |

Methods

| Method | Description | |:---------|---------------------------------------------------------------------------------------------------------------------------| | show() | Set open to true | | hide() | Set open to false. This is taken care of automatically when the backdrop is clicked but you can add your own triggers |

Events

Ready (from 1.1.1)

The component dispatches a ready event when it finishes initializing. You can wait for this event to trigger before making the Install button available to your user.

document.getElementById("pwa-install").addEventListener("ready", () => {
  document.getElementById("dialog-trigger").style.visibility = "visible"
})

Interactions (from 1.1.0)

The component dispatches interact events when the user interacts with the dialog, allowing you to react to or track behaviors on your app.

The event detail always has an interaction value, plus some optional payload depending on the interaction.

document.getElementById("pwa-install").addEventListener("interact", (e) => {
  console.log(e.detail) // { interaction: 'first-open', mode: 'support' }
})

| Interaction | Description | Additional Payload | Details | |:---------------------|:-----------------------------------------------------------------------------|-----------------------|:------------------------------------------------------------------------------------------------| | first-open | The user opened the install modal for the first time since last page refresh | mode: <see_below> | Whether or not the device supports native prompt; if not, what custom instructions are provided | | open-listing | The user opened the app listing from the dialog | | | | click-instructions | The user clicked the manual install instructions section (no effect) | | | | install | The user triggered the native install prompt | | |

Supported values for mode currently are:

  • native-prompt
  • not-supported
  • ios-safari
  • ios-chrome
  • ios-edge
  • ios-firefox
  • android-chrome
  • android-edge
  • android-firefox
  • android-opera
  • android-samsung-browser
  • macos-safari

Screenshots

Native Prompt in Dark Mode

iOS/Safari in Light Mode

Opera/Android in Dark Mode