@oxyhq/core 1.5.0 → 1.6.0
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 +1 -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/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 +16 -7
- package/dist/cjs/utils/platform.js +14 -0
- package/dist/esm/AuthManager.js +1 -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/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 +16 -7
- 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/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 +7 -6
- package/dist/types/utils/platform.d.ts +8 -0
- package/package.json +1 -1
- package/src/AuthManager.ts +1 -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/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 +18 -8
- package/src/utils/platform.ts +14 -0
|
@@ -90,7 +90,7 @@ export function OxyServicesAuthMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
90
90
|
|
|
91
91
|
const response = await this.makeRequest<ServiceTokenResponse>(
|
|
92
92
|
'POST',
|
|
93
|
-
'/
|
|
93
|
+
'/auth/service-token',
|
|
94
94
|
{ apiKey: key, apiSecret: secret },
|
|
95
95
|
{ cache: false, retry: false }
|
|
96
96
|
);
|
|
@@ -142,7 +142,7 @@ export function OxyServicesAuthMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
142
142
|
timestamp: number
|
|
143
143
|
): Promise<{ message: string; user: User }> {
|
|
144
144
|
try {
|
|
145
|
-
const res = await this.makeRequest<{ message: string; user: User }>('POST', '/
|
|
145
|
+
const res = await this.makeRequest<{ message: string; user: User }>('POST', '/auth/register', {
|
|
146
146
|
publicKey,
|
|
147
147
|
signature,
|
|
148
148
|
timestamp,
|
|
@@ -166,7 +166,7 @@ export function OxyServicesAuthMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
166
166
|
*/
|
|
167
167
|
async requestChallenge(publicKey: string): Promise<ChallengeResponse> {
|
|
168
168
|
try {
|
|
169
|
-
return await this.makeRequest<ChallengeResponse>('POST', '/
|
|
169
|
+
return await this.makeRequest<ChallengeResponse>('POST', '/auth/challenge', {
|
|
170
170
|
publicKey,
|
|
171
171
|
}, { cache: false });
|
|
172
172
|
} catch (error) {
|
|
@@ -193,7 +193,7 @@ export function OxyServicesAuthMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
193
193
|
deviceFingerprint?: string
|
|
194
194
|
): Promise<SessionLoginResponse> {
|
|
195
195
|
try {
|
|
196
|
-
return await this.makeRequest<SessionLoginResponse>('POST', '/
|
|
196
|
+
return await this.makeRequest<SessionLoginResponse>('POST', '/auth/verify', {
|
|
197
197
|
publicKey,
|
|
198
198
|
challenge,
|
|
199
199
|
signature,
|
|
@@ -213,7 +213,7 @@ export function OxyServicesAuthMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
213
213
|
try {
|
|
214
214
|
return await this.makeRequest<PublicKeyCheckResponse>(
|
|
215
215
|
'GET',
|
|
216
|
-
`/
|
|
216
|
+
`/auth/check-publickey/${encodeURIComponent(publicKey)}`,
|
|
217
217
|
undefined,
|
|
218
218
|
{ cache: false }
|
|
219
219
|
);
|
|
@@ -229,7 +229,7 @@ export function OxyServicesAuthMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
229
229
|
try {
|
|
230
230
|
return await this.makeRequest<User>(
|
|
231
231
|
'GET',
|
|
232
|
-
`/
|
|
232
|
+
`/auth/user/${encodeURIComponent(publicKey)}`,
|
|
233
233
|
undefined,
|
|
234
234
|
{ cache: true, cacheTTL: 2 * 60 * 1000 }
|
|
235
235
|
);
|
|
@@ -243,7 +243,7 @@ export function OxyServicesAuthMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
243
243
|
*/
|
|
244
244
|
async getUserBySession(sessionId: string): Promise<User> {
|
|
245
245
|
try {
|
|
246
|
-
return await this.makeRequest<User>('GET', `/
|
|
246
|
+
return await this.makeRequest<User>('GET', `/session/user/${sessionId}`, undefined, {
|
|
247
247
|
cache: true,
|
|
248
248
|
cacheTTL: 2 * 60 * 1000,
|
|
249
249
|
});
|
|
@@ -265,7 +265,7 @@ export function OxyServicesAuthMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
265
265
|
|
|
266
266
|
return await this.makeRequest<Array<{ sessionId: string; user: User | null }>>(
|
|
267
267
|
'POST',
|
|
268
|
-
'/
|
|
268
|
+
'/session/users/batch',
|
|
269
269
|
{ sessionIds: uniqueSessionIds },
|
|
270
270
|
{
|
|
271
271
|
cache: true,
|
|
@@ -285,7 +285,7 @@ export function OxyServicesAuthMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
285
285
|
try {
|
|
286
286
|
const res = await this.makeRequest<{ accessToken: string; expiresAt: string }>(
|
|
287
287
|
'GET',
|
|
288
|
-
`/
|
|
288
|
+
`/session/token/${sessionId}`,
|
|
289
289
|
undefined,
|
|
290
290
|
{ cache: false, retry: false }
|
|
291
291
|
);
|
|
@@ -303,7 +303,7 @@ export function OxyServicesAuthMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
303
303
|
*/
|
|
304
304
|
async getSessionsBySessionId(sessionId: string): Promise<any[]> {
|
|
305
305
|
try {
|
|
306
|
-
return await this.makeRequest('GET', `/
|
|
306
|
+
return await this.makeRequest('GET', `/session/sessions/${sessionId}`, undefined, {
|
|
307
307
|
cache: false,
|
|
308
308
|
});
|
|
309
309
|
} catch (error) {
|
|
@@ -317,8 +317,8 @@ export function OxyServicesAuthMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
317
317
|
async logoutSession(sessionId: string, targetSessionId?: string): Promise<void> {
|
|
318
318
|
try {
|
|
319
319
|
const url = targetSessionId
|
|
320
|
-
? `/
|
|
321
|
-
: `/
|
|
320
|
+
? `/session/logout/${sessionId}/${targetSessionId}`
|
|
321
|
+
: `/session/logout/${sessionId}`;
|
|
322
322
|
|
|
323
323
|
await this.makeRequest('POST', url, undefined, { cache: false });
|
|
324
324
|
} catch (error) {
|
|
@@ -331,7 +331,7 @@ export function OxyServicesAuthMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
331
331
|
*/
|
|
332
332
|
async logoutAllSessions(sessionId: string): Promise<void> {
|
|
333
333
|
try {
|
|
334
|
-
await this.makeRequest('POST', `/
|
|
334
|
+
await this.makeRequest('POST', `/session/logout-all/${sessionId}`, undefined, { cache: false });
|
|
335
335
|
} catch (error) {
|
|
336
336
|
throw this.handleError(error);
|
|
337
337
|
}
|
|
@@ -358,10 +358,10 @@ export function OxyServicesAuthMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
358
358
|
const urlParams: Record<string, string> = {};
|
|
359
359
|
if (options.deviceFingerprint) urlParams.deviceFingerprint = options.deviceFingerprint;
|
|
360
360
|
if (options.useHeaderValidation) urlParams.useHeaderValidation = 'true';
|
|
361
|
-
return await this.makeRequest('GET', `/
|
|
361
|
+
return await this.makeRequest('GET', `/session/validate/${sessionId}`, urlParams, { cache: false });
|
|
362
362
|
} catch (error) {
|
|
363
363
|
// Session is invalid — clear any cached user data for this session (#196)
|
|
364
|
-
this.clearCacheEntry(`GET:/
|
|
364
|
+
this.clearCacheEntry(`GET:/session/user/${sessionId}`);
|
|
365
365
|
throw this.handleError(error);
|
|
366
366
|
}
|
|
367
367
|
}
|
|
@@ -371,7 +371,7 @@ export function OxyServicesAuthMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
371
371
|
*/
|
|
372
372
|
async checkUsernameAvailability(username: string): Promise<{ available: boolean; message: string }> {
|
|
373
373
|
try {
|
|
374
|
-
return await this.makeRequest('GET', `/
|
|
374
|
+
return await this.makeRequest('GET', `/auth/check-username/${username}`, undefined, { cache: false });
|
|
375
375
|
} catch (error) {
|
|
376
376
|
throw this.handleError(error);
|
|
377
377
|
}
|
|
@@ -382,7 +382,7 @@ export function OxyServicesAuthMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
382
382
|
*/
|
|
383
383
|
async checkEmailAvailability(email: string): Promise<{ available: boolean; message: string }> {
|
|
384
384
|
try {
|
|
385
|
-
return await this.makeRequest('GET', `/
|
|
385
|
+
return await this.makeRequest('GET', `/auth/check-email/${email}`, undefined, { cache: false });
|
|
386
386
|
} catch (error) {
|
|
387
387
|
throw this.handleError(error);
|
|
388
388
|
}
|
|
@@ -399,7 +399,7 @@ export function OxyServicesAuthMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
399
399
|
deviceFingerprint?: any
|
|
400
400
|
): Promise<SessionLoginResponse> {
|
|
401
401
|
try {
|
|
402
|
-
return await this.makeRequest<SessionLoginResponse>('POST', '/
|
|
402
|
+
return await this.makeRequest<SessionLoginResponse>('POST', '/auth/signup', {
|
|
403
403
|
username,
|
|
404
404
|
email,
|
|
405
405
|
password,
|
|
@@ -421,7 +421,7 @@ export function OxyServicesAuthMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
421
421
|
deviceFingerprint?: any
|
|
422
422
|
): Promise<SessionLoginResponse> {
|
|
423
423
|
try {
|
|
424
|
-
return await this.makeRequest<SessionLoginResponse>('POST', '/
|
|
424
|
+
return await this.makeRequest<SessionLoginResponse>('POST', '/auth/login', {
|
|
425
425
|
identifier,
|
|
426
426
|
password,
|
|
427
427
|
deviceName,
|
|
@@ -18,7 +18,7 @@ export function OxyServicesDeveloperMixin<T extends typeof OxyServicesBase>(Base
|
|
|
18
18
|
*/
|
|
19
19
|
async getDeveloperApps(): Promise<any[]> {
|
|
20
20
|
try {
|
|
21
|
-
const res = await this.makeRequest<{ apps?: any[] }>('GET', '/
|
|
21
|
+
const res = await this.makeRequest<{ apps?: any[] }>('GET', '/developer/apps', undefined, {
|
|
22
22
|
cache: true,
|
|
23
23
|
cacheTTL: CACHE_TIMES.MEDIUM,
|
|
24
24
|
});
|
|
@@ -41,7 +41,7 @@ export function OxyServicesDeveloperMixin<T extends typeof OxyServicesBase>(Base
|
|
|
41
41
|
scopes?: string[];
|
|
42
42
|
}): Promise<any> {
|
|
43
43
|
try {
|
|
44
|
-
const res = await this.makeRequest<{ app: any }>('POST', '/
|
|
44
|
+
const res = await this.makeRequest<{ app: any }>('POST', '/developer/apps', data, { cache: false });
|
|
45
45
|
return res.app;
|
|
46
46
|
} catch (error) {
|
|
47
47
|
throw this.handleError(error);
|
|
@@ -53,7 +53,7 @@ export function OxyServicesDeveloperMixin<T extends typeof OxyServicesBase>(Base
|
|
|
53
53
|
*/
|
|
54
54
|
async getDeveloperApp(appId: string): Promise<any> {
|
|
55
55
|
try {
|
|
56
|
-
const res = await this.makeRequest<{ app: any }>('GET', `/
|
|
56
|
+
const res = await this.makeRequest<{ app: any }>('GET', `/developer/apps/${appId}`, undefined, {
|
|
57
57
|
cache: true,
|
|
58
58
|
cacheTTL: CACHE_TIMES.LONG,
|
|
59
59
|
});
|
|
@@ -77,7 +77,7 @@ export function OxyServicesDeveloperMixin<T extends typeof OxyServicesBase>(Base
|
|
|
77
77
|
scopes?: string[];
|
|
78
78
|
}): Promise<any> {
|
|
79
79
|
try {
|
|
80
|
-
const res = await this.makeRequest<{ app: any }>('PATCH', `/
|
|
80
|
+
const res = await this.makeRequest<{ app: any }>('PATCH', `/developer/apps/${appId}`, data, { cache: false });
|
|
81
81
|
return res.app;
|
|
82
82
|
} catch (error) {
|
|
83
83
|
throw this.handleError(error);
|
|
@@ -91,7 +91,7 @@ export function OxyServicesDeveloperMixin<T extends typeof OxyServicesBase>(Base
|
|
|
91
91
|
*/
|
|
92
92
|
async regenerateDeveloperAppSecret(appId: string): Promise<any> {
|
|
93
93
|
try {
|
|
94
|
-
return await this.makeRequest('POST', `/
|
|
94
|
+
return await this.makeRequest('POST', `/developer/apps/${appId}/regenerate-secret`, undefined, { cache: false });
|
|
95
95
|
} catch (error) {
|
|
96
96
|
throw this.handleError(error);
|
|
97
97
|
}
|
|
@@ -104,7 +104,7 @@ export function OxyServicesDeveloperMixin<T extends typeof OxyServicesBase>(Base
|
|
|
104
104
|
*/
|
|
105
105
|
async deleteDeveloperApp(appId: string): Promise<any> {
|
|
106
106
|
try {
|
|
107
|
-
return await this.makeRequest('DELETE', `/
|
|
107
|
+
return await this.makeRequest('DELETE', `/developer/apps/${appId}`, undefined, { cache: false });
|
|
108
108
|
} catch (error) {
|
|
109
109
|
throw this.handleError(error);
|
|
110
110
|
}
|
|
@@ -16,7 +16,7 @@ export function OxyServicesDevicesMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
16
16
|
*/
|
|
17
17
|
async registerDevice(deviceData: any): Promise<any> {
|
|
18
18
|
try {
|
|
19
|
-
return await this.makeRequest('POST', '/
|
|
19
|
+
return await this.makeRequest('POST', '/devices', deviceData, { cache: false });
|
|
20
20
|
} catch (error) {
|
|
21
21
|
throw this.handleError(error);
|
|
22
22
|
}
|
|
@@ -28,7 +28,7 @@ export function OxyServicesDevicesMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
28
28
|
*/
|
|
29
29
|
async getUserDevices(): Promise<any[]> {
|
|
30
30
|
try {
|
|
31
|
-
return await this.makeRequest('GET', '/
|
|
31
|
+
return await this.makeRequest('GET', '/devices', undefined, {
|
|
32
32
|
cache: false, // Don't cache device list - always get fresh data
|
|
33
33
|
});
|
|
34
34
|
} catch (error) {
|
|
@@ -42,7 +42,7 @@ export function OxyServicesDevicesMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
42
42
|
*/
|
|
43
43
|
async removeDevice(deviceId: string): Promise<void> {
|
|
44
44
|
try {
|
|
45
|
-
await this.makeRequest('DELETE', `/
|
|
45
|
+
await this.makeRequest('DELETE', `/devices/${deviceId}`, undefined, { cache: false });
|
|
46
46
|
} catch (error) {
|
|
47
47
|
throw this.handleError(error);
|
|
48
48
|
}
|
|
@@ -58,7 +58,7 @@ export function OxyServicesDevicesMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
58
58
|
try {
|
|
59
59
|
// Use makeRequest for consistent error handling and optional caching
|
|
60
60
|
// Cache disabled by default to ensure fresh session data
|
|
61
|
-
return await this.makeRequest<any[]>('GET', `/
|
|
61
|
+
return await this.makeRequest<any[]>('GET', `/session/device/sessions/${sessionId}`, undefined, {
|
|
62
62
|
cache: false, // Don't cache sessions - always get fresh data
|
|
63
63
|
deduplicate: true, // Deduplicate concurrent requests for same sessionId
|
|
64
64
|
});
|
|
@@ -79,7 +79,7 @@ export function OxyServicesDevicesMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
79
79
|
const urlParams: any = {};
|
|
80
80
|
if (deviceId) urlParams.deviceId = deviceId;
|
|
81
81
|
if (excludeCurrent) urlParams.excludeCurrent = 'true';
|
|
82
|
-
return await this.makeRequest('POST', `/
|
|
82
|
+
return await this.makeRequest('POST', `/session/device/logout-all/${sessionId}`, urlParams, { cache: false });
|
|
83
83
|
} catch (error) {
|
|
84
84
|
throw this.handleError(error);
|
|
85
85
|
}
|
|
@@ -93,7 +93,7 @@ export function OxyServicesDevicesMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
93
93
|
*/
|
|
94
94
|
async updateDeviceName(sessionId: string, deviceName: string): Promise<any> {
|
|
95
95
|
try {
|
|
96
|
-
return await this.makeRequest('PUT', `/
|
|
96
|
+
return await this.makeRequest('PUT', `/session/device/name/${sessionId}`, { deviceName }, { cache: false });
|
|
97
97
|
} catch (error) {
|
|
98
98
|
throw this.handleError(error);
|
|
99
99
|
}
|
|
@@ -107,7 +107,7 @@ export function OxyServicesDevicesMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
107
107
|
recoveryEmail: string | null;
|
|
108
108
|
}> {
|
|
109
109
|
try {
|
|
110
|
-
return await this.makeRequest('GET', '/
|
|
110
|
+
return await this.makeRequest('GET', '/devices/security', undefined, {
|
|
111
111
|
cache: false,
|
|
112
112
|
});
|
|
113
113
|
} catch (error) {
|
|
@@ -115,7 +115,7 @@ export function OxyServicesFeaturesMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
115
115
|
*/
|
|
116
116
|
async submitFeedback(payload: FeedbackPayload): Promise<FeedbackResult> {
|
|
117
117
|
try {
|
|
118
|
-
return await this.makeRequest<FeedbackResult>('POST', '/
|
|
118
|
+
return await this.makeRequest<FeedbackResult>('POST', '/feedback', payload, {
|
|
119
119
|
cache: false,
|
|
120
120
|
});
|
|
121
121
|
} catch (error) {
|
|
@@ -132,7 +132,7 @@ export function OxyServicesFeaturesMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
132
132
|
*/
|
|
133
133
|
async getSubscriptionPlans(): Promise<SubscriptionPlan[]> {
|
|
134
134
|
try {
|
|
135
|
-
return await this.makeRequest<SubscriptionPlan[]>('GET', '/
|
|
135
|
+
return await this.makeRequest<SubscriptionPlan[]>('GET', '/subscriptions/plans', undefined, {
|
|
136
136
|
cache: true,
|
|
137
137
|
cacheTTL: CACHE_TIMES.LONG,
|
|
138
138
|
});
|
|
@@ -146,7 +146,7 @@ export function OxyServicesFeaturesMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
146
146
|
*/
|
|
147
147
|
async getIndividualFeatures(): Promise<any[]> {
|
|
148
148
|
try {
|
|
149
|
-
return await this.makeRequest<any[]>('GET', '/
|
|
149
|
+
return await this.makeRequest<any[]>('GET', '/subscriptions/features', undefined, {
|
|
150
150
|
cache: true,
|
|
151
151
|
cacheTTL: CACHE_TIMES.LONG,
|
|
152
152
|
});
|
|
@@ -160,7 +160,7 @@ export function OxyServicesFeaturesMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
160
160
|
*/
|
|
161
161
|
async subscribe(planId: string, paymentMethodId?: string): Promise<SubscriptionResult> {
|
|
162
162
|
return this.withAuthRetry(async () => {
|
|
163
|
-
return await this.makeRequest<SubscriptionResult>('POST', '/
|
|
163
|
+
return await this.makeRequest<SubscriptionResult>('POST', '/subscriptions/subscribe', {
|
|
164
164
|
planId,
|
|
165
165
|
paymentMethodId,
|
|
166
166
|
}, { cache: false });
|
|
@@ -172,7 +172,7 @@ export function OxyServicesFeaturesMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
172
172
|
*/
|
|
173
173
|
async subscribeToFeature(featureId: string, paymentMethodId?: string): Promise<SubscriptionResult> {
|
|
174
174
|
return this.withAuthRetry(async () => {
|
|
175
|
-
return await this.makeRequest<SubscriptionResult>('POST', '/
|
|
175
|
+
return await this.makeRequest<SubscriptionResult>('POST', '/subscriptions/features/subscribe', {
|
|
176
176
|
featureId,
|
|
177
177
|
paymentMethodId,
|
|
178
178
|
}, { cache: false });
|
|
@@ -184,7 +184,7 @@ export function OxyServicesFeaturesMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
184
184
|
*/
|
|
185
185
|
async cancelSubscription(subscriptionId: string): Promise<void> {
|
|
186
186
|
return this.withAuthRetry(async () => {
|
|
187
|
-
await this.makeRequest('POST', `/
|
|
187
|
+
await this.makeRequest('POST', `/subscriptions/${subscriptionId}/cancel`, undefined, {
|
|
188
188
|
cache: false,
|
|
189
189
|
});
|
|
190
190
|
}, 'cancelSubscription');
|
|
@@ -195,7 +195,7 @@ export function OxyServicesFeaturesMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
195
195
|
*/
|
|
196
196
|
async reactivateSubscription(subscriptionId: string): Promise<void> {
|
|
197
197
|
return this.withAuthRetry(async () => {
|
|
198
|
-
await this.makeRequest('POST', `/
|
|
198
|
+
await this.makeRequest('POST', `/subscriptions/${subscriptionId}/reactivate`, undefined, {
|
|
199
199
|
cache: false,
|
|
200
200
|
});
|
|
201
201
|
}, 'reactivateSubscription');
|
|
@@ -207,7 +207,7 @@ export function OxyServicesFeaturesMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
207
207
|
async getCurrentSubscription(): Promise<SubscriptionResult | null> {
|
|
208
208
|
return this.withAuthRetry(async () => {
|
|
209
209
|
try {
|
|
210
|
-
return await this.makeRequest<SubscriptionResult>('GET', '/
|
|
210
|
+
return await this.makeRequest<SubscriptionResult>('GET', '/subscriptions/current', undefined, {
|
|
211
211
|
cache: true,
|
|
212
212
|
cacheTTL: CACHE_TIMES.SHORT,
|
|
213
213
|
});
|
|
@@ -227,7 +227,7 @@ export function OxyServicesFeaturesMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
227
227
|
*/
|
|
228
228
|
async getSavedItems(userId?: string): Promise<SavedItem[]> {
|
|
229
229
|
return this.withAuthRetry(async () => {
|
|
230
|
-
const endpoint = userId ? `/
|
|
230
|
+
const endpoint = userId ? `/users/${userId}/saves` : '/saves';
|
|
231
231
|
return await this.makeRequest<SavedItem[]>('GET', endpoint, undefined, {
|
|
232
232
|
cache: true,
|
|
233
233
|
cacheTTL: CACHE_TIMES.SHORT,
|
|
@@ -240,7 +240,7 @@ export function OxyServicesFeaturesMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
240
240
|
*/
|
|
241
241
|
async getCollections(userId?: string): Promise<Collection[]> {
|
|
242
242
|
return this.withAuthRetry(async () => {
|
|
243
|
-
const endpoint = userId ? `/
|
|
243
|
+
const endpoint = userId ? `/users/${userId}/collections` : '/collections';
|
|
244
244
|
return await this.makeRequest<Collection[]>('GET', endpoint, undefined, {
|
|
245
245
|
cache: true,
|
|
246
246
|
cacheTTL: CACHE_TIMES.SHORT,
|
|
@@ -253,7 +253,7 @@ export function OxyServicesFeaturesMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
253
253
|
*/
|
|
254
254
|
async saveItem(itemId: string, itemType: string, collectionId?: string): Promise<SavedItem> {
|
|
255
255
|
return this.withAuthRetry(async () => {
|
|
256
|
-
return await this.makeRequest<SavedItem>('POST', '/
|
|
256
|
+
return await this.makeRequest<SavedItem>('POST', '/saves', {
|
|
257
257
|
itemId,
|
|
258
258
|
itemType,
|
|
259
259
|
collectionId,
|
|
@@ -266,7 +266,7 @@ export function OxyServicesFeaturesMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
266
266
|
*/
|
|
267
267
|
async removeSavedItem(saveId: string): Promise<void> {
|
|
268
268
|
return this.withAuthRetry(async () => {
|
|
269
|
-
await this.makeRequest('DELETE', `/
|
|
269
|
+
await this.makeRequest('DELETE', `/saves/${saveId}`, undefined, { cache: false });
|
|
270
270
|
}, 'removeSavedItem');
|
|
271
271
|
}
|
|
272
272
|
|
|
@@ -275,7 +275,7 @@ export function OxyServicesFeaturesMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
275
275
|
*/
|
|
276
276
|
async createCollection(name: string, description?: string): Promise<Collection> {
|
|
277
277
|
return this.withAuthRetry(async () => {
|
|
278
|
-
return await this.makeRequest<Collection>('POST', '/
|
|
278
|
+
return await this.makeRequest<Collection>('POST', '/collections', {
|
|
279
279
|
name,
|
|
280
280
|
description,
|
|
281
281
|
}, { cache: false });
|
|
@@ -287,7 +287,7 @@ export function OxyServicesFeaturesMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
287
287
|
*/
|
|
288
288
|
async deleteCollection(collectionId: string): Promise<void> {
|
|
289
289
|
return this.withAuthRetry(async () => {
|
|
290
|
-
await this.makeRequest('DELETE', `/
|
|
290
|
+
await this.makeRequest('DELETE', `/collections/${collectionId}`, undefined, { cache: false });
|
|
291
291
|
}, 'deleteCollection');
|
|
292
292
|
}
|
|
293
293
|
|
|
@@ -300,7 +300,7 @@ export function OxyServicesFeaturesMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
300
300
|
*/
|
|
301
301
|
async getUserStats(userId: string): Promise<UserStats> {
|
|
302
302
|
try {
|
|
303
|
-
return await this.makeRequest<UserStats>('GET', `/
|
|
303
|
+
return await this.makeRequest<UserStats>('GET', `/users/${userId}/stats`, undefined, {
|
|
304
304
|
cache: true,
|
|
305
305
|
cacheTTL: CACHE_TIMES.MEDIUM,
|
|
306
306
|
});
|
|
@@ -322,7 +322,7 @@ export function OxyServicesFeaturesMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
322
322
|
if (limit) params.limit = limit;
|
|
323
323
|
if (offset) params.offset = offset;
|
|
324
324
|
|
|
325
|
-
const endpoint = userId ? `/
|
|
325
|
+
const endpoint = userId ? `/users/${userId}/history` : '/history';
|
|
326
326
|
return await this.makeRequest<HistoryItem[]>('GET', endpoint, params, {
|
|
327
327
|
cache: true,
|
|
328
328
|
cacheTTL: CACHE_TIMES.SHORT,
|
|
@@ -335,7 +335,7 @@ export function OxyServicesFeaturesMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
335
335
|
*/
|
|
336
336
|
async clearUserHistory(): Promise<void> {
|
|
337
337
|
return this.withAuthRetry(async () => {
|
|
338
|
-
await this.makeRequest('DELETE', '/
|
|
338
|
+
await this.makeRequest('DELETE', '/history', undefined, { cache: false });
|
|
339
339
|
}, 'clearUserHistory');
|
|
340
340
|
}
|
|
341
341
|
|
|
@@ -344,7 +344,7 @@ export function OxyServicesFeaturesMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
344
344
|
*/
|
|
345
345
|
async deleteHistoryItem(itemId: string): Promise<void> {
|
|
346
346
|
return this.withAuthRetry(async () => {
|
|
347
|
-
await this.makeRequest('DELETE', `/
|
|
347
|
+
await this.makeRequest('DELETE', `/history/${itemId}`, undefined, { cache: false });
|
|
348
348
|
}, 'deleteHistoryItem');
|
|
349
349
|
}
|
|
350
350
|
|
|
@@ -358,7 +358,7 @@ export function OxyServicesFeaturesMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
358
358
|
async getFAQs(category?: string): Promise<FAQ[]> {
|
|
359
359
|
try {
|
|
360
360
|
const params = category ? { category } : undefined;
|
|
361
|
-
return await this.makeRequest<FAQ[]>('GET', '/
|
|
361
|
+
return await this.makeRequest<FAQ[]>('GET', '/faqs', params, {
|
|
362
362
|
cache: true,
|
|
363
363
|
cacheTTL: CACHE_TIMES.LONG,
|
|
364
364
|
});
|
|
@@ -372,7 +372,7 @@ export function OxyServicesFeaturesMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
372
372
|
*/
|
|
373
373
|
async searchFAQs(query: string): Promise<FAQ[]> {
|
|
374
374
|
try {
|
|
375
|
-
return await this.makeRequest<FAQ[]>('GET', '/
|
|
375
|
+
return await this.makeRequest<FAQ[]>('GET', '/faqs/search', { query }, {
|
|
376
376
|
cache: true,
|
|
377
377
|
cacheTTL: CACHE_TIMES.MEDIUM,
|
|
378
378
|
});
|
|
@@ -390,7 +390,7 @@ export function OxyServicesFeaturesMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
390
390
|
*/
|
|
391
391
|
async getUserAchievements(userId?: string): Promise<Achievement[]> {
|
|
392
392
|
return this.withAuthRetry(async () => {
|
|
393
|
-
const endpoint = userId ? `/
|
|
393
|
+
const endpoint = userId ? `/users/${userId}/achievements` : '/achievements';
|
|
394
394
|
return await this.makeRequest<Achievement[]>('GET', endpoint, undefined, {
|
|
395
395
|
cache: true,
|
|
396
396
|
cacheTTL: CACHE_TIMES.MEDIUM,
|
|
@@ -403,7 +403,7 @@ export function OxyServicesFeaturesMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
403
403
|
*/
|
|
404
404
|
async getAllAchievements(): Promise<Achievement[]> {
|
|
405
405
|
try {
|
|
406
|
-
return await this.makeRequest<Achievement[]>('GET', '/
|
|
406
|
+
return await this.makeRequest<Achievement[]>('GET', '/achievements/all', undefined, {
|
|
407
407
|
cache: true,
|
|
408
408
|
cacheTTL: CACHE_TIMES.LONG,
|
|
409
409
|
});
|
|
@@ -421,7 +421,7 @@ export function OxyServicesFeaturesMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
421
421
|
*/
|
|
422
422
|
async deleteAccount(password: string): Promise<void> {
|
|
423
423
|
return this.withAuthRetry(async () => {
|
|
424
|
-
await this.makeRequest('DELETE', '/
|
|
424
|
+
await this.makeRequest('DELETE', '/account', { password }, { cache: false });
|
|
425
425
|
}, 'deleteAccount');
|
|
426
426
|
}
|
|
427
427
|
};
|
|
@@ -397,7 +397,7 @@ export function OxyServicesFedCMMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
397
397
|
try {
|
|
398
398
|
const response = await this.makeRequest<SessionLoginResponse>(
|
|
399
399
|
'POST',
|
|
400
|
-
'/
|
|
400
|
+
'/fedcm/exchange',
|
|
401
401
|
{ id_token: idToken },
|
|
402
402
|
{ cache: false }
|
|
403
403
|
);
|
|
@@ -16,7 +16,7 @@ export function OxyServicesKarmaMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
16
16
|
*/
|
|
17
17
|
async getUserKarma(userId: string): Promise<any> {
|
|
18
18
|
try {
|
|
19
|
-
return await this.makeRequest('GET', `/
|
|
19
|
+
return await this.makeRequest('GET', `/karma/${userId}`, undefined, {
|
|
20
20
|
cache: true,
|
|
21
21
|
cacheTTL: 2 * 60 * 1000, // 2 minutes cache
|
|
22
22
|
});
|
|
@@ -30,7 +30,7 @@ export function OxyServicesKarmaMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
30
30
|
*/
|
|
31
31
|
async giveKarma(userId: string, amount: number, reason?: string): Promise<any> {
|
|
32
32
|
try {
|
|
33
|
-
return await this.makeRequest('POST', `/
|
|
33
|
+
return await this.makeRequest('POST', `/karma/${userId}/give`, {
|
|
34
34
|
amount,
|
|
35
35
|
reason
|
|
36
36
|
}, { cache: false });
|
|
@@ -46,7 +46,7 @@ export function OxyServicesKarmaMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
46
46
|
*/
|
|
47
47
|
async getUserKarmaTotal(userId: string): Promise<any> {
|
|
48
48
|
try {
|
|
49
|
-
return await this.makeRequest('GET', `/
|
|
49
|
+
return await this.makeRequest('GET', `/karma/${userId}/total`, undefined, {
|
|
50
50
|
cache: true,
|
|
51
51
|
cacheTTL: CACHE_TIMES.MEDIUM,
|
|
52
52
|
});
|
|
@@ -68,7 +68,7 @@ export function OxyServicesKarmaMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
68
68
|
if (limit) params.limit = limit;
|
|
69
69
|
if (offset) params.offset = offset;
|
|
70
70
|
|
|
71
|
-
return await this.makeRequest('GET', `/
|
|
71
|
+
return await this.makeRequest('GET', `/karma/${userId}/history`, params, {
|
|
72
72
|
cache: true,
|
|
73
73
|
cacheTTL: CACHE_TIMES.MEDIUM,
|
|
74
74
|
});
|
|
@@ -83,7 +83,7 @@ export function OxyServicesKarmaMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
83
83
|
*/
|
|
84
84
|
async getKarmaLeaderboard(): Promise<any> {
|
|
85
85
|
try {
|
|
86
|
-
return await this.makeRequest('GET', '/
|
|
86
|
+
return await this.makeRequest('GET', '/karma/leaderboard', undefined, {
|
|
87
87
|
cache: true,
|
|
88
88
|
cacheTTL: CACHE_TIMES.LONG,
|
|
89
89
|
});
|
|
@@ -98,7 +98,7 @@ export function OxyServicesKarmaMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
98
98
|
*/
|
|
99
99
|
async getKarmaRules(): Promise<any> {
|
|
100
100
|
try {
|
|
101
|
-
return await this.makeRequest('GET', '/
|
|
101
|
+
return await this.makeRequest('GET', '/karma/rules', undefined, {
|
|
102
102
|
cache: true,
|
|
103
103
|
cacheTTL: CACHE_TIMES.EXTRA_LONG, // Rules don't change often
|
|
104
104
|
});
|
|
@@ -17,7 +17,7 @@ export function OxyServicesLocationMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
17
17
|
*/
|
|
18
18
|
async updateLocation(latitude: number, longitude: number): Promise<any> {
|
|
19
19
|
try {
|
|
20
|
-
return await this.makeRequest('POST', '/
|
|
20
|
+
return await this.makeRequest('POST', '/location', {
|
|
21
21
|
latitude,
|
|
22
22
|
longitude
|
|
23
23
|
}, { cache: false });
|
|
@@ -34,7 +34,7 @@ export function OxyServicesLocationMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
34
34
|
async getNearbyUsers(radius?: number): Promise<any[]> {
|
|
35
35
|
try {
|
|
36
36
|
const params: any = radius ? { radius } : undefined;
|
|
37
|
-
return await this.makeRequest('GET', '/
|
|
37
|
+
return await this.makeRequest('GET', '/location/nearby', params, {
|
|
38
38
|
cache: false, // Don't cache location data - always get fresh data
|
|
39
39
|
});
|
|
40
40
|
} catch (error) {
|
|
@@ -19,7 +19,7 @@ export function OxyServicesPaymentMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
19
19
|
*/
|
|
20
20
|
async createPayment(data: any): Promise<any> {
|
|
21
21
|
try {
|
|
22
|
-
return await this.makeRequest('POST', '/
|
|
22
|
+
return await this.makeRequest('POST', '/payments', data, { cache: false });
|
|
23
23
|
} catch (error) {
|
|
24
24
|
throw this.handleError(error);
|
|
25
25
|
}
|
|
@@ -32,7 +32,7 @@ export function OxyServicesPaymentMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
32
32
|
*/
|
|
33
33
|
async getPayment(paymentId: string): Promise<any> {
|
|
34
34
|
try {
|
|
35
|
-
return await this.makeRequest('GET', `/
|
|
35
|
+
return await this.makeRequest('GET', `/payments/${paymentId}`, undefined, {
|
|
36
36
|
cache: true,
|
|
37
37
|
cacheTTL: CACHE_TIMES.LONG,
|
|
38
38
|
});
|
|
@@ -47,7 +47,7 @@ export function OxyServicesPaymentMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
47
47
|
*/
|
|
48
48
|
async getUserPayments(): Promise<any[]> {
|
|
49
49
|
try {
|
|
50
|
-
return await this.makeRequest('GET', '/
|
|
50
|
+
return await this.makeRequest('GET', '/payments/user', undefined, {
|
|
51
51
|
cache: false, // Don't cache user payments - always get fresh data
|
|
52
52
|
});
|
|
53
53
|
} catch (error) {
|
|
@@ -62,7 +62,7 @@ export function OxyServicesPaymentMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
62
62
|
*/
|
|
63
63
|
async getSubscription(userId: string): Promise<any> {
|
|
64
64
|
try {
|
|
65
|
-
return await this.makeRequest('GET', `/
|
|
65
|
+
return await this.makeRequest('GET', `/subscription/${userId}`, undefined, {
|
|
66
66
|
cache: true,
|
|
67
67
|
cacheTTL: CACHE_TIMES.MEDIUM,
|
|
68
68
|
});
|
|
@@ -94,7 +94,7 @@ export function OxyServicesPaymentMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
94
94
|
*/
|
|
95
95
|
async getWallet(userId: string): Promise<any> {
|
|
96
96
|
try {
|
|
97
|
-
return await this.makeRequest('GET', `/
|
|
97
|
+
return await this.makeRequest('GET', `/wallet/${userId}`, undefined, {
|
|
98
98
|
cache: true,
|
|
99
99
|
cacheTTL: CACHE_TIMES.SHORT, // Cache wallet for short time as balance changes frequently
|
|
100
100
|
});
|
|
@@ -132,7 +132,7 @@ export function OxyServicesPaymentMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
132
132
|
if (options?.offset) params.append('offset', options.offset.toString());
|
|
133
133
|
|
|
134
134
|
const queryString = params.toString();
|
|
135
|
-
const url = `/
|
|
135
|
+
const url = `/wallet/transactions/${userId}${queryString ? `?${queryString}` : ''}`;
|
|
136
136
|
|
|
137
137
|
return await this.makeRequest('GET', url, undefined, {
|
|
138
138
|
cache: false, // Don't cache transactions - always get fresh data
|
|
@@ -120,7 +120,7 @@ export function OxyServicesPopupAuthMixin<T extends typeof OxyServicesBase>(Base
|
|
|
120
120
|
try {
|
|
121
121
|
const userData = await this.makeRequest<any>(
|
|
122
122
|
'GET',
|
|
123
|
-
`/
|
|
123
|
+
`/session/user/${session.sessionId}`,
|
|
124
124
|
undefined,
|
|
125
125
|
{ cache: false }
|
|
126
126
|
);
|