0.7.62 • Published 10 months ago

@cirkay-eng/cirkay-components v0.7.62

Weekly downloads
-
License
-
Repository
-
Last release
10 months ago

Fan Pass Web Components Library README

A lightweight bundle for loading Cirkay components via CDN. This bundle provides three main components: FanPassClaim, FanPassUnlock, and MobilePass.

Using via Cirkay Fan Pass CDN

Installation

UMD Bundle (Standalone)

The UMD bundle includes all components and dependencies in a single file. Add the following script tag to your HTML:

<!-- Production -->
<script src="https://cdn.n3xus.services/fan-pass-cdn/cirkay-fan-pass-standalone-umd.0.7.6.umd.js"></script>

Modular Bundle (ES Modules)

The modular bundle splits components into separate chunks for better tree-shaking and code splitting. First, load the vendor bundle, then the modular bundle:

<script type="module">
  // Load main bundle
  import { FanPassClaim, FanPassUnlock, MobilePass } from 'https://cdn.n3xus.services/fan-pass-cdn/cirkay-fan-pass-standalone-es.0.7.6.esm.js';
</script>

Components

FanPassUnlock

A component that handles the unlocking of Fan Pass content.

<fp-unlock
  apiKey="your-api-key"
  fanPassTitle="Fan Pass"
  buttonLabel="Connect"
  :logoSet="{
    large: { src: 'path/to/large-logo.png' },
    medium: { src: 'path/to/medium-logo.png' },
    small: { src: 'path/to/small-logo.png' },
    alt: 'Fan Pass Logo'
  }"
  :inline="false"
  :loading="false"
  :staging="false"
  :debugLogging="false"
  :cta="false"
  ctaText="Connect to unlock"
  btnBackgroundColor="#D60455"
  btnTextColor="#FFFFFF"
></fp-unlock>

Props

PropTypeDefaultDescription
apiKeyString''Your Cirkay API key
fanPassTitleString'Fan Pass'Title of the Fan Pass
buttonLabelString'Connect'Label for the connect button
logoSetObjectSee defaultLogo configuration for different sizes
inlineBooleanfalseWhether to display inline
loadingBooleanfalseLoading state
stagingBooleanfalseWhether to use staging environment
debugLoggingBooleanfalseEnable debug logging
ctaBooleanfalseShow call-to-action
ctaTextString'Connect to unlock'Text for the CTA
btnBackgroundColorString'#D60455'Button background color
btnTextColorString'#FFFFFF'Button text color

Events

EventDescriptionEvent Detail
fp-unlock-initialisingDispatched when component is initializing{ status: 'initialising' }
fp-unlock-initialisedDispatched when component is initialized{ status: 'initialised' }
fp-unlock-startedDispatched when unlock flow starts{ status: 'started' }
fp-unlockedDispatched when unlock is completed{ status: 'unlocked', data: {...} }
fp-unlock-completeDispatched when unlock process is complete{ status: 'complete', data: {...} }
fp-mobile-dataDispatched with mobile pass data{ data: {...} }

FanPassClaim

A component for claiming Fan Passes.

<fp-claim
  apiKey="your-api-key"
  fanPassTitle="Fan Pass"
  :logoSet="{
    large: { src: 'path/to/large-logo.png' },
    medium: { src: 'path/to/medium-logo.png' },
    small: { src: 'path/to/small-logo.png' },
    alt: 'Fan Pass Logo'
  }"
  :modal="false"
  :validateAfterModal="false"
  redeemCode=""
  successUrl="https://example.com/success"
  :autoRedirect="false"
  :showRedeemInput="true"
  :staging="false"
  :debugLogging="false"
  btnBackgroundColor="#D60455"
  btnTextColor="#FFFFFF"
></fp-claim>

Props

PropTypeDefaultDescription
apiKeyString''Your Cirkay API key
fanPassTitleString'Fan Pass'Title of the Fan Pass
logoSetObjectSee defaultLogo configuration
modalBooleanfalseDisplay as modal
validateAfterModalBooleanfalseValidate after modal display
redeemCodeString''Code for redeeming Fan Pass
successUrlString''URL to redirect after success
autoRedirectBooleanfalseAuto redirect after success
showRedeemInputBooleantrueShow redeem code input
stagingBooleanfalseUse staging environment
debugLoggingBooleanfalseEnable debug logging
btnBackgroundColorString'#D60455'Button background color
btnTextColorString'#FFFFFF'Button text color

Events

