@oxyhq/services 6.9.44 → 6.9.45

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 (160) hide show
  1. package/lib/commonjs/ui/components/OxyPayButton.js +4 -2
  2. package/lib/commonjs/ui/components/OxyPayButton.js.map +1 -1
  3. package/lib/commonjs/ui/components/OxySignInButton.js +83 -82
  4. package/lib/commonjs/ui/components/OxySignInButton.js.map +1 -1
  5. package/lib/commonjs/ui/components/SettingRow.js +11 -5
  6. package/lib/commonjs/ui/components/SettingRow.js.map +1 -1
  7. package/lib/commonjs/ui/components/fileManagement/FileDetailsModal.js +76 -121
  8. package/lib/commonjs/ui/components/fileManagement/FileDetailsModal.js.map +1 -1
  9. package/lib/commonjs/ui/components/fileManagement/UploadPreview.js +32 -18
  10. package/lib/commonjs/ui/components/fileManagement/UploadPreview.js.map +1 -1
  11. package/lib/commonjs/ui/components/icon/OxyIcon.js +5 -4
  12. package/lib/commonjs/ui/components/icon/OxyIcon.js.map +1 -1
  13. package/lib/commonjs/ui/components/internal/GroupedPillButtons.js +11 -9
  14. package/lib/commonjs/ui/components/internal/GroupedPillButtons.js.map +1 -1
  15. package/lib/commonjs/ui/components/internal/PinInput.js +3 -2
  16. package/lib/commonjs/ui/components/internal/PinInput.js.map +1 -1
  17. package/lib/commonjs/ui/components/modals/DeleteAccountModal.js +83 -219
  18. package/lib/commonjs/ui/components/modals/DeleteAccountModal.js.map +1 -1
  19. package/lib/commonjs/ui/constants/theme.js +2 -2
  20. package/lib/commonjs/ui/constants/theme.js.map +1 -1
  21. package/lib/commonjs/ui/screens/AccountCenterScreen.js +12 -10
  22. package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
  23. package/lib/commonjs/ui/screens/AccountOverviewScreen.js +70 -79
  24. package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +1 -1
  25. package/lib/commonjs/ui/screens/AccountSettingsScreen.js +22 -10
  26. package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
  27. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +141 -81
  28. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +1 -1
  29. package/lib/commonjs/ui/screens/AccountVerificationScreen.js +21 -9
  30. package/lib/commonjs/ui/screens/AccountVerificationScreen.js.map +1 -1
  31. package/lib/commonjs/ui/screens/FileManagementScreen.js +83 -50
  32. package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
  33. package/lib/commonjs/ui/screens/HistoryViewScreen.js +80 -101
  34. package/lib/commonjs/ui/screens/HistoryViewScreen.js.map +1 -1
  35. package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js +66 -93
  36. package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
  37. package/lib/commonjs/ui/screens/SessionManagementScreen.js +101 -66
  38. package/lib/commonjs/ui/screens/SessionManagementScreen.js.map +1 -1
  39. package/lib/commonjs/ui/utils/fileManagement.js +0 -21
  40. package/lib/commonjs/ui/utils/fileManagement.js.map +1 -1
  41. package/lib/module/ui/components/OxyPayButton.js +4 -2
  42. package/lib/module/ui/components/OxyPayButton.js.map +1 -1
  43. package/lib/module/ui/components/OxySignInButton.js +84 -83
  44. package/lib/module/ui/components/OxySignInButton.js.map +1 -1
  45. package/lib/module/ui/components/SettingRow.js +11 -5
  46. package/lib/module/ui/components/SettingRow.js.map +1 -1
  47. package/lib/module/ui/components/fileManagement/FileDetailsModal.js +76 -122
  48. package/lib/module/ui/components/fileManagement/FileDetailsModal.js.map +1 -1
  49. package/lib/module/ui/components/fileManagement/UploadPreview.js +32 -19
  50. package/lib/module/ui/components/fileManagement/UploadPreview.js.map +1 -1
  51. package/lib/module/ui/components/icon/OxyIcon.js +5 -4
  52. package/lib/module/ui/components/icon/OxyIcon.js.map +1 -1
  53. package/lib/module/ui/components/internal/GroupedPillButtons.js +11 -9
  54. package/lib/module/ui/components/internal/GroupedPillButtons.js.map +1 -1
  55. package/lib/module/ui/components/internal/PinInput.js +3 -2
  56. package/lib/module/ui/components/internal/PinInput.js.map +1 -1
  57. package/lib/module/ui/components/modals/DeleteAccountModal.js +83 -220
  58. package/lib/module/ui/components/modals/DeleteAccountModal.js.map +1 -1
  59. package/lib/module/ui/constants/theme.js +2 -2
  60. package/lib/module/ui/constants/theme.js.map +1 -1
  61. package/lib/module/ui/screens/AccountCenterScreen.js +11 -10
  62. package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
  63. package/lib/module/ui/screens/AccountOverviewScreen.js +71 -80
  64. package/lib/module/ui/screens/AccountOverviewScreen.js.map +1 -1
  65. package/lib/module/ui/screens/AccountSettingsScreen.js +22 -10
  66. package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
  67. package/lib/module/ui/screens/AccountSwitcherScreen.js +140 -81
  68. package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
  69. package/lib/module/ui/screens/AccountVerificationScreen.js +22 -10
  70. package/lib/module/ui/screens/AccountVerificationScreen.js.map +1 -1
  71. package/lib/module/ui/screens/FileManagementScreen.js +85 -52
  72. package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
  73. package/lib/module/ui/screens/HistoryViewScreen.js +80 -101
  74. package/lib/module/ui/screens/HistoryViewScreen.js.map +1 -1
  75. package/lib/module/ui/screens/PremiumSubscriptionScreen.js +66 -94
  76. package/lib/module/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
  77. package/lib/module/ui/screens/SessionManagementScreen.js +101 -67
  78. package/lib/module/ui/screens/SessionManagementScreen.js.map +1 -1
  79. package/lib/module/ui/utils/fileManagement.js +0 -20
  80. package/lib/module/ui/utils/fileManagement.js.map +1 -1
  81. package/lib/typescript/commonjs/ui/components/OxyPayButton.d.ts.map +1 -1
  82. package/lib/typescript/commonjs/ui/components/OxySignInButton.d.ts +0 -1
  83. package/lib/typescript/commonjs/ui/components/OxySignInButton.d.ts.map +1 -1
  84. package/lib/typescript/commonjs/ui/components/SettingRow.d.ts +2 -2
  85. package/lib/typescript/commonjs/ui/components/SettingRow.d.ts.map +1 -1
  86. package/lib/typescript/commonjs/ui/components/fileManagement/FileDetailsModal.d.ts +3 -4
  87. package/lib/typescript/commonjs/ui/components/fileManagement/FileDetailsModal.d.ts.map +1 -1
  88. package/lib/typescript/commonjs/ui/components/fileManagement/UploadPreview.d.ts +2 -3
  89. package/lib/typescript/commonjs/ui/components/fileManagement/UploadPreview.d.ts.map +1 -1
  90. package/lib/typescript/commonjs/ui/components/icon/OxyIcon.d.ts.map +1 -1
  91. package/lib/typescript/commonjs/ui/components/internal/GroupedPillButtons.d.ts.map +1 -1
  92. package/lib/typescript/commonjs/ui/components/internal/PinInput.d.ts.map +1 -1
  93. package/lib/typescript/commonjs/ui/components/modals/DeleteAccountModal.d.ts +2 -2
  94. package/lib/typescript/commonjs/ui/components/modals/DeleteAccountModal.d.ts.map +1 -1
  95. package/lib/typescript/commonjs/ui/screens/AccountCenterScreen.d.ts.map +1 -1
  96. package/lib/typescript/commonjs/ui/screens/AccountOverviewScreen.d.ts.map +1 -1
  97. package/lib/typescript/commonjs/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
  98. package/lib/typescript/commonjs/ui/screens/AccountSwitcherScreen.d.ts.map +1 -1
  99. package/lib/typescript/commonjs/ui/screens/AccountVerificationScreen.d.ts.map +1 -1
  100. package/lib/typescript/commonjs/ui/screens/FileManagementScreen.d.ts.map +1 -1
  101. package/lib/typescript/commonjs/ui/screens/HistoryViewScreen.d.ts.map +1 -1
  102. package/lib/typescript/commonjs/ui/screens/PremiumSubscriptionScreen.d.ts.map +1 -1
  103. package/lib/typescript/commonjs/ui/screens/SessionManagementScreen.d.ts.map +1 -1
  104. package/lib/typescript/commonjs/ui/utils/fileManagement.d.ts +0 -4
  105. package/lib/typescript/commonjs/ui/utils/fileManagement.d.ts.map +1 -1
  106. package/lib/typescript/module/ui/components/OxyPayButton.d.ts.map +1 -1
  107. package/lib/typescript/module/ui/components/OxySignInButton.d.ts +0 -1
  108. package/lib/typescript/module/ui/components/OxySignInButton.d.ts.map +1 -1
  109. package/lib/typescript/module/ui/components/SettingRow.d.ts +2 -2
  110. package/lib/typescript/module/ui/components/SettingRow.d.ts.map +1 -1
  111. package/lib/typescript/module/ui/components/fileManagement/FileDetailsModal.d.ts +3 -4
  112. package/lib/typescript/module/ui/components/fileManagement/FileDetailsModal.d.ts.map +1 -1
  113. package/lib/typescript/module/ui/components/fileManagement/UploadPreview.d.ts +2 -3
  114. package/lib/typescript/module/ui/components/fileManagement/UploadPreview.d.ts.map +1 -1
  115. package/lib/typescript/module/ui/components/icon/OxyIcon.d.ts.map +1 -1
  116. package/lib/typescript/module/ui/components/internal/GroupedPillButtons.d.ts.map +1 -1
  117. package/lib/typescript/module/ui/components/internal/PinInput.d.ts.map +1 -1
  118. package/lib/typescript/module/ui/components/modals/DeleteAccountModal.d.ts +2 -2
  119. package/lib/typescript/module/ui/components/modals/DeleteAccountModal.d.ts.map +1 -1
  120. package/lib/typescript/module/ui/screens/AccountCenterScreen.d.ts.map +1 -1
  121. package/lib/typescript/module/ui/screens/AccountOverviewScreen.d.ts.map +1 -1
  122. package/lib/typescript/module/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
  123. package/lib/typescript/module/ui/screens/AccountSwitcherScreen.d.ts.map +1 -1
  124. package/lib/typescript/module/ui/screens/AccountVerificationScreen.d.ts.map +1 -1
  125. package/lib/typescript/module/ui/screens/FileManagementScreen.d.ts.map +1 -1
  126. package/lib/typescript/module/ui/screens/HistoryViewScreen.d.ts.map +1 -1
  127. package/lib/typescript/module/ui/screens/PremiumSubscriptionScreen.d.ts.map +1 -1
  128. package/lib/typescript/module/ui/screens/SessionManagementScreen.d.ts.map +1 -1
  129. package/lib/typescript/module/ui/utils/fileManagement.d.ts +0 -4
  130. package/lib/typescript/module/ui/utils/fileManagement.d.ts.map +1 -1
  131. package/package.json +2 -2
  132. package/src/ui/components/OxyPayButton.tsx +5 -3
  133. package/src/ui/components/OxySignInButton.tsx +82 -81
  134. package/src/ui/components/SettingRow.tsx +14 -7
  135. package/src/ui/components/fileManagement/FileDetailsModal.tsx +69 -99
  136. package/src/ui/components/fileManagement/UploadPreview.tsx +58 -46
  137. package/src/ui/components/icon/OxyIcon.tsx +5 -4
  138. package/src/ui/components/internal/GroupedPillButtons.tsx +15 -12
  139. package/src/ui/components/internal/PinInput.tsx +4 -3
  140. package/src/ui/components/modals/DeleteAccountModal.tsx +79 -221
  141. package/src/ui/constants/theme.ts +2 -2
  142. package/src/ui/screens/AccountCenterScreen.tsx +34 -136
  143. package/src/ui/screens/AccountOverviewScreen.tsx +63 -98
  144. package/src/ui/screens/AccountSettingsScreen.tsx +21 -7
  145. package/src/ui/screens/AccountSwitcherScreen.tsx +135 -87
  146. package/src/ui/screens/AccountVerificationScreen.tsx +24 -16
  147. package/src/ui/screens/FileManagementScreen.tsx +62 -54
  148. package/src/ui/screens/HistoryViewScreen.tsx +57 -204
  149. package/src/ui/screens/PremiumSubscriptionScreen.tsx +73 -93
  150. package/src/ui/screens/SessionManagementScreen.tsx +101 -73
  151. package/src/ui/utils/fileManagement.ts +0 -30
  152. package/lib/commonjs/ui/utils/confirmAction.js +0 -28
  153. package/lib/commonjs/ui/utils/confirmAction.js.map +0 -1
  154. package/lib/module/ui/utils/confirmAction.js +0 -25
  155. package/lib/module/ui/utils/confirmAction.js.map +0 -1
  156. package/lib/typescript/commonjs/ui/utils/confirmAction.d.ts +0 -7
  157. package/lib/typescript/commonjs/ui/utils/confirmAction.d.ts.map +0 -1
  158. package/lib/typescript/module/ui/utils/confirmAction.d.ts +0 -7
  159. package/lib/typescript/module/ui/utils/confirmAction.d.ts.map +0 -1
  160. package/src/ui/utils/confirmAction.ts +0 -23
