@bonlineza/luxity-lib 2.35.2 → 2.36.1-beta.0

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);
@@ -9586,9 +9586,9 @@
9586
9586
  };
9587
9587
 
9588
9588
  var _templateObject$D;
9589
- var StyledHeader = styled__default.h5(_templateObject$D || (_templateObject$D = _taggedTemplateLiteral(["\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n\n @media (max-width: ", ") {\n display: block;\n }\n\n .icon-header__left {\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n\n @media (max-width: ", ") {\n align-self: flex-start;\n }\n\n svg {\n height: 1.5em;\n width: 1.5em;\n margin-right: ", ";\n }\n }\n\n .icon-header__right {\n display: flex;\n flex-grow: 1;\n justify-content: flex-end;\n }\n"])), media.sm, media.sm, function (props) {
9589
+ var StyledHeader = styled__default.h5(_templateObject$D || (_templateObject$D = _taggedTemplateLiteral(["\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n\n @media (max-width: ", ") {\n display: block;\n }\n\n .icon-header__left {\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n\n @media (max-width: ", ") {\n align-self: flex-start;\n }\n\n svg {\n height: 1.5em;\n width: 1.5em;\n margin-right: ", ";\n }\n }\n\n .icon-header__right {\n display: flex;\n flex-grow: 1;\n justify-content: flex-end;\n\n @media (max-width: ", ") {\n justify-content: flex-start;\n }\n }\n"])), media.sm, media.sm, function (props) {
9590
9590
  return props.theme.marginPaddings[1];
9591
- });
9591
+ }, media.sm);
9592
9592
 
