Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@justeat/f-checkout

Package Overview
Dependencies
Maintainers
42
Versions
175
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@justeat/f-checkout

Fozzie Checkout – Fozzie Checkout Component

  • 0.38.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-97.75%
Maintainers
42
Weekly downloads
 
Created
Source

f-checkout

Fozzie Bear

Fozzie Checkout Component


npm version CircleCI Coverage Status Known Vulnerabilities

Usage

  1. Install the module using NPM or Yarn:

    yarn add @justeat/f-checkout
    
    npm install @justeat/f-checkout
    
  2. Import the component

    You can import it in your Vue SFC like this (please note that styles have to be imported separately):

    import VueCheckout from '@justeat/f-checkout';
    import '@justeat/f-checkout/dist/f-checkout.css';
    
    export default {
        components: {
            VueCheckout
        }
    }
    

    If you are using Webpack, you can import the component dynamically to separate the vue-checkout bundle from the main bundle.client.js:

    import '@justeat/f-checkout/dist/f-checkout.css';
    
    export default {
        components: {
            ...
            VueCheckout: () => import(/* webpackChunkName: "vue-checkout" */ '@justeat/f-checkout')
        }
    }
    
    

Configuration

Props

f-checkout has a number of props that allow you to customise its functionality.

The props that can be defined are as follows:

PropTypeDefaultDescription
checkoutUrlString-URL for the API called to load the Checkout Data.

The data returned from this API contains the serviceType, which determines if the Checkout component is created for Collection or Delivery.
checkoutAvailableFulfilmentUrlString-URL for the API called to load the Available Fulfilment data.
checkoutTimeoutNumber1000Timeout when submitting the checkout form.
getCheckoutTimeoutNumber1000Timeout when loading checkout data.
authTokenString''Authorisation token used when submitting the checkout form.
loginUrlString-URL to navigate to if the user wishes to change account.

CSS Classes

Checkout has its own styles that are scoped to the component using CSS modules to prevent conflicts with existing styles on the page.

In addition to this, checkout exposes some classes that you can target in your application.

ClassDescription
c-checkoutTargets the checkout wrapper element.
c-card--dimensionsTargets the checkout content dimensions.
c-checkout-alertTargets the checkout alert element when it is visible.
c-checkout-submitButtonTargets the checkout submit button.
c-address-labelTargets the address group label when checkout is using the delivery method.
c-address-groupTargets the grouped address fields when checkout is using the delivery method.
c-address-errorTargets the error message spacing in the address element when checkout is using the delivery method.
c-userNoteTargets the checkout user note wrapper.
c-userNote-titleTargets the checkout user note title.
c-userNote-contentTargets the checkout user note text description.
c-userNote-textAreaTargets the checkout user note text area.
c-checkout-linkTargets any link in the checkout page.

Events

EventDescription
checkout-payment-successEmitted when checkout form is successfully submitted.
checkout-payment-failureEmitted when checkout form fails when submitted.
checkout-get-successEmitted when checkout data is successfully loaded.
checkout-get-failureEmitted when checkout data fails to load.
checkout-visit-login-pageEmitted when user clicks the Not you? link

You can add event listeners for these like so

<template>
  <vue-checkout
    @checkoutPaymentSuccess="onPaymentSuccess"
    @checkoutPaymentFailure="onPaymentFailure"
    @checkoutGetPaymentSuccess="onGetPaymentSuccess"
    @checkoutGetPaymentFailure="onGetPaymentFailure"
  </vue-checkout>
</template>

<script>
export default {
  methods: {
    onPaymentSuccess () {
      // Do stuff here
    },

    onPaymentFailure () {
      // Do stuff here
    },

    onGetPaymentSuccess () {
      // Do stuff here
    },

    onGetPaymentFailure () {
      // Do stuff here
    }
  }
}
</script>

Development

It is recommended to run the following commands at the root of the monorepo in order to install dependencies and allow you to view components in isolation via Storybook.

# cd ./fozzie-components
yarn install

## Testing
Unit / Integration / Contract

```bash
# Run Unit / Integration / Contract tests for all components
cd ./fozzie-components
yarn test

OR

# Run Unit / Integration / Contract tests for f-checkout
cd ./fozzie-components/packages/f-checkout
yarn test

Component Tests

# Run Component tests for all components
# Note: Ensure Storybook is not running when running the following commands
cd ./fozzie-components

yarn storybook:build
yarn storybook:serve-static
yarn test-component:chrome

OR

# Run Component tests for f-checkout
# Note: Ensure Storybook is not running when running the following commands
cd ./fozzie-components/packages/f-checkout
yarn test-component:chrome

Documentation to be completed once module is in stable state.

Keywords

FAQs

Package last updated on 18 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc