@bonlineza/luxity-lib 2.35.4 → 2.35.5

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.
@@ -1,12 +1,13 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react'), require('styled-components'), require('helpers/axios'), 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', 'helpers/axios', '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.axiosInstance, 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, axiosInstance, Notifications, stylisRuleSheet, reactDom, PropTypes, raf, AutosizeInput, reactTransitionGroup) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react'), require('styled-components'), require('axios'), require('js-cookie'), 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', 'axios', 'js-cookie', '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.axios, global.Cookies, 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, axios, Cookies, 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
- axiosInstance = axiosInstance && Object.prototype.hasOwnProperty.call(axiosInstance, 'default') ? axiosInstance['default'] : axiosInstance;
9
+ axios = axios && Object.prototype.hasOwnProperty.call(axios, 'default') ? axios['default'] : axios;
10
+ Cookies = Cookies && Object.prototype.hasOwnProperty.call(Cookies, 'default') ? Cookies['default'] : Cookies;
10
11
  var Notifications__default = 'default' in Notifications ? Notifications['default'] : Notifications;
11
12
  stylisRuleSheet = stylisRuleSheet && Object.prototype.hasOwnProperty.call(stylisRuleSheet, 'default') ? stylisRuleSheet['default'] : stylisRuleSheet;
12
13
  PropTypes = PropTypes && Object.prototype.hasOwnProperty.call(PropTypes, 'default') ? PropTypes['default'] : PropTypes;
@@ -559,6 +560,127 @@
559
560
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
560
561
  }
561
562
 
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
+
562
684
  var defaultNotifyTime = 5000;
