@adatechnology/purchase-ui 0.0.0-stage → 0.1.0

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/README.md CHANGED
@@ -1,3 +1,32 @@
1
- # Temporary Holding Version
1
+ # @adatechnology/purchase-ui
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Telas de Compras em React, por cima das peças e dos tokens do [`recipes-ui`](../recipes-ui) (mesmo idioma, moeda e
4
+ estilo). A API é injetada: o host implementa `PurchaseApi` sobre as rotas do `purchase-module`, e **método ausente =
5
+ botão ausente** (sem `approveOrder`, ninguém aprova por esta tela; sem `previewNfe`, sem importar XML).
6
+
7
+ ```tsx
8
+ import '@adatechnology/recipes-ui/styles.css'
9
+ import '@adatechnology/purchase-ui/styles.css'
10
+ import { RecipesProvider } from '@adatechnology/recipes-ui'
11
+ import { PurchaseOrdersWorkspace, PurchaseProvider, PurchaseSuggestionWorkspace } from '@adatechnology/purchase-ui'
12
+
13
+ <RecipesProvider api={recipesApi} locale="pt-BR" currency="BRL">
14
+ <PurchaseProvider api={purchaseApi}>
15
+ <PurchaseOrdersWorkspace dispatchChannels={capabilities.dispatchChannels} />
16
+ </PurchaseProvider>
17
+ </RecipesProvider>
18
+ ```
19
+
20
+ | Componente | O que faz |
21
+ |---|---|
22
+ | `PurchaseOrdersWorkspace` | lista com busca, situação, "só atrasados", paginação; abre o pedido e o pedido novo |
23
+ | `PurchaseOrderPanel` | linhas, o que falta chegar, totais, ações da situação (aprovar, recusar, enviar, receber, encerrar, cancelar, repetir) e chegadas com "tentar de novo" |
24
+ | `NewOrderDialog` | fornecedor, itens do catálogo dele (preço sugerido = último pago) ou avulsos, previsão |
25
+ | `SendOrderDialog` | texto pronto, canais ligados no host, copiar e marcar como enviado |
26
+ | `ReceiveOrderForm` | conferência parcial com lote, validade, preço, motivo da diferença, frete, parcelas e importação do XML da NF-e |
27
+ | `PurchaseSuggestionWorkspace` | sugestão por fornecedor, marca e cria os rascunhos |
28
+ | `PurchaseSuppliersWorkspace` | fornecedores com condição de pagamento, prazo e pedido mínimo |
29
+ | `PurchaseReportsWorkspace` | gasto por fornecedor/item/mês e entrega dos fornecedores |
30
+
31
+ As funções do rascunho de chegada (`buildReceiveRows`, `applyNfePreview`, `rowDivergence`, `toReceiveInput`) são
32
+ exportadas para quem quiser montar a conferência com o próprio design system.
@@ -0,0 +1,566 @@
1
+ import * as react from 'react';
2
+ import { ReactNode } from 'react';
3
+ import { DispatchChannel, OrderStatus, PurchaseOrderSummary, PurchaseOrder, CreateOrderInput, ReceiveInput, Receipt, NfePreview, PurchaseSuggestion, Supplier, CreateSupplierInput, UpdateSupplierInput, SupplierItem, ReportGroup, SpendReport, SupplierPerformanceReport, Divergence } from '@adatechnology/purchase-contracts';
4
+ import { Paginated } from '@adatechnology/recipe-contracts';
5
+
6
+ var ordersTitle = "Pedidos de compra";
7
+ var newOrder = "Novo pedido";
8
+ var searchOrders = "Número do pedido ou fornecedor";
9
+ var onlyLate = "Só atrasados";
10
+ var status_draft = "Rascunho";
11
+ var status_pending_approval = "Aguardando aprovação";
12
+ var status_approved = "Aprovado";
13
+ var status_sent = "Enviado";
14
+ var status_partially_received = "Recebido em parte";
15
+ var status_received = "Recebido";
16
+ var status_closed = "Encerrado";
17
+ var status_canceled = "Cancelado";
18
+ var payment_none = "Sem conta";
19
+ var payment_open = "A pagar";
20
+ var payment_partial = "Pago em parte";
21
+ var payment_paid = "Pago";
22
+ var late = "Atrasado";
23
+ var columnNumber = "Pedido";
24
+ var columnSupplier = "Fornecedor";
25
+ var columnStatus = "Situação";
26
+ var columnExpectedAt = "Previsto para";
27
+ var columnTotal = "Total";
28
+ var columnPayment = "Pagamento";
29
+ var columnItem = "Item";
30
+ var columnQuantity = "Quantidade";
31
+ var columnPending = "Falta chegar";
32
+ var columnUnitPrice = "Preço";
33
+ var columnLineTotal = "Subtotal";
34
+ var columnReceived = "Chegou";
35
+ var columnBatch = "Lote";
36
+ var columnExpiresAt = "Validade";
37
+ var emptyOrders = "Nenhum pedido ainda. Crie um ou use a sugestão de compra.";
38
+ var loading = "Carregando…";
39
+ var loadError = "Não foi possível carregar.";
40
+ var retry = "Tentar de novo";
41
+ var genericError = "Não deu certo. Tente de novo.";
42
+ var close = "Fechar";
43
+ var cancel = "Cancelar";
44
+ var save = "Salvar";
45
+ var confirm = "Confirmar";
46
+ var orderTitle = "Pedido {number}";
47
+ var subtotal = "Itens";
48
+ var freight = "Frete";
49
+ var discount = "Desconto";
50
+ var total = "Total";
51
+ var paymentTerms = "Condição de pagamento (dias)";
52
+ var paymentTermsHint = "Ex.: 0 à vista, 30/60/90";
53
+ var notes = "Observações";
54
+ var actionSubmit = "Enviar para aprovação";
55
+ var actionApprove = "Aprovar";
56
+ var actionReject = "Recusar";
57
+ var actionSend = "Enviar ao fornecedor";
58
+ var actionReceive = "Registrar chegada";
59
+ var actionClose = "Encerrar com falta";
60
+ var actionCancel = "Cancelar pedido";
61
+ var actionDuplicate = "Repetir pedido";
62
+ var rejectReason = "Motivo da recusa";
63
+ var cancelReason = "Motivo do cancelamento";
64
+ var closeReason = "Motivo (o que faltou não vem mais)";
65
+ var reasonRequired = "Diga o motivo.";
66
+ var approvalNeeded = "Acima do limite: precisa de aprovação de outra pessoa.";
67
+ var rejectedBecause = "Recusado: {reason}";
68
+ var canceledBecause = "Cancelado: {reason}";
69
+ var selfApproval = "Quem fez o pedido não pode aprovar.";
70
+ var sendTitle = "Enviar pedido";
71
+ var channel_whatsapp = "WhatsApp";
72
+ var channel_email = "E-mail";
73
+ var channel_manual = "Copiar o texto";
74
+ var withPrices = "Mostrar os preços no pedido";
75
+ var copyText = "Copiar texto";
76
+ var copied = "Copiado. Cole na conversa com o fornecedor e depois marque como enviado.";
77
+ var markSent = "Marcar como enviado";
78
+ var sentVia = "Enviado por {channel} em {date}";
79
+ var dispatchUnavailable = "Esse canal não está ligado. Copie o texto.";
80
+ var receiveTitle = "Chegada do pedido {number}";
81
+ var receiveHint = "Confira o que chegou. Pode receber só uma parte: o resto continua a caminho.";
82
+ var importNfe = "Importar XML da nota";
83
+ var nfeImported = "Nota {number} de {issuer}: {count} itens conferidos com o pedido.";
84
+ var nfeNotMatched = "{count} itens da nota não casaram com o pedido; confira à mão.";
85
+ var nfeInvalid = "Esse arquivo não é o XML de uma NF-e.";
86
+ var nfeAlreadyReceived = "Essa nota já foi registrada.";
87
+ var invoiceNumber = "Número da nota";
88
+ var invoiceKey = "Chave de acesso (44 dígitos)";
89
+ var installments = "Parcelas";
90
+ var installmentsHint = "Vazio: pela condição do pedido.";
91
+ var installmentLine = "{number}ª em {date}: {amount}";
92
+ var divergenceReason = "Motivo da diferença";
93
+ var divergence_quantity = "Quantidade diferente do pedido";
94
+ var divergence_price = "Preço diferente do pedido";
95
+ var divergence_both = "Quantidade e preço diferentes";
96
+ var nothingToReceive = "Informe a quantidade de ao menos um item.";
97
+ var invalidNumber = "Número inválido.";
98
+ var invoiceTaken = "Essa nota já foi registrada.";
99
+ var received = "Chegada registrada.";
100
+ var receiptsTitle = "Chegadas";
101
+ var noReceipts = "Nada chegou ainda.";
102
+ var integrationFailed = "Estoque ou conta a pagar não foram atualizados.";
103
+ var retryIntegration = "Tentar de novo";
104
+ var stockDone = "Estoque atualizado";
105
+ var payableDone = "Conta a pagar lançada";
106
+ var suggestionTitle = "Sugestão de compra";
107
+ var suggestionHint = "O que está abaixo do mínimo ou falta para a produção, já descontado o que está a caminho.";
108
+ var suggestionEmpty = "Nada a comprar agora.";
109
+ var noSupplier = "Sem fornecedor cadastrado";
110
+ var belowMinimumOrder = "Abaixo do pedido mínimo do fornecedor";
111
+ var columnNeeded = "Precisa";
112
+ var columnOnHand = "Tem";
113
+ var columnIncoming = "A caminho";
114
+ var columnSuggested = "Comprar";
115
+ var estimated = "Estimado";
116
+ var createOrders = "Criar rascunhos dos selecionados";
117
+ var ordersCreated = "{count} rascunho(s) criado(s).";
118
+ var suppliersTitle = "Fornecedores";
119
+ var searchSuppliers = "Nome ou CNPJ";
120
+ var newSupplier = "Novo fornecedor";
121
+ var editSupplier = "Editar fornecedor";
122
+ var supplierName = "Nome";
123
+ var supplierDocument = "CNPJ ou CPF";
124
+ var supplierContact = "Contato";
125
+ var supplierEmail = "E-mail";
126
+ var supplierPhone = "Telefone";
127
+ var supplierWhatsapp = "WhatsApp";
128
+ var supplierLeadTime = "Prazo de entrega (dias)";
129
+ var supplierMinimumOrder = "Pedido mínimo";
130
+ var supplierActive = "Ativo";
131
+ var supplierInactive = "Inativo";
132
+ var documentTaken = "Já existe um fornecedor com esse documento.";
133
+ var requiredField = "Obrigatório.";
134
+ var emptySuppliers = "Nenhum fornecedor ainda.";
135
+ var edit = "Editar";
136
+ var chooseSupplier = "Escolha o fornecedor";
137
+ var addLine = "Adicionar item";
138
+ var removeLine = "Remover";
139
+ var itemName = "Item";
140
+ var purchaseUnit = "Unidade de compra";
141
+ var lastPrice = "Último preço: {price}";
142
+ var noLines = "Adicione ao menos um item.";
143
+ var orderCreated = "Pedido {number} criado.";
144
+ var reportsTitle = "Relatórios de compras";
145
+ var periodFrom = "De";
146
+ var periodTo = "Até";
147
+ var groupBy = "Agrupar por";
148
+ var group_supplier = "Fornecedor";
149
+ var group_item = "Item";
150
+ var group_month = "Mês";
151
+ var columnGroup = "Grupo";
152
+ var columnReceipts = "Chegadas";
153
+ var spendTotal = "Total comprado: {total} em {count} chegada(s)";
154
+ var performanceTitle = "Entrega dos fornecedores";
155
+ var columnOrders = "Pedidos";
156
+ var columnOnTime = "No prazo";
157
+ var columnLate = "Atrasados";
158
+ var columnAverageLate = "Atraso médio (dias)";
159
+ var columnDivergent = "Itens com diferença";
160
+ var emptyReport = "Nada no período.";
161
+ var ptBR = {
162
+ ordersTitle: ordersTitle,
163
+ newOrder: newOrder,
164
+ searchOrders: searchOrders,
165
+ onlyLate: onlyLate,
166
+ status_draft: status_draft,
167
+ status_pending_approval: status_pending_approval,
168
+ status_approved: status_approved,
169
+ status_sent: status_sent,
170
+ status_partially_received: status_partially_received,
171
+ status_received: status_received,
172
+ status_closed: status_closed,
173
+ status_canceled: status_canceled,
174
+ payment_none: payment_none,
175
+ payment_open: payment_open,
176
+ payment_partial: payment_partial,
177
+ payment_paid: payment_paid,
178
+ late: late,
179
+ columnNumber: columnNumber,
180
+ columnSupplier: columnSupplier,
181
+ columnStatus: columnStatus,
182
+ columnExpectedAt: columnExpectedAt,
183
+ columnTotal: columnTotal,
184
+ columnPayment: columnPayment,
185
+ columnItem: columnItem,
186
+ columnQuantity: columnQuantity,
187
+ columnPending: columnPending,
188
+ columnUnitPrice: columnUnitPrice,
189
+ columnLineTotal: columnLineTotal,
190
+ columnReceived: columnReceived,
191
+ columnBatch: columnBatch,
192
+ columnExpiresAt: columnExpiresAt,
193
+ emptyOrders: emptyOrders,
194
+ loading: loading,
195
+ loadError: loadError,
196
+ retry: retry,
197
+ genericError: genericError,
198
+ close: close,
199
+ cancel: cancel,
200
+ save: save,
201
+ confirm: confirm,
202
+ orderTitle: orderTitle,
203
+ subtotal: subtotal,
204
+ freight: freight,
205
+ discount: discount,
206
+ total: total,
207
+ paymentTerms: paymentTerms,
208
+ paymentTermsHint: paymentTermsHint,
209
+ notes: notes,
210
+ actionSubmit: actionSubmit,
211
+ actionApprove: actionApprove,
212
+ actionReject: actionReject,
213
+ actionSend: actionSend,
214
+ actionReceive: actionReceive,
215
+ actionClose: actionClose,
216
+ actionCancel: actionCancel,
217
+ actionDuplicate: actionDuplicate,
218
+ rejectReason: rejectReason,
219
+ cancelReason: cancelReason,
220
+ closeReason: closeReason,
221
+ reasonRequired: reasonRequired,
222
+ approvalNeeded: approvalNeeded,
223
+ rejectedBecause: rejectedBecause,
224
+ canceledBecause: canceledBecause,
225
+ selfApproval: selfApproval,
226
+ sendTitle: sendTitle,
227
+ channel_whatsapp: channel_whatsapp,
228
+ channel_email: channel_email,
229
+ channel_manual: channel_manual,
230
+ withPrices: withPrices,
231
+ copyText: copyText,
232
+ copied: copied,
233
+ markSent: markSent,
234
+ sentVia: sentVia,
235
+ dispatchUnavailable: dispatchUnavailable,
236
+ receiveTitle: receiveTitle,
237
+ receiveHint: receiveHint,
238
+ importNfe: importNfe,
239
+ nfeImported: nfeImported,
240
+ nfeNotMatched: nfeNotMatched,
241
+ nfeInvalid: nfeInvalid,
242
+ nfeAlreadyReceived: nfeAlreadyReceived,
243
+ invoiceNumber: invoiceNumber,
244
+ invoiceKey: invoiceKey,
245
+ installments: installments,
246
+ installmentsHint: installmentsHint,
247
+ installmentLine: installmentLine,
248
+ divergenceReason: divergenceReason,
249
+ divergence_quantity: divergence_quantity,
250
+ divergence_price: divergence_price,
251
+ divergence_both: divergence_both,
252
+ nothingToReceive: nothingToReceive,
253
+ invalidNumber: invalidNumber,
254
+ invoiceTaken: invoiceTaken,
255
+ received: received,
256
+ receiptsTitle: receiptsTitle,
257
+ noReceipts: noReceipts,
258
+ integrationFailed: integrationFailed,
259
+ retryIntegration: retryIntegration,
260
+ stockDone: stockDone,
261
+ payableDone: payableDone,
262
+ suggestionTitle: suggestionTitle,
263
+ suggestionHint: suggestionHint,
264
+ suggestionEmpty: suggestionEmpty,
265
+ noSupplier: noSupplier,
266
+ belowMinimumOrder: belowMinimumOrder,
267
+ columnNeeded: columnNeeded,
268
+ columnOnHand: columnOnHand,
269
+ columnIncoming: columnIncoming,
270
+ columnSuggested: columnSuggested,
271
+ estimated: estimated,
272
+ createOrders: createOrders,
273
+ ordersCreated: ordersCreated,
274
+ suppliersTitle: suppliersTitle,
275
+ searchSuppliers: searchSuppliers,
276
+ newSupplier: newSupplier,
277
+ editSupplier: editSupplier,
278
+ supplierName: supplierName,
279
+ supplierDocument: supplierDocument,
280
+ supplierContact: supplierContact,
281
+ supplierEmail: supplierEmail,
282
+ supplierPhone: supplierPhone,
283
+ supplierWhatsapp: supplierWhatsapp,
284
+ supplierLeadTime: supplierLeadTime,
285
+ supplierMinimumOrder: supplierMinimumOrder,
286
+ supplierActive: supplierActive,
287
+ supplierInactive: supplierInactive,
288
+ documentTaken: documentTaken,
289
+ requiredField: requiredField,
290
+ emptySuppliers: emptySuppliers,
291
+ edit: edit,
292
+ chooseSupplier: chooseSupplier,
293
+ addLine: addLine,
294
+ removeLine: removeLine,
295
+ itemName: itemName,
296
+ purchaseUnit: purchaseUnit,
297
+ lastPrice: lastPrice,
298
+ noLines: noLines,
299
+ orderCreated: orderCreated,
300
+ reportsTitle: reportsTitle,
301
+ periodFrom: periodFrom,
302
+ periodTo: periodTo,
303
+ groupBy: groupBy,
304
+ group_supplier: group_supplier,
305
+ group_item: group_item,
306
+ group_month: group_month,
307
+ columnGroup: columnGroup,
308
+ columnReceipts: columnReceipts,
309
+ spendTotal: spendTotal,
310
+ performanceTitle: performanceTitle,
311
+ columnOrders: columnOrders,
312
+ columnOnTime: columnOnTime,
313
+ columnLate: columnLate,
314
+ columnAverageLate: columnAverageLate,
315
+ columnDivergent: columnDivergent,
316
+ emptyReport: emptyReport
317
+ };
318
+
319
+ /**
320
+ * Copyright (c) 2026 Ada Technology. MIT License.
321
+ */
322
+
323
+ type PurchaseMessages = typeof ptBR;
324
+ type PurchaseLocale = 'pt-BR' | 'en';
325
+ declare function resolvePurchaseMessages(locale: string): PurchaseMessages;
326
+
327
+ /**
328
+ * Copyright (c) 2026 Ada Technology. MIT License.
329
+ *
330
+ * O host implementa sobre as rotas do `purchase-module`. Método ausente = ação ausente na tela (sem `approveOrder`,
331
+ * sem botão de aprovar; sem `previewNfe`, sem importar XML).
332
+ */
333
+
334
+ type PurchaseCapabilities = {
335
+ readonly stock: boolean;
336
+ readonly payables: boolean;
337
+ readonly demand: boolean;
338
+ readonly catalog: boolean;
339
+ readonly dispatchChannels: readonly DispatchChannel[];
340
+ };
341
+ type PurchaseApi = {
342
+ getCapabilities?(): Promise<PurchaseCapabilities>;
343
+ listOrders(params: {
344
+ readonly page: number;
345
+ readonly pageSize: number;
346
+ readonly status?: readonly OrderStatus[];
347
+ readonly supplierId?: string;
348
+ readonly lateOnly?: boolean;
349
+ readonly search?: string;
350
+ }): Promise<Paginated<PurchaseOrderSummary>>;
351
+ getOrder(id: string): Promise<PurchaseOrder>;
352
+ createOrder?(input: CreateOrderInput): Promise<PurchaseOrder>;
353
+ submitOrder?(id: string): Promise<PurchaseOrder>;
354
+ approveOrder?(id: string): Promise<PurchaseOrder>;
355
+ rejectOrder?(id: string, reason: string): Promise<PurchaseOrder>;
356
+ /** Texto pronto do pedido (para copiar ou conferir antes de enviar). */
357
+ getOrderMessage?(id: string, params: {
358
+ readonly withPrices: boolean;
359
+ }): Promise<{
360
+ readonly text: string;
361
+ }>;
362
+ sendOrder?(id: string, params: {
363
+ readonly channel: DispatchChannel;
364
+ readonly withPrices: boolean;
365
+ }): Promise<PurchaseOrder>;
366
+ cancelOrder?(id: string, reason: string): Promise<PurchaseOrder>;
367
+ closeOrder?(id: string, reason?: string): Promise<PurchaseOrder>;
368
+ duplicateOrder?(id: string): Promise<PurchaseOrder>;
369
+ receiveOrder?(orderId: string, input: ReceiveInput): Promise<Receipt>;
370
+ listReceipts?(params: {
371
+ readonly orderId?: string;
372
+ readonly page: number;
373
+ readonly pageSize: number;
374
+ }): Promise<Paginated<Receipt>>;
375
+ retryReceipt?(id: string): Promise<Receipt>;
376
+ previewNfe?(input: {
377
+ readonly xml: string;
378
+ readonly orderId?: string;
379
+ }): Promise<NfePreview>;
380
+ getSuggestion?(params: {
381
+ readonly supplierId?: string;
382
+ }): Promise<PurchaseSuggestion>;
383
+ createOrdersFromSuggestion?(input: {
384
+ readonly supplierIds?: readonly string[];
385
+ readonly expectedAt?: string | null;
386
+ }): Promise<readonly PurchaseOrder[]>;
387
+ listSuppliers(params: {
388
+ readonly page: number;
389
+ readonly pageSize: number;
390
+ readonly search?: string;
391
+ readonly isActive?: boolean;
392
+ }): Promise<Paginated<Supplier>>;
393
+ createSupplier?(input: CreateSupplierInput): Promise<Supplier>;
394
+ updateSupplier?(id: string, input: UpdateSupplierInput): Promise<Supplier>;
395
+ listSupplierItems?(supplierId: string): Promise<readonly SupplierItem[]>;
396
+ getSpendReport?(query: {
397
+ readonly from: string;
398
+ readonly to: string;
399
+ readonly groupBy: ReportGroup;
400
+ }): Promise<SpendReport>;
401
+ getSupplierPerformance?(query: {
402
+ readonly from: string;
403
+ readonly to: string;
404
+ }): Promise<SupplierPerformanceReport>;
405
+ };
406
+
407
+ type PurchaseProviderProps = {
408
+ readonly api: PurchaseApi;
409
+ readonly messages?: Partial<PurchaseMessages>;
410
+ readonly children: ReactNode;
411
+ };
412
+ declare function PurchaseProvider({ api, messages, children }: PurchaseProviderProps): react.JSX.Element;
413
+ declare function usePurchaseApi(): PurchaseApi;
414
+ type PurchaseText = {
415
+ readonly messages: PurchaseMessages;
416
+ readonly locale: string;
417
+ readonly currency: string;
418
+ readonly format: (key: keyof PurchaseMessages, values: Readonly<Record<string, string | number>>) => string;
419
+ };
420
+ declare function usePurchaseText(): PurchaseText;
421
+
422
+ type PurchaseOrdersWorkspaceProps = {
423
+ /** Canais de envio ligados no host (`capabilities.dispatchChannels`). */
424
+ readonly dispatchChannels?: readonly DispatchChannel[];
425
+ };
426
+ declare function PurchaseOrdersWorkspace({ dispatchChannels }: PurchaseOrdersWorkspaceProps): react.JSX.Element;
427
+
428
+ type PurchaseOrderPanelProps = {
429
+ readonly orderId: string;
430
+ /** Canais de envio ligados no host; padrão: só copiar o texto. */
431
+ readonly dispatchChannels?: readonly DispatchChannel[];
432
+ readonly onChanged?: (order: PurchaseOrder) => void;
433
+ /** Pedido novo criado por "repetir pedido". */
434
+ readonly onDuplicated?: (order: PurchaseOrder) => void;
435
+ readonly onClose: () => void;
436
+ };
437
+ declare function PurchaseOrderPanel(props: PurchaseOrderPanelProps): react.JSX.Element;
438
+
439
+ type NewOrderDialogProps = {
440
+ readonly supplierId?: string;
441
+ readonly onCreated: (order: PurchaseOrder) => void;
442
+ readonly onCancel: () => void;
443
+ };
444
+ declare function NewOrderDialog({ supplierId: initialSupplier, onCreated, onCancel }: NewOrderDialogProps): react.JSX.Element;
445
+
446
+ type SendOrderDialogProps = {
447
+ readonly order: PurchaseOrder;
448
+ /** Canais que o host ligou (`capabilities.dispatchChannels`); `manual` está sempre disponível. */
449
+ readonly channels: readonly DispatchChannel[];
450
+ readonly onSent: (order: PurchaseOrder) => void;
451
+ readonly onCancel: () => void;
452
+ };
453
+ declare function SendOrderDialog({ order, channels, onSent, onCancel }: SendOrderDialogProps): react.JSX.Element;
454
+
455
+ type ReceiveOrderFormProps = {
456
+ readonly order: PurchaseOrder;
457
+ readonly onReceived: (receipt: Receipt) => void;
458
+ readonly onCancel: () => void;
459
+ };
460
+ declare function ReceiveOrderForm({ order, onReceived, onCancel }: ReceiveOrderFormProps): react.JSX.Element;
461
+
462
+ /**
463
+ * Copyright (c) 2026 Ada Technology. MIT License.
464
+ *
465
+ * Pede o motivo antes de recusar, cancelar ou encerrar um pedido.
466
+ */
467
+ type ReasonDialogProps = {
468
+ readonly title: string;
469
+ readonly label: string;
470
+ readonly isRequired?: boolean;
471
+ readonly isDanger?: boolean;
472
+ readonly onConfirm: (reason: string) => Promise<void> | void;
473
+ readonly onCancel: () => void;
474
+ };
475
+ declare function ReasonDialog({ title, label, isRequired, isDanger, onConfirm, onCancel }: ReasonDialogProps): react.JSX.Element;
476
+
477
+ declare function OrderStatusChip({ status, isLate }: {
478
+ readonly status: OrderStatus;
479
+ readonly isLate?: boolean;
480
+ }): react.JSX.Element;
481
+
482
+ type PurchaseSuggestionWorkspaceProps = {
483
+ readonly onOrdersCreated?: (orders: readonly PurchaseOrder[]) => void;
484
+ };
485
+ declare function PurchaseSuggestionWorkspace({ onOrdersCreated }: PurchaseSuggestionWorkspaceProps): react.JSX.Element;
486
+
487
+ /**
488
+ * Copyright (c) 2026 Ada Technology. MIT License.
489
+ *
490
+ * Fornecedores de Compras: busca por nome ou documento, condição de pagamento e prazo à vista, criar e editar quando
491
+ * o host liga os métodos. Com Compras ligado, é esta a tela de fornecedores (a do estoque fica só leitura).
492
+ */
493
+ declare function PurchaseSuppliersWorkspace(): react.JSX.Element;
494
+
495
+ type PurchaseSupplierDialogProps = {
496
+ readonly supplier?: Supplier;
497
+ readonly onSaved: (supplier: Supplier) => void;
498
+ readonly onCancel: () => void;
499
+ };
500
+ declare function PurchaseSupplierDialog({ supplier, onSaved, onCancel }: PurchaseSupplierDialogProps): react.JSX.Element;
501
+
502
+ /**
503
+ * Copyright (c) 2026 Ada Technology. MIT License.
504
+ *
505
+ * Quanto se comprou no período (por fornecedor, item ou mês) e como cada fornecedor entregou (no prazo, atraso
506
+ * médio, itens com diferença).
507
+ */
508
+ declare function PurchaseReportsWorkspace(): react.JSX.Element;
509
+
510
+ /**
511
+ * Copyright (c) 2026 Ada Technology. MIT License.
512
+ *
513
+ * Rascunho da conferência de chegada: começa com o que falta chegar de cada linha, a NF-e preenche quantidade,
514
+ * preço, lote e validade, e vira o `ReceiveInput` do módulo só com as linhas que chegaram.
515
+ */
516
+
517
+ type ReceiveRow = {
518
+ readonly orderLineId: string;
519
+ readonly itemName: string;
520
+ readonly purchaseUnit: string;
521
+ readonly orderedPrice: string;
522
+ readonly pendingQuantity: string;
523
+ /** Texto do contrato (ponto decimal) ou vazio = não chegou. */
524
+ readonly quantity: string;
525
+ readonly unitPrice: string;
526
+ readonly batchCode: string;
527
+ readonly expiresAt: string;
528
+ readonly divergenceReason: string;
529
+ };
530
+ type ReceiveExtras = {
531
+ readonly invoiceNumber: string;
532
+ readonly invoiceKey: string;
533
+ readonly freight: string;
534
+ readonly discount: string;
535
+ readonly notes: string;
536
+ readonly installments: readonly {
537
+ readonly dueDate: string;
538
+ readonly amount: string;
539
+ }[];
540
+ };
541
+ declare function buildReceiveRows(order: PurchaseOrder): ReceiveRow[];
542
+ /** Preenche com a nota as linhas que ela casou; devolve também quantas linhas da nota ficaram sem par. */
543
+ declare function applyNfePreview(rows: readonly ReceiveRow[], preview: NfePreview): {
544
+ readonly rows: ReceiveRow[];
545
+ readonly unmatched: number;
546
+ readonly matched: number;
547
+ };
548
+ declare function rowDivergence(row: ReceiveRow): Divergence;
549
+ declare function toReceiveInput(params: {
550
+ readonly rows: readonly ReceiveRow[];
551
+ readonly extras: ReceiveExtras;
552
+ readonly idempotencyKey: string;
553
+ }): ReceiveInput | null;
554
+
555
+ /**
556
+ * Copyright (c) 2026 Ada Technology. MIT License.
557
+ */
558
+ /** `yyyy-mm-dd` → data curta do idioma, sem o fuso do navegador mexer no dia. */
559
+ declare function formatCivilDate(value: string | null, locale: string): string;
560
+ /** Primeiro dia do mês e hoje, em `yyyy-mm-dd`, no relógio do navegador. */
561
+ declare function monthToDate(now?: Date): {
562
+ readonly from: string;
563
+ readonly to: string;
564
+ };
565
+
566
+ export { NewOrderDialog, type NewOrderDialogProps, OrderStatusChip, type PurchaseApi, type PurchaseCapabilities, type PurchaseLocale, type PurchaseMessages, PurchaseOrderPanel, type PurchaseOrderPanelProps, PurchaseOrdersWorkspace, type PurchaseOrdersWorkspaceProps, PurchaseProvider, type PurchaseProviderProps, PurchaseReportsWorkspace, PurchaseSuggestionWorkspace, type PurchaseSuggestionWorkspaceProps, PurchaseSupplierDialog, type PurchaseSupplierDialogProps, PurchaseSuppliersWorkspace, type PurchaseText, ReasonDialog, type ReasonDialogProps, type ReceiveExtras, ReceiveOrderForm, type ReceiveOrderFormProps, type ReceiveRow, SendOrderDialog, type SendOrderDialogProps, applyNfePreview, buildReceiveRows, formatCivilDate, monthToDate, resolvePurchaseMessages, rowDivergence, toReceiveInput, usePurchaseApi, usePurchaseText };