Skip to content

Instantly share code, notes, and snippets.

@JamieMason
Last active July 12, 2020 09:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JamieMason/77cfb23c2a4d66a85fbb095f7b686028 to your computer and use it in GitHub Desktop.
Save JamieMason/77cfb23c2a4d66a85fbb095f7b686028 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
const isNumber = (value) => typeof value === 'number' && !isNaN(value);
const isNonEmptyObject = (value) => Object.keys(value).length > 0;
const isNonEmptyString = (value) => typeof value === 'string' && value.length > 0;
const shouldAddFilterAt = (filterName) => (ctx, event) => {
return isNonEmptyString(event.value) && ctx[filterName][event.value] !== true;
};
const shouldRemoveFilterAt = (filterName) => (ctx, event) => {
return isNonEmptyString(event.value) && ctx[filterName][event.value] === true;
};
const shouldSetPriceAt = (filterName) => (ctx, event) => {
return isNumber(event.value) && event.value !== ctx[filterName];
};
const addFilterTo = (filterName) =>
assign({
[filterName]: (ctx, event) => ({ ...ctx[filterName], [event.value]: true }),
});
const removeFilterFrom = (filterName) =>
assign({
[filterName]: (ctx, event) => {
const nextFilters = { ...ctx[filterName] };
delete nextFilters[event.value];
return nextFilters;
},
});
const createFilterTransition = ({ guardName, actionName }) => ({
cond: guardName,
actions: [actionName, 'cancelPendingFetch', 'scheduleFetchAfterDelay'],
target: '.dirty',
});
const initialApiParams = {
allowTyposOnNumericTokens: false,
distinct: 'true',
facetFilters: [],
numericFilters: ['current_price>=50', 'current_price<=59'],
facets: [
'meta_data.size',
'product_meta_data.type',
'product_meta_data.gender',
'product_meta_data.brand_name',
'product_meta_data.colour_name',
],
filters: 'visible = 1 AND price > 0 AND (in_stock = 1 OR ewis_eligible = 1)',
hitsPerPage: 8,
tagFilters: '-redirect',
};
const initialResult = getMockInitialProps();
const sendSearch = getMockClientResponse;
const algoliaMachine = Machine(
{
id: 'algolia',
initial: 'validating',
context: {
'filter.price.min': 0,
'filter.price.max': Number.MAX_SAFE_INTEGER,
'sortOrder.all': ['Featured', 'Newest', 'Popular', 'Price: Highest', 'Price: Lowest'],
'sortOrder.selected': 'Newest',
'client.error': null,
'client.params': initialApiParams,
'client.result': initialResult,
},
states: {
validating: {
on: {
'': [
{
cond: 'hasError',
target: 'broken',
},
{ target: 'started' },
],
},
},
broken: {},
started: {
type: 'parallel',
states: {
/**
* A loading status indicator for HTTP Requests made by the Algolia
* Client. Requests are made when changing: filter settings, sort
* order, or page size.
*
* Data is stored in context.client.*
*/
algoliaClient: {
initial: 'idle',
states: {
idle: {
on: {
FETCH: 'loading',
},
},
loading: {
invoke: {
id: 'sendSearch',
src: 'sendSearch',
onDone: {
target: 'resolved',
actions: 'setSearchResults',
},
onError: {
target: 'rejected',
actions: 'setSearchError',
},
},
},
resolved: {
entry: send('RESOLVE'),
after: {
1000: 'idle',
},
},
rejected: {
entry: send('REJECT'),
after: {
1000: 'idle',
},
},
},
},
/**
* Based on response data from the Algolia Client at
* context.client.*, determines the state of the list of search
* results displayed in the main column of the UI.
*/
results: {
initial: 'evaluating',
on: {
RESOLVE: '.evaluating',
},
states: {
evaluating: {
on: {
'': [
{
cond: 'hasError',
target: 'broken',
},
{
cond: 'resultsAreEmpty',
target: 'empty',
},
{
target: 'populated',
},
],
},
},
broken: {},
empty: {},
populated: {},
},
},
/**
* Based on response data from the Algolia Client at
* context.client.*, determines whether and how to display a button
* for loading more results.
*/
loadMoreButton: {
initial: 'evaluating',
states: {
evaluating: {
on: {
'': [
{
cond: 'resultsAreEmpty',
target: 'hidden',
},
{
cond: 'resultsAreLastPage',
target: 'hidden',
},
{
target: 'enabled',
},
],
},
},
hidden: {
on: {
RESOLVE: 'evaluating',
},
},
enabled: {
on: {
FETCH: 'disabled',
},
},
disabled: {
on: {
RESOLVE: 'evaluating',
},
},
},
},
filters: {
type: 'parallel',
states: {
/**
* Manages solely the raw values within context.filter.* which the
* User has chosen for their Filter settings. When a filter is
* changed, a debounced fetch is scheduled to send a request to
* Algolia once the filters have been left idle for a short
* period.
*
* The data within context.filter.* can be used to populate the
* left column of PLPs.
*/
synchronisation: {
initial: 'dirty',
on: {
RESOLVE: {
target: '.clean',
},
REJECT: {
target: '.dirty',
},
SET_FACET_FILTER: createFilterTransition({
guardName: 'shouldSetFacetFilter',
actionName: 'setFacetFilter',
}),
UNSET_FACET_FILTER: createFilterTransition({
guardName: 'shouldUnsetFacetFilter',
actionName: 'unsetFacetFilter',
}),
SET_MAX_PRICE: createFilterTransition({
guardName: 'shouldSetMaxPrice',
actionName: 'setMaxPrice',
}),
SET_MIN_PRICE: createFilterTransition({
guardName: 'shouldSetMinPrice',
actionName: 'setMinPrice',
}),
RESET_ALL_FILTERS: createFilterTransition({
guardName: 'hasModifiedFilters',
actionName: 'resetAllFilters',
}),
SET_SORT_ORDER: createFilterTransition({
guardName: 'shouldSetSortOrder',
actionName: 'setSortOrder',
}),
},
states: {
dirty: {},
clean: {},
},
},
/**
* Inspects the raw values within context.filter.* to determine
* whether the User has used any of the filter controls to refine
* their search.
*
* This can be used to show/hide the "Applied Filters" summary at
* the top of the main column in the UI, or to show/hide a
* "Clear Filters" Button accordingly.
*/
modification: {
initial: 'evaluating',
on: {
SET_FACET_FILTER: '.evaluating',
UNSET_FACET_FILTER: '.evaluating',
SET_MAX_PRICE: '.evaluating',
SET_MIN_PRICE: '.evaluating',
RESET_ALL_FILTERS: '.unmodified',
SET_SORT_ORDER: '.evaluating',
},
states: {
evaluating: {
on: {
'': [
{ cond: 'hasModifiedFilters', target: 'modified' },
{ target: 'unmodified' },
],
},
},
unmodified: {},
modified: {},
},
},
},
},
},
},
},
},
{
actions: {
setFacetFilter: assign({
'client.params': (ctx, { facetName, facetValue }) => ({
...ctx['client.params'],
facetFilters: ctx['client.params'].facetFilters.concat(`${facetName}:${facetValue}`),
}),
}),
unsetFacetFilter: assign({
'client.params': (ctx, { facetName, facetValue }) => ({
...ctx['client.params'],
facetFilters: ctx['client.params'].facetFilters.filter(
(value) => value !== `${facetName}:${facetValue}`
),
}),
}),
resetAllFilters: assign({
'client.params': initialApiParams,
'filter.price.min': 0,
'filter.price.max': Number.MAX_SAFE_INTEGER,
}),
setMaxPrice: assign({
'filter.price.max': (ctx, { value }) => value,
}),
setMinPrice: assign({
'filter.price.min': (ctx, { value }) => value,
}),
setSortOrder: assign({
'sortOrder.selected': (ctx, { value }) => value,
}),
setSearchResults: assign({
'client.error': null,
'client.result': (ctx, { data }) => data,
}),
setSearchError: assign({
'client.error': (ctx, { data }) => data,
}),
cancelPendingFetch: actions.cancel('debounced-fetch'),
scheduleFetchAfterDelay: send('FETCH', {
delay: 1000,
id: 'debounced-fetch',
}),
},
guards: {
shouldSetFacetFilter(ctx, { facetName, facetValue }) {
return (
isNonEmptyString(facetName) &&
ctx['client.result'].facets[facetName] &&
isNonEmptyString(facetValue) &&
!ctx['client.params'].facetFilters.includes(`${facetName}:${facetValue}`)
);
},
shouldUnsetFacetFilter(ctx, { facetName, facetValue }) {
return (
isNonEmptyString(facetName) &&
ctx['client.result'].facets[facetName] &&
isNonEmptyString(facetValue) &&
ctx['client.params'].facetFilters.includes(`${facetName}:${facetValue}`)
);
},
shouldSetMinPrice: shouldSetPriceAt('filter.price.min'),
shouldSetMaxPrice: shouldSetPriceAt('filter.price.max'),
shouldSetSortOrder: (ctx, { value }) => value && ctx['sortOrder.all'].includes(value),
hasModifiedFilters(ctx) {
return (
ctx['filter.price.min'] !== 0 ||
ctx['filter.price.max'] !== Number.MAX_SAFE_INTEGER ||
ctx['client.params'].facetFilters.toString() !== initialApiParams.facetFilters.toString()
);
},
resultsAreEmpty(ctx) {
const result = ctx['client.result'];
return Boolean(result && Array.isArray(result.hits) && result.hits.length === 0);
},
resultsAreLastPage(ctx) {
const result = ctx['client.result'];
return Boolean(result && result.hitsPerPage >= result.nbHits);
},
hasError(ctx) {
/*@TODO validate everything important in the algolia response*/
const error = ctx['client.error'];
const params = ctx['client.params'];
const result = ctx['client.result'];
return !(
error === null &&
isNonEmptyObject(params) &&
Array.isArray(params.facets) &&
typeof params.filters === 'string' &&
isNumber(params.hitsPerPage) &&
isNonEmptyObject(result) &&
Array.isArray(result.hits) &&
isNonEmptyObject(params.facets)
);
},
},
services: {
sendSearch: (ctx) =>
new Promise((done) => {
console.log('sendSearch: sleeping for 5 seconds');
setTimeout(() => {
console.log('sendSearch: skipping the real client and returning existing context');
done(ctx['client.result']);
}, 5000);
}),
},
}
);
function getMockClientResponse() {
return new Promise((done) => {
setTimeout(() => {
done(getMockInitialProps());
}, 5000);
});
}
function getMockInitialProps() {
return JSON.parse(
'{"hits":[{"id":150910,"product_id":37306,"archived":false,"title":"Standard - Large","description":null,"sku":"G4LC0G01R-BLSM-large","price":25,"stock_level":2,"reference":"G4LC0G01R-BLSM-large","position":5,"stock_allocated_level":0,"tax_code":"UK VAT","price_includes_taxes":true,"ewis_eligible":false,"ordered_total":0,"meta_data":{"size":"L","colour_name":"","colour_reference":""},"in_stock":true,"current_price":25,"skus":["G4LC0G01R-BLSM-large"],"product_min_price":25,"product_max_price":25,"product_min_current_price":25,"product_max_current_price":25,"product_title":"Womens Right Glove Blossom - 2019","product_description":"Ultimate functional golf accessory. Add colour to your game and grip to your swing with the latest designer golf glove. Worn by Bubba Watson and Jonas Blixt of the PGA Tour. Conforms to USGA rules.","product_reference":"G4LC0G01R-BLSM","product_total_ratings":null,"product_average_rating":0,"product_rating":0,"published_at":1575493957,"product_meta_data":{"type":"Accessories","gender":"Women","season":"Never Out of Stock","features":"* 100% Cabretta Leather* Multiple colour options* Conforms to USGA rules","brand_name":"G/FORE","colour_name":"Pink","variant_colours":"pink,blue"},"visible":true,"product_path":"/products/g-fore-womens-right-glove-blossom-2018","category_ids":[261,291,277,287,276],"product_asset_files":[{"caption":"G4MC0G01R-BLSM-1.jpg","source":"https://staging-trendygolf-1561995371.s3.amazonaws.com/uploads/asset_file/asset_file/3753/1575501632.4505877-G4MC0G01R-BLSM-1.jpg"}],"objectID":"150910","_highlightResult":{"title":{"value":"Standard - Large","matchLevel":"none","matchedWords":[]},"meta_data":{"size":{"value":"L","matchLevel":"none","matchedWords":[]},"colour_name":{"value":"","matchLevel":"none","matchedWords":[]}},"current_price":{"value":"25.0","matchLevel":"none","matchedWords":[]},"skus":[{"value":"G4LC0G01R-BLSM-large","matchLevel":"none","matchedWords":[]}],"product_title":{"value":"Womens Right <em>Glove</em> Blossom - 2019","matchLevel":"full","fullyHighlighted":false,"matchedWords":["glove"]},"product_description":{"value":"Ultimate functional golf accessory. Add colour to your game and grip to your swing with the latest designer golf <em>glove</em>. Worn by Bubba Watson and Jonas Blixt of the PGA Tour. Conforms to USGA rules.","matchLevel":"full","fullyHighlighted":false,"matchedWords":["glove"]},"product_meta_data":{"gender":{"value":"Women","matchLevel":"none","matchedWords":[]},"brand_name":{"value":"G/FORE","matchLevel":"none","matchedWords":[]}}}},{"id":150905,"product_id":37305,"archived":false,"title":"Standard - Large","description":null,"sku":"G4LC0G01R-PACF-large","price":25,"stock_level":1,"reference":"G4LC0G01R-PACF-large","position":5,"stock_allocated_level":0,"tax_code":"UK VAT","price_includes_taxes":true,"ewis_eligible":false,"ordered_total":0,"meta_data":{"size":"L","colour_name":"","colour_reference":""},"in_stock":true,"current_price":25,"skus":["G4LC0G01R-PACF-large"],"product_min_price":25,"product_max_price":25,"product_min_current_price":25,"product_max_current_price":25,"product_title":"Womens Right Glove Pacific - 2019","product_description":"Ultimate functional golf accessory. Add colour to your game and grip to your swing with the latest designer golf glove. Worn by Bubba Watson and Jonas Blixt of the PGA Tour. Conforms to USGA rules.","product_reference":"G4LC0G01R-PACF","product_total_ratings":null,"product_average_rating":0,"product_rating":0,"published_at":1575493955,"product_meta_data":{"type":"Accessories","gender":"Women","season":"Never Out of Stock","features":"* 100% Cabretta Leather* Multiple colour options* Conforms to USGA rules","brand_name":"G/FORE","colour_name":"Blue","variant_colours":"pink,blue"},"visible":true,"product_path":"/products/g-fore-womens-right-glove-pacific-2018","category_ids":[261,291,277,287,276],"product_asset_files":[{"caption":"G-fore-pacific-right.jpg","source":"https://staging-trendygolf-1561995371.s3.amazonaws.com/uploads/asset_file/asset_file/2545/1575501389.568504-G-fore-pacific-right.jpg"}],"objectID":"150905","_highlightResult":{"title":{"value":"Standard - Large","matchLevel":"none","matchedWords":[]},"meta_data":{"size":{"value":"L","matchLevel":"none","matchedWords":[]},"colour_name":{"value":"","matchLevel":"none","matchedWords":[]}},"current_price":{"value":"25.0","matchLevel":"none","matchedWords":[]},"skus":[{"value":"G4LC0G01R-PACF-large","matchLevel":"none","matchedWords":[]}],"product_title":{"value":"Womens Right <em>Glove</em> Pacific - 2019","matchLevel":"full","fullyHighlighted":false,"matchedWords":["glove"]},"product_description":{"value":"Ultimate functional golf accessory. Add colour to your game and grip to your swing with the latest designer golf <em>glove</em>. Worn by Bubba Watson and Jonas Blixt of the PGA Tour. Conforms to USGA rules.","matchLevel":"full","fullyHighlighted":false,"matchedWords":["glove"]},"product_meta_data":{"gender":{"value":"Women","matchLevel":"none","matchedWords":[]},"brand_name":{"value":"G/FORE","matchLevel":"none","matchedWords":[]}}}},{"id":150900,"product_id":37304,"archived":false,"title":"Standard - Large","description":null,"sku":"G4LC0G01R-BLSH-large","price":25,"stock_level":1,"reference":"G4LC0G01R-BLSH-large","position":5,"stock_allocated_level":0,"tax_code":"UK VAT","price_includes_taxes":true,"ewis_eligible":false,"ordered_total":0,"meta_data":{"size":"L","colour_name":"","colour_reference":""},"in_stock":true,"current_price":25,"skus":["G4LC0G01R-BLSH-large"],"product_min_price":25,"product_max_price":29.99,"product_min_current_price":8.99,"product_max_current_price":29.99,"product_title":"Womens Right Glove Blush - 2019","product_description":"Ultimate functional golf accessory. Add colour to your game and grip to your swing with the latest designer golf glove. Worn by Bubba Watson and Jonas Blixt of the PGA Tour. Conforms to USGA rules.","product_reference":"G4LC0G01R-BLSH","product_total_ratings":null,"product_average_rating":0,"product_rating":0,"published_at":1575493954,"product_meta_data":{"type":"Accessories","gender":"Women","season":"Never Out of Stock","features":"* 100% Cabretta Leather* Multiple colour options* Conforms to USGA rules","brand_name":"G/FORE","colour_name":"Pink","variant_colours":"pink,blue"},"visible":true,"product_path":"/products/g-fore-womens-right-glove-blush-2018","category_ids":[294,261,291,277,287,276],"product_asset_files":[{"caption":"G4MC0G01R-BLSH-1.jpg","source":"https://staging-trendygolf-1561995371.s3.amazonaws.com/uploads/asset_file/asset_file/2951/1575501487.4550593-G4MC0G01R-BLSH-1.jpg"}],"objectID":"150900","_highlightResult":{"title":{"value":"Standard - Large","matchLevel":"none","matchedWords":[]},"meta_data":{"size":{"value":"L","matchLevel":"none","matchedWords":[]},"colour_name":{"value":"","matchLevel":"none","matchedWords":[]}},"current_price":{"value":"25.0","matchLevel":"none","matchedWords":[]},"skus":[{"value":"G4LC0G01R-BLSH-large","matchLevel":"none","matchedWords":[]}],"product_title":{"value":"Womens Right <em>Glove</em> Blush - 2019","matchLevel":"full","fullyHighlighted":false,"matchedWords":["glove"]},"product_description":{"value":"Ultimate functional golf accessory. Add colour to your game and grip to your swing with the latest designer golf <em>glove</em>. Worn by Bubba Watson and Jonas Blixt of the PGA Tour. Conforms to USGA rules.","matchLevel":"full","fullyHighlighted":false,"matchedWords":["glove"]},"product_meta_data":{"gender":{"value":"Women","matchLevel":"none","matchedWords":[]},"brand_name":{"value":"G/FORE","matchLevel":"none","matchedWords":[]}}}},{"id":150894,"product_id":37303,"archived":false,"title":"Standard - Medium/Large","description":null,"sku":"G4LC0G01-BLSM-medium-large","price":25,"stock_level":5,"reference":"G4LC0G01-BLSM-medium-large","position":4,"stock_allocated_level":0,"tax_code":"UK VAT","price_includes_taxes":true,"ewis_eligible":false,"ordered_total":0,"meta_data":{"size":"M/L","colour_name":"","colour_reference":""},"in_stock":true,"current_price":25,"skus":["G4LC0G01-BLSM-medium-large"],"product_min_price":25,"product_max_price":25,"product_min_current_price":25,"product_max_current_price":25,"product_title":"Womens Left Glove Blossom - 2019","product_description":"Ultimate functional golf accessory. Add colour to your game and grip to your swing with the latest designer golf glove. Worn by Bubba Watson and Jonas Blixt of the PGA Tour. Conforms to USGA rules.","product_reference":"G4LC0G01-BLSM","product_total_ratings":null,"product_average_rating":0,"product_rating":0,"published_at":1575493953,"product_meta_data":{"type":"Accessories","gender":"Women","season":"Never Out of Stock","features":"* 100% Cabretta Leather* Multiple colour options* Conforms to USGA rules","brand_name":"G/FORE","colour_name":"Pink","variant_colours":"pink,purple,blue"},"visible":true,"product_path":"/products/g-fore-womens-left-glove-blossom-2018","category_ids":[261,291,277,287,276],"product_asset_files":[{"caption":"RackMultipart20180801-333-1n2bo3q.jpg","source":"https://staging-trendygolf-1561995371.s3.amazonaws.com/uploads/asset_file/asset_file/2544/1575501388.9536657-RackMultipart20180801-333-1n2bo3q.jpg"}],"objectID":"150894","_highlightResult":{"title":{"value":"Standard - Medium/Large","matchLevel":"none","matchedWords":[]},"meta_data":{"size":{"value":"M/L","matchLevel":"none","matchedWords":[]},"colour_name":{"value":"","matchLevel":"none","matchedWords":[]}},"current_price":{"value":"25.0","matchLevel":"none","matchedWords":[]},"skus":[{"value":"G4LC0G01-BLSM-medium-large","matchLevel":"none","matchedWords":[]}],"product_title":{"value":"Womens Left <em>Glove</em> Blossom - 2019","matchLevel":"full","fullyHighlighted":false,"matchedWords":["glove"]},"product_description":{"value":"Ultimate functional golf accessory. Add colour to your game and grip to your swing with the latest designer golf <em>glove</em>. Worn by Bubba Watson and Jonas Blixt of the PGA Tour. Conforms to USGA rules.","matchLevel":"full","fullyHighlighted":false,"matchedWords":["glove"]},"product_meta_data":{"gender":{"value":"Women","matchLevel":"none","matchedWords":[]},"brand_name":{"value":"G/FORE","matchLevel":"none","matchedWords":[]}}}},{"id":150889,"product_id":37302,"archived":false,"title":"Standard - Large","description":null,"sku":"G4LC0G01-PACF-large","price":25,"stock_level":2,"reference":"G4LC0G01-PACF-large","position":5,"stock_allocated_level":0,"tax_code":"UK VAT","price_includes_taxes":true,"ewis_eligible":false,"ordered_total":0,"meta_data":{"size":"L","colour_name":"","colour_reference":""},"in_stock":true,"current_price":25,"skus":["G4LC0G01-PACF-large"],"product_min_price":0,"product_max_price":25,"product_min_current_price":0,"product_max_current_price":25,"product_title":"Womens Left Glove Pacific - 2019","product_description":"Ultimate functional golf accessory. Add colour to your game and grip to your swing with the latest designer golf glove. Worn by Bubba Watson and Jonas Blixt of the PGA Tour. Conforms to USGA rules.","product_reference":"G4LC0G01-PACF","product_total_ratings":null,"product_average_rating":0,"product_rating":0,"published_at":1575493952,"product_meta_data":{"type":"Accessories","gender":"Women","season":"Never Out of Stock","features":"* 100% Cabretta Leather* Multiple colour options* Conforms to USGA rules","brand_name":"G/FORE","colour_name":"Blue","variant_colours":"pink,purple,blue"},"visible":true,"product_path":"/products/g-fore-womens-left-glove-pacific-2018","category_ids":[261,291,277,287,276],"product_asset_files":[{"caption":"RackMultipart20180801-322-1twxfog.jpg","source":"https://staging-trendygolf-1561995371.s3.amazonaws.com/uploads/asset_file/asset_file/2543/1575501388.2664752-RackMultipart20180801-322-1twxfog.jpg"}],"objectID":"150889","_highlightResult":{"title":{"value":"Standard - Large","matchLevel":"none","matchedWords":[]},"meta_data":{"size":{"value":"L","matchLevel":"none","matchedWords":[]},"colour_name":{"value":"","matchLevel":"none","matchedWords":[]}},"current_price":{"value":"25.0","matchLevel":"none","matchedWords":[]},"skus":[{"value":"G4LC0G01-PACF-large","matchLevel":"none","matchedWords":[]}],"product_title":{"value":"Womens Left <em>Glove</em> Pacific - 2019","matchLevel":"full","fullyHighlighted":false,"matchedWords":["glove"]},"product_description":{"value":"Ultimate functional golf accessory. Add colour to your game and grip to your swing with the latest designer golf <em>glove</em>. Worn by Bubba Watson and Jonas Blixt of the PGA Tour. Conforms to USGA rules.","matchLevel":"full","fullyHighlighted":false,"matchedWords":["glove"]},"product_meta_data":{"gender":{"value":"Women","matchLevel":"none","matchedWords":[]},"brand_name":{"value":"G/FORE","matchLevel":"none","matchedWords":[]}}}},{"id":150884,"product_id":37301,"archived":false,"title":"Standard - Large","description":null,"sku":"G4LC0G01-LAVN-large","price":25,"stock_level":1,"reference":"G4LC0G01-LAVN-large","position":5,"stock_allocated_level":0,"tax_code":"UK VAT","price_includes_taxes":true,"ewis_eligible":false,"ordered_total":0,"meta_data":{"size":"L","colour_name":"","colour_reference":""},"in_stock":true,"current_price":25,"skus":["G4LC0G01-LAVN-large"],"product_min_price":25,"product_max_price":25,"product_min_current_price":25,"product_max_current_price":25,"product_title":"Womens Left Glove Lavender - 2019","product_description":"Ultimate functional golf accessory. Add colour to your game and grip to your swing with the latest designer golf glove. Worn by Bubba Watson and Jonas Blixt of the PGA Tour. Conforms to USGA rules.","product_reference":"G4LC0G01-LAVN","product_total_ratings":null,"product_average_rating":0,"product_rating":0,"published_at":1575493951,"product_meta_data":{"type":"Accessories","gender":"Women","season":"Never Out of Stock","features":"* 100% Cabretta Leather* Multiple colour options* Conforms to USGA rules","brand_name":"G/FORE","colour_name":"Purple","variant_colours":"pink,purple,blue"},"visible":true,"product_path":"/products/g-fore-womens-left-glove-lavender-2018","category_ids":[261,291,277,287,276],"product_asset_files":[{"caption":"RackMultipart20180801-332-xntkb8.jpg","source":"https://staging-trendygolf-1561995371.s3.amazonaws.com/uploads/asset_file/asset_file/2541/1575501387.0350745-RackMultipart20180801-332-xntkb8.jpg"}],"objectID":"150884","_highlightResult":{"title":{"value":"Standard - Large","matchLevel":"none","matchedWords":[]},"meta_data":{"size":{"value":"L","matchLevel":"none","matchedWords":[]},"colour_name":{"value":"","matchLevel":"none","matchedWords":[]}},"current_price":{"value":"25.0","matchLevel":"none","matchedWords":[]},"skus":[{"value":"G4LC0G01-LAVN-large","matchLevel":"none","matchedWords":[]}],"product_title":{"value":"Womens Left <em>Glove</em> Lavender - 2019","matchLevel":"full","fullyHighlighted":false,"matchedWords":["glove"]},"product_description":{"value":"Ultimate functional golf accessory. Add colour to your game and grip to your swing with the latest designer golf <em>glove</em>. Worn by Bubba Watson and Jonas Blixt of the PGA Tour. Conforms to USGA rules.","matchLevel":"full","fullyHighlighted":false,"matchedWords":["glove"]},"product_meta_data":{"gender":{"value":"Women","matchLevel":"none","matchedWords":[]},"brand_name":{"value":"G/FORE","matchLevel":"none","matchedWords":[]}}}},{"id":150879,"product_id":37300,"archived":false,"title":"Standard - Large","description":null,"sku":"G4LC0G01-BLSH-large","price":25,"stock_level":3,"reference":"G4LC0G01-BLSH-large","position":5,"stock_allocated_level":0,"tax_code":"UK VAT","price_includes_taxes":true,"ewis_eligible":false,"ordered_total":0,"meta_data":{"size":"L","colour_name":"","colour_reference":""},"in_stock":true,"current_price":25,"skus":["G4LC0G01-BLSH-large"],"product_min_price":25,"product_max_price":25,"product_min_current_price":25,"product_max_current_price":25,"product_title":"Womens Left Glove Blush - 2019","product_description":"Ultimate functional golf accessory. Add colour to your game and grip to your swing with the latest designer golf glove. Worn by Bubba Watson and Jonas Blixt of the PGA Tour. Conforms to USGA rules.","product_reference":"G4LC0G01-BLSH","product_total_ratings":null,"product_average_rating":0,"product_rating":0,"published_at":1575493949,"product_meta_data":{"type":"Accessories","gender":"Women","season":"Never Out of Stock","features":"* 100% Cabretta Leather* Multiple colour options* Conforms to USGA rules","brand_name":"G/FORE","colour_name":"Pink","variant_colours":"pink,purple,blue"},"visible":true,"product_path":"/products/g-fore-womens-left-glove-blush-2018","category_ids":[261,291,277,287,276],"product_asset_files":[{"caption":"RackMultipart20180801-324-8ssmzg.jpg","source":"https://staging-trendygolf-1561995371.s3.amazonaws.com/uploads/asset_file/asset_file/2542/1575501387.6234763-RackMultipart20180801-324-8ssmzg.jpg"}],"objectID":"150879","_highlightResult":{"title":{"value":"Standard - Large","matchLevel":"none","matchedWords":[]},"meta_data":{"size":{"value":"L","matchLevel":"none","matchedWords":[]},"colour_name":{"value":"","matchLevel":"none","matchedWords":[]}},"current_price":{"value":"25.0","matchLevel":"none","matchedWords":[]},"skus":[{"value":"G4LC0G01-BLSH-large","matchLevel":"none","matchedWords":[]}],"product_title":{"value":"Womens Left <em>Glove</em> Blush - 2019","matchLevel":"full","fullyHighlighted":false,"matchedWords":["glove"]},"product_description":{"value":"Ultimate functional golf accessory. Add colour to your game and grip to your swing with the latest designer golf <em>glove</em>. Worn by Bubba Watson and Jonas Blixt of the PGA Tour. Conforms to USGA rules.","matchLevel":"full","fullyHighlighted":false,"matchedWords":["glove"]},"product_meta_data":{"gender":{"value":"Women","matchLevel":"none","matchedWords":[]},"brand_name":{"value":"G/FORE","matchLevel":"none","matchedWords":[]}}}},{"id":150851,"product_id":37295,"archived":false,"title":"Standard - Large","description":null,"sku":"G4YC0G01-CLVR-large","price":20,"stock_level":1,"reference":"G4YC0G01-CLVR-large","position":5,"stock_allocated_level":0,"tax_code":"UK VAT","price_includes_taxes":true,"ewis_eligible":false,"ordered_total":0,"meta_data":{"size":"L","colour_name":"","colour_reference":""},"in_stock":true,"current_price":20,"skus":["G4YC0G01-CLVR-large"],"product_min_price":20,"product_max_price":20,"product_min_current_price":20,"product_max_current_price":20,"product_title":"JUNIOR Left Glove Clover - 2019","product_description":"Ultimate functional golf accessory. Add colour to your game and grip to your swing with the latest designer golf glove. Worn by Bubba Watson and Jonas Blixt of the PGA Tour. Conforms to USGA rules.","product_reference":"G4YC0G01-CLVR","product_total_ratings":null,"product_average_rating":0,"product_rating":0,"published_at":1575493943,"product_meta_data":{"type":"Accessories","gender":"Junior","season":"Season Carry Over 2019","features":"* 100% Cabretta Leather* Multiple colour options* Conforms to USGA rules","brand_name":"G/FORE","colour_name":"Green","variant_colours":"pink,green"},"visible":true,"product_path":"/products/g-fore-junior-left-glove-clover-2018","category_ids":[243,254,276,225,259,261,277,291,287,240],"product_asset_files":[{"caption":"G4MC0G01-CLVR-1.jpg","source":"https://staging-trendygolf-1561995371.s3.amazonaws.com/uploads/asset_file/asset_file/2540/1575501386.4260511-G4MC0G01-CLVR-1.jpg"}],"objectID":"150851","_highlightResult":{"title":{"value":"Standard - Large","matchLevel":"none","matchedWords":[]},"meta_data":{"size":{"value":"L","matchLevel":"none","matchedWords":[]},"colour_name":{"value":"","matchLevel":"none","matchedWords":[]}},"current_price":{"value":"20.0","matchLevel":"none","matchedWords":[]},"skus":[{"value":"G4YC0G01-CLVR-large","matchLevel":"none","matchedWords":[]}],"product_title":{"value":"JUNIOR Left <em>Glove</em> Clover - 2019","matchLevel":"full","fullyHighlighted":false,"matchedWords":["glove"]},"product_description":{"value":"Ultimate functional golf accessory. Add colour to your game and grip to your swing with the latest designer golf <em>glove</em>. Worn by Bubba Watson and Jonas Blixt of the PGA Tour. Conforms to USGA rules.","matchLevel":"full","fullyHighlighted":false,"matchedWords":["glove"]},"product_meta_data":{"gender":{"value":"Junior","matchLevel":"none","matchedWords":[]},"brand_name":{"value":"G/FORE","matchLevel":"none","matchedWords":[]}}}}],"nbHits":70,"page":0,"nbPages":9,"hitsPerPage":8,"facets":{"meta_data.size":{"L":41,"M/L":38,"S":35,"M":34,"XL":24,"UK 8":6,"UK 10":4,"One Size Fits All":3,"UK 11":3,"UK 7":3,"UK 8.5":3,"UK 9":3,"XXL":3,"UK 12":2,"UK 4":2,"UK 4.5":2,"UK 5":2,"UK 5.5":2,"UK 6":2,"UK 7.5":2,"UK 9.5":2,"XS":2,"L/XL":1,"Pack of 8":1,"S/M":1,"UK 10.5":1,"UK 11.5":1,"UK 6.5":1},"product_meta_data.type":{"Accessories":149,"Golf Shoes":41,"Knitwear":14,"Skirts & Skorts":7,"Golf Gloves":5,"Mid Layers":4,"Polo Shirts":2,"Hybrid Jackets":1,"Jackets":1},"product_meta_data.gender":{"Men":167,"Women":47,"Junior":8,"All":2},"product_meta_data.brand_name":{"G/FORE":166,"Puma":24,"BOSS":14,"RLX Ralph Lauren":11,"J.Lindeberg":2,"Under Armour":2,"Galvin Green":1,"Max Golf Protein":1,"Peak Performance":1,"Polo Golf Ralph Lauren":1,"Royal Albartross":1},"product_meta_data.colour_name":{"Pink":44,"White":35,"Grey":30,"Blue":29,"Navy":25,"Black":18,"Green":17,"Purple":13,"Yellow":7,"Orange":5,"Brown":1}},"exhaustiveFacetsCount":false,"exhaustiveNbHits":true,"query":"glove","params":"query=glove&allowTyposOnNumericTokens=false&distinct=true&facets=%5B%22meta_data.size%22%2C%22product_meta_data.type%22%2C%22product_meta_data.gender%22%2C%22product_meta_data.brand_name%22%2C%22product_meta_data.colour_name%22%5D&filters=visible+%3D+1+AND+price+%3E+0+AND+%28in_stock+%3D+1+OR+ewis_eligible+%3D+1%29&hitsPerPage=8&tagFilters=-redirect","processingTimeMS":2}'
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment