react-cookie-kit
Advanced tools
Comparing version 1.0.21 to 1.0.22
@@ -1,2 +0,2 @@ | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
@@ -9,11 +9,15 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
@@ -26,7 +30,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var BridgeCommunicator = | ||
/*#__PURE__*/ | ||
function (_React$PureComponent) { | ||
var BridgeCommunicator = /*#__PURE__*/function (_React$PureComponent) { | ||
_inherits(BridgeCommunicator, _React$PureComponent); | ||
var _super = _createSuper(BridgeCommunicator); | ||
function BridgeCommunicator(props) { | ||
@@ -37,3 +41,3 @@ var _this; | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(BridgeCommunicator).call(this, props)); // Register with XcooBee domain in iframe | ||
_this = _super.call(this, props); // Register with XcooBee domain in iframe | ||
@@ -134,3 +138,3 @@ _defineProperty(_assertThisInitialized(_this), "XcooBeeHandleResponse", function (event) { | ||
return React.createElement("iframe", { | ||
return /*#__PURE__*/React.createElement("iframe", { | ||
title: "cookieBridge", | ||
@@ -137,0 +141,0 @@ ref: function ref(frameRef) { |
@@ -1,2 +0,2 @@ | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
@@ -9,11 +9,15 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
@@ -43,3 +47,3 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var className = "xb-cookie-kit__button xb-cookie-kit__reset-button"; | ||
return React.createElement("button", { | ||
return /*#__PURE__*/React.createElement("button", { | ||
type: "button", | ||
@@ -51,7 +55,7 @@ className: className, | ||
var CookieKit = | ||
/*#__PURE__*/ | ||
function (_React$PureComponent) { | ||
var CookieKit = /*#__PURE__*/function (_React$PureComponent) { | ||
_inherits(CookieKit, _React$PureComponent); | ||
var _super = _createSuper(CookieKit); | ||
function CookieKit(props) { | ||
@@ -63,3 +67,3 @@ var _this; | ||
// console.log("CookieKit#constructor"); | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(CookieKit).call(this, props)); | ||
_this = _super.call(this, props); | ||
@@ -319,3 +323,3 @@ _defineProperty(_assertThisInitialized(_this), "handleOpen", function () { | ||
var renderResetButton = testMode; | ||
return isShown && React.createElement("div", { | ||
return isShown && /*#__PURE__*/React.createElement("div", { | ||
className: cx(BLOCK, position, { | ||
@@ -328,3 +332,3 @@ transparent: transparent | ||
}) | ||
}, renderPopup ? React.createElement(CookieKitPopup, { | ||
}, renderPopup ? /*#__PURE__*/React.createElement(CookieKitPopup, { | ||
companyLogo: companyLogo, | ||
@@ -347,9 +351,9 @@ cookieConsents: cookieConsents, | ||
theme: theme | ||
}) : React.createElement("button", { | ||
}) : /*#__PURE__*/React.createElement("button", { | ||
type: "button", | ||
className: "".concat(BLOCK, "__button ").concat(BLOCK, "__cookie-button"), | ||
onClick: this.handleOpen | ||
}, React.createElement("div", { | ||
}, /*#__PURE__*/React.createElement("div", { | ||
className: cx("".concat(BLOCK, "__cookie-icon"), "".concat(BLOCK, "__cookie-icon--").concat(animation), _defineProperty({}, "".concat(BLOCK, "__pulsing"), pulsing)) | ||
})), renderResetButton && React.createElement(ResetButton, null)); | ||
})), renderResetButton && /*#__PURE__*/React.createElement(ResetButton, null)); | ||
} | ||
@@ -356,0 +360,0 @@ }]); |
@@ -1,11 +0,15 @@ | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } | ||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -17,11 +21,15 @@ | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
@@ -35,5 +43,5 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
import cookieConsentsCache from "xcoobee-cookie-kit-core/src/cookieConsentsCache"; | ||
import { countryCodes } from "xcoobee-cookie-kit-core/src/countryData"; | ||
import { countryCodes, countryMapping } from "xcoobee-cookie-kit-core/src/countryData"; | ||
import CookieManager from "xcoobee-cookie-kit-core/src/CookieManager"; | ||
import { getCountryCode, saveCountryCode, fetchCountryCode, fetchCountryCodeForSubscribers } from "xcoobee-cookie-kit-core/src/LocaleManager"; | ||
import { getCountryCode, saveCountryCode, saveLocale, fetchCountryCode, fetchCountryCodeForSubscribers } from "xcoobee-cookie-kit-core/src/LocaleManager"; | ||
import NotAuthorizedError from "xcoobee-cookie-kit-core/src/NotAuthorizedError"; | ||
@@ -102,7 +110,7 @@ import { xckDomain } from "./configs"; | ||
var CookieKitContainer = | ||
/*#__PURE__*/ | ||
function (_React$PureComponent) { | ||
var CookieKitContainer = /*#__PURE__*/function (_React$PureComponent) { | ||
_inherits(CookieKitContainer, _React$PureComponent); | ||
var _super = _createSuper(CookieKitContainer); | ||
function CookieKitContainer(props) { | ||
@@ -114,3 +122,3 @@ var _this; | ||
// console.log("CookieKitContainer#constructor"); | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(CookieKitContainer).call(this, props)); | ||
_this = _super.call(this, props); | ||
@@ -305,3 +313,4 @@ _defineProperty(_assertThisInitialized(_this), "onLoginStatusChange", function (loginStatus) { | ||
value: function getCountryCode() { | ||
var _this2 = this; | ||
var _this2 = this, | ||
_countryMapping$defau; | ||
@@ -351,2 +360,3 @@ var _this$props = this.props, | ||
saveCountryCode(defaultCountryCode); | ||
saveLocale(((_countryMapping$defau = countryMapping[defaultCountryCode]) === null || _countryMapping$defau === void 0 ? void 0 : _countryMapping$defau.locale) || "en-us"); | ||
return Promise.resolve(defaultCountryCode); | ||
@@ -515,3 +525,3 @@ } | ||
return React.createElement(React.Fragment, null, !initializing && React.createElement(React.Fragment, null, React.createElement(CookieKit, { | ||
return /*#__PURE__*/React.createElement(React.Fragment, null, !initializing && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CookieKit, { | ||
campaignReference: campaignReference, | ||
@@ -542,3 +552,3 @@ companyLogo: companyLogo, | ||
theme: theme | ||
})), React.createElement(BridgeCommunicator, { | ||
})), /*#__PURE__*/React.createElement(BridgeCommunicator, { | ||
ref: function ref(bridgeRef) { | ||
@@ -545,0 +555,0 @@ _this4.bridgeRef = bridgeRef; |
@@ -1,2 +0,2 @@ | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
@@ -13,11 +13,15 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
@@ -41,7 +45,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var CookieKitPopup = | ||
/*#__PURE__*/ | ||
function (_React$PureComponent) { | ||
var CookieKitPopup = /*#__PURE__*/function (_React$PureComponent) { | ||
_inherits(CookieKitPopup, _React$PureComponent); | ||
var _super = _createSuper(CookieKitPopup); | ||
function CookieKitPopup(props) { | ||
@@ -53,3 +57,3 @@ var _this; | ||
// console.log('CookieKitPopup#constructor'); | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(CookieKitPopup).call(this, props)); | ||
_this = _super.call(this, props); | ||
@@ -72,7 +76,7 @@ _defineProperty(_assertThisInitialized(_this), "onMessage", function (event) { | ||
_this.setState({ | ||
selectedLocale: locale, | ||
selectedLocale: locale.code, | ||
isLocaleSelectShown: false | ||
}); | ||
saveLocale(locale); | ||
saveLocale(locale.code); | ||
}); | ||
@@ -214,3 +218,3 @@ | ||
isLocaleSelectShown: false, | ||
selectedLocale: getLocale() || "EN" | ||
selectedLocale: getLocale() || "en-us" | ||
}; | ||
@@ -256,20 +260,8 @@ window.addEventListener("message", _this.onMessage); | ||
// console.log('CookieKitPopup#renderTextMessage'); | ||
if (typeof textMessage === "string") { | ||
return textMessage; | ||
} | ||
var selectedLocale = this.state.selectedLocale; | ||
switch (selectedLocale) { | ||
case "EN": | ||
return textMessage["en-us"]; | ||
case "DE": | ||
return textMessage["de-de"] || textMessage["en-us"]; | ||
case "ES": | ||
return textMessage["es-419"] || textMessage["en-us"]; | ||
case "FR": | ||
return textMessage["fr-fr"] || textMessage["en-us"]; | ||
default: | ||
return textMessage["en-us"]; | ||
} | ||
return textMessage[selectedLocale] || textMessage["en-us"]; | ||
} | ||
@@ -325,3 +317,7 @@ }, { | ||
if (theme === "popup") { | ||
layout = // eslint-disable-next-line max-len | ||
var _locales$find; | ||
layout = | ||
/*#__PURE__*/ | ||
// eslint-disable-next-line max-len | ||
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions | ||
@@ -338,49 +334,51 @@ React.createElement("div", { | ||
tabIndex: "-1" | ||
}, React.createElement("div", { | ||
}, /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__header") | ||
}, React.createElement("div", { | ||
}, /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__logo") | ||
}, isConnected && companyLogo && React.createElement("img", { | ||
}, isConnected && companyLogo && /*#__PURE__*/React.createElement("img", { | ||
className: "".concat(BLOCK, "__company-logo"), | ||
src: companyLogo, | ||
alt: "Company logo" | ||
})), React.createElement("div", { | ||
})), /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__title") | ||
}, renderText("CookieKit.Title", selectedLocale)), React.createElement("button", { | ||
}, renderText("CookieKit.Title", selectedLocale)), /*#__PURE__*/React.createElement("button", { | ||
type: "button", | ||
className: "xb-cookie-kit__button ".concat(BLOCK, "__close-button"), | ||
onClick: onClose | ||
}, React.createElement("img", { | ||
}, /*#__PURE__*/React.createElement("img", { | ||
className: "".concat(BLOCK, "__close-button-icon"), | ||
src: closeIcon, | ||
alt: "close-icon" | ||
}))), React.createElement("div", { | ||
}))), /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__text-container") | ||
}, React.createElement("div", { | ||
}, /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__text") | ||
}, typeof textMessage === "string" ? textMessage : this.renderTextMessage(textMessage)), React.createElement("div", { | ||
}, this.renderTextMessage(textMessage)), /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__locale-container") | ||
}, React.createElement("div", { | ||
}, /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__locale") | ||
}, React.createElement("button", { | ||
}, /*#__PURE__*/React.createElement("button", { | ||
type: "button", | ||
className: "xb-cookie-kit__button ".concat(BLOCK, "__language-picker"), | ||
onClick: this.handleLocaleSelectToggle | ||
}, selectedLocale), React.createElement("div", { | ||
}, ((_locales$find = locales.find(function (locale) { | ||
return locale.code === selectedLocale; | ||
})) === null || _locales$find === void 0 ? void 0 : _locales$find.text) || "?"), /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__block ").concat(BLOCK, "__block--sm ").concat(BLOCK, "__country-picker"), | ||
title: countryCode | ||
}, React.createElement("button", { | ||
}, /*#__PURE__*/React.createElement("button", { | ||
type: "button", | ||
className: "xb-cookie-kit__button ".concat(BLOCK, "__country-picker-button"), | ||
onClick: this.handleCountrySelectToggle | ||
}, React.createElement("div", { | ||
}, /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__flag") | ||
}, React.createElement(ReactCountryFlag, { | ||
}, /*#__PURE__*/React.createElement(ReactCountryFlag, { | ||
code: countryCode, | ||
svg: true | ||
}))))), isLocaleSelectShown && React.createElement("div", { | ||
}))))), isLocaleSelectShown && /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__custom-select") | ||
}, locales.map(function (locale) { | ||
return React.createElement("button", { | ||
key: locale, | ||
return /*#__PURE__*/React.createElement("button", { | ||
key: locale.code, | ||
className: "xb-cookie-kit__button ".concat(BLOCK, "__language-picker-button"), | ||
@@ -391,7 +389,7 @@ type: "button", | ||
} | ||
}, locale); | ||
})), isCountrySelectShown && React.createElement("div", { | ||
}, locale.text); | ||
})), isCountrySelectShown && /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__country-picker-select") | ||
}, countryCodes.map(function (cCode) { | ||
return React.createElement("button", { | ||
return /*#__PURE__*/React.createElement("button", { | ||
type: "button", | ||
@@ -404,17 +402,17 @@ key: "country-flag-".concat(cCode), | ||
title: cCode | ||
}, React.createElement("div", { | ||
}, /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__flag") | ||
}, React.createElement(ReactCountryFlag, { | ||
}, /*#__PURE__*/React.createElement(ReactCountryFlag, { | ||
code: cCode, | ||
svg: true | ||
}))); | ||
})))), React.createElement("div", { | ||
})))), /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__cookie-list") | ||
}, cookieDefns.map(function (cookieDefn) { | ||
return React.createElement("div", { | ||
return /*#__PURE__*/React.createElement("div", { | ||
key: cookieDefn.type, | ||
className: "".concat(BLOCK, "__cookie") | ||
}, React.createElement("div", { | ||
}, /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__block ").concat(BLOCK, "__block--lg") | ||
}, React.createElement("div", null, React.createElement("input", { | ||
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", { | ||
id: "xbCheckbox_".concat(cookieDefn.id), | ||
@@ -429,3 +427,3 @@ type: "checkbox" // Application cookies are always checked. | ||
} | ||
}), React.createElement("label", { | ||
}), /*#__PURE__*/React.createElement("label", { | ||
htmlFor: "xbCheckbox_".concat(cookieDefn.id), | ||
@@ -435,6 +433,6 @@ className: "".concat(BLOCK, "__checkbox") // Application cookies are always disabled. | ||
disabled: cookieDefn.type === "application" | ||
})), React.createElement("div", { | ||
})), /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__consent-label"), | ||
title: renderText("CookieKit.MoreInfo", selectedLocale) | ||
}, React.createElement("a", { | ||
}, /*#__PURE__*/React.createElement("a", { | ||
className: "".concat(BLOCK, "__consent-label-link"), | ||
@@ -445,9 +443,9 @@ href: cookieDefn.url, | ||
}, renderText(cookieDefn.localeKey, selectedLocale))))); | ||
})), displayFingerprint || displayDoNotSell ? React.createElement("div", { | ||
})), displayFingerprint || displayDoNotSell ? /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__consents-container") | ||
}, displayFingerprint && React.createElement("div", { | ||
}, displayFingerprint && /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__consent ").concat(BLOCK, "__consent--fingerprint") | ||
}, React.createElement("div", { | ||
}, /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__consent-checkbox") | ||
}, React.createElement("input", { | ||
}, /*#__PURE__*/React.createElement("input", { | ||
id: "xbCheckbox_fingerprint", | ||
@@ -457,9 +455,9 @@ type: "checkbox", | ||
onChange: this.handleFingerprintCheck | ||
}), React.createElement("label", { | ||
}), /*#__PURE__*/React.createElement("label", { | ||
htmlFor: "xbCheckbox_fingerprint", | ||
className: "".concat(BLOCK, "__checkbox") | ||
})), React.createElement("div", { | ||
})), /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__consent-label"), | ||
title: renderText("CookieKit.MoreInfo", selectedLocale) | ||
}, React.createElement("a", { | ||
}, /*#__PURE__*/React.createElement("a", { | ||
className: "".concat(BLOCK, "__consent-label-link"), | ||
@@ -469,7 +467,7 @@ href: links.fingerprinting, | ||
rel: "noopener noreferrer" | ||
}, renderText("CookieKit.FingerprintLabel", selectedLocale)))), displayDoNotSell && React.createElement("div", { | ||
}, renderText("CookieKit.FingerprintLabel", selectedLocale)))), displayDoNotSell && /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__consent ").concat(BLOCK, "__consent--donotsell") | ||
}, React.createElement("div", { | ||
}, /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__consent-checkbox") | ||
}, React.createElement("input", { | ||
}, /*#__PURE__*/React.createElement("input", { | ||
id: "xbCheckbox_donotsell", | ||
@@ -479,9 +477,9 @@ type: "checkbox", | ||
onChange: this.handleDoNotSellCheck | ||
}), React.createElement("label", { | ||
}), /*#__PURE__*/React.createElement("label", { | ||
htmlFor: "xbCheckbox_donotsell", | ||
className: "".concat(BLOCK, "__checkbox") | ||
})), React.createElement("div", { | ||
})), /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__consent-label"), | ||
title: renderText("CookieKit.MoreInfo", selectedLocale) | ||
}, React.createElement("a", { | ||
}, /*#__PURE__*/React.createElement("a", { | ||
className: "".concat(BLOCK, "__consent-label-link"), | ||
@@ -491,11 +489,11 @@ href: links.donotsell, | ||
rel: "noopener noreferrer" | ||
}, renderText("CookieKit.DoNotSellLabel", selectedLocale))))) : null, consentCount > 1 && React.createElement("button", { | ||
}, renderText("CookieKit.DoNotSellLabel", selectedLocale))))) : null, consentCount > 1 && /*#__PURE__*/React.createElement("button", { | ||
type: "button", | ||
className: "xb-cookie-kit__button ".concat(BLOCK, "__check-all"), | ||
onClick: this.handleCheckAll | ||
}, isAllConsentsChecked ? renderText("CookieKit.UncheckButton", selectedLocale) : renderText("CookieKit.CheckAllButton", selectedLocale)), React.createElement("div", { | ||
}, isAllConsentsChecked ? renderText("CookieKit.UncheckButton", selectedLocale) : renderText("CookieKit.CheckAllButton", selectedLocale)), /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__actions") | ||
}, !hideBrandTag && React.createElement("div", { | ||
}, !hideBrandTag && /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__privacy-partner-container") | ||
}, React.createElement("a", { | ||
}, /*#__PURE__*/React.createElement("a", { | ||
className: "".concat(BLOCK, "__privacy-partner-link"), | ||
@@ -505,17 +503,17 @@ href: links.poweredBy, | ||
rel: "noopener noreferrer" | ||
}, React.createElement("div", { | ||
}, /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__privacy-partner") | ||
}, renderText("CookieKit.PoweredByText", selectedLocale), React.createElement("img", { | ||
}, renderText("CookieKit.PoweredByText", selectedLocale), /*#__PURE__*/React.createElement("img", { | ||
className: "".concat(BLOCK, "__privacy-partner-logo"), | ||
src: xbLogo, | ||
alt: "XcooBee logo" | ||
})))), React.createElement("div", { | ||
})))), /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__button-container") | ||
}, React.createElement("button", { | ||
}, /*#__PURE__*/React.createElement("button", { | ||
type: "button", | ||
className: "xb-cookie-kit__button ".concat(BLOCK, "__button"), | ||
onClick: this.handleSubmit | ||
}, renderText("CookieKit.OkButton", selectedLocale)))), React.createElement("div", { | ||
}, renderText("CookieKit.OkButton", selectedLocale)))), /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__links") | ||
}, isConnected && (appearsToBeLoggedIn ? React.createElement("a", { | ||
}, isConnected && (appearsToBeLoggedIn ? /*#__PURE__*/React.createElement("a", { | ||
className: "".concat(BLOCK, "__link"), | ||
@@ -525,3 +523,3 @@ href: "".concat(xbOrigin).concat(links.manage), | ||
rel: "noopener noreferrer" | ||
}, renderText("CookieKit.ManageLink", selectedLocale)) : React.createElement("button", { | ||
}, renderText("CookieKit.ManageLink", selectedLocale)) : /*#__PURE__*/React.createElement("button", { | ||
className: "xb-cookie-kit__button ".concat(BLOCK, "__link"), | ||
@@ -532,3 +530,3 @@ type: "button", | ||
} | ||
}, renderText("CookieKit.LoginLink", selectedLocale))), React.createElement("a", { | ||
}, renderText("CookieKit.LoginLink", selectedLocale))), /*#__PURE__*/React.createElement("a", { | ||
className: "".concat(BLOCK, "__link"), | ||
@@ -538,3 +536,3 @@ href: privacyUrl, | ||
rel: "noopener noreferrer" | ||
}, renderText("CookieKit.PolicyLink", selectedLocale)), React.createElement("a", { | ||
}, renderText("CookieKit.PolicyLink", selectedLocale)), /*#__PURE__*/React.createElement("a", { | ||
className: "".concat(BLOCK, "__link"), | ||
@@ -544,5 +542,5 @@ href: termsUrl, | ||
rel: "noopener noreferrer" | ||
}, renderText("CookieKit.TermsLink", selectedLocale))), !hideBrandTag && React.createElement("div", { | ||
}, renderText("CookieKit.TermsLink", selectedLocale))), !hideBrandTag && /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__powered-by") | ||
}, "Powered by", React.createElement("a", { | ||
}, "Powered by", /*#__PURE__*/React.createElement("a", { | ||
className: "".concat(BLOCK, "__powered-by-link"), | ||
@@ -554,3 +552,7 @@ href: links.poweredBy, | ||
} else { | ||
layout = // eslint-disable-next-line max-len | ||
var _locales$find2; | ||
layout = | ||
/*#__PURE__*/ | ||
// eslint-disable-next-line max-len | ||
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions | ||
@@ -567,13 +569,13 @@ React.createElement("div", { | ||
tabIndex: "-1" | ||
}, React.createElement("div", { | ||
}, /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__content") | ||
}, React.createElement("div", { | ||
}, /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__text") | ||
}, typeof textMessage === "string" ? textMessage : this.renderTextMessage(textMessage)), React.createElement("div", { | ||
}, this.renderTextMessage(textMessage)), /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__main") | ||
}, React.createElement("div", { | ||
}, /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__links-container") | ||
}, React.createElement("div", { | ||
}, /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__links") | ||
}, React.createElement("a", { | ||
}, /*#__PURE__*/React.createElement("a", { | ||
className: "".concat(BLOCK, "__link"), | ||
@@ -583,3 +585,3 @@ href: privacyUrl, | ||
rel: "noopener noreferrer" | ||
}, renderText("CookieKit.PolicyLink", selectedLocale)), React.createElement("a", { | ||
}, renderText("CookieKit.PolicyLink", selectedLocale)), /*#__PURE__*/React.createElement("a", { | ||
className: "".concat(BLOCK, "__link"), | ||
@@ -589,9 +591,9 @@ href: termsUrl, | ||
rel: "noopener noreferrer" | ||
}, renderText("CookieKit.TermsLink", selectedLocale))), React.createElement("div", { | ||
}, renderText("CookieKit.TermsLink", selectedLocale))), /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__login-container") | ||
}, !hideBrandTag ? React.createElement("div", { | ||
}, !hideBrandTag ? /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__powered-by-container") | ||
}, React.createElement("div", { | ||
}, /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__powered-by") | ||
}, "Powered by", React.createElement("a", { | ||
}, "Powered by", /*#__PURE__*/React.createElement("a", { | ||
className: "".concat(BLOCK, "__powered-by-link"), | ||
@@ -601,3 +603,3 @@ href: links.poweredBy, | ||
rel: "noopener noreferrer" | ||
}, "XcooBee"))) : React.createElement("div", null), isConnected && (appearsToBeLoggedIn ? React.createElement("a", { | ||
}, "XcooBee"))) : /*#__PURE__*/React.createElement("div", null), isConnected && (appearsToBeLoggedIn ? /*#__PURE__*/React.createElement("a", { | ||
className: "".concat(BLOCK, "__link"), | ||
@@ -607,5 +609,5 @@ href: "".concat(xbOrigin).concat(links.manage), | ||
rel: "noopener noreferrer" | ||
}, renderText("CookieKit.ManageLink", selectedLocale)) : React.createElement("div", { | ||
}, renderText("CookieKit.ManageLink", selectedLocale)) : /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__login-button") | ||
}, React.createElement("button", { | ||
}, /*#__PURE__*/React.createElement("button", { | ||
className: "xb-cookie-kit__button ".concat(BLOCK, "__link"), | ||
@@ -616,13 +618,13 @@ type: "button", | ||
} | ||
}, renderText("CookieKit.LoginLink", selectedLocale)))))), React.createElement("div", { | ||
}, renderText("CookieKit.LoginLink", selectedLocale)))))), /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__consents-container") | ||
}, React.createElement("div", { | ||
}, /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__consents-container-body") | ||
}, cookieDefns.map(function (cookieDefn) { | ||
return React.createElement("div", { | ||
return /*#__PURE__*/React.createElement("div", { | ||
key: cookieDefn.type, | ||
className: "".concat(BLOCK, "__consent ").concat(BLOCK, "__cookie") | ||
}, React.createElement("div", { | ||
}, /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__checkbox-container") | ||
}, React.createElement("input", { | ||
}, /*#__PURE__*/React.createElement("input", { | ||
id: "xbCheckbox_".concat(cookieDefn.id), | ||
@@ -637,3 +639,3 @@ type: "checkbox" // Application cookies are always checked. | ||
} | ||
}), React.createElement("label", { | ||
}), /*#__PURE__*/React.createElement("label", { | ||
htmlFor: "xbCheckbox_".concat(cookieDefn.id), | ||
@@ -643,6 +645,6 @@ className: "".concat(BLOCK, "__checkbox") // Application cookies are always disabled. | ||
disabled: cookieDefn.type === "application" | ||
})), React.createElement("div", { | ||
})), /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__consent-label"), | ||
title: renderText("CookieKit.MoreInfo", selectedLocale) | ||
}, React.createElement("a", { | ||
}, /*#__PURE__*/React.createElement("a", { | ||
className: "".concat(BLOCK, "__consent-label-link"), | ||
@@ -653,7 +655,7 @@ href: cookieDefn.url, | ||
}, renderText(cookieDefn.localeKey, selectedLocale)))); | ||
}), displayFingerprint && React.createElement("div", { | ||
}), displayFingerprint && /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__consent ").concat(BLOCK, "__fingerprint") | ||
}, React.createElement("div", { | ||
}, /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__checkbox-container ").concat(BLOCK, "__fingerprint-checkbox") | ||
}, React.createElement("input", { | ||
}, /*#__PURE__*/React.createElement("input", { | ||
id: "xbCheckbox_fingerprint", | ||
@@ -663,8 +665,8 @@ type: "checkbox", | ||
onChange: this.handleFingerprintCheck | ||
}), React.createElement("label", { | ||
}), /*#__PURE__*/React.createElement("label", { | ||
htmlFor: "xbCheckbox_fingerprint", | ||
className: "".concat(BLOCK, "__checkbox") | ||
})), React.createElement("div", { | ||
})), /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__consent-label") | ||
}, React.createElement("a", { | ||
}, /*#__PURE__*/React.createElement("a", { | ||
className: "".concat(BLOCK, "__consent-label-link"), | ||
@@ -674,7 +676,7 @@ href: links.donotsell, | ||
rel: "noopener noreferrer" | ||
}, renderText("CookieKit.FingerprintLabel", selectedLocale)))), displayDoNotSell && React.createElement("div", { | ||
}, renderText("CookieKit.FingerprintLabel", selectedLocale)))), displayDoNotSell && /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__consent ").concat(BLOCK, "__donotsell") | ||
}, React.createElement("div", { | ||
}, /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__checkbox-container ").concat(BLOCK, "__donotsell-checkbox") | ||
}, React.createElement("input", { | ||
}, /*#__PURE__*/React.createElement("input", { | ||
id: "xbCheckbox_donotsell", | ||
@@ -684,8 +686,8 @@ type: "checkbox", | ||
onChange: this.handleDoNotSellCheck | ||
}), React.createElement("label", { | ||
}), /*#__PURE__*/React.createElement("label", { | ||
htmlFor: "xbCheckbox_donotsell", | ||
className: "".concat(BLOCK, "__checkbox") | ||
})), React.createElement("div", { | ||
})), /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__consent-label") | ||
}, React.createElement("a", { | ||
}, /*#__PURE__*/React.createElement("a", { | ||
className: "".concat(BLOCK, "__consent-label-link"), | ||
@@ -695,35 +697,37 @@ href: links.donotsell, | ||
rel: "noopener noreferrer" | ||
}, renderText("CookieKit.DoNotSellLabel", selectedLocale))))), consentCount > 1 && React.createElement("div", { | ||
}, renderText("CookieKit.DoNotSellLabel", selectedLocale))))), consentCount > 1 && /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__consents-container-foot") | ||
}, React.createElement("button", { | ||
}, /*#__PURE__*/React.createElement("button", { | ||
type: "button", | ||
className: "xb-cookie-kit__button ".concat(BLOCK, "__check-all"), | ||
onClick: this.handleCheckAll | ||
}, isAllConsentsChecked ? renderText("CookieKit.UncheckButton", selectedLocale) : renderText("CookieKit.CheckAllButton", selectedLocale)))), React.createElement("div", { | ||
}, isAllConsentsChecked ? renderText("CookieKit.UncheckButton", selectedLocale) : renderText("CookieKit.CheckAllButton", selectedLocale)))), /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__button-container") | ||
}, React.createElement("button", { | ||
}, /*#__PURE__*/React.createElement("button", { | ||
type: "button", | ||
className: "xb-cookie-kit__button ".concat(BLOCK, "__button"), | ||
onClick: this.handleSubmit | ||
}, renderText("CookieKit.OkButton", selectedLocale))))), React.createElement("div", { | ||
}, renderText("CookieKit.OkButton", selectedLocale))))), /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__actions") | ||
}, React.createElement("button", { | ||
}, /*#__PURE__*/React.createElement("button", { | ||
type: "button", | ||
className: "xb-cookie-kit__button ".concat(BLOCK, "__close-button"), | ||
onClick: onClose | ||
}, React.createElement("img", { | ||
}, /*#__PURE__*/React.createElement("img", { | ||
className: "".concat(BLOCK, "__close-button-icon"), | ||
src: closeIcon, | ||
alt: "close-icon" | ||
})), React.createElement("div", { | ||
})), /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__language-picker-container") | ||
}, React.createElement("button", { | ||
}, /*#__PURE__*/React.createElement("button", { | ||
type: "button", | ||
className: "xb-cookie-kit__button ".concat(BLOCK, "__language-picker"), | ||
onClick: this.handleLocaleSelectToggle | ||
}, selectedLocale), isLocaleSelectShown && React.createElement("div", { | ||
}, ((_locales$find2 = locales.find(function (locale) { | ||
return locale.code === selectedLocale; | ||
})) === null || _locales$find2 === void 0 ? void 0 : _locales$find2.text) || "?"), isLocaleSelectShown && /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__custom-select") | ||
}, locales.map(function (locale) { | ||
return React.createElement("button", { | ||
key: locale, | ||
return /*#__PURE__*/React.createElement("button", { | ||
key: locale.code, | ||
className: "xb-cookie-kit__button ".concat(BLOCK, "__language-picker-button"), | ||
@@ -734,18 +738,18 @@ type: "button", | ||
} | ||
}, locale); | ||
}))), React.createElement("div", { | ||
}, locale.text); | ||
}))), /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__block ").concat(BLOCK, "__block--sm ").concat(BLOCK, "__country-picker"), | ||
title: countryCode | ||
}, React.createElement("button", { | ||
}, /*#__PURE__*/React.createElement("button", { | ||
type: "button", | ||
className: "xb-cookie-kit__button ".concat(BLOCK, "__country-picker-button"), | ||
onClick: this.handleCountrySelectToggle | ||
}, React.createElement("div", { | ||
}, /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__flag") | ||
}, React.createElement(ReactCountryFlag, { | ||
}, /*#__PURE__*/React.createElement(ReactCountryFlag, { | ||
code: countryCode, | ||
svg: true | ||
}))), isCountrySelectShown && React.createElement("div", { | ||
}))), isCountrySelectShown && /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__country-picker-container") | ||
}, React.createElement("button", { | ||
}, /*#__PURE__*/React.createElement("button", { | ||
type: "button", | ||
@@ -756,6 +760,6 @@ className: "xb-cookie-kit__button", | ||
} | ||
}, React.createElement("img", { | ||
}, /*#__PURE__*/React.createElement("img", { | ||
src: caretUp, | ||
alt: "caret-up" | ||
})), React.createElement("div", { | ||
})), /*#__PURE__*/React.createElement("div", { | ||
ref: function ref(countryPicker) { | ||
@@ -766,3 +770,3 @@ _this2.countryPicker = countryPicker; | ||
}, countryCodes.map(function (cCode) { | ||
return React.createElement("button", { | ||
return /*#__PURE__*/React.createElement("button", { | ||
type: "button", | ||
@@ -775,9 +779,9 @@ key: "country-flag-".concat(cCode), | ||
title: cCode | ||
}, React.createElement("div", { | ||
}, /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(BLOCK, "__flag") | ||
}, React.createElement(ReactCountryFlag, { | ||
}, /*#__PURE__*/React.createElement(ReactCountryFlag, { | ||
code: cCode, | ||
svg: true | ||
}))); | ||
})), React.createElement("button", { | ||
})), /*#__PURE__*/React.createElement("button", { | ||
type: "button", | ||
@@ -788,3 +792,3 @@ className: "xb-cookie-kit__button", | ||
} | ||
}, React.createElement("img", { | ||
}, /*#__PURE__*/React.createElement("img", { | ||
src: caretDown, | ||
@@ -791,0 +795,0 @@ alt: "caret-down" |
{ | ||
"name": "react-cookie-kit", | ||
"version": "1.0.21", | ||
"version": "1.0.22", | ||
"description": "GDPR / CCPA Easy Cookie, Script, Do-Not-Sell, and Fingerprint Consent Management for Websites.", | ||
@@ -37,3 +37,3 @@ "keywords": [ | ||
"react-country-flag": "^1.0.1", | ||
"xcoobee-cookie-kit-core": "^1.0.18" | ||
"xcoobee-cookie-kit-core": "^1.0.20" | ||
}, | ||
@@ -40,0 +40,0 @@ "devDependencies": { |
@@ -16,3 +16,3 @@ import fetch from "isomorphic-fetch"; | ||
import cookieConsentsCache from "xcoobee-cookie-kit-core/src/cookieConsentsCache"; | ||
import { countryCodes } from "xcoobee-cookie-kit-core/src/countryData"; | ||
import { countryCodes, countryMapping } from "xcoobee-cookie-kit-core/src/countryData"; | ||
@@ -23,2 +23,3 @@ import CookieManager from "xcoobee-cookie-kit-core/src/CookieManager"; | ||
saveCountryCode, | ||
saveLocale, | ||
fetchCountryCode, | ||
@@ -266,2 +267,3 @@ fetchCountryCodeForSubscribers, | ||
saveCountryCode(defaultCountryCode); | ||
saveLocale(countryMapping[defaultCountryCode]?.locale || "en-us"); | ||
@@ -268,0 +270,0 @@ return Promise.resolve(defaultCountryCode); |
@@ -87,3 +87,3 @@ import React from "react"; | ||
isLocaleSelectShown: false, | ||
selectedLocale: getLocale() || "EN", | ||
selectedLocale: getLocale() || "en-us", | ||
}; | ||
@@ -114,4 +114,4 @@ | ||
// console.log('CookieKitPopup#handleLocaleChange'); | ||
this.setState({ selectedLocale: locale, isLocaleSelectShown: false }); | ||
saveLocale(locale); | ||
this.setState({ selectedLocale: locale.code, isLocaleSelectShown: false }); | ||
saveLocale(locale.code); | ||
}; | ||
@@ -230,16 +230,10 @@ | ||
// console.log('CookieKitPopup#renderTextMessage'); | ||
if (typeof textMessage === "string") { | ||
return textMessage; | ||
} | ||
const { selectedLocale } = this.state; | ||
switch (selectedLocale) { | ||
case "EN": | ||
return textMessage["en-us"]; | ||
case "DE": | ||
return textMessage["de-de"] || textMessage["en-us"]; | ||
case "ES": | ||
return textMessage["es-419"] || textMessage["en-us"]; | ||
case "FR": | ||
return textMessage["fr-fr"] || textMessage["en-us"]; | ||
default: | ||
return textMessage["en-us"]; | ||
} | ||
return textMessage[selectedLocale] || textMessage["en-us"]; | ||
} | ||
@@ -334,4 +328,3 @@ | ||
<div className={`${BLOCK}__text`}> | ||
{ typeof textMessage === "string" | ||
? textMessage : this.renderTextMessage(textMessage) } | ||
{ this.renderTextMessage(textMessage) } | ||
</div> | ||
@@ -345,3 +338,3 @@ <div className={`${BLOCK}__locale-container`}> | ||
> | ||
{ selectedLocale } | ||
{ locales.find(locale => locale.code === selectedLocale)?.text || "?" } | ||
</button> | ||
@@ -367,3 +360,3 @@ <div | ||
<button | ||
key={locale} | ||
key={locale.code} | ||
className={`xb-cookie-kit__button ${BLOCK}__language-picker-button`} | ||
@@ -373,3 +366,3 @@ type="button" | ||
> | ||
{locale} | ||
{locale.text} | ||
</button> | ||
@@ -610,4 +603,3 @@ ))} | ||
<div className={`${BLOCK}__text`}> | ||
{ typeof textMessage === "string" | ||
? textMessage : this.renderTextMessage(textMessage) } | ||
{ this.renderTextMessage(textMessage) } | ||
</div> | ||
@@ -808,3 +800,3 @@ <div className={`${BLOCK}__main`}> | ||
> | ||
{ selectedLocale } | ||
{ locales.find(locale => locale.code === selectedLocale)?.text || "?" } | ||
</button> | ||
@@ -815,3 +807,3 @@ { isLocaleSelectShown && ( | ||
<button | ||
key={locale} | ||
key={locale.code} | ||
className={`xb-cookie-kit__button ${BLOCK}__language-picker-button`} | ||
@@ -821,3 +813,3 @@ type="button" | ||
> | ||
{locale} | ||
{locale.text} | ||
</button> | ||
@@ -824,0 +816,0 @@ ))} |
384476
4461