@layerfi/components 0.1.117 → 0.1.118
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/dist/cjs/index.cjs +457 -402
- package/dist/esm/index.mjs +458 -403
- package/dist/index.css +13 -12
- package/dist/index.d.ts +10 -6
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -57,11 +57,11 @@ const react = require("react");
|
|
|
57
57
|
const zustand = require("zustand");
|
|
58
58
|
const reactPlaidLink = require("react-plaid-link");
|
|
59
59
|
const dateFns = require("date-fns");
|
|
60
|
+
const effect = require("effect");
|
|
60
61
|
const date = require("@internationalized/date");
|
|
61
62
|
const useSWR = require("swr");
|
|
62
63
|
const classNames = require("classnames");
|
|
63
64
|
const index = require("effect/index");
|
|
64
|
-
const effect = require("effect");
|
|
65
65
|
const useSWRInfinite = require("swr/infinite");
|
|
66
66
|
const traditional = require("zustand/traditional");
|
|
67
67
|
const react$1 = require("@floating-ui/react");
|
|
@@ -149,6 +149,13 @@ function toSnakeCase(input) {
|
|
|
149
149
|
const segments = (_a = input.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)) != null ? _a : [];
|
|
150
150
|
return segments.map((segment) => segment.toLowerCase()).join("_");
|
|
151
151
|
}
|
|
152
|
+
effect.Schema.Union(
|
|
153
|
+
effect.Schema.Date,
|
|
154
|
+
effect.Schema.String,
|
|
155
|
+
effect.Schema.Array(effect.Schema.String),
|
|
156
|
+
effect.Schema.Number,
|
|
157
|
+
effect.Schema.Boolean
|
|
158
|
+
);
|
|
152
159
|
function toDefinedSearchParameters(input) {
|
|
153
160
|
const definedParameterPairs = Object.entries(input).flatMap(([key, value]) => {
|
|
154
161
|
if (value === null || value === void 0) {
|
|
@@ -202,7 +209,7 @@ class ErrorHandlerClass {
|
|
|
202
209
|
}
|
|
203
210
|
const errorHandler = new ErrorHandlerClass();
|
|
204
211
|
const reportError = (payload) => errorHandler.onError(payload);
|
|
205
|
-
const version = "0.1.
|
|
212
|
+
const version = "0.1.118";
|
|
206
213
|
const pkg = {
|
|
207
214
|
version
|
|
208
215
|
};
|
|
@@ -4632,10 +4639,6 @@ function clampToPresentOrPast(date2, cutoff = dateFns.endOfDay(/* @__PURE__ */ n
|
|
|
4632
4639
|
return dateFns.min([date2, cutoff]);
|
|
4633
4640
|
}
|
|
4634
4641
|
const RANGE_MODE_LOOKUP = {
|
|
4635
|
-
date: {
|
|
4636
|
-
getStartDate: ({ startDate }) => dateFns.startOfMonth(startDate),
|
|
4637
|
-
getEndDate: ({ endDate }) => clampToPresentOrPast(dateFns.endOfDay(endDate))
|
|
4638
|
-
},
|
|
4639
4642
|
full: {
|
|
4640
4643
|
getStartDate: ({ startDate }) => startDate,
|
|
4641
4644
|
getEndDate: ({ endDate }) => clampToPresentOrPast(dateFns.endOfDay(endDate))
|
|
@@ -4662,8 +4665,8 @@ function buildStore$2() {
|
|
|
4662
4665
|
return next;
|
|
4663
4666
|
};
|
|
4664
4667
|
const setDate = ({ date: date2 }) => {
|
|
4665
|
-
const s = RANGE_MODE_LOOKUP.
|
|
4666
|
-
const e = RANGE_MODE_LOOKUP.
|
|
4668
|
+
const s = RANGE_MODE_LOOKUP.month.getStartDate({ startDate: date2 });
|
|
4669
|
+
const e = RANGE_MODE_LOOKUP.full.getEndDate({ endDate: date2 });
|
|
4667
4670
|
return apply2({ startDate: s, endDate: e });
|
|
4668
4671
|
};
|
|
4669
4672
|
const setDateRange = withCorrectedRange(({ startDate, endDate }) => {
|
|
@@ -4676,30 +4679,11 @@ function buildStore$2() {
|
|
|
4676
4679
|
const e = RANGE_MODE_LOOKUP.month.getEndDate({ endDate: startDate });
|
|
4677
4680
|
return apply2({ startDate: s, endDate: e });
|
|
4678
4681
|
};
|
|
4679
|
-
const setRangeWithExplicitDisplayMode = ({
|
|
4680
|
-
startDate,
|
|
4681
|
-
endDate,
|
|
4682
|
-
displayMode
|
|
4683
|
-
}) => {
|
|
4684
|
-
switch (displayMode) {
|
|
4685
|
-
case "date":
|
|
4686
|
-
return setDate({ date: endDate });
|
|
4687
|
-
case "full":
|
|
4688
|
-
return setDateRange({ startDate, endDate });
|
|
4689
|
-
case "month":
|
|
4690
|
-
return setMonth({ startDate });
|
|
4691
|
-
default:
|
|
4692
|
-
unsafeAssertUnreachable({
|
|
4693
|
-
message: "Invalid `displayMode`"
|
|
4694
|
-
});
|
|
4695
|
-
}
|
|
4696
|
-
};
|
|
4697
4682
|
return {
|
|
4698
4683
|
startDate: dateFns.startOfMonth(now2),
|
|
4699
4684
|
endDate: clampToPresentOrPast(dateFns.endOfMonth(now2)),
|
|
4700
4685
|
actions: {
|
|
4701
4686
|
setDate,
|
|
4702
|
-
setRangeWithExplicitDisplayMode,
|
|
4703
4687
|
setDateRange,
|
|
4704
4688
|
setMonth,
|
|
4705
4689
|
setMonthByPeriod: ({ monthNumber, yearNumber }) => {
|
|
@@ -4711,10 +4695,17 @@ function buildStore$2() {
|
|
|
4711
4695
|
});
|
|
4712
4696
|
}
|
|
4713
4697
|
const GlobalDateStoreContext = react.createContext(buildStore$2());
|
|
4714
|
-
|
|
4698
|
+
const getEffectiveDateForMode = (mode, { date: date2 }) => {
|
|
4699
|
+
const rangeModifierForMode = RANGE_MODE_LOOKUP[mode];
|
|
4700
|
+
return { date: rangeModifierForMode.getEndDate({ endDate: date2 }) };
|
|
4701
|
+
};
|
|
4702
|
+
function useGlobalDate({ dateSelectionMode = "full" } = {}) {
|
|
4715
4703
|
const store = react.useContext(GlobalDateStoreContext);
|
|
4716
|
-
const
|
|
4717
|
-
return
|
|
4704
|
+
const rawDate = useStoreWithDateSelected(store, ({ endDate }) => endDate);
|
|
4705
|
+
return react.useMemo(
|
|
4706
|
+
() => getEffectiveDateForMode(dateSelectionMode, { date: rawDate }),
|
|
4707
|
+
[dateSelectionMode, rawDate]
|
|
4708
|
+
);
|
|
4718
4709
|
}
|
|
4719
4710
|
function useGlobalDateActions() {
|
|
4720
4711
|
const store = react.useContext(GlobalDateStoreContext);
|
|
@@ -4728,28 +4719,23 @@ const getEffectiveDateRangeForMode = (mode, { startDate, endDate }) => {
|
|
|
4728
4719
|
endDate: rangeModifierForMode.getEndDate({ endDate })
|
|
4729
4720
|
};
|
|
4730
4721
|
};
|
|
4731
|
-
function useGlobalDateRange({
|
|
4722
|
+
function useGlobalDateRange({ dateSelectionMode }) {
|
|
4732
4723
|
const store = react.useContext(GlobalDateStoreContext);
|
|
4733
4724
|
const rawStartDate = useStoreWithDateSelected(store, ({ startDate }) => startDate);
|
|
4734
4725
|
const rawEndDate = useStoreWithDateSelected(store, ({ endDate }) => endDate);
|
|
4735
4726
|
return react.useMemo(
|
|
4736
4727
|
() => getEffectiveDateRangeForMode(
|
|
4737
|
-
|
|
4728
|
+
dateSelectionMode,
|
|
4738
4729
|
{ startDate: rawStartDate, endDate: rawEndDate }
|
|
4739
4730
|
),
|
|
4740
|
-
[
|
|
4731
|
+
[dateSelectionMode, rawEndDate, rawStartDate]
|
|
4741
4732
|
);
|
|
4742
4733
|
}
|
|
4743
4734
|
function useGlobalDateRangeActions() {
|
|
4744
4735
|
const store = react.useContext(GlobalDateStoreContext);
|
|
4745
|
-
const setRangeWithExplicitDisplayMode = zustand.useStore(
|
|
4746
|
-
store,
|
|
4747
|
-
({ actions: { setRangeWithExplicitDisplayMode: setRangeWithExplicitDisplayMode2 } }) => setRangeWithExplicitDisplayMode2
|
|
4748
|
-
);
|
|
4749
4736
|
const setDateRange = zustand.useStore(store, ({ actions: { setDateRange: setDateRange2 } }) => setDateRange2);
|
|
4750
4737
|
const setMonth = zustand.useStore(store, ({ actions: { setMonth: setMonth2 } }) => setMonth2);
|
|
4751
4738
|
return {
|
|
4752
|
-
setRangeWithExplicitDisplayMode,
|
|
4753
4739
|
setDateRange,
|
|
4754
4740
|
setMonth
|
|
4755
4741
|
};
|
|
@@ -4767,7 +4753,7 @@ function GlobalDateStoreProvider({
|
|
|
4767
4753
|
}
|
|
4768
4754
|
const useBankTransactionsFilters = (params) => {
|
|
4769
4755
|
const dateFilterMode = (params == null ? void 0 : params.applyGlobalDateRange) ? BankTransactionsDateFilterMode.GlobalDateRange : (params == null ? void 0 : params.monthlyView) ? BankTransactionsDateFilterMode.MonthlyView : void 0;
|
|
4770
|
-
const globalDateRange = useGlobalDateRange({
|
|
4756
|
+
const globalDateRange = useGlobalDateRange({ dateSelectionMode: "full" });
|
|
4771
4757
|
const defaultDateRange = {
|
|
4772
4758
|
startDate: dateFns.startOfMonth(/* @__PURE__ */ new Date()),
|
|
4773
4759
|
endDate: dateFns.endOfMonth(/* @__PURE__ */ new Date())
|
|
@@ -12754,6 +12740,10 @@ const InvoicePaymentLedgerEntrySourceSchema = effect.Schema.Struct({
|
|
|
12754
12740
|
effect.Schema.propertySignature(effect.Schema.String),
|
|
12755
12741
|
effect.Schema.fromKey("invoice_id")
|
|
12756
12742
|
),
|
|
12743
|
+
invoicePaymentId: effect.pipe(
|
|
12744
|
+
effect.Schema.propertySignature(effect.Schema.String),
|
|
12745
|
+
effect.Schema.fromKey("invoice_payment_id")
|
|
12746
|
+
),
|
|
12757
12747
|
invoiceNumber: effect.pipe(
|
|
12758
12748
|
effect.Schema.propertySignature(effect.Schema.NullOr(effect.Schema.String)),
|
|
12759
12749
|
effect.Schema.fromKey("invoice_number")
|
|
@@ -13216,6 +13206,10 @@ const BillPaymentLedgerEntrySourceSchema = effect.Schema.Struct({
|
|
|
13216
13206
|
effect.Schema.optional(effect.Schema.NullOr(effect.Schema.String)),
|
|
13217
13207
|
effect.Schema.fromKey("external_id")
|
|
13218
13208
|
),
|
|
13209
|
+
billPaymentId: effect.pipe(
|
|
13210
|
+
effect.Schema.propertySignature(effect.Schema.String),
|
|
13211
|
+
effect.Schema.fromKey("bill_payment_id")
|
|
13212
|
+
),
|
|
13219
13213
|
billId: effect.pipe(
|
|
13220
13214
|
effect.Schema.propertySignature(effect.Schema.String),
|
|
13221
13215
|
effect.Schema.fromKey("bill_id")
|
|
@@ -13341,7 +13335,7 @@ const convertLedgerEntrySourceToLinkingMetadata = (ledgerEntrySource) => {
|
|
|
13341
13335
|
baseMetadata.id = ledgerEntrySource.manualEntryId;
|
|
13342
13336
|
break;
|
|
13343
13337
|
case "Invoice_Payment_Ledger_Entry_Source":
|
|
13344
|
-
baseMetadata.id = ledgerEntrySource.
|
|
13338
|
+
baseMetadata.id = ledgerEntrySource.invoicePaymentId;
|
|
13345
13339
|
baseMetadata.entityName = EntityName.InvoicePayment;
|
|
13346
13340
|
if (ledgerEntrySource.invoiceIdentifiers) {
|
|
13347
13341
|
baseMetadata.relatedEntityLinkingMetadata = ledgerEntrySource.invoiceIdentifiers.map((identifier) => ({
|
|
@@ -13447,7 +13441,7 @@ const convertLedgerEntrySourceToLinkingMetadata = (ledgerEntrySource) => {
|
|
|
13447
13441
|
baseMetadata.entityName = EntityName.Bill;
|
|
13448
13442
|
break;
|
|
13449
13443
|
case "Bill_Payment_Ledger_Entry_Source":
|
|
13450
|
-
baseMetadata.id = ledgerEntrySource.
|
|
13444
|
+
baseMetadata.id = ledgerEntrySource.billPaymentId;
|
|
13451
13445
|
baseMetadata.entityName = EntityName.BillPayment;
|
|
13452
13446
|
if (ledgerEntrySource.billIdentifiers) {
|
|
13453
13447
|
baseMetadata.relatedEntityLinkingMetadata = ledgerEntrySource.billIdentifiers.map((identifier) => ({
|
|
@@ -14182,11 +14176,13 @@ const CSS_PREFIX$1 = "Layer__UI__Table";
|
|
|
14182
14176
|
const getClassName = (component, additionalClassNames, withHidden) => classNames(`${CSS_PREFIX$1}-${component}`, withHidden && `${CSS_PREFIX$1}-${component}--hidden`, additionalClassNames);
|
|
14183
14177
|
const Table$1 = react.forwardRef(
|
|
14184
14178
|
(_rb, ref) => {
|
|
14185
|
-
var _sb = _rb, { children, className } = _sb, restProps = __objRest(_sb, ["children", "className"]);
|
|
14179
|
+
var _sb = _rb, { children, className, nonAria, slot } = _sb, restProps = __objRest(_sb, ["children", "className", "nonAria", "slot"]);
|
|
14180
|
+
const TableComponent = nonAria ? "table" : reactAriaComponents.Table;
|
|
14186
14181
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14187
|
-
|
|
14182
|
+
TableComponent,
|
|
14188
14183
|
__spreadProps(__spreadValues({
|
|
14189
|
-
className: getClassName("Table", className)
|
|
14184
|
+
className: getClassName("Table", className),
|
|
14185
|
+
slot: slot != null ? slot : void 0
|
|
14190
14186
|
}, restProps), {
|
|
14191
14187
|
ref,
|
|
14192
14188
|
children
|
|
@@ -14196,9 +14192,10 @@ const Table$1 = react.forwardRef(
|
|
|
14196
14192
|
);
|
|
14197
14193
|
Table$1.displayName = "Table";
|
|
14198
14194
|
const TableHeaderInner = (_tb, ref) => {
|
|
14199
|
-
var _ub = _tb, { children, className, hideHeader } = _ub, restProps = __objRest(_ub, ["children", "className", "hideHeader"]);
|
|
14195
|
+
var _ub = _tb, { children, className, hideHeader, nonAria } = _ub, restProps = __objRest(_ub, ["children", "className", "hideHeader", "nonAria"]);
|
|
14196
|
+
const TableHeaderComponent = nonAria ? "thead" : reactAriaComponents.TableHeader;
|
|
14200
14197
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14201
|
-
|
|
14198
|
+
TableHeaderComponent,
|
|
14202
14199
|
__spreadProps(__spreadValues({
|
|
14203
14200
|
className: getClassName("TableHeader", className, hideHeader)
|
|
14204
14201
|
}, restProps), {
|
|
@@ -14210,9 +14207,10 @@ const TableHeaderInner = (_tb, ref) => {
|
|
|
14210
14207
|
const TableHeader = react.forwardRef(TableHeaderInner);
|
|
14211
14208
|
TableHeader.displayName = "TableHeader";
|
|
14212
14209
|
const TableBodyInner = (_vb, ref) => {
|
|
14213
|
-
var _wb = _vb, { children, className } = _wb, restProps = __objRest(_wb, ["children", "className"]);
|
|
14210
|
+
var _wb = _vb, { children, className, nonAria } = _wb, restProps = __objRest(_wb, ["children", "className", "nonAria"]);
|
|
14211
|
+
const TableBodyComponent = nonAria ? "tbody" : reactAriaComponents.TableBody;
|
|
14214
14212
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14215
|
-
|
|
14213
|
+
TableBodyComponent,
|
|
14216
14214
|
__spreadProps(__spreadValues({
|
|
14217
14215
|
className: getClassName("TableBody", className)
|
|
14218
14216
|
}, restProps), {
|
|
@@ -14224,14 +14222,16 @@ const TableBodyInner = (_vb, ref) => {
|
|
|
14224
14222
|
const TableBody$1 = react.forwardRef(TableBodyInner);
|
|
14225
14223
|
TableBody$1.displayName = "TableBody";
|
|
14226
14224
|
const RowInner = (_xb, ref) => {
|
|
14227
|
-
var _yb = _xb, { children, className, depth = 0 } = _yb, restProps = __objRest(_yb, ["children", "className", "depth"]);
|
|
14225
|
+
var _yb = _xb, { children, className, depth = 0, nonAria, id } = _yb, restProps = __objRest(_yb, ["children", "className", "depth", "nonAria", "id"]);
|
|
14228
14226
|
const dataProperties = toDataProperties({ depth });
|
|
14227
|
+
const RowComponent = nonAria ? "tr" : reactAriaComponents.Row;
|
|
14229
14228
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14230
|
-
|
|
14229
|
+
RowComponent,
|
|
14231
14230
|
__spreadProps(__spreadValues(__spreadValues({
|
|
14232
14231
|
className: getClassName("Row", className)
|
|
14233
14232
|
}, restProps), dataProperties), {
|
|
14234
14233
|
ref,
|
|
14234
|
+
id: id == null ? void 0 : id.toString(),
|
|
14235
14235
|
children: withRenderProp(children, (node) => node)
|
|
14236
14236
|
})
|
|
14237
14237
|
);
|
|
@@ -14240,14 +14240,18 @@ const Row = react.forwardRef(RowInner);
|
|
|
14240
14240
|
Row.displayName = "Row";
|
|
14241
14241
|
const Column = react.forwardRef(
|
|
14242
14242
|
(_zb, ref) => {
|
|
14243
|
-
var _Ab = _zb, { children, className, textAlign = "left" } = _Ab, restProps = __objRest(_Ab, ["children", "className", "textAlign"]);
|
|
14243
|
+
var _Ab = _zb, { children, className, nonAria, id, textAlign = "left", colSpan = 1 } = _Ab, restProps = __objRest(_Ab, ["children", "className", "nonAria", "id", "textAlign", "colSpan"]);
|
|
14244
14244
|
const dataProperties = toDataProperties({ "text-align": textAlign });
|
|
14245
|
+
const columnClassName = getClassName("Column", className);
|
|
14246
|
+
const ColumnComponent = nonAria ? "th" : reactAriaComponents.Column;
|
|
14245
14247
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14246
|
-
|
|
14248
|
+
ColumnComponent,
|
|
14247
14249
|
__spreadProps(__spreadValues(__spreadValues({
|
|
14248
|
-
className:
|
|
14250
|
+
className: columnClassName
|
|
14249
14251
|
}, restProps), dataProperties), {
|
|
14250
14252
|
ref,
|
|
14253
|
+
id: id == null ? void 0 : id.toString(),
|
|
14254
|
+
colSpan,
|
|
14251
14255
|
children: withRenderProp(children, (node) => node)
|
|
14252
14256
|
})
|
|
14253
14257
|
);
|
|
@@ -14256,19 +14260,44 @@ const Column = react.forwardRef(
|
|
|
14256
14260
|
Column.displayName = "Column";
|
|
14257
14261
|
const Cell = react.forwardRef(
|
|
14258
14262
|
(_Bb, ref) => {
|
|
14259
|
-
var _Cb = _Bb, { children, className } = _Cb, restProps = __objRest(_Cb, ["children", "className"]);
|
|
14263
|
+
var _Cb = _Bb, { children, className, nonAria, id } = _Cb, restProps = __objRest(_Cb, ["children", "className", "nonAria", "id"]);
|
|
14264
|
+
const CellComponent = nonAria ? "td" : reactAriaComponents.Cell;
|
|
14260
14265
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14261
|
-
|
|
14266
|
+
CellComponent,
|
|
14262
14267
|
__spreadProps(__spreadValues({
|
|
14263
14268
|
className: getClassName("Cell", className)
|
|
14264
14269
|
}, restProps), {
|
|
14265
14270
|
ref,
|
|
14271
|
+
id: id == null ? void 0 : id.toString(),
|
|
14266
14272
|
children: withRenderProp(children, (node) => node)
|
|
14267
14273
|
})
|
|
14268
14274
|
);
|
|
14269
14275
|
}
|
|
14270
14276
|
);
|
|
14271
14277
|
Cell.displayName = "Cell";
|
|
14278
|
+
const isLeafColumn = (col) => {
|
|
14279
|
+
return "cell" in col;
|
|
14280
|
+
};
|
|
14281
|
+
const getColumnDefs = (columnConfig) => {
|
|
14282
|
+
const columnHelper = reactTable.createColumnHelper();
|
|
14283
|
+
return columnConfig.map((col) => {
|
|
14284
|
+
if (isLeafColumn(col)) {
|
|
14285
|
+
return columnHelper.display({
|
|
14286
|
+
id: col.id,
|
|
14287
|
+
header: () => col.header,
|
|
14288
|
+
cell: ({ row }) => col.cell(row),
|
|
14289
|
+
meta: {
|
|
14290
|
+
isRowHeader: col.isRowHeader || false
|
|
14291
|
+
}
|
|
14292
|
+
});
|
|
14293
|
+
}
|
|
14294
|
+
return columnHelper.group({
|
|
14295
|
+
id: col.id,
|
|
14296
|
+
header: () => col.header,
|
|
14297
|
+
columns: getColumnDefs(col.columns)
|
|
14298
|
+
});
|
|
14299
|
+
});
|
|
14300
|
+
};
|
|
14272
14301
|
const Loader = ({ children, size = 28 }) => {
|
|
14273
14302
|
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "Layer__loader", children: [
|
|
14274
14303
|
/* @__PURE__ */ jsxRuntime.jsx(Loader$1, { size, className: "Layer__anim--rotating" }),
|
|
@@ -14304,19 +14333,8 @@ const VirtualizedDataTable = ({
|
|
|
14304
14333
|
const calculatedHeight = actualRowCount * rowHeight + HEADER_HEIGHT + 1;
|
|
14305
14334
|
return Math.min(height, calculatedHeight);
|
|
14306
14335
|
}, [data, height, rowHeight, shrinkHeightToFitRows]);
|
|
14307
|
-
const columnHelper = reactTable.createColumnHelper();
|
|
14308
|
-
const columns = Object.values(columnConfig);
|
|
14309
14336
|
const tableData = data != null ? data : EMPTY_ARRAY$2;
|
|
14310
|
-
const columnDefs =
|
|
14311
|
-
return columnHelper.display({
|
|
14312
|
-
id: col.id,
|
|
14313
|
-
header: () => col.header,
|
|
14314
|
-
cell: ({ row }) => col.cell(row.original),
|
|
14315
|
-
meta: {
|
|
14316
|
-
isRowHeader: col.isRowHeader || false
|
|
14317
|
-
}
|
|
14318
|
-
});
|
|
14319
|
-
});
|
|
14337
|
+
const columnDefs = getColumnDefs(columnConfig);
|
|
14320
14338
|
const table2 = reactTable.useReactTable({
|
|
14321
14339
|
data: tableData,
|
|
14322
14340
|
columns: columnDefs,
|
|
@@ -14414,43 +14432,34 @@ const AffectedTransactionsTable = ({
|
|
|
14414
14432
|
isLoading = false,
|
|
14415
14433
|
isError = false
|
|
14416
14434
|
}) => {
|
|
14417
|
-
const columnConfig = react.useMemo(() =>
|
|
14418
|
-
|
|
14419
|
-
"Date"
|
|
14420
|
-
/* Date */
|
|
14421
|
-
]: {
|
|
14435
|
+
const columnConfig = react.useMemo(() => [
|
|
14436
|
+
{
|
|
14422
14437
|
id: "Date",
|
|
14423
14438
|
header: "Date",
|
|
14424
14439
|
cell: (row) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
14425
14440
|
DateTime,
|
|
14426
14441
|
{
|
|
14427
|
-
valueAsDate: row.date,
|
|
14442
|
+
valueAsDate: row.original.date,
|
|
14428
14443
|
onlyDate: true,
|
|
14429
14444
|
slotProps: { Date: { size: TextSize.md, weight: TextWeight.normal, variant: "subtle" } }
|
|
14430
14445
|
}
|
|
14431
14446
|
)
|
|
14432
14447
|
},
|
|
14433
|
-
|
|
14434
|
-
"Description"
|
|
14435
|
-
/* Description */
|
|
14436
|
-
]: {
|
|
14448
|
+
{
|
|
14437
14449
|
id: "Description",
|
|
14438
14450
|
header: "Description",
|
|
14439
|
-
cell: (row) => /* @__PURE__ */ jsxRuntime.jsx(Span, { withTooltip: true, children: row.counterpartyName || row.description || "-" }),
|
|
14451
|
+
cell: (row) => /* @__PURE__ */ jsxRuntime.jsx(Span, { withTooltip: true, children: row.original.counterpartyName || row.original.description || "-" }),
|
|
14440
14452
|
isRowHeader: true
|
|
14441
14453
|
},
|
|
14442
|
-
|
|
14443
|
-
"Amount"
|
|
14444
|
-
/* Amount */
|
|
14445
|
-
]: {
|
|
14454
|
+
{
|
|
14446
14455
|
id: "Amount",
|
|
14447
14456
|
header: "Amount",
|
|
14448
14457
|
cell: (row) => {
|
|
14449
|
-
const amount = row.direction === BankTransactionDirection.Credit ? row.amount : -row.amount;
|
|
14458
|
+
const amount = row.original.direction === BankTransactionDirection.Credit ? row.original.amount : -row.original.amount;
|
|
14450
14459
|
return /* @__PURE__ */ jsxRuntime.jsx(MoneySpan, { amount });
|
|
14451
14460
|
}
|
|
14452
14461
|
}
|
|
14453
|
-
|
|
14462
|
+
], []);
|
|
14454
14463
|
return /* @__PURE__ */ jsxRuntime.jsx(VStack, { className: "Layer__AffectedTransactionsTable", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
14455
14464
|
VirtualizedDataTable,
|
|
14456
14465
|
{
|
|
@@ -17826,7 +17835,7 @@ const ExpandedBankTransactionRow = ({
|
|
|
17826
17835
|
className: `${className} ${className}--${isOpen ? "expanded" : "collapsed"}`,
|
|
17827
17836
|
children: isOpen && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
17828
17837
|
/* @__PURE__ */ jsxRuntime.jsx(Separator, {}),
|
|
17829
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: `${className}__wrapper`, ref: bodyRef, children: /* @__PURE__ */ jsxRuntime.jsxs(VStack, { pis: variant === "row" ? "md" : void 0, pbs: "sm", children: [
|
|
17838
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: `${className}__wrapper`, ref: bodyRef, children: /* @__PURE__ */ jsxRuntime.jsxs(VStack, { pis: variant === "row" ? "md" : void 0, pbs: "sm", pbe: "md", children: [
|
|
17830
17839
|
categorizationEnabled && /* @__PURE__ */ jsxRuntime.jsx(HStack, { pi: "md", pbe: "md", pbs: "3xs", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
17831
17840
|
Toggle,
|
|
17832
17841
|
{
|
|
@@ -18484,7 +18493,7 @@ const BankTransactionsListItem = ({
|
|
|
18484
18493
|
onValidityChange: setIsExpandedRowValid
|
|
18485
18494
|
}
|
|
18486
18495
|
) }, `expanded-${bankTransaction.id}`) }),
|
|
18487
|
-
categorizationEnabled && !displayAsCategorized && /* @__PURE__ */ jsxRuntime.jsx("div", { onClick: preventRowExpansion, children: /* @__PURE__ */ jsxRuntime.jsxs(HStack, { pi: "md", gap: "md",
|
|
18496
|
+
categorizationEnabled && !displayAsCategorized && /* @__PURE__ */ jsxRuntime.jsx("div", { onClick: preventRowExpansion, children: /* @__PURE__ */ jsxRuntime.jsxs(HStack, { pi: "md", gap: "md", pbe: "md", justify: "end", children: [
|
|
18488
18497
|
!openExpandedRow && /* @__PURE__ */ jsxRuntime.jsx(
|
|
18489
18498
|
BankTransactionCategoryComboBox,
|
|
18490
18499
|
{
|
|
@@ -18953,20 +18962,37 @@ const BankTransactionsMobileListBusinessForm = ({
|
|
|
18953
18962
|
)
|
|
18954
18963
|
] });
|
|
18955
18964
|
};
|
|
18956
|
-
var
|
|
18957
|
-
|
|
18958
|
-
|
|
18959
|
-
return
|
|
18960
|
-
})(
|
|
18965
|
+
var PersonalStableName = /* @__PURE__ */ ((PersonalStableName2) => {
|
|
18966
|
+
PersonalStableName2["CREDIT"] = "CONTRIBUTIONS";
|
|
18967
|
+
PersonalStableName2["DEBIT"] = "PERSONAL_EXPENSES";
|
|
18968
|
+
return PersonalStableName2;
|
|
18969
|
+
})(PersonalStableName || {});
|
|
18970
|
+
var LegacyPersonalCategories = /* @__PURE__ */ ((LegacyPersonalCategories2) => {
|
|
18971
|
+
LegacyPersonalCategories2["INCOME"] = "PERSONAL_INFLOWS";
|
|
18972
|
+
LegacyPersonalCategories2["EXPENSES"] = "PERSONAL_EXPENSES";
|
|
18973
|
+
return LegacyPersonalCategories2;
|
|
18974
|
+
})(LegacyPersonalCategories || {});
|
|
18961
18975
|
const isAlreadyAssigned = (bankTransaction) => {
|
|
18962
18976
|
if (bankTransaction.categorization_status === CategorizationStatus.MATCHED || (bankTransaction == null ? void 0 : bankTransaction.categorization_status) === CategorizationStatus.SPLIT) {
|
|
18963
18977
|
return false;
|
|
18964
18978
|
}
|
|
18965
|
-
|
|
18966
|
-
|
|
18967
|
-
|
|
18968
|
-
|
|
18969
|
-
)
|
|
18979
|
+
if (!bankTransaction.category) {
|
|
18980
|
+
return false;
|
|
18981
|
+
}
|
|
18982
|
+
const category = bankTransaction.category;
|
|
18983
|
+
if (category.type === "Account" && "stable_name" in category) {
|
|
18984
|
+
const stableName = category.stable_name;
|
|
18985
|
+
if (stableName === PersonalStableName.CREDIT || stableName === PersonalStableName.DEBIT) {
|
|
18986
|
+
return true;
|
|
18987
|
+
}
|
|
18988
|
+
}
|
|
18989
|
+
if (category.type === "Exclusion") {
|
|
18990
|
+
const displayName = category.display_name;
|
|
18991
|
+
if (Object.values(LegacyPersonalCategories).includes(displayName)) {
|
|
18992
|
+
return true;
|
|
18993
|
+
}
|
|
18994
|
+
}
|
|
18995
|
+
return false;
|
|
18970
18996
|
};
|
|
18971
18997
|
const BankTransactionsMobileListPersonalForm = ({
|
|
18972
18998
|
bankTransaction,
|
|
@@ -18995,8 +19021,8 @@ const BankTransactionsMobileListPersonalForm = ({
|
|
|
18995
19021
|
{
|
|
18996
19022
|
type: "Category",
|
|
18997
19023
|
category: {
|
|
18998
|
-
type: "
|
|
18999
|
-
|
|
19024
|
+
type: "StableName",
|
|
19025
|
+
stableName: isCredit(bankTransaction) ? PersonalStableName.CREDIT : PersonalStableName.DEBIT
|
|
19000
19026
|
}
|
|
19001
19027
|
},
|
|
19002
19028
|
true
|
|
@@ -19534,9 +19560,24 @@ const BankTransactionsMobileListItemExpandedRow = ({
|
|
|
19534
19560
|
)
|
|
19535
19561
|
] });
|
|
19536
19562
|
};
|
|
19563
|
+
const isPersonalCategory = (category) => {
|
|
19564
|
+
if (!category) {
|
|
19565
|
+
return false;
|
|
19566
|
+
}
|
|
19567
|
+
if (category.type === "Account" && "stable_name" in category) {
|
|
19568
|
+
const stableName = category.stable_name;
|
|
19569
|
+
if (stableName === PersonalStableName.CREDIT || stableName === PersonalStableName.DEBIT) {
|
|
19570
|
+
return true;
|
|
19571
|
+
}
|
|
19572
|
+
}
|
|
19573
|
+
if (category.type === "Exclusion") {
|
|
19574
|
+
return true;
|
|
19575
|
+
}
|
|
19576
|
+
return false;
|
|
19577
|
+
};
|
|
19537
19578
|
const getInitialPurpose = (bankTransaction) => {
|
|
19538
19579
|
if (bankTransaction.category) {
|
|
19539
|
-
if (bankTransaction.category
|
|
19580
|
+
if (isPersonalCategory(bankTransaction.category)) {
|
|
19540
19581
|
return Purpose.personal;
|
|
19541
19582
|
}
|
|
19542
19583
|
if (bankTransaction.categorization_status === CategorizationStatus.SPLIT) {
|
|
@@ -20069,43 +20110,56 @@ function useArchiveCategorizationRule() {
|
|
|
20069
20110
|
});
|
|
20070
20111
|
}
|
|
20071
20112
|
const DataTable = ({
|
|
20072
|
-
columnConfig,
|
|
20073
|
-
data,
|
|
20074
20113
|
isLoading,
|
|
20075
20114
|
isError,
|
|
20076
20115
|
componentName,
|
|
20077
20116
|
ariaLabel,
|
|
20078
20117
|
slots,
|
|
20079
20118
|
hideHeader,
|
|
20080
|
-
dependencies
|
|
20119
|
+
dependencies,
|
|
20120
|
+
data,
|
|
20121
|
+
headerGroups,
|
|
20122
|
+
numColumns
|
|
20081
20123
|
}) => {
|
|
20082
|
-
const
|
|
20124
|
+
const nonAria = headerGroups.length > 1;
|
|
20083
20125
|
const { EmptyState: EmptyState2, ErrorState: ErrorState2 } = slots;
|
|
20084
20126
|
const isEmptyTable = (data == null ? void 0 : data.length) === 0;
|
|
20085
20127
|
const renderTableBody = react.useMemo(() => {
|
|
20086
20128
|
if (isError) {
|
|
20087
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Row, { className: "Layer__DataTable__EmptyState__Row", children: /* @__PURE__ */ jsxRuntime.jsx(Cell, { className: "Layer__DataTable__EmptyState__Cell", colSpan:
|
|
20129
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Row, { className: "Layer__DataTable__EmptyState__Row", nonAria, children: /* @__PURE__ */ jsxRuntime.jsx(Cell, { className: "Layer__DataTable__EmptyState__Cell", colSpan: numColumns, nonAria, children: /* @__PURE__ */ jsxRuntime.jsx(ErrorState2, {}) }) });
|
|
20088
20130
|
}
|
|
20089
20131
|
if (isLoading) {
|
|
20090
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Row, { className: "Layer__DataTable__EmptyState__Row", children: /* @__PURE__ */ jsxRuntime.jsx(Cell, { className: "Layer__DataTable__EmptyState__Cell", colSpan:
|
|
20132
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Row, { className: "Layer__DataTable__EmptyState__Row", nonAria, children: /* @__PURE__ */ jsxRuntime.jsx(Cell, { className: "Layer__DataTable__EmptyState__Cell", colSpan: numColumns, nonAria, children: /* @__PURE__ */ jsxRuntime.jsx(Loader, {}) }) });
|
|
20091
20133
|
}
|
|
20092
20134
|
if (isEmptyTable) {
|
|
20093
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Row, { className: "Layer__DataTable__EmptyState__Row", children: /* @__PURE__ */ jsxRuntime.jsx(Cell, { className: "Layer__DataTable__EmptyState__Cell", colSpan:
|
|
20135
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Row, { className: "Layer__DataTable__EmptyState__Row", nonAria, children: /* @__PURE__ */ jsxRuntime.jsx(Cell, { className: "Layer__DataTable__EmptyState__Cell", colSpan: numColumns, nonAria, children: /* @__PURE__ */ jsxRuntime.jsx(EmptyState2, {}) }) });
|
|
20094
20136
|
}
|
|
20095
|
-
|
|
20137
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: data == null ? void 0 : data.map((row) => /* @__PURE__ */ jsxRuntime.jsx(Row, { depth: row.depth, nonAria, children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
20096
20138
|
Cell,
|
|
20097
20139
|
{
|
|
20098
|
-
className: `Layer__UI__Table-Cell__${componentName}--${
|
|
20099
|
-
|
|
20140
|
+
className: `Layer__UI__Table-Cell__${componentName}--${cell.column.id}`,
|
|
20141
|
+
nonAria,
|
|
20142
|
+
children: reactTable.flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
20100
20143
|
},
|
|
20101
|
-
`${row.id}-${
|
|
20102
|
-
)) }, row.id);
|
|
20103
|
-
|
|
20104
|
-
|
|
20105
|
-
|
|
20106
|
-
|
|
20107
|
-
|
|
20108
|
-
|
|
20144
|
+
`${row.id}-${cell.id}`
|
|
20145
|
+
)) }, row.id)) });
|
|
20146
|
+
}, [isError, isLoading, isEmptyTable, data, nonAria, numColumns, ErrorState2, EmptyState2, componentName]);
|
|
20147
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Table$1, { "aria-label": ariaLabel, className: `Layer__UI__Table__${componentName}`, nonAria, children: [
|
|
20148
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableHeader, { hideHeader, nonAria, children: headerGroups.map((headerGroup) => /* @__PURE__ */ jsxRuntime.jsx(Row, { nonAria, children: headerGroup.headers.map((header) => {
|
|
20149
|
+
var _a;
|
|
20150
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
20151
|
+
Column,
|
|
20152
|
+
{
|
|
20153
|
+
isRowHeader: (_a = header.column.columnDef.meta) == null ? void 0 : _a.isRowHeader,
|
|
20154
|
+
className: `Layer__UI__Table-Column__${componentName}--${header.id}`,
|
|
20155
|
+
nonAria,
|
|
20156
|
+
colSpan: header.colSpan,
|
|
20157
|
+
children: header.isPlaceholder ? null : typeof header.column.columnDef.header === "function" ? header.column.columnDef.header(header.getContext()) : header.column.columnDef.header
|
|
20158
|
+
},
|
|
20159
|
+
header.id
|
|
20160
|
+
);
|
|
20161
|
+
}) }, headerGroup.id)) }),
|
|
20162
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableBody$1, { dependencies, nonAria, children: renderTableBody })
|
|
20109
20163
|
] });
|
|
20110
20164
|
};
|
|
20111
20165
|
var Dots = /* @__PURE__ */ ((Dots2) => {
|
|
@@ -20259,15 +20313,7 @@ function PaginatedTable({
|
|
|
20259
20313
|
var _a;
|
|
20260
20314
|
const { pageSize = 20, hasMore, fetchMore, initialPage = 0, onSetPage, autoResetPageIndexRef } = paginationProps;
|
|
20261
20315
|
const [pagination, setPagination] = react.useState({ pageIndex: initialPage, pageSize });
|
|
20262
|
-
const
|
|
20263
|
-
const columns = Object.values(columnConfig);
|
|
20264
|
-
const columnDefs = columns.map((col) => {
|
|
20265
|
-
return columnHelper.display({
|
|
20266
|
-
id: col.id,
|
|
20267
|
-
header: () => col.header,
|
|
20268
|
-
cell: ({ row }) => col.cell(row.original)
|
|
20269
|
-
});
|
|
20270
|
-
});
|
|
20316
|
+
const columnDefs = getColumnDefs(columnConfig);
|
|
20271
20317
|
const table2 = reactTable.useReactTable({
|
|
20272
20318
|
data: data != null ? data : [],
|
|
20273
20319
|
columns: columnDefs,
|
|
@@ -20282,21 +20328,23 @@ function PaginatedTable({
|
|
|
20282
20328
|
autoResetPageIndex: (_a = autoResetPageIndexRef == null ? void 0 : autoResetPageIndexRef.current) != null ? _a : false
|
|
20283
20329
|
});
|
|
20284
20330
|
const { rows } = table2.getRowModel();
|
|
20285
|
-
const rowData = react.useMemo(() => rows.map((r) => r.original), [rows]);
|
|
20286
20331
|
const onPageChange = react.useCallback((page) => {
|
|
20287
20332
|
table2.setPageIndex(page - 1);
|
|
20288
20333
|
}, [table2]);
|
|
20334
|
+
const headerGroups = table2.getHeaderGroups();
|
|
20335
|
+
const numColumns = table2.getVisibleLeafColumns().length;
|
|
20289
20336
|
return /* @__PURE__ */ jsxRuntime.jsxs(VStack, { children: [
|
|
20290
20337
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
20291
20338
|
DataTable,
|
|
20292
20339
|
{
|
|
20293
20340
|
ariaLabel,
|
|
20294
|
-
|
|
20295
|
-
data:
|
|
20341
|
+
numColumns,
|
|
20342
|
+
data: rows,
|
|
20296
20343
|
isLoading,
|
|
20297
20344
|
isError,
|
|
20298
20345
|
componentName,
|
|
20299
|
-
slots
|
|
20346
|
+
slots,
|
|
20347
|
+
headerGroups
|
|
20300
20348
|
}
|
|
20301
20349
|
),
|
|
20302
20350
|
!isError && !isLoading && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -20386,34 +20434,25 @@ const CategorizationRulesTable = () => {
|
|
|
20386
20434
|
spacing: true
|
|
20387
20435
|
}
|
|
20388
20436
|
), [refetch]);
|
|
20389
|
-
const columnConfig = react.useMemo(() =>
|
|
20390
|
-
|
|
20391
|
-
"Counterparty"
|
|
20392
|
-
/* Counterparty */
|
|
20393
|
-
]: {
|
|
20437
|
+
const columnConfig = react.useMemo(() => [
|
|
20438
|
+
{
|
|
20394
20439
|
id: "Counterparty",
|
|
20395
20440
|
header: "Counterparty",
|
|
20396
20441
|
cell: (row) => {
|
|
20397
20442
|
var _a2;
|
|
20398
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Span, { ellipsis: true, children: (_a2 = row.counterpartyFilter) == null ? void 0 : _a2.name });
|
|
20443
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Span, { ellipsis: true, children: (_a2 = row.original.counterpartyFilter) == null ? void 0 : _a2.name });
|
|
20399
20444
|
}
|
|
20400
20445
|
},
|
|
20401
|
-
|
|
20402
|
-
"Category"
|
|
20403
|
-
/* Category */
|
|
20404
|
-
]: {
|
|
20446
|
+
{
|
|
20405
20447
|
id: "Category",
|
|
20406
20448
|
header: "Category",
|
|
20407
20449
|
cell: (row) => {
|
|
20408
|
-
const accountIdentifier = row.category;
|
|
20450
|
+
const accountIdentifier = row.original.category;
|
|
20409
20451
|
return accountIdentifier && /* @__PURE__ */ jsxRuntime.jsx(CategoryDisplay, { accountIdentifier, options: options2 });
|
|
20410
20452
|
},
|
|
20411
20453
|
isRowHeader: true
|
|
20412
20454
|
},
|
|
20413
|
-
|
|
20414
|
-
"Delete"
|
|
20415
|
-
/* Delete */
|
|
20416
|
-
]: {
|
|
20455
|
+
{
|
|
20417
20456
|
id: "Delete",
|
|
20418
20457
|
cell: (row) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
20419
20458
|
Button,
|
|
@@ -20421,7 +20460,7 @@ const CategorizationRulesTable = () => {
|
|
|
20421
20460
|
inset: true,
|
|
20422
20461
|
icon: true,
|
|
20423
20462
|
onPress: () => {
|
|
20424
|
-
setSelectedRule(row);
|
|
20463
|
+
setSelectedRule(row.original);
|
|
20425
20464
|
setShowDeletionConfirmationModal(true);
|
|
20426
20465
|
},
|
|
20427
20466
|
"aria-label": "Delete rule",
|
|
@@ -20430,7 +20469,7 @@ const CategorizationRulesTable = () => {
|
|
|
20430
20469
|
}
|
|
20431
20470
|
)
|
|
20432
20471
|
}
|
|
20433
|
-
|
|
20472
|
+
], [options2]);
|
|
20434
20473
|
return /* @__PURE__ */ jsxRuntime.jsxs(Container, { name: "CategorizationRulesTable", children: [
|
|
20435
20474
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
20436
20475
|
PaginatedTable,
|
|
@@ -22548,7 +22587,7 @@ const DatePicker = ({
|
|
|
22548
22587
|
const getIsDateInvalid = (date2, { minDate, maxDate }) => {
|
|
22549
22588
|
if (date2 === null) return "Cannot select empty date";
|
|
22550
22589
|
if (minDate && date2.compare(minDate) < 0) return "Cannot select date before the business activation date";
|
|
22551
|
-
if (maxDate && date2.compare(maxDate) > 0) return "Cannot select date
|
|
22590
|
+
if (maxDate && date2.compare(maxDate) > 0) return "Cannot select date in the future";
|
|
22552
22591
|
return null;
|
|
22553
22592
|
};
|
|
22554
22593
|
const useDatePickerState = ({ date: date2, setDate, minDate = null, maxDate = null }) => {
|
|
@@ -23066,8 +23105,8 @@ const sortPnlLineItemsAndCalculateTotal = (items, filter) => {
|
|
|
23066
23105
|
};
|
|
23067
23106
|
const useProfitAndLoss = ({ tagFilter, reportingBasis }) => {
|
|
23068
23107
|
var _a;
|
|
23069
|
-
const [
|
|
23070
|
-
const dateRange = useGlobalDateRange({
|
|
23108
|
+
const [dateSelectionMode, setDateSelectionMode] = react.useState("month");
|
|
23109
|
+
const dateRange = useGlobalDateRange({ dateSelectionMode });
|
|
23071
23110
|
const [filters, setFilters] = react.useState({
|
|
23072
23111
|
expenses: void 0,
|
|
23073
23112
|
revenue: void 0
|
|
@@ -23126,8 +23165,8 @@ const useProfitAndLoss = ({ tagFilter, reportingBasis }) => {
|
|
|
23126
23165
|
dateRange,
|
|
23127
23166
|
selectedLineItem,
|
|
23128
23167
|
setSelectedLineItem,
|
|
23129
|
-
|
|
23130
|
-
|
|
23168
|
+
setDateSelectionMode,
|
|
23169
|
+
dateSelectionMode
|
|
23131
23170
|
};
|
|
23132
23171
|
};
|
|
23133
23172
|
function isArrayWithAtLeastOne(list) {
|
|
@@ -23314,9 +23353,9 @@ const ProfitAndLossContext = react.createContext({
|
|
|
23314
23353
|
selectedLineItem: null,
|
|
23315
23354
|
setSelectedLineItem: () => {
|
|
23316
23355
|
},
|
|
23317
|
-
|
|
23356
|
+
setDateSelectionMode: () => {
|
|
23318
23357
|
},
|
|
23319
|
-
|
|
23358
|
+
dateSelectionMode: "month"
|
|
23320
23359
|
});
|
|
23321
23360
|
const isNotOnlyNoneTag = (compareOptions) => {
|
|
23322
23361
|
return Boolean(
|
|
@@ -23348,8 +23387,8 @@ function useProfitAndLossComparison({
|
|
|
23348
23387
|
}) {
|
|
23349
23388
|
var _a;
|
|
23350
23389
|
const [comparisonPeriodMode, setComparisonPeriodMode] = react.useState(DateGroupBy.AllTime);
|
|
23351
|
-
const {
|
|
23352
|
-
const { startDate, endDate } = useGlobalDateRange({
|
|
23390
|
+
const { dateSelectionMode } = react.useContext(ProfitAndLossContext);
|
|
23391
|
+
const { startDate, endDate } = useGlobalDateRange({ dateSelectionMode: "month" });
|
|
23353
23392
|
const comparePeriods = react.useMemo(() => {
|
|
23354
23393
|
if (!comparisonPeriodMode || comparisonPeriodMode === DateGroupBy.AllTime) {
|
|
23355
23394
|
return 1;
|
|
@@ -23362,7 +23401,7 @@ function useProfitAndLossComparison({
|
|
|
23362
23401
|
const [selectedCompareOptions, setSelectedCompareOptionsState] = react.useState(
|
|
23363
23402
|
(comparisonConfig == null ? void 0 : comparisonConfig.defaultTagFilter) ? [comparisonConfig == null ? void 0 : comparisonConfig.defaultTagFilter] : []
|
|
23364
23403
|
);
|
|
23365
|
-
const dateRange = useGlobalDateRange({
|
|
23404
|
+
const dateRange = useGlobalDateRange({ dateSelectionMode });
|
|
23366
23405
|
const compareModeActive = react.useMemo(() => comparePeriods > 1 || selectedCompareOptions.length > 1 || selectedCompareOptions.length === 1 && isNotOnlyNoneTag(selectedCompareOptions), [comparePeriods, selectedCompareOptions]);
|
|
23367
23406
|
const setSelectedCompareOptions = (values) => {
|
|
23368
23407
|
const options2 = values.map(
|
|
@@ -23710,7 +23749,7 @@ const ProfitAndLossChart = ({
|
|
|
23710
23749
|
const [compactView, setCompactView] = react.useState(false);
|
|
23711
23750
|
const barSize = compactView ? 10 : 20;
|
|
23712
23751
|
const { getColor, business } = useLayerContext();
|
|
23713
|
-
const dateRange = useGlobalDateRange({
|
|
23752
|
+
const dateRange = useGlobalDateRange({ dateSelectionMode: "month" });
|
|
23714
23753
|
const { setMonth } = useGlobalDateRangeActions();
|
|
23715
23754
|
const [customCursorSize, setCustomCursorSize] = react.useState({
|
|
23716
23755
|
width: 0,
|
|
@@ -24343,14 +24382,19 @@ const BackButton = (_Ec) => {
|
|
|
24343
24382
|
const baseClassName2 = classNames("Layer__btn", "Layer__back-btn", className);
|
|
24344
24383
|
return /* @__PURE__ */ jsxRuntime.jsx("button", __spreadProps(__spreadValues({}, props), { className: baseClassName2, children: textOnly ? "Back" : /* @__PURE__ */ jsxRuntime.jsx(BackArrow, { size: 16 }) }));
|
|
24345
24384
|
};
|
|
24346
|
-
|
|
24385
|
+
function useGlobalDatePickerBounds() {
|
|
24347
24386
|
const rawActivationDate = useBusinessActivationDate();
|
|
24348
|
-
const
|
|
24387
|
+
const minDate = react.useMemo(() => rawActivationDate ? dateFns.startOfDay(rawActivationDate) : null, [rawActivationDate]);
|
|
24388
|
+
const maxDate = react.useMemo(() => dateFns.endOfDay(/* @__PURE__ */ new Date()), []);
|
|
24389
|
+
return react.useMemo(() => ({ minDate, maxDate }), [minDate, maxDate]);
|
|
24390
|
+
}
|
|
24391
|
+
const GlobalMonthPicker = ({ truncateMonth }) => {
|
|
24392
|
+
const { minDate, maxDate } = useGlobalDatePickerBounds();
|
|
24349
24393
|
const { setMonth } = useGlobalDateRangeActions();
|
|
24350
|
-
const { date: date2 } = useGlobalDate();
|
|
24394
|
+
const { date: date2 } = useGlobalDate({ dateSelectionMode: "month" });
|
|
24351
24395
|
const dateZdt = react.useMemo(() => convertDateToZonedDateTime(date2), [date2]);
|
|
24352
|
-
const minDateZdt = react.useMemo(() =>
|
|
24353
|
-
const maxDateZdt = react.useMemo(() => convertDateToZonedDateTime(
|
|
24396
|
+
const minDateZdt = react.useMemo(() => minDate ? convertDateToZonedDateTime(minDate) : null, [minDate]);
|
|
24397
|
+
const maxDateZdt = react.useMemo(() => convertDateToZonedDateTime(maxDate), [maxDate]);
|
|
24354
24398
|
const onChange = react.useCallback((val) => {
|
|
24355
24399
|
setMonth({ startDate: val.toDate() });
|
|
24356
24400
|
}, [setMonth]);
|
|
@@ -25657,30 +25701,24 @@ const ProfitAndLossDetailReport = ({
|
|
|
25657
25701
|
total: runningBalance
|
|
25658
25702
|
};
|
|
25659
25703
|
}, [data == null ? void 0 : data.lines]);
|
|
25660
|
-
const columnConfig = react.useMemo(() =>
|
|
25661
|
-
|
|
25662
|
-
"Date"
|
|
25663
|
-
/* Date */
|
|
25664
|
-
]: {
|
|
25704
|
+
const columnConfig = react.useMemo(() => [
|
|
25705
|
+
{
|
|
25665
25706
|
id: "Date",
|
|
25666
25707
|
header: (stringOverrides == null ? void 0 : stringOverrides.dateColumnHeader) || "Date",
|
|
25667
25708
|
cell: (row) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
25668
25709
|
DateTime,
|
|
25669
25710
|
{
|
|
25670
|
-
value: row.date,
|
|
25711
|
+
value: row.original.date,
|
|
25671
25712
|
onlyDate: true,
|
|
25672
25713
|
slotProps: { Date: { size: TextSize.md, weight: TextWeight.normal, variant: "subtle" } }
|
|
25673
25714
|
}
|
|
25674
25715
|
)
|
|
25675
25716
|
},
|
|
25676
|
-
|
|
25677
|
-
"Type"
|
|
25678
|
-
/* Type */
|
|
25679
|
-
]: {
|
|
25717
|
+
{
|
|
25680
25718
|
id: "Type",
|
|
25681
25719
|
header: (stringOverrides == null ? void 0 : stringOverrides.typeColumnHeader) || "Type",
|
|
25682
25720
|
cell: (row) => {
|
|
25683
|
-
const { source } = row;
|
|
25721
|
+
const { source } = row.original;
|
|
25684
25722
|
return source ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
25685
25723
|
Button,
|
|
25686
25724
|
{
|
|
@@ -25691,10 +25729,7 @@ const ProfitAndLossDetailReport = ({
|
|
|
25691
25729
|
) : "-";
|
|
25692
25730
|
}
|
|
25693
25731
|
},
|
|
25694
|
-
|
|
25695
|
-
"Account"
|
|
25696
|
-
/* Account */
|
|
25697
|
-
]: {
|
|
25732
|
+
{
|
|
25698
25733
|
id: "Account",
|
|
25699
25734
|
header: (stringOverrides == null ? void 0 : stringOverrides.accountColumnHeader) || "Account",
|
|
25700
25735
|
cell: (row) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -25703,14 +25738,11 @@ const ProfitAndLossDetailReport = ({
|
|
|
25703
25738
|
as: "span",
|
|
25704
25739
|
withDeprecatedTooltip: TextUseTooltip.whenTruncated,
|
|
25705
25740
|
ellipsis: true,
|
|
25706
|
-
children: row.account.name || "-"
|
|
25741
|
+
children: row.original.account.name || "-"
|
|
25707
25742
|
}
|
|
25708
25743
|
)
|
|
25709
25744
|
},
|
|
25710
|
-
|
|
25711
|
-
"Description"
|
|
25712
|
-
/* Description */
|
|
25713
|
-
]: {
|
|
25745
|
+
{
|
|
25714
25746
|
id: "Description",
|
|
25715
25747
|
header: (stringOverrides == null ? void 0 : stringOverrides.descriptionColumnHeader) || "Description",
|
|
25716
25748
|
cell: (row) => {
|
|
@@ -25721,33 +25753,27 @@ const ProfitAndLossDetailReport = ({
|
|
|
25721
25753
|
as: "span",
|
|
25722
25754
|
withDeprecatedTooltip: TextUseTooltip.whenTruncated,
|
|
25723
25755
|
ellipsis: true,
|
|
25724
|
-
children: ((_a = row.source) == null ? void 0 : _a.displayDescription) || row.account.accountSubtype.displayName || "-"
|
|
25756
|
+
children: ((_a = row.original.source) == null ? void 0 : _a.displayDescription) || row.original.account.accountSubtype.displayName || "-"
|
|
25725
25757
|
}
|
|
25726
25758
|
);
|
|
25727
25759
|
},
|
|
25728
25760
|
isRowHeader: true
|
|
25729
25761
|
},
|
|
25730
|
-
|
|
25731
|
-
"Amount"
|
|
25732
|
-
/* Amount */
|
|
25733
|
-
]: {
|
|
25762
|
+
{
|
|
25734
25763
|
id: "Amount",
|
|
25735
25764
|
header: (stringOverrides == null ? void 0 : stringOverrides.amountColumnHeader) || "Amount",
|
|
25736
25765
|
cell: (row) => {
|
|
25737
|
-
return /* @__PURE__ */ jsxRuntime.jsx(MoneySpan, { amount: row.direction === Direction.CREDIT ? row.amount : -row.amount });
|
|
25766
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MoneySpan, { amount: row.original.direction === Direction.CREDIT ? row.original.amount : -row.original.amount });
|
|
25738
25767
|
}
|
|
25739
25768
|
},
|
|
25740
|
-
|
|
25741
|
-
"Balance"
|
|
25742
|
-
/* Balance */
|
|
25743
|
-
]: {
|
|
25769
|
+
{
|
|
25744
25770
|
id: "Balance",
|
|
25745
25771
|
header: (stringOverrides == null ? void 0 : stringOverrides.balanceColumnHeader) || "Balance",
|
|
25746
25772
|
cell: (row) => {
|
|
25747
|
-
return /* @__PURE__ */ jsxRuntime.jsx(MoneySpan, { amount: row.runningBalance });
|
|
25773
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MoneySpan, { amount: row.original.runningBalance });
|
|
25748
25774
|
}
|
|
25749
25775
|
}
|
|
25750
|
-
|
|
25776
|
+
], [stringOverrides, handleSourceClick]);
|
|
25751
25777
|
const Header3 = react.useCallback(() => {
|
|
25752
25778
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
25753
25779
|
DetailReportBreadcrumb,
|
|
@@ -26067,7 +26093,7 @@ const options$3 = Object.values(dateSelectionOptionConfig).filter((opt) => opt.v
|
|
|
26067
26093
|
const DateSelectionComboBox = () => {
|
|
26068
26094
|
const [lastPreset, setLastPreset] = react.useState(null);
|
|
26069
26095
|
const { business } = useLayerContext();
|
|
26070
|
-
const dateRange = useGlobalDateRange({
|
|
26096
|
+
const dateRange = useGlobalDateRange({ dateSelectionMode: "full" });
|
|
26071
26097
|
const { setDateRange } = useGlobalDateRangeActions();
|
|
26072
26098
|
const selectedPreset = presetForDateRange(dateRange, lastPreset, getActivationDate(business));
|
|
26073
26099
|
const selectedOption = dateSelectionOptionConfig[selectedPreset != null ? selectedPreset : DatePreset.Custom];
|
|
@@ -26090,10 +26116,10 @@ const DateSelectionComboBox = () => {
|
|
|
26090
26116
|
}
|
|
26091
26117
|
);
|
|
26092
26118
|
};
|
|
26093
|
-
const
|
|
26094
|
-
const { startDate: globalStartDate, endDate: globalEndDate } = useGlobalDateRange({
|
|
26119
|
+
const GlobalDateRangePicker = () => {
|
|
26120
|
+
const { startDate: globalStartDate, endDate: globalEndDate } = useGlobalDateRange({ dateSelectionMode: "full" });
|
|
26095
26121
|
const { setDateRange: setGlobalDateRange } = useGlobalDateRangeActions();
|
|
26096
|
-
const {
|
|
26122
|
+
const { minDate, maxDate } = useGlobalDatePickerBounds();
|
|
26097
26123
|
const {
|
|
26098
26124
|
localDate: localStartDate,
|
|
26099
26125
|
onChange: onChangeStartDate,
|
|
@@ -26125,6 +26151,39 @@ const DateRangeSelection = ({ minDate, maxDate }) => {
|
|
|
26125
26151
|
const next = { startDate: localStartDate.toDate(), endDate: localEndDate.toDate() };
|
|
26126
26152
|
setGlobalDateRange(next);
|
|
26127
26153
|
}, [startDateInvalid, endDateInvalid, localStartDate, localEndDate, setGlobalDateRange]);
|
|
26154
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
26155
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
26156
|
+
DatePicker,
|
|
26157
|
+
{
|
|
26158
|
+
label: "Start Date",
|
|
26159
|
+
showLabel: false,
|
|
26160
|
+
date: localStartDate,
|
|
26161
|
+
onChange: onChangeStartDate,
|
|
26162
|
+
minDate: minStartDate,
|
|
26163
|
+
maxDate: maxStartDate,
|
|
26164
|
+
isInvalid: startDateInvalid,
|
|
26165
|
+
errorText: startDateErrorText,
|
|
26166
|
+
onBlur: onBlurStartDate
|
|
26167
|
+
}
|
|
26168
|
+
),
|
|
26169
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
26170
|
+
DatePicker,
|
|
26171
|
+
{
|
|
26172
|
+
label: "End Date",
|
|
26173
|
+
showLabel: false,
|
|
26174
|
+
date: localEndDate,
|
|
26175
|
+
onChange: onChangeEndDate,
|
|
26176
|
+
minDate: minEndDate,
|
|
26177
|
+
maxDate: maxEndDate,
|
|
26178
|
+
isInvalid: endDateInvalid,
|
|
26179
|
+
errorText: endDateErrorText,
|
|
26180
|
+
onBlur: onBlurEndDate
|
|
26181
|
+
}
|
|
26182
|
+
)
|
|
26183
|
+
] });
|
|
26184
|
+
};
|
|
26185
|
+
const DateRangeSelection = () => {
|
|
26186
|
+
const { value } = useSizeClass();
|
|
26128
26187
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
26129
26188
|
HStack,
|
|
26130
26189
|
{
|
|
@@ -26133,34 +26192,7 @@ const DateRangeSelection = ({ minDate, maxDate }) => {
|
|
|
26133
26192
|
}),
|
|
26134
26193
|
children: [
|
|
26135
26194
|
/* @__PURE__ */ jsxRuntime.jsx(DateSelectionComboBox, {}),
|
|
26136
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
26137
|
-
DatePicker,
|
|
26138
|
-
{
|
|
26139
|
-
label: "Start Date",
|
|
26140
|
-
showLabel: false,
|
|
26141
|
-
date: localStartDate,
|
|
26142
|
-
onChange: onChangeStartDate,
|
|
26143
|
-
minDate: minStartDate,
|
|
26144
|
-
maxDate: maxStartDate,
|
|
26145
|
-
isInvalid: startDateInvalid,
|
|
26146
|
-
errorText: startDateErrorText,
|
|
26147
|
-
onBlur: onBlurStartDate
|
|
26148
|
-
}
|
|
26149
|
-
),
|
|
26150
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
26151
|
-
DatePicker,
|
|
26152
|
-
{
|
|
26153
|
-
label: "End Date",
|
|
26154
|
-
showLabel: false,
|
|
26155
|
-
date: localEndDate,
|
|
26156
|
-
onChange: onChangeEndDate,
|
|
26157
|
-
minDate: minEndDate,
|
|
26158
|
-
maxDate: maxEndDate,
|
|
26159
|
-
isInvalid: endDateInvalid,
|
|
26160
|
-
errorText: endDateErrorText,
|
|
26161
|
-
onBlur: onBlurEndDate
|
|
26162
|
-
}
|
|
26163
|
-
)
|
|
26195
|
+
/* @__PURE__ */ jsxRuntime.jsx(GlobalDateRangePicker, {})
|
|
26164
26196
|
]
|
|
26165
26197
|
}
|
|
26166
26198
|
);
|
|
@@ -26485,7 +26517,7 @@ const ProfitAndLossCompareOptions = () => {
|
|
|
26485
26517
|
comparisonPeriodMode,
|
|
26486
26518
|
setComparisonPeriodMode
|
|
26487
26519
|
} = react.useContext(ProfitAndLossComparisonContext);
|
|
26488
|
-
const {
|
|
26520
|
+
const { dateSelectionMode } = react.useContext(ProfitAndLossContext);
|
|
26489
26521
|
const tagComparisonSelectOptions = compareOptions.map(
|
|
26490
26522
|
(tagComparisonOption) => {
|
|
26491
26523
|
return {
|
|
@@ -26498,7 +26530,7 @@ const ProfitAndLossCompareOptions = () => {
|
|
|
26498
26530
|
return null;
|
|
26499
26531
|
}
|
|
26500
26532
|
return /* @__PURE__ */ jsxRuntime.jsxs(HStack, { align: "center", gap: "xs", children: [
|
|
26501
|
-
|
|
26533
|
+
dateSelectionMode === "full" && /* @__PURE__ */ jsxRuntime.jsx(DateGroupByComboBox, { value: comparisonPeriodMode, onValueChange: setComparisonPeriodMode }),
|
|
26502
26534
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
26503
26535
|
MultiSelect,
|
|
26504
26536
|
{
|
|
@@ -26673,7 +26705,7 @@ const useTableExpandRow = () => {
|
|
|
26673
26705
|
const ProfitAndLossCompareTable = ({
|
|
26674
26706
|
stringOverrides
|
|
26675
26707
|
}) => {
|
|
26676
|
-
const { dateRange,
|
|
26708
|
+
const { dateRange, dateSelectionMode } = react.useContext(ProfitAndLossContext);
|
|
26677
26709
|
const {
|
|
26678
26710
|
data: comparisonData,
|
|
26679
26711
|
isLoading,
|
|
@@ -26690,7 +26722,7 @@ const ProfitAndLossCompareTable = ({
|
|
|
26690
26722
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "Layer__profit-and-loss-table__loader-container", children: /* @__PURE__ */ jsxRuntime.jsx(Loader, {}) });
|
|
26691
26723
|
}
|
|
26692
26724
|
const getBookkeepingPeriodStatus = (date2) => {
|
|
26693
|
-
if (!bookkeepingPeriods ||
|
|
26725
|
+
if (!bookkeepingPeriods || dateSelectionMode !== "month") {
|
|
26694
26726
|
return;
|
|
26695
26727
|
}
|
|
26696
26728
|
const currentMonth = date2.getMonth() + 1;
|
|
@@ -27119,11 +27151,11 @@ const ProfitAndLossReport = ({
|
|
|
27119
27151
|
hideHeader
|
|
27120
27152
|
}) => {
|
|
27121
27153
|
var _a;
|
|
27122
|
-
const { selectedLineItem, setSelectedLineItem,
|
|
27154
|
+
const { selectedLineItem, setSelectedLineItem, setDateSelectionMode } = react.useContext(ProfitAndLossContext);
|
|
27123
27155
|
const { comparisonConfig } = react.useContext(ProfitAndLossComparisonContext);
|
|
27124
27156
|
react.useEffect(() => {
|
|
27125
|
-
|
|
27126
|
-
}, [dateSelectionMode,
|
|
27157
|
+
setDateSelectionMode(dateSelectionMode);
|
|
27158
|
+
}, [dateSelectionMode, setDateSelectionMode]);
|
|
27127
27159
|
const breadcrumbIndexMap = react.useMemo(() => {
|
|
27128
27160
|
if (!selectedLineItem) return {};
|
|
27129
27161
|
return selectedLineItem.breadcrumbPath.reduce((acc, item, index2) => {
|
|
@@ -27470,7 +27502,7 @@ function Internal_ProfitAndLossSummaries({
|
|
|
27470
27502
|
setSidebarScope,
|
|
27471
27503
|
sidebarScope
|
|
27472
27504
|
} = react.useContext(ProfitAndLossContext);
|
|
27473
|
-
const { startDate, endDate: _endDate } = useGlobalDateRange({
|
|
27505
|
+
const { startDate, endDate: _endDate } = useGlobalDateRange({ dateSelectionMode: "month" });
|
|
27474
27506
|
const previousMonthStart = dateFns.sub(startDate, { months: 1 });
|
|
27475
27507
|
const { data: previousData } = useProfitAndLossSummaries({
|
|
27476
27508
|
startYear: previousMonthStart.getFullYear(),
|
|
@@ -27977,18 +28009,16 @@ const BalanceSheetTable = ({
|
|
|
27977
28009
|
] });
|
|
27978
28010
|
};
|
|
27979
28011
|
const GlobalDatePicker = () => {
|
|
27980
|
-
const { date: date2 } = useGlobalDate();
|
|
28012
|
+
const { date: date2 } = useGlobalDate({ dateSelectionMode: "full" });
|
|
27981
28013
|
const { setDate: setGlobalDate } = useGlobalDateActions();
|
|
27982
|
-
const
|
|
27983
|
-
const activationDate = react.useMemo(() => rawActivationDate ? dateFns.startOfDay(rawActivationDate) : null, [rawActivationDate]);
|
|
27984
|
-
const maxDate = react.useMemo(() => dateFns.endOfDay(/* @__PURE__ */ new Date()), []);
|
|
28014
|
+
const { minDate, maxDate } = useGlobalDatePickerBounds();
|
|
27985
28015
|
const setDate = react.useCallback((date22) => {
|
|
27986
28016
|
setGlobalDate({ date: date22 });
|
|
27987
28017
|
}, [setGlobalDate]);
|
|
27988
28018
|
const { localDate, onChange, minDateZdt, maxDateZdt, errorText, onBlur, isInvalid } = useDatePickerState({
|
|
27989
28019
|
date: date2,
|
|
27990
28020
|
setDate,
|
|
27991
|
-
minDate
|
|
28021
|
+
minDate,
|
|
27992
28022
|
maxDate
|
|
27993
28023
|
});
|
|
27994
28024
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -28023,7 +28053,7 @@ const DateSelection = () => {
|
|
|
28023
28053
|
};
|
|
28024
28054
|
const CombinedDateSelection = ({ mode }) => {
|
|
28025
28055
|
if (mode === "month") {
|
|
28026
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
28056
|
+
return /* @__PURE__ */ jsxRuntime.jsx(GlobalMonthPicker, {});
|
|
28027
28057
|
}
|
|
28028
28058
|
return /* @__PURE__ */ jsxRuntime.jsx(DateSelection, {});
|
|
28029
28059
|
};
|
|
@@ -28043,7 +28073,7 @@ const BalanceSheetView = ({
|
|
|
28043
28073
|
stringOverrides,
|
|
28044
28074
|
dateSelectionMode = "full"
|
|
28045
28075
|
}) => {
|
|
28046
|
-
const { date: effectiveDate } = useGlobalDate();
|
|
28076
|
+
const { date: effectiveDate } = useGlobalDate({ dateSelectionMode });
|
|
28047
28077
|
const { data, isLoading } = useBalanceSheet({ effectiveDate });
|
|
28048
28078
|
const { view, containerRef } = useElementViewSize();
|
|
28049
28079
|
if (asWidget) {
|
|
@@ -28358,7 +28388,7 @@ const StatementOfCashFlowView = ({
|
|
|
28358
28388
|
stringOverrides,
|
|
28359
28389
|
dateSelectionMode = "full"
|
|
28360
28390
|
}) => {
|
|
28361
|
-
const dateRange = useGlobalDateRange({
|
|
28391
|
+
const dateRange = useGlobalDateRange({ dateSelectionMode });
|
|
28362
28392
|
const { data, isLoading } = useStatementOfCashFlow(dateRange);
|
|
28363
28393
|
const { view, containerRef } = useElementViewSize();
|
|
28364
28394
|
return /* @__PURE__ */ jsxRuntime.jsx(TableProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -29024,7 +29054,7 @@ const useChartOfAccounts = ({ withDates = false } = {}) => {
|
|
|
29024
29054
|
const { businessId } = useLayerContext();
|
|
29025
29055
|
const { apiUrl } = useEnvironment();
|
|
29026
29056
|
const { data: auth } = useAuth();
|
|
29027
|
-
const { startDate, endDate } = useGlobalDateRange({
|
|
29057
|
+
const { startDate, endDate } = useGlobalDateRange({ dateSelectionMode: "month" });
|
|
29028
29058
|
const [form, setForm] = react.useState();
|
|
29029
29059
|
const [sendingForm, setSendingForm] = react.useState(false);
|
|
29030
29060
|
const [apiError, setApiError] = react.useState(void 0);
|
|
@@ -37006,56 +37036,38 @@ const AmountCell = ({ invoice }) => {
|
|
|
37006
37036
|
}
|
|
37007
37037
|
}
|
|
37008
37038
|
};
|
|
37009
|
-
const getColumnConfig$1 = (onSelectInvoice) =>
|
|
37010
|
-
|
|
37011
|
-
"SentAt"
|
|
37012
|
-
/* SentAt */
|
|
37013
|
-
]: {
|
|
37039
|
+
const getColumnConfig$1 = (onSelectInvoice) => [
|
|
37040
|
+
{
|
|
37014
37041
|
id: "SentAt",
|
|
37015
37042
|
header: "Sent Date",
|
|
37016
|
-
cell: (row) => row.sentAt ? formatDate(row.sentAt) : null
|
|
37043
|
+
cell: (row) => row.original.sentAt ? formatDate(row.original.sentAt) : null
|
|
37017
37044
|
},
|
|
37018
|
-
|
|
37019
|
-
"InvoiceNo"
|
|
37020
|
-
/* InvoiceNo */
|
|
37021
|
-
]: {
|
|
37045
|
+
{
|
|
37022
37046
|
id: "InvoiceNo",
|
|
37023
37047
|
header: "No.",
|
|
37024
|
-
cell: (row) => /* @__PURE__ */ jsxRuntime.jsx(Span, { ellipsis: true, children: row.invoiceNumber }),
|
|
37048
|
+
cell: (row) => /* @__PURE__ */ jsxRuntime.jsx(Span, { ellipsis: true, children: row.original.invoiceNumber }),
|
|
37025
37049
|
isRowHeader: true
|
|
37026
37050
|
},
|
|
37027
|
-
|
|
37028
|
-
"Customer"
|
|
37029
|
-
/* Customer */
|
|
37030
|
-
]: {
|
|
37051
|
+
{
|
|
37031
37052
|
id: "Customer",
|
|
37032
37053
|
header: "Customer",
|
|
37033
|
-
cell: (row) => /* @__PURE__ */ jsxRuntime.jsx(Span, { ellipsis: true, children: getCustomerName(row.customer) })
|
|
37054
|
+
cell: (row) => /* @__PURE__ */ jsxRuntime.jsx(Span, { ellipsis: true, children: getCustomerName(row.original.customer) })
|
|
37034
37055
|
},
|
|
37035
|
-
|
|
37036
|
-
"Total"
|
|
37037
|
-
/* Total */
|
|
37038
|
-
]: {
|
|
37056
|
+
{
|
|
37039
37057
|
id: "Total",
|
|
37040
37058
|
header: "Amount",
|
|
37041
|
-
cell: (row) => /* @__PURE__ */ jsxRuntime.jsx(AmountCell, { invoice: row })
|
|
37059
|
+
cell: (row) => /* @__PURE__ */ jsxRuntime.jsx(AmountCell, { invoice: row.original })
|
|
37042
37060
|
},
|
|
37043
|
-
|
|
37044
|
-
"Status"
|
|
37045
|
-
/* Status */
|
|
37046
|
-
]: {
|
|
37061
|
+
{
|
|
37047
37062
|
id: "Status",
|
|
37048
37063
|
header: "Status",
|
|
37049
|
-
cell: (row) => /* @__PURE__ */ jsxRuntime.jsx(InvoiceStatusCell, { invoice: row })
|
|
37064
|
+
cell: (row) => /* @__PURE__ */ jsxRuntime.jsx(InvoiceStatusCell, { invoice: row.original })
|
|
37050
37065
|
},
|
|
37051
|
-
|
|
37052
|
-
"Expand"
|
|
37053
|
-
/* Expand */
|
|
37054
|
-
]: {
|
|
37066
|
+
{
|
|
37055
37067
|
id: "Expand",
|
|
37056
|
-
cell: (row) => /* @__PURE__ */ jsxRuntime.jsx(Button, { inset: true, icon: true, onPress: () => onSelectInvoice(row), "aria-label": "View invoice", variant: "ghost", children: /* @__PURE__ */ jsxRuntime.jsx(ChevronRightFill, {}) })
|
|
37068
|
+
cell: (row) => /* @__PURE__ */ jsxRuntime.jsx(Button, { inset: true, icon: true, onPress: () => onSelectInvoice(row.original), "aria-label": "View invoice", variant: "ghost", children: /* @__PURE__ */ jsxRuntime.jsx(ChevronRightFill, {}) })
|
|
37057
37069
|
}
|
|
37058
|
-
|
|
37070
|
+
];
|
|
37059
37071
|
const UNPAID_STATUSES$1 = [InvoiceStatus.Sent, InvoiceStatus.PartiallyPaid];
|
|
37060
37072
|
const getStatusFilterParams = (statusFilter) => {
|
|
37061
37073
|
switch (statusFilter) {
|
|
@@ -39765,15 +39777,72 @@ effect.Schema.Union(
|
|
|
39765
39777
|
DateQueryParamsSchema,
|
|
39766
39778
|
DateRangeQueryParamsSchema
|
|
39767
39779
|
);
|
|
39780
|
+
const unifiedReportColumnFields = {
|
|
39781
|
+
columnKey: effect.pipe(
|
|
39782
|
+
effect.Schema.propertySignature(effect.Schema.String),
|
|
39783
|
+
effect.Schema.fromKey("column_key")
|
|
39784
|
+
),
|
|
39785
|
+
displayName: effect.pipe(
|
|
39786
|
+
effect.Schema.propertySignature(effect.Schema.String),
|
|
39787
|
+
effect.Schema.fromKey("display_name")
|
|
39788
|
+
)
|
|
39789
|
+
};
|
|
39790
|
+
const UnifiedReportColumnSchema = effect.Schema.Struct(__spreadProps(__spreadValues({}, unifiedReportColumnFields), {
|
|
39791
|
+
columns: effect.Schema.optional(
|
|
39792
|
+
effect.Schema.Array(
|
|
39793
|
+
effect.Schema.suspend(() => UnifiedReportColumnSchema)
|
|
39794
|
+
)
|
|
39795
|
+
)
|
|
39796
|
+
}));
|
|
39797
|
+
const UnifiedCellValueAmountSchema = effect.Schema.Struct({
|
|
39798
|
+
type: effect.Schema.Literal("Amount"),
|
|
39799
|
+
value: effect.Schema.Number
|
|
39800
|
+
});
|
|
39801
|
+
const UnifiedCellValueEmptySchema = effect.Schema.Struct({
|
|
39802
|
+
type: effect.Schema.Literal("Empty")
|
|
39803
|
+
});
|
|
39804
|
+
const UnifiedCellValueUnknownSchema = effect.Schema.Struct({
|
|
39805
|
+
type: effect.Schema.String,
|
|
39806
|
+
value: effect.Schema.optional(effect.Schema.Unknown)
|
|
39807
|
+
});
|
|
39808
|
+
const UnifiedCellValueSchema = effect.Schema.Union(
|
|
39809
|
+
UnifiedCellValueAmountSchema,
|
|
39810
|
+
UnifiedCellValueEmptySchema,
|
|
39811
|
+
UnifiedCellValueUnknownSchema
|
|
39812
|
+
);
|
|
39813
|
+
const isAmountCellValue = (value) => value.type === "Amount";
|
|
39814
|
+
const isEmptyCellValue = (value) => value.type === "Empty";
|
|
39815
|
+
const UnifiedReportCellSchema = effect.Schema.Struct({
|
|
39816
|
+
value: UnifiedCellValueSchema
|
|
39817
|
+
});
|
|
39818
|
+
const unifiedReportRowFields = {
|
|
39819
|
+
rowKey: effect.pipe(
|
|
39820
|
+
effect.Schema.propertySignature(effect.Schema.String),
|
|
39821
|
+
effect.Schema.fromKey("row_key")
|
|
39822
|
+
),
|
|
39823
|
+
displayName: effect.pipe(
|
|
39824
|
+
effect.Schema.propertySignature(effect.Schema.String),
|
|
39825
|
+
effect.Schema.fromKey("display_name")
|
|
39826
|
+
),
|
|
39827
|
+
cells: effect.Schema.Record({
|
|
39828
|
+
key: effect.Schema.String,
|
|
39829
|
+
value: effect.Schema.NullishOr(UnifiedReportCellSchema)
|
|
39830
|
+
})
|
|
39831
|
+
};
|
|
39832
|
+
const UnifiedReportRowSchema = effect.Schema.Struct(__spreadProps(__spreadValues({}, unifiedReportRowFields), {
|
|
39833
|
+
rows: effect.Schema.optional(
|
|
39834
|
+
effect.Schema.Array(
|
|
39835
|
+
effect.Schema.suspend(() => UnifiedReportRowSchema)
|
|
39836
|
+
)
|
|
39837
|
+
)
|
|
39838
|
+
}));
|
|
39768
39839
|
const UnifiedReportSchema = effect.Schema.Struct({
|
|
39769
39840
|
businessId: effect.pipe(
|
|
39770
39841
|
effect.Schema.propertySignature(effect.Schema.UUID),
|
|
39771
39842
|
effect.Schema.fromKey("business_id")
|
|
39772
39843
|
),
|
|
39773
|
-
|
|
39774
|
-
|
|
39775
|
-
effect.Schema.fromKey("line_items")
|
|
39776
|
-
)
|
|
39844
|
+
columns: effect.Schema.Array(UnifiedReportColumnSchema),
|
|
39845
|
+
rows: effect.Schema.Array(UnifiedReportRowSchema)
|
|
39777
39846
|
});
|
|
39778
39847
|
var UnifiedReportDateVariant = /* @__PURE__ */ ((UnifiedReportDateVariant2) => {
|
|
39779
39848
|
UnifiedReportDateVariant2["Date"] = "Date";
|
|
@@ -39795,10 +39864,10 @@ function useUnifiedReportDateVariant() {
|
|
|
39795
39864
|
const report = zustand.useStore(store, (state) => state.report);
|
|
39796
39865
|
return reportToDateVariantMap[report];
|
|
39797
39866
|
}
|
|
39798
|
-
function useUnifiedReportWithDateParams() {
|
|
39867
|
+
function useUnifiedReportWithDateParams({ dateSelectionMode }) {
|
|
39799
39868
|
const store = react.useContext(UnifiedReportStoreContext);
|
|
39800
|
-
const { date: effectiveDate } = useGlobalDate();
|
|
39801
|
-
const { startDate, endDate } = useGlobalDateRange({
|
|
39869
|
+
const { date: effectiveDate } = useGlobalDate({ dateSelectionMode });
|
|
39870
|
+
const { startDate, endDate } = useGlobalDateRange({ dateSelectionMode });
|
|
39802
39871
|
const report = zustand.useStore(store, (state) => state.report);
|
|
39803
39872
|
const dateVariant = reportToDateVariantMap[report];
|
|
39804
39873
|
switch (dateVariant) {
|
|
@@ -39858,33 +39927,13 @@ function ExpandableDataTable({
|
|
|
39858
39927
|
ariaLabel,
|
|
39859
39928
|
slots,
|
|
39860
39929
|
hideHeader,
|
|
39861
|
-
getSubRows: getSubRows2
|
|
39930
|
+
getSubRows: getSubRows2,
|
|
39931
|
+
getRowId
|
|
39862
39932
|
}) {
|
|
39863
|
-
const columnHelper = reactTable.createColumnHelper();
|
|
39864
|
-
const columns = Object.values(columnConfig);
|
|
39865
39933
|
const { expanded, setExpanded } = react.useContext(ExpandableDataTableContext);
|
|
39866
|
-
const columnDefs = columns.map((col) => {
|
|
39867
|
-
return columnHelper.display({
|
|
39868
|
-
id: col.id,
|
|
39869
|
-
header: () => col.header,
|
|
39870
|
-
cell: ({ row }) => col.cell(row)
|
|
39871
|
-
});
|
|
39872
|
-
});
|
|
39873
|
-
const table2 = reactTable.useReactTable({
|
|
39874
|
-
data: data != null ? data : EMPTY_ARRAY,
|
|
39875
|
-
columns: columnDefs,
|
|
39876
|
-
getSubRows: getSubRows2,
|
|
39877
|
-
getCoreRowModel: reactTable.getCoreRowModel(),
|
|
39878
|
-
getExpandedRowModel: reactTable.getExpandedRowModel(),
|
|
39879
|
-
state: { expanded },
|
|
39880
|
-
onExpandedChange: setExpanded,
|
|
39881
|
-
autoResetPageIndex: false,
|
|
39882
|
-
getRowId: (row) => row.id
|
|
39883
|
-
});
|
|
39884
|
-
const { rows } = table2.getExpandedRowModel();
|
|
39885
39934
|
const wrappedColumnConfig = react.useMemo(() => {
|
|
39886
|
-
|
|
39887
|
-
|
|
39935
|
+
const [first, ...rest] = columnConfig;
|
|
39936
|
+
if (!first || !isLeafColumn(first)) return columnConfig;
|
|
39888
39937
|
const originalFirstCell = first.cell;
|
|
39889
39938
|
const firstWithChevron = __spreadProps(__spreadValues({}, first), {
|
|
39890
39939
|
cell: (row) => {
|
|
@@ -39897,26 +39946,37 @@ function ExpandableDataTable({
|
|
|
39897
39946
|
] }) });
|
|
39898
39947
|
}
|
|
39899
39948
|
});
|
|
39900
|
-
return
|
|
39901
|
-
|
|
39902
|
-
|
|
39903
|
-
|
|
39904
|
-
|
|
39905
|
-
|
|
39906
|
-
|
|
39949
|
+
return [firstWithChevron, ...rest];
|
|
39950
|
+
}, [columnConfig]);
|
|
39951
|
+
const columnDefs = getColumnDefs(wrappedColumnConfig);
|
|
39952
|
+
const table2 = reactTable.useReactTable({
|
|
39953
|
+
data: data != null ? data : EMPTY_ARRAY,
|
|
39954
|
+
columns: columnDefs,
|
|
39955
|
+
getSubRows: getSubRows2,
|
|
39956
|
+
getCoreRowModel: reactTable.getCoreRowModel(),
|
|
39957
|
+
getExpandedRowModel: reactTable.getExpandedRowModel(),
|
|
39958
|
+
state: { expanded },
|
|
39959
|
+
onExpandedChange: setExpanded,
|
|
39960
|
+
autoResetPageIndex: false,
|
|
39961
|
+
getRowId
|
|
39962
|
+
});
|
|
39963
|
+
const { rows } = table2.getExpandedRowModel();
|
|
39907
39964
|
const dependencies = react.useMemo(() => [expanded], [expanded]);
|
|
39965
|
+
const headerGroups = table2.getHeaderGroups();
|
|
39966
|
+
const numColumns = table2.getVisibleLeafColumns().length;
|
|
39908
39967
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
39909
39968
|
DataTable,
|
|
39910
39969
|
{
|
|
39911
39970
|
ariaLabel,
|
|
39912
|
-
|
|
39971
|
+
numColumns,
|
|
39913
39972
|
data: rows,
|
|
39914
39973
|
isLoading,
|
|
39915
39974
|
isError,
|
|
39916
39975
|
componentName,
|
|
39917
39976
|
slots,
|
|
39918
39977
|
hideHeader,
|
|
39919
|
-
dependencies
|
|
39978
|
+
dependencies,
|
|
39979
|
+
headerGroups
|
|
39920
39980
|
}
|
|
39921
39981
|
);
|
|
39922
39982
|
}
|
|
@@ -39948,10 +40008,6 @@ const getUnifiedReport = get$1((_md) => {
|
|
|
39948
40008
|
const parameters = toDefinedSearchParameters(__spreadValues({}, dateParams));
|
|
39949
40009
|
return `/v1/businesses/${businessId}/reports/unified/${report}?${parameters}`;
|
|
39950
40010
|
});
|
|
39951
|
-
const addIdToLineItem = (li) => __spreadProps(__spreadValues({}, li), {
|
|
39952
|
-
id: li.name,
|
|
39953
|
-
lineItems: li.lineItems.map(addIdToLineItem)
|
|
39954
|
-
});
|
|
39955
40011
|
class UnifiedReportSWRResponse {
|
|
39956
40012
|
constructor(swrResponse) {
|
|
39957
40013
|
__publicField(this, "swrResponse");
|
|
@@ -39986,45 +40042,64 @@ function useUnifiedReport(_od) {
|
|
|
39986
40042
|
}), dateParams)),
|
|
39987
40043
|
({ accessToken, apiUrl: apiUrl2, businessId: businessId2 }) => getUnifiedReport(apiUrl2, accessToken, {
|
|
39988
40044
|
params: __spreadValues({ businessId: businessId2, report }, dateParams)
|
|
39989
|
-
})().then(
|
|
39990
|
-
({ data }) => effect.Schema.decodeUnknownPromise(UnifiedReportSchema)(data).then((rep) => __spreadProps(__spreadValues({}, rep), {
|
|
39991
|
-
lineItems: rep.lineItems.map(addIdToLineItem)
|
|
39992
|
-
}))
|
|
39993
|
-
)
|
|
40045
|
+
})().then(({ data }) => effect.Schema.decodeUnknownPromise(UnifiedReportSchema)(data))
|
|
39994
40046
|
);
|
|
39995
40047
|
return new UnifiedReportSWRResponse(swrResponse);
|
|
39996
40048
|
}
|
|
39997
40049
|
const COMPONENT_NAME$2 = "UnifiedReport";
|
|
39998
|
-
const
|
|
39999
|
-
|
|
40000
|
-
|
|
40001
|
-
|
|
40002
|
-
|
|
40003
|
-
|
|
40004
|
-
|
|
40050
|
+
const makeLeafColumn = (col) => ({
|
|
40051
|
+
id: col.columnKey,
|
|
40052
|
+
header: col.displayName,
|
|
40053
|
+
cell: (row) => {
|
|
40054
|
+
var _a;
|
|
40055
|
+
const cellValue = (_a = row.original.cells[col.columnKey]) == null ? void 0 : _a.value;
|
|
40056
|
+
if (!cellValue || isEmptyCellValue(cellValue)) {
|
|
40057
|
+
return null;
|
|
40058
|
+
}
|
|
40059
|
+
if (isAmountCellValue(cellValue)) {
|
|
40060
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MoneySpan, { ellipsis: true, amount: cellValue.value });
|
|
40061
|
+
}
|
|
40062
|
+
if (isEmptyCellValue(cellValue)) {
|
|
40063
|
+
return null;
|
|
40064
|
+
}
|
|
40065
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Span, { ellipsis: true, children: String(cellValue.value) });
|
|
40066
|
+
}
|
|
40067
|
+
});
|
|
40068
|
+
const makeGroupColumn = (col) => ({
|
|
40069
|
+
id: col.columnKey,
|
|
40070
|
+
header: col.displayName,
|
|
40071
|
+
columns: buildNestedColumnConfig(col.columns)
|
|
40072
|
+
});
|
|
40073
|
+
const isGroupColumn = (col) => col.columns !== void 0 && col.columns.length > 0;
|
|
40074
|
+
const buildNestedColumnConfig = (columns) => {
|
|
40075
|
+
return columns.map((col) => {
|
|
40076
|
+
if (isGroupColumn(col)) {
|
|
40077
|
+
return makeGroupColumn(col);
|
|
40078
|
+
}
|
|
40079
|
+
return makeLeafColumn(col);
|
|
40080
|
+
});
|
|
40081
|
+
};
|
|
40082
|
+
const buildColumnConfig = (columns) => {
|
|
40083
|
+
const displayNameColumn = {
|
|
40084
|
+
id: "displayName",
|
|
40085
|
+
header: "",
|
|
40005
40086
|
cell: (row) => /* @__PURE__ */ jsxRuntime.jsx(Span, { weight: row.depth === 0 ? "bold" : "normal", ellipsis: true, children: row.original.displayName }),
|
|
40006
40087
|
isRowHeader: true
|
|
40007
|
-
}
|
|
40008
|
-
[
|
|
40009
|
-
"Value"
|
|
40010
|
-
/* Value */
|
|
40011
|
-
]: {
|
|
40012
|
-
id: "Value",
|
|
40013
|
-
header: "Amount",
|
|
40014
|
-
cell: (row) => /* @__PURE__ */ jsxRuntime.jsx(MoneySpan, { amount: row.original.value })
|
|
40015
|
-
}
|
|
40088
|
+
};
|
|
40089
|
+
return [displayNameColumn, ...buildNestedColumnConfig(columns)];
|
|
40016
40090
|
};
|
|
40017
|
-
const getSubRows = (
|
|
40018
|
-
const UnifiedReportTable = () => {
|
|
40019
|
-
const _a = useUnifiedReportWithDateParams(), { report } = _a, dateParams = __objRest(_a, ["report"]);
|
|
40091
|
+
const getSubRows = (row) => row.rows ? asMutable(row.rows) : void 0;
|
|
40092
|
+
const UnifiedReportTable = ({ dateSelectionMode }) => {
|
|
40093
|
+
const _a = useUnifiedReportWithDateParams({ dateSelectionMode }), { report } = _a, dateParams = __objRest(_a, ["report"]);
|
|
40020
40094
|
const { data, isLoading, isError, refetch } = useUnifiedReport(__spreadValues({ report }, dateParams));
|
|
40021
40095
|
const { setExpanded } = react.useContext(ExpandableDataTableContext);
|
|
40022
|
-
const
|
|
40096
|
+
const mutableRows = (data == null ? void 0 : data.rows) ? asMutable(data.rows) : void 0;
|
|
40097
|
+
const columnConfig = react.useMemo(() => data ? buildColumnConfig(data.columns) : [], [data]);
|
|
40023
40098
|
react.useEffect(() => {
|
|
40024
|
-
if (
|
|
40025
|
-
setExpanded(Object.fromEntries(
|
|
40099
|
+
if (mutableRows !== void 0) {
|
|
40100
|
+
setExpanded(Object.fromEntries(mutableRows.map((d) => [d.rowKey, true])));
|
|
40026
40101
|
}
|
|
40027
|
-
}, [
|
|
40102
|
+
}, [mutableRows, setExpanded]);
|
|
40028
40103
|
const UnifiedReportEmptyState = react.useCallback(() => {
|
|
40029
40104
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
40030
40105
|
DataState,
|
|
@@ -40052,17 +40127,17 @@ const UnifiedReportTable = () => {
|
|
|
40052
40127
|
ExpandableDataTable,
|
|
40053
40128
|
{
|
|
40054
40129
|
ariaLabel: "Report",
|
|
40055
|
-
data:
|
|
40130
|
+
data: mutableRows,
|
|
40056
40131
|
isLoading: data === void 0 || isLoading,
|
|
40057
40132
|
isError,
|
|
40058
|
-
columnConfig
|
|
40133
|
+
columnConfig,
|
|
40059
40134
|
componentName: COMPONENT_NAME$2,
|
|
40060
40135
|
slots: {
|
|
40061
40136
|
ErrorState: UnifiedReportErrorState,
|
|
40062
40137
|
EmptyState: UnifiedReportEmptyState
|
|
40063
40138
|
},
|
|
40064
40139
|
getSubRows,
|
|
40065
|
-
|
|
40140
|
+
getRowId: (row) => row.rowKey
|
|
40066
40141
|
}
|
|
40067
40142
|
);
|
|
40068
40143
|
};
|
|
@@ -40141,10 +40216,10 @@ function downloadReport(apiUrl, accessToken, businessId, unifiedReportParams) {
|
|
|
40141
40216
|
});
|
|
40142
40217
|
}
|
|
40143
40218
|
}
|
|
40144
|
-
function useUnifiedReportDownload({ onSuccess }
|
|
40219
|
+
function useUnifiedReportDownload({ dateSelectionMode, onSuccess }) {
|
|
40145
40220
|
const { data: auth } = useAuth();
|
|
40146
40221
|
const { businessId } = useLayerContext();
|
|
40147
|
-
const reportWithDateParams = useUnifiedReportWithDateParams();
|
|
40222
|
+
const reportWithDateParams = useUnifiedReportWithDateParams({ dateSelectionMode });
|
|
40148
40223
|
const rawMutationResponse = useSWRMutation(
|
|
40149
40224
|
() => buildKey$a(__spreadProps(__spreadValues({}, auth), {
|
|
40150
40225
|
businessId,
|
|
@@ -40161,9 +40236,10 @@ function useUnifiedReportDownload({ onSuccess } = {}) {
|
|
|
40161
40236
|
);
|
|
40162
40237
|
return new DownloadUnifiedReportSWRResponse(rawMutationResponse);
|
|
40163
40238
|
}
|
|
40164
|
-
function UnifiedReportDownloadButton() {
|
|
40239
|
+
function UnifiedReportDownloadButton({ dateSelectionMode }) {
|
|
40165
40240
|
const { invisibleDownloadRef, triggerInvisibleDownload } = useInvisibleDownload();
|
|
40166
40241
|
const { trigger, isMutating, isError } = useUnifiedReportDownload({
|
|
40242
|
+
dateSelectionMode,
|
|
40167
40243
|
onSuccess: ({ presignedUrl }) => triggerInvisibleDownload({ url: presignedUrl })
|
|
40168
40244
|
});
|
|
40169
40245
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -40185,7 +40261,7 @@ function UnifiedReportDownloadButton() {
|
|
|
40185
40261
|
/* @__PURE__ */ jsxRuntime.jsx(InvisibleDownload, { ref: invisibleDownloadRef })
|
|
40186
40262
|
] });
|
|
40187
40263
|
}
|
|
40188
|
-
const UnifiedReportTableHeader = () => {
|
|
40264
|
+
const UnifiedReportTableHeader = ({ dateSelectionMode }) => {
|
|
40189
40265
|
const dateVariant = useUnifiedReportDateVariant();
|
|
40190
40266
|
const { expanded, setExpanded } = react.useContext(ExpandableDataTableContext);
|
|
40191
40267
|
const shouldCollapse = expanded === true;
|
|
@@ -40197,17 +40273,17 @@ const UnifiedReportTableHeader = () => {
|
|
|
40197
40273
|
}
|
|
40198
40274
|
}, [setExpanded, shouldCollapse]);
|
|
40199
40275
|
return /* @__PURE__ */ jsxRuntime.jsxs(HStack, { fluid: true, justify: "space-between", align: "center", className: "Layer__UnifiedReport__Header", children: [
|
|
40200
|
-
/* @__PURE__ */ jsxRuntime.jsx(HStack, { pi: "md", children: dateVariant === UnifiedReportDateVariant.DateRange ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
40276
|
+
/* @__PURE__ */ jsxRuntime.jsx(HStack, { pi: "md", children: dateVariant === UnifiedReportDateVariant.DateRange ? /* @__PURE__ */ jsxRuntime.jsx(CombinedDateRangeSelection, { mode: dateSelectionMode }) : /* @__PURE__ */ jsxRuntime.jsx(CombinedDateSelection, { mode: dateSelectionMode }) }),
|
|
40201
40277
|
/* @__PURE__ */ jsxRuntime.jsxs(HStack, { pi: "md", className: "Layer__UnifiedReport__Header__SecondaryActions", children: [
|
|
40202
40278
|
/* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "outlined", onClick: onClickExpandOrCollapse, children: shouldCollapse ? "Collapse All" : "Expand All" }),
|
|
40203
|
-
/* @__PURE__ */ jsxRuntime.jsx(UnifiedReportDownloadButton, {})
|
|
40279
|
+
/* @__PURE__ */ jsxRuntime.jsx(UnifiedReportDownloadButton, { dateSelectionMode })
|
|
40204
40280
|
] })
|
|
40205
40281
|
] });
|
|
40206
40282
|
};
|
|
40207
|
-
const UnifiedReport = () => {
|
|
40283
|
+
const UnifiedReport = ({ dateSelectionMode }) => {
|
|
40208
40284
|
return /* @__PURE__ */ jsxRuntime.jsx(Container, { name: "UnifiedReport", children: /* @__PURE__ */ jsxRuntime.jsx(UnifiedReportStoreProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(ExpandableDataTableProvider, { children: [
|
|
40209
|
-
/* @__PURE__ */ jsxRuntime.jsx(UnifiedReportTableHeader, {}),
|
|
40210
|
-
/* @__PURE__ */ jsxRuntime.jsx(UnifiedReportTable, {})
|
|
40285
|
+
/* @__PURE__ */ jsxRuntime.jsx(UnifiedReportTableHeader, { dateSelectionMode }),
|
|
40286
|
+
/* @__PURE__ */ jsxRuntime.jsx(UnifiedReportTable, { dateSelectionMode })
|
|
40211
40287
|
] }) }) });
|
|
40212
40288
|
};
|
|
40213
40289
|
const AccountingOverview = ({
|
|
@@ -43950,80 +44026,59 @@ const TripsTableHeaderMenu = () => {
|
|
|
43950
44026
|
);
|
|
43951
44027
|
};
|
|
43952
44028
|
const COMPONENT_NAME = "TripsTable";
|
|
43953
|
-
const getColumnConfig = ({ onSelectTrip, onDeleteTrip }) =>
|
|
43954
|
-
|
|
43955
|
-
"TripDate"
|
|
43956
|
-
/* TripDate */
|
|
43957
|
-
]: {
|
|
44029
|
+
const getColumnConfig = ({ onSelectTrip, onDeleteTrip }) => [
|
|
44030
|
+
{
|
|
43958
44031
|
id: "TripDate",
|
|
43959
44032
|
header: "Date",
|
|
43960
|
-
cell: (row) => formatCalendarDate(row.tripDate)
|
|
44033
|
+
cell: (row) => formatCalendarDate(row.original.tripDate)
|
|
43961
44034
|
},
|
|
43962
|
-
|
|
43963
|
-
"Vehicle"
|
|
43964
|
-
/* Vehicle */
|
|
43965
|
-
]: {
|
|
44035
|
+
{
|
|
43966
44036
|
id: "Vehicle",
|
|
43967
44037
|
header: "Vehicle",
|
|
43968
|
-
cell: (row) => /* @__PURE__ */ jsxRuntime.jsx(Span, { ellipsis: true, withTooltip: true, children: getVehicleDisplayName(row.vehicle) }),
|
|
44038
|
+
cell: (row) => /* @__PURE__ */ jsxRuntime.jsx(Span, { ellipsis: true, withTooltip: true, children: getVehicleDisplayName(row.original.vehicle) }),
|
|
43969
44039
|
isRowHeader: true
|
|
43970
44040
|
},
|
|
43971
|
-
|
|
43972
|
-
"Distance"
|
|
43973
|
-
/* Distance */
|
|
43974
|
-
]: {
|
|
44041
|
+
{
|
|
43975
44042
|
id: "Distance",
|
|
43976
44043
|
header: "Distance",
|
|
43977
|
-
cell: (row) => /* @__PURE__ */ jsxRuntime.jsx(Span, { align: "right", children: formatDistance(row.distance) })
|
|
44044
|
+
cell: (row) => /* @__PURE__ */ jsxRuntime.jsx(Span, { align: "right", children: formatDistance(row.original.distance) })
|
|
43978
44045
|
},
|
|
43979
|
-
|
|
43980
|
-
"Purpose"
|
|
43981
|
-
/* Purpose */
|
|
43982
|
-
]: {
|
|
44046
|
+
{
|
|
43983
44047
|
id: "Purpose",
|
|
43984
44048
|
header: "Purpose",
|
|
43985
|
-
cell: (row) => getPurposeLabel(row.purpose)
|
|
44049
|
+
cell: (row) => getPurposeLabel(row.original.purpose)
|
|
43986
44050
|
},
|
|
43987
|
-
|
|
43988
|
-
"Address"
|
|
43989
|
-
/* Address */
|
|
43990
|
-
]: {
|
|
44051
|
+
{
|
|
43991
44052
|
id: "Address",
|
|
43992
44053
|
header: "Address",
|
|
43993
44054
|
cell: (row) => {
|
|
43994
44055
|
return /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "3xs", overflow: "auto", children: [
|
|
43995
|
-
row.startAddress && /* @__PURE__ */ jsxRuntime.jsxs(Span, { ellipsis: true, size: "sm", withTooltip: true, children: [
|
|
44056
|
+
row.original.startAddress && /* @__PURE__ */ jsxRuntime.jsxs(Span, { ellipsis: true, size: "sm", withTooltip: true, children: [
|
|
43996
44057
|
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Start:" }),
|
|
43997
44058
|
" ",
|
|
43998
|
-
row.startAddress
|
|
44059
|
+
row.original.startAddress
|
|
43999
44060
|
] }),
|
|
44000
|
-
row.endAddress && /* @__PURE__ */ jsxRuntime.jsxs(Span, { ellipsis: true, size: "sm", withTooltip: true, children: [
|
|
44061
|
+
row.original.endAddress && /* @__PURE__ */ jsxRuntime.jsxs(Span, { ellipsis: true, size: "sm", withTooltip: true, children: [
|
|
44001
44062
|
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "End:" }),
|
|
44002
44063
|
" ",
|
|
44003
|
-
row.endAddress
|
|
44064
|
+
row.original.endAddress
|
|
44004
44065
|
] })
|
|
44005
44066
|
] });
|
|
44006
44067
|
}
|
|
44007
44068
|
},
|
|
44008
|
-
|
|
44009
|
-
"Description"
|
|
44010
|
-
/* Description */
|
|
44011
|
-
]: {
|
|
44069
|
+
{
|
|
44012
44070
|
id: "Description",
|
|
44013
44071
|
header: "Description",
|
|
44014
|
-
cell: (row) => /* @__PURE__ */ jsxRuntime.jsx(Span, { ellipsis: true, withTooltip: true, children: row.description })
|
|
44072
|
+
cell: (row) => /* @__PURE__ */ jsxRuntime.jsx(Span, { ellipsis: true, withTooltip: true, children: row.original.description })
|
|
44015
44073
|
},
|
|
44016
|
-
|
|
44017
|
-
"Actions"
|
|
44018
|
-
/* Actions */
|
|
44019
|
-
]: {
|
|
44074
|
+
{
|
|
44020
44075
|
id: "Actions",
|
|
44021
44076
|
cell: (row) => /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "3xs", children: [
|
|
44022
|
-
/* @__PURE__ */ jsxRuntime.jsx(Button, { inset: true, icon: true, onPress: () => onSelectTrip(row), "aria-label": "View trip", variant: "ghost", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Edit, { size: 20 }) }),
|
|
44023
|
-
/* @__PURE__ */ jsxRuntime.jsx(Button, { inset: true, icon: true, onPress: () => onDeleteTrip(row), "aria-label": "Delete trip", variant: "ghost", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { size: 20 }) })
|
|
44077
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button, { inset: true, icon: true, onPress: () => onSelectTrip(row.original), "aria-label": "View trip", variant: "ghost", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Edit, { size: 20 }) }),
|
|
44078
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button, { inset: true, icon: true, onPress: () => onDeleteTrip(row.original), "aria-label": "Delete trip", variant: "ghost", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { size: 20 }) })
|
|
44024
44079
|
] })
|
|
44025
44080
|
}
|
|
44026
|
-
|
|
44081
|
+
];
|
|
44027
44082
|
const TripsTable = () => {
|
|
44028
44083
|
var _a;
|
|
44029
44084
|
const [isTripDrawerOpen, setIsTripDrawerOpen] = react.useState(false);
|
|
@@ -45506,7 +45561,7 @@ const BusinessProvider = ({
|
|
|
45506
45561
|
hasBeenTouched,
|
|
45507
45562
|
resetCaches
|
|
45508
45563
|
} = useDataSync();
|
|
45509
|
-
const globalDateRange = useGlobalDateRange({
|
|
45564
|
+
const globalDateRange = useGlobalDateRange({ dateSelectionMode: "full" });
|
|
45510
45565
|
const { setDateRange } = useGlobalDateRangeActions();
|
|
45511
45566
|
const dateRange = react.useMemo(() => ({
|
|
45512
45567
|
range: globalDateRange,
|