@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.
- 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/screens/AccountCenterScreen.js +12 -10
- 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 +141 -81
- 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/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/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/screens/AccountCenterScreen.js +11 -10
- 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 +140 -81
- 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/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/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/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/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/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/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/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/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/screens/AccountCenterScreen.tsx +34 -136
- package/src/ui/screens/AccountOverviewScreen.tsx +63 -98
- package/src/ui/screens/AccountSettingsScreen.tsx +21 -7
- package/src/ui/screens/AccountSwitcherScreen.tsx +135 -87
- package/src/ui/screens/AccountVerificationScreen.tsx +24 -16
- 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
|
@@ -7,7 +7,6 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _sonner = require("../../lib/sonner");
|
|
10
|
-
var _confirmAction = require("../utils/confirmAction.js");
|
|
11
10
|
var _index = require("../components/index.js");
|
|
12
11
|
var _useI18n = require("../hooks/useI18n.js");
|
|
13
12
|
var _theme = require("@oxyhq/bloom/theme");
|
|
@@ -15,6 +14,8 @@ var _useColorScheme = require("../hooks/useColorScheme.js");
|
|
|
15
14
|
var _theme2 = require("../constants/theme.js");
|
|
16
15
|
var _themeUtils = require("../utils/themeUtils.js");
|
|
17
16
|
var _OxyContext = require("../context/OxyContext.js");
|
|
17
|
+
var _prompt = _interopRequireWildcard(require("@oxyhq/bloom/prompt"));
|
|
18
|
+
var Prompt = _prompt;
|
|
18
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
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); }
|
|
20
21
|
const HistoryViewScreen = ({
|
|
@@ -22,7 +23,6 @@ const HistoryViewScreen = ({
|
|
|
22
23
|
theme,
|
|
23
24
|
goBack
|
|
24
25
|
}) => {
|
|
25
|
-
// Use useOxy() hook for OxyContext values
|
|
26
26
|
const {
|
|
27
27
|
user
|
|
28
28
|
} = (0, _OxyContext.useOxy)();
|
|
@@ -36,128 +36,93 @@ const HistoryViewScreen = ({
|
|
|
36
36
|
const [history, setHistory] = (0, _react.useState)([]);
|
|
37
37
|
const [isLoading, setIsLoading] = (0, _react.useState)(true);
|
|
38
38
|
const [isDeleting, setIsDeleting] = (0, _react.useState)(false);
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
const deleteLast15Prompt = (0, _prompt.usePromptControl)();
|
|
40
|
+
const clearAllPrompt = (0, _prompt.usePromptControl)();
|
|
41
41
|
const getStorage = async () => {
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
42
|
+
const isRN = typeof navigator !== 'undefined' && navigator.product === 'ReactNative';
|
|
43
|
+
if (isRN) {
|
|
44
44
|
try {
|
|
45
|
-
const
|
|
46
|
-
const
|
|
45
|
+
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require('@react-native-async-storage/async-storage')));
|
|
46
|
+
const s = mod.default;
|
|
47
47
|
return {
|
|
48
|
-
getItem:
|
|
49
|
-
setItem:
|
|
50
|
-
removeItem:
|
|
48
|
+
getItem: s.getItem.bind(s),
|
|
49
|
+
setItem: s.setItem.bind(s),
|
|
50
|
+
removeItem: s.removeItem.bind(s)
|
|
51
51
|
};
|
|
52
|
-
} catch (
|
|
53
|
-
if (__DEV__)
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
throw new Error('AsyncStorage is required in React Native environment');
|
|
52
|
+
} catch (e) {
|
|
53
|
+
if (__DEV__) console.error('AsyncStorage not available:', e);
|
|
54
|
+
throw new Error('AsyncStorage required');
|
|
57
55
|
}
|
|
58
|
-
} else {
|
|
59
|
-
// Use localStorage for web
|
|
60
|
-
return {
|
|
61
|
-
getItem: async key => {
|
|
62
|
-
if (typeof window !== 'undefined' && window.localStorage) {
|
|
63
|
-
return window.localStorage.getItem(key);
|
|
64
|
-
}
|
|
65
|
-
return null;
|
|
66
|
-
},
|
|
67
|
-
setItem: async (key, value) => {
|
|
68
|
-
if (typeof window !== 'undefined' && window.localStorage) {
|
|
69
|
-
window.localStorage.setItem(key, value);
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
removeItem: async key => {
|
|
73
|
-
if (typeof window !== 'undefined' && window.localStorage) {
|
|
74
|
-
window.localStorage.removeItem(key);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
56
|
}
|
|
57
|
+
return {
|
|
58
|
+
getItem: async k => typeof window !== 'undefined' && window.localStorage ? window.localStorage.getItem(k) : null,
|
|
59
|
+
setItem: async (k, v) => {
|
|
60
|
+
if (typeof window !== 'undefined' && window.localStorage) window.localStorage.setItem(k, v);
|
|
61
|
+
},
|
|
62
|
+
removeItem: async k => {
|
|
63
|
+
if (typeof window !== 'undefined' && window.localStorage) window.localStorage.removeItem(k);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
79
66
|
};
|
|
80
|
-
|
|
81
|
-
// TODO: Integrate with backend API for history storage
|
|
82
|
-
// Currently uses local storage only. Should fetch from backend API and sync across devices.
|
|
83
|
-
// Load history from storage
|
|
84
67
|
_react.default.useEffect(() => {
|
|
85
|
-
const
|
|
68
|
+
const load = async () => {
|
|
86
69
|
try {
|
|
87
70
|
setIsLoading(true);
|
|
88
71
|
const storage = await getStorage();
|
|
89
|
-
const
|
|
90
|
-
const stored = await storage.getItem(historyKey);
|
|
72
|
+
const stored = await storage.getItem(`history_${user?.id || 'guest'}`);
|
|
91
73
|
if (stored) {
|
|
92
74
|
const parsed = JSON.parse(stored);
|
|
93
|
-
setHistory(parsed.map(
|
|
94
|
-
...
|
|
95
|
-
timestamp: new Date(
|
|
75
|
+
setHistory(parsed.map(i => ({
|
|
76
|
+
...i,
|
|
77
|
+
timestamp: new Date(i.timestamp)
|
|
96
78
|
})));
|
|
97
|
-
} else
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
} catch (error) {
|
|
79
|
+
} else setHistory([]);
|
|
80
|
+
} catch {
|
|
101
81
|
setHistory([]);
|
|
102
82
|
} finally {
|
|
103
83
|
setIsLoading(false);
|
|
104
84
|
}
|
|
105
85
|
};
|
|
106
|
-
|
|
86
|
+
load();
|
|
107
87
|
}, [user?.id]);
|
|
108
88
|
const handleDeleteLast15Minutes = (0, _react.useCallback)(async () => {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
console.error('Failed to delete history:', error);
|
|
124
|
-
}
|
|
125
|
-
_sonner.toast.error(t('history.deleteLast15Minutes.error') || 'Failed to delete history');
|
|
126
|
-
} finally {
|
|
127
|
-
setIsDeleting(false);
|
|
128
|
-
}
|
|
129
|
-
});
|
|
89
|
+
try {
|
|
90
|
+
setIsDeleting(true);
|
|
91
|
+
const cutoff = new Date(Date.now() - 15 * 60 * 1000);
|
|
92
|
+
const filtered = history.filter(item => item.timestamp < cutoff);
|
|
93
|
+
setHistory(filtered);
|
|
94
|
+
const storage = await getStorage();
|
|
95
|
+
await storage.setItem(`history_${user?.id || 'guest'}`, JSON.stringify(filtered));
|
|
96
|
+
_sonner.toast.success(t('history.deleteLast15Minutes.success') || 'Last 15 minutes deleted');
|
|
97
|
+
} catch (e) {
|
|
98
|
+
if (__DEV__) console.error('Failed to delete history:', e);
|
|
99
|
+
_sonner.toast.error(t('history.deleteLast15Minutes.error') || 'Failed to delete history');
|
|
100
|
+
} finally {
|
|
101
|
+
setIsDeleting(false);
|
|
102
|
+
}
|
|
130
103
|
}, [history, user?.id, t]);
|
|
131
104
|
const handleClearAll = (0, _react.useCallback)(async () => {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
console.error('Failed to clear history:', error);
|
|
145
|
-
}
|
|
146
|
-
_sonner.toast.error(t('history.clearAll.error') || 'Failed to clear history');
|
|
147
|
-
} finally {
|
|
148
|
-
setIsDeleting(false);
|
|
149
|
-
}
|
|
150
|
-
});
|
|
105
|
+
try {
|
|
106
|
+
setIsDeleting(true);
|
|
107
|
+
setHistory([]);
|
|
108
|
+
const storage = await getStorage();
|
|
109
|
+
await storage.removeItem(`history_${user?.id || 'guest'}`);
|
|
110
|
+
_sonner.toast.success(t('history.clearAll.success') || 'History cleared');
|
|
111
|
+
} catch (e) {
|
|
112
|
+
if (__DEV__) console.error('Failed to clear history:', e);
|
|
113
|
+
_sonner.toast.error(t('history.clearAll.error') || 'Failed to clear history');
|
|
114
|
+
} finally {
|
|
115
|
+
setIsDeleting(false);
|
|
116
|
+
}
|
|
151
117
|
}, [user?.id, t]);
|
|
152
118
|
const formatTime = date => {
|
|
153
|
-
const
|
|
154
|
-
const
|
|
155
|
-
const
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
if (
|
|
159
|
-
if (
|
|
160
|
-
if (hours < 24) return `${hours} ${t('history.hoursAgo') || 'hours ago'}`;
|
|
119
|
+
const diff = new Date().getTime() - date.getTime();
|
|
120
|
+
const min = Math.floor(diff / 60000);
|
|
121
|
+
const hrs = Math.floor(min / 60);
|
|
122
|
+
const days = Math.floor(hrs / 24);
|
|
123
|
+
if (min < 1) return t('history.justNow') || 'Just now';
|
|
124
|
+
if (min < 60) return `${min} ${t('history.minutesAgo') || 'minutes ago'}`;
|
|
125
|
+
if (hrs < 24) return `${hrs} ${t('history.hoursAgo') || 'hours ago'}`;
|
|
161
126
|
if (days < 7) return `${days} ${t('history.daysAgo') || 'days ago'}`;
|
|
162
127
|
return date.toLocaleDateString();
|
|
163
128
|
};
|
|
@@ -182,7 +147,7 @@ const HistoryViewScreen = ({
|
|
|
182
147
|
iconColor: themeColors.iconStorage,
|
|
183
148
|
title: t('history.deleteLast15Minutes.title') || 'Delete Last 15 Minutes',
|
|
184
149
|
subtitle: t('history.deleteLast15Minutes.subtitle') || 'Remove recent history entries',
|
|
185
|
-
onPress:
|
|
150
|
+
onPress: () => deleteLast15Prompt.open(),
|
|
186
151
|
disabled: isDeleting || history.length === 0
|
|
187
152
|
}, {
|
|
188
153
|
id: 'clear-all',
|
|
@@ -190,7 +155,7 @@ const HistoryViewScreen = ({
|
|
|
190
155
|
iconColor: themeColors.iconSharing,
|
|
191
156
|
title: t('history.clearAll.title') || 'Clear All History',
|
|
192
157
|
subtitle: t('history.clearAll.subtitle') || 'Remove all history entries',
|
|
193
|
-
onPress:
|
|
158
|
+
onPress: () => clearAllPrompt.open(),
|
|
194
159
|
disabled: isDeleting || history.length === 0
|
|
195
160
|
}]
|
|
196
161
|
})
|
|
@@ -212,6 +177,20 @@ const HistoryViewScreen = ({
|
|
|
212
177
|
}))
|
|
213
178
|
})
|
|
214
179
|
})]
|
|
180
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Prompt.Basic, {
|
|
181
|
+
control: deleteLast15Prompt,
|
|
182
|
+
title: t('history.deleteLast15Minutes.title') || 'Delete Last 15 Minutes',
|
|
183
|
+
description: t('history.deleteLast15Minutes.confirm') || 'Delete last 15 minutes of history?',
|
|
184
|
+
onConfirm: handleDeleteLast15Minutes,
|
|
185
|
+
confirmButtonCta: t('common.actions.delete') || 'Delete',
|
|
186
|
+
confirmButtonColor: "negative"
|
|
187
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Prompt.Basic, {
|
|
188
|
+
control: clearAllPrompt,
|
|
189
|
+
title: t('history.clearAll.title') || 'Clear All History',
|
|
190
|
+
description: t('history.clearAll.confirm') || 'Clear all history? This cannot be undone.',
|
|
191
|
+
onConfirm: handleClearAll,
|
|
192
|
+
confirmButtonCta: t('history.clearAll.title') || 'Clear All',
|
|
193
|
+
confirmButtonColor: "negative"
|
|
215
194
|
})]
|
|
216
195
|
});
|
|
217
196
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_sonner","_confirmAction","_index","_useI18n","_theme","_useColorScheme","_theme2","_themeUtils","_OxyContext","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","HistoryViewScreen","onClose","theme","goBack","user","useOxy","useI18n","bloomTheme","useTheme","colorScheme","useColorScheme","normalizedColorScheme","normalizeColorScheme","themeColors","Colors","history","setHistory","useState","isLoading","setIsLoading","isDeleting","setIsDeleting","getStorage","isReactNative","navigator","product","asyncStorageModule","Promise","resolve","then","storage","getItem","bind","setItem","removeItem","error","__DEV__","console","Error","key","window","localStorage","value","React","useEffect","loadHistory","historyKey","id","stored","parsed","JSON","parse","map","item","timestamp","Date","handleDeleteLast15Minutes","useCallback","confirmAction","fifteenMinutesAgo","now","filtered","filter","stringify","toast","success","handleClearAll","formatTime","date","diff","getTime","minutes","Math","floor","hours","days","toLocaleDateString","jsxs","View","style","styles","container","backgroundColor","colors","background","children","jsx","Header","title","onBack","variant","elevation","ScrollView","content","Section","isFirst","GroupedSection","items","icon","iconColor","iconStorage","subtitle","onPress","disabled","length","iconSharing","LoadingState","message","color","text","EmptyState","textColor","type","iconSecurity","iconPersonalInfo","query","StyleSheet","create","flex","padding","_default","exports","memo"],"sourceRoot":"../../../../src","sources":["ui/screens/HistoryViewScreen.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAMA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,eAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,WAAA,GAAAV,OAAA;AAA+C,IAAAW,WAAA,GAAAX,OAAA;AAAA,SAAAD,wBAAAa,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAf,uBAAA,YAAAA,CAAAa,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA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CAAC,CAAC;QAAE,CACP;MACJ,CACI,CAAC;IAAA,CACF,CAAC;EAAA,CACX,CAAC;AAEf,CAAC;AAED,MAAM0B,MAAM,GAAGoC,uBAAU,CAACC,MAAM,CAAC;EAC7BpC,SAAS,EAAE;IACPqC,IAAI,EAAE;EACV,CAAC;EACDzB,OAAO,EAAE;IACLyB,IAAI,EAAE,CAAC;IACPC,OAAO,EAAE;EACb;AACJ,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAlI,OAAA,gBAEYoD,cAAK,CAAC+E,IAAI,CAAC1H,iBAAiB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_sonner","_index","_useI18n","_theme","_useColorScheme","_theme2","_themeUtils","_OxyContext","_prompt","Prompt","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","HistoryViewScreen","onClose","theme","goBack","user","useOxy","useI18n","bloomTheme","useTheme","colorScheme","useColorScheme","normalizedColorScheme","normalizeColorScheme","themeColors","Colors","history","setHistory","useState","isLoading","setIsLoading","isDeleting","setIsDeleting","deleteLast15Prompt","usePromptControl","clearAllPrompt","getStorage","isRN","navigator","product","mod","Promise","resolve","then","s","getItem","bind","setItem","removeItem","__DEV__","console","error","Error","k","window","localStorage","v","React","useEffect","load","storage","stored","id","parsed","JSON","parse","map","timestamp","Date","handleDeleteLast15Minutes","useCallback","cutoff","now","filtered","filter","item","stringify","toast","success","handleClearAll","formatTime","date","diff","getTime","min","Math","floor","hrs","days","toLocaleDateString","jsxs","View","style","styles","container","backgroundColor","colors","background","children","jsx","Header","title","onBack","variant","elevation","ScrollView","content","Section","isFirst","GroupedSection","items","icon","iconColor","iconStorage","subtitle","onPress","open","disabled","length","iconSharing","LoadingState","message","color","text","EmptyState","textColor","type","iconSecurity","iconPersonalInfo","query","Basic","control","description","onConfirm","confirmButtonCta","confir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EAAC;IAAU,CAAE,CAAC,eACrV,IAAAhJ,WAAA,CAAA4G,GAAA,EAAC7G,MAAM,CAAC4I,KAAK;MAACC,OAAO,EAAEhG,cAAe;MAACkE,KAAK,EAAE5G,CAAC,CAAC,wBAAwB,CAAC,IAAI,mBAAoB;MAAC2I,WAAW,EAAE3I,CAAC,CAAC,0BAA0B,CAAC,IAAI,2CAA4C;MAAC4I,SAAS,EAAEtD,cAAe;MAACuD,gBAAgB,EAAE7I,CAAC,CAAC,wBAAwB,CAAC,IAAI,WAAY;MAAC8I,kBAAkB,EAAC;IAAU,CAAE,CAAC;EAAA,CACpT,CAAC;AAEf,CAAC;AAED,MAAM1C,MAAM,GAAG2C,uBAAU,CAACC,MAAM,CAAC;EAAE3C,SAAS,EAAE;IAAE4C,IAAI,EAAE;EAAE,CAAC;EAAEhC,OAAO,EAAE;IAAEgC,IAAI,EAAE,CAAC;IAAEC,OAAO,EAAE;EAAG;AAAE,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA3I,OAAA,gBAEjFuD,cAAK,CAACqF,IAAI,CAACnI,iBAAiB,CAAC","ignoreList":[]}
|
|
@@ -8,12 +8,14 @@ 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 _vectorIcons = require("@expo/vector-icons");
|
|
13
14
|
var _useI18n = require("../hooks/useI18n.js");
|
|
14
15
|
var _theme = require("@oxyhq/bloom/theme");
|
|
15
16
|
var _OxyContext = require("../context/OxyContext.js");
|
|
16
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
+
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); }
|
|
17
19
|
const PremiumSubscriptionScreen = ({
|
|
18
20
|
onClose,
|
|
19
21
|
theme,
|
|
@@ -34,11 +36,16 @@ const PremiumSubscriptionScreen = ({
|
|
|
34
36
|
const [billingInterval, setBillingInterval] = (0, _react.useState)('month');
|
|
35
37
|
const [activeTab, setActiveTab] = (0, _react.useState)('plans');
|
|
36
38
|
const [currentAppPackage, setCurrentAppPackage] = (0, _react.useState)('mention'); // Default to mention for demo
|
|
37
|
-
|
|
39
|
+
const [pendingUnsubscribeFeatureId, setPendingUnsubscribeFeatureId] = (0, _react.useState)(null);
|
|
38
40
|
const {
|
|
39
41
|
t
|
|
40
42
|
} = (0, _useI18n.useI18n)();
|
|
41
43
|
const bloomTheme = (0, _theme.useTheme)();
|
|
44
|
+
|
|
45
|
+
// Prompt controls
|
|
46
|
+
const cancelSubscriptionPrompt = (0, _prompt.usePromptControl)();
|
|
47
|
+
const unsubscribeFeaturePrompt = (0, _prompt.usePromptControl)();
|
|
48
|
+
|
|
42
49
|
// Extract commonly used colors for readability
|
|
43
50
|
const textColor = bloomTheme.colors.text;
|
|
44
51
|
const backgroundColor = bloomTheme.colors.background;
|
|
@@ -221,46 +228,14 @@ const PremiumSubscriptionScreen = ({
|
|
|
221
228
|
}
|
|
222
229
|
}, [currentAppPackage, user?.isPremium]);
|
|
223
230
|
const detectCurrentApp = () => {
|
|
224
|
-
|
|
225
|
-
// For now, we'll use a mock detection based on available methods
|
|
226
|
-
|
|
227
|
-
// Real app detection methods you could use:
|
|
228
|
-
// 1. Check bundle identifier in React Native:
|
|
229
|
-
// import DeviceInfo from 'react-native-device-info';
|
|
230
|
-
// const bundleId = DeviceInfo.getBundleId();
|
|
231
|
-
// Example: com.oxy.mention -> 'mention'
|
|
232
|
-
|
|
233
|
-
// 2. Environment variables or build configuration
|
|
234
|
-
// const appPackage = __DEV__ ? process.env.APP_PACKAGE : 'mention';
|
|
235
|
-
|
|
236
|
-
// 3. Check specific app capabilities or modules
|
|
237
|
-
// if (typeof MentionModule !== 'undefined') return 'mention';
|
|
238
|
-
// if (typeof OxyWorkspaceModule !== 'undefined') return 'oxy-workspace';
|
|
239
|
-
|
|
240
|
-
// 4. Use build-time configuration with Metro or similar
|
|
241
|
-
// const appPackage = require('../config/app.json').packageName;
|
|
242
|
-
|
|
243
|
-
// For demo purposes, we'll simulate different apps
|
|
244
|
-
// You would replace this with actual app detection logic
|
|
245
|
-
|
|
246
|
-
// IMPORTANT: This ensures subscription restrictions work properly:
|
|
247
|
-
// - Mention+ plan can only be subscribed to when app package == 'mention'
|
|
248
|
-
// - Other app-specific plans follow the same pattern
|
|
249
|
-
// - Ecosystem plans work across all apps
|
|
250
|
-
|
|
251
|
-
const detectedApp = 'mention'; // This would be dynamic in real implementation
|
|
252
|
-
|
|
231
|
+
const detectedApp = 'mention';
|
|
253
232
|
setCurrentAppPackage(detectedApp);
|
|
254
233
|
};
|
|
255
234
|
const loadSubscriptionData = async () => {
|
|
256
235
|
try {
|
|
257
236
|
setLoading(true);
|
|
258
|
-
|
|
259
|
-
// Filter plans available for current app
|
|
260
237
|
const availablePlans = mockPlans.filter(plan => plan.applicableApps.includes(currentAppPackage));
|
|
261
238
|
setPlans(availablePlans);
|
|
262
|
-
|
|
263
|
-
// Mock current subscription
|
|
264
239
|
let currentSubscription = null;
|
|
265
240
|
if (user?.isPremium) {
|
|
266
241
|
currentSubscription = {
|
|
@@ -273,15 +248,13 @@ const PremiumSubscriptionScreen = ({
|
|
|
273
248
|
};
|
|
274
249
|
setSubscription(currentSubscription);
|
|
275
250
|
}
|
|
276
|
-
|
|
277
|
-
// Filter features available for current app and update based on current subscription
|
|
278
251
|
const availableFeatures = mockIndividualFeatures.filter(feature => feature.applicableApps.includes(currentAppPackage));
|
|
279
252
|
const updatedFeatures = availableFeatures.map(feature => {
|
|
280
253
|
const isIncludedInCurrentPlan = !!(currentSubscription && feature.includedInPlans.includes(currentSubscription.planId));
|
|
281
254
|
return {
|
|
282
255
|
...feature,
|
|
283
256
|
isIncludedInCurrentPlan,
|
|
284
|
-
isSubscribed: !!isIncludedInCurrentPlan
|
|
257
|
+
isSubscribed: !!isIncludedInCurrentPlan
|
|
285
258
|
};
|
|
286
259
|
});
|
|
287
260
|
setIndividualFeatures(updatedFeatures);
|
|
@@ -299,7 +272,6 @@ const PremiumSubscriptionScreen = ({
|
|
|
299
272
|
};
|
|
300
273
|
const handleSubscribe = async planId => {
|
|
301
274
|
try {
|
|
302
|
-
// Check if plan is available for current app
|
|
303
275
|
const selectedPlan = mockPlans.find(plan => plan.id === planId);
|
|
304
276
|
if (!selectedPlan?.applicableApps.includes(currentAppPackage)) {
|
|
305
277
|
_sonner.toast.error(t('premium.toasts.planUnavailable', {
|
|
@@ -307,19 +279,13 @@ const PremiumSubscriptionScreen = ({
|
|
|
307
279
|
}) || `This plan is not available for the current app (${currentAppPackage})`);
|
|
308
280
|
return;
|
|
309
281
|
}
|
|
310
|
-
|
|
311
|
-
// Special restriction for Mention+ plan - only available in mention app
|
|
312
282
|
if (planId === 'mention-plus' && currentAppPackage !== 'mention') {
|
|
313
283
|
_sonner.toast.error(t('premium.toasts.mentionOnly') || 'Mention+ is only available in the Mention app');
|
|
314
284
|
return;
|
|
315
285
|
}
|
|
316
286
|
setProcessingPayment(true);
|
|
317
|
-
|
|
318
|
-
// Mock payment processing
|
|
319
287
|
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
320
288
|
_sonner.toast.success(t('premium.toasts.activated') || 'Subscription activated successfully!');
|
|
321
|
-
|
|
322
|
-
// Mock subscription update
|
|
323
289
|
setSubscription({
|
|
324
290
|
id: `sub_${Date.now()}`,
|
|
325
291
|
planId,
|
|
@@ -328,8 +294,6 @@ const PremiumSubscriptionScreen = ({
|
|
|
328
294
|
currentPeriodEnd: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000).toISOString(),
|
|
329
295
|
cancelAtPeriodEnd: false
|
|
330
296
|
});
|
|
331
|
-
|
|
332
|
-
// Reload data to update feature states
|
|
333
297
|
loadSubscriptionData();
|
|
334
298
|
} catch (error) {
|
|
335
299
|
if (__DEV__) {
|
|
@@ -340,20 +304,20 @@ const PremiumSubscriptionScreen = ({
|
|
|
340
304
|
setProcessingPayment(false);
|
|
341
305
|
}
|
|
342
306
|
};
|
|
343
|
-
const
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
}
|
|
356
|
-
};
|
|
307
|
+
const confirmCancelSubscription = (0, _react.useCallback)(() => {
|
|
308
|
+
cancelSubscriptionPrompt.open();
|
|
309
|
+
}, [cancelSubscriptionPrompt]);
|
|
310
|
+
const handleCancelSubscription = (0, _react.useCallback)(async () => {
|
|
311
|
+
try {
|
|
312
|
+
setSubscription(prev => prev ? {
|
|
313
|
+
...prev,
|
|
314
|
+
cancelAtPeriodEnd: true
|
|
315
|
+
} : null);
|
|
316
|
+
_sonner.toast.success(t('premium.toasts.willCancel') || 'Subscription will be canceled at the end of the billing period');
|
|
317
|
+
} catch (error) {
|
|
318
|
+
_sonner.toast.error(t('premium.toasts.cancelFailed') || 'Failed to cancel subscription');
|
|
319
|
+
}
|
|
320
|
+
}, [t]);
|
|
357
321
|
const handleReactivateSubscription = async () => {
|
|
358
322
|
try {
|
|
359
323
|
setSubscription(prev => prev ? {
|
|
@@ -366,7 +330,7 @@ const PremiumSubscriptionScreen = ({
|
|
|
366
330
|
}
|
|
367
331
|
};
|
|
368
332
|
const formatPrice = (price, currency, interval) => {
|
|
369
|
-
const yearlyPrice = interval === 'year' ? price : price * 12 * 0.8;
|
|
333
|
+
const yearlyPrice = interval === 'year' ? price : price * 12 * 0.8;
|
|
370
334
|
const displayPrice = billingInterval === 'year' ? yearlyPrice : price;
|
|
371
335
|
return {
|
|
372
336
|
price: displayPrice,
|
|
@@ -380,16 +344,12 @@ const PremiumSubscriptionScreen = ({
|
|
|
380
344
|
};
|
|
381
345
|
const handleFeatureSubscribe = async featureId => {
|
|
382
346
|
try {
|
|
383
|
-
// Check if feature is available for current app
|
|
384
347
|
const selectedFeature = mockIndividualFeatures.find(feature => feature.id === featureId);
|
|
385
348
|
if (!selectedFeature?.applicableApps.includes(currentAppPackage)) {
|
|
386
349
|
_sonner.toast.error(`This feature is not available for the current app (${currentAppPackage})`);
|
|
387
350
|
return;
|
|
388
351
|
}
|
|
389
|
-
|
|
390
|
-
// Special restrictions for app-specific features
|
|
391
352
|
if (selectedFeature.appScope === 'specific') {
|
|
392
|
-
// For features that are only available in specific apps, enforce strict matching
|
|
393
353
|
const hasExactMatch = selectedFeature.applicableApps.length === 1 && selectedFeature.applicableApps[0] === currentAppPackage;
|
|
394
354
|
if (!hasExactMatch && selectedFeature.applicableApps.length === 1) {
|
|
395
355
|
const requiredApp = selectedFeature.applicableApps[0];
|
|
@@ -398,8 +358,6 @@ const PremiumSubscriptionScreen = ({
|
|
|
398
358
|
}
|
|
399
359
|
}
|
|
400
360
|
setProcessingPayment(true);
|
|
401
|
-
|
|
402
|
-
// Mock feature subscription
|
|
403
361
|
await new Promise(resolve => setTimeout(resolve, 1500));
|
|
404
362
|
setIndividualFeatures(prev => prev.map(feature => feature.id === featureId ? {
|
|
405
363
|
...feature,
|
|
@@ -418,24 +376,28 @@ const PremiumSubscriptionScreen = ({
|
|
|
418
376
|
setProcessingPayment(false);
|
|
419
377
|
}
|
|
420
378
|
};
|
|
421
|
-
const
|
|
422
|
-
|
|
423
|
-
(
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
379
|
+
const confirmFeatureUnsubscribe = (0, _react.useCallback)(featureId => {
|
|
380
|
+
setPendingUnsubscribeFeatureId(featureId);
|
|
381
|
+
unsubscribeFeaturePrompt.open();
|
|
382
|
+
}, [unsubscribeFeaturePrompt]);
|
|
383
|
+
const handleFeatureUnsubscribe = (0, _react.useCallback)(async () => {
|
|
384
|
+
if (!pendingUnsubscribeFeatureId) return;
|
|
385
|
+
const feature = individualFeatures.find(f => f.id === pendingUnsubscribeFeatureId);
|
|
386
|
+
try {
|
|
387
|
+
setIndividualFeatures(prev => prev.map(f => f.id === pendingUnsubscribeFeatureId ? {
|
|
388
|
+
...f,
|
|
389
|
+
isSubscribed: false
|
|
390
|
+
} : f));
|
|
391
|
+
_sonner.toast.success(t('premium.toasts.featureUnsubscribed', {
|
|
392
|
+
name: feature?.name ?? ''
|
|
393
|
+
}) ?? `Unsubscribed from ${feature?.name}`);
|
|
394
|
+
} catch (error) {
|
|
395
|
+
_sonner.toast.error(t('premium.toasts.featureUnsubscribeFailed') || 'Failed to unsubscribe from feature');
|
|
396
|
+
} finally {
|
|
397
|
+
setPendingUnsubscribeFeatureId(null);
|
|
398
|
+
}
|
|
399
|
+
}, [pendingUnsubscribeFeatureId, individualFeatures, t]);
|
|
400
|
+
const pendingUnsubscribeFeature = (0, _react.useMemo)(() => individualFeatures.find(f => f.id === pendingUnsubscribeFeatureId), [individualFeatures, pendingUnsubscribeFeatureId]);
|
|
439
401
|
const renderHeader = () => {
|
|
440
402
|
const getAppDisplayName = packageName => {
|
|
441
403
|
const appNames = {
|
|
@@ -562,7 +524,7 @@ const PremiumSubscriptionScreen = ({
|
|
|
562
524
|
style: [styles.actionButton, {
|
|
563
525
|
backgroundColor: dangerColor
|
|
564
526
|
}],
|
|
565
|
-
onPress:
|
|
527
|
+
onPress: confirmCancelSubscription,
|
|
566
528
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
567
529
|
style: styles.actionButtonText,
|
|
568
530
|
children: t('premium.actions.cancelSubBtn') || 'Cancel Subscription'
|
|
@@ -942,7 +904,7 @@ const PremiumSubscriptionScreen = ({
|
|
|
942
904
|
style: [styles.unsubscribeButton, {
|
|
943
905
|
borderColor: dangerColor
|
|
944
906
|
}],
|
|
945
|
-
onPress: () =>
|
|
907
|
+
onPress: () => confirmFeatureUnsubscribe(feature.id),
|
|
946
908
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
947
909
|
style: [styles.unsubscribeText, {
|
|
948
910
|
color: dangerColor
|
|
@@ -1168,6 +1130,22 @@ const PremiumSubscriptionScreen = ({
|
|
|
1168
1130
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
1169
1131
|
style: styles.bottomSpacing
|
|
1170
1132
|
})]
|
|
1133
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Prompt.Basic, {
|
|
1134
|
+
control: cancelSubscriptionPrompt,
|
|
1135
|
+
title: t('premium.confirms.cancelSubTitle') || 'Cancel Subscription',
|
|
1136
|
+
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.',
|
|
1137
|
+
onConfirm: handleCancelSubscription,
|
|
1138
|
+
confirmButtonCta: t('premium.actions.cancelSubBtn') || 'Cancel Subscription',
|
|
1139
|
+
confirmButtonColor: "negative"
|
|
1140
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Prompt.Basic, {
|
|
1141
|
+
control: unsubscribeFeaturePrompt,
|
|
1142
|
+
title: t('premium.confirms.unsubscribeFeatureTitle') || 'Unsubscribe from Feature',
|
|
1143
|
+
description: pendingUnsubscribeFeature ? t('premium.confirms.unsubscribeFeature', {
|
|
1144
|
+
name: pendingUnsubscribeFeature.name
|
|
1145
|
+
}) ?? `Are you sure you want to unsubscribe from ${pendingUnsubscribeFeature.name}?` : '',
|
|
1146
|
+
onConfirm: handleFeatureUnsubscribe,
|
|
1147
|
+
confirmButtonCta: t('premium.actions.unsubscribe') || 'Unsubscribe',
|
|
1148
|
+
confirmButtonColor: "negative"
|
|
1171
1149
|
})]
|
|
1172
1150
|
});
|
|
1173
1151
|
};
|
|
@@ -1419,7 +1397,6 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
1419
1397
|
bottomSpacing: {
|
|
1420
1398
|
height: 40
|
|
1421
1399
|
},
|
|
1422
|
-
// Tab Navigation Styles
|
|
1423
1400
|
tabContainer: {
|
|
1424
1401
|
flexDirection: 'row',
|
|
1425
1402
|
borderBottomWidth: 1,
|
|
@@ -1435,7 +1412,6 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
1435
1412
|
fontSize: 16,
|
|
1436
1413
|
fontWeight: '600'
|
|
1437
1414
|
},
|
|
1438
|
-
// Individual Feature Styles
|
|
1439
1415
|
featureCard: {
|
|
1440
1416
|
borderRadius: 12,
|
|
1441
1417
|
borderWidth: 1,
|
|
@@ -1529,7 +1505,6 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
1529
1505
|
fontWeight: '600',
|
|
1530
1506
|
marginBottom: 12
|
|
1531
1507
|
},
|
|
1532
|
-
// New styles for enhanced feature cards
|
|
1533
1508
|
featureNameRow: {
|
|
1534
1509
|
flexDirection: 'row',
|
|
1535
1510
|
alignItems: 'center',
|
|
@@ -1577,7 +1552,6 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
1577
1552
|
fontWeight: '500',
|
|
1578
1553
|
textAlign: 'center'
|
|
1579
1554
|
},
|
|
1580
|
-
// App-specific plan styles
|
|
1581
1555
|
appSpecificBadge: {
|
|
1582
1556
|
position: 'absolute',
|
|
1583
1557
|
top: 16,
|
|
@@ -1607,7 +1581,6 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
1607
1581
|
fontSize: 16,
|
|
1608
1582
|
fontWeight: '600'
|
|
1609
1583
|
},
|
|
1610
|
-
// App switcher styles (for development/testing)
|
|
1611
1584
|
appSwitcher: {
|
|
1612
1585
|
padding: 16,
|
|
1613
1586
|
borderBottomWidth: 1,
|