@oxyhq/services 10.3.3 → 10.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.
Files changed (74) hide show
  1. package/lib/commonjs/ui/components/AnotherDeviceQR.js +121 -0
  2. package/lib/commonjs/ui/components/AnotherDeviceQR.js.map +1 -0
  3. package/lib/commonjs/ui/components/OxyProvider.js +2 -0
  4. package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
  5. package/lib/commonjs/ui/components/SignInModal.js +145 -356
  6. package/lib/commonjs/ui/components/SignInModal.js.map +1 -1
  7. package/lib/commonjs/ui/context/OxyContext.js +49 -9
  8. package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
  9. package/lib/commonjs/ui/hooks/queries/queryKeys.js +5 -0
  10. package/lib/commonjs/ui/hooks/queries/queryKeys.js.map +1 -1
  11. package/lib/commonjs/ui/hooks/useFollow.js +28 -12
  12. package/lib/commonjs/ui/hooks/useFollow.js.map +1 -1
  13. package/lib/commonjs/ui/hooks/useOxyAuthSession.js +458 -0
  14. package/lib/commonjs/ui/hooks/useOxyAuthSession.js.map +1 -0
  15. package/lib/commonjs/ui/screens/OxyAuthScreen.js +62 -460
  16. package/lib/commonjs/ui/screens/OxyAuthScreen.js.map +1 -1
  17. package/lib/module/ui/components/AnotherDeviceQR.js +116 -0
  18. package/lib/module/ui/components/AnotherDeviceQR.js.map +1 -0
  19. package/lib/module/ui/components/OxyProvider.js +2 -0
  20. package/lib/module/ui/components/OxyProvider.js.map +1 -1
  21. package/lib/module/ui/components/SignInModal.js +149 -358
  22. package/lib/module/ui/components/SignInModal.js.map +1 -1
  23. package/lib/module/ui/context/OxyContext.js +49 -9
  24. package/lib/module/ui/context/OxyContext.js.map +1 -1
  25. package/lib/module/ui/hooks/queries/queryKeys.js +5 -0
  26. package/lib/module/ui/hooks/queries/queryKeys.js.map +1 -1
  27. package/lib/module/ui/hooks/useFollow.js +29 -13
  28. package/lib/module/ui/hooks/useFollow.js.map +1 -1
  29. package/lib/module/ui/hooks/useOxyAuthSession.js +452 -0
  30. package/lib/module/ui/hooks/useOxyAuthSession.js.map +1 -0
  31. package/lib/module/ui/screens/OxyAuthScreen.js +62 -460
  32. package/lib/module/ui/screens/OxyAuthScreen.js.map +1 -1
  33. package/lib/typescript/commonjs/ui/components/AnotherDeviceQR.d.ts +24 -0
  34. package/lib/typescript/commonjs/ui/components/AnotherDeviceQR.d.ts.map +1 -0
  35. package/lib/typescript/commonjs/ui/components/OxyProvider.d.ts.map +1 -1
  36. package/lib/typescript/commonjs/ui/components/SignInModal.d.ts +10 -5
  37. package/lib/typescript/commonjs/ui/components/SignInModal.d.ts.map +1 -1
  38. package/lib/typescript/commonjs/ui/context/OxyContext.d.ts +10 -0
  39. package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
  40. package/lib/typescript/commonjs/ui/hooks/queries/queryKeys.d.ts +4 -0
  41. package/lib/typescript/commonjs/ui/hooks/queries/queryKeys.d.ts.map +1 -1
  42. package/lib/typescript/commonjs/ui/hooks/useFollow.d.ts.map +1 -1
  43. package/lib/typescript/commonjs/ui/hooks/useOxyAuthSession.d.ts +83 -0
  44. package/lib/typescript/commonjs/ui/hooks/useOxyAuthSession.d.ts.map +1 -0
  45. package/lib/typescript/commonjs/ui/screens/OxyAuthScreen.d.ts +12 -8
  46. package/lib/typescript/commonjs/ui/screens/OxyAuthScreen.d.ts.map +1 -1
  47. package/lib/typescript/commonjs/ui/types/navigation.d.ts +17 -0
  48. package/lib/typescript/commonjs/ui/types/navigation.d.ts.map +1 -1
  49. package/lib/typescript/module/ui/components/AnotherDeviceQR.d.ts +24 -0
  50. package/lib/typescript/module/ui/components/AnotherDeviceQR.d.ts.map +1 -0
  51. package/lib/typescript/module/ui/components/OxyProvider.d.ts.map +1 -1
  52. package/lib/typescript/module/ui/components/SignInModal.d.ts +10 -5
  53. package/lib/typescript/module/ui/components/SignInModal.d.ts.map +1 -1
  54. package/lib/typescript/module/ui/context/OxyContext.d.ts +10 -0
  55. package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
  56. package/lib/typescript/module/ui/hooks/queries/queryKeys.d.ts +4 -0
  57. package/lib/typescript/module/ui/hooks/queries/queryKeys.d.ts.map +1 -1
  58. package/lib/typescript/module/ui/hooks/useFollow.d.ts.map +1 -1
  59. package/lib/typescript/module/ui/hooks/useOxyAuthSession.d.ts +83 -0
  60. package/lib/typescript/module/ui/hooks/useOxyAuthSession.d.ts.map +1 -0
  61. package/lib/typescript/module/ui/screens/OxyAuthScreen.d.ts +12 -8
  62. package/lib/typescript/module/ui/screens/OxyAuthScreen.d.ts.map +1 -1
  63. package/lib/typescript/module/ui/types/navigation.d.ts +17 -0
  64. package/lib/typescript/module/ui/types/navigation.d.ts.map +1 -1
  65. package/package.json +2 -2
  66. package/src/ui/components/AnotherDeviceQR.tsx +111 -0
  67. package/src/ui/components/OxyProvider.tsx +2 -0
  68. package/src/ui/components/SignInModal.tsx +142 -381
  69. package/src/ui/context/OxyContext.tsx +59 -8
  70. package/src/ui/hooks/queries/queryKeys.ts +6 -0
  71. package/src/ui/hooks/useFollow.ts +30 -12
  72. package/src/ui/hooks/useOxyAuthSession.ts +556 -0
  73. package/src/ui/screens/OxyAuthScreen.tsx +61 -506
  74. package/src/ui/types/navigation.ts +17 -0
