@thecb/components 9.0.0-beta.7 → 9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/dist/index.cjs.js +314 -1371
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.d.ts +2 -2
  4. package/dist/index.esm.js +314 -1372
  5. package/dist/index.esm.js.map +1 -1
  6. package/package.json +2 -2
  7. package/src/components/atoms/checkbox/Checkbox.js +1 -0
  8. package/src/components/atoms/country-dropdown/CountryDropdown.js +1 -1
  9. package/src/components/atoms/country-dropdown/CountryDropdown.stories.js +0 -1
  10. package/src/components/atoms/dropdown/Dropdown.js +9 -9
  11. package/src/components/atoms/form-layouts/FormInput.js +2 -3
  12. package/src/components/atoms/form-layouts/index.d.ts +1 -1
  13. package/src/components/atoms/form-select/FormSelect.js +1 -1
  14. package/src/components/atoms/form-select/index.d.ts +1 -1
  15. package/src/components/molecules/account-and-routing-modal/AccountAndRoutingModal.js +0 -1
  16. package/src/components/molecules/link-card/index.d.ts +1 -1
  17. package/src/components/molecules/modal/Modal.js +1 -1
  18. package/src/components/molecules/partial-amount-form/PartialAmountForm.state.js +40 -22
  19. package/src/components/molecules/partial-amount-form/index.js +9 -2
  20. package/src/components/molecules/payment-details/PaymentDetails.js +36 -16
  21. package/src/components/molecules/phone-form/PhoneForm.js +1 -0
  22. package/src/components/molecules/terms-and-conditions/TermsAndConditionsControlV1.js +1 -2
  23. package/src/components/molecules/terms-and-conditions/TermsAndConditionsControlV2.js +0 -1
  24. package/src/components/atoms/dropdown/index.d.ts +0 -32
  25. package/src/components/atoms/state-province-dropdown/index.d.ts +0 -26
package/dist/index.esm.js CHANGED
@@ -22154,6 +22154,7 @@ var Checkbox = function Checkbox(_ref4) {
22154
22154
  error: error,
22155
22155
  disabled: disabled,
22156
22156
  checked: checked,
22157
+ "aria-checked": checked,
22157
22158
  focused: focused,
22158
22159
  defaultStyles: themeValues.defaultStyles,
22159
22160
  checkedStyles: themeValues.checkedStyles,
@@ -24063,13 +24064,14 @@ var Dropdown = function Dropdown(_ref8) {
24063
24064
  "data-qa": choice.text,
24064
24065
  themeValues: themeValues,
24065
24066
  title: hasTitles ? choice.text : null,
24067
+ role: "option",
24066
24068
  onFocus: function onFocus() {
24067
24069
  return setFocusedRef(optionRefs.current[i]);
24068
24070
  }
24069
24071
  }, /*#__PURE__*/React.createElement(Text$1, {
24070
24072
  variant: "p",
24071
24073
  color: choice.value === value ? WHITE : disabledValues.includes(choice.value) ? STORM_GREY : MINESHAFT_GREY,
24072
- extraStyles: "padding-left: 16px; \n cursor: ".concat(disabledValues.includes(choice.value) ? "default" : "pointer", "; \n white-space: nowrap; \n overflow: hidden; \n text-overflow: ellipsis;")
24074
+ extraStyles: "padding-left: 16px; \n cursor: ".concat(disabledValues.includes(choice.value) ? "default" : "pointer", "; \n white-space: nowrap; \n overflow: hidden; \n text-overflow: ellipsis;")
24073
24075
  }, choice.text));
24074
24076
  }))) : /*#__PURE__*/React.createElement(Fragment$1, null)));
24075
24077
  };
@@ -24219,7 +24221,7 @@ var FormSelect = function FormSelect(_ref) {
24219
24221
  id: createIdFromString(labelTextWhenNoError)
24220
24222
  }, labelTextWhenNoError))), /*#__PURE__*/React.createElement(Dropdown$1, {
24221
24223
  ariaLabelledby: createIdFromString(labelTextWhenNoError),
24222
- ariaDescribedBy: createIdFromString(labelTextWhenNoError, "error message"),
24224
+ ariaDescribedby: createIdFromString(labelTextWhenNoError, "error message"),
24223
24225
  maxHeight: dropdownMaxHeight,
24224
24226
  hasTitles: hasTitles,
24225
24227
  placeholder: options[0] ? options[0].text : "",
@@ -25001,7 +25003,8 @@ var options = [{
25001
25003
  }];
25002
25004
 
25003
25005
  var CountryDropdown = function CountryDropdown(_ref) {
25004
- var labelTextWhenNoError = _ref.labelTextWhenNoError,
25006
+ var _ref$labelTextWhenNoE = _ref.labelTextWhenNoError,
25007
+ labelTextWhenNoError = _ref$labelTextWhenNoE === void 0 ? "Country" : _ref$labelTextWhenNoE,
25005
25008
  errorMessages = _ref.errorMessages,
25006
25009
  field = _ref.field,
25007
25010
  fieldActions = _ref.fieldActions,
@@ -25946,10 +25949,11 @@ var FormInput = function FormInput(_ref15) {
25946
25949
  background = _ref15.background,
25947
25950
  customHeight = _ref15.customHeight,
25948
25951
  _ref15$autocompleteVa = _ref15.autocompleteValue,
25949
- autocompleteValue = _ref15$autocompleteVa === void 0 ? "" : _ref15$autocompleteVa,
25952
+ autocompleteValue = _ref15$autocompleteVa === void 0 ? null : _ref15$autocompleteVa,
25950
25953
  extraStyles = _ref15.extraStyles,
25951
25954
  removeFromValue = _ref15.removeFromValue,
25952
- dataQa = _ref15.dataQa,
25955
+ _ref15$dataQa = _ref15.dataQa,
25956
+ dataQa = _ref15$dataQa === void 0 ? null : _ref15$dataQa,
25953
25957
  props = _objectWithoutProperties(_ref15, _excluded2);
25954
25958
 
25955
25959
  var _useState = useState(false),
@@ -26060,8 +26064,7 @@ var FormInput = function FormInput(_ref15) {
26060
26064
  direction: "row",
26061
26065
  justify: "space-between",
26062
26066
  "aria-live": "polite",
26063
- "aria-atomic": true,
26064
- "data-qa": "".concat(labelTextWhenNoError, " error message")
26067
+ "aria-atomic": true
26065
26068
  }, field.hasErrors && field.dirty || field.hasErrors && showErrors ? /*#__PURE__*/React.createElement(Text$1, {
26066
26069
  color: ERROR_COLOR,
26067
26070
  variant: "pXS",
@@ -38584,44 +38587,52 @@ var TableHeading_styled = styled.th.withConfig({
38584
38587
  return extraStyles;
38585
38588
  });
38586
38589
 
38587
- const validatorToPredicate = (validatorFn, emptyCase) => (
38588
- value,
38589
- ...rest
38590
- ) => (value === "" ? emptyCase : validatorFn(value, ...rest));
38590
+ const validatorToPredicate =
38591
+ (validatorFn, emptyCase) =>
38592
+ (value, ...rest) =>
38593
+ value === '' ? emptyCase : validatorFn(value, ...rest);
38591
38594
 
38592
38595
  var commonjsGlobal$1 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
38593
38596
 
38597
+ function getDefaultExportFromCjs (x) {
38598
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
38599
+ }
38600
+
38594
38601
  var dayjs_min = {exports: {}};
38595
38602
 
38596
38603
  (function (module, exports) {
38597
- !function(t,e){module.exports=e();}(commonjsGlobal$1,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",f="month",h="quarter",c="year",d="date",$="Invalid Date",l=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},g={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,f),s=n-i<0,u=e.clone().add(r+(s?-1:1),f);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:f,y:c,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:h}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},D="en",v={};v[D]=M;var p=function(t){return t instanceof _},S=function(t,e,n){var r;if(!t)return D;if("string"==typeof t)v[t]&&(r=t),e&&(v[t]=e,r=t);else {var i=t.name;v[i]=t,r=i;}return !n&&r&&(D=r),r||!n&&D},w=function(t,e){if(p(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},O=g;O.l=S,O.i=p,O.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=S(t.locale,null,!0),this.parse(t);}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(O.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(l);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return O},m.isValid=function(){return !(this.$d.toString()===$)},m.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return w(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<w(t)},m.$g=function(t,e,n){return O.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!O.u(e)||e,h=O.p(t),$=function(t,e){var i=O.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},l=function(t,e){return O.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,g="set"+(this.$u?"UTC":"");switch(h){case c:return r?$(1,0):$(31,11);case f:return r?$(1,M):$(0,M+1);case o:var D=this.$locale().weekStart||0,v=(y<D?y+7:y)-D;return $(r?m-v:m+(6-v),M);case a:case d:return l(g+"Hours",0);case u:return l(g+"Minutes",1);case s:return l(g+"Seconds",2);case i:return l(g+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=O.p(t),h="set"+(this.$u?"UTC":""),$=(n={},n[a]=h+"Date",n[d]=h+"Date",n[f]=h+"Month",n[c]=h+"FullYear",n[u]=h+"Hours",n[s]=h+"Minutes",n[i]=h+"Seconds",n[r]=h+"Milliseconds",n)[o],l=o===a?this.$D+(e-this.$W):e;if(o===f||o===c){var y=this.clone().set(d,1);y.$d[$](l),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else $&&this.$d[$](l);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[O.p(t)]()},m.add=function(r,h){var d,$=this;r=Number(r);var l=O.p(h),y=function(t){var e=w($);return O.w(e.date(e.date()+Math.round(t*r)),$)};if(l===f)return this.set(f,this.$M+r);if(l===c)return this.set(c,this.$y+r);if(l===a)return y(1);if(l===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[l]||1,m=this.$d.getTime()+r*M;return O.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||$;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=O.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,f=n.months,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].substr(0,s)},c=function(t){return O.s(s%12||12,t,"0")},d=n.meridiem||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r},l={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:O.s(a+1,2,"0"),MMM:h(n.monthsShort,a,f,3),MMMM:h(f,a),D:this.$D,DD:O.s(this.$D,2,"0"),d:String(this.$W),dd:h(n.weekdaysMin,this.$W,o,2),ddd:h(n.weekdaysShort,this.$W,o,3),dddd:o[this.$W],H:String(s),HH:O.s(s,2,"0"),h:c(1),hh:c(2),a:d(s,u,!0),A:d(s,u,!1),m:String(u),mm:O.s(u,2,"0"),s:String(this.$s),ss:O.s(this.$s,2,"0"),SSS:O.s(this.$ms,3,"0"),Z:i};return r.replace(y,(function(t,e){return e||l[t]||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,$){var l,y=O.p(d),M=w(r),m=(M.utcOffset()-this.utcOffset())*e,g=this-M,D=O.m(this,M);return D=(l={},l[c]=D/12,l[f]=D,l[h]=D/3,l[o]=(g-m)/6048e5,l[a]=(g-m)/864e5,l[u]=g/n,l[s]=g/e,l[i]=g/t,l)[y]||g,$?D:O.a(D)},m.daysInMonth=function(){return this.endOf(f).$D},m.$locale=function(){return v[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=S(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return O.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),b=_.prototype;return w.prototype=b,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",f],["$y",c],["$D",d]].forEach((function(t){b[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),w.extend=function(t,e){return t.$i||(t(e,_,w),t.$i=!0),w},w.locale=S,w.isDayjs=p,w.unix=function(t){return w(1e3*t)},w.en=v[D],w.Ls=v,w.p={},w}));
38598
- }(dayjs_min));
38604
+ !function(t,e){module.exports=e();}(commonjsGlobal$1,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",f="month",h="quarter",c="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,f),s=n-i<0,u=e.clone().add(r+(s?-1:1),f);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:f,y:c,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:h}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p=function(t){return t instanceof _},S=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},w=function(t,e){if(p(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},O=v;O.l=S,O.i=p,O.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=S(t.locale,null,!0),this.parse(t);}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(O.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return O},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return w(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<w(t)},m.$g=function(t,e,n){return O.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!O.u(e)||e,h=O.p(t),l=function(t,e){var i=O.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return O.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(h){case c:return r?l(1,0):l(31,11);case f:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=O.p(t),h="set"+(this.$u?"UTC":""),l=(n={},n[a]=h+"Date",n[d]=h+"Date",n[f]=h+"Month",n[c]=h+"FullYear",n[u]=h+"Hours",n[s]=h+"Minutes",n[i]=h+"Seconds",n[r]=h+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===f||o===c){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[O.p(t)]()},m.add=function(r,h){var d,l=this;r=Number(r);var $=O.p(h),y=function(t){var e=w(l);return O.w(e.date(e.date()+Math.round(t*r)),l)};if($===f)return this.set(f,this.$M+r);if($===c)return this.set(c,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return O.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=O.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,f=n.months,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},c=function(t){return O.s(s%12||12,t,"0")},d=n.meridiem||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r},$={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:O.s(a+1,2,"0"),MMM:h(n.monthsShort,a,f,3),MMMM:h(f,a),D:this.$D,DD:O.s(this.$D,2,"0"),d:String(this.$W),dd:h(n.weekdaysMin,this.$W,o,2),ddd:h(n.weekdaysShort,this.$W,o,3),dddd:o[this.$W],H:String(s),HH:O.s(s,2,"0"),h:c(1),hh:c(2),a:d(s,u,!0),A:d(s,u,!1),m:String(u),mm:O.s(u,2,"0"),s:String(this.$s),ss:O.s(this.$s,2,"0"),SSS:O.s(this.$ms,3,"0"),Z:i};return r.replace(y,(function(t,e){return e||$[t]||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=O.p(d),M=w(r),m=(M.utcOffset()-this.utcOffset())*e,v=this-M,g=O.m(this,M);return g=($={},$[c]=g/12,$[f]=g,$[h]=g/3,$[o]=(v-m)/6048e5,$[a]=(v-m)/864e5,$[u]=v/n,$[s]=v/e,$[i]=v/t,$)[y]||v,l?g:O.a(g)},m.daysInMonth=function(){return this.endOf(f).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=S(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return O.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),T=_.prototype;return w.prototype=T,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",f],["$y",c],["$D",d]].forEach((function(t){T[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),w.extend=function(t,e){return t.$i||(t(e,_,w),t.$i=!0),w},w.locale=S,w.isDayjs=p,w.unix=function(t){return w(1e3*t)},w.en=D[g],w.Ls=D,w.p={},w}));
38605
+ } (dayjs_min));
38599
38606
 
38600
- var dayjs = dayjs_min.exports;
38607
+ var dayjs_minExports = dayjs_min.exports;
38608
+ var dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);
38601
38609
 
38602
38610
  var customParseFormat$1 = {exports: {}};
38603
38611
 
38604
38612
  (function (module, exports) {
38605
- !function(t,e){module.exports=e();}(commonjsGlobal$1,(function(){var t={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},e=/(\[[^[]*\])|([-:/.()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d\d/,r=/\d\d?/,i=/\d*[^\s\d-_:/()]+/,o={},s=function(t){return (t=+t)+(t>68?1900:2e3)};var a=function(t){return function(e){this[t]=+e;}},f=[/[+-]\d\d:?(\d\d)?|Z/,function(t){(this.zone||(this.zone={})).offset=function(t){if(!t)return 0;if("Z"===t)return 0;var e=t.match(/([+-]|\d\d)/g),n=60*e[1]+(+e[2]||0);return 0===n?0:"+"===e[0]?-n:n}(t);}],u=function(t){var e=o[t];return e&&(e.indexOf?e:e.s.concat(e.f))},h=function(t,e){var n,r=o.meridiem;if(r){for(var i=1;i<=24;i+=1)if(t.indexOf(r(i,0,e))>-1){n=i>12;break}}else n=t===(e?"pm":"PM");return n},d={A:[i,function(t){this.afternoon=h(t,!1);}],a:[i,function(t){this.afternoon=h(t,!0);}],S:[/\d/,function(t){this.milliseconds=100*+t;}],SS:[n,function(t){this.milliseconds=10*+t;}],SSS:[/\d{3}/,function(t){this.milliseconds=+t;}],s:[r,a("seconds")],ss:[r,a("seconds")],m:[r,a("minutes")],mm:[r,a("minutes")],H:[r,a("hours")],h:[r,a("hours")],HH:[r,a("hours")],hh:[r,a("hours")],D:[r,a("day")],DD:[n,a("day")],Do:[i,function(t){var e=o.ordinal,n=t.match(/\d+/);if(this.day=n[0],e)for(var r=1;r<=31;r+=1)e(r).replace(/\[|\]/g,"")===t&&(this.day=r);}],M:[r,a("month")],MM:[n,a("month")],MMM:[i,function(t){var e=u("months"),n=(u("monthsShort")||e.map((function(t){return t.substr(0,3)}))).indexOf(t)+1;if(n<1)throw new Error;this.month=n%12||n;}],MMMM:[i,function(t){var e=u("months").indexOf(t)+1;if(e<1)throw new Error;this.month=e%12||e;}],Y:[/[+-]?\d+/,a("year")],YY:[n,function(t){this.year=s(t);}],YYYY:[/\d{4}/,a("year")],Z:f,ZZ:f};function c(n){var r,i;r=n,i=o&&o.formats;for(var s=(n=r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(e,n,r){var o=r&&r.toUpperCase();return n||i[r]||t[r]||i[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(t,e,n){return e||n.slice(1)}))}))).match(e),a=s.length,f=0;f<a;f+=1){var u=s[f],h=d[u],c=h&&h[0],l=h&&h[1];s[f]=l?{regex:c,parser:l}:u.replace(/^\[|\]$/g,"");}return function(t){for(var e={},n=0,r=0;n<a;n+=1){var i=s[n];if("string"==typeof i)r+=i.length;else {var o=i.regex,f=i.parser,u=t.substr(r),h=o.exec(u)[0];f.call(e,h),t=t.replace(h,"");}}return function(t){var e=t.afternoon;if(void 0!==e){var n=t.hours;e?n<12&&(t.hours+=12):12===n&&(t.hours=0),delete t.afternoon;}}(e),e}}return function(t,e,n){n.p.customParseFormat=!0,t&&t.parseTwoDigitYear&&(s=t.parseTwoDigitYear);var r=e.prototype,i=r.parse;r.parse=function(t){var e=t.date,r=t.utc,s=t.args;this.$u=r;var a=s[1];if("string"==typeof a){var f=!0===s[2],u=!0===s[3],h=f||u,d=s[2];u&&(d=s[2]),o=this.$locale(),!f&&d&&(o=n.Ls[d]),this.$d=function(t,e,n){try{if(["x","X"].indexOf(e)>-1)return new Date(("X"===e?1e3:1)*t);var r=c(e)(t),i=r.year,o=r.month,s=r.day,a=r.hours,f=r.minutes,u=r.seconds,h=r.milliseconds,d=r.zone,l=new Date,m=s||(i||o?1:l.getDate()),M=i||l.getFullYear(),Y=0;i&&!o||(Y=o>0?o-1:l.getMonth());var p=a||0,v=f||0,D=u||0,g=h||0;return d?new Date(Date.UTC(M,Y,m,p,v,D,g+60*d.offset*1e3)):n?new Date(Date.UTC(M,Y,m,p,v,D,g)):new Date(M,Y,m,p,v,D,g)}catch(t){return new Date("")}}(e,a,r),this.init(),d&&!0!==d&&(this.$L=this.locale(d).$L),h&&e!=this.format(a)&&(this.$d=new Date("")),o={};}else if(a instanceof Array)for(var l=a.length,m=1;m<=l;m+=1){s[1]=a[m-1];var M=n.apply(this,s);if(M.isValid()){this.$d=M.$d,this.$L=M.$L,this.init();break}m===l&&(this.$d=new Date(""));}else i.call(this,t);};}}));
38606
- }(customParseFormat$1));
38613
+ !function(e,t){module.exports=t();}(commonjsGlobal$1,(function(){var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d\d/,r=/\d\d?/,i=/\d*[^-_:/,()\s\d]+/,o={},s=function(e){return (e=+e)+(e>68?1900:2e3)};var a=function(e){return function(t){this[e]=+t;}},f=[/[+-]\d\d:?(\d\d)?|Z/,function(e){(this.zone||(this.zone={})).offset=function(e){if(!e)return 0;if("Z"===e)return 0;var t=e.match(/([+-]|\d\d)/g),n=60*t[1]+(+t[2]||0);return 0===n?0:"+"===t[0]?-n:n}(e);}],h=function(e){var t=o[e];return t&&(t.indexOf?t:t.s.concat(t.f))},u=function(e,t){var n,r=o.meridiem;if(r){for(var i=1;i<=24;i+=1)if(e.indexOf(r(i,0,t))>-1){n=i>12;break}}else n=e===(t?"pm":"PM");return n},d={A:[i,function(e){this.afternoon=u(e,!1);}],a:[i,function(e){this.afternoon=u(e,!0);}],S:[/\d/,function(e){this.milliseconds=100*+e;}],SS:[n,function(e){this.milliseconds=10*+e;}],SSS:[/\d{3}/,function(e){this.milliseconds=+e;}],s:[r,a("seconds")],ss:[r,a("seconds")],m:[r,a("minutes")],mm:[r,a("minutes")],H:[r,a("hours")],h:[r,a("hours")],HH:[r,a("hours")],hh:[r,a("hours")],D:[r,a("day")],DD:[n,a("day")],Do:[i,function(e){var t=o.ordinal,n=e.match(/\d+/);if(this.day=n[0],t)for(var r=1;r<=31;r+=1)t(r).replace(/\[|\]/g,"")===e&&(this.day=r);}],M:[r,a("month")],MM:[n,a("month")],MMM:[i,function(e){var t=h("months"),n=(h("monthsShort")||t.map((function(e){return e.slice(0,3)}))).indexOf(e)+1;if(n<1)throw new Error;this.month=n%12||n;}],MMMM:[i,function(e){var t=h("months").indexOf(e)+1;if(t<1)throw new Error;this.month=t%12||t;}],Y:[/[+-]?\d+/,a("year")],YY:[n,function(e){this.year=s(e);}],YYYY:[/\d{4}/,a("year")],Z:f,ZZ:f};function c(n){var r,i;r=n,i=o&&o.formats;for(var s=(n=r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(t,n,r){var o=r&&r.toUpperCase();return n||i[r]||e[r]||i[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(e,t,n){return t||n.slice(1)}))}))).match(t),a=s.length,f=0;f<a;f+=1){var h=s[f],u=d[h],c=u&&u[0],l=u&&u[1];s[f]=l?{regex:c,parser:l}:h.replace(/^\[|\]$/g,"");}return function(e){for(var t={},n=0,r=0;n<a;n+=1){var i=s[n];if("string"==typeof i)r+=i.length;else {var o=i.regex,f=i.parser,h=e.slice(r),u=o.exec(h)[0];f.call(t,u),e=e.replace(u,"");}}return function(e){var t=e.afternoon;if(void 0!==t){var n=e.hours;t?n<12&&(e.hours+=12):12===n&&(e.hours=0),delete e.afternoon;}}(t),t}}return function(e,t,n){n.p.customParseFormat=!0,e&&e.parseTwoDigitYear&&(s=e.parseTwoDigitYear);var r=t.prototype,i=r.parse;r.parse=function(e){var t=e.date,r=e.utc,s=e.args;this.$u=r;var a=s[1];if("string"==typeof a){var f=!0===s[2],h=!0===s[3],u=f||h,d=s[2];h&&(d=s[2]),o=this.$locale(),!f&&d&&(o=n.Ls[d]),this.$d=function(e,t,n){try{if(["x","X"].indexOf(t)>-1)return new Date(("X"===t?1e3:1)*e);var r=c(t)(e),i=r.year,o=r.month,s=r.day,a=r.hours,f=r.minutes,h=r.seconds,u=r.milliseconds,d=r.zone,l=new Date,m=s||(i||o?1:l.getDate()),M=i||l.getFullYear(),Y=0;i&&!o||(Y=o>0?o-1:l.getMonth());var p=a||0,v=f||0,D=h||0,g=u||0;return d?new Date(Date.UTC(M,Y,m,p,v,D,g+60*d.offset*1e3)):n?new Date(Date.UTC(M,Y,m,p,v,D,g)):new Date(M,Y,m,p,v,D,g)}catch(e){return new Date("")}}(t,a,r),this.init(),d&&!0!==d&&(this.$L=this.locale(d).$L),u&&t!=this.format(a)&&(this.$d=new Date("")),o={};}else if(a instanceof Array)for(var l=a.length,m=1;m<=l;m+=1){s[1]=a[m-1];var M=n.apply(this,s);if(M.isValid()){this.$d=M.$d,this.$L=M.$L,this.init();break}m===l&&(this.$d=new Date(""));}else i.call(this,e);};}}));
38614
+ } (customParseFormat$1));
38607
38615
 
38608
- var customParseFormat = customParseFormat$1.exports;
38616
+ var customParseFormatExports = customParseFormat$1.exports;
38617
+ var customParseFormat = /*@__PURE__*/getDefaultExportFromCjs(customParseFormatExports);
38609
38618
 
38610
38619
  var isSameOrBefore$1 = {exports: {}};
38611
38620
 
38612
38621
  (function (module, exports) {
38613
- !function(e,i){module.exports=i();}(commonjsGlobal$1,(function(){return function(e,i){i.prototype.isSameOrBefore=function(e,i){return this.isSame(e,i)||this.isBefore(e,i)};}}));
38614
- }(isSameOrBefore$1));
38622
+ !function(e,i){module.exports=i();}(commonjsGlobal$1,(function(){return function(e,i){i.prototype.isSameOrBefore=function(e,i){return this.isSame(e,i)||this.isBefore(e,i)};}}));
38623
+ } (isSameOrBefore$1));
38615
38624
 
