@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
@@ -1 +1 @@
1
- {"version":3,"file":"application.service.js","sourceRoot":"","sources":["../../src/services/application.service.ts"],"names":[],"mappings":";;;AACA,oCAMkB;AAElB;;GAEG;AACH,MAAa,kBAAkB;IAC7B,YAAoB,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAG,CAAC;IAE9C;;;;OAIG;IACH,KAAK,CAAC,gBAAgB,CAAC,kBAAiD;QACtE,yBAAyB;QACzB,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,eAAe,EAAE,EAAE,CAAC;YACvC,MAAM,IAAI,2BAAmB,CAAC,yEAAyE,CAAC,CAAC;QAC3G,CAAC;QAED,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CACzC,iDAAiD,EACjD,kBAAkB,CACnB,CAAC;YAEF,uCAAuC;YACvC,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;gBACzB,MAAM,IAAI,uBAAe,CAAC,QAAQ,CAAC,KAAK,IAAI,6BAA6B,CAAC,CAAC;YAC7E,CAAC;YAED,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;gBACpB,MAAM,IAAI,uBAAe,CAAC,0CAA0C,CAAC,CAAC;YACxE,CAAC;YAED,OAAO,QAAQ,CAAC,KAAK,CAAC;QACxB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,uBAAe,EAAE,CAAC;gBACrC,MAAM,KAAK,CAAC;YACd,CAAC;YACD,MAAM,IAAI,uBAAe,CAAC,+BAA+B,GAAI,KAAe,CAAC,OAAO,CAAC,CAAC;QACxF,CAAC;IACH,CAAC;CACF;AArCD,gDAqCC"}
1
+ {"version":3,"file":"application.service.js","sourceRoot":"","sources":["../../src/services/application.service.ts"],"names":[],"mappings":";;;AACA,sDAAwD;AACxD,oCAQkB;AAElB;;GAEG;AACH,MAAa,kBAAkB;IAC7B,YAA6B,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAG,CAAC;IAEvD;;;;OAIG;IACH,KAAK,CAAC,gBAAgB,CAAC,kBAAiD;QACtE,yBAAyB;QACzB,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,eAAe,EAAE,EAAE,CAAC;YACvC,MAAM,IAAI,2BAAmB,CAAC,yEAAyE,CAAC,CAAC;QAC3G,CAAC;QAED,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CACzC,iDAAiD,EACjD,kBAAkB,CACnB,CAAC;YAEF,uCAAuC;YACvC,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;gBACzB,MAAM,IAAI,uBAAe,CAAC,QAAQ,CAAC,KAAK,IAAI,6BAA6B,CAAC,CAAC;YAC7E,CAAC;YAED,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;gBACpB,MAAM,IAAI,uBAAe,CAAC,0CAA0C,CAAC,CAAC;YACxE,CAAC;YAED,OAAO,QAAQ,CAAC,KAA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AM,KAAK,CAAC;YACd,CAAC;YACD,MAAM,IAAI,uBAAe,CAAC,gCAAgC,GAAI,KAAe,CAAC,OAAO,CAAC,CAAC;QACzF,CAAC;IACH,CAAC;CACF;AAhFD,gDAgFC"}
@@ -3,7 +3,7 @@ import { HttpClient } from '../utils/http-client';
3
3
  * Authentication service for managing JWT tokens and authorization
4
4
  */
