@orangecheck/auth-client 2.4.0 → 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 +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +16 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -1
- package/CHANGELOG.md +0 -111
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(
|
|
@@ -925,10 +934,7 @@ function WalletFlow({ authOrigin, audience, onSuccess }) {
|
|
|
925
934
|
}
|
|
926
935
|
let adapter;
|
|
927
936
|
try {
|
|
928
|
-
|
|
929
|
-
adapter = await Function("m", "return import(m)")(
|
|
930
|
-
moduleId
|
|
931
|
-
);
|
|
937
|
+
adapter = await import('@orangecheck/wallet-adapter');
|
|
932
938
|
} catch {
|
|
933
939
|
throw new Error(
|
|
934
940
|
"@orangecheck/wallet-adapter not installed \xB7 add it to your consumer site"
|
|
@@ -1215,7 +1221,10 @@ var inputStyle = {
|
|
|
1215
1221
|
border: "1px solid var(--input, #27272a)",
|
|
1216
1222
|
borderRadius: 6,
|
|
1217
1223
|
fontFamily: "ui-monospace, SFMono-Regular, monospace",
|
|
1218
|
-
|
|
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,
|
|
1219
1228
|
outline: "none"
|
|
1220
1229
|
};
|
|
1221
1230
|
function submitStyle(disabled) {
|