@sincpro/mobile 0.4.4 → 1.0.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 +3 -3
- package/dist/adapters/JsonSerializer.adapter.d.ts +1 -1
- package/dist/adapters/JsonSerializer.adapter.js +2 -2
- package/dist/adapters/repositories/database_table.repository.d.ts +3 -2
- package/dist/adapters/repositories/database_table.repository.js +1 -1
- package/dist/adapters/repositories/document.repository.d.ts +81 -0
- package/dist/adapters/repositories/document.repository.js +653 -0
- package/dist/adapters/repositories/domain_event.repository.d.ts +17 -17
- package/dist/adapters/repositories/domain_event.repository.js +25 -31
- package/dist/adapters/repositories/domain_event_dead_letter.repository.d.ts +10 -10
- package/dist/adapters/repositories/domain_event_dead_letter.repository.js +14 -13
- package/dist/adapters/repositories/event_row.d.ts +13 -0
- package/dist/adapters/repositories/event_row.js +22 -0
- package/dist/adapters/repositories/sqlite_document_store.d.ts +33 -0
- package/dist/adapters/repositories/sqlite_document_store.js +201 -0
- package/dist/domain/connectivity/events.d.ts +5 -5
- package/dist/domain/connectivity/events.js +3 -3
- package/dist/domain/database/criteria.d.ts +19 -0
- package/dist/domain/database/criteria.js +36 -0
- package/dist/domain/database/criteria_clock.d.ts +8 -0
- package/dist/domain/database/criteria_clock.js +305 -0
- package/dist/domain/database/criteria_sql.d.ts +61 -0
- package/dist/domain/database/criteria_sql.js +476 -0
- package/dist/domain/database/database.d.ts +1 -0
- package/dist/domain/database/index.d.ts +3 -1
- package/dist/domain/database/index.js +3 -1
- package/dist/domain/database/migration_plan.d.ts +14 -0
- package/dist/domain/database/migration_plan.js +44 -0
- package/dist/domain/entity/change_tracking.d.ts +21 -0
- package/dist/domain/entity/change_tracking.js +71 -0
- package/dist/domain/entity/checks.d.ts +8 -0
- package/dist/domain/entity/checks.js +82 -0
- package/dist/domain/entity/entity.d.ts +39 -32
- package/dist/domain/entity/entity.js +94 -105
- package/dist/domain/entity/entity_collection.d.ts +15 -30
- package/dist/domain/entity/entity_collection.js +30 -121
- package/dist/domain/entity/index.d.ts +5 -0
- package/dist/domain/entity/index.js +5 -0
- package/dist/domain/entity/reconcile.d.ts +7 -0
- package/dist/domain/entity/reconcile.js +12 -0
- package/dist/domain/entity/relations.d.ts +27 -0
- package/dist/domain/entity/relations.js +69 -0
- package/dist/domain/entity/remote_sync.d.ts +4 -0
- package/dist/domain/entity/remote_sync.js +19 -0
- package/dist/domain/entity/values.d.ts +6 -0
- package/dist/domain/entity/values.js +13 -0
- package/dist/domain/events/catalog.d.ts +29 -0
- package/dist/domain/{events.js → events/catalog.js} +7 -11
- package/dist/domain/events/chain.d.ts +5 -0
- package/dist/domain/events/chain.js +6 -0
- package/dist/domain/{event_sourcing → events}/domain_event.d.ts +20 -22
- package/dist/domain/events/domain_event.js +227 -0
- package/dist/domain/events/index.d.ts +8 -0
- package/dist/domain/events/index.js +8 -0
- package/dist/domain/events/integration_event.d.ts +103 -0
- package/dist/domain/events/integration_event.js +72 -0
- package/dist/domain/events/label.d.ts +2 -0
- package/dist/domain/events/label.js +26 -0
- package/dist/domain/index.d.ts +0 -1
- package/dist/domain/index.js +0 -1
- package/dist/domain/print/events.d.ts +8 -4
- package/dist/domain/print/events.js +9 -4
- package/dist/domain/repositories/document_store.d.ts +33 -0
- package/dist/domain/repositories/document_store.js +5 -0
- package/dist/domain/repositories/hooks.d.ts +23 -0
- package/dist/domain/repositories/hooks.js +32 -0
- package/dist/domain/repositories/index.d.ts +4 -0
- package/dist/domain/repositories/index.js +4 -0
- package/dist/domain/{database → repositories}/repository.d.ts +9 -3
- package/dist/domain/settings.d.ts +4 -1
- package/dist/domain/settings.js +3 -0
- package/dist/domain/webview/events.d.ts +2 -2
- package/dist/domain/webview/events.js +2 -2
- package/dist/entrypoints/db/migrations.js +10 -10
- package/dist/entrypoints/queue/QueueProcessor.d.ts +1 -1
- package/dist/entrypoints/queue/activateDomain.subscriber.d.ts +2 -2
- package/dist/entrypoints/queue/activateDomain.subscriber.js +2 -2
- package/dist/entrypoints/queue/newAppSettings.handler.d.ts +2 -2
- package/dist/entrypoints/queue/newAppSettings.handler.js +1 -1
- package/dist/entrypoints/queue/printImage.subscriber.d.ts +1 -1
- package/dist/entrypoints/queue/printImage.subscriber.js +2 -2
- package/dist/entrypoints/queue/processWebViewMessage.subscriber.d.ts +1 -1
- package/dist/entrypoints/queue/processWebViewMessage.subscriber.js +1 -1
- package/dist/entrypoints/ui/AppShell.js +2 -2
- package/dist/entrypoints/ui/common_provider.d.ts +0 -12
- package/dist/entrypoints/ui/common_provider.js +2 -131
- package/dist/event_driven/index.d.ts +1 -0
- package/dist/event_driven/index.js +1 -0
- package/dist/{domain/event_sourcing/event_handler.d.ts → event_driven/subscriber.d.ts} +1 -1
- package/dist/exceptions.d.ts +21 -0
- package/dist/exceptions.js +30 -0
- package/dist/framework/base_module.d.ts +1 -1
- package/dist/framework/createApp.d.ts +3 -3
- package/dist/framework/domain_module.d.ts +1 -1
- package/dist/framework/kernel.d.ts +1 -1
- package/dist/framework/kernel.js +17 -8
- package/dist/infrastructure/database/connector.d.ts +2 -0
- package/dist/infrastructure/database/connector.js +22 -0
- package/dist/infrastructure/database/index.d.ts +1 -0
- package/dist/infrastructure/database/index.js +1 -0
- package/dist/infrastructure/database/schema.d.ts +9 -0
- package/dist/infrastructure/database/schema.js +61 -0
- package/dist/infrastructure/database/utils.d.ts +2 -0
- package/dist/infrastructure/database/utils.js +12 -4
- package/dist/infrastructure/event_chain.d.ts +6 -0
- package/dist/infrastructure/event_chain.js +25 -0
- package/dist/infrastructure/telemetry/tracing/tracing_hooks.js +8 -5
- package/dist/infrastructure/ui/UIEventBus.d.ts +3 -1
- package/dist/infrastructure/ui/UIEventBus.js +8 -1
- package/dist/infrastructure/ui/activity.d.ts +37 -0
- package/dist/infrastructure/ui/activity.js +84 -0
- package/dist/infrastructure/workers/CronWorker.d.ts +6 -4
- package/dist/infrastructure/workers/CronWorker.js +24 -18
- package/dist/infrastructure/workers/EventBus.d.ts +9 -5
- package/dist/infrastructure/workers/EventBus.js +68 -33
- package/dist/services/bluetooth.service.js +16 -14
- package/dist/services/dead_letter_queue.service.d.ts +7 -7
- package/dist/services/dead_letter_queue.service.js +0 -2
- package/dist/services/event.service.d.ts +3 -3
- package/dist/services/event.service.js +1 -1
- package/dist/services/network.service.d.ts +1 -1
- package/dist/services/network.service.js +17 -15
- package/dist/services/printer.service.d.ts +1 -1
- package/dist/services/printer.service.js +50 -44
- package/dist/tools/utils/date.js +4 -3
- package/dist/tools/utils/monetary.d.ts +6 -3
- package/dist/tools/utils/monetary.js +33 -21
- package/dist/tools/utils/serializer.d.ts +1 -1
- package/dist/tools/utils/serializer.js +32 -35
- package/dist/ui/activity/DeviceNotices.d.ts +1 -0
- package/dist/ui/activity/DeviceNotices.js +29 -0
- package/dist/ui/activity/ProcessToast.d.ts +2 -0
- package/dist/ui/activity/ProcessToast.js +71 -0
- package/dist/ui/activity/index.d.ts +4 -0
- package/dist/ui/activity/index.js +4 -0
- package/dist/ui/activity/useActivity.d.ts +9 -0
- package/dist/ui/activity/useActivity.js +48 -0
- package/dist/ui/components/molecules/EventTimelineItem.d.ts +2 -2
- package/dist/ui/components/molecules/EventTimelineItem.js +1 -1
- package/dist/ui/components/molecules/index.d.ts +1 -2
- package/dist/ui/components/molecules/index.js +1 -2
- package/dist/ui/components/organisms/DeadLetterQueueRow.d.ts +3 -3
- package/dist/ui/components/organisms/EventRow.d.ts +3 -3
- package/dist/ui/components/organisms/EventRow.js +1 -1
- package/dist/ui/screens/dead_letter_queue/dead_letter_queue.context.d.ts +5 -5
- package/dist/ui/screens/events/events.context.d.ts +4 -4
- package/package.json +13 -8
- package/dist/domain/event_sourcing/domain_event.js +0 -164
- package/dist/domain/event_sourcing/event.d.ts +0 -25
- package/dist/domain/event_sourcing/event.js +0 -25
- package/dist/domain/event_sourcing/index.d.ts +0 -2
- package/dist/domain/event_sourcing/index.js +0 -2
- package/dist/domain/events.d.ts +0 -33
- package/dist/infrastructure/ui/ToastHost.d.ts +0 -6
- package/dist/infrastructure/ui/ToastHost.js +0 -28
- package/dist/infrastructure/ui/events.d.ts +0 -1
- package/dist/infrastructure/ui/events.js +0 -1
- package/dist/ui/components/molecules/ProcessToast.d.ts +0 -8
- package/dist/ui/components/molecules/ProcessToast.js +0 -52
- /package/dist/domain/{repositories.d.ts → repositories/catalog.d.ts} +0 -0
- /package/dist/domain/{repositories.js → repositories/catalog.js} +0 -0
- /package/dist/domain/{database → repositories}/repository.js +0 -0
- /package/dist/{domain/event_sourcing/event_handler.js → event_driven/subscriber.js} +0 -0
- /package/dist/ui/{components/molecules → activity}/ProcessToastProvider.d.ts +0 -0
- /package/dist/ui/{components/molecules → activity}/ProcessToastProvider.js +0 -0
|
@@ -1,31 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export function
|
|
1
|
+
import { Decimal } from "@sincpro/client-framework";
|
|
2
|
+
export function toDecimal(input) {
|
|
3
3
|
if (input == null)
|
|
4
|
-
return 0;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
return new Decimal(0);
|
|
5
|
+
if (typeof input === "number" && !Number.isFinite(input))
|
|
6
|
+
return new Decimal(0);
|
|
7
|
+
if (typeof input === "string") {
|
|
8
|
+
const text = input.trim();
|
|
9
|
+
if (!/[0-9]/.test(text))
|
|
10
|
+
return new Decimal(0);
|
|
11
|
+
try {
|
|
12
|
+
return new Decimal(text.replace(/[^0-9.-]+/g, ""));
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return new Decimal(0);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
9
18
|
try {
|
|
10
|
-
return
|
|
19
|
+
return new Decimal(input);
|
|
11
20
|
}
|
|
12
21
|
catch {
|
|
13
|
-
return 0;
|
|
22
|
+
return new Decimal(0);
|
|
14
23
|
}
|
|
15
24
|
}
|
|
25
|
+
export function parseToMonetaryNumber(input) {
|
|
26
|
+
return toDecimal(input);
|
|
27
|
+
}
|
|
16
28
|
export function formatTwoDecimals(value) {
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
29
|
+
const text = toDecimal(value).rounded(2).toString();
|
|
30
|
+
const negative = text.startsWith("-");
|
|
31
|
+
const [whole, fraction = "00"] = (negative ? text.slice(1) : text).split(".");
|
|
32
|
+
const grouped = whole.replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
|
33
|
+
return `${negative ? "-" : ""}${grouped},${fraction}`;
|
|
34
|
+
}
|
|
35
|
+
export function discountOf(total, discount) {
|
|
36
|
+
const rate = toDecimal(discount);
|
|
37
|
+
if (rate.isZero)
|
|
38
|
+
return new Decimal(0);
|
|
39
|
+
return toDecimal(total).times(rate).dividedBy(100, 8);
|
|
24
40
|
}
|
|
25
41
|
export function calculateDiscountedTotal(total, discount) {
|
|
26
|
-
|
|
27
|
-
return 0;
|
|
28
|
-
}
|
|
29
|
-
const result = (parseToMonetaryNumber(total) * discount) / 100;
|
|
30
|
-
return parseToMonetaryNumber(result);
|
|
42
|
+
return discountOf(total, discount);
|
|
31
43
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function safeJsonStringify(obj:
|
|
1
|
+
export declare function safeJsonStringify(obj: unknown, pretty?: boolean): string;
|
|
2
2
|
export declare function safeJsonParse(json: string): any;
|
|
@@ -1,44 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (
|
|
4
|
-
return
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return Array.from(value);
|
|
13
|
-
}
|
|
14
|
-
if (typeof value === "object" && value !== null) {
|
|
15
|
-
if (seen.has(value)) {
|
|
16
|
-
return "[Circular]";
|
|
17
|
-
}
|
|
18
|
-
seen.add(value);
|
|
19
|
-
}
|
|
20
|
-
return value;
|
|
21
|
-
}, 2);
|
|
1
|
+
import { readValues, valuesOf } from "@sincpro/client-framework";
|
|
2
|
+
function publishable(value, seen) {
|
|
3
|
+
if (value === null || typeof value !== "object")
|
|
4
|
+
return value;
|
|
5
|
+
if (seen.has(value))
|
|
6
|
+
return "[Circular]";
|
|
7
|
+
if (value instanceof Uint8Array ||
|
|
8
|
+
value instanceof ArrayBuffer ||
|
|
9
|
+
value instanceof DataView ||
|
|
10
|
+
typeof value.toJSON === "function") {
|
|
11
|
+
return value;
|
|
22
12
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return undefined;
|
|
26
|
-
}
|
|
13
|
+
seen.add(value);
|
|
14
|
+
try {
|
|
27
15
|
if (value instanceof Map) {
|
|
28
|
-
return
|
|
16
|
+
return new Map([...value].map(([key, item]) => [key, publishable(item, seen)]));
|
|
29
17
|
}
|
|
30
18
|
if (value instanceof Set) {
|
|
31
|
-
return
|
|
19
|
+
return new Set([...value].map((item) => publishable(item, seen)));
|
|
32
20
|
}
|
|
33
|
-
if (
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
21
|
+
if (Array.isArray(value))
|
|
22
|
+
return value.map((item) => publishable(item, seen));
|
|
23
|
+
const published = {};
|
|
24
|
+
for (const [key, item] of Object.entries(value)) {
|
|
25
|
+
if (key.startsWith("_") || typeof item === "function")
|
|
26
|
+
continue;
|
|
27
|
+
published[key] = publishable(item, seen);
|
|
38
28
|
}
|
|
39
|
-
return
|
|
40
|
-
}
|
|
29
|
+
return published;
|
|
30
|
+
}
|
|
31
|
+
finally {
|
|
32
|
+
seen.delete(value);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export function safeJsonStringify(obj, pretty = false) {
|
|
36
|
+
const wire = valuesOf(publishable(obj, new WeakSet()));
|
|
37
|
+
return JSON.stringify(wire, null, pretty ? 2 : undefined);
|
|
41
38
|
}
|
|
42
39
|
export function safeJsonParse(json) {
|
|
43
|
-
return
|
|
40
|
+
return readValues(json);
|
|
44
41
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function DeviceNotices(): null;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { textOf } from "../../domain/events/label";
|
|
2
|
+
import { useCommon } from "../../entrypoints/ui/common_provider";
|
|
3
|
+
import { useToast } from "@sincpro/mobile-ui/Feedback";
|
|
4
|
+
import { useEffect, useRef } from "react";
|
|
5
|
+
import { useActivity } from "./useActivity";
|
|
6
|
+
const VARIANT = {
|
|
7
|
+
success: "success",
|
|
8
|
+
danger: "danger",
|
|
9
|
+
info: "info",
|
|
10
|
+
};
|
|
11
|
+
export function DeviceNotices() {
|
|
12
|
+
const { notices } = useActivity();
|
|
13
|
+
const { locale } = useCommon();
|
|
14
|
+
const toast = useToast();
|
|
15
|
+
const shownRef = useRef(new Set());
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
for (const notice of notices) {
|
|
18
|
+
if (shownRef.current.has(notice.id))
|
|
19
|
+
continue;
|
|
20
|
+
shownRef.current.add(notice.id);
|
|
21
|
+
toast.show({
|
|
22
|
+
title: textOf(notice.label, locale),
|
|
23
|
+
message: textOf(notice.detail ?? notice.label, locale),
|
|
24
|
+
variant: VARIANT[notice.variant ?? "info"],
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}, [locale, notices, toast]);
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { textOf } from "../../domain/events/label";
|
|
2
|
+
import { useCommon } from "../../entrypoints/ui/common_provider";
|
|
3
|
+
import { useToast } from "@sincpro/mobile-ui/Feedback";
|
|
4
|
+
import { useEffect, useRef } from "react";
|
|
5
|
+
import { useActivity } from "./useActivity";
|
|
6
|
+
const MAX_ERROR_LEN = 150;
|
|
7
|
+
const MIN_VISIBLE_MS = 1200;
|
|
8
|
+
function ProcessToast() {
|
|
9
|
+
const { queue, crons, failure } = useActivity();
|
|
10
|
+
const { locale } = useCommon();
|
|
11
|
+
const toast = useToast();
|
|
12
|
+
const loadingIdRef = useRef(null);
|
|
13
|
+
const shownErrorRef = useRef(null);
|
|
14
|
+
const startedAtRef = useRef(null);
|
|
15
|
+
const hideTimerRef = useRef(null);
|
|
16
|
+
const progress = queue ?? crons[0];
|
|
17
|
+
const progressLabel = textOf(progress?.label, locale);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (hideTimerRef.current) {
|
|
20
|
+
clearTimeout(hideTimerRef.current);
|
|
21
|
+
hideTimerRef.current = null;
|
|
22
|
+
}
|
|
23
|
+
const hideLoading = () => {
|
|
24
|
+
if (!loadingIdRef.current)
|
|
25
|
+
return;
|
|
26
|
+
toast.hide(loadingIdRef.current);
|
|
27
|
+
loadingIdRef.current = null;
|
|
28
|
+
startedAtRef.current = null;
|
|
29
|
+
};
|
|
30
|
+
if (progress && !failure) {
|
|
31
|
+
if (startedAtRef.current == null)
|
|
32
|
+
startedAtRef.current = Date.now();
|
|
33
|
+
if (loadingIdRef.current) {
|
|
34
|
+
toast.update(loadingIdRef.current, { message: progressLabel, variant: "loading" });
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
loadingIdRef.current = toast.loading(progressLabel);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
else if (loadingIdRef.current) {
|
|
41
|
+
const elapsed = startedAtRef.current
|
|
42
|
+
? Date.now() - startedAtRef.current
|
|
43
|
+
: MIN_VISIBLE_MS;
|
|
44
|
+
const wait = failure ? 0 : Math.max(0, MIN_VISIBLE_MS - elapsed);
|
|
45
|
+
hideTimerRef.current = setTimeout(hideLoading, wait);
|
|
46
|
+
}
|
|
47
|
+
return () => {
|
|
48
|
+
if (hideTimerRef.current)
|
|
49
|
+
clearTimeout(hideTimerRef.current);
|
|
50
|
+
};
|
|
51
|
+
}, [failure, progress, progressLabel, toast]);
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
if (!failure) {
|
|
54
|
+
shownErrorRef.current = null;
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (shownErrorRef.current === failure.id)
|
|
58
|
+
return;
|
|
59
|
+
shownErrorRef.current = failure.id;
|
|
60
|
+
const raw = failure.detail != null ? textOf(failure.detail, locale) : undefined;
|
|
61
|
+
const detail = raw
|
|
62
|
+
? raw.length > MAX_ERROR_LEN
|
|
63
|
+
? `${raw.slice(0, MAX_ERROR_LEN)}...`
|
|
64
|
+
: raw
|
|
65
|
+
: undefined;
|
|
66
|
+
const title = textOf(failure.label, locale);
|
|
67
|
+
toast.danger(detail ?? title, { title: `Error: ${title}` });
|
|
68
|
+
}, [failure, locale, toast]);
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
export default ProcessToast;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ACTIVITY_EVENT, ACTIVITY_SETTING_EVENT, activityVisible, applyActivity, emptyActivity, loadActivityEnabled, } from "../../infrastructure/ui/activity";
|
|
2
|
+
import { UIEventBus } from "../../infrastructure/ui/UIEventBus";
|
|
3
|
+
import { useEffect, useMemo, useState } from "react";
|
|
4
|
+
const CHANNELS_ON = {
|
|
5
|
+
queue: true,
|
|
6
|
+
cron: true,
|
|
7
|
+
device: true,
|
|
8
|
+
};
|
|
9
|
+
export function useActivity(options) {
|
|
10
|
+
const all = options?.all ?? false;
|
|
11
|
+
const [state, setState] = useState(emptyActivity);
|
|
12
|
+
const [enabled, setEnabled] = useState(CHANNELS_ON);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
let alive = true;
|
|
15
|
+
loadActivityEnabled().then((next) => {
|
|
16
|
+
if (alive)
|
|
17
|
+
setEnabled(next);
|
|
18
|
+
});
|
|
19
|
+
return () => {
|
|
20
|
+
alive = false;
|
|
21
|
+
};
|
|
22
|
+
}, []);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
const offFact = UIEventBus.on(ACTIVITY_EVENT, (payload) => {
|
|
25
|
+
setState((current) => applyActivity(current, payload));
|
|
26
|
+
}, { debounce: false });
|
|
27
|
+
const offSetting = UIEventBus.on(ACTIVITY_SETTING_EVENT, (payload) => {
|
|
28
|
+
const change = payload;
|
|
29
|
+
setEnabled((current) => ({ ...current, [change.channel]: change.enabled }));
|
|
30
|
+
}, { debounce: false });
|
|
31
|
+
return () => {
|
|
32
|
+
offFact();
|
|
33
|
+
offSetting();
|
|
34
|
+
};
|
|
35
|
+
}, []);
|
|
36
|
+
return useMemo(() => {
|
|
37
|
+
const visible = state.running.filter((fact) => activityVisible(fact, enabled, all));
|
|
38
|
+
const queues = visible.filter((fact) => fact.channel === "queue");
|
|
39
|
+
return {
|
|
40
|
+
queue: queues[queues.length - 1],
|
|
41
|
+
crons: visible.filter((fact) => fact.channel === "cron"),
|
|
42
|
+
failure: state.failure && activityVisible(state.failure, enabled, all)
|
|
43
|
+
? state.failure
|
|
44
|
+
: undefined,
|
|
45
|
+
notices: state.notices.filter((fact) => activityVisible(fact, enabled, all)),
|
|
46
|
+
};
|
|
47
|
+
}, [all, enabled, state]);
|
|
48
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IntegrationEvent } from "../../../domain/events";
|
|
2
2
|
interface EventTimelineItemProps {
|
|
3
|
-
event:
|
|
3
|
+
event: IntegrationEvent;
|
|
4
4
|
isLast?: boolean;
|
|
5
5
|
}
|
|
6
6
|
declare function EventTimelineItem({ event, isLast }: EventTimelineItemProps): import("react").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "nativewind/jsx-runtime";
|
|
2
|
-
import { EEventStatus } from "../../../domain/
|
|
2
|
+
import { EEventStatus } from "../../../domain/events";
|
|
3
3
|
import { Display } from "@sincpro/mobile-ui/Display";
|
|
4
4
|
import CopyableText from "@sincpro/mobile-ui/Display/Display.CopyableText";
|
|
5
5
|
import { useTheme } from "@sincpro/mobile-ui/theme";
|
|
@@ -2,8 +2,7 @@ export { BluetoothDeviceSelectorModal } from "./BluetoothDeviceSelectorModal";
|
|
|
2
2
|
export { default as DeadLetterErrorBlock } from "./DeadLetterErrorBlock";
|
|
3
3
|
export { default as EventTimelineItem } from "./EventTimelineItem";
|
|
4
4
|
export { default as GeoPermissionCard } from "./GeoPermissionCard";
|
|
5
|
-
export { default as ProcessToast } from "./ProcessToast";
|
|
6
|
-
export { ProcessToastProvider } from "./ProcessToastProvider";
|
|
7
5
|
export type { TimezoneLocale } from "./timezone";
|
|
8
6
|
export { TimeZoneSelector } from "./TimeZoneSelector";
|
|
9
7
|
export { TimeZoneSelectorModal } from "./TimeZoneSelectorModal";
|
|
8
|
+
export { DeviceNotices, ProcessToast, ProcessToastProvider, } from "../../../ui/activity";
|
|
@@ -2,7 +2,6 @@ export { BluetoothDeviceSelectorModal } from "./BluetoothDeviceSelectorModal";
|
|
|
2
2
|
export { default as DeadLetterErrorBlock } from "./DeadLetterErrorBlock";
|
|
3
3
|
export { default as EventTimelineItem } from "./EventTimelineItem";
|
|
4
4
|
export { default as GeoPermissionCard } from "./GeoPermissionCard";
|
|
5
|
-
export { default as ProcessToast } from "./ProcessToast";
|
|
6
|
-
export { ProcessToastProvider } from "./ProcessToastProvider";
|
|
7
5
|
export { TimeZoneSelector } from "./TimeZoneSelector";
|
|
8
6
|
export { TimeZoneSelectorModal } from "./TimeZoneSelectorModal";
|
|
7
|
+
export { DeviceNotices, ProcessToast, ProcessToastProvider, } from "../../../ui/activity";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IntegrationEvent } from "../../../domain/events";
|
|
2
2
|
import { IRowItemProps } from "@sincpro/mobile-ui/views/types/IListView";
|
|
3
3
|
import React from "react";
|
|
4
|
-
interface DeadLetterQueueRowProps extends IRowItemProps<
|
|
5
|
-
onRetry: (event:
|
|
4
|
+
interface DeadLetterQueueRowProps extends IRowItemProps<IntegrationEvent> {
|
|
5
|
+
onRetry: (event: IntegrationEvent) => Promise<void> | void;
|
|
6
6
|
}
|
|
7
7
|
declare function DeadLetterQueueRow({ item, onRetry }: DeadLetterQueueRowProps): React.JSX.Element | null;
|
|
8
8
|
export default DeadLetterQueueRow;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IntegrationEvent } from "../../../domain/events";
|
|
2
2
|
interface EventRowProps {
|
|
3
|
-
item:
|
|
4
|
-
onRetry: (event:
|
|
3
|
+
item: IntegrationEvent;
|
|
4
|
+
onRetry: (event: IntegrationEvent) => Promise<void> | void;
|
|
5
5
|
}
|
|
6
6
|
declare function EventRow({ item, onRetry }: EventRowProps): import("react").JSX.Element | null;
|
|
7
7
|
export default EventRow;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "nativewind/jsx-runtime";
|
|
2
|
-
import { EEventStatus } from "../../../domain/
|
|
2
|
+
import { EEventStatus } from "../../../domain/events";
|
|
3
3
|
import { Display } from "@sincpro/mobile-ui/Display";
|
|
4
4
|
import { Form } from "@sincpro/mobile-ui/Form";
|
|
5
5
|
import { Typography } from "@sincpro/mobile-ui/Typography";
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IntegrationEvent } from "../../../domain/events";
|
|
2
2
|
import React, { ReactNode } from "react";
|
|
3
3
|
interface IDeadLetterQueueContext {
|
|
4
|
-
events:
|
|
5
|
-
enrichedEvents:
|
|
4
|
+
events: IntegrationEvent[];
|
|
5
|
+
enrichedEvents: IntegrationEvent[];
|
|
6
6
|
selectedEvents: Set<string>;
|
|
7
7
|
isLoading: boolean;
|
|
8
8
|
isRetrying: boolean;
|
|
9
9
|
isDeleting: boolean;
|
|
10
10
|
loadEvents: () => Promise<void>;
|
|
11
|
-
retryEvent: (event:
|
|
11
|
+
retryEvent: (event: IntegrationEvent) => Promise<void>;
|
|
12
12
|
retrySelectedEvents: () => Promise<{
|
|
13
13
|
success: number;
|
|
14
14
|
failed: number;
|
|
15
15
|
}>;
|
|
16
|
-
deleteEvent: (event:
|
|
16
|
+
deleteEvent: (event: IntegrationEvent) => Promise<void>;
|
|
17
17
|
deleteSelectedEvents: () => Promise<{
|
|
18
18
|
success: number;
|
|
19
19
|
failed: number;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IntegrationEvent } from "../../../domain/events";
|
|
2
2
|
import React, { ReactNode } from "react";
|
|
3
3
|
type EventFilter = "ALL" | "FAILED" | "ACKNOWLEDGED" | "PENDING";
|
|
4
4
|
interface IEventsContext {
|
|
5
|
-
events:
|
|
6
|
-
pagedEvents:
|
|
5
|
+
events: IntegrationEvent[];
|
|
6
|
+
pagedEvents: IntegrationEvent[];
|
|
7
7
|
isLoading: boolean;
|
|
8
8
|
isLoadingMore: boolean;
|
|
9
9
|
isRetrying: boolean;
|
|
@@ -15,7 +15,7 @@ interface IEventsContext {
|
|
|
15
15
|
loadEvents: () => Promise<void>;
|
|
16
16
|
refreshEvents: () => Promise<void>;
|
|
17
17
|
loadMore: () => Promise<void>;
|
|
18
|
-
retryEvent: (event:
|
|
18
|
+
retryEvent: (event: IntegrationEvent) => Promise<void>;
|
|
19
19
|
}
|
|
20
20
|
export declare function EventsProvider({ children, pageSize, }: {
|
|
21
21
|
children: ReactNode;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sincpro/mobile",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Sincpro Mobile framework core: offline-first infra (DB, queue/events, cron), DDD patterns, adapters, AppShell and module-driven composition for React Native",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -34,18 +34,19 @@
|
|
|
34
34
|
"@opentelemetry/core": "^2.10.0",
|
|
35
35
|
"@opentelemetry/resources": "^2.10.0",
|
|
36
36
|
"@opentelemetry/sdk-trace-base": "^2.10.0",
|
|
37
|
+
"@sincpro/client-framework": "^0.6.0",
|
|
38
|
+
"@sincpro/criteria": "^2.1.0",
|
|
37
39
|
"async-mutex": "^0.5.0",
|
|
38
40
|
"big.js": "^7.0.1",
|
|
39
41
|
"dayjs": "^1.11.21",
|
|
40
42
|
"mitt": "^3.0.1",
|
|
41
43
|
"pdf-lib": "^1.17.1",
|
|
42
|
-
"tailwind-variants": "^3.2.2"
|
|
43
|
-
"uuid": "^14.0.1"
|
|
44
|
+
"tailwind-variants": "^3.2.2"
|
|
44
45
|
},
|
|
45
46
|
"peerDependencies": {
|
|
46
47
|
"@react-navigation/native": ">=7",
|
|
47
48
|
"@react-navigation/native-stack": ">=7",
|
|
48
|
-
"@sincpro/mobile-ui": "^0.
|
|
49
|
+
"@sincpro/mobile-ui": "^2.0.0",
|
|
49
50
|
"expo-background-task": "*",
|
|
50
51
|
"expo-clipboard": "*",
|
|
51
52
|
"expo-crypto": "*",
|
|
@@ -75,10 +76,11 @@
|
|
|
75
76
|
"@opentelemetry/api": "^1.9.0",
|
|
76
77
|
"@react-navigation/native": "^7.0.0",
|
|
77
78
|
"@react-navigation/native-stack": "^7.0.0",
|
|
78
|
-
"@
|
|
79
|
+
"@expo-google-fonts/ibm-plex-mono": "^0.4.1",
|
|
80
|
+
"@expo-google-fonts/ibm-plex-sans": "^0.4.1",
|
|
81
|
+
"@sincpro/mobile-ui": "^2.0.0",
|
|
79
82
|
"@types/big.js": "^6.2.2",
|
|
80
83
|
"@types/react": "~19.3.0",
|
|
81
|
-
"@types/uuid": "^10.0.0",
|
|
82
84
|
"eslint": "^9.35.0",
|
|
83
85
|
"eslint-config-expo": "~58.0.4",
|
|
84
86
|
"eslint-config-prettier": "^10.1.8",
|
|
@@ -89,6 +91,7 @@
|
|
|
89
91
|
"expo-clipboard": "~58.0.4",
|
|
90
92
|
"expo-crypto": "~58.0.7",
|
|
91
93
|
"expo-file-system": "~58.0.13",
|
|
94
|
+
"expo-image": "~58.0.18",
|
|
92
95
|
"expo-linking": "~58.0.16",
|
|
93
96
|
"expo-localization": "~58.0.5",
|
|
94
97
|
"expo-location": "~58.0.20",
|
|
@@ -99,7 +102,6 @@
|
|
|
99
102
|
"expo-sqlite": "~58.0.15",
|
|
100
103
|
"expo-task-manager": "~58.0.13",
|
|
101
104
|
"nativewind": "4.2.7",
|
|
102
|
-
"tailwindcss": "3.4.19",
|
|
103
105
|
"prettier": "^3.6.2",
|
|
104
106
|
"react": "19.3.0",
|
|
105
107
|
"react-native": "0.88.1",
|
|
@@ -113,6 +115,7 @@
|
|
|
113
115
|
"react-native-view-shot": "6.1.1",
|
|
114
116
|
"react-native-webview": "14.0.1",
|
|
115
117
|
"react-native-worklets": "0.13.0",
|
|
118
|
+
"tailwindcss": "3.4.19",
|
|
116
119
|
"tsc-alias": "^1.8.17",
|
|
117
120
|
"tsx": "^4.22.4",
|
|
118
121
|
"typescript": "~5.9.2"
|
|
@@ -121,7 +124,9 @@
|
|
|
121
124
|
".": "./dist/index.js",
|
|
122
125
|
"./domain": "./dist/domain/index.js",
|
|
123
126
|
"./domain/entity": "./dist/domain/entity/index.js",
|
|
124
|
-
"./domain/
|
|
127
|
+
"./domain/events": "./dist/domain/events/index.js",
|
|
128
|
+
"./domain/repositories": "./dist/domain/repositories/index.js",
|
|
129
|
+
"./event_driven": "./dist/event_driven/index.js",
|
|
125
130
|
"./domain/database": "./dist/domain/database/index.js",
|
|
126
131
|
"./domain/connectivity": "./dist/domain/connectivity/index.js",
|
|
127
132
|
"./domain/print": "./dist/domain/print/index.js",
|