@open-mercato/core 0.6.6-develop.6246.1.85fd30c705 → 0.6.6-develop.6253.1.a8c2b49d90
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/customers/components/detail/DecisionMakersFooter.js +3 -3
- package/dist/modules/customers/components/detail/DecisionMakersFooter.js.map +2 -2
- package/dist/modules/sales/commands/documents.js +25 -9
- package/dist/modules/sales/commands/documents.js.map +2 -2
- package/dist/modules/sales/commands/shared.js +33 -0
- package/dist/modules/sales/commands/shared.js.map +2 -2
- package/dist/modules/sales/migrations/Migration20260624120000_backfill_line_net_from_gross.js +27 -0
- package/dist/modules/sales/migrations/Migration20260624120000_backfill_line_net_from_gross.js.map +7 -0
- package/package.json +7 -7
- package/src/modules/customers/components/detail/DecisionMakersFooter.tsx +14 -12
- package/src/modules/sales/commands/documents.ts +25 -9
- package/src/modules/sales/commands/shared.ts +68 -0
- package/src/modules/sales/migrations/Migration20260624120000_backfill_line_net_from_gross.ts +48 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -3,7 +3,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { Lightbulb, Send } from "lucide-react";
|
|
4
4
|
import { useT } from "@open-mercato/shared/lib/i18n/context";
|
|
5
5
|
import { Button } from "@open-mercato/ui/primitives/button";
|
|
6
|
-
import { Tooltip, TooltipContent, TooltipTrigger } from "@open-mercato/ui/primitives/tooltip";
|
|
6
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@open-mercato/ui/primitives/tooltip";
|
|
7
7
|
function DecisionMakersFooter({ names, suggestion, onSendInvitation }) {
|
|
8
8
|
const t = useT();
|
|
9
9
|
if (names.length === 0) return null;
|
|
@@ -24,13 +24,13 @@ function DecisionMakersFooter({ names, suggestion, onSendInvitation }) {
|
|
|
24
24
|
suggestion && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mt-0.5", children: suggestion })
|
|
25
25
|
] })
|
|
26
26
|
] }),
|
|
27
|
-
onSendInvitation && /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
27
|
+
onSendInvitation && /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 300, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
28
28
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "w-full shrink-0 sm:w-auto", children: /* @__PURE__ */ jsxs(Button, { type: "button", size: "sm", disabled: true, className: "pointer-events-none w-full sm:w-auto", children: [
|
|
29
29
|
/* @__PURE__ */ jsx(Send, { className: "mr-1.5 size-3.5" }),
|
|
30
30
|
t("customers.people.decisionMakers.sendInvitation", "Send invitation")
|
|
31
31
|
] }) }) }),
|
|
32
32
|
/* @__PURE__ */ jsx(TooltipContent, { children: t("customers.ai.comingSoon", "Coming soon") })
|
|
33
|
-
] })
|
|
33
|
+
] }) })
|
|
34
34
|
] });
|
|
35
35
|
}
|
|
36
36
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/modules/customers/components/detail/DecisionMakersFooter.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { Lightbulb, Send } from 'lucide-react'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Tooltip, TooltipContent, TooltipTrigger } from '@open-mercato/ui/primitives/tooltip'\n\ninterface DecisionMakersFooterProps {\n names: string[]\n suggestion?: string\n onSendInvitation?: () => void\n}\n\nexport function DecisionMakersFooter({ names, suggestion, onSendInvitation }: DecisionMakersFooterProps) {\n const t = useT()\n\n if (names.length === 0) return null\n\n const visibleNames = names.slice(0, 4)\n const hiddenCount = Math.max(0, names.length - visibleNames.length)\n\n return (\n <div className=\"sticky bottom-0 flex flex-col gap-3 rounded-lg border bg-card px-4 py-3 shadow-sm sm:flex-row sm:items-center sm:justify-between\">\n <div className=\"flex min-w-0 items-start gap-3\">\n <Lightbulb className=\"mt-0.5 size-4 shrink-0 text-muted-foreground\" />\n <div className=\"min-w-0\">\n <p className=\"text-overline font-semibold uppercase tracking-wide text-muted-foreground\">\n {t('customers.people.decisionMakers.label', 'Decision Makers')}\n </p>\n <p className=\"break-words text-sm font-medium\">\n {t('customers.people.decisionMakers.count', '{count} key people', { count: names.length })}:\n {' '}{visibleNames.join(' \\u00b7 ')}\n {hiddenCount > 0 ? ` \\u00b7 +${hiddenCount} ${t('customers.people.decisionMakers.more', 'more')}` : ''}\n </p>\n {suggestion && (\n <p className=\"text-xs text-muted-foreground mt-0.5\">{suggestion}</p>\n )}\n </div>\n </div>\n {onSendInvitation && (\n <
|
|
5
|
-
"mappings": ";AAyBQ,cAKE,YALF;AAtBR,SAAS,WAAW,YAAY;AAChC,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB,SAAS,SAAS,gBAAgB,sBAAsB;
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { Lightbulb, Send } from 'lucide-react'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@open-mercato/ui/primitives/tooltip'\n\ninterface DecisionMakersFooterProps {\n names: string[]\n suggestion?: string\n onSendInvitation?: () => void\n}\n\nexport function DecisionMakersFooter({ names, suggestion, onSendInvitation }: DecisionMakersFooterProps) {\n const t = useT()\n\n if (names.length === 0) return null\n\n const visibleNames = names.slice(0, 4)\n const hiddenCount = Math.max(0, names.length - visibleNames.length)\n\n return (\n <div className=\"sticky bottom-0 flex flex-col gap-3 rounded-lg border bg-card px-4 py-3 shadow-sm sm:flex-row sm:items-center sm:justify-between\">\n <div className=\"flex min-w-0 items-start gap-3\">\n <Lightbulb className=\"mt-0.5 size-4 shrink-0 text-muted-foreground\" />\n <div className=\"min-w-0\">\n <p className=\"text-overline font-semibold uppercase tracking-wide text-muted-foreground\">\n {t('customers.people.decisionMakers.label', 'Decision Makers')}\n </p>\n <p className=\"break-words text-sm font-medium\">\n {t('customers.people.decisionMakers.count', '{count} key people', { count: names.length })}:\n {' '}{visibleNames.join(' \\u00b7 ')}\n {hiddenCount > 0 ? ` \\u00b7 +${hiddenCount} ${t('customers.people.decisionMakers.more', 'more')}` : ''}\n </p>\n {suggestion && (\n <p className=\"text-xs text-muted-foreground mt-0.5\">{suggestion}</p>\n )}\n </div>\n </div>\n {onSendInvitation && (\n <TooltipProvider delayDuration={300}>\n <Tooltip>\n <TooltipTrigger asChild>\n <span className=\"w-full shrink-0 sm:w-auto\">\n <Button type=\"button\" size=\"sm\" disabled className=\"pointer-events-none w-full sm:w-auto\">\n <Send className=\"mr-1.5 size-3.5\" />\n {t('customers.people.decisionMakers.sendInvitation', 'Send invitation')}\n </Button>\n </span>\n </TooltipTrigger>\n <TooltipContent>{t('customers.ai.comingSoon', 'Coming soon')}</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n )}\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAyBQ,cAKE,YALF;AAtBR,SAAS,WAAW,YAAY;AAChC,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB,SAAS,SAAS,gBAAgB,iBAAiB,sBAAsB;AAQlE,SAAS,qBAAqB,EAAE,OAAO,YAAY,iBAAiB,GAA8B;AACvG,QAAM,IAAI,KAAK;AAEf,MAAI,MAAM,WAAW,EAAG,QAAO;AAE/B,QAAM,eAAe,MAAM,MAAM,GAAG,CAAC;AACrC,QAAM,cAAc,KAAK,IAAI,GAAG,MAAM,SAAS,aAAa,MAAM;AAElE,SACE,qBAAC,SAAI,WAAU,oIACb;AAAA,yBAAC,SAAI,WAAU,kCACb;AAAA,0BAAC,aAAU,WAAU,gDAA+C;AAAA,MACpE,qBAAC,SAAI,WAAU,WACb;AAAA,4BAAC,OAAE,WAAU,6EACV,YAAE,yCAAyC,iBAAiB,GAC/D;AAAA,QACA,qBAAC,OAAE,WAAU,mCACV;AAAA,YAAE,yCAAyC,sBAAsB,EAAE,OAAO,MAAM,OAAO,CAAC;AAAA,UAAE;AAAA,UAC1F;AAAA,UAAK,aAAa,KAAK,QAAU;AAAA,UACjC,cAAc,IAAI,UAAY,WAAW,IAAI,EAAE,wCAAwC,MAAM,CAAC,KAAK;AAAA,WACtG;AAAA,QACC,cACC,oBAAC,OAAE,WAAU,wCAAwC,sBAAW;AAAA,SAEpE;AAAA,OACF;AAAA,IACC,oBACC,oBAAC,mBAAgB,eAAe,KAC9B,+BAAC,WACC;AAAA,0BAAC,kBAAe,SAAO,MACrB,8BAAC,UAAK,WAAU,6BACd,+BAAC,UAAO,MAAK,UAAS,MAAK,MAAK,UAAQ,MAAC,WAAU,wCACjD;AAAA,4BAAC,QAAK,WAAU,mBAAkB;AAAA,QACjC,EAAE,kDAAkD,iBAAiB;AAAA,SACxE,GACF,GACF;AAAA,MACA,oBAAC,kBAAgB,YAAE,2BAA2B,aAAa,GAAE;AAAA,OAC/D,GACF;AAAA,KAEJ;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -78,6 +78,8 @@ import {
|
|
|
78
78
|
ensureTenantScope,
|
|
79
79
|
extractUndoPayload,
|
|
80
80
|
toNumericString,
|
|
81
|
+
reconcileLinePersistedTotals,
|
|
82
|
+
deriveLineNetFromGross,
|
|
81
83
|
enforceSalesDocumentOptimisticLock,
|
|
82
84
|
SALES_RESOURCE_KIND_ORDER,
|
|
83
85
|
SALES_RESOURCE_KIND_QUOTE
|
|
@@ -1879,7 +1881,7 @@ function createAdjustmentDraftFromInput(adjustment) {
|
|
|
1879
1881
|
}
|
|
1880
1882
|
function convertLineCalculationToEntityInput(lineResult, sourceLine, document, index) {
|
|
1881
1883
|
const line = lineResult.line;
|
|
1882
|
-
return {
|
|
1884
|
+
return reconcileLinePersistedTotals({
|
|
1883
1885
|
lineNumber: line.lineNumber ?? index + 1,
|
|
1884
1886
|
kind: line.kind ?? "product",
|
|
1885
1887
|
statusEntryId: sourceLine.statusEntryId ?? null,
|
|
@@ -1914,7 +1916,7 @@ function convertLineCalculationToEntityInput(lineResult, sourceLine, document, i
|
|
|
1914
1916
|
customFieldSetId: sourceLine.customFieldSetId ?? null,
|
|
1915
1917
|
organizationId: document.organizationId,
|
|
1916
1918
|
tenantId: document.tenantId
|
|
1917
|
-
};
|
|
1919
|
+
});
|
|
1918
1920
|
}
|
|
1919
1921
|
function convertAdjustmentResultToEntityInput(adjustment, sourceAdjustment, document, index) {
|
|
1920
1922
|
const metadata = adjustment.metadata ? cloneJson(adjustment.metadata) : null;
|
|
@@ -2639,7 +2641,9 @@ async function restoreQuoteGraph(em, snapshot) {
|
|
|
2639
2641
|
discountPercent: line.discountPercent,
|
|
2640
2642
|
taxRate: line.taxRate,
|
|
2641
2643
|
taxAmount: line.taxAmount,
|
|
2642
|
-
totalNetAmount:
|
|
2644
|
+
totalNetAmount: toNumericString(
|
|
2645
|
+
deriveLineNetFromGross(line.totalNetAmount, line.totalGrossAmount, line.taxRate)
|
|
2646
|
+
),
|
|
2643
2647
|
totalGrossAmount: line.totalGrossAmount,
|
|
2644
2648
|
configuration: line.configuration ? cloneJson(line.configuration) : null,
|
|
2645
2649
|
promotionCode: line.promotionCode ?? null,
|
|
@@ -2924,7 +2928,9 @@ async function restoreOrderGraph(em, snapshot) {
|
|
|
2924
2928
|
discountPercent: line.discountPercent,
|
|
2925
2929
|
taxRate: line.taxRate,
|
|
2926
2930
|
taxAmount: line.taxAmount,
|
|
2927
|
-
totalNetAmount:
|
|
2931
|
+
totalNetAmount: toNumericString(
|
|
2932
|
+
deriveLineNetFromGross(line.totalNetAmount, line.totalGrossAmount, line.taxRate)
|
|
2933
|
+
),
|
|
2928
2934
|
totalGrossAmount: line.totalGrossAmount,
|
|
2929
2935
|
configuration: line.configuration ? cloneJson(line.configuration) : null,
|
|
2930
2936
|
promotionCode: line.promotionCode ?? null,
|
|
@@ -4583,7 +4589,9 @@ const convertQuoteToOrderCommand = {
|
|
|
4583
4589
|
discountPercent: line.discountPercent,
|
|
4584
4590
|
taxRate: line.taxRate,
|
|
4585
4591
|
taxAmount: line.taxAmount,
|
|
4586
|
-
totalNetAmount:
|
|
4592
|
+
totalNetAmount: toNumericString(
|
|
4593
|
+
deriveLineNetFromGross(line.totalNetAmount, line.totalGrossAmount, line.taxRate)
|
|
4594
|
+
),
|
|
4587
4595
|
totalGrossAmount: line.totalGrossAmount,
|
|
4588
4596
|
configuration: line.configuration ? cloneJson(line.configuration) : null,
|
|
4589
4597
|
promotionCode: line.promotionCode ?? null,
|
|
@@ -6534,7 +6542,9 @@ const createInvoiceCommand = {
|
|
|
6534
6542
|
discountPercent: toNumericString(line.discountPercent ?? 0),
|
|
6535
6543
|
taxRate: toNumericString(line.taxRate ?? 0),
|
|
6536
6544
|
taxAmount: toNumericString(line.taxAmount ?? 0),
|
|
6537
|
-
totalNetAmount: toNumericString(
|
|
6545
|
+
totalNetAmount: toNumericString(
|
|
6546
|
+
deriveLineNetFromGross(line.totalNetAmount ?? 0, line.totalGrossAmount ?? 0, line.taxRate ?? 0)
|
|
6547
|
+
),
|
|
6538
6548
|
totalGrossAmount: toNumericString(line.totalGrossAmount ?? 0),
|
|
6539
6549
|
metadata: line.metadata ?? null
|
|
6540
6550
|
})
|
|
@@ -6865,7 +6875,9 @@ const deleteInvoiceCommand = {
|
|
|
6865
6875
|
discountPercent: line.discountPercent,
|
|
6866
6876
|
taxRate: line.taxRate,
|
|
6867
6877
|
taxAmount: line.taxAmount,
|
|
6868
|
-
totalNetAmount:
|
|
6878
|
+
totalNetAmount: toNumericString(
|
|
6879
|
+
deriveLineNetFromGross(line.totalNetAmount, line.totalGrossAmount, line.taxRate)
|
|
6880
|
+
),
|
|
6869
6881
|
totalGrossAmount: line.totalGrossAmount,
|
|
6870
6882
|
metadata: line.metadata
|
|
6871
6883
|
}));
|
|
@@ -6982,7 +6994,9 @@ const createCreditMemoCommand = {
|
|
|
6982
6994
|
unitPriceGross: toNumericString(line.unitPriceGross ?? 0),
|
|
6983
6995
|
taxRate: toNumericString(line.taxRate ?? 0),
|
|
6984
6996
|
taxAmount: toNumericString(line.taxAmount ?? 0),
|
|
6985
|
-
totalNetAmount: toNumericString(
|
|
6997
|
+
totalNetAmount: toNumericString(
|
|
6998
|
+
deriveLineNetFromGross(line.totalNetAmount ?? 0, line.totalGrossAmount ?? 0, line.taxRate ?? 0)
|
|
6999
|
+
),
|
|
6986
7000
|
totalGrossAmount: toNumericString(line.totalGrossAmount ?? 0),
|
|
6987
7001
|
metadata: line.metadata ?? null
|
|
6988
7002
|
})
|
|
@@ -7303,7 +7317,9 @@ const deleteCreditMemoCommand = {
|
|
|
7303
7317
|
unitPriceGross: line.unitPriceGross,
|
|
7304
7318
|
taxRate: line.taxRate,
|
|
7305
7319
|
taxAmount: line.taxAmount,
|
|
7306
|
-
totalNetAmount:
|
|
7320
|
+
totalNetAmount: toNumericString(
|
|
7321
|
+
deriveLineNetFromGross(line.totalNetAmount, line.totalGrossAmount, line.taxRate)
|
|
7322
|
+
),
|
|
7307
7323
|
totalGrossAmount: line.totalGrossAmount,
|
|
7308
7324
|
metadata: line.metadata
|
|
7309
7325
|
}));
|