@bonlineza/luxity-lib 2.36.3 → 2.36.4
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/AddProductInterest.js +10 -133
- package/GraphQLDropdownSelector.js +10 -132
- package/Interests.js +10 -133
- package/LuxityGraphQLDropdownSelector.js +10 -132
- package/MaterialSelector.js +10 -132
- package/ModelSelector.js +10 -132
- package/build/bundle.css +1 -1
- package/build/bundle.js +10 -132
- package/package.json +1 -1
package/AddProductInterest.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react'), require('styled-components'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['react', 'styled-components', '
|
|
4
|
-
(global = global || self, global.AddProductInterest = factory(global.React, global.styled, global
|
|
5
|
-
}(this, (function (React, styled,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react'), require('styled-components'), require('react-notify-toast'), require('stylis-rule-sheet'), require('react-dom'), require('prop-types'), require('raf'), require('react-input-autosize'), require('react-transition-group')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['react', 'styled-components', 'react-notify-toast', 'stylis-rule-sheet', 'react-dom', 'prop-types', 'raf', 'react-input-autosize', 'react-transition-group'], factory) :
|
|
4
|
+
(global = global || self, global.AddProductInterest = factory(global.React, global.styled, global['react-notify-toast'], global['stylis-rule-sheet'], global.reactDom, global.PropTypes, global.raf, global['react-input-autosize'], global['react-transition-group']));
|
|
5
|
+
}(this, (function (React, styled, Notifications, stylisRuleSheet, reactDom, PropTypes, raf, AutosizeInput, reactTransitionGroup) { '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;
|
|
9
|
-
axios = axios && Object.prototype.hasOwnProperty.call(axios, 'default') ? axios['default'] : axios;
|
|
10
|
-
Cookies = Cookies && Object.prototype.hasOwnProperty.call(Cookies, 'default') ? Cookies['default'] : Cookies;
|
|
11
9
|
var Notifications__default = 'default' in Notifications ? Notifications['default'] : Notifications;
|
|
12
10
|
stylisRuleSheet = stylisRuleSheet && Object.prototype.hasOwnProperty.call(stylisRuleSheet, 'default') ? stylisRuleSheet['default'] : stylisRuleSheet;
|
|
13
11
|
PropTypes = PropTypes && Object.prototype.hasOwnProperty.call(PropTypes, 'default') ? PropTypes['default'] : PropTypes;
|
|
@@ -560,127 +558,6 @@
|
|
|
560
558
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
561
559
|
}
|
|
562
560
|
|
|
563
|
-
function getToken() {
|
|
564
|
-
var _Cookies$get;
|
|
565
|
-
|
|
566
|
-
return (_Cookies$get = Cookies.get('_tk')) === null || _Cookies$get === void 0 ? void 0 : _Cookies$get.replace('*', 'Bearer ');
|
|
567
|
-
}
|
|
568
|
-
function setToken(value) {
|
|
569
|
-
Cookies.set('_tk', value, 30);
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
/** @format */
|
|
573
|
-
|
|
574
|
-
function getEncodedSearch(currentUrl) {
|
|
575
|
-
var splitUrl = currentUrl.split('?');
|
|
576
|
-
var baseUrl = splitUrl[0];
|
|
577
|
-
var nextUrlSegments = splitUrl[1].split('&');
|
|
578
|
-
var nextQueryString = splitUrl[1];
|
|
579
|
-
|
|
580
|
-
if (nextUrlSegments.length > 0) {
|
|
581
|
-
nextQueryString = nextUrlSegments.map(function (v) {
|
|
582
|
-
var nextValue = v;
|
|
583
|
-
|
|
584
|
-
if (v.includes('search=')) {
|
|
585
|
-
var temp = v.split('=');
|
|
586
|
-
nextValue = "".concat(temp[0], "=").concat(encodeURIComponent(temp[1]));
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
return nextValue;
|
|
590
|
-
}).join('&');
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
return "".concat(baseUrl, "?").concat(nextQueryString);
|
|
594
|
-
}
|
|
595
|
-
/**
|
|
596
|
-
* Gets an instance of Axios that is configured with the custom failure handlers
|
|
597
|
-
* @param {Function} onAuthFailed - callback triggers when auth fails - ie, server error is one of ['token_invalid', 'token_not_provided', 'user_not_found', 'token_expired'] or http status is one of [401, 503, 400]
|
|
598
|
-
* @param {Function} onForbidden - callback triggers when http status = 403
|
|
599
|
-
*/
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
var axiosInstance = function axiosInstance(onAuthFailed, onForbidden) {
|
|
603
|
-
var instance = axios.create({
|
|
604
|
-
validateStatus: function validateStatus(status) {
|
|
605
|
-
return status >= 200 && status < 300;
|
|
606
|
-
}
|
|
607
|
-
});
|
|
608
|
-
var token = getToken();
|
|
609
|
-
|
|
610
|
-
if (token !== '') {
|
|
611
|
-
instance.defaults.headers.common.Authorization = token;
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
instance.defaults.headers.common['Content-Type'] = 'application/json;charset=UTF-8'; // Add a request interceptor
|
|
615
|
-
|
|
616
|
-
instance.interceptors.request.use(function (request, error) {
|
|
617
|
-
if (error) {
|
|
618
|
-
return Promise.reject(error.response);
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
if (request.url.includes('search') && request.url.includes('?')) {
|
|
622
|
-
// do some uri manipulation for ie
|
|
623
|
-
// https://stackoverflow.com/questions/18220057
|
|
624
|
-
// eslint-disable-next-line no-param-reassign
|
|
625
|
-
request.url = getEncodedSearch(request.url);
|
|
626
|
-
} // eslint-disable-next-line no-param-reassign
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
request.headers.common['Content-Type'] = 'application/json; charset=utf-8';
|
|
630
|
-
|
|
631
|
-
if (typeof request.body === 'undefined') {
|
|
632
|
-
request.body = {};
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
token = getToken();
|
|
636
|
-
|
|
637
|
-
if (token !== '') {
|
|
638
|
-
// eslint-disable-next-line no-param-reassign
|
|
639
|
-
request.headers.common.Authorization = token;
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
return request;
|
|
643
|
-
}, function (error) {
|
|
644
|
-
return Promise.reject(error.message);
|
|
645
|
-
}); // Add a response interceptor
|
|
646
|
-
|
|
647
|
-
instance.interceptors.response.use(function (response, error) {
|
|
648
|
-
if (error) {
|
|
649
|
-
return Promise.reject(error.response);
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
if (response.headers.authorization) {
|
|
653
|
-
setToken(response.headers.authorization);
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
return response;
|
|
657
|
-
}, function (error) {
|
|
658
|
-
if (error.response) {
|
|
659
|
-
// network error
|
|
660
|
-
if (error.response.data && error.response.data.error && (error.response.data.error === 'token_invalid' || error.response.data.error === 'token_not_provided' || error.response.data.error === 'user_not_found' || error.response.data.error === 'token_expired') || error.response.status === 401 || error.response.status === 503 || error.response.status === 400) {
|
|
661
|
-
onAuthFailed();
|
|
662
|
-
} // if (error.response.status === 500) {
|
|
663
|
-
// // INTERNAL SERVER ERROR
|
|
664
|
-
// store.dispatch({
|
|
665
|
-
// type: AppConstants.OVERLAY.SERVER_ERROR,
|
|
666
|
-
// });
|
|
667
|
-
// return Promise.reject(error.response);
|
|
668
|
-
// }
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
if (error.response.status === 403) {
|
|
672
|
-
// FORBIDDEN
|
|
673
|
-
onForbidden();
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
return Promise.reject(error.response);
|
|
677
|
-
}
|
|
678
|
-
|
|
679
|
-
return Promise.reject(error);
|
|
680
|
-
});
|
|
681
|
-
return instance;
|
|
682
|
-
}; // NOTE: this to be instanciated with params: onAuthFailed, onForbidden
|
|
683
|
-
|
|
684
561
|
var defaultNotifyTime = 5000;
|
|
685
562
|
var error = function error(message) {
|
|
686
563
|
Notifications.notify.show(message, 'error', defaultNotifyTime);
|
|
@@ -7626,7 +7503,7 @@
|
|
|
7626
7503
|
case 0:
|
|
7627
7504
|
_context.prev = 0;
|
|
7628
7505
|
_context.next = 3;
|
|
7629
|
-
return
|
|
7506
|
+
return requestInstance.post("".concat(baseGraphApi, "?id=getBrands"), {
|
|
7630
7507
|
query: getBrandsGraphQuery(1000, 1, 'id|desc')
|
|
7631
7508
|
});
|
|
7632
7509
|
|
|
@@ -7657,7 +7534,7 @@
|
|
|
7657
7534
|
}
|
|
7658
7535
|
}
|
|
7659
7536
|
}, _callee, null, [[0, 7]]);
|
|
7660
|
-
})), [baseGraphApi, getBrandsGraphQuery]);
|
|
7537
|
+
})), [baseGraphApi, getBrandsGraphQuery, requestInstance]);
|
|
7661
7538
|
var fetchModels = React.useCallback( /*#__PURE__*/function () {
|
|
7662
7539
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(brandId) {
|
|
7663
7540
|
var _response$data2, _response$data2$data, _response$data2$data$, response, formattedModels;
|
|
@@ -7668,7 +7545,7 @@
|
|
|
7668
7545
|
case 0:
|
|
7669
7546
|
_context2.prev = 0;
|
|
7670
7547
|
_context2.next = 3;
|
|
7671
|
-
return
|
|
7548
|
+
return requestInstance.post("".concat(baseGraphApi, "?id=getModels"), {
|
|
7672
7549
|
query: getModelsGraphQuery(brandId)
|
|
7673
7550
|
});
|
|
7674
7551
|
|
|
@@ -7704,7 +7581,7 @@
|
|
|
7704
7581
|
return function (_x) {
|
|
7705
7582
|
return _ref3.apply(this, arguments);
|
|
7706
7583
|
};
|
|
7707
|
-
}(), [baseGraphApi, getModelsGraphQuery]);
|
|
7584
|
+
}(), [baseGraphApi, getModelsGraphQuery, requestInstance]);
|
|
7708
7585
|
var fetchMaterials = React.useCallback( /*#__PURE__*/function () {
|
|
7709
7586
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(brandId) {
|
|
7710
7587
|
var _response$data3, _response$data3$data, _response$data3$data$, response, formattedMaterials;
|
|
@@ -7715,7 +7592,7 @@
|
|
|
7715
7592
|
case 0:
|
|
7716
7593
|
_context3.prev = 0;
|
|
7717
7594
|
_context3.next = 3;
|
|
7718
|
-
return
|
|
7595
|
+
return requestInstance.post("".concat(baseGraphApi, "?id=getMaterials"), {
|
|
7719
7596
|
query: getMaterialsGraphQuery(brandId)
|
|
7720
7597
|
});
|
|
7721
7598
|
|
|
@@ -7751,7 +7628,7 @@
|
|
|
7751
7628
|
return function (_x2) {
|
|
7752
7629
|
return _ref4.apply(this, arguments);
|
|
7753
7630
|
};
|
|
7754
|
-
}(), [baseGraphApi, getMaterialsGraphQuery]);
|
|
7631
|
+
}(), [baseGraphApi, getMaterialsGraphQuery, requestInstance]);
|
|
7755
7632
|
React.useEffect(function () {
|
|
7756
7633
|
fetchBrands();
|
|
7757
7634
|
}, [fetchBrands]);
|
|
@@ -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'), 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'
|
|
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
|
|
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;
|
|
@@ -16,7 +16,6 @@
|
|
|
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
18
|
axios = axios && Object.prototype.hasOwnProperty.call(axios, 'default') ? axios['default'] : axios;
|
|
19
|
-
Cookies = Cookies && Object.prototype.hasOwnProperty.call(Cookies, 'default') ? Cookies['default'] : Cookies;
|
|
20
19
|
|
|
21
20
|
function ownKeys(object, enumerableOnly) {
|
|
22
21
|
var keys = Object.keys(object);
|
|
@@ -11009,127 +11008,6 @@
|
|
|
11009
11008
|
}));
|
|
11010
11009
|
});
|
|
11011
11010
|
|
|
11012
|
-
function getToken() {
|
|
11013
|
-
var _Cookies$get;
|
|
11014
|
-
|
|
11015
|
-
return (_Cookies$get = Cookies.get('_tk')) === null || _Cookies$get === void 0 ? void 0 : _Cookies$get.replace('*', 'Bearer ');
|
|
11016
|
-
}
|
|
11017
|
-
function setToken(value) {
|
|
11018
|
-
Cookies.set('_tk', value, 30);
|
|
11019
|
-
}
|
|
11020
|
-
|
|
11021
|
-
/** @format */
|
|
11022
|
-
|
|
11023
|
-
function getEncodedSearch(currentUrl) {
|
|
11024
|
-
var splitUrl = currentUrl.split('?');
|
|
11025
|
-
var baseUrl = splitUrl[0];
|
|
11026
|
-
var nextUrlSegments = splitUrl[1].split('&');
|
|
11027
|
-
var nextQueryString = splitUrl[1];
|
|
11028
|
-
|
|
11029
|
-
if (nextUrlSegments.length > 0) {
|
|
11030
|
-
nextQueryString = nextUrlSegments.map(function (v) {
|
|
11031
|
-
var nextValue = v;
|
|
11032
|
-
|
|
11033
|
-
if (v.includes('search=')) {
|
|
11034
|
-
var temp = v.split('=');
|
|
11035
|
-
nextValue = "".concat(temp[0], "=").concat(encodeURIComponent(temp[1]));
|
|
11036
|
-
}
|
|
11037
|
-
|
|
11038
|
-
return nextValue;
|
|
11039
|
-
}).join('&');
|
|
11040
|
-
}
|
|
11041
|
-
|
|
11042
|
-
return "".concat(baseUrl, "?").concat(nextQueryString);
|
|
11043
|
-
}
|
|
11044
|
-
/**
|
|
11045
|
-
* Gets an instance of Axios that is configured with the custom failure handlers
|
|
11046
|
-
* @param {Function} onAuthFailed - callback triggers when auth fails - ie, server error is one of ['token_invalid', 'token_not_provided', 'user_not_found', 'token_expired'] or http status is one of [401, 503, 400]
|
|
11047
|
-
* @param {Function} onForbidden - callback triggers when http status = 403
|
|
11048
|
-
*/
|
|
11049
|
-
|
|
11050
|
-
|
|
11051
|
-
var axiosInstance = function axiosInstance(onAuthFailed, onForbidden) {
|
|
11052
|
-
var instance = axios.create({
|
|
11053
|
-
validateStatus: function validateStatus(status) {
|
|
11054
|
-
return status >= 200 && status < 300;
|
|
11055
|
-
}
|
|
11056
|
-
});
|
|
11057
|
-
var token = getToken();
|
|
11058
|
-
|
|
11059
|
-
if (token !== '') {
|
|
11060
|
-
instance.defaults.headers.common.Authorization = token;
|
|
11061
|
-
}
|
|
11062
|
-
|
|
11063
|
-
instance.defaults.headers.common['Content-Type'] = 'application/json;charset=UTF-8'; // Add a request interceptor
|
|
11064
|
-
|
|
11065
|
-
instance.interceptors.request.use(function (request, error) {
|
|
11066
|
-
if (error) {
|
|
11067
|
-
return Promise.reject(error.response);
|
|
11068
|
-
}
|
|
11069
|
-
|
|
11070
|
-
if (request.url.includes('search') && request.url.includes('?')) {
|
|
11071
|
-
// do some uri manipulation for ie
|
|
11072
|
-
// https://stackoverflow.com/questions/18220057
|
|
11073
|
-
// eslint-disable-next-line no-param-reassign
|
|
11074
|
-
request.url = getEncodedSearch(request.url);
|
|
11075
|
-
} // eslint-disable-next-line no-param-reassign
|
|
11076
|
-
|
|
11077
|
-
|
|
11078
|
-
request.headers.common['Content-Type'] = 'application/json; charset=utf-8';
|
|
11079
|
-
|
|
11080
|
-
if (typeof request.body === 'undefined') {
|
|
11081
|
-
request.body = {};
|
|
11082
|
-
}
|
|
11083
|
-
|
|
11084
|
-
token = getToken();
|
|
11085
|
-
|
|
11086
|
-
if (token !== '') {
|
|
11087
|
-
// eslint-disable-next-line no-param-reassign
|
|
11088
|
-
request.headers.common.Authorization = token;
|
|
11089
|
-
}
|
|
11090
|
-
|
|
11091
|
-
return request;
|
|
11092
|
-
}, function (error) {
|
|
11093
|
-
return Promise.reject(error.message);
|
|
11094
|
-
}); // Add a response interceptor
|
|
11095
|
-
|
|
11096
|
-
instance.interceptors.response.use(function (response, error) {
|
|
11097
|
-
if (error) {
|
|
11098
|
-
return Promise.reject(error.response);
|
|
11099
|
-
}
|
|
11100
|
-
|
|
11101
|
-
if (response.headers.authorization) {
|
|
11102
|
-
setToken(response.headers.authorization);
|
|
11103
|
-
}
|
|
11104
|
-
|
|
11105
|
-
return response;
|
|
11106
|
-
}, function (error) {
|
|
11107
|
-
if (error.response) {
|
|
11108
|
-
// network error
|
|
11109
|
-
if (error.response.data && error.response.data.error && (error.response.data.error === 'token_invalid' || error.response.data.error === 'token_not_provided' || error.response.data.error === 'user_not_found' || error.response.data.error === 'token_expired') || error.response.status === 401 || error.response.status === 503 || error.response.status === 400) {
|
|
11110
|
-
onAuthFailed();
|
|
11111
|
-
} // if (error.response.status === 500) {
|
|
11112
|
-
// // INTERNAL SERVER ERROR
|
|
11113
|
-
// store.dispatch({
|
|
11114
|
-
// type: AppConstants.OVERLAY.SERVER_ERROR,
|
|
11115
|
-
// });
|
|
11116
|
-
// return Promise.reject(error.response);
|
|
11117
|
-
// }
|
|
11118
|
-
|
|
11119
|
-
|
|
11120
|
-
if (error.response.status === 403) {
|
|
11121
|
-
// FORBIDDEN
|
|
11122
|
-
onForbidden();
|
|
11123
|
-
}
|
|
11124
|
-
|
|
11125
|
-
return Promise.reject(error.response);
|
|
11126
|
-
}
|
|
11127
|
-
|
|
11128
|
-
return Promise.reject(error);
|
|
11129
|
-
});
|
|
11130
|
-
return instance;
|
|
11131
|
-
}; // NOTE: this to be instanciated with params: onAuthFailed, onForbidden
|
|
11132
|
-
|
|
11133
11011
|
var _excluded$8 = ["children"];
|
|
11134
11012
|
|
|
11135
11013
|
var DropdownSelector = function DropdownSelector(_ref) {
|
|
@@ -11351,7 +11229,7 @@
|
|
|
11351
11229
|
case 0:
|
|
11352
11230
|
_context.prev = 0;
|
|
11353
11231
|
_context.next = 3;
|
|
11354
|
-
return
|
|
11232
|
+
return requestInstance.post("".concat(baseGraphApi, "?id=getBrands"), {
|
|
11355
11233
|
query: getBrandsGraphQuery(1000, 1, 'id|desc')
|
|
11356
11234
|
});
|
|
11357
11235
|
|
|
@@ -11382,7 +11260,7 @@
|
|
|
11382
11260
|
}
|
|
11383
11261
|
}
|
|
11384
11262
|
}, _callee, null, [[0, 7]]);
|
|
11385
|
-
})), [baseGraphApi, getBrandsGraphQuery]);
|
|
11263
|
+
})), [baseGraphApi, getBrandsGraphQuery, requestInstance]);
|
|
11386
11264
|
var fetchModels = React.useCallback( /*#__PURE__*/function () {
|
|
11387
11265
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(brandId) {
|
|
11388
11266
|
var _response$data2, _response$data2$data, _response$data2$data$, response, formattedModels;
|
|
@@ -11393,7 +11271,7 @@
|
|
|
11393
11271
|
case 0:
|
|
11394
11272
|
_context2.prev = 0;
|
|
11395
11273
|
_context2.next = 3;
|
|
11396
|
-
return
|
|
11274
|
+
return requestInstance.post("".concat(baseGraphApi, "?id=getModels"), {
|
|
11397
11275
|
query: getModelsGraphQuery(brandId)
|
|
11398
11276
|
});
|
|
11399
11277
|
|
|
@@ -11429,7 +11307,7 @@
|
|
|
11429
11307
|
return function (_x) {
|
|
11430
11308
|
return _ref3.apply(this, arguments);
|
|
11431
11309
|
};
|
|
11432
|
-
}(), [baseGraphApi, getModelsGraphQuery]);
|
|
11310
|
+
}(), [baseGraphApi, getModelsGraphQuery, requestInstance]);
|
|
11433
11311
|
var fetchMaterials = React.useCallback( /*#__PURE__*/function () {
|
|
11434
11312
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(brandId) {
|
|
11435
11313
|
var _response$data3, _response$data3$data, _response$data3$data$, response, formattedMaterials;
|
|
@@ -11440,7 +11318,7 @@
|
|
|
11440
11318
|
case 0:
|
|
11441
11319
|
_context3.prev = 0;
|
|
11442
11320
|
_context3.next = 3;
|
|
11443
|
-
return
|
|
11321
|
+
return requestInstance.post("".concat(baseGraphApi, "?id=getMaterials"), {
|
|
11444
11322
|
query: getMaterialsGraphQuery(brandId)
|
|
11445
11323
|
});
|
|
11446
11324
|
|
|
@@ -11476,7 +11354,7 @@
|
|
|
11476
11354
|
return function (_x2) {
|
|
11477
11355
|
return _ref4.apply(this, arguments);
|
|
11478
11356
|
};
|
|
11479
|
-
}(), [baseGraphApi, getMaterialsGraphQuery]);
|
|
11357
|
+
}(), [baseGraphApi, getMaterialsGraphQuery, requestInstance]);
|
|
11480
11358
|
React.useEffect(function () {
|
|
11481
11359
|
fetchBrands();
|
|
11482
11360
|
}, [fetchBrands]);
|
package/Interests.js
CHANGED
|
@@ -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('react-notify-toast'), require('@bonlineza/b-lib/EllipsisLoader'), require('@bonlineza/b-lib/PageReady'), 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('numeral')
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['react', 'styled-components', 'react-notify-toast', '@bonlineza/b-lib/EllipsisLoader', '@bonlineza/b-lib/PageReady', 'stylis-rule-sheet', 'react-dom', 'prop-types', 'raf', 'react-input-autosize', 'react-transition-group', '@bonlineza/b-lib/functions', 'rc-slider', 'numeral'
|
|
4
|
-
(global = global || self, global.Interests = factory(global.React, global.styled, global['react-notify-toast'], global.EllipsisLoader, global.PageReady, global['stylis-rule-sheet'], global.reactDom, global.PropTypes, global.raf, global['react-input-autosize'], global['react-transition-group'], global.function, global.rcSlider, global.numeral
|
|
5
|
-
}(this, (function (React, styled, Notifications, EllipsisLoader, PageReady, stylisRuleSheet, reactDom, PropTypes, raf, AutosizeInput, reactTransitionGroup, functions, rcSlider, numeral
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react'), require('styled-components'), require('react-notify-toast'), require('@bonlineza/b-lib/EllipsisLoader'), require('@bonlineza/b-lib/PageReady'), 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('numeral')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['react', 'styled-components', 'react-notify-toast', '@bonlineza/b-lib/EllipsisLoader', '@bonlineza/b-lib/PageReady', 'stylis-rule-sheet', 'react-dom', 'prop-types', 'raf', 'react-input-autosize', 'react-transition-group', '@bonlineza/b-lib/functions', 'rc-slider', 'numeral'], factory) :
|
|
4
|
+
(global = global || self, global.Interests = factory(global.React, global.styled, global['react-notify-toast'], global.EllipsisLoader, global.PageReady, global['stylis-rule-sheet'], global.reactDom, global.PropTypes, global.raf, global['react-input-autosize'], global['react-transition-group'], global.function, global.rcSlider, global.numeral));
|
|
5
|
+
}(this, (function (React, styled, Notifications, EllipsisLoader, PageReady, stylisRuleSheet, reactDom, PropTypes, raf, AutosizeInput, reactTransitionGroup, functions, rcSlider, numeral) { '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;
|
|
@@ -14,8 +14,6 @@
|
|
|
14
14
|
raf = raf && Object.prototype.hasOwnProperty.call(raf, 'default') ? raf['default'] : raf;
|
|
15
15
|
AutosizeInput = AutosizeInput && Object.prototype.hasOwnProperty.call(AutosizeInput, 'default') ? AutosizeInput['default'] : AutosizeInput;
|
|
16
16
|
numeral = numeral && Object.prototype.hasOwnProperty.call(numeral, 'default') ? numeral['default'] : numeral;
|
|
17
|
-
axios = axios && Object.prototype.hasOwnProperty.call(axios, 'default') ? axios['default'] : axios;
|
|
18
|
-
Cookies = Cookies && Object.prototype.hasOwnProperty.call(Cookies, 'default') ? Cookies['default'] : Cookies;
|
|
19
17
|
|
|
20
18
|
function ownKeys(object, enumerableOnly) {
|
|
21
19
|
var keys = Object.keys(object);
|
|
@@ -10873,127 +10871,6 @@
|
|
|
10873
10871
|
}));
|
|
10874
10872
|
});
|
|
10875
10873
|
|
|
10876
|
-
function getToken() {
|
|
10877
|
-
var _Cookies$get;
|
|
10878
|
-
|
|
10879
|
-
return (_Cookies$get = Cookies.get('_tk')) === null || _Cookies$get === void 0 ? void 0 : _Cookies$get.replace('*', 'Bearer ');
|
|
10880
|
-
}
|
|
10881
|
-
function setToken(value) {
|
|
10882
|
-
Cookies.set('_tk', value, 30);
|
|
10883
|
-
}
|
|
10884
|
-
|
|
10885
|
-
/** @format */
|
|
10886
|
-
|
|
10887
|
-
function getEncodedSearch(currentUrl) {
|
|
10888
|
-
var splitUrl = currentUrl.split('?');
|
|
10889
|
-
var baseUrl = splitUrl[0];
|
|
10890
|
-
var nextUrlSegments = splitUrl[1].split('&');
|
|
10891
|
-
var nextQueryString = splitUrl[1];
|
|
10892
|
-
|
|
10893
|
-
if (nextUrlSegments.length > 0) {
|
|
10894
|
-
nextQueryString = nextUrlSegments.map(function (v) {
|
|
10895
|
-
var nextValue = v;
|
|
10896
|
-
|
|
10897
|
-
if (v.includes('search=')) {
|
|
10898
|
-
var temp = v.split('=');
|
|
10899
|
-
nextValue = "".concat(temp[0], "=").concat(encodeURIComponent(temp[1]));
|
|
10900
|
-
}
|
|
10901
|
-
|
|
10902
|
-
return nextValue;
|
|
10903
|
-
}).join('&');
|
|
10904
|
-
}
|
|
10905
|
-
|
|
10906
|
-
return "".concat(baseUrl, "?").concat(nextQueryString);
|
|
10907
|
-
}
|
|
10908
|
-
/**
|
|
10909
|
-
* Gets an instance of Axios that is configured with the custom failure handlers
|
|
10910
|
-
* @param {Function} onAuthFailed - callback triggers when auth fails - ie, server error is one of ['token_invalid', 'token_not_provided', 'user_not_found', 'token_expired'] or http status is one of [401, 503, 400]
|
|
10911
|
-
* @param {Function} onForbidden - callback triggers when http status = 403
|
|
10912
|
-
*/
|
|
10913
|
-
|
|
10914
|
-
|
|
10915
|
-
var axiosInstance = function axiosInstance(onAuthFailed, onForbidden) {
|
|
10916
|
-
var instance = axios.create({
|
|
10917
|
-
validateStatus: function validateStatus(status) {
|
|
10918
|
-
return status >= 200 && status < 300;
|
|
10919
|
-
}
|
|
10920
|
-
});
|
|
10921
|
-
var token = getToken();
|
|
10922
|
-
|
|
10923
|
-
if (token !== '') {
|
|
10924
|
-
instance.defaults.headers.common.Authorization = token;
|
|
10925
|
-
}
|
|
10926
|
-
|
|
10927
|
-
instance.defaults.headers.common['Content-Type'] = 'application/json;charset=UTF-8'; // Add a request interceptor
|
|
10928
|
-
|
|
10929
|
-
instance.interceptors.request.use(function (request, error) {
|
|
10930
|
-
if (error) {
|
|
10931
|
-
return Promise.reject(error.response);
|
|
10932
|
-
}
|
|
10933
|
-
|
|
10934
|
-
if (request.url.includes('search') && request.url.includes('?')) {
|
|
10935
|
-
// do some uri manipulation for ie
|
|
10936
|
-
// https://stackoverflow.com/questions/18220057
|
|
10937
|
-
// eslint-disable-next-line no-param-reassign
|
|
10938
|
-
request.url = getEncodedSearch(request.url);
|
|
10939
|
-
} // eslint-disable-next-line no-param-reassign
|
|
10940
|
-
|
|
10941
|
-
|
|
10942
|
-
request.headers.common['Content-Type'] = 'application/json; charset=utf-8';
|
|
10943
|
-
|
|
10944
|
-
if (typeof request.body === 'undefined') {
|
|
10945
|
-
request.body = {};
|
|
10946
|
-
}
|
|
10947
|
-
|
|
10948
|
-
token = getToken();
|
|
10949
|
-
|
|
10950
|
-
if (token !== '') {
|
|
10951
|
-
// eslint-disable-next-line no-param-reassign
|
|
10952
|
-
request.headers.common.Authorization = token;
|
|
10953
|
-
}
|
|
10954
|
-
|
|
10955
|
-
return request;
|
|
10956
|
-
}, function (error) {
|
|
10957
|
-
return Promise.reject(error.message);
|
|
10958
|
-
}); // Add a response interceptor
|
|
10959
|
-
|
|
10960
|
-
instance.interceptors.response.use(function (response, error) {
|
|
10961
|
-
if (error) {
|
|
10962
|
-
return Promise.reject(error.response);
|
|
10963
|
-
}
|
|
10964
|
-
|
|
10965
|
-
if (response.headers.authorization) {
|
|
10966
|
-
setToken(response.headers.authorization);
|
|
10967
|
-
}
|
|
10968
|
-
|
|
10969
|
-
return response;
|
|
10970
|
-
}, function (error) {
|
|
10971
|
-
if (error.response) {
|
|
10972
|
-
// network error
|
|
10973
|
-
if (error.response.data && error.response.data.error && (error.response.data.error === 'token_invalid' || error.response.data.error === 'token_not_provided' || error.response.data.error === 'user_not_found' || error.response.data.error === 'token_expired') || error.response.status === 401 || error.response.status === 503 || error.response.status === 400) {
|
|
10974
|
-
onAuthFailed();
|
|
10975
|
-
} // if (error.response.status === 500) {
|
|
10976
|
-
// // INTERNAL SERVER ERROR
|
|
10977
|
-
// store.dispatch({
|
|
10978
|
-
// type: AppConstants.OVERLAY.SERVER_ERROR,
|
|
10979
|
-
// });
|
|
10980
|
-
// return Promise.reject(error.response);
|
|
10981
|
-
// }
|
|
10982
|
-
|
|
10983
|
-
|
|
10984
|
-
if (error.response.status === 403) {
|
|
10985
|
-
// FORBIDDEN
|
|
10986
|
-
onForbidden();
|
|
10987
|
-
}
|
|
10988
|
-
|
|
10989
|
-
return Promise.reject(error.response);
|
|
10990
|
-
}
|
|
10991
|
-
|
|
10992
|
-
return Promise.reject(error);
|
|
10993
|
-
});
|
|
10994
|
-
return instance;
|
|
10995
|
-
}; // NOTE: this to be instanciated with params: onAuthFailed, onForbidden
|
|
10996
|
-
|
|
10997
10874
|
var _excluded$8 = ["children"];
|
|
10998
10875
|
|
|
10999
10876
|
var DropdownSelector = function DropdownSelector(_ref) {
|
|
@@ -11215,7 +11092,7 @@
|
|
|
11215
11092
|
case 0:
|
|
11216
11093
|
_context.prev = 0;
|
|
11217
11094
|
_context.next = 3;
|
|
11218
|
-
return
|
|
11095
|
+
return requestInstance.post("".concat(baseGraphApi, "?id=getBrands"), {
|
|
11219
11096
|
query: getBrandsGraphQuery(1000, 1, 'id|desc')
|
|
11220
11097
|
});
|
|
11221
11098
|
|
|
@@ -11246,7 +11123,7 @@
|
|
|
11246
11123
|
}
|
|
11247
11124
|
}
|
|
11248
11125
|
}, _callee, null, [[0, 7]]);
|
|
11249
|
-
})), [baseGraphApi, getBrandsGraphQuery]);
|
|
11126
|
+
})), [baseGraphApi, getBrandsGraphQuery, requestInstance]);
|
|
11250
11127
|
var fetchModels = React.useCallback( /*#__PURE__*/function () {
|
|
11251
11128
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(brandId) {
|
|
11252
11129
|
var _response$data2, _response$data2$data, _response$data2$data$, response, formattedModels;
|
|
@@ -11257,7 +11134,7 @@
|
|
|
11257
11134
|
case 0:
|
|
11258
11135
|
_context2.prev = 0;
|
|
11259
11136
|
_context2.next = 3;
|
|
11260
|
-
return
|
|
11137
|
+
return requestInstance.post("".concat(baseGraphApi, "?id=getModels"), {
|
|
11261
11138
|
query: getModelsGraphQuery(brandId)
|
|
11262
11139
|
});
|
|
11263
11140
|
|
|
@@ -11293,7 +11170,7 @@
|
|
|
11293
11170
|
return function (_x) {
|
|
11294
11171
|
return _ref3.apply(this, arguments);
|
|
11295
11172
|
};
|
|
11296
|
-
}(), [baseGraphApi, getModelsGraphQuery]);
|
|
11173
|
+
}(), [baseGraphApi, getModelsGraphQuery, requestInstance]);
|
|
11297
11174
|
var fetchMaterials = React.useCallback( /*#__PURE__*/function () {
|
|
11298
11175
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(brandId) {
|
|
11299
11176
|
var _response$data3, _response$data3$data, _response$data3$data$, response, formattedMaterials;
|
|
@@ -11304,7 +11181,7 @@
|
|
|
11304
11181
|
case 0:
|
|
11305
11182
|
_context3.prev = 0;
|
|
11306
11183
|
_context3.next = 3;
|
|
11307
|
-
return
|
|
11184
|
+
return requestInstance.post("".concat(baseGraphApi, "?id=getMaterials"), {
|
|
11308
11185
|
query: getMaterialsGraphQuery(brandId)
|
|
11309
11186
|
});
|
|
11310
11187
|
|
|
@@ -11340,7 +11217,7 @@
|
|
|
11340
11217
|
return function (_x2) {
|
|
11341
11218
|
return _ref4.apply(this, arguments);
|
|
11342
11219
|
};
|
|
11343
|
-
}(), [baseGraphApi, getMaterialsGraphQuery]);
|
|
11220
|
+
}(), [baseGraphApi, getMaterialsGraphQuery, requestInstance]);
|
|
11344
11221
|
React.useEffect(function () {
|
|
11345
11222
|
fetchBrands();
|
|
11346
11223
|
}, [fetchBrands]);
|