@hed-hog/finance 0.0.300 → 0.0.301

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 (39) hide show
  1. package/dist/finance.contract-activated.subscriber.d.ts +24 -0
  2. package/dist/finance.contract-activated.subscriber.d.ts.map +1 -0
  3. package/dist/finance.contract-activated.subscriber.js +519 -0
  4. package/dist/finance.contract-activated.subscriber.js.map +1 -0
  5. package/dist/finance.contract-activated.subscriber.spec.d.ts +2 -0
  6. package/dist/finance.contract-activated.subscriber.spec.d.ts.map +1 -0
  7. package/dist/finance.contract-activated.subscriber.spec.js +302 -0
  8. package/dist/finance.contract-activated.subscriber.spec.js.map +1 -0
  9. package/dist/finance.module.d.ts.map +1 -1
  10. package/dist/finance.module.js +6 -1
  11. package/dist/finance.module.js.map +1 -1
  12. package/hedhog/frontend/app/_components/finance-layout.tsx.ejs +108 -0
  13. package/hedhog/frontend/app/accounts-payable/approvals/page.tsx.ejs +91 -106
  14. package/hedhog/frontend/app/accounts-payable/installments/page.tsx.ejs +1306 -1145
  15. package/hedhog/frontend/app/accounts-receivable/collections-default/page.tsx.ejs +288 -268
  16. package/hedhog/frontend/app/accounts-receivable/installments/page.tsx.ejs +491 -351
  17. package/hedhog/frontend/app/administration/audit-logs/page.tsx.ejs +157 -173
  18. package/hedhog/frontend/app/administration/categories/page.tsx.ejs +44 -62
  19. package/hedhog/frontend/app/administration/cost-centers/page.tsx.ejs +62 -80
  20. package/hedhog/frontend/app/administration/period-close/page.tsx.ejs +151 -170
  21. package/hedhog/frontend/app/cash-and-banks/bank-accounts/page.tsx.ejs +332 -286
  22. package/hedhog/frontend/app/cash-and-banks/bank-reconciliation/page.tsx.ejs +204 -226
  23. package/hedhog/frontend/app/cash-and-banks/statements/page.tsx.ejs +122 -140
  24. package/hedhog/frontend/app/cash-and-banks/transfers/page.tsx.ejs +32 -49
  25. package/hedhog/frontend/app/planning/cash-flow-forecast/page.tsx.ejs +84 -108
  26. package/hedhog/frontend/app/planning/receivables-calendar/page.tsx.ejs +53 -70
  27. package/hedhog/frontend/app/planning/scenarios/page.tsx.ejs +98 -95
  28. package/hedhog/frontend/app/reports/actual-vs-forecast/page.tsx.ejs +100 -125
  29. package/hedhog/frontend/app/reports/aging-default/page.tsx.ejs +77 -105
  30. package/hedhog/frontend/app/reports/cash-position/page.tsx.ejs +99 -134
  31. package/hedhog/frontend/app/reports/overview-results/page.tsx.ejs +147 -182
  32. package/hedhog/frontend/app/reports/top-customers/page.tsx.ejs +49 -61
  33. package/hedhog/frontend/app/reports/top-operational-expenses/page.tsx.ejs +49 -67
  34. package/hedhog/frontend/messages/en.json +176 -68
  35. package/hedhog/frontend/messages/pt.json +176 -68
  36. package/package.json +7 -6
  37. package/src/finance.contract-activated.subscriber.spec.ts +392 -0
  38. package/src/finance.contract-activated.subscriber.ts +780 -0
  39. package/src/finance.module.ts +6 -1
