@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.
Files changed (92) hide show
  1. package/dist/cjs/AuthManager.js +14 -1
  2. package/dist/cjs/HttpService.js +87 -69
  3. package/dist/cjs/OxyServices.base.js +5 -4
  4. package/dist/cjs/crypto/keyManager.js +1 -13
  5. package/dist/cjs/crypto/signatureService.js +7 -20
  6. package/dist/cjs/index.js +9 -1
  7. package/dist/cjs/mixins/OxyServices.analytics.js +2 -2
  8. package/dist/cjs/mixins/OxyServices.assets.js +14 -14
  9. package/dist/cjs/mixins/OxyServices.auth.js +19 -19
  10. package/dist/cjs/mixins/OxyServices.developer.js +6 -6
  11. package/dist/cjs/mixins/OxyServices.devices.js +7 -7
  12. package/dist/cjs/mixins/OxyServices.features.js +23 -23
  13. package/dist/cjs/mixins/OxyServices.fedcm.js +1 -1
  14. package/dist/cjs/mixins/OxyServices.karma.js +6 -6
  15. package/dist/cjs/mixins/OxyServices.location.js +2 -2
  16. package/dist/cjs/mixins/OxyServices.payment.js +6 -6
  17. package/dist/cjs/mixins/OxyServices.popup.js +1 -1
  18. package/dist/cjs/mixins/OxyServices.privacy.js +6 -6
  19. package/dist/cjs/mixins/OxyServices.security.js +3 -3
  20. package/dist/cjs/mixins/OxyServices.user.js +22 -22
  21. package/dist/cjs/mixins/OxyServices.utility.js +39 -10
  22. package/dist/cjs/utils/authHelpers.js +114 -0
  23. package/dist/cjs/utils/platform.js +14 -0
  24. package/dist/esm/AuthManager.js +14 -1
  25. package/dist/esm/HttpService.js +87 -69
  26. package/dist/esm/OxyServices.base.js +5 -4
  27. package/dist/esm/crypto/keyManager.js +1 -13
  28. package/dist/esm/crypto/signatureService.js +2 -15
  29. package/dist/esm/index.js +2 -0
  30. package/dist/esm/mixins/OxyServices.analytics.js +2 -2
  31. package/dist/esm/mixins/OxyServices.assets.js +14 -14
  32. package/dist/esm/mixins/OxyServices.auth.js +19 -19
  33. package/dist/esm/mixins/OxyServices.developer.js +6 -6
  34. package/dist/esm/mixins/OxyServices.devices.js +7 -7
  35. package/dist/esm/mixins/OxyServices.features.js +23 -23
  36. package/dist/esm/mixins/OxyServices.fedcm.js +1 -1
  37. package/dist/esm/mixins/OxyServices.karma.js +6 -6
  38. package/dist/esm/mixins/OxyServices.location.js +2 -2
  39. package/dist/esm/mixins/OxyServices.payment.js +6 -6
  40. package/dist/esm/mixins/OxyServices.popup.js +1 -1
  41. package/dist/esm/mixins/OxyServices.privacy.js +6 -6
  42. package/dist/esm/mixins/OxyServices.security.js +3 -3
  43. package/dist/esm/mixins/OxyServices.user.js +22 -22
  44. package/dist/esm/mixins/OxyServices.utility.js +39 -10
  45. package/dist/esm/utils/authHelpers.js +105 -0
  46. package/dist/esm/utils/platform.js +12 -0
  47. package/dist/types/HttpService.d.ts +4 -1
  48. package/dist/types/OxyServices.base.d.ts +1 -1
  49. package/dist/types/index.d.ts +2 -0
  50. package/dist/types/mixins/OxyServices.analytics.d.ts +1 -1
  51. package/dist/types/mixins/OxyServices.assets.d.ts +1 -1
  52. package/dist/types/mixins/OxyServices.auth.d.ts +1 -1
  53. package/dist/types/mixins/OxyServices.developer.d.ts +1 -1
  54. package/dist/types/mixins/OxyServices.devices.d.ts +1 -1
  55. package/dist/types/mixins/OxyServices.features.d.ts +1 -1
  56. package/dist/types/mixins/OxyServices.fedcm.d.ts +1 -1
  57. package/dist/types/mixins/OxyServices.karma.d.ts +1 -1
  58. package/dist/types/mixins/OxyServices.language.d.ts +1 -1
  59. package/dist/types/mixins/OxyServices.location.d.ts +1 -1
  60. package/dist/types/mixins/OxyServices.payment.d.ts +1 -1
  61. package/dist/types/mixins/OxyServices.popup.d.ts +1 -1
  62. package/dist/types/mixins/OxyServices.privacy.d.ts +1 -1
  63. package/dist/types/mixins/OxyServices.redirect.d.ts +1 -1
  64. package/dist/types/mixins/OxyServices.security.d.ts +1 -1
  65. package/dist/types/mixins/OxyServices.user.d.ts +1 -1
  66. package/dist/types/mixins/OxyServices.utility.d.ts +20 -6
  67. package/dist/types/utils/authHelpers.d.ts +57 -0
  68. package/dist/types/utils/platform.d.ts +8 -0
  69. package/package.json +1 -1
  70. package/src/AuthManager.ts +14 -1
  71. package/src/HttpService.ts +85 -67
  72. package/src/OxyServices.base.ts +5 -4
  73. package/src/crypto/keyManager.ts +1 -15
  74. package/src/crypto/signatureService.ts +2 -17
  75. package/src/index.ts +11 -0
  76. package/src/mixins/OxyServices.analytics.ts +2 -2
  77. package/src/mixins/OxyServices.assets.ts +14 -14
  78. package/src/mixins/OxyServices.auth.ts +19 -19
  79. package/src/mixins/OxyServices.developer.ts +6 -6
  80. package/src/mixins/OxyServices.devices.ts +7 -7
  81. package/src/mixins/OxyServices.features.ts +23 -23
  82. package/src/mixins/OxyServices.fedcm.ts +1 -1
  83. package/src/mixins/OxyServices.karma.ts +6 -6
  84. package/src/mixins/OxyServices.location.ts +2 -2
  85. package/src/mixins/OxyServices.payment.ts +6 -6
  86. package/src/mixins/OxyServices.popup.ts +1 -1
  87. package/src/mixins/OxyServices.privacy.ts +6 -6
  88. package/src/mixins/OxyServices.security.ts +3 -3
  89. package/src/mixins/OxyServices.user.ts +22 -22
  90. package/src/mixins/OxyServices.utility.ts +41 -11
  91. package/src/utils/authHelpers.ts +140 -0
  92. 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', '/api/developer/apps', undefined, {
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', '/api/developer/apps', data, { cache: false });
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', `/api/developer/apps/${appId}`, undefined, {
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', `/api/developer/apps/${appId}`, data, { cache: false });
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', `/api/developer/apps/${appId}/regenerate-secret`, undefined, { cache: false });
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', `/api/developer/apps/${appId}`, undefined, { cache: false });
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', '/api/devices', deviceData, { cache: false });
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', '/api/devices', undefined, {
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', `/api/devices/${deviceId}`, undefined, { cache: false });
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', `/api/session/device/sessions/${sessionId}`, undefined, {
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', `/api/session/device/logout-all/${sessionId}`, urlParams, { cache: false });
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', `/api/session/device/name/${sessionId}`, { deviceName }, { cache: false });
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', '/api/devices/security', undefined, {
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', '/api/feedback', payload, {
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', '/api/subscriptions/plans', undefined, {
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', '/api/subscriptions/features', undefined, {
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', '/api/subscriptions/subscribe', {
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', '/api/subscriptions/features/subscribe', {
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', `/api/subscriptions/${subscriptionId}/cancel`, undefined, {
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', `/api/subscriptions/${subscriptionId}/reactivate`, undefined, {
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', '/api/subscriptions/current', undefined, {
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 ? `/api/users/${userId}/saves` : '/api/saves';
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 ? `/api/users/${userId}/collections` : '/api/collections';
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', '/api/saves', {
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', `/api/saves/${saveId}`, undefined, { cache: false });
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', '/api/collections', {
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', `/api/collections/${collectionId}`, undefined, { cache: false });
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', `/api/users/${userId}/stats`, undefined, {
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 ? `/api/users/${userId}/history` : '/api/history';
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', '/api/history', undefined, { cache: false });
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', `/api/history/${itemId}`, undefined, { cache: false });
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', '/api/faqs', params, {
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', '/api/faqs/search', { query }, {
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 ? `/api/users/${userId}/achievements` : '/api/achievements';
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', '/api/achievements/all', undefined, {
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', '/api/account', { password }, { cache: false });
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', '/api/fedcm/exchange', { id_token: idToken }, { cache: false });
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', `/api/karma/${userId}`, undefined, {
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', `/api/karma/${userId}/give`, {
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', `/api/karma/${userId}/total`, undefined, {
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', `/api/karma/${userId}/history`, params, {
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', '/api/karma/leaderboard', undefined, {
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', '/api/karma/rules', undefined, {
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', '/api/location', {
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', '/api/location/nearby', params, {
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', '/api/payments', data, { cache: false });
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', `/api/payments/${paymentId}`, undefined, {
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', '/api/payments/user', undefined, {
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', `/api/subscription/${userId}`, undefined, {
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', `/api/wallet/${userId}`, undefined, {
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 = `/api/wallet/transactions/${userId}${queryString ? `?${queryString}` : ''}`;
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', `/api/session/user/${session.sessionId}`, undefined, { cache: false });
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', '/api/privacy/blocked', undefined, {
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', `/api/privacy/blocked/${userId}`, undefined, {
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', `/api/privacy/blocked/${userId}`, undefined, {
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', '/api/privacy/restricted', undefined, {
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', `/api/privacy/restricted/${userId}`, undefined, {
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', `/api/privacy/restricted/${userId}`, undefined, {
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', '/api/security/activity', params, { cache: false });
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', '/api/security/activity/private-key-exported', { deviceId }, { cache: false });
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', '/api/security/activity/backup-created', { deviceId }, { cache: false });
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