@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
|
@@ -237,7 +237,7 @@ export declare function OxyServicesRedirectAuthMixin<T extends typeof OxyService
|
|
|
237
237
|
[key: string]: any;
|
|
238
238
|
}>;
|
|
239
239
|
};
|
|
240
|
-
readonly
|
|
240
|
+
readonly DEFAULT_AUTH_URL: "https://auth.oxy.so";
|
|
241
241
|
readonly TOKEN_STORAGE_KEY: "oxy_access_token";
|
|
242
242
|
readonly SESSION_STORAGE_KEY: "oxy_session_id";
|
|
243
243
|
readonly STATE_STORAGE_KEY: "oxy_auth_state";
|
|
@@ -67,6 +67,10 @@ export declare function OxyServicesUserMixin<T extends typeof OxyServicesBase>(B
|
|
|
67
67
|
};
|
|
68
68
|
[key: string]: unknown;
|
|
69
69
|
}>>;
|
|
70
|
+
/**
|
|
71
|
+
* Get profiles similar to a given user, based on co-follower overlap.
|
|
72
|
+
*/
|
|
73
|
+
getSimilarProfiles(userId: string, limit?: number): Promise<User[]>;
|
|
70
74
|
/**
|
|
71
75
|
* Get user by ID
|
|
72
76
|
*/
|
package/package.json
CHANGED
|
@@ -113,7 +113,7 @@ export function OxyServicesFedCMMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
113
113
|
// Request credential from browser's native identity flow
|
|
114
114
|
// mode: 'button' signals this is a user-gesture-initiated flow (Chrome 125+)
|
|
115
115
|
const credential = await this.requestIdentityCredential({
|
|
116
|
-
configURL: (this.constructor as any).DEFAULT_CONFIG_URL,
|
|
116
|
+
configURL: (this.config.authWebUrl ? `${this.config.authWebUrl}/fedcm.json` : (this.constructor as any).DEFAULT_CONFIG_URL),
|
|
117
117
|
clientId,
|
|
118
118
|
nonce,
|
|
119
119
|
context: options.context,
|
|
@@ -216,7 +216,7 @@ export function OxyServicesFedCMMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
216
216
|
debug.log('Silent SSO: Attempting silent mediation...', loginHint ? `(hint: ${loginHint})` : '');
|
|
217
217
|
|
|
218
218
|
credential = await this.requestIdentityCredential({
|
|
219
|
-
configURL: (this.constructor as any).DEFAULT_CONFIG_URL,
|
|
219
|
+
configURL: (this.config.authWebUrl ? `${this.config.authWebUrl}/fedcm.json` : (this.constructor as any).DEFAULT_CONFIG_URL),
|
|
220
220
|
clientId,
|
|
221
221
|
nonce,
|
|
222
222
|
loginHint,
|
|
@@ -461,7 +461,7 @@ export function OxyServicesFedCMMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
461
461
|
if ('IdentityCredential' in window && 'disconnect' in (window as any).IdentityCredential) {
|
|
462
462
|
const clientId = this.getClientId();
|
|
463
463
|
await (window as any).IdentityCredential.disconnect({
|
|
464
|
-
configURL: (this.constructor as any).DEFAULT_CONFIG_URL,
|
|
464
|
+
configURL: (this.config.authWebUrl ? `${this.config.authWebUrl}/fedcm.json` : (this.constructor as any).DEFAULT_CONFIG_URL),
|
|
465
465
|
clientId,
|
|
466
466
|
accountHint: accountHint || '*',
|
|
467
467
|
});
|
|
@@ -480,7 +480,7 @@ export function OxyServicesFedCMMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
480
480
|
getFedCMConfig(): FedCMConfig {
|
|
481
481
|
return {
|
|
482
482
|
enabled: this.isFedCMSupported(),
|
|
483
|
-
configURL: (this.constructor as any).DEFAULT_CONFIG_URL,
|
|
483
|
+
configURL: (this.config.authWebUrl ? `${this.config.authWebUrl}/fedcm.json` : (this.constructor as any).DEFAULT_CONFIG_URL),
|
|
484
484
|
clientId: this.getClientId(),
|
|
485
485
|
};
|
|
486
486
|
}
|
|
@@ -43,7 +43,7 @@ export function OxyServicesPopupAuthMixin<T extends typeof OxyServicesBase>(Base
|
|
|
43
43
|
constructor(...args: any[]) {
|
|
44
44
|
super(...(args as [any]));
|
|
45
45
|
}
|
|
46
|
-
public static readonly
|
|
46
|
+
public static readonly DEFAULT_AUTH_URL = 'https://auth.oxy.so';
|
|
47
47
|
public static readonly POPUP_WIDTH = 500;
|
|
48
48
|
public static readonly POPUP_HEIGHT = 700;
|
|
49
49
|
public static readonly POPUP_TIMEOUT = 60000; // 1 minute
|
|
@@ -95,7 +95,7 @@ export function OxyServicesPopupAuthMixin<T extends typeof OxyServicesBase>(Base
|
|
|
95
95
|
state,
|
|
96
96
|
nonce,
|
|
97
97
|
clientId: window.location.origin,
|
|
98
|
-
redirectUri: `${(this.constructor as any).
|
|
98
|
+
redirectUri: `${(this.config.authWebUrl || (this.constructor as any).DEFAULT_AUTH_URL)}/auth/callback`,
|
|
99
99
|
});
|
|
100
100
|
|
|
101
101
|
const popup = this.openCenteredPopup(authUrl, 'Oxy Sign In', width, height);
|
|
@@ -198,7 +198,7 @@ export function OxyServicesPopupAuthMixin<T extends typeof OxyServicesBase>(Base
|
|
|
198
198
|
iframe.style.height = '0';
|
|
199
199
|
iframe.style.border = 'none';
|
|
200
200
|
|
|
201
|
-
const silentUrl = `${(this.constructor as any).
|
|
201
|
+
const silentUrl = `${(this.config.authWebUrl || (this.constructor as any).DEFAULT_AUTH_URL)}/auth/silent?` + `client_id=${encodeURIComponent(clientId)}&` + `nonce=${nonce}`;
|
|
202
202
|
|
|
203
203
|
iframe.src = silentUrl;
|
|
204
204
|
document.body.appendChild(iframe);
|
|
@@ -260,7 +260,7 @@ export function OxyServicesPopupAuthMixin<T extends typeof OxyServicesBase>(Base
|
|
|
260
260
|
}, timeout);
|
|
261
261
|
|
|
262
262
|
const messageHandler = (event: MessageEvent) => {
|
|
263
|
-
const authUrl = (this.constructor as any).
|
|
263
|
+
const authUrl = (this.config.authWebUrl || (this.constructor as any).DEFAULT_AUTH_URL);
|
|
264
264
|
|
|
265
265
|
// Log all messages for debugging
|
|
266
266
|
if (event.data && typeof event.data === 'object' && event.data.type) {
|
|
@@ -347,7 +347,7 @@ export function OxyServicesPopupAuthMixin<T extends typeof OxyServicesBase>(Base
|
|
|
347
347
|
|
|
348
348
|
const messageHandler = (event: MessageEvent) => {
|
|
349
349
|
// Verify origin
|
|
350
|
-
if (event.origin !== (this.constructor as any).
|
|
350
|
+
if (event.origin !== (this.config.authWebUrl || (this.constructor as any).DEFAULT_AUTH_URL)) {
|
|
351
351
|
return;
|
|
352
352
|
}
|
|
353
353
|
|
|
@@ -382,7 +382,7 @@ export function OxyServicesPopupAuthMixin<T extends typeof OxyServicesBase>(Base
|
|
|
382
382
|
clientId: string;
|
|
383
383
|
redirectUri: string;
|
|
384
384
|
}): string {
|
|
385
|
-
const url = new URL(`${(this.constructor as any).
|
|
385
|
+
const url = new URL(`${(this.config.authWebUrl || (this.constructor as any).DEFAULT_AUTH_URL)}/${params.mode}`);
|
|
386
386
|
url.searchParams.set('response_type', 'token');
|
|
387
387
|
url.searchParams.set('client_id', params.clientId);
|
|
388
388
|
url.searchParams.set('redirect_uri', params.redirectUri);
|
|
@@ -37,7 +37,7 @@ export function OxyServicesRedirectAuthMixin<T extends typeof OxyServicesBase>(B
|
|
|
37
37
|
constructor(...args: any[]) {
|
|
38
38
|
super(...(args as [any]));
|
|
39
39
|
}
|
|
40
|
-
public static readonly
|
|
40
|
+
public static readonly DEFAULT_AUTH_URL = 'https://auth.oxy.so';
|
|
41
41
|
public static readonly TOKEN_STORAGE_KEY = 'oxy_access_token';
|
|
42
42
|
public static readonly SESSION_STORAGE_KEY = 'oxy_session_id';
|
|
43
43
|
public static readonly STATE_STORAGE_KEY = 'oxy_auth_state';
|
|
@@ -270,7 +270,7 @@ export function OxyServicesRedirectAuthMixin<T extends typeof OxyServicesBase>(B
|
|
|
270
270
|
nonce: string;
|
|
271
271
|
clientId: string;
|
|
272
272
|
}): string {
|
|
273
|
-
const url = new URL(`${(this.constructor as any).
|
|
273
|
+
const url = new URL(`${(this.config.authWebUrl || (this.constructor as any).DEFAULT_AUTH_URL)}/${params.mode}`);
|
|
274
274
|
url.searchParams.set('redirect_uri', params.redirectUri);
|
|
275
275
|
url.searchParams.set('state', params.state);
|
|
276
276
|
url.searchParams.set('nonce', params.nonce);
|
|
@@ -149,6 +149,18 @@ export function OxyServicesUserMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
149
149
|
}, 'getProfileRecommendations');
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
+
/**
|
|
153
|
+
* Get profiles similar to a given user, based on co-follower overlap.
|
|
154
|
+
*/
|
|
155
|
+
async getSimilarProfiles(userId: string, limit?: number): Promise<User[]> {
|
|
156
|
+
const params: Record<string, string> = {};
|
|
157
|
+
if (limit) params.limit = String(limit);
|
|
158
|
+
return await this.makeRequest<User[]>('GET', `/profiles/${userId}/similar`, params, {
|
|
159
|
+
cache: true,
|
|
160
|
+
cacheTTL: 5 * 60 * 1000, // 5 min cache
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
|
|
152
164
|
/**
|
|
153
165
|
* Get user by ID
|
|
154
166
|
*/
|