3.6.1 • Published 2 years ago

@wayke-se/ecom-react v3.6.1

Weekly downloads
1
License
MIT
Repository
github
Last release
2 years ago

build status

React components for Wayke's e-commerce flow

This project contains react components that can be integrated on a website in order to add the Wayke e-commerce flow, which is a modal that allows the user to go through the different steps of the e-commerce process.

Installation

npm i --save @wayke-se/ecom-react

Configuration

Configure the e-commerce API endpoint:

import { config } from "@wayke-se/ecom";

config.bind({
    api: {
        address: [E-COMMERCE API URL],
    },
    /** Specifying an origin is optional **/
    origin: {
        topic: [E-COMMERCE-TOPIC],
        channel: [E-COMMERCE-CHANNEL],
    },
    /** Specifying a bank id thumbprint is optional **/
    bankIdThumbprint: "[CUSTOM BANK ID CERTIFICATE THUMBPRINT]"
});

See https://github.com/wayke-se/wayke-ecom-js for more info about for instance the API address, as well as configuration for order origination and bank id thumbprint.

Usage

The React components are built with Typescript and React, but Typescript is optional to use. The ecom flow can be added to your website by including the React component Ecom. This component needs some data in the following format:

const ecomData = {
    vehicle: {
        id: [string],
        title: [string],
        shortDescription: [string],
        price: [number],
        imageUrl: [string],
        retailerName: [string],
        modelYear: [number],
        milage: [string],
        gearBox: [string],
        fuelType: [string]
    },
    serviceLogotypeUrl: [string],
    onExit: [function],
    onUserEvent: [function],
    useBankId: [boolean],
    displayBankIdAlert: [boolean]
};
  • vehicle - This is information about the vehicle that the user wants to sell. The id is referring to a Wayke id, i.e. an id that is defined by Wayke for the car to sell via Wayke's e-commerce solution. The rest of the information is information about the vehicle to sell and/or the retailer who sells it.
  • serviceLogotypeUrl - This should be an url to an image that is shown in the "header" of the e-commerce modal.
  • onExit - This should be a function that determines what should happen when the user either clicks the exit button on the modal, or if the user goes through the whole flow, makes the order and now is finished. (this code should probably hide the modal)
  • onUserEvent - This is an optional method to provide if you want to be informed about how the user navigates through the ecom modal. This could for instance be used for analytics purposes. The method will receive two parameters: 1) userEvent: string and 2) currentStep: string. The first one indicating what the user did, and the second one which step the user was on when they performed the event.
  • useBankId: An optional flag. If you want to use Swedish Bank Id to identify the user and fetch their personal information, set this to true (false by default).
  • displayBankIdAlert: An optional flag. By default, the user is identified with BankId to Wayke. To clarify that the purchase is to another retailer, an optional alert can be displayed in the BankId identification step (false by default).

When you want to show the Ecom component you simply import it and instantiate it with the above mentioned data.

import Ecom from '@wayke-se/ecom-react';

...
<Ecom {...ecomData} />
...

The ecom component will always be visible, so you have to set it's visibility by removing and adding it, e.g.:

...
{ shouldShowEcomModal && <Ecom {...ecomData} /> }
...

Styling

In the folder assets/styles there is a CSS-file default.css. If you want to use these provided styles, you can simply add this CSS to your html-head as normally with a link element.

Development

npx parcel@1.12.3 dev/index.html
3.6.1

2 years ago

3.6.0

2 years ago

3.6.0-alpha.13

2 years ago

3.6.0-alpha.12

2 years ago

3.6.0-alpha.11

2 years ago

3.6.0-alpha.10

2 years ago

3.6.0-alpha.9

2 years ago

3.6.0-alpha.8

2 years ago

3.6.0-alpha.7

2 years ago

3.6.0-alpha.6

2 years ago

3.6.0-alpha.5

2 years ago

3.6.0-alpha.4

2 years ago

3.6.0-alpha.3

2 years ago

3.6.0-alpha.1

2 years ago

3.6.0-alpha.2

2 years ago

3.5.2

3 years ago

3.5.2-beta-1

3 years ago

3.5.1

3 years ago

3.5.1-alpha.2

3 years ago

3.5.1-alpha.1

3 years ago

3.5.0

3 years ago

3.5.0-beta.5

3 years ago

3.5.0-beta.4

3 years ago

3.5.0-beta.3

3 years ago

3.4.1

3 years ago

3.4.2-alpha.4

3 years ago

3.5.0-beta.1

3 years ago

3.5.0-beta.2

3 years ago

3.4.2-alpha.3

3 years ago

3.4.2-alpha.2

3 years ago

3.4.2-alpha.1

3 years ago

3.4.1-beta.11

3 years ago

3.4.1-beta.10

3 years ago

3.4.1-beta.9

3 years ago

3.4.1-beta.7

3 years ago

3.4.1-beta.8

3 years ago

3.4.1-beta.6

3 years ago

3.4.1-beta.5

3 years ago

3.4.1-beta.4

3 years ago

3.4.1-beta.3

3 years ago

3.4.1-beta.2

3 years ago

3.4.1-beta.1

3 years ago

3.3.0

3 years ago

3.3.0-alpha.1

3 years ago

3.2.1

4 years ago

3.2.0-beta.0

4 years ago

3.1.0

4 years ago

3.1.0-alpha.1

4 years ago

3.0.2

4 years ago

3.0.2-alpha.1

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago

3.0.0-alpha.1

4 years ago

2.3.0-alpha.4

4 years ago

2.3.0-alpha.3

4 years ago

2.3.0-alpha.2

4 years ago

2.2.1

4 years ago

2.3.0-alpha.1

4 years ago

2.2.1-alpha.1

4 years ago

2.2.0

4 years ago

2.2.0-alpha.1

4 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.1.0-alpha.14

4 years ago

2.1.0-alpha.13

4 years ago

2.1.0-alpha.12

4 years ago

2.1.0-alpha.11

4 years ago

2.1.0-alpha.10

4 years ago

2.0.1

4 years ago

2.1.0-alpha.8

4 years ago

2.1.0-alpha.7

4 years ago

2.1.0-alpha.6

4 years ago

2.1.0-alpha.5

4 years ago

2.1.0-alpha.4

4 years ago

2.1.0-alpha.3

4 years ago

2.1.0-alpha.2

4 years ago

2.1.0-alpha.1

4 years ago

2.0.0

4 years ago

2.0.0-alpha12

4 years ago

2.0.0-alpha13

4 years ago

2.0.0-alpha10

4 years ago

2.0.0-alpha11

4 years ago

2.0.0-alpha9

4 years ago

2.0.0-alpha6

4 years ago

2.0.0-alpha8

4 years ago

2.0.0-alpha7

4 years ago

2.0.0-alpha5

4 years ago

2.0.0-alpha4

4 years ago

2.0.0-alpha3

4 years ago

2.0.0-alpha2

4 years ago

2.0.0-alpha

4 years ago

1.1.5

4 years ago

1.1.5-alpha

4 years ago

1.1.4-alpha

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago