@bigbinary/neeto-integrations-frontend 1.0.0 → 1.1.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.
package/dist/index.js CHANGED
@@ -1,18 +1,22 @@
1
1
  import * as React from 'react';
2
2
  import React__default, { useContext, useState, useRef, useEffect } from 'react';
3
3
  import classnames from 'classnames';
4
- import { noop as noop$1, isNotEmpty } from '@bigbinary/neeto-commons-frontend/pure';
5
- import { Check, MenuVertical } from '@bigbinary/neeto-icons';
6
- import { Dropdown, Typography, Tag, Button, Modal as Modal$1 } from '@bigbinary/neetoui';
4
+ import { noop as noop$1, isNotEmpty, isNotNil } from '@bigbinary/neeto-commons-frontend/pure';
5
+ import { Check, MenuVertical, MenuHorizontal, Copy } from '@bigbinary/neeto-icons';
6
+ import { Dropdown, Typography, Tag, Button, Modal as Modal$1, Table, Alert, Callout, Spinner } from '@bigbinary/neetoui';
7
+ import { isEmpty } from 'ramda';
8
+ import { timeFormat, copyToClipboard } from '@bigbinary/neeto-commons-frontend/utils';
9
+ import { Form, Input } from '@bigbinary/neetoui/formik';
10
+ import * as Yup from 'yup';
7
11
 
8
- function _typeof$1(obj) {
12
+ function _typeof$2(obj) {
9
13
  "@babel/helpers - typeof";
10
14
 
11
- return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
15
+ return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
12
16
  return typeof obj;
13
17
  } : function (obj) {
14
18
  return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
15
- }, _typeof$1(obj);
19
+ }, _typeof$2(obj);
16
20
  }
17
21
 
18
22
  function _classCallCheck$1(instance, Constructor) {
@@ -21,20 +25,20 @@ function _classCallCheck$1(instance, Constructor) {
21
25
  }
22
26
  }
23
27
 
