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

@mathiscode/voucherify-js-sdk

v2.7.7

Published

<p align="center" > <img src="https://vf-asset.s3-eu-west-1.amazonaws.com/voucherify-js-sdk/logo.png" /> </p>

Downloads

9

Readme

- ! THIS IS THE README OF THE MONOREPO ! -

Go to JS SDK package readme

Go to React Widget readme


Voucherify empowers marketers and developers with flexible building blocks to come up with, implement, and track targeted promotional campaigns.

Visit Voucherify to learn more.

📝 Documentation

Find detailed description and example responses at Voucherify developer documentation. Most method headers point to more detailed descriptions of arguments you can use.

You can also use the detailed JS SDK documentation.

📚 Want to learn more? Visit Voucherify official site or Success Portal.

👽 Having troubles? Check out the Help center.

⚙️ Installation

Voucherify JS SDK

Voucherify JS SDK is a JavaScript SDK and it is fully consistent with the restful API Voucherify provides and it has a fully integrated TypeScript support. It also combines together the previously maintained Voucherify Node.js SDK and Voucherify.js SDK.

Learn more about Voucherify JS SDK installation.

Voucherify React Widget

Voucherify React Widget contains several client-side Voucherify methods, which are useful in integrating your promotion logic straight to your e-commerce store.

Learn more about Voucherify React Widget installation.

🏎 Marketer-ready Voucherify snippet

More HTML-based examples

<body>
  <div id="voucher-validate"></div>

  <link rel="stylesheet" type="text/css" href="https://unpkg.com/@voucherify/[email protected]/dist/voucherify.css" />
  <script src="https://cdnjs.cloudflare.com/ajax/libs/qs/6.5.1/qs.min.js" crossorigin></script>
  <script src="https://unpkg.com/react@17/umd/react.production.min.js" crossorigin></script>
  <script src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js" crossorigin></script>
  <script src="https://unpkg.com/axios/dist/axios.min.js" crossorigin></script>
  <script type="text/javascript" src="https://unpkg.com/@voucherify/[email protected]/dist/voucherifysdk.umd.production.min.js" crossorigin></script>
  <script type="text/javascript" src="https://unpkg.com/@voucherify/[email protected]/dist/voucherifywidget.umd.production.min.js" crossorigin></script>

  <script type="text/javascript">
    window.ReactDOM.render(
      window.React.createElement(VoucherifyWidget.VoucherifyValidate, {
        clientApplicationId: 'CLIENT-APPLICATION-ID',
        clientSecretKey: 'CLIENT-SECRET-KEY',
        amount: true,
      }),
      document.querySelector('#voucher-validate'),
    )
  </script>
</body>

Alternative Ways – iframe and jQuery

If you're looking for something plain and simple, you're used to working with iframe and jQuery on your website, and for whatever technical reason the React-based snippet doesn't work for you, you may want to stick with the legacy voucherify.js SDK for the time being. In this case, refer to the widget section in the documentation.

↔️ Migration

Check out the MIGRATION GUIDE to learn more about switching to the newest Voucherify JS SDK.

🦸 TypeScript

Both the Voucherify JS SDK and Voucherify React Widget support TypeScript declarations. It's recommended to use TypeScript Version 4.2.

Explore also Voucherify TS examples.

😨 Error Handling

A Voucherify error object always has a consistent structure, described in details in the API reference.

Check out code examples for server-side error handling:

Also, see the structure / typing for error returned from Voucherify API:

If you want to receive an original AxiosError when a VoucherifyError is thrown, you need to explicitly set the exposeErrorCause property to true when creating the instance of VouchierfyClient:

const voucherify = VoucherifyServerSide({
	applicationId: 'APPLICATION-ID',
	secretKey: 'SECRET-KEY',
	exposeErrorCause: true
})

The original AxiosError will be available under cause property of VoucherifyError.

👴 Legacy Voucherify JS SDKs

You can always visit legacy Voucherify JS SDKs:

🛠️ Contributing

Bug reports and pull requests are welcome through GitHub Issues.

Read more about how to Contribute to Voucherify JS SDK by visiting CONTRIBUTING.md.

🗄️ Changelog

Voucherify JS SDK CHANGELOG.

Voucherify React Widget CHANGELOG.

🧪 SDK Tests

SDK tests are located in a test folder and use real calls to Voucherify API via client.ts.

// add this to your test
import { voucherifyClient as client } from './client'

In order to run SDK tests, you need to copy packages/sdk/.env.example to packages/sdk/.env and fill the file with your credentials.

In order to run SDK tests, go to the packages/sdk folder and run yarn test.