@orangecheck/auth-client 2.4.1 → 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.
package/dist/index.d.mts CHANGED
@@ -98,7 +98,8 @@ declare const OcAddressInput: React.ForwardRefExoticComponent<OcAddressInputProp
98
98
  interface OcSignInProps {
99
99
  audience: string;
100
100
  returnTo?: string;
101
- onSuccess?: (account: OcAccount) => void;
101
+ onSuccess?: (account: OcAccount, token?: string) => 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
@@ -98,7 +98,8 @@ declare const OcAddressInput: React.ForwardRefExoticComponent<OcAddressInputProp
98
98
  interface OcSignInProps {
99
99
  audience: string;
100
100
  returnTo?: string;
101
- onSuccess?: (account: OcAccount) => void;
101
+ onSuccess?: (account: OcAccount, token?: string) => 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, token) => {
798
799
  if (onSuccess) {
799
- onSuccess(account);
800
+ onSuccess(account, token);
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(
@@ -957,7 +966,7 @@ function WalletFlow({ authOrigin, audience, onSuccess }) {
957
966
  "reason" in json && json.reason || "error" in json && json.error || `verify_failed_${res.status}`
958
967
  );
959
968
  }
960
- onSuccess(json.account);
969
+ onSuccess(json.account, json.token);
961
970
  } catch (err) {
962
971
  const msg = err instanceof Error ? err.message : "sign-in failed";
963
972
  setError(msg);
@@ -1058,7 +1067,7 @@ function EmailFlow({ authOrigin, onSuccess }) {
1058
1067
  "reason" in json && json.reason || "error" in json && json.error || `verify failed (${res.status})`
1059
1068
  );
1060
1069
  }
1061
- onSuccess(json.account);
1070
+ onSuccess(json.account, json.token);
1062
1071
  } catch (err) {
1063
1072
  setCodeError(err instanceof Error ? err.message : "verify failed");
1064
1073
  } finally {
@@ -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) {