yaver-feedback-react-native 0.7.10 → 0.7.11

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.
@@ -37,6 +37,51 @@ exports.YaverLoginScreen = void 0;
37
37
  const react_1 = __importStar(require("react"));
38
38
  const react_native_1 = require("react-native");
39
39
  const auth_1 = require("./auth");
40
+ const PROVIDER_THEME = {
41
+ apple: { ion: 'logo-apple', letter: '', fg: '#FFFFFF', bg: 'transparent' },
42
+ google: { ion: 'logo-google', letter: 'G', fg: '#EA4335', bg: 'transparent' },
43
+ github: { ion: 'logo-github', letter: 'G', fg: '#FFFFFF', bg: 'transparent' },
44
+ gitlab: { ion: 'logo-gitlab', letter: 'G', fg: '#FC6D26', bg: 'transparent' },
45
+ microsoft: { ion: 'logo-microsoft', letter: 'M', fg: '#00A4EF', bg: 'transparent' },
46
+ };
47
+ const ProviderLogo = ({ provider, }) => {
48
+ const theme = PROVIDER_THEME[provider] ?? PROVIDER_THEME.apple;
49
+ // Soft-require @expo/vector-icons so the SDK works in bare-RN apps
50
+ // that don't ship Expo. If present, render the brand glyph; if
51
+ // not, render a coloured monogram fallback.
52
+ let Ionicons = null;
53
+ try {
54
+ const mod = require('@expo/vector-icons');
55
+ Ionicons = mod?.Ionicons ?? null;
56
+ }
57
+ catch {
58
+ // package not installed — use letter fallback
59
+ }
60
+ if (Ionicons) {
61
+ return (<Ionicons name={theme.ion} size={18} color={theme.fg} style={iconStyles.icon}/>);
62
+ }
63
+ if (!theme.letter) {
64
+ return null;
65
+ }
66
+ return (<react_native_1.View style={[iconStyles.fallback, { backgroundColor: theme.fg + '22' }]}>
67
+ <react_native_1.Text style={[iconStyles.fallbackText, { color: theme.fg }]}>{theme.letter}</react_native_1.Text>
68
+ </react_native_1.View>);
69
+ };
70
+ const iconStyles = react_native_1.StyleSheet.create({
71
+ icon: { marginRight: 12 },
72
+ fallback: {
73
+ width: 22,
74
+ height: 22,
75
+ borderRadius: 11,
76
+ alignItems: 'center',
77
+ justifyContent: 'center',
78
+ marginRight: 12,
79
+ },
80
+ fallbackText: {
81
+ fontSize: 12,
82
+ fontWeight: '700',
83
+ },
84
+ });
40
85
  /**
41
86
  * Full-screen in-SDK login. Mirrors the Yaver mobile app login UX: native
42
87
  * Apple Sign-In on iOS, in-app browser OAuth for Google/GitHub/GitLab/
@@ -120,7 +165,10 @@ const YaverLoginScreen = ({ onLoggedIn, onCancel, }) => {
120
165
  pressed && styles.buttonPressed,
121
166
  busyProvider === id && { opacity: 0.6 },
122
167
  ]} onPress={onPress} disabled={busyProvider !== null}>
123
- {busyProvider === id ? (<react_native_1.ActivityIndicator color="#e0e0e0"/>) : (<react_native_1.Text style={styles.buttonText}>{label}</react_native_1.Text>)}
168
+ {busyProvider === id ? (<react_native_1.ActivityIndicator color="#e0e0e0"/>) : (<react_native_1.View style={styles.buttonContent}>
169
+ <ProviderLogo provider={id}/>
170
+ <react_native_1.Text style={[styles.buttonText, styles.buttonTextWithIcon]}>{label}</react_native_1.Text>
171
+ </react_native_1.View>)}
124
172
  </react_native_1.Pressable>);
125
173
  return (<react_native_1.SafeAreaView style={styles.safeArea}>
126
174
  <react_native_1.KeyboardAvoidingView style={{ flex: 1 }} behavior={react_native_1.Platform.OS === 'ios' ? 'padding' : undefined}>
@@ -211,6 +259,14 @@ const styles = react_native_1.StyleSheet.create({
211
259
  },
212
260
  buttonPressed: { opacity: 0.7 },
213
261
  buttonText: { color: '#e0e0e0', fontSize: 15, fontWeight: '600' },
262
+ buttonContent: {
263
+ flexDirection: 'row',
264
+ alignItems: 'center',
265
+ justifyContent: 'center',
266
+ },
267
+ buttonTextWithIcon: {
268
+ // No extra spacing — ProviderLogo provides its own marginRight.
269
+ },
214
270
  divider: {
215
271
  flexDirection: 'row',
216
272
  alignItems: 'center',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yaver-feedback-react-native",
3
- "version": "0.7.10",
3
+ "version": "0.7.11",
4
4
  "description": "Visual feedback SDK for Yaver — bug reports, screen recording, voice annotations, and local-first developer workflows",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -23,6 +23,88 @@ import {
23
23
  type OAuthProvider,
24
24
  } from './auth';
25
25
 
26
+ // ── ProviderLogo ─────────────────────────────────────────────────────
27
+ //
28
+ // Mirrors the Yaver mobile app's login screen — Apple, Google, GitHub,
29
+ // GitLab, Microsoft each get their brand mark next to the label.
30
+ // Mobile uses `Ionicons` from `@expo/vector-icons`. We soft-require
31
+ // the same package so apps that have it (every Expo app does) get
32
+ // real logos automatically; bare-RN apps without the package fall
33
+ // back to a single-letter monogram in a tinted circle.
34
+ //
35
+ // Each entry holds: Ionicons name, fallback letter, brand colour,
36
+ // optional Apple-on-light invert (Apple's wordmark needs the
37
+ // alternate "logo-apple-appstore" / dark variant on dark backgrounds).
38
+ type ProviderTheme = {
39
+ ion: string;
40
+ letter: string;
41
+ fg: string;
42
+ bg: string;
43
+ };
44
+
45
+ const PROVIDER_THEME: Record<OAuthProvider | 'apple', ProviderTheme> = {
46
+ apple: { ion: 'logo-apple', letter: '', fg: '#FFFFFF', bg: 'transparent' },
47
+ google: { ion: 'logo-google', letter: 'G', fg: '#EA4335', bg: 'transparent' },
48
+ github: { ion: 'logo-github', letter: 'G', fg: '#FFFFFF', bg: 'transparent' },
49
+ gitlab: { ion: 'logo-gitlab', letter: 'G', fg: '#FC6D26', bg: 'transparent' },
50
+ microsoft: { ion: 'logo-microsoft', letter: 'M', fg: '#00A4EF', bg: 'transparent' },
51
+ };
52
+
53
+ const ProviderLogo: React.FC<{ provider: OAuthProvider | 'apple' }> = ({
54
+ provider,
55
+ }) => {
56
+ const theme = PROVIDER_THEME[provider] ?? PROVIDER_THEME.apple;
57
+ // Soft-require @expo/vector-icons so the SDK works in bare-RN apps
58
+ // that don't ship Expo. If present, render the brand glyph; if
59
+ // not, render a coloured monogram fallback.
60
+ let Ionicons: React.ComponentType<{
61
+ name: string;
62
+ size?: number;
63
+ color?: string;
64
+ style?: object;
65
+ }> | null = null;
66
+ try {
67
+ const mod = require('@expo/vector-icons');
68
+ Ionicons = mod?.Ionicons ?? null;
69
+ } catch {
70
+ // package not installed — use letter fallback
71
+ }
72
+ if (Ionicons) {
73
+ return (
74
+ <Ionicons
75
+ name={theme.ion}
76
+ size={18}
77
+ color={theme.fg}
78
+ style={iconStyles.icon}
79
+ />
80
+ );
81
+ }
82
+ if (!theme.letter) {
83
+ return null;
84
+ }
85
+ return (
86
+ <View style={[iconStyles.fallback, { backgroundColor: theme.fg + '22' }]}>
87
+ <Text style={[iconStyles.fallbackText, { color: theme.fg }]}>{theme.letter}</Text>
88
+ </View>
89
+ );
90
+ };
91
+
92
+ const iconStyles = StyleSheet.create({
93
+ icon: { marginRight: 12 },
94
+ fallback: {
95
+ width: 22,
96
+ height: 22,
97
+ borderRadius: 11,
98
+ alignItems: 'center',
99
+ justifyContent: 'center',
100
+ marginRight: 12,
101
+ },
102
+ fallbackText: {
103
+ fontSize: 12,
104
+ fontWeight: '700',
105
+ },
106
+ });
107
+
26
108
  export interface YaverLoginScreenProps {
27
109
  /** Invoked once a session token is issued and the user is loaded. */
