@evervault/react-native 2.5.0 → 2.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6702,11 +6702,11 @@ var z = /*#__PURE__*/Object.freeze({
6702
6702
  ZodError: ZodError
6703
6703
  });
6704
6704
 
6705
- function d(n) {
6706
- let e = 0, t = false, s = n.length - 1, l;
6705
+ function g(e) {
6706
+ let n = 0, t = false, s = e.length - 1, l;
6707
6707
  for (; s >= 0; )
6708
- l = parseInt(n.charAt(s), 10), t && (l *= 2, l > 9 && (l = l % 10 + 1)), t = !t, e += l, s--;
6709
- return e % 10 === 0;
6708
+ l = parseInt(e.charAt(s), 10), t && (l *= 2, l > 9 && (l = l % 10 + 1)), t = !t, n += l, s--;
6709
+ return n % 10 === 0;
6710
6710
  }
6711
6711
  const h = [
6712
6712
  {
@@ -6964,19 +6964,19 @@ const h = [
6964
6964
  }
6965
6965
  }
6966
6966
  ];
6967
- function g(n, e, t) {
6968
- const s = String(e).length, l = n.substring(0, s), i = parseInt(l, 10);
6969
- return l.length < s ? false : (e = parseInt(String(e).substring(0, l.length), 10), t = parseInt(String(t).substring(0, l.length), 10), i >= e && i <= t);
6967
+ function m(e, n, t) {
6968
+ const s = String(n).length, l = e.substring(0, s), a = parseInt(l, 10);
6969
+ return l.length < s ? false : (n = parseInt(String(n).substring(0, l.length), 10), t = parseInt(String(t).substring(0, l.length), 10), a >= n && a <= t);
6970
6970
  }
6971
- function m(n, e) {
6972
- return n.startsWith(String(e));
6971
+ function V(e, n) {
6972
+ return e.startsWith(String(n));
6973
6973
  }
6974
- function V(n) {
6975
- return n.length < 16 ? n.substring(0, 6) : n.substring(0, 8);
6974
+ function f(e) {
6975
+ return e.length < 16 ? e.substring(0, 6) : e.substring(0, 8);
6976
6976
  }
6977
- function f(n) {
6978
- const e = String(n).replace(/\s/g, "");
6979
- if (!/^\d*$/.test(e))
6977
+ function C(e) {
6978
+ const n = String(e).replace(/\s/g, "");
6979
+ if (!/^\d*$/.test(n))
6980
6980
  return {
6981
6981
  brand: null,
6982
6982
  localBrands: [],
@@ -6984,37 +6984,37 @@ function f(n) {
6984
6984
  lastFour: null,
6985
6985
  isValid: false
6986
6986
  };
6987
- const t = h.filter((a) => a.numberValidationRules.ranges.some((r) => {
6987
+ const t = h.filter((i) => i.numberValidationRules.ranges.some((r) => {
6988
6988
  if (Array.isArray(r)) {
6989
6989
  if (r[0] && r[1])
6990
- return g(e, r[0], r[1]);
6990
+ return m(n, r[0], r[1]);
6991
6991
  } else
6992
- return m(e, r);
6992
+ return V(n, r);
6993
6993
  return false;
6994
- })), s = t.filter((a) => !a.isLocal), l = t.filter((a) => a.isLocal), i = t.length > 0 && t.every((a) => {
6995
- const { lengths: r, luhnCheck: u } = a.numberValidationRules, o = r.includes(e.length), c = !u || d(e);
6996
- return o && c;
6997
- });
6994
+ })), s = t.filter((i) => !i.isLocal), l = t.filter((i) => i.isLocal), a = t.length > 0 && t.every((i) => {
6995
+ const { lengths: r, luhnCheck: o } = i.numberValidationRules, c = r.includes(n.length), d = !o || g(n);
6996
+ return c && d;
6997
+ }), u = e.length > 5;
6998
6998
  return {
6999
6999
  brand: s.length > 0 ? s[0].name : null,
7000
- localBrands: l.map((a) => a.name),
7001
- bin: i ? V(n) : null,
7002
- lastFour: i ? e.substring(e.length - 4) : null,
7003
- isValid: i
7000
+ localBrands: l.map((i) => i.name),
7001
+ bin: u ? f(e) : null,
7002
+ lastFour: a ? n.substring(n.length - 4) : null,
7003
+ isValid: a
7004
7004
  };
7005
7005
  }
7006
- function C(n, e) {
7007
- if (!/^\d{3,4}$/.test(n))
7006
+ function R(e, n) {
7007
+ if (!/^\d{3,4}$/.test(e))
7008
7008
  return {
7009
7009
  cvc: null,
7010
7010
  isValid: false
7011
7011
  };
7012
- if (!e)
7012
+ if (!n)
7013
7013
  return {
7014
- cvc: n,
7014
+ cvc: e,
7015
7015
  isValid: true
7016
7016
  };
7017
- const t = f(e);
7017
+ const t = C(n);
7018
7018
  if (!t.isValid)
7019
7019
  return {
7020
7020
  cvc: null,
@@ -7022,20 +7022,20 @@ function C(n, e) {
7022
7022
  };
7023
7023
  const s = [];
7024
7024
  t.brand && s.push(t.brand), t.localBrands && s.push(...t.localBrands);
7025
- const l = h.filter((i) => s.includes(i.name)).some((i) => i.securityCodeValidationRules.lengths.includes(n.length));
7025
+ const l = h.filter((a) => s.includes(a.name)).some((a) => a.securityCodeValidationRules.lengths.includes(e.length));
7026
7026
  return {
7027
- cvc: l ? n : null,
7027
+ cvc: l ? e : null,
7028
7028
  isValid: l
7029
7029
  };
7030
7030
  }
7031
- function R(n) {
7032
- var r;
7033
- const e = /^(0[1-9]|1[[0-2]).*$/, t = n.match(e), s = t ? parseInt(t[1].toString(), 10) : null, l = /^(0[1-9]|1[[0-2])(\d{2})$/, i = n.match(l), a = i ? parseInt(i[2].toString(), 10) : null;
7031
+ function b(e) {
7032
+ var i;
7033
+ const n = /^(0[1-9]|1[[0-2]).*$/, t = e.match(n), s = t ? parseInt(t[1].toString(), 10) : null, l = /^(0[1-9]|1[[0-2])(\d{2})$/, a = e.match(l), u = a ? parseInt(a[2].toString(), 10) : null;
7034
7034
  if (s) {
7035
- const u = (/* @__PURE__ */ new Date()).getFullYear() % 100, o = (/* @__PURE__ */ new Date()).getMonth() + 1, c = !a || a < u || a === u && s < o;
7035
+ const r = (/* @__PURE__ */ new Date()).getFullYear() % 100, o = (/* @__PURE__ */ new Date()).getMonth() + 1, c = !u || u < r || u === r && s < o;
7036
7036
  return {
7037
7037
  month: s.toString().padStart(2, "0"),
7038
- year: ((r = a == null ? void 0 : a.toString()) == null ? void 0 : r.padStart(2, "0")) ?? null,
7038
+ year: ((i = u == null ? void 0 : u.toString()) == null ? void 0 : i.padStart(2, "0")) ?? null,
7039
7039
  isValid: !c
7040
7040
  };
7041
7041
  }
@@ -7048,13 +7048,13 @@ function R(n) {
7048
7048
 
7049
7049
  async function formatPayload(values, context) {
7050
7050
  const number = values.number?.replace(/\s/g, "") || "";
7051
- const { brand, localBrands, bin, lastFour, isValid: isNumberValid, } = f(number);
7051
+ const { brand, localBrands, bin, lastFour, isValid: isNumberValid, } = C(number);
7052
7052
  if (number.length > 0 &&
7053
7053
  brand !== "american-express" &&
7054
7054
  values.cvc?.length === 4) {
7055
7055
  context.form.setValue("cvc", values.cvc?.slice(0, 3));
7056
7056
  }
7057
- const { cvc, isValid: isCvcValid } = C(values.cvc ?? "", number);
7057
+ const { cvc, isValid: isCvcValid } = R(values.cvc ?? "", number);
7058
7058
  const formErrors = context.form.formState.errors;
7059
7059
  const isValid = !Object.keys(formErrors).length;
7060
7060
  const isComplete = areValuesComplete(values);
@@ -7091,14 +7091,14 @@ function areValuesComplete(values) {
7091
7091
  if ("name" in values && !values.name?.length) {
7092
7092
  return false;
7093
7093
  }
7094
- if ("number" in values && !f(values.number ?? "").isValid) {
7094
+ if ("number" in values && !C(values.number ?? "").isValid) {
7095
7095
  return false;
7096
7096
  }
7097
- if ("expiry" in values && !R(values.expiry ?? "").isValid) {
7097
+ if ("expiry" in values && !b(values.expiry ?? "").isValid) {
7098
7098
  return false;
7099
7099
  }
7100
7100
  if ("cvc" in values &&
7101
- !C(values.cvc ?? "", values.number).isValid) {
7101
+ !R(values.cvc ?? "", values.number).isValid) {
7102
7102
  return false;
7103
7103
  }
7104
7104
  return true;
@@ -7115,7 +7115,7 @@ function isAcceptedBrand(acceptedBrands, cardNumberValidationResult) {
7115
7115
  return isBrandAccepted || isLocalBrandAccepted;
7116
7116
  }
7117
7117
  function formatExpiry(expiry) {
7118
- const parsedExpiry = R(expiry);
7118
+ const parsedExpiry = b(expiry);
7119
7119
  if (!parsedExpiry.isValid) {
7120
7120
  return null;
7121
7121
  }
@@ -7131,20 +7131,20 @@ function getCardFormSchema(acceptedBrands) {
7131
7131
  number: z
7132
7132
  .string()
7133
7133
  .min(1, "Required")
7134
- .refine((value) => f(value).isValid, {
7134
+ .refine((value) => C(value).isValid, {
7135
7135
  message: "Invalid card number",
7136
7136
  })
7137
- .refine((value) => isAcceptedBrand(acceptedBrands, f(value)), { message: "Brand not accepted" }),
7137
+ .refine((value) => isAcceptedBrand(acceptedBrands, C(value)), { message: "Brand not accepted" }),
7138
7138
  expiry: z
7139
7139
  .string()
7140
7140
  .min(1, "Required")
7141
- .refine((value) => R(value).isValid, {
7141
+ .refine((value) => b(value).isValid, {
7142
7142
  message: "Invalid expiry",
7143
7143
  }),
7144
7144
  cvc: z
7145
7145
  .string()
7146
7146
  .min(1, "Required")
7147
- .refine((value) => C(value).isValid, {
7147
+ .refine((value) => R(value).isValid, {
7148
7148
  message: "Invalid CVC",
7149
7149
  }),
7150
7150
  });
@@ -7530,7 +7530,7 @@ const CardCvc = React.forwardRef(function CardCvc(props, ref) {
7530
7530
  if (!number) {
7531
7531
  return DEFAULT_CARD_CVC_MASK;
7532
7532
  }
7533
- const brand = f(number).brand;
7533
+ const brand = C(number).brand;
7534
7534
  if (brand && CARD_CVC_MASKS[brand]) {
7535
7535
  return CARD_CVC_MASKS[brand];
7536
7536
  }
@@ -7549,7 +7549,7 @@ const CardNumber = React.forwardRef(function CardNumber(props, ref) {
7549
7549
  if (!text) {
7550
7550
  return DEFAULT_CARD_NUMBER_MASK;
7551
7551
  }
7552
- const brand = f(text).brand;
7552
+ const brand = C(text).brand;
7553
7553
  if (brand && CARD_NUMBER_MASKS[brand]) {
7554
7554
  return CARD_NUMBER_MASKS[brand];
7555
7555
  }