diff --git a/package-lock.json b/package-lock.json index 2c51f0f..b0694b6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,7 @@ "jsqr": "1.4.0", "lucide-react": "^0.546.0", "motion": "^12.23.24", - "onehook-api-client": "1.0.23", + "onehook-api-client": "1.0.30", "qrcode.react": "^4.2.0", "react": "^19.0.1", "react-dom": "^19.0.1", @@ -5704,9 +5704,9 @@ } }, "node_modules/onehook-api-client": { - "version": "1.0.23", - "resolved": "https://registry.npmjs.org/onehook-api-client/-/onehook-api-client-1.0.23.tgz", - "integrity": "sha512-sHq2lh+3GasvK4M1eJMMKX7Vdc/+iSXpHbWPOKhZZTv1Hnljdd7dwEz5RhWiZBUe7WWmkEMuui7CCmN1LKWC3g==", + "version": "1.0.30", + "resolved": "https://registry.npmjs.org/onehook-api-client/-/onehook-api-client-1.0.30.tgz", + "integrity": "sha512-oJKZWq+uHgTKXvg1VgRBuDWUXNQsCJV6se4mEv8iWT9QpjIlPx3JkYtY00geDL6nh8LXF/CdPZDkz2c3B0gV6w==", "license": "UNLICENSED", "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", diff --git a/package.json b/package.json index 24e3fd9..39761d7 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "jsqr": "1.4.0", "lucide-react": "^0.546.0", "motion": "^12.23.24", - "onehook-api-client": "1.0.23", + "onehook-api-client": "1.0.30", "qrcode.react": "^4.2.0", "react": "^19.0.1", "react-dom": "^19.0.1", diff --git a/src/api/chat.ts b/src/api/chat.ts index 32d5ef1..a5361d7 100644 --- a/src/api/chat.ts +++ b/src/api/chat.ts @@ -30,7 +30,7 @@ export type PresenceState = 'ONLINE' | 'OFFLINE'; * as a JSON string the client parses into a map of `reactorUserId -> reaction ciphertext`; each value * is E2E-encrypted exactly like a message body. */ -export interface ChatMessageExtended extends ChatMessage { +export interface ChatMessageExtended extends Omit { contentType?: MessageContentType | null; replyToMessageId?: string | null; replyToTimestamp?: number | null; diff --git a/src/api/matching.ts b/src/api/matching.ts index 391d203..5f0d256 100644 --- a/src/api/matching.ts +++ b/src/api/matching.ts @@ -10,6 +10,19 @@ import { type RoseQuota, } from './rest'; +/** Discovery categories (mirrors the backend `DiscoveryCategory`). */ +export type DiscoveryCategory = 'ALL' | 'PROFILE_MATCH' | 'ONEHOOK_SUGGESTED' | 'SIMILAR'; + +export interface DiscoverFeed { + candidates: RankedCandidate[]; + count: number; + algorithm: string; + /** The category the backend applied. */ + category?: DiscoveryCategory; + /** Categories this member's tier may pick; just ['ALL'] for free members. */ + availableCategories?: DiscoveryCategory[]; +} + export type ProfileSection = | 'PHOTOS' | 'BIO' @@ -25,16 +38,21 @@ export const MatchingApi = { return (sdkClient as any).indexLocation({ userId, lat, lon }); }, - discover: async (userId: string, lat: number, lon: number) => { - const timeoutPromise = new Promise<{ candidates: RankedCandidate[]; count: number; algorithm: string }>((_, reject) => + /** + * The discover feed. Without `category` every tier gets the mixed deck (OneHook Intelligence + + * Mr. OneHook). Super+ may pass a category; the backend answers 403 PREMIUM_REQUIRED otherwise. + */ + discover: async (userId: string, lat: number, lon: number, category?: DiscoveryCategory) => { + const timeoutPromise = new Promise((_, reject) => setTimeout(() => reject(new Error('Discover request timed out. Please check your connection and try again.')), 10000) ); const discoverPromise = (async () => { - return (await (sdkClient as any).discover({ userId, lat, lon })) as unknown as { - candidates: RankedCandidate[]; - count: number; - algorithm: string; - }; + return (await (sdkClient as any).discover({ + userId, + lat, + lon, + ...(category && category !== 'ALL' ? { category } : {}), + })) as unknown as DiscoverFeed; })(); return Promise.race([discoverPromise, timeoutPromise]); }, diff --git a/src/app/AppContent.tsx b/src/app/AppContent.tsx index 7dcb12d..1d4148c 100644 --- a/src/app/AppContent.tsx +++ b/src/app/AppContent.tsx @@ -103,6 +103,9 @@ export function AppContent() { loading: candidatesLoading, error: candidatesError, refresh: refreshCandidates, + category: discoveryCategory, + availableCategories, + setCategory: setDiscoveryCategory, } = useCandidates(userCoords); const { pass, like, loading: swipeLoading } = useSwipe(); const { showToast } = useToast(); @@ -309,6 +312,9 @@ export function AppContent() { > ; @@ -630,10 +635,19 @@ export function DiscoveryCard({ return (
- {/* Recommendation banner */} - {((candidate.score && candidate.score >= 0.9) || candidate.recommendationReason) && ( -
- {candidate.recommendationReason || 'Handpicked for you — high compatibility and shared vibe.'} + {/* Match finder: who found this person and why. Mr. OneHook = from a OneHook suggestion (asked or + inferred); OneHook Intelligence = profile details match the member's preferences. */} + {(candidate.matchFinderLabel || candidate.reasoning || candidate.recommendationReason) && ( +
+ {candidate.matchFinderLabel && ( + {candidate.matchFinderLabel} + )} + {candidate.reasoning || candidate.recommendationReason}
)} diff --git a/src/features/discovery/DiscoveryView.tsx b/src/features/discovery/DiscoveryView.tsx index b28204a..66ae4c4 100644 --- a/src/features/discovery/DiscoveryView.tsx +++ b/src/features/discovery/DiscoveryView.tsx @@ -3,7 +3,7 @@ import { AnimatePresence, motion } from 'motion/react'; import type { DiscoveryCandidate, UserProfile } from '../../types'; import type { ApiError } from '../../lib/api-client'; import type { LikeTargetType } from '../../api/rest'; -import { MatchingApi } from '../../api/matching'; +import { MatchingApi, type DiscoveryCategory } from '../../api/matching'; import { LoadingSpinner } from '../../components/common/LoadingSpinner'; import { DiscoveryCard } from './DiscoveryCard'; import { CommentComposer } from './CommentComposer'; @@ -25,6 +25,9 @@ export function DiscoveryView({ onRetry, onPass, onLike, + category = 'ALL', + availableCategories = ['ALL'], + onCategoryChange, }: { key?: string; candidates: DiscoveryCandidate[]; @@ -44,6 +47,10 @@ export function DiscoveryView({ likeKind?: 'LIKE' | 'ROSE' ) => Promise; onNavigateToProfile?: () => void; + /** Applied discovery category and the ones this member may pick (from the backend). */ + category?: DiscoveryCategory; + availableCategories?: DiscoveryCategory[]; + onCategoryChange?: (category: DiscoveryCategory) => void; }) { // The element being commented on (composer open). `kind` distinguishes a normal like from a rose. const [activeComposer, setActiveComposer] = useState<{ @@ -129,6 +136,12 @@ export function DiscoveryView({ advance(candidateId); }; + // Super+ members get a category selector; free members (availableCategories = ['ALL']) see none. + const selector = + onCategoryChange && availableCategories.length > 1 ? ( + + ) : null; + if (loading) { return (
@@ -157,7 +170,8 @@ export function DiscoveryView({ if (!currentCandidate) { return ( -
+
+ {selector}

You’re All Caught Up

Check back soon for new people to meet.

@@ -169,6 +183,7 @@ export function DiscoveryView({ return (
+ {selector &&
{selector}
} ); } + +const CATEGORY_LABELS: Record = { + ALL: 'For you', + PROFILE_MATCH: 'Matches your preferences', + ONEHOOK_SUGGESTED: 'Mr. OneHook picks', + SIMILAR: 'Similar to your likes', +}; + +/** Discovery category chips (Super+). Options come from the backend's availableCategories. */ +function CategorySelector({ + value, + options, + onChange, +}: { + value: DiscoveryCategory; + options: DiscoveryCategory[]; + onChange: (c: DiscoveryCategory) => void; +}) { + return ( +
+ {options.map((option) => ( + + ))} +
+ ); +} diff --git a/src/hooks/use-api.ts b/src/hooks/use-api.ts index fadb5a4..4031e83 100644 --- a/src/hooks/use-api.ts +++ b/src/hooks/use-api.ts @@ -14,7 +14,7 @@ import { MessageStatus } from 'onehook-api-client/graphql'; import { PreferencesApi } from '../api/preferences'; import { StateApi } from '../api/state'; import { ProfileApi } from '../api/profile'; -import { MatchingApi, type ProfileSection } from '../api/matching'; +import { MatchingApi, type DiscoveryCategory, type ProfileSection } from '../api/matching'; import type { LikeTargetType, ReceivedLike } from '../api/rest'; import { ChatMessagingApi } from '../api/chat'; import { ChatEncryptionManager } from '../lib/chat-encryption'; @@ -170,12 +170,28 @@ function toDiscoveryCandidate( distanceKm: candidate.distanceKm, score: candidate.score, photos: [], + ...finderOf(candidate), + }; +} + +/** The match-finder attribution the backend puts on every card; survives profile hydration. */ +function finderOf(candidate: DiscoverResponse['candidates'][number]) { + return { + matchFinder: candidate.matchFinder, + matchFinderLabel: candidate.matchFinderLabel, + reasoning: candidate.reasoning, + suggestionBasis: candidate.suggestionBasis, + suggestionId: candidate.suggestionId, }; } export function useCandidates(activeCoords?: Coordinates) { const { currentUser, setCandidates } = useAppStore(); const [candidatesList, setCandidatesList] = useState([]); + // Discovery category (Super+ may narrow the feed). availableCategories comes from the backend, so the + // selector never hard-codes tier rules. + const [category, setCategory] = useState('ALL'); + const [availableCategories, setAvailableCategories] = useState(['ALL']); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); const [refreshKey, setRefreshKey] = useState(0); @@ -220,8 +236,11 @@ export function useCandidates(activeCoords?: Coordinates) { throw new ApiError('Authentication required to discover candidates', 401, 'UNAUTHORIZED'); } - const res = await MatchingApi.discover(userId, lat, lon); + const res = await MatchingApi.discover(userId, lat, lon, category); if (!active) return; + if (Array.isArray(res?.availableCategories) && res.availableCategories.length > 0) { + setAvailableCategories(res.availableCategories); + } if (res && Array.isArray(res.candidates) && res.candidates.length > 0) { const candidatePromises = res.candidates.map(async (candidate) => { @@ -247,6 +266,7 @@ export function useCandidates(activeCoords?: Coordinates) { distance: candidate.distanceKm, distanceKm: candidate.distanceKm, score: candidate.score, + ...finderOf(candidate), } as DiscoveryCandidate; } } catch (pErr) { @@ -296,7 +316,7 @@ export function useCandidates(activeCoords?: Coordinates) { return () => { active = false; }; - }, [uid, lat, lon, refreshKey, setCandidates]); + }, [uid, lat, lon, refreshKey, category, setCandidates]); const refresh = useCallback(() => { setRefreshKey((prev) => prev + 1); @@ -307,6 +327,9 @@ export function useCandidates(activeCoords?: Coordinates) { loading, error, refresh, + category, + availableCategories, + setCategory, }; } diff --git a/src/lib/analytics/generated/telemetryCatalog.ts b/src/lib/analytics/generated/telemetryCatalog.ts index b582c2f..e31cf2d 100644 --- a/src/lib/analytics/generated/telemetryCatalog.ts +++ b/src/lib/analytics/generated/telemetryCatalog.ts @@ -1,15 +1,15 @@ // GENERATED FILE - DO NOT EDIT. -// telemetry-integrity: sha256 ba978d01fe927413a36fd8f2b3d8d595ed4c72a84bc4ad1c5a9e880a72aa4c97 +// telemetry-integrity: sha256 34a4918a54cc60e7ee0259d51cd8fba1a6167c89465599a00f3f8ef937c44004 // Source of truth: OneHookBackend/packages/telemetry/src/catalog.ts // Regenerate: (OneHookBackend) npm run telemetry:generate && npm run telemetry:sync -// Catalog version 1.7.0, hash 4a3328962531236a. +// Catalog version 1.8.0, hash 9a56f9fef0ed4ae7. // // HARD RULE: every user interaction MUST emit ui_interaction with an id from THIS file, and // ids are controlled by the backend. Read TELEMETRY_CONTRACT.txt (printed by every build). /* eslint-disable */ -export const TELEMETRY_CATALOG_VERSION = "1.7.0"; -export const TELEMETRY_CATALOG_HASH = "4a3328962531236a"; +export const TELEMETRY_CATALOG_VERSION = "1.8.0"; +export const TELEMETRY_CATALOG_HASH = "9a56f9fef0ed4ae7"; /** Every signal type the ingest accepts. */ export const SignalType = { @@ -335,6 +335,7 @@ export const UiElement = { DISCOVER_LIKES_YOU_OPEN: "discover.likes_you_open", DISCOVER_ADD_HOOK_OPEN: "discover.add_hook_open", DISCOVER_RETRY: "discover.retry", + DISCOVER_CATEGORY_SELECT: "discover.category_select", DISCOVER_ADD_HOOK_SUBMIT: "discover.add_hook_submit", DISCOVER_UPGRADE_OPEN: "discover.upgrade_open", LIKE_COMPOSER_SEND: "like_composer.send", @@ -591,6 +592,7 @@ export const UI_ELEMENTS: { readonly [K in UiElementId]: UiElementSpec } = { "discover.likes_you_open": { screen: "DISCOVER", kind: "button", actions: ["tap", "dismiss"], values: null, platforms: ["ios", "android"] }, "discover.add_hook_open": { screen: "DISCOVER", kind: "button", actions: ["tap", "dismiss"], values: null, platforms: ["ios"] }, "discover.retry": { screen: "DISCOVER", kind: "button", actions: ["tap"], values: null, platforms: ["web", "ios", "android"] }, + "discover.category_select": { screen: "DISCOVER", kind: "button", actions: ["tap"], values: ["all", "profile_match", "onehook_suggested", "similar"], platforms: ["web", "ios", "android"] }, "discover.add_hook_submit": { screen: "DISCOVER", kind: "button", actions: ["submit"], values: null, platforms: ["web", "ios"] }, "discover.upgrade_open": { screen: "DISCOVER", kind: "button", actions: ["tap", "dismiss"], values: null, platforms: ["ios"] }, "like_composer.send": { screen: "LIKE_COMPOSER", kind: "button", actions: ["submit"], values: null, platforms: ["web", "ios", "android"] }, diff --git a/src/lib/mr-onehook-contract.ts b/src/lib/mr-onehook-contract.ts index 4ccd414..fb83fb8 100644 --- a/src/lib/mr-onehook-contract.ts +++ b/src/lib/mr-onehook-contract.ts @@ -155,10 +155,32 @@ export interface MemberSessionMetadata { messageCount: number; } +/** + * Outcome of a "find me ..." request. When the member asks Mr OneHook to find someone, the backend records + * a OneHook suggestion; people who fit it then appear in Discover as "Mr. OneHook" cards with `reasoning`. + */ +export interface MemberMatchSuggestion { + status: 'RECORDED' | 'PREMIUM_REQUIRED' | 'UNAVAILABLE'; + reasoning: string; +} + +/** One-line note shown under Mr OneHook's reply for a suggestion outcome. */ +export function matchSuggestionNote(suggestion: MemberMatchSuggestion): string { + switch (suggestion.status) { + case 'RECORDED': + return `Added to your Discover feed: ${suggestion.reasoning}`; + case 'PREMIUM_REQUIRED': + return 'Upgrade to Super to have Mr. OneHook find people for you.'; + default: + return "I couldn't save that to your Discover feed right now. Please try again later."; + } +} + export interface MemberChatResponse { reply: string; mood: MrOneHookMood; needsMoreContext: boolean; + matchSuggestion?: MemberMatchSuggestion; contextRequest?: MemberContextRequest; contextUsed?: MemberContextUsed; requestId?: string; @@ -238,6 +260,15 @@ export function parseMemberChatResponse(data: unknown): MemberChatResponse { if (typeof data.requestId === 'string') response.requestId = data.requestId; const session = parseSessionMetadata(data.session); if (session) response.session = session; + if (isRecord(data.matchSuggestion) + && (data.matchSuggestion.status === 'RECORDED' + || data.matchSuggestion.status === 'PREMIUM_REQUIRED' + || data.matchSuggestion.status === 'UNAVAILABLE')) { + response.matchSuggestion = { + status: data.matchSuggestion.status, + reasoning: typeof data.matchSuggestion.reasoning === 'string' ? data.matchSuggestion.reasoning : '', + }; + } return response; } diff --git a/src/lib/mr-onehook.ts b/src/lib/mr-onehook.ts index cb5e254..54889b8 100644 --- a/src/lib/mr-onehook.ts +++ b/src/lib/mr-onehook.ts @@ -26,6 +26,7 @@ import { MEMBER_CHAT_PATH, type MemberChatAvailability, parseMemberChatResponse, + matchSuggestionNote, type MemberChatResponse, type MemberSessionMetadata, type MrOneHookMessage, @@ -362,7 +363,12 @@ export function useMrOneHookChat(options: UseMrOneHookChatOptions): UseMrOneHook return; } - setMessages((prev) => [...prev, { role: 'assistant', content: result.reply }]); + // A "find me ..." request: say what happened to the suggestion (added to Discover, needs Super, or + // could not be saved) under the reply. + const content = result.matchSuggestion + ? `${result.reply}\n\n${matchSuggestionNote(result.matchSuggestion)}` + : result.reply; + setMessages((prev) => [...prev, { role: 'assistant', content }]); setMood(result.mood || 'Happy'); }, [applySession, matchId], diff --git a/src/tests/integration.test.ts b/src/tests/integration.test.ts index adf1a86..cc04a3c 100644 --- a/src/tests/integration.test.ts +++ b/src/tests/integration.test.ts @@ -34,6 +34,8 @@ describe('Matching Pipeline: Gale-Shapley + Collaborative Filtering', () => { candidates: [], count: 0, algorithm: 'gale-shapley+cf', + category: 'ALL', + availableCategories: ['ALL'], }; expect(response.algorithm).toBe('gale-shapley+cf'); }); @@ -50,16 +52,21 @@ describe('Matching Pipeline: Gale-Shapley + Collaborative Filtering', () => { }); it('cold start: empty candidate list is a valid response', () => { - const response: DiscoverResponse = { candidates: [], count: 0, algorithm: 'gale-shapley+cf' }; + const response: DiscoverResponse = { + candidates: [], count: 0, algorithm: 'gale-shapley+cf', category: 'ALL', availableCategories: ['ALL'], + }; expect(response.candidates).toHaveLength(0); expect(response.count).toBe(0); }); it('top candidate score is highest in a sorted result set', () => { + const finder = { + matchFinder: 'ONEHOOK_INTELLIGENCE', matchFinderLabel: 'OneHook Intelligence', reasoning: 'r', + } as const; const candidates: RankedCandidate[] = [ - { userId: 'best', score: 0.95, distanceKm: 5 }, - { userId: 'good', score: 0.72, distanceKm: 5 }, - { userId: 'ok', score: 0.41, distanceKm: 5 }, + { ...finder, userId: 'best', score: 0.95, distanceKm: 5 }, + { ...finder, userId: 'good', score: 0.72, distanceKm: 5 }, + { ...finder, userId: 'ok', score: 0.41, distanceKm: 5 }, ]; const top = candidates[0]; candidates.forEach((c) => expect(top.score).toBeGreaterThanOrEqual(c.score)); diff --git a/src/tests/mr-onehook-contract.test.ts b/src/tests/mr-onehook-contract.test.ts index 5c4255c..4fcbd9d 100644 --- a/src/tests/mr-onehook-contract.test.ts +++ b/src/tests/mr-onehook-contract.test.ts @@ -5,6 +5,7 @@ import { isSessionErrorCode, MEMBER_CHAT_PATH, parseMemberChatResponse, + matchSuggestionNote, PUBLIC_PRODUCT_CHAT_PATH, } from '../lib/mr-onehook-contract'; import type { SelectedExcerpt } from '../lib/mr-onehook-excerpts'; @@ -214,3 +215,22 @@ describe('isSessionErrorCode', () => { expect(isSessionErrorCode(undefined)).toBe(false); }); }); + +describe('matchSuggestion — "find me ..." outcome', () => { + it('parses a valid suggestion outcome and ignores unknown statuses', () => { + const ok = parseMemberChatResponse({ + reply: 'On it.', mood: 'Happy', matchSuggestion: { status: 'RECORDED', reasoning: 'You asked for a reader' }, + }); + expect(ok.matchSuggestion).toEqual({ status: 'RECORDED', reasoning: 'You asked for a reader' }); + expect(parseMemberChatResponse({ reply: 'x', mood: 'Happy', matchSuggestion: { status: 'NOPE' } }).matchSuggestion) + .toBeUndefined(); + expect(parseMemberChatResponse({ reply: 'x', mood: 'Happy' }).matchSuggestion).toBeUndefined(); + }); + + it('renders a note for each outcome', () => { + expect(matchSuggestionNote({ status: 'RECORDED', reasoning: 'You asked for a reader' })) + .toBe('Added to your Discover feed: You asked for a reader'); + expect(matchSuggestionNote({ status: 'PREMIUM_REQUIRED', reasoning: '' })).toMatch(/Upgrade to Super/); + expect(matchSuggestionNote({ status: 'UNAVAILABLE', reasoning: '' })).toMatch(/try again later/); + }); +}); diff --git a/src/tests/unit.test.ts b/src/tests/unit.test.ts index a038ee6..53a19ff 100644 --- a/src/tests/unit.test.ts +++ b/src/tests/unit.test.ts @@ -31,22 +31,28 @@ describe('MatchingApi: Unit Tests', () => { }); }); +const finder = { + matchFinder: 'ONEHOOK_INTELLIGENCE', matchFinderLabel: 'OneHook Intelligence', reasoning: 'r', +} as const; + describe('DiscoverResponse: Ranked Candidates', () => { it('discover response shape includes algorithm field', () => { const response: DiscoverResponse = { candidates: [ - { userId: 'abc123', score: 0.847, distanceKm: 5 }, - { userId: 'def456', score: 0.731, distanceKm: 5 }, + { ...finder, userId: 'abc123', score: 0.847, distanceKm: 5 }, + { ...finder, userId: 'def456', score: 0.731, distanceKm: 5 }, ], count: 2, algorithm: 'gale-shapley+cf', + category: 'ALL', + availableCategories: ['ALL'], }; expect(response.algorithm).toBe('gale-shapley+cf'); expect(response.count).toBe(2); }); it('ranked candidates have userId and score fields', () => { - const candidate: RankedCandidate = { userId: 'user1', score: 0.75, distanceKm: 5 }; + const candidate: RankedCandidate = { ...finder, userId: 'user1', score: 0.75, distanceKm: 5 }; expect(candidate.userId).toBe('user1'); expect(candidate.score).toBeGreaterThanOrEqual(0); expect(candidate.score).toBeLessThanOrEqual(1); @@ -54,9 +60,9 @@ describe('DiscoverResponse: Ranked Candidates', () => { it('candidates are ordered by score descending', () => { const candidates: RankedCandidate[] = [ - { userId: 'a', score: 0.9, distanceKm: 5 }, - { userId: 'b', score: 0.7, distanceKm: 5 }, - { userId: 'c', score: 0.5, distanceKm: 5 }, + { ...finder, userId: 'a', score: 0.9, distanceKm: 5 }, + { ...finder, userId: 'b', score: 0.7, distanceKm: 5 }, + { ...finder, userId: 'c', score: 0.5, distanceKm: 5 }, ]; for (let i = 0; i < candidates.length - 1; i++) { expect(candidates[i].score).toBeGreaterThanOrEqual(candidates[i + 1].score); @@ -64,12 +70,12 @@ describe('DiscoverResponse: Ranked Candidates', () => { }); it('score of 0 is valid for cold-start candidates', () => { - const candidate: RankedCandidate = { userId: 'newUser', score: 0, distanceKm: 5 }; + const candidate: RankedCandidate = { ...finder, userId: 'newUser', score: 0, distanceKm: 5 }; expect(candidate.score).toBe(0); }); it('score of 1 is valid for top mutual-affinity candidates', () => { - const candidate: RankedCandidate = { userId: 'topUser', score: 1, distanceKm: 5 }; + const candidate: RankedCandidate = { ...finder, userId: 'topUser', score: 1, distanceKm: 5 }; expect(candidate.score).toBe(1); }); }); diff --git a/src/types.ts b/src/types.ts index d142654..2cd6cd3 100644 --- a/src/types.ts +++ b/src/types.ts @@ -94,6 +94,12 @@ export type DiscoveryCandidate = CandidateDto & { education?: string; hometown?: string; interests?: string[]; + /** Who found this candidate: 'ONEHOOK_INTELLIGENCE' or 'MR_ONEHOOK'. */ + matchFinder?: string; + /** Display name of matchFinder ("OneHook Intelligence" / "Mr. OneHook"). */ + matchFinderLabel?: string; + /** Why this candidate is shown. */ + reasoning?: string; }; export type RankedCandidate = CandidateDto & {