@authara/react-native 0.2.0 → 0.2.2
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/README.md +14 -0
- package/dist/buttons.d.ts +1 -0
- package/dist/buttons.js +2 -2
- package/dist/nitro-google-signin.js +2 -1
- package/package.json +14 -9
package/README.md
CHANGED
|
@@ -50,6 +50,20 @@ then each request retries once with `Authorization: Bearer …`.
|
|
|
50
50
|
`baseUrl` must use HTTPS. Local development can explicitly opt in to HTTP with
|
|
51
51
|
`allowInsecureHttp: true`; never enable it in production.
|
|
52
52
|
|
|
53
|
+
The package publishes ESM. Jest consumers must allow Babel to transform the
|
|
54
|
+
package, for example with `jest-expo`:
|
|
55
|
+
|
|
56
|
+
```js
|
|
57
|
+
module.exports = {
|
|
58
|
+
preset: "jest-expo",
|
|
59
|
+
transformIgnorePatterns: [
|
|
60
|
+
"/node_modules/(?!(.pnpm|react-native|@react-native|@react-native-community|expo|@expo|@expo-google-fonts|react-navigation|@react-navigation|@sentry/react-native|native-base|standard-navigation|@authara/react-native))",
|
|
61
|
+
"/node_modules/react-native-reanimated/plugin/",
|
|
62
|
+
"/node_modules/@react-native/babel-preset/",
|
|
63
|
+
],
|
|
64
|
+
};
|
|
65
|
+
```
|
|
66
|
+
|
|
53
67
|
### Application API clients
|
|
54
68
|
|
|
55
69
|
An application with its own authenticated API can read the current in-memory
|
package/dist/buttons.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export interface GoogleButtonVisualProps extends AutharaButtonVisualProps {
|
|
|
28
28
|
border?: boolean;
|
|
29
29
|
shape?: "pill" | "circle" | "square" | "rectangular";
|
|
30
30
|
logoAlignment?: "left" | "center";
|
|
31
|
+
onCancel?: () => void;
|
|
31
32
|
}
|
|
32
33
|
export interface AppleButtonVisualProps extends AutharaButtonVisualProps {
|
|
33
34
|
locale?: string;
|
package/dist/buttons.js
CHANGED
|
@@ -99,12 +99,12 @@ function ProviderButton({ provider, providerLabel, action, audience, authenticat
|
|
|
99
99
|
}
|
|
100
100
|
export function GoogleButton(props) {
|
|
101
101
|
const internal = props;
|
|
102
|
-
const { action = "login", audience, authenticationChallengeId, recoveryLinkId, onSuccess, onError, variant = "text", size = "large", label = action === "login" ? "sign-in" : "continue", mode = "light", theme, border, shape = "rectangular", logoAlignment = "center", buttonText, width, locale, ...buttonProps } = internal;
|
|
102
|
+
const { action = "login", audience, authenticationChallengeId, recoveryLinkId, onSuccess, onError, onCancel, variant = "text", size = "large", label = action === "login" ? "sign-in" : "continue", mode = "light", theme, border, shape = "rectangular", logoAlignment = "center", buttonText, width, locale, ...buttonProps } = internal;
|
|
103
103
|
void locale;
|
|
104
104
|
const resolvedMode = useResolvedColorMode(mode);
|
|
105
105
|
const visibleLabel = buttonText ??
|
|
106
106
|
(variant === "provider" ? "Google" : autharaButtonLabel(label, "Google"));
|
|
107
|
-
return (_jsx(ProviderButton, { ...buttonProps, provider: "google", providerLabel: "Google", action: action, audience: audience, authenticationChallengeId: authenticationChallengeId, recoveryLinkId: recoveryLinkId, onSuccess: onSuccess, onError: onError, variant: variant, label: visibleLabel, appearance: googleButtonAppearance({
|
|
107
|
+
return (_jsx(ProviderButton, { ...buttonProps, provider: "google", providerLabel: "Google", action: action, audience: audience, authenticationChallengeId: authenticationChallengeId, recoveryLinkId: recoveryLinkId, onSuccess: onSuccess, onError: onError, onCancel: onCancel, variant: variant, label: visibleLabel, appearance: googleButtonAppearance({
|
|
108
108
|
variant,
|
|
109
109
|
size,
|
|
110
110
|
width,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { GoogleOneTapSignIn, isCancelledResponse, isSuccessResponse, } from "react-native-nitro-google-signin";
|
|
2
2
|
import { Platform } from "react-native";
|
|
3
|
+
import { AutharaProviderCancellationError } from "./button-error.js";
|
|
3
4
|
export function createNitroGoogleSignIn(config = {}) {
|
|
4
5
|
return {
|
|
5
6
|
async authorize(options) {
|
|
@@ -15,7 +16,7 @@ export function createNitroGoogleSignIn(config = {}) {
|
|
|
15
16
|
await GoogleOneTapSignIn.checkPlayServices(true);
|
|
16
17
|
const response = await GoogleOneTapSignIn.presentExplicitSignIn();
|
|
17
18
|
if (isCancelledResponse(response)) {
|
|
18
|
-
throw new
|
|
19
|
+
throw new AutharaProviderCancellationError("Google");
|
|
19
20
|
}
|
|
20
21
|
if (!isSuccessResponse(response) || !response.data.idToken) {
|
|
21
22
|
throw new Error("Google did not return an ID token");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@authara/react-native",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Official React Native client, hooks, and native-provider buttons for Authara",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"authentication",
|
|
@@ -29,23 +29,28 @@
|
|
|
29
29
|
"exports": {
|
|
30
30
|
".": {
|
|
31
31
|
"import": "./dist/index.js",
|
|
32
|
-
"types": "./dist/index.d.ts"
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"default": "./dist/index.js"
|
|
33
34
|
},
|
|
34
35
|
"./expo-secure-store": {
|
|
35
36
|
"import": "./dist/expo-secure-store.js",
|
|
36
|
-
"types": "./dist/expo-secure-store.d.ts"
|
|
37
|
+
"types": "./dist/expo-secure-store.d.ts",
|
|
38
|
+
"default": "./dist/expo-secure-store.js"
|
|
37
39
|
},
|
|
38
40
|
"./expo-apple-authentication": {
|
|
39
41
|
"import": "./dist/expo-apple-authentication.js",
|
|
40
|
-
"types": "./dist/expo-apple-authentication.d.ts"
|
|
42
|
+
"types": "./dist/expo-apple-authentication.d.ts",
|
|
43
|
+
"default": "./dist/expo-apple-authentication.js"
|
|
41
44
|
},
|
|
42
45
|
"./nitro-google-signin": {
|
|
43
46
|
"import": "./dist/nitro-google-signin.js",
|
|
44
|
-
"types": "./dist/nitro-google-signin.d.ts"
|
|
47
|
+
"types": "./dist/nitro-google-signin.d.ts",
|
|
48
|
+
"default": "./dist/nitro-google-signin.js"
|
|
45
49
|
},
|
|
46
50
|
"./expo-microsoft-auth-session": {
|
|
47
51
|
"import": "./dist/expo-microsoft-auth-session.js",
|
|
48
|
-
"types": "./dist/expo-microsoft-auth-session.d.ts"
|
|
52
|
+
"types": "./dist/expo-microsoft-auth-session.d.ts",
|
|
53
|
+
"default": "./dist/expo-microsoft-auth-session.js"
|
|
49
54
|
}
|
|
50
55
|
},
|
|
51
56
|
"files": [
|
|
@@ -70,9 +75,9 @@
|
|
|
70
75
|
"prepublishOnly": "npm run check:generated && npm run build"
|
|
71
76
|
},
|
|
72
77
|
"peerDependencies": {
|
|
73
|
-
"expo-apple-authentication": ">=7 <9",
|
|
74
|
-
"expo-auth-session": ">=6 <8",
|
|
75
|
-
"expo-secure-store": ">=14 <16",
|
|
78
|
+
"expo-apple-authentication": ">=7 <9 || >=56 <58",
|
|
79
|
+
"expo-auth-session": ">=6 <8 || >=56 <58",
|
|
80
|
+
"expo-secure-store": ">=14 <16 || >=56 <58",
|
|
76
81
|
"react": "^18.0.0 || ^19.0.0",
|
|
77
82
|
"react-native": ">=0.76",
|
|
78
83
|
"react-native-nitro-google-signin": ">=2 <3",
|