@wisemen/wise-invoicing-web 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/{BillingDocumentDetailViewDataProvider-CwonTh2r.js → BillingDocumentDetailViewDataProvider-pePmiXWb.js} +332 -332
  2. package/dist/{BillingDocumentPdf-GWCCjE6F.js → BillingDocumentPdf-Dg5JlQE1.js} +8 -8
  3. package/dist/{CreditNoteDetailViewDataProvider-CaucKK9o.js → CreditNoteDetailViewDataProvider-C-A0jyVr.js} +5 -5
  4. package/dist/{CreditNotePdfViewDataProvider-CDkvm-3m.js → CreditNotePdfViewDataProvider-DNUvFVDj.js} +2 -2
  5. package/dist/{CustomFieldValueText-CC9spLWf.js → CustomFieldValueText-DDQq-975.js} +1 -1
  6. package/dist/{DunningCaseDetailViewDataProvider-1Ui9yqUb.js → DunningCaseDetailViewDataProvider-0WV-7-vg.js} +110 -113
  7. package/dist/DunningCaseOverviewView-CHdzfbhb.js +553 -0
  8. package/dist/{DunningCaseReminderPdfViewDataProvider-CVnr9ge6.js → DunningCaseReminderPdfViewDataProvider-DcM-7ECg.js} +4 -1
  9. package/dist/DunningCaseSendDialog-DBtwr2ue.js +350 -0
  10. package/dist/{InvoiceDetailViewDataProvider-DfRDFCEb.js → InvoiceDetailViewDataProvider-BDL9lAWe.js} +175 -174
  11. package/dist/{InvoiceOverviewViewDataProvider-CNK7H5r2.js → InvoiceOverviewViewDataProvider-B_jrcC_8.js} +54 -54
  12. package/dist/{InvoicePdfView-CrWU8Xa-.js → InvoicePdfView-Bygb-9z6.js} +2 -2
  13. package/dist/{InvoicePdfViewDataProvider-nHZoeRxn.js → InvoicePdfViewDataProvider-nBk3XNrE.js} +2 -2
  14. package/dist/{InvoicePublicPdfViewDataProvider-CXWSg2pq.js → InvoicePublicPdfViewDataProvider-DHJP_-7-.js} +2 -2
  15. package/dist/{IssuerSettingsViewDataProvider-DcA6rgOJ.js → IssuerSettingsViewDataProvider-Dk_Q6w6f.js} +2 -2
  16. package/dist/ReminderSettingsViewDataProvider-CDBjfU7R.js +668 -0
  17. package/dist/{billingDocumentDetail.transformer-tmy9Tf_b.js → billingDocumentDetail.transformer-zMTbka5p.js} +1 -1
  18. package/dist/composables/invoicingConfig.composable.d.ts +0 -2
  19. package/dist/{creditNoteDetail.query-BM2saU0n.js → creditNoteDetail.query-BZqgZRSu.js} +2 -2
  20. package/dist/{documentTitle.composable-D7XA-8iJ.js → documentTitle.composable-CeaFddr1.js} +28 -30
  21. package/dist/{invoicingConfig.composable-AjojW4qE.js → i18n.lib-DUbAMBRb.js} +8 -66
  22. package/dist/index.js +156 -157
  23. package/dist/{invoice.service-PsmVGGTR.js → invoice.service-ChHEtXBA.js} +13 -13
  24. package/dist/{invoiceDeliveryStatus.util-CL8K78pD.js → invoiceDeliveryStatus.util-BsA-MlA3.js} +27 -27
  25. package/dist/{invoiceDetail.query-D2eFdE0j.js → invoiceDetail.query-O_CGvdwg.js} +1 -1
  26. package/dist/invoicingConfig.composable-c6w_aMm1.js +60 -0
  27. package/dist/{issuerSettings.query-d5i7Wd7j.js → issuerSettings.query-RqtrZFaB.js} +1 -1
  28. package/dist/modules/dunning-case/api/queries/dunningCaseIndex.query.d.ts +0 -1
  29. package/dist/modules/dunning-case/use-cases/send/components/DunningCaseBulkSendStat.vue.d.ts +9 -0
  30. package/dist/modules/dunning-case/use-cases/send/components/DunningCaseBulkSendSummary.vue.d.ts +8 -0
  31. package/dist/modules/dunning-case/use-cases/send/components/DunningCaseSendFeeRow.vue.d.ts +8 -0
  32. package/dist/modules/dunning-case/use-cases/send/components/DunningCaseSendInvoiceRow.vue.d.ts +8 -0
  33. package/dist/modules/dunning-case/use-cases/send/components/DunningCaseSendInvoiceSummary.vue.d.ts +8 -0
  34. package/dist/modules/dunning-case/use-cases/send/components/DunningCaseSendRecipientAlert.vue.d.ts +7 -0
  35. package/dist/modules/dunning-case/use-cases/send/composables/dunningCaseReminderSubject.composable.d.ts +6 -0
  36. package/dist/modules/dunning-case/use-cases/send/composables/dunningCaseSendRecipient.composable.d.ts +16 -0
  37. package/dist/modules/dunning-case/use-cases/send/utils/dunningCaseSend.util.d.ts +13 -0
  38. package/dist/modules/dunning-case/use-cases/settings/components/ReminderLadderFeeNotice.vue.d.ts +3 -0
  39. package/dist/modules/dunning-case/use-cases/settings/components/ReminderLadderPanel.vue.d.ts +12 -0
  40. package/dist/modules/dunning-case/use-cases/settings/components/ReminderLadderRow.vue.d.ts +26 -0
  41. package/dist/modules/dunning-case/use-cases/settings/components/ReminderLadderTimeline.vue.d.ts +13 -0
  42. package/dist/modules/dunning-case/use-cases/settings/components/ReminderTemplateTabs.vue.d.ts +20 -0
  43. package/dist/modules/dunning-case/use-cases/settings/components/ReminderTemplatesPanel.vue.d.ts +24 -0
  44. package/dist/modules/dunning-case/use-cases/settings/composables/reminderLadder.composable.d.ts +41 -0
  45. package/dist/{reminderConfig.query-C7I3M2pu.js → reminderConfig.query-DzTN2AvU.js} +87 -100
  46. package/package.json +1 -1
  47. package/dist/DunningCaseOverviewView-Bvwaj4_y.js +0 -507
  48. package/dist/PermissionGuard-DDw-lDGL.js +0 -301
  49. package/dist/ReminderSettingsViewDataProvider-C4qz2Rli.js +0 -502
  50. package/dist/composables/permission-guard/permissionGuard.composable.d.ts +0 -4
  51. package/dist/modules/dunning-case/api/queries/dunningCaseIndex.query.spec.d.ts +0 -1
  52. package/dist/ui/permission-guard/PermissionGuard.vue.d.ts +0 -22
