@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.
- package/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/mixins/OxyServices.fedcm.js +4 -4
- package/dist/cjs/mixins/OxyServices.popup.js +6 -6
- package/dist/cjs/mixins/OxyServices.redirect.js +2 -2
- package/dist/cjs/mixins/OxyServices.user.js +12 -0
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/mixins/OxyServices.fedcm.js +4 -4
- package/dist/esm/mixins/OxyServices.popup.js +6 -6
- package/dist/esm/mixins/OxyServices.redirect.js +2 -2
- package/dist/esm/mixins/OxyServices.user.js +12 -0
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/mixins/OxyServices.popup.d.ts +1 -1
- package/dist/types/mixins/OxyServices.redirect.d.ts +1 -1
- package/dist/types/mixins/OxyServices.user.d.ts +4 -0
- package/package.json +1 -1
- package/src/mixins/OxyServices.fedcm.ts +4 -4
- package/src/mixins/OxyServices.popup.ts +6 -6
- package/src/mixins/OxyServices.redirect.ts +2 -2
- package/src/mixins/OxyServices.user.ts +12 -0
|
@@ -75,7 +75,7 @@ function OxyServicesPopupAuthMixin(Base) {
|
|
|
75
75
|
state,
|
|
76
76
|
nonce,
|
|
77
77
|
clientId: window.location.origin,
|
|
78
|
-
redirectUri: `${this.constructor.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
*/
|