@proef/common-ui 2.6.43 → 2.6.45

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.
@@ -60,8 +60,25 @@ declare module 'axios' {
60
60
  }
61
61
  }
62
62
  export declare const INBOX_SAVED_AT_HEADER = "x-inbox-saved-at";
63
+ export type InboxRead = {
64
+ found: false;
65
+ } | {
66
+ found: true;
67
+ status: number;
68
+ body: unknown;
69
+ savedAt: string;
70
+ };
63
71
  export declare function connectInbox(api: AxiosInstance, options: InboxConnectOptions): void;
64
72
  export declare function inboxSavedAt(response: AxiosResponse): string | null;
73
+ /**
74
+ * O que a app tem guardado para um pedido (ex: para mostrar a quem usa o que
75
+ * está no telemóvel). `address` é o endereço da API por inteiro (com
76
+ * `https://`); `path` é o resto. Fora da app, `null`.
77
+ */
78
+ export declare function readInbox(options: InboxOptions & {
79
+ address: string;
80
+ path: string;
81
+ }): Promise<InboxRead | null>;
65
82
  export declare function inboxStatus(options: InboxOptions & {
66
83
  inboxId: string;
67
84
  }): Promise<InboxStatus | null>;
@@ -25,6 +25,10 @@ export type OutboxActionStatus = {
25
25
  reason?: string;
26
26
  method?: string;
27
27
  path?: string;
28
+ /** Os cabeçalhos guardados com a escrita (nunca o token). */
29
+ headers?: Record<string, string>;
30
+ /** O que vai ser enviado. */
31
+ body?: unknown;
28
32
  };