5
5
  export declare class AuthService {
6
- private httpClient;
6
+ private readonly httpClient;
7
7
  constructor(httpClient: HttpClient);
8
8
  /**
9
9
  * Authenticate with the InstaBrain API and obtain a JWT token
@@ -1 +1 @@
1
- {"version":3,"file":"auth.service.d.ts","sourceRoot":"","sources":["../../src/services/auth.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAQlD;;GAEG;AACH,qBAAa,WAAW;IACV,OAAO,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAE1C;;;;;OAKG;IACG,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAmCxE;;;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;CAG9B"}
1
+ {"version":3,"file":"auth.service.d.ts","sourceRoot":"","sources":["../../src/services/auth.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAQlD;;GAEG;AACH,qBAAa,WAAW;IACV,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAEnD;;;;;OAKG;IACG,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAmCxE;;;OAGG;IACH,eAAe,IAAI,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AC,UAAU,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;YACtC,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;YAExD,OAAO,QAAQ,CAAC;QAClB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,qDAAqD;YACrD,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YAClC,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,eAAe;QACb,OAAO,IAAI,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC;IAC3C,CAAC;IAED;;;OAGG;IACH,eAAe;QACb,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;IACvC,CAAC;IAED;;OAEG;IACH,MAAM;QACJ,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IAED;;;OAGG;IACH,QAAQ,CAAC,KAAa;QACpB,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;CACF;AA1ED,kCA0EC"}
@@ -0,0 +1,44 @@
1
+ import { HttpClient } from '../utils/http-client';
2
+ import { ThirdPartyGigdbQuoteRequest, ThirdPartyGigdbUpdateQuoteReq, ThirdPartyGigdbAppReq, ThirdPartyEftPaymentReq, ThirdPartyQuoteResp, ThirdPartyStartAppResp } from '../types';
3
+ /**
4
+ * GIGDB (Guaranteed Issue Group Decreasing Benefit) service
5
+ * Handles quote, application, and EFT payment for the GIGDB product (ages 50-85, $5k-$25k)
6
+ */
7
+ export declare class GigdbService {
8
+ private readonly httpClient;
9
+ constructor(httpClient: HttpClient);
10
+ /**
11
+ * Get a GIGDB insurance quote
12
+ * @param request - The GIGDB quote request parameters
13
+ * @returns Promise with the quote response
14
+ */
15
+ getQuote(request: ThirdPartyGigdbQuoteRequest): Promise<ThirdPartyQuoteResp>;
16
+ /**
17
+ * Start a GIGDB application from a quote
18
+ * Note: isDeclined=true is a valid success response (knockout), not an error
19
+ * @param request - The GIGDB application request parameters
20
+ * @returns Promise with the application response
21
+ */
22
+ startApplication(request: ThirdPartyGigdbAppReq): Promise<ThirdPartyStartAppResp>;
23
+ /**
24
+ * Save EFT payment details for a GIGDB application
25
+ * @param request - The EFT payment request with account details
26
+ * @returns Promise with payment validation response
27
+ */
28
+ saveEftPayment(request: ThirdPartyEftPaymentReq): Promise<boolean>;
29
+ /**
30
+ * Update a GIGDB quote with a different face amount or payment frequency
31
+ * Use after application has been started to re-quote for the same opportunity
32
+ * @param request - The update quote request with opportunityId, faceAmount, and paymentFreq
33
+ * @returns Promise with the updated quote response
34
+ */
35
+ updateQuote(request: ThirdPartyGigdbUpdateQuoteReq): Promise<ThirdPartyQuoteResp>;
36
+ /**
37
+ * Get the existing quote for a GIGDB opportunity
38
+ * Use when startApplication returns isQuoteChanged=true to get the updated quote
39
+ * @param opportunityId - The OpportunityId from the Start Application response
40
+ * @returns Promise with the current quote response
41
+ */
42
+ getExistingQuote(opportunityId: string): Promise<ThirdPartyQuoteResp>;
43
+ }
44
+ //# sourceMappingURL=gigdb.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gigdb.service.d.ts","sourceRoot":"","sources":["../../src/services/gigdb.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EACL,2BAA2B,EAC3B,6BAA6B,EAC7B,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,EACnB,sBAAsB,EAKvB,MAAM,UAAU,CAAC;AAElB;;;GAGG;AACH,qBAAa,YAAY;IACX,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAEnD;;;;OAIG;IACG,QAAQ,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAmClF;;;;;OAKG;IACG,gBAAgB,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAmCvF;;;;OAIG;IACG,cAAc,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,OAAO,CAAC;IA+BxE;;;;;OAKG;IACG,WAAW,CAAC,OAAO,EAAE,6BAA6B,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAmCvF;;;;;OAKG;IACG,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAmC5E"}
@@ -0,0 +1,182 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GigdbService = void 0;
4
+ const error_utils_1 = require("../utils/error-utils");
5
+ const types_1 = require("../types");
6
+ /**
7
+ * GIGDB (Guaranteed Issue Group Decreasing Benefit) service
8
+ * Handles quote, application, and EFT payment for the GIGDB product (ages 50-85, $5k-$25k)
9
+ */
10
+ class GigdbService {
11
+ constructor(httpClient) {
12
+ this.httpClient = httpClient;
13
+ }
14
+ /**
15
+ * Get a GIGDB insurance quote
16
+ * @param request - The GIGDB quote request parameters
17
+ * @returns Promise with the quote response
18
+ */
19
+ async getQuote(request) {
20
+ if (!this.httpClient.isAuthenticated()) {
21
+ throw new types_1.AuthenticationError('Must be authenticated to get GIGDB quote. Call authenticate() first.');
22
+ }
23
+ try {
24
+ const response = await this.httpClient.post('/api/ThirdPartyIbGigdbQuote/get', request);
25
+ if (!response.flagStatus) {
26
+ const errorMessage = response.error || 'Failed to get GIGDB quote';
27
+ const errorCode = (0, error_utils_1.extractErrorCode)(response);
28
+ if (errorCode) {
29
+ throw new types_1.APIValidationError(errorMessage, errorCode, response);
30
+ }
31
+ else {
32
+ throw new types_1.InstaBrainError(errorMessage, 400, response);
33
+ }
34
+ }
35
+ if (!response.value) {
36
+ throw new types_1.InstaBrainError('No GIGDB quote data received from server');
37
+ }
38
+ return response.value;
39
+ }
40
+ catch (error) {
41
+ if (error instanceof types_1.InstaBrainError) {
42
+ throw error;
43
+ }
44
+ throw new types_1.InstaBrainError('Failed to get GIGDB quote: ' + error.message);
45
+ }
46
+ }
47
+ /**
48
+ * Start a GIGDB application from a quote
49
+ * Note: isDeclined=true is a valid success response (knockout), not an error
50
+ * @param request - The GIGDB application request parameters
51
+ * @returns Promise with the application response
52
+ */
53
+ async startApplication(request) {
54
+ if (!this.httpClient.isAuthenticated()) {
55
+ throw new types_1.AuthenticationError('Must be authenticated to start GIGDB application. Call authenticate() first.');
56
+ }
57
+ try {
58
+ const response = await this.httpClient.post('/api/ThirdPartyGigdbApplication/start-application', request);
59
+ if (!response.flagStatus) {
60
+ const errorMessage = response.error || 'Failed to start GIGDB application';
61
+ const errorCode = (0, error_utils_1.extractErrorCode)(response);
62
+ if (errorCode) {
63
+ throw new types_1.APIValidationError(errorMessage, errorCode, response);
64
+ }
65
+ else {
66
+ throw new types_1.InstaBrainError(errorMessage, 400, response);
67
+ }
68
+ }
69
+ if (!response.value) {
70
+ throw new types_1.InstaBrainError('No GIGDB application data received from server');
71
+ }
72
+ return response.value;
73
+ }
74
+ catch (error) {
75
+ if (error instanceof types_1.InstaBrainError) {
76
+ throw error;
77
+ }
78
+ throw new types_1.InstaBrainError('Failed to start GIGDB application: ' + error.message);
79
+ }
80
+ }
81
+ /**
82
+ * Save EFT payment details for a GIGDB application
83
+ * @param request - The EFT payment request with account details
84
+ * @returns Promise with payment validation response
85
+ */
86
+ async saveEftPayment(request) {
87
+ var _a;
88
+ if (!this.httpClient.isAuthenticated()) {
89
+ throw new types_1.AuthenticationError('Must be authenticated to save EFT payment. Call authenticate() first.');
90
+ }
91
+ try {
92
+ const response = await this.httpClient.post('/api/ThirdPartyPayment/save-eft-payment', request);
93
+ if (!response.flagStatus) {
94
+ const errorMessage = response.error || 'Failed to save EFT payment';
95
+ const errorCode = (0, error_utils_1.extractErrorCode)(response);
96
+ if (errorCode) {
97
+ throw new types_1.APIValidationError(errorMessage, errorCode, response);
98
+ }
99
+ else {
100
+ throw new types_1.InstaBrainError(errorMessage, 400, response);
101
+ }
102
+ }
103
+ return (_a = response.value) !== null && _a !== void 0 ? _a : true;
104
+ }
105
+ catch (error) {
106
+ if (error instanceof types_1.InstaBrainError) {
107
+ throw error;
108
+ }
109
+ throw new types_1.InstaBrainError('Failed to save EFT payment: ' + error.message);
110
+ }
111
+ }
112
+ /**
113
+ * Update a GIGDB quote with a different face amount or payment frequency
114
+ * Use after application has been started to re-quote for the same opportunity
115
+ * @param request - The update quote request with opportunityId, faceAmount, and paymentFreq
116
+ * @returns Promise with the updated quote response
117
+ */
118
+ async updateQuote(request) {
119
+ if (!this.httpClient.isAuthenticated()) {
120
+ throw new types_1.AuthenticationError('Must be authenticated to update GIGDB quote. Call authenticate() first.');
121
+ }
122
+ try {
123
+ const response = await this.httpClient.post('/api/ThirdPartyIbGigdbQuote/update', request);
124
+ if (!response.flagStatus) {
125
+ const errorMessage = response.error || 'Failed to update GIGDB quote';
126
+ const errorCode = (0, error_utils_1.extractErrorCode)(response);
127
+ if (errorCode) {
128
+ throw new types_1.APIValidationError(errorMessage, errorCode, response);
129
+ }
130
+ else {
131
+ throw new types_1.InstaBrainError(errorMessage, 400, response);
132
+ }
133
+ }
134
+ if (!response.value) {
135
+ throw new types_1.InstaBrainError('No GIGDB quote data received from server');
136
+ }
137
+ return response.value;
138
+ }
139
+ catch (error) {
140
+ if (error instanceof types_1.InstaBrainError) {
141
+ throw error;
142
+ }
143
+ throw new types_1.InstaBrainError('Failed to update GIGDB quote: ' + error.message);
144
+ }
145
+ }
146
+ /**
147
+ * Get the existing quote for a GIGDB opportunity
148
+ * Use when startApplication returns isQuoteChanged=true to get the updated quote
149
+ * @param opportunityId - The OpportunityId from the Start Application response
150
+ * @returns Promise with the current quote response
151
+ */
152
+ async getExistingQuote(opportunityId) {
153
+ if (!this.httpClient.isAuthenticated()) {
154
+ throw new types_1.AuthenticationError('Must be authenticated to get existing GIGDB quote. Call authenticate() first.');
155
+ }
156
+ try {
157
+ const response = await this.httpClient.get('/api/ThirdPartyIbGigdbQuote/get-existing-quote', { params: { opportunityId } });
158
+ if (!response.flagStatus) {
159
+ const errorMessage = response.error || 'Failed to get existing GIGDB quote';
160
+ const errorCode = (0, error_utils_1.extractErrorCode)(response);
161
+ if (errorCode) {
162
+ throw new types_1.APIValidationError(errorMessage, errorCode, response);
163
+ }
164
+ else {
165
+ throw new types_1.InstaBrainError(errorMessage, 400, response);
166
+ }
167
+ }
168
+ if (!response.value) {
169
+ throw new types_1.InstaBrainError('No GIGDB quote data received from server');
170
+ }
171
+ return response.value;
172
+ }
173
+ catch (error) {
174
+ if (error instanceof types_1.InstaBrainError) {
175
+ throw error;
176
+ }
177
+ throw new types_1.InstaBrainError('Failed to get existing GIGDB quote: ' + error.message);
178
+ }
179
+ }
180
+ }
181
+ exports.GigdbService = GigdbService;
182
+ //# sourceMappingURL=gigdb.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gigdb.service.js","sourceRoot":"","sources":["../../src/services/gigdb.service.ts"],"names":[],"mappings":";;;AACA,sDAAwD;AACxD,oCAWkB;AAElB;;;GAGG;AACH,MAAa,YAAY;IACvB,YAA6B,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAG,CAAC;IAEvD;;;;OAIG;IACH,KAAK,CAAC,QAAQ,CAAC,OAAoC;QACjD,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,eAAe,EAAE,EAAE,CAAC;YACvC,MAAM,IAAI,2BAAmB,CAAC,sEAAsE,CAAC,CAAC;QACxG,CAAC;QAED,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CACzC,iCAAiC,EACjC,OAAO,CACR,CAAC;YAEF,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;gBACzB,MAAM,YAAY,GAAG,QAAQ,CAAC,KAAK,IAAI,2BAA2B,CAAC;gBACnE,MAAM,SAAS,GAAG,IAAA,8BAAgB,EAAC,QAAQ,CAAC,CAAC;gB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irdPartyQuoteResp } from '../types';
4
4
  * Quote service for getting insurance quotes from the InstaBrain API
5
5
  */
6
6
  export declare class QuoteService {
7
- private httpClient;
7
+ private readonly httpClient;
8
8
  constructor(httpClient: HttpClient);
9
9
  /**
10
10
  * Get an insurance quote based on the provided parameters
@@ -22,11 +22,5 @@ export declare class QuoteService {
22
22
  * @returns Promise with the quote response
23
23
  */
24
24
  getQuote(quoteRequest: ThirdPartyQuoteReq): Promise<ThirdPartyQuoteResp>;
25
- /**
26
- * Extract error code from API response
27
- * @param response - The API response
28
- * @returns The error code if found, null otherwise
29
- */
30
- private extractErrorCode;
31
25
  }
32
26
  //# sourceMappingURL=quote.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"quote.service.d.ts","sourceRoot":"","sources":["../../src/services/quote.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EAKpB,MAAM,UAAU,CAAC;AAElB;;GAEG;AACH,qBAAa,YAAY;IACX,OAAO,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAE1C;;;;;;;;;;;;;;OAcG;IACG,QAAQ,CAAC,YAAY,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAwC9E;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;CA+BzB"}
1
+ {"version":3,"file":"quote.service.d.ts","sourceRoot":"","sources":["../../src/services/quote.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EAKpB,MAAM,UAAU,CAAC;AAElB;;GAEG;AACH,qBAAa,YAAY;IACX,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAEnD;;;;;;;;;;;;;;OAcG;IACG,QAAQ,CAAC,YAAY,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAwC/E"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.QuoteService = void 0;
4
+ const error_utils_1 = require("../utils/error-utils");
4
5
  const types_1 = require("../types");
5
6
  /**
6
7
  * Quote service for getting insurance quotes from the InstaBrain API
@@ -36,7 +37,7 @@ class QuoteService {
36
37
  // Handle API validation errors with specific error codes
37
38
  const errorMessage = response.error || 'Failed to get quote';
38
39
  // Try to extract error code from response
39
- const errorCode = this.extractErrorCode(response);
40
+ const errorCode = (0, error_utils_1.extractErrorCode)(response);
40
41
  if (errorCode) {
41
42
  throw new types_1.APIValidationError(errorMessage, errorCode, response);
42
43
  }
@@ -56,38 +57,6 @@ class QuoteService {
56
57
  throw new types_1.InstaBrainError('Failed to get quote: ' + error.message);
57
58
  }
58
59
  }
59
- /**
60
- * Extract error code from API response
61
- * @param response - The API response
62
- * @returns The error code if found, null otherwise
63
- */
64
- extractErrorCode(response) {
65
- // The API documentation indicates that error codes are returned
66
- // when flagStatus is false. The exact format may vary.
67
- // Common patterns to check:
68
- // Check if error code is directly in the response
69
- if (response.errorCode) {
70
- return response.errorCode;
71
- }
72
- // Check if error code is in error message or nested structure
73
- if (response.error && typeof response.error === 'string') {
74
- // Known API error codes from documentation
75
- const knownErrorCodes = [
76
- 'stateNotFound', 'RateClassNotFound', 'RiderNotAvailable',
77
- 'HeightNotValid', 'InvalidRateclass', 'InvalidHealthClass',
78
- 'ZipCodeNotFound', 'outsideBuildChart', 'QuoteNotEligibleForGivenConditions',
79
- 'NotAvailableForState', 'BenefitPeriodNotAvailable', 'CoverageNotAvailable',
80
- 'RiderFaceAmountNotValid'
81
- ];
82
- // Try to find error code in the error message
83
- for (const errorCode of knownErrorCodes) {
84
- if (response.error.includes(errorCode)) {
85
- return errorCode;
86
- }
87
- }
88
- }
89
- return null;
90
- }
91
60
  }
92
61
  exports.QuoteService = QuoteService;
93
62
  //# sourceMappingURL=quote.service.js.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UAAU,CAAC,eAAe,EAAE,EAAE,CAAC;YACvC,MAAM,IAAI,2BAAmB,CAAC,iEAAiE,CAAC,CAAC;QACnG,CAAC;QAED,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CACzC,gCAAgC,EAChC,YAAY,CACb,CAAC;YAEF,uCAAuC;YACvC,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;gBACzB,yDAAyD;gBACzD,MAAM,YAAY,GAAG,QAAQ,CAAC,KAAK,IAAI,qBAAqB,CAAC;gBAE7D,0CAA0C;gBAC1C,MAAM,SAAS,GAAG,IAAA,8BAAgB,EAAC,QAAQ,CAAC,CAAC;gBAE7C,IAAI,SAAS,EAAE,CAAC;oBACd,MAAM,IAAI,0BAAkB,CAAC,YAAY,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;gBAClE,CAAC;qBAAM,CAAC;oBACN,MAAM,IAAI,uBAAe,CAAC,YAAY,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;gBACzD,CAAC;YACH,CAAC;YAED,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;gBACpB,MAAM,IAAI,uBAAe,CAAC,oCAAoC,CAAC,CAAC;YAClE,CAAC;YAED,OAAO,QAAQ,CAAC,KAAK,CAAC;QACxB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,uBAAe,EAAE,CAAC;gBACrC,MAAM,KAAK,CAAC;YACd,CAAC;YACD,MAAM,IAAI,uBAAe,CAAC,uBAAuB,GAAI,KAAe,CAAC,OAAO,CAAC,CAAC;QAChF,CAAC;IACH,CAAC;CAEF;AA1DD,oCA0DC"}
@@ -5,7 +5,7 @@ import { AgentPortalReq, ThirdPartyProspectsResp, ThirdPartySalesReportRes, Thir
5
5
  * These APIs provide dashboard-ready data for agent portals and reporting systems
6
6
  */
7
7
  export declare class ReportsService {
8
- private httpClient;
8
+ private readonly httpClient;
9
9
  constructor(httpClient: HttpClient);
10
10
  /**
11
11
  * Get prospects data - quotes that haven't been converted to applications yet
@@ -54,11 +54,5 @@ export declare class ReportsService {
54
54
  * @returns Promise with applications data including status and completion info
55
55
  */
56
56
  getApplications(request: AgentPortalReq): Promise<ThirdPartyApplicationReportRes>;
57
- /**
58
- * Extract error code from API response
59
- * @param response - The API response
60
- * @returns The error code if found, null otherwise
61
- */
62
- private extractErrorCode;
63
57
  }
64
58
  //# sourceMappingURL=reports.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reports.service.d.ts","sourceRoot":"","sources":["../../src/services/reports.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EACL,cAAc,EACd,uBAAuB,EACvB,wBAAwB,EACxB,8BAA8B,EAK/B,MAAM,UAAU,CAAC;AAElB;;;GAGG;AACH,qBAAa,cAAc;IACb,OAAO,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAE1C;;;;;;;;;;;;OAYG;IACG,YAAY,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAwC7E;;;;;;;;;;;;;;OAcG;IACG,QAAQ,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAwC1E;;;;;;;;;;;;;;;OAeG;IACG,eAAe,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,8BAA8B,CAAC;IAwCvF;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;CA2BzB"}
1
+ {"version":3,"file":"reports.service.d.ts","sourceRoot":"","sources":["../../src/services/reports.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EACL,cAAc,EACd,uBAAuB,EACvB,wBAAwB,EACxB,8BAA8B,EAK/B,MAAM,UAAU,CAAC;AAElB;;;GAGG;AACH,qBAAa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAEnD;;;;;;;;;;;;OAYG;IACG,YAAY,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAoC7E;;;;;;;;;;;;;;OAcG;IACG,QAAQ,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAoC1E;;;;;;;;;;;;;;;OAeG;IACG,eAAe,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,8BAA8B,CAAC;CAoCxF"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ReportsService = void 0;
4
+ const error_utils_1 = require("../utils/error-utils");
4
5
  const types_1 = require("../types");
5
6
  /**
6
7
  * Reports service for getting prospects, sales, and applications data from InstaBrain API
@@ -30,12 +31,9 @@ class ReportsService {
30
31
  }
31
32
  try {
32
33
  const response = await this.httpClient.post('/api/ThirdParty/get-prospects', request);
33
- // Check if the response was successful
34
34
  if (!response.flagStatus) {
35
- // Handle API validation errors with specific error codes
36
35
  const errorMessage = response.error || 'Failed to get prospects';
37
- // Try to extract error code from response
38
- const errorCode = this.extractErrorCode(response);
36
+ const errorCode = (0, error_utils_1.extractErrorCode)(response);
39
37
  if (errorCode) {
40
38
  throw new types_1.APIValidationError(errorMessage, errorCode, response);
41
39
  }
@@ -77,12 +75,9 @@ class ReportsService {
77
75
  }
78
76
  try {
79
77
  const response = await this.httpClient.post('/api/ThirdParty/get-sales', request);
80
- // Check if the response was successful
81
78
  if (!response.flagStatus) {
82
- // Handle API validation errors with specific error codes
83
79
  const errorMessage = response.error || 'Failed to get sales';
84
- // Try to extract error code from response
85
- const errorCode = this.extractErrorCode(response);
80
+ const errorCode = (0, error_utils_1.extractErrorCode)(response);
86
81
  if (errorCode) {
87
82
  throw new types_1.APIValidationError(errorMessage, errorCode, response);
88
83
  }
@@ -125,12 +120,9 @@ class ReportsService {
125
120
  }
126
121
  try {
127
122
  const response = await this.httpClient.post('/api/ThirdParty/get-application', request);
128
- // Check if the response was successful
129
123
  if (!response.flagStatus) {
130
- // Handle API validation errors with specific error codes
131
124
  const errorMessage = response.error || 'Failed to get applications';
132
- // Try to extract error code from response
133
- const errorCode = this.extractErrorCode(response);
125
+ const errorCode = (0, error_utils_1.extractErrorCode)(response);
134
126
  if (errorCode) {
135
127
  throw new types_1.APIValidationError(errorMessage, errorCode, response);
136
128
  }
@@ -150,35 +142,6 @@ class ReportsService {
150
142
  throw new types_1.InstaBrainError('Failed to get applications: ' + error.message);
151
143
  }
152
144
  }
153
- /**
154
- * Extract error code from API response
155
- * @param response - The API response
156
- * @returns The error code if found, null otherwise
157
- */
158
- extractErrorCode(response) {
159
- // Check if error code is directly in the response
160
- if (response.errorCode) {
161
- return response.errorCode;
162
- }
163
- // Check if error code is in error message or nested structure
164
- if (response.error && typeof response.error === 'string') {
165
- // Known API error codes from documentation
166
- const knownErrorCodes = [
167
- 'stateNotFound', 'RateClassNotFound', 'RiderNotAvailable',
168
- 'HeightNotValid', 'InvalidRateclass', 'InvalidHealthClass',
169
- 'ZipCodeNotFound', 'outsideBuildChart', 'QuoteNotEligibleForGivenConditions',
170
- 'NotAvailableForState', 'BenefitPeriodNotAvailable', 'CoverageNotAvailable',
171
- 'RiderFaceAmountNotValid'
172
- ];
173
- // Try to find error code in the error message
174
- for (const errorCode of knownErrorCodes) {
175
- if (response.error.includes(errorCode)) {
176
- return errorCode;
177
- }
178
- }
179
- }
180
- return null;
181
- }
182
145
  }
183
146
  exports.ReportsService = ReportsService;
184
147
  //# sourceMappingURL=reports.service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"reports.service.js","sourceRoot":"","sources":["../../src/services/reports.service.ts"],"names":[],"mappings":";;;AACA,oCASkB;AAElB;;;GAGG;AACH,MAAa,cAAc;IACzB,YAAoB,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAG,CAAC;IAE9C;;;;;;;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AE,CAAC;gBACpB,MAAM,IAAI,uBAAe,CAAC,2CAA2C,CAAC,CAAC;YACzE,CAAC;YAED,OAAO,QAAQ,CAAC,KAAK,CAAC;QACxB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,uBAAe,EAAE,CAAC;gBACrC,MAAM,KAAK,CAAC;YACd,CAAC;YACD,MAAM,IAAI,uBAAe,CAAC,8BAA8B,GAAI,KAAe,CAAC,OAAO,CAAC,CAAC;QACvF,CAAC;IACH,CAAC;CAEF;AA3JD,wCA2JC"}
@@ -0,0 +1,48 @@
1
+ import { HttpClient } from '../utils/http-client';
2
+ import { ThirdPartySendPinReq, ThirdPartyResendPinReq, ThirdPartyVerifyPinReq, ThirdPartyPrepareDocsResp, ThirdPartySendPinResp, ThirdPartyResendPinResp, ThirdPartyVerifyPinResp } from '../types';
3
+ /**
4
+ * Secure Sign service for document signing flow
5
+ * Shared across all third-party products — not specific to GIGDB.
6
+ * Call these endpoints after EFT payment has been saved successfully.
7
+ *
8
+ * Typical flow:
9
+ * 1. prepareDocsAndGetDeliveryChannels() — prepare signing package, check channels
10
+ * 2. sendPinAndGetDocumentsLink() — send PIN via SMS/Email, get documents link
11
+ * 3. resendPin() (optional) — resend if signer didn't receive PIN
12
+ * 4. verifyPin() — verify PIN to complete signing
13
+ */
14
+ export declare class SecureSignService {
15
+ private readonly httpClient;
16
+ constructor(httpClient: HttpClient);
17
+ /**
18
+ * Prepare the signing package and check available delivery channels
19
+ * Always call this first — it prepares the signing package.
20
+ * If isSignCompleted is true, skip the PIN flow and proceed to Final Submit.
21
+ * @param opportunityId - The OpportunityId from the Start Application response
22
+ * @returns Promise with delivery channels and sign completion status
23
+ */
24
+ prepareDocsAndGetDeliveryChannels(opportunityId: string): Promise<ThirdPartyPrepareDocsResp>;
25
+ /**
26
+ * Send a verification PIN via SMS and/or Email and receive the documents link
27
+ * At least one of flagSendSms or flagSendEmail must be true.
28
+ * The returned script must be read aloud to the proposed insured before signing.
29
+ * @param request - The send PIN request with delivery preferences
30
+ * @returns Promise with documents link and disclosure script
31
+ */
32
+ sendPinAndGetDocumentsLink(request: ThirdPartySendPinReq): Promise<ThirdPartySendPinResp>;
33
+ /**
34
+ * Resend the verification PIN if the signer did not receive it
35
+ * Unlike sendPinAndGetDocumentsLink, this does NOT return the documents link.
36
+ * @param request - The resend PIN request with delivery preferences
37
+ * @returns Promise with PIN sent confirmation
38
+ */
39
+ resendPin(request: ThirdPartyResendPinReq): Promise<ThirdPartyResendPinResp>;
40
+ /**
41
+ * Verify the PIN entered by the signer to complete document signing
42
+ * The disclosure script must have been read aloud before calling this.
43
+ * @param request - The verify PIN request with PIN and script confirmation
44
+ * @returns Promise with verification result
45
+ */
46
+ verifyPin(request: ThirdPartyVerifyPinReq): Promise<ThirdPartyVerifyPinResp>;
47
+ }
48
+ //# sourceMappingURL=secure-sign.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secure-sign.service.d.ts","sourceRoot":"","sources":["../../src/services/secure-sign.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EACtB,yBAAyB,EACzB,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EAKxB,MAAM,UAAU,CAAC;AAElB;;;;;;;;;;GAUG;AACH,qBAAa,iBAAiB;IAChB,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAEnD;;;;;;OAMG;IACG,iCAAiC,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAmClG;;;;;;OAMG;IACG,0BAA0B,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAmC/F;;;;;OAKG;IACG,SAAS,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAmClF;;;;;OAKG;IACG,SAAS,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,uBAAuB,CAAC;CAkCnF"}