@bigbinary/neeto-integrations-frontend 1.0.1 → 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.cjs.js CHANGED
@@ -7,6 +7,10 @@ var classnames = require('classnames');
7
7
  var pure = require('@bigbinary/neeto-commons-frontend/pure');
8
8
  var neetoIcons = require('@bigbinary/neeto-icons');
9
9
  var neetoui = require('@bigbinary/neetoui');
10
+ var ramda = require('ramda');
11
+ var utils = require('@bigbinary/neeto-commons-frontend/utils');
12
+ var formik = require('@bigbinary/neetoui/formik');
13
+ var Yup = require('yup');
10
14
 
11
15
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
12
16
 
@@ -31,15 +35,16 @@ function _interopNamespace(e) {
31
35
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
32
36
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
33
37
  var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
38
+ var Yup__namespace = /*#__PURE__*/_interopNamespace(Yup);
34
39
 
35
- function _typeof$1(obj) {
40
+ function _typeof$2(obj) {
36
41
  "@babel/helpers - typeof";
37
42
 
38
- return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
43
+ return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
39
44
  return typeof obj;
40
45
  } : function (obj) {
41
46
  return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
42
- }, _typeof$1(obj);
47
+ }, _typeof$2(obj);
43
48
  }
44
49
 
45
50
  function _classCallCheck$1(instance, Constructor) {
@@ -48,20 +53,20 @@ function _classCallCheck$1(instance, Constructor) {
48
53
  }
49
54
  }
50
55
 