29
33
  export type OutboxWatch = {
30
34
  actions: OutboxActionStatus[];
@@ -1,2 +1,7 @@
1
1
  import { type OrientacaoEcra } from './frame';
2
+ /**
3
+ * Pede à app uma orientação enquanto o ecrã está montado (ex: 'paisagem'
4
+ * numa tabela larga). Ao sair, volta a retrato: na app os portais ficam em
5
+ * retrato, salvo quando um ecrã pede outra coisa.
6
+ */
2
7
  export declare function useOrientacaoNaApp(modo: OrientacaoEcra): void;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { type OfflineBoxesLabels, type OfflineSavedSummary, type OfflineWrite, type OfflineWriteDescription } from './OfflineBoxesView';
3
- export { DEFAULT_OFFLINE_BOXES_LABELS, type OfflineBoxesLabels, type OfflineSavedItem, type OfflineSavedSummary, type OfflineSavedTag, type OfflineWrite, type OfflineWriteDescription, } from './OfflineBoxesView';
3
+ export { DEFAULT_OFFLINE_BOXES_LABELS, type OfflineBoxesLabels, type OfflineSavedItem, type OfflineSavedPart, type OfflineSavedSummary, type OfflineSavedTag, type OfflineWrite, type OfflineWriteDescription, } from './OfflineBoxesView';
4
4
  export interface OfflineBoxesProps {
5
5
  /** O mesmo `storageId` do `connectOutbox` e do `connectInbox`. */
6
6
  storageId: string | undefined;
@@ -24,7 +24,8 @@ export interface OfflineBoxesProps {
24
24
  * enviar (Outbox, laranja), num botão que se põe onde se quiser (ex: à
25
25
  * direita do título): o ícone e uma pílula com duas metades, a percentagem
26
26
  * guardada (sobe enquanto a descarga corre) e quantas escritas faltam enviar. Tocar abre a vista inteira
27
- * com o detalhe. Fora da app OnePoint não aparece.
27
+ * com o detalhe; nela, tocar numa linha guardada mostra o que está guardado
28
+ * por inteiro (JSON). Fora da app OnePoint não aparece.
28
29
  */
29
30
  export default function OfflineBoxes({ storageId, inboxIds, onRefresh, address, subtitle, describeSaved, describeWrite, labels, className }: OfflineBoxesProps): React.JSX.Element | null;
30
31
  export { OfflineBoxes };
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { OfflineBoxesState } from '../../../capabilities/onepoint-rn/useOfflineBoxes';
3
+ import type { InboxRead } from '../../../capabilities/onepoint-rn/connectInbox';
3
4
  export interface OfflineBoxesLabels {
4
5
  /** Nome da vista (para leitores de ecrã e o botão). */
5
6
  title: string;
@@ -38,6 +39,20 @@ export interface OfflineBoxesLabels {
38
39
  allSent: string;
39
40
  /** Escritas recusadas, no cartão da Outbox, com `{n}`. */
40
41
  rejectedCount: string;
42
+ /** Botão de uma linha guardada, com `{title}`. */
43
+ openSaved: string;
44
+ /** Mostrar o JSON de uma parte. */
45
+ showJson: string;
46
+ /** Esconder o JSON de uma parte. */
47
+ hideJson: string;
48
+ copy: string;
49
+ copied: string;
50
+ /** A ler uma parte do telemóvel. */
51
+ reading: string;
52
+ /** A parte não está no telemóvel. */
53
+ notOnPhone: string;
54
+ /** Quando foi guardada, com `{date}` e `{time}`. */
55
+ savedOn: string;
41
56
  }
42
57
  export declare const DEFAULT_OFFLINE_BOXES_LABELS: OfflineBoxesLabels;
43
58
  /** Uma marca curta numa linha guardada (ex: `{ short: 'F', label: 'Ficha' }`). */
@@ -46,6 +61,12 @@ export interface OfflineSavedTag {
46
61
  label: string;
47
62
  }
48
63
  /** Uma linha da lista do que está guardado, como o portal a quer mostrar. */
64
+ /** Uma parte guardada de uma linha (ex: `{ label: 'Ficha', path: '/ajustes/7285650015' }`), que se pode abrir. */
65
+ export interface OfflineSavedPart {
66
+ label: string;
67
+ /** O endereço guardado, sem o `address` à frente. */
68
+ path: string;
69
+ }
49
70
  export interface OfflineSavedItem {
50
71
  key: string;
51
72
  title: string;
@@ -54,12 +75,18 @@ export interface OfflineSavedItem {
54
75
  /** Por baixo do título (ex: a descrição). */
55
76
  detail?: string;
56
77
  tags?: OfflineSavedTag[];
78
+ /** O que está guardado para esta linha; com elas, tocar na linha mostra cada uma por inteiro. */
79
+ parts?: OfflineSavedPart[];
80
+ /** O tipo de dados (ex: 'OTs', 'Listas'): linhas do mesmo grupo aparecem juntas, debaixo de um título com quantas são. */
81
+ group?: string;
57
82
  }
58
83
  /** O que o portal faz dos endereços guardados. */
59
84
  export interface OfflineSavedSummary {
60
85
  items: OfflineSavedItem[];
61
86
  /** Linha no fim da lista (ex: o que também está guardado e não é item). */
62
87
  note?: string;
88
+ /** O número da linha "{n} guardados" (ex: só as OTs, sem as listas). Sem ele, conta todas as linhas. */
89
+ count?: number;
63
90
  }
64
91
  /** Uma escrita por enviar, em palavras do portal. */
65
92
  export interface OfflineWriteDescription {
@@ -79,6 +106,8 @@ export interface OfflineBoxesViewProps {
79
106
  onBack: () => void;
80
107
  describeSaved?: (paths: string[]) => OfflineSavedSummary;
81
108
  describeWrite?: (write: OfflineWrite) => OfflineWriteDescription | null;
109
+ /** Lê do telemóvel o que está guardado num endereço (sem o `address`). Sem ele, as linhas não abrem. */
110
+ readSaved?: (path: string) => Promise<InboxRead | null>;
82
111
  }
83
112
  export declare const INBOX_GREEN = "#19C99B";
84
113
  export declare const OUTBOX_ORANGE = "#EA6A12";
@@ -96,4 +125,4 @@ export declare function OfflineArrow({ up }: {
96
125
  * (`describeSaved`, `describeWrite`); sem elas, mostra os endereços. Abre na
97
126
  * Outbox quando há alguma coisa por enviar.
98
127
  */
99
- export default function OfflineBoxesView({ state, labels: L, subtitle, address, onRefresh, onBack, describeSaved, describeWrite }: OfflineBoxesViewProps): React.JSX.Element;
128
+ export default function OfflineBoxesView({ state, labels: L, subtitle, address, onRefresh, onBack, describeSaved, describeWrite, readSaved }: OfflineBoxesViewProps): React.JSX.Element;
@@ -16,10 +16,10 @@ export { nativo } from './capabilities/onepoint-rn/nativo';
16
16
  export { type Coordenadas, type RespostaFicheiro } from './capabilities/onepoint-rn/device';
17
17
  export { type OrientacaoEcra } from './capabilities/onepoint-rn/frame';
18
18
  export { connectOutbox, isOutboxSaved, OutboxSavedError, OUTBOX_SAVED_MESSAGE, type OutboxOptions, type OutboxRequestOptions, watchOutbox, type OutboxActionStatus, type OutboxState, type OutboxWatch, } from './capabilities/onepoint-rn/connectOutbox';
19
- export { connectInbox, INBOX_SAVED_AT_HEADER, inboxSavedAt, inboxStatus, syncInbox, watchInbox, type InboxBundle, type InboxEvent, type InboxConnectOptions, type InboxEach, type InboxGet, type InboxOptions, type InboxProgress, type InboxStatus, type InboxSyncOptions, type InboxTier, } from './capabilities/onepoint-rn/connectInbox';
19
+ export { connectInbox, INBOX_SAVED_AT_HEADER, inboxSavedAt, inboxStatus, readInbox, syncInbox, watchInbox, type InboxBundle, type InboxEvent, type InboxConnectOptions, type InboxEach, type InboxGet, type InboxOptions, type InboxProgress, type InboxRead, type InboxStatus, type InboxSyncOptions, type InboxTier, } from './capabilities/onepoint-rn/connectInbox';
20
20
  export { useOfflineBoxes, type OfflineBoxesOptions, type OfflineBoxesState } from './capabilities/onepoint-rn/useOfflineBoxes';
21
21
  export { default as OfflineBoxes, DEFAULT_OFFLINE_BOXES_LABELS } from './components/feedback/OfflineBoxes/OfflineBoxes';
22
- export type { OfflineBoxesLabels, OfflineBoxesProps, OfflineSavedItem, OfflineSavedSummary, OfflineSavedTag, OfflineWrite, OfflineWriteDescription, } from './components/feedback/OfflineBoxes/OfflineBoxes';
22
+ export type { OfflineBoxesLabels, OfflineBoxesProps, OfflineSavedItem, OfflineSavedPart, OfflineSavedSummary, OfflineSavedTag, OfflineWrite, OfflineWriteDescription, } from './components/feedback/OfflineBoxes/OfflineBoxes';
23
23
  export { default as OfflineBoxesIcon } from './components/feedback/OfflineBoxes/OfflineBoxesIcon';
24
24
  export { useOrientacaoNaApp } from './capabilities/onepoint-rn/useOrientacaoNaApp';
25
25
  export { useMenuLateralNaApp } from './capabilities/onepoint-rn/useMenuLateralNaApp';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proef/common-ui",
3
- "version": "2.6.43",
3
+ "version": "2.6.45",
4
4
  "description": "Biblioteca de componentes e tema partilhada pelos portais Proef.",
5
5
  "repository": {
6
6
  "type": "git",