@open-mercato/core 0.6.6-develop.6543.1.49fadb4c31 → 0.6.6
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/.turbo/turbo-build.log +1 -1
- package/dist/modules/api_keys/api/keys/route.js +9 -23
- package/dist/modules/api_keys/api/keys/route.js.map +2 -2
- package/dist/modules/api_keys/cli.js +1 -2
- package/dist/modules/api_keys/cli.js.map +2 -2
- package/dist/modules/attachments/api/file/[id]/route.js +7 -9
- package/dist/modules/attachments/api/file/[id]/route.js.map +2 -2
- package/dist/modules/attachments/api/image/[id]/[[...slug]]/route.js +7 -9
- package/dist/modules/attachments/api/image/[id]/[[...slug]]/route.js.map +2 -2
- package/dist/modules/attachments/api/route.js +17 -21
- package/dist/modules/attachments/api/route.js.map +2 -2
- package/dist/modules/auth/api/users/route.js +2 -6
- package/dist/modules/auth/api/users/route.js.map +2 -2
- package/dist/modules/auth/cli.js +2 -3
- package/dist/modules/auth/cli.js.map +2 -2
- package/dist/modules/configs/lib/upgrade-actions.js +0 -22
- package/dist/modules/configs/lib/upgrade-actions.js.map +2 -2
- package/dist/modules/customer_accounts/widgets/injection-table.js +2 -0
- package/dist/modules/customer_accounts/widgets/injection-table.js.map +2 -2
- package/dist/modules/customers/backend/customers/companies-v2/[id]/page.js +1 -7
- package/dist/modules/customers/backend/customers/companies-v2/[id]/page.js.map +2 -2
- package/dist/modules/customers/components/detail/CompanyDetailTabs.js +7 -11
- package/dist/modules/customers/components/detail/CompanyDetailTabs.js.map +2 -2
- package/dist/modules/dashboards/api/roles/widgets/route.js +3 -22
- package/dist/modules/dashboards/api/roles/widgets/route.js.map +2 -2
- package/dist/modules/dashboards/api/users/widgets/route.js +3 -22
- package/dist/modules/dashboards/api/users/widgets/route.js.map +2 -2
- package/dist/modules/dashboards/cli.js +3 -4
- package/dist/modules/dashboards/cli.js.map +2 -2
- package/dist/modules/dashboards/lib/widgetAssignmentScope.js +1 -9
- package/dist/modules/dashboards/lib/widgetAssignmentScope.js.map +2 -2
- package/dist/modules/dictionaries/commands/entries.js +14 -7
- package/dist/modules/dictionaries/commands/entries.js.map +2 -2
- package/dist/modules/dictionaries/commands/entry-operations.js +16 -7
- package/dist/modules/dictionaries/commands/entry-operations.js.map +2 -2
- package/dist/modules/dictionaries/commands/factory.js +3 -9
- package/dist/modules/dictionaries/commands/factory.js.map +2 -2
- package/dist/modules/dictionaries/fields/dictionary.js +41 -56
- package/dist/modules/dictionaries/fields/dictionary.js.map +2 -2
- package/dist/modules/directory/utils/organizationScope.js +3 -10
- package/dist/modules/directory/utils/organizationScope.js.map +2 -2
- package/dist/modules/entities/api/records.js +4 -5
- package/dist/modules/entities/api/records.js.map +2 -2
- package/dist/modules/entities/backend/entities/system/[entityId]/page.meta.js +0 -1
- package/dist/modules/entities/backend/entities/system/[entityId]/page.meta.js.map +2 -2
- package/dist/modules/entities/backend/entities/user/[entityId]/page.js +49 -49
- package/dist/modules/entities/backend/entities/user/[entityId]/page.js.map +2 -2
- package/dist/modules/entities/backend/entities/user/[entityId]/page.meta.js +0 -1
- package/dist/modules/entities/backend/entities/user/[entityId]/page.meta.js.map +2 -2
- package/dist/modules/entities/cli.js +1 -2
- package/dist/modules/entities/cli.js.map +2 -2
- package/dist/modules/query_index/api/status.js +8 -2
- package/dist/modules/query_index/api/status.js.map +2 -2
- package/dist/modules/sales/commands/documents.js +0 -44
- package/dist/modules/sales/commands/documents.js.map +2 -2
- package/dist/modules/sales/commands/returns.js +27 -2
- package/dist/modules/sales/commands/returns.js.map +2 -2
- package/dist/modules/sales/components/documents/AddressesSection.js +2 -6
- package/dist/modules/sales/components/documents/AddressesSection.js.map +2 -2
- package/dist/modules/sales/components/documents/ItemsSection.js +0 -1
- package/dist/modules/sales/components/documents/ItemsSection.js.map +2 -2
- package/dist/modules/sales/components/documents/LineItemDialog.js +0 -9
- package/dist/modules/sales/components/documents/LineItemDialog.js.map +2 -2
- package/dist/modules/sales/components/documents/SalesDocumentForm.js +0 -44
- package/dist/modules/sales/components/documents/SalesDocumentForm.js.map +2 -2
- package/dist/modules/sales/components/documents/ShipmentDialog.js +38 -59
- package/dist/modules/sales/components/documents/ShipmentDialog.js.map +2 -2
- package/dist/modules/sales/lib/shipments/snapshots.js +1 -27
- package/dist/modules/sales/lib/shipments/snapshots.js.map +2 -2
- package/dist/modules/workflows/frontend/checkout-demo/page.js +8 -1
- package/dist/modules/workflows/frontend/checkout-demo/page.js.map +2 -2
- package/dist/modules/workflows/lib/activity-executor.js +1 -1
- package/dist/modules/workflows/lib/activity-executor.js.map +2 -2
- package/dist/modules/workflows/lib/find-definition.js +18 -2
- package/dist/modules/workflows/lib/find-definition.js.map +2 -2
- package/dist/modules/workflows/lib/signal-handler.js +3 -2
- package/dist/modules/workflows/lib/signal-handler.js.map +2 -2
- package/dist/modules/workflows/lib/step-handler.js +4 -8
- package/dist/modules/workflows/lib/step-handler.js.map +2 -2
- package/dist/modules/workflows/lib/task-handler.js +3 -5
- package/dist/modules/workflows/lib/task-handler.js.map +2 -2
- package/dist/modules/workflows/lib/timer-handler.js +2 -1
- package/dist/modules/workflows/lib/timer-handler.js.map +2 -2
- package/dist/modules/workflows/lib/transition-handler.js +5 -13
- package/dist/modules/workflows/lib/transition-handler.js.map +2 -2
- package/dist/modules/workflows/lib/workflow-executor.js +11 -9
- package/dist/modules/workflows/lib/workflow-executor.js.map +2 -2
- package/dist/modules/workflows/migrations/Migration20260715120000.js +68 -0
- package/dist/modules/workflows/migrations/Migration20260715120000.js.map +7 -0
- package/dist/modules/workflows/migrations/Migration20260716120000.js +24 -0
- package/dist/modules/workflows/migrations/Migration20260716120000.js.map +7 -0
- package/dist/modules/workflows/workflows.js +2 -0
- package/dist/modules/workflows/workflows.js.map +2 -2
- package/package.json +8 -9
- package/src/modules/api_keys/api/keys/route.ts +9 -27
- package/src/modules/api_keys/cli.ts +3 -2
- package/src/modules/attachments/api/file/[id]/route.ts +7 -11
- package/src/modules/attachments/api/image/[id]/[[...slug]]/route.ts +7 -11
- package/src/modules/attachments/api/route.ts +21 -26
- package/src/modules/auth/api/users/route.ts +2 -11
- package/src/modules/auth/cli.ts +2 -3
- package/src/modules/configs/i18n/de.json +1 -5
- package/src/modules/configs/i18n/en.json +1 -5
- package/src/modules/configs/i18n/es.json +1 -5
- package/src/modules/configs/i18n/pl.json +1 -5
- package/src/modules/configs/lib/upgrade-actions.ts +0 -24
- package/src/modules/customer_accounts/AGENTS.md +6 -8
- package/src/modules/customer_accounts/widgets/injection-table.ts +2 -0
- package/src/modules/customers/backend/customers/companies-v2/[id]/page.tsx +1 -11
- package/src/modules/customers/components/detail/CompanyDetailTabs.tsx +7 -13
- package/src/modules/dashboards/api/roles/widgets/route.ts +3 -22
- package/src/modules/dashboards/api/users/widgets/route.ts +3 -22
- package/src/modules/dashboards/cli.ts +9 -4
- package/src/modules/dashboards/lib/widgetAssignmentScope.ts +0 -18
- package/src/modules/dictionaries/commands/entries.ts +16 -7
- package/src/modules/dictionaries/commands/entry-operations.ts +18 -8
- package/src/modules/dictionaries/commands/factory.ts +2 -8
- package/src/modules/dictionaries/fields/dictionary.tsx +32 -55
- package/src/modules/dictionaries/i18n/de.json +0 -2
- package/src/modules/dictionaries/i18n/en.json +0 -2
- package/src/modules/dictionaries/i18n/es.json +0 -2
- package/src/modules/dictionaries/i18n/pl.json +0 -2
- package/src/modules/directory/utils/organizationScope.ts +2 -36
- package/src/modules/entities/api/records.ts +7 -5
- package/src/modules/entities/backend/entities/system/[entityId]/page.meta.ts +0 -1
- package/src/modules/entities/backend/entities/user/[entityId]/page.meta.ts +0 -1
- package/src/modules/entities/backend/entities/user/[entityId]/page.tsx +49 -51
- package/src/modules/entities/cli.ts +1 -2
- package/src/modules/entities/i18n/de.json +0 -34
- package/src/modules/entities/i18n/en.json +0 -34
- package/src/modules/entities/i18n/es.json +0 -34
- package/src/modules/entities/i18n/pl.json +0 -34
- package/src/modules/query_index/api/status.ts +8 -2
- package/src/modules/sales/commands/documents.ts +0 -65
- package/src/modules/sales/commands/returns.ts +32 -2
- package/src/modules/sales/components/documents/AddressesSection.tsx +2 -6
- package/src/modules/sales/components/documents/ItemsSection.tsx +0 -5
- package/src/modules/sales/components/documents/LineItemDialog.tsx +0 -10
- package/src/modules/sales/components/documents/SalesDocumentForm.tsx +0 -46
- package/src/modules/sales/components/documents/ShipmentDialog.tsx +40 -65
- package/src/modules/sales/i18n/de.json +0 -4
- package/src/modules/sales/i18n/en.json +0 -4
- package/src/modules/sales/i18n/es.json +0 -4
- package/src/modules/sales/i18n/pl.json +0 -4
- package/src/modules/sales/lib/shipments/snapshots.ts +0 -30
- package/src/modules/workflows/frontend/checkout-demo/page.tsx +12 -1
- package/src/modules/workflows/lib/activity-executor.ts +22 -2
- package/src/modules/workflows/lib/find-definition.ts +53 -1
- package/src/modules/workflows/lib/signal-handler.ts +5 -4
- package/src/modules/workflows/lib/step-handler.ts +4 -8
- package/src/modules/workflows/lib/task-handler.ts +2 -4
- package/src/modules/workflows/lib/timer-handler.ts +3 -2
- package/src/modules/workflows/lib/transition-handler.ts +5 -13
- package/src/modules/workflows/lib/workflow-executor.ts +11 -8
- package/src/modules/workflows/migrations/Migration20260715120000.ts +114 -0
- package/src/modules/workflows/migrations/Migration20260716120000.ts +57 -0
- package/src/modules/workflows/workflows.ts +2 -0
- package/dist/modules/attachments/lib/reconcileOrganization.js +0 -110
- package/dist/modules/attachments/lib/reconcileOrganization.js.map +0 -7
- package/dist/modules/attachments/lib/requestScope.js +0 -10
- package/dist/modules/attachments/lib/requestScope.js.map +0 -7
- package/dist/modules/customers/components/detail/useDealsAccess.js +0 -16
- package/dist/modules/customers/components/detail/useDealsAccess.js.map +0 -7
- package/src/modules/attachments/lib/reconcileOrganization.ts +0 -188
- package/src/modules/attachments/lib/requestScope.ts +0 -27
- package/src/modules/customers/components/detail/useDealsAccess.ts +0 -19
|
@@ -183,10 +183,6 @@ function ShipmentDialog({
|
|
|
183
183
|
const [addressOptions, setAddressOptions] = React.useState([]);
|
|
184
184
|
const [addressLoading, setAddressLoading] = React.useState(false);
|
|
185
185
|
const [addressError, setAddressError] = React.useState(null);
|
|
186
|
-
const addressLoadPromiseRef = React.useRef(null);
|
|
187
|
-
const currentAddressOrderIdRef = React.useRef(orderId);
|
|
188
|
-
currentAddressOrderIdRef.current = orderId;
|
|
189
|
-
const initializedDialogKeyRef = React.useRef(null);
|
|
190
186
|
const [documentStatuses, setDocumentStatuses] = React.useState([]);
|
|
191
187
|
const [lineStatuses, setLineStatuses] = React.useState([]);
|
|
192
188
|
const [shipmentStatuses, setShipmentStatuses] = React.useState([]);
|
|
@@ -344,49 +340,35 @@ function ShipmentDialog({
|
|
|
344
340
|
}),
|
|
345
341
|
[]
|
|
346
342
|
);
|
|
347
|
-
const loadAddressOptions = React.useCallback(() => {
|
|
348
|
-
const activeRequest = addressLoadPromiseRef.current;
|
|
349
|
-
if (activeRequest?.orderId === orderId) return activeRequest.promise;
|
|
343
|
+
const loadAddressOptions = React.useCallback(async () => {
|
|
350
344
|
setAddressLoading(true);
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
return baseAddressOptions;
|
|
379
|
-
}
|
|
380
|
-
})();
|
|
381
|
-
addressLoadPromiseRef.current = { orderId, promise: request };
|
|
382
|
-
void request.then(() => {
|
|
383
|
-
if (addressLoadPromiseRef.current?.promise === request) {
|
|
384
|
-
addressLoadPromiseRef.current = null;
|
|
385
|
-
setAddressLoading(false);
|
|
386
|
-
}
|
|
387
|
-
});
|
|
388
|
-
return request;
|
|
389
|
-
}, [baseAddressOptions, mapDocumentAddressOption, mergeAddressOptions, orderId, t]);
|
|
345
|
+
try {
|
|
346
|
+
const params = new URLSearchParams({
|
|
347
|
+
page: "1",
|
|
348
|
+
pageSize: "100",
|
|
349
|
+
documentId: orderId,
|
|
350
|
+
documentKind: "order"
|
|
351
|
+
});
|
|
352
|
+
const response = await apiCall(
|
|
353
|
+
`/api/sales/document-addresses?${params.toString()}`,
|
|
354
|
+
void 0,
|
|
355
|
+
{ fallback: { items: [] } }
|
|
356
|
+
);
|
|
357
|
+
const items = Array.isArray(response.result?.items) ? response.result.items : [];
|
|
358
|
+
const mapped = items.map((item) => mapDocumentAddressOption(item)).filter((entry) => Boolean(entry));
|
|
359
|
+
mergeAddressOptions(mapped);
|
|
360
|
+
setAddressError(null);
|
|
361
|
+
return mapped;
|
|
362
|
+
} catch (err) {
|
|
363
|
+
logger.error("sales.shipments.addresses.load", { err });
|
|
364
|
+
setAddressError(
|
|
365
|
+
t("sales.documents.shipments.addressLoadError", "Failed to load addresses.")
|
|
366
|
+
);
|
|
367
|
+
return [];
|
|
368
|
+
} finally {
|
|
369
|
+
setAddressLoading(false);
|
|
370
|
+
}
|
|
371
|
+
}, [mapDocumentAddressOption, mergeAddressOptions, orderId, t]);
|
|
390
372
|
const buildPriceSubtitle = React.useCallback(
|
|
391
373
|
(option) => {
|
|
392
374
|
const currency = option.currencyCode ?? currencyCode ?? void 0;
|
|
@@ -656,20 +638,16 @@ function ShipmentDialog({
|
|
|
656
638
|
[renderStatusIcon, shipmentStatuses]
|
|
657
639
|
);
|
|
658
640
|
React.useEffect(() => {
|
|
659
|
-
if (!open)
|
|
660
|
-
initializedDialogKeyRef.current = null;
|
|
661
|
-
return;
|
|
662
|
-
}
|
|
663
|
-
const dialogKey = `${orderId}:${mode}:${shipment?.id ?? "new"}`;
|
|
664
|
-
if (initializedDialogKeyRef.current === dialogKey) return;
|
|
665
|
-
initializedDialogKeyRef.current = dialogKey;
|
|
641
|
+
if (!open) return;
|
|
666
642
|
setFormResetKey((prev) => prev + 1);
|
|
667
643
|
if (!shippingMethods.length) {
|
|
668
644
|
void loadShippingMethods();
|
|
669
645
|
}
|
|
670
646
|
setAddressOptions(baseAddressOptions);
|
|
671
647
|
setAddressError(null);
|
|
672
|
-
|
|
648
|
+
if (!addressOptions.length) {
|
|
649
|
+
void loadAddressOptions();
|
|
650
|
+
}
|
|
673
651
|
if (!shipmentStatuses.length) {
|
|
674
652
|
void loadShipmentStatuses();
|
|
675
653
|
}
|
|
@@ -680,6 +658,7 @@ function ShipmentDialog({
|
|
|
680
658
|
void loadLineStatuses();
|
|
681
659
|
}
|
|
682
660
|
}, [
|
|
661
|
+
addressOptions.length,
|
|
683
662
|
baseAddressOptions,
|
|
684
663
|
documentStatuses.length,
|
|
685
664
|
loadAddressOptions,
|
|
@@ -689,8 +668,6 @@ function ShipmentDialog({
|
|
|
689
668
|
loadShippingMethods,
|
|
690
669
|
mode,
|
|
691
670
|
open,
|
|
692
|
-
orderId,
|
|
693
|
-
shipment?.id,
|
|
694
671
|
lineStatuses.length,
|
|
695
672
|
shipmentStatuses.length,
|
|
696
673
|
shippingMethods.length
|
|
@@ -741,9 +718,11 @@ function ShipmentDialog({
|
|
|
741
718
|
}, [baseAddressOptions, mergeAddressOptions, open]);
|
|
742
719
|
const fetchAddressItems = React.useCallback(
|
|
743
720
|
async (query) => {
|
|
744
|
-
|
|
721
|
+
if (!addressOptions.length && !addressLoading) {
|
|
722
|
+
await loadAddressOptions();
|
|
723
|
+
}
|
|
745
724
|
const needle = query?.trim().toLowerCase() ?? "";
|
|
746
|
-
return
|
|
725
|
+
return addressOptions.filter((option) => {
|
|
747
726
|
if (!needle) return true;
|
|
748
727
|
return option.label.toLowerCase().includes(needle) || option.summary.toLowerCase().includes(needle);
|
|
749
728
|
}).map((option) => ({
|
|
@@ -753,7 +732,7 @@ function ShipmentDialog({
|
|
|
753
732
|
icon: /* @__PURE__ */ jsx("div", { className: "flex h-8 w-8 items-center justify-center rounded-md bg-muted text-muted-foreground", children: /* @__PURE__ */ jsx(MapPin, { className: "h-4 w-4" }) })
|
|
754
733
|
}));
|
|
755
734
|
},
|
|
756
|
-
[addressOptions, loadAddressOptions]
|
|
735
|
+
[addressLoading, addressOptions, loadAddressOptions]
|
|
757
736
|
);
|
|
758
737
|
const validateItems = React.useCallback(
|
|
759
738
|
(itemsValue) => {
|