@orangecheck/auth-client 2.4.1 → 2.5.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.d.mts CHANGED
@@ -99,6 +99,7 @@ interface OcSignInProps {
99
99
  audience: string;
100
100
  returnTo?: string;
101
101
  onSuccess?: (account: OcAccount) => void;
102
+ resolveReturnTo?: (account: OcAccount) => string | Promise<string>;
102
103
  authOrigin?: string;
103
104
  initialPath?: 'wallet' | 'email';
104
105
  paths?: {
@@ -107,7 +108,7 @@ interface OcSignInProps {
107
108
  };
108
109
  className?: string;
109
110
  }
110
- declare function OcSignIn({ audience, returnTo, onSuccess, authOrigin, initialPath, paths, className, }: OcSignInProps): React.ReactElement;
111
+ declare function OcSignIn({ audience, returnTo, onSuccess, resolveReturnTo, authOrigin, initialPath, paths, className, }: OcSignInProps): React.ReactElement;
111
112
 
112
113
  interface WebAuthnCredentialPublic {
113
114
  id: string;
package/dist/index.d.ts CHANGED
@@ -99,6 +99,7 @@ interface OcSignInProps {
99
99
  audience: string;
100
100
  returnTo?: string;
101
101
  onSuccess?: (account: OcAccount) => void;
102
+ resolveReturnTo?: (account: OcAccount) => string | Promise<string>;
102
103
  authOrigin?: string;
103
104
  initialPath?: 'wallet' | 'email';
104
105
  paths?: {
@@ -107,7 +108,7 @@ interface OcSignInProps {
107
108
  };
108
109
  className?: string;
109
110
  }
110
- declare function OcSignIn({ audience, returnTo, onSuccess, authOrigin, initialPath, paths, className, }: OcSignInProps): React.ReactElement;
111
+ declare function OcSignIn({ audience, returnTo, onSuccess, resolveReturnTo, authOrigin, initialPath, paths, className, }: OcSignInProps): React.ReactElement;
111
112
 
112
113
  interface WebAuthnCredentialPublic {
113
114
  id: string;
package/dist/index.js CHANGED
@@ -784,6 +784,7 @@ function OcSignIn({
784
784
  audience,
785
785
  returnTo,
786
786
  onSuccess,
787
+ resolveReturnTo,
787
788
  authOrigin = "https://ochk.io",
788
789
  initialPath = "wallet",
789
790
  paths,
@@ -794,14 +795,22 @@ function OcSignIn({
794
795
  const safeReturn = safeReturnTo(returnTo);
795
796
  const [path, setPath] = React4__namespace.useState(initialPath);
796
797
  const handleSuccess = React4__namespace.useCallback(
797
- (account) => {
798
+ async (account) => {
798
799
  if (onSuccess) {
799
800
  onSuccess(account);
800
801
  return;
801
802
  }
803
+ if (resolveReturnTo) {
804
+ try {
805
+ const target = await resolveReturnTo(account);
806
+ hardNavigate(safeReturnTo(target));
807
+ return;
808
+ } catch {
809
+ }
810
+ }
802
811
  hardNavigate(safeReturn);
803
812
  },
804
- [onSuccess, safeReturn]
813
+ [onSuccess, resolveReturnTo, safeReturn]
805
814
  );
806
815
  if (!walletEnabled && !emailEnabled) {
807
816
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -1212,7 +1221,10 @@ var inputStyle = {
1212
1221
  border: "1px solid var(--input, #27272a)",
1213
1222
  borderRadius: 6,
1214
1223
  fontFamily: "ui-monospace, SFMono-Regular, monospace",
1215
- fontSize: 13,
1224
+ // 16px — never below it. A sub-16px font-size makes iOS Safari
1225
+ // auto-zoom the viewport on focus; the family rule is >=16px on
1226
+ // every form field. Desktop reads fine at 16 too.
1227
+ fontSize: 16,
1216
1228
  outline: "none"
1217
1229
  };
1218
1230
  function submitStyle(disabled) {