EventDescriptionEvent Detail
fp-claim-claimingDispatched when claim flow starts{ status: 'claiming' }
fp-claim-claimedDispatched when claim is finished{ status: 'claimed', data: {...} }

MobilePass

A component for displaying mobile pass information.

<fp-mobile-pass
  fanPassTitle="Fan Pass"
  androidLink="https://play.google.com/store/apps/details?id=com.example"
  appleLink="https://apps.apple.com/app/example"
  downloadLink="https://example.com/download"
  :displayIntro="false"
  :debugLogging="false"
></fp-mobile-pass>

Props

PropTypeDefaultDescription
fanPassTitleString'Fan Pass'Title of the Fan Pass
androidLinkString''Link to Android app
appleLinkString''Link to iOS app
downloadLinkString''Link to download page
displayIntroBooleanfalseShow introduction text
debugLoggingBooleanfalseEnable debug logging

Event Handling

Example of handling events:

// Listen for unlock events
document.querySelector('fp-unlock').addEventListener('fp-unlock-complete', (event) => {
  console.log('Unlock complete:', event.detail);
});

// Listen for claim events
document.querySelector('fp-claim').addEventListener('fp-claim-claimed', (event) => {
  console.log('Claim complete:', event.detail);
});

Bundle Types

Production

For production, use the minified versions:

<!-- UMD -->
<script src="https://cdn.n3xus.services/fan-pass-cdn/cirkay-fan-pass-standalone-umd.0.7.6.umd.js"></script>

<!-- ES Modules -->
<script type="module">
        // Load main bundle
        import { FanPassClaim, FanPassUnlock, MobilePass } from 'https://cdn.n3xus.services/fan-pass-cdn/cirkay-fan-pass-standalone-es.0.7.6.esm.js';
    </script>

Browser Support

The components are built using modern web standards and support all modern browsers:

  • Chrome (latest)
  • Firefox (latest)
  • Safari (latest)
  • Edge (latest)

Dependencies

The components require the following dependencies:

  • Lit (for web components)
  • Push Web Components (for UI elements)

These are included in the standalone bundle but need to be loaded separately when using the modular bundle.

Fan Pass Web Components Library Via NPM Beta

Welcome to the Fan Pass Web Components library! This library provides a collection of UX frontend components designed to be fast, reusable, and highly customisable for any project, without relying on proprietary technologies or frameworks. These components leverage standard Web APIs and are compatible with all modern browsers.

Installation

Requires Node v20.0+ minimum.

  1. Install Node.js globally using one of the following methods:
  1. Install PNPM globally using one of the following methods:
  • Mac: brew install pnpm
  • Windows PowerShell: Run the command iwr https://get.pnpm.io/install.ps1 -useb | iex

Build scripts

We've provided the following build scripts to streamline the development process:

Fan Pass application:

  • Develop main library: pnpm fan-pass:serve
  • Build main library: pnpm fan-pass:build
  • Build main library docs: pnpm fan-pass:build:docs

Importing components into your project

Our components are written as ES6 modules for seamless integration into your project without the need for transpilation through tools like Webpack or Babel. You can still use pre-processors like Vite, Webpack, or Roll-up for tree shaking and minification while preserving ES modules.

To initialise a web component and render it in your HTML and the DOM, simply import the component script within your page's entry scripts or as a script tag directly inside your page.

0.7.62

10 months ago

0.7.61

10 months ago

0.7.6

10 months ago

0.7.5

11 months ago

0.7.4

1 year ago

0.7.3205

1 year ago

0.7.3204

1 year ago

0.7.3203

1 year ago

0.7.3202

1 year ago

0.7.3201

1 year ago

0.7.320

1 year ago

0.7.319

1 year ago

0.7.318

1 year ago

0.7.317

1 year ago

0.7.316

1 year ago

0.7.315

1 year ago

0.7.314

1 year ago

0.7.313

1 year ago

0.7.312

1 year ago

0.7.311

1 year ago

0.7.310

1 year ago

0.7.309

1 year ago

0.7.308

1 year ago

0.7.307

1 year ago

0.7.306

1 year ago

0.7.305

1 year ago

0.7.304

1 year ago

0.7.303

1 year ago

0.7.302

1 year ago

0.7.301

1 year ago

0.7.300

1 year ago

0.7.233

1 year ago

0.7.232

1 year ago

0.7.231

1 year ago

0.7.23

1 year ago

0.7.22

1 year ago

0.7.21

1 year ago

0.7.2

1 year ago

0.7.1

1 year ago