@oxyhq/services 6.9.43 → 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.
- package/lib/commonjs/index.js +9 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/ui/components/ActingAsBanner.js +143 -0
- package/lib/commonjs/ui/components/ActingAsBanner.js.map +1 -0
- package/lib/commonjs/ui/components/OxyPayButton.js +4 -2
- package/lib/commonjs/ui/components/OxyPayButton.js.map +1 -1
- package/lib/commonjs/ui/components/OxySignInButton.js +83 -82
- package/lib/commonjs/ui/components/OxySignInButton.js.map +1 -1
- package/lib/commonjs/ui/components/SettingRow.js +11 -5
- package/lib/commonjs/ui/components/SettingRow.js.map +1 -1
- package/lib/commonjs/ui/components/fileManagement/FileDetailsModal.js +76 -121
- package/lib/commonjs/ui/components/fileManagement/FileDetailsModal.js.map +1 -1
- package/lib/commonjs/ui/components/fileManagement/UploadPreview.js +32 -18
- package/lib/commonjs/ui/components/fileManagement/UploadPreview.js.map +1 -1
- package/lib/commonjs/ui/components/icon/OxyIcon.js +5 -4
- package/lib/commonjs/ui/components/icon/OxyIcon.js.map +1 -1
- package/lib/commonjs/ui/components/internal/GroupedPillButtons.js +11 -9
- package/lib/commonjs/ui/components/internal/GroupedPillButtons.js.map +1 -1
- package/lib/commonjs/ui/components/internal/PinInput.js +3 -2
- package/lib/commonjs/ui/components/internal/PinInput.js.map +1 -1
- package/lib/commonjs/ui/components/modals/DeleteAccountModal.js +83 -219
- package/lib/commonjs/ui/components/modals/DeleteAccountModal.js.map +1 -1
- package/lib/commonjs/ui/constants/theme.js +2 -2
- package/lib/commonjs/ui/constants/theme.js.map +1 -1
- package/lib/commonjs/ui/context/OxyContext.js +78 -3
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/navigation/routes.js +3 -2
- package/lib/commonjs/ui/navigation/routes.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountCenterScreen.js +33 -11
- package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js +70 -79
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js +22 -10
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +376 -82
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountVerificationScreen.js +21 -9
- package/lib/commonjs/ui/screens/AccountVerificationScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/CreateManagedAccountScreen.js +346 -0
- package/lib/commonjs/ui/screens/CreateManagedAccountScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/FileManagementScreen.js +83 -50
- package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/HistoryViewScreen.js +80 -101
- package/lib/commonjs/ui/screens/HistoryViewScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js +66 -93
- package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SessionManagementScreen.js +101 -66
- package/lib/commonjs/ui/screens/SessionManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/utils/fileManagement.js +0 -21
- package/lib/commonjs/ui/utils/fileManagement.js.map +1 -1
- package/lib/module/index.js +3 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/ui/components/ActingAsBanner.js +140 -0
- package/lib/module/ui/components/ActingAsBanner.js.map +1 -0
- package/lib/module/ui/components/OxyPayButton.js +4 -2
- package/lib/module/ui/components/OxyPayButton.js.map +1 -1
- package/lib/module/ui/components/OxySignInButton.js +84 -83
- package/lib/module/ui/components/OxySignInButton.js.map +1 -1
- package/lib/module/ui/components/SettingRow.js +11 -5
- package/lib/module/ui/components/SettingRow.js.map +1 -1
- package/lib/module/ui/components/fileManagement/FileDetailsModal.js +76 -122
- package/lib/module/ui/components/fileManagement/FileDetailsModal.js.map +1 -1
- package/lib/module/ui/components/fileManagement/UploadPreview.js +32 -19
- package/lib/module/ui/components/fileManagement/UploadPreview.js.map +1 -1
- package/lib/module/ui/components/icon/OxyIcon.js +5 -4
- package/lib/module/ui/components/icon/OxyIcon.js.map +1 -1
- package/lib/module/ui/components/internal/GroupedPillButtons.js +11 -9
- package/lib/module/ui/components/internal/GroupedPillButtons.js.map +1 -1
- package/lib/module/ui/components/internal/PinInput.js +3 -2
- package/lib/module/ui/components/internal/PinInput.js.map +1 -1
- package/lib/module/ui/components/modals/DeleteAccountModal.js +83 -220
- package/lib/module/ui/components/modals/DeleteAccountModal.js.map +1 -1
- package/lib/module/ui/constants/theme.js +2 -2
- package/lib/module/ui/constants/theme.js.map +1 -1
- package/lib/module/ui/context/OxyContext.js +78 -3
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/navigation/routes.js +3 -2
- package/lib/module/ui/navigation/routes.js.map +1 -1
- package/lib/module/ui/screens/AccountCenterScreen.js +32 -11
- package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountOverviewScreen.js +71 -80
- package/lib/module/ui/screens/AccountOverviewScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSettingsScreen.js +22 -10
- package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSwitcherScreen.js +375 -82
- package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountVerificationScreen.js +22 -10
- package/lib/module/ui/screens/AccountVerificationScreen.js.map +1 -1
- package/lib/module/ui/screens/CreateManagedAccountScreen.js +342 -0
- package/lib/module/ui/screens/CreateManagedAccountScreen.js.map +1 -0
- package/lib/module/ui/screens/FileManagementScreen.js +85 -52
- package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/HistoryViewScreen.js +80 -101
- package/lib/module/ui/screens/HistoryViewScreen.js.map +1 -1
- package/lib/module/ui/screens/PremiumSubscriptionScreen.js +66 -94
- package/lib/module/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
- package/lib/module/ui/screens/SessionManagementScreen.js +101 -67
- package/lib/module/ui/screens/SessionManagementScreen.js.map +1 -1
- package/lib/module/ui/utils/fileManagement.js +0 -20
- package/lib/module/ui/utils/fileManagement.js.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +1 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/ActingAsBanner.d.ts +4 -0
- package/lib/typescript/commonjs/ui/components/ActingAsBanner.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/OxyPayButton.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/OxySignInButton.d.ts +0 -1
- package/lib/typescript/commonjs/ui/components/OxySignInButton.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/SettingRow.d.ts +2 -2
- package/lib/typescript/commonjs/ui/components/SettingRow.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/fileManagement/FileDetailsModal.d.ts +3 -4
- package/lib/typescript/commonjs/ui/components/fileManagement/FileDetailsModal.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/fileManagement/UploadPreview.d.ts +2 -3
- package/lib/typescript/commonjs/ui/components/fileManagement/UploadPreview.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/icon/OxyIcon.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/internal/GroupedPillButtons.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/internal/PinInput.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/modals/DeleteAccountModal.d.ts +2 -2
- package/lib/typescript/commonjs/ui/components/modals/DeleteAccountModal.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/OxyContext.d.ts +6 -0
- package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/navigation/routes.d.ts +1 -1
- package/lib/typescript/commonjs/ui/navigation/routes.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/AccountCenterScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/AccountOverviewScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/AccountSwitcherScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/AccountVerificationScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/CreateManagedAccountScreen.d.ts +5 -0
- package/lib/typescript/commonjs/ui/screens/CreateManagedAccountScreen.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/FileManagementScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/HistoryViewScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/PremiumSubscriptionScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/SessionManagementScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/utils/fileManagement.d.ts +0 -4
- package/lib/typescript/commonjs/ui/utils/fileManagement.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +1 -0
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/ActingAsBanner.d.ts +4 -0
- package/lib/typescript/module/ui/components/ActingAsBanner.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/OxyPayButton.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/OxySignInButton.d.ts +0 -1
- package/lib/typescript/module/ui/components/OxySignInButton.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/SettingRow.d.ts +2 -2
- package/lib/typescript/module/ui/components/SettingRow.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/fileManagement/FileDetailsModal.d.ts +3 -4
- package/lib/typescript/module/ui/components/fileManagement/FileDetailsModal.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/fileManagement/UploadPreview.d.ts +2 -3
- package/lib/typescript/module/ui/components/fileManagement/UploadPreview.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/icon/OxyIcon.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/internal/GroupedPillButtons.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/internal/PinInput.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/modals/DeleteAccountModal.d.ts +2 -2
- package/lib/typescript/module/ui/components/modals/DeleteAccountModal.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/OxyContext.d.ts +6 -0
- package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/module/ui/navigation/routes.d.ts +1 -1
- package/lib/typescript/module/ui/navigation/routes.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/AccountCenterScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/AccountOverviewScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/AccountSwitcherScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/AccountVerificationScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/CreateManagedAccountScreen.d.ts +5 -0
- package/lib/typescript/module/ui/screens/CreateManagedAccountScreen.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/FileManagementScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/HistoryViewScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/PremiumSubscriptionScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/SessionManagementScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/utils/fileManagement.d.ts +0 -4
- package/lib/typescript/module/ui/utils/fileManagement.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +3 -0
- package/src/ui/components/ActingAsBanner.tsx +135 -0
- package/src/ui/components/OxyPayButton.tsx +5 -3
- package/src/ui/components/OxySignInButton.tsx +82 -81
- package/src/ui/components/SettingRow.tsx +14 -7
- package/src/ui/components/fileManagement/FileDetailsModal.tsx +69 -99
- package/src/ui/components/fileManagement/UploadPreview.tsx +58 -46
- package/src/ui/components/icon/OxyIcon.tsx +5 -4
- package/src/ui/components/internal/GroupedPillButtons.tsx +15 -12
- package/src/ui/components/internal/PinInput.tsx +4 -3
- package/src/ui/components/modals/DeleteAccountModal.tsx +79 -221
- package/src/ui/constants/theme.ts +2 -2
- package/src/ui/context/OxyContext.tsx +85 -0
- package/src/ui/navigation/routes.ts +3 -1
- package/src/ui/screens/AccountCenterScreen.tsx +40 -122
- package/src/ui/screens/AccountOverviewScreen.tsx +63 -98
- package/src/ui/screens/AccountSettingsScreen.tsx +21 -7
- package/src/ui/screens/AccountSwitcherScreen.tsx +344 -87
- package/src/ui/screens/AccountVerificationScreen.tsx +24 -16
- package/src/ui/screens/CreateManagedAccountScreen.tsx +338 -0
- package/src/ui/screens/FileManagementScreen.tsx +62 -54
- package/src/ui/screens/HistoryViewScreen.tsx +57 -204
- package/src/ui/screens/PremiumSubscriptionScreen.tsx +73 -93
- package/src/ui/screens/SessionManagementScreen.tsx +101 -73
- package/src/ui/utils/fileManagement.ts +0 -30
- package/lib/commonjs/ui/utils/confirmAction.js +0 -28
- package/lib/commonjs/ui/utils/confirmAction.js.map +0 -1
- package/lib/module/ui/utils/confirmAction.js +0 -25
- package/lib/module/ui/utils/confirmAction.js.map +0 -1
- package/lib/typescript/commonjs/ui/utils/confirmAction.d.ts +0 -7
- package/lib/typescript/commonjs/ui/utils/confirmAction.d.ts.map +0 -1
- package/lib/typescript/module/ui/utils/confirmAction.d.ts +0 -7
- package/lib/typescript/module/ui/utils/confirmAction.d.ts.map +0 -1
- package/src/ui/utils/confirmAction.ts +0 -23
|
@@ -8,7 +8,8 @@ var _react = require("react");
|
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _fonts = require("../styles/fonts.js");
|
|
10
10
|
var _sonner = require("../../lib/sonner");
|
|
11
|
-
var
|
|
11
|
+
var _prompt = _interopRequireWildcard(require("@oxyhq/bloom/prompt"));
|
|
12
|
+
var Prompt = _prompt;
|
|
12
13
|
var _OxyIcon = _interopRequireDefault(require("../components/icon/OxyIcon.js"));
|
|
13
14
|
var _index = require("../components/index.js");
|
|
14
15
|
var _useI18n = require("../hooks/useI18n.js");
|
|
@@ -16,6 +17,7 @@ var _theme = require("@oxyhq/bloom/theme");
|
|
|
16
17
|
var _OxyContext = require("../context/OxyContext.js");
|
|
17
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
19
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
19
21
|
const ModernAccountSwitcherScreen = ({
|
|
20
22
|
onClose,
|
|
21
23
|
theme,
|
|
@@ -34,11 +36,15 @@ const ModernAccountSwitcherScreen = ({
|
|
|
34
36
|
logoutAll,
|
|
35
37
|
refreshSessions,
|
|
36
38
|
isLoading = false,
|
|
37
|
-
isAuthenticated = false
|
|
39
|
+
isAuthenticated = false,
|
|
40
|
+
actingAs,
|
|
41
|
+
managedAccounts,
|
|
42
|
+
setActingAs
|
|
38
43
|
} = (0, _OxyContext.useOxy)();
|
|
39
44
|
const [sessionsWithUsers, setSessionsWithUsers] = (0, _react.useState)([]);
|
|
40
45
|
const [switchingToUserId, setSwitchingToUserId] = (0, _react.useState)(null);
|
|
41
46
|
const [removingUserId, setRemovingUserId] = (0, _react.useState)(null);
|
|
47
|
+
const [switchingManagedId, setSwitchingManagedId] = (0, _react.useState)(null);
|
|
42
48
|
|
|
43
49
|
// Device session management state
|
|
44
50
|
const [showDeviceManagement, setShowDeviceManagement] = (0, _react.useState)(false);
|
|
@@ -46,6 +52,16 @@ const ModernAccountSwitcherScreen = ({
|
|
|
46
52
|
const [loadingDeviceSessions, setLoadingDeviceSessions] = (0, _react.useState)(false);
|
|
47
53
|
const [remotingLogoutSessionId, setRemoteLogoutSessionId] = (0, _react.useState)(null);
|
|
48
54
|
const [loggingOutAllDevices, setLoggingOutAllDevices] = (0, _react.useState)(false);
|
|
55
|
+
|
|
56
|
+
// Pending state for prompts
|
|
57
|
+
const [pendingRemoveSession, setPendingRemoveSession] = (0, _react.useState)(null);
|
|
58
|
+
const [pendingRemoteLogout, setPendingRemoteLogout] = (0, _react.useState)(null);
|
|
59
|
+
|
|
60
|
+
// Prompt controls
|
|
61
|
+
const removeSessionPrompt = (0, _prompt.usePromptControl)();
|
|
62
|
+
const logoutAllPrompt = (0, _prompt.usePromptControl)();
|
|
63
|
+
const remoteLogoutPrompt = (0, _prompt.usePromptControl)();
|
|
64
|
+
const logoutAllDevicesPrompt = (0, _prompt.usePromptControl)();
|
|
49
65
|
const screenWidth = _reactNative.Dimensions.get('window').width;
|
|
50
66
|
const {
|
|
51
67
|
t
|
|
@@ -140,45 +156,75 @@ const ModernAccountSwitcherScreen = ({
|
|
|
140
156
|
setSwitchingToUserId(null);
|
|
141
157
|
}
|
|
142
158
|
}, [activeSessionId, switchSession, onClose, t, switchingToUserId]);
|
|
143
|
-
const
|
|
144
|
-
if (removingUserId) return;
|
|
145
|
-
|
|
146
|
-
|
|
159
|
+
const confirmRemoveSession = (0, _react.useCallback)((sessionId, displayName) => {
|
|
160
|
+
if (removingUserId) return;
|
|
161
|
+
setPendingRemoveSession({
|
|
162
|
+
sessionId,
|
|
147
163
|
displayName
|
|
148
|
-
}) || `Are you sure you want to remove ${displayName} from this device? You'll need to sign in again to access this account.`, async () => {
|
|
149
|
-
setRemovingUserId(sessionId);
|
|
150
|
-
try {
|
|
151
|
-
await removeSession(sessionId);
|
|
152
|
-
_sonner.toast.success(t('accountSwitcher.toasts.removeSuccess') || 'Account removed successfully!');
|
|
153
|
-
} catch (error) {
|
|
154
|
-
if (__DEV__) {
|
|
155
|
-
console.error('Remove session failed:', error);
|
|
156
|
-
}
|
|
157
|
-
_sonner.toast.error(t('accountSwitcher.toasts.removeFailed') || 'There was a problem removing the account. Please try again.');
|
|
158
|
-
} finally {
|
|
159
|
-
setRemovingUserId(null);
|
|
160
|
-
}
|
|
161
164
|
});
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
_sonner.toast.error(t('accountSwitcher.toasts.signOutAllFailed', {
|
|
177
|
-
error: errorMessage
|
|
178
|
-
}) || `There was a problem signing out: ${errorMessage}`);
|
|
165
|
+
removeSessionPrompt.open();
|
|
166
|
+
}, [removingUserId, removeSessionPrompt]);
|
|
167
|
+
const handleRemoveSession = (0, _react.useCallback)(async () => {
|
|
168
|
+
if (!pendingRemoveSession) return;
|
|
169
|
+
const {
|
|
170
|
+
sessionId
|
|
171
|
+
} = pendingRemoveSession;
|
|
172
|
+
setRemovingUserId(sessionId);
|
|
173
|
+
try {
|
|
174
|
+
await removeSession(sessionId);
|
|
175
|
+
_sonner.toast.success(t('accountSwitcher.toasts.removeSuccess') || 'Account removed successfully!');
|
|
176
|
+
} catch (error) {
|
|
177
|
+
if (__DEV__) {
|
|
178
|
+
console.error('Remove session failed:', error);
|
|
179
179
|
}
|
|
180
|
-
|
|
180
|
+
_sonner.toast.error(t('accountSwitcher.toasts.removeFailed') || 'There was a problem removing the account. Please try again.');
|
|
181
|
+
} finally {
|
|
182
|
+
setRemovingUserId(null);
|
|
183
|
+
setPendingRemoveSession(null);
|
|
184
|
+
}
|
|
185
|
+
}, [pendingRemoveSession, removeSession, t]);
|
|
186
|
+
const confirmLogoutAll = (0, _react.useCallback)(() => {
|
|
187
|
+
logoutAllPrompt.open();
|
|
188
|
+
}, [logoutAllPrompt]);
|
|
189
|
+
const handleLogoutAll = (0, _react.useCallback)(async () => {
|
|
190
|
+
try {
|
|
191
|
+
await logoutAll();
|
|
192
|
+
_sonner.toast.success(t('accountSwitcher.toasts.signOutAllSuccess') || 'All accounts signed out successfully!');
|
|
193
|
+
if (onClose) {
|
|
194
|
+
onClose();
|
|
195
|
+
}
|
|
196
|
+
} catch (error) {
|
|
197
|
+
if (__DEV__) {
|
|
198
|
+
console.error('Logout all failed:', error);
|
|
199
|
+
}
|
|
200
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
201
|
+
_sonner.toast.error(t('accountSwitcher.toasts.signOutAllFailed', {
|
|
202
|
+
error: errorMessage
|
|
203
|
+
}) || `There was a problem signing out: ${errorMessage}`);
|
|
204
|
+
}
|
|
181
205
|
}, [logoutAll, onClose, t]);
|
|
206
|
+
const handleSwitchToManagedAccount = (0, _react.useCallback)(async accountId => {
|
|
207
|
+
if (actingAs === accountId) return; // Already acting as this account
|
|
208
|
+
if (switchingManagedId) return; // Already switching
|
|
209
|
+
|
|
210
|
+
setSwitchingManagedId(accountId);
|
|
211
|
+
try {
|
|
212
|
+
setActingAs(accountId);
|
|
213
|
+
_sonner.toast.success(t('accountSwitcher.toasts.switchSuccess') || 'Switched identity successfully!');
|
|
214
|
+
onClose?.();
|
|
215
|
+
} catch (error) {
|
|
216
|
+
if (__DEV__) {
|
|
217
|
+
console.error('Switch managed account failed:', error);
|
|
218
|
+
}
|
|
219
|
+
_sonner.toast.error('Failed to switch identity. Please try again.');
|
|
220
|
+
} finally {
|
|
221
|
+
setSwitchingManagedId(null);
|
|
222
|
+
}
|
|
223
|
+
}, [actingAs, switchingManagedId, setActingAs, t, onClose]);
|
|
224
|
+
const handleSwitchBackToPrimary = (0, _react.useCallback)(() => {
|
|
225
|
+
setActingAs(null);
|
|
226
|
+
_sonner.toast.success('Switched back to primary account');
|
|
227
|
+
}, [setActingAs]);
|
|
182
228
|
|
|
183
229
|
// Device session management functions - optimized with useCallback
|
|
184
230
|
const loadAllDeviceSessions = (0, _react.useCallback)(async () => {
|
|
@@ -197,58 +243,64 @@ const ModernAccountSwitcherScreen = ({
|
|
|
197
243
|
setLoadingDeviceSessions(false);
|
|
198
244
|
}
|
|
199
245
|
}, [oxyServices, activeSessionId, t]);
|
|
200
|
-
const
|
|
201
|
-
if (remotingLogoutSessionId) return;
|
|
202
|
-
|
|
203
|
-
|
|
246
|
+
const confirmRemoteSessionLogout = (0, _react.useCallback)((sessionId, deviceName) => {
|
|
247
|
+
if (remotingLogoutSessionId) return;
|
|
248
|
+
setPendingRemoteLogout({
|
|
249
|
+
sessionId,
|
|
204
250
|
deviceName
|
|
205
|
-
}) || `Are you sure you want to sign out from "${deviceName}"? This will end the session on that device.`, async () => {
|
|
206
|
-
setRemoteLogoutSessionId(sessionId);
|
|
207
|
-
try {
|
|
208
|
-
await oxyServices?.logoutSession((activeSessionId ?? null) || '', sessionId);
|
|
209
|
-
await loadAllDeviceSessions();
|
|
210
|
-
_sonner.toast.success(t('accountSwitcher.toasts.remoteSignOutSuccess', {
|
|
211
|
-
deviceName
|
|
212
|
-
}) || `Signed out from ${deviceName} successfully!`);
|
|
213
|
-
} catch (error) {
|
|
214
|
-
if (__DEV__) {
|
|
215
|
-
console.error('Remote logout failed:', error);
|
|
216
|
-
}
|
|
217
|
-
_sonner.toast.error(t('accountSwitcher.toasts.remoteSignOutFailed') || 'There was a problem signing out from the device. Please try again.');
|
|
218
|
-
} finally {
|
|
219
|
-
setRemoteLogoutSessionId(null);
|
|
220
|
-
}
|
|
221
251
|
});
|
|
222
|
-
|
|
223
|
-
|
|
252
|
+
remoteLogoutPrompt.open();
|
|
253
|
+
}, [remotingLogoutSessionId, remoteLogoutPrompt]);
|
|
254
|
+
const handleRemoteSessionLogout = (0, _react.useCallback)(async () => {
|
|
255
|
+
if (!pendingRemoteLogout) return;
|
|
256
|
+
const {
|
|
257
|
+
sessionId
|
|
258
|
+
} = pendingRemoteLogout;
|
|
259
|
+
setRemoteLogoutSessionId(sessionId);
|
|
260
|
+
try {
|
|
261
|
+
await oxyServices?.logoutSession((activeSessionId ?? null) || '', sessionId);
|
|
262
|
+
await loadAllDeviceSessions();
|
|
263
|
+
_sonner.toast.success(t('accountSwitcher.toasts.remoteSignOutSuccess', {
|
|
264
|
+
deviceName: pendingRemoteLogout.deviceName
|
|
265
|
+
}) || `Signed out from ${pendingRemoteLogout.deviceName} successfully!`);
|
|
266
|
+
} catch (error) {
|
|
267
|
+
if (__DEV__) {
|
|
268
|
+
console.error('Remote logout failed:', error);
|
|
269
|
+
}
|
|
270
|
+
_sonner.toast.error(t('accountSwitcher.toasts.remoteSignOutFailed') || 'There was a problem signing out from the device. Please try again.');
|
|
271
|
+
} finally {
|
|
272
|
+
setRemoteLogoutSessionId(null);
|
|
273
|
+
setPendingRemoteLogout(null);
|
|
274
|
+
}
|
|
275
|
+
}, [pendingRemoteLogout, activeSessionId, oxyServices, loadAllDeviceSessions, t]);
|
|
276
|
+
const confirmLogoutAllDevices = (0, _react.useCallback)(() => {
|
|
224
277
|
const otherDevicesCount = deviceSessions.filter(session => !session.isCurrent).length;
|
|
225
278
|
if (otherDevicesCount === 0) {
|
|
226
279
|
_sonner.toast.info(t('accountSwitcher.toasts.noOtherDeviceSessions') || 'No other device sessions found to sign out from.');
|
|
227
280
|
return;
|
|
228
281
|
}
|
|
229
|
-
if (loggingOutAllDevices) return;
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
console.error('Logout all devices failed:', error);
|
|
242
|
-
}
|
|
243
|
-
_sonner.toast.error(t('accountSwitcher.toasts.signOutOthersFailed') || 'There was a problem signing out from other devices. Please try again.');
|
|
244
|
-
} finally {
|
|
245
|
-
setLoggingOutAllDevices(false);
|
|
282
|
+
if (loggingOutAllDevices) return;
|
|
283
|
+
logoutAllDevicesPrompt.open();
|
|
284
|
+
}, [deviceSessions, loggingOutAllDevices, logoutAllDevicesPrompt, t]);
|
|
285
|
+
const handleLogoutAllDevices = (0, _react.useCallback)(async () => {
|
|
286
|
+
setLoggingOutAllDevices(true);
|
|
287
|
+
try {
|
|
288
|
+
await oxyServices?.logoutAllDeviceSessions((activeSessionId ?? null) || '');
|
|
289
|
+
await loadAllDeviceSessions();
|
|
290
|
+
_sonner.toast.success(t('accountSwitcher.toasts.signOutOthersSuccess') || 'Signed out from all other devices successfully!');
|
|
291
|
+
} catch (error) {
|
|
292
|
+
if (__DEV__) {
|
|
293
|
+
console.error('Logout all devices failed:', error);
|
|
246
294
|
}
|
|
247
|
-
|
|
248
|
-
|
|
295
|
+
_sonner.toast.error(t('accountSwitcher.toasts.signOutOthersFailed') || 'There was a problem signing out from other devices. Please try again.');
|
|
296
|
+
} finally {
|
|
297
|
+
setLoggingOutAllDevices(false);
|
|
298
|
+
}
|
|
299
|
+
}, [activeSessionId, oxyServices, loadAllDeviceSessions, t]);
|
|
249
300
|
|
|
250
301
|
// Memoize filtered sessions for performance
|
|
251
302
|
const otherSessions = (0, _react.useMemo)(() => sessionsWithUsers.filter(s => s.sessionId !== (activeSessionId ?? null)), [sessionsWithUsers, activeSessionId]);
|
|
303
|
+
const otherDevicesCount = (0, _react.useMemo)(() => deviceSessions.filter(session => !session.isCurrent).length, [deviceSessions]);
|
|
252
304
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
253
305
|
style: [styles.container, {
|
|
254
306
|
backgroundColor: bloomTheme.colors.background
|
|
@@ -382,7 +434,7 @@ const ModernAccountSwitcherScreen = ({
|
|
|
382
434
|
})
|
|
383
435
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
384
436
|
style: styles.removeButton,
|
|
385
|
-
onPress: () =>
|
|
437
|
+
onPress: () => confirmRemoveSession(sessionWithUser.sessionId, displayName),
|
|
386
438
|
disabled: isSwitching || isRemoving,
|
|
387
439
|
children: isRemoving ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ActivityIndicator, {
|
|
388
440
|
size: "small",
|
|
@@ -396,6 +448,178 @@ const ModernAccountSwitcherScreen = ({
|
|
|
396
448
|
})]
|
|
397
449
|
}, `session-${sessionWithUser.sessionId}-${index}`);
|
|
398
450
|
})]
|
|
451
|
+
}), actingAs && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
452
|
+
style: styles.section,
|
|
453
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
|
|
454
|
+
style: [styles.settingItem, styles.firstSettingItem, styles.lastSettingItem, styles.actingAsBanner],
|
|
455
|
+
onPress: handleSwitchBackToPrimary,
|
|
456
|
+
activeOpacity: 0.7,
|
|
457
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
458
|
+
style: styles.settingInfo,
|
|
459
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
460
|
+
style: styles.settingLabel,
|
|
461
|
+
children: "Switch back to primary account"
|
|
462
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
463
|
+
style: styles.settingDescription,
|
|
464
|
+
children: "You are currently acting as another identity"
|
|
465
|
+
})]
|
|
466
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
467
|
+
style: styles.switchBackButton,
|
|
468
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
469
|
+
style: styles.switchBackButtonText,
|
|
470
|
+
children: "Switch Back"
|
|
471
|
+
})
|
|
472
|
+
})]
|
|
473
|
+
})
|
|
474
|
+
}), managedAccounts.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
475
|
+
style: styles.section,
|
|
476
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
477
|
+
style: styles.sectionTitle,
|
|
478
|
+
children: "Managed Accounts"
|
|
479
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
480
|
+
style: styles.sectionSubtitle,
|
|
481
|
+
children: "Identities you manage"
|
|
482
|
+
}), managedAccounts.map((managed, index) => {
|
|
483
|
+
const account = managed.account;
|
|
484
|
+
if (!account) return null;
|
|
485
|
+
const isActive = actingAs === managed.accountId;
|
|
486
|
+
const isSwitching = switchingManagedId === managed.accountId;
|
|
487
|
+
const isFirst = index === 0;
|
|
488
|
+
const isLast = index === managedAccounts.length - 1;
|
|
489
|
+
const managedDisplayName = typeof account.name === 'object' ? account.name.full || account.name.first || account.username : account.name || account.username || 'Unknown';
|
|
490
|
+
|
|
491
|
+
// Determine the manager role for badge display
|
|
492
|
+
const myRole = managed.managers?.find(m => m.userId === user?.id)?.role ?? 'owner';
|
|
493
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
|
|
494
|
+
style: [styles.settingItem, isFirst && styles.firstSettingItem, isLast && styles.lastSettingItem, isActive && styles.currentAccountCard],
|
|
495
|
+
onPress: () => handleSwitchToManagedAccount(managed.accountId),
|
|
496
|
+
disabled: isActive || isSwitching,
|
|
497
|
+
activeOpacity: 0.7,
|
|
498
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
499
|
+
style: styles.userIcon,
|
|
500
|
+
children: [account.avatar ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Image, {
|
|
501
|
+
source: {
|
|
502
|
+
uri: oxyServices.getFileDownloadUrl(account.avatar, 'thumb')
|
|
503
|
+
},
|
|
504
|
+
style: styles.accountAvatarImage
|
|
505
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
506
|
+
style: [styles.accountAvatarFallback, styles.managedAvatarFallback],
|
|
507
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
508
|
+
style: styles.accountAvatarText,
|
|
509
|
+
children: managedDisplayName.charAt(0).toUpperCase()
|
|
510
|
+
})
|
|
511
|
+
}), isActive && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
512
|
+
style: styles.activeBadge,
|
|
513
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyIcon.default, {
|
|
514
|
+
name: "checkmark",
|
|
515
|
+
size: 12,
|
|
516
|
+
color: "#fff"
|
|
517
|
+
})
|
|
518
|
+
})]
|
|
519
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
520
|
+
style: styles.settingInfo,
|
|
521
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
522
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
523
|
+
style: styles.settingLabel,
|
|
524
|
+
children: managedDisplayName
|
|
525
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
|
|
526
|
+
style: styles.settingDescription,
|
|
527
|
+
children: ["@", account.username]
|
|
528
|
+
})]
|
|
529
|
+
})
|
|
530
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
531
|
+
style: styles.accountActions,
|
|
532
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
533
|
+
style: styles.roleBadge,
|
|
534
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
535
|
+
style: styles.roleBadgeText,
|
|
536
|
+
children: myRole
|
|
537
|
+
})
|
|
538
|
+
}), isActive ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
539
|
+
style: styles.currentBadge,
|
|
540
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
541
|
+
style: styles.currentBadgeText,
|
|
542
|
+
children: "Current"
|
|
543
|
+
})
|
|
544
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
545
|
+
style: styles.switchButton,
|
|
546
|
+
onPress: () => handleSwitchToManagedAccount(managed.accountId),
|
|
547
|
+
disabled: isSwitching,
|
|
548
|
+
children: isSwitching ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ActivityIndicator, {
|
|
549
|
+
size: "small",
|
|
550
|
+
color: "#fff"
|
|
551
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
552
|
+
style: styles.switchButtonText,
|
|
553
|
+
children: "Act As"
|
|
554
|
+
})
|
|
555
|
+
})]
|
|
556
|
+
})]
|
|
557
|
+
}, `managed-${managed.accountId}`);
|
|
558
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
|
|
559
|
+
style: [styles.settingItem, styles.firstSettingItem, styles.lastSettingItem, {
|
|
560
|
+
marginTop: 8
|
|
561
|
+
}],
|
|
562
|
+
onPress: () => navigate?.('CreateManagedAccount'),
|
|
563
|
+
activeOpacity: 0.7,
|
|
564
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
565
|
+
style: styles.userIcon,
|
|
566
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
567
|
+
style: [styles.accountAvatarFallback, {
|
|
568
|
+
backgroundColor: '#007AFF20'
|
|
569
|
+
}],
|
|
570
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyIcon.default, {
|
|
571
|
+
name: "add",
|
|
572
|
+
size: 20,
|
|
573
|
+
color: "#007AFF"
|
|
574
|
+
})
|
|
575
|
+
})
|
|
576
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
577
|
+
style: styles.settingInfo,
|
|
578
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
579
|
+
style: [styles.settingLabel, {
|
|
580
|
+
color: '#007AFF'
|
|
581
|
+
}],
|
|
582
|
+
children: "Create New Identity"
|
|
583
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
584
|
+
style: styles.settingDescription,
|
|
585
|
+
children: "Add a managed sub-account"
|
|
586
|
+
})]
|
|
587
|
+
})]
|
|
588
|
+
})]
|
|
589
|
+
}), managedAccounts.length === 0 && isAuthenticated && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
590
|
+
style: styles.section,
|
|
591
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
592
|
+
style: styles.sectionTitle,
|
|
593
|
+
children: "Managed Accounts"
|
|
594
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
|
|
595
|
+
style: [styles.settingItem, styles.firstSettingItem, styles.lastSettingItem],
|
|
596
|
+
onPress: () => navigate?.('CreateManagedAccount'),
|
|
597
|
+
activeOpacity: 0.7,
|
|
598
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
599
|
+
style: styles.userIcon,
|
|
600
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
601
|
+
style: [styles.accountAvatarFallback, {
|
|
602
|
+
backgroundColor: '#007AFF20'
|
|
603
|
+
}],
|
|
604
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyIcon.default, {
|
|
605
|
+
name: "add",
|
|
606
|
+
size: 20,
|
|
607
|
+
color: "#007AFF"
|
|
608
|
+
})
|
|
609
|
+
})
|
|
610
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
611
|
+
style: styles.settingInfo,
|
|
612
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
613
|
+
style: [styles.settingLabel, {
|
|
614
|
+
color: '#007AFF'
|
|
615
|
+
}],
|
|
616
|
+
children: "Create New Identity"
|
|
617
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
618
|
+
style: styles.settingDescription,
|
|
619
|
+
children: "Create a managed sub-account you control"
|
|
620
|
+
})]
|
|
621
|
+
})]
|
|
622
|
+
})]
|
|
399
623
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
400
624
|
style: styles.section,
|
|
401
625
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
@@ -422,7 +646,7 @@ const ModernAccountSwitcherScreen = ({
|
|
|
422
646
|
iconColor: '#FF3B30',
|
|
423
647
|
title: 'Sign Out All Accounts',
|
|
424
648
|
subtitle: 'Remove all accounts from this device',
|
|
425
|
-
onPress:
|
|
649
|
+
onPress: confirmLogoutAll,
|
|
426
650
|
disabled: sessionsWithUsers.length === 0
|
|
427
651
|
}]
|
|
428
652
|
})]
|
|
@@ -465,11 +689,11 @@ const ModernAccountSwitcherScreen = ({
|
|
|
465
689
|
subtitle: t('accountSwitcher.device.lastActive', {
|
|
466
690
|
date: new Date(session.lastActive).toLocaleDateString()
|
|
467
691
|
}) || `Last active: ${new Date(session.lastActive).toLocaleDateString()}`,
|
|
468
|
-
onPress: session.isCurrent ? undefined : () =>
|
|
692
|
+
onPress: session.isCurrent ? undefined : () => confirmRemoteSessionLogout(session.sessionId, session.deviceName),
|
|
469
693
|
disabled: session.isCurrent || remotingLogoutSessionId === session.sessionId,
|
|
470
694
|
customContent: !session.isCurrent ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
471
695
|
style: styles.removeButton,
|
|
472
|
-
onPress: () =>
|
|
696
|
+
onPress: () => confirmRemoteSessionLogout(session.sessionId, session.deviceName),
|
|
473
697
|
disabled: remotingLogoutSessionId === session.sessionId,
|
|
474
698
|
children: remotingLogoutSessionId === session.sessionId ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ActivityIndicator, {
|
|
475
699
|
size: "small",
|
|
@@ -517,6 +741,40 @@ const ModernAccountSwitcherScreen = ({
|
|
|
517
741
|
})
|
|
518
742
|
})]
|
|
519
743
|
})
|
|
744
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Prompt.Basic, {
|
|
745
|
+
control: removeSessionPrompt,
|
|
746
|
+
title: t('accountSwitcher.confirms.removeTitle') || 'Remove Account',
|
|
747
|
+
description: pendingRemoveSession ? t('accountSwitcher.confirms.remove', {
|
|
748
|
+
displayName: pendingRemoveSession.displayName
|
|
749
|
+
}) || `Are you sure you want to remove ${pendingRemoveSession.displayName} from this device? You'll need to sign in again to access this account.` : '',
|
|
750
|
+
onConfirm: handleRemoveSession,
|
|
751
|
+
confirmButtonCta: t('common.remove') || 'Remove',
|
|
752
|
+
confirmButtonColor: "negative"
|
|
753
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Prompt.Basic, {
|
|
754
|
+
control: logoutAllPrompt,
|
|
755
|
+
title: t('accountSwitcher.confirms.logoutAllTitle') || 'Sign Out All',
|
|
756
|
+
description: t('accountSwitcher.confirms.logoutAll') || 'Are you sure you want to sign out of all accounts? This will remove all saved accounts from this device.',
|
|
757
|
+
onConfirm: handleLogoutAll,
|
|
758
|
+
confirmButtonCta: t('common.signOutAll') || 'Sign Out All',
|
|
759
|
+
confirmButtonColor: "negative"
|
|
760
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Prompt.Basic, {
|
|
761
|
+
control: remoteLogoutPrompt,
|
|
762
|
+
title: t('accountSwitcher.confirms.remoteLogoutTitle') || 'Remote Sign Out',
|
|
763
|
+
description: pendingRemoteLogout ? t('accountSwitcher.confirms.remoteLogout', {
|
|
764
|
+
deviceName: pendingRemoteLogout.deviceName
|
|
765
|
+
}) || `Are you sure you want to sign out from "${pendingRemoteLogout.deviceName}"? This will end the session on that device.` : '',
|
|
766
|
+
onConfirm: handleRemoteSessionLogout,
|
|
767
|
+
confirmButtonCta: t('common.signOut') || 'Sign Out',
|
|
768
|
+
confirmButtonColor: "negative"
|
|
769
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Prompt.Basic, {
|
|
770
|
+
control: logoutAllDevicesPrompt,
|
|
771
|
+
title: t('accountSwitcher.confirms.logoutOthersTitle') || 'Sign Out Other Devices',
|
|
772
|
+
description: t('accountSwitcher.confirms.logoutOthers', {
|
|
773
|
+
count: otherDevicesCount
|
|
774
|
+
}) || `Are you sure you want to sign out from all ${otherDevicesCount} other device(s)? This will end sessions on all other devices except this one.`,
|
|
775
|
+
onConfirm: handleLogoutAllDevices,
|
|
776
|
+
confirmButtonCta: t('common.signOutAll') || 'Sign Out All',
|
|
777
|
+
confirmButtonColor: "negative"
|
|
520
778
|
})]
|
|
521
779
|
});
|
|
522
780
|
};
|
|
@@ -677,6 +935,42 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
677
935
|
color: '#fff',
|
|
678
936
|
fontSize: 16,
|
|
679
937
|
fontWeight: '600'
|
|
938
|
+
},
|
|
939
|
+
sectionSubtitle: {
|
|
940
|
+
fontSize: 13,
|
|
941
|
+
color: '#888',
|
|
942
|
+
marginBottom: 12
|
|
943
|
+
},
|
|
944
|
+
managedAvatarFallback: {
|
|
945
|
+
backgroundColor: '#5856D6'
|
|
946
|
+
},
|
|
947
|
+
roleBadge: {
|
|
948
|
+
backgroundColor: '#F2F2F7',
|
|
949
|
+
paddingHorizontal: 8,
|
|
950
|
+
paddingVertical: 3,
|
|
951
|
+
borderRadius: 8
|
|
952
|
+
},
|
|
953
|
+
roleBadgeText: {
|
|
954
|
+
color: '#666',
|
|
955
|
+
fontSize: 11,
|
|
956
|
+
fontWeight: '500',
|
|
957
|
+
textTransform: 'capitalize'
|
|
958
|
+
},
|
|
959
|
+
actingAsBanner: {
|
|
960
|
+
borderWidth: 2,
|
|
961
|
+
borderColor: '#FF9500',
|
|
962
|
+
backgroundColor: '#FF950010'
|
|
963
|
+
},
|
|
964
|
+
switchBackButton: {
|
|
965
|
+
backgroundColor: '#FF9500',
|
|
966
|
+
paddingHorizontal: 14,
|
|
967
|
+
paddingVertical: 8,
|
|
968
|
+
borderRadius: 16
|
|
969
|
+
},
|
|
970
|
+
switchBackButtonText: {
|
|
971
|
+
color: '#fff',
|
|
972
|
+
fontSize: 13,
|
|
973
|
+
fontWeight: '600'
|
|
680
974
|
}
|
|
681
975
|
});
|
|
682
976
|
var _default = exports.default = ModernAccountSwitcherScreen;
|