@instabrain-sdks/api-client 2.3.1 → 2.3.3
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/README.md +1952 -1749
- package/dist/client/instabrain-client.d.ts +18 -1
- package/dist/client/instabrain-client.js +20 -0
- package/dist/services/application.service.js +1 -1
- package/dist/services/ibterm.service.d.ts +1 -1
- package/dist/services/ibterm.service.js +1 -1
- package/dist/services/pureterm.service.d.ts +31 -0
- package/dist/services/pureterm.service.js +36 -0
- package/dist/types/application.types.d.ts +15 -0
- package/dist/types/application.types.js +1 -0
- package/dist/types/enums.d.ts +53 -41
- package/dist/types/enums.js +63 -44
- package/dist/types/errors.d.ts +4 -1
- package/dist/types/errors.js +19 -18
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/pureterm.types.d.ts +59 -0
- package/dist/types/pureterm.types.js +2 -0
- package/package.json +1 -1
|
@@ -5,8 +5,9 @@ import { ReportsService } from '../services/reports.service';
|
|
|
5
5
|
import { GigdbService } from '../services/gigdb.service';
|
|
6
6
|
import { AdbService } from '../services/adb.service';
|
|
7
7
|
import { IBTermService } from '../services/ibterm.service';
|
|
8
|
+
import { PureTermService } from '../services/pureterm.service';
|
|
8
9
|
import { SecureSignService } from '../services/secure-sign.service';
|
|
9
|
-
import { InstaBrainConfig, Environment, ThirdPartyQuoteReq, ThirdPartyQuoteResp, ThirdPartyStartApplicationReq, ThirdPartyStartAppResp, AgentPortalReq, ThirdPartyProspectsResp, ThirdPartySalesReportRes, ThirdPartyApplicationReportRes, ThirdPartyGigdbQuoteRequest, ThirdPartyGigdbUpdateQuoteReq, ThirdPartyGigdbAppReq, ThirdPartyEftPaymentReq, ThirdPartyAdbQuoteRequest, ThirdPartyAdbUpdateQuoteReq, ThirdPartyAdbAppReq, ThirdPartyAdbStartAppResp, AdbRiderDetailsResp, IBTermRiderDetailsResp, IBTermStartApplicationReq, ThirdPartySendPinReq, ThirdPartyResendPinReq, ThirdPartyVerifyPinReq, ThirdPartyPrepareDocsResp, ThirdPartySendPinResp, ThirdPartyResendPinResp, ThirdPartyVerifyPinResp, ThirdPartyFinalSubmitResp } from '../types';
|
|
10
|
+
import { InstaBrainConfig, Environment, ThirdPartyQuoteReq, ThirdPartyQuoteResp, ThirdPartyStartApplicationReq, ThirdPartyStartAppResp, AgentPortalReq, ThirdPartyProspectsResp, ThirdPartySalesReportRes, ThirdPartyApplicationReportRes, ThirdPartyGigdbQuoteRequest, ThirdPartyGigdbUpdateQuoteReq, ThirdPartyGigdbAppReq, ThirdPartyEftPaymentReq, ThirdPartyAdbQuoteRequest, ThirdPartyAdbUpdateQuoteReq, ThirdPartyAdbAppReq, ThirdPartyAdbStartAppResp, AdbRiderDetailsResp, IBTermRiderDetailsResp, IBTermStartApplicationReq, ThirdPartyPureTermQuoteReq, ThirdPartySendPinReq, ThirdPartyResendPinReq, ThirdPartyVerifyPinReq, ThirdPartyPrepareDocsResp, ThirdPartySendPinResp, ThirdPartyResendPinResp, ThirdPartyVerifyPinResp, ThirdPartyFinalSubmitResp } from '../types';
|
|
10
11
|
/**
|
|
11
12
|
* Main InstaBrain SDK client
|
|
12
13
|
*/
|
|
@@ -19,6 +20,7 @@ export declare class InstaBrainClient {
|
|
|
19
20
|
readonly gigdb: GigdbService;
|
|
20
21
|
readonly adb: AdbService;
|
|
21
22
|
readonly ibterm: IBTermService;
|
|
23
|
+
readonly pureTerm: PureTermService;
|
|
22
24
|
readonly secureSign: SecureSignService;
|
|
23
25
|
constructor(config?: InstaBrainConfig);
|
|
24
26
|
/**
|
|
@@ -180,6 +182,21 @@ export declare class InstaBrainClient {
|
|
|
180
182
|
* @returns Promise with the current quote response
|
|
181
183
|
*/
|
|
182
184
|
getExistingIBTermQuote(opportunityId: string): Promise<ThirdPartyQuoteResp>;
|
|
185
|
+
/**
|
|
186
|
+
* Get a Pure Term insurance quote.
|
|
187
|
+
*
|
|
188
|
+
* Provide exactly one rating group: `rateClass`, OR `healthClass`, OR
|
|
189
|
+
* both `height` and `weightInLbs`. `benefitPeriod` and `stateCode` are
|
|
190
|
+
* required. Supply `age` OR `dateOfBirth` (18–60).
|
|
191
|
+
*
|
|
192
|
+
* After the quote, call `startApplication()` with the returned
|
|
193
|
+
* `quoteResponseId` to receive the pre-fill links for the InstaBrain
|
|
194
|
+
* frontend.
|
|
195
|
+
*
|
|
196
|
+
* @param request - The Pure Term quote request parameters
|
|
197
|
+
* @returns Promise with the quote response containing quoteResponseId
|
|
198
|
+
*/
|
|
199
|
+
getPureTermQuote(request: ThirdPartyPureTermQuoteReq): Promise<ThirdPartyQuoteResp>;
|
|
183
200
|
/**
|
|
184
201
|
* Prepare the signing package and check available delivery channels
|
|
185
202
|
* Always call this first in the signing flow. If isSignCompleted is true, skip to finalSubmit().
|
|
@@ -9,6 +9,7 @@ const reports_service_1 = require("../services/reports.service");
|
|
|
9
9
|
const gigdb_service_1 = require("../services/gigdb.service");
|
|
10
10
|
const adb_service_1 = require("../services/adb.service");
|
|
11
11
|
const ibterm_service_1 = require("../services/ibterm.service");
|
|
12
|
+
const pureterm_service_1 = require("../services/pureterm.service");
|
|
12
13
|
const secure_sign_service_1 = require("../services/secure-sign.service");
|
|
13
14
|
/**
|
|
14
15
|
* Main InstaBrain SDK client
|
|
@@ -23,6 +24,7 @@ class InstaBrainClient {
|
|
|
23
24
|
this.gigdb = new gigdb_service_1.GigdbService(this.httpClient);
|
|
24
25
|
this.adb = new adb_service_1.AdbService(this.httpClient);
|
|
25
26
|
this.ibterm = new ibterm_service_1.IBTermService(this.httpClient);
|
|
27
|
+
this.pureTerm = new pureterm_service_1.PureTermService(this.httpClient);
|
|
26
28
|
this.secureSign = new secure_sign_service_1.SecureSignService(this.httpClient);
|
|
27
29
|
}
|
|
28
30
|
/**
|
|
@@ -233,6 +235,24 @@ class InstaBrainClient {
|
|
|
233
235
|
async getExistingIBTermQuote(opportunityId) {
|
|
234
236
|
return this.ibterm.getExistingQuote(opportunityId);
|
|
235
237
|
}
|
|
238
|
+
// ── Pure Term Methods ──────────────────────────────────────────────
|
|
239
|
+
/**
|
|
240
|
+
* Get a Pure Term insurance quote.
|
|
241
|
+
*
|
|
242
|
+
* Provide exactly one rating group: `rateClass`, OR `healthClass`, OR
|
|
243
|
+
* both `height` and `weightInLbs`. `benefitPeriod` and `stateCode` are
|
|
244
|
+
* required. Supply `age` OR `dateOfBirth` (18–60).
|
|
245
|
+
*
|
|
246
|
+
* After the quote, call `startApplication()` with the returned
|
|
247
|
+
* `quoteResponseId` to receive the pre-fill links for the InstaBrain
|
|
248
|
+
* frontend.
|
|
249
|
+
*
|
|
250
|
+
* @param request - The Pure Term quote request parameters
|
|
251
|
+
* @returns Promise with the quote response containing quoteResponseId
|
|
252
|
+
*/
|
|
253
|
+
async getPureTermQuote(request) {
|
|
254
|
+
return this.pureTerm.getQuote(request);
|
|
255
|
+
}
|
|
236
256
|
// ── Secure Sign Methods ─────────────────────────────────────────────
|
|
237
257
|
/**
|
|
238
258
|
* Prepare the signing package and check available delivery channels
|
|
@@ -15,7 +15,7 @@ class ApplicationService extends base_service_1.BaseService {
|
|
|
15
15
|
* @returns Promise with the application response containing links
|
|
16
16
|
*/
|
|
17
17
|
async startApplication(applicationRequest) {
|
|
18
|
-
return this.post('start application', '/api/
|
|
18
|
+
return this.post('start application', '/api/ThirdPartyStartApp/start-application', applicationRequest);
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* Submit the application to the carrier for a final underwriting decision
|
|
@@ -57,7 +57,7 @@ export declare class IBTermService extends BaseService {
|
|
|
57
57
|
* - missing / empty / non-GUID `opportunityId` → `InvalidRequestFormat`
|
|
58
58
|
* - opportunity belongs to a different product → `OpportunityIdDoesNotMatchProduct`
|
|
59
59
|
* (field-level message under `InvalidRequestFormat`)
|
|
60
|
-
* - opportunity exists but has no stored quote → `QuoteNotFound`
|
|
60
|
+
* - opportunity exists but has no stored quote → `QuoteNotFound` (top-level, `value: null`)
|
|
61
61
|
*
|
|
62
62
|
* @param opportunityId - UUID from a prior IB Term application/quote flow.
|
|
63
63
|
* @returns Promise with the current quote response.
|
|
@@ -63,7 +63,7 @@ class IBTermService extends base_service_1.BaseService {
|
|
|
63
63
|
* - missing / empty / non-GUID `opportunityId` → `InvalidRequestFormat`
|
|
64
64
|
* - opportunity belongs to a different product → `OpportunityIdDoesNotMatchProduct`
|
|
65
65
|
* (field-level message under `InvalidRequestFormat`)
|
|
66
|
-
* - opportunity exists but has no stored quote → `QuoteNotFound`
|
|
66
|
+
* - opportunity exists but has no stored quote → `QuoteNotFound` (top-level, `value: null`)
|
|
67
67
|
*
|
|
68
68
|
* @param opportunityId - UUID from a prior IB Term application/quote flow.
|
|
69
69
|
* @returns Promise with the current quote response.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { HttpClient } from '../utils/http-client';
|
|
2
|
+
import { BaseService } from './base.service';
|
|
3
|
+
import { ThirdPartyPureTermQuoteReq } from '../types/pureterm.types';
|
|
4
|
+
import { ThirdPartyQuoteResp } from '../types';
|
|
5
|
+
/**
|
|
6
|
+
* Pure Term (InstaBrain Pure Term) service
|
|
7
|
+
* Handles quoting for the Pure Term product.
|
|
8
|
+
*
|
|
9
|
+
* Flow:
|
|
10
|
+
* 1. getQuote() → quoteResponseId
|
|
11
|
+
* 2. InstaBrainClient.startApplication() → agentLink / applicantLink / eAppAgentLink
|
|
12
|
+
*
|
|
13
|
+
* After startApplication(), direct the agent or applicant to the returned link.
|
|
14
|
+
* All remaining steps (underwriting, payment, signing) complete inside the
|
|
15
|
+
* InstaBrain frontend. Do NOT call saveEftPayment(), SecureSign methods, or
|
|
16
|
+
* finalSubmit() for Pure Term.
|
|
17
|
+
*/
|
|
18
|
+
export declare class PureTermService extends BaseService {
|
|
19
|
+
constructor(httpClient: HttpClient);
|
|
20
|
+
/**
|
|
21
|
+
* Get a Pure Term insurance quote.
|
|
22
|
+
*
|
|
23
|
+
* Provide exactly one rating group: `rateClass`, OR `healthClass`, OR
|
|
24
|
+
* both `height` and `weightInLbs`. `benefitPeriod` and `stateCode` are
|
|
25
|
+
* required. Supply `age` OR `dateOfBirth` (18–60).
|
|
26
|
+
*
|
|
27
|
+
* @param request - The Pure Term quote request payload.
|
|
28
|
+
* @returns Promise with the quote response including `quoteResponseId`.
|
|
29
|
+
*/
|
|
30
|
+
getQuote(request: ThirdPartyPureTermQuoteReq): Promise<ThirdPartyQuoteResp>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PureTermService = void 0;
|
|
4
|
+
const base_service_1 = require("./base.service");
|
|
5
|
+
/**
|
|
6
|
+
* Pure Term (InstaBrain Pure Term) service
|
|
7
|
+
* Handles quoting for the Pure Term product.
|
|
8
|
+
*
|
|
9
|
+
* Flow:
|
|
10
|
+
* 1. getQuote() → quoteResponseId
|
|
11
|
+
* 2. InstaBrainClient.startApplication() → agentLink / applicantLink / eAppAgentLink
|
|
12
|
+
*
|
|
13
|
+
* After startApplication(), direct the agent or applicant to the returned link.
|
|
14
|
+
* All remaining steps (underwriting, payment, signing) complete inside the
|
|
15
|
+
* InstaBrain frontend. Do NOT call saveEftPayment(), SecureSign methods, or
|
|
16
|
+
* finalSubmit() for Pure Term.
|
|
17
|
+
*/
|
|
18
|
+
class PureTermService extends base_service_1.BaseService {
|
|
19
|
+
constructor(httpClient) {
|
|
20
|
+
super(httpClient);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Get a Pure Term insurance quote.
|
|
24
|
+
*
|
|
25
|
+
* Provide exactly one rating group: `rateClass`, OR `healthClass`, OR
|
|
26
|
+
* both `height` and `weightInLbs`. `benefitPeriod` and `stateCode` are
|
|
27
|
+
* required. Supply `age` OR `dateOfBirth` (18–60).
|
|
28
|
+
*
|
|
29
|
+
* @param request - The Pure Term quote request payload.
|
|
30
|
+
* @returns Promise with the quote response including `quoteResponseId`.
|
|
31
|
+
*/
|
|
32
|
+
async getQuote(request) {
|
|
33
|
+
return this.post('get Pure Term quote', '/api/ThirdPartyIbPureTermQuote/get', request);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.PureTermService = PureTermService;
|
|
@@ -1,9 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request body for `POST /api/ThirdPartyStartApp/start-application`.
|
|
3
|
+
*
|
|
4
|
+
* Generic start-application endpoint used across products that follow the
|
|
5
|
+
* pre-fill link hand-off flow (e.g. Pure Term). Returns `agentLink`,
|
|
6
|
+
* `applicantLink`, and `eAppAgentLink` for the InstaBrain frontend.
|
|
7
|
+
*
|
|
8
|
+
* Source of truth: ThirdPartyStartApplicationReq.cs
|
|
9
|
+
*/
|
|
1
10
|
export interface ThirdPartyStartApplicationReq {
|
|
11
|
+
/** UUID from the product quote response. */
|
|
2
12
|
quoteResponseId: string;
|
|
3
13
|
firstName: string | null;
|
|
4
14
|
lastName: string | null;
|
|
5
15
|
email: string | null;
|
|
6
16
|
phoneNumber: string | null;
|
|
17
|
+
/**
|
|
18
|
+
* Product variant code. When omitted the base product is started.
|
|
19
|
+
* Contact InstaBrain support to obtain the correct code for a specific variant.
|
|
20
|
+
*/
|
|
21
|
+
proCode?: string | null;
|
|
7
22
|
}
|
|
8
23
|
export interface ThirdPartyStartAppResp {
|
|
9
24
|
opportunityId: string;
|
package/dist/types/enums.d.ts
CHANGED
|
@@ -385,6 +385,14 @@ export declare enum RateClass {
|
|
|
385
385
|
Standard = "Standard",
|
|
386
386
|
StandardExtra = "Standard Extra"
|
|
387
387
|
}
|
|
388
|
+
export declare enum PureTermRateClass {
|
|
389
|
+
PreferredPlus = "Preferred Plus",
|
|
390
|
+
Preferred = "Preferred",
|
|
391
|
+
Standard = "Standard",
|
|
392
|
+
StandardExtra = "Standard Extra",
|
|
393
|
+
RatedC = "Rated C",
|
|
394
|
+
RatedD = "Rated D"
|
|
395
|
+
}
|
|
388
396
|
export declare enum HealthClass {
|
|
389
397
|
Excellent = "Excellent",
|
|
390
398
|
Great = "Great",
|
|
@@ -434,18 +442,14 @@ export declare enum AdbRiderType {
|
|
|
434
442
|
InflationBenefit = "InflationBenefit"
|
|
435
443
|
}
|
|
436
444
|
/**
|
|
437
|
-
* API Error codes returned in the top-level `error` field
|
|
445
|
+
* API Error codes returned in the top-level `error` / `errorCode` field when `flagStatus` is false.
|
|
438
446
|
*
|
|
439
|
-
*
|
|
440
|
-
*
|
|
441
|
-
*
|
|
447
|
+
* Many validation failures use `InvalidRequestFormat` with per-field details in `value.fields`.
|
|
448
|
+
* Quote business rules, Start Application limits, Secure Sign, and Final Submit also use
|
|
449
|
+
* dedicated top-level codes listed below.
|
|
442
450
|
*
|
|
443
|
-
*
|
|
444
|
-
*
|
|
445
|
-
* for backward-compatibility with existing integrations and will be removed in a
|
|
446
|
-
* future major version. Detect the equivalent failures via field-level messages
|
|
447
|
-
* under `InvalidRequestFormat` — see the README "Field-Level Error Messages"
|
|
448
|
-
* section.
|
|
451
|
+
* Members marked `@deprecated` remain for backward compatibility but are not documented as
|
|
452
|
+
* active in the README; prefer `InvalidRequestFormat` field messages where applicable.
|
|
449
453
|
*/
|
|
450
454
|
export declare enum APIErrorCode {
|
|
451
455
|
/** Top-level code for every FluentValidation failure across all products. Inspect `value.fields` for field-level details. */
|
|
@@ -468,10 +472,6 @@ export declare enum APIErrorCode {
|
|
|
468
472
|
BenefitPeriodNotAvailable = "BenefitPeriodNotAvailable",
|
|
469
473
|
/** IB Term Quote only — height + weight fall outside the carrier's acceptable build chart. */
|
|
470
474
|
OutsideBuildChart = "outsideBuildChart",
|
|
471
|
-
/** IB Term Quote only — `Height` / `WeightInLbs` value or combination is invalid. */
|
|
472
|
-
HeightNotValid = "HeightNotValid",
|
|
473
|
-
/** Returned by ADB / GIGDB / IB Term `get-existing-quote` when no saved quote exists for the opportunity. */
|
|
474
|
-
QuoteNotFound = "QuoteNotFound",
|
|
475
475
|
/** ADB / GIGDB Start Application only — same SSN, email, or phone already has a policy generated within the last 30 days. IB Term does NOT use this code. */
|
|
476
476
|
ApplicationLimitReached = "ApplicationLimitReached",
|
|
477
477
|
/** Quote state and `Address.State` on Start Application refer to different US states (case-insensitive compare). Returned only after request validation passes. */
|
|
@@ -480,41 +480,53 @@ export declare enum APIErrorCode {
|
|
|
480
480
|
AgentNotFound = "agentNotFound",
|
|
481
481
|
/** Unexpected backend failure while processing a Start Application request. */
|
|
482
482
|
InternalServerError = "internalServerError",
|
|
483
|
+
/** Update quote or save EFT when payment is already recorded for the opportunity. */
|
|
484
|
+
PaymentAlreadyMade = "PaymentAlreadyMade",
|
|
485
|
+
/** Generic Secure Sign failure. */
|
|
486
|
+
SecureSignRelatedError = "SecureSignRelatedError",
|
|
487
|
+
/** Signing package missing — call `prepareDocsAndGetDeliveryChannels()` first. */
|
|
488
|
+
SigningPackageNotCreated = "SigningPackageNotCreated",
|
|
489
|
+
/** Wrong PIN on `verifyPin()` (also returns `isVerified: false` without throwing). */
|
|
490
|
+
SecureSignPinMismatch = "SecureSignPinMismatch",
|
|
491
|
+
/** PIN expired — call `resendPin()`. */
|
|
492
|
+
PinExpired = "PinExpired",
|
|
493
|
+
/** Documents already signed for this opportunity. */
|
|
494
|
+
DocumentsAlreadySigned = "DocumentsAlreadySigned",
|
|
495
|
+
/** Phone number invalid for SMS on Send PIN / Resend PIN. */
|
|
496
|
+
InvalidPhoneNumber = "InvalidPhoneNumber",
|
|
497
|
+
/** Email delivery failed on Send PIN / Resend PIN. */
|
|
498
|
+
EmailDeliveryFailed = "EmailDeliveryFailed",
|
|
499
|
+
/** SMS delivery failed on Send PIN / Resend PIN. */
|
|
500
|
+
MessageNotDelivered = "MessageNotDelivered",
|
|
501
|
+
/** EFT payment not saved — call `saveEftPayment()` before `finalSubmit()`. */
|
|
502
|
+
PaymentNotMade = "paymentNotMade",
|
|
503
|
+
/** Fidelity carrier rejected or failed to process final submit. */
|
|
504
|
+
FidelityFinalSubmitError = "FidelityFinalSubmitError",
|
|
483
505
|
AgentLogout = "AgentLogout",
|
|
484
|
-
/**
|
|
506
|
+
/** Top-level code returned by `getExistingIBTermQuote()` / `getExistingGigdbQuote()` / `getExistingAdbQuote()` when no quote is on file for the opportunityId. HTTP 400, `value: null`. */
|
|
507
|
+
QuoteNotFound = "QuoteNotFound",
|
|
508
|
+
/** Returned by IB Term Quote when `height.feet` or `height.inches` values are out-of-range (feet 1–8, inches 0–11). Distinct from `OutsideBuildChart` which fires when height+weight fail the carrier build chart lookup. */
|
|
509
|
+
HeightNotValid = "HeightNotValid",
|
|
510
|
+
/** Applicant has not viewed all documents before attempting PIN verification. Returned by `verifyPin()`. */
|
|
511
|
+
DocumentsNotViewed = "DocumentsNotViewed",
|
|
512
|
+
/** @deprecated Prefer `InvalidRequestFormat` on `BirthJurisdiction.Country`. */
|
|
485
513
|
InvalidBirthCountry = "InvalidBirthCountry",
|
|
486
|
-
/** @deprecated
|
|
514
|
+
/** @deprecated Prefer `InvalidRequestFormat` on `BirthJurisdiction.State`. */
|
|
487
515
|
InvalidBirthState = "InvalidBirthState",
|
|
488
|
-
/** @deprecated
|
|
516
|
+
/** @deprecated Prefer `InvalidRequestFormat` on `Address.State`. */
|
|
489
517
|
InvalidResidenceState = "InvalidResidenceState",
|
|
490
|
-
/** @deprecated No longer returned
|
|
518
|
+
/** @deprecated No longer returned as a top-level code. */
|
|
491
519
|
OneOfTheExistingCoveragesQuestionsNotFound = "OneOfTheExistingCoveragesQuestionsNotFound",
|
|
492
|
-
/** @deprecated
|
|
493
|
-
PaymentAlreadyMade = "PaymentAlreadyMade",
|
|
494
|
-
/** @deprecated Returned as a field-level message under `InvalidRequestFormat`. */
|
|
520
|
+
/** @deprecated Prefer `InvalidRequestFormat` on EFT fields. */
|
|
495
521
|
ErrorInSaveEftPaymentDetails = "ErrorInSaveEftPaymentDetails",
|
|
496
|
-
/** @deprecated
|
|
522
|
+
/** @deprecated Prefer `InvalidRequestFormat` on EFT fields. */
|
|
497
523
|
InvalidPaymentScheduledDate = "InvalidPaymentScheduledDate",
|
|
498
|
-
/** @deprecated
|
|
524
|
+
/** @deprecated Legacy get-existing-quote code; prefer `InvalidRequestFormat`. */
|
|
499
525
|
ThirdPartyQuoteError = "ThirdPartyQuoteError",
|
|
500
|
-
/** @deprecated
|
|
526
|
+
/** @deprecated No longer returned as a top-level code. */
|
|
501
527
|
InvalidQuoteParameters = "InvalidQuoteParameters",
|
|
502
|
-
/** @deprecated
|
|
528
|
+
/** @deprecated Prefer `InvalidRequestFormat` on `Address.State` (ADB). */
|
|
503
529
|
InvalidStateCode = "InvalidStateCode",
|
|
504
|
-
/** @deprecated
|
|
505
|
-
InvalidAdbAgeRange = "InvalidAdbAgeRange"
|
|
506
|
-
/** @deprecated Final Submit now returns "Application has already been final submitted." on `opportunityId` under `InvalidRequestFormat`. */
|
|
507
|
-
PaymentNotMade = "paymentNotMade",
|
|
508
|
-
/** @deprecated Secure Sign endpoints now return field-level messages under `InvalidRequestFormat`. */
|
|
509
|
-
SecureSignRelatedError = "SecureSignRelatedError",
|
|
510
|
-
/** @deprecated Secure Sign endpoints now return field-level messages under `InvalidRequestFormat`. */
|
|
511
|
-
SigningPackageNotCreated = "SigningPackageNotCreated",
|
|
512
|
-
/** @deprecated Secure Sign endpoints now return field-level messages under `InvalidRequestFormat`. */
|
|
513
|
-
SecureSignPinMismatch = "SecureSignPinMismatch",
|
|
514
|
-
/** @deprecated Secure Sign endpoints now return field-level messages under `InvalidRequestFormat`. */
|
|
515
|
-
PinExpired = "PinExpired",
|
|
516
|
-
/** @deprecated Secure Sign endpoints now return field-level messages under `InvalidRequestFormat`. */
|
|
517
|
-
DocumentsNotViewed = "DocumentsNotViewed",
|
|
518
|
-
/** @deprecated Secure Sign endpoints now return "Documents are already signed." on `OpportunityId` under `InvalidRequestFormat`. */
|
|
519
|
-
DocumentsAlreadySigned = "DocumentsAlreadySigned"
|
|
530
|
+
/** @deprecated Prefer `InvalidRequestFormat` on `DateOfBirth` (ADB age 20–59). */
|
|
531
|
+
InvalidAdbAgeRange = "InvalidAdbAgeRange"
|
|
520
532
|
}
|
package/dist/types/enums.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.APIErrorCode = exports.AdbRiderType = exports.TobaccoNicotineProductType = exports.TobaccoNicotineLastUsedPeriod = exports.RiderType = exports.HealthClass = exports.RateClass = exports.Country = exports.BeneficiaryRelationship = exports.BeneficiaryType = exports.State = exports.PaymentFrequency = exports.Gender = void 0;
|
|
3
|
+
exports.APIErrorCode = exports.AdbRiderType = exports.TobaccoNicotineProductType = exports.TobaccoNicotineLastUsedPeriod = exports.RiderType = exports.HealthClass = exports.PureTermRateClass = exports.RateClass = exports.Country = exports.BeneficiaryRelationship = exports.BeneficiaryType = exports.State = exports.PaymentFrequency = exports.Gender = void 0;
|
|
4
4
|
// Gender enum (string-based — used by GIGDB and other string-API products)
|
|
5
5
|
var Gender;
|
|
6
6
|
(function (Gender) {
|
|
@@ -395,7 +395,7 @@ var Country;
|
|
|
395
395
|
Country["Wales"] = "GB-WLS";
|
|
396
396
|
Country["Tibet"] = "TI";
|
|
397
397
|
})(Country || (exports.Country = Country = {}));
|
|
398
|
-
// Rate class enum
|
|
398
|
+
// Rate class enum for IB Term — matches API values exactly
|
|
399
399
|
var RateClass;
|
|
400
400
|
(function (RateClass) {
|
|
401
401
|
RateClass["PreferredPlus"] = "Preferred Plus";
|
|
@@ -403,6 +403,16 @@ var RateClass;
|
|
|
403
403
|
RateClass["Standard"] = "Standard";
|
|
404
404
|
RateClass["StandardExtra"] = "Standard Extra";
|
|
405
405
|
})(RateClass || (exports.RateClass = RateClass = {}));
|
|
406
|
+
// Rate class enum for Pure Term — extends IB Term classes with rated variants
|
|
407
|
+
var PureTermRateClass;
|
|
408
|
+
(function (PureTermRateClass) {
|
|
409
|
+
PureTermRateClass["PreferredPlus"] = "Preferred Plus";
|
|
410
|
+
PureTermRateClass["Preferred"] = "Preferred";
|
|
411
|
+
PureTermRateClass["Standard"] = "Standard";
|
|
412
|
+
PureTermRateClass["StandardExtra"] = "Standard Extra";
|
|
413
|
+
PureTermRateClass["RatedC"] = "Rated C";
|
|
414
|
+
PureTermRateClass["RatedD"] = "Rated D";
|
|
415
|
+
})(PureTermRateClass || (exports.PureTermRateClass = PureTermRateClass = {}));
|
|
406
416
|
// Health class enum - matches API values exactly
|
|
407
417
|
var HealthClass;
|
|
408
418
|
(function (HealthClass) {
|
|
@@ -463,18 +473,14 @@ var AdbRiderType;
|
|
|
463
473
|
AdbRiderType["InflationBenefit"] = "InflationBenefit";
|
|
464
474
|
})(AdbRiderType || (exports.AdbRiderType = AdbRiderType = {}));
|
|
465
475
|
/**
|
|
466
|
-
* API Error codes returned in the top-level `error` field
|
|
476
|
+
* API Error codes returned in the top-level `error` / `errorCode` field when `flagStatus` is false.
|
|
467
477
|
*
|
|
468
|
-
*
|
|
469
|
-
*
|
|
470
|
-
*
|
|
478
|
+
* Many validation failures use `InvalidRequestFormat` with per-field details in `value.fields`.
|
|
479
|
+
* Quote business rules, Start Application limits, Secure Sign, and Final Submit also use
|
|
480
|
+
* dedicated top-level codes listed below.
|
|
471
481
|
*
|
|
472
|
-
*
|
|
473
|
-
*
|
|
474
|
-
* for backward-compatibility with existing integrations and will be removed in a
|
|
475
|
-
* future major version. Detect the equivalent failures via field-level messages
|
|
476
|
-
* under `InvalidRequestFormat` — see the README "Field-Level Error Messages"
|
|
477
|
-
* section.
|
|
482
|
+
* Members marked `@deprecated` remain for backward compatibility but are not documented as
|
|
483
|
+
* active in the README; prefer `InvalidRequestFormat` field messages where applicable.
|
|
478
484
|
*/
|
|
479
485
|
var APIErrorCode;
|
|
480
486
|
(function (APIErrorCode) {
|
|
@@ -501,11 +507,6 @@ var APIErrorCode;
|
|
|
501
507
|
APIErrorCode["BenefitPeriodNotAvailable"] = "BenefitPeriodNotAvailable";
|
|
502
508
|
/** IB Term Quote only — height + weight fall outside the carrier's acceptable build chart. */
|
|
503
509
|
APIErrorCode["OutsideBuildChart"] = "outsideBuildChart";
|
|
504
|
-
/** IB Term Quote only — `Height` / `WeightInLbs` value or combination is invalid. */
|
|
505
|
-
APIErrorCode["HeightNotValid"] = "HeightNotValid";
|
|
506
|
-
// ─── Get-Existing-Quote business error ────────────────────────────────────
|
|
507
|
-
/** Returned by ADB / GIGDB / IB Term `get-existing-quote` when no saved quote exists for the opportunity. */
|
|
508
|
-
APIErrorCode["QuoteNotFound"] = "QuoteNotFound";
|
|
509
510
|
// ─── Start Application — duplicate-detection limit ───────────────────────
|
|
510
511
|
/** ADB / GIGDB Start Application only — same SSN, email, or phone already has a policy generated within the last 30 days. IB Term does NOT use this code. */
|
|
511
512
|
APIErrorCode["ApplicationLimitReached"] = "ApplicationLimitReached";
|
|
@@ -516,43 +517,61 @@ var APIErrorCode;
|
|
|
516
517
|
APIErrorCode["AgentNotFound"] = "agentNotFound";
|
|
517
518
|
/** Unexpected backend failure while processing a Start Application request. */
|
|
518
519
|
APIErrorCode["InternalServerError"] = "internalServerError";
|
|
520
|
+
// ─── Payment & quote update (after Start Application) ─────────────────────
|
|
521
|
+
/** Update quote or save EFT when payment is already recorded for the opportunity. */
|
|
522
|
+
APIErrorCode["PaymentAlreadyMade"] = "PaymentAlreadyMade";
|
|
523
|
+
// ─── Secure Sign ───────────────────────────────────────────────────────────
|
|
524
|
+
/** Generic Secure Sign failure. */
|
|
525
|
+
APIErrorCode["SecureSignRelatedError"] = "SecureSignRelatedError";
|
|
526
|
+
/** Signing package missing — call `prepareDocsAndGetDeliveryChannels()` first. */
|
|
527
|
+
APIErrorCode["SigningPackageNotCreated"] = "SigningPackageNotCreated";
|
|
528
|
+
/** Wrong PIN on `verifyPin()` (also returns `isVerified: false` without throwing). */
|
|
529
|
+
APIErrorCode["SecureSignPinMismatch"] = "SecureSignPinMismatch";
|
|
530
|
+
/** PIN expired — call `resendPin()`. */
|
|
531
|
+
APIErrorCode["PinExpired"] = "PinExpired";
|
|
532
|
+
/** Documents already signed for this opportunity. */
|
|
533
|
+
APIErrorCode["DocumentsAlreadySigned"] = "DocumentsAlreadySigned";
|
|
534
|
+
/** Phone number invalid for SMS on Send PIN / Resend PIN. */
|
|
535
|
+
APIErrorCode["InvalidPhoneNumber"] = "InvalidPhoneNumber";
|
|
536
|
+
/** Email delivery failed on Send PIN / Resend PIN. */
|
|
537
|
+
APIErrorCode["EmailDeliveryFailed"] = "EmailDeliveryFailed";
|
|
538
|
+
/** SMS delivery failed on Send PIN / Resend PIN. */
|
|
539
|
+
APIErrorCode["MessageNotDelivered"] = "MessageNotDelivered";
|
|
540
|
+
// ─── Final Submit ──────────────────────────────────────────────────────────
|
|
541
|
+
/** EFT payment not saved — call `saveEftPayment()` before `finalSubmit()`. */
|
|
542
|
+
APIErrorCode["PaymentNotMade"] = "paymentNotMade";
|
|
543
|
+
/** Fidelity carrier rejected or failed to process final submit. */
|
|
544
|
+
APIErrorCode["FidelityFinalSubmitError"] = "FidelityFinalSubmitError";
|
|
519
545
|
// ─── Session ─────────────────────────────────────────────────────────────
|
|
520
546
|
APIErrorCode["AgentLogout"] = "AgentLogout";
|
|
521
|
-
// ───
|
|
522
|
-
/**
|
|
547
|
+
// ─── Get Existing Quote ──────────────────────────────────────────────────
|
|
548
|
+
/** Top-level code returned by `getExistingIBTermQuote()` / `getExistingGigdbQuote()` / `getExistingAdbQuote()` when no quote is on file for the opportunityId. HTTP 400, `value: null`. */
|
|
549
|
+
APIErrorCode["QuoteNotFound"] = "QuoteNotFound";
|
|
550
|
+
// ─── IB Term Quote — height validation ───────────────────────────────────
|
|
551
|
+
/** Returned by IB Term Quote when `height.feet` or `height.inches` values are out-of-range (feet 1–8, inches 0–11). Distinct from `OutsideBuildChart` which fires when height+weight fail the carrier build chart lookup. */
|
|
552
|
+
APIErrorCode["HeightNotValid"] = "HeightNotValid";
|
|
553
|
+
// ─── Secure Sign (continued) ─────────────────────────────────────────────
|
|
554
|
+
/** Applicant has not viewed all documents before attempting PIN verification. Returned by `verifyPin()`. */
|
|
555
|
+
APIErrorCode["DocumentsNotViewed"] = "DocumentsNotViewed";
|
|
556
|
+
// ─── Deprecated — not in active README; kept for backward compatibility ───
|
|
557
|
+
/** @deprecated Prefer `InvalidRequestFormat` on `BirthJurisdiction.Country`. */
|
|
523
558
|
APIErrorCode["InvalidBirthCountry"] = "InvalidBirthCountry";
|
|
524
|
-
/** @deprecated
|
|
559
|
+
/** @deprecated Prefer `InvalidRequestFormat` on `BirthJurisdiction.State`. */
|
|
525
560
|
APIErrorCode["InvalidBirthState"] = "InvalidBirthState";
|
|
526
|
-
/** @deprecated
|
|
561
|
+
/** @deprecated Prefer `InvalidRequestFormat` on `Address.State`. */
|
|
527
562
|
APIErrorCode["InvalidResidenceState"] = "InvalidResidenceState";
|
|
528
|
-
/** @deprecated No longer returned
|
|
563
|
+
/** @deprecated No longer returned as a top-level code. */
|
|
529
564
|
APIErrorCode["OneOfTheExistingCoveragesQuestionsNotFound"] = "OneOfTheExistingCoveragesQuestionsNotFound";
|
|
530
|
-
/** @deprecated
|
|
531
|
-
APIErrorCode["PaymentAlreadyMade"] = "PaymentAlreadyMade";
|
|
532
|
-
/** @deprecated Returned as a field-level message under `InvalidRequestFormat`. */
|
|
565
|
+
/** @deprecated Prefer `InvalidRequestFormat` on EFT fields. */
|
|
533
566
|
APIErrorCode["ErrorInSaveEftPaymentDetails"] = "ErrorInSaveEftPaymentDetails";
|
|
534
|
-
/** @deprecated
|
|
567
|
+
/** @deprecated Prefer `InvalidRequestFormat` on EFT fields. */
|
|
535
568
|
APIErrorCode["InvalidPaymentScheduledDate"] = "InvalidPaymentScheduledDate";
|
|
536
|
-
/** @deprecated
|
|
569
|
+
/** @deprecated Legacy get-existing-quote code; prefer `InvalidRequestFormat`. */
|
|
537
570
|
APIErrorCode["ThirdPartyQuoteError"] = "ThirdPartyQuoteError";
|
|
538
|
-
/** @deprecated
|
|
571
|
+
/** @deprecated No longer returned as a top-level code. */
|
|
539
572
|
APIErrorCode["InvalidQuoteParameters"] = "InvalidQuoteParameters";
|
|
540
|
-
/** @deprecated
|
|
573
|
+
/** @deprecated Prefer `InvalidRequestFormat` on `Address.State` (ADB). */
|
|
541
574
|
APIErrorCode["InvalidStateCode"] = "InvalidStateCode";
|
|
542
|
-
/** @deprecated
|
|
575
|
+
/** @deprecated Prefer `InvalidRequestFormat` on `DateOfBirth` (ADB age 20–59). */
|
|
543
576
|
APIErrorCode["InvalidAdbAgeRange"] = "InvalidAdbAgeRange";
|
|
544
|
-
/** @deprecated Final Submit now returns "Application has already been final submitted." on `opportunityId` under `InvalidRequestFormat`. */
|
|
545
|
-
APIErrorCode["PaymentNotMade"] = "paymentNotMade";
|
|
546
|
-
/** @deprecated Secure Sign endpoints now return field-level messages under `InvalidRequestFormat`. */
|
|
547
|
-
APIErrorCode["SecureSignRelatedError"] = "SecureSignRelatedError";
|
|
548
|
-
/** @deprecated Secure Sign endpoints now return field-level messages under `InvalidRequestFormat`. */
|
|
549
|
-
APIErrorCode["SigningPackageNotCreated"] = "SigningPackageNotCreated";
|
|
550
|
-
/** @deprecated Secure Sign endpoints now return field-level messages under `InvalidRequestFormat`. */
|
|
551
|
-
APIErrorCode["SecureSignPinMismatch"] = "SecureSignPinMismatch";
|
|
552
|
-
/** @deprecated Secure Sign endpoints now return field-level messages under `InvalidRequestFormat`. */
|
|
553
|
-
APIErrorCode["PinExpired"] = "PinExpired";
|
|
554
|
-
/** @deprecated Secure Sign endpoints now return field-level messages under `InvalidRequestFormat`. */
|
|
555
|
-
APIErrorCode["DocumentsNotViewed"] = "DocumentsNotViewed";
|
|
556
|
-
/** @deprecated Secure Sign endpoints now return "Documents are already signed." on `OpportunityId` under `InvalidRequestFormat`. */
|
|
557
|
-
APIErrorCode["DocumentsAlreadySigned"] = "DocumentsAlreadySigned";
|
|
558
577
|
})(APIErrorCode || (exports.APIErrorCode = APIErrorCode = {}));
|
package/dist/types/errors.d.ts
CHANGED
|
@@ -23,7 +23,10 @@ export declare class APIValidationError extends InstaBrainError {
|
|
|
23
23
|
*/
|
|
24
24
|
isErrorType(errorCode: string): boolean;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* Returns a human-readable message for a given API error code.
|
|
27
|
+
* Includes mappings for both active and deprecated error codes.
|
|
28
|
+
* Deprecated codes retain their mappings here for backward compatibility
|
|
29
|
+
* with integrations that may still receive legacy responses.
|
|
27
30
|
*/
|
|
28
31
|
getUserFriendlyMessage(): string;
|
|
29
32
|
}
|
package/dist/types/errors.js
CHANGED
|
@@ -44,7 +44,10 @@ class APIValidationError extends InstaBrainError {
|
|
|
44
44
|
return this.errorCode === errorCode;
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
47
|
+
* Returns a human-readable message for a given API error code.
|
|
48
|
+
* Includes mappings for both active and deprecated error codes.
|
|
49
|
+
* Deprecated codes retain their mappings here for backward compatibility
|
|
50
|
+
* with integrations that may still receive legacy responses.
|
|
48
51
|
*/
|
|
49
52
|
getUserFriendlyMessage() {
|
|
50
53
|
const errorMessages = {
|
|
@@ -64,9 +67,20 @@ class APIValidationError extends InstaBrainError {
|
|
|
64
67
|
'StateMismatchIdentified': 'Quote state and Start Application Address.State refer to different US states. Re-quote with the correct residence state.',
|
|
65
68
|
'agentNotFound': 'The quote cannot be linked to an agent account. Please verify the agent token and try again.',
|
|
66
69
|
'internalServerError': 'An unexpected error occurred while processing the application. Please retry; if the issue persists, contact InstaBrain support.',
|
|
67
|
-
|
|
70
|
+
'InvalidRequestFormat': 'The request format is invalid. Inspect value.fields for per-field details.',
|
|
71
|
+
'QuoteNotFound': 'No previous quote found for this opportunity. Please create a quote first.',
|
|
72
|
+
'ApplicationLimitReached': 'An application with the same SSN, email, or phone already has a policy generated within the last 30 days.',
|
|
73
|
+
'SecureSignRelatedError': 'A signing-related error occurred. Please try again.',
|
|
74
|
+
'SigningPackageNotCreated': 'No signing package exists for this application. Call prepareDocsAndGetDeliveryChannels() first.',
|
|
75
|
+
'SecureSignPinMismatch': 'The PIN entered is incorrect. Please try again.',
|
|
76
|
+
'PinExpired': 'The PIN has expired. Please request a new one.',
|
|
77
|
+
'DocumentsNotViewed': 'All documents must be viewed before verifying the PIN.',
|
|
78
|
+
'DocumentsAlreadySigned': 'The documents have already been signed for this application.',
|
|
79
|
+
'InvalidPhoneNumber': 'The phone number is invalid for SMS delivery.',
|
|
80
|
+
'EmailDeliveryFailed': 'Email delivery failed. Retry or switch to SMS.',
|
|
81
|
+
'MessageNotDelivered': 'SMS delivery failed. Retry or switch to email.',
|
|
82
|
+
'FidelityFinalSubmitError': 'Fidelity carrier rejected or failed to process the submission. Contact support with the opportunityId.',
|
|
68
83
|
'AgentLogout': 'Agent session has expired. Please re-authenticate.',
|
|
69
|
-
// ── DEPRECATED — surfaced as field-level messages under InvalidRequestFormat ──
|
|
70
84
|
'InvalidBirthCountry': 'The birth country provided is not valid.',
|
|
71
85
|
'InvalidBirthState': 'The birth state provided is not valid.',
|
|
72
86
|
'InvalidResidenceState': 'The residence state provided is not valid.',
|
|
@@ -74,24 +88,11 @@ class APIValidationError extends InstaBrainError {
|
|
|
74
88
|
'PaymentAlreadyMade': 'Payment has already been made for this application.',
|
|
75
89
|
'ErrorInSaveEftPaymentDetails': 'Failed to save EFT payment details. Please verify account information.',
|
|
76
90
|
'InvalidPaymentScheduledDate': 'The scheduled payment date is not valid.',
|
|
77
|
-
'ThirdPartyQuoteError': 'An error occurred while
|
|
91
|
+
'ThirdPartyQuoteError': 'An error occurred while retrieving the quote.',
|
|
78
92
|
'InvalidQuoteParameters': 'The quote parameters provided are not valid.',
|
|
79
|
-
'InvalidRequestFormat': 'The request format is invalid. Inspect value.fields for per-field details.',
|
|
80
|
-
'QuoteNotFound': 'No previous quote found for this opportunity. Please create a quote first.',
|
|
81
|
-
// ADB-specific (deprecated — now surfaced as field-level messages under InvalidRequestFormat)
|
|
82
93
|
'InvalidStateCode': 'State not supported for ADB (MA, NH, AK unavailable; CA coming next release).',
|
|
83
94
|
'InvalidAdbAgeRange': 'Age must be between 20 and 59 for ADB.',
|
|
84
|
-
|
|
85
|
-
'ApplicationLimitReached': 'An application with the same SSN, email, or phone already has a policy generated within the last 30 days.',
|
|
86
|
-
// Final Submit error messages
|
|
87
|
-
'paymentNotMade': 'EFT payment must be completed before submitting the application.',
|
|
88
|
-
// Secure Sign error messages
|
|
89
|
-
'SecureSignRelatedError': 'A signing-related error occurred. Please try again.',
|
|
90
|
-
'SigningPackageNotCreated': 'No signing package exists for this application. Complete previous steps first.',
|
|
91
|
-
'SecureSignPinMismatch': 'The PIN entered is incorrect. Please try again.',
|
|
92
|
-
'PinExpired': 'The PIN has expired. Please request a new one.',
|
|
93
|
-
'DocumentsNotViewed': 'All documents must be viewed before verifying the PIN.',
|
|
94
|
-
'DocumentsAlreadySigned': 'The documents have already been signed for this application.'
|
|
95
|
+
'paymentNotMade': 'EFT payment must be completed before submitting the application.'
|
|
95
96
|
};
|
|
96
97
|
return errorMessages[this.errorCode] || this.message;
|
|
97
98
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export * from './beneficiary.types';
|
|
|
9
9
|
export * from './gigdb.types';
|
|
10
10
|
export * from './adb.types';
|
|
11
11
|
export * from './ibterm.types';
|
|
12
|
+
export * from './pureterm.types';
|
|
12
13
|
export * from './secure-sign.types';
|
|
13
14
|
/**
|
|
14
15
|
* Base configuration for the InstaBrain SDK
|
package/dist/types/index.js
CHANGED
|
@@ -26,4 +26,5 @@ __exportStar(require("./beneficiary.types"), exports);
|
|
|
26
26
|
__exportStar(require("./gigdb.types"), exports);
|
|
27
27
|
__exportStar(require("./adb.types"), exports);
|
|
28
28
|
__exportStar(require("./ibterm.types"), exports);
|
|
29
|
+
__exportStar(require("./pureterm.types"), exports);
|
|
29
30
|
__exportStar(require("./secure-sign.types"), exports);
|