@instabrain-sdks/api-client 2.3.0 → 2.3.2

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.
@@ -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.
@@ -434,18 +434,14 @@ export declare enum AdbRiderType {
434
434
  InflationBenefit = "InflationBenefit"
435
435
  }
436
436
  /**
437
- * API Error codes returned in the top-level `error` field of a failed response.
437
+ * API Error codes returned in the top-level `error` / `errorCode` field when `flagStatus` is false.
438
438
  *
439
- * **Most validation failures use `InvalidRequestFormat`** with per-field details
440
- * nested under `value.fields`. Only the IB Term Quote endpoint and a few
441
- * cross-cutting business cases use other top-level error codes.
439
+ * Many validation failures use `InvalidRequestFormat` with per-field details in `value.fields`.
440
+ * Quote business rules, Start Application limits, Secure Sign, and Final Submit also use
441
+ * dedicated top-level codes listed below.
442
442
  *
443
- * Codes marked `@deprecated` are not returned by the current Third-Party API
444
- * (per `THIRD_PARTY_ERROR_CODES.md` reference, 2026-05). They remain in the enum
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.
443
+ * Members marked `@deprecated` remain for backward compatibility but are not documented as
444
+ * active in the README; prefer `InvalidRequestFormat` field messages where applicable.
449
445
  */
