@sincpro/mobile 0.4.3 → 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/ReceiptExporter.adapter.js +10 -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 +1 -13
- package/dist/entrypoints/ui/common_provider.js +4 -133
- package/dist/entrypoints/ui/domain_switcher.d.ts +2 -2
- 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/feature.d.ts +26 -0
- package/dist/framework/feature.js +36 -0
- package/dist/framework/kernel.d.ts +1 -1
- package/dist/framework/kernel.js +17 -8
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- 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/interceptor/intercept.d.ts +7 -2
- package/dist/infrastructure/interceptor/intercept.js +5 -2
- package/dist/infrastructure/telemetry/tracing/tracing_hooks.d.ts +9 -6
- package/dist/infrastructure/telemetry/tracing/tracing_hooks.js +61 -35
- 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/{components/molecules → activity}/ProcessToastProvider.d.ts +1 -1
- 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/atoms/DebugBanner.d.ts +1 -1
- package/dist/ui/components/molecules/BluetoothDeviceSelectorModal.d.ts +1 -1
- package/dist/ui/components/molecules/BluetoothDeviceSelectorModal.js +8 -2
- package/dist/ui/components/molecules/DeadLetterErrorBlock.d.ts +1 -1
- package/dist/ui/components/molecules/EventTimelineItem.d.ts +3 -3
- package/dist/ui/components/molecules/EventTimelineItem.js +1 -1
- package/dist/ui/components/molecules/GeoPermissionCard.d.ts +1 -1
- package/dist/ui/components/molecules/TimeZoneSelector.d.ts +1 -1
- package/dist/ui/components/molecules/TimeZoneSelectorModal.d.ts +1 -1
- package/dist/ui/components/molecules/TimeZoneSelectorModal.js +5 -3
- package/dist/ui/components/molecules/index.d.ts +1 -2
- package/dist/ui/components/molecules/index.js +1 -2
- package/dist/ui/components/organisms/BluetoothPrinterSelector.d.ts +1 -1
- package/dist/ui/components/organisms/BluetoothPrinterSelector.js +3 -0
- package/dist/ui/components/organisms/DatabaseInfoRow.d.ts +1 -1
- package/dist/ui/components/organisms/DeadLetterQueueRow.d.ts +5 -4
- package/dist/ui/components/organisms/EventRow.d.ts +4 -4
- package/dist/ui/components/organisms/EventRow.js +1 -1
- package/dist/ui/components/organisms/InjectableWebView.d.ts +2 -2
- package/dist/ui/components/organisms/InjectableWebView.js +6 -3
- package/dist/ui/components/organisms/Receipt.d.ts +2 -1
- package/dist/ui/components/organisms/TableInfoInfoRow.d.ts +1 -1
- package/dist/ui/screens/database/database.context.d.ts +2 -2
- package/dist/ui/screens/database/database.context.js +9 -18
- package/dist/ui/screens/database/database.json_detail.d.ts +1 -1
- package/dist/ui/screens/database/database.list.d.ts +1 -1
- package/dist/ui/screens/database/database.table_rows.d.ts +1 -1
- package/dist/ui/screens/dead_letter_queue/dead_letter_queue.context.d.ts +7 -7
- package/dist/ui/screens/dead_letter_queue/dead_letter_queue.list.d.ts +1 -1
- package/dist/ui/screens/events/events.context.d.ts +6 -6
- package/dist/ui/screens/events/events.context.js +20 -25
- package/dist/ui/screens/events/events.list.d.ts +1 -1
- package/package.json +51 -40
- 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.js +0 -0
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import { ValueObject } from "../../domain/entity/value_object";
|
|
2
|
-
import { generateUUID } from "../../infrastructure/database/utils";
|
|
3
|
-
import { safeJsonParse, safeJsonStringify } from "../../tools/utils/serializer";
|
|
4
|
-
export var EEventStatus;
|
|
5
|
-
(function (EEventStatus) {
|
|
6
|
-
EEventStatus["PENDING"] = "PENDING";
|
|
7
|
-
EEventStatus["PROCESSING"] = "PROCESSING";
|
|
8
|
-
EEventStatus["ACKNOWLEDGED"] = "ACKNOWLEDGED";
|
|
9
|
-
EEventStatus["FAILED"] = "FAILED";
|
|
10
|
-
EEventStatus["CANCELLED"] = "CANCELLED";
|
|
11
|
-
})(EEventStatus || (EEventStatus = {}));
|
|
12
|
-
export class DomainEvent extends ValueObject {
|
|
13
|
-
name = "";
|
|
14
|
-
label = "";
|
|
15
|
-
requiresNetwork = false;
|
|
16
|
-
uuid = "";
|
|
17
|
-
createdAt = "";
|
|
18
|
-
status = EEventStatus.PENDING;
|
|
19
|
-
attempts = 0;
|
|
20
|
-
errorMessage = null;
|
|
21
|
-
acknowledgedAt = null;
|
|
22
|
-
failedAt = null;
|
|
23
|
-
aggregateId = null;
|
|
24
|
-
sourceId = null;
|
|
25
|
-
correlationId = null;
|
|
26
|
-
sequence = 0;
|
|
27
|
-
static sanitize(data) {
|
|
28
|
-
if (data === null || data === undefined) {
|
|
29
|
-
return data;
|
|
30
|
-
}
|
|
31
|
-
if (data instanceof ValueObject) {
|
|
32
|
-
return safeJsonParse(data.asJSON());
|
|
33
|
-
}
|
|
34
|
-
if (Array.isArray(data)) {
|
|
35
|
-
return data.map((item) => DomainEvent.sanitize(item));
|
|
36
|
-
}
|
|
37
|
-
if (typeof data === "object" && data !== null) {
|
|
38
|
-
const result = {};
|
|
39
|
-
for (const [key, value] of Object.entries(data)) {
|
|
40
|
-
result[key] = DomainEvent.sanitize(value);
|
|
41
|
-
}
|
|
42
|
-
return result;
|
|
43
|
-
}
|
|
44
|
-
return data;
|
|
45
|
-
}
|
|
46
|
-
static create(data) {
|
|
47
|
-
const instance = new this();
|
|
48
|
-
if (data) {
|
|
49
|
-
const sanitized = DomainEvent.sanitize(data);
|
|
50
|
-
Object.assign(instance, sanitized);
|
|
51
|
-
}
|
|
52
|
-
Object.assign(instance, {
|
|
53
|
-
uuid: generateUUID(),
|
|
54
|
-
createdAt: new Date().toISOString(),
|
|
55
|
-
});
|
|
56
|
-
return instance;
|
|
57
|
-
}
|
|
58
|
-
static from(event) {
|
|
59
|
-
const instance = new this();
|
|
60
|
-
Object.assign(instance, safeJsonParse(event.asJSON()));
|
|
61
|
-
return instance;
|
|
62
|
-
}
|
|
63
|
-
cloneWithReset() {
|
|
64
|
-
const clone = this.constructor.from(this);
|
|
65
|
-
const mutableClone = clone;
|
|
66
|
-
Object.assign(mutableClone, {
|
|
67
|
-
uuid: generateUUID(),
|
|
68
|
-
createdAt: new Date().toISOString(),
|
|
69
|
-
status: EEventStatus.PENDING,
|
|
70
|
-
attempts: 0,
|
|
71
|
-
errorMessage: null,
|
|
72
|
-
acknowledgedAt: null,
|
|
73
|
-
failedAt: null,
|
|
74
|
-
});
|
|
75
|
-
return mutableClone;
|
|
76
|
-
}
|
|
77
|
-
withAggregateId(aggregateId) {
|
|
78
|
-
this.aggregateId = aggregateId;
|
|
79
|
-
return this;
|
|
80
|
-
}
|
|
81
|
-
withSourceId(sourceId) {
|
|
82
|
-
this.sourceId = sourceId;
|
|
83
|
-
return this;
|
|
84
|
-
}
|
|
85
|
-
withCorrelationId(correlationId) {
|
|
86
|
-
this.correlationId = correlationId;
|
|
87
|
-
return this;
|
|
88
|
-
}
|
|
89
|
-
withSequence(sequence) {
|
|
90
|
-
this.sequence = sequence;
|
|
91
|
-
return this;
|
|
92
|
-
}
|
|
93
|
-
getBusinessPayload() {
|
|
94
|
-
const infrastructureKeys = new Set([
|
|
95
|
-
"uuid",
|
|
96
|
-
"createdAt",
|
|
97
|
-
"status",
|
|
98
|
-
"attempts",
|
|
99
|
-
"errorMessage",
|
|
100
|
-
"acknowledgedAt",
|
|
101
|
-
"failedAt",
|
|
102
|
-
"aggregateId",
|
|
103
|
-
"sourceId",
|
|
104
|
-
"correlationId",
|
|
105
|
-
"sequence",
|
|
106
|
-
]);
|
|
107
|
-
const payload = {};
|
|
108
|
-
for (const [key, value] of Object.entries(this)) {
|
|
109
|
-
if (!infrastructureKeys.has(key)) {
|
|
110
|
-
payload[key] = value;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
return payload;
|
|
114
|
-
}
|
|
115
|
-
hasSameBusinessPayload(other) {
|
|
116
|
-
if (this.name !== other.name)
|
|
117
|
-
return false;
|
|
118
|
-
return (safeJsonStringify(this.getBusinessPayload()) ===
|
|
119
|
-
safeJsonStringify(other.getBusinessPayload()));
|
|
120
|
-
}
|
|
121
|
-
markAsProcessing() {
|
|
122
|
-
this.status = EEventStatus.PROCESSING;
|
|
123
|
-
this.attempts += 1;
|
|
124
|
-
return this;
|
|
125
|
-
}
|
|
126
|
-
markAsAcknowledged() {
|
|
127
|
-
this.status = EEventStatus.ACKNOWLEDGED;
|
|
128
|
-
this.acknowledgedAt = new Date().toISOString();
|
|
129
|
-
return this;
|
|
130
|
-
}
|
|
131
|
-
markAsFailed(errorMessage) {
|
|
132
|
-
this.status = EEventStatus.FAILED;
|
|
133
|
-
this.errorMessage = errorMessage;
|
|
134
|
-
this.failedAt = new Date().toISOString();
|
|
135
|
-
return this;
|
|
136
|
-
}
|
|
137
|
-
markAsCancelled() {
|
|
138
|
-
this.status = EEventStatus.CANCELLED;
|
|
139
|
-
return this;
|
|
140
|
-
}
|
|
141
|
-
retry() {
|
|
142
|
-
this.status = EEventStatus.PENDING;
|
|
143
|
-
this.errorMessage = null;
|
|
144
|
-
return this;
|
|
145
|
-
}
|
|
146
|
-
get isPending() {
|
|
147
|
-
return this.status === EEventStatus.PENDING;
|
|
148
|
-
}
|
|
149
|
-
get isProcessing() {
|
|
150
|
-
return this.status === EEventStatus.PROCESSING;
|
|
151
|
-
}
|
|
152
|
-
get isAcknowledged() {
|
|
153
|
-
return this.status === EEventStatus.ACKNOWLEDGED;
|
|
154
|
-
}
|
|
155
|
-
get isFailed() {
|
|
156
|
-
return this.status === EEventStatus.FAILED;
|
|
157
|
-
}
|
|
158
|
-
get isCancelled() {
|
|
159
|
-
return this.status === EEventStatus.CANCELLED;
|
|
160
|
-
}
|
|
161
|
-
get isPartOfTransaction() {
|
|
162
|
-
return this.correlationId !== null;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { DomainEvent } from "../../domain/event_sourcing/domain_event";
|
|
2
|
-
export declare class QueueStartEvent extends DomainEvent {
|
|
3
|
-
static readonly name = "common.queue_event.v2.start";
|
|
4
|
-
static readonly label = "Iniciando procesamiento de cola";
|
|
5
|
-
static readonly requiresNetwork = false;
|
|
6
|
-
readonly name = "common.queue_event.v2.start";
|
|
7
|
-
readonly label = "Iniciando procesamiento de cola";
|
|
8
|
-
readonly requiresNetwork = false;
|
|
9
|
-
}
|
|
10
|
-
export declare class QueueEndEvent extends DomainEvent {
|
|
11
|
-
static readonly name = "common.queue_event.v2.end";
|
|
12
|
-
static readonly label = "Finalizando procesamiento de cola";
|
|
13
|
-
static readonly requiresNetwork = false;
|
|
14
|
-
readonly name = "common.queue_event.v2.end";
|
|
15
|
-
readonly label = "Finalizando procesamiento de cola";
|
|
16
|
-
readonly requiresNetwork = false;
|
|
17
|
-
}
|
|
18
|
-
export declare class QueueAttemptEndEvent extends DomainEvent {
|
|
19
|
-
static readonly name = "common.queue_event.v2.attempt_end";
|
|
20
|
-
static readonly label = "Intento de procesamiento finalizado";
|
|
21
|
-
static readonly requiresNetwork = false;
|
|
22
|
-
readonly name = "common.queue_event.v2.attempt_end";
|
|
23
|
-
readonly label = "Intento de procesamiento finalizado";
|
|
24
|
-
readonly requiresNetwork = false;
|
|
25
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { DomainEvent } from "../../domain/event_sourcing/domain_event";
|
|
2
|
-
export class QueueStartEvent extends DomainEvent {
|
|
3
|
-
static name = "common.queue_event.v2.start";
|
|
4
|
-
static label = "Iniciando procesamiento de cola";
|
|
5
|
-
static requiresNetwork = false;
|
|
6
|
-
name = QueueStartEvent.name;
|
|
7
|
-
label = QueueStartEvent.label;
|
|
8
|
-
requiresNetwork = QueueStartEvent.requiresNetwork;
|
|
9
|
-
}
|
|
10
|
-
export class QueueEndEvent extends DomainEvent {
|
|
11
|
-
static name = "common.queue_event.v2.end";
|
|
12
|
-
static label = "Finalizando procesamiento de cola";
|
|
13
|
-
static requiresNetwork = false;
|
|
14
|
-
name = QueueEndEvent.name;
|
|
15
|
-
label = QueueEndEvent.label;
|
|
16
|
-
requiresNetwork = QueueEndEvent.requiresNetwork;
|
|
17
|
-
}
|
|
18
|
-
export class QueueAttemptEndEvent extends DomainEvent {
|
|
19
|
-
static name = "common.queue_event.v2.attempt_end";
|
|
20
|
-
static label = "Intento de procesamiento finalizado";
|
|
21
|
-
static requiresNetwork = false;
|
|
22
|
-
name = QueueAttemptEndEvent.name;
|
|
23
|
-
label = QueueAttemptEndEvent.label;
|
|
24
|
-
requiresNetwork = QueueAttemptEndEvent.requiresNetwork;
|
|
25
|
-
}
|
package/dist/domain/events.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { DomainEvent } from "../domain/event_sourcing/domain_event";
|
|
2
|
-
import { ISetting } from "../domain/settings";
|
|
3
|
-
export * from "../domain/connectivity/events";
|
|
4
|
-
export * from "../domain/event_sourcing/event";
|
|
5
|
-
export * from "../domain/print/events";
|
|
6
|
-
export * from "../domain/webview/events";
|
|
7
|
-
export declare class ActivateDomainEvent extends DomainEvent {
|
|
8
|
-
static readonly name = "common.domain.v2.activate";
|
|
9
|
-
static readonly label = "Activar dominio";
|
|
10
|
-
static readonly requiresNetwork = false;
|
|
11
|
-
readonly name = "common.domain.v2.activate";
|
|
12
|
-
readonly label = "Activar dominio";
|
|
13
|
-
readonly requiresNetwork = false;
|
|
14
|
-
domain: string;
|
|
15
|
-
}
|
|
16
|
-
export declare class DeactivateDomainEvent extends DomainEvent {
|
|
17
|
-
static readonly name = "common.domain.v2.deactivate";
|
|
18
|
-
static readonly label = "Desactivar dominio";
|
|
19
|
-
static readonly requiresNetwork = false;
|
|
20
|
-
readonly name = "common.domain.v2.deactivate";
|
|
21
|
-
readonly label = "Desactivar dominio";
|
|
22
|
-
readonly requiresNetwork = false;
|
|
23
|
-
domain: string;
|
|
24
|
-
}
|
|
25
|
-
export declare class NewAppSettingsEvent extends DomainEvent {
|
|
26
|
-
static readonly name = "common.settings.v2.added_new_settings";
|
|
27
|
-
static readonly label = "Nuevas configuraciones";
|
|
28
|
-
static readonly requiresNetwork = false;
|
|
29
|
-
readonly name = "common.settings.v2.added_new_settings";
|
|
30
|
-
readonly label = "Nuevas configuraciones";
|
|
31
|
-
readonly requiresNetwork = false;
|
|
32
|
-
settings: ISetting[];
|
|
33
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bridges the framework's `UI_NOTIFICATION_EVENT` (emitted by services via UIEventBus)
|
|
3
|
-
* to the design-system Toast. Renders nothing; the toast stack is rendered by
|
|
4
|
-
* `ToastProvider` (mounted in AppShell). Must live inside `ToastProvider`.
|
|
5
|
-
*/
|
|
6
|
-
export declare function ToastHost(): null;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { useToast } from "@sincpro/mobile-ui/Feedback";
|
|
2
|
-
import { useEffect } from "react";
|
|
3
|
-
import { UI_NOTIFICATION_EVENT } from "./events";
|
|
4
|
-
import { UIEventBus } from "./UIEventBus";
|
|
5
|
-
const VARIANT_BY_TYPE = {
|
|
6
|
-
success: "success",
|
|
7
|
-
error: "danger",
|
|
8
|
-
info: "info",
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Bridges the framework's `UI_NOTIFICATION_EVENT` (emitted by services via UIEventBus)
|
|
12
|
-
* to the design-system Toast. Renders nothing; the toast stack is rendered by
|
|
13
|
-
* `ToastProvider` (mounted in AppShell). Must live inside `ToastProvider`.
|
|
14
|
-
*/
|
|
15
|
-
export function ToastHost() {
|
|
16
|
-
const toast = useToast();
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
const off = UIEventBus.on(UI_NOTIFICATION_EVENT, (payload) => {
|
|
19
|
-
const notification = payload;
|
|
20
|
-
const variant = VARIANT_BY_TYPE[notification.type ?? "info"];
|
|
21
|
-
const message = notification.text2 ?? notification.text1 ?? "";
|
|
22
|
-
const title = notification.text2 ? notification.text1 : undefined;
|
|
23
|
-
toast.show({ message, title, variant });
|
|
24
|
-
});
|
|
25
|
-
return off;
|
|
26
|
-
}, [toast]);
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const UI_NOTIFICATION_EVENT = "ui.notification";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const UI_NOTIFICATION_EVENT = "ui.notification";
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bridges the framework's queue/cron activity state (from CommonProvider) to the
|
|
3
|
-
* design-system Toast: a persistent `loading` toast while a queue/cron task runs, and a
|
|
4
|
-
* `danger` toast on failure. Renders nothing — the toast UI is owned by the DS
|
|
5
|
-
* `ToastProvider` (mounted in AppShell), so this must live inside it.
|
|
6
|
-
*/
|
|
7
|
-
declare function ProcessToast(): null;
|
|
8
|
-
export default ProcessToast;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { useCommon } from "../../../entrypoints/ui/common_provider";
|
|
2
|
-
import { useToast } from "@sincpro/mobile-ui/Feedback";
|
|
3
|
-
import { useEffect, useRef } from "react";
|
|
4
|
-
const MAX_ERROR_LEN = 150;
|
|
5
|
-
/**
|
|
6
|
-
* Bridges the framework's queue/cron activity state (from CommonProvider) to the
|
|
7
|
-
* design-system Toast: a persistent `loading` toast while a queue/cron task runs, and a
|
|
8
|
-
* `danger` toast on failure. Renders nothing — the toast UI is owned by the DS
|
|
9
|
-
* `ToastProvider` (mounted in AppShell), so this must live inside it.
|
|
10
|
-
*/
|
|
11
|
-
function ProcessToast() {
|
|
12
|
-
const { currentActivity, lastError, isProcessing } = useCommon();
|
|
13
|
-
const toast = useToast();
|
|
14
|
-
const loadingIdRef = useRef(null);
|
|
15
|
-
const shownErrorRef = useRef(null);
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
const showLoading = isProcessing && !lastError;
|
|
18
|
-
if (showLoading) {
|
|
19
|
-
const label = currentActivity?.label ?? "Sincronizando...";
|
|
20
|
-
if (loadingIdRef.current) {
|
|
21
|
-
toast.update(loadingIdRef.current, { message: label, variant: "loading" });
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
loadingIdRef.current = toast.loading(label);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
else if (loadingIdRef.current) {
|
|
28
|
-
toast.hide(loadingIdRef.current);
|
|
29
|
-
loadingIdRef.current = null;
|
|
30
|
-
}
|
|
31
|
-
}, [isProcessing, lastError, currentActivity, toast]);
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
if (!lastError) {
|
|
34
|
-
shownErrorRef.current = null;
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
const key = `${lastError.id}:${lastError.error ?? ""}`;
|
|
38
|
-
if (shownErrorRef.current === key) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
shownErrorRef.current = key;
|
|
42
|
-
const raw = lastError.error;
|
|
43
|
-
const detail = raw
|
|
44
|
-
? raw.length > MAX_ERROR_LEN
|
|
45
|
-
? `${raw.slice(0, MAX_ERROR_LEN)}...`
|
|
46
|
-
: raw
|
|
47
|
-
: undefined;
|
|
48
|
-
toast.danger(detail ?? lastError.label, { title: `Error: ${lastError.label}` });
|
|
49
|
-
}, [lastError, toast]);
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
export default ProcessToast;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|