@instabrain-sdks/api-client 2.3.3 → 2.5.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.
@@ -0,0 +1,459 @@
1
+ import { Gender, PaymentFrequency, BeneficiaryType, BeneficiaryRelationship } from './enums';
2
+ import { ThirdPartyQuoteReqHeight } from './quote.types';
3
+ /**
4
+ * Beneficiary relationship values accepted by Final Expense.
5
+ *
6
+ * This is the Final Expense allow-list — a subset of the shared
7
+ * {@link BeneficiaryRelationship} enum. Final Expense does not accept the wider
8
+ * relationship set (e.g. `Aunt`, `Boyfriend`, `Cousin`, in-laws, grandparents).
9
+ * Typed as a union of the specific enum members for compile-time safety.
10
+ */
11
+ export type FinalExpenseRelationship = BeneficiaryRelationship.Brother | BeneficiaryRelationship.CommonLawHusband | BeneficiaryRelationship.CommonLawWife | BeneficiaryRelationship.Daughter | BeneficiaryRelationship.DomesticPartner | BeneficiaryRelationship.Father | BeneficiaryRelationship.FatherOfChild | BeneficiaryRelationship.Fiance | BeneficiaryRelationship.Fiancee | BeneficiaryRelationship.FormerSpouse | BeneficiaryRelationship.Granddaughter | BeneficiaryRelationship.Grandson | BeneficiaryRelationship.Husband | BeneficiaryRelationship.LifePartner | BeneficiaryRelationship.Mother | BeneficiaryRelationship.MotherOfChild | BeneficiaryRelationship.Sister | BeneficiaryRelationship.Son | BeneficiaryRelationship.Spouse | BeneficiaryRelationship.Wife;
12
+ /**
13
+ * `beneficiaryType` values accepted by Final Expense.
14
+ *
15
+ * Restricted subset of {@link BeneficiaryType} — Business, Corporation,
16
+ * Charitable Organization, Employer, and Other are NOT accepted by Final Expense.
17
+ */
18
+ export type FinalExpenseBeneficiaryType = BeneficiaryType.Person | BeneficiaryType.InsuredEstate | BeneficiaryType.AllChildrenOfTheInsuredEqually | BeneficiaryType.AllChildrenOfTheMarriageEqually | BeneficiaryType.Trust;
19
+ /** Respiratory condition values for `RespiratoryDetails.conditions`. */
20
+ export type RespiratoryCondition = 'sleep apnea' | 'chronic obstructive pulmonary disease (COPD)' | 'emphysema' | 'acute respiratory distress syndrome (ARDS)' | 'any other respiratory disorder (other than asthma)' | 'required the use of a ventilator' | 'none of the above';
21
+ /** Sleep-apnea comorbid condition values for `RespiratoryDetails.sleepApneaComorbidConditions`. */
22
+ export type SleepApneaComorbidCondition = 'diabetes' | 'hypertension' | 'heart attack/heart disease' | 'none of the above';
23
+ /**
24
+ * Application status returned by the shared Final Submit endpoint.
25
+ *
26
+ * Final Expense uses asynchronous underwriting — `final-submit` returns
27
+ * `'InProgress'` on the first call. ADB/GIGDB are synchronous and omit
28
+ * `applicationStatus` entirely.
29
+ */
30
+ export type FinalSubmitApplicationStatus = 'InProgress';
31
+ /**
32
+ * Underwriting decision status returned by
33
+ * `GET /api/ThirdPartyApplication/final-submit-status` (Final Expense only).
34
+ *
35
+ * `'InProgress'` is the only non-terminal value — keep polling. Every other
36
+ * value means the underwriting journey is complete; stop polling.
37
+ */
38
+ export type FinalExpenseApplicationStatus = 'InProgress' | 'Approved' | 'NotEligible' | 'UnableToOffer' | 'Closed' | 'Abandoned' | 'TimedOut';
39
+ /**
40
+ * Request body for `POST /api/ThirdPartyIbFinalExpenseQuote/get`.
41
+ *
42
+ * Final Expense (InstaFinalExpense) is a simplified-issue whole life product for
43
+ * ages 50–85. The response `selectedQuote.quoteResponseId` is the token you must
44
+ * pass to {@link ThirdPartyFinalExpenseStartApplicationReq.quoteResponseId} on
45
+ * start application.
46
+ *
47
+ * Validation rules (enforced server-side):
48
+ * - `faceAmount`, `gender`, `stateCode`, `paymentFreq`, `flagTobaccoUse` are required.
49
+ * - `age` OR `dateOfBirth` is required (resolved age must be 50–85; `dateOfBirth`
50
+ * takes priority when both are provided).
51
+ * - `height` validation applies only when provided: `feet` 1–8, `inches` 0–11.
52
+ * - Final Expense is not available in all states; unsupported states return
53
+ * `InvalidRequestFormat`.
54
+ */
55
+ export interface ThirdPartyFinalExpenseQuoteReq {
56
+ /** Coverage amount in dollars (5,000–50,000). */
57
+ faceAmount: number;
58
+ /** Applicant gender. Serialized as `'Male'` / `'Female'`. */
59
+ gender: Gender;
60
+ /** 2-letter US state code. Product must be available in this state. */
61
+ stateCode: string;
62
+ /** Applicant age (50–85). Provide `age` OR `dateOfBirth`. */
63
+ age?: number | null;
64
+ /** Applicant date of birth (ISO 8601). Takes priority over `age` when both provided. Derived age must be 50–85. */
65
+ dateOfBirth?: string | null;
66
+ /** Payment frequency. Final Expense supports `Monthly` / `Annually` only. */
67
+ paymentFreq: PaymentFrequency;
68
+ /** Whether the applicant uses tobacco/nicotine. Affects premium. Always required. */
69
+ flagTobaccoUse: boolean;
70
+ /** Optional. Used for underwriting when provided. `feet` 1–8, `inches` 0–11. */
71
+ height?: ThirdPartyQuoteReqHeight | null;
72
+ /** Optional. Weight in pounds. Independent of `height`. */
73
+ weightInLbs?: number | null;
74
+ /** Optional. Alphabetic only. Lead capture. */
75
+ firstName?: string | null;
76
+ /** Optional. Alphabetic only. Lead capture. */
77
+ lastName?: string | null;
78
+ /** Optional. Valid email format. Lead capture. */
79
+ email?: string | null;
80
+ /** Optional. 10-digit US phone number or `+1XXXXXXXXXX`. Lead capture. */
81
+ phoneNum?: string | null;
82
+ }
83
+ /** A single Final Expense quote returned inside {@link ThirdPartyFinalExpenseQuoteRes}. */
84
+ export interface ThirdPartyFinalExpenseSelectedQuote {
85
+ /** **Pass this as `quoteResponseId` in start application.** */
86
+ quoteResponseId: string;
87
+ /** Total premium at the requested payment frequency. */
88
+ quoteAmount: number | null;
89
+ /** Annual billing savings versus monthly. `null` when `paymentFreq` is `Annually`. */
90
+ premiumSaveWhenSelectingAnnual: number | null;
91
+ /** Upper premium bound for the quoted profile. */
92
+ maxQuoteAmount: number | null;
93
+ /** Lower premium bound for the quoted profile. */
94
+ minQuoteAmount: number | null;
95
+ /** Coverage amount from the request. */
96
+ faceAmount: number;
97
+ /** Payment frequency from the request. `null` when not yet set. */
98
+ paymentFrequency: PaymentFrequency | null;
99
+ }
100
+ /**
101
+ * Response from the Final Expense quote, get-existing-quote, and update-quote
102
+ * endpoints — all three share this shape.
103
+ */
104
+ export interface ThirdPartyFinalExpenseQuoteRes {
105
+ /** Product display name, e.g. `"InstaFinalExpense"`. */
106
+ productName: string | null;
107
+ selectedQuote: ThirdPartyFinalExpenseSelectedQuote;
108
+ }
109
+ /**
110
+ * Request body for `POST /api/ThirdPartyIbFinalExpenseQuote/update`.
111
+ *
112
+ * Updates `faceAmount` and/or `paymentFreq` on an existing Final Expense quote.
113
+ * Only these two fields can change — nicotine, state, and age cannot. Blocked
114
+ * once a successful EFT payment has been recorded for the opportunity
115
+ * (returns `"Quote update is not allowed when payment is already made."`).
116
+ */
117
+ export interface ThirdPartyFinalExpenseUpdateQuoteReq {
118
+ /** Opportunity ID from a prior quote or application response. */
119
+ opportunityId: string;
120
+ /** New coverage amount in dollars. */
121
+ faceAmount: number;
122
+ /** New payment frequency. */
123
+ paymentFreq: PaymentFrequency;
124
+ }
125
+ export interface FinalExpenseAddress {
126
+ /** Street address. Avoid unsupported special characters. */
127
+ addressLine1: string;
128
+ /** City. Letters and spaces only. */
129
+ city: string;
130
+ /** 2-letter US state code. Must match the state used on the quote. */
131
+ state: string;
132
+ /**
133
+ * 5-digit US ZIP code.
134
+ *
135
+ * NOTE: lowercase `zipcode` is intentional — it mirrors the backend DTO
136
+ * (`Address.zipcode`). This differs from {@link FinalExpenseSecondaryAddressee}
137
+ * which uses `zipCode` (capital C) per its own DTO. Do NOT normalize the
138
+ * casing — the backend matches on the exact property name and would silently
139
+ * drop a renamed field.
140
+ */
141
+ zipcode: string;
142
+ }
143
+ export interface FinalExpenseBirthJurisdiction {
144
+ /** Two-letter country code. */
145
+ country: string;
146
+ /** 2-letter US state code; required when `country === "US"`. */
147
+ state?: string | null;
148
+ }
149
+ export interface FinalExpenseNicotineInfo {
150
+ /** `YYYY-MM` format only. Required when `flagTobaccoUse === true`. */
151
+ lastUseDate: string;
152
+ }
153
+ /** Beneficiary person — required when `beneficiaryType === 'Person'`. */
154
+ export interface FinalExpenseBeneficiaryPerson {
155
+ /** Alphabetic characters only. */
156
+ firstName: string;
157
+ /** Alphabetic characters only. */
158
+ lastName: string;
159
+ relationship: FinalExpenseRelationship;
160
+ }
161
+ /** Named entity — required when `beneficiaryType === 'Trust'`. */
162
+ export interface FinalExpenseNamedEntity {
163
+ /** Trust/entity name. */
164
+ name: string;
165
+ /** Optional tax ID. */
166
+ taxId?: string | null;
167
+ /** Optional; when provided, must be `YYYY-MM`. */
168
+ trustDate?: string | null;
169
+ }
170
+ /**
171
+ * Final Expense beneficiary details.
172
+ *
173
+ * `beneficiaryPerson` is required only when `beneficiaryType === 'Person'`;
174
+ * `namedEntity` is required only when `beneficiaryType === 'Trust'`. For the
175
+ * no-detail types (`Insured Estate`, `All Children Of The Insured Equally`,
176
+ * `All Children Of The Marriage Equally`) send `beneficiaryType` alone.
177
+ */
178
+ export interface FinalExpenseBeneficiaryDetails {
179
+ beneficiaryType: FinalExpenseBeneficiaryType;
180
+ /** Required when `beneficiaryType === 'Person'`. */
181
+ beneficiaryPerson?: FinalExpenseBeneficiaryPerson | null;
182
+ /** Required when `beneficiaryType === 'Trust'`. */
183
+ namedEntity?: FinalExpenseNamedEntity | null;
184
+ }
185
+ /**
186
+ * Current Care & Serious Conditions. All booleans are required; any `true`
187
+ * declines the application (`isDeclined: true`).
188
+ */
189
+ export interface CurrentCareConditions {
190
+ /** On oxygen for a medical condition, or confined to a nursing/assisted living facility? */
191
+ isOnOxygenOrConfinedToFacility: boolean;
192
+ /** Hospitalized 2+ times or advised to be admitted in the past 6 months? */
193
+ hasHospitalizationOrAdvisedAdmissionInPastSixMonths: boolean;
194
+ /** Diagnosed with a life expectancy of 24 months or less? */
195
+ hasLifeExpectancyTwentyFourMonthsOrLess: boolean;
196
+ /** Ever diagnosed with AIDS, ARC, or tested positive for HIV? */
197
+ hasAidsArcOrHiv: boolean;
198
+ }
199
+ /**
200
+ * Substance Use & Mental Health (last 2 years). All booleans required; any `true` declines.
201
+ */
202
+ export interface SubstanceUseAndMentalHealth {
203
+ /** Counseled/treated for illegal drugs, alcohol, or prescription drugs in the past 2 years? */
204
+ hasReceivedDrugAlcoholAdviceInPastTwoYears: boolean;
205
+ /** Hospitalized for a mental disorder in the past 2 years? */
206
+ hasMentalDisorderHospitalizationInPastTwoYears: boolean;
207
+ }
208
+ /**
209
+ * Tests, Appointments & Legal History. All booleans required; any `true` declines.
210
+ */
211
+ export interface TestsAppointmentsAndLegalHistory {
212
+ /** Advised of an incomplete medical appointment in the past 2 years? */
213
+ hasIncompleteMedicalAppointmentInPastTwoYears: boolean;
214
+ /** Advised of an incomplete medical test (non-HIV) in the past 2 years? */
215
+ hasIncompleteMedicalTestInPastTwoYears: boolean;
216
+ /** Convicted of a felony or DUI in the past 5 years? */
217
+ hasFelonyOrDuiInPastFiveYears: boolean;
218
+ }
219
+ /**
220
+ * Heart, Stroke, Organ Issues (last 2 years). All booleans required; any `true` declines.
221
+ */
222
+ export interface HeartStrokeOrganIssuesInPastTwoYears {
223
+ /** Heart attack, stroke, chest pain, TIA, myocarditis, or vascular disorder in past 2 years? */
224
+ hasHeartOrVascularConditionInPastTwoYears: boolean;
225
+ /** Kidney/liver disorder, organ transplant, or diabetic complications (amputation, coma, blindness) in past 2 years? */
226
+ hasKidneyLiverOrganOrDiabeticComplicationsInPastTwoYears: boolean;
227
+ /** Alzheimer's, dementia, cognitive impairment, or ALS in past 2 years? */
228
+ hasCognitiveOrNeurologicalConditionInPastTwoYears: boolean;
229
+ /** Cancer (other than basal cell skin cancer) in past 2 years? */
230
+ hasNonBasalCellCancerInPastTwoYears: boolean;
231
+ }
232
+ /**
233
+ * Respiratory prequalification.
234
+ *
235
+ * Decline rules (enforced server-side): any `conditions` value other than
236
+ * `'sleep apnea'` declines. When only `'sleep apnea'` is selected,
237
+ * `isCurrentlyTreatedForSleepApnea` must be `true` or the applicant is declined.
238
+ * `sleepApneaComorbidConditions` containing `'diabetes'` or
239
+ * `'heart attack/heart disease'` declines; `'hypertension'` alone does not.
240
+ */
241
+ export interface RespiratoryDetails {
242
+ /** Gate for the rest of the block. */
243
+ hasRespiratoryCondition: boolean;
244
+ /** Required (non-empty) when `hasRespiratoryCondition === true`; `null` when false. Values must be unique; `'none of the above'` cannot be combined. */
245
+ conditions?: RespiratoryCondition[] | null;
246
+ /** Required when `conditions` includes `'sleep apnea'`. */
247
+ isCurrentlyTreatedForSleepApnea?: boolean | null;
248
+ /** Required (non-empty) when `'sleep apnea'` is selected. Values must be unique; `'none of the above'` cannot be combined. */
249
+ sleepApneaComorbidConditions?: SleepApneaComorbidCondition[] | null;
250
+ }
251
+ /** Secondary addressee — required when `includeSecondaryAddressee === true`. */
252
+ export interface FinalExpenseSecondaryAddressee {
253
+ firstName: string;
254
+ lastName: string;
255
+ street: string;
256
+ city: string;
257
+ /** Valid 2-letter US state code. */
258
+ state: string;
259
+ /**
260
+ * 5-digit ZIP code.
261
+ *
262
+ * NOTE: `zipCode` (capital C) is intentional — it mirrors the backend DTO
263
+ * (`SecondaryAddressee.zipCode`). This differs from {@link FinalExpenseAddress}
264
+ * which uses lowercase `zipcode` per its own DTO. Do NOT normalize the casing
265
+ * — the backend matches on the exact property name and would silently drop a
266
+ * renamed field.
267
+ */
268
+ zipCode: string;
269
+ }
270
+ export interface FinalExpenseExistingCoverageInfo {
271
+ nameOfTheCompany: string;
272
+ insuranceAmount: string;
273
+ /** `YYYY-MM`. */
274
+ dateOfIssue: string;
275
+ toBeReplaced: boolean;
276
+ toBeFinanced: boolean;
277
+ /** Required when address.state === "MA". */
278
+ requestsYieldIndices?: boolean | null;
279
+ /** Required when address.state === "OK". */
280
+ notifyPresentInsurer?: boolean | null;
281
+ /** Required when address.state is "DE" or "GA". */
282
+ wantsPolicySummary?: boolean | null;
283
+ /** Required when address.state === "FL". */
284
+ wantsComparativeInformationForm?: boolean | null;
285
+ }
286
+ export interface FinalExpenseExistingCoverageData {
287
+ isExistingPolicyBeingTerminated: boolean;
288
+ existingCoverages: FinalExpenseExistingCoverageInfo[];
289
+ /** Required when address.state is "RI" or "WV". */
290
+ areExistingPoliciesIssuedByFidelity?: boolean | null;
291
+ }
292
+ /**
293
+ * Washington-only replacement disclosure block — all 7 booleans are server-required.
294
+ * Each `specify*` field is required when its paired boolean is `true`.
295
+ */
296
+ export interface FinalExpenseOtherInsuranceReplacementData {
297
+ mayReduceBenefitsIncreasePremiums: boolean;
298
+ /** Required when mayReduceBenefitsIncreasePremiums === true. */
299
+ specifyReduceBenefitsIncreasePremiums?: string | null;
300
+ hasNewPolicyCharges: boolean;
301
+ /** Required when hasNewPolicyCharges === true. */
302
+ specifyNewPolicyCharges?: string | null;
303
+ hasPriorPolicyCharges: boolean;
304
+ /** Required when hasPriorPolicyCharges === true. */
305
+ specifyPriorPolicyCharges?: string | null;
306
+ hasTaxConsequences: boolean;
307
+ /** Required when hasTaxConsequences === true. */
308
+ specifyTaxConsequences?: string | null;
309
+ hasInterestConsiderations: boolean;
310
+ /** Required when hasInterestConsiderations === true. */
311
+ specifyInterestConsiderations?: string | null;
312
+ hasMinRequirementsBeforeInterest: boolean;
313
+ /** Required when hasMinRequirementsBeforeInterest === true. */
314
+ specifyMinRequirementsBeforeInterest?: string | null;
315
+ hasOtherAdverseEffects: boolean;
316
+ /** Required when hasOtherAdverseEffects === true. */
317
+ specifyOtherAdverseEffects?: string | null;
318
+ }
319
+ /**
320
+ * Top-level wrapper for KS / WA replacement-or-financing disclosures.
321
+ * Required when address.state is "KS" or "WA" AND willOtherCoverageBeReplacedOrFinanced === true.
322
+ */
323
+ export interface FinalExpenseWillOtherCoverageBeReplacedOrFinancedData {
324
+ /** Required for KS when willOtherCoverageBeReplacedOrFinanced === true. */
325
+ areReplacedPoliciesIssuedByFidelity?: boolean | null;
326
+ /** Required for WA when willOtherCoverageBeReplacedOrFinanced === true. */
327
+ otherInsuranceReplacementData?: FinalExpenseOtherInsuranceReplacementData | null;
328
+ }
329
+ /**
330
+ * Request body for `POST /api/ThirdPartyFinalExpenseApplication/start-application`.
331
+ *
332
+ * This uses the **dedicated** Final Expense controller — NOT the generic
333
+ * `ThirdPartyStartApp` controller. Knockouts return HTTP 200 with
334
+ * `isDeclined: true` (a valid success response, not a 4xx error).
335
+ *
336
+ * Do NOT use GIGDB's `isSmoker` — Final Expense uses `flagTobaccoUse` +
337
+ * `nicotineInfo`.
338
+ *
339
+ * Eligible age range: 50–85 (from `dateOfBirth`). `address.state` must match
340
+ * the state used during `getQuote` (mismatch returns `StateMismatchIdentified`).
341
+ * `ApplicationLimitReached` (HTTP 400) is returned when the same SSN, email, or
342
+ * phone was used on a Final Expense policy within the last 30 days.
343
+ */
344
+ export interface ThirdPartyFinalExpenseStartApplicationReq {
345
+ /** Final Expense quote response ID. Must exist and belong to Final Expense. */
346
+ quoteResponseId: string;
347
+ /** Applicant first name. Alphabetic only. */
348
+ firstName: string;
349
+ /** Applicant last name. Alphabetic only. */
350
+ lastName: string;
351
+ /** Valid email address. */
352
+ email: string;
353
+ /** 10-digit US phone number or `+1XXXXXXXXXX`. */
354
+ phoneNumber: string;
355
+ /** US citizen. */
356
+ isUsCitizen: boolean;
357
+ /** Required when `isUsCitizen === false`. */
358
+ isLegalUsResident?: boolean | null;
359
+ /** Must be `true`; `false` immediately declines. */
360
+ isPayerAlsoOwnerAndInsured: boolean;
361
+ /** `address.state` must match the quote state. */
362
+ address: FinalExpenseAddress;
363
+ /** `YYYY-MM-DD`. Applicant age must be 50–85. */
364
+ dateOfBirth: string;
365
+ socialSecurityNumber: string;
366
+ /** Controls `existingCoverageData`. */
367
+ hasExistingCoverage: boolean;
368
+ /** Required when `hasExistingCoverage === true`; must be `null` or `false` when false. */
369
+ willOtherCoverageBeReplacedOrFinanced?: boolean | null;
370
+ /** Required for KS and WA replacement/financing flows. */
371
+ willOtherCoverageBeReplacedOrFinancedData?: FinalExpenseWillOtherCoverageBeReplacedOrFinancedData | null;
372
+ /** Required when `hasExistingCoverage === true`; must be `null` when false. */
373
+ existingCoverageData?: FinalExpenseExistingCoverageData | null;
374
+ beneficiaryDetails: FinalExpenseBeneficiaryDetails;
375
+ /** `feet` 1–8, `inches` 0–11. Used for prequalification and build-chart eligibility. */
376
+ height: ThirdPartyQuoteReqHeight;
377
+ /** Must be greater than 0. Used for prequalification and build-chart eligibility. */
378
+ weight: number;
379
+ /** Must be `true`; `false` immediately declines (driver license attestation). */
380
+ isHoldingValidDriverLicense: boolean;
381
+ birthJurisdiction: FinalExpenseBirthJurisdiction;
382
+ /** Required when `isHoldingValidDriverLicense === true`; must be `null` when false. */
383
+ driverLicenseState?: string | null;
384
+ /** Required when `isHoldingValidDriverLicense === true`; validated against the state's regex. Must be `null` when false. */
385
+ driverLicenseNumber?: string | null;
386
+ /** Final Expense tobacco flag. Do NOT use GIGDB `isSmoker`. */
387
+ flagTobaccoUse: boolean;
388
+ /** Required when `flagTobaccoUse === true`; must be `null` when false. */
389
+ nicotineInfo?: FinalExpenseNicotineInfo | null;
390
+ currentCareConditions: CurrentCareConditions;
391
+ substanceUseAndMentalHealth: SubstanceUseAndMentalHealth;
392
+ testsAppointmentsAndLegalHistory: TestsAppointmentsAndLegalHistory;
393
+ heartStrokeOrganIssuesInPastTwoYears: HeartStrokeOrganIssuesInPastTwoYears;
394
+ respiratoryDetails: RespiratoryDetails;
395
+ /** Controls `secondaryAddressee`. */
396
+ includeSecondaryAddressee: boolean;
397
+ /** Required when `includeSecondaryAddressee === true`; must be `null` when false. */
398
+ secondaryAddressee?: FinalExpenseSecondaryAddressee | null;
399
+ }
400
+ /**
401
+ * Response from `POST /api/ThirdPartyFinalExpenseApplication/start-application`.
402
+ *
403
+ * `isDeclined: true` is a valid success response (knockout / underwriting
404
+ * decline), not an error. `opportunityId` is the all-zero GUID
405
+ * (`00000000-0000-0000-0000-000000000000`) when declined before opportunity
406
+ * creation, and a real GUID when declined after.
407
+ */
408
+ export interface ThirdPartyFinalExpenseStartApplicationRes {
409
+ opportunityId: string;
410
+ /** `true` on any knockout or final underwriting decline. */
411
+ isDeclined: boolean;
412
+ /** `true` when the tobacco flag or DOB triggered a requote during processing. */
413
+ isQuoteChanged: boolean;
414
+ }
415
+ /**
416
+ * Response from `GET /api/ThirdPartyApplication/final-submit-status` (Final
417
+ * Expense only). `policyNumber` is populated only when
418
+ * `applicationStatus === 'Approved'`.
419
+ */
420
+ export interface ThirdPartyFinalExpensePingRes {
421
+ applicationStatus: FinalExpenseApplicationStatus;
422
+ /** Issued policy number — only present when `applicationStatus === 'Approved'`; `null` otherwise. */
423
+ policyNumber: string | null;
424
+ /**
425
+ * The authoritative stop signal — `true` while the underwriting decision is
426
+ * still pending, `false` once a terminal status is reached (stop polling).
427
+ * `pollUnderwritingStatus()` uses this when present and falls back to
428
+ * `applicationStatus === 'InProgress'` when it is absent (older backends that
429
+ * predate the field).
430
+ *
431
+ * Optional for backward compatibility: it is populated by the backend as of
432
+ * the async-underwriting rate-limit release; treat its absence as "keep
433
+ * polling while `applicationStatus` is `'InProgress'`".
434
+ */
435
+ shouldContinuePolling?: boolean;
436
+ }
437
+ /**
438
+ * Tuning options for {@link FinalExpenseService.pollUnderwritingStatus}.
439
+ * All durations are in milliseconds. Defaults implement the recommended
440
+ * two-phase strategy: poll every 10s for the first 7 minutes, then every
441
+ * 5 minutes up to 30 minutes total.
442
+ */
443
+ export interface PollUnderwritingStatusOptions {
444
+ /** Length of the fast-polling phase. Default `420_000` (7 min). */
445
+ fastPhaseDurationMs?: number;
446
+ /** Interval during the fast phase. Default `10_000` (10s). */
447
+ fastIntervalMs?: number;
448
+ /** Interval during the slow phase. Default `300_000` (5 min). */
449
+ slowIntervalMs?: number;
450
+ /** Total time budget before a timeout is surfaced. Default `1_800_000` (30 min). */
451
+ maxTotalDurationMs?: number;
452
+ /**
453
+ * Progress callback invoked after every poll (including the final terminal
454
+ * one). Useful for surfacing "still underwriting…" feedback during a long
455
+ * poll instead of awaiting silently. Receives the ping result, the 1-based
456
+ * attempt number, and milliseconds elapsed since polling began.
457
+ */
458
+ onPoll?: (result: ThirdPartyFinalExpensePingRes, attempt: number, elapsedMs: number) => void;
459
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -125,9 +125,41 @@ export interface ThirdPartyGigdbAppReq {
125
125
  /** Required for KS or WA when willOtherCoverageBeReplacedOrFinanced === true */
126
126
  willOtherCoverageBeReplacedOrFinancedData?: GigdbWillOtherCoverageBeReplacedOrFinancedData | null;
127
127
  }
128
+ /**
129
+ * Request body for `POST /api/ThirdPartyPayment/save-eft-payment`.
130
+ *
131
+ * Shared across all full-flow products (GIGDB, ADB, Final Expense). Call after
132
+ * Start Application and before Prepare Signing Docs. Once EFT is saved, quote
133
+ * updates for the same `opportunityId` are blocked.
134
+ *
135
+ * Every field is required server-side. Format failures return
136
+ * `InvalidRequestFormat` with the offending PascalCase key under `value.fields`.
137
+ */
128
138
  export interface ThirdPartyEftPaymentReq {
139
+ /**
140
+ * The `opportunityId` from the Start Application response.
141
+ *
142
+ * Unlike `getCcPaymentIframeUrl()`, this endpoint applies **no
143
+ * application-readiness gate** — it only checks that the opportunity exists
144
+ * and that payment has not already completed. Still call it after Start
145
+ * Application in the integration flow.
146
+ *
147
+ * Errors: `OpportunityId is required.` / `OpportunityId does not exist.`
148
+ * (`InvalidRequestFormat`), or `PaymentAlreadyMade` when a successful payment
149
+ * already exists.
150
+ */
129
151
  opportunityId: string;
152
+ /**
153
+ * Name on the bank account. **Max 100 characters**, and may contain only
154
+ * **letters, spaces, hyphens, and apostrophes**.
155
+ *
156
+ * Errors: `Account holder name is required.` /
157
+ * `Account holder name must be 100 characters or fewer.` /
158
+ * `Account holder name may only contain letters, spaces, hyphens, and apostrophes.`
159
+ */
130
160
  accountHolderName: string | null;
161
+ /** 9-digit US bank routing number. Error: `Routing number must be 9 digits.` */
131
162
  routingNumber: string | null;
163
+ /** Bank account number, 4–17 digits. Error: `Account number must be 4 to 17 digits.` */
132
164
  accountNumber: string | null;
133
165
  }
@@ -237,8 +237,11 @@ export interface IBTermChildRiderInfo {
237
237
  /**
238
238
  * Request body for `POST /api/ThirdPartyIBTermApplication/start-application`.
239
239
  *
240
- * Source of truth: `THIRD_PARTY_ERROR_CODES.md` (IB Term Start Application section,
241
- * 2026-05). IB Term has product-specific fields ADB and GIGDB do not — height,
240
+ * Source of truth: the IB Term Start Application API page. The single
241
+ * `THIRD_PARTY_ERROR_CODES.md` catalog it previously cited has been retired —
242
+ * validation and business errors are now documented per endpoint instead.
243
+ *
244
+ * IB Term has product-specific fields ADB and GIGDB do not — height,
242
245
  * weight, driver license, primary care physician, structured tobacco/nicotine
243
246
  * usage, and the Dependent Child Rider's nested child + child-existing-coverage
244
247
  * arrays.
@@ -10,6 +10,8 @@ export * from './gigdb.types';
10
10
  export * from './adb.types';
11
11
  export * from './ibterm.types';
12
12
  export * from './pureterm.types';
13
+ export * from './finalexpense.types';
14
+ export * from './payment.types';
13
15
  export * from './secure-sign.types';
14
16
  /**
15
17
  * Base configuration for the InstaBrain SDK
@@ -27,4 +27,6 @@ __exportStar(require("./gigdb.types"), exports);
27
27
  __exportStar(require("./adb.types"), exports);
28
28
  __exportStar(require("./ibterm.types"), exports);
29
29
  __exportStar(require("./pureterm.types"), exports);
30
+ __exportStar(require("./finalexpense.types"), exports);
31
+ __exportStar(require("./payment.types"), exports);
30
32
  __exportStar(require("./secure-sign.types"), exports);
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Card-capture status reported by
3
+ * `GET /api/ThirdPartyPayment/cc-payment-status`.
4
+ *
5
+ * `'pending'` is the only non-terminal value. Note that `'approved'` means the
6
+ * card **details were captured**, not that money moved:
7
+ * - **ADB / GIGDB** — the stored card is charged later, at `finalSubmit()`.
8
+ * - **Final Expense** — the carrier collects after underwriting; `finalSubmit()`
9
+ * never charges.
10
+ */
11
+ export type CcPaymentStatus = 'pending' | 'approved' | 'failed';
12
+ /**
13
+ * Response from `GET /api/ThirdPartyPayment/cc-payment-status`.
14
+ *
15
+ * Drive polling loops off {@link shouldContinuePolling} rather than comparing
16
+ * `status` — same convention as the Final Expense underwriting poller.
17
+ */
18
+ export interface ThirdPartyCcPaymentStatusRes {
19
+ status: CcPaymentStatus;
20
+ /** `true` only while `status` is `'pending'`; `false` for `'approved'` / `'failed'`. */
21
+ shouldContinuePolling: boolean;
22
+ }
23
+ /**
24
+ * Tuning options for {@link PaymentService.pollCcPaymentStatus}.
25
+ * All durations are in milliseconds.
26
+ *
27
+ * The status endpoint is rate-limited to **1 request per 10 seconds** per
28
+ * `opportunityId`, so `intervalMs` should never be set below `10_000`.
29
+ */
30
+ export interface PollCcPaymentStatusOptions {
31
+ /**
32
+ * Interval between polls. Default `10_000` (10s) — matches the documented
33
+ * rate limit. Do not go below `10_000` or the endpoint returns HTTP 429.
34
+ */
35
+ intervalMs?: number;
36
+ /**
37
+ * Client-side safety net. Default `1_800_000` (30 min) — the same budget as
38
+ * the Final Expense underwriting poller. Unlike that flow (which the backend
39
+ * terminates with `'TimedOut'` at 30 min), card capture has **no server-side
40
+ * timeout** — it simply stays `'pending'` until the applicant finishes the
41
+ * hosted form, so this budget is the only stop. On expiry the poll resolves
42
+ * with the last response rather than throwing.
43
+ */
44
+ maxTotalDurationMs?: number;
45
+ /**
46
+ * Progress callback invoked after every poll, including the terminal one.
47
+ * Useful for surfacing "waiting for card capture…" feedback instead of
48
+ * awaiting silently. Receives the result, the 1-based attempt number, and
49
+ * milliseconds elapsed since polling began.
50
+ */
51
+ onPoll?: (result: ThirdPartyCcPaymentStatusRes, attempt: number, elapsedMs: number) => void;
52
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // ── Credit Card Payment (shared — ADB / GIGDB / Final Expense) ───────────────
3
+ Object.defineProperty(exports, "__esModule", { value: true });