@instabrain-sdks/api-client 2.3.2 → 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 +211 -12
- 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/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 +8 -0
- package/dist/types/enums.js +12 -2
- 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
package/README.md
CHANGED
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
TypeScript SDK for Node.js. All operations go through `InstaBrainClient` — request/response types are exported from `@instabrain-sdks/api-client`.
|
|
6
6
|
|
|
7
|
-
**Products covered:** GIGDB, ADB, IB Term.
|
|
7
|
+
**Products covered:** GIGDB, ADB, IB Term, Pure Term.
|
|
8
8
|
|
|
9
9
|
- **GIGDB & ADB** — full client flow: `get*Quote()` → `start*Application()` → `saveEftPayment()` → SecureSign methods → `finalSubmit()`.
|
|
10
10
|
- **IB Term** — client flow ends at `startIBTermApplication()`; use returned `agentLink` / `applicantLink` / `eAppAgentLink` for the InstaBrain frontend.
|
|
11
|
+
- **Pure Term** — pre-fill flow: `getPureTermQuote()` → `startApplication()`; use returned links for the InstaBrain frontend.
|
|
11
12
|
|
|
12
13
|
```typescript
|
|
13
14
|
import { InstaBrainClient } from '@instabrain-sdks/api-client';
|
|
@@ -45,28 +46,32 @@ Credentials (`userId` and `accessToken`) are provisioned during onboarding.
|
|
|
45
46
|
- [Get quote](#ib-term--get-quote)
|
|
46
47
|
- [Start application](#ib-term--start-application)
|
|
47
48
|
- [Get existing quote](#ib-term--get-existing-quote)
|
|
48
|
-
7. [
|
|
49
|
+
7. [Pure Term](#pure-term)
|
|
50
|
+
- [Integration flow](#integration-flow-3)
|
|
51
|
+
- [Get quote](#pure-term--get-quote)
|
|
52
|
+
- [Start application](#pure-term--start-application)
|
|
53
|
+
8. [Shared methods — GIGDB & ADB](#shared-methods--gigdb--adb)
|
|
49
54
|
- [Save EFT payment](#save-eft-payment)
|
|
50
55
|
- [Prepare docs & get delivery channels](#prepare-docs--get-delivery-channels)
|
|
51
56
|
- [Send PIN & get documents link](#send-pin--get-documents-link)
|
|
52
57
|
- [Resend PIN](#resend-pin)
|
|
53
58
|
- [Verify PIN](#verify-pin)
|
|
54
59
|
- [Final submit](#final-submit)
|
|
55
|
-
|
|
60
|
+
9. [Reporting](#reporting)
|
|
56
61
|
- [Request fields](#request-fields-shared-shape)
|
|
57
62
|
- [Filters (`SQLOperator`)](#filters--sqloperator-enum)
|
|
58
63
|
- [Response shapes](#response-shapes)
|
|
59
|
-
|
|
60
|
-
|
|
64
|
+
10. [Enums & Constants](#enums--constants)
|
|
65
|
+
11. [Beneficiary Reference](#beneficiary-reference)
|
|
61
66
|
- [No extra fields](#variant-1--no-extra-fields)
|
|
62
67
|
- [Named person](#variant-2--named-person)
|
|
63
68
|
- [Named entity](#variant-3--named-entity)
|
|
64
|
-
|
|
69
|
+
12. [Error Handling](#error-handling)
|
|
65
70
|
- [Error class hierarchy](#error-class-hierarchy)
|
|
66
71
|
- [Using `APIValidationError`](#using-apivalidationerror)
|
|
67
72
|
- [`BaseResponse<T>` envelope](#baseresponset-envelope)
|
|
68
73
|
- [Field-level error messages](#field-level-error-messages)
|
|
69
|
-
|
|
74
|
+
13. [Error codes (`APIErrorCode`)](#apierrorcode-reference)
|
|
70
75
|
- [Quote errors](#quote-errors)
|
|
71
76
|
- [Start application errors](#start-application-errors)
|
|
72
77
|
- [Payment & quote update errors](#payment--quote-update-errors)
|
|
@@ -74,10 +79,10 @@ Credentials (`userId` and `accessToken`) are provisioned during onboarding.
|
|
|
74
79
|
- [Final submit errors](#final-submit-errors)
|
|
75
80
|
- [Session](#session)
|
|
76
81
|
- [Deprecated codes (reference only)](#deprecated-codes-reference-only)
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
82
|
+
14. [Environment Configuration](#environment-configuration)
|
|
83
|
+
15. [Token Management](#token-management)
|
|
84
|
+
16. [Examples Directory](#examples-directory)
|
|
85
|
+
17. [Support](#support)
|
|
81
86
|
|
|
82
87
|
---
|
|
83
88
|
|
|
@@ -1630,9 +1635,203 @@ const { quoteResponseId, quoteAmount } = quoteResp.selectedQuote;
|
|
|
1630
1635
|
|
|
1631
1636
|
---
|
|
1632
1637
|
|
|
1638
|
+
## Pure Term
|
|
1639
|
+
|
|
1640
|
+
**InstaBrain Pure Term** — simplified term life product.
|
|
1641
|
+
|
|
1642
|
+
This is a **pre-fill flow**: use `getPureTermQuote()` then `startApplication()`, then hand off via `agentLink`, `applicantLink`, and `eAppAgentLink`. Do **not** call `saveEftPayment()`, SecureSign methods, or `finalSubmit()` for Pure Term.
|
|
1643
|
+
|
|
1644
|
+
- **Eligible ages:** 18–60
|
|
1645
|
+
- **Rating:** `rateClass`, `healthClass`, or `height` + `weightInLbs`
|
|
1646
|
+
- **Term lengths:** 10, 20, or 30 years (`benefitPeriod`)
|
|
1647
|
+
|
|
1648
|
+
---
|
|
1649
|
+
|
|
1650
|
+
## Integration flow
|
|
1651
|
+
|
|
1652
|
+
```
|
|
1653
|
+
1. [`getPureTermQuote()`](#pure-term--get-quote) Get quote → quoteResponseId
|
|
1654
|
+
2. [`startApplication()`](#pure-term--start-application) Start app → agentLink / applicantLink
|
|
1655
|
+
├── isDeclined = true → STOP
|
|
1656
|
+
└── isQuoteChanged = true → re-present updated premium, then hand off via links
|
|
1657
|
+
|
|
1658
|
+
→ Direct agent or applicant to agentLink / applicantLink / eAppAgentLink
|
|
1659
|
+
All remaining steps complete inside the InstaBrain frontend.
|
|
1660
|
+
No further InstaBrainClient methods for Pure Term.
|
|
1661
|
+
```
|
|
1662
|
+
|
|
1663
|
+
---
|
|
1664
|
+
|
|
1665
|
+
## Pure Term — Get Quote
|
|
1666
|
+
|
|
1667
|
+
**Method:** `client.getPureTermQuote(request)` · **Type:** `ThirdPartyPureTermQuoteReq`
|
|
1668
|
+
|
|
1669
|
+
|
|
1670
|
+
***
|
|
1671
|
+
|
|
1672
|
+
### Request Fields
|
|
1673
|
+
|
|
1674
|
+
Provide exactly one rating group (†) and exactly one age input (‡).
|
|
1675
|
+
|
|
1676
|
+
| Field | Type | Required | Description | Validation Error |
|
|
1677
|
+
|---|---|---|---|---|
|
|
1678
|
+
| `faceAmount` | `number` | Yes | Coverage amount — age-based limits apply | `Coverage amount (FaceAmount) is required.` |
|
|
1679
|
+
| `benefitPeriod` | `number` | Yes | Term: 10, 20, or 30 years (state/age/tobacco dependent) | `Benefit period is required.` |
|
|
1680
|
+
| `flagTobaccoUse` | `boolean` | No | Defaults to `false` when omitted | — |
|
|
1681
|
+
| `gender` | `Gender` | Yes | `Gender.Male`, `Gender.Female` | `Gender is required.` / `Invalid gender.` |
|
|
1682
|
+
| `stateCode` | `string` | Yes | 2-letter US state code | `State code is required.` / `State code is not valid.` / `This product is not available for the selected state.` |
|
|
1683
|
+
| `rateClass` | `RateClass` | One of † | `"Preferred Plus"`, `"Preferred"`, `"Standard"`, `"Standard Extra"` | `Either RateClass, HealthClass, or Height and WeightInLbs must be provided.` |
|
|
1684
|
+
| `healthClass` | `HealthClass` | One of † | `"excellent"`, `"great"`, `"good"`, `"average"` (case-insensitive) | `Health class is invalid.` |
|
|
1685
|
+
| `height` | `ThirdPartyQuoteReqHeight \| null` | One of † | `feet` (1–8), `inches` (0–11) — required with `weightInLbs` | `Height or weight is invalid.` |
|
|
1686
|
+
| `weightInLbs` | `number \| null` | One of † | Paired with `height` | — |
|
|
1687
|
+
| `age` | `number` | Yes‡ | 18–60 | `Either age or date of birth must be provided.` / `Age must be between 18 and 60.` |
|
|
1688
|
+
| `dateOfBirth` | `string` (ISO 8601) | Yes‡ | Wins over `age` when both provided | `Date of birth must be a valid date.` |
|
|
1689
|
+
| `riders` | `object[]` | No | `[{ rider: riderCode, riderFaceAmount: number }]` | `Riders are invalid.` |
|
|
1690
|
+
| `paymentFreq` | `PaymentFrequency` | Yes | `"Monthly"` or `"Annually"` | `Payment frequency is required.` |
|
|
1691
|
+
| `firstName` | `string` | No | Alphabetic only — lead capture | `First name is invalid. Only alphabetic characters are allowed.` |
|
|
1692
|
+
| `lastName` | `string` | No | Alphabetic only — lead capture | `Last name is invalid. Only alphabetic characters are allowed.` |
|
|
1693
|
+
| `email` | `string` | No | Lead capture | `Please enter a valid email address.` |
|
|
1694
|
+
| `phoneNum` | `string` | No | 10 digits or E.164 — lead capture | `Phone number format is incorrect.` |
|
|
1695
|
+
|
|
1696
|
+
> **†** Supply exactly **one** rating group: `rateClass`, OR `healthClass`, OR both `height` and `weightInLbs`.
|
|
1697
|
+
> **‡** Provide `age` OR `dateOfBirth`. When both are sent, `dateOfBirth` takes priority.
|
|
1698
|
+
|
|
1699
|
+
|
|
1700
|
+
***
|
|
1701
|
+
|
|
1702
|
+
### Error Codes
|
|
1703
|
+
|
|
1704
|
+
| Code | When |
|
|
1705
|
+
|---|---|
|
|
1706
|
+
| `InvalidRequestFormat` | Any field validation failure — inspect `value.fields` |
|
|
1707
|
+
| `BenefitPeriodNotAvailable` | `benefitPeriod` not allowed for state/age/nicotine combination |
|
|
1708
|
+
| `CoverageNotAvailable` | `faceAmount` outside allowed range for state/age/nicotine |
|
|
1709
|
+
| `NotAvailableForState` | Pure Term not available in the requested state |
|
|
1710
|
+
| `QuoteNotEligibleForGivenConditions` | State/age/nicotine combination not eligible |
|
|
1711
|
+
| `OutsideBuildChart` | Height/weight outside carrier build chart |
|
|
1712
|
+
| `RiderNotAvailable` | Rider unavailable for product or state |
|
|
1713
|
+
| `RiderFaceAmountNotValid` | Rider face amount outside allowed range |
|
|
1714
|
+
|
|
1715
|
+
|
|
1716
|
+
***
|
|
1717
|
+
|
|
1718
|
+
### Response
|
|
1719
|
+
|
|
1720
|
+
| Field | Type | Description |
|
|
1721
|
+
|---|---|---|
|
|
1722
|
+
| `productName` | `string` | `"InstaPureTerm"` |
|
|
1723
|
+
| `selectedQuote.quoteResponseId` | `string` | Pass as `quoteResponseId` in `startApplication()` |
|
|
1724
|
+
| `selectedQuote.quoteAmount` | `number` | Premium at requested payment frequency |
|
|
1725
|
+
| `selectedQuote.faceAmount` | `number` | Coverage amount |
|
|
1726
|
+
| `selectedQuote.benefitPeriod` | `number \| null` | Term length in years |
|
|
1727
|
+
| `selectedQuote.paymentFrequency` | `string \| null` | `"Monthly"` or `"Annually"` |
|
|
1728
|
+
|
|
1729
|
+
|
|
1730
|
+
***
|
|
1731
|
+
|
|
1732
|
+
### Example
|
|
1733
|
+
|
|
1734
|
+
```typescript
|
|
1735
|
+
import { InstaBrainClient, Gender, PaymentFrequency, HealthClass } from '@instabrain-sdks/api-client';
|
|
1736
|
+
|
|
1737
|
+
const quoteResp = await client.getPureTermQuote({
|
|
1738
|
+
faceAmount: 500000,
|
|
1739
|
+
benefitPeriod: 20,
|
|
1740
|
+
flagTobaccoUse: false,
|
|
1741
|
+
gender: Gender.Male,
|
|
1742
|
+
stateCode: 'TX',
|
|
1743
|
+
healthClass: HealthClass.Great,
|
|
1744
|
+
age: 35,
|
|
1745
|
+
paymentFreq: PaymentFrequency.Monthly
|
|
1746
|
+
});
|
|
1747
|
+
|
|
1748
|
+
const { quoteResponseId, quoteAmount } = quoteResp.selectedQuote;
|
|
1749
|
+
```
|
|
1750
|
+
|
|
1751
|
+
---
|
|
1752
|
+
|
|
1753
|
+
## Pure Term — Start Application
|
|
1754
|
+
|
|
1755
|
+
**Method:** `client.startApplication(request)` · **Type:** `ThirdPartyStartApplicationReq`
|
|
1756
|
+
|
|
1757
|
+
|
|
1758
|
+
This is the **generic** start-application endpoint shared across products that use the pre-fill link hand-off flow. For Pure Term, call this after `getPureTermQuote()` using the `quoteResponseId` from the quote response.
|
|
1759
|
+
|
|
1760
|
+
|
|
1761
|
+
***
|
|
1762
|
+
|
|
1763
|
+
### Request Fields
|
|
1764
|
+
|
|
1765
|
+
| Field | Type | Required | Description |
|
|
1766
|
+
|---|---|---|---|
|
|
1767
|
+
| `quoteResponseId` | `string` | Yes | UUID from `getPureTermQuote()` |
|
|
1768
|
+
| `firstName` | `string \| null` | Yes | Applicant first name |
|
|
1769
|
+
| `lastName` | `string \| null` | Yes | Applicant last name |
|
|
1770
|
+
| `email` | `string \| null` | Yes | Applicant email address |
|
|
1771
|
+
| `phoneNumber` | `string \| null` | Yes | Applicant phone number — 10-digit local or E.164 |
|
|
1772
|
+
| `proCode` | `string \| null` | No | Product variant code. When omitted the base product is started. Contact InstaBrain support for the correct code if a specific variant is required. |
|
|
1773
|
+
|
|
1774
|
+
|
|
1775
|
+
***
|
|
1776
|
+
|
|
1777
|
+
### Business Rules
|
|
1778
|
+
|
|
1779
|
+
1. `isDeclined: true` is a valid success response (knockout) — the SDK does **not** throw.
|
|
1780
|
+
2. When `isQuoteChanged = true`, the carrier adjusted the premium. Re-present the updated premium to the applicant before directing them to the link.
|
|
1781
|
+
|
|
1782
|
+
|
|
1783
|
+
***
|
|
1784
|
+
|
|
1785
|
+
### Knockout Rules
|
|
1786
|
+
|
|
1787
|
+
Returns `isDeclined: true` on a successful response — the SDK does **not** throw. Check the field explicitly; do not treat it as an exception.
|
|
1788
|
+
|
|
1789
|
+
|
|
1790
|
+
***
|
|
1791
|
+
|
|
1792
|
+
### Response
|
|
1793
|
+
|
|
1794
|
+
| Field | Type | Description |
|
|
1795
|
+
|---|---|---|
|
|
1796
|
+
| `opportunityId` | `string` | All-zero UUID when declined before opportunity creation |
|
|
1797
|
+
| `isDeclined` | `boolean` | `true` = knockout; stop the flow |
|
|
1798
|
+
| `isQuoteChanged` | `boolean` | `true` = carrier adjusted premium; re-present before handoff |
|
|
1799
|
+
| `agentLink` | `string \| null` | Agent Conversational UI |
|
|
1800
|
+
| `applicantLink` | `string \| null` | Applicant Conversational UI |
|
|
1801
|
+
| `eAppAgentLink` | `string \| null` | Agent E-App |
|
|
1802
|
+
|
|
1803
|
+
> After a non-declined response, direct the agent or applicant to the appropriate link. All remaining steps (underwriting, payment, signing) complete inside the InstaBrain frontend.
|
|
1804
|
+
|
|
1805
|
+
|
|
1806
|
+
***
|
|
1807
|
+
|
|
1808
|
+
### Example
|
|
1809
|
+
|
|
1810
|
+
```typescript
|
|
1811
|
+
const appResp = await client.startApplication({
|
|
1812
|
+
quoteResponseId,
|
|
1813
|
+
firstName: 'Jane',
|
|
1814
|
+
lastName: 'Doe',
|
|
1815
|
+
email: 'jane.doe@example.com',
|
|
1816
|
+
phoneNumber: '5551234567',
|
|
1817
|
+
// proCode: 'VARIANT_CODE' // omit to start the base product
|
|
1818
|
+
});
|
|
1819
|
+
|
|
1820
|
+
if (appResp.isDeclined) {
|
|
1821
|
+
return;
|
|
1822
|
+
}
|
|
1823
|
+
if (appResp.isQuoteChanged) {
|
|
1824
|
+
// Re-present updated premium before directing to link
|
|
1825
|
+
}
|
|
1826
|
+
// Hand off to InstaBrain frontend
|
|
1827
|
+
console.log('Applicant link:', appResp.applicantLink);
|
|
1828
|
+
```
|
|
1829
|
+
|
|
1830
|
+
---
|
|
1831
|
+
|
|
1633
1832
|
## Shared methods — GIGDB & ADB
|
|
1634
1833
|
|
|
1635
|
-
These methods apply to **GIGDB and ADB only**. IB Term
|
|
1834
|
+
These methods apply to **GIGDB and ADB only**. IB Term and Pure Term use the frontend links returned by Start Application.
|
|
1636
1835
|
|
|
1637
1836
|
---
|
|
1638
1837
|
|
|
@@ -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
|
|
@@ -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",
|
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) {
|
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);
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Gender, PaymentFrequency, PureTermRateClass, HealthClass } from './enums';
|
|
2
|
+
import { ThirdPartyQuoteReqHeight, ThirdPartyQuoteReqRider } from './quote.types';
|
|
3
|
+
/**
|
|
4
|
+
* Request body for `POST /api/ThirdPartyIbPureTermQuote/get`.
|
|
5
|
+
*
|
|
6
|
+
* Source of truth: ThirdPartyTermQuoteRequest.cs (InstaPureTerm product).
|
|
7
|
+
*
|
|
8
|
+
* **Validation rules (enforced server-side):**
|
|
9
|
+
* - `benefitPeriod` is required.
|
|
10
|
+
* - **One rating input group is required** — supply ONE of:
|
|
11
|
+
* (a) `rateClass`, OR
|
|
12
|
+
* (b) `healthClass`, OR
|
|
13
|
+
* (c) `height` + `weightInLbs` (both together).
|
|
14
|
+
* - `age` OR `dateOfBirth` required; resolved age must be 18–60. When both
|
|
15
|
+
* are provided, `dateOfBirth` takes priority.
|
|
16
|
+
* - `stateCode` required.
|
|
17
|
+
*/
|
|
18
|
+
export interface ThirdPartyPureTermQuoteReq {
|
|
19
|
+
/**
|
|
20
|
+
* Coverage amount in dollars.
|
|
21
|
+
* Age-based limits apply — same schedule as IB Term.
|
|
22
|
+
*/
|
|
23
|
+
faceAmount?: number | null;
|
|
24
|
+
/** Term length in years. **Required.** Available: 10, 20, 30 (state/age/tobacco dependent). */
|
|
25
|
+
benefitPeriod?: number | null;
|
|
26
|
+
/** Whether the applicant uses tobacco or nicotine. */
|
|
27
|
+
flagTobaccoUse: boolean;
|
|
28
|
+
/** Applicant gender. */
|
|
29
|
+
gender?: Gender | null;
|
|
30
|
+
/** 2-letter US state code. Required. */
|
|
31
|
+
stateCode?: string | null;
|
|
32
|
+
/** Rate class — one of the three rating groups (†). */
|
|
33
|
+
rateClass?: PureTermRateClass | null;
|
|
34
|
+
/** Health class — one of the three rating groups (†). */
|
|
35
|
+
healthClass?: HealthClass | null;
|
|
36
|
+
/**
|
|
37
|
+
* Applicant height. Required together with `weightInLbs` when using the
|
|
38
|
+
* height/weight rating path. Omit when rating via `rateClass` or `healthClass`.
|
|
39
|
+
*/
|
|
40
|
+
height?: ThirdPartyQuoteReqHeight | null;
|
|
41
|
+
/** Applicant weight in lbs. Required together with `height`. */
|
|
42
|
+
weightInLbs?: number | null;
|
|
43
|
+
/** Applicant age (18–60). Provide `age` OR `dateOfBirth`. */
|
|
44
|
+
age?: number | null;
|
|
45
|
+
/** Applicant date of birth (ISO 8601). Takes priority over `age` when both are provided. */
|
|
46
|
+
dateOfBirth?: string | null;
|
|
47
|
+
/** Riders to include. Use `riderCode` values returned by the rider lookup endpoint. */
|
|
48
|
+
riders?: ThirdPartyQuoteReqRider[] | null;
|
|
49
|
+
/** Payment frequency. */
|
|
50
|
+
paymentFreq?: PaymentFrequency | null;
|
|
51
|
+
/** First name — alphabetic only. Lead capture. */
|
|
52
|
+
firstName?: string | null;
|
|
53
|
+
/** Last name — alphabetic only. Lead capture. */
|
|
54
|
+
lastName?: string | null;
|
|
55
|
+
/** Email address. Lead capture. */
|
|
56
|
+
email?: string | null;
|
|
57
|
+
/** Phone number — 10-digit local or E.164 format. Lead capture. */
|
|
58
|
+
phoneNum?: string | null;
|
|
59
|
+
}
|
package/package.json
CHANGED