51
- function _toPrimitive$1(input, hint) {
52
- if (_typeof$1(input) !== "object" || input === null) return input;
56
+ function _toPrimitive$2(input, hint) {
57
+ if (_typeof$2(input) !== "object" || input === null) return input;
53
58
  var prim = input[Symbol.toPrimitive];
54
59
  if (prim !== undefined) {
55
60
  var res = prim.call(input, hint || "default");
56
- if (_typeof$1(res) !== "object") return res;
61
+ if (_typeof$2(res) !== "object") return res;
57
62
  throw new TypeError("@@toPrimitive must return a primitive value.");
58
63
  }
59
64
  return (hint === "string" ? String : Number)(input);
60
65
  }
61
66
 
62
- function _toPropertyKey$1(arg) {
63
- var key = _toPrimitive$1(arg, "string");
64
- return _typeof$1(key) === "symbol" ? key : String(key);
67
+ function _toPropertyKey$2(arg) {
68
+ var key = _toPrimitive$2(arg, "string");
69
+ return _typeof$2(key) === "symbol" ? key : String(key);
65
70
  }
66
71
 
67
72
  function _defineProperties$1(target, props) {
@@ -70,7 +75,7 @@ function _defineProperties$1(target, props) {
70
75
  descriptor.enumerable = descriptor.enumerable || false;
71
76
  descriptor.configurable = true;
72
77
  if ("value" in descriptor) descriptor.writable = true;
73
- Object.defineProperty(target, _toPropertyKey$1(descriptor.key), descriptor);
78
+ Object.defineProperty(target, _toPropertyKey$2(descriptor.key), descriptor);
74
79
  }
75
80
  }
76
81
  function _createClass$1(Constructor, protoProps, staticProps) {
@@ -115,7 +120,7 @@ function _inherits(subClass, superClass) {
115
120
  }
116
121
 
117
122
  function _possibleConstructorReturn(self, call) {
118
- if (call && (_typeof$1(call) === "object" || typeof call === "function")) {
123
+ if (call && (_typeof$2(call) === "object" || typeof call === "function")) {
119
124
  return call;
120
125
  } else if (call !== void 0) {
121
126
  throw new TypeError("Derived constructors may only return object or undefined");
@@ -130,8 +135,8 @@ function _getPrototypeOf(o) {
130
135
  return _getPrototypeOf(o);
131
136
  }
132
137
 
133
- function _defineProperty$1(obj, key, value) {
134
- key = _toPropertyKey$1(key);
138
+ function _defineProperty$2(obj, key, value) {
139
+ key = _toPropertyKey$2(key);
135
140
  if (key in obj) {
136
141
  Object.defineProperty(obj, key, {
137
142
  value: value,
@@ -145,7 +150,7 @@ function _defineProperty$1(obj, key, value) {
145
150
  return obj;
146
151
  }
147
152
 
148
- function _arrayWithHoles$1(arr) {
153
+ function _arrayWithHoles$2(arr) {
149
154
  if (Array.isArray(arr)) return arr;
150
155
  }
151
156
 
@@ -153,30 +158,30 @@ function _iterableToArray(iter) {
153
158
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
154
159
  }
155
160
 
156
- function _arrayLikeToArray$1(arr, len) {
161
+ function _arrayLikeToArray$2(arr, len) {
157
162
  if (len == null || len > arr.length) len = arr.length;
158
163
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
159
164
  return arr2;
160
165
  }
161
166
 
162
- function _unsupportedIterableToArray$1(o, minLen) {
167
+ function _unsupportedIterableToArray$2(o, minLen) {
163
168
  if (!o) return;
164
- if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
169
+ if (typeof o === "string") return _arrayLikeToArray$2(o, minLen);
165
170
  var n = Object.prototype.toString.call(o).slice(8, -1);
166
171
  if (n === "Object" && o.constructor) n = o.constructor.name;
167
172
  if (n === "Map" || n === "Set") return Array.from(o);
168
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
173
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen);
169
174
  }
170
175
 
171
- function _nonIterableRest$1() {
176
+ function _nonIterableRest$2() {
172
177
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
173
178
  }
174
179
 
175
180
  function _toArray(arr) {
176
- return _arrayWithHoles$1(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableRest$1();
181
+ return _arrayWithHoles$2(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$2(arr) || _nonIterableRest$2();
177
182
  }
178
183
 
179
- function ownKeys$2(object, enumerableOnly) {
184
+ function ownKeys$5(object, enumerableOnly) {
180
185
  var keys = Object.keys(object);
181
186
  if (Object.getOwnPropertySymbols) {
182
187
  var symbols = Object.getOwnPropertySymbols(object);
@@ -189,17 +194,17 @@ function ownKeys$2(object, enumerableOnly) {
189
194
  }
190
195
  return keys;
191
196
  }
192
- function _objectSpread$2(target) {
197
+ function _objectSpread$5(target) {
193
198
  for (var i = 1; i < arguments.length; i++) {
194
199
  var source = arguments[i] != null ? arguments[i] : {};
195
200
  if (i % 2) {
196
- ownKeys$2(Object(source), true).forEach(function (key) {
197
- _defineProperty$1(target, key, source[key]);
201
+ ownKeys$5(Object(source), true).forEach(function (key) {
202
+ _defineProperty$2(target, key, source[key]);
198
203
  });
199
204
  } else if (Object.getOwnPropertyDescriptors) {
200
205
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
201
206
  } else {
202
- ownKeys$2(Object(source)).forEach(function (key) {
207
+ ownKeys$5(Object(source)).forEach(function (key) {
203
208
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
204
209
  });
205
210
  }
@@ -283,7 +288,7 @@ var Logger = function () {
283
288
  }, {
284
289
  key: "create",
285
290
  value: function create(moduleName) {
286
- return new Logger(this.logger, _objectSpread$2(_objectSpread$2({}, {
291
+ return new Logger(this.logger, _objectSpread$5(_objectSpread$5({}, {
287
292
  prefix: "".concat(this.prefix, ":").concat(moduleName, ":")
288
293
  }), this.options));
289
294
  }
@@ -486,7 +491,7 @@ function _objectSpread$1$1(target) {
486
491
  var source = arguments[i] != null ? arguments[i] : {};
487
492
  if (i % 2) {
488
493
  ownKeys$1$1(Object(source), true).forEach(function (key) {
489
- _defineProperty$1(target, key, source[key]);
494
+ _defineProperty$2(target, key, source[key]);
490
495
  });
491
496
  } else if (Object.getOwnPropertyDescriptors) {
492
497
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
@@ -740,7 +745,7 @@ function _objectSpread$2$1(target) {
740
745
  var source = arguments[i] != null ? arguments[i] : {};
741
746
  if (i % 2) {
742
747
  ownKeys$2$1(Object(source), true).forEach(function (key) {
743
- _defineProperty$1(target, key, source[key]);
748
+ _defineProperty$2(target, key, source[key]);
744
749
  });
745
750
  } else if (Object.getOwnPropertyDescriptors) {
746
751
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
@@ -845,7 +850,7 @@ var Translator = function (_EventEmitter) {
845
850
  key: "translate",
846
851
  value: function translate(keys, options, lastKey) {
847
852
  var _this2 = this;
848
- if (_typeof$1(options) !== 'object' && this.options.overloadTranslationOptionHandler) {
853
+ if (_typeof$2(options) !== 'object' && this.options.overloadTranslationOptionHandler) {
849
854
  options = this.options.overloadTranslationOptionHandler(arguments);
850
855
  }
851
856
  if (!options) options = {};
@@ -1567,7 +1572,7 @@ var PluralResolver = function () {
1567
1572
  }]);
1568
1573
  return PluralResolver;
1569
1574
  }();
1570
- function ownKeys$3(object, enumerableOnly) {
1575
+ function ownKeys$3$1(object, enumerableOnly) {
1571
1576
  var keys = Object.keys(object);
1572
1577
  if (Object.getOwnPropertySymbols) {
1573
1578
  var symbols = Object.getOwnPropertySymbols(object);
@@ -1580,17 +1585,17 @@ function ownKeys$3(object, enumerableOnly) {
1580
1585
  }
1581
1586
  return keys;
1582
1587
  }
1583
- function _objectSpread$3(target) {
1588
+ function _objectSpread$3$1(target) {
1584
1589
  for (var i = 1; i < arguments.length; i++) {
1585
1590
  var source = arguments[i] != null ? arguments[i] : {};
1586
1591
  if (i % 2) {
1587
- ownKeys$3(Object(source), true).forEach(function (key) {
1588
- _defineProperty$1(target, key, source[key]);
1592
+ ownKeys$3$1(Object(source), true).forEach(function (key) {
1593
+ _defineProperty$2(target, key, source[key]);
1589
1594
  });
1590
1595
  } else if (Object.getOwnPropertyDescriptors) {
1591
1596
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
1592
1597
  } else {
1593
- ownKeys$3(Object(source)).forEach(function (key) {
1598
+ ownKeys$3$1(Object(source)).forEach(function (key) {
1594
1599
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1595
1600
  });
1596
1601
  }
@@ -1660,14 +1665,14 @@ var Interpolator = function () {
1660
1665
  var handleFormat = function handleFormat(key) {
1661
1666
  if (key.indexOf(_this.formatSeparator) < 0) {
1662
1667
  var path = getPathWithDefaults(data, defaultData, key);
1663
- return _this.alwaysFormat ? _this.format(path, undefined, lng, _objectSpread$3(_objectSpread$3(_objectSpread$3({}, options), data), {}, {
1668
+ return _this.alwaysFormat ? _this.format(path, undefined, lng, _objectSpread$3$1(_objectSpread$3$1(_objectSpread$3$1({}, options), data), {}, {
1664
1669
  interpolationkey: key
1665
1670
  })) : path;
1666
1671
  }
1667
1672
  var p = key.split(_this.formatSeparator);
1668
1673
  var k = p.shift().trim();
1669
1674
  var f = p.join(_this.formatSeparator).trim();
1670
- return _this.format(getPathWithDefaults(data, defaultData, k), f, lng, _objectSpread$3(_objectSpread$3(_objectSpread$3({}, options), data), {}, {
1675
+ return _this.format(getPathWithDefaults(data, defaultData, k), f, lng, _objectSpread$3$1(_objectSpread$3$1(_objectSpread$3$1({}, options), data), {}, {
1671
1676
  interpolationkey: k
1672
1677
  }));
1673
1678
  };
@@ -1729,7 +1734,7 @@ var Interpolator = function () {
1729
1734
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1730
1735
  var match;
1731
1736
  var value;
1732
- var clonedOptions = _objectSpread$3({}, options);
1737
+ var clonedOptions = _objectSpread$3$1({}, options);
1733
1738
  clonedOptions.applyPostProcessor = false;
1734
1739
  delete clonedOptions.defaultValue;
1735
1740
  function handleHasOptions(key, inheritedOptions) {
@@ -1742,7 +1747,7 @@ var Interpolator = function () {
1742
1747
  optionsString = optionsString.replace(/'/g, '"');
1743
1748
  try {
1744
1749
  clonedOptions = JSON.parse(optionsString);
1745
- if (inheritedOptions) clonedOptions = _objectSpread$3(_objectSpread$3({}, inheritedOptions), clonedOptions);
1750
+ if (inheritedOptions) clonedOptions = _objectSpread$3$1(_objectSpread$3$1({}, inheritedOptions), clonedOptions);
1746
1751
  } catch (e) {
1747
1752
  this.logger.warn("failed parsing options string in nesting for key ".concat(key), e);
1748
1753
  return "".concat(key).concat(sep).concat(optionsString);
@@ -1770,7 +1775,7 @@ var Interpolator = function () {
1770
1775
  }
1771
1776
  if (doReduce) {
1772
1777
  value = formatters.reduce(function (v, f) {
1773
- return _this2.format(v, f, options.lng, _objectSpread$3(_objectSpread$3({}, options), {}, {
1778
+ return _this2.format(v, f, options.lng, _objectSpread$3$1(_objectSpread$3$1({}, options), {}, {
1774
1779
  interpolationkey: match[1].trim()
1775
1780
  }));
1776
1781
  }, value.trim());
@@ -1783,7 +1788,7 @@ var Interpolator = function () {
1783
1788
  }]);
1784
1789
  return Interpolator;
1785
1790
  }();
1786
- function ownKeys$4(object, enumerableOnly) {
1791
+ function ownKeys$4$1(object, enumerableOnly) {
1787
1792
  var keys = Object.keys(object);
1788
1793
  if (Object.getOwnPropertySymbols) {
1789
1794
  var symbols = Object.getOwnPropertySymbols(object);
@@ -1796,17 +1801,17 @@ function ownKeys$4(object, enumerableOnly) {
1796
1801
  }
1797
1802
  return keys;
1798
1803
  }
1799
- function _objectSpread$4(target) {
1804
+ function _objectSpread$4$1(target) {
1800
1805
  for (var i = 1; i < arguments.length; i++) {
1801
1806
  var source = arguments[i] != null ? arguments[i] : {};
1802
1807
  if (i % 2) {
1803
- ownKeys$4(Object(source), true).forEach(function (key) {
1804
- _defineProperty$1(target, key, source[key]);
1808
+ ownKeys$4$1(Object(source), true).forEach(function (key) {
1809
+ _defineProperty$2(target, key, source[key]);
1805
1810
  });
1806
1811
  } else if (Object.getOwnPropertyDescriptors) {
1807
1812
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
1808
1813
  } else {
1809
- ownKeys$4(Object(source)).forEach(function (key) {
1814
+ ownKeys$4$1(Object(source)).forEach(function (key) {
1810
1815
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1811
1816
  });
1812
1817
  }
@@ -1856,18 +1861,18 @@ var Formatter = function () {
1856
1861
  return new Intl.NumberFormat(lng, options).format(val);
1857
1862
  },
1858
1863
  currency: function currency(val, lng, options) {
1859
- return new Intl.NumberFormat(lng, _objectSpread$4(_objectSpread$4({}, options), {}, {
1864
+ return new Intl.NumberFormat(lng, _objectSpread$4$1(_objectSpread$4$1({}, options), {}, {
1860
1865
  style: 'currency'
1861
1866
  })).format(val);
1862
1867
  },
1863
1868
  datetime: function datetime(val, lng, options) {
1864
- return new Intl.DateTimeFormat(lng, _objectSpread$4({}, options)).format(val);
1869
+ return new Intl.DateTimeFormat(lng, _objectSpread$4$1({}, options)).format(val);
1865
1870
  },
1866
1871
  relativetime: function relativetime(val, lng, options) {
1867
- return new Intl.RelativeTimeFormat(lng, _objectSpread$4({}, options)).format(val, options.range || 'day');
1872
+ return new Intl.RelativeTimeFormat(lng, _objectSpread$4$1({}, options)).format(val, options.range || 'day');
1868
1873
  },
1869
1874
  list: function list(val, lng, options) {
1870
- return new Intl.ListFormat(lng, _objectSpread$4({}, options)).format(val);
1875
+ return new Intl.ListFormat(lng, _objectSpread$4$1({}, options)).format(val);
1871
1876
  }
1872
1877
  };
1873
1878
  this.init(options);
@@ -1900,7 +1905,7 @@ var Formatter = function () {
1900
1905
  try {
1901
1906
  var valOptions = options && options.formatParams && options.formatParams[options.interpolationkey] || {};
1902
1907
  var l = valOptions.locale || valOptions.lng || options.locale || options.lng || lng;
1903
- formatted = _this.formats[formatName](mem, l, _objectSpread$4(_objectSpread$4(_objectSpread$4({}, formatOptions), options), valOptions));
1908
+ formatted = _this.formats[formatName](mem, l, _objectSpread$4$1(_objectSpread$4$1(_objectSpread$4$1({}, formatOptions), options), valOptions));
1904
1909
  } catch (error) {
1905
1910
  _this.logger.warn(error);
1906
1911
  }
@@ -1915,7 +1920,7 @@ var Formatter = function () {
1915
1920
  }]);
1916
1921
  return Formatter;
1917
1922
  }();
1918
- function ownKeys$5(object, enumerableOnly) {
1923
+ function ownKeys$5$1(object, enumerableOnly) {
1919
1924
  var keys = Object.keys(object);
1920
1925
  if (Object.getOwnPropertySymbols) {
1921
1926
  var symbols = Object.getOwnPropertySymbols(object);
@@ -1928,17 +1933,17 @@ function ownKeys$5(object, enumerableOnly) {
1928
1933
  }
1929
1934
  return keys;
1930
1935
  }
1931
- function _objectSpread$5(target) {
1936
+ function _objectSpread$5$1(target) {
1932
1937
  for (var i = 1; i < arguments.length; i++) {
1933
1938
  var source = arguments[i] != null ? arguments[i] : {};
1934
1939
  if (i % 2) {
1935
- ownKeys$5(Object(source), true).forEach(function (key) {
1936
- _defineProperty$1(target, key, source[key]);
1940
+ ownKeys$5$1(Object(source), true).forEach(function (key) {
1941
+ _defineProperty$2(target, key, source[key]);
1937
1942
  });
1938
1943
  } else if (Object.getOwnPropertyDescriptors) {
1939
1944
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
1940
1945
  } else {
1941
- ownKeys$5(Object(source)).forEach(function (key) {
1946
+ ownKeys$5$1(Object(source)).forEach(function (key) {
1942
1947
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1943
1948
  });
1944
1949
  }
@@ -2155,7 +2160,7 @@ var Connector = function (_EventEmitter) {
2155
2160
  }
2156
2161
  if (key === undefined || key === null || key === '') return;
2157
2162
  if (this.backend && this.backend.create) {
2158
- this.backend.create(languages, namespace, key, fallbackValue, null, _objectSpread$5(_objectSpread$5({}, options), {}, {
2163
+ this.backend.create(languages, namespace, key, fallbackValue, null, _objectSpread$5$1(_objectSpread$5$1({}, options), {}, {
2159
2164
  isUpdate: isUpdate
2160
2165
  }));
2161
2166
  }
@@ -2201,10 +2206,10 @@ function get() {
2201
2206
  appendNamespaceToCIMode: false,
2202
2207
  overloadTranslationOptionHandler: function handle(args) {
2203
2208
  var ret = {};
2204
- if (_typeof$1(args[1]) === 'object') ret = args[1];
2209
+ if (_typeof$2(args[1]) === 'object') ret = args[1];
2205
2210
  if (typeof args[1] === 'string') ret.defaultValue = args[1];
2206
2211
  if (typeof args[2] === 'string') ret.tDescription = args[2];
2207
- if (_typeof$1(args[2]) === 'object' || _typeof$1(args[3]) === 'object') {
2212
+ if (_typeof$2(args[2]) === 'object' || _typeof$2(args[3]) === 'object') {
2208
2213
  var options = args[3] || args[2];
2209
2214
  Object.keys(options).forEach(function (key) {
2210
2215
  ret[key] = options[key];
@@ -2256,7 +2261,7 @@ function _objectSpread$6(target) {
2256
2261
  var source = arguments[i] != null ? arguments[i] : {};
2257
2262
  if (i % 2) {
2258
2263
  ownKeys$6(Object(source), true).forEach(function (key) {
2259
- _defineProperty$1(target, key, source[key]);
2264
+ _defineProperty$2(target, key, source[key]);
2260
2265
  });
2261
2266
  } else if (Object.getOwnPropertyDescriptors) {
2262
2267
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
@@ -2620,7 +2625,7 @@ var I18n = function (_EventEmitter) {
2620
2625
  var _this5 = this;
2621
2626
  var fixedT = function fixedT(key, opts) {
2622
2627
  var options;
2623
- if (_typeof$1(opts) !== 'object') {
2628
+ if (_typeof$2(opts) !== 'object') {
2624
2629
  for (var _len3 = arguments.length, rest = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
2625
2630
  rest[_key3 - 2] = arguments[_key3];
2626
2631
  }
@@ -2784,7 +2789,7 @@ var I18n = function (_EventEmitter) {
2784
2789
  }]);
2785
2790
  return I18n;
2786
2791
  }(EventEmitter);
2787
- _defineProperty$1(I18n, "createInstance", function () {
2792
+ _defineProperty$2(I18n, "createInstance", function () {
2788
2793
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2789
2794
  var callback = arguments.length > 1 ? arguments[1] : undefined;
2790
2795
  return new I18n(options, callback);
@@ -2805,34 +2810,63 @@ instance.hasLoadedNamespace;
2805
2810
  instance.loadNamespaces;
2806
2811
  instance.loadLanguages;
2807
2812
 
2808
- function _typeof(obj) {
2813
+ function _objectWithoutPropertiesLoose(source, excluded) {
2814
+ if (source == null) return {};
2815
+ var target = {};
2816
+ var sourceKeys = Object.keys(source);
2817
+ var key, i;
2818
+ for (i = 0; i < sourceKeys.length; i++) {
2819
+ key = sourceKeys[i];
2820
+ if (excluded.indexOf(key) >= 0) continue;
2821
+ target[key] = source[key];
2822
+ }
2823
+ return target;
2824
+ }
2825
+
2826
+ function _objectWithoutProperties(source, excluded) {
2827
+ if (source == null) return {};
2828
+ var target = _objectWithoutPropertiesLoose(source, excluded);
2829
+ var key, i;
2830
+ if (Object.getOwnPropertySymbols) {
2831
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
2832
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
2833
+ key = sourceSymbolKeys[i];
2834
+ if (excluded.indexOf(key) >= 0) continue;
2835
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
2836
+ target[key] = source[key];
2837
+ }
2838
+ }
2839
+ return target;
2840
+ }
2841
+
2842
+ function _typeof$1(obj) {
2809
2843
  "@babel/helpers - typeof";
2810
2844
 
2811
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
2845
+ return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
2812
2846
  return typeof obj;
2813
2847
  } : function (obj) {
2814
2848
  return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
2815
- }, _typeof(obj);
2849
+ }, _typeof$1(obj);
2816
2850
  }
2817
2851
 
2818
- function _toPrimitive(input, hint) {
2819
- if (_typeof(input) !== "object" || input === null) return input;
2852
+ function _toPrimitive$1(input, hint) {
2853
+ if (_typeof$1(input) !== "object" || input === null) return input;
2820
2854
  var prim = input[Symbol.toPrimitive];
2821
2855
  if (prim !== undefined) {
2822
2856
  var res = prim.call(input, hint || "default");
2823
- if (_typeof(res) !== "object") return res;
2857
+ if (_typeof$1(res) !== "object") return res;
2824
2858
  throw new TypeError("@@toPrimitive must return a primitive value.");
2825
2859
  }
2826
2860
  return (hint === "string" ? String : Number)(input);
2827
2861
  }
2828
2862
 
2829
- function _toPropertyKey(arg) {
2830
- var key = _toPrimitive(arg, "string");
2831
- return _typeof(key) === "symbol" ? key : String(key);
2863
+ function _toPropertyKey$1(arg) {
2864
+ var key = _toPrimitive$1(arg, "string");
2865
+ return _typeof$1(key) === "symbol" ? key : String(key);
2832
2866
  }
2833
2867
 
2834
- function _defineProperty(obj, key, value) {
2835
- key = _toPropertyKey(key);
2868
+ function _defineProperty$1(obj, key, value) {
2869
+ key = _toPropertyKey$1(key);
2836
2870
  if (key in obj) {
2837
2871
  Object.defineProperty(obj, key, {
2838
2872
  value: value,
@@ -2846,6 +2880,161 @@ function _defineProperty(obj, key, value) {
2846
2880
  return obj;
2847
2881
  }
2848
2882
 
2883
+ /**
2884
+ * This file automatically generated from `pre-publish.js`.
2885
+ * Do not manually edit.
2886
+ */
2887
+ var voidElements = {
2888
+ "area": true,
2889
+ "base": true,
2890
+ "br": true,
2891
+ "col": true,
2892
+ "embed": true,
2893
+ "hr": true,
2894
+ "img": true,
2895
+ "input": true,
2896
+ "link": true,
2897
+ "meta": true,
2898
+ "param": true,
2899
+ "source": true,
2900
+ "track": true,
2901
+ "wbr": true
2902
+ };
2903
+
2904
+ var t$1 = /\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;
2905
+ function n$1(n) {
2906
+ var r = {
2907
+ type: "tag",
2908
+ name: "",
2909
+ voidElement: !1,
2910
+ attrs: {},
2911
+ children: []
2912
+ },
2913
+ i = n.match(/<\/?([^\s]+?)[/\s>]/);
2914
+ if (i && (r.name = i[1], (voidElements[i[1]] || "/" === n.charAt(n.length - 2)) && (r.voidElement = !0), r.name.startsWith("!--"))) {
2915
+ var s = n.indexOf("--\x3e");
2916
+ return {
2917
+ type: "comment",
2918
+ comment: -1 !== s ? n.slice(4, s) : ""
2919
+ };
2920
+ }
2921
+ for (var a = new RegExp(t$1), c = null; null !== (c = a.exec(n));) if (c[0].trim()) if (c[1]) {
2922
+ var o = c[1].trim(),
2923
+ l = [o, ""];
2924
+ o.indexOf("=") > -1 && (l = o.split("=")), r.attrs[l[0]] = l[1], a.lastIndex--;
2925
+ } else c[2] && (r.attrs[c[2]] = c[3].trim().substring(1, c[3].length - 1));
2926
+ return r;
2927
+ }
2928
+ var r = /<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,
2929
+ i = /^\s*$/,
2930
+ s = Object.create(null);
2931
+ function a(e, t) {
2932
+ switch (t.type) {
2933
+ case "text":
2934
+ return e + t.content;
2935
+ case "tag":
2936
+ return e += "<" + t.name + (t.attrs ? function (e) {
2937
+ var t = [];
2938
+ for (var n in e) t.push(n + '="' + e[n] + '"');
2939
+ return t.length ? " " + t.join(" ") : "";
2940
+ }(t.attrs) : "") + (t.voidElement ? "/>" : ">"), t.voidElement ? e : e + t.children.reduce(a, "") + "</" + t.name + ">";
2941
+ case "comment":
2942
+ return e + "\x3c!--" + t.comment + "--\x3e";
2943
+ }
2944
+ }
2945
+ var c = {
2946
+ parse: function parse(e, t) {
2947
+ t || (t = {}), t.components || (t.components = s);
2948
+ var a,
2949
+ c = [],
2950
+ o = [],
2951
+ l = -1,
2952
+ m = !1;
2953
+ if (0 !== e.indexOf("<")) {
2954
+ var u = e.indexOf("<");
2955
+ c.push({
2956
+ type: "text",
2957
+ content: -1 === u ? e : e.substring(0, u)
2958
+ });
2959
+ }
2960
+ return e.replace(r, function (r, s) {
2961
+ if (m) {
2962
+ if (r !== "</" + a.name + ">") return;
2963
+ m = !1;
2964
+ }
2965
+ var u,
2966
+ f = "/" !== r.charAt(1),
2967
+ h = r.startsWith("\x3c!--"),
2968
+ p = s + r.length,
2969
+ d = e.charAt(p);
2970
+ if (h) {
2971
+ var v = n$1(r);
2972
+ return l < 0 ? (c.push(v), c) : ((u = o[l]).children.push(v), c);
2973
+ }
2974
+ 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({
2975
+ type: "text",
2976
+ content: e.slice(p, e.indexOf("<", p))
2977
+ }), 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)) {
2978
+ u = -1 === l ? c : o[l].children;
2979
+ var x = e.indexOf("<", p),
2980
+ g = e.slice(p, -1 === x ? void 0 : x);
2981
+ i.test(g) && (g = " "), (x > -1 && l + u.length >= 0 || " " !== g) && u.push({
2982
+ type: "text",
2983
+ content: g
2984
+ });
2985
+ }
2986
+ }), c;
2987
+ },
2988
+ stringify: function stringify(e) {
2989
+ return e.reduce(function (e, t) {
2990
+ return e + a("", t);
2991
+ }, "");
2992
+ }
2993
+ };
2994
+
2995
+ /**
2996
+ * Copyright (C) 2017-present by Andrea Giammarchi - @WebReflection
2997
+ *
2998
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
2999
+ * of this software and associated documentation files (the "Software"), to deal
3000
+ * in the Software without restriction, including without limitation the rights
3001
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
3002
+ * copies of the Software, and to permit persons to whom the Software is
3003
+ * furnished to do so, subject to the following conditions:
3004
+ *
3005
+ * The above copyright notice and this permission notice shall be included in
3006
+ * all copies or substantial portions of the Software.
3007
+ *
3008
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3009
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3010
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3011
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3012
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3013
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
3014
+ * THE SOFTWARE.
3015
+ */
3016
+
3017
+ var replace = ''.replace;
3018
+ var es = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34);/g;
3019
+ var unes = {
3020
+ '&amp;': '&',
3021
+ '&#38;': '&',
3022
+ '&lt;': '<',
3023
+ '&#60;': '<',
3024
+ '&gt;': '>',
3025
+ '&#62;': '>',
3026
+ '&apos;': "'",
3027
+ '&#39;': "'",
3028
+ '&quot;': '"',
3029
+ '&#34;': '"'
3030
+ };
3031
+ function unescape(un) {
3032
+ return replace.call(un, es, cape);
3033
+ }
3034
+ function cape(m) {
3035
+ return unes[m];
3036
+ }
3037
+
2849
3038
  function _classCallCheck(instance, Constructor) {
2850
3039
  if (!(instance instanceof Constructor)) {
2851
3040
  throw new TypeError("Cannot call a class as a function");
@@ -2858,7 +3047,7 @@ function _defineProperties(target, props) {
2858
3047
  descriptor.enumerable = descriptor.enumerable || false;
2859
3048
  descriptor.configurable = true;
2860
3049
  if ("value" in descriptor) descriptor.writable = true;
2861
- Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
3050
+ Object.defineProperty(target, _toPropertyKey$1(descriptor.key), descriptor);
2862
3051
  }
2863
3052
  }
2864
3053
  function _createClass(Constructor, protoProps, staticProps) {
@@ -2870,7 +3059,7 @@ function _createClass(Constructor, protoProps, staticProps) {
2870
3059
  return Constructor;
2871
3060
  }
2872
3061
 
2873
- function ownKeys$1(object, enumerableOnly) {
3062
+ function ownKeys$4(object, enumerableOnly) {
2874
3063
  var keys = Object.keys(object);
2875
3064
  if (Object.getOwnPropertySymbols) {
2876
3065
  var symbols = Object.getOwnPropertySymbols(object);
@@ -2883,17 +3072,17 @@ function ownKeys$1(object, enumerableOnly) {
2883
3072
  }
2884
3073
  return keys;
2885
3074
  }
2886
- function _objectSpread$1(target) {
3075
+ function _objectSpread$4(target) {
2887
3076
  for (var i = 1; i < arguments.length; i++) {
2888
3077
  var source = arguments[i] != null ? arguments[i] : {};
2889
3078
  if (i % 2) {
2890
- ownKeys$1(Object(source), true).forEach(function (key) {
2891
- _defineProperty(target, key, source[key]);
3079
+ ownKeys$4(Object(source), true).forEach(function (key) {
3080
+ _defineProperty$1(target, key, source[key]);
2892
3081
  });
2893
3082
  } else if (Object.getOwnPropertyDescriptors) {
2894
3083
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2895
3084
  } else {
2896
- ownKeys$1(Object(source)).forEach(function (key) {
3085
+ ownKeys$4(Object(source)).forEach(function (key) {
2897
3086
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2898
3087
  });
2899
3088
  }
@@ -2913,7 +3102,7 @@ var i18nInstance;
2913
3102
  var I18nContext = /*#__PURE__*/React__default["default"].createContext();
2914
3103
  function setDefaults() {
2915
3104
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2916
- defaultOptions = _objectSpread$1(_objectSpread$1({}, defaultOptions), options);
3105
+ defaultOptions = _objectSpread$4(_objectSpread$4({}, defaultOptions), options);
2917
3106
  }
2918
3107
  function getDefaults() {
2919
3108
  return defaultOptions;
@@ -3020,11 +3209,268 @@ function hasLoadedNamespace(ns, i18n) {
3020
3209
  });
3021
3210
  }
3022
3211
 
3023
- function _arrayWithHoles(arr) {
3212
+ var _excluded = ["format"],
3213
+ _excluded2 = ["children", "count", "parent", "i18nKey", "context", "tOptions", "values", "defaults", "components", "ns", "i18n", "t", "shouldUnescape"];
3214
+ function ownKeys$3(object, enumerableOnly) {
3215
+ var keys = Object.keys(object);
3216
+ if (Object.getOwnPropertySymbols) {
3217
+ var symbols = Object.getOwnPropertySymbols(object);
3218
+ if (enumerableOnly) {
3219
+ symbols = symbols.filter(function (sym) {
3220
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
3221
+ });
3222
+ }
3223
+ keys.push.apply(keys, symbols);
3224
+ }
3225
+ return keys;
3226
+ }
3227
+ function _objectSpread$3(target) {
3228
+ for (var i = 1; i < arguments.length; i++) {
3229
+ var source = arguments[i] != null ? arguments[i] : {};
3230
+ if (i % 2) {
3231
+ ownKeys$3(Object(source), true).forEach(function (key) {
3232
+ _defineProperty$1(target, key, source[key]);
3233
+ });
3234
+ } else if (Object.getOwnPropertyDescriptors) {
3235
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
3236
+ } else {
3237
+ ownKeys$3(Object(source)).forEach(function (key) {
3238
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
3239
+ });
3240
+ }
3241
+ }
3242
+ return target;
3243
+ }
3244
+ function hasChildren(node, checkLength) {
3245
+ if (!node) return false;
3246
+ var base = node.props ? node.props.children : node.children;
3247
+ if (checkLength) return base.length > 0;
3248
+ return !!base;
3249
+ }
3250
+ function getChildren(node) {
3251
+ if (!node) return [];
3252
+ return node && node.children ? node.children : node.props && node.props.children;
3253
+ }
3254
+ function hasValidReactChildren(children) {
3255
+ if (Object.prototype.toString.call(children) !== '[object Array]') return false;
3256
+ return children.every(function (child) {
3257
+ return /*#__PURE__*/React__default["default"].isValidElement(child);
3258
+ });
3259
+ }
3260
+ function getAsArray(data) {
3261
+ return Array.isArray(data) ? data : [data];
3262
+ }
3263
+ function mergeProps(source, target) {
3264
+ var newTarget = _objectSpread$3({}, target);
3265
+ newTarget.props = Object.assign(source.props, target.props);
3266
+ return newTarget;
3267
+ }
3268
+ function nodesToString(children, i18nOptions) {
3269
+ if (!children) return '';
3270
+ var stringNode = '';
3271
+ var childrenArray = getAsArray(children);
3272
+ var keepArray = i18nOptions.transSupportBasicHtmlNodes && i18nOptions.transKeepBasicHtmlNodesFor ? i18nOptions.transKeepBasicHtmlNodesFor : [];
3273
+ childrenArray.forEach(function (child, childIndex) {
3274
+ if (typeof child === 'string') {
3275
+ stringNode += "".concat(child);
3276
+ } else if ( /*#__PURE__*/React__default["default"].isValidElement(child)) {
3277
+ var childPropsCount = Object.keys(child.props).length;
3278
+ var shouldKeepChild = keepArray.indexOf(child.type) > -1;
3279
+ var childChildren = child.props.children;
3280
+ if (!childChildren && shouldKeepChild && childPropsCount === 0) {
3281
+ stringNode += "<".concat(child.type, "/>");
3282
+ } else if (!childChildren && (!shouldKeepChild || childPropsCount !== 0)) {
3283
+ stringNode += "<".concat(childIndex, "></").concat(childIndex, ">");
3284
+ } else if (child.props.i18nIsDynamicList) {
3285
+ stringNode += "<".concat(childIndex, "></").concat(childIndex, ">");
3286
+ } else if (shouldKeepChild && childPropsCount === 1 && typeof childChildren === 'string') {
3287
+ stringNode += "<".concat(child.type, ">").concat(childChildren, "</").concat(child.type, ">");
3288
+ } else {
3289
+ var content = nodesToString(childChildren, i18nOptions);
3290
+ stringNode += "<".concat(childIndex, ">").concat(content, "</").concat(childIndex, ">");
3291
+ }
3292
+ } else if (child === null) {
3293
+ warn("Trans: the passed in value is invalid - seems you passed in a null child.");
3294
+ } else if (_typeof$1(child) === 'object') {
3295
+ var format = child.format,
3296
+ clone = _objectWithoutProperties(child, _excluded);
3297
+ var keys = Object.keys(clone);
3298
+ if (keys.length === 1) {
3299
+ var value = format ? "".concat(keys[0], ", ").concat(format) : keys[0];
3300
+ stringNode += "{{".concat(value, "}}");
3301
+ } else {
3302
+ warn("react-i18next: the passed in object contained more than one variable - the object should look like {{ value, format }} where format is optional.", child);
3303
+ }
3304
+ } else {
3305
+ 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);
3306
+ }
3307
+ });
3308
+ return stringNode;
3309
+ }
3310
+ function renderNodes(children, targetString, i18n, i18nOptions, combinedTOpts, shouldUnescape) {
3311
+ if (targetString === '') return [];
3312
+ var keepArray = i18nOptions.transKeepBasicHtmlNodesFor || [];
3313
+ var emptyChildrenButNeedsHandling = targetString && new RegExp(keepArray.join('|')).test(targetString);
3314
+ if (!children && !emptyChildrenButNeedsHandling) return [targetString];
3315
+ var data = {};
3316
+ function getData(childs) {
3317
+ var childrenArray = getAsArray(childs);
3318
+ childrenArray.forEach(function (child) {
3319
+ if (typeof child === 'string') return;
3320
+ if (hasChildren(child)) getData(getChildren(child));else if (_typeof$1(child) === 'object' && ! /*#__PURE__*/React__default["default"].isValidElement(child)) Object.assign(data, child);
3321
+ });
3322
+ }
3323
+ getData(children);
3324
+ var ast = c.parse("<0>".concat(targetString, "</0>"));
3325
+ var opts = _objectSpread$3(_objectSpread$3({}, data), combinedTOpts);
3326
+ function renderInner(child, node, rootReactNode) {
3327
+ var childs = getChildren(child);
3328
+ var mappedChildren = mapAST(childs, node.children, rootReactNode);
3329
+ return hasValidReactChildren(childs) && mappedChildren.length === 0 ? childs : mappedChildren;
3330
+ }
3331
+ function pushTranslatedJSX(child, inner, mem, i, isVoid) {
3332
+ if (child.dummy) child.children = inner;
3333
+ mem.push( /*#__PURE__*/React__default["default"].cloneElement(child, _objectSpread$3(_objectSpread$3({}, child.props), {}, {
3334
+ key: i
3335
+ }), isVoid ? undefined : inner));
3336
+ }
3337
+ function mapAST(reactNode, astNode, rootReactNode) {
3338
+ var reactNodes = getAsArray(reactNode);
3339
+ var astNodes = getAsArray(astNode);
3340
+ return astNodes.reduce(function (mem, node, i) {
3341
+ var translationContent = node.children && node.children[0] && node.children[0].content && i18n.services.interpolator.interpolate(node.children[0].content, opts, i18n.language);
3342
+ if (node.type === 'tag') {
3343
+ var tmp = reactNodes[parseInt(node.name, 10)];
3344
+ if (!tmp && rootReactNode.length === 1 && rootReactNode[0][node.name]) tmp = rootReactNode[0][node.name];
3345
+ if (!tmp) tmp = {};
3346
+ var child = Object.keys(node.attrs).length !== 0 ? mergeProps({
3347
+ props: node.attrs
3348
+ }, tmp) : tmp;
3349
+ var isElement = /*#__PURE__*/React__default["default"].isValidElement(child);
3350
+ var isValidTranslationWithChildren = isElement && hasChildren(node, true) && !node.voidElement;
3351
+ var isEmptyTransWithHTML = emptyChildrenButNeedsHandling && _typeof$1(child) === 'object' && child.dummy && !isElement;
3352
+ var isKnownComponent = _typeof$1(children) === 'object' && children !== null && Object.hasOwnProperty.call(children, node.name);
3353
+ if (typeof child === 'string') {
3354
+ var value = i18n.services.interpolator.interpolate(child, opts, i18n.language);
3355
+ mem.push(value);
3356
+ } else if (hasChildren(child) || isValidTranslationWithChildren) {
3357
+ var inner = renderInner(child, node, rootReactNode);
3358
+ pushTranslatedJSX(child, inner, mem, i);
3359
+ } else if (isEmptyTransWithHTML) {
3360
+ var _inner = mapAST(reactNodes, node.children, rootReactNode);
3361
+ mem.push( /*#__PURE__*/React__default["default"].cloneElement(child, _objectSpread$3(_objectSpread$3({}, child.props), {}, {
3362
+ key: i
3363
+ }), _inner));
3364
+ } else if (Number.isNaN(parseFloat(node.name))) {
3365
+ if (isKnownComponent) {
3366
+ var _inner2 = renderInner(child, node, rootReactNode);
3367
+ pushTranslatedJSX(child, _inner2, mem, i, node.voidElement);
3368
+ } else if (i18nOptions.transSupportBasicHtmlNodes && keepArray.indexOf(node.name) > -1) {
3369
+ if (node.voidElement) {
3370
+ mem.push( /*#__PURE__*/React__default["default"].createElement(node.name, {
3371
+ key: "".concat(node.name, "-").concat(i)
3372
+ }));
3373
+ } else {
3374
+ var _inner3 = mapAST(reactNodes, node.children, rootReactNode);
3375
+ mem.push( /*#__PURE__*/React__default["default"].createElement(node.name, {
3376
+ key: "".concat(node.name, "-").concat(i)
3377
+ }, _inner3));
3378
+ }
3379
+ } else if (node.voidElement) {
3380
+ mem.push("<".concat(node.name, " />"));
3381
+ } else {
3382
+ var _inner4 = mapAST(reactNodes, node.children, rootReactNode);
3383
+ mem.push("<".concat(node.name, ">").concat(_inner4, "</").concat(node.name, ">"));
3384
+ }
3385
+ } else if (_typeof$1(child) === 'object' && !isElement) {
3386
+ var content = node.children[0] ? translationContent : null;
3387
+ if (content) mem.push(content);
3388
+ } else if (node.children.length === 1 && translationContent) {
3389
+ mem.push( /*#__PURE__*/React__default["default"].cloneElement(child, _objectSpread$3(_objectSpread$3({}, child.props), {}, {
3390
+ key: i
3391
+ }), translationContent));
3392
+ } else {
3393
+ mem.push( /*#__PURE__*/React__default["default"].cloneElement(child, _objectSpread$3(_objectSpread$3({}, child.props), {}, {
3394
+ key: i
3395
+ })));
3396
+ }
3397
+ } else if (node.type === 'text') {
3398
+ var wrapTextNodes = i18nOptions.transWrapTextNodes;
3399
+ var _content = shouldUnescape ? unescape(i18n.services.interpolator.interpolate(node.content, opts, i18n.language)) : i18n.services.interpolator.interpolate(node.content, opts, i18n.language);
3400
+ if (wrapTextNodes) {
3401
+ mem.push( /*#__PURE__*/React__default["default"].createElement(wrapTextNodes, {
3402
+ key: "".concat(node.name, "-").concat(i)
3403
+ }, _content));
3404
+ } else {
3405
+ mem.push(_content);
3406
+ }
3407
+ }
3408
+ return mem;
3409
+ }, []);
3410
+ }
3411
+ var result = mapAST([{
3412
+ dummy: true,
3413
+ children: children || []
3414
+ }], ast, getAsArray(children || []));
3415
+ return getChildren(result[0]);
3416
+ }
3417
+ function Trans(_ref) {
3418
+ var children = _ref.children,
3419
+ count = _ref.count,
3420
+ parent = _ref.parent,
3421
+ i18nKey = _ref.i18nKey,
3422
+ context = _ref.context,
3423
+ _ref$tOptions = _ref.tOptions,
3424
+ tOptions = _ref$tOptions === void 0 ? {} : _ref$tOptions,
3425
+ values = _ref.values,
3426
+ defaults = _ref.defaults,
3427
+ components = _ref.components,
3428
+ ns = _ref.ns,
3429
+ i18nFromProps = _ref.i18n,
3430
+ tFromProps = _ref.t,
3431
+ shouldUnescape = _ref.shouldUnescape,
3432
+ additionalProps = _objectWithoutProperties(_ref, _excluded2);
3433
+ var _ref2 = React.useContext(I18nContext) || {},
3434
+ i18nFromContext = _ref2.i18n,
3435
+ defaultNSFromContext = _ref2.defaultNS;
3436
+ var i18n = i18nFromProps || i18nFromContext || getI18n();
3437
+ if (!i18n) {
3438
+ warnOnce('You will need to pass in an i18next instance by using i18nextReactModule');
3439
+ return children;
3440
+ }
3441
+ var t = tFromProps || i18n.t.bind(i18n) || function (k) {
3442
+ return k;
3443
+ };
3444
+ if (context) tOptions.context = context;
3445
+ var reactI18nextOptions = _objectSpread$3(_objectSpread$3({}, getDefaults()), i18n.options && i18n.options.react);
3446
+ var namespaces = ns || t.ns || defaultNSFromContext || i18n.options && i18n.options.defaultNS;
3447
+ namespaces = typeof namespaces === 'string' ? [namespaces] : namespaces || ['translation'];
3448
+ var defaultValue = defaults || nodesToString(children, reactI18nextOptions) || reactI18nextOptions.transEmptyNodeValue || i18nKey;
3449
+ var hashTransKey = reactI18nextOptions.hashTransKey;
3450
+ var key = i18nKey || (hashTransKey ? hashTransKey(defaultValue) : defaultValue);
3451
+ var interpolationOverride = values ? tOptions.interpolation : {
3452
+ interpolation: _objectSpread$3(_objectSpread$3({}, tOptions.interpolation), {}, {
3453
+ prefix: '#$?',
3454
+ suffix: '?$#'
3455
+ })
3456
+ };
3457
+ var combinedTOpts = _objectSpread$3(_objectSpread$3(_objectSpread$3(_objectSpread$3({}, tOptions), {}, {
3458
+ count: count
3459
+ }, values), interpolationOverride), {}, {
3460
+ defaultValue: defaultValue,
3461
+ ns: namespaces
3462
+ });
3463
+ var translation = key ? t(key, combinedTOpts) : defaultValue;
3464
+ var content = renderNodes(components || children, translation, i18n, reactI18nextOptions, combinedTOpts, shouldUnescape);
3465
+ var useAsParent = parent !== undefined ? parent : reactI18nextOptions.defaultTransParent;
3466
+ return useAsParent ? /*#__PURE__*/React__default["default"].createElement(useAsParent, additionalProps, content) : content;
3467
+ }
3468
+
3469
+ function _arrayWithHoles$1(arr) {
3024
3470
  if (Array.isArray(arr)) return arr;
3025
3471
  }
3026
3472
 
3027
- function _iterableToArrayLimit(arr, i) {
3473
+ function _iterableToArrayLimit$1(arr, i) {
3028
3474
  var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
3029
3475
  if (null != _i) {
3030
3476
  var _s,
@@ -3052,30 +3498,30 @@ function _iterableToArrayLimit(arr, i) {
3052
3498
  }
3053
3499
  }
3054
3500
 
3055
- function _arrayLikeToArray(arr, len) {
3501
+ function _arrayLikeToArray$1(arr, len) {
3056
3502
  if (len == null || len > arr.length) len = arr.length;
3057
3503
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
3058
3504
  return arr2;
3059
3505
  }
3060
3506
 
3061
- function _unsupportedIterableToArray(o, minLen) {
3507
+ function _unsupportedIterableToArray$1(o, minLen) {
3062
3508
  if (!o) return;
3063
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
3509
+ if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
3064
3510
  var n = Object.prototype.toString.call(o).slice(8, -1);
3065
3511
  if (n === "Object" && o.constructor) n = o.constructor.name;
3066
3512
  if (n === "Map" || n === "Set") return Array.from(o);
3067
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
3513
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
3068
3514
  }
3069
3515
 
3070
- function _nonIterableRest() {
3516
+ function _nonIterableRest$1() {
3071
3517
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3072
3518
  }
3073
3519
 
3074
- function _slicedToArray(arr, i) {
3075
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
3520
+ function _slicedToArray$1(arr, i) {
3521
+ return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest$1();
3076
3522
  }
3077
3523
 
3078
- function ownKeys(object, enumerableOnly) {
3524
+ function ownKeys$2(object, enumerableOnly) {
3079
3525
  var keys = Object.keys(object);
3080
3526
  if (Object.getOwnPropertySymbols) {
3081
3527
  var symbols = Object.getOwnPropertySymbols(object);
@@ -3088,17 +3534,17 @@ function ownKeys(object, enumerableOnly) {
3088
3534
  }
3089
3535
  return keys;
3090
3536
  }
3091
- function _objectSpread(target) {
3537
+ function _objectSpread$2(target) {
3092
3538
  for (var i = 1; i < arguments.length; i++) {
3093
3539
  var source = arguments[i] != null ? arguments[i] : {};
3094
3540
  if (i % 2) {
3095
- ownKeys(Object(source), true).forEach(function (key) {
3096
- _defineProperty(target, key, source[key]);
3541
+ ownKeys$2(Object(source), true).forEach(function (key) {
3542
+ _defineProperty$1(target, key, source[key]);
3097
3543
  });
3098
3544
  } else if (Object.getOwnPropertyDescriptors) {
3099
3545
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
3100
3546
  } else {
3101
- ownKeys(Object(source)).forEach(function (key) {
3547
+ ownKeys$2(Object(source)).forEach(function (key) {
3102
3548
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
3103
3549
  });
3104
3550
  }
@@ -3125,7 +3571,7 @@ function useTranslation(ns) {
3125
3571
  return retNotReady;
3126
3572
  }
3127
3573
  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.');
3128
- var i18nOptions = _objectSpread(_objectSpread(_objectSpread({}, getDefaults()), i18n.options.react), props);
3574
+ var i18nOptions = _objectSpread$2(_objectSpread$2(_objectSpread$2({}, getDefaults()), i18n.options.react), props);
3129
3575
  var useSuspense = i18nOptions.useSuspense,
3130
3576
  keyPrefix = i18nOptions.keyPrefix;
3131
3577
  var namespaces = ns || defaultNSFromContext || i18n.options && i18n.options.defaultNS;
@@ -3138,7 +3584,7 @@ function useTranslation(ns) {
3138
3584
  return i18n.getFixedT(null, i18nOptions.nsMode === 'fallback' ? namespaces : namespaces[0], keyPrefix);
3139
3585
  }
3140
3586
  var _useState = React.useState(getT),
3141
- _useState2 = _slicedToArray(_useState, 2),
3587
+ _useState2 = _slicedToArray$1(_useState, 2),
3142
3588
  t = _useState2[0],
3143
3589
  setT = _useState2[1];
3144
3590
  var isMounted = React.useRef(true);
@@ -3192,16 +3638,37 @@ var common = {
3192
3638
  connected: "Connected",
3193
3639
  manage: "Manage",
3194
3640
  disconnect: "Disconnect",
3195
- finish: "Finish"
3641
+ finish: "Finish",
3642
+ required: "Required",
3643
+ "delete": "Delete"
3196
3644
  };
3197
3645
  var demo = {
3198
3646
  title: "Check how it behaves",
3199
3647
  subtitle: "Watch the following video to understand how you can utilize this integration:",
3200
3648
  iFrameTitle: "Watch this video to utilize the integration"
3201
3649
  };
3650
+ var zapier = {
3651
+ apiKeys: "API Keys",
3652
+ copyApiKey: "Copy API Key to Clipboard",
3653
+ emptyText: "Generate an API Key to connect to the Zapier platform",
3654
+ generateApiKey: "Generate API Key",
3655
+ labelInputPlaceholder: "Enter a Label for the new API Key",
3656
+ tableColumns: {
3657
+ createdAt: "Created At",
3658
+ label: "Label"
3659
+ },
3660
+ newApiKeyInstruction: "Here is your Zapier API Key. Make sure to copy the API Key now. It will not be made visible again.",
3661
+ tableTitle: "Previously Generated API Keys",
3662
+ deleteApiKey: {
3663
+ title: "Delete API Key?",
3664
+ message: "You are permanently deleting the API Key <strong>{{key}}</strong>. This can't be undone."
3665
+ },
3666
+ walkthroughText: "Check how it behaves"
3667
+ };
3202
3668
  var en = {
3203
3669
  common: common,
3204
- demo: demo
3670
+ demo: demo,
3671
+ zapier: zapier
3205
3672
  };
3206
3673
 
3207
3674
  instance.use(initReactI18next).init({
@@ -3218,8 +3685,8 @@ instance.use(initReactI18next).init({
3218
3685
  }
3219
3686
  });
3220
3687
 
3221
- var Menu = neetoui.Dropdown.Menu,
3222
- MenuItem = neetoui.Dropdown.MenuItem;
3688
+ var Menu$1 = neetoui.Dropdown.Menu,
3689
+ MenuItem$1 = neetoui.Dropdown.MenuItem;
3223
3690
  var Card = function Card(_ref) {
3224
3691
  var label = _ref.label,
3225
3692
  description = _ref.description,
@@ -3268,9 +3735,9 @@ var Card = function Card(_ref) {
3268
3735
  }), customDropdown || /*#__PURE__*/React__default["default"].createElement(neetoui.Dropdown, {
3269
3736
  buttonStyle: "text",
3270
3737
  icon: neetoIcons.MenuVertical
3271
- }, /*#__PURE__*/React__default["default"].createElement(Menu, null, /*#__PURE__*/React__default["default"].createElement(MenuItem.Button, {
3738
+ }, /*#__PURE__*/React__default["default"].createElement(Menu$1, null, /*#__PURE__*/React__default["default"].createElement(MenuItem$1.Button, {
3272
3739
  onClick: onManage
3273
- }, t("common.manage")), /*#__PURE__*/React__default["default"].createElement(MenuItem.Button, {
3740
+ }, t("common.manage")), /*#__PURE__*/React__default["default"].createElement(MenuItem$1.Button, {
3274
3741
  onClick: onDisconnect
3275
3742
  }, t("common.disconnect"))))) : /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
3276
3743
  label: !isStatusLoading && t("common.connect"),
@@ -3623,6 +4090,326 @@ Finish.prototypes = {
3623
4090
  secondaryButtonProps: propTypes.exports.object
3624
4091
  };
3625
4092
 
4093
+ function _arrayWithHoles(arr) {
4094
+ if (Array.isArray(arr)) return arr;
4095
+ }
4096
+
4097
+ function _iterableToArrayLimit(arr, i) {
4098
+ var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
4099
+ if (null != _i) {
4100
+ var _s,
4101
+ _e,
4102
+ _x,
4103
+ _r,
4104
+ _arr = [],
4105
+ _n = !0,
4106
+ _d = !1;
4107
+ try {
4108
+ if (_x = (_i = _i.call(arr)).next, 0 === i) {
4109
+ if (Object(_i) !== _i) return;
4110
+ _n = !1;
4111
+ } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
4112
+ } catch (err) {
4113
+ _d = !0, _e = err;
4114
+ } finally {
4115
+ try {
4116
+ if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
4117
+ } finally {
4118
+ if (_d) throw _e;
4119
+ }
4120
+ }
4121
+ return _arr;
4122
+ }
4123
+ }
4124
+
4125
+ function _arrayLikeToArray(arr, len) {
4126
+ if (len == null || len > arr.length) len = arr.length;
4127
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
4128
+ return arr2;
4129
+ }
4130
+
4131
+ function _unsupportedIterableToArray(o, minLen) {
4132
+ if (!o) return;
4133
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
4134
+ var n = Object.prototype.toString.call(o).slice(8, -1);
4135
+ if (n === "Object" && o.constructor) n = o.constructor.name;
4136
+ if (n === "Map" || n === "Set") return Array.from(o);
4137
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
4138
+ }
4139
+
4140
+ function _nonIterableRest() {
4141
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
4142
+ }
4143
+
4144
+ function _slicedToArray(arr, i) {
4145
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
4146
+ }
4147
+
4148
+ function _typeof(obj) {
4149
+ "@babel/helpers - typeof";
4150
+
4151
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
4152
+ return typeof obj;
4153
+ } : function (obj) {
4154
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
4155
+ }, _typeof(obj);
4156
+ }
4157
+
4158
+ function _toPrimitive(input, hint) {
4159
+ if (_typeof(input) !== "object" || input === null) return input;
4160
+ var prim = input[Symbol.toPrimitive];
4161
+ if (prim !== undefined) {
4162
+ var res = prim.call(input, hint || "default");
4163
+ if (_typeof(res) !== "object") return res;
4164
+ throw new TypeError("@@toPrimitive must return a primitive value.");
4165
+ }
4166
+ return (hint === "string" ? String : Number)(input);
4167
+ }
4168
+
4169
+ function _toPropertyKey(arg) {
4170
+ var key = _toPrimitive(arg, "string");
4171
+ return _typeof(key) === "symbol" ? key : String(key);
4172
+ }
4173
+
4174
+ function _defineProperty(obj, key, value) {
4175
+ key = _toPropertyKey(key);
4176
+ if (key in obj) {
4177
+ Object.defineProperty(obj, key, {
4178
+ value: value,
4179
+ enumerable: true,
4180
+ configurable: true,
4181
+ writable: true
4182
+ });
4183
+ } else {
4184
+ obj[key] = value;
4185
+ }
4186
+ return obj;
4187
+ }
4188
+
4189
+ var Menu = neetoui.Dropdown.Menu,
4190
+ MenuItem = neetoui.Dropdown.MenuItem;
4191
+ var Actions = function Actions(_ref) {
4192
+ var apiKey = _ref.apiKey,
4193
+ setApiKeyToDelete = _ref.setApiKeyToDelete;
4194
+ var _useTranslation = useTranslation(),
4195
+ t = _useTranslation.t;
4196
+ return /*#__PURE__*/React__default["default"].createElement(neetoui.Dropdown, {
4197
+ buttonStyle: "text",
4198
+ icon: neetoIcons.MenuHorizontal,
4199
+ strategy: "fixed"
4200
+ }, /*#__PURE__*/React__default["default"].createElement(Menu, null, /*#__PURE__*/React__default["default"].createElement(MenuItem.Button, {
4201
+ "data-cy": "delete-apikey-button",
4202
+ onClick: function onClick() {
4203
+ return setApiKeyToDelete(apiKey);
4204
+ }
4205
+ }, t("common.delete"))));
4206
+ };
4207
+
4208
+ 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; }
4209
+ 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; }
4210
+ var getApiKeysTableColumnData = function getApiKeysTableColumnData() {
4211
+ return [{
4212
+ title: instance.t("zapier.tableColumns.label"),
4213
+ dataIndex: "options",
4214
+ key: "options",
4215
+ width: 272,
4216
+ render: function render(options, _ref) {
4217
+ var actions = _ref.actions;
4218
+ return /*#__PURE__*/React__default["default"].createElement("div", {
4219
+ className: "flex items-center justify-between gap-x-3"
4220
+ }, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
4221
+ className: "w-4/5",
4222
+ style: "body2"
4223
+ }, options === null || options === void 0 ? void 0 : options.label), actions);
4224
+ }
4225
+ }, {
4226
+ title: instance.t("zapier.tableColumns.createdAt"),
4227
+ dataIndex: "createdAt",
4228
+ key: "createdAt"
4229
+ }];
4230
+ };
4231
+ var getApiKeysTableRowData = function getApiKeysTableRowData(_ref2) {
4232
+ var apiKeys = _ref2.apiKeys,
4233
+ setApiKeyToDelete = _ref2.setApiKeyToDelete;
4234
+ return apiKeys.map(function (apiKey) {
4235
+ return _objectSpread$1(_objectSpread$1({}, apiKey), {}, {
4236
+ createdAt: utils.timeFormat.fromNow(apiKey.createdAt),
4237
+ actions: /*#__PURE__*/React__default["default"].createElement(Actions, {
4238
+ apiKey: apiKey,
4239
+ setApiKeyToDelete: setApiKeyToDelete
4240
+ })
4241
+ });
4242
+ });
4243
+ };
4244
+
4245
+ var ApiKeysList = function ApiKeysList(_ref) {
4246
+ var _apiKeyToDelete$optio;
4247
+ var _ref$apiKeys = _ref.apiKeys,
4248
+ apiKeys = _ref$apiKeys === void 0 ? [] : _ref$apiKeys,
4249
+ _ref$deleteApiKey = _ref.deleteApiKey,
4250
+ deleteApiKey = _ref$deleteApiKey === void 0 ? pure.noop : _ref$deleteApiKey,
4251
+ _ref$isDeleting = _ref.isDeleting,
4252
+ isDeleting = _ref$isDeleting === void 0 ? false : _ref$isDeleting,
4253
+ _ref$setNewZapierApiK = _ref.setNewZapierApiKey,
4254
+ setNewZapierApiKey = _ref$setNewZapierApiK === void 0 ? pure.noop : _ref$setNewZapierApiK;
4255
+ var _useState = React.useState(null),
4256
+ _useState2 = _slicedToArray(_useState, 2),
4257
+ apiKeyToDelete = _useState2[0],
4258
+ setApiKeyToDelete = _useState2[1];
4259
+ var _useTranslation = useTranslation(),
4260
+ t = _useTranslation.t;
4261
+ var closeAlert = function closeAlert() {
4262
+ return setApiKeyToDelete(null);
4263
+ };
4264
+ var handleSubmit = function handleSubmit() {
4265
+ deleteApiKey(apiKeyToDelete === null || apiKeyToDelete === void 0 ? void 0 : apiKeyToDelete.id, {
4266
+ onSuccess: function onSuccess() {
4267
+ closeAlert();
4268
+ setNewZapierApiKey("");
4269
+ }
4270
+ });
4271
+ };
4272
+ if (ramda.isEmpty(apiKeys)) return null;
4273
+ return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
4274
+ className: "space-y-2"
4275
+ }, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
4276
+ style: "h3"
4277
+ }, t("zapier.tableTitle")), /*#__PURE__*/React__default["default"].createElement(neetoui.Table, {
4278
+ fixedHeight: true,
4279
+ allowRowClick: false,
4280
+ columnData: getApiKeysTableColumnData(),
4281
+ rowData: getApiKeysTableRowData({
4282
+ apiKeys: apiKeys,
4283
+ setApiKeyToDelete: setApiKeyToDelete
4284
+ })
4285
+ })), /*#__PURE__*/React__default["default"].createElement(neetoui.Alert, {
4286
+ backdropClassName: "zapier-delete-alert",
4287
+ isOpen: pure.isNotNil(apiKeyToDelete),
4288
+ isSubmitting: isDeleting,
4289
+ submitButtonLabel: t("common.delete"),
4290
+ title: t("zapier.deleteApiKey.title"),
4291
+ message: /*#__PURE__*/React__default["default"].createElement(Trans, {
4292
+ i18nKey: "zapier.deleteApiKey.message",
4293
+ values: {
4294
+ key: apiKeyToDelete === null || apiKeyToDelete === void 0 ? void 0 : (_apiKeyToDelete$optio = apiKeyToDelete.options) === null || _apiKeyToDelete$optio === void 0 ? void 0 : _apiKeyToDelete$optio.label
4295
+ }
4296
+ }),
4297
+ onClose: closeAlert,
4298
+ onSubmit: handleSubmit
4299
+ }));
4300
+ };
4301
+
4302
+ var GENERATE_API_KEY_VALIDATION = Yup__namespace.object({
4303
+ label: Yup__namespace.string().required(instance.t("common.required"))
4304
+ });
4305
+ var GENERATE_API_KEY_FORMIK_PROPS = {
4306
+ initialValues: {
4307
+ label: ""
4308
+ },
4309
+ validationSchema: GENERATE_API_KEY_VALIDATION
4310
+ };
4311
+
4312
+ 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; }
4313
+ 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; }
4314
+ var GenerateKey = function GenerateKey(_ref) {
4315
+ var handleSubmit = _ref.handleSubmit,
4316
+ isLoading = _ref.isLoading;
4317
+ var _useTranslation = useTranslation(),
4318
+ t = _useTranslation.t;
4319
+ var inputRef = React.useRef(null);
4320
+ React.useEffect(function () {
4321
+ if (inputRef.current) {
4322
+ inputRef.current.focus();
4323
+ }
4324
+ }, []);
4325
+ return /*#__PURE__*/React__default["default"].createElement(formik.Form, {
4326
+ formikProps: _objectSpread(_objectSpread({}, GENERATE_API_KEY_FORMIK_PROPS), {}, {
4327
+ onSubmit: handleSubmit
4328
+ })
4329
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
4330
+ className: "space-y-4"
4331
+ }, /*#__PURE__*/React__default["default"].createElement(formik.Input, {
4332
+ name: "label",
4333
+ placeholder: t("zapier.labelInputPlaceholder"),
4334
+ ref: inputRef
4335
+ }), /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
4336
+ label: t("zapier.generateApiKey"),
4337
+ loading: isLoading,
4338
+ type: "submit"
4339
+ })));
4340
+ };
4341
+
4342
+ var NewZapierApiKey = function NewZapierApiKey(_ref) {
4343
+ var apiKey = _ref.apiKey;
4344
+ var _useTranslation = useTranslation(),
4345
+ t = _useTranslation.t;
4346
+ return /*#__PURE__*/React__default["default"].createElement("div", {
4347
+ className: "mb-8 space-y-2"
4348
+ }, /*#__PURE__*/React__default["default"].createElement(neetoui.Callout, null, t("zapier.newApiKeyInstruction")), /*#__PURE__*/React__default["default"].createElement(neetoui.Callout, {
4349
+ className: "flex justify-between",
4350
+ style: "success"
4351
+ }, apiKey, /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
4352
+ icon: neetoIcons.Copy,
4353
+ style: "text",
4354
+ tooltipProps: {
4355
+ content: t("zapier.copyApiKey")
4356
+ },
4357
+ onClick: function onClick() {
4358
+ return utils.copyToClipboard(apiKey);
4359
+ }
4360
+ })));
4361
+ };
4362
+
4363
+ var ZapierForm = function ZapierForm(_ref) {
4364
+ var _ref$newZapierApiKey = _ref.newZapierApiKey,
4365
+ newZapierApiKey = _ref$newZapierApiKey === void 0 ? "" : _ref$newZapierApiKey,
4366
+ _ref$videoUrl = _ref.videoUrl,
4367
+ videoUrl = _ref$videoUrl === void 0 ? "" : _ref$videoUrl,
4368
+ _ref$zapierApiKeys = _ref.zapierApiKeys,
4369
+ zapierApiKeys = _ref$zapierApiKeys === void 0 ? [] : _ref$zapierApiKeys,
4370
+ _ref$isGenerating = _ref.isGenerating,
4371
+ isGenerating = _ref$isGenerating === void 0 ? false : _ref$isGenerating,
4372
+ _ref$isLoading = _ref.isLoading,
4373
+ isLoading = _ref$isLoading === void 0 ? true : _ref$isLoading,
4374
+ _ref$isDeleting = _ref.isDeleting,
4375
+ isDeleting = _ref$isDeleting === void 0 ? false : _ref$isDeleting,
4376
+ _ref$deleteApiKey = _ref.deleteApiKey,
4377
+ deleteApiKey = _ref$deleteApiKey === void 0 ? pure.noop : _ref$deleteApiKey,
4378
+ _ref$handleGenerateAp = _ref.handleGenerateApiKey,
4379
+ handleGenerateApiKey = _ref$handleGenerateAp === void 0 ? pure.noop : _ref$handleGenerateAp,
4380
+ _ref$setNewZapierApiK = _ref.setNewZapierApiKey,
4381
+ setNewZapierApiKey = _ref$setNewZapierApiK === void 0 ? pure.noop : _ref$setNewZapierApiK,
4382
+ _ref$setIsDemoModalOp = _ref.setIsDemoModalOpen,
4383
+ setIsDemoModalOpen = _ref$setIsDemoModalOp === void 0 ? pure.noop : _ref$setIsDemoModalOp;
4384
+ var _useTranslation = useTranslation(),
4385
+ t = _useTranslation.t;
4386
+ if (isLoading) return /*#__PURE__*/React__default["default"].createElement(neetoui.Spinner, null);
4387
+ return /*#__PURE__*/React__default["default"].createElement("div", {
4388
+ className: "w-full max-w-xl space-y-10 p-10"
4389
+ }, pure.isNotEmpty(newZapierApiKey) && /*#__PURE__*/React__default["default"].createElement(NewZapierApiKey, {
4390
+ apiKey: newZapierApiKey
4391
+ }), /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
4392
+ style: "h2"
4393
+ }, t("zapier.apiKeys")), ramda.isEmpty(zapierApiKeys) && /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
4394
+ style: "h4"
4395
+ }, t("zapier.emptyText")), /*#__PURE__*/React__default["default"].createElement(GenerateKey, {
4396
+ handleSubmit: handleGenerateApiKey,
4397
+ isLoading: isGenerating
4398
+ }), /*#__PURE__*/React__default["default"].createElement(ApiKeysList, {
4399
+ apiKeys: zapierApiKeys,
4400
+ deleteApiKey: deleteApiKey,
4401
+ isDeleting: isDeleting,
4402
+ setNewZapierApiKey: setNewZapierApiKey
4403
+ }), pure.isNotEmpty(videoUrl) && /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
4404
+ className: "mb-6",
4405
+ label: t("zapier.walkthroughText"),
4406
+ style: "link",
4407
+ onClick: function onClick() {
4408
+ return setIsDemoModalOpen(true);
4409
+ }
4410
+ }));
4411
+ };
4412
+
3626
4413
  var e = [],
3627
4414
  t = [];
3628
4415
  function n(n, r) {
@@ -3653,4 +4440,5 @@ exports.Connect = Connect;
3653
4440
  exports.Demo = Demo;
3654
4441
  exports.Finish = Finish;
3655
4442
  exports.Modal = Modal;
4443
+ exports.ZapierForm = ZapierForm;
3656
4444
  //# sourceMappingURL=index.cjs.js.map