@oxyhq/core 1.5.0 → 1.6.1
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/dist/cjs/AuthManager.js +14 -1
- package/dist/cjs/HttpService.js +87 -69
- package/dist/cjs/OxyServices.base.js +5 -4
- package/dist/cjs/crypto/keyManager.js +1 -13
- package/dist/cjs/crypto/signatureService.js +7 -20
- package/dist/cjs/index.js +9 -1
- package/dist/cjs/mixins/OxyServices.analytics.js +2 -2
- package/dist/cjs/mixins/OxyServices.assets.js +14 -14
- package/dist/cjs/mixins/OxyServices.auth.js +19 -19
- package/dist/cjs/mixins/OxyServices.developer.js +6 -6
- package/dist/cjs/mixins/OxyServices.devices.js +7 -7
- package/dist/cjs/mixins/OxyServices.features.js +23 -23
- package/dist/cjs/mixins/OxyServices.fedcm.js +1 -1
- package/dist/cjs/mixins/OxyServices.karma.js +6 -6
- package/dist/cjs/mixins/OxyServices.location.js +2 -2
- package/dist/cjs/mixins/OxyServices.payment.js +6 -6
- package/dist/cjs/mixins/OxyServices.popup.js +1 -1
- package/dist/cjs/mixins/OxyServices.privacy.js +6 -6
- package/dist/cjs/mixins/OxyServices.security.js +3 -3
- package/dist/cjs/mixins/OxyServices.user.js +22 -22
- package/dist/cjs/mixins/OxyServices.utility.js +39 -10
- package/dist/cjs/utils/authHelpers.js +114 -0
- package/dist/cjs/utils/platform.js +14 -0
- package/dist/esm/AuthManager.js +14 -1
- package/dist/esm/HttpService.js +87 -69
- package/dist/esm/OxyServices.base.js +5 -4
- package/dist/esm/crypto/keyManager.js +1 -13
- package/dist/esm/crypto/signatureService.js +2 -15
- package/dist/esm/index.js +2 -0
- package/dist/esm/mixins/OxyServices.analytics.js +2 -2
- package/dist/esm/mixins/OxyServices.assets.js +14 -14
- package/dist/esm/mixins/OxyServices.auth.js +19 -19
- package/dist/esm/mixins/OxyServices.developer.js +6 -6
- package/dist/esm/mixins/OxyServices.devices.js +7 -7
- package/dist/esm/mixins/OxyServices.features.js +23 -23
- package/dist/esm/mixins/OxyServices.fedcm.js +1 -1
- package/dist/esm/mixins/OxyServices.karma.js +6 -6
- package/dist/esm/mixins/OxyServices.location.js +2 -2
- package/dist/esm/mixins/OxyServices.payment.js +6 -6
- package/dist/esm/mixins/OxyServices.popup.js +1 -1
- package/dist/esm/mixins/OxyServices.privacy.js +6 -6
- package/dist/esm/mixins/OxyServices.security.js +3 -3
- package/dist/esm/mixins/OxyServices.user.js +22 -22
- package/dist/esm/mixins/OxyServices.utility.js +39 -10
- package/dist/esm/utils/authHelpers.js +105 -0
- package/dist/esm/utils/platform.js +12 -0
- package/dist/types/HttpService.d.ts +4 -1
- package/dist/types/OxyServices.base.d.ts +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/mixins/OxyServices.analytics.d.ts +1 -1
- package/dist/types/mixins/OxyServices.assets.d.ts +1 -1
- package/dist/types/mixins/OxyServices.auth.d.ts +1 -1
- package/dist/types/mixins/OxyServices.developer.d.ts +1 -1
- package/dist/types/mixins/OxyServices.devices.d.ts +1 -1
- package/dist/types/mixins/OxyServices.features.d.ts +1 -1
- package/dist/types/mixins/OxyServices.fedcm.d.ts +1 -1
- package/dist/types/mixins/OxyServices.karma.d.ts +1 -1
- package/dist/types/mixins/OxyServices.language.d.ts +1 -1
- package/dist/types/mixins/OxyServices.location.d.ts +1 -1
- package/dist/types/mixins/OxyServices.payment.d.ts +1 -1
- package/dist/types/mixins/OxyServices.popup.d.ts +1 -1
- package/dist/types/mixins/OxyServices.privacy.d.ts +1 -1
- package/dist/types/mixins/OxyServices.redirect.d.ts +1 -1
- package/dist/types/mixins/OxyServices.security.d.ts +1 -1
- package/dist/types/mixins/OxyServices.user.d.ts +1 -1
- package/dist/types/mixins/OxyServices.utility.d.ts +20 -6
- package/dist/types/utils/authHelpers.d.ts +57 -0
- package/dist/types/utils/platform.d.ts +8 -0
- package/package.json +1 -1
- package/src/AuthManager.ts +14 -1
- package/src/HttpService.ts +85 -67
- package/src/OxyServices.base.ts +5 -4
- package/src/crypto/keyManager.ts +1 -15
- package/src/crypto/signatureService.ts +2 -17
- package/src/index.ts +11 -0
- package/src/mixins/OxyServices.analytics.ts +2 -2
- package/src/mixins/OxyServices.assets.ts +14 -14
- package/src/mixins/OxyServices.auth.ts +19 -19
- package/src/mixins/OxyServices.developer.ts +6 -6
- package/src/mixins/OxyServices.devices.ts +7 -7
- package/src/mixins/OxyServices.features.ts +23 -23
- package/src/mixins/OxyServices.fedcm.ts +1 -1
- package/src/mixins/OxyServices.karma.ts +6 -6
- package/src/mixins/OxyServices.location.ts +2 -2
- package/src/mixins/OxyServices.payment.ts +6 -6
- package/src/mixins/OxyServices.popup.ts +1 -1
- package/src/mixins/OxyServices.privacy.ts +6 -6
- package/src/mixins/OxyServices.security.ts +3 -3
- package/src/mixins/OxyServices.user.ts +22 -22
- package/src/mixins/OxyServices.utility.ts +41 -11
- package/src/utils/authHelpers.ts +140 -0
- package/src/utils/platform.ts +14 -0
|
@@ -10,7 +10,7 @@ export function OxyServicesDeveloperMixin(Base) {
|
|
|
10
10
|
*/
|
|
11
11
|
async getDeveloperApps() {
|
|
12
12
|
try {
|
|
13
|
-
const res = await this.makeRequest('GET', '/
|
|
13
|
+
const res = await this.makeRequest('GET', '/developer/apps', undefined, {
|
|
14
14
|
cache: true,
|
|
15
15
|
cacheTTL: CACHE_TIMES.MEDIUM,
|
|
16
16
|
});
|
|
@@ -27,7 +27,7 @@ export function OxyServicesDeveloperMixin(Base) {
|
|
|
27
27
|
*/
|
|
28
28
|
async createDeveloperApp(data) {
|
|
29
29
|
try {
|
|
30
|
-
const res = await this.makeRequest('POST', '/
|
|
30
|
+
const res = await this.makeRequest('POST', '/developer/apps', data, { cache: false });
|
|
31
31
|
return res.app;
|
|
32
32
|
}
|
|
33
33
|
catch (error) {
|
|
@@ -39,7 +39,7 @@ export function OxyServicesDeveloperMixin(Base) {
|
|
|
39
39
|
*/
|
|
40
40
|
async getDeveloperApp(appId) {
|
|
41
41
|
try {
|
|
42
|
-
const res = await this.makeRequest('GET', `/
|
|
42
|
+
const res = await this.makeRequest('GET', `/developer/apps/${appId}`, undefined, {
|
|
43
43
|
cache: true,
|
|
44
44
|
cacheTTL: CACHE_TIMES.LONG,
|
|
45
45
|
});
|
|
@@ -57,7 +57,7 @@ export function OxyServicesDeveloperMixin(Base) {
|
|
|
57
57
|
*/
|
|
58
58
|
async updateDeveloperApp(appId, data) {
|
|
59
59
|
try {
|
|
60
|
-
const res = await this.makeRequest('PATCH', `/
|
|
60
|
+
const res = await this.makeRequest('PATCH', `/developer/apps/${appId}`, data, { cache: false });
|
|
61
61
|
return res.app;
|
|
62
62
|
}
|
|
63
63
|
catch (error) {
|
|
@@ -71,7 +71,7 @@ export function OxyServicesDeveloperMixin(Base) {
|
|
|
71
71
|
*/
|
|
72
72
|
async regenerateDeveloperAppSecret(appId) {
|
|
73
73
|
try {
|
|
74
|
-
return await this.makeRequest('POST', `/
|
|
74
|
+
return await this.makeRequest('POST', `/developer/apps/${appId}/regenerate-secret`, undefined, { cache: false });
|
|
75
75
|
}
|
|
76
76
|
catch (error) {
|
|
77
77
|
throw this.handleError(error);
|
|
@@ -84,7 +84,7 @@ export function OxyServicesDeveloperMixin(Base) {
|
|
|
84
84
|
*/
|
|
85
85
|
async deleteDeveloperApp(appId) {
|
|
86
86
|
try {
|
|
87
|
-
return await this.makeRequest('DELETE', `/
|
|
87
|
+
return await this.makeRequest('DELETE', `/developer/apps/${appId}`, undefined, { cache: false });
|
|
88
88
|
}
|
|
89
89
|
catch (error) {
|
|
90
90
|
throw this.handleError(error);
|
|
@@ -10,7 +10,7 @@ export function OxyServicesDevicesMixin(Base) {
|
|
|
10
10
|
*/
|
|
11
11
|
async registerDevice(deviceData) {
|
|
12
12
|
try {
|
|
13
|
-
return await this.makeRequest('POST', '/
|
|
13
|
+
return await this.makeRequest('POST', '/devices', deviceData, { cache: false });
|
|
14
14
|
}
|
|
15
15
|
catch (error) {
|
|
16
16
|
throw this.handleError(error);
|
|
@@ -22,7 +22,7 @@ export function OxyServicesDevicesMixin(Base) {
|
|
|
22
22
|
*/
|
|
23
23
|
async getUserDevices() {
|
|
24
24
|
try {
|
|
25
|
-
return await this.makeRequest('GET', '/
|
|
25
|
+
return await this.makeRequest('GET', '/devices', undefined, {
|
|
26
26
|
cache: false, // Don't cache device list - always get fresh data
|
|
27
27
|
});
|
|
28
28
|
}
|
|
@@ -36,7 +36,7 @@ export function OxyServicesDevicesMixin(Base) {
|
|
|
36
36
|
*/
|
|
37
37
|
async removeDevice(deviceId) {
|
|
38
38
|
try {
|
|
39
|
-
await this.makeRequest('DELETE', `/
|
|
39
|
+
await this.makeRequest('DELETE', `/devices/${deviceId}`, undefined, { cache: false });
|
|
40
40
|
}
|
|
41
41
|
catch (error) {
|
|
42
42
|
throw this.handleError(error);
|
|
@@ -52,7 +52,7 @@ export function OxyServicesDevicesMixin(Base) {
|
|
|
52
52
|
try {
|
|
53
53
|
// Use makeRequest for consistent error handling and optional caching
|
|
54
54
|
// Cache disabled by default to ensure fresh session data
|
|
55
|
-
return await this.makeRequest('GET', `/
|
|
55
|
+
return await this.makeRequest('GET', `/session/device/sessions/${sessionId}`, undefined, {
|
|
56
56
|
cache: false, // Don't cache sessions - always get fresh data
|
|
57
57
|
deduplicate: true, // Deduplicate concurrent requests for same sessionId
|
|
58
58
|
});
|
|
@@ -75,7 +75,7 @@ export function OxyServicesDevicesMixin(Base) {
|
|
|
75
75
|
urlParams.deviceId = deviceId;
|
|
76
76
|
if (excludeCurrent)
|
|
77
77
|
urlParams.excludeCurrent = 'true';
|
|
78
|
-
return await this.makeRequest('POST', `/
|
|
78
|
+
return await this.makeRequest('POST', `/session/device/logout-all/${sessionId}`, urlParams, { cache: false });
|
|
79
79
|
}
|
|
80
80
|
catch (error) {
|
|
81
81
|
throw this.handleError(error);
|
|
@@ -89,7 +89,7 @@ export function OxyServicesDevicesMixin(Base) {
|
|
|
89
89
|
*/
|
|
90
90
|
async updateDeviceName(sessionId, deviceName) {
|
|
91
91
|
try {
|
|
92
|
-
return await this.makeRequest('PUT', `/
|
|
92
|
+
return await this.makeRequest('PUT', `/session/device/name/${sessionId}`, { deviceName }, { cache: false });
|
|
93
93
|
}
|
|
94
94
|
catch (error) {
|
|
95
95
|
throw this.handleError(error);
|
|
@@ -101,7 +101,7 @@ export function OxyServicesDevicesMixin(Base) {
|
|
|
101
101
|
*/
|
|
102
102
|
async getSecurityInfo() {
|
|
103
103
|
try {
|
|
104
|
-
return await this.makeRequest('GET', '/
|
|
104
|
+
return await this.makeRequest('GET', '/devices/security', undefined, {
|
|
105
105
|
cache: false,
|
|
106
106
|
});
|
|
107
107
|
}
|
|
@@ -12,7 +12,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
12
12
|
*/
|
|
13
13
|
async submitFeedback(payload) {
|
|
14
14
|
try {
|
|
15
|
-
return await this.makeRequest('POST', '/
|
|
15
|
+
return await this.makeRequest('POST', '/feedback', payload, {
|
|
16
16
|
cache: false,
|
|
17
17
|
});
|
|
18
18
|
}
|
|
@@ -28,7 +28,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
28
28
|
*/
|
|
29
29
|
async getSubscriptionPlans() {
|
|
30
30
|
try {
|
|
31
|
-
return await this.makeRequest('GET', '/
|
|
31
|
+
return await this.makeRequest('GET', '/subscriptions/plans', undefined, {
|
|
32
32
|
cache: true,
|
|
33
33
|
cacheTTL: CACHE_TIMES.LONG,
|
|
34
34
|
});
|
|
@@ -42,7 +42,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
42
42
|
*/
|
|
43
43
|
async getIndividualFeatures() {
|
|
44
44
|
try {
|
|
45
|
-
return await this.makeRequest('GET', '/
|
|
45
|
+
return await this.makeRequest('GET', '/subscriptions/features', undefined, {
|
|
46
46
|
cache: true,
|
|
47
47
|
cacheTTL: CACHE_TIMES.LONG,
|
|
48
48
|
});
|
|
@@ -56,7 +56,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
56
56
|
*/
|
|
57
57
|
async subscribe(planId, paymentMethodId) {
|
|
58
58
|
return this.withAuthRetry(async () => {
|
|
59
|
-
return await this.makeRequest('POST', '/
|
|
59
|
+
return await this.makeRequest('POST', '/subscriptions/subscribe', {
|
|
60
60
|
planId,
|
|
61
61
|
paymentMethodId,
|
|
62
62
|
}, { cache: false });
|
|
@@ -67,7 +67,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
67
67
|
*/
|
|
68
68
|
async subscribeToFeature(featureId, paymentMethodId) {
|
|
69
69
|
return this.withAuthRetry(async () => {
|
|
70
|
-
return await this.makeRequest('POST', '/
|
|
70
|
+
return await this.makeRequest('POST', '/subscriptions/features/subscribe', {
|
|
71
71
|
featureId,
|
|
72
72
|
paymentMethodId,
|
|
73
73
|
}, { cache: false });
|
|
@@ -78,7 +78,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
78
78
|
*/
|
|
79
79
|
async cancelSubscription(subscriptionId) {
|
|
80
80
|
return this.withAuthRetry(async () => {
|
|
81
|
-
await this.makeRequest('POST', `/
|
|
81
|
+
await this.makeRequest('POST', `/subscriptions/${subscriptionId}/cancel`, undefined, {
|
|
82
82
|
cache: false,
|
|
83
83
|
});
|
|
84
84
|
}, 'cancelSubscription');
|
|
@@ -88,7 +88,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
88
88
|
*/
|
|
89
89
|
async reactivateSubscription(subscriptionId) {
|
|
90
90
|
return this.withAuthRetry(async () => {
|
|
91
|
-
await this.makeRequest('POST', `/
|
|
91
|
+
await this.makeRequest('POST', `/subscriptions/${subscriptionId}/reactivate`, undefined, {
|
|
92
92
|
cache: false,
|
|
93
93
|
});
|
|
94
94
|
}, 'reactivateSubscription');
|
|
@@ -99,7 +99,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
99
99
|
async getCurrentSubscription() {
|
|
100
100
|
return this.withAuthRetry(async () => {
|
|
101
101
|
try {
|
|
102
|
-
return await this.makeRequest('GET', '/
|
|
102
|
+
return await this.makeRequest('GET', '/subscriptions/current', undefined, {
|
|
103
103
|
cache: true,
|
|
104
104
|
cacheTTL: CACHE_TIMES.SHORT,
|
|
105
105
|
});
|
|
@@ -119,7 +119,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
119
119
|
*/
|
|
120
120
|
async getSavedItems(userId) {
|
|
121
121
|
return this.withAuthRetry(async () => {
|
|
122
|
-
const endpoint = userId ? `/
|
|
122
|
+
const endpoint = userId ? `/users/${userId}/saves` : '/saves';
|
|
123
123
|
return await this.makeRequest('GET', endpoint, undefined, {
|
|
124
124
|
cache: true,
|
|
125
125
|
cacheTTL: CACHE_TIMES.SHORT,
|
|
@@ -131,7 +131,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
131
131
|
*/
|
|
132
132
|
async getCollections(userId) {
|
|
133
133
|
return this.withAuthRetry(async () => {
|
|
134
|
-
const endpoint = userId ? `/
|
|
134
|
+
const endpoint = userId ? `/users/${userId}/collections` : '/collections';
|
|
135
135
|
return await this.makeRequest('GET', endpoint, undefined, {
|
|
136
136
|
cache: true,
|
|
137
137
|
cacheTTL: CACHE_TIMES.SHORT,
|
|
@@ -143,7 +143,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
143
143
|
*/
|
|
144
144
|
async saveItem(itemId, itemType, collectionId) {
|
|
145
145
|
return this.withAuthRetry(async () => {
|
|
146
|
-
return await this.makeRequest('POST', '/
|
|
146
|
+
return await this.makeRequest('POST', '/saves', {
|
|
147
147
|
itemId,
|
|
148
148
|
itemType,
|
|
149
149
|
collectionId,
|
|
@@ -155,7 +155,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
155
155
|
*/
|
|
156
156
|
async removeSavedItem(saveId) {
|
|
157
157
|
return this.withAuthRetry(async () => {
|
|
158
|
-
await this.makeRequest('DELETE', `/
|
|
158
|
+
await this.makeRequest('DELETE', `/saves/${saveId}`, undefined, { cache: false });
|
|
159
159
|
}, 'removeSavedItem');
|
|
160
160
|
}
|
|
161
161
|
/**
|
|
@@ -163,7 +163,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
163
163
|
*/
|
|
164
164
|
async createCollection(name, description) {
|
|
165
165
|
return this.withAuthRetry(async () => {
|
|
166
|
-
return await this.makeRequest('POST', '/
|
|
166
|
+
return await this.makeRequest('POST', '/collections', {
|
|
167
167
|
name,
|
|
168
168
|
description,
|
|
169
169
|
}, { cache: false });
|
|
@@ -174,7 +174,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
174
174
|
*/
|
|
175
175
|
async deleteCollection(collectionId) {
|
|
176
176
|
return this.withAuthRetry(async () => {
|
|
177
|
-
await this.makeRequest('DELETE', `/
|
|
177
|
+
await this.makeRequest('DELETE', `/collections/${collectionId}`, undefined, { cache: false });
|
|
178
178
|
}, 'deleteCollection');
|
|
179
179
|
}
|
|
180
180
|
// ==================
|
|
@@ -185,7 +185,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
185
185
|
*/
|
|
186
186
|
async getUserStats(userId) {
|
|
187
187
|
try {
|
|
188
|
-
return await this.makeRequest('GET', `/
|
|
188
|
+
return await this.makeRequest('GET', `/users/${userId}/stats`, undefined, {
|
|
189
189
|
cache: true,
|
|
190
190
|
cacheTTL: CACHE_TIMES.MEDIUM,
|
|
191
191
|
});
|
|
@@ -207,7 +207,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
207
207
|
params.limit = limit;
|
|
208
208
|
if (offset)
|
|
209
209
|
params.offset = offset;
|
|
210
|
-
const endpoint = userId ? `/
|
|
210
|
+
const endpoint = userId ? `/users/${userId}/history` : '/history';
|
|
211
211
|
return await this.makeRequest('GET', endpoint, params, {
|
|
212
212
|
cache: true,
|
|
213
213
|
cacheTTL: CACHE_TIMES.SHORT,
|
|
@@ -219,7 +219,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
219
219
|
*/
|
|
220
220
|
async clearUserHistory() {
|
|
221
221
|
return this.withAuthRetry(async () => {
|
|
222
|
-
await this.makeRequest('DELETE', '/
|
|
222
|
+
await this.makeRequest('DELETE', '/history', undefined, { cache: false });
|
|
223
223
|
}, 'clearUserHistory');
|
|
224
224
|
}
|
|
225
225
|
/**
|
|
@@ -227,7 +227,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
227
227
|
*/
|
|
228
228
|
async deleteHistoryItem(itemId) {
|
|
229
229
|
return this.withAuthRetry(async () => {
|
|
230
|
-
await this.makeRequest('DELETE', `/
|
|
230
|
+
await this.makeRequest('DELETE', `/history/${itemId}`, undefined, { cache: false });
|
|
231
231
|
}, 'deleteHistoryItem');
|
|
232
232
|
}
|
|
233
233
|
// ==================
|
|
@@ -239,7 +239,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
239
239
|
async getFAQs(category) {
|
|
240
240
|
try {
|
|
241
241
|
const params = category ? { category } : undefined;
|
|
242
|
-
return await this.makeRequest('GET', '/
|
|
242
|
+
return await this.makeRequest('GET', '/faqs', params, {
|
|
243
243
|
cache: true,
|
|
244
244
|
cacheTTL: CACHE_TIMES.LONG,
|
|
245
245
|
});
|
|
@@ -253,7 +253,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
253
253
|
*/
|
|
254
254
|
async searchFAQs(query) {
|
|
255
255
|
try {
|
|
256
|
-
return await this.makeRequest('GET', '/
|
|
256
|
+
return await this.makeRequest('GET', '/faqs/search', { query }, {
|
|
257
257
|
cache: true,
|
|
258
258
|
cacheTTL: CACHE_TIMES.MEDIUM,
|
|
259
259
|
});
|
|
@@ -270,7 +270,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
270
270
|
*/
|
|
271
271
|
async getUserAchievements(userId) {
|
|
272
272
|
return this.withAuthRetry(async () => {
|
|
273
|
-
const endpoint = userId ? `/
|
|
273
|
+
const endpoint = userId ? `/users/${userId}/achievements` : '/achievements';
|
|
274
274
|
return await this.makeRequest('GET', endpoint, undefined, {
|
|
275
275
|
cache: true,
|
|
276
276
|
cacheTTL: CACHE_TIMES.MEDIUM,
|
|
@@ -282,7 +282,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
282
282
|
*/
|
|
283
283
|
async getAllAchievements() {
|
|
284
284
|
try {
|
|
285
|
-
return await this.makeRequest('GET', '/
|
|
285
|
+
return await this.makeRequest('GET', '/achievements/all', undefined, {
|
|
286
286
|
cache: true,
|
|
287
287
|
cacheTTL: CACHE_TIMES.LONG,
|
|
288
288
|
});
|
|
@@ -299,7 +299,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
299
299
|
*/
|
|
300
300
|
async deleteAccount(password) {
|
|
301
301
|
return this.withAuthRetry(async () => {
|
|
302
|
-
await this.makeRequest('DELETE', '/
|
|
302
|
+
await this.makeRequest('DELETE', '/account', { password }, { cache: false });
|
|
303
303
|
}, 'deleteAccount');
|
|
304
304
|
}
|
|
305
305
|
};
|
|
@@ -340,7 +340,7 @@ export function OxyServicesFedCMMixin(Base) {
|
|
|
340
340
|
async exchangeIdTokenForSession(idToken) {
|
|
341
341
|
debug.log('Exchanging ID token for session...');
|
|
342
342
|
try {
|
|
343
|
-
const response = await this.makeRequest('POST', '/
|
|
343
|
+
const response = await this.makeRequest('POST', '/fedcm/exchange', { id_token: idToken }, { cache: false });
|
|
344
344
|
debug.log('Token exchange complete:', {
|
|
345
345
|
hasSession: !!response?.sessionId,
|
|
346
346
|
hasUser: !!response?.user,
|
|
@@ -9,7 +9,7 @@ export function OxyServicesKarmaMixin(Base) {
|
|
|
9
9
|
*/
|
|
10
10
|
async getUserKarma(userId) {
|
|
11
11
|
try {
|
|
12
|
-
return await this.makeRequest('GET', `/
|
|
12
|
+
return await this.makeRequest('GET', `/karma/${userId}`, undefined, {
|
|
13
13
|
cache: true,
|
|
14
14
|
cacheTTL: 2 * 60 * 1000, // 2 minutes cache
|
|
15
15
|
});
|
|
@@ -23,7 +23,7 @@ export function OxyServicesKarmaMixin(Base) {
|
|
|
23
23
|
*/
|
|
24
24
|
async giveKarma(userId, amount, reason) {
|
|
25
25
|
try {
|
|
26
|
-
return await this.makeRequest('POST', `/
|
|
26
|
+
return await this.makeRequest('POST', `/karma/${userId}/give`, {
|
|
27
27
|
amount,
|
|
28
28
|
reason
|
|
29
29
|
}, { cache: false });
|
|
@@ -39,7 +39,7 @@ export function OxyServicesKarmaMixin(Base) {
|
|
|
39
39
|
*/
|
|
40
40
|
async getUserKarmaTotal(userId) {
|
|
41
41
|
try {
|
|
42
|
-
return await this.makeRequest('GET', `/
|
|
42
|
+
return await this.makeRequest('GET', `/karma/${userId}/total`, undefined, {
|
|
43
43
|
cache: true,
|
|
44
44
|
cacheTTL: CACHE_TIMES.MEDIUM,
|
|
45
45
|
});
|
|
@@ -62,7 +62,7 @@ export function OxyServicesKarmaMixin(Base) {
|
|
|
62
62
|
params.limit = limit;
|
|
63
63
|
if (offset)
|
|
64
64
|
params.offset = offset;
|
|
65
|
-
return await this.makeRequest('GET', `/
|
|
65
|
+
return await this.makeRequest('GET', `/karma/${userId}/history`, params, {
|
|
66
66
|
cache: true,
|
|
67
67
|
cacheTTL: CACHE_TIMES.MEDIUM,
|
|
68
68
|
});
|
|
@@ -77,7 +77,7 @@ export function OxyServicesKarmaMixin(Base) {
|
|
|
77
77
|
*/
|
|
78
78
|
async getKarmaLeaderboard() {
|
|
79
79
|
try {
|
|
80
|
-
return await this.makeRequest('GET', '/
|
|
80
|
+
return await this.makeRequest('GET', '/karma/leaderboard', undefined, {
|
|
81
81
|
cache: true,
|
|
82
82
|
cacheTTL: CACHE_TIMES.LONG,
|
|
83
83
|
});
|
|
@@ -92,7 +92,7 @@ export function OxyServicesKarmaMixin(Base) {
|
|
|
92
92
|
*/
|
|
93
93
|
async getKarmaRules() {
|
|
94
94
|
try {
|
|
95
|
-
return await this.makeRequest('GET', '/
|
|
95
|
+
return await this.makeRequest('GET', '/karma/rules', undefined, {
|
|
96
96
|
cache: true,
|
|
97
97
|
cacheTTL: CACHE_TIMES.EXTRA_LONG, // Rules don't change often
|
|
98
98
|
});
|
|
@@ -11,7 +11,7 @@ export function OxyServicesLocationMixin(Base) {
|
|
|
11
11
|
*/
|
|
12
12
|
async updateLocation(latitude, longitude) {
|
|
13
13
|
try {
|
|
14
|
-
return await this.makeRequest('POST', '/
|
|
14
|
+
return await this.makeRequest('POST', '/location', {
|
|
15
15
|
latitude,
|
|
16
16
|
longitude
|
|
17
17
|
}, { cache: false });
|
|
@@ -28,7 +28,7 @@ export function OxyServicesLocationMixin(Base) {
|
|
|
28
28
|
async getNearbyUsers(radius) {
|
|
29
29
|
try {
|
|
30
30
|
const params = radius ? { radius } : undefined;
|
|
31
|
-
return await this.makeRequest('GET', '/
|
|
31
|
+
return await this.makeRequest('GET', '/location/nearby', params, {
|
|
32
32
|
cache: false, // Don't cache location data - always get fresh data
|
|
33
33
|
});
|
|
34
34
|
}
|
|
@@ -11,7 +11,7 @@ export function OxyServicesPaymentMixin(Base) {
|
|
|
11
11
|
*/
|
|
12
12
|
async createPayment(data) {
|
|
13
13
|
try {
|
|
14
|
-
return await this.makeRequest('POST', '/
|
|
14
|
+
return await this.makeRequest('POST', '/payments', data, { cache: false });
|
|
15
15
|
}
|
|
16
16
|
catch (error) {
|
|
17
17
|
throw this.handleError(error);
|
|
@@ -24,7 +24,7 @@ export function OxyServicesPaymentMixin(Base) {
|
|
|
24
24
|
*/
|
|
25
25
|
async getPayment(paymentId) {
|
|
26
26
|
try {
|
|
27
|
-
return await this.makeRequest('GET', `/
|
|
27
|
+
return await this.makeRequest('GET', `/payments/${paymentId}`, undefined, {
|
|
28
28
|
cache: true,
|
|
29
29
|
cacheTTL: CACHE_TIMES.LONG,
|
|
30
30
|
});
|
|
@@ -39,7 +39,7 @@ export function OxyServicesPaymentMixin(Base) {
|
|
|
39
39
|
*/
|
|
40
40
|
async getUserPayments() {
|
|
41
41
|
try {
|
|
42
|
-
return await this.makeRequest('GET', '/
|
|
42
|
+
return await this.makeRequest('GET', '/payments/user', undefined, {
|
|
43
43
|
cache: false, // Don't cache user payments - always get fresh data
|
|
44
44
|
});
|
|
45
45
|
}
|
|
@@ -54,7 +54,7 @@ export function OxyServicesPaymentMixin(Base) {
|
|
|
54
54
|
*/
|
|
55
55
|
async getSubscription(userId) {
|
|
56
56
|
try {
|
|
57
|
-
return await this.makeRequest('GET', `/
|
|
57
|
+
return await this.makeRequest('GET', `/subscription/${userId}`, undefined, {
|
|
58
58
|
cache: true,
|
|
59
59
|
cacheTTL: CACHE_TIMES.MEDIUM,
|
|
60
60
|
});
|
|
@@ -86,7 +86,7 @@ export function OxyServicesPaymentMixin(Base) {
|
|
|
86
86
|
*/
|
|
87
87
|
async getWallet(userId) {
|
|
88
88
|
try {
|
|
89
|
-
return await this.makeRequest('GET', `/
|
|
89
|
+
return await this.makeRequest('GET', `/wallet/${userId}`, undefined, {
|
|
90
90
|
cache: true,
|
|
91
91
|
cacheTTL: CACHE_TIMES.SHORT, // Cache wallet for short time as balance changes frequently
|
|
92
92
|
});
|
|
@@ -125,7 +125,7 @@ export function OxyServicesPaymentMixin(Base) {
|
|
|
125
125
|
if (options?.offset)
|
|
126
126
|
params.append('offset', options.offset.toString());
|
|
127
127
|
const queryString = params.toString();
|
|
128
|
-
const url = `/
|
|
128
|
+
const url = `/wallet/transactions/${userId}${queryString ? `?${queryString}` : ''}`;
|
|
129
129
|
return await this.makeRequest('GET', url, undefined, {
|
|
130
130
|
cache: false, // Don't cache transactions - always get fresh data
|
|
131
131
|
});
|
|
@@ -87,7 +87,7 @@ export function OxyServicesPopupAuthMixin(Base) {
|
|
|
87
87
|
// The callback page only sends sessionId/accessToken, not user data
|
|
88
88
|
if (session && session.sessionId && !session.user) {
|
|
89
89
|
try {
|
|
90
|
-
const userData = await this.makeRequest('GET', `/
|
|
90
|
+
const userData = await this.makeRequest('GET', `/session/user/${session.sessionId}`, undefined, { cache: false });
|
|
91
91
|
if (userData) {
|
|
92
92
|
session.user = userData;
|
|
93
93
|
}
|
|
@@ -41,7 +41,7 @@ export function OxyServicesPrivacyMixin(Base) {
|
|
|
41
41
|
*/
|
|
42
42
|
async getBlockedUsers() {
|
|
43
43
|
try {
|
|
44
|
-
return await this.makeRequest('GET', '/
|
|
44
|
+
return await this.makeRequest('GET', '/privacy/blocked', undefined, {
|
|
45
45
|
cache: true,
|
|
46
46
|
cacheTTL: 1 * 60 * 1000, // 1 minute cache
|
|
47
47
|
});
|
|
@@ -60,7 +60,7 @@ export function OxyServicesPrivacyMixin(Base) {
|
|
|
60
60
|
if (!userId) {
|
|
61
61
|
throw new Error('User ID is required');
|
|
62
62
|
}
|
|
63
|
-
return await this.makeRequest('POST', `/
|
|
63
|
+
return await this.makeRequest('POST', `/privacy/blocked/${userId}`, undefined, {
|
|
64
64
|
cache: false,
|
|
65
65
|
});
|
|
66
66
|
}
|
|
@@ -78,7 +78,7 @@ export function OxyServicesPrivacyMixin(Base) {
|
|
|
78
78
|
if (!userId) {
|
|
79
79
|
throw new Error('User ID is required');
|
|
80
80
|
}
|
|
81
|
-
return await this.makeRequest('DELETE', `/
|
|
81
|
+
return await this.makeRequest('DELETE', `/privacy/blocked/${userId}`, undefined, {
|
|
82
82
|
cache: false,
|
|
83
83
|
});
|
|
84
84
|
}
|
|
@@ -103,7 +103,7 @@ export function OxyServicesPrivacyMixin(Base) {
|
|
|
103
103
|
*/
|
|
104
104
|
async getRestrictedUsers() {
|
|
105
105
|
try {
|
|
106
|
-
return await this.makeRequest('GET', '/
|
|
106
|
+
return await this.makeRequest('GET', '/privacy/restricted', undefined, {
|
|
107
107
|
cache: true,
|
|
108
108
|
cacheTTL: 1 * 60 * 1000, // 1 minute cache
|
|
109
109
|
});
|
|
@@ -122,7 +122,7 @@ export function OxyServicesPrivacyMixin(Base) {
|
|
|
122
122
|
if (!userId) {
|
|
123
123
|
throw new Error('User ID is required');
|
|
124
124
|
}
|
|
125
|
-
return await this.makeRequest('POST', `/
|
|
125
|
+
return await this.makeRequest('POST', `/privacy/restricted/${userId}`, undefined, {
|
|
126
126
|
cache: false,
|
|
127
127
|
});
|
|
128
128
|
}
|
|
@@ -140,7 +140,7 @@ export function OxyServicesPrivacyMixin(Base) {
|
|
|
140
140
|
if (!userId) {
|
|
141
141
|
throw new Error('User ID is required');
|
|
142
142
|
}
|
|
143
|
-
return await this.makeRequest('DELETE', `/
|
|
143
|
+
return await this.makeRequest('DELETE', `/privacy/restricted/${userId}`, undefined, {
|
|
144
144
|
cache: false,
|
|
145
145
|
});
|
|
146
146
|
}
|
|
@@ -20,7 +20,7 @@ export function OxyServicesSecurityMixin(Base) {
|
|
|
20
20
|
params.offset = offset;
|
|
21
21
|
if (eventType)
|
|
22
22
|
params.eventType = eventType;
|
|
23
|
-
const response = await this.makeRequest('GET', '/
|
|
23
|
+
const response = await this.makeRequest('GET', '/security/activity', params, { cache: false });
|
|
24
24
|
return response;
|
|
25
25
|
}
|
|
26
26
|
catch (error) {
|
|
@@ -48,7 +48,7 @@ export function OxyServicesSecurityMixin(Base) {
|
|
|
48
48
|
*/
|
|
49
49
|
async logPrivateKeyExported(deviceId) {
|
|
50
50
|
try {
|
|
51
|
-
await this.makeRequest('POST', '/
|
|
51
|
+
await this.makeRequest('POST', '/security/activity/private-key-exported', { deviceId }, { cache: false });
|
|
52
52
|
}
|
|
53
53
|
catch (error) {
|
|
54
54
|
// Don't throw - logging failures shouldn't break user flow
|
|
@@ -65,7 +65,7 @@ export function OxyServicesSecurityMixin(Base) {
|
|
|
65
65
|
*/
|
|
66
66
|
async logBackupCreated(deviceId) {
|
|
67
67
|
try {
|
|
68
|
-
await this.makeRequest('POST', '/
|
|
68
|
+
await this.makeRequest('POST', '/security/activity/backup-created', { deviceId }, { cache: false });
|
|
69
69
|
}
|
|
70
70
|
catch (error) {
|
|
71
71
|
// Don't throw - logging failures shouldn't break user flow
|