@@ -0,0 +1,111 @@
1
+ /**
2
+ * AnotherDeviceQR — the collapsed "Sign in on another device" disclosure shared
3
+ * by both sign-in containers (`SignInModal` on web, `OxyAuthScreen` on native).
4
+ *
5
+ * The QR code is always DEMOTED below the platform-primary "Continue with Oxy"
6
+ * action: you cannot scan your own screen, so the QR is only useful for handing
7
+ * sign-in to a SECOND device (scan with the Oxy Accounts app there). It lives
8
+ * inside a tap-to-expand disclosure so it never competes with the primary CTA.
9
+ *
10
+ * The QR plate stays white intentionally — high contrast is required for
11
+ * reliable scanning regardless of the app theme.
12
+ */
13
+
14
+ import type React from 'react';
15
+ import { useState, useCallback } from 'react';
16
+ import { View, Text, TouchableOpacity, StyleSheet } from 'react-native';
17
+ import QRCode from 'react-native-qrcode-svg';
18
+ import { useTheme } from '@oxyhq/bloom/theme';
19
+
20
+ export interface AnotherDeviceQRProps {
21
+ /** The QR payload (`oxyauth://<token>`). Empty string renders nothing. */
22
+ qrData: string;
23
+ }
24
+
25
+ /** Size, in px, of the rendered QR symbol. */
26
+ const QR_SIZE = 200;
27
+
28
+ /**
29
+ * Collapsed disclosure that reveals a high-contrast QR for signing in on a
30
+ * second device with the Oxy Accounts app.
31
+ */
32
+ const AnotherDeviceQR: React.FC<AnotherDeviceQRProps> = ({ qrData }) => {
33
+ const { colors } = useTheme();
34
+ const [expanded, setExpanded] = useState(false);
35
+
36
+ const toggle = useCallback(() => {
37
+ setExpanded((prev) => !prev);
38
+ }, []);
39
+
40
+ if (!qrData) {
41
+ return null;
42
+ }
43
+
44
+ return (
45
+ <View style={styles.container}>
46
+ <TouchableOpacity
47
+ style={styles.toggle}
48
+ onPress={toggle}
49
+ accessibilityRole="button"
50
+ accessibilityState={{ expanded }}
51
+ accessibilityHint="Reveals a QR code to sign in using the Oxy Accounts app on another device"
52
+ >
53
+ <Text style={styles.toggleText} className="text-muted-foreground">
54
+ Sign in on another device
55
+ </Text>
56
+ <Text style={styles.chevron} className="text-muted-foreground">
57
+ {expanded ? '✕' : '›'}
58
+ </Text>
59
+ </TouchableOpacity>
60
+
61
+ {expanded && (
62
+ <View style={styles.body}>
63
+ {/* The QR plate is intentionally white for scan reliability. */}
64
+ <View style={[styles.qrPlate, { backgroundColor: '#FFFFFF' }]}>
65
+ <QRCode value={qrData} size={QR_SIZE} backgroundColor="#FFFFFF" color="#000000" />
66
+ </View>
67
+ <Text style={[styles.hint, { color: colors.textSecondary }]}>
68
+ Scan with the Oxy Accounts app
69
+ </Text>
70
+ </View>
71
+ )}
72
+ </View>
73
+ );
74
+ };
75
+
76
+ const styles = StyleSheet.create({
77
+ container: {
78
+ width: '100%',
79
+ alignItems: 'center',
80
+ },
81
+ toggle: {
82
+ flexDirection: 'row',
83
+ alignItems: 'center',
84
+ justifyContent: 'center',
85
+ paddingVertical: 12,
86
+ paddingHorizontal: 8,
87
+ },
88
+ toggleText: {
89
+ fontSize: 14,
90
+ fontWeight: '600',
91
+ },
92
+ chevron: {
93
+ fontSize: 16,
94
+ marginLeft: 8,
95
+ },
96
+ body: {
97
+ alignItems: 'center',
98
+ marginTop: 8,
99
+ },
100
+ qrPlate: {
101
+ padding: 16,
102
+ borderRadius: 16,
103
+ },
104
+ hint: {
105
+ marginTop: 12,
106
+ fontSize: 12,
107
+ textAlign: 'center',
108
+ },
109
+ });
110
+
111
+ export default AnotherDeviceQR;
@@ -107,6 +107,7 @@ const OxyProvider: FC<OxyProviderProps> = ({
107
107
  baseURL,
108
108
  authWebUrl,
109
109
  authRedirectUri,
110
+ disableAutoSso,
110
111
  queryClient: providedQueryClient,
111
112
  }) => {
112
113
 
@@ -298,6 +299,7 @@ const OxyProvider: FC<OxyProviderProps> = ({
298
299
  authRedirectUri={authRedirectUri}
299
300
  storageKeyPrefix={storageKeyPrefix}
300
301
  clientId={clientId}
302
+ disableAutoSso={disableAutoSso}
301
303
  onAuthStateChange={onAuthStateChange as OxyContextProviderProps['onAuthStateChange']}
302
304
  >
303
305
  {children}