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

nuxt-smart-app-banner

v0.2.0

Published

Smart banner for nuxt 3

Downloads

33

Readme

Nuxt Smart App Banner [nuxt ^3.0.0]

npm version npm downloads License

Alt text Alt text

Based on
'jQuery Smart Banner' by Arnold Daniels [email protected] https://github.com/jasny/jquery.smartbanner ,
'Smart App Banner' by Vitaly Glibin [email protected] https://github.com/kudago/smart-app-banner

Smart App Banner for Nuxt

Features

  • Smart App Banner for Anroid/IOS
  • Nuxt 3 compatible
  • Support native IOS banner
  • Callbacks available

Quick Setup

  1. Add nuxt-smart-app-banner dependency to your project
# Using pnpm
pnpm add -D nuxt-smart-app-banner

# Using yarn
yarn add --dev nuxt-smart-app-banner

# Using npm
npm install --save-dev nuxt-smart-app-banner
  1. Add nuxt-smart-app-banner to the modules section of nuxt.config.ts and provide module config
import { defineNuxtConfig } from 'nuxt/config'

export default defineNuxtConfig({
    modules: ['nuxt-smart-app-banner'],
    "nuxt-smart-app-banner": {
      bannerOptions: {
        title: "Title",
        androidAppId: "",
        icon: "https://icon-library.com/images/play-store-icon/play-store-icon-9.jpg",
        iosAppId: "",
        appStoreLanguage: "us",
      }
    }
})
  1. Place smart banner component into desired component, page or layout
    ⚠️ Note: if you set overrideComponentNameWith, use custom name instead of SmartAppBanner ⚠️
<template>
  <div>
  🔥<SmartAppBanner/>🔥
    <NuxtWelcome />
  </div>
</template>
  1. Using emits(callbacks)
<template>
  <div>
    Nuxt module playground!
  </div>
  <SmartAppBanner 
    @on-dismiss="handleOnDismiss" // callback fired on clicking close button
    @on-install="handleOnInstall" // callback fired on clicking install button
    @on-not-shown="handleOnNotShown" // callback fired on banner not shown because it was previously either clicked or dismissed
    @on-shown="handleOnShown" // callback fired on banner shown
  />
</template>

<script setup>

const handleOnDismiss = (platform, appId) => {
  console.log(`handleOnDismiss ${platform} ${appId}`)
}
const handleOnInstall = (platform, appId) => {
  console.log(`handleOnInstall ${platform} ${appId}`)
}
const handleOnNotShown = (platform, appId, reason) => {
  console.log(`handleOnNotShown ${platform} ${appId} ${reason}`)
}
const handleOnShown = (platform, appId) => {
  console.log(`handleOnShown ${platform} ${appId}`)
}

</script>

That's it! You can now use Nuxt Smart App Banner in your Nuxt app ✨

Config overview

export interface ModuleOptions {
  overrideComponentNameWith?: string; // Use to override default component name
  bannerOptions: {
    useNativeIosBannerForSafari: boolean; // use native ios banner if available instead of custom (default: true)
    daysHidden: number;  // days to banner appear again after close button is clicked (defaults to 15)
    daysReminder: number;  // days to banner appear again after "VIEW" button is clicked (defaults to 90)
    appStoreLanguage: string; // ios app store language
    title: string;  // title text shown on banner
    author: string;  // author text shown on banner
    button: string;  // button text shown on banner
    androidAppId: string;  // android app id
    iosAppId: string; // ios app id
    store: {
        ios: string; // Instore text shown on banner for ios
        android: string; // Instore text shown on banner for android
    },
    price: {
        ios: string; // Price text shown on banner for ios
        android: string; // Price text shown on banner for ios
    },
    icons?: {
        ios: string; // Url for app icon shown on banner for ios
        android: string; // Url for app icon shown on banner for android
    },
    icon: string; // fallback icon url for all platforms
    theme?: SmartAppBannerTheme; // put platform type here to force single theme on all device
    force?: SmartAppBannerPlatform, // put platform type here for force banner platform for debug 
    }
}

Development

# Install dependencies
npm install

# Generate type stubs
npm run dev:prepare

# Develop with the playground
npm run dev

# Build the playground
npm run dev:build

# Run ESLint
npm run lint