450
446
  export declare enum APIErrorCode {
451
447
  /** Top-level code for every FluentValidation failure across all products. Inspect `value.fields` for field-level details. */
@@ -468,10 +464,6 @@ export declare enum APIErrorCode {
468
464
  BenefitPeriodNotAvailable = "BenefitPeriodNotAvailable",
469
465
  /** IB Term Quote only — height + weight fall outside the carrier's acceptable build chart. */
470
466
  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
467
  /** 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
468
  ApplicationLimitReached = "ApplicationLimitReached",
477
469
  /** Quote state and `Address.State` on Start Application refer to different US states (case-insensitive compare). Returned only after request validation passes. */
@@ -480,41 +472,53 @@ export declare enum APIErrorCode {
480
472
  AgentNotFound = "agentNotFound",
481
473
  /** Unexpected backend failure while processing a Start Application request. */
482
474
  InternalServerError = "internalServerError",
475
+ /** Update quote or save EFT when payment is already recorded for the opportunity. */
476
+ PaymentAlreadyMade = "PaymentAlreadyMade",
477
+ /** Generic Secure Sign failure. */
478
+ SecureSignRelatedError = "SecureSignRelatedError",
479
+ /** Signing package missing — call `prepareDocsAndGetDeliveryChannels()` first. */
480
+ SigningPackageNotCreated = "SigningPackageNotCreated",
481
+ /** Wrong PIN on `verifyPin()` (also returns `isVerified: false` without throwing). */
482
+ SecureSignPinMismatch = "SecureSignPinMismatch",
483
+ /** PIN expired — call `resendPin()`. */
484
+ PinExpired = "PinExpired",
485
+ /** Documents already signed for this opportunity. */
486
+ DocumentsAlreadySigned = "DocumentsAlreadySigned",
487
+ /** Phone number invalid for SMS on Send PIN / Resend PIN. */
488
+ InvalidPhoneNumber = "InvalidPhoneNumber",
489
+ /** Email delivery failed on Send PIN / Resend PIN. */
490
+ EmailDeliveryFailed = "EmailDeliveryFailed",
491
+ /** SMS delivery failed on Send PIN / Resend PIN. */
492
+ MessageNotDelivered = "MessageNotDelivered",
493
+ /** EFT payment not saved — call `saveEftPayment()` before `finalSubmit()`. */
494
+ PaymentNotMade = "paymentNotMade",
495
+ /** Fidelity carrier rejected or failed to process final submit. */
496
+ FidelityFinalSubmitError = "FidelityFinalSubmitError",
483
497
  AgentLogout = "AgentLogout",
484
- /** @deprecated Returned as a field-level message on `BirthJurisdiction.Country` under `InvalidRequestFormat`. */
498
+ /** Top-level code returned by `getExistingIBTermQuote()` / `getExistingGigdbQuote()` / `getExistingAdbQuote()` when no quote is on file for the opportunityId. HTTP 400, `value: null`. */
499
+ QuoteNotFound = "QuoteNotFound",
500
+ /** 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. */
501
+ HeightNotValid = "HeightNotValid",
502
+ /** Applicant has not viewed all documents before attempting PIN verification. Returned by `verifyPin()`. */
503
+ DocumentsNotViewed = "DocumentsNotViewed",
504
+ /** @deprecated Prefer `InvalidRequestFormat` on `BirthJurisdiction.Country`. */
485
505
  InvalidBirthCountry = "InvalidBirthCountry",
486
- /** @deprecated Returned as a field-level message on `BirthJurisdiction.State` under `InvalidRequestFormat`. */
506
+ /** @deprecated Prefer `InvalidRequestFormat` on `BirthJurisdiction.State`. */
487
507
  InvalidBirthState = "InvalidBirthState",
488
- /** @deprecated Returned as a field-level message on `Address.State` under `InvalidRequestFormat`. */
508
+ /** @deprecated Prefer `InvalidRequestFormat` on `Address.State`. */
489
509
  InvalidResidenceState = "InvalidResidenceState",
490
- /** @deprecated No longer returned by the API. */
510
+ /** @deprecated No longer returned as a top-level code. */
491
511
  OneOfTheExistingCoveragesQuestionsNotFound = "OneOfTheExistingCoveragesQuestionsNotFound",
492
- /** @deprecated Returned as a field-level message on `OpportunityId` under `InvalidRequestFormat` ("Quote update is not allowed when payment is already made."). */
493
- PaymentAlreadyMade = "PaymentAlreadyMade",
494
- /** @deprecated Returned as a field-level message under `InvalidRequestFormat`. */
512
+ /** @deprecated Prefer `InvalidRequestFormat` on EFT fields. */
495
513
  ErrorInSaveEftPaymentDetails = "ErrorInSaveEftPaymentDetails",
496
- /** @deprecated Returned as a field-level message under `InvalidRequestFormat`. */
514
+ /** @deprecated Prefer `InvalidRequestFormat` on EFT fields. */
497
515
  InvalidPaymentScheduledDate = "InvalidPaymentScheduledDate",
498
- /** @deprecated Generic legacy code; no longer returned. */
516
+ /** @deprecated Legacy get-existing-quote code; prefer `InvalidRequestFormat`. */
499
517
  ThirdPartyQuoteError = "ThirdPartyQuoteError",
500
- /** @deprecated Generic legacy code; no longer returned. */
518
+ /** @deprecated No longer returned as a top-level code. */
501
519
  InvalidQuoteParameters = "InvalidQuoteParameters",
502
- /** @deprecated ADB state issues now return field-level messages on `Address.State` under `InvalidRequestFormat`. */
520
+ /** @deprecated Prefer `InvalidRequestFormat` on `Address.State` (ADB). */
503
521
  InvalidStateCode = "InvalidStateCode",
504
- /** @deprecated ADB age range failure now returns "Age must be between 20 and 59 for ADB." on `DateOfBirth` under `InvalidRequestFormat`. */
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"
522
+ /** @deprecated Prefer `InvalidRequestFormat` on `DateOfBirth` (ADB age 20–59). */
523
+ InvalidAdbAgeRange = "InvalidAdbAgeRange"
520
524
  }
@@ -463,18 +463,14 @@ var AdbRiderType;
463
463
  AdbRiderType["InflationBenefit"] = "InflationBenefit";
464
464
  })(AdbRiderType || (exports.AdbRiderType = AdbRiderType = {}));
