@mercoa/react 0.0.38-rc1 → 0.0.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -5060,14 +5060,14 @@ IO.write = function(e, r, t, n, o, a) {
5060
5060
  return g = +g, _ = _ >>> 0, F || Y(this, g, _, 4, 4294967295, 0), this[_] = g >>> 24, this[_ + 1] = g >>> 16, this[_ + 2] = g >>> 8, this[_ + 3] = g & 255, _ + 4;
5061
5061
  };
5062
5062
  function he(T, g, _, F, ee) {
5063
- Ee(g, F, ee, T, _, 7);
5063
+ Pe(g, F, ee, T, _, 7);
5064
5064
  let ce = Number(g & BigInt(4294967295));
5065
5065
  T[_++] = ce, ce = ce >> 8, T[_++] = ce, ce = ce >> 8, T[_++] = ce, ce = ce >> 8, T[_++] = ce;
5066
5066
  let me = Number(g >> BigInt(32) & BigInt(4294967295));
5067
5067
  return T[_++] = me, me = me >> 8, T[_++] = me, me = me >> 8, T[_++] = me, me = me >> 8, T[_++] = me, _;
5068
5068
  }
5069
5069
  function le(T, g, _, F, ee) {
5070
- Ee(g, F, ee, T, _, 7);
5070
+ Pe(g, F, ee, T, _, 7);
5071
5071
  let ce = Number(g & BigInt(4294967295));
5072
5072
  T[_ + 7] = ce, ce = ce >> 8, T[_ + 6] = ce, ce = ce >> 8, T[_ + 5] = ce, ce = ce >> 8, T[_ + 4] = ce;
5073
5073
  let me = Number(g >> BigInt(32) & BigInt(4294967295));
@@ -5235,7 +5235,7 @@ IO.write = function(e, r, t, n, o, a) {
5235
5235
  function ye(T, g, _) {
5236
5236
  Me(g, "offset"), (T[g] === void 0 || T[g + _] === void 0) && Ae(g, T.length - (_ + 1));
5237
5237
  }
5238
- function Ee(T, g, _, F, ee, ce) {
5238
+ function Pe(T, g, _, F, ee, ce) {
5239
5239
  if (T > _ || T < g) {
5240
5240
  const me = typeof g == "bigint" ? "n" : "";
5241
5241
  let Ve;
@@ -5782,12 +5782,12 @@ var $D = {}, nb = {}, AD = { exports: {} };
5782
5782
  }, v = function(te) {
5783
5783
  return te.replace(/[^A-Za-z0-9\+\/]/g, "");
5784
5784
  }, w = function(te) {
5785
- for (var ie, oe, fe, ye, Ee = "", Me = te.length % 3, Ae = 0; Ae < te.length; ) {
5785
+ for (var ie, oe, fe, ye, Pe = "", Me = te.length % 3, Ae = 0; Ae < te.length; ) {
5786
5786
  if ((oe = te.charCodeAt(Ae++)) > 255 || (fe = te.charCodeAt(Ae++)) > 255 || (ye = te.charCodeAt(Ae++)) > 255)
5787
5787
  throw new TypeError("invalid character found");
5788
- ie = oe << 16 | fe << 8 | ye, Ee += f[ie >> 18 & 63] + f[ie >> 12 & 63] + f[ie >> 6 & 63] + f[ie & 63];
5788
+ ie = oe << 16 | fe << 8 | ye, Pe += f[ie >> 18 & 63] + f[ie >> 12 & 63] + f[ie >> 6 & 63] + f[ie & 63];
5789
5789
  }
5790
- return Me ? Ee.slice(0, Me - 3) + "===".substring(Me) : Ee;
5790
+ return Me ? Pe.slice(0, Me - 3) + "===".substring(Me) : Pe;
5791
5791
  }, S = a ? function(te) {
5792
5792
  return btoa(te);
5793
5793
  } : i ? function(te) {
@@ -5836,8 +5836,8 @@ var $D = {}, nb = {}, AD = { exports: {} };
5836
5836
  if (te = te.replace(/\s+/g, ""), !h.test(te))
5837
5837
  throw new TypeError("malformed base64.");
5838
5838
  te += "==".slice(2 - (te.length & 3));
5839
- for (var ie, oe = "", fe, ye, Ee = 0; Ee < te.length; )
5840
- ie = p[te.charAt(Ee++)] << 18 | p[te.charAt(Ee++)] << 12 | (fe = p[te.charAt(Ee++)]) << 6 | (ye = p[te.charAt(Ee++)]), oe += fe === 64 ? m(ie >> 16 & 255) : ye === 64 ? m(ie >> 16 & 255, ie >> 8 & 255) : m(ie >> 16 & 255, ie >> 8 & 255, ie & 255);
5839
+ for (var ie, oe = "", fe, ye, Pe = 0; Pe < te.length; )
5840
+ ie = p[te.charAt(Pe++)] << 18 | p[te.charAt(Pe++)] << 12 | (fe = p[te.charAt(Pe++)]) << 6 | (ye = p[te.charAt(Pe++)]), oe += fe === 64 ? m(ie >> 16 & 255) : ye === 64 ? m(ie >> 16 & 255, ie >> 8 & 255) : m(ie >> 16 & 255, ie >> 8 & 255, ie & 255);
5841
5841
  return oe;
5842
5842
  }, C = o ? function(te) {
5843
5843
  return atob(v(te));
@@ -30108,7 +30108,7 @@ function loe(e = {}) {
30108
30108
  errors: t.errors
30109
30109
  }), de)
30110
30110
  throw de;
30111
- }, Ee = (I, q = {}) => {
30111
+ }, Pe = (I, q = {}) => {
30112
30112
  Se(n, I) && (rt(q.defaultValue) ? R(I, qt(Se(o, I))) : (R(I, q.defaultValue), Yr(o, I, qt(q.defaultValue))), q.keepTouched || Xt(t.touchedFields, I), q.keepDirty || (Xt(t.dirtyFields, I), t.isDirty = q.defaultValue ? $(I, qt(Se(o, I))) : $()), q.keepError || (Xt(t.errors, I), f.isValid && v()), p.state.next({ ...t }));
30113
30113
  }, Me = (I, q = {}) => {
30114
30114
  const re = I ? qt(I) : o, de = qt(re), ue = Fn(I), k = ue ? o : de;
@@ -30232,7 +30232,7 @@ function loe(e = {}) {
30232
30232
  setValue: R,
30233
30233
  getValues: ne,
30234
30234
  reset: Ae,
30235
- resetField: Ee,
30235
+ resetField: Pe,
30236
30236
  clearErrors: he,
30237
30237
  unregister: we,
30238
30238
  setError: le,
@@ -32471,7 +32471,7 @@ function cae(e, r) {
32471
32471
  })), Y = Ie((oe) => (z({ type: 5, id: oe }), () => z({ type: 5, id: null }))), he = Ie((oe) => Wr(C.mode, { 0() {
32472
32472
  return S == null ? void 0 : S(oe);
32473
32473
  }, 1() {
32474
- let fe = C.value.slice(), ye = fe.findIndex((Ee) => O(Ee, oe));
32474
+ let fe = C.value.slice(), ye = fe.findIndex((Pe) => O(Pe, oe));
32475
32475
  return ye === -1 ? fe.push(oe) : fe.splice(ye, 1), S == null ? void 0 : S(fe);
32476
32476
  } })), le = Ie((oe) => {
32477
32477
  z({ type: 6, trigger: oe });
@@ -32480,9 +32480,9 @@ function cae(e, r) {
32480
32480
  te.current && n !== void 0 && ie.addEventListener(te.current, "reset", () => {
32481
32481
  S == null || S(n);
32482
32482
  });
32483
- }, [te, S]), B.createElement(mj.Provider, { value: be }, B.createElement(hj.Provider, { value: C }, B.createElement(dj, { value: Wr(C.comboboxState, { 0: Ct.Open, 1: Ct.Closed }) }, i != null && w != null && pj({ [i]: w }).map(([oe, fe], ye) => B.createElement(Xl, { features: Bc.Hidden, ref: ye === 0 ? (Ee) => {
32483
+ }, [te, S]), B.createElement(mj.Provider, { value: be }, B.createElement(hj.Provider, { value: C }, B.createElement(dj, { value: Wr(C.comboboxState, { 0: Ct.Open, 1: Ct.Closed }) }, i != null && w != null && pj({ [i]: w }).map(([oe, fe], ye) => B.createElement(Xl, { features: Bc.Hidden, ref: ye === 0 ? (Pe) => {
32484
32484
  var Me;
32485
- te.current = (Me = Ee == null ? void 0 : Ee.closest("form")) != null ? Me : null;
32485
+ te.current = (Me = Pe == null ? void 0 : Pe.closest("form")) != null ? Me : null;
32486
32486
  } : void 0, ...Ih({ key: oe, as: "input", type: "hidden", hidden: !0, readOnly: !0, form: a, disabled: u, name: oe, value: fe }) })), bt({ ourProps: we, theirProps: y, slot: N, defaultTag: sae, name: "Combobox" }))));
32487
32487
  }
32488
32488
  let uae = "input";
@@ -33162,13 +33162,13 @@ function jie(e, r) {
33162
33162
  var ye;
33163
33163
  return (ye = z.panelRef.current) != null ? ye : y.current;
33164
33164
  } }, { resolveContainers: A, mainTreeNodeRef: C, MainTreeNode: N } = cie({ portals: O, defaultContainers: [V] }), R = P ? "parent" : "leaf", J = m !== null ? (m & Ct.Closing) === Ct.Closing : !1, W = U || J ? !1 : M, Q = Tt(() => {
33165
- var ye, Ee;
33166
- return (Ee = Array.from((ye = v == null ? void 0 : v.querySelectorAll("body > *")) != null ? ye : []).find((Me) => Me.id === "headlessui-portal-root" ? !1 : Me.contains(C.current) && Me instanceof HTMLElement)) != null ? Ee : null;
33165
+ var ye, Pe;
33166
+ return (Pe = Array.from((ye = v == null ? void 0 : v.querySelectorAll("body > *")) != null ? ye : []).find((Me) => Me.id === "headlessui-portal-root" ? !1 : Me.contains(C.current) && Me instanceof HTMLElement)) != null ? Pe : null;
33167
33167
  }, [C]);
33168
33168
  $P(Q, W);
33169
33169
  let ne = P ? !0 : M, Y = Tt(() => {
33170
- var ye, Ee;
33171
- return (Ee = Array.from((ye = v == null ? void 0 : v.querySelectorAll("[data-headlessui-portal]")) != null ? ye : []).find((Me) => Me.contains(C.current) && Me instanceof HTMLElement)) != null ? Ee : null;
33170
+ var ye, Pe;
33171
+ return (Pe = Array.from((ye = v == null ? void 0 : v.querySelectorAll("[data-headlessui-portal]")) != null ? ye : []).find((Me) => Me.contains(C.current) && Me instanceof HTMLElement)) != null ? Pe : null;
33172
33172
  }, [C]);
33173
33173
  $P(Y, ne), uj(A, (ye) => {
33174
33174
  ye.preventDefault(), E();
@@ -33179,8 +33179,8 @@ function jie(e, r) {
33179
33179
  }), gie(v, !(J || j !== 0 || U), A), ge(() => {
33180
33180
  if (j !== 0 || !y.current)
33181
33181
  return;
33182
- let ye = new ResizeObserver((Ee) => {
33183
- for (let Me of Ee) {
33182
+ let ye = new ResizeObserver((Pe) => {
33183
+ for (let Me of Pe) {
33184
33184
  let Ae = Me.target.getBoundingClientRect();
33185
33185
  Ae.x === 0 && Ae.y === 0 && Ae.width === 0 && Ae.height === 0 && E();
33186
33186
  }
@@ -33188,8 +33188,8 @@ function jie(e, r) {
33188
33188
  return ye.observe(y.current), () => ye.disconnect();
33189
33189
  }, [j, y, E]);
33190
33190
  let [we, te] = die(), ie = fr(() => [{ dialogState: j, close: E, setTitleId: D }, z], [j, z, E, D]), oe = fr(() => ({ open: j === 0 }), [j]), fe = { ref: b, id: n, role: s, "aria-modal": j === 0 ? !0 : void 0, "aria-labelledby": z.titleId, "aria-describedby": we };
33191
- return B.createElement(lie, { type: "Dialog", enabled: j === 0, element: y, onUpdate: Ie((ye, Ee) => {
33192
- Ee === "Dialog" && Wr(ye, { [w0.Add]: () => p((Me) => Me + 1), [w0.Remove]: () => p((Me) => Me - 1) });
33191
+ return B.createElement(lie, { type: "Dialog", enabled: j === 0, element: y, onUpdate: Ie((ye, Pe) => {
33192
+ Pe === "Dialog" && Wr(ye, { [w0.Add]: () => p((Me) => Me + 1), [w0.Remove]: () => p((Me) => Me - 1) });
33193
33193
  }) }, B.createElement(b0, { force: !0 }, B.createElement(g0, null, B.createElement(Nh.Provider, { value: ie }, B.createElement(g0.Group, { target: y }, B.createElement(b0, { force: !1 }, B.createElement(te, { slot: oe, name: "Dialog.Description" }, B.createElement(ml, { initialFocus: i, containers: A, features: M ? Wr(R, { parent: ml.features.RestoreFocus, leaf: ml.features.All & ~ml.features.FocusLock }) : ml.features.None }, B.createElement($, null, bt({ ourProps: fe, theirProps: l, slot: oe, defaultTag: _ie, features: Oie, visible: j === 0, name: "Dialog" }))))))))), B.createElement(N, null));
33194
33194
  }
33195
33195
  let xie = "div";
@@ -37501,7 +37501,7 @@ function dN({
37501
37501
  });
37502
37502
  }, [(z = o.entity) == null ? void 0 : z.id, o.token, o.refreshId, f]);
37503
37503
  function j(O) {
37504
- b(O), O && (l(!1), r == null || r(O));
37504
+ b(O), r == null || r(O), O && l(!1);
37505
37505
  }
37506
37506
  if (y != null && y.id && (y == null ? void 0 : y.id) !== "new" && !u)
37507
37507
  return /* @__PURE__ */ d.jsx(d.Fragment, {
@@ -37522,7 +37522,7 @@ function dN({
37522
37522
  })]
37523
37523
  }), /* @__PURE__ */ d.jsxs("button", {
37524
37524
  onClick: () => {
37525
- b(void 0);
37525
+ j(void 0);
37526
37526
  },
37527
37527
  type: "button",
37528
37528
  className: "mercoa-ml-4 mercoa-flex-shrink-0 mercoa-p-1 mercoa-text-mercoa-primary-text hover:mercoa-opacity-75",
@@ -38163,7 +38163,7 @@ function rle({
38163
38163
  type: n,
38164
38164
  children: o
38165
38165
  }) {
38166
- var S, j, z, x, E, D, M, P, U, O, $, V, A, C, N, R, J, W, Q, ne, Y, he, le, be, we, te, ie, oe, fe, ye, Ee, Me, Ae, _e, Oe, pe;
38166
+ var S, j, z, x, E, D, M, P, U, O, $, V, A, C, N, R, J, W, Q, ne, Y, he, le, be, we, te, ie, oe, fe, ye, Pe, Me, Ae, _e, Oe, pe;
38167
38167
  const a = Ke(), [i, s] = ae(!1), [u, l] = ae(void 0), [f, p] = ae(e);
38168
38168
  if (ge(() => {
38169
38169
  if (!a.client || !a.entityId || !r || e || f)
@@ -38241,7 +38241,7 @@ function rle({
38241
38241
  }), /* @__PURE__ */ d.jsxs("div", {
38242
38242
  children: [/* @__PURE__ */ d.jsxs("dd", {
38243
38243
  className: "mercoa-text-2xl mercoa-font-semibold mercoa-leading-6 mercoa-text-gray-900 mercoa-inline",
38244
- children: [((J = f.profile) == null ? void 0 : J.business) && ((W = e == null ? void 0 : e.profile.business) == null ? void 0 : W.legalBusinessName), ((Q = f.profile) == null ? void 0 : Q.individual) && `${rN((he = (Y = (ne = f.profile) == null ? void 0 : ne.individual) == null ? void 0 : Y.name) == null ? void 0 : he.firstName, (we = (be = (le = f.profile) == null ? void 0 : le.individual) == null ? void 0 : be.name) == null ? void 0 : we.lastName, (oe = (ie = (te = f.profile) == null ? void 0 : te.individual) == null ? void 0 : ie.name) == null ? void 0 : oe.middleName, (Ee = (ye = (fe = f.profile) == null ? void 0 : fe.individual) == null ? void 0 : ye.name) == null ? void 0 : Ee.suffix)}`]
38244
+ children: [((J = f.profile) == null ? void 0 : J.business) && ((W = e == null ? void 0 : e.profile.business) == null ? void 0 : W.legalBusinessName), ((Q = f.profile) == null ? void 0 : Q.individual) && `${rN((he = (Y = (ne = f.profile) == null ? void 0 : ne.individual) == null ? void 0 : Y.name) == null ? void 0 : he.firstName, (we = (be = (le = f.profile) == null ? void 0 : le.individual) == null ? void 0 : be.name) == null ? void 0 : we.lastName, (oe = (ie = (te = f.profile) == null ? void 0 : te.individual) == null ? void 0 : ie.name) == null ? void 0 : oe.middleName, (Pe = (ye = (fe = f.profile) == null ? void 0 : fe.individual) == null ? void 0 : ye.name) == null ? void 0 : Pe.suffix)}`]
38245
38245
  }), t && /* @__PURE__ */ d.jsx("div", {
38246
38246
  className: "mercoa-text-sm mercoa-leading-6 mercoa-text-gray-400 mercoa-select-all",
38247
38247
  children: f.id
@@ -39558,17 +39558,17 @@ var gN = { exports: {} };
39558
39558
  var R = this, J = this.$locale();
39559
39559
  if (!this.isValid())
39560
39560
  return J.invalidDate || b;
39561
- var W = N || "YYYY-MM-DDTHH:mm:ssZ", Q = O.z(this), ne = this.$H, Y = this.$m, he = this.$M, le = J.weekdays, be = J.months, we = J.meridiem, te = function(fe, ye, Ee, Me) {
39562
- return fe && (fe[ye] || fe(R, W)) || Ee[ye].slice(0, Me);
39561
+ var W = N || "YYYY-MM-DDTHH:mm:ssZ", Q = O.z(this), ne = this.$H, Y = this.$m, he = this.$M, le = J.weekdays, be = J.months, we = J.meridiem, te = function(fe, ye, Pe, Me) {
39562
+ return fe && (fe[ye] || fe(R, W)) || Pe[ye].slice(0, Me);
39563
39563
  }, ie = function(fe) {
39564
39564
  return O.s(ne % 12 || 12, fe, "0");
39565
- }, oe = we || function(fe, ye, Ee) {
39565
+ }, oe = we || function(fe, ye, Pe) {
39566
39566
  var Me = fe < 12 ? "AM" : "PM";
39567
- return Ee ? Me.toLowerCase() : Me;
39567
+ return Pe ? Me.toLowerCase() : Me;
39568
39568
  };
39569
39569
  return W.replace(w, function(fe, ye) {
39570
- return ye || function(Ee) {
39571
- switch (Ee) {
39570
+ return ye || function(Pe) {
39571
+ switch (Pe) {
39572
39572
  case "YY":
39573
39573
  return String(R.$y).slice(-2);
39574
39574
  case "YYYY":
@@ -40191,7 +40191,7 @@ function zN(e) {
40191
40191
  }, 0);
40192
40192
  }, ye = function(_e) {
40193
40193
  N.current = null, clearTimeout(R.current.focusTimeout), clearTimeout(R.current.setCaretTimeout), v(_e);
40194
- }, Ee = A && Dle() ? "numeric" : void 0, Me = Object.assign({ inputMode: Ee }, x, {
40194
+ }, Pe = A && Dle() ? "numeric" : void 0, Me = Object.assign({ inputMode: Pe }, x, {
40195
40195
  type: r,
40196
40196
  value: M,
40197
40197
  onChange: te,
@@ -41922,7 +41922,7 @@ function Nj({
41922
41922
  onOnboardingSubmit: t,
41923
41923
  onCancel: n
41924
41924
  }) {
41925
- var y, b, v, w, S, j, z, x, E, D, M, P, U, O, $, V, A, C, N, R, J, W, Q, ne, Y, he, le, be, we, te, ie, oe, fe, ye, Ee, Me, Ae, _e, Oe, pe;
41925
+ var y, b, v, w, S, j, z, x, E, D, M, P, U, O, $, V, A, C, N, R, J, W, Q, ne, Y, he, le, be, we, te, ie, oe, fe, ye, Pe, Me, Ae, _e, Oe, pe;
41926
41926
  const o = Ke(), {
41927
41927
  register: a,
41928
41928
  handleSubmit: i,
@@ -41950,7 +41950,7 @@ function Nj({
41950
41950
  country: ((te = (we = e.profile.individual) == null ? void 0 : we.address) == null ? void 0 : te.country) ?? ((oe = (ie = e.profile.business) == null ? void 0 : ie.address) == null ? void 0 : oe.country) ?? "US",
41951
41951
  taxID: (fe = e.profile.individual) != null && fe.governmentIdProvided ? "****" : (ye = e.profile.business) != null && ye.taxIdProvided ? "**-*******" : "",
41952
41952
  dob: /* @__PURE__ */ new Date(),
41953
- legalBusinessName: ((Ee = e.profile.business) == null ? void 0 : Ee.legalBusinessName) ?? "",
41953
+ legalBusinessName: ((Pe = e.profile.business) == null ? void 0 : Pe.legalBusinessName) ?? "",
41954
41954
  doingBusinessAs: (Me = e.profile.business) == null ? void 0 : Me.doingBusinessAs,
41955
41955
  description: (Ae = e.profile.business) == null ? void 0 : Ae.description,
41956
41956
  website: (_e = e.profile.business) == null ? void 0 : _e.website,
@@ -43786,8 +43786,8 @@ function Ude({
43786
43786
  te = te.replace(/^#/, ""), te.length === 3 && (te = te[0] + te[0] + te[1] + te[1] + te[2] + te[2]);
43787
43787
  let [oe, fe, ye] = te.match(/.{2}/g);
43788
43788
  [oe, fe, ye] = [parseInt(oe, 16) + ie, parseInt(fe, 16) + ie, parseInt(ye, 16) + ie], oe = Math.max(Math.min(255, oe), 0).toString(16), fe = Math.max(Math.min(255, fe), 0).toString(16), ye = Math.max(Math.min(255, ye), 0).toString(16);
43789
- const Ee = (oe.length < 2 ? "0" : "") + oe, Me = (fe.length < 2 ? "0" : "") + fe, Ae = (ye.length < 2 ? "0" : "") + ye;
43790
- return `#${Ee}${Me}${Ae}`;
43789
+ const Pe = (oe.length < 2 ? "0" : "") + oe, Me = (fe.length < 2 ? "0" : "") + fe, Ae = (ye.length < 2 ? "0" : "") + ye;
43790
+ return `#${Pe}${Me}${Ae}`;
43791
43791
  }, ne = v.colorScheme.logoBackgroundColor || "transparent", Y = v.colorScheme.primaryColor || "#4f46e5", he = Q(Y, 40), le = Q(Y, -40);
43792
43792
  let be = Y, we = "#ffffff";
43793
43793
  Y === "#f8fafc" && (be = "#111827", we = "#111827"), document.documentElement.style.setProperty("--mercoa-logo-background", ne), document.documentElement.style.setProperty("--mercoa-primary", Y), document.documentElement.style.setProperty("--mercoa-primary-light", he), document.documentElement.style.setProperty("--mercoa-primary-dark", le), document.documentElement.style.setProperty("--mercoa-primary-text", be), document.documentElement.style.setProperty("--mercoa-primary-text-invert", we);
@@ -48851,10 +48851,10 @@ function V_(e, r, t, n) {
48851
48851
  !(n != null && n.useAdditionalWeekYearTokens) && vR(oe) && Yh(oe, D, e), !(n != null && n.useAdditionalDayOfYearTokens) && bR(oe) && Yh(oe, D, e);
48852
48852
  var fe = oe[0], ye = phe[fe];
48853
48853
  if (ye) {
48854
- var Ee = ye.incompatibleTokens;
48855
- if (Array.isArray(Ee)) {
48854
+ var Pe = ye.incompatibleTokens;
48855
+ if (Array.isArray(Pe)) {
48856
48856
  var Me = C.find(function(_e) {
48857
- return Ee.includes(_e.token) || _e.token === fe;
48857
+ return Pe.includes(_e.token) || _e.token === fe;
48858
48858
  });
48859
48859
  if (Me)
48860
48860
  throw new RangeError("The format string mustn't contain `".concat(Me.fullToken, "` and `").concat(oe, "` at the same time"));
@@ -49907,7 +49907,7 @@ function Vye(e) {
49907
49907
  var V, A = z === "y" ? Kn : Xn, C = z === "y" ? xo : Mo, N = z === "y" ? "height" : "width", R = E[z], J = R + v[A], W = R - v[C], Q = m ? -M[N] / 2 : 0, ne = S === qc ? D[N] : M[N], Y = S === qc ? -M[N] : -D[N], he = r.elements.arrow, le = m && he ? qj(he) : {
49908
49908
  width: 0,
49909
49909
  height: 0
49910
- }, be = r.modifiersData["arrow#persistent"] ? r.modifiersData["arrow#persistent"].padding : FR(), we = be[A], te = be[C], ie = Fl(0, D[N], le[N]), oe = j ? D[N] / 2 - Q - ie - we - U.mainAxis : ne - ie - we - U.mainAxis, fe = j ? -D[N] / 2 + Q + ie + te + U.mainAxis : Y + ie + te + U.mainAxis, ye = r.elements.arrow && Np(r.elements.arrow), Ee = ye ? z === "y" ? ye.clientTop || 0 : ye.clientLeft || 0 : 0, Me = (V = O == null ? void 0 : O[z]) != null ? V : 0, Ae = R + oe - Me - Ee, _e = R + fe - Me, Oe = Fl(m ? ey(J, Ae) : J, R, m ? gs(W, _e) : W);
49910
+ }, be = r.modifiersData["arrow#persistent"] ? r.modifiersData["arrow#persistent"].padding : FR(), we = be[A], te = be[C], ie = Fl(0, D[N], le[N]), oe = j ? D[N] / 2 - Q - ie - we - U.mainAxis : ne - ie - we - U.mainAxis, fe = j ? -D[N] / 2 + Q + ie + te + U.mainAxis : Y + ie + te + U.mainAxis, ye = r.elements.arrow && Np(r.elements.arrow), Pe = ye ? z === "y" ? ye.clientTop || 0 : ye.clientLeft || 0 : 0, Me = (V = O == null ? void 0 : O[z]) != null ? V : 0, Ae = R + oe - Me - Pe, _e = R + fe - Me, Oe = Fl(m ? ey(J, Ae) : J, R, m ? gs(W, _e) : W);
49911
49911
  E[z] = Oe, $[z] = Oe - R;
49912
49912
  }
49913
49913
  if (s) {
@@ -53131,7 +53131,7 @@ function Rve() {
53131
53131
  }), W({
53132
53132
  type: "reset"
53133
53133
  });
53134
- }, [o, fe, we, D]), Ee = Tt(function() {
53134
+ }, [o, fe, we, D]), Pe = Tt(function() {
53135
53135
  if (Y.current) {
53136
53136
  W({
53137
53137
  type: "openDialog"
@@ -53157,8 +53157,8 @@ function Rve() {
53157
53157
  type: "openDialog"
53158
53158
  }), $(), C.current.value = null, C.current.click());
53159
53159
  }, [W, $, V, w, fe, we, O, s]), Me = Tt(function(Z) {
53160
- !A.current || !A.current.isEqualNode(Z.target) || (Z.key === " " || Z.key === "Enter" || Z.keyCode === 32 || Z.keyCode === 13) && (Z.preventDefault(), Ee());
53161
- }, [A, Ee]), Ae = Tt(function() {
53160
+ !A.current || !A.current.isEqualNode(Z.target) || (Z.key === " " || Z.key === "Enter" || Z.keyCode === 32 || Z.keyCode === 13) && (Z.preventDefault(), Pe());
53161
+ }, [A, Pe]), Ae = Tt(function() {
53162
53162
  W({
53163
53163
  type: "focus"
53164
53164
  });
@@ -53167,8 +53167,8 @@ function Rve() {
53167
53167
  type: "blur"
53168
53168
  });
53169
53169
  }, []), Oe = Tt(function() {
53170
- z || (vve() ? setTimeout(Ee, 0) : Ee());
53171
- }, [z, Ee]), pe = function(se) {
53170
+ z || (vve() ? setTimeout(Pe, 0) : Pe());
53171
+ }, [z, Pe]), pe = function(se) {
53172
53172
  return n ? null : se;
53173
53173
  }, I = function(se) {
53174
53174
  return x ? null : pe(se);
@@ -53217,7 +53217,7 @@ function Rve() {
53217
53217
  getInputProps: k,
53218
53218
  rootRef: A,
53219
53219
  inputRef: C,
53220
- open: pe(Ee)
53220
+ open: pe(Pe)
53221
53221
  });
53222
53222
  }
53223
53223
  function $ve(e, r) {
@@ -53719,11 +53719,11 @@ function Gve({
53719
53719
  admin: s
53720
53720
  }) {
53721
53721
  var Oe, pe, I, q, re, de, ue, k, Z, se, ve, T, g, _, F, ee, ce, me, Ve, nr, Ye, Ur, pr, $i;
53722
- const u = Ke(), [l, f] = ae([]), [p, h] = ae([]), [m, y] = ae([]), [b, v] = ae([]), [w, S] = ae(e == null ? void 0 : e.vendor), [j, z] = ae([]), [x, E] = ae(!1), D = (Pe) => {
53722
+ const u = Ke(), [l, f] = ae([]), [p, h] = ae([]), [m, y] = ae([]), [b, v] = ae([]), [w, S] = ae(e == null ? void 0 : e.vendor), [j, z] = ae([]), [x, E] = ae(!1), D = (Ee) => {
53723
53723
  const [or, ar] = ae(0);
53724
53724
  return kc(() => {
53725
- ar(Pe.current.getBoundingClientRect().width);
53726
- }, [Pe]), sR(Pe, (ot) => ar(ot.contentRect.width)), or;
53725
+ ar(Ee.current.getBoundingClientRect().width);
53726
+ }, [Ee]), sR(Ee, (ot) => ar(ot.contentRect.width)), or;
53727
53727
  }, M = De(null), P = D(M);
53728
53728
  let U = "mercoa-grid-cols-1";
53729
53729
  P && P > 300 && (U = "mercoa-grid-cols-2"), P && P > 500 && (U = "mercoa-grid-cols-3"), P && P > 700 && (U = "mercoa-grid-cols-4"), P && P > 900 && (U = "mercoa-grid-cols-5"), P && P > 1100 && (U = "mercoa-grid-cols-6");
@@ -53792,9 +53792,9 @@ function Gve({
53792
53792
  saveAsDraft: !1,
53793
53793
  saveAsAdmin: !1,
53794
53794
  metadata: JSON.stringify((e == null ? void 0 : e.metadata) ?? {}),
53795
- approvers: e != null && e.approvers ? e.approvers.map((Pe) => ({
53796
- approvalSlotId: Pe.approvalSlotId,
53797
- assignedUserId: Pe.assignedUserId
53795
+ approvers: e != null && e.approvers ? e.approvers.map((Ee) => ({
53796
+ approvalSlotId: Ee.approvalSlotId,
53797
+ assignedUserId: Ee.assignedUserId
53798
53798
  })) : [],
53799
53799
  newBankAccount: {
53800
53800
  routingNumber: "",
@@ -53813,9 +53813,9 @@ function Gve({
53813
53813
  }
53814
53814
  });
53815
53815
  ge(() => {
53816
- A("approvers", e != null && e.approvers ? e.approvers.map((Pe) => ({
53817
- approvalSlotId: Pe.approvalSlotId,
53818
- assignedUserId: Pe.assignedUserId
53816
+ A("approvers", e != null && e.approvers ? e.approvers.map((Ee) => ({
53817
+ approvalSlotId: Ee.approvalSlotId,
53818
+ assignedUserId: Ee.assignedUserId
53819
53819
  })) : []);
53820
53820
  }, [e]);
53821
53821
  const ne = R("currency"), Y = R("vendorId"), he = R("vendorName"), le = R("paymentDestinationId"), be = R("paymentSourceId"), we = R("approvers"), te = R("metadata");
@@ -53836,8 +53836,8 @@ function Gve({
53836
53836
  control: W,
53837
53837
  name: "lineItems"
53838
53838
  });
53839
- function ye(Pe) {
53840
- if (Pe != null && Pe.find((ar) => isNaN(ar.amount))) {
53839
+ function ye(Ee) {
53840
+ if (Ee != null && Ee.find((ar) => isNaN(ar.amount))) {
53841
53841
  C("amount", {
53842
53842
  type: "manual",
53843
53843
  message: "Please enter a valid number"
@@ -53845,20 +53845,20 @@ function Gve({
53845
53845
  return;
53846
53846
  }
53847
53847
  let or = new N1(0);
53848
- Pe == null || Pe.forEach((ar, ot) => {
53848
+ Ee == null || Ee.forEach((ar, ot) => {
53849
53849
  or = or.add(Number(ar.amount));
53850
53850
  }), N("amount"), A("amount", or.toNumber()), J("amount");
53851
53851
  }
53852
- async function Ee() {
53852
+ async function Pe() {
53853
53853
  var or, ar, ot;
53854
53854
  if (!u.token || !((or = u.entity) != null && or.id) || !u.client)
53855
53855
  return;
53856
- const Pe = await ((ot = u.client) == null ? void 0 : ot.entity.paymentMethod.getAll((ar = u.entity) == null ? void 0 : ar.id));
53857
- Pe && f(Pe);
53856
+ const Ee = await ((ot = u.client) == null ? void 0 : ot.entity.paymentMethod.getAll((ar = u.entity) == null ? void 0 : ar.id));
53857
+ Ee && f(Ee);
53858
53858
  }
53859
53859
  ge(() => {
53860
- var Pe, or;
53861
- !u.token || !((Pe = u.entity) != null && Pe.id) || !u.client || (Ee(), (or = u.client) == null || or.customPaymentMethodSchema.getAll().then((ar) => {
53860
+ var Ee, or;
53861
+ !u.token || !((Ee = u.entity) != null && Ee.id) || !u.client || (Pe(), (or = u.client) == null || or.customPaymentMethodSchema.getAll().then((ar) => {
53862
53862
  var ot, So;
53863
53863
  if (ar) {
53864
53864
  h(ar);
@@ -53869,8 +53869,8 @@ function Gve({
53869
53869
  }
53870
53870
  }));
53871
53871
  }, [u.client, (re = u.entity) == null ? void 0 : re.id, u.token]), ge(() => {
53872
- var Pe, or;
53873
- !u.token || !((Pe = u.entity) != null && Pe.id) || (or = u.client) == null || or.entity.metadata.getAll(u.entity.id).then((ar) => {
53872
+ var Ee, or;
53873
+ !u.token || !((Ee = u.entity) != null && Ee.id) || (or = u.client) == null || or.entity.metadata.getAll(u.entity.id).then((ar) => {
53874
53874
  u.debug({
53875
53875
  entityMetadata: ar
53876
53876
  }), ar && z(ar);
@@ -53879,18 +53879,28 @@ function Gve({
53879
53879
  });
53880
53880
  }, [(de = u.entity) == null ? void 0 : de.id, u.refreshId, u.token]), ge(() => {
53881
53881
  b.length > 0 && A("currency", (e == null ? void 0 : e.currency) ?? b[0]);
53882
- }, [b]);
53882
+ }, [b]), ge(() => {
53883
+ if (!w)
53884
+ A("vendorId", ""), A("vendorName", ""), N("vendorId"), N("vendorName");
53885
+ else {
53886
+ if (w.id === "new")
53887
+ return;
53888
+ w.id && (u.debug({
53889
+ selectedVendor: w
53890
+ }), A("vendorId", w.id), A("vendorName", w.name), N("vendorId"), N("vendorName"));
53891
+ }
53892
+ }, [w]);
53883
53893
  async function Me() {
53884
53894
  var or;
53885
53895
  if (!u.token || !Y)
53886
53896
  return;
53887
- const Pe = await ((or = u.client) == null ? void 0 : or.entity.paymentMethod.getAll(Y));
53888
- Pe && y(Pe);
53897
+ const Ee = await ((or = u.client) == null ? void 0 : or.entity.paymentMethod.getAll(Y));
53898
+ Ee && y(Ee);
53889
53899
  }
53890
53900
  ge(() => {
53891
53901
  Me();
53892
53902
  }, [u.client, Y, u.token]);
53893
- const Ae = ((ue = l.find((Pe) => Pe.id === be)) == null ? void 0 : ue.type) === "offPlatform";
53903
+ const Ae = ((ue = l.find((Ee) => Ee.id === be)) == null ? void 0 : ue.type) === "offPlatform";
53894
53904
  ge(() => {
53895
53905
  Y && Ae && b$({
53896
53906
  entityId: Y,
@@ -53900,14 +53910,14 @@ function Gve({
53900
53910
  clearErrors: N,
53901
53911
  mercoaSession: u,
53902
53912
  refreshPaymentMethods: async () => {
53903
- await Ee(), await Me();
53913
+ await Pe(), await Me();
53904
53914
  }
53905
53915
  });
53906
53916
  }, [Y, Ae]), ge(() => {
53907
- var Pe, or, ar, ot, So, Fo;
53917
+ var Ee, or, ar, ot, So, Fo;
53908
53918
  r && (u.debug({
53909
53919
  ocrResponse: r
53910
- }), r.invoice.amount && A("amount", r.invoice.amount), r.invoice.invoiceNumber && A("invoiceNumber", r.invoice.invoiceNumber), r.invoice.invoiceDate && A("invoiceDate", qe(r.invoice.invoiceDate.toDateString()).toDate()), r.invoice.dueDate && A("dueDate", qe(r.invoice.dueDate.toDateString()).toDate()), r.invoice.deductionDate && A("deductionDate", qe(r.invoice.deductionDate.toDateString()).toDate()), r.invoice.currency && A("currency", r.invoice.currency), r.invoice.metadata && A("metadata", JSON.stringify(r.invoice.metadata)), r.invoice.lineItems && ((ar = (or = (Pe = u.iframeOptions) == null ? void 0 : Pe.options) == null ? void 0 : or.invoice) == null ? void 0 : ar.lineItems) != L.Mercoa.LineItemAvailabilities.Disabled && A("lineItems", r.invoice.lineItems.map((Mn) => ({
53920
+ }), r.invoice.amount && A("amount", r.invoice.amount), r.invoice.invoiceNumber && A("invoiceNumber", r.invoice.invoiceNumber), r.invoice.invoiceDate && A("invoiceDate", qe(r.invoice.invoiceDate.toDateString()).toDate()), r.invoice.dueDate && A("dueDate", qe(r.invoice.dueDate.toDateString()).toDate()), r.invoice.deductionDate && A("deductionDate", qe(r.invoice.deductionDate.toDateString()).toDate()), r.invoice.currency && A("currency", r.invoice.currency), r.invoice.metadata && A("metadata", JSON.stringify(r.invoice.metadata)), r.invoice.lineItems && ((ar = (or = (Ee = u.iframeOptions) == null ? void 0 : Ee.options) == null ? void 0 : or.invoice) == null ? void 0 : ar.lineItems) != L.Mercoa.LineItemAvailabilities.Disabled && A("lineItems", r.invoice.lineItems.map((Mn) => ({
53911
53921
  description: Mn.description ?? "",
53912
53922
  currency: Mn.currency ?? "USD",
53913
53923
  amount: Mn.amount ?? 0,
@@ -53933,13 +53943,13 @@ function Gve({
53933
53943
  payToTheOrderOf: r.check.payToTheOrderOf
53934
53944
  }), w || (r.vendor.id === "new" && ((Fo = (So = (ot = u.iframeOptions) == null ? void 0 : ot.options) == null ? void 0 : So.vendors) != null && Fo.disableCreation) ? u.debug("new vendor creation disabled") : r.vendor.id && (u.debug("setting selected vendor", r.vendor), S(r.vendor))));
53935
53945
  }, [r, w]);
53936
- const _e = async (Pe) => {
53946
+ const _e = async (Ee) => {
53937
53947
  var ot, So, Fo, Mn, ya, sx, cx, ux, lx, dx, fx, px, mx, hx, yx, bx, vx, gx, wx, _x, Ox;
53938
53948
  if (!u.token || !((ot = u.entity) != null && ot.id))
53939
53949
  return;
53940
53950
  let or = L.Mercoa.InvoiceStatus.Draft;
53941
- if (s && Pe.saveAsAdmin)
53942
- or = Pe.status;
53951
+ if (s && Ee.saveAsAdmin)
53952
+ or = Ee.status;
53943
53953
  else if ((e == null ? void 0 : e.status) === L.Mercoa.InvoiceStatus.Draft)
53944
53954
  or = L.Mercoa.InvoiceStatus.New;
53945
53955
  else if ((e == null ? void 0 : e.status) === L.Mercoa.InvoiceStatus.New)
@@ -53952,26 +53962,26 @@ function Gve({
53952
53962
  }
53953
53963
  E(!0);
53954
53964
  const ar = {
53955
- status: Pe.saveAsDraft ? (e == null ? void 0 : e.status) ?? L.Mercoa.InvoiceStatus.Draft : or,
53956
- amount: Number(Pe.amount),
53957
- currency: Pe.currency,
53958
- invoiceDate: Pe.invoiceDate,
53959
- deductionDate: Pe.deductionDate,
53960
- dueDate: Pe.dueDate,
53961
- invoiceNumber: Pe.invoiceNumber,
53962
- noteToSelf: Pe.description,
53965
+ status: Ee.saveAsDraft ? (e == null ? void 0 : e.status) ?? L.Mercoa.InvoiceStatus.Draft : or,
53966
+ amount: Number(Ee.amount),
53967
+ currency: Ee.currency,
53968
+ invoiceDate: Ee.invoiceDate,
53969
+ deductionDate: Ee.deductionDate,
53970
+ dueDate: Ee.dueDate,
53971
+ invoiceNumber: Ee.invoiceNumber,
53972
+ noteToSelf: Ee.description,
53963
53973
  payerId: (So = u.entity) == null ? void 0 : So.id,
53964
- paymentSourceId: Pe.paymentSourceId,
53965
- approvers: Pe.approvers.filter((cr) => cr.assignedUserId),
53966
- vendorId: Pe.vendorId,
53967
- paymentDestinationId: Pe.paymentDestinationId,
53968
- ...Pe.paymentMethodDestinationType === "check" && {
53969
- paymentDestinationOptions: Pe.paymentDestinationOptions ?? {
53974
+ paymentSourceId: Ee.paymentSourceId,
53975
+ approvers: Ee.approvers.filter((cr) => cr.assignedUserId),
53976
+ vendorId: Ee.vendorId,
53977
+ paymentDestinationId: Ee.paymentDestinationId,
53978
+ ...Ee.paymentMethodDestinationType === "check" && {
53979
+ paymentDestinationOptions: Ee.paymentDestinationOptions ?? {
53970
53980
  type: "check",
53971
53981
  delivery: "MAIL"
53972
53982
  }
53973
53983
  },
53974
- lineItems: Pe.lineItems.map((cr) => ({
53984
+ lineItems: Ee.lineItems.map((cr) => ({
53975
53985
  ...cr.id && {
53976
53986
  id: cr.id
53977
53987
  },
@@ -53980,16 +53990,16 @@ function Gve({
53980
53990
  quantity: Number(cr.quantity),
53981
53991
  unitPrice: Number(cr.unitPrice),
53982
53992
  metadata: cr.metadata,
53983
- currency: Pe.currency ?? "USD",
53993
+ currency: Ee.currency ?? "USD",
53984
53994
  glAccountId: cr.glAccountId
53985
53995
  })),
53986
- metadata: JSON.parse(Pe.metadata),
53996
+ metadata: JSON.parse(Ee.metadata),
53987
53997
  document: t,
53988
53998
  creatorEntityId: (Fo = u.entity) == null ? void 0 : Fo.id,
53989
53999
  creatorUserId: (Mn = u.user) == null ? void 0 : Mn.id
53990
54000
  };
53991
54001
  if (u.debug({
53992
- data: Pe,
54002
+ data: Ee,
53993
54003
  invoiceData: ar
53994
54004
  }), (ya = u.organization) != null && ya.metadataSchema)
53995
54005
  for (const [cr, Ys] of Object.entries((ar == null ? void 0 : ar.metadata) ?? {})) {
@@ -54002,8 +54012,8 @@ function Gve({
54002
54012
  return;
54003
54013
  }
54004
54014
  }
54005
- if (!Pe.saveAsDraft) {
54006
- if (!Pe.vendorId && (e != null && e.id)) {
54015
+ if (!Ee.saveAsDraft) {
54016
+ if (!Ee.vendorId && (e != null && e.id)) {
54007
54017
  je.error("Please select a vendor"), C("vendorId", {
54008
54018
  type: "manual",
54009
54019
  message: "Please select a vendor"
@@ -54021,7 +54031,7 @@ function Gve({
54021
54031
  let cr = new N1(0);
54022
54032
  if (ar.lineItems.forEach((Ys, Ws) => {
54023
54033
  cr = cr.add(Number(Ys.amount));
54024
- }), cr.toNumber() !== Number(Pe.amount)) {
54034
+ }), cr.toNumber() !== Number(Ee.amount)) {
54025
54035
  C("amount", {
54026
54036
  type: "manual",
54027
54037
  message: "Line item amounts do not match total amount"
@@ -54029,21 +54039,21 @@ function Gve({
54029
54039
  return;
54030
54040
  }
54031
54041
  }
54032
- if (Number(Pe.amount) < 0.01) {
54042
+ if (Number(Ee.amount) < 0.01) {
54033
54043
  je.error("Amount must be at least 0.01"), C("amount", {
54034
54044
  type: "manual",
54035
54045
  message: "Amount must be at least 0.01"
54036
54046
  }), E(!1);
54037
54047
  return;
54038
54048
  }
54039
- if (!Pe.paymentSourceId && (e != null && e.id)) {
54049
+ if (!Ee.paymentSourceId && (e != null && e.id)) {
54040
54050
  je.error("Please select a payment source"), C("paymentSourceId", {
54041
54051
  type: "manual",
54042
54052
  message: "Please select how you want to pay"
54043
54053
  }), E(!1);
54044
54054
  return;
54045
54055
  }
54046
- if (!Pe.paymentDestinationId && (e != null && e.id)) {
54056
+ if (!Ee.paymentDestinationId && (e != null && e.id)) {
54047
54057
  je.error("Please select a payment destination"), C("paymentDestinationId", {
54048
54058
  type: "manual",
54049
54059
  message: "Please select how the vendor wants to get paid"
@@ -54064,8 +54074,8 @@ function Gve({
54064
54074
  }), E(!1);
54065
54075
  return;
54066
54076
  }
54067
- if (((vx = m.find((cr) => cr.id === Pe.paymentDestinationId)) == null ? void 0 : vx.type) === "check") {
54068
- const cr = l.find((Ys) => Ys.id === Pe.paymentSourceId);
54077
+ if (((vx = m.find((cr) => cr.id === Ee.paymentDestinationId)) == null ? void 0 : vx.type) === "check") {
54078
+ const cr = l.find((Ys) => Ys.id === Ee.paymentSourceId);
54069
54079
  if ((cr == null ? void 0 : cr.type) !== "bankAccount") {
54070
54080
  C("paymentSourceId", {
54071
54081
  type: "manual",
@@ -54124,16 +54134,10 @@ function Gve({
54124
54134
  className: "mercoa-mt-2 mercoa-flex mercoa-items-center mercoa-justify-left",
54125
54135
  children: /* @__PURE__ */ d.jsx(dN, {
54126
54136
  type: "payee",
54127
- onSelect: (Pe) => {
54137
+ onSelect: (Ee) => {
54128
54138
  u.debug({
54129
- vendor: Pe
54130
- }), S(Pe), A("vendorId", (Pe == null ? void 0 : Pe.id) ?? void 0, {
54131
- shouldTouch: !0,
54132
- shouldDirty: !0
54133
- }), A("vendorName", (Pe == null ? void 0 : Pe.name) ?? void 0, {
54134
- shouldTouch: !0,
54135
- shouldDirty: !0
54136
- }), N("vendorId");
54139
+ vendor: Ee
54140
+ }), S(Ee);
54137
54141
  },
54138
54142
  counterparty: w
54139
54143
  })
@@ -54156,8 +54160,8 @@ function Gve({
54156
54160
  className: "mercoa-col-span-full",
54157
54161
  children: /* @__PURE__ */ d.jsx(ox, {
54158
54162
  currentStatuses: e != null && e.status ? [e.status] : void 0,
54159
- onStatusChange: ([Pe]) => {
54160
- console.log(Pe), A("status", Pe);
54163
+ onStatusChange: ([Ee]) => {
54164
+ console.log(Ee), A("status", Ee);
54161
54165
  }
54162
54166
  })
54163
54167
  }), /* @__PURE__ */ d.jsx(Xe, {
@@ -54185,9 +54189,9 @@ function Gve({
54185
54189
  }), /* @__PURE__ */ d.jsx("select", {
54186
54190
  ...$("currency"),
54187
54191
  className: "mercoa-h-full mercoa-rounded-md mercoa-border-0 mercoa-bg-transparent mercoa-py-0 mercoa-pl-2 mercoa-pr-7 mercoa-text-gray-500 focus:mercoa-ring-1 focus:mercoa-ring-inset focus:mercoa-ring-mercoa-primary sm:mercoa-text-sm",
54188
- children: b.map((Pe, or) => /* @__PURE__ */ d.jsx("option", {
54189
- value: Pe,
54190
- children: Pe
54192
+ children: b.map((Ee, or) => /* @__PURE__ */ d.jsx("option", {
54193
+ value: Ee,
54194
+ children: Ee
54191
54195
  }, or))
54192
54196
  })]
54193
54197
  }),
@@ -54247,15 +54251,15 @@ function Gve({
54247
54251
  currency: ne,
54248
54252
  watch: R,
54249
54253
  hasDocument: !!t || !!(e != null && e.hasDocuments),
54250
- paymentDestination: m.find((Pe) => Pe.id === le),
54251
- paymentSource: l.find((Pe) => Pe.id === be),
54254
+ paymentDestination: m.find((Ee) => Ee.id === le),
54255
+ paymentSource: l.find((Ee) => Ee.id === be),
54252
54256
  setValue: A,
54253
54257
  entityMetadata: j,
54254
54258
  calculateTotalAmountFromLineItems: ye
54255
54259
  })
54256
- }), (((me = (ce = (ee = u.organization) == null ? void 0 : ee.metadataSchema) == null ? void 0 : ce.filter((Pe) => !Pe.lineItem && v$({
54257
- schema: Pe,
54258
- entityMetadata: j.find((or) => or.key === Pe.key),
54260
+ }), (((me = (ce = (ee = u.organization) == null ? void 0 : ee.metadataSchema) == null ? void 0 : ce.filter((Ee) => !Ee.lineItem && v$({
54261
+ schema: Ee,
54262
+ entityMetadata: j.find((or) => or.key === Ee.key),
54259
54263
  hasDocument: !!t || !!(e != null && e.hasDocuments),
54260
54264
  hasNoLineItems: ie.length === 0,
54261
54265
  paymentDestination: m.find((or) => or.id === le),
@@ -54267,11 +54271,11 @@ function Gve({
54267
54271
  htmlFor: "vendor-name",
54268
54272
  className: "mercoa-block mercoa-text-lg mercoa-font-medium mercoa-leading-6 mercoa-text-gray-700 mercoa-mb-2 mercoa-col-span-full",
54269
54273
  children: "Additional Invoice Details"
54270
- }), (nr = (Ve = u.organization) == null ? void 0 : Ve.metadataSchema) == null ? void 0 : nr.map((Pe) => {
54271
- const or = JSON.parse(te ?? {}), ar = or == null ? void 0 : or[Pe.key];
54274
+ }), (nr = (Ve = u.organization) == null ? void 0 : Ve.metadataSchema) == null ? void 0 : nr.map((Ee) => {
54275
+ const or = JSON.parse(te ?? {}), ar = or == null ? void 0 : or[Ee.key];
54272
54276
  return /* @__PURE__ */ d.jsx(tx, {
54273
- entityMetadata: j.find((ot) => ot.key === Pe.key),
54274
- schema: Pe,
54277
+ entityMetadata: j.find((ot) => ot.key === Ee.key),
54278
+ schema: Ee,
54275
54279
  value: ar,
54276
54280
  hasDocument: !!t || !!(e != null && e.hasDocuments),
54277
54281
  hasNoLineItems: ie.length === 0,
@@ -54280,12 +54284,12 @@ function Gve({
54280
54284
  setValue: (ot) => {
54281
54285
  Array.isArray(ot) && (ot = ot.join(","));
54282
54286
  const So = JSON.parse(te ?? {});
54283
- So[Pe.key] = `${ot}`, A("metadata", JSON.stringify(So), {
54287
+ So[Ee.key] = `${ot}`, A("metadata", JSON.stringify(So), {
54284
54288
  shouldDirty: !0,
54285
54289
  shouldTouch: !0
54286
54290
  });
54287
54291
  }
54288
- }, Pe.key);
54292
+ }, Ee.key);
54289
54293
  })]
54290
54294
  }), /* @__PURE__ */ d.jsx("div", {
54291
54295
  className: "mercoa-border-b mercoa-border-gray-900/10 mercoa-pb-6 mercoa-col-span-full"
@@ -54303,14 +54307,14 @@ function Gve({
54303
54307
  setValue: A,
54304
54308
  clearErrors: N,
54305
54309
  refreshVendorPaymentMethods: Me,
54306
- refreshPayerPaymentMethods: Ee
54310
+ refreshPayerPaymentMethods: Pe
54307
54311
  }), ((Ye = Q.paymentSourceId) == null ? void 0 : Ye.message) && /* @__PURE__ */ d.jsx("p", {
54308
54312
  className: "mercoa-text-sm mercoa-text-red-500",
54309
54313
  children: (Ur = Q.paymentSourceId) == null ? void 0 : Ur.message.toString()
54310
54314
  })]
54311
54315
  }), /* @__PURE__ */ d.jsx("div", {
54312
54316
  className: "mercoa-border-b mercoa-border-gray-900/10 mercoa-pb-6 mercoa-col-span-full"
54313
- }), he && !Ae && /* @__PURE__ */ d.jsxs("div", {
54317
+ }), w && Y && he && !Ae && /* @__PURE__ */ d.jsxs("div", {
54314
54318
  className: "mercoa-border-b mercoa-border-gray-900/10 mercoa-pb-16 mercoa-col-span-full",
54315
54319
  children: [/* @__PURE__ */ d.jsxs("h2", {
54316
54320
  className: "mercoa-block mercoa-text-lg mercoa-font-medium mercoa-leading-6 mercoa-text-gray-700 mercoa-mt-5",
@@ -54328,7 +54332,7 @@ function Gve({
54328
54332
  setValue: A,
54329
54333
  clearErrors: N,
54330
54334
  refreshVendorPaymentMethods: Me,
54331
- refreshPayerPaymentMethods: Ee
54335
+ refreshPayerPaymentMethods: Pe
54332
54336
  }), ((pr = Q.paymentDestinationId) == null ? void 0 : pr.message) && /* @__PURE__ */ d.jsx("p", {
54333
54337
  className: "mercoa-text-sm mercoa-text-red-500",
54334
54338
  children: ($i = Q.paymentDestinationId) == null ? void 0 : $i.message.toString()
@@ -55073,11 +55077,11 @@ function tx({
55073
55077
  }))
55074
55078
  return /* @__PURE__ */ d.jsx(d.Fragment, {});
55075
55079
  const h = /* @__PURE__ */ d.jsxs(d.Fragment, {
55076
- children: [(e.type === L.Mercoa.MetadataType.String || e.type === L.Mercoa.MetadataType.Number) && /* @__PURE__ */ d.jsx(nge, {
55080
+ children: [(!(f != null && f.value) && e.type === L.Mercoa.MetadataType.String || e.type === L.Mercoa.MetadataType.Number) && /* @__PURE__ */ d.jsx(nge, {
55077
55081
  schema: e,
55078
55082
  setValue: n,
55079
55083
  value: r
55080
- }), e.type === L.Mercoa.MetadataType.KeyValue && /* @__PURE__ */ d.jsx(rge, {
55084
+ }), ((f == null ? void 0 : f.value) && e.type === L.Mercoa.MetadataType.String || e.type === L.Mercoa.MetadataType.KeyValue) && /* @__PURE__ */ d.jsx(rge, {
55081
55085
  schema: e,
55082
55086
  setValue: n,
55083
55087
  value: r,
@@ -55604,7 +55608,7 @@ License: MIT
55604
55608
  0 < he.length && (be += V);
55605
55609
  }
55606
55610
  for (var oe = 0; oe < he.length; oe++) {
55607
- var fe = we ? Y.length : he[oe].length, ye = !1, Ee = we ? Object.keys(he[oe]).length === 0 : he[oe].length === 0;
55611
+ var fe = we ? Y.length : he[oe].length, ye = !1, Pe = we ? Object.keys(he[oe]).length === 0 : he[oe].length === 0;
55608
55612
  if (le && !we && (ye = le === "greedy" ? he[oe].join("").trim() === "" : he[oe].length === 1 && he[oe][0].length === 0), le === "greedy" && we) {
55609
55613
  for (var Me = [], Ae = 0; Ae < fe; Ae++) {
55610
55614
  var _e = te ? Y[Ae] : Ae;
@@ -55614,11 +55618,11 @@ License: MIT
55614
55618
  }
55615
55619
  if (!ye) {
55616
55620
  for (var Oe = 0; Oe < fe; Oe++) {
55617
- 0 < Oe && !Ee && (be += $);
55621
+ 0 < Oe && !Pe && (be += $);
55618
55622
  var pe = we && te ? Y[Oe] : Oe;
55619
55623
  be += ne(he[oe][pe], Oe);
55620
55624
  }
55621
- oe < he.length - 1 && (!le || 0 < fe && !Ee) && (be += V);
55625
+ oe < he.length - 1 && (!le || 0 < fe && !Pe) && (be += V);
55622
55626
  }
55623
55627
  }
55624
55628
  return be;
@@ -55828,8 +55832,8 @@ License: MIT
55828
55832
  })), we() && function() {
55829
55833
  if (!Y)
55830
55834
  return;
55831
- function oe(ye, Ee) {
55832
- D(M.transformHeader) && (ye = M.transformHeader(ye, Ee)), ne.push(ye);
55835
+ function oe(ye, Pe) {
55836
+ D(M.transformHeader) && (ye = M.transformHeader(ye, Pe)), ne.push(ye);
55833
55837
  }
55834
55838
  if (Array.isArray(Y.data[0])) {
55835
55839
  for (var fe = 0; we() && fe < Y.data.length; fe++)
@@ -55840,13 +55844,13 @@ License: MIT
55840
55844
  }(), function() {
55841
55845
  if (!Y || !M.header && !M.dynamicTyping && !M.transform)
55842
55846
  return Y;
55843
- function oe(ye, Ee) {
55847
+ function oe(ye, Pe) {
55844
55848
  var Me, Ae = M.header ? {} : [];
55845
55849
  for (Me = 0; Me < ye.length; Me++) {
55846
55850
  var _e = Me, Oe = ye[Me];
55847
55851
  M.header && (_e = Me >= ne.length ? "__parsed_extra" : ne[Me]), M.transform && (Oe = M.transform(Oe, _e)), Oe = te(_e, Oe), _e === "__parsed_extra" ? (Ae[_e] = Ae[_e] || [], Ae[_e].push(Oe)) : Ae[_e] = Oe;
55848
55852
  }
55849
- return M.header && (Me > ne.length ? ie("FieldMismatch", "TooManyFields", "Too many fields: expected " + ne.length + " fields but parsed " + Me, J + Ee) : Me < ne.length && ie("FieldMismatch", "TooFewFields", "Too few fields: expected " + ne.length + " fields but parsed " + Me, J + Ee)), Ae;
55853
+ return M.header && (Me > ne.length ? ie("FieldMismatch", "TooManyFields", "Too many fields: expected " + ne.length + " fields but parsed " + Me, J + Pe) : Me < ne.length && ie("FieldMismatch", "TooFewFields", "Too few fields: expected " + ne.length + " fields but parsed " + Me, J + Pe)), Ae;
55850
55854
  }
55851
55855
  var fe = 1;
55852
55856
  return !Y.data.length || Array.isArray(Y.data[0]) ? (Y.data = Y.data.map(oe), fe = Y.data.length) : Y.data = oe(Y.data, 0), M.header && Y.meta && (Y.meta.fields = ne), J += fe, Y;
@@ -55856,9 +55860,9 @@ License: MIT
55856
55860
  return M.header && ne.length === 0;
55857
55861
  }
55858
55862
  function te(oe, fe) {
55859
- return ye = oe, M.dynamicTypingFunction && M.dynamicTyping[ye] === void 0 && (M.dynamicTyping[ye] = M.dynamicTypingFunction(ye)), (M.dynamicTyping[ye] || M.dynamicTyping) === !0 ? fe === "true" || fe === "TRUE" || fe !== "false" && fe !== "FALSE" && (function(Ee) {
55860
- if (A.test(Ee)) {
55861
- var Me = parseFloat(Ee);
55863
+ return ye = oe, M.dynamicTypingFunction && M.dynamicTyping[ye] === void 0 && (M.dynamicTyping[ye] = M.dynamicTypingFunction(ye)), (M.dynamicTyping[ye] || M.dynamicTyping) === !0 ? fe === "true" || fe === "TRUE" || fe !== "false" && fe !== "FALSE" && (function(Pe) {
55864
+ if (A.test(Pe)) {
55865
+ var Me = parseFloat(Pe);
55862
55866
  if (V < Me && Me < $)
55863
55867
  return !0;
55864
55868
  }
@@ -55866,12 +55870,12 @@ License: MIT
55866
55870
  }(fe) ? parseFloat(fe) : C.test(fe) ? new Date(fe) : fe === "" ? null : fe) : fe;
55867
55871
  var ye;
55868
55872
  }
55869
- function ie(oe, fe, ye, Ee) {
55873
+ function ie(oe, fe, ye, Pe) {
55870
55874
  var Me = { type: oe, code: fe, message: ye };
55871
- Ee !== void 0 && (Me.row = Ee), Y.errors.push(Me);
55875
+ Pe !== void 0 && (Me.row = Pe), Y.errors.push(Me);
55872
55876
  }
55873
55877
  this.parse = function(oe, fe, ye) {
55874
- var Ee = M.quoteChar || '"';
55878
+ var Pe = M.quoteChar || '"';
55875
55879
  if (M.newline || (M.newline = function(_e, Oe) {
55876
55880
  _e = _e.substring(0, 1048576);
55877
55881
  var pe = new RegExp(v(Oe) + "([^]*?)" + v(Oe), "gm"), I = (_e = _e.replace(pe, "")).split("\r"), q = _e.split(`
@@ -55884,7 +55888,7 @@ License: MIT
55884
55888
  ` && de++;
55885
55889
  return de >= I.length / 2 ? `\r
55886
55890
  ` : "\r";
55887
- }(oe, Ee)), O = !1, M.delimiter)
55891
+ }(oe, Pe)), O = !1, M.delimiter)
55888
55892
  D(M.delimiter) && (M.delimiter = M.delimiter(oe), Y.meta.delimiter = M.delimiter);
55889
55893
  else {
55890
55894
  var Me = function(_e, Oe, pe, I, q) {
@@ -55939,18 +55943,18 @@ License: MIT
55939
55943
  if (!W)
55940
55944
  return ce();
55941
55945
  if (M.header && !Q) {
55942
- var ye = W.split(O)[0].split(U), Ee = [], Me = {}, Ae = !1;
55946
+ var ye = W.split(O)[0].split(U), Pe = [], Me = {}, Ae = !1;
55943
55947
  for (var _e in ye) {
55944
55948
  var Oe = ye[_e];
55945
55949
  D(M.transformHeader) && (Oe = M.transformHeader(Oe, _e));
55946
55950
  var pe = Oe, I = Me[Oe] || 0;
55947
- for (0 < I && (Ae = !0, pe = Oe + "_" + I), Me[Oe] = I + 1; Ee.includes(pe); )
55951
+ for (0 < I && (Ae = !0, pe = Oe + "_" + I), Me[Oe] = I + 1; Pe.includes(pe); )
55948
55952
  pe = pe + "_" + I;
55949
- Ee.push(pe);
55953
+ Pe.push(pe);
55950
55954
  }
55951
55955
  if (Ae) {
55952
55956
  var q = W.split(O);
55953
- q[0] = Ee.join(U), W = q.join(O);
55957
+ q[0] = Pe.join(U), W = q.join(O);
55954
55958
  }
55955
55959
  }
55956
55960
  if (C || C !== !1 && W.indexOf(P) === -1) {
@@ -56333,7 +56337,7 @@ function mge({
56333
56337
  const se = k.approvalPolicy;
56334
56338
  return se && se.length > 0 && (Z = L.Mercoa.InvoiceStatus.New), Z;
56335
56339
  }
56336
- async function Ee() {
56340
+ async function Pe() {
56337
56341
  var Z;
56338
56342
  if (!u.token || !((Z = u.entity) != null && Z.id))
56339
56343
  return;
@@ -56480,7 +56484,7 @@ function mge({
56480
56484
  k = g.data[g.data.length - 1].id, Z = [...Z, ...g.data], await se();
56481
56485
  else {
56482
56486
  const ce = O$.unparse(Z.map((Ye) => {
56483
- var Ur, pr, $i, Pe, or, ar;
56487
+ var Ur, pr, $i, Ee, or, ar;
56484
56488
  return {
56485
56489
  "Invoice ID": Ye.id,
56486
56490
  "Invoice Number": Ye.invoiceNumber,
@@ -56491,7 +56495,7 @@ function mge({
56491
56495
  "Payer ID": (Ur = Ye.payer) == null ? void 0 : Ur.id,
56492
56496
  "Payer Email": (pr = Ye.payer) == null ? void 0 : pr.email,
56493
56497
  "Payer Name": ($i = Ye.payer) == null ? void 0 : $i.name,
56494
- "Vendor ID": (Pe = Ye.vendor) == null ? void 0 : Pe.id,
56498
+ "Vendor ID": (Ee = Ye.vendor) == null ? void 0 : Ee.id,
56495
56499
  "Vendor Email": (or = Ye.vendor) == null ? void 0 : or.email,
56496
56500
  "Vendor Name": (ar = Ye.vendor) == null ? void 0 : ar.name,
56497
56501
  Metadata: JSON.stringify(Ye.metadata),
@@ -56716,7 +56720,7 @@ function mge({
56716
56720
  }), /* @__PURE__ */ d.jsx("button", {
56717
56721
  type: "button",
56718
56722
  className: "mercoa-inline-flex mercoa-items-center mercoa-rounded mercoa-bg-white mercoa-px-2 mercoa-py-1 mercoa-text-sm mercoa-font-semibold mercoa-text-gray-900 mercoa-shadow-sm mercoa-ring-1 mercoa-ring-inset mercoa-ring-gray-300 hover:mercoa-bg-gray-50 disabled:mercoa-cursor-not-allowed disabled:mercoa-opacity-30 disabled:hover:mercoa-bg-white",
56719
- onClick: Ee,
56723
+ onClick: Pe,
56720
56724
  children: ye(Q[0]) === L.Mercoa.InvoiceStatus.New ? "Submit for Approval" : "Approve"
56721
56725
  }), /* @__PURE__ */ d.jsx(pge, {
56722
56726
  open: le,
@@ -57067,7 +57071,7 @@ function Rge({
57067
57071
  admin: n,
57068
57072
  layout: o = "left"
57069
57073
  }) {
57070
- var we, te, ie, oe, fe, ye, Ee, Me, Ae, _e, Oe;
57074
+ var we, te, ie, oe, fe, ye, Pe, Me, Ae, _e, Oe;
57071
57075
  const a = Ke(), [i, s] = ae([]), [u, l] = ae([]), [f, p] = ae([]), [h, m] = ae(r), [y, b] = ae(r == null ? void 0 : r.payer), [v, w] = ae([]), S = to({
57072
57076
  status: Fe(),
57073
57077
  amount: ra().positive().required().typeError("Please enter a valid number"),
@@ -57318,7 +57322,7 @@ function Rge({
57318
57322
  })
57319
57323
  }), ((ye = O.payerId) == null ? void 0 : ye.message) && /* @__PURE__ */ d.jsx("p", {
57320
57324
  className: "mercoa-text-sm mercoa-text-red-500",
57321
- children: (Ee = O.payerId) == null ? void 0 : Ee.message.toString()
57325
+ children: (Pe = O.payerId) == null ? void 0 : Pe.message.toString()
57322
57326
  })]
57323
57327
  })
57324
57328
  }), /* @__PURE__ */ d.jsxs("form", {
@@ -57604,7 +57608,7 @@ function bge({
57604
57608
  N = ne.data[ne.data.length - 1].id, R = [...R, ...ne.data], await J();
57605
57609
  else {
57606
57610
  const le = O$.unparse(R.map((ie) => {
57607
- var oe, fe, ye, Ee, Me, Ae;
57611
+ var oe, fe, ye, Pe, Me, Ae;
57608
57612
  return {
57609
57613
  "Invoice ID": ie.id,
57610
57614
  "Invoice Number": ie.invoiceNumber,
@@ -57615,7 +57619,7 @@ function bge({
57615
57619
  "Payer ID": (oe = ie.payer) == null ? void 0 : oe.id,
57616
57620
  "Payer Email": (fe = ie.payer) == null ? void 0 : fe.email,
57617
57621
  "Payer Name": (ye = ie.payer) == null ? void 0 : ye.name,
57618
- "Vendor ID": (Ee = ie.vendor) == null ? void 0 : Ee.id,
57622
+ "Vendor ID": (Pe = ie.vendor) == null ? void 0 : Pe.id,
57619
57623
  "Vendor Email": (Me = ie.vendor) == null ? void 0 : Me.email,
57620
57624
  "Vendor Name": (Ae = ie.vendor) == null ? void 0 : Ae.name,
57621
57625
  Metadata: JSON.stringify(ie.metadata),