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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@kennofizet/rewardplay-frontend

v1.0.7

Published

RewardPlay frontend package - Token-based API client for RewardPlay

Readme

RewardPlay Frontend

Vue 3 UI for RewardPlay: login, bag, shop, daily rewards, ranking, and settings. It talks to two APIs — Core (zones, auth check) and RewardPlay (game data) — so you pass coreUrl, backendUrl, and token when mounting.


Install

npm i @kennofizet/rewardplay-frontend

Peer dependency: Vue 3 (vue@^3.2.0). Your app must provide Vue.


Mount in 3 steps

1. Add a mount point (only when you have a token)

<div v-show="initialized" id="rewardplay-mount-point"></div>

Show it only when initialized is true (e.g. after login), then mount in a nextTick after setting initialized = true. Use the same ID in document.getElementById below.

2. Get token and URLs

Your app must provide:

  • coreUrl — Base URL of the Core API (e.g. https://your-app.com/api/knf). Used for auth check, zones, managed zones.
  • backendUrl — Base URL of the RewardPlay API (e.g. https://your-app.com/api/knf/rewardplay). Used for user data, bag, shop, daily rewards, ranking, manifest, settings.
  • token — RewardPlay token (from your backend; see rewardplay-backend README).

3. Create app and use the plugin

import { createApp, ref, nextTick } from 'vue'
import RewardPlay, { RewardPlayPage } from '@kennofizet/rewardplay-frontend'

const initialized = ref(false)
let rewardPlayApp = null

async function initRewardPlay() {
  const coreUrl = 'https://your-app.com/api/knf'                    // from your config
  const backendUrl = 'https://your-app.com/api/knf/rewardplay'     // from your config
  if (!coreUrl?.trim() || !backendUrl?.trim()) return

  try {
    const token = await fetchYourRewardPlayToken()   // your API
    initialized.value = true
    await nextTick()

    const mountPoint = document.getElementById('rewardplay-mount-point')
    if (!mountPoint) {
      initialized.value = false
      return
    }

    rewardPlayApp = createApp(RewardPlayPage, {
      imageUrls: [],
      scriptUrls: [],
      stylesheetUrls: [],
      fontUrls: [],
      backgroundImage: null,
      language: 'vi',   // 'en' | 'vi'
    })

    rewardPlayApp.use(RewardPlay, {
      coreUrl: coreUrl.trim(),
      backendUrl: backendUrl.trim(),
      token,
    })

    rewardPlayApp.mount(mountPoint)
  } catch (err) {
    initialized.value = false
    // handle error
  }
}

// e.g. onMounted or after login
onMounted(() => {
  initRewardPlay()
})

Plugin options (all required)

| Option | Type | Description | |--------|------|-------------| | coreUrl | string | Base URL of Core API (zones, auth check). | | backendUrl | string | Base URL of RewardPlay API (game data, manifest). | | token | string | RewardPlay auth token. |

All three are required: app.use(RewardPlay, { coreUrl, backendUrl, token }).


Vite: same Vue instance

If you mount RewardPlay in a separate createApp(RewardPlayPage), add the package to Vite so it shares the same Vue instance and inject('gameApi') works:

// vite.config.js
export default {
  optimizeDeps: {
    include: ['@kennofizet/rewardplay-frontend'],
  },
}

RewardPlayPage props (optional)

| Prop | Type | Default | Description | |------|------|--------|-------------| | imageUrls | Array | [] | URLs for image manifest/assets | | scriptUrls | Array | [] | Script URLs to load | | stylesheetUrls | Array | [] | CSS URLs | | fontUrls | Array | [] | Font URLs | | backgroundImage | string | null | Background image URL | | language | string | 'en' | 'en' or 'vi' | | rotate | boolean | true | Auto-rotate in portrait | | customStyles | Object | {} | Extra CSS variables |


Backend and token

  • Token: Your host app gets the RewardPlay token from your backend (see kennofizet/rewardplay-backend README).
  • URLs: Core and RewardPlay can live on the same app; just pass the correct base paths for coreUrl and backendUrl.

Exports

  • default — Plugin: app.use(RewardPlay, { coreUrl, backendUrl, token })
  • RewardPlayPage — Root component to mount
  • createGameApi, installGameModule, ComingSoonPage, LoadingSource, LoginScreen
  • ResourceLoader, useResourceLoader, constants helpers, createTranslator, translations

Development (editing the package)

From the rewardplay-packages repo root: npm install, then npm run dev:frontend or npm run build:frontend. Package entry is src/index.js.