@@ -3,7 +3,6 @@
3
3
  import React, { useState, useCallback } from 'react';
4
4
  import { View, StyleSheet, ScrollView } from 'react-native';
5
5
  import { toast } from '../../lib/sonner';
6
- import { confirmAction } from "../utils/confirmAction.js";
7
6
  import { Header, Section, GroupedSection, LoadingState, EmptyState } from "../components/index.js";
8
7
  import { useI18n } from "../hooks/useI18n.js";
9
8
  import { useTheme } from '@oxyhq/bloom/theme';
@@ -11,13 +10,14 @@ import { useColorScheme } from "../hooks/useColorScheme.js";
11
10
  import { Colors } from "../constants/theme.js";
12
11
  import { normalizeColorScheme } from "../utils/themeUtils.js";
13
12
  import { useOxy } from "../context/OxyContext.js";
13
+ import * as Prompt from '@oxyhq/bloom/prompt';
14
+ import { usePromptControl } from '@oxyhq/bloom/prompt';
14
15
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
16
  const HistoryViewScreen = ({
16
17
  onClose,
17
18
  theme,
18
19
  goBack
19
20
  }) => {
20
- // Use useOxy() hook for OxyContext values
21
21
  const {
22
22
  user
23
23
  } = useOxy();
@@ -31,128 +31,93 @@ const HistoryViewScreen = ({
31
31
  const [history, setHistory] = useState([]);
32
32
  const [isLoading, setIsLoading] = useState(true);
33
33
  const [isDeleting, setIsDeleting] = useState(false);
34
-
35
- // Helper to get storage
34
+ const deleteLast15Prompt = usePromptControl();
35
+ const clearAllPrompt = usePromptControl();
36
36
  const getStorage = async () => {
37
- const isReactNative = typeof navigator !== 'undefined' && navigator.product === 'ReactNative';
38
- if (isReactNative) {
37
+ const isRN = typeof navigator !== 'undefined' && navigator.product === 'ReactNative';
38
+ if (isRN) {
39
39
  try {
40
- const asyncStorageModule = await import('@react-native-async-storage/async-storage');
41
- const storage = asyncStorageModule.default;
40
+ const mod = await import('@react-native-async-storage/async-storage');
41
+ const s = mod.default;
42
42
  return {
43
- getItem: storage.getItem.bind(storage),
44
- setItem: storage.setItem.bind(storage),
45
- removeItem: storage.removeItem.bind(storage)
43
+ getItem: s.getItem.bind(s),
44
+ setItem: s.setItem.bind(s),
45
+ removeItem: s.removeItem.bind(s)
46
46
  };
47
- } catch (error) {
48
- if (__DEV__) {
49
- console.error('AsyncStorage not available:', error);
50
- }
51
- throw new Error('AsyncStorage is required in React Native environment');
47
+ } catch (e) {
48
+ if (__DEV__) console.error('AsyncStorage not available:', e);
49
+ throw new Error('AsyncStorage required');
52
50
  }
53
- } else {
54
- // Use localStorage for web
55
- return {
56
- getItem: async key => {
57
- if (typeof window !== 'undefined' && window.localStorage) {
58
- return window.localStorage.getItem(key);
59
- }
60
- return null;
61
- },
62
- setItem: async (key, value) => {
63
- if (typeof window !== 'undefined' && window.localStorage) {
64
- window.localStorage.setItem(key, value);
65
- }
66
- },
67
- removeItem: async key => {
68
- if (typeof window !== 'undefined' && window.localStorage) {
69
- window.localStorage.removeItem(key);
70
- }
71
- }
72
- };
73
51
  }
52
+ return {
53
+ getItem: async k => typeof window !== 'undefined' && window.localStorage ? window.localStorage.getItem(k) : null,
54
+ setItem: async (k, v) => {
55
+ if (typeof window !== 'undefined' && window.localStorage) window.localStorage.setItem(k, v);
56
+ },
57
+ removeItem: async k => {
58
+ if (typeof window !== 'undefined' && window.localStorage) window.localStorage.removeItem(k);
59
+ }
60
+ };
74
61
  };
75
-
76
- // TODO: Integrate with backend API for history storage
77
- // Currently uses local storage only. Should fetch from backend API and sync across devices.
78
- // Load history from storage
79
62
  React.useEffect(() => {
80
- const loadHistory = async () => {
63
+ const load = async () => {
81
64
  try {
82
65
  setIsLoading(true);
83
66
  const storage = await getStorage();
84
- const historyKey = `history_${user?.id || 'guest'}`;
85
- const stored = await storage.getItem(historyKey);
67
+ const stored = await storage.getItem(`history_${user?.id || 'guest'}`);
86
68
  if (stored) {
87
69
  const parsed = JSON.parse(stored);
88
- setHistory(parsed.map(item => ({
89
- ...item,
90
- timestamp: new Date(item.timestamp)
70
+ setHistory(parsed.map(i => ({
71
+ ...i,
72
+ timestamp: new Date(i.timestamp)
91
73
  })));
92
- } else {
93
- setHistory([]);
94
- }
95
- } catch (error) {
74
+ } else setHistory([]);
75
+ } catch {
96
76
  setHistory([]);
97
77
  } finally {
98
78
  setIsLoading(false);
99
79
  }
100
80
  };
101
- loadHistory();
81
+ load();
102
82
  }, [user?.id]);
103
83
  const handleDeleteLast15Minutes = useCallback(async () => {
104
- confirmAction(t('history.deleteLast15Minutes.confirm') || 'Delete last 15 minutes of history?', async () => {
105
- try {
106
- setIsDeleting(true);
107
- const fifteenMinutesAgo = new Date(Date.now() - 15 * 60 * 1000);
108
- const filtered = history.filter(item => item.timestamp < fifteenMinutesAgo);
109
- setHistory(filtered);
110
-
111
- // Save to storage
112
- const storage = await getStorage();
113
- const historyKey = `history_${user?.id || 'guest'}`;
114
- await storage.setItem(historyKey, JSON.stringify(filtered));
115
- toast.success(t('history.deleteLast15Minutes.success') || 'Last 15 minutes deleted');
116
- } catch (error) {
117
- if (__DEV__) {
118
- console.error('Failed to delete history:', error);
119
- }
120
- toast.error(t('history.deleteLast15Minutes.error') || 'Failed to delete history');
121
- } finally {
122
- setIsDeleting(false);
123
- }
124
- });
84
+ try {
85
+ setIsDeleting(true);
86
+ const cutoff = new Date(Date.now() - 15 * 60 * 1000);
87
+ const filtered = history.filter(item => item.timestamp < cutoff);
88
+ setHistory(filtered);
89
+ const storage = await getStorage();
90
+ await storage.setItem(`history_${user?.id || 'guest'}`, JSON.stringify(filtered));
91
+ toast.success(t('history.deleteLast15Minutes.success') || 'Last 15 minutes deleted');
92
+ } catch (e) {
93
+ if (__DEV__) console.error('Failed to delete history:', e);
94
+ toast.error(t('history.deleteLast15Minutes.error') || 'Failed to delete history');
95
+ } finally {
96
+ setIsDeleting(false);
97
+ }
125
98
  }, [history, user?.id, t]);
126
99
  const handleClearAll = useCallback(async () => {
127
- confirmAction(t('history.clearAll.confirm') || 'Clear all history? This cannot be undone.', async () => {
128
- try {
129
- setIsDeleting(true);
130
- setHistory([]);
131
-
132
- // Clear from storage
133
- const storage = await getStorage();
134
- const historyKey = `history_${user?.id || 'guest'}`;
135
- await storage.removeItem(historyKey);
136
- toast.success(t('history.clearAll.success') || 'History cleared');
137
- } catch (error) {
138
- if (__DEV__) {
139
- console.error('Failed to clear history:', error);
140
- }
141
- toast.error(t('history.clearAll.error') || 'Failed to clear history');
142
- } finally {
143
- setIsDeleting(false);
144
- }
145
- });
100
+ try {
101
+ setIsDeleting(true);
102
+ setHistory([]);
103
+ const storage = await getStorage();
104
+ await storage.removeItem(`history_${user?.id || 'guest'}`);
105
+ toast.success(t('history.clearAll.success') || 'History cleared');
106
+ } catch (e) {
107
+ if (__DEV__) console.error('Failed to clear history:', e);
108
+ toast.error(t('history.clearAll.error') || 'Failed to clear history');
109
+ } finally {
110
+ setIsDeleting(false);
111
+ }
146
112
  }, [user?.id, t]);
147
113
  const formatTime = date => {
148
- const now = new Date();
149
- const diff = now.getTime() - date.getTime();
150
- const minutes = Math.floor(diff / 60000);
151
- const hours = Math.floor(minutes / 60);
152
- const days = Math.floor(hours / 24);
153
- if (minutes < 1) return t('history.justNow') || 'Just now';
154
- if (minutes < 60) return `${minutes} ${t('history.minutesAgo') || 'minutes ago'}`;
155
- if (hours < 24) return `${hours} ${t('history.hoursAgo') || 'hours ago'}`;
114
+ const diff = new Date().getTime() - date.getTime();
115
+ const min = Math.floor(diff / 60000);
116
+ const hrs = Math.floor(min / 60);
117
+ const days = Math.floor(hrs / 24);
118
+ if (min < 1) return t('history.justNow') || 'Just now';
119
+ if (min < 60) return `${min} ${t('history.minutesAgo') || 'minutes ago'}`;
120
+ if (hrs < 24) return `${hrs} ${t('history.hoursAgo') || 'hours ago'}`;
156
121
  if (days < 7) return `${days} ${t('history.daysAgo') || 'days ago'}`;
157
122
  return date.toLocaleDateString();
158
123
  };
@@ -177,7 +142,7 @@ const HistoryViewScreen = ({
177
142
  iconColor: themeColors.iconStorage,
178
143
  title: t('history.deleteLast15Minutes.title') || 'Delete Last 15 Minutes',
179
144
  subtitle: t('history.deleteLast15Minutes.subtitle') || 'Remove recent history entries',
180
- onPress: handleDeleteLast15Minutes,
145
+ onPress: () => deleteLast15Prompt.open(),
181
146
  disabled: isDeleting || history.length === 0
182
147
  }, {
183
148
  id: 'clear-all',
@@ -185,7 +150,7 @@ const HistoryViewScreen = ({
185
150
  iconColor: themeColors.iconSharing,
186
151
  title: t('history.clearAll.title') || 'Clear All History',
187
152
  subtitle: t('history.clearAll.subtitle') || 'Remove all history entries',
188
- onPress: handleClearAll,
153
+ onPress: () => clearAllPrompt.open(),
189
154
  disabled: isDeleting || history.length === 0
190
155
  }]
191
156
  })
@@ -207,6 +172,20 @@ const HistoryViewScreen = ({
207
172
  }))
208
173
  })
209
174
  })]
175
+ }), /*#__PURE__*/_jsx(Prompt.Basic, {
176
+ control: deleteLast15Prompt,
177
+ title: t('history.deleteLast15Minutes.title') || 'Delete Last 15 Minutes',
178
+ description: t('history.deleteLast15Minutes.confirm') || 'Delete last 15 minutes of history?',
179
+ onConfirm: handleDeleteLast15Minutes,
180
+ confirmButtonCta: t('common.actions.delete') || 'Delete',
181
+ confirmButtonColor: "negative"
182
+ }), /*#__PURE__*/_jsx(Prompt.Basic, {
183
+ control: clearAllPrompt,
184
+ title: t('history.clearAll.title') || 'Clear All History',
185
+ description: t('history.clearAll.confirm') || 'Clear all history? This cannot be undone.',
186
+ onConfirm: handleClearAll,
187
+ confirmButtonCta: t('history.clearAll.title') || 'Clear All',
188
+ confirmButtonColor: "negative"
210
189
  })]
