@open-mercato/core 0.7.1-develop.7153.1.7145d295e6 → 0.7.1-develop.7170.1.d95074d7ba
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/AGENTS.md +2 -2
- package/dist/modules/auth/commands/users.js +14 -1
- package/dist/modules/auth/commands/users.js.map +2 -2
- package/dist/modules/auth/data/entities.js +2 -2
- package/dist/modules/auth/data/entities.js.map +2 -2
- package/dist/modules/auth/lib/backendChrome.js +26 -3
- package/dist/modules/auth/lib/backendChrome.js.map +2 -2
- package/dist/modules/auth/lib/profile-sections.js +1 -1
- package/dist/modules/auth/lib/profile-sections.js.map +2 -2
- package/dist/modules/auth/migrations/Migration20260907120000_auth.js +19 -0
- package/dist/modules/auth/migrations/Migration20260907120000_auth.js.map +7 -0
- package/dist/modules/communication_channels/backend/profile/communication-channels/page.meta.js +2 -2
- package/dist/modules/communication_channels/backend/profile/communication-channels/page.meta.js.map +1 -1
- package/dist/modules/customer_accounts/api/admin/demo-accounts.js +118 -0
- package/dist/modules/customer_accounts/api/admin/demo-accounts.js.map +7 -0
- package/dist/modules/customer_accounts/api/invitations/accept.js +23 -6
- package/dist/modules/customer_accounts/api/invitations/accept.js.map +2 -2
- package/dist/modules/customer_accounts/backend/customer_accounts/settings/CustomerAccountsSettingsPageClient.js +10 -13
- package/dist/modules/customer_accounts/backend/customer_accounts/settings/CustomerAccountsSettingsPageClient.js.map +2 -2
- package/dist/modules/customer_accounts/backend/customer_accounts/useDemoPortalAccounts.js +28 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/useDemoPortalAccounts.js.map +7 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/users/PortalUsersPageClient.js +6 -1
- package/dist/modules/customer_accounts/backend/customer_accounts/users/PortalUsersPageClient.js.map +2 -2
- package/dist/modules/customer_accounts/data/entities.js +4 -1
- package/dist/modules/customer_accounts/data/entities.js.map +2 -2
- package/dist/modules/customer_accounts/lib/exampleAccounts.js +9 -0
- package/dist/modules/customer_accounts/lib/exampleAccounts.js.map +7 -0
- package/dist/modules/customer_accounts/migrations/Migration20260827160000_customer_accounts.js +16 -0
- package/dist/modules/customer_accounts/migrations/Migration20260827160000_customer_accounts.js.map +7 -0
- package/dist/modules/customer_accounts/services/customerInvitationService.js +53 -6
- package/dist/modules/customer_accounts/services/customerInvitationService.js.map +2 -2
- package/dist/modules/customer_accounts/setup.js +2 -6
- package/dist/modules/customer_accounts/setup.js.map +2 -2
- package/dist/modules/customer_accounts/widgets/injection/account-status/widget.client.js +55 -40
- package/dist/modules/customer_accounts/widgets/injection/account-status/widget.client.js.map +2 -2
- package/dist/modules/customers/commands/people.js +16 -1
- package/dist/modules/customers/commands/people.js.map +2 -2
- package/dist/modules/data_sync/backend/data-sync/runs/[id]/page.js +18 -36
- package/dist/modules/data_sync/backend/data-sync/runs/[id]/page.js.map +2 -2
- package/dist/modules/data_sync/lib/sync-schedule-service.js +25 -23
- package/dist/modules/data_sync/lib/sync-schedule-service.js.map +2 -2
- package/dist/modules/entities/api/records.js +18 -15
- package/dist/modules/entities/api/records.js.map +3 -3
- package/dist/modules/entities/lib/scoped-field-defs.js +52 -0
- package/dist/modules/entities/lib/scoped-field-defs.js.map +7 -0
- package/dist/modules/entities/lib/validation.js +4 -35
- package/dist/modules/entities/lib/validation.js.map +2 -2
- package/dist/modules/integrations/backend/integrations/[id]/page.js +32 -54
- package/dist/modules/integrations/backend/integrations/[id]/page.js.map +2 -2
- package/dist/modules/integrations/backend/integrations/bundle/[id]/page.js +12 -29
- package/dist/modules/integrations/backend/integrations/bundle/[id]/page.js.map +2 -2
- package/dist/modules/notifications/backend/profile/notification-preferences/page.meta.js +2 -2
- package/dist/modules/notifications/backend/profile/notification-preferences/page.meta.js.map +1 -1
- package/dist/modules/progress/lib/progressServiceImpl.js +14 -3
- package/dist/modules/progress/lib/progressServiceImpl.js.map +2 -2
- package/dist/modules/sales/backend/sales/documents/[id]/page.js +9 -9
- package/dist/modules/sales/backend/sales/documents/[id]/page.js.map +2 -2
- package/dist/modules/sales/components/documents/LineItemDialog.js +50 -10
- package/dist/modules/sales/components/documents/LineItemDialog.js.map +2 -2
- package/dist/modules/sales/components/documents/PaymentsSection.js +8 -3
- package/dist/modules/sales/components/documents/PaymentsSection.js.map +2 -2
- package/dist/modules/sales/components/documents/ReturnEditDialog.js +2 -7
- package/dist/modules/sales/components/documents/ReturnEditDialog.js.map +2 -2
- package/dist/modules/sales/components/documents/ReturnsSection.js +2 -7
- package/dist/modules/sales/components/documents/ReturnsSection.js.map +2 -2
- package/dist/modules/sales/components/documents/ShipmentsSection.js +3 -8
- package/dist/modules/sales/components/documents/ShipmentsSection.js.map +2 -2
- package/package.json +7 -7
- package/src/modules/auth/commands/users.ts +14 -1
- package/src/modules/auth/data/entities.ts +2 -2
- package/src/modules/auth/lib/backendChrome.tsx +46 -2
- package/src/modules/auth/lib/profile-sections.tsx +14 -3
- package/src/modules/auth/migrations/.snapshot-open-mercato.json +4 -2
- package/src/modules/auth/migrations/Migration20260907120000_auth.ts +21 -0
- package/src/modules/communication_channels/backend/profile/communication-channels/page.meta.ts +2 -2
- package/src/modules/customer_accounts/AGENTS.md +3 -1
- package/src/modules/customer_accounts/api/admin/demo-accounts.ts +149 -0
- package/src/modules/customer_accounts/api/invitations/accept.ts +23 -6
- package/src/modules/customer_accounts/backend/customer_accounts/settings/CustomerAccountsSettingsPageClient.tsx +43 -41
- package/src/modules/customer_accounts/backend/customer_accounts/useDemoPortalAccounts.ts +42 -0
- package/src/modules/customer_accounts/backend/customer_accounts/users/PortalUsersPageClient.tsx +10 -3
- package/src/modules/customer_accounts/data/entities.ts +5 -1
- package/src/modules/customer_accounts/i18n/de.json +4 -2
- package/src/modules/customer_accounts/i18n/en.json +4 -2
- package/src/modules/customer_accounts/i18n/es.json +4 -2
- package/src/modules/customer_accounts/i18n/ko.json +4 -2
- package/src/modules/customer_accounts/i18n/pl.json +4 -2
- package/src/modules/customer_accounts/lib/exampleAccounts.ts +18 -0
- package/src/modules/customer_accounts/migrations/.snapshot-open-mercato.json +5 -7
- package/src/modules/customer_accounts/migrations/Migration20260827160000_customer_accounts.ts +23 -0
- package/src/modules/customer_accounts/services/customerInvitationService.ts +89 -5
- package/src/modules/customer_accounts/setup.ts +2 -6
- package/src/modules/customer_accounts/widgets/injection/account-status/widget.client.tsx +74 -41
- package/src/modules/customers/commands/people.ts +15 -0
- package/src/modules/data_sync/backend/data-sync/runs/[id]/page.tsx +19 -44
- package/src/modules/data_sync/lib/sync-schedule-service.ts +32 -26
- package/src/modules/entities/api/records.ts +24 -15
- package/src/modules/entities/lib/scoped-field-defs.ts +76 -0
- package/src/modules/entities/lib/validation.ts +5 -45
- package/src/modules/integrations/backend/integrations/[id]/page.tsx +33 -62
- package/src/modules/integrations/backend/integrations/bundle/[id]/page.tsx +13 -37
- package/src/modules/notifications/backend/profile/notification-preferences/page.meta.ts +2 -2
- package/src/modules/progress/AGENTS.md +1 -1
- package/src/modules/progress/lib/progressServiceImpl.ts +26 -3
- package/src/modules/sales/backend/sales/documents/[id]/page.tsx +19 -25
- package/src/modules/sales/components/documents/LineItemDialog.tsx +53 -9
- package/src/modules/sales/components/documents/PaymentsSection.tsx +8 -8
- package/src/modules/sales/components/documents/ReturnEditDialog.tsx +2 -8
- package/src/modules/sales/components/documents/ReturnsSection.tsx +8 -7
- package/src/modules/sales/components/documents/ShipmentsSection.tsx +9 -8
- package/src/modules/sales/i18n/de.json +2 -0
- package/src/modules/sales/i18n/en.json +2 -0
- package/src/modules/sales/i18n/es.json +2 -0
- package/src/modules/sales/i18n/ko.json +2 -0
- package/src/modules/sales/i18n/pl.json +2 -0
|
@@ -50,6 +50,7 @@ import {
|
|
|
50
50
|
extractCustomFieldValues
|
|
51
51
|
} from "./customFieldHelpers.js";
|
|
52
52
|
import { canonicalizeUnitCode } from "@open-mercato/shared/lib/units/unitCodes";
|
|
53
|
+
import { parseLocaleNumber } from "@open-mercato/shared/lib/number";
|
|
53
54
|
import { createLogger } from "@open-mercato/shared/lib/logger";
|
|
54
55
|
const logger = createLogger("sales");
|
|
55
56
|
function mapTaxRateOption(item) {
|
|
@@ -213,6 +214,26 @@ function LineItemDialog({
|
|
|
213
214
|
}) {
|
|
214
215
|
const t = useT();
|
|
215
216
|
const locale = useLocale();
|
|
217
|
+
const parseUserNumber = React.useCallback(
|
|
218
|
+
(value) => {
|
|
219
|
+
if (value == null) return 0;
|
|
220
|
+
if (typeof value === "number") return Number.isFinite(value) ? value : null;
|
|
221
|
+
if (typeof value !== "string") return null;
|
|
222
|
+
if (!value.trim()) return 0;
|
|
223
|
+
return parseLocaleNumber(value, locale);
|
|
224
|
+
},
|
|
225
|
+
[locale]
|
|
226
|
+
);
|
|
227
|
+
const numberExample = React.useMemo(() => {
|
|
228
|
+
try {
|
|
229
|
+
return new Intl.NumberFormat(locale, {
|
|
230
|
+
minimumFractionDigits: 2,
|
|
231
|
+
maximumFractionDigits: 2
|
|
232
|
+
}).format(110.7);
|
|
233
|
+
} catch {
|
|
234
|
+
return "110.70";
|
|
235
|
+
}
|
|
236
|
+
}, [locale]);
|
|
216
237
|
const scope = useOrganizationScopeDetail();
|
|
217
238
|
const resolvedOrganizationId = organizationId ?? scope.organizationId ?? null;
|
|
218
239
|
const resolvedTenantId = tenantId ?? scope.tenantId ?? null;
|
|
@@ -537,7 +558,7 @@ function LineItemDialog({
|
|
|
537
558
|
try {
|
|
538
559
|
const params = new URLSearchParams({ productId, pageSize: "20" });
|
|
539
560
|
if (variantId) params.set("variantId", variantId);
|
|
540
|
-
const quantityValue =
|
|
561
|
+
const quantityValue = parseUserNumber(quantity) ?? Number.NaN;
|
|
541
562
|
if (Number.isFinite(quantityValue) && quantityValue > 0) {
|
|
542
563
|
params.set("quantity", String(quantityValue));
|
|
543
564
|
}
|
|
@@ -607,7 +628,7 @@ function LineItemDialog({
|
|
|
607
628
|
setPriceLoading(false);
|
|
608
629
|
}
|
|
609
630
|
},
|
|
610
|
-
[t]
|
|
631
|
+
[parseUserNumber, t]
|
|
611
632
|
);
|
|
612
633
|
const selectPriceAfterRefresh = React.useCallback(
|
|
613
634
|
(prices, currentPriceId, currentPriceKindId) => {
|
|
@@ -639,7 +660,7 @@ function LineItemDialog({
|
|
|
639
660
|
);
|
|
640
661
|
const convertUnitPriceForUnitChange = React.useCallback(
|
|
641
662
|
(rawUnitPrice, fromUnit, toUnit) => {
|
|
642
|
-
const amount =
|
|
663
|
+
const amount = parseUserNumber(rawUnitPrice) ?? Number.NaN;
|
|
643
664
|
if (!Number.isFinite(amount) || amount <= 0) return null;
|
|
644
665
|
const fromCode = normalizeUnitCode(fromUnit);
|
|
645
666
|
const toCode = normalizeUnitCode(toUnit);
|
|
@@ -654,7 +675,7 @@ function LineItemDialog({
|
|
|
654
675
|
if (!Number.isFinite(convertedAmount) || convertedAmount <= 0) return null;
|
|
655
676
|
return normalizeUnitPriceInputValue(convertedAmount);
|
|
656
677
|
},
|
|
657
|
-
[resolveUnitPriceFactor]
|
|
678
|
+
[parseUserNumber, resolveUnitPriceFactor]
|
|
658
679
|
);
|
|
659
680
|
const applyPriceSelection = React.useCallback(
|
|
660
681
|
(selected, setFormValue, options) => {
|
|
@@ -782,8 +803,16 @@ function LineItemDialog({
|
|
|
782
803
|
}
|
|
783
804
|
);
|
|
784
805
|
}
|
|
785
|
-
const qtyNumber =
|
|
786
|
-
if (
|
|
806
|
+
const qtyNumber = parseUserNumber(values.quantity);
|
|
807
|
+
if (qtyNumber === null) {
|
|
808
|
+
const message = t(
|
|
809
|
+
"sales.documents.items.errorQuantityInvalid",
|
|
810
|
+
"Enter the quantity as a number, for example {{example}}.",
|
|
811
|
+
{ example: numberExample }
|
|
812
|
+
);
|
|
813
|
+
throw createCrudFormError(message, { quantity: message });
|
|
814
|
+
}
|
|
815
|
+
if (qtyNumber <= 0) {
|
|
787
816
|
throw createCrudFormError(
|
|
788
817
|
t(
|
|
789
818
|
"sales.documents.items.errorQuantity",
|
|
@@ -813,8 +842,16 @@ function LineItemDialog({
|
|
|
813
842
|
if (isCustomLine) return entered;
|
|
814
843
|
return entered ?? normalizeUnitCode(productOption?.defaultSalesUnit) ?? normalizeUnitCode(productOption?.defaultUnit);
|
|
815
844
|
})();
|
|
816
|
-
const unitPriceNumber =
|
|
817
|
-
if (
|
|
845
|
+
const unitPriceNumber = parseUserNumber(values.unitPrice);
|
|
846
|
+
if (unitPriceNumber === null) {
|
|
847
|
+
const message = t(
|
|
848
|
+
"sales.documents.items.errorUnitPriceInvalid",
|
|
849
|
+
"Enter the unit price as a number, for example {{example}}.",
|
|
850
|
+
{ example: numberExample }
|
|
851
|
+
);
|
|
852
|
+
throw createCrudFormError(message, { unitPrice: message });
|
|
853
|
+
}
|
|
854
|
+
if (unitPriceNumber <= 0) {
|
|
818
855
|
throw createCrudFormError(
|
|
819
856
|
t(
|
|
820
857
|
"sales.documents.items.errorUnitPrice",
|
|
@@ -976,6 +1013,8 @@ function LineItemDialog({
|
|
|
976
1013
|
variantOption,
|
|
977
1014
|
onSaved,
|
|
978
1015
|
closeDialog,
|
|
1016
|
+
numberExample,
|
|
1017
|
+
parseUserNumber,
|
|
979
1018
|
resolvedOrganizationId,
|
|
980
1019
|
resolvedTenantId
|
|
981
1020
|
]
|
|
@@ -1715,7 +1754,7 @@ function LineItemDialog({
|
|
|
1715
1754
|
layout: "full",
|
|
1716
1755
|
component: ({ values }) => {
|
|
1717
1756
|
if (isCustomLine) return null;
|
|
1718
|
-
const quantity =
|
|
1757
|
+
const quantity = parseUserNumber(values?.quantity) ?? Number.NaN;
|
|
1719
1758
|
const enteredUnit = normalizeUnitCode(values?.quantityUnit);
|
|
1720
1759
|
if (!Number.isFinite(quantity) || quantity <= 0 || !enteredUnit) {
|
|
1721
1760
|
return /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t(
|
|
@@ -1811,7 +1850,8 @@ function LineItemDialog({
|
|
|
1811
1850
|
resolveTaxSelection,
|
|
1812
1851
|
selectPriceAfterRefresh,
|
|
1813
1852
|
hasTaxMetadata,
|
|
1814
|
-
isShippedOrderLine
|
|
1853
|
+
isShippedOrderLine,
|
|
1854
|
+
parseUserNumber
|
|
1815
1855
|
]);
|
|
1816
1856
|
const groups = React.useMemo(() => {
|
|
1817
1857
|
return [
|