@instabrain-sdks/api-client 1.0.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +234 -17
  2. package/dist/client/instabrain-client.d.ts +73 -1
  3. package/dist/client/instabrain-client.d.ts.map +1 -1
  4. package/dist/client/instabrain-client.js +94 -0
  5. package/dist/client/instabrain-client.js.map +1 -1
  6. package/dist/index.d.ts +0 -4
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +1 -11
  9. package/dist/index.js.map +1 -1
  10. package/dist/services/application.service.d.ts +10 -2
  11. package/dist/services/application.service.d.ts.map +1 -1
  12. package/dist/services/application.service.js +36 -0
  13. package/dist/services/application.service.js.map +1 -1
  14. package/dist/services/auth.service.d.ts +1 -1
  15. package/dist/services/auth.service.d.ts.map +1 -1
  16. package/dist/services/auth.service.js.map +1 -1
  17. package/dist/services/gigdb.service.d.ts +44 -0
  18. package/dist/services/gigdb.service.d.ts.map +1 -0
  19. package/dist/services/gigdb.service.js +182 -0
  20. package/dist/services/gigdb.service.js.map +1 -0
  21. package/dist/services/quote.service.d.ts +1 -7
  22. package/dist/services/quote.service.d.ts.map +1 -1
  23. package/dist/services/quote.service.js +2 -33
  24. package/dist/services/quote.service.js.map +1 -1
  25. package/dist/services/reports.service.d.ts +1 -7
  26. package/dist/services/reports.service.d.ts.map +1 -1
  27. package/dist/services/reports.service.js +4 -41
  28. package/dist/services/reports.service.js.map +1 -1
  29. package/dist/services/secure-sign.service.d.ts +48 -0
  30. package/dist/services/secure-sign.service.d.ts.map +1 -0
  31. package/dist/services/secure-sign.service.js +161 -0
  32. package/dist/services/secure-sign.service.js.map +1 -0
  33. package/dist/types/application.types.d.ts +4 -0
  34. package/dist/types/application.types.d.ts.map +1 -1
  35. package/dist/types/enums.d.ts +23 -1
  36. package/dist/types/enums.d.ts.map +1 -1
  37. package/dist/types/enums.js +25 -0
  38. package/dist/types/enums.js.map +1 -1
  39. package/dist/types/errors.d.ts.map +1 -1
  40. package/dist/types/errors.js +26 -1
  41. package/dist/types/errors.js.map +1 -1
  42. package/dist/types/gigdb.types.d.ts +98 -0
  43. package/dist/types/gigdb.types.d.ts.map +1 -0
  44. package/dist/types/gigdb.types.js +3 -0
  45. package/dist/types/gigdb.types.js.map +1 -0
  46. package/dist/types/index.d.ts +3 -0
  47. package/dist/types/index.d.ts.map +1 -1
  48. package/dist/types/index.js +2 -0
  49. package/dist/types/index.js.map +1 -1
  50. package/dist/types/secure-sign.types.d.ts +82 -0
  51. package/dist/types/secure-sign.types.d.ts.map +1 -0
  52. package/dist/types/secure-sign.types.js +5 -0
  53. package/dist/types/secure-sign.types.js.map +1 -0
  54. package/dist/utils/error-utils.d.ts +13 -0
  55. package/dist/utils/error-utils.d.ts.map +1 -0
  56. package/dist/utils/error-utils.js +31 -0
  57. package/dist/utils/error-utils.js.map +1 -0
  58. package/package.json +54 -51
package/README.md CHANGED
@@ -14,14 +14,20 @@ npm install @instabrain-sdks/api-client
14
14
  ## Quick Start
15
15
 
16
16
  ```typescript
17
- import { InstaBrainClient,
18
- Gender,
19
- PaymentFrequency,
20
- RateClass,
21
- HealthClass,
22
- ThirdPartyQuoteReq,
17
+ import { InstaBrainClient,
18
+ Gender,
19
+ PaymentFrequency,
20
+ RateClass,
21
+ HealthClass,
22
+ ThirdPartyQuoteReq,
23
23
  ThirdPartyStartApplicationReq,
24
- AgentPortalReq }
24
+ ThirdPartyGigdbQuoteRequest,
25
+ ThirdPartyGigdbUpdateQuoteReq,
26
+ ThirdPartyGigdbAppReq,
27
+ ThirdPartyEftPaymentReq,
28
+ ThirdPartySendPinReq,
29
+ ThirdPartyVerifyPinReq,
30
+ AgentPortalReq }
25
31
  from '@instabrain-sdks/api-client';
26
32
 
27
33
  // Create a client instance
@@ -52,6 +58,38 @@ console.log(`Dashboard Summary:`);
52
58
  console.log(`- Prospects: ${prospects.prospectCount}`);
53
59
  console.log(`- Sales: ${sales.applicationCount} ($${sales.totalPremiumAmount})`);
54
60
  console.log(`- Applications: ${applications.applicationCount}`);
61
+
62
+ // GIGDB Product (Guaranteed Issue — ages 50-85, $5k-$25k)
63
+ const gigdbQuote = await client.getGigdbQuote(gigdbQuoteReq);
64
+ const gigdbApp = await client.startGigdbApplication(gigdbAppReq);
65
+ const eftPayment = await client.saveEftPayment(eftPaymentReq);
66
+
67
+ // Update GIGDB quote (change face amount or payment frequency)
68
+ const updatedQuote = await client.updateGigdbQuote({
69
+ opportunityId: gigdbApp.opportunityId,
70
+ faceAmount: 20000,
71
+ paymentFreq: PaymentFrequency.Annual
72
+ });
73
+
74
+ // Get existing GIGDB quote (when isQuoteChanged=true)
75
+ const existingQuote = await client.getExistingGigdbQuote(gigdbApp.opportunityId);
76
+
77
+ // Secure Sign flow (shared across all products)
78
+ const docs = await client.prepareDocsAndGetDeliveryChannels(gigdbApp.opportunityId);
79
+ if (!docs.isSignCompleted) {
80
+ const pin = await client.sendPinAndGetDocumentsLink({
81
+ opportunityId: gigdbApp.opportunityId,
82
+ flagSendSms: docs.isSmsAvailable,
83
+ flagSendEmail: docs.isEmailAvailable
84
+ });
85
+ await client.verifyPin({
86
+ opportunityId: gigdbApp.opportunityId,
87
+ pin: '123456',
88
+ isScriptReadConfirmed: true
89
+ });
90
+ }
91
+ const result = await client.finalSubmit(gigdbApp.opportunityId);
92
+ console.log('Policy Number:', result.policyNumber || 'pending');
55
93
  ```