24
- function _toPrimitive$1(input, hint) {
25
- if (_typeof$1(input) !== "object" || input === null) return input;
28
+ function _toPrimitive$2(input, hint) {
29
+ if (_typeof$2(input) !== "object" || input === null) return input;
26
30
  var prim = input[Symbol.toPrimitive];
27
31
  if (prim !== undefined) {
28
32
  var res = prim.call(input, hint || "default");
29
- if (_typeof$1(res) !== "object") return res;
33
+ if (_typeof$2(res) !== "object") return res;
30
34
  throw new TypeError("@@toPrimitive must return a primitive value.");
31
35
  }
32
36
  return (hint === "string" ? String : Number)(input);
33
37
  }
34
38
 
35
- function _toPropertyKey$1(arg) {
36
- var key = _toPrimitive$1(arg, "string");
37
- return _typeof$1(key) === "symbol" ? key : String(key);
39
+ function _toPropertyKey$2(arg) {
40
+ var key = _toPrimitive$2(arg, "string");
41
+ return _typeof$2(key) === "symbol" ? key : String(key);
38
42
  }
39
43
 
40
44
  function _defineProperties$1(target, props) {
@@ -43,7 +47,7 @@ function _defineProperties$1(target, props) {
43
47
  descriptor.enumerable = descriptor.enumerable || false;
44
48
  descriptor.configurable = true;
45
49
  if ("value" in descriptor) descriptor.writable = true;
46
- Object.defineProperty(target, _toPropertyKey$1(descriptor.key), descriptor);
50
+ Object.defineProperty(target, _toPropertyKey$2(descriptor.key), descriptor);
47
51
  }
48
52
  }
49
53
  function _createClass$1(Constructor, protoProps, staticProps) {
@@ -88,7 +92,7 @@ function _inherits(subClass, superClass) {
88
92
  }
89
93
 
90
94
  function _possibleConstructorReturn(self, call) {
91
- if (call && (_typeof$1(call) === "object" || typeof call === "function")) {
95
+ if (call && (_typeof$2(call) === "object" || typeof call === "function")) {
92
96
  return call;
93
97
  } else if (call !== void 0) {
94
98
  throw new TypeError("Derived constructors may only return object or undefined");
@@ -103,8 +107,8 @@ function _getPrototypeOf(o) {
103
107
  return _getPrototypeOf(o);
104
108
  }
105
109
 
106
- function _defineProperty$1(obj, key, value) {
107
- key = _toPropertyKey$1(key);
110
+ function _defineProperty$2(obj, key, value) {
111
+ key = _toPropertyKey$2(key);
108
112
  if (key in obj) {
109
113
  Object.defineProperty(obj, key, {
110
114
  value: value,
@@ -118,7 +122,7 @@ function _defineProperty$1(obj, key, value) {
118
122
  return obj;
119
123
  }
120
124
 
121
- function _arrayWithHoles$1(arr) {
125
+ function _arrayWithHoles$2(arr) {
122
126
  if (Array.isArray(arr)) return arr;
123
127
  }
124
128
 
@@ -126,30 +130,30 @@ function _iterableToArray(iter) {
126
130
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
127
131
  }
128
132
 
129
- function _arrayLikeToArray$1(arr, len) {
133
+ function _arrayLikeToArray$2(arr, len) {
130
134
  if (len == null || len > arr.length) len = arr.length;
131
135
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
132
136
  return arr2;
133
137
  }
134
138
 
135
- function _unsupportedIterableToArray$1(o, minLen) {
139
+ function _unsupportedIterableToArray$2(o, minLen) {
136
140
  if (!o) return;
137
- if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
141
+ if (typeof o === "string") return _arrayLikeToArray$2(o, minLen);
138
142
  var n = Object.prototype.toString.call(o).slice(8, -1);
139
143
  if (n === "Object" && o.constructor) n = o.constructor.name;
140
144
  if (n === "Map" || n === "Set") return Array.from(o);
141
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
145
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen);
142
146
  }
143
147
 
144
- function _nonIterableRest$1() {
148
+ function _nonIterableRest$2() {
145
149
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
146
150
  }
147
151
 
148
152
  function _toArray(arr) {
149
- return _arrayWithHoles$1(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableRest$1();
153
+ return _arrayWithHoles$2(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$2(arr) || _nonIterableRest$2();
150
154
  }
151
155
 
152
- function ownKeys$2(object, enumerableOnly) {
156
+ function ownKeys$5(object, enumerableOnly) {
153
157
  var keys = Object.keys(object);
154
158
  if (Object.getOwnPropertySymbols) {
155
159
  var symbols = Object.getOwnPropertySymbols(object);
@@ -162,17 +166,17 @@ function ownKeys$2(object, enumerableOnly) {
162
166
  }
163
167
  return keys;
164
168
  }
165
- function _objectSpread$2(target) {
169
+ function _objectSpread$5(target) {
166
170
  for (var i = 1; i < arguments.length; i++) {
167
171
  var source = arguments[i] != null ? arguments[i] : {};
168
172
  if (i % 2) {
169
- ownKeys$2(Object(source), true).forEach(function (key) {
170
- _defineProperty$1(target, key, source[key]);
173
+ ownKeys$5(Object(source), true).forEach(function (key) {
174
+ _defineProperty$2(target, key, source[key]);
171
175
  });
172
176
  } else if (Object.getOwnPropertyDescriptors) {
173
177
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
174
178
  } else {
175
- ownKeys$2(Object(source)).forEach(function (key) {
179
+ ownKeys$5(Object(source)).forEach(function (key) {
176
180
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
177
181
  });
178
182
  }
@@ -256,7 +260,7 @@ var Logger = function () {
256
260
  }, {
257
261
  key: "create",
258
262
  value: function create(moduleName) {
259
- return new Logger(this.logger, _objectSpread$2(_objectSpread$2({}, {
263
+ return new Logger(this.logger, _objectSpread$5(_objectSpread$5({}, {
260
264
  prefix: "".concat(this.prefix, ":").concat(moduleName, ":")
261
265
  }), this.options));
262
266
  }
@@ -459,7 +463,7 @@ function _objectSpread$1$1(target) {
459
463
  var source = arguments[i] != null ? arguments[i] : {};
460
464
  if (i % 2) {
461
465
  ownKeys$1$1(Object(source), true).forEach(function (key) {
462
- _defineProperty$1(target, key, source[key]);
466
+ _defineProperty$2(target, key, source[key]);
463
467
  });
464
468
  } else if (Object.getOwnPropertyDescriptors) {
465
469
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
@@ -713,7 +717,7 @@ function _objectSpread$2$1(target) {
713
717
  var source = arguments[i] != null ? arguments[i] : {};
714
718
  if (i % 2) {
715
719
  ownKeys$2$1(Object(source), true).forEach(function (key) {
716
- _defineProperty$1(target, key, source[key]);
720
+ _defineProperty$2(target, key, source[key]);
717
721
  });
718
722
  } else if (Object.getOwnPropertyDescriptors) {
719
723
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
@@ -818,7 +822,7 @@ var Translator = function (_EventEmitter) {
818
822
  key: "translate",
819
823
  value: function translate(keys, options, lastKey) {
820
824
  var _this2 = this;
821
- if (_typeof$1(options) !== 'object' && this.options.overloadTranslationOptionHandler) {
825
+ if (_typeof$2(options) !== 'object' && this.options.overloadTranslationOptionHandler) {
822
826
  options = this.options.overloadTranslationOptionHandler(arguments);
823
827
  }
824
828
  if (!options) options = {};
@@ -1540,7 +1544,7 @@ var PluralResolver = function () {
1540
1544
  }]);
1541
1545
  return PluralResolver;
1542
1546
  }();
1543
- function ownKeys$3(object, enumerableOnly) {
1547
+ function ownKeys$3$1(object, enumerableOnly) {
1544
1548
  var keys = Object.keys(object);
1545
1549
  if (Object.getOwnPropertySymbols) {
1546
1550
  var symbols = Object.getOwnPropertySymbols(object);
@@ -1553,17 +1557,17 @@ function ownKeys$3(object, enumerableOnly) {
1553
1557
  }
1554
1558
  return keys;
1555
1559
  }
1556
- function _objectSpread$3(target) {
1560
+ function _objectSpread$3$1(target) {
1557
1561
  for (var i = 1; i < arguments.length; i++) {
1558
1562
  var source = arguments[i] != null ? arguments[i] : {};
1559
1563
  if (i % 2) {
1560
- ownKeys$3(Object(source), true).forEach(function (key) {
1561
- _defineProperty$1(target, key, source[key]);
1564
+ ownKeys$3$1(Object(source), true).forEach(function (key) {
1565
+ _defineProperty$2(target, key, source[key]);
1562
1566
  });
1563
1567
  } else if (Object.getOwnPropertyDescriptors) {
1564
1568
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
1565
1569
  } else {
1566
- ownKeys$3(Object(source)).forEach(function (key) {
1570
+ ownKeys$3$1(Object(source)).forEach(function (key) {
1567
1571
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1568
1572
  });
1569
1573
  }
@@ -1633,14 +1637,14 @@ var Interpolator = function () {
1633
1637
  var handleFormat = function handleFormat(key) {
1634
1638
  if (key.indexOf(_this.formatSeparator) < 0) {
1635
1639
  var path = getPathWithDefaults(data, defaultData, key);
1636
- return _this.alwaysFormat ? _this.format(path, undefined, lng, _objectSpread$3(_objectSpread$3(_objectSpread$3({}, options), data), {}, {
1640
+ return _this.alwaysFormat ? _this.format(path, undefined, lng, _objectSpread$3$1(_objectSpread$3$1(_objectSpread$3$1({}, options), data), {}, {
1637
1641
  interpolationkey: key
1638
1642
  })) : path;
1639
1643
  }
1640
1644
  var p = key.split(_this.formatSeparator);
1641
1645
  var k = p.shift().trim();
1642
1646
  var f = p.join(_this.formatSeparator).trim();
1643
- return _this.format(getPathWithDefaults(data, defaultData, k), f, lng, _objectSpread$3(_objectSpread$3(_objectSpread$3({}, options), data), {}, {
1647
+ return _this.format(getPathWithDefaults(data, defaultData, k), f, lng, _objectSpread$3$1(_objectSpread$3$1(_objectSpread$3$1({}, options), data), {}, {
1644
1648
  interpolationkey: k
1645
1649
  }));
1646
1650
  };
@@ -1702,7 +1706,7 @@ var Interpolator = function () {
1702
1706
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1703
1707
  var match;
1704
1708
  var value;
1705
- var clonedOptions = _objectSpread$3({}, options);
1709
+ var clonedOptions = _objectSpread$3$1({}, options);
1706
1710
  clonedOptions.applyPostProcessor = false;
1707
1711
  delete clonedOptions.defaultValue;
1708
1712
  function handleHasOptions(key, inheritedOptions) {
@@ -1715,7 +1719,7 @@ var Interpolator = function () {
1715
1719
  optionsString = optionsString.replace(/'/g, '"');
1716
1720
  try {
1717
1721
  clonedOptions = JSON.parse(optionsString);
1718
- if (inheritedOptions) clonedOptions = _objectSpread$3(_objectSpread$3({}, inheritedOptions), clonedOptions);
1722
+ if (inheritedOptions) clonedOptions = _objectSpread$3$1(_objectSpread$3$1({}, inheritedOptions), clonedOptions);
1719
1723
  } catch (e) {
1720
1724
  this.logger.warn("failed parsing options string in nesting for key ".concat(key), e);
1721
1725
  return "".concat(key).concat(sep).concat(optionsString);
@@ -1743,7 +1747,7 @@ var Interpolator = function () {
1743
1747
  }
1744
1748
  if (doReduce) {
1745
1749
  value = formatters.reduce(function (v, f) {
1746
- return _this2.format(v, f, options.lng, _objectSpread$3(_objectSpread$3({}, options), {}, {
1750
+ return _this2.format(v, f, options.lng, _objectSpread$3$1(_objectSpread$3$1({}, options), {}, {
1747
1751
  interpolationkey: match[1].trim()
1748
1752
  }));
1749
1753
  }, value.trim());
@@ -1756,7 +1760,7 @@ var Interpolator = function () {
1756
1760
  }]);
1757
1761
  return Interpolator;
1758
1762
  }();
1759
- function ownKeys$4(object, enumerableOnly) {
1763
+ function ownKeys$4$1(object, enumerableOnly) {
1760
1764
  var keys = Object.keys(object);
1761
1765
  if (Object.getOwnPropertySymbols) {
1762
1766
  var symbols = Object.getOwnPropertySymbols(object);
@@ -1769,17 +1773,17 @@ function ownKeys$4(object, enumerableOnly) {
1769
1773
  }
1770
1774
  return keys;
1771
1775
  }
1772
- function _objectSpread$4(target) {
1776
+ function _objectSpread$4$1(target) {
1773
1777
  for (var i = 1; i < arguments.length; i++) {
1774
1778
  var source = arguments[i] != null ? arguments[i] : {};
1775
1779
  if (i % 2) {
1776
- ownKeys$4(Object(source), true).forEach(function (key) {
1777
- _defineProperty$1(target, key, source[key]);
1780
+ ownKeys$4$1(Object(source), true).forEach(function (key) {
1781
+ _defineProperty$2(target, key, source[key]);
1778
1782
  });
1779
1783
  } else if (Object.getOwnPropertyDescriptors) {
1780
1784
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
1781
1785
  } else {
1782
- ownKeys$4(Object(source)).forEach(function (key) {
1786
+ ownKeys$4$1(Object(source)).forEach(function (key) {
1783
1787
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1784
1788
  });
1785
1789
  }
@@ -1829,18 +1833,18 @@ var Formatter = function () {
1829
1833
  return new Intl.NumberFormat(lng, options).format(val);
1830
1834
  },
1831
1835
  currency: function currency(val, lng, options) {
1832
- return new Intl.NumberFormat(lng, _objectSpread$4(_objectSpread$4({}, options), {}, {
1836
+ return new Intl.NumberFormat(lng, _objectSpread$4$1(_objectSpread$4$1({}, options), {}, {
1833
1837
  style: 'currency'
1834
1838
  })).format(val);
1835
1839
  },
1836
1840
  datetime: function datetime(val, lng, options) {
1837
- return new Intl.DateTimeFormat(lng, _objectSpread$4({}, options)).format(val);
1841
+ return new Intl.DateTimeFormat(lng, _objectSpread$4$1({}, options)).format(val);
1838
1842
  },
1839
1843
  relativetime: function relativetime(val, lng, options) {
1840
- return new Intl.RelativeTimeFormat(lng, _objectSpread$4({}, options)).format(val, options.range || 'day');
1844
+ return new Intl.RelativeTimeFormat(lng, _objectSpread$4$1({}, options)).format(val, options.range || 'day');
1841
1845
  },
1842
1846
  list: function list(val, lng, options) {
1843
- return new Intl.ListFormat(lng, _objectSpread$4({}, options)).format(val);
1847
+ return new Intl.ListFormat(lng, _objectSpread$4$1({}, options)).format(val);
1844
1848
  }
1845
1849
  };
1846
1850
  this.init(options);
@@ -1873,7 +1877,7 @@ var Formatter = function () {
1873
1877
  try {
1874
1878
  var valOptions = options && options.formatParams && options.formatParams[options.interpolationkey] || {};
1875
1879
  var l = valOptions.locale || valOptions.lng || options.locale || options.lng || lng;
1876
- formatted = _this.formats[formatName](mem, l, _objectSpread$4(_objectSpread$4(_objectSpread$4({}, formatOptions), options), valOptions));
1880
+ formatted = _this.formats[formatName](mem, l, _objectSpread$4$1(_objectSpread$4$1(_objectSpread$4$1({}, formatOptions), options), valOptions));
1877
1881
  } catch (error) {
1878
1882
  _this.logger.warn(error);
1879
1883
  }
@@ -1888,7 +1892,7 @@ var Formatter = function () {
1888
1892
  }]);
1889
1893
  return Formatter;
1890
1894
  }();
1891
- function ownKeys$5(object, enumerableOnly) {
1895
+ function ownKeys$5$1(object, enumerableOnly) {
1892
1896
  var keys = Object.keys(object);
1893
1897
  if (Object.getOwnPropertySymbols) {
1894
1898
  var symbols = Object.getOwnPropertySymbols(object);
@@ -1901,17 +1905,17 @@ function ownKeys$5(object, enumerableOnly) {
1901
1905
  }
1902
1906
  return keys;
1903
1907
  }
1904
- function _objectSpread$5(target) {
1908
+ function _objectSpread$5$1(target) {
1905
1909
  for (var i = 1; i < arguments.length; i++) {
1906
1910
  var source = arguments[i] != null ? arguments[i] : {};
1907
1911
  if (i % 2) {
1908
- ownKeys$5(Object(source), true).forEach(function (key) {
1909
- _defineProperty$1(target, key, source[key]);
1912
+ ownKeys$5$1(Object(source), true).forEach(function (key) {
1913
+ _defineProperty$2(target, key, source[key]);
1910
1914
  });
1911
1915
  } else if (Object.getOwnPropertyDescriptors) {
1912
1916
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
1913
1917
  } else {
1914
- ownKeys$5(Object(source)).forEach(function (key) {
1918
+ ownKeys$5$1(Object(source)).forEach(function (key) {
1915
1919
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1916
1920
  });
1917
1921
  }
@@ -2128,7 +2132,7 @@ var Connector = function (_EventEmitter) {
2128
2132
  }
2129
2133
  if (key === undefined || key === null || key === '') return;
2130
2134
  if (this.backend && this.backend.create) {
2131
- this.backend.create(languages, namespace, key, fallbackValue, null, _objectSpread$5(_objectSpread$5({}, options), {}, {
2135
+ this.backend.create(languages, namespace, key, fallbackValue, null, _objectSpread$5$1(_objectSpread$5$1({}, options), {}, {
2132
2136
  isUpdate: isUpdate
2133
2137
  }));
2134
2138
  }
@@ -2174,10 +2178,10 @@ function get() {
2174
2178
  appendNamespaceToCIMode: false,
2175
2179
  overloadTranslationOptionHandler: function handle(args) {
2176
2180
  var ret = {};
2177
- if (_typeof$1(args[1]) === 'object') ret = args[1];
2181
+ if (_typeof$2(args[1]) === 'object') ret = args[1];
2178
2182
  if (typeof args[1] === 'string') ret.defaultValue = args[1];
2179
2183
  if (typeof args[2] === 'string') ret.tDescription = args[2];
2180
- if (_typeof$1(args[2]) === 'object' || _typeof$1(args[3]) === 'object') {
2184
+ if (_typeof$2(args[2]) === 'object' || _typeof$2(args[3]) === 'object') {
2181
2185
  var options = args[3] || args[2];
2182
2186
  Object.keys(options).forEach(function (key) {
2183
2187
  ret[key] = options[key];
@@ -2229,7 +2233,7 @@ function _objectSpread$6(target) {
2229
2233
  var source = arguments[i] != null ? arguments[i] : {};
2230
2234
  if (i % 2) {
2231
2235
  ownKeys$6(Object(source), true).forEach(function (key) {
2232
- _defineProperty$1(target, key, source[key]);
2236
+ _defineProperty$2(target, key, source[key]);
2233
2237
  });
2234
2238
  } else if (Object.getOwnPropertyDescriptors) {
2235
2239
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
@@ -2593,7 +2597,7 @@ var I18n = function (_EventEmitter) {
2593
2597
  var _this5 = this;
2594
2598
  var fixedT = function fixedT(key, opts) {
2595
2599
  var options;
2596
- if (_typeof$1(opts) !== 'object') {
2600
+ if (_typeof$2(opts) !== 'object') {
2597
2601
  for (var _len3 = arguments.length, rest = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
2598
2602
  rest[_key3 - 2] = arguments[_key3];
2599
2603
  }
@@ -2757,7 +2761,7 @@ var I18n = function (_EventEmitter) {
2757
2761
  }]);
2758
2762
  return I18n;
2759
2763
  }(EventEmitter);
2760
- _defineProperty$1(I18n, "createInstance", function () {
2764
+ _defineProperty$2(I18n, "createInstance", function () {
2761
2765
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2762
2766
  var callback = arguments.length > 1 ? arguments[1] : undefined;
2763
2767
  return new I18n(options, callback);
@@ -2778,34 +2782,63 @@ instance.hasLoadedNamespace;
2778
2782
  instance.loadNamespaces;
2779
2783
  instance.loadLanguages;
2780
2784
 
2781
- function _typeof(obj) {
2785
+ function _objectWithoutPropertiesLoose(source, excluded) {
2786
+ if (source == null) return {};
2787
+ var target = {};
2788
+ var sourceKeys = Object.keys(source);
2789
+ var key, i;
2790
+ for (i = 0; i < sourceKeys.length; i++) {
2791
+ key = sourceKeys[i];
2792
+ if (excluded.indexOf(key) >= 0) continue;
2793
+ target[key] = source[key];
2794
+ }
2795
+ return target;
2796
+ }
2797
+
2798
+ function _objectWithoutProperties(source, excluded) {
2799
+ if (source == null) return {};
2800
+ var target = _objectWithoutPropertiesLoose(source, excluded);
2801
+ var key, i;
2802
+ if (Object.getOwnPropertySymbols) {
2803
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
2804
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
2805
+ key = sourceSymbolKeys[i];
2806
+ if (excluded.indexOf(key) >= 0) continue;
2807
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
2808
+ target[key] = source[key];
2809
+ }
2810
+ }
2811
+ return target;
2812
+ }
2813
+
2814
+ function _typeof$1(obj) {
2782
2815
  "@babel/helpers - typeof";
2783
2816
 
2784
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
2817
+ return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
2785
2818
  return typeof obj;
2786
2819
  } : function (obj) {
2787
2820
  return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
2788
- }, _typeof(obj);
2821
+ }, _typeof$1(obj);
2789
2822
  }
2790
2823
 
2791
- function _toPrimitive(input, hint) {
2792
- if (_typeof(input) !== "object" || input === null) return input;
2824
+ function _toPrimitive$1(input, hint) {
2825
+ if (_typeof$1(input) !== "object" || input === null) return input;
2793
2826
  var prim = input[Symbol.toPrimitive];
2794
2827
  if (prim !== undefined) {
2795
2828
  var res = prim.call(input, hint || "default");
2796
- if (_typeof(res) !== "object") return res;
2829
+ if (_typeof$1(res) !== "object") return res;
2797
2830
  throw new TypeError("@@toPrimitive must return a primitive value.");
2798
2831
  }
2799
2832
  return (hint === "string" ? String : Number)(input);
2800
2833
  }
2801
2834
 
2802
- function _toPropertyKey(arg) {
2803
- var key = _toPrimitive(arg, "string");
2804
- return _typeof(key) === "symbol" ? key : String(key);
2835
+ function _toPropertyKey$1(arg) {
2836
+ var key = _toPrimitive$1(arg, "string");
2837
+ return _typeof$1(key) === "symbol" ? key : String(key);
2805
2838
  }
2806
2839
 
2807
- function _defineProperty(obj, key, value) {
2808
- key = _toPropertyKey(key);
2840
+ function _defineProperty$1(obj, key, value) {
2841
+ key = _toPropertyKey$1(key);
2809
2842
  if (key in obj) {
2810
2843
  Object.defineProperty(obj, key, {
2811
2844
  value: value,
@@ -2819,6 +2852,161 @@ function _defineProperty(obj, key, value) {
2819
2852
  return obj;
2820
2853
  }
2821
2854
 
2855
+ /**
2856
+ * This file automatically generated from `pre-publish.js`.
2857
+ * Do not manually edit.
2858
+ */
2859
+ var voidElements = {
2860
+ "area": true,
2861
+ "base": true,
2862
+ "br": true,
2863
+ "col": true,
2864
+ "embed": true,
2865
+ "hr": true,
2866
+ "img": true,
2867
+ "input": true,
2868
+ "link": true,
2869
+ "meta": true,
2870
+ "param": true,
2871
+ "source": true,
2872
+ "track": true,
2873
+ "wbr": true
2874
+ };
2875
+
2876
+ var t$1 = /\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;
2877
+ function n$1(n) {
2878
+ var r = {
2879
+ type: "tag",
2880
+ name: "",
2881
+ voidElement: !1,
2882
+ attrs: {},
2883
+ children: []
2884
+ },
2885
+ i = n.match(/<\/?([^\s]+?)[/\s>]/);
2886
+ if (i && (r.name = i[1], (voidElements[i[1]] || "/" === n.charAt(n.length - 2)) && (r.voidElement = !0), r.name.startsWith("!--"))) {
2887
+ var s = n.indexOf("--\x3e");
2888
+ return {
2889
+ type: "comment",
2890
+ comment: -1 !== s ? n.slice(4, s) : ""
2891
+ };
2892
+ }
2893
+ for (var a = new RegExp(t$1), c = null; null !== (c = a.exec(n));) if (c[0].trim()) if (c[1]) {
2894
+ var o = c[1].trim(),
2895
+ l = [o, ""];
2896
+ o.indexOf("=") > -1 && (l = o.split("=")), r.attrs[l[0]] = l[1], a.lastIndex--;
2897
+ } else c[2] && (r.attrs[c[2]] = c[3].trim().substring(1, c[3].length - 1));
2898
+ return r;
2899
+ }
2900
+ var r = /<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,
2901
+ i = /^\s*$/,
2902
+ s = Object.create(null);
2903
+ function a(e, t) {
2904
+ switch (t.type) {
2905
+ case "text":
2906
+ return e + t.content;
2907
+ case "tag":
2908
+ return e += "<" + t.name + (t.attrs ? function (e) {
2909
+ var t = [];
2910
+ for (var n in e) t.push(n + '="' + e[n] + '"');
2911
+ return t.length ? " " + t.join(" ") : "";
2912
+ }(t.attrs) : "") + (t.voidElement ? "/>" : ">"), t.voidElement ? e : e + t.children.reduce(a, "") + "</" + t.name + ">";
2913
+ case "comment":
2914
+ return e + "\x3c!--" + t.comment + "--\x3e";
2915
+ }
2916
+ }
2917
+ var c = {
2918
+ parse: function parse(e, t) {
2919
+ t || (t = {}), t.components || (t.components = s);
2920
+ var a,
2921
+ c = [],
2922
+ o = [],
2923
+ l = -1,
2924
+ m = !1;
2925
+ if (0 !== e.indexOf("<")) {
2926
+ var u = e.indexOf("<");
2927
+ c.push({
2928
+ type: "text",
2929
+ content: -1 === u ? e : e.substring(0, u)
2930
+ });
2931
+ }
2932
+ return e.replace(r, function (r, s) {
2933
+ if (m) {
2934
+ if (r !== "</" + a.name + ">") return;
2935
+ m = !1;
2936
+ }
2937
+ var u,
2938
+ f = "/" !== r.charAt(1),
2939
+ h = r.startsWith("\x3c!--"),
2940
+ p = s + r.length,
2941
+ d = e.charAt(p);
2942
+ if (h) {
2943
+ var v = n$1(r);
2944
+ return l < 0 ? (c.push(v), c) : ((u = o[l]).children.push(v), c);
2945
+ }
2946
+ if (f && (l++, "tag" === (a = n$1(r)).type && t.components[a.name] && (a.type = "component", m = !0), a.voidElement || m || !d || "<" === d || a.children.push({
2947
+ type: "text",
2948
+ content: e.slice(p, e.indexOf("<", p))
2949
+ }), 0 === l && c.push(a), (u = o[l - 1]) && u.children.push(a), o[l] = a), (!f || a.voidElement) && (l > -1 && (a.voidElement || a.name === r.slice(2, -1)) && (l--, a = -1 === l ? c : o[l]), !m && "<" !== d && d)) {
2950
+ u = -1 === l ? c : o[l].children;
2951
+ var x = e.indexOf("<", p),
2952
+ g = e.slice(p, -1 === x ? void 0 : x);
2953
+ i.test(g) && (g = " "), (x > -1 && l + u.length >= 0 || " " !== g) && u.push({
2954
+ type: "text",
2955
+ content: g
2956
+ });
2957
+ }
2958
+ }), c;
2959
+ },
2960
+ stringify: function stringify(e) {
2961
+ return e.reduce(function (e, t) {
2962
+ return e + a("", t);
2963
+ }, "");
2964
+ }
2965
+ };
2966
+
2967
+ /**
2968
+ * Copyright (C) 2017-present by Andrea Giammarchi - @WebReflection
2969
+ *
2970
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
2971
+ * of this software and associated documentation files (the "Software"), to deal
2972
+ * in the Software without restriction, including without limitation the rights
2973
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2974
+ * copies of the Software, and to permit persons to whom the Software is
2975
+ * furnished to do so, subject to the following conditions:
2976
+ *
2977
+ * The above copyright notice and this permission notice shall be included in
2978
+ * all copies or substantial portions of the Software.
2979
+ *
2980
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2981
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2982
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2983
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2984
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2985
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2986
+ * THE SOFTWARE.
2987
+ */
2988
+
2989
+ var replace = ''.replace;
2990
+ var es = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34);/g;
2991
+ var unes = {
2992
+ '&amp;': '&',
2993
+ '&#38;': '&',
2994
+ '&lt;': '<',
2995
+ '&#60;': '<',
2996
+ '&gt;': '>',
2997
+ '&#62;': '>',
2998
+ '&apos;': "'",
2999
+ '&#39;': "'",
3000
+ '&quot;': '"',
3001
+ '&#34;': '"'
3002
+ };
3003
+ function unescape(un) {
3004
+ return replace.call(un, es, cape);
3005
+ }
3006
+ function cape(m) {
3007
+ return unes[m];
3008
+ }
3009
+
2822
3010
  function _classCallCheck(instance, Constructor) {
2823
3011
  if (!(instance instanceof Constructor)) {
2824
3012
  throw new TypeError("Cannot call a class as a function");
@@ -2831,7 +3019,7 @@ function _defineProperties(target, props) {
2831
3019
  descriptor.enumerable = descriptor.enumerable || false;
2832
3020
  descriptor.configurable = true;
2833
3021
  if ("value" in descriptor) descriptor.writable = true;
2834
- Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
3022
+ Object.defineProperty(target, _toPropertyKey$1(descriptor.key), descriptor);
2835
3023
  }
2836
3024
  }
2837
3025
  function _createClass(Constructor, protoProps, staticProps) {
@@ -2843,7 +3031,7 @@ function _createClass(Constructor, protoProps, staticProps) {
2843
3031
  return Constructor;
2844
3032
  }
2845
3033
 
2846
- function ownKeys$1(object, enumerableOnly) {
3034
+ function ownKeys$4(object, enumerableOnly) {
2847
3035
  var keys = Object.keys(object);
2848
3036
  if (Object.getOwnPropertySymbols) {
2849
3037
  var symbols = Object.getOwnPropertySymbols(object);
@@ -2856,17 +3044,17 @@ function ownKeys$1(object, enumerableOnly) {
2856
3044
  }
2857
3045
  return keys;
2858
3046
  }
2859
- function _objectSpread$1(target) {
3047
+ function _objectSpread$4(target) {
2860
3048
  for (var i = 1; i < arguments.length; i++) {
2861
3049
  var source = arguments[i] != null ? arguments[i] : {};
2862
3050
  if (i % 2) {
2863
- ownKeys$1(Object(source), true).forEach(function (key) {
2864
- _defineProperty(target, key, source[key]);
3051
+ ownKeys$4(Object(source), true).forEach(function (key) {
3052
+ _defineProperty$1(target, key, source[key]);
2865
3053
  });
2866
3054
  } else if (Object.getOwnPropertyDescriptors) {
2867
3055
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2868
3056
  } else {
2869
- ownKeys$1(Object(source)).forEach(function (key) {
3057
+ ownKeys$4(Object(source)).forEach(function (key) {
2870
3058
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2871
3059
  });
2872
3060
  }
@@ -2886,7 +3074,7 @@ var i18nInstance;
2886
3074
  var I18nContext = /*#__PURE__*/React__default.createContext();
2887
3075
  function setDefaults() {
2888
3076
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2889
- defaultOptions = _objectSpread$1(_objectSpread$1({}, defaultOptions), options);
3077
+ defaultOptions = _objectSpread$4(_objectSpread$4({}, defaultOptions), options);
2890
3078
  }
2891
3079
  function getDefaults() {
2892
3080
  return defaultOptions;
@@ -2993,11 +3181,268 @@ function hasLoadedNamespace(ns, i18n) {
2993
3181
  });
2994
3182
  }
2995
3183
 
2996
- function _arrayWithHoles(arr) {
3184
+ var _excluded = ["format"],
3185
+ _excluded2 = ["children", "count", "parent", "i18nKey", "context", "tOptions", "values", "defaults", "components", "ns", "i18n", "t", "shouldUnescape"];
3186
+ function ownKeys$3(object, enumerableOnly) {
3187
+ var keys = Object.keys(object);
3188
+ if (Object.getOwnPropertySymbols) {
3189
+ var symbols = Object.getOwnPropertySymbols(object);
3190
+ if (enumerableOnly) {
3191
+ symbols = symbols.filter(function (sym) {
3192
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
3193
+ });
3194
+ }
3195
+ keys.push.apply(keys, symbols);
3196
+ }
3197
+ return keys;
3198
+ }
3199
+ function _objectSpread$3(target) {
3200
+ for (var i = 1; i < arguments.length; i++) {
3201
+ var source = arguments[i] != null ? arguments[i] : {};
3202
+ if (i % 2) {
3203
+ ownKeys$3(Object(source), true).forEach(function (key) {
3204
+ _defineProperty$1(target, key, source[key]);
3205
+ });
3206
+ } else if (Object.getOwnPropertyDescriptors) {
3207
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
3208
+ } else {
3209
+ ownKeys$3(Object(source)).forEach(function (key) {
3210
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
3211
+ });
3212
+ }
3213
+ }
3214
+ return target;
3215
+ }
3216
+ function hasChildren(node, checkLength) {
3217
+ if (!node) return false;
3218
+ var base = node.props ? node.props.children : node.children;
3219
+ if (checkLength) return base.length > 0;
3220
+ return !!base;
3221
+ }
3222
+ function getChildren(node) {
3223
+ if (!node) return [];
3224
+ return node && node.children ? node.children : node.props && node.props.children;
3225
+ }
3226
+ function hasValidReactChildren(children) {
3227
+ if (Object.prototype.toString.call(children) !== '[object Array]') return false;
3228
+ return children.every(function (child) {
3229
+ return /*#__PURE__*/React__default.isValidElement(child);
3230
+ });
3231
+ }
3232
+ function getAsArray(data) {
3233
+ return Array.isArray(data) ? data : [data];
3234
+ }
3235
+ function mergeProps(source, target) {
3236
+ var newTarget = _objectSpread$3({}, target);
3237
+ newTarget.props = Object.assign(source.props, target.props);
3238
+ return newTarget;
3239
+ }
3240
+ function nodesToString(children, i18nOptions) {
3241
+ if (!children) return '';
3242
+ var stringNode = '';
3243
+ var childrenArray = getAsArray(children);
3244
+ var keepArray = i18nOptions.transSupportBasicHtmlNodes && i18nOptions.transKeepBasicHtmlNodesFor ? i18nOptions.transKeepBasicHtmlNodesFor : [];
3245
+ childrenArray.forEach(function (child, childIndex) {
3246
+ if (typeof child === 'string') {
3247
+ stringNode += "".concat(child);
3248
+ } else if ( /*#__PURE__*/React__default.isValidElement(child)) {
3249
+ var childPropsCount = Object.keys(child.props).length;
3250
+ var shouldKeepChild = keepArray.indexOf(child.type) > -1;
3251
+ var childChildren = child.props.children;
3252
+ if (!childChildren && shouldKeepChild && childPropsCount === 0) {
3253
+ stringNode += "<".concat(child.type, "/>");
3254
+ } else if (!childChildren && (!shouldKeepChild || childPropsCount !== 0)) {
3255
+ stringNode += "<".concat(childIndex, "></").concat(childIndex, ">");
3256
+ } else if (child.props.i18nIsDynamicList) {
3257
+ stringNode += "<".concat(childIndex, "></").concat(childIndex, ">");
3258
+ } else if (shouldKeepChild && childPropsCount === 1 && typeof childChildren === 'string') {
3259
+ stringNode += "<".concat(child.type, ">").concat(childChildren, "</").concat(child.type, ">");
3260
+ } else {
3261
+ var content = nodesToString(childChildren, i18nOptions);
3262
+ stringNode += "<".concat(childIndex, ">").concat(content, "</").concat(childIndex, ">");
3263
+ }
3264
+ } else if (child === null) {
3265
+ warn("Trans: the passed in value is invalid - seems you passed in a null child.");
3266
+ } else if (_typeof$1(child) === 'object') {
3267
+ var format = child.format,
3268
+ clone = _objectWithoutProperties(child, _excluded);
3269
+ var keys = Object.keys(clone);
3270
+ if (keys.length === 1) {
3271
+ var value = format ? "".concat(keys[0], ", ").concat(format) : keys[0];
3272
+ stringNode += "{{".concat(value, "}}");
3273
+ } else {
3274
+ warn("react-i18next: the passed in object contained more than one variable - the object should look like {{ value, format }} where format is optional.", child);
3275
+ }
3276
+ } else {
3277
+ warn("Trans: the passed in value is invalid - seems you passed in a variable like {number} - please pass in variables for interpolation as full objects like {{number}}.", child);
3278
+ }
3279
+ });
3280
+ return stringNode;
3281
+ }
3282
+ function renderNodes(children, targetString, i18n, i18nOptions, combinedTOpts, shouldUnescape) {
3283
+ if (targetString === '') return [];
3284
+ var keepArray = i18nOptions.transKeepBasicHtmlNodesFor || [];
3285
+ var emptyChildrenButNeedsHandling = targetString && new RegExp(keepArray.join('|')).test(targetString);
3286
+ if (!children && !emptyChildrenButNeedsHandling) return [targetString];
3287
+ var data = {};
3288
+ function getData(childs) {
3289
+ var childrenArray = getAsArray(childs);
3290
+ childrenArray.forEach(function (child) {
3291
+ if (typeof child === 'string') return;
3292
+ if (hasChildren(child)) getData(getChildren(child));else if (_typeof$1(child) === 'object' && ! /*#__PURE__*/React__default.isValidElement(child)) Object.assign(data, child);
3293
+ });
3294
+ }
3295
+ getData(children);
3296
+ var ast = c.parse("<0>".concat(targetString, "</0>"));
3297
+ var opts = _objectSpread$3(_objectSpread$3({}, data), combinedTOpts);
3298
+ function renderInner(child, node, rootReactNode) {
3299
+ var childs = getChildren(child);
3300
+ var mappedChildren = mapAST(childs, node.children, rootReactNode);
3301
+ return hasValidReactChildren(childs) && mappedChildren.length === 0 ? childs : mappedChildren;
3302
+ }
3303
+ function pushTranslatedJSX(child, inner, mem, i, isVoid) {
3304
+ if (child.dummy) child.children = inner;
3305
+ mem.push( /*#__PURE__*/React__default.cloneElement(child, _objectSpread$3(_objectSpread$3({}, child.props), {}, {
3306
+ key: i
3307
+ }), isVoid ? undefined : inner));
3308
+ }
3309
+ function mapAST(reactNode, astNode, rootReactNode) {
3310
+ var reactNodes = getAsArray(reactNode);
3311
+ var astNodes = getAsArray(astNode);
3312
+ return astNodes.reduce(function (mem, node, i) {
3313
+ var translationContent = node.children && node.children[0] && node.children[0].content && i18n.services.interpolator.interpolate(node.children[0].content, opts, i18n.language);
3314
+ if (node.type === 'tag') {
3315
+ var tmp = reactNodes[parseInt(node.name, 10)];
3316
+ if (!tmp && rootReactNode.length === 1 && rootReactNode[0][node.name]) tmp = rootReactNode[0][node.name];
3317
+ if (!tmp) tmp = {};
3318
+ var child = Object.keys(node.attrs).length !== 0 ? mergeProps({
3319
+ props: node.attrs
3320
+ }, tmp) : tmp;
3321
+ var isElement = /*#__PURE__*/React__default.isValidElement(child);
3322
+ var isValidTranslationWithChildren = isElement && hasChildren(node, true) && !node.voidElement;
3323
+ var isEmptyTransWithHTML = emptyChildrenButNeedsHandling && _typeof$1(child) === 'object' && child.dummy && !isElement;
3324
+ var isKnownComponent = _typeof$1(children) === 'object' && children !== null && Object.hasOwnProperty.call(children, node.name);
3325
+ if (typeof child === 'string') {
3326
+ var value = i18n.services.interpolator.interpolate(child, opts, i18n.language);
3327
+ mem.push(value);
3328
+ } else if (hasChildren(child) || isValidTranslationWithChildren) {
3329
+ var inner = renderInner(child, node, rootReactNode);
3330
+ pushTranslatedJSX(child, inner, mem, i);
3331
+ } else if (isEmptyTransWithHTML) {
3332
+ var _inner = mapAST(reactNodes, node.children, rootReactNode);
3333
+ mem.push( /*#__PURE__*/React__default.cloneElement(child, _objectSpread$3(_objectSpread$3({}, child.props), {}, {
3334
+ key: i
3335
+ }), _inner));
3336
+ } else if (Number.isNaN(parseFloat(node.name))) {
3337
+ if (isKnownComponent) {
3338
+ var _inner2 = renderInner(child, node, rootReactNode);
3339
+ pushTranslatedJSX(child, _inner2, mem, i, node.voidElement);
3340
+ } else if (i18nOptions.transSupportBasicHtmlNodes && keepArray.indexOf(node.name) > -1) {
3341
+ if (node.voidElement) {
3342
+ mem.push( /*#__PURE__*/React__default.createElement(node.name, {
3343
+ key: "".concat(node.name, "-").concat(i)
3344
+ }));
3345
+ } else {
3346
+ var _inner3 = mapAST(reactNodes, node.children, rootReactNode);
3347
+ mem.push( /*#__PURE__*/React__default.createElement(node.name, {
3348
+ key: "".concat(node.name, "-").concat(i)
3349
+ }, _inner3));
3350
+ }
3351
+ } else if (node.voidElement) {
3352
+ mem.push("<".concat(node.name, " />"));
3353
+ } else {
3354
+ var _inner4 = mapAST(reactNodes, node.children, rootReactNode);
3355
+ mem.push("<".concat(node.name, ">").concat(_inner4, "</").concat(node.name, ">"));
3356
+ }
3357
+ } else if (_typeof$1(child) === 'object' && !isElement) {
3358
+ var content = node.children[0] ? translationContent : null;
3359
+ if (content) mem.push(content);
3360
+ } else if (node.children.length === 1 && translationContent) {
3361
+ mem.push( /*#__PURE__*/React__default.cloneElement(child, _objectSpread$3(_objectSpread$3({}, child.props), {}, {
3362
+ key: i
3363
+ }), translationContent));
3364
+ } else {
3365
+ mem.push( /*#__PURE__*/React__default.cloneElement(child, _objectSpread$3(_objectSpread$3({}, child.props), {}, {
3366
+ key: i
3367
+ })));
3368
+ }
3369
+ } else if (node.type === 'text') {
3370
+ var wrapTextNodes = i18nOptions.transWrapTextNodes;
3371
+ var _content = shouldUnescape ? unescape(i18n.services.interpolator.interpolate(node.content, opts, i18n.language)) : i18n.services.interpolator.interpolate(node.content, opts, i18n.language);
3372
+ if (wrapTextNodes) {
3373
+ mem.push( /*#__PURE__*/React__default.createElement(wrapTextNodes, {
3374
+ key: "".concat(node.name, "-").concat(i)
3375
+ }, _content));
3376
+ } else {
3377
+ mem.push(_content);
3378
+ }
3379
+ }
3380
+ return mem;
3381
+ }, []);
3382
+ }
3383
+ var result = mapAST([{
3384
+ dummy: true,
3385
+ children: children || []
3386
+ }], ast, getAsArray(children || []));
3387
+ return getChildren(result[0]);
3388
+ }
3389
+ function Trans(_ref) {
3390
+ var children = _ref.children,
3391
+ count = _ref.count,
3392
+ parent = _ref.parent,
3393
+ i18nKey = _ref.i18nKey,
3394
+ context = _ref.context,
3395
+ _ref$tOptions = _ref.tOptions,
3396
+ tOptions = _ref$tOptions === void 0 ? {} : _ref$tOptions,
3397
+ values = _ref.values,
3398
+ defaults = _ref.defaults,
3399
+ components = _ref.components,
3400
+ ns = _ref.ns,
3401
+ i18nFromProps = _ref.i18n,
3402
+ tFromProps = _ref.t,
3403
+ shouldUnescape = _ref.shouldUnescape,
3404
+ additionalProps = _objectWithoutProperties(_ref, _excluded2);
3405
+ var _ref2 = useContext(I18nContext) || {},
3406
+ i18nFromContext = _ref2.i18n,
3407
+ defaultNSFromContext = _ref2.defaultNS;
3408
+ var i18n = i18nFromProps || i18nFromContext || getI18n();
3409
+ if (!i18n) {
3410
+ warnOnce('You will need to pass in an i18next instance by using i18nextReactModule');
3411
+ return children;
3412
+ }
3413
+ var t = tFromProps || i18n.t.bind(i18n) || function (k) {
3414
+ return k;
3415
+ };
3416
+ if (context) tOptions.context = context;
3417
+ var reactI18nextOptions = _objectSpread$3(_objectSpread$3({}, getDefaults()), i18n.options && i18n.options.react);
3418
+ var namespaces = ns || t.ns || defaultNSFromContext || i18n.options && i18n.options.defaultNS;
3419
+ namespaces = typeof namespaces === 'string' ? [namespaces] : namespaces || ['translation'];
3420
+ var defaultValue = defaults || nodesToString(children, reactI18nextOptions) || reactI18nextOptions.transEmptyNodeValue || i18nKey;
3421
+ var hashTransKey = reactI18nextOptions.hashTransKey;
3422
+ var key = i18nKey || (hashTransKey ? hashTransKey(defaultValue) : defaultValue);
3423
+ var interpolationOverride = values ? tOptions.interpolation : {
3424
+ interpolation: _objectSpread$3(_objectSpread$3({}, tOptions.interpolation), {}, {
3425
+ prefix: '#$?',
3426
+ suffix: '?$#'
3427
+ })
3428
+ };
3429
+ var combinedTOpts = _objectSpread$3(_objectSpread$3(_objectSpread$3(_objectSpread$3({}, tOptions), {}, {
3430
+ count: count
3431
+ }, values), interpolationOverride), {}, {
3432
+ defaultValue: defaultValue,
3433
+ ns: namespaces
3434
+ });
3435
+ var translation = key ? t(key, combinedTOpts) : defaultValue;
3436
+ var content = renderNodes(components || children, translation, i18n, reactI18nextOptions, combinedTOpts, shouldUnescape);
3437
+ var useAsParent = parent !== undefined ? parent : reactI18nextOptions.defaultTransParent;
3438
+ return useAsParent ? /*#__PURE__*/React__default.createElement(useAsParent, additionalProps, content) : content;
3439
+ }
3440
+
3441
+ function _arrayWithHoles$1(arr) {
2997
3442
  if (Array.isArray(arr)) return arr;
2998
3443
  }
2999
3444
 
3000
- function _iterableToArrayLimit(arr, i) {
3445
+ function _iterableToArrayLimit$1(arr, i) {
3001
3446
  var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
3002
3447
  if (null != _i) {
3003
3448
  var _s,
@@ -3025,30 +3470,30 @@ function _iterableToArrayLimit(arr, i) {
3025
3470
  }
3026
3471
  }
3027
3472
 
3028
- function _arrayLikeToArray(arr, len) {
3473
+ function _arrayLikeToArray$1(arr, len) {
3029
3474
  if (len == null || len > arr.length) len = arr.length;
3030
3475
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
3031
3476
  return arr2;
3032
3477
  }
3033
3478
 
3034
- function _unsupportedIterableToArray(o, minLen) {
3479
+ function _unsupportedIterableToArray$1(o, minLen) {
3035
3480
  if (!o) return;
3036
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
3481
+ if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
3037
3482
  var n = Object.prototype.toString.call(o).slice(8, -1);
3038
3483
  if (n === "Object" && o.constructor) n = o.constructor.name;
3039
3484
  if (n === "Map" || n === "Set") return Array.from(o);
3040
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
3485
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
3041
3486
  }
3042
3487
 
3043
- function _nonIterableRest() {
3488
+ function _nonIterableRest$1() {
3044
3489
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3045
3490
  }
3046
3491
 
3047
- function _slicedToArray(arr, i) {
3048
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
3492
+ function _slicedToArray$1(arr, i) {
3493
+ return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest$1();
3049
3494
  }
3050
3495
 
3051
- function ownKeys(object, enumerableOnly) {
3496
+ function ownKeys$2(object, enumerableOnly) {
3052
3497
  var keys = Object.keys(object);
3053
3498
  if (Object.getOwnPropertySymbols) {
3054
3499
  var symbols = Object.getOwnPropertySymbols(object);
@@ -3061,17 +3506,17 @@ function ownKeys(object, enumerableOnly) {
3061
3506
  }
3062
3507
  return keys;
3063
3508
  }
3064
- function _objectSpread(target) {
3509
+ function _objectSpread$2(target) {
3065
3510
  for (var i = 1; i < arguments.length; i++) {
3066
3511
  var source = arguments[i] != null ? arguments[i] : {};
3067
3512
  if (i % 2) {
3068
- ownKeys(Object(source), true).forEach(function (key) {
3069
- _defineProperty(target, key, source[key]);
3513
+ ownKeys$2(Object(source), true).forEach(function (key) {
3514
+ _defineProperty$1(target, key, source[key]);
3070
3515
  });
3071
3516
  } else if (Object.getOwnPropertyDescriptors) {
3072
3517
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
3073
3518
  } else {
3074
- ownKeys(Object(source)).forEach(function (key) {
3519
+ ownKeys$2(Object(source)).forEach(function (key) {
3075
3520
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
3076
3521
  });
3077
3522
  }
@@ -3098,7 +3543,7 @@ function useTranslation(ns) {
3098
3543
  return retNotReady;
3099
3544
  }
3100
3545
  if (i18n.options.react && i18n.options.react.wait !== undefined) warnOnce('It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.');
3101
- var i18nOptions = _objectSpread(_objectSpread(_objectSpread({}, getDefaults()), i18n.options.react), props);
3546
+ var i18nOptions = _objectSpread$2(_objectSpread$2(_objectSpread$2({}, getDefaults()), i18n.options.react), props);
3102
3547
  var useSuspense = i18nOptions.useSuspense,
3103
3548
  keyPrefix = i18nOptions.keyPrefix;
3104
3549
  var namespaces = ns || defaultNSFromContext || i18n.options && i18n.options.defaultNS;
@@ -3111,7 +3556,7 @@ function useTranslation(ns) {
3111
3556
  return i18n.getFixedT(null, i18nOptions.nsMode === 'fallback' ? namespaces : namespaces[0], keyPrefix);
3112
3557
  }
3113
3558
  var _useState = useState(getT),
3114
- _useState2 = _slicedToArray(_useState, 2),
3559
+ _useState2 = _slicedToArray$1(_useState, 2),
3115
3560
  t = _useState2[0],
3116
3561
  setT = _useState2[1];
3117
3562
  var isMounted = useRef(true);
@@ -3165,16 +3610,37 @@ var common = {
3165
3610
  connected: "Connected",
3166
3611
  manage: "Manage",
3167
3612
  disconnect: "Disconnect",
3168
- finish: "Finish"
3613
+ finish: "Finish",
3614
+ required: "Required",
3615
+ "delete": "Delete"
3169
3616
  };
3170
3617
  var demo = {
3171
3618
  title: "Check how it behaves",
3172
3619
  subtitle: "Watch the following video to understand how you can utilize this integration:",
3173
3620
  iFrameTitle: "Watch this video to utilize the integration"
3174
3621
  };
3622
+ var zapier = {
3623
+ apiKeys: "API Keys",
3624
+ copyApiKey: "Copy API Key to Clipboard",
3625
+ emptyText: "Generate an API Key to connect to the Zapier platform",
3626
+ generateApiKey: "Generate API Key",
3627
+ labelInputPlaceholder: "Enter a Label for the new API Key",
3628
+ tableColumns: {
3629
+ createdAt: "Created At",
3630
+ label: "Label"
3631
+ },
3632
+ newApiKeyInstruction: "Here is your Zapier API Key. Make sure to copy the API Key now. It will not be made visible again.",
3633
+ tableTitle: "Previously Generated API Keys",
3634
+ deleteApiKey: {
3635
+ title: "Delete API Key?",
3636
+ message: "You are permanently deleting the API Key <strong>{{key}}</strong>. This can't be undone."
3637
+ },
3638
+ walkthroughText: "Check how it behaves"
3639
+ };
3175
3640
  var en = {
3176
3641
  common: common,
3177
- demo: demo
3642
+ demo: demo,
3643
+ zapier: zapier
3178
3644
  };
3179
3645
 
3180
3646
  instance.use(initReactI18next).init({
@@ -3191,8 +3657,8 @@ instance.use(initReactI18next).init({
3191
3657
  }
3192
3658
  });
3193
3659
 
3194
- var Menu = Dropdown.Menu,
3195
- MenuItem = Dropdown.MenuItem;
3660
+ var Menu$1 = Dropdown.Menu,
3661
+ MenuItem$1 = Dropdown.MenuItem;
3196
3662
  var Card = function Card(_ref) {
3197
3663
  var label = _ref.label,
3198
3664
  description = _ref.description,
@@ -3241,9 +3707,9 @@ var Card = function Card(_ref) {
3241
3707
  }), customDropdown || /*#__PURE__*/React__default.createElement(Dropdown, {
3242
3708
  buttonStyle: "text",
3243
3709
  icon: MenuVertical
3244
- }, /*#__PURE__*/React__default.createElement(Menu, null, /*#__PURE__*/React__default.createElement(MenuItem.Button, {
3710
+ }, /*#__PURE__*/React__default.createElement(Menu$1, null, /*#__PURE__*/React__default.createElement(MenuItem$1.Button, {
3245
3711
  onClick: onManage
3246
- }, t("common.manage")), /*#__PURE__*/React__default.createElement(MenuItem.Button, {
3712
+ }, t("common.manage")), /*#__PURE__*/React__default.createElement(MenuItem$1.Button, {
3247
3713
  onClick: onDisconnect
3248
3714
  }, t("common.disconnect"))))) : /*#__PURE__*/React__default.createElement(Button, {
3249
3715
  label: !isStatusLoading && t("common.connect"),
@@ -3555,6 +4021,8 @@ var Finish = function Finish(_ref) {
3555
4021
  onClick = _ref$onClick === void 0 ? noop$1 : _ref$onClick,
3556
4022
  _ref$title = _ref.title,
3557
4023
  title = _ref$title === void 0 ? "" : _ref$title,
4024
+ _ref$buttonProps = _ref.buttonProps,
4025
+ buttonProps = _ref$buttonProps === void 0 ? {} : _ref$buttonProps,
3558
4026
  _ref$secondaryButtonP = _ref.secondaryButtonProps,
3559
4027
  secondaryButtonProps = _ref$secondaryButtonP === void 0 ? {} : _ref$secondaryButtonP,
3560
4028
  children = _ref.children;
@@ -3568,10 +4036,10 @@ var Finish = function Finish(_ref) {
3568
4036
  weight: "semibold"
3569
4037
  }, title), children, /*#__PURE__*/React__default.createElement("div", {
3570
4038
  className: "flex w-full items-start space-x-2"
3571
- }, /*#__PURE__*/React__default.createElement(Button, {
4039
+ }, /*#__PURE__*/React__default.createElement(Button, _extends$1({
3572
4040
  label: t("common.continue"),
3573
4041
  onClick: onClick
3574
- }), isNotEmpty(secondaryButtonProps) && /*#__PURE__*/React__default.createElement(Button, _extends$1({
4042
+ }, buttonProps)), isNotEmpty(secondaryButtonProps) && /*#__PURE__*/React__default.createElement(Button, _extends$1({
3575
4043
  style: "secondary"
3576
4044
  }, secondaryButtonProps))));
3577
4045
  };
@@ -3584,12 +4052,336 @@ Finish.prototypes = {
3584
4052
  * To show the title of the Finish component
3585
4053
  */
3586
4054
  title: propTypes.exports.string,
4055
+ /**
4056
+ * To specify props for primary button
4057
+ */
4058
+ buttonProps: propTypes.exports.object,
3587
4059
  /**
3588
4060
  * To specify props for secondary button
3589
4061
  */
3590
4062
  secondaryButtonProps: propTypes.exports.object
3591
4063
  };
3592
4064
 
4065
+ function _arrayWithHoles(arr) {
4066
+ if (Array.isArray(arr)) return arr;
4067
+ }
4068
+
4069
+ function _iterableToArrayLimit(arr, i) {
4070
+ var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
4071
+ if (null != _i) {
4072
+ var _s,
4073
+ _e,
4074
+ _x,
4075
+ _r,
4076
+ _arr = [],
4077
+ _n = !0,
4078
+ _d = !1;
4079
+ try {
4080
+ if (_x = (_i = _i.call(arr)).next, 0 === i) {
4081
+ if (Object(_i) !== _i) return;
4082
+ _n = !1;
4083
+ } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
4084
+ } catch (err) {
4085
+ _d = !0, _e = err;
4086
+ } finally {
4087
+ try {
4088
+ if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
4089
+ } finally {
4090
+ if (_d) throw _e;
4091
+ }
4092
+ }
4093
+ return _arr;
4094
+ }
4095
+ }
4096
+
4097
+ function _arrayLikeToArray(arr, len) {
4098
+ if (len == null || len > arr.length) len = arr.length;
4099
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
4100
+ return arr2;
4101
+ }
4102
+
4103
+ function _unsupportedIterableToArray(o, minLen) {
4104
+ if (!o) return;
4105
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
4106
+ var n = Object.prototype.toString.call(o).slice(8, -1);
4107
+ if (n === "Object" && o.constructor) n = o.constructor.name;
4108
+ if (n === "Map" || n === "Set") return Array.from(o);
4109
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
4110
+ }
4111
+
4112
+ function _nonIterableRest() {
4113
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
4114
+ }
4115
+
4116
+ function _slicedToArray(arr, i) {
4117
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
4118
+ }
4119
+
4120
+ function _typeof(obj) {
4121
+ "@babel/helpers - typeof";
4122
+
4123
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
4124
+ return typeof obj;
4125
+ } : function (obj) {
4126
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
4127
+ }, _typeof(obj);
4128
+ }
4129
+
4130
+ function _toPrimitive(input, hint) {
4131
+ if (_typeof(input) !== "object" || input === null) return input;
4132
+ var prim = input[Symbol.toPrimitive];
4133
+ if (prim !== undefined) {
4134
+ var res = prim.call(input, hint || "default");
4135
+ if (_typeof(res) !== "object") return res;
4136
+ throw new TypeError("@@toPrimitive must return a primitive value.");
4137
+ }
4138
+ return (hint === "string" ? String : Number)(input);
4139
+ }
4140
+
4141
+ function _toPropertyKey(arg) {
4142
+ var key = _toPrimitive(arg, "string");
4143
+ return _typeof(key) === "symbol" ? key : String(key);
4144
+ }
4145
+
4146
+ function _defineProperty(obj, key, value) {
4147
+ key = _toPropertyKey(key);
4148
+ if (key in obj) {
4149
+ Object.defineProperty(obj, key, {
4150
+ value: value,
4151
+ enumerable: true,
4152
+ configurable: true,
4153
+ writable: true
4154
+ });
4155
+ } else {
4156
+ obj[key] = value;
4157
+ }
4158
+ return obj;
4159
+ }
4160
+
4161
+ var Menu = Dropdown.Menu,
4162
+ MenuItem = Dropdown.MenuItem;
4163
+ var Actions = function Actions(_ref) {
4164
+ var apiKey = _ref.apiKey,
4165
+ setApiKeyToDelete = _ref.setApiKeyToDelete;
4166
+ var _useTranslation = useTranslation(),
4167
+ t = _useTranslation.t;
4168
+ return /*#__PURE__*/React__default.createElement(Dropdown, {
4169
+ buttonStyle: "text",
4170
+ icon: MenuHorizontal,
4171
+ strategy: "fixed"
4172
+ }, /*#__PURE__*/React__default.createElement(Menu, null, /*#__PURE__*/React__default.createElement(MenuItem.Button, {
4173
+ "data-cy": "delete-apikey-button",
4174
+ onClick: function onClick() {
4175
+ return setApiKeyToDelete(apiKey);
4176
+ }
4177
+ }, t("common.delete"))));
4178
+ };
4179
+
4180
+ function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4181
+ function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4182
+ var getApiKeysTableColumnData = function getApiKeysTableColumnData() {
4183
+ return [{
4184
+ title: instance.t("zapier.tableColumns.label"),
4185
+ dataIndex: "options",
4186
+ key: "options",
4187
+ width: 272,
4188
+ render: function render(options, _ref) {
4189
+ var actions = _ref.actions;
4190
+ return /*#__PURE__*/React__default.createElement("div", {
4191
+ className: "flex items-center justify-between gap-x-3"
4192
+ }, /*#__PURE__*/React__default.createElement(Typography, {
4193
+ className: "w-4/5",
4194
+ style: "body2"
4195
+ }, options === null || options === void 0 ? void 0 : options.label), actions);
4196
+ }
4197
+ }, {
4198
+ title: instance.t("zapier.tableColumns.createdAt"),
4199
+ dataIndex: "createdAt",
4200
+ key: "createdAt"
4201
+ }];
4202
+ };
4203
+ var getApiKeysTableRowData = function getApiKeysTableRowData(_ref2) {
4204
+ var apiKeys = _ref2.apiKeys,
4205
+ setApiKeyToDelete = _ref2.setApiKeyToDelete;
4206
+ return apiKeys.map(function (apiKey) {
4207
+ return _objectSpread$1(_objectSpread$1({}, apiKey), {}, {
4208
+ createdAt: timeFormat.fromNow(apiKey.createdAt),
4209
+ actions: /*#__PURE__*/React__default.createElement(Actions, {
4210
+ apiKey: apiKey,
4211
+ setApiKeyToDelete: setApiKeyToDelete
4212
+ })
4213
+ });
4214
+ });
4215
+ };
4216
+
4217
+ var ApiKeysList = function ApiKeysList(_ref) {
4218
+ var _apiKeyToDelete$optio;
4219
+ var _ref$apiKeys = _ref.apiKeys,
4220
+ apiKeys = _ref$apiKeys === void 0 ? [] : _ref$apiKeys,
4221
+ _ref$deleteApiKey = _ref.deleteApiKey,
4222
+ deleteApiKey = _ref$deleteApiKey === void 0 ? noop$1 : _ref$deleteApiKey,
4223
+ _ref$isDeleting = _ref.isDeleting,
4224
+ isDeleting = _ref$isDeleting === void 0 ? false : _ref$isDeleting,
4225
+ _ref$setNewZapierApiK = _ref.setNewZapierApiKey,
4226
+ setNewZapierApiKey = _ref$setNewZapierApiK === void 0 ? noop$1 : _ref$setNewZapierApiK;
4227
+ var _useState = useState(null),
4228
+ _useState2 = _slicedToArray(_useState, 2),
4229
+ apiKeyToDelete = _useState2[0],
4230
+ setApiKeyToDelete = _useState2[1];
4231
+ var _useTranslation = useTranslation(),
4232
+ t = _useTranslation.t;
4233
+ var closeAlert = function closeAlert() {
4234
+ return setApiKeyToDelete(null);
4235
+ };
4236
+ var handleSubmit = function handleSubmit() {
4237
+ deleteApiKey(apiKeyToDelete === null || apiKeyToDelete === void 0 ? void 0 : apiKeyToDelete.id, {
4238
+ onSuccess: function onSuccess() {
4239
+ closeAlert();
4240
+ setNewZapierApiKey("");
4241
+ }
4242
+ });
4243
+ };
4244
+ if (isEmpty(apiKeys)) return null;
4245
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
4246
+ className: "space-y-2"
4247
+ }, /*#__PURE__*/React__default.createElement(Typography, {
4248
+ style: "h3"
4249
+ }, t("zapier.tableTitle")), /*#__PURE__*/React__default.createElement(Table, {
4250
+ fixedHeight: true,
4251
+ allowRowClick: false,
4252
+ columnData: getApiKeysTableColumnData(),
4253
+ rowData: getApiKeysTableRowData({
4254
+ apiKeys: apiKeys,
4255
+ setApiKeyToDelete: setApiKeyToDelete
4256
+ })
4257
+ })), /*#__PURE__*/React__default.createElement(Alert, {
4258
+ backdropClassName: "zapier-delete-alert",
4259
+ isOpen: isNotNil(apiKeyToDelete),
4260
+ isSubmitting: isDeleting,
4261
+ submitButtonLabel: t("common.delete"),
4262
+ title: t("zapier.deleteApiKey.title"),
4263
+ message: /*#__PURE__*/React__default.createElement(Trans, {
4264
+ i18nKey: "zapier.deleteApiKey.message",
4265
+ values: {
4266
+ key: apiKeyToDelete === null || apiKeyToDelete === void 0 ? void 0 : (_apiKeyToDelete$optio = apiKeyToDelete.options) === null || _apiKeyToDelete$optio === void 0 ? void 0 : _apiKeyToDelete$optio.label
4267
+ }
4268
+ }),
4269
+ onClose: closeAlert,
4270
+ onSubmit: handleSubmit
4271
+ }));
4272
+ };
4273
+
4274
+ var GENERATE_API_KEY_VALIDATION = Yup.object({
4275
+ label: Yup.string().required(instance.t("common.required"))
4276
+ });
4277
+ var GENERATE_API_KEY_FORMIK_PROPS = {
4278
+ initialValues: {
4279
+ label: ""
4280
+ },
4281
+ validationSchema: GENERATE_API_KEY_VALIDATION
4282
+ };
4283
+
4284
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4285
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4286
+ var GenerateKey = function GenerateKey(_ref) {
4287
+ var handleSubmit = _ref.handleSubmit,
4288
+ isLoading = _ref.isLoading;
4289
+ var _useTranslation = useTranslation(),
4290
+ t = _useTranslation.t;
4291
+ var inputRef = useRef(null);
4292
+ useEffect(function () {
4293
+ if (inputRef.current) {
4294
+ inputRef.current.focus();
4295
+ }
4296
+ }, []);
4297
+ return /*#__PURE__*/React__default.createElement(Form, {
4298
+ formikProps: _objectSpread(_objectSpread({}, GENERATE_API_KEY_FORMIK_PROPS), {}, {
4299
+ onSubmit: handleSubmit
4300
+ })
4301
+ }, /*#__PURE__*/React__default.createElement("div", {
4302
+ className: "space-y-4"
4303
+ }, /*#__PURE__*/React__default.createElement(Input, {
4304
+ name: "label",
4305
+ placeholder: t("zapier.labelInputPlaceholder"),
4306
+ ref: inputRef
4307
+ }), /*#__PURE__*/React__default.createElement(Button, {
4308
+ label: t("zapier.generateApiKey"),
4309
+ loading: isLoading,
4310
+ type: "submit"
4311
+ })));
4312
+ };
4313
+
4314
+ var NewZapierApiKey = function NewZapierApiKey(_ref) {
4315
+ var apiKey = _ref.apiKey;
4316
+ var _useTranslation = useTranslation(),
4317
+ t = _useTranslation.t;
4318
+ return /*#__PURE__*/React__default.createElement("div", {
4319
+ className: "mb-8 space-y-2"
4320
+ }, /*#__PURE__*/React__default.createElement(Callout, null, t("zapier.newApiKeyInstruction")), /*#__PURE__*/React__default.createElement(Callout, {
4321
+ className: "flex justify-between",
4322
+ style: "success"
4323
+ }, apiKey, /*#__PURE__*/React__default.createElement(Button, {
4324
+ icon: Copy,
4325
+ style: "text",
4326
+ tooltipProps: {
4327
+ content: t("zapier.copyApiKey")
4328
+ },
4329
+ onClick: function onClick() {
4330
+ return copyToClipboard(apiKey);
4331
+ }
4332
+ })));
4333
+ };
4334
+
4335
+ var ZapierForm = function ZapierForm(_ref) {
4336
+ var _ref$newZapierApiKey = _ref.newZapierApiKey,
4337
+ newZapierApiKey = _ref$newZapierApiKey === void 0 ? "" : _ref$newZapierApiKey,
4338
+ _ref$videoUrl = _ref.videoUrl,
4339
+ videoUrl = _ref$videoUrl === void 0 ? "" : _ref$videoUrl,
4340
+ _ref$zapierApiKeys = _ref.zapierApiKeys,
4341
+ zapierApiKeys = _ref$zapierApiKeys === void 0 ? [] : _ref$zapierApiKeys,
4342
+ _ref$isGenerating = _ref.isGenerating,
4343
+ isGenerating = _ref$isGenerating === void 0 ? false : _ref$isGenerating,
4344
+ _ref$isLoading = _ref.isLoading,
4345
+ isLoading = _ref$isLoading === void 0 ? true : _ref$isLoading,
4346
+ _ref$isDeleting = _ref.isDeleting,
4347
+ isDeleting = _ref$isDeleting === void 0 ? false : _ref$isDeleting,
4348
+ _ref$deleteApiKey = _ref.deleteApiKey,
4349
+ deleteApiKey = _ref$deleteApiKey === void 0 ? noop$1 : _ref$deleteApiKey,
4350
+ _ref$handleGenerateAp = _ref.handleGenerateApiKey,
4351
+ handleGenerateApiKey = _ref$handleGenerateAp === void 0 ? noop$1 : _ref$handleGenerateAp,
4352
+ _ref$setNewZapierApiK = _ref.setNewZapierApiKey,
4353
+ setNewZapierApiKey = _ref$setNewZapierApiK === void 0 ? noop$1 : _ref$setNewZapierApiK,
4354
+ _ref$setIsDemoModalOp = _ref.setIsDemoModalOpen,
4355
+ setIsDemoModalOpen = _ref$setIsDemoModalOp === void 0 ? noop$1 : _ref$setIsDemoModalOp;
4356
+ var _useTranslation = useTranslation(),
4357
+ t = _useTranslation.t;
4358
+ if (isLoading) return /*#__PURE__*/React__default.createElement(Spinner, null);
4359
+ return /*#__PURE__*/React__default.createElement("div", {
4360
+ className: "w-full max-w-xl space-y-10 p-10"
4361
+ }, isNotEmpty(newZapierApiKey) && /*#__PURE__*/React__default.createElement(NewZapierApiKey, {
4362
+ apiKey: newZapierApiKey
4363
+ }), /*#__PURE__*/React__default.createElement(Typography, {
4364
+ style: "h2"
4365
+ }, t("zapier.apiKeys")), isEmpty(zapierApiKeys) && /*#__PURE__*/React__default.createElement(Typography, {
4366
+ style: "h4"
4367
+ }, t("zapier.emptyText")), /*#__PURE__*/React__default.createElement(GenerateKey, {
4368
+ handleSubmit: handleGenerateApiKey,
4369
+ isLoading: isGenerating
4370
+ }), /*#__PURE__*/React__default.createElement(ApiKeysList, {
4371
+ apiKeys: zapierApiKeys,
4372
+ deleteApiKey: deleteApiKey,
4373
+ isDeleting: isDeleting,
4374
+ setNewZapierApiKey: setNewZapierApiKey
4375
+ }), isNotEmpty(videoUrl) && /*#__PURE__*/React__default.createElement(Button, {
4376
+ className: "mb-6",
4377
+ label: t("zapier.walkthroughText"),
4378
+ style: "link",
4379
+ onClick: function onClick() {
4380
+ return setIsDemoModalOpen(true);
4381
+ }
4382
+ }));
4383
+ };
4384
+
3593
4385
  var e = [],
3594
4386
  t = [];
3595
4387
  function n(n, r) {
@@ -3615,5 +4407,5 @@ function n(n, r) {
3615
4407
  var css = ".w-screen-imp{width:100vw!important}.intrinsic-container{height:0;overflow:hidden;position:relative}.intrinsic-container-16x9{padding-bottom:56.25%}.intrinsic-container-4x3{padding-bottom:75%}.intrinsic-container iframe{height:100%;left:0;position:absolute;top:0;width:100%}";
3616
4408
  n(css,{});
3617
4409
 
3618
- export { Card, Connect, Demo, Finish, Modal };
4410
+ export { Card, Connect, Demo, Finish, Modal, ZapierForm };
3619
4411
  //# sourceMappingURL=index.js.map