9593
9593
  /**
9594
9594
  * IconHeader can render the standard Luxity Page/Section Header nodes with SVG
@@ -9633,7 +9633,7 @@
9633
9633
  });
9634
9634
 
9635
9635
  var _templateObject$E;
9636
- var NotifyContainer = styled__default.div(_templateObject$E || (_templateObject$E = _taggedTemplateLiteral(["\n .page-ready {\n display: flex;\n align-items: center;\n }\n\n .notification-settings {\n display: flex;\n align-items: center;\n\n @media (max-width: 768px) {\n flex-direction: column;\n align-items: flex-end;\n padding: 10px 0;\n }\n }\n\n .notification-dropdown-label {\n margin-left: 20px;\n }\n\n .loader {\n min-width: 150px;\n }\n\n .notification-dropdown-select-container {\n min-width: 110px;\n\n .notification-dropdown-select__control {\n min-height: auto;\n background-color: ", ";\n border: none;\n border-radius: 0;\n\n &--is-focused {\n border: none;\n border-radius: 0;\n box-shadow: none;\n }\n\n .notification-dropdown-select__value-container {\n & > div {\n padding: 0;\n margin: 0;\n color: ", ";\n }\n & .notification-dropdown-select__single-value,\n & .notification-dropdown-select__placeholder {\n overflow: visible;\n font-weight: lighter;\n }\n }\n }\n }\n\n .notification-dropdown-select__indicators {\n padding: 0 !important;\n .notification-dropdown-select__dropdown-indicator {\n color: ", ";\n }\n }\n\n .notification-dropdown-select__menu {\n border-radius: 0;\n\n & > .notification-dropdown-select__menu-list {\n border-radius: 0;\n\n & > .notification-dropdown-select__option {\n font-weight: bold;\n &:last-child {\n border-bottom: none;\n }\n\n &.notification-dropdown-select__option--is-focused {\n background-color: ", ";\n border-style: hidden;\n }\n &.notification-dropdown-select__option--is-selected {\n color: ", ";\n background-color: ", ";\n border-style: hidden;\n }\n &.notification-dropdown-select__option--is-selected.notification-dropdown-select__option--is-focused {\n border-style: hidden;\n }\n }\n }\n }\n"])), function (props) {
9636
+ var NotifyContainer = styled__default.div(_templateObject$E || (_templateObject$E = _taggedTemplateLiteral(["\n .page-ready {\n display: flex;\n align-items: center;\n }\n\n .notification-settings {\n display: flex;\n align-items: center;\n\n @media (max-width: ", ") {\n flex-direction: column;\n align-items: flex-end;\n padding: 10px 0;\n }\n }\n\n .notification-row-wrapper {\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n\n @media (min-width: ", ") {\n justify-content: center;\n width: auto;\n }\n }\n\n .notification-dropdown-label {\n margin-left: 20px;\n\n @media (max-width: ", ") {\n margin-left: 0;\n }\n }\n\n .loader {\n min-width: 150px;\n }\n\n .notification-dropdown-select-container {\n min-width: 110px;\n\n .notification-dropdown-select__control {\n min-height: auto;\n background-color: ", ";\n border: none;\n border-radius: 0;\n\n &--is-focused {\n border: none;\n border-radius: 0;\n box-shadow: none;\n }\n\n .notification-dropdown-select__value-container {\n & > div {\n padding: 0;\n margin: 0;\n color: ", ";\n }\n & .notification-dropdown-select__single-value,\n & .notification-dropdown-select__placeholder {\n overflow: visible;\n font-weight: lighter;\n }\n }\n }\n }\n\n .notification-dropdown-select__indicators {\n padding: 0 !important;\n .notification-dropdown-select__dropdown-indicator {\n color: ", ";\n }\n }\n\n .notification-dropdown-select__menu {\n border-radius: 0;\n\n & > .notification-dropdown-select__menu-list {\n border-radius: 0;\n\n & > .notification-dropdown-select__option {\n font-weight: bold;\n &:last-child {\n border-bottom: none;\n }\n\n &.notification-dropdown-select__option--is-focused {\n background-color: ", ";\n border-style: hidden;\n }\n &.notification-dropdown-select__option--is-selected {\n color: ", ";\n background-color: ", ";\n border-style: hidden;\n }\n &.notification-dropdown-select__option--is-selected.notification-dropdown-select__option--is-focused {\n border-style: hidden;\n }\n }\n }\n }\n"])), media.sm, media.lg, media.sm, function (props) {
9637
9637
  return props.theme.colors.ntrlMin;
9638
9638
  }, function (props) {
9639
9639
  return props.theme.colors.base;
@@ -9747,7 +9747,7 @@
9747
9747
  }, /*#__PURE__*/React__default.createElement(React.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
9748
9748
  className: "notification-settings"
9749
9749
  }, isVip && /*#__PURE__*/React__default.createElement("div", {
9750
- className: "flex justify-center items-center"
9750
+ className: "notification-row-wrapper"
9751
9751
  }, /*#__PURE__*/React__default.createElement("div", {
9752
9752
  className: "notification-dropdown-label"
9753
9753
  }, "Notify me via WhatsApp:\xA0"), updating ? /*#__PURE__*/React__default.createElement(EllipsisLoader, null) : /*#__PURE__*/React__default.createElement(index$1, {
@@ -9766,7 +9766,7 @@
9766
9766
  },
9767
9767
  value: whatsappSelectedOption
9768
9768
  })), /*#__PURE__*/React__default.createElement("div", {
9769
- className: "flex justify-center items-center"
9769
+ className: "notification-row-wrapper"
9770
9770
  }, /*#__PURE__*/React__default.createElement("div", {
9771
9771
  className: "notification-dropdown-label"
9772
9772
  }, "Notify me via Email:\xA0"), updating ? /*#__PURE__*/React__default.createElement(EllipsisLoader, null) : /*#__PURE__*/React__default.createElement(index$1, {
@@ -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/IconHeader.js CHANGED
@@ -108,9 +108,9 @@
108
108
  });
109
109
 
110
110
  var _templateObject;
111
- var StyledHeader = styled__default.h5(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n\n @media (max-width: ", ") {\n display: block;\n }\n\n .icon-header__left {\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n\n @media (max-width: ", ") {\n align-self: flex-start;\n }\n\n svg {\n height: 1.5em;\n width: 1.5em;\n margin-right: ", ";\n }\n }\n\n .icon-header__right {\n display: flex;\n flex-grow: 1;\n justify-content: flex-end;\n }\n"])), media.sm, media.sm, function (props) {
111
+ var StyledHeader = styled__default.h5(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n\n @media (max-width: ", ") {\n display: block;\n }\n\n .icon-header__left {\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n\n @media (max-width: ", ") {\n align-self: flex-start;\n }\n\n svg {\n height: 1.5em;\n width: 1.5em;\n margin-right: ", ";\n }\n }\n\n .icon-header__right {\n display: flex;\n flex-grow: 1;\n justify-content: flex-end;\n\n @media (max-width: ", ") {\n justify-content: flex-start;\n }\n }\n"])), media.sm, media.sm, function (props) {
112
112
  return props.theme.marginPaddings[1];
113
- });
113
+ }, media.sm);
114
114
 
