@wearejh/m2-pwa-currency

0.23.2 • Public • Published

@wearejh/m2-pwa-currency

Note: This does NOT currently affect Quotes, it's only purpose currently is to track the selected currency so that content can be rendered/updated.

Install

npm i @wearejh/m2-pwa-currency

Browser installation

This modules gives you a register function for state & events, along with an apollo link that will add a header to outgoing requests.

import { init } from '@wearejh/m2-pwa-engine/lib/browser';
import { createCurrencyBrowser } from '@wearejh/m2-pwa-currency';

const { link, register } = createCurrencyBrowser();

const createApp = init({
    features: [register()],
    links: [link],
    // the rest of the params to init
});

Server installation

For initial rendering, you'll want to read the content-currency cookie and use that to set some initial state.

import { createCurrencySSR } from '@wearejh/m2-pwa-currency';

const { reducers, state } = createCurrencySSR(req.cookies['content-currency']);

const { App, Inner } = getSsrInit({
    state: {
        ...state,
    },
    reducers: {
        ...reducers,
    },
});

Readme

Keywords

none

Package Sidebar

Install

npm i @wearejh/m2-pwa-currency

Weekly Downloads

41

Version

0.23.2

License

ISC

Unpacked Size

21.8 kB

Total Files

11

Last publish

Collaborators

  • oliverchenery
  • jasonujmaalvis
  • yutonet
  • domjtalbot
  • jhdeploy