@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
|
@@ -71,7 +71,7 @@ export function OxyServicesPopupAuthMixin(Base) {
|
|
|
71
71
|
state,
|
|
72
72
|
nonce,
|
|
73
73
|
clientId: window.location.origin,
|
|
74
|
-
redirectUri: `${this.constructor.
|
|
74
|
+
redirectUri: `${(this.config.authWebUrl || this.constructor.DEFAULT_AUTH_URL)}/auth/callback`,
|
|
75
75
|
});
|
|
76
76
|
const popup = this.openCenteredPopup(authUrl, 'Oxy Sign In', width, height);
|
|
77
77
|
if (!popup) {
|
|
@@ -159,7 +159,7 @@ export function OxyServicesPopupAuthMixin(Base) {
|
|
|
159
159
|
iframe.style.width = '0';
|
|
160
160
|
iframe.style.height = '0';
|
|
161
161
|
iframe.style.border = 'none';
|
|
162
|
-
const silentUrl = `${this.constructor.
|
|
162
|
+
const silentUrl = `${(this.config.authWebUrl || this.constructor.DEFAULT_AUTH_URL)}/auth/silent?` + `client_id=${encodeURIComponent(clientId)}&` + `nonce=${nonce}`;
|
|
163
163
|
iframe.src = silentUrl;
|
|
164
164
|
document.body.appendChild(iframe);
|
|
165
165
|
try {
|
|
@@ -210,7 +210,7 @@ export function OxyServicesPopupAuthMixin(Base) {
|
|
|
210
210
|
reject(new OxyAuthenticationError('Authentication timeout'));
|
|
211
211
|
}, timeout);
|
|
212
212
|
const messageHandler = (event) => {
|
|
213
|
-
const authUrl = this.constructor.
|
|
213
|
+
const authUrl = (this.config.authWebUrl || this.constructor.DEFAULT_AUTH_URL);
|
|
214
214
|
// Log all messages for debugging
|
|
215
215
|
if (event.data && typeof event.data === 'object' && event.data.type) {
|
|
216
216
|
debug.log('Message received:', {
|
|
@@ -282,7 +282,7 @@ export function OxyServicesPopupAuthMixin(Base) {
|
|
|
282
282
|
}, timeout);
|
|
283
283
|
const messageHandler = (event) => {
|
|
284
284
|
// Verify origin
|
|
285
|
-
if (event.origin !== this.constructor.
|
|
285
|
+
if (event.origin !== (this.config.authWebUrl || this.constructor.DEFAULT_AUTH_URL)) {
|
|
286
286
|
return;
|
|
287
287
|
}
|
|
288
288
|
const { type, session } = event.data;
|
|
@@ -305,7 +305,7 @@ export function OxyServicesPopupAuthMixin(Base) {
|
|
|
305
305
|
* @private
|
|
306
306
|
*/
|
|
307
307
|
buildAuthUrl(params) {
|
|
308
|
-
const url = new URL(`${this.constructor.
|
|
308
|
+
const url = new URL(`${(this.config.authWebUrl || this.constructor.DEFAULT_AUTH_URL)}/${params.mode}`);
|
|
309
309
|
url.searchParams.set('response_type', 'token');
|
|
310
310
|
url.searchParams.set('client_id', params.clientId);
|
|
311
311
|
url.searchParams.set('redirect_uri', params.redirectUri);
|
|
@@ -366,7 +366,7 @@ export function OxyServicesPopupAuthMixin(Base) {
|
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
368
|
},
|
|
369
|
-
_a.
|
|
369
|
+
_a.DEFAULT_AUTH_URL = 'https://auth.oxy.so',
|
|
370
370
|
_a.POPUP_WIDTH = 500,
|
|
371
371
|
_a.POPUP_HEIGHT = 700,
|
|
372
372
|
_a.POPUP_TIMEOUT = 60000 // 1 minute
|
|
@@ -224,7 +224,7 @@ export function OxyServicesRedirectAuthMixin(Base) {
|
|
|
224
224
|
* @private
|
|
225
225
|
*/
|
|
226
226
|
buildAuthUrl(params) {
|
|
227
|
-
const url = new URL(`${this.constructor.
|
|
227
|
+
const url = new URL(`${(this.config.authWebUrl || this.constructor.DEFAULT_AUTH_URL)}/${params.mode}`);
|
|
228
228
|
url.searchParams.set('redirect_uri', params.redirectUri);
|
|
229
229
|
url.searchParams.set('state', params.state);
|
|
230
230
|
url.searchParams.set('nonce', params.nonce);
|
|
@@ -341,7 +341,7 @@ export function OxyServicesRedirectAuthMixin(Base) {
|
|
|
341
341
|
window.history.replaceState({}, '', url.toString());
|
|
342
342
|
}
|
|
343
343
|
},
|
|
344
|
-
_a.
|
|
344
|
+
_a.DEFAULT_AUTH_URL = 'https://auth.oxy.so',
|
|
345
345
|
_a.TOKEN_STORAGE_KEY = 'oxy_access_token',
|
|
346
346
|
_a.SESSION_STORAGE_KEY = 'oxy_session_id',
|
|
347
347
|
_a.STATE_STORAGE_KEY = 'oxy_auth_state',
|
|
@@ -104,6 +104,18 @@ export function OxyServicesUserMixin(Base) {
|
|
|
104
104
|
return await this.makeRequest('GET', '/profiles/recommendations', params, { cache: true });
|
|
105
105
|
}, 'getProfileRecommendations');
|
|
106
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* Get profiles similar to a given user, based on co-follower overlap.
|
|
109
|
+
*/
|
|
110
|
+
async getSimilarProfiles(userId, limit) {
|
|
111
|
+
const params = {};
|
|
112
|
+
if (limit)
|
|
113
|
+
params.limit = String(limit);
|
|
114
|
+
return await this.makeRequest('GET', `/profiles/${userId}/similar`, params, {
|
|
115
|
+
cache: true,
|
|
116
|
+
cacheTTL: 5 * 60 * 1000, // 5 min cache
|
|
117
|
+
});
|
|
118
|
+
}
|
|
107
119
|
/**
|
|
108
120
|
* Get user by ID
|
|
109
121
|
*/
|