@open-mercato/core 0.7.1-develop.7113.1.9d83dca10c → 0.7.1-develop.7121.1.734c263bda

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.
Files changed (95) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/dist/helpers/integration/crmFixtures.js.map +1 -1
  3. package/dist/modules/communication_channels/api/post/channels/[id]/test-send/route.js +9 -2
  4. package/dist/modules/communication_channels/api/post/channels/[id]/test-send/route.js.map +2 -2
  5. package/dist/modules/communication_channels/lib/outbound-recipient.js +5 -1
  6. package/dist/modules/communication_channels/lib/outbound-recipient.js.map +2 -2
  7. package/dist/modules/communication_channels/lib/test-seed.js +5 -0
  8. package/dist/modules/communication_channels/lib/test-seed.js.map +2 -2
  9. package/dist/modules/customers/backend/customers/deals/[id]/hooks/useDealClosure.js +1 -1
  10. package/dist/modules/customers/backend/customers/deals/[id]/hooks/useDealClosure.js.map +1 -1
  11. package/dist/modules/customers/backend/customers/deals/page.js +4 -3
  12. package/dist/modules/customers/backend/customers/deals/page.js.map +2 -2
  13. package/dist/modules/customers/backend/customers/deals/pipeline/components/QuickDealDialog.js +2 -2
  14. package/dist/modules/customers/backend/customers/deals/pipeline/components/QuickDealDialog.js.map +2 -2
  15. package/dist/modules/customers/backend/customers/deals/pipeline/components/StatusFilterPopover.js +1 -1
  16. package/dist/modules/customers/backend/customers/deals/pipeline/components/StatusFilterPopover.js.map +1 -1
  17. package/dist/modules/customers/backend/customers/deals/pipeline/page.js +1 -1
  18. package/dist/modules/customers/backend/customers/deals/pipeline/page.js.map +2 -2
  19. package/dist/modules/customers/cli.js +5 -5
  20. package/dist/modules/customers/cli.js.map +2 -2
  21. package/dist/modules/customers/commands/deals.js.map +2 -2
  22. package/dist/modules/customers/components/detail/pipelineStageUtils.js +1 -0
  23. package/dist/modules/customers/components/detail/pipelineStageUtils.js.map +2 -2
  24. package/dist/modules/customers/components/linking/adapters/dealAdapter.js +2 -2
  25. package/dist/modules/customers/components/linking/adapters/dealAdapter.js.map +2 -2
  26. package/dist/modules/customers/lib/closureStage.js.map +2 -2
  27. package/dist/modules/customers/lib/dealStatus.js +6 -4
  28. package/dist/modules/customers/lib/dealStatus.js.map +2 -2
  29. package/dist/modules/customers/lib/dealsSummaryQueries.js +3 -3
  30. package/dist/modules/customers/lib/dealsSummaryQueries.js.map +1 -1
  31. package/dist/modules/customers/migrations/Migration20260824180000_deal_status_lost.js +30 -0
  32. package/dist/modules/customers/migrations/Migration20260824180000_deal_status_lost.js.map +7 -0
  33. package/dist/modules/dashboards/widgets/dashboard/pipeline-summary/config.js.map +1 -1
  34. package/dist/modules/eudr/notifications.js +5 -0
  35. package/dist/modules/eudr/notifications.js.map +2 -2
  36. package/dist/modules/query_index/lib/search-tokens.js +59 -28
  37. package/dist/modules/query_index/lib/search-tokens.js.map +2 -2
  38. package/dist/modules/sales/commands/documents.js +146 -99
  39. package/dist/modules/sales/commands/documents.js.map +2 -2
  40. package/dist/modules/sales/commands/returns.js +1 -30
  41. package/dist/modules/sales/commands/returns.js.map +2 -2
  42. package/dist/modules/sales/commands/shared.js +1 -4
  43. package/dist/modules/sales/commands/shared.js.map +2 -2
  44. package/dist/modules/sales/components/documents/SalesOrderDraftLines.js +2 -1
  45. package/dist/modules/sales/components/documents/SalesOrderDraftLines.js.map +2 -2
  46. package/dist/modules/sales/data/validators.js +3 -0
  47. package/dist/modules/sales/data/validators.js.map +2 -2
  48. package/dist/modules/sales/lib/calculations.js +14 -2
  49. package/dist/modules/sales/lib/calculations.js.map +2 -2
  50. package/dist/modules/sales/lib/json.js +8 -0
  51. package/dist/modules/sales/lib/json.js.map +7 -0
  52. package/dist/modules/sales/lib/lineSnapshots.js +66 -0
  53. package/dist/modules/sales/lib/lineSnapshots.js.map +7 -0
  54. package/dist/modules/warranty_claims/notifications.js +5 -0
  55. package/dist/modules/warranty_claims/notifications.js.map +2 -2
  56. package/dist/modules/wms/notifications.js +2 -0
  57. package/dist/modules/wms/notifications.js.map +2 -2
  58. package/package.json +7 -7
  59. package/src/helpers/integration/crmFixtures.ts +1 -1
  60. package/src/modules/communication_channels/api/post/channels/[id]/test-send/route.ts +21 -9
  61. package/src/modules/communication_channels/lib/adapter.ts +11 -0
  62. package/src/modules/communication_channels/lib/outbound-recipient.ts +14 -1
  63. package/src/modules/communication_channels/lib/test-seed.ts +19 -0
  64. package/src/modules/customers/backend/customers/deals/[id]/hooks/useDealClosure.ts +1 -1
  65. package/src/modules/customers/backend/customers/deals/page.tsx +4 -3
  66. package/src/modules/customers/backend/customers/deals/pipeline/components/QuickDealDialog.tsx +5 -5
  67. package/src/modules/customers/backend/customers/deals/pipeline/components/StatusFilterPopover.tsx +3 -3
  68. package/src/modules/customers/backend/customers/deals/pipeline/page.tsx +2 -2
  69. package/src/modules/customers/cli.ts +5 -5
  70. package/src/modules/customers/commands/deals.ts +4 -3
  71. package/src/modules/customers/components/detail/pipelineStageUtils.ts +1 -0
  72. package/src/modules/customers/components/linking/adapters/dealAdapter.tsx +2 -2
  73. package/src/modules/customers/i18n/de.json +1 -1
  74. package/src/modules/customers/i18n/en.json +1 -1
  75. package/src/modules/customers/i18n/es.json +1 -1
  76. package/src/modules/customers/i18n/ko.json +1 -1
  77. package/src/modules/customers/i18n/pl.json +1 -1
  78. package/src/modules/customers/lib/closureStage.ts +2 -1
  79. package/src/modules/customers/lib/dealStatus.ts +23 -12
  80. package/src/modules/customers/lib/dealsSummaryQueries.ts +3 -3
  81. package/src/modules/customers/migrations/Migration20260824180000_deal_status_lost.ts +55 -0
  82. package/src/modules/dashboards/widgets/dashboard/pipeline-summary/config.ts +1 -1
  83. package/src/modules/eudr/notifications.ts +5 -0
  84. package/src/modules/query_index/lib/search-tokens.ts +100 -43
  85. package/src/modules/sales/commands/documents.ts +185 -105
  86. package/src/modules/sales/commands/returns.ts +1 -31
  87. package/src/modules/sales/commands/shared.ts +1 -4
  88. package/src/modules/sales/components/documents/SalesOrderDraftLines.tsx +12 -1
  89. package/src/modules/sales/data/validators.ts +3 -0
  90. package/src/modules/sales/lib/calculations.ts +33 -7
  91. package/src/modules/sales/lib/json.ts +4 -0
  92. package/src/modules/sales/lib/lineSnapshots.ts +98 -0
  93. package/src/modules/sales/lib/types.ts +20 -0
  94. package/src/modules/warranty_claims/notifications.ts +5 -0
  95. package/src/modules/wms/notifications.ts +2 -0