56
94
 
57
95
  ## Features
@@ -62,6 +100,9 @@ console.log(`- Applications: ${applications.applicationCount}`);
62
100
  - ✅ **Error Handling** - Comprehensive error handling with custom error types
63
101
  - ✅ **Request Validation** - Built-in validation for API requests
64
102
  - ✅ **Comprehensive Testing** - Well-tested with Jest
103
+ - ✅ **GIGDB Product Support** - Guaranteed Issue quotes, applications, and EFT payments
104
+ - ✅ **GIGDB Quote Management** - Update quotes and get existing quotes for GIGDB opportunities
105
+ - ✅ **Secure Sign & Final Submit** - Document signing flow and carrier submission (shared across all products)
65
106
  - ✅ **Modern Promise API** - Uses async/await patterns
66
107
 
67
108
  ## API Reference
@@ -125,6 +166,176 @@ console.log('Agent Link:', application.agentLink);
125
166
  console.log('Applicant Link:', application.applicantLink);
126
167
  ```
127
168
 
169
+ ### GIGDB (Guaranteed Issue)
170
+
171
+ #### `getGigdbQuote(request: ThirdPartyGigdbQuoteRequest): Promise<ThirdPartyQuoteResp>`
172
+
173
+ Get a Guaranteed Issue quote (ages 50-85, face amount $5k-$25k).
174
+
175
+ ```typescript
176
+ const gigdbQuoteReq: ThirdPartyGigdbQuoteRequest = {
177
+ faceAmount: 15000,
178
+ gender: Gender.Female,
179
+ stateCode: 'TX',
180
+ age: 65,
181
+ dateOfBirth: '1961-01-15',
182
+ paymentFreq: PaymentFrequency.Monthly,
183
+ firstName: 'Jane',
184
+ lastName: 'Smith',
185
+ email: 'jane.smith@example.com',
186
+ phoneNum: '555-0123',
187
+ isSmoker: false
188
+ };
189
+ const quote = await client.getGigdbQuote(gigdbQuoteReq);
190
+ ```
191
+
192
+ #### `startGigdbApplication(request: ThirdPartyGigdbAppReq): Promise<ThirdPartyStartAppResp>`
193
+
194
+ Start a GIGDB application. Note: `isDeclined: true` is a valid response (knockout), not an error.
195
+
196
+ ```typescript
197
+ const gigdbAppReq: ThirdPartyGigdbAppReq = {
198
+ quoteResponseId: quote.selectedQuote.quoteResponseId,
199
+ firstName: 'Jane',
200
+ lastName: 'Smith',
201
+ email: 'jane.smith@example.com',
202
+ phoneNumber: '555-0123',
203
+ isUsCitizen: true,
204
+ isPayerAlsoOwnerAndInsured: true,
205
+ isSmoker: false,
206
+ dateOfBirth: '1961-01-15',
207
+ socialSecurityNumber: '123456789',
208
+ address: {
209
+ addressLine1: '123 Main St',
210
+ city: 'Dallas',
211
+ state: 'TX',
212
+ zipcode: '75001'
213
+ },
214
+ birthJurisdiction: {
215
+ country: 'US',
216
+ state: 'TX'
217
+ },
218
+ hasExistingCoverage: false,
219
+ existingCoverageData: null,
220
+ willOtherCoverageBeReplacedOrFinanced: null,
221
+ beneficiaryDetails: {
222
+ beneficiaryType: 'Person',
223
+ beneficiaryPerson: {
224
+ firstName: 'John',
225
+ lastName: 'Smith',
226
+ relationship: 'Spouse'
227
+ },
228
+ namedEntity: null
229
+ }
230
+ };
231
+ const app = await client.startGigdbApplication(gigdbAppReq);
232
+ console.log('Opportunity ID:', app.opportunityId);
233
+ console.log('Declined:', app.isDeclined);
234
+ ```
235
+
236
+ #### `saveEftPayment(request: ThirdPartyEftPaymentReq): Promise<boolean>`
237
+
238
+ Returns `true` when payment saved successfully.
239
+
240
+ ```typescript
241
+ const eftReq: ThirdPartyEftPaymentReq = {
242
+ opportunityId: app.opportunityId,
243
+ accountHolderName: 'Jane Smith',
244
+ routingNumber: '021000021',
245
+ accountNumber: '123456789'
246
+ };
247
+ const success = await client.saveEftPayment(eftReq);
248
+ console.log('Payment saved:', success);
249
+ ```
250
+
251
+ #### `updateGigdbQuote(request: ThirdPartyGigdbUpdateQuoteReq): Promise<ThirdPartyQuoteResp>`
252
+
253
+ Update a GIGDB quote with a different face amount or payment frequency.
254
+
255
+ ```typescript
256
+ const updateReq: ThirdPartyGigdbUpdateQuoteReq = {
257
+ opportunityId: app.opportunityId,
258
+ faceAmount: 20000,
259
+ paymentFreq: PaymentFrequency.Annual
260
+ };
261
+ const updatedQuote = await client.updateGigdbQuote(updateReq);
262
+ console.log('Updated face amount:', updatedQuote.selectedQuote.faceAmount);
263
+ ```
264
+
265
+ #### `getExistingGigdbQuote(opportunityId: string): Promise<ThirdPartyQuoteResp>`
266
+
267
+ Get the existing quote for a GIGDB opportunity. Use when `isQuoteChanged=true` after `startGigdbApplication`.
268
+
269
+ ```typescript
270
+ const existingQuote = await client.getExistingGigdbQuote(app.opportunityId);
271
+ console.log('Current quote:', existingQuote.selectedQuote.quoteAmount);
272
+ ```
273
+
274
+ ### Secure Sign (Document Signing)
275
+
276
+ The signing flow is shared across all products. Call after EFT payment has been saved.
277
+
278
+ #### `prepareDocsAndGetDeliveryChannels(opportunityId: string): Promise<ThirdPartyPrepareDocsResp>`
279
+
280
+ Prepare the signing package and check available delivery channels. If `isSignCompleted` is true, skip directly to `finalSubmit()`.
281
+
282
+ ```typescript
283
+ const docs = await client.prepareDocsAndGetDeliveryChannels(app.opportunityId);
284
+ console.log('SMS available:', docs.isSmsAvailable);
285
+ console.log('Already signed:', docs.isSignCompleted);
286
+ ```
287
+
288
+ #### `sendPinAndGetDocumentsLink(request: ThirdPartySendPinReq): Promise<ThirdPartySendPinResp>`
289
+
290
+ Send a verification PIN via SMS and/or Email and receive the documents link.
291
+
292
+ ```typescript
293
+ const pinResp = await client.sendPinAndGetDocumentsLink({
294
+ opportunityId: app.opportunityId,
295
+ flagSendSms: true,
296
+ flagSendEmail: true
297
+ });
298
+ console.log('Documents link:', pinResp.link);
299
+ console.log('Script to read:', pinResp.script);
300
+ ```
301
+
302
+ #### `resendPin(request: ThirdPartyResendPinReq): Promise<ThirdPartyResendPinResp>`
303
+
304
+ Resend the verification PIN if the signer did not receive it.
305
+
306
+ ```typescript
307
+ const resendResp = await client.resendPin({
308
+ opportunityId: app.opportunityId,
309
+ flagSendSms: true,
310
+ flagSendEmail: false
311
+ });
312
+ console.log('PIN resent:', resendResp.flagPinSent);
313
+ ```
314
+
315
+ #### `verifyPin(request: ThirdPartyVerifyPinReq): Promise<ThirdPartyVerifyPinResp>`
316
+
317
+ Verify the PIN entered by the signer to complete document signing.
318
+
319
+ ```typescript
320
+ const verifyResp = await client.verifyPin({
321
+ opportunityId: app.opportunityId,
322
+ pin: '123456',
323
+ isScriptReadConfirmed: true
324
+ });
325
+ console.log('Verified:', verifyResp.isVerified);
326
+ ```
327
+
328
+ ### Final Submit
329
+
330
+ #### `finalSubmit(opportunityId: string): Promise<ThirdPartyFinalSubmitResp>`
331
+
332
+ Submit the application to the carrier for a final underwriting decision. Call after the signing flow is complete. Note: `policyNumber: null` means the carrier has not yet issued a number (pending decision) — this is not an error.
333
+
334
+ ```typescript
335
+ const result = await client.finalSubmit(app.opportunityId);
336
+ console.log('Policy Number:', result.policyNumber || 'pending carrier decision');
337
+ ```
338
+
128
339
  ### Reports
129
340
 
130
341
  #### `getProspects(request?: AgentPortalReq): Promise<ThirdPartyProspectsResp>`
@@ -196,16 +407,25 @@ const sandboxClient = InstaBrainClient.forEnvironment('sandbox');
196
407
  The SDK provides specific error types for different scenarios:
197
408
 
198
409
  ```typescript