465
465
  /**
466
- * API Error codes returned in the top-level `error` field of a failed response.
466
+ * API Error codes returned in the top-level `error` / `errorCode` field when `flagStatus` is false.
467
467
  *
468
- * **Most validation failures use `InvalidRequestFormat`** with per-field details
469
- * nested under `value.fields`. Only the IB Term Quote endpoint and a few
470
- * cross-cutting business cases use other top-level error codes.
468
+ * Many validation failures use `InvalidRequestFormat` with per-field details in `value.fields`.
469
+ * Quote business rules, Start Application limits, Secure Sign, and Final Submit also use
470
+ * dedicated top-level codes listed below.
471
471
  *
472
- * Codes marked `@deprecated` are not returned by the current Third-Party API
473
- * (per `THIRD_PARTY_ERROR_CODES.md` reference, 2026-05). They remain in the enum
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.
472
+ * Members marked `@deprecated` remain for backward compatibility but are not documented as
473
+ * active in the README; prefer `InvalidRequestFormat` field messages where applicable.
478
474
  */
479
475
  var APIErrorCode;
480
476
  (function (APIErrorCode) {
@@ -501,11 +497,6 @@ var APIErrorCode;
501
497
  APIErrorCode["BenefitPeriodNotAvailable"] = "BenefitPeriodNotAvailable";
502
498
  /** IB Term Quote only — height + weight fall outside the carrier's acceptable build chart. */
503
499
  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
500
  // ─── Start Application — duplicate-detection limit ───────────────────────
510
501
  /** 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
502
  APIErrorCode["ApplicationLimitReached"] = "ApplicationLimitReached";
@@ -516,43 +507,61 @@ var APIErrorCode;
516
507
  APIErrorCode["AgentNotFound"] = "agentNotFound";
517
508
  /** Unexpected backend failure while processing a Start Application request. */
518
509
  APIErrorCode["InternalServerError"] = "internalServerError";
510
+ // ─── Payment & quote update (after Start Application) ─────────────────────
511
+ /** Update quote or save EFT when payment is already recorded for the opportunity. */
512
+ APIErrorCode["PaymentAlreadyMade"] = "PaymentAlreadyMade";
513
+ // ─── Secure Sign ───────────────────────────────────────────────────────────
514
+ /** Generic Secure Sign failure. */
515
+ APIErrorCode["SecureSignRelatedError"] = "SecureSignRelatedError";
516
+ /** Signing package missing — call `prepareDocsAndGetDeliveryChannels()` first. */
517
+ APIErrorCode["SigningPackageNotCreated"] = "SigningPackageNotCreated";
518
+ /** Wrong PIN on `verifyPin()` (also returns `isVerified: false` without throwing). */
519
+ APIErrorCode["SecureSignPinMismatch"] = "SecureSignPinMismatch";
520
+ /** PIN expired — call `resendPin()`. */
521
+ APIErrorCode["PinExpired"] = "PinExpired";
522
+ /** Documents already signed for this opportunity. */
523
+ APIErrorCode["DocumentsAlreadySigned"] = "DocumentsAlreadySigned";
524
+ /** Phone number invalid for SMS on Send PIN / Resend PIN. */
525
+ APIErrorCode["InvalidPhoneNumber"] = "InvalidPhoneNumber";
526
+ /** Email delivery failed on Send PIN / Resend PIN. */
527
+ APIErrorCode["EmailDeliveryFailed"] = "EmailDeliveryFailed";
528
+ /** SMS delivery failed on Send PIN / Resend PIN. */
529
+ APIErrorCode["MessageNotDelivered"] = "MessageNotDelivered";
530
+ // ─── Final Submit ──────────────────────────────────────────────────────────
531
+ /** EFT payment not saved — call `saveEftPayment()` before `finalSubmit()`. */
532
+ APIErrorCode["PaymentNotMade"] = "paymentNotMade";
533
+ /** Fidelity carrier rejected or failed to process final submit. */
534
+ APIErrorCode["FidelityFinalSubmitError"] = "FidelityFinalSubmitError";
519
535
  // ─── Session ─────────────────────────────────────────────────────────────
520
536
  APIErrorCode["AgentLogout"] = "AgentLogout";
521
- // ─── DEPRECATED — superseded by `InvalidRequestFormat` field-level messages ──
522
- /** @deprecated Returned as a field-level message on `BirthJurisdiction.Country` under `InvalidRequestFormat`. */
537
+ // ─── Get Existing Quote ──────────────────────────────────────────────────
538
+ /** Top-level code returned by `getExistingIBTermQuote()` / `getExistingGigdbQuote()` / `getExistingAdbQuote()` when no quote is on file for the opportunityId. HTTP 400, `value: null`. */
539
+ APIErrorCode["QuoteNotFound"] = "QuoteNotFound";
540
+ // ─── IB Term Quote — height validation ───────────────────────────────────
541
+ /** 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. */
542
+ APIErrorCode["HeightNotValid"] = "HeightNotValid";
543
+ // ─── Secure Sign (continued) ─────────────────────────────────────────────
544
+ /** Applicant has not viewed all documents before attempting PIN verification. Returned by `verifyPin()`. */
545
+ APIErrorCode["DocumentsNotViewed"] = "DocumentsNotViewed";
546
+ // ─── Deprecated — not in active README; kept for backward compatibility ───
547
+ /** @deprecated Prefer `InvalidRequestFormat` on `BirthJurisdiction.Country`. */
523
548
  APIErrorCode["InvalidBirthCountry"] = "InvalidBirthCountry";
524
- /** @deprecated Returned as a field-level message on `BirthJurisdiction.State` under `InvalidRequestFormat`. */
549
+ /** @deprecated Prefer `InvalidRequestFormat` on `BirthJurisdiction.State`. */
525
550
  APIErrorCode["InvalidBirthState"] = "InvalidBirthState";
526
- /** @deprecated Returned as a field-level message on `Address.State` under `InvalidRequestFormat`. */
551
+ /** @deprecated Prefer `InvalidRequestFormat` on `Address.State`. */
527
552
  APIErrorCode["InvalidResidenceState"] = "InvalidResidenceState";
528
- /** @deprecated No longer returned by the API. */
553
+ /** @deprecated No longer returned as a top-level code. */
529
554
  APIErrorCode["OneOfTheExistingCoveragesQuestionsNotFound"] = "OneOfTheExistingCoveragesQuestionsNotFound";
530
- /** @deprecated Returned as a field-level message on `OpportunityId` under `InvalidRequestFormat` ("Quote update is not allowed when payment is already made."). */
531
- APIErrorCode["PaymentAlreadyMade"] = "PaymentAlreadyMade";
532
- /** @deprecated Returned as a field-level message under `InvalidRequestFormat`. */
555
+ /** @deprecated Prefer `InvalidRequestFormat` on EFT fields. */
533
556
  APIErrorCode["ErrorInSaveEftPaymentDetails"] = "ErrorInSaveEftPaymentDetails";
534
- /** @deprecated Returned as a field-level message under `InvalidRequestFormat`. */
557
+ /** @deprecated Prefer `InvalidRequestFormat` on EFT fields. */
535
558
  APIErrorCode["InvalidPaymentScheduledDate"] = "InvalidPaymentScheduledDate";
536
- /** @deprecated Generic legacy code; no longer returned. */
559
+ /** @deprecated Legacy get-existing-quote code; prefer `InvalidRequestFormat`. */
537
560
  APIErrorCode["ThirdPartyQuoteError"] = "ThirdPartyQuoteError";
538
- /** @deprecated Generic legacy code; no longer returned. */
561
+ /** @deprecated No longer returned as a top-level code. */
539
562
  APIErrorCode["InvalidQuoteParameters"] = "InvalidQuoteParameters";
540
- /** @deprecated ADB state issues now return field-level messages on `Address.State` under `InvalidRequestFormat`. */
563
+ /** @deprecated Prefer `InvalidRequestFormat` on `Address.State` (ADB). */
541
564
  APIErrorCode["InvalidStateCode"] = "InvalidStateCode";
542
- /** @deprecated ADB age range failure now returns "Age must be between 20 and 59 for ADB." on `DateOfBirth` under `InvalidRequestFormat`. */
565
+ /** @deprecated Prefer `InvalidRequestFormat` on `DateOfBirth` (ADB age 20–59). */
543
566
  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
567
  })(APIErrorCode || (exports.APIErrorCode = APIErrorCode = {}));