211
190
  });
212
191
  };
@@ -1 +1 @@
1
- {"version":3,"names":["React","useState","useCallback","View","StyleSheet","ScrollView","toast","confirmAction","Header","Section","GroupedSection","LoadingState","EmptyState","useI18n","useTheme","useColorScheme","Colors","normalizeColorScheme","useOxy","jsx","_jsx","jsxs","_jsxs","HistoryViewScreen","onClose","theme","goBack","user","t","bloomTheme","colorScheme","normalizedColorScheme","themeColors","history","setHistory","isLoading","setIsLoading","isDeleting","setIsDeleting","getStorage","isReactNative","navigator","product","asyncStorageModule","storage","default","getItem","bind","setItem","removeItem","error","__DEV__","console","Error","key","window","localStorage","value","useEffect","loadHistory","historyKey","id","stored","parsed","JSON","parse","map","item","timestamp","Date","handleDeleteLast15Minutes","fifteenMinutesAgo","now","filtered","filter","stringify","success","handleClearAll","formatTime","date","diff","getTime","minutes","Math","floor","hours","days","toLocaleDateString","style","styles","container","backgroundColor","colors","background","children","title","onBack","variant","elevation","content","isFirst","items","icon","iconColor","iconStorage","subtitle","onPress","disabled","length","iconSharing","message","color","text","textColor","type","iconSecurity","iconPersonalInfo","query","create","flex","padding","memo"],"sourceRoot":"../../../../src","sources":["ui/screens/HistoryViewScreen.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,WAAW,QAAQ,OAAO;AACpD,SACIC,IAAI,EACJC,UAAU,EACVC,UAAU,QACP,cAAc;AAErB,SAASC,KAAK,QAAQ,kBAAkB;AACxC,SAASC,aAAa,QAAQ,2BAAwB;AACtD,SAASC,MAAM,EAAEC,OAAO,EAAEC,cAAc,EAAEC,YAAY,EAAEC,UAAU,QAAQ,wBAAe;AACzF,SAASC,OAAO,QAAQ,qBAAkB;AAC1C,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,cAAc,QAAQ,4BAAyB;AACxD,SAASC,MAAM,QAAQ,uBAAoB;AAC3C,SAASC,oBAAoB,QAAQ,wBAAqB;AAC1D,SAASC,MAAM,QAAQ,0BAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAS/C,MAAMC,iBAA4C,GAAGA,CAAC;EAClDC,OAAO;EACPC,KAAK;EACLC;AACJ,CAAC,KAAK;EACF;EACA,MAAM;IAAEC;EAAK,CAAC,GAAGT,MAAM,CAAC,CAAC;EACzB,MAAM;IAAEU;EAAE,CAAC,GAAGf,OAAO,CAAC,CAAC;EACvB,MAAMgB,UAAU,GAAGf,QAAQ,CAAC,CAAC;EAC7B,MAAMgB,WAAW,GAAGf,cAAc,CAAC,CAAC;EACpC,MAAMgB,qBAAqB,GAAGd,oBAAoB,CAACa,WAAW,CAAC;EAC/D,MAAME,WAAW,GAAGhB,MAAM,CAACe,qBAAqB,CAAC;EACjD,MAAM,CAACE,OAAO,EAAEC,UAAU,CAAC,GAAGjC,QAAQ,CAAgB,EAAE,CAAC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ACP;MACJ,CACI,CAAC;IAAA,CACF,CAAC;EAAA,CACX,CAAC;AAEf,CAAC;AAED,MAAMqB,MAAM,GAAGrF,UAAU,CAACkH,MAAM,CAAC;EAC7B5B,SAAS,EAAE;IACP6B,IAAI,EAAE;EACV,CAAC;EACDpB,OAAO,EAAE;IACLoB,IAAI,EAAE,CAAC;IACPC,OAAO,EAAE;EACb;AACJ,CAAC,CAAC;AAEF,4BAAexH,KAAK,CAACyH,IAAI,CAAClG,iBAAiB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","useState","useCallback","View","StyleSheet","ScrollView","toast","Header","Section","GroupedSection","LoadingState","EmptyState","useI18n","useTheme","useColorScheme","Colors","normalizeColorScheme","useOxy","Prompt","usePromptControl","jsx","_jsx","jsxs","_jsxs","HistoryViewScreen","onClose","theme","goBack","user","t","bloomTheme","colorScheme","normalizedColorScheme","themeColors","history","setHistory","isLoading","setIsLoading","isDeleting","setIsDeleting","deleteLast15Prompt","clearAllPrompt","getStorage","isRN","navigator","product","mod","s","default","getItem","bind","setItem","removeItem","e","__DEV__","console","error","Error","k","window","localStorage","v","useEffect","load","storage","stored","id","parsed","JSON","parse","map","i","timestamp","Date","handleDeleteLast15Minutes","cutoff","now","filtered","filter","item","stringify","success","handleClearAll","formatTime","date","diff","getTime","min","Math","floor","hrs","days","toLocaleDateString","style","styles","container","backgroundColor","colors","background","children","title","onBack","variant","elevation","content","isFirst","items","icon","iconColor","iconStorage","subtitle","onPress","open","disabled","length","iconSharing","message","color","text","textColor","type","iconSecurity","iconPersonalInfo","query","Basic","control","description","onConfirm","confirmButtonCta","confirmButtonColor","create","flex","padding","memo"],"sourceRoot":"../../../../src","sources":["ui/screens/HistoryViewScreen.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,WAAW,QAAQ,OAAO;AACpD,SAASC,IAAI,EAAEC,UAAU,EAAEC,UAAU,QAAQ,cAAc;AAE3D,SAASC,KAAK,QAAQ,kBAAkB;AACx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CAAC,IAAI,WAAY;MAACoG,kBAAkB,EAAC;IAAU,CAAE,CAAC;EAAA,CACpT,CAAC;AAEf,CAAC;AAED,MAAMnC,MAAM,GAAG1F,UAAU,CAAC8H,MAAM,CAAC;EAAEnC,SAAS,EAAE;IAAEoC,IAAI,EAAE;EAAE,CAAC;EAAE3B,OAAO,EAAE;IAAE2B,IAAI,EAAE,CAAC;IAAEC,OAAO,EAAE;EAAG;AAAE,CAAC,CAAC;AAE/F,4BAAepI,KAAK,CAACqI,IAAI,CAAC7G,iBAAiB,CAAC","ignoreList":[]}
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
 
3
- import { useState, useEffect } from 'react';
3
+ import { useState, useEffect, useCallback, useMemo } from 'react';
4
4
  import { View, Text, TouchableOpacity, StyleSheet, ScrollView, ActivityIndicator } from 'react-native';
5
5
  import { fontFamilies } from "../styles/fonts.js";
6
6
  import { toast } from '../../lib/sonner';
7
- import { confirmAction } from "../utils/confirmAction.js";
7
+ import * as Prompt from '@oxyhq/bloom/prompt';
8
+ import { usePromptControl } from '@oxyhq/bloom/prompt';
8
9
  import { Ionicons } from '@expo/vector-icons';
9
10
  import { useI18n } from "../hooks/useI18n.js";
10
11
  import { useTheme } from '@oxyhq/bloom/theme';
@@ -30,11 +31,16 @@ const PremiumSubscriptionScreen = ({
30
31
  const [billingInterval, setBillingInterval] = useState('month');
31
32
  const [activeTab, setActiveTab] = useState('plans');
32
33
  const [currentAppPackage, setCurrentAppPackage] = useState('mention'); // Default to mention for demo
33
-
34
+ const [pendingUnsubscribeFeatureId, setPendingUnsubscribeFeatureId] = useState(null);
34
35
  const {
35
36
  t
36
37
  } = useI18n();
37
38
  const bloomTheme = useTheme();
39
+
40
+ // Prompt controls
41
+ const cancelSubscriptionPrompt = usePromptControl();
42
+ const unsubscribeFeaturePrompt = usePromptControl();
43
+
38
44
  // Extract commonly used colors for readability
39
45
  const textColor = bloomTheme.colors.text;
40
46
  const backgroundColor = bloomTheme.colors.background;
@@ -217,46 +223,14 @@ const PremiumSubscriptionScreen = ({
217
223
  }
218
224
  }, [currentAppPackage, user?.isPremium]);
219
225
  const detectCurrentApp = () => {
220
- // In a real implementation, this would detect the actual app package name
221
- // For now, we'll use a mock detection based on available methods
222
-
223
- // Real app detection methods you could use:
224
- // 1. Check bundle identifier in React Native:
225
- // import DeviceInfo from 'react-native-device-info';
226
- // const bundleId = DeviceInfo.getBundleId();
227
- // Example: com.oxy.mention -> 'mention'
228
-
229
- // 2. Environment variables or build configuration
230
- // const appPackage = __DEV__ ? process.env.APP_PACKAGE : 'mention';
231
-
232
- // 3. Check specific app capabilities or modules
233
- // if (typeof MentionModule !== 'undefined') return 'mention';
234
- // if (typeof OxyWorkspaceModule !== 'undefined') return 'oxy-workspace';
235
-
236
- // 4. Use build-time configuration with Metro or similar
237
- // const appPackage = require('../config/app.json').packageName;
238
-
239
- // For demo purposes, we'll simulate different apps
240
- // You would replace this with actual app detection logic
241
-
242
- // IMPORTANT: This ensures subscription restrictions work properly:
243
- // - Mention+ plan can only be subscribed to when app package == 'mention'
244
- // - Other app-specific plans follow the same pattern
245
- // - Ecosystem plans work across all apps
246
-
247
- const detectedApp = 'mention'; // This would be dynamic in real implementation
248
-
226
+ const detectedApp = 'mention';
249
227
  setCurrentAppPackage(detectedApp);
250
228
  };
251
229
  const loadSubscriptionData = async () => {
252
230
  try {
253
231
  setLoading(true);
254
-
255
- // Filter plans available for current app
256
232
  const availablePlans = mockPlans.filter(plan => plan.applicableApps.includes(currentAppPackage));
257
233
  setPlans(availablePlans);
258
-
259
- // Mock current subscription
260
234
  let currentSubscription = null;
261
235
  if (user?.isPremium) {
262
236
  currentSubscription = {
@@ -269,15 +243,13 @@ const PremiumSubscriptionScreen = ({
269
243
  };
270
244
  setSubscription(currentSubscription);
271
245
  }
272
-
273
- // Filter features available for current app and update based on current subscription
274
246
  const availableFeatures = mockIndividualFeatures.filter(feature => feature.applicableApps.includes(currentAppPackage));
275
247
  const updatedFeatures = availableFeatures.map(feature => {
276
248
  const isIncludedInCurrentPlan = !!(currentSubscription && feature.includedInPlans.includes(currentSubscription.planId));
277
249
  return {
278
250
  ...feature,
279
251
  isIncludedInCurrentPlan,
280
- isSubscribed: !!isIncludedInCurrentPlan // Mock some individual subscriptions
252
+ isSubscribed: !!isIncludedInCurrentPlan
281
253
  };
282
254
  });
283
255
  setIndividualFeatures(updatedFeatures);
@@ -295,7 +267,6 @@ const PremiumSubscriptionScreen = ({
295
267
  };
296
268
  const handleSubscribe = async planId => {
297
269
  try {
298
- // Check if plan is available for current app
299
270
  const selectedPlan = mockPlans.find(plan => plan.id === planId);
300
271
  if (!selectedPlan?.applicableApps.includes(currentAppPackage)) {
301
272
  toast.error(t('premium.toasts.planUnavailable', {
@@ -303,19 +274,13 @@ const PremiumSubscriptionScreen = ({
303
274
  }) || `This plan is not available for the current app (${currentAppPackage})`);
304
275
  return;
305
276
  }
306
-
307
- // Special restriction for Mention+ plan - only available in mention app
308
277
  if (planId === 'mention-plus' && currentAppPackage !== 'mention') {
309
278
  toast.error(t('premium.toasts.mentionOnly') || 'Mention+ is only available in the Mention app');
310
279
  return;
311
280
  }
312
281
  setProcessingPayment(true);
313
-
314
- // Mock payment processing
315
282
  await new Promise(resolve => setTimeout(resolve, 2000));
316
283
  toast.success(t('premium.toasts.activated') || 'Subscription activated successfully!');
317
-
318
- // Mock subscription update
319
284
  setSubscription({
320
285
  id: `sub_${Date.now()}`,
321
286
  planId,
@@ -324,8 +289,6 @@ const PremiumSubscriptionScreen = ({
324
289
  currentPeriodEnd: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000).toISOString(),
325
290
  cancelAtPeriodEnd: false
326
291
  });
327
-
328
- // Reload data to update feature states
329
292
  loadSubscriptionData();
330
293
  } catch (error) {
331
294
  if (__DEV__) {
@@ -336,20 +299,20 @@ const PremiumSubscriptionScreen = ({
336
299
  setProcessingPayment(false);
337
300
  }
338
301
  };
339
- const handleCancelSubscription = () => {
340
- confirmAction(t('premium.confirms.cancelSub') || 'Are you sure you want to cancel your subscription? You will lose access to premium features at the end of your current billing period.', async () => {
341
- try {
342
- // Mock cancellation
343
- setSubscription(prev => prev ? {
344
- ...prev,
345
- cancelAtPeriodEnd: true
346
- } : null);
347
- toast.success(t('premium.toasts.willCancel') || 'Subscription will be canceled at the end of the billing period');
348
- } catch (error) {
349
- toast.error(t('premium.toasts.cancelFailed') || 'Failed to cancel subscription');
350
- }
351
- });
352
- };
302
+ const confirmCancelSubscription = useCallback(() => {
303
+ cancelSubscriptionPrompt.open();
304
+ }, [cancelSubscriptionPrompt]);
305
+ const handleCancelSubscription = useCallback(async () => {
306
+ try {
307
+ setSubscription(prev => prev ? {
308
+ ...prev,
309
+ cancelAtPeriodEnd: true
310
+ } : null);
311
+ toast.success(t('premium.toasts.willCancel') || 'Subscription will be canceled at the end of the billing period');
312
+ } catch (error) {
313
+ toast.error(t('premium.toasts.cancelFailed') || 'Failed to cancel subscription');
314
+ }
315
+ }, [t]);
353
316
  const handleReactivateSubscription = async () => {
354
317
  try {
355
318
  setSubscription(prev => prev ? {
@@ -362,7 +325,7 @@ const PremiumSubscriptionScreen = ({
362
325
  }
363
326
  };
364
327
  const formatPrice = (price, currency, interval) => {
365
- const yearlyPrice = interval === 'year' ? price : price * 12 * 0.8; // 20% discount for yearly
328
+ const yearlyPrice = interval === 'year' ? price : price * 12 * 0.8;
366
329
  const displayPrice = billingInterval === 'year' ? yearlyPrice : price;
367
330
  return {
368
331
  price: displayPrice,
@@ -376,16 +339,12 @@ const PremiumSubscriptionScreen = ({
376
339
  };
377
340
  const handleFeatureSubscribe = async featureId => {
378
341
  try {
379
- // Check if feature is available for current app
380
342
  const selectedFeature = mockIndividualFeatures.find(feature => feature.id === featureId);
381
343
  if (!selectedFeature?.applicableApps.includes(currentAppPackage)) {
382
344
  toast.error(`This feature is not available for the current app (${currentAppPackage})`);
383
345
  return;
384
346
  }
385
-
386
- // Special restrictions for app-specific features
387
347
  if (selectedFeature.appScope === 'specific') {
388
- // For features that are only available in specific apps, enforce strict matching
389
348
  const hasExactMatch = selectedFeature.applicableApps.length === 1 && selectedFeature.applicableApps[0] === currentAppPackage;
390
349
  if (!hasExactMatch && selectedFeature.applicableApps.length === 1) {
391
350
  const requiredApp = selectedFeature.applicableApps[0];
@@ -394,8 +353,6 @@ const PremiumSubscriptionScreen = ({
394
353
  }
395
354
  }
396
355
  setProcessingPayment(true);
397
-
398
- // Mock feature subscription
399
356
  await new Promise(resolve => setTimeout(resolve, 1500));
400
357
  setIndividualFeatures(prev => prev.map(feature => feature.id === featureId ? {
401
358
  ...feature,
@@ -414,24 +371,28 @@ const PremiumSubscriptionScreen = ({
414
371
  setProcessingPayment(false);
415
372
  }
416
373
  };
417
- const handleFeatureUnsubscribe = async featureId => {
418
- const feature = individualFeatures.find(f => f.id === featureId);
419
- confirmAction(t('premium.confirms.unsubscribeFeature', {
420
- name: feature?.name ?? ''
421
- }) ?? `Are you sure you want to unsubscribe from ${feature?.name}?`, async () => {
422
- try {
423
- setIndividualFeatures(prev => prev.map(f => f.id === featureId ? {
424
- ...f,
425
- isSubscribed: false
426
- } : f));
427
- toast.success(t('premium.toasts.featureUnsubscribed', {
428
- name: feature?.name ?? ''
429
- }) ?? `Unsubscribed from ${feature?.name}`);
430
- } catch (error) {
431
- toast.error(t('premium.toasts.featureUnsubscribeFailed') || 'Failed to unsubscribe from feature');
432
- }
433
- });
434
- };
374
+ const confirmFeatureUnsubscribe = useCallback(featureId => {
375
+ setPendingUnsubscribeFeatureId(featureId);
376
+ unsubscribeFeaturePrompt.open();
377
+ }, [unsubscribeFeaturePrompt]);
378
+ const handleFeatureUnsubscribe = useCallback(async () => {
379
+ if (!pendingUnsubscribeFeatureId) return;
380
+ const feature = individualFeatures.find(f => f.id === pendingUnsubscribeFeatureId);
381
+ try {
382
+ setIndividualFeatures(prev => prev.map(f => f.id === pendingUnsubscribeFeatureId ? {
383
+ ...f,
384
+ isSubscribed: false
385
+ } : f));
386
+ toast.success(t('premium.toasts.featureUnsubscribed', {
387
+ name: feature?.name ?? ''
388
+ }) ?? `Unsubscribed from ${feature?.name}`);
389
+ } catch (error) {
390
+ toast.error(t('premium.toasts.featureUnsubscribeFailed') || 'Failed to unsubscribe from feature');
391
+ } finally {
392
+ setPendingUnsubscribeFeatureId(null);
393
+ }
394
+ }, [pendingUnsubscribeFeatureId, individualFeatures, t]);
395
+ const pendingUnsubscribeFeature = useMemo(() => individualFeatures.find(f => f.id === pendingUnsubscribeFeatureId), [individualFeatures, pendingUnsubscribeFeatureId]);
435
396
  const renderHeader = () => {
436
397
  const getAppDisplayName = packageName => {
437
398
  const appNames = {
@@ -558,7 +519,7 @@ const PremiumSubscriptionScreen = ({
558
519
  style: [styles.actionButton, {
559
520
  backgroundColor: dangerColor
560
521
  }],
561
- onPress: handleCancelSubscription,
522
+ onPress: confirmCancelSubscription,
562
523
  children: /*#__PURE__*/_jsx(Text, {
563
524
  style: styles.actionButtonText,
564
525
  children: t('premium.actions.cancelSubBtn') || 'Cancel Subscription'
@@ -938,7 +899,7 @@ const PremiumSubscriptionScreen = ({
938
899
  style: [styles.unsubscribeButton, {
939
900
  borderColor: dangerColor
940
901
  }],
941
- onPress: () => handleFeatureUnsubscribe(feature.id),
902
+ onPress: () => confirmFeatureUnsubscribe(feature.id),
942
903
  children: /*#__PURE__*/_jsx(Text, {
943
904
  style: [styles.unsubscribeText, {
944
905
  color: dangerColor
@@ -1164,6 +1125,22 @@ const PremiumSubscriptionScreen = ({
1164
1125
  }), /*#__PURE__*/_jsx(View, {
1165
1126
  style: styles.bottomSpacing
1166
1127
  })]
1128
+ }), /*#__PURE__*/_jsx(Prompt.Basic, {
1129
+ control: cancelSubscriptionPrompt,
1130
+ title: t('premium.confirms.cancelSubTitle') || 'Cancel Subscription',
1131
+ description: t('premium.confirms.cancelSub') || 'Are you sure you want to cancel your subscription? You will lose access to premium features at the end of your current billing period.',
1132
+ onConfirm: handleCancelSubscription,
1133
+ confirmButtonCta: t('premium.actions.cancelSubBtn') || 'Cancel Subscription',
1134
+ confirmButtonColor: "negative"
1135
+ }), /*#__PURE__*/_jsx(Prompt.Basic, {
1136
+ control: unsubscribeFeaturePrompt,
1137
+ title: t('premium.confirms.unsubscribeFeatureTitle') || 'Unsubscribe from Feature',
1138
+ description: pendingUnsubscribeFeature ? t('premium.confirms.unsubscribeFeature', {
1139
+ name: pendingUnsubscribeFeature.name
1140
+ }) ?? `Are you sure you want to unsubscribe from ${pendingUnsubscribeFeature.name}?` : '',
1141
+ onConfirm: handleFeatureUnsubscribe,
1142
+ confirmButtonCta: t('premium.actions.unsubscribe') || 'Unsubscribe',
1143
+ confirmButtonColor: "negative"
1167
1144
  })]
1168
1145
  });
1169
1146
  };
@@ -1415,7 +1392,6 @@ const styles = StyleSheet.create({
1415
1392
  bottomSpacing: {
1416
1393
  height: 40
1417
1394
  },
1418
- // Tab Navigation Styles
1419
1395
  tabContainer: {
1420
1396
  flexDirection: 'row',
1421
1397
  borderBottomWidth: 1,
@@ -1431,7 +1407,6 @@ const styles = StyleSheet.create({
1431
1407
  fontSize: 16,
1432
1408
  fontWeight: '600'
1433
1409
  },
1434
- // Individual Feature Styles
1435
1410
  featureCard: {
1436
1411
  borderRadius: 12,
1437
1412
  borderWidth: 1,
@@ -1525,7 +1500,6 @@ const styles = StyleSheet.create({
1525
1500
  fontWeight: '600',
1526
1501
  marginBottom: 12
1527
1502
  },
1528
- // New styles for enhanced feature cards
1529
1503
  featureNameRow: {
1530
1504
  flexDirection: 'row',
1531
1505
  alignItems: 'center',
@@ -1573,7 +1547,6 @@ const styles = StyleSheet.create({
1573
1547
  fontWeight: '500',
1574
1548
  textAlign: 'center'
1575
1549
  },
1576
- // App-specific plan styles
1577
1550
  appSpecificBadge: {
1578
1551
  position: 'absolute',
1579
1552
  top: 16,
@@ -1603,7 +1576,6 @@ const styles = StyleSheet.create({
1603
1576
  fontSize: 16,
1604
1577
  fontWeight: '600'
1605
1578
  },
1606
- // App switcher styles (for development/testing)
1607
1579
  appSwitcher: {
1608
1580
  padding: 16,
1609
1581
  borderBottomWidth: 1,