@@ -0,0 +1,302 @@
1
+ "use strict";
2
+ /// <reference types="jest" />
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const finance_contract_activated_subscriber_1 = require("./finance.contract-activated.subscriber");
5
+ describe('FinanceContractActivatedSubscriber', () => {
6
+ let integrationApi;
7
+ let financeService;
8
+ let prisma;
9
+ let subscriber;
10
+ beforeEach(() => {
11
+ integrationApi = {
12
+ subscribeMany: jest.fn(),
13
+ findLinksBySource: jest.fn(),
14
+ createLink: jest.fn().mockResolvedValue(undefined),
15
+ publishEvent: jest.fn().mockResolvedValue(undefined),
16
+ };
17
+ financeService = {
18
+ createAccountsReceivableTitle: jest.fn().mockResolvedValue({
19
+ id: '91',
20
+ parcelas: [
21
+ {
22
+ id: '501',
23
+ numero: 1,
24
+ vencimento: '2025-02-10T00:00:00.000Z',
25
+ valor: 1000,
26
+ },
27
+ {
28
+ id: '502',
29
+ numero: 2,
30
+ vencimento: '2025-03-10T00:00:00.000Z',
31
+ valor: 1000,
32
+ },
33
+ {
34
+ id: '503',
35
+ numero: 3,
36
+ vencimento: '2025-04-10T00:00:00.000Z',
37
+ valor: 1000,
38
+ },
39
+ ],
40
+ }),
41
+ createAccountsPayableTitle: jest.fn().mockResolvedValue({
42
+ id: '190',
43
+ parcelas: [
44
+ {
45
+ id: '801',
46
+ numero: 1,
47
+ vencimento: '2025-02-15T00:00:00.000Z',
48
+ valor: 450,
49
+ },
50
+ ],
51
+ }),
52
+ };
53
+ prisma = {
54
+ financial_title: {
55
+ findFirst: jest.fn().mockResolvedValue(null),
56
+ },
57
+ outbox_event: {
58
+ findMany: jest.fn().mockResolvedValue([]),
59
+ },
60
+ };
61
+ subscriber = new finance_contract_activated_subscriber_1.FinanceContractActivatedSubscriber(integrationApi, financeService, prisma);
62
+ });
63
+ afterEach(() => {
64
+ jest.clearAllMocks();
65
+ });
66
+ it('registers handlers for contract signing and activation', () => {
67
+ subscriber.onModuleInit();
68
+ const subscriptions = integrationApi.subscribeMany.mock.calls[0][0];
69
+ expect(subscriptions).toHaveLength(2);
70
+ expect(subscriptions.map((entry) => entry.eventName)).toEqual(expect.arrayContaining([
71
+ 'operations.contract.signed',
72
+ 'operations.contract.activated',
73
+ ]));
74
+ });
75
+ it('skips duplicate finance generation when a financial title link already exists', async () => {
76
+ subscriber.onModuleInit();
77
+ const subscriptions = integrationApi.subscribeMany.mock.calls[0][0];
78
+ const activated = subscriptions.find((entry) => entry.eventName === 'operations.contract.activated');
79
+ integrationApi.findLinksBySource.mockResolvedValue([
80
+ {
81
+ targetModule: 'finance',
82
+ targetEntityType: 'financial_title',
83
+ targetEntityId: '91',
84
+ },
85
+ ]);
86
+ await activated.handler({
87
+ eventName: 'operations.contract.activated',
88
+ sourceModule: 'operations',
89
+ aggregateType: 'contract',
90
+ aggregateId: '77',
91
+ payload: {
92
+ contractId: 77,
93
+ },
94
+ });
95
+ expect(financeService.createAccountsReceivableTitle).not.toHaveBeenCalled();
96
+ expect(financeService.createAccountsPayableTitle).not.toHaveBeenCalled();
97
+ expect(integrationApi.createLink).not.toHaveBeenCalled();
98
+ expect(integrationApi.publishEvent).not.toHaveBeenCalled();
99
+ });
100
+ it('recovers an existing title when the finance record already exists but the integration link is missing', async () => {
101
+ subscriber.onModuleInit();
102
+ const subscriptions = integrationApi.subscribeMany.mock.calls[0][0];
103
+ const activated = subscriptions.find((entry) => entry.eventName === 'operations.contract.activated');
104
+ integrationApi.findLinksBySource.mockResolvedValue([]);
105
+ prisma.financial_title.findFirst.mockResolvedValue({
106
+ id: 91,
107
+ financial_installment: [
108
+ {
109
+ id: 501,
110
+ installment_number: 1,
111
+ due_date: new Date('2025-02-10T00:00:00.000Z'),
112
+ amount_cents: 100000,
113
+ },
114
+ ],
115
+ });
116
+ await activated.handler({
117
+ eventName: 'operations.contract.activated',
118
+ sourceModule: 'operations',
119
+ aggregateType: 'contract',
120
+ aggregateId: '77',
121
+ payload: {
122
+ contractId: 77,
123
+ locale: 'en',
124
+ correlationId: 'contract:77',
125
+ activatedByUserId: 9,
126
+ contract: {
127
+ code: 'CTR-077',
128
+ name: 'Recovered Contract',
129
+ contractCategory: 'client',
130
+ contractType: 'service_agreement',
131
+ effectiveDate: '2025-02-01',
132
+ financialTerms: [
133
+ {
134
+ label: 'Recovered installment',
135
+ amount: 1000,
136
+ recurrence: 'one_time',
137
+ },
138
+ ],
139
+ },
140
+ receivable: {
141
+ personId: 5,
142
+ documentNumber: 'CTR-077',
143
+ description: 'Recovered Contract',
144
+ },
145
+ },
146
+ });
147
+ expect(financeService.createAccountsReceivableTitle).not.toHaveBeenCalled();
148
+ expect(integrationApi.createLink).toHaveBeenCalledWith(expect.objectContaining({
149
+ targetEntityType: 'financial_title',
150
+ targetEntityId: '91',
151
+ }));
152
+ });
153
+ it('creates receivable titles, installment links and a finance success event', async () => {
154
+ subscriber.onModuleInit();
155
+ const subscriptions = integrationApi.subscribeMany.mock.calls[0][0];
156
+ const signed = subscriptions.find((entry) => entry.eventName === 'operations.contract.signed');
157
+ integrationApi.findLinksBySource.mockResolvedValue([]);
158
+ await signed.handler({
159
+ eventName: 'operations.contract.signed',
160
+ sourceModule: 'operations',
161
+ aggregateType: 'contract',
162
+ aggregateId: '77',
163
+ payload: {
164
+ contractId: 77,
165
+ proposalId: 12,
166
+ locale: 'en',
167
+ correlationId: 'contract:77',
168
+ signedByUserId: 9,
169
+ contract: {
170
+ code: 'CTR-077',
171
+ name: 'Support Contract',
172
+ contractCategory: 'client',
173
+ contractType: 'service_agreement',
174
+ startDate: '2025-02-01',
175
+ endDate: '2025-04-30',
176
+ signedAt: '2025-02-01',
177
+ effectiveDate: '2025-02-01',
178
+ financialTerms: [
179
+ {
180
+ label: 'Monthly retainer',
181
+ amount: 1000,
182
+ recurrence: 'monthly',
183
+ dueDay: 10,
184
+ },
185
+ ],
186
+ },
187
+ receivable: {
188
+ personId: 5,
189
+ documentNumber: 'CTR-077',
190
+ description: 'Support Contract',
191
+ },
192
+ },
193
+ });
194
+ expect(financeService.createAccountsReceivableTitle).toHaveBeenCalledWith(expect.objectContaining({
195
+ person_id: 5,
196
+ document_number: 'CTR-077',
197
+ total_amount: 3000,
198
+ installments: [
199
+ expect.objectContaining({
200
+ installment_number: 1,
201
+ due_date: '2025-02-10',
202
+ amount: 1000,
203
+ }),
204
+ expect.objectContaining({
205
+ installment_number: 2,
206
+ due_date: '2025-03-10',
207
+ amount: 1000,
208
+ }),
209
+ expect.objectContaining({
210
+ installment_number: 3,
211
+ due_date: '2025-04-10',
212
+ amount: 1000,
213
+ }),
214
+ ],
215
+ }), 'en', 9);
216
+ expect(financeService.createAccountsPayableTitle).not.toHaveBeenCalled();
217
+ expect(integrationApi.createLink).toHaveBeenCalledTimes(4);
218
+ expect(integrationApi.createLink).toHaveBeenNthCalledWith(1, expect.objectContaining({
219
+ sourceModule: 'operations',
220
+ sourceEntityType: 'contract',
221
+ sourceEntityId: '77',
222
+ targetModule: 'finance',
223
+ targetEntityType: 'financial_title',
224
+ targetEntityId: '91',
225
+ metadata: expect.objectContaining({
226
+ eventName: 'operations.contract.signed',
227
+ titleType: 'receivable',
228
+ source_module: 'operations',
229
+ source_entity: 'contract',
230
+ source_id: '77',
231
+ installmentCount: 3,
232
+ }),
233
+ }));
234
+ expect(integrationApi.createLink).toHaveBeenNthCalledWith(2, expect.objectContaining({
235
+ targetEntityType: 'financial_installment',
236
+ targetEntityId: '501',
237
+ }));
238
+ expect(integrationApi.createLink).toHaveBeenNthCalledWith(3, expect.objectContaining({
239
+ targetEntityType: 'financial_installment',
240
+ targetEntityId: '502',
241
+ }));
242
+ expect(integrationApi.createLink).toHaveBeenNthCalledWith(4, expect.objectContaining({
243
+ targetEntityType: 'financial_installment',
244
+ targetEntityId: '503',
245
+ }));
246
+ expect(integrationApi.publishEvent).toHaveBeenCalledWith(expect.objectContaining({
247
+ eventName: 'finance.receivable.created_from_contract',
248
+ sourceModule: 'finance',
249
+ aggregateType: 'financial_title',
250
+ aggregateId: '91',
251
+ payload: expect.objectContaining({
252
+ proposalId: 12,
253
+ source_module: 'operations',
254
+ source_entity: 'contract',
255
+ source_id: '77',
256
+ triggerEvent: 'operations.contract.signed',
257
+ financialTitle: expect.objectContaining({
258
+ id: '91',
259
+ titleType: 'receivable',
260
+ installmentCount: 3,
261
+ }),
262
+ }),
263
+ }));
264
+ });
265
+ it('routes supplier contracts to accounts payable', async () => {
266
+ subscriber.onModuleInit();
267
+ const subscriptions = integrationApi.subscribeMany.mock.calls[0][0];
268
+ const activated = subscriptions.find((entry) => entry.eventName === 'operations.contract.activated');
269
+ integrationApi.findLinksBySource.mockResolvedValue([]);
270
+ await activated.handler({
271
+ eventName: 'operations.contract.activated',
272
+ sourceModule: 'operations',
273
+ aggregateType: 'contract',
274
+ aggregateId: '88',
275
+ payload: {
276
+ contractId: 88,
277
+ locale: 'en',
278
+ activatedByUserId: 11,
279
+ contract: {
280
+ code: 'CTR-088',
281
+ contractCategory: 'supplier',
282
+ contractType: 'service_agreement',
283
+ effectiveDate: '2025-02-15',
284
+ },
285
+ receivable: {
286
+ personId: 14,
287
+ totalAmount: 450,
288
+ documentNumber: 'CTR-088',
289
+ description: 'Supplier onboarding',
290
+ },
291
+ },
292
+ });
293
+ expect(financeService.createAccountsPayableTitle).toHaveBeenCalledWith(expect.objectContaining({
294
+ person_id: 14,
295
+ total_amount: 450,
296
+ }), 'en', 11);
297
+ expect(integrationApi.publishEvent).toHaveBeenCalledWith(expect.objectContaining({
298
+ eventName: 'finance.payable.created_from_contract',
299
+ }));
300
+ });
301
+ });
302
+ //# sourceMappingURL=finance.contract-activated.subscriber.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"finance.contract-activated.subscriber.spec.js","sourceRoot":"","sources":["../src/finance.contract-activated.subscriber.spec.ts"],"names":[],"mappings":";AAAA,8BAA8B;;AAE9B,mGAA6F;AAE7F,QAAQ,CAAC,oCAAoC,EAAE,GAAG,EAAE;IAClD,IAAI,cAKH,CAAC;IACF,IAAI,cAGH,CAAC;IACF,IAAI,MAOH,CAAC;IACF,IAAI,UAA8C,CAAC;IAEnD,UAAU,CAAC,GAAG,EAAE;QACd,cAAc,GAAG;YACf,aAAa,EAAE,IAAI,CAAC,EAAE,EAAE;YACxB,iBAAiB,EAAE,IAAI,CAAC,EAAE,EAAE;YAC5B,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,SAAS,CAAC;YAClD,YAAY,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,SAAS,CAAC;SACrD,CAAC;QAEF,cAAc,GAAG;YACf,6BAA6B,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC;gBACzD,EAAE,EAAE,IAAI;gBACR,QAAQ,EAAE;oBACR;wBACE,EAAE,EAAE,KAAK;wBACT,MAAM,EAAE,CAAC;wBACT,UAAU,EAAE,0BAA0B;wBACtC,KAAK,EAAE,IAAI;qBACZ;oBACD;wBACE,EAAE,EAAE,KAAK;wBACT,MAAM,EAAE,CAAC;wBACT,UAAU,EAAE,0BAA0B;wBACtC,KAAK,EAAE,IAAI;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AC,CACH,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"finance.module.d.ts","sourceRoot":"","sources":["../src/finance.module.ts"],"names":[],"mappings":"AAoBA,qBA0Ba,aAAa;CAAG"}
1
+ {"version":3,"file":"finance.module.d.ts","sourceRoot":"","sources":["../src/finance.module.ts"],"names":[],"mappings":"AAqBA,qBA8Ba,aAAa;CAAG"}
@@ -24,6 +24,7 @@ const finance_period_close_controller_1 = require("./finance-period-close.contro
24
24
  const finance_reports_controller_1 = require("./finance-reports.controller");
25
25
  const finance_statements_controller_1 = require("./finance-statements.controller");
26
26
  const finance_transfers_controller_1 = require("./finance-transfers.controller");
27
+ const finance_contract_activated_subscriber_1 = require("./finance.contract-activated.subscriber");
27
28
  const finance_integration_example_subscriber_1 = require("./finance.integration-example.subscriber");
28
29
  const finance_service_1 = require("./finance.service");
29
30
  let FinanceModule = class FinanceModule {
@@ -53,7 +54,11 @@ exports.FinanceModule = FinanceModule = __decorate([
53
54
  finance_statements_controller_1.FinanceStatementsController,
54
55
  finance_transfers_controller_1.FinanceTransfersController,
55
56
  ],
56
- providers: [finance_service_1.FinanceService, finance_integration_example_subscriber_1.FinanceIntegrationExampleSubscriber],
57
+ providers: [
58
+ finance_service_1.FinanceService,
59
+ finance_integration_example_subscriber_1.FinanceIntegrationExampleSubscriber,
60
+ finance_contract_activated_subscriber_1.FinanceContractActivatedSubscriber,
61
+ ],
57
62
  exports: [finance_service_1.FinanceService],
58
63
  })
59
64
  ], FinanceModule);
