@granto-umbrella/umbrella-components 3.0.4 → 3.0.6

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.4",
3
+ "version": "3.0.6",
4
4
  "description": "Umbrella Components for React",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -7,7 +7,7 @@ import {
7
7
  } from '@granto-umbrella/umbrella-components';
8
8
 
9
9
  export const Container = styled.div`
10
- font-size: ${typographyTokens.fontSizes.bodyS};
10
+ font-size: ${typographyTokens.fontSizes.bodyM};
11
11
  color: ${semanticColors.global.text.default.enabled};
12
12
  margin-top: calc(${semanticSizes.global.padding['4xl']} + 111px);
13
13
  padding-bottom: ${semanticSizes.global.padding['2xl']};
@@ -0,0 +1,55 @@
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
+ if (eventType === 'order:proposal_refused') return 'rejected';
8
+ return 'continued';
9
+ }
10
+
11
+ function buildTitle(ev: RemoteEvent): string {
12
+ const { eventType, data } = ev;
13
+
14
+ if (eventType === 'subscription:partner_subscribe')
15
+ return 'Subscrição realizada';
16
+ if (eventType === 'subscription:partner_quote') return 'Cotação processada';
17
+ if (eventType === 'order:proposal_refused') return 'Proposta recusada';
18
+
19
+ // Fallback genérico
20
+ return data?.title ? String(data.title) : eventType;
21
+ }
22
+
23
+ export function mapRemoteToTimeline(items: RemoteEvent[]): TimelineItem[] {
24
+ return items.map((ev, idx) => {
25
+ const id = ev.correlationId || String(idx);
26
+ const actorName = ev.actor?.name || 'Sistema';
27
+
28
+ return {
29
+ id,
30
+ timestamp: ev.startAt,
31
+ type: toVariant(ev.eventType),
32
+ title: buildTitle(ev),
33
+ description: undefined,
34
+ actor: {
35
+ id: String(ev.actor?.id ?? ''),
36
+ displayName: actorName,
37
+ type: ev.actor?.type ?? 'app',
38
+ },
39
+ origin: ev.parentEventType || ev.eventType,
40
+ correlationId: ev.correlationId,
41
+ metadata: {
42
+ eventType: ev.eventType,
43
+ orderId: ev.data?.orderId,
44
+ insuranceId: ev.data?.insuranceId,
45
+ startAt: ev.startAt,
46
+ endAt: ev.endAt,
47
+ duration: ev.duration,
48
+ parentCorrelationId: ev.parentCorrelationId,
49
+ offers: ev.data?.offers,
50
+ subscriptionPeriod: ev.data?.subscription?.period,
51
+ insuredName: ev.data?.subscription?.insured?.name,
52
+ },
53
+ };
54
+ });
55
+ }
@@ -24,11 +24,11 @@ export const ItemWrap = styled.li`
24
24
  content: '';
25
25
  position: absolute;
26
26
  left: 11px;
27
- top: 32px;
27
+ top: 34px;
28
28
  bottom: 0;
29
29
  width: 2px;
30
30
  height: 100%;
31
- background-color: ${primitiveColors.gray[100]};
31
+ background-color: ${primitiveColors.gray[200]};
32
32
  }
33
33
  `;
34
34
 
@@ -41,46 +41,40 @@ export const Dot = styled.span<{
41
41
  border: 1px solid;
42
42
  display: inline-block;
43
43
  margin-top: 0.2rem;
44
- ${({ $variant = 'StatusChanged' }) => {
44
+ ${({ $variant = 'continued' }) => {
45
45
  const map: Record<TimelineVariant, ReturnType<typeof css>> = {
46
- StatusChanged: css`
46
+ continued: css`
47
47
  background: ${semanticColors.branding.surface.disabled};
48
48
  `,
49
49
  accepted: css`
50
- background: #3dcb2c;
51
- `,
52
- continued: css`
53
- background: #f59e0b;
50
+ background: ${semanticColors.global.surface.status.online};
54
51
  `,
55
52
  rejected: css`
56
- background: #cb2c2d;
53
+ background: ${semanticColors.global.surface.status.notification};
57
54
  `,
58
55
  download: css`
59
- background: #9ca3af;
56
+ background: ${semanticColors.branding.surface.disabled};
60
57
  `,
61
58
  };
62
- return map[$variant as TimelineVariant] ?? map['StatusChanged'];
59
+ return map[$variant as TimelineVariant] ?? map['continued'];
63
60
  }}
64
61
 
65
- ${({ $variant = 'StatusChanged' }) => {
62
+ ${({ $variant = 'continued' }) => {
66
63
  const map: Record<TimelineVariant, ReturnType<typeof css>> = {
67
- StatusChanged: css`
64
+ continued: css`
68
65
  border-color: ${semanticColors.branding.surface.enabled};
69
66
  `,
70
67
  accepted: css`
71
- border-color: #21731c;
72
- `,
73
- continued: css`
74
- border-color: #f59e0b;
68
+ border-color: ${semanticColors.global.border.feedback.success};
75
69
  `,
76
70
  rejected: css`
77
- border-color: #731c1c;
71
+ border-color: ${semanticColors.global.border.feedback.error};
78
72
  `,
79
73
  download: css`
80
- border-color: #9ca3af;
74
+ border-color: ${semanticColors.branding.surface.enabled};
81
75
  `,
82
76
  };
83
- return map[$variant as TimelineVariant] ?? map['StatusChanged'];
77
+ return map[$variant as TimelineVariant] ?? map['continued'];
84
78
  }}
85
79
  `;
86
80
 
@@ -1,6 +1,5 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
2
  export type TimelineVariant =
3
- | 'StatusChanged'
4
3
  | 'accepted'
5
4
  | 'continued'
6
5
  | 'rejected'
@@ -33,3 +32,77 @@ export interface TimelineMetadata {
33
32
  to?: string;
34
33
  [key: string]: any;
35
34
  }
35
+
36
+ export type RemoteEventType =
37
+ | 'subscription:partner_quote'
38
+ | 'subscription:partner_subscribe'
39
+ | 'order:proposal_refused'
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)`
@@ -1,17 +0,0 @@
1
- import { TimelineVariant } from '@/components/molecules/TimeLine/TimeLine.types';
2
-
3
- export function labelFromVariant(v?: TimelineVariant) {
4
- switch (v) {
5
- case 'accepted':
6
- return 'Proposta aceita';
7
- case 'continued':
8
- return 'Continuação';
9
- case 'rejected':
10
- return 'Recusada';
11
- case 'download':
12
- return 'Download';
13
- case 'StatusChanged':
14
- default:
15
- return 'Status Alterado';
16
- }
17
- }