38616
- var isSameOrBefore = isSameOrBefore$1.exports;
38625
+ var isSameOrBeforeExports = isSameOrBefore$1.exports;
38626
+ var isSameOrBefore = /*@__PURE__*/getDefaultExportFromCjs(isSameOrBeforeExports);
38617
38627
 
38618
38628
  var isSameOrAfter$1 = {exports: {}};
38619
38629
 
38620
38630
  (function (module, exports) {
38621
- !function(e,t){module.exports=t();}(commonjsGlobal$1,(function(){return function(e,t){t.prototype.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)};}}));
38622
- }(isSameOrAfter$1));
38631
+ !function(e,t){module.exports=t();}(commonjsGlobal$1,(function(){return function(e,t){t.prototype.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)};}}));
38632
+ } (isSameOrAfter$1));
38623
38633
 
38624
- var isSameOrAfter = isSameOrAfter$1.exports;
38634
+ var isSameOrAfterExports = isSameOrAfter$1.exports;
38635
+ var isSameOrAfter = /*@__PURE__*/getDefaultExportFromCjs(isSameOrAfterExports);
38625
38636
 
38626
38637
  /* eslint-disable no-unused-vars */
38627
38638
 
@@ -38637,24 +38648,24 @@ dayjs.extend(isSameOrAfter);
38637
38648
 
38638
38649
  let validatorFns = {};
38639
38650
 
38640
- const INCLUDED_IN = "validator/INCLUDED_IN";
38641
- const INCLUDED_IN_ERROR = "error/INCLUDED_IN";
38651
+ const INCLUDED_IN = 'validator/INCLUDED_IN';
38652
+ const INCLUDED_IN_ERROR = 'error/INCLUDED_IN';
38642
38653
  const includedIn = createValidator(INCLUDED_IN, INCLUDED_IN_ERROR);
38643
38654
  validatorFns[INCLUDED_IN] = (value, args, form) =>
38644
38655
  Array.isArray(args[0]) ? args[0].includes(value) : args[0] === value;
38645
38656
 
38646
- const REQUIRED = "validator/REQUIRED";
38647
- const REQUIRED_ERROR = "error/REQUIRED";
38657
+ const REQUIRED = 'validator/REQUIRED';
38658
+ const REQUIRED_ERROR = 'error/REQUIRED';
38648
38659
  const required = createValidator(REQUIRED, REQUIRED_ERROR);
38649
- validatorFns[REQUIRED] = (value, args, form) => value !== "";
38660
+ validatorFns[REQUIRED] = (value, args, form) => value !== '';
38650
38661
 
38651
- const ONLY_INTEGERS = "validator/ONLY_INTEGERS";
38652
- const ONLY_INTEGERS_ERROR = "error/ONLY_INTEGERS";
38662
+ const ONLY_INTEGERS = 'validator/ONLY_INTEGERS';
38663
+ const ONLY_INTEGERS_ERROR = 'error/ONLY_INTEGERS';
38653
38664
  const onlyIntegers = createValidator(ONLY_INTEGERS, ONLY_INTEGERS_ERROR);
38654
38665
  validatorFns[ONLY_INTEGERS] = (value, args, form) => /^(-?\d+)?$/.test(value);
38655
38666
 
38656
- const ONLY_NATURALS = "validator/ONLY_NATURALS";
38657
- const ONLY_NATURALS_ERROR = "error/ONLY_NATURALS";
38667
+ const ONLY_NATURALS = 'validator/ONLY_NATURALS';
38668
+ const ONLY_NATURALS_ERROR = 'error/ONLY_NATURALS';
38658
38669
  const onlyNaturals = createValidator(ONLY_NATURALS, ONLY_NATURALS_ERROR);
38659
38670
  validatorFns[ONLY_NATURALS] = (value, args, form) => /^(\d+)?$/.test(value);
38660
38671
 
@@ -38667,8 +38678,8 @@ not tested as validation function
38667
38678
  to validate exp date instead use combo of:
38668
38679
  required(), hasLength(), isValidMonth(), dateAfterToday()
38669
38680
  */