@@ -1 +1 @@
1
- {"version":3,"file":"finance.module.js","sourceRoot":"","sources":["../src/finance.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,oDAAmD;AACnD,4DAA2D;AAC3D,oDAAmD;AACnD,wCAAwE;AACxE,2CAAoD;AACpD,2CAA8C;AAC9C,mFAA6E;AAC7E,yFAAmF;AACnF,mFAA8E;AAC9E,qFAAgF;AAChF,uFAAiF;AACjF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ACxE,mFAA8E;AAC9E,iFAA4E;AAC5E,mGAA6F;AAC7F,qGAA+F;AAC/F,uDAAmD;AAgC5C,IAAM,aAAa,GAAnB,MAAM,aAAa;CAAG,CAAA;AAAhB,sCAAa;wBAAb,aAAa;IA9BzB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,qBAAY,CAAC,OAAO,EAAE;YACtB,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,iCAAgB,CAAC;YAClC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,yBAAY,CAAC;YAC9B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,yBAAY,CAAC;YAC9B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,eAAQ,CAAC;YAC1B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,iBAAU,CAAC;YAC5B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,wBAAiB,CAAC;SACpC;QACD,WAAW,EAAE;YACX,0DAA0B;YAC1B,+CAAqB;YACrB,+DAA6B;YAC7B,qDAAwB;YACxB,gEAA6B;YAC7B,2DAA2B;YAC3B,6DAA4B;YAC5B,8DAA4B;YAC5B,8DAA4B;YAC5B,2DAA2B;YAC3B,yDAA0B;SAC3B;QACD,SAAS,EAAE;YACT,gCAAc;YACd,4EAAmC;YACnC,0EAAkC;SACnC;QACD,OAAO,EAAE,CAAC,gCAAc,CAAC;KAC1B,CAAC;GACW,aAAa,CAAG"}
@@ -0,0 +1,108 @@
1
+ 'use client';
2
+
3
+ import {
4
+ Card,
5
+ CardContent,
6
+ CardDescription,
7
+ CardHeader,
8
+ CardTitle,
9
+ } from '@/components/ui/card';
10
+ import { cn } from '@/lib/utils';
11
+ import type { ReactNode } from 'react';
12
+
13
+ type FinancePageSectionProps = {
14
+ title?: ReactNode;
15
+ description?: ReactNode;
16
+ actions?: ReactNode;
17
+ children: ReactNode;
18
+ className?: string;
19
+ contentClassName?: string;
20
+ };
21
+
22
+ export function FinancePageSection({
23
+ title,
24
+ description,
25
+ actions,
26
+ children,
27
+ className,
28
+ contentClassName,
29
+ }: FinancePageSectionProps) {
30
+ const hasHeader = title || description || actions;
31
+
32
+ return (
33
+ <Card
34
+ className={cn(
35
+ 'overflow-hidden border-border/60 py-0 shadow-sm',
36
+ className
37
+ )}
38
+ >
39
+ {hasHeader ? (
40
+ <CardHeader className="flex flex-col gap-3 border-b border-border/50 px-5 py-4 sm:flex-row sm:items-start sm:justify-between">
41
+ <div className="space-y-1">
42
+ {title ? (
43
+ <CardTitle className="text-base">{title}</CardTitle>
44
+ ) : null}
45
+ {description ? (
46
+ <CardDescription>{description}</CardDescription>
47
+ ) : null}
48
+ </div>
49
+ {actions ? <div className="shrink-0">{actions}</div> : null}
50
+ </CardHeader>
51
+ ) : null}
52
+ <CardContent className={cn('p-0', contentClassName)}>
53
+ {children}
54
+ </CardContent>
55
+ </Card>
56
+ );
57
+ }
58
+
59
+ type FinanceSheetBodyProps = {
60
+ children: ReactNode;
61
+ className?: string;
62
+ };
63
+
64
+ export function FinanceSheetBody({
65
+ children,
66
+ className,
67
+ }: FinanceSheetBodyProps) {
68
+ return (
69
+ <div
70
+ className={cn(
71
+ 'flex-1 space-y-5 overflow-y-auto px-4 py-4 sm:px-6 sm:py-5',
72
+ className
73
+ )}
74
+ >
75
+ {children}
76
+ </div>
77
+ );
78
+ }
79
+
80
+ type FinanceSheetSectionProps = {
81
+ title: ReactNode;
82
+ description?: ReactNode;
83
+ children: ReactNode;
84
+ className?: string;
85
+ contentClassName?: string;
86
+ };
87
+
88
+ export function FinanceSheetSection({
89
+ title,
90
+ description,
91
+ children,
92
+ className,
93
+ contentClassName,
94
+ }: FinanceSheetSectionProps) {
95
+ return (
96
+ <section className={cn('', className)}>
97
+ <div className="mb-4 space-y-1">
98
+ <h3 className="text-sm font-semibold text-foreground">{title}</h3>
99
+ {description ? (
100
+ <p className="text-sm leading-relaxed text-muted-foreground">
101
+ {description}
102
+ </p>
103
+ ) : null}
104
+ </div>
105
+ <div className={cn('space-y-4', contentClassName)}>{children}</div>
106
+ </section>
107
+ );
108
+ }