@bonlineza/luxity-lib 2.35.4 → 2.35.6
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 +127 -5
- package/GraphQLDropdownSelector.js +126 -5
- package/Interests.js +127 -5
- package/LuxityDesktopHeader.js +300 -237
- package/LuxityGraphQLDropdownSelector.js +126 -5
- package/LuxityMobileHeader.js +318 -228
- package/MaterialSelector.js +126 -5
- package/ModelSelector.js +126 -5
- package/build/bundle.css +1 -1
- package/build/bundle.js +509 -293
- package/package.json +1 -1
- package/build/.gitignore +0 -3
- package/build/.npmignore +0 -0
|
@@ -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('
|
|
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', '
|
|
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.
|
|
5
|
-
}(this, (function (React, styled, EllipsisLoader, PageReady, AnimateHeight, numeral, stylisRuleSheet, reactDom, PropTypes, raf, AutosizeInput, reactTransitionGroup, functions, rcSlider, Notifications,
|
|
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'), require('js-cookie')) :
|
|
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', 'js-cookie'], 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, global.Cookies));
|
|
5
|
+
}(this, (function (React, styled, EllipsisLoader, PageReady, AnimateHeight, numeral, stylisRuleSheet, reactDom, PropTypes, raf, AutosizeInput, reactTransitionGroup, functions, rcSlider, Notifications, axios, Cookies) { '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,8 +15,8 @@
|
|
|
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
|
-
axiosInstance = axiosInstance && Object.prototype.hasOwnProperty.call(axiosInstance, 'default') ? axiosInstance['default'] : axiosInstance;
|
|
19
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
20
|
|
|
21
21
|
function ownKeys(object, enumerableOnly) {
|
|
22
22
|
var keys = Object.keys(object);
|
|
@@ -11009,6 +11009,127 @@
|
|
|
11009
11009
|
}));
|
|
11010
11010
|
});
|
|
11011
11011
|
|
|
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
|
+
|
|
11012
11133
|
var _excluded$8 = ["children"];
|
|
11013
11134
|
|
|
11014
11135
|
var DropdownSelector = function DropdownSelector(_ref) {
|