@cemiar/cemiarlink-sdk 1.0.57 → 1.0.59

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 (34) hide show
  1. package/dist/epic-api/index.d.ts +2 -0
  2. package/dist/epic-api/index.js +18 -0
  3. package/dist/epic-api/models/BaseModels.d.ts +34 -0
  4. package/dist/epic-api/models/BaseModels.js +2 -0
  5. package/dist/epic-api/models/EpicApiOptions.d.ts +12 -0
  6. package/dist/epic-api/models/EpicApiOptions.js +2 -0
  7. package/dist/epic-api/models/epic/Client.d.ts +203 -0
  8. package/dist/epic-api/models/epic/Client.js +2 -0
  9. package/dist/epic-api/models/epic/Form.d.ts +113 -0
  10. package/dist/epic-api/models/epic/Form.js +2 -0
  11. package/dist/epic-api/models/epic/Line.d.ts +146 -0
  12. package/dist/epic-api/models/epic/Line.js +2 -0
  13. package/dist/epic-api/models/epic/Organization.d.ts +31 -0
  14. package/dist/epic-api/models/epic/Organization.js +2 -0
  15. package/dist/epic-api/models/epic/Policy.d.ts +111 -0
  16. package/dist/epic-api/models/epic/Policy.js +2 -0
  17. package/dist/epic-api/models/epic/index.d.ts +5 -0
  18. package/dist/epic-api/models/epic/index.js +21 -0
  19. package/dist/epic-api/models/index.d.ts +3 -0
  20. package/dist/epic-api/models/index.js +19 -0
  21. package/dist/epic-api/modules/BaseModule.d.ts +14 -0
  22. package/dist/epic-api/modules/BaseModule.js +31 -0
  23. package/dist/epic-api/modules/ClientModule.d.ts +9 -0
  24. package/dist/epic-api/modules/ClientModule.js +24 -0
  25. package/dist/epic-api/modules/FormModule.d.ts +8 -0
  26. package/dist/epic-api/modules/FormModule.js +22 -0
  27. package/dist/epic-api/modules/PolicyModule.d.ts +11 -0
  28. package/dist/epic-api/modules/PolicyModule.js +30 -0
  29. package/dist/epic-api/services/EpicApiService.d.ts +29 -0
  30. package/dist/epic-api/services/EpicApiService.js +133 -0
  31. package/dist/epic-api/services/index.d.ts +1 -0
  32. package/dist/epic-api/services/index.js +17 -0
  33. package/dist/models/epic/Policy.d.ts +1 -0
  34. package/package.json +13 -1
