@selectwin/kit 0.1.117 → 0.1.118
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/dist/SelectInsight.d.ts +119 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +641 -304
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/** Um valor do achado: `display` para ler, `raw` para gráfico/ordenação (percentual em fração, dinheiro em centavos). */
|
|
3
|
+
export interface SelectInsightValue {
|
|
4
|
+
type: string;
|
|
5
|
+
raw: number | string | readonly string[];
|
|
6
|
+
display: string;
|
|
7
|
+
currency: string | null;
|
|
8
|
+
}
|
|
9
|
+
export interface SelectInsightItem {
|
|
10
|
+
/** `product`, `ad`, `campaign`, `coupon`, `channel`, `network`, `field`, `segment`… */
|
|
11
|
+
kind: string;
|
|
12
|
+
/** O id do recurso quando existe tela para ele (`prd_…`). */
|
|
13
|
+
id: string | null;
|
|
14
|
+
label: string;
|
|
15
|
+
value: SelectInsightValue | null;
|
|
16
|
+
}
|
|
17
|
+
export type SelectInsightBlock = {
|
|
18
|
+
type: 'metric';
|
|
19
|
+
label: string;
|
|
20
|
+
value: SelectInsightValue;
|
|
21
|
+
hint: string | null;
|
|
22
|
+
} | {
|
|
23
|
+
type: 'comparison';
|
|
24
|
+
label: string;
|
|
25
|
+
value: SelectInsightValue;
|
|
26
|
+
baseline: SelectInsightValue;
|
|
27
|
+
baselineLabel: string;
|
|
28
|
+
hint: string | null;
|
|
29
|
+
} | {
|
|
30
|
+
type: 'table';
|
|
31
|
+
title: string;
|
|
32
|
+
columns: ReadonlyArray<{
|
|
33
|
+
key: string;
|
|
34
|
+
label: string;
|
|
35
|
+
}>;
|
|
36
|
+
rows: ReadonlyArray<Record<string, SelectInsightValue>>;
|
|
37
|
+
} | {
|
|
38
|
+
type: 'items';
|
|
39
|
+
title: string;
|
|
40
|
+
items: ReadonlyArray<SelectInsightItem>;
|
|
41
|
+
} | {
|
|
42
|
+
type: 'text';
|
|
43
|
+
text: string;
|
|
44
|
+
};
|
|
45
|
+
export interface SelectInsightAction {
|
|
46
|
+
label: string;
|
|
47
|
+
/** Destino estável (`guide:utm`, `product:prd_…`) ou `null` — conselho sem tela. */
|
|
48
|
+
target: string | null;
|
|
49
|
+
}
|
|
50
|
+
/** O achado como o node o entrega. Campos a mais (id, status, score…) passam sem atrapalhar. */
|
|
51
|
+
export interface SelectInsightData {
|
|
52
|
+
title: string;
|
|
53
|
+
summary: string;
|
|
54
|
+
severity: string;
|
|
55
|
+
confidence?: string | null;
|
|
56
|
+
sampleSize?: number | null;
|
|
57
|
+
kind?: string | null;
|
|
58
|
+
domain?: string | null;
|
|
59
|
+
impact?: {
|
|
60
|
+
currency: string;
|
|
61
|
+
minCents: number;
|
|
62
|
+
maxCents: number;
|
|
63
|
+
} | null;
|
|
64
|
+
period?: {
|
|
65
|
+
start: string;
|
|
66
|
+
end: string;
|
|
67
|
+
} | null;
|
|
68
|
+
methodology?: string | null;
|
|
69
|
+
/** Aceita tipos que esta versão não conhece — são ignorados na renderização. */
|
|
70
|
+
blocks?: ReadonlyArray<SelectInsightBlock | {
|
|
71
|
+
type: string;
|
|
72
|
+
}>;
|
|
73
|
+
actions?: ReadonlyArray<SelectInsightAction>;
|
|
74
|
+
}
|
|
75
|
+
export type SelectInsightLocale = 'pt-BR' | 'en' | 'es';
|
|
76
|
+
export interface SelectInsightLabels {
|
|
77
|
+
severity: Record<string, string>;
|
|
78
|
+
kind: Record<string, string>;
|
|
79
|
+
domain: Record<string, string>;
|
|
80
|
+
confidence: Record<string, string>;
|
|
81
|
+
sample: (n: string) => string;
|
|
82
|
+
/** A faixa já formatada ("R$ 2.038 a R$ 3.962") → a frase do impacto. */
|
|
83
|
+
impact: (range: string) => string;
|
|
84
|
+
/** Impacto com mínimo = máximo — ainda é estimativa, então nunca um número seco. */
|
|
85
|
+
impactAbout: (value: string) => string;
|
|
86
|
+
rangeJoin: string;
|
|
87
|
+
methodology: string;
|
|
88
|
+
actions: string;
|
|
89
|
+
locked: string;
|
|
90
|
+
}
|
|
91
|
+
/** "R$ 2.038 a R$ 3.962" — em reais inteiros: é estimativa, centavo seria falsa precisão. */
|
|
92
|
+
export declare function formatInsightImpact(impact: {
|
|
93
|
+
currency: string;
|
|
94
|
+
minCents: number;
|
|
95
|
+
maxCents: number;
|
|
96
|
+
}, locale?: string, labels?: Pick<SelectInsightLabels, 'impact' | 'impactAbout' | 'rangeJoin'>): string;
|
|
97
|
+
export interface SelectInsightProps {
|
|
98
|
+
insight: SelectInsightData;
|
|
99
|
+
/** Os rótulos do card. O TEXTO do achado já vem traduzido pelo node — passe a mesma língua que pediu a ele. */
|
|
100
|
+
locale?: string;
|
|
101
|
+
labels?: Partial<SelectInsightLabels>;
|
|
102
|
+
/** Fuso do período (o calendário do Lince é o de São Paulo). */
|
|
103
|
+
timeZone?: string;
|
|
104
|
+
/** A isca do plano: só título, resumo e impacto, esmaecidos, com o `lockedCta`. */
|
|
105
|
+
locked?: boolean;
|
|
106
|
+
lockedCta?: ReactNode;
|
|
107
|
+
/** Selos a mais no cabeçalho (no console: o estado do achado, o "o lojista vê travado"). */
|
|
108
|
+
badges?: ReactNode;
|
|
109
|
+
/** Linha a mais no pé do card (no console: o `subjectKey`). */
|
|
110
|
+
footer?: ReactNode;
|
|
111
|
+
/** O rótulo de um item virado link quando houver tela (`product` + `prd_…`). `undefined` = só o texto. */
|
|
112
|
+
renderItem?: (item: SelectInsightItem) => ReactNode | undefined;
|
|
113
|
+
/** Uma ação virada link/botão pelo `target`. `undefined` = só o texto. */
|
|
114
|
+
renderAction?: (action: SelectInsightAction) => ReactNode | undefined;
|
|
115
|
+
/** "Como calculamos" aberto de saída. */
|
|
116
|
+
methodologyOpen?: boolean;
|
|
117
|
+
className?: string;
|
|
118
|
+
}
|
|
119
|
+
export declare function SelectInsight({ insight, locale, labels: labelsOverride, timeZone, locked, lockedCta, badges, footer, renderItem, renderAction, methodologyOpen, className, }: SelectInsightProps): import("react").JSX.Element;
|
package/dist/index.d.ts
CHANGED
|
@@ -96,6 +96,7 @@ export { SelectMoney, SelectSensitiveValue, SelectMetricDelta, SelectHideMoneyTo
|
|
|
96
96
|
export { SelectBalanceCard } from './SelectBalanceCard';
|
|
97
97
|
export { SelectFeeBreakdown } from './SelectFeeBreakdown';
|
|
98
98
|
export { SelectKpiCard } from './SelectKpiCard';
|
|
99
|
+
export { SelectInsight, formatInsightImpact } from './SelectInsight';
|
|
99
100
|
export { SelectChartCard } from './SelectChartCard';
|
|
100
101
|
export { SelectSparkline } from './SelectSparkline';
|
|
101
102
|
export { SelectBarChart } from './SelectBarChart';
|
|
@@ -224,6 +225,7 @@ export type { SelectRowAction } from './SelectRowActions';
|
|
|
224
225
|
export type { SelectStatusMeta } from './SelectStatusBadge';
|
|
225
226
|
export type { SelectTimelineItem, SelectTimelineTone } from './SelectTimeline';
|
|
226
227
|
export type { SelectDataColumn } from './SelectDataTable';
|
|
228
|
+
export type { SelectInsightProps, SelectInsightData, SelectInsightBlock, SelectInsightValue, SelectInsightItem, SelectInsightAction, SelectInsightLabels, SelectInsightLocale, } from './SelectInsight';
|
|
227
229
|
export type { SelectRecordCardProps, SelectRecordCardTone, SelectLayoutThumbProps } from './SelectRecordCard';
|
|
228
230
|
export type { SelectSplitChainProps, SelectSplitNode } from './SelectSplitChain';
|
|
229
231
|
export type { SelectOfferPriceProps } from './SelectOfferPrice';
|