@thecb/components 3.5.7 → 3.5.10
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 +408 -638
- package/package.json +1 -1
- package/src/components/molecules/collapsible-section/CollapsibleSection.js +2 -2
- package/src/components/molecules/nav-menu/NavMenu.theme.js +9 -2
- package/src/components/molecules/nav-menu/NavMenuDesktop.js +6 -1
- package/src/components/molecules/nav-menu/NavMenuMobile.js +6 -1
- package/src/components/molecules/workflow-tile/WorkflowTile.js +4 -3
- package/src/deprecated/icons/AlertSuccessIcon.js +3 -3
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
|
|
|
@@ -14148,7 +14091,7 @@ var AlertSuccessIcon = function AlertSuccessIcon() {
|
|
|
14148
14091
|
xmlnsXlink: "http://www.w3.org/1999/xlink"
|
|
14149
14092
|
}, /*#__PURE__*/React__default.createElement("defs", null, /*#__PURE__*/React__default.createElement("path", {
|
|
14150
14093
|
d: "M12,24 C18.627417,24 24,18.627417 24,12 C24,5.372583 18.627417,0 12,0 C5.372583,0 0,5.372583 0,12 C0,18.627417 5.372583,24 12,24 Z M16.9497475,7.46446609 L18.363961,8.87867966 L9.87867966,17.363961 L5.63603897,13.1213203 L7.05025253,11.7071068 L9.87803897,14.5354661 L16.9497475,7.46446609 Z",
|
|
14151
|
-
id: "
|
|
14094
|
+
id: "alertSuccess"
|
|
14152
14095
|
})), /*#__PURE__*/React__default.createElement("g", {
|
|
14153
14096
|
id: "Symbols",
|
|
14154
14097
|
stroke: "none",
|
|
@@ -14165,12 +14108,12 @@ var AlertSuccessIcon = function AlertSuccessIcon() {
|
|
|
14165
14108
|
id: "mask-2",
|
|
14166
14109
|
fill: "white"
|
|
14167
14110
|
}, /*#__PURE__*/React__default.createElement("use", {
|
|
14168
|
-
xlinkHref: "#
|
|
14111
|
+
xlinkHref: "#alertSuccess"
|
|
14169
14112
|
})), /*#__PURE__*/React__default.createElement("use", {
|
|
14170
14113
|
id: "background-2",
|
|
14171
14114
|
fill: "#47B872",
|
|
14172
14115
|
fillRule: "nonzero",
|
|
14173
|
-
xlinkHref: "#
|
|
14116
|
+
xlinkHref: "#alertSuccess"
|
|
14174
14117
|
})))));
|
|
14175
14118
|
};
|
|
14176
14119
|
|
|
@@ -30573,401 +30516,378 @@ var ToggleSwitch = function ToggleSwitch(_ref6) {
|
|
|
30573
30516
|
|
|
30574
30517
|
var ToggleSwitch$1 = themeComponent(ToggleSwitch, "ToggleSwitch", fallbackValues$o);
|
|
30575
30518
|
|
|
30576
|
-
|
|
30577
|
-
|
|
30578
|
-
|
|
30579
|
-
|
|
30580
|
-
}
|
|
30519
|
+
const validatorToPredicate = (validatorFn, emptyCase) => (
|
|
30520
|
+
value,
|
|
30521
|
+
...rest
|
|
30522
|
+
) => (value === "" ? emptyCase : validatorFn(value, ...rest));
|
|
30581
30523
|
|
|
30582
|
-
return value === "" ? emptyCase : validatorFn.apply(void 0, [value].concat(rest));
|
|
30583
|
-
};
|
|
30584
|
-
};
|
|
30585
30524
|
/* eslint-disable no-unused-vars */
|
|
30586
30525
|
|
|
30587
|
-
|
|
30588
|
-
|
|
30589
|
-
var validator = function validator() {
|
|
30590
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
30591
|
-
args[_key2] = arguments[_key2];
|
|
30592
|
-
}
|
|
30593
|
-
|
|
30594
|
-
return {
|
|
30595
|
-
type: type,
|
|
30596
|
-
args: args,
|
|
30597
|
-
error: error
|
|
30598
|
-
};
|
|
30599
|
-
};
|
|
30600
|
-
|
|
30526
|
+
const createValidator = (type, error) => {
|
|
30527
|
+
let validator = (...args) => ({ type, args, error });
|
|
30601
30528
|
validator.error = error;
|
|
30602
30529
|
return validator;
|
|
30603
30530
|
};
|
|
30604
30531
|
|
|
30605
|
-
|
|
30606
|
-
var REQUIRED = "validator/REQUIRED";
|
|
30607
|
-
var REQUIRED_ERROR = "error/REQUIRED";
|
|
30608
|
-
var required = createValidator(REQUIRED, REQUIRED_ERROR);
|
|
30609
|
-
|
|
30610
|
-
validatorFns[REQUIRED] = function (value, args, form) {
|
|
30611
|
-
return value !== "";
|
|
30612
|
-
};
|
|
30532
|
+
let validatorFns = {};
|
|
30613
30533
|
|
|
30614
|
-
|
|
30615
|
-
|
|
30616
|
-
|
|
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 !== "";
|
|
30617
30538
|
|
|
30618
|
-
|
|
30619
|
-
|
|
30620
|
-
|
|
30621
|
-
|
|
30622
|
-
var ONLY_NATURALS = "validator/ONLY_NATURALS";
|
|
30623
|
-
var ONLY_NATURALS_ERROR = "error/ONLY_NATURALS";
|
|
30624
|
-
var onlyNaturals = createValidator(ONLY_NATURALS, ONLY_NATURALS_ERROR);
|
|
30625
|
-
|
|
30626
|
-
validatorFns[ONLY_NATURALS] = function (value, args, form) {
|
|
30627
|
-
return /^(\d+)?$/.test(value);
|
|
30628
|
-
};
|
|
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);
|
|
30629
30543
|
|
|
30630
|
-
|
|
30631
|
-
|
|
30632
|
-
|
|
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);
|
|
30633
30548
|
|
|
30634
|
-
|
|
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) => {
|
|
30635
30556
|
if (value === "") {
|
|
30636
30557
|
return true;
|
|
30637
30558
|
}
|
|
30638
|
-
|
|
30639
30559
|
return Number(value) < args[0];
|
|
30640
30560
|
};
|
|
30641
30561
|
|
|
30642
|
-
|
|
30643
|
-
|
|
30644
|
-
|
|
30645
|
-
|
|
30646
|
-
|
|
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) => {
|
|
30647
30571
|
if (value === "") {
|
|
30648
30572
|
return true;
|
|
30649
30573
|
}
|
|
30650
|
-
|
|
30651
30574
|
return Number(value) <= args[0];
|
|
30652
30575
|
};
|
|
30653
30576
|
|
|
30654
|
-
|
|
30655
|
-
|
|
30656
|
-
|
|
30657
|
-
|
|
30658
|
-
|
|
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) => {
|
|
30659
30584
|
if (value === "") {
|
|
30660
30585
|
return true;
|
|
30661
30586
|
}
|
|
30662
|
-
|
|
30663
30587
|
return Number(value) > args[0];
|
|
30664
30588
|
};
|
|
30665
30589
|
|
|
30666
|
-
|
|
30667
|
-
|
|
30668
|
-
|
|
30669
|
-
|
|
30670
|
-
|
|
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) => {
|
|
30671
30599
|
if (value === "") {
|
|
30672
30600
|
return true;
|
|
30673
30601
|
}
|
|
30674
|
-
|
|
30675
30602
|
return Number(value) >= args[0];
|
|
30676
30603
|
};
|
|
30677
30604
|
|
|
30678
|
-
|
|
30679
|
-
|
|
30680
|
-
|
|
30681
|
-
|
|
30682
|
-
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) => {
|
|
30683
30609
|
if (value === "") {
|
|
30684
30610
|
return true;
|
|
30685
30611
|
}
|
|
30686
|
-
|
|
30687
30612
|
if (form[args[0]] === undefined) {
|
|
30688
|
-
throw new Error(
|
|
30613
|
+
throw new Error(
|
|
30614
|
+
`${args[0]} was passed to matchesField, but that field does not exist in the form`
|
|
30615
|
+
);
|
|
30689
30616
|
}
|
|
30690
|
-
|
|
30691
30617
|
return value === form[args[0]].rawValue;
|
|
30692
30618
|
};
|
|
30693
30619
|
|
|
30694
|
-
|
|
30695
|
-
|
|
30696
|
-
|
|
30697
|
-
|
|
30698
|
-
|
|
30699
|
-
|
|
30700
|
-
|
|
30701
|
-
|
|
30702
|
-
|
|
30703
|
-
|
|
30704
|
-
|
|
30705
|
-
|
|
30706
|
-
|
|
30707
|
-
|
|
30708
|
-
|
|
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
|
+
});
|
|
30709
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";
|
|
30710
30643
|
|
|
30711
|
-
|
|
30712
|
-
|
|
30713
|
-
|
|
30714
|
-
|
|
30715
|
-
optionalFieldName = _args[2];
|
|
30716
|
-
|
|
30717
|
-
var dependsOnOtherField = typeof optionalFieldName === "string";
|
|
30718
|
-
|
|
30719
|
-
if (primaryValidator.type === undefined || typeof validatorFns[primaryValidator.type] !== "function") {
|
|
30644
|
+
if (
|
|
30645
|
+
primaryValidator.type === undefined ||
|
|
30646
|
+
typeof validatorFns[primaryValidator.type] !== "function"
|
|
30647
|
+
) {
|
|
30720
30648
|
throw new Error(validateWhenErrorMessage(primaryValidator.type));
|
|
30721
30649
|
}
|
|
30722
|
-
|
|
30723
30650
|
if (dependsOnOtherField && form[optionalFieldName] === undefined) {
|
|
30724
|
-
throw new Error(
|
|
30651
|
+
throw new Error(
|
|
30652
|
+
`${args[2]} was passed to matchesField, but that field does not exist in the form`
|
|
30653
|
+
);
|
|
30725
30654
|
}
|
|
30726
30655
|
|
|
30727
|
-
|
|
30728
|
-
|
|
30729
|
-
|
|
30730
|
-
|
|
30731
|
-
|
|
30732
|
-
|
|
30733
|
-
|
|
30734
|
-
|
|
30735
|
-
|
|
30736
|
-
|
|
30737
|
-
|
|
30738
|
-
|
|
30739
|
-
|
|
30740
|
-
var validateSum = function validateSum(validator, fieldNamesArray) {
|
|
30741
|
-
return {
|
|
30742
|
-
type: VALIDATE_SUM,
|
|
30743
|
-
args: [validator, fieldNamesArray],
|
|
30744
|
-
error: validator.error
|
|
30745
|
-
};
|
|
30746
|
-
};
|
|
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
|
+
);
|
|
30747
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
|
+
});
|
|
30748
30691
|
validateSum.error = VALIDATE_SUM_ERROR;
|
|
30692
|
+
validatorFns[VALIDATE_SUM] = (value, args, form) => {
|
|
30693
|
+
const [validator, fieldNamesArray] = args;
|
|
30749
30694
|
|
|
30750
|
-
|
|
30751
|
-
|
|
30752
|
-
|
|
30753
|
-
|
|
30754
|
-
|
|
30755
|
-
if (validator.type === undefined || typeof validatorFns[validator.type] !== "function") {
|
|
30695
|
+
if (
|
|
30696
|
+
validator.type === undefined ||
|
|
30697
|
+
typeof validatorFns[validator.type] !== "function"
|
|
30698
|
+
) {
|
|
30756
30699
|
throw new Error(validateSumErrorMessage(validator.type));
|
|
30757
30700
|
}
|
|
30758
30701
|
|
|
30759
|
-
|
|
30760
|
-
|
|
30761
|
-
|
|
30762
|
-
|
|
30763
|
-
|
|
30764
|
-
var fieldName = _step.value;
|
|
30765
|
-
|
|
30766
|
-
if (form[fieldName] === undefined) {
|
|
30767
|
-
throw new Error("".concat(fieldName, " was passed to matchesField, but that field does not exist in the form"));
|
|
30768
|
-
}
|
|
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
|
+
);
|
|
30769
30707
|
}
|
|
30770
|
-
} catch (err) {
|
|
30771
|
-
_iterator.e(err);
|
|
30772
|
-
} finally {
|
|
30773
|
-
_iterator.f();
|
|
30774
30708
|
}
|
|
30775
30709
|
|
|
30776
|
-
|
|
30777
|
-
|
|
30778
|
-
|
|
30710
|
+
const sum = fieldNamesArray.reduce(
|
|
30711
|
+
(acc, curr) => acc + Number(form[curr].rawValue),
|
|
30712
|
+
Number(value)
|
|
30713
|
+
);
|
|
30714
|
+
|
|
30779
30715
|
return validatorFns[validator.type](sum, validator.args, form);
|
|
30780
30716
|
};
|
|
30781
30717
|
|
|
30782
|
-
|
|
30783
|
-
|
|
30784
|
-
|
|
30785
|
-
|
|
30786
|
-
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) => {
|
|
30787
30722
|
if (value === "") {
|
|
30788
30723
|
return true;
|
|
30789
30724
|
}
|
|
30790
|
-
|
|
30791
|
-
|
|
30792
|
-
var max = args[1];
|
|
30793
|
-
|
|
30725
|
+
const min = args[0];
|
|
30726
|
+
const max = args[1];
|
|
30794
30727
|
if (max == undefined || min == undefined) {
|
|
30795
|
-
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
|
+
);
|
|
30796
30731
|
}
|
|
30797
|
-
|
|
30798
30732
|
if (max < min) {
|
|
30799
|
-
throw new Error(
|
|
30733
|
+
throw new Error(
|
|
30734
|
+
"hasLength validator was passed a min greater than the max"
|
|
30735
|
+
);
|
|
30800
30736
|
}
|
|
30801
|
-
|
|
30802
|
-
var valueLength = value.length;
|
|
30737
|
+
const valueLength = value.length;
|
|
30803
30738
|
return max >= valueLength && valueLength >= min;
|
|
30804
30739
|
};
|
|
30805
30740
|
|
|
30806
|
-
|
|
30807
|
-
|
|
30808
|
-
|
|
30809
|
-
|
|
30810
|
-
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) => {
|
|
30811
30745
|
if (value === "") {
|
|
30812
30746
|
return true;
|
|
30813
30747
|
}
|
|
30814
|
-
|
|
30815
30748
|
return new RegExp(args[0]).test(value); // new RexExp never throws an error, no matter the input
|
|
30816
|
-
};
|
|
30817
|
-
|
|
30818
|
-
|
|
30819
|
-
var IS_ROUTING_NUMBER = "validator/IS_ROUTING_NUMBER";
|
|
30820
|
-
var IS_ROUTING_NUMBER_ERROR = "error/IS_ROUTING_NUMBER";
|
|
30821
|
-
var isRoutingNumber = createValidator(IS_ROUTING_NUMBER, IS_ROUTING_NUMBER_ERROR);
|
|
30749
|
+
};
|
|
30822
30750
|
|
|
30823
|
-
|
|
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) => {
|
|
30824
30759
|
if (value === "") {
|
|
30825
30760
|
return true;
|
|
30826
30761
|
}
|
|
30827
|
-
|
|
30828
30762
|
if (value.length != 9) {
|
|
30829
30763
|
return false;
|
|
30830
30764
|
}
|
|
30831
|
-
|
|
30832
|
-
|
|
30833
|
-
|
|
30834
|
-
|
|
30835
|
-
|
|
30836
|
-
|
|
30837
|
-
|
|
30838
|
-
|
|
30839
|
-
|
|
30840
|
-
|
|
30841
|
-
|
|
30842
|
-
|
|
30843
|
-
|
|
30844
|
-
}
|
|
30845
|
-
}, 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);
|
|
30846
30778
|
return sum != 0 && sum % 10 == 0;
|
|
30847
30779
|
};
|
|
30848
30780
|
|
|
30849
|
-
|
|
30850
|
-
|
|
30851
|
-
|
|
30852
|
-
|
|
30853
|
-
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) => {
|
|
30854
30785
|
if (value === "") {
|
|
30855
30786
|
return true;
|
|
30856
30787
|
}
|
|
30857
|
-
|
|
30858
30788
|
return new RegExp(/[0-9]/).test(value);
|
|
30859
30789
|
};
|
|
30860
30790
|
|
|
30861
|
-
|
|
30862
|
-
|
|
30863
|
-
|
|
30864
|
-
|
|
30865
|
-
|
|
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) => {
|
|
30866
30798
|
if (value === "") {
|
|
30867
30799
|
return true;
|
|
30868
30800
|
}
|
|
30869
|
-
|
|
30870
30801
|
return new RegExp(/[a-z]/).test(value);
|
|
30871
30802
|
};
|
|
30872
30803
|
|
|
30873
|
-
|
|
30874
|
-
|
|
30875
|
-
|
|
30876
|
-
|
|
30877
|
-
|
|
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) => {
|
|
30878
30811
|
if (value === "") {
|
|
30879
30812
|
return true;
|
|
30880
30813
|
}
|
|
30881
|
-
|
|
30882
30814
|
return new RegExp(/[A-Z]/).test(value);
|
|
30883
30815
|
};
|
|
30884
30816
|
|
|
30885
|
-
|
|
30886
|
-
|
|
30887
|
-
|
|
30888
|
-
|
|
30889
|
-
|
|
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) => {
|
|
30890
30824
|
if (value === "") {
|
|
30891
30825
|
return true;
|
|
30892
30826
|
}
|
|
30893
|
-
|
|
30894
30827
|
return new RegExp(/[!@#$%^&*.?]/).test(value);
|
|
30895
30828
|
};
|
|
30896
30829
|
|
|
30897
|
-
|
|
30898
|
-
|
|
30899
|
-
|
|
30900
|
-
|
|
30901
|
-
|
|
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) => {
|
|
30902
30837
|
if (value === "") {
|
|
30903
30838
|
return true;
|
|
30904
30839
|
}
|
|
30905
|
-
|
|
30906
30840
|
return new RegExp(/^\S+@\S+\.\S+$/).test(value);
|
|
30907
30841
|
};
|
|
30908
30842
|
|
|
30909
|
-
|
|
30910
|
-
|
|
30911
|
-
|
|
30912
|
-
|
|
30913
|
-
|
|
30914
|
-
|
|
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)`;
|
|
30915
30849
|
|
|
30850
|
+
const runValidator = (validator, value, form) => {
|
|
30851
|
+
const validatorFn = validatorFns[validator.type];
|
|
30916
30852
|
if (validatorFn === undefined) {
|
|
30917
30853
|
throw new Error(runValidatorErrorMessage(validator.type));
|
|
30918
30854
|
}
|
|
30919
|
-
|
|
30920
30855
|
return validatorFn(value, validator.args, form) ? null : validator.error;
|
|
30921
30856
|
};
|
|
30922
30857
|
|
|
30923
|
-
|
|
30924
|
-
return validators
|
|
30925
|
-
|
|
30926
|
-
|
|
30927
|
-
return x !== null;
|
|
30928
|
-
});
|
|
30858
|
+
const _computeErrors = (fieldName, form, validators) => {
|
|
30859
|
+
return validators
|
|
30860
|
+
.map(v => runValidator(v, form[fieldName].rawValue, form))
|
|
30861
|
+
.filter(x => x !== null);
|
|
30929
30862
|
};
|
|
30930
30863
|
|
|
30931
|
-
|
|
30932
|
-
|
|
30864
|
+
const computeConstraints = (fieldName, form) => {
|
|
30865
|
+
const constraints = form[fieldName].constraints;
|
|
30933
30866
|
return _computeErrors(fieldName, form, constraints);
|
|
30934
30867
|
};
|
|
30935
30868
|
|
|
30936
|
-
|
|
30937
|
-
|
|
30869
|
+
const computeErrors = (fieldName, form) => {
|
|
30870
|
+
const validators = form[fieldName].validators;
|
|
30938
30871
|
return _computeErrors(fieldName, form, validators);
|
|
30939
30872
|
};
|
|
30940
30873
|
|
|
30941
30874
|
var obj;
|
|
30942
|
-
var NOTHING = typeof Symbol !== "undefined" ? Symbol("immer-nothing") : (obj = {}, obj["immer-nothing"] = true, obj);
|
|
30943
|
-
var DRAFTABLE = typeof Symbol !== "undefined" && Symbol
|
|
30944
|
-
var DRAFT_STATE = typeof Symbol !== "undefined" && Symbol
|
|
30945
|
-
|
|
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";
|
|
30946
30878
|
function isDraft(value) {
|
|
30947
30879
|
return !!value && !!value[DRAFT_STATE];
|
|
30948
30880
|
}
|
|
30949
|
-
|
|
30950
30881
|
function isDraftable(value) {
|
|
30951
|
-
if (!value) {
|
|
30952
|
-
return false;
|
|
30953
|
-
}
|
|
30954
|
-
|
|
30882
|
+
if (!value) { return false; }
|
|
30955
30883
|
return isPlainObject(value) || !!value[DRAFTABLE] || !!value.constructor[DRAFTABLE];
|
|
30956
30884
|
}
|
|
30957
|
-
|
|
30958
30885
|
function isPlainObject(value) {
|
|
30959
|
-
if (!value ||
|
|
30960
|
-
|
|
30961
|
-
}
|
|
30962
|
-
|
|
30963
|
-
if (Array.isArray(value)) {
|
|
30964
|
-
return true;
|
|
30965
|
-
}
|
|
30966
|
-
|
|
30886
|
+
if (!value || typeof value !== "object") { return false; }
|
|
30887
|
+
if (Array.isArray(value)) { return true; }
|
|
30967
30888
|
var proto = Object.getPrototypeOf(value);
|
|
30968
30889
|
return !proto || proto === Object.prototype;
|
|
30969
30890
|
}
|
|
30970
|
-
|
|
30971
30891
|
var assign = Object.assign || function assign(target, value) {
|
|
30972
30892
|
for (var key in value) {
|
|
30973
30893
|
if (has(value, key)) {
|
|
@@ -30977,18 +30897,11 @@ var assign = Object.assign || function assign(target, value) {
|
|
|
30977
30897
|
|
|
30978
30898
|
return target;
|
|
30979
30899
|
};
|
|
30980
|
-
|
|
30981
|
-
var ownKeys$1 = typeof Reflect !== "undefined" && Reflect.ownKeys ? Reflect.ownKeys : typeof Object.getOwnPropertySymbols !== "undefined" ? function (obj) {
|
|
30982
|
-
return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj));
|
|
30983
|
-
} : Object.getOwnPropertyNames;
|
|
30984
|
-
|
|
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;
|
|
30985
30901
|
function shallowCopy(base, invokeGetters) {
|
|
30986
|
-
if (invokeGetters === void 0) invokeGetters = false;
|
|
30987
|
-
|
|
30988
|
-
if (Array.isArray(base)) {
|
|
30989
|
-
return base.slice();
|
|
30990
|
-
}
|
|
30902
|
+
if ( invokeGetters === void 0 ) invokeGetters = false;
|
|
30991
30903
|
|
|
30904
|
+
if (Array.isArray(base)) { return base.slice(); }
|
|
30992
30905
|
var clone = Object.create(Object.getPrototypeOf(base));
|
|
30993
30906
|
ownKeys$1(base).forEach(function (key) {
|
|
30994
30907
|
if (key === DRAFT_STATE) {
|
|
@@ -31018,28 +30931,20 @@ function shallowCopy(base, invokeGetters) {
|
|
|
31018
30931
|
});
|
|
31019
30932
|
return clone;
|
|
31020
30933
|
}
|
|
31021
|
-
|
|
31022
30934
|
function each(value, cb) {
|
|
31023
30935
|
if (Array.isArray(value)) {
|
|
31024
|
-
for (var i = 0; i < value.length; i++) {
|
|
31025
|
-
cb(i, value[i], value);
|
|
31026
|
-
}
|
|
30936
|
+
for (var i = 0; i < value.length; i++) { cb(i, value[i], value); }
|
|
31027
30937
|
} else {
|
|
31028
|
-
ownKeys$1(value).forEach(function (key) {
|
|
31029
|
-
return cb(key, value[key], value);
|
|
31030
|
-
});
|
|
30938
|
+
ownKeys$1(value).forEach(function (key) { return cb(key, value[key], value); });
|
|
31031
30939
|
}
|
|
31032
30940
|
}
|
|
31033
|
-
|
|
31034
30941
|
function isEnumerable(base, prop) {
|
|
31035
30942
|
var desc = Object.getOwnPropertyDescriptor(base, prop);
|
|
31036
30943
|
return !!desc && desc.enumerable;
|
|
31037
30944
|
}
|
|
31038
|
-
|
|
31039
30945
|
function has(thing, prop) {
|
|
31040
30946
|
return Object.prototype.hasOwnProperty.call(thing, prop);
|
|
31041
30947
|
}
|
|
31042
|
-
|
|
31043
30948
|
function is(x, y) {
|
|
31044
30949
|
// From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js
|
|
31045
30950
|
if (x === y) {
|
|
@@ -31048,26 +30953,17 @@ function is(x, y) {
|
|
|
31048
30953
|
return x !== x && y !== y;
|
|
31049
30954
|
}
|
|
31050
30955
|
}
|
|
31051
|
-
|
|
31052
30956
|
function clone(obj) {
|
|
31053
|
-
if (!isDraftable(obj)) {
|
|
31054
|
-
|
|
31055
|
-
}
|
|
31056
|
-
|
|
31057
|
-
if (Array.isArray(obj)) {
|
|
31058
|
-
return obj.map(clone);
|
|
31059
|
-
}
|
|
31060
|
-
|
|
30957
|
+
if (!isDraftable(obj)) { return obj; }
|
|
30958
|
+
if (Array.isArray(obj)) { return obj.map(clone); }
|
|
31061
30959
|
var cloned = Object.create(Object.getPrototypeOf(obj));
|
|
31062
30960
|
|
|
31063
|
-
for (var key in obj) {
|
|
31064
|
-
cloned[key] = clone(obj[key]);
|
|
31065
|
-
}
|
|
30961
|
+
for (var key in obj) { cloned[key] = clone(obj[key]); }
|
|
31066
30962
|
|
|
31067
30963
|
return cloned;
|
|
31068
30964
|
}
|
|
31069
|
-
/** Each scope represents a `produce` call. */
|
|
31070
30965
|
|
|
30966
|
+
/** Each scope represents a `produce` call. */
|
|
31071
30967
|
|
|
31072
30968
|
var ImmerScope = function ImmerScope(parent) {
|
|
31073
30969
|
this.drafts = [];
|
|
@@ -31079,7 +30975,7 @@ var ImmerScope = function ImmerScope(parent) {
|
|
|
31079
30975
|
this.patches = null;
|
|
31080
30976
|
};
|
|
31081
30977
|
|
|
31082
|
-
ImmerScope.prototype.usePatches = function usePatches(patchListener) {
|
|
30978
|
+
ImmerScope.prototype.usePatches = function usePatches (patchListener) {
|
|
31083
30979
|
if (patchListener) {
|
|
31084
30980
|
this.patches = [];
|
|
31085
30981
|
this.inversePatches = [];
|
|
@@ -31087,18 +30983,17 @@ ImmerScope.prototype.usePatches = function usePatches(patchListener) {
|
|
|
31087
30983
|
}
|
|
31088
30984
|
};
|
|
31089
30985
|
|
|
31090
|
-
ImmerScope.prototype.revoke = function revoke$1() {
|
|
30986
|
+
ImmerScope.prototype.revoke = function revoke$1 () {
|
|
31091
30987
|
this.leave();
|
|
31092
30988
|
this.drafts.forEach(revoke);
|
|
31093
30989
|
this.drafts = null; // Make draft-related methods throw.
|
|
31094
30990
|
};
|
|
31095
30991
|
|
|
31096
|
-
ImmerScope.prototype.leave = function leave() {
|
|
30992
|
+
ImmerScope.prototype.leave = function leave () {
|
|
31097
30993
|
if (this === ImmerScope.current) {
|
|
31098
30994
|
ImmerScope.current = this.parent;
|
|
31099
30995
|
}
|
|
31100
30996
|
};
|
|
31101
|
-
|
|
31102
30997
|
ImmerScope.current = null;
|
|
31103
30998
|
|
|
31104
30999
|
ImmerScope.enter = function () {
|
|
@@ -31107,11 +31002,11 @@ ImmerScope.enter = function () {
|
|
|
31107
31002
|
|
|
31108
31003
|
function revoke(draft) {
|
|
31109
31004
|
draft[DRAFT_STATE].revoke();
|
|
31110
|
-
}
|
|
31005
|
+
}
|
|
31111
31006
|
|
|
31007
|
+
// but share them all instead
|
|
31112
31008
|
|
|
31113
31009
|
var descriptors = {};
|
|
31114
|
-
|
|
31115
31010
|
function willFinalize(scope, result, isReplaced) {
|
|
31116
31011
|
scope.drafts.forEach(function (draft) {
|
|
31117
31012
|
draft[DRAFT_STATE].finalizing = true;
|
|
@@ -31129,7 +31024,6 @@ function willFinalize(scope, result, isReplaced) {
|
|
|
31129
31024
|
markChangesSweep(scope.drafts);
|
|
31130
31025
|
}
|
|
31131
31026
|
}
|
|
31132
|
-
|
|
31133
31027
|
function createProxy(base, parent) {
|
|
31134
31028
|
var isArray = Array.isArray(base);
|
|
31135
31029
|
var draft = clonePotentialDraft(base);
|
|
@@ -31183,11 +31077,7 @@ function peek(draft, prop) {
|
|
|
31183
31077
|
function get(state, prop) {
|
|
31184
31078
|
assertUnrevoked(state);
|
|
31185
31079
|
var value = peek(source(state), prop);
|
|
31186
|
-
|
|
31187
|
-
if (state.finalizing) {
|
|
31188
|
-
return value;
|
|
31189
|
-
} // Create a draft if the value is unmodified.
|
|
31190
|
-
|
|
31080
|
+
if (state.finalizing) { return value; } // Create a draft if the value is unmodified.
|
|
31191
31081
|
|
|
31192
31082
|
if (value === peek(state.base, prop) && isDraftable(value)) {
|
|
31193
31083
|
prepareCopy(state);
|
|
@@ -31202,10 +31092,7 @@ function set(state, prop, value) {
|
|
|
31202
31092
|
state.assigned[prop] = true;
|
|
31203
31093
|
|
|
31204
31094
|
if (!state.modified) {
|
|
31205
|
-
if (is(value, peek(source(state), prop))) {
|
|
31206
|
-
return;
|
|
31207
|
-
}
|
|
31208
|
-
|
|
31095
|
+
if (is(value, peek(source(state), prop))) { return; }
|
|
31209
31096
|
markChanged(state);
|
|
31210
31097
|
prepareCopy(state);
|
|
31211
31098
|
}
|
|
@@ -31216,17 +31103,12 @@ function set(state, prop, value) {
|
|
|
31216
31103
|
function markChanged(state) {
|
|
31217
31104
|
if (!state.modified) {
|
|
31218
31105
|
state.modified = true;
|
|
31219
|
-
|
|
31220
|
-
if (state.parent) {
|
|
31221
|
-
markChanged(state.parent);
|
|
31222
|
-
}
|
|
31106
|
+
if (state.parent) { markChanged(state.parent); }
|
|
31223
31107
|
}
|
|
31224
31108
|
}
|
|
31225
31109
|
|
|
31226
31110
|
function prepareCopy(state) {
|
|
31227
|
-
if (!state.copy) {
|
|
31228
|
-
state.copy = clonePotentialDraft(state.base);
|
|
31229
|
-
}
|
|
31111
|
+
if (!state.copy) { state.copy = clonePotentialDraft(state.base); }
|
|
31230
31112
|
}
|
|
31231
31113
|
|
|
31232
31114
|
function clonePotentialDraft(base) {
|
|
@@ -31251,12 +31133,15 @@ function proxyProperty(draft, prop, enumerable) {
|
|
|
31251
31133
|
descriptors[prop] = desc = {
|
|
31252
31134
|
configurable: true,
|
|
31253
31135
|
enumerable: enumerable,
|
|
31136
|
+
|
|
31254
31137
|
get: function get$1() {
|
|
31255
31138
|
return get(this[DRAFT_STATE], prop);
|
|
31256
31139
|
},
|
|
31140
|
+
|
|
31257
31141
|
set: function set$1(value) {
|
|
31258
31142
|
set(this[DRAFT_STATE], prop, value);
|
|
31259
31143
|
}
|
|
31144
|
+
|
|
31260
31145
|
};
|
|
31261
31146
|
}
|
|
31262
31147
|
|
|
@@ -31264,9 +31149,7 @@ function proxyProperty(draft, prop, enumerable) {
|
|
|
31264
31149
|
}
|
|
31265
31150
|
|
|
31266
31151
|
function assertUnrevoked(state) {
|
|
31267
|
-
if (state.revoked === true) {
|
|
31268
|
-
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)));
|
|
31269
|
-
}
|
|
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))); }
|
|
31270
31153
|
} // This looks expensive, but only proxies are visited, and only objects without known changes are scanned.
|
|
31271
31154
|
|
|
31272
31155
|
|
|
@@ -31280,27 +31163,16 @@ function markChangesSweep(drafts) {
|
|
|
31280
31163
|
|
|
31281
31164
|
if (!state.modified) {
|
|
31282
31165
|
if (Array.isArray(state.base)) {
|
|
31283
|
-
if (hasArrayChanges(state)) {
|
|
31284
|
-
|
|
31285
|
-
}
|
|
31286
|
-
} else if (hasObjectChanges(state)) {
|
|
31287
|
-
markChanged(state);
|
|
31288
|
-
}
|
|
31166
|
+
if (hasArrayChanges(state)) { markChanged(state); }
|
|
31167
|
+
} else if (hasObjectChanges(state)) { markChanged(state); }
|
|
31289
31168
|
}
|
|
31290
31169
|
}
|
|
31291
31170
|
}
|
|
31292
31171
|
|
|
31293
31172
|
function markChangesRecursively(object) {
|
|
31294
|
-
if (!object ||
|
|
31295
|
-
return;
|
|
31296
|
-
}
|
|
31297
|
-
|
|
31173
|
+
if (!object || typeof object !== "object") { return; }
|
|
31298
31174
|
var state = object[DRAFT_STATE];
|
|
31299
|
-
|
|
31300
|
-
if (!state) {
|
|
31301
|
-
return;
|
|
31302
|
-
}
|
|
31303
|
-
|
|
31175
|
+
if (!state) { return; }
|
|
31304
31176
|
var base = state.base;
|
|
31305
31177
|
var draft = state.draft;
|
|
31306
31178
|
var assigned = state.assigned;
|
|
@@ -31330,20 +31202,14 @@ function markChangesRecursively(object) {
|
|
|
31330
31202
|
assigned.length = true;
|
|
31331
31203
|
|
|
31332
31204
|
if (draft.length < base.length) {
|
|
31333
|
-
for (var i = draft.length; i < base.length; i++) {
|
|
31334
|
-
assigned[i] = false;
|
|
31335
|
-
}
|
|
31205
|
+
for (var i = draft.length; i < base.length; i++) { assigned[i] = false; }
|
|
31336
31206
|
} else {
|
|
31337
|
-
for (var i$1 = base.length; i$1 < draft.length; i$1++) {
|
|
31338
|
-
assigned[i$1] = true;
|
|
31339
|
-
}
|
|
31207
|
+
for (var i$1 = base.length; i$1 < draft.length; i$1++) { assigned[i$1] = true; }
|
|
31340
31208
|
}
|
|
31341
31209
|
|
|
31342
31210
|
for (var i$2 = 0; i$2 < draft.length; i$2++) {
|
|
31343
31211
|
// Only untouched indices trigger recursion.
|
|
31344
|
-
if (assigned[i$2] === undefined) {
|
|
31345
|
-
markChangesRecursively(draft[i$2]);
|
|
31346
|
-
}
|
|
31212
|
+
if (assigned[i$2] === undefined) { markChangesRecursively(draft[i$2]); }
|
|
31347
31213
|
}
|
|
31348
31214
|
}
|
|
31349
31215
|
}
|
|
@@ -31380,10 +31246,7 @@ function hasObjectChanges(state) {
|
|
|
31380
31246
|
|
|
31381
31247
|
function hasArrayChanges(state) {
|
|
31382
31248
|
var draft = state.draft;
|
|
31383
|
-
|
|
31384
|
-
if (draft.length !== state.base.length) {
|
|
31385
|
-
return true;
|
|
31386
|
-
} // See #116
|
|
31249
|
+
if (draft.length !== state.base.length) { return true; } // See #116
|
|
31387
31250
|
// If we first shorten the length, our array interceptors will be removed.
|
|
31388
31251
|
// If after that new items are added, result in the same original length,
|
|
31389
31252
|
// those last items will have no intercepting property.
|
|
@@ -31391,13 +31254,9 @@ function hasArrayChanges(state) {
|
|
|
31391
31254
|
// N.B.: splice, unshift, etc only shift values around, but not prop descriptors, so we only have to check
|
|
31392
31255
|
// the last one
|
|
31393
31256
|
|
|
31394
|
-
|
|
31395
31257
|
var descriptor = Object.getOwnPropertyDescriptor(draft, draft.length - 1); // descriptor can be null, but only for newly created sparse arrays, eg. new Array(10)
|
|
31396
31258
|
|
|
31397
|
-
if (descriptor && !descriptor.get) {
|
|
31398
|
-
return true;
|
|
31399
|
-
} // For all other cases, we don't have to compare, as they would have been picked up by the index setters
|
|
31400
|
-
|
|
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
|
|
31401
31260
|
|
|
31402
31261
|
return false;
|
|
31403
31262
|
}
|
|
@@ -31411,12 +31270,11 @@ function createHiddenProperty(target, prop, value) {
|
|
|
31411
31270
|
}
|
|
31412
31271
|
|
|
31413
31272
|
var legacyProxy = /*#__PURE__*/Object.freeze({
|
|
31414
|
-
|
|
31415
|
-
|
|
31273
|
+
willFinalize: willFinalize,
|
|
31274
|
+
createProxy: createProxy
|
|
31416
31275
|
});
|
|
31417
31276
|
|
|
31418
31277
|
function willFinalize$1() {}
|
|
31419
|
-
|
|
31420
31278
|
function createProxy$1(base, parent) {
|
|
31421
31279
|
var scope = parent ? parent.scope : ImmerScope.current;
|
|
31422
31280
|
var state = {
|
|
@@ -31451,27 +31309,33 @@ function createProxy$1(base, parent) {
|
|
|
31451
31309
|
scope.drafts.push(proxy);
|
|
31452
31310
|
return proxy;
|
|
31453
31311
|
}
|
|
31454
|
-
|
|
31455
31312
|
var objectTraps = {
|
|
31456
31313
|
get: get$1,
|
|
31314
|
+
|
|
31457
31315
|
has: function has(target, prop) {
|
|
31458
31316
|
return prop in source$1(target);
|
|
31459
31317
|
},
|
|
31318
|
+
|
|
31460
31319
|
ownKeys: function ownKeys(target) {
|
|
31461
31320
|
return Reflect.ownKeys(source$1(target));
|
|
31462
31321
|
},
|
|
31322
|
+
|
|
31463
31323
|
set: set$1,
|
|
31464
31324
|
deleteProperty: deleteProperty,
|
|
31465
31325
|
getOwnPropertyDescriptor: getOwnPropertyDescriptor,
|
|
31326
|
+
|
|
31466
31327
|
defineProperty: function defineProperty() {
|
|
31467
31328
|
throw new Error("Object.defineProperty() cannot be used on an Immer draft"); // prettier-ignore
|
|
31468
31329
|
},
|
|
31330
|
+
|
|
31469
31331
|
getPrototypeOf: function getPrototypeOf(target) {
|
|
31470
31332
|
return Object.getPrototypeOf(target.base);
|
|
31471
31333
|
},
|
|
31334
|
+
|
|
31472
31335
|
setPrototypeOf: function setPrototypeOf() {
|
|
31473
31336
|
throw new Error("Object.setPrototypeOf() cannot be used on an Immer draft"); // prettier-ignore
|
|
31474
31337
|
}
|
|
31338
|
+
|
|
31475
31339
|
};
|
|
31476
31340
|
var arrayTraps = {};
|
|
31477
31341
|
each(objectTraps, function (key, fn) {
|
|
@@ -31510,10 +31374,7 @@ function peek$1(draft, prop) {
|
|
|
31510
31374
|
}
|
|
31511
31375
|
|
|
31512
31376
|
function get$1(state, prop) {
|
|
31513
|
-
if (prop === DRAFT_STATE) {
|
|
31514
|
-
return state;
|
|
31515
|
-
}
|
|
31516
|
-
|
|
31377
|
+
if (prop === DRAFT_STATE) { return state; }
|
|
31517
31378
|
var drafts = state.drafts; // Check for existing draft in unmodified state.
|
|
31518
31379
|
|
|
31519
31380
|
if (!state.modified && has(drafts, prop)) {
|
|
@@ -31529,10 +31390,7 @@ function get$1(state, prop) {
|
|
|
31529
31390
|
|
|
31530
31391
|
if (state.modified) {
|
|
31531
31392
|
// Assigned values are never drafted. This catches any drafts we created, too.
|
|
31532
|
-
if (value !== peek$1(state.base, prop)) {
|
|
31533
|
-
return value;
|
|
31534
|
-
} // Store drafts on the copy (when one exists).
|
|
31535
|
-
|
|
31393
|
+
if (value !== peek$1(state.base, prop)) { return value; } // Store drafts on the copy (when one exists).
|
|
31536
31394
|
|
|
31537
31395
|
drafts = state.copy;
|
|
31538
31396
|
}
|
|
@@ -31547,11 +31405,7 @@ function set$1(state, prop, value) {
|
|
|
31547
31405
|
// values may be drafts, but falsy values are never drafts.
|
|
31548
31406
|
|
|
31549
31407
|
var isUnchanged = value ? is(baseValue, value) || value === state.drafts[prop] : is(baseValue, value) && prop in state.base;
|
|
31550
|
-
|
|
31551
|
-
if (isUnchanged) {
|
|
31552
|
-
return true;
|
|
31553
|
-
}
|
|
31554
|
-
|
|
31408
|
+
if (isUnchanged) { return true; }
|
|
31555
31409
|
markChanged$1(state);
|
|
31556
31410
|
}
|
|
31557
31411
|
|
|
@@ -31570,10 +31424,7 @@ function deleteProperty(state, prop) {
|
|
|
31570
31424
|
delete state.assigned[prop];
|
|
31571
31425
|
}
|
|
31572
31426
|
|
|
31573
|
-
if (state.copy) {
|
|
31574
|
-
delete state.copy[prop];
|
|
31575
|
-
}
|
|
31576
|
-
|
|
31427
|
+
if (state.copy) { delete state.copy[prop]; }
|
|
31577
31428
|
return true;
|
|
31578
31429
|
} // Note: We never coerce `desc.value` into an Immer draft, because we can't make
|
|
31579
31430
|
// the same guarantee in ES5 mode.
|
|
@@ -31596,16 +31447,13 @@ function markChanged$1(state) {
|
|
|
31596
31447
|
state.modified = true;
|
|
31597
31448
|
state.copy = assign(shallowCopy(state.base), state.drafts);
|
|
31598
31449
|
state.drafts = null;
|
|
31599
|
-
|
|
31600
|
-
if (state.parent) {
|
|
31601
|
-
markChanged$1(state.parent);
|
|
31602
|
-
}
|
|
31450
|
+
if (state.parent) { markChanged$1(state.parent); }
|
|
31603
31451
|
}
|
|
31604
31452
|
}
|
|
31605
31453
|
|
|
31606
31454
|
var modernProxy = /*#__PURE__*/Object.freeze({
|
|
31607
|
-
|
|
31608
|
-
|
|
31455
|
+
willFinalize: willFinalize$1,
|
|
31456
|
+
createProxy: createProxy$1
|
|
31609
31457
|
});
|
|
31610
31458
|
|
|
31611
31459
|
function generatePatches(state, basePath, patches, inversePatches) {
|
|
@@ -31614,13 +31462,14 @@ function generatePatches(state, basePath, patches, inversePatches) {
|
|
|
31614
31462
|
|
|
31615
31463
|
function generateArrayPatches(state, basePath, patches, inversePatches) {
|
|
31616
31464
|
var assign, assign$1;
|
|
31465
|
+
|
|
31617
31466
|
var base = state.base;
|
|
31618
31467
|
var copy = state.copy;
|
|
31619
31468
|
var assigned = state.assigned; // Reduce complexity by ensuring `base` is never longer.
|
|
31620
31469
|
|
|
31621
31470
|
if (copy.length < base.length) {
|
|
31622
|
-
assign = [copy, base], base = assign[0], copy = assign[1];
|
|
31623
|
-
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]);
|
|
31624
31473
|
}
|
|
31625
31474
|
|
|
31626
31475
|
var delta = copy.length - base.length; // Find the first replaced index.
|
|
@@ -31678,11 +31527,7 @@ function generateObjectPatches(state, basePath, patches, inversePatches) {
|
|
|
31678
31527
|
var origValue = base[key];
|
|
31679
31528
|
var value = copy[key];
|
|
31680
31529
|
var op = !assignedValue ? "remove" : key in base ? "replace" : "add";
|
|
31681
|
-
|
|
31682
|
-
if (origValue === value && op === "replace") {
|
|
31683
|
-
return;
|
|
31684
|
-
}
|
|
31685
|
-
|
|
31530
|
+
if (origValue === value && op === "replace") { return; }
|
|
31686
31531
|
var path = basePath.concat(key);
|
|
31687
31532
|
patches.push(op === "remove" ? {
|
|
31688
31533
|
op: op,
|
|
@@ -31707,26 +31552,20 @@ function generateObjectPatches(state, basePath, patches, inversePatches) {
|
|
|
31707
31552
|
});
|
|
31708
31553
|
}
|
|
31709
31554
|
|
|
31710
|
-
var applyPatches = function
|
|
31555
|
+
var applyPatches = function (draft, patches) {
|
|
31711
31556
|
for (var i$1 = 0, list = patches; i$1 < list.length; i$1 += 1) {
|
|
31712
31557
|
var patch = list[i$1];
|
|
31558
|
+
|
|
31713
31559
|
var path = patch.path;
|
|
31714
31560
|
var op = patch.op;
|
|
31715
31561
|
var value = clone(patch.value); // used to clone patch to ensure original patch is not modified, see #411
|
|
31716
31562
|
|
|
31717
|
-
if (!path.length) {
|
|
31718
|
-
throw new Error("Illegal state");
|
|
31719
|
-
}
|
|
31720
|
-
|
|
31563
|
+
if (!path.length) { throw new Error("Illegal state"); }
|
|
31721
31564
|
var base = draft;
|
|
31722
31565
|
|
|
31723
31566
|
for (var i = 0; i < path.length - 1; i++) {
|
|
31724
31567
|
base = base[path[i]];
|
|
31725
|
-
|
|
31726
|
-
if (!base || _typeof(base) !== "object") {
|
|
31727
|
-
throw new Error("Cannot apply patch, path doesn't resolve: " + path.join("/"));
|
|
31728
|
-
} // prettier-ignore
|
|
31729
|
-
|
|
31568
|
+
if (!base || typeof base !== "object") { throw new Error("Cannot apply patch, path doesn't resolve: " + path.join("/")); } // prettier-ignore
|
|
31730
31569
|
}
|
|
31731
31570
|
|
|
31732
31571
|
var key = path[path.length - 1];
|
|
@@ -31775,33 +31614,27 @@ var configDefaults = {
|
|
|
31775
31614
|
onDelete: null,
|
|
31776
31615
|
onCopy: null
|
|
31777
31616
|
};
|
|
31778
|
-
|
|
31779
31617
|
var Immer = function Immer(config) {
|
|
31780
31618
|
assign(this, configDefaults, config);
|
|
31781
31619
|
this.setUseProxies(this.useProxies);
|
|
31782
31620
|
this.produce = this.produce.bind(this);
|
|
31783
31621
|
};
|
|
31784
31622
|
|
|
31785
|
-
Immer.prototype.produce = function produce(base, recipe, patchListener) {
|
|
31786
|
-
|
|
31623
|
+
Immer.prototype.produce = function produce (base, recipe, patchListener) {
|
|
31624
|
+
var this$1 = this;
|
|
31787
31625
|
|
|
31626
|
+
// curried invocation
|
|
31788
31627
|
if (typeof base === "function" && typeof recipe !== "function") {
|
|
31789
31628
|
var defaultBase = recipe;
|
|
31790
31629
|
recipe = base;
|
|
31791
31630
|
var self = this;
|
|
31792
31631
|
return function curriedProduce(base) {
|
|
31793
|
-
|
|
31794
|
-
|
|
31795
|
-
|
|
31796
|
-
|
|
31797
|
-
|
|
31798
|
-
while (len-- > 0) {
|
|
31799
|
-
args[len] = arguments[len + 1];
|
|
31800
|
-
}
|
|
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 ];
|
|
31801
31636
|
|
|
31802
|
-
return self.produce(base, function (draft) {
|
|
31803
|
-
return recipe.call.apply(recipe, [this$1, draft].concat(args));
|
|
31804
|
-
}); // prettier-ignore
|
|
31637
|
+
return self.produce(base, function (draft) { return recipe.call.apply(recipe, [ this$1, draft ].concat( args )); }); // prettier-ignore
|
|
31805
31638
|
};
|
|
31806
31639
|
} // prettier-ignore
|
|
31807
31640
|
|
|
@@ -31827,11 +31660,7 @@ Immer.prototype.produce = function produce(base, recipe, patchListener) {
|
|
|
31827
31660
|
hasError = false;
|
|
31828
31661
|
} finally {
|
|
31829
31662
|
// finally instead of catch + rethrow better preserves original stack
|
|
31830
|
-
if (hasError) {
|
|
31831
|
-
scope.revoke();
|
|
31832
|
-
} else {
|
|
31833
|
-
scope.leave();
|
|
31834
|
-
}
|
|
31663
|
+
if (hasError) { scope.revoke(); }else { scope.leave(); }
|
|
31835
31664
|
}
|
|
31836
31665
|
|
|
31837
31666
|
if (result instanceof Promise) {
|
|
@@ -31848,38 +31677,25 @@ Immer.prototype.produce = function produce(base, recipe, patchListener) {
|
|
|
31848
31677
|
return this.processResult(result, scope);
|
|
31849
31678
|
} else {
|
|
31850
31679
|
result = recipe(base);
|
|
31851
|
-
|
|
31852
|
-
if (result === undefined) {
|
|
31853
|
-
return base;
|
|
31854
|
-
}
|
|
31855
|
-
|
|
31680
|
+
if (result === undefined) { return base; }
|
|
31856
31681
|
return result !== NOTHING ? result : undefined;
|
|
31857
31682
|
}
|
|
31858
31683
|
};
|
|
31859
31684
|
|
|
31860
|
-
Immer.prototype.produceWithPatches = function produceWithPatches(arg1, arg2, arg3) {
|
|
31861
|
-
|
|
31685
|
+
Immer.prototype.produceWithPatches = function produceWithPatches (arg1, arg2, arg3) {
|
|
31686
|
+
var this$1 = this;
|
|
31862
31687
|
|
|
31863
31688
|
if (typeof arg1 === "function") {
|
|
31864
31689
|
return function (state) {
|
|
31865
|
-
|
|
31866
|
-
|
|
31690
|
+
var args = [], len = arguments.length - 1;
|
|
31691
|
+
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
|
|
31867
31692
|
|
|
31868
|
-
|
|
31869
|
-
|
|
31870
|
-
}
|
|
31871
|
-
|
|
31872
|
-
return this$1.produceWithPatches(state, function (draft) {
|
|
31873
|
-
return arg1.apply(void 0, [draft].concat(args));
|
|
31874
|
-
});
|
|
31875
|
-
};
|
|
31693
|
+
return this$1.produceWithPatches(state, function (draft) { return arg1.apply(void 0, [ draft ].concat( args )); });
|
|
31694
|
+
};
|
|
31876
31695
|
} // non-curried form
|
|
31877
31696
|
|
|
31878
31697
|
|
|
31879
|
-
if (arg3) {
|
|
31880
|
-
throw new Error("A patch listener cannot be passed to produceWithPatches");
|
|
31881
|
-
}
|
|
31882
|
-
|
|
31698
|
+
if (arg3) { throw new Error("A patch listener cannot be passed to produceWithPatches"); }
|
|
31883
31699
|
var patches, inversePatches;
|
|
31884
31700
|
var nextState = this.produce(arg1, arg2, function (p, ip) {
|
|
31885
31701
|
patches = p;
|
|
@@ -31888,7 +31704,7 @@ Immer.prototype.produceWithPatches = function produceWithPatches(arg1, arg2, arg
|
|
|
31888
31704
|
return [nextState, patches, inversePatches];
|
|
31889
31705
|
};
|
|
31890
31706
|
|
|
31891
|
-
Immer.prototype.createDraft = function createDraft(base) {
|
|
31707
|
+
Immer.prototype.createDraft = function createDraft (base) {
|
|
31892
31708
|
if (!isDraftable(base)) {
|
|
31893
31709
|
throw new Error("First argument to `createDraft` must be a plain object, an array, or an immerable object"); // prettier-ignore
|
|
31894
31710
|
}
|
|
@@ -31900,7 +31716,7 @@ Immer.prototype.createDraft = function createDraft(base) {
|
|
|
31900
31716
|
return proxy;
|
|
31901
31717
|
};
|
|
31902
31718
|
|
|
31903
|
-
Immer.prototype.finishDraft = function finishDraft(draft, patchListener) {
|
|
31719
|
+
Immer.prototype.finishDraft = function finishDraft (draft, patchListener) {
|
|
31904
31720
|
var state = draft && draft[DRAFT_STATE];
|
|
31905
31721
|
|
|
31906
31722
|
if (!state || !state.isManual) {
|
|
@@ -31916,16 +31732,16 @@ Immer.prototype.finishDraft = function finishDraft(draft, patchListener) {
|
|
|
31916
31732
|
return this.processResult(undefined, scope);
|
|
31917
31733
|
};
|
|
31918
31734
|
|
|
31919
|
-
Immer.prototype.setAutoFreeze = function setAutoFreeze(value) {
|
|
31735
|
+
Immer.prototype.setAutoFreeze = function setAutoFreeze (value) {
|
|
31920
31736
|
this.autoFreeze = value;
|
|
31921
31737
|
};
|
|
31922
31738
|
|
|
31923
|
-
Immer.prototype.setUseProxies = function setUseProxies(value) {
|
|
31739
|
+
Immer.prototype.setUseProxies = function setUseProxies (value) {
|
|
31924
31740
|
this.useProxies = value;
|
|
31925
31741
|
assign(this, value ? modernProxy : legacyProxy);
|
|
31926
31742
|
};
|
|
31927
31743
|
|
|
31928
|
-
Immer.prototype.applyPatches = function applyPatches$1(base, patches) {
|
|
31744
|
+
Immer.prototype.applyPatches = function applyPatches$1 (base, patches) {
|
|
31929
31745
|
// If a patch replaces the entire state, take that replacement as base
|
|
31930
31746
|
// before applying patches
|
|
31931
31747
|
var i;
|
|
@@ -31945,14 +31761,12 @@ Immer.prototype.applyPatches = function applyPatches$1(base, patches) {
|
|
|
31945
31761
|
} // Otherwise, produce a copy of the base state.
|
|
31946
31762
|
|
|
31947
31763
|
|
|
31948
|
-
return this.produce(base, function (draft) {
|
|
31949
|
-
return applyPatches(draft, patches.slice(i + 1));
|
|
31950
|
-
});
|
|
31764
|
+
return this.produce(base, function (draft) { return applyPatches(draft, patches.slice(i + 1)); });
|
|
31951
31765
|
};
|
|
31952
31766
|
/** @internal */
|
|
31953
31767
|
|
|
31954
31768
|
|
|
31955
|
-
Immer.prototype.processResult = function processResult(result, scope) {
|
|
31769
|
+
Immer.prototype.processResult = function processResult (result, scope) {
|
|
31956
31770
|
var baseDraft = scope.drafts[0];
|
|
31957
31771
|
var isReplaced = result !== undefined && result !== baseDraft;
|
|
31958
31772
|
this.willFinalize(scope, result, isReplaced);
|
|
@@ -32000,15 +31814,13 @@ Immer.prototype.processResult = function processResult(result, scope) {
|
|
|
32000
31814
|
*/
|
|
32001
31815
|
|
|
32002
31816
|
|
|
32003
|
-
Immer.prototype.finalize = function finalize(draft, path, scope) {
|
|
32004
|
-
|
|
31817
|
+
Immer.prototype.finalize = function finalize (draft, path, scope) {
|
|
31818
|
+
var this$1 = this;
|
|
31819
|
+
|
|
32005
31820
|
var state = draft[DRAFT_STATE];
|
|
32006
31821
|
|
|
32007
31822
|
if (!state) {
|
|
32008
|
-
if (Object.isFrozen(draft)) {
|
|
32009
|
-
return draft;
|
|
32010
|
-
}
|
|
32011
|
-
|
|
31823
|
+
if (Object.isFrozen(draft)) { return draft; }
|
|
32012
31824
|
return this.finalizeTree(draft, null, scope);
|
|
32013
31825
|
} // Never finalize drafts owned by another scope.
|
|
32014
31826
|
|
|
@@ -32031,17 +31843,13 @@ Immer.prototype.finalize = function finalize(draft, path, scope) {
|
|
|
32031
31843
|
var assigned = state.assigned;
|
|
32032
31844
|
|
|
32033
31845
|
for (var prop in assigned) {
|
|
32034
|
-
if (!assigned[prop]) {
|
|
32035
|
-
this.onDelete(state, prop);
|
|
32036
|
-
}
|
|
31846
|
+
if (!assigned[prop]) { this.onDelete(state, prop); }
|
|
32037
31847
|
}
|
|
32038
31848
|
} else {
|
|
32039
31849
|
var base = state.base;
|
|
32040
|
-
|
|
31850
|
+
var copy = state.copy;
|
|
32041
31851
|
each(base, function (prop) {
|
|
32042
|
-
if (!has(copy, prop)) {
|
|
32043
|
-
this$1.onDelete(state, prop);
|
|
32044
|
-
}
|
|
31852
|
+
if (!has(copy, prop)) { this$1.onDelete(state, prop); }
|
|
32045
31853
|
});
|
|
32046
31854
|
}
|
|
32047
31855
|
}
|
|
@@ -32069,8 +31877,9 @@ Immer.prototype.finalize = function finalize(draft, path, scope) {
|
|
|
32069
31877
|
*/
|
|
32070
31878
|
|
|
32071
31879
|
|
|
32072
|
-
Immer.prototype.finalizeTree = function finalizeTree(root, rootPath, scope) {
|
|
32073
|
-
|
|
31880
|
+
Immer.prototype.finalizeTree = function finalizeTree (root, rootPath, scope) {
|
|
31881
|
+
var this$1 = this;
|
|
31882
|
+
|
|
32074
31883
|
var state = root[DRAFT_STATE];
|
|
32075
31884
|
|
|
32076
31885
|
if (state) {
|
|
@@ -32084,7 +31893,7 @@ Immer.prototype.finalizeTree = function finalizeTree(root, rootPath, scope) {
|
|
|
32084
31893
|
|
|
32085
31894
|
var needPatches = !!rootPath && !!scope.patches;
|
|
32086
31895
|
|
|
32087
|
-
var finalizeProperty = function
|
|
31896
|
+
var finalizeProperty = function (prop, value, parent) {
|
|
32088
31897
|
if (value === parent) {
|
|
32089
31898
|
throw Error("Immer forbids circular references");
|
|
32090
31899
|
} // In the `finalizeTree` method, only the `root` object may be a draft.
|
|
@@ -32111,9 +31920,7 @@ Immer.prototype.finalizeTree = function finalizeTree(root, rootPath, scope) {
|
|
|
32111
31920
|
} // Unchanged drafts are never passed to the `onAssign` hook.
|
|
32112
31921
|
|
|
32113
31922
|
|
|
32114
|
-
if (isDraftProp && value === state.base[prop]) {
|
|
32115
|
-
return;
|
|
32116
|
-
}
|
|
31923
|
+
if (isDraftProp && value === state.base[prop]) { return; }
|
|
32117
31924
|
} // Unchanged draft properties are ignored.
|
|
32118
31925
|
else if (isDraftProp && is(value, state.base[prop])) {
|
|
32119
31926
|
return;
|
|
@@ -32198,149 +32005,103 @@ var createDraft = immer.createDraft.bind(immer);
|
|
|
32198
32005
|
|
|
32199
32006
|
var finishDraft = immer.finishDraft.bind(immer);
|
|
32200
32007
|
|
|
32201
|
-
|
|
32202
|
-
|
|
32203
|
-
|
|
32204
|
-
|
|
32205
|
-
for (var _i = 0, _formConfigKeys = formConfigKeys; _i < _formConfigKeys.length; _i++) {
|
|
32206
|
-
var formKey = _formConfigKeys[_i];
|
|
32008
|
+
const createInitialState = formConfig => {
|
|
32009
|
+
let initialForm = {};
|
|
32010
|
+
const formConfigKeys = Object.keys(formConfig);
|
|
32011
|
+
for (let formKey of formConfigKeys) {
|
|
32207
32012
|
initialForm[formKey] = {
|
|
32208
32013
|
dirty: false,
|
|
32209
32014
|
rawValue: formConfig[formKey].defaultValue || "",
|
|
32210
32015
|
validators: formConfig[formKey].validators || [],
|
|
32211
32016
|
constraints: formConfig[formKey].constraints || []
|
|
32212
32017
|
};
|
|
32213
|
-
}
|
|
32018
|
+
}
|
|
32019
|
+
// Because validators require the entire form we have to do a
|
|
32214
32020
|
// second pass to add errors once the initial form has been
|
|
32215
32021
|
// constructed
|
|
32216
|
-
|
|
32217
|
-
|
|
32218
|
-
|
|
32219
|
-
|
|
32220
|
-
var errors = computeErrors(_formKey, initialForm);
|
|
32221
|
-
initialForm[_formKey].errors = errors;
|
|
32222
|
-
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;
|
|
32223
32026
|
}
|
|
32224
|
-
|
|
32225
32027
|
return initialForm;
|
|
32226
32028
|
};
|
|
32227
32029
|
|
|
32228
|
-
|
|
32229
|
-
|
|
32230
|
-
|
|
32231
|
-
|
|
32232
|
-
|
|
32233
|
-
type: SET,
|
|
32234
|
-
payload: {
|
|
32235
|
-
fieldName: fieldName,
|
|
32236
|
-
value: value
|
|
32237
|
-
}
|
|
32238
|
-
};
|
|
32239
|
-
};
|
|
32240
|
-
};
|
|
32241
|
-
|
|
32242
|
-
var CLEAR = "form/CLEAR";
|
|
32243
|
-
|
|
32244
|
-
var _clear = function clear() {
|
|
32245
|
-
return {
|
|
32246
|
-
type: CLEAR
|
|
32247
|
-
};
|
|
32248
|
-
};
|
|
32249
|
-
|
|
32250
|
-
var createFormReducer = function createFormReducer(formConfig) {
|
|
32251
|
-
return function () {
|
|
32252
|
-
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : createInitialState(formConfig);
|
|
32253
|
-
var action = arguments.length > 1 ? arguments[1] : undefined;
|
|
32254
|
-
|
|
32255
|
-
switch (action.type) {
|
|
32256
|
-
case SET:
|
|
32257
|
-
var changedFieldName = action.payload.fieldName;
|
|
32258
|
-
var newRawValue = action.payload.value;
|
|
32259
|
-
return produce(state, function (draftState) {
|
|
32260
|
-
var originalValue = draftState[changedFieldName].rawValue;
|
|
32261
|
-
draftState[changedFieldName].rawValue = newRawValue;
|
|
32262
|
-
|
|
32263
|
-
if (computeConstraints(changedFieldName, draftState).length > 0) {
|
|
32264
|
-
// If the change violates constraints, revert the change
|
|
32265
|
-
draftState[changedFieldName].rawValue = originalValue;
|
|
32266
|
-
return draftState;
|
|
32267
|
-
}
|
|
32268
|
-
|
|
32269
|
-
var fields = Object.entries(draftState);
|
|
32270
|
-
|
|
32271
|
-
for (var _i3 = 0, _fields = fields; _i3 < _fields.length; _i3++) {
|
|
32272
|
-
var entry = _fields[_i3];
|
|
32273
|
-
var fieldName = entry[0];
|
|
32274
|
-
var field = entry[1];
|
|
32275
|
-
var errors = computeErrors(fieldName, draftState);
|
|
32276
|
-
var dirty = fieldName === changedFieldName ? true : field.dirty;
|
|
32277
|
-
draftState[fieldName].errors = errors;
|
|
32278
|
-
draftState[fieldName].dirty = dirty;
|
|
32279
|
-
draftState[fieldName].hasErrors = errors.length > 0;
|
|
32280
|
-
}
|
|
32281
|
-
});
|
|
32030
|
+
const SET = "field/SET";
|
|
32031
|
+
const set$2 = fieldName => value => ({
|
|
32032
|
+
type: SET,
|
|
32033
|
+
payload: { fieldName, value }
|
|
32034
|
+
});
|
|
32282
32035
|
|
|
32283
|
-
|
|
32284
|
-
|
|
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
|
+
}
|
|
32285
32056
|
|
|
32286
|
-
|
|
32287
|
-
|
|
32288
|
-
|
|
32289
|
-
|
|
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
|
+
}
|
|
32290
32073
|
};
|
|
32291
32074
|
|
|
32292
|
-
|
|
32075
|
+
const createMapDispatchToProps = formConfig => {
|
|
32293
32076
|
// Do memo-ization
|
|
32294
|
-
|
|
32295
|
-
|
|
32296
|
-
return
|
|
32077
|
+
let cachedDispatch;
|
|
32078
|
+
let cacheValue;
|
|
32079
|
+
return dispatch => {
|
|
32297
32080
|
if (dispatch == cachedDispatch) {
|
|
32298
32081
|
return cacheValue;
|
|
32299
32082
|
}
|
|
32300
|
-
|
|
32301
|
-
var dispatchObj = {};
|
|
32083
|
+
let dispatchObj = {};
|
|
32302
32084
|
dispatchObj.fields = {};
|
|
32303
|
-
|
|
32304
|
-
|
|
32305
|
-
var _loop = function _loop() {
|
|
32306
|
-
var fieldName = _keys[_i4];
|
|
32085
|
+
const keys = Object.keys(formConfig);
|
|
32086
|
+
for (let fieldName of keys) {
|
|
32307
32087
|
dispatchObj.fields[fieldName] = {
|
|
32308
|
-
set:
|
|
32309
|
-
return dispatch(set$2(fieldName)(value));
|
|
32310
|
-
}
|
|
32088
|
+
set: value => dispatch(set$2(fieldName)(value))
|
|
32311
32089
|
};
|
|
32312
|
-
};
|
|
32313
|
-
|
|
32314
|
-
for (var _i4 = 0, _keys = keys; _i4 < _keys.length; _i4++) {
|
|
32315
|
-
_loop();
|
|
32316
32090
|
}
|
|
32317
|
-
|
|
32318
|
-
dispatchObj.form = {
|
|
32319
|
-
clear: function clear() {
|
|
32320
|
-
return dispatch(_clear());
|
|
32321
|
-
}
|
|
32322
|
-
};
|
|
32091
|
+
dispatchObj.form = { clear: () => dispatch(clear()) };
|
|
32323
32092
|
cachedDispatch = dispatch;
|
|
32324
|
-
cacheValue = {
|
|
32325
|
-
actions: dispatchObj
|
|
32326
|
-
};
|
|
32093
|
+
cacheValue = { actions: dispatchObj };
|
|
32327
32094
|
return cacheValue;
|
|
32328
32095
|
};
|
|
32329
32096
|
};
|
|
32330
32097
|
|
|
32331
|
-
|
|
32332
|
-
return {
|
|
32333
|
-
fields: state
|
|
32334
|
-
};
|
|
32335
|
-
};
|
|
32098
|
+
const mapStateToProps = state => ({ fields: state });
|
|
32336
32099
|
|
|
32337
|
-
|
|
32338
|
-
|
|
32339
|
-
|
|
32340
|
-
|
|
32341
|
-
|
|
32342
|
-
};
|
|
32343
|
-
};
|
|
32100
|
+
const createFormState = formConfig => ({
|
|
32101
|
+
reducer: createFormReducer(formConfig),
|
|
32102
|
+
mapDispatchToProps: createMapDispatchToProps(formConfig),
|
|
32103
|
+
mapStateToProps: mapStateToProps
|
|
32104
|
+
});
|
|
32344
32105
|
|
|
32345
32106
|
var formatDelimiter = "_";
|
|
32346
32107
|
var phoneFormats = ["", "_", "__", "(___) ", "(___) _", "(___) __", "(___) ___-", "(___) ___-_", "(___) ___-__", "(___) ___-___", "(___) ___-____"];
|
|
@@ -32669,7 +32430,7 @@ var CollapsibleSection = function CollapsibleSection(_ref) {
|
|
|
32669
32430
|
display: "flex",
|
|
32670
32431
|
alignItems: "center"
|
|
32671
32432
|
}
|
|
32672
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
32433
|
+
}, /*#__PURE__*/React__default.createElement(ChevronIcon$1, null)))), /*#__PURE__*/React__default.createElement(AnimatePresence, {
|
|
32673
32434
|
initial: false
|
|
32674
32435
|
}, isOpen && /*#__PURE__*/React__default.createElement(Motion, {
|
|
32675
32436
|
padding: "0",
|
|
@@ -34628,8 +34389,14 @@ var Module = function Module(_ref) {
|
|
|
34628
34389
|
|
|
34629
34390
|
var Module$1 = /*#__PURE__*/React.memo(themeComponent(Module, "Module", fallbackValues$r, "default"));
|
|
34630
34391
|
|
|
34631
|
-
var backgroundColor$6 =
|
|
34632
|
-
|
|
34392
|
+
var backgroundColor$6 = {
|
|
34393
|
+
profile: "#3b414d",
|
|
34394
|
+
cms: "#3b414d"
|
|
34395
|
+
};
|
|
34396
|
+
var shadowColor = {
|
|
34397
|
+
profile: "#292A33",
|
|
34398
|
+
cms: "#292A33"
|
|
34399
|
+
};
|
|
34633
34400
|
var fallbackValues$s = {
|
|
34634
34401
|
backgroundColor: backgroundColor$6,
|
|
34635
34402
|
shadowColor: shadowColor
|
|
@@ -34669,7 +34436,7 @@ var NavMenuDesktop = function NavMenuDesktop(_ref) {
|
|
|
34669
34436
|
}, menuContent));
|
|
34670
34437
|
};
|
|
34671
34438
|
|
|
34672
|
-
var NavMenuDesktop$1 = themeComponent(NavMenuDesktop, "NavMenu", fallbackValues$s);
|
|
34439
|
+
var NavMenuDesktop$1 = themeComponent(NavMenuDesktop, "NavMenu", fallbackValues$s, "profile");
|
|
34673
34440
|
|
|
34674
34441
|
function _templateObject$y() {
|
|
34675
34442
|
var data = _taggedTemplateLiteral(["\n position: fixed;\n top: 72px;\n"]);
|
|
@@ -34729,7 +34496,7 @@ var NavMenuMobile = function NavMenuMobile(_ref) {
|
|
|
34729
34496
|
}, menuContent));
|
|
34730
34497
|
};
|
|
34731
34498
|
|
|
34732
|
-
var NavMenuMobile$1 = themeComponent(NavMenuMobile, "NavMenu", fallbackValues$s);
|
|
34499
|
+
var NavMenuMobile$1 = themeComponent(NavMenuMobile, "NavMenu", fallbackValues$s, "profile");
|
|
34733
34500
|
|
|
34734
34501
|
var AccountBillIcon = function AccountBillIcon() {
|
|
34735
34502
|
return /*#__PURE__*/React__default.createElement("svg", {
|
|
@@ -38093,7 +37860,10 @@ var Timeout$1 = withWindowSize(Timeout);
|
|
|
38093
37860
|
var WorkflowTile = function WorkflowTile(_ref) {
|
|
38094
37861
|
var _ref$workflowName = _ref.workflowName,
|
|
38095
37862
|
workflowName = _ref$workflowName === void 0 ? "Test Workflow" : _ref$workflowName,
|
|
38096
|
-
|
|
37863
|
+
_ref$workflowDescript = _ref.workflowDescription,
|
|
37864
|
+
workflowDescription = _ref$workflowDescript === void 0 ? "Link your benefit plan" : _ref$workflowDescript,
|
|
37865
|
+
_ref$workflowActionNa = _ref.workflowActionName,
|
|
37866
|
+
workflowActionName = _ref$workflowActionNa === void 0 ? "Search" : _ref$workflowActionNa,
|
|
38097
37867
|
slug = _ref.slug;
|
|
38098
37868
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
38099
37869
|
background: WHITE,
|
|
@@ -38116,7 +37886,7 @@ var WorkflowTile = function WorkflowTile(_ref) {
|
|
|
38116
37886
|
}, /*#__PURE__*/React__default.createElement(Paragraph$1, {
|
|
38117
37887
|
variant: "pS",
|
|
38118
37888
|
color: STORM_GREY
|
|
38119
|
-
}, workflowDescription
|
|
37889
|
+
}, workflowDescription)), /*#__PURE__*/React__default.createElement(Box, {
|
|
38120
37890
|
padding: "1.5rem 1rem",
|
|
38121
37891
|
background: GRECIAN_GREY
|
|
38122
37892
|
}, /*#__PURE__*/React__default.createElement(ButtonWithLink, {
|
|
@@ -38125,7 +37895,7 @@ var WorkflowTile = function WorkflowTile(_ref) {
|
|
|
38125
37895
|
fontWeight: FONT_WEIGHT_SEMIBOLD,
|
|
38126
37896
|
fontSize: "1.125rem",
|
|
38127
37897
|
borderRadius: "0px",
|
|
38128
|
-
text:
|
|
37898
|
+
text: workflowActionName,
|
|
38129
37899
|
minWidth: "100%",
|
|
38130
37900
|
url: "/service/".concat(slug),
|
|
38131
37901
|
extraStyles: "width: 100%;"
|