38670
- const ONLY_EXPIRATION_DATE = "validator/ONLY_EXPIRATION_DATE";
38671
- const ONLY_EXPIRATION_DATE_ERROR = "error/ONLY_EXPIRATION_DATE";
38681
+ const ONLY_EXPIRATION_DATE = 'validator/ONLY_EXPIRATION_DATE';
38682
+ const ONLY_EXPIRATION_DATE_ERROR = 'error/ONLY_EXPIRATION_DATE';
38672
38683
  const onlyExpirationDate = createValidator(
38673
38684
  ONLY_EXPIRATION_DATE,
38674
38685
  ONLY_EXPIRATION_DATE_ERROR
@@ -38676,64 +38687,63 @@ const onlyExpirationDate = createValidator(
38676
38687
  validatorFns[ONLY_EXPIRATION_DATE] = (value, args, form) =>
38677
38688
  /^(\d?\d?\/?\d?\d?)?$/.test(value);
38678
38689
 
38679
- const NUMBER_LESS_THAN = "validator/NUMBER_LESS_THAN";
38680
- const NUMBER_LESS_THAN_ERROR = "error/NUMBER_LESS_THAN";
38690
+ const NUMBER_LESS_THAN = 'validator/NUMBER_LESS_THAN';
38691
+ const NUMBER_LESS_THAN_ERROR = 'error/NUMBER_LESS_THAN';
38681
38692
  const numberLessThan = createValidator(
38682
38693
  NUMBER_LESS_THAN,
38683
38694
  NUMBER_LESS_THAN_ERROR
38684
38695
  );
38685
38696
  validatorFns[NUMBER_LESS_THAN] = (value, args, form) => {
38686
- if (value === "") {
38697
+ if (value === '') {
38687
38698
  return true;
38688
38699
  }
38689
38700
  return Number(value) < args[0];
38690
38701
  };
38691
38702
 
38692
- const NUMBER_LESS_THAN_OR_EQUAL_TO =
38693
- "validator/NUMBER_LESS_THAN_OR_EQUAL_TO";
38703
+ const NUMBER_LESS_THAN_OR_EQUAL_TO = 'validator/NUMBER_LESS_THAN_OR_EQUAL_TO';
38694
38704
  const NUMBER_LESS_THAN_OR_EQUAL_TO_ERROR =
38695
- "error/NUMBER_LESS_THAN_OR_EQUAL_TO";
38705
+ 'error/NUMBER_LESS_THAN_OR_EQUAL_TO';
38696
38706
  const numberLessThanOrEqualTo = createValidator(
38697
38707
  NUMBER_LESS_THAN_OR_EQUAL_TO,
38698
38708
  NUMBER_LESS_THAN_OR_EQUAL_TO_ERROR
38699
38709
  );
38700
38710
  validatorFns[NUMBER_LESS_THAN_OR_EQUAL_TO] = (value, args, form) => {
38701
- if (value === "") {
38711
+ if (value === '') {
38702
38712
  return true;
38703
38713
  }
38704
38714
  return Number(value) <= args[0];
38705
38715
  };
38706
38716
 
38707
- const NUMBER_GREATER_THAN = "validator/NUMBER_GREATER_THAN";
38708
- const NUMBER_GREATER_THAN_ERROR = "error/NUMBER_GREATER_THAN";
38717
+ const NUMBER_GREATER_THAN = 'validator/NUMBER_GREATER_THAN';
38718
+ const NUMBER_GREATER_THAN_ERROR = 'error/NUMBER_GREATER_THAN';
38709
38719
  const numberGreaterThan = createValidator(
38710
38720
  NUMBER_GREATER_THAN,
38711
38721
  NUMBER_GREATER_THAN_ERROR
38712
38722
  );
38713
38723
  validatorFns[NUMBER_GREATER_THAN] = (value, args, form) => {
38714
- if (value === "") {
38724
+ if (value === '') {
38715
38725
  return true;
38716
38726
  }
38717
38727
  return Number(value) > args[0];
38718
38728
  };
38719
38729
 
38720
38730
  const NUMBER_GREATER_THAN_OR_EQUAL_TO =
38721
- "validator/NUMBER_GREATER_THAN_OR_EQUAL_TO";
38731
+ 'validator/NUMBER_GREATER_THAN_OR_EQUAL_TO';
38722
38732
  const NUMBER_GREATER_THAN_OR_EQUAL_TO_ERROR =
38723
- "error/NUMBER_GREATER_THAN_OR_EQUAL_TO";
38733
+ 'error/NUMBER_GREATER_THAN_OR_EQUAL_TO';
38724
38734
  const numberGreaterThanOrEqualTo = createValidator(
38725
38735
  NUMBER_GREATER_THAN_OR_EQUAL_TO,
38726
38736
  NUMBER_GREATER_THAN_OR_EQUAL_TO_ERROR
38727
38737
  );
38728
38738
  validatorFns[NUMBER_GREATER_THAN_OR_EQUAL_TO] = (value, args, form) => {
38729
- if (value === "") {
38739
+ if (value === '') {
38730
38740
  return true;
38731
38741
  }
38732
38742
  return Number(value) >= args[0];
38733
38743
  };
38734
38744
 
38735
- const MATCHES_FIELD = "validator/MATCHES_FIELD";
38736
- const MATCHES_FIELD_ERROR$1 = "error/MATCHES_FIELD";
38745
+ const MATCHES_FIELD = 'validator/MATCHES_FIELD';
38746
+ const MATCHES_FIELD_ERROR$1 = 'error/MATCHES_FIELD';
38737
38747
  const matchesField = createValidator(MATCHES_FIELD, MATCHES_FIELD_ERROR$1);
38738
38748
  validatorFns[MATCHES_FIELD] = (value, args, form) => {
38739
38749
  const dependentField = form[args[0]];
@@ -38746,7 +38756,7 @@ validatorFns[MATCHES_FIELD] = (value, args, form) => {
38746
38756
  return value === dependentFieldValue;
38747
38757
  };
38748
38758
 
38749
- const validateWhenErrorMessage = type =>
38759
+ const validateWhenErrorMessage = (type) =>
38750
38760
  `${type} was passed to validateWhen, but that validator type does not exist.
38751
38761
  Please check that you are only calling validator creator functions exported from
38752
38762
  redux-freeform in your form config and that you didn't forget to
@@ -38754,25 +38764,21 @@ const validateWhenErrorMessage = type =>
38754
38764
  createFormState). Also make sure you aren't passing validateWhen() to validateWhen
38755
38765
  as the primary validator.`;
38756
38766
 
38757
- const VALIDATE_WHEN = "validator/VALIDATE_WHEN";
38758
- const VALIDATE_WHEN_ERROR = "error/VALIDATE_WHEN";
38759
- const validateWhen = (
38760
- dependentValidator,
38761
- primaryValidator,
38762
- optionalFieldName
38763
- ) => ({
38767
+ const VALIDATE_WHEN = 'validator/VALIDATE_WHEN';
38768
+ const VALIDATE_WHEN_ERROR = 'error/VALIDATE_WHEN';
38769
+ const validateWhen = (dependentValidator, primaryValidator, optionalFieldName) => ({
38764
38770
  type: VALIDATE_WHEN,
38765
38771
  args: [dependentValidator, primaryValidator, optionalFieldName],
38766
- error: dependentValidator.error
38772
+ error: dependentValidator.error,
38767
38773
  });
38768
38774
  validateWhen.error = VALIDATE_WHEN_ERROR;
38769
38775
  validatorFns[VALIDATE_WHEN] = (value, args, form) => {
38770
38776
  const [dependentValidator, primaryValidator, optionalFieldName] = args;
38771
- const dependsOnOtherField = typeof optionalFieldName === "string";
38777
+ const dependsOnOtherField = typeof optionalFieldName === 'string';
38772
38778
 
38773
38779
  if (
38774
38780
  primaryValidator.type === undefined ||
38775
- typeof validatorFns[primaryValidator.type] !== "function"
38781
+ typeof validatorFns[primaryValidator.type] !== 'function'
38776
38782
  ) {
38777
38783
  throw new Error(validateWhenErrorMessage(primaryValidator.type));
38778
38784
  }
@@ -38796,26 +38802,22 @@ validatorFns[VALIDATE_WHEN] = (value, args, form) => {
38796
38802
  );
38797
38803
 
38798
38804
  return primaryPredicatePassed
38799
- ? validatorFns[dependentValidator.type](
38800
- value,
38801
- dependentValidator.args,
38802
- form
38803
- )
38805
+ ? validatorFns[dependentValidator.type](value, dependentValidator.args, form)
38804
38806
  : true;
38805
38807
  };
38806
38808
 
38807
- const validateSumErrorMessage = type =>
38809
+ const validateSumErrorMessage = (type) =>
38808
38810
  `${type} was passed to validateSum, but that validator type does not exist.
38809
38811
  Please check that you are only calling validator creator functions exported from
38810
38812
  redux-freeform in your form config and that you didn't forget to
38811
38813
  invoke the validator creator (you cannot pass the functions themselves to
38812
38814
  createFormState).`;
38813
- const VALIDATE_SUM = "validator/VALIDATE_SUM";
38814
- const VALIDATE_SUM_ERROR = "error/VALIDATE_SUM";
38815
+ const VALIDATE_SUM = 'validator/VALIDATE_SUM';
38816
+ const VALIDATE_SUM_ERROR = 'error/VALIDATE_SUM';
38815
38817
  const validateSum = (validator, fieldNamesArray) => ({
38816
38818
  type: VALIDATE_SUM,
38817
38819
  args: [validator, fieldNamesArray],
38818
- error: validator.error
38820
+ error: validator.error,
38819
38821
  });
38820
38822
  validateSum.error = VALIDATE_SUM_ERROR;
38821
38823
  validatorFns[VALIDATE_SUM] = (value, args, form) => {
@@ -38823,7 +38825,7 @@ validatorFns[VALIDATE_SUM] = (value, args, form) => {
38823
38825
 
38824
38826
  if (
38825
38827
  validator.type === undefined ||
38826
- typeof validatorFns[validator.type] !== "function"
38828
+ typeof validatorFns[validator.type] !== 'function'
38827
38829
  ) {
38828
38830
  throw new Error(validateSumErrorMessage(validator.type));
38829
38831
  }
@@ -38844,37 +38846,35 @@ validatorFns[VALIDATE_SUM] = (value, args, form) => {
38844
38846
  return validatorFns[validator.type](sum, validator.args, form);
38845
38847
  };
38846
38848
 
38847
- const HAS_LENGTH = "validator/HAS_LENGTH";
38848
- const HAS_LENGTH_ERROR = "error/HAS_LENGTH";
38849
+ const HAS_LENGTH = 'validator/HAS_LENGTH';
38850
+ const HAS_LENGTH_ERROR = 'error/HAS_LENGTH';
38849
38851
  const hasLength = createValidator(HAS_LENGTH, HAS_LENGTH_ERROR);
38850
38852
  validatorFns[HAS_LENGTH] = (value, args, form) => {
38851
- if (value === "") {
38853
+ if (value === '') {
38852
38854
  return true;
38853
38855
  }
38854
38856
  const min = args[0];
38855
38857
  const max = args[1];
38856
38858
  if (max == undefined || min == undefined) {
38857
38859
  throw new Error(
38858
- "Max and min need to be defined for hasLength, both or one of them is undefined"
38860
+ 'Max and min need to be defined for hasLength, both or one of them is undefined'
38859
38861
  );
38860
38862
  }
38861
38863
  if (max < min) {
38862
- throw new Error(
38863
- "hasLength validator was passed a min greater than the max"
38864
- );
38864
+ throw new Error('hasLength validator was passed a min greater than the max');
38865
38865
  }
38866
38866
  const valueLength = value.length;
38867
38867
  return max >= valueLength && valueLength >= min;
38868
38868
  };
38869
38869
 
38870
- const DATE_BEFORE_TODAY = "validator/DATE_BEFORE_TODAY";
38871
- const DATE_BEFORE_TODAY_ERROR = "error/DATE_BEFORE_TODAY";
38870
+ const DATE_BEFORE_TODAY = 'validator/DATE_BEFORE_TODAY';
38871
+ const DATE_BEFORE_TODAY_ERROR = 'error/DATE_BEFORE_TODAY';
38872
38872
  const dateBeforeToday = createValidator(
38873
38873
  DATE_BEFORE_TODAY,
38874
38874
  DATE_BEFORE_TODAY_ERROR
38875
38875
  );
38876
38876
  validatorFns[DATE_BEFORE_TODAY] = (value, args, form) => {
38877
- if (value === "") {
38877
+ if (value === '') {
38878
38878
  return true;
38879
38879
  }
38880
38880
  const dateFormat = args[0];
@@ -38883,7 +38883,7 @@ validatorFns[DATE_BEFORE_TODAY] = (value, args, form) => {
38883
38883
 
38884
38884
  if (dateFormat == undefined || unit == undefined) {
38885
38885
  throw new Error(
38886
- "Date format and unit need to be defined for dateBeforeToday, one or both are undefined"
38886
+ 'Date format and unit need to be defined for dateBeforeToday, one or both are undefined'
38887
38887
  );
38888
38888
  }
38889
38889
  const now = dayjs();
@@ -38895,14 +38895,14 @@ validatorFns[DATE_BEFORE_TODAY] = (value, args, form) => {
38895
38895
  return dateValue.isBefore(now, unit);
38896
38896
  };
38897
38897
 
38898
- const DATE_AFTER_TODAY = "validator/DATE_AFTER_TODAY";
38899
- const DATE_AFTER_TODAY_ERROR = "error/DATE_AFTER_TODAY";
38898
+ const DATE_AFTER_TODAY = 'validator/DATE_AFTER_TODAY';
38899
+ const DATE_AFTER_TODAY_ERROR = 'error/DATE_AFTER_TODAY';
38900
38900
  const dateAfterToday = createValidator(
38901
38901
  DATE_AFTER_TODAY,
38902
38902
  DATE_AFTER_TODAY_ERROR
38903
38903
  );
38904
38904
  validatorFns[DATE_AFTER_TODAY] = (value, args, form) => {
38905
- if (value === "") {
38905
+ if (value === '') {
38906
38906
  return true;
38907
38907
  }
38908
38908
  const dateFormat = args[0];
@@ -38911,7 +38911,7 @@ validatorFns[DATE_AFTER_TODAY] = (value, args, form) => {
38911
38911
 
38912
38912
  if (dateFormat == undefined || unit == undefined) {
38913
38913
  throw new Error(
38914
- "Date format and unit need to be defined for dateAfterToday, one or both are undefined"
38914
+ 'Date format and unit need to be defined for dateAfterToday, one or both are undefined'
38915
38915
  );
38916
38916
  }
38917
38917
  const now = dayjs();
@@ -38923,14 +38923,11 @@ validatorFns[DATE_AFTER_TODAY] = (value, args, form) => {
38923
38923
  return dateValue.isAfter(now, unit);
38924
38924
  };
38925
38925
 
38926
- const IS_VALID_MONTH = "validator/IS_VALID_MONTH";
38927
- const IS_VALID_MONTH_ERROR = "error/IS_VALID_MONTH";
38928
- const isValidMonth = createValidator(
38929
- IS_VALID_MONTH,
38930
- IS_VALID_MONTH_ERROR
38931
- );
38926
+ const IS_VALID_MONTH = 'validator/IS_VALID_MONTH';
38927
+ const IS_VALID_MONTH_ERROR = 'error/IS_VALID_MONTH';
38928
+ const isValidMonth = createValidator(IS_VALID_MONTH, IS_VALID_MONTH_ERROR);
38932
38929
  validatorFns[IS_VALID_MONTH] = (value, args, form) => {
38933
- if (value === "") {
38930
+ if (value === '') {
38934
38931
  return true;
38935
38932
  }
38936
38933
  // Function takes one argument representing the character position
@@ -38940,43 +38937,43 @@ validatorFns[IS_VALID_MONTH] = (value, args, form) => {
38940
38937
  // Only works with two digit months (01, 02, 03, etc)
38941
38938
  const monthStartPosition = parseInt(args[0]);
38942
38939
  const monthEndPosition = monthStartPosition + 2;
38943
- if (monthStartPosition === NaN) {
38944
- throw new Error("Month start position has to be a valid integer string");
38940
+ if (isNaN(monthStartPosition)) {
38941
+ throw new Error('Month start position has to be a valid integer string');
38945
38942
  }
38946
38943
  const month = parseInt(value.slice(monthStartPosition, monthEndPosition));
38947
- if (month === NaN) {
38944
+ if (isNaN(month)) {
38948
38945
  return false;
38949
38946
  }
38950
38947
  return month >= 1 && month <= 12;
38951
38948
  };
38952
38949
 
38953
- const MATCHES_REGEX = "validator/MATCHES_REGEX";
38954
- const MATCHES_REGEX_ERROR = "error/MATCHES_REGEX";
38950
+ const MATCHES_REGEX = 'validator/MATCHES_REGEX';
38951
+ const MATCHES_REGEX_ERROR = 'error/MATCHES_REGEX';
38955
38952
  const matchesRegex = createValidator(MATCHES_REGEX, MATCHES_REGEX_ERROR);
38956
38953
  validatorFns[MATCHES_REGEX] = (value, args, form) => {
38957
- if (value === "") {
38954
+ if (value === '') {
38958
38955
  return true;
38959
38956
  }
38960
38957
  return new RegExp(args[0]).test(value); // new RexExp never throws an error, no matter the input
38961
38958
  };
38962
38959
 
38963
38960
  // based on http://www.brainjar.com/js/validation/
38964
- const IS_ROUTING_NUMBER = "validator/IS_ROUTING_NUMBER";
38965
- const IS_ROUTING_NUMBER_ERROR = "error/IS_ROUTING_NUMBER";
38961
+ const IS_ROUTING_NUMBER = 'validator/IS_ROUTING_NUMBER';
38962
+ const IS_ROUTING_NUMBER_ERROR = 'error/IS_ROUTING_NUMBER';
38966
38963
  const isRoutingNumber = createValidator(
38967
38964
  IS_ROUTING_NUMBER,
38968
38965
  IS_ROUTING_NUMBER_ERROR
38969
38966
  );
38970
38967
  validatorFns[IS_ROUTING_NUMBER] = (value, args, form) => {
38971
- if (value === "") {
38968
+ if (value === '') {
38972
38969
  return true;
38973
38970
  }
38974
38971
  if (value.length != 9) {
38975
38972
  return false;
38976
38973
  }
38977
38974
  const sum = value
38978
- .split("")
38979
- .map(ch => parseInt(ch))
38975
+ .split('')
38976
+ .map((ch) => parseInt(ch))
38980
38977
  .reduce((acc, cur, idx) => {
38981
38978
  switch (idx % 3) {
38982
38979
  case 0:
@@ -38990,69 +38987,69 @@ validatorFns[IS_ROUTING_NUMBER] = (value, args, form) => {
38990
38987
  return sum != 0 && sum % 10 == 0;
38991
38988
  };
38992
38989
 
38993
- const HAS_NUMBER = "validator/HAS_NUMBER";
38994
- const HAS_NUMBER_ERROR$1 = "error/HAS_NUMBER";
38990
+ const HAS_NUMBER = 'validator/HAS_NUMBER';
38991
+ const HAS_NUMBER_ERROR$1 = 'error/HAS_NUMBER';
38995
38992
  const hasNumber = createValidator(HAS_NUMBER, HAS_NUMBER_ERROR$1);
38996
38993
  validatorFns[HAS_NUMBER] = (value, args, form) => {
38997
- if (value === "") {
38994
+ if (value === '') {
38998
38995
  return true;
38999
38996
  }
39000
38997
  return new RegExp(/[0-9]/).test(value);
39001
38998
  };
39002
38999
 
39003
- const HAS_LOWERCASE_LETTER = "validator/HAS_LOWERCASE_LETTER";
39004
- const HAS_LOWERCASE_LETTER_ERROR$1 = "error/HAS_LOWERCASE_LETTER";
39000
+ const HAS_LOWERCASE_LETTER = 'validator/HAS_LOWERCASE_LETTER';
39001
+ const HAS_LOWERCASE_LETTER_ERROR$1 = 'error/HAS_LOWERCASE_LETTER';
39005
39002
  const hasLowercaseLetter = createValidator(
39006
39003
  HAS_LOWERCASE_LETTER,
39007
39004
  HAS_LOWERCASE_LETTER_ERROR$1
39008
39005
  );
39009
39006
  validatorFns[HAS_LOWERCASE_LETTER] = (value, args, form) => {
39010
- if (value === "") {
39007
+ if (value === '') {
39011
39008
  return true;
39012
39009
  }
39013
39010
  return new RegExp(/[a-z]/).test(value);
39014
39011
  };
39015
39012
 
39016
- const HAS_UPPERCASE_LETTER = "validator/HAS_UPPERCASE_LETTER";
39017
- const HAS_UPPERCASE_LETTER_ERROR$1 = "error/HAS_UPPERCASE_LETTER";
39013
+ const HAS_UPPERCASE_LETTER = 'validator/HAS_UPPERCASE_LETTER';
39014
+ const HAS_UPPERCASE_LETTER_ERROR$1 = 'error/HAS_UPPERCASE_LETTER';
39018
39015
  const hasUppercaseLetter = createValidator(
39019
39016
  HAS_UPPERCASE_LETTER,
39020
39017
  HAS_UPPERCASE_LETTER_ERROR$1
39021
39018
  );
39022
39019
  validatorFns[HAS_UPPERCASE_LETTER] = (value, args, form) => {
39023
- if (value === "") {
39020
+ if (value === '') {
39024
39021
  return true;
39025
39022
  }
39026
39023
  return new RegExp(/[A-Z]/).test(value);
39027
39024
  };
39028
39025
 
39029
- const HAS_SPECIAL_CHARACTER = "validator/HAS_SPECIAL_CHARACTER";
39030
- const HAS_SPECIAL_CHARACTER_ERROR$1 = "error/HAS_SPECIAL_CHARACTER";
39026
+ const HAS_SPECIAL_CHARACTER = 'validator/HAS_SPECIAL_CHARACTER';
39027
+ const HAS_SPECIAL_CHARACTER_ERROR$1 = 'error/HAS_SPECIAL_CHARACTER';
39031
39028
  const hasSpecialCharacter = createValidator(
39032
39029
  HAS_SPECIAL_CHARACTER,
39033
39030
  HAS_SPECIAL_CHARACTER_ERROR$1
39034
39031
  );
39035
39032
  validatorFns[HAS_SPECIAL_CHARACTER] = (value, args, form) => {
39036
- if (value === "") {
39033
+ if (value === '') {
39037
39034
  return true;
39038
39035
  }
39039
39036
  return new RegExp(/[!@#$%^&*.?]/).test(value);
39040
39037
  };
39041
39038
 
39042
- const IS_PROBABLY_EMAIL = "validator/IS_PROBABLY_EMAIL";
39043
- const IS_PROBABLY_EMAIL_ERROR = "error/IS_PROBABLY_EMAIL";
39039
+ const IS_PROBABLY_EMAIL = 'validator/IS_PROBABLY_EMAIL';
39040
+ const IS_PROBABLY_EMAIL_ERROR = 'error/IS_PROBABLY_EMAIL';
39044
39041
  const isProbablyEmail = createValidator(
39045
39042
  IS_PROBABLY_EMAIL,
39046
39043
  IS_PROBABLY_EMAIL_ERROR
39047
39044
  );
39048
39045
  validatorFns[IS_PROBABLY_EMAIL] = (value, args, form) => {
39049
- if (value === "") {
39046
+ if (value === '') {
39050
39047
  return true;
39051
39048
  }
39052
39049
  return new RegExp(/^\S+@\S+\.\S+$/).test(value);
39053
39050
  };
39054
39051
 
39055
- const runValidatorErrorMessage = type =>
39052
+ const runValidatorErrorMessage = (type) =>
39056
39053
  `${type} was passed to runValidator, but that validator type does not exist.
39057
39054
  Please check that you are only calling validator creator functions exported from
39058
39055
  redux-freeform in your form config and that you didn't forget to
@@ -39067,1165 +39064,53 @@ const runValidator = (validator, value, form) => {
39067
39064
  return validatorFn(value, validator.args, form) ? null : validator.error;
39068
39065
  };
39069
39066
 
39070
- const _computeErrors = (fieldName, form, validators) => {
39067
+ const runFormValidators = (fieldName, form, validators) => {
39071
39068
  return validators
39072
- .map(v => runValidator(v, form[fieldName].rawValue, form))
39073
- .filter(x => x !== null);
39069
+ .map((v) => runValidator(v, form[fieldName].rawValue, form))
39070
+ .filter((x) => x !== null);
39074
39071
  };
39075
39072
 
39076
39073
  const computeConstraints = (fieldName, form) => {
39077
39074
  const constraints = form[fieldName].constraints;
39078
- return _computeErrors(fieldName, form, constraints);
39075
+ return runFormValidators(fieldName, form, constraints);
39079
39076
  };
39080
39077
 
39081
39078
  const computeErrors = (fieldName, form) => {
39082
39079
  const validators = form[fieldName].validators;
39083
- return _computeErrors(fieldName, form, validators);
39084
- };
39085
-
39086
- var obj;
39087
- var NOTHING = typeof Symbol !== "undefined" ? Symbol("immer-nothing") : ( obj = {}, obj["immer-nothing"] = true, obj );
39088
- var DRAFTABLE = typeof Symbol !== "undefined" && Symbol.for ? Symbol.for("immer-draftable") : "__$immer_draftable";
39089
- var DRAFT_STATE = typeof Symbol !== "undefined" && Symbol.for ? Symbol.for("immer-state") : "__$immer_state";
39090
- function isDraft(value) {
39091
- return !!value && !!value[DRAFT_STATE];
39092
- }
39093
- function isDraftable(value) {
39094
- if (!value) { return false; }
39095
- return isPlainObject(value) || !!value[DRAFTABLE] || !!value.constructor[DRAFTABLE];
39096
- }
39097
- function isPlainObject(value) {
39098
- if (!value || typeof value !== "object") { return false; }
39099
- if (Array.isArray(value)) { return true; }
39100
- var proto = Object.getPrototypeOf(value);
39101
- return !proto || proto === Object.prototype;
39102
- }
39103
- var assign = Object.assign || function assign(target, value) {
39104
- for (var key in value) {
39105
- if (has$1(value, key)) {
39106
- target[key] = value[key];
39107
- }
39108
- }
39109
-
39110
- return target;
39111
- };
39112
- var ownKeys$2 = typeof Reflect !== "undefined" && Reflect.ownKeys ? Reflect.ownKeys : typeof Object.getOwnPropertySymbols !== "undefined" ? function (obj) { return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj)); } : Object.getOwnPropertyNames;
39113
- function shallowCopy(base, invokeGetters) {
39114
- if ( invokeGetters === void 0 ) invokeGetters = false;
39115
-
39116
- if (Array.isArray(base)) { return base.slice(); }
39117
- var clone = Object.create(Object.getPrototypeOf(base));
39118
- ownKeys$2(base).forEach(function (key) {
39119
- if (key === DRAFT_STATE) {
39120
- return; // Never copy over draft state.
39121
- }
39122
-
39123
- var desc = Object.getOwnPropertyDescriptor(base, key);
39124
- var value = desc.value;
39125
-
39126
- if (desc.get) {
39127
- if (!invokeGetters) {
39128
- throw new Error("Immer drafts cannot have computed properties");
39129
- }
39130
-
39131
- value = desc.get.call(base);
39132
- }
39133
-
39134
- if (desc.enumerable) {
39135
- clone[key] = value;
39136
- } else {
39137
- Object.defineProperty(clone, key, {
39138
- value: value,
39139
- writable: true,
39140
- configurable: true
39141
- });
39142
- }
39143
- });
39144
- return clone;
39145
- }
39146
- function each(value, cb) {
39147
- if (Array.isArray(value)) {
39148
- for (var i = 0; i < value.length; i++) { cb(i, value[i], value); }
39149
- } else {
39150
- ownKeys$2(value).forEach(function (key) { return cb(key, value[key], value); });
39151
- }
39152
- }
39153
- function isEnumerable(base, prop) {
39154
- var desc = Object.getOwnPropertyDescriptor(base, prop);
39155
- return !!desc && desc.enumerable;
39156
- }
39157
- function has$1(thing, prop) {
39158
- return Object.prototype.hasOwnProperty.call(thing, prop);
39159
- }
39160
- function is(x, y) {
39161
- // From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js
39162
- if (x === y) {
39163
- return x !== 0 || 1 / x === 1 / y;
39164
- } else {
39165
- return x !== x && y !== y;
39166
- }
39167
- }
39168
- function clone(obj) {
39169
- if (!isDraftable(obj)) { return obj; }
39170
- if (Array.isArray(obj)) { return obj.map(clone); }
39171
- var cloned = Object.create(Object.getPrototypeOf(obj));
39172
-
39173
- for (var key in obj) { cloned[key] = clone(obj[key]); }
39174
-
39175
- return cloned;
39176
- }
39177
-
39178
- /** Each scope represents a `produce` call. */
39179
-
39180
- var ImmerScope = function ImmerScope(parent) {
39181
- this.drafts = [];
39182
- this.parent = parent; // Whenever the modified draft contains a draft from another scope, we
39183
- // need to prevent auto-freezing so the unowned draft can be finalized.
39184
-
39185
- this.canAutoFreeze = true; // To avoid prototype lookups:
39186
-
39187
- this.patches = null;
39188
- };
39189
-
39190
- ImmerScope.prototype.usePatches = function usePatches (patchListener) {
39191
- if (patchListener) {
39192
- this.patches = [];
39193
- this.inversePatches = [];
39194
- this.patchListener = patchListener;
39195
- }
39196
- };
39197
-
39198
- ImmerScope.prototype.revoke = function revoke$1 () {
39199
- this.leave();
39200
- this.drafts.forEach(revoke);
39201
- this.drafts = null; // Make draft-related methods throw.
39202
- };
39203
-
39204
- ImmerScope.prototype.leave = function leave () {
39205
- if (this === ImmerScope.current) {
39206
- ImmerScope.current = this.parent;
39207
- }
39208
- };
39209
- ImmerScope.current = null;
39210
-
39211
- ImmerScope.enter = function () {
39212
- return this.current = new ImmerScope(this.current);
39213
- };
39214
-
39215
- function revoke(draft) {
39216
- draft[DRAFT_STATE].revoke();
39217
- }
39218
-
39219
- // but share them all instead
39220
-
39221
- var descriptors$1 = {};
39222
- function willFinalize(scope, result, isReplaced) {
39223
- scope.drafts.forEach(function (draft) {
39224
- draft[DRAFT_STATE].finalizing = true;
39225
- });
39226
-
39227
- if (!isReplaced) {
39228
- if (scope.patches) {
39229
- markChangesRecursively(scope.drafts[0]);
39230
- } // This is faster when we don't care about which attributes changed.
39231
-
39232
-
39233
- markChangesSweep(scope.drafts);
39234
- } // When a child draft is returned, look for changes.
39235
- else if (isDraft(result) && result[DRAFT_STATE].scope === scope) {
39236
- markChangesSweep(scope.drafts);
39237
- }
39238
- }
39239
- function createProxy(base, parent) {
39240
- var isArray = Array.isArray(base);
39241
- var draft = clonePotentialDraft(base);
39242
- each(draft, function (prop) {
39243
- proxyProperty(draft, prop, isArray || isEnumerable(base, prop));
39244
- }); // See "proxy.js" for property documentation.
39245
-
39246
- var scope = parent ? parent.scope : ImmerScope.current;
39247
- var state = {
39248
- scope: scope,
39249
- modified: false,
39250
- finalizing: false,
39251
- // es5 only
39252
- finalized: false,
39253
- assigned: {},
39254
- parent: parent,
39255
- base: base,
39256
- draft: draft,
39257
- copy: null,
39258
- revoke: revoke$1,
39259
- revoked: false // es5 only
39260
-
39261
- };
39262
- createHiddenProperty(draft, DRAFT_STATE, state);
39263
- scope.drafts.push(draft);
39264
- return draft;
39265
- }
39266
-
39267
- function revoke$1() {
39268
- this.revoked = true;
39269
- }
39270
-
39271
- function source(state) {
39272
- return state.copy || state.base;
39273
- } // Access a property without creating an Immer draft.
39274
-
39275
-
39276
- function peek(draft, prop) {
39277
- var state = draft[DRAFT_STATE];
39278
-
39279
- if (state && !state.finalizing) {
39280
- state.finalizing = true;
39281
- var value = draft[prop];
39282
- state.finalizing = false;
39283
- return value;
39284
- }
39285
-
39286
- return draft[prop];
39287
- }
39288
-
39289
- function get$1(state, prop) {
39290
- assertUnrevoked(state);
39291
- var value = peek(source(state), prop);
39292
- if (state.finalizing) { return value; } // Create a draft if the value is unmodified.
39293
-
39294
- if (value === peek(state.base, prop) && isDraftable(value)) {
39295
- prepareCopy(state);
39296
- return state.copy[prop] = createProxy(value, state);
39297
- }
39298
-
39299
- return value;
39300
- }
39301
-
39302
- function set$1(state, prop, value) {
39303
- assertUnrevoked(state);
39304
- state.assigned[prop] = true;
39305
-
39306
- if (!state.modified) {
39307
- if (is(value, peek(source(state), prop))) { return; }
39308
- markChanged(state);
39309
- prepareCopy(state);
39310
- }
39311
-
39312
- state.copy[prop] = value;
39313
- }
39314
-
39315
- function markChanged(state) {
39316
- if (!state.modified) {
39317
- state.modified = true;
39318
- if (state.parent) { markChanged(state.parent); }
39319
- }
39320
- }
39321
-
39322
- function prepareCopy(state) {
39323
- if (!state.copy) { state.copy = clonePotentialDraft(state.base); }
39324
- }
39325
-
39326
- function clonePotentialDraft(base) {
39327
- var state = base && base[DRAFT_STATE];
39328
-
39329
- if (state) {
39330
- state.finalizing = true;
39331
- var draft = shallowCopy(state.draft, true);
39332
- state.finalizing = false;
39333
- return draft;
39334
- }
39335
-
39336
- return shallowCopy(base);
39337
- }
39338
-
39339
- function proxyProperty(draft, prop, enumerable) {
39340
- var desc = descriptors$1[prop];
39341
-
39342
- if (desc) {
39343
- desc.enumerable = enumerable;
39344
- } else {
39345
- descriptors$1[prop] = desc = {
39346
- configurable: true,
39347
- enumerable: enumerable,
39348
-
39349
- get: function get$1$1() {
39350
- return get$1(this[DRAFT_STATE], prop);
39351
- },
39352
-
39353
- set: function set$1$1(value) {
39354
- set$1(this[DRAFT_STATE], prop, value);
39355
- }
39356
-
39357
- };
39358
- }
39359
-
39360
- Object.defineProperty(draft, prop, desc);
39361
- }
39362
-
39363
- function assertUnrevoked(state) {
39364
- 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))); }
39365
- } // This looks expensive, but only proxies are visited, and only objects without known changes are scanned.
39366
-
39367
-
39368
- function markChangesSweep(drafts) {
39369
- // The natural order of drafts in the `scope` array is based on when they
39370
- // were accessed. By processing drafts in reverse natural order, we have a
39371
- // better chance of processing leaf nodes first. When a leaf node is known to
39372
- // have changed, we can avoid any traversal of its ancestor nodes.
39373
- for (var i = drafts.length - 1; i >= 0; i--) {
39374
- var state = drafts[i][DRAFT_STATE];
39375
-
39376
- if (!state.modified) {
39377
- if (Array.isArray(state.base)) {
39378
- if (hasArrayChanges(state)) { markChanged(state); }
39379
- } else if (hasObjectChanges(state)) { markChanged(state); }
39380
- }
39381
- }
39382
- }
39383
-
39384
- function markChangesRecursively(object) {
39385
- if (!object || typeof object !== "object") { return; }
39386
- var state = object[DRAFT_STATE];
39387
- if (!state) { return; }
39388
- var base = state.base;
39389
- var draft = state.draft;
39390
- var assigned = state.assigned;
39391
-
39392
- if (!Array.isArray(object)) {
39393
- // Look for added keys.
39394
- Object.keys(draft).forEach(function (key) {
39395
- // The `undefined` check is a fast path for pre-existing keys.
39396
- if (base[key] === undefined && !has$1(base, key)) {
39397
- assigned[key] = true;
39398
- markChanged(state);
39399
- } else if (!assigned[key]) {
39400
- // Only untouched properties trigger recursion.
39401
- markChangesRecursively(draft[key]);
39402
- }
39403
- }); // Look for removed keys.
39404
-
39405
- Object.keys(base).forEach(function (key) {
39406
- // The `undefined` check is a fast path for pre-existing keys.
39407
- if (draft[key] === undefined && !has$1(draft, key)) {
39408
- assigned[key] = false;
39409
- markChanged(state);
39410
- }
39411
- });
39412
- } else if (hasArrayChanges(state)) {
39413
- markChanged(state);
39414
- assigned.length = true;
39415
-
39416
- if (draft.length < base.length) {
39417
- for (var i = draft.length; i < base.length; i++) { assigned[i] = false; }
39418
- } else {
39419
- for (var i$1 = base.length; i$1 < draft.length; i$1++) { assigned[i$1] = true; }
39420
- }
39421
-
39422
- for (var i$2 = 0; i$2 < draft.length; i$2++) {
39423
- // Only untouched indices trigger recursion.
39424
- if (assigned[i$2] === undefined) { markChangesRecursively(draft[i$2]); }
39425
- }
39426
- }
39427
- }
39428
-
39429
- function hasObjectChanges(state) {
39430
- var base = state.base;
39431
- var draft = state.draft; // Search for added keys and changed keys. Start at the back, because
39432
- // non-numeric keys are ordered by time of definition on the object.
39433
-
39434
- var keys = Object.keys(draft);
39435
-
39436
- for (var i = keys.length - 1; i >= 0; i--) {
39437
- var key = keys[i];
39438
- var baseValue = base[key]; // The `undefined` check is a fast path for pre-existing keys.
39439
-
39440
- if (baseValue === undefined && !has$1(base, key)) {
39441
- return true;
39442
- } // Once a base key is deleted, future changes go undetected, because its
39443
- // descriptor is erased. This branch detects any missed changes.
39444
- else {
39445
- var value = draft[key];
39446
- var state$1 = value && value[DRAFT_STATE];
39447
-
39448
- if (state$1 ? state$1.base !== baseValue : !is(value, baseValue)) {
39449
- return true;
39450
- }
39451
- }
39452
- } // At this point, no keys were added or changed.
39453
- // Compare key count to determine if keys were deleted.
39454
-
39455
-
39456
- return keys.length !== Object.keys(base).length;
39457
- }
39458
-
39459
- function hasArrayChanges(state) {
39460
- var draft = state.draft;
39461
- if (draft.length !== state.base.length) { return true; } // See #116
39462
- // If we first shorten the length, our array interceptors will be removed.
39463
- // If after that new items are added, result in the same original length,
39464
- // those last items will have no intercepting property.
39465
- // So if there is no own descriptor on the last position, we know that items were removed and added
39466
- // N.B.: splice, unshift, etc only shift values around, but not prop descriptors, so we only have to check
39467
- // the last one
39468
-
39469
- var descriptor = Object.getOwnPropertyDescriptor(draft, draft.length - 1); // descriptor can be null, but only for newly created sparse arrays, eg. new Array(10)
39470
-
39471
- 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
39472
-
39473
- return false;
39474
- }
39475
-
39476
- function createHiddenProperty(target, prop, value) {
39477
- Object.defineProperty(target, prop, {
39478
- value: value,
39479
- enumerable: false,
39480
- writable: true
39481
- });
39482
- }
39483
-
39484
- var legacyProxy = /*#__PURE__*/Object.freeze({
39485
- willFinalize: willFinalize,
39486
- createProxy: createProxy
39487
- });
39488
-
39489
- function willFinalize$1() {}
39490
- function createProxy$1(base, parent) {
39491
- var scope = parent ? parent.scope : ImmerScope.current;
39492
- var state = {
39493
- // Track which produce call this is associated with.
39494
- scope: scope,
39495
- // True for both shallow and deep changes.
39496
- modified: false,
39497
- // Used during finalization.
39498
- finalized: false,
39499
- // Track which properties have been assigned (true) or deleted (false).
39500
- assigned: {},
39501
- // The parent draft state.
39502
- parent: parent,
39503
- // The base state.
39504
- base: base,
39505
- // The base proxy.
39506
- draft: null,
39507
- // Any property proxies.
39508
- drafts: {},
39509
- // The base copy with any updated values.
39510
- copy: null,
39511
- // Called by the `produce` function.
39512
- revoke: null
39513
- };
39514
- var ref = Array.isArray(base) ? // [state] is used for arrays, to make sure the proxy is array-ish and not violate invariants,
39515
- // although state itself is an object
39516
- Proxy.revocable([state], arrayTraps) : Proxy.revocable(state, objectTraps);
39517
- var revoke = ref.revoke;
39518
- var proxy = ref.proxy;
39519
- state.draft = proxy;
39520
- state.revoke = revoke;
39521
- scope.drafts.push(proxy);
39522
- return proxy;
39523
- }
39524
- var objectTraps = {
39525
- get: get$1$1,
39526
-
39527
- has: function has(target, prop) {
39528
- return prop in source$1(target);
39529
- },
39530
-
39531
- ownKeys: function ownKeys(target) {
39532
- return Reflect.ownKeys(source$1(target));
39533
- },
39534
-
39535
- set: set$1$1,
39536
- deleteProperty: deleteProperty,
39537
- getOwnPropertyDescriptor: getOwnPropertyDescriptor$2,
39538
-
39539
- defineProperty: function defineProperty() {
39540
- throw new Error("Object.defineProperty() cannot be used on an Immer draft"); // prettier-ignore
39541
- },
39542
-
39543
- getPrototypeOf: function getPrototypeOf(target) {
39544
- return Object.getPrototypeOf(target.base);
39545
- },
39546
-
39547
- setPrototypeOf: function setPrototypeOf() {
39548
- throw new Error("Object.setPrototypeOf() cannot be used on an Immer draft"); // prettier-ignore
39549
- }
39550
-
39551
- };
39552
- var arrayTraps = {};
39553
- each(objectTraps, function (key, fn) {
39554
- arrayTraps[key] = function () {
39555
- arguments[0] = arguments[0][0];
39556
- return fn.apply(this, arguments);
39557
- };
39558
- });
39559
-
39560
- arrayTraps.deleteProperty = function (state, prop) {
39561
- if (isNaN(parseInt(prop))) {
39562
- throw new Error("Immer only supports deleting array indices"); // prettier-ignore
39563
- }
39564
-
39565
- return objectTraps.deleteProperty.call(this, state[0], prop);
39566
- };
39567
-
39568
- arrayTraps.set = function (state, prop, value) {
39569
- if (prop !== "length" && isNaN(parseInt(prop))) {
39570
- throw new Error("Immer only supports setting array indices and the 'length' property"); // prettier-ignore
39571
- }
39572
-
39573
- return objectTraps.set.call(this, state[0], prop, value);
39574
- }; // returns the object we should be reading the current value from, which is base, until some change has been made
39575
-
39576
-
39577
- function source$1(state) {
39578
- return state.copy || state.base;
39579
- } // Access a property without creating an Immer draft.
39580
-
39581
-
39582
- function peek$1(draft, prop) {
39583
- var state = draft[DRAFT_STATE];
39584
- var desc = Reflect.getOwnPropertyDescriptor(state ? source$1(state) : draft, prop);
39585
- return desc && desc.value;
39586
- }
39587
-
39588
- function get$1$1(state, prop) {
39589
- if (prop === DRAFT_STATE) { return state; }
39590
- var drafts = state.drafts; // Check for existing draft in unmodified state.
39591
-
39592
- if (!state.modified && has$1(drafts, prop)) {
39593
- return drafts[prop];
39594
- }
39595
-
39596
- var value = source$1(state)[prop];
39597
-
39598
- if (state.finalized || !isDraftable(value)) {
39599
- return value;
39600
- } // Check for existing draft in modified state.
39601
-
39602
-
39603
- if (state.modified) {
39604
- // Assigned values are never drafted. This catches any drafts we created, too.
39605
- if (value !== peek$1(state.base, prop)) { return value; } // Store drafts on the copy (when one exists).
39606
-
39607
- drafts = state.copy;
39608
- }
39609
-
39610
- return drafts[prop] = createProxy$1(value, state);
39611
- }
39612
-
39613
- function set$1$1(state, prop, value) {
39614
- if (!state.modified) {
39615
- var baseValue = peek$1(state.base, prop); // Optimize based on value's truthiness. Truthy values are guaranteed to
39616
- // never be undefined, so we can avoid the `in` operator. Lastly, truthy
39617
- // values may be drafts, but falsy values are never drafts.
39618
-
39619
- var isUnchanged = value ? is(baseValue, value) || value === state.drafts[prop] : is(baseValue, value) && prop in state.base;
39620
- if (isUnchanged) { return true; }
39621
- markChanged$1(state);
39622
- }
39623
-
39624
- state.assigned[prop] = true;
39625
- state.copy[prop] = value;
39626
- return true;
39627
- }
39628
-
39629
- function deleteProperty(state, prop) {
39630
- // The `undefined` check is a fast path for pre-existing keys.
39631
- if (peek$1(state.base, prop) !== undefined || prop in state.base) {
39632
- state.assigned[prop] = false;
39633
- markChanged$1(state);
39634
- } else if (state.assigned[prop]) {
39635
- // if an originally not assigned property was deleted
39636
- delete state.assigned[prop];
39637
- }
39638
-
39639
- if (state.copy) { delete state.copy[prop]; }
39640
- return true;
39641
- } // Note: We never coerce `desc.value` into an Immer draft, because we can't make
39642
- // the same guarantee in ES5 mode.
39643
-
39644
-
39645
- function getOwnPropertyDescriptor$2(state, prop) {
39646
- var owner = source$1(state);
39647
- var desc = Reflect.getOwnPropertyDescriptor(owner, prop);
39648
-
39649
- if (desc) {
39650
- desc.writable = true;
39651
- desc.configurable = !Array.isArray(owner) || prop !== "length";
39652
- }
39653
-
39654
- return desc;
39655
- }
39656
-
39657
- function markChanged$1(state) {
39658
- if (!state.modified) {
39659
- state.modified = true;
39660
- state.copy = assign(shallowCopy(state.base), state.drafts);
39661
- state.drafts = null;
39662
- if (state.parent) { markChanged$1(state.parent); }
39663
- }
39664
- }
39665
-
39666
- var modernProxy = /*#__PURE__*/Object.freeze({
39667
- willFinalize: willFinalize$1,
39668
- createProxy: createProxy$1
39669
- });
39670
-
39671
- function generatePatches(state, basePath, patches, inversePatches) {
39672
- Array.isArray(state.base) ? generateArrayPatches(state, basePath, patches, inversePatches) : generateObjectPatches(state, basePath, patches, inversePatches);
39673
- }
39674
-
39675
- function generateArrayPatches(state, basePath, patches, inversePatches) {
39676
- var assign, assign$1;
39677
-
39678
- var base = state.base;
39679
- var copy = state.copy;
39680
- var assigned = state.assigned; // Reduce complexity by ensuring `base` is never longer.
39681
-
39682
- if (copy.length < base.length) {
39683
- (assign = [copy, base], base = assign[0], copy = assign[1]);
39684
- (assign$1 = [inversePatches, patches], patches = assign$1[0], inversePatches = assign$1[1]);
39685
- }
39686
-
39687
- var delta = copy.length - base.length; // Find the first replaced index.
39688
-
39689
- var start = 0;
39690
-
39691
- while (base[start] === copy[start] && start < base.length) {
39692
- ++start;
39693
- } // Find the last replaced index. Search from the end to optimize splice patches.
39694
-
39695
-
39696
- var end = base.length;
39697
-
39698
- while (end > start && base[end - 1] === copy[end + delta - 1]) {
39699
- --end;
39700
- } // Process replaced indices.
39701
-
39702
-
39703
- for (var i = start; i < end; ++i) {
39704
- if (assigned[i] && copy[i] !== base[i]) {
39705
- var path = basePath.concat([i]);
39706
- patches.push({
39707
- op: "replace",
39708
- path: path,
39709
- value: copy[i]
39710
- });
39711
- inversePatches.push({
39712
- op: "replace",
39713
- path: path,
39714
- value: base[i]
39715
- });
39716
- }
39717
- }
39718
-
39719
- var replaceCount = patches.length; // Process added indices.
39720
-
39721
- for (var i$1 = end + delta - 1; i$1 >= end; --i$1) {
39722
- var path$1 = basePath.concat([i$1]);
39723
- patches[replaceCount + i$1 - end] = {
39724
- op: "add",
39725
- path: path$1,
39726
- value: copy[i$1]
39727
- };
39728
- inversePatches.push({
39729
- op: "remove",
39730
- path: path$1
39731
- });
39732
- }
39733
- }
39734
-
39735
- function generateObjectPatches(state, basePath, patches, inversePatches) {
39736
- var base = state.base;
39737
- var copy = state.copy;
39738
- each(state.assigned, function (key, assignedValue) {
39739
- var origValue = base[key];
39740
- var value = copy[key];
39741
- var op = !assignedValue ? "remove" : key in base ? "replace" : "add";
39742
- if (origValue === value && op === "replace") { return; }
39743
- var path = basePath.concat(key);
39744
- patches.push(op === "remove" ? {
39745
- op: op,
39746
- path: path
39747
- } : {
39748
- op: op,
39749
- path: path,
39750
- value: value
39751
- });
39752
- inversePatches.push(op === "add" ? {
39753
- op: "remove",
39754
- path: path
39755
- } : op === "remove" ? {
39756
- op: "add",
39757
- path: path,
39758
- value: origValue
39759
- } : {
39760
- op: "replace",
39761
- path: path,
39762
- value: origValue
39763
- });
39764
- });
39765
- }
39766
-
39767
- var applyPatches = function (draft, patches) {
39768
- for (var i$1 = 0, list = patches; i$1 < list.length; i$1 += 1) {
39769
- var patch = list[i$1];
39770
-
39771
- var path = patch.path;
39772
- var op = patch.op;
39773
- var value = clone(patch.value); // used to clone patch to ensure original patch is not modified, see #411
39774
-
39775
- if (!path.length) { throw new Error("Illegal state"); }
39776
- var base = draft;
39777
-
39778
- for (var i = 0; i < path.length - 1; i++) {
39779
- base = base[path[i]];
39780
- if (!base || typeof base !== "object") { throw new Error("Cannot apply patch, path doesn't resolve: " + path.join("/")); } // prettier-ignore
39781
- }
39782
-
39783
- var key = path[path.length - 1];
39784
-
39785
- switch (op) {
39786
- case "replace":
39787
- // if value is an object, then it's assigned by reference
39788
- // in the following add or remove ops, the value field inside the patch will also be modifyed
39789
- // so we use value from the cloned patch
39790
- base[key] = value;
39791
- break;
39792
-
39793
- case "add":
39794
- if (Array.isArray(base)) {
39795
- // TODO: support "foo/-" paths for appending to an array
39796
- base.splice(key, 0, value);
39797
- } else {
39798
- base[key] = value;
39799
- }
39800
-
39801
- break;
39802
-
39803
- case "remove":
39804
- if (Array.isArray(base)) {
39805
- base.splice(key, 1);
39806
- } else {
39807
- delete base[key];
39808
- }
39809
-
39810
- break;
39811
-
39812
- default:
39813
- throw new Error("Unsupported patch operation: " + op);
39814
- }
39815
- }
39816
-
39817
- return draft;
39818
- };
39819
-
39820
- function verifyMinified() {}
39821
-
39822
- var configDefaults = {
39823
- useProxies: typeof Proxy !== "undefined" && typeof Reflect !== "undefined",
39824
- autoFreeze: typeof process !== "undefined" ? process.env.NODE_ENV !== "production" : verifyMinified.name === "verifyMinified",
39825
- onAssign: null,
39826
- onDelete: null,
39827
- onCopy: null
39828
- };
39829
- var Immer = function Immer(config) {
39830
- assign(this, configDefaults, config);
39831
- this.setUseProxies(this.useProxies);
39832
- this.produce = this.produce.bind(this);
39833
- };
39834
-
39835
- Immer.prototype.produce = function produce (base, recipe, patchListener) {
39836
- var this$1$1 = this;
39837
-
39838
- // curried invocation
39839
- if (typeof base === "function" && typeof recipe !== "function") {
39840
- var defaultBase = recipe;
39841
- recipe = base;
39842
- var self = this;
39843
- return function curriedProduce(base) {
39844
- var this$1$1 = this;
39845
- if ( base === void 0 ) base = defaultBase;
39846
- var args = [], len = arguments.length - 1;
39847
- while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
39848
-
39849
- return self.produce(base, function (draft) { return recipe.call.apply(recipe, [ this$1$1, draft ].concat( args )); }); // prettier-ignore
39850
- };
39851
- } // prettier-ignore
39852
-
39853
-
39854
- {
39855
- if (typeof recipe !== "function") {
39856
- throw new Error("The first or second argument to `produce` must be a function");
39857
- }
39858
-
39859
- if (patchListener !== undefined && typeof patchListener !== "function") {
39860
- throw new Error("The third argument to `produce` must be a function or undefined");
39861
- }
39862
- }
39863
- var result; // Only plain objects, arrays, and "immerable classes" are drafted.
39864
-
39865
- if (isDraftable(base)) {
39866
- var scope = ImmerScope.enter();
39867
- var proxy = this.createProxy(base);
39868
- var hasError = true;
39869
-
39870
- try {
39871
- result = recipe(proxy);
39872
- hasError = false;
39873
- } finally {
39874
- // finally instead of catch + rethrow better preserves original stack
39875
- if (hasError) { scope.revoke(); }else { scope.leave(); }
39876
- }
39877
-
39878
- if (result instanceof Promise) {
39879
- return result.then(function (result) {
39880
- scope.usePatches(patchListener);
39881
- return this$1$1.processResult(result, scope);
39882
- }, function (error) {
39883
- scope.revoke();
39884
- throw error;
39885
- });
39886
- }
39887
-
39888
- scope.usePatches(patchListener);
39889
- return this.processResult(result, scope);
39890
- } else {
39891
- result = recipe(base);
39892
- if (result === undefined) { return base; }
39893
- return result !== NOTHING ? result : undefined;
39894
- }
39895
- };
39896
-
39897
- Immer.prototype.produceWithPatches = function produceWithPatches (arg1, arg2, arg3) {
39898
- var this$1$1 = this;
39899
-
39900
- if (typeof arg1 === "function") {
39901
- return function (state) {
39902
- var args = [], len = arguments.length - 1;
39903
- while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
39904
-
39905
- return this$1$1.produceWithPatches(state, function (draft) { return arg1.apply(void 0, [ draft ].concat( args )); });
39906
- };
39907
- } // non-curried form
39908
-
39909
-
39910
- if (arg3) { throw new Error("A patch listener cannot be passed to produceWithPatches"); }
39911
- var patches, inversePatches;
39912
- var nextState = this.produce(arg1, arg2, function (p, ip) {
39913
- patches = p;
39914
- inversePatches = ip;
39915
- });
39916
- return [nextState, patches, inversePatches];
39917
- };
39918
-
39919
- Immer.prototype.createDraft = function createDraft (base) {
39920
- if (!isDraftable(base)) {
39921
- throw new Error("First argument to `createDraft` must be a plain object, an array, or an immerable object"); // prettier-ignore
39922
- }
39923
-
39924
- var scope = ImmerScope.enter();
39925
- var proxy = this.createProxy(base);
39926
- proxy[DRAFT_STATE].isManual = true;
39927
- scope.leave();
39928
- return proxy;
39929
- };
39930
-
39931
- Immer.prototype.finishDraft = function finishDraft (draft, patchListener) {
39932
- var state = draft && draft[DRAFT_STATE];
39933
-
39934
- if (!state || !state.isManual) {
39935
- throw new Error("First argument to `finishDraft` must be a draft returned by `createDraft`"); // prettier-ignore
39936
- }
39937
-
39938
- if (state.finalized) {
39939
- throw new Error("The given draft is already finalized"); // prettier-ignore
39940
- }
39941
-
39942
- var scope = state.scope;
39943
- scope.usePatches(patchListener);
39944
- return this.processResult(undefined, scope);
39945
- };
39946
-
39947
- Immer.prototype.setAutoFreeze = function setAutoFreeze (value) {
39948
- this.autoFreeze = value;
39949
- };
39950
-
39951
- Immer.prototype.setUseProxies = function setUseProxies (value) {
39952
- this.useProxies = value;
39953
- assign(this, value ? modernProxy : legacyProxy);
39954
- };
39955
-
39956
- Immer.prototype.applyPatches = function applyPatches$1 (base, patches) {
39957
- // If a patch replaces the entire state, take that replacement as base
39958
- // before applying patches
39959
- var i;
39960
-
39961
- for (i = patches.length - 1; i >= 0; i--) {
39962
- var patch = patches[i];
39963
-
39964
- if (patch.path.length === 0 && patch.op === "replace") {
39965
- base = patch.value;
39966
- break;
39967
- }
39968
- }
39969
-
39970
- if (isDraft(base)) {
39971
- // N.B: never hits if some patch a replacement, patches are never drafts
39972
- return applyPatches(base, patches);
39973
- } // Otherwise, produce a copy of the base state.
39974
-
39975
-
39976
- return this.produce(base, function (draft) { return applyPatches(draft, patches.slice(i + 1)); });
39080
+ return runFormValidators(fieldName, form, validators);
39977
39081
  };
39978
- /** @internal */
39979
-
39980
-
39981
- Immer.prototype.processResult = function processResult (result, scope) {
39982
- var baseDraft = scope.drafts[0];
39983
- var isReplaced = result !== undefined && result !== baseDraft;
39984
- this.willFinalize(scope, result, isReplaced);
39985
39082
 
39986
- if (isReplaced) {
39987
- if (baseDraft[DRAFT_STATE].modified) {
39988
- scope.revoke();
39989
- throw new Error("An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft."); // prettier-ignore
39990
- }
39991
-
39992
- if (isDraftable(result)) {
39993
- // Finalize the result in case it contains (or is) a subset of the draft.
39994
- result = this.finalize(result, null, scope);
39995
- }
39996
-
39997
- if (scope.patches) {
39998
- scope.patches.push({
39999
- op: "replace",
40000
- path: [],
40001
- value: result
40002
- });
40003
- scope.inversePatches.push({
40004
- op: "replace",
40005
- path: [],
40006
- value: baseDraft[DRAFT_STATE].base
40007
- });
40008
- }
40009
- } else {
40010
- // Finalize the base draft.
40011
- result = this.finalize(baseDraft, [], scope);
40012
- }
40013
-
40014
- scope.revoke();
40015
-
40016
- if (scope.patches) {
40017
- scope.patchListener(scope.patches, scope.inversePatches);
40018
- }
40019
-
40020
- return result !== NOTHING ? result : undefined;
40021
- };
40022
- /**
40023
- * @internal
40024
- * Finalize a draft, returning either the unmodified base state or a modified
40025
- * copy of the base state.
40026
- */
40027
-
40028
-
40029
- Immer.prototype.finalize = function finalize (draft, path, scope) {
40030
- var this$1$1 = this;
40031
-
40032
- var state = draft[DRAFT_STATE];
40033
-
40034
- if (!state) {
40035
- if (Object.isFrozen(draft)) { return draft; }
40036
- return this.finalizeTree(draft, null, scope);
40037
- } // Never finalize drafts owned by another scope.
40038
-
40039
-
40040
- if (state.scope !== scope) {
40041
- return draft;
40042
- }
40043
-
40044
- if (!state.modified) {
40045
- return state.base;
40046
- }
40047
-
40048
- if (!state.finalized) {
40049
- state.finalized = true;
40050
- this.finalizeTree(state.draft, path, scope);
40051
-
40052
- if (this.onDelete) {
40053
- // The `assigned` object is unreliable with ES5 drafts.
40054
- if (this.useProxies) {
40055
- var assigned = state.assigned;
40056
-
40057
- for (var prop in assigned) {
40058
- if (!assigned[prop]) { this.onDelete(state, prop); }
40059
- }
40060
- } else {
40061
- var base = state.base;
40062
- var copy = state.copy;
40063
- each(base, function (prop) {
40064
- if (!has$1(copy, prop)) { this$1$1.onDelete(state, prop); }
40065
- });
40066
- }
40067
- }
40068
-
40069
- if (this.onCopy) {
40070
- this.onCopy(state);
40071
- } // At this point, all descendants of `state.copy` have been finalized,
40072
- // so we can be sure that `scope.canAutoFreeze` is accurate.
40073
-
40074
-
40075
- if (this.autoFreeze && scope.canAutoFreeze) {
40076
- Object.freeze(state.copy);
40077
- }
40078
-
40079
- if (path && scope.patches) {
40080
- generatePatches(state, path, scope.patches, scope.inversePatches);
40081
- }
39083
+ const computeErrorEntries = (formState) => {
39084
+ const fields = Object.entries(formState);
39085
+ for (let entry of fields) {
39086
+ let fieldName = entry[0];
39087
+ let errors = computeErrors(fieldName, formState);
39088
+ formState[fieldName].errors = errors;
39089
+ formState[fieldName].hasErrors = errors.length > 0;
40082
39090
  }
40083
-
40084
- return state.copy;
40085
39091
  };
40086
- /**
40087
- * @internal
40088
- * Finalize all drafts in the given state tree.
40089
- */
40090
-
40091
-
40092
- Immer.prototype.finalizeTree = function finalizeTree (root, rootPath, scope) {
40093
- var this$1$1 = this;
40094
-
40095
- var state = root[DRAFT_STATE];
40096
-
40097
- if (state) {
40098
- if (!this.useProxies) {
40099
- // Create the final copy, with added keys and without deleted keys.
40100
- state.copy = shallowCopy(state.draft, true);
40101
- }
40102
39092
 
40103
- root = state.copy;
39093
+ const computeDirtyEntries = (formState, changedFieldName) => {
39094
+ const fields = Object.entries(formState);
39095
+ for (let entry of fields) {
39096
+ let fieldName = entry[0];
39097
+ let field = entry[1];
39098
+ let dirty = fieldName === changedFieldName ? true : field.dirty;
39099
+ formState[fieldName].dirty = dirty;
40104
39100
  }
40105
-
40106
- var needPatches = !!rootPath && !!scope.patches;
40107
-
40108
- var finalizeProperty = function (prop, value, parent) {
40109
- if (value === parent) {
40110
- throw Error("Immer forbids circular references");
40111
- } // In the `finalizeTree` method, only the `root` object may be a draft.
40112
-
40113
-
40114
- var isDraftProp = !!state && parent === root;
40115
-
40116
- if (isDraft(value)) {
40117
- var path = isDraftProp && needPatches && !state.assigned[prop] ? rootPath.concat(prop) : null; // Drafts owned by `scope` are finalized here.
40118
-
40119
- value = this$1$1.finalize(value, path, scope); // Drafts from another scope must prevent auto-freezing.
40120
-
40121
- if (isDraft(value)) {
40122
- scope.canAutoFreeze = false;
40123
- } // Preserve non-enumerable properties.
40124
-
40125
-
40126
- if (Array.isArray(parent) || isEnumerable(parent, prop)) {
40127
- parent[prop] = value;
40128
- } else {
40129
- Object.defineProperty(parent, prop, {
40130
- value: value
40131
- });
40132
- } // Unchanged drafts are never passed to the `onAssign` hook.
40133
-
40134
-
40135
- if (isDraftProp && value === state.base[prop]) { return; }
40136
- } // Unchanged draft properties are ignored.
40137
- else if (isDraftProp && is(value, state.base[prop])) {
40138
- return;
40139
- } // Search new objects for unfinalized drafts. Frozen objects should never contain drafts.
40140
- else if (isDraftable(value) && !Object.isFrozen(value)) {
40141
- each(value, finalizeProperty);
40142
- }
40143
-
40144
- if (isDraftProp && this$1$1.onAssign) {
40145
- this$1$1.onAssign(state, prop, value);
40146
- }
40147
- };
40148
-
40149
- each(root, finalizeProperty);
40150
- return root;
40151
39101
  };
40152
39102
 
40153
- var immer = new Immer();
40154
- /**
40155
- * The `produce` function takes a value and a "recipe function" (whose
40156
- * return value often depends on the base state). The recipe function is
40157
- * free to mutate its first argument however it wants. All mutations are
40158
- * only ever applied to a __copy__ of the base state.
40159
- *
40160
- * Pass only a function to create a "curried producer" which relieves you
40161
- * from passing the recipe function every time.
40162
- *
40163
- * Only plain objects and arrays are made mutable. All other objects are
40164
- * considered uncopyable.
40165
- *
40166
- * Note: This function is __bound__ to its `Immer` instance.
40167
- *
40168
- * @param {any} base - the initial state
40169
- * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified
40170
- * @param {Function} patchListener - optional function that will be called with all the patches produced here
40171
- * @returns {any} a new state, or the initial state if nothing was modified
40172
- */
40173
-
40174
- var produce = immer.produce;
40175
- /**
40176
- * Like `produce`, but `produceWithPatches` always returns a tuple
40177
- * [nextState, patches, inversePatches] (instead of just the next state)
40178
- */
40179
-
40180
- immer.produceWithPatches.bind(immer);
40181
- /**
40182
- * Pass true to automatically freeze all copies created by Immer.
40183
- *
40184
- * By default, auto-freezing is disabled in production.
40185
- */
40186
-
40187
- immer.setAutoFreeze.bind(immer);
40188
- /**
40189
- * Pass true to use the ES2015 `Proxy` class when creating drafts, which is
40190
- * always faster than using ES5 proxies.
40191
- *
40192
- * By default, feature detection is used, so calling this is rarely necessary.
40193
- */
40194
-
40195
- immer.setUseProxies.bind(immer);
40196
- /**
40197
- * Apply an array of Immer patches to the first argument.
40198
- *
40199
- * This function is a producer, which means copy-on-write is in effect.
40200
- */
39103
+ function n(n){for(var r=arguments.length,t=Array(r>1?r-1:0),e=1;e<r;e++)t[e-1]=arguments[e];if("production"!==process.env.NODE_ENV){var i=Y[n],o=i?"function"==typeof i?i.apply(null,t):i:"unknown error nr: "+n;throw Error("[Immer] "+o)}throw Error("[Immer] minified error nr: "+n+(t.length?" "+t.map((function(n){return "'"+n+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function r(n){return !!n&&!!n[Q]}function t(n){var r;return !!n&&(function(n){if(!n||"object"!=typeof n)return !1;var r=Object.getPrototypeOf(n);if(null===r)return !0;var t=Object.hasOwnProperty.call(r,"constructor")&&r.constructor;return t===Object||"function"==typeof t&&Function.toString.call(t)===Z}(n)||Array.isArray(n)||!!n[L]||!!(null===(r=n.constructor)||void 0===r?void 0:r[L])||s(n)||v(n))}function i(n,r,t){void 0===t&&(t=!1),0===o(n)?(t?Object.keys:nn)(n).forEach((function(e){t&&"symbol"==typeof e||r(e,n[e],n);})):n.forEach((function(t,e){return r(e,t,n)}));}function o(n){var r=n[Q];return r?r.i>3?r.i-4:r.i:Array.isArray(n)?1:s(n)?2:v(n)?3:0}function u(n,r){return 2===o(n)?n.has(r):Object.prototype.hasOwnProperty.call(n,r)}function a$1(n,r){return 2===o(n)?n.get(r):n[r]}function f$6(n,r,t){var e=o(n);2===e?n.set(r,t):3===e?n.add(t):n[r]=t;}function c$1(n,r){return n===r?0!==n||1/n==1/r:n!=n&&r!=r}function s(n){return X&&n instanceof Map}function v(n){return q&&n instanceof Set}function p(n){return n.o||n.t}function l(n){if(Array.isArray(n))return Array.prototype.slice.call(n);var r=rn(n);delete r[Q];for(var t=nn(r),e=0;e<t.length;e++){var i=t[e],o=r[i];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(r[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:n[i]});}return Object.create(Object.getPrototypeOf(n),r)}function d(n,e){return void 0===e&&(e=!1),y(n)||r(n)||!t(n)||(o(n)>1&&(n.set=n.add=n.clear=n.delete=h),Object.freeze(n),e&&i(n,(function(n,r){return d(r,!0)}),!0)),n}function h(){n(2);}function y(n){return null==n||"object"!=typeof n||Object.isFrozen(n)}function b$1(r){var t=tn[r];return t||n(18,r),t}function _(){return "production"===process.env.NODE_ENV||U||n(0),U}function j(n,r){r&&(b$1("Patches"),n.u=[],n.s=[],n.v=r);}function g(n){O(n),n.p.forEach(S),n.p=null;}function O(n){n===U&&(U=n.l);}function w(n){return U={p:[],l:U,h:n,m:!0,_:0}}function S(n){var r=n[Q];0===r.i||1===r.i?r.j():r.g=!0;}function P(r,e){e._=e.p.length;var i=e.p[0],o=void 0!==r&&r!==i;return e.h.O||b$1("ES5").S(e,r,o),o?(i[Q].P&&(g(e),n(4)),t(r)&&(r=M(e,r),e.l||x(e,r)),e.u&&b$1("Patches").M(i[Q].t,r,e.u,e.s)):r=M(e,i,[]),g(e),e.u&&e.v(e.u,e.s),r!==H?r:void 0}function M(n,r,t){if(y(r))return r;var e=r[Q];if(!e)return i(r,(function(i,o){return A(n,e,r,i,o,t)}),!0),r;if(e.A!==n)return r;if(!e.P)return x(n,e.t,!0),e.t;if(!e.I){e.I=!0,e.A._--;var o=4===e.i||5===e.i?e.o=l(e.k):e.o,u=o,a=!1;3===e.i&&(u=new Set(o),o.clear(),a=!0),i(u,(function(r,i){return A(n,e,o,r,i,t,a)})),x(n,o,!1),t&&n.u&&b$1("Patches").N(e,t,n.u,n.s);}return e.o}function A(e,i,o,a,c,s,v){if("production"!==process.env.NODE_ENV&&c===o&&n(5),r(c)){var p=M(e,c,s&&i&&3!==i.i&&!u(i.R,a)?s.concat(a):void 0);if(f$6(o,a,p),!r(p))return;e.m=!1;}else v&&o.add(c);if(t(c)&&!y(c)){if(!e.h.D&&e._<1)return;M(e,c),i&&i.A.l||x(e,c);}}function x(n,r,t){void 0===t&&(t=!1),!n.l&&n.h.D&&n.m&&d(r,t);}function z(n,r){var t=n[Q];return (t?p(t):n)[r]}function I(n,r){if(r in n)for(var t=Object.getPrototypeOf(n);t;){var e=Object.getOwnPropertyDescriptor(t,r);if(e)return e;t=Object.getPrototypeOf(t);}}function k(n){n.P||(n.P=!0,n.l&&k(n.l));}function E(n){n.o||(n.o=l(n.t));}function N(n,r,t){var e=s(r)?b$1("MapSet").F(r,t):v(r)?b$1("MapSet").T(r,t):n.O?function(n,r){var t=Array.isArray(n),e={i:t?1:0,A:r?r.A:_(),P:!1,I:!1,R:{},l:r,t:n,k:null,o:null,j:null,C:!1},i=e,o=en;t&&(i=[e],o=on);var u=Proxy.revocable(i,o),a=u.revoke,f=u.proxy;return e.k=f,e.j=a,f}(r,t):b$1("ES5").J(r,t);return (t?t.A:_()).p.push(e),e}function R(e){return r(e)||n(22,e),function n(r){if(!t(r))return r;var e,u=r[Q],c=o(r);if(u){if(!u.P&&(u.i<4||!b$1("ES5").K(u)))return u.t;u.I=!0,e=D(r,c),u.I=!1;}else e=D(r,c);return i(e,(function(r,t){u&&a$1(u.t,r)===t||f$6(e,r,n(t));})),3===c?new Set(e):e}(e)}function D(n,r){switch(r){case 2:return new Map(n);case 3:return Array.from(n)}return l(n)}var G,U,W="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),X="undefined"!=typeof Map,q="undefined"!=typeof Set,B="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,H=W?Symbol.for("immer-nothing"):((G={})["immer-nothing"]=!0,G),L=W?Symbol.for("immer-draftable"):"__$immer_draftable",Q=W?Symbol.for("immer-state"):"__$immer_state",Y={0:"Illegal state",1:"Immer drafts cannot have computed properties",2:"This object has been frozen and should not be mutated",3:function(n){return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+n},4:"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",5:"Immer forbids circular references",6:"The first or second argument to `produce` must be a function",7:"The third argument to `produce` must be a function or undefined",8:"First argument to `createDraft` must be a plain object, an array, or an immerable object",9:"First argument to `finishDraft` must be a draft returned by `createDraft`",10:"The given draft is already finalized",11:"Object.defineProperty() cannot be used on an Immer draft",12:"Object.setPrototypeOf() cannot be used on an Immer draft",13:"Immer only supports deleting array indices",14:"Immer only supports setting array indices and the 'length' property",15:function(n){return "Cannot apply patch, path doesn't resolve: "+n},16:'Sets cannot have "replace" patches.',17:function(n){return "Unsupported patch operation: "+n},18:function(n){return "The plugin for '"+n+"' has not been loaded into Immer. To enable the plugin, import and call `enable"+n+"()` when initializing your application."},20:"Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available",21:function(n){return "produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '"+n+"'"},22:function(n){return "'current' expects a draft, got: "+n},23:function(n){return "'original' expects a draft, got: "+n},24:"Patching reserved attributes like __proto__, prototype and constructor is not allowed"},Z=""+Object.prototype.constructor,nn="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(n){return Object.getOwnPropertyNames(n).concat(Object.getOwnPropertySymbols(n))}:Object.getOwnPropertyNames,rn=Object.getOwnPropertyDescriptors||function(n){var r={};return nn(n).forEach((function(t){r[t]=Object.getOwnPropertyDescriptor(n,t);})),r},tn={},en={get:function(n,r){if(r===Q)return n;var e=p(n);if(!u(e,r))return function(n,r,t){var e,i=I(r,t);return i?"value"in i?i.value:null===(e=i.get)||void 0===e?void 0:e.call(n.k):void 0}(n,e,r);var i=e[r];return n.I||!t(i)?i:i===z(n.t,r)?(E(n),n.o[r]=N(n.A.h,i,n)):i},has:function(n,r){return r in p(n)},ownKeys:function(n){return Reflect.ownKeys(p(n))},set:function(n,r,t){var e=I(p(n),r);if(null==e?void 0:e.set)return e.set.call(n.k,t),!0;if(!n.P){var i=z(p(n),r),o=null==i?void 0:i[Q];if(o&&o.t===t)return n.o[r]=t,n.R[r]=!1,!0;if(c$1(t,i)&&(void 0!==t||u(n.t,r)))return !0;E(n),k(n);}return n.o[r]===t&&(void 0!==t||r in n.o)||Number.isNaN(t)&&Number.isNaN(n.o[r])||(n.o[r]=t,n.R[r]=!0),!0},deleteProperty:function(n,r){return void 0!==z(n.t,r)||r in n.t?(n.R[r]=!1,E(n),k(n)):delete n.R[r],n.o&&delete n.o[r],!0},getOwnPropertyDescriptor:function(n,r){var t=p(n),e=Reflect.getOwnPropertyDescriptor(t,r);return e?{writable:!0,configurable:1!==n.i||"length"!==r,enumerable:e.enumerable,value:t[r]}:e},defineProperty:function(){n(11);},getPrototypeOf:function(n){return Object.getPrototypeOf(n.t)},setPrototypeOf:function(){n(12);}},on={};i(en,(function(n,r){on[n]=function(){return arguments[0]=arguments[0][0],r.apply(this,arguments)};})),on.deleteProperty=function(r,t){return "production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&n(13),on.set.call(this,r,t,void 0)},on.set=function(r,t,e){return "production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&n(14),en.set.call(this,r[0],t,e,r[0])};var un=function(){function e(r){var e=this;this.O=B,this.D=!0,this.produce=function(r,i,o){if("function"==typeof r&&"function"!=typeof i){var u=i;i=r;var a=e;return function(n){var r=this;void 0===n&&(n=u);for(var t=arguments.length,e=Array(t>1?t-1:0),o=1;o<t;o++)e[o-1]=arguments[o];return a.produce(n,(function(n){var t;return (t=i).call.apply(t,[r,n].concat(e))}))}}var f;if("function"!=typeof i&&n(6),void 0!==o&&"function"!=typeof o&&n(7),t(r)){var c=w(e),s=N(e,r,void 0),v=!0;try{f=i(s),v=!1;}finally{v?g(c):O(c);}return "undefined"!=typeof Promise&&f instanceof Promise?f.then((function(n){return j(c,o),P(n,c)}),(function(n){throw g(c),n})):(j(c,o),P(f,c))}if(!r||"object"!=typeof r){if(void 0===(f=i(r))&&(f=r),f===H&&(f=void 0),e.D&&d(f,!0),o){var p=[],l=[];b$1("Patches").M(r,f,p,l),o(p,l);}return f}n(21,r);},this.produceWithPatches=function(n,r){if("function"==typeof n)return function(r){for(var t=arguments.length,i=Array(t>1?t-1:0),o=1;o<t;o++)i[o-1]=arguments[o];return e.produceWithPatches(r,(function(r){return n.apply(void 0,[r].concat(i))}))};var t,i,o=e.produce(n,r,(function(n,r){t=n,i=r;}));return "undefined"!=typeof Promise&&o instanceof Promise?o.then((function(n){return [n,t,i]})):[o,t,i]},"boolean"==typeof(null==r?void 0:r.useProxies)&&this.setUseProxies(r.useProxies),"boolean"==typeof(null==r?void 0:r.autoFreeze)&&this.setAutoFreeze(r.autoFreeze);}var i=e.prototype;return i.createDraft=function(e){t(e)||n(8),r(e)&&(e=R(e));var i=w(this),o=N(this,e,void 0);return o[Q].C=!0,O(i),o},i.finishDraft=function(r,t){var e=r&&r[Q];"production"!==process.env.NODE_ENV&&(e&&e.C||n(9),e.I&&n(10));var i=e.A;return j(i,t),P(void 0,i)},i.setAutoFreeze=function(n){this.D=n;},i.setUseProxies=function(r){r&&!B&&n(20),this.O=r;},i.applyPatches=function(n,t){var e;for(e=t.length-1;e>=0;e--){var i=t[e];if(0===i.path.length&&"replace"===i.op){n=i.value;break}}e>-1&&(t=t.slice(e+1));var o=b$1("Patches").$;return r(n)?o(n,t):this.produce(n,(function(n){return o(n,t)}))},e}(),an=new un,fn=an.produce;an.produceWithPatches.bind(an);an.setAutoFreeze.bind(an);an.setUseProxies.bind(an);an.applyPatches.bind(an);an.createDraft.bind(an);an.finishDraft.bind(an);var produce = fn;
40201
39104
 
40202
- immer.applyPatches.bind(immer);
40203
- /**
40204
- * Create an Immer draft from the given base state, which may be a draft itself.
40205
- * The draft can be modified until you finalize it with the `finishDraft` function.
40206
- */
40207
-
40208
- immer.createDraft.bind(immer);
40209
- /**
40210
- * Finalize an Immer draft from a `createDraft` call, returning the base state
40211
- * (if no changes were made) or a modified copy. The draft must *not* be
40212
- * mutated afterwards.
40213
- *
40214
- * Pass a function as the 2nd argument to generate Immer patches based on the
40215
- * changes that were made.
40216
- */
40217
-
40218
- immer.finishDraft.bind(immer);
40219
-
40220
- const createInitialState = formConfig => {
39105
+ const createInitialState = (formConfig) => {
40221
39106
  let initialForm = {};
40222
39107
  const formConfigKeys = Object.keys(formConfig);
40223
39108
  for (let formKey of formConfigKeys) {
40224
39109
  initialForm[formKey] = {
40225
39110
  dirty: false,
40226
- rawValue: formConfig[formKey].defaultValue || "",
39111
+ rawValue: formConfig[formKey].defaultValue || '',
40227
39112
  validators: formConfig[formKey].validators || [],
40228
- constraints: formConfig[formKey].constraints || []
39113
+ constraints: formConfig[formKey].constraints || [],
40229
39114
  };
40230
39115
  }
40231
39116
  // Because validators require the entire form we have to do a
@@ -40236,82 +39121,99 @@ const createInitialState = formConfig => {
40236
39121
  initialForm[formKey].errors = errors;
40237
39122
  initialForm[formKey].hasErrors = errors.length > 0;
40238
39123
  }
39124
+
40239
39125
  return initialForm;
40240
39126
  };
40241
39127
 
40242
- const SET = "field/SET";
40243
- const set$2 = fieldName => value => ({
39128
+ const SET = 'field/SET';
39129
+ const set$1 = (fieldName) => (value) => ({
40244
39130
  type: SET,
40245
- payload: { fieldName, value }
39131
+ payload: { fieldName, value },
40246
39132
  });
40247
39133
 
40248
- const CLEAR = "form/CLEAR";
39134
+ const CLEAR = 'form/CLEAR';
40249
39135
  const clear = () => ({ type: CLEAR });
40250
39136
 
40251
- const ADD_VALIDATOR = "field/ADD_VALIDATOR";
40252
- const addValidator = fieldName => validator => ({
39137
+ const ADD_VALIDATOR = 'field/ADD_VALIDATOR';
39138
+ const addValidator = (fieldName) => (validator) => ({
40253
39139
  type: ADD_VALIDATOR,
40254
- payload: { fieldName, validator }
39140
+ payload: { fieldName, validator },
40255
39141
  });
40256
39142
 
40257
- const createFormReducer = formConfig => (
40258
- state = createInitialState(formConfig),
40259
- action
40260
- ) => {
40261
- switch (action.type) {
40262
- case SET:
40263
- const changedFieldName = action.payload.fieldName;
40264
- const newRawValue = action.payload.value;
40265
-
40266
- return produce(state, draftState => {
40267
- let originalValue = draftState[changedFieldName].rawValue;
40268
- draftState[changedFieldName].rawValue = newRawValue;
40269
- if (computeConstraints(changedFieldName, draftState).length > 0) {
40270
- // If the change violates constraints, revert the change
40271
- draftState[changedFieldName].rawValue = originalValue;
40272
- return draftState;
40273
- }
39143
+ const REMOVE_VALIDATOR = 'field/REMOVE_VALIDATOR';
39144
+ const removeValidator = (fieldName) => (validator) => ({
39145
+ type: REMOVE_VALIDATOR,
39146
+ payload: { fieldName, validator },
39147
+ });
40274
39148
 
40275
- const fields = Object.entries(draftState);
40276
- for (let entry of fields) {
40277
- let fieldName = entry[0];
40278
- let field = entry[1];
40279
- let errors = computeErrors(fieldName, draftState);
40280
- let dirty = fieldName === changedFieldName ? true : field.dirty;
40281
- draftState[fieldName].errors = errors;
40282
- draftState[fieldName].dirty = dirty;
40283
- draftState[fieldName].hasErrors = errors.length > 0;
40284
- }
40285
- });
40286
- case CLEAR:
40287
- return createInitialState(formConfig);
40288
- case ADD_VALIDATOR:
40289
- const fieldWithOverride = action.payload.fieldName;
40290
- const newValidator = action.payload.validator;
40291
-
40292
- return produce(state, draftState => {
40293
- draftState[fieldWithOverride].validators.push(newValidator);
40294
- const fields = Object.entries(draftState);
40295
- for (let entry of fields) {
40296
- let fieldName = entry[0];
40297
- let field = entry[1];
40298
- let errors = computeErrors(fieldName, draftState);
40299
- let dirty = field.dirty;
40300
- draftState[fieldName].errors = errors;
40301
- draftState[fieldName].dirty = dirty;
40302
- draftState[fieldName].hasErrors = errors.length > 0;
40303
- }
40304
- });
40305
- default:
40306
- return state;
40307
- }
40308
- };
39149
+ const CLEAR_FIELD_VALIDATORS = 'field/CLEAR_FIELD_VALIDATORS';
39150
+ const clearFieldValidators = (fieldName) => () => ({
39151
+ type: CLEAR_FIELD_VALIDATORS,
39152
+ payload: { fieldName },
39153
+ });
39154
+
39155
+ const createFormReducer =
39156
+ (formConfig) =>
39157
+ (state = createInitialState(formConfig), action) => {
39158
+ switch (action.type) {
39159
+ case SET: {
39160
+ const changedFieldName = action.payload.fieldName;
39161
+ const newRawValue = action.payload.value;
39162
+
39163
+ return produce(state, (draftState) => {
39164
+ let originalValue = draftState[changedFieldName].rawValue;
39165
+ draftState[changedFieldName].rawValue = newRawValue;
39166
+ if (computeConstraints(changedFieldName, draftState).length > 0) {
39167
+ // If the change violates constraints, revert the change
39168
+ draftState[changedFieldName].rawValue = originalValue;
39169
+ return draftState;
39170
+ }
39171
+
39172
+ computeDirtyEntries(draftState, changedFieldName);
39173
+ computeErrorEntries(draftState);
39174
+ });
39175
+ }
39176
+ case CLEAR:
39177
+ return createInitialState(formConfig);
39178
+ case ADD_VALIDATOR: {
39179
+ const fieldWithOverride = action.payload.fieldName;
39180
+ const newValidator = action.payload.validator;
39181
+
39182
+ return produce(state, (draftState) => {
39183
+ draftState[fieldWithOverride].validators.push(newValidator);
39184
+ computeErrorEntries(draftState);
39185
+ });
39186
+ }
39187
+ case REMOVE_VALIDATOR: {
39188
+ const fieldToOverride = action.payload.fieldName;
39189
+ const targetValidator = action.payload.validator;
39190
+
39191
+ return produce(state, (draftState) => {
39192
+ let fieldValidators = draftState[fieldToOverride].validators;
39193
+ draftState[fieldToOverride].validators = fieldValidators.filter(
39194
+ (validator) => validator.type !== targetValidator.type
39195
+ );
39196
+ computeErrorEntries(draftState);
39197
+ });
39198
+ }
39199
+ case CLEAR_FIELD_VALIDATORS: {
39200
+ const fieldToClear = action.payload.fieldName;
39201
+
39202
+ return produce(state, (draftState) => {
39203
+ draftState[fieldToClear].validators = [];
39204
+ computeErrorEntries(draftState);
39205
+ });
39206
+ }
39207
+ default:
39208
+ return state;
39209
+ }
39210
+ };
40309
39211
 
40310
- const createMapDispatchToProps = formConfig => {
39212
+ const createMapDispatchToProps = (formConfig) => {
40311
39213
  // Do memo-ization
40312
39214
  let cachedDispatch;
40313
39215
  let cacheValue;
40314
- return dispatch => {
39216
+ return (dispatch) => {
40315
39217
  if (dispatch == cachedDispatch) {
40316
39218
  return cacheValue;
40317
39219
  }
@@ -40320,8 +39222,11 @@ const createMapDispatchToProps = formConfig => {
40320
39222
  const keys = Object.keys(formConfig);
40321
39223
  for (let fieldName of keys) {
40322
39224
  dispatchObj.fields[fieldName] = {
40323
- set: value => dispatch(set$2(fieldName)(value)),
40324
- addValidator: validator => dispatch(addValidator(fieldName)(validator))
39225
+ set: (value) => dispatch(set$1(fieldName)(value)),
39226
+ addValidator: (validator) => dispatch(addValidator(fieldName)(validator)),
39227
+ removeValidator: (validator) =>
39228
+ dispatch(removeValidator(fieldName)(validator)),
39229
+ clear: () => dispatch(clearFieldValidators(fieldName)()),
40325
39230
  };
40326
39231
  }
40327
39232
  dispatchObj.form = { clear: () => dispatch(clear()) };
@@ -40331,12 +39236,12 @@ const createMapDispatchToProps = formConfig => {
40331
39236
  };
40332
39237
  };
40333
39238
 
40334
- const mapStateToProps = state => ({ fields: state });
39239
+ const mapStateToProps = (state) => ({ fields: state });
40335
39240
 
40336
- const createFormState = formConfig => ({
39241
+ const createFormState = (formConfig) => ({
40337
39242
  reducer: createFormReducer(formConfig),
40338
39243
  mapDispatchToProps: createMapDispatchToProps(formConfig),
40339
- mapStateToProps: mapStateToProps
39244
+ mapStateToProps: mapStateToProps,
40340
39245
  });
40341
39246
 
40342
39247
  var AddressForm = function AddressForm(_ref) {
@@ -43202,12 +42107,12 @@ LoginForm.mapDispatchToProps = mapDispatchToProps$5;
43202
42107
  * This source code is licensed under the MIT license found in the
43203
42108
  * LICENSE file in the root directory of this source tree.
43204
42109
  */
43205
- var b$1="function"===typeof Symbol&&Symbol.for,c$1=b$1?Symbol.for("react.element"):60103,d=b$1?Symbol.for("react.portal"):60106,e=b$1?Symbol.for("react.fragment"):60107,f$6=b$1?Symbol.for("react.strict_mode"):60108,g=b$1?Symbol.for("react.profiler"):60114,h=b$1?Symbol.for("react.provider"):60109,k=b$1?Symbol.for("react.context"):60110,l=b$1?Symbol.for("react.async_mode"):60111,m=b$1?Symbol.for("react.concurrent_mode"):60111,n=b$1?Symbol.for("react.forward_ref"):60112,p=b$1?Symbol.for("react.suspense"):60113,q=b$1?
43206
- Symbol.for("react.suspense_list"):60120,r=b$1?Symbol.for("react.memo"):60115,t=b$1?Symbol.for("react.lazy"):60116,v=b$1?Symbol.for("react.block"):60121,w=b$1?Symbol.for("react.fundamental"):60117,x=b$1?Symbol.for("react.responder"):60118,y=b$1?Symbol.for("react.scope"):60119;
43207
- function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c$1:switch(a=a.type,a){case l:case m:case e:case g:case f$6:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}var AsyncMode=l;var ConcurrentMode=m;var ContextConsumer=k;var ContextProvider=h;var Element$1=c$1;var ForwardRef=n;var Fragment=e;var Lazy=t;var Memo=r;var Portal=d;
43208
- var Profiler=g;var StrictMode=f$6;var Suspense=p;var isAsyncMode=function(a){return A(a)||z(a)===l};var isConcurrentMode=A;var isContextConsumer=function(a){return z(a)===k};var isContextProvider=function(a){return z(a)===h};var isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c$1};var isForwardRef=function(a){return z(a)===n};var isFragment=function(a){return z(a)===e};var isLazy=function(a){return z(a)===t};
43209
- var isMemo=function(a){return z(a)===r};var isPortal=function(a){return z(a)===d};var isProfiler=function(a){return z(a)===g};var isStrictMode=function(a){return z(a)===f$6};var isSuspense=function(a){return z(a)===p};
43210
- var isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f$6||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};var typeOf=z;
42110
+ var b$2="function"===typeof Symbol&&Symbol.for,c$2=b$2?Symbol.for("react.element"):60103,d$1=b$2?Symbol.for("react.portal"):60106,e=b$2?Symbol.for("react.fragment"):60107,f$7=b$2?Symbol.for("react.strict_mode"):60108,g$1=b$2?Symbol.for("react.profiler"):60114,h$1=b$2?Symbol.for("react.provider"):60109,k$1=b$2?Symbol.for("react.context"):60110,l$1=b$2?Symbol.for("react.async_mode"):60111,m=b$2?Symbol.for("react.concurrent_mode"):60111,n$1=b$2?Symbol.for("react.forward_ref"):60112,p$1=b$2?Symbol.for("react.suspense"):60113,q$1=b$2?
42111
+ Symbol.for("react.suspense_list"):60120,r$1=b$2?Symbol.for("react.memo"):60115,t$1=b$2?Symbol.for("react.lazy"):60116,v$1=b$2?Symbol.for("react.block"):60121,w$1=b$2?Symbol.for("react.fundamental"):60117,x$1=b$2?Symbol.for("react.responder"):60118,y$1=b$2?Symbol.for("react.scope"):60119;
42112
+ function z$1(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c$2:switch(a=a.type,a){case l$1:case m:case e:case g$1:case f$7:case p$1:return a;default:switch(a=a&&a.$$typeof,a){case k$1:case n$1:case t$1:case r$1:case h$1:return a;default:return u}}case d$1:return u}}}function A$1(a){return z$1(a)===m}var AsyncMode=l$1;var ConcurrentMode=m;var ContextConsumer=k$1;var ContextProvider=h$1;var Element$1=c$2;var ForwardRef=n$1;var Fragment=e;var Lazy=t$1;var Memo=r$1;var Portal=d$1;
42113
+ var Profiler=g$1;var StrictMode=f$7;var Suspense=p$1;var isAsyncMode=function(a){return A$1(a)||z$1(a)===l$1};var isConcurrentMode=A$1;var isContextConsumer=function(a){return z$1(a)===k$1};var isContextProvider=function(a){return z$1(a)===h$1};var isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c$2};var isForwardRef=function(a){return z$1(a)===n$1};var isFragment=function(a){return z$1(a)===e};var isLazy=function(a){return z$1(a)===t$1};
42114
+ var isMemo=function(a){return z$1(a)===r$1};var isPortal=function(a){return z$1(a)===d$1};var isProfiler=function(a){return z$1(a)===g$1};var isStrictMode=function(a){return z$1(a)===f$7};var isSuspense=function(a){return z$1(a)===p$1};
42115
+ var isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g$1||a===f$7||a===p$1||a===q$1||"object"===typeof a&&null!==a&&(a.$$typeof===t$1||a.$$typeof===r$1||a.$$typeof===h$1||a.$$typeof===k$1||a.$$typeof===n$1||a.$$typeof===w$1||a.$$typeof===x$1||a.$$typeof===y$1||a.$$typeof===v$1)};var typeOf=z$1;
43211
42116
 
43212
42117
  var reactIs_production_min = {
43213
42118
  AsyncMode: AsyncMode,
@@ -43578,14 +42483,14 @@ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
43578
42483
 
43579
42484
  var ReactPropTypesSecret_1 = ReactPropTypesSecret;
43580
42485
 
43581
- var has$2 = Function.call.bind(Object.prototype.hasOwnProperty);
42486
+ var has$1 = Function.call.bind(Object.prototype.hasOwnProperty);
43582
42487
 
43583
42488
  var printWarning = function() {};
43584
42489
 
43585
42490
  if (process.env.NODE_ENV !== 'production') {
43586
42491
  var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
43587
42492
  var loggedTypeFailures = {};
43588
- var has$3 = has$2;
42493
+ var has$2 = has$1;
43589
42494
 
43590
42495
  printWarning = function(text) {
43591
42496
  var message = 'Warning: ' + text;
@@ -43615,7 +42520,7 @@ if (process.env.NODE_ENV !== 'production') {
43615
42520
  function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
43616
42521
  if (process.env.NODE_ENV !== 'production') {
43617
42522
  for (var typeSpecName in typeSpecs) {
43618
- if (has$3(typeSpecs, typeSpecName)) {
42523
+ if (has$2(typeSpecs, typeSpecName)) {
43619
42524
  var error;
43620
42525
  // Prop type validation may throw. In case they do, we don't want to
43621
42526
  // fail the render phase where it didn't fail before. So we log it.
@@ -44014,7 +42919,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
44014
42919
  return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
44015
42920
  }
44016
42921
  for (var key in propValue) {
44017
- if (has$2(propValue, key)) {
42922
+ if (has$1(propValue, key)) {
44018
42923
  var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
44019
42924
  if (error instanceof Error) {
44020
42925
  return error;
@@ -44051,7 +42956,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
44051
42956
  if (checkerResult == null) {
44052
42957
  return null;
44053
42958
  }
44054
- if (checkerResult.data && has$2(checkerResult.data, 'expectedType')) {
42959
+ if (checkerResult.data && has$1(checkerResult.data, 'expectedType')) {
44055
42960
  expectedTypes.push(checkerResult.data.expectedType);
44056
42961
  }
44057
42962
  }
@@ -44111,7 +43016,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
44111
43016
  var allKeys = objectAssign({}, props[propName], shapeTypes);
44112
43017
  for (var key in allKeys) {
44113
43018
  var checker = shapeTypes[key];
44114
- if (has$2(shapeTypes, key) && typeof checker !== 'function') {
43019
+ if (has$1(shapeTypes, key) && typeof checker !== 'function') {
44115
43020
  return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
44116
43021
  }
44117
43022
  if (!checker) {
@@ -44849,7 +43754,7 @@ var index_esm = /*#__PURE__*/Object.freeze({
44849
43754
  * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
44850
43755
  */
44851
43756
 
44852
- function ownKeys$3(object, enumerableOnly) {
43757
+ function ownKeys$2(object, enumerableOnly) {
44853
43758
  var keys = Object.keys(object);
44854
43759
 
44855
43760
  if (Object.getOwnPropertySymbols) {
@@ -44865,9 +43770,9 @@ function ownKeys$3(object, enumerableOnly) {
44865
43770
  function _objectSpread2$1(target) {
44866
43771
  for (var i = 1; i < arguments.length; i++) {
44867
43772
  var source = null != arguments[i] ? arguments[i] : {};
44868
- i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) {
43773
+ i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) {
44869
43774
  _defineProperty$1(target, key, source[key]);
44870
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) {
43775
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) {
44871
43776
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
44872
43777
  });
44873
43778
  }
@@ -46659,7 +45564,7 @@ var Modal$1 = function Modal(_ref) {
46659
45564
  buttonExtraStyles = _ref.buttonExtraStyles,
46660
45565
  children = _ref.children,
46661
45566
  _ref$dataQa = _ref.dataQa,
46662
- dataQa = _ref$dataQa === void 0 ? "" : _ref$dataQa;
45567
+ dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa;
46663
45568
 
46664
45569
  var _useContext = useContext(ThemeContext),
46665
45570
  isMobile = _useContext.isMobile;
@@ -47838,24 +46743,7 @@ var createPartialAmountFormState = function createPartialAmountFormState(lineIte
47838
46743
  var minimum = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
47839
46744
  var blockPartialPaymentOverpay = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
47840
46745
  var formConfig = lineItems.reduce(function (acc, item) {
47841
- var validators = [required(), validateSum(numberGreaterThanOrEqualTo(minimum), lineItems.filter(function (lineItem) {
47842
- return lineItem != item;
47843
- }).reduce(function (acc, curr) {
47844
- return [].concat(_toConsumableArray(acc), [curr.id]);
47845
- }, []))];
47846
-
47847
- if (!!maximum) {
47848
- validators.push(validateSum(numberLessThanOrEqualTo(maximum), lineItems.filter(function (lineItem) {
47849
- return lineItem != item;
47850
- }).reduce(function (acc, curr) {
47851
- return [].concat(_toConsumableArray(acc), [curr.id]);
47852
- }, [])));
47853
- }
47854
-
47855
- if (blockPartialPaymentOverpay) {
47856
- validators.push(numberLessThanOrEqualTo(item.amount));
47857
- }
47858
-
46746
+ var validators = createPartialAmountFormValidators(item, lineItems, maximum, minimum, blockPartialPaymentOverpay);
47859
46747
  return _objectSpread2(_objectSpread2({}, acc), {}, _defineProperty({}, item.id, {
47860
46748
  validators: validators,
47861
46749
  constraints: [onlyNaturals()],
@@ -47874,6 +46762,29 @@ var createPartialAmountFormState = function createPartialAmountFormState(lineIte
47874
46762
  partialAmountFormMapDispatchToProps: mapDispatchToProps
47875
46763
  };
47876
46764
  };
46765
+ var createPartialAmountFormValidators = function createPartialAmountFormValidators(item, lineItems, maximum) {
46766
+ var minimum = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
46767
+ var blockPartialPaymentOverpay = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
46768
+ var validators = [required(), validateSum(numberGreaterThanOrEqualTo(minimum), lineItems.filter(function (lineItem) {
46769
+ return lineItem != item;
46770
+ }).reduce(function (acc, curr) {
46771
+ return [].concat(_toConsumableArray(acc), [curr.id]);
46772
+ }, []))];
46773
+
46774
+ if (!!maximum) {
46775
+ validators.push(validateSum(numberLessThanOrEqualTo(maximum), lineItems.filter(function (lineItem) {
46776
+ return lineItem != item;
46777
+ }).reduce(function (acc, curr) {
46778
+ return [].concat(_toConsumableArray(acc), [curr.id]);
46779
+ }, [])));
46780
+ }
46781
+
46782
+ if (blockPartialPaymentOverpay) {
46783
+ validators.push(numberLessThanOrEqualTo(item.amount));
46784
+ }
46785
+
46786
+ return validators;
46787
+ };
47877
46788
 
47878
46789
  var arrowColor = WHITE;
47879
46790
  var numberColor = MATISSE_BLUE;
@@ -48252,22 +47163,57 @@ var PaymentDetailsContent = function PaymentDetailsContent(_ref) {
48252
47163
  var LoadingDetails = function LoadingDetails() {
48253
47164
  return /*#__PURE__*/React.createElement(Box, {
48254
47165
  padding: "0",
48255
- background: GRECIAN_GREY,
48256
- borderRadius: "4px",
48257
47166
  minHeight: "196px"
48258
- }, /*#__PURE__*/React.createElement(Cover, {
48259
- minHeight: "196px",
48260
- singleChild: true,
48261
- fillCenter: true
48262
- }, /*#__PURE__*/React.createElement(Center, {
48263
- intrinsic: true
48264
47167
  }, /*#__PURE__*/React.createElement(Box, {
48265
47168
  padding: "0",
48266
- extraStyles: "flex-grow: 1; display: flex; justify-content: center; align-items: center;"
47169
+ extraStyles: "position: absolute;\n height: 200px;\n width: 100%;\n display: flex;\n justify-content: center;\n align-items: center;"
48267
47170
  }, /*#__PURE__*/React.createElement(Spinner$2, {
48268
47171
  size: "100",
48269
47172
  centerSpinner: true
48270
- })))));
47173
+ })), /*#__PURE__*/React.createElement(Stack, {
47174
+ childGap: "16px"
47175
+ }, /*#__PURE__*/React.createElement(Cluster, {
47176
+ nowrap: true,
47177
+ justify: "space-between",
47178
+ align: "start"
47179
+ }, /*#__PURE__*/React.createElement(LoadingLine, {
47180
+ exactWidth: "110",
47181
+ height: "27px"
47182
+ }), /*#__PURE__*/React.createElement(LoadingLine, {
47183
+ exactWidth: "60",
47184
+ height: "27px"
47185
+ })), /*#__PURE__*/React.createElement(SolidDivider$1, null), /*#__PURE__*/React.createElement(Box, {
47186
+ padding: "0.5rem 0"
47187
+ }, /*#__PURE__*/React.createElement(Cluster, {
47188
+ justify: "space-between",
47189
+ align: "start"
47190
+ }, /*#__PURE__*/React.createElement(LoadingLine, {
47191
+ exactWidth: "80",
47192
+ height: "27px"
47193
+ }), /*#__PURE__*/React.createElement(LoadingLine, {
47194
+ exactWidth: "60",
47195
+ height: "27px"
47196
+ })), /*#__PURE__*/React.createElement(Box, {
47197
+ padding: "4px 0"
47198
+ }), /*#__PURE__*/React.createElement(Cluster, {
47199
+ justify: "space-between",
47200
+ align: "start"
47201
+ }, /*#__PURE__*/React.createElement(LoadingLine, {
47202
+ exactWidth: "100",
47203
+ height: "27px"
47204
+ }), /*#__PURE__*/React.createElement(LoadingLine, {
47205
+ exactWidth: "50",
47206
+ height: "27px"
47207
+ }))), /*#__PURE__*/React.createElement(SolidDivider$1, null), /*#__PURE__*/React.createElement(Stack, {
47208
+ justify: "space-between",
47209
+ direction: "row"
47210
+ }, /*#__PURE__*/React.createElement(LoadingLine, {
47211
+ exactWidth: "55",
47212
+ height: "30px"
47213
+ }), /*#__PURE__*/React.createElement(LoadingLine, {
47214
+ exactWidth: "70",
47215
+ height: "30px"
47216
+ }))));
48271
47217
  };
48272
47218
 
48273
47219
  var ErrorDetails = function ErrorDetails() {
@@ -48556,7 +47502,6 @@ var AccountAndRoutingModal = function AccountAndRoutingModal(_ref) {
48556
47502
  toggleOpen(false);
48557
47503
  }
48558
47504
  }, /*#__PURE__*/React.createElement(Text$1, {
48559
- role: "button",
48560
47505
  variant: "pS",
48561
47506
  onClick: function onClick() {
48562
47507
  return toggleOpen(true);
@@ -48684,12 +47629,9 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
48684
47629
  showTerms = _useState2[0],
48685
47630
  toggleShowTerms = _useState2[1];
48686
47631
 
48687
- return /*#__PURE__*/React.createElement(DisplayBox$1, {
48688
- dataQa: "TermsAndConditionsControlV1"
48689
- }, /*#__PURE__*/React.createElement(Stack, null, /*#__PURE__*/React.createElement(Checkbox$1, {
47632
+ return /*#__PURE__*/React.createElement(DisplayBox$1, null, /*#__PURE__*/React.createElement(Stack, null, /*#__PURE__*/React.createElement(Checkbox$1, {
48690
47633
  name: "terms",
48691
47634
  title: "Terms and Conditions",
48692
- dataQa: "Terms and Conditions",
48693
47635
  error: error,
48694
47636
  checked: isChecked,
48695
47637
  onChange: onCheck
@@ -48790,8 +47732,7 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
48790
47732
  minWidth: displayInline ? "0" : "100%",
48791
47733
  background: displayInline ? "transparent" : containerBackground,
48792
47734
  boxShadow: displayInline ? "none" : standardBoxShadow,
48793
- borderRadius: displayInline ? "0" : "4px",
48794
- dataQa: "TermsAndConditionsControlV2"
47735
+ borderRadius: displayInline ? "0" : "4px"
48795
47736
  }, /*#__PURE__*/React.createElement(Stack, {
48796
47737
  childGap: "0"
48797
47738
  }, html && /*#__PURE__*/React.createElement(Box, {
@@ -49412,7 +48353,8 @@ var PhoneForm = function PhoneForm(_ref) {
49412
48353
  return e.key === "Enter" && handleSubmit(e);
49413
48354
  },
49414
48355
  autocompleteValue: "tel",
49415
- dataQa: "Phone number"
48356
+ dataQa: "Phone number",
48357
+ isNum: true
49416
48358
  }), showWalletCheckbox && /*#__PURE__*/React.createElement(Checkbox$1, {
49417
48359
  name: "phone checkbox",
49418
48360
  title: "Save phone number to wallet",
@@ -50537,5 +49479,5 @@ var SidebarStackContent = function SidebarStackContent(_ref) {
50537
49479
 
50538
49480
  var SidebarStackContent$1 = withWindowSize(themeComponent(SidebarStackContent, "Global", fallbackValues$U));
50539
49481
 
50540
- export { AccountNumberImage, AccountsAddIcon$1 as AccountsAddIcon, AccountsIcon$1 as AccountsIcon, AccountsIconSmall$1 as AccountsIconSmall, AchReturnIcon, AddObligation$1 as AddObligation, AddressForm, Alert$1 as Alert, AllocatedIcon, AmountCallout$1 as AmountCallout, ArrowDownCircleIconSmall, ArrowLeftCircleIconMedium, ArrowLeftCircleIconSmall, ArrowRightCircleIconSmall, ArrowRightIcon, ArrowUpCircleIconSmall, AutopayIcon, AutopayOnIcon, Badge$1 as Badge, BankIcon, BankIconLarge, Banner$1 as Banner, Box, BoxWithShadow$1 as BoxWithShadow, Breadcrumbs as Breadcrumb, ButtonWithAction, ButtonWithLink, CalendarIcon, Card$1 as Card, CarrotIcon$1 as CarrotIcon, CashIcon, Center, CenterSingle$1 as CenterSingle, CenterStack$1 as CenterStack, ChangePasswordForm, ChargebackIcon, ChargebackIconMedium, ChargebackIconSmall, ChargebackReversalIcon, ChargebackReversalIconMedium, ChargebackReversalIconSmall, CheckIcon, Checkbox$1 as Checkbox, CheckboxList$1 as CheckboxList, CheckmarkIcon, ChevronIcon$1 as ChevronIcon, Cluster, CollapsibleSection$1 as CollapsibleSection, Copyable, CountryDropdown, Cover, CustomerSearchIcon, DefaultPageTemplate, Detail$1 as Detail, DisplayBox$1 as DisplayBox, DisplayCard, Dropdown$1 as Dropdown, DuplicateIcon, EditNameForm, EditableList, EditableTable, EmailForm, EmptyCartIcon$1 as EmptyCartIcon, ErroredIcon, ExternalLink, ExternalLinkIcon, FailedIcon, FindIconSmall$1 as FindIconSmall, FooterWithSubfooter$1 as FooterWithSubfooter, ForgotPasswordForm, ForgotPasswordIcon$1 as ForgotPasswordIcon, FormContainer$1 as FormContainer, FormFooterPanel$1 as FormFooterPanel, FormInput$1 as FormInput, FormInputColumn, FormInputRow, FormSelect$1 as FormSelect, FormattedAddress$1 as FormattedAddress, FormattedBankAccount$1 as FormattedBankAccount, FormattedCreditCard$1 as FormattedCreditCard, Frame, GenericCard, GenericCardLarge, GenericErrorIcon, GoToEmailIcon$1 as GoToEmailIcon, Grid, GuidedCheckoutImage, HamburgerButton, Heading$1 as Heading, HighlightTabRow$1 as HighlightTabRow, HistoryIconSmall$1 as HistoryIconSmall, IconAdd, IconQuitLarge, ImageBox, Imposter, InternalLink, Jumbo$1 as Jumbo, KioskImage, LabeledAmount$1 as LabeledAmount, LineItem$1 as LineItem, LinkCard$1 as LinkCard, Loading, LoadingLine, LoginForm, Modal$1 as Modal, Module$1 as Module, Motion, NavFooter, NavHeader, NavMenuDesktop$1 as NavMenuDesktop, NavMenuMobile$1 as NavMenuMobile, NavTabs, NoCustomerResultsIcon, NoPaymentResultsIcon, NotFoundIcon, Obligation, iconsMap as ObligationIcons, Pagination$1 as Pagination, Paragraph$1 as Paragraph, PartialAmountForm, PasswordRequirements, PaymentButtonBar, PaymentDetails$1 as PaymentDetails, PaymentFormACH, PaymentFormCard$1 as PaymentFormCard, PaymentMethodAddIcon$1 as PaymentMethodAddIcon, PaymentMethodIcon$1 as PaymentMethodIcon, PaymentSearchIcon, PaymentsIconSmall$1 as PaymentsIconSmall, PencilIcon$1 as PencilIcon, PendingIcon, PeriscopeDashboardIframe, PeriscopeFailedIcon, PhoneForm, Placeholder$1 as Placeholder, PlusCircleIcon, PointOfSaleImage, Popover$1 as Popover, ProcessingFee$1 as ProcessingFee, ProfileIcon$1 as ProfileIcon, ProfileIconSmall$1 as ProfileIconSmall, ProfileImage, PropertiesAddIcon$1 as PropertiesAddIcon, PropertiesIconSmall$1 as PropertiesIconSmall, RadioButton$2 as RadioButton, RadioButtonWithLabel$1 as RadioButtonWithLabel, RadioGroup, RadioSection$1 as RadioSection, Reel, RefundIcon, RefundIconMedium, RefundIconSmall, RegistrationForm, RejectedIcon, RejectedVelocityIcon, ResetConfirmationForm$1 as ResetConfirmationForm, ResetPasswordForm, ResetPasswordIcon, ResetPasswordSuccess, RevenueManagementImage, RoutingNumberImage, SearchIcon, SearchableSelect$1 as SearchableSelect, SettingsIconSmall$1 as SettingsIconSmall, ShoppingCartIcon, Sidebar, SidebarSingleContent$1 as SidebarSingleContent, SidebarStackContent$1 as SidebarStackContent, SolidDivider$1 as SolidDivider, Spinner$2 as Spinner, Stack, StandardCheckoutImage, FormStateDropdown as StateProvinceDropdown, StatusUnknownIcon, SuccessfulIcon, SuccessfulIconMedium, SuccessfulIconSmall, Switcher, TabSidebar$1 as TabSidebar, Table_styled as Table, TableBody_styled as TableBody, TableCell_styled as TableCell, TableHead$1 as TableHead, TableHeading_styled as TableHeading, TableListItem, TableRow$1 as TableRow, Tabs$1 as Tabs, TermsAndConditions, TermsAndConditionsModal$1 as TermsAndConditionsModal, Text$1 as Text, Timeout$1 as Timeout, TimeoutImage, Title$1 as Title, ToggleSwitch$1 as ToggleSwitch, TrashIcon$1 as TrashIcon, TypeaheadInput, VerifiedEmailIcon$1 as VerifiedEmailIcon, VoidedIcon, WalletBannerIcon$1 as WalletBannerIcon, WalletIcon$1 as WalletIcon, WalletIconSmall$1 as WalletIconSmall, WarningIconXS, WelcomeModule$1 as WelcomeModule, WorkflowTile, XCircleIconMedium, XCircleIconSmall, cardRegistry, index$5 as constants, createPartialAmountFormState, index$4 as util, withWindowSize };
49482
+ export { AccountNumberImage, AccountsAddIcon$1 as AccountsAddIcon, AccountsIcon$1 as AccountsIcon, AccountsIconSmall$1 as AccountsIconSmall, AchReturnIcon, AddObligation$1 as AddObligation, AddressForm, Alert$1 as Alert, AllocatedIcon, AmountCallout$1 as AmountCallout, ArrowDownCircleIconSmall, ArrowLeftCircleIconMedium, ArrowLeftCircleIconSmall, ArrowRightCircleIconSmall, ArrowRightIcon, ArrowUpCircleIconSmall, AutopayIcon, AutopayOnIcon, Badge$1 as Badge, BankIcon, BankIconLarge, Banner$1 as Banner, Box, BoxWithShadow$1 as BoxWithShadow, Breadcrumbs as Breadcrumb, ButtonWithAction, ButtonWithLink, CalendarIcon, Card$1 as Card, CarrotIcon$1 as CarrotIcon, CashIcon, Center, CenterSingle$1 as CenterSingle, CenterStack$1 as CenterStack, ChangePasswordForm, ChargebackIcon, ChargebackIconMedium, ChargebackIconSmall, ChargebackReversalIcon, ChargebackReversalIconMedium, ChargebackReversalIconSmall, CheckIcon, Checkbox$1 as Checkbox, CheckboxList$1 as CheckboxList, CheckmarkIcon, ChevronIcon$1 as ChevronIcon, Cluster, CollapsibleSection$1 as CollapsibleSection, Copyable, CountryDropdown, Cover, CustomerSearchIcon, DefaultPageTemplate, Detail$1 as Detail, DisplayBox$1 as DisplayBox, DisplayCard, Dropdown$1 as Dropdown, DuplicateIcon, EditNameForm, EditableList, EditableTable, EmailForm, EmptyCartIcon$1 as EmptyCartIcon, ErroredIcon, ExternalLink, ExternalLinkIcon, FailedIcon, FindIconSmall$1 as FindIconSmall, FooterWithSubfooter$1 as FooterWithSubfooter, ForgotPasswordForm, ForgotPasswordIcon$1 as ForgotPasswordIcon, FormContainer$1 as FormContainer, FormFooterPanel$1 as FormFooterPanel, FormInput$1 as FormInput, FormInputColumn, FormInputRow, FormSelect$1 as FormSelect, FormattedAddress$1 as FormattedAddress, FormattedBankAccount$1 as FormattedBankAccount, FormattedCreditCard$1 as FormattedCreditCard, Frame, GenericCard, GenericCardLarge, GenericErrorIcon, GoToEmailIcon$1 as GoToEmailIcon, Grid, GuidedCheckoutImage, HamburgerButton, Heading$1 as Heading, HighlightTabRow$1 as HighlightTabRow, HistoryIconSmall$1 as HistoryIconSmall, IconAdd, IconQuitLarge, ImageBox, Imposter, InternalLink, Jumbo$1 as Jumbo, KioskImage, LabeledAmount$1 as LabeledAmount, LineItem$1 as LineItem, LinkCard$1 as LinkCard, Loading, LoadingLine, LoginForm, Modal$1 as Modal, Module$1 as Module, Motion, NavFooter, NavHeader, NavMenuDesktop$1 as NavMenuDesktop, NavMenuMobile$1 as NavMenuMobile, NavTabs, NoCustomerResultsIcon, NoPaymentResultsIcon, NotFoundIcon, Obligation, iconsMap as ObligationIcons, Pagination$1 as Pagination, Paragraph$1 as Paragraph, PartialAmountForm, PasswordRequirements, PaymentButtonBar, PaymentDetails$1 as PaymentDetails, PaymentFormACH, PaymentFormCard$1 as PaymentFormCard, PaymentMethodAddIcon$1 as PaymentMethodAddIcon, PaymentMethodIcon$1 as PaymentMethodIcon, PaymentSearchIcon, PaymentsIconSmall$1 as PaymentsIconSmall, PencilIcon$1 as PencilIcon, PendingIcon, PeriscopeDashboardIframe, PeriscopeFailedIcon, PhoneForm, Placeholder$1 as Placeholder, PlusCircleIcon, PointOfSaleImage, Popover$1 as Popover, ProcessingFee$1 as ProcessingFee, ProfileIcon$1 as ProfileIcon, ProfileIconSmall$1 as ProfileIconSmall, ProfileImage, PropertiesAddIcon$1 as PropertiesAddIcon, PropertiesIconSmall$1 as PropertiesIconSmall, RadioButton$2 as RadioButton, RadioButtonWithLabel$1 as RadioButtonWithLabel, RadioGroup, RadioSection$1 as RadioSection, Reel, RefundIcon, RefundIconMedium, RefundIconSmall, RegistrationForm, RejectedIcon, RejectedVelocityIcon, ResetConfirmationForm$1 as ResetConfirmationForm, ResetPasswordForm, ResetPasswordIcon, ResetPasswordSuccess, RevenueManagementImage, RoutingNumberImage, SearchIcon, SearchableSelect$1 as SearchableSelect, SettingsIconSmall$1 as SettingsIconSmall, ShoppingCartIcon, Sidebar, SidebarSingleContent$1 as SidebarSingleContent, SidebarStackContent$1 as SidebarStackContent, SolidDivider$1 as SolidDivider, Spinner$2 as Spinner, Stack, StandardCheckoutImage, FormStateDropdown as StateProvinceDropdown, StatusUnknownIcon, SuccessfulIcon, SuccessfulIconMedium, SuccessfulIconSmall, Switcher, TabSidebar$1 as TabSidebar, Table_styled as Table, TableBody_styled as TableBody, TableCell_styled as TableCell, TableHead$1 as TableHead, TableHeading_styled as TableHeading, TableListItem, TableRow$1 as TableRow, Tabs$1 as Tabs, TermsAndConditions, TermsAndConditionsModal$1 as TermsAndConditionsModal, Text$1 as Text, Timeout$1 as Timeout, TimeoutImage, Title$1 as Title, ToggleSwitch$1 as ToggleSwitch, TrashIcon$1 as TrashIcon, TypeaheadInput, VerifiedEmailIcon$1 as VerifiedEmailIcon, VoidedIcon, WalletBannerIcon$1 as WalletBannerIcon, WalletIcon$1 as WalletIcon, WalletIconSmall$1 as WalletIconSmall, WarningIconXS, WelcomeModule$1 as WelcomeModule, WorkflowTile, XCircleIconMedium, XCircleIconSmall, cardRegistry, index$5 as constants, createPartialAmountFormState, createPartialAmountFormValidators, index$4 as util, withWindowSize };
50541
49483
  //# sourceMappingURL=index.esm.js.map