@thecb/components 3.4.2 → 3.5.2
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 +790 -392
- package/package.json +1 -1
- package/src/components/atoms/dropdown/Dropdown.js +2 -3
- package/src/components/atoms/icons/TimeoutImage.js +138 -0
- package/src/components/atoms/icons/index.js +2 -0
- package/src/components/molecules/index.js +1 -0
- package/src/components/molecules/obligation/modules/AutopayModalModule.js +1 -1
- package/src/components/molecules/timeout/Timeout.js +46 -0
- package/src/components/molecules/timeout/index.js +3 -0
- package/.tool-versions +0 -1
package/dist/index.cjs.js
CHANGED
|
@@ -215,6 +215,63 @@ function _nonIterableRest() {
|
|
|
215
215
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
+
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
219
|
+
var it;
|
|
220
|
+
|
|
221
|
+
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
|
|
222
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
223
|
+
if (it) o = it;
|
|
224
|
+
var i = 0;
|
|
225
|
+
|
|
226
|
+
var F = function () {};
|
|
227
|
+
|
|
228
|
+
return {
|
|
229
|
+
s: F,
|
|
230
|
+
n: function () {
|
|
231
|
+
if (i >= o.length) return {
|
|
232
|
+
done: true
|
|
233
|
+
};
|
|
234
|
+
return {
|
|
235
|
+
done: false,
|
|
236
|
+
value: o[i++]
|
|
237
|
+
};
|
|
238
|
+
},
|
|
239
|
+
e: function (e) {
|
|
240
|
+
throw e;
|
|
241
|
+
},
|
|
242
|
+
f: F
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
var normalCompletion = true,
|
|
250
|
+
didErr = false,
|
|
251
|
+
err;
|
|
252
|
+
return {
|
|
253
|
+
s: function () {
|
|
254
|
+
it = o[Symbol.iterator]();
|
|
255
|
+
},
|
|
256
|
+
n: function () {
|
|
257
|
+
var step = it.next();
|
|
258
|
+
normalCompletion = step.done;
|
|
259
|
+
return step;
|
|
260
|
+
},
|
|
261
|
+
e: function (e) {
|
|
262
|
+
didErr = true;
|
|
263
|
+
err = e;
|
|
264
|
+
},
|
|
265
|
+
f: function () {
|
|
266
|
+
try {
|
|
267
|
+
if (!normalCompletion && it.return != null) it.return();
|
|
268
|
+
} finally {
|
|
269
|
+
if (didErr) throw err;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
|
|
218
275
|
/*! *****************************************************************************
|
|
219
276
|
Copyright (c) Microsoft Corporation.
|
|
220
277
|
|
|
@@ -13630,6 +13687,127 @@ var IconAdd = function IconAdd() {
|
|
|
13630
13687
|
}))))));
|
|
13631
13688
|
};
|
|
13632
13689
|
|
|
13690
|
+
var TimeoutImage = function TimeoutImage() {
|
|
13691
|
+
return /*#__PURE__*/React__default.createElement("svg", {
|
|
13692
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
13693
|
+
width: "100%",
|
|
13694
|
+
height: "100%",
|
|
13695
|
+
viewBox: "0 0 458 308"
|
|
13696
|
+
}, /*#__PURE__*/React__default.createElement("g", {
|
|
13697
|
+
fill: "none",
|
|
13698
|
+
fillRule: "evenodd",
|
|
13699
|
+
stroke: "none",
|
|
13700
|
+
strokeWidth: "1"
|
|
13701
|
+
}, /*#__PURE__*/React__default.createElement("g", {
|
|
13702
|
+
transform: "translate(-492 -168)"
|
|
13703
|
+
}, /*#__PURE__*/React__default.createElement("g", {
|
|
13704
|
+
transform: "translate(492 168)"
|
|
13705
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
|
13706
|
+
fill: "#EAF4EB",
|
|
13707
|
+
d: "M286.327 294.916c0 7.133-26.041 12.916-58.164 12.916-32.123 0-58.163-5.783-58.163-12.916S196.04 282 228.163 282s58.164 5.783 58.164 12.916"
|
|
13708
|
+
}), /*#__PURE__*/React__default.createElement("g", {
|
|
13709
|
+
stroke: "#45B770",
|
|
13710
|
+
strokeLinecap: "round",
|
|
13711
|
+
strokeLinejoin: "round",
|
|
13712
|
+
strokeWidth: "8.362",
|
|
13713
|
+
transform: "translate(204 268)"
|
|
13714
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
|
13715
|
+
d: "M15.817 -2.13162821e-14L15.817 24.795 3.55271368e-15 24.795"
|
|
13716
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
13717
|
+
d: "M31.3102 -2.30926389e-14L31.3102 25.574 47.1272 25.574"
|
|
13718
|
+
})), /*#__PURE__*/React__default.createElement("path", {
|
|
13719
|
+
fill: "#FEFEFE",
|
|
13720
|
+
d: "M107.968 73h239.721a6.969 6.969 0 016.969 6.968v178.398a6.969 6.969 0 01-6.969 6.968H107.968a6.968 6.968 0 01-6.968-6.968V79.968A6.968 6.968 0 01107.968 73"
|
|
13721
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
13722
|
+
fill: "#E4E6EB",
|
|
13723
|
+
d: "M101 99L355 99 355 73 101 73z"
|
|
13724
|
+
}), /*#__PURE__*/React__default.createElement("g", {
|
|
13725
|
+
stroke: "#3B414D",
|
|
13726
|
+
strokeLinecap: "round",
|
|
13727
|
+
strokeWidth: "5.575",
|
|
13728
|
+
transform: "translate(197.811 141.913)"
|
|
13729
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
|
13730
|
+
strokeLinejoin: "round",
|
|
13731
|
+
d: "M0 5.575C1.168 2.317 4.16 0 7.666 0c3.505 0 6.497 2.317 7.665 5.575"
|
|
13732
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
13733
|
+
strokeLinejoin: "round",
|
|
13734
|
+
d: "M46 5.575C47.168 2.317 50.16 0 53.666 0c3.505 0 6.497 2.317 7.665 5.575"
|
|
13735
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
13736
|
+
d: "M50.38 44.087h0a6.886 6.886 0 01-6.886 6.886h-26.42a6.886 6.886 0 01-6.885-6.886",
|
|
13737
|
+
transform: "matrix(1 0 0 -1 0 95.06)"
|
|
13738
|
+
})), /*#__PURE__*/React__default.createElement("path", {
|
|
13739
|
+
fill: "#3B414D",
|
|
13740
|
+
d: "M124 83a3 3 0 110 6 3 3 0 010-6zm-10 0a3 3 0 110 6 3 3 0 010-6zm20 0a3 3 0 110 6 3 3 0 010-6z"
|
|
13741
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
13742
|
+
stroke: "#45B770",
|
|
13743
|
+
strokeLinecap: "round",
|
|
13744
|
+
strokeLinejoin: "round",
|
|
13745
|
+
strokeWidth: "8",
|
|
13746
|
+
d: "M99.441 205.181L77.181 224.512"
|
|
13747
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
13748
|
+
stroke: "#45B770",
|
|
13749
|
+
strokeLinecap: "round",
|
|
13750
|
+
strokeLinejoin: "round",
|
|
13751
|
+
strokeWidth: "8",
|
|
13752
|
+
d: "M412.8955 190.764648L381.126953 224.790039 356 205.267859"
|
|
13753
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
13754
|
+
stroke: "#45B770",
|
|
13755
|
+
strokeLinecap: "round",
|
|
13756
|
+
strokeWidth: "8",
|
|
13757
|
+
d: "M396.5 189.5L429.5 189.5"
|
|
13758
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
13759
|
+
stroke: "#45B770",
|
|
13760
|
+
strokeLinecap: "round",
|
|
13761
|
+
strokeLinejoin: "round",
|
|
13762
|
+
strokeWidth: "8",
|
|
13763
|
+
d: "M137.079 231.103a7.605 7.605 0 000 15.211h6.644"
|
|
13764
|
+
}), /*#__PURE__*/React__default.createElement("g", {
|
|
13765
|
+
transform: "translate(377 63)"
|
|
13766
|
+
}, /*#__PURE__*/React__default.createElement("g", null, /*#__PURE__*/React__default.createElement("path", {
|
|
13767
|
+
fill: "#FFF",
|
|
13768
|
+
d: "M66.669 116.462H5.122a5.122 5.122 0 110-10.243h61.547a5.122 5.122 0 110 10.243"
|
|
13769
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
13770
|
+
fill: "#E4F4FD",
|
|
13771
|
+
d: "M15.126 71.521l20.77-13.29 20.769 13.29a19.123 19.123 0 018.815 16.106v18.591H6.311v-18.59c0-6.52 3.323-12.592 8.815-16.107z"
|
|
13772
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
13773
|
+
fill: "#E4F4FD",
|
|
13774
|
+
d: "M56.665 44.94l-20.77 13.292L15.126 44.94a19.12 19.12 0 01-8.815-16.106V10.244H65.48v18.59a19.12 19.12 0 01-8.815 16.107z"
|
|
13775
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
13776
|
+
fill: "#FFF",
|
|
13777
|
+
d: "M66.669 10.244H5.122A5.122 5.122 0 115.122 0h61.547a5.122 5.122 0 110 10.244z"
|
|
13778
|
+
})), /*#__PURE__*/React__default.createElement("g", {
|
|
13779
|
+
stroke: "#3B414D",
|
|
13780
|
+
strokeLinecap: "round",
|
|
13781
|
+
strokeWidth: "6"
|
|
13782
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
|
13783
|
+
d: "M66.669 116.462H5.122a5.122 5.122 0 110-10.243h61.547a5.122 5.122 0 110 10.243z"
|
|
13784
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
13785
|
+
d: "M15.126 71.521l20.77-13.29 20.769 13.29a19.123 19.123 0 018.815 16.106v18.591H6.311v-18.59c0-6.52 3.323-12.592 8.815-16.107z"
|
|
13786
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
13787
|
+
d: "M56.665 44.94l-20.77 13.292L15.126 44.94a19.12 19.12 0 01-8.815-16.106V10.244H65.48v18.59a19.12 19.12 0 01-8.815 16.107z"
|
|
13788
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
13789
|
+
d: "M66.669 10.244H5.122A5.122 5.122 0 115.122 0h61.547a5.122 5.122 0 110 10.244z"
|
|
13790
|
+
}))), /*#__PURE__*/React__default.createElement("path", {
|
|
13791
|
+
stroke: "#3B414D",
|
|
13792
|
+
strokeLinecap: "round",
|
|
13793
|
+
strokeWidth: "8",
|
|
13794
|
+
d: "M27.663 247.376l-15.18.348M401 248l-44.96-.276m-256.445-.348l-52.372.348M454 248h-34"
|
|
13795
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
13796
|
+
stroke: "#3B414D",
|
|
13797
|
+
strokeWidth: "6",
|
|
13798
|
+
d: "M107.969 73H347.69a6.969 6.969 0 016.968 6.969v178.397a6.968 6.968 0 01-6.968 6.968H107.969a6.969 6.969 0 01-6.969-6.968V79.969A6.969 6.969 0 01107.969 73zM104 99h248"
|
|
13799
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
13800
|
+
stroke: "#45B770",
|
|
13801
|
+
strokeLinecap: "round",
|
|
13802
|
+
strokeLinejoin: "round",
|
|
13803
|
+
strokeWidth: "8",
|
|
13804
|
+
d: "M77.181 224.512L127.905 236.375"
|
|
13805
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
13806
|
+
fill: "#B8E4F4",
|
|
13807
|
+
d: "M95.74 141.218c5.753 0 10.652 3.602 12.599 8.67a5.733 5.733 0 016.092 1.987 8.512 8.512 0 013.505-.757 8.557 8.557 0 110 17.114H81.002a8.557 8.557 0 111.69-16.945c1.523-5.792 6.78-10.069 13.049-10.069zM365.823 82c9.17 0 16.7 7.01 17.532 15.963a10.567 10.567 0 016.175-1.99c5.868 0 10.625 4.757 10.625 10.625 0 5.869-4.757 10.625-10.625 10.625h-48.094c-6.868 0-12.435-5.566-12.435-12.434 0-6.868 5.567-12.435 12.435-12.435 2.791 0 5.36.931 7.435 2.484C350.952 87.432 357.75 82 365.822 82zM23.296 75.456c5.752 0 10.651 3.602 12.598 8.669a5.733 5.733 0 011.559-.22c1.84 0 3.476.866 4.532 2.208a8.52 8.52 0 013.506-.757 8.557 8.557 0 110 17.114H8.557a8.557 8.557 0 111.69-16.945c1.523-5.792 6.78-10.07 13.049-10.07zM170.219 8.845c10.946 0 19.935 8.367 20.927 19.054a12.618 12.618 0 017.372-2.375c7.004 0 12.683 5.679 12.683 12.684 0 7.004-5.68 12.683-12.683 12.683h-57.41c-8.197 0-14.843-6.646-14.843-14.844 0-8.197 6.646-14.843 14.843-14.843 3.333 0 6.398 1.112 8.876 2.966 2.485-8.841 10.599-15.325 20.235-15.325zM297.892 0c5.752 0 10.651 3.602 12.598 8.669a5.728 5.728 0 011.56-.219c1.84 0 3.475.865 4.531 2.207a8.516 8.516 0 013.506-.757 8.557 8.557 0 110 17.114h-36.935a8.557 8.557 0 01-8.556-8.557 8.557 8.557 0 0110.248-8.388C286.366 4.277 291.622 0 297.892 0z"
|
|
13808
|
+
})))));
|
|
13809
|
+
};
|
|
13810
|
+
|
|
13633
13811
|
var AutopayOnIcon = function AutopayOnIcon(_ref) {
|
|
13634
13812
|
var themeValues = _ref.themeValues;
|
|
13635
13813
|
return /*#__PURE__*/React__default.createElement("svg", {
|
|
@@ -16887,15 +17065,14 @@ var Dropdown = function Dropdown(_ref7) {
|
|
|
16887
17065
|
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
16888
17066
|
as: "button",
|
|
16889
17067
|
background: isOpen ? themeValues.hoverColor : WHITE,
|
|
16890
|
-
minHeight: "52px",
|
|
16891
17068
|
width: "100%",
|
|
16892
|
-
padding: "
|
|
17069
|
+
padding: "12px",
|
|
16893
17070
|
hoverStyles: "background-color: ".concat(themeValues.hoverColor, ";"),
|
|
16894
17071
|
focusStyles: "background-color: ".concat(themeValues.hoverColor, ";"),
|
|
16895
17072
|
borderSize: "1px",
|
|
16896
17073
|
borderColor: isError ? ERROR_COLOR : isOpen ? themeValues.selectedColor : GREY_CHATEAU,
|
|
16897
17074
|
borderRadius: "2px",
|
|
16898
|
-
extraStyles: "tabindex: 0;",
|
|
17075
|
+
extraStyles: "tabindex: 0; height: 48px;",
|
|
16899
17076
|
dataQa: placeholder
|
|
16900
17077
|
}, /*#__PURE__*/React__default.createElement(Stack, {
|
|
16901
17078
|
direction: "row",
|
|
@@ -30395,378 +30572,401 @@ var ToggleSwitch = function ToggleSwitch(_ref6) {
|
|
|
30395
30572
|
|
|
30396
30573
|
var ToggleSwitch$1 = themeComponent(ToggleSwitch, "ToggleSwitch", fallbackValues$o);
|
|
30397
30574
|
|
|
30398
|
-
|
|
30399
|
-
value
|
|
30400
|
-
|
|
30401
|
-
|
|
30575
|
+
var validatorToPredicate = function validatorToPredicate(validatorFn, emptyCase) {
|
|
30576
|
+
return function (value) {
|
|
30577
|
+
for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
30578
|
+
rest[_key - 1] = arguments[_key];
|
|
30579
|
+
}
|
|
30402
30580
|
|
|
30581
|
+
return value === "" ? emptyCase : validatorFn.apply(void 0, [value].concat(rest));
|
|
30582
|
+
};
|
|
30583
|
+
};
|
|
30403
30584
|
/* eslint-disable no-unused-vars */
|
|
30404
30585
|
|
|
30405
|
-
|
|
30406
|
-
|
|
30586
|
+
|
|
30587
|
+
var createValidator = function createValidator(type, error) {
|
|
30588
|
+
var validator = function validator() {
|
|
30589
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
30590
|
+
args[_key2] = arguments[_key2];
|
|
30591
|
+
}
|
|
30592
|
+
|
|
30593
|
+
return {
|
|
30594
|
+
type: type,
|
|
30595
|
+
args: args,
|
|
30596
|
+
error: error
|
|
30597
|
+
};
|
|
30598
|
+
};
|
|
30599
|
+
|
|
30407
30600
|
validator.error = error;
|
|
30408
30601
|
return validator;
|
|
30409
30602
|
};
|
|
30410
30603
|
|
|
30411
|
-
|
|
30604
|
+
var validatorFns = {};
|
|
30605
|
+
var REQUIRED = "validator/REQUIRED";
|
|
30606
|
+
var REQUIRED_ERROR = "error/REQUIRED";
|
|
30607
|
+
var required = createValidator(REQUIRED, REQUIRED_ERROR);
|
|
30412
30608
|
|
|
30413
|
-
|
|
30414
|
-
|
|
30415
|
-
|
|
30416
|
-
validatorFns[REQUIRED] = (value, args, form) => value !== "";
|
|
30609
|
+
validatorFns[REQUIRED] = function (value, args, form) {
|
|
30610
|
+
return value !== "";
|
|
30611
|
+
};
|
|
30417
30612
|
|
|
30418
|
-
|
|
30419
|
-
|
|
30420
|
-
|
|
30421
|
-
validatorFns[ONLY_INTEGERS] = (value, args, form) => /^(-?\d+)?$/.test(value);
|
|
30613
|
+
var ONLY_INTEGERS = "validator/ONLY_INTEGERS";
|
|
30614
|
+
var ONLY_INTEGERS_ERROR = "error/ONLY_INTEGERS";
|
|
30615
|
+
var onlyIntegers = createValidator(ONLY_INTEGERS, ONLY_INTEGERS_ERROR);
|
|
30422
30616
|
|
|
30423
|
-
|
|
30424
|
-
|
|
30425
|
-
|
|
30426
|
-
validatorFns[ONLY_NATURALS] = (value, args, form) => /^(\d+)?$/.test(value);
|
|
30617
|
+
validatorFns[ONLY_INTEGERS] = function (value, args, form) {
|
|
30618
|
+
return /^(-?\d+)?$/.test(value);
|
|
30619
|
+
};
|
|
30427
30620
|
|
|
30428
|
-
|
|
30429
|
-
|
|
30430
|
-
|
|
30431
|
-
|
|
30432
|
-
|
|
30433
|
-
);
|
|
30434
|
-
|
|
30621
|
+
var ONLY_NATURALS = "validator/ONLY_NATURALS";
|
|
30622
|
+
var ONLY_NATURALS_ERROR = "error/ONLY_NATURALS";
|
|
30623
|
+
var onlyNaturals = createValidator(ONLY_NATURALS, ONLY_NATURALS_ERROR);
|
|
30624
|
+
|
|
30625
|
+
validatorFns[ONLY_NATURALS] = function (value, args, form) {
|
|
30626
|
+
return /^(\d+)?$/.test(value);
|
|
30627
|
+
};
|
|
30628
|
+
|
|
30629
|
+
var NUMBER_LESS_THAN = "validator/NUMBER_LESS_THAN";
|
|
30630
|
+
var NUMBER_LESS_THAN_ERROR = "error/NUMBER_LESS_THAN";
|
|
30631
|
+
var numberLessThan = createValidator(NUMBER_LESS_THAN, NUMBER_LESS_THAN_ERROR);
|
|
30632
|
+
|
|
30633
|
+
validatorFns[NUMBER_LESS_THAN] = function (value, args, form) {
|
|
30435
30634
|
if (value === "") {
|
|
30436
30635
|
return true;
|
|
30437
30636
|
}
|
|
30637
|
+
|
|
30438
30638
|
return Number(value) < args[0];
|
|
30439
30639
|
};
|
|
30440
30640
|
|
|
30441
|
-
|
|
30442
|
-
|
|
30443
|
-
|
|
30444
|
-
|
|
30445
|
-
|
|
30446
|
-
NUMBER_LESS_THAN_OR_EQUAL_TO,
|
|
30447
|
-
NUMBER_LESS_THAN_OR_EQUAL_TO_ERROR
|
|
30448
|
-
);
|
|
30449
|
-
validatorFns[NUMBER_LESS_THAN_OR_EQUAL_TO] = (value, args, form) => {
|
|
30641
|
+
var NUMBER_LESS_THAN_OR_EQUAL_TO = "validator/NUMBER_LESS_THAN_OR_EQUAL_TO";
|
|
30642
|
+
var NUMBER_LESS_THAN_OR_EQUAL_TO_ERROR = "error/NUMBER_LESS_THAN_OR_EQUAL_TO";
|
|
30643
|
+
var numberLessThanOrEqualTo = createValidator(NUMBER_LESS_THAN_OR_EQUAL_TO, NUMBER_LESS_THAN_OR_EQUAL_TO_ERROR);
|
|
30644
|
+
|
|
30645
|
+
validatorFns[NUMBER_LESS_THAN_OR_EQUAL_TO] = function (value, args, form) {
|
|
30450
30646
|
if (value === "") {
|
|
30451
30647
|
return true;
|
|
30452
30648
|
}
|
|
30649
|
+
|
|
30453
30650
|
return Number(value) <= args[0];
|
|
30454
30651
|
};
|
|
30455
30652
|
|
|
30456
|
-
|
|
30457
|
-
|
|
30458
|
-
|
|
30459
|
-
|
|
30460
|
-
|
|
30461
|
-
);
|
|
30462
|
-
validatorFns[NUMBER_GREATER_THAN] = (value, args, form) => {
|
|
30653
|
+
var NUMBER_GREATER_THAN = "validator/NUMBER_GREATER_THAN";
|
|
30654
|
+
var NUMBER_GREATER_THAN_ERROR = "error/NUMBER_GREATER_THAN";
|
|
30655
|
+
var numberGreaterThan = createValidator(NUMBER_GREATER_THAN, NUMBER_GREATER_THAN_ERROR);
|
|
30656
|
+
|
|
30657
|
+
validatorFns[NUMBER_GREATER_THAN] = function (value, args, form) {
|
|
30463
30658
|
if (value === "") {
|
|
30464
30659
|
return true;
|
|
30465
30660
|
}
|
|
30661
|
+
|
|
30466
30662
|
return Number(value) > args[0];
|
|
30467
30663
|
};
|
|
30468
30664
|
|
|
30469
|
-
|
|
30470
|
-
|
|
30471
|
-
|
|
30472
|
-
|
|
30473
|
-
|
|
30474
|
-
NUMBER_GREATER_THAN_OR_EQUAL_TO,
|
|
30475
|
-
NUMBER_GREATER_THAN_OR_EQUAL_TO_ERROR
|
|
30476
|
-
);
|
|
30477
|
-
validatorFns[NUMBER_GREATER_THAN_OR_EQUAL_TO] = (value, args, form) => {
|
|
30665
|
+
var NUMBER_GREATER_THAN_OR_EQUAL_TO = "validator/NUMBER_GREATER_THAN_OR_EQUAL_TO";
|
|
30666
|
+
var NUMBER_GREATER_THAN_OR_EQUAL_TO_ERROR = "error/NUMBER_GREATER_THAN_OR_EQUAL_TO";
|
|
30667
|
+
var numberGreaterThanOrEqualTo = createValidator(NUMBER_GREATER_THAN_OR_EQUAL_TO, NUMBER_GREATER_THAN_OR_EQUAL_TO_ERROR);
|
|
30668
|
+
|
|
30669
|
+
validatorFns[NUMBER_GREATER_THAN_OR_EQUAL_TO] = function (value, args, form) {
|
|
30478
30670
|
if (value === "") {
|
|
30479
30671
|
return true;
|
|
30480
30672
|
}
|
|
30673
|
+
|
|
30481
30674
|
return Number(value) >= args[0];
|
|
30482
30675
|
};
|
|
30483
30676
|
|
|
30484
|
-
|
|
30485
|
-
|
|
30486
|
-
|
|
30487
|
-
|
|
30677
|
+
var MATCHES_FIELD = "validator/MATCHES_FIELD";
|
|
30678
|
+
var MATCHES_FIELD_ERROR$1 = "error/MATCHES_FIELD";
|
|
30679
|
+
var matchesField = createValidator(MATCHES_FIELD, MATCHES_FIELD_ERROR$1);
|
|
30680
|
+
|
|
30681
|
+
validatorFns[MATCHES_FIELD] = function (value, args, form) {
|
|
30488
30682
|
if (value === "") {
|
|
30489
30683
|
return true;
|
|
30490
30684
|
}
|
|
30685
|
+
|
|
30491
30686
|
if (form[args[0]] === undefined) {
|
|
30492
|
-
throw new Error(
|
|
30493
|
-
`${args[0]} was passed to matchesField, but that field does not exist in the form`
|
|
30494
|
-
);
|
|
30687
|
+
throw new Error("".concat(args[0], " was passed to matchesField, but that field does not exist in the form"));
|
|
30495
30688
|
}
|
|
30689
|
+
|
|
30496
30690
|
return value === form[args[0]].rawValue;
|
|
30497
30691
|
};
|
|
30498
30692
|
|
|
30499
|
-
|
|
30500
|
-
|
|
30501
|
-
|
|
30502
|
-
|
|
30503
|
-
|
|
30504
|
-
|
|
30505
|
-
|
|
30506
|
-
|
|
30507
|
-
|
|
30508
|
-
|
|
30509
|
-
|
|
30510
|
-
|
|
30511
|
-
|
|
30512
|
-
|
|
30513
|
-
|
|
30514
|
-
type: VALIDATE_WHEN,
|
|
30515
|
-
args: [dependentValidator, primaryValidator, optionalFieldName],
|
|
30516
|
-
error: dependentValidator.error
|
|
30517
|
-
});
|
|
30693
|
+
var validateWhenErrorMessage = function validateWhenErrorMessage(type) {
|
|
30694
|
+
return "".concat(type, " was passed to validateWhen, but that validator type does not exist.\n Please check that you are only calling validator creator functions exported from\n redux-freeform in your form config and that you didn't forget to\n invoke the validator creator (you cannot pass the functions themselves to\n createFormState). Also make sure you aren't passing validateWhen() to validateWhen\n as the primary validator.");
|
|
30695
|
+
};
|
|
30696
|
+
|
|
30697
|
+
var VALIDATE_WHEN = "validator/VALIDATE_WHEN";
|
|
30698
|
+
var VALIDATE_WHEN_ERROR = "error/VALIDATE_WHEN";
|
|
30699
|
+
|
|
30700
|
+
var validateWhen = function validateWhen(dependentValidator, primaryValidator, optionalFieldName) {
|
|
30701
|
+
return {
|
|
30702
|
+
type: VALIDATE_WHEN,
|
|
30703
|
+
args: [dependentValidator, primaryValidator, optionalFieldName],
|
|
30704
|
+
error: dependentValidator.error
|
|
30705
|
+
};
|
|
30706
|
+
};
|
|
30707
|
+
|
|
30518
30708
|
validateWhen.error = VALIDATE_WHEN_ERROR;
|
|
30519
|
-
validatorFns[VALIDATE_WHEN] = (value, args, form) => {
|
|
30520
|
-
const [dependentValidator, primaryValidator, optionalFieldName] = args;
|
|
30521
|
-
const dependsOnOtherField = typeof optionalFieldName === "string";
|
|
30522
30709
|
|
|
30523
|
-
|
|
30524
|
-
|
|
30525
|
-
|
|
30526
|
-
|
|
30710
|
+
validatorFns[VALIDATE_WHEN] = function (value, args, form) {
|
|
30711
|
+
var _args = _slicedToArray(args, 3),
|
|
30712
|
+
dependentValidator = _args[0],
|
|
30713
|
+
primaryValidator = _args[1],
|
|
30714
|
+
optionalFieldName = _args[2];
|
|
30715
|
+
|
|
30716
|
+
var dependsOnOtherField = typeof optionalFieldName === "string";
|
|
30717
|
+
|
|
30718
|
+
if (primaryValidator.type === undefined || typeof validatorFns[primaryValidator.type] !== "function") {
|
|
30527
30719
|
throw new Error(validateWhenErrorMessage(primaryValidator.type));
|
|
30528
30720
|
}
|
|
30721
|
+
|
|
30529
30722
|
if (dependsOnOtherField && form[optionalFieldName] === undefined) {
|
|
30530
|
-
throw new Error(
|
|
30531
|
-
`${args[2]} was passed to matchesField, but that field does not exist in the form`
|
|
30532
|
-
);
|
|
30723
|
+
throw new Error("".concat(args[2], " was passed to matchesField, but that field does not exist in the form"));
|
|
30533
30724
|
}
|
|
30534
30725
|
|
|
30535
|
-
|
|
30536
|
-
|
|
30537
|
-
|
|
30538
|
-
);
|
|
30539
|
-
|
|
30540
|
-
|
|
30541
|
-
|
|
30542
|
-
|
|
30543
|
-
|
|
30544
|
-
|
|
30545
|
-
|
|
30546
|
-
|
|
30726
|
+
var primaryPredicate = validatorToPredicate(validatorFns[primaryValidator.type], false);
|
|
30727
|
+
var primaryValue = dependsOnOtherField ? form[optionalFieldName].rawValue : value;
|
|
30728
|
+
var primaryPredicatePassed = primaryPredicate(primaryValue, primaryValidator.args, form);
|
|
30729
|
+
return primaryPredicatePassed ? validatorFns[dependentValidator.type](value, dependentValidator.args, form) : true;
|
|
30730
|
+
};
|
|
30731
|
+
|
|
30732
|
+
var validateSumErrorMessage = function validateSumErrorMessage(type) {
|
|
30733
|
+
return "".concat(type, " was passed to validateSum, but that validator type does not exist.\n Please check that you are only calling validator creator functions exported from\n redux-freeform in your form config and that you didn't forget to\n invoke the validator creator (you cannot pass the functions themselves to\n createFormState).");
|
|
30734
|
+
};
|
|
30735
|
+
|
|
30736
|
+
var VALIDATE_SUM = "validator/VALIDATE_SUM";
|
|
30737
|
+
var VALIDATE_SUM_ERROR = "error/VALIDATE_SUM";
|
|
30738
|
+
|
|
30739
|
+
var validateSum = function validateSum(validator, fieldNamesArray) {
|
|
30740
|
+
return {
|
|
30741
|
+
type: VALIDATE_SUM,
|
|
30742
|
+
args: [validator, fieldNamesArray],
|
|
30743
|
+
error: validator.error
|
|
30744
|
+
};
|
|
30745
|
+
};
|
|
30547
30746
|
|
|
30548
|
-
return primaryPredicatePassed
|
|
30549
|
-
? validatorFns[dependentValidator.type](
|
|
30550
|
-
value,
|
|
30551
|
-
dependentValidator.args,
|
|
30552
|
-
form
|
|
30553
|
-
)
|
|
30554
|
-
: true;
|
|
30555
|
-
};
|
|
30556
|
-
|
|
30557
|
-
const validateSumErrorMessage = type =>
|
|
30558
|
-
`${type} was passed to validateSum, but that validator type does not exist.
|
|
30559
|
-
Please check that you are only calling validator creator functions exported from
|
|
30560
|
-
redux-freeform in your form config and that you didn't forget to
|
|
30561
|
-
invoke the validator creator (you cannot pass the functions themselves to
|
|
30562
|
-
createFormState).`;
|
|
30563
|
-
const VALIDATE_SUM = "validator/VALIDATE_SUM";
|
|
30564
|
-
const VALIDATE_SUM_ERROR = "error/VALIDATE_SUM";
|
|
30565
|
-
const validateSum = (validator, fieldNamesArray) => ({
|
|
30566
|
-
type: VALIDATE_SUM,
|
|
30567
|
-
args: [validator, fieldNamesArray],
|
|
30568
|
-
error: validator.error
|
|
30569
|
-
});
|
|
30570
30747
|
validateSum.error = VALIDATE_SUM_ERROR;
|
|
30571
|
-
validatorFns[VALIDATE_SUM] = (value, args, form) => {
|
|
30572
|
-
const [validator, fieldNamesArray] = args;
|
|
30573
30748
|
|
|
30574
|
-
|
|
30575
|
-
|
|
30576
|
-
|
|
30577
|
-
|
|
30749
|
+
validatorFns[VALIDATE_SUM] = function (value, args, form) {
|
|
30750
|
+
var _args2 = _slicedToArray(args, 2),
|
|
30751
|
+
validator = _args2[0],
|
|
30752
|
+
fieldNamesArray = _args2[1];
|
|
30753
|
+
|
|
30754
|
+
if (validator.type === undefined || typeof validatorFns[validator.type] !== "function") {
|
|
30578
30755
|
throw new Error(validateSumErrorMessage(validator.type));
|
|
30579
30756
|
}
|
|
30580
30757
|
|
|
30581
|
-
|
|
30582
|
-
|
|
30583
|
-
|
|
30584
|
-
|
|
30585
|
-
|
|
30758
|
+
var _iterator = _createForOfIteratorHelper(fieldNamesArray),
|
|
30759
|
+
_step;
|
|
30760
|
+
|
|
30761
|
+
try {
|
|
30762
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
30763
|
+
var fieldName = _step.value;
|
|
30764
|
+
|
|
30765
|
+
if (form[fieldName] === undefined) {
|
|
30766
|
+
throw new Error("".concat(fieldName, " was passed to matchesField, but that field does not exist in the form"));
|
|
30767
|
+
}
|
|
30586
30768
|
}
|
|
30769
|
+
} catch (err) {
|
|
30770
|
+
_iterator.e(err);
|
|
30771
|
+
} finally {
|
|
30772
|
+
_iterator.f();
|
|
30587
30773
|
}
|
|
30588
30774
|
|
|
30589
|
-
|
|
30590
|
-
|
|
30591
|
-
|
|
30592
|
-
);
|
|
30593
|
-
|
|
30775
|
+
var sum = fieldNamesArray.reduce(function (acc, curr) {
|
|
30776
|
+
return acc + Number(form[curr].rawValue);
|
|
30777
|
+
}, Number(value));
|
|
30594
30778
|
return validatorFns[validator.type](sum, validator.args, form);
|
|
30595
30779
|
};
|
|
30596
30780
|
|
|
30597
|
-
|
|
30598
|
-
|
|
30599
|
-
|
|
30600
|
-
|
|
30781
|
+
var HAS_LENGTH = "validator/HAS_LENGTH";
|
|
30782
|
+
var HAS_LENGTH_ERROR = "error/HAS_LENGTH";
|
|
30783
|
+
var hasLength = createValidator(HAS_LENGTH, HAS_LENGTH_ERROR);
|
|
30784
|
+
|
|
30785
|
+
validatorFns[HAS_LENGTH] = function (value, args, form) {
|
|
30601
30786
|
if (value === "") {
|
|
30602
30787
|
return true;
|
|
30603
30788
|
}
|
|
30604
|
-
|
|
30605
|
-
|
|
30789
|
+
|
|
30790
|
+
var min = args[0];
|
|
30791
|
+
var max = args[1];
|
|
30792
|
+
|
|
30606
30793
|
if (max == undefined || min == undefined) {
|
|
30607
|
-
throw new Error(
|
|
30608
|
-
"Max and min need to be defined for hasLength, both or one of them is undefined"
|
|
30609
|
-
);
|
|
30794
|
+
throw new Error("Max and min need to be defined for hasLength, both or one of them is undefined");
|
|
30610
30795
|
}
|
|
30796
|
+
|
|
30611
30797
|
if (max < min) {
|
|
30612
|
-
throw new Error(
|
|
30613
|
-
"hasLength validator was passed a min greater than the max"
|
|
30614
|
-
);
|
|
30798
|
+
throw new Error("hasLength validator was passed a min greater than the max");
|
|
30615
30799
|
}
|
|
30616
|
-
|
|
30800
|
+
|
|
30801
|
+
var valueLength = value.length;
|
|
30617
30802
|
return max >= valueLength && valueLength >= min;
|
|
30618
30803
|
};
|
|
30619
30804
|
|
|
30620
|
-
|
|
30621
|
-
|
|
30622
|
-
|
|
30623
|
-
|
|
30805
|
+
var MATCHES_REGEX = "validator/MATCHES_REGEX";
|
|
30806
|
+
var MATCHES_REGEX_ERROR = "error/MATCHES_REGEX";
|
|
30807
|
+
var matchesRegex = createValidator(MATCHES_REGEX, MATCHES_REGEX_ERROR);
|
|
30808
|
+
|
|
30809
|
+
validatorFns[MATCHES_REGEX] = function (value, args, form) {
|
|
30624
30810
|
if (value === "") {
|
|
30625
30811
|
return true;
|
|
30626
30812
|
}
|
|
30813
|
+
|
|
30627
30814
|
return new RegExp(args[0]).test(value); // new RexExp never throws an error, no matter the input
|
|
30628
|
-
};
|
|
30815
|
+
}; // based on http://www.brainjar.com/js/validation/
|
|
30629
30816
|
|
|
30630
|
-
|
|
30631
|
-
|
|
30632
|
-
|
|
30633
|
-
|
|
30634
|
-
|
|
30635
|
-
|
|
30636
|
-
);
|
|
30637
|
-
validatorFns[IS_ROUTING_NUMBER] = (value, args, form) => {
|
|
30817
|
+
|
|
30818
|
+
var IS_ROUTING_NUMBER = "validator/IS_ROUTING_NUMBER";
|
|
30819
|
+
var IS_ROUTING_NUMBER_ERROR = "error/IS_ROUTING_NUMBER";
|
|
30820
|
+
var isRoutingNumber = createValidator(IS_ROUTING_NUMBER, IS_ROUTING_NUMBER_ERROR);
|
|
30821
|
+
|
|
30822
|
+
validatorFns[IS_ROUTING_NUMBER] = function (value, args, form) {
|
|
30638
30823
|
if (value === "") {
|
|
30639
30824
|
return true;
|
|
30640
30825
|
}
|
|
30826
|
+
|
|
30641
30827
|
if (value.length != 9) {
|
|
30642
30828
|
return false;
|
|
30643
30829
|
}
|
|
30644
|
-
|
|
30645
|
-
|
|
30646
|
-
|
|
30647
|
-
|
|
30648
|
-
|
|
30649
|
-
|
|
30650
|
-
|
|
30651
|
-
|
|
30652
|
-
|
|
30653
|
-
|
|
30654
|
-
|
|
30655
|
-
|
|
30656
|
-
|
|
30830
|
+
|
|
30831
|
+
var sum = value.split("").map(function (ch) {
|
|
30832
|
+
return parseInt(ch);
|
|
30833
|
+
}).reduce(function (acc, cur, idx) {
|
|
30834
|
+
switch (idx % 3) {
|
|
30835
|
+
case 0:
|
|
30836
|
+
return acc + 3 * cur;
|
|
30837
|
+
|
|
30838
|
+
case 1:
|
|
30839
|
+
return acc + 7 * cur;
|
|
30840
|
+
|
|
30841
|
+
case 2:
|
|
30842
|
+
return acc + 1 * cur;
|
|
30843
|
+
}
|
|
30844
|
+
}, 0);
|
|
30657
30845
|
return sum != 0 && sum % 10 == 0;
|
|
30658
30846
|
};
|
|
30659
30847
|
|
|
30660
|
-
|
|
30661
|
-
|
|
30662
|
-
|
|
30663
|
-
|
|
30848
|
+
var HAS_NUMBER = "validator/HAS_NUMBER";
|
|
30849
|
+
var HAS_NUMBER_ERROR$1 = "error/HAS_NUMBER";
|
|
30850
|
+
var hasNumber = createValidator(HAS_NUMBER, HAS_NUMBER_ERROR$1);
|
|
30851
|
+
|
|
30852
|
+
validatorFns[HAS_NUMBER] = function (value, args, form) {
|
|
30664
30853
|
if (value === "") {
|
|
30665
30854
|
return true;
|
|
30666
30855
|
}
|
|
30856
|
+
|
|
30667
30857
|
return new RegExp(/[0-9]/).test(value);
|
|
30668
30858
|
};
|
|
30669
30859
|
|
|
30670
|
-
|
|
30671
|
-
|
|
30672
|
-
|
|
30673
|
-
|
|
30674
|
-
|
|
30675
|
-
);
|
|
30676
|
-
validatorFns[HAS_LOWERCASE_LETTER] = (value, args, form) => {
|
|
30860
|
+
var HAS_LOWERCASE_LETTER = "validator/HAS_LOWERCASE_LETTER";
|
|
30861
|
+
var HAS_LOWERCASE_LETTER_ERROR$1 = "error/HAS_LOWERCASE_LETTER";
|
|
30862
|
+
var hasLowercaseLetter = createValidator(HAS_LOWERCASE_LETTER, HAS_LOWERCASE_LETTER_ERROR$1);
|
|
30863
|
+
|
|
30864
|
+
validatorFns[HAS_LOWERCASE_LETTER] = function (value, args, form) {
|
|
30677
30865
|
if (value === "") {
|
|
30678
30866
|
return true;
|
|
30679
30867
|
}
|
|
30868
|
+
|
|
30680
30869
|
return new RegExp(/[a-z]/).test(value);
|
|
30681
30870
|
};
|
|
30682
30871
|
|
|
30683
|
-
|
|
30684
|
-
|
|
30685
|
-
|
|
30686
|
-
|
|
30687
|
-
|
|
30688
|
-
);
|
|
30689
|
-
validatorFns[HAS_UPPERCASE_LETTER] = (value, args, form) => {
|
|
30872
|
+
var HAS_UPPERCASE_LETTER = "validator/HAS_UPPERCASE_LETTER";
|
|
30873
|
+
var HAS_UPPERCASE_LETTER_ERROR$1 = "error/HAS_UPPERCASE_LETTER";
|
|
30874
|
+
var hasUppercaseLetter = createValidator(HAS_UPPERCASE_LETTER, HAS_UPPERCASE_LETTER_ERROR$1);
|
|
30875
|
+
|
|
30876
|
+
validatorFns[HAS_UPPERCASE_LETTER] = function (value, args, form) {
|
|
30690
30877
|
if (value === "") {
|
|
30691
30878
|
return true;
|
|
30692
30879
|
}
|
|
30880
|
+
|
|
30693
30881
|
return new RegExp(/[A-Z]/).test(value);
|
|
30694
30882
|
};
|
|
30695
30883
|
|
|
30696
|
-
|
|
30697
|
-
|
|
30698
|
-
|
|
30699
|
-
|
|
30700
|
-
|
|
30701
|
-
);
|
|
30702
|
-
validatorFns[HAS_SPECIAL_CHARACTER] = (value, args, form) => {
|
|
30884
|
+
var HAS_SPECIAL_CHARACTER = "validator/HAS_SPECIAL_CHARACTER";
|
|
30885
|
+
var HAS_SPECIAL_CHARACTER_ERROR$1 = "error/HAS_SPECIAL_CHARACTER";
|
|
30886
|
+
var hasSpecialCharacter = createValidator(HAS_SPECIAL_CHARACTER, HAS_SPECIAL_CHARACTER_ERROR$1);
|
|
30887
|
+
|
|
30888
|
+
validatorFns[HAS_SPECIAL_CHARACTER] = function (value, args, form) {
|
|
30703
30889
|
if (value === "") {
|
|
30704
30890
|
return true;
|
|
30705
30891
|
}
|
|
30892
|
+
|
|
30706
30893
|
return new RegExp(/[!@#$%^&*.?]/).test(value);
|
|
30707
30894
|
};
|
|
30708
30895
|
|
|
30709
|
-
|
|
30710
|
-
|
|
30711
|
-
|
|
30712
|
-
|
|
30713
|
-
|
|
30714
|
-
);
|
|
30715
|
-
validatorFns[IS_PROBABLY_EMAIL] = (value, args, form) => {
|
|
30896
|
+
var IS_PROBABLY_EMAIL = "validator/IS_PROBABLY_EMAIL";
|
|
30897
|
+
var IS_PROBABLY_EMAIL_ERROR = "error/IS_PROBABLY_EMAIL";
|
|
30898
|
+
var isProbablyEmail = createValidator(IS_PROBABLY_EMAIL, IS_PROBABLY_EMAIL_ERROR);
|
|
30899
|
+
|
|
30900
|
+
validatorFns[IS_PROBABLY_EMAIL] = function (value, args, form) {
|
|
30716
30901
|
if (value === "") {
|
|
30717
30902
|
return true;
|
|
30718
30903
|
}
|
|
30904
|
+
|
|
30719
30905
|
return new RegExp(/^\S+@\S+\.\S+$/).test(value);
|
|
30720
30906
|
};
|
|
30721
30907
|
|
|
30722
|
-
|
|
30723
|
-
|
|
30724
|
-
|
|
30725
|
-
|
|
30726
|
-
|
|
30727
|
-
|
|
30908
|
+
var runValidatorErrorMessage = function runValidatorErrorMessage(type) {
|
|
30909
|
+
return "".concat(type, " was passed to runValidator, but that validator type does not exist. \n Please check that you are only calling validator creator functions exported from \n redux-freeform in your form config and that you didn't forget to \n invoke the validator creator (you cannot pass the functions themselves to \n createFormState)");
|
|
30910
|
+
};
|
|
30911
|
+
|
|
30912
|
+
var runValidator = function runValidator(validator, value, form) {
|
|
30913
|
+
var validatorFn = validatorFns[validator.type];
|
|
30728
30914
|
|
|
30729
|
-
const runValidator = (validator, value, form) => {
|
|
30730
|
-
const validatorFn = validatorFns[validator.type];
|
|
30731
30915
|
if (validatorFn === undefined) {
|
|
30732
30916
|
throw new Error(runValidatorErrorMessage(validator.type));
|
|
30733
30917
|
}
|
|
30918
|
+
|
|
30734
30919
|
return validatorFn(value, validator.args, form) ? null : validator.error;
|
|
30735
30920
|
};
|
|
30736
30921
|
|
|
30737
|
-
|
|
30738
|
-
return validators
|
|
30739
|
-
|
|
30740
|
-
|
|
30922
|
+
var _computeErrors = function _computeErrors(fieldName, form, validators) {
|
|
30923
|
+
return validators.map(function (v) {
|
|
30924
|
+
return runValidator(v, form[fieldName].rawValue, form);
|
|
30925
|
+
}).filter(function (x) {
|
|
30926
|
+
return x !== null;
|
|
30927
|
+
});
|
|
30741
30928
|
};
|
|
30742
30929
|
|
|
30743
|
-
|
|
30744
|
-
|
|
30930
|
+
var computeConstraints = function computeConstraints(fieldName, form) {
|
|
30931
|
+
var constraints = form[fieldName].constraints;
|
|
30745
30932
|
return _computeErrors(fieldName, form, constraints);
|
|
30746
30933
|
};
|
|
30747
30934
|
|
|
30748
|
-
|
|
30749
|
-
|
|
30935
|
+
var computeErrors = function computeErrors(fieldName, form) {
|
|
30936
|
+
var validators = form[fieldName].validators;
|
|
30750
30937
|
return _computeErrors(fieldName, form, validators);
|
|
30751
30938
|
};
|
|
30752
30939
|
|
|
30753
30940
|
var obj;
|
|
30754
|
-
var NOTHING = typeof Symbol !== "undefined" ? Symbol("immer-nothing") : (
|
|
30755
|
-
var DRAFTABLE = typeof Symbol !== "undefined" && Symbol
|
|
30756
|
-
var DRAFT_STATE = typeof Symbol !== "undefined" && Symbol
|
|
30941
|
+
var NOTHING = typeof Symbol !== "undefined" ? Symbol("immer-nothing") : (obj = {}, obj["immer-nothing"] = true, obj);
|
|
30942
|
+
var DRAFTABLE = typeof Symbol !== "undefined" && Symbol["for"] ? Symbol["for"]("immer-draftable") : "__$immer_draftable";
|
|
30943
|
+
var DRAFT_STATE = typeof Symbol !== "undefined" && Symbol["for"] ? Symbol["for"]("immer-state") : "__$immer_state";
|
|
30944
|
+
|
|
30757
30945
|
function isDraft(value) {
|
|
30758
30946
|
return !!value && !!value[DRAFT_STATE];
|
|
30759
30947
|
}
|
|
30948
|
+
|
|
30760
30949
|
function isDraftable(value) {
|
|
30761
|
-
if (!value) {
|
|
30950
|
+
if (!value) {
|
|
30951
|
+
return false;
|
|
30952
|
+
}
|
|
30953
|
+
|
|
30762
30954
|
return isPlainObject(value) || !!value[DRAFTABLE] || !!value.constructor[DRAFTABLE];
|
|
30763
30955
|
}
|
|
30956
|
+
|
|
30764
30957
|
function isPlainObject(value) {
|
|
30765
|
-
if (!value ||
|
|
30766
|
-
|
|
30958
|
+
if (!value || _typeof(value) !== "object") {
|
|
30959
|
+
return false;
|
|
30960
|
+
}
|
|
30961
|
+
|
|
30962
|
+
if (Array.isArray(value)) {
|
|
30963
|
+
return true;
|
|
30964
|
+
}
|
|
30965
|
+
|
|
30767
30966
|
var proto = Object.getPrototypeOf(value);
|
|
30768
30967
|
return !proto || proto === Object.prototype;
|
|
30769
30968
|
}
|
|
30969
|
+
|
|
30770
30970
|
var assign = Object.assign || function assign(target, value) {
|
|
30771
30971
|
for (var key in value) {
|
|
30772
30972
|
if (has(value, key)) {
|
|
@@ -30776,11 +30976,18 @@ var assign = Object.assign || function assign(target, value) {
|
|
|
30776
30976
|
|
|
30777
30977
|
return target;
|
|
30778
30978
|
};
|
|
30779
|
-
|
|
30979
|
+
|
|
30980
|
+
var ownKeys$1 = typeof Reflect !== "undefined" && Reflect.ownKeys ? Reflect.ownKeys : typeof Object.getOwnPropertySymbols !== "undefined" ? function (obj) {
|
|
30981
|
+
return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj));
|
|
30982
|
+
} : Object.getOwnPropertyNames;
|
|
30983
|
+
|
|
30780
30984
|
function shallowCopy(base, invokeGetters) {
|
|
30781
|
-
if (
|
|
30985
|
+
if (invokeGetters === void 0) invokeGetters = false;
|
|
30986
|
+
|
|
30987
|
+
if (Array.isArray(base)) {
|
|
30988
|
+
return base.slice();
|
|
30989
|
+
}
|
|
30782
30990
|
|
|
30783
|
-
if (Array.isArray(base)) { return base.slice(); }
|
|
30784
30991
|
var clone = Object.create(Object.getPrototypeOf(base));
|
|
30785
30992
|
ownKeys$1(base).forEach(function (key) {
|
|
30786
30993
|
if (key === DRAFT_STATE) {
|
|
@@ -30810,20 +31017,28 @@ function shallowCopy(base, invokeGetters) {
|
|
|
30810
31017
|
});
|
|
30811
31018
|
return clone;
|
|
30812
31019
|
}
|
|
31020
|
+
|
|
30813
31021
|
function each(value, cb) {
|
|
30814
31022
|
if (Array.isArray(value)) {
|
|
30815
|
-
for (var i = 0; i < value.length; i++) {
|
|
31023
|
+
for (var i = 0; i < value.length; i++) {
|
|
31024
|
+
cb(i, value[i], value);
|
|
31025
|
+
}
|
|
30816
31026
|
} else {
|
|
30817
|
-
ownKeys$1(value).forEach(function (key) {
|
|
31027
|
+
ownKeys$1(value).forEach(function (key) {
|
|
31028
|
+
return cb(key, value[key], value);
|
|
31029
|
+
});
|
|
30818
31030
|
}
|
|
30819
31031
|
}
|
|
31032
|
+
|
|
30820
31033
|
function isEnumerable(base, prop) {
|
|
30821
31034
|
var desc = Object.getOwnPropertyDescriptor(base, prop);
|
|
30822
31035
|
return !!desc && desc.enumerable;
|
|
30823
31036
|
}
|
|
31037
|
+
|
|
30824
31038
|
function has(thing, prop) {
|
|
30825
31039
|
return Object.prototype.hasOwnProperty.call(thing, prop);
|
|
30826
31040
|
}
|
|
31041
|
+
|
|
30827
31042
|
function is(x, y) {
|
|
30828
31043
|
// From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js
|
|
30829
31044
|
if (x === y) {
|
|
@@ -30832,18 +31047,27 @@ function is(x, y) {
|
|
|
30832
31047
|
return x !== x && y !== y;
|
|
30833
31048
|
}
|
|
30834
31049
|
}
|
|
31050
|
+
|
|
30835
31051
|
function clone(obj) {
|
|
30836
|
-
if (!isDraftable(obj)) {
|
|
30837
|
-
|
|
31052
|
+
if (!isDraftable(obj)) {
|
|
31053
|
+
return obj;
|
|
31054
|
+
}
|
|
31055
|
+
|
|
31056
|
+
if (Array.isArray(obj)) {
|
|
31057
|
+
return obj.map(clone);
|
|
31058
|
+
}
|
|
31059
|
+
|
|
30838
31060
|
var cloned = Object.create(Object.getPrototypeOf(obj));
|
|
30839
31061
|
|
|
30840
|
-
for (var key in obj) {
|
|
31062
|
+
for (var key in obj) {
|
|
31063
|
+
cloned[key] = clone(obj[key]);
|
|
31064
|
+
}
|
|
30841
31065
|
|
|
30842
31066
|
return cloned;
|
|
30843
31067
|
}
|
|
30844
|
-
|
|
30845
31068
|
/** Each scope represents a `produce` call. */
|
|
30846
31069
|
|
|
31070
|
+
|
|
30847
31071
|
var ImmerScope = function ImmerScope(parent) {
|
|
30848
31072
|
this.drafts = [];
|
|
30849
31073
|
this.parent = parent; // Whenever the modified draft contains a draft from another scope, we
|
|
@@ -30854,7 +31078,7 @@ var ImmerScope = function ImmerScope(parent) {
|
|
|
30854
31078
|
this.patches = null;
|
|
30855
31079
|
};
|
|
30856
31080
|
|
|
30857
|
-
ImmerScope.prototype.usePatches = function usePatches
|
|
31081
|
+
ImmerScope.prototype.usePatches = function usePatches(patchListener) {
|
|
30858
31082
|
if (patchListener) {
|
|
30859
31083
|
this.patches = [];
|
|
30860
31084
|
this.inversePatches = [];
|
|
@@ -30862,17 +31086,18 @@ ImmerScope.prototype.usePatches = function usePatches (patchListener) {
|
|
|
30862
31086
|
}
|
|
30863
31087
|
};
|
|
30864
31088
|
|
|
30865
|
-
ImmerScope.prototype.revoke = function revoke$1
|
|
31089
|
+
ImmerScope.prototype.revoke = function revoke$1() {
|
|
30866
31090
|
this.leave();
|
|
30867
31091
|
this.drafts.forEach(revoke);
|
|
30868
31092
|
this.drafts = null; // Make draft-related methods throw.
|
|
30869
31093
|
};
|
|
30870
31094
|
|
|
30871
|
-
ImmerScope.prototype.leave = function leave
|
|
31095
|
+
ImmerScope.prototype.leave = function leave() {
|
|
30872
31096
|
if (this === ImmerScope.current) {
|
|
30873
31097
|
ImmerScope.current = this.parent;
|
|
30874
31098
|
}
|
|
30875
31099
|
};
|
|
31100
|
+
|
|
30876
31101
|
ImmerScope.current = null;
|
|
30877
31102
|
|
|
30878
31103
|
ImmerScope.enter = function () {
|
|
@@ -30881,11 +31106,11 @@ ImmerScope.enter = function () {
|
|
|
30881
31106
|
|
|
30882
31107
|
function revoke(draft) {
|
|
30883
31108
|
draft[DRAFT_STATE].revoke();
|
|
30884
|
-
}
|
|
31109
|
+
} // but share them all instead
|
|
30885
31110
|
|
|
30886
|
-
// but share them all instead
|
|
30887
31111
|
|
|
30888
31112
|
var descriptors = {};
|
|
31113
|
+
|
|
30889
31114
|
function willFinalize(scope, result, isReplaced) {
|
|
30890
31115
|
scope.drafts.forEach(function (draft) {
|
|
30891
31116
|
draft[DRAFT_STATE].finalizing = true;
|
|
@@ -30903,6 +31128,7 @@ function willFinalize(scope, result, isReplaced) {
|
|
|
30903
31128
|
markChangesSweep(scope.drafts);
|
|
30904
31129
|
}
|
|
30905
31130
|
}
|
|
31131
|
+
|
|
30906
31132
|
function createProxy(base, parent) {
|
|
30907
31133
|
var isArray = Array.isArray(base);
|
|
30908
31134
|
var draft = clonePotentialDraft(base);
|
|
@@ -30956,7 +31182,11 @@ function peek(draft, prop) {
|
|
|
30956
31182
|
function get(state, prop) {
|
|
30957
31183
|
assertUnrevoked(state);
|
|
30958
31184
|
var value = peek(source(state), prop);
|
|
30959
|
-
|
|
31185
|
+
|
|
31186
|
+
if (state.finalizing) {
|
|
31187
|
+
return value;
|
|
31188
|
+
} // Create a draft if the value is unmodified.
|
|
31189
|
+
|
|
30960
31190
|
|
|
30961
31191
|
if (value === peek(state.base, prop) && isDraftable(value)) {
|
|
30962
31192
|
prepareCopy(state);
|
|
@@ -30971,7 +31201,10 @@ function set(state, prop, value) {
|
|
|
30971
31201
|
state.assigned[prop] = true;
|
|
30972
31202
|
|
|
30973
31203
|
if (!state.modified) {
|
|
30974
|
-
if (is(value, peek(source(state), prop))) {
|
|
31204
|
+
if (is(value, peek(source(state), prop))) {
|
|
31205
|
+
return;
|
|
31206
|
+
}
|
|
31207
|
+
|
|
30975
31208
|
markChanged(state);
|
|
30976
31209
|
prepareCopy(state);
|
|
30977
31210
|
}
|
|
@@ -30982,12 +31215,17 @@ function set(state, prop, value) {
|
|
|
30982
31215
|
function markChanged(state) {
|
|
30983
31216
|
if (!state.modified) {
|
|
30984
31217
|
state.modified = true;
|
|
30985
|
-
|
|
31218
|
+
|
|
31219
|
+
if (state.parent) {
|
|
31220
|
+
markChanged(state.parent);
|
|
31221
|
+
}
|
|
30986
31222
|
}
|
|
30987
31223
|
}
|
|
30988
31224
|
|
|
30989
31225
|
function prepareCopy(state) {
|
|
30990
|
-
if (!state.copy) {
|
|
31226
|
+
if (!state.copy) {
|
|
31227
|
+
state.copy = clonePotentialDraft(state.base);
|
|
31228
|
+
}
|
|
30991
31229
|
}
|
|
30992
31230
|
|
|
30993
31231
|
function clonePotentialDraft(base) {
|
|
@@ -31012,15 +31250,12 @@ function proxyProperty(draft, prop, enumerable) {
|
|
|
31012
31250
|
descriptors[prop] = desc = {
|
|
31013
31251
|
configurable: true,
|
|
31014
31252
|
enumerable: enumerable,
|
|
31015
|
-
|
|
31016
31253
|
get: function get$1() {
|
|
31017
31254
|
return get(this[DRAFT_STATE], prop);
|
|
31018
31255
|
},
|
|
31019
|
-
|
|
31020
31256
|
set: function set$1(value) {
|
|
31021
31257
|
set(this[DRAFT_STATE], prop, value);
|
|
31022
31258
|
}
|
|
31023
|
-
|
|
31024
31259
|
};
|
|
31025
31260
|
}
|
|
31026
31261
|
|
|
@@ -31028,7 +31263,9 @@ function proxyProperty(draft, prop, enumerable) {
|
|
|
31028
31263
|
}
|
|
31029
31264
|
|
|
31030
31265
|
function assertUnrevoked(state) {
|
|
31031
|
-
if (state.revoked === true) {
|
|
31266
|
+
if (state.revoked === true) {
|
|
31267
|
+
throw new Error("Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + JSON.stringify(source(state)));
|
|
31268
|
+
}
|
|
31032
31269
|
} // This looks expensive, but only proxies are visited, and only objects without known changes are scanned.
|
|
31033
31270
|
|
|
31034
31271
|
|
|
@@ -31042,16 +31279,27 @@ function markChangesSweep(drafts) {
|
|
|
31042
31279
|
|
|
31043
31280
|
if (!state.modified) {
|
|
31044
31281
|
if (Array.isArray(state.base)) {
|
|
31045
|
-
if (hasArrayChanges(state)) {
|
|
31046
|
-
|
|
31282
|
+
if (hasArrayChanges(state)) {
|
|
31283
|
+
markChanged(state);
|
|
31284
|
+
}
|
|
31285
|
+
} else if (hasObjectChanges(state)) {
|
|
31286
|
+
markChanged(state);
|
|
31287
|
+
}
|
|
31047
31288
|
}
|
|
31048
31289
|
}
|
|
31049
31290
|
}
|
|
31050
31291
|
|
|
31051
31292
|
function markChangesRecursively(object) {
|
|
31052
|
-
if (!object ||
|
|
31293
|
+
if (!object || _typeof(object) !== "object") {
|
|
31294
|
+
return;
|
|
31295
|
+
}
|
|
31296
|
+
|
|
31053
31297
|
var state = object[DRAFT_STATE];
|
|
31054
|
-
|
|
31298
|
+
|
|
31299
|
+
if (!state) {
|
|
31300
|
+
return;
|
|
31301
|
+
}
|
|
31302
|
+
|
|
31055
31303
|
var base = state.base;
|
|
31056
31304
|
var draft = state.draft;
|
|
31057
31305
|
var assigned = state.assigned;
|
|
@@ -31081,14 +31329,20 @@ function markChangesRecursively(object) {
|
|
|
31081
31329
|
assigned.length = true;
|
|
31082
31330
|
|
|
31083
31331
|
if (draft.length < base.length) {
|
|
31084
|
-
for (var i = draft.length; i < base.length; i++) {
|
|
31332
|
+
for (var i = draft.length; i < base.length; i++) {
|
|
31333
|
+
assigned[i] = false;
|
|
31334
|
+
}
|
|
31085
31335
|
} else {
|
|
31086
|
-
for (var i$1 = base.length; i$1 < draft.length; i$1++) {
|
|
31336
|
+
for (var i$1 = base.length; i$1 < draft.length; i$1++) {
|
|
31337
|
+
assigned[i$1] = true;
|
|
31338
|
+
}
|
|
31087
31339
|
}
|
|
31088
31340
|
|
|
31089
31341
|
for (var i$2 = 0; i$2 < draft.length; i$2++) {
|
|
31090
31342
|
// Only untouched indices trigger recursion.
|
|
31091
|
-
if (assigned[i$2] === undefined) {
|
|
31343
|
+
if (assigned[i$2] === undefined) {
|
|
31344
|
+
markChangesRecursively(draft[i$2]);
|
|
31345
|
+
}
|
|
31092
31346
|
}
|
|
31093
31347
|
}
|
|
31094
31348
|
}
|
|
@@ -31125,7 +31379,10 @@ function hasObjectChanges(state) {
|
|
|
31125
31379
|
|
|
31126
31380
|
function hasArrayChanges(state) {
|
|
31127
31381
|
var draft = state.draft;
|
|
31128
|
-
|
|
31382
|
+
|
|
31383
|
+
if (draft.length !== state.base.length) {
|
|
31384
|
+
return true;
|
|
31385
|
+
} // See #116
|
|
31129
31386
|
// If we first shorten the length, our array interceptors will be removed.
|
|
31130
31387
|
// If after that new items are added, result in the same original length,
|
|
31131
31388
|
// those last items will have no intercepting property.
|
|
@@ -31133,9 +31390,13 @@ function hasArrayChanges(state) {
|
|
|
31133
31390
|
// N.B.: splice, unshift, etc only shift values around, but not prop descriptors, so we only have to check
|
|
31134
31391
|
// the last one
|
|
31135
31392
|
|
|
31393
|
+
|
|
31136
31394
|
var descriptor = Object.getOwnPropertyDescriptor(draft, draft.length - 1); // descriptor can be null, but only for newly created sparse arrays, eg. new Array(10)
|
|
31137
31395
|
|
|
31138
|
-
if (descriptor && !descriptor.get) {
|
|
31396
|
+
if (descriptor && !descriptor.get) {
|
|
31397
|
+
return true;
|
|
31398
|
+
} // For all other cases, we don't have to compare, as they would have been picked up by the index setters
|
|
31399
|
+
|
|
31139
31400
|
|
|
31140
31401
|
return false;
|
|
31141
31402
|
}
|
|
@@ -31149,11 +31410,12 @@ function createHiddenProperty(target, prop, value) {
|
|
|
31149
31410
|
}
|
|
31150
31411
|
|
|
31151
31412
|
var legacyProxy = /*#__PURE__*/Object.freeze({
|
|
31152
|
-
|
|
31153
|
-
|
|
31413
|
+
willFinalize: willFinalize,
|
|
31414
|
+
createProxy: createProxy
|
|
31154
31415
|
});
|
|
31155
31416
|
|
|
31156
31417
|
function willFinalize$1() {}
|
|
31418
|
+
|
|
31157
31419
|
function createProxy$1(base, parent) {
|
|
31158
31420
|
var scope = parent ? parent.scope : ImmerScope.current;
|
|
31159
31421
|
var state = {
|
|
@@ -31188,33 +31450,27 @@ function createProxy$1(base, parent) {
|
|
|
31188
31450
|
scope.drafts.push(proxy);
|
|
31189
31451
|
return proxy;
|
|
31190
31452
|
}
|
|
31453
|
+
|
|
31191
31454
|
var objectTraps = {
|
|
31192
31455
|
get: get$1,
|
|
31193
|
-
|
|
31194
31456
|
has: function has(target, prop) {
|
|
31195
31457
|
return prop in source$1(target);
|
|
31196
31458
|
},
|
|
31197
|
-
|
|
31198
31459
|
ownKeys: function ownKeys(target) {
|
|
31199
31460
|
return Reflect.ownKeys(source$1(target));
|
|
31200
31461
|
},
|
|
31201
|
-
|
|
31202
31462
|
set: set$1,
|
|
31203
31463
|
deleteProperty: deleteProperty,
|
|
31204
31464
|
getOwnPropertyDescriptor: getOwnPropertyDescriptor,
|
|
31205
|
-
|
|
31206
31465
|
defineProperty: function defineProperty() {
|
|
31207
31466
|
throw new Error("Object.defineProperty() cannot be used on an Immer draft"); // prettier-ignore
|
|
31208
31467
|
},
|
|
31209
|
-
|
|
31210
31468
|
getPrototypeOf: function getPrototypeOf(target) {
|
|
31211
31469
|
return Object.getPrototypeOf(target.base);
|
|
31212
31470
|
},
|
|
31213
|
-
|
|
31214
31471
|
setPrototypeOf: function setPrototypeOf() {
|
|
31215
31472
|
throw new Error("Object.setPrototypeOf() cannot be used on an Immer draft"); // prettier-ignore
|
|
31216
31473
|
}
|
|
31217
|
-
|
|
31218
31474
|
};
|
|
31219
31475
|
var arrayTraps = {};
|
|
31220
31476
|
each(objectTraps, function (key, fn) {
|
|
@@ -31253,7 +31509,10 @@ function peek$1(draft, prop) {
|
|
|
31253
31509
|
}
|
|
31254
31510
|
|
|
31255
31511
|
function get$1(state, prop) {
|
|
31256
|
-
if (prop === DRAFT_STATE) {
|
|
31512
|
+
if (prop === DRAFT_STATE) {
|
|
31513
|
+
return state;
|
|
31514
|
+
}
|
|
31515
|
+
|
|
31257
31516
|
var drafts = state.drafts; // Check for existing draft in unmodified state.
|
|
31258
31517
|
|
|
31259
31518
|
if (!state.modified && has(drafts, prop)) {
|
|
@@ -31269,7 +31528,10 @@ function get$1(state, prop) {
|
|
|
31269
31528
|
|
|
31270
31529
|
if (state.modified) {
|
|
31271
31530
|
// Assigned values are never drafted. This catches any drafts we created, too.
|
|
31272
|
-
if (value !== peek$1(state.base, prop)) {
|
|
31531
|
+
if (value !== peek$1(state.base, prop)) {
|
|
31532
|
+
return value;
|
|
31533
|
+
} // Store drafts on the copy (when one exists).
|
|
31534
|
+
|
|
31273
31535
|
|
|
31274
31536
|
drafts = state.copy;
|
|
31275
31537
|
}
|
|
@@ -31284,7 +31546,11 @@ function set$1(state, prop, value) {
|
|
|
31284
31546
|
// values may be drafts, but falsy values are never drafts.
|
|
31285
31547
|
|
|
31286
31548
|
var isUnchanged = value ? is(baseValue, value) || value === state.drafts[prop] : is(baseValue, value) && prop in state.base;
|
|
31287
|
-
|
|
31549
|
+
|
|
31550
|
+
if (isUnchanged) {
|
|
31551
|
+
return true;
|
|
31552
|
+
}
|
|
31553
|
+
|
|
31288
31554
|
markChanged$1(state);
|
|
31289
31555
|
}
|
|
31290
31556
|
|
|
@@ -31303,7 +31569,10 @@ function deleteProperty(state, prop) {
|
|
|
31303
31569
|
delete state.assigned[prop];
|
|
31304
31570
|
}
|
|
31305
31571
|
|
|
31306
|
-
if (state.copy) {
|
|
31572
|
+
if (state.copy) {
|
|
31573
|
+
delete state.copy[prop];
|
|
31574
|
+
}
|
|
31575
|
+
|
|
31307
31576
|
return true;
|
|
31308
31577
|
} // Note: We never coerce `desc.value` into an Immer draft, because we can't make
|
|
31309
31578
|
// the same guarantee in ES5 mode.
|
|
@@ -31326,13 +31595,16 @@ function markChanged$1(state) {
|
|
|
31326
31595
|
state.modified = true;
|
|
31327
31596
|
state.copy = assign(shallowCopy(state.base), state.drafts);
|
|
31328
31597
|
state.drafts = null;
|
|
31329
|
-
|
|
31598
|
+
|
|
31599
|
+
if (state.parent) {
|
|
31600
|
+
markChanged$1(state.parent);
|
|
31601
|
+
}
|
|
31330
31602
|
}
|
|
31331
31603
|
}
|
|
31332
31604
|
|
|
31333
31605
|
var modernProxy = /*#__PURE__*/Object.freeze({
|
|
31334
|
-
|
|
31335
|
-
|
|
31606
|
+
willFinalize: willFinalize$1,
|
|
31607
|
+
createProxy: createProxy$1
|
|
31336
31608
|
});
|
|
31337
31609
|
|
|
31338
31610
|
function generatePatches(state, basePath, patches, inversePatches) {
|
|
@@ -31341,14 +31613,13 @@ function generatePatches(state, basePath, patches, inversePatches) {
|
|
|
31341
31613
|
|
|
31342
31614
|
function generateArrayPatches(state, basePath, patches, inversePatches) {
|
|
31343
31615
|
var assign, assign$1;
|
|
31344
|
-
|
|
31345
31616
|
var base = state.base;
|
|
31346
31617
|
var copy = state.copy;
|
|
31347
31618
|
var assigned = state.assigned; // Reduce complexity by ensuring `base` is never longer.
|
|
31348
31619
|
|
|
31349
31620
|
if (copy.length < base.length) {
|
|
31350
|
-
|
|
31351
|
-
|
|
31621
|
+
assign = [copy, base], base = assign[0], copy = assign[1];
|
|
31622
|
+
assign$1 = [inversePatches, patches], patches = assign$1[0], inversePatches = assign$1[1];
|
|
31352
31623
|
}
|
|
31353
31624
|
|
|
31354
31625
|
var delta = copy.length - base.length; // Find the first replaced index.
|
|
@@ -31406,7 +31677,11 @@ function generateObjectPatches(state, basePath, patches, inversePatches) {
|
|
|
31406
31677
|
var origValue = base[key];
|
|
31407
31678
|
var value = copy[key];
|
|
31408
31679
|
var op = !assignedValue ? "remove" : key in base ? "replace" : "add";
|
|
31409
|
-
|
|
31680
|
+
|
|
31681
|
+
if (origValue === value && op === "replace") {
|
|
31682
|
+
return;
|
|
31683
|
+
}
|
|
31684
|
+
|
|
31410
31685
|
var path = basePath.concat(key);
|
|
31411
31686
|
patches.push(op === "remove" ? {
|
|
31412
31687
|
op: op,
|
|
@@ -31431,20 +31706,26 @@ function generateObjectPatches(state, basePath, patches, inversePatches) {
|
|
|
31431
31706
|
});
|
|
31432
31707
|
}
|
|
31433
31708
|
|
|
31434
|
-
var applyPatches = function (draft, patches) {
|
|
31709
|
+
var applyPatches = function applyPatches(draft, patches) {
|
|
31435
31710
|
for (var i$1 = 0, list = patches; i$1 < list.length; i$1 += 1) {
|
|
31436
31711
|
var patch = list[i$1];
|
|
31437
|
-
|
|
31438
31712
|
var path = patch.path;
|
|
31439
31713
|
var op = patch.op;
|
|
31440
31714
|
var value = clone(patch.value); // used to clone patch to ensure original patch is not modified, see #411
|
|
31441
31715
|
|
|
31442
|
-
if (!path.length) {
|
|
31716
|
+
if (!path.length) {
|
|
31717
|
+
throw new Error("Illegal state");
|
|
31718
|
+
}
|
|
31719
|
+
|
|
31443
31720
|
var base = draft;
|
|
31444
31721
|
|
|
31445
31722
|
for (var i = 0; i < path.length - 1; i++) {
|
|
31446
31723
|
base = base[path[i]];
|
|
31447
|
-
|
|
31724
|
+
|
|
31725
|
+
if (!base || _typeof(base) !== "object") {
|
|
31726
|
+
throw new Error("Cannot apply patch, path doesn't resolve: " + path.join("/"));
|
|
31727
|
+
} // prettier-ignore
|
|
31728
|
+
|
|
31448
31729
|
}
|
|
31449
31730
|
|
|
31450
31731
|
var key = path[path.length - 1];
|
|
@@ -31493,27 +31774,33 @@ var configDefaults = {
|
|
|
31493
31774
|
onDelete: null,
|
|
31494
31775
|
onCopy: null
|
|
31495
31776
|
};
|
|
31777
|
+
|
|
31496
31778
|
var Immer = function Immer(config) {
|
|
31497
31779
|
assign(this, configDefaults, config);
|
|
31498
31780
|
this.setUseProxies(this.useProxies);
|
|
31499
31781
|
this.produce = this.produce.bind(this);
|
|
31500
31782
|
};
|
|
31501
31783
|
|
|
31502
|
-
Immer.prototype.produce = function produce
|
|
31503
|
-
|
|
31784
|
+
Immer.prototype.produce = function produce(base, recipe, patchListener) {
|
|
31785
|
+
var this$1 = this; // curried invocation
|
|
31504
31786
|
|
|
31505
|
-
// curried invocation
|
|
31506
31787
|
if (typeof base === "function" && typeof recipe !== "function") {
|
|
31507
31788
|
var defaultBase = recipe;
|
|
31508
31789
|
recipe = base;
|
|
31509
31790
|
var self = this;
|
|
31510
31791
|
return function curriedProduce(base) {
|
|
31511
|
-
|
|
31512
|
-
|
|
31513
|
-
|
|
31514
|
-
|
|
31792
|
+
var this$1 = this;
|
|
31793
|
+
if (base === void 0) base = defaultBase;
|
|
31794
|
+
var args = [],
|
|
31795
|
+
len = arguments.length - 1;
|
|
31796
|
+
|
|
31797
|
+
while (len-- > 0) {
|
|
31798
|
+
args[len] = arguments[len + 1];
|
|
31799
|
+
}
|
|
31515
31800
|
|
|
31516
|
-
return self.produce(base, function (draft) {
|
|
31801
|
+
return self.produce(base, function (draft) {
|
|
31802
|
+
return recipe.call.apply(recipe, [this$1, draft].concat(args));
|
|
31803
|
+
}); // prettier-ignore
|
|
31517
31804
|
};
|
|
31518
31805
|
} // prettier-ignore
|
|
31519
31806
|
|
|
@@ -31539,7 +31826,11 @@ Immer.prototype.produce = function produce (base, recipe, patchListener) {
|
|
|
31539
31826
|
hasError = false;
|
|
31540
31827
|
} finally {
|
|
31541
31828
|
// finally instead of catch + rethrow better preserves original stack
|
|
31542
|
-
if (hasError) {
|
|
31829
|
+
if (hasError) {
|
|
31830
|
+
scope.revoke();
|
|
31831
|
+
} else {
|
|
31832
|
+
scope.leave();
|
|
31833
|
+
}
|
|
31543
31834
|
}
|
|
31544
31835
|
|
|
31545
31836
|
if (result instanceof Promise) {
|
|
@@ -31556,25 +31847,38 @@ Immer.prototype.produce = function produce (base, recipe, patchListener) {
|
|
|
31556
31847
|
return this.processResult(result, scope);
|
|
31557
31848
|
} else {
|
|
31558
31849
|
result = recipe(base);
|
|
31559
|
-
|
|
31850
|
+
|
|
31851
|
+
if (result === undefined) {
|
|
31852
|
+
return base;
|
|
31853
|
+
}
|
|
31854
|
+
|
|
31560
31855
|
return result !== NOTHING ? result : undefined;
|
|
31561
31856
|
}
|
|
31562
31857
|
};
|
|
31563
31858
|
|
|
31564
|
-
Immer.prototype.produceWithPatches = function produceWithPatches
|
|
31565
|
-
|
|
31859
|
+
Immer.prototype.produceWithPatches = function produceWithPatches(arg1, arg2, arg3) {
|
|
31860
|
+
var this$1 = this;
|
|
31566
31861
|
|
|
31567
31862
|
if (typeof arg1 === "function") {
|
|
31568
31863
|
return function (state) {
|
|
31569
|
-
|
|
31570
|
-
|
|
31864
|
+
var args = [],
|
|
31865
|
+
len = arguments.length - 1;
|
|
31571
31866
|
|
|
31572
|
-
|
|
31573
|
-
|
|
31867
|
+
while (len-- > 0) {
|
|
31868
|
+
args[len] = arguments[len + 1];
|
|
31869
|
+
}
|
|
31870
|
+
|
|
31871
|
+
return this$1.produceWithPatches(state, function (draft) {
|
|
31872
|
+
return arg1.apply(void 0, [draft].concat(args));
|
|
31873
|
+
});
|
|
31874
|
+
};
|
|
31574
31875
|
} // non-curried form
|
|
31575
31876
|
|
|
31576
31877
|
|
|
31577
|
-
if (arg3) {
|
|
31878
|
+
if (arg3) {
|
|
31879
|
+
throw new Error("A patch listener cannot be passed to produceWithPatches");
|
|
31880
|
+
}
|
|
31881
|
+
|
|
31578
31882
|
var patches, inversePatches;
|
|
31579
31883
|
var nextState = this.produce(arg1, arg2, function (p, ip) {
|
|
31580
31884
|
patches = p;
|
|
@@ -31583,7 +31887,7 @@ Immer.prototype.produceWithPatches = function produceWithPatches (arg1, arg2, ar
|
|
|
31583
31887
|
return [nextState, patches, inversePatches];
|
|
31584
31888
|
};
|
|
31585
31889
|
|
|
31586
|
-
Immer.prototype.createDraft = function createDraft
|
|
31890
|
+
Immer.prototype.createDraft = function createDraft(base) {
|
|
31587
31891
|
if (!isDraftable(base)) {
|
|
31588
31892
|
throw new Error("First argument to `createDraft` must be a plain object, an array, or an immerable object"); // prettier-ignore
|
|
31589
31893
|
}
|
|
@@ -31595,7 +31899,7 @@ Immer.prototype.createDraft = function createDraft (base) {
|
|
|
31595
31899
|
return proxy;
|
|
31596
31900
|
};
|
|
31597
31901
|
|
|
31598
|
-
Immer.prototype.finishDraft = function finishDraft
|
|
31902
|
+
Immer.prototype.finishDraft = function finishDraft(draft, patchListener) {
|
|
31599
31903
|
var state = draft && draft[DRAFT_STATE];
|
|
31600
31904
|
|
|
31601
31905
|
if (!state || !state.isManual) {
|
|
@@ -31611,16 +31915,16 @@ Immer.prototype.finishDraft = function finishDraft (draft, patchListener) {
|
|
|
31611
31915
|
return this.processResult(undefined, scope);
|
|
31612
31916
|
};
|
|
31613
31917
|
|
|
31614
|
-
Immer.prototype.setAutoFreeze = function setAutoFreeze
|
|
31918
|
+
Immer.prototype.setAutoFreeze = function setAutoFreeze(value) {
|
|
31615
31919
|
this.autoFreeze = value;
|
|
31616
31920
|
};
|
|
31617
31921
|
|
|
31618
|
-
Immer.prototype.setUseProxies = function setUseProxies
|
|
31922
|
+
Immer.prototype.setUseProxies = function setUseProxies(value) {
|
|
31619
31923
|
this.useProxies = value;
|
|
31620
31924
|
assign(this, value ? modernProxy : legacyProxy);
|
|
31621
31925
|
};
|
|
31622
31926
|
|
|
31623
|
-
Immer.prototype.applyPatches = function applyPatches$1
|
|
31927
|
+
Immer.prototype.applyPatches = function applyPatches$1(base, patches) {
|
|
31624
31928
|
// If a patch replaces the entire state, take that replacement as base
|
|
31625
31929
|
// before applying patches
|
|
31626
31930
|
var i;
|
|
@@ -31640,12 +31944,14 @@ Immer.prototype.applyPatches = function applyPatches$1 (base, patches) {
|
|
|
31640
31944
|
} // Otherwise, produce a copy of the base state.
|
|
31641
31945
|
|
|
31642
31946
|
|
|
31643
|
-
return this.produce(base, function (draft) {
|
|
31947
|
+
return this.produce(base, function (draft) {
|
|
31948
|
+
return applyPatches(draft, patches.slice(i + 1));
|
|
31949
|
+
});
|
|
31644
31950
|
};
|
|
31645
31951
|
/** @internal */
|
|
31646
31952
|
|
|
31647
31953
|
|
|
31648
|
-
Immer.prototype.processResult = function processResult
|
|
31954
|
+
Immer.prototype.processResult = function processResult(result, scope) {
|
|
31649
31955
|
var baseDraft = scope.drafts[0];
|
|
31650
31956
|
var isReplaced = result !== undefined && result !== baseDraft;
|
|
31651
31957
|
this.willFinalize(scope, result, isReplaced);
|
|
@@ -31693,13 +31999,15 @@ Immer.prototype.processResult = function processResult (result, scope) {
|
|
|
31693
31999
|
*/
|
|
31694
32000
|
|
|
31695
32001
|
|
|
31696
|
-
Immer.prototype.finalize = function finalize
|
|
31697
|
-
|
|
31698
|
-
|
|
32002
|
+
Immer.prototype.finalize = function finalize(draft, path, scope) {
|
|
32003
|
+
var this$1 = this;
|
|
31699
32004
|
var state = draft[DRAFT_STATE];
|
|
31700
32005
|
|
|
31701
32006
|
if (!state) {
|
|
31702
|
-
if (Object.isFrozen(draft)) {
|
|
32007
|
+
if (Object.isFrozen(draft)) {
|
|
32008
|
+
return draft;
|
|
32009
|
+
}
|
|
32010
|
+
|
|
31703
32011
|
return this.finalizeTree(draft, null, scope);
|
|
31704
32012
|
} // Never finalize drafts owned by another scope.
|
|
31705
32013
|
|
|
@@ -31722,13 +32030,17 @@ Immer.prototype.finalize = function finalize (draft, path, scope) {
|
|
|
31722
32030
|
var assigned = state.assigned;
|
|
31723
32031
|
|
|
31724
32032
|
for (var prop in assigned) {
|
|
31725
|
-
if (!assigned[prop]) {
|
|
32033
|
+
if (!assigned[prop]) {
|
|
32034
|
+
this.onDelete(state, prop);
|
|
32035
|
+
}
|
|
31726
32036
|
}
|
|
31727
32037
|
} else {
|
|
31728
32038
|
var base = state.base;
|
|
31729
|
-
|
|
32039
|
+
var copy = state.copy;
|
|
31730
32040
|
each(base, function (prop) {
|
|
31731
|
-
if (!has(copy, prop)) {
|
|
32041
|
+
if (!has(copy, prop)) {
|
|
32042
|
+
this$1.onDelete(state, prop);
|
|
32043
|
+
}
|
|
31732
32044
|
});
|
|
31733
32045
|
}
|
|
31734
32046
|
}
|
|
@@ -31756,9 +32068,8 @@ Immer.prototype.finalize = function finalize (draft, path, scope) {
|
|
|
31756
32068
|
*/
|
|
31757
32069
|
|
|
31758
32070
|
|
|
31759
|
-
Immer.prototype.finalizeTree = function finalizeTree
|
|
31760
|
-
|
|
31761
|
-
|
|
32071
|
+
Immer.prototype.finalizeTree = function finalizeTree(root, rootPath, scope) {
|
|
32072
|
+
var this$1 = this;
|
|
31762
32073
|
var state = root[DRAFT_STATE];
|
|
31763
32074
|
|
|
31764
32075
|
if (state) {
|
|
@@ -31772,7 +32083,7 @@ Immer.prototype.finalizeTree = function finalizeTree (root, rootPath, scope) {
|
|
|
31772
32083
|
|
|
31773
32084
|
var needPatches = !!rootPath && !!scope.patches;
|
|
31774
32085
|
|
|
31775
|
-
var finalizeProperty = function (prop, value, parent) {
|
|
32086
|
+
var finalizeProperty = function finalizeProperty(prop, value, parent) {
|
|
31776
32087
|
if (value === parent) {
|
|
31777
32088
|
throw Error("Immer forbids circular references");
|
|
31778
32089
|
} // In the `finalizeTree` method, only the `root` object may be a draft.
|
|
@@ -31799,7 +32110,9 @@ Immer.prototype.finalizeTree = function finalizeTree (root, rootPath, scope) {
|
|
|
31799
32110
|
} // Unchanged drafts are never passed to the `onAssign` hook.
|
|
31800
32111
|
|
|
31801
32112
|
|
|
31802
|
-
if (isDraftProp && value === state.base[prop]) {
|
|
32113
|
+
if (isDraftProp && value === state.base[prop]) {
|
|
32114
|
+
return;
|
|
32115
|
+
}
|
|
31803
32116
|
} // Unchanged draft properties are ignored.
|
|
31804
32117
|
else if (isDraftProp && is(value, state.base[prop])) {
|
|
31805
32118
|
return;
|
|
@@ -31884,103 +32197,149 @@ var createDraft = immer.createDraft.bind(immer);
|
|
|
31884
32197
|
|
|
31885
32198
|
var finishDraft = immer.finishDraft.bind(immer);
|
|
31886
32199
|
|
|
31887
|
-
|
|
31888
|
-
|
|
31889
|
-
|
|
31890
|
-
|
|
32200
|
+
var createInitialState = function createInitialState(formConfig) {
|
|
32201
|
+
var initialForm = {};
|
|
32202
|
+
var formConfigKeys = Object.keys(formConfig);
|
|
32203
|
+
|
|
32204
|
+
for (var _i = 0, _formConfigKeys = formConfigKeys; _i < _formConfigKeys.length; _i++) {
|
|
32205
|
+
var formKey = _formConfigKeys[_i];
|
|
31891
32206
|
initialForm[formKey] = {
|
|
31892
32207
|
dirty: false,
|
|
31893
32208
|
rawValue: formConfig[formKey].defaultValue || "",
|
|
31894
32209
|
validators: formConfig[formKey].validators || [],
|
|
31895
32210
|
constraints: formConfig[formKey].constraints || []
|
|
31896
32211
|
};
|
|
31897
|
-
}
|
|
31898
|
-
// Because validators require the entire form we have to do a
|
|
32212
|
+
} // Because validators require the entire form we have to do a
|
|
31899
32213
|
// second pass to add errors once the initial form has been
|
|
31900
32214
|
// constructed
|
|
31901
|
-
|
|
31902
|
-
|
|
31903
|
-
|
|
31904
|
-
|
|
32215
|
+
|
|
32216
|
+
|
|
32217
|
+
for (var _i2 = 0, _formConfigKeys2 = formConfigKeys; _i2 < _formConfigKeys2.length; _i2++) {
|
|
32218
|
+
var _formKey = _formConfigKeys2[_i2];
|
|
32219
|
+
var errors = computeErrors(_formKey, initialForm);
|
|
32220
|
+
initialForm[_formKey].errors = errors;
|
|
32221
|
+
initialForm[_formKey].hasErrors = errors.length > 0;
|
|
31905
32222
|
}
|
|
32223
|
+
|
|
31906
32224
|
return initialForm;
|
|
31907
32225
|
};
|
|
31908
32226
|
|
|
31909
|
-
|
|
31910
|
-
const set$2 = fieldName => value => ({
|
|
31911
|
-
type: SET,
|
|
31912
|
-
payload: { fieldName, value }
|
|
31913
|
-
});
|
|
32227
|
+
var SET = "field/SET";
|
|
31914
32228
|
|
|
31915
|
-
|
|
31916
|
-
|
|
31917
|
-
|
|
31918
|
-
|
|
31919
|
-
|
|
31920
|
-
|
|
31921
|
-
|
|
31922
|
-
|
|
31923
|
-
|
|
31924
|
-
|
|
31925
|
-
|
|
31926
|
-
|
|
31927
|
-
return produce(state, draftState => {
|
|
31928
|
-
let originalValue = draftState[changedFieldName].rawValue;
|
|
31929
|
-
draftState[changedFieldName].rawValue = newRawValue;
|
|
31930
|
-
if (computeConstraints(changedFieldName, draftState).length > 0) {
|
|
31931
|
-
// If the change violates constraints, revert the change
|
|
31932
|
-
draftState[changedFieldName].rawValue = originalValue;
|
|
31933
|
-
return draftState;
|
|
31934
|
-
}
|
|
32229
|
+
var set$2 = function set$2(fieldName) {
|
|
32230
|
+
return function (value) {
|
|
32231
|
+
return {
|
|
32232
|
+
type: SET,
|
|
32233
|
+
payload: {
|
|
32234
|
+
fieldName: fieldName,
|
|
32235
|
+
value: value
|
|
32236
|
+
}
|
|
32237
|
+
};
|
|
32238
|
+
};
|
|
32239
|
+
};
|
|
31935
32240
|
|
|
31936
|
-
|
|
31937
|
-
|
|
31938
|
-
|
|
31939
|
-
|
|
31940
|
-
|
|
31941
|
-
|
|
31942
|
-
draftState[fieldName].errors = errors;
|
|
31943
|
-
draftState[fieldName].dirty = dirty;
|
|
31944
|
-
draftState[fieldName].hasErrors = errors.length > 0;
|
|
31945
|
-
}
|
|
31946
|
-
});
|
|
31947
|
-
case CLEAR:
|
|
31948
|
-
return createInitialState(formConfig);
|
|
31949
|
-
default:
|
|
31950
|
-
return state;
|
|
31951
|
-
}
|
|
32241
|
+
var CLEAR = "form/CLEAR";
|
|
32242
|
+
|
|
32243
|
+
var _clear = function clear() {
|
|
32244
|
+
return {
|
|
32245
|
+
type: CLEAR
|
|
32246
|
+
};
|
|
31952
32247
|
};
|
|
31953
32248
|
|
|
31954
|
-
|
|
32249
|
+
var createFormReducer = function createFormReducer(formConfig) {
|
|
32250
|
+
return function () {
|
|
32251
|
+
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : createInitialState(formConfig);
|
|
32252
|
+
var action = arguments.length > 1 ? arguments[1] : undefined;
|
|
32253
|
+
|
|
32254
|
+
switch (action.type) {
|
|
32255
|
+
case SET:
|
|
32256
|
+
var changedFieldName = action.payload.fieldName;
|
|
32257
|
+
var newRawValue = action.payload.value;
|
|
32258
|
+
return produce(state, function (draftState) {
|
|
32259
|
+
var originalValue = draftState[changedFieldName].rawValue;
|
|
32260
|
+
draftState[changedFieldName].rawValue = newRawValue;
|
|
32261
|
+
|
|
32262
|
+
if (computeConstraints(changedFieldName, draftState).length > 0) {
|
|
32263
|
+
// If the change violates constraints, revert the change
|
|
32264
|
+
draftState[changedFieldName].rawValue = originalValue;
|
|
32265
|
+
return draftState;
|
|
32266
|
+
}
|
|
32267
|
+
|
|
32268
|
+
var fields = Object.entries(draftState);
|
|
32269
|
+
|
|
32270
|
+
for (var _i3 = 0, _fields = fields; _i3 < _fields.length; _i3++) {
|
|
32271
|
+
var entry = _fields[_i3];
|
|
32272
|
+
var fieldName = entry[0];
|
|
32273
|
+
var field = entry[1];
|
|
32274
|
+
var errors = computeErrors(fieldName, draftState);
|
|
32275
|
+
var dirty = fieldName === changedFieldName ? true : field.dirty;
|
|
32276
|
+
draftState[fieldName].errors = errors;
|
|
32277
|
+
draftState[fieldName].dirty = dirty;
|
|
32278
|
+
draftState[fieldName].hasErrors = errors.length > 0;
|
|
32279
|
+
}
|
|
32280
|
+
});
|
|
32281
|
+
|
|
32282
|
+
case CLEAR:
|
|
32283
|
+
return createInitialState(formConfig);
|
|
32284
|
+
|
|
32285
|
+
default:
|
|
32286
|
+
return state;
|
|
32287
|
+
}
|
|
32288
|
+
};
|
|
32289
|
+
};
|
|
32290
|
+
|
|
32291
|
+
var createMapDispatchToProps = function createMapDispatchToProps(formConfig) {
|
|
31955
32292
|
// Do memo-ization
|
|
31956
|
-
|
|
31957
|
-
|
|
31958
|
-
return dispatch
|
|
32293
|
+
var cachedDispatch;
|
|
32294
|
+
var cacheValue;
|
|
32295
|
+
return function (dispatch) {
|
|
31959
32296
|
if (dispatch == cachedDispatch) {
|
|
31960
32297
|
return cacheValue;
|
|
31961
32298
|
}
|
|
31962
|
-
|
|
32299
|
+
|
|
32300
|
+
var dispatchObj = {};
|
|
31963
32301
|
dispatchObj.fields = {};
|
|
31964
|
-
|
|
31965
|
-
|
|
32302
|
+
var keys = Object.keys(formConfig);
|
|
32303
|
+
|
|
32304
|
+
var _loop = function _loop() {
|
|
32305
|
+
var fieldName = _keys[_i4];
|
|
31966
32306
|
dispatchObj.fields[fieldName] = {
|
|
31967
|
-
set:
|
|
32307
|
+
set: function set(value) {
|
|
32308
|
+
return dispatch(set$2(fieldName)(value));
|
|
32309
|
+
}
|
|
31968
32310
|
};
|
|
32311
|
+
};
|
|
32312
|
+
|
|
32313
|
+
for (var _i4 = 0, _keys = keys; _i4 < _keys.length; _i4++) {
|
|
32314
|
+
_loop();
|
|
31969
32315
|
}
|
|
31970
|
-
|
|
32316
|
+
|
|
32317
|
+
dispatchObj.form = {
|
|
32318
|
+
clear: function clear() {
|
|
32319
|
+
return dispatch(_clear());
|
|
32320
|
+
}
|
|
32321
|
+
};
|
|
31971
32322
|
cachedDispatch = dispatch;
|
|
31972
|
-
cacheValue = {
|
|
32323
|
+
cacheValue = {
|
|
32324
|
+
actions: dispatchObj
|
|
32325
|
+
};
|
|
31973
32326
|
return cacheValue;
|
|
31974
32327
|
};
|
|
31975
32328
|
};
|
|
31976
32329
|
|
|
31977
|
-
|
|
32330
|
+
var mapStateToProps = function mapStateToProps(state) {
|
|
32331
|
+
return {
|
|
32332
|
+
fields: state
|
|
32333
|
+
};
|
|
32334
|
+
};
|
|
31978
32335
|
|
|
31979
|
-
|
|
31980
|
-
|
|
31981
|
-
|
|
31982
|
-
|
|
31983
|
-
|
|
32336
|
+
var createFormState = function createFormState(formConfig) {
|
|
32337
|
+
return {
|
|
32338
|
+
reducer: createFormReducer(formConfig),
|
|
32339
|
+
mapDispatchToProps: createMapDispatchToProps(formConfig),
|
|
32340
|
+
mapStateToProps: mapStateToProps
|
|
32341
|
+
};
|
|
32342
|
+
};
|
|
31984
32343
|
|
|
31985
32344
|
var formatDelimiter = "_";
|
|
31986
32345
|
var phoneFormats = ["", "_", "__", "(___) ", "(___) _", "(___) __", "(___) ___-", "(___) ___-_", "(___) ___-__", "(___) ___-___", "(___) ___-____"];
|
|
@@ -35898,7 +36257,7 @@ var AutopayModal = function AutopayModal(_ref) {
|
|
|
35898
36257
|
toggleModal(false);
|
|
35899
36258
|
} : navigateToSettings
|
|
35900
36259
|
};
|
|
35901
|
-
var hoverStyles = "\n &:hover {\n .autopayIcon { fill: ".concat(themeValues.hoverColor, "; text-decoration: underline; }\n }");
|
|
36260
|
+
var hoverStyles = "\n &:hover {\n .autopayIcon { fill: ".concat(themeValues.hoverColor, "; text-decoration: underline; cursor: pointer; }\n }");
|
|
35902
36261
|
var activeStyles = "\n &:active {\n .autopayIcon { fill: ".concat(themeValues.activeColor, "; text-decoration: underline; }\n }");
|
|
35903
36262
|
var defaultStyles = "\n .autopayIcon { fill: ".concat(themeValues.color, "; text-decoration: underline; }\n ");
|
|
35904
36263
|
return /*#__PURE__*/React__default.createElement(Modal$1, _extends({
|
|
@@ -37688,6 +38047,43 @@ var TermsAndConditions = function TermsAndConditions(_ref) {
|
|
|
37688
38047
|
})))));
|
|
37689
38048
|
};
|
|
37690
38049
|
|
|
38050
|
+
var Timeout = function Timeout(_ref) {
|
|
38051
|
+
var onLogout = _ref.onLogout;
|
|
38052
|
+
|
|
38053
|
+
var _useContext = React.useContext(styled.ThemeContext),
|
|
38054
|
+
isMobile = _useContext.isMobile;
|
|
38055
|
+
|
|
38056
|
+
return /*#__PURE__*/React__default.createElement(Cover, null, /*#__PURE__*/React__default.createElement(Center, {
|
|
38057
|
+
intrinsic: true
|
|
38058
|
+
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
38059
|
+
padding: "0",
|
|
38060
|
+
maxWidth: isMobile ? "100%" : "500px"
|
|
38061
|
+
}, /*#__PURE__*/React__default.createElement(Stack, {
|
|
38062
|
+
childGap: "32px",
|
|
38063
|
+
justify: "center"
|
|
38064
|
+
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
38065
|
+
padding: isMobile ? "1rem" : "0"
|
|
38066
|
+
}, /*#__PURE__*/React__default.createElement(TimeoutImage, null)), /*#__PURE__*/React__default.createElement(Box, {
|
|
38067
|
+
padding: "0"
|
|
38068
|
+
}, /*#__PURE__*/React__default.createElement(Heading$1, {
|
|
38069
|
+
textAlign: "center",
|
|
38070
|
+
weight: FONT_WEIGHT_BOLD
|
|
38071
|
+
}, "Request Timed Out"), /*#__PURE__*/React__default.createElement(Paragraph$1, {
|
|
38072
|
+
variant: "pL",
|
|
38073
|
+
extraStyles: "text-align: center;"
|
|
38074
|
+
}, "That was taking longer than we expected and your request timed out. Please log out, log back in, and then try again.")), /*#__PURE__*/React__default.createElement(Center, {
|
|
38075
|
+
intrinsic: true
|
|
38076
|
+
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
38077
|
+
padding: "0"
|
|
38078
|
+
}, /*#__PURE__*/React__default.createElement(ButtonWithAction, {
|
|
38079
|
+
variant: "primary",
|
|
38080
|
+
text: "Log out",
|
|
38081
|
+
action: onLogout
|
|
38082
|
+
})))))));
|
|
38083
|
+
};
|
|
38084
|
+
|
|
38085
|
+
var Timeout$1 = withWindowSize(Timeout);
|
|
38086
|
+
|
|
37691
38087
|
var WorkflowTile = function WorkflowTile(_ref) {
|
|
37692
38088
|
var _ref$workflowName = _ref.workflowName,
|
|
37693
38089
|
workflowName = _ref$workflowName === void 0 ? "Test Workflow" : _ref$workflowName,
|
|
@@ -38109,6 +38505,8 @@ exports.TableListItem = TableListItem;
|
|
|
38109
38505
|
exports.TermsAndConditions = TermsAndConditions;
|
|
38110
38506
|
exports.TermsAndConditionsModal = TermsAndConditionsModal$1;
|
|
38111
38507
|
exports.Text = Text$1;
|
|
38508
|
+
exports.Timeout = Timeout$1;
|
|
38509
|
+
exports.TimeoutImage = TimeoutImage;
|
|
38112
38510
|
exports.ToggleSwitch = ToggleSwitch$1;
|
|
38113
38511
|
exports.VerifiedEmailIcon = VerifiedEmailIcon$1;
|
|
38114
38512
|
exports.WorkflowTile = WorkflowTile;
|