563
685
  var error = function error(message) {
564
686
  Notifications.notify.show(message, 'error', defaultNotifyTime);
@@ -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('helpers/axios'), 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', 'helpers/axios', '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.axiosInstance, global.axios));
5
- }(this, (function (React, styled, EllipsisLoader, PageReady, AnimateHeight, numeral, stylisRuleSheet, reactDom, PropTypes, raf, AutosizeInput, reactTransitionGroup, functions, rcSlider, Notifications, axiosInstance, axios) { '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'), 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.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, 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) {
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'), require('helpers/axios')) :
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', 'helpers/axios'], 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, global.axiosInstance));
5
- }(this, (function (React, styled, Notifications, EllipsisLoader, PageReady, stylisRuleSheet, reactDom, PropTypes, raf, AutosizeInput, reactTransitionGroup, functions, rcSlider, numeral, axiosInstance) { 'use strict';
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'), require('axios'), require('js-cookie')) :
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', 'axios', 'js-cookie'], 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, global.axios, global.Cookies));
5
+ }(this, (function (React, styled, Notifications, EllipsisLoader, PageReady, stylisRuleSheet, reactDom, PropTypes, raf, AutosizeInput, reactTransitionGroup, functions, rcSlider, numeral, 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;
@@ -14,7 +14,8 @@
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
- axiosInstance = axiosInstance && Object.prototype.hasOwnProperty.call(axiosInstance, 'default') ? axiosInstance['default'] : axiosInstance;
17
+ axios = axios && Object.prototype.hasOwnProperty.call(axios, 'default') ? axios['default'] : axios;
18
+ Cookies = Cookies && Object.prototype.hasOwnProperty.call(Cookies, 'default') ? Cookies['default'] : Cookies;
18
19
 
19
20
  function ownKeys(object, enumerableOnly) {
20
21
  var keys = Object.keys(object);
@@ -10872,6 +10873,127 @@
10872
10873
  }));
10873
10874
  });
10874
10875
 
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
+
10875
10997
  var _excluded$8 = ["children"];
10876
10998
 
10877
10999
  var DropdownSelector = function DropdownSelector(_ref) {
@@ -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('helpers/axios'), 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', 'helpers/axios', '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.axiosInstance, global.axios));
5
- }(this, (function (React, styled, EllipsisLoader, PageReady, AnimateHeight, numeral, stylisRuleSheet, reactDom, PropTypes, raf, AutosizeInput, reactTransitionGroup, functions, rcSlider, Notifications, axiosInstance, axios) { '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'), 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) {
@@ -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('helpers/axios'), 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', 'helpers/axios', 'axios'], factory) :
4
- (global = global || self, global.MaterialSelector = 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.axiosInstance, global.axios));
5
- }(this, (function (React, styled, EllipsisLoader, PageReady, AnimateHeight, numeral, stylisRuleSheet, reactDom, PropTypes, raf, AutosizeInput, reactTransitionGroup, functions, rcSlider, Notifications, axiosInstance, axios) { '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'), 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.MaterialSelector = 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) {
package/ModelSelector.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('@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('helpers/axios'), 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', 'helpers/axios', 'axios'], factory) :
4
- (global = global || self, global.ModelSelector = 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.axiosInstance, global.axios));
5
- }(this, (function (React, styled, EllipsisLoader, PageReady, AnimateHeight, numeral, stylisRuleSheet, reactDom, PropTypes, raf, AutosizeInput, reactTransitionGroup, functions, rcSlider, Notifications, axiosInstance, axios) { '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'), 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.ModelSelector = 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) {
package/build/bundle.css CHANGED
@@ -1 +1 @@
1
- .navbar{box-shadow:2px 2px 10px #dfdede;display:flex;padding-bottom:10px;padding-top:20px;position:relative}.navbar__link-item--desktop{align-items:center;display:flex;height:35px;margin:auto 0;padding-top:5px}.navbar__mobile-wrapper{align-items:center;display:flex;flex-direction:column;padding-bottom:20px;padding-left:32px;padding-right:32px}.navbar__container{display:flex;margin:0 auto;max-width:1280px;padding-left:12px;padding-right:12px;width:100%}.navbar__body{flex-basis:60%}.navbar__wrapper{align-items:center;display:flex;justify-content:space-between;width:100%}.navbar__product-search-wrapper{align-items:center;display:flex;justify-content:center;padding:0 20%;width:100%}@media only screen and (max-width:879px){.navbar__product-search-wrapper{padding:0}}.navbar__input-close-icon{height:auto;margin-bottom:10px;margin-left:10px;width:20px}@media only screen and (max-width:879px){.navbar__input-close-icon{margin-bottom:0;margin-left:0;width:15px}}.navbar__menu-icon{width:30px}.navbar__product-search{align-items:center;display:flex;max-width:545px;width:100%}.navbar__logo-wrapper{margin-right:18px;width:200px}.navbar__logo{width:200px}@media only screen and (max-width:879px){.navbar__logo{margin-left:10px;margin-top:5px;width:125px}}.navbar__form-input{align-items:center;background:transparent;border:none;display:flex;font-size:13px;outline:none;padding:8px;width:100%}.navbar__product-search{border:1px solid #dfdede;margin-bottom:10px}@media only screen and (max-width:879px){.navbar__product-search{border:none;border-bottom:1px solid #dfdede;margin-bottom:0;margin-right:10px;margin-top:10px}}.navbar__section{align-items:flex-start;display:flex;flex-direction:row;justify-content:space-between;width:100%}.navbar__link{display:inline-block;font-family:Martel Sans;font-size:14px;font-weight:700;margin-right:10px;overflow:hidden;text-transform:uppercase;transition:.3s ease-in-out}.navbar__link:after{background-color:#000;content:"";display:block;height:2px;transition:width .25s ease-out;width:0}.navbar__link:hover:after{width:100%}.navbar__link:hover .navbar__dropdown{animation:fadeInDropdown .3s ease-in-out;display:block}.navbar__dropdown{background-color:#fff;box-shadow:5px 5px 5px #dfdede;display:none;left:0;position:absolute;width:100%;z-index:999}@keyframes fadeInDropdown{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}.navbar__company-link{font-size:13px;font-weight:400;list-style:none;margin-left:18px;text-decoration:none}.navbar__company-block{align-items:center;background-color:#000;color:#fff;display:flex;font-weight:700;height:33px;justify-content:center;margin-right:0;padding:0 18px;text-transform:uppercase}.navbar__input-search-icon{height:auto;margin-left:1.125rem;margin-right:.375rem;width:15px}.navbar__nav-links{align-items:center;display:flex}.navbar__nav-links--wrap{flex-wrap:wrap}.navbar__icons{align-items:center;display:flex;height:40px;justify-content:flex-end;margin-bottom:10px}@media only screen and (max-width:879px){.navbar__icons{display:block;height:20px;margin-bottom:0}}.navbar__icon{cursor:pointer;height:auto;margin-right:18px;width:20px}@media only screen and (max-width:879px){.navbar__icon{margin-right:0}}.navbar__icon--app{cursor:pointer;height:auto;margin-left:12px;width:20px}@media only screen and (max-width:879px){.navbar__icon--app{margin-right:0}}.navbar__vip-icon{height:16px;position:absolute;right:-12px;top:-4px;width:16px}.navbar__cart-icon{position:relative}.navbar__cart-count{align-items:center;background-color:#000;border-radius:50%;bottom:50%;color:#fff;display:flex;font-size:13px;height:20px;justify-content:center;left:100%;position:absolute;width:20px}.footer__newsletter-section{align-items:center;background-color:#000;color:#fff;display:flex;justify-content:space-between;padding:2.265rem 0}@media only screen and (max-width:879px){.footer__newsletter-section{flex-direction:column}}.footer__newsletter-wrapper{align-items:center;display:flex;justify-content:space-between;margin:0 auto;max-width:1280px;padding-left:32px;padding-right:32px;width:100%}@media only screen and (max-width:879px){.footer__newsletter-wrapper{flex-direction:column}.footer__link-container{flex-basis:50%}}.footer__newsletter-icon{height:30px;position:absolute;right:0;top:0;width:32px}.footer__newsletter-form{flex-basis:50%;max-width:250px;position:relative}@media only screen and (max-width:879px){.footer__newsletter-form{display:block;margin-top:20px;max-width:100%;width:100%}}.footer__newsletter-title{font-family:Martel Sans,sans-serif;font-size:14px;font-weight:700;letter-spacing:3px;margin-bottom:1.125rem;text-transform:uppercase}.footer__newsletter-text{font-size:14px}.footer__form-input{background-color:#000;border:none;border-bottom:1px solid #fff;color:#fff;height:30px;outline:none;width:100%}.footer__form-input::-moz-placeholder{color:#fff;font-weight:400}.footer__form-input::placeholder{color:#fff;font-weight:400}.footer__form-errors{color:#fff;margin-top:5px}.footer__main-section{align-items:flex-start;display:flex;justify-content:space-between;margin-bottom:50px;margin-top:80px}.footer__link-title{font-family:El Messiri;font-size:16px;font-weight:700;margin-bottom:20px;text-transform:uppercase}@media only screen and (max-width:879px){.footer__link-title{margin-bottom:10px}}.footer__link-child{margin-top:25px}.footer__links{display:flex;flex-direction:column}.footer__link{color:#939393;cursor:pointer;font-family:Martel Sans;font-size:14px;line-height:20px;margin-bottom:7px;text-align:left;text-decoration:none}.footer__link:hover{color:#000;text-decoration:underline}@media only screen and (max-width:879px){.footer__link{margin-bottom:10px}}.footer__link-wrapper{align-items:center;display:flex;gap:5px}.footer__link-icon{height:30px;margin-bottom:18px}.footer__text{color:#939393;font-family:Martel Sans;font-size:14px;line-height:20px;margin-bottom:15px;text-align:left;text-decoration:none}.footer__store-hours{margin-top:35px}.footer__copyrights-section{border-top:1px solid;display:flex;justify-content:space-between;padding-bottom:20px;padding-top:20px}.footer__logo{height:30px;width:135px}.footer__payment-icons{align-items:center;display:flex;gap:8px}.footer__wrapper{margin:0 auto;max-width:1280px;padding-left:32px;padding-right:32px;width:100%}@media only screen and (max-width:879px){.footer__wrapper{padding:32px 0 0 24px}}.footer__wrapper--desktop{display:block}@media only screen and (max-width:879px){.footer__wrapper--desktop{display:none}}.footer__wrapper--mobile{display:none}@media only screen and (max-width:879px){.footer__wrapper--mobile{display:block;padding-top:30px}}.footer__copyright{font-size:10px;line-height:22px}.footer__copyright--mobile{display:none}@media only screen and (max-width:879px){.footer__copyright--mobile{display:block;padding:30px 10px 30px 0;text-align:center}}.footer__section-row{display:flex;gap:50%}@media only screen and (max-width:879px){.footer__section-row{gap:unset}}.side-nav{font-family:Martel Sans}.side-nav__errors{align-items:center;color:red;display:flex;font-size:16px;justify-content:center}.side-nav__overlay{background-color:rgba(78,73,73,.51);height:100%;opacity:0;position:fixed;top:0;transition:opacity .5s ease-out 0s,visibility .5s ease-out 0s;width:100%;z-index:99999}.side-nav__overlay--visible{opacity:1;visibility:visible}.side-nav__overlay--hidden{opacity:1;visibility:hidden}.side-nav__content{background-color:#fff;bottom:0;overflow-y:scroll;padding:1.5rem;position:fixed;top:0;transition:left .5s ease-in-out;width:80%;z-index:99999}.side-nav__content--hidden{display:none}.side-nav__content--open{left:0}.side-nav__content--closed{left:-100%}.side-nav__menu-title-wrapper{align-items:center;background-color:transparent;border:none;display:flex;justify-content:space-between;outline:none;width:100%}.side-nav__icon-container{float:right;margin-bottom:10px}.side-nav__menu-title{font-size:14px;font-weight:700;line-height:20px;text-transform:uppercase}.side-nav__accordion-icon{height:auto;width:15px}.side-nav__menu-item{margin-bottom:25px}.side-nav__close-icon{height:20px;margin-left:auto;width:20px}.side-nav__back-button-wrapper{align-items:center;display:flex;margin-bottom:25px}.side-nav__back-icon{height:20px;width:20px}.side-nav__back-button,.side-nav__sub-menu-title{font-weight:700;text-transform:uppercase}.side-nav__sub-menu-title{font-size:14px;margin-bottom:10px}.side-nav__elements{display:flex;flex-direction:column}.side-nav__element{color:#555;cursor:pointer;line-height:20px;margin-bottom:10px}.side-nav__element,.side-nav__sub-link{font-size:14px;font-weight:400;text-transform:capitalize}.side-nav__block-button{background-color:#000;color:#fff;font-weight:700;padding:10px 0;width:100%}.side-nav{font-family:Martel Sans}.side-nav__errors{align-items:center;color:red;display:flex;font-size:16px;justify-content:center}.side-nav__overlay{background-color:rgba(78,73,73,.51);height:100%;opacity:0;position:fixed;top:0;transition:opacity .5s ease-out 0s,visibility .5s ease-out 0s;width:100%;z-index:99999}.side-nav__overlay--visible{opacity:1;visibility:visible}.side-nav__overlay--hidden{opacity:1;visibility:hidden}.side-nav__content{background-color:#fff;bottom:0;overflow-y:scroll;padding:1.5rem;position:fixed;top:0;transition:left .5s ease-in-out;width:80%;z-index:99999}.side-nav__content--hidden{display:none}.side-nav__content--open{left:0}.side-nav__content--closed{left:-100%}.side-nav__menu-title-wrapper{align-items:center;background-color:transparent;border:none;display:flex;outline:none;width:100%}.side-nav__icon-container{float:right;margin-bottom:10px}.side-nav__menu-title{align-items:center;display:flex;font-size:14px;font-weight:700;justify-content:center;line-height:20px;text-transform:uppercase}.side-nav__menu-icon{display:flex;height:25px;margin-right:10px;width:25px}.side-nav__menu-divider{margin-bottom:40px}.side-nav__accordion-icon{height:auto;width:15px}.side-nav__menu-item{margin-bottom:25px}.side-nav__close-icon{height:20px;margin-left:auto;width:20px}.side-nav__back-button-wrapper{align-items:center;display:flex;margin-bottom:25px}.side-nav__back-icon{height:20px;width:20px}.side-nav__back-button,.side-nav__sub-menu-title{font-weight:700;text-transform:uppercase}.side-nav__sub-menu-title{font-size:14px;margin-bottom:10px}.side-nav__elements{display:flex;flex-direction:column}.side-nav__element{color:#555;cursor:pointer;line-height:20px;margin-bottom:10px}.side-nav__element,.side-nav__sub-link{font-size:14px;font-weight:400;text-transform:capitalize}.side-nav__block-button{background-color:#000;color:#fff;font-weight:700;padding:10px 0;width:100%}@charset "UTF-8";.currency-select-container{align-items:center;display:flex;margin-right:18px;position:relative}.currency-select-container .currency-flag{margin-right:5px}.currency-select-container .currency-flag img{height:15px;-o-object-fit:cover;object-fit:cover;width:20px}.currency-select-container .currency-select{appearance:none;-webkit-appearance:none;-moz-appearance:none;background-color:transparent;border:none;color:#000;cursor:pointer;font-family:inherit;font-size:14px;margin:0;outline:none;padding:5px 15px 5px 5px}.currency-select-container .currency-select::-ms-expand{display:none}.currency-select-container .currency-select:focus{box-shadow:none;outline:none}.currency-select-container .currency-select:-moz-focusring{color:transparent;text-shadow:0 0 0 #000}.currency-select-container:after{color:#000;content:"▼";font-size:10px;pointer-events:none;position:absolute;right:0;top:50%;transform:translateY(-50%)}@media only screen and (max-width:879px){.currency-select-container .currency-select{appearance:menulist;-webkit-appearance:menulist;-moz-appearance:menulist;padding-right:0}.currency-select-container:after{display:none}}.currency-select-container.disabled{cursor:not-allowed;opacity:.7}.currency-select-container.disabled .currency-select{pointer-events:none}.interests__add-button{display:flex;flex-direction:row;gap:10px;width:100%}@media only screen and (max-width:879px){.interests__add-button{flex-direction:column}}.interests__section-wrapper{display:flex;flex-direction:column;width:100%}.interests__select-option{display:flex;flex-direction:column;margin-bottom:15px}.interests__title{font-family:El Messiri;font-size:16px;margin-bottom:10px}.stores-dropdown{align-items:flex-start;display:flex;font-family:Martel Sans;gap:20px;margin-left:auto;margin-right:auto;max-width:1280px;overflow-x:auto;padding:20px 15px}.stores-dropdown__image{height:200px;-o-object-fit:cover;object-fit:cover;width:100%}.stores-dropdown__store-details{flex-basis:20%}.stores-dropdown__title{font-family:El Messiri}.stores-dropdown__main-title,.stores-dropdown__title{font-size:16px;font-weight:400;letter-spacing:3px;margin-top:20px}.stores-dropdown__main-title{font-weight:700;margin-bottom:10px}.stores-dropdown__open-days{font-size:12px;font-weight:700;line-height:20px}.stores-dropdown__open-hours{font-size:12px;font-weight:400;line-height:20px}.stores-dropdown__queries-title{font-family:El Messiri;font-size:16px;font-weight:400;letter-spacing:3px}.stores-dropdown__contact-details{font-size:16px;font-weight:700}.stores-dropdown__view-more{cursor:pointer;font-size:14px;font-weight:400;margin-top:10px;text-transform:capitalize}.dropdown{display:flex;justify-content:space-between;margin-left:auto;margin-right:auto;max-width:1280px;min-height:500px;overflow-x:auto;padding:20px 0}.dropdown__errors{align-items:center;color:red;display:flex;font-size:16px;justify-content:center;min-height:300px}.dropdown__column{flex:1;padding-left:12px}.dropdown__column:nth-child(2){flex:2}.dropdown__title{font-family:El Messiri;font-size:16px;font-weight:700;letter-spacing:3px;line-height:1;margin-bottom:20px;text-transform:uppercase}.dropdown__elements{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));max-height:800px;overflow-y:auto}.dropdown__brand-elements{-moz-column-count:3;column-count:3;max-height:800px}.dropdown__brand-element{cursor:pointer;margin-bottom:10px}.dropdown__element{flex-basis:33.33%;font-family:Martel Sans;font-size:14px;font-weight:400;margin-bottom:10px;text-transform:capitalize}.cover-spinner{align-items:center;background-color:hsla(0,0%,100%,.7);display:flex;height:100%;justify-content:center;min-height:400px;position:relative;top:50%;width:100%;z-index:9999}.cover-spinner:after{animation:spin 1.5s linear infinite;border:4px dotted #000;border-radius:50%;border-top-color:transparent;content:"";display:block;height:40px;position:absolute;width:40px}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}
1
+ .side-nav{font-family:Martel Sans}.side-nav__errors{align-items:center;color:red;display:flex;font-size:16px;justify-content:center}.side-nav__overlay{background-color:rgba(78,73,73,.51);height:100%;opacity:0;position:fixed;top:0;transition:opacity .5s ease-out 0s,visibility .5s ease-out 0s;width:100%;z-index:99999}.side-nav__overlay--visible{opacity:1;visibility:visible}.side-nav__overlay--hidden{opacity:1;visibility:hidden}.side-nav__content{background-color:#fff;bottom:0;overflow-y:scroll;padding:1.5rem;position:fixed;top:0;transition:left .5s ease-in-out;width:80%;z-index:99999}.side-nav__content--hidden{display:none}.side-nav__content--open{left:0}.side-nav__content--closed{left:-100%}.side-nav__menu-title-wrapper{align-items:center;background-color:transparent;border:none;display:flex;justify-content:space-between;outline:none;width:100%}.side-nav__icon-container{float:right;margin-bottom:10px}.side-nav__menu-title{font-size:14px;font-weight:700;line-height:20px;text-transform:uppercase}.side-nav__accordion-icon{height:auto;width:15px}.side-nav__menu-item{margin-bottom:25px}.side-nav__close-icon{height:20px;margin-left:auto;width:20px}.side-nav__back-button-wrapper{align-items:center;display:flex;margin-bottom:25px}.side-nav__back-icon{height:20px;width:20px}.side-nav__back-button,.side-nav__sub-menu-title{font-weight:700;text-transform:uppercase}.side-nav__sub-menu-title{font-size:14px;margin-bottom:10px}.side-nav__elements{display:flex;flex-direction:column}.side-nav__element{color:#555;cursor:pointer;line-height:20px;margin-bottom:10px}.side-nav__element,.side-nav__sub-link{font-size:14px;font-weight:400;text-transform:capitalize}.side-nav__block-button{background-color:#000;color:#fff;font-weight:700;padding:10px 0;width:100%}.side-nav{font-family:Martel Sans}.side-nav__errors{align-items:center;color:red;display:flex;font-size:16px;justify-content:center}.side-nav__overlay{background-color:rgba(78,73,73,.51);height:100%;opacity:0;position:fixed;top:0;transition:opacity .5s ease-out 0s,visibility .5s ease-out 0s;width:100%;z-index:99999}.side-nav__overlay--visible{opacity:1;visibility:visible}.side-nav__overlay--hidden{opacity:1;visibility:hidden}.side-nav__content{background-color:#fff;bottom:0;overflow-y:scroll;padding:1.5rem;position:fixed;top:0;transition:left .5s ease-in-out;width:80%;z-index:99999}.side-nav__content--hidden{display:none}.side-nav__content--open{left:0}.side-nav__content--closed{left:-100%}.side-nav__menu-title-wrapper{align-items:center;background-color:transparent;border:none;display:flex;outline:none;width:100%}.side-nav__icon-container{float:right;margin-bottom:10px}.side-nav__menu-title{align-items:center;display:flex;font-size:14px;font-weight:700;justify-content:center;line-height:20px;text-transform:uppercase}.side-nav__menu-icon{display:flex;height:25px;margin-right:10px;width:25px}.side-nav__menu-divider{margin-bottom:40px}.side-nav__accordion-icon{height:auto;width:15px}.side-nav__menu-item{margin-bottom:25px}.side-nav__close-icon{height:20px;margin-left:auto;width:20px}.side-nav__back-button-wrapper{align-items:center;display:flex;margin-bottom:25px}.side-nav__back-icon{height:20px;width:20px}.side-nav__back-button,.side-nav__sub-menu-title{font-weight:700;text-transform:uppercase}.side-nav__sub-menu-title{font-size:14px;margin-bottom:10px}.side-nav__elements{display:flex;flex-direction:column}.side-nav__element{color:#555;cursor:pointer;line-height:20px;margin-bottom:10px}.side-nav__element,.side-nav__sub-link{font-size:14px;font-weight:400;text-transform:capitalize}.side-nav__block-button{background-color:#000;color:#fff;font-weight:700;padding:10px 0;width:100%}@charset "UTF-8";.currency-select-container{align-items:center;display:flex;margin-right:18px;position:relative}.currency-select-container .currency-flag{margin-right:5px}.currency-select-container .currency-flag img{height:15px;-o-object-fit:cover;object-fit:cover;width:20px}.currency-select-container .currency-select{appearance:none;-webkit-appearance:none;-moz-appearance:none;background-color:transparent;border:none;color:#000;cursor:pointer;font-family:inherit;font-size:14px;margin:0;outline:none;padding:5px 15px 5px 5px}.currency-select-container .currency-select::-ms-expand{display:none}.currency-select-container .currency-select:focus{box-shadow:none;outline:none}.currency-select-container .currency-select:-moz-focusring{color:transparent;text-shadow:0 0 0 #000}.currency-select-container:after{color:#000;content:"▼";font-size:10px;pointer-events:none;position:absolute;right:0;top:50%;transform:translateY(-50%)}@media only screen and (max-width:879px){.currency-select-container .currency-select{appearance:menulist;-webkit-appearance:menulist;-moz-appearance:menulist;padding-right:0}.currency-select-container:after{display:none}}.currency-select-container.disabled{cursor:not-allowed;opacity:.7}.currency-select-container.disabled .currency-select{pointer-events:none}.interests__add-button{display:flex;flex-direction:row;gap:10px;width:100%}@media only screen and (max-width:879px){.interests__add-button{flex-direction:column}}.interests__section-wrapper{display:flex;flex-direction:column;width:100%}.interests__select-option{display:flex;flex-direction:column;margin-bottom:15px}.interests__title{font-family:El Messiri;font-size:16px;margin-bottom:10px}.navbar{box-shadow:2px 2px 10px #dfdede;display:flex;padding-bottom:10px;padding-top:20px;position:relative}.navbar__link-item--desktop{align-items:center;display:flex;height:35px;margin:auto 0;padding-top:5px}.navbar__mobile-wrapper{align-items:center;display:flex;flex-direction:column;padding-bottom:20px;padding-left:32px;padding-right:32px}.navbar__container{display:flex;margin:0 auto;max-width:1280px;padding-left:12px;padding-right:12px;width:100%}.navbar__body{flex-basis:60%}.navbar__wrapper{align-items:center;display:flex;justify-content:space-between;width:100%}.navbar__product-search-wrapper{align-items:center;display:flex;justify-content:center;padding:0 20%;width:100%}@media only screen and (max-width:879px){.navbar__product-search-wrapper{padding:0}}.navbar__input-close-icon{height:auto;margin-bottom:10px;margin-left:10px;width:20px}@media only screen and (max-width:879px){.navbar__input-close-icon{margin-bottom:0;margin-left:0;width:15px}}.navbar__menu-icon{width:30px}.navbar__product-search{align-items:center;display:flex;max-width:545px;width:100%}.navbar__logo-wrapper{margin-right:18px;width:200px}.navbar__logo{width:200px}@media only screen and (max-width:879px){.navbar__logo{margin-left:10px;margin-top:5px;width:125px}}.navbar__form-input{align-items:center;background:transparent;border:none;display:flex;font-size:13px;outline:none;padding:8px;width:100%}.navbar__product-search{border:1px solid #dfdede;margin-bottom:10px}@media only screen and (max-width:879px){.navbar__product-search{border:none;border-bottom:1px solid #dfdede;margin-bottom:0;margin-right:10px;margin-top:10px}}.navbar__section{align-items:flex-start;display:flex;flex-direction:row;justify-content:space-between;width:100%}.navbar__link{display:inline-block;font-family:Martel Sans;font-size:14px;font-weight:700;margin-right:10px;overflow:hidden;text-transform:uppercase;transition:.3s ease-in-out}.navbar__link:after{background-color:#000;content:"";display:block;height:2px;transition:width .25s ease-out;width:0}.navbar__link:hover:after{width:100%}.navbar__link:hover .navbar__dropdown{animation:fadeInDropdown .3s ease-in-out;display:block}.navbar__dropdown{background-color:#fff;box-shadow:5px 5px 5px #dfdede;display:none;left:0;position:absolute;width:100%;z-index:999}@keyframes fadeInDropdown{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}.navbar__company-link{font-size:13px;font-weight:400;list-style:none;margin-left:18px;text-decoration:none}.navbar__company-block{align-items:center;background-color:#000;color:#fff;display:flex;font-weight:700;height:33px;justify-content:center;margin-right:0;padding:0 18px;text-transform:uppercase}.navbar__input-search-icon{height:auto;margin-left:1.125rem;margin-right:.375rem;width:15px}.navbar__nav-links{align-items:center;display:flex}.navbar__nav-links--wrap{flex-wrap:wrap}.navbar__icons{align-items:center;display:flex;height:40px;justify-content:flex-end;margin-bottom:10px}@media only screen and (max-width:879px){.navbar__icons{display:block;height:20px;margin-bottom:0}}.navbar__icon{cursor:pointer;height:auto;margin-right:18px;width:20px}@media only screen and (max-width:879px){.navbar__icon{margin-right:0}}.navbar__icon--app{cursor:pointer;height:auto;margin-left:12px;width:20px}@media only screen and (max-width:879px){.navbar__icon--app{margin-right:0}}.navbar__vip-icon{height:16px;position:absolute;right:-12px;top:-4px;width:16px}.navbar__cart-icon{position:relative}.navbar__cart-count{align-items:center;background-color:#000;border-radius:50%;bottom:50%;color:#fff;display:flex;font-size:13px;height:20px;justify-content:center;left:100%;position:absolute;width:20px}.footer__newsletter-section{align-items:center;background-color:#000;color:#fff;display:flex;justify-content:space-between;padding:2.265rem 0}@media only screen and (max-width:879px){.footer__newsletter-section{flex-direction:column}}.footer__newsletter-wrapper{align-items:center;display:flex;justify-content:space-between;margin:0 auto;max-width:1280px;padding-left:32px;padding-right:32px;width:100%}@media only screen and (max-width:879px){.footer__newsletter-wrapper{flex-direction:column}.footer__link-container{flex-basis:50%}}.footer__newsletter-icon{height:30px;position:absolute;right:0;top:0;width:32px}.footer__newsletter-form{flex-basis:50%;max-width:250px;position:relative}@media only screen and (max-width:879px){.footer__newsletter-form{display:block;margin-top:20px;max-width:100%;width:100%}}.footer__newsletter-title{font-family:Martel Sans,sans-serif;font-size:14px;font-weight:700;letter-spacing:3px;margin-bottom:1.125rem;text-transform:uppercase}.footer__newsletter-text{font-size:14px}.footer__form-input{background-color:#000;border:none;border-bottom:1px solid #fff;color:#fff;height:30px;outline:none;width:100%}.footer__form-input::-moz-placeholder{color:#fff;font-weight:400}.footer__form-input::placeholder{color:#fff;font-weight:400}.footer__form-errors{color:#fff;margin-top:5px}.footer__main-section{align-items:flex-start;display:flex;justify-content:space-between;margin-bottom:50px;margin-top:80px}.footer__link-title{font-family:El Messiri;font-size:16px;font-weight:700;margin-bottom:20px;text-transform:uppercase}@media only screen and (max-width:879px){.footer__link-title{margin-bottom:10px}}.footer__link-child{margin-top:25px}.footer__links{display:flex;flex-direction:column}.footer__link{color:#939393;cursor:pointer;font-family:Martel Sans;font-size:14px;line-height:20px;margin-bottom:7px;text-align:left;text-decoration:none}.footer__link:hover{color:#000;text-decoration:underline}@media only screen and (max-width:879px){.footer__link{margin-bottom:10px}}.footer__link-wrapper{align-items:center;display:flex;gap:5px}.footer__link-icon{height:30px;margin-bottom:18px}.footer__text{color:#939393;font-family:Martel Sans;font-size:14px;line-height:20px;margin-bottom:15px;text-align:left;text-decoration:none}.footer__store-hours{margin-top:35px}.footer__copyrights-section{border-top:1px solid;display:flex;justify-content:space-between;padding-bottom:20px;padding-top:20px}.footer__logo{height:30px;width:135px}.footer__payment-icons{align-items:center;display:flex;gap:8px}.footer__wrapper{margin:0 auto;max-width:1280px;padding-left:32px;padding-right:32px;width:100%}@media only screen and (max-width:879px){.footer__wrapper{padding:32px 0 0 24px}}.footer__wrapper--desktop{display:block}@media only screen and (max-width:879px){.footer__wrapper--desktop{display:none}}.footer__wrapper--mobile{display:none}@media only screen and (max-width:879px){.footer__wrapper--mobile{display:block;padding-top:30px}}.footer__copyright{font-size:10px;line-height:22px}.footer__copyright--mobile{display:none}@media only screen and (max-width:879px){.footer__copyright--mobile{display:block;padding:30px 10px 30px 0;text-align:center}}.footer__section-row{display:flex;gap:50%}@media only screen and (max-width:879px){.footer__section-row{gap:unset}}.stores-dropdown{align-items:flex-start;display:flex;font-family:Martel Sans;gap:20px;margin-left:auto;margin-right:auto;max-width:1280px;overflow-x:auto;padding:20px 15px}.stores-dropdown__image{height:200px;-o-object-fit:cover;object-fit:cover;width:100%}.stores-dropdown__store-details{flex-basis:20%}.stores-dropdown__title{font-family:El Messiri}.stores-dropdown__main-title,.stores-dropdown__title{font-size:16px;font-weight:400;letter-spacing:3px;margin-top:20px}.stores-dropdown__main-title{font-weight:700;margin-bottom:10px}.stores-dropdown__open-days{font-size:12px;font-weight:700;line-height:20px}.stores-dropdown__open-hours{font-size:12px;font-weight:400;line-height:20px}.stores-dropdown__queries-title{font-family:El Messiri;font-size:16px;font-weight:400;letter-spacing:3px}.stores-dropdown__contact-details{font-size:16px;font-weight:700}.stores-dropdown__view-more{cursor:pointer;font-size:14px;font-weight:400;margin-top:10px;text-transform:capitalize}.dropdown{display:flex;justify-content:space-between;margin-left:auto;margin-right:auto;max-width:1280px;min-height:500px;overflow-x:auto;padding:20px 0}.dropdown__errors{align-items:center;color:red;display:flex;font-size:16px;justify-content:center;min-height:300px}.dropdown__column{flex:1;padding-left:12px}.dropdown__column:nth-child(2){flex:2}.dropdown__title{font-family:El Messiri;font-size:16px;font-weight:700;letter-spacing:3px;line-height:1;margin-bottom:20px;text-transform:uppercase}.dropdown__elements{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));max-height:800px;overflow-y:auto}.dropdown__brand-elements{-moz-column-count:3;column-count:3;max-height:800px}.dropdown__brand-element{cursor:pointer;margin-bottom:10px}.dropdown__element{flex-basis:33.33%;font-family:Martel Sans;font-size:14px;font-weight:400;margin-bottom:10px;text-transform:capitalize}.cover-spinner{align-items:center;background-color:hsla(0,0%,100%,.7);display:flex;height:100%;justify-content:center;min-height:400px;position:relative;top:50%;width:100%;z-index:9999}.cover-spinner:after{animation:spin 1.5s linear infinite;border:4px dotted #000;border-radius:50%;border-top-color:transparent;content:"";display:block;height:40px;position:absolute;width:40px}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}
package/build/bundle.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('react-animate-height'), require('styled-components'), require('numeral'), 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('react-notify-toast'), require('helpers/axios'), require('axios')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'react', 'react-animate-height', 'styled-components', 'numeral', '@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', 'react-notify-toast', 'helpers/axios', 'axios'], factory) :
4
- (global = global || self, factory(global.blib = {}, global.React, global.AnimateHeight, global.styled, global.numeral, 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['react-notify-toast'], global.axiosInstance, global.axios));
5
- }(this, (function (exports, React, AnimateHeight, styled, numeral, EllipsisLoader, PageReady, stylisRuleSheet, reactDom, PropTypes, raf, AutosizeInput, reactTransitionGroup, functions, rcSlider, Notifications, axiosInstance, axios) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('react-animate-height'), require('styled-components'), require('numeral'), 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('react-notify-toast'), require('axios'), require('js-cookie')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'react', 'react-animate-height', 'styled-components', 'numeral', '@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', 'react-notify-toast', 'axios', 'js-cookie'], factory) :
4
+ (global = global || self, factory(global.blib = {}, global.React, global.AnimateHeight, global.styled, global.numeral, 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['react-notify-toast'], global.axios, global.Cookies));
5
+ }(this, (function (exports, React, AnimateHeight, styled, numeral, EllipsisLoader, PageReady, 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
  AnimateHeight = AnimateHeight && Object.prototype.hasOwnProperty.call(AnimateHeight, 'default') ? AnimateHeight['default'] : AnimateHeight;
@@ -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);
@@ -11443,6 +11443,127 @@
11443
11443
  }));
