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

@leatcom/portal-sessions

v0.0.52

Published

This is the Javascript SDK for integrating with Leat | Piggy using Portal Sessions. Sign up for a free Leat | Piggy account [here](https://business.piggy.eu/sign-up).

Downloads

531

Readme

Portal Sessions by Leat | Piggy

This is the Javascript SDK for integrating with Leat | Piggy using Portal Sessions. Sign up for a free Leat | Piggy account here.

More information on Portal Sessions and their specific API calls can be found on the API Documentation.

Installation

Install using

npm install @leatcom/portal-sessions
yarn add @leatcom/portal-sessions

Documentation

Usage

Portal Sessions come in different types, each with their own use. To initiate a Portal Sessions, an API key is required, which can be created in your account's Dashboard. A Portal Session is also always created for a specific Shop, so the shopUuid is also required. You can find a Shop's UUID in your Dashboard or by API.

Currently, there are five Portal Session types:

  • PORTAL: This is the 'default' session type, which doesn't have a predefined aim, but rather allows for flexible use. See this as a way for customers to login to their own portal.
  • REDEEM_GIFTCARD: A session to use and redeem gift card(s). Best used as payment option.
  • TOP_UP_GIFTCARD: A session to sell and/or top up existing gift cards.
  • PAY_PREPAID: A session to handle prepaid transactions.
  • TOP_UP_PREPAID: A session to top up prepaid balance.
  • POINTS_TRANSACTION: A session to handle an order and a subsequent credit reception.
  • VOUCHER: A session to redeem vouchers.

Initiate a new Portal Session as follows:

<PortalSession
    apiKey={apiKey}
    shopUuid={shopUuid}
    type="PORTAL"
    onRedeemVoucher={(voucher) => handleVoucherLogic(voucher)}
/>

Portal Session Props

| Prop | Type | Required | Description | |-------------------------------|--------------------------------------------------------------|----------|------------------------------------------------------------------------------------------------------------| | apiKey | string | Yes | API key used to authenticate. | | shopUuid | string | Yes | The shop's uuid. | | contactUuid | string | No | Optional contact uuid. This opens the portal session for this contact specifically. | | type | PortalType | No | Optional portal type, defaults to "PORTAL". | | primaryIdentificationMethod | string | No | Start the identification flow with either "email" or "identifier", defaults to "identifier". | | enableEmailIdentification | boolean | No | Optional alternative route to identify a contact. | | enableOnScreenKeyboard | boolean | No | Optional on-screen keyboard. | | allowMultipleGiftcards | boolean | No | Allow using multiple giftcards in one session. Applies to sessions with PortalType "REDEEM_GIFTCARD". | | amountInCents | number | No | A purchase amount in cents. Applies to sessions with PortalType "REDEEM_GIFTCARD" and "PAY_PREPAID". | | onContactLink | (contact: ContactResource) => void | No | Optional callback. Called when a contact is linked to the portal session. | | onClaimReward | (reward: RewardResource, transactionUuid?: string) => void | No | Optional callback. Called when a reward is claimed. | | onRedeemVoucher | (voucher: VoucherResource) => void | No | Optional callback. Called when a voucher is redeemed. | | onUseGiftcard | (giftcardTransaction: GiftcardTransactionResource) => void | No | Optional callback. Called when a giftcard payment is made. |

Types

PortalType

export enum PortalType {
    REDEEM_GIFTCARD = "REDEEM_GIFTCARD",
    TOP_UP_GIFTCARD = "TOP_UP_GIFTCARD",
    PORTAL = "PORTAL",
    PAY_PREPAID = "PAY_PREPAID",
    TOP_UP_PREPAID = "TOP_UP_PREPAID",
    POINTS_TRANSACTION = "POINTS_TRANSACTION",
    VOUCHER = "VOUCHER",
}