199
- import {
200
- InstaBrainError,
201
- AuthenticationError,
202
- ValidationError
203
- } from 'instabrain';
410
+ import {
411
+ InstaBrainError,
412
+ AuthenticationError,
413
+ ValidationError,
414
+ APIValidationError,
415
+ APIErrorCode
416
+ } from '@instabrain-sdks/api-client';
204
417
 
205
418
  try {
206
419
  await client.authenticate(userId, accessToken);
207
420
  } catch (error) {
208
- if (error instanceof AuthenticationError) {
421
+ if (error instanceof APIValidationError) {
422
+ // Business-logic error with a specific error code
423
+ console.error('API validation error:', error.errorCode);
424
+ console.error('Friendly message:', error.getUserFriendlyMessage());
425
+ if (error.isErrorType(APIErrorCode.SecureSignPinMismatch)) {
426
+ console.error('PIN did not match — please try again');
427
+ }
428
+ } else if (error instanceof AuthenticationError) {
209
429
  console.error('Authentication failed:', error.message);
210
430
  } else if (error instanceof ValidationError) {
211
431
  console.error('Validation error:', error.message);
@@ -280,12 +500,9 @@ const currentToken = client.getCurrentToken();
280
500
  client.logout();
281
501
  ```
282
502
 
283
- ### Base URL Management
503
+ ### Base URL
284
504
 
285
505
  ```typescript
286
- // Update base URL dynamically
287
- client.updateBaseUrl('https://api-staging.instabrain.io');
288
-
289
506
  // Get current base URL
290
507
  const currentUrl = client.getBaseUrl();
291
508
  ```
@@ -2,7 +2,9 @@ import { AuthService } from '../services/auth.service';
2
2
  import { QuoteService } from '../services/quote.service';
3
3
  import { ApplicationService } from '../services/application.service';
4
4
  import { ReportsService } from '../services/reports.service';
5
- import { InstaBrainConfig, Environment, ThirdPartyQuoteReq, ThirdPartyQuoteResp, ThirdPartyStartApplicationReq, ThirdPartyStartAppResp, AgentPortalReq, ThirdPartyProspectsResp, ThirdPartySalesReportRes, ThirdPartyApplicationReportRes } from '../types';
5
+ import { GigdbService } from '../services/gigdb.service';
6
+ import { SecureSignService } from '../services/secure-sign.service';
7
+ import { InstaBrainConfig, Environment, ThirdPartyQuoteReq, ThirdPartyQuoteResp, ThirdPartyStartApplicationReq, ThirdPartyStartAppResp, AgentPortalReq, ThirdPartyProspectsResp, ThirdPartySalesReportRes, ThirdPartyApplicationReportRes, ThirdPartyGigdbQuoteRequest, ThirdPartyGigdbUpdateQuoteReq, ThirdPartyGigdbAppReq, ThirdPartyEftPaymentReq, ThirdPartySendPinReq, ThirdPartyResendPinReq, ThirdPartyVerifyPinReq, ThirdPartyPrepareDocsResp, ThirdPartySendPinResp, ThirdPartyResendPinResp, ThirdPartyVerifyPinResp, ThirdPartyFinalSubmitResp } from '../types';
6
8
  /**
7
9
  * Main InstaBrain SDK client
8
10
  */
@@ -12,6 +14,8 @@ export declare class InstaBrainClient {
12
14
  readonly quote: QuoteService;
13
15
  readonly application: ApplicationService;
14
16
  readonly reports: ReportsService;
17
+ readonly gigdb: GigdbService;
18
+ readonly secureSign: SecureSignService;
15
19
  constructor(config?: InstaBrainConfig);
16
20
  /**
17
21
  * Configure the client for different environments
@@ -55,6 +59,74 @@ export declare class InstaBrainClient {
55
59
  * @returns Promise with applications data including status and completion info
56
60
  */
57
61
  getApplications(request: AgentPortalReq): Promise<ThirdPartyApplicationReportRes>;
62
+ /**
63
+ * Get a GIGDB insurance quote (ages 50-85, $5k-$25k)
64
+ * @param request - The GIGDB quote request parameters
65
+ * @returns Promise with the quote response
66
+ */
67
+ getGigdbQuote(request: ThirdPartyGigdbQuoteRequest): Promise<ThirdPartyQuoteResp>;
68
+ /**
69
+ * Start a GIGDB application from a quote
70
+ * Note: isDeclined=true is a valid success response (knockout), not an error
71
+ * @param request - The GIGDB application request parameters
72
+ * @returns Promise with the application response
73
+ */
74
+ startGigdbApplication(request: ThirdPartyGigdbAppReq): Promise<ThirdPartyStartAppResp>;
75
+ /**
76
+ * Save EFT payment details for a GIGDB application
77
+ * @param request - The EFT payment request with account details
78
+ * @returns Promise with payment validation response
79
+ */
80
+ saveEftPayment(request: ThirdPartyEftPaymentReq): Promise<boolean>;
81
+ /**
82
+ * Update a GIGDB quote with a different face amount or payment frequency
83
+ * Use after application has been started to re-quote for the same opportunity
84
+ * @param request - The update quote request with opportunityId, faceAmount, and paymentFreq
85
+ * @returns Promise with the updated quote response
86
+ */
87
+ updateGigdbQuote(request: ThirdPartyGigdbUpdateQuoteReq): Promise<ThirdPartyQuoteResp>;
88
+ /**
89
+ * Get the existing quote for a GIGDB opportunity
90
+ * Use when startGigdbApplication returns isQuoteChanged=true to get the updated quote
91
+ * @param opportunityId - The OpportunityId from the Start Application response
92
+ * @returns Promise with the current quote response
93
+ */
94
+ getExistingGigdbQuote(opportunityId: string): Promise<ThirdPartyQuoteResp>;
95
+ /**
96
+ * Prepare the signing package and check available delivery channels
97
+ * Always call this first in the signing flow. If isSignCompleted is true, skip to finalSubmit().
98
+ * @param opportunityId - The OpportunityId from the Start Application response
99
+ * @returns Promise with delivery channels and sign completion status
100
+ */
101
+ prepareDocsAndGetDeliveryChannels(opportunityId: string): Promise<ThirdPartyPrepareDocsResp>;
102
+ /**
103
+ * Send a verification PIN via SMS and/or Email and receive the documents link
104
+ * At least one of flagSendSms or flagSendEmail must be true.
105
+ * @param request - The send PIN request with delivery preferences
106
+ * @returns Promise with documents link and disclosure script
107
+ */
108
+ sendPinAndGetDocumentsLink(request: ThirdPartySendPinReq): Promise<ThirdPartySendPinResp>;
109
+ /**
110
+ * Resend the verification PIN if the signer did not receive it
111
+ * @param request - The resend PIN request with delivery preferences
112
+ * @returns Promise with PIN sent confirmation
113
+ */
114
+ resendPin(request: ThirdPartyResendPinReq): Promise<ThirdPartyResendPinResp>;
115
+ /**
116
+ * Verify the PIN entered by the signer to complete document signing
117
+ * The disclosure script must have been read aloud before calling this.
118
+ * @param request - The verify PIN request with PIN and script confirmation
119
+ * @returns Promise with verification result
120
+ */
121
+ verifyPin(request: ThirdPartyVerifyPinReq): Promise<ThirdPartyVerifyPinResp>;
122
+ /**
123
+ * Submit the application to the carrier for a final underwriting decision
124
+ * Call after the signing flow is complete or when isSignCompleted is true.
125
+ * Note: A null policyNumber means the carrier has not yet issued a number (pending decision) — not an error.
126
+ * @param opportunityId - The OpportunityId from the Start Application response
127
+ * @returns Promise with the final submit response containing policyNumber
128
+ */
129
+ finalSubmit(opportunityId: string): Promise<ThirdPartyFinalSubmitResp>;
58
130
  /**
59
131
  * Check if the client is authenticated
60
132
  * @returns boolean indicating authentication status
@@ -1 +1 @@
1
- {"version":3,"file":"instabrain-client.d.ts","sourceRoot":"","sources":["../../src/client/instabrain-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,6BAA6B,EAC7B,sBAAsB,EACtB,cAAc,EACd,uBAAuB,EACvB,wBAAwB,EACxB,8BAA8B,EAC/B,MAAM,UAAU,CAAC;AAElB;;GAEG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,UAAU,CAAa;IAC/B,SAAgB,IAAI,EAAE,WAAW,CAAC;IAClC,SAAgB,KAAK,EAAE,YAAY,CAAC;IACpC,SAAgB,WAAW,EAAE,kBAAkB,CAAC;IAChD,SAAgB,OAAO,EAAE,cAAc,CAAC;gBAE5B,MAAM,GAAE,gBAAqB;IAQzC;;;OAGG;IACH,MAAM,CAAC,cAAc,CAAC,WAAW,EAAE,WAAW,GAAG,gBAAgB;IAUjE;;;;;OAKG;IACG,YAAY,C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,EAAE,2BAA2B,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAIvF;;;;;OAKG;IACG,qBAAqB,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAI5F;;;;OAIG;IACG,cAAc,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,OAAO,CAAC;IAIxE;;;;;OAKG;IACG,gBAAgB,CAAC,OAAO,EAAE,6BAA6B,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAI5F;;;;;OAKG;IACG,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAMhF;;;;;OAKG;IACG,iCAAiC,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAIlG;;;;;OAKG;IACG,0BAA0B,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAI/F;;;;OAIG;IACG,SAAS,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAIlF;;;;;OAKG;IACG,SAAS,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAMlF;;;;;;OAMG;IACG,WAAW,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAI5E;;;OAGG;IACH,eAAe,IAAI,OAAO;IAI1B;;;OAGG;IACH,eAAe,IAAI,MAAM,GAAG,IAAI;IAIhC;;OAEG;IACH,MAAM,IAAI,IAAI;IAId;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI7B;;;OAGG;IACH,UAAU,IAAI,MAAM;CAGrB"}
@@ -6,6 +6,8 @@ const auth_service_1 = require("../services/auth.service");
6
6
  const quote_service_1 = require("../services/quote.service");
7
7
  const application_service_1 = require("../services/application.service");
8
8
  const reports_service_1 = require("../services/reports.service");
9
+ const gigdb_service_1 = require("../services/gigdb.service");
10
+ const secure_sign_service_1 = require("../services/secure-sign.service");
9
11
  /**
10
12
  * Main InstaBrain SDK client
11
13
  */
@@ -16,6 +18,8 @@ class InstaBrainClient {
16
18
  this.quote = new quote_service_1.QuoteService(this.httpClient);
17
19
  this.application = new application_service_1.ApplicationService(this.httpClient);
18
20
  this.reports = new reports_service_1.ReportsService(this.httpClient);
21
+ this.gigdb = new gigdb_service_1.GigdbService(this.httpClient);
22
+ this.secureSign = new secure_sign_service_1.SecureSignService(this.httpClient);
19
23
  }
20
24
  /**
21
25
  * Configure the client for different environments
@@ -78,6 +82,96 @@ class InstaBrainClient {
78
82
  async getApplications(request) {
79
83
  return this.reports.getApplications(request);
80
84
  }
85
+ /**
86
+ * Get a GIGDB insurance quote (ages 50-85, $5k-$25k)
87
+ * @param request - The GIGDB quote request parameters
88
+ * @returns Promise with the quote response
89
+ */
90
+ async getGigdbQuote(request) {
91
+ return this.gigdb.getQuote(request);
92
+ }
93
+ /**
94
+ * Start a GIGDB application from a quote
95
+ * Note: isDeclined=true is a valid success response (knockout), not an error
96
+ * @param request - The GIGDB application request parameters
97
+ * @returns Promise with the application response
98
+ */
99
+ async startGigdbApplication(request) {
100
+ return this.gigdb.startApplication(request);
101
+ }
102
+ /**
103
+ * Save EFT payment details for a GIGDB application
104
+ * @param request - The EFT payment request with account details
105
+ * @returns Promise with payment validation response
106
+ */
107
+ async saveEftPayment(request) {
108
+ return this.gigdb.saveEftPayment(request);
109
+ }
110
+ /**
111
+ * Update a GIGDB quote with a different face amount or payment frequency
112
+ * Use after application has been started to re-quote for the same opportunity
113
+ * @param request - The update quote request with opportunityId, faceAmount, and paymentFreq
114
+ * @returns Promise with the updated quote response
115
+ */
116
+ async updateGigdbQuote(request) {
117
+ return this.gigdb.updateQuote(request);
118
+ }
119
+ /**
120
+ * Get the existing quote for a GIGDB opportunity
121
+ * Use when startGigdbApplication returns isQuoteChanged=true to get the updated quote
122
+ * @param opportunityId - The OpportunityId from the Start Application response
123
+ * @returns Promise with the current quote response
124
+ */
125
+ async getExistingGigdbQuote(opportunityId) {
126
+ return this.gigdb.getExistingQuote(opportunityId);
127
+ }
128
+ // ── Secure Sign Methods ─────────────────────────────────────────────
129
+ /**
130
+ * Prepare the signing package and check available delivery channels
131
+ * Always call this first in the signing flow. If isSignCompleted is true, skip to finalSubmit().
132
+ * @param opportunityId - The OpportunityId from the Start Application response
133
+ * @returns Promise with delivery channels and sign completion status
134
+ */
135
+ async prepareDocsAndGetDeliveryChannels(opportunityId) {
136
+ return this.secureSign.prepareDocsAndGetDeliveryChannels(opportunityId);
137
+ }
138
+ /**
139
+ * Send a verification PIN via SMS and/or Email and receive the documents link
140
+ * At least one of flagSendSms or flagSendEmail must be true.
141
+ * @param request - The send PIN request with delivery preferences
142
+ * @returns Promise with documents link and disclosure script
143
+ */
144
+ async sendPinAndGetDocumentsLink(request) {
145
+ return this.secureSign.sendPinAndGetDocumentsLink(request);
146
+ }
147
+ /**
148
+ * Resend the verification PIN if the signer did not receive it
149
+ * @param request - The resend PIN request with delivery preferences
150
+ * @returns Promise with PIN sent confirmation
151
+ */
152
+ async resendPin(request) {
153
+ return this.secureSign.resendPin(request);
154
+ }
155
+ /**
156
+ * Verify the PIN entered by the signer to complete document signing
157
+ * The disclosure script must have been read aloud before calling this.
158
+ * @param request - The verify PIN request with PIN and script confirmation
159
+ * @returns Promise with verification result
160
+ */
161
+ async verifyPin(request) {
162
+ return this.secureSign.verifyPin(request);
163
+ }
164
+ // ── Final Submit ───────────────────────────────────────────────────
165
+ /**
166
+ * Submit the application to the carrier for a final underwriting decision
167
+ * Call after the signing flow is complete or when isSignCompleted is true.
168
+ * Note: A null policyNumber means the carrier has not yet issued a number (pending decision) — not an error.
169
+ * @param opportunityId - The OpportunityId from the Start Application response
170
+ * @returns Promise with the final submit response containing policyNumber
171
+ */
172
+ async finalSubmit(opportunityId) {
173
+ return this.application.finalSubmit(opportunityId);
174
+ }
81
175
  /**
82
176
  * Check if the client is authenticated
83
177
  * @returns boolean indicating authentication status
@@ -1 +1 @@
1
- {"version":3,"file":"instabrain-client.js","sourceRoot":"","sources":["../../src/client/instabrain-client.ts"],"names":[],"mappings":";;;AAAA,sDAAkD;AAClD,2DAAuD;AACvD,6DAAyD;AACzD,yEAAqE;AACrE,iEAA6D;AAc7D;;GAEG;AACH,MAAa,gBAAgB;IAO3B,YAAY,SAA2B,EAAE;QACvC,IAAI,CAAC,UAAU,GAAG,IAAI,wBAAU,CAAC,MAAM,CAAC,CAAC;QACzC,IAAI,CAAC,IAAI,GAAG,IAAI,0BAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC7C,IAAI,CAAC,KAAK,GAAG,IAAI,4BAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC/C,IAAI,CAAC,WAAW,GAAG,IAAI,wCAAkB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3D,IAAI,CAAC,OAAO,GAAG,IAAI,gCAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACrD,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,cAAc,CAAC,WAAwB;QAC5C,MAAM,UAAU,GAAG;YACjB,UAAU,EAAE,EAAE,OAAO,EAAE,2BAA2B,EAAE;YACpD,OAAO,EAAE,EAAE,OAAO,EAAE,kCAAkC,EAAE;SACzD,CAAC;QAEF,MAAM,MAAM,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;QACvC,OAAO,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,YAAY,CAAC,MAAc,EAAE,WAAmB;QACpD,OAAO,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACrD,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,QAAQ,CAAC,YAAgC;QAC7C,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;IAC3C,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,gBAAgB,CAAC,kBAAiD;QACtE,OAAO,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;IAC/D,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,YAAY,CAAC,OAAuB;QACxC,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,QAAQ,CAAC,OAAuB;QACpC,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,eAAe,CAAC,OAAuB;QAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IAC/C,CAAC;IAED;;;OAGG;IACH,eAAe;QACb,OAAO,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;IACrC,CAAC;IAED;;;OAGG;IACH,eAAe;QACb,OAAO,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,MAAM;QACJ,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;IACrB,CAAC;IAED;;;OAGG;IACH,QAAQ,CAAC,KAAa;QACpB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACH,UAAU;QACR,OAAO,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;IACtC,CAAC;CACF;AA1HD,4CA0HC"}
1
+ {"version":3,"file":"instabrain-client.js","sourceRoot":"","sources":["../../src/client/instabrain-client.ts"],"names":[],"mappings":";;;AAAA,sDAAkD;AAClD,2DAAuD;AACvD,6DAAyD;AACzD,yEAAqE;AACrE,iEAA6D;AAC7D,6DAAyD;AACzD,yEAAoE;AA0BpE;;GAEG;AACH,MAAa,gBAAg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IAAI,CAAC,UAAU,CAAC,iCAAiC,CAAC,aAAa,CAAC,CAAC;IAC1E,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,0BAA0B,CAAC,OAA6B;QAC5D,OAAO,IAAI,CAAC,UAAU,CAAC,0BAA0B,CAAC,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,SAAS,CAAC,OAA+B;QAC7C,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,SAAS,CAAC,OAA+B;QAC7C,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;IAED,sEAAsE;IAEtE;;;;;;OAMG;IACH,KAAK,CAAC,WAAW,CAAC,aAAqB;QACrC,OAAO,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;IACrD,CAAC;IAED;;;OAGG;IACH,eAAe;QACb,OAAO,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;IACrC,CAAC;IAED;;;OAGG;IACH,eAAe;QACb,OAAO,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,MAAM;QACJ,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;IACrB,CAAC;IAED;;;OAGG;IACH,QAAQ,CAAC,KAAa;QACpB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACH,UAAU;QACR,OAAO,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;IACtC,CAAC;CACF;AApOD,4CAoOC"}
package/dist/index.d.ts CHANGED
@@ -1,8 +1,4 @@
1
1
  export { InstaBrainClient } from './client/instabrain-client';
2
- export { AuthService } from './services/auth.service';
3
- export { QuoteService } from './services/quote.service';
4
- export { ApplicationService } from './services/application.service';
5
2
  export * from './types';
6
- export { HttpClient } from './utils/http-client';
7
3
  export { InstaBrainClient as default } from './client/instabrain-client';
8
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAG9D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGpE,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGjD,OAAO,EAAE,gBAAgB,IAAI,OAAO,EAAE,MAAM,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAG9D,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAE,gBAAgB,IAAI,OAAO,EAAE,MAAM,4BAA4B,CAAC"}
package/dist/index.js CHANGED
@@ -14,22 +14,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.default = exports.HttpClient = exports.ApplicationService = exports.QuoteService = exports.AuthService = exports.InstaBrainClient = void 0;
17
+ exports.default = exports.InstaBrainClient = void 0;
18
18
  // Main exports
19
19
  var instabrain_client_1 = require("./client/instabrain-client");
20
20
  Object.defineProperty(exports, "InstaBrainClient", { enumerable: true, get: function () { return instabrain_client_1.InstaBrainClient; } });
21
- // Service exports
22
- var auth_service_1 = require("./services/auth.service");
23
- Object.defineProperty(exports, "AuthService", { enumerable: true, get: function () { return auth_service_1.AuthService; } });
24
- var quote_service_1 = require("./services/quote.service");
25
- Object.defineProperty(exports, "QuoteService", { enumerable: true, get: function () { return quote_service_1.QuoteService; } });
26
- var application_service_1 = require("./services/application.service");
27
- Object.defineProperty(exports, "ApplicationService", { enumerable: true, get: function () { return application_service_1.ApplicationService; } });
28
21
  // Type exports
29
22
  __exportStar(require("./types"), exports);
30
- // Utility exports
31
- var http_client_1 = require("./utils/http-client");
32
- Object.defineProperty(exports, "HttpClient", { enumerable: true, get: function () { return http_client_1.HttpClient; } });
33
23
  // Default export
34
24
  var instabrain_client_2 = require("./client/instabrain-client");
35
25
  Object.defineProperty(exports, "default", { enumerable: true, get: function () { return instabrain_client_2.InstaBrainClient; } });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,eAAe;AACf,gEAA8D;AAArD,qHAAA,gBAAgB,OAAA;AAEzB,kBAAkB;AAClB,wDAAsD;AAA7C,2GAAA,WAAW,OAAA;AACpB,0DAAwD;AAA/C,6GAAA,YAAY,OAAA;AACrB,sEAAoE;AAA3D,yHAAA,kBAAkB,OAAA;AAE3B,eAAe;AACf,0CAAwB;AAExB,kBAAkB;AAClB,mDAAiD;AAAxC,yGAAA,UAAU,OAAA;AAEnB,iBAAiB;AACjB,gEAAyE;AAAhE,4GAAA,gBAAgB,OAAW"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,eAAe;AACf,gEAA8D;AAArD,qHAAA,gBAAgB,OAAA;AAEzB,eAAe;AACf,0CAAwB;AAExB,iBAAiB;AACjB,gEAAyE;AAAhE,4GAAA,gBAAgB,OAAW"}
@@ -1,10 +1,10 @@
1
1
  import { HttpClient } from '../utils/http-client';
2
- import { ThirdPartyStartApplicationReq, ThirdPartyStartAppResp } from '../types';
2
+ import { ThirdPartyStartApplicationReq, ThirdPartyStartAppResp, ThirdPartyFinalSubmitResp } from '../types';
3
3
  /**
4
4
  * Application service for starting insurance applications from quotes
5
5
  */
6
6
  export declare class ApplicationService {
7
- private httpClient;
7
+ private readonly httpClient;
8
8
  constructor(httpClient: HttpClient);
9
9
  /**
10
10
  * Start an insurance application based on a quote response ID
@@ -12,5 +12,13 @@ export declare class ApplicationService {
12
12
  * @returns Promise with the application response containing links
13
13
  */
14
14
  startApplication(applicationRequest: ThirdPartyStartApplicationReq): Promise<ThirdPartyStartAppResp>;
15
+ /**
16
+ * Submit the application to the carrier for a final underwriting decision
17
+ * Shared across all products. Call after the signing flow is complete.
18
+ * Note: A null policyNumber does not indicate failure — it means the carrier has not yet issued a number (pending decision).
19
+ * @param opportunityId - The OpportunityId from the Start Application response
20
+ * @returns Promise with the final submit response containing policyNumber
21
+ */
22
+ finalSubmit(opportunityId: string): Promise<ThirdPartyFinalSubmitResp>;
15
23
  }
16
24
  //# sourceMappingURL=application.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"application.service.d.ts","sourceRoot":"","sources":["../../src/services/application.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EACL,6BAA6B,EAC7B,sBAAsB,EAIvB,MAAM,UAAU,CAAC;AAElB;;GAEG;AACH,qBAAa,kBAAkB;IACjB,OAAO,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAE1C;;;;OAIG;IACG,gBAAgB,CAAC,kBAAkB,EAAE,6BAA6B,GAAG,OAAO,CAAC,sBAAsB,CAAC;CA6B3G"}
1
+ {"version":3,"file":"application.service.d.ts","sourceRoot":"","sources":["../../src/services/application.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EACL,6BAA6B,EAC7B,sBAAsB,EACtB,yBAAyB,EAK1B,MAAM,UAAU,CAAC;AAElB;;GAEG;AACH,qBAAa,kBAAkB;IACjB,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAEnD;;;;OAIG;IACG,gBAAgB,CAAC,kBAAkB,EAAE,6BAA6B,GAAG,OAAO,CAAC,sBAAsB,CAAC;IA8B1G;;;;;;OAMG;IACG,WAAW,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC;CAmC7E"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ApplicationService = void 0;
4
+ const error_utils_1 = require("../utils/error-utils");
4
5
  const types_1 = require("../types");
5
6
  /**
6
7
  * Application service for starting insurance applications from quotes
@@ -37,6 +38,41 @@ class ApplicationService {
37
38
  throw new types_1.InstaBrainError('Failed to start application: ' + error.message);
38
39
  }
39
40
  }
41
+ /**
42
+ * Submit the application to the carrier for a final underwriting decision
43
+ * Shared across all products. Call after the signing flow is complete.
44
+ * Note: A null policyNumber does not indicate failure — it means the carrier has not yet issued a number (pending decision).
45
+ * @param opportunityId - The OpportunityId from the Start Application response
46
+ * @returns Promise with the final submit response containing policyNumber
47
+ */
48
+ async finalSubmit(opportunityId) {
49
+ if (!this.httpClient.isAuthenticated()) {
50
+ throw new types_1.AuthenticationError('Must be authenticated to submit application. Call authenticate() first.');
51
+ }
52
+ try {
53
+ const response = await this.httpClient.post('/api/ThirdPartyApplication/final-submit', null, { params: { opportunityId } });
54
+ if (!response.flagStatus) {
55
+ const errorMessage = response.error || 'Failed to submit application';
56
+ const errorCode = (0, error_utils_1.extractErrorCode)(response);
57
+ if (errorCode) {
58
+ throw new types_1.APIValidationError(errorMessage, errorCode, response);
59
+ }
60
+ else {
61
+ throw new types_1.InstaBrainError(errorMessage, 400, response);
62
+ }
63
+ }
64
+ if (!response.value) {
65
+ throw new types_1.InstaBrainError('No final submit data received from server');
66
+ }
67
+ return response.value;
68
+ }
69
+ catch (error) {
70
+ if (error instanceof types_1.InstaBrainError) {
71
+ throw error;
72
+ }
73
+ throw new types_1.InstaBrainError('Failed to submit application: ' + error.message);
74
+ }
75
+ }
40
76
  }
41
77
  exports.ApplicationService = ApplicationService;
42
78
  //# sourceMappingURL=application.service.js.map