sysone-api-mapper 1.0.147 → 1.0.149

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 (46) hide show
  1. package/{axiosInstance.js → dist/axiosInstance.js} +5 -7
  2. package/dist/index.d.ts +2 -2
  3. package/{index.ts → dist/index.js} +7 -20
  4. package/dist/services.js +92 -0
  5. package/dist/servicesData.js +996 -0
  6. package/dist/src/adapters/createApiAdapter.js +8 -0
  7. package/{src → dist/src}/adapters/financeAdapter.js +4 -5
  8. package/{src → dist/src}/adapters/locationAdapter.js +5 -6
  9. package/{src → dist/src}/adapters/partyAdapter.js +7 -8
  10. package/{src → dist/src}/components/notificationToast.js +35 -37
  11. package/dist/src/contexts/actionsContext.js +43 -0
  12. package/{src → dist/src}/contexts/apiContext.js +8 -9
  13. package/dist/src/contexts/translationContext.js +19 -0
  14. package/dist/src/mapper/Mapper.js +98 -0
  15. package/{src → dist/src}/mapper/endpointsConfig.js +821 -915
  16. package/{src → dist/src}/mapper/helpers/mappingHelpers.js +24 -26
  17. package/{src → dist/src}/mapper/modules/billing/index.js +128 -131
  18. package/{src → dist/src}/mapper/modules/claim/index.js +15 -17
  19. package/{src → dist/src}/mapper/modules/general/index.js +6 -7
  20. package/{src → dist/src}/mapper/modules/party/index.js +119 -128
  21. package/dist/src/mapper/modules/policy/index.js +573 -0
  22. package/dist/src/mapper/modules/quotation/index.js +477 -0
  23. package/{src → dist/src}/mapper/modules/request/index.js +60 -67
  24. package/dist/src/public/index.js +7 -0
  25. package/{src → dist/src}/server.js +18 -23
  26. package/package.json +4 -4
  27. package/.babelrc +0 -4
  28. package/.gitlab-ci.yml +0 -42
  29. package/config/dist/index.js +0 -307
  30. package/config/dist/index.js.LICENSE.txt +0 -1
  31. package/config/dist/index.ts +0 -319
  32. package/config/webpack.dev.js +0 -63
  33. package/config/webpack.prod.js +0 -63
  34. package/index.d.ts +0 -5
  35. package/services.js +0 -105
  36. package/servicesData.js +0 -1013
  37. package/src/adapters/createApiAdapter.ts +0 -29
  38. package/src/contexts/actionsContext.js +0 -54
  39. package/src/contexts/translationContext.js +0 -29
  40. package/src/mapper/Mapper.js +0 -141
  41. package/src/mapper/modules/policy/index.js +0 -613
  42. package/src/mapper/modules/quotation/index.js +0 -480
  43. package/src/public/index.html +0 -15
  44. package/src/public/index.js +0 -9
  45. package/test/script.js +0 -0
  46. package/tsconfig.json +0 -9
