@booki-aui/react 0.0.0-stage → 0.2.0
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/CHANGELOG.md +122 -0
- package/LICENSE +21 -0
- package/README.md +16 -2
- package/dist/access.d.ts +43 -0
- package/dist/access.js +15 -0
- package/dist/access.js.map +1 -0
- package/dist/account-picker.d.ts +40 -0
- package/dist/account-picker.js +25 -0
- package/dist/account-picker.js.map +1 -0
- package/dist/accounting-period-select.d.ts +34 -0
- package/dist/accounting-period-select.js +23 -0
- package/dist/accounting-period-select.js.map +1 -0
- package/dist/activity-timeline.d.ts +37 -0
- package/dist/activity-timeline.js +19 -0
- package/dist/activity-timeline.js.map +1 -0
- package/dist/aged-balances.d.ts +62 -0
- package/dist/aged-balances.js +31 -0
- package/dist/aged-balances.js.map +1 -0
- package/dist/agent-cursor.d.ts +34 -0
- package/dist/agent-cursor.js +14 -0
- package/dist/agent-cursor.js.map +1 -0
- package/dist/agent-presence.d.ts +110 -0
- package/dist/agent-presence.js +15 -0
- package/dist/agent-presence.js.map +1 -0
- package/dist/aging-chart.d.ts +41 -0
- package/dist/aging-chart.js +19 -0
- package/dist/aging-chart.js.map +1 -0
- package/dist/amount-field.d.ts +46 -0
- package/dist/amount-field.js +19 -0
- package/dist/amount-field.js.map +1 -0
- package/dist/amount-input.d.ts +18 -0
- package/dist/amount-input.js +12 -0
- package/dist/amount-input.js.map +1 -0
- package/dist/approval-chain.d.ts +36 -0
- package/dist/approval-chain.js +22 -0
- package/dist/approval-chain.js.map +1 -0
- package/dist/approval-gate.d.ts +19 -0
- package/dist/approval-gate.js +10 -0
- package/dist/approval-gate.js.map +1 -0
- package/dist/attestation-status.d.ts +31 -0
- package/dist/attestation-status.js +22 -0
- package/dist/attestation-status.js.map +1 -0
- package/dist/audit-findings.d.ts +40 -0
- package/dist/audit-findings.js +28 -0
- package/dist/audit-findings.js.map +1 -0
- package/dist/audit-trail.d.ts +22 -0
- package/dist/audit-trail.js +10 -0
- package/dist/audit-trail.js.map +1 -0
- package/dist/audit-workpaper.d.ts +56 -0
- package/dist/audit-workpaper.js +35 -0
- package/dist/audit-workpaper.js.map +1 -0
- package/dist/bank-account-input.d.ts +36 -0
- package/dist/bank-account-input.js +22 -0
- package/dist/bank-account-input.js.map +1 -0
- package/dist/bank-reconciliation.d.ts +38 -0
- package/dist/bank-reconciliation.js +20 -0
- package/dist/bank-reconciliation.js.map +1 -0
- package/dist/bar-chart.d.ts +38 -0
- package/dist/bar-chart.js +19 -0
- package/dist/bar-chart.js.map +1 -0
- package/dist/booki-agent.d.ts +153 -0
- package/dist/booki-agent.js +27 -0
- package/dist/booki-agent.js.map +1 -0
- package/dist/cashflow-waterfall.d.ts +36 -0
- package/dist/cashflow-waterfall.js +17 -0
- package/dist/cashflow-waterfall.js.map +1 -0
- package/dist/change-details-CWpEgc80.d.ts +14 -0
- package/dist/chunk-2HM7YSBC.js +92 -0
- package/dist/chunk-2HM7YSBC.js.map +1 -0
- package/dist/chunk-35QKOOAI.js +27 -0
- package/dist/chunk-35QKOOAI.js.map +1 -0
- package/dist/chunk-37GDU76M.js +86 -0
- package/dist/chunk-37GDU76M.js.map +1 -0
- package/dist/chunk-4EVVT6ME.js +136 -0
- package/dist/chunk-4EVVT6ME.js.map +1 -0
- package/dist/chunk-4GQUOBOG.js +132 -0
- package/dist/chunk-4GQUOBOG.js.map +1 -0
- package/dist/chunk-4KWEZTO5.js +86 -0
- package/dist/chunk-4KWEZTO5.js.map +1 -0
- package/dist/chunk-4WC76FUE.js +242 -0
- package/dist/chunk-4WC76FUE.js.map +1 -0
- package/dist/chunk-62G3T2AA.js +230 -0
- package/dist/chunk-62G3T2AA.js.map +1 -0
- package/dist/chunk-663UXACN.js +334 -0
- package/dist/chunk-663UXACN.js.map +1 -0
- package/dist/chunk-6CVPNV7N.js +106 -0
- package/dist/chunk-6CVPNV7N.js.map +1 -0
- package/dist/chunk-6HWFMC7V.js +140 -0
- package/dist/chunk-6HWFMC7V.js.map +1 -0
- package/dist/chunk-7MYFKLPB.js +301 -0
- package/dist/chunk-7MYFKLPB.js.map +1 -0
- package/dist/chunk-7YTOVA5F.js +312 -0
- package/dist/chunk-7YTOVA5F.js.map +1 -0
- package/dist/chunk-AIGQPM4Y.js +311 -0
- package/dist/chunk-AIGQPM4Y.js.map +1 -0
- package/dist/chunk-AKC6N4QO.js +414 -0
- package/dist/chunk-AKC6N4QO.js.map +1 -0
- package/dist/chunk-BZIOOU4I.js +421 -0
- package/dist/chunk-BZIOOU4I.js.map +1 -0
- package/dist/chunk-CDTDN4LY.js +212 -0
- package/dist/chunk-CDTDN4LY.js.map +1 -0
- package/dist/chunk-EDWQSKY7.js +161 -0
- package/dist/chunk-EDWQSKY7.js.map +1 -0
- package/dist/chunk-EKIWL37F.js +488 -0
- package/dist/chunk-EKIWL37F.js.map +1 -0
- package/dist/chunk-F3C77WLR.js +116 -0
- package/dist/chunk-F3C77WLR.js.map +1 -0
- package/dist/chunk-FBV7BFEQ.js +84 -0
- package/dist/chunk-FBV7BFEQ.js.map +1 -0
- package/dist/chunk-GVP2N3K6.js +89 -0
- package/dist/chunk-GVP2N3K6.js.map +1 -0
- package/dist/chunk-HKYEHBQT.js +19 -0
- package/dist/chunk-HKYEHBQT.js.map +1 -0
- package/dist/chunk-HQYIFZZT.js +169 -0
- package/dist/chunk-HQYIFZZT.js.map +1 -0
- package/dist/chunk-HT6HGOLM.js +151 -0
- package/dist/chunk-HT6HGOLM.js.map +1 -0
- package/dist/chunk-ISPUO3AQ.js +244 -0
- package/dist/chunk-ISPUO3AQ.js.map +1 -0
- package/dist/chunk-JPUVGWLO.js +207 -0
- package/dist/chunk-JPUVGWLO.js.map +1 -0
- package/dist/chunk-JWFGUI7A.js +73 -0
- package/dist/chunk-JWFGUI7A.js.map +1 -0
- package/dist/chunk-K72VT6RJ.js +57 -0
- package/dist/chunk-K72VT6RJ.js.map +1 -0
- package/dist/chunk-KLDUGI7L.js +150 -0
- package/dist/chunk-KLDUGI7L.js.map +1 -0
- package/dist/chunk-M2WLQIFE.js +40 -0
- package/dist/chunk-M2WLQIFE.js.map +1 -0
- package/dist/chunk-M3MCIKF2.js +143 -0
- package/dist/chunk-M3MCIKF2.js.map +1 -0
- package/dist/chunk-MBLQSZHE.js +77 -0
- package/dist/chunk-MBLQSZHE.js.map +1 -0
- package/dist/chunk-N7GIVDUU.js +191 -0
- package/dist/chunk-N7GIVDUU.js.map +1 -0
- package/dist/chunk-NMHTPP6I.js +62 -0
- package/dist/chunk-NMHTPP6I.js.map +1 -0
- package/dist/chunk-NNP6GNEW.js +65 -0
- package/dist/chunk-NNP6GNEW.js.map +1 -0
- package/dist/chunk-OTD7VUEC.js +35 -0
- package/dist/chunk-OTD7VUEC.js.map +1 -0
- package/dist/chunk-OXHKA3UZ.js +30 -0
- package/dist/chunk-OXHKA3UZ.js.map +1 -0
- package/dist/chunk-OYERLEER.js +21 -0
- package/dist/chunk-OYERLEER.js.map +1 -0
- package/dist/chunk-PFY3VJ2T.js +231 -0
- package/dist/chunk-PFY3VJ2T.js.map +1 -0
- package/dist/chunk-PUMSFFEU.js +228 -0
- package/dist/chunk-PUMSFFEU.js.map +1 -0
- package/dist/chunk-QE7KUQOI.js +84 -0
- package/dist/chunk-QE7KUQOI.js.map +1 -0
- package/dist/chunk-QGT7VI6I.js +35 -0
- package/dist/chunk-QGT7VI6I.js.map +1 -0
- package/dist/chunk-QGYS5HS3.js +214 -0
- package/dist/chunk-QGYS5HS3.js.map +1 -0
- package/dist/chunk-QPSBRSBH.js +167 -0
- package/dist/chunk-QPSBRSBH.js.map +1 -0
- package/dist/chunk-ROXGVKR2.js +59 -0
- package/dist/chunk-ROXGVKR2.js.map +1 -0
- package/dist/chunk-RPONJDFZ.js +310 -0
- package/dist/chunk-RPONJDFZ.js.map +1 -0
- package/dist/chunk-RTCKV4H2.js +65 -0
- package/dist/chunk-RTCKV4H2.js.map +1 -0
- package/dist/chunk-SHZFZRHV.js +259 -0
- package/dist/chunk-SHZFZRHV.js.map +1 -0
- package/dist/chunk-SOXPKIQK.js +91 -0
- package/dist/chunk-SOXPKIQK.js.map +1 -0
- package/dist/chunk-SR2HEE4U.js +76 -0
- package/dist/chunk-SR2HEE4U.js.map +1 -0
- package/dist/chunk-SX3U6DRW.js +462 -0
- package/dist/chunk-SX3U6DRW.js.map +1 -0
- package/dist/chunk-T4U2CT35.js +175 -0
- package/dist/chunk-T4U2CT35.js.map +1 -0
- package/dist/chunk-TSX6BD72.js +251 -0
- package/dist/chunk-TSX6BD72.js.map +1 -0
- package/dist/chunk-U6PR3V2Q.js +123 -0
- package/dist/chunk-U6PR3V2Q.js.map +1 -0
- package/dist/chunk-U7NPK4WO.js +135 -0
- package/dist/chunk-U7NPK4WO.js.map +1 -0
- package/dist/chunk-W6TKXS75.js +55 -0
- package/dist/chunk-W6TKXS75.js.map +1 -0
- package/dist/chunk-WDME4U42.js +14 -0
- package/dist/chunk-WDME4U42.js.map +1 -0
- package/dist/chunk-WS2YJSNS.js +62 -0
- package/dist/chunk-WS2YJSNS.js.map +1 -0
- package/dist/chunk-Y5EYY6WJ.js +174 -0
- package/dist/chunk-Y5EYY6WJ.js.map +1 -0
- package/dist/chunk-YBMO3W5O.js +191 -0
- package/dist/chunk-YBMO3W5O.js.map +1 -0
- package/dist/chunk-YOOWFGCU.js +90 -0
- package/dist/chunk-YOOWFGCU.js.map +1 -0
- package/dist/chunk-ZKNVWQDU.js +230 -0
- package/dist/chunk-ZKNVWQDU.js.map +1 -0
- package/dist/chunk-ZYLWSGWQ.js +29 -0
- package/dist/chunk-ZYLWSGWQ.js.map +1 -0
- package/dist/chunk-ZYPW7GCI.js +82 -0
- package/dist/chunk-ZYPW7GCI.js.map +1 -0
- package/dist/client-requests.d.ts +40 -0
- package/dist/client-requests.js +25 -0
- package/dist/client-requests.js.map +1 -0
- package/dist/close-checklist.d.ts +34 -0
- package/dist/close-checklist.js +22 -0
- package/dist/close-checklist.js.map +1 -0
- package/dist/confirm-dialog.d.ts +43 -0
- package/dist/confirm-dialog.js +10 -0
- package/dist/confirm-dialog.js.map +1 -0
- package/dist/country-toggle.d.ts +16 -0
- package/dist/country-toggle.js +10 -0
- package/dist/country-toggle.js.map +1 -0
- package/dist/currency-select.d.ts +32 -0
- package/dist/currency-select.js +23 -0
- package/dist/currency-select.js.map +1 -0
- package/dist/data-table.d.ts +77 -0
- package/dist/data-table.js +30 -0
- package/dist/data-table.js.map +1 -0
- package/dist/deal-pipeline.d.ts +46 -0
- package/dist/deal-pipeline.js +25 -0
- package/dist/deal-pipeline.js.map +1 -0
- package/dist/document-signoff.d.ts +45 -0
- package/dist/document-signoff.js +21 -0
- package/dist/document-signoff.js.map +1 -0
- package/dist/evidence-list.d.ts +35 -0
- package/dist/evidence-list.js +21 -0
- package/dist/evidence-list.js.map +1 -0
- package/dist/exception-banner.d.ts +15 -0
- package/dist/exception-banner.js +10 -0
- package/dist/exception-banner.js.map +1 -0
- package/dist/expense-claim.d.ts +43 -0
- package/dist/expense-claim.js +31 -0
- package/dist/expense-claim.js.map +1 -0
- package/dist/financial-date-field.d.ts +27 -0
- package/dist/financial-date-field.js +17 -0
- package/dist/financial-date-field.js.map +1 -0
- package/dist/fixed-asset-register.d.ts +59 -0
- package/dist/fixed-asset-register.js +31 -0
- package/dist/fixed-asset-register.js.map +1 -0
- package/dist/forecast-chart.d.ts +38 -0
- package/dist/forecast-chart.js +19 -0
- package/dist/forecast-chart.js.map +1 -0
- package/dist/form-props-Ct7zeZBH.d.ts +25 -0
- package/dist/funnel-chart.d.ts +27 -0
- package/dist/funnel-chart.js +17 -0
- package/dist/funnel-chart.js.map +1 -0
- package/dist/iban-input.d.ts +27 -0
- package/dist/iban-input.js +16 -0
- package/dist/iban-input.js.map +1 -0
- package/dist/index.d.ts +644 -0
- package/dist/index.js +1082 -0
- package/dist/index.js.map +1 -0
- package/dist/invoice-editor.d.ts +38 -0
- package/dist/invoice-editor.js +26 -0
- package/dist/invoice-editor.js.map +1 -0
- package/dist/invoice-number-input.d.ts +25 -0
- package/dist/invoice-number-input.js +17 -0
- package/dist/invoice-number-input.js.map +1 -0
- package/dist/kpi-stat.d.ts +34 -0
- package/dist/kpi-stat.js +15 -0
- package/dist/kpi-stat.js.map +1 -0
- package/dist/ledger-table.d.ts +85 -0
- package/dist/ledger-table.js +41 -0
- package/dist/ledger-table.js.map +1 -0
- package/dist/locale.d.ts +22 -0
- package/dist/locale.js +13 -0
- package/dist/locale.js.map +1 -0
- package/dist/money-amount.d.ts +15 -0
- package/dist/money-amount.js +10 -0
- package/dist/money-amount.js.map +1 -0
- package/dist/organization-number-input.d.ts +25 -0
- package/dist/organization-number-input.js +17 -0
- package/dist/organization-number-input.js.map +1 -0
- package/dist/payment-batch.d.ts +58 -0
- package/dist/payment-batch.js +31 -0
- package/dist/payment-batch.js.map +1 -0
- package/dist/payment-confirm.d.ts +19 -0
- package/dist/payment-confirm.js +11 -0
- package/dist/payment-confirm.js.map +1 -0
- package/dist/payment-reference-input.d.ts +27 -0
- package/dist/payment-reference-input.js +17 -0
- package/dist/payment-reference-input.js.map +1 -0
- package/dist/period-lock.d.ts +28 -0
- package/dist/period-lock.js +18 -0
- package/dist/period-lock.js.map +1 -0
- package/dist/recurring-revenue.d.ts +37 -0
- package/dist/recurring-revenue.js +18 -0
- package/dist/recurring-revenue.js.map +1 -0
- package/dist/sca-prompt.d.ts +16 -0
- package/dist/sca-prompt.js +10 -0
- package/dist/sca-prompt.js.map +1 -0
- package/dist/sheet-stack.d.ts +34 -0
- package/dist/sheet-stack.js +20 -0
- package/dist/sheet-stack.js.map +1 -0
- package/dist/stage-duration.d.ts +33 -0
- package/dist/stage-duration.js +16 -0
- package/dist/stage-duration.js.map +1 -0
- package/dist/supplier-invoice-inbox.d.ts +66 -0
- package/dist/supplier-invoice-inbox.js +38 -0
- package/dist/supplier-invoice-inbox.js.map +1 -0
- package/dist/tax-code-select.d.ts +33 -0
- package/dist/tax-code-select.js +23 -0
- package/dist/tax-code-select.js.map +1 -0
- package/dist/text-link.d.ts +33 -0
- package/dist/text-link.js +13 -0
- package/dist/text-link.js.map +1 -0
- package/dist/toasts.d.ts +53 -0
- package/dist/toasts.js +17 -0
- package/dist/toasts.js.map +1 -0
- package/dist/trend-chart.d.ts +43 -0
- package/dist/trend-chart.js +19 -0
- package/dist/trend-chart.js.map +1 -0
- package/dist/vat-return.d.ts +54 -0
- package/dist/vat-return.js +23 -0
- package/dist/vat-return.js.map +1 -0
- package/dist/voucher-composer.d.ts +69 -0
- package/dist/voucher-composer.js +15 -0
- package/dist/voucher-composer.js.map +1 -0
- package/dist/voucher-lines.d.ts +11 -0
- package/dist/voucher-lines.js +10 -0
- package/dist/voucher-lines.js.map +1 -0
- package/docs/llms.txt +214 -0
- package/package.json +308 -3
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
useBookiLocaleOptional
|
|
4
|
+
} from "./chunk-GVP2N3K6.js";
|
|
5
|
+
|
|
6
|
+
// src/exception-banner.tsx
|
|
7
|
+
import { Button } from "@ui-sdk/react/button";
|
|
8
|
+
import { personOnly } from "@booki-aui/primitives/person-only";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
function ExceptionBanner({ title, reason, context, onReview, onDismiss, className }) {
|
|
11
|
+
const { profile } = useBookiLocaleOptional();
|
|
12
|
+
return /* @__PURE__ */ jsxs("aside", { "data-slot": "exception-banner", role: "alert", className, children: [
|
|
13
|
+
/* @__PURE__ */ jsx("strong", { "data-slot": "exception-banner-title", children: title ?? profile.copy.exceptionTitle }),
|
|
14
|
+
/* @__PURE__ */ jsx("p", { "data-slot": "exception-banner-reason", children: reason }),
|
|
15
|
+
context ? /* @__PURE__ */ jsx("div", { "data-slot": "exception-banner-context", children: context }) : null,
|
|
16
|
+
/* @__PURE__ */ jsxs("div", { "data-slot": "exception-banner-actions", children: [
|
|
17
|
+
onReview ? /* @__PURE__ */ jsx(Button, { type: "button", "data-agent-confirm": personOnly("Exception review needs a person"), onClick: onReview, children: "Review" }) : null,
|
|
18
|
+
onDismiss ? /* @__PURE__ */ jsx(
|
|
19
|
+
Button,
|
|
20
|
+
{
|
|
21
|
+
"data-variant": "secondary",
|
|
22
|
+
type: "button",
|
|
23
|
+
"data-agent-confirm": personOnly("Dismiss exception needs a person"),
|
|
24
|
+
onClick: onDismiss,
|
|
25
|
+
children: profile.copy.cancel
|
|
26
|
+
}
|
|
27
|
+
) : null
|
|
28
|
+
] })
|
|
29
|
+
] });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export {
|
|
33
|
+
ExceptionBanner
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=chunk-OTD7VUEC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/exception-banner.tsx"],"sourcesContent":["import { Button } from \"@ui-sdk/react/button\";\nimport type { ReactNode } from \"react\";\nimport { useBookiLocaleOptional } from \"./locale.js\";\nimport { personOnly } from \"@booki-aui/primitives/person-only\";\n\nexport type ExceptionBannerProps = {\n title?: string;\n reason: string;\n context?: ReactNode;\n onReview?: () => void;\n onDismiss?: () => void;\n className?: string;\n};\n\n/** Agent escalation surface — stop and hand off to a reviewer. */\nfunction ExceptionBanner({ title, reason, context, onReview, onDismiss, className }: ExceptionBannerProps) {\n const { profile } = useBookiLocaleOptional();\n\n return (\n <aside data-slot=\"exception-banner\" role=\"alert\" className={className}>\n <strong data-slot=\"exception-banner-title\">{title ?? profile.copy.exceptionTitle}</strong>\n <p data-slot=\"exception-banner-reason\">{reason}</p>\n {context ? <div data-slot=\"exception-banner-context\">{context}</div> : null}\n <div data-slot=\"exception-banner-actions\">\n {onReview ? (\n <Button type=\"button\" data-agent-confirm={personOnly(\"Exception review needs a person\")} onClick={onReview}>\n Review\n </Button>\n ) : null}\n {onDismiss ? (\n <Button\n data-variant=\"secondary\"\n type=\"button\"\n data-agent-confirm={personOnly(\"Dismiss exception needs a person\")}\n onClick={onDismiss}\n >\n {profile.copy.cancel}\n </Button>\n ) : null}\n </div>\n </aside>\n );\n}\n\nexport { ExceptionBanner };\n"],"mappings":";;;;;;AAAA,SAAS,cAAc;AAGvB,SAAS,kBAAkB;AAiBrB,cAGA,YAHA;AALN,SAAS,gBAAgB,EAAE,OAAO,QAAQ,SAAS,UAAU,WAAW,UAAU,GAAyB;AACzG,QAAM,EAAE,QAAQ,IAAI,uBAAuB;AAE3C,SACE,qBAAC,WAAM,aAAU,oBAAmB,MAAK,SAAQ,WAC/C;AAAA,wBAAC,YAAO,aAAU,0BAA0B,mBAAS,QAAQ,KAAK,gBAAe;AAAA,IACjF,oBAAC,OAAE,aAAU,2BAA2B,kBAAO;AAAA,IAC9C,UAAU,oBAAC,SAAI,aAAU,4BAA4B,mBAAQ,IAAS;AAAA,IACvE,qBAAC,SAAI,aAAU,4BACZ;AAAA,iBACC,oBAAC,UAAO,MAAK,UAAS,sBAAoB,WAAW,iCAAiC,GAAG,SAAS,UAAU,oBAE5G,IACE;AAAA,MACH,YACC;AAAA,QAAC;AAAA;AAAA,UACC,gBAAa;AAAA,UACb,MAAK;AAAA,UACL,sBAAoB,WAAW,kCAAkC;AAAA,UACjE,SAAS;AAAA,UAER,kBAAQ,KAAK;AAAA;AAAA,MAChB,IACE;AAAA,OACN;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
useBookiLocaleOptional
|
|
4
|
+
} from "./chunk-GVP2N3K6.js";
|
|
5
|
+
|
|
6
|
+
// src/money-amount.tsx
|
|
7
|
+
import { formatMoney, money } from "@booki-aui/core/money";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
function MoneyAmount({
|
|
10
|
+
value,
|
|
11
|
+
currency,
|
|
12
|
+
withCurrency = true,
|
|
13
|
+
accounting = false,
|
|
14
|
+
size = "md",
|
|
15
|
+
className,
|
|
16
|
+
...props
|
|
17
|
+
}) {
|
|
18
|
+
const { profile } = useBookiLocaleOptional();
|
|
19
|
+
const m = typeof value === "number" ? money(value, currency ?? profile.currency) : value;
|
|
20
|
+
return /* @__PURE__ */ jsx("span", { "data-slot": "money-amount", "data-size": size, className, ...props, children: formatMoney(m, {
|
|
21
|
+
locale: profile.locale,
|
|
22
|
+
withCurrency,
|
|
23
|
+
accounting
|
|
24
|
+
}) });
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
MoneyAmount
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=chunk-OXHKA3UZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/money-amount.tsx"],"sourcesContent":["import { formatMoney, money, type Money } from \"@booki-aui/core/money\";\nimport { useBookiLocaleOptional } from \"./locale.js\";\nimport type { HTMLAttributes } from \"react\";\n\nexport type MoneyAmountProps = {\n value: Money | number;\n currency?: string;\n withCurrency?: boolean;\n accounting?: boolean;\n size?: \"md\" | \"lg\";\n className?: string;\n} & Omit<HTMLAttributes<HTMLSpanElement>, \"children\">;\n\nfunction MoneyAmount({\n value,\n currency,\n withCurrency = true,\n accounting = false,\n size = \"md\",\n className,\n ...props\n}: MoneyAmountProps) {\n const { profile } = useBookiLocaleOptional();\n const m = typeof value === \"number\" ? money(value, currency ?? profile.currency) : value;\n\n return (\n <span data-slot=\"money-amount\" data-size={size} className={className} {...props}>\n {formatMoney(m, {\n locale: profile.locale,\n withCurrency,\n accounting,\n })}\n </span>\n );\n}\n\nexport { MoneyAmount };\n"],"mappings":";;;;;;AAAA,SAAS,aAAa,aAAyB;AA0B3C;AAbJ,SAAS,YAAY;AAAA,EACnB;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf,aAAa;AAAA,EACb,OAAO;AAAA,EACP;AAAA,EACA,GAAG;AACL,GAAqB;AACnB,QAAM,EAAE,QAAQ,IAAI,uBAAuB;AAC3C,QAAM,IAAI,OAAO,UAAU,WAAW,MAAM,OAAO,YAAY,QAAQ,QAAQ,IAAI;AAEnF,SACE,oBAAC,UAAK,aAAU,gBAAe,aAAW,MAAM,WAAuB,GAAG,OACvE,sBAAY,GAAG;AAAA,IACd,QAAQ,QAAQ;AAAA,IAChB;AAAA,IACA;AAAA,EACF,CAAC,GACH;AAEJ;","names":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/form-props.tsx
|
|
4
|
+
import {
|
|
5
|
+
inputLockAttrs,
|
|
6
|
+
isLocked,
|
|
7
|
+
lockOptions,
|
|
8
|
+
lockState,
|
|
9
|
+
restoreSelect,
|
|
10
|
+
selectLockAttrs
|
|
11
|
+
} from "@booki-aui/primitives/lock";
|
|
12
|
+
import { jsx } from "react/jsx-runtime";
|
|
13
|
+
function FormValue({ name, value, disabled }) {
|
|
14
|
+
if (!name) return null;
|
|
15
|
+
return /* @__PURE__ */ jsx("input", { type: "hidden", name, value: String(value), disabled });
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export {
|
|
19
|
+
FormValue
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=chunk-OYERLEER.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/form-props.tsx"],"sourcesContent":["/**\n * Form participation shared by the composed Booki controls.\n *\n * - `name`: the control submits with a native `<form>` through a hidden input\n * carrying its canonical value (minor units, digits, ISO date, code).\n * - `disabled`: not editable and not submitted, as in HTML.\n * - `readOnly`: shown and submitted, not editable.\n * - `required` and `id` go to the visible input.\n *\n * `disabled` and `readOnly` live in each primitive's state. ui-sdk's agent\n * bridge reads those two keys itself: the snapshot lists the control with\n * `disabled: true` and no actions, and a step on it is refused.\n */\nexport type BookiFormProps = {\n /** Field name in a native form. Submits the canonical value. */\n name?: string;\n /** Id of the visible input, for `<label htmlFor>`. */\n id?: string;\n disabled?: boolean;\n /** Shown and submitted, but nobody (person or agent) can change it. */\n readOnly?: boolean;\n required?: boolean;\n};\n\nexport {\n inputLockAttrs,\n isLocked,\n lockOptions,\n lockState,\n restoreSelect,\n selectLockAttrs,\n type LockOptions,\n type LockState,\n} from \"@booki-aui/primitives/lock\";\n\n/** The hidden input that carries a control's canonical value into a form. */\nexport function FormValue({ name, value, disabled }: { name?: string; value: string | number; disabled?: boolean }) {\n if (!name) return null;\n return <input type=\"hidden\" name={name} value={String(value)} disabled={disabled} />;\n}\n"],"mappings":";;;AAwBA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AAKE;AAFF,SAAS,UAAU,EAAE,MAAM,OAAO,SAAS,GAAkE;AAClH,MAAI,CAAC,KAAM,QAAO;AAClB,SAAO,oBAAC,WAAM,MAAK,UAAS,MAAY,OAAO,OAAO,KAAK,GAAG,UAAoB;AACpF;","names":[]}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
MoneyAmount
|
|
4
|
+
} from "./chunk-OXHKA3UZ.js";
|
|
5
|
+
import {
|
|
6
|
+
useAccessFor
|
|
7
|
+
} from "./chunk-K72VT6RJ.js";
|
|
8
|
+
import {
|
|
9
|
+
useBookiLocaleOptional,
|
|
10
|
+
useSay
|
|
11
|
+
} from "./chunk-GVP2N3K6.js";
|
|
12
|
+
|
|
13
|
+
// src/audit-findings.tsx
|
|
14
|
+
import {
|
|
15
|
+
FINDING_BASES,
|
|
16
|
+
FINDING_CATEGORIES,
|
|
17
|
+
WITHDRAW_REASON_MIN
|
|
18
|
+
} from "@booki-aui/core/findings";
|
|
19
|
+
import { createParts } from "@ui-sdk/react/primitive";
|
|
20
|
+
import { auditFindings, buttonKey } from "@booki-aui/primitives/audit-findings";
|
|
21
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
22
|
+
var TAGS = {
|
|
23
|
+
root: "div",
|
|
24
|
+
confirm: "button",
|
|
25
|
+
reason: "textarea",
|
|
26
|
+
withdraw: "button",
|
|
27
|
+
reopen: "button"
|
|
28
|
+
};
|
|
29
|
+
var parts = createParts(auditFindings, TAGS);
|
|
30
|
+
var AuditFindingsRoot = parts.Root;
|
|
31
|
+
var AuditFindingsConfirm = parts.Confirm;
|
|
32
|
+
var AuditFindingsReason = parts.Reason;
|
|
33
|
+
var AuditFindingsWithdraw = parts.Withdraw;
|
|
34
|
+
var AuditFindingsReopen = parts.Reopen;
|
|
35
|
+
var COPY = {
|
|
36
|
+
EN: {
|
|
37
|
+
label: "Audit findings",
|
|
38
|
+
none: "No findings raised.",
|
|
39
|
+
confidential: "Confidential",
|
|
40
|
+
evidence: "Evidence",
|
|
41
|
+
noEvidence: "No evidence cited",
|
|
42
|
+
raisedBy: "Raised by",
|
|
43
|
+
confirmedBy: "confirmed by",
|
|
44
|
+
withdrawnBy: "withdrawn by",
|
|
45
|
+
toWeigh: "To weigh before confirming",
|
|
46
|
+
confirm: "Confirm",
|
|
47
|
+
withdraw: "Withdraw",
|
|
48
|
+
reopen: "Reopen",
|
|
49
|
+
reason: "Reason for withdrawing",
|
|
50
|
+
reasonHint: `At least ${WITHDRAW_REASON_MIN} characters. Kept with the file.`,
|
|
51
|
+
status: { draft: "Draft", confirmed: "Confirmed", withdrawn: "Withdrawn" },
|
|
52
|
+
category: {
|
|
53
|
+
misstatement: "Misstatement",
|
|
54
|
+
"control-deficiency": "Control deficiency",
|
|
55
|
+
compliance: "Compliance",
|
|
56
|
+
other: "Other"
|
|
57
|
+
},
|
|
58
|
+
basis: { documented: "Documented", reported: "Reported by a party", hypothesis: "Hypothesis" }
|
|
59
|
+
},
|
|
60
|
+
NO: {
|
|
61
|
+
label: "Revisjonsfunn",
|
|
62
|
+
none: "Ingen funn er registrert.",
|
|
63
|
+
confidential: "Fortrolig",
|
|
64
|
+
evidence: "Dokumentasjon",
|
|
65
|
+
noEvidence: "Ingen dokumentasjon",
|
|
66
|
+
raisedBy: "Registrert av",
|
|
67
|
+
confirmedBy: "bekreftet av",
|
|
68
|
+
withdrawnBy: "trukket tilbake av",
|
|
69
|
+
toWeigh: "Vurder f\xF8r bekreftelse",
|
|
70
|
+
confirm: "Bekreft",
|
|
71
|
+
withdraw: "Trekk tilbake",
|
|
72
|
+
reopen: "\xC5pne igjen",
|
|
73
|
+
reason: "Begrunnelse for \xE5 trekke tilbake",
|
|
74
|
+
reasonHint: `Minst ${WITHDRAW_REASON_MIN} tegn. Lagres i arkivet.`,
|
|
75
|
+
status: { draft: "Utkast", confirmed: "Bekreftet", withdrawn: "Trukket tilbake" },
|
|
76
|
+
category: {
|
|
77
|
+
misstatement: "Feilinformasjon",
|
|
78
|
+
"control-deficiency": "Svakhet i internkontroll",
|
|
79
|
+
compliance: "Etterlevelse",
|
|
80
|
+
other: "Annet"
|
|
81
|
+
},
|
|
82
|
+
basis: { documented: "Dokumentert", reported: "Opplyst av en part", hypothesis: "Hypotese" }
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
function AuditFindings({
|
|
86
|
+
findings,
|
|
87
|
+
defaultFindings,
|
|
88
|
+
evidence,
|
|
89
|
+
currency,
|
|
90
|
+
actor,
|
|
91
|
+
agentActor,
|
|
92
|
+
onFindingsChange,
|
|
93
|
+
nameOf = (id) => id,
|
|
94
|
+
className,
|
|
95
|
+
"aria-label": ariaLabel
|
|
96
|
+
}) {
|
|
97
|
+
const { country, profile } = useBookiLocaleOptional();
|
|
98
|
+
const say = useSay();
|
|
99
|
+
const copy = COPY[country === "NO" ? "NO" : "EN"];
|
|
100
|
+
const access = useAccessFor(
|
|
101
|
+
{ confirm: "finding.confirm", withdraw: "finding.withdraw", reopen: "finding.confirm" },
|
|
102
|
+
actor
|
|
103
|
+
);
|
|
104
|
+
const labelOf = (id) => evidence?.find((item) => item.id === id)?.label ?? id;
|
|
105
|
+
return /* @__PURE__ */ jsx(
|
|
106
|
+
AuditFindingsRoot,
|
|
107
|
+
{
|
|
108
|
+
findings,
|
|
109
|
+
defaultFindings,
|
|
110
|
+
evidence,
|
|
111
|
+
currency: currency ?? profile.currency,
|
|
112
|
+
actor: access.actor,
|
|
113
|
+
denied: access.denied,
|
|
114
|
+
agentActor,
|
|
115
|
+
onFindingsChange,
|
|
116
|
+
className,
|
|
117
|
+
"aria-label": ariaLabel ?? copy.label,
|
|
118
|
+
children: (state) => {
|
|
119
|
+
const count = (status) => state.findings.filter((finding) => finding.status === status).length;
|
|
120
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
121
|
+
/* @__PURE__ */ jsx("p", { "data-slot": "audit-findings-status", role: "status", children: ["draft", "confirmed", "withdrawn"].map((status) => `${copy.status[status]} ${count(status)}`).join(" \xB7 ") }),
|
|
122
|
+
state.findings.length === 0 ? /* @__PURE__ */ jsx("p", { "data-slot": "audit-findings-empty", children: copy.none }) : /* @__PURE__ */ jsx("ul", { "data-slot": "audit-findings-items", children: state.findings.map((finding) => {
|
|
123
|
+
const name = finding.code ?? finding.id;
|
|
124
|
+
const secret = finding.confidential ? "" : void 0;
|
|
125
|
+
const issues = state.issues[finding.id] ?? [];
|
|
126
|
+
const reasonId = `${finding.id}-withdraw-hint`;
|
|
127
|
+
return /* @__PURE__ */ jsxs(
|
|
128
|
+
"li",
|
|
129
|
+
{
|
|
130
|
+
"data-status": finding.status,
|
|
131
|
+
"data-basis": finding.basis,
|
|
132
|
+
"data-confidential": secret,
|
|
133
|
+
children: [
|
|
134
|
+
/* @__PURE__ */ jsxs("div", { "data-slot": "audit-findings-head", children: [
|
|
135
|
+
/* @__PURE__ */ jsx("span", { "data-slot": "audit-findings-code", children: name }),
|
|
136
|
+
/* @__PURE__ */ jsx("span", { "data-slot": "audit-findings-name", "data-agent-secret": secret, children: finding.title }),
|
|
137
|
+
finding.amountMinor !== void 0 ? /* @__PURE__ */ jsx("span", { "data-slot": "audit-findings-amount", "data-agent-secret": secret, children: /* @__PURE__ */ jsx(MoneyAmount, { value: finding.amountMinor, currency: finding.currency ?? profile.currency }) }) : null
|
|
138
|
+
] }),
|
|
139
|
+
/* @__PURE__ */ jsxs("div", { "data-slot": "audit-findings-tags", children: [
|
|
140
|
+
/* @__PURE__ */ jsx("span", { "data-slot": "audit-findings-state", "data-status": finding.status, children: copy.status[finding.status] }),
|
|
141
|
+
/* @__PURE__ */ jsx("span", { "data-slot": "audit-findings-tag", children: copy.category[finding.category] }),
|
|
142
|
+
/* @__PURE__ */ jsx("span", { "data-slot": "audit-findings-tag", "data-basis": finding.basis, children: copy.basis[finding.basis] }),
|
|
143
|
+
finding.confidential ? /* @__PURE__ */ jsx("span", { "data-slot": "audit-findings-tag", "data-confidential": "", children: copy.confidential }) : null
|
|
144
|
+
] }),
|
|
145
|
+
finding.description ? /* @__PURE__ */ jsx("p", { "data-slot": "audit-findings-text", "data-agent-secret": secret, children: finding.description }) : null,
|
|
146
|
+
/* @__PURE__ */ jsxs("p", { "data-slot": "audit-findings-meta", children: [
|
|
147
|
+
copy.evidence,
|
|
148
|
+
":",
|
|
149
|
+
" ",
|
|
150
|
+
/* @__PURE__ */ jsx("span", { "data-agent-secret": secret, children: finding.sources.length ? finding.sources.map(labelOf).join(", ") : copy.noEvidence }),
|
|
151
|
+
" \xB7 ",
|
|
152
|
+
copy.raisedBy,
|
|
153
|
+
" ",
|
|
154
|
+
nameOf(finding.raisedBy),
|
|
155
|
+
finding.confirmedBy ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
156
|
+
", ",
|
|
157
|
+
copy.confirmedBy,
|
|
158
|
+
" ",
|
|
159
|
+
nameOf(finding.confirmedBy)
|
|
160
|
+
] }) : null,
|
|
161
|
+
finding.withdrawnBy ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
162
|
+
", ",
|
|
163
|
+
copy.withdrawnBy,
|
|
164
|
+
" ",
|
|
165
|
+
nameOf(finding.withdrawnBy)
|
|
166
|
+
] }) : null
|
|
167
|
+
] }),
|
|
168
|
+
finding.withdrawReason ? /* @__PURE__ */ jsx("p", { "data-slot": "audit-findings-withdrawn", "data-agent-secret": secret, children: finding.withdrawReason }) : null,
|
|
169
|
+
finding.status !== "withdrawn" && issues.length ? /* @__PURE__ */ jsx("ul", { "data-slot": "audit-findings-issues", "aria-label": `${copy.toWeigh}: ${name}`, children: issues.map((issue) => /* @__PURE__ */ jsx("li", { children: say(issue) }, issue)) }) : null,
|
|
170
|
+
/* @__PURE__ */ jsxs("div", { "data-slot": "audit-findings-actions", children: [
|
|
171
|
+
finding.status === "draft" ? /* @__PURE__ */ jsx(
|
|
172
|
+
AuditFindingsConfirm,
|
|
173
|
+
{
|
|
174
|
+
value: buttonKey(finding.id, "confirm"),
|
|
175
|
+
"aria-label": `${copy.confirm}: ${name}`,
|
|
176
|
+
children: copy.confirm
|
|
177
|
+
}
|
|
178
|
+
) : null,
|
|
179
|
+
finding.status !== "withdrawn" ? /* @__PURE__ */ jsxs("span", { "data-slot": "audit-findings-withdraw", children: [
|
|
180
|
+
/* @__PURE__ */ jsx(
|
|
181
|
+
AuditFindingsReason,
|
|
182
|
+
{
|
|
183
|
+
value: finding.id,
|
|
184
|
+
rows: 2,
|
|
185
|
+
"aria-label": `${copy.reason}: ${name}`,
|
|
186
|
+
"aria-describedby": reasonId
|
|
187
|
+
}
|
|
188
|
+
),
|
|
189
|
+
/* @__PURE__ */ jsx("small", { id: reasonId, "data-slot": "audit-findings-hint", children: copy.reasonHint }),
|
|
190
|
+
/* @__PURE__ */ jsx(
|
|
191
|
+
AuditFindingsWithdraw,
|
|
192
|
+
{
|
|
193
|
+
value: buttonKey(finding.id, "withdraw"),
|
|
194
|
+
"aria-label": `${copy.withdraw}: ${name}`,
|
|
195
|
+
children: copy.withdraw
|
|
196
|
+
}
|
|
197
|
+
)
|
|
198
|
+
] }) : null,
|
|
199
|
+
finding.status !== "draft" ? /* @__PURE__ */ jsx(
|
|
200
|
+
AuditFindingsReopen,
|
|
201
|
+
{
|
|
202
|
+
value: buttonKey(finding.id, "reopen"),
|
|
203
|
+
"aria-label": `${copy.reopen}: ${name}`,
|
|
204
|
+
children: copy.reopen
|
|
205
|
+
}
|
|
206
|
+
) : null
|
|
207
|
+
] })
|
|
208
|
+
]
|
|
209
|
+
},
|
|
210
|
+
finding.id
|
|
211
|
+
);
|
|
212
|
+
}) }),
|
|
213
|
+
state.refusal ? /* @__PURE__ */ jsx("p", { "data-slot": "audit-findings-error", role: "alert", children: say(state.refusal) }) : null
|
|
214
|
+
] });
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export {
|
|
221
|
+
FINDING_BASES,
|
|
222
|
+
FINDING_CATEGORIES,
|
|
223
|
+
auditFindings,
|
|
224
|
+
AuditFindingsRoot,
|
|
225
|
+
AuditFindingsConfirm,
|
|
226
|
+
AuditFindingsReason,
|
|
227
|
+
AuditFindingsWithdraw,
|
|
228
|
+
AuditFindingsReopen,
|
|
229
|
+
AuditFindings
|
|
230
|
+
};
|
|
231
|
+
//# sourceMappingURL=chunk-PFY3VJ2T.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/audit-findings.tsx"],"sourcesContent":["import {\n FINDING_BASES,\n FINDING_CATEGORIES,\n WITHDRAW_REASON_MIN,\n type Finding,\n type FindingBasis,\n type FindingCategory,\n type FindingStatus,\n} from \"@booki-aui/core/findings\";\nimport type { BookiChangeDetails } from \"./change-details.js\";\nimport { createParts, type Parts } from \"@ui-sdk/react/primitive\";\nimport type { ReactNode } from \"react\";\nimport { useAccessFor } from \"./access.js\";\nimport { useBookiLocaleOptional } from \"./locale.js\";\nimport { MoneyAmount } from \"./money-amount.js\";\nimport { useSay } from \"./say.js\";\nimport { auditFindings, buttonKey, type FindingEvidence } from \"@booki-aui/primitives/audit-findings\";\n\nconst TAGS = {\n root: \"div\",\n confirm: \"button\",\n reason: \"textarea\",\n withdraw: \"button\",\n reopen: \"button\",\n} as const;\n// Typed by name, so the declarations refer to the definition instead of spelling it out per part.\nconst parts: Parts<typeof auditFindings, typeof TAGS> = createParts(auditFindings, TAGS);\nconst AuditFindingsRoot: (typeof parts)[\"Root\"] = parts.Root;\nconst AuditFindingsConfirm: (typeof parts)[\"Confirm\"] = parts.Confirm;\nconst AuditFindingsReason: (typeof parts)[\"Reason\"] = parts.Reason;\nconst AuditFindingsWithdraw: (typeof parts)[\"Withdraw\"] = parts.Withdraw;\nconst AuditFindingsReopen: (typeof parts)[\"Reopen\"] = parts.Reopen;\n\nconst COPY = {\n EN: {\n label: \"Audit findings\",\n none: \"No findings raised.\",\n confidential: \"Confidential\",\n evidence: \"Evidence\",\n noEvidence: \"No evidence cited\",\n raisedBy: \"Raised by\",\n confirmedBy: \"confirmed by\",\n withdrawnBy: \"withdrawn by\",\n toWeigh: \"To weigh before confirming\",\n confirm: \"Confirm\",\n withdraw: \"Withdraw\",\n reopen: \"Reopen\",\n reason: \"Reason for withdrawing\",\n reasonHint: `At least ${WITHDRAW_REASON_MIN} characters. Kept with the file.`,\n status: { draft: \"Draft\", confirmed: \"Confirmed\", withdrawn: \"Withdrawn\" } satisfies Record<FindingStatus, string>,\n category: {\n misstatement: \"Misstatement\",\n \"control-deficiency\": \"Control deficiency\",\n compliance: \"Compliance\",\n other: \"Other\",\n } satisfies Record<FindingCategory, string>,\n basis: { documented: \"Documented\", reported: \"Reported by a party\", hypothesis: \"Hypothesis\" } satisfies Record<\n FindingBasis,\n string\n >,\n },\n NO: {\n label: \"Revisjonsfunn\",\n none: \"Ingen funn er registrert.\",\n confidential: \"Fortrolig\",\n evidence: \"Dokumentasjon\",\n noEvidence: \"Ingen dokumentasjon\",\n raisedBy: \"Registrert av\",\n confirmedBy: \"bekreftet av\",\n withdrawnBy: \"trukket tilbake av\",\n toWeigh: \"Vurder før bekreftelse\",\n confirm: \"Bekreft\",\n withdraw: \"Trekk tilbake\",\n reopen: \"Åpne igjen\",\n reason: \"Begrunnelse for å trekke tilbake\",\n reasonHint: `Minst ${WITHDRAW_REASON_MIN} tegn. Lagres i arkivet.`,\n status: { draft: \"Utkast\", confirmed: \"Bekreftet\", withdrawn: \"Trukket tilbake\" } satisfies Record<\n FindingStatus,\n string\n >,\n category: {\n misstatement: \"Feilinformasjon\",\n \"control-deficiency\": \"Svakhet i internkontroll\",\n compliance: \"Etterlevelse\",\n other: \"Annet\",\n } satisfies Record<FindingCategory, string>,\n basis: { documented: \"Dokumentert\", reported: \"Opplyst av en part\", hypothesis: \"Hypotese\" } satisfies Record<\n FindingBasis,\n string\n >,\n },\n} as const;\n\nexport type AuditFindingsProps = {\n findings?: Finding[];\n defaultFindings?: Finding[];\n /** Evidence a finding can cite. When given, an agent can cite nothing else. */\n evidence?: FindingEvidence[];\n /** Currency of an amount drafted without one. Defaults to the country's. */\n currency?: string;\n actor?: string;\n agentActor?: string;\n onFindingsChange?: (findings: Finding[], details: BookiChangeDetails) => void;\n nameOf?: (id: string) => ReactNode;\n className?: string;\n \"aria-label\"?: string;\n};\n\ntype RootState = {\n findings: Finding[];\n issues: Record<string, string[]>;\n drafts: Record<string, string>;\n refusal: string;\n};\n\n/** Composed register: each finding, its basis and evidence, what to weigh, and a person's buttons. */\nfunction AuditFindings({\n findings,\n defaultFindings,\n evidence,\n currency,\n actor,\n agentActor,\n onFindingsChange,\n nameOf = (id) => id,\n className,\n \"aria-label\": ariaLabel,\n}: AuditFindingsProps) {\n const { country, profile } = useBookiLocaleOptional();\n const say = useSay();\n const copy = COPY[country === \"NO\" ? \"NO\" : \"EN\"];\n const access = useAccessFor(\n { confirm: \"finding.confirm\", withdraw: \"finding.withdraw\", reopen: \"finding.confirm\" },\n actor,\n );\n const labelOf = (id: string) => evidence?.find((item) => item.id === id)?.label ?? id;\n return (\n <AuditFindingsRoot\n findings={findings}\n defaultFindings={defaultFindings}\n evidence={evidence}\n currency={currency ?? profile.currency}\n actor={access.actor}\n denied={access.denied}\n agentActor={agentActor}\n onFindingsChange={onFindingsChange}\n className={className}\n aria-label={ariaLabel ?? copy.label}\n >\n {(state: RootState) => {\n const count = (status: FindingStatus) => state.findings.filter((finding) => finding.status === status).length;\n return (\n <>\n <p data-slot=\"audit-findings-status\" role=\"status\">\n {([\"draft\", \"confirmed\", \"withdrawn\"] as const)\n .map((status) => `${copy.status[status]} ${count(status)}`)\n .join(\" · \")}\n </p>\n {state.findings.length === 0 ? (\n <p data-slot=\"audit-findings-empty\">{copy.none}</p>\n ) : (\n <ul data-slot=\"audit-findings-items\">\n {state.findings.map((finding) => {\n // Buttons are named by code or id, never by a confidential title.\n const name = finding.code ?? finding.id;\n const secret = finding.confidential ? \"\" : undefined;\n const issues = state.issues[finding.id] ?? [];\n const reasonId = `${finding.id}-withdraw-hint`;\n return (\n <li\n key={finding.id}\n data-status={finding.status}\n data-basis={finding.basis}\n data-confidential={secret}\n >\n <div data-slot=\"audit-findings-head\">\n <span data-slot=\"audit-findings-code\">{name}</span>\n <span data-slot=\"audit-findings-name\" data-agent-secret={secret}>\n {finding.title}\n </span>\n {finding.amountMinor !== undefined ? (\n <span data-slot=\"audit-findings-amount\" data-agent-secret={secret}>\n <MoneyAmount value={finding.amountMinor} currency={finding.currency ?? profile.currency} />\n </span>\n ) : null}\n </div>\n <div data-slot=\"audit-findings-tags\">\n <span data-slot=\"audit-findings-state\" data-status={finding.status}>\n {copy.status[finding.status]}\n </span>\n <span data-slot=\"audit-findings-tag\">{copy.category[finding.category]}</span>\n <span data-slot=\"audit-findings-tag\" data-basis={finding.basis}>\n {copy.basis[finding.basis]}\n </span>\n {finding.confidential ? (\n <span data-slot=\"audit-findings-tag\" data-confidential=\"\">\n {copy.confidential}\n </span>\n ) : null}\n </div>\n {finding.description ? (\n <p data-slot=\"audit-findings-text\" data-agent-secret={secret}>\n {finding.description}\n </p>\n ) : null}\n <p data-slot=\"audit-findings-meta\">\n {copy.evidence}:{\" \"}\n <span data-agent-secret={secret}>\n {finding.sources.length ? finding.sources.map(labelOf).join(\", \") : copy.noEvidence}\n </span>\n {\" · \"}\n {copy.raisedBy} {nameOf(finding.raisedBy)}\n {finding.confirmedBy ? (\n <>\n , {copy.confirmedBy} {nameOf(finding.confirmedBy)}\n </>\n ) : null}\n {finding.withdrawnBy ? (\n <>\n , {copy.withdrawnBy} {nameOf(finding.withdrawnBy)}\n </>\n ) : null}\n </p>\n {finding.withdrawReason ? (\n <p data-slot=\"audit-findings-withdrawn\" data-agent-secret={secret}>\n {finding.withdrawReason}\n </p>\n ) : null}\n {finding.status !== \"withdrawn\" && issues.length ? (\n <ul data-slot=\"audit-findings-issues\" aria-label={`${copy.toWeigh}: ${name}`}>\n {issues.map((issue) => (\n <li key={issue}>{say(issue)}</li>\n ))}\n </ul>\n ) : null}\n <div data-slot=\"audit-findings-actions\">\n {finding.status === \"draft\" ? (\n <AuditFindingsConfirm\n value={buttonKey(finding.id, \"confirm\")}\n aria-label={`${copy.confirm}: ${name}`}\n >\n {copy.confirm}\n </AuditFindingsConfirm>\n ) : null}\n {finding.status !== \"withdrawn\" ? (\n <span data-slot=\"audit-findings-withdraw\">\n <AuditFindingsReason\n value={finding.id}\n rows={2}\n aria-label={`${copy.reason}: ${name}`}\n aria-describedby={reasonId}\n />\n <small id={reasonId} data-slot=\"audit-findings-hint\">\n {copy.reasonHint}\n </small>\n <AuditFindingsWithdraw\n value={buttonKey(finding.id, \"withdraw\")}\n aria-label={`${copy.withdraw}: ${name}`}\n >\n {copy.withdraw}\n </AuditFindingsWithdraw>\n </span>\n ) : null}\n {finding.status !== \"draft\" ? (\n <AuditFindingsReopen\n value={buttonKey(finding.id, \"reopen\")}\n aria-label={`${copy.reopen}: ${name}`}\n >\n {copy.reopen}\n </AuditFindingsReopen>\n ) : null}\n </div>\n </li>\n );\n })}\n </ul>\n )}\n {state.refusal ? (\n <p data-slot=\"audit-findings-error\" role=\"alert\">\n {say(state.refusal)}\n </p>\n ) : null}\n </>\n );\n }}\n </AuditFindingsRoot>\n );\n}\n\nexport {\n AuditFindings,\n AuditFindingsConfirm,\n AuditFindingsReason,\n AuditFindingsReopen,\n AuditFindingsRoot,\n AuditFindingsWithdraw,\n FINDING_BASES,\n FINDING_CATEGORIES,\n auditFindings,\n};\nexport type { Finding, FindingBasis, FindingCategory, FindingEvidence, FindingStatus };\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
useAccessFor
|
|
4
|
+
} from "./chunk-K72VT6RJ.js";
|
|
5
|
+
import {
|
|
6
|
+
useBookiLocaleOptional,
|
|
7
|
+
useSay
|
|
8
|
+
} from "./chunk-GVP2N3K6.js";
|
|
9
|
+
|
|
10
|
+
// src/deal-pipeline.tsx
|
|
11
|
+
import { formatMoney } from "@booki-aui/core/money";
|
|
12
|
+
import { createParts } from "@ui-sdk/react/primitive";
|
|
13
|
+
import { buttonKey, dealPipeline } from "@booki-aui/primitives/deal-pipeline";
|
|
14
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
var TAGS = {
|
|
16
|
+
root: "div",
|
|
17
|
+
move: "select",
|
|
18
|
+
won: "button",
|
|
19
|
+
reason: "textarea",
|
|
20
|
+
lost: "button",
|
|
21
|
+
reopen: "button"
|
|
22
|
+
};
|
|
23
|
+
var parts = createParts(dealPipeline, TAGS);
|
|
24
|
+
var DealPipelineRoot = parts.Root;
|
|
25
|
+
var DealPipelineMove = parts.Move;
|
|
26
|
+
var DealPipelineWon = parts.Won;
|
|
27
|
+
var DealPipelineReason = parts.Reason;
|
|
28
|
+
var DealPipelineLost = parts.Lost;
|
|
29
|
+
var DealPipelineReopen = parts.Reopen;
|
|
30
|
+
var COPY = {
|
|
31
|
+
EN: {
|
|
32
|
+
label: "Sales pipeline",
|
|
33
|
+
forecast: "Weighted forecast",
|
|
34
|
+
none: "No deals",
|
|
35
|
+
noValue: "No value",
|
|
36
|
+
deals: (n) => n === 1 ? "1 deal" : `${n} deals`,
|
|
37
|
+
weighted: "weighted",
|
|
38
|
+
unverified: (n) => `${n} without a source`,
|
|
39
|
+
stage: "Stage",
|
|
40
|
+
close: "Expected close",
|
|
41
|
+
owner: "Owner",
|
|
42
|
+
won: "Mark won",
|
|
43
|
+
lost: "Mark lost",
|
|
44
|
+
reopen: "Reopen",
|
|
45
|
+
reason: "Why it was lost",
|
|
46
|
+
closedBy: "Closed by",
|
|
47
|
+
status: { known: "Known", estimate: "Estimate", unknown: "Unverified" },
|
|
48
|
+
outcome: { won: "Won", lost: "Lost" }
|
|
49
|
+
},
|
|
50
|
+
NO: {
|
|
51
|
+
label: "Salgsl\xF8p",
|
|
52
|
+
forecast: "Vektet prognose",
|
|
53
|
+
none: "Ingen avtaler",
|
|
54
|
+
noValue: "Ingen verdi",
|
|
55
|
+
deals: (n) => n === 1 ? "1 avtale" : `${n} avtaler`,
|
|
56
|
+
weighted: "vektet",
|
|
57
|
+
unverified: (n) => `${n} uten kilde`,
|
|
58
|
+
stage: "Fase",
|
|
59
|
+
close: "Forventet lukket",
|
|
60
|
+
owner: "Ansvarlig",
|
|
61
|
+
won: "Marker vunnet",
|
|
62
|
+
lost: "Marker tapt",
|
|
63
|
+
reopen: "\xC5pne igjen",
|
|
64
|
+
reason: "Hvorfor den ble tapt",
|
|
65
|
+
closedBy: "Lukket av",
|
|
66
|
+
status: { known: "Kjent", estimate: "Estimat", unknown: "Ubekreftet" },
|
|
67
|
+
outcome: { won: "Vunnet", lost: "Tapt" }
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
function DealPipeline({
|
|
71
|
+
stages,
|
|
72
|
+
deals,
|
|
73
|
+
defaultDeals,
|
|
74
|
+
owners,
|
|
75
|
+
today,
|
|
76
|
+
staleDays,
|
|
77
|
+
actor,
|
|
78
|
+
onDealsChange,
|
|
79
|
+
nameOf = (id) => id,
|
|
80
|
+
className,
|
|
81
|
+
"aria-label": ariaLabel
|
|
82
|
+
}) {
|
|
83
|
+
const { country, profile } = useBookiLocaleOptional();
|
|
84
|
+
const say = useSay();
|
|
85
|
+
const copy = COPY[country === "NO" ? "NO" : "EN"];
|
|
86
|
+
const access = useAccessFor({ closeWon: "deal.close", closeLost: "deal.close", reopen: "deal.close" }, actor);
|
|
87
|
+
const money = (minor, currency) => formatMoney({ minor, currency }, { locale: profile.locale, trimZeroFraction: true });
|
|
88
|
+
const date = (value) => new Intl.DateTimeFormat(profile.locale, {
|
|
89
|
+
day: "numeric",
|
|
90
|
+
month: "short",
|
|
91
|
+
year: "numeric",
|
|
92
|
+
timeZone: "UTC"
|
|
93
|
+
}).format(/* @__PURE__ */ new Date(`${value.slice(0, 10)}T00:00:00Z`));
|
|
94
|
+
const totalsLine = (totals) => totals.filter((total) => total.knownMinor + total.estimateMinor > 0).map((total) => money(total.knownMinor + total.estimateMinor, total.currency)).join(" \xB7 ");
|
|
95
|
+
return /* @__PURE__ */ jsx(
|
|
96
|
+
DealPipelineRoot,
|
|
97
|
+
{
|
|
98
|
+
deals,
|
|
99
|
+
defaultDeals,
|
|
100
|
+
stages,
|
|
101
|
+
owners,
|
|
102
|
+
today,
|
|
103
|
+
staleDays,
|
|
104
|
+
actor: access.actor,
|
|
105
|
+
denied: access.denied,
|
|
106
|
+
onDealsChange,
|
|
107
|
+
className,
|
|
108
|
+
"aria-label": ariaLabel ?? copy.label,
|
|
109
|
+
children: (state) => {
|
|
110
|
+
const open = state.stages.filter((stage) => !stage.outcome);
|
|
111
|
+
const ownerName = (id) => state.owners.find((owner) => owner.id === id)?.name ?? id;
|
|
112
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
113
|
+
/* @__PURE__ */ jsxs("p", { "data-slot": "deal-pipeline-forecast", role: "status", children: [
|
|
114
|
+
/* @__PURE__ */ jsx("span", { "data-slot": "deal-pipeline-label", children: copy.forecast }),
|
|
115
|
+
" ",
|
|
116
|
+
state.forecast.length && state.forecast.some((total) => total.weightedMinor > 0) ? state.forecast.filter((total) => total.weightedMinor > 0).map((total) => money(total.weightedMinor, total.currency)).join(" \xB7 ") : "\u2013"
|
|
117
|
+
] }),
|
|
118
|
+
/* @__PURE__ */ jsx("div", { "data-slot": "deal-pipeline-board", children: state.summary.map((column) => {
|
|
119
|
+
const here = state.deals.filter((deal) => deal.stageId === column.stageId);
|
|
120
|
+
const unverified = column.totals.reduce((n, total) => n + total.unverified, 0);
|
|
121
|
+
return /* @__PURE__ */ jsxs(
|
|
122
|
+
"section",
|
|
123
|
+
{
|
|
124
|
+
"data-slot": "deal-pipeline-stage",
|
|
125
|
+
"data-outcome": column.outcome,
|
|
126
|
+
"aria-label": column.name,
|
|
127
|
+
children: [
|
|
128
|
+
/* @__PURE__ */ jsxs("header", { "data-slot": "deal-pipeline-stage-head", children: [
|
|
129
|
+
/* @__PURE__ */ jsx("span", { "data-slot": "deal-pipeline-stage-name", children: column.name }),
|
|
130
|
+
/* @__PURE__ */ jsxs("span", { "data-slot": "deal-pipeline-stage-meta", children: [
|
|
131
|
+
copy.deals(column.count),
|
|
132
|
+
column.outcome ? "" : ` \xB7 ${column.probability} %`
|
|
133
|
+
] }),
|
|
134
|
+
/* @__PURE__ */ jsx("span", { "data-slot": "deal-pipeline-stage-total", children: totalsLine(column.totals) || "\u2013" }),
|
|
135
|
+
unverified ? /* @__PURE__ */ jsx("span", { "data-slot": "deal-pipeline-stage-unverified", children: copy.unverified(unverified) }) : null
|
|
136
|
+
] }),
|
|
137
|
+
here.length === 0 ? /* @__PURE__ */ jsx("p", { "data-slot": "deal-pipeline-empty", children: copy.none }) : /* @__PURE__ */ jsx("ul", { "data-slot": "deal-pipeline-deals", children: here.map((deal) => {
|
|
138
|
+
const issues = state.issues[deal.id] ?? [];
|
|
139
|
+
return /* @__PURE__ */ jsxs("li", { "data-slot": "deal-pipeline-deal", "data-value-status": deal.valueStatus, children: [
|
|
140
|
+
/* @__PURE__ */ jsxs("div", { "data-slot": "deal-pipeline-deal-head", children: [
|
|
141
|
+
/* @__PURE__ */ jsx("span", { "data-slot": "deal-pipeline-deal-name", children: deal.name }),
|
|
142
|
+
deal.company ? /* @__PURE__ */ jsx("span", { "data-slot": "deal-pipeline-deal-company", children: deal.company }) : null
|
|
143
|
+
] }),
|
|
144
|
+
/* @__PURE__ */ jsxs("p", { "data-slot": "deal-pipeline-deal-value", children: [
|
|
145
|
+
deal.valueMinor === null ? copy.noValue : money(deal.valueMinor, deal.currency),
|
|
146
|
+
/* @__PURE__ */ jsx("span", { "data-slot": "deal-pipeline-deal-status", "data-value-status": deal.valueStatus, children: copy.status[deal.valueStatus] })
|
|
147
|
+
] }),
|
|
148
|
+
deal.valueSource ? /* @__PURE__ */ jsx("p", { "data-slot": "deal-pipeline-deal-source", children: deal.valueSource }) : null,
|
|
149
|
+
/* @__PURE__ */ jsxs("p", { "data-slot": "deal-pipeline-deal-meta", children: [
|
|
150
|
+
deal.expectedClose ? `${copy.close} ${date(deal.expectedClose)}` : null,
|
|
151
|
+
deal.expectedClose && deal.ownerId ? " \xB7 " : null,
|
|
152
|
+
deal.ownerId ? `${copy.owner}: ${ownerName(deal.ownerId)}` : null
|
|
153
|
+
] }),
|
|
154
|
+
issues.length ? /* @__PURE__ */ jsx("ul", { "data-slot": "deal-pipeline-issues", children: issues.map((issue) => (
|
|
155
|
+
// The card names the deal; the sentence's id (often a UUID) reads as its name.
|
|
156
|
+
/* @__PURE__ */ jsx("li", { children: say(issue).replaceAll(`"${deal.id}"`, `"${deal.name}"`) }, issue)
|
|
157
|
+
)) }) : null,
|
|
158
|
+
column.outcome ? /* @__PURE__ */ jsxs("div", { "data-slot": "deal-pipeline-actions", children: [
|
|
159
|
+
/* @__PURE__ */ jsxs("span", { "data-slot": "deal-pipeline-closed", children: [
|
|
160
|
+
copy.outcome[column.outcome],
|
|
161
|
+
deal.closedBy ? ` \xB7 ${copy.closedBy} ${String(nameOf(deal.closedBy))}` : "",
|
|
162
|
+
deal.lostReason ? ` \xB7 ${deal.lostReason}` : ""
|
|
163
|
+
] }),
|
|
164
|
+
/* @__PURE__ */ jsx(
|
|
165
|
+
DealPipelineReopen,
|
|
166
|
+
{
|
|
167
|
+
value: buttonKey(deal.id, "reopen"),
|
|
168
|
+
"aria-label": `${copy.reopen}: ${deal.name}`,
|
|
169
|
+
children: copy.reopen
|
|
170
|
+
}
|
|
171
|
+
)
|
|
172
|
+
] }) : /* @__PURE__ */ jsxs("div", { "data-slot": "deal-pipeline-actions", children: [
|
|
173
|
+
/* @__PURE__ */ jsx(DealPipelineMove, { value: deal.id, "aria-label": `${copy.stage}: ${deal.name}`, children: open.map((stage) => /* @__PURE__ */ jsx("option", { value: stage.id, children: stage.name }, stage.id)) }),
|
|
174
|
+
/* @__PURE__ */ jsx(
|
|
175
|
+
DealPipelineWon,
|
|
176
|
+
{
|
|
177
|
+
value: buttonKey(deal.id, "won"),
|
|
178
|
+
"data-variant": "secondary",
|
|
179
|
+
"aria-label": `${copy.won}: ${deal.name}`,
|
|
180
|
+
children: copy.won
|
|
181
|
+
}
|
|
182
|
+
),
|
|
183
|
+
/* @__PURE__ */ jsxs("details", { "data-slot": "deal-pipeline-lost", children: [
|
|
184
|
+
/* @__PURE__ */ jsx("summary", { children: copy.lost }),
|
|
185
|
+
/* @__PURE__ */ jsx(
|
|
186
|
+
DealPipelineReason,
|
|
187
|
+
{
|
|
188
|
+
value: deal.id,
|
|
189
|
+
rows: 2,
|
|
190
|
+
"aria-label": `${copy.reason}: ${deal.name}`,
|
|
191
|
+
placeholder: copy.reason
|
|
192
|
+
}
|
|
193
|
+
),
|
|
194
|
+
/* @__PURE__ */ jsx(
|
|
195
|
+
DealPipelineLost,
|
|
196
|
+
{
|
|
197
|
+
value: buttonKey(deal.id, "lost"),
|
|
198
|
+
"aria-label": `${copy.lost}: ${deal.name}`,
|
|
199
|
+
children: copy.lost
|
|
200
|
+
}
|
|
201
|
+
)
|
|
202
|
+
] })
|
|
203
|
+
] })
|
|
204
|
+
] }, deal.id);
|
|
205
|
+
}) })
|
|
206
|
+
]
|
|
207
|
+
},
|
|
208
|
+
column.stageId
|
|
209
|
+
);
|
|
210
|
+
}) }),
|
|
211
|
+
state.refusal ? /* @__PURE__ */ jsx("p", { "data-slot": "deal-pipeline-error", role: "alert", children: say(state.refusal) }) : null
|
|
212
|
+
] });
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export {
|
|
219
|
+
dealPipeline,
|
|
220
|
+
DealPipelineRoot,
|
|
221
|
+
DealPipelineMove,
|
|
222
|
+
DealPipelineWon,
|
|
223
|
+
DealPipelineReason,
|
|
224
|
+
DealPipelineLost,
|
|
225
|
+
DealPipelineReopen,
|
|
226
|
+
DealPipeline
|
|
227
|
+
};
|
|
228
|
+
//# sourceMappingURL=chunk-PUMSFFEU.js.map
|