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

@tge-tech/tgquest-core

v1.0.2

Published

* [Installation](#installation) * [Configuration](#configuration) * [Usage with modal instance](#with-modal-instance) * [Usage with web-component button](#with-web-component-button) * [Usage with react](#with-react) * [Additional settings](#additional-set

Downloads

39

Readme

@tge-tech/tgquest-core

Overview

Part of the @tge-tech/tgquest platform for Telegram applications.
Provides a modal window for displaying quests to users. Users can follow links within the modal, complete the offered quests, and automatically receive the rewards you have pre-configured.

Installation

npm:
$ npm i @tge-tech/tgquest-core
yarn:
$ yarn add @tge-tech/tgquest-core

Configuration

tgquest.js:
import { createTgquestModal } from '@tge-tech/tgquest-core';

// Get your api key from https://tgquest.tge.tech/traffic-source/apps/{your_app_id}
const apiKey = 'API_KEY'

// Create modal instance
export const tgquestModal = createTgquestModal({
  apiKey,
})

Usage

With modal instance

html:
<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Example</title>
  </head>
  <body>
    <button id="button">Open Modal</button>
    <script type="module" src="script.js"></script>
  </body>
</html>
script.js:
const openModalButton = document.getElementById('button')

openModalButton.addEventListener('click', () => tgquestModal.open())

With web-component button

<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Example</title>
  </head>
  <body>
    <tgq-button></tgq-button>
  </body>
</html>

With react

export const App = () => {
  const onClick = () => {
    tgquestModal.open()
  }

  return (
    <div>
      <button onClick={onClick}>
        Open Modal
      </button>
    </div>
  )
}

Additional settings

Locale

A locale in which the text and quests will be displayed inside the modal.
If locale is not provided, it will be set automatically depending on the user's Telegram language.

export const tgquestModal = createTgquestModal({
  // only 'en | 'ru' locale is available for now
  locale: 'en',
})

// or
tgquestModal.setLocale('ru')

Payload

If you want to show the modal to the user in several places of your application, you can pass different payloads to .open() method options.
With this approach, you will be able to determine exactly where the user clicked on the link from.

tgquestModal.open({ payload: 'main page'})
// or
tgquestModal.open({ payload: 'profile page'})

On Quest Complete

You may want to perform some action after the user has completed the quest.
To do this, you can pass the onQuestComplete callback to the .open() method options.

tgquestModal.open({ onQuestComplete: () => console.log('complete') })

Also you can pass the global onQuestComplete callback to modal config.
This callback will be executed on any quest is completed.

export const tgquestModal = createTgquestModal({
  onQuestComplete: () => console.log('complete'),
})

// or
tgquestModal.setOnQuestComplete(() => console.log('complete'))

Theme

You can provide a theme mode or/and theme variables to customize the modal. Otherwise theme mode will be set automatically depending on the browser theme.

export const tgquestModal = createTgquestModal({
  theme: {
    mode: 'dark',
    variables: {
      '--tgq-z-index': 9999,
      '--tgq-spacing': '12px',
      '--tgq-color-accent': '#DEBE49',
    }
  },
})

// or
tgquestModal.setThemeMode('light')
tgquestModal.setThemeVariables({
  '--tgq-avatar-size': '80px',
  '--tgq-border-radius': '0',
})

Theme variables

| Name | Default value (light/dark) | Description | | ------------------------------- | ---------------------------- | ----------------------------------------------- | | --tgq-font-family | Rubik, sans-serif | - | | --tgq-z-index | 2000 | z-index for modal component | | --tgq-spacing | 20px | gap and padding | | --tgq-avatar-size | 128px | width and height | | --tgq-avatar-offset | -40px | offset from bottom for quest avatar container | | --tgq-border-radius | 12px | modal/quest avatar/buttons | | --tgq-align | start | text (text-align) and quest avatar (flex) align | | --tgq-color-backdrop | #00000080 | - | | --tgq-color-accent | #019ADA | reward/button/icon etc. | | --tgq-color-background | #FAFAFA / #242424 | modal background color | | --tgq-color-background-avatar | #FFFFFF / #343434 | quest avatar container bacground color | | --tgq-color-text | #242424 / #FAFAFA | title and description | | --tgq-color-text-button | #FFFFFF | - | | --tgq-shadow | 0px 4px 12px 0px #0000001A | quest avatar container shadow |

Traffic Source backend integration

If you are a traffic source, you want to reward your user for completing quests. It can be possible via backend integration of our platform.
All you need to do is implement the webhook (HTTP POST request) that accepts JSON data with click information from tgquest platform. We will make a request every time when your user completes a quest and you can reward them.

Webhook example

URL
POST https://your-domain/api/tgquest/accrue_reward
Request Headers
{
  // Get your api key from https://tgquest.tge.tech/traffic-source/apps/{your_app_id}
  "Authorization": "API_KEY"
}
Request Body
{
  "click": {
    "id": 1,
    "payload": "main page", // the value that you provided in tgquestModal.open method
    "task_id": 1, // that the user completed
    "user_telegram_id": 000000001
  }
}
Success Response
{
  "done": true
}
Errror Response

If the request data is not valid or authorization failed, your backend should return the appropriate error code and message.

{
  "error": "The Authorization header missing or invalid"
}

| Code | Message | | ---------------- | ------------------------------------------- | | 400 Bad Request | Invalid body | | 401 Unauthorized | The Authorization header missing or invalid |

Advertiser backend integration

If you are an advertiser, you have the option not to show your quest to users who are already in your project.
To make this possible you need to implement the webhook (HTTP POST request) that accepts JSON data, and we will make a request before showing your quest to the user.

Webhook example

URL
POST https://your-domain/api/tgquest/user_exists
Request Body
{
  "telegram_id": 000000001
}
Success Response
{
  "exists": false // user does not exist
}
Errror Response

If the request data is not valid, your backend should return the appropriate error code and message.

{
  "error": "Invalid body"
}

| Code | Message | | ---------------- | ------------------------------------------- | | 400 Bad Request | Invalid body |