@oxyhq/services 5.10.4 → 5.10.5
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/README.md +62 -14
- package/lib/commonjs/core/OxyServices.js +796 -4
- package/lib/commonjs/core/OxyServices.js.map +1 -1
- package/lib/commonjs/core/index.js +8 -83
- package/lib/commonjs/core/index.js.map +1 -1
- package/lib/commonjs/ui/screens/FileManagementScreen.js +12 -12
- package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ProfileScreen.js +2 -2
- package/lib/commonjs/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SignInScreen.js +1 -1
- package/lib/commonjs/ui/screens/SignInScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaLeaderboardScreen.js +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaLeaderboardScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaRulesScreen.js +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaRulesScreen.js.map +1 -1
- package/lib/commonjs/ui/stores/followStore.js +4 -4
- package/lib/commonjs/ui/stores/followStore.js.map +1 -1
- package/lib/module/core/OxyServices.js +795 -3
- package/lib/module/core/OxyServices.js.map +1 -1
- package/lib/module/core/index.js +9 -24
- package/lib/module/core/index.js.map +1 -1
- package/lib/module/ui/screens/FileManagementScreen.js +12 -12
- package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/ProfileScreen.js +2 -2
- package/lib/module/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/module/ui/screens/SignInScreen.js +1 -1
- package/lib/module/ui/screens/SignInScreen.js.map +1 -1
- package/lib/module/ui/screens/karma/KarmaCenterScreen.js +1 -1
- package/lib/module/ui/screens/karma/KarmaCenterScreen.js.map +1 -1
- package/lib/module/ui/screens/karma/KarmaLeaderboardScreen.js +1 -1
- package/lib/module/ui/screens/karma/KarmaLeaderboardScreen.js.map +1 -1
- package/lib/module/ui/screens/karma/KarmaRulesScreen.js +1 -1
- package/lib/module/ui/screens/karma/KarmaRulesScreen.js.map +1 -1
- package/lib/module/ui/stores/followStore.js +4 -4
- package/lib/module/ui/stores/followStore.js.map +1 -1
- package/lib/typescript/core/OxyServices.d.ts +290 -1
- package/lib/typescript/core/OxyServices.d.ts.map +1 -1
- package/lib/typescript/core/index.d.ts +7 -16
- package/lib/typescript/core/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/core/OxyServices.ts +881 -46
- package/src/core/index.ts +9 -24
- package/src/ui/screens/FileManagementScreen.tsx +12 -12
- package/src/ui/screens/ProfileScreen.tsx +3 -3
- package/src/ui/screens/SignInScreen.tsx +1 -1
- package/src/ui/screens/karma/KarmaCenterScreen.tsx +2 -2
- package/src/ui/screens/karma/KarmaLeaderboardScreen.tsx +1 -1
- package/src/ui/screens/karma/KarmaRulesScreen.tsx +1 -1
- package/src/ui/stores/followStore.ts +4 -4
- package/lib/commonjs/core/OxyServicesMain.js +0 -51
- package/lib/commonjs/core/OxyServicesMain.js.map +0 -1
- package/lib/commonjs/core/analytics/AnalyticsService.js +0 -67
- package/lib/commonjs/core/analytics/AnalyticsService.js.map +0 -1
- package/lib/commonjs/core/auth/AuthService.js +0 -538
- package/lib/commonjs/core/auth/AuthService.js.map +0 -1
- package/lib/commonjs/core/devices/DeviceService.js +0 -61
- package/lib/commonjs/core/devices/DeviceService.js.map +0 -1
- package/lib/commonjs/core/files/FileService.js +0 -180
- package/lib/commonjs/core/files/FileService.js.map +0 -1
- package/lib/commonjs/core/karma/KarmaService.js +0 -100
- package/lib/commonjs/core/karma/KarmaService.js.map +0 -1
- package/lib/commonjs/core/locations/LocationService.js +0 -131
- package/lib/commonjs/core/locations/LocationService.js.map +0 -1
- package/lib/commonjs/core/payments/PaymentService.js +0 -124
- package/lib/commonjs/core/payments/PaymentService.js.map +0 -1
- package/lib/commonjs/core/users/UserService.js +0 -234
- package/lib/commonjs/core/users/UserService.js.map +0 -1
- package/lib/module/core/OxyServicesMain.js +0 -47
- package/lib/module/core/OxyServicesMain.js.map +0 -1
- package/lib/module/core/analytics/AnalyticsService.js +0 -62
- package/lib/module/core/analytics/AnalyticsService.js.map +0 -1
- package/lib/module/core/auth/AuthService.js +0 -533
- package/lib/module/core/auth/AuthService.js.map +0 -1
- package/lib/module/core/devices/DeviceService.js +0 -57
- package/lib/module/core/devices/DeviceService.js.map +0 -1
- package/lib/module/core/files/FileService.js +0 -175
- package/lib/module/core/files/FileService.js.map +0 -1
- package/lib/module/core/karma/KarmaService.js +0 -95
- package/lib/module/core/karma/KarmaService.js.map +0 -1
- package/lib/module/core/locations/LocationService.js +0 -127
- package/lib/module/core/locations/LocationService.js.map +0 -1
- package/lib/module/core/payments/PaymentService.js +0 -119
- package/lib/module/core/payments/PaymentService.js.map +0 -1
- package/lib/module/core/users/UserService.js +0 -230
- package/lib/module/core/users/UserService.js.map +0 -1
- package/lib/typescript/core/OxyServicesMain.d.ts +0 -33
- package/lib/typescript/core/OxyServicesMain.d.ts.map +0 -1
- package/lib/typescript/core/analytics/AnalyticsService.d.ts +0 -26
- package/lib/typescript/core/analytics/AnalyticsService.d.ts.map +0 -1
- package/lib/typescript/core/auth/AuthService.d.ts +0 -165
- package/lib/typescript/core/auth/AuthService.d.ts.map +0 -1
- package/lib/typescript/core/devices/DeviceService.d.ts +0 -20
- package/lib/typescript/core/devices/DeviceService.d.ts.map +0 -1
- package/lib/typescript/core/files/FileService.d.ts +0 -59
- package/lib/typescript/core/files/FileService.d.ts.map +0 -1
- package/lib/typescript/core/karma/KarmaService.d.ts +0 -50
- package/lib/typescript/core/karma/KarmaService.d.ts.map +0 -1
- package/lib/typescript/core/locations/LocationService.d.ts +0 -39
- package/lib/typescript/core/locations/LocationService.d.ts.map +0 -1
- package/lib/typescript/core/payments/PaymentService.d.ts +0 -50
- package/lib/typescript/core/payments/PaymentService.d.ts.map +0 -1
- package/lib/typescript/core/users/UserService.d.ts +0 -111
- package/lib/typescript/core/users/UserService.d.ts.map +0 -1
- package/src/core/OxyServicesMain.ts +0 -57
- package/src/core/analytics/AnalyticsService.ts +0 -64
- package/src/core/auth/AuthService.ts +0 -560
- package/src/core/devices/DeviceService.ts +0 -55
- package/src/core/files/FileService.ts +0 -198
- package/src/core/karma/KarmaService.ts +0 -104
- package/src/core/locations/LocationService.ts +0 -141
- package/src/core/payments/PaymentService.ts +0 -133
- package/src/core/users/UserService.ts +0 -241
package/src/core/index.ts
CHANGED
|
@@ -1,28 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* OxyServices Core Module -
|
|
2
|
+
* OxyServices Core Module - Unified Architecture
|
|
3
3
|
*
|
|
4
|
-
* This module exports the
|
|
5
|
-
*
|
|
4
|
+
* This module exports the unified OxyServices class that provides all API functionality
|
|
5
|
+
* in one simple, easy-to-use interface.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
// Main OxyServices class (
|
|
9
|
-
export {
|
|
10
|
-
|
|
11
|
-
// Individual service classes for focused usage
|
|
12
|
-
export { AuthService } from './auth/AuthService';
|
|
13
|
-
export { UserService } from './users/UserService';
|
|
14
|
-
export { PaymentService } from './payments/PaymentService';
|
|
15
|
-
export { KarmaService } from './karma/KarmaService';
|
|
16
|
-
export { FileService } from './files/FileService';
|
|
17
|
-
export { LocationService } from './locations/LocationService';
|
|
18
|
-
export { AnalyticsService } from './analytics/AnalyticsService';
|
|
19
|
-
export { DeviceService } from './devices/DeviceService';
|
|
20
|
-
|
|
21
|
-
// Base class for custom service extensions
|
|
22
|
-
export { OxyServices as BaseOxyServices } from './OxyServices';
|
|
23
|
-
|
|
24
|
-
// Constants
|
|
25
|
-
export { OXY_CLOUD_URL } from './files/FileService';
|
|
8
|
+
// Main OxyServices class (unified)
|
|
9
|
+
export { OxyServices } from './OxyServices';
|
|
10
|
+
export { OXY_CLOUD_URL } from './OxyServices';
|
|
26
11
|
|
|
27
12
|
// Re-export all models and types for convenience
|
|
28
13
|
export * from '../models/interfaces';
|
|
@@ -32,8 +17,8 @@ export * from '../models/session';
|
|
|
32
17
|
export { DeviceManager } from '../utils/deviceManager';
|
|
33
18
|
export type { DeviceFingerprint, StoredDeviceInfo } from '../utils/deviceManager';
|
|
34
19
|
|
|
35
|
-
// Import
|
|
36
|
-
import {
|
|
20
|
+
// Import for default export
|
|
21
|
+
import { OxyServices } from './OxyServices';
|
|
37
22
|
|
|
38
23
|
// Default export for backward compatibility
|
|
39
|
-
export default
|
|
24
|
+
export default OxyServices;
|
|
@@ -118,7 +118,7 @@ const FileManagementScreen: React.FC<FileManagementScreenProps> = ({
|
|
|
118
118
|
setLoading(true);
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
const response = await oxyServices.
|
|
121
|
+
const response = await oxyServices.listUserFiles(targetUserId);
|
|
122
122
|
setFiles(response.files || []);
|
|
123
123
|
} catch (error: any) {
|
|
124
124
|
console.error('Failed to load files:', error);
|
|
@@ -172,7 +172,7 @@ const FileManagementScreen: React.FC<FileManagementScreenProps> = ({
|
|
|
172
172
|
await Promise.all(
|
|
173
173
|
photosToLoad.map(async (photo) => {
|
|
174
174
|
try {
|
|
175
|
-
const downloadUrl = oxyServices.
|
|
175
|
+
const downloadUrl = oxyServices.getFileDownloadUrl(photo.id);
|
|
176
176
|
|
|
177
177
|
if (Platform.OS === 'web') {
|
|
178
178
|
const img = new (window as any).Image();
|
|
@@ -340,7 +340,7 @@ const FileManagementScreen: React.FC<FileManagementScreenProps> = ({
|
|
|
340
340
|
console.log('Current user ID:', user?.id);
|
|
341
341
|
setDeleting(fileId);
|
|
342
342
|
|
|
343
|
-
const result = await oxyServices.
|
|
343
|
+
const result = await oxyServices.deleteFile(fileId);
|
|
344
344
|
console.log('Delete result:', result);
|
|
345
345
|
|
|
346
346
|
toast.success('File deleted successfully');
|
|
@@ -408,7 +408,7 @@ const FileManagementScreen: React.FC<FileManagementScreenProps> = ({
|
|
|
408
408
|
console.log('Downloading file:', { fileId, filename });
|
|
409
409
|
|
|
410
410
|
// Use the public download URL method
|
|
411
|
-
const downloadUrl = oxyServices.
|
|
411
|
+
const downloadUrl = oxyServices.getFileDownloadUrl(fileId);
|
|
412
412
|
console.log('Download URL:', downloadUrl);
|
|
413
413
|
|
|
414
414
|
try {
|
|
@@ -426,7 +426,7 @@ const FileManagementScreen: React.FC<FileManagementScreenProps> = ({
|
|
|
426
426
|
console.warn('Link download failed, trying fetch method:', linkError);
|
|
427
427
|
|
|
428
428
|
// Method 2: Fallback to authenticated download
|
|
429
|
-
const blob = await oxyServices.
|
|
429
|
+
const blob = await oxyServices.getFileContentAsBlob(fileId);
|
|
430
430
|
const url = window.URL.createObjectURL(blob);
|
|
431
431
|
|
|
432
432
|
const link = document.createElement('a');
|
|
@@ -491,11 +491,11 @@ const FileManagementScreen: React.FC<FileManagementScreenProps> = ({
|
|
|
491
491
|
file.contentType.startsWith('video/') ||
|
|
492
492
|
file.contentType.startsWith('audio/')) {
|
|
493
493
|
// For images, PDFs, videos, and audio, we'll use the URL directly
|
|
494
|
-
const downloadUrl = oxyServices.
|
|
494
|
+
const downloadUrl = oxyServices.getFileDownloadUrl(file.id);
|
|
495
495
|
setFileContent(downloadUrl);
|
|
496
496
|
} else {
|
|
497
497
|
// For text files, get the content using authenticated request
|
|
498
|
-
const content = await oxyServices.
|
|
498
|
+
const content = await oxyServices.getFileContentAsText(file.id);
|
|
499
499
|
setFileContent(content);
|
|
500
500
|
}
|
|
501
501
|
} catch (error: any) {
|
|
@@ -532,7 +532,7 @@ const FileManagementScreen: React.FC<FileManagementScreenProps> = ({
|
|
|
532
532
|
};
|
|
533
533
|
|
|
534
534
|
const renderSimplePhotoItem = useCallback((photo: FileMetadata, index: number) => {
|
|
535
|
-
const downloadUrl = oxyServices.
|
|
535
|
+
const downloadUrl = oxyServices.getFileDownloadUrl(photo.id);
|
|
536
536
|
|
|
537
537
|
// Calculate photo item width based on actual container size from bottom sheet
|
|
538
538
|
let itemsPerRow = 3; // Default for mobile
|
|
@@ -598,7 +598,7 @@ const FileManagementScreen: React.FC<FileManagementScreenProps> = ({
|
|
|
598
598
|
}, [oxyServices, containerWidth]);
|
|
599
599
|
|
|
600
600
|
const renderJustifiedPhotoItem = useCallback((photo: FileMetadata, width: number, height: number, isLast: boolean) => {
|
|
601
|
-
const downloadUrl = oxyServices.
|
|
601
|
+
const downloadUrl = oxyServices.getFileDownloadUrl(photo.id);
|
|
602
602
|
|
|
603
603
|
return (
|
|
604
604
|
<TouchableOpacity
|
|
@@ -689,7 +689,7 @@ const FileManagementScreen: React.FC<FileManagementScreenProps> = ({
|
|
|
689
689
|
{isImage && (
|
|
690
690
|
Platform.OS === 'web' ? (
|
|
691
691
|
<img
|
|
692
|
-
src={oxyServices.
|
|
692
|
+
src={oxyServices.getFileDownloadUrl(file.id)}
|
|
693
693
|
style={{
|
|
694
694
|
width: '100%',
|
|
695
695
|
height: '100%',
|
|
@@ -709,7 +709,7 @@ const FileManagementScreen: React.FC<FileManagementScreenProps> = ({
|
|
|
709
709
|
/>
|
|
710
710
|
) : (
|
|
711
711
|
<Image
|
|
712
|
-
source={{ uri: oxyServices.
|
|
712
|
+
source={{ uri: oxyServices.getFileDownloadUrl(file.id) }}
|
|
713
713
|
style={styles.previewImage}
|
|
714
714
|
resizeMode="cover"
|
|
715
715
|
onError={() => {
|
|
@@ -817,7 +817,7 @@ const FileManagementScreen: React.FC<FileManagementScreenProps> = ({
|
|
|
817
817
|
};
|
|
818
818
|
|
|
819
819
|
const renderPhotoItem = (photo: FileMetadata, index: number) => {
|
|
820
|
-
const downloadUrl = oxyServices.
|
|
820
|
+
const downloadUrl = oxyServices.getFileDownloadUrl(photo.id);
|
|
821
821
|
|
|
822
822
|
// Calculate photo item width based on actual container size from bottom sheet
|
|
823
823
|
let itemsPerRow = 3; // Default for mobile
|
|
@@ -61,7 +61,7 @@ const ProfileScreen: React.FC<ProfileScreenProps> = ({ userId, username, theme,
|
|
|
61
61
|
|
|
62
62
|
// Load user profile and karma total
|
|
63
63
|
Promise.all([
|
|
64
|
-
oxyServices.
|
|
64
|
+
oxyServices.getUserById(userId).catch((err: any) => {
|
|
65
65
|
console.error('getUserById error:', err);
|
|
66
66
|
// If this is the current user and the API call fails, use current user data as fallback
|
|
67
67
|
if (currentUser && currentUser.id === userId) {
|
|
@@ -70,8 +70,8 @@ const ProfileScreen: React.FC<ProfileScreenProps> = ({ userId, username, theme,
|
|
|
70
70
|
}
|
|
71
71
|
throw err;
|
|
72
72
|
}),
|
|
73
|
-
oxyServices.
|
|
74
|
-
oxyServices.
|
|
73
|
+
oxyServices.getUserKarmaTotal ?
|
|
74
|
+
oxyServices.getUserKarmaTotal(userId).catch((err: any) => {
|
|
75
75
|
console.warn('getUserKarmaTotal error:', err);
|
|
76
76
|
return { total: undefined };
|
|
77
77
|
}) :
|
|
@@ -136,7 +136,7 @@ const SignInScreen: React.FC<BaseScreenProps> = ({
|
|
|
136
136
|
|
|
137
137
|
try {
|
|
138
138
|
// First check if username exists by trying to get profile
|
|
139
|
-
const profile = await oxyServices.
|
|
139
|
+
const profile = await oxyServices.getProfileByUsername(usernameToValidate);
|
|
140
140
|
|
|
141
141
|
if (profile) {
|
|
142
142
|
const profileData = {
|
|
@@ -38,8 +38,8 @@ const KarmaCenterScreen: React.FC<BaseScreenProps> = ({
|
|
|
38
38
|
setIsLoading(true);
|
|
39
39
|
setError(null);
|
|
40
40
|
Promise.all([
|
|
41
|
-
oxyServices.
|
|
42
|
-
oxyServices.
|
|
41
|
+
oxyServices.getUserKarmaTotal(user.id),
|
|
42
|
+
oxyServices.getUserKarmaHistory(user.id, 20, 0),
|
|
43
43
|
])
|
|
44
44
|
.then(([totalRes, historyRes]) => {
|
|
45
45
|
setKarmaTotal(totalRes.total);
|
|
@@ -19,7 +19,7 @@ const KarmaLeaderboardScreen: React.FC<BaseScreenProps> = ({ goBack, theme, navi
|
|
|
19
19
|
useEffect(() => {
|
|
20
20
|
setIsLoading(true);
|
|
21
21
|
setError(null);
|
|
22
|
-
oxyServices.
|
|
22
|
+
oxyServices.getKarmaLeaderboard()
|
|
23
23
|
.then((data: any) => setLeaderboard(Array.isArray(data) ? data : []))
|
|
24
24
|
.catch((err: any) => setError(err.message || 'Failed to load leaderboard'))
|
|
25
25
|
.finally(() => setIsLoading(false));
|
|
@@ -18,7 +18,7 @@ const KarmaRulesScreen: React.FC<BaseScreenProps> = ({ goBack, theme }) => {
|
|
|
18
18
|
useEffect(() => {
|
|
19
19
|
setIsLoading(true);
|
|
20
20
|
setError(null);
|
|
21
|
-
oxyServices.
|
|
21
|
+
oxyServices.getKarmaRules()
|
|
22
22
|
.then((data: any) => setRules(Array.isArray(data) ? data : []))
|
|
23
23
|
.catch((err: any) => setError(err.message || 'Failed to load rules'))
|
|
24
24
|
.finally(() => setIsLoading(false));
|
|
@@ -53,7 +53,7 @@ export const useFollowStore = create<FollowState>((set: any, get: any) => ({
|
|
|
53
53
|
errors: { ...state.errors, [userId]: null },
|
|
54
54
|
}));
|
|
55
55
|
try {
|
|
56
|
-
const response = await oxyServices.
|
|
56
|
+
const response = await oxyServices.getFollowStatus(userId);
|
|
57
57
|
set((state: FollowState) => ({
|
|
58
58
|
followingUsers: { ...state.followingUsers, [userId]: response.isFollowing },
|
|
59
59
|
fetchingUsers: { ...state.fetchingUsers, [userId]: false },
|
|
@@ -75,10 +75,10 @@ export const useFollowStore = create<FollowState>((set: any, get: any) => ({
|
|
|
75
75
|
let response: any;
|
|
76
76
|
let newFollowState;
|
|
77
77
|
if (isCurrentlyFollowing) {
|
|
78
|
-
response = await oxyServices.
|
|
78
|
+
response = await oxyServices.unfollowUser(userId);
|
|
79
79
|
newFollowState = false;
|
|
80
80
|
} else {
|
|
81
|
-
response = await oxyServices.
|
|
81
|
+
response = await oxyServices.followUser(userId);
|
|
82
82
|
newFollowState = true;
|
|
83
83
|
}
|
|
84
84
|
|
|
@@ -158,7 +158,7 @@ export const useFollowStore = create<FollowState>((set: any, get: any) => ({
|
|
|
158
158
|
loadingCounts: { ...state.loadingCounts, [userId]: true },
|
|
159
159
|
}));
|
|
160
160
|
try {
|
|
161
|
-
const user = await oxyServices.
|
|
161
|
+
const user = await oxyServices.getUserById(userId);
|
|
162
162
|
if (user && user._count) {
|
|
163
163
|
set((state: FollowState) => ({
|
|
164
164
|
followerCounts: {
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.OxyServicesMain = void 0;
|
|
7
|
-
var _AuthService = require("./auth/AuthService");
|
|
8
|
-
var _UserService = require("./users/UserService");
|
|
9
|
-
var _PaymentService = require("./payments/PaymentService");
|
|
10
|
-
var _KarmaService = require("./karma/KarmaService");
|
|
11
|
-
var _FileService = require("./files/FileService");
|
|
12
|
-
var _LocationService = require("./locations/LocationService");
|
|
13
|
-
var _AnalyticsService = require("./analytics/AnalyticsService");
|
|
14
|
-
var _DeviceService = require("./devices/DeviceService");
|
|
15
|
-
/**
|
|
16
|
-
* Main OxyServices class that combines all individual services
|
|
17
|
-
*
|
|
18
|
-
* This class provides a unified interface to all Oxy API services while maintaining
|
|
19
|
-
* backward compatibility with the original monolithic structure.
|
|
20
|
-
*/
|
|
21
|
-
class OxyServicesMain extends _AuthService.AuthService {
|
|
22
|
-
// Service instances
|
|
23
|
-
|
|
24
|
-
constructor(config) {
|
|
25
|
-
super(config);
|
|
26
|
-
|
|
27
|
-
// Initialize all service instances
|
|
28
|
-
this.users = new _UserService.UserService(config);
|
|
29
|
-
this.payments = new _PaymentService.PaymentService(config);
|
|
30
|
-
this.karma = new _KarmaService.KarmaService(config);
|
|
31
|
-
this.files = new _FileService.FileService(config);
|
|
32
|
-
this.locations = new _LocationService.LocationService(config);
|
|
33
|
-
this.analytics = new _AnalyticsService.AnalyticsService(config);
|
|
34
|
-
this.devices = new _DeviceService.DeviceService(config);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// Re-export OXY_CLOUD_URL for convenience
|
|
38
|
-
static OXY_CLOUD_URL = _FileService.OXY_CLOUD_URL;
|
|
39
|
-
|
|
40
|
-
// Additional utility methods that span multiple services
|
|
41
|
-
async fetchLinkMetadata(url) {
|
|
42
|
-
try {
|
|
43
|
-
const res = await this.getClient().get(`/api/link-metadata?url=${encodeURIComponent(url)}`);
|
|
44
|
-
return res.data;
|
|
45
|
-
} catch (error) {
|
|
46
|
-
throw this.handleError(error);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.OxyServicesMain = OxyServicesMain;
|
|
51
|
-
//# sourceMappingURL=OxyServicesMain.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_AuthService","require","_UserService","_PaymentService","_KarmaService","_FileService","_LocationService","_AnalyticsService","_DeviceService","OxyServicesMain","AuthService","constructor","config","users","UserService","payments","PaymentService","karma","KarmaService","files","FileService","locations","LocationService","analytics","AnalyticsService","devices","DeviceService","OXY_CLOUD_URL","fetchLinkMetadata","url","res","getClient","get","encodeURIComponent","data","error","handleError","exports"],"sourceRoot":"../../../src","sources":["core/OxyServicesMain.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAN,OAAA;AACA,IAAAO,cAAA,GAAAP,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMQ,eAAe,SAASC,wBAAW,CAAC;EAC/C;;EASAC,WAAWA,CAACC,MAAiB,EAAE;IAC7B,KAAK,CAACA,MAAM,CAAC;;IAEb;IACA,IAAI,CAACC,KAAK,GAAG,IAAIC,wBAAW,CAACF,MAAM,CAAC;IACpC,IAAI,CAACG,QAAQ,GAAG,IAAIC,8BAAc,CAACJ,MAAM,CAAC;IAC1C,IAAI,CAACK,KAAK,GAAG,IAAIC,0BAAY,CAACN,MAAM,CAAC;IACrC,IAAI,CAACO,KAAK,GAAG,IAAIC,wBAAW,CAACR,MAAM,CAAC;IACpC,IAAI,CAACS,SAAS,GAAG,IAAIC,gCAAe,CAACV,MAAM,CAAC;IAC5C,IAAI,CAACW,SAAS,GAAG,IAAIC,kCAAgB,CAACZ,MAAM,CAAC;IAC7C,IAAI,CAACa,OAAO,GAAG,IAAIC,4BAAa,CAACd,MAAM,CAAC;EAC1C;;EAEA;EACA,OAAgBe,aAAa,GAAGA,0BAAa;;EAE7C;EACA,MAAMC,iBAAiBA,CAACC,GAAW,EAKhC;IACD,IAAI;MACF,MAAMC,GAAG,GAAG,MAAM,IAAI,CAACC,SAAS,CAAC,CAAC,CAACC,GAAG,CAAC,0BAA0BC,kBAAkB,CAACJ,GAAG,CAAC,EAAE,CAAC;MAC3F,OAAOC,GAAG,CAACI,IAAI;IACjB,CAAC,CAAC,OAAOC,KAAK,EAAE;MACd,MAAM,IAAI,CAACC,WAAW,CAACD,KAAK,CAAC;IAC/B;EACF;AACF;AAACE,OAAA,CAAA5B,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.AnalyticsService = void 0;
|
|
7
|
-
var _OxyServices = require("../OxyServices");
|
|
8
|
-
/**
|
|
9
|
-
* Analytics service for handling analytics and content viewer operations
|
|
10
|
-
*/
|
|
11
|
-
class AnalyticsService extends _OxyServices.OxyServices {
|
|
12
|
-
/**
|
|
13
|
-
* Get analytics data for user
|
|
14
|
-
*/
|
|
15
|
-
async getAnalytics(userId, period) {
|
|
16
|
-
try {
|
|
17
|
-
const params = new URLSearchParams();
|
|
18
|
-
if (period) params.append('period', period);
|
|
19
|
-
const res = await this.getClient().get(`/api/analytics/users/${userId}?${params.toString()}`);
|
|
20
|
-
return res.data;
|
|
21
|
-
} catch (error) {
|
|
22
|
-
throw this.handleError(error);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Update analytics data
|
|
28
|
-
*/
|
|
29
|
-
async updateAnalytics(userId, type, data) {
|
|
30
|
-
try {
|
|
31
|
-
const res = await this.getClient().put(`/api/analytics/users/${userId}/${type}`, data);
|
|
32
|
-
return res.data;
|
|
33
|
-
} catch (error) {
|
|
34
|
-
throw this.handleError(error);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Get content viewers for user
|
|
40
|
-
*/
|
|
41
|
-
async getContentViewers(userId, period) {
|
|
42
|
-
try {
|
|
43
|
-
const params = new URLSearchParams();
|
|
44
|
-
if (period) params.append('period', period);
|
|
45
|
-
const res = await this.getClient().get(`/api/analytics/users/${userId}/viewers?${params.toString()}`);
|
|
46
|
-
return res.data;
|
|
47
|
-
} catch (error) {
|
|
48
|
-
throw this.handleError(error);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Get follower details for user
|
|
54
|
-
*/
|
|
55
|
-
async getFollowerDetails(userId, period) {
|
|
56
|
-
try {
|
|
57
|
-
const params = new URLSearchParams();
|
|
58
|
-
if (period) params.append('period', period);
|
|
59
|
-
const res = await this.getClient().get(`/api/analytics/users/${userId}/followers?${params.toString()}`);
|
|
60
|
-
return res.data;
|
|
61
|
-
} catch (error) {
|
|
62
|
-
throw this.handleError(error);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
exports.AnalyticsService = AnalyticsService;
|
|
67
|
-
//# sourceMappingURL=AnalyticsService.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_OxyServices","require","AnalyticsService","OxyServices","getAnalytics","userId","period","params","URLSearchParams","append","res","getClient","get","toString","data","error","handleError","updateAnalytics","type","put","getContentViewers","getFollowerDetails","exports"],"sourceRoot":"../../../../src","sources":["core/analytics/AnalyticsService.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAGA;AACA;AACA;AACO,MAAMC,gBAAgB,SAASC,wBAAW,CAAC;EAChD;AACF;AACA;EACE,MAAMC,YAAYA,CAACC,MAAc,EAAEC,MAAe,EAA0B;IAC1E,IAAI;MACF,MAAMC,MAAM,GAAG,IAAIC,eAAe,CAAC,CAAC;MACpC,IAAIF,MAAM,EAAEC,MAAM,CAACE,MAAM,CAAC,QAAQ,EAAEH,MAAM,CAAC;MAE3C,MAAMI,GAAG,GAAG,MAAM,IAAI,CAACC,SAAS,CAAC,CAAC,CAACC,GAAG,CAAC,wBAAwBP,MAAM,IAAIE,MAAM,CAACM,QAAQ,CAAC,CAAC,EAAE,CAAC;MAC7F,OAAOH,GAAG,CAACI,IAAI;IACjB,CAAC,CAAC,OAAOC,KAAK,EAAE;MACd,MAAM,IAAI,CAACC,WAAW,CAACD,KAAK,CAAC;IAC/B;EACF;;EAEA;AACF;AACA;EACE,MAAME,eAAeA,CAACZ,MAAc,EAAEa,IAAY,EAAEJ,IAAyB,EAAgC;IAC3G,IAAI;MACF,MAAMJ,GAAG,GAAG,MAAM,IAAI,CAACC,SAAS,CAAC,CAAC,CAACQ,GAAG,CAAC,wBAAwBd,MAAM,IAAIa,IAAI,EAAE,EAAEJ,IAAI,CAAC;MACtF,OAAOJ,GAAG,CAACI,IAAI;IACjB,CAAC,CAAC,OAAOC,KAAK,EAAE;MACd,MAAM,IAAI,CAACC,WAAW,CAACD,KAAK,CAAC;IAC/B;EACF;;EAEA;AACF;AACA;EACE,MAAMK,iBAAiBA,CAACf,MAAc,EAAEC,MAAe,EAA4B;IACjF,IAAI;MACF,MAAMC,MAAM,GAAG,IAAIC,eAAe,CAAC,CAAC;MACpC,IAAIF,MAAM,EAAEC,MAAM,CAACE,MAAM,CAAC,QAAQ,EAAEH,MAAM,CAAC;MAE3C,MAAMI,GAAG,GAAG,MAAM,IAAI,CAACC,SAAS,CAAC,CAAC,CAACC,GAAG,CAAC,wBAAwBP,MAAM,YAAYE,MAAM,CAACM,QAAQ,CAAC,CAAC,EAAE,CAAC;MACrG,OAAOH,GAAG,CAACI,IAAI;IACjB,CAAC,CAAC,OAAOC,KAAK,EAAE;MACd,MAAM,IAAI,CAACC,WAAW,CAACD,KAAK,CAAC;IAC/B;EACF;;EAEA;AACF;AACA;EACE,MAAMM,kBAAkBA,CAAChB,MAAc,EAAEC,MAAe,EAA4B;IAClF,IAAI;MACF,MAAMC,MAAM,GAAG,IAAIC,eAAe,CAAC,CAAC;MACpC,IAAIF,MAAM,EAAEC,MAAM,CAACE,MAAM,CAAC,QAAQ,EAAEH,MAAM,CAAC;MAE3C,MAAMI,GAAG,GAAG,MAAM,IAAI,CAACC,SAAS,CAAC,CAAC,CAACC,GAAG,CAAC,wBAAwBP,MAAM,cAAcE,MAAM,CAACM,QAAQ,CAAC,CAAC,EAAE,CAAC;MACvG,OAAOH,GAAG,CAACI,IAAI;IACjB,CAAC,CAAC,OAAOC,KAAK,EAAE;MACd,MAAM,IAAI,CAACC,WAAW,CAACD,KAAK,CAAC;IAC/B;EACF;AACF;AAACO,OAAA,CAAApB,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|