@taxbit/react-sdk 1.0.0-beta.7 → 1.0.0-beta.8

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/README.md CHANGED
@@ -311,10 +311,15 @@ type QuestionnaireType = 'DPS' | 'W-FORM';
311
311
 
312
312
  ## Changelog
313
313
 
314
+ ### Version 1.0.0-beta.8
315
+
316
+ 1. Signature confirmation is more flexible with spaces.
317
+ 2. Fixed checkbox issue with certification upon submission.
318
+
314
319
  ### Version 1.0.0-beta.7
315
320
 
316
321
  1. BearerToken and Fetch errors are now sent only to the console, no longer thrown and bubbled up.
317
- 2. 2Added an `error` object to the 'useTaxbit' hook.
322
+ 2. Added an `error` object to the 'useTaxbit' hook.
318
323
 
319
324
  ### Version 1.0.0-beta.6
320
325
 
@@ -315,7 +315,7 @@ const fo = [
315
315
  "ij",
316
316
  "Œ",
317
317
  "ƒ"
318
- ], po = (e, n) => !G(e) || !G(n) ? !1 : e === n, ga = (e) => G(e) ? /^(.)\1+$/.test(e) : !1, G = (e) => typeof e == "string", va = (e) => G(e) ? new RegExp(`[a-zA-Z0-9${fo.join("")}]`).test(e) : !1, Pe = (e) => G(e) ? e.trim() === "" : e == null, O = (e) => !Pe(e), Mt = (e) => {
318
+ ], po = (e, n) => !G(e) || !G(n) ? !1 : e.replace(/\s+/g, " ").trim() === n.replace(/\s+/g, " ").trim(), ga = (e) => G(e) ? /^(.)\1+$/.test(e) : !1, G = (e) => typeof e == "string", va = (e) => G(e) ? new RegExp(`[a-zA-Z0-9${fo.join("")}]`).test(e) : !1, Pe = (e) => G(e) ? e.trim() === "" : e == null, O = (e) => !Pe(e), Mt = (e) => {
319
319
  if (O(e))
320
320
  return G(e) && !ga(e) && e.length >= 2 && e.length <= 22;
321
321
  }, go = (e, n) => {
@@ -973,6 +973,9 @@ class w {
973
973
  this.push(new H(a.value, o, a.messages));
974
974
  });
975
975
  }
976
+ validateTruePresent(n, t) {
977
+ return this.validateBooleanPresent(n, t) ? n ? !0 : (this.issues.push(new H(n, t, "invalid")), !1) : !1;
978
+ }
976
979
  validateBooleanPresent(n, t) {
977
980
  return O(n) ? Yo(n) ? !0 : (this.issues.push(new H(n, t, "invalid")), !1) : (this.issues.push(new H(n, t, "required")), !1);
978
981
  }
@@ -1210,7 +1213,9 @@ const Xo = (e) => e.country === "CA", Qo = (e) => {
1210
1213
  return O(e.accountHolder.financialAccountIdentifier) && a.validateSpecialNumberPresent(
1211
1214
  e.accountHolder.financialAccountIdentifier,
1212
1215
  ["accountHolder", "financialAccountIdentifier"]
1213
- ), a;
1216
+ ), a.validateTruePresent(e.isConfirmedCorrectComplete, [
1217
+ "isConfirmedCorrectComplete"
1218
+ ]), a;
1214
1219
  }, Ba = (e) => {
1215
1220
  var n, t, a, o;
1216
1221
  return ((n = e.accountHolder) == null ? void 0 : n.usAccountType) === "SM_LLC" && ((t = e.accountHolder) == null ? void 0 : t.usSmllcElection) === !1 || ((a = e.accountHolder) == null ? void 0 : a.usAccountType) === "DISREGARDED_ENTITY" || ((o = e.accountHolder) == null ? void 0 : o.foreignAccountType) === "DISREGARDED_ENTITY";
@@ -1499,7 +1504,7 @@ const Xo = (e) => e.country === "CA", Qo = (e) => {
1499
1504
  );
1500
1505
  }, pd = (e) => !!e && !!e.accountHolder && (e.accountHolder.isUsPerson !== void 0 || e.accountHolder.usAccountType !== void 0 || e.accountHolder.foreignAccountType !== void 0), gd = (e) => {
1501
1506
  const n = new w();
1502
- return Ba(e) && n.append(Ts(e)), md(e) ? n.append(fd(e)) : $s(e) && n.append(Ws(e)), n.validateStringPresent(e.signature, ["signature"]), n;
1507
+ return Ba(e) && n.append(Ts(e)), md(e) ? n.append(fd(e)) : $s(e) && n.append(Ws(e)), n.validateStringPresent(e.signature, ["signature"]), n.validateTruePresent(e.hasCertified, ["hasCertified"]), n;
1503
1508
  }, vd = (e) => !!e && typeof e == "object" && "accountHolder" in e, hd = (e, n = "1.0") => {
1504
1509
  if (!vd(e)) {
1505
1510
  const a = new w();
@@ -1898,7 +1903,7 @@ const X = (e) => e === void 0 || e === "" || e === null, Q = (e) => !X(e), Ce =
1898
1903
  kt(t)
1899
1904
  ]
1900
1905
  )
