@layerfi/components 0.1.13 → 0.1.14
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/esm/index.js +653 -299
- package/dist/esm/index.js.map +4 -4
- package/dist/index.d.ts +64 -2
- package/dist/index.js +911 -557
- package/dist/index.js.map +4 -4
- package/dist/styles/index.css +20 -2
- package/dist/styles/index.css.map +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4332,7 +4332,7 @@ var useLinkedAccounts = () => {
|
|
|
4332
4332
|
const exchangePublicToken = async (publicToken, metadata) => {
|
|
4333
4333
|
await Layer.exchangePlaidPublicToken(apiUrl, auth?.access_token, {
|
|
4334
4334
|
params: { businessId },
|
|
4335
|
-
body: { public_token: publicToken,
|
|
4335
|
+
body: { public_token: publicToken, institution: metadata.institution }
|
|
4336
4336
|
});
|
|
4337
4337
|
refetchAccounts();
|
|
4338
4338
|
};
|
|
@@ -4974,7 +4974,7 @@ var LinkedAccounts = ({ asWidget, elevated }) => {
|
|
|
4974
4974
|
};
|
|
4975
4975
|
|
|
4976
4976
|
// src/components/ProfitAndLoss/ProfitAndLoss.tsx
|
|
4977
|
-
var
|
|
4977
|
+
var import_react65 = __toESM(require("react"));
|
|
4978
4978
|
|
|
4979
4979
|
// src/hooks/useProfitAndLoss/useProfitAndLoss.tsx
|
|
4980
4980
|
var import_react51 = require("react");
|
|
@@ -5032,12 +5032,12 @@ var applyShare = (items, total) => {
|
|
|
5032
5032
|
});
|
|
5033
5033
|
};
|
|
5034
5034
|
|
|
5035
|
-
// src/hooks/useProfitAndLoss/
|
|
5035
|
+
// src/hooks/useProfitAndLoss/useProfitAndLossQuery.tsx
|
|
5036
5036
|
var import_date_fns10 = require("date-fns");
|
|
5037
5037
|
var import_swr5 = __toESM(require("swr"));
|
|
5038
|
-
var
|
|
5039
|
-
startDate
|
|
5040
|
-
endDate
|
|
5038
|
+
var useProfitAndLossQuery = ({
|
|
5039
|
+
startDate,
|
|
5040
|
+
endDate,
|
|
5041
5041
|
tagFilter,
|
|
5042
5042
|
reportingBasis
|
|
5043
5043
|
} = {
|
|
@@ -5045,17 +5045,6 @@ var useProfitAndLoss = ({
|
|
|
5045
5045
|
endDate: (0, import_date_fns10.endOfMonth)(/* @__PURE__ */ new Date())
|
|
5046
5046
|
}) => {
|
|
5047
5047
|
const { auth, businessId, apiUrl } = useLayerContext();
|
|
5048
|
-
const [startDate, setStartDate] = (0, import_react51.useState)(
|
|
5049
|
-
initialStartDate || (0, import_date_fns10.startOfMonth)(Date.now())
|
|
5050
|
-
);
|
|
5051
|
-
const [endDate, setEndDate] = (0, import_react51.useState)(
|
|
5052
|
-
initialEndDate || (0, import_date_fns10.endOfMonth)(Date.now())
|
|
5053
|
-
);
|
|
5054
|
-
const [filters, setFilters] = (0, import_react51.useState)({
|
|
5055
|
-
expenses: void 0,
|
|
5056
|
-
revenue: void 0
|
|
5057
|
-
});
|
|
5058
|
-
const [sidebarScope, setSidebarScope] = (0, import_react51.useState)(void 0);
|
|
5059
5048
|
const {
|
|
5060
5049
|
data: rawData,
|
|
5061
5050
|
isLoading,
|
|
@@ -5069,15 +5058,83 @@ var useProfitAndLoss = ({
|
|
|
5069
5058
|
Layer.getProfitAndLoss(apiUrl, auth?.access_token, {
|
|
5070
5059
|
params: {
|
|
5071
5060
|
businessId,
|
|
5072
|
-
startDate: (0, import_date_fns10.formatISO)(startDate),
|
|
5073
|
-
endDate: (0, import_date_fns10.formatISO)(endDate),
|
|
5061
|
+
startDate: (0, import_date_fns10.formatISO)(startDate.valueOf()),
|
|
5062
|
+
endDate: (0, import_date_fns10.formatISO)(endDate.valueOf()),
|
|
5074
5063
|
tagKey: tagFilter?.key,
|
|
5075
5064
|
tagValues: tagFilter?.values?.join(","),
|
|
5076
5065
|
reportingBasis
|
|
5077
5066
|
}
|
|
5078
5067
|
})
|
|
5079
5068
|
);
|
|
5080
|
-
const
|
|
5069
|
+
const refetch = () => {
|
|
5070
|
+
mutate();
|
|
5071
|
+
};
|
|
5072
|
+
return {
|
|
5073
|
+
startDate,
|
|
5074
|
+
endDate,
|
|
5075
|
+
data: rawData?.data,
|
|
5076
|
+
isLoading,
|
|
5077
|
+
isValidating,
|
|
5078
|
+
error: rawError,
|
|
5079
|
+
refetch
|
|
5080
|
+
};
|
|
5081
|
+
};
|
|
5082
|
+
|
|
5083
|
+
// src/hooks/useProfitAndLoss/useProfitAndLoss.tsx
|
|
5084
|
+
var import_date_fns11 = require("date-fns");
|
|
5085
|
+
var useProfitAndLoss = ({
|
|
5086
|
+
startDate: initialStartDate,
|
|
5087
|
+
endDate: initialEndDate,
|
|
5088
|
+
tagFilter,
|
|
5089
|
+
reportingBasis,
|
|
5090
|
+
fetchMultipleMonths = false
|
|
5091
|
+
} = {
|
|
5092
|
+
startDate: (0, import_date_fns11.startOfMonth)(/* @__PURE__ */ new Date()),
|
|
5093
|
+
endDate: (0, import_date_fns11.endOfMonth)(/* @__PURE__ */ new Date())
|
|
5094
|
+
}) => {
|
|
5095
|
+
const [startDate, setStartDate] = (0, import_react51.useState)(
|
|
5096
|
+
initialStartDate || (0, import_date_fns11.startOfMonth)(Date.now())
|
|
5097
|
+
);
|
|
5098
|
+
const [endDate, setEndDate] = (0, import_react51.useState)(
|
|
5099
|
+
initialEndDate || (0, import_date_fns11.endOfMonth)(Date.now())
|
|
5100
|
+
);
|
|
5101
|
+
const [filters, setFilters] = (0, import_react51.useState)({
|
|
5102
|
+
expenses: void 0,
|
|
5103
|
+
revenue: void 0
|
|
5104
|
+
});
|
|
5105
|
+
const [sidebarScope, setSidebarScope] = (0, import_react51.useState)(void 0);
|
|
5106
|
+
const { data, isLoading, isValidating, error, refetch } = useProfitAndLossQuery({
|
|
5107
|
+
startDate,
|
|
5108
|
+
endDate,
|
|
5109
|
+
tagFilter,
|
|
5110
|
+
reportingBasis
|
|
5111
|
+
});
|
|
5112
|
+
const changeDateRange = ({
|
|
5113
|
+
startDate: newStartDate,
|
|
5114
|
+
endDate: newEndDate
|
|
5115
|
+
}) => {
|
|
5116
|
+
newStartDate && setStartDate(newStartDate);
|
|
5117
|
+
newEndDate && setEndDate(newEndDate);
|
|
5118
|
+
};
|
|
5119
|
+
const sortBy = (scope, field, direction) => {
|
|
5120
|
+
setFilters({
|
|
5121
|
+
...filters,
|
|
5122
|
+
[scope]: {
|
|
5123
|
+
...filters[scope],
|
|
5124
|
+
sortBy: field,
|
|
5125
|
+
sortDirection: direction ?? filters[scope]?.sortDirection === "desc" ? "asc" : "desc"
|
|
5126
|
+
}
|
|
5127
|
+
});
|
|
5128
|
+
};
|
|
5129
|
+
const setFilterTypes = (scope, types) => {
|
|
5130
|
+
setFilters({
|
|
5131
|
+
...filters,
|
|
5132
|
+
[scope]: {
|
|
5133
|
+
...filters[scope],
|
|
5134
|
+
types
|
|
5135
|
+
}
|
|
5136
|
+
});
|
|
5137
|
+
};
|
|
5081
5138
|
const { filteredDataRevenue, filteredTotalRevenue } = (0, import_react51.useMemo)(() => {
|
|
5082
5139
|
if (!data) {
|
|
5083
5140
|
return { filteredDataRevenue: [], filteredTotalRevenue: void 0 };
|
|
@@ -5152,35 +5209,6 @@ var useProfitAndLoss = ({
|
|
|
5152
5209
|
const withShare = applyShare(sorted, total);
|
|
5153
5210
|
return { filteredDataExpenses: withShare, filteredTotalExpenses: total };
|
|
5154
5211
|
}, [data, startDate, filters, sidebarScope]);
|
|
5155
|
-
const changeDateRange = ({
|
|
5156
|
-
startDate: newStartDate,
|
|
5157
|
-
endDate: newEndDate
|
|
5158
|
-
}) => {
|
|
5159
|
-
newStartDate && setStartDate(newStartDate);
|
|
5160
|
-
newEndDate && setEndDate(newEndDate);
|
|
5161
|
-
};
|
|
5162
|
-
const refetch = () => {
|
|
5163
|
-
mutate();
|
|
5164
|
-
};
|
|
5165
|
-
const sortBy = (scope, field, direction) => {
|
|
5166
|
-
setFilters({
|
|
5167
|
-
...filters,
|
|
5168
|
-
[scope]: {
|
|
5169
|
-
...filters[scope],
|
|
5170
|
-
sortBy: field,
|
|
5171
|
-
sortDirection: direction ?? filters[scope]?.sortDirection === "desc" ? "asc" : "desc"
|
|
5172
|
-
}
|
|
5173
|
-
});
|
|
5174
|
-
};
|
|
5175
|
-
const setFilterTypes = (scope, types) => {
|
|
5176
|
-
setFilters({
|
|
5177
|
-
...filters,
|
|
5178
|
-
[scope]: {
|
|
5179
|
-
...filters[scope],
|
|
5180
|
-
types
|
|
5181
|
-
}
|
|
5182
|
-
});
|
|
5183
|
-
};
|
|
5184
5212
|
return {
|
|
5185
5213
|
data,
|
|
5186
5214
|
filteredDataRevenue,
|
|
@@ -5189,7 +5217,7 @@ var useProfitAndLoss = ({
|
|
|
5189
5217
|
filteredTotalExpenses,
|
|
5190
5218
|
isLoading,
|
|
5191
5219
|
isValidating,
|
|
5192
|
-
error
|
|
5220
|
+
error,
|
|
5193
5221
|
dateRange: { startDate, endDate },
|
|
5194
5222
|
refetch,
|
|
5195
5223
|
changeDateRange,
|
|
@@ -5202,7 +5230,350 @@ var useProfitAndLoss = ({
|
|
|
5202
5230
|
};
|
|
5203
5231
|
|
|
5204
5232
|
// src/components/ProfitAndLossChart/ProfitAndLossChart.tsx
|
|
5205
|
-
var
|
|
5233
|
+
var import_react54 = __toESM(require("react"));
|
|
5234
|
+
|
|
5235
|
+
// src/hooks/useProfitAndLoss/useProfitAndLossLTM.tsx
|
|
5236
|
+
var import_react52 = require("react");
|
|
5237
|
+
var import_date_fns12 = require("date-fns");
|
|
5238
|
+
var buildDates = ({ currentDate }) => {
|
|
5239
|
+
const list = [];
|
|
5240
|
+
for (let i = 11; i > 0; i--) {
|
|
5241
|
+
const startDateWithOffset = (0, import_date_fns12.startOfMonth)((0, import_date_fns12.sub)(currentDate, { months: i }));
|
|
5242
|
+
const endDateWithOffset = (0, import_date_fns12.endOfMonth)((0, import_date_fns12.sub)(currentDate, { months: i }));
|
|
5243
|
+
list.push({
|
|
5244
|
+
startDate: startDateWithOffset,
|
|
5245
|
+
endDate: endDateWithOffset
|
|
5246
|
+
});
|
|
5247
|
+
}
|
|
5248
|
+
list.push({
|
|
5249
|
+
startDate: (0, import_date_fns12.startOfMonth)(currentDate),
|
|
5250
|
+
endDate: (0, import_date_fns12.endOfMonth)(currentDate)
|
|
5251
|
+
});
|
|
5252
|
+
return list;
|
|
5253
|
+
};
|
|
5254
|
+
var useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
|
|
5255
|
+
currentDate: /* @__PURE__ */ new Date()
|
|
5256
|
+
}) => {
|
|
5257
|
+
const { businessId } = useLayerContext();
|
|
5258
|
+
const [loaded, setLoaded] = (0, import_react52.useState)("initial");
|
|
5259
|
+
const dates = (0, import_react52.useMemo)(() => {
|
|
5260
|
+
return buildDates({ currentDate });
|
|
5261
|
+
}, [currentDate, businessId, tagFilter, reportingBasis]);
|
|
5262
|
+
const {
|
|
5263
|
+
data: data0,
|
|
5264
|
+
isLoading: isLoading0,
|
|
5265
|
+
error: error0,
|
|
5266
|
+
startDate: startDate0,
|
|
5267
|
+
endDate: endDate0
|
|
5268
|
+
} = useProfitAndLossQuery({
|
|
5269
|
+
startDate: dates[0].startDate,
|
|
5270
|
+
endDate: dates[0].endDate,
|
|
5271
|
+
tagFilter,
|
|
5272
|
+
reportingBasis
|
|
5273
|
+
});
|
|
5274
|
+
const {
|
|
5275
|
+
data: data1,
|
|
5276
|
+
isLoading: isLoading1,
|
|
5277
|
+
error: error1,
|
|
5278
|
+
startDate: startDate1,
|
|
5279
|
+
endDate: endDate1
|
|
5280
|
+
} = useProfitAndLossQuery({
|
|
5281
|
+
startDate: dates[1].startDate,
|
|
5282
|
+
endDate: dates[1].endDate,
|
|
5283
|
+
tagFilter,
|
|
5284
|
+
reportingBasis
|
|
5285
|
+
});
|
|
5286
|
+
const {
|
|
5287
|
+
data: data2,
|
|
5288
|
+
isLoading: isLoading2,
|
|
5289
|
+
error: error2,
|
|
5290
|
+
startDate: startDate2,
|
|
5291
|
+
endDate: endDate2
|
|
5292
|
+
} = useProfitAndLossQuery({
|
|
5293
|
+
startDate: dates[2].startDate,
|
|
5294
|
+
endDate: dates[2].endDate,
|
|
5295
|
+
tagFilter,
|
|
5296
|
+
reportingBasis
|
|
5297
|
+
});
|
|
5298
|
+
const {
|
|
5299
|
+
data: data3,
|
|
5300
|
+
isLoading: isLoading3,
|
|
5301
|
+
error: error3,
|
|
5302
|
+
startDate: startDate3,
|
|
5303
|
+
endDate: endDate3
|
|
5304
|
+
} = useProfitAndLossQuery({
|
|
5305
|
+
startDate: dates[3].startDate,
|
|
5306
|
+
endDate: dates[3].endDate,
|
|
5307
|
+
tagFilter,
|
|
5308
|
+
reportingBasis
|
|
5309
|
+
});
|
|
5310
|
+
const {
|
|
5311
|
+
data: data4,
|
|
5312
|
+
isLoading: isLoading4,
|
|
5313
|
+
error: error4,
|
|
5314
|
+
startDate: startDate4,
|
|
5315
|
+
endDate: endDate4
|
|
5316
|
+
} = useProfitAndLossQuery({
|
|
5317
|
+
startDate: dates[4].startDate,
|
|
5318
|
+
endDate: dates[4].endDate,
|
|
5319
|
+
tagFilter,
|
|
5320
|
+
reportingBasis
|
|
5321
|
+
});
|
|
5322
|
+
const {
|
|
5323
|
+
data: data5,
|
|
5324
|
+
isLoading: isLoading5,
|
|
5325
|
+
error: error5,
|
|
5326
|
+
startDate: startDate5,
|
|
5327
|
+
endDate: endDate5
|
|
5328
|
+
} = useProfitAndLossQuery({
|
|
5329
|
+
startDate: dates[5].startDate,
|
|
5330
|
+
endDate: dates[5].endDate,
|
|
5331
|
+
tagFilter,
|
|
5332
|
+
reportingBasis
|
|
5333
|
+
});
|
|
5334
|
+
const {
|
|
5335
|
+
data: data6,
|
|
5336
|
+
isLoading: isLoading6,
|
|
5337
|
+
error: error6,
|
|
5338
|
+
startDate: startDate6,
|
|
5339
|
+
endDate: endDate6
|
|
5340
|
+
} = useProfitAndLossQuery({
|
|
5341
|
+
startDate: dates[6].startDate,
|
|
5342
|
+
endDate: dates[6].endDate,
|
|
5343
|
+
tagFilter,
|
|
5344
|
+
reportingBasis
|
|
5345
|
+
});
|
|
5346
|
+
const {
|
|
5347
|
+
data: data7,
|
|
5348
|
+
isLoading: isLoading7,
|
|
5349
|
+
error: error7,
|
|
5350
|
+
startDate: startDate7,
|
|
5351
|
+
endDate: endDate7
|
|
5352
|
+
} = useProfitAndLossQuery({
|
|
5353
|
+
startDate: dates[7].startDate,
|
|
5354
|
+
endDate: dates[7].endDate,
|
|
5355
|
+
tagFilter,
|
|
5356
|
+
reportingBasis
|
|
5357
|
+
});
|
|
5358
|
+
const {
|
|
5359
|
+
data: data8,
|
|
5360
|
+
isLoading: isLoading8,
|
|
5361
|
+
error: error8,
|
|
5362
|
+
startDate: startDate8,
|
|
5363
|
+
endDate: endDate8
|
|
5364
|
+
} = useProfitAndLossQuery({
|
|
5365
|
+
startDate: dates[8].startDate,
|
|
5366
|
+
endDate: dates[8].endDate,
|
|
5367
|
+
tagFilter,
|
|
5368
|
+
reportingBasis
|
|
5369
|
+
});
|
|
5370
|
+
const {
|
|
5371
|
+
data: data9,
|
|
5372
|
+
isLoading: isLoading9,
|
|
5373
|
+
error: error9,
|
|
5374
|
+
startDate: startDate9,
|
|
5375
|
+
endDate: endDate9
|
|
5376
|
+
} = useProfitAndLossQuery({
|
|
5377
|
+
startDate: dates[9].startDate,
|
|
5378
|
+
endDate: dates[9].endDate,
|
|
5379
|
+
tagFilter,
|
|
5380
|
+
reportingBasis
|
|
5381
|
+
});
|
|
5382
|
+
const {
|
|
5383
|
+
data: data10,
|
|
5384
|
+
isLoading: isLoading10,
|
|
5385
|
+
error: error10,
|
|
5386
|
+
startDate: startDate10,
|
|
5387
|
+
endDate: endDate10
|
|
5388
|
+
} = useProfitAndLossQuery({
|
|
5389
|
+
startDate: dates[10].startDate,
|
|
5390
|
+
endDate: dates[10].endDate,
|
|
5391
|
+
tagFilter,
|
|
5392
|
+
reportingBasis
|
|
5393
|
+
});
|
|
5394
|
+
const {
|
|
5395
|
+
data: data11,
|
|
5396
|
+
isLoading: isLoading11,
|
|
5397
|
+
error: error11,
|
|
5398
|
+
startDate: startDate11,
|
|
5399
|
+
endDate: endDate11
|
|
5400
|
+
} = useProfitAndLossQuery({
|
|
5401
|
+
startDate: dates[11].startDate,
|
|
5402
|
+
endDate: dates[11].endDate,
|
|
5403
|
+
tagFilter,
|
|
5404
|
+
reportingBasis
|
|
5405
|
+
});
|
|
5406
|
+
const { data, isLoading, error } = (0, import_react52.useMemo)(() => {
|
|
5407
|
+
return {
|
|
5408
|
+
data: [
|
|
5409
|
+
{
|
|
5410
|
+
data: data0,
|
|
5411
|
+
isLoading: isLoading0,
|
|
5412
|
+
error: error0,
|
|
5413
|
+
startDate: startDate0,
|
|
5414
|
+
endDate: endDate0
|
|
5415
|
+
},
|
|
5416
|
+
{
|
|
5417
|
+
data: data1,
|
|
5418
|
+
isLoading: isLoading1,
|
|
5419
|
+
error: error1,
|
|
5420
|
+
startDate: startDate1,
|
|
5421
|
+
endDate: endDate1
|
|
5422
|
+
},
|
|
5423
|
+
{
|
|
5424
|
+
data: data2,
|
|
5425
|
+
isLoading: isLoading2,
|
|
5426
|
+
error: error2,
|
|
5427
|
+
startDate: startDate2,
|
|
5428
|
+
endDate: endDate2
|
|
5429
|
+
},
|
|
5430
|
+
{
|
|
5431
|
+
data: data3,
|
|
5432
|
+
isLoading: isLoading3,
|
|
5433
|
+
error: error3,
|
|
5434
|
+
startDate: startDate3,
|
|
5435
|
+
endDate: endDate3
|
|
5436
|
+
},
|
|
5437
|
+
{
|
|
5438
|
+
data: data4,
|
|
5439
|
+
isLoading: isLoading4,
|
|
5440
|
+
error: error4,
|
|
5441
|
+
startDate: startDate4,
|
|
5442
|
+
endDate: endDate4
|
|
5443
|
+
},
|
|
5444
|
+
{
|
|
5445
|
+
data: data5,
|
|
5446
|
+
isLoading: isLoading5,
|
|
5447
|
+
error: error5,
|
|
5448
|
+
startDate: startDate5,
|
|
5449
|
+
endDate: endDate5
|
|
5450
|
+
},
|
|
5451
|
+
{
|
|
5452
|
+
data: data6,
|
|
5453
|
+
isLoading: isLoading6,
|
|
5454
|
+
error: error6,
|
|
5455
|
+
startDate: startDate6,
|
|
5456
|
+
endDate: endDate6
|
|
5457
|
+
},
|
|
5458
|
+
{
|
|
5459
|
+
data: data7,
|
|
5460
|
+
isLoading: isLoading7,
|
|
5461
|
+
error: error7,
|
|
5462
|
+
startDate: startDate7,
|
|
5463
|
+
endDate: endDate7
|
|
5464
|
+
},
|
|
5465
|
+
{
|
|
5466
|
+
data: data8,
|
|
5467
|
+
isLoading: isLoading8,
|
|
5468
|
+
error: error8,
|
|
5469
|
+
startDate: startDate8,
|
|
5470
|
+
endDate: endDate8
|
|
5471
|
+
},
|
|
5472
|
+
{
|
|
5473
|
+
data: data9,
|
|
5474
|
+
isLoading: isLoading9,
|
|
5475
|
+
error: error9,
|
|
5476
|
+
startDate: startDate9,
|
|
5477
|
+
endDate: endDate9
|
|
5478
|
+
},
|
|
5479
|
+
{
|
|
5480
|
+
data: data10,
|
|
5481
|
+
isLoading: isLoading10,
|
|
5482
|
+
error: error10,
|
|
5483
|
+
startDate: startDate10,
|
|
5484
|
+
endDate: endDate10
|
|
5485
|
+
},
|
|
5486
|
+
{
|
|
5487
|
+
data: data11,
|
|
5488
|
+
isLoading: isLoading11,
|
|
5489
|
+
error: error11,
|
|
5490
|
+
startDate: startDate11,
|
|
5491
|
+
endDate: endDate11
|
|
5492
|
+
}
|
|
5493
|
+
],
|
|
5494
|
+
error: [
|
|
5495
|
+
error0,
|
|
5496
|
+
error1,
|
|
5497
|
+
error2,
|
|
5498
|
+
error3,
|
|
5499
|
+
error4,
|
|
5500
|
+
error5,
|
|
5501
|
+
error6,
|
|
5502
|
+
error7,
|
|
5503
|
+
error8,
|
|
5504
|
+
error9,
|
|
5505
|
+
error10,
|
|
5506
|
+
error11
|
|
5507
|
+
].find((x) => !!x),
|
|
5508
|
+
isLoading: [
|
|
5509
|
+
isLoading0,
|
|
5510
|
+
isLoading1,
|
|
5511
|
+
isLoading2,
|
|
5512
|
+
isLoading3,
|
|
5513
|
+
isLoading4,
|
|
5514
|
+
isLoading5,
|
|
5515
|
+
isLoading6,
|
|
5516
|
+
isLoading7,
|
|
5517
|
+
isLoading8,
|
|
5518
|
+
isLoading9,
|
|
5519
|
+
isLoading10,
|
|
5520
|
+
isLoading11
|
|
5521
|
+
].find((x) => !!x)
|
|
5522
|
+
};
|
|
5523
|
+
}, [
|
|
5524
|
+
data0,
|
|
5525
|
+
data1,
|
|
5526
|
+
data2,
|
|
5527
|
+
data3,
|
|
5528
|
+
data4,
|
|
5529
|
+
data5,
|
|
5530
|
+
data6,
|
|
5531
|
+
data7,
|
|
5532
|
+
data8,
|
|
5533
|
+
data9,
|
|
5534
|
+
data10,
|
|
5535
|
+
data11,
|
|
5536
|
+
isLoading0,
|
|
5537
|
+
isLoading1,
|
|
5538
|
+
isLoading2,
|
|
5539
|
+
isLoading3,
|
|
5540
|
+
isLoading4,
|
|
5541
|
+
isLoading5,
|
|
5542
|
+
isLoading6,
|
|
5543
|
+
isLoading7,
|
|
5544
|
+
isLoading8,
|
|
5545
|
+
isLoading9,
|
|
5546
|
+
isLoading10,
|
|
5547
|
+
isLoading11,
|
|
5548
|
+
error0,
|
|
5549
|
+
error1,
|
|
5550
|
+
error2,
|
|
5551
|
+
error3,
|
|
5552
|
+
error4,
|
|
5553
|
+
error5,
|
|
5554
|
+
error6,
|
|
5555
|
+
error7,
|
|
5556
|
+
error8,
|
|
5557
|
+
error9,
|
|
5558
|
+
error10,
|
|
5559
|
+
error11
|
|
5560
|
+
]);
|
|
5561
|
+
(0, import_react52.useEffect)(() => {
|
|
5562
|
+
if (isLoading && loaded === "initial") {
|
|
5563
|
+
setLoaded("loading");
|
|
5564
|
+
return;
|
|
5565
|
+
}
|
|
5566
|
+
if (!isLoading && data && !data.find((x) => !x.data && !x.error)) {
|
|
5567
|
+
setLoaded("complete");
|
|
5568
|
+
}
|
|
5569
|
+
}, [data, isLoading]);
|
|
5570
|
+
return {
|
|
5571
|
+
data,
|
|
5572
|
+
isLoading,
|
|
5573
|
+
loaded,
|
|
5574
|
+
error
|
|
5575
|
+
};
|
|
5576
|
+
};
|
|
5206
5577
|
|
|
5207
5578
|
// src/utils/format.ts
|
|
5208
5579
|
var capitalizeFirstLetter = (text) => text.charAt(0).toUpperCase() + text.slice(1);
|
|
@@ -5243,211 +5614,188 @@ var humanizeEnum = (text) => {
|
|
|
5243
5614
|
};
|
|
5244
5615
|
|
|
5245
5616
|
// src/components/ProfitAndLossChart/Indicator.tsx
|
|
5246
|
-
var
|
|
5617
|
+
var import_react53 = __toESM(require("react"));
|
|
5247
5618
|
var emptyViewBox = { x: 0, y: 0, width: 0, height: 0 };
|
|
5248
5619
|
var Indicator = ({
|
|
5249
|
-
viewBox = {},
|
|
5250
5620
|
className,
|
|
5251
5621
|
animateFrom,
|
|
5252
|
-
setAnimateFrom
|
|
5622
|
+
setAnimateFrom,
|
|
5623
|
+
customCursorSize,
|
|
5624
|
+
setCustomCursorSize,
|
|
5625
|
+
viewBox = {}
|
|
5253
5626
|
}) => {
|
|
5254
5627
|
if (!className?.match(/selected/)) {
|
|
5255
5628
|
return null;
|
|
5256
5629
|
}
|
|
5630
|
+
const [opacityIndicator, setOpacityIndicator] = (0, import_react53.useState)(0);
|
|
5257
5631
|
const { x: animateTo = 0, width = 0 } = "x" in viewBox ? viewBox : emptyViewBox;
|
|
5258
5632
|
const margin = width > 12 ? 4 : 1;
|
|
5259
5633
|
const boxWidth = width * 2 + margin;
|
|
5260
5634
|
const multiplier = width > 12 ? 1.2 : 1;
|
|
5261
5635
|
const xOffset = (boxWidth * multiplier - boxWidth) / 2;
|
|
5262
|
-
const borderRadius =
|
|
5263
|
-
|
|
5636
|
+
const borderRadius = 6;
|
|
5637
|
+
const rectWidth = `${boxWidth * multiplier}px`;
|
|
5638
|
+
const rectHeight = "calc(100% - 38px)";
|
|
5639
|
+
(0, import_react53.useEffect)(() => {
|
|
5640
|
+
if (Math.abs(animateTo - animateFrom) < 30) {
|
|
5641
|
+
setOpacityIndicator(0);
|
|
5642
|
+
}
|
|
5264
5643
|
setAnimateFrom(animateTo);
|
|
5644
|
+
setTimeout(() => {
|
|
5645
|
+
setOpacityIndicator(1);
|
|
5646
|
+
}, 200);
|
|
5265
5647
|
}, [animateTo]);
|
|
5648
|
+
const rectRef = (ref) => {
|
|
5649
|
+
if (ref) {
|
|
5650
|
+
const refRectWidth = ref.getBoundingClientRect().width;
|
|
5651
|
+
const refRectHeight = ref.getBoundingClientRect().height;
|
|
5652
|
+
if (customCursorSize.width !== refRectWidth || customCursorSize.height !== refRectHeight) {
|
|
5653
|
+
setCustomCursorSize(refRectWidth, refRectHeight, actualX - xOffset);
|
|
5654
|
+
}
|
|
5655
|
+
}
|
|
5656
|
+
};
|
|
5266
5657
|
const actualX = animateFrom === -1 ? animateTo : animateFrom;
|
|
5267
|
-
return /* @__PURE__ */
|
|
5658
|
+
return /* @__PURE__ */ import_react53.default.createElement(
|
|
5268
5659
|
"rect",
|
|
5269
5660
|
{
|
|
5661
|
+
ref: rectRef,
|
|
5270
5662
|
className: "Layer__profit-and-loss-chart__selection-indicator",
|
|
5271
5663
|
rx: borderRadius,
|
|
5272
5664
|
ry: borderRadius,
|
|
5273
5665
|
style: {
|
|
5274
|
-
width:
|
|
5666
|
+
width: rectWidth,
|
|
5275
5667
|
// @ts-expect-error -- y is fine but x apparently isn't!
|
|
5276
5668
|
x: actualX - xOffset,
|
|
5277
|
-
y:
|
|
5278
|
-
height:
|
|
5669
|
+
y: 1,
|
|
5670
|
+
height: rectHeight,
|
|
5671
|
+
opacity: opacityIndicator
|
|
5279
5672
|
}
|
|
5280
5673
|
}
|
|
5281
5674
|
);
|
|
5282
5675
|
};
|
|
5283
5676
|
|
|
5284
5677
|
// src/components/ProfitAndLossChart/ProfitAndLossChart.tsx
|
|
5285
|
-
var
|
|
5678
|
+
var import_classnames27 = __toESM(require("classnames"));
|
|
5679
|
+
var import_date_fns13 = require("date-fns");
|
|
5286
5680
|
var import_recharts = require("recharts");
|
|
5287
5681
|
var barGap = 4;
|
|
5288
5682
|
var barSize = 20;
|
|
5289
5683
|
var ProfitAndLossChart = () => {
|
|
5290
5684
|
const { getColor } = useLayerContext();
|
|
5291
|
-
const { changeDateRange, dateRange } = (0,
|
|
5292
|
-
const
|
|
5685
|
+
const { changeDateRange, dateRange } = (0, import_react54.useContext)(ProfitAndLoss.Context);
|
|
5686
|
+
const [customCursorSize, setCustomCursorSize] = (0, import_react54.useState)({
|
|
5687
|
+
width: 0,
|
|
5688
|
+
height: 0,
|
|
5689
|
+
x: 0
|
|
5690
|
+
});
|
|
5691
|
+
const [barAnimActive, setBarAnimActive] = (0, import_react54.useState)(true);
|
|
5293
5692
|
const startSelectionMonth = dateRange.startDate.getMonth();
|
|
5294
5693
|
const endSelectionMonth = dateRange.endDate.getMonth();
|
|
5295
|
-
const
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
})?.data
|
|
5307
|
-
);
|
|
5308
|
-
monthData.push(
|
|
5309
|
-
useProfitAndLoss({
|
|
5310
|
-
startDate: (0, import_date_fns11.startOfMonth)((0, import_date_fns11.sub)(thisMonth, { months: 9 })),
|
|
5311
|
-
endDate: (0, import_date_fns11.endOfMonth)((0, import_date_fns11.sub)(thisMonth, { months: 9 }))
|
|
5312
|
-
})?.data
|
|
5313
|
-
);
|
|
5314
|
-
monthData.push(
|
|
5315
|
-
useProfitAndLoss({
|
|
5316
|
-
startDate: (0, import_date_fns11.startOfMonth)((0, import_date_fns11.sub)(thisMonth, { months: 8 })),
|
|
5317
|
-
endDate: (0, import_date_fns11.endOfMonth)((0, import_date_fns11.sub)(thisMonth, { months: 8 }))
|
|
5318
|
-
})?.data
|
|
5319
|
-
);
|
|
5320
|
-
monthData.push(
|
|
5321
|
-
useProfitAndLoss({
|
|
5322
|
-
startDate: (0, import_date_fns11.startOfMonth)((0, import_date_fns11.sub)(thisMonth, { months: 7 })),
|
|
5323
|
-
endDate: (0, import_date_fns11.endOfMonth)((0, import_date_fns11.sub)(thisMonth, { months: 7 }))
|
|
5324
|
-
})?.data
|
|
5325
|
-
);
|
|
5326
|
-
monthData.push(
|
|
5327
|
-
useProfitAndLoss({
|
|
5328
|
-
startDate: (0, import_date_fns11.startOfMonth)((0, import_date_fns11.sub)(thisMonth, { months: 6 })),
|
|
5329
|
-
endDate: (0, import_date_fns11.endOfMonth)((0, import_date_fns11.sub)(thisMonth, { months: 6 }))
|
|
5330
|
-
})?.data
|
|
5331
|
-
);
|
|
5332
|
-
monthData.push(
|
|
5333
|
-
useProfitAndLoss({
|
|
5334
|
-
startDate: (0, import_date_fns11.startOfMonth)((0, import_date_fns11.sub)(thisMonth, { months: 5 })),
|
|
5335
|
-
endDate: (0, import_date_fns11.endOfMonth)((0, import_date_fns11.sub)(thisMonth, { months: 5 }))
|
|
5336
|
-
})?.data
|
|
5337
|
-
);
|
|
5338
|
-
monthData.push(
|
|
5339
|
-
useProfitAndLoss({
|
|
5340
|
-
startDate: (0, import_date_fns11.startOfMonth)((0, import_date_fns11.sub)(thisMonth, { months: 4 })),
|
|
5341
|
-
endDate: (0, import_date_fns11.endOfMonth)((0, import_date_fns11.sub)(thisMonth, { months: 4 }))
|
|
5342
|
-
})?.data
|
|
5343
|
-
);
|
|
5344
|
-
monthData.push(
|
|
5345
|
-
useProfitAndLoss({
|
|
5346
|
-
startDate: (0, import_date_fns11.startOfMonth)((0, import_date_fns11.sub)(thisMonth, { months: 3 })),
|
|
5347
|
-
endDate: (0, import_date_fns11.endOfMonth)((0, import_date_fns11.sub)(thisMonth, { months: 3 }))
|
|
5348
|
-
})?.data
|
|
5349
|
-
);
|
|
5350
|
-
monthData.push(
|
|
5351
|
-
useProfitAndLoss({
|
|
5352
|
-
startDate: (0, import_date_fns11.startOfMonth)((0, import_date_fns11.sub)(thisMonth, { months: 2 })),
|
|
5353
|
-
endDate: (0, import_date_fns11.endOfMonth)((0, import_date_fns11.sub)(thisMonth, { months: 2 }))
|
|
5354
|
-
})?.data
|
|
5355
|
-
);
|
|
5356
|
-
monthData.push(
|
|
5357
|
-
useProfitAndLoss({
|
|
5358
|
-
startDate: (0, import_date_fns11.startOfMonth)((0, import_date_fns11.sub)(thisMonth, { months: 1 })),
|
|
5359
|
-
endDate: (0, import_date_fns11.endOfMonth)((0, import_date_fns11.sub)(thisMonth, { months: 1 }))
|
|
5360
|
-
})?.data
|
|
5361
|
-
);
|
|
5362
|
-
monthData.push(
|
|
5363
|
-
useProfitAndLoss({
|
|
5364
|
-
startDate: thisMonth,
|
|
5365
|
-
endDate: (0, import_date_fns11.endOfMonth)(thisMonth)
|
|
5366
|
-
})?.data
|
|
5367
|
-
);
|
|
5368
|
-
const getMonthName = (pnl) => pnl ? (0, import_date_fns11.format)((0, import_date_fns11.parseISO)(pnl.start_date), "LLL") : "";
|
|
5694
|
+
const { data, loaded } = useProfitAndLossLTM({
|
|
5695
|
+
currentDate: (0, import_date_fns13.startOfMonth)(Date.now())
|
|
5696
|
+
});
|
|
5697
|
+
(0, import_react54.useEffect)(() => {
|
|
5698
|
+
if (loaded === "complete") {
|
|
5699
|
+
setTimeout(() => {
|
|
5700
|
+
setBarAnimActive(false);
|
|
5701
|
+
}, 1e3);
|
|
5702
|
+
}
|
|
5703
|
+
}, [loaded]);
|
|
5704
|
+
const getMonthName = (pnl) => pnl ? (0, import_date_fns13.format)((0, import_date_fns13.parseISO)(pnl.start_date), "LLL") : "";
|
|
5369
5705
|
const summarizePnL = (pnl) => ({
|
|
5370
5706
|
name: getMonthName(pnl),
|
|
5371
5707
|
revenue: pnl?.income.value || 0,
|
|
5372
5708
|
expenses: Math.abs((pnl?.income.value || 0) - (pnl?.net_profit || 0)),
|
|
5373
5709
|
netProfit: pnl?.net_profit || 0,
|
|
5374
|
-
selected: !!pnl && (0,
|
|
5710
|
+
selected: !!pnl && (0, import_date_fns13.parseISO)(pnl.start_date).getMonth() >= startSelectionMonth && (0, import_date_fns13.parseISO)(pnl.end_date).getMonth() <= endSelectionMonth
|
|
5375
5711
|
});
|
|
5376
5712
|
const onClick = ({ activeTooltipIndex }) => {
|
|
5377
|
-
const selection =
|
|
5378
|
-
if (selection) {
|
|
5379
|
-
const { start_date
|
|
5713
|
+
const selection = data[activeTooltipIndex || -1];
|
|
5714
|
+
if (selection && selection.data) {
|
|
5715
|
+
const { start_date, end_date } = selection.data;
|
|
5380
5716
|
changeDateRange({
|
|
5381
|
-
startDate: (0,
|
|
5382
|
-
endDate: (0,
|
|
5717
|
+
startDate: (0, import_date_fns13.parseISO)(start_date),
|
|
5718
|
+
endDate: (0, import_date_fns13.parseISO)(end_date)
|
|
5383
5719
|
});
|
|
5384
5720
|
}
|
|
5385
5721
|
};
|
|
5386
|
-
const CustomTooltip = ({
|
|
5387
|
-
active,
|
|
5388
|
-
payload,
|
|
5389
|
-
label
|
|
5390
|
-
}) => {
|
|
5722
|
+
const CustomTooltip = ({ active, payload }) => {
|
|
5391
5723
|
if (active && payload && payload.length) {
|
|
5392
5724
|
const netProfit = payload[0].payload.netProfit ?? 0;
|
|
5393
5725
|
const netProfitClass = netProfit > 0 ? "positive" : netProfit < 0 ? "negative" : "";
|
|
5394
|
-
return /* @__PURE__ */
|
|
5726
|
+
return /* @__PURE__ */ import_react54.default.createElement("div", { className: "Layer__chart__tooltip" }, loaded !== "complete" ? /* @__PURE__ */ import_react54.default.createElement(Text, null, "Loading...") : /* @__PURE__ */ import_react54.default.createElement("ul", { className: "Layer__chart__tooltip-list" }, /* @__PURE__ */ import_react54.default.createElement("li", null, /* @__PURE__ */ import_react54.default.createElement("label", { className: "Layer__chart__tooltip-label" }, capitalizeFirstLetter(payload[0].name ?? "")), /* @__PURE__ */ import_react54.default.createElement("span", { className: "Layer__chart__tooltip-value" }, "$", centsToDollars(Math.abs(payload[0].value ?? 0)))), /* @__PURE__ */ import_react54.default.createElement("li", null, /* @__PURE__ */ import_react54.default.createElement("label", { className: "Layer__chart__tooltip-label" }, capitalizeFirstLetter(payload[1].name ?? "")), /* @__PURE__ */ import_react54.default.createElement("span", { className: "Layer__chart__tooltip-value" }, "$", centsToDollars(Math.abs(payload[1].value ?? 0)))), /* @__PURE__ */ import_react54.default.createElement("li", null, /* @__PURE__ */ import_react54.default.createElement("label", { className: "Layer__chart__tooltip-label" }, "Net Profit"), /* @__PURE__ */ import_react54.default.createElement(
|
|
5727
|
+
"span",
|
|
5728
|
+
{
|
|
5729
|
+
className: `Layer__chart__tooltip-value ${netProfitClass}`
|
|
5730
|
+
},
|
|
5731
|
+
"$",
|
|
5732
|
+
centsToDollars(netProfit)
|
|
5733
|
+
))));
|
|
5395
5734
|
}
|
|
5396
5735
|
return null;
|
|
5397
5736
|
};
|
|
5398
5737
|
const CustomizedCursor = (props) => {
|
|
5399
|
-
const { x,
|
|
5400
|
-
|
|
5738
|
+
const { x, y } = props;
|
|
5739
|
+
const { width, height } = customCursorSize;
|
|
5740
|
+
const offsetX = width * 0.1;
|
|
5741
|
+
return /* @__PURE__ */ import_react54.default.createElement(
|
|
5401
5742
|
import_recharts.Rectangle,
|
|
5402
5743
|
{
|
|
5403
|
-
fill:
|
|
5744
|
+
fill: "#F7F8FA",
|
|
5404
5745
|
stroke: "none",
|
|
5405
|
-
x: x +
|
|
5406
|
-
y
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5746
|
+
x: x + offsetX,
|
|
5747
|
+
y,
|
|
5748
|
+
width,
|
|
5749
|
+
height,
|
|
5750
|
+
radius: 6,
|
|
5410
5751
|
className: "Layer__chart__tooltip-cursor"
|
|
5411
5752
|
}
|
|
5412
5753
|
);
|
|
5413
5754
|
};
|
|
5414
|
-
const
|
|
5415
|
-
(
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5755
|
+
const theData = (0, import_react54.useMemo)(() => {
|
|
5756
|
+
if (loaded !== "complete") {
|
|
5757
|
+
return data?.map((x) => ({
|
|
5758
|
+
name: (0, import_date_fns13.format)(x.startDate, "LLL"),
|
|
5759
|
+
revenue: 1,
|
|
5760
|
+
expenses: 1,
|
|
5761
|
+
netProfit: 0,
|
|
5762
|
+
selected: false
|
|
5763
|
+
}));
|
|
5764
|
+
}
|
|
5765
|
+
return data?.map((x) => summarizePnL(x.data));
|
|
5766
|
+
}, [startSelectionMonth, endSelectionMonth, loaded]);
|
|
5767
|
+
const [animateFrom, setAnimateFrom] = (0, import_react54.useState)(-1);
|
|
5768
|
+
return /* @__PURE__ */ import_react54.default.createElement(
|
|
5424
5769
|
import_recharts.ResponsiveContainer,
|
|
5425
5770
|
{
|
|
5426
|
-
className:
|
|
5771
|
+
className: (0, import_classnames27.default)(
|
|
5772
|
+
"Layer__chart-container",
|
|
5773
|
+
loaded !== "complete" && "Layer__chart-container--loading"
|
|
5774
|
+
),
|
|
5427
5775
|
width: "100%",
|
|
5428
5776
|
height: "100%",
|
|
5429
5777
|
minHeight: 200
|
|
5430
5778
|
},
|
|
5431
|
-
/* @__PURE__ */
|
|
5779
|
+
/* @__PURE__ */ import_react54.default.createElement(
|
|
5432
5780
|
import_recharts.BarChart,
|
|
5433
5781
|
{
|
|
5434
5782
|
margin: { left: 12, right: 12, bottom: 12 },
|
|
5435
|
-
data,
|
|
5783
|
+
data: theData,
|
|
5436
5784
|
onClick,
|
|
5437
5785
|
barGap,
|
|
5438
5786
|
className: "Layer__profit-and-loss-chart"
|
|
5439
5787
|
},
|
|
5440
|
-
/* @__PURE__ */
|
|
5788
|
+
/* @__PURE__ */ import_react54.default.createElement(
|
|
5441
5789
|
import_recharts.Tooltip,
|
|
5442
5790
|
{
|
|
5443
5791
|
wrapperClassName: "Layer__chart__tooltip-wrapper",
|
|
5444
|
-
content: /* @__PURE__ */
|
|
5445
|
-
cursor: /* @__PURE__ */
|
|
5792
|
+
content: /* @__PURE__ */ import_react54.default.createElement(CustomTooltip, null),
|
|
5793
|
+
cursor: /* @__PURE__ */ import_react54.default.createElement(CustomizedCursor, null),
|
|
5446
5794
|
animationDuration: 100,
|
|
5447
5795
|
animationEasing: "ease-out"
|
|
5448
5796
|
}
|
|
5449
5797
|
),
|
|
5450
|
-
/* @__PURE__ */
|
|
5798
|
+
/* @__PURE__ */ import_react54.default.createElement(
|
|
5451
5799
|
import_recharts.CartesianGrid,
|
|
5452
5800
|
{
|
|
5453
5801
|
vertical: false,
|
|
@@ -5455,12 +5803,12 @@ var ProfitAndLossChart = () => {
|
|
|
5455
5803
|
strokeDasharray: "5 5"
|
|
5456
5804
|
}
|
|
5457
5805
|
),
|
|
5458
|
-
/* @__PURE__ */
|
|
5806
|
+
/* @__PURE__ */ import_react54.default.createElement(
|
|
5459
5807
|
import_recharts.Legend,
|
|
5460
5808
|
{
|
|
5461
|
-
verticalAlign: "
|
|
5809
|
+
verticalAlign: "bottom",
|
|
5462
5810
|
align: "left",
|
|
5463
|
-
wrapperStyle: {
|
|
5811
|
+
wrapperStyle: { bottom: 0 },
|
|
5464
5812
|
payload: [
|
|
5465
5813
|
{
|
|
5466
5814
|
value: "Revenue",
|
|
@@ -5475,46 +5823,50 @@ var ProfitAndLossChart = () => {
|
|
|
5475
5823
|
]
|
|
5476
5824
|
}
|
|
5477
5825
|
),
|
|
5478
|
-
/* @__PURE__ */
|
|
5479
|
-
/* @__PURE__ */
|
|
5826
|
+
/* @__PURE__ */ import_react54.default.createElement(import_recharts.XAxis, { dataKey: "name", tickLine: false }),
|
|
5827
|
+
/* @__PURE__ */ import_react54.default.createElement(
|
|
5480
5828
|
import_recharts.Bar,
|
|
5481
5829
|
{
|
|
5482
5830
|
dataKey: "revenue",
|
|
5483
5831
|
barSize,
|
|
5484
|
-
isAnimationActive:
|
|
5832
|
+
isAnimationActive: barAnimActive,
|
|
5485
5833
|
radius: [2, 2, 0, 0],
|
|
5486
5834
|
className: "Layer__profit-and-loss-chart__bar--income"
|
|
5487
5835
|
},
|
|
5488
|
-
/* @__PURE__ */
|
|
5836
|
+
/* @__PURE__ */ import_react54.default.createElement(
|
|
5489
5837
|
import_recharts.LabelList,
|
|
5490
5838
|
{
|
|
5491
|
-
content: /* @__PURE__ */
|
|
5839
|
+
content: /* @__PURE__ */ import_react54.default.createElement(
|
|
5492
5840
|
Indicator,
|
|
5493
5841
|
{
|
|
5842
|
+
setCustomCursorSize: (width, height, x) => setCustomCursorSize({ width, height, x }),
|
|
5843
|
+
customCursorSize,
|
|
5494
5844
|
animateFrom,
|
|
5495
5845
|
setAnimateFrom
|
|
5496
5846
|
}
|
|
5497
5847
|
)
|
|
5498
5848
|
}
|
|
5499
5849
|
),
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5850
|
+
theData?.map((entry) => {
|
|
5851
|
+
return /* @__PURE__ */ import_react54.default.createElement(
|
|
5852
|
+
import_recharts.Cell,
|
|
5853
|
+
{
|
|
5854
|
+
key: entry.name,
|
|
5855
|
+
className: entry.selected ? "Layer__profit-and-loss-chart__cell--selected" : ""
|
|
5856
|
+
}
|
|
5857
|
+
);
|
|
5858
|
+
})
|
|
5507
5859
|
),
|
|
5508
|
-
/* @__PURE__ */
|
|
5860
|
+
/* @__PURE__ */ import_react54.default.createElement(
|
|
5509
5861
|
import_recharts.Bar,
|
|
5510
5862
|
{
|
|
5511
5863
|
dataKey: "expenses",
|
|
5512
5864
|
barSize,
|
|
5513
|
-
isAnimationActive:
|
|
5865
|
+
isAnimationActive: barAnimActive,
|
|
5514
5866
|
radius: [2, 2, 0, 0],
|
|
5515
5867
|
className: "Layer__profit-and-loss-chart__bar--expenses"
|
|
5516
5868
|
},
|
|
5517
|
-
|
|
5869
|
+
theData.map((entry) => /* @__PURE__ */ import_react54.default.createElement(
|
|
5518
5870
|
import_recharts.Cell,
|
|
5519
5871
|
{
|
|
5520
5872
|
key: entry.name,
|
|
@@ -5527,19 +5879,19 @@ var ProfitAndLossChart = () => {
|
|
|
5527
5879
|
};
|
|
5528
5880
|
|
|
5529
5881
|
// src/components/ProfitAndLossDatePicker/ProfitAndLossDatePicker.tsx
|
|
5530
|
-
var
|
|
5531
|
-
var
|
|
5882
|
+
var import_react55 = __toESM(require("react"));
|
|
5883
|
+
var import_date_fns14 = require("date-fns");
|
|
5532
5884
|
var ProfitAndLossDatePicker = () => {
|
|
5533
|
-
const { changeDateRange, dateRange } = (0,
|
|
5534
|
-
const [isAnimating, setIsAnimating] = (0,
|
|
5535
|
-
const [localDate, setLocalDate] = (0,
|
|
5536
|
-
const [nextOpacity, setNextOpacity] = (0,
|
|
5537
|
-
const [currentOpacity, setCurrentOpacity] = (0,
|
|
5538
|
-
const [transformStyle, setTransformStyle] = (0,
|
|
5885
|
+
const { changeDateRange, dateRange } = (0, import_react55.useContext)(ProfitAndLoss.Context);
|
|
5886
|
+
const [isAnimating, setIsAnimating] = (0, import_react55.useState)(false);
|
|
5887
|
+
const [localDate, setLocalDate] = (0, import_react55.useState)(dateRange.startDate);
|
|
5888
|
+
const [nextOpacity, setNextOpacity] = (0, import_react55.useState)(0);
|
|
5889
|
+
const [currentOpacity, setCurrentOpacity] = (0, import_react55.useState)(1);
|
|
5890
|
+
const [transformStyle, setTransformStyle] = (0, import_react55.useState)({
|
|
5539
5891
|
transform: "translateX(33%)",
|
|
5540
5892
|
transition: "ease"
|
|
5541
5893
|
});
|
|
5542
|
-
(0,
|
|
5894
|
+
(0, import_react55.useEffect)(() => {
|
|
5543
5895
|
if (dateRange.startDate !== localDate && !isAnimating) {
|
|
5544
5896
|
setLocalDate(dateRange.startDate);
|
|
5545
5897
|
setTransformStyle({ transform: "translateX(33%)", transition: "none" });
|
|
@@ -5550,13 +5902,13 @@ var ProfitAndLossDatePicker = () => {
|
|
|
5550
5902
|
return;
|
|
5551
5903
|
setIsAnimating(true);
|
|
5552
5904
|
setNextOpacity(1);
|
|
5553
|
-
const newDate = (0,
|
|
5905
|
+
const newDate = (0, import_date_fns14.add)(localDate, { months: monthsToAdd });
|
|
5554
5906
|
if (monthsToAdd === -1) {
|
|
5555
5907
|
setCurrentOpacity(0);
|
|
5556
5908
|
}
|
|
5557
5909
|
changeDateRange({
|
|
5558
|
-
startDate: (0,
|
|
5559
|
-
endDate: (0,
|
|
5910
|
+
startDate: (0, import_date_fns14.startOfMonth)(newDate),
|
|
5911
|
+
endDate: (0, import_date_fns14.endOfMonth)(newDate)
|
|
5560
5912
|
});
|
|
5561
5913
|
const translateXValue = monthsToAdd > 0 ? "0%" : "66%";
|
|
5562
5914
|
setTransformStyle({
|
|
@@ -5574,67 +5926,67 @@ var ProfitAndLossDatePicker = () => {
|
|
|
5574
5926
|
setCurrentOpacity(1);
|
|
5575
5927
|
}, 300);
|
|
5576
5928
|
};
|
|
5577
|
-
const currentLabel = (0,
|
|
5578
|
-
const prevLabel = (0,
|
|
5579
|
-
const nextLabel = (0,
|
|
5580
|
-
return /* @__PURE__ */
|
|
5929
|
+
const currentLabel = (0, import_date_fns14.format)(localDate, "LLLL, y");
|
|
5930
|
+
const prevLabel = (0, import_date_fns14.format)((0, import_date_fns14.add)(localDate, { months: -1 }), "LLLL, y");
|
|
5931
|
+
const nextLabel = (0, import_date_fns14.format)((0, import_date_fns14.add)(localDate, { months: 1 }), "LLLL, y");
|
|
5932
|
+
return /* @__PURE__ */ import_react55.default.createElement("div", { className: "Layer__profit-and-loss-date-picker" }, /* @__PURE__ */ import_react55.default.createElement(
|
|
5581
5933
|
"div",
|
|
5582
5934
|
{
|
|
5583
|
-
className: "Layer__profit-and-loss-date-
|
|
5935
|
+
className: "Layer__profit-and-loss-date-picker__labels-container",
|
|
5936
|
+
style: transformStyle
|
|
5584
5937
|
},
|
|
5585
|
-
/* @__PURE__ */
|
|
5938
|
+
/* @__PURE__ */ import_react55.default.createElement("span", { className: "Layer__profit-and-loss-date-picker__label" }, prevLabel),
|
|
5939
|
+
/* @__PURE__ */ import_react55.default.createElement(
|
|
5586
5940
|
"span",
|
|
5587
5941
|
{
|
|
5588
5942
|
className: "Layer__profit-and-loss-date-picker__label",
|
|
5589
5943
|
style: { opacity: currentOpacity }
|
|
5590
5944
|
},
|
|
5591
5945
|
currentLabel
|
|
5592
|
-
),
|
|
5946
|
+
),
|
|
5947
|
+
/* @__PURE__ */ import_react55.default.createElement(
|
|
5593
5948
|
"span",
|
|
5594
5949
|
{
|
|
5595
5950
|
className: "Layer__profit-and-loss-date-picker__label",
|
|
5596
5951
|
style: { opacity: nextOpacity }
|
|
5597
5952
|
},
|
|
5598
5953
|
nextLabel
|
|
5599
|
-
)
|
|
5600
|
-
|
|
5601
|
-
|
|
5954
|
+
)
|
|
5955
|
+
), /* @__PURE__ */ import_react55.default.createElement(
|
|
5956
|
+
"button",
|
|
5957
|
+
{
|
|
5958
|
+
"aria-label": "View Previous Month",
|
|
5959
|
+
className: "Layer__profit-and-loss-date-picker__button",
|
|
5960
|
+
onClick: () => change(-1),
|
|
5961
|
+
disabled: isAnimating
|
|
5962
|
+
},
|
|
5963
|
+
/* @__PURE__ */ import_react55.default.createElement(
|
|
5964
|
+
ChevronLeft_default,
|
|
5602
5965
|
{
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
"button",
|
|
5966
|
+
className: "Layer__profit-and-loss-date-picker__button-icon",
|
|
5967
|
+
size: 16
|
|
5968
|
+
}
|
|
5969
|
+
)
|
|
5970
|
+
), /* @__PURE__ */ import_react55.default.createElement(
|
|
5971
|
+
"button",
|
|
5972
|
+
{
|
|
5973
|
+
"aria-label": "View Next Month",
|
|
5974
|
+
className: "Layer__profit-and-loss-date-picker__button",
|
|
5975
|
+
onClick: () => change(1),
|
|
5976
|
+
disabled: isAnimating
|
|
5977
|
+
},
|
|
5978
|
+
/* @__PURE__ */ import_react55.default.createElement(
|
|
5979
|
+
ChevronRight_default,
|
|
5618
5980
|
{
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
/* @__PURE__ */ import_react54.default.createElement(
|
|
5625
|
-
ChevronRight_default,
|
|
5626
|
-
{
|
|
5627
|
-
className: "Layer__profit-and-loss-date-picker__button-icon",
|
|
5628
|
-
size: 16
|
|
5629
|
-
}
|
|
5630
|
-
)
|
|
5631
|
-
),
|
|
5632
|
-
/* @__PURE__ */ import_react54.default.createElement("div", { className: "Layer__profit-and-loss-date-picker__effect-blur" })
|
|
5633
|
-
);
|
|
5981
|
+
className: "Layer__profit-and-loss-date-picker__button-icon",
|
|
5982
|
+
size: 16
|
|
5983
|
+
}
|
|
5984
|
+
)
|
|
5985
|
+
), /* @__PURE__ */ import_react55.default.createElement("div", { className: "Layer__profit-and-loss-date-picker__effect-blur" }));
|
|
5634
5986
|
};
|
|
5635
5987
|
|
|
5636
5988
|
// src/components/ProfitAndLossDetailedCharts/ProfitAndLossDetailedCharts.tsx
|
|
5637
|
-
var
|
|
5989
|
+
var import_react59 = __toESM(require("react"));
|
|
5638
5990
|
|
|
5639
5991
|
// src/icons/X.tsx
|
|
5640
5992
|
var React68 = __toESM(require("react"));
|
|
@@ -5670,7 +6022,7 @@ var X = ({ size = 18, ...props }) => /* @__PURE__ */ React68.createElement(
|
|
|
5670
6022
|
var X_default = X;
|
|
5671
6023
|
|
|
5672
6024
|
// src/components/ProfitAndLossDetailedCharts/DetailedChart.tsx
|
|
5673
|
-
var
|
|
6025
|
+
var import_react56 = __toESM(require("react"));
|
|
5674
6026
|
|
|
5675
6027
|
// src/config/charts.ts
|
|
5676
6028
|
var INACTIVE_OPACITY_LEVELS = [
|
|
@@ -5769,7 +6121,7 @@ var DetailedChart = ({
|
|
|
5769
6121
|
date,
|
|
5770
6122
|
isLoading
|
|
5771
6123
|
}) => {
|
|
5772
|
-
const chartData = (0,
|
|
6124
|
+
const chartData = (0, import_react56.useMemo)(() => {
|
|
5773
6125
|
if (!filteredData) {
|
|
5774
6126
|
return [];
|
|
5775
6127
|
}
|
|
@@ -5787,7 +6139,7 @@ var DetailedChart = ({
|
|
|
5787
6139
|
});
|
|
5788
6140
|
}, [filteredData, isLoading]);
|
|
5789
6141
|
const noValue = chartData.length === 0 || !chartData.find((x) => x.value !== 0);
|
|
5790
|
-
return /* @__PURE__ */
|
|
6142
|
+
return /* @__PURE__ */ import_react56.default.createElement("div", { className: "chart-field" }, /* @__PURE__ */ import_react56.default.createElement("div", { className: "header--tablet" }, /* @__PURE__ */ import_react56.default.createElement(Text, { size: "lg" /* lg */, weight: "bold" /* bold */, className: "title" }, humanizeTitle(sidebarScope)), /* @__PURE__ */ import_react56.default.createElement(ProfitAndLossDatePicker, null)), /* @__PURE__ */ import_react56.default.createElement("div", { className: "chart-container" }, /* @__PURE__ */ import_react56.default.createElement(import_recharts2.ResponsiveContainer, null, /* @__PURE__ */ import_react56.default.createElement(import_recharts2.PieChart, null, !isLoading && !noValue ? /* @__PURE__ */ import_react56.default.createElement(
|
|
5791
6143
|
import_recharts2.Pie,
|
|
5792
6144
|
{
|
|
5793
6145
|
data: chartData,
|
|
@@ -5812,7 +6164,7 @@ var DetailedChart = ({
|
|
|
5812
6164
|
fill = void 0;
|
|
5813
6165
|
opacity = INACTIVE_OPACITY_LEVELS[index % INACTIVE_OPACITY_LEVELS.length];
|
|
5814
6166
|
}
|
|
5815
|
-
return /* @__PURE__ */
|
|
6167
|
+
return /* @__PURE__ */ import_react56.default.createElement(
|
|
5816
6168
|
import_recharts2.Cell,
|
|
5817
6169
|
{
|
|
5818
6170
|
key: `cell-${index}`,
|
|
@@ -5824,7 +6176,7 @@ var DetailedChart = ({
|
|
|
5824
6176
|
}
|
|
5825
6177
|
);
|
|
5826
6178
|
}),
|
|
5827
|
-
/* @__PURE__ */
|
|
6179
|
+
/* @__PURE__ */ import_react56.default.createElement(
|
|
5828
6180
|
import_recharts2.Label,
|
|
5829
6181
|
{
|
|
5830
6182
|
position: "center",
|
|
@@ -5845,7 +6197,7 @@ var DetailedChart = ({
|
|
|
5845
6197
|
if (hoveredItem) {
|
|
5846
6198
|
text = hoveredItem;
|
|
5847
6199
|
}
|
|
5848
|
-
return /* @__PURE__ */
|
|
6200
|
+
return /* @__PURE__ */ import_react56.default.createElement(
|
|
5849
6201
|
import_recharts2.Text,
|
|
5850
6202
|
{
|
|
5851
6203
|
...positioningProps,
|
|
@@ -5856,7 +6208,7 @@ var DetailedChart = ({
|
|
|
5856
6208
|
}
|
|
5857
6209
|
}
|
|
5858
6210
|
),
|
|
5859
|
-
/* @__PURE__ */
|
|
6211
|
+
/* @__PURE__ */ import_react56.default.createElement(
|
|
5860
6212
|
import_recharts2.Label,
|
|
5861
6213
|
{
|
|
5862
6214
|
position: "center",
|
|
@@ -5879,7 +6231,7 @@ var DetailedChart = ({
|
|
|
5879
6231
|
(x) => x.display_name === hoveredItem
|
|
5880
6232
|
)?.value;
|
|
5881
6233
|
}
|
|
5882
|
-
return /* @__PURE__ */
|
|
6234
|
+
return /* @__PURE__ */ import_react56.default.createElement(
|
|
5883
6235
|
import_recharts2.Text,
|
|
5884
6236
|
{
|
|
5885
6237
|
...positioningProps,
|
|
@@ -5890,7 +6242,7 @@ var DetailedChart = ({
|
|
|
5890
6242
|
}
|
|
5891
6243
|
}
|
|
5892
6244
|
),
|
|
5893
|
-
/* @__PURE__ */
|
|
6245
|
+
/* @__PURE__ */ import_react56.default.createElement(
|
|
5894
6246
|
import_recharts2.Label,
|
|
5895
6247
|
{
|
|
5896
6248
|
position: "center",
|
|
@@ -5909,7 +6261,7 @@ var DetailedChart = ({
|
|
|
5909
6261
|
verticalAnchor: "middle"
|
|
5910
6262
|
};
|
|
5911
6263
|
if (hoveredItem) {
|
|
5912
|
-
return /* @__PURE__ */
|
|
6264
|
+
return /* @__PURE__ */ import_react56.default.createElement(
|
|
5913
6265
|
import_recharts2.Text,
|
|
5914
6266
|
{
|
|
5915
6267
|
...positioningProps,
|
|
@@ -5926,7 +6278,7 @@ var DetailedChart = ({
|
|
|
5926
6278
|
}
|
|
5927
6279
|
}
|
|
5928
6280
|
)
|
|
5929
|
-
) : null, !isLoading && noValue ? /* @__PURE__ */
|
|
6281
|
+
) : null, !isLoading && noValue ? /* @__PURE__ */ import_react56.default.createElement(
|
|
5930
6282
|
import_recharts2.Pie,
|
|
5931
6283
|
{
|
|
5932
6284
|
data: [{ name: "Total", value: 1 }],
|
|
@@ -5941,7 +6293,7 @@ var DetailedChart = ({
|
|
|
5941
6293
|
animationDuration: 200,
|
|
5942
6294
|
animationEasing: "ease-in-out"
|
|
5943
6295
|
},
|
|
5944
|
-
/* @__PURE__ */
|
|
6296
|
+
/* @__PURE__ */ import_react56.default.createElement(
|
|
5945
6297
|
import_recharts2.Label,
|
|
5946
6298
|
{
|
|
5947
6299
|
position: "center",
|
|
@@ -5962,7 +6314,7 @@ var DetailedChart = ({
|
|
|
5962
6314
|
if (hoveredItem) {
|
|
5963
6315
|
text = hoveredItem;
|
|
5964
6316
|
}
|
|
5965
|
-
return /* @__PURE__ */
|
|
6317
|
+
return /* @__PURE__ */ import_react56.default.createElement(
|
|
5966
6318
|
import_recharts2.Text,
|
|
5967
6319
|
{
|
|
5968
6320
|
...positioningProps,
|
|
@@ -5973,7 +6325,7 @@ var DetailedChart = ({
|
|
|
5973
6325
|
}
|
|
5974
6326
|
}
|
|
5975
6327
|
),
|
|
5976
|
-
/* @__PURE__ */
|
|
6328
|
+
/* @__PURE__ */ import_react56.default.createElement(
|
|
5977
6329
|
import_recharts2.Label,
|
|
5978
6330
|
{
|
|
5979
6331
|
position: "center",
|
|
@@ -5996,7 +6348,7 @@ var DetailedChart = ({
|
|
|
5996
6348
|
(x) => x.display_name === hoveredItem
|
|
5997
6349
|
)?.value;
|
|
5998
6350
|
}
|
|
5999
|
-
return /* @__PURE__ */
|
|
6351
|
+
return /* @__PURE__ */ import_react56.default.createElement(
|
|
6000
6352
|
import_recharts2.Text,
|
|
6001
6353
|
{
|
|
6002
6354
|
...positioningProps,
|
|
@@ -6007,7 +6359,7 @@ var DetailedChart = ({
|
|
|
6007
6359
|
}
|
|
6008
6360
|
}
|
|
6009
6361
|
)
|
|
6010
|
-
) : null, isLoading ? /* @__PURE__ */
|
|
6362
|
+
) : null, isLoading ? /* @__PURE__ */ import_react56.default.createElement(
|
|
6011
6363
|
import_recharts2.Pie,
|
|
6012
6364
|
{
|
|
6013
6365
|
data: [{ name: "loading...", value: 1 }],
|
|
@@ -6026,7 +6378,7 @@ var DetailedChart = ({
|
|
|
6026
6378
|
};
|
|
6027
6379
|
|
|
6028
6380
|
// src/components/ProfitAndLossDetailedCharts/DetailedTable.tsx
|
|
6029
|
-
var
|
|
6381
|
+
var import_react57 = __toESM(require("react"));
|
|
6030
6382
|
|
|
6031
6383
|
// src/icons/SortArrows.tsx
|
|
6032
6384
|
var React70 = __toESM(require("react"));
|
|
@@ -6040,7 +6392,7 @@ var SortArrows = ({ size = 13, ...props }) => /* @__PURE__ */ React70.createElem
|
|
|
6040
6392
|
width: size,
|
|
6041
6393
|
height: size
|
|
6042
6394
|
},
|
|
6043
|
-
/* @__PURE__ */ React70.createElement("g", {
|
|
6395
|
+
/* @__PURE__ */ React70.createElement("g", { clipPath: "url(#clip0_1758_75388)" }, /* @__PURE__ */ React70.createElement(
|
|
6044
6396
|
"path",
|
|
6045
6397
|
{
|
|
6046
6398
|
d: "M1.33325 8.5L3.99992 11.1667L6.66659 8.5",
|
|
@@ -6090,7 +6442,7 @@ var SortArrows = ({ size = 13, ...props }) => /* @__PURE__ */ React70.createElem
|
|
|
6090
6442
|
var SortArrows_default = SortArrows;
|
|
6091
6443
|
|
|
6092
6444
|
// src/components/ProfitAndLossDetailedCharts/DetailedTable.tsx
|
|
6093
|
-
var
|
|
6445
|
+
var import_classnames28 = __toESM(require("classnames"));
|
|
6094
6446
|
var DetailedTable = ({
|
|
6095
6447
|
filteredData,
|
|
6096
6448
|
sidebarScope,
|
|
@@ -6100,52 +6452,52 @@ var DetailedTable = ({
|
|
|
6100
6452
|
setHoveredItem
|
|
6101
6453
|
}) => {
|
|
6102
6454
|
const buildColClass = (column) => {
|
|
6103
|
-
return (0,
|
|
6455
|
+
return (0, import_classnames28.default)(
|
|
6104
6456
|
"Layer__sortable-col",
|
|
6105
6457
|
sidebarScope && filters[sidebarScope]?.sortBy === column ? `sort--${(sidebarScope && filters[sidebarScope]?.sortDirection) ?? "desc"}` : ""
|
|
6106
6458
|
);
|
|
6107
6459
|
};
|
|
6108
|
-
return /* @__PURE__ */
|
|
6460
|
+
return /* @__PURE__ */ import_react57.default.createElement("div", { className: "details-container" }, /* @__PURE__ */ import_react57.default.createElement("div", { className: "table" }, /* @__PURE__ */ import_react57.default.createElement("table", null, /* @__PURE__ */ import_react57.default.createElement("thead", null, /* @__PURE__ */ import_react57.default.createElement("tr", null, /* @__PURE__ */ import_react57.default.createElement(
|
|
6109
6461
|
"th",
|
|
6110
6462
|
{
|
|
6111
6463
|
className: buildColClass("category"),
|
|
6112
6464
|
onClick: () => sortBy(sidebarScope ?? "expenses", "category")
|
|
6113
6465
|
},
|
|
6114
6466
|
"Expense/Sale ",
|
|
6115
|
-
/* @__PURE__ */
|
|
6116
|
-
), /* @__PURE__ */
|
|
6467
|
+
/* @__PURE__ */ import_react57.default.createElement(SortArrows_default, { className: "Layer__sort-arrows" })
|
|
6468
|
+
), /* @__PURE__ */ import_react57.default.createElement(
|
|
6117
6469
|
"th",
|
|
6118
6470
|
{
|
|
6119
6471
|
className: buildColClass("type"),
|
|
6120
6472
|
onClick: () => sortBy(sidebarScope ?? "expenses", "type")
|
|
6121
6473
|
},
|
|
6122
6474
|
"Type ",
|
|
6123
|
-
/* @__PURE__ */
|
|
6124
|
-
), /* @__PURE__ */
|
|
6475
|
+
/* @__PURE__ */ import_react57.default.createElement(SortArrows_default, { className: "Layer__sort-arrows" })
|
|
6476
|
+
), /* @__PURE__ */ import_react57.default.createElement("th", null), /* @__PURE__ */ import_react57.default.createElement(
|
|
6125
6477
|
"th",
|
|
6126
6478
|
{
|
|
6127
6479
|
className: buildColClass("value"),
|
|
6128
6480
|
onClick: () => sortBy(sidebarScope ?? "expenses", "value")
|
|
6129
6481
|
},
|
|
6130
6482
|
"Value ",
|
|
6131
|
-
/* @__PURE__ */
|
|
6132
|
-
))), /* @__PURE__ */
|
|
6483
|
+
/* @__PURE__ */ import_react57.default.createElement(SortArrows_default, { className: "Layer__sort-arrows" })
|
|
6484
|
+
))), /* @__PURE__ */ import_react57.default.createElement("tbody", null, filteredData.filter((x) => !x.hidden).map((item, idx) => {
|
|
6133
6485
|
const colorConfig = DEFAULT_CHART_COLORS[idx % DEFAULT_CHART_COLORS.length];
|
|
6134
|
-
return /* @__PURE__ */
|
|
6486
|
+
return /* @__PURE__ */ import_react57.default.createElement(
|
|
6135
6487
|
"tr",
|
|
6136
6488
|
{
|
|
6137
6489
|
key: `pl-side-table-item-${idx}`,
|
|
6138
|
-
className: (0,
|
|
6490
|
+
className: (0, import_classnames28.default)(
|
|
6139
6491
|
"Layer__profit-and-loss-detailed-table__row",
|
|
6140
6492
|
hoveredItem && hoveredItem === item.display_name ? "active" : ""
|
|
6141
6493
|
),
|
|
6142
6494
|
onMouseEnter: () => setHoveredItem(item.display_name),
|
|
6143
6495
|
onMouseLeave: () => setHoveredItem(void 0)
|
|
6144
6496
|
},
|
|
6145
|
-
/* @__PURE__ */
|
|
6146
|
-
/* @__PURE__ */
|
|
6147
|
-
/* @__PURE__ */
|
|
6148
|
-
/* @__PURE__ */
|
|
6497
|
+
/* @__PURE__ */ import_react57.default.createElement("td", { className: "category-col" }, item.display_name),
|
|
6498
|
+
/* @__PURE__ */ import_react57.default.createElement("td", { className: "type-col" }, item.type),
|
|
6499
|
+
/* @__PURE__ */ import_react57.default.createElement("td", { className: "value-col" }, "$", centsToDollars(item.value)),
|
|
6500
|
+
/* @__PURE__ */ import_react57.default.createElement("td", { className: "share-col" }, /* @__PURE__ */ import_react57.default.createElement("span", { className: "share-cell-content" }, formatPercent(item.share), "%", /* @__PURE__ */ import_react57.default.createElement(
|
|
6149
6501
|
"div",
|
|
6150
6502
|
{
|
|
6151
6503
|
className: "share-icon",
|
|
@@ -6160,7 +6512,7 @@ var DetailedTable = ({
|
|
|
6160
6512
|
};
|
|
6161
6513
|
|
|
6162
6514
|
// src/components/ProfitAndLossDetailedCharts/Filters.tsx
|
|
6163
|
-
var
|
|
6515
|
+
var import_react58 = __toESM(require("react"));
|
|
6164
6516
|
var import_react_select3 = __toESM(require("react-select"));
|
|
6165
6517
|
var Filters = ({
|
|
6166
6518
|
filteredData,
|
|
@@ -6168,7 +6520,7 @@ var Filters = ({
|
|
|
6168
6520
|
filters,
|
|
6169
6521
|
setFilterTypes
|
|
6170
6522
|
}) => {
|
|
6171
|
-
return /* @__PURE__ */
|
|
6523
|
+
return /* @__PURE__ */ import_react58.default.createElement("div", { className: "filters" }, /* @__PURE__ */ import_react58.default.createElement(Text, { size: "sm" /* sm */, className: "Layer__label" }, "Filters"), /* @__PURE__ */ import_react58.default.createElement(
|
|
6172
6524
|
import_react_select3.default,
|
|
6173
6525
|
{
|
|
6174
6526
|
className: "Layer__select type-select",
|
|
@@ -6190,15 +6542,15 @@ var Filters = ({
|
|
|
6190
6542
|
);
|
|
6191
6543
|
},
|
|
6192
6544
|
components: {
|
|
6193
|
-
DropdownIndicator: (props) => /* @__PURE__ */
|
|
6194
|
-
Placeholder: (props) => /* @__PURE__ */
|
|
6545
|
+
DropdownIndicator: (props) => /* @__PURE__ */ import_react58.default.createElement(import_react_select3.components.DropdownIndicator, { ...props }, /* @__PURE__ */ import_react58.default.createElement(ChevronDown_default, null)),
|
|
6546
|
+
Placeholder: (props) => /* @__PURE__ */ import_react58.default.createElement(import_react_select3.components.Placeholder, { ...props }, /* @__PURE__ */ import_react58.default.createElement("div", { className: "Layer__select__multi-all-placeholder-badge" }, "All"))
|
|
6195
6547
|
}
|
|
6196
6548
|
}
|
|
6197
6549
|
));
|
|
6198
6550
|
};
|
|
6199
6551
|
|
|
6200
6552
|
// src/components/ProfitAndLossDetailedCharts/ProfitAndLossDetailedCharts.tsx
|
|
6201
|
-
var
|
|
6553
|
+
var import_date_fns15 = require("date-fns");
|
|
6202
6554
|
var ProfitAndLossDetailedCharts = ({
|
|
6203
6555
|
scope,
|
|
6204
6556
|
hideClose = false,
|
|
@@ -6216,20 +6568,20 @@ var ProfitAndLossDetailedCharts = ({
|
|
|
6216
6568
|
sidebarScope,
|
|
6217
6569
|
setSidebarScope,
|
|
6218
6570
|
setFilterTypes
|
|
6219
|
-
} = (0,
|
|
6571
|
+
} = (0, import_react59.useContext)(ProfitAndLoss.Context);
|
|
6220
6572
|
const theScope = scope ? scope : sidebarScope;
|
|
6221
6573
|
const data = theScope === "revenue" ? filteredDataRevenue : filteredDataExpenses;
|
|
6222
6574
|
const total = theScope === "revenue" ? filteredTotalRevenue : filteredTotalExpenses;
|
|
6223
|
-
const [hoveredItem, setHoveredItem] = (0,
|
|
6224
|
-
return /* @__PURE__ */
|
|
6575
|
+
const [hoveredItem, setHoveredItem] = (0, import_react59.useState)();
|
|
6576
|
+
return /* @__PURE__ */ import_react59.default.createElement("div", { className: "Layer__profit-and-loss-detailed-charts" }, /* @__PURE__ */ import_react59.default.createElement("header", { className: "Layer__profit-and-loss-detailed-charts__header" }, /* @__PURE__ */ import_react59.default.createElement("div", { className: "Layer__profit-and-loss-detailed-charts__head" }, /* @__PURE__ */ import_react59.default.createElement(Text, { size: "lg" /* lg */, weight: "bold" /* bold */, className: "title" }, humanizeTitle(theScope)), /* @__PURE__ */ import_react59.default.createElement(Text, { size: "sm" /* sm */, className: "date" }, (0, import_date_fns15.format)(dateRange.startDate, "LLLL, y")), showDatePicker && /* @__PURE__ */ import_react59.default.createElement(ProfitAndLossDatePicker, null)), !hideClose && /* @__PURE__ */ import_react59.default.createElement(
|
|
6225
6577
|
Button,
|
|
6226
6578
|
{
|
|
6227
|
-
rightIcon: /* @__PURE__ */
|
|
6579
|
+
rightIcon: /* @__PURE__ */ import_react59.default.createElement(X_default, null),
|
|
6228
6580
|
iconOnly: true,
|
|
6229
6581
|
onClick: () => setSidebarScope(void 0),
|
|
6230
6582
|
variant: "secondary" /* secondary */
|
|
6231
6583
|
}
|
|
6232
|
-
)), /* @__PURE__ */
|
|
6584
|
+
)), /* @__PURE__ */ import_react59.default.createElement("header", { className: "Layer__profit-and-loss-detailed-charts__header--tablet" }, /* @__PURE__ */ import_react59.default.createElement(BackButton, { onClick: () => setSidebarScope(void 0) })), /* @__PURE__ */ import_react59.default.createElement("div", { className: "Layer__profit-and-loss-detailed-charts__content" }, /* @__PURE__ */ import_react59.default.createElement(
|
|
6233
6585
|
DetailedChart,
|
|
6234
6586
|
{
|
|
6235
6587
|
filteredData: data,
|
|
@@ -6240,7 +6592,7 @@ var ProfitAndLossDetailedCharts = ({
|
|
|
6240
6592
|
date: dateRange.startDate,
|
|
6241
6593
|
isLoading
|
|
6242
6594
|
}
|
|
6243
|
-
), /* @__PURE__ */
|
|
6595
|
+
), /* @__PURE__ */ import_react59.default.createElement("div", { className: "Layer__profit-and-loss-detailed-charts__table-wrapper" }, /* @__PURE__ */ import_react59.default.createElement(
|
|
6244
6596
|
Filters,
|
|
6245
6597
|
{
|
|
6246
6598
|
filteredData: data,
|
|
@@ -6248,7 +6600,7 @@ var ProfitAndLossDetailedCharts = ({
|
|
|
6248
6600
|
filters,
|
|
6249
6601
|
setFilterTypes
|
|
6250
6602
|
}
|
|
6251
|
-
), /* @__PURE__ */
|
|
6603
|
+
), /* @__PURE__ */ import_react59.default.createElement(
|
|
6252
6604
|
DetailedTable,
|
|
6253
6605
|
{
|
|
6254
6606
|
filteredData: data,
|
|
@@ -6262,28 +6614,28 @@ var ProfitAndLossDetailedCharts = ({
|
|
|
6262
6614
|
};
|
|
6263
6615
|
|
|
6264
6616
|
// src/components/ProfitAndLossSummaries/ProfitAndLossSummaries.tsx
|
|
6265
|
-
var
|
|
6617
|
+
var import_react62 = __toESM(require("react"));
|
|
6266
6618
|
|
|
6267
6619
|
// src/components/SkeletonLoader/SkeletonLoader.tsx
|
|
6268
|
-
var
|
|
6269
|
-
var
|
|
6620
|
+
var import_react60 = __toESM(require("react"));
|
|
6621
|
+
var import_classnames29 = __toESM(require("classnames"));
|
|
6270
6622
|
var SkeletonLoader = ({
|
|
6271
6623
|
height,
|
|
6272
6624
|
width,
|
|
6273
6625
|
className
|
|
6274
6626
|
}) => {
|
|
6275
|
-
const baseClassName = (0,
|
|
6627
|
+
const baseClassName = (0, import_classnames29.default)(
|
|
6276
6628
|
"Layer__skeleton-loader Layer__anim--skeleton-loading",
|
|
6277
6629
|
className
|
|
6278
6630
|
);
|
|
6279
|
-
return /* @__PURE__ */
|
|
6631
|
+
return /* @__PURE__ */ import_react60.default.createElement("div", { className: baseClassName, style: { width, height } });
|
|
6280
6632
|
};
|
|
6281
6633
|
|
|
6282
6634
|
// src/components/ProfitAndLossSummaries/MiniChart.tsx
|
|
6283
|
-
var
|
|
6635
|
+
var import_react61 = __toESM(require("react"));
|
|
6284
6636
|
var import_recharts3 = require("recharts");
|
|
6285
6637
|
var MiniChart = ({ data }) => {
|
|
6286
|
-
return /* @__PURE__ */
|
|
6638
|
+
return /* @__PURE__ */ import_react61.default.createElement(import_recharts3.PieChart, { width: 48, height: 48, className: "mini-chart" }, /* @__PURE__ */ import_react61.default.createElement(
|
|
6287
6639
|
import_recharts3.Pie,
|
|
6288
6640
|
{
|
|
6289
6641
|
data,
|
|
@@ -6302,7 +6654,7 @@ var MiniChart = ({ data }) => {
|
|
|
6302
6654
|
},
|
|
6303
6655
|
data.map((entry, index) => {
|
|
6304
6656
|
const colorConfig = DEFAULT_CHART_COLORS[index % DEFAULT_CHART_COLORS.length];
|
|
6305
|
-
return /* @__PURE__ */
|
|
6657
|
+
return /* @__PURE__ */ import_react61.default.createElement(
|
|
6306
6658
|
import_recharts3.Cell,
|
|
6307
6659
|
{
|
|
6308
6660
|
key: `cell-${index}`,
|
|
@@ -6316,7 +6668,7 @@ var MiniChart = ({ data }) => {
|
|
|
6316
6668
|
};
|
|
6317
6669
|
|
|
6318
6670
|
// src/components/ProfitAndLossSummaries/ProfitAndLossSummaries.tsx
|
|
6319
|
-
var
|
|
6671
|
+
var import_classnames30 = __toESM(require("classnames"));
|
|
6320
6672
|
var CHART_PLACEHOLDER = [
|
|
6321
6673
|
{
|
|
6322
6674
|
name: "placeholder",
|
|
@@ -6353,26 +6705,27 @@ var ProfitAndLossSummaries = ({
|
|
|
6353
6705
|
isLoading,
|
|
6354
6706
|
setSidebarScope,
|
|
6355
6707
|
sidebarScope
|
|
6356
|
-
} = (0,
|
|
6357
|
-
const
|
|
6358
|
-
|
|
6708
|
+
} = (0, import_react62.useContext)(ProfitAndLoss.Context);
|
|
6709
|
+
const dataItem = Array.isArray(storedData) ? storedData[storedData.length - 1] : storedData;
|
|
6710
|
+
const expensesChartData = (0, import_react62.useMemo)(() => {
|
|
6711
|
+
return buildMiniChartData("expenses", dataItem);
|
|
6359
6712
|
}, [storedData]);
|
|
6360
|
-
const revenueChartData = (0,
|
|
6361
|
-
return buildMiniChartData("revenue",
|
|
6713
|
+
const revenueChartData = (0, import_react62.useMemo)(() => {
|
|
6714
|
+
return buildMiniChartData("revenue", dataItem);
|
|
6362
6715
|
}, [storedData]);
|
|
6363
|
-
const data =
|
|
6716
|
+
const data = dataItem ? dataItem : { income: { value: NaN }, net_profit: NaN };
|
|
6364
6717
|
const incomeDirectionClass = (data.income.value ?? NaN) < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--positive";
|
|
6365
6718
|
const expensesDirectionClass = (data?.income?.value ?? NaN) - data.net_profit < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--positive";
|
|
6366
6719
|
const netProfitDirectionClass = data.net_profit < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--positive";
|
|
6367
|
-
return /* @__PURE__ */
|
|
6720
|
+
return /* @__PURE__ */ import_react62.default.createElement(
|
|
6368
6721
|
"div",
|
|
6369
6722
|
{
|
|
6370
6723
|
className: `Layer__profit-and-loss-summaries ${vertical ? "flex-col" : ""}`
|
|
6371
6724
|
},
|
|
6372
|
-
/* @__PURE__ */
|
|
6725
|
+
/* @__PURE__ */ import_react62.default.createElement(
|
|
6373
6726
|
"div",
|
|
6374
6727
|
{
|
|
6375
|
-
className: (0,
|
|
6728
|
+
className: (0, import_classnames30.default)(
|
|
6376
6729
|
"Layer__profit-and-loss-summaries__summary",
|
|
6377
6730
|
actionable && "Layer__actionable",
|
|
6378
6731
|
"Layer__profit-and-loss-summaries__summary--income",
|
|
@@ -6382,8 +6735,8 @@ var ProfitAndLossSummaries = ({
|
|
|
6382
6735
|
actionable && setSidebarScope("revenue");
|
|
6383
6736
|
}
|
|
6384
6737
|
},
|
|
6385
|
-
/* @__PURE__ */
|
|
6386
|
-
/* @__PURE__ */
|
|
6738
|
+
/* @__PURE__ */ import_react62.default.createElement(MiniChart, { data: revenueChartData }),
|
|
6739
|
+
/* @__PURE__ */ import_react62.default.createElement("div", { className: "Layer__profit-and-loss-summaries__text" }, /* @__PURE__ */ import_react62.default.createElement("span", { className: "Layer__profit-and-loss-summaries__title" }, revenueLabel), isLoading || storedData === void 0 ? /* @__PURE__ */ import_react62.default.createElement("div", { className: "Layer__profit-and-loss-summaries__loader" }, /* @__PURE__ */ import_react62.default.createElement(SkeletonLoader, null)) : /* @__PURE__ */ import_react62.default.createElement(
|
|
6387
6740
|
"span",
|
|
6388
6741
|
{
|
|
6389
6742
|
className: `Layer__profit-and-loss-summaries__amount ${incomeDirectionClass}`
|
|
@@ -6391,10 +6744,10 @@ var ProfitAndLossSummaries = ({
|
|
|
6391
6744
|
centsToDollars(Math.abs(data?.income?.value ?? NaN))
|
|
6392
6745
|
))
|
|
6393
6746
|
),
|
|
6394
|
-
/* @__PURE__ */
|
|
6747
|
+
/* @__PURE__ */ import_react62.default.createElement(
|
|
6395
6748
|
"div",
|
|
6396
6749
|
{
|
|
6397
|
-
className: (0,
|
|
6750
|
+
className: (0, import_classnames30.default)(
|
|
6398
6751
|
"Layer__profit-and-loss-summaries__summary",
|
|
6399
6752
|
actionable && "Layer__actionable",
|
|
6400
6753
|
"Layer__profit-and-loss-summaries__summary--expenses",
|
|
@@ -6404,8 +6757,8 @@ var ProfitAndLossSummaries = ({
|
|
|
6404
6757
|
actionable && setSidebarScope("expenses");
|
|
6405
6758
|
}
|
|
6406
6759
|
},
|
|
6407
|
-
/* @__PURE__ */
|
|
6408
|
-
/* @__PURE__ */
|
|
6760
|
+
/* @__PURE__ */ import_react62.default.createElement(MiniChart, { data: expensesChartData }),
|
|
6761
|
+
/* @__PURE__ */ import_react62.default.createElement("div", { className: "Layer__profit-and-loss-summaries__text" }, /* @__PURE__ */ import_react62.default.createElement("span", { className: "Layer__profit-and-loss-summaries__title" }, "Expenses"), isLoading || storedData === void 0 ? /* @__PURE__ */ import_react62.default.createElement("div", { className: "Layer__profit-and-loss-summaries__loader" }, /* @__PURE__ */ import_react62.default.createElement(SkeletonLoader, { className: "Layer__profit-and-loss-summaries__loader" })) : /* @__PURE__ */ import_react62.default.createElement(
|
|
6409
6762
|
"span",
|
|
6410
6763
|
{
|
|
6411
6764
|
className: `Layer__profit-and-loss-summaries__amount ${expensesDirectionClass}`
|
|
@@ -6415,15 +6768,15 @@ var ProfitAndLossSummaries = ({
|
|
|
6415
6768
|
)
|
|
6416
6769
|
))
|
|
6417
6770
|
),
|
|
6418
|
-
/* @__PURE__ */
|
|
6771
|
+
/* @__PURE__ */ import_react62.default.createElement(
|
|
6419
6772
|
"div",
|
|
6420
6773
|
{
|
|
6421
|
-
className: (0,
|
|
6774
|
+
className: (0, import_classnames30.default)(
|
|
6422
6775
|
"Layer__profit-and-loss-summaries__summary net-profit Layer__profit-and-loss-summaries__summary--net-profit",
|
|
6423
6776
|
actionable && "Layer__actionable"
|
|
6424
6777
|
)
|
|
6425
6778
|
},
|
|
6426
|
-
/* @__PURE__ */
|
|
6779
|
+
/* @__PURE__ */ import_react62.default.createElement("div", { className: "Layer__profit-and-loss-summaries__text" }, /* @__PURE__ */ import_react62.default.createElement("span", { className: "Layer__profit-and-loss-summaries__title" }, "Net Profit"), isLoading || storedData === void 0 ? /* @__PURE__ */ import_react62.default.createElement("div", { className: "Layer__profit-and-loss-summaries__loader" }, /* @__PURE__ */ import_react62.default.createElement(SkeletonLoader, { className: "Layer__profit-and-loss-summaries__loader" })) : /* @__PURE__ */ import_react62.default.createElement(
|
|
6427
6780
|
"span",
|
|
6428
6781
|
{
|
|
6429
6782
|
className: `Layer__profit-and-loss-summaries__amount ${netProfitDirectionClass}`
|
|
@@ -6435,10 +6788,10 @@ var ProfitAndLossSummaries = ({
|
|
|
6435
6788
|
};
|
|
6436
6789
|
|
|
6437
6790
|
// src/components/ProfitAndLossTable/ProfitAndLossTable.tsx
|
|
6438
|
-
var
|
|
6791
|
+
var import_react64 = __toESM(require("react"));
|
|
6439
6792
|
|
|
6440
6793
|
// src/components/ProfitAndLossRow/ProfitAndLossRow.tsx
|
|
6441
|
-
var
|
|
6794
|
+
var import_react63 = __toESM(require("react"));
|
|
6442
6795
|
|
|
6443
6796
|
// src/icons/PieChart.tsx
|
|
6444
6797
|
var React77 = __toESM(require("react"));
|
|
@@ -6487,7 +6840,7 @@ var ProfitAndLossRow = ({
|
|
|
6487
6840
|
return null;
|
|
6488
6841
|
}
|
|
6489
6842
|
const { value, display_name, line_items } = lineItem;
|
|
6490
|
-
const [expanded, setExpanded] = (0,
|
|
6843
|
+
const [expanded, setExpanded] = (0, import_react63.useState)(true);
|
|
6491
6844
|
const amount = value ?? 0;
|
|
6492
6845
|
const amountString = centsToDollars(Math.abs(amount));
|
|
6493
6846
|
const labelClasses = [
|
|
@@ -6518,20 +6871,20 @@ var ProfitAndLossRow = ({
|
|
|
6518
6871
|
);
|
|
6519
6872
|
displayChildren && expanded && labelClasses.push("Layer__profit-and-loss-row__label--expanded");
|
|
6520
6873
|
displayChildren && expanded && valueClasses.push("Layer__profit-and-loss-row__value--expanded");
|
|
6521
|
-
return /* @__PURE__ */
|
|
6874
|
+
return /* @__PURE__ */ import_react63.default.createElement(import_react63.default.Fragment, null, /* @__PURE__ */ import_react63.default.createElement(
|
|
6522
6875
|
"div",
|
|
6523
6876
|
{
|
|
6524
6877
|
className: labelClasses.join(" "),
|
|
6525
6878
|
onClick: () => !lockExpanded && toggleExpanded()
|
|
6526
6879
|
},
|
|
6527
|
-
/* @__PURE__ */
|
|
6880
|
+
/* @__PURE__ */ import_react63.default.createElement("span", { className: "Layer__profit-and-loss-row__label__title" }, !lockExpanded && variant !== "summation" ? /* @__PURE__ */ import_react63.default.createElement(
|
|
6528
6881
|
ChevronDownFill_default,
|
|
6529
6882
|
{
|
|
6530
6883
|
size: 16,
|
|
6531
6884
|
className: "Layer__profit-and-loss-row__label__chevron"
|
|
6532
6885
|
}
|
|
6533
|
-
) : null, /* @__PURE__ */
|
|
6534
|
-
setSidebarScope && /* @__PURE__ */
|
|
6886
|
+
) : null, /* @__PURE__ */ import_react63.default.createElement(Text, null, display_name)),
|
|
6887
|
+
setSidebarScope && /* @__PURE__ */ import_react63.default.createElement(
|
|
6535
6888
|
"span",
|
|
6536
6889
|
{
|
|
6537
6890
|
className: "Layer__profit-and-loss-row__detailed-chart-btn",
|
|
@@ -6540,14 +6893,14 @@ var ProfitAndLossRow = ({
|
|
|
6540
6893
|
setSidebarScope && setSidebarScope(scope ?? "expenses");
|
|
6541
6894
|
}
|
|
6542
6895
|
},
|
|
6543
|
-
/* @__PURE__ */
|
|
6896
|
+
/* @__PURE__ */ import_react63.default.createElement(PieChart_default, null)
|
|
6544
6897
|
)
|
|
6545
|
-
), /* @__PURE__ */
|
|
6898
|
+
), /* @__PURE__ */ import_react63.default.createElement("div", { className: valueClasses.join(" ") }, /* @__PURE__ */ import_react63.default.createElement(Text, null, amountString)), canGoDeeper && hasChildren && /* @__PURE__ */ import_react63.default.createElement(
|
|
6546
6899
|
"div",
|
|
6547
6900
|
{
|
|
6548
6901
|
className: `Layer__profit-and-loss-row__children ${expanded && "Layer__profit-and-loss-row__children--expanded"}`
|
|
6549
6902
|
},
|
|
6550
|
-
/* @__PURE__ */
|
|
6903
|
+
/* @__PURE__ */ import_react63.default.createElement("div", { className: "Layer__profit-and-loss-row__children--content" }, (line_items || []).map((line_item) => /* @__PURE__ */ import_react63.default.createElement(
|
|
6551
6904
|
ProfitAndLossRow,
|
|
6552
6905
|
{
|
|
6553
6906
|
key: line_item.display_name,
|
|
@@ -6609,35 +6962,36 @@ var empty_profit_and_loss_report_default = {
|
|
|
6609
6962
|
};
|
|
6610
6963
|
|
|
6611
6964
|
// src/components/ProfitAndLossTable/ProfitAndLossTable.tsx
|
|
6612
|
-
var
|
|
6965
|
+
var import_classnames31 = __toESM(require("classnames"));
|
|
6613
6966
|
var ProfitAndLossTable = ({ lockExpanded, asContainer }) => {
|
|
6614
6967
|
const {
|
|
6615
6968
|
data: actualData,
|
|
6616
6969
|
isLoading,
|
|
6617
6970
|
setSidebarScope
|
|
6618
|
-
} = (0,
|
|
6619
|
-
const
|
|
6971
|
+
} = (0, import_react64.useContext)(ProfitAndLoss.Context);
|
|
6972
|
+
const currentData = Array.isArray(actualData) ? actualData[actualData.length - 1] : actualData;
|
|
6973
|
+
const data = !currentData || isLoading ? empty_profit_and_loss_report_default : currentData;
|
|
6620
6974
|
if (isLoading || actualData === void 0) {
|
|
6621
|
-
return /* @__PURE__ */
|
|
6975
|
+
return /* @__PURE__ */ import_react64.default.createElement(
|
|
6622
6976
|
"div",
|
|
6623
6977
|
{
|
|
6624
|
-
className: (0,
|
|
6978
|
+
className: (0, import_classnames31.default)(
|
|
6625
6979
|
"Layer__profit-and-loss-table__loader-container",
|
|
6626
6980
|
asContainer && "Layer__component-container"
|
|
6627
6981
|
)
|
|
6628
6982
|
},
|
|
6629
|
-
/* @__PURE__ */
|
|
6983
|
+
/* @__PURE__ */ import_react64.default.createElement(Loader2, null)
|
|
6630
6984
|
);
|
|
6631
6985
|
}
|
|
6632
|
-
return /* @__PURE__ */
|
|
6986
|
+
return /* @__PURE__ */ import_react64.default.createElement(import_react64.default.Fragment, null, /* @__PURE__ */ import_react64.default.createElement(
|
|
6633
6987
|
"div",
|
|
6634
6988
|
{
|
|
6635
|
-
className: (0,
|
|
6989
|
+
className: (0, import_classnames31.default)(
|
|
6636
6990
|
"Layer__profit-and-loss-table Layer__profit-and-loss-table--main",
|
|
6637
6991
|
asContainer && "Layer__component-container"
|
|
6638
6992
|
)
|
|
6639
6993
|
},
|
|
6640
|
-
/* @__PURE__ */
|
|
6994
|
+
/* @__PURE__ */ import_react64.default.createElement(
|
|
6641
6995
|
ProfitAndLossRow,
|
|
6642
6996
|
{
|
|
6643
6997
|
lineItem: data.income,
|
|
@@ -6647,7 +7001,7 @@ var ProfitAndLossTable = ({ lockExpanded, asContainer }) => {
|
|
|
6647
7001
|
setSidebarScope
|
|
6648
7002
|
}
|
|
6649
7003
|
),
|
|
6650
|
-
/* @__PURE__ */
|
|
7004
|
+
/* @__PURE__ */ import_react64.default.createElement(
|
|
6651
7005
|
ProfitAndLossRow,
|
|
6652
7006
|
{
|
|
6653
7007
|
lineItem: data.cost_of_goods_sold,
|
|
@@ -6657,7 +7011,7 @@ var ProfitAndLossTable = ({ lockExpanded, asContainer }) => {
|
|
|
6657
7011
|
setSidebarScope
|
|
6658
7012
|
}
|
|
6659
7013
|
),
|
|
6660
|
-
/* @__PURE__ */
|
|
7014
|
+
/* @__PURE__ */ import_react64.default.createElement(
|
|
6661
7015
|
ProfitAndLossRow,
|
|
6662
7016
|
{
|
|
6663
7017
|
lineItem: {
|
|
@@ -6671,7 +7025,7 @@ var ProfitAndLossTable = ({ lockExpanded, asContainer }) => {
|
|
|
6671
7025
|
setSidebarScope
|
|
6672
7026
|
}
|
|
6673
7027
|
),
|
|
6674
|
-
/* @__PURE__ */
|
|
7028
|
+
/* @__PURE__ */ import_react64.default.createElement(
|
|
6675
7029
|
ProfitAndLossRow,
|
|
6676
7030
|
{
|
|
6677
7031
|
lineItem: data.expenses,
|
|
@@ -6681,7 +7035,7 @@ var ProfitAndLossTable = ({ lockExpanded, asContainer }) => {
|
|
|
6681
7035
|
setSidebarScope
|
|
6682
7036
|
}
|
|
6683
7037
|
),
|
|
6684
|
-
/* @__PURE__ */
|
|
7038
|
+
/* @__PURE__ */ import_react64.default.createElement(
|
|
6685
7039
|
ProfitAndLossRow,
|
|
6686
7040
|
{
|
|
6687
7041
|
lineItem: {
|
|
@@ -6695,7 +7049,7 @@ var ProfitAndLossTable = ({ lockExpanded, asContainer }) => {
|
|
|
6695
7049
|
setSidebarScope
|
|
6696
7050
|
}
|
|
6697
7051
|
),
|
|
6698
|
-
/* @__PURE__ */
|
|
7052
|
+
/* @__PURE__ */ import_react64.default.createElement(
|
|
6699
7053
|
ProfitAndLossRow,
|
|
6700
7054
|
{
|
|
6701
7055
|
lineItem: data.taxes,
|
|
@@ -6705,7 +7059,7 @@ var ProfitAndLossTable = ({ lockExpanded, asContainer }) => {
|
|
|
6705
7059
|
setSidebarScope
|
|
6706
7060
|
}
|
|
6707
7061
|
),
|
|
6708
|
-
/* @__PURE__ */
|
|
7062
|
+
/* @__PURE__ */ import_react64.default.createElement(
|
|
6709
7063
|
ProfitAndLossRow,
|
|
6710
7064
|
{
|
|
6711
7065
|
lineItem: {
|
|
@@ -6717,14 +7071,14 @@ var ProfitAndLossTable = ({ lockExpanded, asContainer }) => {
|
|
|
6717
7071
|
lockExpanded
|
|
6718
7072
|
}
|
|
6719
7073
|
)
|
|
6720
|
-
), data.other_outflows || data.personal_expenses ? /* @__PURE__ */
|
|
7074
|
+
), data.other_outflows || data.personal_expenses ? /* @__PURE__ */ import_react64.default.createElement("div", { className: "Layer__profit-and-loss-table Layer__profit-and-loss-table__outflows" }, /* @__PURE__ */ import_react64.default.createElement(
|
|
6721
7075
|
ProfitAndLossRow,
|
|
6722
7076
|
{
|
|
6723
7077
|
lineItem: data.other_outflows,
|
|
6724
7078
|
direction: "DEBIT" /* DEBIT */,
|
|
6725
7079
|
lockExpanded
|
|
6726
7080
|
}
|
|
6727
|
-
), /* @__PURE__ */
|
|
7081
|
+
), /* @__PURE__ */ import_react64.default.createElement(
|
|
6728
7082
|
ProfitAndLossRow,
|
|
6729
7083
|
{
|
|
6730
7084
|
lineItem: data.personal_expenses,
|
|
@@ -6735,8 +7089,8 @@ var ProfitAndLossTable = ({ lockExpanded, asContainer }) => {
|
|
|
6735
7089
|
};
|
|
6736
7090
|
|
|
6737
7091
|
// src/components/ProfitAndLoss/ProfitAndLoss.tsx
|
|
6738
|
-
var
|
|
6739
|
-
var PNLContext = (0,
|
|
7092
|
+
var import_date_fns16 = require("date-fns");
|
|
7093
|
+
var PNLContext = (0, import_react65.createContext)({
|
|
6740
7094
|
data: void 0,
|
|
6741
7095
|
filteredDataRevenue: [],
|
|
6742
7096
|
filteredTotalRevenue: void 0,
|
|
@@ -6746,8 +7100,8 @@ var PNLContext = (0, import_react64.createContext)({
|
|
|
6746
7100
|
isValidating: false,
|
|
6747
7101
|
error: void 0,
|
|
6748
7102
|
dateRange: {
|
|
6749
|
-
startDate: (0,
|
|
6750
|
-
endDate: (0,
|
|
7103
|
+
startDate: (0, import_date_fns16.startOfMonth)(/* @__PURE__ */ new Date()),
|
|
7104
|
+
endDate: (0, import_date_fns16.endOfMonth)(/* @__PURE__ */ new Date())
|
|
6751
7105
|
},
|
|
6752
7106
|
changeDateRange: () => {
|
|
6753
7107
|
},
|
|
@@ -6772,7 +7126,7 @@ var ProfitAndLoss = ({
|
|
|
6772
7126
|
asContainer = true
|
|
6773
7127
|
}) => {
|
|
6774
7128
|
const contextData = useProfitAndLoss({ tagFilter, reportingBasis });
|
|
6775
|
-
return /* @__PURE__ */
|
|
7129
|
+
return /* @__PURE__ */ import_react65.default.createElement(PNLContext.Provider, { value: contextData }, asContainer ? /* @__PURE__ */ import_react65.default.createElement(Container, { name: "profit-and-loss" }, children) : children);
|
|
6776
7130
|
};
|
|
6777
7131
|
ProfitAndLoss.Chart = ProfitAndLossChart;
|
|
6778
7132
|
ProfitAndLoss.Context = PNLContext;
|
|
@@ -6782,11 +7136,11 @@ ProfitAndLoss.Table = ProfitAndLossTable;
|
|
|
6782
7136
|
ProfitAndLoss.DetailedCharts = ProfitAndLossDetailedCharts;
|
|
6783
7137
|
|
|
6784
7138
|
// src/components/ProfitAndLossView/ProfitAndLossView.tsx
|
|
6785
|
-
var
|
|
7139
|
+
var import_react67 = __toESM(require("react"));
|
|
6786
7140
|
|
|
6787
7141
|
// src/components/Panel/Panel.tsx
|
|
6788
|
-
var
|
|
6789
|
-
var
|
|
7142
|
+
var import_react66 = __toESM(require("react"));
|
|
7143
|
+
var import_classnames32 = __toESM(require("classnames"));
|
|
6790
7144
|
var Panel = ({
|
|
6791
7145
|
children,
|
|
6792
7146
|
className,
|
|
@@ -6795,23 +7149,23 @@ var Panel = ({
|
|
|
6795
7149
|
sidebarIsOpen,
|
|
6796
7150
|
parentRef
|
|
6797
7151
|
}) => {
|
|
6798
|
-
const [sidebarHeight, setSidebarHeight] = (0,
|
|
6799
|
-
(0,
|
|
7152
|
+
const [sidebarHeight, setSidebarHeight] = (0, import_react66.useState)(0);
|
|
7153
|
+
(0, import_react66.useEffect)(() => {
|
|
6800
7154
|
if (parentRef?.current?.offsetHeight) {
|
|
6801
7155
|
setSidebarHeight(parentRef?.current?.offsetHeight - 1);
|
|
6802
7156
|
}
|
|
6803
7157
|
}, [parentRef?.current?.offsetHeight, sidebarIsOpen]);
|
|
6804
|
-
return /* @__PURE__ */
|
|
7158
|
+
return /* @__PURE__ */ import_react66.default.createElement(
|
|
6805
7159
|
"div",
|
|
6806
7160
|
{
|
|
6807
|
-
className: (0,
|
|
7161
|
+
className: (0, import_classnames32.default)(
|
|
6808
7162
|
"Layer__panel",
|
|
6809
7163
|
className,
|
|
6810
7164
|
sidebarIsOpen && "Layer__panel--open"
|
|
6811
7165
|
)
|
|
6812
7166
|
},
|
|
6813
|
-
/* @__PURE__ */
|
|
6814
|
-
sidebar && /* @__PURE__ */
|
|
7167
|
+
/* @__PURE__ */ import_react66.default.createElement("div", { className: "Layer__panel__content" }, header, children),
|
|
7168
|
+
sidebar && /* @__PURE__ */ import_react66.default.createElement(
|
|
6815
7169
|
"div",
|
|
6816
7170
|
{
|
|
6817
7171
|
className: "Layer__panel__sidebar",
|
|
@@ -6819,7 +7173,7 @@ var Panel = ({
|
|
|
6819
7173
|
maxHeight: sidebarHeight > 0 && sidebarIsOpen ? sidebarHeight : 0
|
|
6820
7174
|
}
|
|
6821
7175
|
},
|
|
6822
|
-
/* @__PURE__ */
|
|
7176
|
+
/* @__PURE__ */ import_react66.default.createElement("div", { className: "Layer__panel__sidebar-content" }, sidebar)
|
|
6823
7177
|
)
|
|
6824
7178
|
);
|
|
6825
7179
|
};
|
|
@@ -6827,34 +7181,34 @@ var Panel = ({
|
|
|
6827
7181
|
// src/components/ProfitAndLossView/ProfitAndLossView.tsx
|
|
6828
7182
|
var COMPONENT_NAME3 = "profit-and-loss";
|
|
6829
7183
|
var ProfitAndLossView = (props) => {
|
|
6830
|
-
const containerRef = (0,
|
|
6831
|
-
return /* @__PURE__ */
|
|
7184
|
+
const containerRef = (0, import_react67.useRef)(null);
|
|
7185
|
+
return /* @__PURE__ */ import_react67.default.createElement(Container, { name: COMPONENT_NAME3, ref: containerRef }, /* @__PURE__ */ import_react67.default.createElement(ProfitAndLoss, null, /* @__PURE__ */ import_react67.default.createElement(ProfitAndLossPanel, { containerRef, ...props })));
|
|
6832
7186
|
};
|
|
6833
7187
|
var ProfitAndLossPanel = ({
|
|
6834
7188
|
containerRef,
|
|
6835
7189
|
...props
|
|
6836
7190
|
}) => {
|
|
6837
|
-
const { sidebarScope } = (0,
|
|
6838
|
-
return /* @__PURE__ */
|
|
7191
|
+
const { sidebarScope } = (0, import_react67.useContext)(ProfitAndLoss.Context);
|
|
7192
|
+
return /* @__PURE__ */ import_react67.default.createElement(
|
|
6839
7193
|
Panel,
|
|
6840
7194
|
{
|
|
6841
|
-
sidebar: /* @__PURE__ */
|
|
7195
|
+
sidebar: /* @__PURE__ */ import_react67.default.createElement(ProfitAndLossDetailedCharts, null),
|
|
6842
7196
|
sidebarIsOpen: Boolean(sidebarScope),
|
|
6843
7197
|
parentRef: containerRef
|
|
6844
7198
|
},
|
|
6845
|
-
/* @__PURE__ */
|
|
6846
|
-
/* @__PURE__ */
|
|
7199
|
+
/* @__PURE__ */ import_react67.default.createElement(Header, { className: `Layer__${COMPONENT_NAME3}__header` }, /* @__PURE__ */ import_react67.default.createElement(Heading, { className: "Layer__profit-and-loss__title" }, "Profit & Loss")),
|
|
7200
|
+
/* @__PURE__ */ import_react67.default.createElement(Components, { ...props })
|
|
6847
7201
|
);
|
|
6848
7202
|
};
|
|
6849
7203
|
var Components = ({
|
|
6850
7204
|
hideChart = false,
|
|
6851
7205
|
hideTable = false
|
|
6852
7206
|
}) => {
|
|
6853
|
-
const { error, isLoading, isValidating, refetch } = (0,
|
|
7207
|
+
const { error, isLoading, isValidating, refetch } = (0, import_react67.useContext)(
|
|
6854
7208
|
ProfitAndLoss.Context
|
|
6855
7209
|
);
|
|
6856
7210
|
if (!isLoading && error) {
|
|
6857
|
-
return /* @__PURE__ */
|
|
7211
|
+
return /* @__PURE__ */ import_react67.default.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ import_react67.default.createElement(
|
|
6858
7212
|
DataState,
|
|
6859
7213
|
{
|
|
6860
7214
|
status: "failed" /* failed */,
|
|
@@ -6865,27 +7219,27 @@ var Components = ({
|
|
|
6865
7219
|
}
|
|
6866
7220
|
));
|
|
6867
7221
|
}
|
|
6868
|
-
return /* @__PURE__ */
|
|
7222
|
+
return /* @__PURE__ */ import_react67.default.createElement(import_react67.default.Fragment, null, !hideChart && /* @__PURE__ */ import_react67.default.createElement("div", { className: `Layer__${COMPONENT_NAME3}__chart_with_summaries` }, /* @__PURE__ */ import_react67.default.createElement(
|
|
6869
7223
|
"div",
|
|
6870
7224
|
{
|
|
6871
7225
|
className: `Layer__${COMPONENT_NAME3}__chart_with_summaries__summary-col`
|
|
6872
7226
|
},
|
|
6873
|
-
/* @__PURE__ */
|
|
6874
|
-
/* @__PURE__ */
|
|
6875
|
-
), /* @__PURE__ */
|
|
7227
|
+
/* @__PURE__ */ import_react67.default.createElement(ProfitAndLoss.DatePicker, null),
|
|
7228
|
+
/* @__PURE__ */ import_react67.default.createElement(ProfitAndLoss.Summaries, { vertical: true })
|
|
7229
|
+
), /* @__PURE__ */ import_react67.default.createElement(
|
|
6876
7230
|
"div",
|
|
6877
7231
|
{
|
|
6878
7232
|
className: `Layer__${COMPONENT_NAME3}__chart_with_summaries__chart-col`
|
|
6879
7233
|
},
|
|
6880
|
-
/* @__PURE__ */
|
|
6881
|
-
)), !hideTable && /* @__PURE__ */
|
|
7234
|
+
/* @__PURE__ */ import_react67.default.createElement(ProfitAndLoss.Chart, null)
|
|
7235
|
+
)), !hideTable && /* @__PURE__ */ import_react67.default.createElement(ProfitAndLoss.Table, null));
|
|
6882
7236
|
};
|
|
6883
7237
|
|
|
6884
7238
|
// src/components/ChartOfAccounts/ChartOfAccounts.tsx
|
|
6885
|
-
var
|
|
7239
|
+
var import_react82 = __toESM(require("react"));
|
|
6886
7240
|
|
|
6887
7241
|
// src/hooks/useChartOfAccounts/useChartOfAccounts.tsx
|
|
6888
|
-
var
|
|
7242
|
+
var import_react68 = require("react");
|
|
6889
7243
|
|
|
6890
7244
|
// src/components/ChartOfAccountsForm/constants.ts
|
|
6891
7245
|
var LEDGER_ACCOUNT_TYPES = [
|
|
@@ -7169,9 +7523,9 @@ var validateName = (formData) => {
|
|
|
7169
7523
|
var flattenAccounts = (accounts) => accounts.flatMap((a) => [a, flattenAccounts(a.sub_accounts || [])]).flat().filter((id) => id);
|
|
7170
7524
|
var useChartOfAccounts = () => {
|
|
7171
7525
|
const { auth, businessId, apiUrl } = useLayerContext();
|
|
7172
|
-
const [form, setForm] = (0,
|
|
7173
|
-
const [sendingForm, setSendingForm] = (0,
|
|
7174
|
-
const [apiError, setApiError] = (0,
|
|
7526
|
+
const [form, setForm] = (0, import_react68.useState)();
|
|
7527
|
+
const [sendingForm, setSendingForm] = (0, import_react68.useState)(false);
|
|
7528
|
+
const [apiError, setApiError] = (0, import_react68.useState)(void 0);
|
|
7175
7529
|
const { data, isLoading, isValidating, error, mutate } = (0, import_swr6.default)(
|
|
7176
7530
|
businessId && auth?.access_token && `chart-of-accounts-${businessId}`,
|
|
7177
7531
|
Layer.getLedgerAccountBalances(apiUrl, auth?.access_token, {
|
|
@@ -7355,12 +7709,12 @@ var useChartOfAccounts = () => {
|
|
|
7355
7709
|
};
|
|
7356
7710
|
|
|
7357
7711
|
// src/hooks/useLedgerAccounts/useLedgerAccounts.tsx
|
|
7358
|
-
var
|
|
7712
|
+
var import_react69 = require("react");
|
|
7359
7713
|
var import_swr7 = __toESM(require("swr"));
|
|
7360
7714
|
var useLedgerAccounts = () => {
|
|
7361
7715
|
const { auth, businessId, apiUrl } = useLayerContext();
|
|
7362
|
-
const [accountId, setAccountId] = (0,
|
|
7363
|
-
const [selectedEntryId, setSelectedEntryId] = (0,
|
|
7716
|
+
const [accountId, setAccountId] = (0, import_react69.useState)();
|
|
7717
|
+
const [selectedEntryId, setSelectedEntryId] = (0, import_react69.useState)();
|
|
7364
7718
|
const { data, isLoading, isValidating, error, mutate } = (0, import_swr7.default)(
|
|
7365
7719
|
businessId && accountId && auth?.access_token && `ledger-accounts-lines-${businessId}-${accountId}`,
|
|
7366
7720
|
Layer.getLedgerAccountsLines(apiUrl, auth?.access_token, {
|
|
@@ -7403,10 +7757,10 @@ var useLedgerAccounts = () => {
|
|
|
7403
7757
|
};
|
|
7404
7758
|
|
|
7405
7759
|
// src/components/ChartOfAccountsTable/ChartOfAccountsTable.tsx
|
|
7406
|
-
var
|
|
7760
|
+
var import_react74 = __toESM(require("react"));
|
|
7407
7761
|
|
|
7408
7762
|
// src/components/ChartOfAccountsRow/ChartOfAccountsRow.tsx
|
|
7409
|
-
var
|
|
7763
|
+
var import_react70 = __toESM(require("react"));
|
|
7410
7764
|
|
|
7411
7765
|
// src/icons/Edit2.tsx
|
|
7412
7766
|
var React83 = __toESM(require("react"));
|
|
@@ -7433,7 +7787,7 @@ var Edit2 = ({ size = 18, ...props }) => /* @__PURE__ */ React83.createElement(
|
|
|
7433
7787
|
var Edit2_default = Edit2;
|
|
7434
7788
|
|
|
7435
7789
|
// src/components/ChartOfAccountsRow/ChartOfAccountsRow.tsx
|
|
7436
|
-
var
|
|
7790
|
+
var import_classnames33 = __toESM(require("classnames"));
|
|
7437
7791
|
var INDENTATION = 24;
|
|
7438
7792
|
var MOBILE_INDENTATION = 12;
|
|
7439
7793
|
var EXPANDED_STYLE = {
|
|
@@ -7464,10 +7818,10 @@ var ChartOfAccountsRow = ({
|
|
|
7464
7818
|
acountsLength,
|
|
7465
7819
|
view
|
|
7466
7820
|
}) => {
|
|
7467
|
-
const { form, editAccount } = (0,
|
|
7468
|
-
const { setAccountId } = (0,
|
|
7821
|
+
const { form, editAccount } = (0, import_react70.useContext)(ChartOfAccountsContext);
|
|
7822
|
+
const { setAccountId } = (0, import_react70.useContext)(LedgerAccountsContext);
|
|
7469
7823
|
const baseStyle = view === "desktop" ? EXPANDED_STYLE : EXPANDED_MOBILE_STYLE;
|
|
7470
|
-
const [isOpen, setIsOpen] = (0,
|
|
7824
|
+
const [isOpen, setIsOpen] = (0, import_react70.useState)(defaultOpen);
|
|
7471
7825
|
const style = expanded ? {
|
|
7472
7826
|
...baseStyle,
|
|
7473
7827
|
transitionDelay: `${15 * index}ms`
|
|
@@ -7475,14 +7829,14 @@ var ChartOfAccountsRow = ({
|
|
|
7475
7829
|
...COLLAPSED_STYLE,
|
|
7476
7830
|
transitionDelay: `${acountsLength - 15 * index}ms`
|
|
7477
7831
|
};
|
|
7478
|
-
const [showComponent, setShowComponent] = (0,
|
|
7479
|
-
(0,
|
|
7832
|
+
const [showComponent, setShowComponent] = (0, import_react70.useState)(false);
|
|
7833
|
+
(0, import_react70.useEffect)(() => {
|
|
7480
7834
|
const timeoutId = setTimeout(() => {
|
|
7481
7835
|
setShowComponent(true);
|
|
7482
7836
|
}, cumulativeIndex * 50);
|
|
7483
7837
|
return () => clearTimeout(timeoutId);
|
|
7484
7838
|
}, []);
|
|
7485
|
-
const baseClass = (0,
|
|
7839
|
+
const baseClass = (0, import_classnames33.default)(
|
|
7486
7840
|
"Layer__table-row",
|
|
7487
7841
|
isOpen ? "Layer__table-row--expanded" : "Layer__table-row--collapsed",
|
|
7488
7842
|
!expanded && "Layer__table-row--hidden",
|
|
@@ -7490,15 +7844,15 @@ var ChartOfAccountsRow = ({
|
|
|
7490
7844
|
form?.accountId === account.id && "Layer__table-row--active",
|
|
7491
7845
|
!showComponent && "Layer__table-row--anim-starting-state"
|
|
7492
7846
|
);
|
|
7493
|
-
const desktopRowClass = (0,
|
|
7847
|
+
const desktopRowClass = (0, import_classnames33.default)(
|
|
7494
7848
|
baseClass,
|
|
7495
7849
|
"Layer__chart-of-accounts__row---desktop"
|
|
7496
7850
|
);
|
|
7497
|
-
const mobileRowClass = (0,
|
|
7851
|
+
const mobileRowClass = (0, import_classnames33.default)(
|
|
7498
7852
|
baseClass,
|
|
7499
7853
|
"Layer__chart-of-accounts__row---mobile"
|
|
7500
7854
|
);
|
|
7501
|
-
return /* @__PURE__ */
|
|
7855
|
+
return /* @__PURE__ */ import_react70.default.createElement(import_react70.default.Fragment, null, view === "desktop" && /* @__PURE__ */ import_react70.default.createElement(
|
|
7502
7856
|
"tr",
|
|
7503
7857
|
{
|
|
7504
7858
|
className: desktopRowClass,
|
|
@@ -7508,7 +7862,7 @@ var ChartOfAccountsRow = ({
|
|
|
7508
7862
|
setAccountId(account.id);
|
|
7509
7863
|
}
|
|
7510
7864
|
},
|
|
7511
|
-
/* @__PURE__ */
|
|
7865
|
+
/* @__PURE__ */ import_react70.default.createElement("td", { className: "Layer__table-cell Layer__coa__name" }, /* @__PURE__ */ import_react70.default.createElement("span", { className: "Layer__table-cell-content", style }, /* @__PURE__ */ import_react70.default.createElement(
|
|
7512
7866
|
"span",
|
|
7513
7867
|
{
|
|
7514
7868
|
className: "Layer__table-cell-content-indentation",
|
|
@@ -7516,7 +7870,7 @@ var ChartOfAccountsRow = ({
|
|
|
7516
7870
|
paddingLeft: INDENTATION * depth + 16
|
|
7517
7871
|
}
|
|
7518
7872
|
},
|
|
7519
|
-
account.sub_accounts && account.sub_accounts.length > 0 && /* @__PURE__ */
|
|
7873
|
+
account.sub_accounts && account.sub_accounts.length > 0 && /* @__PURE__ */ import_react70.default.createElement(
|
|
7520
7874
|
ChevronDownFill_default,
|
|
7521
7875
|
{
|
|
7522
7876
|
size: 16,
|
|
@@ -7527,22 +7881,22 @@ var ChartOfAccountsRow = ({
|
|
|
7527
7881
|
}
|
|
7528
7882
|
}
|
|
7529
7883
|
),
|
|
7530
|
-
/* @__PURE__ */
|
|
7884
|
+
/* @__PURE__ */ import_react70.default.createElement("span", { className: "Layer__coa__name__text" }, account.name)
|
|
7531
7885
|
))),
|
|
7532
|
-
/* @__PURE__ */
|
|
7886
|
+
/* @__PURE__ */ import_react70.default.createElement("td", { className: "Layer__table-cell Layer__coa__type" }, /* @__PURE__ */ import_react70.default.createElement(
|
|
7533
7887
|
"span",
|
|
7534
7888
|
{
|
|
7535
7889
|
className: "Layer__table-cell-content Layer__mobile--hidden",
|
|
7536
7890
|
style
|
|
7537
7891
|
},
|
|
7538
7892
|
account.account_type?.display_name
|
|
7539
|
-
), /* @__PURE__ */
|
|
7893
|
+
), /* @__PURE__ */ import_react70.default.createElement(
|
|
7540
7894
|
"span",
|
|
7541
7895
|
{
|
|
7542
7896
|
className: "Layer__table-cell-content Layer__desktop--hidden",
|
|
7543
7897
|
style
|
|
7544
7898
|
},
|
|
7545
|
-
/* @__PURE__ */
|
|
7899
|
+
/* @__PURE__ */ import_react70.default.createElement(
|
|
7546
7900
|
Text,
|
|
7547
7901
|
{
|
|
7548
7902
|
weight: "bold" /* bold */,
|
|
@@ -7550,10 +7904,10 @@ var ChartOfAccountsRow = ({
|
|
|
7550
7904
|
},
|
|
7551
7905
|
account.normality
|
|
7552
7906
|
),
|
|
7553
|
-
/* @__PURE__ */
|
|
7907
|
+
/* @__PURE__ */ import_react70.default.createElement(Text, { className: "Layer__coa__subtype--mobile" }, account.account_subtype?.display_name)
|
|
7554
7908
|
)),
|
|
7555
|
-
/* @__PURE__ */
|
|
7556
|
-
/* @__PURE__ */
|
|
7909
|
+
/* @__PURE__ */ import_react70.default.createElement("td", { className: "Layer__table-cell Layer__coa__subtype Layer__mobile--hidden" }, /* @__PURE__ */ import_react70.default.createElement("span", { className: "Layer__table-cell-content", style }, account.account_subtype?.display_name)),
|
|
7910
|
+
/* @__PURE__ */ import_react70.default.createElement("td", { className: "Layer__table-cell Layer__coa__balance" }, /* @__PURE__ */ import_react70.default.createElement(
|
|
7557
7911
|
"span",
|
|
7558
7912
|
{
|
|
7559
7913
|
className: "Layer__table-cell-content Layer__table-cell--amount",
|
|
@@ -7562,11 +7916,11 @@ var ChartOfAccountsRow = ({
|
|
|
7562
7916
|
"$",
|
|
7563
7917
|
centsToDollars(Math.abs(account.balance || 0))
|
|
7564
7918
|
)),
|
|
7565
|
-
/* @__PURE__ */
|
|
7919
|
+
/* @__PURE__ */ import_react70.default.createElement("td", { className: "Layer__table-cell Layer__coa__actions" }, /* @__PURE__ */ import_react70.default.createElement("span", { className: "Layer__table-cell-content", style }, /* @__PURE__ */ import_react70.default.createElement(
|
|
7566
7920
|
Button,
|
|
7567
7921
|
{
|
|
7568
7922
|
variant: "secondary" /* secondary */,
|
|
7569
|
-
rightIcon: /* @__PURE__ */
|
|
7923
|
+
rightIcon: /* @__PURE__ */ import_react70.default.createElement(Edit2_default, { size: 12 }),
|
|
7570
7924
|
iconOnly: true,
|
|
7571
7925
|
onClick: (e) => {
|
|
7572
7926
|
e.preventDefault();
|
|
@@ -7576,7 +7930,7 @@ var ChartOfAccountsRow = ({
|
|
|
7576
7930
|
},
|
|
7577
7931
|
"Edit"
|
|
7578
7932
|
)))
|
|
7579
|
-
), view === "mobile" || view === "tablet" ? /* @__PURE__ */
|
|
7933
|
+
), view === "mobile" || view === "tablet" ? /* @__PURE__ */ import_react70.default.createElement(
|
|
7580
7934
|
"tr",
|
|
7581
7935
|
{
|
|
7582
7936
|
className: mobileRowClass,
|
|
@@ -7586,7 +7940,7 @@ var ChartOfAccountsRow = ({
|
|
|
7586
7940
|
setAccountId(account.id);
|
|
7587
7941
|
}
|
|
7588
7942
|
},
|
|
7589
|
-
/* @__PURE__ */
|
|
7943
|
+
/* @__PURE__ */ import_react70.default.createElement("td", { className: "Layer__table-cell", colSpan: 5 }, /* @__PURE__ */ import_react70.default.createElement(
|
|
7590
7944
|
"span",
|
|
7591
7945
|
{
|
|
7592
7946
|
className: "Layer__table-cell-content Layer__table-cell-content-indentation",
|
|
@@ -7595,7 +7949,7 @@ var ChartOfAccountsRow = ({
|
|
|
7595
7949
|
...style
|
|
7596
7950
|
}
|
|
7597
7951
|
},
|
|
7598
|
-
account.sub_accounts && account.sub_accounts.length > 0 && /* @__PURE__ */
|
|
7952
|
+
account.sub_accounts && account.sub_accounts.length > 0 && /* @__PURE__ */ import_react70.default.createElement(
|
|
7599
7953
|
ChevronDownFill_default,
|
|
7600
7954
|
{
|
|
7601
7955
|
size: 16,
|
|
@@ -7606,14 +7960,14 @@ var ChartOfAccountsRow = ({
|
|
|
7606
7960
|
}
|
|
7607
7961
|
}
|
|
7608
7962
|
),
|
|
7609
|
-
/* @__PURE__ */
|
|
7963
|
+
/* @__PURE__ */ import_react70.default.createElement("div", { className: "Layer__chart-of-accounts__mobile-row-content" }, /* @__PURE__ */ import_react70.default.createElement("div", { className: "Layer__chart-of-accounts__mobile-row-content__top-row" }, /* @__PURE__ */ import_react70.default.createElement(
|
|
7610
7964
|
Text,
|
|
7611
7965
|
{
|
|
7612
7966
|
as: "span",
|
|
7613
7967
|
className: "Layer__chart-of-accounts__mobile-row-content__name"
|
|
7614
7968
|
},
|
|
7615
7969
|
account.name
|
|
7616
|
-
), /* @__PURE__ */
|
|
7970
|
+
), /* @__PURE__ */ import_react70.default.createElement(
|
|
7617
7971
|
TextButton,
|
|
7618
7972
|
{
|
|
7619
7973
|
onClick: (e) => {
|
|
@@ -7623,7 +7977,7 @@ var ChartOfAccountsRow = ({
|
|
|
7623
7977
|
}
|
|
7624
7978
|
},
|
|
7625
7979
|
"Edit"
|
|
7626
|
-
)), /* @__PURE__ */
|
|
7980
|
+
)), /* @__PURE__ */ import_react70.default.createElement("div", { className: "Layer__chart-of-accounts__mobile-row-content__bottom-row" }, /* @__PURE__ */ import_react70.default.createElement("div", { className: "Layer__chart-of-accounts__mobile-row-content__types" }, /* @__PURE__ */ import_react70.default.createElement(Text, { as: "span" }, account.normality), /* @__PURE__ */ import_react70.default.createElement("span", { className: "Layer__chart-of-accounts__mobile-row-content__separator" }), /* @__PURE__ */ import_react70.default.createElement(Text, { as: "span" }, "Sub-Type")), /* @__PURE__ */ import_react70.default.createElement(
|
|
7627
7981
|
Text,
|
|
7628
7982
|
{
|
|
7629
7983
|
as: "span",
|
|
@@ -7633,7 +7987,7 @@ var ChartOfAccountsRow = ({
|
|
|
7633
7987
|
centsToDollars(Math.abs(account.balance || 0))
|
|
7634
7988
|
)))
|
|
7635
7989
|
))
|
|
7636
|
-
) : null, (account.sub_accounts || []).map((subAccount, idx) => /* @__PURE__ */
|
|
7990
|
+
) : null, (account.sub_accounts || []).map((subAccount, idx) => /* @__PURE__ */ import_react70.default.createElement(
|
|
7637
7991
|
ChartOfAccountsRow,
|
|
7638
7992
|
{
|
|
7639
7993
|
key: subAccount.id,
|
|
@@ -7649,14 +8003,14 @@ var ChartOfAccountsRow = ({
|
|
|
7649
8003
|
};
|
|
7650
8004
|
|
|
7651
8005
|
// src/components/ChartOfAccountsSidebar/ChartOfAccountsSidebar.tsx
|
|
7652
|
-
var
|
|
8006
|
+
var import_react73 = __toESM(require("react"));
|
|
7653
8007
|
|
|
7654
8008
|
// src/components/ChartOfAccountsForm/ChartOfAccountsForm.tsx
|
|
7655
|
-
var
|
|
8009
|
+
var import_react72 = __toESM(require("react"));
|
|
7656
8010
|
|
|
7657
8011
|
// src/components/ChartOfAccountsForm/useParentOptions.ts
|
|
7658
|
-
var
|
|
7659
|
-
var useParentOptions = (data) => (0,
|
|
8012
|
+
var import_react71 = require("react");
|
|
8013
|
+
var useParentOptions = (data) => (0, import_react71.useMemo)(
|
|
7660
8014
|
() => flattenAccounts(data?.accounts || []).sort((a, b) => a?.name && b?.name ? a.name.localeCompare(b.name) : 0).map((x) => {
|
|
7661
8015
|
return {
|
|
7662
8016
|
label: x.name,
|
|
@@ -7676,9 +8030,9 @@ var ChartOfAccountsForm = () => {
|
|
|
7676
8030
|
submitForm,
|
|
7677
8031
|
sendingForm,
|
|
7678
8032
|
apiError
|
|
7679
|
-
} = (0,
|
|
8033
|
+
} = (0, import_react72.useContext)(ChartOfAccountsContext);
|
|
7680
8034
|
const parentOptions = useParentOptions(data);
|
|
7681
|
-
const entry = (0,
|
|
8035
|
+
const entry = (0, import_react72.useMemo)(() => {
|
|
7682
8036
|
if (form?.action === "edit" && form.accountId) {
|
|
7683
8037
|
return flattenAccounts(data?.accounts || []).find(
|
|
7684
8038
|
(x) => x.id === form.accountId
|
|
@@ -7689,7 +8043,7 @@ var ChartOfAccountsForm = () => {
|
|
|
7689
8043
|
if (!form) {
|
|
7690
8044
|
return;
|
|
7691
8045
|
}
|
|
7692
|
-
return /* @__PURE__ */
|
|
8046
|
+
return /* @__PURE__ */ import_react72.default.createElement(
|
|
7693
8047
|
"form",
|
|
7694
8048
|
{
|
|
7695
8049
|
className: "Layer__form",
|
|
@@ -7698,7 +8052,7 @@ var ChartOfAccountsForm = () => {
|
|
|
7698
8052
|
submitForm();
|
|
7699
8053
|
}
|
|
7700
8054
|
},
|
|
7701
|
-
/* @__PURE__ */
|
|
8055
|
+
/* @__PURE__ */ import_react72.default.createElement("div", { className: "Layer__chart-of-accounts__sidebar__header" }, /* @__PURE__ */ import_react72.default.createElement(Text, { size: "lg" /* lg */, weight: "bold" /* bold */, className: "title" }, form?.action === "edit" ? "Edit" : "Add New", " Account"), /* @__PURE__ */ import_react72.default.createElement("div", { className: "actions" }, /* @__PURE__ */ import_react72.default.createElement(
|
|
7702
8056
|
Button,
|
|
7703
8057
|
{
|
|
7704
8058
|
type: "button",
|
|
@@ -7707,7 +8061,7 @@ var ChartOfAccountsForm = () => {
|
|
|
7707
8061
|
disabled: sendingForm
|
|
7708
8062
|
},
|
|
7709
8063
|
"Cancel"
|
|
7710
|
-
), apiError && /* @__PURE__ */
|
|
8064
|
+
), apiError && /* @__PURE__ */ import_react72.default.createElement(
|
|
7711
8065
|
RetryButton,
|
|
7712
8066
|
{
|
|
7713
8067
|
type: "submit",
|
|
@@ -7716,7 +8070,7 @@ var ChartOfAccountsForm = () => {
|
|
|
7716
8070
|
disabled: sendingForm
|
|
7717
8071
|
},
|
|
7718
8072
|
"Retry"
|
|
7719
|
-
), !apiError && /* @__PURE__ */
|
|
8073
|
+
), !apiError && /* @__PURE__ */ import_react72.default.createElement(
|
|
7720
8074
|
SubmitButton,
|
|
7721
8075
|
{
|
|
7722
8076
|
type: "submit",
|
|
@@ -7726,7 +8080,7 @@ var ChartOfAccountsForm = () => {
|
|
|
7726
8080
|
},
|
|
7727
8081
|
"Save"
|
|
7728
8082
|
))),
|
|
7729
|
-
apiError && /* @__PURE__ */
|
|
8083
|
+
apiError && /* @__PURE__ */ import_react72.default.createElement(
|
|
7730
8084
|
Text,
|
|
7731
8085
|
{
|
|
7732
8086
|
size: "sm" /* sm */,
|
|
@@ -7734,8 +8088,8 @@ var ChartOfAccountsForm = () => {
|
|
|
7734
8088
|
},
|
|
7735
8089
|
apiError
|
|
7736
8090
|
),
|
|
7737
|
-
entry && /* @__PURE__ */
|
|
7738
|
-
/* @__PURE__ */
|
|
8091
|
+
entry && /* @__PURE__ */ import_react72.default.createElement("div", { className: "Layer__chart-of-accounts__form-edit-entry" }, /* @__PURE__ */ import_react72.default.createElement(Text, { weight: "bold" /* bold */ }, entry.name), /* @__PURE__ */ import_react72.default.createElement(Text, { weight: "bold" /* bold */ }, "$", centsToDollars(entry.balance || 0))),
|
|
8092
|
+
/* @__PURE__ */ import_react72.default.createElement("div", { className: "Layer__chart-of-accounts__form" }, /* @__PURE__ */ import_react72.default.createElement(InputGroup, { name: "parent", label: "Parent", inline: true }, /* @__PURE__ */ import_react72.default.createElement(
|
|
7739
8093
|
Select2,
|
|
7740
8094
|
{
|
|
7741
8095
|
options: parentOptions,
|
|
@@ -7743,7 +8097,7 @@ var ChartOfAccountsForm = () => {
|
|
|
7743
8097
|
onChange: (sel) => changeFormData("parent", sel),
|
|
7744
8098
|
disabled: sendingForm
|
|
7745
8099
|
}
|
|
7746
|
-
)), /* @__PURE__ */
|
|
8100
|
+
)), /* @__PURE__ */ import_react72.default.createElement(InputGroup, { name: "name", label: "Name", inline: true }, /* @__PURE__ */ import_react72.default.createElement(
|
|
7747
8101
|
Input,
|
|
7748
8102
|
{
|
|
7749
8103
|
name: "name",
|
|
@@ -7754,7 +8108,7 @@ var ChartOfAccountsForm = () => {
|
|
|
7754
8108
|
disabled: sendingForm,
|
|
7755
8109
|
onChange: (e) => changeFormData("name", e.target.value)
|
|
7756
8110
|
}
|
|
7757
|
-
)), /* @__PURE__ */
|
|
8111
|
+
)), /* @__PURE__ */ import_react72.default.createElement(InputGroup, { name: "type", label: "Type", inline: true }, /* @__PURE__ */ import_react72.default.createElement(
|
|
7758
8112
|
Select2,
|
|
7759
8113
|
{
|
|
7760
8114
|
options: LEDGER_ACCOUNT_TYPES,
|
|
@@ -7764,7 +8118,7 @@ var ChartOfAccountsForm = () => {
|
|
|
7764
8118
|
errorMessage: form?.errors?.find((x) => x.field === "type")?.message,
|
|
7765
8119
|
disabled: sendingForm || form.action === "edit" || form.data.parent !== void 0
|
|
7766
8120
|
}
|
|
7767
|
-
)), /* @__PURE__ */
|
|
8121
|
+
)), /* @__PURE__ */ import_react72.default.createElement(InputGroup, { name: "subType", label: "Sub-Type", inline: true }, /* @__PURE__ */ import_react72.default.createElement(
|
|
7768
8122
|
Select2,
|
|
7769
8123
|
{
|
|
7770
8124
|
options: form?.data.type?.value !== void 0 ? LEDGER_ACCOUNT_SUBTYPES_FOR_TYPE[form?.data.type?.value] : LEDGER_ACCOUNT_SUBTYPES,
|
|
@@ -7772,7 +8126,7 @@ var ChartOfAccountsForm = () => {
|
|
|
7772
8126
|
onChange: (sel) => changeFormData("subType", sel),
|
|
7773
8127
|
disabled: sendingForm
|
|
7774
8128
|
}
|
|
7775
|
-
)), /* @__PURE__ */
|
|
8129
|
+
)), /* @__PURE__ */ import_react72.default.createElement(InputGroup, { name: "normality", label: "Normality", inline: true }, /* @__PURE__ */ import_react72.default.createElement(
|
|
7776
8130
|
Select2,
|
|
7777
8131
|
{
|
|
7778
8132
|
options: NORMALITY_OPTIONS,
|
|
@@ -7792,7 +8146,7 @@ var ChartOfAccountsForm = () => {
|
|
|
7792
8146
|
var ChartOfAccountsSidebar = ({
|
|
7793
8147
|
parentRef: _parentRef
|
|
7794
8148
|
}) => {
|
|
7795
|
-
return /* @__PURE__ */
|
|
8149
|
+
return /* @__PURE__ */ import_react73.default.createElement(ChartOfAccountsForm, null);
|
|
7796
8150
|
};
|
|
7797
8151
|
|
|
7798
8152
|
// src/components/ChartOfAccountsTable/ChartOfAccountsTable.tsx
|
|
@@ -7801,29 +8155,29 @@ var ChartOfAccountsTable = ({
|
|
|
7801
8155
|
view,
|
|
7802
8156
|
containerRef
|
|
7803
8157
|
}) => {
|
|
7804
|
-
const { data, isLoading, addAccount, error, isValidating, refetch, form } = (0,
|
|
8158
|
+
const { data, isLoading, addAccount, error, isValidating, refetch, form } = (0, import_react74.useContext)(ChartOfAccountsContext);
|
|
7805
8159
|
let cumulativeIndex = 0;
|
|
7806
8160
|
const accountsLength = data?.accounts.length ?? 0;
|
|
7807
|
-
return /* @__PURE__ */
|
|
8161
|
+
return /* @__PURE__ */ import_react74.default.createElement(
|
|
7808
8162
|
Panel,
|
|
7809
8163
|
{
|
|
7810
|
-
sidebar: /* @__PURE__ */
|
|
8164
|
+
sidebar: /* @__PURE__ */ import_react74.default.createElement(ChartOfAccountsSidebar, { parentRef: containerRef }),
|
|
7811
8165
|
sidebarIsOpen: Boolean(form),
|
|
7812
8166
|
parentRef: containerRef
|
|
7813
8167
|
},
|
|
7814
|
-
/* @__PURE__ */
|
|
8168
|
+
/* @__PURE__ */ import_react74.default.createElement(Header, { className: `Layer__${COMPONENT_NAME4}__header` }, /* @__PURE__ */ import_react74.default.createElement(Heading, { className: `Layer__${COMPONENT_NAME4}__title` }, "Chart of Accounts"), /* @__PURE__ */ import_react74.default.createElement("div", { className: `Layer__${COMPONENT_NAME4}__actions` }, /* @__PURE__ */ import_react74.default.createElement(
|
|
7815
8169
|
Button,
|
|
7816
8170
|
{
|
|
7817
8171
|
variant: "secondary" /* secondary */,
|
|
7818
8172
|
disabled: isLoading,
|
|
7819
|
-
rightIcon: /* @__PURE__ */
|
|
8173
|
+
rightIcon: /* @__PURE__ */ import_react74.default.createElement(DownloadCloud_default, { size: 12 })
|
|
7820
8174
|
},
|
|
7821
8175
|
"Download"
|
|
7822
|
-
), /* @__PURE__ */
|
|
7823
|
-
/* @__PURE__ */
|
|
8176
|
+
), /* @__PURE__ */ import_react74.default.createElement(Button, { onClick: () => addAccount(), disabled: isLoading }, "Add Account"))),
|
|
8177
|
+
/* @__PURE__ */ import_react74.default.createElement("table", { className: "Layer__chart-of-accounts__table" }, /* @__PURE__ */ import_react74.default.createElement("thead", null, /* @__PURE__ */ import_react74.default.createElement("tr", { className: "Layer__table-row--header" }, /* @__PURE__ */ import_react74.default.createElement("th", { className: "Layer__table-header Layer__coa__name" }, "Name"), /* @__PURE__ */ import_react74.default.createElement("th", { className: "Layer__table-header Layer__coa__type" }, "Type"), /* @__PURE__ */ import_react74.default.createElement("th", { className: "Layer__table-header Layer__coa__subtype Layer__mobile--hidden" }, "Sub-Type"), /* @__PURE__ */ import_react74.default.createElement("th", { className: "Layer__table-header Layer__coa__balance" }, "Balance"), /* @__PURE__ */ import_react74.default.createElement("th", { className: "Layer__table-header Layer__coa__actions" }))), /* @__PURE__ */ import_react74.default.createElement("tbody", null, !error && data?.accounts.map((account, idx) => {
|
|
7824
8178
|
const currentCumulativeIndex = cumulativeIndex;
|
|
7825
8179
|
cumulativeIndex = (account.sub_accounts?.length || 0) + cumulativeIndex + 1;
|
|
7826
|
-
return /* @__PURE__ */
|
|
8180
|
+
return /* @__PURE__ */ import_react74.default.createElement(
|
|
7827
8181
|
ChartOfAccountsRow,
|
|
7828
8182
|
{
|
|
7829
8183
|
key: account.id,
|
|
@@ -7838,7 +8192,7 @@ var ChartOfAccountsTable = ({
|
|
|
7838
8192
|
}
|
|
7839
8193
|
);
|
|
7840
8194
|
}))),
|
|
7841
|
-
error ? /* @__PURE__ */
|
|
8195
|
+
error ? /* @__PURE__ */ import_react74.default.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ import_react74.default.createElement(
|
|
7842
8196
|
DataState,
|
|
7843
8197
|
{
|
|
7844
8198
|
status: "failed" /* failed */,
|
|
@@ -7848,8 +8202,8 @@ var ChartOfAccountsTable = ({
|
|
|
7848
8202
|
isLoading: isValidating || isLoading
|
|
7849
8203
|
}
|
|
7850
8204
|
)) : null,
|
|
7851
|
-
(!data || isLoading) && !error ? /* @__PURE__ */
|
|
7852
|
-
!isLoading && !error && data?.accounts.length === 0 ? /* @__PURE__ */
|
|
8205
|
+
(!data || isLoading) && !error ? /* @__PURE__ */ import_react74.default.createElement("div", { className: `Layer__${COMPONENT_NAME4}__loader-container` }, /* @__PURE__ */ import_react74.default.createElement(Loader2, null)) : null,
|
|
8206
|
+
!isLoading && !error && data?.accounts.length === 0 ? /* @__PURE__ */ import_react74.default.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ import_react74.default.createElement(
|
|
7853
8207
|
DataState,
|
|
7854
8208
|
{
|
|
7855
8209
|
status: "info" /* info */,
|
|
@@ -7863,21 +8217,21 @@ var ChartOfAccountsTable = ({
|
|
|
7863
8217
|
};
|
|
7864
8218
|
|
|
7865
8219
|
// src/components/LedgerAccount/LedgerAccountIndex.tsx
|
|
7866
|
-
var
|
|
8220
|
+
var import_react81 = __toESM(require("react"));
|
|
7867
8221
|
|
|
7868
8222
|
// src/components/LedgerAccountEntryDetails/LedgerAccountEntryDetails.tsx
|
|
7869
|
-
var
|
|
8223
|
+
var import_react79 = __toESM(require("react"));
|
|
7870
8224
|
|
|
7871
8225
|
// src/components/Card/Card.tsx
|
|
7872
|
-
var
|
|
7873
|
-
var
|
|
8226
|
+
var import_react75 = __toESM(require("react"));
|
|
8227
|
+
var import_classnames34 = __toESM(require("classnames"));
|
|
7874
8228
|
var Card = ({ children, className }) => {
|
|
7875
|
-
return /* @__PURE__ */
|
|
8229
|
+
return /* @__PURE__ */ import_react75.default.createElement("div", { className: (0, import_classnames34.default)("Layer__card", className) }, children);
|
|
7876
8230
|
};
|
|
7877
8231
|
|
|
7878
8232
|
// src/components/DateTime/DateTime.tsx
|
|
7879
|
-
var
|
|
7880
|
-
var
|
|
8233
|
+
var import_react76 = __toESM(require("react"));
|
|
8234
|
+
var import_date_fns17 = require("date-fns");
|
|
7881
8235
|
var DateTime = ({
|
|
7882
8236
|
value,
|
|
7883
8237
|
format: format7,
|
|
@@ -7887,11 +8241,11 @@ var DateTime = ({
|
|
|
7887
8241
|
onlyTime
|
|
7888
8242
|
}) => {
|
|
7889
8243
|
if (format7) {
|
|
7890
|
-
return /* @__PURE__ */
|
|
8244
|
+
return /* @__PURE__ */ import_react76.default.createElement(Text, { className: "Layer__datetime" }, (0, import_date_fns17.format)((0, import_date_fns17.parseISO)(value), format7));
|
|
7891
8245
|
}
|
|
7892
|
-
const date = (0,
|
|
7893
|
-
const time = (0,
|
|
7894
|
-
return /* @__PURE__ */
|
|
8246
|
+
const date = (0, import_date_fns17.format)((0, import_date_fns17.parseISO)(value), dateFormat ?? DATE_FORMAT);
|
|
8247
|
+
const time = (0, import_date_fns17.format)((0, import_date_fns17.parseISO)(value), timeFormat ?? TIME_FORMAT);
|
|
8248
|
+
return /* @__PURE__ */ import_react76.default.createElement(Text, { className: "Layer__datetime" }, !onlyTime && /* @__PURE__ */ import_react76.default.createElement(
|
|
7895
8249
|
Text,
|
|
7896
8250
|
{
|
|
7897
8251
|
as: "span",
|
|
@@ -7900,7 +8254,7 @@ var DateTime = ({
|
|
|
7900
8254
|
className: "Layer__datetime__date"
|
|
7901
8255
|
},
|
|
7902
8256
|
date
|
|
7903
|
-
), !onlyDate && /* @__PURE__ */
|
|
8257
|
+
), !onlyDate && /* @__PURE__ */ import_react76.default.createElement(
|
|
7904
8258
|
Text,
|
|
7905
8259
|
{
|
|
7906
8260
|
as: "span",
|
|
@@ -7913,22 +8267,22 @@ var DateTime = ({
|
|
|
7913
8267
|
};
|
|
7914
8268
|
|
|
7915
8269
|
// src/components/DetailsList/DetailsList.tsx
|
|
7916
|
-
var
|
|
7917
|
-
var
|
|
8270
|
+
var import_react77 = __toESM(require("react"));
|
|
8271
|
+
var import_classnames35 = __toESM(require("classnames"));
|
|
7918
8272
|
var DetailsList = ({
|
|
7919
8273
|
title,
|
|
7920
8274
|
children,
|
|
7921
8275
|
className,
|
|
7922
8276
|
actions
|
|
7923
8277
|
}) => {
|
|
7924
|
-
return /* @__PURE__ */
|
|
8278
|
+
return /* @__PURE__ */ import_react77.default.createElement("div", { className: (0, import_classnames35.default)("Layer__details-list", className) }, title && /* @__PURE__ */ import_react77.default.createElement(Header, null, /* @__PURE__ */ import_react77.default.createElement(Heading, { size: "secondary" /* secondary */ }, title), actions && /* @__PURE__ */ import_react77.default.createElement("div", { className: "Layer__details-list__actions" }, actions)), /* @__PURE__ */ import_react77.default.createElement("ul", { className: "Layer__details-list__list" }, children));
|
|
7925
8279
|
};
|
|
7926
8280
|
|
|
7927
8281
|
// src/components/DetailsList/DetailsListItem.tsx
|
|
7928
|
-
var
|
|
8282
|
+
var import_react78 = __toESM(require("react"));
|
|
7929
8283
|
var renderValue = (value) => {
|
|
7930
8284
|
if (typeof value === "string") {
|
|
7931
|
-
return /* @__PURE__ */
|
|
8285
|
+
return /* @__PURE__ */ import_react78.default.createElement(Text, { weight: "bold" /* bold */, size: "sm" /* sm */ }, value);
|
|
7932
8286
|
}
|
|
7933
8287
|
return value;
|
|
7934
8288
|
};
|
|
@@ -7937,7 +8291,7 @@ var DetailsListItem = ({
|
|
|
7937
8291
|
children,
|
|
7938
8292
|
isLoading
|
|
7939
8293
|
}) => {
|
|
7940
|
-
return /* @__PURE__ */
|
|
8294
|
+
return /* @__PURE__ */ import_react78.default.createElement("li", { className: "Layer__details-list-item" }, /* @__PURE__ */ import_react78.default.createElement("label", { className: "Layer__details-list-item__label" }, label), /* @__PURE__ */ import_react78.default.createElement("span", { className: "Layer__details-list-item__value" }, isLoading ? /* @__PURE__ */ import_react78.default.createElement(SkeletonLoader, null) : renderValue(children)));
|
|
7941
8295
|
};
|
|
7942
8296
|
|
|
7943
8297
|
// src/components/LedgerAccountEntryDetails/LedgerAccountEntryDetails.tsx
|
|
@@ -7945,39 +8299,39 @@ var SourceDetailView = ({ source }) => {
|
|
|
7945
8299
|
switch (source.type) {
|
|
7946
8300
|
case "Transaction_Ledger_Entry_Source": {
|
|
7947
8301
|
const transactionSource = source;
|
|
7948
|
-
return /* @__PURE__ */
|
|
8302
|
+
return /* @__PURE__ */ import_react79.default.createElement(import_react79.default.Fragment, null, /* @__PURE__ */ import_react79.default.createElement(DetailsListItem, { label: "Account name" }, transactionSource.account_name), /* @__PURE__ */ import_react79.default.createElement(DetailsListItem, { label: "Date" }, /* @__PURE__ */ import_react79.default.createElement(DateTime, { value: transactionSource.date })), /* @__PURE__ */ import_react79.default.createElement(DetailsListItem, { label: "Amount" }, `$${centsToDollars(transactionSource.amount)}`), /* @__PURE__ */ import_react79.default.createElement(DetailsListItem, { label: "Direction" }, transactionSource.direction), /* @__PURE__ */ import_react79.default.createElement(DetailsListItem, { label: "Counterparty" }, transactionSource.counterparty));
|
|
7949
8303
|
}
|
|
7950
8304
|
case "Invoice_Ledger_Entry_Source": {
|
|
7951
8305
|
const invoiceSource = source;
|
|
7952
|
-
return /* @__PURE__ */
|
|
8306
|
+
return /* @__PURE__ */ import_react79.default.createElement(import_react79.default.Fragment, null, /* @__PURE__ */ import_react79.default.createElement(DetailsListItem, { label: "Invoice number" }, invoiceSource.invoice_number), /* @__PURE__ */ import_react79.default.createElement(DetailsListItem, { label: "Recipient name" }, invoiceSource.recipient_name), /* @__PURE__ */ import_react79.default.createElement(DetailsListItem, { label: "Date" }, /* @__PURE__ */ import_react79.default.createElement(DateTime, { value: invoiceSource.date })), /* @__PURE__ */ import_react79.default.createElement(DetailsListItem, { label: "Amount" }, `$${centsToDollars(invoiceSource.amount)}`));
|
|
7953
8307
|
}
|
|
7954
8308
|
case "Manual_Ledger_Entry_Source": {
|
|
7955
8309
|
const manualSource = source;
|
|
7956
|
-
return /* @__PURE__ */
|
|
8310
|
+
return /* @__PURE__ */ import_react79.default.createElement(import_react79.default.Fragment, null, /* @__PURE__ */ import_react79.default.createElement(DetailsListItem, { label: "Memo" }, manualSource.memo), /* @__PURE__ */ import_react79.default.createElement(DetailsListItem, { label: "Created by" }, manualSource.created_by));
|
|
7957
8311
|
}
|
|
7958
8312
|
case "Invoice_Payment_Ledger_Entry_Source": {
|
|
7959
8313
|
const invoicePaymentSource = source;
|
|
7960
|
-
return /* @__PURE__ */
|
|
8314
|
+
return /* @__PURE__ */ import_react79.default.createElement(import_react79.default.Fragment, null, /* @__PURE__ */ import_react79.default.createElement(DetailsListItem, { label: "Invoice number" }, invoicePaymentSource.invoice_number), /* @__PURE__ */ import_react79.default.createElement(DetailsListItem, { label: "Amount" }, `$${centsToDollars(invoicePaymentSource.amount)}`));
|
|
7961
8315
|
}
|
|
7962
8316
|
case "Refund_Ledger_Entry_Source": {
|
|
7963
8317
|
const refundSource = source;
|
|
7964
|
-
return /* @__PURE__ */
|
|
8318
|
+
return /* @__PURE__ */ import_react79.default.createElement(import_react79.default.Fragment, null, /* @__PURE__ */ import_react79.default.createElement(DetailsListItem, { label: "Amount" }, `$${centsToDollars(refundSource.refunded_to_customer_amount)}`), /* @__PURE__ */ import_react79.default.createElement(DetailsListItem, { label: "Recipient name" }, refundSource.recipient_name));
|
|
7965
8319
|
}
|
|
7966
8320
|
case "Opening_Balance_Ledger_Entry_Source": {
|
|
7967
8321
|
const openingBalanceSource = source;
|
|
7968
|
-
return /* @__PURE__ */
|
|
8322
|
+
return /* @__PURE__ */ import_react79.default.createElement(import_react79.default.Fragment, null, /* @__PURE__ */ import_react79.default.createElement(DetailsListItem, { label: "Account name" }, openingBalanceSource.account_name));
|
|
7969
8323
|
}
|
|
7970
8324
|
case "Payout_Ledger_Entry_Source": {
|
|
7971
8325
|
const payoutSource = source;
|
|
7972
|
-
return /* @__PURE__ */
|
|
8326
|
+
return /* @__PURE__ */ import_react79.default.createElement(import_react79.default.Fragment, null, /* @__PURE__ */ import_react79.default.createElement(DetailsListItem, { label: "Amount" }, `$${centsToDollars(payoutSource.paid_out_amount)}`), /* @__PURE__ */ import_react79.default.createElement(DetailsListItem, { label: "Processor" }, payoutSource.processor));
|
|
7973
8327
|
}
|
|
7974
8328
|
default:
|
|
7975
8329
|
return null;
|
|
7976
8330
|
}
|
|
7977
8331
|
};
|
|
7978
8332
|
var LedgerAccountEntryDetails = () => {
|
|
7979
|
-
const { entryData, isLoadingEntry, closeSelectedEntry, errorEntry } = (0,
|
|
7980
|
-
const { totalDebit, totalCredit } = (0,
|
|
8333
|
+
const { entryData, isLoadingEntry, closeSelectedEntry, errorEntry } = (0, import_react79.useContext)(LedgerAccountsContext);
|
|
8334
|
+
const { totalDebit, totalCredit } = (0, import_react79.useMemo)(() => {
|
|
7981
8335
|
let totalDebit2 = 0;
|
|
7982
8336
|
let totalCredit2 = 0;
|
|
7983
8337
|
entryData?.line_items?.forEach((item) => {
|
|
@@ -7989,47 +8343,47 @@ var LedgerAccountEntryDetails = () => {
|
|
|
7989
8343
|
});
|
|
7990
8344
|
return { totalDebit: totalDebit2, totalCredit: totalCredit2 };
|
|
7991
8345
|
}, [entryData]);
|
|
7992
|
-
return /* @__PURE__ */
|
|
8346
|
+
return /* @__PURE__ */ import_react79.default.createElement("div", { className: "Layer__ledger-account__entry-details" }, /* @__PURE__ */ import_react79.default.createElement("div", { className: "Layer__ledger-account__entry-details__back-btn" }, /* @__PURE__ */ import_react79.default.createElement(BackButton, { onClick: () => closeSelectedEntry() })), /* @__PURE__ */ import_react79.default.createElement(
|
|
7993
8347
|
DetailsList,
|
|
7994
8348
|
{
|
|
7995
8349
|
title: "Transaction source",
|
|
7996
|
-
actions: /* @__PURE__ */
|
|
8350
|
+
actions: /* @__PURE__ */ import_react79.default.createElement(
|
|
7997
8351
|
IconButton,
|
|
7998
8352
|
{
|
|
7999
|
-
icon: /* @__PURE__ */
|
|
8353
|
+
icon: /* @__PURE__ */ import_react79.default.createElement(X_default, null),
|
|
8000
8354
|
onClick: () => closeSelectedEntry(),
|
|
8001
8355
|
className: "Layer__hidden-sm Layer__hidden-xs"
|
|
8002
8356
|
}
|
|
8003
8357
|
)
|
|
8004
8358
|
},
|
|
8005
|
-
/* @__PURE__ */
|
|
8006
|
-
entryData?.source?.display_description && /* @__PURE__ */
|
|
8007
|
-
), /* @__PURE__ */
|
|
8359
|
+
/* @__PURE__ */ import_react79.default.createElement(DetailsListItem, { label: "Source", isLoading: isLoadingEntry }, /* @__PURE__ */ import_react79.default.createElement(Badge, null, entryData?.source?.entity_name)),
|
|
8360
|
+
entryData?.source?.display_description && /* @__PURE__ */ import_react79.default.createElement(SourceDetailView, { source: entryData?.source })
|
|
8361
|
+
), /* @__PURE__ */ import_react79.default.createElement(
|
|
8008
8362
|
DetailsList,
|
|
8009
8363
|
{
|
|
8010
8364
|
title: `Journal Entry ${entryData?.id.substring(0, 5)}`,
|
|
8011
8365
|
className: "Layer__border-top"
|
|
8012
8366
|
},
|
|
8013
|
-
/* @__PURE__ */
|
|
8014
|
-
/* @__PURE__ */
|
|
8015
|
-
/* @__PURE__ */
|
|
8016
|
-
entryData?.reversal_id && /* @__PURE__ */
|
|
8017
|
-
), !isLoadingEntry && !errorEntry ? /* @__PURE__ */
|
|
8367
|
+
/* @__PURE__ */ import_react79.default.createElement(DetailsListItem, { label: "Entry type", isLoading: isLoadingEntry }, humanizeEnum(entryData?.entry_type ?? "")),
|
|
8368
|
+
/* @__PURE__ */ import_react79.default.createElement(DetailsListItem, { label: "Date", isLoading: isLoadingEntry }, entryData?.entry_at && /* @__PURE__ */ import_react79.default.createElement(DateTime, { value: entryData?.entry_at })),
|
|
8369
|
+
/* @__PURE__ */ import_react79.default.createElement(DetailsListItem, { label: "Creation date", isLoading: isLoadingEntry }, entryData?.date && /* @__PURE__ */ import_react79.default.createElement(DateTime, { value: entryData?.date })),
|
|
8370
|
+
entryData?.reversal_id && /* @__PURE__ */ import_react79.default.createElement(DetailsListItem, { label: "Reversal", isLoading: isLoadingEntry }, entryData?.reversal_id.substring(0, 5))
|
|
8371
|
+
), !isLoadingEntry && !errorEntry ? /* @__PURE__ */ import_react79.default.createElement("div", { className: "Layer__ledger-account__entry-details__line-items" }, /* @__PURE__ */ import_react79.default.createElement(Card, null, /* @__PURE__ */ import_react79.default.createElement("table", { className: "Layer__table Layer__ledger-account__entry-details__table" }, /* @__PURE__ */ import_react79.default.createElement("thead", null, /* @__PURE__ */ import_react79.default.createElement("tr", null, /* @__PURE__ */ import_react79.default.createElement("th", { className: "Layer__table-header" }, "Line items"), /* @__PURE__ */ import_react79.default.createElement("th", { className: "Layer__table-header Layer__table-cell--amount" }, "Debit"), /* @__PURE__ */ import_react79.default.createElement("th", { className: "Layer__table-header Layer__table-cell--amount" }, "Credit"))), /* @__PURE__ */ import_react79.default.createElement("tbody", null, entryData?.line_items?.map((item) => /* @__PURE__ */ import_react79.default.createElement("tr", { key: `ledger-line-item-${item.id}` }, /* @__PURE__ */ import_react79.default.createElement("td", { className: "Layer__table-cell" }, item.account?.name || ""), /* @__PURE__ */ import_react79.default.createElement("td", { className: "Layer__table-cell Layer__table-cell--amount" }, item.direction === "DEBIT" /* DEBIT */ && /* @__PURE__ */ import_react79.default.createElement(Badge, { variant: "warning" /* WARNING */ }, "$", centsToDollars(item.amount || 0))), /* @__PURE__ */ import_react79.default.createElement("td", { className: "Layer__table-cell Layer__table-cell--amount" }, item.direction === "CREDIT" /* CREDIT */ && /* @__PURE__ */ import_react79.default.createElement(Badge, { variant: "success" /* SUCCESS */ }, "$", centsToDollars(item.amount || 0))))), /* @__PURE__ */ import_react79.default.createElement("tr", { className: "Layer__table Layer__ledger-account__entry-details__table__total-row" }, /* @__PURE__ */ import_react79.default.createElement("td", { className: "Layer__table-cell" }, "Total"), /* @__PURE__ */ import_react79.default.createElement("td", { className: "Layer__table-cell Layer__table-cell--amount" }, "$", centsToDollars(totalDebit || 0)), /* @__PURE__ */ import_react79.default.createElement("td", { className: "Layer__table-cell Layer__table-cell--amount" }, "$", centsToDollars(totalCredit || 0))))))) : null);
|
|
8018
8372
|
};
|
|
8019
8373
|
|
|
8020
8374
|
// src/components/LedgerAccount/LedgerAccountRow.tsx
|
|
8021
|
-
var
|
|
8022
|
-
var
|
|
8023
|
-
var
|
|
8375
|
+
var import_react80 = __toESM(require("react"));
|
|
8376
|
+
var import_classnames36 = __toESM(require("classnames"));
|
|
8377
|
+
var import_date_fns18 = require("date-fns");
|
|
8024
8378
|
var LedgerAccountRow = ({
|
|
8025
8379
|
row,
|
|
8026
8380
|
index,
|
|
8027
8381
|
initialLoad,
|
|
8028
8382
|
view
|
|
8029
8383
|
}) => {
|
|
8030
|
-
const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = (0,
|
|
8031
|
-
const [showComponent, setShowComponent] = (0,
|
|
8032
|
-
(0,
|
|
8384
|
+
const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = (0, import_react80.useContext)(LedgerAccountsContext);
|
|
8385
|
+
const [showComponent, setShowComponent] = (0, import_react80.useState)(false);
|
|
8386
|
+
(0, import_react80.useEffect)(() => {
|
|
8033
8387
|
if (initialLoad) {
|
|
8034
8388
|
const timeoutId = setTimeout(() => {
|
|
8035
8389
|
setShowComponent(true);
|
|
@@ -8040,10 +8394,10 @@ var LedgerAccountRow = ({
|
|
|
8040
8394
|
}
|
|
8041
8395
|
}, []);
|
|
8042
8396
|
if (view === "tablet") {
|
|
8043
|
-
return /* @__PURE__ */
|
|
8397
|
+
return /* @__PURE__ */ import_react80.default.createElement(
|
|
8044
8398
|
"tr",
|
|
8045
8399
|
{
|
|
8046
|
-
className: (0,
|
|
8400
|
+
className: (0, import_classnames36.default)(
|
|
8047
8401
|
"Layer__table-row",
|
|
8048
8402
|
row.entry_id === selectedEntryId && "Layer__table-row--active",
|
|
8049
8403
|
initialLoad && "initial-load",
|
|
@@ -8059,24 +8413,24 @@ var LedgerAccountRow = ({
|
|
|
8059
8413
|
}
|
|
8060
8414
|
}
|
|
8061
8415
|
},
|
|
8062
|
-
/* @__PURE__ */
|
|
8416
|
+
/* @__PURE__ */ import_react80.default.createElement("td", { className: "Layer__table-cell Layer__ledger-account-table__tablet-main-col" }, /* @__PURE__ */ import_react80.default.createElement("span", { className: "Layer__table-cell-content" }, /* @__PURE__ */ import_react80.default.createElement("div", { className: "Layer__ledger-account-table__tablet-main-col__date" }, /* @__PURE__ */ import_react80.default.createElement(Text, null, row.date && (0, import_date_fns18.format)((0, import_date_fns18.parseISO)(row.date), DATE_FORMAT)), /* @__PURE__ */ import_react80.default.createElement(
|
|
8063
8417
|
Text,
|
|
8064
8418
|
{
|
|
8065
8419
|
weight: "normal" /* normal */,
|
|
8066
8420
|
className: "Layer__ledger_account-table__journal-id"
|
|
8067
8421
|
},
|
|
8068
8422
|
row.entry_id.substring(0, 5)
|
|
8069
|
-
)), /* @__PURE__ */
|
|
8070
|
-
/* @__PURE__ */
|
|
8071
|
-
/* @__PURE__ */
|
|
8072
|
-
/* @__PURE__ */
|
|
8423
|
+
)), /* @__PURE__ */ import_react80.default.createElement(Text, null, row.source?.display_description ?? ""))),
|
|
8424
|
+
/* @__PURE__ */ import_react80.default.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, /* @__PURE__ */ import_react80.default.createElement("span", { className: "Layer__table-cell-content Layer__table-cell--amount" }, row.direction === "DEBIT" /* DEBIT */ && `$${centsToDollars(row?.amount || 0)}`)),
|
|
8425
|
+
/* @__PURE__ */ import_react80.default.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, /* @__PURE__ */ import_react80.default.createElement("span", { className: "Layer__table-cell-content Layer__table-cell--amount" }, row.direction === "CREDIT" /* CREDIT */ && `$${centsToDollars(row?.amount || 0)}`)),
|
|
8426
|
+
/* @__PURE__ */ import_react80.default.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, /* @__PURE__ */ import_react80.default.createElement("span", { className: "Layer__table-cell-content Layer__table-cell--amount" }, `$${centsToDollars(row.running_balance)}`))
|
|
8073
8427
|
);
|
|
8074
8428
|
}
|
|
8075
8429
|
if (view === "mobile") {
|
|
8076
|
-
return /* @__PURE__ */
|
|
8430
|
+
return /* @__PURE__ */ import_react80.default.createElement(
|
|
8077
8431
|
"tr",
|
|
8078
8432
|
{
|
|
8079
|
-
className: (0,
|
|
8433
|
+
className: (0, import_classnames36.default)(
|
|
8080
8434
|
"Layer__table-row",
|
|
8081
8435
|
row.entry_id === selectedEntryId && "Layer__table-row--active",
|
|
8082
8436
|
initialLoad && "initial-load",
|
|
@@ -8092,20 +8446,20 @@ var LedgerAccountRow = ({
|
|
|
8092
8446
|
}
|
|
8093
8447
|
}
|
|
8094
8448
|
},
|
|
8095
|
-
/* @__PURE__ */
|
|
8449
|
+
/* @__PURE__ */ import_react80.default.createElement("td", { className: "Layer__table-cell Layer__ledger-account-table__tablet-main-col" }, /* @__PURE__ */ import_react80.default.createElement("span", { className: "Layer__table-cell-content" }, /* @__PURE__ */ import_react80.default.createElement("div", { className: "Layer__ledger-account-table__tablet-main-col__date" }, /* @__PURE__ */ import_react80.default.createElement(Text, null, row.date && (0, import_date_fns18.format)((0, import_date_fns18.parseISO)(row.date), DATE_FORMAT)), /* @__PURE__ */ import_react80.default.createElement(
|
|
8096
8450
|
Text,
|
|
8097
8451
|
{
|
|
8098
8452
|
weight: "normal" /* normal */,
|
|
8099
8453
|
className: "Layer__ledger_account-table__journal-id"
|
|
8100
8454
|
},
|
|
8101
8455
|
row.entry_id.substring(0, 5)
|
|
8102
|
-
)), /* @__PURE__ */
|
|
8456
|
+
)), /* @__PURE__ */ import_react80.default.createElement(Text, null, row.source?.display_description ?? ""), /* @__PURE__ */ import_react80.default.createElement("div", { className: "Layer__ledger_account-table__balances-mobile" }, /* @__PURE__ */ import_react80.default.createElement("div", { className: "Layer__ledger_account-table__balance-item" }, /* @__PURE__ */ import_react80.default.createElement("span", { className: "Layer__ledger_account-table__balances-mobile__label" }, "Debit"), /* @__PURE__ */ import_react80.default.createElement("span", { className: "Layer__ledger_account-table__balances-mobile__value" }, " ", row.direction === "DEBIT" /* DEBIT */ && `$${centsToDollars(row?.amount || 0)}`)), /* @__PURE__ */ import_react80.default.createElement("div", { className: "Layer__ledger_account-table__balance-item" }, /* @__PURE__ */ import_react80.default.createElement("span", { className: "Layer__ledger_account-table__balances-mobile__label" }, "Credit"), /* @__PURE__ */ import_react80.default.createElement("span", { className: "Layer__ledger_account-table__balances-mobile__value" }, row.direction === "CREDIT" /* CREDIT */ && `$${centsToDollars(row?.amount || 0)}`)), /* @__PURE__ */ import_react80.default.createElement("div", { className: "Layer__ledger_account-table__balance-item" }, /* @__PURE__ */ import_react80.default.createElement("span", { className: "Layer__ledger_account-table__balances-mobile__label" }, "Running balance"), /* @__PURE__ */ import_react80.default.createElement("span", { className: "Layer__ledger_account-table__balances-mobile__value" }, `$${centsToDollars(row.running_balance)}`)))))
|
|
8103
8457
|
);
|
|
8104
8458
|
}
|
|
8105
|
-
return /* @__PURE__ */
|
|
8459
|
+
return /* @__PURE__ */ import_react80.default.createElement(
|
|
8106
8460
|
"tr",
|
|
8107
8461
|
{
|
|
8108
|
-
className: (0,
|
|
8462
|
+
className: (0, import_classnames36.default)(
|
|
8109
8463
|
"Layer__table-row",
|
|
8110
8464
|
row.entry_id === selectedEntryId && "Layer__table-row--active",
|
|
8111
8465
|
initialLoad && "initial-load",
|
|
@@ -8121,25 +8475,25 @@ var LedgerAccountRow = ({
|
|
|
8121
8475
|
}
|
|
8122
8476
|
}
|
|
8123
8477
|
},
|
|
8124
|
-
/* @__PURE__ */
|
|
8125
|
-
/* @__PURE__ */
|
|
8126
|
-
/* @__PURE__ */
|
|
8127
|
-
/* @__PURE__ */
|
|
8128
|
-
/* @__PURE__ */
|
|
8129
|
-
/* @__PURE__ */
|
|
8478
|
+
/* @__PURE__ */ import_react80.default.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ import_react80.default.createElement("span", { className: "Layer__table-cell-content" }, row.date && (0, import_date_fns18.format)((0, import_date_fns18.parseISO)(row.date), DATE_FORMAT))),
|
|
8479
|
+
/* @__PURE__ */ import_react80.default.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ import_react80.default.createElement("span", { className: "Layer__table-cell-content" }, row.entry_id.substring(0, 5))),
|
|
8480
|
+
/* @__PURE__ */ import_react80.default.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ import_react80.default.createElement("span", { className: "Layer__table-cell-content" }, row.source?.display_description ?? "")),
|
|
8481
|
+
/* @__PURE__ */ import_react80.default.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, /* @__PURE__ */ import_react80.default.createElement("span", { className: "Layer__table-cell-content Layer__table-cell--amount" }, row.direction === "DEBIT" /* DEBIT */ && `$${centsToDollars(row?.amount || 0)}`)),
|
|
8482
|
+
/* @__PURE__ */ import_react80.default.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, /* @__PURE__ */ import_react80.default.createElement("span", { className: "Layer__table-cell-content Layer__table-cell--amount" }, row.direction === "CREDIT" /* CREDIT */ && `$${centsToDollars(row?.amount || 0)}`)),
|
|
8483
|
+
/* @__PURE__ */ import_react80.default.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, /* @__PURE__ */ import_react80.default.createElement("span", { className: "Layer__table-cell-content Layer__table-cell--amount" }, `$${centsToDollars(row.running_balance)}`))
|
|
8130
8484
|
);
|
|
8131
8485
|
};
|
|
8132
8486
|
|
|
8133
8487
|
// src/components/LedgerAccount/LedgerAccountIndex.tsx
|
|
8134
|
-
var
|
|
8488
|
+
var import_classnames37 = __toESM(require("classnames"));
|
|
8135
8489
|
var LedgerAccount = ({
|
|
8136
8490
|
containerRef,
|
|
8137
8491
|
pageSize = 15,
|
|
8138
8492
|
view
|
|
8139
8493
|
}) => {
|
|
8140
|
-
const [currentPage, setCurrentPage] = (0,
|
|
8141
|
-
const [initialLoad, setInitialLoad] = (0,
|
|
8142
|
-
const { data: accountData } = (0,
|
|
8494
|
+
const [currentPage, setCurrentPage] = (0, import_react81.useState)(1);
|
|
8495
|
+
const [initialLoad, setInitialLoad] = (0, import_react81.useState)(true);
|
|
8496
|
+
const { data: accountData } = (0, import_react81.useContext)(ChartOfAccountsContext);
|
|
8143
8497
|
const {
|
|
8144
8498
|
data: rawData,
|
|
8145
8499
|
error,
|
|
@@ -8150,8 +8504,8 @@ var LedgerAccount = ({
|
|
|
8150
8504
|
selectedEntryId,
|
|
8151
8505
|
closeSelectedEntry,
|
|
8152
8506
|
refetch
|
|
8153
|
-
} = (0,
|
|
8154
|
-
(0,
|
|
8507
|
+
} = (0, import_react81.useContext)(LedgerAccountsContext);
|
|
8508
|
+
(0, import_react81.useEffect)(() => {
|
|
8155
8509
|
if (!isLoading) {
|
|
8156
8510
|
const timeoutLoad = setTimeout(() => {
|
|
8157
8511
|
setInitialLoad(false);
|
|
@@ -8159,16 +8513,16 @@ var LedgerAccount = ({
|
|
|
8159
8513
|
return () => clearTimeout(timeoutLoad);
|
|
8160
8514
|
}
|
|
8161
8515
|
}, [isLoading]);
|
|
8162
|
-
const baseClassName = (0,
|
|
8516
|
+
const baseClassName = (0, import_classnames37.default)(
|
|
8163
8517
|
"Layer__ledger-account__index",
|
|
8164
8518
|
accountId && "open"
|
|
8165
8519
|
);
|
|
8166
|
-
const entry = (0,
|
|
8520
|
+
const entry = (0, import_react81.useMemo)(() => {
|
|
8167
8521
|
return flattenAccounts(accountData?.accounts || []).find(
|
|
8168
8522
|
(x) => x.id === accountId
|
|
8169
8523
|
);
|
|
8170
8524
|
}, [accountId]);
|
|
8171
|
-
const data = (0,
|
|
8525
|
+
const data = (0, import_react81.useMemo)(() => {
|
|
8172
8526
|
const firstPageIndex = (currentPage - 1) * pageSize;
|
|
8173
8527
|
const lastPageIndex = firstPageIndex + pageSize;
|
|
8174
8528
|
return rawData?.sort((a, b) => Date.parse(b.date) - Date.parse(a.date))?.slice(firstPageIndex, lastPageIndex);
|
|
@@ -8177,36 +8531,36 @@ var LedgerAccount = ({
|
|
|
8177
8531
|
setAccountId(void 0);
|
|
8178
8532
|
closeSelectedEntry();
|
|
8179
8533
|
};
|
|
8180
|
-
return /* @__PURE__ */
|
|
8534
|
+
return /* @__PURE__ */ import_react81.default.createElement(
|
|
8181
8535
|
Panel,
|
|
8182
8536
|
{
|
|
8183
|
-
sidebar: /* @__PURE__ */
|
|
8537
|
+
sidebar: /* @__PURE__ */ import_react81.default.createElement(LedgerAccountEntryDetails, null),
|
|
8184
8538
|
sidebarIsOpen: Boolean(selectedEntryId),
|
|
8185
8539
|
parentRef: containerRef,
|
|
8186
8540
|
className: "Layer__ledger-account__panel"
|
|
8187
8541
|
},
|
|
8188
|
-
/* @__PURE__ */
|
|
8542
|
+
/* @__PURE__ */ import_react81.default.createElement("div", { className: baseClassName }, /* @__PURE__ */ import_react81.default.createElement("div", { className: "Layer__ledger-account__header" }, /* @__PURE__ */ import_react81.default.createElement(BackButton, { onClick: close }), /* @__PURE__ */ import_react81.default.createElement("div", { className: "Layer__ledger-account__title-container" }, /* @__PURE__ */ import_react81.default.createElement(
|
|
8189
8543
|
Text,
|
|
8190
8544
|
{
|
|
8191
8545
|
weight: "bold" /* bold */,
|
|
8192
8546
|
className: "Layer__ledger-account__title"
|
|
8193
8547
|
},
|
|
8194
8548
|
entry?.name ?? ""
|
|
8195
|
-
), /* @__PURE__ */
|
|
8549
|
+
), /* @__PURE__ */ import_react81.default.createElement(
|
|
8196
8550
|
Button,
|
|
8197
8551
|
{
|
|
8198
8552
|
variant: "secondary" /* secondary */,
|
|
8199
|
-
rightIcon: /* @__PURE__ */
|
|
8553
|
+
rightIcon: /* @__PURE__ */ import_react81.default.createElement(DownloadCloud_default, { size: 12 })
|
|
8200
8554
|
},
|
|
8201
8555
|
"Download"
|
|
8202
|
-
)), /* @__PURE__ */
|
|
8556
|
+
)), /* @__PURE__ */ import_react81.default.createElement("div", { className: "Layer__ledger-account__balance-container" }, /* @__PURE__ */ import_react81.default.createElement(
|
|
8203
8557
|
Text,
|
|
8204
8558
|
{
|
|
8205
8559
|
weight: "bold" /* bold */,
|
|
8206
8560
|
className: "Layer__ledger-account__balance-label"
|
|
8207
8561
|
},
|
|
8208
8562
|
"Current balance"
|
|
8209
|
-
), /* @__PURE__ */
|
|
8563
|
+
), /* @__PURE__ */ import_react81.default.createElement(
|
|
8210
8564
|
Text,
|
|
8211
8565
|
{
|
|
8212
8566
|
weight: "bold" /* bold */,
|
|
@@ -8214,7 +8568,7 @@ var LedgerAccount = ({
|
|
|
8214
8568
|
},
|
|
8215
8569
|
"$",
|
|
8216
8570
|
centsToDollars(entry?.balance || 0)
|
|
8217
|
-
))), /* @__PURE__ */
|
|
8571
|
+
))), /* @__PURE__ */ import_react81.default.createElement("table", { className: "Layer__table Layer__table--hover-effect Layer__ledger-account-table" }, /* @__PURE__ */ import_react81.default.createElement("thead", null, /* @__PURE__ */ import_react81.default.createElement("tr", null, view !== "desktop" && /* @__PURE__ */ import_react81.default.createElement("th", null), view === "desktop" && /* @__PURE__ */ import_react81.default.createElement(import_react81.default.Fragment, null, /* @__PURE__ */ import_react81.default.createElement("th", { className: "Layer__table-header" }, "Date"), /* @__PURE__ */ import_react81.default.createElement("th", { className: "Layer__table-header" }, "Journal id #"), /* @__PURE__ */ import_react81.default.createElement("th", { className: "Layer__table-header" }, "Source")), view !== "mobile" && /* @__PURE__ */ import_react81.default.createElement(import_react81.default.Fragment, null, /* @__PURE__ */ import_react81.default.createElement("th", { className: "Layer__table-header Layer__table-cell--amount" }, "Debit"), /* @__PURE__ */ import_react81.default.createElement("th", { className: "Layer__table-header Layer__table-cell--amount" }, "Credit"), /* @__PURE__ */ import_react81.default.createElement("th", { className: "Layer__table-header Layer__table-cell--amount" }, "Running balance")))), /* @__PURE__ */ import_react81.default.createElement("tbody", null, data?.map((x, index) => /* @__PURE__ */ import_react81.default.createElement(
|
|
8218
8572
|
LedgerAccountRow,
|
|
8219
8573
|
{
|
|
8220
8574
|
key: x.id,
|
|
@@ -8223,7 +8577,7 @@ var LedgerAccount = ({
|
|
|
8223
8577
|
initialLoad,
|
|
8224
8578
|
view
|
|
8225
8579
|
}
|
|
8226
|
-
)))), data && /* @__PURE__ */
|
|
8580
|
+
)))), data && /* @__PURE__ */ import_react81.default.createElement("div", { className: "Layer__ledger-account__pagination" }, /* @__PURE__ */ import_react81.default.createElement(
|
|
8227
8581
|
Pagination,
|
|
8228
8582
|
{
|
|
8229
8583
|
currentPage,
|
|
@@ -8231,7 +8585,7 @@ var LedgerAccount = ({
|
|
|
8231
8585
|
pageSize,
|
|
8232
8586
|
onPageChange: (page) => setCurrentPage(page)
|
|
8233
8587
|
}
|
|
8234
|
-
)), error ? /* @__PURE__ */
|
|
8588
|
+
)), error ? /* @__PURE__ */ import_react81.default.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ import_react81.default.createElement(
|
|
8235
8589
|
DataState,
|
|
8236
8590
|
{
|
|
8237
8591
|
status: "failed" /* failed */,
|
|
@@ -8240,7 +8594,7 @@ var LedgerAccount = ({
|
|
|
8240
8594
|
onRefresh: () => refetch(),
|
|
8241
8595
|
isLoading: isValidating || isLoading
|
|
8242
8596
|
}
|
|
8243
|
-
)) : null, (!data || isLoading) && !error ? /* @__PURE__ */
|
|
8597
|
+
)) : null, (!data || isLoading) && !error ? /* @__PURE__ */ import_react81.default.createElement("div", { className: `Layer__ledger-account__loader-container` }, /* @__PURE__ */ import_react81.default.createElement(Loader2, null)) : null, !isLoading && !error && data?.length === 0 ? /* @__PURE__ */ import_react81.default.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ import_react81.default.createElement(
|
|
8244
8598
|
DataState,
|
|
8245
8599
|
{
|
|
8246
8600
|
status: "info" /* info */,
|
|
@@ -8253,7 +8607,7 @@ var LedgerAccount = ({
|
|
|
8253
8607
|
};
|
|
8254
8608
|
|
|
8255
8609
|
// src/components/ChartOfAccounts/ChartOfAccounts.tsx
|
|
8256
|
-
var ChartOfAccountsContext = (0,
|
|
8610
|
+
var ChartOfAccountsContext = (0, import_react82.createContext)(
|
|
8257
8611
|
{
|
|
8258
8612
|
data: void 0,
|
|
8259
8613
|
isLoading: false,
|
|
@@ -8278,7 +8632,7 @@ var ChartOfAccountsContext = (0, import_react81.createContext)(
|
|
|
8278
8632
|
}
|
|
8279
8633
|
}
|
|
8280
8634
|
);
|
|
8281
|
-
var LedgerAccountsContext = (0,
|
|
8635
|
+
var LedgerAccountsContext = (0, import_react82.createContext)({
|
|
8282
8636
|
data: void 0,
|
|
8283
8637
|
entryData: void 0,
|
|
8284
8638
|
isLoading: false,
|
|
@@ -8301,11 +8655,11 @@ var LedgerAccountsContext = (0, import_react81.createContext)({
|
|
|
8301
8655
|
var ChartOfAccounts = (props) => {
|
|
8302
8656
|
const chartOfAccountsContextData = useChartOfAccounts();
|
|
8303
8657
|
const ledgerAccountsContextData = useLedgerAccounts();
|
|
8304
|
-
return /* @__PURE__ */
|
|
8658
|
+
return /* @__PURE__ */ import_react82.default.createElement(ChartOfAccountsContext.Provider, { value: chartOfAccountsContextData }, /* @__PURE__ */ import_react82.default.createElement(LedgerAccountsContext.Provider, { value: ledgerAccountsContextData }, /* @__PURE__ */ import_react82.default.createElement(ChartOfAccountsContent, null)));
|
|
8305
8659
|
};
|
|
8306
8660
|
var ChartOfAccountsContent = ({ asWidget }) => {
|
|
8307
|
-
const { accountId } = (0,
|
|
8308
|
-
const [view, setView] = (0,
|
|
8661
|
+
const { accountId } = (0, import_react82.useContext)(LedgerAccountsContext);
|
|
8662
|
+
const [view, setView] = (0, import_react82.useState)("desktop");
|
|
8309
8663
|
const containerRef = useElementSize((_a, _b, { width }) => {
|
|
8310
8664
|
if (width) {
|
|
8311
8665
|
if (width >= BREAKPOINTS.TABLET && view !== "desktop") {
|
|
@@ -8317,12 +8671,12 @@ var ChartOfAccountsContent = ({ asWidget }) => {
|
|
|
8317
8671
|
}
|
|
8318
8672
|
}
|
|
8319
8673
|
});
|
|
8320
|
-
return /* @__PURE__ */
|
|
8674
|
+
return /* @__PURE__ */ import_react82.default.createElement(Container, { name: "chart-of-accounts", ref: containerRef, asWidget }, accountId ? /* @__PURE__ */ import_react82.default.createElement(LedgerAccount, { view, containerRef }) : /* @__PURE__ */ import_react82.default.createElement(ChartOfAccountsTable, { view, containerRef }));
|
|
8321
8675
|
};
|
|
8322
8676
|
|
|
8323
8677
|
// src/providers/LayerProvider/LayerProvider.tsx
|
|
8324
|
-
var
|
|
8325
|
-
var
|
|
8678
|
+
var import_react83 = __toESM(require("react"));
|
|
8679
|
+
var import_date_fns19 = require("date-fns");
|
|
8326
8680
|
var import_swr8 = __toESM(require("swr"));
|
|
8327
8681
|
var reducer = (state, action) => {
|
|
8328
8682
|
switch (action.type) {
|
|
@@ -8363,7 +8717,7 @@ var LayerProvider = ({
|
|
|
8363
8717
|
};
|
|
8364
8718
|
const colors = buildColorsPalette(theme);
|
|
8365
8719
|
const { url, scope, apiUrl } = LayerEnvironment[environment];
|
|
8366
|
-
const [state, dispatch] = (0,
|
|
8720
|
+
const [state, dispatch] = (0, import_react83.useReducer)(reducer, {
|
|
8367
8721
|
auth: {
|
|
8368
8722
|
access_token: "",
|
|
8369
8723
|
token_type: "",
|
|
@@ -8377,7 +8731,7 @@ var LayerProvider = ({
|
|
|
8377
8731
|
colors
|
|
8378
8732
|
});
|
|
8379
8733
|
const { data: auth } = appId !== void 0 && appSecret !== void 0 ? (0, import_swr8.default)(
|
|
8380
|
-
businessAccessToken === void 0 && appId !== void 0 && appSecret !== void 0 && (0,
|
|
8734
|
+
businessAccessToken === void 0 && appId !== void 0 && appSecret !== void 0 && (0, import_date_fns19.isBefore)(state.auth.expires_at, /* @__PURE__ */ new Date()) && "authenticate",
|
|
8381
8735
|
Layer.authenticate({
|
|
8382
8736
|
appId,
|
|
8383
8737
|
appSecret,
|
|
@@ -8386,7 +8740,7 @@ var LayerProvider = ({
|
|
|
8386
8740
|
}),
|
|
8387
8741
|
defaultSWRConfig
|
|
8388
8742
|
) : { data: void 0 };
|
|
8389
|
-
(0,
|
|
8743
|
+
(0, import_react83.useEffect)(() => {
|
|
8390
8744
|
if (businessAccessToken) {
|
|
8391
8745
|
dispatch({
|
|
8392
8746
|
type: "LayerContext.setAuth" /* setAuth */,
|
|
@@ -8395,7 +8749,7 @@ var LayerProvider = ({
|
|
|
8395
8749
|
access_token: businessAccessToken,
|
|
8396
8750
|
token_type: "Bearer",
|
|
8397
8751
|
expires_in: 3600,
|
|
8398
|
-
expires_at: (0,
|
|
8752
|
+
expires_at: (0, import_date_fns19.add)(/* @__PURE__ */ new Date(), { seconds: 3600 })
|
|
8399
8753
|
}
|
|
8400
8754
|
}
|
|
8401
8755
|
});
|
|
@@ -8405,7 +8759,7 @@ var LayerProvider = ({
|
|
|
8405
8759
|
payload: {
|
|
8406
8760
|
auth: {
|
|
8407
8761
|
...auth,
|
|
8408
|
-
expires_at: (0,
|
|
8762
|
+
expires_at: (0, import_date_fns19.add)(/* @__PURE__ */ new Date(), { seconds: auth.expires_in })
|
|
8409
8763
|
}
|
|
8410
8764
|
}
|
|
8411
8765
|
});
|
|
@@ -8460,7 +8814,7 @@ var LayerProvider = ({
|
|
|
8460
8814
|
}
|
|
8461
8815
|
return;
|
|
8462
8816
|
};
|
|
8463
|
-
return /* @__PURE__ */
|
|
8817
|
+
return /* @__PURE__ */ import_react83.default.createElement(import_swr8.SWRConfig, { value: defaultSWRConfig }, /* @__PURE__ */ import_react83.default.createElement(
|
|
8464
8818
|
LayerContext.Provider,
|
|
8465
8819
|
{
|
|
8466
8820
|
value: { ...state, setTheme, getColor, setLightColor, setDarkColor, setColors }
|
|
@@ -8470,53 +8824,53 @@ var LayerProvider = ({
|
|
|
8470
8824
|
};
|
|
8471
8825
|
|
|
8472
8826
|
// src/views/AccountingOverview/AccountingOverview.tsx
|
|
8473
|
-
var
|
|
8827
|
+
var import_react86 = __toESM(require("react"));
|
|
8474
8828
|
|
|
8475
8829
|
// src/components/View/View.tsx
|
|
8476
|
-
var
|
|
8830
|
+
var import_react85 = __toESM(require("react"));
|
|
8477
8831
|
|
|
8478
8832
|
// src/components/ViewHeader/ViewHeader.tsx
|
|
8479
|
-
var
|
|
8833
|
+
var import_react84 = __toESM(require("react"));
|
|
8480
8834
|
var ViewHeader = ({ title, controls }) => {
|
|
8481
|
-
return /* @__PURE__ */
|
|
8835
|
+
return /* @__PURE__ */ import_react84.default.createElement("div", { className: "Layer__view-header" }, /* @__PURE__ */ import_react84.default.createElement("div", { className: "Layer__view-header__content" }, /* @__PURE__ */ import_react84.default.createElement(Heading, null, title), controls && /* @__PURE__ */ import_react84.default.createElement("div", { className: "Layer__view-header__controls" }, controls)));
|
|
8482
8836
|
};
|
|
8483
8837
|
|
|
8484
8838
|
// src/components/View/View.tsx
|
|
8485
8839
|
var View6 = ({ title, children, headerControls }) => {
|
|
8486
8840
|
const { theme } = useLayerContext();
|
|
8487
8841
|
const styles = parseStylesFromThemeConfig(theme);
|
|
8488
|
-
return /* @__PURE__ */
|
|
8842
|
+
return /* @__PURE__ */ import_react85.default.createElement("div", { className: "Layer__view", style: { ...styles } }, /* @__PURE__ */ import_react85.default.createElement(ViewHeader, { title, controls: headerControls }), /* @__PURE__ */ import_react85.default.createElement("div", { className: "Layer__view-main" }, children));
|
|
8489
8843
|
};
|
|
8490
8844
|
|
|
8491
8845
|
// src/views/AccountingOverview/AccountingOverview.tsx
|
|
8492
8846
|
var AccountingOverview = ({
|
|
8493
8847
|
title = "Accounting overview"
|
|
8494
8848
|
}) => {
|
|
8495
|
-
return /* @__PURE__ */
|
|
8849
|
+
return /* @__PURE__ */ import_react86.default.createElement(ProfitAndLoss, { asContainer: false }, /* @__PURE__ */ import_react86.default.createElement(View6, { title, headerControls: /* @__PURE__ */ import_react86.default.createElement(ProfitAndLoss.DatePicker, null) }, /* @__PURE__ */ import_react86.default.createElement(ProfitAndLoss.Summaries, { actionable: false }), /* @__PURE__ */ import_react86.default.createElement(
|
|
8496
8850
|
Container,
|
|
8497
8851
|
{
|
|
8498
8852
|
name: "accounting-overview-profit-and-loss",
|
|
8499
8853
|
asWidget: true,
|
|
8500
8854
|
elevated: true
|
|
8501
8855
|
},
|
|
8502
|
-
/* @__PURE__ */
|
|
8503
|
-
/* @__PURE__ */
|
|
8504
|
-
), /* @__PURE__ */
|
|
8856
|
+
/* @__PURE__ */ import_react86.default.createElement(Header, null, /* @__PURE__ */ import_react86.default.createElement(Heading, { size: "secondary" /* secondary */ }, "Profit & Loss")),
|
|
8857
|
+
/* @__PURE__ */ import_react86.default.createElement(ProfitAndLoss.Chart, null)
|
|
8858
|
+
), /* @__PURE__ */ import_react86.default.createElement("div", { className: "accounting-overview-profit-and-loss-charts" }, /* @__PURE__ */ import_react86.default.createElement(Container, { name: "accounting-overview-profit-and-loss-chart" }, /* @__PURE__ */ import_react86.default.createElement(ProfitAndLoss.DetailedCharts, { scope: "revenue", hideClose: true })), /* @__PURE__ */ import_react86.default.createElement(Container, { name: "accounting-overview-profit-and-loss-chart" }, /* @__PURE__ */ import_react86.default.createElement(ProfitAndLoss.DetailedCharts, { scope: "expenses", hideClose: true })))));
|
|
8505
8859
|
};
|
|
8506
8860
|
|
|
8507
8861
|
// src/views/BankTransactionsWithLinkedAccounts/BankTransactionsWithLinkedAccounts.tsx
|
|
8508
|
-
var
|
|
8862
|
+
var import_react87 = __toESM(require("react"));
|
|
8509
8863
|
var BankTransactionsWithLinkedAccounts = ({
|
|
8510
8864
|
title = "Bank transactions"
|
|
8511
8865
|
}) => {
|
|
8512
|
-
return /* @__PURE__ */
|
|
8866
|
+
return /* @__PURE__ */ import_react87.default.createElement(View6, { title }, /* @__PURE__ */ import_react87.default.createElement(LinkedAccounts, { elevated: true }), /* @__PURE__ */ import_react87.default.createElement(BankTransactions, { asWidget: true }));
|
|
8513
8867
|
};
|
|
8514
8868
|
|
|
8515
8869
|
// src/views/Reports/Reports.tsx
|
|
8516
|
-
var
|
|
8870
|
+
var import_react88 = __toESM(require("react"));
|
|
8517
8871
|
var Reports = ({ title = "Reports" }) => {
|
|
8518
|
-
const containerRef = (0,
|
|
8519
|
-
return /* @__PURE__ */
|
|
8872
|
+
const containerRef = (0, import_react88.useRef)(null);
|
|
8873
|
+
return /* @__PURE__ */ import_react88.default.createElement(ProfitAndLoss, { asContainer: false }, /* @__PURE__ */ import_react88.default.createElement(View6, { title, headerControls: /* @__PURE__ */ import_react88.default.createElement(ProfitAndLoss.DatePicker, null) }, /* @__PURE__ */ import_react88.default.createElement(
|
|
8520
8874
|
Toggle,
|
|
8521
8875
|
{
|
|
8522
8876
|
name: "reports-tabs",
|
|
@@ -8534,18 +8888,18 @@ var Reports = ({ title = "Reports" }) => {
|
|
|
8534
8888
|
selected: "profitAndLoss",
|
|
8535
8889
|
onChange: () => null
|
|
8536
8890
|
}
|
|
8537
|
-
), /* @__PURE__ */
|
|
8891
|
+
), /* @__PURE__ */ import_react88.default.createElement(Container, { name: "reports", ref: containerRef }, /* @__PURE__ */ import_react88.default.createElement(ReportsPanel, { containerRef }))));
|
|
8538
8892
|
};
|
|
8539
8893
|
var ReportsPanel = ({ containerRef }) => {
|
|
8540
|
-
const { sidebarScope } = (0,
|
|
8541
|
-
return /* @__PURE__ */
|
|
8894
|
+
const { sidebarScope } = (0, import_react88.useContext)(ProfitAndLoss.Context);
|
|
8895
|
+
return /* @__PURE__ */ import_react88.default.createElement(
|
|
8542
8896
|
Panel,
|
|
8543
8897
|
{
|
|
8544
|
-
sidebar: /* @__PURE__ */
|
|
8898
|
+
sidebar: /* @__PURE__ */ import_react88.default.createElement(ProfitAndLoss.DetailedCharts, null),
|
|
8545
8899
|
sidebarIsOpen: Boolean(sidebarScope),
|
|
8546
8900
|
parentRef: containerRef
|
|
8547
8901
|
},
|
|
8548
|
-
/* @__PURE__ */
|
|
8902
|
+
/* @__PURE__ */ import_react88.default.createElement(ProfitAndLoss.Table, { asContainer: false })
|
|
8549
8903
|
);
|
|
8550
8904
|
};
|
|
8551
8905
|
// Annotate the CommonJS export names for ESM import in node:
|