115
115
  /**
116
116
  * IconHeader can render the standard Luxity Page/Section Header nodes with SVG
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);
@@ -810,9 +811,9 @@
810
811
  });
811
812
 
812
813
  var _templateObject;
813
- var StyledHeader = styled__default.h5(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n\n @media (max-width: ", ") {\n display: block;\n }\n\n .icon-header__left {\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n\n @media (max-width: ", ") {\n align-self: flex-start;\n }\n\n svg {\n height: 1.5em;\n width: 1.5em;\n margin-right: ", ";\n }\n }\n\n .icon-header__right {\n display: flex;\n flex-grow: 1;\n justify-content: flex-end;\n }\n"])), media.sm, media.sm, function (props) {
814
+ var StyledHeader = styled__default.h5(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n\n @media (max-width: ", ") {\n display: block;\n }\n\n .icon-header__left {\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n\n @media (max-width: ", ") {\n align-self: flex-start;\n }\n\n svg {\n height: 1.5em;\n width: 1.5em;\n margin-right: ", ";\n }\n }\n\n .icon-header__right {\n display: flex;\n flex-grow: 1;\n justify-content: flex-end;\n\n @media (max-width: ", ") {\n justify-content: flex-start;\n }\n }\n"])), media.sm, media.sm, function (props) {
814
815
  return props.theme.marginPaddings[1];
815
- });
816
+ }, media.sm);
816
817
 
817
818
  /**
818
819
  * IconHeader can render the standard Luxity Page/Section Header nodes with SVG
@@ -7525,7 +7526,7 @@
7525
7526
  var index$1 = manageState(Select);
7526
7527
 
7527
7528
  var _templateObject$1;
7528
- var NotifyContainer = styled__default.div(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteral(["\n .page-ready {\n display: flex;\n align-items: center;\n }\n\n .notification-settings {\n display: flex;\n align-items: center;\n\n @media (max-width: 768px) {\n flex-direction: column;\n align-items: flex-end;\n padding: 10px 0;\n }\n }\n\n .notification-dropdown-label {\n margin-left: 20px;\n }\n\n .loader {\n min-width: 150px;\n }\n\n .notification-dropdown-select-container {\n min-width: 110px;\n\n .notification-dropdown-select__control {\n min-height: auto;\n background-color: ", ";\n border: none;\n border-radius: 0;\n\n &--is-focused {\n border: none;\n border-radius: 0;\n box-shadow: none;\n }\n\n .notification-dropdown-select__value-container {\n & > div {\n padding: 0;\n margin: 0;\n color: ", ";\n }\n & .notification-dropdown-select__single-value,\n & .notification-dropdown-select__placeholder {\n overflow: visible;\n font-weight: lighter;\n }\n }\n }\n }\n\n .notification-dropdown-select__indicators {\n padding: 0 !important;\n .notification-dropdown-select__dropdown-indicator {\n color: ", ";\n }\n }\n\n .notification-dropdown-select__menu {\n border-radius: 0;\n\n & > .notification-dropdown-select__menu-list {\n border-radius: 0;\n\n & > .notification-dropdown-select__option {\n font-weight: bold;\n &:last-child {\n border-bottom: none;\n }\n\n &.notification-dropdown-select__option--is-focused {\n background-color: ", ";\n border-style: hidden;\n }\n &.notification-dropdown-select__option--is-selected {\n color: ", ";\n background-color: ", ";\n border-style: hidden;\n }\n &.notification-dropdown-select__option--is-selected.notification-dropdown-select__option--is-focused {\n border-style: hidden;\n }\n }\n }\n }\n"])), function (props) {
7529
+ var NotifyContainer = styled__default.div(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteral(["\n .page-ready {\n display: flex;\n align-items: center;\n }\n\n .notification-settings {\n display: flex;\n align-items: center;\n\n @media (max-width: ", ") {\n flex-direction: column;\n align-items: flex-end;\n padding: 10px 0;\n }\n }\n\n .notification-row-wrapper {\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n\n @media (min-width: ", ") {\n justify-content: center;\n width: auto;\n }\n }\n\n .notification-dropdown-label {\n margin-left: 20px;\n\n @media (max-width: ", ") {\n margin-left: 0;\n }\n }\n\n .loader {\n min-width: 150px;\n }\n\n .notification-dropdown-select-container {\n min-width: 110px;\n\n .notification-dropdown-select__control {\n min-height: auto;\n background-color: ", ";\n border: none;\n border-radius: 0;\n\n &--is-focused {\n border: none;\n border-radius: 0;\n box-shadow: none;\n }\n\n .notification-dropdown-select__value-container {\n & > div {\n padding: 0;\n margin: 0;\n color: ", ";\n }\n & .notification-dropdown-select__single-value,\n & .notification-dropdown-select__placeholder {\n overflow: visible;\n font-weight: lighter;\n }\n }\n }\n }\n\n .notification-dropdown-select__indicators {\n padding: 0 !important;\n .notification-dropdown-select__dropdown-indicator {\n color: ", ";\n }\n }\n\n .notification-dropdown-select__menu {\n border-radius: 0;\n\n & > .notification-dropdown-select__menu-list {\n border-radius: 0;\n\n & > .notification-dropdown-select__option {\n font-weight: bold;\n &:last-child {\n border-bottom: none;\n }\n\n &.notification-dropdown-select__option--is-focused {\n background-color: ", ";\n border-style: hidden;\n }\n &.notification-dropdown-select__option--is-selected {\n color: ", ";\n background-color: ", ";\n border-style: hidden;\n }\n &.notification-dropdown-select__option--is-selected.notification-dropdown-select__option--is-focused {\n border-style: hidden;\n }\n }\n }\n }\n"])), media.sm, media.lg, media.sm, function (props) {
7529
7530
  return props.theme.colors.ntrlMin;
7530
7531
  }, function (props) {
7531
7532
  return props.theme.colors.base;
@@ -7652,7 +7653,7 @@
7652
7653
  }, /*#__PURE__*/React__default.createElement(React.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
7653
7654
  className: "notification-settings"
7654
7655
  }, isVip && /*#__PURE__*/React__default.createElement("div", {
7655
- className: "flex justify-center items-center"
7656
+ className: "notification-row-wrapper"
7656
7657
  }, /*#__PURE__*/React__default.createElement("div", {
7657
7658
  className: "notification-dropdown-label"
7658
7659
  }, "Notify me via WhatsApp:\xA0"), updating ? /*#__PURE__*/React__default.createElement(EllipsisLoader, null) : /*#__PURE__*/React__default.createElement(index$1, {
@@ -7671,7 +7672,7 @@
7671
7672
  },
7672
7673
  value: whatsappSelectedOption
7673
7674
  })), /*#__PURE__*/React__default.createElement("div", {
7674
- className: "flex justify-center items-center"
7675
+ className: "notification-row-wrapper"
7675
7676
  }, /*#__PURE__*/React__default.createElement("div", {
7676
7677
  className: "notification-dropdown-label"
7677
7678
  }, "Notify me via Email:\xA0"), updating ? /*#__PURE__*/React__default.createElement(EllipsisLoader, null) : /*#__PURE__*/React__default.createElement(index$1, {
@@ -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) {