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

@vhiweb/magami-client-js

v2.3.2

Published

Welcome to Magami Software Development Kit (SDK), This library contains core API needed to create a mini game campaign. This developer-friendly resource empowers you to efficiently retrieve and manipulate data to create tailored solutions. ## Prerequisite

Downloads

8

Readme

Magami Client JS

Welcome to Magami Software Development Kit (SDK), This library contains core API needed to create a mini game campaign. This developer-friendly resource empowers you to efficiently retrieve and manipulate data to create tailored solutions.

Prerequisites

To use this package, you must have a registered Magami client application. Make sure you already have the API Key and Campaign Slug.

Installation

You can install Magami Client JS using npm or yarn, depending on your preference. Open your terminal or command prompt and navigate to your project directory.

npm i magami-client-js
or if you are using yarn
yarn add magami-client-js

Importing Magami Client JS

After successfully installing Magami Client JS, you can import it into your JavaScript or TypeScript code as follows:

import Magami from 'magami-client-js';
const magami = new Magami();

Initalizing Magami

To initialize Magami, you need to provide your apiKey and campaignSlug, which can be obtained from the Magami dashboard or by contacting Magami support. Use the magami.init() function for this purpose:

magami.init({
    apiKey: 'example',
    campaignSlug: 'example'
});

Usage

Now that you have Magami Client JS installed and initialized, you can use its functions to interact with the Magami platform, including claiming coupons, setting user data, redeeming coupons, and more. Refer to the library's documentation or README for detailed information on how to use each function.

Example

magami.claim('coupon_code_here')
    .then(response => {
        console.log('Coupon claimed successfully:', response);
    })
    .catch(error => {
        console.error('Error claiming coupon:', error);
    });

Methods

Claiming Coupon

To claim coupon from a campaign use claim() function.

claim(coupon_code)

| Param | Description | Data Type | Required | |-------------|--------------|------------|-----------| | coupon_code | - | String | yes |

Microsite Configuration

To get your microsite configuration including app key and campaign slug, use getConfiguration() to get all information you need about your campaign.

getConfiguration(host, username, password) 

| Param | Description | Data Type | Required | |--------------|-------------|-----------|----------| | host| | | String | yes | | username | | String | yes | | password | | String | yes |

Validate Signnature

To validate your signature that you get from claim() response, use validateSignature() to revalidate your coupon/token (in case you wan't it to be more secure)

validateSignature(signature) 

| Param | Description | Data Type | Required | |--------------|-------------|-----------|----------| | signature | | String | yes |

Welcome Form

To set user data from a user use welcomeForm()

welcomeForm({ coupon_code, name, phone, province_id, city_id, district_id })

| Param | Description | Data Type | Required | |--------------|-------------|-----------|----------| | coupon_code | | String | yes | | name | | String | yes | | phone | | String | yes | | province_id | | String | yes | | city_id | | String | yes | | district_id | | String | yes |

Redeem

To redeem a coupon use redeem() function.

redeem(redemption_id)

| Param | Description | Data Type | Required | |--------------|--------------|-----------|----------| | redemption_id| | String | yes |

Validate Winner

Incase your user reload or close the page by some reason, you can re-validate your winner coupon code using validateWinner().

validateWinner({ coupon_code, phone })

| Param | Description | Data Type | Required | |-------------|-------------|-----------|----------| | coupon_code | | String | yes | | phone | | String | yes |

Winner Form

To complete the user data after a user won a prize, you can use winnerForm() to complete their data.

winnerForm({ redemption_id, email,id_number, address})

| Param | Description | Data Type | Required | |--------------|-------------|-----------|----------| | redemption_id| | String | yes | | email | | String | yes | | id_number | | String | yes | | address | | String | yes | | province_id | | String | yes | | city_id | | String | yes | | district_id | | String | yes |

Get Winner

To get list of winners you can use getWinner() function.

getWinner()

FAQ

To get list of all your Frequently Asked Question, use faq() function.

faq()
// or you can pass a string into faq to filter faq data
faq('keyword')

| Param | Description | Data Type | Required | |---------|-------------|-----------|----------| | keyword | - | String | no |