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

@frontend-sdk/loyaltylion

v0.28.1

Published

LoyaltyLion integration for Shogun Frontend.

Downloads

56

Readme

LoyaltyLion

LoyaltyLion integration for Shogun Frontend.

Power your ecommerce growth by building a better understanding of what will drive longer-lasting relationships and use those insights to create a loyalty program as unique as your brand.

LoyaltyLion website →

Installation

yarn add @frontend-sdk/loyaltylion

or

npm install @frontend-sdk/loyaltylion

Initial setup

  1. Send your LoyaltyLion Site Token and LoyaltyLion Secret to [email protected] via One Time Secret. These will be used on our backend for customer authentication.

  2. In Shogun Frontend, call the useLoyaltyLion hook at the top level, so that the script is injected only once, and all LoyaltyLion components can utilize it. This hook injects and initializes the LoyaltyLion script.

import { useLoyaltyLion } from '@frontend-sdk/loyaltylion'
import { useCustomerState } from 'frontend-customer'
import { useRouter } from 'frontend-router'

const App = () => {
  const { id, email, isLoggedIn } = useCustomerState()
  const customer = { id, email, isLoggedIn }
  const router = useRouter()

  useLoyaltyLion(loyaltyLionSiteToken, customer, router)
}

How to find required values

You can find your LoyaltyLion Site Token and LoyaltyLion Secret here.

To find this page manually: log in to https://app.loyaltylion.com > click on "Manage" in the top nav bar > scroll down to the "Configurations" section in the left nav bar and click "Settings" > scroll down to the bottom of the page to see your token and secret.

Limitations

Not supported

Partially supported

  • The free product voucher and product discount voucher redemption LoyaltyLion components try to add a product directly to the cart. This action is not supported and fails silently. One possible workaround is to use CSS to apply display: none to the parts of the LoyaltyLion component that mention adding directly to the cart. See LoyaltyLion's CSS customization guide.

  • The referee welcome modal has a button to automatically "apply discount". This action is not supported. The customer must manually enter the code at checkout. Again, a possible workaround is to use CSS to hide the button.

  • To use LoyaltyLion's custom rewards, your developers will need to set up a custom webhook.

  • Rewards are not automatically added to cart upon redemption. To redeem voucher rewards, customers must manually input the voucher code into the discount code input on the checkout page.

LoyaltyLion Components

Prerequisite: Make sure you've followed the steps in initial setup above.

Go to your LoyaltyLion admin portal to activate and customize the LoyaltyLion components you'd like to use.

Each LoyaltyLion component will provide you with a string of HTML. E.g. <div data-lion-component-name></div>.

Paste the provided HTML into the Shogun Frontend section where you'd like the LoyaltyLion component to appear. Note that some HTML code may need to be manually converted to JSX to work properly. E.g. The <input> tag in HTML is written as <input /> in JSX.

Call the useLoyaltyLionRefresh hook from the Shogun Frontend section. This will be invoked once upon React component mount, and is required for the LoyaltyLion component to properly render upon client side navigation to that page.

Loyalty Page

In your LoyaltyLion admin portal, navigate to https://app.loyaltylion.com/sites/YourLoyaltyLionSiteId/manage/design/app-integrated (Manage > Customize > Loyalty Page), customize as you like, and set to visible.

In Shogun Frontend, create a new section and page, and paste the following snippet.

<div data-lion-integrated-page></div>

Note: Make sure this is the only element with a data-lion... attribute on this page.

Source: https://help.loyaltylion.com/en/articles/4385100-loyalty-page

Example

import { useLoyaltyLionRefresh } from '@frontend-sdk/loyaltylion'

export const LoyaltyPage = () => {
  useLoyaltyLionRefresh()

  return (
    <>
      <div data-lion-integrated-page></div>
    </>
  )
}

Other LoyaltyLion Components

A full list of LoyaltyLion's components and their code snippets can be found here. There are components that are embeddable in the page, and others that are rendered in a modal. All will follow the same general format of pasting the provided HTML into Shogun Frontend. All require useLoyaltyLionRefresh to be called within that section to properly render upon client-side navigation.

Some LoyaltyLion components are partially supported or not supported at all. See Limitations for more detail.

Resources

LoyaltyLion Help Centre