@bonlineza/luxity-lib 2.31.5 → 2.32.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/GraphQLDropdownSelector.js +5 -4
- package/LuxityDesktopHeader.js +107 -36
- package/LuxityGraphQLDropdownSelector.js +5 -4
- package/LuxityMobileHeader.js +146 -56
- package/LuxitySideNav.js +143 -39
- package/MaterialSelector.js +5 -4
- package/ModelSelector.js +5 -4
- package/build/bundle.css +1 -1
- package/build/bundle.js +193 -88
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react'), require('styled-components'), require('@bonlineza/b-lib/EllipsisLoader'), require('@bonlineza/b-lib/PageReady'), require('react-animate-height'), require('numeral'), require('stylis-rule-sheet'), require('react-dom'), require('prop-types'), require('raf'), require('react-input-autosize'), require('react-transition-group'), require('@bonlineza/b-lib/functions'), require('rc-slider'), require('react-notify-toast')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['react', 'styled-components', '@bonlineza/b-lib/EllipsisLoader', '@bonlineza/b-lib/PageReady', 'react-animate-height', 'numeral', 'stylis-rule-sheet', 'react-dom', 'prop-types', 'raf', 'react-input-autosize', 'react-transition-group', '@bonlineza/b-lib/functions', 'rc-slider', 'react-notify-toast'], factory) :
|
|
4
|
-
(global = global || self, global.GraphQLDropdownSelector = factory(global.React, global.styled, global.EllipsisLoader, global.PageReady, global.AnimateHeight, global.numeral, global['stylis-rule-sheet'], global.reactDom, global.PropTypes, global.raf, global['react-input-autosize'], global['react-transition-group'], global.function, global.rcSlider, global['react-notify-toast']));
|
|
5
|
-
}(this, (function (React, styled, EllipsisLoader, PageReady, AnimateHeight, numeral, stylisRuleSheet, reactDom, PropTypes, raf, AutosizeInput, reactTransitionGroup, functions, rcSlider, Notifications) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react'), require('styled-components'), require('@bonlineza/b-lib/EllipsisLoader'), require('@bonlineza/b-lib/PageReady'), require('react-animate-height'), require('numeral'), require('stylis-rule-sheet'), require('react-dom'), require('prop-types'), require('raf'), require('react-input-autosize'), require('react-transition-group'), require('@bonlineza/b-lib/functions'), require('rc-slider'), require('react-notify-toast'), require('axios')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['react', 'styled-components', '@bonlineza/b-lib/EllipsisLoader', '@bonlineza/b-lib/PageReady', 'react-animate-height', 'numeral', 'stylis-rule-sheet', 'react-dom', 'prop-types', 'raf', 'react-input-autosize', 'react-transition-group', '@bonlineza/b-lib/functions', 'rc-slider', 'react-notify-toast', 'axios'], factory) :
|
|
4
|
+
(global = global || self, global.GraphQLDropdownSelector = factory(global.React, global.styled, global.EllipsisLoader, global.PageReady, global.AnimateHeight, global.numeral, global['stylis-rule-sheet'], global.reactDom, global.PropTypes, global.raf, global['react-input-autosize'], global['react-transition-group'], global.function, global.rcSlider, global['react-notify-toast'], global.axios));
|
|
5
|
+
}(this, (function (React, styled, EllipsisLoader, PageReady, AnimateHeight, numeral, stylisRuleSheet, reactDom, PropTypes, raf, AutosizeInput, reactTransitionGroup, functions, rcSlider, Notifications, axios) { 'use strict';
|
|
6
6
|
|
|
7
7
|
var React__default = 'default' in React ? React['default'] : React;
|
|
8
8
|
var styled__default = 'default' in styled ? styled['default'] : styled;
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
raf = raf && Object.prototype.hasOwnProperty.call(raf, 'default') ? raf['default'] : raf;
|
|
16
16
|
AutosizeInput = AutosizeInput && Object.prototype.hasOwnProperty.call(AutosizeInput, 'default') ? AutosizeInput['default'] : AutosizeInput;
|
|
17
17
|
var Notifications__default = 'default' in Notifications ? Notifications['default'] : Notifications;
|
|
18
|
+
axios = axios && Object.prototype.hasOwnProperty.call(axios, 'default') ? axios['default'] : axios;
|
|
18
19
|
|
|
19
20
|
function ownKeys(object, enumerableOnly) {
|
|
20
21
|
var keys = Object.keys(object);
|
package/LuxityDesktopHeader.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['react'], factory) :
|
|
4
|
-
(global = global || self, global.LuxityDesktopHeader = factory(global.React));
|
|
5
|
-
}(this, (function (React) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react'), require('axios')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['react', 'axios'], factory) :
|
|
4
|
+
(global = global || self, global.LuxityDesktopHeader = factory(global.React, global.axios));
|
|
5
|
+
}(this, (function (React, axios) { 'use strict';
|
|
6
6
|
|
|
7
7
|
var React__default = 'default' in React ? React['default'] : React;
|
|
8
|
+
axios = axios && Object.prototype.hasOwnProperty.call(axios, 'default') ? axios['default'] : axios;
|
|
8
9
|
|
|
9
10
|
function ownKeys(object, enumerableOnly) {
|
|
10
11
|
var keys = Object.keys(object);
|
|
@@ -106,6 +107,12 @@
|
|
|
106
107
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
107
108
|
}
|
|
108
109
|
|
|
110
|
+
var getBrands = function getBrands() {
|
|
111
|
+
return {
|
|
112
|
+
query: "{\n latest_arrivals: luxity_brands(has_products: true, limit: 1000, page: 1) {data {id name slug}}\n bags: luxity_brands(has_products: true, limit: 1000, page: 1, category_type: BAGS) {data {id name slug}}\n shoes: luxity_brands(has_products: true, limit: 1000, page: 1, category_type: SHOES) {data {id name slug}}\n apparel: luxity_brands(has_products: true, limit: 1000, page: 1, category_type: APPAREL) {data {id name slug}}\n accessories: luxity_brands(has_products: true, limit: 1000, page: 1, category_type: ACCESSORIES) {data {id name slug}}\n watches: luxity_brands(has_products: true, limit: 1000, page: 1, category_type: WATCHES) {data {id name slug}}\n accessories_categories: luxity_accessories_categories_list { id name slug }\n apparel_styles: luxity_apparel_styles_list { name slug }\n } "
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
|
|
109
116
|
var Dropdown = function Dropdown(_ref) {
|
|
110
117
|
var title = _ref.title,
|
|
111
118
|
imageSrc = _ref.imageSrc,
|
|
@@ -115,10 +122,16 @@
|
|
|
115
122
|
brandElements = _ref$brandElements === void 0 ? [] : _ref$brandElements,
|
|
116
123
|
productsUrl = _ref.productsUrl,
|
|
117
124
|
categorySlug = _ref.categorySlug,
|
|
118
|
-
categoryTitle = _ref.categoryTitle
|
|
119
|
-
|
|
125
|
+
categoryTitle = _ref.categoryTitle,
|
|
126
|
+
isLoading = _ref.isLoading,
|
|
127
|
+
hasError = _ref.hasError;
|
|
128
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, hasError ? /*#__PURE__*/React__default.createElement("div", {
|
|
129
|
+
className: "dropdown__errors"
|
|
130
|
+
}, "Failed to load data.") : /*#__PURE__*/React__default.createElement("div", {
|
|
120
131
|
className: "dropdown"
|
|
121
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
132
|
+
}, isLoading ? /*#__PURE__*/React__default.createElement("div", {
|
|
133
|
+
className: "cover-spinner"
|
|
134
|
+
}) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
122
135
|
className: "dropdown__column"
|
|
123
136
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
124
137
|
className: "dropdown__title"
|
|
@@ -129,11 +142,11 @@
|
|
|
129
142
|
href: "".concat(productsUrl, "/").concat(categoryElement.category, "/").concat(categoryElement === null || categoryElement === void 0 ? void 0 : categoryElement.slug),
|
|
130
143
|
className: "dropdown__element",
|
|
131
144
|
key: categoryElement.name
|
|
132
|
-
}, categoryElement === null || categoryElement === void 0 ? void 0 : categoryElement.name) : /*#__PURE__*/React__default.createElement("a", {
|
|
145
|
+
}, categoryElement === null || categoryElement === void 0 ? void 0 : categoryElement.name.toLowerCase()) : /*#__PURE__*/React__default.createElement("a", {
|
|
133
146
|
href: "".concat(productsUrl, "/").concat(categoryElement === null || categoryElement === void 0 ? void 0 : categoryElement.slug),
|
|
134
147
|
className: "dropdown__element",
|
|
135
148
|
key: categoryElement.name
|
|
136
|
-
}, categoryElement === null || categoryElement === void 0 ? void 0 : categoryElement.name);
|
|
149
|
+
}, categoryElement === null || categoryElement === void 0 ? void 0 : categoryElement.name.toLowerCase());
|
|
137
150
|
}))), /*#__PURE__*/React__default.createElement("div", {
|
|
138
151
|
className: "dropdown__column"
|
|
139
152
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -154,7 +167,7 @@
|
|
|
154
167
|
}, /*#__PURE__*/React__default.createElement("img", {
|
|
155
168
|
src: imageSrc,
|
|
156
169
|
alt: "".concat(title)
|
|
157
|
-
})));
|
|
170
|
+
})))));
|
|
158
171
|
};
|
|
159
172
|
|
|
160
173
|
var StoresDropdown = function StoresDropdown(_ref) {
|
|
@@ -223,6 +236,14 @@
|
|
|
223
236
|
}
|
|
224
237
|
};
|
|
225
238
|
|
|
239
|
+
var removeCategoryByName = function removeCategoryByName(categories, name) {
|
|
240
|
+
var _categories$filter;
|
|
241
|
+
|
|
242
|
+
return (_categories$filter = categories === null || categories === void 0 ? void 0 : categories.filter(function (category) {
|
|
243
|
+
return category.name !== name;
|
|
244
|
+
})) !== null && _categories$filter !== void 0 ? _categories$filter : [];
|
|
245
|
+
};
|
|
246
|
+
|
|
226
247
|
var LuxityDesktopHeader = function LuxityDesktopHeader(_ref) {
|
|
227
248
|
var accountIcon = _ref.accountIcon,
|
|
228
249
|
cartIcon = _ref.cartIcon,
|
|
@@ -230,39 +251,56 @@
|
|
|
230
251
|
cartCount = _ref.cartCount,
|
|
231
252
|
logoSrc = _ref.logoSrc,
|
|
232
253
|
categoryElements = _ref.categoryElements,
|
|
233
|
-
newBrandElements = _ref.newBrandElements,
|
|
234
|
-
bagsElements = _ref.bagsElements,
|
|
235
|
-
shoesElements = _ref.shoesElements,
|
|
236
|
-
clothingElements = _ref.clothingElements,
|
|
237
|
-
accessoriesElements = _ref.accessoriesElements,
|
|
238
|
-
accessoriesCategoryElements = _ref.accessoriesCategoryElements,
|
|
239
|
-
apparelStylesElements = _ref.apparelStylesElements,
|
|
240
|
-
watchesElements = _ref.watchesElements,
|
|
241
254
|
newBrandsImage = _ref.newBrandsImage,
|
|
242
255
|
bagsImage = _ref.bagsImage,
|
|
243
256
|
shoesImage = _ref.shoesImage,
|
|
244
257
|
clothingImage = _ref.clothingImage,
|
|
245
258
|
accessoriesImage = _ref.accessoriesImage,
|
|
246
259
|
watchesImage = _ref.watchesImage,
|
|
247
|
-
productsUrl = _ref.productsUrl,
|
|
248
260
|
stores = _ref.stores,
|
|
249
261
|
contactNumber = _ref.contactNumber,
|
|
262
|
+
productsUrl = _ref.productsUrl,
|
|
250
263
|
onInterestClick = _ref.onInterestClick,
|
|
251
264
|
onCartClick = _ref.onCartClick,
|
|
252
265
|
onAccountClick = _ref.onAccountClick,
|
|
253
266
|
inputSearchIcon = _ref.inputSearchIcon,
|
|
254
267
|
onSearch = _ref.onSearch,
|
|
255
|
-
|
|
268
|
+
onSellToUsClick = _ref.onSellToUsClick,
|
|
256
269
|
blogLink = _ref.blogLink,
|
|
257
270
|
contactUsLink = _ref.contactUsLink,
|
|
258
|
-
|
|
259
|
-
onLogoClick = _ref.onLogoClick
|
|
271
|
+
ourStoryLink = _ref.ourStoryLink,
|
|
272
|
+
onLogoClick = _ref.onLogoClick,
|
|
273
|
+
endpoint = _ref.endpoint;
|
|
260
274
|
|
|
261
275
|
var _useState = React.useState(''),
|
|
262
276
|
_useState2 = _slicedToArray(_useState, 2),
|
|
263
277
|
searchValue = _useState2[0],
|
|
264
278
|
setSearchValue = _useState2[1];
|
|
265
279
|
|
|
280
|
+
var _useState3 = React.useState(false),
|
|
281
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
282
|
+
loading = _useState4[0],
|
|
283
|
+
setLoading = _useState4[1];
|
|
284
|
+
|
|
285
|
+
var _useState5 = React.useState({
|
|
286
|
+
latestArrivals: [],
|
|
287
|
+
bags: [],
|
|
288
|
+
shoes: [],
|
|
289
|
+
clothing: [],
|
|
290
|
+
accessories: [],
|
|
291
|
+
watches: [],
|
|
292
|
+
accessoriesCategories: [],
|
|
293
|
+
apparelStyles: []
|
|
294
|
+
}),
|
|
295
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
296
|
+
dropdownData = _useState6[0],
|
|
297
|
+
setDropdownData = _useState6[1];
|
|
298
|
+
|
|
299
|
+
var _useState7 = React.useState(false),
|
|
300
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
301
|
+
hasError = _useState8[0],
|
|
302
|
+
setHasError = _useState8[1];
|
|
303
|
+
|
|
266
304
|
var handleChange = function handleChange(event) {
|
|
267
305
|
setSearchValue(event.target.value);
|
|
268
306
|
};
|
|
@@ -281,6 +319,27 @@
|
|
|
281
319
|
});
|
|
282
320
|
}
|
|
283
321
|
|
|
322
|
+
React.useMemo(function () {
|
|
323
|
+
setLoading(true);
|
|
324
|
+
axios.post("".concat(endpoint), getBrands()).then(function (_ref2) {
|
|
325
|
+
var data = _ref2.data;
|
|
326
|
+
setLoading(false);
|
|
327
|
+
setDropdownData(function (prev) {
|
|
328
|
+
return _objectSpread2(_objectSpread2({}, prev), {}, {
|
|
329
|
+
latestArrivals: data.data.latest_arrivals.data,
|
|
330
|
+
bags: data.data.bags.data,
|
|
331
|
+
shoes: data.data.shoes.data,
|
|
332
|
+
apparel: data.data.apparel.data,
|
|
333
|
+
accessories: data.data.accessories.data,
|
|
334
|
+
watches: data.data.watches.data,
|
|
335
|
+
accessoriesCategories: data.data.accessories_categories,
|
|
336
|
+
apparelStyles: data.data.apparel_styles
|
|
337
|
+
});
|
|
338
|
+
});
|
|
339
|
+
}).catch(function () {
|
|
340
|
+
return setHasError(true);
|
|
341
|
+
});
|
|
342
|
+
}, [endpoint]);
|
|
284
343
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
285
344
|
className: "navbar"
|
|
286
345
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -324,10 +383,12 @@
|
|
|
324
383
|
title: "Department",
|
|
325
384
|
imageSrc: newBrandsImage,
|
|
326
385
|
categoryElements: categoryElements,
|
|
327
|
-
brandElements:
|
|
386
|
+
brandElements: dropdownData.latestArrivals,
|
|
328
387
|
productsUrl: productsUrl,
|
|
329
388
|
categorySlug: "brands",
|
|
330
|
-
categoryTitle: "Brands"
|
|
389
|
+
categoryTitle: "Brands",
|
|
390
|
+
isLoading: loading,
|
|
391
|
+
hasError: hasError
|
|
331
392
|
}))), /*#__PURE__*/React__default.createElement("li", {
|
|
332
393
|
className: "navbar__link"
|
|
333
394
|
}, /*#__PURE__*/React__default.createElement("a", {
|
|
@@ -339,10 +400,12 @@
|
|
|
339
400
|
title: "Department",
|
|
340
401
|
imageSrc: bagsImage,
|
|
341
402
|
categoryElements: addCategoryToElements(categoryElements, categories.bags.slug),
|
|
342
|
-
brandElements:
|
|
403
|
+
brandElements: dropdownData.bags,
|
|
343
404
|
productsUrl: productsUrl,
|
|
344
405
|
categorySlug: categories.bags.slug,
|
|
345
|
-
categoryTitle: categories.bags.name
|
|
406
|
+
categoryTitle: categories.bags.name,
|
|
407
|
+
isLoading: loading,
|
|
408
|
+
hasError: hasError
|
|
346
409
|
}))), /*#__PURE__*/React__default.createElement("li", {
|
|
347
410
|
className: "navbar__link"
|
|
348
411
|
}, /*#__PURE__*/React__default.createElement("a", {
|
|
@@ -354,10 +417,12 @@
|
|
|
354
417
|
title: "Department",
|
|
355
418
|
imageSrc: shoesImage,
|
|
356
419
|
categoryElements: addCategoryToElements(categoryElements, categories.shoes.slug),
|
|
357
|
-
brandElements:
|
|
420
|
+
brandElements: dropdownData.shoes,
|
|
358
421
|
productsUrl: productsUrl,
|
|
359
422
|
categorySlug: categories.shoes.slug,
|
|
360
|
-
categoryTitle: categories.shoes.name
|
|
423
|
+
categoryTitle: categories.shoes.name,
|
|
424
|
+
isLoading: loading,
|
|
425
|
+
hasError: hasError
|
|
361
426
|
}))), /*#__PURE__*/React__default.createElement("li", {
|
|
362
427
|
className: "navbar__link"
|
|
363
428
|
}, /*#__PURE__*/React__default.createElement("a", {
|
|
@@ -368,11 +433,13 @@
|
|
|
368
433
|
}, /*#__PURE__*/React__default.createElement(Dropdown, {
|
|
369
434
|
title: "Department",
|
|
370
435
|
imageSrc: clothingImage,
|
|
371
|
-
categoryElements:
|
|
372
|
-
brandElements:
|
|
436
|
+
categoryElements: dropdownData.apparelStyles,
|
|
437
|
+
brandElements: dropdownData.apparel,
|
|
373
438
|
productsUrl: productsUrl,
|
|
374
439
|
categorySlug: categories.clothing.slug,
|
|
375
|
-
categoryTitle: categories.clothing.name
|
|
440
|
+
categoryTitle: categories.clothing.name,
|
|
441
|
+
isLoading: loading,
|
|
442
|
+
hasError: hasError
|
|
376
443
|
}))), /*#__PURE__*/React__default.createElement("li", {
|
|
377
444
|
className: "navbar__link"
|
|
378
445
|
}, /*#__PURE__*/React__default.createElement("a", {
|
|
@@ -383,11 +450,13 @@
|
|
|
383
450
|
}, /*#__PURE__*/React__default.createElement(Dropdown, {
|
|
384
451
|
title: "Categories",
|
|
385
452
|
imageSrc: accessoriesImage,
|
|
386
|
-
categoryElements:
|
|
387
|
-
brandElements:
|
|
453
|
+
categoryElements: removeCategoryByName(dropdownData.accessoriesCategories, 'ACCESSORIES'),
|
|
454
|
+
brandElements: dropdownData.accessories,
|
|
388
455
|
productsUrl: productsUrl,
|
|
389
456
|
categorySlug: categories.accessories.slug,
|
|
390
|
-
categoryTitle: categories.accessories.name
|
|
457
|
+
categoryTitle: categories.accessories.name,
|
|
458
|
+
isLoading: loading,
|
|
459
|
+
hasError: hasError
|
|
391
460
|
}))), /*#__PURE__*/React__default.createElement("li", {
|
|
392
461
|
className: "navbar__link"
|
|
393
462
|
}, /*#__PURE__*/React__default.createElement("a", {
|
|
@@ -399,10 +468,12 @@
|
|
|
399
468
|
title: "Department",
|
|
400
469
|
imageSrc: watchesImage,
|
|
401
470
|
categoryElements: addCategoryToElements(categoryElements, categories.watches.slug),
|
|
402
|
-
brandElements:
|
|
471
|
+
brandElements: dropdownData.watches,
|
|
403
472
|
productsUrl: productsUrl,
|
|
404
473
|
categorySlug: categories.watches.slug,
|
|
405
|
-
categoryTitle: categories.watches.name
|
|
474
|
+
categoryTitle: categories.watches.name,
|
|
475
|
+
isLoading: loading,
|
|
476
|
+
hasError: hasError
|
|
406
477
|
}))), /*#__PURE__*/React__default.createElement("li", {
|
|
407
478
|
className: "navbar__link"
|
|
408
479
|
}, /*#__PURE__*/React__default.createElement("a", {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react'), require('styled-components'), require('@bonlineza/b-lib/EllipsisLoader'), require('@bonlineza/b-lib/PageReady'), require('react-animate-height'), require('numeral'), require('stylis-rule-sheet'), require('react-dom'), require('prop-types'), require('raf'), require('react-input-autosize'), require('react-transition-group'), require('@bonlineza/b-lib/functions'), require('rc-slider'), require('react-notify-toast')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['react', 'styled-components', '@bonlineza/b-lib/EllipsisLoader', '@bonlineza/b-lib/PageReady', 'react-animate-height', 'numeral', 'stylis-rule-sheet', 'react-dom', 'prop-types', 'raf', 'react-input-autosize', 'react-transition-group', '@bonlineza/b-lib/functions', 'rc-slider', 'react-notify-toast'], factory) :
|
|
4
|
-
(global = global || self, global.LuxityGraphQLDropdownSelector = factory(global.React, global.styled, global.EllipsisLoader, global.PageReady, global.AnimateHeight, global.numeral, global['stylis-rule-sheet'], global.reactDom, global.PropTypes, global.raf, global['react-input-autosize'], global['react-transition-group'], global.function, global.rcSlider, global['react-notify-toast']));
|
|
5
|
-
}(this, (function (React, styled, EllipsisLoader, PageReady, AnimateHeight, numeral, stylisRuleSheet, reactDom, PropTypes, raf, AutosizeInput, reactTransitionGroup, functions, rcSlider, Notifications) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react'), require('styled-components'), require('@bonlineza/b-lib/EllipsisLoader'), require('@bonlineza/b-lib/PageReady'), require('react-animate-height'), require('numeral'), require('stylis-rule-sheet'), require('react-dom'), require('prop-types'), require('raf'), require('react-input-autosize'), require('react-transition-group'), require('@bonlineza/b-lib/functions'), require('rc-slider'), require('react-notify-toast'), require('axios')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['react', 'styled-components', '@bonlineza/b-lib/EllipsisLoader', '@bonlineza/b-lib/PageReady', 'react-animate-height', 'numeral', 'stylis-rule-sheet', 'react-dom', 'prop-types', 'raf', 'react-input-autosize', 'react-transition-group', '@bonlineza/b-lib/functions', 'rc-slider', 'react-notify-toast', 'axios'], factory) :
|
|
4
|
+
(global = global || self, global.LuxityGraphQLDropdownSelector = factory(global.React, global.styled, global.EllipsisLoader, global.PageReady, global.AnimateHeight, global.numeral, global['stylis-rule-sheet'], global.reactDom, global.PropTypes, global.raf, global['react-input-autosize'], global['react-transition-group'], global.function, global.rcSlider, global['react-notify-toast'], global.axios));
|
|
5
|
+
}(this, (function (React, styled, EllipsisLoader, PageReady, AnimateHeight, numeral, stylisRuleSheet, reactDom, PropTypes, raf, AutosizeInput, reactTransitionGroup, functions, rcSlider, Notifications, axios) { 'use strict';
|
|
6
6
|
|
|
7
7
|
var React__default = 'default' in React ? React['default'] : React;
|
|
8
8
|
var styled__default = 'default' in styled ? styled['default'] : styled;
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
raf = raf && Object.prototype.hasOwnProperty.call(raf, 'default') ? raf['default'] : raf;
|
|
16
16
|
AutosizeInput = AutosizeInput && Object.prototype.hasOwnProperty.call(AutosizeInput, 'default') ? AutosizeInput['default'] : AutosizeInput;
|
|
17
17
|
var Notifications__default = 'default' in Notifications ? Notifications['default'] : Notifications;
|
|
18
|
+
axios = axios && Object.prototype.hasOwnProperty.call(axios, 'default') ? axios['default'] : axios;
|
|
18
19
|
|
|
19
20
|
function ownKeys(object, enumerableOnly) {
|
|
20
21
|
var keys = Object.keys(object);
|
package/LuxityMobileHeader.js
CHANGED
|
@@ -1,10 +1,52 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['react'], factory) :
|
|
4
|
-
(global = global || self, global.LuxityMobileHeader = factory(global.React));
|
|
5
|
-
}(this, (function (React) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react'), require('axios')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['react', 'axios'], factory) :
|
|
4
|
+
(global = global || self, global.LuxityMobileHeader = factory(global.React, global.axios));
|
|
5
|
+
}(this, (function (React, axios) { 'use strict';
|
|
6
6
|
|
|
7
7
|
var React__default = 'default' in React ? React['default'] : React;
|
|
8
|
+
axios = axios && Object.prototype.hasOwnProperty.call(axios, 'default') ? axios['default'] : axios;
|
|
9
|
+
|
|
10
|
+
function ownKeys(object, enumerableOnly) {
|
|
11
|
+
var keys = Object.keys(object);
|
|
12
|
+
|
|
13
|
+
if (Object.getOwnPropertySymbols) {
|
|
14
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
15
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
16
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
17
|
+
})), keys.push.apply(keys, symbols);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return keys;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function _objectSpread2(target) {
|
|
24
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
25
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
26
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
27
|
+
_defineProperty(target, key, source[key]);
|
|
28
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
29
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return target;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function _defineProperty(obj, key, value) {
|
|
37
|
+
if (key in obj) {
|
|
38
|
+
Object.defineProperty(obj, key, {
|
|
39
|
+
value: value,
|
|
40
|
+
enumerable: true,
|
|
41
|
+
configurable: true,
|
|
42
|
+
writable: true
|
|
43
|
+
});
|
|
44
|
+
} else {
|
|
45
|
+
obj[key] = value;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return obj;
|
|
49
|
+
}
|
|
8
50
|
|
|
9
51
|
function _slicedToArray(arr, i) {
|
|
10
52
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
@@ -116,12 +158,18 @@
|
|
|
116
158
|
subMenuBrandsTitle = _ref.subMenuBrandsTitle,
|
|
117
159
|
_ref$brandsList = _ref.brandsList,
|
|
118
160
|
brandsList = _ref$brandsList === void 0 ? [] : _ref$brandsList,
|
|
119
|
-
categorySlug = _ref.categorySlug
|
|
161
|
+
categorySlug = _ref.categorySlug,
|
|
162
|
+
isLoading = _ref.isLoading,
|
|
163
|
+
hasError = _ref.hasError;
|
|
120
164
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
121
165
|
className: "side-nav__content ".concat(subMenuOpen ? '' : 'side-nav__content--hidden')
|
|
122
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
166
|
+
}, hasError ? /*#__PURE__*/React__default.createElement("div", {
|
|
167
|
+
className: "side-nav__errors"
|
|
168
|
+
}, "Failed to load data.") : /*#__PURE__*/React__default.createElement("div", {
|
|
123
169
|
className: "side-nav__sub-menu-wrapper"
|
|
124
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
170
|
+
}, isLoading ? /*#__PURE__*/React__default.createElement("div", {
|
|
171
|
+
className: "cover-spinner"
|
|
172
|
+
}) : /*#__PURE__*/React__default.createElement("div", {
|
|
125
173
|
className: "side-nav__sub-menu"
|
|
126
174
|
}, /*#__PURE__*/React__default.createElement("button", {
|
|
127
175
|
type: "button",
|
|
@@ -141,7 +189,7 @@
|
|
|
141
189
|
return /*#__PURE__*/React__default.createElement("a", {
|
|
142
190
|
href: "".concat(productUrl, "/").concat(category.slug),
|
|
143
191
|
className: "side-nav__element"
|
|
144
|
-
}, category.name);
|
|
192
|
+
}, category.name.toLowerCase());
|
|
145
193
|
})), /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("div", {
|
|
146
194
|
className: "side-nav__elements"
|
|
147
195
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -157,6 +205,20 @@
|
|
|
157
205
|
})))));
|
|
158
206
|
};
|
|
159
207
|
|
|
208
|
+
var getBrands = function getBrands() {
|
|
209
|
+
return {
|
|
210
|
+
query: "{\n latest_arrivals: luxity_brands(has_products: true, limit: 1000, page: 1) {data {id name slug}}\n bags: luxity_brands(has_products: true, limit: 1000, page: 1, category_type: BAGS) {data {id name slug}}\n shoes: luxity_brands(has_products: true, limit: 1000, page: 1, category_type: SHOES) {data {id name slug}}\n apparel: luxity_brands(has_products: true, limit: 1000, page: 1, category_type: APPAREL) {data {id name slug}}\n accessories: luxity_brands(has_products: true, limit: 1000, page: 1, category_type: ACCESSORIES) {data {id name slug}}\n watches: luxity_brands(has_products: true, limit: 1000, page: 1, category_type: WATCHES) {data {id name slug}}\n accessories_categories: luxity_accessories_categories_list { id name slug }\n apparel_styles: luxity_apparel_styles_list { name slug }\n } "
|
|
211
|
+
};
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
var removeCategoryByName = function removeCategoryByName(categories, name) {
|
|
215
|
+
var _categories$filter;
|
|
216
|
+
|
|
217
|
+
return (_categories$filter = categories === null || categories === void 0 ? void 0 : categories.filter(function (category) {
|
|
218
|
+
return category.name !== name;
|
|
219
|
+
})) !== null && _categories$filter !== void 0 ? _categories$filter : [];
|
|
220
|
+
};
|
|
221
|
+
|
|
160
222
|
var LuxitySideNav = function LuxitySideNav(_ref) {
|
|
161
223
|
var accordionIcon = _ref.accordionIcon,
|
|
162
224
|
closeIcon = _ref.closeIcon,
|
|
@@ -170,24 +232,9 @@
|
|
|
170
232
|
onSellToUsClick = _ref.onSellToUsClick,
|
|
171
233
|
stores = _ref.stores,
|
|
172
234
|
categoryElements = _ref.categoryElements,
|
|
173
|
-
_ref$newBrandsList = _ref.newBrandsList,
|
|
174
|
-
newBrandsList = _ref$newBrandsList === void 0 ? [] : _ref$newBrandsList,
|
|
175
|
-
_ref$bagsBrandsList = _ref.bagsBrandsList,
|
|
176
|
-
bagsBrandsList = _ref$bagsBrandsList === void 0 ? [] : _ref$bagsBrandsList,
|
|
177
|
-
_ref$shoesBrandsList = _ref.shoesBrandsList,
|
|
178
|
-
shoesBrandsList = _ref$shoesBrandsList === void 0 ? [] : _ref$shoesBrandsList,
|
|
179
|
-
_ref$clothingBrandsLi = _ref.clothingBrandsList,
|
|
180
|
-
clothingBrandsList = _ref$clothingBrandsLi === void 0 ? [] : _ref$clothingBrandsLi,
|
|
181
|
-
_ref$accessoriesBrand = _ref.accessoriesBrandsList,
|
|
182
|
-
accessoriesBrandsList = _ref$accessoriesBrand === void 0 ? [] : _ref$accessoriesBrand,
|
|
183
|
-
_ref$watchesBrandsLis = _ref.watchesBrandsList,
|
|
184
|
-
watchesBrandsList = _ref$watchesBrandsLis === void 0 ? [] : _ref$watchesBrandsLis,
|
|
185
|
-
_ref$accessoriesCateg = _ref.accessoriesCategoryElements,
|
|
186
|
-
accessoriesCategoryElements = _ref$accessoriesCateg === void 0 ? [] : _ref$accessoriesCateg,
|
|
187
|
-
_ref$apparelStylesEle = _ref.apparelStylesElements,
|
|
188
|
-
apparelStylesElements = _ref$apparelStylesEle === void 0 ? [] : _ref$apparelStylesEle,
|
|
189
235
|
showSideNav = _ref.showSideNav,
|
|
190
|
-
onMenuClick = _ref.onMenuClick
|
|
236
|
+
onMenuClick = _ref.onMenuClick,
|
|
237
|
+
endpoint = _ref.endpoint;
|
|
191
238
|
|
|
192
239
|
var _useState = React.useState(false),
|
|
193
240
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -199,6 +246,30 @@
|
|
|
199
246
|
displayedSubMenu = _useState4[0],
|
|
200
247
|
setDisplayedSubMenu = _useState4[1];
|
|
201
248
|
|
|
249
|
+
var _useState5 = React.useState(false),
|
|
250
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
251
|
+
loading = _useState6[0],
|
|
252
|
+
setLoading = _useState6[1];
|
|
253
|
+
|
|
254
|
+
var _useState7 = React.useState({
|
|
255
|
+
latestArrivals: [],
|
|
256
|
+
bags: [],
|
|
257
|
+
shoes: [],
|
|
258
|
+
clothing: [],
|
|
259
|
+
accessories: [],
|
|
260
|
+
watches: [],
|
|
261
|
+
accessoriesCategories: [],
|
|
262
|
+
apparelStyles: []
|
|
263
|
+
}),
|
|
264
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
265
|
+
dropdownData = _useState8[0],
|
|
266
|
+
setDropdownData = _useState8[1];
|
|
267
|
+
|
|
268
|
+
var _useState9 = React.useState(false),
|
|
269
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
270
|
+
hasError = _useState10[0],
|
|
271
|
+
setHasError = _useState10[1];
|
|
272
|
+
|
|
202
273
|
var onSubMenuClick = function onSubMenuClick(subMenu) {
|
|
203
274
|
setSubMenuOpen(function (prev) {
|
|
204
275
|
return !prev;
|
|
@@ -216,6 +287,27 @@
|
|
|
216
287
|
setDisplayedSubMenu('');
|
|
217
288
|
};
|
|
218
289
|
|
|
290
|
+
React.useMemo(function () {
|
|
291
|
+
setLoading(true);
|
|
292
|
+
axios.post("".concat(endpoint), getBrands()).then(function (_ref2) {
|
|
293
|
+
var data = _ref2.data;
|
|
294
|
+
setLoading(false);
|
|
295
|
+
setDropdownData(function (prev) {
|
|
296
|
+
return _objectSpread2(_objectSpread2({}, prev), {}, {
|
|
297
|
+
latestArrivals: data.data.latest_arrivals.data,
|
|
298
|
+
bags: data.data.bags.data,
|
|
299
|
+
shoes: data.data.shoes.data,
|
|
300
|
+
apparel: data.data.apparel.data,
|
|
301
|
+
accessories: data.data.accessories.data,
|
|
302
|
+
watches: data.data.watches.data,
|
|
303
|
+
accessoriesCategories: data.data.accessories_categories,
|
|
304
|
+
apparelStyles: data.data.apparel_styles
|
|
305
|
+
});
|
|
306
|
+
});
|
|
307
|
+
}).catch(function () {
|
|
308
|
+
return setHasError(true);
|
|
309
|
+
});
|
|
310
|
+
}, [endpoint]);
|
|
219
311
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
220
312
|
className: "side-nav"
|
|
221
313
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -369,8 +461,10 @@
|
|
|
369
461
|
productUrl: productUrl,
|
|
370
462
|
categoryElements: categoryElements,
|
|
371
463
|
subMenuBrandsTitle: "Brands",
|
|
372
|
-
brandsList:
|
|
373
|
-
categorySlug: displayedSubMenu
|
|
464
|
+
brandsList: dropdownData.latestArrivals,
|
|
465
|
+
categorySlug: displayedSubMenu,
|
|
466
|
+
isLoading: loading,
|
|
467
|
+
hasError: hasError
|
|
374
468
|
}), /*#__PURE__*/React__default.createElement(BrandsDropDown, {
|
|
375
469
|
subMenuOpen: subMenuOpen && displayedSubMenu === 'bags',
|
|
376
470
|
onBackClick: onBackClick,
|
|
@@ -379,8 +473,10 @@
|
|
|
379
473
|
productUrl: productUrl,
|
|
380
474
|
categoryElements: categoryElements,
|
|
381
475
|
subMenuBrandsTitle: "Bag Brands",
|
|
382
|
-
brandsList:
|
|
383
|
-
categorySlug: displayedSubMenu
|
|
476
|
+
brandsList: dropdownData.bags,
|
|
477
|
+
categorySlug: displayedSubMenu,
|
|
478
|
+
isLoading: loading,
|
|
479
|
+
hasError: hasError
|
|
384
480
|
}), /*#__PURE__*/React__default.createElement(BrandsDropDown, {
|
|
385
481
|
subMenuOpen: subMenuOpen && displayedSubMenu === 'shoes',
|
|
386
482
|
onBackClick: onBackClick,
|
|
@@ -389,28 +485,34 @@
|
|
|
389
485
|
productUrl: productUrl,
|
|
390
486
|
categoryElements: categoryElements,
|
|
391
487
|
subMenuBrandsTitle: "Shoe Brands",
|
|
392
|
-
brandsList:
|
|
393
|
-
categorySlug: displayedSubMenu
|
|
488
|
+
brandsList: dropdownData.shoes,
|
|
489
|
+
categorySlug: displayedSubMenu,
|
|
490
|
+
isLoading: loading,
|
|
491
|
+
hasError: hasError
|
|
394
492
|
}), /*#__PURE__*/React__default.createElement(BrandsDropDown, {
|
|
395
493
|
subMenuOpen: subMenuOpen && displayedSubMenu === 'clothing',
|
|
396
494
|
onBackClick: onBackClick,
|
|
397
495
|
backIcon: backIcon,
|
|
398
496
|
subMenuCategoryTitle: "Department",
|
|
399
497
|
productUrl: productUrl,
|
|
400
|
-
categoryElements:
|
|
498
|
+
categoryElements: dropdownData.apparelStyles,
|
|
401
499
|
subMenuBrandsTitle: "Clothing Brands",
|
|
402
|
-
brandsList:
|
|
403
|
-
categorySlug: displayedSubMenu
|
|
500
|
+
brandsList: dropdownData.clothing,
|
|
501
|
+
categorySlug: displayedSubMenu,
|
|
502
|
+
isLoading: loading,
|
|
503
|
+
hasError: hasError
|
|
404
504
|
}), /*#__PURE__*/React__default.createElement(BrandsDropDown, {
|
|
405
505
|
subMenuOpen: subMenuOpen && displayedSubMenu === 'accessories',
|
|
406
506
|
onBackClick: onBackClick,
|
|
407
507
|
backIcon: backIcon,
|
|
408
508
|
subMenuCategoryTitle: "Categories",
|
|
409
509
|
productUrl: productUrl,
|
|
410
|
-
categoryElements:
|
|
510
|
+
categoryElements: removeCategoryByName(dropdownData.accessoriesCategories, 'ACCESSORIES'),
|
|
411
511
|
subMenuBrandsTitle: "Accessory Brands",
|
|
412
|
-
brandsList:
|
|
413
|
-
categorySlug: displayedSubMenu
|
|
512
|
+
brandsList: dropdownData.accessories,
|
|
513
|
+
categorySlug: displayedSubMenu,
|
|
514
|
+
isLoading: loading,
|
|
515
|
+
hasError: hasError
|
|
414
516
|
}), /*#__PURE__*/React__default.createElement(BrandsDropDown, {
|
|
415
517
|
subMenuOpen: subMenuOpen && displayedSubMenu === 'watches',
|
|
416
518
|
onBackClick: onBackClick,
|
|
@@ -419,8 +521,10 @@
|
|
|
419
521
|
productUrl: productUrl,
|
|
420
522
|
categoryElements: categoryElements,
|
|
421
523
|
subMenuBrandsTitle: "Watches Brands",
|
|
422
|
-
brandsList:
|
|
423
|
-
categorySlug: displayedSubMenu
|
|
524
|
+
brandsList: dropdownData.watches,
|
|
525
|
+
categorySlug: displayedSubMenu,
|
|
526
|
+
isLoading: loading,
|
|
527
|
+
hasError: hasError
|
|
424
528
|
}), displayedSubMenu === 'stores' && /*#__PURE__*/React__default.createElement("div", {
|
|
425
529
|
className: "side-nav__content"
|
|
426
530
|
}, /*#__PURE__*/React__default.createElement(StoresDropdown, {
|
|
@@ -450,15 +554,8 @@
|
|
|
450
554
|
ourStoryLink = _ref.ourStoryLink,
|
|
451
555
|
blogLink = _ref.blogLink,
|
|
452
556
|
onSellToUsClick = _ref.onSellToUsClick,
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
shoesBrandsList = _ref.shoesBrandsList,
|
|
456
|
-
clothingBrandsList = _ref.clothingBrandsList,
|
|
457
|
-
accessoriesBrandsList = _ref.accessoriesBrandsList,
|
|
458
|
-
accessoriesCategoryElements = _ref.accessoriesCategoryElements,
|
|
459
|
-
apparelStylesElements = _ref.apparelStylesElements,
|
|
460
|
-
watchesBrandsList = _ref.watchesBrandsList,
|
|
461
|
-
onLogoClick = _ref.onLogoClick;
|
|
557
|
+
onLogoClick = _ref.onLogoClick,
|
|
558
|
+
endpoint = _ref.endpoint;
|
|
462
559
|
|
|
463
560
|
var _useState = React.useState(''),
|
|
464
561
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -571,16 +668,9 @@
|
|
|
571
668
|
onSellToUsClick: onSellToUsClick,
|
|
572
669
|
stores: stores,
|
|
573
670
|
categoryElements: categoryElements,
|
|
574
|
-
newBrandsList: newBrandsList,
|
|
575
|
-
bagsBrandsList: bagsBrandsList,
|
|
576
|
-
shoesBrandsList: shoesBrandsList,
|
|
577
|
-
clothingBrandsList: clothingBrandsList,
|
|
578
|
-
accessoriesBrandsList: accessoriesBrandsList,
|
|
579
|
-
watchesBrandsList: watchesBrandsList,
|
|
580
671
|
showSideNav: showSideNav,
|
|
581
672
|
onMenuClick: onMenuClick,
|
|
582
|
-
|
|
583
|
-
apparelStylesElements: apparelStylesElements
|
|
673
|
+
endpoint: endpoint
|
|
584
674
|
}));
|
|
585
675
|
};
|
|
586
676
|
|