@proef/common-ui 2.6.34 → 2.6.35

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.
@@ -48,6 +48,11 @@ export type InboxProgress = {
48
48
  };
49
49
  export type InboxStatus = InboxProgress & {
50
50
  finishedAt: string | null;
51
+ saved?: string[];
52
+ };
53
+ export type InboxEvent = InboxProgress & {
54
+ inboxId: string;
55
+ finishedAt: string | null;
51
56
  };
52
57
  declare module 'axios' {
53
58
  interface AxiosRequestConfig {
@@ -60,4 +65,5 @@ export declare function inboxSavedAt(response: AxiosResponse): string | null;
60
65
  export declare function inboxStatus(options: InboxOptions & {
61
66
  inboxId: string;
62
67
  }): Promise<InboxStatus | null>;
68
+ export declare function watchInbox(options: InboxOptions, onEvent: (event: InboxEvent) => void): () => void;
63
69
  export declare function syncInbox(api: AxiosInstance, options: InboxSyncOptions, onProgress?: (progress: InboxProgress) => void): Promise<InboxStatus | null>;
@@ -23,6 +23,8 @@ export type OutboxActionStatus = {
23
23
  state: OutboxState;
24
24
  createdAt?: string;
25
25
  reason?: string;
26
+ method?: string;
27
+ path?: string;
26
28
  };
27
29
  export type OutboxWatch = {
28
30
  actions: OutboxActionStatus[];
@@ -0,0 +1,14 @@
1
+ import { type InboxStatus } from './connectInbox';
2
+ import { type OutboxActionStatus } from './connectOutbox';
3
+ export type OfflineBoxesOptions = {
4
+ storageId: string | undefined;
5
+ inboxIds: string[];
6
+ };
7
+ export type OfflineBoxesState = {
8
+ inbox: InboxStatus & {
9
+ saved: string[];
10
+ };
11
+ downloading: boolean;
12
+ waiting: OutboxActionStatus[];
13
+ };
14
+ export declare function useOfflineBoxes({ storageId, inboxIds }: OfflineBoxesOptions): OfflineBoxesState | null;
@@ -0,0 +1,50 @@
1
+ import React from 'react';
2
+ export interface OfflineBoxesLabels {
3
+ /** Título do painel. */
4
+ title: string;
5
+ /** Secção da Inbox. */
6
+ saved: string;
7
+ /** Secção da Outbox. */
8
+ waiting: string;
9
+ /** Ao lado do ícone, com `{n}`. */
10
+ toSend: string;
11
+ /** A descarregar, com `{ready}` e `{total}`. */
12
+ downloading: string;
13
+ /** Última descarga, com `{ready}`, `{total}` e `{time}`. */
14
+ savedAt: string;
15
+ /** Ainda nada guardado. */
16
+ nothingSaved: string;
17
+ /** Falharam pedidos, com `{n}`. */
18
+ failed: string;
19
+ /** Lista do que está guardado, com `{n}`. */
20
+ savedList: string;
21
+ /** Nada por enviar. */
22
+ nothingWaiting: string;
23
+ refresh: string;
24
+ close: string;
25
+ pending: string;
26
+ sending: string;
27
+ rejected: string;
28
+ }
29
+ export declare const DEFAULT_OFFLINE_BOXES_LABELS: OfflineBoxesLabels;
30
+ export interface OfflineBoxesProps {
31
+ /** O mesmo `storageId` do `connectOutbox` e do `connectInbox`. */
32
+ storageId: string | undefined;
33
+ /** As inboxes que este sítio mostra (ex: `['ajustes']`). Somam-se. */
34
+ inboxIds: string[];
35
+ /** O que o botão Atualizar faz (ex: chamar o `syncInbox`). Sem ele, não há botão. */
36
+ onRefresh?: () => void;
37
+ /** Endereço da API (`api.defaults.baseURL`), para mostrar o que está guardado sem ele à frente. */
38
+ address?: string;
39
+ labels?: Partial<OfflineBoxesLabels>;
40
+ className?: string;
41
+ }
42
+ /**
43
+ * O que a app tem guardado para usar sem rede (Inbox, verde) e o que tem por
44
+ * enviar (Outbox, laranja), num ícone que se põe onde se quiser (ex: à
45
+ * direita do título). Ao lado, a percentagem guardada, que sobe enquanto a
46
+ * descarga corre, e quantas escritas faltam enviar. Tocar abre o painel com o
47
+ * detalhe. Fora da app OnePoint não aparece.
48
+ */
49
+ export default function OfflineBoxes({ storageId, inboxIds, onRefresh, address, labels, className }: OfflineBoxesProps): React.JSX.Element | null;
50
+ export { OfflineBoxes };
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ export interface OfflineBoxesIconProps {
3
+ size?: number;
4
+ className?: string;
5
+ }
6
+ /**
7
+ * O tabuleiro de inbox em 3D, dividido na diagonal: verde (Inbox) em cima à
8
+ * esquerda, laranja (Outbox) em baixo à direita. Só desenho; os números vão
9
+ * ao lado, no OfflineBoxes.
10
+ */
11
+ export default function OfflineBoxesIcon({ size, className }: OfflineBoxesIconProps): React.JSX.Element;
12
+ export { OfflineBoxesIcon };
@@ -16,7 +16,11 @@ 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, type InboxBundle, 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, 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';
20
+ export { useOfflineBoxes, type OfflineBoxesOptions, type OfflineBoxesState } from './capabilities/onepoint-rn/useOfflineBoxes';
21
+ export { default as OfflineBoxes, DEFAULT_OFFLINE_BOXES_LABELS } from './components/feedback/OfflineBoxes/OfflineBoxes';
22
+ export type { OfflineBoxesLabels, OfflineBoxesProps } from './components/feedback/OfflineBoxes/OfflineBoxes';
23
+ export { default as OfflineBoxesIcon } from './components/feedback/OfflineBoxes/OfflineBoxesIcon';
20
24
  export { useOrientacaoNaApp } from './capabilities/onepoint-rn/useOrientacaoNaApp';
21
25
  export { useMenuLateralNaApp } from './capabilities/onepoint-rn/useMenuLateralNaApp';
22
26
  export { useBarraEstadoNaApp } from './capabilities/onepoint-rn/useBarraEstadoNaApp';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proef/common-ui",
3
- "version": "2.6.34",
3
+ "version": "2.6.35",
4
4
  "description": "",
5
5
  "main": "dist/esm/index.js",
6
6
  "module": "dist/esm/index.js",