@oxyhq/core 1.11.7 → 1.11.9

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.
@@ -75,7 +75,7 @@ function OxyServicesPopupAuthMixin(Base) {
75
75
  state,
76
76
  nonce,
77
77
  clientId: window.location.origin,
78
- redirectUri: `${this.constructor.AUTH_URL}/auth/callback`,
78
+ redirectUri: `${(this.config.authWebUrl || this.constructor.DEFAULT_AUTH_URL)}/auth/callback`,
79
79
  });
80
80
  const popup = this.openCenteredPopup(authUrl, 'Oxy Sign In', width, height);
81
81
  if (!popup) {
@@ -163,7 +163,7 @@ function OxyServicesPopupAuthMixin(Base) {
163
163
  iframe.style.width = '0';
164
164
  iframe.style.height = '0';
165
165
  iframe.style.border = 'none';
166
- const silentUrl = `${this.constructor.AUTH_URL}/auth/silent?` + `client_id=${encodeURIComponent(clientId)}&` + `nonce=${nonce}`;
166
+ const silentUrl = `${(this.config.authWebUrl || this.constructor.DEFAULT_AUTH_URL)}/auth/silent?` + `client_id=${encodeURIComponent(clientId)}&` + `nonce=${nonce}`;
167
167
  iframe.src = silentUrl;
168
168
  document.body.appendChild(iframe);
169
169
  try {
@@ -214,7 +214,7 @@ function OxyServicesPopupAuthMixin(Base) {
214
214
  reject(new OxyServices_errors_1.OxyAuthenticationError('Authentication timeout'));
215
215
  }, timeout);
216
216
  const messageHandler = (event) => {
217
- const authUrl = this.constructor.AUTH_URL;
217
+ const authUrl = (this.config.authWebUrl || this.constructor.DEFAULT_AUTH_URL);
218
218
  // Log all messages for debugging
219
219
  if (event.data && typeof event.data === 'object' && event.data.type) {
220
220
  debug.log('Message received:', {
@@ -286,7 +286,7 @@ function OxyServicesPopupAuthMixin(Base) {
286
286
  }, timeout);
287
287
  const messageHandler = (event) => {
288
288
  // Verify origin
289
- if (event.origin !== this.constructor.AUTH_URL) {
289
+ if (event.origin !== (this.config.authWebUrl || this.constructor.DEFAULT_AUTH_URL)) {
290
290
  return;
291
291
  }
292
292
  const { type, session } = event.data;
@@ -309,7 +309,7 @@ function OxyServicesPopupAuthMixin(Base) {
309
309
  * @private
310
310
  */
311
311
  buildAuthUrl(params) {
312
- const url = new URL(`${this.constructor.AUTH_URL}/${params.mode}`);
312
+ const url = new URL(`${(this.config.authWebUrl || this.constructor.DEFAULT_AUTH_URL)}/${params.mode}`);
313
313
  url.searchParams.set('response_type', 'token');
314
314
  url.searchParams.set('client_id', params.clientId);
315
315
  url.searchParams.set('redirect_uri', params.redirectUri);
@@ -370,7 +370,7 @@ function OxyServicesPopupAuthMixin(Base) {
370
370
  }
371
371
  }
372
372
  },
373
- _a.AUTH_URL = 'https://auth.oxy.so',
373
+ _a.DEFAULT_AUTH_URL = 'https://auth.oxy.so',
374
374
  _a.POPUP_WIDTH = 500,
375
375
  _a.POPUP_HEIGHT = 700,
376
376
  _a.POPUP_TIMEOUT = 60000 // 1 minute
@@ -228,7 +228,7 @@ function OxyServicesRedirectAuthMixin(Base) {
228
228
  * @private
229
229
  */
230
230
  buildAuthUrl(params) {
231
- const url = new URL(`${this.constructor.AUTH_URL}/${params.mode}`);
231
+ const url = new URL(`${(this.config.authWebUrl || this.constructor.DEFAULT_AUTH_URL)}/${params.mode}`);
232
232
  url.searchParams.set('redirect_uri', params.redirectUri);
233
233
  url.searchParams.set('state', params.state);
234
234
  url.searchParams.set('nonce', params.nonce);
@@ -345,7 +345,7 @@ function OxyServicesRedirectAuthMixin(Base) {
345
345
  window.history.replaceState({}, '', url.toString());
346
346
  }
347
347
  },
348
- _a.AUTH_URL = 'https://auth.oxy.so',
348
+ _a.DEFAULT_AUTH_URL = 'https://auth.oxy.so',
349
349
  _a.TOKEN_STORAGE_KEY = 'oxy_access_token',
350
350
  _a.SESSION_STORAGE_KEY = 'oxy_session_id',
351
351
  _a.STATE_STORAGE_KEY = 'oxy_auth_state',
@@ -107,6 +107,18 @@ function OxyServicesUserMixin(Base) {
107
107
  return await this.makeRequest('GET', '/profiles/recommendations', params, { cache: true });
108
108
  }, 'getProfileRecommendations');
109
109
  }
110
+ /**
111
+ * Get profiles similar to a given user, based on co-follower overlap.
112
+ */
113
+ async getSimilarProfiles(userId, limit) {
114
+ const params = {};
115
+ if (limit)
116
+ params.limit = String(limit);
117
+ return await this.makeRequest('GET', `/profiles/${userId}/similar`, params, {
118
+ cache: true,
119
+ cacheTTL: 5 * 60 * 1000, // 5 min cache
120
+ });
121
+ }
110
122
  /**
111
123
  * Get user by ID
112
124
  */