@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
|
@@ -43,7 +43,7 @@ function OxyServicesAuthMixin(Base) {
|
|
|
43
43
|
if (this._serviceToken && this._serviceTokenExp > Date.now() + 60000) {
|
|
44
44
|
return this._serviceToken;
|
|
45
45
|
}
|
|
46
|
-
const response = await this.makeRequest('POST', '/
|
|
46
|
+
const response = await this.makeRequest('POST', '/auth/service-token', { apiKey: key, apiSecret: secret }, { cache: false, retry: false });
|
|
47
47
|
this._serviceToken = response.token;
|
|
48
48
|
this._serviceTokenExp = Date.now() + response.expiresIn * 1000;
|
|
49
49
|
return this._serviceToken;
|
|
@@ -77,7 +77,7 @@ function OxyServicesAuthMixin(Base) {
|
|
|
77
77
|
*/
|
|
78
78
|
async register(publicKey, signature, timestamp) {
|
|
79
79
|
try {
|
|
80
|
-
const res = await this.makeRequest('POST', '/
|
|
80
|
+
const res = await this.makeRequest('POST', '/auth/register', {
|
|
81
81
|
publicKey,
|
|
82
82
|
signature,
|
|
83
83
|
timestamp,
|
|
@@ -99,7 +99,7 @@ function OxyServicesAuthMixin(Base) {
|
|
|
99
99
|
*/
|
|
100
100
|
async requestChallenge(publicKey) {
|
|
101
101
|
try {
|
|
102
|
-
return await this.makeRequest('POST', '/
|
|
102
|
+
return await this.makeRequest('POST', '/auth/challenge', {
|
|
103
103
|
publicKey,
|
|
104
104
|
}, { cache: false });
|
|
105
105
|
}
|
|
@@ -119,7 +119,7 @@ function OxyServicesAuthMixin(Base) {
|
|
|
119
119
|
*/
|
|
120
120
|
async verifyChallenge(publicKey, challenge, signature, timestamp, deviceName, deviceFingerprint) {
|
|
121
121
|
try {
|
|
122
|
-
return await this.makeRequest('POST', '/
|
|
122
|
+
return await this.makeRequest('POST', '/auth/verify', {
|
|
123
123
|
publicKey,
|
|
124
124
|
challenge,
|
|
125
125
|
signature,
|
|
@@ -137,7 +137,7 @@ function OxyServicesAuthMixin(Base) {
|
|
|
137
137
|
*/
|
|
138
138
|
async checkPublicKeyRegistered(publicKey) {
|
|
139
139
|
try {
|
|
140
|
-
return await this.makeRequest('GET', `/
|
|
140
|
+
return await this.makeRequest('GET', `/auth/check-publickey/${encodeURIComponent(publicKey)}`, undefined, { cache: false });
|
|
141
141
|
}
|
|
142
142
|
catch (error) {
|
|
143
143
|
throw this.handleError(error);
|
|
@@ -148,7 +148,7 @@ function OxyServicesAuthMixin(Base) {
|
|
|
148
148
|
*/
|
|
149
149
|
async getUserByPublicKey(publicKey) {
|
|
150
150
|
try {
|
|
151
|
-
return await this.makeRequest('GET', `/
|
|
151
|
+
return await this.makeRequest('GET', `/auth/user/${encodeURIComponent(publicKey)}`, undefined, { cache: true, cacheTTL: 2 * 60 * 1000 });
|
|
152
152
|
}
|
|
153
153
|
catch (error) {
|
|
154
154
|
throw this.handleError(error);
|
|
@@ -159,7 +159,7 @@ function OxyServicesAuthMixin(Base) {
|
|
|
159
159
|
*/
|
|
160
160
|
async getUserBySession(sessionId) {
|
|
161
161
|
try {
|
|
162
|
-
return await this.makeRequest('GET', `/
|
|
162
|
+
return await this.makeRequest('GET', `/session/user/${sessionId}`, undefined, {
|
|
163
163
|
cache: true,
|
|
164
164
|
cacheTTL: 2 * 60 * 1000,
|
|
165
165
|
});
|
|
@@ -177,7 +177,7 @@ function OxyServicesAuthMixin(Base) {
|
|
|
177
177
|
return [];
|
|
178
178
|
}
|
|
179
179
|
const uniqueSessionIds = Array.from(new Set(sessionIds)).sort();
|
|
180
|
-
return await this.makeRequest('POST', '/
|
|
180
|
+
return await this.makeRequest('POST', '/session/users/batch', { sessionIds: uniqueSessionIds }, {
|
|
181
181
|
cache: true,
|
|
182
182
|
cacheTTL: 2 * 60 * 1000,
|
|
183
183
|
deduplicate: true,
|
|
@@ -192,7 +192,7 @@ function OxyServicesAuthMixin(Base) {
|
|
|
192
192
|
*/
|
|
193
193
|
async getTokenBySession(sessionId) {
|
|
194
194
|
try {
|
|
195
|
-
const res = await this.makeRequest('GET', `/
|
|
195
|
+
const res = await this.makeRequest('GET', `/session/token/${sessionId}`, undefined, { cache: false, retry: false });
|
|
196
196
|
this.setTokens(res.accessToken);
|
|
197
197
|
return res;
|
|
198
198
|
}
|
|
@@ -205,7 +205,7 @@ function OxyServicesAuthMixin(Base) {
|
|
|
205
205
|
*/
|
|
206
206
|
async getSessionsBySessionId(sessionId) {
|
|
207
207
|
try {
|
|
208
|
-
return await this.makeRequest('GET', `/
|
|
208
|
+
return await this.makeRequest('GET', `/session/sessions/${sessionId}`, undefined, {
|
|
209
209
|
cache: false,
|
|
210
210
|
});
|
|
211
211
|
}
|
|
@@ -219,8 +219,8 @@ function OxyServicesAuthMixin(Base) {
|
|
|
219
219
|
async logoutSession(sessionId, targetSessionId) {
|
|
220
220
|
try {
|
|
221
221
|
const url = targetSessionId
|
|
222
|
-
? `/
|
|
223
|
-
: `/
|
|
222
|
+
? `/session/logout/${sessionId}/${targetSessionId}`
|
|
223
|
+
: `/session/logout/${sessionId}`;
|
|
224
224
|
await this.makeRequest('POST', url, undefined, { cache: false });
|
|
225
225
|
}
|
|
226
226
|
catch (error) {
|
|
@@ -232,7 +232,7 @@ function OxyServicesAuthMixin(Base) {
|
|
|
232
232
|
*/
|
|
233
233
|
async logoutAllSessions(sessionId) {
|
|
234
234
|
try {
|
|
235
|
-
await this.makeRequest('POST', `/
|
|
235
|
+
await this.makeRequest('POST', `/session/logout-all/${sessionId}`, undefined, { cache: false });
|
|
236
236
|
}
|
|
237
237
|
catch (error) {
|
|
238
238
|
throw this.handleError(error);
|
|
@@ -248,11 +248,11 @@ function OxyServicesAuthMixin(Base) {
|
|
|
248
248
|
urlParams.deviceFingerprint = options.deviceFingerprint;
|
|
249
249
|
if (options.useHeaderValidation)
|
|
250
250
|
urlParams.useHeaderValidation = 'true';
|
|
251
|
-
return await this.makeRequest('GET', `/
|
|
251
|
+
return await this.makeRequest('GET', `/session/validate/${sessionId}`, urlParams, { cache: false });
|
|
252
252
|
}
|
|
253
253
|
catch (error) {
|
|
254
254
|
// Session is invalid — clear any cached user data for this session (#196)
|
|
255
|
-
this.clearCacheEntry(`GET:/
|
|
255
|
+
this.clearCacheEntry(`GET:/session/user/${sessionId}`);
|
|
256
256
|
throw this.handleError(error);
|
|
257
257
|
}
|
|
258
258
|
}
|
|
@@ -261,7 +261,7 @@ function OxyServicesAuthMixin(Base) {
|
|
|
261
261
|
*/
|
|
262
262
|
async checkUsernameAvailability(username) {
|
|
263
263
|
try {
|
|
264
|
-
return await this.makeRequest('GET', `/
|
|
264
|
+
return await this.makeRequest('GET', `/auth/check-username/${username}`, undefined, { cache: false });
|
|
265
265
|
}
|
|
266
266
|
catch (error) {
|
|
267
267
|
throw this.handleError(error);
|
|
@@ -272,7 +272,7 @@ function OxyServicesAuthMixin(Base) {
|
|
|
272
272
|
*/
|
|
273
273
|
async checkEmailAvailability(email) {
|
|
274
274
|
try {
|
|
275
|
-
return await this.makeRequest('GET', `/
|
|
275
|
+
return await this.makeRequest('GET', `/auth/check-email/${email}`, undefined, { cache: false });
|
|
276
276
|
}
|
|
277
277
|
catch (error) {
|
|
278
278
|
throw this.handleError(error);
|
|
@@ -283,7 +283,7 @@ function OxyServicesAuthMixin(Base) {
|
|
|
283
283
|
*/
|
|
284
284
|
async signUp(username, email, password, deviceName, deviceFingerprint) {
|
|
285
285
|
try {
|
|
286
|
-
return await this.makeRequest('POST', '/
|
|
286
|
+
return await this.makeRequest('POST', '/auth/signup', {
|
|
287
287
|
username,
|
|
288
288
|
email,
|
|
289
289
|
password,
|
|
@@ -300,7 +300,7 @@ function OxyServicesAuthMixin(Base) {
|
|
|
300
300
|
*/
|
|
301
301
|
async signIn(identifier, password, deviceName, deviceFingerprint) {
|
|
302
302
|
try {
|
|
303
|
-
return await this.makeRequest('POST', '/
|
|
303
|
+
return await this.makeRequest('POST', '/auth/login', {
|
|
304
304
|
identifier,
|
|
305
305
|
password,
|
|
306
306
|
deviceName,
|
|
@@ -13,7 +13,7 @@ function OxyServicesDeveloperMixin(Base) {
|
|
|
13
13
|
*/
|
|
14
14
|
async getDeveloperApps() {
|
|
15
15
|
try {
|
|
16
|
-
const res = await this.makeRequest('GET', '/
|
|
16
|
+
const res = await this.makeRequest('GET', '/developer/apps', undefined, {
|
|
17
17
|
cache: true,
|
|
18
18
|
cacheTTL: mixinHelpers_1.CACHE_TIMES.MEDIUM,
|
|
19
19
|
});
|
|
@@ -30,7 +30,7 @@ function OxyServicesDeveloperMixin(Base) {
|
|
|
30
30
|
*/
|
|
31
31
|
async createDeveloperApp(data) {
|
|
32
32
|
try {
|
|
33
|
-
const res = await this.makeRequest('POST', '/
|
|
33
|
+
const res = await this.makeRequest('POST', '/developer/apps', data, { cache: false });
|
|
34
34
|
return res.app;
|
|
35
35
|
}
|
|
36
36
|
catch (error) {
|
|
@@ -42,7 +42,7 @@ function OxyServicesDeveloperMixin(Base) {
|
|
|
42
42
|
*/
|
|
43
43
|
async getDeveloperApp(appId) {
|
|
44
44
|
try {
|
|
45
|
-
const res = await this.makeRequest('GET', `/
|
|
45
|
+
const res = await this.makeRequest('GET', `/developer/apps/${appId}`, undefined, {
|
|
46
46
|
cache: true,
|
|
47
47
|
cacheTTL: mixinHelpers_1.CACHE_TIMES.LONG,
|
|
48
48
|
});
|
|
@@ -60,7 +60,7 @@ function OxyServicesDeveloperMixin(Base) {
|
|
|
60
60
|
*/
|
|
61
61
|
async updateDeveloperApp(appId, data) {
|
|
62
62
|
try {
|
|
63
|
-
const res = await this.makeRequest('PATCH', `/
|
|
63
|
+
const res = await this.makeRequest('PATCH', `/developer/apps/${appId}`, data, { cache: false });
|
|
64
64
|
return res.app;
|
|
65
65
|
}
|
|
66
66
|
catch (error) {
|
|
@@ -74,7 +74,7 @@ function OxyServicesDeveloperMixin(Base) {
|
|
|
74
74
|
*/
|
|
75
75
|
async regenerateDeveloperAppSecret(appId) {
|
|
76
76
|
try {
|
|
77
|
-
return await this.makeRequest('POST', `/
|
|
77
|
+
return await this.makeRequest('POST', `/developer/apps/${appId}/regenerate-secret`, undefined, { cache: false });
|
|
78
78
|
}
|
|
79
79
|
catch (error) {
|
|
80
80
|
throw this.handleError(error);
|
|
@@ -87,7 +87,7 @@ function OxyServicesDeveloperMixin(Base) {
|
|
|
87
87
|
*/
|
|
88
88
|
async deleteDeveloperApp(appId) {
|
|
89
89
|
try {
|
|
90
|
-
return await this.makeRequest('DELETE', `/
|
|
90
|
+
return await this.makeRequest('DELETE', `/developer/apps/${appId}`, undefined, { cache: false });
|
|
91
91
|
}
|
|
92
92
|
catch (error) {
|
|
93
93
|
throw this.handleError(error);
|
|
@@ -13,7 +13,7 @@ function OxyServicesDevicesMixin(Base) {
|
|
|
13
13
|
*/
|
|
14
14
|
async registerDevice(deviceData) {
|
|
15
15
|
try {
|
|
16
|
-
return await this.makeRequest('POST', '/
|
|
16
|
+
return await this.makeRequest('POST', '/devices', deviceData, { cache: false });
|
|
17
17
|
}
|
|
18
18
|
catch (error) {
|
|
19
19
|
throw this.handleError(error);
|
|
@@ -25,7 +25,7 @@ function OxyServicesDevicesMixin(Base) {
|
|
|
25
25
|
*/
|
|
26
26
|
async getUserDevices() {
|
|
27
27
|
try {
|
|
28
|
-
return await this.makeRequest('GET', '/
|
|
28
|
+
return await this.makeRequest('GET', '/devices', undefined, {
|
|
29
29
|
cache: false, // Don't cache device list - always get fresh data
|
|
30
30
|
});
|
|
31
31
|
}
|
|
@@ -39,7 +39,7 @@ function OxyServicesDevicesMixin(Base) {
|
|
|
39
39
|
*/
|
|
40
40
|
async removeDevice(deviceId) {
|
|
41
41
|
try {
|
|
42
|
-
await this.makeRequest('DELETE', `/
|
|
42
|
+
await this.makeRequest('DELETE', `/devices/${deviceId}`, undefined, { cache: false });
|
|
43
43
|
}
|
|
44
44
|
catch (error) {
|
|
45
45
|
throw this.handleError(error);
|
|
@@ -55,7 +55,7 @@ function OxyServicesDevicesMixin(Base) {
|
|
|
55
55
|
try {
|
|
56
56
|
// Use makeRequest for consistent error handling and optional caching
|
|
57
57
|
// Cache disabled by default to ensure fresh session data
|
|
58
|
-
return await this.makeRequest('GET', `/
|
|
58
|
+
return await this.makeRequest('GET', `/session/device/sessions/${sessionId}`, undefined, {
|
|
59
59
|
cache: false, // Don't cache sessions - always get fresh data
|
|
60
60
|
deduplicate: true, // Deduplicate concurrent requests for same sessionId
|
|
61
61
|
});
|
|
@@ -78,7 +78,7 @@ function OxyServicesDevicesMixin(Base) {
|
|
|
78
78
|
urlParams.deviceId = deviceId;
|
|
79
79
|
if (excludeCurrent)
|
|
80
80
|
urlParams.excludeCurrent = 'true';
|
|
81
|
-
return await this.makeRequest('POST', `/
|
|
81
|
+
return await this.makeRequest('POST', `/session/device/logout-all/${sessionId}`, urlParams, { cache: false });
|
|
82
82
|
}
|
|
83
83
|
catch (error) {
|
|
84
84
|
throw this.handleError(error);
|
|
@@ -92,7 +92,7 @@ function OxyServicesDevicesMixin(Base) {
|
|
|
92
92
|
*/
|
|
93
93
|
async updateDeviceName(sessionId, deviceName) {
|
|
94
94
|
try {
|
|
95
|
-
return await this.makeRequest('PUT', `/
|
|
95
|
+
return await this.makeRequest('PUT', `/session/device/name/${sessionId}`, { deviceName }, { cache: false });
|
|
96
96
|
}
|
|
97
97
|
catch (error) {
|
|
98
98
|
throw this.handleError(error);
|
|
@@ -104,7 +104,7 @@ function OxyServicesDevicesMixin(Base) {
|
|
|
104
104
|
*/
|
|
105
105
|
async getSecurityInfo() {
|
|
106
106
|
try {
|
|
107
|
-
return await this.makeRequest('GET', '/
|
|
107
|
+
return await this.makeRequest('GET', '/devices/security', undefined, {
|
|
108
108
|
cache: false,
|
|
109
109
|
});
|
|
110
110
|
}
|
|
@@ -15,7 +15,7 @@ function OxyServicesFeaturesMixin(Base) {
|
|
|
15
15
|
*/
|
|
16
16
|
async submitFeedback(payload) {
|
|
17
17
|
try {
|
|
18
|
-
return await this.makeRequest('POST', '/
|
|
18
|
+
return await this.makeRequest('POST', '/feedback', payload, {
|
|
19
19
|
cache: false,
|
|
20
20
|
});
|
|
21
21
|
}
|
|
@@ -31,7 +31,7 @@ function OxyServicesFeaturesMixin(Base) {
|
|
|
31
31
|
*/
|
|
32
32
|
async getSubscriptionPlans() {
|
|
33
33
|
try {
|
|
34
|
-
return await this.makeRequest('GET', '/
|
|
34
|
+
return await this.makeRequest('GET', '/subscriptions/plans', undefined, {
|
|
35
35
|
cache: true,
|
|
36
36
|
cacheTTL: mixinHelpers_1.CACHE_TIMES.LONG,
|
|
37
37
|
});
|
|
@@ -45,7 +45,7 @@ function OxyServicesFeaturesMixin(Base) {
|
|
|
45
45
|
*/
|
|
46
46
|
async getIndividualFeatures() {
|
|
47
47
|
try {
|
|
48
|
-
return await this.makeRequest('GET', '/
|
|
48
|
+
return await this.makeRequest('GET', '/subscriptions/features', undefined, {
|
|
49
49
|
cache: true,
|
|
50
50
|
cacheTTL: mixinHelpers_1.CACHE_TIMES.LONG,
|
|
51
51
|
});
|
|
@@ -59,7 +59,7 @@ function OxyServicesFeaturesMixin(Base) {
|
|
|
59
59
|
*/
|
|
60
60
|
async subscribe(planId, paymentMethodId) {
|
|
61
61
|
return this.withAuthRetry(async () => {
|
|
62
|
-
return await this.makeRequest('POST', '/
|
|
62
|
+
return await this.makeRequest('POST', '/subscriptions/subscribe', {
|
|
63
63
|
planId,
|
|
64
64
|
paymentMethodId,
|
|
65
65
|
}, { cache: false });
|
|
@@ -70,7 +70,7 @@ function OxyServicesFeaturesMixin(Base) {
|
|
|
70
70
|
*/
|
|
71
71
|
async subscribeToFeature(featureId, paymentMethodId) {
|
|
72
72
|
return this.withAuthRetry(async () => {
|
|
73
|
-
return await this.makeRequest('POST', '/
|
|
73
|
+
return await this.makeRequest('POST', '/subscriptions/features/subscribe', {
|
|
74
74
|
featureId,
|
|
75
75
|
paymentMethodId,
|
|
76
76
|
}, { cache: false });
|
|
@@ -81,7 +81,7 @@ function OxyServicesFeaturesMixin(Base) {
|
|
|
81
81
|
*/
|
|
82
82
|
async cancelSubscription(subscriptionId) {
|
|
83
83
|
return this.withAuthRetry(async () => {
|
|
84
|
-
await this.makeRequest('POST', `/
|
|
84
|
+
await this.makeRequest('POST', `/subscriptions/${subscriptionId}/cancel`, undefined, {
|
|
85
85
|
cache: false,
|
|
86
86
|
});
|
|
87
87
|
}, 'cancelSubscription');
|
|
@@ -91,7 +91,7 @@ function OxyServicesFeaturesMixin(Base) {
|
|
|
91
91
|
*/
|
|
92
92
|
async reactivateSubscription(subscriptionId) {
|
|
93
93
|
return this.withAuthRetry(async () => {
|
|
94
|
-
await this.makeRequest('POST', `/
|
|
94
|
+
await this.makeRequest('POST', `/subscriptions/${subscriptionId}/reactivate`, undefined, {
|
|
95
95
|
cache: false,
|
|
96
96
|
});
|
|
97
97
|
}, 'reactivateSubscription');
|
|
@@ -102,7 +102,7 @@ function OxyServicesFeaturesMixin(Base) {
|
|
|
102
102
|
async getCurrentSubscription() {
|
|
103
103
|
return this.withAuthRetry(async () => {
|
|
104
104
|
try {
|
|
105
|
-
return await this.makeRequest('GET', '/
|
|
105
|
+
return await this.makeRequest('GET', '/subscriptions/current', undefined, {
|
|
106
106
|
cache: true,
|
|
107
107
|
cacheTTL: mixinHelpers_1.CACHE_TIMES.SHORT,
|
|
108
108
|
});
|
|
@@ -122,7 +122,7 @@ function OxyServicesFeaturesMixin(Base) {
|
|
|
122
122
|
*/
|
|
123
123
|
async getSavedItems(userId) {
|
|
124
124
|
return this.withAuthRetry(async () => {
|
|
125
|
-
const endpoint = userId ? `/
|
|
125
|
+
const endpoint = userId ? `/users/${userId}/saves` : '/saves';
|
|
126
126
|
return await this.makeRequest('GET', endpoint, undefined, {
|
|
127
127
|
cache: true,
|
|
128
128
|
cacheTTL: mixinHelpers_1.CACHE_TIMES.SHORT,
|
|
@@ -134,7 +134,7 @@ function OxyServicesFeaturesMixin(Base) {
|
|
|
134
134
|
*/
|
|
135
135
|
async getCollections(userId) {
|
|
136
136
|
return this.withAuthRetry(async () => {
|
|
137
|
-
const endpoint = userId ? `/
|
|
137
|
+
const endpoint = userId ? `/users/${userId}/collections` : '/collections';
|
|
138
138
|
return await this.makeRequest('GET', endpoint, undefined, {
|
|
139
139
|
cache: true,
|
|
140
140
|
cacheTTL: mixinHelpers_1.CACHE_TIMES.SHORT,
|
|
@@ -146,7 +146,7 @@ function OxyServicesFeaturesMixin(Base) {
|
|
|
146
146
|
*/
|
|
147
147
|
async saveItem(itemId, itemType, collectionId) {
|
|
148
148
|
return this.withAuthRetry(async () => {
|
|
149
|
-
return await this.makeRequest('POST', '/
|
|
149
|
+
return await this.makeRequest('POST', '/saves', {
|
|
150
150
|
itemId,
|
|
151
151
|
itemType,
|
|
152
152
|
collectionId,
|
|
@@ -158,7 +158,7 @@ function OxyServicesFeaturesMixin(Base) {
|
|
|
158
158
|
*/
|
|
159
159
|
async removeSavedItem(saveId) {
|
|
160
160
|
return this.withAuthRetry(async () => {
|
|
161
|
-
await this.makeRequest('DELETE', `/
|
|
161
|
+
await this.makeRequest('DELETE', `/saves/${saveId}`, undefined, { cache: false });
|
|
162
162
|
}, 'removeSavedItem');
|
|
163
163
|
}
|
|
164
164
|
/**
|
|
@@ -166,7 +166,7 @@ function OxyServicesFeaturesMixin(Base) {
|
|
|
166
166
|
*/
|
|
167
167
|
async createCollection(name, description) {
|
|
168
168
|
return this.withAuthRetry(async () => {
|
|
169
|
-
return await this.makeRequest('POST', '/
|
|
169
|
+
return await this.makeRequest('POST', '/collections', {
|
|
170
170
|
name,
|
|
171
171
|
description,
|
|
172
172
|
}, { cache: false });
|
|
@@ -177,7 +177,7 @@ function OxyServicesFeaturesMixin(Base) {
|
|
|
177
177
|
*/
|
|
178
178
|
async deleteCollection(collectionId) {
|
|
179
179
|
return this.withAuthRetry(async () => {
|
|
180
|
-
await this.makeRequest('DELETE', `/
|
|
180
|
+
await this.makeRequest('DELETE', `/collections/${collectionId}`, undefined, { cache: false });
|
|
181
181
|
}, 'deleteCollection');
|
|
182
182
|
}
|
|
183
183
|
// ==================
|
|
@@ -188,7 +188,7 @@ function OxyServicesFeaturesMixin(Base) {
|
|
|
188
188
|
*/
|
|
189
189
|
async getUserStats(userId) {
|
|
190
190
|
try {
|
|
191
|
-
return await this.makeRequest('GET', `/
|
|
191
|
+
return await this.makeRequest('GET', `/users/${userId}/stats`, undefined, {
|
|
192
192
|
cache: true,
|
|
193
193
|
cacheTTL: mixinHelpers_1.CACHE_TIMES.MEDIUM,
|
|
194
194
|
});
|
|
@@ -210,7 +210,7 @@ function OxyServicesFeaturesMixin(Base) {
|
|
|
210
210
|
params.limit = limit;
|
|
211
211
|
if (offset)
|
|
212
212
|
params.offset = offset;
|
|
213
|
-
const endpoint = userId ? `/
|
|
213
|
+
const endpoint = userId ? `/users/${userId}/history` : '/history';
|
|
214
214
|
return await this.makeRequest('GET', endpoint, params, {
|
|
215
215
|
cache: true,
|
|
216
216
|
cacheTTL: mixinHelpers_1.CACHE_TIMES.SHORT,
|
|
@@ -222,7 +222,7 @@ function OxyServicesFeaturesMixin(Base) {
|
|
|
222
222
|
*/
|
|
223
223
|
async clearUserHistory() {
|
|
224
224
|
return this.withAuthRetry(async () => {
|
|
225
|
-
await this.makeRequest('DELETE', '/
|
|
225
|
+
await this.makeRequest('DELETE', '/history', undefined, { cache: false });
|
|
226
226
|
}, 'clearUserHistory');
|
|
227
227
|
}
|
|
228
228
|
/**
|
|
@@ -230,7 +230,7 @@ function OxyServicesFeaturesMixin(Base) {
|
|
|
230
230
|
*/
|
|
231
231
|
async deleteHistoryItem(itemId) {
|
|
232
232
|
return this.withAuthRetry(async () => {
|
|
233
|
-
await this.makeRequest('DELETE', `/
|
|
233
|
+
await this.makeRequest('DELETE', `/history/${itemId}`, undefined, { cache: false });
|
|
234
234
|
}, 'deleteHistoryItem');
|
|
235
235
|
}
|
|
236
236
|
// ==================
|
|
@@ -242,7 +242,7 @@ function OxyServicesFeaturesMixin(Base) {
|
|
|
242
242
|
async getFAQs(category) {
|
|
243
243
|
try {
|
|
244
244
|
const params = category ? { category } : undefined;
|
|
245
|
-
return await this.makeRequest('GET', '/
|
|
245
|
+
return await this.makeRequest('GET', '/faqs', params, {
|
|
246
246
|
cache: true,
|
|
247
247
|
cacheTTL: mixinHelpers_1.CACHE_TIMES.LONG,
|
|
248
248
|
});
|
|
@@ -256,7 +256,7 @@ function OxyServicesFeaturesMixin(Base) {
|
|
|
256
256
|
*/
|
|
257
257
|
async searchFAQs(query) {
|
|
258
258
|
try {
|
|
259
|
-
return await this.makeRequest('GET', '/
|
|
259
|
+
return await this.makeRequest('GET', '/faqs/search', { query }, {
|
|
260
260
|
cache: true,
|
|
261
261
|
cacheTTL: mixinHelpers_1.CACHE_TIMES.MEDIUM,
|
|
262
262
|
});
|
|
@@ -273,7 +273,7 @@ function OxyServicesFeaturesMixin(Base) {
|
|
|
273
273
|
*/
|
|
274
274
|
async getUserAchievements(userId) {
|
|
275
275
|
return this.withAuthRetry(async () => {
|
|
276
|
-
const endpoint = userId ? `/
|
|
276
|
+
const endpoint = userId ? `/users/${userId}/achievements` : '/achievements';
|
|
277
277
|
return await this.makeRequest('GET', endpoint, undefined, {
|
|
278
278
|
cache: true,
|
|
279
279
|
cacheTTL: mixinHelpers_1.CACHE_TIMES.MEDIUM,
|
|
@@ -285,7 +285,7 @@ function OxyServicesFeaturesMixin(Base) {
|
|
|
285
285
|
*/
|
|
286
286
|
async getAllAchievements() {
|
|
287
287
|
try {
|
|
288
|
-
return await this.makeRequest('GET', '/
|
|
288
|
+
return await this.makeRequest('GET', '/achievements/all', undefined, {
|
|
289
289
|
cache: true,
|
|
290
290
|
cacheTTL: mixinHelpers_1.CACHE_TIMES.LONG,
|
|
291
291
|
});
|
|
@@ -302,7 +302,7 @@ function OxyServicesFeaturesMixin(Base) {
|
|
|
302
302
|
*/
|
|
303
303
|
async deleteAccount(password) {
|
|
304
304
|
return this.withAuthRetry(async () => {
|
|
305
|
-
await this.makeRequest('DELETE', '/
|
|
305
|
+
await this.makeRequest('DELETE', '/account', { password }, { cache: false });
|
|
306
306
|
}, 'deleteAccount');
|
|
307
307
|
}
|
|
308
308
|
};
|
|
@@ -344,7 +344,7 @@ function OxyServicesFedCMMixin(Base) {
|
|
|
344
344
|
async exchangeIdTokenForSession(idToken) {
|
|
345
345
|
debug.log('Exchanging ID token for session...');
|
|
346
346
|
try {
|
|
347
|
-
const response = await this.makeRequest('POST', '/
|
|
347
|
+
const response = await this.makeRequest('POST', '/fedcm/exchange', { id_token: idToken }, { cache: false });
|
|
348
348
|
debug.log('Token exchange complete:', {
|
|
349
349
|
hasSession: !!response?.sessionId,
|
|
350
350
|
hasUser: !!response?.user,
|
|
@@ -12,7 +12,7 @@ function OxyServicesKarmaMixin(Base) {
|
|
|
12
12
|
*/
|
|
13
13
|
async getUserKarma(userId) {
|
|
14
14
|
try {
|
|
15
|
-
return await this.makeRequest('GET', `/
|
|
15
|
+
return await this.makeRequest('GET', `/karma/${userId}`, undefined, {
|
|
16
16
|
cache: true,
|
|
17
17
|
cacheTTL: 2 * 60 * 1000, // 2 minutes cache
|
|
18
18
|
});
|
|
@@ -26,7 +26,7 @@ function OxyServicesKarmaMixin(Base) {
|
|
|
26
26
|
*/
|
|
27
27
|
async giveKarma(userId, amount, reason) {
|
|
28
28
|
try {
|
|
29
|
-
return await this.makeRequest('POST', `/
|
|
29
|
+
return await this.makeRequest('POST', `/karma/${userId}/give`, {
|
|
30
30
|
amount,
|
|
31
31
|
reason
|
|
32
32
|
}, { cache: false });
|
|
@@ -42,7 +42,7 @@ function OxyServicesKarmaMixin(Base) {
|
|
|
42
42
|
*/
|
|
43
43
|
async getUserKarmaTotal(userId) {
|
|
44
44
|
try {
|
|
45
|
-
return await this.makeRequest('GET', `/
|
|
45
|
+
return await this.makeRequest('GET', `/karma/${userId}/total`, undefined, {
|
|
46
46
|
cache: true,
|
|
47
47
|
cacheTTL: mixinHelpers_1.CACHE_TIMES.MEDIUM,
|
|
48
48
|
});
|
|
@@ -65,7 +65,7 @@ function OxyServicesKarmaMixin(Base) {
|
|
|
65
65
|
params.limit = limit;
|
|
66
66
|
if (offset)
|
|
67
67
|
params.offset = offset;
|
|
68
|
-
return await this.makeRequest('GET', `/
|
|
68
|
+
return await this.makeRequest('GET', `/karma/${userId}/history`, params, {
|
|
69
69
|
cache: true,
|
|
70
70
|
cacheTTL: mixinHelpers_1.CACHE_TIMES.MEDIUM,
|
|
71
71
|
});
|
|
@@ -80,7 +80,7 @@ function OxyServicesKarmaMixin(Base) {
|
|
|
80
80
|
*/
|
|
81
81
|
async getKarmaLeaderboard() {
|
|
82
82
|
try {
|
|
83
|
-
return await this.makeRequest('GET', '/
|
|
83
|
+
return await this.makeRequest('GET', '/karma/leaderboard', undefined, {
|
|
84
84
|
cache: true,
|
|
85
85
|
cacheTTL: mixinHelpers_1.CACHE_TIMES.LONG,
|
|
86
86
|
});
|
|
@@ -95,7 +95,7 @@ function OxyServicesKarmaMixin(Base) {
|
|
|
95
95
|
*/
|
|
96
96
|
async getKarmaRules() {
|
|
97
97
|
try {
|
|
98
|
-
return await this.makeRequest('GET', '/
|
|
98
|
+
return await this.makeRequest('GET', '/karma/rules', undefined, {
|
|
99
99
|
cache: true,
|
|
100
100
|
cacheTTL: mixinHelpers_1.CACHE_TIMES.EXTRA_LONG, // Rules don't change often
|
|
101
101
|
});
|
|
@@ -14,7 +14,7 @@ function OxyServicesLocationMixin(Base) {
|
|
|
14
14
|
*/
|
|
15
15
|
async updateLocation(latitude, longitude) {
|
|
16
16
|
try {
|
|
17
|
-
return await this.makeRequest('POST', '/
|
|
17
|
+
return await this.makeRequest('POST', '/location', {
|
|
18
18
|
latitude,
|
|
19
19
|
longitude
|
|
20
20
|
}, { cache: false });
|
|
@@ -31,7 +31,7 @@ function OxyServicesLocationMixin(Base) {
|
|
|
31
31
|
async getNearbyUsers(radius) {
|
|
32
32
|
try {
|
|
33
33
|
const params = radius ? { radius } : undefined;
|
|
34
|
-
return await this.makeRequest('GET', '/
|
|
34
|
+
return await this.makeRequest('GET', '/location/nearby', params, {
|
|
35
35
|
cache: false, // Don't cache location data - always get fresh data
|
|
36
36
|
});
|
|
37
37
|
}
|
|
@@ -14,7 +14,7 @@ function OxyServicesPaymentMixin(Base) {
|
|
|
14
14
|
*/
|
|
15
15
|
async createPayment(data) {
|
|
16
16
|
try {
|
|
17
|
-
return await this.makeRequest('POST', '/
|
|
17
|
+
return await this.makeRequest('POST', '/payments', data, { cache: false });
|
|
18
18
|
}
|
|
19
19
|
catch (error) {
|
|
20
20
|
throw this.handleError(error);
|
|
@@ -27,7 +27,7 @@ function OxyServicesPaymentMixin(Base) {
|
|
|
27
27
|
*/
|
|
28
28
|
async getPayment(paymentId) {
|
|
29
29
|
try {
|
|
30
|
-
return await this.makeRequest('GET', `/
|
|
30
|
+
return await this.makeRequest('GET', `/payments/${paymentId}`, undefined, {
|
|
31
31
|
cache: true,
|
|
32
32
|
cacheTTL: mixinHelpers_1.CACHE_TIMES.LONG,
|
|
33
33
|
});
|
|
@@ -42,7 +42,7 @@ function OxyServicesPaymentMixin(Base) {
|
|
|
42
42
|
*/
|
|
43
43
|
async getUserPayments() {
|
|
44
44
|
try {
|
|
45
|
-
return await this.makeRequest('GET', '/
|
|
45
|
+
return await this.makeRequest('GET', '/payments/user', undefined, {
|
|
46
46
|
cache: false, // Don't cache user payments - always get fresh data
|
|
47
47
|
});
|
|
48
48
|
}
|
|
@@ -57,7 +57,7 @@ function OxyServicesPaymentMixin(Base) {
|
|
|
57
57
|
*/
|
|
58
58
|
async getSubscription(userId) {
|
|
59
59
|
try {
|
|
60
|
-
return await this.makeRequest('GET', `/
|
|
60
|
+
return await this.makeRequest('GET', `/subscription/${userId}`, undefined, {
|
|
61
61
|
cache: true,
|
|
62
62
|
cacheTTL: mixinHelpers_1.CACHE_TIMES.MEDIUM,
|
|
63
63
|
});
|
|
@@ -89,7 +89,7 @@ function OxyServicesPaymentMixin(Base) {
|
|
|
89
89
|
*/
|
|
90
90
|
async getWallet(userId) {
|
|
91
91
|
try {
|
|
92
|
-
return await this.makeRequest('GET', `/
|
|
92
|
+
return await this.makeRequest('GET', `/wallet/${userId}`, undefined, {
|
|
93
93
|
cache: true,
|
|
94
94
|
cacheTTL: mixinHelpers_1.CACHE_TIMES.SHORT, // Cache wallet for short time as balance changes frequently
|
|
95
95
|
});
|
|
@@ -128,7 +128,7 @@ function OxyServicesPaymentMixin(Base) {
|
|
|
128
128
|
if (options?.offset)
|
|
129
129
|
params.append('offset', options.offset.toString());
|
|
130
130
|
const queryString = params.toString();
|
|
131
|
-
const url = `/
|
|
131
|
+
const url = `/wallet/transactions/${userId}${queryString ? `?${queryString}` : ''}`;
|
|
132
132
|
return await this.makeRequest('GET', url, undefined, {
|
|
133
133
|
cache: false, // Don't cache transactions - always get fresh data
|
|
134
134
|
});
|
|
@@ -91,7 +91,7 @@ function OxyServicesPopupAuthMixin(Base) {
|
|
|
91
91
|
// The callback page only sends sessionId/accessToken, not user data
|
|
92
92
|
if (session && session.sessionId && !session.user) {
|
|
93
93
|
try {
|
|
94
|
-
const userData = await this.makeRequest('GET', `/
|
|
94
|
+
const userData = await this.makeRequest('GET', `/session/user/${session.sessionId}`, undefined, { cache: false });
|
|
95
95
|
if (userData) {
|
|
96
96
|
session.user = userData;
|
|
97
97
|
}
|