28
110
  onLoggedIn: (token: string) => void;
@@ -125,7 +207,10 @@ export const YaverLoginScreen: React.FC<YaverLoginScreenProps> = ({
125
207
  {busyProvider === id ? (
126
208
  <ActivityIndicator color="#e0e0e0" />
127
209
  ) : (
128
- <Text style={styles.buttonText}>{label}</Text>
210
+ <View style={styles.buttonContent}>
211
+ <ProviderLogo provider={id} />
212
+ <Text style={[styles.buttonText, styles.buttonTextWithIcon]}>{label}</Text>
213
+ </View>
129
214
  )}
130
215
  </Pressable>
131
216
  );
@@ -295,6 +380,14 @@ const styles = StyleSheet.create({
295
380
  },
296
381
  buttonPressed: { opacity: 0.7 },
297
382
  buttonText: { color: '#e0e0e0', fontSize: 15, fontWeight: '600' },
383
+ buttonContent: {
384
+ flexDirection: 'row',
385
+ alignItems: 'center',
386
+ justifyContent: 'center',
387
+ },
388
+ buttonTextWithIcon: {
389
+ // No extra spacing — ProviderLogo provides its own marginRight.
390
+ },
298
391
  divider: {
299
392
  flexDirection: 'row',
300
393
  alignItems: 'center',