@oxy.so/services 2.0.0 → 2.1.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/README.md +10 -0
- package/lib/commonjs/ui/components/OxySignInButton.js +36 -35
- package/lib/commonjs/ui/components/OxySignInButton.js.map +1 -1
- package/lib/module/ui/components/OxySignInButton.js +36 -35
- package/lib/module/ui/components/OxySignInButton.js.map +1 -1
- package/lib/typescript/commonjs/ui/components/OxySignInButton.d.ts +31 -12
- package/lib/typescript/commonjs/ui/components/OxySignInButton.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/OxySignInButton.d.ts +31 -12
- package/lib/typescript/module/ui/components/OxySignInButton.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/ui/components/OxySignInButton.tsx +73 -41
package/README.md
CHANGED
|
@@ -523,6 +523,16 @@ function LoginScreen() {
|
|
|
523
523
|
- **Official Oxy apps** (`isOfficial` / first-party types): opens the in-app account dialog.
|
|
524
524
|
- **Third-party apps** (`type: 'third_party'`): starts the standard OAuth 2.0 Authorization Code + PKCE flow against `auth.oxy.so` (the SDK generates `state` + PKCE via `@oxy.so/core`). On web the transport is `OxyProvider` prop `webAuthMode: 'popup' | 'redirect'` (default `'popup'`; issue #691 Phases 2/7b) — `'popup'` opens a small window and relays the result via `postMessage` without navigating your app's tab, falling back to a redirect if the browser blocks it. Pass `oauthRedirectUri`; on native handle `onOAuthResult` to complete the token exchange.
|
|
525
525
|
|
|
526
|
+
The button is Bloom's `SocialButton brand="oxy"` (Bloom 2.1+), so it matches every other sign-in button in the app. It reads **"Sign in with Oxy"**, localized; `action` changes the verb and `variant` / `appearance` the look:
|
|
527
|
+
|
|
528
|
+
```tsx
|
|
529
|
+
<OxySignInButton /> // Sign in with Oxy — outlined, Oxy mark
|
|
530
|
+
<OxySignInButton variant="contained" fullWidth /> // filled in the theme accent
|
|
531
|
+
<OxySignInButton action="signUp" /> // Sign up with Oxy
|
|
532
|
+
<OxySignInButton action="continue" appearance="black" />
|
|
533
|
+
<OxySignInButton iconOnly /> // circular, named "Sign in with Oxy"
|
|
534
|
+
```
|
|
535
|
+
|
|
526
536
|
See the [integration guide](../../docs/auth/integration-guide.md) for Console registration, OAuth endpoints, and backend verification, and [AUTHENTICATION.md](../../docs/AUTHENTICATION.md) for the full model.
|
|
527
537
|
|
|
528
538
|
### Documentation
|
|
@@ -9,12 +9,10 @@ var _reactNative = require("react-native");
|
|
|
9
9
|
var _core = require("@oxy.so/core");
|
|
10
10
|
var _authStore = require("../stores/authStore.js");
|
|
11
11
|
var _shallow = require("zustand/react/shallow");
|
|
12
|
-
var
|
|
13
|
-
var _button = require("@oxy.so/bloom/button");
|
|
12
|
+
var _socialButton = require("@oxy.so/bloom/social-button");
|
|
14
13
|
var _toast = require("@oxy.so/bloom/toast");
|
|
15
14
|
var _OxyContext = require("../context/OxyContext.js");
|
|
16
15
|
var _useI18n = require("../hooks/useI18n.js");
|
|
17
|
-
var _LogoIcon = require("./logo/LogoIcon.js");
|
|
18
16
|
var _accountDialogManager = require("../navigation/accountDialogManager.js");
|
|
19
17
|
var _oauthNavigation = require("./oauthNavigation.js");
|
|
20
18
|
var _oauthPopup = require("../oauth/oauthPopup.js");
|
|
@@ -26,6 +24,14 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
26
24
|
* transport (`useOxy().startWebOAuthSignIn`) and never uses this callback.
|
|
27
25
|
*/
|
|
28
26
|
|
|
27
|
+
/** The label's verb: "Sign in with Oxy", "Continue with Oxy" or "Sign up with Oxy". */
|
|
28
|
+
|
|
29
|
+
const ACTION_KEYS = {
|
|
30
|
+
signIn: 'accountSwitcher.signInWithOxy',
|
|
31
|
+
continue: 'accountSwitcher.continueWithOxy',
|
|
32
|
+
signUp: 'accountSwitcher.signUpWithOxy'
|
|
33
|
+
};
|
|
34
|
+
|
|
29
35
|
/**
|
|
30
36
|
* A pre-styled button component for signing in with Oxy identity
|
|
31
37
|
*
|
|
@@ -37,12 +43,11 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
37
43
|
* // Basic usage
|
|
38
44
|
* <OxySignInButton />
|
|
39
45
|
*
|
|
40
|
-
* //
|
|
41
|
-
* <OxySignInButton
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* />
|
|
46
|
+
* // The filled button, full width
|
|
47
|
+
* <OxySignInButton variant="contained" fullWidth />
|
|
48
|
+
*
|
|
49
|
+
* // "Sign up with Oxy" on a registration screen
|
|
50
|
+
* <OxySignInButton action="signUp" />
|
|
46
51
|
*
|
|
47
52
|
* // Custom handler
|
|
48
53
|
* <OxySignInButton onPress={() => {
|
|
@@ -52,6 +57,11 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
52
57
|
*/
|
|
53
58
|
const OxySignInButton = ({
|
|
54
59
|
variant = 'default',
|
|
60
|
+
appearance,
|
|
61
|
+
action = 'signIn',
|
|
62
|
+
size = 'medium',
|
|
63
|
+
fullWidth = false,
|
|
64
|
+
iconOnly = false,
|
|
55
65
|
onPress,
|
|
56
66
|
style,
|
|
57
67
|
textStyle,
|
|
@@ -61,7 +71,6 @@ const OxySignInButton = ({
|
|
|
61
71
|
oauthRedirectUri,
|
|
62
72
|
onOAuthResult
|
|
63
73
|
}) => {
|
|
64
|
-
const theme = (0, _theme.useTheme)();
|
|
65
74
|
const {
|
|
66
75
|
t
|
|
67
76
|
} = (0, _useI18n.useI18n)();
|
|
@@ -285,35 +294,27 @@ const OxySignInButton = ({
|
|
|
285
294
|
if (isAuthenticated && !showWhenAuthenticated) return null;
|
|
286
295
|
const isButtonDisabled = disabled || isLoading || isModalOpen;
|
|
287
296
|
|
|
288
|
-
//
|
|
289
|
-
//
|
|
290
|
-
const
|
|
291
|
-
|
|
292
|
-
// The Oxy mark reads white-on-primary for the filled (contained) button and
|
|
293
|
-
// primary-on-transparent for the outline / default surfaces.
|
|
294
|
-
const isContained = variant === 'contained';
|
|
295
|
-
const logoColor = isContained ? '#ffffff' : theme.colors.primary;
|
|
296
|
-
const logoLetterColor = isContained ? theme.colors.primary : '#ffffff';
|
|
297
|
+
// `contained` is the filled button in the theme accent; `default` and
|
|
298
|
+
// `outline` are the outlined button carrying the Oxy mark.
|
|
299
|
+
const resolvedAppearance = appearance ?? (variant === 'contained' ? 'colorful' : 'white');
|
|
297
300
|
|
|
298
|
-
//
|
|
299
|
-
//
|
|
300
|
-
const
|
|
301
|
-
|
|
302
|
-
|
|
301
|
+
// A key missing from every dictionary comes back as the key itself; fall
|
|
302
|
+
// back to Bloom's English phrase rather than render a dotted path.
|
|
303
|
+
const actionKey = ACTION_KEYS[action];
|
|
304
|
+
const translated = t(actionKey);
|
|
305
|
+
const label = text ?? (translated === actionKey ? (0, _socialButton.socialButtonLabel)('Oxy', action) : translated);
|
|
306
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_socialButton.SocialButton, {
|
|
307
|
+
brand: "oxy",
|
|
308
|
+
action: action,
|
|
309
|
+
appearance: resolvedAppearance,
|
|
310
|
+
size: size,
|
|
311
|
+
fullWidth: fullWidth,
|
|
312
|
+
iconOnly: iconOnly,
|
|
303
313
|
onPress: handlePress,
|
|
304
314
|
disabled: isButtonDisabled,
|
|
305
315
|
style: style,
|
|
306
|
-
textStyle:
|
|
307
|
-
|
|
308
|
-
} : null, textStyle],
|
|
309
|
-
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_LogoIcon.LogoIcon, {
|
|
310
|
-
height: 20,
|
|
311
|
-
color: logoColor,
|
|
312
|
-
letterColor: logoLetterColor,
|
|
313
|
-
style: {
|
|
314
|
-
marginRight: 10
|
|
315
|
-
}
|
|
316
|
-
}),
|
|
316
|
+
textStyle: textStyle,
|
|
317
|
+
accessibilityLabel: iconOnly ? label : undefined,
|
|
317
318
|
children: isLoading || isModalOpen ? t('signin.status.signingIn') : label
|
|
318
319
|
});
|
|
319
320
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactNative","_core","_authStore","_shallow","
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","_core","_authStore","_shallow","_socialButton","_toast","_OxyContext","_useI18n","_accountDialogManager","_oauthNavigation","_oauthPopup","_jsxRuntime","ACTION_KEYS","signIn","continue","signUp","OxySignInButton","variant","appearance","action","size","fullWidth","iconOnly","onPress","style","textStyle","text","disabled","showWhenAuthenticated","oauthRedirectUri","onOAuthResult","t","useI18n","openAccountDialog","oxyServices","clientId","webAuthMode","startWebOAuthSignIn","useOxy","isAuthenticated","isLoading","useAuthStore","useShallow","state","isModalOpen","setIsModalOpen","useState","useEffect","subscribeToAccountDialog","appResolutionRef","useRef","routingRef","shouldPreOpenPopup","Platform","OS","Boolean","resolvePublicApplication","useCallback","cached","current","promise","getPublicApplication","catch","error","notifyNotConfigured","appName","toast","description","app","notifyFailed","startOfficialSignIn","startThirdPartyOAuth","popup","closeOAuthPopup","logger","undefined","component","application","name","result","redirectUri","status","warn","reason","pkce","Promise","all","generatePkcePair","generateOAuthState","authorizeUrl","buildOAuthAuthorizeUrl","codeChallenge","redirectUrl","openAuthorizeUrlNative","codeVerifier","routeSignIn","resolving","type","isOfficial","Error","String","handlePress","openOAuthPopup","isButtonDisabled","resolvedAppearance","actionKey","translated","label","socialButtonLabel","jsx","SocialButton","brand","accessibilityLabel","children","exports","_default","default"],"sourceRoot":"../../../../src","sources":["ui/components/OxySignInButton.tsx"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAOA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AAOA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,qBAAA,GAAAT,OAAA;AACA,IAAAU,gBAAA,GAAAV,OAAA;AACA,I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IAAAsC,QAAA,EAEhDzE,SAAS,IAAII,WAAW,GAAGb,CAAC,CAAC,yBAAyB,CAAC,GAAG4E;EAAK,CACtD,CAAC;AAEvB,CAAC;AAACO,OAAA,CAAAlG,eAAA,GAAAA,eAAA;AAAA,IAAAmG,QAAA,GAAAD,OAAA,CAAAE,OAAA,GAEapG,eAAe","ignoreList":[]}
|
|
@@ -5,12 +5,10 @@ import { Platform } from 'react-native';
|
|
|
5
5
|
import { logger, generatePkcePair, generateOAuthState, buildOAuthAuthorizeUrl } from '@oxy.so/core';
|
|
6
6
|
import { useAuthStore } from "../stores/authStore.js";
|
|
7
7
|
import { useShallow } from 'zustand/react/shallow';
|
|
8
|
-
import {
|
|
9
|
-
import { Button } from '@oxy.so/bloom/button';
|
|
8
|
+
import { SocialButton, socialButtonLabel } from '@oxy.so/bloom/social-button';
|
|
10
9
|
import { toast } from '@oxy.so/bloom/toast';
|
|
11
10
|
import { useOxy } from "../context/OxyContext.js";
|
|
12
11
|
import { useI18n } from "../hooks/useI18n.js";
|
|
13
|
-
import { LogoIcon } from "./logo/LogoIcon.js";
|
|
14
12
|
import { subscribeToAccountDialog } from "../navigation/accountDialogManager.js";
|
|
15
13
|
import { openAuthorizeUrlNative } from "./oauthNavigation.js";
|
|
16
14
|
import { closeOAuthPopup, openOAuthPopup } from "../oauth/oauthPopup.js";
|
|
@@ -21,7 +19,15 @@ import { closeOAuthPopup, openOAuthPopup } from "../oauth/oauthPopup.js";
|
|
|
21
19
|
* (`POST /auth/oauth/token`). Web sign-in is handled entirely by the SDK's web
|
|
22
20
|
* transport (`useOxy().startWebOAuthSignIn`) and never uses this callback.
|
|
23
21
|
*/
|
|
22
|
+
|
|
23
|
+
/** The label's verb: "Sign in with Oxy", "Continue with Oxy" or "Sign up with Oxy". */
|
|
24
24
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
25
|
+
const ACTION_KEYS = {
|
|
26
|
+
signIn: 'accountSwitcher.signInWithOxy',
|
|
27
|
+
continue: 'accountSwitcher.continueWithOxy',
|
|
28
|
+
signUp: 'accountSwitcher.signUpWithOxy'
|
|
29
|
+
};
|
|
30
|
+
|
|
25
31
|
/**
|
|
26
32
|
* A pre-styled button component for signing in with Oxy identity
|
|
27
33
|
*
|
|
@@ -33,12 +39,11 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
33
39
|
* // Basic usage
|
|
34
40
|
* <OxySignInButton />
|
|
35
41
|
*
|
|
36
|
-
* //
|
|
37
|
-
* <OxySignInButton
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* />
|
|
42
|
+
* // The filled button, full width
|
|
43
|
+
* <OxySignInButton variant="contained" fullWidth />
|
|
44
|
+
*
|
|
45
|
+
* // "Sign up with Oxy" on a registration screen
|
|
46
|
+
* <OxySignInButton action="signUp" />
|
|
42
47
|
*
|
|
43
48
|
* // Custom handler
|
|
44
49
|
* <OxySignInButton onPress={() => {
|
|
@@ -48,6 +53,11 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
48
53
|
*/
|
|
49
54
|
export const OxySignInButton = ({
|
|
50
55
|
variant = 'default',
|
|
56
|
+
appearance,
|
|
57
|
+
action = 'signIn',
|
|
58
|
+
size = 'medium',
|
|
59
|
+
fullWidth = false,
|
|
60
|
+
iconOnly = false,
|
|
51
61
|
onPress,
|
|
52
62
|
style,
|
|
53
63
|
textStyle,
|
|
@@ -57,7 +67,6 @@ export const OxySignInButton = ({
|
|
|
57
67
|
oauthRedirectUri,
|
|
58
68
|
onOAuthResult
|
|
59
69
|
}) => {
|
|
60
|
-
const theme = useTheme();
|
|
61
70
|
const {
|
|
62
71
|
t
|
|
63
72
|
} = useI18n();
|
|
@@ -281,35 +290,27 @@ export const OxySignInButton = ({
|
|
|
281
290
|
if (isAuthenticated && !showWhenAuthenticated) return null;
|
|
282
291
|
const isButtonDisabled = disabled || isLoading || isModalOpen;
|
|
283
292
|
|
|
284
|
-
//
|
|
285
|
-
//
|
|
286
|
-
const
|
|
287
|
-
|
|
288
|
-
// The Oxy mark reads white-on-primary for the filled (contained) button and
|
|
289
|
-
// primary-on-transparent for the outline / default surfaces.
|
|
290
|
-
const isContained = variant === 'contained';
|
|
291
|
-
const logoColor = isContained ? '#ffffff' : theme.colors.primary;
|
|
292
|
-
const logoLetterColor = isContained ? theme.colors.primary : '#ffffff';
|
|
293
|
+
// `contained` is the filled button in the theme accent; `default` and
|
|
294
|
+
// `outline` are the outlined button carrying the Oxy mark.
|
|
295
|
+
const resolvedAppearance = appearance ?? (variant === 'contained' ? 'colorful' : 'white');
|
|
293
296
|
|
|
294
|
-
//
|
|
295
|
-
//
|
|
296
|
-
const
|
|
297
|
-
|
|
298
|
-
|
|
297
|
+
// A key missing from every dictionary comes back as the key itself; fall
|
|
298
|
+
// back to Bloom's English phrase rather than render a dotted path.
|
|
299
|
+
const actionKey = ACTION_KEYS[action];
|
|
300
|
+
const translated = t(actionKey);
|
|
301
|
+
const label = text ?? (translated === actionKey ? socialButtonLabel('Oxy', action) : translated);
|
|
302
|
+
return /*#__PURE__*/_jsx(SocialButton, {
|
|
303
|
+
brand: "oxy",
|
|
304
|
+
action: action,
|
|
305
|
+
appearance: resolvedAppearance,
|
|
306
|
+
size: size,
|
|
307
|
+
fullWidth: fullWidth,
|
|
308
|
+
iconOnly: iconOnly,
|
|
299
309
|
onPress: handlePress,
|
|
300
310
|
disabled: isButtonDisabled,
|
|
301
311
|
style: style,
|
|
302
|
-
textStyle:
|
|
303
|
-
|
|
304
|
-
} : null, textStyle],
|
|
305
|
-
icon: /*#__PURE__*/_jsx(LogoIcon, {
|
|
306
|
-
height: 20,
|
|
307
|
-
color: logoColor,
|
|
308
|
-
letterColor: logoLetterColor,
|
|
309
|
-
style: {
|
|
310
|
-
marginRight: 10
|
|
311
|
-
}
|
|
312
|
-
}),
|
|
312
|
+
textStyle: textStyle,
|
|
313
|
+
accessibilityLabel: iconOnly ? label : undefined,
|
|
313
314
|
children: isLoading || isModalOpen ? t('signin.status.signingIn') : label
|
|
314
315
|
});
|
|
315
316
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useCallback","useState","useEffect","useRef","Platform","logger","generatePkcePair","generateOAuthState","buildOAuthAuthorizeUrl","useAuthStore","useShallow","
|
|
1
|
+
{"version":3,"names":["useCallback","useState","useEffect","useRef","Platform","logger","generatePkcePair","generateOAuthState","buildOAuthAuthorizeUrl","useAuthStore","useShallow","SocialButton","socialButtonLabel","toast","useOxy","useI18n","subscribeToAccountDialog","openAuthorizeUrlNative","closeOAuthPopup","openOAuthPopup","jsx","_jsx","ACTION_KEYS","signIn","continue","signUp","OxySignInButton","variant","appearance","action","size","fullWidth","iconOnly","onPress","style","textStyle","text","disabled","showWhenAuthenticated","oauthRedirectUri","onOAuthResult","t","openAccountDialog","oxyServices","clientId","webAuthMode","startWebOAuthSignIn","isAuthenticated","isLoading","state","isModalOpen","setIsModalOpen","appResolutionRef","routingRef","shouldPreOpenPopup","OS","Boolean","resolvePublicApplication","cached","current","promise","getPublicApplication","catch","error","notifyNotConfigured","appName","description","app","notifyFailed","startOfficialSignIn","startThirdPartyOAuth","popup","undefined","component","application","name","result","redirectUri","status","warn","reason","pkce","Promise","all","authorizeUrl","codeChallenge","redirectUrl","codeVerifier","routeSignIn","resolving","type","isOfficial","Error","String","handlePress","isButtonDisabled","resolvedAppearance","actionKey","translated","label","brand","accessibilityLabel","children"],"sourceRoot":"../../../../src","sources":["ui/components/OxySignInButton.tsx"],"mappings":";;AACA,SAASA,WAAW,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAChE,SAAyDC,QAAQ,QAAQ,cAAc;AACvF,SACIC,MAAM,EACNC,gBAAgB,EAChBC,kBAAkB,EAClBC,sBAAsB,QAEnB,cAAc;AACrB,SAASC,YAAY,QAAQ,wBAAqB;AAClD,SAASC,UAAU,QAAQ,uBAAuB;AAClD,SACIC,YAAY,EACZC,iBAAiB,QAId,6BAA6B;AACpC,SA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SAAU;IAAA8B,QAAA,EAEhDtD,SAAS,IAAIE,WAAW,GAAGT,CAAC,CAAC,yBAAyB,CAAC,GAAG0D;EAAK,CACtD,CAAC;AAEvB,CAAC;AAED,eAAezE,eAAe","ignoreList":[]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import { type ViewStyle, type TextStyle, type StyleProp } from 'react-native';
|
|
3
|
+
import { type SocialButtonAction, type SocialButtonAppearance, type SocialButtonSize } from '@oxy.so/bloom/social-button';
|
|
3
4
|
/**
|
|
4
5
|
* The OAuth handshake surfaced to a NATIVE third-party RP via
|
|
5
6
|
* {@link OxySignInButtonProps.onOAuthResult} so it can finish the code exchange
|
|
@@ -14,12 +15,33 @@ export interface OxyOAuthResult {
|
|
|
14
15
|
/** The PKCE `code_verifier` to replay on the token exchange. */
|
|
15
16
|
codeVerifier: string;
|
|
16
17
|
}
|
|
18
|
+
/** The label's verb: "Sign in with Oxy", "Continue with Oxy" or "Sign up with Oxy". */
|
|
19
|
+
export type OxySignInButtonAction = SocialButtonAction;
|
|
17
20
|
export interface OxySignInButtonProps {
|
|
18
21
|
/**
|
|
19
|
-
*
|
|
22
|
+
* Shorthand for {@link OxySignInButtonProps.appearance}: `contained` is the
|
|
23
|
+
* filled button in the theme accent (`colorful`); `default` and `outline`
|
|
24
|
+
* are the outlined button with the Oxy mark (`white`).
|
|
20
25
|
* @default 'default'
|
|
21
26
|
*/
|
|
22
27
|
variant?: 'default' | 'outline' | 'contained';
|
|
28
|
+
/**
|
|
29
|
+
* Bloom `SocialButton` appearance — `colorful`, `white` or `black`. Wins
|
|
30
|
+
* over `variant` when both are given.
|
|
31
|
+
*/
|
|
32
|
+
appearance?: SocialButtonAppearance;
|
|
33
|
+
/**
|
|
34
|
+
* The label's verb, localized: `signIn` — "Sign in with Oxy", `continue` —
|
|
35
|
+
* "Continue with Oxy", `signUp` — "Sign up with Oxy".
|
|
36
|
+
* @default 'signIn'
|
|
37
|
+
*/
|
|
38
|
+
action?: OxySignInButtonAction;
|
|
39
|
+
/** `medium` (36 tall, 300 wide) or `small` (32 × 250). @default 'medium' */
|
|
40
|
+
size?: SocialButtonSize;
|
|
41
|
+
/** Fill the container's width instead of the fixed 300 / 250. */
|
|
42
|
+
fullWidth?: boolean;
|
|
43
|
+
/** A circular button showing only the Oxy mark; the label becomes its accessible name. */
|
|
44
|
+
iconOnly?: boolean;
|
|
23
45
|
/**
|
|
24
46
|
* Optional function to handle button press
|
|
25
47
|
* If not provided, the button will use the showBottomSheet method from OxyContext
|
|
@@ -34,12 +56,10 @@ export interface OxySignInButtonProps {
|
|
|
34
56
|
*/
|
|
35
57
|
textStyle?: StyleProp<TextStyle>;
|
|
36
58
|
/**
|
|
37
|
-
* Overrides the button label. When omitted the
|
|
38
|
-
*
|
|
39
|
-
* ("Continue with Oxy" in English). "Sign in with Oxy" remains the name of
|
|
40
|
-
* the MECHANISM — only this surface's label is "Continue with Oxy".
|
|
59
|
+
* Overrides the button label. When omitted the label is the localized
|
|
60
|
+
* {@link OxySignInButtonProps.action} phrase.
|
|
41
61
|
*
|
|
42
|
-
* @default localized
|
|
62
|
+
* @default localized "Sign in with Oxy"
|
|
43
63
|
*/
|
|
44
64
|
text?: string;
|
|
45
65
|
/**
|
|
@@ -95,12 +115,11 @@ export interface OxySignInButtonProps {
|
|
|
95
115
|
* // Basic usage
|
|
96
116
|
* <OxySignInButton />
|
|
97
117
|
*
|
|
98
|
-
* //
|
|
99
|
-
* <OxySignInButton
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
* />
|
|
118
|
+
* // The filled button, full width
|
|
119
|
+
* <OxySignInButton variant="contained" fullWidth />
|
|
120
|
+
*
|
|
121
|
+
* // "Sign up with Oxy" on a registration screen
|
|
122
|
+
* <OxySignInButton action="signUp" />
|
|
104
123
|
*
|
|
105
124
|
* // Custom handler
|
|
106
125
|
* <OxySignInButton onPress={() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OxySignInButton.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/OxySignInButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAY,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"OxySignInButton.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/OxySignInButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAY,MAAM,cAAc,CAAC;AAUxF,OAAO,EAGH,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACxB,MAAM,6BAA6B,CAAC;AASrC;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC3B,sGAAsG;IACtG,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,sFAAsF;IACtF,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,YAAY,EAAE,MAAM,CAAC;CACxB;AAED,uFAAuF;AACvF,MAAM,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAEvD,MAAM,WAAW,oBAAoB;IACjC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,CAAC;IAE9C;;;OAGG;IACH,UAAU,CAAC,EAAE,sBAAsB,CAAC;IAEpC;;;;OAIG;IACH,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAE/B,4EAA4E;IAC5E,IAAI,CAAC,EAAE,gBAAgB,CAAC;IAExB,iEAAiE;IACjE,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAE7B;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAEjC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC;;;;;;;OAOG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;CACpD;AAQD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAqR1D,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import { type ViewStyle, type TextStyle, type StyleProp } from 'react-native';
|
|
3
|
+
import { type SocialButtonAction, type SocialButtonAppearance, type SocialButtonSize } from '@oxy.so/bloom/social-button';
|
|
3
4
|
/**
|
|
4
5
|
* The OAuth handshake surfaced to a NATIVE third-party RP via
|
|
5
6
|
* {@link OxySignInButtonProps.onOAuthResult} so it can finish the code exchange
|
|
@@ -14,12 +15,33 @@ export interface OxyOAuthResult {
|
|
|
14
15
|
/** The PKCE `code_verifier` to replay on the token exchange. */
|
|
15
16
|
codeVerifier: string;
|
|
16
17
|
}
|
|
18
|
+
/** The label's verb: "Sign in with Oxy", "Continue with Oxy" or "Sign up with Oxy". */
|
|
19
|
+
export type OxySignInButtonAction = SocialButtonAction;
|
|
17
20
|
export interface OxySignInButtonProps {
|
|
18
21
|
/**
|
|
19
|
-
*
|
|
22
|
+
* Shorthand for {@link OxySignInButtonProps.appearance}: `contained` is the
|
|
23
|
+
* filled button in the theme accent (`colorful`); `default` and `outline`
|
|
24
|
+
* are the outlined button with the Oxy mark (`white`).
|
|
20
25
|
* @default 'default'
|
|
21
26
|
*/
|
|
22
27
|
variant?: 'default' | 'outline' | 'contained';
|
|
28
|
+
/**
|
|
29
|
+
* Bloom `SocialButton` appearance — `colorful`, `white` or `black`. Wins
|
|
30
|
+
* over `variant` when both are given.
|
|
31
|
+
*/
|
|
32
|
+
appearance?: SocialButtonAppearance;
|
|
33
|
+
/**
|
|
34
|
+
* The label's verb, localized: `signIn` — "Sign in with Oxy", `continue` —
|
|
35
|
+
* "Continue with Oxy", `signUp` — "Sign up with Oxy".
|
|
36
|
+
* @default 'signIn'
|
|
37
|
+
*/
|
|
38
|
+
action?: OxySignInButtonAction;
|
|
39
|
+
/** `medium` (36 tall, 300 wide) or `small` (32 × 250). @default 'medium' */
|
|
40
|
+
size?: SocialButtonSize;
|
|
41
|
+
/** Fill the container's width instead of the fixed 300 / 250. */
|
|
42
|
+
fullWidth?: boolean;
|
|
43
|
+
/** A circular button showing only the Oxy mark; the label becomes its accessible name. */
|
|
44
|
+
iconOnly?: boolean;
|
|
23
45
|
/**
|
|
24
46
|
* Optional function to handle button press
|
|
25
47
|
* If not provided, the button will use the showBottomSheet method from OxyContext
|
|
@@ -34,12 +56,10 @@ export interface OxySignInButtonProps {
|
|
|
34
56
|
*/
|
|
35
57
|
textStyle?: StyleProp<TextStyle>;
|
|
36
58
|
/**
|
|
37
|
-
* Overrides the button label. When omitted the
|
|
38
|
-
*
|
|
39
|
-
* ("Continue with Oxy" in English). "Sign in with Oxy" remains the name of
|
|
40
|
-
* the MECHANISM — only this surface's label is "Continue with Oxy".
|
|
59
|
+
* Overrides the button label. When omitted the label is the localized
|
|
60
|
+
* {@link OxySignInButtonProps.action} phrase.
|
|
41
61
|
*
|
|
42
|
-
* @default localized
|
|
62
|
+
* @default localized "Sign in with Oxy"
|
|
43
63
|
*/
|
|
44
64
|
text?: string;
|
|
45
65
|
/**
|
|
@@ -95,12 +115,11 @@ export interface OxySignInButtonProps {
|
|
|
95
115
|
* // Basic usage
|
|
96
116
|
* <OxySignInButton />
|
|
97
117
|
*
|
|
98
|
-
* //
|
|
99
|
-
* <OxySignInButton
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
* />
|
|
118
|
+
* // The filled button, full width
|
|
119
|
+
* <OxySignInButton variant="contained" fullWidth />
|
|
120
|
+
*
|
|
121
|
+
* // "Sign up with Oxy" on a registration screen
|
|
122
|
+
* <OxySignInButton action="signUp" />
|
|
104
123
|
*
|
|
105
124
|
* // Custom handler
|
|
106
125
|
* <OxySignInButton onPress={() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OxySignInButton.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/OxySignInButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAY,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"OxySignInButton.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/OxySignInButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAY,MAAM,cAAc,CAAC;AAUxF,OAAO,EAGH,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACxB,MAAM,6BAA6B,CAAC;AASrC;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC3B,sGAAsG;IACtG,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,sFAAsF;IACtF,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,YAAY,EAAE,MAAM,CAAC;CACxB;AAED,uFAAuF;AACvF,MA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components, screens, and native features",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
"@types/jest": "^30.0.0",
|
|
180
180
|
"@types/node": "^20.19.43",
|
|
181
181
|
"@types/react": "*",
|
|
182
|
-
"@oxy.so/bloom": "^2.
|
|
182
|
+
"@oxy.so/bloom": "^2.1.0",
|
|
183
183
|
"copyfiles": "^2.4.1",
|
|
184
184
|
"expo-constants": "~57.0.5",
|
|
185
185
|
"expo-file-system": "~57.0.1",
|
|
@@ -212,10 +212,10 @@
|
|
|
212
212
|
"typescript": "^5.9.2",
|
|
213
213
|
"zustand": "^5.0.14"
|
|
214
214
|
},
|
|
215
|
-
"//@oxy.so/bloom": "RE-RAISE THIS FLOOR ON EVERY BREAKING BLOOM RELEASE, in the same commit as the root package.json catalog entry and the code that requires it. Bloom is now at or above 2.0.0, so the breaking position is the MAJOR and `^2.
|
|
215
|
+
"//@oxy.so/bloom": "RE-RAISE THIS FLOOR ON EVERY BREAKING BLOOM RELEASE, in the same commit as the root package.json catalog entry and the code that requires it. Bloom is now at or above 2.0.0, so the breaking position is the MAJOR and `^2.1.0` means `>=2.1.0 <3.0.0` (the floor is 2.1.0 because `OxySignInButton` renders `SocialButton brand=\"oxy\"`, which 2.1.0 added): 2.x minors are admitted on semver's additive promise, and Bloom 3.0.0 is refused until someone raises this deliberately. The floor was raised from `^1.0.0` for Bloom 2.0.0, which removed every hand-drawn icon (now Remix `Ri*` names) and the `benefit-list` and `profile-card` subpaths this package imported. The CAP is the part that is load-bearing. An earlier revision of this key recorded the opposite trade -- an uncapped `>=` floor, accepted so that intentionally-breaking Bloom 0.x minors would not be blocked -- and that trade is now closed by evidence rather than by preference: an unbounded range is exactly what let `bun install` pair this package with Bloom 1.0.0 and emit no warning at all, and 1.0.0 broke it four ways (a deleted provider, a renamed confirm option, a renamed Chip fill, and two REMOVED SUBPATHS that fail at bundle time, before any typecheck runs). A floor is a claim about what was measured; a cap is the claim that nothing beyond it was.",
|
|
216
216
|
"peerDependencies": {
|
|
217
217
|
"@expo/vector-icons": "^15.0.3",
|
|
218
|
-
"@oxy.so/bloom": "^2.
|
|
218
|
+
"@oxy.so/bloom": "^2.1.0",
|
|
219
219
|
"@oxy.so/core": "^1.0.1",
|
|
220
220
|
"@react-native-async-storage/async-storage": "^2.0.0",
|
|
221
221
|
"@react-native-community/netinfo": ">=11.4.1",
|
|
@@ -10,12 +10,16 @@ import {
|
|
|
10
10
|
} from '@oxy.so/core';
|
|
11
11
|
import { useAuthStore } from '../stores/authStore';
|
|
12
12
|
import { useShallow } from 'zustand/react/shallow';
|
|
13
|
-
import {
|
|
14
|
-
|
|
13
|
+
import {
|
|
14
|
+
SocialButton,
|
|
15
|
+
socialButtonLabel,
|
|
16
|
+
type SocialButtonAction,
|
|
17
|
+
type SocialButtonAppearance,
|
|
18
|
+
type SocialButtonSize,
|
|
19
|
+
} from '@oxy.so/bloom/social-button';
|
|
15
20
|
import { toast } from '@oxy.so/bloom/toast';
|
|
16
21
|
import { useOxy } from '../context/OxyContext';
|
|
17
22
|
import { useI18n } from '../hooks/useI18n';
|
|
18
|
-
import { LogoIcon } from './logo/LogoIcon';
|
|
19
23
|
import { subscribeToAccountDialog } from '../navigation/accountDialogManager';
|
|
20
24
|
import { openAuthorizeUrlNative } from './oauthNavigation';
|
|
21
25
|
import { closeOAuthPopup, openOAuthPopup } from '../oauth/oauthPopup';
|
|
@@ -36,13 +40,40 @@ export interface OxyOAuthResult {
|
|
|
36
40
|
codeVerifier: string;
|
|
37
41
|
}
|
|
38
42
|
|
|
43
|
+
/** The label's verb: "Sign in with Oxy", "Continue with Oxy" or "Sign up with Oxy". */
|
|
44
|
+
export type OxySignInButtonAction = SocialButtonAction;
|
|
45
|
+
|
|
39
46
|
export interface OxySignInButtonProps {
|
|
40
47
|
/**
|
|
41
|
-
*
|
|
48
|
+
* Shorthand for {@link OxySignInButtonProps.appearance}: `contained` is the
|
|
49
|
+
* filled button in the theme accent (`colorful`); `default` and `outline`
|
|
50
|
+
* are the outlined button with the Oxy mark (`white`).
|
|
42
51
|
* @default 'default'
|
|
43
52
|
*/
|
|
44
53
|
variant?: 'default' | 'outline' | 'contained';
|
|
45
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Bloom `SocialButton` appearance — `colorful`, `white` or `black`. Wins
|
|
57
|
+
* over `variant` when both are given.
|
|
58
|
+
*/
|
|
59
|
+
appearance?: SocialButtonAppearance;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The label's verb, localized: `signIn` — "Sign in with Oxy", `continue` —
|
|
63
|
+
* "Continue with Oxy", `signUp` — "Sign up with Oxy".
|
|
64
|
+
* @default 'signIn'
|
|
65
|
+
*/
|
|
66
|
+
action?: OxySignInButtonAction;
|
|
67
|
+
|
|
68
|
+
/** `medium` (36 tall, 300 wide) or `small` (32 × 250). @default 'medium' */
|
|
69
|
+
size?: SocialButtonSize;
|
|
70
|
+
|
|
71
|
+
/** Fill the container's width instead of the fixed 300 / 250. */
|
|
72
|
+
fullWidth?: boolean;
|
|
73
|
+
|
|
74
|
+
/** A circular button showing only the Oxy mark; the label becomes its accessible name. */
|
|
75
|
+
iconOnly?: boolean;
|
|
76
|
+
|
|
46
77
|
/**
|
|
47
78
|
* Optional function to handle button press
|
|
48
79
|
* If not provided, the button will use the showBottomSheet method from OxyContext
|
|
@@ -60,12 +91,10 @@ export interface OxySignInButtonProps {
|
|
|
60
91
|
textStyle?: StyleProp<TextStyle>;
|
|
61
92
|
|
|
62
93
|
/**
|
|
63
|
-
* Overrides the button label. When omitted the
|
|
64
|
-
*
|
|
65
|
-
* ("Continue with Oxy" in English). "Sign in with Oxy" remains the name of
|
|
66
|
-
* the MECHANISM — only this surface's label is "Continue with Oxy".
|
|
94
|
+
* Overrides the button label. When omitted the label is the localized
|
|
95
|
+
* {@link OxySignInButtonProps.action} phrase.
|
|
67
96
|
*
|
|
68
|
-
* @default localized
|
|
97
|
+
* @default localized "Sign in with Oxy"
|
|
69
98
|
*/
|
|
70
99
|
text?: string;
|
|
71
100
|
|
|
@@ -115,6 +144,12 @@ export interface OxySignInButtonProps {
|
|
|
115
144
|
onOAuthResult?: (result: OxyOAuthResult) => void;
|
|
116
145
|
}
|
|
117
146
|
|
|
147
|
+
const ACTION_KEYS: Record<OxySignInButtonAction, string> = {
|
|
148
|
+
signIn: 'accountSwitcher.signInWithOxy',
|
|
149
|
+
continue: 'accountSwitcher.continueWithOxy',
|
|
150
|
+
signUp: 'accountSwitcher.signUpWithOxy',
|
|
151
|
+
};
|
|
152
|
+
|
|
118
153
|
/**
|
|
119
154
|
* A pre-styled button component for signing in with Oxy identity
|
|
120
155
|
*
|
|
@@ -126,12 +161,11 @@ export interface OxySignInButtonProps {
|
|
|
126
161
|
* // Basic usage
|
|
127
162
|
* <OxySignInButton />
|
|
128
163
|
*
|
|
129
|
-
* //
|
|
130
|
-
* <OxySignInButton
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
* />
|
|
164
|
+
* // The filled button, full width
|
|
165
|
+
* <OxySignInButton variant="contained" fullWidth />
|
|
166
|
+
*
|
|
167
|
+
* // "Sign up with Oxy" on a registration screen
|
|
168
|
+
* <OxySignInButton action="signUp" />
|
|
135
169
|
*
|
|
136
170
|
* // Custom handler
|
|
137
171
|
* <OxySignInButton onPress={() => {
|
|
@@ -141,6 +175,11 @@ export interface OxySignInButtonProps {
|
|
|
141
175
|
*/
|
|
142
176
|
export const OxySignInButton: React.FC<OxySignInButtonProps> = ({
|
|
143
177
|
variant = 'default',
|
|
178
|
+
appearance,
|
|
179
|
+
action = 'signIn',
|
|
180
|
+
size = 'medium',
|
|
181
|
+
fullWidth = false,
|
|
182
|
+
iconOnly = false,
|
|
144
183
|
onPress,
|
|
145
184
|
style,
|
|
146
185
|
textStyle,
|
|
@@ -150,7 +189,6 @@ export const OxySignInButton: React.FC<OxySignInButtonProps> = ({
|
|
|
150
189
|
oauthRedirectUri,
|
|
151
190
|
onOAuthResult,
|
|
152
191
|
}) => {
|
|
153
|
-
const theme = useTheme();
|
|
154
192
|
const { t } = useI18n();
|
|
155
193
|
const { openAccountDialog, oxyServices, clientId, webAuthMode, startWebOAuthSignIn } = useOxy();
|
|
156
194
|
const { isAuthenticated, isLoading } = useAuthStore(
|
|
@@ -384,39 +422,33 @@ export const OxySignInButton: React.FC<OxySignInButtonProps> = ({
|
|
|
384
422
|
|
|
385
423
|
const isButtonDisabled = disabled || isLoading || isModalOpen;
|
|
386
424
|
|
|
387
|
-
//
|
|
388
|
-
//
|
|
389
|
-
const
|
|
390
|
-
|
|
425
|
+
// `contained` is the filled button in the theme accent; `default` and
|
|
426
|
+
// `outline` are the outlined button carrying the Oxy mark.
|
|
427
|
+
const resolvedAppearance: SocialButtonAppearance =
|
|
428
|
+
appearance ?? (variant === 'contained' ? 'colorful' : 'white');
|
|
391
429
|
|
|
392
|
-
//
|
|
393
|
-
//
|
|
394
|
-
const
|
|
395
|
-
const
|
|
396
|
-
const
|
|
397
|
-
|
|
398
|
-
// The relying party surfaces exactly ONE primary action, and it reads
|
|
399
|
-
// "Continue with Oxy" (issue #691). A caller-supplied `text` still wins.
|
|
400
|
-
const label = text ?? t('accountSwitcher.continueWithOxy');
|
|
430
|
+
// A key missing from every dictionary comes back as the key itself; fall
|
|
431
|
+
// back to Bloom's English phrase rather than render a dotted path.
|
|
432
|
+
const actionKey = ACTION_KEYS[action];
|
|
433
|
+
const translated = t(actionKey);
|
|
434
|
+
const label = text ?? (translated === actionKey ? socialButtonLabel('Oxy', action) : translated);
|
|
401
435
|
|
|
402
436
|
return (
|
|
403
|
-
<
|
|
404
|
-
|
|
437
|
+
<SocialButton
|
|
438
|
+
brand="oxy"
|
|
439
|
+
action={action}
|
|
440
|
+
appearance={resolvedAppearance}
|
|
441
|
+
size={size}
|
|
442
|
+
fullWidth={fullWidth}
|
|
443
|
+
iconOnly={iconOnly}
|
|
405
444
|
onPress={handlePress}
|
|
406
445
|
disabled={isButtonDisabled}
|
|
407
446
|
style={style}
|
|
408
|
-
textStyle={
|
|
409
|
-
|
|
410
|
-
<LogoIcon
|
|
411
|
-
height={20}
|
|
412
|
-
color={logoColor}
|
|
413
|
-
letterColor={logoLetterColor}
|
|
414
|
-
style={{ marginRight: 10 }}
|
|
415
|
-
/>
|
|
416
|
-
}
|
|
447
|
+
textStyle={textStyle}
|
|
448
|
+
accessibilityLabel={iconOnly ? label : undefined}
|
|
417
449
|
>
|
|
418
450
|
{isLoading || isModalOpen ? t('signin.status.signingIn') : label}
|
|
419
|
-
</
|
|
451
|
+
</SocialButton>
|
|
420
452
|
);
|
|
421
453
|
};
|
|
422
454
|
|