1.102.0 • Published 2 months ago

@farfetch/blackout-core v1.102.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

@farfetch/blackout-core

Clients to connect to the Farfetch Platform Solutions' services and modules to manage the application data layer and global state.

Installation

yarn

yarn add @farfetch/blackout-core

npm

npm i @farfetch/blackout-core

Usage

Update your store to include the reducers and entities, like the example below:

// Typically in `store/buildStore.js`
import { applyMiddleware, combineReducers, createStore } from 'redux';
import { bagMiddleware } from '@farfetch/blackout-core/analytics/redux/middlewares';
import { entitiesMapperReducer } from '@farfetch/blackout-core/entities/redux';
import checkout from '@farfetch/blackout-core/checkout/redux';
import listing from '@farfetch/blackout-core/products/listing/redux';
import otherScopeReducer from './other-scope';

// Create your reducer based on a combination of other reducers and entities
const reducers = combineReducers({
  checkout,
  entities: entitiesMapperReducer(),
  listing,
  otherScope: otherScopeReducer,
});
const middlewares = [bagMiddleware()];
const store = createStore(reducers, applyMiddleware(...middlewares));

With the store configured, you just need to import and use what you need

// Fetching a listing page
import { doGetListing } from '@farfetch/blackout-core/products/listing/redux';
import { getListing as getListingClient } from '@farfetch/blackout-core/products/listing/client';

const fetchListing = doGetListing(getListingClient);

fetchListing(args);

Additional configuration

Since this package is published in its original structure, all the source code is contained in a src folder. This means you might need additional configurations:

  • In order to have friendly imports (@farfetch/blackout-core vs @farfetch/blackout-core/src), you probably want to add aliases

    // Webpack example
    config.resolve.alias = {
      '@farfetch/blackout-core': '@farfetch/blackout-core/src',
    };
  • In order to have your project running, you probably need a specific loader

    // Webpack example
    config.module.rules.push({
      test: /\.jsx?$/,
      include: [/node_modules\/@farfetch\/blackout-core/],
      use: [
        {
          loader: 'babel-loader',
          options: myBabelConfig,
        },
      ],
    });

Contributing

Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.

Please read the CONTRIBUTING file to know what we expect from your contribution and the guidelines you should follow.

License

MIT @ Farfetch

1.102.0

2 months ago

1.101.0

2 months ago

1.100.0

3 months ago

1.99.0

4 months ago

1.98.0

5 months ago

1.97.0

5 months ago

1.96.0

6 months ago

1.94.0

6 months ago

1.92.0

9 months ago

1.90.1

10 months ago

1.95.0

6 months ago

1.93.0

8 months ago

1.91.0

10 months ago

1.90.0

11 months ago

1.82.0

1 year ago

1.84.0

1 year ago

1.86.0

1 year ago

1.89.0

12 months ago

1.88.0

12 months ago

1.83.0

1 year ago

1.85.0

1 year ago

1.87.0

12 months ago

1.81.0

1 year ago

1.80.0

1 year ago

1.79.0

1 year ago

1.78.0

1 year ago

1.70.0

2 years ago

1.72.0

2 years ago

1.72.1

2 years ago

1.74.0

1 year ago

1.74.1

1 year ago

1.76.0

1 year ago

1.74.2

1 year ago

1.76.1

1 year ago

1.71.0

2 years ago

1.73.0

2 years ago

1.73.1

2 years ago

1.75.0

1 year ago

1.73.2

1 year ago

1.77.0

1 year ago

1.59.0

2 years ago

1.60.0

2 years ago

1.62.0

2 years ago

1.61.0

2 years ago

1.63.0

2 years ago

1.64.0

2 years ago

1.65.0

2 years ago

1.66.0

2 years ago

2.0.0

2 years ago

1.67.0

2 years ago

1.68.0

2 years ago

1.69.0

2 years ago

1.58.1

2 years ago

1.58.0

2 years ago

1.58.2

2 years ago

1.57.0

2 years ago

1.56.1

2 years ago

1.56.0

2 years ago

1.55.0

2 years ago

1.53.3

2 years ago

1.54.0

2 years ago

1.53.0

2 years ago

1.53.2

2 years ago

1.53.1

2 years ago

1.46.0

2 years ago

1.45.1

2 years ago

1.45.0

2 years ago

1.48.0

2 years ago

1.47.0

2 years ago

1.46.1

2 years ago

1.49.0

2 years ago

1.51.0

2 years ago

1.50.0

2 years ago

1.52.1

2 years ago

1.52.0

2 years ago

1.42.1-rc.0

2 years ago

1.44.0

2 years ago

1.43.0

2 years ago

1.42.0

2 years ago