@granto-umbrella/umbrella-components 3.0.3 → 3.0.5

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@granto-umbrella/umbrella-components",
3
- "version": "3.0.3",
3
+ "version": "3.0.5",
4
4
  "description": "Umbrella Components for React",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -1,16 +1,16 @@
1
- import styled from "styled-components";
1
+ import styled from 'styled-components';
2
2
  import {
3
3
  semanticSizes,
4
4
  semanticColors,
5
5
  primitiveSizes,
6
6
  typographyTokens,
7
- } from "@granto-umbrella/umbrella-components";
7
+ } from '@granto-umbrella/umbrella-components';
8
8
 
9
9
  export const Container = styled.div`
10
10
  font-size: ${typographyTokens.fontSizes.bodyM};
11
11
  color: ${semanticColors.global.text.default.enabled};
12
- margin-top: calc(${semanticSizes.global.padding["4xl"]} + 111px);
13
- padding-bottom: ${semanticSizes.global.padding["2xl"]};
12
+ margin-top: calc(${semanticSizes.global.padding['4xl']} + 111px);
13
+ padding-bottom: ${semanticSizes.global.padding['2xl']};
14
14
  text-align: center;
15
15
  font-family: ${typographyTokens.fontFamily.base};
16
16
  font-weight: ${typographyTokens.fontWeights.regular};
@@ -19,4 +19,4 @@ export const Container = styled.div`
19
19
  bottom: ${primitiveSizes.size.half};
20
20
  width: ${semanticSizes.global.full};
21
21
  background-color: ${semanticColors.base.background};
22
- `;
22
+ `;
@@ -0,0 +1,54 @@
1
+ // TimeLine.mapper.ts
2
+ import { TimelineItem, TimelineVariant, RemoteEvent } from './TimeLine.types';
3
+
4
+ function toVariant(eventType: string): TimelineVariant {
5
+ if (eventType === 'subscription:partner_subscribe') return 'accepted';
6
+ if (eventType === 'subscription:partner_quote') return 'continued';
7
+ return 'StatusChanged';
8
+ }
9
+
10
+ function buildTitle(ev: RemoteEvent): string {
11
+ const { eventType, data } = ev;
12
+
13
+ if (eventType === 'subscription:partner_subscribe')
14
+ return 'Subscrição realizada';
15
+ if (eventType === 'subscription:partner_quote') return 'Cotação processada';
16
+ if (eventType === 'order:proposal_refused') return 'Proposta recusada';
17
+
18
+ // Fallback genérico
19
+ return data?.title ? String(data.title) : eventType;
20
+ }
21
+
22
+ export function mapRemoteToTimeline(items: RemoteEvent[]): TimelineItem[] {
23
+ return items.map((ev, idx) => {
24
+ const id = ev.correlationId || String(idx);
25
+ const actorName = ev.actor?.name || 'Sistema';
26
+
27
+ return {
28
+ id,
29
+ timestamp: ev.startAt,
30
+ type: toVariant(ev.eventType), // mapeia para seu Dot
31
+ title: buildTitle(ev), // título legível
32
+ description: undefined, // opcional: pode montar aqui
33
+ actor: {
34
+ id: String(ev.actor?.id ?? ''),
35
+ displayName: actorName,
36
+ type: ev.actor?.type ?? 'app',
37
+ },
38
+ origin: ev.parentEventType || ev.eventType,
39
+ correlationId: ev.correlationId,
40
+ metadata: {
41
+ eventType: ev.eventType,
42
+ orderId: ev.data?.orderId,
43
+ insuranceId: ev.data?.insuranceId,
44
+ startAt: ev.startAt,
45
+ endAt: ev.endAt,
46
+ duration: ev.duration,
47
+ parentCorrelationId: ev.parentCorrelationId,
48
+ offers: ev.data?.offers,
49
+ subscriptionPeriod: ev.data?.subscription?.period,
50
+ insuredName: ev.data?.subscription?.insured?.name,
51
+ },
52
+ };
53
+ });
54
+ }
@@ -33,3 +33,76 @@ export interface TimelineMetadata {
33
33
  to?: string;
34
34
  [key: string]: any;
35
35
  }
36
+
37
+ export type RemoteEventType =
38
+ | 'subscription:partner_quote'
39
+ | 'subscription:partner_subscribe'
40
+ | string;
41
+
42
+ export interface RemoteEventActor {
43
+ id: number | string;
44
+ name: string;
45
+ type: 'app' | 'user' | string;
46
+ }
47
+
48
+ export interface RemoteEventData {
49
+ orderId?: string | null;
50
+ title?: string | number | null;
51
+ insuranceId?: string | null;
52
+ subscription?: {
53
+ branch?: number;
54
+ sumInsuredRatio?: number;
55
+ sumContract?: number;
56
+ hasExclusivity?: boolean;
57
+ hasContinuity?: boolean;
58
+ retroactive?: number;
59
+ coverages?: Array<unknown>;
60
+ insured?: {
61
+ name?: string;
62
+ type?: string;
63
+ document?: string;
64
+ address?: {
65
+ cep?: string;
66
+ street?: string;
67
+ number?: number | string;
68
+ locale?: string;
69
+ city?: string;
70
+ uf?: string;
71
+ complement?: string | null;
72
+ };
73
+ };
74
+ contract?: {
75
+ edital?: string | null;
76
+ number?: string | null;
77
+ title?: string | null;
78
+ addition?: string | null;
79
+ object?: string | null;
80
+ process?: string | null;
81
+ signedOn?: string | null;
82
+ };
83
+ event?: unknown;
84
+ startAt?: string | null;
85
+ endAt?: string | null;
86
+ period?: number | null;
87
+ sumInsured?: number | null;
88
+ endosso?: unknown;
89
+ underwriter?: unknown;
90
+ details?: unknown;
91
+ } | null;
92
+ offers?: Array<{ insurerId: number; insurerName: string }> | null;
93
+ upn?: number;
94
+ isApp?: boolean;
95
+ }
96
+
97
+ export interface RemoteEvent {
98
+ eventType: RemoteEventType;
99
+ isPublic: boolean;
100
+ startAt: string; // ISO
101
+ endAt?: string; // ISO
102
+ duration?: number; // ms
103
+ correlationId: string;
104
+ parentCorrelationId?: string;
105
+ parentEventType?: string;
106
+ actor: RemoteEventActor;
107
+ data: RemoteEventData;
108
+ }
@@ -32,7 +32,7 @@ export const Title = styled.h2`
32
32
  flex-direction: row;
33
33
  gap: 8px;
34
34
  align-items: center;
35
- margin-top: -24px;
35
+ margin-top: -2px;
36
36
  `;
37
37
 
38
38
  export const CloseIcon = styled(Dialog.Close)`