@@ -0,0 +1,2 @@
1
+ export * from './models';
2
+ export * from './services';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./models"), exports);
18
+ __exportStar(require("./services"), exports);
@@ -0,0 +1,34 @@
1
+ export interface ListParams {
2
+ limit?: number;
3
+ offset?: number;
4
+ embed?: string;
5
+ }
6
+ export interface BaseListResponse<T> {
7
+ total: number;
8
+ _links: Links;
9
+ _embedded: {
10
+ [key: string]: T[];
11
+ };
12
+ }
13
+ export interface ListResponse<T> {
14
+ items: T[];
15
+ total: number;
16
+ links: Links;
17
+ }
18
+ export interface Link {
19
+ href: string;
20
+ templated?: boolean;
21
+ type?: string;
22
+ deprecation?: string;
23
+ name?: string;
24
+ profile?: string;
25
+ title?: string;
26
+ hreflang?: string;
27
+ }
28
+ export interface Links {
29
+ self: Link;
30
+ next?: Link;
31
+ prev?: Link;
32
+ first?: Link;
33
+ last?: Link;
34
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,12 @@
1
+ export type CemiarLinkOptions = {
2
+ env: 'local';
3
+ baseURL: string;
4
+ } | {
5
+ env: 'dev' | 'prod';
6
+ taskId?: string;
7
+ };
8
+ export interface EpicApiOptions {
9
+ apiEnv?: 'dev' | 'prod';
10
+ language?: 'en-US' | 'fr-CA';
11
+ cemiarLink?: CemiarLinkOptions;
12
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,203 @@
1
+ import { ListParams } from '../BaseModels';
2
+ export interface Client {
3
+ id: string;
4
+ active?: boolean;
5
+ individualOrBusiness?: 'INDIVIDUAL' | 'BUSINESS';
6
+ businessTypes?: ('AGRICULTURE' | 'BENEFITS' | 'BONDS' | 'COMMERCIAL' | 'FINANCIAL_SERVICES' | 'LIFE_AND_HEALTH' | 'PERSONAL' | 'OTHER')[];
7
+ name: string;
8
+ lookupCode?: string;
9
+ type: 'PROSPECT' | 'INSURED';
10
+ customId?: string | null;
11
+ accountSource?: string;
12
+ doNotPurge?: boolean;
13
+ organizations: string[];
14
+ address?: ClientAddress;
15
+ comments?: string;
16
+ phoneNumber?: ClientPhoneNumber;
17
+ inactiveReason?: string;
18
+ enteredBy?: ClientAudit;
19
+ lastUpdatedBy?: ClientAudit;
20
+ convertedOn?: string;
21
+ priorAccountId?: string;
22
+ business?: ClientBusiness | null;
23
+ billing?: ClientBilling;
24
+ servicingContacts?: ClientServicingContact[];
25
+ primaryContact?: string;
26
+ mainBusinessContact?: string;
27
+ _links?: ClientLinks;
28
+ _embedded?: Record<string, any>;
29
+ }
30
+ export interface ClientAddress {
31
+ streets: string[];
32
+ city: string;
33
+ zipOrPostalCode: string;
34
+ county: string;
35
+ stateOrProvince: string;
36
+ countryCode: string;
37
+ description: string;
38
+ siteId: string;
39
+ mailing: boolean;
40
+ billing: boolean;
41
+ }
42
+ export interface ClientPhoneNumber {
43
+ callPermission: 'OBTAINED' | 'DID_NOT_OBTAIN' | 'PLEASE_DO_NOT_CALL';
44
+ number?: string;
45
+ description?: string;
46
+ extension?: string;
47
+ }
48
+ export interface ClientAudit {
49
+ date: string;
50
+ userCode: string;
51
+ }
52
+ export interface ClientBusiness {
53
+ email?: string;
54
+ website?: string;
55
+ faxNumber?: ClientPhoneNumber | null;
56
+ }
57
+ export interface ClientLinks {
58
+ self: {
59
+ href: string;
60
+ };
61
+ organizations: {
62
+ href: string;
63
+ };
64
+ }
65
+ export interface ClientFilter extends ListParams {
66
+ active_status?: string;
67
+ address_contains?: string;
68
+ email?: string;
69
+ email_contains?: string;
70
+ enteredBy?: string;
71
+ enteredBy_contains?: string;
72
+ enteredOn_before?: string;
73
+ enteredOn_after?: string;
74
+ lookupCode?: string;
75
+ lookupCode_contains?: string;
76
+ name?: string;
77
+ name_contains?: string;
78
+ customId?: string;
79
+ customId_contains?: string;
80
+ organization?: string;
81
+ phoneNumber?: string;
82
+ phoneNumber_contains?: string;
83
+ priorAccountId?: string;
84
+ priorAccountId_contains?: string;
85
+ type?: string;
86
+ updatedBy?: string;
87
+ updatedBy_contains?: string;
88
+ updatedOn_after?: string;
89
+ updatedOn_before?: string;
90
+ 'servicingContacts.role'?: string;
91
+ 'servicingContacts.employee'?: string;
92
+ }
93
+ export interface CreateClient {
94
+ name: string;
95
+ type: 'PROSPECT' | 'INSURED';
96
+ organizations: string[];
97
+ primaryContact: CreateClientContact;
98
+ active?: boolean;
99
+ individualOrBusiness?: 'INDIVIDUAL' | 'BUSINESS';
100
+ businessTypes?: ('AGRICULTURE' | 'BENEFITS' | 'BONDS' | 'COMMERCIAL' | 'FINANCIAL_SERVICES' | 'LIFE_AND_HEALTH' | 'PERSONAL' | 'OTHER')[];
101
+ lookupCode?: string;
102
+ customId?: string | null;
103
+ accountSource?: string;
104
+ doNotPurge?: boolean;
105
+ address?: ClientAddress;
106
+ comments?: string;
107
+ phoneNumber?: ClientPhoneNumber;
108
+ inactiveReason?: string;
109
+ business?: ClientBusiness;
110
+ billing?: ClientBilling;
111
+ servicingContacts?: ClientServicingContact[];
112
+ }
113
+ export interface ClientBilling {
114
+ broker?: string;
115
+ billBrokerNet?: boolean;
116
+ invoicePageBreak?: 'CLIENT' | 'ITEM' | 'POLICY';
117
+ invoiceLayout?: string;
118
+ serviceCharge?: boolean;
119
+ statementPageBreak?: 'ACCOUNT' | 'CONTACT';
120
+ statementLayout?: string;
121
+ overrideAchFee?: number;
122
+ overrideCcFee?: number;
123
+ accountBalance?: {
124
+ currencySymbol: string;
125
+ units: string;
126
+ partialUnits: number;
127
+ };
128
+ continuousPaymentAuthorization?: {
129
+ authorized: boolean;
130
+ cardLastDigits?: string;
131
+ };
132
+ }
133
+ export interface ClientServicingContact {
134
+ role: string;
135
+ employee: string;
136
+ description?: string;
137
+ _links?: Record<string, {
138
+ href: string;
139
+ }>;
140
+ _embedded?: Record<string, any>;
141
+ }
142
+ export interface CreateClientContact {
143
+ individualOrBusiness: 'INDIVIDUAL' | 'BUSINESS';
144
+ marketingPreferences: ClientMarketingPreferences;
145
+ primaryContactPreference: 'PHONE' | 'EMAIL' | 'MAIL' | 'FAX' | 'SMS';
146
+ billingContactPreference: 'EMAIL' | 'MAIL' | 'FAX';
147
+ servicingContactPreference: 'EMAIL' | 'MAIL' | 'FAX';
148
+ preferredLanguage: string;
149
+ phoneNumbers?: ContactPhoneNumber[];
150
+ useAccountAddress?: boolean;
151
+ address?: ClientAddress | null;
152
+ emails?: ClientEmail[];
153
+ website?: string;
154
+ conversationalSmsOptIn?: boolean;
155
+ comments?: string;
156
+ individualContact?: IndividualContact;
157
+ businessContact?: BusinessContact;
158
+ }
159
+ export interface ContactPhoneNumber extends ClientPhoneNumber {
160
+ type: 'BUSINESS' | 'MOBILE' | 'RESIDENCE' | 'FAX' | 'OTHER';
161
+ primary?: boolean;
162
+ }
163
+ export interface IndividualContact {
164
+ lastName: string;
165
+ person?: string;
166
+ prefix?: string;
167
+ firstName?: string;
168
+ middleName?: string;
169
+ suffix?: string;
170
+ formalName?: string;
171
+ informalName?: string;
172
+ dateOfBirth?: string;
173
+ }
174
+ export interface BusinessContact {
175
+ name: string;
176
+ businessStartedDate?: string;
177
+ naics?: string;
178
+ sic?: string;
179
+ }
180
+ export interface ClientPrimaryContact {
181
+ individualOrBusiness: 'INDIVIDUAL' | 'BUSINESS';
182
+ marketingPreferences: ClientMarketingPreferences;
183
+ primaryContactPreference: 'PHONE' | 'EMAIL' | 'MAIL' | 'FAX' | 'SMS';
184
+ billingContactPreference: 'EMAIL' | 'MAIL' | 'FAX';
185
+ servicingContactPreference: 'EMAIL' | 'MAIL' | 'FAX';
186
+ preferredLanguage: string;
187
+ phoneNumbers?: ContactPhoneNumber[];
188
+ useAccountAddress?: boolean;
189
+ address?: ClientAddress | null;
190
+ emails?: ClientEmail[];
191
+ website?: string;
192
+ conversationalSmsOptIn?: boolean;
193
+ comments?: string;
194
+ }
195
+ export interface ClientMarketingPreferences {
196
+ doNotMarket: boolean;
197
+ preferred?: 'PHONE' | 'EMAIL' | 'MAIL' | 'FAX';
198
+ allowed?: ('PHONE' | 'EMAIL' | 'MAIL' | 'FAX' | '3RD_PARTY' | 'SMS')[];
199
+ }
200
+ export interface ClientEmail {
201
+ emailAddress: string;
202
+ description?: string;
203
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,113 @@
1
+ export interface FormContentResponse<T> {
2
+ _links: {
3
+ self: {
4
+ href: string;
5
+ };
6
+ };
7
+ content: T;
8
+ }
9
+ export interface SubmissionFormDefinition {
10
+ form: FormDefinition;
11
+ prefillForm: PrefillForm | null;
12
+ clientId: number;
13
+ hiddenFields: string[];
14
+ isSample: boolean;
15
+ }
16
+ export interface FormDefinition {
17
+ guid: string;
18
+ label: string;
19
+ description?: string;
20
+ formPages: FormPage[];
21
+ formBlocks: FormBlock[];
22
+ formFields: FormField[];
23
+ insuranceTypes: InsuranceType[];
24
+ countries: string[];
25
+ categoryName?: string;
26
+ isTestAgency?: boolean;
27
+ }
28
+ export interface FormPage {
29
+ guid: string;
30
+ label: string;
31
+ isDraft?: string;
32
+ isLocked?: boolean;
33
+ clonedFromParent?: string | number | null;
34
+ }
35
+ export interface FormBlock {
36
+ guid: string;
37
+ entity?: number;
38
+ condition?: Record<string, any> | null;
39
+ attributes?: Record<string, any>;
40
+ label: string;
41
+ description?: string;
42
+ formPage?: string;
43
+ after?: string;
44
+ type?: string;
45
+ hasRootEntity?: boolean;
46
+ isLocked?: boolean;
47
+ isDraft?: string;
48
+ clonedFromParent?: string | number | null;
49
+ entityLink?: string | number | null;
50
+ children?: string;
51
+ entityDetails?: {
52
+ id: number;
53
+ label: string;
54
+ };
55
+ integrationsIdentifier?: string;
56
+ }
57
+ export interface FormField {
58
+ guid: string;
59
+ type: string;
60
+ attributes?: Record<string, any>;
61
+ label: string;
62
+ metadata?: string | Record<string, any>;
63
+ child?: string;
64
+ }
65
+ export interface InsuranceType {
66
+ id: number;
67
+ name: string;
68
+ }
69
+ export interface PrefillForm {
70
+ id: number;
71
+ name: string;
72
+ form?: {
73
+ guid: string;
74
+ label: string;
75
+ description?: string;
76
+ };
77
+ defaultPrefill?: {
78
+ id: number;
79
+ name: string;
80
+ };
81
+ }
82
+ export interface SubmissionResponse {
83
+ id: number;
84
+ formField: {
85
+ guid: string;
86
+ type: string;
87
+ attributes?: Record<string, any>;
88
+ label: string;
89
+ };
90
+ type: string;
91
+ response: any;
92
+ }
93
+ export interface SubmissionResponseRow {
94
+ id: number;
95
+ entity: number;
96
+ formBlocks: FormBlock[];
97
+ responses: SubmissionResponse[];
98
+ responseRows: SubmissionResponseRow[];
99
+ formBlocksIntegrationsIdentifiers?: string[];
100
+ }
101
+ export interface SubmissionResponsesResult {
102
+ responses: SubmissionResponse[];
103
+ responseRows: SubmissionResponseRow[];
104
+ }
105
+ export interface UpdateSubmissionResponsesPayload {
106
+ responses: SubmissionResponse[];
107
+ responseRows: SubmissionResponseRow[];
108
+ }
109
+ export interface UpdateSubmissionResponsesResult {
110
+ errors: any[];
111
+ responses: SubmissionResponse[];
112
+ responseRows: SubmissionResponseRow[];
113
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,146 @@
1
+ import { ListParams } from '../BaseModels';
2
+ import { PolicyCurrency } from './Policy';
3
+ export interface Line {
4
+ id: string;
5
+ status?: string;
6
+ lineType?: string;
7
+ issuingCompany?: string;
8
+ issuingLocation?: {
9
+ stateOrProvince: string;
10
+ country: string;
11
+ };
12
+ premiumPayable?: {
13
+ account: string;
14
+ type: 'EXTERNAL_BROKER' | 'CARRIER' | 'INTERNAL_BROKER';
15
+ };
16
+ organization?: string;
17
+ billMode?: 'AGENCY' | 'DIRECT';
18
+ agencyFirstWrittenOn?: string;
19
+ effectiveOn?: string;
20
+ expirationOn?: string;
21
+ planOptionName?: string;
22
+ planLineId?: string;
23
+ billTo?: LineBillTo;
24
+ producerBrokerCommission?: {
25
+ type: 'SINGLE_TERM' | 'MULTI_TERM';
26
+ };
27
+ client?: string;
28
+ policy?: string;
29
+ premium?: LinePremium;
30
+ commission?: LinePremium;
31
+ comments?: string;
32
+ newRevenueBeginOn?: string;
33
+ renewalRevenueBeginOn?: string;
34
+ billingPlan?: string;
35
+ financed?: boolean;
36
+ taxOption?: 'NOT_APPLICABLE' | 'AUTO_GENERATE' | 'EXEMPT' | 'PROMPT';
37
+ lineCommission?: LineCommission;
38
+ risksInsured?: number;
39
+ risksInsuredDescription?: string;
40
+ totalEligible?: number;
41
+ totalEligibleDescription?: string;
42
+ payableContract?: string;
43
+ cobraStateContinuation?: 'NONE' | 'OFFERED' | 'NOT_OFFERED';
44
+ rateGuaranteedThrough?: string;
45
+ stage?: string;
46
+ action?: string;
47
+ lastUpdatedBy?: {
48
+ userCode?: string;
49
+ date?: string;
50
+ };
51
+ _links?: Record<string, {
52
+ href: string;
53
+ }>;
54
+ _embedded?: Record<string, any>;
55
+ }
56
+ export interface CreateLine {
57
+ status: string;
58
+ lineType: string;
59
+ issuingLocation: {
60
+ stateOrProvince: string;
61
+ country: string;
62
+ };
63
+ organization: string;
64
+ policy: string;
65
+ billMode: 'AGENCY' | 'DIRECT';
66
+ issuingCompany?: string;
67
+ premiumPayable?: {
68
+ account: string;
69
+ type: 'EXTERNAL_BROKER' | 'CARRIER' | 'INTERNAL_BROKER';
70
+ };
71
+ agencyFirstWrittenOn?: string;
72
+ effectiveOn?: string;
73
+ expirationOn?: string;
74
+ planOptionName?: string;
75
+ planLineId?: string;
76
+ billTo?: LineBillTo;
77
+ producerBrokerCommission?: {
78
+ type: 'SINGLE_TERM' | 'MULTI_TERM';
79
+ };
80
+ premium?: LinePremium;
81
+ commission?: LinePremium;
82
+ comments?: string;
83
+ newRevenueBeginOn?: string;
84
+ renewalRevenueBeginOn?: string;
85
+ billingPlan?: string;
86
+ financed?: boolean;
87
+ taxOption?: 'NOT_APPLICABLE' | 'AUTO_GENERATE' | 'EXEMPT' | 'PROMPT';
88
+ lineCommission?: LineCommission;
89
+ risksInsured?: number;
90
+ risksInsuredDescription?: string;
91
+ totalEligible?: number;
92
+ totalEligibleDescription?: string;
93
+ payableContract?: string;
94
+ cobraStateContinuation?: 'NONE' | 'OFFERED' | 'NOT_OFFERED';
95
+ rateGuaranteedThrough?: string;
96
+ }
97
+ export interface LineFilter extends ListParams {
98
+ policy?: string;
99
+ 'lastUpdatedOn.date_before'?: string;
100
+ 'lastUpdatedOn.date_after'?: string;
101
+ 'lineType.code'?: string;
102
+ 'lineType.code_contains'?: string;
103
+ effectiveOn?: string;
104
+ effectiveOn_before?: string;
105
+ effectiveOn_after?: string;
106
+ expirationOn?: string;
107
+ expirationOn_before?: string;
108
+ expirationOn_after?: string;
109
+ organization?: string;
110
+ client?: string;
111
+ }
112
+ export interface LinePremium {
113
+ estimated?: PolicyCurrency;
114
+ annualized?: PolicyCurrency;
115
+ billed?: PolicyCurrency;
116
+ estimatedMonthly?: PolicyCurrency;
117
+ }
118
+ export interface LineBillTo {
119
+ contactName?: string;
120
+ address?: LineAddress;
121
+ deliveryMethod?: 'MAIL' | 'EMAIL' | 'FAX';
122
+ email?: string;
123
+ faxNumber?: {
124
+ number?: string;
125
+ extension?: string;
126
+ };
127
+ account?: string;
128
+ }
129
+ export interface LineAddress {
130
+ streets?: string[];
131
+ city?: string;
132
+ stateOrProvince?: string;
133
+ zipOrPostalCode?: string;
134
+ county?: string;
135
+ countryCode?: string;
136
+ description?: string;
137
+ siteId?: string;
138
+ }
139
+ export interface LineCommission {
140
+ useAgreement?: boolean;
141
+ commissionAgreement?: string;
142
+ overrideAgreement?: boolean;
143
+ type?: 'FLAT_FEE' | 'PERCENTAGE_OF_PREMIUM';
144
+ percent?: number;
145
+ amount?: PolicyCurrency;
146
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,31 @@
1
+ import { ListParams } from '../BaseModels';
2
+ export interface Organization {
3
+ id: string;
4
+ agency: string;
5
+ branch: string;
6
+ _links?: {
7
+ self?: {
8
+ href: string;
9
+ };
10
+ agency?: {
11
+ href: string;
12
+ };
13
+ branch?: {
14
+ href: string;
15
+ };
16
+ };
17
+ _embedded?: {
18
+ agency?: {
19
+ id: string;
20
+ code: string;
21
+ name: string;
22
+ };
23
+ branch?: {
24
+ id: string;
25
+ code: string;
26
+ name: string;
27
+ };
28
+ };
29
+ }
30
+ export interface OrganizationFilter extends ListParams {
31
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,111 @@
1
+ import { ListParams } from '../BaseModels';
2
+ export interface Policy {
3
+ id: string;
4
+ status?: string;
5
+ organization?: string;
6
+ description?: string;
7
+ effectiveOn?: string;
8
+ expirationOn?: string;
9
+ policyNumber?: string;
10
+ policyType?: string;
11
+ client?: string;
12
+ premium?: PolicyPremium;
13
+ commission?: PolicyCommission;
14
+ source?: string;
15
+ turnOffPolicyDownload?: boolean;
16
+ datesChanged?: boolean;
17
+ originalPolicy?: string;
18
+ lines?: string[];
19
+ historic?: boolean;
20
+ enteredBy?: PolicyProcessAndDate;
21
+ lastUpdatedBy?: PolicyProcessAndDate;
22
+ _links?: Record<string, {
23
+ href: string;
24
+ }>;
25
+ _embedded?: Record<string, any>;
26
+ }
27
+ export interface CreatePolicy {
28
+ description: string;
29
+ effectiveOn: string;
30
+ expirationOn: string;
31
+ policyType: string;
32
+ client: string;
33
+ status?: string;
34
+ policyNumber?: string;
35
+ premium?: PolicyPremium;
36
+ commission?: PolicyCommission;
37
+ source?: string;
38
+ turnOffPolicyDownload?: boolean;
39
+ lines?: CreatePolicyLine[];
40
+ }
41
+ export interface CreatePolicyLine {
42
+ status: string;
43
+ lineType: string;
44
+ issuingLocation: {
45
+ stateOrProvince: string;
46
+ country: string;
47
+ };
48
+ organization: string;
49
+ billMode: 'AGENCY' | 'DIRECT';
50
+ issuingCompany?: string;
51
+ premiumPayable?: {
52
+ account: string;
53
+ type: 'EXTERNAL_BROKER' | 'INTERNAL_BROKER';
54
+ };
55
+ agencyFirstWrittenOn?: string;
56
+ effectiveOn?: string;
57
+ expirationOn?: string;
58
+ planOptionName?: string;
59
+ planLineId?: string;
60
+ billTo?: PolicyBillTo;
61
+ premium?: PolicyPremium;
62
+ commission?: PolicyCommission;
63
+ comments?: string;
64
+ newRevenueBeginOn?: string;
65
+ renewalRevenueBeginOn?: string;
66
+ producerBrokerCommission?: {
67
+ type: 'SINGLE_TERM' | 'MULTI_TERM';
68
+ };
69
+ }
70
+ export interface PolicyFilter extends ListParams {
71
+ policyType?: string;
72
+ 'lineType.code'?: string;
73
+ 'lineType.code_contains'?: string;
74
+ policyNumber?: string;
75
+ policyNumber_contains?: string;
76
+ effectiveOn?: string;
77
+ effectiveOn_before?: string;
78
+ effectiveOn_after?: string;
79
+ expirationOn?: string;
80
+ expirationOn_before?: string;
81
+ expirationOn_after?: string;
82
+ enteredOn_before?: string;
83
+ enteredOn_after?: string;
84
+ lastUpdatedOn_before?: string;
85
+ lastUpdatedOn_after?: string;
86
+ historic?: string;
87
+ status?: string;
88
+ client?: string;
89
+ insertedByProcessCode?: string;
90
+ updatedByProcessCode?: string;
91
+ originalPolicy?: string;
92
+ }
93
+ export interface PolicyPremium {
94
+ estimated?: PolicyCurrency;
95
+ }
96
+ export interface PolicyCommission {
97
+ estimated?: PolicyCurrency;
98
+ }
99
+ export interface PolicyCurrency {
100
+ currencySymbol?: string;
101
+ units?: string;
102
+ partialUnits?: number;
103
+ }
104
+ export interface PolicyProcessAndDate {
105
+ code?: string;
106
+ date?: string;
107
+ }
108
+ export interface PolicyBillTo {
109
+ contactName?: string;
110
+ account?: string;
111
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ export * from './Client';
2
+ export * from './Policy';
3
+ export * from './Form';
4
+ export * from './Organization';
5
+ export * from './Line';
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./Client"), exports);
18
+ __exportStar(require("./Policy"), exports);
19
+ __exportStar(require("./Form"), exports);
20
+ __exportStar(require("./Organization"), exports);
21
+ __exportStar(require("./Line"), exports);
@@ -0,0 +1,3 @@
1
+ export * from './epic';
2
+ export * from './BaseModels';
3
+ export * from './EpicApiOptions';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./epic"), exports);
18
+ __exportStar(require("./BaseModels"), exports);
19
+ __exportStar(require("./EpicApiOptions"), exports);
@@ -0,0 +1,14 @@
1
+ import { Method } from 'axios';
2
+ import { BaseListResponse, ListParams, ListResponse } from '../models/BaseModels';
3
+ export type RequestFn = <T>(method: Method, path: string, data?: any, params?: any, headers?: Record<string, string>) => Promise<T>;
4
+ export declare abstract class BaseModule {
5
+ protected request: RequestFn;
6
+ protected readonly basePath: string;
7
+ protected readonly version: string;
8
+ constructor(request: RequestFn, basePath: string, version: string);
9
+ protected buildPath(endpoint: string): string;
10
+ protected getList<T>(endpoint: string, params?: ListParams): Promise<BaseListResponse<T>>;
11
+ protected getItemById<T>(endpoint: string, id: string): Promise<T>;
12
+ protected create<TPayload, TResponse>(endpoint: string, payload: TPayload): Promise<TResponse>;
13
+ protected toListResponse<T>(response: BaseListResponse<T>): ListResponse<T>;
14
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseModule = void 0;
4
+ class BaseModule {
5
+ constructor(request, basePath, version) {
6
+ this.request = request;
7
+ this.basePath = basePath;
8
+ this.version = version;
9
+ }
10
+ buildPath(endpoint) {
11
+ return `${this.basePath}/${this.version}/${endpoint}`;
12
+ }
13
+ async getList(endpoint, params) {
14
+ return this.request('GET', this.buildPath(endpoint), undefined, params);
15
+ }
16
+ async getItemById(endpoint, id) {
17
+ return this.request('GET', `${this.buildPath(endpoint)}/${id}`);
18
+ }
19
+ async create(endpoint, payload) {
20
+ return this.request('POST', this.buildPath(endpoint), payload);
21
+ }
22
+ toListResponse(response) {
23
+ const items = [].concat(...Object.values(response._embedded));
24
+ return {
25
+ items,
26
+ total: response.total,
27
+ links: response._links,
28
+ };
29
+ }
30
+ }
31
+ exports.BaseModule = BaseModule;
@@ -0,0 +1,9 @@
1
+ import { ClientFilter, ListResponse, Client, CreateClient, OrganizationFilter, Organization } from '../models';
2
+ import { BaseModule, RequestFn } from './BaseModule';
3
+ export declare class ClientModule extends BaseModule {
4
+ constructor(request: RequestFn);
5
+ getClients(params?: ClientFilter): Promise<ListResponse<Client>>;
6
+ getClientById(id: string): Promise<Client>;
7
+ createClient(data: CreateClient): Promise<Client>;
8
+ getClientOrganizations(clientId: string, params?: OrganizationFilter): Promise<ListResponse<Organization>>;
9
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClientModule = void 0;
4
+ const BaseModule_1 = require("./BaseModule");
5
+ class ClientModule extends BaseModule_1.BaseModule {
6
+ constructor(request) {
7
+ super(request, 'epic/client', 'v1');
8
+ }
9
+ async getClients(params) {
10
+ const response = await this.getList('clients', params);
11
+ return this.toListResponse(response);
12
+ }
13
+ async getClientById(id) {
14
+ return this.getItemById('clients', id);
15
+ }
16
+ async createClient(data) {
17
+ return this.create(`clients`, data);
18
+ }
19
+ async getClientOrganizations(clientId, params) {
20
+ const response = await this.getList(`clients/${clientId}/organizations`, params);
21
+ return this.toListResponse(response);
22
+ }
23
+ }
24
+ exports.ClientModule = ClientModule;
@@ -0,0 +1,8 @@
1
+ import { SubmissionFormDefinition, SubmissionResponsesResult, UpdateSubmissionResponsesPayload, UpdateSubmissionResponsesResult } from '../models';
2
+ import { BaseModule, RequestFn } from './BaseModule';
3
+ export declare class FormModule extends BaseModule {
4
+ constructor(request: RequestFn);
5
+ getFormDefinition(clientId: string, submissionFormPk: string): Promise<SubmissionFormDefinition>;
6
+ getSubmissionResponses(clientId: string, submissionFormPk: string): Promise<SubmissionResponsesResult>;
7
+ updateSubmissionResponses(clientId: string, submissionFormPk: string, data: UpdateSubmissionResponsesPayload): Promise<UpdateSubmissionResponsesResult>;
8
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FormModule = void 0;
4
+ const BaseModule_1 = require("./BaseModule");
5
+ class FormModule extends BaseModule_1.BaseModule {
6
+ constructor(request) {
7
+ super(request, 'pdc', 'v1');
8
+ }
9
+ async getFormDefinition(clientId, submissionFormPk) {
10
+ const response = await this.request('GET', `${this.basePath}/pde/clients/${clientId}/fetch-form/${submissionFormPk}`, undefined, undefined);
11
+ return response.content;
12
+ }
13
+ async getSubmissionResponses(clientId, submissionFormPk) {
14
+ const response = await this.request('GET', `${this.basePath}/pde/clients/${clientId}/form/${submissionFormPk}`, undefined, undefined);
15
+ return response.content;
16
+ }
17
+ async updateSubmissionResponses(clientId, submissionFormPk, data) {
18
+ const response = await this.request('POST', `${this.basePath}/pde/clients/${clientId}/form/${submissionFormPk}/bulk-save-responses`, data, undefined);
19
+ return response.content;
20
+ }
21
+ }
22
+ exports.FormModule = FormModule;
@@ -0,0 +1,11 @@
1
+ import { PolicyFilter, ListResponse, Policy, CreatePolicy, LineFilter, Line, CreateLine } from '../models';
2
+ import { BaseModule, RequestFn } from './BaseModule';
3
+ export declare class PolicyModule extends BaseModule {
4
+ constructor(request: RequestFn);
5
+ getPolicies(params?: PolicyFilter): Promise<ListResponse<Policy>>;
6
+ getPolicyById(id: string): Promise<Policy>;
7
+ createPolicy(data: CreatePolicy): Promise<Policy>;
8
+ getLines(params?: LineFilter): Promise<ListResponse<Line>>;
9
+ getLineById(id: string): Promise<Line>;
10
+ createLine(data: CreateLine): Promise<Line>;
11
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PolicyModule = void 0;
4
+ const BaseModule_1 = require("./BaseModule");
5
+ class PolicyModule extends BaseModule_1.BaseModule {
6
+ constructor(request) {
7
+ super(request, '/epic/policy', 'v2');
8
+ }
9
+ async getPolicies(params) {
10
+ const response = await this.getList('policies', params);
11
+ return this.toListResponse(response);
12
+ }
13
+ async getPolicyById(id) {
14
+ return this.getItemById('policies', id);
15
+ }
16
+ async createPolicy(data) {
17
+ return this.create('policies', data);
18
+ }
19
+ async getLines(params) {
20
+ const response = await this.getList('lines', params);
21
+ return this.toListResponse(response);
22
+ }
23
+ async getLineById(id) {
24
+ return this.getItemById('lines', id);
25
+ }
26
+ async createLine(data) {
27
+ return this.create('lines', data);
28
+ }
29
+ }
30
+ exports.PolicyModule = PolicyModule;
@@ -0,0 +1,29 @@
1
+ import { EpicApiOptions } from '../models';
2
+ import { ClientModule } from '../modules/ClientModule';
3
+ import { FormModule } from '../modules/FormModule';
4
+ import { PolicyModule } from '../modules/PolicyModule';
5
+ export declare class EpicApiService {
6
+ private cemiarLinkClient;
7
+ private tokenClient;
8
+ private cemiarAuthClient;
9
+ private readonly clientId;
10
+ private readonly clientSecret;
11
+ private readonly accountId;
12
+ private readonly language;
13
+ private readonly apiEnv;
14
+ private epicApiToken;
15
+ private cemiarAuthToken;
16
+ private epicApiTokenPromise;
17
+ private cemiarAuthTokenPromise;
18
+ readonly Client: ClientModule;
19
+ readonly Policy: PolicyModule;
20
+ readonly Form: FormModule;
21
+ constructor(clientId: string, clientSecret: string, accountId: string, options: EpicApiOptions);
22
+ private request;
23
+ private getAccessToken;
24
+ private fetchAccessToken;
25
+ private getCemiarAuthAccessToken;
26
+ private fetchCemiarAuthToken;
27
+ private getEnvUrls;
28
+ private getTokenExpiration;
29
+ }
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.EpicApiService = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const ClientModule_1 = require("../modules/ClientModule");
9
+ const FormModule_1 = require("../modules/FormModule");
10
+ const PolicyModule_1 = require("../modules/PolicyModule");
11
+ const DEV_URLS = {
12
+ cemiarLink: 'https://link.cemiar.dev/epic/api',
13
+ cemiarAuth: 'https://www.api.auth.cemiar.dev',
14
+ };
15
+ const PROD_URLS = {
16
+ cemiarLink: 'https://link.cemiar.pro/epic/api',
17
+ cemiarAuth: 'https://api.auth.cemiar.pro',
18
+ };
19
+ class EpicApiService {
20
+ constructor(clientId, clientSecret, accountId, options) {
21
+ var _a, _b, _c;
22
+ var _d, _e;
23
+ this.epicApiToken = null;
24
+ this.cemiarAuthToken = null;
25
+ this.epicApiTokenPromise = null;
26
+ this.cemiarAuthTokenPromise = null;
27
+ this.clientId = clientId;
28
+ this.clientSecret = clientSecret;
29
+ this.accountId = accountId;
30
+ this.language = (_d = options.language) !== null && _d !== void 0 ? _d : 'en-US';
31
+ this.apiEnv = (_e = options.apiEnv) !== null && _e !== void 0 ? _e : 'dev';
32
+ const urls = this.getEnvUrls(options.cemiarLink);
33
+ this.cemiarAuthClient = axios_1.default.create({
34
+ baseURL: urls.cemiarAuth,
35
+ headers: {
36
+ 'Content-Type': 'application/json',
37
+ },
38
+ });
39
+ const cemiarLinkBaseURL = ((_a = options.cemiarLink) === null || _a === void 0 ? void 0 : _a.env) === 'local' ? options.cemiarLink.baseURL : urls.cemiarLink;
40
+ const taskId = ((_b = options.cemiarLink) === null || _b === void 0 ? void 0 : _b.env) !== 'local' ? (_c = options.cemiarLink) === null || _c === void 0 ? void 0 : _c.taskId : undefined;
41
+ this.cemiarLinkClient = axios_1.default.create({
42
+ baseURL: cemiarLinkBaseURL,
43
+ headers: {
44
+ taskId: taskId,
45
+ 'Content-Type': 'application/json',
46
+ 'Accept-Language': this.language,
47
+ },
48
+ });
49
+ this.tokenClient = axios_1.default.create({
50
+ baseURL: cemiarLinkBaseURL,
51
+ headers: {
52
+ 'Content-Type': 'application/json',
53
+ },
54
+ });
55
+ this.cemiarLinkClient.interceptors.request.use(async (config) => {
56
+ const accessToken = await this.getAccessToken();
57
+ config.headers['Authorization'] = `Bearer ${accessToken}`;
58
+ return config;
59
+ });
60
+ this.tokenClient.interceptors.request.use(async (config) => {
61
+ const accessToken = await this.getCemiarAuthAccessToken();
62
+ config.headers['Authorization'] = `Bearer ${accessToken}`;
63
+ return config;
64
+ });
65
+ const requestFn = this.request.bind(this);
66
+ this.Form = new FormModule_1.FormModule(requestFn);
67
+ this.Policy = new PolicyModule_1.PolicyModule(requestFn);
68
+ this.Client = new ClientModule_1.ClientModule(requestFn);
69
+ }
70
+ async request(method, path, data, params, headers) {
71
+ const { data: response } = await this.cemiarLinkClient.request({
72
+ method,
73
+ url: path,
74
+ data,
75
+ params,
76
+ headers,
77
+ });
78
+ return response;
79
+ }
80
+ async getAccessToken() {
81
+ if (this.epicApiToken && this.epicApiToken.expiration.getTime() > Date.now()) {
82
+ return this.epicApiToken.accessToken;
83
+ }
84
+ if (!this.epicApiTokenPromise) {
85
+ this.epicApiTokenPromise = this.fetchAccessToken().finally(() => {
86
+ this.epicApiTokenPromise = null;
87
+ });
88
+ }
89
+ return this.epicApiTokenPromise;
90
+ }
91
+ async fetchAccessToken() {
92
+ const { data } = await this.tokenClient.post(`/token/${this.apiEnv}/${this.accountId}`);
93
+ this.epicApiToken = {
94
+ accessToken: data.access_token,
95
+ tokenType: data.token_type,
96
+ expiration: this.getTokenExpiration(data.expires_in),
97
+ };
98
+ return this.epicApiToken.accessToken;
99
+ }
100
+ async getCemiarAuthAccessToken() {
101
+ if (this.cemiarAuthToken && this.cemiarAuthToken.expiration.getTime() > Date.now()) {
102
+ return this.cemiarAuthToken.accessToken;
103
+ }
104
+ if (!this.cemiarAuthTokenPromise) {
105
+ this.cemiarAuthTokenPromise = this.fetchCemiarAuthToken().finally(() => {
106
+ this.cemiarAuthTokenPromise = null;
107
+ });
108
+ }
109
+ return this.cemiarAuthTokenPromise;
110
+ }
111
+ async fetchCemiarAuthToken() {
112
+ const { data } = await this.cemiarAuthClient.post('auth/service/token', {
113
+ clientId: this.clientId,
114
+ clientSecret: this.clientSecret,
115
+ audiences: ['cemiar'],
116
+ });
117
+ this.cemiarAuthToken = {
118
+ accessToken: data.access_token,
119
+ tokenType: data.token_type,
120
+ expiration: this.getTokenExpiration(data.expires_in),
121
+ };
122
+ return this.cemiarAuthToken.accessToken;
123
+ }
124
+ getEnvUrls(options) {
125
+ if (!!options && options.env === 'prod')
126
+ return PROD_URLS;
127
+ return DEV_URLS;
128
+ }
129
+ getTokenExpiration(expiresIn) {
130
+ return new Date(Date.now() + (expiresIn - 10) * 1000); // Added a 10 second buffer to account for potential clock skew
131
+ }
132
+ }
133
+ exports.EpicApiService = EpicApiService;
@@ -0,0 +1 @@
1
+ export * from './EpicApiService';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./EpicApiService"), exports);
@@ -131,4 +131,5 @@ export interface PolicyProducerBrokerCommission {
131
131
  ProducerBrokerCode: string;
132
132
  ProductionCredit: number;
133
133
  UseCommissionAgreement: boolean;
134
+ ContractID: number | null;
134
135
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cemiar/cemiarlink-sdk",
3
- "version": "1.0.57",
3
+ "version": "1.0.59",
4
4
  "description": "CemiarLink SDK to access CemiarLink API services",
5
5
  "engines": {
6
6
  "npm": ">=9.5.1",
@@ -26,5 +26,17 @@
26
26
  "scripts": {
27
27
  "build": "rm -rf dist/ && tsc -p tsconfig.json",
28
28
  "buildWindows": "rmdir /s /q dist & tsc -p tsconfig.json"
29
+ },
30
+ "exports": {
31
+ ".": {
32
+ "types": "./dist/index.d.ts",
33
+ "import": "./dist/index.js",
34
+ "default": "./dist/index.js"
35
+ },
36
+ "./epic-api": {
37
+ "types": "./dist/epic-api/index.d.ts",
38
+ "import": "./dist/epic-api/index.js",
39
+ "default": "./dist/epic-api/index.js"
40
+ }
29
41
  }
30
42
  }