@@ -1,301 +0,0 @@
1
- import { n as e } from "./invoicingConfig.composable-AjojW4qE.js";
2
- import { R as t, t as n, z as r } from "./api.util-Dm_TQedZ.js";
3
- import { v as i } from "./documentTitle.composable-D7XA-8iJ.js";
4
- import { r as a } from "./useCurrencyFormat.composable-MtZaqKnO.js";
5
- import { a as o, n as ee, r as s, t as c } from "./reminderConfig.query-C7I3M2pu.js";
6
- import { d as l, k as u, nt as d, q as f } from "./dist-DP8KNFVD.js";
7
- import { t as te } from "./customerUuid.model-GUFYq3O2.js";
8
- import { useRouter as ne } from "vue-router";
9
- import { z as p } from "zod";
10
- import { useI18n as m } from "vue-i18n";
11
- import { Fragment as h, computed as g, createBlock as _, createCommentVNode as v, createElementBlock as y, createElementVNode as b, createTextVNode as x, createVNode as S, defineComponent as C, normalizeClass as w, openBlock as T, ref as E, renderList as re, renderSlot as D, toDisplayString as O, unref as k, watch as A, withCtx as j } from "vue";
12
- import { useMutation as M, useQuery as N } from "@wisemen/vue-core-api-utils";
13
- import { Temporal as P } from "temporal-polyfill";
14
- import { err as F, ok as I } from "neverthrow";
15
- import { UIBadge as L, UIColumnLayout as ie, UIDialogBody as ae, UIDialogFooter as oe, UIDialogFooterCancel as se, UIDialogFooterPrimary as ce, UIDialogHeader as le, UIFormDialog as ue, useToast as R } from "@wisemen/vue-core-design-system";
16
- import { useForm as z } from "formango";
17
- //#region src/modules/dunning-case/api/services/dunningCaseCustomer.service.ts
18
- var B = class {
19
- static async getAll(e, r) {
20
- return (await n.fromPromise(t({ query: {
21
- pagination: r,
22
- search: e
23
- } }))).map((e) => ({
24
- data: e.data.items.map((e) => ({
25
- uuid: e.uuid,
26
- name: e.name
27
- })),
28
- meta: e.data.meta
29
- }));
30
- }
31
- static async getRecipients(e) {
32
- let t = [], i = 0, a = 0;
33
- do {
34
- let o = await n.fromPromise(r({
35
- query: { pagination: {
36
- limit: 100,
37
- offset: i
38
- } },
39
- path: { uuid: e }
40
- }));
41
- if (o.isErr()) return F(o.error);
42
- if (t.push(...o.value.data.items.map((e) => ({
43
- isDefault: e.isDefault,
44
- email: e.email
45
- }))), a = o.value.data.meta.total, i += o.value.data.items.length, o.value.data.items.length === 0) break;
46
- } while (i < a);
47
- return I(t);
48
- }
49
- static async getUuidByExternalId(e) {
50
- return (await n.fromPromise(t({ query: {
51
- filter: { externalId: e },
52
- pagination: {
53
- limit: 1,
54
- offset: 0
55
- }
56
- } }))).map((e) => e.data.items[0]?.uuid ?? null);
57
- }
58
- }, V = 3e4;
59
- function H(e) {
60
- let t = o();
61
- return N("dunningCaseDetail", {
62
- staleTime: V,
63
- isEnabled: g(() => t.has(i.DUNNING_CASE_READ)),
64
- params: { dunningCaseUuid: e },
65
- queryFn: () => s.getByUuid(e.value)
66
- });
67
- }
68
- //#endregion
69
- //#region src/modules/dunning-case/components/DunningCaseReminderStatusIndicator.vue?vue&type=script&setup=true&lang.ts
70
- var U = {
71
- key: 2,
72
- class: "inline-flex items-center gap-xs text-xs text-secondary",
73
- role: "status"
74
- }, W = /* @__PURE__ */ C({
75
- __name: "DunningCaseReminderStatusIndicator",
76
- props: {
77
- blockedReason: {},
78
- status: {}
79
- },
80
- setup(e) {
81
- let t = e, n = m(), r = {
82
- icon: f,
83
- type: "icon"
84
- };
85
- return (e, i) => t.blockedReason === null ? t.status === "failed" ? (T(), _(k(L), {
86
- key: 1,
87
- label: k(n).t("module.dunning_case.reminder_status.failed"),
88
- left: r,
89
- color: "warning",
90
- size: "sm",
91
- variant: "translucent"
92
- }, null, 8, ["label"])) : t.status === "sending" ? (T(), y("span", U, [S(k(u), { class: "size-(--spacing-md) animate-spin motion-reduce:animate-none" }), x(" " + O(k(n).t("module.dunning_case.reminder_status.sending")), 1)])) : v("", !0) : (T(), _(k(L), {
93
- key: 0,
94
- label: k(n).t(`module.dunning_case.blocked_reason.${t.blockedReason}`),
95
- left: r,
96
- color: "error",
97
- size: "sm",
98
- variant: "translucent"
99
- }, null, 8, ["label"]));
100
- }
101
- });
102
- p.uuid().brand("DunningCaseUuid");
103
- function G(e) {
104
- return e === null ? "none" : e.hasErrors ? "failed" : e.sentAt === null ? "sending" : "sent";
105
- }
106
- function K(e, t) {
107
- return [
108
- 0,
109
- 1,
110
- 2,
111
- 3
112
- ].map((n) => e.filter((e) => !e.isDisputed && e.level === n).reduce((e, t) => ({
113
- ...e,
114
- amount: e.amount + t.balanceDueAmount.amount
115
- }), {
116
- ...t,
117
- amount: 0
118
- }));
119
- }
120
- //#endregion
121
- //#region src/modules/dunning-case/api/mutations/dunningCaseSend.mutation.ts
122
- function de() {
123
- return M({
124
- queryFn: (e) => s.send(e.params.dunningCaseUuid),
125
- queryKeysToInvalidate: {
126
- dunningCaseDetail: { dunningCaseUuid: (e) => e.dunningCaseUuid },
127
- dunningCaseIndex: {}
128
- }
129
- });
130
- }
131
- //#endregion
132
- //#region src/modules/dunning-case/use-cases/send/utils/dunningCaseSend.util.ts
133
- function q(e) {
134
- return !e.isDisputed && P.PlainDate.compare(e.dueOn, P.Now.plainDateISO()) < 0;
135
- }
136
- function fe(e) {
137
- return e.filter(q);
138
- }
139
- //#endregion
140
- //#region src/modules/dunning-case/use-cases/send/dialogs/DunningCaseSendDialog.vue?vue&type=script&setup=true&lang.ts
141
- var pe = {
142
- key: 0,
143
- class: "text-sm text-secondary"
144
- }, me = {
145
- key: 0,
146
- class: "rounded-md border border-secondary bg-secondary p-md"
147
- }, he = { class: "text-sm text-error-primary" }, ge = { class: "w-full overflow-hidden rounded-md border border-secondary bg-primary shadow-xs" }, _e = { class: "flex items-start justify-between gap-lg border-b border-secondary px-lg py-md" }, ve = { class: "min-w-0" }, ye = { class: "text-sm font-semibold text-primary" }, be = { class: "shrink-0" }, xe = { class: "max-h-72 overflow-y-auto border-b border-secondary" }, Se = {
148
- key: 0,
149
- class: "flex items-center justify-between gap-lg px-lg py-xs"
150
- }, Ce = { class: "text-xs text-secondary" }, we = { class: "font-mono text-xs font-medium text-primary tabular-nums" }, Te = { class: "min-w-0" }, Ee = { class: "flex min-w-0 items-center gap-sm" }, De = { class: "font-mono text-sm font-medium text-primary" }, Oe = {
151
- key: 0,
152
- class: "truncate text-xs text-error-primary"
153
- }, ke = {
154
- key: 1,
155
- class: "truncate text-xs text-secondary"
156
- }, Ae = {
157
- key: 2,
158
- class: "flex shrink-0 gap-xxs"
159
- }, je = { class: "font-mono text-xs font-medium text-primary tabular-nums" }, Me = {
160
- key: 0,
161
- class: "flex items-center justify-between gap-lg px-lg py-xs"
162
- }, J = { class: "text-xs text-secondary" }, Ne = { class: "font-mono text-xs font-medium text-primary tabular-nums" }, Pe = { class: "flex items-center justify-between gap-xl bg-secondary px-lg py-md" }, Fe = { class: "text-sm font-medium text-primary" }, Ie = { class: "font-mono text-xl font-semibold text-primary tabular-nums" }, Le = { class: "flex w-full items-start gap-md rounded-md bg-secondary px-lg py-md text-secondary" }, Re = { class: "text-xs/relaxed" }, Y = /* @__PURE__ */ C({
163
- __name: "DunningCaseSendDialog",
164
- props: {
165
- dunningCaseUuid: {},
166
- onSent: { type: Function }
167
- },
168
- emits: ["close"],
169
- setup(t, { emit: n }) {
170
- let r = t, s = n, u = m(), f = R(), C = a(), D = e(), M = o(), N = ne(), F = de(), I = H(g(() => r.dunningCaseUuid)), V = c(), U = E(void 0), W = E(!0), G = g(() => I.result.value.isOk() ? I.result.value.getValue() : null), K = g(() => {
171
- let e = G.value?.customer.uuid;
172
- return e === void 0 ? null : D.getCustomerDetailRoute(e);
173
- });
174
- function q(e) {
175
- return e === "fr-BE" || e === "nl-BE" ? e : "en-US";
176
- }
177
- let Y = g(() => {
178
- let e = G.value;
179
- if (e === null || !V.result.value.isOk()) return null;
180
- let t = V.result.value.getValue().find((t) => t.sequence === e.level);
181
- return t === void 0 ? null : t.template[q(u.locale.value)].subject || null;
182
- }), X = g(() => G.value === null ? [] : fe(G.value.invoices)), Z = g(() => {
183
- let e = G.value;
184
- return e === null ? -1 : e.invoices.findIndex((e) => !e.isDisputed && Q(e.dueOn));
185
- });
186
- function Q(e) {
187
- return P.PlainDate.compare(e, P.Now.plainDateISO()) >= 0;
188
- }
189
- function ze() {
190
- K.value !== null && N.push(K.value);
191
- }
192
- let Be = g(() => typeof U.value == "string" ? u.t("module.dunning_case.send.grouped_to", { email: U.value }) : U.value === null ? u.t("module.dunning_case.send.no_default_recipient") : u.t("module.dunning_case.send.description")), $ = z({
193
- schema: p.object({}),
194
- onSubmit: async () => {
195
- if (U.value === null) {
196
- f.show({ message: u.t("module.dunning_case.send.no_default_recipient_blocked") });
197
- return;
198
- }
199
- let e = await F.execute({ params: { dunningCaseUuid: r.dunningCaseUuid } });
200
- if (e.isErr()) {
201
- f.apiError(e.error);
202
- return;
203
- }
204
- f.show({ message: u.t("module.dunning_case.send.success", { customer: G.value?.customer.name ?? "" }) }), r.onSent?.(), s("close");
205
- }
206
- });
207
- return A(G, async (e) => {
208
- if (U.value = void 0, W.value = !0, e === null) return;
209
- if (!M.has(i.RECIPIENT_READ)) {
210
- W.value = !1;
211
- return;
212
- }
213
- let t = await B.getRecipients(te.parse(e.customer.uuid));
214
- if (t.isErr()) {
215
- W.value = !1;
216
- return;
217
- }
218
- U.value = t.value.find((e) => e.isDefault)?.email ?? null, W.value = !1;
219
- }, { immediate: !0 }), (e, t) => (T(), _(k(ue), {
220
- form: k($),
221
- size: "lg",
222
- onClose: t[0] ||= (e) => s("close")
223
- }, {
224
- default: j(() => [
225
- S(k(le), {
226
- title: k(u).t("module.dunning_case.send.title", {
227
- customer: G.value?.customer.name ?? "",
228
- level: G.value?.level ?? ""
229
- }),
230
- description: Be.value,
231
- "has-separator": !1,
232
- icon: k(d)
233
- }, null, 8, [
234
- "title",
235
- "description",
236
- "icon"
237
- ]),
238
- S(k(ae), null, {
239
- default: j(() => [S(k(ie), { gap: "lg" }, {
240
- default: j(() => [k(I).isLoading.value ? (T(), y("p", pe, O(k(u).t("module.dunning_case.common.loading")), 1)) : G.value === null ? v("", !0) : (T(), y(h, { key: 1 }, [
241
- U.value === null ? (T(), y("div", me, [b("p", he, [x(O(k(u).t("module.dunning_case.send.no_default_recipient_description")) + " ", 1), K.value === null ? v("", !0) : (T(), y("button", {
242
- key: 0,
243
- class: "font-medium underline hover:no-underline",
244
- type: "button",
245
- onClick: ze
246
- }, O(k(u).t("module.dunning_case.send.open_customer")), 1))])])) : v("", !0),
247
- b("section", ge, [
248
- b("div", _e, [b("div", ve, [b("p", ye, O(Y.value ?? k(u).t("module.dunning_case.detail.invoices")), 1)]), b("span", be, [S(k(L), {
249
- label: G.value.level === 0 ? k(u).t("module.dunning_case.level.none") : k(u).t("module.dunning_case.level.reminder", { level: G.value.level }),
250
- color: "gray",
251
- size: "sm",
252
- variant: "translucent"
253
- }, null, 8, ["label"])])]),
254
- b("div", xe, [(T(!0), y(h, null, re(G.value.invoices, (e, t) => (T(), y(h, { key: e.uuid }, [G.value.totalFee.amount > 0 && Z.value === t ? (T(), y("dl", Se, [b("dt", Ce, O(k(u).t("module.dunning_case.detail.reminder_fee")) + " · " + O(k(u).t("module.dunning_case.level.reminder", { level: G.value.level })), 1), b("dd", we, O(k(C).formatMonetary(G.value.totalFee)), 1)])) : v("", !0), b("div", { class: w([{ "border-t border-secondary": Z.value === t }, "grid grid-cols-[minmax(0,1fr)_auto] items-center gap-lg px-lg py-xs"]) }, [b("div", Te, [b("div", Ee, [b("p", De, O(e.sequence), 1), e.isDisputed ? (T(), y("span", Oe, " · " + O(k(u).t("module.dunning_case.detail.protested")), 1)) : Q(e.dueOn) ? (T(), y("span", ke, " (" + O(k(u).t("module.dunning_case.send.not_yet_due")) + ") ", 1)) : (T(), y("span", Ae, [S(ee, {
255
- level: e.level,
256
- size: "sm"
257
- }, null, 8, ["level"])]))])]), b("p", je, O(e.isDisputed ? "—" : k(C).formatMonetary(e.balanceDueAmount)), 1)], 2)], 64))), 128)), G.value.totalFee.amount > 0 && Z.value === -1 ? (T(), y("dl", Me, [b("dt", J, O(k(u).t("module.dunning_case.detail.reminder_fee")) + " · " + O(k(u).t("module.dunning_case.level.reminder", { level: G.value.level })), 1), b("dd", Ne, O(k(C).formatMonetary(G.value.totalFee)), 1)])) : v("", !0)]),
258
- b("dl", Pe, [b("dt", Fe, O(k(u).t("module.dunning_case.send.outstanding_balance")), 1), b("dd", Ie, O(k(C).formatMonetary(G.value.outstandingBalance)), 1)])
259
- ]),
260
- b("div", Le, [S(k(l), { class: "mt-xxs size-(--spacing-xl) shrink-0" }), b("p", Re, O(k(u).t("module.dunning_case.send.impact", {
261
- count: X.value.length,
262
- level: G.value.level
263
- })), 1)])
264
- ], 64))]),
265
- _: 1
266
- })]),
267
- _: 1
268
- }),
269
- S(k(oe), { "has-separator": !1 }, {
270
- right: j(() => [S(k(se)), S(k(ce), {
271
- "icon-right": k(d),
272
- "is-disabled": G.value === null || W.value || U.value === null,
273
- "is-loading": k($).isSubmitting.value,
274
- label: k(u).t("module.dunning_case.send.send_now"),
275
- onClick: k($).submit
276
- }, null, 8, [
277
- "icon-right",
278
- "is-disabled",
279
- "is-loading",
280
- "label",
281
- "onClick"
282
- ])]),
283
- _: 1
284
- })
285
- ]),
286
- _: 1
287
- }, 8, ["form"]));
288
- }
289
- }), X = /* @__PURE__ */ C({
290
- __name: "PermissionGuard",
291
- props: {
292
- match: { default: "any" },
293
- permission: {}
294
- },
295
- setup(e) {
296
- let t = e, n = o();
297
- return (e, r) => k(n).has(t.permission, t.match) ? D(e.$slots, "default", {}, void 0, void 0, 0) : D(e.$slots, "fallback", {}, void 0, void 0, 1);
298
- }
299
- });
300
- //#endregion
301
- export { W as a, G as i, Y as n, H as o, K as r, B as s, X as t };