@zoreal/oauth2-react 0.2.7 → 0.2.8
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 +7 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -4
- package/dist/index.d.ts +20 -4
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -71,10 +71,13 @@ interface ZorealButtonConfiguration {
|
|
|
71
71
|
theme?: 'outline' | 'filled' | 'filled_black';
|
|
72
72
|
size?: 'large' | 'medium' | 'small';
|
|
73
73
|
/**
|
|
74
|
-
* All
|
|
75
|
-
* authenticated; there is no 'verified_human' variant.
|
|
74
|
+
* All five are neutral. The button asserts nothing about a person who has
|
|
75
|
+
* not yet authenticated; there is no 'verified_human' variant. 'verify_with'
|
|
76
|
+
* stays inside that rule: it names the act the button starts, not a state
|
|
77
|
+
* the person already holds — built for surfaces where the login IS a check
|
|
78
|
+
* (ZOREAL Meet's presence request), not a sign-in.
|
|
76
79
|
*/
|
|
77
|
-
text?: 'continue_with' | 'signin_with' | 'signup_with' | 'signin';
|
|
80
|
+
text?: 'continue_with' | 'signin_with' | 'signup_with' | 'signin' | 'verify_with';
|
|
78
81
|
shape?: 'rectangular' | 'pill' | 'square';
|
|
79
82
|
logo_alignment?: 'left' | 'center';
|
|
80
83
|
width?: string | number;
|
|
@@ -126,8 +129,21 @@ interface AuthCodeFlowOptions extends ZorealLoginRequestOptions {
|
|
|
126
129
|
redirect_uri?: string;
|
|
127
130
|
ux_mode?: 'popup' | 'redirect';
|
|
128
131
|
}
|
|
129
|
-
|
|
132
|
+
/**
|
|
133
|
+
* The button runs either flow, discriminated on `flow` exactly as
|
|
134
|
+
* useZorealLogin is: browser-direct (the default) hands onSuccess an ID
|
|
135
|
+
* token; auth-code hands it the code, PKCE verifier and nonce for YOUR
|
|
136
|
+
* backend to redeem. Added in 0.2.8 — before that the button was
|
|
137
|
+
* browser-direct only and auth-code integrations had to rebuild the button
|
|
138
|
+
* around the hook to get the same pixels.
|
|
139
|
+
*/
|
|
140
|
+
type ZorealLoginProps = ({
|
|
141
|
+
flow?: 'browser-direct';
|
|
130
142
|
onSuccess: (response: ZorealCredentialResponse) => void;
|
|
143
|
+
} | {
|
|
144
|
+
flow: 'auth-code';
|
|
145
|
+
onSuccess: (response: ZorealCodeResponse) => void;
|
|
146
|
+
}) & {
|
|
131
147
|
onError?: (error: NonOAuthError) => void;
|
|
132
148
|
containerProps?: React.ComponentPropsWithoutRef<'div'>;
|
|
133
149
|
} & ZorealLoginRequestOptions & ZorealButtonConfiguration;
|
package/dist/index.d.ts
CHANGED
|
@@ -71,10 +71,13 @@ interface ZorealButtonConfiguration {
|
|
|
71
71
|
theme?: 'outline' | 'filled' | 'filled_black';
|
|
72
72
|
size?: 'large' | 'medium' | 'small';
|
|
73
73
|
/**
|
|
74
|
-
* All
|
|
75
|
-
* authenticated; there is no 'verified_human' variant.
|
|
74
|
+
* All five are neutral. The button asserts nothing about a person who has
|
|
75
|
+
* not yet authenticated; there is no 'verified_human' variant. 'verify_with'
|
|
76
|
+
* stays inside that rule: it names the act the button starts, not a state
|
|
77
|
+
* the person already holds — built for surfaces where the login IS a check
|
|
78
|
+
* (ZOREAL Meet's presence request), not a sign-in.
|
|
76
79
|
*/
|
|
77
|
-
text?: 'continue_with' | 'signin_with' | 'signup_with' | 'signin';
|
|
80
|
+
text?: 'continue_with' | 'signin_with' | 'signup_with' | 'signin' | 'verify_with';
|
|
78
81
|
shape?: 'rectangular' | 'pill' | 'square';
|
|
79
82
|
logo_alignment?: 'left' | 'center';
|
|
80
83
|
width?: string | number;
|
|
@@ -126,8 +129,21 @@ interface AuthCodeFlowOptions extends ZorealLoginRequestOptions {
|
|
|
126
129
|
redirect_uri?: string;
|
|
127
130
|
ux_mode?: 'popup' | 'redirect';
|
|
128
131
|
}
|
|
129
|
-
|
|
132
|
+
/**
|
|
133
|
+
* The button runs either flow, discriminated on `flow` exactly as
|
|
134
|
+
* useZorealLogin is: browser-direct (the default) hands onSuccess an ID
|
|
135
|
+
* token; auth-code hands it the code, PKCE verifier and nonce for YOUR
|
|
136
|
+
* backend to redeem. Added in 0.2.8 — before that the button was
|
|
137
|
+
* browser-direct only and auth-code integrations had to rebuild the button
|
|
138
|
+
* around the hook to get the same pixels.
|
|
139
|
+
*/
|
|
140
|
+
type ZorealLoginProps = ({
|
|
141
|
+
flow?: 'browser-direct';
|
|
130
142
|
onSuccess: (response: ZorealCredentialResponse) => void;
|
|
143
|
+
} | {
|
|
144
|
+
flow: 'auth-code';
|
|
145
|
+
onSuccess: (response: ZorealCodeResponse) => void;
|
|
146
|
+
}) & {
|
|
131
147
|
onError?: (error: NonOAuthError) => void;
|
|
132
148
|
containerProps?: React.ComponentPropsWithoutRef<'div'>;
|
|
133
149
|
} & ZorealLoginRequestOptions & ZorealButtonConfiguration;
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { createContext, useContext, useMemo, useState as useState2 } from "react
|
|
|
5
5
|
|
|
6
6
|
// src/wire.ts
|
|
7
7
|
var WIRE_VERSION = 1;
|
|
8
|
-
var SDK_VERSION = "0.2.
|
|
8
|
+
var SDK_VERSION = "0.2.8";
|
|
9
9
|
var DEFAULT_ISSUER = "https://id.zoreal.com";
|
|
10
10
|
var POLL_INTERVAL_MS = 2e3;
|
|
11
11
|
var POLL_INTERVAL_ENROLLING_MS = 5e3;
|
|
@@ -1555,7 +1555,8 @@ var TEXTS = {
|
|
|
1555
1555
|
continue_with: "Continue with ZOREAL",
|
|
1556
1556
|
signin_with: "Sign in with ZOREAL",
|
|
1557
1557
|
signup_with: "Sign up with ZOREAL",
|
|
1558
|
-
signin: "Sign in"
|
|
1558
|
+
signin: "Sign in",
|
|
1559
|
+
verify_with: "Verify with ZOREAL ID"
|
|
1559
1560
|
};
|
|
1560
1561
|
var SIZES = {
|
|
1561
1562
|
large: { height: 44, font: 15, pad: 20 },
|
|
@@ -1575,12 +1576,14 @@ function ZorealLogin(props) {
|
|
|
1575
1576
|
logo_alignment = "left",
|
|
1576
1577
|
width,
|
|
1577
1578
|
click_listener,
|
|
1579
|
+
flow = "browser-direct",
|
|
1578
1580
|
...request
|
|
1579
1581
|
} = props;
|
|
1580
1582
|
const { login } = useZorealFlow({
|
|
1581
1583
|
...request,
|
|
1582
|
-
flow
|
|
1583
|
-
onCredential: onSuccess,
|
|
1584
|
+
flow,
|
|
1585
|
+
onCredential: flow === "browser-direct" ? onSuccess : void 0,
|
|
1586
|
+
onCode: flow === "auth-code" ? onSuccess : void 0,
|
|
1584
1587
|
onError: (e) => onError?.({ type: "unknown", description: e.description ?? e.error }),
|
|
1585
1588
|
onNonOAuthError: (e) => onError?.(e)
|
|
1586
1589
|
});
|