@proef/common-ui 2.6.43 → 2.6.44

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,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,6 +75,8 @@ 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[];
57
80
  }
58
81
  /** O que o portal faz dos endereços guardados. */
59
82
  export interface OfflineSavedSummary {
@@ -79,6 +102,8 @@ export interface OfflineBoxesViewProps {
79
102
  onBack: () => void;
80
103
  describeSaved?: (paths: string[]) => OfflineSavedSummary;
81
104
  describeWrite?: (write: OfflineWrite) => OfflineWriteDescription | null;
105
+ /** Lê do telemóvel o que está guardado num endereço (sem o `address`). Sem ele, as linhas não abrem. */
106
+ readSaved?: (path: string) => Promise<InboxRead | null>;
82
107
  }
83
108
  export declare const INBOX_GREEN = "#19C99B";
84
109
  export declare const OUTBOX_ORANGE = "#EA6A12";
@@ -96,4 +121,4 @@ export declare function OfflineArrow({ up }: {
96
121
  * (`describeSaved`, `describeWrite`); sem elas, mostra os endereços. Abre na
97
122
  * Outbox quando há alguma coisa por enviar.
98
123
  */
99
- export default function OfflineBoxesView({ state, labels: L, subtitle, address, onRefresh, onBack, describeSaved, describeWrite }: OfflineBoxesViewProps): React.JSX.Element;
124
+ 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.44",
4
4
  "description": "Biblioteca de componentes e tema partilhada pelos portais Proef.",
5
5
  "repository": {
6
6
  "type": "git",