@authowl/react 0.17.0 → 0.18.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.
package/dist/index.cjs CHANGED
@@ -880,6 +880,14 @@ function SocialButtons({ providers, callbackURL }) {
880
880
  const { signInSocial } = useSignIn();
881
881
  const [pending, setPending] = React6.useState(null);
882
882
  const [error, setError] = React6.useState(null);
883
+ React6.useEffect(() => {
884
+ if (typeof window === "undefined") return;
885
+ const url = new URL(window.location.href);
886
+ if (!url.searchParams.has("authowl_error")) return;
887
+ url.searchParams.delete("authowl_error");
888
+ window.history.replaceState(window.history.state, "", url.toString());
889
+ setError(t("social.error.startFailed"));
890
+ }, [t]);
883
891
  if (providers.length === 0) return null;
884
892
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "ba-social", children: [
885
893
  providers.map((provider) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
@@ -894,7 +902,11 @@ function SocialButtons({ providers, callbackURL }) {
894
902
  setPending(provider);
895
903
  try {
896
904
  const destination = callbackURL ?? window.location.href;
897
- const res = await signInSocial({ provider, callbackURL: destination });
905
+ const res = await signInSocial({
906
+ provider,
907
+ callbackURL: destination,
908
+ errorCallbackURL: window.location.href
909
+ });
898
910
  if (res?.error) {
899
911
  setError(toServerError(res.error, t("social.error.startFailed")));
900
912
  setPending(null);
package/dist/index.js CHANGED
@@ -799,6 +799,14 @@ function SocialButtons({ providers, callbackURL }) {
799
799
  const { signInSocial } = useSignIn();
800
800
  const [pending, setPending] = React6.useState(null);
801
801
  const [error, setError] = React6.useState(null);
802
+ React6.useEffect(() => {
803
+ if (typeof window === "undefined") return;
804
+ const url = new URL(window.location.href);
805
+ if (!url.searchParams.has("authowl_error")) return;
806
+ url.searchParams.delete("authowl_error");
807
+ window.history.replaceState(window.history.state, "", url.toString());
808
+ setError(t("social.error.startFailed"));
809
+ }, [t]);
802
810
  if (providers.length === 0) return null;
803
811
  return /* @__PURE__ */ jsxs3("div", { className: "ba-social", children: [
804
812
  providers.map((provider) => /* @__PURE__ */ jsx6(
@@ -813,7 +821,11 @@ function SocialButtons({ providers, callbackURL }) {
813
821
  setPending(provider);
814
822
  try {
815
823
  const destination = callbackURL ?? window.location.href;
816
- const res = await signInSocial({ provider, callbackURL: destination });
824
+ const res = await signInSocial({
825
+ provider,
826
+ callbackURL: destination,
827
+ errorCallbackURL: window.location.href
828
+ });
817
829
  if (res?.error) {
818
830
  setError(toServerError(res.error, t("social.error.startFailed")));
819
831
  setPending(null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@authowl/react",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "description": "React provider, hooks, and drop-in components for AuthOwl, the multi-tenant auth SaaS.",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -47,7 +47,7 @@
47
47
  "LICENSE"
48
48
  ],
49
49
  "dependencies": {
50
- "@authowl/core": "0.13.0"
50
+ "@authowl/core": "0.15.0"
51
51
  },
52
52
  "peerDependencies": {
53
53
  "react": ">=18",