11444
11444
  });
11445
11445
 
11446
+ function getToken() {
11447
+ var _Cookies$get;
11448
+
11449
+ return (_Cookies$get = Cookies.get('_tk')) === null || _Cookies$get === void 0 ? void 0 : _Cookies$get.replace('*', 'Bearer ');
11450
+ }
11451
+ function setToken(value) {
11452
+ Cookies.set('_tk', value, 30);
11453
+ }
11454
+
11455
+ /** @format */
11456
+
11457
+ function getEncodedSearch(currentUrl) {
11458
+ var splitUrl = currentUrl.split('?');
11459
+ var baseUrl = splitUrl[0];
11460
+ var nextUrlSegments = splitUrl[1].split('&');
11461
+ var nextQueryString = splitUrl[1];
11462
+
11463
+ if (nextUrlSegments.length > 0) {
11464
+ nextQueryString = nextUrlSegments.map(function (v) {
11465
+ var nextValue = v;
11466
+
11467
+ if (v.includes('search=')) {
11468
+ var temp = v.split('=');
11469
+ nextValue = "".concat(temp[0], "=").concat(encodeURIComponent(temp[1]));
11470
+ }
11471
+
11472
+ return nextValue;
11473
+ }).join('&');
11474
+ }
11475
+
11476
+ return "".concat(baseUrl, "?").concat(nextQueryString);
11477
+ }
11478
+ /**
11479
+ * Gets an instance of Axios that is configured with the custom failure handlers
11480
+ * @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]
11481
+ * @param {Function} onForbidden - callback triggers when http status = 403
11482
+ */
11483
+
11484
+
11485
+ var axiosInstance = function axiosInstance(onAuthFailed, onForbidden) {
11486
+ var instance = axios.create({
11487
+ validateStatus: function validateStatus(status) {
11488
+ return status >= 200 && status < 300;
11489
+ }
11490
+ });
11491
+ var token = getToken();
11492
+
11493
+ if (token !== '') {
11494
+ instance.defaults.headers.common.Authorization = token;
11495
+ }
11496
+
11497
+ instance.defaults.headers.common['Content-Type'] = 'application/json;charset=UTF-8'; // Add a request interceptor
11498
+
11499
+ instance.interceptors.request.use(function (request, error) {
11500
+ if (error) {
11501
+ return Promise.reject(error.response);
11502
+ }
11503
+
11504
+ if (request.url.includes('search') && request.url.includes('?')) {
11505
+ // do some uri manipulation for ie
11506
+ // https://stackoverflow.com/questions/18220057
11507
+ // eslint-disable-next-line no-param-reassign
11508
+ request.url = getEncodedSearch(request.url);
11509
+ } // eslint-disable-next-line no-param-reassign
11510
+
11511
+
11512
+ request.headers.common['Content-Type'] = 'application/json; charset=utf-8';
11513
+
11514
+ if (typeof request.body === 'undefined') {
11515
+ request.body = {};
11516
+ }
11517
+
11518
+ token = getToken();
11519
+
11520
+ if (token !== '') {
11521
+ // eslint-disable-next-line no-param-reassign
11522
+ request.headers.common.Authorization = token;
11523
+ }
11524
+
11525
+ return request;
11526
+ }, function (error) {
11527
+ return Promise.reject(error.message);
11528
+ }); // Add a response interceptor
11529
+
11530
+ instance.interceptors.response.use(function (response, error) {
11531
+ if (error) {
11532
+ return Promise.reject(error.response);
11533
+ }
11534
+
11535
+ if (response.headers.authorization) {
11536
+ setToken(response.headers.authorization);
11537
+ }
11538
+
11539
+ return response;
11540
+ }, function (error) {
11541
+ if (error.response) {
11542
+ // network error
11543
+ 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) {
11544
+ onAuthFailed();
11545
+ } // if (error.response.status === 500) {
11546
+ // // INTERNAL SERVER ERROR
11547
+ // store.dispatch({
11548
+ // type: AppConstants.OVERLAY.SERVER_ERROR,
11549
+ // });
11550
+ // return Promise.reject(error.response);
11551
+ // }
11552
+
11553
+
11554
+ if (error.response.status === 403) {
11555
+ // FORBIDDEN
11556
+ onForbidden();
11557
+ }
11558
+
11559
+ return Promise.reject(error.response);
11560
+ }
11561
+
11562
+ return Promise.reject(error);
11563
+ });
11564
+ return instance;
11565
+ }; // NOTE: this to be instanciated with params: onAuthFailed, onForbidden
11566
+
11446
11567
  var _excluded$8 = ["children"];
11447
11568
 
11448
11569
  var DropdownSelector = function DropdownSelector(_ref) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bonlineza/luxity-lib",
3
- "version": "2.35.4",
3
+ "version": "2.35.5",
4
4
  "scripts": {
5
5
  "start": "start-storybook -p 9001 -c .storybook -s ./public",
6
6
  "clean": "rimraf ./build/*.*",
package/build/.gitignore DELETED
@@ -1,3 +0,0 @@
1
- bundle.css
2
- bundle.js
3
- constants.js
package/build/.npmignore DELETED
File without changes