@thecb/components 3.4.1 → 3.5.1
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/.tool-versions +1 -0
- package/dist/index.cjs.js +784 -664
- package/package.json +1 -1
- package/src/components/atoms/icons/AutopayOnIcon.js +28 -0
- package/src/components/atoms/icons/TimeoutImage.js +138 -0
- package/src/components/atoms/icons/icons.stories.js +3 -1
- package/src/components/atoms/icons/index.js +5 -1
- package/src/components/molecules/index.js +1 -0
- package/src/components/molecules/obligation/Obligation.js +58 -21
- package/src/components/molecules/obligation/modules/AmountModule.js +38 -30
- package/src/components/molecules/obligation/modules/AutopayModalModule.js +99 -0
- package/src/components/molecules/obligation/modules/AutopayModalModule.theme.js +9 -0
- package/src/components/molecules/obligation/modules/PaymentDetailsActions.js +110 -31
- package/src/components/molecules/timeout/Timeout.js +46 -0
- package/src/components/molecules/timeout/index.js +3 -0
package/dist/index.cjs.js
CHANGED
|
@@ -215,63 +215,6 @@ 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
|
-
|
|
275
218
|
/*! *****************************************************************************
|
|
276
219
|
Copyright (c) Microsoft Corporation.
|
|
277
220
|
|
|
@@ -13687,6 +13630,149 @@ var IconAdd = function IconAdd() {
|
|
|
13687
13630
|
}))))));
|
|
13688
13631
|
};
|
|
13689
13632
|
|
|
13633
|
+
var TimeoutImage = function TimeoutImage() {
|
|
13634
|
+
return /*#__PURE__*/React__default.createElement("svg", {
|
|
13635
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
13636
|
+
width: "100%",
|
|
13637
|
+
height: "100%",
|
|
13638
|
+
viewBox: "0 0 458 308"
|
|
13639
|
+
}, /*#__PURE__*/React__default.createElement("g", {
|
|
13640
|
+
fill: "none",
|
|
13641
|
+
fillRule: "evenodd",
|
|
13642
|
+
stroke: "none",
|
|
13643
|
+
strokeWidth: "1"
|
|
13644
|
+
}, /*#__PURE__*/React__default.createElement("g", {
|
|
13645
|
+
transform: "translate(-492 -168)"
|
|
13646
|
+
}, /*#__PURE__*/React__default.createElement("g", {
|
|
13647
|
+
transform: "translate(492 168)"
|
|
13648
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
|
13649
|
+
fill: "#EAF4EB",
|
|
13650
|
+
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"
|
|
13651
|
+
}), /*#__PURE__*/React__default.createElement("g", {
|
|
13652
|
+
stroke: "#45B770",
|
|
13653
|
+
strokeLinecap: "round",
|
|
13654
|
+
strokeLinejoin: "round",
|
|
13655
|
+
strokeWidth: "8.362",
|
|
13656
|
+
transform: "translate(204 268)"
|
|
13657
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
|
13658
|
+
d: "M15.817 -2.13162821e-14L15.817 24.795 3.55271368e-15 24.795"
|
|
13659
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
13660
|
+
d: "M31.3102 -2.30926389e-14L31.3102 25.574 47.1272 25.574"
|
|
13661
|
+
})), /*#__PURE__*/React__default.createElement("path", {
|
|
13662
|
+
fill: "#FEFEFE",
|
|
13663
|
+
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"
|
|
13664
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
13665
|
+
fill: "#E4E6EB",
|
|
13666
|
+
d: "M101 99L355 99 355 73 101 73z"
|
|
13667
|
+
}), /*#__PURE__*/React__default.createElement("g", {
|
|
13668
|
+
stroke: "#3B414D",
|
|
13669
|
+
strokeLinecap: "round",
|
|
13670
|
+
strokeWidth: "5.575",
|
|
13671
|
+
transform: "translate(197.811 141.913)"
|
|
13672
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
|
13673
|
+
strokeLinejoin: "round",
|
|
13674
|
+
d: "M0 5.575C1.168 2.317 4.16 0 7.666 0c3.505 0 6.497 2.317 7.665 5.575"
|
|
13675
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
13676
|
+
strokeLinejoin: "round",
|
|
13677
|
+
d: "M46 5.575C47.168 2.317 50.16 0 53.666 0c3.505 0 6.497 2.317 7.665 5.575"
|
|
13678
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
13679
|
+
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",
|
|
13680
|
+
transform: "matrix(1 0 0 -1 0 95.06)"
|
|
13681
|
+
})), /*#__PURE__*/React__default.createElement("path", {
|
|
13682
|
+
fill: "#3B414D",
|
|
13683
|
+
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"
|
|
13684
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
13685
|
+
stroke: "#45B770",
|
|
13686
|
+
strokeLinecap: "round",
|
|
13687
|
+
strokeLinejoin: "round",
|
|
13688
|
+
strokeWidth: "8",
|
|
13689
|
+
d: "M99.441 205.181L77.181 224.512"
|
|
13690
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
13691
|
+
stroke: "#45B770",
|
|
13692
|
+
strokeLinecap: "round",
|
|
13693
|
+
strokeLinejoin: "round",
|
|
13694
|
+
strokeWidth: "8",
|
|
13695
|
+
d: "M412.8955 190.764648L381.126953 224.790039 356 205.267859"
|
|
13696
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
13697
|
+
stroke: "#45B770",
|
|
13698
|
+
strokeLinecap: "round",
|
|
13699
|
+
strokeWidth: "8",
|
|
13700
|
+
d: "M396.5 189.5L429.5 189.5"
|
|
13701
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
13702
|
+
stroke: "#45B770",
|
|
13703
|
+
strokeLinecap: "round",
|
|
13704
|
+
strokeLinejoin: "round",
|
|
13705
|
+
strokeWidth: "8",
|
|
13706
|
+
d: "M137.079 231.103a7.605 7.605 0 000 15.211h6.644"
|
|
13707
|
+
}), /*#__PURE__*/React__default.createElement("g", {
|
|
13708
|
+
transform: "translate(377 63)"
|
|
13709
|
+
}, /*#__PURE__*/React__default.createElement("g", null, /*#__PURE__*/React__default.createElement("path", {
|
|
13710
|
+
fill: "#FFF",
|
|
13711
|
+
d: "M66.669 116.462H5.122a5.122 5.122 0 110-10.243h61.547a5.122 5.122 0 110 10.243"
|
|
13712
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
13713
|
+
fill: "#E4F4FD",
|
|
13714
|
+
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"
|
|
13715
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
13716
|
+
fill: "#E4F4FD",
|
|
13717
|
+
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"
|
|
13718
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
13719
|
+
fill: "#FFF",
|
|
13720
|
+
d: "M66.669 10.244H5.122A5.122 5.122 0 115.122 0h61.547a5.122 5.122 0 110 10.244z"
|
|
13721
|
+
})), /*#__PURE__*/React__default.createElement("g", {
|
|
13722
|
+
stroke: "#3B414D",
|
|
13723
|
+
strokeLinecap: "round",
|
|
13724
|
+
strokeWidth: "6"
|
|
13725
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
|
13726
|
+
d: "M66.669 116.462H5.122a5.122 5.122 0 110-10.243h61.547a5.122 5.122 0 110 10.243z"
|
|
13727
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
13728
|
+
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"
|
|
13729
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
13730
|
+
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"
|
|
13731
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
13732
|
+
d: "M66.669 10.244H5.122A5.122 5.122 0 115.122 0h61.547a5.122 5.122 0 110 10.244z"
|
|
13733
|
+
}))), /*#__PURE__*/React__default.createElement("path", {
|
|
13734
|
+
stroke: "#3B414D",
|
|
13735
|
+
strokeLinecap: "round",
|
|
13736
|
+
strokeWidth: "8",
|
|
13737
|
+
d: "M27.663 247.376l-15.18.348M401 248l-44.96-.276m-256.445-.348l-52.372.348M454 248h-34"
|
|
13738
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
13739
|
+
stroke: "#3B414D",
|
|
13740
|
+
strokeWidth: "6",
|
|
13741
|
+
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"
|
|
13742
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
13743
|
+
stroke: "#45B770",
|
|
13744
|
+
strokeLinecap: "round",
|
|
13745
|
+
strokeLinejoin: "round",
|
|
13746
|
+
strokeWidth: "8",
|
|
13747
|
+
d: "M77.181 224.512L127.905 236.375"
|
|
13748
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
13749
|
+
fill: "#B8E4F4",
|
|
13750
|
+
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"
|
|
13751
|
+
})))));
|
|
13752
|
+
};
|
|
13753
|
+
|
|
13754
|
+
var AutopayOnIcon = function AutopayOnIcon(_ref) {
|
|
13755
|
+
var themeValues = _ref.themeValues;
|
|
13756
|
+
return /*#__PURE__*/React__default.createElement("svg", {
|
|
13757
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
13758
|
+
width: "12",
|
|
13759
|
+
height: "13",
|
|
13760
|
+
viewBox: "0 0 12 13"
|
|
13761
|
+
}, /*#__PURE__*/React__default.createElement("g", {
|
|
13762
|
+
fill: "none",
|
|
13763
|
+
fillRule: "evenodd",
|
|
13764
|
+
stroke: "none",
|
|
13765
|
+
strokeWidth: "1"
|
|
13766
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
|
13767
|
+
className: "autopayIcon",
|
|
13768
|
+
fill: themeValues.primaryColor,
|
|
13769
|
+
fillRule: "nonzero",
|
|
13770
|
+
d: "M1.898 5.75c.079 0 .141-.02.188-.059a.281.281 0 00.094-.152 3.825 3.825 0 011.394-2.144A3.838 3.838 0 016 2.563c.5 0 .98.09 1.441.27.461.179.88.44 1.254.784l-.984.985A.542.542 0 007.547 5c0 .156.055.29.164.398.11.11.242.165.398.165h3.141c.156 0 .289-.055.398-.165A.542.542 0 0011.812 5V1.86a.542.542 0 00-.164-.399.542.542 0 00-.398-.164.542.542 0 00-.398.164l-.844.844A5.699 5.699 0 006 .688c-.938 0-1.809.207-2.613.62-.805.415-1.48.981-2.028 1.7A5.726 5.726 0 00.281 5.422a.265.265 0 00.059.223c.055.07.129.105.222.105h1.336zM6 12.312c.937 0 1.809-.207 2.613-.62a5.919 5.919 0 002.028-1.7 5.726 5.726 0 001.078-2.414.265.265 0 00-.059-.223.267.267 0 00-.223-.105h-1.335c-.079 0-.141.02-.188.059a.281.281 0 00-.094.152 3.825 3.825 0 01-1.394 2.144c-.711.555-1.52.833-2.426.833-.5 0-.98-.09-1.441-.27a3.985 3.985 0 01-1.254-.785l.984-.985A.542.542 0 004.453 8a.542.542 0 00-.164-.398.542.542 0 00-.398-.164H.75a.542.542 0 00-.398.164A.542.542 0 00.187 8v3.14c0 .157.055.29.165.4.109.108.242.163.398.163.156 0 .29-.055.398-.164l.844-.844A5.699 5.699 0 006 12.312z"
|
|
13771
|
+
})));
|
|
13772
|
+
};
|
|
13773
|
+
|
|
13774
|
+
var AutopayOnIcon$1 = themeComponent(AutopayOnIcon, "Icons", fallbackValues$2, "primary");
|
|
13775
|
+
|
|
13690
13776
|
var color$2 = "#15749D";
|
|
13691
13777
|
var hoverColor$1 = "#116285";
|
|
13692
13778
|
var activeColor$1 = "#0E506D";
|
|
@@ -30430,401 +30516,378 @@ var ToggleSwitch = function ToggleSwitch(_ref6) {
|
|
|
30430
30516
|
|
|
30431
30517
|
var ToggleSwitch$1 = themeComponent(ToggleSwitch, "ToggleSwitch", fallbackValues$o);
|
|
30432
30518
|
|
|
30433
|
-
|
|
30434
|
-
|
|
30435
|
-
|
|
30436
|
-
|
|
30437
|
-
}
|
|
30519
|
+
const validatorToPredicate = (validatorFn, emptyCase) => (
|
|
30520
|
+
value,
|
|
30521
|
+
...rest
|
|
30522
|
+
) => (value === "" ? emptyCase : validatorFn(value, ...rest));
|
|
30438
30523
|
|
|
30439
|
-
return value === "" ? emptyCase : validatorFn.apply(void 0, [value].concat(rest));
|
|
30440
|
-
};
|
|
30441
|
-
};
|
|
30442
30524
|
/* eslint-disable no-unused-vars */
|
|
30443
30525
|
|
|
30444
|
-
|
|
30445
|
-
|
|
30446
|
-
var validator = function validator() {
|
|
30447
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
30448
|
-
args[_key2] = arguments[_key2];
|
|
30449
|
-
}
|
|
30450
|
-
|
|
30451
|
-
return {
|
|
30452
|
-
type: type,
|
|
30453
|
-
args: args,
|
|
30454
|
-
error: error
|
|
30455
|
-
};
|
|
30456
|
-
};
|
|
30457
|
-
|
|
30526
|
+
const createValidator = (type, error) => {
|
|
30527
|
+
let validator = (...args) => ({ type, args, error });
|
|
30458
30528
|
validator.error = error;
|
|
30459
30529
|
return validator;
|
|
30460
30530
|
};
|
|
30461
30531
|
|
|
30462
|
-
|
|
30463
|
-
var REQUIRED = "validator/REQUIRED";
|
|
30464
|
-
var REQUIRED_ERROR = "error/REQUIRED";
|
|
30465
|
-
var required = createValidator(REQUIRED, REQUIRED_ERROR);
|
|
30466
|
-
|
|
30467
|
-
validatorFns[REQUIRED] = function (value, args, form) {
|
|
30468
|
-
return value !== "";
|
|
30469
|
-
};
|
|
30470
|
-
|
|
30471
|
-
var ONLY_INTEGERS = "validator/ONLY_INTEGERS";
|
|
30472
|
-
var ONLY_INTEGERS_ERROR = "error/ONLY_INTEGERS";
|
|
30473
|
-
var onlyIntegers = createValidator(ONLY_INTEGERS, ONLY_INTEGERS_ERROR);
|
|
30532
|
+
let validatorFns = {};
|
|
30474
30533
|
|
|
30475
|
-
|
|
30476
|
-
|
|
30477
|
-
|
|
30478
|
-
|
|
30479
|
-
var ONLY_NATURALS = "validator/ONLY_NATURALS";
|
|
30480
|
-
var ONLY_NATURALS_ERROR = "error/ONLY_NATURALS";
|
|
30481
|
-
var onlyNaturals = createValidator(ONLY_NATURALS, ONLY_NATURALS_ERROR);
|
|
30534
|
+
const REQUIRED = "validator/REQUIRED";
|
|
30535
|
+
const REQUIRED_ERROR = "error/REQUIRED";
|
|
30536
|
+
const required = createValidator(REQUIRED, REQUIRED_ERROR);
|
|
30537
|
+
validatorFns[REQUIRED] = (value, args, form) => value !== "";
|
|
30482
30538
|
|
|
30483
|
-
|
|
30484
|
-
|
|
30485
|
-
|
|
30539
|
+
const ONLY_INTEGERS = "validator/ONLY_INTEGERS";
|
|
30540
|
+
const ONLY_INTEGERS_ERROR = "error/ONLY_INTEGERS";
|
|
30541
|
+
const onlyIntegers = createValidator(ONLY_INTEGERS, ONLY_INTEGERS_ERROR);
|
|
30542
|
+
validatorFns[ONLY_INTEGERS] = (value, args, form) => /^(-?\d+)?$/.test(value);
|
|
30486
30543
|
|
|
30487
|
-
|
|
30488
|
-
|
|
30489
|
-
|
|
30544
|
+
const ONLY_NATURALS = "validator/ONLY_NATURALS";
|
|
30545
|
+
const ONLY_NATURALS_ERROR = "error/ONLY_NATURALS";
|
|
30546
|
+
const onlyNaturals = createValidator(ONLY_NATURALS, ONLY_NATURALS_ERROR);
|
|
30547
|
+
validatorFns[ONLY_NATURALS] = (value, args, form) => /^(\d+)?$/.test(value);
|
|
30490
30548
|
|
|
30491
|
-
|
|
30549
|
+
const NUMBER_LESS_THAN = "validator/NUMBER_LESS_THAN";
|
|
30550
|
+
const NUMBER_LESS_THAN_ERROR = "error/NUMBER_LESS_THAN";
|
|
30551
|
+
const numberLessThan = createValidator(
|
|
30552
|
+
NUMBER_LESS_THAN,
|
|
30553
|
+
NUMBER_LESS_THAN_ERROR
|
|
30554
|
+
);
|
|
30555
|
+
validatorFns[NUMBER_LESS_THAN] = (value, args, form) => {
|
|
30492
30556
|
if (value === "") {
|
|
30493
30557
|
return true;
|
|
30494
30558
|
}
|
|
30495
|
-
|
|
30496
30559
|
return Number(value) < args[0];
|
|
30497
30560
|
};
|
|
30498
30561
|
|
|
30499
|
-
|
|
30500
|
-
|
|
30501
|
-
|
|
30502
|
-
|
|
30503
|
-
|
|
30562
|
+
const NUMBER_LESS_THAN_OR_EQUAL_TO =
|
|
30563
|
+
"validator/NUMBER_LESS_THAN_OR_EQUAL_TO";
|
|
30564
|
+
const NUMBER_LESS_THAN_OR_EQUAL_TO_ERROR =
|
|
30565
|
+
"error/NUMBER_LESS_THAN_OR_EQUAL_TO";
|
|
30566
|
+
const numberLessThanOrEqualTo = createValidator(
|
|
30567
|
+
NUMBER_LESS_THAN_OR_EQUAL_TO,
|
|
30568
|
+
NUMBER_LESS_THAN_OR_EQUAL_TO_ERROR
|
|
30569
|
+
);
|
|
30570
|
+
validatorFns[NUMBER_LESS_THAN_OR_EQUAL_TO] = (value, args, form) => {
|
|
30504
30571
|
if (value === "") {
|
|
30505
30572
|
return true;
|
|
30506
30573
|
}
|
|
30507
|
-
|
|
30508
30574
|
return Number(value) <= args[0];
|
|
30509
30575
|
};
|
|
30510
30576
|
|
|
30511
|
-
|
|
30512
|
-
|
|
30513
|
-
|
|
30514
|
-
|
|
30515
|
-
|
|
30577
|
+
const NUMBER_GREATER_THAN = "validator/NUMBER_GREATER_THAN";
|
|
30578
|
+
const NUMBER_GREATER_THAN_ERROR = "error/NUMBER_GREATER_THAN";
|
|
30579
|
+
const numberGreaterThan = createValidator(
|
|
30580
|
+
NUMBER_GREATER_THAN,
|
|
30581
|
+
NUMBER_GREATER_THAN_ERROR
|
|
30582
|
+
);
|
|
30583
|
+
validatorFns[NUMBER_GREATER_THAN] = (value, args, form) => {
|
|
30516
30584
|
if (value === "") {
|
|
30517
30585
|
return true;
|
|
30518
30586
|
}
|
|
30519
|
-
|
|
30520
30587
|
return Number(value) > args[0];
|
|
30521
30588
|
};
|
|
30522
30589
|
|
|
30523
|
-
|
|
30524
|
-
|
|
30525
|
-
|
|
30526
|
-
|
|
30527
|
-
|
|
30590
|
+
const NUMBER_GREATER_THAN_OR_EQUAL_TO =
|
|
30591
|
+
"validator/NUMBER_GREATER_THAN_OR_EQUAL_TO";
|
|
30592
|
+
const NUMBER_GREATER_THAN_OR_EQUAL_TO_ERROR =
|
|
30593
|
+
"error/NUMBER_GREATER_THAN_OR_EQUAL_TO";
|
|
30594
|
+
const numberGreaterThanOrEqualTo = createValidator(
|
|
30595
|
+
NUMBER_GREATER_THAN_OR_EQUAL_TO,
|
|
30596
|
+
NUMBER_GREATER_THAN_OR_EQUAL_TO_ERROR
|
|
30597
|
+
);
|
|
30598
|
+
validatorFns[NUMBER_GREATER_THAN_OR_EQUAL_TO] = (value, args, form) => {
|
|
30528
30599
|
if (value === "") {
|
|
30529
30600
|
return true;
|
|
30530
30601
|
}
|
|
30531
|
-
|
|
30532
30602
|
return Number(value) >= args[0];
|
|
30533
30603
|
};
|
|
30534
30604
|
|
|
30535
|
-
|
|
30536
|
-
|
|
30537
|
-
|
|
30538
|
-
|
|
30539
|
-
validatorFns[MATCHES_FIELD] = function (value, args, form) {
|
|
30605
|
+
const MATCHES_FIELD = "validator/MATCHES_FIELD";
|
|
30606
|
+
const MATCHES_FIELD_ERROR$1 = "error/MATCHES_FIELD";
|
|
30607
|
+
const matchesField = createValidator(MATCHES_FIELD, MATCHES_FIELD_ERROR$1);
|
|
30608
|
+
validatorFns[MATCHES_FIELD] = (value, args, form) => {
|
|
30540
30609
|
if (value === "") {
|
|
30541
30610
|
return true;
|
|
30542
30611
|
}
|
|
30543
|
-
|
|
30544
30612
|
if (form[args[0]] === undefined) {
|
|
30545
|
-
throw new Error(
|
|
30613
|
+
throw new Error(
|
|
30614
|
+
`${args[0]} was passed to matchesField, but that field does not exist in the form`
|
|
30615
|
+
);
|
|
30546
30616
|
}
|
|
30547
|
-
|
|
30548
30617
|
return value === form[args[0]].rawValue;
|
|
30549
30618
|
};
|
|
30550
30619
|
|
|
30551
|
-
|
|
30552
|
-
|
|
30553
|
-
|
|
30554
|
-
|
|
30555
|
-
|
|
30556
|
-
|
|
30557
|
-
|
|
30558
|
-
|
|
30559
|
-
|
|
30560
|
-
|
|
30561
|
-
|
|
30562
|
-
|
|
30563
|
-
|
|
30564
|
-
|
|
30565
|
-
|
|
30620
|
+
const validateWhenErrorMessage = type =>
|
|
30621
|
+
`${type} was passed to validateWhen, but that validator type does not exist.
|
|
30622
|
+
Please check that you are only calling validator creator functions exported from
|
|
30623
|
+
redux-freeform in your form config and that you didn't forget to
|
|
30624
|
+
invoke the validator creator (you cannot pass the functions themselves to
|
|
30625
|
+
createFormState). Also make sure you aren't passing validateWhen() to validateWhen
|
|
30626
|
+
as the primary validator.`;
|
|
30627
|
+
|
|
30628
|
+
const VALIDATE_WHEN = "validator/VALIDATE_WHEN";
|
|
30629
|
+
const VALIDATE_WHEN_ERROR = "error/VALIDATE_WHEN";
|
|
30630
|
+
const validateWhen = (
|
|
30631
|
+
dependentValidator,
|
|
30632
|
+
primaryValidator,
|
|
30633
|
+
optionalFieldName
|
|
30634
|
+
) => ({
|
|
30635
|
+
type: VALIDATE_WHEN,
|
|
30636
|
+
args: [dependentValidator, primaryValidator, optionalFieldName],
|
|
30637
|
+
error: dependentValidator.error
|
|
30638
|
+
});
|
|
30566
30639
|
validateWhen.error = VALIDATE_WHEN_ERROR;
|
|
30640
|
+
validatorFns[VALIDATE_WHEN] = (value, args, form) => {
|
|
30641
|
+
const [dependentValidator, primaryValidator, optionalFieldName] = args;
|
|
30642
|
+
const dependsOnOtherField = typeof optionalFieldName === "string";
|
|
30567
30643
|
|
|
30568
|
-
|
|
30569
|
-
|
|
30570
|
-
|
|
30571
|
-
|
|
30572
|
-
optionalFieldName = _args[2];
|
|
30573
|
-
|
|
30574
|
-
var dependsOnOtherField = typeof optionalFieldName === "string";
|
|
30575
|
-
|
|
30576
|
-
if (primaryValidator.type === undefined || typeof validatorFns[primaryValidator.type] !== "function") {
|
|
30644
|
+
if (
|
|
30645
|
+
primaryValidator.type === undefined ||
|
|
30646
|
+
typeof validatorFns[primaryValidator.type] !== "function"
|
|
30647
|
+
) {
|
|
30577
30648
|
throw new Error(validateWhenErrorMessage(primaryValidator.type));
|
|
30578
30649
|
}
|
|
30579
|
-
|
|
30580
30650
|
if (dependsOnOtherField && form[optionalFieldName] === undefined) {
|
|
30581
|
-
throw new Error(
|
|
30651
|
+
throw new Error(
|
|
30652
|
+
`${args[2]} was passed to matchesField, but that field does not exist in the form`
|
|
30653
|
+
);
|
|
30582
30654
|
}
|
|
30583
30655
|
|
|
30584
|
-
|
|
30585
|
-
|
|
30586
|
-
|
|
30587
|
-
|
|
30588
|
-
|
|
30589
|
-
|
|
30590
|
-
|
|
30591
|
-
|
|
30592
|
-
|
|
30593
|
-
|
|
30594
|
-
|
|
30595
|
-
|
|
30596
|
-
|
|
30597
|
-
var validateSum = function validateSum(validator, fieldNamesArray) {
|
|
30598
|
-
return {
|
|
30599
|
-
type: VALIDATE_SUM,
|
|
30600
|
-
args: [validator, fieldNamesArray],
|
|
30601
|
-
error: validator.error
|
|
30602
|
-
};
|
|
30603
|
-
};
|
|
30656
|
+
const primaryPredicate = validatorToPredicate(
|
|
30657
|
+
validatorFns[primaryValidator.type],
|
|
30658
|
+
false
|
|
30659
|
+
);
|
|
30660
|
+
const primaryValue = dependsOnOtherField
|
|
30661
|
+
? form[optionalFieldName].rawValue
|
|
30662
|
+
: value;
|
|
30663
|
+
const primaryPredicatePassed = primaryPredicate(
|
|
30664
|
+
primaryValue,
|
|
30665
|
+
primaryValidator.args,
|
|
30666
|
+
form
|
|
30667
|
+
);
|
|
30604
30668
|
|
|
30669
|
+
return primaryPredicatePassed
|
|
30670
|
+
? validatorFns[dependentValidator.type](
|
|
30671
|
+
value,
|
|
30672
|
+
dependentValidator.args,
|
|
30673
|
+
form
|
|
30674
|
+
)
|
|
30675
|
+
: true;
|
|
30676
|
+
};
|
|
30677
|
+
|
|
30678
|
+
const validateSumErrorMessage = type =>
|
|
30679
|
+
`${type} was passed to validateSum, but that validator type does not exist.
|
|
30680
|
+
Please check that you are only calling validator creator functions exported from
|
|
30681
|
+
redux-freeform in your form config and that you didn't forget to
|
|
30682
|
+
invoke the validator creator (you cannot pass the functions themselves to
|
|
30683
|
+
createFormState).`;
|
|
30684
|
+
const VALIDATE_SUM = "validator/VALIDATE_SUM";
|
|
30685
|
+
const VALIDATE_SUM_ERROR = "error/VALIDATE_SUM";
|
|
30686
|
+
const validateSum = (validator, fieldNamesArray) => ({
|
|
30687
|
+
type: VALIDATE_SUM,
|
|
30688
|
+
args: [validator, fieldNamesArray],
|
|
30689
|
+
error: validator.error
|
|
30690
|
+
});
|
|
30605
30691
|
validateSum.error = VALIDATE_SUM_ERROR;
|
|
30692
|
+
validatorFns[VALIDATE_SUM] = (value, args, form) => {
|
|
30693
|
+
const [validator, fieldNamesArray] = args;
|
|
30606
30694
|
|
|
30607
|
-
|
|
30608
|
-
|
|
30609
|
-
|
|
30610
|
-
|
|
30611
|
-
|
|
30612
|
-
if (validator.type === undefined || typeof validatorFns[validator.type] !== "function") {
|
|
30695
|
+
if (
|
|
30696
|
+
validator.type === undefined ||
|
|
30697
|
+
typeof validatorFns[validator.type] !== "function"
|
|
30698
|
+
) {
|
|
30613
30699
|
throw new Error(validateSumErrorMessage(validator.type));
|
|
30614
30700
|
}
|
|
30615
30701
|
|
|
30616
|
-
|
|
30617
|
-
|
|
30618
|
-
|
|
30619
|
-
|
|
30620
|
-
|
|
30621
|
-
var fieldName = _step.value;
|
|
30622
|
-
|
|
30623
|
-
if (form[fieldName] === undefined) {
|
|
30624
|
-
throw new Error("".concat(fieldName, " was passed to matchesField, but that field does not exist in the form"));
|
|
30625
|
-
}
|
|
30702
|
+
for (const fieldName of fieldNamesArray) {
|
|
30703
|
+
if (form[fieldName] === undefined) {
|
|
30704
|
+
throw new Error(
|
|
30705
|
+
`${fieldName} was passed to matchesField, but that field does not exist in the form`
|
|
30706
|
+
);
|
|
30626
30707
|
}
|
|
30627
|
-
} catch (err) {
|
|
30628
|
-
_iterator.e(err);
|
|
30629
|
-
} finally {
|
|
30630
|
-
_iterator.f();
|
|
30631
30708
|
}
|
|
30632
30709
|
|
|
30633
|
-
|
|
30634
|
-
|
|
30635
|
-
|
|
30710
|
+
const sum = fieldNamesArray.reduce(
|
|
30711
|
+
(acc, curr) => acc + Number(form[curr].rawValue),
|
|
30712
|
+
Number(value)
|
|
30713
|
+
);
|
|
30714
|
+
|
|
30636
30715
|
return validatorFns[validator.type](sum, validator.args, form);
|
|
30637
30716
|
};
|
|
30638
30717
|
|
|
30639
|
-
|
|
30640
|
-
|
|
30641
|
-
|
|
30642
|
-
|
|
30643
|
-
validatorFns[HAS_LENGTH] = function (value, args, form) {
|
|
30718
|
+
const HAS_LENGTH = "validator/HAS_LENGTH";
|
|
30719
|
+
const HAS_LENGTH_ERROR = "error/HAS_LENGTH";
|
|
30720
|
+
const hasLength = createValidator(HAS_LENGTH, HAS_LENGTH_ERROR);
|
|
30721
|
+
validatorFns[HAS_LENGTH] = (value, args, form) => {
|
|
30644
30722
|
if (value === "") {
|
|
30645
30723
|
return true;
|
|
30646
30724
|
}
|
|
30647
|
-
|
|
30648
|
-
|
|
30649
|
-
var max = args[1];
|
|
30650
|
-
|
|
30725
|
+
const min = args[0];
|
|
30726
|
+
const max = args[1];
|
|
30651
30727
|
if (max == undefined || min == undefined) {
|
|
30652
|
-
throw new Error(
|
|
30728
|
+
throw new Error(
|
|
30729
|
+
"Max and min need to be defined for hasLength, both or one of them is undefined"
|
|
30730
|
+
);
|
|
30653
30731
|
}
|
|
30654
|
-
|
|
30655
30732
|
if (max < min) {
|
|
30656
|
-
throw new Error(
|
|
30733
|
+
throw new Error(
|
|
30734
|
+
"hasLength validator was passed a min greater than the max"
|
|
30735
|
+
);
|
|
30657
30736
|
}
|
|
30658
|
-
|
|
30659
|
-
var valueLength = value.length;
|
|
30737
|
+
const valueLength = value.length;
|
|
30660
30738
|
return max >= valueLength && valueLength >= min;
|
|
30661
30739
|
};
|
|
30662
30740
|
|
|
30663
|
-
|
|
30664
|
-
|
|
30665
|
-
|
|
30666
|
-
|
|
30667
|
-
validatorFns[MATCHES_REGEX] = function (value, args, form) {
|
|
30741
|
+
const MATCHES_REGEX = "validator/MATCHES_REGEX";
|
|
30742
|
+
const MATCHES_REGEX_ERROR = "error/MATCHES_REGEX";
|
|
30743
|
+
const matchesRegex = createValidator(MATCHES_REGEX, MATCHES_REGEX_ERROR);
|
|
30744
|
+
validatorFns[MATCHES_REGEX] = (value, args, form) => {
|
|
30668
30745
|
if (value === "") {
|
|
30669
30746
|
return true;
|
|
30670
30747
|
}
|
|
30671
|
-
|
|
30672
30748
|
return new RegExp(args[0]).test(value); // new RexExp never throws an error, no matter the input
|
|
30673
|
-
};
|
|
30674
|
-
|
|
30675
|
-
|
|
30676
|
-
var IS_ROUTING_NUMBER = "validator/IS_ROUTING_NUMBER";
|
|
30677
|
-
var IS_ROUTING_NUMBER_ERROR = "error/IS_ROUTING_NUMBER";
|
|
30678
|
-
var isRoutingNumber = createValidator(IS_ROUTING_NUMBER, IS_ROUTING_NUMBER_ERROR);
|
|
30749
|
+
};
|
|
30679
30750
|
|
|
30680
|
-
|
|
30751
|
+
// based on http://www.brainjar.com/js/validation/
|
|
30752
|
+
const IS_ROUTING_NUMBER = "validator/IS_ROUTING_NUMBER";
|
|
30753
|
+
const IS_ROUTING_NUMBER_ERROR = "error/IS_ROUTING_NUMBER";
|
|
30754
|
+
const isRoutingNumber = createValidator(
|
|
30755
|
+
IS_ROUTING_NUMBER,
|
|
30756
|
+
IS_ROUTING_NUMBER_ERROR
|
|
30757
|
+
);
|
|
30758
|
+
validatorFns[IS_ROUTING_NUMBER] = (value, args, form) => {
|
|
30681
30759
|
if (value === "") {
|
|
30682
30760
|
return true;
|
|
30683
30761
|
}
|
|
30684
|
-
|
|
30685
30762
|
if (value.length != 9) {
|
|
30686
30763
|
return false;
|
|
30687
30764
|
}
|
|
30688
|
-
|
|
30689
|
-
|
|
30690
|
-
|
|
30691
|
-
|
|
30692
|
-
|
|
30693
|
-
|
|
30694
|
-
|
|
30695
|
-
|
|
30696
|
-
|
|
30697
|
-
|
|
30698
|
-
|
|
30699
|
-
|
|
30700
|
-
|
|
30701
|
-
}
|
|
30702
|
-
}, 0);
|
|
30765
|
+
const sum = value
|
|
30766
|
+
.split("")
|
|
30767
|
+
.map(ch => parseInt(ch))
|
|
30768
|
+
.reduce((acc, cur, idx) => {
|
|
30769
|
+
switch (idx % 3) {
|
|
30770
|
+
case 0:
|
|
30771
|
+
return acc + 3 * cur;
|
|
30772
|
+
case 1:
|
|
30773
|
+
return acc + 7 * cur;
|
|
30774
|
+
case 2:
|
|
30775
|
+
return acc + 1 * cur;
|
|
30776
|
+
}
|
|
30777
|
+
}, 0);
|
|
30703
30778
|
return sum != 0 && sum % 10 == 0;
|
|
30704
30779
|
};
|
|
30705
30780
|
|
|
30706
|
-
|
|
30707
|
-
|
|
30708
|
-
|
|
30709
|
-
|
|
30710
|
-
validatorFns[HAS_NUMBER] = function (value, args, form) {
|
|
30781
|
+
const HAS_NUMBER = "validator/HAS_NUMBER";
|
|
30782
|
+
const HAS_NUMBER_ERROR$1 = "error/HAS_NUMBER";
|
|
30783
|
+
const hasNumber = createValidator(HAS_NUMBER, HAS_NUMBER_ERROR$1);
|
|
30784
|
+
validatorFns[HAS_NUMBER] = (value, args, form) => {
|
|
30711
30785
|
if (value === "") {
|
|
30712
30786
|
return true;
|
|
30713
30787
|
}
|
|
30714
|
-
|
|
30715
30788
|
return new RegExp(/[0-9]/).test(value);
|
|
30716
30789
|
};
|
|
30717
30790
|
|
|
30718
|
-
|
|
30719
|
-
|
|
30720
|
-
|
|
30721
|
-
|
|
30722
|
-
|
|
30791
|
+
const HAS_LOWERCASE_LETTER = "validator/HAS_LOWERCASE_LETTER";
|
|
30792
|
+
const HAS_LOWERCASE_LETTER_ERROR$1 = "error/HAS_LOWERCASE_LETTER";
|
|
30793
|
+
const hasLowercaseLetter = createValidator(
|
|
30794
|
+
HAS_LOWERCASE_LETTER,
|
|
30795
|
+
HAS_LOWERCASE_LETTER_ERROR$1
|
|
30796
|
+
);
|
|
30797
|
+
validatorFns[HAS_LOWERCASE_LETTER] = (value, args, form) => {
|
|
30723
30798
|
if (value === "") {
|
|
30724
30799
|
return true;
|
|
30725
30800
|
}
|
|
30726
|
-
|
|
30727
30801
|
return new RegExp(/[a-z]/).test(value);
|
|
30728
30802
|
};
|
|
30729
30803
|
|
|
30730
|
-
|
|
30731
|
-
|
|
30732
|
-
|
|
30733
|
-
|
|
30734
|
-
|
|
30804
|
+
const HAS_UPPERCASE_LETTER = "validator/HAS_UPPERCASE_LETTER";
|
|
30805
|
+
const HAS_UPPERCASE_LETTER_ERROR$1 = "error/HAS_UPPERCASE_LETTER";
|
|
30806
|
+
const hasUppercaseLetter = createValidator(
|
|
30807
|
+
HAS_UPPERCASE_LETTER,
|
|
30808
|
+
HAS_UPPERCASE_LETTER_ERROR$1
|
|
30809
|
+
);
|
|
30810
|
+
validatorFns[HAS_UPPERCASE_LETTER] = (value, args, form) => {
|
|
30735
30811
|
if (value === "") {
|
|
30736
30812
|
return true;
|
|
30737
30813
|
}
|
|
30738
|
-
|
|
30739
30814
|
return new RegExp(/[A-Z]/).test(value);
|
|
30740
30815
|
};
|
|
30741
30816
|
|
|
30742
|
-
|
|
30743
|
-
|
|
30744
|
-
|
|
30745
|
-
|
|
30746
|
-
|
|
30817
|
+
const HAS_SPECIAL_CHARACTER = "validator/HAS_SPECIAL_CHARACTER";
|
|
30818
|
+
const HAS_SPECIAL_CHARACTER_ERROR$1 = "error/HAS_SPECIAL_CHARACTER";
|
|
30819
|
+
const hasSpecialCharacter = createValidator(
|
|
30820
|
+
HAS_SPECIAL_CHARACTER,
|
|
30821
|
+
HAS_SPECIAL_CHARACTER_ERROR$1
|
|
30822
|
+
);
|
|
30823
|
+
validatorFns[HAS_SPECIAL_CHARACTER] = (value, args, form) => {
|
|
30747
30824
|
if (value === "") {
|
|
30748
30825
|
return true;
|
|
30749
30826
|
}
|
|
30750
|
-
|
|
30751
30827
|
return new RegExp(/[!@#$%^&*.?]/).test(value);
|
|
30752
30828
|
};
|
|
30753
30829
|
|
|
30754
|
-
|
|
30755
|
-
|
|
30756
|
-
|
|
30757
|
-
|
|
30758
|
-
|
|
30830
|
+
const IS_PROBABLY_EMAIL = "validator/IS_PROBABLY_EMAIL";
|
|
30831
|
+
const IS_PROBABLY_EMAIL_ERROR = "error/IS_PROBABLY_EMAIL";
|
|
30832
|
+
const isProbablyEmail = createValidator(
|
|
30833
|
+
IS_PROBABLY_EMAIL,
|
|
30834
|
+
IS_PROBABLY_EMAIL_ERROR
|
|
30835
|
+
);
|
|
30836
|
+
validatorFns[IS_PROBABLY_EMAIL] = (value, args, form) => {
|
|
30759
30837
|
if (value === "") {
|
|
30760
30838
|
return true;
|
|
30761
30839
|
}
|
|
30762
|
-
|
|
30763
30840
|
return new RegExp(/^\S+@\S+\.\S+$/).test(value);
|
|
30764
30841
|
};
|
|
30765
30842
|
|
|
30766
|
-
|
|
30767
|
-
|
|
30768
|
-
|
|
30769
|
-
|
|
30770
|
-
|
|
30771
|
-
|
|
30843
|
+
const runValidatorErrorMessage = type =>
|
|
30844
|
+
`${type} was passed to runValidator, but that validator type does not exist.
|
|
30845
|
+
Please check that you are only calling validator creator functions exported from
|
|
30846
|
+
redux-freeform in your form config and that you didn't forget to
|
|
30847
|
+
invoke the validator creator (you cannot pass the functions themselves to
|
|
30848
|
+
createFormState)`;
|
|
30772
30849
|
|
|
30850
|
+
const runValidator = (validator, value, form) => {
|
|
30851
|
+
const validatorFn = validatorFns[validator.type];
|
|
30773
30852
|
if (validatorFn === undefined) {
|
|
30774
30853
|
throw new Error(runValidatorErrorMessage(validator.type));
|
|
30775
30854
|
}
|
|
30776
|
-
|
|
30777
30855
|
return validatorFn(value, validator.args, form) ? null : validator.error;
|
|
30778
30856
|
};
|
|
30779
30857
|
|
|
30780
|
-
|
|
30781
|
-
return validators
|
|
30782
|
-
|
|
30783
|
-
|
|
30784
|
-
return x !== null;
|
|
30785
|
-
});
|
|
30858
|
+
const _computeErrors = (fieldName, form, validators) => {
|
|
30859
|
+
return validators
|
|
30860
|
+
.map(v => runValidator(v, form[fieldName].rawValue, form))
|
|
30861
|
+
.filter(x => x !== null);
|
|
30786
30862
|
};
|
|
30787
30863
|
|
|
30788
|
-
|
|
30789
|
-
|
|
30864
|
+
const computeConstraints = (fieldName, form) => {
|
|
30865
|
+
const constraints = form[fieldName].constraints;
|
|
30790
30866
|
return _computeErrors(fieldName, form, constraints);
|
|
30791
30867
|
};
|
|
30792
30868
|
|
|
30793
|
-
|
|
30794
|
-
|
|
30869
|
+
const computeErrors = (fieldName, form) => {
|
|
30870
|
+
const validators = form[fieldName].validators;
|
|
30795
30871
|
return _computeErrors(fieldName, form, validators);
|
|
30796
30872
|
};
|
|
30797
30873
|
|
|
30798
30874
|
var obj;
|
|
30799
|
-
var NOTHING = typeof Symbol !== "undefined" ? Symbol("immer-nothing") : (obj = {}, obj["immer-nothing"] = true, obj);
|
|
30800
|
-
var DRAFTABLE = typeof Symbol !== "undefined" && Symbol
|
|
30801
|
-
var DRAFT_STATE = typeof Symbol !== "undefined" && Symbol
|
|
30802
|
-
|
|
30875
|
+
var NOTHING = typeof Symbol !== "undefined" ? Symbol("immer-nothing") : ( obj = {}, obj["immer-nothing"] = true, obj );
|
|
30876
|
+
var DRAFTABLE = typeof Symbol !== "undefined" && Symbol.for ? Symbol.for("immer-draftable") : "__$immer_draftable";
|
|
30877
|
+
var DRAFT_STATE = typeof Symbol !== "undefined" && Symbol.for ? Symbol.for("immer-state") : "__$immer_state";
|
|
30803
30878
|
function isDraft(value) {
|
|
30804
30879
|
return !!value && !!value[DRAFT_STATE];
|
|
30805
30880
|
}
|
|
30806
|
-
|
|
30807
30881
|
function isDraftable(value) {
|
|
30808
|
-
if (!value) {
|
|
30809
|
-
return false;
|
|
30810
|
-
}
|
|
30811
|
-
|
|
30882
|
+
if (!value) { return false; }
|
|
30812
30883
|
return isPlainObject(value) || !!value[DRAFTABLE] || !!value.constructor[DRAFTABLE];
|
|
30813
30884
|
}
|
|
30814
|
-
|
|
30815
30885
|
function isPlainObject(value) {
|
|
30816
|
-
if (!value ||
|
|
30817
|
-
|
|
30818
|
-
}
|
|
30819
|
-
|
|
30820
|
-
if (Array.isArray(value)) {
|
|
30821
|
-
return true;
|
|
30822
|
-
}
|
|
30823
|
-
|
|
30886
|
+
if (!value || typeof value !== "object") { return false; }
|
|
30887
|
+
if (Array.isArray(value)) { return true; }
|
|
30824
30888
|
var proto = Object.getPrototypeOf(value);
|
|
30825
30889
|
return !proto || proto === Object.prototype;
|
|
30826
30890
|
}
|
|
30827
|
-
|
|
30828
30891
|
var assign = Object.assign || function assign(target, value) {
|
|
30829
30892
|
for (var key in value) {
|
|
30830
30893
|
if (has(value, key)) {
|
|
@@ -30834,18 +30897,11 @@ var assign = Object.assign || function assign(target, value) {
|
|
|
30834
30897
|
|
|
30835
30898
|
return target;
|
|
30836
30899
|
};
|
|
30837
|
-
|
|
30838
|
-
var ownKeys$1 = typeof Reflect !== "undefined" && Reflect.ownKeys ? Reflect.ownKeys : typeof Object.getOwnPropertySymbols !== "undefined" ? function (obj) {
|
|
30839
|
-
return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj));
|
|
30840
|
-
} : Object.getOwnPropertyNames;
|
|
30841
|
-
|
|
30900
|
+
var ownKeys$1 = typeof Reflect !== "undefined" && Reflect.ownKeys ? Reflect.ownKeys : typeof Object.getOwnPropertySymbols !== "undefined" ? function (obj) { return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj)); } : Object.getOwnPropertyNames;
|
|
30842
30901
|
function shallowCopy(base, invokeGetters) {
|
|
30843
|
-
if (invokeGetters === void 0) invokeGetters = false;
|
|
30844
|
-
|
|
30845
|
-
if (Array.isArray(base)) {
|
|
30846
|
-
return base.slice();
|
|
30847
|
-
}
|
|
30902
|
+
if ( invokeGetters === void 0 ) invokeGetters = false;
|
|
30848
30903
|
|
|
30904
|
+
if (Array.isArray(base)) { return base.slice(); }
|
|
30849
30905
|
var clone = Object.create(Object.getPrototypeOf(base));
|
|
30850
30906
|
ownKeys$1(base).forEach(function (key) {
|
|
30851
30907
|
if (key === DRAFT_STATE) {
|
|
@@ -30875,28 +30931,20 @@ function shallowCopy(base, invokeGetters) {
|
|
|
30875
30931
|
});
|
|
30876
30932
|
return clone;
|
|
30877
30933
|
}
|
|
30878
|
-
|
|
30879
30934
|
function each(value, cb) {
|
|
30880
30935
|
if (Array.isArray(value)) {
|
|
30881
|
-
for (var i = 0; i < value.length; i++) {
|
|
30882
|
-
cb(i, value[i], value);
|
|
30883
|
-
}
|
|
30936
|
+
for (var i = 0; i < value.length; i++) { cb(i, value[i], value); }
|
|
30884
30937
|
} else {
|
|
30885
|
-
ownKeys$1(value).forEach(function (key) {
|
|
30886
|
-
return cb(key, value[key], value);
|
|
30887
|
-
});
|
|
30938
|
+
ownKeys$1(value).forEach(function (key) { return cb(key, value[key], value); });
|
|
30888
30939
|
}
|
|
30889
30940
|
}
|
|
30890
|
-
|
|
30891
30941
|
function isEnumerable(base, prop) {
|
|
30892
30942
|
var desc = Object.getOwnPropertyDescriptor(base, prop);
|
|
30893
30943
|
return !!desc && desc.enumerable;
|
|
30894
30944
|
}
|
|
30895
|
-
|
|
30896
30945
|
function has(thing, prop) {
|
|
30897
30946
|
return Object.prototype.hasOwnProperty.call(thing, prop);
|
|
30898
30947
|
}
|
|
30899
|
-
|
|
30900
30948
|
function is(x, y) {
|
|
30901
30949
|
// From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js
|
|
30902
30950
|
if (x === y) {
|
|
@@ -30905,26 +30953,17 @@ function is(x, y) {
|
|
|
30905
30953
|
return x !== x && y !== y;
|
|
30906
30954
|
}
|
|
30907
30955
|
}
|
|
30908
|
-
|
|
30909
30956
|
function clone(obj) {
|
|
30910
|
-
if (!isDraftable(obj)) {
|
|
30911
|
-
|
|
30912
|
-
}
|
|
30913
|
-
|
|
30914
|
-
if (Array.isArray(obj)) {
|
|
30915
|
-
return obj.map(clone);
|
|
30916
|
-
}
|
|
30917
|
-
|
|
30957
|
+
if (!isDraftable(obj)) { return obj; }
|
|
30958
|
+
if (Array.isArray(obj)) { return obj.map(clone); }
|
|
30918
30959
|
var cloned = Object.create(Object.getPrototypeOf(obj));
|
|
30919
30960
|
|
|
30920
|
-
for (var key in obj) {
|
|
30921
|
-
cloned[key] = clone(obj[key]);
|
|
30922
|
-
}
|
|
30961
|
+
for (var key in obj) { cloned[key] = clone(obj[key]); }
|
|
30923
30962
|
|
|
30924
30963
|
return cloned;
|
|
30925
30964
|
}
|
|
30926
|
-
/** Each scope represents a `produce` call. */
|
|
30927
30965
|
|
|
30966
|
+
/** Each scope represents a `produce` call. */
|
|
30928
30967
|
|
|
30929
30968
|
var ImmerScope = function ImmerScope(parent) {
|
|
30930
30969
|
this.drafts = [];
|
|
@@ -30936,7 +30975,7 @@ var ImmerScope = function ImmerScope(parent) {
|
|
|
30936
30975
|
this.patches = null;
|
|
30937
30976
|
};
|
|
30938
30977
|
|
|
30939
|
-
ImmerScope.prototype.usePatches = function usePatches(patchListener) {
|
|
30978
|
+
ImmerScope.prototype.usePatches = function usePatches (patchListener) {
|
|
30940
30979
|
if (patchListener) {
|
|
30941
30980
|
this.patches = [];
|
|
30942
30981
|
this.inversePatches = [];
|
|
@@ -30944,18 +30983,17 @@ ImmerScope.prototype.usePatches = function usePatches(patchListener) {
|
|
|
30944
30983
|
}
|
|
30945
30984
|
};
|
|
30946
30985
|
|
|
30947
|
-
ImmerScope.prototype.revoke = function revoke$1() {
|
|
30986
|
+
ImmerScope.prototype.revoke = function revoke$1 () {
|
|
30948
30987
|
this.leave();
|
|
30949
30988
|
this.drafts.forEach(revoke);
|
|
30950
30989
|
this.drafts = null; // Make draft-related methods throw.
|
|
30951
30990
|
};
|
|
30952
30991
|
|
|
30953
|
-
ImmerScope.prototype.leave = function leave() {
|
|
30992
|
+
ImmerScope.prototype.leave = function leave () {
|
|
30954
30993
|
if (this === ImmerScope.current) {
|
|
30955
30994
|
ImmerScope.current = this.parent;
|
|
30956
30995
|
}
|
|
30957
30996
|
};
|
|
30958
|
-
|
|
30959
30997
|
ImmerScope.current = null;
|
|
30960
30998
|
|
|
30961
30999
|
ImmerScope.enter = function () {
|
|
@@ -30964,11 +31002,11 @@ ImmerScope.enter = function () {
|
|
|
30964
31002
|
|
|
30965
31003
|
function revoke(draft) {
|
|
30966
31004
|
draft[DRAFT_STATE].revoke();
|
|
30967
|
-
}
|
|
31005
|
+
}
|
|
30968
31006
|
|
|
31007
|
+
// but share them all instead
|
|
30969
31008
|
|
|
30970
31009
|
var descriptors = {};
|
|
30971
|
-
|
|
30972
31010
|
function willFinalize(scope, result, isReplaced) {
|
|
30973
31011
|
scope.drafts.forEach(function (draft) {
|
|
30974
31012
|
draft[DRAFT_STATE].finalizing = true;
|
|
@@ -30986,7 +31024,6 @@ function willFinalize(scope, result, isReplaced) {
|
|
|
30986
31024
|
markChangesSweep(scope.drafts);
|
|
30987
31025
|
}
|
|
30988
31026
|
}
|
|
30989
|
-
|
|
30990
31027
|
function createProxy(base, parent) {
|
|
30991
31028
|
var isArray = Array.isArray(base);
|
|
30992
31029
|
var draft = clonePotentialDraft(base);
|
|
@@ -31040,11 +31077,7 @@ function peek(draft, prop) {
|
|
|
31040
31077
|
function get(state, prop) {
|
|
31041
31078
|
assertUnrevoked(state);
|
|
31042
31079
|
var value = peek(source(state), prop);
|
|
31043
|
-
|
|
31044
|
-
if (state.finalizing) {
|
|
31045
|
-
return value;
|
|
31046
|
-
} // Create a draft if the value is unmodified.
|
|
31047
|
-
|
|
31080
|
+
if (state.finalizing) { return value; } // Create a draft if the value is unmodified.
|
|
31048
31081
|
|
|
31049
31082
|
if (value === peek(state.base, prop) && isDraftable(value)) {
|
|
31050
31083
|
prepareCopy(state);
|
|
@@ -31059,10 +31092,7 @@ function set(state, prop, value) {
|
|
|
31059
31092
|
state.assigned[prop] = true;
|
|
31060
31093
|
|
|
31061
31094
|
if (!state.modified) {
|
|
31062
|
-
if (is(value, peek(source(state), prop))) {
|
|
31063
|
-
return;
|
|
31064
|
-
}
|
|
31065
|
-
|
|
31095
|
+
if (is(value, peek(source(state), prop))) { return; }
|
|
31066
31096
|
markChanged(state);
|
|
31067
31097
|
prepareCopy(state);
|
|
31068
31098
|
}
|
|
@@ -31073,17 +31103,12 @@ function set(state, prop, value) {
|
|
|
31073
31103
|
function markChanged(state) {
|
|
31074
31104
|
if (!state.modified) {
|
|
31075
31105
|
state.modified = true;
|
|
31076
|
-
|
|
31077
|
-
if (state.parent) {
|
|
31078
|
-
markChanged(state.parent);
|
|
31079
|
-
}
|
|
31106
|
+
if (state.parent) { markChanged(state.parent); }
|
|
31080
31107
|
}
|
|
31081
31108
|
}
|
|
31082
31109
|
|
|
31083
31110
|
function prepareCopy(state) {
|
|
31084
|
-
if (!state.copy) {
|
|
31085
|
-
state.copy = clonePotentialDraft(state.base);
|
|
31086
|
-
}
|
|
31111
|
+
if (!state.copy) { state.copy = clonePotentialDraft(state.base); }
|
|
31087
31112
|
}
|
|
31088
31113
|
|
|
31089
31114
|
function clonePotentialDraft(base) {
|
|
@@ -31108,12 +31133,15 @@ function proxyProperty(draft, prop, enumerable) {
|
|
|
31108
31133
|
descriptors[prop] = desc = {
|
|
31109
31134
|
configurable: true,
|
|
31110
31135
|
enumerable: enumerable,
|
|
31136
|
+
|
|
31111
31137
|
get: function get$1() {
|
|
31112
31138
|
return get(this[DRAFT_STATE], prop);
|
|
31113
31139
|
},
|
|
31140
|
+
|
|
31114
31141
|
set: function set$1(value) {
|
|
31115
31142
|
set(this[DRAFT_STATE], prop, value);
|
|
31116
31143
|
}
|
|
31144
|
+
|
|
31117
31145
|
};
|
|
31118
31146
|
}
|
|
31119
31147
|
|
|
@@ -31121,9 +31149,7 @@ function proxyProperty(draft, prop, enumerable) {
|
|
|
31121
31149
|
}
|
|
31122
31150
|
|
|
31123
31151
|
function assertUnrevoked(state) {
|
|
31124
|
-
if (state.revoked === true) {
|
|
31125
|
-
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)));
|
|
31126
|
-
}
|
|
31152
|
+
if (state.revoked === true) { 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))); }
|
|
31127
31153
|
} // This looks expensive, but only proxies are visited, and only objects without known changes are scanned.
|
|
31128
31154
|
|
|
31129
31155
|
|
|
@@ -31137,27 +31163,16 @@ function markChangesSweep(drafts) {
|
|
|
31137
31163
|
|
|
31138
31164
|
if (!state.modified) {
|
|
31139
31165
|
if (Array.isArray(state.base)) {
|
|
31140
|
-
if (hasArrayChanges(state)) {
|
|
31141
|
-
|
|
31142
|
-
}
|
|
31143
|
-
} else if (hasObjectChanges(state)) {
|
|
31144
|
-
markChanged(state);
|
|
31145
|
-
}
|
|
31166
|
+
if (hasArrayChanges(state)) { markChanged(state); }
|
|
31167
|
+
} else if (hasObjectChanges(state)) { markChanged(state); }
|
|
31146
31168
|
}
|
|
31147
31169
|
}
|
|
31148
31170
|
}
|
|
31149
31171
|
|
|
31150
31172
|
function markChangesRecursively(object) {
|
|
31151
|
-
if (!object ||
|
|
31152
|
-
return;
|
|
31153
|
-
}
|
|
31154
|
-
|
|
31173
|
+
if (!object || typeof object !== "object") { return; }
|
|
31155
31174
|
var state = object[DRAFT_STATE];
|
|
31156
|
-
|
|
31157
|
-
if (!state) {
|
|
31158
|
-
return;
|
|
31159
|
-
}
|
|
31160
|
-
|
|
31175
|
+
if (!state) { return; }
|
|
31161
31176
|
var base = state.base;
|
|
31162
31177
|
var draft = state.draft;
|
|
31163
31178
|
var assigned = state.assigned;
|
|
@@ -31187,20 +31202,14 @@ function markChangesRecursively(object) {
|
|
|
31187
31202
|
assigned.length = true;
|
|
31188
31203
|
|
|
31189
31204
|
if (draft.length < base.length) {
|
|
31190
|
-
for (var i = draft.length; i < base.length; i++) {
|
|
31191
|
-
assigned[i] = false;
|
|
31192
|
-
}
|
|
31205
|
+
for (var i = draft.length; i < base.length; i++) { assigned[i] = false; }
|
|
31193
31206
|
} else {
|
|
31194
|
-
for (var i$1 = base.length; i$1 < draft.length; i$1++) {
|
|
31195
|
-
assigned[i$1] = true;
|
|
31196
|
-
}
|
|
31207
|
+
for (var i$1 = base.length; i$1 < draft.length; i$1++) { assigned[i$1] = true; }
|
|
31197
31208
|
}
|
|
31198
31209
|
|
|
31199
31210
|
for (var i$2 = 0; i$2 < draft.length; i$2++) {
|
|
31200
31211
|
// Only untouched indices trigger recursion.
|
|
31201
|
-
if (assigned[i$2] === undefined) {
|
|
31202
|
-
markChangesRecursively(draft[i$2]);
|
|
31203
|
-
}
|
|
31212
|
+
if (assigned[i$2] === undefined) { markChangesRecursively(draft[i$2]); }
|
|
31204
31213
|
}
|
|
31205
31214
|
}
|
|
31206
31215
|
}
|
|
@@ -31237,10 +31246,7 @@ function hasObjectChanges(state) {
|
|
|
31237
31246
|
|
|
31238
31247
|
function hasArrayChanges(state) {
|
|
31239
31248
|
var draft = state.draft;
|
|
31240
|
-
|
|
31241
|
-
if (draft.length !== state.base.length) {
|
|
31242
|
-
return true;
|
|
31243
|
-
} // See #116
|
|
31249
|
+
if (draft.length !== state.base.length) { return true; } // See #116
|
|
31244
31250
|
// If we first shorten the length, our array interceptors will be removed.
|
|
31245
31251
|
// If after that new items are added, result in the same original length,
|
|
31246
31252
|
// those last items will have no intercepting property.
|
|
@@ -31248,13 +31254,9 @@ function hasArrayChanges(state) {
|
|
|
31248
31254
|
// N.B.: splice, unshift, etc only shift values around, but not prop descriptors, so we only have to check
|
|
31249
31255
|
// the last one
|
|
31250
31256
|
|
|
31251
|
-
|
|
31252
31257
|
var descriptor = Object.getOwnPropertyDescriptor(draft, draft.length - 1); // descriptor can be null, but only for newly created sparse arrays, eg. new Array(10)
|
|
31253
31258
|
|
|
31254
|
-
if (descriptor && !descriptor.get) {
|
|
31255
|
-
return true;
|
|
31256
|
-
} // For all other cases, we don't have to compare, as they would have been picked up by the index setters
|
|
31257
|
-
|
|
31259
|
+
if (descriptor && !descriptor.get) { return true; } // For all other cases, we don't have to compare, as they would have been picked up by the index setters
|
|
31258
31260
|
|
|
31259
31261
|
return false;
|
|
31260
31262
|
}
|
|
@@ -31268,12 +31270,11 @@ function createHiddenProperty(target, prop, value) {
|
|
|
31268
31270
|
}
|
|
31269
31271
|
|
|
31270
31272
|
var legacyProxy = /*#__PURE__*/Object.freeze({
|
|
31271
|
-
|
|
31272
|
-
|
|
31273
|
+
willFinalize: willFinalize,
|
|
31274
|
+
createProxy: createProxy
|
|
31273
31275
|
});
|
|
31274
31276
|
|
|
31275
31277
|
function willFinalize$1() {}
|
|
31276
|
-
|
|
31277
31278
|
function createProxy$1(base, parent) {
|
|
31278
31279
|
var scope = parent ? parent.scope : ImmerScope.current;
|
|
31279
31280
|
var state = {
|
|
@@ -31308,27 +31309,33 @@ function createProxy$1(base, parent) {
|
|
|
31308
31309
|
scope.drafts.push(proxy);
|
|
31309
31310
|
return proxy;
|
|
31310
31311
|
}
|
|
31311
|
-
|
|
31312
31312
|
var objectTraps = {
|
|
31313
31313
|
get: get$1,
|
|
31314
|
+
|
|
31314
31315
|
has: function has(target, prop) {
|
|
31315
31316
|
return prop in source$1(target);
|
|
31316
31317
|
},
|
|
31318
|
+
|
|
31317
31319
|
ownKeys: function ownKeys(target) {
|
|
31318
31320
|
return Reflect.ownKeys(source$1(target));
|
|
31319
31321
|
},
|
|
31322
|
+
|
|
31320
31323
|
set: set$1,
|
|
31321
31324
|
deleteProperty: deleteProperty,
|
|
31322
31325
|
getOwnPropertyDescriptor: getOwnPropertyDescriptor,
|
|
31326
|
+
|
|
31323
31327
|
defineProperty: function defineProperty() {
|
|
31324
31328
|
throw new Error("Object.defineProperty() cannot be used on an Immer draft"); // prettier-ignore
|
|
31325
31329
|
},
|
|
31330
|
+
|
|
31326
31331
|
getPrototypeOf: function getPrototypeOf(target) {
|
|
31327
31332
|
return Object.getPrototypeOf(target.base);
|
|
31328
31333
|
},
|
|
31334
|
+
|
|
31329
31335
|
setPrototypeOf: function setPrototypeOf() {
|
|
31330
31336
|
throw new Error("Object.setPrototypeOf() cannot be used on an Immer draft"); // prettier-ignore
|
|
31331
31337
|
}
|
|
31338
|
+
|
|
31332
31339
|
};
|
|
31333
31340
|
var arrayTraps = {};
|
|
31334
31341
|
each(objectTraps, function (key, fn) {
|
|
@@ -31367,10 +31374,7 @@ function peek$1(draft, prop) {
|
|
|
31367
31374
|
}
|
|
31368
31375
|
|
|
31369
31376
|
function get$1(state, prop) {
|
|
31370
|
-
if (prop === DRAFT_STATE) {
|
|
31371
|
-
return state;
|
|
31372
|
-
}
|
|
31373
|
-
|
|
31377
|
+
if (prop === DRAFT_STATE) { return state; }
|
|
31374
31378
|
var drafts = state.drafts; // Check for existing draft in unmodified state.
|
|
31375
31379
|
|
|
31376
31380
|
if (!state.modified && has(drafts, prop)) {
|
|
@@ -31386,10 +31390,7 @@ function get$1(state, prop) {
|
|
|
31386
31390
|
|
|
31387
31391
|
if (state.modified) {
|
|
31388
31392
|
// Assigned values are never drafted. This catches any drafts we created, too.
|
|
31389
|
-
if (value !== peek$1(state.base, prop)) {
|
|
31390
|
-
return value;
|
|
31391
|
-
} // Store drafts on the copy (when one exists).
|
|
31392
|
-
|
|
31393
|
+
if (value !== peek$1(state.base, prop)) { return value; } // Store drafts on the copy (when one exists).
|
|
31393
31394
|
|
|
31394
31395
|
drafts = state.copy;
|
|
31395
31396
|
}
|
|
@@ -31404,11 +31405,7 @@ function set$1(state, prop, value) {
|
|
|
31404
31405
|
// values may be drafts, but falsy values are never drafts.
|
|
31405
31406
|
|
|
31406
31407
|
var isUnchanged = value ? is(baseValue, value) || value === state.drafts[prop] : is(baseValue, value) && prop in state.base;
|
|
31407
|
-
|
|
31408
|
-
if (isUnchanged) {
|
|
31409
|
-
return true;
|
|
31410
|
-
}
|
|
31411
|
-
|
|
31408
|
+
if (isUnchanged) { return true; }
|
|
31412
31409
|
markChanged$1(state);
|
|
31413
31410
|
}
|
|
31414
31411
|
|
|
@@ -31427,10 +31424,7 @@ function deleteProperty(state, prop) {
|
|
|
31427
31424
|
delete state.assigned[prop];
|
|
31428
31425
|
}
|
|
31429
31426
|
|
|
31430
|
-
if (state.copy) {
|
|
31431
|
-
delete state.copy[prop];
|
|
31432
|
-
}
|
|
31433
|
-
|
|
31427
|
+
if (state.copy) { delete state.copy[prop]; }
|
|
31434
31428
|
return true;
|
|
31435
31429
|
} // Note: We never coerce `desc.value` into an Immer draft, because we can't make
|
|
31436
31430
|
// the same guarantee in ES5 mode.
|
|
@@ -31453,16 +31447,13 @@ function markChanged$1(state) {
|
|
|
31453
31447
|
state.modified = true;
|
|
31454
31448
|
state.copy = assign(shallowCopy(state.base), state.drafts);
|
|
31455
31449
|
state.drafts = null;
|
|
31456
|
-
|
|
31457
|
-
if (state.parent) {
|
|
31458
|
-
markChanged$1(state.parent);
|
|
31459
|
-
}
|
|
31450
|
+
if (state.parent) { markChanged$1(state.parent); }
|
|
31460
31451
|
}
|
|
31461
31452
|
}
|
|
31462
31453
|
|
|
31463
31454
|
var modernProxy = /*#__PURE__*/Object.freeze({
|
|
31464
|
-
|
|
31465
|
-
|
|
31455
|
+
willFinalize: willFinalize$1,
|
|
31456
|
+
createProxy: createProxy$1
|
|
31466
31457
|
});
|
|
31467
31458
|
|
|
31468
31459
|
function generatePatches(state, basePath, patches, inversePatches) {
|
|
@@ -31471,13 +31462,14 @@ function generatePatches(state, basePath, patches, inversePatches) {
|
|
|
31471
31462
|
|
|
31472
31463
|
function generateArrayPatches(state, basePath, patches, inversePatches) {
|
|
31473
31464
|
var assign, assign$1;
|
|
31465
|
+
|
|
31474
31466
|
var base = state.base;
|
|
31475
31467
|
var copy = state.copy;
|
|
31476
31468
|
var assigned = state.assigned; // Reduce complexity by ensuring `base` is never longer.
|
|
31477
31469
|
|
|
31478
31470
|
if (copy.length < base.length) {
|
|
31479
|
-
assign = [copy, base], base = assign[0], copy = assign[1];
|
|
31480
|
-
assign$1 = [inversePatches, patches], patches = assign$1[0], inversePatches = assign$1[1];
|
|
31471
|
+
(assign = [copy, base], base = assign[0], copy = assign[1]);
|
|
31472
|
+
(assign$1 = [inversePatches, patches], patches = assign$1[0], inversePatches = assign$1[1]);
|
|
31481
31473
|
}
|
|
31482
31474
|
|
|
31483
31475
|
var delta = copy.length - base.length; // Find the first replaced index.
|
|
@@ -31535,11 +31527,7 @@ function generateObjectPatches(state, basePath, patches, inversePatches) {
|
|
|
31535
31527
|
var origValue = base[key];
|
|
31536
31528
|
var value = copy[key];
|
|
31537
31529
|
var op = !assignedValue ? "remove" : key in base ? "replace" : "add";
|
|
31538
|
-
|
|
31539
|
-
if (origValue === value && op === "replace") {
|
|
31540
|
-
return;
|
|
31541
|
-
}
|
|
31542
|
-
|
|
31530
|
+
if (origValue === value && op === "replace") { return; }
|
|
31543
31531
|
var path = basePath.concat(key);
|
|
31544
31532
|
patches.push(op === "remove" ? {
|
|
31545
31533
|
op: op,
|
|
@@ -31564,26 +31552,20 @@ function generateObjectPatches(state, basePath, patches, inversePatches) {
|
|
|
31564
31552
|
});
|
|
31565
31553
|
}
|
|
31566
31554
|
|
|
31567
|
-
var applyPatches = function
|
|
31555
|
+
var applyPatches = function (draft, patches) {
|
|
31568
31556
|
for (var i$1 = 0, list = patches; i$1 < list.length; i$1 += 1) {
|
|
31569
31557
|
var patch = list[i$1];
|
|
31558
|
+
|
|
31570
31559
|
var path = patch.path;
|
|
31571
31560
|
var op = patch.op;
|
|
31572
31561
|
var value = clone(patch.value); // used to clone patch to ensure original patch is not modified, see #411
|
|
31573
31562
|
|
|
31574
|
-
if (!path.length) {
|
|
31575
|
-
throw new Error("Illegal state");
|
|
31576
|
-
}
|
|
31577
|
-
|
|
31563
|
+
if (!path.length) { throw new Error("Illegal state"); }
|
|
31578
31564
|
var base = draft;
|
|
31579
31565
|
|
|
31580
31566
|
for (var i = 0; i < path.length - 1; i++) {
|
|
31581
31567
|
base = base[path[i]];
|
|
31582
|
-
|
|
31583
|
-
if (!base || _typeof(base) !== "object") {
|
|
31584
|
-
throw new Error("Cannot apply patch, path doesn't resolve: " + path.join("/"));
|
|
31585
|
-
} // prettier-ignore
|
|
31586
|
-
|
|
31568
|
+
if (!base || typeof base !== "object") { throw new Error("Cannot apply patch, path doesn't resolve: " + path.join("/")); } // prettier-ignore
|
|
31587
31569
|
}
|
|
31588
31570
|
|
|
31589
31571
|
var key = path[path.length - 1];
|
|
@@ -31632,33 +31614,27 @@ var configDefaults = {
|
|
|
31632
31614
|
onDelete: null,
|
|
31633
31615
|
onCopy: null
|
|
31634
31616
|
};
|
|
31635
|
-
|
|
31636
31617
|
var Immer = function Immer(config) {
|
|
31637
31618
|
assign(this, configDefaults, config);
|
|
31638
31619
|
this.setUseProxies(this.useProxies);
|
|
31639
31620
|
this.produce = this.produce.bind(this);
|
|
31640
31621
|
};
|
|
31641
31622
|
|
|
31642
|
-
Immer.prototype.produce = function produce(base, recipe, patchListener) {
|
|
31643
|
-
|
|
31623
|
+
Immer.prototype.produce = function produce (base, recipe, patchListener) {
|
|
31624
|
+
var this$1 = this;
|
|
31644
31625
|
|
|
31626
|
+
// curried invocation
|
|
31645
31627
|
if (typeof base === "function" && typeof recipe !== "function") {
|
|
31646
31628
|
var defaultBase = recipe;
|
|
31647
31629
|
recipe = base;
|
|
31648
31630
|
var self = this;
|
|
31649
31631
|
return function curriedProduce(base) {
|
|
31650
|
-
|
|
31651
|
-
|
|
31652
|
-
|
|
31653
|
-
|
|
31632
|
+
var this$1 = this;
|
|
31633
|
+
if ( base === void 0 ) base = defaultBase;
|
|
31634
|
+
var args = [], len = arguments.length - 1;
|
|
31635
|
+
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
|
|
31654
31636
|
|
|
31655
|
-
|
|
31656
|
-
args[len] = arguments[len + 1];
|
|
31657
|
-
}
|
|
31658
|
-
|
|
31659
|
-
return self.produce(base, function (draft) {
|
|
31660
|
-
return recipe.call.apply(recipe, [this$1, draft].concat(args));
|
|
31661
|
-
}); // prettier-ignore
|
|
31637
|
+
return self.produce(base, function (draft) { return recipe.call.apply(recipe, [ this$1, draft ].concat( args )); }); // prettier-ignore
|
|
31662
31638
|
};
|
|
31663
31639
|
} // prettier-ignore
|
|
31664
31640
|
|
|
@@ -31684,11 +31660,7 @@ Immer.prototype.produce = function produce(base, recipe, patchListener) {
|
|
|
31684
31660
|
hasError = false;
|
|
31685
31661
|
} finally {
|
|
31686
31662
|
// finally instead of catch + rethrow better preserves original stack
|
|
31687
|
-
if (hasError) {
|
|
31688
|
-
scope.revoke();
|
|
31689
|
-
} else {
|
|
31690
|
-
scope.leave();
|
|
31691
|
-
}
|
|
31663
|
+
if (hasError) { scope.revoke(); }else { scope.leave(); }
|
|
31692
31664
|
}
|
|
31693
31665
|
|
|
31694
31666
|
if (result instanceof Promise) {
|
|
@@ -31705,38 +31677,25 @@ Immer.prototype.produce = function produce(base, recipe, patchListener) {
|
|
|
31705
31677
|
return this.processResult(result, scope);
|
|
31706
31678
|
} else {
|
|
31707
31679
|
result = recipe(base);
|
|
31708
|
-
|
|
31709
|
-
if (result === undefined) {
|
|
31710
|
-
return base;
|
|
31711
|
-
}
|
|
31712
|
-
|
|
31680
|
+
if (result === undefined) { return base; }
|
|
31713
31681
|
return result !== NOTHING ? result : undefined;
|
|
31714
31682
|
}
|
|
31715
31683
|
};
|
|
31716
31684
|
|
|
31717
|
-
Immer.prototype.produceWithPatches = function produceWithPatches(arg1, arg2, arg3) {
|
|
31718
|
-
|
|
31685
|
+
Immer.prototype.produceWithPatches = function produceWithPatches (arg1, arg2, arg3) {
|
|
31686
|
+
var this$1 = this;
|
|
31719
31687
|
|
|
31720
31688
|
if (typeof arg1 === "function") {
|
|
31721
31689
|
return function (state) {
|
|
31722
|
-
|
|
31723
|
-
|
|
31724
|
-
|
|
31725
|
-
while (len-- > 0) {
|
|
31726
|
-
args[len] = arguments[len + 1];
|
|
31727
|
-
}
|
|
31690
|
+
var args = [], len = arguments.length - 1;
|
|
31691
|
+
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
|
|
31728
31692
|
|
|
31729
|
-
|
|
31730
|
-
|
|
31731
|
-
});
|
|
31732
|
-
};
|
|
31693
|
+
return this$1.produceWithPatches(state, function (draft) { return arg1.apply(void 0, [ draft ].concat( args )); });
|
|
31694
|
+
};
|
|
31733
31695
|
} // non-curried form
|
|
31734
31696
|
|
|
31735
31697
|
|
|
31736
|
-
if (arg3) {
|
|
31737
|
-
throw new Error("A patch listener cannot be passed to produceWithPatches");
|
|
31738
|
-
}
|
|
31739
|
-
|
|
31698
|
+
if (arg3) { throw new Error("A patch listener cannot be passed to produceWithPatches"); }
|
|
31740
31699
|
var patches, inversePatches;
|
|
31741
31700
|
var nextState = this.produce(arg1, arg2, function (p, ip) {
|
|
31742
31701
|
patches = p;
|
|
@@ -31745,7 +31704,7 @@ Immer.prototype.produceWithPatches = function produceWithPatches(arg1, arg2, arg
|
|
|
31745
31704
|
return [nextState, patches, inversePatches];
|
|
31746
31705
|
};
|
|
31747
31706
|
|
|
31748
|
-
Immer.prototype.createDraft = function createDraft(base) {
|
|
31707
|
+
Immer.prototype.createDraft = function createDraft (base) {
|
|
31749
31708
|
if (!isDraftable(base)) {
|
|
31750
31709
|
throw new Error("First argument to `createDraft` must be a plain object, an array, or an immerable object"); // prettier-ignore
|
|
31751
31710
|
}
|
|
@@ -31757,7 +31716,7 @@ Immer.prototype.createDraft = function createDraft(base) {
|
|
|
31757
31716
|
return proxy;
|
|
31758
31717
|
};
|
|
31759
31718
|
|
|
31760
|
-
Immer.prototype.finishDraft = function finishDraft(draft, patchListener) {
|
|
31719
|
+
Immer.prototype.finishDraft = function finishDraft (draft, patchListener) {
|
|
31761
31720
|
var state = draft && draft[DRAFT_STATE];
|
|
31762
31721
|
|
|
31763
31722
|
if (!state || !state.isManual) {
|
|
@@ -31773,16 +31732,16 @@ Immer.prototype.finishDraft = function finishDraft(draft, patchListener) {
|
|
|
31773
31732
|
return this.processResult(undefined, scope);
|
|
31774
31733
|
};
|
|
31775
31734
|
|
|
31776
|
-
Immer.prototype.setAutoFreeze = function setAutoFreeze(value) {
|
|
31735
|
+
Immer.prototype.setAutoFreeze = function setAutoFreeze (value) {
|
|
31777
31736
|
this.autoFreeze = value;
|
|
31778
31737
|
};
|
|
31779
31738
|
|
|
31780
|
-
Immer.prototype.setUseProxies = function setUseProxies(value) {
|
|
31739
|
+
Immer.prototype.setUseProxies = function setUseProxies (value) {
|
|
31781
31740
|
this.useProxies = value;
|
|
31782
31741
|
assign(this, value ? modernProxy : legacyProxy);
|
|
31783
31742
|
};
|
|
31784
31743
|
|
|
31785
|
-
Immer.prototype.applyPatches = function applyPatches$1(base, patches) {
|
|
31744
|
+
Immer.prototype.applyPatches = function applyPatches$1 (base, patches) {
|
|
31786
31745
|
// If a patch replaces the entire state, take that replacement as base
|
|
31787
31746
|
// before applying patches
|
|
31788
31747
|
var i;
|
|
@@ -31802,14 +31761,12 @@ Immer.prototype.applyPatches = function applyPatches$1(base, patches) {
|
|
|
31802
31761
|
} // Otherwise, produce a copy of the base state.
|
|
31803
31762
|
|
|
31804
31763
|
|
|
31805
|
-
return this.produce(base, function (draft) {
|
|
31806
|
-
return applyPatches(draft, patches.slice(i + 1));
|
|
31807
|
-
});
|
|
31764
|
+
return this.produce(base, function (draft) { return applyPatches(draft, patches.slice(i + 1)); });
|
|
31808
31765
|
};
|
|
31809
31766
|
/** @internal */
|
|
31810
31767
|
|
|
31811
31768
|
|
|
31812
|
-
Immer.prototype.processResult = function processResult(result, scope) {
|
|
31769
|
+
Immer.prototype.processResult = function processResult (result, scope) {
|
|
31813
31770
|
var baseDraft = scope.drafts[0];
|
|
31814
31771
|
var isReplaced = result !== undefined && result !== baseDraft;
|
|
31815
31772
|
this.willFinalize(scope, result, isReplaced);
|
|
@@ -31857,15 +31814,13 @@ Immer.prototype.processResult = function processResult(result, scope) {
|
|
|
31857
31814
|
*/
|
|
31858
31815
|
|
|
31859
31816
|
|
|
31860
|
-
Immer.prototype.finalize = function finalize(draft, path, scope) {
|
|
31861
|
-
|
|
31817
|
+
Immer.prototype.finalize = function finalize (draft, path, scope) {
|
|
31818
|
+
var this$1 = this;
|
|
31819
|
+
|
|
31862
31820
|
var state = draft[DRAFT_STATE];
|
|
31863
31821
|
|
|
31864
31822
|
if (!state) {
|
|
31865
|
-
if (Object.isFrozen(draft)) {
|
|
31866
|
-
return draft;
|
|
31867
|
-
}
|
|
31868
|
-
|
|
31823
|
+
if (Object.isFrozen(draft)) { return draft; }
|
|
31869
31824
|
return this.finalizeTree(draft, null, scope);
|
|
31870
31825
|
} // Never finalize drafts owned by another scope.
|
|
31871
31826
|
|
|
@@ -31888,17 +31843,13 @@ Immer.prototype.finalize = function finalize(draft, path, scope) {
|
|
|
31888
31843
|
var assigned = state.assigned;
|
|
31889
31844
|
|
|
31890
31845
|
for (var prop in assigned) {
|
|
31891
|
-
if (!assigned[prop]) {
|
|
31892
|
-
this.onDelete(state, prop);
|
|
31893
|
-
}
|
|
31846
|
+
if (!assigned[prop]) { this.onDelete(state, prop); }
|
|
31894
31847
|
}
|
|
31895
31848
|
} else {
|
|
31896
31849
|
var base = state.base;
|
|
31897
|
-
|
|
31850
|
+
var copy = state.copy;
|
|
31898
31851
|
each(base, function (prop) {
|
|
31899
|
-
if (!has(copy, prop)) {
|
|
31900
|
-
this$1.onDelete(state, prop);
|
|
31901
|
-
}
|
|
31852
|
+
if (!has(copy, prop)) { this$1.onDelete(state, prop); }
|
|
31902
31853
|
});
|
|
31903
31854
|
}
|
|
31904
31855
|
}
|
|
@@ -31926,8 +31877,9 @@ Immer.prototype.finalize = function finalize(draft, path, scope) {
|
|
|
31926
31877
|
*/
|
|
31927
31878
|
|
|
31928
31879
|
|
|
31929
|
-
Immer.prototype.finalizeTree = function finalizeTree(root, rootPath, scope) {
|
|
31930
|
-
|
|
31880
|
+
Immer.prototype.finalizeTree = function finalizeTree (root, rootPath, scope) {
|
|
31881
|
+
var this$1 = this;
|
|
31882
|
+
|
|
31931
31883
|
var state = root[DRAFT_STATE];
|
|
31932
31884
|
|
|
31933
31885
|
if (state) {
|
|
@@ -31941,7 +31893,7 @@ Immer.prototype.finalizeTree = function finalizeTree(root, rootPath, scope) {
|
|
|
31941
31893
|
|
|
31942
31894
|
var needPatches = !!rootPath && !!scope.patches;
|
|
31943
31895
|
|
|
31944
|
-
var finalizeProperty = function
|
|
31896
|
+
var finalizeProperty = function (prop, value, parent) {
|
|
31945
31897
|
if (value === parent) {
|
|
31946
31898
|
throw Error("Immer forbids circular references");
|
|
31947
31899
|
} // In the `finalizeTree` method, only the `root` object may be a draft.
|
|
@@ -31968,9 +31920,7 @@ Immer.prototype.finalizeTree = function finalizeTree(root, rootPath, scope) {
|
|
|
31968
31920
|
} // Unchanged drafts are never passed to the `onAssign` hook.
|
|
31969
31921
|
|
|
31970
31922
|
|
|
31971
|
-
if (isDraftProp && value === state.base[prop]) {
|
|
31972
|
-
return;
|
|
31973
|
-
}
|
|
31923
|
+
if (isDraftProp && value === state.base[prop]) { return; }
|
|
31974
31924
|
} // Unchanged draft properties are ignored.
|
|
31975
31925
|
else if (isDraftProp && is(value, state.base[prop])) {
|
|
31976
31926
|
return;
|
|
@@ -32055,149 +32005,103 @@ var createDraft = immer.createDraft.bind(immer);
|
|
|
32055
32005
|
|
|
32056
32006
|
var finishDraft = immer.finishDraft.bind(immer);
|
|
32057
32007
|
|
|
32058
|
-
|
|
32059
|
-
|
|
32060
|
-
|
|
32061
|
-
|
|
32062
|
-
for (var _i = 0, _formConfigKeys = formConfigKeys; _i < _formConfigKeys.length; _i++) {
|
|
32063
|
-
var formKey = _formConfigKeys[_i];
|
|
32008
|
+
const createInitialState = formConfig => {
|
|
32009
|
+
let initialForm = {};
|
|
32010
|
+
const formConfigKeys = Object.keys(formConfig);
|
|
32011
|
+
for (let formKey of formConfigKeys) {
|
|
32064
32012
|
initialForm[formKey] = {
|
|
32065
32013
|
dirty: false,
|
|
32066
32014
|
rawValue: formConfig[formKey].defaultValue || "",
|
|
32067
32015
|
validators: formConfig[formKey].validators || [],
|
|
32068
32016
|
constraints: formConfig[formKey].constraints || []
|
|
32069
32017
|
};
|
|
32070
|
-
}
|
|
32018
|
+
}
|
|
32019
|
+
// Because validators require the entire form we have to do a
|
|
32071
32020
|
// second pass to add errors once the initial form has been
|
|
32072
32021
|
// constructed
|
|
32073
|
-
|
|
32074
|
-
|
|
32075
|
-
|
|
32076
|
-
|
|
32077
|
-
var errors = computeErrors(_formKey, initialForm);
|
|
32078
|
-
initialForm[_formKey].errors = errors;
|
|
32079
|
-
initialForm[_formKey].hasErrors = errors.length > 0;
|
|
32022
|
+
for (let formKey of formConfigKeys) {
|
|
32023
|
+
let errors = computeErrors(formKey, initialForm);
|
|
32024
|
+
initialForm[formKey].errors = errors;
|
|
32025
|
+
initialForm[formKey].hasErrors = errors.length > 0;
|
|
32080
32026
|
}
|
|
32081
|
-
|
|
32082
32027
|
return initialForm;
|
|
32083
32028
|
};
|
|
32084
32029
|
|
|
32085
|
-
|
|
32086
|
-
|
|
32087
|
-
|
|
32088
|
-
|
|
32089
|
-
|
|
32090
|
-
type: SET,
|
|
32091
|
-
payload: {
|
|
32092
|
-
fieldName: fieldName,
|
|
32093
|
-
value: value
|
|
32094
|
-
}
|
|
32095
|
-
};
|
|
32096
|
-
};
|
|
32097
|
-
};
|
|
32098
|
-
|
|
32099
|
-
var CLEAR = "form/CLEAR";
|
|
32100
|
-
|
|
32101
|
-
var _clear = function clear() {
|
|
32102
|
-
return {
|
|
32103
|
-
type: CLEAR
|
|
32104
|
-
};
|
|
32105
|
-
};
|
|
32106
|
-
|
|
32107
|
-
var createFormReducer = function createFormReducer(formConfig) {
|
|
32108
|
-
return function () {
|
|
32109
|
-
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : createInitialState(formConfig);
|
|
32110
|
-
var action = arguments.length > 1 ? arguments[1] : undefined;
|
|
32111
|
-
|
|
32112
|
-
switch (action.type) {
|
|
32113
|
-
case SET:
|
|
32114
|
-
var changedFieldName = action.payload.fieldName;
|
|
32115
|
-
var newRawValue = action.payload.value;
|
|
32116
|
-
return produce(state, function (draftState) {
|
|
32117
|
-
var originalValue = draftState[changedFieldName].rawValue;
|
|
32118
|
-
draftState[changedFieldName].rawValue = newRawValue;
|
|
32119
|
-
|
|
32120
|
-
if (computeConstraints(changedFieldName, draftState).length > 0) {
|
|
32121
|
-
// If the change violates constraints, revert the change
|
|
32122
|
-
draftState[changedFieldName].rawValue = originalValue;
|
|
32123
|
-
return draftState;
|
|
32124
|
-
}
|
|
32125
|
-
|
|
32126
|
-
var fields = Object.entries(draftState);
|
|
32127
|
-
|
|
32128
|
-
for (var _i3 = 0, _fields = fields; _i3 < _fields.length; _i3++) {
|
|
32129
|
-
var entry = _fields[_i3];
|
|
32130
|
-
var fieldName = entry[0];
|
|
32131
|
-
var field = entry[1];
|
|
32132
|
-
var errors = computeErrors(fieldName, draftState);
|
|
32133
|
-
var dirty = fieldName === changedFieldName ? true : field.dirty;
|
|
32134
|
-
draftState[fieldName].errors = errors;
|
|
32135
|
-
draftState[fieldName].dirty = dirty;
|
|
32136
|
-
draftState[fieldName].hasErrors = errors.length > 0;
|
|
32137
|
-
}
|
|
32138
|
-
});
|
|
32030
|
+
const SET = "field/SET";
|
|
32031
|
+
const set$2 = fieldName => value => ({
|
|
32032
|
+
type: SET,
|
|
32033
|
+
payload: { fieldName, value }
|
|
32034
|
+
});
|
|
32139
32035
|
|
|
32140
|
-
|
|
32141
|
-
|
|
32036
|
+
const CLEAR = "form/CLEAR";
|
|
32037
|
+
const clear = () => ({ type: CLEAR });
|
|
32038
|
+
|
|
32039
|
+
const createFormReducer = formConfig => (
|
|
32040
|
+
state = createInitialState(formConfig),
|
|
32041
|
+
action
|
|
32042
|
+
) => {
|
|
32043
|
+
switch (action.type) {
|
|
32044
|
+
case SET:
|
|
32045
|
+
const changedFieldName = action.payload.fieldName;
|
|
32046
|
+
const newRawValue = action.payload.value;
|
|
32047
|
+
|
|
32048
|
+
return produce(state, draftState => {
|
|
32049
|
+
let originalValue = draftState[changedFieldName].rawValue;
|
|
32050
|
+
draftState[changedFieldName].rawValue = newRawValue;
|
|
32051
|
+
if (computeConstraints(changedFieldName, draftState).length > 0) {
|
|
32052
|
+
// If the change violates constraints, revert the change
|
|
32053
|
+
draftState[changedFieldName].rawValue = originalValue;
|
|
32054
|
+
return draftState;
|
|
32055
|
+
}
|
|
32142
32056
|
|
|
32143
|
-
|
|
32144
|
-
|
|
32145
|
-
|
|
32146
|
-
|
|
32057
|
+
const fields = Object.entries(draftState);
|
|
32058
|
+
for (let entry of fields) {
|
|
32059
|
+
let fieldName = entry[0];
|
|
32060
|
+
let field = entry[1];
|
|
32061
|
+
let errors = computeErrors(fieldName, draftState);
|
|
32062
|
+
let dirty = fieldName === changedFieldName ? true : field.dirty;
|
|
32063
|
+
draftState[fieldName].errors = errors;
|
|
32064
|
+
draftState[fieldName].dirty = dirty;
|
|
32065
|
+
draftState[fieldName].hasErrors = errors.length > 0;
|
|
32066
|
+
}
|
|
32067
|
+
});
|
|
32068
|
+
case CLEAR:
|
|
32069
|
+
return createInitialState(formConfig);
|
|
32070
|
+
default:
|
|
32071
|
+
return state;
|
|
32072
|
+
}
|
|
32147
32073
|
};
|
|
32148
32074
|
|
|
32149
|
-
|
|
32075
|
+
const createMapDispatchToProps = formConfig => {
|
|
32150
32076
|
// Do memo-ization
|
|
32151
|
-
|
|
32152
|
-
|
|
32153
|
-
return
|
|
32077
|
+
let cachedDispatch;
|
|
32078
|
+
let cacheValue;
|
|
32079
|
+
return dispatch => {
|
|
32154
32080
|
if (dispatch == cachedDispatch) {
|
|
32155
32081
|
return cacheValue;
|
|
32156
32082
|
}
|
|
32157
|
-
|
|
32158
|
-
var dispatchObj = {};
|
|
32083
|
+
let dispatchObj = {};
|
|
32159
32084
|
dispatchObj.fields = {};
|
|
32160
|
-
|
|
32161
|
-
|
|
32162
|
-
var _loop = function _loop() {
|
|
32163
|
-
var fieldName = _keys[_i4];
|
|
32085
|
+
const keys = Object.keys(formConfig);
|
|
32086
|
+
for (let fieldName of keys) {
|
|
32164
32087
|
dispatchObj.fields[fieldName] = {
|
|
32165
|
-
set:
|
|
32166
|
-
return dispatch(set$2(fieldName)(value));
|
|
32167
|
-
}
|
|
32088
|
+
set: value => dispatch(set$2(fieldName)(value))
|
|
32168
32089
|
};
|
|
32169
|
-
};
|
|
32170
|
-
|
|
32171
|
-
for (var _i4 = 0, _keys = keys; _i4 < _keys.length; _i4++) {
|
|
32172
|
-
_loop();
|
|
32173
32090
|
}
|
|
32174
|
-
|
|
32175
|
-
dispatchObj.form = {
|
|
32176
|
-
clear: function clear() {
|
|
32177
|
-
return dispatch(_clear());
|
|
32178
|
-
}
|
|
32179
|
-
};
|
|
32091
|
+
dispatchObj.form = { clear: () => dispatch(clear()) };
|
|
32180
32092
|
cachedDispatch = dispatch;
|
|
32181
|
-
cacheValue = {
|
|
32182
|
-
actions: dispatchObj
|
|
32183
|
-
};
|
|
32093
|
+
cacheValue = { actions: dispatchObj };
|
|
32184
32094
|
return cacheValue;
|
|
32185
32095
|
};
|
|
32186
32096
|
};
|
|
32187
32097
|
|
|
32188
|
-
|
|
32189
|
-
return {
|
|
32190
|
-
fields: state
|
|
32191
|
-
};
|
|
32192
|
-
};
|
|
32098
|
+
const mapStateToProps = state => ({ fields: state });
|
|
32193
32099
|
|
|
32194
|
-
|
|
32195
|
-
|
|
32196
|
-
|
|
32197
|
-
|
|
32198
|
-
|
|
32199
|
-
};
|
|
32200
|
-
};
|
|
32100
|
+
const createFormState = formConfig => ({
|
|
32101
|
+
reducer: createFormReducer(formConfig),
|
|
32102
|
+
mapDispatchToProps: createMapDispatchToProps(formConfig),
|
|
32103
|
+
mapStateToProps: mapStateToProps
|
|
32104
|
+
});
|
|
32201
32105
|
|
|
32202
32106
|
var formatDelimiter = "_";
|
|
32203
32107
|
var phoneFormats = ["", "_", "__", "(___) ", "(___) _", "(___) __", "(___) ___-", "(___) ___-_", "(___) ___-__", "(___) ___-___", "(___) ___-____"];
|
|
@@ -36086,10 +35990,92 @@ var TitleModule = function TitleModule(_ref) {
|
|
|
36086
35990
|
}, subtitle)));
|
|
36087
35991
|
};
|
|
36088
35992
|
|
|
35993
|
+
var color$9 = "#15749D";
|
|
35994
|
+
var hoverColor$4 = "#116285";
|
|
35995
|
+
var activeColor$5 = "#0E506D";
|
|
35996
|
+
var fallbackValues$t = {
|
|
35997
|
+
color: color$9,
|
|
35998
|
+
hoverColor: hoverColor$4,
|
|
35999
|
+
activeColor: activeColor$5
|
|
36000
|
+
};
|
|
36001
|
+
|
|
36002
|
+
var AutopayModal = function AutopayModal(_ref) {
|
|
36003
|
+
var autoPayActive = _ref.autoPayActive,
|
|
36004
|
+
autoPaySchedule = _ref.autoPaySchedule,
|
|
36005
|
+
toggleModal = _ref.toggleModal,
|
|
36006
|
+
modalOpen = _ref.modalOpen,
|
|
36007
|
+
deactivatePaymentSchedule = _ref.deactivatePaymentSchedule,
|
|
36008
|
+
navigateToSettings = _ref.navigateToSettings,
|
|
36009
|
+
buttonLinkType = _ref.buttonLinkType,
|
|
36010
|
+
isMobile = _ref.isMobile,
|
|
36011
|
+
themeValues = _ref.themeValues;
|
|
36012
|
+
var modalExtraProps = {
|
|
36013
|
+
modalHeaderText: autoPayActive ? "Deactivate Autopay" : "Set Up Autopay",
|
|
36014
|
+
modalBodyText: autoPayActive ? "Are you sure you want to deactivate autopay? You will need to manually make your next payment." : "To set up autopay you must save a payment method and address in your profile. Do you want to save these now?",
|
|
36015
|
+
continueButtonText: autoPayActive ? "Disable Autopay" : "Add to Profile",
|
|
36016
|
+
useDangerButton: autoPayActive,
|
|
36017
|
+
continueAction: autoPayActive ? function () {
|
|
36018
|
+
deactivatePaymentSchedule(autoPaySchedule);
|
|
36019
|
+
toggleModal(false);
|
|
36020
|
+
} : navigateToSettings
|
|
36021
|
+
};
|
|
36022
|
+
var hoverStyles = "\n &:hover {\n .autopayIcon { fill: ".concat(themeValues.hoverColor, "; text-decoration: underline; cursor: pointer; }\n }");
|
|
36023
|
+
var activeStyles = "\n &:active {\n .autopayIcon { fill: ".concat(themeValues.activeColor, "; text-decoration: underline; }\n }");
|
|
36024
|
+
var defaultStyles = "\n .autopayIcon { fill: ".concat(themeValues.color, "; text-decoration: underline; }\n ");
|
|
36025
|
+
return /*#__PURE__*/React__default.createElement(Modal$1, _extends({
|
|
36026
|
+
ModalLink: function ModalLink() {
|
|
36027
|
+
return buttonLinkType ? /*#__PURE__*/React__default.createElement(ButtonWithAction, {
|
|
36028
|
+
text: autoPayActive ? "Manage Autopay" : "Set Up Autopay",
|
|
36029
|
+
variant: "tertiary",
|
|
36030
|
+
action: function action() {
|
|
36031
|
+
toggleModal(true);
|
|
36032
|
+
},
|
|
36033
|
+
dataQa: "Manage Autopay",
|
|
36034
|
+
extraStyles: isMobile && "flex-grow: 1; width: 100%;"
|
|
36035
|
+
}) : /*#__PURE__*/React__default.createElement(Box, {
|
|
36036
|
+
padding: "0",
|
|
36037
|
+
onClick: function onClick() {
|
|
36038
|
+
toggleModal(true);
|
|
36039
|
+
},
|
|
36040
|
+
hoverStyles: hoverStyles,
|
|
36041
|
+
activeStyles: activeStyles,
|
|
36042
|
+
extraStyles: defaultStyles
|
|
36043
|
+
}, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
36044
|
+
justify: isMobile ? "flex-start" : "flex-end",
|
|
36045
|
+
align: "center"
|
|
36046
|
+
}, /*#__PURE__*/React__default.createElement(AutopayOnIcon$1, null), /*#__PURE__*/React__default.createElement(ButtonWithAction, {
|
|
36047
|
+
text: "Autopay On",
|
|
36048
|
+
variant: "smallGhost",
|
|
36049
|
+
dataQa: "Autopay On",
|
|
36050
|
+
textExtraStyles: "font-size: 0.875rem; ",
|
|
36051
|
+
extraStyles: "min-width: auto; padding: 0 0 0 6px;"
|
|
36052
|
+
})));
|
|
36053
|
+
},
|
|
36054
|
+
showModal: function showModal() {
|
|
36055
|
+
return toggleModal(true);
|
|
36056
|
+
},
|
|
36057
|
+
hideModal: function hideModal() {
|
|
36058
|
+
return toggleModal(false);
|
|
36059
|
+
},
|
|
36060
|
+
modalOpen: modalOpen
|
|
36061
|
+
}, modalExtraProps));
|
|
36062
|
+
};
|
|
36063
|
+
|
|
36064
|
+
var AutopayModalModule = themeComponent(AutopayModal, "AutopayModal", fallbackValues$t);
|
|
36065
|
+
|
|
36089
36066
|
var AmountModule = function AmountModule(_ref) {
|
|
36090
36067
|
var totalAmountDue = _ref.totalAmountDue,
|
|
36091
36068
|
autoPayEnabled = _ref.autoPayEnabled,
|
|
36092
|
-
isMobile = _ref.isMobile
|
|
36069
|
+
isMobile = _ref.isMobile,
|
|
36070
|
+
deactivatePaymentSchedule = _ref.deactivatePaymentSchedule,
|
|
36071
|
+
navigateToSettings = _ref.navigateToSettings,
|
|
36072
|
+
autoPaySchedule = _ref.autoPaySchedule;
|
|
36073
|
+
|
|
36074
|
+
var _useState = React.useState(false),
|
|
36075
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
36076
|
+
modalOpen = _useState2[0],
|
|
36077
|
+
toggleModal = _useState2[1];
|
|
36078
|
+
|
|
36093
36079
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
36094
36080
|
padding: "0 0.25rem 0 0"
|
|
36095
36081
|
}, /*#__PURE__*/React__default.createElement(Stack, {
|
|
@@ -36097,29 +36083,43 @@ var AmountModule = function AmountModule(_ref) {
|
|
|
36097
36083
|
}, /*#__PURE__*/React__default.createElement(Text$1, {
|
|
36098
36084
|
variant: "pS",
|
|
36099
36085
|
weight: FONT_WEIGHT_SEMIBOLD,
|
|
36100
|
-
extraStyles: "text-align: right;"
|
|
36086
|
+
extraStyles: isMobile ? "text-align: left;" : "text-align: right;"
|
|
36101
36087
|
}, isMobile ? "Total Due" : "Total Amount Due"), /*#__PURE__*/React__default.createElement(AmountCallout$1, {
|
|
36102
36088
|
amount: displayCurrency(totalAmountDue),
|
|
36103
|
-
textAlign: "right"
|
|
36104
|
-
}), autoPayEnabled && /*#__PURE__*/React__default.createElement(
|
|
36105
|
-
|
|
36106
|
-
|
|
36107
|
-
|
|
36108
|
-
|
|
36109
|
-
|
|
36089
|
+
textAlign: isMobile ? "left" : "right"
|
|
36090
|
+
}), autoPayEnabled && /*#__PURE__*/React__default.createElement(AutopayModalModule, {
|
|
36091
|
+
autoPayActive: autoPayEnabled,
|
|
36092
|
+
autoPaySchedule: autoPaySchedule,
|
|
36093
|
+
toggleModal: toggleModal,
|
|
36094
|
+
modalOpen: modalOpen,
|
|
36095
|
+
navigateToSettings: navigateToSettings,
|
|
36096
|
+
deactivatePaymentSchedule: deactivatePaymentSchedule,
|
|
36097
|
+
isMobile: isMobile
|
|
36098
|
+
})));
|
|
36110
36099
|
};
|
|
36111
36100
|
|
|
36112
36101
|
var PaymentDetailsActions = function PaymentDetailsActions(_ref) {
|
|
36113
36102
|
var isMobile = _ref.isMobile,
|
|
36114
36103
|
obligations = _ref.obligations,
|
|
36115
36104
|
config = _ref.config,
|
|
36116
|
-
actions = _ref.actions
|
|
36105
|
+
actions = _ref.actions,
|
|
36106
|
+
autoPayEnabled = _ref.autoPayEnabled,
|
|
36107
|
+
autoPayAvailable = _ref.autoPayAvailable,
|
|
36108
|
+
handleAutopayAction = _ref.handleAutopayAction,
|
|
36109
|
+
deactivatePaymentSchedule = _ref.deactivatePaymentSchedule,
|
|
36110
|
+
navigateToSettings = _ref.navigateToSettings,
|
|
36111
|
+
autoPaySchedule = _ref.autoPaySchedule;
|
|
36117
36112
|
|
|
36118
36113
|
var _useState = React.useState(false),
|
|
36119
36114
|
_useState2 = _slicedToArray(_useState, 2),
|
|
36120
36115
|
isLoading = _useState2[0],
|
|
36121
36116
|
setIsLoading = _useState2[1];
|
|
36122
36117
|
|
|
36118
|
+
var _useState3 = React.useState(false),
|
|
36119
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
36120
|
+
modalOpen = _useState4[0],
|
|
36121
|
+
toggleModal = _useState4[1];
|
|
36122
|
+
|
|
36123
36123
|
var obligationSlug = config.obligationSlug;
|
|
36124
36124
|
var createPaymentFromProfile = actions.createPaymentFromProfile,
|
|
36125
36125
|
setDetailedObligation = actions.setDetailedObligation;
|
|
@@ -36135,12 +36135,47 @@ var PaymentDetailsActions = function PaymentDetailsActions(_ref) {
|
|
|
36135
36135
|
};
|
|
36136
36136
|
|
|
36137
36137
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
36138
|
-
padding: "16px 0 0",
|
|
36138
|
+
padding: isMobile ? "0" : "16px 0 0",
|
|
36139
36139
|
minWidth: "100%",
|
|
36140
36140
|
borderSize: "1px",
|
|
36141
36141
|
borderColor: GHOST_GREY,
|
|
36142
36142
|
borderWidthOverride: "1px 0 0 0",
|
|
36143
36143
|
key: "".concat(obligations[0].id, "-actions")
|
|
36144
|
+
}, isMobile && /*#__PURE__*/React__default.createElement(Box, {
|
|
36145
|
+
padding: "16px 24px",
|
|
36146
|
+
borderSize: "1px",
|
|
36147
|
+
borderColor: GHOST_GREY,
|
|
36148
|
+
borderWidthOverride: "0 0 1px 0"
|
|
36149
|
+
}, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
36150
|
+
justify: "space-between",
|
|
36151
|
+
align: "center",
|
|
36152
|
+
nowrap: true
|
|
36153
|
+
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
36154
|
+
padding: "0",
|
|
36155
|
+
width: "100%"
|
|
36156
|
+
}, /*#__PURE__*/React__default.createElement(AmountModule, {
|
|
36157
|
+
totalAmountDue: obligations.reduce(function (acc, curr) {
|
|
36158
|
+
return acc + curr.amountDue;
|
|
36159
|
+
}, 0),
|
|
36160
|
+
autoPayEnabled: autoPayEnabled,
|
|
36161
|
+
isMobile: isMobile,
|
|
36162
|
+
deactivatePaymentSchedule: deactivatePaymentSchedule,
|
|
36163
|
+
navigateToSettings: navigateToSettings,
|
|
36164
|
+
autoPaySchedule: autoPaySchedule
|
|
36165
|
+
})), /*#__PURE__*/React__default.createElement(Box, {
|
|
36166
|
+
padding: "0",
|
|
36167
|
+
width: "100%"
|
|
36168
|
+
}, /*#__PURE__*/React__default.createElement(ButtonWithAction, {
|
|
36169
|
+
isLoading: isLoading,
|
|
36170
|
+
action: function action() {
|
|
36171
|
+
return handleClick(obligations);
|
|
36172
|
+
},
|
|
36173
|
+
text: "Pay Now",
|
|
36174
|
+
variant: isMobile ? "smallSecondary" : "secondary",
|
|
36175
|
+
dataQa: "Pay Now",
|
|
36176
|
+
extraStyles: isMobile && "flex-grow: 1; width: 100%;"
|
|
36177
|
+
})))), /*#__PURE__*/React__default.createElement(Box, {
|
|
36178
|
+
padding: isMobile ? "16px" : "0"
|
|
36144
36179
|
}, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
36145
36180
|
justify: isMobile ? "center" : "flex-end",
|
|
36146
36181
|
align: "center",
|
|
@@ -36149,12 +36184,30 @@ var PaymentDetailsActions = function PaymentDetailsActions(_ref) {
|
|
|
36149
36184
|
padding: isMobile ? "0 8px 0 0" : "8px",
|
|
36150
36185
|
extraStyles: isMobile && "flex-grow: 1;"
|
|
36151
36186
|
}, /*#__PURE__*/React__default.createElement(ButtonWithAction, {
|
|
36152
|
-
variant:
|
|
36187
|
+
variant: "tertiary",
|
|
36153
36188
|
text: config.type === "ACCOUNT" ? "Account Details" : "Property Details",
|
|
36154
36189
|
action: handleDetailsClick,
|
|
36155
36190
|
dataQa: "Account Details",
|
|
36156
36191
|
extraStyles: isMobile && "flex-grow: 1; width: 100%;"
|
|
36157
36192
|
})), /*#__PURE__*/React__default.createElement(Box, {
|
|
36193
|
+
padding: isMobile ? "0 8px 0 0" : "8px",
|
|
36194
|
+
extraStyles: isMobile && "flex-grow: 1;"
|
|
36195
|
+
}, autoPayAvailable && !autoPayEnabled ? /*#__PURE__*/React__default.createElement(ButtonWithAction, {
|
|
36196
|
+
variant: "tertiary",
|
|
36197
|
+
text: "Set Up Autopay",
|
|
36198
|
+
action: handleAutopayAction,
|
|
36199
|
+
dataQa: "Set Up Autopay",
|
|
36200
|
+
extraStyles: isMobile && "flex-grow: 1; width: 100%;"
|
|
36201
|
+
}) : /*#__PURE__*/React__default.createElement(AutopayModalModule, {
|
|
36202
|
+
autoPayActive: autoPayEnabled,
|
|
36203
|
+
autoPaySchedule: autoPaySchedule,
|
|
36204
|
+
toggleModal: toggleModal,
|
|
36205
|
+
modalOpen: modalOpen,
|
|
36206
|
+
navigateToSettings: navigateToSettings,
|
|
36207
|
+
deactivatePaymentSchedule: deactivatePaymentSchedule,
|
|
36208
|
+
buttonLinkType: true,
|
|
36209
|
+
isMobile: isMobile
|
|
36210
|
+
})), !isMobile && /*#__PURE__*/React__default.createElement(Box, {
|
|
36158
36211
|
padding: isMobile ? "0 0 0 8px" : "8px",
|
|
36159
36212
|
extraStyles: isMobile && "flex-grow: 1;"
|
|
36160
36213
|
}, /*#__PURE__*/React__default.createElement(ButtonWithAction, {
|
|
@@ -36162,11 +36215,11 @@ var PaymentDetailsActions = function PaymentDetailsActions(_ref) {
|
|
|
36162
36215
|
action: function action() {
|
|
36163
36216
|
return handleClick(obligations);
|
|
36164
36217
|
},
|
|
36165
|
-
text: "
|
|
36166
|
-
variant: isMobile ? "
|
|
36167
|
-
dataQa: "
|
|
36218
|
+
text: "Pay Now",
|
|
36219
|
+
variant: isMobile ? "smallSecondary" : "secondary",
|
|
36220
|
+
dataQa: "Pay Now",
|
|
36168
36221
|
extraStyles: isMobile && "flex-grow: 1; width: 100%;"
|
|
36169
|
-
}))));
|
|
36222
|
+
})))));
|
|
36170
36223
|
};
|
|
36171
36224
|
|
|
36172
36225
|
var Obligation = function Obligation(_ref) {
|
|
@@ -36174,13 +36227,20 @@ var Obligation = function Obligation(_ref) {
|
|
|
36174
36227
|
obligations = _ref.obligations,
|
|
36175
36228
|
actions = _ref.actions,
|
|
36176
36229
|
autoPayEnabled = _ref.autoPayEnabled,
|
|
36230
|
+
autoPayAvailable = _ref.autoPayAvailable,
|
|
36231
|
+
handleAutopayAction = _ref.handleAutopayAction,
|
|
36232
|
+
deactivatePaymentSchedule = _ref.deactivatePaymentSchedule,
|
|
36233
|
+
autoPaySchedule = _ref.autoPaySchedule,
|
|
36234
|
+
navigateToSettings = _ref.navigateToSettings,
|
|
36177
36235
|
isMobile = _ref.isMobile;
|
|
36178
36236
|
var obligation = obligations[0];
|
|
36179
36237
|
var customAttributes = obligation.customAttributes;
|
|
36180
36238
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
36181
|
-
|
|
36239
|
+
padding: "0",
|
|
36182
36240
|
borderRadius: "4px",
|
|
36183
36241
|
boxShadow: "0px 0px 5px 0px ".concat(GHOST_GREY)
|
|
36242
|
+
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
36243
|
+
background: WHITE
|
|
36184
36244
|
}, /*#__PURE__*/React__default.createElement(Stack, {
|
|
36185
36245
|
childGap: "14px"
|
|
36186
36246
|
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
@@ -36197,7 +36257,7 @@ var Obligation = function Obligation(_ref) {
|
|
|
36197
36257
|
}, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
36198
36258
|
justify: "flex-start",
|
|
36199
36259
|
align: "center"
|
|
36200
|
-
},
|
|
36260
|
+
}, /*#__PURE__*/React__default.createElement(IconsModule, {
|
|
36201
36261
|
icon: config.icon,
|
|
36202
36262
|
iconDefault: config.iconDefault,
|
|
36203
36263
|
configIconMap: config.iconMap,
|
|
@@ -36208,18 +36268,38 @@ var Obligation = function Obligation(_ref) {
|
|
|
36208
36268
|
subtitle: obligation.subDescription,
|
|
36209
36269
|
titleColor: BRIGHT_GREY,
|
|
36210
36270
|
isMobile: isMobile
|
|
36211
|
-
}))), /*#__PURE__*/React__default.createElement(AmountModule, {
|
|
36271
|
+
}))), !isMobile && /*#__PURE__*/React__default.createElement(AmountModule, {
|
|
36212
36272
|
totalAmountDue: obligations.reduce(function (acc, curr) {
|
|
36213
36273
|
return acc + curr.amountDue;
|
|
36214
36274
|
}, 0),
|
|
36215
36275
|
autoPayEnabled: autoPayEnabled,
|
|
36276
|
+
isMobile: isMobile,
|
|
36277
|
+
deactivatePaymentSchedule: deactivatePaymentSchedule,
|
|
36278
|
+
navigateToSettings: navigateToSettings,
|
|
36279
|
+
autoPaySchedule: autoPaySchedule
|
|
36280
|
+
}))), !isMobile && /*#__PURE__*/React__default.createElement(PaymentDetailsActions, {
|
|
36281
|
+
obligations: obligations,
|
|
36282
|
+
autoPayEnabled: autoPayEnabled,
|
|
36283
|
+
autoPayAvailable: autoPayAvailable,
|
|
36284
|
+
handleAutopayAction: handleAutopayAction,
|
|
36285
|
+
deactivatePaymentSchedule: deactivatePaymentSchedule,
|
|
36286
|
+
autoPaySchedule: autoPaySchedule,
|
|
36287
|
+
navigateToSettings: navigateToSettings,
|
|
36288
|
+
config: config,
|
|
36289
|
+
actions: actions,
|
|
36216
36290
|
isMobile: isMobile
|
|
36217
|
-
}))), /*#__PURE__*/React__default.createElement(PaymentDetailsActions, {
|
|
36291
|
+
}))), isMobile && /*#__PURE__*/React__default.createElement(PaymentDetailsActions, {
|
|
36218
36292
|
obligations: obligations,
|
|
36293
|
+
autoPayEnabled: autoPayEnabled,
|
|
36294
|
+
autoPayAvailable: autoPayAvailable,
|
|
36295
|
+
handleAutopayAction: handleAutopayAction,
|
|
36296
|
+
deactivatePaymentSchedule: deactivatePaymentSchedule,
|
|
36297
|
+
autoPaySchedule: autoPaySchedule,
|
|
36298
|
+
navigateToSettings: navigateToSettings,
|
|
36219
36299
|
config: config,
|
|
36220
36300
|
actions: actions,
|
|
36221
36301
|
isMobile: isMobile
|
|
36222
|
-
}))
|
|
36302
|
+
}));
|
|
36223
36303
|
};
|
|
36224
36304
|
|
|
36225
36305
|
var PartialAmountForm = function PartialAmountForm(_ref) {
|
|
@@ -36386,7 +36466,7 @@ var labeledAmountTotal = {
|
|
|
36386
36466
|
"default": "h6",
|
|
36387
36467
|
small: "pL"
|
|
36388
36468
|
};
|
|
36389
|
-
var fallbackValues$
|
|
36469
|
+
var fallbackValues$u = {
|
|
36390
36470
|
backgroundColor: backgroundColor$7,
|
|
36391
36471
|
lineItem: lineItem,
|
|
36392
36472
|
labeledAmountSubtotal: labeledAmountSubtotal,
|
|
@@ -36547,7 +36627,7 @@ var PaymentDetails = function PaymentDetails(_ref4) {
|
|
|
36547
36627
|
});
|
|
36548
36628
|
};
|
|
36549
36629
|
|
|
36550
|
-
var PaymentDetails$1 = themeComponent(PaymentDetails, "PaymentDetails", fallbackValues$
|
|
36630
|
+
var PaymentDetails$1 = themeComponent(PaymentDetails, "PaymentDetails", fallbackValues$u, "default");
|
|
36551
36631
|
|
|
36552
36632
|
var linkColor$1 = {
|
|
36553
36633
|
"default": "#357fb8",
|
|
@@ -36569,7 +36649,7 @@ var modalLinkHoverFocus = {
|
|
|
36569
36649
|
"default": "",
|
|
36570
36650
|
footer: "outline: none; text-decoration: underline;"
|
|
36571
36651
|
};
|
|
36572
|
-
var fallbackValues$
|
|
36652
|
+
var fallbackValues$v = {
|
|
36573
36653
|
linkColor: linkColor$1,
|
|
36574
36654
|
fontSize: fontSize$8,
|
|
36575
36655
|
lineHeight: lineHeight$4,
|
|
@@ -36632,7 +36712,7 @@ var AccountAndRoutingModal = function AccountAndRoutingModal(_ref) {
|
|
|
36632
36712
|
});
|
|
36633
36713
|
};
|
|
36634
36714
|
|
|
36635
|
-
var AccountAndRoutingModal$1 = themeComponent(AccountAndRoutingModal, "AccountAndRoutingModal", fallbackValues$
|
|
36715
|
+
var AccountAndRoutingModal$1 = themeComponent(AccountAndRoutingModal, "AccountAndRoutingModal", fallbackValues$v, "default");
|
|
36636
36716
|
|
|
36637
36717
|
function _templateObject$z() {
|
|
36638
36718
|
var data = _taggedTemplateLiteral([""]);
|
|
@@ -37018,7 +37098,7 @@ var headingDisabledColor = "".concat(ATHENS_GREY);
|
|
|
37018
37098
|
var bodyBackgroundColor$1 = "#eeeeee";
|
|
37019
37099
|
var borderColor$2 = "".concat(GREY_CHATEAU);
|
|
37020
37100
|
var focusStyles$1 = "outline: none;";
|
|
37021
|
-
var fallbackValues$
|
|
37101
|
+
var fallbackValues$w = {
|
|
37022
37102
|
headingBackgroundColor: headingBackgroundColor$1,
|
|
37023
37103
|
headingDisabledColor: headingDisabledColor,
|
|
37024
37104
|
bodyBackgroundColor: bodyBackgroundColor$1,
|
|
@@ -37205,7 +37285,7 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
37205
37285
|
})));
|
|
37206
37286
|
};
|
|
37207
37287
|
|
|
37208
|
-
var RadioSection$1 = themeComponent(RadioSection, "RadioSection", fallbackValues$
|
|
37288
|
+
var RadioSection$1 = themeComponent(RadioSection, "RadioSection", fallbackValues$w);
|
|
37209
37289
|
|
|
37210
37290
|
var RegistrationForm = function RegistrationForm(_ref) {
|
|
37211
37291
|
var _emailErrorMessages, _passwordErrorMessage;
|
|
@@ -37492,7 +37572,7 @@ var ResetPasswordSuccess = withWindowSize(ResetConfirmationForm$2);
|
|
|
37492
37572
|
var activeTabBackground = "#FFFFFF";
|
|
37493
37573
|
var activeTabAccent = "#15749D";
|
|
37494
37574
|
var activeTabHover = "#B8D5E1";
|
|
37495
|
-
var fallbackValues$
|
|
37575
|
+
var fallbackValues$x = {
|
|
37496
37576
|
activeTabBackground: activeTabBackground,
|
|
37497
37577
|
activeTabAccent: activeTabAccent,
|
|
37498
37578
|
activeTabHover: activeTabHover
|
|
@@ -37548,7 +37628,7 @@ var TabSidebar = function TabSidebar(_ref) {
|
|
|
37548
37628
|
})));
|
|
37549
37629
|
};
|
|
37550
37630
|
|
|
37551
|
-
var TabSidebar$1 = themeComponent(TabSidebar, "ProfileTab", fallbackValues$
|
|
37631
|
+
var TabSidebar$1 = themeComponent(TabSidebar, "ProfileTab", fallbackValues$x);
|
|
37552
37632
|
|
|
37553
37633
|
var backgroundColor$8 = {
|
|
37554
37634
|
"default": "#ffffff",
|
|
@@ -37578,7 +37658,7 @@ var modalLinkHoverFocus$1 = {
|
|
|
37578
37658
|
"default": "",
|
|
37579
37659
|
footer: "outline: none; text-decoration: underline;"
|
|
37580
37660
|
};
|
|
37581
|
-
var fallbackValues$
|
|
37661
|
+
var fallbackValues$y = {
|
|
37582
37662
|
backgroundColor: backgroundColor$8,
|
|
37583
37663
|
linkColor: linkColor$2,
|
|
37584
37664
|
border: border$2,
|
|
@@ -37642,7 +37722,7 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
|
|
|
37642
37722
|
});
|
|
37643
37723
|
};
|
|
37644
37724
|
|
|
37645
|
-
var TermsAndConditionsModal$1 = themeComponent(TermsAndConditionsModal, "TermsAndConditionsModal", fallbackValues$
|
|
37725
|
+
var TermsAndConditionsModal$1 = themeComponent(TermsAndConditionsModal, "TermsAndConditionsModal", fallbackValues$y, "default");
|
|
37646
37726
|
|
|
37647
37727
|
function _templateObject2$l() {
|
|
37648
37728
|
var data = _taggedTemplateLiteral([""]);
|
|
@@ -37729,6 +37809,43 @@ var TermsAndConditions = function TermsAndConditions(_ref) {
|
|
|
37729
37809
|
})))));
|
|
37730
37810
|
};
|
|
37731
37811
|
|
|
37812
|
+
var Timeout = function Timeout(_ref) {
|
|
37813
|
+
var onLogout = _ref.onLogout;
|
|
37814
|
+
|
|
37815
|
+
var _useContext = React.useContext(styled.ThemeContext),
|
|
37816
|
+
isMobile = _useContext.isMobile;
|
|
37817
|
+
|
|
37818
|
+
return /*#__PURE__*/React__default.createElement(Cover, null, /*#__PURE__*/React__default.createElement(Center, {
|
|
37819
|
+
intrinsic: true
|
|
37820
|
+
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
37821
|
+
padding: "0",
|
|
37822
|
+
maxWidth: isMobile ? "100%" : "500px"
|
|
37823
|
+
}, /*#__PURE__*/React__default.createElement(Stack, {
|
|
37824
|
+
childGap: "32px",
|
|
37825
|
+
justify: "center"
|
|
37826
|
+
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
37827
|
+
padding: isMobile ? "1rem" : "0"
|
|
37828
|
+
}, /*#__PURE__*/React__default.createElement(TimeoutImage, null)), /*#__PURE__*/React__default.createElement(Box, {
|
|
37829
|
+
padding: "0"
|
|
37830
|
+
}, /*#__PURE__*/React__default.createElement(Heading$1, {
|
|
37831
|
+
textAlign: "center",
|
|
37832
|
+
weight: FONT_WEIGHT_BOLD
|
|
37833
|
+
}, "Request Timed Out"), /*#__PURE__*/React__default.createElement(Paragraph$1, {
|
|
37834
|
+
variant: "pL",
|
|
37835
|
+
extraStyles: "text-align: center;"
|
|
37836
|
+
}, "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, {
|
|
37837
|
+
intrinsic: true
|
|
37838
|
+
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
37839
|
+
padding: "0"
|
|
37840
|
+
}, /*#__PURE__*/React__default.createElement(ButtonWithAction, {
|
|
37841
|
+
variant: "primary",
|
|
37842
|
+
text: "Log out",
|
|
37843
|
+
action: onLogout
|
|
37844
|
+
})))))));
|
|
37845
|
+
};
|
|
37846
|
+
|
|
37847
|
+
var Timeout$1 = withWindowSize(Timeout);
|
|
37848
|
+
|
|
37732
37849
|
var WorkflowTile = function WorkflowTile(_ref) {
|
|
37733
37850
|
var _ref$workflowName = _ref.workflowName,
|
|
37734
37851
|
workflowName = _ref$workflowName === void 0 ? "Test Workflow" : _ref$workflowName,
|
|
@@ -37772,7 +37889,7 @@ var WorkflowTile = function WorkflowTile(_ref) {
|
|
|
37772
37889
|
};
|
|
37773
37890
|
|
|
37774
37891
|
var pageBackground = "#F6F6F9";
|
|
37775
|
-
var fallbackValues$
|
|
37892
|
+
var fallbackValues$z = {
|
|
37776
37893
|
pageBackground: pageBackground
|
|
37777
37894
|
};
|
|
37778
37895
|
|
|
@@ -37819,7 +37936,7 @@ var CenterSingle = function CenterSingle(_ref) {
|
|
|
37819
37936
|
})));
|
|
37820
37937
|
};
|
|
37821
37938
|
|
|
37822
|
-
var CenterSingle$1 = withWindowSize(themeComponent(CenterSingle, "Global", fallbackValues$
|
|
37939
|
+
var CenterSingle$1 = withWindowSize(themeComponent(CenterSingle, "Global", fallbackValues$z));
|
|
37823
37940
|
|
|
37824
37941
|
var CenterStack = function CenterStack(_ref) {
|
|
37825
37942
|
var header = _ref.header,
|
|
@@ -37861,7 +37978,7 @@ var CenterStack = function CenterStack(_ref) {
|
|
|
37861
37978
|
})));
|
|
37862
37979
|
};
|
|
37863
37980
|
|
|
37864
|
-
var CenterStack$1 = withWindowSize(themeComponent(CenterStack, "Global", fallbackValues$
|
|
37981
|
+
var CenterStack$1 = withWindowSize(themeComponent(CenterStack, "Global", fallbackValues$z));
|
|
37865
37982
|
|
|
37866
37983
|
var CenterSingle$2 = function CenterSingle(_ref) {
|
|
37867
37984
|
var header = _ref.header,
|
|
@@ -37901,7 +38018,7 @@ var CenterSingle$2 = function CenterSingle(_ref) {
|
|
|
37901
38018
|
})));
|
|
37902
38019
|
};
|
|
37903
38020
|
|
|
37904
|
-
var DefaultPageTemplate = withWindowSize(themeComponent(CenterSingle$2, "Global", fallbackValues$
|
|
38021
|
+
var DefaultPageTemplate = withWindowSize(themeComponent(CenterSingle$2, "Global", fallbackValues$z));
|
|
37905
38022
|
|
|
37906
38023
|
var SidebarSingleContent = function SidebarSingleContent(_ref) {
|
|
37907
38024
|
var header = _ref.header,
|
|
@@ -37955,7 +38072,7 @@ var SidebarSingleContent = function SidebarSingleContent(_ref) {
|
|
|
37955
38072
|
})));
|
|
37956
38073
|
};
|
|
37957
38074
|
|
|
37958
|
-
var SidebarSingleContent$1 = withWindowSize(themeComponent(SidebarSingleContent, "Global", fallbackValues$
|
|
38075
|
+
var SidebarSingleContent$1 = withWindowSize(themeComponent(SidebarSingleContent, "Global", fallbackValues$z));
|
|
37959
38076
|
|
|
37960
38077
|
var SidebarStackContent = function SidebarStackContent(_ref) {
|
|
37961
38078
|
var header = _ref.header,
|
|
@@ -38026,7 +38143,7 @@ var SidebarStackContent = function SidebarStackContent(_ref) {
|
|
|
38026
38143
|
})));
|
|
38027
38144
|
};
|
|
38028
38145
|
|
|
38029
|
-
var SidebarStackContent$1 = withWindowSize(themeComponent(SidebarStackContent, "Global", fallbackValues$
|
|
38146
|
+
var SidebarStackContent$1 = withWindowSize(themeComponent(SidebarStackContent, "Global", fallbackValues$z));
|
|
38030
38147
|
|
|
38031
38148
|
|
|
38032
38149
|
|
|
@@ -38053,6 +38170,7 @@ exports.AddObligation = AddObligation$1;
|
|
|
38053
38170
|
exports.AddressForm = AddressForm;
|
|
38054
38171
|
exports.Alert = Alert$1;
|
|
38055
38172
|
exports.AmountCallout = AmountCallout$1;
|
|
38173
|
+
exports.AutopayOnIcon = AutopayOnIcon$1;
|
|
38056
38174
|
exports.BankIcon = BankIcon;
|
|
38057
38175
|
exports.Box = Box;
|
|
38058
38176
|
exports.Breadcrumb = Breadcrumbs;
|
|
@@ -38149,6 +38267,8 @@ exports.TableListItem = TableListItem;
|
|
|
38149
38267
|
exports.TermsAndConditions = TermsAndConditions;
|
|
38150
38268
|
exports.TermsAndConditionsModal = TermsAndConditionsModal$1;
|
|
38151
38269
|
exports.Text = Text$1;
|
|
38270
|
+
exports.Timeout = Timeout$1;
|
|
38271
|
+
exports.TimeoutImage = TimeoutImage;
|
|
38152
38272
|
exports.ToggleSwitch = ToggleSwitch$1;
|
|
38153
38273
|
exports.VerifiedEmailIcon = VerifiedEmailIcon$1;
|
|
38154
38274
|
exports.WorkflowTile = WorkflowTile;
|