@@ -23,7 +23,10 @@ export declare class APIValidationError extends InstaBrainError {
23
23
  */
24
24
  isErrorType(errorCode: string): boolean;
25
25
  /**
26
- * Get user-friendly error message based on error code
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
  }
@@ -44,7 +44,10 @@ class APIValidationError extends InstaBrainError {
44
44
  return this.errorCode === errorCode;
45
45
  }
46
46
  /**
47
- * Get user-friendly error message based on error code
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
- // Session
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 generating the quote.',
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
- // Start Application — duplicate-detection limit (ADB / GIGDB only; IB Term does NOT use this)
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
  }
@@ -71,15 +71,16 @@ export interface IBTermPhysicianDetails {
71
71
  city: string;
72
72
  /** 2-letter US state code; "Outside Of The USA" is not accepted. Backend field: `PhysicianDetails.StateCode`. */
73
73
  stateCode: string;
74
- /** YYYY-MM, must be in the past. */
74
+ /** `YYYY-MM`. Must not be after the current month (current month is allowed). */
75
75
  lastSeen: string;
76
76
  }
77
77
  /**
78
78
  * IB Term tobacco / nicotine usage history.
79
79
  *
80
80
  * IB Term uses this structured object — it is NOT a boolean `isSmoker` flag
81
- * like ADB / GIGDB. The applicant must always supply this object on the
82
- * Start Application request.
81
+ * like ADB / GIGDB. Under the progressive disclosure model, the whole object
82
+ * is optional on Start Application; when present, every sub-rule below
83
+ * applies as before.
83
84
  */
