@insforge/react 0.2.1 → 0.2.3

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.mjs CHANGED
@@ -665,6 +665,22 @@ function AuthSubmitButton({
665
665
  );
666
666
  }
667
667
  function AuthLink({ text, linkText, href, appearance = {} }) {
668
+ const currentSearch = typeof window !== "undefined" ? window.location.search : "";
669
+ const finalHref = (() => {
670
+ if (!currentSearch) return href;
671
+ try {
672
+ const url = new URL(href, window.location.origin);
673
+ const currentParams = new URLSearchParams(currentSearch);
674
+ currentParams.forEach((value, key) => {
675
+ if (!url.searchParams.has(key)) {
676
+ url.searchParams.set(key, value);
677
+ }
678
+ });
679
+ return url.pathname + url.search;
680
+ } catch {
681
+ return href;
682
+ }
683
+ })();
668
684
  return /* @__PURE__ */ jsxs("p", { className: cn(
669
685
  "text-center text-sm font-normal text-[#828282] leading-6",
670
686
  appearance.containerClassName
@@ -674,7 +690,7 @@ function AuthLink({ text, linkText, href, appearance = {} }) {
674
690
  /* @__PURE__ */ jsx(
675
691
  "a",
676
692
  {
677
- href,
693
+ href: finalHref,
678
694
  className: cn(
679
695
  "text-sm font-medium text-black leading-6",
680
696
  appearance.linkClassName
@@ -2033,7 +2049,7 @@ function validateEmail(email) {
2033
2049
  if (result.success) {
2034
2050
  return { valid: true };
2035
2051
  }
2036
- return { valid: false, error: result.error.errors[0]?.message };
2052
+ return { valid: false, error: result.error.message };
2037
2053
  }
2038
2054
  function validatePassword(password, options) {
2039
2055
  const schema = createPasswordSchema(options);
@@ -2041,7 +2057,7 @@ function validatePassword(password, options) {
2041
2057
  if (result.success) {
2042
2058
  return { valid: true };
2043
2059
  }
2044
- return { valid: false, error: result.error.errors[0]?.message };
2060
+ return { valid: false, error: result.error.message };
2045
2061
  }
2046
2062
  function checkPasswordStrength(password) {
2047
2063
  const feedback = [];