1901
- ), Bd = "1.0.0-beta.7", Ee = (e) => e === "yes", be = (e) => e === void 0 ? void 0 : e === "yes", Md = (e) => {
1906
+ ), Bd = "1.0.0-beta.8", Ee = (e) => e === "yes", be = (e) => e === void 0 ? void 0 : e === "yes", Md = (e) => {
1902
1907
  const n = {
1903
1908
  city: e.accountHolderAddressCity,
1904
1909
  country: e.accountHolderAddressCountry,
@@ -2072,22 +2077,25 @@ const X = (e) => e === void 0 || e === "" || e === null, Q = (e) => !X(e), Ce =
2072
2077
  }, qd = (e) => ({
2073
2078
  accountHolder: Vd(e),
2074
2079
  regardedOwner: _d(e)
2075
- }), Gd = (e, n) => ({
2076
- ...qd(e),
2077
- documentType: "COMPREHENSIVE",
2078
- hasCertified: be(e.iCertifyToAll),
2079
- isNotSubjectBackupWithholding: Ee(
2080
- e.iAmNotSubjectToBackupWithholding
2081
- ),
2082
- isConfirmedCorrectComplete: be(
2083
- e.iConfirmTheInformationIsCorrectComplete
2084
- ),
2085
- questionnaire: n,
2086
- schemaVersion: "1.0",
2087
- signature: e.signature,
2088
- signatureDate: (/* @__PURE__ */ new Date()).toISOString(),
2089
- source: `Taxbit React SDK v${Bd}`
2090
- }), pt = (e) => {
2080
+ }), Gd = (e, n) => {
2081
+ var t;
2082
+ return {
2083
+ ...qd(e),
2084
+ documentType: "COMPREHENSIVE",
2085
+ hasCertified: be(e.iHaveCapacityToSign),
2086
+ isNotSubjectBackupWithholding: Ee(
2087
+ e.iAmNotSubjectToBackupWithholding
2088
+ ),
2089
+ isConfirmedCorrectComplete: be(
2090
+ e.iConfirmTheInformationIsCorrectComplete
2091
+ ),
2092
+ questionnaire: n,
2093
+ schemaVersion: "1.0",
2094
+ signature: (t = e.signature) == null ? void 0 : t.replace(/\s+/g, " ").trim(),
2095
+ signatureDate: (/* @__PURE__ */ new Date()).toISOString(),
2096
+ source: `Taxbit React SDK v${Bd}`
2097
+ };
2098
+ }, pt = (e) => {
2091
2099
  if (e && Tt.includes(
2092
2100
  e
2093
2101
  ))
@@ -10396,7 +10404,7 @@ const Ie = ({ name: e }) => {
10396
10404
  /* @__PURE__ */ i.jsx(
10397
10405
  Y,
10398
10406
  {
10399
- name: "iConfirmTheInformationIsCorrectComplete",
10407
+ name: "iAuthorizeWithholdingAgent",
10400
10408
  label: !0,
10401
10409
  disabled: g
10402
10410
  }
@@ -10404,7 +10412,7 @@ const Ie = ({ name: e }) => {
10404
10412
  /* @__PURE__ */ i.jsx(
10405
10413
  Y,
10406
10414
  {
10407
- name: "iAuthorizeWithholdingAgent",
10415
+ name: "iConfirmTheInformationIsCorrectComplete",
10408
10416
  label: !0,
10409
10417
  disabled: g
10410
10418
  }