@@ -1,480 +0,0 @@
1
- import { mapPaymentFrequency, mapProductCode } from "../../helpers/mappingHelpers";
2
- import dayjs from 'dayjs';
3
-
4
- const normalizeDateToYYYYMMDD = (date) => {
5
- if (!date) return null;
6
-
7
- const formats = ['DD/MM/YYYY', 'YYYY/MM/DD'];
8
- const parsed = dayjs(date, formats, true);
9
-
10
- return parsed.isValid()
11
- ? parsed.format('YYYY/MM/DD')
12
- : null;
13
- };
14
-
15
- export const getQuotationsList = async (response) => {
16
- const quotations = Array.isArray(response?.quotations)
17
- ? response.quotations.map(q => ({
18
- code: q.code || null,
19
- email: q.email || null,
20
- creationDate: normalizeDateToYYYYMMDD(q.creationDate),
21
- expirationDate: normalizeDateToYYYYMMDD(q.expirationDate),
22
- number: q.number || null,
23
- paymentFrequency: {
24
- name: q.paymentFrequency?.name || null,
25
- code: q.paymentFrequency?.code || null,
26
- },
27
- product: {
28
- code: q.product?.code?.toString() || null,
29
- name: q.product?.name || null,
30
- subsection: {
31
- code: q.product?.subsection?.code || null,
32
- name: q.product?.subsection?.name || null,
33
- section: {
34
- code: q.product?.subsection?.section?.code || null,
35
- name: q.product?.subsection?.section?.name || null,
36
- }
37
- },
38
- version: q.product?.version || 0,
39
- },
40
- status: {
41
- code: q.status?.code || null,
42
- name: q.status?.name || null,
43
- },
44
- }))
45
- : [];
46
-
47
- const total = response?.total ? response.total : 0;
48
-
49
- return {
50
- quotations,
51
- total,
52
- };
53
- };
54
-
55
- export const getQuotationDetail = async (res) => {
56
- const quotation = {
57
- areaCode: res?.areaCode || null,
58
- code: res?.code || null,
59
- commercialStructure: {
60
- data: {
61
- code: null,
62
- description: null,
63
- name: null,
64
- status: {
65
- code: null,
66
- name: null
67
- },
68
- version: 0
69
- },
70
- intermediaries: {
71
- values: []
72
- }
73
- },
74
- creationDate: res?.creationDate || null,
75
- email: res?.email || null,
76
- intermediary: {
77
- code: res?.intermediary?.code || null,
78
- group: {
79
- code: null,
80
- name: null
81
- },
82
- licence: res?.intermediary?.licence || null,
83
- name: res?.intermediary?.name || null,
84
- roles: [
85
- {
86
- code: null,
87
- name: null
88
- }
89
- ],
90
- status: {
91
- code: null,
92
- name: null
93
- }
94
- },
95
- number: res?.number || null,
96
- paymentFrequency: {
97
- code: res?.paymentFrequency?.code || null,
98
- months: res?.paymentFrequency?.months || null,
99
- name: res?.paymentFrequency?.name || null
100
- },
101
- phone: res?.phone || null,
102
- product: {
103
- code: res?.product?.code || null,
104
- currency: {
105
- code: null,
106
- mnemonic: null,
107
- name: null,
108
- symbol: null
109
- },
110
- name: res?.product?.name || null,
111
- status: {
112
- code: null,
113
- name: null
114
- },
115
- subsection: {
116
- code: res?.product?.subsection?.code || null,
117
- name: res?.product?.subsection?.name || null,
118
- section: {
119
- category: null,
120
- code: res?.product?.subsection?.section?.code || null,
121
- name: res?.product?.subsection?.section?.name || null,
122
- type: null
123
- }
124
- },
125
- version: res?.product?.version || 0
126
- },
127
- productSegment: null,
128
- status: {
129
- code: res?.status?.code || null,
130
- name: res?.status?.name || null
131
- },
132
- validity: {
133
- code: null,
134
- months: 0,
135
- name: null
136
- },
137
- values: {
138
- commercialAgreement: {
139
- code: null,
140
- intermediaries: []
141
- },
142
- expenses: [],
143
- groupedEconomicValues: res?.values?.groupedEconomicValues?.map((e) => ({
144
- type: {
145
- code: e?.type?.code || null,
146
- name: e?.type?.name || null
147
- },
148
- value: e?.value || null
149
- })) || [],
150
- risks: res?.values?.risks?.map((risk) => ({
151
- adherents: [],
152
- code: risk?.code || null,
153
- coverages: risk?.coverages?.map((cv) => ({
154
- code: cv?.code || null,
155
- coverageValues: cv?.coverageValues?.map((c) => ({
156
- type: {
157
- code: c?.type?.code || null,
158
- name: c?.type?.name || null
159
- },
160
- value: c?.value || null
161
- })) || [],
162
- deductible: null,
163
- economicValues: [
164
- {
165
- type: {
166
- code: null,
167
- name: null
168
- },
169
- value: 0
170
- }
171
- ],
172
- name: cv?.description || null,
173
- description: cv?.name || null
174
- })) || [],
175
- data: {
176
- city: {
177
- code: risk?.data?.city?.code || null,
178
- name: risk?.data?.city?.name || null,
179
- province: risk?.data?.city?.province || null
180
- },
181
- gender: {
182
- code: risk?.data?.gender?.code || null,
183
- name: risk?.data?.gender?.name || null
184
- },
185
- birthdate: risk?.data?.birthdate || null,
186
- savings: risk?.data?.savings || null,
187
- identification: risk?.data?.identification ?? null,
188
- firstName: risk?.data?.firstName ?? null,
189
- lastName: risk?.data?.lastName ?? null,
190
- spouse: risk?.data?.spouse ?? null,
191
- values: risk?.data?.values || null,
192
- activity: risk?.data?.activity || null,
193
- bloodPressure: risk?.data?.bloodPressure || null,
194
- height: risk?.data?.height || null,
195
- weight: risk?.data?.weight || null,
196
- },
197
- groupedEconomicValues: []
198
- })) || []
199
- }
200
- };
201
-
202
- return quotation;
203
- };
204
-
205
- export const getQuotationByCode = async (response) => {
206
- const objectMapped = {
207
- code: response.quotationNumber?.toString() || null,
208
- number: response.activityCode || 0,
209
- creationDate: response.vigencyDateFrom || null,
210
- expirationDate: response.vigencyDateTo || null,
211
- validity: {
212
- code: "N/A",
213
- name: "N/A",
214
- months: "N/A"
215
- },
216
- status: {
217
- code: "N/A",
218
- name: "N/A"
219
- },
220
- paymentFrequency: {
221
- name: "N/A",
222
- code: "N/A",
223
- months: 0
224
-
225
- },
226
- email: "N/A",
227
- phone: "N/A",
228
- intermediary: {
229
- code: "N/A",
230
- name: "N/A",
231
- roles: {},
232
- },
233
- commercialStructure: {
234
- data: {
235
- name: "N/A",
236
- code: "N/A",
237
- version: 0,
238
- description: "N/A",
239
- status: {
240
- name: "N/A",
241
- code: "N/A"
242
- }
243
- },
244
- intermediaries: {
245
- values: [
246
- {
247
- code: "N/A",
248
- name: "N/A",
249
- licence: "N/A",
250
- role: {
251
- name: "N/A",
252
- code: "N/A"
253
- },
254
- status: {
255
- name: "N/A",
256
- code: "N/A"
257
- },
258
- group: {
259
- name: "N/A",
260
- code: "N/A"
261
- },
262
- }
263
- ]
264
- }
265
- },
266
- product: {
267
- name: "N/A",
268
- code: response?.productCode?.toString() || null,
269
- version: 0,
270
- subsection: {
271
- name: "N/A",
272
- code: "N/A",
273
- section: {
274
- name: "N/A",
275
- code: response?.sectionCode?.toString() || null,
276
- type: {
277
- name: "N/A",
278
- code: "N/A"
279
- },
280
- category: {
281
- name: "N/A",
282
- code: "N/A"
283
- }
284
- }
285
- },
286
- status: {
287
- code: "N/A",
288
- name: "N/A"
289
- },
290
- currency: {
291
- name: "N/A",
292
- code: "N/A",
293
- mnemonic: "N/A",
294
- symbol: "N/A"
295
- }
296
- },
297
- productSegment: {
298
- coverages: [],
299
- expenses: [],
300
- name: "N/A",
301
- code: "N/A",
302
- version: 0,
303
- description: "N/A"
304
- },
305
- values: {
306
- risks: [
307
- {
308
- code: "N/A",
309
- coverages: [
310
- {
311
- code: "N/A",
312
- name: "N/A",
313
- deductible: {
314
- name: "N/A",
315
- code: "N/A",
316
- value: 0,
317
- appliedValue: 0
318
- },
319
- economicValues: [
320
- {
321
- type: {
322
- name: "N/A",
323
- code: "N/A"
324
- },
325
- value: 0
326
- }
327
- ],
328
- coverageValues: [
329
- {
330
- type: {
331
- name: "N/A",
332
- code: "N/A"
333
- },
334
- value: 0
335
- }
336
- ]
337
- }
338
- ],
339
- data: {},
340
- adherents: [
341
- {
342
- code: "N/A",
343
- coverages: [
344
- {
345
- code: "N/A",
346
- name: "N/A",
347
- deductible: {
348
- name: "N/A",
349
- code: "N/A",
350
- value: 0,
351
- appliedValue: 0
352
- },
353
- economicValues: [{
354
- type: "N/A",
355
- code: "N/A"
356
- }],
357
- coverageValues: [{
358
- type: {
359
- name: "N/A",
360
- code: "N/A"
361
- },
362
- value: 0
363
- }]
364
- }
365
- ],
366
- data: {}
367
- }
368
- ]
369
- }
370
- ],
371
- expenses: [
372
- {
373
- type: {
374
- name: "N/A",
375
- code: "N/A"
376
- },
377
- value: 0
378
- }
379
- ],
380
- groupedEconomicValues: [
381
- {
382
- type: {
383
- name: "N/A",
384
- code: "N/A"
385
- },
386
- value: 0
387
- }
388
- ],
389
- commercialAgreement: {}
390
- }
391
- };
392
- return objectMapped;
393
- };
394
-
395
-
396
- export const getQuotationByCode_Request = (inputParams) => {
397
- return {};
398
- }
399
-
400
- export const getQuotations_Request = (inputParams) => {
401
- return {
402
- number: inputParams.quotationNumber || undefined,
403
- from: inputParams.dateFrom || undefined,
404
- to: inputParams.dateTo || undefined,
405
- }
406
- }
407
-
408
- export const quotationStandardPlanCreationMapped = (params) => {
409
- if (!params) return null;
410
-
411
- return {
412
- sectionCode: 17, // no recibe se asigna 17 por defecto
413
- paymentTypeCode: mapPaymentFrequency(params.paymentFrequencyCode),
414
- productCode: mapProductCode(params.productCode),
415
- provinceCode: 1, // no recibe provincia, se asigna 1 por defecto
416
-
417
- };
418
- };
419
-
420
- export const quotationVariablePlanCreationMapped = (params) => {
421
- if (!params) return null;
422
-
423
- return {
424
- sectionCode: 17, // no recibe se asigna 17 por defecto
425
- paymentTypeCode: mapPaymentFrequency(params.paymentFrequencyCode),
426
- productCode: mapProductCode(params.productCode),
427
- provinceCode: 1, // no recibe provincia, se asigna 1 por defecto
428
- birthdate: params.risks[0]?.birthDate,
429
- insuredAmount: params.risks[0]?.coverages[0]?.values.find(v => v.code === "INSURED_AMOUNT")?.value || 0,
430
- };
431
- };
432
-
433
- export const getActivityList = async (response) => {
434
- const objectMapped = {
435
- values: response.activities.map(a => ({
436
- code: a.code,
437
- name: a.name,
438
- })),
439
- }
440
- return objectMapped;
441
- }
442
-
443
- export const getProductsBySubsections = async (response) => {
444
- const objectMapped = {
445
- values: response.products.map(item => ({
446
- name: item.name,
447
- code: item.code,
448
- version: item.version,
449
- subsection: item?.subsection || null,
450
- fieldExclusions: item?.exclusions || null,
451
- fields: item?.fieldValues || item?.fields || null
452
- })),
453
- };
454
- return objectMapped;
455
- };
456
-
457
- export const getProductParameters = async (item) => {
458
-
459
- const objectMapped = {
460
- name: item.name,
461
- code: item.code,
462
- version: item.version,
463
- subsection: item?.subsection || null,
464
- fieldExclusions: item?.exclusions || null,
465
- fields: item?.fields || null
466
- }
467
- return objectMapped;
468
- }
469
-
470
-
471
- export const getPaymentFrecuencies = async (response) => {
472
- const objectMapped = {
473
- frequencies: response.frequencies.map(a => ({
474
- name: a.name,
475
- code: a.code,
476
- months: a.months
477
- })),
478
- }
479
- return objectMapped;
480
- }
@@ -1,15 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>Mi Package NPM</title>
8
- </head>
9
- <body>
10
- <div id="root">
11
-
12
- </div>
13
- <script type="module" src="index.js"></script>
14
- </body>
15
- </html>
@@ -1,9 +0,0 @@
1
- const root = document.getElementById("root")
2
-
3
- const header = document.createElement("h1")
4
- const div = document.createElement("div")
5
-
6
- header.innerHTML = "HOLA"
7
- div.append(header)
8
-
9
- root.append(div)
package/test/script.js DELETED
File without changes
package/tsconfig.json DELETED
@@ -1,9 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "declaration": true,
4
- "outDir": "dist",
5
- "allowJs": true,
6
- "esModuleInterop": true
7
- },
8
- "include": ["src", "index.ts"]
9
- }