@@ -32,6 +32,13 @@ export type SalesLineUomSnapshot = {
32
32
  }
33
33
  }
34
34
 
35
+ /**
36
+ * How a caller-supplied `discountAmount` should be read: as a rate per unit, or
37
+ * as the total for the whole line. Persisted rows always hold a line total —
38
+ * see `discountAmountFromStoredRow`, which is a separate signal on purpose.
39
+ */
40
+ export type SalesLineDiscountBasis = 'unit' | 'line'
41
+
35
42
  export type SalesLineSnapshot = {
36
43
  id?: string
37
44
  lineNumber?: number
@@ -50,6 +57,19 @@ export type SalesLineSnapshot = {
50
57
  unitPriceNet?: number | null
51
58
  unitPriceGross?: number | null
52
59
  discountAmount?: number | null
60
+ /**
61
+ * Caller-supplied ONLY. How to interpret a supplied `discountAmount`.
62
+ * Omitted means 'unit', which is the meaning the API has always documented.
63
+ * Entity-to-snapshot mappers MUST NOT set this: a populated value is what
64
+ * makes this a reliable *caller* signal.
65
+ */
66
+ discountAmountBasis?: SalesLineDiscountBasis | null
67
+ /**
68
+ * Set by entity-to-snapshot mappers ONLY. Marks `discountAmount` as
69
+ * reconstructed from a persisted row, so it is a line total and is NOT a
70
+ * caller assertion. Never persisted; never accepted from a request.
71
+ */
72
+ discountAmountFromStoredRow?: boolean
53
73
  discountPercent?: number | null
54
74
  taxRate?: number | null
55
75
  taxAmount?: number | null
@@ -4,6 +4,7 @@ export const notificationTypes: NotificationTypeDefinition[] = [
4
4
  {
5
5
  type: 'warranty_claims.claim.submitted',
6
6
  module: 'warranty_claims',
7
+ channels: ['in_app', 'email'],
7
8
  titleKey: 'warranty_claims.notifications.submitted.title',
8
9
  bodyKey: 'warranty_claims.notifications.submitted.body',
9
10
  icon: 'clipboard-check',
@@ -23,6 +24,7 @@ export const notificationTypes: NotificationTypeDefinition[] = [
23
24
  {
24
25
  type: 'warranty_claims.claim.assigned',
25
26
  module: 'warranty_claims',
27
+ channels: ['in_app', 'email'],
26
28
  titleKey: 'warranty_claims.notifications.assigned.title',
27
29
  bodyKey: 'warranty_claims.notifications.assigned.body',
28
30
  icon: 'user-check',
@@ -42,6 +44,7 @@ export const notificationTypes: NotificationTypeDefinition[] = [
42
44
  {
43
45
  type: 'warranty_claims.claim.status_changed',
44
46
  module: 'warranty_claims',
47
+ channels: ['in_app', 'email'],
45
48
  titleKey: 'warranty_claims.notifications.statusChanged.title',
46
49
  bodyKey: 'warranty_claims.notifications.statusChanged.body',
47
50
  icon: 'refresh-cw',
@@ -61,6 +64,7 @@ export const notificationTypes: NotificationTypeDefinition[] = [
61
64
  {
62
65
  type: 'warranty_claims.claim.escalated',
63
66
  module: 'warranty_claims',
67
+ channels: ['in_app', 'email'],
64
68
  titleKey: 'warranty_claims.notifications.escalated.title',
65
69
  bodyKey: 'warranty_claims.notifications.escalated.body',
66
70
  icon: 'alarm-clock',
@@ -80,6 +84,7 @@ export const notificationTypes: NotificationTypeDefinition[] = [
80
84
  {
81
85
  type: 'warranty_claims.claim.customer_replied',
82
86
  module: 'warranty_claims',
87
+ channels: ['in_app', 'email'],
83
88
  titleKey: 'warranty_claims.notifications.customerReplied.title',
84
89
  bodyKey: 'warranty_claims.notifications.customerReplied.body',
85
90
  icon: 'message-square-reply',
@@ -4,6 +4,7 @@ export const notificationTypes: NotificationTypeDefinition[] = [
4
4
  {
5
5
  type: 'wms.inventory.low_stock',
6
6
  module: 'wms',
7
+ channels: ['in_app', 'email'],
7
8
  titleKey: 'wms.notifications.lowStock.title',
8
9
  bodyKey: 'wms.notifications.lowStock.body',
9
10
  icon: 'alert-triangle',
@@ -23,6 +24,7 @@ export const notificationTypes: NotificationTypeDefinition[] = [
23
24
  {
24
25
  type: 'wms.inventory.reservation_shortfall',
25
26
  module: 'wms',
27
+ channels: ['in_app', 'email'],
26
28
  titleKey: 'wms.notifications.reservationShortfall.title',
27
29
  bodyKey: 'wms.notifications.reservationShortfall.body',
28
30
  icon: 'alert-triangle',