84
85
  export interface IBTermTobaccoNicotineUsage {
85
86
  /** Bucket describing how recently the applicant last used tobacco / nicotine. */
@@ -210,7 +211,12 @@ export interface IBTermChildExistingCoverage {
210
211
  * in a declined application.
211
212
  */
212
213
  export interface IBTermChildRiderInfo {
213
- hasExistingCoverageForChildren: boolean;
214
+ /**
215
+ * Optional under the progressive disclosure model. Validated only when sent.
216
+ * When `true`, supply `existingCoverageInfoForChildren` (max 10 entries) per
217
+ * existing child policy.
218
+ */
219
+ hasExistingCoverageForChildren?: boolean | null;
214
220
  /** Knockout question — true declines the application. */
215
221
  isAnyChildTakingMedication: boolean;
216
222
  /** Knockout question — true declines the application. */
@@ -219,8 +225,12 @@ export interface IBTermChildRiderInfo {
219
225
  isAnyChildDiagnosedWithSevereCondition: boolean;
220
226
  /** Knockout question — true declines the application. */
221
227
  isAnyChildAdvisedForSurgery: boolean;
222
- /** At least 1, max 10. */
223
- childrenToBeInsuredDetails: IBTermChildToBeInsured[];
228
+ /**
229
+ * Optional under the progressive disclosure model. When provided, each entry
230
+ * is validated by the backend (max 10 entries). The previous "at least 1
231
+ * required" constraint has been removed.
232
+ */
233
+ childrenToBeInsuredDetails?: IBTermChildToBeInsured[] | null;
224
234
  /** Required when hasExistingCoverageForChildren === true; max 10 entries. */
225
235
  existingCoverageInfoForChildren?: IBTermChildExistingCoverage[];
226
236
  }
@@ -233,10 +243,23 @@ export interface IBTermChildRiderInfo {
233
243
  * usage, and the Dependent Child Rider's nested child + child-existing-coverage
234
244
  * arrays.
235
245
  *
236
- * Knockout returns `isDeclined: true` with no `opportunityId` created. IB Term
237
- * does NOT use `ApplicationLimitReached` (that applies to ADB/GIGDB only).
246
+ * **Progressive disclosure model:** eight top-level fields are
247
+ * optional — `address`, `socialSecurityNumber`, `dateOfBirth`,
248
+ * `birthJurisdiction`, `hasPrimaryCarePhysician`, `hasExistingCoverage`,
249
+ * `beneficiaryDetails`, `tobaccoNicotineUsage`. Backend validation fires only
250
+ * when each parent is sent. `IBTermChildRiderInfo.hasExistingCoverageForChildren`
251
+ * and `childrenToBeInsuredDetails` are similarly optional.
252
+ *
253
+ * Knockout returns `isDeclined: true` with no `opportunityId` created. Knockout
254
+ * triggers: `isUsCitizenOrIsPermanentResident === false`,
255
+ * `isPayerAlsoOwnerAndInsured === false`, driver license attestation
256
+ * (`isHoldingValidDriverLicense === false`), `areListedConditionsNotApplicable
257
+ * === false`, any of the four `IBTermChildRiderInfo` knockout booleans `true`,
258
+ * or height/weight outside allowed limits. The physician-age-55 knockout was
259
+ * removed. IB Term does NOT use `ApplicationLimitReached` (that
260
+ * applies to ADB/GIGDB only).
238
261
  *
239
- * Eligible age range: 18–60 (derived from `dateOfBirth`).
262
+ * Eligible age range: 18–60 (derived from the originating quote).
240
263
  * Beneficiary types accepted: Person, Trust, Insured Estate, All Children Of The
241
264
  * Insured Equally, All Children Of The Marriage Equally. (Business / Corporation
242
265
  * / Charitable Organization / Employer / Other are NOT accepted by IB Term.)
@@ -256,38 +279,71 @@ export interface IBTermStartApplicationReq {
256
279
  isUsCitizenOrIsPermanentResident: boolean;
257
280
  /** Must be true to proceed — applicant must be both owner and insured. */
258
281
  isPayerAlsoOwnerAndInsured: boolean;
259
- /** ISO date; age must be 18–60. */
260
- dateOfBirth: string;
261
- /** Format: XXXXXXXXX (9 digits) or XXX-XX-XXXX — both formats accepted by IB Term. */
262
- socialSecurityNumber: string;
263
- address: IBTermAddress;
264
- birthJurisdiction: IBTermBirthJurisdiction;
282
+ /**
283
+ * Optional under the progressive disclosure model. ISO date; when sent, age must be 18–60.
284
+ * The applicant's age is already captured on the originating quote, so this is
285
+ * not re-required on Start Application. Validated by the backend only when present.
286
+ */
287
+ dateOfBirth?: string | null;
288
+ /**
289
+ * Optional under the progressive disclosure model. Format: XXXXXXXXX (9 digits) —
290
+ * dashed values are rejected. Validated by the backend only when present.
291
+ */
292
+ socialSecurityNumber?: string | null;
293
+ /**
294
+ * Optional under the progressive disclosure model. The state code captured on
295
+ * the quote already drives state-specific rules; this address block is for the
296
+ * final policy record. When sent, all sub-fields are validated.
297
+ */
298
+ address?: IBTermAddress | null;
299
+ /**
300
+ * Optional under the progressive disclosure model. When sent, all sub-fields
301
+ * are validated.
302
+ */
303
+ birthJurisdiction?: IBTermBirthJurisdiction | null;
265
304
  height: IBTermHeight;
266
305
  /** Positive. */
267
306
  weight: number;
268
307
  isHoldingValidDriverLicense: boolean;
269
308
  /**
270
- * 2-letter US state code. Required (non-null) when
271
- * `isHoldingValidDriverLicense === true`; must be `null` when `false`.
309
+ * 2-letter US state code. **Optional and independent of `isHoldingValidDriverLicense`** —
310
+ * validated only when sent. Omit or pass `null` when not collected.
272
311
  * Backend property: `DriverLicenseState` (top-level on `ThirdPartyIBTermAppReq`).
273
312
  */
274
- driverLicenseState: string | null;
313
+ driverLicenseState?: string | null;
275
314
  /**
276
- * Driver license number. Required (non-null) when
277
- * `isHoldingValidDriverLicense === true`; must be `null` when `false`.
315
+ * Driver license number. **Optional and independent of `isHoldingValidDriverLicense`** —
316
+ * validated only when sent (and only against `driverLicenseState` when both are present).
317
+ * Omit or pass `null` when not collected.
278
318
  * Backend property: `DriverLicenseNumber` (top-level on `ThirdPartyIBTermAppReq`).
279
319
  */
280
- driverLicenseNumber: string | null;
281
- hasPrimaryCarePhysician: boolean;
320
+ driverLicenseNumber?: string | null;
321
+ /**
322
+ * Optional under the progressive disclosure model. The whole
323
+ * `hasPrimaryCarePhysician` / `physicianDetails` pair may be omitted. When
324
+ * `hasPrimaryCarePhysician === true`, supply `physicianDetails`; when `false`,
325
+ * `physicianDetails` must be `null`. The physician-based knockout was removed
326
+ * — applicants aged 55+ without physician details are no longer declined.
327
+ */
328
+ hasPrimaryCarePhysician?: boolean | null;
282
329
  /**
283
330
  * Required when `hasPrimaryCarePhysician === true`. Must be `null` when
284
331
  * `hasPrimaryCarePhysician === false`.
285
332
  */
286
333
  physicianDetails?: IBTermPhysicianDetails | null;
287
- tobaccoNicotineUsage: IBTermTobaccoNicotineUsage;
334
+ /**
335
+ * Optional under the progressive disclosure model. IB Term uses this structured
336
+ * object — it is NOT a boolean `isSmoker` flag like ADB / GIGDB. When sent, all
337
+ * conditional sub-rules apply (see {@link IBTermTobaccoNicotineUsage}).
338
+ */
339
+ tobaccoNicotineUsage?: IBTermTobaccoNicotineUsage | null;
288
340
  /** Required boolean — applicant confirms none of the listed conditions apply. */
289
341
  areListedConditionsNotApplicable: boolean;
290
- hasExistingCoverage: boolean;
342
+ /**
343
+ * Optional under the progressive disclosure model. When sent, follow the
344
+ * `existingCoverageData` / `willOtherCoverageBeReplacedOrFinanced` rules below.
345
+ */
346
+ hasExistingCoverage?: boolean | null;
291
347
  /** Required when hasExistingCoverage === true */
292
348
  willOtherCoverageBeReplacedOrFinanced?: boolean;
293
349
  /** Required when hasExistingCoverage === true */
@@ -295,12 +351,12 @@ export interface IBTermStartApplicationReq {
295
351
  /** Required when address.state is "KS" or "WA" AND willOtherCoverageBeReplacedOrFinanced === true */
296
352
  willOtherCoverageBeReplacedOrFinancedData?: IBTermWillOtherCoverageBeReplacedOrFinancedData;
297
353
  /**
298
- * Beneficiary details. IB Term restricts `beneficiaryType` to:
299
- * `Person`, `Trust`, `Insured Estate`, `All Children Of The Insured Equally`,
300
- * `All Children Of The Marriage Equally`. The SDK uses the shared
301
- * `BeneficiaryDetails` union; restriction is enforced server-side.
354
+ * Optional under the progressive disclosure model. IB Term restricts
355
+ * `beneficiaryType` to: `Person`, `Trust`, `Insured Estate`,
356
+ * `All Children Of The Insured Equally`, `All Children Of The Marriage Equally`.
357
+ * The SDK uses the shared `BeneficiaryDetails` union; restriction is enforced server-side.
302
358
  */
303
- beneficiaryDetails: BeneficiaryDetails;
359
+ beneficiaryDetails?: BeneficiaryDetails | null;
304
360
  /**
305
361
  * Required when the Dependent Child Rider was selected on the originating
306
362
  * quote. Setting any of the four knockout questions to `true` declines
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instabrain-sdks/api-client",
3
- "version": "2.3.0",
3
+ "version": "2.3.2",
4
4
  "description": "Official Node.js SDK for InstaBrain APIs - Insurance quotes and application processing",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",