@hiofu/apply-sdk 0.1.0
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/LICENSE +173 -0
- package/README.md +420 -0
- package/dist/chunk-6YSWH4IM.js +647 -0
- package/dist/client-BD0-Mbnq.d.cts +279 -0
- package/dist/client-BD0-Mbnq.d.ts +279 -0
- package/dist/index.cjs +1036 -0
- package/dist/index.d.cts +158 -0
- package/dist/index.d.ts +158 -0
- package/dist/index.global.js +1 -0
- package/dist/index.js +381 -0
- package/dist/react.cjs +748 -0
- package/dist/react.d.cts +20 -0
- package/dist/react.d.ts +20 -0
- package/dist/react.js +97 -0
- package/package.json +70 -0
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
type HiofuScope = "profile.basic" | "profile.full" | "evidence.read" | "applications.write" | "passport.snapshot";
|
|
2
|
+
interface HiofuConfig {
|
|
3
|
+
/** Public client identifier (pk_live_… / pk_test_…). */
|
|
4
|
+
clientId: string;
|
|
5
|
+
/** Where the Hiofu candidate app lives. Defaults to https://hiofu.com */
|
|
6
|
+
hiofuOrigin?: string;
|
|
7
|
+
/** Where the backend API lives. Defaults to https://api.hiofu.com */
|
|
8
|
+
apiBase?: string;
|
|
9
|
+
/** Optional default scopes for `authorize()`. */
|
|
10
|
+
scopes?: HiofuScope[];
|
|
11
|
+
/** Optional default scopes for `apply()`. */
|
|
12
|
+
applyScopes?: HiofuScope[];
|
|
13
|
+
/** Where the popup will redirect on success. Must be one of the partner's
|
|
14
|
+
* registered URIs. If omitted in the browser, the SDK falls back to a
|
|
15
|
+
* same-origin `/oauth/callback.html` page when possible. */
|
|
16
|
+
redirectUri?: string;
|
|
17
|
+
/** Where to store the access token client-side. */
|
|
18
|
+
storage?: "session" | "memory";
|
|
19
|
+
/** How long to wait for the consent popup before failing. Defaults to 5 minutes. */
|
|
20
|
+
authorizeTimeoutMs?: number;
|
|
21
|
+
/** Optional lifecycle listener for popup/auth/apply events. */
|
|
22
|
+
onEvent?: (event: HiofuEvent) => void;
|
|
23
|
+
}
|
|
24
|
+
interface HiofuTokenSet {
|
|
25
|
+
expiresAt: number;
|
|
26
|
+
scopes: HiofuScope[];
|
|
27
|
+
}
|
|
28
|
+
interface HiofuApplyRole {
|
|
29
|
+
/** Partner-owned stable role/job identifier. */
|
|
30
|
+
externalRoleId: string;
|
|
31
|
+
/** Partner-owned stable employer/company identifier. */
|
|
32
|
+
externalEmployerId: string;
|
|
33
|
+
title: string;
|
|
34
|
+
description?: string;
|
|
35
|
+
department?: string;
|
|
36
|
+
locations?: string[];
|
|
37
|
+
jobTypes?: string[];
|
|
38
|
+
salaryMin?: number;
|
|
39
|
+
salaryMax?: number;
|
|
40
|
+
salaryCurrency?: string;
|
|
41
|
+
experienceMin?: number;
|
|
42
|
+
experienceMax?: number;
|
|
43
|
+
metadata?: Record<string, unknown>;
|
|
44
|
+
}
|
|
45
|
+
interface HiofuApplyOptions {
|
|
46
|
+
jobId: string;
|
|
47
|
+
jobTitle: string;
|
|
48
|
+
employerId: string;
|
|
49
|
+
employerName: string;
|
|
50
|
+
scopes?: HiofuScope[];
|
|
51
|
+
variationId?: string;
|
|
52
|
+
/** Optional richer partner role payload used by Apply Rail role mapping. */
|
|
53
|
+
role?: HiofuApplyRole;
|
|
54
|
+
/** Stable partner-generated key for safe retries and duplicate-submit protection.
|
|
55
|
+
* If omitted, the SDK generates a per-attempt key automatically. */
|
|
56
|
+
idempotencyKey?: string;
|
|
57
|
+
}
|
|
58
|
+
interface HiofuBasicProfile {
|
|
59
|
+
id?: string | null;
|
|
60
|
+
name?: string | null;
|
|
61
|
+
firstName?: string | null;
|
|
62
|
+
lastName?: string | null;
|
|
63
|
+
email?: string | null;
|
|
64
|
+
phone?: string | null;
|
|
65
|
+
location?: string | null;
|
|
66
|
+
professionalTitle: string | null;
|
|
67
|
+
avatarUrl?: string | null;
|
|
68
|
+
professionalLinks?: unknown;
|
|
69
|
+
}
|
|
70
|
+
interface HiofuSkill {
|
|
71
|
+
id?: string | null;
|
|
72
|
+
name: string;
|
|
73
|
+
category: string | null;
|
|
74
|
+
proficiencyLevel: string | null;
|
|
75
|
+
yearsExperience: number | null;
|
|
76
|
+
verificationType: string;
|
|
77
|
+
verifiedAt: string | Date | null;
|
|
78
|
+
trustScore: number | null;
|
|
79
|
+
confidenceScore: number | null;
|
|
80
|
+
}
|
|
81
|
+
interface HiofuExperience {
|
|
82
|
+
id?: string | null;
|
|
83
|
+
title: string;
|
|
84
|
+
company?: string | null;
|
|
85
|
+
yearStart: number | null;
|
|
86
|
+
yearEnd: number | null;
|
|
87
|
+
monthStart: number | null;
|
|
88
|
+
monthEnd: number | null;
|
|
89
|
+
isCurrent: boolean;
|
|
90
|
+
employmentType: string | null;
|
|
91
|
+
description?: string | null;
|
|
92
|
+
highlights?: string[];
|
|
93
|
+
skillIds: string[];
|
|
94
|
+
}
|
|
95
|
+
interface HiofuEducation {
|
|
96
|
+
id?: string | null;
|
|
97
|
+
degree: string;
|
|
98
|
+
institution?: string | null;
|
|
99
|
+
fieldOfStudy: string | null;
|
|
100
|
+
year: number | null;
|
|
101
|
+
gpa: number | null;
|
|
102
|
+
honors: string | null;
|
|
103
|
+
}
|
|
104
|
+
interface HiofuAchievement {
|
|
105
|
+
id?: string | null;
|
|
106
|
+
title: string;
|
|
107
|
+
description?: string | null;
|
|
108
|
+
metric: string | null;
|
|
109
|
+
}
|
|
110
|
+
interface HiofuFullProfile extends HiofuBasicProfile {
|
|
111
|
+
bio: string | null;
|
|
112
|
+
skills: HiofuSkill[];
|
|
113
|
+
experiences: HiofuExperience[];
|
|
114
|
+
education: HiofuEducation[];
|
|
115
|
+
achievements: HiofuAchievement[];
|
|
116
|
+
}
|
|
117
|
+
interface HiofuEvidenceItem {
|
|
118
|
+
id?: string | null;
|
|
119
|
+
title: string;
|
|
120
|
+
evidenceType: string;
|
|
121
|
+
normalisedProficiency: string | null;
|
|
122
|
+
trustScore: number | null;
|
|
123
|
+
proctoringLevel: string | null;
|
|
124
|
+
completedAt: string | Date | null;
|
|
125
|
+
expiresAt: string | Date | null;
|
|
126
|
+
}
|
|
127
|
+
interface HiofuEvidenceBundle {
|
|
128
|
+
trustScore: number;
|
|
129
|
+
evidence: HiofuEvidenceItem[];
|
|
130
|
+
}
|
|
131
|
+
interface HiofuSnapshotFocus {
|
|
132
|
+
targetRole: string | null;
|
|
133
|
+
industry: string | null;
|
|
134
|
+
headline: string | null;
|
|
135
|
+
summary: string | null;
|
|
136
|
+
}
|
|
137
|
+
interface HiofuSnapshotSkillPreview {
|
|
138
|
+
name: string;
|
|
139
|
+
category: string | null;
|
|
140
|
+
verificationType: string | null;
|
|
141
|
+
yearsExperience: number | null;
|
|
142
|
+
trustScore: number | null;
|
|
143
|
+
}
|
|
144
|
+
interface HiofuSnapshotExperiencePreview {
|
|
145
|
+
title: string;
|
|
146
|
+
yearStart: number | null;
|
|
147
|
+
yearEnd: number | null;
|
|
148
|
+
isCurrent: boolean;
|
|
149
|
+
employmentType: string | null;
|
|
150
|
+
}
|
|
151
|
+
interface HiofuSnapshotEducationPreview {
|
|
152
|
+
degree: string;
|
|
153
|
+
fieldOfStudy: string | null;
|
|
154
|
+
year: number | null;
|
|
155
|
+
honors: string | null;
|
|
156
|
+
}
|
|
157
|
+
interface HiofuSnapshotAchievementPreview {
|
|
158
|
+
title: string;
|
|
159
|
+
metric: string | null;
|
|
160
|
+
}
|
|
161
|
+
interface HiofuSnapshotEvidencePreview {
|
|
162
|
+
title: string;
|
|
163
|
+
evidenceType: string;
|
|
164
|
+
trustScore: number | null;
|
|
165
|
+
verificationStatus: string | null;
|
|
166
|
+
}
|
|
167
|
+
interface HiofuPassportSnapshot {
|
|
168
|
+
versionNumber: number;
|
|
169
|
+
variationName: string | null;
|
|
170
|
+
label: string | null;
|
|
171
|
+
createdAt: string | Date;
|
|
172
|
+
trustScore: number;
|
|
173
|
+
trustBand: "low" | "moderate" | "high";
|
|
174
|
+
professionalTitle: string | null;
|
|
175
|
+
focus: HiofuSnapshotFocus;
|
|
176
|
+
counts: {
|
|
177
|
+
skills: number;
|
|
178
|
+
experiences: number;
|
|
179
|
+
education: number;
|
|
180
|
+
achievements: number;
|
|
181
|
+
evidence: number;
|
|
182
|
+
};
|
|
183
|
+
preview: {
|
|
184
|
+
skills: HiofuSnapshotSkillPreview[];
|
|
185
|
+
experiences: HiofuSnapshotExperiencePreview[];
|
|
186
|
+
education: HiofuSnapshotEducationPreview[];
|
|
187
|
+
achievements: HiofuSnapshotAchievementPreview[];
|
|
188
|
+
evidence: HiofuSnapshotEvidencePreview[];
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
interface HiofuApplicationRecord {
|
|
192
|
+
id: string;
|
|
193
|
+
status: string;
|
|
194
|
+
jobId?: string;
|
|
195
|
+
jobTitle?: string;
|
|
196
|
+
employerId?: string;
|
|
197
|
+
employerName?: string;
|
|
198
|
+
submittedAt?: string | Date;
|
|
199
|
+
statusUpdatedAt?: string | Date;
|
|
200
|
+
}
|
|
201
|
+
interface HiofuPartnerDelivery {
|
|
202
|
+
mode: "webhook_and_response" | "response_only";
|
|
203
|
+
event: string;
|
|
204
|
+
queued: boolean;
|
|
205
|
+
endpointCount?: number;
|
|
206
|
+
}
|
|
207
|
+
interface HiofuSharedView {
|
|
208
|
+
type: "full_passport" | "variation";
|
|
209
|
+
label: string | null;
|
|
210
|
+
}
|
|
211
|
+
interface HiofuApplyResult {
|
|
212
|
+
application: HiofuApplicationRecord;
|
|
213
|
+
authorization: HiofuTokenSet;
|
|
214
|
+
idempotencyKey: string;
|
|
215
|
+
sharedView?: HiofuSharedView | null;
|
|
216
|
+
versionNumber?: number | null;
|
|
217
|
+
profile?: HiofuBasicProfile | HiofuFullProfile | null;
|
|
218
|
+
evidence?: HiofuEvidenceBundle | null;
|
|
219
|
+
snapshot?: HiofuPassportSnapshot | null;
|
|
220
|
+
delivery?: HiofuPartnerDelivery | null;
|
|
221
|
+
}
|
|
222
|
+
interface HiofuPartner {
|
|
223
|
+
id: string;
|
|
224
|
+
name: string;
|
|
225
|
+
logoUrl: string | null;
|
|
226
|
+
websiteUrl: string | null;
|
|
227
|
+
privacyPolicyUrl: string | null;
|
|
228
|
+
}
|
|
229
|
+
type HiofuEvent = {
|
|
230
|
+
type: "popup_opened";
|
|
231
|
+
redirectUri: string;
|
|
232
|
+
} | {
|
|
233
|
+
type: "popup_closed";
|
|
234
|
+
reason: "completed" | "denied" | "user_closed" | "timed_out";
|
|
235
|
+
} | {
|
|
236
|
+
type: "popup_result_received";
|
|
237
|
+
channel: "message" | "storage" | "broadcast" | "poll_url" | "poll_storage" | "focus_storage" | "close_check";
|
|
238
|
+
hasCode: boolean;
|
|
239
|
+
hasError: boolean;
|
|
240
|
+
stateMatches: boolean;
|
|
241
|
+
error?: string | null;
|
|
242
|
+
variationId?: string | null;
|
|
243
|
+
} | {
|
|
244
|
+
type: "token_issued";
|
|
245
|
+
token: HiofuTokenSet;
|
|
246
|
+
} | {
|
|
247
|
+
type: "apply_started";
|
|
248
|
+
input: Pick<HiofuApplyOptions, "jobId" | "jobTitle" | "employerId" | "employerName" | "variationId">;
|
|
249
|
+
} | {
|
|
250
|
+
type: "apply_submitting";
|
|
251
|
+
idempotencyKey: string;
|
|
252
|
+
variationId: string | null;
|
|
253
|
+
} | {
|
|
254
|
+
type: "apply_success";
|
|
255
|
+
result: HiofuApplyResult;
|
|
256
|
+
} | {
|
|
257
|
+
type: "apply_error";
|
|
258
|
+
error: Error;
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
declare const DEFAULT_AUTHORIZE_SCOPES: HiofuScope[];
|
|
262
|
+
declare const DEFAULT_APPLY_SCOPES: HiofuScope[];
|
|
263
|
+
declare class HiofuClient {
|
|
264
|
+
private readonly listeners;
|
|
265
|
+
readonly config: Required<Pick<HiofuConfig, "clientId" | "hiofuOrigin" | "apiBase" | "storage" | "authorizeTimeoutMs">> & HiofuConfig;
|
|
266
|
+
constructor(config: HiofuConfig);
|
|
267
|
+
subscribe(listener: (event: HiofuEvent) => void): () => void;
|
|
268
|
+
private emit;
|
|
269
|
+
/** Returns a usable access token, refreshing if needed. */
|
|
270
|
+
getAccessToken(): Promise<string | null>;
|
|
271
|
+
/** Open the popup, get a token. */
|
|
272
|
+
authorize(scopes?: HiofuScope[], context?: Pick<HiofuApplyOptions, "jobId" | "jobTitle" | "employerId" | "employerName">): Promise<HiofuTokenSet>;
|
|
273
|
+
/** End-to-end apply: authorize if needed, then POST application. */
|
|
274
|
+
apply(opts: HiofuApplyOptions): Promise<HiofuApplyResult>;
|
|
275
|
+
getProfile(scope?: "basic" | "full"): Promise<unknown>;
|
|
276
|
+
logout(): Promise<void>;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export { DEFAULT_APPLY_SCOPES as D, HiofuClient as H, type HiofuScope as a, type HiofuApplyResult as b, type HiofuConfig as c, type HiofuEvent as d, type HiofuApplyOptions as e, type HiofuTokenSet as f, DEFAULT_AUTHORIZE_SCOPES as g, type HiofuApplyRole as h, type HiofuPartner as i };
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
type HiofuScope = "profile.basic" | "profile.full" | "evidence.read" | "applications.write" | "passport.snapshot";
|
|
2
|
+
interface HiofuConfig {
|
|
3
|
+
/** Public client identifier (pk_live_… / pk_test_…). */
|
|
4
|
+
clientId: string;
|
|
5
|
+
/** Where the Hiofu candidate app lives. Defaults to https://hiofu.com */
|
|
6
|
+
hiofuOrigin?: string;
|
|
7
|
+
/** Where the backend API lives. Defaults to https://api.hiofu.com */
|
|
8
|
+
apiBase?: string;
|
|
9
|
+
/** Optional default scopes for `authorize()`. */
|
|
10
|
+
scopes?: HiofuScope[];
|
|
11
|
+
/** Optional default scopes for `apply()`. */
|
|
12
|
+
applyScopes?: HiofuScope[];
|
|
13
|
+
/** Where the popup will redirect on success. Must be one of the partner's
|
|
14
|
+
* registered URIs. If omitted in the browser, the SDK falls back to a
|
|
15
|
+
* same-origin `/oauth/callback.html` page when possible. */
|
|
16
|
+
redirectUri?: string;
|
|
17
|
+
/** Where to store the access token client-side. */
|
|
18
|
+
storage?: "session" | "memory";
|
|
19
|
+
/** How long to wait for the consent popup before failing. Defaults to 5 minutes. */
|
|
20
|
+
authorizeTimeoutMs?: number;
|
|
21
|
+
/** Optional lifecycle listener for popup/auth/apply events. */
|
|
22
|
+
onEvent?: (event: HiofuEvent) => void;
|
|
23
|
+
}
|
|
24
|
+
interface HiofuTokenSet {
|
|
25
|
+
expiresAt: number;
|
|
26
|
+
scopes: HiofuScope[];
|
|
27
|
+
}
|
|
28
|
+
interface HiofuApplyRole {
|
|
29
|
+
/** Partner-owned stable role/job identifier. */
|
|
30
|
+
externalRoleId: string;
|
|
31
|
+
/** Partner-owned stable employer/company identifier. */
|
|
32
|
+
externalEmployerId: string;
|
|
33
|
+
title: string;
|
|
34
|
+
description?: string;
|
|
35
|
+
department?: string;
|
|
36
|
+
locations?: string[];
|
|
37
|
+
jobTypes?: string[];
|
|
38
|
+
salaryMin?: number;
|
|
39
|
+
salaryMax?: number;
|
|
40
|
+
salaryCurrency?: string;
|
|
41
|
+
experienceMin?: number;
|
|
42
|
+
experienceMax?: number;
|
|
43
|
+
metadata?: Record<string, unknown>;
|
|
44
|
+
}
|
|
45
|
+
interface HiofuApplyOptions {
|
|
46
|
+
jobId: string;
|
|
47
|
+
jobTitle: string;
|
|
48
|
+
employerId: string;
|
|
49
|
+
employerName: string;
|
|
50
|
+
scopes?: HiofuScope[];
|
|
51
|
+
variationId?: string;
|
|
52
|
+
/** Optional richer partner role payload used by Apply Rail role mapping. */
|
|
53
|
+
role?: HiofuApplyRole;
|
|
54
|
+
/** Stable partner-generated key for safe retries and duplicate-submit protection.
|
|
55
|
+
* If omitted, the SDK generates a per-attempt key automatically. */
|
|
56
|
+
idempotencyKey?: string;
|
|
57
|
+
}
|
|
58
|
+
interface HiofuBasicProfile {
|
|
59
|
+
id?: string | null;
|
|
60
|
+
name?: string | null;
|
|
61
|
+
firstName?: string | null;
|
|
62
|
+
lastName?: string | null;
|
|
63
|
+
email?: string | null;
|
|
64
|
+
phone?: string | null;
|
|
65
|
+
location?: string | null;
|
|
66
|
+
professionalTitle: string | null;
|
|
67
|
+
avatarUrl?: string | null;
|
|
68
|
+
professionalLinks?: unknown;
|
|
69
|
+
}
|
|
70
|
+
interface HiofuSkill {
|
|
71
|
+
id?: string | null;
|
|
72
|
+
name: string;
|
|
73
|
+
category: string | null;
|
|
74
|
+
proficiencyLevel: string | null;
|
|
75
|
+
yearsExperience: number | null;
|
|
76
|
+
verificationType: string;
|
|
77
|
+
verifiedAt: string | Date | null;
|
|
78
|
+
trustScore: number | null;
|
|
79
|
+
confidenceScore: number | null;
|
|
80
|
+
}
|
|
81
|
+
interface HiofuExperience {
|
|
82
|
+
id?: string | null;
|
|
83
|
+
title: string;
|
|
84
|
+
company?: string | null;
|
|
85
|
+
yearStart: number | null;
|
|
86
|
+
yearEnd: number | null;
|
|
87
|
+
monthStart: number | null;
|
|
88
|
+
monthEnd: number | null;
|
|
89
|
+
isCurrent: boolean;
|
|
90
|
+
employmentType: string | null;
|
|
91
|
+
description?: string | null;
|
|
92
|
+
highlights?: string[];
|
|
93
|
+
skillIds: string[];
|
|
94
|
+
}
|
|
95
|
+
interface HiofuEducation {
|
|
96
|
+
id?: string | null;
|
|
97
|
+
degree: string;
|
|
98
|
+
institution?: string | null;
|
|
99
|
+
fieldOfStudy: string | null;
|
|
100
|
+
year: number | null;
|
|
101
|
+
gpa: number | null;
|
|
102
|
+
honors: string | null;
|
|
103
|
+
}
|
|
104
|
+
interface HiofuAchievement {
|
|
105
|
+
id?: string | null;
|
|
106
|
+
title: string;
|
|
107
|
+
description?: string | null;
|
|
108
|
+
metric: string | null;
|
|
109
|
+
}
|
|
110
|
+
interface HiofuFullProfile extends HiofuBasicProfile {
|
|
111
|
+
bio: string | null;
|
|
112
|
+
skills: HiofuSkill[];
|
|
113
|
+
experiences: HiofuExperience[];
|
|
114
|
+
education: HiofuEducation[];
|
|
115
|
+
achievements: HiofuAchievement[];
|
|
116
|
+
}
|
|
117
|
+
interface HiofuEvidenceItem {
|
|
118
|
+
id?: string | null;
|
|
119
|
+
title: string;
|
|
120
|
+
evidenceType: string;
|
|
121
|
+
normalisedProficiency: string | null;
|
|
122
|
+
trustScore: number | null;
|
|
123
|
+
proctoringLevel: string | null;
|
|
124
|
+
completedAt: string | Date | null;
|
|
125
|
+
expiresAt: string | Date | null;
|
|
126
|
+
}
|
|
127
|
+
interface HiofuEvidenceBundle {
|
|
128
|
+
trustScore: number;
|
|
129
|
+
evidence: HiofuEvidenceItem[];
|
|
130
|
+
}
|
|
131
|
+
interface HiofuSnapshotFocus {
|
|
132
|
+
targetRole: string | null;
|
|
133
|
+
industry: string | null;
|
|
134
|
+
headline: string | null;
|
|
135
|
+
summary: string | null;
|
|
136
|
+
}
|
|
137
|
+
interface HiofuSnapshotSkillPreview {
|
|
138
|
+
name: string;
|
|
139
|
+
category: string | null;
|
|
140
|
+
verificationType: string | null;
|
|
141
|
+
yearsExperience: number | null;
|
|
142
|
+
trustScore: number | null;
|
|
143
|
+
}
|
|
144
|
+
interface HiofuSnapshotExperiencePreview {
|
|
145
|
+
title: string;
|
|
146
|
+
yearStart: number | null;
|
|
147
|
+
yearEnd: number | null;
|
|
148
|
+
isCurrent: boolean;
|
|
149
|
+
employmentType: string | null;
|
|
150
|
+
}
|
|
151
|
+
interface HiofuSnapshotEducationPreview {
|
|
152
|
+
degree: string;
|
|
153
|
+
fieldOfStudy: string | null;
|
|
154
|
+
year: number | null;
|
|
155
|
+
honors: string | null;
|
|
156
|
+
}
|
|
157
|
+
interface HiofuSnapshotAchievementPreview {
|
|
158
|
+
title: string;
|
|
159
|
+
metric: string | null;
|
|
160
|
+
}
|
|
161
|
+
interface HiofuSnapshotEvidencePreview {
|
|
162
|
+
title: string;
|
|
163
|
+
evidenceType: string;
|
|
164
|
+
trustScore: number | null;
|
|
165
|
+
verificationStatus: string | null;
|
|
166
|
+
}
|
|
167
|
+
interface HiofuPassportSnapshot {
|
|
168
|
+
versionNumber: number;
|
|
169
|
+
variationName: string | null;
|
|
170
|
+
label: string | null;
|
|
171
|
+
createdAt: string | Date;
|
|
172
|
+
trustScore: number;
|
|
173
|
+
trustBand: "low" | "moderate" | "high";
|
|
174
|
+
professionalTitle: string | null;
|
|
175
|
+
focus: HiofuSnapshotFocus;
|
|
176
|
+
counts: {
|
|
177
|
+
skills: number;
|
|
178
|
+
experiences: number;
|
|
179
|
+
education: number;
|
|
180
|
+
achievements: number;
|
|
181
|
+
evidence: number;
|
|
182
|
+
};
|
|
183
|
+
preview: {
|
|
184
|
+
skills: HiofuSnapshotSkillPreview[];
|
|
185
|
+
experiences: HiofuSnapshotExperiencePreview[];
|
|
186
|
+
education: HiofuSnapshotEducationPreview[];
|
|
187
|
+
achievements: HiofuSnapshotAchievementPreview[];
|
|
188
|
+
evidence: HiofuSnapshotEvidencePreview[];
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
interface HiofuApplicationRecord {
|
|
192
|
+
id: string;
|
|
193
|
+
status: string;
|
|
194
|
+
jobId?: string;
|
|
195
|
+
jobTitle?: string;
|
|
196
|
+
employerId?: string;
|
|
197
|
+
employerName?: string;
|
|
198
|
+
submittedAt?: string | Date;
|
|
199
|
+
statusUpdatedAt?: string | Date;
|
|
200
|
+
}
|
|
201
|
+
interface HiofuPartnerDelivery {
|
|
202
|
+
mode: "webhook_and_response" | "response_only";
|
|
203
|
+
event: string;
|
|
204
|
+
queued: boolean;
|
|
205
|
+
endpointCount?: number;
|
|
206
|
+
}
|
|
207
|
+
interface HiofuSharedView {
|
|
208
|
+
type: "full_passport" | "variation";
|
|
209
|
+
label: string | null;
|
|
210
|
+
}
|
|
211
|
+
interface HiofuApplyResult {
|
|
212
|
+
application: HiofuApplicationRecord;
|
|
213
|
+
authorization: HiofuTokenSet;
|
|
214
|
+
idempotencyKey: string;
|
|
215
|
+
sharedView?: HiofuSharedView | null;
|
|
216
|
+
versionNumber?: number | null;
|
|
217
|
+
profile?: HiofuBasicProfile | HiofuFullProfile | null;
|
|
218
|
+
evidence?: HiofuEvidenceBundle | null;
|
|
219
|
+
snapshot?: HiofuPassportSnapshot | null;
|
|
220
|
+
delivery?: HiofuPartnerDelivery | null;
|
|
221
|
+
}
|
|
222
|
+
interface HiofuPartner {
|
|
223
|
+
id: string;
|
|
224
|
+
name: string;
|
|
225
|
+
logoUrl: string | null;
|
|
226
|
+
websiteUrl: string | null;
|
|
227
|
+
privacyPolicyUrl: string | null;
|
|
228
|
+
}
|
|
229
|
+
type HiofuEvent = {
|
|
230
|
+
type: "popup_opened";
|
|
231
|
+
redirectUri: string;
|
|
232
|
+
} | {
|
|
233
|
+
type: "popup_closed";
|
|
234
|
+
reason: "completed" | "denied" | "user_closed" | "timed_out";
|
|
235
|
+
} | {
|
|
236
|
+
type: "popup_result_received";
|
|
237
|
+
channel: "message" | "storage" | "broadcast" | "poll_url" | "poll_storage" | "focus_storage" | "close_check";
|
|
238
|
+
hasCode: boolean;
|
|
239
|
+
hasError: boolean;
|
|
240
|
+
stateMatches: boolean;
|
|
241
|
+
error?: string | null;
|
|
242
|
+
variationId?: string | null;
|
|
243
|
+
} | {
|
|
244
|
+
type: "token_issued";
|
|
245
|
+
token: HiofuTokenSet;
|
|
246
|
+
} | {
|
|
247
|
+
type: "apply_started";
|
|
248
|
+
input: Pick<HiofuApplyOptions, "jobId" | "jobTitle" | "employerId" | "employerName" | "variationId">;
|
|
249
|
+
} | {
|
|
250
|
+
type: "apply_submitting";
|
|
251
|
+
idempotencyKey: string;
|
|
252
|
+
variationId: string | null;
|
|
253
|
+
} | {
|
|
254
|
+
type: "apply_success";
|
|
255
|
+
result: HiofuApplyResult;
|
|
256
|
+
} | {
|
|
257
|
+
type: "apply_error";
|
|
258
|
+
error: Error;
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
declare const DEFAULT_AUTHORIZE_SCOPES: HiofuScope[];
|
|
262
|
+
declare const DEFAULT_APPLY_SCOPES: HiofuScope[];
|
|
263
|
+
declare class HiofuClient {
|
|
264
|
+
private readonly listeners;
|
|
265
|
+
readonly config: Required<Pick<HiofuConfig, "clientId" | "hiofuOrigin" | "apiBase" | "storage" | "authorizeTimeoutMs">> & HiofuConfig;
|
|
266
|
+
constructor(config: HiofuConfig);
|
|
267
|
+
subscribe(listener: (event: HiofuEvent) => void): () => void;
|
|
268
|
+
private emit;
|
|
269
|
+
/** Returns a usable access token, refreshing if needed. */
|
|
270
|
+
getAccessToken(): Promise<string | null>;
|
|
271
|
+
/** Open the popup, get a token. */
|
|
272
|
+
authorize(scopes?: HiofuScope[], context?: Pick<HiofuApplyOptions, "jobId" | "jobTitle" | "employerId" | "employerName">): Promise<HiofuTokenSet>;
|
|
273
|
+
/** End-to-end apply: authorize if needed, then POST application. */
|
|
274
|
+
apply(opts: HiofuApplyOptions): Promise<HiofuApplyResult>;
|
|
275
|
+
getProfile(scope?: "basic" | "full"): Promise<unknown>;
|
|
276
|
+
logout(): Promise<void>;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export { DEFAULT_APPLY_SCOPES as D, HiofuClient as H, type HiofuScope as a, type HiofuApplyResult as b, type HiofuConfig as c, type HiofuEvent as d, type HiofuApplyOptions as e, type HiofuTokenSet as f, DEFAULT_AUTHORIZE_SCOPES as g, type HiofuApplyRole as h, type HiofuPartner as i };
|